[saga] 01/01: Imported Upstream version 2.2.0+dfsg

Johan Van de Wauw johanvdw-guest at moszumanska.debian.org
Mon Jul 6 18:31:49 UTC 2015


This is an automated email from the git hooks/post-receive script.

johanvdw-guest pushed a commit to annotated tag upstream/2.2.0+dfsg
in repository saga.

commit ad2f178bb2ec26ef2f944fcfaa30fb4f580d485a
Author: Johan Van de Wauw <johan.vandewauw at gmail.com>
Date:   Mon Jul 6 14:16:42 2015 +0200

    Imported Upstream version 2.2.0+dfsg
---
 ChangeLog                                          | 11700 +------------------
 README                                             |     2 +-
 configure                                          |    23 +-
 configure.ac                                       |     7 +-
 .../climate/climate_tools/MLB_Interface.cpp        |     5 +-
 src/modules/climate/climate_tools/Makefile.in      |    15 +-
 .../climate/climate_tools/etp_hargreave.cpp        |   293 +-
 src/modules/climate/climate_tools/etp_hargreave.h  |    38 +-
 src/modules/contrib/contrib_peregro/Makefile.in    |    15 +-
 src/modules/db/db_odbc/Makefile.in                 |    15 +-
 src/modules/db/db_pgsql/Makefile.in                |    15 +-
 src/modules/db/db_pgsql/db_pgsql.cpp               |     2 +-
 src/modules/docs/docs_html/CreateWebContent.cpp    |     2 +-
 src/modules/docs/docs_html/Makefile.in             |    15 +-
 src/modules/docs/docs_pdf/Makefile.in              |    15 +-
 src/modules/docs/docs_pdf/Shapes_Summary.cpp       |     2 +-
 .../garden_3d_viewer/3d_viewer_globe_grid.cpp      |    31 +-
 .../garden/garden_3d_viewer/3d_viewer_shapes.cpp   |     4 +-
 src/modules/garden/garden_3d_viewer/Makefile.in    |    15 +-
 src/modules/garden/garden_fractals/Makefile.in     |    15 +-
 src/modules/garden/garden_games/Makefile.in        |    15 +-
 .../garden/garden_learn_to_program/Makefile.in     |    15 +-
 src/modules/garden/garden_webservices/Makefile.in  |    15 +-
 .../garden/garden_webservices/osm_import.cpp       |    10 +-
 .../garden/garden_webservices/wms_import.cpp       |    21 +-
 .../grid_analysis/Grid_Accumulation_Functions.cpp  |     4 +-
 src/modules/grid/grid_analysis/MLB_Interface.cpp   |     3 +-
 src/modules/grid/grid_analysis/Makefile.in         |    15 +-
 src/modules/grid/grid_analysis/Soil_Texture.cpp    |   436 +-
 src/modules/grid/grid_analysis/Soil_Texture.h      |    21 +-
 src/modules/grid/grid_calculus/Grid_Calculator.cpp |   183 +-
 src/modules/grid/grid_calculus/Grid_Calculator.h   |     5 +-
 .../grid/grid_calculus/Grid_Random_Terrain.cpp     |   244 +-
 .../grid/grid_calculus/Grid_Random_Terrain.h       |    53 +-
 src/modules/grid/grid_calculus/Makefile.in         |    95 +-
 src/modules/grid/grid_calculus_bsl/Makefile.in     |    15 +-
 src/modules/grid/grid_calculus_bsl/ausdruck.cpp    |     3 +-
 src/modules/grid/grid_calculus_bsl/basistypen.cpp  |     3 +-
 src/modules/grid/grid_filter/Filter_Majority.cpp   |    77 +-
 src/modules/grid/grid_filter/Filter_Majority.h     |     8 +-
 src/modules/grid/grid_filter/Filter_Rank.cpp       |    33 +-
 src/modules/grid/grid_filter/Makefile.in           |    99 +-
 .../grid/grid_filter/geodesic_morph_rec/geovinc.c  |    13 +-
 src/modules/grid/grid_filter/geomrec.cpp           |     8 +-
 src/modules/grid/grid_gridding/Interpolation.cpp   |    16 +-
 src/modules/grid/grid_gridding/Interpolation.h     |     5 +-
 .../Interpolation_AngularDistance.cpp              |   184 +-
 .../grid_gridding/Interpolation_AngularDistance.h  |    14 +-
 .../Interpolation_InverseDistance.cpp              |   190 +-
 .../grid_gridding/Interpolation_InverseDistance.h  |    16 +-
 .../Interpolation_NaturalNeighbour.cpp             |     4 +-
 .../Interpolation_NearestNeighbour.cpp             |    21 +-
 .../grid_gridding/Interpolation_NearestNeighbour.h |    12 +-
 src/modules/grid/grid_gridding/Makefile.in         |   131 +-
 src/modules/grid/grid_gridding/Shapes2Grid.cpp     |     8 +-
 src/modules/grid/grid_gridding/kernel_density.cpp  |     4 +-
 .../grid/grid_spline/Gridding_Spline_Base.cpp      |    12 +-
 .../grid/grid_spline/Gridding_Spline_CSA.cpp       |    24 +-
 src/modules/grid/grid_spline/Gridding_Spline_CSA.h |     4 +-
 .../grid/grid_spline/Gridding_Spline_TPS_Local.cpp |   180 +-
 .../grid/grid_spline/Gridding_Spline_TPS_Local.h   |    21 +-
 .../grid/grid_spline/Gridding_Spline_TPS_TIN.cpp   |   125 +-
 .../grid/grid_spline/Gridding_Spline_TPS_TIN.h     |    11 +-
 .../MBASpline_for_Categories.cpp}                  |   190 +-
 ...ine_TPS_Global.h => MBASpline_for_Categories.h} |    39 +-
 src/modules/grid/grid_spline/MLB_Interface.cpp     |    13 +-
 src/modules/grid/grid_spline/Makefile.am           |     6 +-
 src/modules/grid/grid_spline/Makefile.in           |    42 +-
 src/modules/grid/grid_tools/Grid_Fill.cpp          |     4 +-
 src/modules/grid/grid_tools/Grid_Merge.cpp         |    20 +-
 src/modules/grid/grid_tools/Grid_Resample.cpp      |   112 +-
 src/modules/grid/grid_tools/Grid_SortRaster.cpp    |     4 +-
 .../grid_tools/Grid_Support_Tool_Chains.cpp}       |    83 +-
 .../Grid_Support_Tool_Chains.h}                    |    34 +-
 src/modules/grid/grid_tools/MLB_Interface.cpp      |     5 +-
 src/modules/grid/grid_tools/Makefile.am            |     4 +-
 src/modules/grid/grid_tools/Makefile.in            |    29 +-
 .../grid_visualisation/Grid_LUT_Assign.cpp}        |    73 +-
 .../Grid_LUT_Assign.h}                             |    32 +-
 .../grid/grid_visualisation/Grid_RGB_Composite.cpp |     3 +-
 .../grid/grid_visualisation/Grid_Terrain_Map.cpp   |     7 +-
 .../grid/grid_visualisation/MLB_Interface.cpp      |     8 +-
 src/modules/grid/grid_visualisation/Makefile.am    |     4 +-
 src/modules/grid/grid_visualisation/Makefile.in    |    24 +-
 src/modules/imagery/Makefile.am                    |     2 +-
 src/modules/imagery/Makefile.in                    |     2 +-
 .../imagery_classification/MLB_Interface.cpp       |     8 +-
 .../imagery/imagery_classification/Makefile.in     |    15 +-
 .../classify_cluster_analysis.cpp                  |     3 +-
 .../imagery_classification/classify_supervised.cpp |   483 +-
 .../imagery_classification/classify_supervised.h   |    17 +-
 .../classify_supervised_polygons.cpp               |   470 +-
 .../classify_supervised_polygons.h                 |    24 +-
 .../imagery_maxent}/MLB_Interface.cpp              |   265 +-
 .../imagery_maxent}/MLB_Interface.h                |   106 +-
 src/modules/imagery/imagery_maxent/Makefile.am     |    30 +
 .../{imagery_svm => imagery_maxent}/Makefile.in    |    68 +-
 .../imagery/imagery_maxent/classify_grid.cpp       |   771 ++
 .../imagery_maxent/classify_grid.h}                |   288 +-
 src/modules/imagery/imagery_maxent/lbfgs.cpp       |   110 +
 src/modules/imagery/imagery_maxent/lbfgs.h         |    21 +
 src/modules/imagery/imagery_maxent/mathvec.h       |    97 +
 src/modules/imagery/imagery_maxent/maxent.cpp      |   698 ++
 src/modules/imagery/imagery_maxent/maxent.h        |   396 +
 src/modules/imagery/imagery_maxent/me.cpp          |   274 +
 src/modules/imagery/imagery_maxent/me.h            |   203 +
 src/modules/imagery/imagery_maxent/owlqn.cpp       |   136 +
 .../imagery/imagery_maxent/presence_prediction.cpp |   641 +
 .../imagery_maxent/presence_prediction.h}          |   286 +-
 src/modules/imagery/imagery_maxent/sgd.cpp         |   179 +
 src/modules/imagery/imagery_opencv/Makefile.in     |    15 +-
 .../imagery/imagery_opencv/opencv_fourier.cpp      |     1 -
 .../imagery/imagery_photogrammetry/Makefile.in     |    15 +-
 .../imagery/imagery_segmentation/Makefile.in       |    15 +-
 .../imagery_segmentation/skeletonization.cpp       |    14 +-
 src/modules/imagery/imagery_svm/Makefile.in        |    15 +-
 src/modules/imagery/imagery_svm/svm.cpp            |  3089 +++++
 src/modules/imagery/imagery_svm/svm.h              |   101 +
 src/modules/imagery/imagery_tools/Makefile.in      |    15 +-
 .../imagery/imagery_tools/landsat_import.cpp       |     4 +-
 .../imagery/imagery_tools/landsat_toar_core.cpp    |     6 +-
 .../imagery/imagery_tools/pansharpening.cpp        |   134 +-
 .../imagery/imagery_vigra/MLB_Interface.cpp        |     5 +-
 src/modules/imagery/imagery_vigra/Makefile.in      |    15 +-
 .../imagery/imagery_vigra/vigra_random_forest.cpp  |   764 +-
 .../imagery/imagery_vigra/vigra_random_forest.h    |    33 +
 src/modules/io/io_esri_e00/Makefile.in             |   106 +-
 src/modules/io/io_gdal/Makefile.in                 |    15 +-
 src/modules/io/io_gdal/gdal_driver.cpp             |   141 +-
 src/modules/io/io_gdal/gdal_driver.h               |     7 +-
 src/modules/io/io_gdal/gdal_import.cpp             |   166 +-
 src/modules/io/io_gdal/gdal_import.h               |     2 -
 src/modules/io/io_gdal/gdal_import_netcdf.cpp      |    46 +
 src/modules/io/io_gdal/ogr_driver.cpp              |    78 +-
 src/modules/io/io_gdal/ogr_driver.h                |    20 +-
 src/modules/io/io_gps/Makefile.in                  |    15 +-
 src/modules/io/io_grid/MLB_Interface.cpp           |    26 +-
 src/modules/io/io_grid/Makefile.am                 |     2 +
 src/modules/io/io_grid/Makefile.in                 |    23 +-
 .../io_grid/import_clip_resample.cpp}              |   342 +-
 .../io_grid/import_clip_resample.h}                |    36 +-
 src/modules/io/io_grid/raw.cpp                     |     2 +-
 src/modules/io/io_grid/wrf.cpp                     |     4 +-
 src/modules/io/io_grid_grib2/Makefile.in           |   564 +-
 src/modules/io/io_grid_image/Makefile.in           |    15 +-
 src/modules/io/io_grid_image/grid_export.cpp       |    68 +-
 src/modules/io/io_grid_image/grid_to_kml.cpp       |   154 +-
 src/modules/io/io_shapes/Makefile.in               |    15 +-
 src/modules/io/io_shapes_dxf/Makefile.in           |    55 +-
 src/modules/io/io_shapes_las/Makefile.in           |    15 +-
 src/modules/io/io_shapes_las/las_export.cpp        |     1 +
 src/modules/io/io_table/Makefile.in                |    15 +-
 src/modules/io/io_table/io_table_txt.cpp           |   184 +-
 src/modules/io/io_virtual/MLB_Interface.cpp        |     4 +-
 src/modules/io/io_virtual/Makefile.am              |     6 +-
 src/modules/io/io_virtual/Makefile.in              |    25 +-
 src/modules/io/io_virtual/pc_create_spcvf.cpp      |    99 +-
 src/modules/io/io_virtual/pc_get_grid_spcvf.cpp    |   203 +-
 src/modules/io/io_virtual/pc_get_grid_spcvf.h      |    13 +-
 src/modules/io/io_virtual/pc_get_subset_spcvf.cpp  |   424 +-
 src/modules/io/io_virtual/pc_get_subset_spcvf.h    |    20 +-
 ..._spcvf.cpp => pc_remove_overlap_from_spcvf.cpp} |   131 +-
 .../io_virtual/pc_remove_overlap_from_spcvf.h}     |    47 +-
 .../io/io_virtual/pc_tileshape_from_spcvf.cpp      |    81 +-
 .../pointcloud/pointcloud_tools/Makefile.in        |    15 +-
 src/modules/pointcloud/pointcloud_tools/pc_cut.cpp |   162 +-
 src/modules/pointcloud/pointcloud_tools/pc_cut.h   |    14 +-
 .../pointcloud/pointcloud_viewer/Makefile.in       |    15 +-
 .../projection/pj_georeference/MLB_Interface.cpp   |     1 +
 src/modules/projection/pj_georeference/Makefile.in |    15 +-
 .../pj_georeference/direct_georeferencing.cpp      |   399 +-
 .../pj_georeference/direct_georeferencing.h        |    57 +-
 src/modules/projection/pj_proj4/MLB_Interface.cpp  |    42 +-
 src/modules/projection/pj_proj4/Makefile.am        |     4 +-
 src/modules/projection/pj_proj4/Makefile.in        |    29 +-
 src/modules/projection/pj_proj4/PROJ4_Grid.cpp     |     4 +-
 src/modules/projection/pj_proj4/crs_base.cpp       |    40 +-
 src/modules/projection/pj_proj4/crs_distance.cpp   |   524 +
 .../pj_proj4/crs_distance.h}                       |   131 +-
 .../shapes/shapes_grid/Grid_Polygon_Clip.cpp       |     4 +-
 .../shapes_grid/Grid_Statistics_AddTo_Polygon.cpp  |   274 +-
 .../shapes_grid/Grid_Statistics_AddTo_Polygon.h    |    10 +-
 .../shapes_grid/Grid_Statistics_For_Points.cpp     |   338 +
 .../shapes_grid/Grid_Statistics_For_Points.h}      |    30 +-
 src/modules/shapes/shapes_grid/Grid_To_Contour.cpp |   707 +-
 src/modules/shapes/shapes_grid/Grid_To_Contour.h   |    27 +-
 src/modules/shapes/shapes_grid/MLB_Interface.cpp   |     7 +-
 src/modules/shapes/shapes_grid/Makefile.am         |     4 +-
 src/modules/shapes/shapes_grid/Makefile.in         |    28 +-
 src/modules/shapes/shapes_lines/MLB_Interface.cpp  |    10 +-
 src/modules/shapes/shapes_lines/Makefile.am        |     2 +
 src/modules/shapes/shapes_lines/Makefile.in        |    20 +-
 src/modules/shapes/shapes_lines/line_smoothing.cpp |   729 ++
 .../shapes_lines/line_smoothing.h}                 |    52 +-
 src/modules/shapes/shapes_points/Makefile.in       |    15 +-
 .../shapes/shapes_points/Points_From_Lines.cpp     |    38 +-
 .../shapes/shapes_points/remove_duplicates.cpp     |     6 +-
 src/modules/shapes/shapes_polygons/Makefile.in     |    15 +-
 .../shapes/shapes_tools/CreateChartLayer.cpp       |    32 +-
 src/modules/shapes/shapes_tools/CreateChartLayer.h |     6 +-
 .../shapes/shapes_tools/LandUse_Scenario.cpp       |   433 +
 .../shapes_tools/LandUse_Scenario.h}               |    81 +-
 src/modules/shapes/shapes_tools/MLB_Interface.cpp  |     6 +-
 src/modules/shapes/shapes_tools/Makefile.am        |     4 +-
 src/modules/shapes/shapes_tools/Makefile.in        |    22 +-
 .../shapes/shapes_tools/Shapes_Create_Empty.cpp    |    72 +-
 .../shapes/shapes_tools/TransformShapes.cpp        |   167 +-
 src/modules/shapes/shapes_tools/TransformShapes.h  |     3 +-
 src/modules/shapes/shapes_transect/Makefile.in     |    15 +-
 .../simulation/sim_cellular_automata/Makefile.in   |    15 +-
 .../simulation/sim_ecosystems_hugget/Makefile.in   |    15 +-
 .../simulation/sim_erosion/MLB_Interface.cpp       |     6 +-
 src/modules/simulation/sim_erosion/MLB_Interface.h |     2 +-
 src/modules/simulation/sim_erosion/MMF_SAGA.cpp    |   338 +-
 src/modules/simulation/sim_erosion/MMF_SAGA.h      |     5 +-
 src/modules/simulation/sim_erosion/Makefile.in     |    15 +-
 .../simulation/sim_hydrology/MLB_Interface.cpp     |    38 +-
 src/modules/simulation/sim_hydrology/Makefile.am   |     2 +
 src/modules/simulation/sim_hydrology/Makefile.in   |    24 +-
 .../sim_hydrology/diffuse_pollution_risk.cpp       |   495 +
 .../sim_hydrology/diffuse_pollution_risk.h}        |   232 +-
 src/modules/simulation/sim_ihacres/Makefile.in     |    15 +-
 src/modules/simulation/sim_ihacres/ihacres_eq.cpp  |    12 +-
 src/modules/statistics/statistics_grid/Makefile.in |    15 +-
 .../statistics_kriging/MLB_Interface.cpp           |    27 +-
 .../statistics/statistics_kriging/Makefile.am      |    18 +-
 .../statistics/statistics_kriging/Makefile.in      |    52 +-
 .../statistics_kriging/_kriging_base.cpp           |   522 -
 .../statistics/statistics_kriging/_kriging_base.h  |   142 -
 .../statistics_kriging/_kriging_ordinary.cpp       |   236 -
 .../_kriging_ordinary_global.cpp                   |   226 -
 .../statistics_kriging/_kriging_universal.cpp      |   260 -
 .../statistics_kriging/_kriging_universal.h        |   118 -
 .../_kriging_universal_global.cpp                  |   282 -
 .../statistics_kriging/_kriging_universal_global.h |   118 -
 .../statistics/statistics_kriging/kriging_base.cpp |   131 +-
 .../statistics/statistics_kriging/kriging_base.h   |    53 +-
 .../statistics_kriging/kriging_ordinary.cpp        |   160 +-
 .../statistics_kriging/kriging_ordinary.h          |    19 +-
 .../statistics_kriging/kriging_regression.cpp      |   405 +
 ...ging_ordinary_global.h => kriging_regression.h} |    34 +-
 ...ging_ordinary_global.cpp => kriging_simple.cpp} |   111 +-
 ...{kriging_ordinary_global.h => kriging_simple.h} |    31 +-
 .../statistics_kriging/kriging_universal.cpp       |   201 +-
 .../statistics_kriging/kriging_universal.h         |    16 +-
 .../statistics_kriging/kriging_universal_global.h  |   125 -
 .../statistics_kriging/semivariogram.cpp           |    10 +-
 .../statistics_kriging/variogram_dialog.cpp        |    15 +-
 .../statistics_kriging/variogram_dialog.h          |     4 +-
 .../statistics/statistics_points/Makefile.in       |    15 +-
 .../statistics_regression/MLB_Interface.cpp        |    41 +
 .../statistics_regression/MLB_Interface.h          |    24 +
 .../statistics/statistics_regression/Makefile.am   |     2 +
 .../statistics/statistics_regression/Makefile.in   |    22 +-
 .../grid_multi_grid_regression.cpp                 |    94 +-
 .../grid_multi_grid_regression.h                   |     8 +-
 .../statistics_regression/gw_multi_regression.cpp  |   277 +-
 .../statistics_regression/gw_multi_regression.h    |    37 +-
 .../gw_multi_regression_grid.cpp                   |   302 +-
 .../gw_multi_regression_grid.h                     |    37 +-
 .../gw_multi_regression_points.cpp                 |   279 +-
 .../gw_multi_regression_points.h                   |    33 +-
 .../statistics_regression/gw_regression.cpp        |   212 +-
 .../statistics_regression/gw_regression.h          |    30 +-
 .../statistics_regression/gw_regression_grid.cpp   |   263 +-
 .../statistics_regression/gw_regression_grid.h     |    27 +-
 .../statistics_regression/gwr_grid_downscaling.cpp |   138 +-
 .../statistics_regression/gwr_grid_downscaling.h   |    21 +-
 .../point_grid_regression.cpp                      |    22 +-
 .../point_multi_grid_regression.cpp                |   185 +-
 .../point_multi_grid_regression.h                  |     4 +-
 .../statistics_regression/point_trend_surface.cpp  |     6 +-
 .../point_zonal_multi_grid_regression.cpp          |   368 +
 .../point_zonal_multi_grid_regression.h}           |    42 +-
 .../table_regression_multiple.cpp                  |    26 +-
 src/modules/table/table_calculus/Fit.cpp           |     4 +-
 src/modules/table/table_calculus/MLB_Interface.cpp |    11 +-
 src/modules/table/table_calculus/Makefile.am       |     4 +-
 src/modules/table/table_calculus/Makefile.in       |    25 +-
 .../table_calculus/table_cluster_analysis.cpp      |    10 +-
 .../table_calculus/table_field_statistics.cpp}     |   181 +-
 .../table_calculus/table_field_statistics.h}       |    63 +-
 src/modules/table/table_tools/Join_Tables.cpp      |     6 +-
 src/modules/table/table_tools/Join_Tables.h        |     4 +-
 src/modules/table/table_tools/MLB_Interface.cpp    |     9 +-
 src/modules/table/table_tools/Makefile.am          |     4 +-
 src/modules/table/table_tools/Makefile.in          |    29 +-
 .../table/table_tools/Table_Create_Empty.cpp       |    74 +-
 .../table_categories_to_indicators.cpp}            |   237 +-
 ...replacer.h => table_categories_to_indicators.h} |    23 +-
 .../table/table_tools/table_text_replacer.cpp      |    11 +-
 .../table/table_tools/table_text_replacer.h        |     2 +-
 .../ta_channels/ChannelNetwork.cpp                 |     2 +-
 .../terrain_analysis/ta_channels/ChannelNetwork.h  |     2 +-
 .../ta_channels/ChannelNetwork_Altitude.cpp        |     4 +-
 .../ta_channels/ChannelNetwork_Altitude.h          |     2 +-
 .../ta_channels/ChannelNetwork_Distance.cpp        |     2 +-
 .../ta_channels/ChannelNetwork_Distance.h          |     2 +-
 .../ta_channels/D8_Flow_Analysis.cpp               |     2 +-
 .../ta_channels/D8_Flow_Analysis.h                 |     2 +-
 .../terrain_analysis/ta_channels/MLB_Interface.cpp |     6 +-
 .../terrain_analysis/ta_channels/MLB_Interface.h   |     2 +-
 .../terrain_analysis/ta_channels/Makefile.in       |    15 +-
 .../terrain_analysis/ta_channels/Strahler.cpp      |     2 +-
 .../terrain_analysis/ta_channels/Strahler.h        |     2 +-
 .../terrain_analysis/ta_channels/Watersheds.cpp    |     4 +-
 .../terrain_analysis/ta_channels/Watersheds.h      |     2 +-
 .../ta_channels/Watersheds_ext.cpp                 |     2 +-
 .../terrain_analysis/ta_channels/Watersheds_ext.h  |     2 +-
 .../terrain_analysis/ta_compound/Makefile.in       |    15 +-
 .../terrain_analysis/ta_compound/TA_Standard.cpp   |     2 +-
 .../ta_hydrology/EdgeContamination.h               |     2 +-
 src/modules/terrain_analysis/ta_hydrology/Flow.cpp |    28 +-
 src/modules/terrain_analysis/ta_hydrology/Flow.h   |     4 +-
 .../ta_hydrology/Flow_AreaDownslope.h              |     2 +-
 .../ta_hydrology/Flow_AreaUpslope.h                |     4 +-
 .../terrain_analysis/ta_hydrology/Flow_Distance.h  |     2 +-
 .../ta_hydrology/Flow_Parallel.cpp                 |    22 +-
 .../ta_hydrology/Flow_RecursiveDown.cpp            |     2 +-
 .../ta_hydrology/Flow_RecursiveUp.cpp              |    48 +-
 .../terrain_analysis/ta_hydrology/Helper.cpp       |    13 +
 src/modules/terrain_analysis/ta_hydrology/Helper.h |     1 +
 .../ta_hydrology/IsochronesConst.cpp               |   169 +-
 .../ta_hydrology/IsochronesConst.h                 |     6 +-
 .../ta_hydrology/IsochronesVar.cpp                 |   310 +-
 .../terrain_analysis/ta_hydrology/IsochronesVar.h  |     6 +-
 .../terrain_analysis/ta_hydrology/Makefile.in      |    15 +-
 .../ta_hydrology/SAGA_Wetness_Index.cpp            |   129 +-
 .../terrain_analysis/ta_hydrology/flow_by_slope.h  |     2 +-
 .../ta_hydrology/flow_massflux.cpp                 |     4 +-
 .../terrain_analysis/ta_hydrology/flow_massflux.h  |     2 +-
 .../terrain_analysis/ta_hydrology/flow_width.h     |     2 +-
 .../terrain_analysis/ta_lighting/Makefile.in       |    15 +-
 .../ta_morphometry/Curvature_UpDownSlope.cpp       |   331 +
 .../Curvature_UpDownSlope.h}                       |   235 +-
 .../ta_morphometry/MLB_Interface.cpp               |    26 +-
 .../terrain_analysis/ta_morphometry/Makefile.am    |     2 +
 .../terrain_analysis/ta_morphometry/Makefile.in    |    26 +-
 .../ta_morphometry/param_scale.cpp                 |     6 +-
 .../terrain_analysis/ta_morphometry/param_scale.h  |   230 +-
 .../ta_morphometry/relative_heights.cpp            |   264 +-
 .../terrain_analysis/ta_preprocessor/Makefile.in   |    15 +-
 .../ta_preprocessor/Pit_Eliminator.cpp             |     3 +-
 .../terrain_analysis/ta_profiles/Makefile.in       |    15 +-
 .../ta_slope_stability/Makefile.in                 |    15 +-
 src/modules/tin/tin_tools/Makefile.in              |    15 +-
 src/modules/tin/tin_viewer/Makefile.in             |    15 +-
 src/saga_core/saga_api/Makefile.am                 |     3 +-
 src/saga_core/saga_api/Makefile.in                 |    48 +-
 src/saga_core/saga_api/api_callback.cpp            |    22 +-
 src/saga_core/saga_api/api_core.h                  |    11 +-
 src/saga_core/saga_api/api_file.cpp                |    33 +-
 src/saga_core/saga_api/geo_tools.h                 |     9 +-
 src/saga_core/saga_api/grid.cpp                    |   139 +-
 src/saga_core/saga_api/grid.h                      |    12 +-
 src/saga_core/saga_api/grid_system.cpp             |   121 +-
 src/saga_core/saga_api/mat_formula.cpp             |    72 +-
 src/saga_core/saga_api/mat_matrix.cpp              |   153 +-
 src/saga_core/saga_api/mat_regression_weighted.cpp |   332 +
 src/saga_core/saga_api/mat_tools.cpp               |   734 +-
 src/saga_core/saga_api/mat_tools.h                 |   150 +-
 src/saga_core/saga_api/module.cpp                  |    62 +-
 src/saga_core/saga_api/module.h                    |    15 +-
 src/saga_core/saga_api/module_chain.cpp            |   347 +-
 src/saga_core/saga_api/module_chain.h              |    10 +-
 src/saga_core/saga_api/module_library.cpp          |    66 +-
 src/saga_core/saga_api/module_library.h            |    22 +-
 .../saga_api/module_library_interface.cpp          |    26 +-
 src/saga_core/saga_api/parameter.cpp               |   106 +-
 src/saga_core/saga_api/parameter_data.cpp          |     7 +-
 src/saga_core/saga_api/parameters.cpp              |    33 +-
 src/saga_core/saga_api/parameters.h                |    14 +-
 src/saga_core/saga_api/pointcloud.cpp              |    96 +-
 src/saga_core/saga_api/quadtree.cpp                |   287 +-
 src/saga_core/saga_api/saga_api.h                  |     6 +-
 src/saga_core/saga_api/shape_points.cpp            |    28 +-
 src/saga_core/saga_api/shapes.h                    |    60 +-
 src/saga_core/saga_api/table.h                     |     8 +-
 src/saga_core/saga_api/table_record.cpp            |    36 +-
 src/saga_core/saga_api/table_value.h               |   122 +-
 src/saga_core/saga_cmd/Makefile.in                 |    15 +-
 src/saga_core/saga_cmd/module_library.cpp          |    47 +-
 src/saga_core/saga_cmd/saga_cmd.cpp                |    18 +-
 src/saga_core/saga_gdi/3d_view_canvas.cpp          |     6 +-
 src/saga_core/saga_gdi/3d_view_panel.cpp           |    14 +-
 src/saga_core/saga_gdi/3d_view_projector.cpp       |    18 +-
 src/saga_core/saga_gdi/3d_view_tools.h             |     8 +-
 src/saga_core/saga_gdi/Makefile.in                 |    15 +-
 src/saga_core/saga_gui/Makefile.in                 |    15 +-
 src/saga_core/saga_gui/dlg_about.cpp               |    10 +-
 src/saga_core/saga_gui/dlg_list_base.cpp           |     4 +-
 src/saga_core/saga_gui/helper.cpp                  |    70 +-
 src/saga_core/saga_gui/info_messages.cpp           |    53 +-
 src/saga_core/saga_gui/info_messages.h             |    10 +-
 src/saga_core/saga_gui/project.cpp                 |    80 +-
 src/saga_core/saga_gui/res/tool_menus.xml          |   734 ++
 src/saga_core/saga_gui/res/tool_menus_example.xml  |   120 +
 src/saga_core/saga_gui/res_commands.cpp            |     6 +-
 src/saga_core/saga_gui/res_commands.h              |     4 +-
 src/saga_core/saga_gui/res_dialogs.cpp             |    65 +-
 src/saga_core/saga_gui/saga.cpp                    |    40 +-
 src/saga_core/saga_gui/saga_frame.cpp              |     4 +-
 src/saga_core/saga_gui/view_histogram.cpp          |     8 +-
 src/saga_core/saga_gui/view_map_3d.cpp             |    67 +-
 src/saga_core/saga_gui/view_map_control.cpp        |    77 +-
 src/saga_core/saga_gui/view_table_control.cpp      |  2429 ++--
 src/saga_core/saga_gui/wksp.cpp                    |     3 +-
 src/saga_core/saga_gui/wksp_base_control.cpp       |    33 +-
 src/saga_core/saga_gui/wksp_base_item.cpp          |     6 +-
 src/saga_core/saga_gui/wksp_data_manager.cpp       |   115 +-
 src/saga_core/saga_gui/wksp_data_manager.h         |     4 +-
 src/saga_core/saga_gui/wksp_data_menu_file.cpp     |     3 +-
 src/saga_core/saga_gui/wksp_grid.cpp               |   183 +-
 src/saga_core/saga_gui/wksp_grid.h                 |    10 +-
 src/saga_core/saga_gui/wksp_layer_classify.cpp     |    30 +-
 src/saga_core/saga_gui/wksp_layer_classify.h       |     8 +-
 src/saga_core/saga_gui/wksp_map.cpp                |    30 +-
 src/saga_core/saga_gui/wksp_map_layer.cpp          |    11 +-
 src/saga_core/saga_gui/wksp_module.cpp             |   461 +-
 src/saga_core/saga_gui/wksp_module.h               |    16 +-
 src/saga_core/saga_gui/wksp_module_library.cpp     |     7 +-
 src/saga_core/saga_gui/wksp_module_manager.cpp     |    58 +-
 src/saga_core/saga_gui/wksp_module_menu.cpp        |   111 +-
 src/saga_core/saga_gui/wksp_module_menu.h          |     4 +-
 src/saga_core/saga_gui/wksp_shapes.cpp             |    18 +-
 425 files changed, 26312 insertions(+), 24695 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0fe1f7f..bb5c135 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11700 +1,4 @@
-2012-06-12 13:41  manfred-e
+Changelogs and other release information are available in the SAGA wiki:
 
-	* src/saga_core/saga_api/module.cpp: saga_api: fix gcc build error
-
-2012-06-08 10:29  oconrad
-
-	* src/modules/grid/grid_tools/Grid_Merge.cpp,
-	  src/modules/grid/grid_tools/Grid_Merge.h: grid_tools, mosaicking:
-	  renamed from 'merge grids', new options added for overlapping
-	  areas (min, max, mean, feathering/blending)
-
-2012-06-07 15:35  oconrad
-
-	* src/saga_core/saga_gui/project.cpp,
-	  src/saga_core/saga_gui/project.h: saga_gui, project: versioning
-	  added (backward compatility, choosing correct symbology for
-	  rgb-coded grids)
-
-2012-06-07 15:33  oconrad
-
-	* src/saga_core/saga_api/parameter.cpp,
-	  src/saga_core/saga_api/parameters.h: saga_api,
-	  CSG_Parameters_Grid_Target: alternative init_user() function
-	  added
-
-2012-06-06 14:33  oconrad
-
-	* src/saga_core/saga_api/module.cpp,
-	  src/saga_core/saga_api/module.h,
-	  src/saga_core/saga_api/module_library.cpp,
-	  src/saga_core/saga_api/module_library.h,
-	  src/saga_core/saga_cmd/saga_cmd.cpp,
-	  src/saga_core/saga_gui/res_commands.cpp,
-	  src/saga_core/saga_gui/res_commands.h,
-	  src/saga_core/saga_gui/wksp_module.cpp,
-	  src/saga_core/saga_gui/wksp_module_manager.cpp: saga_api,
-	  saga_cmd, saga_gui: creating module documentation files. related
-	  to saga-gis-developer mailing list thread:
-	  http://sourceforge.net/mailarchive/forum.php?thread_name=4FCEF035.3010604%40faunalia.it&forum_name=saga-gis-developer
-
-2012-06-04 15:48  oconrad
-
-	* src/saga_core/saga_gui/wksp_grid.cpp,
-	  src/saga_core/saga_gui/wksp_grid.h: saga_gui, drawing grids:
-	  multi-processor support not for file-cached/compressed grids
-
-2012-06-04 15:46  oconrad
-
-	* src/saga_core/saga_api/shapes_polygons.cpp: saga_api, polygon
-	  clipping: precision bug
-
-2012-06-04 09:43  reklov_w
-
-	* src/modules_io/gdal/io_gdal/gdal_driver.cpp: io_gdal,
-	  gdal_driver: fix unicode issue in message output of gdal error
-	  message
-
-2012-06-01 15:13  oconrad
-
-	* src/modules/shapes/shapes_tools/shapes_buffer.cpp,
-	  src/modules/shapes/shapes_tools/shapes_buffer.h: shapes_buffer:
-	  bug fixes and improvements, using polygon offset method of
-	  clipper library
-
-2012-06-01 10:56  oconrad
-
-	* src/modules/shapes/shapes_tools/shapes_buffer.cpp,
-	  src/modules/shapes/shapes_tools/shapes_buffer.h: shapes_buffer:
-	  bug fixes and improvements, using polygon offset method of
-	  clipper library
-
-2012-06-01 08:43  oconrad
-
-	* src/modules/shapes/shapes_grid/Grid_Polygon_Clip.cpp,
-	  src/modules/shapes/shapes_grid/Grid_Polygon_Clip.h: clip grid
-	  with polygon: 'crop grid to data' is now optionally (disabled by
-	  default)
-
-2012-06-01 08:34  reklov_w
-
-	* src/saga_core/saga_cmd/module_library.cpp: saga_cmd: fix quoting
-	  of parameters (with spaces)
-
-2012-05-31 11:24  oconrad
-
-	* src/saga_core/saga_api/clipper.cpp,
-	  src/saga_core/saga_api/shapes.h,
-	  src/saga_core/saga_api/shapes_polygons.cpp: saga_api, polygon
-	  clipping: simplify and buffer functions added, including a
-	  necessary patch to clipper library (limiting number of vertices
-	  when adding an arc)
-
-2012-05-30 16:52  oconrad
-
-	* src/saga_core/saga_api/geo_functions.cpp: saga_api,
-	  sg_get_crossing(): bug fix, crossing position has not been set
-	  under certain circumstances
-
-2012-05-30 16:51  oconrad
-
-	* src/saga_core/saga_api/clipper.cpp,
-	  src/saga_core/saga_api/clipper.hpp: saga_api, clipper: update to
-	  v4.8.3
-
-2012-05-30 13:48  oconrad
-
-	* src/modules_io/gdal/io_gdal/gdal_import.cpp: io_gdal, import
-	  grid: corrected transformation counter
-
-2012-05-30 13:05  oconrad
-
-	* src/modules/shapes/shapes_grid/Grid_Polygon_Clip.cpp,
-	  src/modules/shapes/shapes_grid/Grid_Polygon_Clip.h: clip grid
-	  with polygon: clip region now also takes respect of no-data
-	  values in supplied grids
-
-2012-05-30 13:04  oconrad
-
-	* src/saga_core/saga_cmd/module_library.cpp: saga_cmd: file names
-	  for output object lists can be specified now, e.g.:
-	  saga_cmd shapes_grid 7 -POLYGONS=buf.shp -INPUT=a;b;c
-	  -OUTPUT=a_buf;b_buf;c_buf
-
-2012-05-30 13:00  oconrad
-
-	* src/saga_core/saga_api/module.h: saga_api, module_grid:
-	  additional grid system functions exposed
-
-2012-05-30 12:59  oconrad
-
-	* src/saga_core/saga_api/mat_tools.cpp,
-	  src/saga_core/saga_api/mat_tools.h: saga_api, math_tools:
-	  sg_get_digit_count(int number) added
-
-2012-05-25 12:52  oconrad
-
-	* src/modules_io/gdal/io_gdal/gdal_import.cpp: gdal_import:
-	  improved transformation options, optionally import only a subset
-	  from multiband grids
-
-2012-05-25 12:32  oconrad
-
-	* src/modules_io/gdal/io_gdal/gdal_driver.cpp,
-	  src/modules_io/gdal/io_gdal/gdal_driver.h,
-	  src/modules_io/gdal/io_gdal/gdal_import.cpp,
-	  src/modules_io/gdal/io_gdal/gdal_import.h: gdal_import: improved
-	  transformation options, optionally import only a subset from
-	  multiband grids
-
-2012-05-25 12:30  oconrad
-
-	* src/saga_core/saga_api/geo_classes.cpp,
-	  src/saga_core/saga_api/geo_tools.h: saga_api, csg_rect: union()
-	  function added that takes a single point (csg_point)
-
-2012-05-25 12:29  oconrad
-
-	* src/saga_core/saga_api/grid.cpp: saga_api, csg_grid: default
-	  no-data value for byte grids set to '0' (instead of '-127')
-
-2012-05-25 08:34  oconrad
-
-	* src/modules/grid/grid_spline/Gridding_Spline_Base.cpp:
-	  multi-level-b-spline: point-loading bug fixed
-
-2012-05-24 06:55  manfred-e
-
-	* src/modules/grid/grid_analysis/Grid_AHP.cpp: modules:
-	  grid_analysis: Analytical Hierarchy Process: calculation fix
-
-2012-05-21 14:22  reklov_w
-
-	* src/modules/pointcloud/pointcloud_tools/pc_reclass_extract.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_reclass_extract.h: PC
-	  Reclassifier/Subset Extractor: optionally create new attribute
-	  with reclassification result
-
-2012-05-14 10:34  reklov_w
-
-	* src/saga_core/saga_api/dataobject.cpp: saga_api: changing default
-	  NoData range of data objects from -99999;-999 to -99999;-99999 in
-	  order to avoid problems with marine data
-
-2012-05-14 10:04  reklov_w
-
-	* src/modules/shapes/shapes_tools/Makefile.am,
-	  src/modules/shapes/shapes_tools/QueryParser.cpp,
-	  src/modules/shapes/shapes_tools/QueryParser.h: shapes_tools: fix
-	  Makefile.am and remove depreciated files
-
-2012-05-14 09:58  oconrad
-
-	* src/saga_core/saga_gui/wksp_table.cpp: saga_gui, wksp_table: bug
-	  fix, parameter initializing
-
-2012-05-11 14:28  oconrad
-
-	* src/saga_core/saga_api/table_io.cpp: saga_api, table_io:
-	  recognizing no-data values loading/saving text tables
-
-2012-05-11 14:27  oconrad
-
-	* src/modules/table/table_tools/Join_Tables.cpp,
-	  src/modules/table/table_tools/Join_Tables.h,
-	  src/modules/table/table_tools/MLB_Interface.cpp: table_tools: a
-	  simple 'append columns from other table' tool
-
-2012-05-11 13:47  reklov_w
-
-	* src/saga_core/saga_gui/wksp_data_manager.cpp: saga_gui: fix error
-	  if saga_gui is closed and saga_gui.cfg file is not existing
-	  ("can't remove file")
-
-2012-05-10 11:37  oconrad
-
-	* src/modules/grid/grid_calculus/Grid_Calculator.cpp: saga_api,
-	  formula parser: get_value() made const, easier usage for parallel
-	  processing
-
-2012-05-10 11:36  oconrad
-
-	* src/modules/grid/grid_calculus/Grid_Plotter.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_attribute_calculator.cpp,
-	  src/modules/table/table_calculus/Fit.cpp,
-	  src/saga_core/saga_api/mat_formula.cpp,
-	  src/saga_core/saga_api/mat_tools.h,
-	  src/saga_core/saga_api/mat_trend.cpp: saga_api, formula parser:
-	  get_value() made const, easier usage for parallel processing
-
-2012-05-10 11:25  reklov_w
-
-	* src/modules_io/shapes/io_shapes/pointcloud_to_text_file.cpp,
-	  src/modules_io/shapes/io_shapes/pointcloud_to_text_file.h: point
-	  cloud to text file: enhancements (speed)
-
-2012-05-10 11:16  oconrad
-
-	* src/saga_core/saga_gui/wksp_pointcloud.cpp: saga_gui, pointcloud:
-	  display correct settings for rgb coded attribute
-
-2012-05-10 10:04  reklov_w
-
-	* src/saga_core/saga_gui/wksp_pointcloud.cpp: saga_gui,
-	  wksp_pointcloud.cpp: fix parameter enable for RGB coloring
-
-2012-05-07 14:23  manfred-e
-
-	* src/modules/grid/grid_analysis/owa.cpp: modules: grid_analysis:
-	  ordered weight average: bug fix (ignored values/grids)
-
-2012-05-03 09:33  reklov_w
-
-	* src/saga_core/saga_cmd/module_library.cpp: saga_cmd /
-	  module_library.cpp: set svn eol keyword and convert to LF
-
-2012-05-03 09:31  reklov_w
-
-	* src/saga_core/saga_cmd/module_library.cpp: saga_cmd: change usage
-	  of wxCommandLineParse (SetCmdLine) to prevent re-setting of
-	  locale; fixes unintended usage of ',' as decimal separator during
-	  argument parsing and module execution
-
-2012-05-02 15:37  oconrad
-
-	* src/modules/grid/grid_gridding/Shapes2Grid.cpp,
-	  src/modules/grid/grid_gridding/Shapes2Grid.h: grid_gridding,
-	  shapes to grid: polygon match for either grid nodes or cells
-	  (latter can be useful for polygon sizes around or less than the
-	  grid cell sizes)
-
-2012-05-02 15:35  oconrad
-
-	* src/modules/grid/grid_tools/Grid_Gaps_Resampling.cpp: grid_tools,
-	  close gaps (resampling): prevent possible non-stop loops
-
-2012-04-27 12:49  oconrad
-
-	* src/saga_core/saga_gui/wksp_layer.cpp: saga_gui/wksp_layer: 'save
-	  as ...' dialog, suggests a file name
-
-2012-04-27 12:47  oconrad
-
-	* src/modules/grid/grid_tools/Grid_Gaps_Resampling.cpp,
-	  src/modules/grid/grid_tools/Grid_Gaps_Resampling.h: 'close gaps
-	  with resampling' module: further options added
-
-2012-04-27 12:45  oconrad
-
-	* src/modules/grid/grid_gridding/Shapes2Grid.cpp,
-	  src/modules/grid/grid_gridding/Shapes2Grid.h: 'shapes2grid'
-	  module: output of just '0/1' (data/no-data) option added (instead
-	  of attribute values)
-
-2012-04-27 12:43  oconrad
-
-	* src/modules/shapes/shapes_tools/shapes_extents.cpp: 'get shapes'
-	  extent' module: get 'total extent' option added
-
-2012-04-26 15:44  oconrad
-
-	* src/dev_tools/dev_tools.vcxproj, src/dev_tools/tl_extract.cpp:
-	  dev_tools: updated to saga 2.1.0
-
-2012-04-26 15:44  oconrad
-
-	* src/modules/grid/grid_tools/Grid_Gaps_Resampling.cpp,
-	  src/modules/grid/grid_tools/Grid_Gaps_Resampling.h,
-	  src/modules/grid/grid_tools/MLB_Interface.cpp,
-	  src/modules/grid/grid_tools/Makefile.am,
-	  src/modules/grid/grid_tools/grid_tools.vcxproj,
-	  src/modules/grid/grid_tools/grid_tools.vcxproj.filters: grid tool
-	  added: close gaps using stepwise resampling
-
-2012-04-26 15:42  oconrad
-
-	* src/saga_core/saga_api/grid.h: saga_api/grid: is_InGrid_byPos(),
-	  optional check for no-data
-
-2012-04-26 15:41  oconrad
-
-	* src/saga_core/saga_api/mat_matrix.cpp,
-	  src/saga_core/saga_api/mat_spline.cpp: saga_api: memory
-	  allocation check
-
-2012-04-26 12:02  reklov_w
-
-	* src/modules/grid/grid_tools/Grid_Tiling.cpp,
-	  src/modules/grid/grid_tools/Grid_Tiling.h: Grid Tools - Tiling:
-	  added possibility to write output (individually) to disk
-
-2012-04-26 11:58  manfred-e
-
-	* src/modules_io/gdal/io_gdal/gdal_driver.cpp,
-	  src/modules_io/gdal/io_gdal/gdal_export.cpp,
-	  src/modules_io/gdal/io_gdal/gdal_export_geotiff.cpp: modules:
-	  io_gdal: improved error handling for raster and geotiff export
-
-2012-04-24 14:02  reklov_w
-
-	* src/modules_io/gdal/io_gdal/gdal_driver.cpp: gdal_driver.cpp: fix
-	  string issue
-
-2012-04-24 11:42  manfred-e
-
-	* src/saga_core/saga_gui/Makefile.am: saga_gui: fixes tracker id
-	  3432061: hardcoded MLIBPATH
-
-2012-04-24 09:44  manfred-e
-
-	* src/modules_io/gdal/io_gdal/gdal_driver.cpp,
-	  src/modules_io/gdal/io_gdal/gdal_driver.h,
-	  src/modules_io/gdal/io_gdal/gdal_export.cpp,
-	  src/modules_io/gdal/io_gdal/gdal_export_geotiff.cpp: modules:
-	  io_gdal: added gdal Creation Options support for raster export
-
-2012-04-24 09:04  oconrad
-
-	* src/modules_io/table/io_table/io_table_txt.cpp: table import
-	  (text): minor bug fix
-
-2012-04-17 14:22  oconrad
-
-	* src/saga_core/saga_cmd/callback.cpp,
-	  src/saga_core/saga_cmd/callback.h,
-	  src/saga_core/saga_cmd/module_library.cpp,
-	  src/saga_core/saga_cmd/module_library.h,
-	  src/saga_core/saga_cmd/saga_cmd.cpp: saga_cmd: solving external
-	  module dependencies (e.g. in ta_compound>basic ta) and some minor
-	  optimizations
-
-2012-04-13 09:54  oconrad
-
-	* src/modules_io/shapes/io_shapes/MLB_Interface.cpp,
-	  src/modules_io/shapes/io_shapes/Makefile.am,
-	  src/modules_io/shapes/io_shapes/io_shapes.vcxproj,
-	  src/modules_io/shapes/io_shapes/io_shapes.vcxproj.filters,
-	  src/modules_io/shapes/io_shapes/wktb.cpp,
-	  src/modules_io/shapes/io_shapes/wktb.h,
-	  src/saga_core/saga_api/shapes_ogis.cpp: added: import/export
-	  simple features, well known text (wkt) format
-
-2012-04-12 08:23  reklov_w
-
-	* src/saga_core/saga_api/geo_functions.cpp: saga_api,
-	  geo_functions, SG_Get_Crossing: fix (avoid) precision issue in
-	  case vertices are identical by explicit test for equality
-
-2012-04-11 17:50  reklov_w
-
-	* src/modules/shapes/shapes_tools/shapes_generate.cpp: generate
-	  shapes module: small bug fix for first id
-
-2012-04-11 17:35  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_morphometry/tc_iwahashi_pike.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/tc_iwahashi_pike.h:
-	  morphometry: terrain classification after iwahashi & pike (2007,
-	  geomorphology)
-
-2012-04-10 21:39  reklov_w
-
-	* src/modules/shapes/shapes_tools/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_tools/Makefile.am,
-	  src/modules/shapes/shapes_tools/shapes_generate.cpp,
-	  src/modules/shapes/shapes_tools/shapes_generate.h,
-	  src/modules/shapes/shapes_tools/shapes_tools.vcxproj,
-	  src/modules/shapes/shapes_tools/shapes_tools.vcxproj.filters: new
-	  module "generate shapes" added to MLB Shapes-Tools: Allows to
-	  generate point, line or polygon shapes from a table with x and y
-	  coordinates and an identifier
-
-2012-04-05 09:55  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_morphometry/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Makefile.am,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/ta_morphometry.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/ta_morphometry.vcxproj.filters,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/tc_iwahashi_pike.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/tc_iwahashi_pike.h:
-	  morphometry: terrain classification after iwahashi & pike (2007,
-	  geomorphology)
-
-2012-04-05 08:42  oconrad
-
-	* src/modules_io/esri_e00/io_esri_e00/ESRI_E00_Import.cpp: e00
-	  import: bug fixes, memory leaks
-
-2012-04-05 08:36  oconrad
-
-	* src/modules_geostatistics/geostatistics/geostatistics_kriging/semivariogram.h:
-	  modules: 'geostatistics' renamed to 'spatial and geostatistics'
-	  (for correctness)
-
-2012-03-30 14:21  oconrad
-
-	* src/modules/grid/grid_filter/Filter_Rank.cpp,
-	  src/modules/grid/grid_filter/Filter_Rank.h: grid_filter/rank
-	  filter: bug fix and performance improvements
-
-2012-03-30 14:20  oconrad
-
-	* src/saga_core/saga_api/grid.h,
-	  src/saga_core/saga_api/grid_system.cpp: saga_api,
-	  grid_cell_adressor: squared 'radius' option added
-
-2012-03-30 14:19  oconrad
-
-	* src/modules_geostatistics/geostatistics/geostatistics_grid/MLB_Interface.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/MLB_Interface.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/MLB_Interface.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/MLB_Interface.cpp:
-	  modules: 'geostatistics' renamed to 'spatial and geostatistics'
-	  (for correctness)
-
-2012-03-29 15:38  oconrad
-
-	* src/saga_core/saga_gui/wksp_grid.cpp,
-	  src/saga_core/saga_gui/wksp_layer.cpp,
-	  src/saga_core/saga_gui/wksp_pointcloud.cpp,
-	  src/saga_core/saga_gui/wksp_shapes.cpp: saga_gui: colour
-	  classification parameters, further enhancements
-
-2012-03-29 15:37  oconrad
-
-	* src/saga_core/saga_gui/dlg_base.cpp,
-	  src/saga_core/saga_gui/dlg_list_grid.cpp: saga_gui: grid list
-	  dialog, grid system selector visibility bug
-
-2012-03-29 09:06  reklov_w
-
-	* src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Zonal_Statistics.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Zonal_Statistics.h:
-	  Zonal Grid Statistics: fix bug 'Zonal Grid Statistics - noData
-	  handling - ID: 3512321' and further improvements
-
-2012-03-28 17:17  oconrad
-
-	* src/modules/table/table_tools/MLB_Interface.cpp,
-	  src/modules/table/table_tools/Makefile.am,
-	  src/modules/table/table_tools/table_change_field_type.cpp,
-	  src/modules/table/table_tools/table_change_field_type.h,
-	  src/modules/table/table_tools/table_tools.vcxproj,
-	  src/modules/table/table_tools/table_tools.vcxproj.filters,
-	  src/saga_core/saga_api/table.cpp,
-	  src/saga_core/saga_api/table_io.cpp,
-	  src/saga_core/saga_gui/helper.cpp,
-	  src/saga_core/saga_gui/res_commands.cpp,
-	  src/saga_core/saga_gui/res_commands.h,
-	  src/saga_core/saga_gui/view_table.cpp,
-	  src/saga_core/saga_gui/view_table.h,
-	  src/saga_core/saga_gui/view_table_control.cpp,
-	  src/saga_core/saga_gui/view_table_control.h: saga_api, saga_gui,
-	  table_tools: change a table field's data type (e.g. from integer
-	  to text)
-
-2012-03-27 16:41  oconrad
-
-	* src/saga_core/saga_gui/active_legend.cpp,
-	  src/saga_core/saga_gui/active_legend.h,
-	  src/saga_core/saga_gui/wksp_grid.cpp,
-	  src/saga_core/saga_gui/wksp_layer.cpp,
-	  src/saga_core/saga_gui/wksp_layer_classify.cpp,
-	  src/saga_core/saga_gui/wksp_layer_classify.h,
-	  src/saga_core/saga_gui/wksp_layer_legend.cpp,
-	  src/saga_core/saga_gui/wksp_layer_legend.h,
-	  src/saga_core/saga_gui/wksp_map.cpp,
-	  src/saga_core/saga_gui/wksp_map.h,
-	  src/saga_core/saga_gui/wksp_pointcloud.cpp,
-	  src/saga_core/saga_gui/wksp_pointcloud.h,
-	  src/saga_core/saga_gui/wksp_shapes.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_line.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_line.h,
-	  src/saga_core/saga_gui/wksp_shapes_point.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_point.h,
-	  src/saga_core/saga_gui/wksp_shapes_polygon.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_polygon.h,
-	  src/saga_core/saga_gui/wksp_tin.cpp,
-	  src/saga_core/saga_gui/wksp_tin.h: saga_gui: colour
-	  classification and legend stuff
-
-2012-03-16 14:03  reklov_w
-
-	* src/saga_core/saga_gui/wksp_grid.cpp: saga_gui, wksp_grid: fix
-	  string issue
-
-2012-03-15 16:54  oconrad
-
-	* src/modules_io/grid/io_grid_image/grid_import.cpp,
-	  src/saga_core/saga_gui/view_histogram.cpp,
-	  src/saga_core/saga_gui/wksp_grid.cpp,
-	  src/saga_core/saga_gui/wksp_layer.cpp,
-	  src/saga_core/saga_gui/wksp_layer_classify.cpp,
-	  src/saga_core/saga_gui/wksp_layer_classify.h,
-	  src/saga_core/saga_gui/wksp_layer_legend.cpp,
-	  src/saga_core/saga_gui/wksp_shapes.cpp: saga_gui:
-	  discrete/graduated colour classification implemented (graduated
-	  now interpolates colours from discrete palette)
-
-2012-03-15 16:51  oconrad
-
-	* src/modules_projection/pj_proj4/pj_proj4/crs_assign.cpp: set
-	  projection: automatic update of description tab (saga_gui)
-
-2012-03-14 10:24  oconrad
-
-	* src/modules/shapes/shapes_polygons/Polygon_SelfIntersection.cpp:
-	  module added: 'self-intersection' for polygons of one layer
-
-2012-03-14 10:03  oconrad
-
-	* src/modules/shapes/shapes_polygons/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_polygons/Makefile.am,
-	  src/modules/shapes/shapes_polygons/Polygon_SelfIntersection.cpp,
-	  src/modules/shapes/shapes_polygons/Polygon_SelfIntersection.h,
-	  src/modules/shapes/shapes_polygons/shapes_polygons.vcxproj,
-	  src/modules/shapes/shapes_polygons/shapes_polygons.vcxproj.filters:
-	  module added: 'self-intersection' for polygons of one layer
-
-2012-03-13 15:02  oconrad
-
-	* src/modules/shapes/shapes_polygons/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_polygons/Makefile.am,
-	  src/modules/shapes/shapes_polygons/Polygon_Clip.cpp,
-	  src/modules/shapes/shapes_polygons/Polygon_Clip.h,
-	  src/modules/shapes/shapes_polygons/shapes_polygons.vcxproj,
-	  src/modules/shapes/shapes_polygons/shapes_polygons.vcxproj.filters:
-	  shapes_polygon: polygon clipping for shapes
-
-2012-03-13 15:00  oconrad
-
-	* src/modules_io/gdal/io_gdal/MLB_Interface.cpp,
-	  src/modules_io/gdal/io_gdal/Makefile.am,
-	  src/modules_io/gdal/io_gdal/io_gdal.vcxproj,
-	  src/modules_io/gdal/io_gdal/io_gdal.vcxproj.filters,
-	  src/modules_io/gdal/io_gdal/ogr_export_kml.cpp,
-	  src/modules_io/gdal/io_gdal/ogr_export_kml.h: io_gdal: kml export
-	  module, including automated projection to geographic coordinates
-
-2012-03-12 16:17  oconrad
-
-	* src/modules_geostatistics/geostatistics/geostatistics_regression/grid_multi_grid_regression.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/point_multi_grid_regression.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/point_multi_grid_regression.h,
-	  src/saga_core/saga_api/mat_regression_multiple.cpp,
-	  src/saga_core/saga_api/mat_tools.h: saga_api,
-	  csg_regression_multiple: optional cross validation added
-
-2012-03-12 16:17  oconrad
-
-	* src/modules_recreations/recreations/recreations_fractals/Grid_FractalDimension.cpp,
-	  src/modules_recreations/recreations/recreations_fractals/Grid_FractalDimension.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/RealArea.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/RealArea.h:
-	  modules, geomorphometry, fractal geometry: surface area
-	  calculation
-
-2012-03-08 17:08  oconrad
-
-	* src/modules/grid/grid_analysis/Grid_CVA.cpp,
-	  src/modules/grid/grid_analysis/Grid_CVA.h: change vector
-	  analysis: reworked and improved
-
-2012-03-06 11:09  reklov_w
-
-	* src/modules_io/shapes/io_shapes_las/las_info.cpp: LAS Info: fix
-	  broken strings in message output (wx2.9 issue)
-
-2012-03-01 08:31  oconrad
-
-	* src/saga_core/saga_gui/res/saga.ger.txt: saga_gui/resources:
-	  updated german tranlation table (many thanx again to juergen
-	  brunke)
-
-2012-02-29 17:57  oconrad
-
-	* src/saga_core/saga_api/quadtree.cpp,
-	  src/saga_core/saga_api/shapes.h: saga_api, quadtree: fixing linux
-	  link error
-
-2012-02-29 15:44  oconrad
-
-	* src/modules_io/gdal/io_gdal/gdal_import.cpp: io_gdal,
-	  gdal_import: bug fix loading subgrids without gui (e.g. netcdf
-	  from saga_cmd)
-
-2012-02-29 10:38  reklov_w
-
-	* src/saga_core/saga_gui/saga.cpp: saga_gui: fix Process_Wait() to
-	  avoid endless loop
-
-2012-02-28 16:31  oconrad
-
-	* src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_base.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_base.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_ordinary.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_ordinary.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_ordinary_global.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_ordinary_global.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_universal.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_universal.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_universal_global.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_universal_global.h:
-	  kriging interpolation: support for parallel processing
-
-2012-02-28 16:30  oconrad
-
-	* src/saga_core/saga_api/mat_formula.cpp,
-	  src/saga_core/saga_api/mat_tools.h: saga_api, formula parser:
-	  support for parallel processing
-
-2012-02-28 16:29  oconrad
-
-	* src/saga_core/saga_api/geo_functions.cpp,
-	  src/saga_core/saga_api/geo_tools.h,
-	  src/saga_core/saga_api/quadtree.cpp,
-	  src/saga_core/saga_api/shapes.h: saga_api, quadtree search
-	  engine: support for polar coordinates and parallel processing
-
-2012-02-21 13:34  reklov_w
-
-	* src/modules/shapes/shapes_polygons/Polygon_Geometrics.cpp:
-	  polygon properties module: bug fix (invalid parameter identifier)
-	  in case optional output is set to [create]
-
-2012-02-21 13:27  reklov_w
-
-	* src/modules/shapes/shapes_polygons/shape_index.cpp: shapes
-	  indices module: bug fix to enable copying of geometry in case
-	  optional output is set to [create]; fix division by zero (area)
-
-2012-02-13 21:07  reklov_w
-
-	* src/saga_core/saga_api/parameters.cpp: saga_api, parameters.cpp:
-	  eliminating gcc compiler warning: ignoring return value of ‘int
-	  fscanf(FILE*, const char*, ...)’ and warning: ‘pParameter’ may be
-	  used uninitialized in this function
-
-2012-02-13 20:38  reklov_w
-
-	* src/saga_core/saga_gui/saga.cpp, src/saga_core/saga_gui/saga.h:
-	  saga_gui: locale setting workaround for wxwidgets 2.9.3, more
-	  comments in the sources.
-
-2012-02-06 09:14  reklov_w
-
-	* src/saga_core/saga_api/parameters.cpp: saga_api,
-	  parameters/Set_Parameter(): add parameter type point cloud
-
-2012-02-03 11:38  oconrad
-
-	* src/modules/shapes/shapes_points/gps_track_aggregation.cpp,
-	  src/modules/shapes/shapes_points/gps_track_aggregation.h:
-	  shapes_point, gps_track_aggregation: enhanced fixed time span
-	  option
-
-2012-02-02 15:24  reklov_w
-
-	* src/saga_core/saga_gui/saga_frame.cpp: saga_gui: fix (wxgtk)
-	  display of scatterplot toolbar on gui startup
-
-2012-02-02 14:15  reklov_w
-
-	* src/saga_core/saga_gui/saga_frame.cpp: saga_gui: fix (wxgtk)
-	  EVT_SIZE of wxMDIParentFrame by explicitly connecting (and
-	  disconnecting) the wxObjectEventFunction. prevented a response
-	  when resizing the main window (no redraw)
-
-2012-02-02 10:49  reklov_w
-
-	* src/saga_core/saga_gui/saga_frame.cpp: saga_gui: fix (wxgtk)
-	  placement of progress bar by temporary hack found in wxwidgets
-	  statbar sample
-
-2012-02-01 10:02  reklov_w
-
-	* src/saga_core/saga_gui/data_source_files.cpp: saga_gui,
-	  CData_Source_Files: fix 'Gtk-CRITICAL **:
-	  gtk_widget_set_size_request: assertion height >= -1 failed'
-	  within wxGenericDirCtrl constructor by setting File Filter
-	  afterwards
-
-2012-01-31 07:33  reklov_w
-
-	* src/saga_core/saga_gui/saga_frame.cpp: saga_gui: fix event
-	  handling of map view toolbar
-
-2012-01-26 16:28  oconrad
-
-	* src/modules/shapes/shapes_polygons/Polygons_From_Lines.cpp: lines
-	  to polygon conversion: optionally as one single multipolygon
-	  object
-
-2012-01-26 13:53  oconrad
-
-	* src/modules/shapes/shapes_points/gps_track_aggregation.cpp,
-	  src/modules/shapes/shapes_points/gps_track_aggregation.h:
-	  shapes_point, gps_track_aggregation: bug fixes, distance
-	  calculation for lat/lon, enhanced time span aggregation
-
-2012-01-26 13:51  oconrad
-
-	* src/saga_core/saga_api/geo_functions.cpp,
-	  src/saga_core/saga_api/geo_tools.h: saga_api, geo_functions: new
-	  function for calculation of distances in polar coordinates
-	  (longitude/latitude)
-
-2012-01-26 13:47  oconrad
-
-	* src/modules_io/table/io_table/io_table_txt.cpp,
-	  src/modules_io/table/io_table/io_table_txt.h: io_table:
-	  CTable_Text_Import_Fixed_Cols, enhanced imput option
-
-2012-01-26 13:44  oconrad
-
-	* src/modules/grid/grid_calculus/Fuzzify.cpp: grid_calculus: bug
-	  fix, fuzzify
-
-2012-01-26 13:43  oconrad
-
-	* src/modules_images/modules_imagery/imagery_classification/MLB_Interface.cpp,
-	  src/modules_images/modules_imagery/imagery_classification/Makefile.am,
-	  src/modules_images/modules_imagery/imagery_classification/classify_supervised_polygons.cpp,
-	  src/modules_images/modules_imagery/imagery_classification/classify_supervised_polygons.h,
-	  src/modules_images/modules_imagery/imagery_classification/imagery_classification.vcxproj,
-	  src/modules_images/modules_imagery/imagery_classification/imagery_classification.vcxproj.filters:
-	  imagery_classification: supervised polygon classification added
-
-2012-01-19 14:46  reklov_w
-
-	* src/modules/shapes/shapes_lines/line_simplification.cpp: line
-	  simplification module: fix corrupt characters in description
-	  string and add parameter descriptions
-
-2012-01-18 11:08  reklov_w
-
-	* src/modules_io/grid/io_grid_image/MLB_Interface.cpp,
-	  src/modules_io/grid/io_grid_image/grid_export.cpp: io_grid_image:
-	  fix duplicate image handlers
-
-2012-01-18 09:57  reklov_w
-
-	* src/saga_core/saga_cmd/module_library.cpp: saga_cmd: fix
-	  parameter setting of cmd line parser in case of strings
-
-2012-01-16 15:46  reklov_w
-
-	* src/saga_core/saga_cmd/callback.cpp: saga_cmd: fix corrupt
-	  message output (callbacks)
-
-2012-01-15 19:05  reklov_w
-
-	* src/saga_core/saga_api/api_core.cpp,
-	  src/saga_core/saga_api/api_core.h,
-	  src/saga_core/saga_cmd/saga_cmd.cpp,
-	  src/saga_core/saga_gui/wksp_module_manager.cpp: saga_api,
-	  saga_gui, saga_cmd: implementation of methods to set and get the
-	  MAX_NUM_THREADS to use with OMP in saga_api, module library
-	  settings in saga_gui and flag for saga_cmd
-
-2012-01-12 15:29  oconrad
-
-	* src/saga_core/saga_api/parameter.cpp: saga_api, parameter:
-	  copying enabled flag on assign()
-
-2012-01-12 15:27  oconrad
-
-	* src/modules_images/modules_imagery/imagery_classification/classify_supervised.cpp,
-	  src/modules_images/modules_imagery/imagery_classification/classify_supervised.h,
-	  src/saga_core/saga_api/mat_tools.cpp,
-	  src/saga_core/saga_api/mat_tools.h: saga_api, module: supervised
-	  classification for grids
-
-2012-01-12 12:25  oconrad
-
-	* src/saga_core/saga_api/mat_tools.cpp,
-	  src/saga_core/saga_api/mat_tools.h: saga_api: new class added for
-	  supervised data classification
-
-2012-01-11 21:48  manfred-e
-
-	* src/modules_io/grid/io_grid_image/grid_export.cpp: modules:
-	  io_grid_images: increased precision for coordinates in word files
-	  and kml files; fixes accuray problem with lat/long projection in
-	  combination with high resolution grids
-
-2012-01-10 09:19  oconrad
-
-	* src/saga_core/saga_api/mat_regression_multiple.cpp: saga_api,
-	  multiple regression: backward regression used a (slightly) wrong
-	  degree of freedom
-
-2012-01-09 14:37  oconrad
-
-	* src/saga_core/saga_api/mat_regression_multiple.cpp: saga_api,
-	  multiple regression: backward regression used a (slightly) wrong
-	  degree of freedom
-
-2012-01-06 13:42  reklov_w
-
-	* src/saga_core/saga_api/parameters.h: saga_api, parameters.h:
-	  revert rev1284 (include of stdint.h causes serious problems under
-	  windows, redefining integer types), and, as problematic method
-	  Set_Value(int Value) is not used at all, simply remove it
-
-2012-01-05 22:54  manfred-e
-
-	* src/modules/grid/grid_gridding/Shapes2Grid.cpp,
-	  src/modules/shapes/shapes_grid/Grid_Polygon_Clip.cpp,
-	  src/modules/shapes/shapes_grid/Grid_Statistics_AddTo_Polygon.cpp:
-	  modules: shapes_grid, grid_gridding: fix for missing last column
-	  in result grids
-
-2012-01-05 14:29  oconrad
-
-	* src/modules_contrib/garden/garden_webservices/garden_webservices.vcxproj:
-	  garden_webservices: compiling mswvc x64 targets (fixed)
-
-2012-01-05 14:08  oconrad
-
-	* src/saga_core/saga_api/module.cpp,
-	  src/saga_core/saga_api/parameter.cpp,
-	  src/saga_core/saga_api/parameter_data.cpp,
-	  src/saga_core/saga_api/parameters.cpp,
-	  src/saga_core/saga_api/parameters.h: saga_api, parameters: bug
-	  fix, creating optional output data
-
-2012-01-04 15:32  oconrad
-
-	* src/modules/shapes/shapes_polygons/Polygon_Union.cpp: module,
-	  polygon dissolve: bug fix (dissolve all)
-
-2012-01-04 14:53  oconrad
-
-	* src/saga_core/saga_api/parameters.cpp: saga_api,
-	  module/parameters: input check depends on how module is managed
-
-2012-01-04 14:52  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_channels/D8_Flow_Analysis.cpp,
-	  src/saga_core/saga_api/table.cpp: saga_api, table: don't allow
-	  empty field names
-
-2012-01-04 13:54  oconrad
-
-	* src/saga_core/saga_gui/parameters_properties.cpp,
-	  src/saga_core/saga_gui/wksp_module_manager.cpp: saga_gui:
-	  combobox (propertygrid) assertion removed, wx to saga string
-	  conversion
-
-2012-01-04 11:18  reklov_w
-
-	* src/saga_core/saga_cmd/saga_cmd.cpp,
-	  src/saga_core/saga_gui/saga.cpp: SAGA GUI, SAGA CMD: set
-	  LC_NUMERIC locale to C in order to assure . as decimal separator
-	  in string operations
-
-2012-01-04 10:59  oconrad
-
-	* src/saga_core/saga_gui/wksp_data_manager.cpp,
-	  src/saga_core/saga_gui/wksp_data_menu_file.cpp: saga_gui: recent
-	  files menu (bug fix)
-
-2012-01-04 10:46  oconrad
-
-	* src/saga_core/saga_api/grid_memory.cpp,
-	  src/saga_core/saga_api/module.cpp,
-	  src/saga_core/saga_api/parameters.cpp: saga_api: prevent modules
-	  to crash on grid memory allocation failure
-
-2012-01-03 10:59  manfred-e
-
-	* src/saga_core/saga_cmd/Makefile.am: saga_cmd: fix default search
-	  path for module libraries on linux
-
-2012-01-03 10:49  manfred-e
-
-	* src/saga_core/saga_api/parameters.h: saga_api: gcc warning
-	  int-to-pointer-cast
-
-2012-01-02 16:01  oconrad
-
-	* src/saga_core/saga_gui/callback.cpp,
-	  src/saga_core/saga_gui/project.cpp,
-	  src/saga_core/saga_gui/project.h,
-	  src/saga_core/saga_gui/view_map_3d_image.cpp,
-	  src/saga_core/saga_gui/view_map_3d_image.h,
-	  src/saga_core/saga_gui/view_table_control.cpp,
-	  src/saga_core/saga_gui/view_table_control.h,
-	  src/saga_core/saga_gui/wksp.cpp, src/saga_core/saga_gui/wksp.h,
-	  src/saga_core/saga_gui/wksp_data_layers.cpp,
-	  src/saga_core/saga_gui/wksp_data_layers.h,
-	  src/saga_core/saga_gui/wksp_data_manager.cpp,
-	  src/saga_core/saga_gui/wksp_data_manager.h,
-	  src/saga_core/saga_gui/wksp_data_menu_file.cpp,
-	  src/saga_core/saga_gui/wksp_data_menu_file.h,
-	  src/saga_core/saga_gui/wksp_grid_manager.cpp,
-	  src/saga_core/saga_gui/wksp_grid_manager.h,
-	  src/saga_core/saga_gui/wksp_map_buttons.cpp,
-	  src/saga_core/saga_gui/wksp_map_buttons.h,
-	  src/saga_core/saga_gui/wksp_module.cpp,
-	  src/saga_core/saga_gui/wksp_module.h,
-	  src/saga_core/saga_gui/wksp_module_manager.cpp,
-	  src/saga_core/saga_gui/wksp_module_manager.h,
-	  src/saga_core/saga_gui/wksp_pointcloud_manager.cpp,
-	  src/saga_core/saga_gui/wksp_pointcloud_manager.h,
-	  src/saga_core/saga_gui/wksp_shapes_manager.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_manager.h,
-	  src/saga_core/saga_gui/wksp_table_manager.cpp,
-	  src/saga_core/saga_gui/wksp_table_manager.h,
-	  src/saga_core/saga_gui/wksp_tin_manager.cpp,
-	  src/saga_core/saga_gui/wksp_tin_manager.h: saga_gui: string
-	  issues
-
-2011-12-29 17:13  manfred-e
-
-	* src/modules_images/modules_vigra/vigra/vigra_distance.cpp,
-	  src/modules_images/modules_vigra/vigra/vigra_edges.cpp,
-	  src/modules_images/modules_vigra/vigra/vigra_fft.cpp,
-	  src/modules_images/modules_vigra/vigra/vigra_morphology.cpp,
-	  src/modules_images/modules_vigra/vigra/vigra_smoothing.cpp,
-	  src/modules_images/modules_vigra/vigra/vigra_watershed.cpp:
-	  modules: vigra: fix wx2.9 string issues (linux)
-
-2011-12-27 13:10  reklov_w
-
-	* src/modules_io/db/io_odbc/table.cpp: io_odbc: fix warning 'taking
-	  address of temporary'
-
-2011-12-27 12:53  reklov_w
-
-	* src/modules_contrib/garden/garden_webservices/wms_import.cpp:
-	  garden_webservices, wms import: fix wx2.9 string issues (warning:
-	  taking address of temporary)
-
-2011-12-27 12:46  reklov_w
-
-	* src/saga_core/saga_gui/helper.cpp,
-	  src/saga_core/saga_gui/parameters_control.cpp,
-	  src/saga_core/saga_gui/parameters_properties.cpp,
-	  src/saga_core/saga_gui/project.cpp,
-	  src/saga_core/saga_gui/view_histogram.cpp,
-	  src/saga_core/saga_gui/view_table_control.cpp,
-	  src/saga_core/saga_gui/wksp_base_control.cpp,
-	  src/saga_core/saga_gui/wksp_grid.cpp,
-	  src/saga_core/saga_gui/wksp_map.cpp: saga_gui: fix wx2.9 string
-	  issues (warning: taking address of temporary)
-
-2011-12-27 11:59  reklov_w
-
-	* src/saga_core/saga_cmd/module_library.cpp,
-	  src/saga_core/saga_cmd/saga_cmd.cpp: saga_cmd: fix wx2.9 string
-	  issues (warning: taking address of temporary, warning: cannot
-	  pass objects of non-POD type ... call will abort at runtime)
-
-2011-12-22 15:48  reklov_w
-
-	* Makefile.am, configure.in, src/dev_tools/Makefile.am,
-	  src/modules/grid/grid_analysis/Makefile.am,
-	  src/modules/grid/grid_calculus/Makefile.am,
-	  src/modules/grid/grid_calculus_bsl/Makefile.am,
-	  src/modules/grid/grid_filter/Makefile.am,
-	  src/modules/grid/grid_gridding/Makefile.am,
-	  src/modules/grid/grid_spline/Makefile.am,
-	  src/modules/grid/grid_tools/Makefile.am,
-	  src/modules/grid/grid_visualisation/Makefile.am,
-	  src/modules/pointcloud/pointcloud_tools/Makefile.am,
-	  src/modules/pointcloud/pointcloud_viewer/Makefile.am,
-	  src/modules/shapes/shapes_grid/Makefile.am,
-	  src/modules/shapes/shapes_lines/Makefile.am,
-	  src/modules/shapes/shapes_lines_ex/Makefile.am,
-	  src/modules/shapes/shapes_points/Makefile.am,
-	  src/modules/shapes/shapes_polygons/Makefile.am,
-	  src/modules/shapes/shapes_tools/Makefile.am,
-	  src/modules/shapes/shapes_transect/Makefile.am,
-	  src/modules/table/table_calculus/Makefile.am,
-	  src/modules/table/table_tools/Makefile.am,
-	  src/modules/tin/tin_tools/Makefile.am,
-	  src/modules/tin/tin_viewer/Makefile.am,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/Makefile.am,
-	  src/modules_contrib/contrib_s_liersch/ihacres/Makefile.am,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/Makefile.am,
-	  src/modules_contrib/garden/garden_3d_viewer/Makefile.am,
-	  src/modules_contrib/garden/garden_webservices/Makefile.am,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/Makefile.am,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/Makefile.am,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/Makefile.am,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/Makefile.am,
-	  src/modules_images/modules_imagery/imagery_classification/Makefile.am,
-	  src/modules_images/modules_imagery/imagery_rga/Makefile.am,
-	  src/modules_images/modules_imagery/imagery_segmentation/Makefile.am,
-	  src/modules_images/modules_imagery/imagery_tools/Makefile.am,
-	  src/modules_images/modules_opencv/opencv/Makefile.am,
-	  src/modules_images/modules_vigra/vigra/Makefile.am,
-	  src/modules_io/db/io_db_mysql/Makefile.am,
-	  src/modules_io/db/io_odbc/Makefile.am,
-	  src/modules_io/docs/docs_html/Makefile.am,
-	  src/modules_io/docs/docs_pdf/Makefile.am,
-	  src/modules_io/esri_e00/io_esri_e00/Makefile.am,
-	  src/modules_io/gdal/io_gdal/Makefile.am,
-	  src/modules_io/gps/io_gps/Makefile.am,
-	  src/modules_io/grid/io_grid/Makefile.am,
-	  src/modules_io/grid/io_grid_grib2/Makefile.am,
-	  src/modules_io/grid/io_grid_image/Makefile.am,
-	  src/modules_io/shapes/io_shapes/Makefile.am,
-	  src/modules_io/shapes/io_shapes_dxf/Makefile.am,
-	  src/modules_io/shapes/io_shapes_las/Makefile.am,
-	  src/modules_io/table/io_table/Makefile.am,
-	  src/modules_lectures/lectures/lectures_introduction/Makefile.am,
-	  src/modules_projection/pj_georeference/pj_georeference/Makefile.am,
-	  src/modules_projection/pj_geotrans/pj_geotrans/Makefile.am,
-	  src/modules_projection/pj_proj4/pj_proj4/Makefile.am,
-	  src/modules_recreations/recreations/recreations_fractals/Makefile.am,
-	  src/modules_recreations/recreations/recreations_games/Makefile.am,
-	  src/modules_simulation/cellular_automata/sim_cellular_automata/Makefile.am,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/Makefile.am,
-	  src/modules_simulation/fire/sim_fire_spreading/Makefile.am,
-	  src/modules_simulation/hydrology/sim_hydrology/Makefile.am,
-	  src/modules_template/Makefile.am,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/Makefile.am,
-	  src/modules_terrain_analysis/terrain_analysis/ta_compound/Makefile.am,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Makefile.am,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/Makefile.am,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Makefile.am,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/Makefile.am,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Makefile.am,
-	  src/saga_core/saga_api/Makefile.am,
-	  src/saga_core/saga_cmd/Makefile.am,
-	  src/saga_core/saga_gdi/Makefile.am,
-	  src/saga_core/saga_gui/Makefile.am,
-	  src/saga_core/saga_odbc/Makefile.am: implement --enable-openmp
-	  configuration in autobuild system
-
-2011-12-22 12:15  oconrad
-
-	* src/saga_core/saga_gui/parameters_control.cpp: saga_gui,
-	  parameters_control: hide/show - enable/disable bug fix
-
-2011-12-22 11:42  oconrad
-
-	* src/saga_core/saga_api/parameters.cpp,
-	  src/saga_core/saga_gui/parameters_control.cpp,
-	  src/saga_core/saga_gui/view_scatterplot.cpp: saga_gui:
-	  grid/scatter plot, improved target selection (points/grid)
-
-2011-12-22 11:41  oconrad
-
-	* src/saga_core/saga_gui/dc_helper.h,
-	  src/saga_core/saga_gui/wksp_grid.cpp: saga_gui: labeling (map,
-	  raster data) with 'boundary effect'
-
-2011-12-22 08:52  oconrad
-
-	* src/saga_core/saga_api/mat_regression_multiple.cpp: saga_api,
-	  multiple regression analysis: bug fix (backward/stepwise)
-
-2011-12-21 11:57  reklov_w
-
-	* src/modules/pointcloud/pointcloud_tools/pointcloud_tools.vcxproj,
-	  src/modules/pointcloud/pointcloud_viewer/pointcloud_viewer.vcxproj,
-	  src/modules/tin/tin_viewer/tin_viewer.vcxproj,
-	  src/modules_contrib/garden/garden_3d_viewer/garden_3d_viewer.vcxproj,
-	  src/modules_contrib/garden/garden_webservices/garden_webservices.vcxproj,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/geostatistics_kriging.vcxproj,
-	  src/modules_io/grid/io_grid_image/io_grid_image.vcxproj,
-	  src/modules_io/shapes/io_shapes/io_shapes.vcxproj,
-	  src/modules_io/shapes/io_shapes_las/io_shapes_las.vcxproj,
-	  src/saga_core/saga_api/saga_api.vcxproj,
-	  src/saga_core/saga_cmd/saga_cmd.vcxproj,
-	  src/saga_core/saga_gdi/saga_gdi.vcxproj,
-	  src/saga_core/saga_gui/saga_gui.vcxproj,
-	  src/saga_core/saga_odbc/saga_odbc.vcxproj: fix vcxproj files to
-	  compile unicode debug target with wx 2.9
-
-2011-12-21 11:08  reklov_w
-
-	* src/saga_core/saga_gui/Makefile.am: saga_gui: fix wx libs linking
-	  in Makefile.am
-
-2011-12-21 09:15  oconrad
-
-	* src/saga_core/saga_gui/dc_helper.cpp,
-	  src/saga_core/saga_gui/wksp_shapes.cpp,
-	  src/saga_core/saga_gui/wksp_shapes.h,
-	  src/saga_core/saga_gui/wksp_shapes_line.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_point.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_points.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_polygon.cpp: saga_gui:
-	  labeling (map, vector data) with 'boundary effect'
-
-2011-12-21 09:13  oconrad
-
-	* src/saga_core/saga_api/api_core.h,
-	  src/saga_core/saga_api/parameters.cpp: saga 2.1: linux build with
-	  wxWidgets 2.9
-
-2011-12-20 20:35  reklov_w
-
-	* src/modules_contrib/garden/garden_webservices/wms_import.cpp,
-	  src/saga_core/saga_gui/wksp_base_control.cpp: saga_gui,
-	  wms_import: fix no matching function for call to ‘const
-	  wxScopedWCharBuffer’
-
-2011-12-20 20:17  reklov_w
-
-	* README: updating README for current state of trunk (2.0.9)
-
-2011-12-20 16:29  oconrad
-
-	* src/saga_core/saga_gui/dc_helper.cpp,
-	  src/saga_core/saga_gui/dc_helper.h: saga_gui: draw_text with
-	  boundary effect
-
-2011-12-20 16:12  oconrad
-
-	* src/saga_core/saga_api/api_core.h,
-	  src/saga_core/saga_api/metadata.cpp,
-	  src/saga_core/saga_api/parameter_data.cpp,
-	  src/saga_core/saga_cmd/saga_cmd.cpp,
-	  src/saga_core/saga_gui/Makefile.am,
-	  src/saga_core/saga_gui/helper.cpp,
-	  src/saga_core/saga_gui/view_histogram.cpp,
-	  src/saga_core/saga_gui/view_table_control.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_point.cpp,
-	  src/saga_core/saga_odbc/saga_odbc.cpp: enabling saga 2.1 linux
-	  build with wxWidgets 2.9
-	  remaining issues:
-	  - toolbar buttons (don't send message)
-	  - makefile (enabling openmp support)
-
-2011-12-19 15:44  oconrad
-
-	* src/saga_core/saga_api/mat_regression_multiple.cpp,
-	  src/saga_core/saga_api/mat_tools.h,
-	  src/saga_core/saga_api/shapes_ogis.cpp: saga_api, multiple
-	  regression analysis: bug fix (backward/stepwise)
-
-2011-12-16 15:12  oconrad
-
-	* src/modules_contrib/contrib_s_liersch/ihacres/ihacres_basin.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_cal2.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_elev.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_elev_cal.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_v1.cpp,
-	  src/modules_io/db/io_odbc/io_odbc.vcxproj,
-	  src/modules_io/db/io_odbc/table.cpp,
-	  src/modules_io/docs/docs_html/svg_interactive_map.cpp,
-	  src/modules_io/docs/docs_html/svg_interactive_map.h,
-	  src/modules_io/docs/docs_pdf/doc_pdf.cpp,
-	  src/modules_io/docs/docs_pdf/doc_pdf.h,
-	  src/modules_io/gdal/io_gdal/gdal_driver.cpp,
-	  src/modules_io/gdal/io_gdal/ogr_driver.cpp,
-	  src/modules_io/grid/io_grid/esri_arcinfo.cpp,
-	  src/modules_io/shapes/io_shapes_las/las_info.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_transform.cpp,
-	  src/saga_core/saga_api/api_colors.cpp,
-	  src/saga_core/saga_api/api_core.h,
-	  src/saga_core/saga_api/api_file.cpp,
-	  src/saga_core/saga_api/api_memory.cpp,
-	  src/saga_core/saga_api/api_string.cpp,
-	  src/saga_core/saga_api/grid_io.cpp,
-	  src/saga_core/saga_api/metadata.cpp,
-	  src/saga_core/saga_api/parameters.cpp,
-	  src/saga_core/saga_api/saga_api.h,
-	  src/saga_core/saga_api/shapes_io.cpp,
-	  src/saga_core/saga_api/table.h,
-	  src/saga_core/saga_api/table_dbase.cpp,
-	  src/saga_core/saga_api/table_io.cpp,
-	  src/saga_core/saga_api/table_record.cpp,
-	  src/saga_core/saga_api/table_value.h,
-	  src/saga_core/saga_cmd/module_library.cpp,
-	  src/saga_core/saga_gui/callback.cpp,
-	  src/saga_core/saga_gui/dlg_about.cpp,
-	  src/saga_core/saga_gui/parameters_control.cpp,
-	  src/saga_core/saga_gui/parameters_properties.cpp,
-	  src/saga_core/saga_gui/view_histogram.cpp,
-	  src/saga_core/saga_gui/view_table_control.cpp,
-	  src/saga_core/saga_gui/wksp_base_control.cpp,
-	  src/saga_core/saga_gui/wksp_layer_classify.cpp,
-	  src/saga_core/saga_odbc/saga_odbc.cpp: linux/wxstring related
-	  changes
-
-2011-12-15 16:00  oconrad
-
-	* src/saga_core/saga_api/mat_regression_multiple.cpp: saga_api,
-	  multiple regression analysis: bug fix (f-test, precise
-	  significance)
-
-2011-12-15 15:57  oconrad
-
-	* src/saga_core/saga_api/grid_operation.cpp: saga_api, grid
-	  resampling: parallel processing support
-
-2011-12-15 15:56  oconrad
-
-	* src/saga_core/saga_gui/view_scatterplot.cpp,
-	  src/saga_core/saga_gui/view_scatterplot.h,
-	  src/saga_core/saga_gui/wksp_base_control.cpp: saga_gui, scatter
-	  plot: enhanced visualization options
-
-2011-12-15 15:55  oconrad
-
-	* src/saga_core/saga_api/saga_api.vcxproj,
-	  src/saga_core/saga_cmd/saga_cmd.vcxproj,
-	  src/saga_core/saga_gdi/saga_gdi.vcxproj,
-	  src/saga_core/saga_gui/saga_gui.vcxproj: saga_core projects: open
-	  mp flags and wx2.9 dependencies updated for all targets
-
-2011-12-15 15:51  oconrad
-
-	* src/saga_core/saga_gui/res/saga.ico,
-	  src/saga_core/saga_gui/res/xpm/saga_icon_16.xpm,
-	  src/saga_core/saga_gui/res/xpm/saga_icon_32.xpm: saga_gui: icon
-	  changed
-
-2011-12-15 15:48  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_hydrology/SAGA_Wetness_Index.cpp:
-	  saga wetness index: optimizations and parallel processing support
-
-2011-12-15 15:47  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Convergence_Radius.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/relative_heights.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/relative_heights.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/tpi.cpp:
-	  convergence index, relative heights, topographic position index:
-	  optimizations and parallel processing support
-
-2011-12-15 15:44  oconrad
-
-	* src/modules_geostatistics/geostatistics/geostatistics_regression/point_multi_grid_regression.cpp:
-	  multiple regression (points/grids): bug fix (include coordinates)
-
-2011-12-15 15:43  oconrad
-
-	* src/modules_geostatistics/geostatistics/geostatistics_grid/MLB_Interface.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/grid_pca.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/grid_pca.h:
-	  principle components analysis: bug fix and inverse transformation
-	  added
-
-2011-12-15 15:41  oconrad
-
-	* src/modules_images/modules_imagery/imagery_tools/MLB_Interface.cpp,
-	  src/modules_images/modules_imagery/imagery_tools/Makefile.am,
-	  src/modules_images/modules_imagery/imagery_tools/evi.cpp,
-	  src/modules_images/modules_imagery/imagery_tools/evi.h,
-	  src/modules_images/modules_imagery/imagery_tools/imagery_tools.vcxproj,
-	  src/modules_images/modules_imagery/imagery_tools/imagery_tools.vcxproj.filters,
-	  src/modules_images/modules_imagery/imagery_tools/pansharpening.cpp,
-	  src/modules_images/modules_imagery/imagery_tools/pansharpening.h,
-	  src/modules_images/modules_imagery/imagery_tools/tasseled_cap.cpp,
-	  src/modules_images/modules_imagery/imagery_tools/tasseled_cap.h:
-	  imagery_tools: vegetation indices and pansharpening reworked and
-	  added
-
-2011-12-02 16:02  oconrad
-
-	* src/modules/grid/grid_gridding/Interpolation.cpp,
-	  src/modules/grid/grid_spline/Gridding_Spline_Base.cpp,
-	  src/modules/grid/grid_tools/Grid_Value_Type.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pointcloud_tools.vcxproj,
-	  src/modules_contrib/garden/garden_webservices/wms_import.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/_kriging_base.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_base.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/grid_multi_grid_regression.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/point_grid_regression.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/point_multi_grid_regression.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/point_trend_surface.cpp,
-	  src/modules_images/modules_imagery/imagery_classification/decision_tree.cpp,
-	  src/saga_core/saga_api/api_callback.cpp,
-	  src/saga_core/saga_api/api_core.h,
-	  src/saga_core/saga_api/api_file.cpp,
-	  src/saga_core/saga_api/api_string.cpp,
-	  src/saga_core/saga_api/dataobject.cpp,
-	  src/saga_core/saga_api/module.cpp,
-	  src/saga_core/saga_api/module_library.cpp,
-	  src/saga_core/saga_api/module_library.h,
-	  src/saga_core/saga_api/parameter_data.cpp,
-	  src/saga_core/saga_api/parameters.cpp,
-	  src/saga_core/saga_api/parameters.h,
-	  src/saga_core/saga_api/table_io.cpp,
-	  src/saga_core/saga_cmd/module_library.cpp,
-	  src/saga_core/saga_cmd/saga_cmd.cpp,
-	  src/saga_core/saga_gui/Makefile.am,
-	  src/saga_core/saga_gui/callback.cpp,
-	  src/saga_core/saga_gui/dlg_colors.cpp,
-	  src/saga_core/saga_gui/helper.cpp,
-	  src/saga_core/saga_gui/info_messages.cpp,
-	  src/saga_core/saga_gui/parameters_control.cpp,
-	  src/saga_core/saga_gui/parameters_properties.cpp,
-	  src/saga_core/saga_gui/project.cpp,
-	  src/saga_core/saga_gui/res_commands.cpp,
-	  src/saga_core/saga_gui/res_commands.h,
-	  src/saga_core/saga_gui/saga.cpp,
-	  src/saga_core/saga_gui/view_histogram.cpp,
-	  src/saga_core/saga_gui/view_map_control.cpp,
-	  src/saga_core/saga_gui/view_scatterplot.cpp,
-	  src/saga_core/saga_gui/view_scatterplot.h,
-	  src/saga_core/saga_gui/wksp_base_control.cpp,
-	  src/saga_core/saga_gui/wksp_data_manager.cpp,
-	  src/saga_core/saga_gui/wksp_grid.cpp,
-	  src/saga_core/saga_gui/wksp_layer.cpp,
-	  src/saga_core/saga_gui/wksp_map.cpp,
-	  src/saga_core/saga_gui/wksp_module.cpp,
-	  src/saga_core/saga_gui/wksp_module_manager.cpp,
-	  src/saga_core/saga_gui/wksp_module_manager.h,
-	  src/saga_core/saga_gui/wksp_table.cpp,
-	  src/saga_core/saga_odbc/saga_odbc.cpp: enabling saga 2.1 linux
-	  build with wxWidgets 2.9
-	  some remaining issues:
-	  - csg_string::format/printf (unicode problem?)
-	  - toolbar buttons (don't send message)
-	  - makefile (enabling openmp support)
-
-2011-11-25 13:42  oconrad
-
-	* src/dev_tools/MLB_Interface.cpp, src/dev_tools/tl_extract.h,
-	  src/dev_tools/tl_merge.h, src/dev_tools/tl_union.h,
-	  src/modules/grid/grid_analysis/Cost_Anisotropic.h,
-	  src/modules/grid/grid_analysis/Cost_Isotropic.h,
-	  src/modules/grid/grid_analysis/LeastCostPathProfile.h,
-	  src/modules/grid/grid_analysis/LeastCostPathProfile_Points.h,
-	  src/modules/grid/grid_analysis/MLB_Interface.cpp,
-	  src/modules/grid/grid_analysis/Soil_Texture.h,
-	  src/modules/grid/grid_analysis/fragmentation_base.h,
-	  src/modules/grid/grid_analysis/grid_analysis.vcxproj,
-	  src/modules/grid/grid_calculus/Fuzzify.h,
-	  src/modules/grid/grid_calculus/FuzzyAND.h,
-	  src/modules/grid/grid_calculus/FuzzyOR.h,
-	  src/modules/grid/grid_calculus/Grid_Geometric_Figures.h,
-	  src/modules/grid/grid_calculus/Grid_Plotter.h,
-	  src/modules/grid/grid_calculus/Grid_Random_Field.h,
-	  src/modules/grid/grid_calculus/Grid_Random_Terrain.h,
-	  src/modules/grid/grid_calculus/MLB_Interface.cpp,
-	  src/modules/grid/grid_calculus/gradient_cartes_polar.h,
-	  src/modules/grid/grid_calculus/grid_calculus.vcxproj,
-	  src/modules/grid/grid_calculus/grid_metric_conversion.h,
-	  src/modules/grid/grid_calculus_bsl/MLB_Interface.cpp,
-	  src/modules/grid/grid_calculus_bsl/grid_calculus_bsl.vcxproj,
-	  src/modules/grid/grid_filter/MLB_Interface.cpp,
-	  src/modules/grid/grid_filter/grid_filter.vcxproj,
-	  src/modules/grid/grid_gridding/Interpolation.h,
-	  src/modules/grid/grid_gridding/MLB_Interface.cpp,
-	  src/modules/grid/grid_gridding/grid_gridding.vcxproj,
-	  src/modules/grid/grid_spline/Gridding_Spline_Base.h,
-	  src/modules/grid/grid_spline/MLB_Interface.cpp,
-	  src/modules/grid/grid_spline/grid_spline.vcxproj,
-	  src/modules/grid/grid_tools/CreateGridSystem.h,
-	  src/modules/grid/grid_tools/Grid_Aggregate.h,
-	  src/modules/grid/grid_tools/Grid_Buffer.h,
-	  src/modules/grid/grid_tools/Grid_Buffer_Proximity.h,
-	  src/modules/grid/grid_tools/Grid_Completion.h,
-	  src/modules/grid/grid_tools/Grid_ConstantGrid.h,
-	  src/modules/grid/grid_tools/Grid_CropToData.h,
-	  src/modules/grid/grid_tools/Grid_Cut.h,
-	  src/modules/grid/grid_tools/Grid_Fill.h,
-	  src/modules/grid/grid_tools/Grid_Gaps.h,
-	  src/modules/grid/grid_tools/Grid_Gaps_OneCell.h,
-	  src/modules/grid/grid_tools/Grid_Gaps_Spline_Fill.h,
-	  src/modules/grid/grid_tools/Grid_Mask.h,
-	  src/modules/grid/grid_tools/Grid_Merge.h,
-	  src/modules/grid/grid_tools/Grid_Proximity.h,
-	  src/modules/grid/grid_tools/Grid_Resample.h,
-	  src/modules/grid/grid_tools/Grid_ThresholdBuffer.h,
-	  src/modules/grid/grid_tools/Grid_Tiling.h,
-	  src/modules/grid/grid_tools/Grid_Value_Reclassify.h,
-	  src/modules/grid/grid_tools/Grid_Value_Replace.h,
-	  src/modules/grid/grid_tools/Grid_Value_Replace_Interactive.h,
-	  src/modules/grid/grid_tools/Grid_Value_Request.h,
-	  src/modules/grid/grid_tools/Grid_Value_Type.h,
-	  src/modules/grid/grid_tools/GridsFromTableAndGrid.h,
-	  src/modules/grid/grid_tools/MLB_Interface.cpp,
-	  src/modules/grid/grid_tools/grid_tools.vcxproj,
-	  src/modules/grid/grid_visualisation/MLB_Interface.cpp,
-	  src/modules/grid/grid_visualisation/grid_visualisation.vcxproj,
-	  src/modules/pointcloud/pointcloud_tools/MLB_Interface.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_attribute_calculator.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_cluster_analysis.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_cluster_analysis.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_cut.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_drop_attribute.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_from_grid.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_from_shapes.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_reclass_extract.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_thinning_simple.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_to_grid.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_to_shapes.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_transform.h,
-	  src/modules/pointcloud/pointcloud_tools/pointcloud_tools.vcxproj,
-	  src/modules/pointcloud/pointcloud_viewer/MLB_Interface.cpp,
-	  src/modules/pointcloud/pointcloud_viewer/pointcloud_viewer.vcxproj,
-	  src/modules/pointcloud/pointcloud_viewer/points_view_control.cpp,
-	  src/modules/shapes/shapes_grid/Grid_Classes_To_Shapes.h,
-	  src/modules/shapes/shapes_grid/Grid_Polygon_Clip.h,
-	  src/modules/shapes/shapes_grid/Grid_Statistics_AddTo_Polygon.h,
-	  src/modules/shapes/shapes_grid/Grid_To_Contour.h,
-	  src/modules/shapes/shapes_grid/Grid_To_Gradient.h,
-	  src/modules/shapes/shapes_grid/Grid_To_Points.h,
-	  src/modules/shapes/shapes_grid/Grid_To_Points_Random.h,
-	  src/modules/shapes/shapes_grid/Grid_Values_AddTo_Points.h,
-	  src/modules/shapes/shapes_grid/Grid_Values_AddTo_Shapes.h,
-	  src/modules/shapes/shapes_grid/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_grid/grid_extent.h,
-	  src/modules/shapes/shapes_grid/grid_local_extremes_to_points.h,
-	  src/modules/shapes/shapes_grid/shapes_grid.vcxproj,
-	  src/modules/shapes/shapes_lines/Lines_From_Points.h,
-	  src/modules/shapes/shapes_lines/Lines_From_Polygons.h,
-	  src/modules/shapes/shapes_lines/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_lines/shapes_lines.vcxproj,
-	  src/modules/shapes/shapes_lines_ex/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_points/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_points/Points_From_Lines.h,
-	  src/modules/shapes/shapes_points/Points_From_Table.h,
-	  src/modules/shapes/shapes_points/convex_hull.h,
-	  src/modules/shapes/shapes_points/gps_track_aggregation.h,
-	  src/modules/shapes/shapes_points/select_points.h,
-	  src/modules/shapes/shapes_points/shapes_points.vcxproj,
-	  src/modules/shapes/shapes_polygons/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_polygons/Polygons_From_Lines.h,
-	  src/modules/shapes/shapes_polygons/polygon_to_points.h,
-	  src/modules/shapes/shapes_polygons/shapes_polygons.vcxproj,
-	  src/modules/shapes/shapes_tools/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_tools/NewLayerFromSelectedShapes.h,
-	  src/modules/shapes/shapes_tools/QueryBuilder.h,
-	  src/modules/shapes/shapes_tools/SearchInTable.h,
-	  src/modules/shapes/shapes_tools/SelectByTheme.h,
-	  src/modules/shapes/shapes_tools/SeparateShapes.h,
-	  src/modules/shapes/shapes_tools/Shapes_Create_Empty.h,
-	  src/modules/shapes/shapes_tools/Shapes_Merge.h,
-	  src/modules/shapes/shapes_tools/shapes_cut.h,
-	  src/modules/shapes/shapes_tools/shapes_cut_interactive.h,
-	  src/modules/shapes/shapes_tools/shapes_split.h,
-	  src/modules/shapes/shapes_tools/shapes_split_by_attribute.h,
-	  src/modules/shapes/shapes_tools/shapes_split_randomly.h,
-	  src/modules/shapes/shapes_tools/shapes_tools.vcxproj,
-	  src/modules/shapes/shapes_transect/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_transect/shapes_transect.vcxproj,
-	  src/modules/table/table_calculus/MLB_Interface.cpp,
-	  src/modules/table/table_calculus/Table_Calculator.h,
-	  src/modules/table/table_calculus/Table_Trend.h,
-	  src/modules/table/table_calculus/etp_hargreave.h,
-	  src/modules/table/table_calculus/table_calculus.vcxproj,
-	  src/modules/table/table_calculus/table_fill_record_gaps.h,
-	  src/modules/table/table_tools/Join_Tables.h,
-	  src/modules/table/table_tools/MLB_Interface.cpp,
-	  src/modules/table/table_tools/Table_Create_Empty.h,
-	  src/modules/table/table_tools/table_change_date_format.h,
-	  src/modules/table/table_tools/table_tools.vcxproj,
-	  src/modules/tin/tin_tools/MLB_Interface.cpp,
-	  src/modules/tin/tin_tools/TIN_Flow_Parallel.h,
-	  src/modules/tin/tin_tools/TIN_Flow_Trace.h,
-	  src/modules/tin/tin_tools/TIN_From_Grid.h,
-	  src/modules/tin/tin_tools/TIN_From_Grid_Specific_Points.h,
-	  src/modules/tin/tin_tools/TIN_From_Shapes.h,
-	  src/modules/tin/tin_tools/TIN_Gradient.h,
-	  src/modules/tin/tin_tools/TIN_To_Shapes.h,
-	  src/modules/tin/tin_tools/tin_tools.vcxproj,
-	  src/modules/tin/tin_viewer/MLB_Interface.cpp,
-	  src/modules/tin/tin_viewer/tin_view_control.cpp,
-	  src/modules/tin/tin_viewer/tin_viewer.vcxproj,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/A1WiTh.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/A2WiTh.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/A3WiTh.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/AvWiMa1.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/AvWiMa2.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/MLB_Interface.cpp,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/contrib_a_perego.vcxproj,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/destriping1.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/destriping2.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/directional1.h,
-	  src/modules_contrib/contrib_s_liersch/ihacres/MLB_Interface.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres.vcxproj,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/MLB_Interface.cpp,
-	  src/modules_contrib/garden/garden_3d_viewer/3dshapes_view_control.cpp,
-	  src/modules_contrib/garden/garden_3d_viewer/MLB_Interface.cpp,
-	  src/modules_contrib/garden/garden_3d_viewer/garden_3d_viewer.vcxproj,
-	  src/modules_contrib/garden/garden_webservices/MLB_Interface.cpp,
-	  src/modules_contrib/garden/garden_webservices/garden_webservices.vcxproj,
-	  src/modules_contrib/garden/garden_webservices/wms_import.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/MLB_Interface.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/geostatistics_grid.vcxproj,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/MLB_Interface.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/_kriging_base.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/geostatistics_kriging.vcxproj,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/semivariogram.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/variogram_dialog.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/MLB_Interface.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/geostatistics_points.vcxproj,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/MLB_Interface.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/geostatistics_regression.vcxproj,
-	  src/modules_images/modules_imagery/imagery_classification/MLB_Interface.cpp,
-	  src/modules_images/modules_imagery/imagery_classification/imagery_classification.vcxproj,
-	  src/modules_images/modules_imagery/imagery_rga/MLB_Interface.cpp,
-	  src/modules_images/modules_imagery/imagery_rga/imagery_rga.vcxproj,
-	  src/modules_images/modules_imagery/imagery_segmentation/MLB_Interface.cpp,
-	  src/modules_images/modules_imagery/imagery_segmentation/imagery_segmentation.vcxproj,
-	  src/modules_images/modules_imagery/imagery_tools/Image_VI_Distance.cpp,
-	  src/modules_images/modules_imagery/imagery_tools/Image_VI_Distance.h,
-	  src/modules_images/modules_imagery/imagery_tools/Image_VI_Slope.cpp,
-	  src/modules_images/modules_imagery/imagery_tools/Image_VI_Slope.h,
-	  src/modules_images/modules_imagery/imagery_tools/MLB_Interface.cpp,
-	  src/modules_images/modules_imagery/imagery_tools/imagery_tools.vcxproj,
-	  src/modules_images/modules_opencv/opencv/MLB_Interface.cpp,
-	  src/modules_images/modules_opencv/opencv/opencv.vcxproj,
-	  src/modules_images/modules_vigra/vigra/MLB_Interface.cpp,
-	  src/modules_images/modules_vigra/vigra/vigra.vcxproj,
-	  src/modules_images/modules_vigra/vigra/vigra_fft.h,
-	  src/modules_io/db/io_db_mysql/Get_Table.h,
-	  src/modules_io/db/io_odbc/MLB_Interface.cpp,
-	  src/modules_io/db/io_odbc/io_odbc.vcxproj,
-	  src/modules_io/db/io_odbc/pgis_shapes.cpp,
-	  src/modules_io/db/io_odbc/pgis_shapes.h,
-	  src/modules_io/db/io_odbc/shapes.cpp,
-	  src/modules_io/db/io_odbc/shapes.h,
-	  src/modules_io/db/io_odbc/table.h,
-	  src/modules_io/docs/docs_html/MLB_Interface.cpp,
-	  src/modules_io/docs/docs_html/doc_html.cpp,
-	  src/modules_io/docs/docs_html/docs_html.vcxproj,
-	  src/modules_io/docs/docs_pdf/MLB_Interface.cpp,
-	  src/modules_io/docs/docs_pdf/doc_pdf.cpp,
-	  src/modules_io/docs/docs_pdf/docs_pdf.vcxproj,
-	  src/modules_io/esri_e00/io_esri_e00/MLB_Interface.cpp,
-	  src/modules_io/esri_e00/io_esri_e00/io_esri_e00.vcxproj,
-	  src/modules_io/gdal/io_gdal/MLB_Interface.cpp,
-	  src/modules_io/gdal/io_gdal/io_gdal.vcxproj,
-	  src/modules_io/gps/io_gps/MLB_Interface.cpp,
-	  src/modules_io/gps/io_gps/io_gps.vcxproj,
-	  src/modules_io/grid/io_grid/MLB_Interface.cpp,
-	  src/modules_io/grid/io_grid/bmp_export.h,
-	  src/modules_io/grid/io_grid/erdas_lan.h,
-	  src/modules_io/grid/io_grid/esri_arcinfo.cpp,
-	  src/modules_io/grid/io_grid/esri_arcinfo.h,
-	  src/modules_io/grid/io_grid/grid_table.h,
-	  src/modules_io/grid/io_grid/io_grid.vcxproj,
-	  src/modules_io/grid/io_grid/mola.h,
-	  src/modules_io/grid/io_grid/raw.h,
-	  src/modules_io/grid/io_grid/srtm30.h,
-	  src/modules_io/grid/io_grid/surfer.h,
-	  src/modules_io/grid/io_grid/usgs_srtm.h,
-	  src/modules_io/grid/io_grid/wrf.h,
-	  src/modules_io/grid/io_grid/xyz.h,
-	  src/modules_io/grid/io_grid_grib2/MLB_Interface.cpp,
-	  src/modules_io/grid/io_grid_grib2/grib2_import.h,
-	  src/modules_io/grid/io_grid_grib2/io_grid_grib2.vcxproj,
-	  src/modules_io/grid/io_grid_image/MLB_Interface.cpp,
-	  src/modules_io/grid/io_grid_image/grid_export.h,
-	  src/modules_io/grid/io_grid_image/grid_import.h,
-	  src/modules_io/grid/io_grid_image/io_grid_image.vcxproj,
-	  src/modules_io/shapes/io_shapes/MLB_Interface.cpp,
-	  src/modules_io/shapes/io_shapes/atlas_bna.h,
-	  src/modules_io/shapes/io_shapes/generate.h,
-	  src/modules_io/shapes/io_shapes/gpx.h,
-	  src/modules_io/shapes/io_shapes/gstat.h,
-	  src/modules_io/shapes/io_shapes/io_shapes.vcxproj,
-	  src/modules_io/shapes/io_shapes/pointcloud_from_file.h,
-	  src/modules_io/shapes/io_shapes/pointcloud_from_text_file.h,
-	  src/modules_io/shapes/io_shapes/pointcloud_to_text_file.cpp,
-	  src/modules_io/shapes/io_shapes/pointcloud_to_text_file.h,
-	  src/modules_io/shapes/io_shapes/stl.h,
-	  src/modules_io/shapes/io_shapes/surfer_bln.h,
-	  src/modules_io/shapes/io_shapes/svg.h,
-	  src/modules_io/shapes/io_shapes/wasp_map.h,
-	  src/modules_io/shapes/io_shapes/xyz.h,
-	  src/modules_io/shapes/io_shapes_dxf/MLB_Interface.cpp,
-	  src/modules_io/shapes/io_shapes_dxf/dxf_import.h,
-	  src/modules_io/shapes/io_shapes_dxf/io_shapes_dxf.vcxproj,
-	  src/modules_io/shapes/io_shapes_las/MLB_Interface.cpp,
-	  src/modules_io/shapes/io_shapes_las/io_shapes_las.vcxproj,
-	  src/modules_io/shapes/io_shapes_las/las_export.h,
-	  src/modules_io/shapes/io_shapes_las/las_import.h,
-	  src/modules_io/shapes/io_shapes_las/las_info.h,
-	  src/modules_io/table/io_table/MLB_Interface.cpp,
-	  src/modules_io/table/io_table/io_table.vcxproj,
-	  src/modules_io/table/io_table/io_table_txt.h,
-	  src/modules_lectures/lectures/lectures_introduction/MLB_Interface.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/lectures_introduction.vcxproj,
-	  src/modules_projection/pj_georeference/pj_georeference/MLB_Interface.cpp,
-	  src/modules_projection/pj_georeference/pj_georeference/pj_georeference.vcxproj,
-	  src/modules_projection/pj_geotrans/pj_geotrans/GEOTRANS_Grid.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/GEOTRANS_Shapes.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/MLB_Interface.cpp,
-	  src/modules_projection/pj_geotrans/pj_geotrans/pj_geotrans.vcxproj,
-	  src/modules_projection/pj_proj4/pj_proj4/MLB_Interface.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/PROJ4_Grid.h,
-	  src/modules_projection/pj_proj4/pj_proj4/PROJ4_Shapes.h,
-	  src/modules_projection/pj_proj4/pj_proj4/pj_proj4.vcxproj,
-	  src/modules_recreations/recreations/recreations_fractals/MLB_Interface.cpp,
-	  src/modules_recreations/recreations/recreations_fractals/recreations_fractals.vcxproj,
-	  src/modules_recreations/recreations/recreations_games/MLB_Interface.cpp,
-	  src/modules_recreations/recreations/recreations_games/recreations_games.vcxproj,
-	  src/modules_simulation/cellular_automata/sim_cellular_automata/MLB_Interface.cpp,
-	  src/modules_simulation/cellular_automata/sim_cellular_automata/sim_cellular_automata.vcxproj,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/MLB_Interface.cpp,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/sim_ecosystems_hugget.vcxproj,
-	  src/modules_simulation/fire/sim_fire_spreading/MLB_Interface.cpp,
-	  src/modules_simulation/fire/sim_fire_spreading/sim_fire_spreading.vcxproj,
-	  src/modules_simulation/hydrology/sim_hydrology/MLB_Interface.cpp,
-	  src/modules_simulation/hydrology/sim_hydrology/sim_hydrology.vcxproj,
-	  src/modules_template/MLB_Interface.cpp,
-	  src/modules_template/My_Module.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ta_channels.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_compound/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_compound/ta_compound.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/CellBalance.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/EdgeContamination.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/FlowDepth.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_AreaDownslope.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_AreaUpslope.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_Distance.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/IsochronesConst.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/IsochronesVar.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/LakeFlood.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/SAGA_Wetness_Index.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/SAGA_Wetness_Index.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Sinuosity.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/SlopeLength.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/TopographicIndices.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/flow_massflux.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/flow_width.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/ta_hydrology.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/SolarRadiation.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/ta_lighting.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Curvature_Classification.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/SurfaceSpecificPoints.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/air_flow_height.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/mass_balance_index.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/ruggedness.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/ta_morphometry.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/tpi.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/wind_effect.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/ta_preprocessor.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/ta_profiles.vcxproj,
-	  src/saga_core/saga_api/api_callback.cpp,
-	  src/saga_core/saga_api/api_core.cpp,
-	  src/saga_core/saga_api/api_core.h,
-	  src/saga_core/saga_api/api_file.cpp,
-	  src/saga_core/saga_api/api_string.cpp,
-	  src/saga_core/saga_api/api_translator.cpp,
-	  src/saga_core/saga_api/dataobject.cpp,
-	  src/saga_core/saga_api/dataobject.h,
-	  src/saga_core/saga_api/geo_classes.cpp,
-	  src/saga_core/saga_api/grid.cpp,
-	  src/saga_core/saga_api/grid_io.cpp,
-	  src/saga_core/saga_api/grid_memory.cpp,
-	  src/saga_core/saga_api/grid_operation.cpp,
-	  src/saga_core/saga_api/grid_system.cpp,
-	  src/saga_core/saga_api/mat_formula.cpp,
-	  src/saga_core/saga_api/mat_regression_multiple.cpp,
-	  src/saga_core/saga_api/mat_spline.cpp,
-	  src/saga_core/saga_api/mat_tools.cpp,
-	  src/saga_core/saga_api/mat_trend.cpp,
-	  src/saga_core/saga_api/metadata.cpp,
-	  src/saga_core/saga_api/module.cpp,
-	  src/saga_core/saga_api/module.h,
-	  src/saga_core/saga_api/module_library.cpp,
-	  src/saga_core/saga_api/module_library.h,
-	  src/saga_core/saga_api/module_library_interface.cpp,
-	  src/saga_core/saga_api/parameter.cpp,
-	  src/saga_core/saga_api/parameter_data.cpp,
-	  src/saga_core/saga_api/parameters.cpp,
-	  src/saga_core/saga_api/parameters.h,
-	  src/saga_core/saga_api/pointcloud.cpp,
-	  src/saga_core/saga_api/pointcloud.h,
-	  src/saga_core/saga_api/projections.cpp,
-	  src/saga_core/saga_api/saga_api.h,
-	  src/saga_core/saga_api/saga_api.vcxproj,
-	  src/saga_core/saga_api/shapes.cpp,
-	  src/saga_core/saga_api/shapes.h,
-	  src/saga_core/saga_api/shapes_io.cpp,
-	  src/saga_core/saga_api/table.cpp, src/saga_core/saga_api/table.h,
-	  src/saga_core/saga_api/table_io.cpp,
-	  src/saga_core/saga_api/tin.cpp,
-	  src/saga_core/saga_cmd/callback.cpp,
-	  src/saga_core/saga_cmd/module_library.cpp,
-	  src/saga_core/saga_cmd/module_library.h,
-	  src/saga_core/saga_cmd/saga_cmd.cpp,
-	  src/saga_core/saga_cmd/saga_cmd.vcxproj,
-	  src/saga_core/saga_gdi/saga_gdi.vcxproj,
-	  src/saga_core/saga_gdi/sgdi_diagram.cpp,
-	  src/saga_core/saga_gui/active.cpp,
-	  src/saga_core/saga_gui/active_attributes.cpp,
-	  src/saga_core/saga_gui/active_history.cpp,
-	  src/saga_core/saga_gui/active_history.h,
-	  src/saga_core/saga_gui/active_legend.cpp,
-	  src/saga_core/saga_gui/data_source.cpp,
-	  src/saga_core/saga_gui/dc_helper.cpp,
-	  src/saga_core/saga_gui/dlg_about.cpp,
-	  src/saga_core/saga_gui/dlg_colors.cpp,
-	  src/saga_core/saga_gui/dlg_list_grid.cpp,
-	  src/saga_core/saga_gui/dlg_parameters.cpp,
-	  src/saga_core/saga_gui/helper.cpp,
-	  src/saga_core/saga_gui/helper.h, src/saga_core/saga_gui/info.cpp,
-	  src/saga_core/saga_gui/info_messages.cpp,
-	  src/saga_core/saga_gui/parameters_control.cpp,
-	  src/saga_core/saga_gui/parameters_properties.cpp,
-	  src/saga_core/saga_gui/parameters_properties.h,
-	  src/saga_core/saga_gui/project.cpp,
-	  src/saga_core/saga_gui/project.h,
-	  src/saga_core/saga_gui/res_commands.cpp,
-	  src/saga_core/saga_gui/res_commands.h,
-	  src/saga_core/saga_gui/res_controls.cpp,
-	  src/saga_core/saga_gui/res_controls.h,
-	  src/saga_core/saga_gui/res_dialogs.cpp,
-	  src/saga_core/saga_gui/res_dialogs.h,
-	  src/saga_core/saga_gui/saga.cpp,
-	  src/saga_core/saga_gui/saga_frame.cpp,
-	  src/saga_core/saga_gui/saga_frame.h,
-	  src/saga_core/saga_gui/saga_gui.vcxproj,
-	  src/saga_core/saga_gui/saga_gui.vcxproj.filters,
-	  src/saga_core/saga_gui/view_histogram.cpp,
-	  src/saga_core/saga_gui/view_layout.cpp,
-	  src/saga_core/saga_gui/view_layout_info.cpp,
-	  src/saga_core/saga_gui/view_map.cpp,
-	  src/saga_core/saga_gui/view_map_3d.cpp,
-	  src/saga_core/saga_gui/view_map_3d_image.cpp,
-	  src/saga_core/saga_gui/view_map_control.cpp,
-	  src/saga_core/saga_gui/view_ruler.cpp,
-	  src/saga_core/saga_gui/view_scatterplot.cpp,
-	  src/saga_core/saga_gui/view_table.cpp,
-	  src/saga_core/saga_gui/view_table_control.cpp,
-	  src/saga_core/saga_gui/view_table_diagram.cpp,
-	  src/saga_core/saga_gui/wksp.cpp,
-	  src/saga_core/saga_gui/wksp_base_control.cpp,
-	  src/saga_core/saga_gui/wksp_base_control.h,
-	  src/saga_core/saga_gui/wksp_base_item.cpp,
-	  src/saga_core/saga_gui/wksp_data_layers.cpp,
-	  src/saga_core/saga_gui/wksp_data_manager.cpp,
-	  src/saga_core/saga_gui/wksp_data_manager.h,
-	  src/saga_core/saga_gui/wksp_data_menu_files.cpp,
-	  src/saga_core/saga_gui/wksp_data_menu_files.h,
-	  src/saga_core/saga_gui/wksp_grid.cpp,
-	  src/saga_core/saga_gui/wksp_grid_manager.cpp,
-	  src/saga_core/saga_gui/wksp_grid_system.cpp,
-	  src/saga_core/saga_gui/wksp_layer.cpp,
-	  src/saga_core/saga_gui/wksp_layer.h,
-	  src/saga_core/saga_gui/wksp_layer_classify.cpp,
-	  src/saga_core/saga_gui/wksp_map.cpp,
-	  src/saga_core/saga_gui/wksp_map_buttons.cpp,
-	  src/saga_core/saga_gui/wksp_map_layer.cpp,
-	  src/saga_core/saga_gui/wksp_map_manager.cpp,
-	  src/saga_core/saga_gui/wksp_module.cpp,
-	  src/saga_core/saga_gui/wksp_module.h,
-	  src/saga_core/saga_gui/wksp_module_library.cpp,
-	  src/saga_core/saga_gui/wksp_module_manager.cpp,
-	  src/saga_core/saga_gui/wksp_module_manager.h,
-	  src/saga_core/saga_gui/wksp_pointcloud.cpp,
-	  src/saga_core/saga_gui/wksp_pointcloud.h,
-	  src/saga_core/saga_gui/wksp_pointcloud_manager.cpp,
-	  src/saga_core/saga_gui/wksp_shapes.cpp,
-	  src/saga_core/saga_gui/wksp_shapes.h,
-	  src/saga_core/saga_gui/wksp_shapes_edit.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_line.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_manager.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_point.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_polygon.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_type.cpp,
-	  src/saga_core/saga_gui/wksp_table.cpp,
-	  src/saga_core/saga_gui/wksp_table.h,
-	  src/saga_core/saga_gui/wksp_table_manager.cpp,
-	  src/saga_core/saga_gui/wksp_tin.cpp,
-	  src/saga_core/saga_gui/wksp_tin_manager.cpp,
-	  src/saga_core/saga_gui/wx, src/saga_core/saga_odbc/saga_odbc.cpp,
-	  src/saga_core/saga_odbc/saga_odbc.vcxproj: saga 2.1: upgrade for
-	  wxWidgets 3.0 (2.9).
-
-2011-11-24 12:23  oconrad
-
-	* src/modules/grid/grid_gridding/grid_gridding.vcproj,
-	  src/modules/grid/grid_tools/grid_tools.vcproj,
-	  src/modules/shapes/shapes_points/shapes_points.vcproj,
-	  src/modules/shapes/shapes_polygons/shapes_polygons.vcproj,
-	  src/modules/shapes/shapes_tools/shapes_tools.vcproj,
-	  src/modules/table/table_calculus/table_calculus.vcproj,
-	  src/modules/table/table_tools/table_tools.vcproj,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/geostatistics_regression.vcproj,
-	  src/modules_images/modules_imagery/imagery_classification/imagery_classification.vcproj,
-	  src/modules_io/docs/docs_pdf/docs_pdf.vcproj,
-	  src/modules_io/grid/io_grid/io_grid.vcproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/ta_morphometry.vcproj,
-	  src/saga_core/saga_api/saga_api.vcproj,
-	  src/saga_core/saga_gui/saga_gui.vcproj: update of msvc9 project
-	  files (win32 only)
-
-2011-11-23 18:33  johanvdw
-
-	* src/saga_core/saga_api/Makefile.am: Remove saga_api_py from dist
-	  target
-
-2011-11-23 18:22  oconrad
-
-	* src/saga_core/saga_gui/res/saga.ger.txt: saga_gui, german
-	  translation: update
-
-2011-11-23 18:22  oconrad
-
-	* src/saga_core/saga_api/saga_api_to_python_win.bat,
-	  src/saga_core/saga_api/saga_api_to_python_win.py: saga_api, msw
-	  python build: update
-
-2011-11-23 08:49  oconrad
-
-	* src/saga_core/saga_api/mat_tools.h: saga_api,
-	  csg_test_distribution: missing dll export (win) added
-
-2011-11-22 16:21  oconrad
-
-	* configure.in: linux build: version 2.0.8
-
-2011-11-22 15:44  oconrad
-
-	* src/saga_core/saga_gui/project.cpp: saga_gui, projects: improved
-	  'save modified...' dialog
-
-2011-11-22 15:14  oconrad
-
-	* src/saga_core/saga_api/parameter.cpp: saga_api, user defined grid
-	  system: fixes 'interpolation problem' reported in user forum
-	  http://sourceforge.net/projects/saga-gis/forums/forum/790705/topic/4659827?message=10598261
-
-2011-11-22 15:13  oconrad
-
-	* src/saga_core/saga_api/shapes_polygons.cpp: saga_api,
-	  shapes_polygons: precision of area calculation, bug fixed
-
-2011-11-22 11:17  oconrad
-
-	* src/modules/grid/grid_analysis/grid_analysis.vcxproj,
-	  src/modules/grid/grid_calculus/grid_calculus.vcxproj,
-	  src/modules/grid/grid_calculus_bsl/grid_calculus_bsl.vcxproj,
-	  src/modules/grid/grid_filter/grid_filter.vcxproj,
-	  src/modules/grid/grid_gridding/grid_gridding.vcxproj,
-	  src/modules/grid/grid_spline/grid_spline.vcxproj,
-	  src/modules/grid/grid_tools/grid_tools.vcxproj,
-	  src/modules/grid/grid_visualisation/grid_visualisation.vcxproj,
-	  src/modules/pointcloud/pointcloud_tools/pointcloud_tools.vcxproj,
-	  src/modules/pointcloud/pointcloud_viewer/pointcloud_viewer.vcxproj,
-	  src/modules/shapes/shapes_grid/shapes_grid.vcxproj,
-	  src/modules/shapes/shapes_lines/shapes_lines.vcxproj,
-	  src/modules/shapes/shapes_lines/shapes_lines.vcxproj.filters,
-	  src/modules/shapes/shapes_points/shapes_points.vcxproj,
-	  src/modules/shapes/shapes_transect/shapes_transect.vcxproj,
-	  src/modules/table/table_calculus/table_calculus.vcxproj,
-	  src/modules/table/table_tools/table_tools.vcxproj,
-	  src/modules/tin/tin_tools/tin_tools.vcxproj,
-	  src/modules/tin/tin_viewer/tin_viewer.vcxproj,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/contrib_a_perego.vcxproj,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres.vcxproj,
-	  src/modules_contrib/garden/garden_3d_viewer/garden_3d_viewer.vcxproj,
-	  src/modules_contrib/garden/garden_webservices/garden_webservices.vcxproj,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/geostatistics_grid.vcxproj,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/geostatistics_grid.vcxproj.filters,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/geostatistics_kriging.vcxproj,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/geostatistics_points.vcxproj,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/geostatistics_regression.vcxproj,
-	  src/modules_images/modules_imagery/imagery_classification/imagery_classification.vcxproj,
-	  src/modules_images/modules_imagery/imagery_rga/imagery_rga.vcxproj,
-	  src/modules_images/modules_imagery/imagery_segmentation/imagery_segmentation.vcxproj,
-	  src/modules_images/modules_imagery/imagery_tools/imagery_tools.vcxproj,
-	  src/modules_images/modules_opencv/opencv/opencv.vcxproj,
-	  src/modules_images/modules_vigra/vigra/vigra.vcxproj,
-	  src/modules_io/db/io_odbc/io_odbc.vcxproj,
-	  src/modules_io/docs/docs_html/docs_html.vcxproj,
-	  src/modules_io/esri_e00/io_esri_e00/io_esri_e00.vcxproj,
-	  src/modules_io/gdal/io_gdal/io_gdal.vcxproj,
-	  src/modules_io/gps/io_gps/io_gps.vcxproj,
-	  src/modules_io/grid/io_grid/io_grid.vcxproj,
-	  src/modules_io/grid/io_grid_grib2/io_grid_grib2.vcxproj,
-	  src/modules_io/grid/io_grid_image/io_grid_image.vcxproj,
-	  src/modules_io/shapes/io_shapes/io_shapes.vcxproj,
-	  src/modules_io/shapes/io_shapes_dxf/io_shapes_dxf.vcxproj,
-	  src/modules_io/shapes/io_shapes_las/io_shapes_las.vcxproj,
-	  src/modules_io/table/io_table/io_table.vcxproj,
-	  src/modules_lectures/lectures/lectures_introduction/lectures_introduction.vcxproj,
-	  src/modules_projection/pj_georeference/pj_georeference/pj_georeference.vcxproj,
-	  src/modules_projection/pj_geotrans/pj_geotrans/pj_geotrans.vcxproj,
-	  src/modules_projection/pj_proj4/pj_proj4/pj_proj4.vcxproj,
-	  src/modules_recreations/recreations/recreations_fractals/recreations_fractals.vcxproj,
-	  src/modules_recreations/recreations/recreations_games/recreations_games.vcxproj,
-	  src/modules_simulation/cellular_automata/sim_cellular_automata/sim_cellular_automata.vcxproj,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/sim_ecosystems_hugget.vcxproj,
-	  src/modules_simulation/fire/sim_fire_spreading/sim_fire_spreading.vcxproj,
-	  src/modules_simulation/hydrology/sim_hydrology/sim_hydrology.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ta_channels.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_compound/ta_compound.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/ta_hydrology.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/ta_lighting.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/ta_morphometry.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/ta_preprocessor.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/ta_profiles.vcxproj,
-	  src/saga_core/saga_cmd/saga_cmd.vcxproj,
-	  src/saga_core/saga_gdi/saga_gdi.vcxproj,
-	  src/saga_core/saga_gui/saga_gui.vcxproj,
-	  src/saga_core/saga_odbc/saga_odbc.vcxproj: vcx project files:
-	  parallel compilation enabled for release targets
-
-2011-11-22 11:14  oconrad
-
-	* src/saga_core/saga_api/grid.cpp: saga_api, grid index creation:
-	  bug fix, long array pointer allocated with int size (crashes
-	  under linux 64bit)
-
-2011-11-22 11:12  oconrad
-
-	* src/modules/shapes/shapes_polygons/Makefile.am,
-	  src/modules/shapes/shapes_polygons/Polygon_Clipper.cpp,
-	  src/modules/shapes/shapes_polygons/Polygon_Clipper.h,
-	  src/modules/shapes/shapes_polygons/Polygon_Intersection.cpp,
-	  src/modules/shapes/shapes_polygons/Polygon_Union.cpp,
-	  src/modules/shapes/shapes_polygons/shapes_polygons.vcxproj,
-	  src/modules/shapes/shapes_polygons/shapes_polygons.vcxproj.filters,
-	  src/modules/shapes/shapes_tools/Makefile.am,
-	  src/modules/shapes/shapes_tools/Polygon_Clipper.cpp,
-	  src/modules/shapes/shapes_tools/Polygon_Clipper.h,
-	  src/modules/shapes/shapes_tools/shapes_buffer.cpp,
-	  src/modules/shapes/shapes_tools/shapes_tools.vcxproj,
-	  src/modules/shapes/shapes_tools/shapes_tools.vcxproj.filters,
-	  src/modules_io/docs/docs_pdf/Makefile.am,
-	  src/modules_io/docs/docs_pdf/Polygon_Clipper.cpp,
-	  src/modules_io/docs/docs_pdf/Polygon_Clipper.h,
-	  src/modules_io/docs/docs_pdf/Profile_Cross_Sections.cpp,
-	  src/modules_io/docs/docs_pdf/docs_pdf.vcxproj,
-	  src/modules_io/docs/docs_pdf/docs_pdf.vcxproj.filters,
-	  src/saga_core/saga_api/Makefile.am,
-	  src/saga_core/saga_api/clipper.cpp,
-	  src/saga_core/saga_api/clipper.hpp,
-	  src/saga_core/saga_api/saga_api.vcxproj,
-	  src/saga_core/saga_api/saga_api.vcxproj.filters,
-	  src/saga_core/saga_api/shapes.h,
-	  src/saga_core/saga_api/shapes_polygons.cpp: saga_api, polygon
-	  clip modules: alan murta's gpc has been replaced by the free and
-	  open source software polygon clipping library 'clipper' (angus
-	  johnson, http://sourceforge.net/projects/polyclipping/)
-
-2011-11-18 15:52  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_lighting/topographic_correction.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/topographic_correction.h:
-	  ta_lighting, topographic correction: bug fix (division by zero)
-	  and enhancements
-
-2011-11-18 11:14  reklov_w
-
-	* src/modules/grid/grid_visualisation/Grid_RGB_Composite.cpp: RGB
-	  Composite module: fix naming of output grid
-
-2011-11-16 10:16  reklov_w
-
-	* src/saga_core/saga_api/mat_tools.h: saga_api, regression
-	  multiple: declaration of Get_R() removed (was not defined and
-	  broke python API library (unresolved symbol))
-
-2011-11-16 09:23  reklov_w
-
-	* src/saga_core/saga_gui/dlg_list_grid.cpp: saga_gui, grid list
-	  dialog: fix crash in case no grid datasets are loaded
-
-2011-11-15 16:28  oconrad
-
-	* src/saga_core/saga_api/module.h,
-	  src/saga_core/saga_api/saga_api.cpp,
-	  src/saga_core/saga_api/saga_api.h,
-	  src/saga_core/saga_cmd/saga_cmd.cpp,
-	  src/saga_core/saga_gui/dlg_about.cpp,
-	  src/saga_core/saga_gui/saga.cpp, src/saga_core/saga_gui/saga.h:
-	  saga_api, saga_cmd, saga_gui: version update (coming 2.0.8), one
-	  single version for these subprojects
-
-2011-11-11 09:23  reklov_w
-
-	* src/modules_io/shapes/io_shapes/Makefile.am: PC To Textfile
-	  (io_shapes): patch of Makefile.am to make the module compile with
-	  rev1223
-
-2011-11-11 09:11  reklov_w
-
-	* src/modules_io/shapes/io_shapes/io_shapes.vcxproj,
-	  src/modules_io/shapes/io_shapes/pointcloud_to_text_file.cpp,
-	  src/modules_io/shapes/io_shapes/pointcloud_to_text_file.h: PC To
-	  Text Files module (io_shapes): patch to make the module working
-	  on the command line
-
-2011-11-07 11:42  reklov_w
-
-	* src/saga_core/saga_cmd/saga_cmd.cpp: saga_cmd: update --help
-	  string for new flags
-
-2011-11-07 11:20  reklov_w
-
-	* src/saga_core/saga_cmd/saga_cmd.cpp: saga_cmd: new argument -v
-	  (--version) implemented; prints out version number of saga_cmd
-	  and saga api (requested feature on dev-mailing list)
-
-2011-11-07 11:08  reklov_w
-
-	* src/saga_core/saga_cmd/callback.cpp,
-	  src/saga_core/saga_cmd/callback.h,
-	  src/saga_core/saga_cmd/saga_cmd.cpp: saga_cmd: introducing quiet
-	  flag - no progress output, but messages; allows for better
-	  logging of batch processes
-
-2011-11-07 10:33  oconrad
-
-	* src/saga_core/saga_cmd/callback.cpp: saga_cmd: optimization
-	  (speed up) of progress notification
-
-2011-11-07 10:22  reklov_w
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_compound/TA_Standard.cpp:
-	  fix rev1216 by changing explicit typecast from CSG_Parameter* to
-	  CSG_Grid*
-
-2011-11-07 09:02  oconrad
-
-	* src/modules/pointcloud/pointcloud_tools/pc_cut.cpp,
-	  src/saga_core/saga_cmd/module_library.cpp: saga_cmd: bug fix,
-	  loading unused grid system parameters for additional parameter
-	  lists
-
-2011-11-05 18:31  reklov_w
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_compound/TA_Standard.cpp:
-	  fix 'ambigous call' of overloaded function Set_Parameter() for
-	  gcc by explicit typecast to CGS_Parameter*
-
-2011-11-04 10:28  oconrad
-
-	* src/modules/pointcloud/pointcloud_tools/pc_cut.cpp:
-	  pointcloud_tools/cutting: saga_cmd compatibility
-
-2011-11-03 10:22  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_channels/ChannelNetwork_Altitude.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ChannelNetwork_Altitude.h:
-	  ta_channels, vertical_channel_distance: no data support, speed
-	  optimisation
-
-2011-11-03 10:21  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_channels/D8_Flow_Analysis.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/D8_Flow_Analysis.h:
-	  ta_channels, d8_flow_analysis: channel segment output as 3d-lines
-
-2011-11-03 10:19  oconrad
-
-	* src/modules_contrib/garden/garden_3d_viewer/3dshapes_view_control.cpp:
-	  garden_3d_viewer: support for 3d lines
-
-2011-11-03 10:19  oconrad
-
-	* src/modules/grid/grid_calculus/MLB_Interface.cpp,
-	  src/modules/grid/grid_calculus/grid_difference.cpp,
-	  src/modules/grid/grid_calculus/grid_difference.h: grid_calculus:
-	  bug fix for grids_sum/grids_product; grid_division module added
-
-2011-11-03 10:17  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_compound/TA_Standard.cpp,
-	  src/saga_core/saga_api/module_library.h: saga_api;
-	  module_library: makro for module execution added
-
-2011-11-03 10:16  oconrad
-
-	* src/saga_core/saga_gui/wksp_shapes.cpp: saga_gui; wksp_shapes:
-	  output of extent
-
-2011-10-28 14:34  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_channels/ChannelNetwork_Distance.cpp:
-	  ta_channels, overland flow distance: bug fix; memory adressing on
-	  large data sets
-
-2011-10-28 14:30  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_channels/ChannelNetwork_Distance.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ChannelNetwork_Distance.h:
-	  ta_channels, overland flow distance: bug fix; memory adressing on
-	  large data sets
-
-2011-10-28 11:54  oconrad
-
-	* src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_base.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_base.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_ordinary.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_ordinary_global.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_universal.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_universal_global.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/semivariogram.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/variogram_dialog.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/variogram_dialog.h:
-	  geostatistics_kriging: 'logarithmic transformation' option added
-
-2011-10-27 12:56  oconrad
-
-	* src/modules_geostatistics/geostatistics/geostatistics_kriging/variogram_dialog.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/variogram_dialog.h:
-	  variogram_dialog: pair count displayable, prevent to analyze
-	  distances greater than maximum distance in data
-
-2011-10-27 12:53  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_channels/ChannelNetwork_Altitude.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/D8_Flow_Analysis.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/D8_Flow_Analysis.h:
-	  ta_channels, d8_flow_analysis/vertical distance: minor
-	  improvements
-
-2011-10-27 12:52  oconrad
-
-	* src/modules/shapes/shapes_grid/Grid_Statistics_AddTo_Polygon.cpp:
-	  grid statistics for polygon: 'sum' parameter added
-
-2011-10-26 18:50  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_channels/D8_Flow_Analysis.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/D8_Flow_Analysis.h:
-	  ta_channels, d8 flow analysis: channels now based on strahler
-	  order, automated catchment basin delineation added
-
-2011-10-26 16:33  oconrad
-
-	* configure.in,
-	  src/modules_terrain_analysis/terrain_analysis/Makefile.am,
-	  src/modules_terrain_analysis/terrain_analysis/ta_compound/Makefile.am,
-	  src/saga_core/saga_api/module_library.cpp: saga_api, ta_compound:
-	  module_library_manager/linux related fixes
-
-2011-10-25 15:23  oconrad
-
-	* src/modules_io/gdal/io_gdal/gdal_import.cpp,
-	  src/modules_io/gdal/io_gdal/ogr_import.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_compound/TA_Standard.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_compound/TA_Standard.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/SolarRadiation.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/RealArea.cpp,
-	  src/saga.vc10.sln, src/saga_core/saga_api/module_library.cpp,
-	  src/saga_core/saga_api/module_library.h,
-	  src/saga_core/saga_api/parameter_data.cpp,
-	  src/saga_core/saga_api/parameters.cpp,
-	  src/saga_core/saga_api/parameters.h,
-	  src/saga_core/saga_gui/saga_frame.cpp,
-	  src/saga_core/saga_gui/wksp_data_manager.cpp,
-	  src/saga_core/saga_gui/wksp_module_library.cpp,
-	  src/saga_core/saga_gui/wksp_module_library.h,
-	  src/saga_core/saga_gui/wksp_module_manager.cpp: saga_api,
-	  saga_gui, (ta_compound): module library management moved to
-	  saga_api, class saga_api::CSG_Module_Library_Manager, global
-	  instance available via saga_api::SG_Get_Module_Libray_Manager(),
-	  serious tests recommended
-
-2011-10-21 12:22  oconrad
-
-	* src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_base.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_base.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_ordinary.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_universal.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/semivariogram.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/semivariogram.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/variogram_dialog.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/variogram_dialog.h,
-	  src/saga_core/saga_api/mat_trend.cpp: geostatistics_kriging:
-	  enhanced interactive variogram fitting options
-
-2011-10-21 12:21  oconrad
-
-	* src/saga_core/saga_cmd/module_library.cpp,
-	  src/saga_core/saga_cmd/module_library.h: saga_cmd, bug fix:
-	  additional parameters have not been set from command line
-
-2011-10-17 18:35  reklov_w
-
-	* src/modules/pointcloud/pointcloud_tools/pc_drop_attribute.cpp:
-	  drop point cloud attribute module: lost commit to fix rev. 1163
-
-2011-10-17 12:34  reklov_w
-
-	* src/saga_core/saga_gui/helper.h,
-	  src/saga_core/saga_gui/wksp_grid.cpp: GUI: grid description now
-	  correctly reports number of (noData) cells as long (was int)
-
-2011-10-14 11:29  oconrad
-
-	* src/modules/grid/grid_calculus/Grid_Calculator.cpp,
-	  src/modules/grid/grid_calculus/Grid_Calculator.h,
-	  src/modules/table/table_calculus/Table_Calculator.cpp,
-	  src/saga_core/saga_api/mat_formula.cpp: grid_calculator: improved
-	  error message, different grid systems accessible, addressing via
-	  letters (a, b, c, ...) or index (g1, g2, g3, ...)
-
-2011-10-14 11:26  oconrad
-
-	* src/saga_core/saga_gui/helper.cpp,
-	  src/saga_core/saga_gui/helper.h,
-	  src/saga_core/saga_gui/wksp_grid.cpp: saga_gui, wksp_grid: human
-	  readible memory sizes
-
-2011-10-14 10:51  oconrad
-
-	* src/saga_core/saga_gui/parameters_properties.cpp: saga_gui,
-	  parameter dialog: data lists now show if input/output ('>>',
-	  '<<')
-
-2011-10-12 07:53  reklov_w
-
-	* src/saga_core/saga_cmd/saga_cmd.cpp: fix rev1190 (saga_core:
-	  saga_cmd: fixes segfaults with wxgtk 2.8.12) to support wx
-	  versions older than 2.8.11
-
-2011-10-11 08:58  oconrad
-
-	* src/saga_core/saga_api/mat_regression_multiple.cpp: saga_api,
-	  multiple linear regression: output of correct variable name when
-	  stepping out (stepwise). compatibility with ms excel for
-	  coefficients table (tables starting with 'id' are expected to be
-	  a 'sylk' table)
-
-2011-10-10 17:53  manfred-e
-
-	* src/saga_core/saga_cmd/saga_cmd.cpp: saga_core: saga_cmd: fixes
-	  segfaults with wxgtk 2.8.12
-
-2011-10-10 13:08  oconrad
-
-	* src/saga_core/saga_api/api_colors.cpp: saga_api, colors: unicode
-	  compatibility for loading ascii coded palette files
-
-2011-10-10 12:38  oconrad
-
-	* src/modules/shapes/shapes_points/convex_hull.cpp,
-	  src/modules/shapes/shapes_points/convex_hull.h: shapes_points,
-	  convex hull: minimum bounding rectangle calculation added
-
-2011-10-10 12:37  oconrad
-
-	* src/modules/grid/grid_calculus/grid_difference.cpp:
-	  grid_calculus, sum, product: no data value support
-
-2011-10-10 12:36  oconrad
-
-	* src/modules/table/table_calculus/Table_Calculator.cpp:
-	  table_calculus, calculator: no data value support
-
-2011-10-10 12:35  oconrad
-
-	* src/modules/table/table_tools/table_change_date_format.cpp:
-	  table_tools, change time format: bug fix
-
-2011-10-10 10:21  oconrad
-
-	* src/saga_core/saga_api/projections.cpp: saga_api: fixes unicode
-	  incompatibilities with configuration files
-
-2011-10-10 10:13  reklov_w
-
-	* src/saga_core/saga_api/projections.cpp: API projections.cpp: fix
-	  of fix in rev 1182 - dataset projection files now always written
-	  as plain ASCII
-
-2011-10-10 09:01  reklov_w
-
-	* src/saga_core/saga_api/projections.cpp: API projections.cpp: fix
-	  unicode issues - dataset projection files now always written as
-	  plain ASCII
-
-2011-10-10 08:59  reklov_w
-
-	* src/saga_core/saga_api/api_colors.cpp: api_colors.cpp: fix
-	  unicode issues - color palette file identifiers now defined as
-	  plain ASCII
-
-2011-10-10 07:24  manfred-e
-
-	* configure.in: fixed bug 3420803: odbc library check
-
-2011-09-30 08:21  oconrad
-
-	* src/modules_geostatistics/geostatistics/geostatistics_regression/MLB_Interface.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/Makefile.am,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/geostatistics_regression.vcxproj,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/geostatistics_regression.vcxproj.filters,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/grid_multi_grid_regression.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/grid_multi_grid_regression.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/point_multi_grid_regression.cpp:
-	  multiple regression for grid/grids added
-
-2011-09-28 16:09  oconrad
-
-	* src/saga_core/saga_gui/wksp_data_manager.cpp: saga_gui: bug fix
-	  in wksp_data_manager::get_dataobject_list(); solves bug item
-	  3390337
-	  http://sourceforge.net/tracker/?func=detail&atid=632652&aid=3390337&group_id=102728
-
-2011-09-28 08:06  oconrad
-
-	* src/modules_geostatistics/geostatistics/geostatistics_regression/MLB_Interface.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/Makefile.am,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/geostatistics_regression.vcxproj,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/geostatistics_regression.vcxproj.filters,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/gw_multi_regression.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/gw_multi_regression_grid.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/gw_multi_regression_points.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/gw_multi_regression_points.h:
-	  geographically weighted regression: bug fix (no data handling),
-	  simple version for points added
-
-2011-09-28 08:01  oconrad
-
-	* src/modules_projection/pj_proj4/pj_proj4/pj_proj4.vcxproj,
-	  src/saga_core/saga_api/projections.cpp,
-	  src/saga_core/saga_gui/res/saga_dic.txt: proj4 related: getting
-	  prepared to version 4.8 (support for 'interrupted goode
-	  homolosine' and other)
-
-2011-09-28 07:58  oconrad
-
-	* src/modules/shapes/shapes_tools/Polygon_Clipper.cpp:
-	  shapes_tools, buffer: call to 'exit()' removed; fixes bug item
-	  3412916
-	  https://sourceforge.net/tracker/?func=detail&atid=632652&aid=3412916&group_id=102728
-
-2011-09-23 14:40  oconrad
-
-	* src/modules_simulation/hydrology/sim_hydrology/topmodel.cpp,
-	  src/modules_simulation/hydrology/sim_hydrology/topmodel.h:
-	  sim_hydrology, topmodel: flexible field selection for input table
-
-2011-09-23 14:39  oconrad
-
-	* src/saga_core/saga_api/mat_spline.cpp: saga_api, mat_spline:
-	  memory bug fix
-
-2011-09-23 14:38  oconrad
-
-	* src/modules/table/table_tools/table_change_date_format.cpp:
-	  table_tools, change date format: bug fix and julian datum added
-
-2011-09-23 14:37  oconrad
-
-	* src/modules/table/table_calculus/MLB_Interface.cpp,
-	  src/modules/table/table_calculus/Makefile.am,
-	  src/modules/table/table_calculus/Table_Calculator.cpp,
-	  src/modules/table/table_calculus/etp_hargreave.cpp,
-	  src/modules/table/table_calculus/etp_hargreave.h,
-	  src/modules/table/table_calculus/table_calculus.vcxproj,
-	  src/modules/table/table_calculus/table_calculus.vcxproj.filters,
-	  src/modules/table/table_calculus/table_fill_record_gaps.cpp,
-	  src/modules/table/table_calculus/table_fill_record_gaps.h:
-	  table_calculus, added: pot. daily evapotranspiration after
-	  hargreave and distribution to hourly values. simple data gap
-	  filling routine
-
-2011-09-21 16:57  oconrad
-
-	* src/modules/shapes/shapes_points/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_points/Makefile.am,
-	  src/modules/shapes/shapes_points/gps_track_aggregation.cpp,
-	  src/modules/shapes/shapes_points/gps_track_aggregation.h,
-	  src/modules/shapes/shapes_points/shapes_points.vcxproj,
-	  src/modules/shapes/shapes_points/shapes_points.vcxproj.filters:
-	  module for track point aggregation added
-
-2011-09-21 16:56  oconrad
-
-	* src/modules/table/table_tools/MLB_Interface.cpp,
-	  src/modules/table/table_tools/Makefile.am,
-	  src/modules/table/table_tools/table_change_date_format.cpp,
-	  src/modules/table/table_tools/table_change_date_format.h,
-	  src/modules/table/table_tools/table_tools.vcxproj,
-	  src/modules/table/table_tools/table_tools.vcxproj.filters,
-	  src/saga_core/saga_api/table.cpp, src/saga_core/saga_api/table.h,
-	  src/saga_core/saga_api/table_io.cpp,
-	  src/saga_core/saga_gui/res_dialogs.cpp,
-	  src/saga_core/saga_gui/wksp_data_manager.cpp: api/gui/modules,
-	  table related: csg_table minor text import bugs fixed, csv
-	  support enhanced, modules for date/time format changing added
-
-2011-09-21 08:47  reklov_w
-
-	* src/saga_core/saga_gui/wksp_pointcloud.cpp: SAGA GUI: update test
-	  of PointCloud NoData values due to API changes in is_NoData()
-
-2011-09-21 08:45  reklov_w
-
-	* src/saga_core/saga_api/pointcloud.h: SAGA API, pointcloud.h:
-	  ATTENTION - isNoData() and Set_NoData() methods now take field
-	  number instead of attribute number as input
-
-2011-09-21 07:20  reklov_w
-
-	* src/modules_io/shapes/io_shapes_las/las_import.cpp,
-	  src/modules_io/shapes/io_shapes_las/las_info.cpp: LAS Import and
-	  LAS Info modules: fix/implement LAS version check, now
-	  unsupported file versions are rejected
-
-2011-09-18 13:29  reklov_w
-
-	* src/saga_core/saga_gui/wksp_pointcloud.cpp: SAGA GUI: PointCloud
-	  attribute's NoData value range is now taken into account when map
-	  is drawn
-
-2011-09-16 08:55  reklov_w
-
-	* src/modules/pointcloud/pointcloud_tools/pc_reclass_extract.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_reclass_extract.h:
-	  Point Cloud Reclassifier / Subset Extractor module: bug fix
-	  floating field detection, other enhancements (e.g. colorization
-	  of output)
-
-2011-09-16 07:38  reklov_w
-
-	* src/modules/pointcloud/pointcloud_tools/pc_drop_attribute.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_drop_attribute.h: Drop
-	  Point Cloud Attribute module: fix output naming issue and other
-	  enhancements
-
-2011-09-15 09:20  manfred-e
-
-	* src/saga_core/saga_api/Makefile.am: saga_api, python interface:
-	  platform specific install path fix
-
-2011-09-15 08:37  reklov_w
-
-	* src/saga_core/saga_api/mat_regression_multiple.cpp: fix gcc error
-	  in mat_regression_multiple.cpp:257: error: operands to ?: have
-	  different types ‘const wchar_t*’ and ‘CSG_String’
-
-2011-09-14 15:11  oconrad
-
-	* src/modules_geostatistics/geostatistics/geostatistics_regression/point_multi_grid_regression.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/point_multi_grid_regression.h,
-	  src/saga_core/saga_api/mat_matrix.cpp,
-	  src/saga_core/saga_api/mat_regression.cpp,
-	  src/saga_core/saga_api/mat_regression_multiple.cpp,
-	  src/saga_core/saga_api/mat_tools.cpp,
-	  src/saga_core/saga_api/mat_tools.h: saga_api, multiple linear
-	  regression module: automated predictor selection added (forward,
-	  backward, stepwise)
-
-2011-09-14 15:09  oconrad
-
-	* src/saga_core/saga_api/api_memory.cpp: saga_api, csg_bytes:
-	  hex-string conversion bug fixed
-
-2011-09-14 14:55  oconrad
-
-	* src/saga_core/saga_api/shapes_ogis.cpp: saga_api: shape to
-	  well-known-binary conversion bug fixed
-
-2011-09-14 09:38  oconrad
-
-	* src/saga_core/saga_api/shape_polygon.cpp: saga_api, polygon
-	  centroids: precision bug fix
-
-2011-09-14 08:38  manfred-e
-
-	* src/saga_core/saga_api/Makefile.am: saga API python interface:
-	  fixed platform specific install path
-
-2011-09-06 11:32  johanvdw
-
-	* src/modules/shapes/shapes_polygons/shape_index.cpp: Fix spelling
-	  error, closes bug:#3404844
-
-2011-09-03 12:23  johanvdw
-
-	* src/saga_core/saga_api/Makefile.am: Support make -j when building
-	  the python interface
-
-2011-09-01 13:20  oconrad
-
-	* src/modules_io/grid/io_grid/MLB_Interface.cpp,
-	  src/modules_io/grid/io_grid/Makefile.am,
-	  src/modules_io/grid/io_grid/io_grid.vcxproj,
-	  src/modules_io/grid/io_grid/io_grid.vcxproj.filters,
-	  src/modules_io/grid/io_grid/wrf.cpp,
-	  src/modules_io/grid/io_grid/wrf.h: io_grid modules added: wrf
-	  geogrid import/export (http://www.wrf-model.org)
-
-2011-08-29 13:31  oconrad
-
-	* src/modules/shapes/shapes_polygons/Polygon_StatisticsFromPoints.cpp:
-	  module 'point statistics for polygons': saga_cmd usage enabled
-	  (stats obtained for all attributes by default)
-
-2011-08-29 12:36  johanvdw
-
-	* src/saga_core/saga_api/Makefile.am: Don't include
-	  saga_api_wrap.cxx in dist-target
-
-2011-08-29 12:32  reklov_w
-
-	* src/modules/grid/grid_tools/Grid_Buffer_Proximity.cpp: Grid
-	  Proximity Buffer module: bug fix, now module terminates in case
-	  the buffer distance is smaller than the grid cell size
-
-2011-08-29 12:26  oconrad
-
-	* src/modules/grid/grid_tools/Grid_CropToData.cpp,
-	  src/modules/grid/grid_tools/Grid_CropToData.h: module 'crop to
-	  data': grid list parameter for output added (enables saga_cmd
-	  scripting)
-
-2011-08-29 12:18  reklov_w
-
-	* src/modules/grid/grid_calculus/Grid_Calculator.cpp: Grid
-	  Calculator module: add new option to include NoData cells in
-	  calculation
-
-2011-08-29 09:40  reklov_w
-
-	* src/modules_io/table/io_table/io_table_txt.cpp: Import/Export
-	  Table: bug fix printf formatting (table export) and fix compiler
-	  warnings
-
-2011-08-24 14:13  oconrad
-
-	* src/modules_geostatistics/geostatistics/geostatistics_regression/point_multi_grid_regression.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/point_multi_grid_regression.h,
-	  src/saga_core/saga_api/mat_regression_multiple.cpp: saga_api &
-	  multiple regression module: bug fix and optimisations
-
-2011-08-22 16:01  oconrad
-
-	* src/modules_geostatistics/geostatistics/geostatistics_regression/point_multi_grid_regression.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/point_multi_grid_regression.h,
-	  src/saga_core/saga_api/mat_regression.cpp,
-	  src/saga_core/saga_api/mat_regression_multiple.cpp,
-	  src/saga_core/saga_api/mat_tools.cpp,
-	  src/saga_core/saga_api/mat_tools.h: saga_api & multiple
-	  regression module: adjusted r2 and significance tests for
-	  (multiple) regression analysis added
-
-2011-08-04 16:43  manfred-e
-
-	* src/modules/pointcloud/pointcloud_tools/pc_transform.cpp: point
-	  cloud transformation module: added support for 9 parameter
-	  transformation
-
-2011-07-29 19:33  reklov_w
-
-	* src/modules/grid/grid_spline/Gridding_Spline_TPS_Global.cpp,
-	  src/modules/grid/grid_spline/Gridding_Spline_TPS_Local.cpp,
-	  src/modules/grid/grid_spline/Gridding_Spline_TPS_TIN.cpp: grid
-	  spline interpolation: fix character coding in source (now
-	  description works on linux unicode)
-
-2011-07-29 19:19  reklov_w
-
-	* src/modules_simulation/ecosystems/sim_ecosystems_hugget/Hugget_01.cpp,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/Hugget_02.cpp:
-	  simulation ecosystems hugget: fix string formatting (superscript
-	  in description _TW()) and typos
-
-2011-07-29 13:28  reklov_w
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_AreaUpslope.cpp:
-	  Upslope Area module: now optionally x/y coordinates of a point
-	  can be used instead of a grid as target area; feature request
-	  https://sourceforge.net/tracker/?func=detail&aid=3379797&group_id=102728&atid=632655
-
-2011-07-27 12:23  reklov_w
-
-	* src/modules_io/shapes/io_shapes_las/las_import.cpp: las import
-	  module: fix datatype of rgb field (now 4byte instead of 8byte
-	  integer)
-
-2011-07-21 13:28  reklov_w
-
-	* src/modules_io/shapes/io_shapes/io_shapes.vcxproj,
-	  src/modules_io/shapes/io_shapes/io_shapes.vcxproj.filters:
-	  io_shapes vc10 project files: added new module "export point
-	  cloud to test file"
-
-2011-07-21 13:21  reklov_w
-
-	* src/modules_io/shapes/io_shapes/pointcloud_from_file.cpp: renamed
-	  module 'import point cloud fom file' to 'import point cloud fom
-	  shape file'
-
-2011-07-21 13:18  reklov_w
-
-	* src/modules_io/shapes/io_shapes/MLB_Interface.cpp,
-	  src/modules_io/shapes/io_shapes/Makefile.am,
-	  src/modules_io/shapes/io_shapes/pointcloud_to_text_file.cpp,
-	  src/modules_io/shapes/io_shapes/pointcloud_to_text_file.h: added
-	  new module 'export point cloud to text file'
-
-2011-07-19 20:36  reklov_w
-
-	* src/modules/tin/Makefile.am,
-	  src/modules_contrib/garden/Makefile.am,
-	  src/modules_geostatistics/geostatistics/Makefile.am,
-	  src/modules_io/db/Makefile.am,
-	  src/modules_io/grid/io_grid_grib2/Makefile.am,
-	  src/modules_projection/pj_proj4/pj_proj4/Makefile.am,
-	  src/saga_core/Makefile.am: applying patches from Ben for the
-	  build system: configure flags --disable-gui and --disable-odbc
-
-2011-07-19 20:30  reklov_w
-
-	* configure.in, src/modules/pointcloud/Makefile.am: applying
-	  patches from Ben for the build system: configure flags
-	  --disable-gui and --disable-odbc
-
-2011-07-14 10:25  reklov_w
-
-	* src/saga_core/saga_gui/wksp_pointcloud.cpp: wksp_pointcloud.cpp:
-	  change default value aggregation to "highest z"
-
-2011-07-14 10:14  reklov_w
-
-	* src/saga_core/saga_gui/wksp_shapes_edit.cpp:
-	  wksp_shapes_edit.cpp: change svn keyword from "dummyprop" to "Id"
-
-2011-07-14 09:59  reklov_w
-
-	* src/saga_core/saga_gui/wksp_shapes_edit.cpp: GUI - change text
-	  from "save changes" to "apply changes" in edit shapes dialog
-
-2011-07-14 07:45  reklov_w
-
-	* src/modules_template/MLB_Interface.h: MLB Template: fix EXPORTS
-	  definition
-
-2011-07-14 07:42  reklov_w
-
-	* src/modules/grid/grid_gridding/Interpolation.h,
-	  src/modules/grid/grid_gridding/Interpolation_InverseDistance.h,
-	  src/modules/grid/grid_gridding/Interpolation_NaturalNeighbour.h,
-	  src/modules/grid/grid_gridding/Interpolation_NearestNeighbour.h,
-	  src/modules/grid/grid_gridding/Interpolation_Shepard.h,
-	  src/modules/grid/grid_gridding/Interpolation_Triangulation.h,
-	  src/modules/grid/grid_gridding/Shapes2Grid.h,
-	  src/modules/grid/grid_gridding/grid_gridding.vcxproj,
-	  src/modules/grid/grid_gridding/kernel_density.h: grid_gridding:
-	  adding MLB EXPORTS definitions
-
-2011-07-10 17:45  reklov_w
-
-	* src/modules_template/README.txt,
-	  src/modules_template/create_custom_mlb_from_template.sh: script
-	  and instructions on how to use the module template on GNU/Linux
-	  added
-
-2011-07-07 08:22  oconrad
-
-	* src/modules_images/modules_imagery/imagery_classification/change_detection.cpp,
-	  src/modules_images/modules_imagery/imagery_classification/change_detection.h:
-	  module 'change detection': bug fix (class ids)
-
-2011-07-06 15:53  oconrad
-
-	* src/modules/shapes/shapes_tools/GraticuleBuilder.cpp:
-	  shapes_tools; graticule: rectangles with enumerated rows/columns
-
-2011-07-06 15:51  oconrad
-
-	* src/saga_core/saga_gui/helper.cpp: saga_gui; table control: open
-	  webbrowser (instead of searching for a default application) when
-	  link to be opened starts with ftp/http (alt + left mouse click)
-
-2011-07-06 09:29  oconrad
-
-	* src/saga_core/saga_gui/data_source_files.cpp,
-	  src/saga_core/saga_gui/data_source_files.h,
-	  src/saga_core/saga_gui/res_commands.cpp,
-	  src/saga_core/saga_gui/res_commands.h,
-	  src/saga_core/saga_gui/res_dialogs.cpp: saga_gui, data source
-	  control: context menu (refresh command), module libraries added
-	  to default filter
-
-2011-07-06 09:26  oconrad
-
-	* src/modules/shapes/shapes_points/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_points/Makefile.am,
-	  src/modules/shapes/shapes_points/shapes_points.vcxproj,
-	  src/modules/shapes/shapes_points/shapes_points.vcxproj.filters,
-	  src/modules/shapes/shapes_points/thiessen_polygons.cpp,
-	  src/modules/shapes/shapes_points/thiessen_polygons.h: module
-	  added: create thiessen polygons from points.
-
-2011-07-03 19:00  reklov_w
-
-	* src/modules/pointcloud/pointcloud_tools/pc_reclass_extract.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_reclass_extract.h:
-	  Point Cloud Reclassifier / Subset Extractor module: Parameters
-	  enable/disable implemented
-
-2011-07-03 18:19  reklov_w
-
-	* src/modules/grid/grid_tools/Grid_Value_Reclassify.cpp,
-	  src/modules/grid/grid_tools/Grid_Value_Reclassify.h: Reclassify
-	  Grid Values module: Parameters enable/disable implemented
-
-2011-06-30 09:19  oconrad
-
-	* src/saga_core/saga_gui/data_source_files.cpp,
-	  src/saga_core/saga_gui/data_source_files.h: saga_gui: data source
-	  browser now stays enabled even if no mdi-child is open
-
-2011-06-29 13:32  oconrad
-
-	* src/saga_core/saga_gui/wksp_data_manager.cpp: saga_gui: try to
-	  load graphic formats (bmp, jpg, png, gif) via io_grid_image
-
-2011-06-29 12:13  oconrad
-
-	* src/saga_core/saga_gui/Makefile.am,
-	  src/saga_core/saga_gui/active.cpp,
-	  src/saga_core/saga_gui/data_source.cpp,
-	  src/saga_core/saga_gui/data_source.h,
-	  src/saga_core/saga_gui/data_source_files.cpp,
-	  src/saga_core/saga_gui/data_source_files.h,
-	  src/saga_core/saga_gui/res_commands.cpp,
-	  src/saga_core/saga_gui/res_commands.h,
-	  src/saga_core/saga_gui/res_controls.h,
-	  src/saga_core/saga_gui/res_dialogs.cpp,
-	  src/saga_core/saga_gui/res_dialogs.h,
-	  src/saga_core/saga_gui/res_images.cpp,
-	  src/saga_core/saga_gui/res_images.h,
-	  src/saga_core/saga_gui/saga_frame.cpp,
-	  src/saga_core/saga_gui/saga_frame.h,
-	  src/saga_core/saga_gui/saga_gui.vcxproj,
-	  src/saga_core/saga_gui/saga_gui.vcxproj.filters: saga_gui: data
-	  source browser added; currently only support for file system, in
-	  future database and internet sources will follow.
-
-2011-06-24 15:02  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Curvature_Classification.cpp:
-	  ta_morphometry: curvature classification: grid name was not set,
-	  look-up table added
-
-2011-06-24 14:36  oconrad
-
-	* src/modules/grid/grid_tools/Grid_Resample.cpp: grid_tools:
-	  resampling: 'additional grids' have to be optional
-
-2011-06-24 14:34  oconrad
-
-	* src/modules_images/modules_imagery/imagery_classification/MLB_Interface.cpp,
-	  src/modules_images/modules_imagery/imagery_classification/Makefile.am,
-	  src/modules_images/modules_imagery/imagery_classification/decision_tree.cpp,
-	  src/modules_images/modules_imagery/imagery_classification/decision_tree.h,
-	  src/modules_images/modules_imagery/imagery_classification/imagery_classification.vcxproj,
-	  src/modules_images/modules_imagery/imagery_classification/imagery_classification.vcxproj.filters:
-	  imagery_classification: simple 'decision tree' added
-
-2011-06-24 14:30  oconrad
-
-	* src/saga_core/saga_api/parameter_data.cpp: saga_api:
-	  sub-parameters updates via serializing enabled
-
-2011-06-23 09:20  johanvdw
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_morphometry/tpi.cpp:
-	  Unicode fixes to commit r1107
-
-2011-06-23 07:28  johanvdw
-
-	* src/saga_core/saga_api/Makefile.am: Revert r1103, doesn't work on
-	  opensuse
-
-2011-06-22 13:32  reklov_w
-
-	* src/modules_template/template: removing unused folders and files
-	  from template module
-
-2011-06-22 13:27  reklov_w
-
-	* src/modules_template/MLB_Interface.cpp,
-	  src/modules_template/MLB_Interface.h,
-	  src/modules_template/Makefile.am,
-	  src/modules_template/My_Module.cpp,
-	  src/modules_template/My_Module.h,
-	  src/modules_template/Template.sln,
-	  src/modules_template/Template.vc10.sln,
-	  src/modules_template/Template.vcproj,
-	  src/modules_template/Template.vcxproj,
-	  src/modules_template/Template.vcxproj.filters: moving files of
-	  template module within modules_template
-
-2011-06-22 13:03  reklov_w
-
-	* src/modules_template/template/template/MLB_Interface.cpp,
-	  src/modules_template/template/template/MLB_Interface.h,
-	  src/modules_template/template/template/Makefile.am,
-	  src/modules_template/template/template/My_Module.cpp,
-	  src/modules_template/template/template/My_Module.h,
-	  src/modules_template/template/template/Template.cpp,
-	  src/modules_template/template/template/Template.h,
-	  src/modules_template/template/template/Template.vcproj,
-	  src/modules_template/template/template/Template.vcxproj,
-	  src/modules_template/template/template/Template.vcxproj.filters:
-	  updates for modules_template: MLB name still "Template", module
-	  now "My_Module"
-
-2011-06-22 12:37  reklov_w
-
-	* src/modules_template/template/template/Template.bat: removing
-	  Template.bat from module template (was used for MinGW which is
-	  not supported anymore)
-
-2011-06-22 11:16  johanvdw
-
-	* src/modules_io/gdal/io_gdal/gdal_driver.cpp,
-	  src/modules_io/gdal/io_gdal/gdal_driver.h,
-	  src/modules_io/gdal/io_gdal/gdal_import.cpp: Fix unicode issue
-	  while reporting driver name
-
-2011-06-21 14:21  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_morphometry/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Makefile.am,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/ta_morphometry.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/ta_morphometry.vcxproj.filters,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/tpi.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/tpi.h:
-	  ta_morphometry, module added: topographic position index (tpi)
-	  and tpi based landform classification
-
-2011-06-21 14:18  oconrad
-
-	* src/saga_core/saga_api/parameters.cpp: saga_api: parameters,
-	  on_parameter_changed() call on loading from stream
-
-2011-06-21 14:11  oconrad
-
-	* src/saga_core/saga_api/grid.h,
-	  src/saga_core/saga_api/grid_system.cpp: saga_api:
-	  CSG_Grid_Cell_Addressor::Set_Annulus() function added
-
-2011-06-20 20:50  reklov_w
-
-	* src/modules/grid/grid_tools/Grid_Shrink_Expand.cpp,
-	  src/modules/grid/grid_tools/Grid_Shrink_Expand.h,
-	  src/modules/grid/grid_tools/MLB_Interface.cpp,
-	  src/modules/grid/grid_tools/Makefile.am,
-	  src/modules/grid/grid_tools/grid_tools.vcxproj,
-	  src/modules/grid/grid_tools/grid_tools.vcxproj.filters: new
-	  module Grid_Shrink_Expand added to MLB Grid_Tools
-
-2011-06-19 18:11  johanvdw
-
-	* src/saga_core/saga_api/Makefile.am: Build API only using base
-	  wxwidgets library, without gtk
-
-2011-06-19 18:02  johanvdw
-
-	* src/saga_core/saga_api/parameters.cpp: Small fix to previous
-	  commit for compiling with gcc (please review)
-
-2011-06-17 12:52  oconrad
-
-	* src/saga_core/saga_api/parameter_data.cpp,
-	  src/saga_core/saga_api/parameters.cpp,
-	  src/saga_core/saga_api/parameters.h,
-	  src/saga_core/saga_api/saga_api.vcxproj,
-	  src/saga_core/saga_gui/helper.cpp,
-	  src/saga_core/saga_gui/helper.h,
-	  src/saga_core/saga_gui/parameters_properties.cpp,
-	  src/saga_core/saga_gui/res_dialogs.cpp,
-	  src/saga_core/saga_gui/res_dialogs.h,
-	  src/saga_core/saga_gui/view_scatterplot.cpp,
-	  src/saga_core/saga_gui/view_table_diagram.cpp,
-	  src/saga_core/saga_gui/wksp_grid.cpp,
-	  src/saga_core/saga_gui/wksp_shapes.cpp: saga_api/saga_gui:
-	  parameter_font now stores a metadata string instead of a wxfont
-	  object.
-	  solves unnecessary lib-deps as discussed in
-	  http://sourceforge.net/mailarchive/forum.php?thread_name=4DFB0857.8070907%40faunalia.it&forum_name=saga-gis-developer
-
-2011-06-17 00:47  johanvdw
-
-	* src/modules_io/db/io_odbc/Makefile.am,
-	  src/saga_core/saga_odbc/otlv4.h: Fix building under GCC 4.6
-
-2011-06-16 21:08  johanvdw
-
-	* src/modules_contrib/garden/garden_webservices/MLB_Interface.cpp,
-	  src/modules_contrib/garden/garden_webservices/wms_import.cpp:
-	  Unicode fixes
-
-2011-06-16 16:06  oconrad
-
-	* src/modules/table/table_calculus/MLB_Interface.cpp,
-	  src/modules/table/table_calculus/Table_Calculator.cpp,
-	  src/modules/table/table_calculus/Table_Calculator.h,
-	  src/modules/table/table_calculus/Table_Trend.cpp,
-	  src/modules/table/table_calculus/Table_Trend.h,
-	  src/modules/table/table_tools/Join_Tables.cpp,
-	  src/modules/table/table_tools/Join_Tables.h,
-	  src/modules/table/table_tools/MLB_Interface.cpp,
-	  src/modules/table/table_tools/Makefile.am,
-	  src/modules/table/table_tools/Table_Create_Empty.cpp,
-	  src/modules/table/table_tools/Table_Create_Empty.h,
-	  src/modules/table/table_tools/Table_Enumerate.cpp,
-	  src/modules/table/table_tools/Table_Rotate.cpp,
-	  src/modules/table/table_tools/table_tools.vcxproj,
-	  src/modules/table/table_tools/table_tools.vcxproj.filters: module
-	  libraries table_tools & table_calculus: versions for shapes
-	  enhanced, join tables moved/added
-
-2011-06-16 16:04  oconrad
-
-	* src/modules/shapes/shapes_tools/JoinTables.cpp,
-	  src/modules/shapes/shapes_tools/JoinTables.h,
-	  src/modules/shapes/shapes_tools/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_tools/Makefile.am,
-	  src/modules/shapes/shapes_tools/Shapes_Assign_Table.cpp,
-	  src/modules/shapes/shapes_tools/Shapes_Assign_Table.h,
-	  src/modules/shapes/shapes_tools/Shapes_Create_Empty.cpp,
-	  src/modules/shapes/shapes_tools/Shapes_Create_Empty.h,
-	  src/modules/shapes/shapes_tools/shapes_polar_to_cartes.cpp,
-	  src/modules/shapes/shapes_tools/shapes_polar_to_cartes.h,
-	  src/modules/shapes/shapes_tools/shapes_tools.vcxproj,
-	  src/modules/shapes/shapes_tools/shapes_tools.vcxproj.filters:
-	  module library shapes_tools: several renamings, join tables moved
-	  to table_tools, polar to cartesion (3d shapes) module added
-
-2011-06-16 16:01  oconrad
-
-	* src/modules/shapes/shapes_grid/Grid_To_Points.cpp: module
-	  Grid_To_Points: '...to Shapes' renamed to '...to Points'
-
-2011-06-16 15:56  oconrad
-
-	* src/modules/grid/grid_tools/Grid_Resample.cpp: module
-	  Grid_Resample: resampling of multiple grids added
-
-2011-06-16 15:55  oconrad
-
-	* src/modules/pointcloud/pointcloud_viewer/points_view_control.cpp,
-	  src/modules/pointcloud/pointcloud_viewer/points_view_control.h:
-	  module pointcloud_viewer: dim effect added
-
-2011-06-16 15:54  oconrad
-
-	* src/modules/pointcloud/pointcloud_tools/pc_from_shapes.cpp:
-	  module pc_from_shapes: support for 3d shapes added
-
-2011-06-16 15:52  oconrad
-
-	* src/modules_contrib/garden/garden_3d_viewer/MLB_Interface.cpp,
-	  src/modules_contrib/garden/garden_webservices/MLB_Interface.cpp:
-	  garden modules: menu position moved to 'contributions'
-
-2011-06-16 15:50  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_hydrology/flow_massflux.cpp:
-	  module ta_hydrology/flow_massflux: 'flow accumulation' renamed to
-	  'catchmen area'
-
-2011-06-15 12:01  oconrad
-
-	* src/modules_projection/pj_proj4/pj_proj4/crs_base.cpp:
-	  projection(4) modules: geostationary option 'satellite height'
-	  added
-
-2011-06-15 11:26  oconrad
-
-	* configure.in, src/modules_contrib/garden/Makefile.am,
-	  src/modules_contrib/garden/garden_webservices,
-	  src/modules_contrib/garden/garden_webservices/MLB_Interface.cpp,
-	  src/modules_contrib/garden/garden_webservices/MLB_Interface.h,
-	  src/modules_contrib/garden/garden_webservices/Makefile.am,
-	  src/modules_contrib/garden/garden_webservices/garden_webservices.vc10.sln,
-	  src/modules_contrib/garden/garden_webservices/garden_webservices.vcxproj,
-	  src/modules_contrib/garden/garden_webservices/garden_webservices.vcxproj.filters,
-	  src/modules_contrib/garden/garden_webservices/osm_import.cpp,
-	  src/modules_contrib/garden/garden_webservices/osm_import.h,
-	  src/modules_contrib/garden/garden_webservices/wms_import.cpp,
-	  src/modules_contrib/garden/garden_webservices/wms_import.h,
-	  src/saga.vc10.sln: module library added: garden_webservices -
-	  experimental interfaces to wms and openstreetmap data via
-	  internet
-
-2011-06-14 15:54  oconrad
-
-	* src/saga_core/saga_gui/wksp_shapes.cpp: saga_gui: look-up table
-	  creation for shapes: attribute fields update added
-
-2011-06-09 09:46  reklov_w
-
-	* src/modules_io/shapes/io_shapes/pointcloud_from_text_file.cpp,
-	  src/modules_io/shapes/io_shapes_las/las_import.cpp,
-	  src/saga_core/saga_gui/wksp_pointcloud.cpp: point clouds: value
-	  aggregation parameter moved from graduated color to display
-	  parameter section (now available for all coloring types) and
-	  renamed from COLORS_AGGREGATE to DISPLAY_VALUE_AGGREGATE
-
-2011-06-08 10:12  reklov_w
-
-	* src/modules/grid/grid_filter/Filter_Majority.cpp,
-	  src/modules/grid/grid_filter/Filter_Majority.h: reverting r1080
-	  (patch 01-IntOverflow-Filter_Majority.patch) because VC10
-	  complains about undefined overloads; using int for the filter
-	  kernel should be fine, otherwise there have further changes to be
-	  made (e.g. the majority count has to be long too)
-
-2011-06-08 08:11  reklov_w
-
-	* src/saga_core/saga_api/api_core.h,
-	  src/saga_core/saga_api/api_file.cpp,
-	  src/saga_core/saga_api/pointcloud.cpp,
-	  src/saga_core/saga_api/table_dbase.h,
-	  src/saga_core/saga_api/table_io.cpp: applying patches from
-	  tracker (5 Issues working with files bigger than 4Gb - ID:
-	  3312690) - patch 06-LongFileOffsets.patch
-
-2011-06-08 08:10  reklov_w
-
-	* src/modules/shapes/shapes_grid/Grid_Classes_To_Shapes.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/fast_representativeness.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/GSPoints_Variogram_Surface.cpp,
-	  src/modules_images/modules_imagery/imagery_classification/classify_cluster_analysis.cpp,
-	  src/modules_images/modules_imagery/imagery_segmentation/rga_basic.cpp,
-	  src/modules_images/modules_imagery/imagery_segmentation/skeletonization.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_04.cpp,
-	  src/modules_simulation/cellular_automata/sim_cellular_automata/Wator.h,
-	  src/modules_simulation/hydrology/sim_hydrology/topmodel.cpp,
-	  src/modules_simulation/hydrology/sim_hydrology/topmodel_values.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ChannelNetwork_Altitude.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/Watersheds.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_AreaUpslope.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Hypsometry.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/Pit_Router.cpp:
-	  applying patches from tracker (5 Issues working with files bigger
-	  than 4Gb - ID: 3312690) - patch 05-IntOverflow-variables.patch
-
-2011-06-08 08:08  reklov_w
-
-	* src/saga_core/saga_api/grid.cpp,
-	  src/saga_core/saga_api/grid_io.cpp: applying patches from tracker
-	  (5 Issues working with files bigger than 4Gb - ID: 3312690) -
-	  patch 04-IntOverflow-CSG_Grid.patch
-
-2011-06-08 08:07  reklov_w
-
-	* src/modules/grid/grid_gridding/nn/nn.h,
-	  src/modules/grid/grid_gridding/nn/nnai.c,
-	  src/modules/grid/grid_spline/csa.c,
-	  src/modules/grid/grid_spline/csa.h: applying patches from tracker
-	  (5 Issues working with files bigger than 4Gb - ID: 3312690) -
-	  patch 03-IntOverflow-grid_resolution.patch
-
-2011-06-08 08:05  reklov_w
-
-	* src/modules/grid/grid_gridding/Interpolation_NaturalNeighbour.cpp,
-	  src/modules/grid/grid_spline/Gridding_Spline_CSA.cpp,
-	  src/modules/tin/tin_tools/TIN_From_Grid_Specific_Points.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/grid_pca.cpp,
-	  src/modules_images/modules_imagery/imagery_classification/change_detection.cpp,
-	  src/modules_images/modules_imagery/imagery_segmentation/watershed_segmentation.cpp,
-	  src/modules_images/modules_vigra/vigra/vigra_morphology.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_08.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_14.cpp,
-	  src/modules_simulation/hydrology/sim_hydrology/KinWav_D8.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ChannelNetwork_Distance.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_Distance.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_Parallel.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_RecursiveUp.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/SAGA_Wetness_Index.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/SlopeLength.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/SolarRadiation.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/topographic_correction.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/SurfaceSpecificPoints.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/relative_heights.cpp,
-	  src/saga_core/saga_api/grid.h,
-	  src/saga_core/saga_api/grid_memory.cpp,
-	  src/saga_core/saga_api/grid_operation.cpp,
-	  src/saga_core/saga_api/grid_system.cpp,
-	  src/saga_core/saga_api/module.h: applying patches from tracker (5
-	  Issues working with files bigger than 4Gb - ID: 3312690) - patch
-	  02-IntOverflow-Get_NCells.patch
-
-2011-06-08 07:59  reklov_w
-
-	* src/modules/grid/grid_filter/Filter_Majority.cpp,
-	  src/modules/grid/grid_filter/Filter_Majority.h: applying patches
-	  from tracker (5 Issues working with files bigger than 4Gb - ID:
-	  3312690) - patch 01-IntOverflow-Filter_Majority.patch
-
-2011-06-07 13:16  oconrad
-
-	* src/saga_core/saga_api/grid_memory.cpp: saga_api: grid memory
-	  issue fixed (?!), related to bug tracker item:
-	  http://sourceforge.net/tracker/?func=detail&aid=3264149&group_id=102728&atid=632652
-
-2011-06-07 11:12  oconrad
-
-	* src/modules/pointcloud/pointcloud_tools/pc_to_shapes.cpp,
-	  src/saga_core/saga_api/pointcloud.cpp,
-	  src/saga_core/saga_gui/wksp_pointcloud.cpp: saga_api, saga_gui,
-	  module point cloud conversion: improved point cloud / shapes
-	  compatibility, rgb attribute choice added
-
-2011-06-06 15:46  oconrad
-
-	* src/saga_core/saga_gui/view_table_control.cpp: saga_gui: table
-	  control: update object properties when table changed (add,
-	  delete, rename fields)
-
-2011-06-01 13:26  oconrad
-
-	* src/saga_core/saga_gui/wksp_map.cpp,
-	  src/saga_core/saga_gui/wksp_map_manager.cpp: saga_gui: allow
-	  clipboard copies of maps without a frame
-
-2011-05-31 16:15  oconrad
-
-	* src/saga_core/saga_gui/parameters_control.cpp: saga_gui:
-	  parameter list control (correct dis-/enabling behaviour restored)
-
-2011-05-31 15:04  oconrad
-
-	* src/saga_core/saga_api/parameter.cpp,
-	  src/saga_core/saga_api/parameter_data.cpp,
-	  src/saga_core/saga_api/parameters.h,
-	  src/saga_core/saga_gui/parameters_control.cpp,
-	  src/saga_core/saga_gui/parameters_properties.cpp,
-	  src/saga_core/saga_gui/wksp_base_control.cpp: saga_api, saga_gui:
-	  fixed minor bugs in parameter lists
-
-2011-05-31 15:03  oconrad
-
-	* src/saga_core/saga_gui/helper.h: saga_gui: flexible floating
-	  point precision in description tab
-
-2011-05-31 15:02  oconrad
-
-	* src/modules/shapes/shapes_polygons/Polygon_Union.cpp: module
-	  polygon dissolve: optional does not drop inner boundaries
-
-2011-05-27 08:41  oconrad
-
-	* src/saga_core/saga_gui/project.cpp: saga_gui: project saving:
-	  adding file extension to proposed file names
-
-2011-05-27 08:37  oconrad
-
-	* src/modules/shapes/shapes_points/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_points/Points_From_Lines.cpp,
-	  src/modules/shapes/shapes_points/Points_From_Lines.h: module
-	  added: multipoints to points conversion
-
-2011-05-27 08:36  oconrad
-
-	* src/modules_images/modules_imagery/imagery_classification/classify_cluster_analysis.cpp,
-	  src/saga_core/saga_api/mat_tools.cpp: saga_api: bug fix - cluster
-	  analysis: calculation of variances; minimum distance method
-	  stopped before it should
-
-2011-05-25 14:21  oconrad
-
-	* src/modules/shapes/shapes_tools/shapes_split_by_attribute.cpp:
-	  module: split shapes/table by attribute: bug fix
-
-2011-05-24 08:41  oconrad
-
-	* src/saga_core/saga_gui/project.cpp: saga_gui; project.cpp|save
-	  project bugs: scanf 32/64bit pointer, save all checker
-
-2011-05-18 16:02  oconrad
-
-	* src/modules/table/table_calculus/MLB_Interface.cpp,
-	  src/modules/table/table_calculus/Makefile.am,
-	  src/modules/table/table_calculus/Table_Calculator.cpp,
-	  src/modules/table/table_calculus/Table_Calculator.h,
-	  src/modules/table/table_calculus/table_calculus.vcxproj,
-	  src/modules/table/table_calculus/table_calculus.vcxproj.filters:
-	  modules: 'table calculator', field access now via field number
-	  (f1, f2, ..., fn) or field name (in square brackets, e.g. [field
-	  name])
-
-2011-05-18 15:58  oconrad
-
-	* src/modules/shapes/shapes_lines/line_properties.cpp,
-	  src/modules/shapes/shapes_polygons/Polygon_Geometrics.cpp,
-	  src/modules/shapes/shapes_polygons/Polygon_Geometrics.h: modules:
-	  line/polygon properties unified
-
-2011-05-18 12:47  oconrad
-
-	* src/modules/shapes/shapes_polygons/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_polygons/Makefile.am,
-	  src/modules/shapes/shapes_polygons/polygon_split_parts.cpp,
-	  src/modules/shapes/shapes_polygons/polygon_split_parts.h,
-	  src/modules/shapes/shapes_polygons/shapes_polygons.vcxproj,
-	  src/modules/shapes/shapes_polygons/shapes_polygons.vcxproj.filters:
-	  module added: split multi-polygon parts
-
-2011-05-18 12:45  oconrad
-
-	* src/saga_core/saga_api/grid.cpp: saga_api: no data default value
-	  of unsigned byte grids set to -127 (do not have no data cells
-	  initially)
-
-2011-05-18 12:42  oconrad
-
-	* src/modules/grid/grid_gridding/Shapes2Grid.cpp,
-	  src/saga_core/saga_api/shape_line.cpp,
-	  src/saga_core/saga_api/shape_polygon.cpp: saga_api: bug fixed in
-	  determination of intersection type for polygons/lines with
-	  rectangular regions
-
-2011-05-17 12:52  oconrad
-
-	* src/modules_io/esri_e00/io_esri_e00/ESRI_E00_Import.cpp,
-	  src/modules_io/esri_e00/io_esri_e00/ESRI_E00_Import.h: e00
-	  import: bug fix and enhancements
-
-2011-05-17 12:51  oconrad
-
-	* src/saga_core/saga_gui/wksp_base_item.cpp: saga_gui: unnecessary
-	  object description updates removed
-
-2011-05-17 12:50  oconrad
-
-	* src/saga_core/saga_gui/parameters_control.cpp: saga_gui: bug fix
-	  - integer properties with other than node parents now editable
-
-2011-05-17 12:48  oconrad
-
-	* src/saga_core/saga_api/shapes_io.cpp: saga_api: serious bug
-	  fixed!!! saving multi-part shapes
-
-2011-05-09 07:59  oconrad
-
-	* src/modules_io/gdal/io_gdal/gdal_driver.cpp,
-	  src/modules_io/gdal/io_gdal/gdal_driver.h,
-	  src/modules_io/gdal/io_gdal/gdal_export.cpp,
-	  src/modules_io/gdal/io_gdal/gdal_import.cpp,
-	  src/modules_io/gdal/io_gdal/io_gdal.vcxproj,
-	  src/saga_core/saga_gui/saga.cpp: gdal linkage updated and
-	  improved
-
-2011-05-09 07:55  oconrad
-
-	* src/saga_core/saga_api/api_core.h,
-	  src/saga_core/saga_api/api_file.cpp: api function added to
-	  get/set environment variables
-
-2011-05-06 10:20  reklov_w
-
-	* src/modules_io/grid/io_grid_image/grid_export.cpp: export image
-	  command line: now possible to export RGB coded grid as image
-
-2011-05-05 16:13  oconrad
-
-	* src/modules/shapes/shapes_points/remove_duplicates.cpp,
-	  src/modules/shapes/shapes_points/remove_duplicates.h: enhanced
-	  options for 'remove duplicate points'
-
-2011-05-05 16:13  oconrad
-
-	* src/saga_core/saga_gui/res_commands.cpp: naming error for table
-	  function 'Show' (not 'Add to Map')
-
-2011-05-04 16:06  oconrad
-
-	* configure.in, src/modules_contrib/Makefile.am,
-	  src/modules_contrib/garden/Makefile.am: garden added to linux
-	  configuration
-
-2011-05-04 15:55  oconrad
-
-	* src/modules_images/modules_opencv/opencv/opencv.h,
-	  src/modules_images/modules_opencv/opencv/opencv.vcxproj: update:
-	  linking to opencv v2.2
-
-2011-05-04 15:54  oconrad
-
-	* src/modules/grid/grid_calculus/grid_calculus.vcproj,
-	  src/modules/shapes/shapes_grid/shapes_grid.vcproj,
-	  src/modules_contrib/garden/garden_3d_viewer/garden_3d_viewer.vcproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/ta_hydrology.vcproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/ta_preprocessor.vcproj,
-	  src/saga.sln, src/saga_core/saga_gui/saga_gui.vcproj: update of
-	  vc9 projects (without x64 targets)
-
-2011-05-04 14:29  oconrad
-
-	* src/modules/grid/grid_analysis/grid_analysis.dsp,
-	  src/modules/grid/grid_calculus/grid_calculus.dsp,
-	  src/modules/grid/grid_calculus_bsl/grid_calculus_bsl.dsp,
-	  src/modules/grid/grid_filter/grid_filter.dsp,
-	  src/modules/grid/grid_gridding/grid_gridding.dsp,
-	  src/modules/grid/grid_spline/grid_spline.dsp,
-	  src/modules/grid/grid_tools/grid_tools.dsp,
-	  src/modules/grid/grid_visualisation/grid_visualisation.dsp,
-	  src/modules/pointcloud/pointcloud_tools/pointcloud_tools.dsp,
-	  src/modules/pointcloud/pointcloud_viewer/pointcloud_viewer.dsp,
-	  src/modules/shapes/shapes_grid/shapes_grid.dsp,
-	  src/modules/shapes/shapes_lines/shapes_lines.dsp,
-	  src/modules/shapes/shapes_lines_ex/shapes_lines_ex.dsp,
-	  src/modules/shapes/shapes_points/shapes_points.dsp,
-	  src/modules/shapes/shapes_polygons/shapes_polygons.dsp,
-	  src/modules/shapes/shapes_tools/shapes_tools.dsp,
-	  src/modules/shapes/shapes_transect/shapes_transect.dsp,
-	  src/modules/table/table_calculus/table_calculus.dsp,
-	  src/modules/table/table_tools/table_tools.dsp,
-	  src/modules/tin/tin_tools/tin_tools.dsp,
-	  src/modules/tin/tin_viewer/tin_viewer.dsp,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/contrib_a_perego.dsp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres.dsp,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/contrib_t_wutzler.dsp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/geostatistics_grid.dsp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/geostatistics_kriging.dsp,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/geostatistics_points.dsp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/geostatistics_regression.dsp,
-	  src/modules_images/modules_imagery/imagery_classification/imagery_classification.dsp,
-	  src/modules_images/modules_imagery/imagery_rga/imagery_rga.dsp,
-	  src/modules_images/modules_imagery/imagery_segmentation/imagery_segmentation.dsp,
-	  src/modules_images/modules_imagery/imagery_tools/imagery_tools.dsp,
-	  src/modules_images/modules_opencv/opencv/opencv.dsp,
-	  src/modules_images/modules_vigra/vigra/vigra.dsp,
-	  src/modules_io/db/io_db_mysql/io_db_mysql.dsp,
-	  src/modules_io/db/io_odbc/io_odbc.dsp,
-	  src/modules_io/docs/docs_html/docs_html.dsp,
-	  src/modules_io/docs/docs_pdf/docs_pdf.dsp,
-	  src/modules_io/esri_e00/io_esri_e00/io_esri_e00.dsp,
-	  src/modules_io/gdal/io_gdal/io_gdal.dsp,
-	  src/modules_io/gps/io_gps/io_gps.dsp,
-	  src/modules_io/grid/io_grid/io_grid.dsp,
-	  src/modules_io/grid/io_grid_grib2/io_grid_grib2.dsp,
-	  src/modules_io/grid/io_grid_grib2/io_grid_grib2.dsw,
-	  src/modules_io/grid/io_grid_grib2/io_grid_grib2_x.dsp,
-	  src/modules_io/grid/io_grid_image/io_grid_image.dsp,
-	  src/modules_io/shapes/io_shapes/io_shapes.dsp,
-	  src/modules_io/shapes/io_shapes_dxf/io_shapes_dxf.dsp,
-	  src/modules_io/shapes/io_shapes_las/io_shapes_las.dsp,
-	  src/modules_io/table/io_table/io_table.dsp,
-	  src/modules_lectures/lectures/lectures_introduction/lectures_introduction.dsp,
-	  src/modules_projection/pj_georeference/pj_georeference/pj_georeference.dsp,
-	  src/modules_projection/pj_geotrans/pj_geotrans/pj_geotrans.dsp,
-	  src/modules_projection/pj_proj4/pj_proj4/pj_proj4.dsp,
-	  src/modules_recreations/recreations/recreations_fractals/recreations_fractals.dsp,
-	  src/modules_recreations/recreations/recreations_games/recreations_games.dsp,
-	  src/modules_simulation/cellular_automata/sim_cellular_automata/sim_cellular_automata.dsp,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/sim_ecosystems_hugget.dsp,
-	  src/modules_simulation/fire/sim_fire_spreading/sim_fire_spreading.dsp,
-	  src/modules_simulation/hydrology/sim_hydrology/sim_hydrology.dsp,
-	  src/modules_template/template/template/Template.dsp,
-	  src/modules_template/template/template/Template.dsw,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ta_channels.dsp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_compound/ta_compound.dsp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/ta_hydrology.dsp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/ta_lighting.dsp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/ta_morphometry.dsp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/ta_preprocessor.dsp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/ta_profiles.dsp,
-	  src/saga.dsw, src/saga_core/saga_api/saga_api.dsp,
-	  src/saga_core/saga_cmd/saga_cmd.dsp,
-	  src/saga_core/saga_gdi/saga_gdi.dsp,
-	  src/saga_core/saga_gui/saga_gui.dsp,
-	  src/saga_core/saga_odbc/saga_odbc.dsp: support stopped for ms vc6
-	  projects
-
-2011-05-04 14:09  oconrad
-
-	* src/saga.vc10.sln: experimental 3d shapes viewer added to SAGA's
-	  garden, where it will stay until harvest time has come
-
-2011-05-04 14:06  oconrad
-
-	* src/modules_contrib/garden,
-	  src/modules_contrib/garden/garden_3d_viewer,
-	  src/modules_contrib/garden/garden_3d_viewer/3dshapes_view_control.cpp,
-	  src/modules_contrib/garden/garden_3d_viewer/3dshapes_view_control.h,
-	  src/modules_contrib/garden/garden_3d_viewer/3dshapes_view_dialog.cpp,
-	  src/modules_contrib/garden/garden_3d_viewer/3dshapes_view_dialog.h,
-	  src/modules_contrib/garden/garden_3d_viewer/3dshapes_view_module.cpp,
-	  src/modules_contrib/garden/garden_3d_viewer/3dshapes_view_module.h,
-	  src/modules_contrib/garden/garden_3d_viewer/MLB_Interface.cpp,
-	  src/modules_contrib/garden/garden_3d_viewer/MLB_Interface.h,
-	  src/modules_contrib/garden/garden_3d_viewer/Makefile.am,
-	  src/modules_contrib/garden/garden_3d_viewer/garden_3d_viewer.vcproj,
-	  src/modules_contrib/garden/garden_3d_viewer/garden_3d_viewer.vcxproj,
-	  src/modules_contrib/garden/garden_3d_viewer/garden_3d_viewer.vcxproj.filters:
-	  experimental 3d shapes viewer added to SAGA's garden, where it
-	  will stay until harvest time has come
-
-2011-05-04 14:02  oconrad
-
-	* src/saga_core/saga_gui/res_commands.cpp,
-	  src/saga_core/saga_gui/res_commands.h,
-	  src/saga_core/saga_gui/view_map.cpp,
-	  src/saga_core/saga_gui/view_map.h,
-	  src/saga_core/saga_gui/wksp_map.cpp,
-	  src/saga_core/saga_gui/wksp_map.h,
-	  src/saga_core/saga_gui/wksp_shapes.cpp: added: map to rgb coded
-	  grid conversion (without file saving)
-
-2011-05-04 14:00  oconrad
-
-	* src/modules/tin/tin_viewer/tin_view_control.cpp,
-	  src/modules/tin/tin_viewer/tin_view_control.h,
-	  src/modules/tin/tin_viewer/tin_view_dialog.cpp,
-	  src/modules/tin/tin_viewer/tin_view_dialog.h,
-	  src/modules/tin/tin_viewer/tin_view_module.cpp: support for
-	  draping of rgb coded grids
-
-2011-05-03 15:41  oconrad
-
-	* src/saga_core/saga_gui/parameters_control.cpp: read-only
-	  properties (informative) are displayed in grayed mode (disabled)
-
-2011-05-03 15:40  oconrad
-
-	* src/modules/grid/grid_tools/Grid_Resample.cpp,
-	  src/saga_core/saga_api/parameter.cpp: bug fix and enhancement:
-	  user defined target grid
-
-2011-05-03 15:38  oconrad
-
-	* src/saga_core/saga_gui/wksp_pointcloud.cpp,
-	  src/saga_core/saga_gui/wksp_pointcloud.h: pointcloud properties
-
-2011-05-03 10:53  oconrad
-
-	* src/saga_core/saga_api/pointcloud.cpp: bug fix: missing call of
-	  create() in default constructor
-
-2011-05-03 10:21  oconrad
-
-	* src/modules/pointcloud/pointcloud_tools/pc_cut.cpp,
-	  src/saga_core/saga_gui/view_table_diagram.cpp,
-	  src/saga_core/saga_gui/wksp_shapes.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_point.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_polygon.cpp: property dialogs:
-	  improved display behaviour
-
-2011-05-03 10:20  oconrad
-
-	* src/modules_io/shapes/io_shapes_las/las_import.cpp: bug fix: data
-	  set has been swallowed
-
-2011-05-03 10:15  oconrad
-
-	* src/saga_core/saga_api/api_file.cpp: patched: get file name
-	  without extension
-
-2011-05-02 16:04  oconrad
-
-	* src/modules/pointcloud/pointcloud_tools/pc_cluster_analysis.cpp,
-	  src/modules/shapes/shapes_grid/Grid_Classes_To_Shapes.cpp,
-	  src/modules_io/shapes/io_shapes/pointcloud_from_text_file.cpp,
-	  src/modules_io/shapes/io_shapes_las/las_import.cpp,
-	  src/saga_core/saga_gui/view_histogram.cpp,
-	  src/saga_core/saga_gui/wksp_grid.cpp,
-	  src/saga_core/saga_gui/wksp_layer.cpp,
-	  src/saga_core/saga_gui/wksp_layer_classify.cpp,
-	  src/saga_core/saga_gui/wksp_pointcloud.cpp,
-	  src/saga_core/saga_gui/wksp_shapes.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_line.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_point.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_polygon.cpp,
-	  src/saga_core/saga_gui/wksp_tin.cpp: bug fix: shapes parameter
-	  "COLORS_ATTRIB" has been replaced by "LUT_ATTRIB" and
-	  "METRIC_ATTRIB"
-
-2011-04-29 11:52  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/Makefile.am,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/burn_in_streams.cpp:
-	  burn in stream network: bug fix and makefile update
-
-2011-04-28 16:29  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/burn_in_streams.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/burn_in_streams.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/ta_preprocessor.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/ta_preprocessor.vcxproj.filters:
-	  'burn stream network into dem' module added
-
-2011-04-28 16:21  oconrad
-
-	* src/modules/grid/grid_analysis/Makefile.am: linux compiler error
-	  fixed
-
-2011-04-28 16:18  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_hydrology/ta_hydrology.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/ta_hydrology.vcxproj.filters:
-	  project entry removed for removed file (basin_grid.h)
-
-2011-04-28 16:16  oconrad
-
-	* src/modules/shapes/shapes_grid/Grid_Classes_To_Shapes.h,
-	  src/modules/shapes/shapes_grid/Grid_Polygon_Clip.h,
-	  src/modules/shapes/shapes_grid/Grid_Statistics_AddTo_Polygon.h,
-	  src/modules/shapes/shapes_grid/Grid_To_Contour.h,
-	  src/modules/shapes/shapes_grid/Grid_To_Gradient.cpp,
-	  src/modules/shapes/shapes_grid/Grid_To_Gradient.h,
-	  src/modules/shapes/shapes_grid/Grid_To_Points.h,
-	  src/modules/shapes/shapes_grid/Grid_To_Points_Random.h,
-	  src/modules/shapes/shapes_grid/Grid_Values_AddTo_Points.h,
-	  src/modules/shapes/shapes_grid/Grid_Values_AddTo_Shapes.h,
-	  src/modules/shapes/shapes_grid/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_grid/grid_extent.h,
-	  src/modules/shapes/shapes_grid/grid_local_extremes_to_points.h:
-	  shapes_grid modules: resorted and renamed (where appropriate)
-
-2011-04-28 08:51  johanvdw
-
-	* configure.in: Bump version number in configure.in
-
-2011-04-27 19:45  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_Distance.h:
-	  unicode compiler error fixed
-
-2011-04-27 19:34  oconrad
-
-	* src/saga_core/saga_gui/wksp_shapes_polygon.cpp: bug fix: drawing
-	  polygons with unique symbol
-
-2011-04-27 19:07  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_compound/TA_Standard.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/TopographicIndices.cpp:
-	  bug fix
-
-2011-04-27 18:46  oconrad
-
-	* src/saga_core/saga_gui/parameters_control.cpp,
-	  src/saga_core/saga_gui/wksp_grid.cpp,
-	  src/saga_core/saga_gui/wksp_layer.cpp,
-	  src/saga_core/saga_gui/wksp_layer.h,
-	  src/saga_core/saga_gui/wksp_pointcloud.cpp,
-	  src/saga_core/saga_gui/wksp_shapes.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_point.cpp,
-	  src/saga_core/saga_gui/wksp_tin.cpp: restructured data object
-	  parameters, hiding/disabling included
-
-2011-04-27 18:45  oconrad
-
-	* src/modules/tin/tin_viewer/MLB_Interface.cpp: module library name
-	  changed
-
-2011-04-27 18:44  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_hydrology/BasinGrid.h:
-
-2011-04-27 18:42  oconrad
-
-	* src/saga_core/saga_api/dataobject.cpp,
-	  src/saga_core/saga_api/dataobject.h,
-	  src/saga_core/saga_api/grid.cpp, src/saga_core/saga_api/grid.h:
-	  get/set description methods for all csg_data_object derived
-	  classes
-
-2011-04-27 18:40  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_compound/TA_Standard.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/BasinGrid.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/CellBalance.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/EdgeContamination.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/EdgeContamination.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/FlowDepth.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/FlowDepth.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_Distance.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_Parallel.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_RecursiveDown.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_RecursiveUp.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Helper.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Helper.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/IsochronesConst.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/IsochronesVar.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/LakeFlood.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Makefile.am,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Pt.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/SAGA_Wetness_Index.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Sinuosity.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/SlopeLength.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/SlopeLength.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/TopographicIndices.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/TopographicIndices.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/flow_width.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/ta_hydrology.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/ta_hydrology.vcxproj.filters,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Morphometry.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/ruggedness.cpp:
-	  changed namings and menu paths of terrain analysis modules
-
-2011-04-27 10:19  oconrad
-
-	* src/modules_projection/pj_proj4/pj_proj4/crs_base.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_base.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/SolarRadiation.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/SolarRadiation.h,
-	  src/saga_core/saga_api/module.cpp,
-	  src/saga_core/saga_api/module.h,
-	  src/saga_core/saga_api/parameter.cpp,
-	  src/saga_core/saga_api/parameters.cpp,
-	  src/saga_core/saga_api/parameters.h,
-	  src/saga_core/saga_gui/parameters_control.cpp,
-	  src/saga_core/saga_gui/project.cpp,
-	  src/saga_core/saga_gui/project.h,
-	  src/saga_core/saga_gui/wksp_base_item.cpp,
-	  src/saga_core/saga_gui/wksp_base_item.h,
-	  src/saga_core/saga_gui/wksp_data_manager.h,
-	  src/saga_core/saga_gui/wksp_grid.cpp,
-	  src/saga_core/saga_gui/wksp_grid.h,
-	  src/saga_core/saga_gui/wksp_grid_system.h,
-	  src/saga_core/saga_gui/wksp_layer.cpp,
-	  src/saga_core/saga_gui/wksp_layer.h,
-	  src/saga_core/saga_gui/wksp_map.cpp,
-	  src/saga_core/saga_gui/wksp_map.h,
-	  src/saga_core/saga_gui/wksp_map_manager.h,
-	  src/saga_core/saga_gui/wksp_module_manager.h,
-	  src/saga_core/saga_gui/wksp_pointcloud.cpp,
-	  src/saga_core/saga_gui/wksp_pointcloud.h,
-	  src/saga_core/saga_gui/wksp_shapes.cpp,
-	  src/saga_core/saga_gui/wksp_shapes.h,
-	  src/saga_core/saga_gui/wksp_shapes_line.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_line.h,
-	  src/saga_core/saga_gui/wksp_shapes_point.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_point.h,
-	  src/saga_core/saga_gui/wksp_shapes_points.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_points.h,
-	  src/saga_core/saga_gui/wksp_shapes_polygon.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_polygon.h,
-	  src/saga_core/saga_gui/wksp_table.cpp,
-	  src/saga_core/saga_gui/wksp_table.h,
-	  src/saga_core/saga_gui/wksp_tin.cpp,
-	  src/saga_core/saga_gui/wksp_tin.h: parameter change event:
-	  separate functions for changing and enabling other parameters
-
-2011-04-26 16:21  oconrad
-
-	* src/saga_core/saga_gui/wksp_grid.cpp,
-	  src/saga_core/saga_gui/wksp_grid.h,
-	  src/saga_core/saga_gui/wksp_shapes.cpp: hiding inactive
-	  properties from settings (colour options: grids, shapes)
-
-2011-04-26 15:28  oconrad
-
-	* src/modules_projection/pj_proj4/pj_proj4/crs_base.cpp,
-	  src/saga_core/saga_api/parameters.cpp,
-	  src/saga_core/saga_api/parameters.h,
-	  src/saga_core/saga_gui/parameters_control.cpp: bug fix: allow
-	  conditional changes of dependent parameters when one parameter
-	  changes
-
-2011-04-26 12:53  oconrad
-
-	* src/saga_core/saga_gui/helper.cpp: bug fix: double click on
-	  module (workspace), loading description from saga wiki caused
-	  deadlock
-
-2011-04-26 11:53  oconrad
-
-	* src/modules_projection/pj_proj4/pj_proj4/crs_base.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/SolarRadiation.cpp,
-	  src/saga_core/saga_api/api_colors.cpp,
-	  src/saga_core/saga_api/api_core.h,
-	  src/saga_core/saga_api/parameters.h,
-	  src/saga_core/saga_gui/parameters_control.cpp: property defaults
-	  and disabling: bug fix, disabled items will be hidden
-
-2011-04-26 11:52  oconrad
-
-	* src/modules/shapes/shapes_tools/Shapes_Assign_Table.cpp: BLOB
-	  support
-
-2011-04-21 08:14  oconrad
-
-	* src/saga_core/saga_gui/parameters_control.cpp: bug fix: restoring
-	  to defaults did not graphically update combo boxes
-
-2011-04-20 18:14  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_lighting/SolarRadiation.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/SolarRadiation.h:
-	  context sensitive disabling of parameters added
-
-2011-04-20 16:08  oconrad
-
-	* src/modules_projection/pj_proj4/pj_proj4/crs_base.cpp,
-	  src/saga_core/saga_gui/parameters_control.cpp: bug fix:
-	  dis-/enabling properties
-
-2011-04-20 11:57  oconrad
-
-	* src/modules_projection/pj_proj4/pj_proj4/crs_base.cpp,
-	  src/saga_core/saga_api/parameter_data.cpp,
-	  src/saga_core/saga_api/parameters.cpp,
-	  src/saga_core/saga_api/parameters.h,
-	  src/saga_core/saga_gui/dlg_parameters.cpp,
-	  src/saga_core/saga_gui/dlg_parameters.h,
-	  src/saga_core/saga_gui/parameters_control.cpp,
-	  src/saga_core/saga_gui/parameters_control.h,
-	  src/saga_core/saga_gui/res_controls.cpp,
-	  src/saga_core/saga_gui/res_controls.h: parameters support: state
-	  enabled/disabled, resetting of default values
-
-2011-04-19 16:03  oconrad
-
-	* src/saga_core/saga_gui/res/saga.ger.txt: german translation
-	  update (thanks to j.brunke, gifhorn)
-
-2011-04-19 12:21  oconrad
-
-	* src/saga_core/saga_gui/wksp_module_manager.cpp: module library
-	  manager description
-
-2011-04-19 10:21  oconrad
-
-	* src/saga_core/saga_gui/helper.cpp,
-	  src/saga_core/saga_gui/helper.h,
-	  src/saga_core/saga_gui/saga_frame.cpp,
-	  src/saga_core/saga_gui/saga_gui.vcxproj,
-	  src/saga_core/saga_gui/wksp_grid.cpp,
-	  src/saga_core/saga_gui/wksp_module.cpp,
-	  src/saga_core/saga_gui/wksp_module_manager.cpp,
-	  src/saga_core/saga_gui/wksp_pointcloud.cpp,
-	  src/saga_core/saga_gui/wksp_shapes.cpp,
-	  src/saga_core/saga_gui/wksp_table.cpp,
-	  src/saga_core/saga_gui/wksp_tin.cpp: get module description
-	  optionally from online sources
-	  (http://sourceforge.net/apps/trac/saga-gis/wiki/)
-	  source page coding: library name (no 'lib' prefix) + '_' + module
-	  identifier (number)
-	  e.g. 'ta_morphometry_17' would refer to module 'Vector Ruggedness
-	  Measure (VRM)'
-
-2011-04-19 09:56  oconrad
-
-	* src/saga_core/saga_gui/wksp_module_library.cpp: bug fix
-
-2011-04-19 09:55  oconrad
-
-	* src/saga_core/saga_api/module.cpp,
-	  src/saga_core/saga_api/module.h,
-	  src/saga_core/saga_api/module_library_interface.cpp: support for
-	  live long module identifier
-
-2011-04-18 13:43  oconrad
-
-	* src/saga_core/saga_api/saga_api.h,
-	  src/saga_core/saga_gui/dlg_about.cpp: getting prepared for coming
-	  v2.0.7 release
-
-2011-04-18 13:43  oconrad
-
-	* src/saga_core/saga_gui/wksp_grid.cpp,
-	  src/saga_core/saga_gui/wksp_map_dc.h: bug fix: grid to image
-	  conversion
-	  solves
-	  http://sourceforge.net/tracker/?func=detail&aid=3251858&group_id=102728&atid=632652
-
-2011-04-18 13:41  oconrad
-
-	* src/saga_core/saga_api/api_string.cpp: bug fix: string to long
-	  conversion returned false for '0'
-	  solves
-	  http://sourceforge.net/tracker/?func=detail&aid=3287406&group_id=102728&atid=632652
-
-2011-04-15 10:37  oconrad
-
-	* src/saga_core/saga_api/shapes.h: changing vertex order of shapes:
-	  bug fix
-
-2011-04-15 10:35  oconrad
-
-	* src/saga_core/saga_api/shape_part.cpp,
-	  src/saga_core/saga_api/shapes.cpp,
-	  src/saga_core/saga_api/shapes.h: changing vertex order of shapes
-
-2011-04-15 09:50  oconrad
-
-	* src/saga_core/saga_api/shapes.cpp: minor bug fix in shapes
-	  make_clean() function (z/m polygon check!)
-
-2011-04-15 08:35  oconrad
-
-	* src/saga_core/saga_api/shapes.cpp,
-	  src/saga_core/saga_api/shapes.h,
-	  src/saga_core/saga_api/shapes_io.cpp: minor bug fix and
-	  enhancements in shapes classes
-
-2011-04-14 16:05  oconrad
-
-	* src/modules_io/gdal/io_gdal/ogr_driver.cpp,
-	  src/modules_io/gdal/io_gdal/ogr_driver.h,
-	  src/saga_core/saga_api/shape_part.cpp,
-	  src/saga_core/saga_api/shapes_io.cpp,
-	  src/saga_core/saga_gui/wksp_shapes.cpp: shape vertex dimension
-	  issues (x,y,z,m):
-	  bug fix writing x,y,z (no m) shapes,
-	  gdal/ogr support enabled
-
-2011-04-13 16:47  oconrad
-
-	* src/saga_core/saga_api/shapes.cpp,
-	  src/saga_core/saga_api/shapes_io.cpp: shapes z/m support:
-	  read/save bug fixed
-
-2011-04-13 07:45  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_Profile_From_Lines.cpp:
-	  bug fix in profile from lines
-
-2011-04-12 16:36  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_Profile_From_Lines.cpp:
-	  profiles from line: optionally uses field name for splitted line
-	  namings
-
-2011-04-12 15:56  oconrad
-
-	* src/modules_geostatistics/geostatistics/geostatistics_regression/point_trend_surface.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/point_trend_surface.h:
-	  enhanced flexibility for polynomial regression
-
-2011-04-12 15:55  oconrad
-
-	* src/modules/shapes/shapes_polygons/polygon_to_points.cpp: z/m
-	  support for vertices
-
-2011-04-12 15:54  oconrad
-
-	* src/modules/shapes/shapes_polygons/polygon_line_intersection.cpp:
-	  polygon/line intersection bug fixed
-
-2011-04-12 15:48  oconrad
-
-	* src/saga_core/saga_api/shape_part.cpp,
-	  src/saga_core/saga_api/shape_points.cpp,
-	  src/saga_core/saga_api/shapes.h: z/m support for shape vertices
-
-2011-04-07 14:42  oconrad
-
-	* src/saga_core/saga_cmd/module_library.cpp,
-	  src/saga_core/saga_cmd/module_library.h: serious bug has been
-	  fixed which prevented saga_cmd to work!
-
-2011-04-06 15:33  oconrad
-
-	* src/saga_core/saga_gui/wksp_grid.cpp,
-	  src/saga_core/saga_gui/wksp_shapes.cpp: look-up table creation
-	  support for unique values, equal intervals, quantiles
-
-2011-04-06 15:33  oconrad
-
-	* src/saga_core/saga_api/table_dbase.cpp: return strings from dbase
-	  files without unnecessary (and often annoying) white spaces
-
-2011-04-06 15:30  oconrad
-
-	* src/modules/grid/grid_calculus/MLB_Interface.cpp,
-	  src/modules/grid/grid_calculus/Makefile.am,
-	  src/modules/grid/grid_calculus/grid_calculus.vcxproj,
-	  src/modules/grid/grid_calculus/grid_calculus.vcxproj.filters,
-	  src/modules/grid/grid_calculus/grid_difference.cpp,
-	  src/modules/grid/grid_calculus/grids_trend_polynom.cpp,
-	  src/modules/grid/grid_calculus/grids_trend_polynom.h: module
-	  added: cell wise trend function
-
-2011-04-05 13:59  oconrad
-
-	* src/modules_projection/pj_proj4/pj_proj4/PROJ4_Grid.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/PROJ4_Grid.h,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_base.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_transform.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_transform_grid.cpp:
-	  improved user defined target grid system analysis
-
-2011-04-05 13:55  oconrad
-
-	* src/modules/shapes/shapes_grid/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_grid/Makefile.am,
-	  src/modules/shapes/shapes_grid/grid_extent.cpp,
-	  src/modules/shapes/shapes_grid/grid_extent.h,
-	  src/modules/shapes/shapes_grid/shapes_grid.vcxproj,
-	  src/modules/shapes/shapes_grid/shapes_grid.vcxproj.filters:
-	  module added: grid system extent as polygon layer
-
-2011-04-04 12:57  reklov_w
-
-	* src/modules/tin/tin_viewer/tin_viewer.vcproj, src/saga.sln:
-	  Update tin_viewer.vcproj file and add project to saga.sln for
-	  VS2008 compilation
-
-2011-04-04 12:03  reklov_w
-
-	* src/modules/grid/grid_analysis/grid_analysis.vcproj,
-	  src/modules/grid/grid_calculus/grid_calculus.vcproj,
-	  src/modules/shapes/shapes_lines/shapes_lines.vcproj,
-	  src/modules/shapes/shapes_points/shapes_points.vcproj,
-	  src/modules/shapes/shapes_polygons/shapes_polygons.vcproj,
-	  src/modules/shapes/shapes_tools/shapes_tools.vcproj,
-	  src/modules_io/db/io_odbc/io_odbc.vcproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ta_channels.vcproj:
-	  fix .vcproj files to make SAGA compile under VS2008
-
-2011-04-03 11:05  reklov_w
-
-	* src/saga_core/saga_gui/wksp_module.cpp: fix to respect bDialog in
-	  "stop execution" for interactive modules
-
-2011-04-02 17:23  reklov_w
-
-	* src/saga_core/saga_gui/callback.cpp: fix CALLBACK_STOP_EXECUTION
-	  for interactive modules
-
-2011-04-01 10:38  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_morphometry/air_flow_height.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/air_flow_height.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/wind_effect.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/wind_effect.h:
-	  wind effect calculation support for variable wind
-	  directions/speeds
-
-2011-04-01 10:37  oconrad
-
-	* src/saga_core/saga_gui/wksp_shapes.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_line.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_point.cpp: 'no data' shapes
-	  only hidden in graduated colors mode, look-up table creation
-	  support for equal intervals
-
-2011-04-01 10:35  oconrad
-
-	* src/saga_core/saga_api/projections.cpp,
-	  src/saga_core/saga_gui/res/saga_dic.txt: ogc wkt datum conversion
-	  bug and swiss oblique mercator fix
-
-2011-04-01 10:34  oconrad
-
-	* src/saga_core/saga_api/grid_system.cpp: grid system destruction
-	  zeroes all dimensions
-
-2011-03-28 10:37  reklov_w
-
-	* src/saga_core/saga_api/mat_formula.cpp: fix description string of
-	  operators to handle "less than" character (html)
-
-2011-03-28 10:36  reklov_w
-
-	* src/saga_core/saga_gui/project.cpp: fix progress bar reset on
-	  "save project"
-
-2011-03-27 17:51  reklov_w
-
-	* src/saga_core/saga_api/pointcloud.cpp: fix automatic append of
-	  .spc file name extension on "project save all"
-
-2011-03-25 13:26  oconrad
-
-	* src/modules/grid/grid_gridding/nn/nncommon.c,
-	  src/modules_io/docs/docs_pdf/Profile_Cross_Sections.cpp:
-	  compilation error fixed (typos ;-) )
-
-2011-03-25 08:50  oconrad
-
-	* src/modules/grid/grid_calculus/Makefile.am: rect/polar
-	  conversions moved to grid_calculus
-
-2011-03-25 00:40  johanvdw
-
-	* src/modules_simulation/hydrology/sim_hydrology/WaterRetentionCapacity.cpp:
-	  Fix memory leak
-
-2011-03-25 00:37  johanvdw
-
-	* src/modules_io/docs/docs_pdf/Profile_Cross_Sections.cpp: Another
-	  memory leak
-	  
-	  detected with cppcheck
-
-2011-03-25 00:31  johanvdw
-
-	* src/modules/grid/grid_gridding/nn/nncommon.c: Fix memory leak
-	  
-	  detected with cppcheck
-
-2011-03-25 00:01  johanvdw
-
-	* src/modules/pointcloud/pointcloud_tools/pc_from_shapes.cpp: Fix
-	  mimatching deallocator
-	  
-	  (not really a problem, but fixing it removes a warning, making
-	  debugging easier)
-
-2011-03-24 23:59  johanvdw
-
-	* src/modules/grid/grid_calculus_bsl/pars_all.cpp: Fix memory leak
-
-2011-03-24 23:56  johanvdw
-
-	* src/modules/grid/grid_analysis/Grid_AHP.cpp,
-	  src/modules/grid/grid_analysis/owa.cpp: Only delete initialised
-	  variables
-
-2011-03-24 23:50  johanvdw
-
-	* src/saga_core/saga_api/shapes_ogis.cpp: Fix potential memory leak
-
-2011-03-24 23:45  johanvdw
-
-	* src/modules/grid/grid_analysis/Makefile.am: Remove rect/polar
-	  conversion from grid_analysis Makefile.am
-	  
-	  Fixes automated compilation
-
-2011-03-24 17:23  oconrad
-
-	* src/modules/grid/grid_analysis/Cost_PolarToRect.cpp,
-	  src/modules/grid/grid_analysis/Cost_PolarToRect.h,
-	  src/modules/grid/grid_analysis/Cost_RectToPolar.cpp,
-	  src/modules/grid/grid_analysis/Cost_RectToPolar.h,
-	  src/modules/grid/grid_analysis/grid_analysis.vcxproj,
-	  src/modules/grid/grid_analysis/grid_analysis.vcxproj.filters,
-	  src/modules/grid/grid_calculus/MLB_Interface.cpp,
-	  src/modules/grid/grid_calculus/gradient_cartes_polar.cpp,
-	  src/modules/grid/grid_calculus/gradient_cartes_polar.h,
-	  src/modules/grid/grid_calculus/grid_calculus.vcxproj,
-	  src/modules/grid/grid_calculus/grid_calculus.vcxproj.filters,
-	  src/modules/grid/grid_calculus/grid_metric_conversion.cpp,
-	  src/modules/grid/grid_calculus/grid_metric_conversion.h:
-	  'rect/polar' conversion has been enhanced and moved to
-	  grid_calculus library.
-
-2011-03-24 17:20  oconrad
-
-	* src/modules/grid/grid_analysis/MLB_Interface.cpp,
-	  src/saga_core/saga_api/module.h,
-	  src/saga_core/saga_api/module_library.cpp,
-	  src/saga_core/saga_api/module_library_interface.cpp,
-	  src/saga_core/saga_cmd/module_library.cpp,
-	  src/saga_core/saga_cmd/module_library.h,
-	  src/saga_core/saga_cmd/saga_cmd.cpp,
-	  src/saga_core/saga_gui/saga.cpp,
-	  src/saga_core/saga_gui/wksp_module_library.cpp: module management
-	  enhancements: from now removed modules can be replaced by a dummy
-	  to continue module access via enumeration (e.g. for maintainence
-	  of scripts or R bindings)
-	  includes a preliminary bug fix in saga_cmd for
-	  https://sourceforge.net/tracker/?func=detail&atid=632652&aid=3240208&group_id=102728
-
-2011-03-23 12:12  oconrad
-
-	* src/modules/shapes/shapes_polygons/polygon_line_intersection.cpp:
-	  gcc compilation error fixed; improvements applied (but still to
-	  be continued)
-
-2011-03-22 17:05  oconrad
-
-	* src/modules/shapes/shapes_polygons/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_polygons/Makefile.am,
-	  src/modules/shapes/shapes_polygons/polygon_line_intersection.cpp,
-	  src/modules/shapes/shapes_polygons/polygon_line_intersection.h,
-	  src/modules/shapes/shapes_polygons/polygon_to_edges_nodes.cpp,
-	  src/modules/shapes/shapes_polygons/polygon_to_edges_nodes.h,
-	  src/modules/shapes/shapes_polygons/shapes_polygons.vcxproj,
-	  src/modules/shapes/shapes_polygons/shapes_polygons.vcxproj.filters,
-	  src/saga_core/saga_api/shapes.h: vector topology related studies
-	  (to be continued)
-
-2011-03-20 23:46  reklov_w
-
-	* src/saga_core/saga_gui/project.cpp: bug fix "save project"
-	  (datasets were actually not saved) for win 64bit
-
-2011-03-18 16:21  oconrad
-
-	* src/modules/shapes/shapes_tools/quadtree_structure.cpp,
-	  src/modules/shapes/shapes_tools/quadtree_structure.h,
-	  src/saga_core/saga_api/quadtree.cpp,
-	  src/saga_core/saga_api/shapes.h: improved csg_quadtree
-	  implementation
-
-2011-03-18 16:20  oconrad
-
-	* src/saga_core/saga_api/shape_polygon.cpp: improved polygon/shape
-	  intersection analysis
-
-2011-03-18 16:18  oconrad
-
-	* src/saga_core/saga_api/geo_functions.cpp: simplified crossing
-	  calculation
-
-2011-03-18 16:17  oconrad
-
-	* src/saga_core/saga_api/shapes_ogis.cpp: case insensitivity for
-	  ogc key words
-
-2011-03-14 13:21  oconrad
-
-	* src/modules/grid/grid_analysis/Soil_Texture.cpp,
-	  src/modules/grid/grid_analysis/Soil_Texture.h: bug fix and
-	  enhancements (input of sand, clay and silt)
-
-2011-03-08 10:26  reklov_w
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_channels/Makefile.am:
-	  Helper.cpp/.h removed
-
-2011-03-03 11:56  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_channels/Helper.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/Helper.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/Watersheds_ext.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ta_channels.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ta_channels.vcxproj.filters:
-	  bug fix and clean up (helper.cpp/h removed)
-
-2011-03-02 15:32  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_channels/Watersheds_ext.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/Watersheds_ext.h:
-	  reworked extented watershed analysis
-
-2011-03-02 15:31  oconrad
-
-	* src/saga_core/saga_api/grid.h: CSG_Grid_System::Get_xTo(), ...
-	  functions made static
-
-2011-02-27 00:58  reklov_w
-
-	* src/modules/pointcloud/pointcloud_tools/pc_attribute_calculator.cpp:
-	  added parameter choice for field data storage type of the
-	  attribute to calculate
-
-2011-02-26 23:48  reklov_w
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_channels/Watersheds_ext.cpp:
-	  fixed access violations due to "out of grid extent" value
-	  requests and memory leaks
-
-2011-02-25 20:13  johanvdw
-
-	* src/saga_core/saga_api/Makefile.am: Correction to previous fix
-
-2011-02-25 15:17  oconrad
-
-	* src/modules/table/table_tools/Table_Enumerate.cpp,
-	  src/saga_core/saga_api/table.cpp: CSG_Table::Assign/Create now
-	  accepts derived classes too (i.e. shapes, pointcloud)
-
-2011-02-25 15:15  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Convergence_Radius.cpp:
-	  improved slope representation
-
-2011-02-25 10:36  oconrad
-
-	* src/modules/shapes/shapes_points/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_points/Makefile.am,
-	  src/modules/shapes/shapes_points/points_thinning.cpp,
-	  src/modules/shapes/shapes_points/points_thinning.h,
-	  src/modules/shapes/shapes_points/shapes_points.vcxproj,
-	  src/modules/shapes/shapes_points/shapes_points.vcxproj.filters:
-	  points thinning module added
-
-2011-02-25 10:33  johanvdw
-
-	* src/saga_core/saga_api/Makefile.am: Small fix to enable python
-	  unicode build
-
-2011-02-24 13:57  oconrad
-
-	* src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Convergence_Radius.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Convergence_Radius.h:
-	  bug fix and optimisation
-
-2011-02-24 13:56  oconrad
-
-	* src/modules/shapes/shapes_tools/shapes_buffer.cpp: optional
-	  output of separate buffers for each input shape
-
-2011-02-24 13:55  oconrad
-
-	* src/saga_core/saga_api/grid.h,
-	  src/saga_core/saga_api/grid_system.cpp: CSG_Grid_Cell_Addressor:
-	  radius initialisation with floating point support
-
-2011-02-24 13:53  oconrad
-
-	* src/saga_core/saga_api/module.cpp: CSG_Module::On_Execute():
-	  unnecessary check of additional parameters removed (could cause
-	  unwanted dialog popups)
-
-2011-02-23 17:20  oconrad
-
-	* configure.in, src/modules/tin/Makefile.am,
-	  src/modules/tin/tin_viewer,
-	  src/modules/tin/tin_viewer/MLB_Interface.cpp,
-	  src/modules/tin/tin_viewer/MLB_Interface.h,
-	  src/modules/tin/tin_viewer/Makefile.am,
-	  src/modules/tin/tin_viewer/tin_view_control.cpp,
-	  src/modules/tin/tin_viewer/tin_view_control.h,
-	  src/modules/tin/tin_viewer/tin_view_dialog.cpp,
-	  src/modules/tin/tin_viewer/tin_view_dialog.h,
-	  src/modules/tin/tin_viewer/tin_view_module.cpp,
-	  src/modules/tin/tin_viewer/tin_view_module.h,
-	  src/modules/tin/tin_viewer/tin_viewer.dsp,
-	  src/modules/tin/tin_viewer/tin_viewer.vcproj,
-	  src/modules/tin/tin_viewer/tin_viewer.vcxproj,
-	  src/modules/tin/tin_viewer/tin_viewer.vcxproj.filters,
-	  src/saga.vc10.sln: 2.5d viewer for tin added
-
-2011-02-22 10:04  reklov_w
-
-	* src/saga_core/saga_api/saga_api.h,
-	  src/saga_core/saga_api/saga_api_to_python_linux.py,
-	  src/saga_core/saga_api/saga_api_to_python_linux.sh,
-	  src/saga_core/saga_api/saga_api_to_python_win.bat,
-	  src/saga_core/saga_api/saga_api_to_python_win.py: introduced
-	  _SAGA_PYTHON preprocessor define (to allow also other swig builds
-	  than python)
-
-2011-02-21 16:03  oconrad
-
-	* src/modules/shapes/shapes_tools/SeparateShapes.cpp,
-	  src/modules/shapes/shapes_tools/SeparateShapes.h: module renamed
-	  and output changed to memory to meet saga module standards
-
-2011-02-21 16:01  oconrad
-
-	* src/modules/table/table_tools/Table_Enumerate.cpp: enumeration by
-	  record index added
-
-2011-02-21 16:00  oconrad
-
-	* src/modules/shapes/shapes_tools/quadtree_structure.cpp: counting
-	  of duplicate points
-
-2011-02-21 15:59  oconrad
-
-	* src/modules/shapes/shapes_points/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_points/Makefile.am,
-	  src/modules/shapes/shapes_points/select_points.cpp,
-	  src/modules/shapes/shapes_points/select_points.h,
-	  src/modules/shapes/shapes_points/shapes_points.vcxproj,
-	  src/modules/shapes/shapes_points/shapes_points.vcxproj.filters:
-	  interactive point selection module added
-
-2011-02-21 15:57  oconrad
-
-	* src/modules/shapes/shapes_points/points_filter.cpp,
-	  src/modules/shapes/shapes_points/points_filter.h,
-	  src/modules/shapes/shapes_points/remove_duplicates.cpp,
-	  src/modules/shapes/shapes_points/remove_duplicates.h: adaption of
-	  new quadtree search features
-
-2011-02-21 15:56  oconrad
-
-	* src/saga_core/saga_api/quadtree.cpp,
-	  src/saga_core/saga_api/shapes.h: Quadtree classes: support for
-	  statistics and multiple points at same location
-
-2011-02-21 15:54  oconrad
-
-	* src/saga_core/saga_api/shapes.cpp: CSG_Shapes::Assign: now
-	  supports CSG_PointCloud class
-
-2011-02-21 15:53  oconrad
-
-	* src/saga_core/saga_api/mat_tools.cpp,
-	  src/saga_core/saga_api/mat_tools.h: CSG_Simple_Statistics: copy
-	  constructor, = operator, optional value list, added
-
-2011-02-21 15:52  oconrad
-
-	* src/saga_core/saga_api/api_core.h,
-	  src/saga_core/saga_api/api_file.cpp,
-	  src/saga_core/saga_api/api_memory.cpp: CSG_Array: copy
-	  constructor / = operator added
-
-2011-02-21 15:51  oconrad
-
-	* src/saga_core/saga_api/api_string.cpp,
-	  src/saga_core/saga_api/grid_io.cpp,
-	  src/saga_core/saga_api/mat_trend.cpp,
-	  src/saga_core/saga_api/pointcloud.cpp,
-	  src/saga_core/saga_api/table.cpp,
-	  src/saga_core/saga_api/table_dbase.cpp: size_t/int type castings
-	  (opressing unwanted compiler warnings)
-
-2011-02-17 12:50  oconrad
-
-	* src/modules/shapes/shapes_points/convex_hull.cpp: bug fix
-
-2011-02-17 11:56  oconrad
-
-	* src/modules/shapes/shapes_points/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_points/Makefile.am,
-	  src/modules/shapes/shapes_points/convex_hull.cpp,
-	  src/modules/shapes/shapes_points/convex_hull.h,
-	  src/modules/shapes/shapes_points/shapes_points.vcxproj,
-	  src/modules/shapes/shapes_points/shapes_points.vcxproj.filters:
-	  convex hull construction added
-
-2011-02-16 17:18  oconrad
-
-	* src/modules/shapes/shapes_points/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_points/Makefile.am,
-	  src/modules/shapes/shapes_points/points_filter.cpp,
-	  src/modules/shapes/shapes_points/points_filter.h,
-	  src/modules/shapes/shapes_points/shapes_points.vcxproj,
-	  src/modules/shapes/shapes_points/shapes_points.vcxproj.filters:
-	  points filter added
-
-2011-02-16 17:15  oconrad
-
-	* src/saga_core/saga_api/pointcloud.cpp: bug fix: Get_Shape(int),
-	  when requesting a record a second time
-
-2011-02-16 17:13  oconrad
-
-	* src/saga_core/saga_api/api_memory.cpp: bug fix, tracker:
-	  http://sourceforge.net/tracker/?func=detail&aid=3182340&group_id=102728&atid=632652
-
-2011-02-15 14:27  oconrad
-
-	* src/saga.vc10.sln: build order / dependencies updated
-
-2011-02-15 08:43  oconrad
-
-	* src/modules/shapes/shapes_lines/Lines_From_Points.cpp,
-	  src/modules/shapes/shapes_lines/Lines_From_Points.h,
-	  src/modules/shapes/shapes_lines/Lines_From_Polygons.cpp,
-	  src/modules/shapes/shapes_lines/Lines_From_Polygons.h,
-	  src/modules/shapes/shapes_points/Points_From_Lines.cpp,
-	  src/modules/shapes/shapes_points/Points_From_Lines.h,
-	  src/modules/shapes/shapes_points/Points_From_Table.cpp,
-	  src/modules/shapes/shapes_points/Points_From_Table.h,
-	  src/modules/shapes/shapes_polygons/Polygons_From_Lines.cpp,
-	  src/modules/shapes/shapes_polygons/Polygons_From_Lines.h,
-	  src/modules/shapes/shapes_polygons/polygon_to_points.cpp,
-	  src/modules/shapes/shapes_polygons/polygon_to_points.h:
-
-2011-02-14 23:55  reklov_w
-
-	* src/modules/shapes/shapes_lines/line_dissolve.cpp: fixed typo in
-	  line_dissolve.cpp module description
-
-2011-02-14 23:54  reklov_w
-
-	* src/modules/shapes/shapes_lines/Makefile.am: added line_dissolve
-	  module to Makefile.am
-
-2011-02-14 21:52  reklov_w
-
-	* src/saga_core/saga_gui/wksp_shapes_edit.cpp: fix gcc error in
-	  wksp_shapes_edit.cpp
-
-2011-02-14 16:38  reklov_w
-
-	* AUTHORS, ChangeLog, Makefile.am, NEWS, README, configure.in,
-	  m4/ax_pkg_swig.m4, m4/ax_python_devel.m4,
-	  m4/ax_swig_enable_cxx.m4, m4/ax_swig_python.m4, src/Makefile.am,
-	  src/dev_tools/MLB_Interface.cpp, src/dev_tools/MLB_Interface.h,
-	  src/dev_tools/Makefile.am, src/dev_tools/dev_tools.vc10.sln,
-	  src/dev_tools/dev_tools.vcxproj,
-	  src/dev_tools/dev_tools.vcxproj.filters,
-	  src/dev_tools/tl_extract.cpp, src/dev_tools/tl_extract.h,
-	  src/dev_tools/tl_merge.cpp, src/dev_tools/tl_merge.h,
-	  src/dev_tools/tl_union.cpp, src/dev_tools/tl_union.h,
-	  src/gpl.txt, src/install.txt, src/lgpl.txt,
-	  src/modules/Makefile.am, src/modules/grid/Makefile.am,
-	  src/modules/grid/grid_analysis/Cost_Anisotropic.cpp,
-	  src/modules/grid/grid_analysis/Cost_Anisotropic.h,
-	  src/modules/grid/grid_analysis/Cost_Isotropic.cpp,
-	  src/modules/grid/grid_analysis/Cost_Isotropic.h,
-	  src/modules/grid/grid_analysis/Cost_PolarToRect.cpp,
-	  src/modules/grid/grid_analysis/Cost_PolarToRect.h,
-	  src/modules/grid/grid_analysis/Cost_RectToPolar.cpp,
-	  src/modules/grid/grid_analysis/Cost_RectToPolar.h,
-	  src/modules/grid/grid_analysis/CoveredDistance.cpp,
-	  src/modules/grid/grid_analysis/CoveredDistance.h,
-	  src/modules/grid/grid_analysis/CrossClassification.cpp,
-	  src/modules/grid/grid_analysis/CrossClassification.h,
-	  src/modules/grid/grid_analysis/Grid_AHP.cpp,
-	  src/modules/grid/grid_analysis/Grid_AHP.h,
-	  src/modules/grid/grid_analysis/Grid_AggregationIndex.cpp,
-	  src/modules/grid/grid_analysis/Grid_AggregationIndex.h,
-	  src/modules/grid/grid_analysis/Grid_CVA.cpp,
-	  src/modules/grid/grid_analysis/Grid_CVA.h,
-	  src/modules/grid/grid_analysis/Grid_LayerOfMaximumValue.cpp,
-	  src/modules/grid/grid_analysis/Grid_LayerOfMaximumValue.h,
-	  src/modules/grid/grid_analysis/Grid_Pattern.cpp,
-	  src/modules/grid/grid_analysis/Grid_Pattern.h,
-	  src/modules/grid/grid_analysis/LeastCostPathProfile.cpp,
-	  src/modules/grid/grid_analysis/LeastCostPathProfile.h,
-	  src/modules/grid/grid_analysis/LeastCostPathProfile_Points.cpp,
-	  src/modules/grid/grid_analysis/LeastCostPathProfile_Points.h,
-	  src/modules/grid/grid_analysis/MLB_Interface.cpp,
-	  src/modules/grid/grid_analysis/MLB_Interface.h,
-	  src/modules/grid/grid_analysis/Makefile.am,
-	  src/modules/grid/grid_analysis/PointsEx.cpp,
-	  src/modules/grid/grid_analysis/PointsEx.h,
-	  src/modules/grid/grid_analysis/Soil_Texture.cpp,
-	  src/modules/grid/grid_analysis/Soil_Texture.h,
-	  src/modules/grid/grid_analysis/fragmentation_base.cpp,
-	  src/modules/grid/grid_analysis/fragmentation_base.h,
-	  src/modules/grid/grid_analysis/fragmentation_classify.cpp,
-	  src/modules/grid/grid_analysis/fragmentation_classify.h,
-	  src/modules/grid/grid_analysis/fragmentation_resampling.cpp,
-	  src/modules/grid/grid_analysis/fragmentation_resampling.h,
-	  src/modules/grid/grid_analysis/fragmentation_standard.cpp,
-	  src/modules/grid/grid_analysis/fragmentation_standard.h,
-	  src/modules/grid/grid_analysis/grid_analysis.dsp,
-	  src/modules/grid/grid_analysis/grid_analysis.vcproj,
-	  src/modules/grid/grid_analysis/grid_analysis.vcxproj,
-	  src/modules/grid/grid_analysis/grid_analysis.vcxproj.filters,
-	  src/modules/grid/grid_analysis/owa.cpp,
-	  src/modules/grid/grid_analysis/owa.h,
-	  src/modules/grid/grid_calculus/Fuzzify.cpp,
-	  src/modules/grid/grid_calculus/Fuzzify.h,
-	  src/modules/grid/grid_calculus/FuzzyAND.cpp,
-	  src/modules/grid/grid_calculus/FuzzyAND.h,
-	  src/modules/grid/grid_calculus/FuzzyOR.cpp,
-	  src/modules/grid/grid_calculus/FuzzyOR.h,
-	  src/modules/grid/grid_calculus/Grid_Calculator.cpp,
-	  src/modules/grid/grid_calculus/Grid_Calculator.h,
-	  src/modules/grid/grid_calculus/Grid_Geometric_Figures.cpp,
-	  src/modules/grid/grid_calculus/Grid_Geometric_Figures.h,
-	  src/modules/grid/grid_calculus/Grid_Normalise.cpp,
-	  src/modules/grid/grid_calculus/Grid_Normalise.h,
-	  src/modules/grid/grid_calculus/Grid_Plotter.cpp,
-	  src/modules/grid/grid_calculus/Grid_Plotter.h,
-	  src/modules/grid/grid_calculus/Grid_Random_Field.cpp,
-	  src/modules/grid/grid_calculus/Grid_Random_Field.h,
-	  src/modules/grid/grid_calculus/Grid_Random_Terrain.cpp,
-	  src/modules/grid/grid_calculus/Grid_Random_Terrain.h,
-	  src/modules/grid/grid_calculus/Grid_Volume.cpp,
-	  src/modules/grid/grid_calculus/Grid_Volume.h,
-	  src/modules/grid/grid_calculus/MLB_Interface.cpp,
-	  src/modules/grid/grid_calculus/MLB_Interface.h,
-	  src/modules/grid/grid_calculus/Makefile.am,
-	  src/modules/grid/grid_calculus/grid_calculus.dsp,
-	  src/modules/grid/grid_calculus/grid_calculus.vcproj,
-	  src/modules/grid/grid_calculus/grid_calculus.vcxproj,
-	  src/modules/grid/grid_calculus/grid_calculus.vcxproj.filters,
-	  src/modules/grid/grid_calculus/grid_difference.cpp,
-	  src/modules/grid/grid_calculus/grid_difference.h,
-	  src/modules/grid/grid_calculus_bsl/MLB_Interface.cpp,
-	  src/modules/grid/grid_calculus_bsl/MLB_Interface.h,
-	  src/modules/grid/grid_calculus_bsl/Makefile.am,
-	  src/modules/grid/grid_calculus_bsl/ausdruck.cpp,
-	  src/modules/grid/grid_calculus_bsl/ausdruck.h,
-	  src/modules/grid/grid_calculus_bsl/auswert_anweisung.cpp,
-	  src/modules/grid/grid_calculus_bsl/auswert_anweisung.h,
-	  src/modules/grid/grid_calculus_bsl/auswert_foreach.cpp,
-	  src/modules/grid/grid_calculus_bsl/auswert_foreach.h,
-	  src/modules/grid/grid_calculus_bsl/auswert_if.cpp,
-	  src/modules/grid/grid_calculus_bsl/auswert_if.h,
-	  src/modules/grid/grid_calculus_bsl/auswert_zuweisung.cpp,
-	  src/modules/grid/grid_calculus_bsl/auswert_zuweisung.h,
-	  src/modules/grid/grid_calculus_bsl/basistypen.cpp,
-	  src/modules/grid/grid_calculus_bsl/basistypen.h,
-	  src/modules/grid/grid_calculus_bsl/bedingung.cpp,
-	  src/modules/grid/grid_calculus_bsl/bedingung.h,
-	  src/modules/grid/grid_calculus_bsl/bsl_interpreter.cpp,
-	  src/modules/grid/grid_calculus_bsl/bsl_interpreter.h,
-	  src/modules/grid/grid_calculus_bsl/diverses.cpp,
-	  src/modules/grid/grid_calculus_bsl/diverses.h,
-	  src/modules/grid/grid_calculus_bsl/foreach.cpp,
-	  src/modules/grid/grid_calculus_bsl/foreach.h,
-	  src/modules/grid/grid_calculus_bsl/funktion.cpp,
-	  src/modules/grid/grid_calculus_bsl/funktion.h,
-	  src/modules/grid/grid_calculus_bsl/funktion_numerisch.h,
-	  src/modules/grid/grid_calculus_bsl/funktion_statistisch.h,
-	  src/modules/grid/grid_calculus_bsl/gr_def.h,
-	  src/modules/grid/grid_calculus_bsl/gr_syst.h,
-	  src/modules/grid/grid_calculus_bsl/grid_bsl.cpp,
-	  src/modules/grid/grid_calculus_bsl/grid_bsl.h,
-	  src/modules/grid/grid_calculus_bsl/grid_calculus_bsl.dsp,
-	  src/modules/grid/grid_calculus_bsl/grid_calculus_bsl.vcproj,
-	  src/modules/grid/grid_calculus_bsl/grid_calculus_bsl.vcxproj,
-	  src/modules/grid/grid_calculus_bsl/grid_calculus_bsl.vcxproj.filters,
-	  src/modules/grid/grid_calculus_bsl/interpolation.cpp,
-	  src/modules/grid/grid_calculus_bsl/interpolation.h,
-	  src/modules/grid/grid_calculus_bsl/pars_all.cpp,
-	  src/modules/grid/grid_calculus_bsl/pars_all.h,
-	  src/modules/grid/grid_calculus_bsl/vector.cpp,
-	  src/modules/grid/grid_calculus_bsl/vector.h,
-	  src/modules/grid/grid_calculus_bsl/zuweisung.cpp,
-	  src/modules/grid/grid_calculus_bsl/zuweisung.h,
-	  src/modules/grid/grid_filter/Filter.cpp,
-	  src/modules/grid/grid_filter/Filter.h,
-	  src/modules/grid/grid_filter/FilterClumps.cpp,
-	  src/modules/grid/grid_filter/FilterClumps.h,
-	  src/modules/grid/grid_filter/Filter_3x3.cpp,
-	  src/modules/grid/grid_filter/Filter_3x3.h,
-	  src/modules/grid/grid_filter/Filter_Gauss.cpp,
-	  src/modules/grid/grid_filter/Filter_Gauss.h,
-	  src/modules/grid/grid_filter/Filter_LoG.cpp,
-	  src/modules/grid/grid_filter/Filter_LoG.h,
-	  src/modules/grid/grid_filter/Filter_Majority.cpp,
-	  src/modules/grid/grid_filter/Filter_Majority.h,
-	  src/modules/grid/grid_filter/Filter_Morphology.cpp,
-	  src/modules/grid/grid_filter/Filter_Morphology.h,
-	  src/modules/grid/grid_filter/Filter_Multi_Dir_Lee.cpp,
-	  src/modules/grid/grid_filter/Filter_Multi_Dir_Lee.h,
-	  src/modules/grid/grid_filter/Filter_Rank.cpp,
-	  src/modules/grid/grid_filter/Filter_Rank.h,
-	  src/modules/grid/grid_filter/Filter_Terrain_SlopeBased.cpp,
-	  src/modules/grid/grid_filter/Filter_Terrain_SlopeBased.h,
-	  src/modules/grid/grid_filter/MLB_Interface.cpp,
-	  src/modules/grid/grid_filter/MLB_Interface.h,
-	  src/modules/grid/grid_filter/Makefile.am,
-	  src/modules/grid/grid_filter/Pt.h,
-	  src/modules/grid/grid_filter/grid_filter.dsp,
-	  src/modules/grid/grid_filter/grid_filter.vcproj,
-	  src/modules/grid/grid_filter/grid_filter.vcxproj,
-	  src/modules/grid/grid_filter/grid_filter.vcxproj.filters,
-	  src/modules/grid/grid_gridding/Interpolation.cpp,
-	  src/modules/grid/grid_gridding/Interpolation.h,
-	  src/modules/grid/grid_gridding/Interpolation_InverseDistance.cpp,
-	  src/modules/grid/grid_gridding/Interpolation_InverseDistance.h,
-	  src/modules/grid/grid_gridding/Interpolation_NaturalNeighbour.cpp,
-	  src/modules/grid/grid_gridding/Interpolation_NaturalNeighbour.h,
-	  src/modules/grid/grid_gridding/Interpolation_NearestNeighbour.cpp,
-	  src/modules/grid/grid_gridding/Interpolation_NearestNeighbour.h,
-	  src/modules/grid/grid_gridding/Interpolation_Shepard.cpp,
-	  src/modules/grid/grid_gridding/Interpolation_Shepard.h,
-	  src/modules/grid/grid_gridding/Interpolation_Triangulation.cpp,
-	  src/modules/grid/grid_gridding/Interpolation_Triangulation.h,
-	  src/modules/grid/grid_gridding/MLB_Interface.cpp,
-	  src/modules/grid/grid_gridding/MLB_Interface.h,
-	  src/modules/grid/grid_gridding/Makefile.am,
-	  src/modules/grid/grid_gridding/Shapes2Grid.cpp,
-	  src/modules/grid/grid_gridding/Shapes2Grid.h,
-	  src/modules/grid/grid_gridding/Shepard.cpp,
-	  src/modules/grid/grid_gridding/Shepard.h,
-	  src/modules/grid/grid_gridding/grid_gridding.dsp,
-	  src/modules/grid/grid_gridding/grid_gridding.vcproj,
-	  src/modules/grid/grid_gridding/grid_gridding.vcxproj,
-	  src/modules/grid/grid_gridding/grid_gridding.vcxproj.filters,
-	  src/modules/grid/grid_gridding/kernel_density.cpp,
-	  src/modules/grid/grid_gridding/kernel_density.h,
-	  src/modules/grid/grid_gridding/nn/delaunay.c,
-	  src/modules/grid/grid_gridding/nn/delaunay.h,
-	  src/modules/grid/grid_gridding/nn/hash.c,
-	  src/modules/grid/grid_gridding/nn/hash.h,
-	  src/modules/grid/grid_gridding/nn/istack.c,
-	  src/modules/grid/grid_gridding/nn/istack.h,
-	  src/modules/grid/grid_gridding/nn/lpi.c,
-	  src/modules/grid/grid_gridding/nn/nan.h,
-	  src/modules/grid/grid_gridding/nn/nn.h,
-	  src/modules/grid/grid_gridding/nn/nnai.c,
-	  src/modules/grid/grid_gridding/nn/nncommon.c,
-	  src/modules/grid/grid_gridding/nn/nnpi.c,
-	  src/modules/grid/grid_gridding/nn/triangle.c,
-	  src/modules/grid/grid_gridding/nn/triangle.h,
-	  src/modules/grid/grid_gridding/nn/version.h,
-	  src/modules/grid/grid_spline/Gridding_Spline_BA.cpp,
-	  src/modules/grid/grid_spline/Gridding_Spline_BA.h,
-	  src/modules/grid/grid_spline/Gridding_Spline_Base.cpp,
-	  src/modules/grid/grid_spline/Gridding_Spline_Base.h,
-	  src/modules/grid/grid_spline/Gridding_Spline_CSA.cpp,
-	  src/modules/grid/grid_spline/Gridding_Spline_CSA.h,
-	  src/modules/grid/grid_spline/Gridding_Spline_MBA.cpp,
-	  src/modules/grid/grid_spline/Gridding_Spline_MBA.h,
-	  src/modules/grid/grid_spline/Gridding_Spline_MBA_Grid.cpp,
-	  src/modules/grid/grid_spline/Gridding_Spline_MBA_Grid.h,
-	  src/modules/grid/grid_spline/Gridding_Spline_TPS_Global.cpp,
-	  src/modules/grid/grid_spline/Gridding_Spline_TPS_Global.h,
-	  src/modules/grid/grid_spline/Gridding_Spline_TPS_Local.cpp,
-	  src/modules/grid/grid_spline/Gridding_Spline_TPS_Local.h,
-	  src/modules/grid/grid_spline/Gridding_Spline_TPS_TIN.cpp,
-	  src/modules/grid/grid_spline/Gridding_Spline_TPS_TIN.h,
-	  src/modules/grid/grid_spline/MLB_Interface.cpp,
-	  src/modules/grid/grid_spline/MLB_Interface.h,
-	  src/modules/grid/grid_spline/Makefile.am,
-	  src/modules/grid/grid_spline/csa.c,
-	  src/modules/grid/grid_spline/csa.h,
-	  src/modules/grid/grid_spline/grid_spline.dsp,
-	  src/modules/grid/grid_spline/grid_spline.vcproj,
-	  src/modules/grid/grid_spline/grid_spline.vcxproj,
-	  src/modules/grid/grid_spline/grid_spline.vcxproj.filters,
-	  src/modules/grid/grid_tools/CreateGridSystem.cpp,
-	  src/modules/grid/grid_tools/CreateGridSystem.h,
-	  src/modules/grid/grid_tools/Grid_Aggregate.cpp,
-	  src/modules/grid/grid_tools/Grid_Aggregate.h,
-	  src/modules/grid/grid_tools/Grid_Buffer.cpp,
-	  src/modules/grid/grid_tools/Grid_Buffer.h,
-	  src/modules/grid/grid_tools/Grid_Buffer_Proximity.cpp,
-	  src/modules/grid/grid_tools/Grid_Buffer_Proximity.h,
-	  src/modules/grid/grid_tools/Grid_CombineGrids.cpp,
-	  src/modules/grid/grid_tools/Grid_CombineGrids.h,
-	  src/modules/grid/grid_tools/Grid_Completion.cpp,
-	  src/modules/grid/grid_tools/Grid_Completion.h,
-	  src/modules/grid/grid_tools/Grid_ConstantGrid.cpp,
-	  src/modules/grid/grid_tools/Grid_ConstantGrid.h,
-	  src/modules/grid/grid_tools/Grid_CropToData.cpp,
-	  src/modules/grid/grid_tools/Grid_CropToData.h,
-	  src/modules/grid/grid_tools/Grid_Cut.cpp,
-	  src/modules/grid/grid_tools/Grid_Cut.h,
-	  src/modules/grid/grid_tools/Grid_Fill.cpp,
-	  src/modules/grid/grid_tools/Grid_Fill.h,
-	  src/modules/grid/grid_tools/Grid_Gaps.cpp,
-	  src/modules/grid/grid_tools/Grid_Gaps.h,
-	  src/modules/grid/grid_tools/Grid_Gaps_OneCell.cpp,
-	  src/modules/grid/grid_tools/Grid_Gaps_OneCell.h,
-	  src/modules/grid/grid_tools/Grid_Gaps_Spline_Fill.cpp,
-	  src/modules/grid/grid_tools/Grid_Gaps_Spline_Fill.h,
-	  src/modules/grid/grid_tools/Grid_InvertNoData.cpp,
-	  src/modules/grid/grid_tools/Grid_InvertNoData.h,
-	  src/modules/grid/grid_tools/Grid_Mask.cpp,
-	  src/modules/grid/grid_tools/Grid_Mask.h,
-	  src/modules/grid/grid_tools/Grid_Merge.cpp,
-	  src/modules/grid/grid_tools/Grid_Merge.h,
-	  src/modules/grid/grid_tools/Grid_Orientation.cpp,
-	  src/modules/grid/grid_tools/Grid_Orientation.h,
-	  src/modules/grid/grid_tools/Grid_Proximity.cpp,
-	  src/modules/grid/grid_tools/Grid_Proximity.h,
-	  src/modules/grid/grid_tools/Grid_Resample.cpp,
-	  src/modules/grid/grid_tools/Grid_Resample.h,
-	  src/modules/grid/grid_tools/Grid_SortRaster.cpp,
-	  src/modules/grid/grid_tools/Grid_SortRaster.h,
-	  src/modules/grid/grid_tools/Grid_ThresholdBuffer.cpp,
-	  src/modules/grid/grid_tools/Grid_ThresholdBuffer.h,
-	  src/modules/grid/grid_tools/Grid_Tiling.cpp,
-	  src/modules/grid/grid_tools/Grid_Tiling.h,
-	  src/modules/grid/grid_tools/Grid_Value_Reclassify.cpp,
-	  src/modules/grid/grid_tools/Grid_Value_Reclassify.h,
-	  src/modules/grid/grid_tools/Grid_Value_Replace.cpp,
-	  src/modules/grid/grid_tools/Grid_Value_Replace.h,
-	  src/modules/grid/grid_tools/Grid_Value_Replace_Interactive.cpp,
-	  src/modules/grid/grid_tools/Grid_Value_Replace_Interactive.h,
-	  src/modules/grid/grid_tools/Grid_Value_Request.cpp,
-	  src/modules/grid/grid_tools/Grid_Value_Request.h,
-	  src/modules/grid/grid_tools/Grid_Value_Type.cpp,
-	  src/modules/grid/grid_tools/Grid_Value_Type.h,
-	  src/modules/grid/grid_tools/GridsFromTableAndGrid.cpp,
-	  src/modules/grid/grid_tools/GridsFromTableAndGrid.h,
-	  src/modules/grid/grid_tools/MLB_Interface.cpp,
-	  src/modules/grid/grid_tools/MLB_Interface.h,
-	  src/modules/grid/grid_tools/Makefile.am,
-	  src/modules/grid/grid_tools/Pt.h,
-	  src/modules/grid/grid_tools/grid_tools.dsp,
-	  src/modules/grid/grid_tools/grid_tools.vcproj,
-	  src/modules/grid/grid_tools/grid_tools.vcxproj,
-	  src/modules/grid/grid_tools/grid_tools.vcxproj.filters,
-	  src/modules/grid/grid_visualisation/Grid_3D_Image.cpp,
-	  src/modules/grid/grid_visualisation/Grid_3D_Image.h,
-	  src/modules/grid/grid_visualisation/Grid_Color_Blend.cpp,
-	  src/modules/grid/grid_visualisation/Grid_Color_Blend.h,
-	  src/modules/grid/grid_visualisation/Grid_Color_Rotate.cpp,
-	  src/modules/grid/grid_visualisation/Grid_Color_Rotate.h,
-	  src/modules/grid/grid_visualisation/Grid_Color_Triangle.cpp,
-	  src/modules/grid/grid_visualisation/Grid_Color_Triangle.h,
-	  src/modules/grid/grid_visualisation/Grid_Colors_Fit.cpp,
-	  src/modules/grid/grid_visualisation/Grid_Colors_Fit.h,
-	  src/modules/grid/grid_visualisation/Grid_Histogram_Surface.cpp,
-	  src/modules/grid/grid_visualisation/Grid_Histogram_Surface.h,
-	  src/modules/grid/grid_visualisation/Grid_RGB_Composite.cpp,
-	  src/modules/grid/grid_visualisation/Grid_RGB_Composite.h,
-	  src/modules/grid/grid_visualisation/MLB_Interface.cpp,
-	  src/modules/grid/grid_visualisation/MLB_Interface.h,
-	  src/modules/grid/grid_visualisation/Makefile.am,
-	  src/modules/grid/grid_visualisation/grid_visualisation.dsp,
-	  src/modules/grid/grid_visualisation/grid_visualisation.vcproj,
-	  src/modules/grid/grid_visualisation/grid_visualisation.vcxproj,
-	  src/modules/grid/grid_visualisation/grid_visualisation.vcxproj.filters,
-	  src/modules/pointcloud/Makefile.am,
-	  src/modules/pointcloud/pointcloud_tools/MLB_Interface.cpp,
-	  src/modules/pointcloud/pointcloud_tools/MLB_Interface.h,
-	  src/modules/pointcloud/pointcloud_tools/Makefile.am,
-	  src/modules/pointcloud/pointcloud_tools/pc_attribute_calculator.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_attribute_calculator.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_cluster_analysis.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_cluster_analysis.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_cut.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_cut.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_drop_attribute.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_drop_attribute.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_from_grid.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_from_grid.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_from_shapes.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_from_shapes.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_reclass_extract.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_reclass_extract.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_thinning_simple.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_thinning_simple.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_to_grid.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_to_grid.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_to_shapes.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_to_shapes.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_transform.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_transform.h,
-	  src/modules/pointcloud/pointcloud_tools/pointcloud_tools.dsp,
-	  src/modules/pointcloud/pointcloud_tools/pointcloud_tools.vcproj,
-	  src/modules/pointcloud/pointcloud_tools/pointcloud_tools.vcxproj,
-	  src/modules/pointcloud/pointcloud_tools/pointcloud_tools.vcxproj.filters,
-	  src/modules/pointcloud/pointcloud_viewer/MLB_Interface.cpp,
-	  src/modules/pointcloud/pointcloud_viewer/MLB_Interface.h,
-	  src/modules/pointcloud/pointcloud_viewer/Makefile.am,
-	  src/modules/pointcloud/pointcloud_viewer/pointcloud_viewer.dsp,
-	  src/modules/pointcloud/pointcloud_viewer/pointcloud_viewer.vcproj,
-	  src/modules/pointcloud/pointcloud_viewer/pointcloud_viewer.vcxproj,
-	  src/modules/pointcloud/pointcloud_viewer/pointcloud_viewer.vcxproj.filters,
-	  src/modules/pointcloud/pointcloud_viewer/points_view_control.cpp,
-	  src/modules/pointcloud/pointcloud_viewer/points_view_control.h,
-	  src/modules/pointcloud/pointcloud_viewer/points_view_dialog.cpp,
-	  src/modules/pointcloud/pointcloud_viewer/points_view_dialog.h,
-	  src/modules/pointcloud/pointcloud_viewer/points_view_extent.cpp,
-	  src/modules/pointcloud/pointcloud_viewer/points_view_extent.h,
-	  src/modules/pointcloud/pointcloud_viewer/points_view_module.cpp,
-	  src/modules/pointcloud/pointcloud_viewer/points_view_module.h,
-	  src/modules/shapes/Makefile.am,
-	  src/modules/shapes/shapes_grid/Grid_Classes_To_Shapes.cpp,
-	  src/modules/shapes/shapes_grid/Grid_Classes_To_Shapes.h,
-	  src/modules/shapes/shapes_grid/Grid_Polygon_Clip.cpp,
-	  src/modules/shapes/shapes_grid/Grid_Polygon_Clip.h,
-	  src/modules/shapes/shapes_grid/Grid_Statistics_AddTo_Polygon.cpp,
-	  src/modules/shapes/shapes_grid/Grid_Statistics_AddTo_Polygon.h,
-	  src/modules/shapes/shapes_grid/Grid_To_Contour.cpp,
-	  src/modules/shapes/shapes_grid/Grid_To_Contour.h,
-	  src/modules/shapes/shapes_grid/Grid_To_Gradient.cpp,
-	  src/modules/shapes/shapes_grid/Grid_To_Gradient.h,
-	  src/modules/shapes/shapes_grid/Grid_To_Points.cpp,
-	  src/modules/shapes/shapes_grid/Grid_To_Points.h,
-	  src/modules/shapes/shapes_grid/Grid_To_Points_Random.cpp,
-	  src/modules/shapes/shapes_grid/Grid_To_Points_Random.h,
-	  src/modules/shapes/shapes_grid/Grid_Values_AddTo_Points.cpp,
-	  src/modules/shapes/shapes_grid/Grid_Values_AddTo_Points.h,
-	  src/modules/shapes/shapes_grid/Grid_Values_AddTo_Shapes.cpp,
-	  src/modules/shapes/shapes_grid/Grid_Values_AddTo_Shapes.h,
-	  src/modules/shapes/shapes_grid/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_grid/MLB_Interface.h,
-	  src/modules/shapes/shapes_grid/Makefile.am,
-	  src/modules/shapes/shapes_grid/grid_local_extremes_to_points.cpp,
-	  src/modules/shapes/shapes_grid/grid_local_extremes_to_points.h,
-	  src/modules/shapes/shapes_grid/shapes_grid.dsp,
-	  src/modules/shapes/shapes_grid/shapes_grid.vcproj,
-	  src/modules/shapes/shapes_grid/shapes_grid.vcxproj,
-	  src/modules/shapes/shapes_grid/shapes_grid.vcxproj.filters,
-	  src/modules/shapes/shapes_lines/Lines_From_Points.cpp,
-	  src/modules/shapes/shapes_lines/Lines_From_Points.h,
-	  src/modules/shapes/shapes_lines/Lines_From_Polygons.cpp,
-	  src/modules/shapes/shapes_lines/Lines_From_Polygons.h,
-	  src/modules/shapes/shapes_lines/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_lines/MLB_Interface.h,
-	  src/modules/shapes/shapes_lines/Makefile.am,
-	  src/modules/shapes/shapes_lines/line_dissolve.cpp,
-	  src/modules/shapes/shapes_lines/line_dissolve.h,
-	  src/modules/shapes/shapes_lines/line_polygon_intersection.cpp,
-	  src/modules/shapes/shapes_lines/line_polygon_intersection.h,
-	  src/modules/shapes/shapes_lines/line_properties.cpp,
-	  src/modules/shapes/shapes_lines/line_properties.h,
-	  src/modules/shapes/shapes_lines/line_simplification.cpp,
-	  src/modules/shapes/shapes_lines/line_simplification.h,
-	  src/modules/shapes/shapes_lines/shapes_lines.dsp,
-	  src/modules/shapes/shapes_lines/shapes_lines.vcproj,
-	  src/modules/shapes/shapes_lines/shapes_lines.vcxproj,
-	  src/modules/shapes/shapes_lines/shapes_lines.vcxproj.filters,
-	  src/modules/shapes/shapes_lines_ex/Containers.h,
-	  src/modules/shapes/shapes_lines_ex/DPHull.h,
-	  src/modules/shapes/shapes_lines_ex/LineApproximator.h,
-	  src/modules/shapes/shapes_lines_ex/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_lines_ex/MLB_Interface.h,
-	  src/modules/shapes/shapes_lines_ex/Makefile.am,
-	  src/modules/shapes/shapes_lines_ex/PathHull.h,
-	  src/modules/shapes/shapes_lines_ex/SimplifyShapes.cpp,
-	  src/modules/shapes/shapes_lines_ex/SimplifyShapes.h,
-	  src/modules/shapes/shapes_lines_ex/shapes_lines_ex.dsp,
-	  src/modules/shapes/shapes_points/AddCoordinates.cpp,
-	  src/modules/shapes/shapes_points/AddCoordinates.h,
-	  src/modules/shapes/shapes_points/Clip_Points.cpp,
-	  src/modules/shapes/shapes_points/Clip_Points.h,
-	  src/modules/shapes/shapes_points/CountPoints.cpp,
-	  src/modules/shapes/shapes_points/CountPoints.h,
-	  src/modules/shapes/shapes_points/CreatePointGrid.cpp,
-	  src/modules/shapes/shapes_points/CreatePointGrid.h,
-	  src/modules/shapes/shapes_points/DistanceMatrix.cpp,
-	  src/modules/shapes/shapes_points/DistanceMatrix.h,
-	  src/modules/shapes/shapes_points/FitNPointsToShape.cpp,
-	  src/modules/shapes/shapes_points/FitNPointsToShape.h,
-	  src/modules/shapes/shapes_points/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_points/MLB_Interface.h,
-	  src/modules/shapes/shapes_points/Makefile.am,
-	  src/modules/shapes/shapes_points/Points_From_Lines.cpp,
-	  src/modules/shapes/shapes_points/Points_From_Lines.h,
-	  src/modules/shapes/shapes_points/Points_From_Table.cpp,
-	  src/modules/shapes/shapes_points/Points_From_Table.h,
-	  src/modules/shapes/shapes_points/add_polygon_attributes.cpp,
-	  src/modules/shapes/shapes_points/add_polygon_attributes.h,
-	  src/modules/shapes/shapes_points/remove_duplicates.cpp,
-	  src/modules/shapes/shapes_points/remove_duplicates.h,
-	  src/modules/shapes/shapes_points/separate_by_direction.cpp,
-	  src/modules/shapes/shapes_points/separate_by_direction.h,
-	  src/modules/shapes/shapes_points/shapes_points.dsp,
-	  src/modules/shapes/shapes_points/shapes_points.vcproj,
-	  src/modules/shapes/shapes_points/shapes_points.vcxproj,
-	  src/modules/shapes/shapes_points/shapes_points.vcxproj.filters,
-	  src/modules/shapes/shapes_polygons/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_polygons/MLB_Interface.h,
-	  src/modules/shapes/shapes_polygons/Makefile.am,
-	  src/modules/shapes/shapes_polygons/Polygon_Centroids.cpp,
-	  src/modules/shapes/shapes_polygons/Polygon_Centroids.h,
-	  src/modules/shapes/shapes_polygons/Polygon_Clipper.cpp,
-	  src/modules/shapes/shapes_polygons/Polygon_Clipper.h,
-	  src/modules/shapes/shapes_polygons/Polygon_Geometrics.cpp,
-	  src/modules/shapes/shapes_polygons/Polygon_Geometrics.h,
-	  src/modules/shapes/shapes_polygons/Polygon_Intersection.cpp,
-	  src/modules/shapes/shapes_polygons/Polygon_Intersection.h,
-	  src/modules/shapes/shapes_polygons/Polygon_StatisticsFromPoints.cpp,
-	  src/modules/shapes/shapes_polygons/Polygon_StatisticsFromPoints.h,
-	  src/modules/shapes/shapes_polygons/Polygon_Union.cpp,
-	  src/modules/shapes/shapes_polygons/Polygon_Union.h,
-	  src/modules/shapes/shapes_polygons/Polygons_From_Lines.cpp,
-	  src/modules/shapes/shapes_polygons/Polygons_From_Lines.h,
-	  src/modules/shapes/shapes_polygons/polygon_to_points.cpp,
-	  src/modules/shapes/shapes_polygons/polygon_to_points.h,
-	  src/modules/shapes/shapes_polygons/shape_index.cpp,
-	  src/modules/shapes/shapes_polygons/shape_index.h,
-	  src/modules/shapes/shapes_polygons/shapes_polygons.dsp,
-	  src/modules/shapes/shapes_polygons/shapes_polygons.vcproj,
-	  src/modules/shapes/shapes_polygons/shapes_polygons.vcxproj,
-	  src/modules/shapes/shapes_polygons/shapes_polygons.vcxproj.filters,
-	  src/modules/shapes/shapes_tools/CreateChartLayer.cpp,
-	  src/modules/shapes/shapes_tools/CreateChartLayer.h,
-	  src/modules/shapes/shapes_tools/GraticuleBuilder.cpp,
-	  src/modules/shapes/shapes_tools/GraticuleBuilder.h,
-	  src/modules/shapes/shapes_tools/JoinTables.cpp,
-	  src/modules/shapes/shapes_tools/JoinTables.h,
-	  src/modules/shapes/shapes_tools/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_tools/MLB_Interface.h,
-	  src/modules/shapes/shapes_tools/Makefile.am,
-	  src/modules/shapes/shapes_tools/NewLayerFromSelectedShapes.cpp,
-	  src/modules/shapes/shapes_tools/NewLayerFromSelectedShapes.h,
-	  src/modules/shapes/shapes_tools/Polygon_Clipper.cpp,
-	  src/modules/shapes/shapes_tools/Polygon_Clipper.h,
-	  src/modules/shapes/shapes_tools/QueryBuilder.cpp,
-	  src/modules/shapes/shapes_tools/QueryBuilder.h,
-	  src/modules/shapes/shapes_tools/QueryParser.cpp,
-	  src/modules/shapes/shapes_tools/QueryParser.h,
-	  src/modules/shapes/shapes_tools/SearchInTable.cpp,
-	  src/modules/shapes/shapes_tools/SearchInTable.h,
-	  src/modules/shapes/shapes_tools/SelectByTheme.cpp,
-	  src/modules/shapes/shapes_tools/SelectByTheme.h,
-	  src/modules/shapes/shapes_tools/SeparateShapes.cpp,
-	  src/modules/shapes/shapes_tools/SeparateShapes.h,
-	  src/modules/shapes/shapes_tools/Shapes_Assign_Table.cpp,
-	  src/modules/shapes/shapes_tools/Shapes_Assign_Table.h,
-	  src/modules/shapes/shapes_tools/Shapes_Create_Empty.cpp,
-	  src/modules/shapes/shapes_tools/Shapes_Create_Empty.h,
-	  src/modules/shapes/shapes_tools/Shapes_Merge.cpp,
-	  src/modules/shapes/shapes_tools/Shapes_Merge.h,
-	  src/modules/shapes/shapes_tools/TransformShapes.cpp,
-	  src/modules/shapes/shapes_tools/TransformShapes.h,
-	  src/modules/shapes/shapes_tools/quadtree_structure.cpp,
-	  src/modules/shapes/shapes_tools/quadtree_structure.h,
-	  src/modules/shapes/shapes_tools/shapes_buffer.cpp,
-	  src/modules/shapes/shapes_tools/shapes_buffer.h,
-	  src/modules/shapes/shapes_tools/shapes_cut.cpp,
-	  src/modules/shapes/shapes_tools/shapes_cut.h,
-	  src/modules/shapes/shapes_tools/shapes_cut_interactive.cpp,
-	  src/modules/shapes/shapes_tools/shapes_cut_interactive.h,
-	  src/modules/shapes/shapes_tools/shapes_extents.cpp,
-	  src/modules/shapes/shapes_tools/shapes_extents.h,
-	  src/modules/shapes/shapes_tools/shapes_split.cpp,
-	  src/modules/shapes/shapes_tools/shapes_split.h,
-	  src/modules/shapes/shapes_tools/shapes_split_by_attribute.cpp,
-	  src/modules/shapes/shapes_tools/shapes_split_by_attribute.h,
-	  src/modules/shapes/shapes_tools/shapes_split_randomly.cpp,
-	  src/modules/shapes/shapes_tools/shapes_split_randomly.h,
-	  src/modules/shapes/shapes_tools/shapes_tools.dsp,
-	  src/modules/shapes/shapes_tools/shapes_tools.vcproj,
-	  src/modules/shapes/shapes_tools/shapes_tools.vcxproj,
-	  src/modules/shapes/shapes_tools/shapes_tools.vcxproj.filters,
-	  src/modules/shapes/shapes_transect/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_transect/MLB_Interface.h,
-	  src/modules/shapes/shapes_transect/Makefile.am,
-	  src/modules/shapes/shapes_transect/Polygon_Transect.cpp,
-	  src/modules/shapes/shapes_transect/Polygon_Transect.h,
-	  src/modules/shapes/shapes_transect/shapes_transect.dsp,
-	  src/modules/shapes/shapes_transect/shapes_transect.vcproj,
-	  src/modules/shapes/shapes_transect/shapes_transect.vcxproj,
-	  src/modules/shapes/shapes_transect/shapes_transect.vcxproj.filters,
-	  src/modules/table/Makefile.am,
-	  src/modules/table/table_calculus/Fit.cpp,
-	  src/modules/table/table_calculus/Fit.h,
-	  src/modules/table/table_calculus/LMFit.cpp,
-	  src/modules/table/table_calculus/LMFit.h,
-	  src/modules/table/table_calculus/MLB_Interface.cpp,
-	  src/modules/table/table_calculus/MLB_Interface.h,
-	  src/modules/table/table_calculus/Makefile.am,
-	  src/modules/table/table_calculus/Table_Calculator.cpp,
-	  src/modules/table/table_calculus/Table_Calculator.h,
-	  src/modules/table/table_calculus/Table_CalculatorShapes.cpp,
-	  src/modules/table/table_calculus/Table_CalculatorShapes.h,
-	  src/modules/table/table_calculus/Table_Trend.cpp,
-	  src/modules/table/table_calculus/Table_Trend.h,
-	  src/modules/table/table_calculus/table_calculus.dsp,
-	  src/modules/table/table_calculus/table_calculus.vcproj,
-	  src/modules/table/table_calculus/table_calculus.vcxproj,
-	  src/modules/table/table_calculus/table_calculus.vcxproj.filters,
-	  src/modules/table/table_calculus/table_cluster_analysis.cpp,
-	  src/modules/table/table_calculus/table_cluster_analysis.h,
-	  src/modules/table/table_calculus/table_pca.cpp,
-	  src/modules/table/table_calculus/table_pca.h,
-	  src/modules/table/table_calculus/table_running_average.cpp,
-	  src/modules/table/table_calculus/table_running_average.h,
-	  src/modules/table/table_tools/MLB_Interface.cpp,
-	  src/modules/table/table_tools/MLB_Interface.h,
-	  src/modules/table/table_tools/Makefile.am,
-	  src/modules/table/table_tools/Table_Create_Empty.cpp,
-	  src/modules/table/table_tools/Table_Create_Empty.h,
-	  src/modules/table/table_tools/Table_Enumerate.cpp,
-	  src/modules/table/table_tools/Table_Enumerate.h,
-	  src/modules/table/table_tools/Table_Rotate.cpp,
-	  src/modules/table/table_tools/Table_Rotate.h,
-	  src/modules/table/table_tools/table_tools.dsp,
-	  src/modules/table/table_tools/table_tools.vcproj,
-	  src/modules/table/table_tools/table_tools.vcxproj,
-	  src/modules/table/table_tools/table_tools.vcxproj.filters,
-	  src/modules/tin/Makefile.am,
-	  src/modules/tin/tin_tools/MLB_Interface.cpp,
-	  src/modules/tin/tin_tools/MLB_Interface.h,
-	  src/modules/tin/tin_tools/Makefile.am,
-	  src/modules/tin/tin_tools/TIN_Flow_Parallel.cpp,
-	  src/modules/tin/tin_tools/TIN_Flow_Parallel.h,
-	  src/modules/tin/tin_tools/TIN_Flow_Trace.cpp,
-	  src/modules/tin/tin_tools/TIN_Flow_Trace.h,
-	  src/modules/tin/tin_tools/TIN_From_Grid.cpp,
-	  src/modules/tin/tin_tools/TIN_From_Grid.h,
-	  src/modules/tin/tin_tools/TIN_From_Grid_Specific_Points.cpp,
-	  src/modules/tin/tin_tools/TIN_From_Grid_Specific_Points.h,
-	  src/modules/tin/tin_tools/TIN_From_Shapes.cpp,
-	  src/modules/tin/tin_tools/TIN_From_Shapes.h,
-	  src/modules/tin/tin_tools/TIN_Gradient.cpp,
-	  src/modules/tin/tin_tools/TIN_Gradient.h,
-	  src/modules/tin/tin_tools/TIN_To_Shapes.cpp,
-	  src/modules/tin/tin_tools/TIN_To_Shapes.h,
-	  src/modules/tin/tin_tools/tin_tools.dsp,
-	  src/modules/tin/tin_tools/tin_tools.vcproj,
-	  src/modules/tin/tin_tools/tin_tools.vcxproj,
-	  src/modules/tin/tin_tools/tin_tools.vcxproj.filters,
-	  src/modules_contrib/Makefile.am,
-	  src/modules_contrib/contrib_a_perego/Makefile.am,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/A1WiTh.cpp,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/A1WiTh.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/A2WiTh.cpp,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/A2WiTh.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/A3WiTh.cpp,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/A3WiTh.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/AvWiMa1.cpp,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/AvWiMa1.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/AvWiMa2.cpp,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/AvWiMa2.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/MLB_Interface.cpp,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/MLB_Interface.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/Makefile.am,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/contrib_a_perego.dsp,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/contrib_a_perego.vcproj,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/contrib_a_perego.vcxproj,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/contrib_a_perego.vcxproj.filters,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/destriping1.cpp,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/destriping1.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/destriping2.cpp,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/destriping2.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/directional1.cpp,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/directional1.h,
-	  src/modules_contrib/contrib_s_liersch/Makefile.am,
-	  src/modules_contrib/contrib_s_liersch/ihacres/MLB_Interface.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/MLB_Interface.h,
-	  src/modules_contrib/contrib_s_liersch/ihacres/Makefile.am,
-	  src/modules_contrib/contrib_s_liersch/ihacres/convert_sl.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/convert_sl.h,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres.dsp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres.vcproj,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres.vcxproj,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres.vcxproj.filters,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_basin.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_basin.h,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_cal2.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_cal2.h,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_elev.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_elev.h,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_elev_bands.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_elev_bands.h,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_elev_cal.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_elev_cal.h,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_eq.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_eq.h,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_v1.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_v1.h,
-	  src/modules_contrib/contrib_s_liersch/ihacres/model_tools.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/model_tools.h,
-	  src/modules_contrib/contrib_s_liersch/ihacres/snow_module.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/snow_module.h,
-	  src/modules_contrib/contrib_t_wutzler/Makefile.am,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/CompleteLinkage.cpp,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/CompleteLinkage.h,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/DebugStream.cpp,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/DebugStream.h,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/GridCalcError.cpp,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/GridCalcError.h,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/MLB_Interface.cpp,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/MLB_Interface.h,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/Makefile.am,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/NoDataValueError.cpp,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/NoDataValueError.h,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/Profiler.cpp,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/Profiler.h,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/contrib_t_wutzler.dsp,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/rgbOverlay.cpp,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/rgbOverlay.h,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/tomaschTool.cpp,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/tomaschTool.h,
-	  src/modules_geostatistics/Makefile.am,
-	  src/modules_geostatistics/geostatistics/Makefile.am,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Directional_Statistics.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Directional_Statistics.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Residuals.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Residuals.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Statistics.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Statistics.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Variance.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Variance.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Variance_Radius.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Variance_Radius.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Zonal_Statistics.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Zonal_Statistics.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/MLB_Interface.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/MLB_Interface.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/Makefile.am,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/fast_representativeness.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/fast_representativeness.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/geostatistics_grid.dsp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/geostatistics_grid.vcproj,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/geostatistics_grid.vcxproj,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/geostatistics_grid.vcxproj.filters,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/grid_autocorrelation.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/grid_autocorrelation.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/grid_pca.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/grid_pca.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/multiband_variation.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/multiband_variation.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/MLB_Interface.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/MLB_Interface.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/Makefile.am,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/_kriging_base.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/_kriging_base.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/_kriging_ordinary.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/_kriging_ordinary.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/_kriging_ordinary_global.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/_kriging_ordinary_global.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/_kriging_universal.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/_kriging_universal.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/_kriging_universal_global.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/_kriging_universal_global.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/geostatistics_kriging.dsp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/geostatistics_kriging.vcproj,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/geostatistics_kriging.vcxproj,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/geostatistics_kriging.vcxproj.filters,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_base.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_base.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_ordinary.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_ordinary.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_ordinary_global.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_ordinary_global.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_universal.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_universal.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_universal_global.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_universal_global.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/semivariogram.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/semivariogram.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/variogram_dialog.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/variogram_dialog.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/GSPoints_Distances.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/GSPoints_Distances.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/GSPoints_Pattern_Analysis.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/GSPoints_Pattern_Analysis.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/GSPoints_Semi_Variances.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/GSPoints_Semi_Variances.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/GSPoints_Variogram_Cloud.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/GSPoints_Variogram_Cloud.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/GSPoints_Variogram_Surface.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/GSPoints_Variogram_Surface.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/MLB_Interface.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/MLB_Interface.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/Makefile.am,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/geostatistics_points.dsp,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/geostatistics_points.vcproj,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/geostatistics_points.vcxproj,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/geostatistics_points.vcxproj.filters,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/MLB_Interface.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/MLB_Interface.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/Makefile.am,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/geostatistics_regression.dsp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/geostatistics_regression.vcproj,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/geostatistics_regression.vcxproj,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/geostatistics_regression.vcxproj.filters,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/gw_multi_regression.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/gw_multi_regression.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/gw_multi_regression_grid.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/gw_multi_regression_grid.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/gw_regression.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/gw_regression.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/gw_regression_grid.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/gw_regression_grid.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/point_grid_regression.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/point_grid_regression.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/point_multi_grid_regression.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/point_multi_grid_regression.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/point_trend_surface.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/point_trend_surface.h,
-	  src/modules_images/Makefile.am,
-	  src/modules_images/modules_imagery/Makefile.am,
-	  src/modules_images/modules_imagery/imagery_classification/MLB_Interface.cpp,
-	  src/modules_images/modules_imagery/imagery_classification/MLB_Interface.h,
-	  src/modules_images/modules_imagery/imagery_classification/Makefile.am,
-	  src/modules_images/modules_imagery/imagery_classification/change_detection.cpp,
-	  src/modules_images/modules_imagery/imagery_classification/change_detection.h,
-	  src/modules_images/modules_imagery/imagery_classification/classify_cluster_analysis.cpp,
-	  src/modules_images/modules_imagery/imagery_classification/classify_cluster_analysis.h,
-	  src/modules_images/modules_imagery/imagery_classification/classify_supervised.cpp,
-	  src/modules_images/modules_imagery/imagery_classification/classify_supervised.h,
-	  src/modules_images/modules_imagery/imagery_classification/imagery_classification.dsp,
-	  src/modules_images/modules_imagery/imagery_classification/imagery_classification.vcproj,
-	  src/modules_images/modules_imagery/imagery_classification/imagery_classification.vcxproj,
-	  src/modules_images/modules_imagery/imagery_classification/imagery_classification.vcxproj.filters,
-	  src/modules_images/modules_imagery/imagery_rga/MLB_Interface.cpp,
-	  src/modules_images/modules_imagery/imagery_rga/MLB_Interface.h,
-	  src/modules_images/modules_imagery/imagery_rga/Makefile.am,
-	  src/modules_images/modules_imagery/imagery_rga/fast_region_growing.cpp,
-	  src/modules_images/modules_imagery/imagery_rga/fast_region_growing.h,
-	  src/modules_images/modules_imagery/imagery_rga/imagery_rga.dsp,
-	  src/modules_images/modules_imagery/imagery_rga/imagery_rga.vcproj,
-	  src/modules_images/modules_imagery/imagery_rga/imagery_rga.vcxproj,
-	  src/modules_images/modules_imagery/imagery_rga/imagery_rga.vcxproj.filters,
-	  src/modules_images/modules_imagery/imagery_segmentation/MLB_Interface.cpp,
-	  src/modules_images/modules_imagery/imagery_segmentation/MLB_Interface.h,
-	  src/modules_images/modules_imagery/imagery_segmentation/Makefile.am,
-	  src/modules_images/modules_imagery/imagery_segmentation/grid_seeds.cpp,
-	  src/modules_images/modules_imagery/imagery_segmentation/grid_seeds.h,
-	  src/modules_images/modules_imagery/imagery_segmentation/imagery_segmentation.dsp,
-	  src/modules_images/modules_imagery/imagery_segmentation/imagery_segmentation.vcproj,
-	  src/modules_images/modules_imagery/imagery_segmentation/imagery_segmentation.vcxproj,
-	  src/modules_images/modules_imagery/imagery_segmentation/imagery_segmentation.vcxproj.filters,
-	  src/modules_images/modules_imagery/imagery_segmentation/rga_basic.cpp,
-	  src/modules_images/modules_imagery/imagery_segmentation/rga_basic.h,
-	  src/modules_images/modules_imagery/imagery_segmentation/skeletonization.cpp,
-	  src/modules_images/modules_imagery/imagery_segmentation/skeletonization.h,
-	  src/modules_images/modules_imagery/imagery_segmentation/watershed_segmentation.cpp,
-	  src/modules_images/modules_imagery/imagery_segmentation/watershed_segmentation.h,
-	  src/modules_images/modules_imagery/imagery_tools/Image_VI_Distance.cpp,
-	  src/modules_images/modules_imagery/imagery_tools/Image_VI_Distance.h,
-	  src/modules_images/modules_imagery/imagery_tools/Image_VI_Slope.cpp,
-	  src/modules_images/modules_imagery/imagery_tools/Image_VI_Slope.h,
-	  src/modules_images/modules_imagery/imagery_tools/MLB_Interface.cpp,
-	  src/modules_images/modules_imagery/imagery_tools/MLB_Interface.h,
-	  src/modules_images/modules_imagery/imagery_tools/Makefile.am,
-	  src/modules_images/modules_imagery/imagery_tools/imagery_tools.dsp,
-	  src/modules_images/modules_imagery/imagery_tools/imagery_tools.vcproj,
-	  src/modules_images/modules_imagery/imagery_tools/imagery_tools.vcxproj,
-	  src/modules_images/modules_imagery/imagery_tools/imagery_tools.vcxproj.filters,
-	  src/modules_images/modules_opencv/Makefile.am,
-	  src/modules_images/modules_opencv/opencv/MLB_Interface.cpp,
-	  src/modules_images/modules_opencv/opencv/MLB_Interface.h,
-	  src/modules_images/modules_opencv/opencv/Makefile.am,
-	  src/modules_images/modules_opencv/opencv/opencv.cpp,
-	  src/modules_images/modules_opencv/opencv/opencv.dsp,
-	  src/modules_images/modules_opencv/opencv/opencv.h,
-	  src/modules_images/modules_opencv/opencv/opencv.vcproj,
-	  src/modules_images/modules_opencv/opencv/opencv.vcxproj,
-	  src/modules_images/modules_opencv/opencv/opencv.vcxproj.filters,
-	  src/modules_images/modules_opencv/opencv/opencv_fourier.cpp,
-	  src/modules_images/modules_opencv/opencv/opencv_fourier.h,
-	  src/modules_images/modules_opencv/opencv/opencv_morphology.cpp,
-	  src/modules_images/modules_opencv/opencv/opencv_morphology.h,
-	  src/modules_images/modules_opencv/opencv/opencv_svd.cpp,
-	  src/modules_images/modules_opencv/opencv/opencv_svd.h,
-	  src/modules_images/modules_vigra/Makefile.am,
-	  src/modules_images/modules_vigra/vigra/MLB_Interface.cpp,
-	  src/modules_images/modules_vigra/vigra/MLB_Interface.h,
-	  src/modules_images/modules_vigra/vigra/Makefile.am,
-	  src/modules_images/modules_vigra/vigra/vigra.cpp,
-	  src/modules_images/modules_vigra/vigra/vigra.dsp,
-	  src/modules_images/modules_vigra/vigra/vigra.h,
-	  src/modules_images/modules_vigra/vigra/vigra.sln,
-	  src/modules_images/modules_vigra/vigra/vigra.vcproj,
-	  src/modules_images/modules_vigra/vigra/vigra.vcxproj,
-	  src/modules_images/modules_vigra/vigra/vigra.vcxproj.filters,
-	  src/modules_images/modules_vigra/vigra/vigra_distance.cpp,
-	  src/modules_images/modules_vigra/vigra/vigra_distance.h,
-	  src/modules_images/modules_vigra/vigra/vigra_edges.cpp,
-	  src/modules_images/modules_vigra/vigra/vigra_edges.h,
-	  src/modules_images/modules_vigra/vigra/vigra_fft.cpp,
-	  src/modules_images/modules_vigra/vigra/vigra_fft.h,
-	  src/modules_images/modules_vigra/vigra/vigra_morphology.cpp,
-	  src/modules_images/modules_vigra/vigra/vigra_morphology.h,
-	  src/modules_images/modules_vigra/vigra/vigra_smoothing.cpp,
-	  src/modules_images/modules_vigra/vigra/vigra_smoothing.h,
-	  src/modules_images/modules_vigra/vigra/vigra_watershed.cpp,
-	  src/modules_images/modules_vigra/vigra/vigra_watershed.h,
-	  src/modules_io/Makefile.am, src/modules_io/db/Makefile.am,
-	  src/modules_io/db/io_db_mysql/Get_Table.cpp,
-	  src/modules_io/db/io_db_mysql/Get_Table.h,
-	  src/modules_io/db/io_db_mysql/MLB_Interface.cpp,
-	  src/modules_io/db/io_db_mysql/MLB_Interface.h,
-	  src/modules_io/db/io_db_mysql/Makefile.am,
-	  src/modules_io/db/io_db_mysql/io_db_mysql.dsp,
-	  src/modules_io/db/io_db_mysql/io_db_mysql.vcproj,
-	  src/modules_io/db/io_db_mysql/readme.txt,
-	  src/modules_io/db/io_odbc/MLB_Interface.cpp,
-	  src/modules_io/db/io_odbc/MLB_Interface.h,
-	  src/modules_io/db/io_odbc/Makefile.am,
-	  src/modules_io/db/io_odbc/get_connection.cpp,
-	  src/modules_io/db/io_odbc/get_connection.h,
-	  src/modules_io/db/io_odbc/io_odbc.dsp,
-	  src/modules_io/db/io_odbc/io_odbc.vcproj,
-	  src/modules_io/db/io_odbc/io_odbc.vcxproj,
-	  src/modules_io/db/io_odbc/io_odbc.vcxproj.filters,
-	  src/modules_io/db/io_odbc/pgis_shapes.cpp,
-	  src/modules_io/db/io_odbc/pgis_shapes.h,
-	  src/modules_io/db/io_odbc/shapes.cpp,
-	  src/modules_io/db/io_odbc/shapes.h,
-	  src/modules_io/db/io_odbc/table.cpp,
-	  src/modules_io/db/io_odbc/table.h,
-	  src/modules_io/docs/Makefile.am,
-	  src/modules_io/docs/docs_html/CreateWebContent.cpp,
-	  src/modules_io/docs/docs_html/CreateWebContent.h,
-	  src/modules_io/docs/docs_html/MLB_Interface.cpp,
-	  src/modules_io/docs/docs_html/MLB_Interface.h,
-	  src/modules_io/docs/docs_html/Makefile.am,
-	  src/modules_io/docs/docs_html/doc_html.cpp,
-	  src/modules_io/docs/docs_html/doc_html.h,
-	  src/modules_io/docs/docs_html/doc_svg.cpp,
-	  src/modules_io/docs/docs_html/doc_svg.h,
-	  src/modules_io/docs/docs_html/docs_html.dsp,
-	  src/modules_io/docs/docs_html/docs_html.vcproj,
-	  src/modules_io/docs/docs_html/docs_html.vcxproj,
-	  src/modules_io/docs/docs_html/docs_html.vcxproj.filters,
-	  src/modules_io/docs/docs_html/svg_interactive_map.cpp,
-	  src/modules_io/docs/docs_html/svg_interactive_map.h,
-	  src/modules_io/docs/docs_pdf/MLB_Interface.cpp,
-	  src/modules_io/docs/docs_pdf/MLB_Interface.h,
-	  src/modules_io/docs/docs_pdf/Makefile.am,
-	  src/modules_io/docs/docs_pdf/Polygon_Clipper.cpp,
-	  src/modules_io/docs/docs_pdf/Polygon_Clipper.h,
-	  src/modules_io/docs/docs_pdf/Profile_Cross_Sections.cpp,
-	  src/modules_io/docs/docs_pdf/Profile_Cross_Sections.h,
-	  src/modules_io/docs/docs_pdf/Shapes_Report.cpp,
-	  src/modules_io/docs/docs_pdf/Shapes_Report.h,
-	  src/modules_io/docs/docs_pdf/Shapes_Summary.cpp,
-	  src/modules_io/docs/docs_pdf/Shapes_Summary.h,
-	  src/modules_io/docs/docs_pdf/doc_pdf.cpp,
-	  src/modules_io/docs/docs_pdf/doc_pdf.h,
-	  src/modules_io/docs/docs_pdf/docs_pdf.dsp,
-	  src/modules_io/docs/docs_pdf/docs_pdf.vcproj,
-	  src/modules_io/docs/docs_pdf/docs_pdf.vcxproj,
-	  src/modules_io/docs/docs_pdf/docs_pdf.vcxproj.filters,
-	  src/modules_io/esri_e00/Makefile.am,
-	  src/modules_io/esri_e00/io_esri_e00/ESRI_E00_Import.cpp,
-	  src/modules_io/esri_e00/io_esri_e00/ESRI_E00_Import.h,
-	  src/modules_io/esri_e00/io_esri_e00/MLB_Interface.cpp,
-	  src/modules_io/esri_e00/io_esri_e00/MLB_Interface.h,
-	  src/modules_io/esri_e00/io_esri_e00/Makefile.am,
-	  src/modules_io/esri_e00/io_esri_e00/e00compr/cpl_conv.c,
-	  src/modules_io/esri_e00/io_esri_e00/e00compr/cpl_conv.h,
-	  src/modules_io/esri_e00/io_esri_e00/e00compr/cpl_error.c,
-	  src/modules_io/esri_e00/io_esri_e00/e00compr/cpl_error.h,
-	  src/modules_io/esri_e00/io_esri_e00/e00compr/cpl_port.h,
-	  src/modules_io/esri_e00/io_esri_e00/e00compr/cpl_vsi.h,
-	  src/modules_io/esri_e00/io_esri_e00/e00compr/cpl_vsisimple.c,
-	  src/modules_io/esri_e00/io_esri_e00/e00compr/e00compr.h,
-	  src/modules_io/esri_e00/io_esri_e00/e00compr/e00read.c,
-	  src/modules_io/esri_e00/io_esri_e00/e00compr/e00write.c,
-	  src/modules_io/esri_e00/io_esri_e00/io_esri_e00.dsp,
-	  src/modules_io/esri_e00/io_esri_e00/io_esri_e00.vcproj,
-	  src/modules_io/esri_e00/io_esri_e00/io_esri_e00.vcxproj,
-	  src/modules_io/esri_e00/io_esri_e00/io_esri_e00.vcxproj.filters,
-	  src/modules_io/gdal/Makefile.am,
-	  src/modules_io/gdal/io_gdal/MLB_Interface.cpp,
-	  src/modules_io/gdal/io_gdal/MLB_Interface.h,
-	  src/modules_io/gdal/io_gdal/Makefile.am,
-	  src/modules_io/gdal/io_gdal/gdal_driver.cpp,
-	  src/modules_io/gdal/io_gdal/gdal_driver.h,
-	  src/modules_io/gdal/io_gdal/gdal_export.cpp,
-	  src/modules_io/gdal/io_gdal/gdal_export.h,
-	  src/modules_io/gdal/io_gdal/gdal_export_geotiff.cpp,
-	  src/modules_io/gdal/io_gdal/gdal_export_geotiff.h,
-	  src/modules_io/gdal/io_gdal/gdal_import.cpp,
-	  src/modules_io/gdal/io_gdal/gdal_import.h,
-	  src/modules_io/gdal/io_gdal/io_gdal.dsp,
-	  src/modules_io/gdal/io_gdal/io_gdal.vcproj,
-	  src/modules_io/gdal/io_gdal/io_gdal.vcxproj,
-	  src/modules_io/gdal/io_gdal/io_gdal.vcxproj.filters,
-	  src/modules_io/gdal/io_gdal/ogr_driver.cpp,
-	  src/modules_io/gdal/io_gdal/ogr_driver.h,
-	  src/modules_io/gdal/io_gdal/ogr_export.cpp,
-	  src/modules_io/gdal/io_gdal/ogr_export.h,
-	  src/modules_io/gdal/io_gdal/ogr_import.cpp,
-	  src/modules_io/gdal/io_gdal/ogr_import.h,
-	  src/modules_io/gps/Makefile.am,
-	  src/modules_io/gps/io_gps/GPSBabel.cpp,
-	  src/modules_io/gps/io_gps/GPSBabel.h,
-	  src/modules_io/gps/io_gps/MLB_Interface.cpp,
-	  src/modules_io/gps/io_gps/MLB_Interface.h,
-	  src/modules_io/gps/io_gps/Makefile.am,
-	  src/modules_io/gps/io_gps/gpx2shp.cpp,
-	  src/modules_io/gps/io_gps/gpx2shp.h,
-	  src/modules_io/gps/io_gps/io_gps.dsp,
-	  src/modules_io/gps/io_gps/io_gps.vcproj,
-	  src/modules_io/gps/io_gps/io_gps.vcxproj,
-	  src/modules_io/gps/io_gps/io_gps.vcxproj.filters,
-	  src/modules_io/grid/Makefile.am,
-	  src/modules_io/grid/io_grid/MLB_Interface.cpp,
-	  src/modules_io/grid/io_grid/MLB_Interface.h,
-	  src/modules_io/grid/io_grid/Makefile.am,
-	  src/modules_io/grid/io_grid/bmp_export.cpp,
-	  src/modules_io/grid/io_grid/bmp_export.h,
-	  src/modules_io/grid/io_grid/erdas_lan.cpp,
-	  src/modules_io/grid/io_grid/erdas_lan.h,
-	  src/modules_io/grid/io_grid/esri_arcinfo.cpp,
-	  src/modules_io/grid/io_grid/esri_arcinfo.h,
-	  src/modules_io/grid/io_grid/grid_table.cpp,
-	  src/modules_io/grid/io_grid/grid_table.h,
-	  src/modules_io/grid/io_grid/io_grid.dsp,
-	  src/modules_io/grid/io_grid/io_grid.vcproj,
-	  src/modules_io/grid/io_grid/io_grid.vcxproj,
-	  src/modules_io/grid/io_grid/io_grid.vcxproj.filters,
-	  src/modules_io/grid/io_grid/mola.cpp,
-	  src/modules_io/grid/io_grid/mola.h,
-	  src/modules_io/grid/io_grid/raw.cpp,
-	  src/modules_io/grid/io_grid/raw.h,
-	  src/modules_io/grid/io_grid/srtm30.cpp,
-	  src/modules_io/grid/io_grid/srtm30.h,
-	  src/modules_io/grid/io_grid/surfer.cpp,
-	  src/modules_io/grid/io_grid/surfer.h,
-	  src/modules_io/grid/io_grid/usgs_srtm.cpp,
-	  src/modules_io/grid/io_grid/usgs_srtm.h,
-	  src/modules_io/grid/io_grid/xyz.cpp,
-	  src/modules_io/grid/io_grid/xyz.h,
-	  src/modules_io/grid/io_grid_grib2/MLB_Interface.cpp,
-	  src/modules_io/grid/io_grid_grib2/MLB_Interface.h,
-	  src/modules_io/grid/io_grid_grib2/Makefile.am,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/CHANGES,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/README,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/cmplxpack.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/compack.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/comunpack.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/dec_jpeg2000.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/dec_png.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/drstemplates.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/drstemplates.h,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/enc_jpeg2000.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/enc_png.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_addfield.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_addgrid.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_addlocal.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_create.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_free.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_getfld.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_gribend.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_info.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_miss.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_unpack1.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_unpack2.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_unpack3.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_unpack4.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_unpack5.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_unpack6.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_unpack7.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/gbits.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/getdim.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/getpoly.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/grib2.h,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/grib2c.doc,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/gridtemplates.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/gridtemplates.h,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/int_power.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/jpcpack.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/jpcunpack.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/makefile,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/misspack.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/mkieee.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/pack_gp.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/pdstemplates.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/pdstemplates.h,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/pngpack.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/pngunpack.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/rdieee.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/reduce.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/seekgb.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/simpack.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/simunpack.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/specpack.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/specunpack.c,
-	  src/modules_io/grid/io_grid_grib2/grib2_import.cpp,
-	  src/modules_io/grid/io_grid_grib2/grib2_import.h,
-	  src/modules_io/grid/io_grid_grib2/io_grid_grib2.dsp,
-	  src/modules_io/grid/io_grid_grib2/io_grid_grib2.dsw,
-	  src/modules_io/grid/io_grid_grib2/io_grid_grib2.vcproj,
-	  src/modules_io/grid/io_grid_grib2/io_grid_grib2.vcxproj,
-	  src/modules_io/grid/io_grid_grib2/io_grid_grib2.vcxproj.filters,
-	  src/modules_io/grid/io_grid_grib2/io_grid_grib2_x.dsp,
-	  src/modules_io/grid/io_grid_image/MLB_Interface.cpp,
-	  src/modules_io/grid/io_grid_image/MLB_Interface.h,
-	  src/modules_io/grid/io_grid_image/Makefile.am,
-	  src/modules_io/grid/io_grid_image/grid_export.cpp,
-	  src/modules_io/grid/io_grid_image/grid_export.h,
-	  src/modules_io/grid/io_grid_image/grid_import.cpp,
-	  src/modules_io/grid/io_grid_image/grid_import.h,
-	  src/modules_io/grid/io_grid_image/io_grid_image.dsp,
-	  src/modules_io/grid/io_grid_image/io_grid_image.vcproj,
-	  src/modules_io/grid/io_grid_image/io_grid_image.vcxproj,
-	  src/modules_io/grid/io_grid_image/io_grid_image.vcxproj.filters,
-	  src/modules_io/shapes/Makefile.am,
-	  src/modules_io/shapes/io_shapes/MLB_Interface.cpp,
-	  src/modules_io/shapes/io_shapes/MLB_Interface.h,
-	  src/modules_io/shapes/io_shapes/Makefile.am,
-	  src/modules_io/shapes/io_shapes/atlas_bna.cpp,
-	  src/modules_io/shapes/io_shapes/atlas_bna.h,
-	  src/modules_io/shapes/io_shapes/generate.cpp,
-	  src/modules_io/shapes/io_shapes/generate.h,
-	  src/modules_io/shapes/io_shapes/gpx.cpp,
-	  src/modules_io/shapes/io_shapes/gpx.h,
-	  src/modules_io/shapes/io_shapes/gstat.cpp,
-	  src/modules_io/shapes/io_shapes/gstat.h,
-	  src/modules_io/shapes/io_shapes/io_shapes.dsp,
-	  src/modules_io/shapes/io_shapes/io_shapes.vcproj,
-	  src/modules_io/shapes/io_shapes/io_shapes.vcxproj,
-	  src/modules_io/shapes/io_shapes/io_shapes.vcxproj.filters,
-	  src/modules_io/shapes/io_shapes/pointcloud_from_file.cpp,
-	  src/modules_io/shapes/io_shapes/pointcloud_from_file.h,
-	  src/modules_io/shapes/io_shapes/pointcloud_from_text_file.cpp,
-	  src/modules_io/shapes/io_shapes/pointcloud_from_text_file.h,
-	  src/modules_io/shapes/io_shapes/stl.cpp,
-	  src/modules_io/shapes/io_shapes/stl.h,
-	  src/modules_io/shapes/io_shapes/surfer_bln.cpp,
-	  src/modules_io/shapes/io_shapes/surfer_bln.h,
-	  src/modules_io/shapes/io_shapes/svg.cpp,
-	  src/modules_io/shapes/io_shapes/svg.h,
-	  src/modules_io/shapes/io_shapes/wasp_map.cpp,
-	  src/modules_io/shapes/io_shapes/wasp_map.h,
-	  src/modules_io/shapes/io_shapes/xyz.cpp,
-	  src/modules_io/shapes/io_shapes/xyz.h,
-	  src/modules_io/shapes/io_shapes_dxf/MLB_Interface.cpp,
-	  src/modules_io/shapes/io_shapes_dxf/MLB_Interface.h,
-	  src/modules_io/shapes/io_shapes_dxf/Makefile.am,
-	  src/modules_io/shapes/io_shapes_dxf/dxf_import.cpp,
-	  src/modules_io/shapes/io_shapes_dxf/dxf_import.h,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_attributes.h,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_codes.h,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_creationadapter.h,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_creationinterface.h,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_dxf.cpp,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_dxf.h,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_entities.h,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_exception.h,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_extrusion.h,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_writer.h,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_writer_ascii.cpp,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_writer_ascii.h,
-	  src/modules_io/shapes/io_shapes_dxf/io_shapes_dxf.dsp,
-	  src/modules_io/shapes/io_shapes_dxf/io_shapes_dxf.vcproj,
-	  src/modules_io/shapes/io_shapes_dxf/io_shapes_dxf.vcxproj,
-	  src/modules_io/shapes/io_shapes_dxf/io_shapes_dxf.vcxproj.filters,
-	  src/modules_io/shapes/io_shapes_las/MLB_Interface.cpp,
-	  src/modules_io/shapes/io_shapes_las/MLB_Interface.h,
-	  src/modules_io/shapes/io_shapes_las/Makefile.am,
-	  src/modules_io/shapes/io_shapes_las/io_shapes_las.dsp,
-	  src/modules_io/shapes/io_shapes_las/io_shapes_las.vcproj,
-	  src/modules_io/shapes/io_shapes_las/io_shapes_las.vcxproj,
-	  src/modules_io/shapes/io_shapes_las/io_shapes_las.vcxproj.filters,
-	  src/modules_io/shapes/io_shapes_las/las_export.cpp,
-	  src/modules_io/shapes/io_shapes_las/las_export.h,
-	  src/modules_io/shapes/io_shapes_las/las_import.cpp,
-	  src/modules_io/shapes/io_shapes_las/las_import.h,
-	  src/modules_io/shapes/io_shapes_las/las_info.cpp,
-	  src/modules_io/shapes/io_shapes_las/las_info.h,
-	  src/modules_io/table/Makefile.am,
-	  src/modules_io/table/io_table/MLB_Interface.cpp,
-	  src/modules_io/table/io_table/MLB_Interface.h,
-	  src/modules_io/table/io_table/Makefile.am,
-	  src/modules_io/table/io_table/io_table.dsp,
-	  src/modules_io/table/io_table/io_table.vcproj,
-	  src/modules_io/table/io_table/io_table.vcxproj,
-	  src/modules_io/table/io_table/io_table.vcxproj.filters,
-	  src/modules_io/table/io_table/io_table_txt.cpp,
-	  src/modules_io/table/io_table/io_table_txt.h,
-	  src/modules_lectures/Makefile.am,
-	  src/modules_lectures/lectures/Makefile.am,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_01.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_01.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_02.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_02.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_03.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_03.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_04.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_04.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_05.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_05.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_06.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_06.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_07.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_07.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_08.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_08.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_09.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_09.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_10.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_10.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_11.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_11.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_12.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_12.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_13.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_13.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_14.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_14.h,
-	  src/modules_lectures/lectures/lectures_introduction/MLB_Interface.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/MLB_Interface.h,
-	  src/modules_lectures/lectures/lectures_introduction/Makefile.am,
-	  src/modules_lectures/lectures/lectures_introduction/lectures_introduction.dsp,
-	  src/modules_lectures/lectures/lectures_introduction/lectures_introduction.vcproj,
-	  src/modules_lectures/lectures/lectures_introduction/lectures_introduction.vcxproj,
-	  src/modules_lectures/lectures/lectures_introduction/lectures_introduction.vcxproj.filters,
-	  src/modules_projection/Makefile.am,
-	  src/modules_projection/pj_georeference/Makefile.am,
-	  src/modules_projection/pj_georeference/pj_georeference/Collect_Points.cpp,
-	  src/modules_projection/pj_georeference/pj_georeference/Collect_Points.h,
-	  src/modules_projection/pj_georeference/pj_georeference/Georef_Engine.cpp,
-	  src/modules_projection/pj_georeference/pj_georeference/Georef_Engine.h,
-	  src/modules_projection/pj_georeference/pj_georeference/Georef_Grid.cpp,
-	  src/modules_projection/pj_georeference/pj_georeference/Georef_Grid.h,
-	  src/modules_projection/pj_georeference/pj_georeference/Georef_Shapes.cpp,
-	  src/modules_projection/pj_georeference/pj_georeference/Georef_Shapes.h,
-	  src/modules_projection/pj_georeference/pj_georeference/MLB_Interface.cpp,
-	  src/modules_projection/pj_georeference/pj_georeference/MLB_Interface.h,
-	  src/modules_projection/pj_georeference/pj_georeference/Makefile.am,
-	  src/modules_projection/pj_georeference/pj_georeference/cminpak.h,
-	  src/modules_projection/pj_georeference/pj_georeference/dpmpar.h,
-	  src/modules_projection/pj_georeference/pj_georeference/enorm.c,
-	  src/modules_projection/pj_georeference/pj_georeference/fdjac2.c,
-	  src/modules_projection/pj_georeference/pj_georeference/georef_grid_move.cpp,
-	  src/modules_projection/pj_georeference/pj_georeference/georef_grid_move.h,
-	  src/modules_projection/pj_georeference/pj_georeference/lmdif.c,
-	  src/modules_projection/pj_georeference/pj_georeference/lmdif0.c,
-	  src/modules_projection/pj_georeference/pj_georeference/lmpar.c,
-	  src/modules_projection/pj_georeference/pj_georeference/pj_georeference.dsp,
-	  src/modules_projection/pj_georeference/pj_georeference/pj_georeference.vcproj,
-	  src/modules_projection/pj_georeference/pj_georeference/pj_georeference.vcxproj,
-	  src/modules_projection/pj_georeference/pj_georeference/pj_georeference.vcxproj.filters,
-	  src/modules_projection/pj_georeference/pj_georeference/qrfac.c,
-	  src/modules_projection/pj_georeference/pj_georeference/qrsolv.c,
-	  src/modules_projection/pj_geotrans/Makefile.am,
-	  src/modules_projection/pj_geotrans/pj_geotrans/GEOTRANS_Base.cpp,
-	  src/modules_projection/pj_geotrans/pj_geotrans/GEOTRANS_Base.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/GEOTRANS_Grid.cpp,
-	  src/modules_projection/pj_geotrans/pj_geotrans/GEOTRANS_Grid.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/GEOTRANS_Shapes.cpp,
-	  src/modules_projection/pj_geotrans/pj_geotrans/GEOTRANS_Shapes.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/MLB_Interface.cpp,
-	  src/modules_projection/pj_geotrans/pj_geotrans/MLB_Interface.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/Makefile.am,
-	  src/modules_projection/pj_geotrans/pj_geotrans/data/Projection_GeoTRANS_Datum_3.dat,
-	  src/modules_projection/pj_geotrans/pj_geotrans/data/Projection_GeoTRANS_Datum_7.dat,
-	  src/modules_projection/pj_geotrans/pj_geotrans/data/Projection_GeoTRANS_Ellipsoid.dat,
-	  src/modules_projection/pj_geotrans/pj_geotrans/data/Projection_GeoTRANS_Geoid_EGM96.dat,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/albers.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/albers.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/azeq.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/azeq.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/bng.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/bng.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/bonne.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/bonne.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/cassini.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/cassini.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/cyleqa.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/cyleqa.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/datum.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/datum.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/eckert4.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/eckert4.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/eckert6.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/eckert6.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/ellipse.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/ellipse.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/engine.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/engine.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/eqdcyl.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/eqdcyl.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/geocent.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/geocent.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/geoid.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/geoid.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/georef.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/georef.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/geotrans.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/gnomonic.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/gnomonic.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/grinten.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/grinten.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/lambert.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/lambert.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/lambert_1.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/lambert_1.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/lambert_2.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/lambert_2.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/loccart.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/loccart.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/mercator.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/mercator.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/mgrs.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/mgrs.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/miller.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/miller.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/mollweid.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/mollweid.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/neys.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/neys.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/nzmg.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/nzmg.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/omerc.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/omerc.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/orthogr.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/orthogr.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/polarst.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/polarst.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/polycon.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/polycon.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/sinusoid.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/sinusoid.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/stereogr.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/stereogr.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/tranmerc.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/tranmerc.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/trcyleqa.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/trcyleqa.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/ups.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/ups.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/utm.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/utm.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/pj_geotrans.dsp,
-	  src/modules_projection/pj_geotrans/pj_geotrans/pj_geotrans.vcproj,
-	  src/modules_projection/pj_geotrans/pj_geotrans/pj_geotrans.vcxproj,
-	  src/modules_projection/pj_geotrans/pj_geotrans/pj_geotrans.vcxproj.filters,
-	  src/modules_projection/pj_proj4/Makefile.am,
-	  src/modules_projection/pj_proj4/pj_proj4/MLB_Interface.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/MLB_Interface.h,
-	  src/modules_projection/pj_proj4/pj_proj4/Makefile.am,
-	  src/modules_projection/pj_proj4/pj_proj4/PROJ4_Base.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/PROJ4_Base.h,
-	  src/modules_projection/pj_proj4/pj_proj4/PROJ4_Grid.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/PROJ4_Grid.h,
-	  src/modules_projection/pj_proj4/pj_proj4/PROJ4_Shapes.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/PROJ4_Shapes.h,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_assign.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_assign.h,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_base.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_base.h,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_transform.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_transform.h,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_transform_grid.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_transform_grid.h,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_transform_shapes.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_transform_shapes.h,
-	  src/modules_projection/pj_proj4/pj_proj4/pj_proj4.dsp,
-	  src/modules_projection/pj_proj4/pj_proj4/pj_proj4.vcproj,
-	  src/modules_projection/pj_proj4/pj_proj4/pj_proj4.vcxproj,
-	  src/modules_projection/pj_proj4/pj_proj4/pj_proj4.vcxproj.filters,
-	  src/modules_recreations/Makefile.am,
-	  src/modules_recreations/recreations/Makefile.am,
-	  src/modules_recreations/recreations/recreations_fractals/Bifurcation.cpp,
-	  src/modules_recreations/recreations/recreations_fractals/Bifurcation.h,
-	  src/modules_recreations/recreations/recreations_fractals/Gaussian_Landscapes.cpp,
-	  src/modules_recreations/recreations/recreations_fractals/Gaussian_Landscapes.h,
-	  src/modules_recreations/recreations/recreations_fractals/Grid_FractalDimension.cpp,
-	  src/modules_recreations/recreations/recreations_fractals/Grid_FractalDimension.h,
-	  src/modules_recreations/recreations/recreations_fractals/MLB_Interface.cpp,
-	  src/modules_recreations/recreations/recreations_fractals/MLB_Interface.h,
-	  src/modules_recreations/recreations/recreations_fractals/Makefile.am,
-	  src/modules_recreations/recreations/recreations_fractals/Mandelbrot.cpp,
-	  src/modules_recreations/recreations/recreations_fractals/Mandelbrot.h,
-	  src/modules_recreations/recreations/recreations_fractals/Newton.cpp,
-	  src/modules_recreations/recreations/recreations_fractals/Newton.h,
-	  src/modules_recreations/recreations/recreations_fractals/Pythagoras_Tree.cpp,
-	  src/modules_recreations/recreations/recreations_fractals/Pythagoras_Tree.h,
-	  src/modules_recreations/recreations/recreations_fractals/recreations_fractals.dsp,
-	  src/modules_recreations/recreations/recreations_fractals/recreations_fractals.vcproj,
-	  src/modules_recreations/recreations/recreations_fractals/recreations_fractals.vcxproj,
-	  src/modules_recreations/recreations/recreations_fractals/recreations_fractals.vcxproj.filters,
-	  src/modules_recreations/recreations/recreations_games/MLB_Interface.cpp,
-	  src/modules_recreations/recreations/recreations_games/MLB_Interface.h,
-	  src/modules_recreations/recreations/recreations_games/Makefile.am,
-	  src/modules_recreations/recreations/recreations_games/Mine_Sweeper.cpp,
-	  src/modules_recreations/recreations/recreations_games/Mine_Sweeper.h,
-	  src/modules_recreations/recreations/recreations_games/Mine_Sweeper_Res.cpp,
-	  src/modules_recreations/recreations/recreations_games/Sudoku.cpp,
-	  src/modules_recreations/recreations/recreations_games/Sudoku.h,
-	  src/modules_recreations/recreations/recreations_games/recreations_games.dsp,
-	  src/modules_recreations/recreations/recreations_games/recreations_games.vcproj,
-	  src/modules_recreations/recreations/recreations_games/recreations_games.vcxproj,
-	  src/modules_recreations/recreations/recreations_games/recreations_games.vcxproj.filters,
-	  src/modules_simulation/Makefile.am,
-	  src/modules_simulation/cellular_automata/Makefile.am,
-	  src/modules_simulation/cellular_automata/sim_cellular_automata/Life.cpp,
-	  src/modules_simulation/cellular_automata/sim_cellular_automata/Life.h,
-	  src/modules_simulation/cellular_automata/sim_cellular_automata/MLB_Interface.cpp,
-	  src/modules_simulation/cellular_automata/sim_cellular_automata/MLB_Interface.h,
-	  src/modules_simulation/cellular_automata/sim_cellular_automata/Makefile.am,
-	  src/modules_simulation/cellular_automata/sim_cellular_automata/Wator.cpp,
-	  src/modules_simulation/cellular_automata/sim_cellular_automata/Wator.h,
-	  src/modules_simulation/cellular_automata/sim_cellular_automata/sim_cellular_automata.dsp,
-	  src/modules_simulation/cellular_automata/sim_cellular_automata/sim_cellular_automata.vcproj,
-	  src/modules_simulation/cellular_automata/sim_cellular_automata/sim_cellular_automata.vcxproj,
-	  src/modules_simulation/cellular_automata/sim_cellular_automata/sim_cellular_automata.vcxproj.filters,
-	  src/modules_simulation/ecosystems/Makefile.am,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/Hugget_01.cpp,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/Hugget_01.h,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/Hugget_02.cpp,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/Hugget_02.h,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/Hugget_03.cpp,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/Hugget_03.h,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/MLB_Interface.cpp,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/MLB_Interface.h,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/Makefile.am,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/sim_ecosystems_hugget.dsp,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/sim_ecosystems_hugget.vcproj,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/sim_ecosystems_hugget.vcxproj,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/sim_ecosystems_hugget.vcxproj.filters,
-	  src/modules_simulation/fire/Makefile.am,
-	  src/modules_simulation/fire/sim_fire_spreading/Forecasting.cpp,
-	  src/modules_simulation/fire/sim_fire_spreading/Forecasting.h,
-	  src/modules_simulation/fire/sim_fire_spreading/MLB_Interface.cpp,
-	  src/modules_simulation/fire/sim_fire_spreading/MLB_Interface.h,
-	  src/modules_simulation/fire/sim_fire_spreading/Makefile.am,
-	  src/modules_simulation/fire/sim_fire_spreading/Pt.h,
-	  src/modules_simulation/fire/sim_fire_spreading/Simulate.cpp,
-	  src/modules_simulation/fire/sim_fire_spreading/Simulate.h,
-	  src/modules_simulation/fire/sim_fire_spreading/SimulateVariableWind.cpp,
-	  src/modules_simulation/fire/sim_fire_spreading/SimulateVariableWind.h,
-	  src/modules_simulation/fire/sim_fire_spreading/fireLib.c,
-	  src/modules_simulation/fire/sim_fire_spreading/fireLib.h,
-	  src/modules_simulation/fire/sim_fire_spreading/sim_fire_spreading.dsp,
-	  src/modules_simulation/fire/sim_fire_spreading/sim_fire_spreading.vcproj,
-	  src/modules_simulation/fire/sim_fire_spreading/sim_fire_spreading.vcxproj,
-	  src/modules_simulation/fire/sim_fire_spreading/sim_fire_spreading.vcxproj.filters,
-	  src/modules_simulation/hydrology/Makefile.am,
-	  src/modules_simulation/hydrology/sim_hydrology/DVWK_SoilMoisture.cpp,
-	  src/modules_simulation/hydrology/sim_hydrology/DVWK_SoilMoisture.h,
-	  src/modules_simulation/hydrology/sim_hydrology/KinWav_D8.cpp,
-	  src/modules_simulation/hydrology/sim_hydrology/KinWav_D8.h,
-	  src/modules_simulation/hydrology/sim_hydrology/MLB_Interface.cpp,
-	  src/modules_simulation/hydrology/sim_hydrology/MLB_Interface.h,
-	  src/modules_simulation/hydrology/sim_hydrology/Makefile.am,
-	  src/modules_simulation/hydrology/sim_hydrology/WaterRetentionCapacity.cpp,
-	  src/modules_simulation/hydrology/sim_hydrology/WaterRetentionCapacity.h,
-	  src/modules_simulation/hydrology/sim_hydrology/data/dvwk_soil_moisture_climate1981.txt,
-	  src/modules_simulation/hydrology/sim_hydrology/data/topmodel_climate.txt,
-	  src/modules_simulation/hydrology/sim_hydrology/data/topmodel_grass_input.txt,
-	  src/modules_simulation/hydrology/sim_hydrology/data/topmodel_grass_param.txt,
-	  src/modules_simulation/hydrology/sim_hydrology/doc/TOPMODEL_GRASS.zip,
-	  src/modules_simulation/hydrology/sim_hydrology/doc/TOPMODEL_Lancaster.zip,
-	  src/modules_simulation/hydrology/sim_hydrology/idw.cpp,
-	  src/modules_simulation/hydrology/sim_hydrology/idw.h,
-	  src/modules_simulation/hydrology/sim_hydrology/sim_hydrology.dsp,
-	  src/modules_simulation/hydrology/sim_hydrology/sim_hydrology.vcproj,
-	  src/modules_simulation/hydrology/sim_hydrology/sim_hydrology.vcxproj,
-	  src/modules_simulation/hydrology/sim_hydrology/sim_hydrology.vcxproj.filters,
-	  src/modules_simulation/hydrology/sim_hydrology/topmodel.cpp,
-	  src/modules_simulation/hydrology/sim_hydrology/topmodel.h,
-	  src/modules_simulation/hydrology/sim_hydrology/topmodel_values.cpp,
-	  src/modules_simulation/hydrology/sim_hydrology/topmodel_values.h,
-	  src/modules_template/template/template/MLB_Interface.cpp,
-	  src/modules_template/template/template/MLB_Interface.h,
-	  src/modules_template/template/template/Makefile.am,
-	  src/modules_template/template/template/Template.bat,
-	  src/modules_template/template/template/Template.cpp,
-	  src/modules_template/template/template/Template.dsp,
-	  src/modules_template/template/template/Template.dsw,
-	  src/modules_template/template/template/Template.h,
-	  src/modules_template/template/template/Template.sln,
-	  src/modules_template/template/template/Template.vc10.sln,
-	  src/modules_template/template/template/Template.vcproj,
-	  src/modules_template/template/template/Template.vcxproj,
-	  src/modules_template/template/template/Template.vcxproj.filters,
-	  src/modules_terrain_analysis/Makefile.am,
-	  src/modules_terrain_analysis/terrain_analysis/Makefile.am,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ChannelNetwork.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ChannelNetwork.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ChannelNetwork_Altitude.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ChannelNetwork_Altitude.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ChannelNetwork_Distance.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ChannelNetwork_Distance.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/D8_Flow_Analysis.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/D8_Flow_Analysis.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/Helper.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/Helper.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/MLB_Interface.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/Makefile.am,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/Strahler.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/Strahler.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/Watersheds.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/Watersheds.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/Watersheds_ext.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/Watersheds_ext.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ta_channels.dsp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ta_channels.vcproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ta_channels.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ta_channels.vcxproj.filters,
-	  src/modules_terrain_analysis/terrain_analysis/ta_compound/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_compound/MLB_Interface.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_compound/Makefile.am,
-	  src/modules_terrain_analysis/terrain_analysis/ta_compound/TA_Standard.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_compound/TA_Standard.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_compound/ta_compound.dsp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_compound/ta_compound.vcproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_compound/ta_compound.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_compound/ta_compound.vcxproj.filters,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/BasinGrid.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/BasinGrid.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/CellBalance.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/CellBalance.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/EdgeContamination.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/EdgeContamination.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/FlowDepth.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/FlowDepth.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_AreaDownslope.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_AreaDownslope.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_AreaUpslope.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_AreaUpslope.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_BRM.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_Distance.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_Distance.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_Parallel.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_Parallel.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_RecursiveDown.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_RecursiveDown.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_RecursiveUp.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_RecursiveUp.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Helper.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Helper.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/IsochronesConst.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/IsochronesConst.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/IsochronesVar.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/IsochronesVar.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/LakeFlood.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/LakeFlood.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/LakeFloodInteractive.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/MLB_Interface.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Makefile.am,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Pt.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/SAGA_Wetness_Index.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/SAGA_Wetness_Index.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Sinuosity.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Sinuosity.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/SlopeLength.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/SlopeLength.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/TopographicIndices.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/TopographicIndices.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/flow_massflux.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/flow_massflux.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/flow_width.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/flow_width.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/ta_hydrology.dsp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/ta_hydrology.vcproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/ta_hydrology.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/ta_hydrology.vcxproj.filters,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/HillShade.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/HillShade.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/MLB_Interface.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/Makefile.am,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/SolarRadiation.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/SolarRadiation.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/Visibility_Point.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/Visibility_Point.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/ta_lighting.dsp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/ta_lighting.ger.txt,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/ta_lighting.vcproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/ta_lighting.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/ta_lighting.vcxproj.filters,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/topographic_correction.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/topographic_correction.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/view_shed.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/view_shed.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Convergence.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Convergence.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Convergence_Radius.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Convergence_Radius.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Curvature_Classification.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Curvature_Classification.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Hypsometry.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Hypsometry.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/MLB_Interface.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Makefile.am,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Morphometry.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Morphometry.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/ProtectionIndex.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/ProtectionIndex.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/RealArea.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/RealArea.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/SurfaceSpecificPoints.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/SurfaceSpecificPoints.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/air_flow_height.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/air_flow_height.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/anisotropic_heating.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/anisotropic_heating.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/distance_gradient.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/distance_gradient.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/land_surface_temperature.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/land_surface_temperature.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/mass_balance_index.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/mass_balance_index.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/mrvbf.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/mrvbf.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/relative_heights.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/relative_heights.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/ruggedness.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/ruggedness.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/ta_morphometry.dsp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/ta_morphometry.vcproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/ta_morphometry.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/ta_morphometry.vcxproj.filters,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/wind_effect.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/wind_effect.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/FillSinks.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/FillSinks.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/FillSinks_WL.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/FillSinks_WL.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/FillSinks_WL_XXL.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/Flat_Detection.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/Flat_Detection.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/MLB_Interface.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/Makefile.am,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/Pit_Eliminator.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/Pit_Eliminator.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/Pit_Router.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/Pit_Router.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/ta_preprocessor.dsp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/ta_preprocessor.vcproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/ta_preprocessor.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/ta_preprocessor.vcxproj.filters,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_Cross_Profiles.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_Cross_Profiles.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_Flow_Profile.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_Flow_Profile.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_Profile.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_Profile.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_ProfileFromPoints.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_ProfileFromPoints.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_Profile_From_Lines.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_Profile_From_Lines.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_Swath_Profile.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_Swath_Profile.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/MLB_Interface.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Makefile.am,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/ta_profiles.dsp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/ta_profiles.vcproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/ta_profiles.vcxproj,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/ta_profiles.vcxproj.filters,
-	  src/saga.dsw, src/saga.sln, src/saga.vc10.sln,
-	  src/saga_core/Makefile.am, src/saga_core/saga_api/Makefile.am,
-	  src/saga_core/saga_api/api_callback.cpp,
-	  src/saga_core/saga_api/api_colors.cpp,
-	  src/saga_core/saga_api/api_core.cpp,
-	  src/saga_core/saga_api/api_core.h,
-	  src/saga_core/saga_api/api_file.cpp,
-	  src/saga_core/saga_api/api_memory.cpp,
-	  src/saga_core/saga_api/api_string.cpp,
-	  src/saga_core/saga_api/api_translator.cpp,
-	  src/saga_core/saga_api/changes.txt,
-	  src/saga_core/saga_api/compatibility.h,
-	  src/saga_core/saga_api/dataobject.cpp,
-	  src/saga_core/saga_api/dataobject.h,
-	  src/saga_core/saga_api/geo_classes.cpp,
-	  src/saga_core/saga_api/geo_functions.cpp,
-	  src/saga_core/saga_api/geo_tools.h,
-	  src/saga_core/saga_api/grid.cpp, src/saga_core/saga_api/grid.h,
-	  src/saga_core/saga_api/grid_io.cpp,
-	  src/saga_core/saga_api/grid_memory.cpp,
-	  src/saga_core/saga_api/grid_operation.cpp,
-	  src/saga_core/saga_api/grid_pyramid.cpp,
-	  src/saga_core/saga_api/grid_pyramid.h,
-	  src/saga_core/saga_api/grid_system.cpp,
-	  src/saga_core/saga_api/mat_formula.cpp,
-	  src/saga_core/saga_api/mat_grid_radius.cpp,
-	  src/saga_core/saga_api/mat_indexing.cpp,
-	  src/saga_core/saga_api/mat_matrix.cpp,
-	  src/saga_core/saga_api/mat_regression.cpp,
-	  src/saga_core/saga_api/mat_regression_multiple.cpp,
-	  src/saga_core/saga_api/mat_spline.cpp,
-	  src/saga_core/saga_api/mat_tools.cpp,
-	  src/saga_core/saga_api/mat_tools.h,
-	  src/saga_core/saga_api/mat_trend.cpp,
-	  src/saga_core/saga_api/metadata.cpp,
-	  src/saga_core/saga_api/metadata.h,
-	  src/saga_core/saga_api/module.cpp,
-	  src/saga_core/saga_api/module.h,
-	  src/saga_core/saga_api/module_grid.cpp,
-	  src/saga_core/saga_api/module_grid_interactive.cpp,
-	  src/saga_core/saga_api/module_interactive.cpp,
-	  src/saga_core/saga_api/module_interactive_base.cpp,
-	  src/saga_core/saga_api/module_library.cpp,
-	  src/saga_core/saga_api/module_library.h,
-	  src/saga_core/saga_api/module_library_interface.cpp,
-	  src/saga_core/saga_api/parameter.cpp,
-	  src/saga_core/saga_api/parameter_data.cpp,
-	  src/saga_core/saga_api/parameters.cpp,
-	  src/saga_core/saga_api/parameters.h,
-	  src/saga_core/saga_api/pointcloud.cpp,
-	  src/saga_core/saga_api/pointcloud.h,
-	  src/saga_core/saga_api/projections.cpp,
-	  src/saga_core/saga_api/quadtree.cpp,
-	  src/saga_core/saga_api/saga_api.cpp,
-	  src/saga_core/saga_api/saga_api.dsp,
-	  src/saga_core/saga_api/saga_api.h,
-	  src/saga_core/saga_api/saga_api.vcproj,
-	  src/saga_core/saga_api/saga_api.vcxproj,
-	  src/saga_core/saga_api/saga_api.vcxproj.filters,
-	  src/saga_core/saga_api/saga_api_to_python_linux.py,
-	  src/saga_core/saga_api/saga_api_to_python_linux.sh,
-	  src/saga_core/saga_api/saga_api_to_python_win.bat,
-	  src/saga_core/saga_api/saga_api_to_python_win.py,
-	  src/saga_core/saga_api/shape.cpp,
-	  src/saga_core/saga_api/shape_line.cpp,
-	  src/saga_core/saga_api/shape_part.cpp,
-	  src/saga_core/saga_api/shape_point.cpp,
-	  src/saga_core/saga_api/shape_points.cpp,
-	  src/saga_core/saga_api/shape_polygon.cpp,
-	  src/saga_core/saga_api/shapes.cpp,
-	  src/saga_core/saga_api/shapes.h,
-	  src/saga_core/saga_api/shapes_io.cpp,
-	  src/saga_core/saga_api/shapes_ogis.cpp,
-	  src/saga_core/saga_api/shapes_search.cpp,
-	  src/saga_core/saga_api/shapes_selection.cpp,
-	  src/saga_core/saga_api/table.cpp, src/saga_core/saga_api/table.h,
-	  src/saga_core/saga_api/table_dbase.cpp,
-	  src/saga_core/saga_api/table_dbase.h,
-	  src/saga_core/saga_api/table_io.cpp,
-	  src/saga_core/saga_api/table_record.cpp,
-	  src/saga_core/saga_api/table_selection.cpp,
-	  src/saga_core/saga_api/table_value.h,
-	  src/saga_core/saga_api/tin.cpp, src/saga_core/saga_api/tin.h,
-	  src/saga_core/saga_api/tin_elements.cpp,
-	  src/saga_core/saga_api/tin_triangulation.cpp,
-	  src/saga_core/saga_cmd/Makefile.am,
-	  src/saga_core/saga_cmd/callback.cpp,
-	  src/saga_core/saga_cmd/callback.h,
-	  src/saga_core/saga_cmd/man/Makefile.am,
-	  src/saga_core/saga_cmd/man/saga_cmd.1,
-	  src/saga_core/saga_cmd/module_library.cpp,
-	  src/saga_core/saga_cmd/module_library.h,
-	  src/saga_core/saga_cmd/saga_cmd.cpp,
-	  src/saga_core/saga_cmd/saga_cmd.dsp,
-	  src/saga_core/saga_cmd/saga_cmd.vcproj,
-	  src/saga_core/saga_cmd/saga_cmd.vcxproj,
-	  src/saga_core/saga_cmd/saga_cmd.vcxproj.filters,
-	  src/saga_core/saga_gdi/Makefile.am,
-	  src/saga_core/saga_gdi/saga_gdi.cpp,
-	  src/saga_core/saga_gdi/saga_gdi.dsp,
-	  src/saga_core/saga_gdi/saga_gdi.h,
-	  src/saga_core/saga_gdi/saga_gdi.vcproj,
-	  src/saga_core/saga_gdi/saga_gdi.vcxproj,
-	  src/saga_core/saga_gdi/saga_gdi.vcxproj.filters,
-	  src/saga_core/saga_gdi/sgdi_diagram.cpp,
-	  src/saga_core/saga_gdi/sgdi_diagram.h,
-	  src/saga_core/saga_gdi/sgdi_dialog.cpp,
-	  src/saga_core/saga_gdi/sgdi_dialog.h,
-	  src/saga_core/saga_gdi/sgdi_helper.cpp,
-	  src/saga_core/saga_gdi/sgdi_helper.h,
-	  src/saga_core/saga_gui/Makefile.am,
-	  src/saga_core/saga_gui/active.cpp,
-	  src/saga_core/saga_gui/active.h,
-	  src/saga_core/saga_gui/active_HTMLExtraInfo.cpp,
-	  src/saga_core/saga_gui/active_HTMLExtraInfo.h,
-	  src/saga_core/saga_gui/active_attributes.cpp,
-	  src/saga_core/saga_gui/active_attributes.h,
-	  src/saga_core/saga_gui/active_description.cpp,
-	  src/saga_core/saga_gui/active_description.h,
-	  src/saga_core/saga_gui/active_history.cpp,
-	  src/saga_core/saga_gui/active_history.h,
-	  src/saga_core/saga_gui/active_legend.cpp,
-	  src/saga_core/saga_gui/active_legend.h,
-	  src/saga_core/saga_gui/active_parameters.cpp,
-	  src/saga_core/saga_gui/active_parameters.h,
-	  src/saga_core/saga_gui/callback.cpp,
-	  src/saga_core/saga_gui/callback.h,
-	  src/saga_core/saga_gui/dc_helper.cpp,
-	  src/saga_core/saga_gui/dc_helper.h,
-	  src/saga_core/saga_gui/dlg_about.cpp,
-	  src/saga_core/saga_gui/dlg_about.h,
-	  src/saga_core/saga_gui/dlg_about_logo.cpp,
-	  src/saga_core/saga_gui/dlg_about_logo.h,
-	  src/saga_core/saga_gui/dlg_base.cpp,
-	  src/saga_core/saga_gui/dlg_base.h,
-	  src/saga_core/saga_gui/dlg_colors.cpp,
-	  src/saga_core/saga_gui/dlg_colors.h,
-	  src/saga_core/saga_gui/dlg_colors_control.cpp,
-	  src/saga_core/saga_gui/dlg_colors_control.h,
-	  src/saga_core/saga_gui/dlg_list_base.cpp,
-	  src/saga_core/saga_gui/dlg_list_base.h,
-	  src/saga_core/saga_gui/dlg_list_grid.cpp,
-	  src/saga_core/saga_gui/dlg_list_grid.h,
-	  src/saga_core/saga_gui/dlg_list_pointcloud.cpp,
-	  src/saga_core/saga_gui/dlg_list_pointcloud.h,
-	  src/saga_core/saga_gui/dlg_list_shapes.cpp,
-	  src/saga_core/saga_gui/dlg_list_shapes.h,
-	  src/saga_core/saga_gui/dlg_list_table.cpp,
-	  src/saga_core/saga_gui/dlg_list_table.h,
-	  src/saga_core/saga_gui/dlg_list_tin.cpp,
-	  src/saga_core/saga_gui/dlg_list_tin.h,
-	  src/saga_core/saga_gui/dlg_parameters.cpp,
-	  src/saga_core/saga_gui/dlg_parameters.h,
-	  src/saga_core/saga_gui/dlg_table.cpp,
-	  src/saga_core/saga_gui/dlg_table.h,
-	  src/saga_core/saga_gui/dlg_text.cpp,
-	  src/saga_core/saga_gui/dlg_text.h,
-	  src/saga_core/saga_gui/helper.cpp,
-	  src/saga_core/saga_gui/helper.h, src/saga_core/saga_gui/info.cpp,
-	  src/saga_core/saga_gui/info.h,
-	  src/saga_core/saga_gui/info_messages.cpp,
-	  src/saga_core/saga_gui/info_messages.h,
-	  src/saga_core/saga_gui/man/Makefile.am,
-	  src/saga_core/saga_gui/man/saga_gui.1,
-	  src/saga_core/saga_gui/parameters_control.cpp,
-	  src/saga_core/saga_gui/parameters_control.h,
-	  src/saga_core/saga_gui/parameters_properties.cpp,
-	  src/saga_core/saga_gui/parameters_properties.h,
-	  src/saga_core/saga_gui/project.cpp,
-	  src/saga_core/saga_gui/project.h,
-	  src/saga_core/saga_gui/res/colours.bmp,
-	  src/saga_core/saga_gui/res/resource.h,
-	  src/saga_core/saga_gui/res/saga.ger.txt,
-	  src/saga_core/saga_gui/res/saga.ico,
-	  src/saga_core/saga_gui/res/saga.lng.txt,
-	  src/saga_core/saga_gui/res/saga_dic.txt,
-	  src/saga_core/saga_gui/res/saga_gui.rc,
-	  src/saga_core/saga_gui/res/saga_srs.txt,
-	  src/saga_core/saga_gui/res/saga_tip.txt,
-	  src/saga_core/saga_gui/res/xpm/crs_edit_point_add.xpm,
-	  src/saga_core/saga_gui/res/xpm/crs_edit_point_move.xpm,
-	  src/saga_core/saga_gui/res/xpm/crs_hand.xpm,
-	  src/saga_core/saga_gui/res/xpm/crs_hand_grap.xpm,
-	  src/saga_core/saga_gui/res/xpm/crs_info.xpm,
-	  src/saga_core/saga_gui/res/xpm/crs_magnifier.xpm,
-	  src/saga_core/saga_gui/res/xpm/crs_select.xpm,
-	  src/saga_core/saga_gui/res/xpm/default.xpm,
-	  src/saga_core/saga_gui/res/xpm/nb_active_attributes.xpm,
-	  src/saga_core/saga_gui/res/xpm/nb_active_description.xpm,
-	  src/saga_core/saga_gui/res/xpm/nb_active_htmlextrainfo.xpm,
-	  src/saga_core/saga_gui/res/xpm/nb_active_legend.xpm,
-	  src/saga_core/saga_gui/res/xpm/nb_active_parameters.xpm,
-	  src/saga_core/saga_gui/res/xpm/nb_info_error.xpm,
-	  src/saga_core/saga_gui/res/xpm/nb_info_execution.xpm,
-	  src/saga_core/saga_gui/res/xpm/nb_info_messages.xpm,
-	  src/saga_core/saga_gui/res/xpm/nb_wksp_data.xpm,
-	  src/saga_core/saga_gui/res/xpm/nb_wksp_maps.xpm,
-	  src/saga_core/saga_gui/res/xpm/nb_wksp_modules.xpm,
-	  src/saga_core/saga_gui/res/xpm/nb_wksp_thumbnails.xpm,
-	  src/saga_core/saga_gui/res/xpm/nb_wksp_treeview.xpm,
-	  src/saga_core/saga_gui/res/xpm/saga_icon_16.xpm,
-	  src/saga_core/saga_gui/res/xpm/saga_icon_32.xpm,
-	  src/saga_core/saga_gui/res/xpm/saga_splash.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_active.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_delete.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_diagram_parameters.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_edit_shape_add.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_edit_shape_add_part.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_edit_shape_del.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_edit_shape_del_part.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_edit_shape_del_point.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_edit_shape_select.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_help.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_histogram_as_table.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_histogram_cumulative.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_info.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_layout_page_setup.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_layout_print.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_layout_print_preview.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_layout_print_setup.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map3d_central_less.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map3d_central_more.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map3d_exaggerate_less.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map3d_exaggerate_more.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map3d_interpolated.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map3d_properties.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map3d_rotate_x_less.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map3d_rotate_x_more.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map3d_rotate_z_less.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map3d_rotate_z_more.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map3d_shift_x_less.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map3d_shift_x_more.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map3d_shift_y_less.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map3d_shift_y_more.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map3d_shift_z_less.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map3d_shift_z_more.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map3d_stereo.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map_3d_show.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map_layout_show.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map_legend_horizontal.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map_legend_vertical.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map_mode_distance.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map_mode_pan.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map_mode_select.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map_mode_zoom.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map_synchronize.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map_zoom_active.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map_zoom_full.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map_zoom_last.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map_zoom_next.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_map_zoom_selection.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_open.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_open_grid.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_open_module.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_open_shapes.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_open_table.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_open_tin.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_save.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_scatterplot_parameters.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_show.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_table_col_add.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_table_col_del.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_table_row_add.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_table_row_del.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_table_row_del_all.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_table_row_ins.xpm,
-	  src/saga_core/saga_gui/res/xpm/tb_wksp.xpm,
-	  src/saga_core/saga_gui/res/xpm/wksp_data_manager.xpm,
-	  src/saga_core/saga_gui/res/xpm/wksp_grid.xpm,
-	  src/saga_core/saga_gui/res/xpm/wksp_grid_manager.xpm,
-	  src/saga_core/saga_gui/res/xpm/wksp_grid_system.xpm,
-	  src/saga_core/saga_gui/res/xpm/wksp_map.xpm,
-	  src/saga_core/saga_gui/res/xpm/wksp_map_manager.xpm,
-	  src/saga_core/saga_gui/res/xpm/wksp_module.xpm,
-	  src/saga_core/saga_gui/res/xpm/wksp_module_library.xpm,
-	  src/saga_core/saga_gui/res/xpm/wksp_module_manager.xpm,
-	  src/saga_core/saga_gui/res/xpm/wksp_noitems.xpm,
-	  src/saga_core/saga_gui/res/xpm/wksp_shapes_line.xpm,
-	  src/saga_core/saga_gui/res/xpm/wksp_shapes_manager.xpm,
-	  src/saga_core/saga_gui/res/xpm/wksp_shapes_point.xpm,
-	  src/saga_core/saga_gui/res/xpm/wksp_shapes_points.xpm,
-	  src/saga_core/saga_gui/res/xpm/wksp_shapes_polygon.xpm,
-	  src/saga_core/saga_gui/res/xpm/wksp_table.xpm,
-	  src/saga_core/saga_gui/res/xpm/wksp_table_manager.xpm,
-	  src/saga_core/saga_gui/res/xpm/wksp_tin.xpm,
-	  src/saga_core/saga_gui/res/xpm/wksp_tin_manager.xpm,
-	  src/saga_core/saga_gui/res/xpm/wnd_diagram.xpm,
-	  src/saga_core/saga_gui/res/xpm/wnd_histogram.xpm,
-	  src/saga_core/saga_gui/res/xpm/wnd_layout.xpm,
-	  src/saga_core/saga_gui/res/xpm/wnd_map.xpm,
-	  src/saga_core/saga_gui/res/xpm/wnd_map3d.xpm,
-	  src/saga_core/saga_gui/res/xpm/wnd_scatterplot.xpm,
-	  src/saga_core/saga_gui/res/xpm/wnd_table.xpm,
-	  src/saga_core/saga_gui/res_commands.cpp,
-	  src/saga_core/saga_gui/res_commands.h,
-	  src/saga_core/saga_gui/res_controls.cpp,
-	  src/saga_core/saga_gui/res_controls.h,
-	  src/saga_core/saga_gui/res_dialogs.cpp,
-	  src/saga_core/saga_gui/res_dialogs.h,
-	  src/saga_core/saga_gui/res_images.cpp,
-	  src/saga_core/saga_gui/res_images.h,
-	  src/saga_core/saga_gui/saga.cpp, src/saga_core/saga_gui/saga.h,
-	  src/saga_core/saga_gui/saga_frame.cpp,
-	  src/saga_core/saga_gui/saga_frame.h,
-	  src/saga_core/saga_gui/saga_frame_droptarget.cpp,
-	  src/saga_core/saga_gui/saga_frame_droptarget.h,
-	  src/saga_core/saga_gui/saga_gui.dsp,
-	  src/saga_core/saga_gui/saga_gui.vcproj,
-	  src/saga_core/saga_gui/saga_gui.vcxproj,
-	  src/saga_core/saga_gui/saga_gui.vcxproj.filters,
-	  src/saga_core/saga_gui/view_base.cpp,
-	  src/saga_core/saga_gui/view_base.h,
-	  src/saga_core/saga_gui/view_histogram.cpp,
-	  src/saga_core/saga_gui/view_histogram.h,
-	  src/saga_core/saga_gui/view_layout.cpp,
-	  src/saga_core/saga_gui/view_layout.h,
-	  src/saga_core/saga_gui/view_layout_control.cpp,
-	  src/saga_core/saga_gui/view_layout_control.h,
-	  src/saga_core/saga_gui/view_layout_info.cpp,
-	  src/saga_core/saga_gui/view_layout_info.h,
-	  src/saga_core/saga_gui/view_layout_printout.cpp,
-	  src/saga_core/saga_gui/view_layout_printout.h,
-	  src/saga_core/saga_gui/view_map.cpp,
-	  src/saga_core/saga_gui/view_map.h,
-	  src/saga_core/saga_gui/view_map_3d.cpp,
-	  src/saga_core/saga_gui/view_map_3d.h,
-	  src/saga_core/saga_gui/view_map_3d_image.cpp,
-	  src/saga_core/saga_gui/view_map_3d_image.h,
-	  src/saga_core/saga_gui/view_map_control.cpp,
-	  src/saga_core/saga_gui/view_map_control.h,
-	  src/saga_core/saga_gui/view_ruler.cpp,
-	  src/saga_core/saga_gui/view_ruler.h,
-	  src/saga_core/saga_gui/view_scatterplot.cpp,
-	  src/saga_core/saga_gui/view_scatterplot.h,
-	  src/saga_core/saga_gui/view_table.cpp,
-	  src/saga_core/saga_gui/view_table.h,
-	  src/saga_core/saga_gui/view_table_control.cpp,
-	  src/saga_core/saga_gui/view_table_control.h,
-	  src/saga_core/saga_gui/view_table_diagram.cpp,
-	  src/saga_core/saga_gui/view_table_diagram.h,
-	  src/saga_core/saga_gui/wksp.cpp, src/saga_core/saga_gui/wksp.h,
-	  src/saga_core/saga_gui/wksp_base_control.cpp,
-	  src/saga_core/saga_gui/wksp_base_control.h,
-	  src/saga_core/saga_gui/wksp_base_item.cpp,
-	  src/saga_core/saga_gui/wksp_base_item.h,
-	  src/saga_core/saga_gui/wksp_base_manager.cpp,
-	  src/saga_core/saga_gui/wksp_base_manager.h,
-	  src/saga_core/saga_gui/wksp_data_control.cpp,
-	  src/saga_core/saga_gui/wksp_data_control.h,
-	  src/saga_core/saga_gui/wksp_data_layers.cpp,
-	  src/saga_core/saga_gui/wksp_data_layers.h,
-	  src/saga_core/saga_gui/wksp_data_manager.cpp,
-	  src/saga_core/saga_gui/wksp_data_manager.h,
-	  src/saga_core/saga_gui/wksp_data_menu_file.cpp,
-	  src/saga_core/saga_gui/wksp_data_menu_file.h,
-	  src/saga_core/saga_gui/wksp_data_menu_files.cpp,
-	  src/saga_core/saga_gui/wksp_data_menu_files.h,
-	  src/saga_core/saga_gui/wksp_grid.cpp,
-	  src/saga_core/saga_gui/wksp_grid.h,
-	  src/saga_core/saga_gui/wksp_grid_manager.cpp,
-	  src/saga_core/saga_gui/wksp_grid_manager.h,
-	  src/saga_core/saga_gui/wksp_grid_system.cpp,
-	  src/saga_core/saga_gui/wksp_grid_system.h,
-	  src/saga_core/saga_gui/wksp_layer.cpp,
-	  src/saga_core/saga_gui/wksp_layer.h,
-	  src/saga_core/saga_gui/wksp_layer_classify.cpp,
-	  src/saga_core/saga_gui/wksp_layer_classify.h,
-	  src/saga_core/saga_gui/wksp_layer_legend.cpp,
-	  src/saga_core/saga_gui/wksp_layer_legend.h,
-	  src/saga_core/saga_gui/wksp_map.cpp,
-	  src/saga_core/saga_gui/wksp_map.h,
-	  src/saga_core/saga_gui/wksp_map_buttons.cpp,
-	  src/saga_core/saga_gui/wksp_map_buttons.h,
-	  src/saga_core/saga_gui/wksp_map_control.cpp,
-	  src/saga_core/saga_gui/wksp_map_control.h,
-	  src/saga_core/saga_gui/wksp_map_dc.cpp,
-	  src/saga_core/saga_gui/wksp_map_dc.h,
-	  src/saga_core/saga_gui/wksp_map_layer.cpp,
-	  src/saga_core/saga_gui/wksp_map_layer.h,
-	  src/saga_core/saga_gui/wksp_map_manager.cpp,
-	  src/saga_core/saga_gui/wksp_map_manager.h,
-	  src/saga_core/saga_gui/wksp_module.cpp,
-	  src/saga_core/saga_gui/wksp_module.h,
-	  src/saga_core/saga_gui/wksp_module_control.cpp,
-	  src/saga_core/saga_gui/wksp_module_control.h,
-	  src/saga_core/saga_gui/wksp_module_library.cpp,
-	  src/saga_core/saga_gui/wksp_module_library.h,
-	  src/saga_core/saga_gui/wksp_module_manager.cpp,
-	  src/saga_core/saga_gui/wksp_module_manager.h,
-	  src/saga_core/saga_gui/wksp_module_menu.cpp,
-	  src/saga_core/saga_gui/wksp_module_menu.h,
-	  src/saga_core/saga_gui/wksp_pointcloud.cpp,
-	  src/saga_core/saga_gui/wksp_pointcloud.h,
-	  src/saga_core/saga_gui/wksp_pointcloud_manager.cpp,
-	  src/saga_core/saga_gui/wksp_pointcloud_manager.h,
-	  src/saga_core/saga_gui/wksp_shapes.cpp,
-	  src/saga_core/saga_gui/wksp_shapes.h,
-	  src/saga_core/saga_gui/wksp_shapes_edit.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_line.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_line.h,
-	  src/saga_core/saga_gui/wksp_shapes_manager.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_manager.h,
-	  src/saga_core/saga_gui/wksp_shapes_point.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_point.h,
-	  src/saga_core/saga_gui/wksp_shapes_points.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_points.h,
-	  src/saga_core/saga_gui/wksp_shapes_polygon.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_polygon.h,
-	  src/saga_core/saga_gui/wksp_shapes_type.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_type.h,
-	  src/saga_core/saga_gui/wksp_table.cpp,
-	  src/saga_core/saga_gui/wksp_table.h,
-	  src/saga_core/saga_gui/wksp_table_manager.cpp,
-	  src/saga_core/saga_gui/wksp_table_manager.h,
-	  src/saga_core/saga_gui/wksp_tin.cpp,
-	  src/saga_core/saga_gui/wksp_tin.h,
-	  src/saga_core/saga_gui/wksp_tin_manager.cpp,
-	  src/saga_core/saga_gui/wksp_tin_manager.h,
-	  src/saga_core/saga_gui/wx/propgrid/advprops.cpp,
-	  src/saga_core/saga_gui/wx/propgrid/advprops.h,
-	  src/saga_core/saga_gui/wx/propgrid/editors.cpp,
-	  src/saga_core/saga_gui/wx/propgrid/editors.h,
-	  src/saga_core/saga_gui/wx/propgrid/extras.cpp,
-	  src/saga_core/saga_gui/wx/propgrid/extras.h,
-	  src/saga_core/saga_gui/wx/propgrid/manager.cpp,
-	  src/saga_core/saga_gui/wx/propgrid/manager.h,
-	  src/saga_core/saga_gui/wx/propgrid/odcombo.cpp,
-	  src/saga_core/saga_gui/wx/propgrid/odcombo.h,
-	  src/saga_core/saga_gui/wx/propgrid/propdev.h,
-	  src/saga_core/saga_gui/wx/propgrid/propgrid.cpp,
-	  src/saga_core/saga_gui/wx/propgrid/propgrid.h,
-	  src/saga_core/saga_gui/wx/propgrid/props.cpp,
-	  src/saga_core/saga_gui/wx/propgrid/props.h,
-	  src/saga_core/saga_odbc/Makefile.am,
-	  src/saga_core/saga_odbc/otlv4.h,
-	  src/saga_core/saga_odbc/saga_odbc.cpp,
-	  src/saga_core/saga_odbc/saga_odbc.dsp,
-	  src/saga_core/saga_odbc/saga_odbc.h,
-	  src/saga_core/saga_odbc/saga_odbc.vcproj,
-	  src/saga_core/saga_odbc/saga_odbc.vcxproj,
-	  src/saga_core/saga_odbc/saga_odbc.vcxproj.filters: all .h, .c and
-	  .cpp files: svn keywords added and conversion to Unix LF
-
-2011-02-14 15:27  reklov_w
-
-	* src/dev_tools/MLB_Interface.cpp, src/dev_tools/MLB_Interface.h,
-	  src/dev_tools/tl_extract.cpp, src/dev_tools/tl_extract.h,
-	  src/dev_tools/tl_merge.cpp, src/dev_tools/tl_merge.h,
-	  src/dev_tools/tl_union.cpp, src/dev_tools/tl_union.h,
-	  src/modules/grid/grid_analysis/Cost_Anisotropic.cpp,
-	  src/modules/grid/grid_analysis/Cost_Anisotropic.h,
-	  src/modules/grid/grid_analysis/Cost_Isotropic.cpp,
-	  src/modules/grid/grid_analysis/Cost_Isotropic.h,
-	  src/modules/grid/grid_analysis/Cost_PolarToRect.cpp,
-	  src/modules/grid/grid_analysis/Cost_PolarToRect.h,
-	  src/modules/grid/grid_analysis/Cost_RectToPolar.cpp,
-	  src/modules/grid/grid_analysis/Cost_RectToPolar.h,
-	  src/modules/grid/grid_analysis/CoveredDistance.cpp,
-	  src/modules/grid/grid_analysis/CoveredDistance.h,
-	  src/modules/grid/grid_analysis/CrossClassification.cpp,
-	  src/modules/grid/grid_analysis/CrossClassification.h,
-	  src/modules/grid/grid_analysis/Grid_AHP.cpp,
-	  src/modules/grid/grid_analysis/Grid_AHP.h,
-	  src/modules/grid/grid_analysis/Grid_AggregationIndex.cpp,
-	  src/modules/grid/grid_analysis/Grid_AggregationIndex.h,
-	  src/modules/grid/grid_analysis/Grid_CVA.cpp,
-	  src/modules/grid/grid_analysis/Grid_CVA.h,
-	  src/modules/grid/grid_analysis/Grid_LayerOfMaximumValue.cpp,
-	  src/modules/grid/grid_analysis/Grid_LayerOfMaximumValue.h,
-	  src/modules/grid/grid_analysis/Grid_Pattern.cpp,
-	  src/modules/grid/grid_analysis/Grid_Pattern.h,
-	  src/modules/grid/grid_analysis/LeastCostPathProfile.cpp,
-	  src/modules/grid/grid_analysis/LeastCostPathProfile.h,
-	  src/modules/grid/grid_analysis/LeastCostPathProfile_Points.cpp,
-	  src/modules/grid/grid_analysis/LeastCostPathProfile_Points.h,
-	  src/modules/grid/grid_analysis/MLB_Interface.cpp,
-	  src/modules/grid/grid_analysis/MLB_Interface.h,
-	  src/modules/grid/grid_analysis/PointsEx.cpp,
-	  src/modules/grid/grid_analysis/PointsEx.h,
-	  src/modules/grid/grid_analysis/Soil_Texture.cpp,
-	  src/modules/grid/grid_analysis/Soil_Texture.h,
-	  src/modules/grid/grid_analysis/fragmentation_base.cpp,
-	  src/modules/grid/grid_analysis/fragmentation_base.h,
-	  src/modules/grid/grid_analysis/fragmentation_classify.cpp,
-	  src/modules/grid/grid_analysis/fragmentation_classify.h,
-	  src/modules/grid/grid_analysis/fragmentation_resampling.cpp,
-	  src/modules/grid/grid_analysis/fragmentation_resampling.h,
-	  src/modules/grid/grid_analysis/fragmentation_standard.cpp,
-	  src/modules/grid/grid_analysis/fragmentation_standard.h,
-	  src/modules/grid/grid_analysis/owa.cpp,
-	  src/modules/grid/grid_analysis/owa.h,
-	  src/modules/grid/grid_calculus/Fuzzify.cpp,
-	  src/modules/grid/grid_calculus/Fuzzify.h,
-	  src/modules/grid/grid_calculus/FuzzyAND.cpp,
-	  src/modules/grid/grid_calculus/FuzzyAND.h,
-	  src/modules/grid/grid_calculus/FuzzyOR.cpp,
-	  src/modules/grid/grid_calculus/FuzzyOR.h,
-	  src/modules/grid/grid_calculus/Grid_Calculator.cpp,
-	  src/modules/grid/grid_calculus/Grid_Calculator.h,
-	  src/modules/grid/grid_calculus/Grid_Geometric_Figures.cpp,
-	  src/modules/grid/grid_calculus/Grid_Geometric_Figures.h,
-	  src/modules/grid/grid_calculus/Grid_Normalise.cpp,
-	  src/modules/grid/grid_calculus/Grid_Normalise.h,
-	  src/modules/grid/grid_calculus/Grid_Plotter.cpp,
-	  src/modules/grid/grid_calculus/Grid_Plotter.h,
-	  src/modules/grid/grid_calculus/Grid_Random_Field.cpp,
-	  src/modules/grid/grid_calculus/Grid_Random_Field.h,
-	  src/modules/grid/grid_calculus/Grid_Random_Terrain.cpp,
-	  src/modules/grid/grid_calculus/Grid_Random_Terrain.h,
-	  src/modules/grid/grid_calculus/Grid_Volume.cpp,
-	  src/modules/grid/grid_calculus/Grid_Volume.h,
-	  src/modules/grid/grid_calculus/MLB_Interface.cpp,
-	  src/modules/grid/grid_calculus/MLB_Interface.h,
-	  src/modules/grid/grid_calculus/grid_difference.cpp,
-	  src/modules/grid/grid_calculus/grid_difference.h,
-	  src/modules/grid/grid_calculus_bsl/MLB_Interface.cpp,
-	  src/modules/grid/grid_calculus_bsl/MLB_Interface.h,
-	  src/modules/grid/grid_calculus_bsl/ausdruck.cpp,
-	  src/modules/grid/grid_calculus_bsl/ausdruck.h,
-	  src/modules/grid/grid_calculus_bsl/auswert_anweisung.cpp,
-	  src/modules/grid/grid_calculus_bsl/auswert_anweisung.h,
-	  src/modules/grid/grid_calculus_bsl/auswert_foreach.cpp,
-	  src/modules/grid/grid_calculus_bsl/auswert_foreach.h,
-	  src/modules/grid/grid_calculus_bsl/auswert_if.cpp,
-	  src/modules/grid/grid_calculus_bsl/auswert_if.h,
-	  src/modules/grid/grid_calculus_bsl/auswert_zuweisung.cpp,
-	  src/modules/grid/grid_calculus_bsl/auswert_zuweisung.h,
-	  src/modules/grid/grid_calculus_bsl/basistypen.cpp,
-	  src/modules/grid/grid_calculus_bsl/basistypen.h,
-	  src/modules/grid/grid_calculus_bsl/bedingung.cpp,
-	  src/modules/grid/grid_calculus_bsl/bedingung.h,
-	  src/modules/grid/grid_calculus_bsl/bsl_interpreter.cpp,
-	  src/modules/grid/grid_calculus_bsl/bsl_interpreter.h,
-	  src/modules/grid/grid_calculus_bsl/diverses.cpp,
-	  src/modules/grid/grid_calculus_bsl/diverses.h,
-	  src/modules/grid/grid_calculus_bsl/foreach.cpp,
-	  src/modules/grid/grid_calculus_bsl/foreach.h,
-	  src/modules/grid/grid_calculus_bsl/funktion.cpp,
-	  src/modules/grid/grid_calculus_bsl/funktion.h,
-	  src/modules/grid/grid_calculus_bsl/funktion_numerisch.h,
-	  src/modules/grid/grid_calculus_bsl/funktion_statistisch.h,
-	  src/modules/grid/grid_calculus_bsl/gr_def.h,
-	  src/modules/grid/grid_calculus_bsl/gr_syst.h,
-	  src/modules/grid/grid_calculus_bsl/grid_bsl.cpp,
-	  src/modules/grid/grid_calculus_bsl/grid_bsl.h,
-	  src/modules/grid/grid_calculus_bsl/interpolation.cpp,
-	  src/modules/grid/grid_calculus_bsl/interpolation.h,
-	  src/modules/grid/grid_calculus_bsl/pars_all.cpp,
-	  src/modules/grid/grid_calculus_bsl/pars_all.h,
-	  src/modules/grid/grid_calculus_bsl/vector.cpp,
-	  src/modules/grid/grid_calculus_bsl/vector.h,
-	  src/modules/grid/grid_calculus_bsl/zuweisung.cpp,
-	  src/modules/grid/grid_calculus_bsl/zuweisung.h,
-	  src/modules/grid/grid_filter/Filter.cpp,
-	  src/modules/grid/grid_filter/Filter.h,
-	  src/modules/grid/grid_filter/FilterClumps.cpp,
-	  src/modules/grid/grid_filter/FilterClumps.h,
-	  src/modules/grid/grid_filter/Filter_3x3.cpp,
-	  src/modules/grid/grid_filter/Filter_3x3.h,
-	  src/modules/grid/grid_filter/Filter_Gauss.cpp,
-	  src/modules/grid/grid_filter/Filter_Gauss.h,
-	  src/modules/grid/grid_filter/Filter_LoG.cpp,
-	  src/modules/grid/grid_filter/Filter_LoG.h,
-	  src/modules/grid/grid_filter/Filter_Majority.cpp,
-	  src/modules/grid/grid_filter/Filter_Majority.h,
-	  src/modules/grid/grid_filter/Filter_Morphology.cpp,
-	  src/modules/grid/grid_filter/Filter_Morphology.h,
-	  src/modules/grid/grid_filter/Filter_Multi_Dir_Lee.cpp,
-	  src/modules/grid/grid_filter/Filter_Multi_Dir_Lee.h,
-	  src/modules/grid/grid_filter/Filter_Rank.cpp,
-	  src/modules/grid/grid_filter/Filter_Rank.h,
-	  src/modules/grid/grid_filter/Filter_Terrain_SlopeBased.cpp,
-	  src/modules/grid/grid_filter/Filter_Terrain_SlopeBased.h,
-	  src/modules/grid/grid_filter/MLB_Interface.cpp,
-	  src/modules/grid/grid_filter/MLB_Interface.h,
-	  src/modules/grid/grid_filter/Pt.h,
-	  src/modules/grid/grid_gridding/Interpolation.cpp,
-	  src/modules/grid/grid_gridding/Interpolation.h,
-	  src/modules/grid/grid_gridding/Interpolation_InverseDistance.cpp,
-	  src/modules/grid/grid_gridding/Interpolation_InverseDistance.h,
-	  src/modules/grid/grid_gridding/Interpolation_NaturalNeighbour.cpp,
-	  src/modules/grid/grid_gridding/Interpolation_NaturalNeighbour.h,
-	  src/modules/grid/grid_gridding/Interpolation_NearestNeighbour.cpp,
-	  src/modules/grid/grid_gridding/Interpolation_NearestNeighbour.h,
-	  src/modules/grid/grid_gridding/Interpolation_Shepard.cpp,
-	  src/modules/grid/grid_gridding/Interpolation_Shepard.h,
-	  src/modules/grid/grid_gridding/Interpolation_Triangulation.cpp,
-	  src/modules/grid/grid_gridding/Interpolation_Triangulation.h,
-	  src/modules/grid/grid_gridding/MLB_Interface.cpp,
-	  src/modules/grid/grid_gridding/MLB_Interface.h,
-	  src/modules/grid/grid_gridding/Shapes2Grid.cpp,
-	  src/modules/grid/grid_gridding/Shapes2Grid.h,
-	  src/modules/grid/grid_gridding/Shepard.cpp,
-	  src/modules/grid/grid_gridding/Shepard.h,
-	  src/modules/grid/grid_gridding/kernel_density.cpp,
-	  src/modules/grid/grid_gridding/kernel_density.h,
-	  src/modules/grid/grid_gridding/nn/delaunay.c,
-	  src/modules/grid/grid_gridding/nn/delaunay.h,
-	  src/modules/grid/grid_gridding/nn/hash.c,
-	  src/modules/grid/grid_gridding/nn/hash.h,
-	  src/modules/grid/grid_gridding/nn/istack.c,
-	  src/modules/grid/grid_gridding/nn/istack.h,
-	  src/modules/grid/grid_gridding/nn/lpi.c,
-	  src/modules/grid/grid_gridding/nn/nan.h,
-	  src/modules/grid/grid_gridding/nn/nn.h,
-	  src/modules/grid/grid_gridding/nn/nnai.c,
-	  src/modules/grid/grid_gridding/nn/nncommon.c,
-	  src/modules/grid/grid_gridding/nn/nnpi.c,
-	  src/modules/grid/grid_gridding/nn/triangle.c,
-	  src/modules/grid/grid_gridding/nn/triangle.h,
-	  src/modules/grid/grid_gridding/nn/version.h,
-	  src/modules/grid/grid_spline/Gridding_Spline_BA.cpp,
-	  src/modules/grid/grid_spline/Gridding_Spline_BA.h,
-	  src/modules/grid/grid_spline/Gridding_Spline_Base.cpp,
-	  src/modules/grid/grid_spline/Gridding_Spline_Base.h,
-	  src/modules/grid/grid_spline/Gridding_Spline_CSA.cpp,
-	  src/modules/grid/grid_spline/Gridding_Spline_CSA.h,
-	  src/modules/grid/grid_spline/Gridding_Spline_MBA.cpp,
-	  src/modules/grid/grid_spline/Gridding_Spline_MBA.h,
-	  src/modules/grid/grid_spline/Gridding_Spline_MBA_Grid.cpp,
-	  src/modules/grid/grid_spline/Gridding_Spline_MBA_Grid.h,
-	  src/modules/grid/grid_spline/Gridding_Spline_TPS_Global.cpp,
-	  src/modules/grid/grid_spline/Gridding_Spline_TPS_Global.h,
-	  src/modules/grid/grid_spline/Gridding_Spline_TPS_Local.cpp,
-	  src/modules/grid/grid_spline/Gridding_Spline_TPS_Local.h,
-	  src/modules/grid/grid_spline/Gridding_Spline_TPS_TIN.cpp,
-	  src/modules/grid/grid_spline/Gridding_Spline_TPS_TIN.h,
-	  src/modules/grid/grid_spline/MLB_Interface.cpp,
-	  src/modules/grid/grid_spline/MLB_Interface.h,
-	  src/modules/grid/grid_spline/csa.c,
-	  src/modules/grid/grid_spline/csa.h,
-	  src/modules/grid/grid_tools/CreateGridSystem.cpp,
-	  src/modules/grid/grid_tools/CreateGridSystem.h,
-	  src/modules/grid/grid_tools/Grid_Aggregate.cpp,
-	  src/modules/grid/grid_tools/Grid_Aggregate.h,
-	  src/modules/grid/grid_tools/Grid_Buffer.cpp,
-	  src/modules/grid/grid_tools/Grid_Buffer.h,
-	  src/modules/grid/grid_tools/Grid_Buffer_Proximity.cpp,
-	  src/modules/grid/grid_tools/Grid_Buffer_Proximity.h,
-	  src/modules/grid/grid_tools/Grid_CombineGrids.cpp,
-	  src/modules/grid/grid_tools/Grid_CombineGrids.h,
-	  src/modules/grid/grid_tools/Grid_Completion.cpp,
-	  src/modules/grid/grid_tools/Grid_Completion.h,
-	  src/modules/grid/grid_tools/Grid_ConstantGrid.cpp,
-	  src/modules/grid/grid_tools/Grid_ConstantGrid.h,
-	  src/modules/grid/grid_tools/Grid_CropToData.cpp,
-	  src/modules/grid/grid_tools/Grid_CropToData.h,
-	  src/modules/grid/grid_tools/Grid_Cut.cpp,
-	  src/modules/grid/grid_tools/Grid_Cut.h,
-	  src/modules/grid/grid_tools/Grid_Fill.cpp,
-	  src/modules/grid/grid_tools/Grid_Fill.h,
-	  src/modules/grid/grid_tools/Grid_Gaps.cpp,
-	  src/modules/grid/grid_tools/Grid_Gaps.h,
-	  src/modules/grid/grid_tools/Grid_Gaps_OneCell.cpp,
-	  src/modules/grid/grid_tools/Grid_Gaps_OneCell.h,
-	  src/modules/grid/grid_tools/Grid_Gaps_Spline_Fill.cpp,
-	  src/modules/grid/grid_tools/Grid_Gaps_Spline_Fill.h,
-	  src/modules/grid/grid_tools/Grid_InvertNoData.cpp,
-	  src/modules/grid/grid_tools/Grid_InvertNoData.h,
-	  src/modules/grid/grid_tools/Grid_Mask.cpp,
-	  src/modules/grid/grid_tools/Grid_Mask.h,
-	  src/modules/grid/grid_tools/Grid_Merge.cpp,
-	  src/modules/grid/grid_tools/Grid_Merge.h,
-	  src/modules/grid/grid_tools/Grid_Orientation.cpp,
-	  src/modules/grid/grid_tools/Grid_Orientation.h,
-	  src/modules/grid/grid_tools/Grid_Proximity.cpp,
-	  src/modules/grid/grid_tools/Grid_Proximity.h,
-	  src/modules/grid/grid_tools/Grid_Resample.cpp,
-	  src/modules/grid/grid_tools/Grid_Resample.h,
-	  src/modules/grid/grid_tools/Grid_SortRaster.cpp,
-	  src/modules/grid/grid_tools/Grid_SortRaster.h,
-	  src/modules/grid/grid_tools/Grid_ThresholdBuffer.cpp,
-	  src/modules/grid/grid_tools/Grid_ThresholdBuffer.h,
-	  src/modules/grid/grid_tools/Grid_Tiling.cpp,
-	  src/modules/grid/grid_tools/Grid_Tiling.h,
-	  src/modules/grid/grid_tools/Grid_Value_Reclassify.cpp,
-	  src/modules/grid/grid_tools/Grid_Value_Reclassify.h,
-	  src/modules/grid/grid_tools/Grid_Value_Replace.cpp,
-	  src/modules/grid/grid_tools/Grid_Value_Replace.h,
-	  src/modules/grid/grid_tools/Grid_Value_Replace_Interactive.cpp,
-	  src/modules/grid/grid_tools/Grid_Value_Replace_Interactive.h,
-	  src/modules/grid/grid_tools/Grid_Value_Request.cpp,
-	  src/modules/grid/grid_tools/Grid_Value_Request.h,
-	  src/modules/grid/grid_tools/Grid_Value_Type.cpp,
-	  src/modules/grid/grid_tools/Grid_Value_Type.h,
-	  src/modules/grid/grid_tools/GridsFromTableAndGrid.cpp,
-	  src/modules/grid/grid_tools/GridsFromTableAndGrid.h,
-	  src/modules/grid/grid_tools/MLB_Interface.cpp,
-	  src/modules/grid/grid_tools/MLB_Interface.h,
-	  src/modules/grid/grid_tools/Pt.h,
-	  src/modules/grid/grid_visualisation/Grid_3D_Image.cpp,
-	  src/modules/grid/grid_visualisation/Grid_3D_Image.h,
-	  src/modules/grid/grid_visualisation/Grid_Color_Blend.cpp,
-	  src/modules/grid/grid_visualisation/Grid_Color_Blend.h,
-	  src/modules/grid/grid_visualisation/Grid_Color_Rotate.cpp,
-	  src/modules/grid/grid_visualisation/Grid_Color_Rotate.h,
-	  src/modules/grid/grid_visualisation/Grid_Color_Triangle.cpp,
-	  src/modules/grid/grid_visualisation/Grid_Color_Triangle.h,
-	  src/modules/grid/grid_visualisation/Grid_Colors_Fit.cpp,
-	  src/modules/grid/grid_visualisation/Grid_Colors_Fit.h,
-	  src/modules/grid/grid_visualisation/Grid_Histogram_Surface.cpp,
-	  src/modules/grid/grid_visualisation/Grid_Histogram_Surface.h,
-	  src/modules/grid/grid_visualisation/Grid_RGB_Composite.cpp,
-	  src/modules/grid/grid_visualisation/Grid_RGB_Composite.h,
-	  src/modules/grid/grid_visualisation/MLB_Interface.cpp,
-	  src/modules/grid/grid_visualisation/MLB_Interface.h,
-	  src/modules/pointcloud/pointcloud_tools/MLB_Interface.cpp,
-	  src/modules/pointcloud/pointcloud_tools/MLB_Interface.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_attribute_calculator.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_attribute_calculator.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_cluster_analysis.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_cluster_analysis.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_cut.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_cut.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_drop_attribute.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_drop_attribute.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_from_grid.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_from_grid.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_from_shapes.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_from_shapes.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_reclass_extract.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_reclass_extract.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_thinning_simple.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_thinning_simple.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_to_grid.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_to_grid.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_to_shapes.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_to_shapes.h,
-	  src/modules/pointcloud/pointcloud_tools/pc_transform.cpp,
-	  src/modules/pointcloud/pointcloud_tools/pc_transform.h,
-	  src/modules/pointcloud/pointcloud_viewer/MLB_Interface.cpp,
-	  src/modules/pointcloud/pointcloud_viewer/MLB_Interface.h,
-	  src/modules/pointcloud/pointcloud_viewer/points_view_control.cpp,
-	  src/modules/pointcloud/pointcloud_viewer/points_view_control.h,
-	  src/modules/pointcloud/pointcloud_viewer/points_view_dialog.cpp,
-	  src/modules/pointcloud/pointcloud_viewer/points_view_dialog.h,
-	  src/modules/pointcloud/pointcloud_viewer/points_view_extent.cpp,
-	  src/modules/pointcloud/pointcloud_viewer/points_view_extent.h,
-	  src/modules/pointcloud/pointcloud_viewer/points_view_module.cpp,
-	  src/modules/pointcloud/pointcloud_viewer/points_view_module.h,
-	  src/modules/shapes/shapes_grid/Grid_Classes_To_Shapes.cpp,
-	  src/modules/shapes/shapes_grid/Grid_Classes_To_Shapes.h,
-	  src/modules/shapes/shapes_grid/Grid_Polygon_Clip.cpp,
-	  src/modules/shapes/shapes_grid/Grid_Polygon_Clip.h,
-	  src/modules/shapes/shapes_grid/Grid_Statistics_AddTo_Polygon.cpp,
-	  src/modules/shapes/shapes_grid/Grid_Statistics_AddTo_Polygon.h,
-	  src/modules/shapes/shapes_grid/Grid_To_Contour.cpp,
-	  src/modules/shapes/shapes_grid/Grid_To_Contour.h,
-	  src/modules/shapes/shapes_grid/Grid_To_Gradient.cpp,
-	  src/modules/shapes/shapes_grid/Grid_To_Gradient.h,
-	  src/modules/shapes/shapes_grid/Grid_To_Points.cpp,
-	  src/modules/shapes/shapes_grid/Grid_To_Points.h,
-	  src/modules/shapes/shapes_grid/Grid_To_Points_Random.cpp,
-	  src/modules/shapes/shapes_grid/Grid_To_Points_Random.h,
-	  src/modules/shapes/shapes_grid/Grid_Values_AddTo_Points.cpp,
-	  src/modules/shapes/shapes_grid/Grid_Values_AddTo_Points.h,
-	  src/modules/shapes/shapes_grid/Grid_Values_AddTo_Shapes.cpp,
-	  src/modules/shapes/shapes_grid/Grid_Values_AddTo_Shapes.h,
-	  src/modules/shapes/shapes_grid/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_grid/MLB_Interface.h,
-	  src/modules/shapes/shapes_grid/grid_local_extremes_to_points.cpp,
-	  src/modules/shapes/shapes_grid/grid_local_extremes_to_points.h,
-	  src/modules/shapes/shapes_lines/Lines_From_Points.cpp,
-	  src/modules/shapes/shapes_lines/Lines_From_Points.h,
-	  src/modules/shapes/shapes_lines/Lines_From_Polygons.cpp,
-	  src/modules/shapes/shapes_lines/Lines_From_Polygons.h,
-	  src/modules/shapes/shapes_lines/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_lines/MLB_Interface.h,
-	  src/modules/shapes/shapes_lines/line_dissolve.cpp,
-	  src/modules/shapes/shapes_lines/line_dissolve.h,
-	  src/modules/shapes/shapes_lines/line_polygon_intersection.cpp,
-	  src/modules/shapes/shapes_lines/line_polygon_intersection.h,
-	  src/modules/shapes/shapes_lines/line_properties.cpp,
-	  src/modules/shapes/shapes_lines/line_properties.h,
-	  src/modules/shapes/shapes_lines/line_simplification.cpp,
-	  src/modules/shapes/shapes_lines/line_simplification.h,
-	  src/modules/shapes/shapes_lines_ex/Containers.h,
-	  src/modules/shapes/shapes_lines_ex/DPHull.h,
-	  src/modules/shapes/shapes_lines_ex/LineApproximator.h,
-	  src/modules/shapes/shapes_lines_ex/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_lines_ex/MLB_Interface.h,
-	  src/modules/shapes/shapes_lines_ex/PathHull.h,
-	  src/modules/shapes/shapes_lines_ex/SimplifyShapes.cpp,
-	  src/modules/shapes/shapes_lines_ex/SimplifyShapes.h,
-	  src/modules/shapes/shapes_points/AddCoordinates.cpp,
-	  src/modules/shapes/shapes_points/AddCoordinates.h,
-	  src/modules/shapes/shapes_points/Clip_Points.cpp,
-	  src/modules/shapes/shapes_points/Clip_Points.h,
-	  src/modules/shapes/shapes_points/CountPoints.cpp,
-	  src/modules/shapes/shapes_points/CountPoints.h,
-	  src/modules/shapes/shapes_points/CreatePointGrid.cpp,
-	  src/modules/shapes/shapes_points/CreatePointGrid.h,
-	  src/modules/shapes/shapes_points/DistanceMatrix.cpp,
-	  src/modules/shapes/shapes_points/DistanceMatrix.h,
-	  src/modules/shapes/shapes_points/FitNPointsToShape.cpp,
-	  src/modules/shapes/shapes_points/FitNPointsToShape.h,
-	  src/modules/shapes/shapes_points/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_points/MLB_Interface.h,
-	  src/modules/shapes/shapes_points/Points_From_Lines.cpp,
-	  src/modules/shapes/shapes_points/Points_From_Lines.h,
-	  src/modules/shapes/shapes_points/Points_From_Table.cpp,
-	  src/modules/shapes/shapes_points/Points_From_Table.h,
-	  src/modules/shapes/shapes_points/add_polygon_attributes.cpp,
-	  src/modules/shapes/shapes_points/add_polygon_attributes.h,
-	  src/modules/shapes/shapes_points/remove_duplicates.cpp,
-	  src/modules/shapes/shapes_points/remove_duplicates.h,
-	  src/modules/shapes/shapes_points/separate_by_direction.cpp,
-	  src/modules/shapes/shapes_points/separate_by_direction.h,
-	  src/modules/shapes/shapes_polygons/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_polygons/MLB_Interface.h,
-	  src/modules/shapes/shapes_polygons/Polygon_Centroids.cpp,
-	  src/modules/shapes/shapes_polygons/Polygon_Centroids.h,
-	  src/modules/shapes/shapes_polygons/Polygon_Clipper.cpp,
-	  src/modules/shapes/shapes_polygons/Polygon_Clipper.h,
-	  src/modules/shapes/shapes_polygons/Polygon_Geometrics.cpp,
-	  src/modules/shapes/shapes_polygons/Polygon_Geometrics.h,
-	  src/modules/shapes/shapes_polygons/Polygon_Intersection.cpp,
-	  src/modules/shapes/shapes_polygons/Polygon_Intersection.h,
-	  src/modules/shapes/shapes_polygons/Polygon_StatisticsFromPoints.cpp,
-	  src/modules/shapes/shapes_polygons/Polygon_StatisticsFromPoints.h,
-	  src/modules/shapes/shapes_polygons/Polygon_Union.cpp,
-	  src/modules/shapes/shapes_polygons/Polygon_Union.h,
-	  src/modules/shapes/shapes_polygons/Polygons_From_Lines.cpp,
-	  src/modules/shapes/shapes_polygons/Polygons_From_Lines.h,
-	  src/modules/shapes/shapes_polygons/polygon_to_points.cpp,
-	  src/modules/shapes/shapes_polygons/polygon_to_points.h,
-	  src/modules/shapes/shapes_polygons/shape_index.cpp,
-	  src/modules/shapes/shapes_polygons/shape_index.h,
-	  src/modules/shapes/shapes_tools/CreateChartLayer.cpp,
-	  src/modules/shapes/shapes_tools/CreateChartLayer.h,
-	  src/modules/shapes/shapes_tools/GraticuleBuilder.cpp,
-	  src/modules/shapes/shapes_tools/GraticuleBuilder.h,
-	  src/modules/shapes/shapes_tools/JoinTables.cpp,
-	  src/modules/shapes/shapes_tools/JoinTables.h,
-	  src/modules/shapes/shapes_tools/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_tools/MLB_Interface.h,
-	  src/modules/shapes/shapes_tools/NewLayerFromSelectedShapes.cpp,
-	  src/modules/shapes/shapes_tools/NewLayerFromSelectedShapes.h,
-	  src/modules/shapes/shapes_tools/Polygon_Clipper.cpp,
-	  src/modules/shapes/shapes_tools/Polygon_Clipper.h,
-	  src/modules/shapes/shapes_tools/QueryBuilder.cpp,
-	  src/modules/shapes/shapes_tools/QueryBuilder.h,
-	  src/modules/shapes/shapes_tools/QueryParser.cpp,
-	  src/modules/shapes/shapes_tools/QueryParser.h,
-	  src/modules/shapes/shapes_tools/SearchInTable.cpp,
-	  src/modules/shapes/shapes_tools/SearchInTable.h,
-	  src/modules/shapes/shapes_tools/SelectByTheme.cpp,
-	  src/modules/shapes/shapes_tools/SelectByTheme.h,
-	  src/modules/shapes/shapes_tools/SeparateShapes.cpp,
-	  src/modules/shapes/shapes_tools/SeparateShapes.h,
-	  src/modules/shapes/shapes_tools/Shapes_Assign_Table.cpp,
-	  src/modules/shapes/shapes_tools/Shapes_Assign_Table.h,
-	  src/modules/shapes/shapes_tools/Shapes_Create_Empty.cpp,
-	  src/modules/shapes/shapes_tools/Shapes_Create_Empty.h,
-	  src/modules/shapes/shapes_tools/Shapes_Merge.cpp,
-	  src/modules/shapes/shapes_tools/Shapes_Merge.h,
-	  src/modules/shapes/shapes_tools/TransformShapes.cpp,
-	  src/modules/shapes/shapes_tools/TransformShapes.h,
-	  src/modules/shapes/shapes_tools/quadtree_structure.cpp,
-	  src/modules/shapes/shapes_tools/quadtree_structure.h,
-	  src/modules/shapes/shapes_tools/shapes_buffer.cpp,
-	  src/modules/shapes/shapes_tools/shapes_buffer.h,
-	  src/modules/shapes/shapes_tools/shapes_cut.cpp,
-	  src/modules/shapes/shapes_tools/shapes_cut.h,
-	  src/modules/shapes/shapes_tools/shapes_cut_interactive.cpp,
-	  src/modules/shapes/shapes_tools/shapes_cut_interactive.h,
-	  src/modules/shapes/shapes_tools/shapes_extents.cpp,
-	  src/modules/shapes/shapes_tools/shapes_extents.h,
-	  src/modules/shapes/shapes_tools/shapes_split.cpp,
-	  src/modules/shapes/shapes_tools/shapes_split.h,
-	  src/modules/shapes/shapes_tools/shapes_split_by_attribute.cpp,
-	  src/modules/shapes/shapes_tools/shapes_split_by_attribute.h,
-	  src/modules/shapes/shapes_tools/shapes_split_randomly.cpp,
-	  src/modules/shapes/shapes_tools/shapes_split_randomly.h,
-	  src/modules/shapes/shapes_transect/MLB_Interface.cpp,
-	  src/modules/shapes/shapes_transect/MLB_Interface.h,
-	  src/modules/shapes/shapes_transect/Polygon_Transect.cpp,
-	  src/modules/shapes/shapes_transect/Polygon_Transect.h,
-	  src/modules/table/table_calculus/Fit.cpp,
-	  src/modules/table/table_calculus/Fit.h,
-	  src/modules/table/table_calculus/LMFit.cpp,
-	  src/modules/table/table_calculus/LMFit.h,
-	  src/modules/table/table_calculus/MLB_Interface.cpp,
-	  src/modules/table/table_calculus/MLB_Interface.h,
-	  src/modules/table/table_calculus/Table_Calculator.cpp,
-	  src/modules/table/table_calculus/Table_Calculator.h,
-	  src/modules/table/table_calculus/Table_CalculatorShapes.cpp,
-	  src/modules/table/table_calculus/Table_CalculatorShapes.h,
-	  src/modules/table/table_calculus/Table_Trend.cpp,
-	  src/modules/table/table_calculus/Table_Trend.h,
-	  src/modules/table/table_calculus/table_cluster_analysis.cpp,
-	  src/modules/table/table_calculus/table_cluster_analysis.h,
-	  src/modules/table/table_calculus/table_pca.cpp,
-	  src/modules/table/table_calculus/table_pca.h,
-	  src/modules/table/table_calculus/table_running_average.cpp,
-	  src/modules/table/table_calculus/table_running_average.h,
-	  src/modules/table/table_tools/MLB_Interface.cpp,
-	  src/modules/table/table_tools/MLB_Interface.h,
-	  src/modules/table/table_tools/Table_Create_Empty.cpp,
-	  src/modules/table/table_tools/Table_Create_Empty.h,
-	  src/modules/table/table_tools/Table_Enumerate.cpp,
-	  src/modules/table/table_tools/Table_Enumerate.h,
-	  src/modules/table/table_tools/Table_Rotate.cpp,
-	  src/modules/table/table_tools/Table_Rotate.h,
-	  src/modules/tin/tin_tools/MLB_Interface.cpp,
-	  src/modules/tin/tin_tools/MLB_Interface.h,
-	  src/modules/tin/tin_tools/TIN_Flow_Parallel.cpp,
-	  src/modules/tin/tin_tools/TIN_Flow_Parallel.h,
-	  src/modules/tin/tin_tools/TIN_Flow_Trace.cpp,
-	  src/modules/tin/tin_tools/TIN_Flow_Trace.h,
-	  src/modules/tin/tin_tools/TIN_From_Grid.cpp,
-	  src/modules/tin/tin_tools/TIN_From_Grid.h,
-	  src/modules/tin/tin_tools/TIN_From_Grid_Specific_Points.cpp,
-	  src/modules/tin/tin_tools/TIN_From_Grid_Specific_Points.h,
-	  src/modules/tin/tin_tools/TIN_From_Shapes.cpp,
-	  src/modules/tin/tin_tools/TIN_From_Shapes.h,
-	  src/modules/tin/tin_tools/TIN_Gradient.cpp,
-	  src/modules/tin/tin_tools/TIN_Gradient.h,
-	  src/modules/tin/tin_tools/TIN_To_Shapes.cpp,
-	  src/modules/tin/tin_tools/TIN_To_Shapes.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/A1WiTh.cpp,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/A1WiTh.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/A2WiTh.cpp,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/A2WiTh.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/A3WiTh.cpp,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/A3WiTh.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/AvWiMa1.cpp,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/AvWiMa1.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/AvWiMa2.cpp,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/AvWiMa2.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/MLB_Interface.cpp,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/MLB_Interface.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/destriping1.cpp,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/destriping1.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/destriping2.cpp,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/destriping2.h,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/directional1.cpp,
-	  src/modules_contrib/contrib_a_perego/contrib_a_perego/directional1.h,
-	  src/modules_contrib/contrib_s_liersch/ihacres/MLB_Interface.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/MLB_Interface.h,
-	  src/modules_contrib/contrib_s_liersch/ihacres/convert_sl.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/convert_sl.h,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_basin.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_basin.h,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_cal2.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_cal2.h,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_elev.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_elev.h,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_elev_bands.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_elev_bands.h,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_elev_cal.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_elev_cal.h,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_eq.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_eq.h,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_v1.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/ihacres_v1.h,
-	  src/modules_contrib/contrib_s_liersch/ihacres/model_tools.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/model_tools.h,
-	  src/modules_contrib/contrib_s_liersch/ihacres/snow_module.cpp,
-	  src/modules_contrib/contrib_s_liersch/ihacres/snow_module.h,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/CompleteLinkage.cpp,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/CompleteLinkage.h,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/DebugStream.cpp,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/DebugStream.h,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/GridCalcError.cpp,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/GridCalcError.h,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/MLB_Interface.cpp,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/MLB_Interface.h,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/NoDataValueError.cpp,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/NoDataValueError.h,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/Profiler.cpp,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/Profiler.h,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/rgbOverlay.cpp,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/rgbOverlay.h,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/tomaschTool.cpp,
-	  src/modules_contrib/contrib_t_wutzler/contrib_t_wutzler/tomaschTool.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Directional_Statistics.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Directional_Statistics.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Residuals.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Residuals.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Statistics.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Statistics.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Variance.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Variance.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Variance_Radius.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Variance_Radius.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Zonal_Statistics.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/GSGrid_Zonal_Statistics.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/MLB_Interface.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/MLB_Interface.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/fast_representativeness.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/fast_representativeness.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/grid_autocorrelation.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/grid_autocorrelation.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/grid_pca.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/grid_pca.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/multiband_variation.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_grid/multiband_variation.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/MLB_Interface.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/MLB_Interface.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/_kriging_base.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/_kriging_base.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/_kriging_ordinary.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/_kriging_ordinary.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/_kriging_ordinary_global.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/_kriging_ordinary_global.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/_kriging_universal.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/_kriging_universal.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/_kriging_universal_global.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/_kriging_universal_global.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_base.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_base.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_ordinary.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_ordinary.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_ordinary_global.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_ordinary_global.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_universal.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_universal.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_universal_global.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/kriging_universal_global.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/semivariogram.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/semivariogram.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/variogram_dialog.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_kriging/variogram_dialog.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/GSPoints_Distances.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/GSPoints_Distances.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/GSPoints_Pattern_Analysis.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/GSPoints_Pattern_Analysis.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/GSPoints_Semi_Variances.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/GSPoints_Semi_Variances.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/GSPoints_Variogram_Cloud.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/GSPoints_Variogram_Cloud.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/GSPoints_Variogram_Surface.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/GSPoints_Variogram_Surface.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/MLB_Interface.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_points/MLB_Interface.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/MLB_Interface.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/MLB_Interface.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/gw_multi_regression.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/gw_multi_regression.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/gw_multi_regression_grid.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/gw_multi_regression_grid.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/gw_regression.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/gw_regression.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/gw_regression_grid.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/gw_regression_grid.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/point_grid_regression.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/point_grid_regression.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/point_multi_grid_regression.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/point_multi_grid_regression.h,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/point_trend_surface.cpp,
-	  src/modules_geostatistics/geostatistics/geostatistics_regression/point_trend_surface.h,
-	  src/modules_images/modules_imagery/imagery_classification/MLB_Interface.cpp,
-	  src/modules_images/modules_imagery/imagery_classification/MLB_Interface.h,
-	  src/modules_images/modules_imagery/imagery_classification/change_detection.cpp,
-	  src/modules_images/modules_imagery/imagery_classification/change_detection.h,
-	  src/modules_images/modules_imagery/imagery_classification/classify_cluster_analysis.cpp,
-	  src/modules_images/modules_imagery/imagery_classification/classify_cluster_analysis.h,
-	  src/modules_images/modules_imagery/imagery_classification/classify_supervised.cpp,
-	  src/modules_images/modules_imagery/imagery_classification/classify_supervised.h,
-	  src/modules_images/modules_imagery/imagery_rga/MLB_Interface.cpp,
-	  src/modules_images/modules_imagery/imagery_rga/MLB_Interface.h,
-	  src/modules_images/modules_imagery/imagery_rga/fast_region_growing.cpp,
-	  src/modules_images/modules_imagery/imagery_rga/fast_region_growing.h,
-	  src/modules_images/modules_imagery/imagery_segmentation/MLB_Interface.cpp,
-	  src/modules_images/modules_imagery/imagery_segmentation/MLB_Interface.h,
-	  src/modules_images/modules_imagery/imagery_segmentation/grid_seeds.cpp,
-	  src/modules_images/modules_imagery/imagery_segmentation/grid_seeds.h,
-	  src/modules_images/modules_imagery/imagery_segmentation/rga_basic.cpp,
-	  src/modules_images/modules_imagery/imagery_segmentation/rga_basic.h,
-	  src/modules_images/modules_imagery/imagery_segmentation/skeletonization.cpp,
-	  src/modules_images/modules_imagery/imagery_segmentation/skeletonization.h,
-	  src/modules_images/modules_imagery/imagery_segmentation/watershed_segmentation.cpp,
-	  src/modules_images/modules_imagery/imagery_segmentation/watershed_segmentation.h,
-	  src/modules_images/modules_imagery/imagery_tools/Image_VI_Distance.cpp,
-	  src/modules_images/modules_imagery/imagery_tools/Image_VI_Distance.h,
-	  src/modules_images/modules_imagery/imagery_tools/Image_VI_Slope.cpp,
-	  src/modules_images/modules_imagery/imagery_tools/Image_VI_Slope.h,
-	  src/modules_images/modules_imagery/imagery_tools/MLB_Interface.cpp,
-	  src/modules_images/modules_imagery/imagery_tools/MLB_Interface.h,
-	  src/modules_images/modules_opencv/opencv/MLB_Interface.cpp,
-	  src/modules_images/modules_opencv/opencv/MLB_Interface.h,
-	  src/modules_images/modules_opencv/opencv/opencv.cpp,
-	  src/modules_images/modules_opencv/opencv/opencv.h,
-	  src/modules_images/modules_opencv/opencv/opencv_fourier.cpp,
-	  src/modules_images/modules_opencv/opencv/opencv_fourier.h,
-	  src/modules_images/modules_opencv/opencv/opencv_morphology.cpp,
-	  src/modules_images/modules_opencv/opencv/opencv_morphology.h,
-	  src/modules_images/modules_opencv/opencv/opencv_svd.cpp,
-	  src/modules_images/modules_opencv/opencv/opencv_svd.h,
-	  src/modules_images/modules_vigra/vigra/MLB_Interface.cpp,
-	  src/modules_images/modules_vigra/vigra/MLB_Interface.h,
-	  src/modules_images/modules_vigra/vigra/vigra.cpp,
-	  src/modules_images/modules_vigra/vigra/vigra.h,
-	  src/modules_images/modules_vigra/vigra/vigra_distance.cpp,
-	  src/modules_images/modules_vigra/vigra/vigra_distance.h,
-	  src/modules_images/modules_vigra/vigra/vigra_edges.cpp,
-	  src/modules_images/modules_vigra/vigra/vigra_edges.h,
-	  src/modules_images/modules_vigra/vigra/vigra_fft.cpp,
-	  src/modules_images/modules_vigra/vigra/vigra_fft.h,
-	  src/modules_images/modules_vigra/vigra/vigra_morphology.cpp,
-	  src/modules_images/modules_vigra/vigra/vigra_morphology.h,
-	  src/modules_images/modules_vigra/vigra/vigra_smoothing.cpp,
-	  src/modules_images/modules_vigra/vigra/vigra_smoothing.h,
-	  src/modules_images/modules_vigra/vigra/vigra_watershed.cpp,
-	  src/modules_images/modules_vigra/vigra/vigra_watershed.h,
-	  src/modules_io/db/io_db_mysql/Get_Table.cpp,
-	  src/modules_io/db/io_db_mysql/Get_Table.h,
-	  src/modules_io/db/io_db_mysql/MLB_Interface.cpp,
-	  src/modules_io/db/io_db_mysql/MLB_Interface.h,
-	  src/modules_io/db/io_odbc/MLB_Interface.cpp,
-	  src/modules_io/db/io_odbc/MLB_Interface.h,
-	  src/modules_io/db/io_odbc/get_connection.cpp,
-	  src/modules_io/db/io_odbc/get_connection.h,
-	  src/modules_io/db/io_odbc/pgis_shapes.cpp,
-	  src/modules_io/db/io_odbc/pgis_shapes.h,
-	  src/modules_io/db/io_odbc/shapes.cpp,
-	  src/modules_io/db/io_odbc/shapes.h,
-	  src/modules_io/db/io_odbc/table.cpp,
-	  src/modules_io/db/io_odbc/table.h,
-	  src/modules_io/docs/docs_html/CreateWebContent.cpp,
-	  src/modules_io/docs/docs_html/CreateWebContent.h,
-	  src/modules_io/docs/docs_html/MLB_Interface.cpp,
-	  src/modules_io/docs/docs_html/MLB_Interface.h,
-	  src/modules_io/docs/docs_html/doc_html.cpp,
-	  src/modules_io/docs/docs_html/doc_html.h,
-	  src/modules_io/docs/docs_html/doc_svg.cpp,
-	  src/modules_io/docs/docs_html/doc_svg.h,
-	  src/modules_io/docs/docs_html/svg_interactive_map.cpp,
-	  src/modules_io/docs/docs_html/svg_interactive_map.h,
-	  src/modules_io/docs/docs_pdf/MLB_Interface.cpp,
-	  src/modules_io/docs/docs_pdf/MLB_Interface.h,
-	  src/modules_io/docs/docs_pdf/Polygon_Clipper.cpp,
-	  src/modules_io/docs/docs_pdf/Polygon_Clipper.h,
-	  src/modules_io/docs/docs_pdf/Profile_Cross_Sections.cpp,
-	  src/modules_io/docs/docs_pdf/Profile_Cross_Sections.h,
-	  src/modules_io/docs/docs_pdf/Shapes_Report.cpp,
-	  src/modules_io/docs/docs_pdf/Shapes_Report.h,
-	  src/modules_io/docs/docs_pdf/Shapes_Summary.cpp,
-	  src/modules_io/docs/docs_pdf/Shapes_Summary.h,
-	  src/modules_io/docs/docs_pdf/doc_pdf.cpp,
-	  src/modules_io/docs/docs_pdf/doc_pdf.h,
-	  src/modules_io/esri_e00/io_esri_e00/ESRI_E00_Import.cpp,
-	  src/modules_io/esri_e00/io_esri_e00/ESRI_E00_Import.h,
-	  src/modules_io/esri_e00/io_esri_e00/MLB_Interface.cpp,
-	  src/modules_io/esri_e00/io_esri_e00/MLB_Interface.h,
-	  src/modules_io/esri_e00/io_esri_e00/e00compr/cpl_conv.c,
-	  src/modules_io/esri_e00/io_esri_e00/e00compr/cpl_conv.h,
-	  src/modules_io/esri_e00/io_esri_e00/e00compr/cpl_error.c,
-	  src/modules_io/esri_e00/io_esri_e00/e00compr/cpl_error.h,
-	  src/modules_io/esri_e00/io_esri_e00/e00compr/cpl_port.h,
-	  src/modules_io/esri_e00/io_esri_e00/e00compr/cpl_vsi.h,
-	  src/modules_io/esri_e00/io_esri_e00/e00compr/cpl_vsisimple.c,
-	  src/modules_io/esri_e00/io_esri_e00/e00compr/e00compr.h,
-	  src/modules_io/esri_e00/io_esri_e00/e00compr/e00read.c,
-	  src/modules_io/esri_e00/io_esri_e00/e00compr/e00write.c,
-	  src/modules_io/gdal/io_gdal/MLB_Interface.cpp,
-	  src/modules_io/gdal/io_gdal/MLB_Interface.h,
-	  src/modules_io/gdal/io_gdal/gdal_driver.cpp,
-	  src/modules_io/gdal/io_gdal/gdal_driver.h,
-	  src/modules_io/gdal/io_gdal/gdal_export.cpp,
-	  src/modules_io/gdal/io_gdal/gdal_export.h,
-	  src/modules_io/gdal/io_gdal/gdal_export_geotiff.cpp,
-	  src/modules_io/gdal/io_gdal/gdal_export_geotiff.h,
-	  src/modules_io/gdal/io_gdal/gdal_import.cpp,
-	  src/modules_io/gdal/io_gdal/gdal_import.h,
-	  src/modules_io/gdal/io_gdal/ogr_driver.cpp,
-	  src/modules_io/gdal/io_gdal/ogr_driver.h,
-	  src/modules_io/gdal/io_gdal/ogr_export.cpp,
-	  src/modules_io/gdal/io_gdal/ogr_export.h,
-	  src/modules_io/gdal/io_gdal/ogr_import.cpp,
-	  src/modules_io/gdal/io_gdal/ogr_import.h,
-	  src/modules_io/gps/io_gps/GPSBabel.cpp,
-	  src/modules_io/gps/io_gps/GPSBabel.h,
-	  src/modules_io/gps/io_gps/MLB_Interface.cpp,
-	  src/modules_io/gps/io_gps/MLB_Interface.h,
-	  src/modules_io/gps/io_gps/gpx2shp.cpp,
-	  src/modules_io/gps/io_gps/gpx2shp.h,
-	  src/modules_io/grid/io_grid/MLB_Interface.cpp,
-	  src/modules_io/grid/io_grid/MLB_Interface.h,
-	  src/modules_io/grid/io_grid/bmp_export.cpp,
-	  src/modules_io/grid/io_grid/bmp_export.h,
-	  src/modules_io/grid/io_grid/erdas_lan.cpp,
-	  src/modules_io/grid/io_grid/erdas_lan.h,
-	  src/modules_io/grid/io_grid/esri_arcinfo.cpp,
-	  src/modules_io/grid/io_grid/esri_arcinfo.h,
-	  src/modules_io/grid/io_grid/grid_table.cpp,
-	  src/modules_io/grid/io_grid/grid_table.h,
-	  src/modules_io/grid/io_grid/mola.cpp,
-	  src/modules_io/grid/io_grid/mola.h,
-	  src/modules_io/grid/io_grid/raw.cpp,
-	  src/modules_io/grid/io_grid/raw.h,
-	  src/modules_io/grid/io_grid/srtm30.cpp,
-	  src/modules_io/grid/io_grid/srtm30.h,
-	  src/modules_io/grid/io_grid/surfer.cpp,
-	  src/modules_io/grid/io_grid/surfer.h,
-	  src/modules_io/grid/io_grid/usgs_srtm.cpp,
-	  src/modules_io/grid/io_grid/usgs_srtm.h,
-	  src/modules_io/grid/io_grid/xyz.cpp,
-	  src/modules_io/grid/io_grid/xyz.h,
-	  src/modules_io/grid/io_grid_grib2/MLB_Interface.cpp,
-	  src/modules_io/grid/io_grid_grib2/MLB_Interface.h,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/cmplxpack.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/compack.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/comunpack.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/dec_jpeg2000.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/dec_png.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/drstemplates.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/drstemplates.h,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/enc_jpeg2000.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/enc_png.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_addfield.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_addgrid.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_addlocal.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_create.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_free.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_getfld.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_gribend.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_info.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_miss.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_unpack1.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_unpack2.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_unpack3.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_unpack4.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_unpack5.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_unpack6.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/g2_unpack7.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/gbits.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/getdim.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/getpoly.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/grib2.h,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/gridtemplates.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/gridtemplates.h,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/int_power.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/jpcpack.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/jpcunpack.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/misspack.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/mkieee.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/pack_gp.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/pdstemplates.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/pdstemplates.h,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/pngpack.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/pngunpack.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/rdieee.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/reduce.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/seekgb.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/simpack.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/simunpack.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/specpack.c,
-	  src/modules_io/grid/io_grid_grib2/g2clib-1.0.4/specunpack.c,
-	  src/modules_io/grid/io_grid_grib2/grib2_import.cpp,
-	  src/modules_io/grid/io_grid_grib2/grib2_import.h,
-	  src/modules_io/grid/io_grid_image/MLB_Interface.cpp,
-	  src/modules_io/grid/io_grid_image/MLB_Interface.h,
-	  src/modules_io/grid/io_grid_image/grid_export.cpp,
-	  src/modules_io/grid/io_grid_image/grid_export.h,
-	  src/modules_io/grid/io_grid_image/grid_import.cpp,
-	  src/modules_io/grid/io_grid_image/grid_import.h,
-	  src/modules_io/shapes/io_shapes/MLB_Interface.cpp,
-	  src/modules_io/shapes/io_shapes/MLB_Interface.h,
-	  src/modules_io/shapes/io_shapes/atlas_bna.cpp,
-	  src/modules_io/shapes/io_shapes/atlas_bna.h,
-	  src/modules_io/shapes/io_shapes/generate.cpp,
-	  src/modules_io/shapes/io_shapes/generate.h,
-	  src/modules_io/shapes/io_shapes/gpx.cpp,
-	  src/modules_io/shapes/io_shapes/gpx.h,
-	  src/modules_io/shapes/io_shapes/gstat.cpp,
-	  src/modules_io/shapes/io_shapes/gstat.h,
-	  src/modules_io/shapes/io_shapes/pointcloud_from_file.cpp,
-	  src/modules_io/shapes/io_shapes/pointcloud_from_file.h,
-	  src/modules_io/shapes/io_shapes/pointcloud_from_text_file.cpp,
-	  src/modules_io/shapes/io_shapes/pointcloud_from_text_file.h,
-	  src/modules_io/shapes/io_shapes/stl.cpp,
-	  src/modules_io/shapes/io_shapes/stl.h,
-	  src/modules_io/shapes/io_shapes/surfer_bln.cpp,
-	  src/modules_io/shapes/io_shapes/surfer_bln.h,
-	  src/modules_io/shapes/io_shapes/svg.cpp,
-	  src/modules_io/shapes/io_shapes/svg.h,
-	  src/modules_io/shapes/io_shapes/wasp_map.cpp,
-	  src/modules_io/shapes/io_shapes/wasp_map.h,
-	  src/modules_io/shapes/io_shapes/xyz.cpp,
-	  src/modules_io/shapes/io_shapes/xyz.h,
-	  src/modules_io/shapes/io_shapes_dxf/MLB_Interface.cpp,
-	  src/modules_io/shapes/io_shapes_dxf/MLB_Interface.h,
-	  src/modules_io/shapes/io_shapes_dxf/dxf_import.cpp,
-	  src/modules_io/shapes/io_shapes_dxf/dxf_import.h,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_attributes.h,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_codes.h,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_creationadapter.h,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_creationinterface.h,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_dxf.cpp,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_dxf.h,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_entities.h,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_exception.h,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_extrusion.h,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_writer.h,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_writer_ascii.cpp,
-	  src/modules_io/shapes/io_shapes_dxf/dxflib/dl_writer_ascii.h,
-	  src/modules_io/shapes/io_shapes_las/MLB_Interface.cpp,
-	  src/modules_io/shapes/io_shapes_las/MLB_Interface.h,
-	  src/modules_io/shapes/io_shapes_las/las_export.cpp,
-	  src/modules_io/shapes/io_shapes_las/las_export.h,
-	  src/modules_io/shapes/io_shapes_las/las_import.cpp,
-	  src/modules_io/shapes/io_shapes_las/las_import.h,
-	  src/modules_io/shapes/io_shapes_las/las_info.cpp,
-	  src/modules_io/shapes/io_shapes_las/las_info.h,
-	  src/modules_io/table/io_table/MLB_Interface.cpp,
-	  src/modules_io/table/io_table/MLB_Interface.h,
-	  src/modules_io/table/io_table/io_table_txt.cpp,
-	  src/modules_io/table/io_table/io_table_txt.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_01.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_01.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_02.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_02.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_03.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_03.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_04.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_04.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_05.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_05.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_06.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_06.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_07.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_07.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_08.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_08.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_09.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_09.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_10.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_10.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_11.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_11.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_12.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_12.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_13.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_13.h,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_14.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/Exercise_14.h,
-	  src/modules_lectures/lectures/lectures_introduction/MLB_Interface.cpp,
-	  src/modules_lectures/lectures/lectures_introduction/MLB_Interface.h,
-	  src/modules_projection/pj_georeference/pj_georeference/Collect_Points.cpp,
-	  src/modules_projection/pj_georeference/pj_georeference/Collect_Points.h,
-	  src/modules_projection/pj_georeference/pj_georeference/Georef_Engine.cpp,
-	  src/modules_projection/pj_georeference/pj_georeference/Georef_Engine.h,
-	  src/modules_projection/pj_georeference/pj_georeference/Georef_Grid.cpp,
-	  src/modules_projection/pj_georeference/pj_georeference/Georef_Grid.h,
-	  src/modules_projection/pj_georeference/pj_georeference/Georef_Shapes.cpp,
-	  src/modules_projection/pj_georeference/pj_georeference/Georef_Shapes.h,
-	  src/modules_projection/pj_georeference/pj_georeference/MLB_Interface.cpp,
-	  src/modules_projection/pj_georeference/pj_georeference/MLB_Interface.h,
-	  src/modules_projection/pj_georeference/pj_georeference/cminpak.h,
-	  src/modules_projection/pj_georeference/pj_georeference/dpmpar.h,
-	  src/modules_projection/pj_georeference/pj_georeference/enorm.c,
-	  src/modules_projection/pj_georeference/pj_georeference/fdjac2.c,
-	  src/modules_projection/pj_georeference/pj_georeference/georef_grid_move.cpp,
-	  src/modules_projection/pj_georeference/pj_georeference/georef_grid_move.h,
-	  src/modules_projection/pj_georeference/pj_georeference/lmdif.c,
-	  src/modules_projection/pj_georeference/pj_georeference/lmdif0.c,
-	  src/modules_projection/pj_georeference/pj_georeference/lmpar.c,
-	  src/modules_projection/pj_georeference/pj_georeference/qrfac.c,
-	  src/modules_projection/pj_georeference/pj_georeference/qrsolv.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/GEOTRANS_Base.cpp,
-	  src/modules_projection/pj_geotrans/pj_geotrans/GEOTRANS_Base.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/GEOTRANS_Grid.cpp,
-	  src/modules_projection/pj_geotrans/pj_geotrans/GEOTRANS_Grid.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/GEOTRANS_Shapes.cpp,
-	  src/modules_projection/pj_geotrans/pj_geotrans/GEOTRANS_Shapes.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/MLB_Interface.cpp,
-	  src/modules_projection/pj_geotrans/pj_geotrans/MLB_Interface.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/albers.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/albers.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/azeq.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/azeq.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/bng.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/bng.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/bonne.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/bonne.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/cassini.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/cassini.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/cyleqa.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/cyleqa.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/datum.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/datum.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/eckert4.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/eckert4.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/eckert6.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/eckert6.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/ellipse.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/ellipse.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/engine.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/engine.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/eqdcyl.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/eqdcyl.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/geocent.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/geocent.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/geoid.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/geoid.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/georef.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/georef.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/geotrans.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/gnomonic.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/gnomonic.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/grinten.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/grinten.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/lambert.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/lambert.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/lambert_1.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/lambert_1.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/lambert_2.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/lambert_2.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/loccart.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/loccart.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/mercator.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/mercator.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/mgrs.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/mgrs.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/miller.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/miller.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/mollweid.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/mollweid.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/neys.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/neys.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/nzmg.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/nzmg.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/omerc.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/omerc.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/orthogr.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/orthogr.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/polarst.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/polarst.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/polycon.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/polycon.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/sinusoid.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/sinusoid.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/stereogr.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/stereogr.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/tranmerc.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/tranmerc.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/trcyleqa.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/trcyleqa.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/ups.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/ups.h,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/utm.c,
-	  src/modules_projection/pj_geotrans/pj_geotrans/geotrans/utm.h,
-	  src/modules_projection/pj_proj4/pj_proj4/MLB_Interface.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/MLB_Interface.h,
-	  src/modules_projection/pj_proj4/pj_proj4/PROJ4_Base.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/PROJ4_Base.h,
-	  src/modules_projection/pj_proj4/pj_proj4/PROJ4_Grid.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/PROJ4_Grid.h,
-	  src/modules_projection/pj_proj4/pj_proj4/PROJ4_Shapes.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/PROJ4_Shapes.h,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_assign.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_assign.h,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_base.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_base.h,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_transform.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_transform.h,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_transform_grid.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_transform_grid.h,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_transform_shapes.cpp,
-	  src/modules_projection/pj_proj4/pj_proj4/crs_transform_shapes.h,
-	  src/modules_recreations/recreations/recreations_fractals/Bifurcation.cpp,
-	  src/modules_recreations/recreations/recreations_fractals/Bifurcation.h,
-	  src/modules_recreations/recreations/recreations_fractals/Gaussian_Landscapes.cpp,
-	  src/modules_recreations/recreations/recreations_fractals/Gaussian_Landscapes.h,
-	  src/modules_recreations/recreations/recreations_fractals/Grid_FractalDimension.cpp,
-	  src/modules_recreations/recreations/recreations_fractals/Grid_FractalDimension.h,
-	  src/modules_recreations/recreations/recreations_fractals/MLB_Interface.cpp,
-	  src/modules_recreations/recreations/recreations_fractals/MLB_Interface.h,
-	  src/modules_recreations/recreations/recreations_fractals/Mandelbrot.cpp,
-	  src/modules_recreations/recreations/recreations_fractals/Mandelbrot.h,
-	  src/modules_recreations/recreations/recreations_fractals/Newton.cpp,
-	  src/modules_recreations/recreations/recreations_fractals/Newton.h,
-	  src/modules_recreations/recreations/recreations_fractals/Pythagoras_Tree.cpp,
-	  src/modules_recreations/recreations/recreations_fractals/Pythagoras_Tree.h,
-	  src/modules_recreations/recreations/recreations_games/MLB_Interface.cpp,
-	  src/modules_recreations/recreations/recreations_games/MLB_Interface.h,
-	  src/modules_recreations/recreations/recreations_games/Mine_Sweeper.cpp,
-	  src/modules_recreations/recreations/recreations_games/Mine_Sweeper.h,
-	  src/modules_recreations/recreations/recreations_games/Mine_Sweeper_Res.cpp,
-	  src/modules_recreations/recreations/recreations_games/Sudoku.cpp,
-	  src/modules_recreations/recreations/recreations_games/Sudoku.h,
-	  src/modules_simulation/cellular_automata/sim_cellular_automata/Life.cpp,
-	  src/modules_simulation/cellular_automata/sim_cellular_automata/Life.h,
-	  src/modules_simulation/cellular_automata/sim_cellular_automata/MLB_Interface.cpp,
-	  src/modules_simulation/cellular_automata/sim_cellular_automata/MLB_Interface.h,
-	  src/modules_simulation/cellular_automata/sim_cellular_automata/Wator.cpp,
-	  src/modules_simulation/cellular_automata/sim_cellular_automata/Wator.h,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/Hugget_01.cpp,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/Hugget_01.h,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/Hugget_02.cpp,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/Hugget_02.h,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/Hugget_03.cpp,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/Hugget_03.h,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/MLB_Interface.cpp,
-	  src/modules_simulation/ecosystems/sim_ecosystems_hugget/MLB_Interface.h,
-	  src/modules_simulation/fire/sim_fire_spreading/Forecasting.cpp,
-	  src/modules_simulation/fire/sim_fire_spreading/Forecasting.h,
-	  src/modules_simulation/fire/sim_fire_spreading/MLB_Interface.cpp,
-	  src/modules_simulation/fire/sim_fire_spreading/MLB_Interface.h,
-	  src/modules_simulation/fire/sim_fire_spreading/Pt.h,
-	  src/modules_simulation/fire/sim_fire_spreading/Simulate.cpp,
-	  src/modules_simulation/fire/sim_fire_spreading/Simulate.h,
-	  src/modules_simulation/fire/sim_fire_spreading/SimulateVariableWind.cpp,
-	  src/modules_simulation/fire/sim_fire_spreading/SimulateVariableWind.h,
-	  src/modules_simulation/fire/sim_fire_spreading/fireLib.c,
-	  src/modules_simulation/fire/sim_fire_spreading/fireLib.h,
-	  src/modules_simulation/hydrology/sim_hydrology/DVWK_SoilMoisture.cpp,
-	  src/modules_simulation/hydrology/sim_hydrology/DVWK_SoilMoisture.h,
-	  src/modules_simulation/hydrology/sim_hydrology/KinWav_D8.cpp,
-	  src/modules_simulation/hydrology/sim_hydrology/KinWav_D8.h,
-	  src/modules_simulation/hydrology/sim_hydrology/MLB_Interface.cpp,
-	  src/modules_simulation/hydrology/sim_hydrology/MLB_Interface.h,
-	  src/modules_simulation/hydrology/sim_hydrology/WaterRetentionCapacity.cpp,
-	  src/modules_simulation/hydrology/sim_hydrology/WaterRetentionCapacity.h,
-	  src/modules_simulation/hydrology/sim_hydrology/idw.cpp,
-	  src/modules_simulation/hydrology/sim_hydrology/idw.h,
-	  src/modules_simulation/hydrology/sim_hydrology/topmodel.cpp,
-	  src/modules_simulation/hydrology/sim_hydrology/topmodel.h,
-	  src/modules_simulation/hydrology/sim_hydrology/topmodel_values.cpp,
-	  src/modules_simulation/hydrology/sim_hydrology/topmodel_values.h,
-	  src/modules_template/template/template/MLB_Interface.cpp,
-	  src/modules_template/template/template/MLB_Interface.h,
-	  src/modules_template/template/template/Template.cpp,
-	  src/modules_template/template/template/Template.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ChannelNetwork.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ChannelNetwork.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ChannelNetwork_Altitude.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ChannelNetwork_Altitude.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ChannelNetwork_Distance.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/ChannelNetwork_Distance.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/D8_Flow_Analysis.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/D8_Flow_Analysis.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/Helper.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/Helper.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/MLB_Interface.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/Strahler.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/Strahler.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/Watersheds.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/Watersheds.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/Watersheds_ext.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_channels/Watersheds_ext.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_compound/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_compound/MLB_Interface.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_compound/TA_Standard.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_compound/TA_Standard.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/BasinGrid.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/BasinGrid.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/CellBalance.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/CellBalance.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/EdgeContamination.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/EdgeContamination.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/FlowDepth.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/FlowDepth.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_AreaDownslope.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_AreaDownslope.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_AreaUpslope.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_AreaUpslope.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_BRM.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_Distance.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_Distance.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_Parallel.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_Parallel.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_RecursiveDown.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_RecursiveDown.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_RecursiveUp.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Flow_RecursiveUp.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Helper.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Helper.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/IsochronesConst.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/IsochronesConst.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/IsochronesVar.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/IsochronesVar.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/LakeFlood.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/LakeFlood.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/LakeFloodInteractive.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/MLB_Interface.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Pt.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/SAGA_Wetness_Index.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/SAGA_Wetness_Index.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Sinuosity.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/Sinuosity.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/SlopeLength.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/SlopeLength.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/TopographicIndices.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/TopographicIndices.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/flow_massflux.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/flow_massflux.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/flow_width.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_hydrology/flow_width.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/HillShade.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/HillShade.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/MLB_Interface.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/SolarRadiation.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/SolarRadiation.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/Visibility_Point.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/Visibility_Point.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/topographic_correction.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/topographic_correction.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/view_shed.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_lighting/view_shed.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Convergence.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Convergence.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Convergence_Radius.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Convergence_Radius.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Curvature_Classification.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Curvature_Classification.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Hypsometry.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Hypsometry.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/MLB_Interface.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Morphometry.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/Morphometry.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/ProtectionIndex.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/ProtectionIndex.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/RealArea.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/RealArea.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/SurfaceSpecificPoints.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/SurfaceSpecificPoints.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/air_flow_height.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/air_flow_height.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/anisotropic_heating.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/anisotropic_heating.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/distance_gradient.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/distance_gradient.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/land_surface_temperature.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/land_surface_temperature.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/mass_balance_index.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/mass_balance_index.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/mrvbf.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/mrvbf.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/relative_heights.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/relative_heights.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/ruggedness.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/ruggedness.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/wind_effect.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_morphometry/wind_effect.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/FillSinks.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/FillSinks.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/FillSinks_WL.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/FillSinks_WL.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/FillSinks_WL_XXL.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/Flat_Detection.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/Flat_Detection.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/MLB_Interface.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/Pit_Eliminator.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/Pit_Eliminator.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/Pit_Router.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_preprocessor/Pit_Router.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_Cross_Profiles.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_Cross_Profiles.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_Flow_Profile.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_Flow_Profile.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_Profile.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_Profile.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_ProfileFromPoints.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_ProfileFromPoints.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_Profile_From_Lines.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_Profile_From_Lines.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_Swath_Profile.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/Grid_Swath_Profile.h,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/MLB_Interface.cpp,
-	  src/modules_terrain_analysis/terrain_analysis/ta_profiles/MLB_Interface.h,
-	  src/saga_core/saga_api/api_callback.cpp,
-	  src/saga_core/saga_api/api_colors.cpp,
-	  src/saga_core/saga_api/api_core.cpp,
-	  src/saga_core/saga_api/api_core.h,
-	  src/saga_core/saga_api/api_file.cpp,
-	  src/saga_core/saga_api/api_memory.cpp,
-	  src/saga_core/saga_api/api_string.cpp,
-	  src/saga_core/saga_api/api_translator.cpp,
-	  src/saga_core/saga_api/compatibility.h,
-	  src/saga_core/saga_api/dataobject.cpp,
-	  src/saga_core/saga_api/dataobject.h,
-	  src/saga_core/saga_api/geo_classes.cpp,
-	  src/saga_core/saga_api/geo_functions.cpp,
-	  src/saga_core/saga_api/geo_tools.h,
-	  src/saga_core/saga_api/grid.cpp, src/saga_core/saga_api/grid.h,
-	  src/saga_core/saga_api/grid_io.cpp,
-	  src/saga_core/saga_api/grid_memory.cpp,
-	  src/saga_core/saga_api/grid_operation.cpp,
-	  src/saga_core/saga_api/grid_pyramid.cpp,
-	  src/saga_core/saga_api/grid_pyramid.h,
-	  src/saga_core/saga_api/grid_system.cpp,
-	  src/saga_core/saga_api/mat_formula.cpp,
-	  src/saga_core/saga_api/mat_grid_radius.cpp,
-	  src/saga_core/saga_api/mat_indexing.cpp,
-	  src/saga_core/saga_api/mat_matrix.cpp,
-	  src/saga_core/saga_api/mat_regression.cpp,
-	  src/saga_core/saga_api/mat_regression_multiple.cpp,
-	  src/saga_core/saga_api/mat_spline.cpp,
-	  src/saga_core/saga_api/mat_tools.cpp,
-	  src/saga_core/saga_api/mat_tools.h,
-	  src/saga_core/saga_api/mat_trend.cpp,
-	  src/saga_core/saga_api/metadata.cpp,
-	  src/saga_core/saga_api/metadata.h,
-	  src/saga_core/saga_api/module.cpp,
-	  src/saga_core/saga_api/module.h,
-	  src/saga_core/saga_api/module_grid.cpp,
-	  src/saga_core/saga_api/module_grid_interactive.cpp,
-	  src/saga_core/saga_api/module_interactive.cpp,
-	  src/saga_core/saga_api/module_interactive_base.cpp,
-	  src/saga_core/saga_api/module_library.cpp,
-	  src/saga_core/saga_api/module_library.h,
-	  src/saga_core/saga_api/module_library_interface.cpp,
-	  src/saga_core/saga_api/parameter.cpp,
-	  src/saga_core/saga_api/parameter_data.cpp,
-	  src/saga_core/saga_api/parameters.cpp,
-	  src/saga_core/saga_api/parameters.h,
-	  src/saga_core/saga_api/pointcloud.cpp,
-	  src/saga_core/saga_api/pointcloud.h,
-	  src/saga_core/saga_api/projections.cpp,
-	  src/saga_core/saga_api/quadtree.cpp,
-	  src/saga_core/saga_api/saga_api.cpp,
-	  src/saga_core/saga_api/saga_api.h,
-	  src/saga_core/saga_api/shape.cpp,
-	  src/saga_core/saga_api/shape_line.cpp,
-	  src/saga_core/saga_api/shape_part.cpp,
-	  src/saga_core/saga_api/shape_point.cpp,
-	  src/saga_core/saga_api/shape_points.cpp,
-	  src/saga_core/saga_api/shape_polygon.cpp,
-	  src/saga_core/saga_api/shapes.cpp,
-	  src/saga_core/saga_api/shapes.h,
-	  src/saga_core/saga_api/shapes_io.cpp,
-	  src/saga_core/saga_api/shapes_ogis.cpp,
-	  src/saga_core/saga_api/shapes_search.cpp,
-	  src/saga_core/saga_api/shapes_selection.cpp,
-	  src/saga_core/saga_api/table.cpp, src/saga_core/saga_api/table.h,
-	  src/saga_core/saga_api/table_dbase.cpp,
-	  src/saga_core/saga_api/table_dbase.h,
-	  src/saga_core/saga_api/table_io.cpp,
-	  src/saga_core/saga_api/table_record.cpp,
-	  src/saga_core/saga_api/table_selection.cpp,
-	  src/saga_core/saga_api/table_value.h,
-	  src/saga_core/saga_api/tin.cpp, src/saga_core/saga_api/tin.h,
-	  src/saga_core/saga_api/tin_elements.cpp,
-	  src/saga_core/saga_api/tin_triangulation.cpp,
-	  src/saga_core/saga_cmd/callback.cpp,
-	  src/saga_core/saga_cmd/callback.h,
-	  src/saga_core/saga_cmd/module_library.cpp,
-	  src/saga_core/saga_cmd/module_library.h,
-	  src/saga_core/saga_cmd/saga_cmd.cpp,
-	  src/saga_core/saga_gdi/saga_gdi.cpp,
-	  src/saga_core/saga_gdi/saga_gdi.h,
-	  src/saga_core/saga_gdi/sgdi_diagram.cpp,
-	  src/saga_core/saga_gdi/sgdi_diagram.h,
-	  src/saga_core/saga_gdi/sgdi_dialog.cpp,
-	  src/saga_core/saga_gdi/sgdi_dialog.h,
-	  src/saga_core/saga_gdi/sgdi_helper.cpp,
-	  src/saga_core/saga_gdi/sgdi_helper.h,
-	  src/saga_core/saga_gui/active.cpp,
-	  src/saga_core/saga_gui/active.h,
-	  src/saga_core/saga_gui/active_HTMLExtraInfo.cpp,
-	  src/saga_core/saga_gui/active_HTMLExtraInfo.h,
-	  src/saga_core/saga_gui/active_attributes.cpp,
-	  src/saga_core/saga_gui/active_attributes.h,
-	  src/saga_core/saga_gui/active_description.cpp,
-	  src/saga_core/saga_gui/active_description.h,
-	  src/saga_core/saga_gui/active_history.cpp,
-	  src/saga_core/saga_gui/active_history.h,
-	  src/saga_core/saga_gui/active_legend.cpp,
-	  src/saga_core/saga_gui/active_legend.h,
-	  src/saga_core/saga_gui/active_parameters.cpp,
-	  src/saga_core/saga_gui/active_parameters.h,
-	  src/saga_core/saga_gui/callback.cpp,
-	  src/saga_core/saga_gui/callback.h,
-	  src/saga_core/saga_gui/dc_helper.cpp,
-	  src/saga_core/saga_gui/dc_helper.h,
-	  src/saga_core/saga_gui/dlg_about.cpp,
-	  src/saga_core/saga_gui/dlg_about.h,
-	  src/saga_core/saga_gui/dlg_about_logo.cpp,
-	  src/saga_core/saga_gui/dlg_about_logo.h,
-	  src/saga_core/saga_gui/dlg_base.cpp,
-	  src/saga_core/saga_gui/dlg_base.h,
-	  src/saga_core/saga_gui/dlg_colors.cpp,
-	  src/saga_core/saga_gui/dlg_colors.h,
-	  src/saga_core/saga_gui/dlg_colors_control.cpp,
-	  src/saga_core/saga_gui/dlg_colors_control.h,
-	  src/saga_core/saga_gui/dlg_list_base.cpp,
-	  src/saga_core/saga_gui/dlg_list_base.h,
-	  src/saga_core/saga_gui/dlg_list_grid.cpp,
-	  src/saga_core/saga_gui/dlg_list_grid.h,
-	  src/saga_core/saga_gui/dlg_list_pointcloud.cpp,
-	  src/saga_core/saga_gui/dlg_list_pointcloud.h,
-	  src/saga_core/saga_gui/dlg_list_shapes.cpp,
-	  src/saga_core/saga_gui/dlg_list_shapes.h,
-	  src/saga_core/saga_gui/dlg_list_table.cpp,
-	  src/saga_core/saga_gui/dlg_list_table.h,
-	  src/saga_core/saga_gui/dlg_list_tin.cpp,
-	  src/saga_core/saga_gui/dlg_list_tin.h,
-	  src/saga_core/saga_gui/dlg_parameters.cpp,
-	  src/saga_core/saga_gui/dlg_parameters.h,
-	  src/saga_core/saga_gui/dlg_table.cpp,
-	  src/saga_core/saga_gui/dlg_table.h,
-	  src/saga_core/saga_gui/dlg_text.cpp,
-	  src/saga_core/saga_gui/dlg_text.h,
-	  src/saga_core/saga_gui/helper.cpp,
-	  src/saga_core/saga_gui/helper.h, src/saga_core/saga_gui/info.cpp,
-	  src/saga_core/saga_gui/info.h,
-	  src/saga_core/saga_gui/info_messages.cpp,
-	  src/saga_core/saga_gui/info_messages.h,
-	  src/saga_core/saga_gui/parameters_control.cpp,
-	  src/saga_core/saga_gui/parameters_control.h,
-	  src/saga_core/saga_gui/parameters_properties.cpp,
-	  src/saga_core/saga_gui/parameters_properties.h,
-	  src/saga_core/saga_gui/project.cpp,
-	  src/saga_core/saga_gui/project.h,
-	  src/saga_core/saga_gui/res/resource.h,
-	  src/saga_core/saga_gui/res_commands.cpp,
-	  src/saga_core/saga_gui/res_commands.h,
-	  src/saga_core/saga_gui/res_controls.cpp,
-	  src/saga_core/saga_gui/res_controls.h,
-	  src/saga_core/saga_gui/res_dialogs.cpp,
-	  src/saga_core/saga_gui/res_dialogs.h,
-	  src/saga_core/saga_gui/res_images.cpp,
-	  src/saga_core/saga_gui/res_images.h,
-	  src/saga_core/saga_gui/saga.cpp, src/saga_core/saga_gui/saga.h,
-	  src/saga_core/saga_gui/saga_frame.cpp,
-	  src/saga_core/saga_gui/saga_frame.h,
-	  src/saga_core/saga_gui/saga_frame_droptarget.cpp,
-	  src/saga_core/saga_gui/saga_frame_droptarget.h,
-	  src/saga_core/saga_gui/view_base.cpp,
-	  src/saga_core/saga_gui/view_base.h,
-	  src/saga_core/saga_gui/view_histogram.cpp,
-	  src/saga_core/saga_gui/view_histogram.h,
-	  src/saga_core/saga_gui/view_layout.cpp,
-	  src/saga_core/saga_gui/view_layout.h,
-	  src/saga_core/saga_gui/view_layout_control.cpp,
-	  src/saga_core/saga_gui/view_layout_control.h,
-	  src/saga_core/saga_gui/view_layout_info.cpp,
-	  src/saga_core/saga_gui/view_layout_info.h,
-	  src/saga_core/saga_gui/view_layout_printout.cpp,
-	  src/saga_core/saga_gui/view_layout_printout.h,
-	  src/saga_core/saga_gui/view_map.cpp,
-	  src/saga_core/saga_gui/view_map.h,
-	  src/saga_core/saga_gui/view_map_3d.cpp,
-	  src/saga_core/saga_gui/view_map_3d.h,
-	  src/saga_core/saga_gui/view_map_3d_image.cpp,
-	  src/saga_core/saga_gui/view_map_3d_image.h,
-	  src/saga_core/saga_gui/view_map_control.cpp,
-	  src/saga_core/saga_gui/view_map_control.h,
-	  src/saga_core/saga_gui/view_ruler.cpp,
-	  src/saga_core/saga_gui/view_ruler.h,
-	  src/saga_core/saga_gui/view_scatterplot.cpp,
-	  src/saga_core/saga_gui/view_scatterplot.h,
-	  src/saga_core/saga_gui/view_table.cpp,
-	  src/saga_core/saga_gui/view_table.h,
-	  src/saga_core/saga_gui/view_table_control.cpp,
-	  src/saga_core/saga_gui/view_table_control.h,
-	  src/saga_core/saga_gui/view_table_diagram.cpp,
-	  src/saga_core/saga_gui/view_table_diagram.h,
-	  src/saga_core/saga_gui/wksp.cpp, src/saga_core/saga_gui/wksp.h,
-	  src/saga_core/saga_gui/wksp_base_control.cpp,
-	  src/saga_core/saga_gui/wksp_base_control.h,
-	  src/saga_core/saga_gui/wksp_base_item.cpp,
-	  src/saga_core/saga_gui/wksp_base_item.h,
-	  src/saga_core/saga_gui/wksp_base_manager.cpp,
-	  src/saga_core/saga_gui/wksp_base_manager.h,
-	  src/saga_core/saga_gui/wksp_data_control.cpp,
-	  src/saga_core/saga_gui/wksp_data_control.h,
-	  src/saga_core/saga_gui/wksp_data_layers.cpp,
-	  src/saga_core/saga_gui/wksp_data_layers.h,
-	  src/saga_core/saga_gui/wksp_data_manager.cpp,
-	  src/saga_core/saga_gui/wksp_data_manager.h,
-	  src/saga_core/saga_gui/wksp_data_menu_file.cpp,
-	  src/saga_core/saga_gui/wksp_data_menu_file.h,
-	  src/saga_core/saga_gui/wksp_data_menu_files.cpp,
-	  src/saga_core/saga_gui/wksp_data_menu_files.h,
-	  src/saga_core/saga_gui/wksp_grid.cpp,
-	  src/saga_core/saga_gui/wksp_grid.h,
-	  src/saga_core/saga_gui/wksp_grid_manager.cpp,
-	  src/saga_core/saga_gui/wksp_grid_manager.h,
-	  src/saga_core/saga_gui/wksp_grid_system.cpp,
-	  src/saga_core/saga_gui/wksp_grid_system.h,
-	  src/saga_core/saga_gui/wksp_layer.cpp,
-	  src/saga_core/saga_gui/wksp_layer.h,
-	  src/saga_core/saga_gui/wksp_layer_classify.cpp,
-	  src/saga_core/saga_gui/wksp_layer_classify.h,
-	  src/saga_core/saga_gui/wksp_layer_legend.cpp,
-	  src/saga_core/saga_gui/wksp_layer_legend.h,
-	  src/saga_core/saga_gui/wksp_map.cpp,
-	  src/saga_core/saga_gui/wksp_map.h,
-	  src/saga_core/saga_gui/wksp_map_buttons.cpp,
-	  src/saga_core/saga_gui/wksp_map_buttons.h,
-	  src/saga_core/saga_gui/wksp_map_control.cpp,
-	  src/saga_core/saga_gui/wksp_map_control.h,
-	  src/saga_core/saga_gui/wksp_map_dc.cpp,
-	  src/saga_core/saga_gui/wksp_map_dc.h,
-	  src/saga_core/saga_gui/wksp_map_layer.cpp,
-	  src/saga_core/saga_gui/wksp_map_layer.h,
-	  src/saga_core/saga_gui/wksp_map_manager.cpp,
-	  src/saga_core/saga_gui/wksp_map_manager.h,
-	  src/saga_core/saga_gui/wksp_module.cpp,
-	  src/saga_core/saga_gui/wksp_module.h,
-	  src/saga_core/saga_gui/wksp_module_control.cpp,
-	  src/saga_core/saga_gui/wksp_module_control.h,
-	  src/saga_core/saga_gui/wksp_module_library.cpp,
-	  src/saga_core/saga_gui/wksp_module_library.h,
-	  src/saga_core/saga_gui/wksp_module_manager.cpp,
-	  src/saga_core/saga_gui/wksp_module_manager.h,
-	  src/saga_core/saga_gui/wksp_module_menu.cpp,
-	  src/saga_core/saga_gui/wksp_module_menu.h,
-	  src/saga_core/saga_gui/wksp_pointcloud.cpp,
-	  src/saga_core/saga_gui/wksp_pointcloud.h,
-	  src/saga_core/saga_gui/wksp_pointcloud_manager.cpp,
-	  src/saga_core/saga_gui/wksp_pointcloud_manager.h,
-	  src/saga_core/saga_gui/wksp_shapes.cpp,
-	  src/saga_core/saga_gui/wksp_shapes.h,
-	  src/saga_core/saga_gui/wksp_shapes_edit.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_line.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_line.h,
-	  src/saga_core/saga_gui/wksp_shapes_manager.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_manager.h,
-	  src/saga_core/saga_gui/wksp_shapes_point.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_point.h,
-	  src/saga_core/saga_gui/wksp_shapes_points.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_points.h,
-	  src/saga_core/saga_gui/wksp_shapes_polygon.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_polygon.h,
-	  src/saga_core/saga_gui/wksp_shapes_type.cpp,
-	  src/saga_core/saga_gui/wksp_shapes_type.h,
-	  src/saga_core/saga_gui/wksp_table.cpp,
-	  src/saga_core/saga_gui/wksp_table.h,
-	  src/saga_core/saga_gui/wksp_table_manager.cpp,
-	  src/saga_core/saga_gui/wksp_table_manager.h,
-	  src/saga_core/saga_gui/wksp_tin.cpp,
-	  src/saga_core/saga_gui/wksp_tin.h,
-	  src/saga_core/saga_gui/wksp_tin_manager.cpp,
-	  src/saga_core/saga_gui/wksp_tin_manager.h,
-	  src/saga_core/saga_gui/wx/propgrid/advprops.cpp,
-	  src/saga_core/saga_gui/wx/propgrid/advprops.h,
-	  src/saga_core/saga_gui/wx/propgrid/editors.cpp,
-	  src/saga_core/saga_gui/wx/propgrid/editors.h,
-	  src/saga_core/saga_gui/wx/propgrid/extras.cpp,
-	  src/saga_core/saga_gui/wx/propgrid/extras.h,
-	  src/saga_core/saga_gui/wx/propgrid/manager.cpp,
-	  src/saga_core/saga_gui/wx/propgrid/manager.h,
-	  src/saga_core/saga_gui/wx/propgrid/odcombo.cpp,
-	  src/saga_core/saga_gui/wx/propgrid/odcombo.h,
-	  src/saga_core/saga_gui/wx/propgrid/propdev.h,
-	  src/saga_core/saga_gui/wx/propgrid/propgrid.cpp,
-	  src/saga_core/saga_gui/wx/propgrid/propgrid.h,
-	  src/saga_core/saga_gui/wx/propgrid/props.cpp,
-	  src/saga_core/saga_gui/wx/propgrid/props.h,
-	  src/saga_core/saga_odbc/otlv4.h,
-	  src/saga_core/saga_odbc/saga_odbc.cpp,
-	  src/saga_core/saga_odbc/saga_odbc.h: all .h, .c and .cpp files:
-	  svn keywords added and conversion to Unix LF
-
-2011-02-14 13:51  reklov_w
-
-	* .: directory saga_2 renamed to saga-gis
-
-2011-02-14 12:03  oconrad
-
-	* various changes made when cvs server at sf was down (hack attack)
-
-2011-01-24 15:08  oconrad
-
-	* vc9 project maintainence
-
-2011-01-24 15:01  oconrad
-
-	* pointer assignment bug fix
-
-2011-01-24 14:53  oconrad
-
-	* vc6 project maintainence
-
-2011-01-24 14:50  oconrad
-
-	* segmentation tools moved from grid_discretisation library
-
-2011-01-24 14:23  oconrad
-
-	* stl compile error (gcc) fixed
-
-2011-01-24 13:47  oconrad
-
-	* adjusted menu path
-
-2011-01-24 13:46  oconrad
-
-	* allow classification for just one class
-
-2011-01-24 13:13  oconrad
-
-	* imagery_classification, imagery_rga, imagery_tools added;
-	  grid_discretisation removed
-
-2011-01-24 13:11  oconrad
-
-	* optimisation for grid/shapes related spatial joins
-
-2011-01-24 11:57  oconrad
-
-	* optimisation and no-data support
-
-2011-01-24 11:56  oconrad
-
-	* look-up table classification: minor enhancement
-
-2011-01-24 11:55  oconrad
-
-	* code comments/structuring/readability (no change of
-	  functionality)
-
-2011-01-24 11:53  oconrad
-
-	* no data value support
-
-2011-01-24 11:53  oconrad
-
-	* multiple input grids and selection of output parameters enabled
-
-2011-01-24 11:50  oconrad
-
-	* update changed input grid
-
-2011-01-24 11:46  oconrad
-
-	* support for multiple input files (i.e. e00, e01, e02 ...)
-
-2011-01-24 11:44  oconrad
-
-	* does not belong here...
-
-2011-01-24 11:43  oconrad
-
-	* 'fast region growing algorithm' moved to separate library due to
-	  stl compile con...
-
-2011-01-24 11:41  oconrad
-
-	* new libraries: imagery_classification, imagery_rga, imagery_tools
-
-2011-01-24 11:40  oconrad
-
-	* 'fast region growing algorithm' moved to separate library due to
-	  stl compile conflicts (gcc)
-
-2011-01-24 11:37  oconrad
-
-	* grid_discretisation tools moved to imagery_classification and
-	  imagery_segmentation libraries
-
-2011-01-24 11:35  oconrad
-
-	* fuzzy set and vegetation index tools moved to
-	  grid_calculus/imagery_tools libraries
-
-2011-01-24 11:34  oconrad
-
-	* fuzzy set tools moved from grid_analysis library
-
-2011-01-24 11:33  oconrad
-
-	* vegetation index tools moved from grid_analysis library
-
-2011-01-24 11:32  oconrad
-
-	* image segmentation tools moved from discarded grid_discretisation
-	  library
-
-2011-01-24 11:30  oconrad
-
-	* image classification tools moved from discarded
-	  grid_discretisation library
-
-2011-01-22 15:25  reklov_w
-
-	* fixes LUT min/max comparison to match GUI behavior
-
-2011-01-18 22:05  reklov_w
-
-	* parameter and code added to handle 8bit coded color values;
-	  rescaling of R,G,B values to SAGA RGB refined
-
-2011-01-14 01:33  reklov_w
-
-	* added LUT coloring for command line; module name updated to
-	  reflect all output formats
-
-2011-01-04 13:47  reklov_w
-
-	* fix for wrong 'condition ? value : value' statements
-
-2011-01-03 22:35  reklov_w
-
-	* added missing operator
-
-2011-01-03 21:56  reklov_w
-
-	* table_pca sources added
-
-2011-01-03 21:32  reklov_w
-
-	* enhancement: if output is no set, the attribute is dropped from
-	  the input
-
-2011-01-03 15:42  oconrad
-
-	* unicode compilation error fixed
-
-2011-01-03 15:42  oconrad
-
-	* las_info module added
-
-2011-01-03 15:36  oconrad
-
-	* eigen reduction for matrices added
-
-2011-01-03 15:35  oconrad
-
-	* improved principal components analysis for grids
-
-2011-01-03 15:34  oconrad
-
-	* principal components analysis for tables added
-
-2010-12-27 12:53  reklov_w
-
-	* 'las info' module added
-
-2010-12-22 14:13  reklov_w
-
-	* Principle Components Analysis module added
-
-2010-12-21 17:24  oconrad
-
-	* labels trimmed (white space removed) before drawing
-
-2010-12-21 17:23  oconrad
-
-	* principal componets analysis (for grids) added
-
-2010-12-17 13:14  reklov_w
-
-	* bug fix NoData handling (bug item 3139011)
-
-2010-12-17 13:04  reklov_w
-
-	* postbuild copy of *.lng.txt files removed
-
-2010-12-15 10:18  reklov_w
-
-	* morphology and ranks filter sources added
-
-2010-12-14 17:41  oconrad
-
-	* support for last, first, min, max, mean calculation if more than
-	  one shapes is assoc. with a cell
-
-2010-12-14 17:40  oconrad
-
-	* bug fix: statistics invalidated when a value has changed
-
-2010-12-14 17:39  oconrad
-
-	* bug fix
-
-2010-12-10 11:00  oconrad
-
-	* improved scatterplot performance
-
-2010-12-10 10:56  oconrad
-
-	* fast segmentation replaced by watershed segmentation
-	  (grid_segmentation.cpp/h)
-
-2010-12-10 10:54  oconrad
-
-	* morphology and rank filter added
-
-2010-12-08 19:00  oconrad
-
-	* significally improved performance
-
-2010-12-08 18:59  oconrad
-
-	* stronglly improved and renamed to 'watershed segmentation'
-
-2010-12-08 18:57  oconrad
-
-	* alternative slope/aspect calculation added
-
-2010-12-07 13:56  reklov_w
-
-	* bug fix attribute handling
-
-2010-11-30 11:36  oconrad
-
-	* history related enhancements
-
-2010-11-30 11:36  oconrad
-
-	* delete children: bug fix and delete 'level of detail' added
-
-2010-11-30 11:35  oconrad
-
-	* context menu enabled for legend and history
-
-2010-11-30 11:26  oconrad
-
-	* target grid name inherited from source grid name
-
-2010-11-26 14:40  oconrad
-
-	* long string (_TW() macro) enabled
-
-2010-11-26 14:40  oconrad
-
-	* improved translations
-
-2010-11-26 13:31  oconrad
-
-	* collection of helpful tools for saga development. currently only
-	  tools for translation dictionary creation.
-
-2010-11-26 13:23  oconrad
-
-	* new translation system uses updated dictionary files (template
-	  and german)
-
-2010-11-26 13:07  oconrad
-
-	* new translation system uses only one single dictionary file
-	  removed: post-build copying)
-
-2010-11-26 12:58  oconrad
-
-	* unnecessary translatables removed, critical translatables
-	  replaced
-
-2010-11-26 12:56  oconrad
-
-	* <malloc.h> removed
-
-2010-11-26 12:55  oconrad
-
-	* language dictionary file can be chosen from saga_gui
-
-2010-11-26 12:53  oconrad
-
-	* no need to include <malloc.h> explicitly (stdlib.h is sufficient)
-
-2010-11-26 12:51  oconrad
-
-	* new translation system uses only one single dictionary file
-
-2010-11-26 12:45  oconrad
-
-	* replaced by io_odbc (wxODBC will be removed with wxWidgets
-	  v3(v2.9))
-
-2010-11-26 11:33  reklov_w
-
-	* fix postbuild - projection files added
-
-2010-11-25 00:33  reklov_w
-
-	* fix wrong boolean return on module execution with method 'height'
-
-2010-11-23 13:22  oconrad
-
-	* arrow style option added; works on surface grid or directional
-	  components (x, y)
-
-2010-11-23 13:20  oconrad
-
-	* no data and statistics support for export
-
-2010-11-21 15:26  reklov_w
-
-	* fix data object handling
-
-2010-11-18 12:46  reklov_w
-
-	* updated for 2.0.6 release
-
-2010-11-18 12:12  oconrad
-
-	* proj4 and geotrans lib sources removed (geotrans sources are now
-	  integrated and proj4 works well with the official distribution)
-
-2010-11-18 12:08  oconrad
-
-	* interpolation target grid needs to be of floating pointt type
-	  (optional)
-
-2010-11-18 11:54  oconrad
-
-	* bug fix: missing 'return( true )' on csg_grid::create(csg_grid
-	  *p, ...)
-
-2010-11-17 17:21  oconrad
-
-	* no data set for duration
-
-2010-11-17 16:43  oconrad
-
-	* removed tooltip flickering (windows7)
-
-2010-11-16 16:29  oconrad
-
-	* first fix for msw vista/7 problems with wxTreeCtrl (multi-select
-	  deletion), but there might be more to be done...
-
-2010-11-16 16:27  oconrad
-
-	* Set_NoData_Value(double) now only implemented in CSG_Data_Object,
-	  avoids swig/java conflicts
-
-2010-11-16 11:47  oconrad
-
-	* BSD portability: <malloc.h> not included if __BSD__ is defined
-
-2010-11-16 11:26  oconrad
-
-	* sado_solarradiation removed
-
-2010-11-16 11:25  oconrad
-
-	* cluster_analysis added
-
-2010-11-16 11:25  oconrad
-
-	* doc_html.h, doc_pdf.h, doc_svg.h removed from swig includes
-
-2010-11-16 10:37  oconrad
-
-	* sado_solarradiation removed. bug fixes in solarradiation
-
-2010-11-15 17:20  oconrad
-
-	* completely overworked insolation module (sado_solarradiation is
-	  now obsolete)
-
-2010-11-15 17:19  oconrad
-
-	* removed unnecassary processing on addition/multiplication
-
-2010-11-09 22:12  johanvdw
-
-	* Only check for python/swig on --enable-python
-
-2010-11-09 22:01  johanvdw
-
-	* Fix minor memory leak (Grid Pattern)
-
-2010-11-09 10:26  oconrad
-
-	* msvc10 x64 unicode build targets
-
-2010-11-09 10:24  oconrad
-
-	* C exit() removed
-
-2010-11-09 10:21  oconrad
-
-	* input data will now be saved automatically if modified by module
-
-2010-11-09 10:19  oconrad
-
-	* no data support for dbase files (read/write)
-
-2010-11-09 10:19  oconrad
-
-	* floating point precision fitted to value (currently up to 16
-	  decimals)
-
-2010-11-08 11:34  reklov_w
-
-	* bug fix for memory leak in case of multiple seed cells in
-	  non-interactive version; enhancements: allow multiple seed cells,
-	  allow seeds to be local water depth or absolute water level,
-	  output water depth and surface, incremetal flooding with
-	  interactive version
-
-2010-11-08 09:20  johanvdw
-
-	* Disable libharu in python (when not available)
-
-2010-11-08 09:19  johanvdw
-
-	* Remove saga_api_wrap.cxx on make clean
-
-2010-11-08 08:45  oconrad
-
-	* 'load tin' via file menu now enabled (loads any shapefile and
-	  converts it to tin)
-
-2010-11-06 22:34  reklov_w
-
-	* updated to current cvs
-
-2010-11-06 15:51  reklov_w
-
-	* EXPORTS preprocessor defines added for x64 targets
-
-2010-11-06 15:20  reklov_w
-
-	* cluster analysis for shapes/table attributes added
-
-2010-11-06 15:16  johanvdw
-
-	* Only build module if libharu is found
-
-2010-11-06 11:59  johanvdw
-
-	* Update autotools to build python bindings
-
-2010-11-06 11:55  johanvdw
-
-	* Enable swig unicode build
-
-2010-11-06 11:51  johanvdw
-
-	* Fix some memory leaks
-
-2010-11-05 14:59  oconrad
-
-	* simple tools added for sum and product calculation
-
-2010-11-05 14:58  oconrad
-
-	* cluster analysis now also allowed to work on one single feature
-
-2010-11-05 14:56  oconrad
-
-	* improvements and bug fixes for fuzzy set analysis
-
-2010-11-05 14:55  oconrad
-
-	* improved output grid naming
-
-2010-11-05 14:53  oconrad
-
-	* old linux and mingw makefiles have been removed
-
-2010-11-05 14:51  oconrad
-
-	* cluster analysis for shapes/table attributes added
-
-2010-11-03 19:32  oconrad
-
-	* improved gdal/ogr import via gui (adds to recent files list)
-
-2010-11-03 19:31  oconrad
-
-	* csg_cluster_analysis: optimisation and used for grids
-
-2010-11-03 11:11  oconrad
-
-	* cluster analysis class added
-
-2010-11-02 12:56  oconrad
-
-	* morain's i calculation added
-
-2010-11-02 12:55  oconrad
-
-	* vc6 project missed io_gdal_EXPORTS define
-
-2010-11-02 12:54  oconrad
-
-	* vc6 compiler error fixed
-
-2010-11-02 12:26  oconrad
-
-	* getting prepared for 2.0.6 release
-
-2010-11-02 11:04  oconrad
-
-	* pointcloud points selection and interactive deletion enabled
-
-2010-11-02 11:03  oconrad
-
-	* typing error caused missing las_export.h in make dist target
-
-2010-11-02 11:00  oconrad
-
-	* rounding error
-
-2010-11-02 10:59  oconrad
-
-	* unicode bug fix in csg_ui_parameter class
-
-2010-11-02 10:58  oconrad
-
-	* simple moran's i for grids
-
-2010-10-29 15:48  oconrad
-
-	* kernel density estimation: module added
-
-2010-10-29 15:43  oconrad
-
-	* suppress progress bar flickering
-
-2010-10-29 10:18  oconrad
-
-	* numbering of data set objects (number of leading zeros now user
-	  defined)
-
-2010-10-29 10:17  oconrad
-
-	* enhanced pointcloud/shapes conformity, test case proj4 for shapes
-
-2010-10-27 09:37  oconrad
-
-	* peucker-douglas algorithm for line simplification added
-
-2010-10-27 09:30  oconrad
-
-	* bug fix: possible crash when accessing tree item after closing
-	  associated data set
-
-2010-10-27 09:29  oconrad
-
-	* bug fix: possible crash with field names containing % characters
-
-2010-10-27 09:27  oconrad
-
-	* peucker-douglas algorithm for line simplification added
-
-2010-10-25 15:24  oconrad
-
-	* docs_html, docs_pdf moved to separate libraries
-
-2010-10-22 15:20  oconrad
-
-	* Triangular Multiple Flow Direction added/updated
-
-2010-10-22 14:48  oconrad
-
-	* menu path and name
-
-2010-10-22 14:47  oconrad
-
-	* typing error fixed
-
-2010-10-22 14:46  oconrad
-
-	* svg map export added
-
-2010-10-22 12:05  oconrad
-
-	* shapes_tools project included (was forgotten)
-
-2010-10-22 12:03  oconrad
-
-	* pdf/svg/html doc support moved from api to new module library
-
-2010-10-22 09:15  oconrad
-
-	* pdf/svg/html doc support moved from api to new module library
-
-2010-10-22 09:08  oconrad
-
-	* no need for maintaining old mingw makefiles
-
-2010-10-22 09:05  oconrad
-
-	* no need for maintaining old gcc (linux) makefiles
-
-2010-10-22 09:05  oconrad
-
-	* no need for maintaining old gcc (linux) makefiles
-
-2010-10-20 08:20  oconrad
-
-	* linux gcc compatibility
-
-2010-10-20 08:19  oconrad
-
-	* vc10 solution added (loads *.vcxproj files)
-
-2010-10-19 15:53  oconrad
-
-	* safe 64bit pointers in callback function arguments
-
-2010-10-19 15:52  oconrad
-
-	* target area (polygon) now optional (caused problems with infinite
-	  projections)
-
-2010-10-19 15:50  oconrad
-
-	* vc10 projects
-
-2010-10-19 08:05  johanvdw
-
-	* Add makefiles for modules_imagery
-
-2010-10-19 07:55  johanvdw
-
-	* Complete check for liblas
-
-2010-10-18 14:45  oconrad
-
-	* updated msvc10 projects
-
-2010-10-18 14:30  oconrad
-
-	* saving of nodes without content now permitted
-
-2010-10-18 14:29  oconrad
-
-	* vc10 project; debug settings corrected
-
-2010-10-18 13:29  oconrad
-
-	* msvc10 solution & project files (including 64bit targets)
-
-2010-10-18 13:12  oconrad
-
-	* platform info (x86/x64), windows only
-
-2010-10-18 13:11  oconrad
-
-	* unicode compatibility
-
-2010-10-18 11:08  oconrad
-
-	* x64 type conversion warnings removed (not all of them yet)
-
-2010-10-18 11:07  oconrad
-
-	* dependency to ta_morphology removed
-
-2010-10-18 11:04  oconrad
-
-	* io_gdal: name/descrription bug fixed
-
-2010-10-18 11:03  oconrad
-
-	* geotrans: sources now built-in (not linked to external library)
-
-2010-10-15 14:14  johanvdw
-
-	* Make sure image modules are added to disttarget
-
-2010-10-15 11:57  reklov_w
-
-	* change output format of datalists, now always four digits
-	  (filename_0000 instead of filename_00)
-
-2010-10-15 11:55  reklov_w
-
-	* fix typo in module parameters
-
-2010-10-14 09:54  reklov_w
-
-	* preprocessor define "io_gdal_EXPORTS" added
-
-2010-10-13 17:49  oconrad
-
-	* projection enhancements
-
-2010-10-13 17:49  oconrad
-
-	* csg_metadata: potential crash
-
-2010-10-13 17:48  oconrad
-
-	* api callback; progressbar flickering when progressbar should be
-	  suppressed
-
-2010-10-12 14:56  oconrad
-
-	* gdal import
-
-2010-10-12 14:55  oconrad
-
-	* output parameter lists now automatically cleaned from invalid
-	  items
-
-2010-10-12 14:54  oconrad
-
-	* improved metadata and projection inheritage
-
-2010-10-12 14:52  oconrad
-
-	* gcc compiler error fixed
-
-2010-10-11 16:06  oconrad
-
-	* gdal/ogr dll interface - gdal support in gui
-
-2010-10-08 14:53  oconrad
-
-	* gdal - improved wrapper for dll-export (coming next)
-
-2010-10-08 12:05  oconrad
-
-	* wksp_layer - get_name() function moved to base class
-
-2010-10-08 12:04  oconrad
-
-	* bug fix
-
-2010-10-08 12:04  oconrad
-
-	* gdal - user break, metadata
-
-2010-10-08 12:03  oconrad
-
-	* proj4 - grid to points, target from loaded rdata set
-
-2010-10-07 19:53  johanvdw
-
-	* Add opencv/vigra modules to autotools
-
-2010-10-07 16:01  johanvdw
-
-	* Various fixes to compile using gcc 4.4
-
-2010-10-07 13:57  johanvdw
-
-	* Build LAS module if detected - update Makefile as well
-
-2010-10-07 13:54  johanvdw
-
-	* Build LAS import module if its library is detected
-
-2010-10-07 13:49  johanvdw
-
-	* Use const char* instead of char* for return string
-
-2010-10-07 13:47  johanvdw
-
-	* Mark all images as const chars
-	  
-	  Fixes a very large number of compiler warnings in gcc. May be
-	  slightly
-	  more efficient.
-
-2010-09-20 16:22  oconrad
-
-	* projections: built-in proj4/wkt dictionary now included
-
-2010-09-20 16:20  oconrad
-
-	* svg export module (missing project bindings)
-
-2010-09-17 16:23  oconrad
-
-	* no message
-
-2010-09-17 16:20  oconrad
-
-	* now also saves entries only with parameters (but no child, no
-	  content)
-
-2010-09-15 17:07  oconrad
-
-	* no message
-
-2010-09-14 15:55  oconrad
-
-	* no message
-
-2010-09-13 16:17  oconrad
-
-	* grid to image: drawing bug
-
-2010-09-13 14:38  reklov_w
-
-	* new ASCII import options: output grid data type selection and
-	  optional user defined NoData value to write instead of that found
-	  in the file
-
-2010-09-13 13:49  reklov_w
-
-	* allow for larger numbers than max_int in
-	  SG_Get_Significant_Decimals()
-
-2010-09-11 17:02  reklov_w
-
-	* bug fix in rect_to_polar to recognize quadrant, new option on how
-	  to measure direction; noData support for polar_to_rect
-
-2010-09-11 01:00  reklov_w
-
-	* forgot to add the new files for the least cost path points module
-
-2010-09-11 00:07  reklov_w
-
-	* new module for least cost path search from point(s) shapefile
-	  added
-
-2010-09-09 16:54  oconrad
-
-	* no message
-
-2010-09-08 14:29  oconrad
-
-	* no message
-
-2010-09-08 09:02  reklov_w
-
-	* new interactive modules can use middle mouse button in map mode
-	  select
-
-2010-09-07 15:59  oconrad
-
-	* projection issues: reached beta stage
-
-2010-09-03 15:48  oconrad
-
-	* crs & projection support (not fully completed)
-
-2010-09-02 21:21  reklov_w
-
-	* fixed typo
-
-2010-08-30 16:25  oconrad
-
-	* modules: stop_execution-callback without dialog prompt enabled
-
-2010-08-29 15:53  johanvdw
-
-	* Fix non-unicode autotools build
-
-2010-08-28 15:48  reklov_w
-
-	* fix color attribute setting
-
-2010-08-28 15:47  reklov_w
-
-	* new stepping for SG_ARRAY_GROWTH, and faster growing for point
-	  clouds
-
-2010-08-27 07:54  oconrad
-
-	* no message
-
-2010-08-25 16:17  oconrad
-
-	* projection support: if defined data object's CRS will be
-	  inherited.
-
-2010-08-24 23:02  reklov_w
-
-	* oops, my configure.in contained to build the las import module;
-	  removed
-
-2010-08-24 22:58  reklov_w
-
-	* reverted to build ta_compond library on linux by default because
-	  the change does not work (segfaults with saga_cmd,strange
-	  behaviour in the GUI; seems like the module libs the module
-	  depends on do not get loaded correctly
-
-2010-08-22 23:02  reklov_w
-
-	* fix kernel bug (not all cells processed) and optimization
-
-2010-08-13 08:08  johanvdw
-
-	* Add support for MacOSX dylib dynamic libraries
-
-2010-08-10 14:32  reklov_w
-
-	* export xyz: added the possibility to exclude NoData cells from
-	  the output
-
-2010-07-30 08:20  johanvdw
-
-	* Add module description (from Sextante)
-
-2010-07-22 12:47  johanvdw
-
-	* Changes to enable building dist target
-
-2010-07-19 15:43  oconrad
-
-	* no message
-
-2010-07-13 16:08  oconrad
-
-	* no message
-
-2010-07-13 13:56  oconrad
-
-	* modules: seeds & region growing algorithm (obia)
-
-2010-07-08 15:08  johanvdw
-
-	* Add manfiles for saga_gui and saga_cmd
-	  
-	  Remove unused version numbers from modules - continued
-
-2010-07-08 15:06  johanvdw
-
-	* Add manfiles for saga_gui and saga_cmd
-
-2010-07-08 14:53  johanvdw
-
-	* Update module search path for automake builds
-
-2010-07-08 14:23  johanvdw
-
-	* Update module description formatting
-
-2010-07-08 14:21  johanvdw
-
-	* Change workspace location to Shapes - Transect
-
-2010-07-08 14:18  johanvdw
-
-	* Add ruggedness to Makefile.am
-
-2010-07-08 14:11  johanvdw
-
-	* Remove unused so-versioning from modules
-	  
-	  By adding -avoid-version to ldflags
-
-2010-07-06 13:01  oconrad
-
-	* mainly first macos patches
-
-2010-07-05 08:07  oconrad
-
-	* plascencia fixes & ruggedness modules added
-
-2010-07-04 13:54  reklov_w
-
-	* bug fix and updates for import/export module (offset is already
-	  handled with liblas in case header info is correct)
-
-2010-07-03 21:11  reklov_w
-
-	* new LAS export module and updates for las import (now offset and
-	  scale is recognized and it is possible to skip the isValid()
-	  check that may fail with large scan angles (e.g. from MLS data)
-
-2010-07-01 10:03  reklov_w
-
-	* progress bar added
-
-2010-06-29 03:25  johanvdw
-
-	* Fix module html generation on unix
-
-2010-06-28 23:22  johanvdw
-
-	* Build using libharu if it is available in the system directories
-
-2010-06-28 23:17  johanvdw
-
-	* Build opencv-module on unix
-
-2010-06-24 12:25  oconrad
-
-	* no message
-
-2010-06-24 10:16  reklov_w
-
-	* bug fix for LUT classes fit
-
-2010-06-22 11:03  reklov_w
-
-	* bug fix (multiple module runs now correctly reset seleted
-	  attributes, LUT min/max now correctly set)
-
-2010-06-20 15:35  reklov_w
-
-	* new module 'cluster analysis for point clouds' added
-
-2010-06-18 12:11  reklov_w
-
-	* added new module 'Point Cloud Attribute Calculator' to makefiles
-
-2010-06-18 11:23  reklov_w
-
-	* added new module 'Point Cloud Attribute Calculator'
-
-2010-06-17 15:45  oconrad
-
-	* no message
-
-2010-06-15 13:16  oconrad
-
-	* CSG_String::asDouble() works now also on not null terminated
-	  number strings
-
-2010-06-10 18:59  johanvdw
-
-	* contrib_t_wutzler: various fixes to compile with gcc 4.4
-
-2010-06-10 16:33  oconrad
-
-	* no message
-
-2010-06-08 15:04  johanvdw
-
-	* Add version number to shared library sonames
-
-2010-06-04 15:24  oconrad
-
-	* no message
-
-2010-05-31 13:05  oconrad
-
-	* saga_cmd: mlb_interface is recognised again
-
-2010-05-28 16:49  oconrad
-
-	* no message
-
-2010-05-28 09:18  oconrad
-
-	* csg_pointcloud: load/save bug fix
-	  geogr. weighted regression: support for no data table values
-	  saga_cmd: general flags (silent mode etc.); module path detection
-
-2010-05-26 08:34  oconrad
-
-	* saga_gui/parameters_control.cpp: gcc compilation error fixed
-
-2010-05-21 14:46  oconrad
-
-	* various modules: recognising table's no-data values
-	  gui: search for attributes
-	  api: point cloud selection (alpha stage)
-	  odbc: improvements (constraints have still to be added)
-
-2010-05-19 13:46  reklov_w
-
-	* revert last change
-
-2010-05-19 13:36  reklov_w
-
-	* wx2.8.11 with msvc9 unicode compilation (64-bit)
-
-2010-05-19 13:17  reklov_w
-
-	* fix day2month conversion
-
-2010-05-19 08:41  reklov_w
-
-	* fix access violation with method "absolute" if stddev grid is not
-	  created
-
-2010-05-18 11:32  oconrad
-
-	* no message
-
-2010-05-18 11:31  oconrad
-
-	* wx2.8.11 with msvc9 unicode compilation (32-bit)
-
-2010-05-12 12:54  oconrad
-
-	* csg_pointcloud::del_point() bug fix
-
-2010-05-10 13:26  oconrad
-
-	* no message
-
-2010-05-07 14:27  oconrad
-
-	* no message
-
-2010-05-06 13:41  reklov_w
-
-	* fixing unicode string handling in module library description
-
-2010-05-06 12:56  oconrad
-
-	* no message
-
-2010-05-06 07:47  reklov_w
-
-	* enabled build of ta_compound by default (linux)
-
-2010-04-29 16:06  oconrad
-
-	* no message
-
-2010-04-28 23:32  reklov_w
-
-	* language files updated to match cvs
-
-2010-04-28 15:27  reklov_w
-
-	* added classification support (min/max, stddev) for pointclouds
-
-2010-04-28 14:23  reklov_w
-
-	* added Display Color Classification Type RGB for pointclouds
-
-2010-04-28 13:07  reklov_w
-
-	* moved dialog parameters for "AREA" from constructor to on_execute
-	  to fix "invalid parameter" bug in non-interactive version
-
-2010-04-27 08:51  reklov_w
-
-	* activated ODBC support on linux; this adds a new dependency on
-	  unixODBC
-
-2010-04-26 07:37  oconrad
-
-	* no message
-
-2010-04-26 07:18  oconrad
-
-	* no message
-
-2010-04-23 22:13  reklov_w
-
-	* fix R,G,B, datatypes (now SG_DATATYPE_Int) to prevent overflow
-
-2010-04-21 08:58  reklov_w
-
-	* fix to support point cloud export correctly (before fix, x and y
-	  were written twice to the table)
-
-2010-04-20 16:21  oconrad
-
-	* no message
-
-2010-04-20 10:50  oconrad
-
-	* no message
-
-2010-04-20 10:49  oconrad
-
-	* improved triangulation algorithm (stl import, interpolation)
-
-2010-04-20 07:46  johanvdw
-
-	* Update Protection Index description
-	  
-	  Based on input from a discussion on:
-	  http://sourceforge.net/projects/saga-gis/forums/forum/790705/topic/3674186
-
-2010-04-19 07:27  reklov_w
-
-	* new module pc thinning (simple) added
-
-2010-04-18 18:26  reklov_w
-
-	* fix Del_Point(), bug caused heap corruption in _Dec_Array()
-
-2010-04-16 20:27  reklov_w
-
-	* fix wrong 64bit build configurations, corrected
-	  _SAGA_ODBC_EXPORTS
-
-2010-04-16 16:08  oconrad
-
-	* no message
-
-2010-04-16 15:33  reklov_w
-
-	* fix wrong 64bit build configurations
-
-2010-04-15 09:14  oconrad
-
-	* saga grid ascii import: bug fixed
-
-2010-04-14 19:45  reklov_w
-
-	* SAGA treats xmin/ymin as "pixel-as-point" and not as
-	  "pixel-as-area"
-
-2010-04-14 13:07  oconrad
-
-	* no message
-
-2010-04-06 19:27  reklov_w
-
-	* fix bug in aspect calculation
-
-2010-03-26 12:09  oconrad
-
-	* no message
-
-2010-03-26 11:43  oconrad
-
-	* no message
-
-2010-03-25 16:47  oconrad
-
-	* no message
-
-2010-03-25 16:37  oconrad
-
-	* no message
-
-2010-03-25 16:36  oconrad
-
-	* saga_odbc: new additional api library for database (via odbc)
-	  access
-	  changed io_odbc module library (previous name io_odbc_otl)
-
-2010-03-25 09:23  johanvdw
-
-	* Update modules/shapefiles to include shapes transect
-
-2010-03-25 09:20  johanvdw
-
-	* New module: Create transect through polygons map
-	  
-	  Transect for lines and polygon shapefiles
-	  
-	  The goal of this module is to create a transect along a line
-	  through a
-	  polygon map.
-	  Eg
-	  
-	  |____ST1_____!_ST2_!__ST1__!_______ST#_____|
-	  
-	  (Soil type 1 etc...)
-	  
-	  This is done by creating a table with the ID of each line, the
-	  distance
-	  to the starting point and the different transects:
-	  
-	  | line_id | start | end | code/field |
-	  | 0 | 0 | 124 | ST1 |
-	  | 0 | 124 | 300 | ST2 |
-	  | 0 | 300 | 1223 | ST1 |
-	  | 0 | 1223 | 2504 | ST3 |
-	  | 1 | 0 | 200 | ST4 |
-	  | ... | ... | ... | ... |
-	  
-	  The module requires an input shape with all the line transects
-	  [Transect_Line] and a polygon theme [Theme]. You also have to
-	  select
-	  which field you want to have in the resulting table
-	  [Transect_Result].
-	  This can be an ID of the polygon theme if you want to link the
-	  tables
-	  later on, or any other field [Theme_Field].
-
-2010-03-24 08:24  oconrad
-
-	* saga_api serious bug fix: csg_string::printf() used without
-	  argument list leads potentially to program crash
-
-2010-03-24 08:22  oconrad
-
-	* saga_gui bug fix: deep map window zoom freezes saga
-	  lectures_introduction bug fix: choices list
-	  gridsfromtableandgrid module enhanced
-	  gsgrid_zonal_statistics: field names optionally with full length
-
-2010-03-24 08:18  oconrad
-
-	* flat_detection module added
-
-2010-03-22 10:14  johanvdw
-
-	* Update SG_FPRINTF to work with gcc unicode
-	  
-	  Before the fix running saga_cmd without arguments and without
-	  library
-	  directory would yield:
-	  e:n
-	  afterwards:
-	  error: no valid module library found in path [...]
-	  
-	  this error started after the silent mode was introduced
-	  (11-1-2010)
-
-2010-03-18 10:03  oconrad
-
-	* io_gdal/io_grid_image: rotation/scaling support
-
-2010-03-17 19:38  oconrad
-
-	* no message
-
-2010-03-16 16:10  oconrad
-
-	* saga_api: projections support (not finished yet)
-	  io_grid_image: world file scaling/rotation support
-
-2010-03-16 09:47  oconrad
-
-	* module added to grid_tools: proximity grid calculation
-
-2010-03-16 09:21  reklov_w
-
-	* added error checking for formula and fixed bugs (pointer to
-	  uninitialized vector)
-
-2010-03-15 17:04  oconrad
-
-	* csg_grid index creation error not properly handled in catchment
-	  area calculation
-
-2010-03-15 15:21  oconrad
-
-	* serious bug fix: dbase string fields must have a size > 0 on
-	  initialisation
-
-2010-03-15 15:19  oconrad
-
-	* missing implementation of csg_file::set_unicodemode() (caused
-	  error in swig/python build)
-
-2010-03-15 15:16  oconrad
-
-	* no message
-
-2010-03-15 12:51  reklov_w
-
-	* added x64 build targets to visual studio projects
-
-2010-03-15 12:47  reklov_w
-
-	* added visual studio solution file and x64 build targets to zip
-
-2010-03-14 17:11  oconrad
-
-	* no message
-
-2010-03-11 14:38  reklov_w
-
-	* add point clouds to all recognized types on load
-
-2010-03-09 22:43  reklov_w
-
-	* fix previous change "Fix memory leak"
-
-2010-03-05 19:46  johanvdw
-
-	* Fix memory leak
-
-2010-03-04 16:17  oconrad
-
-	* file: case sensitvity problem
-
-2010-03-04 15:35  oconrad
-
-	* api: serious bug in csg_table_record::assign fixed
-	  api: csg_table_value_binary added
-	  minor bug fixes and enhancements: io_db_otl,
-	  geostatistics_regression...
-
-2010-03-03 19:11  oconrad
-
-	* api: csg_bytes (helper class for byte array handling)
-	  api: csg_shapes_ogis_convert (conversion from/to opengis wkb/wkt)
-	  module library: io_db_odbc added (replaces wxodbc based modules,
-	  alpha)
-
-2010-03-02 10:07  johanvdw
-
-	* Fix Tip of the day for Automake installations
-
-2010-03-01 16:46  oconrad
-
-	* no message
-
-2010-02-25 17:16  oconrad
-
-	* no message
-
-2010-02-23 17:00  oconrad
-
-	* no message
-
-2010-02-22 16:22  oconrad
-
-	* modules for variogram analysis
-	  minor bug fixes (xyz import, spline filled gaps, table view)
-
-2010-02-18 08:36  reklov_w
-
-	* applied Patches item #2953685 provided by Johan Van de Wauw
-	  fixing missing duplicate of start and end point
-
-2010-02-17 13:27  oconrad
-
-	* grid tool modules added:
-	  - grid_mask
-	  - close gaps with spline
-
-2010-02-15 16:51  oconrad
-
-	* modules added: geographically weighted regression (multi/grid
-	  support)
-
-2010-02-13 22:38  reklov_w
-
-	* DTM Filter (slope-based) module added
-
-2010-02-12 16:39  oconrad
-
-	* no message
-
-2010-02-11 17:21  oconrad
-
-	* added module: geographically weighted regression
-
-2010-02-11 17:19  oconrad
-
-	* module bug: pit_eliminator
-	  improved: geographically weighted regression
-
-2010-02-09 17:02  oconrad
-
-	* simplified and unified grid target selector helper class for
-	  parameters
-
-2010-02-03 18:07  oconrad
-
-	* 2 statistic modules added;
-	  supervised classification improved/added functions
-	  sink filling minimum slope
-	  saga_cmd point cloud support
-	  saga_api csg_table::add_field java compatibility
-
-2010-01-29 11:51  oconrad
-
-	* no message
-
-2010-01-29 09:18  oconrad
-
-	* no conio.h under linux
-
-2010-01-28 09:28  oconrad
-
-	* saga_cmd: silent mode
-	  saga_api: thin plate spline
-	  saga_gui: middle mouse pan in zoom mode, 3d view focus
-
-2010-01-25 15:50  oconrad
-
-	* grid: dynamic rgb overlay; esri ascii export
-
-2010-01-19 14:49  oconrad
-
-	* grid history, imagery lib removed from linux am (temporarily),
-	  majority filter added
-
-2010-01-18 17:14  oconrad
-
-	* grid (sort, no data values), parameter & gui
-
-2010-01-18 08:27  oconrad
-
-	* 3d shapefile import
-
-2010-01-15 15:09  oconrad
-
-	* no message
-
-2010-01-15 08:37  reklov_w
-
-	* interactive version now allows to digitize polygon, both versions
-	  support inverse selection
-
-2010-01-15 08:36  reklov_w
-
-	* added transform point cloud module
-
-2010-01-08 13:46  oconrad
-
-	* no message
-
-2010-01-07 15:11  reklov_w
-
-	* modules 'drop attribute' and 'reclass/extract' added
-
-2010-01-06 08:35  oconrad
-
-	* linux unicode problem when saving esri ascii grid
-
-2010-01-06 08:33  oconrad
-
-	* gcc compiler error fixed
-
-2009-12-16 13:07  oconrad
-
-	* no message
-
-2009-12-16 10:29  oconrad
-
-	* no message
-
-2009-12-15 16:52  oconrad
-
-	* no message
-
-2009-12-11 14:52  oconrad
-
-	* no message
-
-2009-12-11 14:15  oconrad
-
-	* no message
-
-2009-12-11 14:09  oconrad
-
-	* no message
-
-2009-12-11 13:54  oconrad
-
-	* no message
-
-2009-12-09 09:31  reklov_w
-
-	* added
-
-2009-12-04 15:57  oconrad
-
-	* no message
-
-2009-11-30 10:13  reklov_w
-
-	* fix wrong parameter identifier (and thus access violation)
-
-2009-11-27 15:26  oconrad
-
-	* no message
-
-2009-11-27 08:06  reklov_w
-
-	* fix for linux unicode support
-
-2009-11-26 15:42  oconrad
-
-	* no message
-
-2009-11-26 08:29  reklov_w
-
-	* finish support of comma as decimal separator in esri ascii import
-
-2009-11-25 08:53  oconrad
-
-	* no message
-
-2009-11-24 14:04  oconrad
-
-	* no message
-
-2009-11-24 10:27  oconrad
-
-	* no message
-
-2009-11-24 09:53  reklov_w
-
-	* fix naming when saving sequence
-
-2009-11-23 16:55  oconrad
-
-	* no message
-
-2009-11-23 16:36  oconrad
-
-	* no message
-
-2009-11-21 14:49  reklov_w
-
-	* updated Get_Shape() to return point
-
-2009-11-21 14:48  reklov_w
-
-	* updated Get_Value() to report z-values
-
-2009-11-20 07:23  reklov_w
-
-	* fix to compile with gcc (typecast added)
-
-2009-11-18 18:13  oconrad
-
-	* no message
-
-2009-11-18 16:31  reklov_w
-
-	* updated _Set_Table_Field() for point cloud support
-
-2009-11-18 16:30  reklov_w
-
-	* updated Add_Table_Field() for point cloud support
-
-2009-11-18 15:27  reklov_w
-
-	* option to calculate statistics on aspect grid added
-
-2009-11-17 10:24  oconrad
-
-	* no message
-
-2009-11-17 09:23  reklov_w
-
-	* fix esri ascci export "zero precision" problem with negative
-	  numbers and xmin/ymin precision in header
-
-2009-11-17 08:45  reklov_w
-
-	* remove unneccessary line
-
-2009-11-17 08:27  oconrad
-
-	* no message
-
-2009-11-17 08:03  reklov_w
-
-	* bug fix (nodata)
-
-2009-11-16 15:24  reklov_w
-
-	* limit output table field names to 10 characters to match dxf
-
-2009-11-16 14:31  reklov_w
-
-	* fix for file selection parameter
-
-2009-11-16 11:22  reklov_w
-
-	* pointcloud from text file module added
-
-2009-11-13 15:36  oconrad
-
-	* no message
-
-2009-11-06 13:35  oconrad
-
-	* no message
-
-2009-11-06 12:24  oconrad
-
-	* no message
-
-2009-11-05 16:40  reklov_w
-
-	* fixed get_attribute_count and others to omit x,y,z fields
-
-2009-11-01 11:37  reklov_w
-
-	* bug fix: variance was calculated instead of devdev and percentile
-	  was calculated with n-1 instead of n
-
-2009-10-29 20:22  reklov_w
-
-	* fixed missing link to liblas
-
-2009-10-29 19:46  reklov_w
-
-	* fixed to compile on linux
-
-2009-10-27 12:42  reklov_w
-
-	* if saga_gui.ini and .cfg can't be written to startup dir, they're
-	  now placed into the user directory
-
-2009-10-20 07:41  oconrad
-
-	* no message
-
-2009-10-08 16:37  oconrad
-
-	* no message
-
-2009-10-06 15:33  oconrad
-
-	* no message
-
-2009-10-02 15:21  oconrad
-
-	* no message
-
-2009-10-02 15:07  oconrad
-
-	* no message
-
-2009-10-02 11:48  oconrad
-
-	* no message
-
-2009-10-02 09:48  oconrad
-
-	* no message
-
-2009-10-02 07:58  oconrad
-
-	* no message
-
-2009-10-01 16:18  oconrad
-
-	* no message
-
-2009-10-01 15:50  oconrad
-
-	* no message
-
-2009-10-01 14:01  oconrad
-
-	* no message
-
-2009-09-30 18:00  oconrad
-
-	* no message
-
-2009-09-25 15:47  oconrad
-
-	* no message
-
-2009-09-25 12:02  oconrad
-
-	* no message
-
-2009-09-24 16:23  oconrad
-
-	* no message
-
-2009-09-23 09:10  reklov_w
-
-	* datatype definition updates
-
-2009-09-23 09:10  reklov_w
-
-	* removed obsolete file
-
-2009-09-22 16:19  oconrad
-
-	* no message
-
-2009-09-21 15:42  reklov_w
-
-	* module description updated
-
-2009-09-21 15:40  reklov_w
-
-	* changes to use liblas c++ api and other stuff
-
-2009-09-21 15:40  reklov_w
-
-	* changes to reflect liblas build from mercurial/trunk
-
-2009-09-18 14:14  oconrad
-
-	* no message
-
-2009-09-16 12:11  oconrad
-
-	* no message
-
-2009-09-15 16:51  oconrad
-
-	* no message
-
-2009-09-15 14:50  reklov_w
-
-	* fix typo in SWIG #def
-
-2009-09-14 11:15  reklov_w
-
-	* remove old/add new files to reflect module updates
-
-2009-09-11 15:22  oconrad
-
-	* no message
-
-2009-09-10 16:17  oconrad
-
-	* no message
-
-2009-09-09 17:13  oconrad
-
-	* no message
-
-2009-09-08 15:45  oconrad
-
-	* no message
-
-2009-09-08 14:32  oconrad
-
-	* no message
-
-2009-09-07 13:55  oconrad
-
-	* no message
-
-2009-09-07 09:39  oconrad
-
-	* no message
-
-2009-09-02 15:20  oconrad
-
-	* no message
-
-2009-09-01 14:47  oconrad
-
-	* no message
-
-2009-09-01 14:15  oconrad
-
-	* no message
-
-2009-09-01 14:07  oconrad
-
-	* no message
-
-2009-08-28 15:30  oconrad
-
-	* no message
-
-2009-08-28 15:21  oconrad
-
-	* no message
-
-2009-08-28 15:13  oconrad
-
-	* no message
-
-2009-08-27 15:57  oconrad
-
-	* no message
-
-2009-08-26 15:15  oconrad
-
-	* no message
-
-2009-08-25 14:36  oconrad
-
-	* no message
-
-2009-08-24 16:28  oconrad
-
-	* no message
-
-2009-08-21 16:03  oconrad
-
-	* no message
-
-2009-08-20 17:36  reklov_w
-
-	* updates for better nodata handling
-
-2009-08-20 17:18  reklov_w
-
-	* bug fixes for wrong parameter query and computations
-
-2009-08-19 16:58  oconrad
-
-	* no message
-
-2009-08-18 08:11  oconrad
-
-	* no message
-
-2009-08-17 13:15  oconrad
-
-	* no message
-
-2009-08-17 13:03  oconrad
-
-	* no message
-
-2009-08-17 13:01  oconrad
-
-	* no message
-
-2009-08-14 11:11  reklov_w
-
-	* added support to use only selected polygons for clipping
-
-2009-08-06 07:33  oconrad
-
-	* no message
-
-2009-07-24 13:03  oconrad
-
-	* no message
-
-2009-07-23 15:54  oconrad
-
-	* no message
-
-2009-07-20 12:34  reklov_w
-
-	* update swig for pointcloud.h
-
-2009-07-19 19:04  reklov_w
-
-	* now calculates true mean of overlapping grids
-
-2009-07-19 19:02  reklov_w
-
-	* now allows to set the value with which the dummy grid is
-	  initialized
-
-2009-07-19 13:11  reklov_w
-
-	* hack for Name on linux unicode
-
-2009-07-19 12:49  reklov_w
-
-	* removed backslash
-
-2009-07-19 12:47  reklov_w
-
-	* adaptions for linux
-
-2009-07-19 12:44  reklov_w
-
-	* adaption for linux
-
-2009-07-19 12:41  reklov_w
-
-	* added pointcloud
-
-2009-07-19 12:34  reklov_w
-
-	* removed io_table_odbc
-
-2009-07-19 12:32  reklov_w
-
-	* pointcloud_from_file added
-
-2009-07-19 12:29  reklov_w
-
-	* updated for las
-
-2009-07-19 12:25  reklov_w
-
-	* added io_shapes_las
-
-2009-07-19 12:23  reklov_w
-
-	* added io_shapes_las and removed io_table_odbc
-
-2009-07-17 10:52  oconrad
-
-	* no message
-
-2009-07-16 17:00  oconrad
-
-	* no message
-
-2009-07-03 20:14  reklov_w
-
-	* bugfix for TTVI calculation
-
-2009-07-02 07:56  reklov_w
-
-	* changes from Johan Van de Wauw to make it compile under linux
-
-2009-06-24 14:58  oconrad
-
-	* no message
-
-2009-06-11 16:18  oconrad
-
-	* no message
-
-2009-06-11 13:08  oconrad
-
-	* no message
-
-2009-06-10 17:11  oconrad
-
-	* no message
-
-2009-06-05 12:00  oconrad
-
-	* no message
-
-2009-05-28 13:08  oconrad
-
-	* no message
-
-2009-05-27 17:31  oconrad
-
-	* no message
-
-2009-05-27 16:01  oconrad
-
-	* no message
-
-2009-05-20 13:42  oconrad
-
-	* no message
-
-2009-05-15 12:17  oconrad
-
-	* no message
-
-2009-05-14 15:51  oconrad
-
-	* no message
-
-2009-05-14 13:26  oconrad
-
-	* no message
-
-2009-05-14 12:37  reklov_w
-
-	* optionally allow to flood nodata
-
-2009-05-13 15:26  oconrad
-
-	* no message
-
-2009-04-29 14:32  oconrad
-
-	* no message
-
-2009-04-29 14:01  oconrad
-
-	* no message
-
-2009-04-28 16:31  oconrad
-
-	* no message
-
-2009-04-07 20:08  reklov_w
-
-	* allows now the setting of a palette when used without GUI
-
-2009-04-07 13:47  oconrad
-
-	* no message
-
-2009-04-02 11:12  oconrad
-
-	* no message
-
-2009-04-01 14:34  oconrad
-
-	* no message
-
-2009-03-31 10:40  oconrad
-
-	* no message
-
-2009-03-30 14:00  oconrad
-
-	* no message
-
-2009-03-27 17:16  oconrad
-
-	* no message
-
-2009-03-27 13:39  oconrad
-
-	* no message
-
-2009-03-25 10:37  oconrad
-
-	* no message
-
-2009-03-24 16:37  oconrad
-
-	* no message
-
-2009-03-17 12:32  reklov_w
-
-	* typo fixed to make quadtree_structure compile on linux
-
-2009-03-15 11:49  reklov_w
-
-	* update for correct postbuild *.lng copy
-
-2009-03-13 16:24  oconrad
-
-	* no message
-
-2009-03-11 15:28  oconrad
-
-	* no message
-
-2009-03-11 15:08  oconrad
-
-	* no message
-
-2009-03-04 09:16  reklov_w
-
-	* optionally grid only selected shapes
-
-2009-03-02 11:27  oconrad
-
-	* no message
-
-2009-02-25 17:26  oconrad
-
-	* no message
-
-2009-02-16 16:40  oconrad
-
-	* no message
-
-2009-02-13 15:50  reklov_w
-
-	* cut off file extension (.sgrd) in field names of output shape
-
-2009-02-10 16:11  reklov_w
-
-	* print out module usage when no module parameters are provided
-
-2009-02-06 17:00  oconrad
-
-	* no message
-
-2009-02-06 16:24  oconrad
-
-	* no message
-
-2009-02-06 16:08  oconrad
-
-	* no message
-
-2009-02-04 12:52  reklov_w
-
-	* io_table module added
-
-2009-02-04 12:51  reklov_w
-
-	* added
-
-2009-02-04 10:35  reklov_w
-
-	* postbuild copy of language files added
-
-2009-02-03 13:00  oconrad
-
-	* no message
-
-2009-01-30 16:33  oconrad
-
-	* no message
-
-2009-01-30 10:37  oconrad
-
-	* no message
-
-2009-01-29 15:44  oconrad
-
-	* no message
-
-2009-01-28 09:48  oconrad
-
-	* no message
-
-2009-01-27 16:00  oconrad
-
-	* no message
-
-2009-01-27 15:29  oconrad
-
-	* no message
-
-2009-01-27 13:56  oconrad
-
-	* no message
-
-2009-01-26 20:23  reklov_w
-
-	* typecast long to int
-
-2009-01-26 16:06  oconrad
-
-	* no message
-
-2009-01-26 15:59  oconrad
-
-	* no message
-
-2009-01-26 15:29  oconrad
-
-	* no message
-
-2009-01-19 14:01  oconrad
-
-	* no message
-
-2009-01-19 12:50  oconrad
-
-	* no message
-
-2009-01-19 11:01  oconrad
-
-	* no message
-
-2009-01-16 14:18  oconrad
-
-	* no message
-
-2009-01-13 16:15  oconrad
-
-	* no message
-
-2009-01-12 17:13  oconrad
-
-	* no message
-
-2009-01-12 15:22  oconrad
-
-	* no message
-
-2009-01-12 12:47  oconrad
-
-	* no message
-
-2009-01-12 12:47  oconrad
-
-	* patch for quantile calculation by K.Stricker
-
-2009-01-05 16:52  oconrad
-
-	* no message
-
-2008-12-29 02:47  reklov_w
-
-	* cut off grid file extension when used as attribute field name
-
-2008-12-29 02:45  reklov_w
-
-	* print warning if field type is string and uids are generated
-
-2008-12-18 15:44  oconrad
-
-	* no message
-
-2008-12-17 17:18  oconrad
-
-	* no message
-
-2008-12-17 10:02  oconrad
-
-	* no message
-
-2008-12-15 14:22  oconrad
-
-	* no message
-
-2008-12-08 00:42  reklov_w
-
-	* unicode fixes
-
-2008-12-07 23:48  reklov_w
-
-	* wxGTK/linux fixes
-
-2008-12-05 16:48  oconrad
-
-	* no message
-
-2008-12-02 14:10  reklov_w
-
-	* vc8 project update
-
-2008-12-02 14:09  reklov_w
-
-	* module parameter updates
-
-2008-12-01 13:51  oconrad
-
-	* no message
-
-2008-11-30 14:52  reklov_w
-
-	* unicode fixes
-
-2008-11-29 14:45  reklov_w
-
-	* unicode fixes
-
-2008-11-29 13:09  reklov_w
-
-	* unicode fixes
-
-2008-11-29 11:49  reklov_w
-
-	* GDALGetDriverByName uses Description not Metaname
-
-2008-11-24 10:36  oconrad
-
-	* topographic correction for satellite imagery
-
-2008-11-18 13:56  oconrad
-
-	* no message
-
-2008-11-15 16:31  reklov_w
-
-	* contact updated
-
-2008-11-15 16:28  reklov_w
-
-	* bug with doubly inserted zone ids solved, table cleanup before
-	  writing
-
-2008-10-14 16:05  oconrad
-
-	* no message
-
-2008-10-14 10:55  oconrad
-
-	* no message
-
-2008-10-09 21:16  reklov_w
-
-	* option added to optionally save the changes to the input
-	  shapefile
-
-2008-10-09 15:48  oconrad
-
-	* no message
-
-2008-10-07 11:34  oconrad
-
-	* no message
-
-2008-09-30 14:41  oconrad
-
-	* no message
-
-2008-09-30 13:34  oconrad
-
-	* no message
-
-2008-09-26 14:43  oconrad
-
-	* no message
-
-2008-09-26 11:28  oconrad
-
-	* no message
-
-2008-09-26 08:53  oconrad
-
-	* no message
-
-2008-09-25 14:12  oconrad
-
-	* no message
-
-2008-09-25 13:44  oconrad
-
-	* no message
-
-2008-09-23 15:37  oconrad
-
-	* no message
-
-2008-09-22 15:19  oconrad
-
-	* no message
-
-2008-09-19 14:01  oconrad
-
-	* no message
-
-2008-09-18 15:14  oconrad
-
-	* no message
-
-2008-09-17 12:22  oconrad
-
-	* no message
-
-2008-09-15 15:16  oconrad
-
-	* no message
-
-2008-09-15 10:48  oconrad
-
-	* no message
-
-2008-09-12 09:49  oconrad
-
-	* no message
-
-2008-09-11 15:23  oconrad
-
-	* no message
-
-2008-09-10 16:08  oconrad
-
-	* no message
-
-2008-09-09 10:37  oconrad
-
-	* no message
-
-2008-09-08 22:40  reklov_w
-
-	* saga_cmd -help text updated
-
-2008-09-08 13:57  oconrad
-
-	* no message
-
-2008-09-04 13:16  oconrad
-
-	* no message
-
-2008-09-03 15:29  oconrad
-
-	* no message
-
-2008-09-03 13:29  oconrad
-
-	* no message
-
-2008-08-21 10:29  oconrad
-
-	* no message
-
-2008-08-19 10:00  oconrad
-
-	* no message
-
-2008-07-25 13:55  oconrad
-
-	* no message
-
-2008-07-24 12:10  oconrad
-
-	* no message
-
-2008-07-24 11:53  oconrad
-
-	* no message
-
-2008-07-23 17:12  oconrad
-
-	* *** empty log message ***
-
-2008-07-23 16:55  oconrad
-
-	* *** empty log message ***
-
-2008-07-22 10:42  oconrad
-
-	* no message
-
-2008-07-21 10:12  oconrad
-
-	* no message
-
-2008-07-21 09:44  oconrad
-
-	* no message
-
-2008-07-21 09:31  oconrad
-
-	* no message
-
-2008-07-18 13:11  oconrad
-
-	* no message
-
-2008-07-18 12:12  oconrad
-
-	* no message
-
-2008-07-16 12:07  oconrad
-
-	* no message
-
-2008-07-16 11:50  oconrad
-
-	* no message
-
-2008-07-16 11:47  oconrad
-
-	* no message
-
-2008-07-15 14:57  oconrad
-
-	* *** empty log message ***
-
-2008-07-09 12:17  oconrad
-
-	* *** empty log message ***
-
-2008-06-26 13:18  oconrad
-
-	* no message
-
-2008-06-06 10:02  oconrad
-
-	* no message
-
-2008-06-06 08:37  oconrad
-
-	* *** empty log message ***
-
-2008-06-06 08:18  oconrad
-
-	* *** empty log message ***
-
-2008-06-06 08:10  oconrad
-
-	* *** empty log message ***
-
-2008-06-05 16:05  oconrad
-
-	* no message
-
-2008-06-05 15:57  oconrad
-
-	* no message
-
-2008-06-05 15:46  oconrad
-
-	* no message
-
-2008-06-05 09:05  oconrad
-
-	* no message
-
-2008-05-30 15:50  oconrad
-
-	* no message
-
-2008-05-29 13:15  oconrad
-
-	* no message
-
-2008-05-28 15:33  oconrad
-
-	* no message
-
-2008-05-28 15:22  oconrad
-
-	* no message
-
-2008-05-26 11:12  oconrad
-
-	* no message
-
-2008-05-23 10:13  oconrad
-
-	* no message
-
-2008-05-22 15:34  oconrad
-
-	* no message
-
-2008-05-22 14:48  oconrad
-
-	* no message
-
-2008-05-22 13:34  oconrad
-
-	* no message
-
-2008-05-22 12:19  oconrad
-
-	* no message
-
-2008-05-21 13:49  oconrad
-
-	* no message
-
-2008-05-21 12:35  oconrad
-
-	* no message
-
-2008-05-21 12:15  oconrad
-
-	* no message
-
-2008-05-21 10:46  oconrad
-
-	* no message
-
-2008-05-21 10:19  oconrad
-
-	* no message
-
-2008-05-14 10:47  oconrad
-
-	* no message
-
-2008-05-14 09:14  oconrad
-
-	* no message
-
-2008-05-13 21:58  oconrad
-
-	* no message
-
-2008-05-13 09:08  oconrad
-
-	* no message
-
-2008-05-09 15:20  oconrad
-
-	* *** empty log message ***
-
-2008-05-09 08:41  oconrad
-
-	* no message
-
-2008-05-06 16:35  oconrad
-
-	* no message
-
-2008-05-05 15:28  oconrad
-
-	* no message
-
-2008-04-24 16:04  oconrad
-
-	* no message
-
-2008-04-24 11:07  oconrad
-
-	* no message
-
-2008-04-22 09:44  oconrad
-
-	* no message
-
-2008-04-18 14:49  oconrad
-
-	* no message
-
-2008-04-18 14:40  oconrad
-
-	* no message
-
-2008-04-16 16:23  oconrad
-
-	* no message
-
-2008-04-09 16:28  oconrad
-
-	* no message
-
-2008-04-04 15:29  oconrad
-
-	* no message
-
-2008-04-03 10:57  oconrad
-
-	* no message
-
-2008-03-12 12:56  oconrad
-
-	* no message
-
-2008-03-12 12:23  oconrad
-
-	* no message
-
-2008-03-10 11:41  oconrad
-
-	* no message
-
-2008-03-07 17:19  oconrad
-
-	* no message
-
-2008-03-07 16:59  oconrad
-
-	* no message
-
-2008-03-07 16:36  oconrad
-
-	* no message
-
-2008-03-07 15:48  oconrad
-
-	* no message
-
-2008-03-07 15:31  oconrad
-
-	* no message
-
-2008-03-07 15:24  oconrad
-
-	* no message
-
-2008-03-07 15:17  oconrad
-
-	* no message
-
-2008-03-07 14:38  oconrad
-
-	* no message
-
-2008-03-07 14:32  oconrad
-
-	* no message
-
-2008-03-06 16:26  oconrad
-
-	* no message
-
-2008-03-06 15:47  oconrad
-
-	* no message
-
-2008-03-05 09:42  oconrad
-
-	* *** empty log message ***
-
-2008-03-05 09:28  oconrad
-
-	* *** empty log message ***
-
-2008-02-28 16:19  oconrad
-
-	* no message
-
-2008-02-27 17:05  oconrad
-
-	* no message
-
-2008-02-26 16:39  oconrad
-
-	* no message
-
-2008-02-26 14:31  oconrad
-
-	* *** empty log message ***
-
-2008-02-25 15:42  oconrad
-
-	* no message
-
-2008-02-22 15:31  oconrad
-
-	* no message
-
-2008-02-15 14:37  oconrad
-
-	* no message
-
-2008-02-12 16:19  oconrad
-
-	* no message
-
-2008-02-06 11:24  oconrad
-
-	* no message
-
-2008-02-01 14:33  oconrad
-
-	* no message
-
-2008-01-30 16:02  oconrad
-
-	* no message
-
-2008-01-30 09:52  oconrad
-
-	* no message
-
-2008-01-29 16:19  oconrad
-
-	* no message
-
-2008-01-28 16:38  oconrad
-
-	* no message
-
-2008-01-25 17:03  oconrad
-
-	* no message
-
-2008-01-24 16:16  oconrad
-
-	* no message
-
-2008-01-22 16:54  oconrad
-
-	* no message
-
-2008-01-22 15:55  oconrad
-
-	* no message
-
-2008-01-22 10:56  oconrad
-
-	* no message
-
-2008-01-21 15:39  oconrad
-
-	* no message
-
-2008-01-21 08:48  oconrad
-
-	* no message
-
-2008-01-18 15:26  oconrad
-
-	* no message
-
-2008-01-18 15:19  oconrad
-
-	* no message
-
-2008-01-18 15:07  oconrad
-
-	* no message
-
-2008-01-18 14:26  oconrad
-
-	* no message
-
-2008-01-18 14:10  oconrad
-
-	* no message
-
-2008-01-18 13:55  oconrad
-
-	* no message
-
-2008-01-16 10:12  oconrad
-
-	* no message
-
-2008-01-15 10:46  oconrad
-
-	* no message
-
-2008-01-14 15:32  oconrad
-
-	* no message
-
-2008-01-11 14:19  oconrad
-
-	* no message
-
-2008-01-11 12:37  oconrad
-
-	* no message
-
-2008-01-10 16:48  oconrad
-
-	* no message
-
-2008-01-09 17:23  oconrad
-
-	* no message
-
-2008-01-08 16:47  oconrad
-
-	* no message
-
-2008-01-07 17:09  oconrad
-
-	* no message
-
-2008-01-04 15:27  oconrad
-
-	* no message
-
-2008-01-03 09:45  oconrad
-
-	* no message
-
-2007-11-21 17:16  oconrad
-
-	* no message
-
-2007-11-14 11:54  oconrad
-
-	* no message
-
-2007-11-13 17:26  oconrad
-
-	* no message
-
-2007-11-08 10:53  oconrad
-
-	* no message
-
-2007-11-06 15:52  oconrad
-
-	* no message
-
-2007-10-31 11:44  oconrad
-
-	* no message
-
-2007-10-24 10:25  oconrad
-
-	* no message
-
-2007-10-23 13:23  oconrad
-
-	* *** empty log message ***
-
-2007-10-23 11:12  oconrad
-
-	* *** empty log message ***
-
-2007-10-19 13:03  oconrad
-
-	* no message
-
-2007-10-12 13:54  oconrad
-
-	* no message
-
-2007-10-10 15:53  oconrad
-
-	* no message
-
-2007-10-08 15:31  oconrad
-
-	* no message
-
-2007-10-04 14:15  oconrad
-
-	* no message
-
-2007-10-02 14:59  oconrad
-
-	* no message
-
-2007-10-02 13:14  oconrad
-
-	* no message
-
-2007-10-02 11:50  oconrad
-
-	* no message
-
-2007-10-02 10:34  oconrad
-
-	* no message
-
-2007-10-01 11:24  oconrad
-
-	* no message
-
-2007-09-25 14:19  oconrad
-
-	* no message
-
-2007-09-25 14:12  oconrad
-
-	* no message
-
-2007-09-25 14:04  oconrad
-
-	* no message
-
-2007-09-24 15:22  oconrad
-
-	* no message
-
-2007-09-22 11:34  reklov_w
-
-	* no message
-
-2007-09-20 15:50  oconrad
-
-	* *** empty log message ***
-
-2007-09-20 15:09  oconrad
-
-	* no message
-
-2007-09-20 14:41  oconrad
-
-	* no message
-
-2007-09-18 11:49  tschorr
-
-	* added initial grib2 import
-
-2007-08-27 10:49  oconrad
-
-	* no message
-
-2007-08-03 11:37  oconrad
-
-	* no message
-
-2007-08-01 13:59  oconrad
-
-	* no message
-
-2007-08-01 13:46  oconrad
-
-	* no message
-
-2007-08-01 09:42  oconrad
-
-	* no message
-
-2007-07-31 13:06  oconrad
-
-	* no message
-
-2007-07-30 07:29  oconrad
-
-	* no message
-
-2007-07-24 12:18  oconrad
-
-	* no message
-
-2007-07-09 14:37  oconrad
-
-	* no message
-
-2007-07-06 11:17  tschorr
-
-	* removed dependency to libgrid_tools.so
-
-2007-07-06 10:07  tschorr
-
-	* cleanup
-
-2007-07-06 08:46  tschorr
-
-	* fixed modules menu (bug #1743837)
-
-2007-07-06 08:14  tschorr
-
-	* fixed modules menu (bug #1743837)
-
-2007-07-03 10:30  tschorr
-
-	* fixed bug #1742774
-
-2007-07-03 10:20  tschorr
-
-	* fixed bug #1737698
-
-2007-06-27 14:20  oconrad
-
-	* no message
-
-2007-06-08 13:02  oconrad
-
-	* no message
-
-2007-06-06 14:15  oconrad
-
-	* no message
-
-2007-05-23 09:04  tschorr
-
-	* changed version to 2.0
-
-2007-05-18 09:55  oconrad
-
-	* no message
-
-2007-05-11 12:40  oconrad
-
-	* no message
-
-2007-05-08 08:28  oconrad
-
-	* no message
-
-2007-05-08 08:21  oconrad
-
-	* no message
-
-2007-05-04 14:50  oconrad
-
-	* no message
-
-2007-05-04 11:54  oconrad
-
-	* no message
-
-2007-05-04 10:34  oconrad
-
-	* no message
-
-2007-04-27 12:50  oconrad
-
-	* no message
-
-2007-04-23 14:38  oconrad
-
-	* no message
-
-2007-04-17 10:34  oconrad
-
-	* no message
-
-2007-04-16 15:29  oconrad
-
-	* no message
-
-2007-03-27 14:50  oconrad
-
-	* no message
-
-2007-03-27 10:55  oconrad
-
-	* no message
-
-2007-03-23 15:32  oconrad
-
-	* no message
-
-2007-03-23 10:49  oconrad
-
-	* no message
-
-2007-03-22 17:01  oconrad
-
-	* no message
-
-2007-03-22 14:24  oconrad
-
-	* no message
-
-2007-03-22 10:37  oconrad
-
-	* no message
-
-2007-03-12 11:13  oconrad
-
-	* no message
-
-2007-03-08 15:59  oconrad
-
-	* no message
-
-2007-03-07 16:48  oconrad
-
-	* no message
-
-2007-03-01 15:31  oconrad
-
-	* no message
-
-2007-02-28 16:44  oconrad
-
-	* no message
-
-2007-02-27 14:36  oconrad
-
-	* no message
-
-2007-02-27 13:46  oconrad
-
-	* no message
-
-2007-02-27 13:35  oconrad
-
-	* no message
-
-2007-02-27 11:46  oconrad
-
-	* no message
-
-2007-02-26 17:48  oconrad
-
-	* no message
-
-2007-02-23 16:02  oconrad
-
-	* no message
-
-2007-02-22 14:40  oconrad
-
-	* no message
-
-2007-02-13 13:08  tschorr
-
-	* *** empty log message ***
-
-2007-02-13 12:59  tschorr
-
-	* *** empty log message ***
-
-2007-02-13 12:49  tschorr
-
-	* *** empty log message ***
-
-2007-02-13 09:58  tschorr
-
-	* added -fPIC compiler flag
-
-2007-02-12 15:57  tschorr
-
-	* removed -fpermissive for x86_64
-
-2007-02-12 15:43  tschorr
-
-	* removed -fpermissive for x86_64
-
-2007-02-12 15:39  tschorr
-
-	* *** empty log message ***
-
-2007-02-12 15:35  tschorr
-
-	* removed -fpermissive for x86_64
-
-2007-02-12 14:16  tschorr
-
-	* fixed issue 1650599
-
-2007-02-09 13:03  oconrad
-
-	* no message
-
-2007-02-08 14:59  oconrad
-
-	* no message
-
-2007-02-07 15:25  oconrad
-
-	* no message
-
-2007-02-07 12:32  tschorr
-
-	* fixed definition of DWORD for x86_64
-
-2007-02-06 13:12  oconrad
-
-	* no message
-
-2007-02-06 12:42  oconrad
-
-	* no message
-
-2007-01-23 12:53  reklov_w
-
-	* no message
-
-2007-01-22 13:00  oconrad
-
-	* no message
-
-2007-01-22 11:38  oconrad
-
-	* no message
-
-2007-01-19 11:12  oconrad
-
-	* no message
-
-2007-01-17 06:27  tschorr
-
-	* Makefile.am
-
-2007-01-16 19:52  tschorr
-
-	* fixed AM_LDFLAGS for saga_cmd, saga_gui
-
-2007-01-16 15:52  tschorr
-
-	* fixed unicode=no for LDFLAGS
-
-2007-01-11 17:58  oconrad
-
-	* no message
-
-2007-01-11 14:05  tschorr
-
-	* --enable-unicode, --enable-debug support in configure
-
-2007-01-11 08:50  tschorr
-
-	* *** empty log message ***
-
-2007-01-11 08:43  tschorr
-
-	* *** empty log message ***
-
-2007-01-10 16:11  oconrad
-
-	* no message
-
-2007-01-10 13:20  oconrad
-
-	* no message
-
-2007-01-09 15:06  oconrad
-
-	* no message
-
-2007-01-09 11:41  oconrad
-
-	* no message
-
-2007-01-08 14:56  oconrad
-
-	* no message
-
-2007-01-08 13:13  oconrad
-
-	* no message
-
-2007-01-08 07:43  tschorr
-
-	* more wxGTK unicode fixes
-
-2007-01-05 16:39  tschorr
-
-	* fixed some wxGTK unicode issues
-
-2006-12-28 15:59  oconrad
-
-	* no message
-
-2006-12-21 17:09  oconrad
-
-	* no message
-
-2006-12-13 17:36  oconrad
-
-	* no message
-
-2006-12-13 15:34  oconrad
-
-	* no message
-
-2006-12-12 17:16  oconrad
-
-	* no message
-
-2006-12-12 13:57  oconrad
-
-	* no message
-
-2006-12-12 13:17  oconrad
-
-	* no message
-
-2006-12-12 11:25  oconrad
-
-	* no message
-
-2006-12-11 17:00  oconrad
-
-	* no message
-
-2006-12-08 09:50  oconrad
-
-	* UNICODE support
-
-2006-12-08 09:42  oconrad
-
-	* UNICODE support
-
-2006-12-08 09:29  oconrad
-
-	* UNICODE support
-
-2006-12-04 09:56  oconrad
-
-	* no message
-
-2006-11-30 12:29  oconrad
-
-	* no message
-
-2006-11-30 09:11  tschorr
-
-	* fixed gcc 4.1.1 extra qualification 'A::' on member 'A' error
-
-2006-11-29 13:39  tschorr
-
-	* changed some Makefile.ams to fix make dist
-
-2006-11-29 12:54  oconrad
-
-	* no message
-
-2006-11-27 17:22  oconrad
-
-	* no message
-
-2006-11-27 15:44  oconrad
-
-	* no message
-
-2006-11-24 16:26  oconrad
-
-	* no message
-
-2006-11-24 16:21  oconrad
-
-	* no message
-
-2006-11-23 13:50  oconrad
-
-	* no message
-
-2006-11-22 18:48  oconrad
-
-	* no message
-
-2006-11-22 17:49  oconrad
-
-	* no message
-
-2006-11-21 14:53  oconrad
-
-	* no message
-
-2006-11-21 10:53  oconrad
-
-	* no message
-
-2006-11-20 18:43  oconrad
-
-	* no message
-
-2006-11-20 15:18  oconrad
-
-	* no message
-
-2006-11-20 11:23  oconrad
-
-	* no message
-
-2006-11-17 15:18  oconrad
-
-	* no message
-
-2006-11-17 10:58  oconrad
-
-	* no message
-
-2006-11-16 16:34  oconrad
-
-	* no message
-
-2006-11-16 15:25  oconrad
-
-	* no message
-
-2006-11-15 20:04  oconrad
-
-	* no message
-
-2006-11-15 15:55  oconrad
-
-	* no message
-
-2006-11-14 14:41  oconrad
-
-	* no message
-
-2006-11-13 19:49  oconrad
-
-	* no message
-
-2006-11-10 17:11  oconrad
-
-	* no message
-
-2006-11-09 16:03  oconrad
-
-	* no message
-
-2006-11-08 14:03  oconrad
-
-	* no message
-
-2006-11-01 19:19  oconrad
-
-	* no message
-
-2006-10-31 13:33  oconrad
-
-	* no message
-
-2006-10-30 17:42  oconrad
-
-	* no message
-
-2006-10-29 18:07  oconrad
-
-	* no message
-
-2006-10-27 18:35  oconrad
-
-	* no message
-
-2006-10-27 16:30  oconrad
-
-	* no message
-
-2006-10-26 15:38  oconrad
-
-	* no message
-
-2006-10-26 10:37  oconrad
-
-	* no message
-
-2006-10-24 08:33  oconrad
-
-	* no message
-
-2006-10-23 18:21  oconrad
-
-	* no message
-
-2006-10-23 13:57  oconrad
-
-	* no message
-
-2006-10-23 13:38  oconrad
-
-	* no message
-
-2006-10-20 15:22  oconrad
-
-	* no message
-
-2006-10-19 18:13  oconrad
-
-	* no message
-
-2006-10-17 13:16  oconrad
-
-	* no message
-
-2006-10-16 16:00  oconrad
-
-	* no message
-
-2006-10-16 10:57  oconrad
-
-	* no message
-
-2006-09-30 14:28  oconrad
-
-	* no message
-
-2006-09-27 14:17  oconrad
-
-	* no message
-
-2006-09-09 12:17  oconrad
-
-	* no message
-
-2006-09-08 17:04  oconrad
-
-	* no message
-
-2006-09-04 18:06  oconrad
-
-	* no message
-
-2006-08-24 17:39  oconrad
-
-	* no message
-
-2006-08-24 14:18  oconrad
-
-	* no message
-
-2006-08-23 11:56  oconrad
-
-	* no message
-
-2006-08-21 17:13  oconrad
-
-	* no message
-
-2006-08-19 18:38  oconrad
-
-	* no message
-
-2006-08-19 14:21  oconrad
-
-	* no message
-
-2006-08-16 18:27  oconrad
-
-	* no message
-
-2006-08-06 13:27  oconrad
-
-	* no message
-
-2006-07-29 13:17  oconrad
-
-	* no message
-
-2006-07-29 12:57  oconrad
-
-	* no message
-
-2006-07-29 11:37  oconrad
-
-	* no message
-
-2006-07-28 16:02  oconrad
-
-	* no message
-
-2006-07-27 16:17  oconrad
-
-	* no message
-
-2006-07-24 14:40  oconrad
-
-	* no message
-
-2006-07-24 12:45  oconrad
-
-	* no message
-
-2006-07-24 12:37  oconrad
-
-	* no message
-
-2006-07-22 22:17  oconrad
-
-	* no message
-
-2006-07-22 21:56  oconrad
-
-	* no message
-
-2006-07-21 19:51  oconrad
-
-	* no message
-
-2006-07-21 19:03  oconrad
-
-	* no message
-
-2006-07-13 19:13  oconrad
-
-	* no message
-
-2006-07-12 18:51  oconrad
-
-	* no message
-
-2006-07-11 14:01  oconrad
-
-	* no message
-
-2006-07-10 17:36  oconrad
-
-	* no message
-
-2006-07-10 12:03  oconrad
-
-	* no message
-
-2006-07-10 08:53  oconrad
-
-	* no message
-
-2006-06-30 12:43  oconrad
-
-	* no message
-
-2006-06-29 17:45  oconrad
-
-	* no message
-
-2006-06-29 15:19  oconrad
-
-	* no message
-
-2006-06-28 14:11  oconrad
-
-	* no message
-
-2006-06-28 13:51  oconrad
-
-	* no message
-
-2006-06-26 15:43  oconrad
-
-	* no message
+http://sourceforge.net/p/saga-gis/wiki/SAGA%20Release%20Information/
 
diff --git a/README b/README
index 9467f7a..3a0421a 100644
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
 _______________________________________________________________________________
 
-         SAGA 2.1.4 - System for Automated Geoscientific Analyses
+         SAGA 2.2.0 - System for Automated Geoscientific Analyses
 _______________________________________________________________________________
 
 * Introduction
diff --git a/configure b/configure
index f5aec2f..5fef9a7 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for saga 2.1.4.
+# Generated by GNU Autoconf 2.69 for saga 2.2.0.
 #
 # Report bugs to <BUG-REPORT-ADDRESS>.
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='saga'
 PACKAGE_TARNAME='saga'
-PACKAGE_VERSION='2.1.4'
-PACKAGE_STRING='saga 2.1.4'
+PACKAGE_VERSION='2.2.0'
+PACKAGE_STRING='saga 2.2.0'
 PACKAGE_BUGREPORT='BUG-REPORT-ADDRESS'
 PACKAGE_URL=''
 
@@ -1380,7 +1380,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures saga 2.1.4 to adapt to many kinds of systems.
+\`configure' configures saga 2.2.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1450,7 +1450,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of saga 2.1.4:";;
+     short | recursive ) echo "Configuration of saga 2.2.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1571,7 +1571,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-saga configure 2.1.4
+saga configure 2.2.0
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2115,7 +2115,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by saga $as_me 2.1.4, which was
+It was created by saga $as_me 2.2.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2982,7 +2982,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='saga'
- VERSION='2.1.4'
+ VERSION='2.2.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -18009,7 +18009,7 @@ $as_echo "$as_me: WARNING: cannot determine SWIG version" >&2;}
 
 fi
 #AC_CONFIG_FILES([Makefile])
-ac_config_files="$ac_config_files Makefile src/Makefile src/saga_core/Makefile src/saga_core/saga_api/Makefile src/saga_core/saga_gdi/Makefile src/saga_core/saga_gui/Makefile src/saga_core/saga_gui/man/Makefile src/saga_core/saga_cmd/Makefile src/saga_core/saga_cmd/man/Makefile src/modules/Makefile src/modules/climate/Makefile src/modules/climate/climate_tools/Makefile src/modules/contrib/Makefile src/modules/contrib/contrib_peregro/Makefile src/modules/db/Makefile src/modules/db/db_odbc [...]
+ac_config_files="$ac_config_files Makefile src/Makefile src/saga_core/Makefile src/saga_core/saga_api/Makefile src/saga_core/saga_gdi/Makefile src/saga_core/saga_gui/Makefile src/saga_core/saga_gui/man/Makefile src/saga_core/saga_cmd/Makefile src/saga_core/saga_cmd/man/Makefile src/modules/Makefile src/modules/climate/Makefile src/modules/climate/climate_tools/Makefile src/modules/contrib/Makefile src/modules/contrib/contrib_peregro/Makefile src/modules/db/Makefile src/modules/db/db_odbc [...]
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -18590,7 +18590,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by saga $as_me 2.1.4, which was
+This file was extended by saga $as_me 2.2.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -18656,7 +18656,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-saga config.status 2.1.4
+saga config.status 2.2.0
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -19201,6 +19201,7 @@ do
     "src/modules/imagery/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/imagery/Makefile" ;;
     "src/modules/imagery/imagery_classification/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/imagery/imagery_classification/Makefile" ;;
     "src/modules/imagery/imagery_opencv/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/imagery/imagery_opencv/Makefile" ;;
+    "src/modules/imagery/imagery_maxent/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/imagery/imagery_maxent/Makefile" ;;
     "src/modules/imagery/imagery_photogrammetry/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/imagery/imagery_photogrammetry/Makefile" ;;
     "src/modules/imagery/imagery_segmentation/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/imagery/imagery_segmentation/Makefile" ;;
     "src/modules/imagery/imagery_svm/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/imagery/imagery_svm/Makefile" ;;
diff --git a/configure.ac b/configure.ac
index de6efde..8c8b097 100755
--- a/configure.ac
+++ b/configure.ac
@@ -1,13 +1,13 @@
-# $Id: configure.ac 2324 2014-11-04 14:28:22Z oconrad $
+# $Id: configure.ac 2491 2015-05-18 06:48:00Z manfred-e $
 #                                               -*- Autoconf -*-
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.59)
-AC_INIT(saga, 2.1.4, BUG-REPORT-ADDRESS)
+AC_INIT(saga, 2.2.0, BUG-REPORT-ADDRESS)
 AC_CONFIG_SRCDIR([src/saga_core/saga_gui/wksp_data_menu_files.cpp])
 AC_CONFIG_HEADER([config.h])
 AC_CONFIG_MACRO_DIR([m4])
-AM_INIT_AUTOMAKE(foreign tar-ustar)
+AM_INIT_AUTOMAKE([foreign tar-ustar subdir-objects])
 
 
 # Checks for programs.
@@ -241,6 +241,7 @@ AC_OUTPUT(Makefile \
 	src/modules/imagery/Makefile \
 	src/modules/imagery/imagery_classification/Makefile \
 	src/modules/imagery/imagery_opencv/Makefile \
+	src/modules/imagery/imagery_maxent/Makefile \
 	src/modules/imagery/imagery_photogrammetry/Makefile \
 	src/modules/imagery/imagery_segmentation/Makefile \
 	src/modules/imagery/imagery_svm/Makefile \
diff --git a/src/modules/climate/climate_tools/MLB_Interface.cpp b/src/modules/climate/climate_tools/MLB_Interface.cpp
index 6a7acb0..6645aa3 100644
--- a/src/modules/climate/climate_tools/MLB_Interface.cpp
+++ b/src/modules/climate/climate_tools/MLB_Interface.cpp
@@ -115,8 +115,9 @@ CSG_Module *		Create_Module(int i)
 	case  4:	return( new CMilankovic_SR_Day_Location );
 	case  5:	return( new CMilankovic_SR_Monthly_Global );
 
-	case  6:	return( new CETP_Hargreave );
-	case  7:	return( new CETP_Day_To_Hour );
+	case  8:	return( new CPET_Hargreave_Grid );
+	case  6:	return( new CPET_Hargreave_Table );
+	case  7:	return( new CPET_Day_To_Hour );
 
 	//-----------------------------------------------------
 	case 10:	return( NULL );
diff --git a/src/modules/climate/climate_tools/Makefile.in b/src/modules/climate/climate_tools/Makefile.in
index fc6c87e..5c278c1 100644
--- a/src/modules/climate/climate_tools/Makefile.in
+++ b/src/modules/climate/climate_tools/Makefile.in
@@ -467,22 +467,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/milankovic.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/climate/climate_tools/etp_hargreave.cpp b/src/modules/climate/climate_tools/etp_hargreave.cpp
index cac2141..5579adc 100644
--- a/src/modules/climate/climate_tools/etp_hargreave.cpp
+++ b/src/modules/climate/climate_tools/etp_hargreave.cpp
@@ -69,16 +69,216 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-CETP_Hargreave::CETP_Hargreave(void)
+double	Get_Radiation_TopOfAtmosphere	(int DayOfYear, double Latitude_Rad)
+{
+	double	sinLat	= sin(Latitude_Rad);
+	double	cosLat	= cos(Latitude_Rad);
+	double	tanLat	= tan(Latitude_Rad);
+
+	// relative distance between sun and earth on any Julian day
+	double	dR		= 0.033  * cos(DayOfYear * 2.0 * M_PI / 365.0) + 1.0;
+
+	// solar declination in radians and sunset hour angle
+	double	SunHgt	= 0.4093 * sin(DayOfYear * 2.0 * M_PI / 365.0 - 1.405);
+	double	SunDir	= acos(-tanLat * tan(SunHgt));
+
+	// water equivalent of extraterrestrial radiation (mm/day)
+	double	R0		= 15.392 * dR * (SunDir * sinLat * sin(SunHgt) + cosLat * cos(SunHgt) * sin(SunDir));
+
+	return( R0 );
+}
+
+//---------------------------------------------------------
+double	Get_PET_Hargreave	(double R0, double Tmean, double Tmin, double Tmax)
+{
+	return( 0.0023 * R0 * (Tmean + 17.8) * sqrt(Tmax - Tmin) );	// potential evapotranspiration per day
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+CPET_Hargreave_Grid::CPET_Hargreave_Grid(void)
+{
+	CSG_Parameter	*pNode;
+
+	//-----------------------------------------------------
+	// 1. Info...
+
+	Set_Name		(_TL("PET (after Hargreaves, Grid)"));
+
+	Set_Author		("O.Conrad (c) 2015");
+
+	Set_Description	(_TW(
+		"Estimation of daily potential evapotranspiration from daily average, minimum and maximum temperatures "
+		"using Hargreave's empirical equation. In order to estimate extraterrestrial net radiation "
+		"geographic latitude of observation and Julian day have to be supplied too. "
+		"\nReferences:\n"
+		"- Ambikadevi, K.M. (2004): Simulation of Evapotranspiration and Rainfall-runoff for the Stillwater River Watershed in Central Massachusetts. "
+		"Environmental & Water Resources Engineering Masters Projects, University of Massachusetts, Amherst "
+		"<a target=\"_blank\" href=\"http://scholarworks.umass.edu/cee_ewre/22/\">online</a>\n"
+		"- Hargraeves, G.H., Samani, Z.A. (1985): Reference crop evapotranspiration from ambient air temperatures. "
+		"Paper presented in ASAE Regional Meeting, Grand Junction, Colorado. "
+		"<a target=\"_blank\" href=\"http://cagesun.nmsu.edu/~zsamani/papers/Hargreaves_Samani_85.pdf\">online</a>\n"
+		"Allen, R.G., Pereira, L.S., Raes, D., Smith, M. (1998): Crop evapotranspiration - Guidelines for computing crop water requirements. "
+		"FAO Irrigation and drainage paper 56. "
+		"<a target=\"_blank\" href=\"http://www.fao.org/docrep/X0490E/x0490e00.htm#Contents\">online</a>\n"
+	));
+
+
+	//-----------------------------------------------------
+	// 2. Parameters...
+
+	Parameters.Add_Grid(NULL, "T"    , _TL("Mean Temperature"            ), _TL(""), PARAMETER_INPUT);
+	Parameters.Add_Grid(NULL, "T_MIN", _TL("Minimum Temperature"         ), _TL(""), PARAMETER_INPUT);
+	Parameters.Add_Grid(NULL, "T_MAX", _TL("Maximum Temperature"         ), _TL(""), PARAMETER_INPUT);
+	Parameters.Add_Grid(NULL, "PET"  , _TL("Potential Evapotranspiration"), _TL(""), PARAMETER_OUTPUT);
+
+	Parameters.Add_Value(
+		NULL	, "LAT"		, _TL("Latitude [Degree]"),
+		_TL(""),
+		PARAMETER_TYPE_Double, 53.0, -90.0, true, 90.0, true
+	);
+
+	pNode	= Parameters.Add_Choice(
+		NULL	, "TIME"	, _TL("Time"),
+		_TL(""),
+		CSG_String::Format("%s|%s|",
+			_TL("day"),
+			_TL("month")
+		), 0
+	);
+
+	Parameters.Add_Choice(
+		pNode	, "MONTH"	, _TL("Month"),
+		_TL(""),
+		CSG_String::Format(SG_T("%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|"),
+			_TL("January"), _TL("February"), _TL("March"    ), _TL("April"  ), _TL("May"     ), _TL("June"    ),
+			_TL("July"   ), _TL("August"  ), _TL("September"), _TL("October"), _TL("November"), _TL("December")
+		), 2
+	);
+
+	Parameters.Add_Value(
+		pNode	, "DAY"		, _TL("Day of Month"),
+		_TL(""),
+		PARAMETER_TYPE_Int, 21, 1, true, 31, true
+	);
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+int CPET_Hargreave_Grid::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+{
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "T") )
+	{
+		pParameters->Set_Enabled("LAT", pParameter->asGrid() && pParameter->asGrid()->Get_Projection().is_Okay() == false);
+	}
+
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "TIME") )
+	{
+		pParameters->Set_Enabled("DAY", pParameter->asInt() == 0);
+	}
+
+	return( CSG_Module::On_Parameters_Enable(pParameters, pParameter) );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CPET_Hargreave_Grid::On_Execute(void)
+{
+	//-----------------------------------------------------
+	const int	DaysBefore[12]	= {   0,  31,  59,  90, 120, 151, 181, 212, 243, 273, 304, 334 };
+	const int	DaysCount [12]	= {  31,  28,  31,  30,  31,  30,  31,  31,  30,  31,  30,  31 };
+
+	//-----------------------------------------------------
+	CSG_Grid	*pTavg	= Parameters("T"    )->asGrid();
+	CSG_Grid	*pTmin	= Parameters("T_MIN")->asGrid();
+	CSG_Grid	*pTmax	= Parameters("T_MAX")->asGrid();
+	CSG_Grid	*pPET	= Parameters("PET"  )->asGrid();
+
+	//-----------------------------------------------------
+	CSG_Grid	Lat, *pLat	= NULL;
+
+	if( pTavg->Get_Projection().is_Okay() )
+	{
+		bool		bResult;
+		CSG_Grid	Lon;
+
+		SG_RUN_MODULE(bResult, "pj_proj4", 17,	// geographic coordinate grids
+				SG_MODULE_PARAMETER_SET("GRID", pTavg)
+			&&	SG_MODULE_PARAMETER_SET("LON" , &Lon)
+			&&	SG_MODULE_PARAMETER_SET("LAT" , &Lat)
+		)
+
+		if( bResult )
+		{
+			pLat	= &Lat;
+		}
+	}
+
+	//-----------------------------------------------------
+	int	Mon	= Parameters("TIME")->asInt() == 0 ? -1 : DaysCount[Parameters("MONTH")->asInt()];
+	int	Day	= DaysBefore[Parameters("MONTH")->asInt()] + Mon < 0 ? Parameters("DAY")->asInt() : Mon / 2;
+
+	double	R0_const	= Get_Radiation_TopOfAtmosphere(Day, Parameters("LAT")->asDouble() * M_DEG_TO_RAD);
+
+	//-----------------------------------------------------
+	for(int y=0; y<Get_NY() && Set_Progress(y); y++)
+	{
+		#pragma omp parallel for
+		for(int x=0; x<Get_NX(); x++)
+		{
+			if( pTavg->is_NoData(x, y) || pTmin->is_NoData(x, y) || pTmax->is_NoData(x, y) || (pLat && pLat->is_NoData(x, y)) )
+			{
+				pPET->Set_NoData(x, y);
+			}
+			else
+			{
+				double	PET	= Get_PET_Hargreave(pLat ? Get_Radiation_TopOfAtmosphere(Day, pLat->asDouble(x, y) * M_DEG_TO_RAD) : R0_const,
+					pTavg->asDouble(x, y),
+					pTmin->asDouble(x, y),
+					pTmax->asDouble(x, y)
+				);
+
+				pPET->Set_Value(x, y, Mon < 0 ? PET : PET * Mon);
+			}
+		}
+	}
+
+	//-----------------------------------------------------
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+CPET_Hargreave_Table::CPET_Hargreave_Table(void)
 {
 	CSG_Parameter	*pNode;
 
 	//-----------------------------------------------------
 	// 1. Info...
 
-	Set_Name		(_TL("PET (after Hargreave)"));
+	Set_Name		(_TL("PET (after Hargreaves, Table)"));
 
-	Set_Author		(SG_T("O.Conrad (c) 2011"));
+	Set_Author		("O.Conrad (c) 2011");
 
 	Set_Description	(_TW(
 		"Estimation of daily potential evapotranspiration from daily average, minimum and maximum temperatures "
@@ -91,6 +291,8 @@ CETP_Hargreave::CETP_Hargreave(void)
 		"- Hargraeves, G.H., Samani, Z.A. (1985): Reference crop evapotranspiration from ambient air temperatures. "
 		"Paper presented in ASAE Regional Meeting, Grand Junction, Colorado. "
 		"<a target=\"_blank\" href=\"http://cagesun.nmsu.edu/~zsamani/papers/Hargreaves_Samani_85.pdf\">online</a>\n"
+		"FAO Irrigation and drainage paper 56. "
+		"<a target=\"_blank\" href=\"http://www.fao.org/docrep/X0490E/x0490e00.htm#Contents\">online</a>\n"
 	));
 
 
@@ -109,7 +311,7 @@ CETP_Hargreave::CETP_Hargreave(void)
 	);
 
 	Parameters.Add_Table_Field(
-		pNode	, "T"				, _TL("Average Temperature"),
+		pNode	, "T"				, _TL("Mean Temperature"),
 		_TL("")
 	);
 
@@ -136,61 +338,40 @@ CETP_Hargreave::CETP_Hargreave(void)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CETP_Hargreave::On_Execute(void)
+bool CPET_Hargreave_Table::On_Execute(void)
 {
-	int			fJD, fT, fTmin, fTmax, fET;
-	double		sinLat, cosLat, tanLat;
-	CSG_Table	*pTable;
-
 	//-----------------------------------------------------
-	pTable	= Parameters("TABLE")	->asTable();
-	fJD		= Parameters("JD")		->asInt();
-	fT		= Parameters("T")		->asInt();
-	fTmin	= Parameters("T_MIN")	->asInt();
-	fTmax	= Parameters("T_MAX")	->asInt();
-
-	sinLat	= sin(Parameters("LAT")	->asDouble() * M_DEG_TO_RAD);
-	cosLat	= cos(Parameters("LAT")	->asDouble() * M_DEG_TO_RAD);
-	tanLat	= tan(Parameters("LAT")	->asDouble() * M_DEG_TO_RAD);
+	int			fDay, fT, fTmin, fTmax, fET;
+	double		Lat;
+	CSG_Table	*pTable;
 
+	pTable	= Parameters("TABLE")->asTable ();
+	Lat		= Parameters("LAT"  )->asDouble() * M_DEG_TO_RAD;
+	fDay	= Parameters("JD"   )->asInt   ();
+	fT		= Parameters("T"    )->asInt   ();
+	fTmin	= Parameters("T_MIN")->asInt   ();
+	fTmax	= Parameters("T_MAX")->asInt   ();
 	fET		= pTable->Get_Field_Count();
 
-	pTable->Add_Field(SG_T("ET"), SG_DATATYPE_Double);
+	pTable->Add_Field("ET", SG_DATATYPE_Double);
 
 	//-----------------------------------------------------
 	for(int iRecord=0; iRecord<pTable->Get_Count() && Set_Progress(iRecord, pTable->Get_Count()); iRecord++)
 	{
 		CSG_Table_Record	*pRecord	= pTable->Get_Record(iRecord);
 
-		if( pRecord->is_NoData(fJD) || pRecord->is_NoData(fTmin) || pRecord->is_NoData(fTmax) )
+		if( pRecord->is_NoData(fDay) || pRecord->is_NoData(fTmin) || pRecord->is_NoData(fTmax) )
 		{
 			pRecord->Set_NoData(fET);
 		}
 		else
 		{
-			int		JD;
-			double	T, Tmin, Tmax, dR, SunDir, SunHgt, S0, ET;
-
-			JD		= pRecord->asInt   (fJD  );
-			T		= pRecord->asDouble(fT   );
-			Tmin	= pRecord->asDouble(fTmin);
-			Tmax	= pRecord->asDouble(fTmax);
-
-			// relative distance between sun and earth on any Julian day
-			dR		= 1 + 0.033 * cos(JD * 2.0 * M_PI / 365.0);
-
-			// solar declination in radians
-			SunHgt	= 0.4093    * sin(JD * 2.0 * M_PI / 365.0 - 1.405);
-
-			// sunset hour angle
-			SunDir	= acos(-tanLat * tan(SunHgt));
-
-			// water equivalent of extraterrestrial radiation (mm/day)
-			S0		= 15.392 * dR * (SunDir * sinLat * sin(SunHgt) + cosLat * cos(SunHgt) * sin(SunDir));
-
-			ET		= 0.0023 * S0 * sqrt(Tmax - Tmin) * (T + 17.8);
-
-			pRecord->Set_Value(fET, ET);
+			pRecord->Set_Value(fET, Get_PET_Hargreave(Get_Radiation_TopOfAtmosphere(
+				pRecord->asInt   (fDay ), Lat),
+				pRecord->asDouble(fT   ),
+				pRecord->asDouble(fTmin),
+				pRecord->asDouble(fTmax))
+			);
 		}
 	}
 
@@ -208,7 +389,7 @@ bool CETP_Hargreave::On_Execute(void)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-CETP_Day_To_Hour::CETP_Day_To_Hour(void)
+CPET_Day_To_Hour::CPET_Day_To_Hour(void)
 {
 	CSG_Parameter	*pNode;
 
@@ -217,7 +398,7 @@ CETP_Day_To_Hour::CETP_Day_To_Hour(void)
 
 	Set_Name		(_TL("Daily to Hourly PET"));
 
-	Set_Author		(SG_T("O.Conrad (c) 2011"));
+	Set_Author		("O.Conrad (c) 2011");
 
 	Set_Description	(_TW(
 		"Derive hourly from daily evapotranspiration using sinusoidal distribution. "
@@ -272,32 +453,32 @@ CETP_Day_To_Hour::CETP_Day_To_Hour(void)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CETP_Day_To_Hour::On_Execute(void)
+bool CPET_Day_To_Hour::On_Execute(void)
 {
 	int			fJD, fET, fP;
 	double		sinLat, cosLat, sinHgt;
 	CSG_Table	*pDays, *pHours;
 
 	//-----------------------------------------------------
-	pDays	= Parameters("DAYS")	->asTable();
-	pHours	= Parameters("HOURS")	->asTable();
-	fJD		= Parameters("JD")		->asInt();
-	fET		= Parameters("ET")		->asInt();
-	fP		= Parameters("P")		->asInt();
+	pDays	= Parameters("DAYS" )->asTable();
+	pHours	= Parameters("HOURS")->asTable();
+	fJD		= Parameters("JD"   )->asInt();
+	fET		= Parameters("ET"   )->asInt();
+	fP		= Parameters("P"    )->asInt();
 
 	sinLat	= sin(Parameters("LAT")	->asDouble() * M_DEG_TO_RAD);
 	cosLat	= cos(Parameters("LAT")	->asDouble() * M_DEG_TO_RAD);
 	sinHgt	= 0.0;	// -0.0145;	// >> -50'' desired height of horizon
 
 	pHours->Destroy();
-	pHours->Set_Name(CSG_String::Format(SG_T("%s [%s]"), pDays->Get_Name(), _TL("h")));
-	pHours->Add_Field(SG_T("JULIAN_DAY")	, SG_DATATYPE_Int);
-	pHours->Add_Field(SG_T("HOUR")			, SG_DATATYPE_Int);
-	pHours->Add_Field(SG_T("ET")			, SG_DATATYPE_Double);
+	pHours->Set_Name(CSG_String::Format("%s [%s]", pDays->Get_Name(), _TL("h")));
+	pHours->Add_Field("JULIAN_DAY", SG_DATATYPE_Int);
+	pHours->Add_Field("HOUR"      , SG_DATATYPE_Int);
+	pHours->Add_Field("ET"        , SG_DATATYPE_Double);
 
 	if( fP >= 0 )
 	{
-		pHours->Add_Field(SG_T("P")				, SG_DATATYPE_Double);
+		pHours->Add_Field("P", SG_DATATYPE_Double);
 	}
 
 	//-----------------------------------------------------
diff --git a/src/modules/climate/climate_tools/etp_hargreave.h b/src/modules/climate/climate_tools/etp_hargreave.h
index 82601fd..6859a2d 100644
--- a/src/modules/climate/climate_tools/etp_hargreave.h
+++ b/src/modules/climate/climate_tools/etp_hargreave.h
@@ -80,17 +80,39 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-class CETP_Hargreave : public CSG_Module
+class CPET_Hargreave_Grid : public CSG_Module_Grid
 {
 public:
-	CETP_Hargreave(void);
+	CPET_Hargreave_Grid(void);
 
-	virtual CSG_String	Get_MenuPath	(void)	{	return( _TL("Evapotranspiration") );	}
+	virtual CSG_String	Get_MenuPath			(void)	{	return( _TL("Evapotranspiration") );	}
 
 
 protected:
 
-	virtual bool		On_Execute		(void);
+	virtual int			On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+
+	virtual bool		On_Execute				(void);
+
+};
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+class CPET_Hargreave_Table : public CSG_Module
+{
+public:
+	CPET_Hargreave_Table(void);
+
+	virtual CSG_String	Get_MenuPath			(void)	{	return( _TL("Evapotranspiration") );	}
+
+
+protected:
+
+	virtual bool		On_Execute				(void);
 
 };
 
@@ -100,17 +122,17 @@ protected:
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-class CETP_Day_To_Hour : public CSG_Module
+class CPET_Day_To_Hour : public CSG_Module
 {
 public:
-	CETP_Day_To_Hour(void);
+	CPET_Day_To_Hour(void);
 
-	virtual CSG_String	Get_MenuPath	(void)	{	return( _TL("Evapotranspiration") );	}
+	virtual CSG_String	Get_MenuPath			(void)	{	return( _TL("Evapotranspiration") );	}
 
 
 protected:
 
-	virtual bool		On_Execute		(void);
+	virtual bool		On_Execute				(void);
 
 };
 
diff --git a/src/modules/contrib/contrib_peregro/Makefile.in b/src/modules/contrib/contrib_peregro/Makefile.in
index c75ff66..b298d0d 100644
--- a/src/modules/contrib/contrib_peregro/Makefile.in
+++ b/src/modules/contrib/contrib_peregro/Makefile.in
@@ -483,22 +483,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/directional1.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/db/db_odbc/Makefile.in b/src/modules/db/db_odbc/Makefile.in
index cf81d8a..7bb44c1 100644
--- a/src/modules/db/db_odbc/Makefile.in
+++ b/src/modules/db/db_odbc/Makefile.in
@@ -468,22 +468,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/table.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/db/db_pgsql/Makefile.in b/src/modules/db/db_pgsql/Makefile.in
index 393b6b0..0d60876 100644
--- a/src/modules/db/db_pgsql/Makefile.in
+++ b/src/modules/db/db_pgsql/Makefile.in
@@ -473,22 +473,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/table.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/db/db_pgsql/db_pgsql.cpp b/src/modules/db/db_pgsql/db_pgsql.cpp
index 7c4fe77..6c3d9d2 100644
--- a/src/modules/db/db_pgsql/db_pgsql.cpp
+++ b/src/modules/db/db_pgsql/db_pgsql.cpp
@@ -1317,7 +1317,7 @@ bool CSG_PG_Connection::Raster_Save(CSG_Grid *pGrid, int SRID, const CSG_String
 		{
 			CSG_String	hex(Band.toHexString());
 
-			PQputCopyData(m_pgConnection, hex, hex.Length());
+			PQputCopyData(m_pgConnection, hex, (int)hex.Length());
 		}
 
 		PQputCopyEnd (m_pgConnection, NULL);
diff --git a/src/modules/docs/docs_html/CreateWebContent.cpp b/src/modules/docs/docs_html/CreateWebContent.cpp
index 61a738c..d49da8e 100644
--- a/src/modules/docs/docs_html/CreateWebContent.cpp
+++ b/src/modules/docs/docs_html/CreateWebContent.cpp
@@ -163,7 +163,7 @@ bool CCreateWebContent::On_Execute_Finish(void){
 				Pictures[j] = m_Pictures[i].at(j).c_str();
 			}//for*/
 		
-			HTMLDoc.AddThumbnails(Pictures, m_Pictures[i].size(), 4);
+			HTMLDoc.AddThumbnails(Pictures, (int)m_Pictures[i].size(), 4);
 			HTMLDoc.AddLineBreak();
 			for (j = 0; j < m_Links[i].size(); j++){
 				HTMLDoc.AddHyperlink(m_LinksDescription[i].at(j).c_str(), m_Links[i].at(j).c_str());
diff --git a/src/modules/docs/docs_html/Makefile.in b/src/modules/docs/docs_html/Makefile.in
index 1d58a2c..3afb91c 100644
--- a/src/modules/docs/docs_html/Makefile.in
+++ b/src/modules/docs/docs_html/Makefile.in
@@ -470,22 +470,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/svg_interactive_map.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/docs/docs_pdf/Makefile.in b/src/modules/docs/docs_pdf/Makefile.in
index d50a182..086745d 100644
--- a/src/modules/docs/docs_pdf/Makefile.in
+++ b/src/modules/docs/docs_pdf/Makefile.in
@@ -475,22 +475,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/doc_pdf.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/docs/docs_pdf/Shapes_Summary.cpp b/src/modules/docs/docs_pdf/Shapes_Summary.cpp
index 7b22b55..ed362e8 100644
--- a/src/modules/docs/docs_pdf/Shapes_Summary.cpp
+++ b/src/modules/docs/docs_pdf/Shapes_Summary.cpp
@@ -422,7 +422,7 @@ void CShapes_Summary::CreatePDFDocs(){
 	pShapesTable = m_pShapes;
 	pShapes = new CSG_Shapes();
 	for (i = 0; i < (int)m_ClassesID.size(); i++){
-		Set_Progress(i,m_ClassesID.size());
+		Set_Progress(i,(int)m_ClassesID.size());
 		pShapes->Create(m_pShapes->Get_Type());
 		for (j = 0; j < m_pShapes->Get_Count(); j++){
 			if (m_pClasses[j] == i){
diff --git a/src/modules/garden/garden_3d_viewer/3d_viewer_globe_grid.cpp b/src/modules/garden/garden_3d_viewer/3d_viewer_globe_grid.cpp
index adc0639..7fb596b 100644
--- a/src/modules/garden/garden_3d_viewer/3d_viewer_globe_grid.cpp
+++ b/src/modules/garden/garden_3d_viewer/3d_viewer_globe_grid.cpp
@@ -228,6 +228,11 @@ C3D_Viewer_Globe_Grid_Panel::C3D_Viewer_Globe_Grid_Panel(wxWindow *pParent, CSG_
 	);
 
 	//-----------------------------------------------------
+	m_Parameters("COLORS_RANGE")->asRange()->Set_Range(
+		m_pGrid->Get_Mean() - 1.5 * m_pGrid->Get_StdDev(),
+		m_pGrid->Get_Mean() + 1.5 * m_pGrid->Get_StdDev()
+	);
+
 	Update_Statistics();
 }
 
@@ -299,11 +304,6 @@ void C3D_Viewer_Globe_Grid_Panel::Update_Statistics(void)
 	double	Radius	= m_Parameters("RADIUS")->asDouble();
 	double	zScale	= m_pZ ? m_Parameters("Z_SCALE")->asDouble() : 0.0;
 
-	m_Parameters("COLORS_RANGE")->asRange()->Set_Range(
-		m_pGrid->Get_Mean() - 1.5 * m_pGrid->Get_StdDev(),
-		m_pGrid->Get_Mean() + 1.5 * m_pGrid->Get_StdDev()
-	);
-
 	m_Data_Min.x = m_Data_Max.x = 0.0;
 	m_Data_Min.y = m_Data_Max.y = 0.0;
 	m_Data_Min.z = m_Data_Max.z = 0.0;
@@ -317,15 +317,18 @@ void C3D_Viewer_Globe_Grid_Panel::Update_Statistics(void)
 
 		for(int x=0; x<m_pGrid->Get_NX(); x++, pNode++, wx+=M_DEG_TO_RAD*m_pGrid->Get_Cellsize())
 		{
-			double r	= zScale ? Radius + zScale * m_pZ->asDouble(x, y) : Radius;
-			pNode->z	= r * sin(wy);
-			double s	= r * cos(wy);
-			pNode->x	= s * cos(wx);
-			pNode->y	= s * sin(wx);
-
-			if( m_Data_Min.x > pNode->x ) m_Data_Min.x = pNode->x; else if( m_Data_Max.x < pNode->x ) m_Data_Max.x = pNode->x;
-			if( m_Data_Min.y > pNode->y ) m_Data_Min.y = pNode->y; else if( m_Data_Max.y < pNode->y ) m_Data_Max.y = pNode->y;
-			if( m_Data_Min.z > pNode->z ) m_Data_Min.z = pNode->z; else if( m_Data_Max.z < pNode->z ) m_Data_Max.z = pNode->z;
+			if( !m_pGrid->is_NoData(x, y) )
+			{
+				double r	= zScale ? Radius + zScale * m_pZ->asDouble(x, y) : Radius;
+				pNode->z	= r * sin(wy);
+				double s	= r * cos(wy);
+				pNode->x	= s * cos(wx);
+				pNode->y	= s * sin(wx);
+
+				if( m_Data_Min.x > pNode->x ) m_Data_Min.x = pNode->x; else if( m_Data_Max.x < pNode->x ) m_Data_Max.x = pNode->x;
+				if( m_Data_Min.y > pNode->y ) m_Data_Min.y = pNode->y; else if( m_Data_Max.y < pNode->y ) m_Data_Max.y = pNode->y;
+				if( m_Data_Min.z > pNode->z ) m_Data_Min.z = pNode->z; else if( m_Data_Max.z < pNode->z ) m_Data_Max.z = pNode->z;
+			}
 		}
 	}
 
diff --git a/src/modules/garden/garden_3d_viewer/3d_viewer_shapes.cpp b/src/modules/garden/garden_3d_viewer/3d_viewer_shapes.cpp
index 596c14d..fab1f0b 100644
--- a/src/modules/garden/garden_3d_viewer/3d_viewer_shapes.cpp
+++ b/src/modules/garden/garden_3d_viewer/3d_viewer_shapes.cpp
@@ -336,10 +336,10 @@ void C3D_Viewer_Shapes_Panel::Draw_Shape(CSG_Shape *pShape, int Field_Color)
 		case SHAPE_TYPE_Point:
 		case SHAPE_TYPE_Points:
 			{
-				for(int iPoint=1; iPoint<pShape->Get_Point_Count(iPart); iPoint++)
+				for(int iPoint=0; iPoint<pShape->Get_Point_Count(iPart); iPoint++)
 				{
 					TSG_Point_Z	a;
-					TSG_Point	p	= pShape->Get_Point(0, iPart);
+					TSG_Point	p	= pShape->Get_Point(iPoint, iPart);
 
 					a.x	= p.x;
 					a.y	= p.y;
diff --git a/src/modules/garden/garden_3d_viewer/Makefile.in b/src/modules/garden/garden_3d_viewer/Makefile.in
index 9e54a24..88ba47b 100644
--- a/src/modules/garden/garden_3d_viewer/Makefile.in
+++ b/src/modules/garden/garden_3d_viewer/Makefile.in
@@ -474,22 +474,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MLB_Interface.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/garden/garden_fractals/Makefile.in b/src/modules/garden/garden_fractals/Makefile.in
index 399d57b..109739f 100644
--- a/src/modules/garden/garden_fractals/Makefile.in
+++ b/src/modules/garden/garden_fractals/Makefile.in
@@ -477,22 +477,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Pythagoras_Tree.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/garden/garden_games/Makefile.in b/src/modules/garden/garden_games/Makefile.in
index ebc8c16..79a1f4f 100644
--- a/src/modules/garden/garden_games/Makefile.in
+++ b/src/modules/garden/garden_games/Makefile.in
@@ -466,22 +466,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Sudoku.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/garden/garden_learn_to_program/Makefile.in b/src/modules/garden/garden_learn_to_program/Makefile.in
index 7d5b204..5ba4970 100644
--- a/src/modules/garden/garden_learn_to_program/Makefile.in
+++ b/src/modules/garden/garden_learn_to_program/Makefile.in
@@ -504,22 +504,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MLB_Interface.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/garden/garden_webservices/Makefile.in b/src/modules/garden/garden_webservices/Makefile.in
index 5e81d69..993a255 100644
--- a/src/modules/garden/garden_webservices/Makefile.in
+++ b/src/modules/garden/garden_webservices/Makefile.in
@@ -464,22 +464,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/wms_import.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/garden/garden_webservices/osm_import.cpp b/src/modules/garden/garden_webservices/osm_import.cpp
index 215e7e4..612bf3a 100644
--- a/src/modules/garden/garden_webservices/osm_import.cpp
+++ b/src/modules/garden/garden_webservices/osm_import.cpp
@@ -282,9 +282,9 @@ bool COSM_Import::Load_Nodes(wxXmlNode *pRoot)
 	{
 		if( !pNode->GetName().CmpNoCase(SG_T("node")) )
 		{
-			if(	pNode->GetPropVal(SG_T("id" ), &sValue) && sValue.ToLong  (&id)
-			&&	pNode->GetPropVal(SG_T("lon"), &sValue) && sValue.ToDouble(&lon)
-			&&	pNode->GetPropVal(SG_T("lat"), &sValue) && sValue.ToDouble(&lat) )
+			if(	pNode->GetAttribute(SG_T("id" ), &sValue) && sValue.ToLong  (&id)
+			&&	pNode->GetAttribute(SG_T("lon"), &sValue) && sValue.ToDouble(&lon)
+			&&	pNode->GetAttribute(SG_T("lat"), &sValue) && sValue.ToDouble(&lat) )
 			{
 				wxXmlNode	*pTag	= pNode->GetChildren();
 
@@ -402,7 +402,7 @@ bool COSM_Import::Load_Ways(wxXmlNode *pRoot)
 	{
 		if( !pNode->GetName().CmpNoCase(SG_T("way")) )
 		{
-			if(	pNode->GetPropVal(SG_T("id" ), &sValue) && sValue.ToLong  (&id) )
+			if(	pNode->GetAttribute(SG_T("id" ), &sValue) && sValue.ToLong  (&id) )
 			{
 				wxXmlNode	*pChild	= pNode->GetChildren();
 
@@ -410,7 +410,7 @@ bool COSM_Import::Load_Ways(wxXmlNode *pRoot)
 
 				while( pChild )
 				{
-					if( !pChild->GetName().CmpNoCase(SG_T("nd")) && pChild->GetPropVal(SG_T("ref"), &sValue) && sValue.ToLong(&idnode) )
+					if( !pChild->GetName().CmpNoCase(SG_T("nd")) && pChild->GetAttribute(SG_T("ref"), &sValue) && sValue.ToLong(&idnode) )
 					{
 						Nodes[nNodes++]	= idnode;
 					}
diff --git a/src/modules/garden/garden_webservices/wms_import.cpp b/src/modules/garden/garden_webservices/wms_import.cpp
index d6a6abf..2f3748f 100644
--- a/src/modules/garden/garden_webservices/wms_import.cpp
+++ b/src/modules/garden/garden_webservices/wms_import.cpp
@@ -251,7 +251,7 @@ bool CWMS_Capabilities::_Get_Node_PropVal(wxXmlNode *pNode, CSG_String &Value, c
 {
 	wxString	PropVal;
 
-	if( pNode != NULL && pNode->GetPropVal(Property.c_str(), &PropVal) )
+	if( pNode != NULL && pNode->GetAttribute(Property.c_str(), &PropVal) )
 	{
 		Value	= PropVal.wc_str();
 
@@ -697,7 +697,6 @@ bool CWMS_Import::Get_Map(wxHTTP *pServer, const CSG_String &Directory, const CS
 	//-----------------------------------------------------
 	if( pServer && Dlg_Parameters(&p, _TL("WMS Import")) )
 	{
-		long		tFormat;
 		int			NX, NY;
 		double		Cellsize;
 		CSG_String	Layers, Format;
@@ -733,17 +732,19 @@ bool CWMS_Import::Get_Map(wxHTTP *pServer, const CSG_String &Directory, const CS
 		}
 
 		//-------------------------------------------------
+		wxBitmapType	tFormat;
+
 		Format	= p("FORMAT")->asString();
 
-		if(      Format.Contains(SG_T("image/gif")) )	tFormat	= wxBITMAP_TYPE_GIF;
+		if(      Format.Contains(SG_T("image/gif" )) )	tFormat	= wxBITMAP_TYPE_GIF ;
 		else if( Format.Contains(SG_T("image/jpeg")) )	tFormat	= wxBITMAP_TYPE_JPEG;
-		else if( Format.Contains(SG_T("image/png")) )	tFormat	= wxBITMAP_TYPE_PNG;
-		else if( Format.Contains(SG_T("image/wbmp")) )	tFormat	= wxBITMAP_TYPE_BMP;
-		else if( Format.Contains(SG_T("image/bmp")) )	tFormat	= wxBITMAP_TYPE_BMP;
-		else if( Format.Contains(SG_T("image/tiff")) )	tFormat	= wxBITMAP_TYPE_TIF;
-		else if( Format.Contains(SG_T("GIF")) )			tFormat	= wxBITMAP_TYPE_GIF;
-		else if( Format.Contains(SG_T("JPEG")) )		tFormat	= wxBITMAP_TYPE_JPEG;
-		else if( Format.Contains(SG_T("PNG")) )			tFormat	= wxBITMAP_TYPE_PNG;
+		else if( Format.Contains(SG_T("image/png" )) )	tFormat	= wxBITMAP_TYPE_PNG ;
+		else if( Format.Contains(SG_T("image/wbmp")) )	tFormat	= wxBITMAP_TYPE_BMP ;
+		else if( Format.Contains(SG_T("image/bmp" )) )	tFormat	= wxBITMAP_TYPE_BMP ;
+		else if( Format.Contains(SG_T("image/tiff")) )	tFormat	= wxBITMAP_TYPE_TIF ;
+		else if( Format.Contains(SG_T("GIF"       )) )	tFormat	= wxBITMAP_TYPE_GIF ;
+		else if( Format.Contains(SG_T("JPEG"      )) )	tFormat	= wxBITMAP_TYPE_JPEG;
+		else if( Format.Contains(SG_T("PNG"       )) )	tFormat	= wxBITMAP_TYPE_PNG ;
 		else
 		{
 			return( false );
diff --git a/src/modules/grid/grid_analysis/Grid_Accumulation_Functions.cpp b/src/modules/grid/grid_analysis/Grid_Accumulation_Functions.cpp
index ae4297e..51817f7 100644
--- a/src/modules/grid/grid_analysis/Grid_Accumulation_Functions.cpp
+++ b/src/modules/grid/grid_analysis/Grid_Accumulation_Functions.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Grid_Accumulation_Functions.cpp 2241 2014-09-22 11:04:27Z oconrad $
+ * Version $Id: Grid_Accumulation_Functions.cpp 2447 2015-03-19 14:43:42Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -242,7 +242,7 @@ bool CGrid_Accumulation_Functions::On_Execute(void)
 		return( false );
 	}
 
-	for(sLong n=0; n<Get_NCells() && Set_Progress(n); n++)
+	for(sLong n=0; n<Get_NCells() && Set_Progress_NCells(n); n++)
 	{
 		pSurface->Get_Sorted(n, x, y, true);
 
diff --git a/src/modules/grid/grid_analysis/MLB_Interface.cpp b/src/modules/grid/grid_analysis/MLB_Interface.cpp
index 2758a15..44b9c19 100644
--- a/src/modules/grid/grid_analysis/MLB_Interface.cpp
+++ b/src/modules/grid/grid_analysis/MLB_Interface.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: MLB_Interface.cpp 2281 2014-10-09 15:49:41Z oconrad $
+ * Version $Id: MLB_Interface.cpp 2365 2015-01-09 15:12:03Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -139,6 +139,7 @@ CSG_Module *		Create_Module(int i)
 	case 13:	return( new CCrossClassification );
 
 	case 14:	return( new CSoil_Texture );
+	case 20:	return( new CSoil_Texture_Table );
 
 	case 15:	return( new CFragmentation_Standard );
 	case 16:	return( new CFragmentation_Resampling );
diff --git a/src/modules/grid/grid_analysis/Makefile.in b/src/modules/grid/grid_analysis/Makefile.in
index e721393..6ed48c2 100644
--- a/src/modules/grid/grid_analysis/Makefile.in
+++ b/src/modules/grid/grid_analysis/Makefile.in
@@ -525,22 +525,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/owa.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/grid/grid_analysis/Soil_Texture.cpp b/src/modules/grid/grid_analysis/Soil_Texture.cpp
index a846115..55e07b0 100644
--- a/src/modules/grid/grid_analysis/Soil_Texture.cpp
+++ b/src/modules/grid/grid_analysis/Soil_Texture.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Soil_Texture.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: Soil_Texture.cpp 2465 2015-04-02 15:49:29Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -71,7 +71,7 @@ struct SClass
 {
 	int			ID, Color;
 
-	CSG_String	Name;
+	CSG_String	Key, Name;
 
 	int			nPoints;
 
@@ -82,60 +82,154 @@ struct SClass
 const struct SClass	Classes[12]	=
 {	
 	{
-		 1, SG_GET_RGB(000, 000, 255), _TL("Clay"),
-		 6,	{   0,   0,  20,  45,  45,   0	},
-			{ 100,  60,  40,  40,  55, 100	}
+		 1, SG_GET_RGB(000, 000, 255), "C"   , _TL("Clay"),
+		 6,	{   0,   0,  20,  45,  45,   0				},
+			{ 100,  60,  40,  40,  55, 100				}
 	},	{
-		 2, SG_GET_RGB(000, 200, 255), _TL("Silty Clay"),
-		 4,	{   0,   0,  20,   0	},
-			{ 100,  60,  40,  40	}
+		 2, SG_GET_RGB(000, 200, 255), "SiC" , _TL("Silty Clay"),
+		 4,	{   0,   0,  20,   0						},
+			{ 100,  60,  40,  40						}
 	},	{
-		 3, SG_GET_RGB(000, 200, 200), _TL("Silty Clay-Loam"),
-		 5,	{   0,   0,  20,  20,   0	},
-			{  40,  27,  27,  40,  40	}
+		 3, SG_GET_RGB(000, 200, 200), "SiCL", _TL("Silty Clay Loam"),
+		 5,	{   0,   0,  20,  20,   0					},
+			{  40,  27,  27,  40,  40					}
 	},	{
-		 4, SG_GET_RGB(200, 000, 255), _TL("Sandy Clay"),
-		 4,	{  45,  45,  65,  45	},
-			{  55,  35,  35,  55	}
+		 4, SG_GET_RGB(200, 000, 255), "SC"  , _TL("Sandy Clay"),
+		 4,	{  45,  45,  65,  45						},
+			{  55,  35,  35,  55						}
 	},	{
-		 5, SG_GET_RGB(200, 200, 200), _TL("Sandy Clay-Loam"),
-		 6,	{  45,  45,  52,  80,  65,  45	},
-			{  35,  27,  20,  20,  35,  35	}
+		 5, SG_GET_RGB(200, 200, 200), "SCL" , _TL("Sandy Clay Loam"),
+		 6,	{  45,  45,  52,  80,  65,  45				},
+			{  35,  27,  20,  20,  35,  35				}
 	},	{
-		 6, SG_GET_RGB(127, 127, 200), _TL("Clay-Loam"),
-		 5,	{  20,  20,  45,  45,  20	},
-			{  40,  27,  27,  40,  40	}
+		 6, SG_GET_RGB(127, 127, 200), "CL"  , _TL("Clay Loam"),
+		 5,	{  20,  20,  45,  45,  20					},
+			{  40,  27,  27,  40,  40					}
 	},	{
-		 7, SG_GET_RGB(000, 255, 000), _TL("Silt"),
-		 5,	{   0,   0,  20,   8,   0	},
-			{  12,   0,   0,  12,  12	}
+		 7, SG_GET_RGB(000, 255, 000), "Si"  , _TL("Silt"),
+		 5,	{   0,   0,  20,   8,   0					},
+			{  12,   0,   0,  12,  12					}
 	},	{
-		 8, SG_GET_RGB(127, 255, 127), _TL("Silt-Loam"),
-		 7,	{   8,  20,  50,  23,   0,   0,   8	},
-			{  12,   0,   0,  27,  27,  12,  12	}
+		 8, SG_GET_RGB(127, 255, 127), "SiL" , _TL("Silt Loam"),
+		 7,	{   8,  20,  50,  23,   0,   0,   8			},
+			{  12,   0,   0,  27,  27,  12,  12			}
 	},	{
-		 9, SG_GET_RGB(127, 127, 127), _TL("Loam"),
-		 6,	{  23,  43,  52,  52,  45,  23	},
-			{  27,   7,   7,  20,  27,  27	}
+		 9, SG_GET_RGB(127, 127, 127), "L"   , _TL("Loam"),
+		 6,	{  23,  43,  52,  52,  45,  23				},
+			{  27,   7,   7,  20,  27,  27				}
 	},	{
-		10, SG_GET_RGB(255, 000, 000), _TL("Sand"),
-		 4,	{  85, 100,  90,  85	},
-			{   0,   0,  10,   0	}
+		10, SG_GET_RGB(255, 000, 000), "S"   , _TL("Sand"),
+		 4,	{  85, 100,  90,  85						},
+			{   0,   0,  10,   0						}
 	},	{
-		11, SG_GET_RGB(255, 000, 127), _TL("Loamy Sand"),
-		 5,	{  70,  85,  90,  85,  70	},
-			{   0,   0,  10,  15,   0	}
+		11, SG_GET_RGB(255, 000, 127), "LS"  , _TL("Loamy Sand"),
+		 5,	{  70,  85,  90,  85,  70					},
+			{   0,   0,  10,  15,   0					}
 	},	{
-		12, SG_GET_RGB(200, 127, 127), _TL("Sandy Loam"),
+		12, SG_GET_RGB(200, 127, 127), "SL"  , _TL("Sandy Loam"),
 		 8,	{  43,  50,  70,  85,  80,  52,  52,  43	},
 			{   7,   0,   0,  15,  20,  20,   7,   7	}
 	}
 };
 
+//---------------------------------------------------------
+const CSG_String	Description	= _TW(
+	"Derive soil texture classes with USDA scheme from sand, silt and clay contents.\n\n"
+	"  1 - Clay\n"
+	"  2 - Silty Clay\n"
+	"  3 - Silty Clay Loam\n"
+	"  4 - Sandy Clay\n"
+	"  5 - Sandy Clay Loam\n"
+	"  6 - Clay Loam\n"
+	"  7 - Silt\n"
+	"  8 - Silt Loam\n"
+	"  9 - Loam\n"
+	" 10 - Sand\n"
+	" 11 - Loamy Sand\n"
+	" 12 - Sandy Loam\n"
+	"\nReference:\n"
+	"<a target=\"_blank\" href=\"http://soils.usda.gov/technical/aids/investigations/texture/\">USDA NRCS Soils Website</a>\n"
+);
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+int Get_Texture_SandClay(double Sand, double Clay)
+{
+	if( Sand < 0.001 ) Sand = 0.001; else if( Sand > 99.99 ) Sand = 99.99;
+	if( Clay < 0.001 ) Clay = 0.001; else if( Clay > 99.99 ) Clay = 99.99;
+
+	if( Sand + Clay >= 99.99 )
+	{
+		double	Sum	= 99.99 / (Sand + Clay);
+
+		Sand	*= Sum;
+		Clay	*= Sum;
+	}
+
+	//-----------------------------------------------------
+	for(int iClass=0; iClass<12; iClass++)
+	{
+		const struct SClass	*c	= Classes + iClass;
+
+		bool	bClass	= false;
+
+		for(int i=0, j=c->nPoints-1; i<c->nPoints; j=i++)
+		{
+			if( ((c->Clay[i] <= Clay && Clay < c->Clay[j]) || (c->Clay[j] <= Clay && Clay < c->Clay[i]))
+			&&	Sand < (c->Sand[j] - c->Sand[i]) * (Clay - c->Clay[i]) / (c->Clay[j] - c->Clay[i]) + c->Sand[i] )
+			{
+				bClass	= !bClass;
+			}
+		}
+
+		if( bClass )
+		{
+			return( iClass );
+		}
+	}
+
+	//-----------------------------------------------------
+	return( -1 );
+}
+
+//---------------------------------------------------------
+int Get_Texture_SandSilt(double Sand, double Silt)
+{
+	return( Get_Texture_SandClay(Sand, 100.0 - (Sand + Silt)) );
+}
+
+//---------------------------------------------------------
+int Get_Texture_SiltClay(double Silt, double Clay)
+{
+	return( Get_Texture_SandClay(100.0 - (Silt + Clay), Clay) );
+}
+
+//---------------------------------------------------------
+int Get_Texture(double Sand, double Silt, double Clay, double &Sum)
+{
+	if( Sand < 0.0 ) Sand = 0.0; else if( Sand > 100.0 ) Sand = 100.0;
+	if( Silt < 0.0 ) Silt = 0.0; else if( Silt > 100.0 ) Silt = 100.0;
+	if( Clay < 0.0 ) Clay = 0.0; else if( Clay > 100.0 ) Clay = 100.0;
+
+	Sum	= Sand + Silt + Clay;
+
+	if( Sum > 0.0 && Sum != 100.0 )
+	{
+		Sand	*= 100.0 / Sum;
+		Clay	*= 100.0 / Sum;
+	}
+
+	return( Get_Texture_SandClay(Sand, Clay) );
+}
+
 
 ///////////////////////////////////////////////////////////
 //														 //
-//				Construction/Destruction				 //
+//														 //
 //														 //
 ///////////////////////////////////////////////////////////
 
@@ -144,30 +238,11 @@ CSoil_Texture::CSoil_Texture(void)
 {
 	Set_Name		(_TL("Soil Texture Classification"));
 
-	Set_Author		(_TL("Gianluca Massei (c) 2007 (g_massa at libero.it)"));
-
-	Set_Description	(_TW(
-		"Derive soil texture classes with USDA scheme from sand, silt and clay contents.\n\n"
-		"  1 - Clay\n"
-		"  2 - Silty Clay\n"
-		"  3 - Silty Clay-Loam\n"
-		"  4 - Sandy Clay\n"
-		"  5 - Sandy Clay-Loam\n"
-		"  6 - Clay-Loam\n"
-		"  7 - Silt\n"
-		"  8 - Silt-Loam\n"
-		"  9 - Loam\n"
-		" 10 - Sand\n"
-		" 11 - Loamy Sand\n"
-		" 12 - Sandy Loam\n"
-		"\nReference:\n"
-		"<a target=\"_blank\" href=\"http://soils.usda.gov/technical/aids/investigations/texture/\">USDA NRCS Soils Website</a>\n"
-	));
+	Set_Author		("Gianluca Massei (c) 2007 (g_massa at libero.it)");
 
+	Set_Description	(Description);
 
 	//-----------------------------------------------------
-	// 2. Parameters...
-
 	Parameters.Add_Grid(
 		NULL, "SAND"	, _TL("Sand"),
 		_TL("sand content given as percentage"),
@@ -189,7 +264,7 @@ CSoil_Texture::CSoil_Texture(void)
 	Parameters.Add_Grid(
 		NULL, "TEXTURE"	, _TL("Soil Texture"),
 		_TL("soil texture"),
-		PARAMETER_OUTPUT, true, SG_DATATYPE_Byte
+		PARAMETER_OUTPUT, true, SG_DATATYPE_Char
 	);
 
 	Parameters.Add_Grid(
@@ -202,21 +277,17 @@ CSoil_Texture::CSoil_Texture(void)
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 bool CSoil_Texture::On_Execute(void)
 {
-	CSG_Grid	*pSand, *pSilt, *pClay, *pTexture, *pSum;
-
 	//-----------------------------------------------------
-	pSand		= Parameters("SAND")	->asGrid();
-	pSilt		= Parameters("SILT")	->asGrid();
-	pClay		= Parameters("CLAY")	->asGrid();
-	pTexture	= Parameters("TEXTURE")	->asGrid();
-	pSum		= Parameters("SUM")		->asGrid();
+	CSG_Grid	*pSand	= Parameters("SAND"   )->asGrid();
+	CSG_Grid	*pSilt	= Parameters("SILT"   )->asGrid();
+	CSG_Grid	*pClay	= Parameters("CLAY"   )->asGrid();
+	CSG_Grid	*pClass	= Parameters("TEXTURE")->asGrid();
+	CSG_Grid	*pSum	= Parameters("SUM"    )->asGrid();
 
 	//-----------------------------------------------------
 	if( (pSand ? 1 : 0) + (pSilt ? 1 : 0) + (pClay ? 1 : 0) < 2 )
@@ -227,85 +298,76 @@ bool CSoil_Texture::On_Execute(void)
 	}
 
 	//-----------------------------------------------------
-	pTexture->Set_NoData_Value(0.0);
+	pClass->Set_NoData_Value(-1.0);
 
-	CSG_Parameters	P;
+	CSG_Parameter	*pLUT	= DataObject_Get_Parameter(pClass, "LUT");
 
-	if( DataObject_Get_Parameters(pTexture, P) && P("COLORS_TYPE") && P("LUT") )
+	if( pLUT && pLUT->asTable() )
 	{
-		CSG_Table	*pLUT	= P("LUT")->asTable();
+		CSG_Table	*pClasses	= pLUT->asTable();
 
 		for(int iClass=0; iClass<12; iClass++)
 		{
-			CSG_Table_Record	*pClass;
+			CSG_Table_Record	*pClass	= pClasses->Get_Record(iClass);
 
-			if( (pClass = pLUT->Get_Record(iClass)) == NULL )
+			if( pClass == NULL )
 			{
-				pClass	= pLUT->Add_Record();
+				pClass	= pClasses->Add_Record();
 			}
 
 			pClass->Set_Value(0, Classes[iClass].Color);
 			pClass->Set_Value(1, Classes[iClass].Name);
-			pClass->Set_Value(2, Classes[iClass].Name);
-			pClass->Set_Value(3, Classes[iClass].ID);
-			pClass->Set_Value(4, Classes[iClass].ID);
+			pClass->Set_Value(2, Classes[iClass].Key);
+			pClass->Set_Value(3, iClass);
+			pClass->Set_Value(4, iClass);
 		}
 
-		while( pLUT->Get_Record_Count() > 12 )
+		while( pClasses->Get_Count() > 12 )
 		{
-			pLUT->Del_Record(pLUT->Get_Record_Count() - 1);
+			pClasses->Del_Record(pClasses->Get_Count() - 1);
 		}
 
-		P("COLORS_TYPE")->Set_Value(1);	// Color Classification Type: Lookup Table
-
-		DataObject_Set_Parameters(pTexture, P);
+		DataObject_Set_Parameter(pClass, pLUT);	// Lookup Table
+		DataObject_Set_Parameter(pClass, "COLORS_TYPE", 1);	// Color Classification Type: Lookup Table
 	}
 
 	//-----------------------------------------------------
 	for(int y=0; y<Get_NY() && Set_Progress(y); y++)
 	{
+		#pragma omp parallel for
 		for(int x=0; x<Get_NX(); x++)
 		{
-			int		Texture	= 0;
-			double	Sum		= 0.0;
-
-			if(	!(pSand && pSand->is_NoData(x, y))
-			&&	!(pSilt && pSilt->is_NoData(x, y))
-			&&	!(pClay && pClay->is_NoData(x, y)) )
+			if(	(pSand && pSand->is_NoData(x, y))
+			||	(pSilt && pSilt->is_NoData(x, y))
+			||	(pClay && pClay->is_NoData(x, y)) )
 			{
-				double	Sand	= pSand ? pSand->asDouble(x, y) : 100.0 - (pSilt->asDouble(x, y) + pClay->asDouble(x, y));
-				double	Silt	= pSilt ? pSilt->asDouble(x, y) : 100.0 - (pSand->asDouble(x, y) + pClay->asDouble(x, y));
-				double	Clay	= pClay ? pClay->asDouble(x, y) : 100.0 - (pSand->asDouble(x, y) + pSilt->asDouble(x, y));
-
-				if( (Sum = Sand + Silt + Clay) > 0.0 )
-				{
-					if( Sum != 100.0 )
-					{
-						Sand	*= 100.0 / Sum;
-						Clay	*= 100.0 / Sum;
-					}
-
-					Texture	= Get_Texture(Sand, Clay);
-				}
+				SG_GRID_PTR_SAFE_SET_NODATA(pClass, x, y);
+				SG_GRID_PTR_SAFE_SET_NODATA(pSum  , x, y);
 			}
-
-			if( Texture )
+			else
 			{
-				pTexture->Set_Value(x, y, Texture);
+				int		Class	= -1;
+				double	Sum		= 100.0;
 
-				if( pSum )
+				if( pSand && pSilt && pClay )
 				{
-					pSum->Set_Value(x, y, Sum);
+					Class	= Get_Texture(pSand->asDouble(x, y), pSilt->asDouble(x, y), pClay->asDouble(x, y), Sum);
 				}
-			}
-			else
-			{
-				pTexture->Set_NoData(x, y);
-
-				if( pSum )
+				else if( !pSilt )
+				{
+					Class	= Get_Texture_SandClay(pSand->asDouble(x, y), pClay->asDouble(x, y));
+				}
+				else if( !pClay )
 				{
-					pSum->Set_NoData(x, y);
+					Class	= Get_Texture_SandSilt(pSand->asDouble(x, y), pSilt->asDouble(x, y));
 				}
+				else if( !pSand )
+				{
+					Class	= Get_Texture_SiltClay(pSilt->asDouble(x, y), pClay->asDouble(x, y));
+				}
+
+				SG_GRID_PTR_SAFE_SET_VALUE(pClass, x, y, Class);
+				SG_GRID_PTR_SAFE_SET_VALUE(pSum  , x, y, Sum  );
 			}
 		}
 	}
@@ -322,31 +384,153 @@ bool CSoil_Texture::On_Execute(void)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-int CSoil_Texture::Get_Texture(double Sand, double Clay)
+CSoil_Texture_Table::CSoil_Texture_Table(void)
 {
-	for(int iClass=0; iClass<12; iClass++)
+	Set_Name		(_TL("Soil Texture Classification for Tables"));
+
+	Set_Author		("O.Conrad (c) 2015");
+
+	Set_Description	(Description);
+
+	//-----------------------------------------------------
+	CSG_Parameter	*pNode	= Parameters.Add_Table(
+		NULL	, "TABLE"	, _TL("Table"),
+		_TL(""),
+		PARAMETER_INPUT
+	);
+
+	Parameters.Add_Table_Field(
+		pNode	, "SAND"	, _TL("Sand"),
+		_TL("sand content given as percentage"),
+		true
+	);
+
+	Parameters.Add_Table_Field(
+		pNode	, "SILT"	, _TL("Silt"),
+		_TL("silt content given as percentage"),
+		true
+	);
+
+	Parameters.Add_Table_Field(
+		pNode	, "CLAY"	, _TL("Clay"),
+		_TL("clay content given as percentage"),
+		true
+	);
+
+	Parameters.Add_Table_Field(
+		pNode	, "TEXTURE"	, _TL("Texture"),
+		_TL("soil texture"),
+		true
+	);
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CSoil_Texture_Table::On_Execute(void)
+{
+	//-----------------------------------------------------
+	CSG_Table	*pTable		= Parameters("TABLE")->asTable();
+
+	int		iSand		= Parameters("SAND"   )->asInt();
+	int		iSilt		= Parameters("SILT"   )->asInt();
+	int		iClay		= Parameters("CLAY"   )->asInt();
+	int		iTexture	= Parameters("TEXTURE")->asInt();
+
+	//-----------------------------------------------------
+	if( (iSand >= 0 ? 1 : 0) + (iSilt >= 0 ? 1 : 0) + (iClay >= 0 ? 1 : 0) < 2 )
 	{
-		const struct SClass	*c	= Classes + iClass;
+		Error_Set(_TL("at least two contents (sand, silt, clay) have to be given"));
 
-		bool	bClass	= false;
+		return( false );
+	}
 
-		for(int i=0, j=c->nPoints-1; i<c->nPoints; j=i++)
+	//-----------------------------------------------------
+	if( iTexture < 0 )
+	{
+		iTexture	= pTable->Get_Field_Count();
+
+		pTable->Add_Field("TEXTURE", SG_DATATYPE_String);
+	}
+
+	//-----------------------------------------------------
+	for(int i=0; i<pTable->Get_Count() && Set_Progress(i, pTable->Get_Count()); i++)
+	{
+		CSG_Table_Record	*pRecord	= pTable->Get_Record(i);
+
+		if(	(iSand >= 0 && pRecord->is_NoData(iSand))
+		||	(iSilt >= 0 && pRecord->is_NoData(iSilt))
+		||	(iClay >= 0 && pRecord->is_NoData(iClay)) )
 		{
-			if( ((c->Clay[i] <= Clay && Clay < c->Clay[j]) || (c->Clay[j] <= Clay && Clay < c->Clay[i]))
-			&&	Sand < (c->Sand[j] - c->Sand[i]) * (Clay - c->Clay[i]) / (c->Clay[j] - c->Clay[i]) + c->Sand[i] )
+			pRecord->Set_NoData(iTexture);
+		}
+		else
+		{
+			int		Class	= -1;
+
+			if( iSand >= 0 && iSilt >= 0 && iClay >= 0 )
 			{
-				bClass	= !bClass;
+				double	Sum;
+
+				Class	= Get_Texture(pRecord->asDouble(iSand), pRecord->asDouble(iSilt), pRecord->asDouble(iClay), Sum);
+			}
+			else if( iSilt < 0 )
+			{
+				Class	= Get_Texture_SandClay(pRecord->asDouble(iSand), pRecord->asDouble(iClay));
+			}
+			else if( iClay < 0 )
+			{
+				Class	= Get_Texture_SandSilt(pRecord->asDouble(iSand), pRecord->asDouble(iSilt));
+			}
+			else if( iSand < 0 )
+			{
+				Class	= Get_Texture_SiltClay(pRecord->asDouble(iSilt), pRecord->asDouble(iClay));
 			}
+
+			pRecord->Set_Value (iTexture, Classes[Class].Key);
 		}
+	}
 
-		if( bClass )
+	DataObject_Update(pTable);
+
+	//-----------------------------------------------------
+	CSG_Parameter	*pLUT	= DataObject_Get_Parameter(pTable, "LUT");
+
+	if( pLUT && pLUT->asTable() )
+	{
+		CSG_Table	*pClasses	= pLUT->asTable();
+
+		for(int iClass=0; iClass<12; iClass++)
 		{
-			return( c->ID );
+			CSG_Table_Record	*pClass	= pClasses->Get_Record(iClass);
+
+			if( pClass == NULL )
+			{
+				pClass	= pClasses->Add_Record();
+			}
+
+			pClass->Set_Value(0, Classes[iClass].Color);
+			pClass->Set_Value(1, Classes[iClass].Name);
+			pClass->Set_Value(2, Classes[iClass].Name);
+			pClass->Set_Value(3, Classes[iClass].Key);
+			pClass->Set_Value(4, Classes[iClass].Key);
 		}
+
+		while( pClasses->Get_Count() > 12 )
+		{
+			pClasses->Del_Record(pClasses->Get_Count() - 1);
+		}
+
+		DataObject_Set_Parameter(pTable, pLUT);	// Lookup Table
+		DataObject_Set_Parameter(pTable, "LUT_ATTRIB" , iTexture);	// Lookup Table Attribute
+		DataObject_Set_Parameter(pTable, "COLORS_TYPE", 1       );	// Color Classification Type: Lookup Table
 	}
 
 	//-----------------------------------------------------
-	return( 0 );
+	return( true );
 }
 
 
diff --git a/src/modules/grid/grid_analysis/Soil_Texture.h b/src/modules/grid/grid_analysis/Soil_Texture.h
index 8f364a0..3f08ab4 100644
--- a/src/modules/grid/grid_analysis/Soil_Texture.h
+++ b/src/modules/grid/grid_analysis/Soil_Texture.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Soil_Texture.h 1922 2014-01-09 10:28:46Z oconrad $
+ * Version $Id: Soil_Texture.h 2365 2015-01-09 15:12:03Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -83,10 +83,25 @@ protected:
 
 	virtual bool			On_Execute		(void);
 
+};
+
 
-private:
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
 
-	int						Get_Texture		(double Sand, double Clay);
+//---------------------------------------------------------
+class CSoil_Texture_Table : public CSG_Module
+{
+public:
+	CSoil_Texture_Table(void);
+
+	virtual CSG_String		Get_MenuPath	(void)	{	return( _TL("R:Soil Analysis") );	}
+
+
+protected:
+
+	virtual bool			On_Execute		(void);
 
 };
 
diff --git a/src/modules/grid/grid_calculus/Grid_Calculator.cpp b/src/modules/grid/grid_calculus/Grid_Calculator.cpp
index 503097d..9d9cd8a 100644
--- a/src/modules/grid/grid_calculus/Grid_Calculator.cpp
+++ b/src/modules/grid/grid_calculus/Grid_Calculator.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Grid_Calculator.cpp 2207 2014-08-26 13:39:34Z oconrad $
+ * Version $Id: Grid_Calculator.cpp 2509 2015-06-15 16:18:32Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -88,6 +88,8 @@ bool _finite(double val)
 //---------------------------------------------------------
 CGrid_Calculator::CGrid_Calculator(void)
 {
+	CSG_Parameter	*pNode;
+
 	//-----------------------------------------------------
 	Set_Name	(_TL("Grid Calculator"));
 
@@ -95,12 +97,12 @@ CGrid_Calculator::CGrid_Calculator(void)
 
 	CSG_String	s(_TW(
 		"The Grid Calculator calculates a new grid based on existing grids and a mathematical formula. "
-		"The grid variables are single characters which correspond in alphabetical order to the grid list order "
-		"('a' = first grid, 'b' = second grid, ...)\n"
-		"Alternatively you can address with letter 'g' followed by position index (g1, g2, g3, ...). "
-		"Grids from other systems are addressed similarly, just using letter 'h' (h1, h2, h3, ...)\n"
-		"Examples:\n"
-		"using letters: sin(a) * b + c\n"
+		"The grid variables in the formula begin with the letter 'g' followed by a position index, "
+		"which corresponds to the order of the grids in the input grid list "
+		"(i.e.: g1, g2, g3, ... correspond to the first, second, third, ... grid in list). "
+		"Grids from other systems than the default one can be addressed likewise using the letter 'h' "
+		"(h1, h2, h3, ...), which correspond to the \'Grids from different Systems\' list.\n"
+		"Example:\t sin(g1) * g2 + h1\n"
 		"the same using indices: sin(g1) * g2 + g3\n\n"
 		"The following operators are available for the formula definition:\n"
 	));
@@ -116,49 +118,61 @@ CGrid_Calculator::CGrid_Calculator(void)
 
 	//-----------------------------------------------------
 	Parameters.Add_Grid_List(
-		NULL	, "GRIDS"	, _TL("Grids"),
+		NULL	, "GRIDS"			, _TL("Grids"),
 		_TL("in the formula these grids are addressed in order of the list as 'g1, g2, g3, ...'"),
 		PARAMETER_INPUT_OPTIONAL
 	);
 
-	Parameters.Add_Grid_List(
-		NULL	, "XGRIDS"	, _TL("Grids from different Systems"),
+	pNode	= Parameters.Add_Grid_List(
+		NULL	, "XGRIDS"			, _TL("Grids from different Systems"),
 		_TL("in the formula these grids are addressed in order of the list as 'h1, h2, h3, ...'"),
 		PARAMETER_INPUT_OPTIONAL, false
 	);
 
+	Parameters.Add_Choice(
+		pNode	,"INTERPOLATION"	, _TL("Interpolation"),
+		_TL(""),
+		CSG_String::Format(SG_T("%s|%s|%s|%s|%s|"),
+			_TL("Nearest Neighbor"),
+			_TL("Bilinear Interpolation"),
+			_TL("Inverse Distance Interpolation"),
+			_TL("Bicubic Spline Interpolation"),
+			_TL("B-Spline Interpolation")
+		), 4
+	);
+
 	Parameters.Add_Grid(
-		NULL	, "RESULT"	, _TL("Result"),
+		NULL	, "RESULT"			, _TL("Result"),
 		_TL(""),
 		PARAMETER_OUTPUT
 	);
 	
 	Parameters.Add_String(
-		NULL	, "FORMULA"	, _TL("Formula"),
+		NULL	, "FORMULA"			, _TL("Formula"),
 		_TL(""),
 		SG_T("(g1 - g2) / (g1 + g2)")
 	);
 
-	CSG_Parameter	*pNode	= Parameters.Add_String(
-		NULL	, "NAME"	, _TL("Name"),
+	pNode	= Parameters.Add_String(
+		NULL	, "NAME"			, _TL("Name"),
 		_TL(""),
 		_TL("Calculation")
 	);
 
 	Parameters.Add_Value(
-		pNode	, "FNAME"	, _TL("Take Formula"),
+		pNode	, "FNAME"			, _TL("Take Formula"),
 		_TL(""),
 		PARAMETER_TYPE_Bool, false
 	);
 
 	Parameters.Add_Value(
-		NULL	, "USE_NODATA"	, _TL("Use NoData"),
+		NULL	, "USE_NODATA"		, _TL("Use NoData"),
 		_TL("Check this in order to include NoData cells in the calculation."),
 		PARAMETER_TYPE_Bool, false
 	);
 
 	Parameters.Add_Choice(
-		NULL	, "TYPE"	, _TL("Data Type"),
+		NULL	, "TYPE"			, _TL("Data Type"),
 		_TL(""),
 		CSG_String::Format(SG_T("%s|%s|%s|%s|%s|%s|%s|%s|%s|"),
 			SG_Data_Type_Get_Name(SG_DATATYPE_Bit   ).c_str(),
@@ -177,15 +191,13 @@ CGrid_Calculator::CGrid_Calculator(void)
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 int CGrid_Calculator::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("FORMULA"))
-	||	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("FNAME")) )
+	if(	!SG_STR_CMP(pParameter->Get_Identifier(), "FORMULA")
+	||	!SG_STR_CMP(pParameter->Get_Identifier(), "FNAME") )
 	{
 		if( pParameters->Get_Parameter("FNAME")->asBool() )
 		{
@@ -193,32 +205,43 @@ int CGrid_Calculator::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Para
 		}
 	}
 
-	return( 0 );
+	return( CSG_Module_Grid::On_Parameter_Changed(pParameters, pParameter) );
+}
+
+//---------------------------------------------------------
+int CGrid_Calculator::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+{
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "XGRIDS") )
+	{
+		pParameters->Set_Enabled("INTERPOLATION", pParameter->asGridList()->Get_Count() > 0);
+	}
+
+	return( CSG_Module_Grid::On_Parameters_Enable(pParameters, pParameter) );
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//                                                       //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 bool CGrid_Calculator::On_Execute(void)
 {
-	bool					bUseNoData;
+	bool					bUseNoData, bPosition[4];
+	int						Interpol;
 	CSG_Formula				Formula;
 	CSG_Parameter_Grid_List	*pGrids, *pXGrids;
 	CSG_Grid				*pResult;
 
 	//-----------------------------------------------------
-	pResult		= Parameters("RESULT"    )->asGrid();
-	pGrids		= Parameters("GRIDS"     )->asGridList();
-	pXGrids		= Parameters("XGRIDS"    )->asGridList();
-	bUseNoData	= Parameters("USE_NODATA")->asBool();
+	pResult		= Parameters("RESULT"       )->asGrid();
+	pGrids		= Parameters("GRIDS"        )->asGridList();
+	pXGrids		= Parameters("XGRIDS"       )->asGridList();
+	bUseNoData	= Parameters("USE_NODATA"   )->asBool();
+	Interpol	= Parameters("INTERPOLATION")->asInt();
 
 	//-----------------------------------------------------
-	if( !Get_Formula(Formula, Parameters("FORMULA")->asString(), pGrids->Get_Count(), pXGrids->Get_Count()) )
+	if( !Get_Formula(Formula, Parameters("FORMULA")->asString(), pGrids->Get_Count(), pXGrids->Get_Count(), bPosition) )
 	{
 		return( false );
 	}
@@ -247,6 +270,12 @@ bool CGrid_Calculator::On_Execute(void)
 
 	pResult->Set_Name(Parameters("NAME")->asString());
 
+	int	nValues	= pGrids->Get_Count() + pXGrids->Get_Count()
+		+ (bPosition[0] ? 1 : 0)
+		+ (bPosition[1] ? 1 : 0)
+		+ (bPosition[2] ? 1 : 0)
+		+ (bPosition[3] ? 1 : 0);
+
 	//-----------------------------------------------------
 	for(int y=0; y<Get_NY() && Set_Progress(y); y++)
 	{
@@ -255,50 +284,41 @@ bool CGrid_Calculator::On_Execute(void)
 		#pragma omp parallel for
 		for(int x=0; x<Get_NX(); x++)
 		{
-			bool		bNoData	= false;
-			int			i, n;
+			bool		bOkay	= true;
+			int			i, n	= 0;
 			double		Result, px	= Get_XMin() + x * Get_Cellsize();
-			CSG_Vector	Values(pGrids->Get_Count() + pXGrids->Get_Count() + 4);
+			CSG_Vector	Values(nValues);
 
-			for(i=0, n=0; !bNoData && i<pGrids->Get_Count(); i++)
+			for(i=0; bOkay && i<pGrids->Get_Count() ; i++, n++)
 			{
-				if( !bUseNoData && pGrids->asGrid(i)->is_NoData(x, y) )
+				if( (bOkay = bUseNoData || !pGrids->asGrid(i)->is_NoData(x, y)) == true )
 				{
-					bNoData		= true;
-				}
-				else
-				{
-					Values[n++]	= pGrids->asGrid(i)->asDouble(x, y);
+					Values[n]	= pGrids->asGrid(i)->asDouble(x, y);
 				}
 			}
 
-			for(i=0, n=pGrids->Get_Count(); !bNoData && i<pXGrids->Get_Count(); i++)
+			for(i=0; bOkay && i<pXGrids->Get_Count(); i++, n++)
 			{
-				if( !pXGrids->asGrid(i)->Get_Value(px, py, Values[n++]) )
-				{
-					bNoData		= true;
-				}
+				bOkay	= pXGrids->asGrid(i)->Get_Value(px, py, Values[n], Interpol);
 			}
 
-			if( !bNoData )
+			if( bOkay )
 			{
-				n	= pGrids->Get_Count() + pXGrids->Get_Count();
-
-				Values[n++]	= y;	// col()
-				Values[n++]	= x;	// row()
-				Values[n++]	= py;	// ypos()
-				Values[n++]	= px;	// xpos()
+				if( bPosition[0] )	Values[n++]	=  x;	// col()
+				if( bPosition[1] )	Values[n++]	=  y;	// row()
+				if( bPosition[2] )	Values[n++]	= px;	// xpos()
+				if( bPosition[3] )	Values[n++]	= py;	// ypos()
 
-				bNoData	= !_finite(Result = Formula.Get_Value(Values));
+				bOkay	= _finite(Result = Formula.Get_Value(Values)) != 0;
 			}
 
-			if( bNoData )
+			if( bOkay )
 			{
-				pResult->Set_NoData(x, y);
+				pResult->Set_Value(x, y, Result);
 			}
 			else
 			{
-				pResult->Set_Value(x, y, Result);
+				pResult->Set_NoData(x, y);
 			}
 		}
 	}
@@ -310,42 +330,47 @@ bool CGrid_Calculator::On_Execute(void)
 
 ///////////////////////////////////////////////////////////
 //														 //
-//                                                       //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CGrid_Calculator::Get_Formula(CSG_Formula &Formula, CSG_String sFormula, int nGrids, int nXGrids)
+bool CGrid_Calculator::Get_Formula(CSG_Formula &Formula, CSG_String sFormula, int nGrids, int nXGrids, bool bPosition[4])
 {
 	//-----------------------------------------------------
 	const int		nVars		= 27;
 
 	const SG_Char	Vars[nVars]	= SG_T("abcdefghijklmnopqrstuvwxyz");
 
+	int		nValues	= nGrids + nXGrids;
+
+	bPosition[0]	= sFormula.Find("col()" ) >= 0;	if( bPosition[0] )	nValues++;
+	bPosition[1]	= sFormula.Find("row()" ) >= 0;	if( bPosition[1] )	nValues++;
+	bPosition[2]	= sFormula.Find("xpos()") >= 0;	if( bPosition[2] )	nValues++;
+	bPosition[3]	= sFormula.Find("ypos()") >= 0;	if( bPosition[3] )	nValues++;
+
 	//-----------------------------------------------------
-	if( nGrids + nXGrids + 4 > nVars )
+	if( nValues > nVars )
 	{
-		Error_Set(_TL("too many input grids"));
+		Error_Set(_TL("too many input variables"));
 
 		return( false );
 	}
 
 	//-----------------------------------------------------
-	int		i, n = nGrids + nXGrids + 4 - 1;
+	int		i, n	= nValues;
 
-	sFormula.Replace("xpos()", Vars[n--]);
-	sFormula.Replace("ypos()", Vars[n--]);
-	sFormula.Replace("row()" , Vars[n--]);
-	sFormula.Replace("col()" , Vars[n--]);
+	if( bPosition[3] )	sFormula.Replace("ypos()", Vars[--n]);
+	if( bPosition[2] )	sFormula.Replace("xpos()", Vars[--n]);
+	if( bPosition[1] )	sFormula.Replace("row()" , Vars[--n]);
+	if( bPosition[0] )	sFormula.Replace("col()" , Vars[--n]);
 
-	for(i=nXGrids; i>0; i--, n--)
+	for(i=nXGrids; i>0 && n>0; i--)
 	{
-		sFormula.Replace(CSG_String::Format(SG_T("h%d"), i), Vars[n]);
+		sFormula.Replace(CSG_String::Format(SG_T("h%d"), i), Vars[--n]);
 	}
 
-	for(i=nGrids; i>0; i--, n--)
+	for(i=nGrids ; i>0 && n>0; i--)
 	{
-		sFormula.Replace(CSG_String::Format(SG_T("g%d"), i), Vars[n]);
+		sFormula.Replace(CSG_String::Format(SG_T("g%d"), i), Vars[--n]);
 	}
 
 	//-----------------------------------------------------
@@ -355,7 +380,7 @@ bool CGrid_Calculator::Get_Formula(CSG_Formula &Formula, CSG_String sFormula, in
 
 		if( !Formula.Get_Error(Message) )
 		{
-			Message.Printf(SG_T("%s: %s"), _TL("error in formula"), sFormula.c_str());
+			Message.Printf("%s: %s", _TL("error in formula"), sFormula.c_str());
 		}
 
 		Error_Set(Message);
@@ -363,6 +388,22 @@ bool CGrid_Calculator::Get_Formula(CSG_Formula &Formula, CSG_String sFormula, in
 		return( false );
 	}
 
+	//-----------------------------------------------------
+	CSG_String	sUsed(Formula.Get_Used_Variables());
+
+	if( nValues < sUsed.Length() )
+	{
+		Error_Fmt("%s (%d < %d)", _TL("The number of supplied grids is less than the number of variables in formula."), nValues, sUsed.Length());
+
+		return( false );
+	}
+
+	if( nValues > sUsed.Length() )
+	{
+		Message_Add(CSG_String::Format("%s: %s (%d > %d)", _TL("Warning"), _TL("The number of supplied grids exceeds the number of variables in formula."), nValues, sUsed.Length()));
+	}
+
+	//-----------------------------------------------------
 	return( true );
 }
 
diff --git a/src/modules/grid/grid_calculus/Grid_Calculator.h b/src/modules/grid/grid_calculus/Grid_Calculator.h
index 3205990..0151845 100644
--- a/src/modules/grid/grid_calculus/Grid_Calculator.h
+++ b/src/modules/grid/grid_calculus/Grid_Calculator.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Grid_Calculator.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: Grid_Calculator.h 2467 2015-04-15 16:55:37Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -84,13 +84,14 @@ public:
 protected:
 
 	virtual int		On_Parameter_Changed	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+	virtual int		On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
 
 	virtual bool	On_Execute				(void);
 
 
 private:
 
-	bool			Get_Formula				(CSG_Formula &Formula, CSG_String sFormula, int nGrids, int nXGrids);
+	bool			Get_Formula				(CSG_Formula &Formula, CSG_String sFormula, int nGrids, int nXGrids, bool bPosition[4]);
 
 };
 
diff --git a/src/modules/grid/grid_calculus/Grid_Random_Terrain.cpp b/src/modules/grid/grid_calculus/Grid_Random_Terrain.cpp
index 1e66424..9d17b22 100644
--- a/src/modules/grid/grid_calculus/Grid_Random_Terrain.cpp
+++ b/src/modules/grid/grid_calculus/Grid_Random_Terrain.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Grid_Random_Terrain.cpp 2072 2014-03-31 08:50:43Z reklov_w $
+ * Version $Id: Grid_Random_Terrain.cpp 2448 2015-03-19 14:44:48Z oconrad $
  *********************************************************/
 /*******************************************************************************
     Grid_Random_Terrain.cpp
@@ -20,194 +20,130 @@
     Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, USA
 *******************************************************************************/ 
 
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
 #include "Grid_Random_Terrain.h"
 
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
 CGrid_Random_Terrain::CGrid_Random_Terrain(void)
 {	 
-	CSG_Parameters	*pParameters;
-	
-	Set_Name(_TL("Random Terrain Generation"));
-	Set_Author(_TL("Copyrights (c) 2004 by Victor Olaya"));
-	Set_Description	(_TW(
-		"(c) 2004 by Victor Olaya. Terrain Generation"));
-
-	Parameters.Add_Value(NULL, 
-						"RADIUS", 
-						_TL("Radius (cells)"), 
-						_TL("Radius (cells)"), 
-						PARAMETER_TYPE_Int, 
-						15);
-	
-	Parameters.Add_Value(NULL, 
-						"ITERATIONS", 
-						_TL("Iterations"), 
-						_TL("Iterations"), 
-						PARAMETER_TYPE_Int, 
-						10);
-	
-	Parameters.Add_Choice(
-		NULL, 
-		"TARGET_TYPE", 
-		_TL("Target Dimensions"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|%s|"),_TL("User defined"), _TL("Grid Project"), _TL("Grid")), 
-		0);
+	Set_Name		(_TL("Random Terrain"));
 
-	Parameters.Add_Grid_List(
-		NULL, 
-		"TARGET_GRID", 
-		_TL("Grid"),
-		_TL(""),
-		PARAMETER_OUTPUT_OPTIONAL, 
-		false);
-	
-	pParameters	= Add_Parameters("USER", _TL("User defined grid"), _TL(""));
-
-	pParameters->Add_Value(
-		NULL, 
-		"CELL_SIZE",
-		_TL("Grid Size"),
-		_TL(""),
-		PARAMETER_TYPE_Double, 
-		100.0, 
-		0.0, 
-		true);
-
-	pParameters->Add_Value(
-		NULL, 
-		"COLS",
-		_TL("Cols"),
-		_TL(""),
-		PARAMETER_TYPE_Int, 
-		100, 
-		0.0, 
-		true);		
-
-	pParameters->Add_Value(
-		NULL, 
-		"ROWS", 
-		_TL("Rows"),
-		_TL(""),
-		PARAMETER_TYPE_Int, 
-		100, 
-		0.0, 
-		true);
+	Set_Author		("V.Olaya (c) 2004");
 
-	//-----------------------------------------------------
-	pParameters	= Add_Parameters("GET_SYSTEM"	, _TL("Choose Grid Project"), _TL(""));
+	Set_Description	(_TW(
+		"(c) 2004 by Victor Olaya. Random Terrain Generation"
+	));
 
-	pParameters->Add_Grid_System(
-		NULL, "SYSTEM"		, _TL("System")		, _TL("")
+	Parameters.Add_Value(
+		NULL	, "RADIUS"	, _TL("Radius (cells)"), 
+		_TL(""), 
+		PARAMETER_TYPE_Int, 25
 	);
 
-
-	pParameters	= Add_Parameters("GRID", _TL("Choose Grid"), _TL(""));
-
-	pParameters->Add_Grid(NULL, 
-		"GRID", 
-		_TL("Grid"),
+	Parameters.Add_Value(
+		NULL,	 "ITERATIONS"	, _TL("Iterations"), 
 		_TL(""),
-		PARAMETER_INPUT	, false
+		PARAMETER_TYPE_Int, 100
 	);
+
+	//-----------------------------------------------------
+	m_Grid_Target.Create(SG_UI_Get_Window_Main() ? &Parameters : Add_Parameters("TARGET", _TL("Target System"), _TL("")));
 }
 
-CGrid_Random_Terrain::~CGrid_Random_Terrain(void)
-{}
 
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
 
-CSG_Grid * CGrid_Random_Terrain::Get_Target_Grid(CSG_Parameters *pParameters )
+//---------------------------------------------------------
+int CGrid_Random_Terrain::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-
-	double iCellSize;
-	int iRows,iCols;
-
-	iCellSize	= pParameters->Get_Parameter("CELL_SIZE")->asDouble();
-	iRows = pParameters->Get_Parameter("ROWS")->asInt();
-	iCols = pParameters->Get_Parameter("COLS")->asInt();
-	
-	return( SG_Create_Grid(SG_DATATYPE_Float, iCols, iRows, iCellSize, 0, 0) );
+	return( m_Grid_Target.On_Parameter_Changed(pParameters, pParameter) ? 1 : 0 );
 }
 
-bool CGrid_Random_Terrain::On_Execute(void)
+//---------------------------------------------------------
+int CGrid_Random_Terrain::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	
-	Parameters("TARGET_GRID")->asGridList()->Del_Items();
+	return( m_Grid_Target.On_Parameters_Enable(pParameters, pParameter) ? 1 : 0 );
+}
+
 
-	pGrid		= NULL;
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
 
-	switch( Parameters("TARGET_TYPE")->asInt() )
+//---------------------------------------------------------
+bool CGrid_Random_Terrain::On_Execute(void)
+{
+	//-----------------------------------------------------
+	if( (m_pGrid = m_Grid_Target.Get_Grid()) == NULL )
 	{
-	case 0:	// User defined...
-		if( Dlg_Parameters("USER") )
-		{
-			pGrid	= Get_Target_Grid(Get_Parameters("USER"));
-		}
-		break;
+		Error_Set(_TL("invalid target grid"));
 
-	case 1:	// Grid Project...
-		if( Dlg_Parameters("GET_SYSTEM") )
-		{
-			pGrid	= SG_Create_Grid(
-						*Get_Parameters("GET_SYSTEM")->Get_Parameter("SYSTEM")->asGrid_System()
-					);
-		}
-		break;
+		return( false );
+	}
 
-	case 2:	// Grid...
-		if( Dlg_Parameters("GRID") )
-		{
-			pGrid	= Get_Parameters("GRID")->Get_Parameter("GRID")->asGrid();
-		}
-		break;
-	}//switch
+	m_pGrid->Set_Name(_TL("Random Terrain"));
 
-	//-------------------------------------------------
-	if( pGrid )
-	{
-		Parameters("TARGET_GRID")->asGridList()->Add_Item(pGrid);
+	m_pGrid->Assign(0.0);
 
-		pGrid->Set_Name(_TL("DEM"));
-		pGrid->Assign(0.0);
+	//-----------------------------------------------------
+	m_Kernel.Set_Radius(m_Radius = Parameters("RADIUS")->asInt());
 
-		int iIterations = Parameters("ITERATIONS")->asInt();
-		int iRadius = Parameters("RADIUS")->asInt();
+	int Iterations	= Parameters("ITERATIONS")->asInt();
 
-		for	(int i=0 ; i<iIterations && Set_Progress(i,iIterations) ; i++){
-			addBump(pGrid, iRadius);
-		}//for
+	for(int i=0; i<Iterations && Set_Progress(i, Iterations); i++)
+	{
+		Add_Bump();
+	}
 
-		return( true );
-	}//if
+	//-----------------------------------------------------
+	m_Kernel.Destroy();
 
-	return( false );
+	return( true );
+}
 
-}//method
 
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
 
-void CGrid_Random_Terrain::addBump(CSG_Grid* pGrid, int iRadius){
+//---------------------------------------------------------
+void CGrid_Random_Terrain::Add_Bump(void)
+{
+	int	x	= CSG_Random::Get_Uniform(-m_Radius, m_Radius + m_pGrid->Get_NX());
+	int	y	= CSG_Random::Get_Uniform(-m_Radius, m_Radius + m_pGrid->Get_NY());
 
-	double dOffset;
-	int x,y,x2,y2;
-	double dDist;
-	double dValue;
+	for(int i=0; i<m_Kernel.Get_Count(); i++)
+	{
+		int	ix	= m_Kernel.Get_X(i, x);
+		int	iy	= m_Kernel.Get_Y(i, y);
 
-	x = rand() % pGrid->Get_NX();
-	y = rand() % pGrid->Get_NY();
+		if( m_pGrid->is_InGrid(ix, iy) )
+		{
+			m_pGrid->Add_Value(ix, iy, (m_Radius*m_Radius) - SG_Get_Square(m_Kernel.Get_Distance(i)));
+		}
+	}
+}
 
-	for	(int i=-iRadius ; i<iRadius ; i++){
-		for (int j=-iRadius ; j<iRadius ; j++){
-			x2 = x+i;
-			y2 = y+j;
-			if (x2>0 && y2>0 && x2<pGrid->Get_NX() && y2 < pGrid->Get_NY()){
-				dDist= M_GET_LENGTH(x-x2, y-y2);
-				if (dDist<=iRadius){
-					dOffset = (iRadius * iRadius) - (dDist * dDist);
-					dValue = pGrid->asDouble(x2,y2);
-					pGrid->Set_Value(x2,y2,dValue+dOffset);	
-				}//else
-			}//if
-		}//for
-	}//for
 
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
 
-}//method
+//---------------------------------------------------------
diff --git a/src/modules/grid/grid_calculus/Grid_Random_Terrain.h b/src/modules/grid/grid_calculus/Grid_Random_Terrain.h
index 6cec079..65f4ebf 100644
--- a/src/modules/grid/grid_calculus/Grid_Random_Terrain.h
+++ b/src/modules/grid/grid_calculus/Grid_Random_Terrain.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Grid_Random_Terrain.h 2072 2014-03-31 08:50:43Z reklov_w $
+ * Version $Id: Grid_Random_Terrain.h 2448 2015-03-19 14:44:48Z oconrad $
  *********************************************************/
 /*******************************************************************************
     Grid_Random_Terrain.h
@@ -19,33 +19,72 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, USA
 *******************************************************************************/ 
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
 //---------------------------------------------------------
 #ifndef HEADER_INCLUDED__Grid_Random_Terrain_H
 #define HEADER_INCLUDED__Grid_Random_Terrain_H
 
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
 #include "MLB_Interface.h"
 
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
 class CGrid_Random_Terrain : public CSG_Module
 {
 public:
 	CGrid_Random_Terrain(void);
-	virtual ~CGrid_Random_Terrain(void);
 
-	virtual CSG_String		Get_MenuPath	(void)	{	return( _TL("R:Grid Generation") );	}
+	virtual CSG_String			Get_MenuPath			(void)	{	return( _TL("R:Grid Generation") );	}
 
 
 protected:
 
-	CSG_Grid *pGrid;
+	virtual int					On_Parameter_Changed	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
 
-	bool On_Execute(void);
-	void addBump (CSG_Grid*, int);
+	virtual bool				On_Execute				(void);
 
 
 private:
 
-	CSG_Grid* Get_Target_Grid(CSG_Parameters *pParameters);
+	double						m_Radius;
+
+	CSG_Grid					*m_pGrid;
+
+	CSG_Grid_Cell_Addressor		m_Kernel;
+
+	CSG_Parameters_Grid_Target	m_Grid_Target;
+
+
+	void						Add_Bump				(void);
 
 };
 
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
 #endif // #ifndef HEADER_INCLUDED__Grid_Random_Terrain_H
diff --git a/src/modules/grid/grid_calculus/Makefile.in b/src/modules/grid/grid_calculus/Makefile.in
index f4c9756..14c17fe 100644
--- a/src/modules/grid/grid_calculus/Makefile.in
+++ b/src/modules/grid/grid_calculus/Makefile.in
@@ -127,12 +127,16 @@ am__installdirs = "$(DESTDIR)$(pkglibdir)"
 LTLIBRARIES = $(pkglib_LTLIBRARIES)
 libgrid_calculus_la_DEPENDENCIES =  \
 	$(top_srcdir)/src/saga_core/saga_api/libsaga_api.la
+am__dirstamp = $(am__leading_dot)dirstamp
 am_libgrid_calculus_la_OBJECTS = Fuzzify.lo FuzzyAND.lo FuzzyOR.lo \
-	errfunc.lo spezfunc.lo storeorg.lo gradient_cartes_polar.lo \
-	grid_metric_conversion.lo Grid_Calculator.lo \
-	grid_difference.lo Grid_Geometric_Figures.lo Grid_Normalise.lo \
-	Grid_Plotter.lo Grid_Random_Field.lo Grid_Random_Terrain.lo \
-	Grid_Volume.lo kff_synth.lo MLB_Interface.lo
+	./../grid_filter/geodesic_morph_rec/errfunc.lo \
+	./../grid_filter/geodesic_morph_rec/spezfunc.lo \
+	./../grid_filter/geodesic_morph_rec/storeorg.lo \
+	gradient_cartes_polar.lo grid_metric_conversion.lo \
+	Grid_Calculator.lo grid_difference.lo \
+	Grid_Geometric_Figures.lo Grid_Normalise.lo Grid_Plotter.lo \
+	Grid_Random_Field.lo Grid_Random_Terrain.lo Grid_Volume.lo \
+	kff_synth.lo MLB_Interface.lo
 libgrid_calculus_la_OBJECTS = $(am_libgrid_calculus_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
@@ -484,12 +488,29 @@ clean-pkglibLTLIBRARIES:
 	  echo rm -f $${locs}; \
 	  rm -f $${locs}; \
 	}
+../grid_filter/geodesic_morph_rec/$(am__dirstamp):
+	@$(MKDIR_P) ./../grid_filter/geodesic_morph_rec
+	@: > ../grid_filter/geodesic_morph_rec/$(am__dirstamp)
+../grid_filter/geodesic_morph_rec/$(DEPDIR)/$(am__dirstamp):
+	@$(MKDIR_P) ./../grid_filter/geodesic_morph_rec/$(DEPDIR)
+	@: > ../grid_filter/geodesic_morph_rec/$(DEPDIR)/$(am__dirstamp)
+./../grid_filter/geodesic_morph_rec/errfunc.lo:  \
+	../grid_filter/geodesic_morph_rec/$(am__dirstamp) \
+	../grid_filter/geodesic_morph_rec/$(DEPDIR)/$(am__dirstamp)
+./../grid_filter/geodesic_morph_rec/spezfunc.lo:  \
+	../grid_filter/geodesic_morph_rec/$(am__dirstamp) \
+	../grid_filter/geodesic_morph_rec/$(DEPDIR)/$(am__dirstamp)
+./../grid_filter/geodesic_morph_rec/storeorg.lo:  \
+	../grid_filter/geodesic_morph_rec/$(am__dirstamp) \
+	../grid_filter/geodesic_morph_rec/$(DEPDIR)/$(am__dirstamp)
 
 libgrid_calculus.la: $(libgrid_calculus_la_OBJECTS) $(libgrid_calculus_la_DEPENDENCIES) $(EXTRA_libgrid_calculus_la_DEPENDENCIES) 
 	$(AM_V_CXXLD)$(CXXLINK) -rpath $(pkglibdir) $(libgrid_calculus_la_OBJECTS) $(libgrid_calculus_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
+	-rm -f ./../grid_filter/geodesic_morph_rec/*.$(OBJEXT)
+	-rm -f ./../grid_filter/geodesic_morph_rec/*.lo
 
 distclean-compile:
 	-rm -f *.tab.c
@@ -505,73 +526,58 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Grid_Random_Terrain.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Grid_Volume.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MLB_Interface.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/errfunc.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gradient_cartes_polar.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/grid_difference.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/grid_metric_conversion.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kff_synth.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/spezfunc.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/storeorg.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./../grid_filter/geodesic_morph_rec/$(DEPDIR)/errfunc.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./../grid_filter/geodesic_morph_rec/$(DEPDIR)/spezfunc.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./../grid_filter/geodesic_morph_rec/$(DEPDIR)/storeorg.Plo at am__quote@
 
 .c.o:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(COMPILE) -c -o $@ $<
 
 .c.obj:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .c.lo:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LTCOMPILE) -c -o $@ $<
 
-errfunc.lo: ./../grid_filter/geodesic_morph_rec/errfunc.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT errfunc.lo -MD -MP -MF $(DEPDIR)/errfunc.Tpo -c -o errfunc.lo `test -f './../grid_filter/geodesic_morph_rec/errfunc.c' || echo '$(srcdir)/'`./../grid_filter/geodesic_morph_rec/errfunc.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/errfunc.Tpo $(DEPDIR)/errfunc.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./../grid_filter/geodesic_morph_rec/errfunc.c' object='errfunc.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o errfunc.lo `test -f './../grid_filter/geodesic_morph_rec/errfunc.c' || echo '$(srcdir)/'`./../grid_filter/geodesic_morph_rec/errfunc.c
-
-spezfunc.lo: ./../grid_filter/geodesic_morph_rec/spezfunc.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spezfunc.lo -MD -MP -MF $(DEPDIR)/spezfunc.Tpo -c -o spezfunc.lo `test -f './../grid_filter/geodesic_morph_rec/spezfunc.c' || echo '$(srcdir)/'`./../grid_filter/geodesic_morph_rec/spezfunc.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/spezfunc.Tpo $(DEPDIR)/spezfunc.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./../grid_filter/geodesic_morph_rec/spezfunc.c' object='spezfunc.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spezfunc.lo `test -f './../grid_filter/geodesic_morph_rec/spezfunc.c' || echo '$(srcdir)/'`./../grid_filter/geodesic_morph_rec/spezfunc.c
-
-storeorg.lo: ./../grid_filter/geodesic_morph_rec/storeorg.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT storeorg.lo -MD -MP -MF $(DEPDIR)/storeorg.Tpo -c -o storeorg.lo `test -f './../grid_filter/geodesic_morph_rec/storeorg.c' || echo '$(srcdir)/'`./../grid_filter/geodesic_morph_rec/storeorg.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/storeorg.Tpo $(DEPDIR)/storeorg.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./../grid_filter/geodesic_morph_rec/storeorg.c' object='storeorg.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o storeorg.lo `test -f './../grid_filter/geodesic_morph_rec/storeorg.c' || echo '$(srcdir)/'`./../grid_filter/geodesic_morph_rec/storeorg.c
-
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
@@ -581,6 +587,7 @@ mostlyclean-libtool:
 
 clean-libtool:
 	-rm -rf .libs _libs
+	-rm -rf ./../grid_filter/geodesic_morph_rec/.libs ./../grid_filter/geodesic_morph_rec/_libs
 
 ID: $(am__tagged_files)
 	$(am__define_uniq_tagged_files); mkid -fID $$unique
@@ -697,6 +704,8 @@ clean-generic:
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-rm -f ../grid_filter/geodesic_morph_rec/$(DEPDIR)/$(am__dirstamp)
+	-rm -f ../grid_filter/geodesic_morph_rec/$(am__dirstamp)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -707,7 +716,7 @@ clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
 	mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+	-rm -rf ./$(DEPDIR) ./../grid_filter/geodesic_morph_rec/$(DEPDIR)
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -753,7 +762,7 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+	-rm -rf ./$(DEPDIR) ./../grid_filter/geodesic_morph_rec/$(DEPDIR)
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
diff --git a/src/modules/grid/grid_calculus_bsl/Makefile.in b/src/modules/grid/grid_calculus_bsl/Makefile.in
index 36dfd61..15d1b94 100644
--- a/src/modules/grid/grid_calculus_bsl/Makefile.in
+++ b/src/modules/grid/grid_calculus_bsl/Makefile.in
@@ -514,22 +514,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/zuweisung.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/grid/grid_calculus_bsl/ausdruck.cpp b/src/modules/grid/grid_calculus_bsl/ausdruck.cpp
index 2682f62..08f566f 100644
--- a/src/modules/grid/grid_calculus_bsl/ausdruck.cpp
+++ b/src/modules/grid/grid_calculus_bsl/ausdruck.cpp
@@ -1,11 +1,12 @@
 /**********************************************************
- * Version $Id: ausdruck.cpp 911 2011-02-14 16:38:15Z reklov_w $
+ * Version $Id: ausdruck.cpp 2387 2015-02-01 22:26:22Z oconrad $
  *********************************************************/
 
 //#include "..\stdafx.h"
 #include <iostream>
 
 #include <vector>
+#include <functional>
 #include "ausdruck.h"
 #include "funktion.h"
 
diff --git a/src/modules/grid/grid_calculus_bsl/basistypen.cpp b/src/modules/grid/grid_calculus_bsl/basistypen.cpp
index 76c55d3..98002e0 100644
--- a/src/modules/grid/grid_calculus_bsl/basistypen.cpp
+++ b/src/modules/grid/grid_calculus_bsl/basistypen.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: basistypen.cpp 911 2011-02-14 16:38:15Z reklov_w $
+ * Version $Id: basistypen.cpp 2387 2015-02-01 22:26:22Z oconrad $
  *********************************************************/
 
 #include <iostream>
@@ -7,6 +7,7 @@
 #include <sstream>
 #include <sstream>
 #include <locale>
+#include <functional>
 
 #include "basistypen.h"
 
diff --git a/src/modules/grid/grid_filter/Filter_Majority.cpp b/src/modules/grid/grid_filter/Filter_Majority.cpp
index b0f4b9e..f52a77f 100644
--- a/src/modules/grid/grid_filter/Filter_Majority.cpp
+++ b/src/modules/grid/grid_filter/Filter_Majority.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Filter_Majority.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: Filter_Majority.cpp 2476 2015-04-22 18:41:38Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -76,7 +76,7 @@ CFilter_Majority::CFilter_Majority(void)
 
 	Set_Name		(_TL("Majority Filter"));
 
-	Set_Author		(SG_T("O.Conrad (c) 2010"));
+	Set_Author		("O.Conrad (c) 2010");
 
 	Set_Description	(_TW(
 		"Majority filter for grids."
@@ -101,7 +101,7 @@ CFilter_Majority::CFilter_Majority(void)
 	Parameters.Add_Choice(
 		NULL, "MODE"		, _TL("Search Mode"),
 		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
+		CSG_String::Format("%s|%s|",
 			_TL("Square"),
 			_TL("Circle")
 		), 1
@@ -130,44 +130,19 @@ CFilter_Majority::CFilter_Majority(void)
 //---------------------------------------------------------
 bool CFilter_Majority::On_Execute(void)
 {
-	int			x, y, ix, iy;
-	CSG_Grid	*pResult;
-
-	//-----------------------------------------------------
-	m_pInput	= Parameters("INPUT")	->asGrid();
-	pResult		= Parameters("RESULT")	->asGrid();
-	m_Radius	= Parameters("RADIUS")	->asInt();
-
 	//-----------------------------------------------------
-	m_Kernel.Create(SG_DATATYPE_Byte, 1 + 2 * m_Radius, 1 + 2 * m_Radius);
-	m_Kernel.Set_NoData_Value(0.0);
-	m_Kernel.Assign(1.0);
-	m_Kernel.Set_Value(m_Radius, m_Radius, 0.0);
+	m_Kernel.Set_Radius(Parameters("RADIUS")->asInt(), Parameters("MODE")->asInt() == 0);
 
-	if( Parameters("MODE")->asInt() == 1 )
-	{
-		for(y=-m_Radius, iy=0; y<=m_Radius; y++, iy++)
-		{
-			for(x=-m_Radius, ix=0; x<=m_Radius; x++, ix++)
-			{
-				if( x*x + y*y > m_Radius*m_Radius )
-				{
-					m_Kernel.Set_Value(ix, iy, 0.0);
-				}
-			}
-		}
-	}
+	m_Threshold	= 1 + (int)((1 + m_Kernel.Get_Count()) * Parameters("THRESHOLD")->asDouble() / 100.0);
 
-	m_Majority.Create();
-
-	m_Threshold	= m_Kernel.Get_NoData_Count();
+	//-----------------------------------------------------
+	m_pInput	= Parameters("INPUT")->asGrid();
 
-	m_Threshold	= 1 + (int)(0.01 * Parameters("THRESHOLD")->asDouble() * (1 + m_Kernel.Get_NCells() - m_Kernel.Get_NoData_Count()));
+	CSG_Grid	Input, *pResult	= Parameters("RESULT")->asGrid();
 
-	//-----------------------------------------------------
 	if( !pResult || pResult == m_pInput )
 	{
-		pResult	= SG_Create_Grid(m_pInput);
+		Input.Create(*m_pInput); pResult = m_pInput; m_pInput = &Input;
 	}
 	else
 	{
@@ -177,9 +152,10 @@ bool CFilter_Majority::On_Execute(void)
 	}
 
 	//-----------------------------------------------------
-	for(y=0; y<Get_NY() && Set_Progress(y); y++)
+	for(int y=0; y<Get_NY() && Set_Progress(y); y++)
 	{
-		for(x=0; x<Get_NX(); x++)
+		#pragma omp parallel for
+		for(int x=0; x<Get_NX(); x++)
 		{
 			if( m_pInput->is_InGrid(x, y) )
 			{
@@ -193,17 +169,12 @@ bool CFilter_Majority::On_Execute(void)
 	}
 
 	//-----------------------------------------------------
-	if( !Parameters("RESULT")->asGrid() || Parameters("RESULT")->asGrid() == m_pInput )
+	if( m_pInput == &Input )
 	{
-		m_pInput->Assign(pResult);
-
-		delete(pResult);
-
-		DataObject_Update(m_pInput);
+		DataObject_Update(pResult);
 	}
 
-	m_Kernel	.Destroy();
-	m_Majority	.Destroy();
+	m_Kernel.Destroy();
 
 	return( true );
 }
@@ -218,25 +189,25 @@ bool CFilter_Majority::On_Execute(void)
 //---------------------------------------------------------
 double CFilter_Majority::Get_Majority(int x, int y)
 {
-	m_Majority.Reset();
+	CSG_Class_Statistics	Majority;
 
-	m_Majority.Add_Value(m_pInput->asDouble(x, y));
+	Majority.Add_Value(m_pInput->asDouble(x, y));
 
-	for(int iy=0, jy=y-m_Radius; iy<m_Kernel.Get_NY(); iy++, jy++)
+	for(int i=0; i<m_Kernel.Get_Count(); i++)
 	{
-		for(int ix=0, jx=x-m_Radius; ix<m_Kernel.Get_NX(); ix++, jx++)
+		int	ix	= m_Kernel.Get_X(i, x);
+		int	iy	= m_Kernel.Get_Y(i, y);
+
+		if( m_pInput->is_InGrid(ix, iy) )
 		{
-			if( m_Kernel.asByte(ix, iy) && m_pInput->is_InGrid(jx, jy) )
-			{
-				m_Majority.Add_Value(m_pInput->asDouble(jx, jy));
-			}
+			Majority.Add_Value(m_pInput->asDouble(ix, iy));
 		}
 	}
 
 	int		Count;
 	double	Value;
 
-	m_Majority.Get_Majority(Value, Count);
+	Majority.Get_Majority(Value, Count);
 
 	return( Count > m_Threshold ? Value : m_pInput->asDouble(x, y) );
 }
diff --git a/src/modules/grid/grid_filter/Filter_Majority.h b/src/modules/grid/grid_filter/Filter_Majority.h
index 83bf64c..df38dda 100644
--- a/src/modules/grid/grid_filter/Filter_Majority.h
+++ b/src/modules/grid/grid_filter/Filter_Majority.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Filter_Majority.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: Filter_Majority.h 2476 2015-04-22 18:41:38Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -93,11 +93,11 @@ protected:
 
 private:
 
-	int						m_Radius, m_Threshold;
+	int						m_Threshold;
 
-	CSG_Grid				m_Kernel, *m_pInput;
+	CSG_Grid				*m_pInput;
 
-	CSG_Class_Statistics	m_Majority;
+	CSG_Grid_Cell_Addressor	m_Kernel;
 
 
 	double					Get_Majority	(int x, int y);
diff --git a/src/modules/grid/grid_filter/Filter_Rank.cpp b/src/modules/grid/grid_filter/Filter_Rank.cpp
index b701119..eb6732f 100644
--- a/src/modules/grid/grid_filter/Filter_Rank.cpp
+++ b/src/modules/grid/grid_filter/Filter_Rank.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Filter_Rank.cpp 2064 2014-03-21 13:20:57Z oconrad $
+ * Version $Id: Filter_Rank.cpp 2476 2015-04-22 18:41:38Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -130,22 +130,19 @@ CFilter_Rank::CFilter_Rank(void)
 //---------------------------------------------------------
 bool CFilter_Rank::On_Execute(void)
 {
-	int			x, y;
-	double		Rank;
-	CSG_Grid	*pResult;
-
-	//-----------------------------------------------------
-	m_pInput	= Parameters("INPUT" )->asGrid();
-	pResult		= Parameters("RESULT")->asGrid();
-	Rank		= Parameters("RANK"  )->asInt() / 100.0;
-
 	//-----------------------------------------------------
 	m_Kernel.Set_Radius(Parameters("RADIUS")->asInt(), Parameters("MODE")->asInt() == 0);
 
+	double	Rank	= Parameters("RANK")->asDouble() / 100.0;
+
 	//-----------------------------------------------------
+	m_pInput	= Parameters("INPUT")->asGrid();
+
+	CSG_Grid	Input, *pResult	= Parameters("RESULT")->asGrid();
+
 	if( !pResult || pResult == m_pInput )
 	{
-		pResult	= SG_Create_Grid(m_pInput);
+		Input.Create(*m_pInput); pResult = m_pInput; m_pInput = &Input;
 	}
 	else
 	{
@@ -155,10 +152,10 @@ bool CFilter_Rank::On_Execute(void)
 	}
 
 	//-----------------------------------------------------
-	for(y=0; y<Get_NY() && Set_Progress(y); y++)
+	for(int y=0; y<Get_NY() && Set_Progress(y); y++)
 	{
-		#pragma omp parallel private(x)
-		for(x=0; x<Get_NX(); x++)
+		#pragma omp parallel for
+		for(int x=0; x<Get_NX(); x++)
 		{
 			double	Value;
 
@@ -174,13 +171,9 @@ bool CFilter_Rank::On_Execute(void)
 	}
 
 	//-----------------------------------------------------
-	if( !Parameters("RESULT")->asGrid() || Parameters("RESULT")->asGrid() == m_pInput )
+	if( m_pInput == &Input )
 	{
-		m_pInput->Assign(pResult);
-
-		delete(pResult);
-
-		DataObject_Update(m_pInput);
+		DataObject_Update(pResult);
 	}
 
 	m_Kernel.Destroy();
diff --git a/src/modules/grid/grid_filter/Makefile.in b/src/modules/grid/grid_filter/Makefile.in
index 005e10c..75928eb 100644
--- a/src/modules/grid/grid_filter/Makefile.in
+++ b/src/modules/grid/grid_filter/Makefile.in
@@ -127,13 +127,17 @@ am__installdirs = "$(DESTDIR)$(pkglibdir)"
 LTLIBRARIES = $(pkglib_LTLIBRARIES)
 libgrid_filter_la_DEPENDENCIES =  \
 	$(top_srcdir)/src/saga_core/saga_api/libsaga_api.la
+am__dirstamp = $(am__leading_dot)dirstamp
 am_libgrid_filter_la_OBJECTS = bin_erosion_reconst.lo \
 	connect_analysis.lo Filter.lo Filter_3x3.lo Filter_Gauss.lo \
 	Filter_LoG.lo Filter_Majority.lo Filter_Morphology.lo \
 	Filter_Multi_Dir_Lee.lo Filter_Rank.lo Filter_Resample.lo \
 	Filter_Sieve.lo Filter_Terrain_SlopeBased.lo FilterClumps.lo \
-	geomrec.lo bin_geovinc.lo combcontour.lo geovinc.lo \
-	storeorg.lo mesh_denoise.lo MLB_Interface.lo
+	geomrec.lo ./geodesic_morph_rec/bin_geovinc.lo \
+	./geodesic_morph_rec/combcontour.lo \
+	./geodesic_morph_rec/geovinc.lo \
+	./geodesic_morph_rec/storeorg.lo mesh_denoise.lo \
+	MLB_Interface.lo
 libgrid_filter_la_OBJECTS = $(am_libgrid_filter_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
@@ -491,12 +495,30 @@ clean-pkglibLTLIBRARIES:
 	  echo rm -f $${locs}; \
 	  rm -f $${locs}; \
 	}
+geodesic_morph_rec/$(am__dirstamp):
+	@$(MKDIR_P) ./geodesic_morph_rec
+	@: > geodesic_morph_rec/$(am__dirstamp)
+geodesic_morph_rec/$(DEPDIR)/$(am__dirstamp):
+	@$(MKDIR_P) ./geodesic_morph_rec/$(DEPDIR)
+	@: > geodesic_morph_rec/$(DEPDIR)/$(am__dirstamp)
+./geodesic_morph_rec/bin_geovinc.lo:  \
+	geodesic_morph_rec/$(am__dirstamp) \
+	geodesic_morph_rec/$(DEPDIR)/$(am__dirstamp)
+./geodesic_morph_rec/combcontour.lo:  \
+	geodesic_morph_rec/$(am__dirstamp) \
+	geodesic_morph_rec/$(DEPDIR)/$(am__dirstamp)
+./geodesic_morph_rec/geovinc.lo: geodesic_morph_rec/$(am__dirstamp) \
+	geodesic_morph_rec/$(DEPDIR)/$(am__dirstamp)
+./geodesic_morph_rec/storeorg.lo: geodesic_morph_rec/$(am__dirstamp) \
+	geodesic_morph_rec/$(DEPDIR)/$(am__dirstamp)
 
 libgrid_filter.la: $(libgrid_filter_la_OBJECTS) $(libgrid_filter_la_DEPENDENCIES) $(EXTRA_libgrid_filter_la_DEPENDENCIES) 
 	$(AM_V_CXXLD)$(CXXLINK) -rpath $(pkglibdir) $(libgrid_filter_la_OBJECTS) $(libgrid_filter_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
+	-rm -f ./geodesic_morph_rec/*.$(OBJEXT)
+	-rm -f ./geodesic_morph_rec/*.lo
 
 distclean-compile:
 	-rm -f *.tab.c
@@ -515,80 +537,58 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Filter_Terrain_SlopeBased.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MLB_Interface.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bin_erosion_reconst.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bin_geovinc.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/combcontour.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/connect_analysis.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/geomrec.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/geovinc.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mesh_denoise.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/storeorg.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./geodesic_morph_rec/$(DEPDIR)/bin_geovinc.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./geodesic_morph_rec/$(DEPDIR)/combcontour.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./geodesic_morph_rec/$(DEPDIR)/geovinc.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./geodesic_morph_rec/$(DEPDIR)/storeorg.Plo at am__quote@
 
 .c.o:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(COMPILE) -c -o $@ $<
 
 .c.obj:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .c.lo:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LTCOMPILE) -c -o $@ $<
 
-bin_geovinc.lo: ./geodesic_morph_rec/bin_geovinc.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bin_geovinc.lo -MD -MP -MF $(DEPDIR)/bin_geovinc.Tpo -c -o bin_geovinc.lo `test -f './geodesic_morph_rec/bin_geovinc.c' || echo '$(srcdir)/'`./geodesic_morph_rec/bin_geovinc.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/bin_geovinc.Tpo $(DEPDIR)/bin_geovinc.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./geodesic_morph_rec/bin_geovinc.c' object='bin_geovinc.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bin_geovinc.lo `test -f './geodesic_morph_rec/bin_geovinc.c' || echo '$(srcdir)/'`./geodesic_morph_rec/bin_geovinc.c
-
-combcontour.lo: ./geodesic_morph_rec/combcontour.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT combcontour.lo -MD -MP -MF $(DEPDIR)/combcontour.Tpo -c -o combcontour.lo `test -f './geodesic_morph_rec/combcontour.c' || echo '$(srcdir)/'`./geodesic_morph_rec/combcontour.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/combcontour.Tpo $(DEPDIR)/combcontour.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./geodesic_morph_rec/combcontour.c' object='combcontour.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o combcontour.lo `test -f './geodesic_morph_rec/combcontour.c' || echo '$(srcdir)/'`./geodesic_morph_rec/combcontour.c
-
-geovinc.lo: ./geodesic_morph_rec/geovinc.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT geovinc.lo -MD -MP -MF $(DEPDIR)/geovinc.Tpo -c -o geovinc.lo `test -f './geodesic_morph_rec/geovinc.c' || echo '$(srcdir)/'`./geodesic_morph_rec/geovinc.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/geovinc.Tpo $(DEPDIR)/geovinc.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./geodesic_morph_rec/geovinc.c' object='geovinc.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o geovinc.lo `test -f './geodesic_morph_rec/geovinc.c' || echo '$(srcdir)/'`./geodesic_morph_rec/geovinc.c
-
-storeorg.lo: ./geodesic_morph_rec/storeorg.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT storeorg.lo -MD -MP -MF $(DEPDIR)/storeorg.Tpo -c -o storeorg.lo `test -f './geodesic_morph_rec/storeorg.c' || echo '$(srcdir)/'`./geodesic_morph_rec/storeorg.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/storeorg.Tpo $(DEPDIR)/storeorg.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./geodesic_morph_rec/storeorg.c' object='storeorg.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o storeorg.lo `test -f './geodesic_morph_rec/storeorg.c' || echo '$(srcdir)/'`./geodesic_morph_rec/storeorg.c
-
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
@@ -598,6 +598,7 @@ mostlyclean-libtool:
 
 clean-libtool:
 	-rm -rf .libs _libs
+	-rm -rf ./geodesic_morph_rec/.libs ./geodesic_morph_rec/_libs
 
 ID: $(am__tagged_files)
 	$(am__define_uniq_tagged_files); mkid -fID $$unique
@@ -714,6 +715,8 @@ clean-generic:
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-rm -f geodesic_morph_rec/$(DEPDIR)/$(am__dirstamp)
+	-rm -f geodesic_morph_rec/$(am__dirstamp)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -724,7 +727,7 @@ clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
 	mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+	-rm -rf ./$(DEPDIR) ./geodesic_morph_rec/$(DEPDIR)
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -770,7 +773,7 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+	-rm -rf ./$(DEPDIR) ./geodesic_morph_rec/$(DEPDIR)
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
diff --git a/src/modules/grid/grid_filter/geodesic_morph_rec/geovinc.c b/src/modules/grid/grid_filter/geodesic_morph_rec/geovinc.c
index ef76b3f..154e872 100644
--- a/src/modules/grid/grid_filter/geodesic_morph_rec/geovinc.c
+++ b/src/modules/grid/grid_filter/geodesic_morph_rec/geovinc.c
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: geovinc.c 1936 2014-01-11 14:07:20Z reklov_w $
+ * Version $Id: geovinc.c 2348 2014-12-10 10:38:15Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -550,7 +550,16 @@ int geodesic_morphological_reconstruction (
 
    flat_region_list (&mr_first, &mr_last, &first_pix, &last_pix, marker);
   
-   memset (*marker, 0x00, numrows * numcols * sizeof (double));
+   //memset (*marker, 0x00, numrows * numcols * sizeof (double));	// this does not work with negative cell values, so we use the following:
+
+   for (row = 0; row < numrows; row ++)
+   {
+	   for (col = 0; col < numcols; col ++)
+	   {
+		  marker [row][col] = -9.9e+19;
+	   }
+   }
+
 
    for (curr_pix = first_pix; curr_pix != NULL; curr_pix = curr_pix -> next)
    {
diff --git a/src/modules/grid/grid_filter/geomrec.cpp b/src/modules/grid/grid_filter/geomrec.cpp
index c9788ec..51998ec 100644
--- a/src/modules/grid/grid_filter/geomrec.cpp
+++ b/src/modules/grid/grid_filter/geomrec.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: geomrec.cpp 1936 2014-01-11 14:07:20Z reklov_w $
+ * Version $Id: geomrec.cpp 2348 2014-12-10 10:38:15Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -96,7 +96,7 @@ CGeomrec::CGeomrec(void)
 	CSG_Parameter	*pNode;
 
 	Parameters.Add_Grid (NULL, "INPUT_GRID", _TL ("Input Grid"), _TL ("Input for the morphological reconstruction"), PARAMETER_INPUT);
-	Parameters.Add_Grid (NULL, "OBJECT_GRID", _TL("Object Grid"), _TL("Binary object mask"), PARAMETER_OUTPUT, true, SG_DATATYPE_Bit);
+	Parameters.Add_Grid (NULL, "OBJECT_GRID", _TL("Object Grid"), _TL("Binary object mask"), PARAMETER_OUTPUT, true, SG_DATATYPE_Char);
 	Parameters.Add_Grid (NULL, "DIFFERENCE_GRID", _TL ("Difference Input - Reconstruction"), _TL ("Difference Input - Reconstruction"), PARAMETER_OUTPUT);
 	Parameters.Add_Value (Parameters ("SHIFT"), "SHIFT_VALUE", _TL ("Shift value"), _TL ("Shift value"), PARAMETER_TYPE_Double, 5);
 	Parameters.Add_Value (NULL, "BORDER_YES_NO", _TL ("Preserve 1px border Yes/No"), _TL ("Preserve 1px border Yes/No"), PARAMETER_TYPE_Bool, true);
@@ -146,8 +146,8 @@ bool CGeomrec::On_Execute(void)
        {
 		  if (pinpgrid->is_NoData(x,y)) // check if there are no_data in input datasets
 		  {
-		 	 mask [x][y] = 0;
-		 	 marker [x][y] = 0;
+		 	 mask [x][y] = -999999.9;
+		 	 marker [x][y] = -999999.9;
 		  }
 		  else if ((pborder) && ((x==0)||(y==0)||(x==Get_NX()-1)||(y==Get_NY()-1)))
    		  {
diff --git a/src/modules/grid/grid_gridding/Interpolation.cpp b/src/modules/grid/grid_gridding/Interpolation.cpp
index ea9c9b6..55aaf17 100644
--- a/src/modules/grid/grid_gridding/Interpolation.cpp
+++ b/src/modules/grid/grid_gridding/Interpolation.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Interpolation.cpp 2221 2014-09-04 16:02:43Z oconrad $
+ * Version $Id: Interpolation.cpp 2415 2015-02-18 14:27:34Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -97,9 +97,9 @@ CInterpolation::CInterpolation(void)
 //---------------------------------------------------------
 int CInterpolation::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	if( !SG_STR_CMP(pParameter->Get_Identifier(), "SHAPES") && pParameter->asShapes() )
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "SHAPES") )
 	{
-		m_Grid_Target.Set_User_Defined(pParameters, pParameter->asShapes()->Get_Extent());
+		m_Grid_Target.Set_User_Defined(pParameters, pParameter->asShapes());
 	}
 
 	return( m_Grid_Target.On_Parameter_Changed(pParameters, pParameter) ? 1 : 0 );
@@ -128,7 +128,7 @@ bool CInterpolation::On_Execute(void)
 	//-----------------------------------------------------
 	bool	bResult	= false;
 
-	m_Grid_Target.Set_User_Defined(Get_Parameters("TARGET"), m_pShapes->Get_Extent());	Dlg_Parameters("TARGET");	// if called from saga_cmd
+	m_Grid_Target.Cmd_Update(m_pShapes);	// if called from saga_cmd
 
 	if( (m_pGrid = m_Grid_Target.Get_Grid()) != NULL )
 	{
@@ -138,8 +138,6 @@ bool CInterpolation::On_Execute(void)
 	}
 
 	//-----------------------------------------------------
-	m_Search.Destroy();
-
 	if( m_pShapes != Parameters("SHAPES")->asShapes() )
 	{
 		delete(m_pShapes);
@@ -232,12 +230,6 @@ CSG_Shapes * CInterpolation::Get_Points(bool bOnlyNonPoints)
 	return( m_pShapes );
 }
 
-//---------------------------------------------------------
-bool CInterpolation::Set_Search_Engine(void)
-{
-	return( m_Search.Create(m_pShapes, m_zField) );
-}
-
 
 ///////////////////////////////////////////////////////////
 //														 //
diff --git a/src/modules/grid/grid_gridding/Interpolation.h b/src/modules/grid/grid_gridding/Interpolation.h
index e227799..36856b0 100644
--- a/src/modules/grid/grid_gridding/Interpolation.h
+++ b/src/modules/grid/grid_gridding/Interpolation.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Interpolation.h 2212 2014-09-01 13:29:48Z oconrad $
+ * Version $Id: Interpolation.h 2381 2015-01-30 16:37:39Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -100,8 +100,6 @@ protected:
 
 	int							m_zField;
 
-	CSG_PRQuadTree				m_Search;
-
 	CSG_Grid					*m_pGrid;
 
 	CSG_Shapes					*m_pShapes;
@@ -115,7 +113,6 @@ protected:
 	virtual bool				Get_Value				(double x, double y, double &z)	{	return( true );	}
 
 	CSG_Shapes *				Get_Points				(bool bOnlyNonPoints = false);
-	bool						Set_Search_Engine		(void);
 
 
 private:
diff --git a/src/modules/grid/grid_gridding/Interpolation_AngularDistance.cpp b/src/modules/grid/grid_gridding/Interpolation_AngularDistance.cpp
index c93bfb1..c5ad876 100644
--- a/src/modules/grid/grid_gridding/Interpolation_AngularDistance.cpp
+++ b/src/modules/grid/grid_gridding/Interpolation_AngularDistance.cpp
@@ -73,12 +73,10 @@
 //---------------------------------------------------------
 CInterpolation_AngularDistance::CInterpolation_AngularDistance(void)
 {
-	CSG_Parameter	*pNode;
-
 	//-----------------------------------------------------
 	Set_Name		(_TL("Angular Distance Weighted"));
 
-	Set_Author		(SG_T("O.Conrad (c) 2013"));
+	Set_Author		("O.Conrad (c) 2013");
 
 	Set_Description	(_TW(
 		"Angular Distance Weighted (ADW) grid interpolation from irregular distributed points.\n"
@@ -90,188 +88,81 @@ CInterpolation_AngularDistance::CInterpolation_AngularDistance(void)
 	));
 
 	//-----------------------------------------------------
-	CSG_Parameter	*pSearch	= Parameters.Add_Node(
-		NULL	, "NODE_SEARCH"			, _TL("Search Options"),
-		_TL("")
-	);
-
-	pNode	= Parameters.Add_Choice(
-		pSearch	, "SEARCH_RANGE"		, _TL("Search Range"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("local"),
-			_TL("global")
-		)
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_RADIUS"		, _TL("Maximum Search Distance"),
-		_TL("local maximum search distance given in map units"),
-		PARAMETER_TYPE_Double	, 1000.0, 0, true
-	);
-
-	pNode	= Parameters.Add_Choice(
-		pSearch	, "SEARCH_POINTS_ALL"	, _TL("Number of Points"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("maximum number of nearest points"),
-			_TL("all points within search distance")
-		)
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_POINTS_MAX"	, _TL("Maximum Number of Points"),
-		_TL("maximum number of nearest points"),
-		PARAMETER_TYPE_Int, 20, 1, true
-	);
-
-	Parameters.Add_Choice(
-		pNode	, "SEARCH_DIRECTION"	, _TL("Search Direction"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("all directions"),
-			_TL("quadrants")
-		)
-	);
+	m_Search.Create(&Parameters, Parameters.Add_Node(NULL, "NODE_SEARCH", _TL("Search Options"), _TL("")));
 
 	//-----------------------------------------------------
-	pNode	= Parameters.Add_Choice(
-		NULL	, "WEIGHTING"	, _TL("Distance Weighting"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|%s|%s|"),
-			_TL("inverse distance to a power"),
-			_TL("linearly decreasing within search radius"),
-			_TL("exponential weighting scheme"),
-			_TL("gaussian weighting scheme")
-		), 0
-	);
-
-	Parameters.Add_Value(
-		pNode	, "WEIGHT_POWER"		, _TL("Power"),
-		_TL(""),
-		PARAMETER_TYPE_Double	, 2.0
-	);
+	m_Weighting.Set_Weighting (SG_DISTWGHT_IDW);
+	m_Weighting.Set_IDW_Offset(false);
+	m_Weighting.Set_IDW_Power (2.0);
 
-	Parameters.Add_Value(
-		pNode	, "WEIGHT_BANDWIDTH"	, _TL("Bandwidth"),
-		_TL(""),
-		PARAMETER_TYPE_Double	, 1.0, 0.0, true
-	);
+	m_Weighting.Create_Parameters(&Parameters, false);
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-int CInterpolation_AngularDistance::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+int CInterpolation_AngularDistance::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("SEARCH_RANGE")) )
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "SHAPES") )
 	{
-		pParameters->Get_Parameter("SEARCH_RADIUS"    )->Set_Enabled(pParameter->asInt() == 0);	// local
-	}
+		m_Search.On_Parameter_Changed(pParameters, pParameter);
 
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("SEARCH_POINTS_ALL")) )
-	{
-		pParameters->Get_Parameter("SEARCH_POINTS_MAX")->Set_Enabled(pParameter->asInt() == 0);	// maximum number of points
-		pParameters->Get_Parameter("SEARCH_DIRECTION" )->Set_Enabled(pParameter->asInt() == 0);	// maximum number of points per quadrant
+		if( pParameter->asShapes() && pParameter->asShapes()->Get_Count() > 1 )
+		{	// get a rough estimation of point density for band width suggestion
+			pParameters->Get_Parameter("DW_BANDWIDTH")->Set_Value(SG_Get_Rounded_To_SignificantFigures(
+				0.5 * sqrt(pParameter->asShapes()->Get_Extent().Get_Area() / pParameter->asShapes()->Get_Count()), 1
+			));
+		}
 	}
 
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("WEIGHTING")) )
-	{
-		pParameters->Get_Parameter("WEIGHT_POWER"     )->Set_Enabled(pParameter->asInt() == 0);	// idw to a power
-		pParameters->Get_Parameter("WEIGHT_BANDWIDTH" )->Set_Enabled(pParameter->asInt() >= 2);	// exponential or gaussian
-	}
+	return( CInterpolation::On_Parameter_Changed(pParameters, pParameter) );
+}
+
+//---------------------------------------------------------
+int CInterpolation_AngularDistance::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+{
+	m_Search.On_Parameters_Enable(pParameters, pParameter);
+
+	m_Weighting.Enable_Parameters(pParameters);
 
-	return( CInterpolation::On_Parameters_Enable(pParameters, pParameter) ? 1 : 0 );
+	return( CInterpolation::On_Parameters_Enable(pParameters, pParameter) );
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 bool CInterpolation_AngularDistance::On_Initialize(void)
 {
-	m_Weighting		= Parameters("WEIGHTING"        )->asInt();
-	m_Power			= Parameters("WEIGHT_POWER"     )->asDouble();
-	m_Bandwidth		= Parameters("WEIGHT_BANDWIDTH" )->asDouble();
-
-	m_nPoints_Max	= Parameters("SEARCH_POINTS_ALL")->asInt() == 0 ? Parameters("SEARCH_POINTS_MAX")->asInt   () : 0;
-	m_Radius		= Parameters("SEARCH_RANGE"     )->asInt() == 0 ? Parameters("SEARCH_RADIUS"    )->asDouble() : 0.0;
-	m_iQuadrant		= Parameters("SEARCH_DIRECTION" )->asInt() == 0 ? -1 : 4;
-
-	return( (m_nPoints_Max <= 0 && m_Radius <= 0.0) || Set_Search_Engine() );
-}
-
-//---------------------------------------------------------
-inline double CInterpolation_AngularDistance::Get_Weight(double Distance)
-{
-	switch( m_Weighting )
-	{
-	default:	return( Distance > 0.0 ? pow(Distance, -m_Power) : -1.0 );
-	case 1:		return( Distance < m_Radius ? (1.0 - Distance / m_Radius) : 0.0 );
-	case 2:		return( exp(-Distance / m_Bandwidth) );
-	case 3:		return( exp(-0.5 * SG_Get_Square(Distance / m_Bandwidth)) );
-	}
+	return(	m_Search.Initialize(m_pShapes, m_zField)
+		&&  m_Weighting.Set_Parameters(&Parameters) 
+	);
 }
 
 //---------------------------------------------------------
-int CInterpolation_AngularDistance::Get_Count(double x, double y)
+bool CInterpolation_AngularDistance::On_Finalize(void)
 {
-	if( m_nPoints_Max > 0 || m_Radius > 0.0 )			// using search engine
-	{
-		return( m_Search.Select_Nearest_Points(x, y, m_nPoints_Max, m_Radius, m_iQuadrant) );
-	}
+	m_Search.Finalize();
 
-	return( m_pShapes->Get_Count() );					// without search engine
+	return(	true );
 }
 
-//---------------------------------------------------------
-inline bool CInterpolation_AngularDistance::Get_Point(int iPoint, double x, double y, double &ix, double &iy, double &id, double &iw, double &iz)
-{
-	if( m_nPoints_Max > 0 || m_Radius > 0.0 )			// using search engine
-	{
-		if( m_Search.Get_Selected_Point(iPoint, ix, iy, iz) )
-		{
-			id	= SG_Get_Distance(x, y, ix, iy);
-			iw	= Get_Weight(id);
 
-			return( true );
-		}
-	}
-
-	//-----------------------------------------------------
-	CSG_Shape	*pPoint	= m_pShapes->Get_Shape(iPoint);	// without search engine
-
-	if( pPoint )
-	{
-		TSG_Point	p	= pPoint->Get_Point(0);
-
-		ix	= p.x;
-		iy	= p.y;
-		iz	= pPoint->asDouble(m_zField);
-		id	= SG_Get_Distance(x, y, ix, iy);
-		iw	= Get_Weight(id);
-
-		return( true );
-	}
-
-	return( false );
-}
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 bool CInterpolation_AngularDistance::Get_Value(double x, double y, double &z)
 {
 	int		i, j, n;
 
-	if( (n = Get_Count(x, y)) <= 0 )
+	if( (n = m_Search.Set_Location(x, y)) <= 0 )
 	{
 		return( false );
 	}
@@ -281,7 +172,10 @@ bool CInterpolation_AngularDistance::Get_Value(double x, double y, double &z)
 
 	for(i=0; i<n; i++)
 	{
-		Get_Point(i, x, y, X[i], Y[i], D[i], W[i], Z[i]);
+		m_Search.Get_Point(i, X[i], Y[i], Z[i]);
+
+		D[i]	= SG_Get_Distance(x, y, X[i], Y[i]);
+		W[i]	= m_Weighting.Get_Weight(D[i]);
 
 		if( D[i] <= 0.0 )
 		{
diff --git a/src/modules/grid/grid_gridding/Interpolation_AngularDistance.h b/src/modules/grid/grid_gridding/Interpolation_AngularDistance.h
index 945e7d3..96125f5 100644
--- a/src/modules/grid/grid_gridding/Interpolation_AngularDistance.h
+++ b/src/modules/grid/grid_gridding/Interpolation_AngularDistance.h
@@ -90,26 +90,20 @@ public:
 
 protected:
 
+	virtual int				On_Parameter_Changed	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
 	virtual int				On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
 
 	virtual bool			On_Initialize			(void);
+	virtual bool			On_Finalize				(void);
 
 	virtual bool			Get_Value				(double x, double y, double &z);
 
 
 private:
 
-	int						m_Weighting, m_nPoints_Max, m_iQuadrant;
-
-	double					m_Power, m_Bandwidth, m_Radius;
-
-
-	double					Get_Weight				(double Distance);
-
-	int						Get_Count				(double x, double y);
-
-	bool					Get_Point				(int iPoint, double x, double y, double &ix, double &iy, double &id, double &iw, double &iz);
+	CSG_Parameters_Search_Points	m_Search;
 
+	CSG_Distance_Weighting			m_Weighting;
 
 };
 
diff --git a/src/modules/grid/grid_gridding/Interpolation_InverseDistance.cpp b/src/modules/grid/grid_gridding/Interpolation_InverseDistance.cpp
index 9b6ece4..da500c5 100644
--- a/src/modules/grid/grid_gridding/Interpolation_InverseDistance.cpp
+++ b/src/modules/grid/grid_gridding/Interpolation_InverseDistance.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Interpolation_InverseDistance.cpp 2212 2014-09-01 13:29:48Z oconrad $
+ * Version $Id: Interpolation_InverseDistance.cpp 2381 2015-01-30 16:37:39Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -73,197 +73,91 @@
 //---------------------------------------------------------
 CInterpolation_InverseDistance::CInterpolation_InverseDistance(void)
 {
-	CSG_Parameter	*pNode;
-
 	//-----------------------------------------------------
 	Set_Name		(_TL("Inverse Distance Weighted"));
 
-	Set_Author		(SG_T("O.Conrad (c) 2003"));
+	Set_Author		("O.Conrad (c) 2003");
 
 	Set_Description	(_TW(
 		"Inverse distance grid interpolation from irregular distributed points."
 	));
 
 	//-----------------------------------------------------
-	CSG_Parameter	*pSearch	= Parameters.Add_Node(
-		NULL	, "NODE_SEARCH"			, _TL("Search Options"),
-		_TL("")
-	);
-
-	pNode	= Parameters.Add_Choice(
-		pSearch	, "SEARCH_RANGE"		, _TL("Search Range"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("local"),
-			_TL("global")
-		)
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_RADIUS"		, _TL("Maximum Search Distance"),
-		_TL("local maximum search distance given in map units"),
-		PARAMETER_TYPE_Double	, 1000.0, 0, true
-	);
-
-	pNode	= Parameters.Add_Choice(
-		pSearch	, "SEARCH_POINTS_ALL"	, _TL("Number of Points"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("maximum number of nearest points"),
-			_TL("all points within search distance")
-		)
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_POINTS_MAX"	, _TL("Maximum Number of Points"),
-		_TL("maximum number of nearest points"),
-		PARAMETER_TYPE_Int, 20, 1, true
-	);
-
-	Parameters.Add_Choice(
-		pNode	, "SEARCH_DIRECTION"	, _TL("Search Direction"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("all directions"),
-			_TL("quadrants")
-		)
-	);
+	m_Search.Create(&Parameters, Parameters.Add_Node(NULL, "NODE_SEARCH", _TL("Search Options"), _TL("")));
 
 	//-----------------------------------------------------
-	pNode	= Parameters.Add_Choice(
-		NULL	, "WEIGHTING"	, _TL("Distance Weighting"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|%s|%s|"),
-			_TL("inverse distance to a power"),
-			_TL("linearly decreasing within search radius"),
-			_TL("exponential weighting scheme"),
-			_TL("gaussian weighting scheme")
-		), 0
-	);
-
-	Parameters.Add_Value(
-		pNode	, "WEIGHT_POWER"		, _TL("Power"),
-		_TL(""),
-		PARAMETER_TYPE_Double	, 2.0
-	);
+	m_Weighting.Set_Weighting (SG_DISTWGHT_IDW);
+	m_Weighting.Set_IDW_Offset(false);
+	m_Weighting.Set_IDW_Power (2.0);
 
-	Parameters.Add_Value(
-		pNode	, "WEIGHT_BANDWIDTH"	, _TL("Bandwidth"),
-		_TL(""),
-		PARAMETER_TYPE_Double	, 1.0, 0.0, true
-	);
+	m_Weighting.Create_Parameters(&Parameters, false);
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-int CInterpolation_InverseDistance::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+int CInterpolation_InverseDistance::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("SEARCH_RANGE")) )
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "SHAPES") )
 	{
-		pParameters->Get_Parameter("SEARCH_RADIUS"    )->Set_Enabled(pParameter->asInt() == 0);	// local
-	}
+		m_Search.On_Parameter_Changed(pParameters, pParameter);
 
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("SEARCH_POINTS_ALL")) )
-	{
-		pParameters->Get_Parameter("SEARCH_POINTS_MAX")->Set_Enabled(pParameter->asInt() == 0);	// maximum number of points
-		pParameters->Get_Parameter("SEARCH_DIRECTION" )->Set_Enabled(pParameter->asInt() == 0);	// maximum number of points per quadrant
+		if( pParameter->asShapes() && pParameter->asShapes()->Get_Count() > 1 )
+		{	// get a rough estimation of point density for band width suggestion
+			pParameters->Get_Parameter("DW_BANDWIDTH")->Set_Value(SG_Get_Rounded_To_SignificantFigures(
+				0.5 * sqrt(pParameter->asShapes()->Get_Extent().Get_Area() / pParameter->asShapes()->Get_Count()), 1
+			));
+		}
 	}
 
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("WEIGHTING")) )
-	{
-		pParameters->Get_Parameter("WEIGHT_POWER"     )->Set_Enabled(pParameter->asInt() == 0);	// idw to a power
-		pParameters->Get_Parameter("WEIGHT_BANDWIDTH" )->Set_Enabled(pParameter->asInt() >= 2);	// exponential or gaussian
-	}
+	return( CInterpolation::On_Parameter_Changed(pParameters, pParameter) );
+}
+
+//---------------------------------------------------------
+int CInterpolation_InverseDistance::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+{
+	m_Search.On_Parameters_Enable(pParameters, pParameter);
+
+	m_Weighting.Enable_Parameters(pParameters);
 
-	return( CInterpolation::On_Parameters_Enable(pParameters, pParameter) ? 1 : 0 );
+	return( CInterpolation::On_Parameters_Enable(pParameters, pParameter) );
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 bool CInterpolation_InverseDistance::On_Initialize(void)
 {
-	m_Weighting		= Parameters("WEIGHTING"        )->asInt();
-	m_Power			= Parameters("WEIGHT_POWER"     )->asDouble();
-	m_Bandwidth		= Parameters("WEIGHT_BANDWIDTH" )->asDouble();
-
-	m_nPoints_Max	= Parameters("SEARCH_POINTS_ALL")->asInt() == 0 ? Parameters("SEARCH_POINTS_MAX")->asInt   () : 0;
-	m_Radius		= Parameters("SEARCH_RANGE"     )->asInt() == 0 ? Parameters("SEARCH_RADIUS"    )->asDouble() : 0.0;
-	m_iQuadrant		= Parameters("SEARCH_DIRECTION" )->asInt() == 0 ? -1 : 4;
-
-	return( (m_nPoints_Max <= 0 && m_Radius <= 0.0) || Set_Search_Engine() );
-}
-
-//---------------------------------------------------------
-inline double CInterpolation_InverseDistance::Get_Weight(double Distance)
-{
-	switch( m_Weighting )
-	{
-	default:	return( Distance > 0.0 ? pow(Distance, -m_Power) : -1.0 );
-	case 1:		return( Distance < m_Radius ? (1.0 - Distance / m_Radius) : 0.0 );
-	case 2:		return( exp(-Distance / m_Bandwidth) );
-	case 3:		return( exp(-0.5 * SG_Get_Square(Distance / m_Bandwidth)) );
-	}
+	return(	m_Search.Initialize(m_pShapes, m_zField)
+		&&  m_Weighting.Set_Parameters(&Parameters) 
+	);
 }
 
 //---------------------------------------------------------
-int CInterpolation_InverseDistance::Get_Count(double x, double y)
+bool CInterpolation_InverseDistance::On_Finalize(void)
 {
-	if( m_nPoints_Max > 0 || m_Radius > 0.0 )			// using search engine
-	{
-		return( m_Search.Select_Nearest_Points(x, y, m_nPoints_Max, m_Radius, m_iQuadrant) );
-	}
+	m_Search.Finalize();
 
-	return( m_pShapes->Get_Count() );					// without search engine
+	return(	true );
 }
 
-//---------------------------------------------------------
-inline bool CInterpolation_InverseDistance::Get_Point(int iPoint, double x, double y, double &w, double &z)
-{
-	TSG_Point	p;
-
-	if( m_nPoints_Max > 0 || m_Radius > 0.0 )	// using search engine
-	{
-		if( !m_Search.Get_Selected_Point(iPoint, p.x, p.y, z) )
-		{
-			return( false );
-		}
-	}
-	else										// without search engine
-	{
-		CSG_Shape	*pPoint	= m_pShapes->Get_Shape(iPoint);
-
-		if( !pPoint || pPoint->is_NoData(m_zField) )
-		{
-			return( false );
-		}
-
-		p	= pPoint->Get_Point(0);
-		z	= pPoint->asDouble(m_zField);
-	}
-
-	w	= Get_Weight(SG_Get_Distance(x, y, p.x, p.y));
 
-	return( true );
-}
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 bool CInterpolation_InverseDistance::Get_Value(double x, double y, double &z)
 {
-	int		nPoints	= Get_Count(x, y);
+	int		n	= m_Search.Set_Location(x, y);
 
-	if( nPoints <= 0 )
+	if( n <= 0 )
 	{
 		return( false );
 	}
@@ -271,13 +165,13 @@ bool CInterpolation_InverseDistance::Get_Value(double x, double y, double &z)
 	//-----------------------------------------------------
 	CSG_Simple_Statistics	s;
 
-	for(int iPoint=0; iPoint<nPoints; iPoint++)
-	{
-		double	w;
+	double	ix, iy, w;
 
-		if( Get_Point(iPoint, x, y, w, z) )
+	for(int i=0; i<n; i++)
+	{
+		if( m_Search.Get_Point(i, ix, iy, z) )
 		{
-			if( w < 0.0 )
+			if( (w = m_Weighting.Get_Weight(SG_Get_Distance(x, y, ix, iy))) < 0.0 )
 			{
 				return( true );
 			}
diff --git a/src/modules/grid/grid_gridding/Interpolation_InverseDistance.h b/src/modules/grid/grid_gridding/Interpolation_InverseDistance.h
index 2c30753..c10beb9 100644
--- a/src/modules/grid/grid_gridding/Interpolation_InverseDistance.h
+++ b/src/modules/grid/grid_gridding/Interpolation_InverseDistance.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Interpolation_InverseDistance.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: Interpolation_InverseDistance.h 2381 2015-01-30 16:37:39Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -90,26 +90,20 @@ public:
 
 protected:
 
+	virtual int				On_Parameter_Changed	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
 	virtual int				On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
 
 	virtual bool			On_Initialize			(void);
+	virtual bool			On_Finalize				(void);
 
 	virtual bool			Get_Value				(double x, double y, double &z);
 
 
 private:
 
-	int						m_Weighting, m_nPoints_Max, m_iQuadrant;
-
-	double					m_Power, m_Bandwidth, m_Radius;
-
-
-	double					Get_Weight				(double Distance);
-
-	int						Get_Count				(double x, double y);
-
-	bool					Get_Point				(int iPoint, double x, double y, double &iw, double &iz);
+	CSG_Parameters_Search_Points	m_Search;
 
+	CSG_Distance_Weighting			m_Weighting;
 
 };
 
diff --git a/src/modules/grid/grid_gridding/Interpolation_NaturalNeighbour.cpp b/src/modules/grid/grid_gridding/Interpolation_NaturalNeighbour.cpp
index 25b8268..4e27184 100644
--- a/src/modules/grid/grid_gridding/Interpolation_NaturalNeighbour.cpp
+++ b/src/modules/grid/grid_gridding/Interpolation_NaturalNeighbour.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Interpolation_NaturalNeighbour.cpp 2064 2014-03-21 13:20:57Z oconrad $
+ * Version $Id: Interpolation_NaturalNeighbour.cpp 2447 2015-03-19 14:43:42Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -151,7 +151,7 @@ bool CInterpolation_NaturalNeighbour::Interpolate(void)
 
 	//-----------------------------------------------------
 	Process_Set_Text(_TL("creating interpolator"));
-	nnai	*pNN	= nnai_build(pTIN, m_pGrid->Get_NCells(), xDst, yDst);
+	nnai	*pNN	= nnai_build(pTIN, (long)m_pGrid->Get_NCells(), xDst, yDst);
 
     Process_Set_Text(_TL("interpolating"));
     nnai_interpolate(pNN, zSrc, zDst);
diff --git a/src/modules/grid/grid_gridding/Interpolation_NearestNeighbour.cpp b/src/modules/grid/grid_gridding/Interpolation_NearestNeighbour.cpp
index e888047..50d0c4a 100644
--- a/src/modules/grid/grid_gridding/Interpolation_NearestNeighbour.cpp
+++ b/src/modules/grid/grid_gridding/Interpolation_NearestNeighbour.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Interpolation_NearestNeighbour.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: Interpolation_NearestNeighbour.cpp 2381 2015-01-30 16:37:39Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -75,7 +75,7 @@ CInterpolation_NearestNeighbour::CInterpolation_NearestNeighbour(void)
 {
 	Set_Name		(_TL("Nearest Neighbour"));
 
-	Set_Author		(SG_T("(c) 2003 by O.Conrad"));
+	Set_Author		("O.Conrad (c) 2003");
 
 	Set_Description	(_TW(
 		"Nearest Neighbour method for grid interpolation from irregular distributed points.")
@@ -85,16 +85,27 @@ CInterpolation_NearestNeighbour::CInterpolation_NearestNeighbour(void)
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 bool CInterpolation_NearestNeighbour::On_Initialize(void)
 {
-	return( Set_Search_Engine() );
+	return( m_Search.Create(m_pShapes, m_zField) );
+}
+
+//---------------------------------------------------------
+bool CInterpolation_NearestNeighbour::On_Finalize(void)
+{
+	m_Search.Destroy();
+
+	return( true );
 }
 
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
 //---------------------------------------------------------
 bool CInterpolation_NearestNeighbour::Get_Value(double x, double y, double &z)
 {
diff --git a/src/modules/grid/grid_gridding/Interpolation_NearestNeighbour.h b/src/modules/grid/grid_gridding/Interpolation_NearestNeighbour.h
index b9655d4..a9fa16f 100644
--- a/src/modules/grid/grid_gridding/Interpolation_NearestNeighbour.h
+++ b/src/modules/grid/grid_gridding/Interpolation_NearestNeighbour.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Interpolation_NearestNeighbour.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: Interpolation_NearestNeighbour.h 2381 2015-01-30 16:37:39Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -90,9 +90,15 @@ public:
 
 protected:
 
-	virtual bool			On_Initialize		(void);
+	virtual bool				On_Initialize		(void);
+	virtual bool				On_Finalize			(void);
 
-	virtual bool			Get_Value			(double x, double y, double &z);
+	virtual bool				Get_Value			(double x, double y, double &z);
+
+
+private:
+
+	CSG_PRQuadTree				m_Search;
 
 };
 
diff --git a/src/modules/grid/grid_gridding/Makefile.in b/src/modules/grid/grid_gridding/Makefile.in
index 1f26f3c..4f6544d 100644
--- a/src/modules/grid/grid_gridding/Makefile.in
+++ b/src/modules/grid/grid_gridding/Makefile.in
@@ -127,14 +127,16 @@ am__installdirs = "$(DESTDIR)$(pkglibdir)"
 LTLIBRARIES = $(pkglib_LTLIBRARIES)
 libgrid_gridding_la_DEPENDENCIES =  \
 	$(top_srcdir)/src/saga_core/saga_api/libsaga_api.la
+am__dirstamp = $(am__leading_dot)dirstamp
 am_libgrid_gridding_la_OBJECTS = Interpolation.lo \
 	Interpolation_AngularDistance.lo \
 	Interpolation_InverseDistance.lo \
 	Interpolation_NaturalNeighbour.lo \
 	Interpolation_NearestNeighbour.lo Interpolation_Shepard.lo \
 	Interpolation_Triangulation.lo kernel_density.lo \
-	MLB_Interface.lo Shapes2Grid.lo Shepard.lo delaunay.lo hash.lo \
-	istack.lo lpi.lo nnai.lo nncommon.lo nnpi.lo triangle.lo
+	MLB_Interface.lo Shapes2Grid.lo Shepard.lo ./nn/delaunay.lo \
+	./nn/hash.lo ./nn/istack.lo ./nn/lpi.lo ./nn/nnai.lo \
+	./nn/nncommon.lo ./nn/nnpi.lo ./nn/triangle.lo
 libgrid_gridding_la_OBJECTS = $(am_libgrid_gridding_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
@@ -487,12 +489,28 @@ clean-pkglibLTLIBRARIES:
 	  echo rm -f $${locs}; \
 	  rm -f $${locs}; \
 	}
+nn/$(am__dirstamp):
+	@$(MKDIR_P) ./nn
+	@: > nn/$(am__dirstamp)
+nn/$(DEPDIR)/$(am__dirstamp):
+	@$(MKDIR_P) ./nn/$(DEPDIR)
+	@: > nn/$(DEPDIR)/$(am__dirstamp)
+./nn/delaunay.lo: nn/$(am__dirstamp) nn/$(DEPDIR)/$(am__dirstamp)
+./nn/hash.lo: nn/$(am__dirstamp) nn/$(DEPDIR)/$(am__dirstamp)
+./nn/istack.lo: nn/$(am__dirstamp) nn/$(DEPDIR)/$(am__dirstamp)
+./nn/lpi.lo: nn/$(am__dirstamp) nn/$(DEPDIR)/$(am__dirstamp)
+./nn/nnai.lo: nn/$(am__dirstamp) nn/$(DEPDIR)/$(am__dirstamp)
+./nn/nncommon.lo: nn/$(am__dirstamp) nn/$(DEPDIR)/$(am__dirstamp)
+./nn/nnpi.lo: nn/$(am__dirstamp) nn/$(DEPDIR)/$(am__dirstamp)
+./nn/triangle.lo: nn/$(am__dirstamp) nn/$(DEPDIR)/$(am__dirstamp)
 
 libgrid_gridding.la: $(libgrid_gridding_la_OBJECTS) $(libgrid_gridding_la_DEPENDENCIES) $(EXTRA_libgrid_gridding_la_DEPENDENCIES) 
 	$(AM_V_CXXLD)$(CXXLINK) -rpath $(pkglibdir) $(libgrid_gridding_la_OBJECTS) $(libgrid_gridding_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
+	-rm -f ./nn/*.$(OBJEXT)
+	-rm -f ./nn/*.lo
 
 distclean-compile:
 	-rm -f *.tab.c
@@ -507,110 +525,60 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MLB_Interface.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Shapes2Grid.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Shepard.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/delaunay.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hash.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/istack.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kernel_density.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lpi.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nnai.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nncommon.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nnpi.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/triangle.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./nn/$(DEPDIR)/delaunay.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./nn/$(DEPDIR)/hash.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./nn/$(DEPDIR)/istack.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./nn/$(DEPDIR)/lpi.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./nn/$(DEPDIR)/nnai.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./nn/$(DEPDIR)/nncommon.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./nn/$(DEPDIR)/nnpi.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./nn/$(DEPDIR)/triangle.Plo at am__quote@
 
 .c.o:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(COMPILE) -c -o $@ $<
 
 .c.obj:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .c.lo:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LTCOMPILE) -c -o $@ $<
 
-delaunay.lo: ./nn/delaunay.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT delaunay.lo -MD -MP -MF $(DEPDIR)/delaunay.Tpo -c -o delaunay.lo `test -f './nn/delaunay.c' || echo '$(srcdir)/'`./nn/delaunay.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/delaunay.Tpo $(DEPDIR)/delaunay.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./nn/delaunay.c' object='delaunay.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o delaunay.lo `test -f './nn/delaunay.c' || echo '$(srcdir)/'`./nn/delaunay.c
-
-hash.lo: ./nn/hash.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hash.lo -MD -MP -MF $(DEPDIR)/hash.Tpo -c -o hash.lo `test -f './nn/hash.c' || echo '$(srcdir)/'`./nn/hash.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/hash.Tpo $(DEPDIR)/hash.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./nn/hash.c' object='hash.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hash.lo `test -f './nn/hash.c' || echo '$(srcdir)/'`./nn/hash.c
-
-istack.lo: ./nn/istack.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT istack.lo -MD -MP -MF $(DEPDIR)/istack.Tpo -c -o istack.lo `test -f './nn/istack.c' || echo '$(srcdir)/'`./nn/istack.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/istack.Tpo $(DEPDIR)/istack.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./nn/istack.c' object='istack.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o istack.lo `test -f './nn/istack.c' || echo '$(srcdir)/'`./nn/istack.c
-
-lpi.lo: ./nn/lpi.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lpi.lo -MD -MP -MF $(DEPDIR)/lpi.Tpo -c -o lpi.lo `test -f './nn/lpi.c' || echo '$(srcdir)/'`./nn/lpi.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/lpi.Tpo $(DEPDIR)/lpi.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./nn/lpi.c' object='lpi.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lpi.lo `test -f './nn/lpi.c' || echo '$(srcdir)/'`./nn/lpi.c
-
-nnai.lo: ./nn/nnai.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nnai.lo -MD -MP -MF $(DEPDIR)/nnai.Tpo -c -o nnai.lo `test -f './nn/nnai.c' || echo '$(srcdir)/'`./nn/nnai.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/nnai.Tpo $(DEPDIR)/nnai.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./nn/nnai.c' object='nnai.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nnai.lo `test -f './nn/nnai.c' || echo '$(srcdir)/'`./nn/nnai.c
-
-nncommon.lo: ./nn/nncommon.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nncommon.lo -MD -MP -MF $(DEPDIR)/nncommon.Tpo -c -o nncommon.lo `test -f './nn/nncommon.c' || echo '$(srcdir)/'`./nn/nncommon.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/nncommon.Tpo $(DEPDIR)/nncommon.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./nn/nncommon.c' object='nncommon.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nncommon.lo `test -f './nn/nncommon.c' || echo '$(srcdir)/'`./nn/nncommon.c
-
-nnpi.lo: ./nn/nnpi.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nnpi.lo -MD -MP -MF $(DEPDIR)/nnpi.Tpo -c -o nnpi.lo `test -f './nn/nnpi.c' || echo '$(srcdir)/'`./nn/nnpi.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/nnpi.Tpo $(DEPDIR)/nnpi.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./nn/nnpi.c' object='nnpi.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nnpi.lo `test -f './nn/nnpi.c' || echo '$(srcdir)/'`./nn/nnpi.c
-
-triangle.lo: ./nn/triangle.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT triangle.lo -MD -MP -MF $(DEPDIR)/triangle.Tpo -c -o triangle.lo `test -f './nn/triangle.c' || echo '$(srcdir)/'`./nn/triangle.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/triangle.Tpo $(DEPDIR)/triangle.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./nn/triangle.c' object='triangle.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o triangle.lo `test -f './nn/triangle.c' || echo '$(srcdir)/'`./nn/triangle.c
-
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
@@ -620,6 +588,7 @@ mostlyclean-libtool:
 
 clean-libtool:
 	-rm -rf .libs _libs
+	-rm -rf ./nn/.libs ./nn/_libs
 
 ID: $(am__tagged_files)
 	$(am__define_uniq_tagged_files); mkid -fID $$unique
@@ -736,6 +705,8 @@ clean-generic:
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-rm -f nn/$(DEPDIR)/$(am__dirstamp)
+	-rm -f nn/$(am__dirstamp)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -746,7 +717,7 @@ clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
 	mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+	-rm -rf ./$(DEPDIR) ./nn/$(DEPDIR)
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -792,7 +763,7 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+	-rm -rf ./$(DEPDIR) ./nn/$(DEPDIR)
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
diff --git a/src/modules/grid/grid_gridding/Shapes2Grid.cpp b/src/modules/grid/grid_gridding/Shapes2Grid.cpp
index ddd14dd..4b1ce8b 100644
--- a/src/modules/grid/grid_gridding/Shapes2Grid.cpp
+++ b/src/modules/grid/grid_gridding/Shapes2Grid.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Shapes2Grid.cpp 2221 2014-09-04 16:02:43Z oconrad $
+ * Version $Id: Shapes2Grid.cpp 2415 2015-02-18 14:27:34Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -176,9 +176,9 @@ CShapes2Grid::CShapes2Grid(void)
 //---------------------------------------------------------
 int CShapes2Grid::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("INPUT")) && pParameter->asShapes() )
+	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("INPUT")) )
 	{
-		m_Grid_Target.Set_User_Defined(pParameters, pParameter->asShapes()->Get_Extent());
+		m_Grid_Target.Set_User_Defined(pParameters, pParameter->asShapes());
 	}
 
 	return( m_Grid_Target.On_Parameter_Changed(pParameters, pParameter) ? 1 : 0 );
@@ -264,7 +264,7 @@ bool CShapes2Grid::On_Execute(void)
 	}
 
 	//-----------------------------------------------------
-	m_Grid_Target.Set_User_Defined(Get_Parameters("TARGET"), m_pShapes->Get_Extent());	Dlg_Parameters("TARGET");	// if called from saga_cmd
+	m_Grid_Target.Cmd_Update(m_pShapes);	// if called from saga_cmd
 
 	if( (m_pGrid = m_Grid_Target.Get_Grid(Get_Grid_Type(Parameters("GRID_TYPE")->asInt()))) == NULL )
 	{
diff --git a/src/modules/grid/grid_gridding/kernel_density.cpp b/src/modules/grid/grid_gridding/kernel_density.cpp
index 385acf4..394b910 100644
--- a/src/modules/grid/grid_gridding/kernel_density.cpp
+++ b/src/modules/grid/grid_gridding/kernel_density.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: kernel_density.cpp 2221 2014-09-04 16:02:43Z oconrad $
+ * Version $Id: kernel_density.cpp 2415 2015-02-18 14:27:34Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -185,7 +185,7 @@ bool CKernel_Density::On_Execute(void)
 	}
 
 	//-----------------------------------------------------
-	m_Grid_Target.Set_User_Defined(Get_Parameters("TARGET"), pPoints->Get_Extent());	Dlg_Parameters("TARGET");	// if called from saga_cmd
+	m_Grid_Target.Cmd_Update(pPoints);	// if called from saga_cmd
 
 	if( (m_pGrid = m_Grid_Target.Get_Grid()) == NULL )
 	{
diff --git a/src/modules/grid/grid_spline/Gridding_Spline_Base.cpp b/src/modules/grid/grid_spline/Gridding_Spline_Base.cpp
index aa5de3b..8a2602f 100644
--- a/src/modules/grid/grid_spline/Gridding_Spline_Base.cpp
+++ b/src/modules/grid/grid_spline/Gridding_Spline_Base.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Gridding_Spline_Base.cpp 2221 2014-09-04 16:02:43Z oconrad $
+ * Version $Id: Gridding_Spline_Base.cpp 2412 2015-02-17 22:18:08Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -112,14 +112,14 @@ CGridding_Spline_Base::CGridding_Spline_Base(bool bGridPoints)
 //---------------------------------------------------------
 int CGridding_Spline_Base::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	if( !SG_STR_CMP(pParameter->Get_Identifier(), "SHAPES") && pParameter->asShapes() )
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "SHAPES") )
 	{
-		m_Grid_Target.Set_User_Defined(pParameters, pParameter->asShapes()->Get_Extent());
+		m_Grid_Target.Set_User_Defined(pParameters, pParameter->asShapes());
 	}
 
 	if( !SG_STR_CMP(pParameter->Get_Identifier(), "GRID") && pParameter->asGrid() )
 	{
-		m_Grid_Target.Set_User_Defined(pParameters, pParameter->asGrid()->Get_Extent());
+		m_Grid_Target.Set_User_Defined(pParameters, pParameter->asGrid()->Get_Extent(), pParameter->asGrid()->Get_NY(), false, 0);
 	}
 
 	return( m_Grid_Target.On_Parameter_Changed(pParameters, pParameter) ? 1 : 0 );
@@ -165,7 +165,7 @@ bool CGridding_Spline_Base::_Get_Grid(void)
 	{
 		CSG_Grid	*pPoints	= Parameters("GRID")->asGrid();
 
-		m_Grid_Target.Set_User_Defined(Get_Parameters("TARGET"), pPoints->Get_Extent());	Dlg_Parameters("TARGET");	// if called from saga_cmd
+		m_Grid_Target.Cmd_Update(pPoints->Get_Extent());	// if called from saga_cmd
 
 		if( (m_pGrid = m_Grid_Target.Get_Grid()) == NULL )
 		{
@@ -180,7 +180,7 @@ bool CGridding_Spline_Base::_Get_Grid(void)
 	{
 		CSG_Shapes	*pPoints	= Parameters("SHAPES")->asShapes();
 
-		m_Grid_Target.Set_User_Defined(Get_Parameters("TARGET"), pPoints->Get_Extent());	Dlg_Parameters("TARGET");	// if called from saga_cmd
+		m_Grid_Target.Cmd_Update(pPoints);					// if called from saga_cmd
 
 		if( (m_pGrid = m_Grid_Target.Get_Grid()) == NULL )
 		{
diff --git a/src/modules/grid/grid_spline/Gridding_Spline_CSA.cpp b/src/modules/grid/grid_spline/Gridding_Spline_CSA.cpp
index b04d87d..5aef93f 100644
--- a/src/modules/grid/grid_spline/Gridding_Spline_CSA.cpp
+++ b/src/modules/grid/grid_spline/Gridding_Spline_CSA.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Gridding_Spline_CSA.cpp 2064 2014-03-21 13:20:57Z oconrad $
+ * Version $Id: Gridding_Spline_CSA.cpp 2376 2015-01-28 19:20:52Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -169,20 +169,6 @@ CGridding_Spline_CSA::CGridding_Spline_CSA(void)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CGridding_Spline_CSA::On_Initialise(void)
-{
-
-	return( true );
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
 bool CGridding_Spline_CSA::On_Execute(void)
 {
 	//-----------------------------------------------------
@@ -197,10 +183,10 @@ bool CGridding_Spline_CSA::On_Execute(void)
 
 	csa			*pCSA	= csa_create();
 
-	csa_setnpmin(pCSA, Parameters("NPMIN")	->asInt());
-	csa_setnpmax(pCSA, Parameters("NPMAX")	->asInt());
-	csa_setk	(pCSA, Parameters("K")		->asInt());
-	csa_setnppc	(pCSA, Parameters("NPPC")	->asDouble());
+	csa_setnpmin(pCSA, Parameters("NPMIN")->asInt   ());
+	csa_setnpmax(pCSA, Parameters("NPMAX")->asInt   ());
+	csa_setk	(pCSA, Parameters("K"    )->asInt   ());
+	csa_setnppc	(pCSA, Parameters("NPPC" )->asDouble());
 
 	//-----------------------------------------------------
 	point	*pSrc	= (point *)SG_Malloc(m_Points.Get_Count() * sizeof(point));
diff --git a/src/modules/grid/grid_spline/Gridding_Spline_CSA.h b/src/modules/grid/grid_spline/Gridding_Spline_CSA.h
index 067fcdc..ca453d2 100644
--- a/src/modules/grid/grid_spline/Gridding_Spline_CSA.h
+++ b/src/modules/grid/grid_spline/Gridding_Spline_CSA.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Gridding_Spline_CSA.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: Gridding_Spline_CSA.h 2376 2015-01-28 19:20:52Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -85,8 +85,6 @@ protected:
 
 	virtual bool			On_Execute		(void);
 
-	virtual bool			On_Initialise	(void);
-
 
 private:
 
diff --git a/src/modules/grid/grid_spline/Gridding_Spline_TPS_Local.cpp b/src/modules/grid/grid_spline/Gridding_Spline_TPS_Local.cpp
index e768a4d..ee97874 100644
--- a/src/modules/grid/grid_spline/Gridding_Spline_TPS_Local.cpp
+++ b/src/modules/grid/grid_spline/Gridding_Spline_TPS_Local.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Gridding_Spline_TPS_Local.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: Gridding_Spline_TPS_Local.cpp 2388 2015-02-01 22:28:39Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -72,14 +72,11 @@
 
 //---------------------------------------------------------
 CGridding_Spline_TPS_Local::CGridding_Spline_TPS_Local(void)
-	: CGridding_Spline_TPS_Global()
 {
-	CSG_Parameter	*pNode;
-
 	//-----------------------------------------------------
-	Set_Name		(_TL("Thin Plate Spline (Local)"));
+	Set_Name		(_TL("Thin Plate Spline"));
 
-	Set_Author		(SG_T("O.Conrad (c) 2006"));
+	Set_Author		("O.Conrad (c) 2006");
 
 	Set_Description	(_TW(
 		"Creates a 'Thin Plate Spline' function for each grid point "
@@ -103,118 +100,90 @@ CGridding_Spline_TPS_Local::CGridding_Spline_TPS_Local(void)
 	));
 
 	//-----------------------------------------------------
-	CSG_Parameter	*pSearch	= Parameters.Add_Node(
-		NULL	, "NODE_SEARCH"			, _TL("Search Options"),
-		_TL("")
-	);
-
-	pNode	= Parameters.Add_Choice(
-		pSearch	, "SEARCH_RANGE"		, _TL("Search Range"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("local"),
-			_TL("global")
-		)
-	);
-
 	Parameters.Add_Value(
-		pNode	, "SEARCH_RADIUS"		, _TL("Maximum Search Distance"),
-		_TL("local maximum search distance given in map units"),
-		PARAMETER_TYPE_Double	, 1000.0, 0, true
-	);
-
-	pNode	= Parameters.Add_Choice(
-		pSearch	, "SEARCH_POINTS_ALL"	, _TL("Number of Points"),
+		NULL, "REGULARISATION"	, _TL("Regularisation"),
 		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("maximum number of nearest points"),
-			_TL("all points within search distance")
-		)
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_POINTS_MAX"	, _TL("Maximum Number of Points"),
-		_TL("maximum number of nearest points"),
-		PARAMETER_TYPE_Int, 20, 1, true
+		PARAMETER_TYPE_Double, 0.0001, 0.0, true
 	);
 
-	Parameters.Add_Choice(
-		pNode	, "SEARCH_DIRECTION"	, _TL("Search Direction"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("all directions"),
-			_TL("quadrants")
-		)
-	);
+	//-----------------------------------------------------
+	m_Search.Create(&Parameters, Parameters.Add_Node(NULL, "NODE_SEARCH", _TL("Search Options"), _TL("")), 16);
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-int CGridding_Spline_TPS_Local::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+int CGridding_Spline_TPS_Local::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("SEARCH_RANGE")) )
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "SHAPES") )
 	{
-		pParameters->Get_Parameter("SEARCH_RADIUS"    )->Set_Enabled(pParameter->asInt() == 0);	// local
+		m_Search.On_Parameter_Changed(pParameters, pParameter);
 	}
 
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("SEARCH_POINTS_ALL")) )
-	{
-		pParameters->Get_Parameter("SEARCH_POINTS_MAX")->Set_Enabled(pParameter->asInt() == 0);	// maximum number of points
-		pParameters->Get_Parameter("SEARCH_DIRECTION" )->Set_Enabled(pParameter->asInt() == 0);	// maximum number of points per quadrant
-	}
+	return( CGridding_Spline_Base::On_Parameter_Changed(pParameters, pParameter) );
+}
 
-	return( 1 );
+//---------------------------------------------------------
+int CGridding_Spline_TPS_Local::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+{
+	m_Search.On_Parameters_Enable(pParameters, pParameter);
+
+	return( CGridding_Spline_Base::On_Parameters_Enable(pParameters, pParameter) );
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 bool CGridding_Spline_TPS_Local::On_Execute(void)
 {
-	m_nPoints_Max	= Parameters("SEARCH_POINTS_ALL")->asInt() == 0 ? Parameters("SEARCH_POINTS_MAX")->asInt   () : 0;
-	m_Radius		= Parameters("SEARCH_RANGE"     )->asInt() == 0 ? Parameters("SEARCH_RADIUS"    )->asDouble() : 0.0;
-	m_Direction		= Parameters("SEARCH_DIRECTION" )->asInt();
+	int			x, y;
+	TSG_Point	p;
 
-	//-----------------------------------------------------
-	if( m_nPoints_Max <= 0 && m_Radius <= 0.0 )	// global
-	{
-		return( CGridding_Spline_TPS_Global::On_Execute() );
-	}
+	m_Regularisation	= Parameters("REGULARISATION")->asDouble();
 
-	if( !Initialise() )
+	//-----------------------------------------------------
+	if( m_Search.Do_Use_All(true) )	// global
 	{
-		return( false );
-	}
+		if( !Initialise(m_Spline.Get_Points()) || !m_Spline.Create(m_Regularisation, false) )
+		{
+			return(false);
+		}
 
-	if( !m_Search.Create(m_pShapes, m_zField) )
-	{
-		return( false );
+		for(y=0, p.y=m_pGrid->Get_YMin(); y<m_pGrid->Get_NY() && Set_Progress(y, m_pGrid->Get_NY()); y++, p.y+=m_pGrid->Get_Cellsize())
+		{
+			for(x=0, p.x=m_pGrid->Get_XMin(); x<m_pGrid->Get_NX(); x++, p.x+=m_pGrid->Get_Cellsize())
+			{
+				m_pGrid->Set_Value(x, y, m_Spline.Get_Value(p.x, p.y));
+			}
+		}
 	}
 
 	//-----------------------------------------------------
-	int			x, y;
-	TSG_Point	p;
-
-	for(y=0, p.y=m_pGrid->Get_YMin(); y<m_pGrid->Get_NY() && Set_Progress(y, m_pGrid->Get_NY()); y++, p.y+=m_pGrid->Get_Cellsize())
+	else
 	{
-		for(x=0, p.x=m_pGrid->Get_XMin(); x<m_pGrid->Get_NX(); x++, p.x+=m_pGrid->Get_Cellsize())
+		if( !Initialise() || !m_Search.Initialize(Parameters("SHAPES")->asShapes(), Parameters("FIELD")->asInt()) )
+		{
+			return(false);
+		}
+
+		for(y=0, p.y=m_pGrid->Get_YMin(); y<m_pGrid->Get_NY() && Set_Progress(y, m_pGrid->Get_NY()); y++, p.y+=m_pGrid->Get_Cellsize())
 		{
-			Set_Value(x, y, p);
+			for(x=0, p.x=m_pGrid->Get_XMin(); x<m_pGrid->Get_NX(); x++, p.x+=m_pGrid->Get_Cellsize())
+			{
+				Set_Value(x, y, p);
+			}
 		}
+
+		m_Search.Finalize();
 	}
 
-	m_Search.Destroy();
+	//-----------------------------------------------------
 	m_Spline.Destroy();
 
 	return( true );
@@ -223,58 +192,35 @@ bool CGridding_Spline_TPS_Local::On_Execute(void)
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-int CGridding_Spline_TPS_Local::Get_Points(const TSG_Point &p, int iQuadrant)
+bool CGridding_Spline_TPS_Local::Set_Value(int x, int y, const TSG_Point &p)
 {
-	double	x, y, z;
-
-	if( m_Search.Select_Nearest_Points(p.x, p.y, m_nPoints_Max, m_Radius, iQuadrant) > 0 )
+	if( m_Search.Set_Location(p) && m_Search.Get_Count() >= 3 )
 	{
-		for(int i=0; i<m_Search.Get_Selected_Count(); i++)
+		m_Spline.Destroy();
+
+		for(int i=0; i<m_Search.Get_Count(); i++)
 		{
-			if( m_Search.Get_Selected_Point(i, x, y, z) )
+			double	ix, iy, iz;
+
+			if( m_Search.Get_Point(i, ix, iy, iz) )
 			{
-				m_Spline.Add_Point(x, y, z);
+				m_Spline.Add_Point(ix, iy, iz);
 			}
 		}
-	}
-
-	return( m_Search.Get_Selected_Count() );
-}
-
-//---------------------------------------------------------
-bool CGridding_Spline_TPS_Local::Set_Value(int x, int y, const TSG_Point &p)
-{
-	int		nPoints	= 0;
 
-	m_Spline.Destroy();
+		//-------------------------------------------------
+		if( m_Spline.Create(m_Regularisation, true) )
+		{
+			m_pGrid->Set_Value(x, y, m_Spline.Get_Value(p.x, p.y));
 
-	switch( m_Direction )
-	{
-	default:
-		nPoints	+= Get_Points(p);
-		break;
-
-	case 1:
-		nPoints	+= Get_Points(p, 0);
-		nPoints	+= Get_Points(p, 1);
-		nPoints	+= Get_Points(p, 2);
-		nPoints	+= Get_Points(p, 3);
-		break;
+			return( true );
+		}
 	}
 
 	//-----------------------------------------------------
-	if( nPoints >= 3 && m_Spline.Create(m_Regularisation, true) )
-	{
-		m_pGrid->Set_Value(x, y, m_Spline.Get_Value(p.x, p.y));
-
-		return( true );
-	}
-
 	m_pGrid->Set_NoData(x, y);
 
 	return( false );
diff --git a/src/modules/grid/grid_spline/Gridding_Spline_TPS_Local.h b/src/modules/grid/grid_spline/Gridding_Spline_TPS_Local.h
index eadddaa..976b593 100644
--- a/src/modules/grid/grid_spline/Gridding_Spline_TPS_Local.h
+++ b/src/modules/grid/grid_spline/Gridding_Spline_TPS_Local.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Gridding_Spline_TPS_Local.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: Gridding_Spline_TPS_Local.h 2388 2015-02-01 22:28:39Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -72,7 +72,7 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#include "Gridding_Spline_TPS_Global.h"
+#include "Gridding_Spline_Base.h"
 
 
 ///////////////////////////////////////////////////////////
@@ -82,7 +82,7 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-class grid_spline_EXPORT CGridding_Spline_TPS_Local : public CGridding_Spline_TPS_Global
+class grid_spline_EXPORT CGridding_Spline_TPS_Local : public CGridding_Spline_Base
 {
 public:
 	CGridding_Spline_TPS_Local(void);
@@ -90,23 +90,22 @@ public:
 
 protected:
 
-	virtual int				On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+	virtual int						On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+	virtual int						On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
 
-	virtual bool			On_Execute				(void);
+	virtual bool					On_Execute				(void);
 
 
 private:
 
-	int						m_nPoints_Max, m_Direction;
+	double							m_Regularisation;
 
-	double					m_Radius;
+	CSG_Thin_Plate_Spline			m_Spline;
 
-	CSG_PRQuadTree			m_Search;
+	CSG_Parameters_Search_Points	m_Search;
 
 
-	int						Get_Points				(const TSG_Point &p, int iQuadrant = -1);
-
-	bool					Set_Value				(int x, int y, const TSG_Point &p);
+	bool							Set_Value				(int x, int y, const TSG_Point &p);
 
 };
 
diff --git a/src/modules/grid/grid_spline/Gridding_Spline_TPS_TIN.cpp b/src/modules/grid/grid_spline/Gridding_Spline_TPS_TIN.cpp
index 5ff2384..68ee808 100644
--- a/src/modules/grid/grid_spline/Gridding_Spline_TPS_TIN.cpp
+++ b/src/modules/grid/grid_spline/Gridding_Spline_TPS_TIN.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Gridding_Spline_TPS_TIN.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: Gridding_Spline_TPS_TIN.cpp 2388 2015-02-01 22:28:39Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -72,11 +72,10 @@
 
 //---------------------------------------------------------
 CGridding_Spline_TPS_TIN::CGridding_Spline_TPS_TIN(void)
-	: CGridding_Spline_TPS_Global()
 {
 	Set_Name		(_TL("Thin Plate Spline (TIN)"));
 
-	Set_Author		(SG_T("(c) 2006 by O.Conrad"));
+	Set_Author		("O.Conrad (c) 2006");
 
 	Set_Description	(_TW(
 		"Creates a 'Thin Plate Spline' function for each triangle of a TIN "
@@ -105,6 +104,13 @@ CGridding_Spline_TPS_TIN::CGridding_Spline_TPS_TIN(void)
 	));
 
 	//-----------------------------------------------------
+	Parameters.Add_Value(
+		NULL, "REGULARISATION"	, _TL("Regularisation"),
+		_TL(""),
+		PARAMETER_TYPE_Double, 0.0001, 0.0, true
+	);
+
+	//-----------------------------------------------------
 	Parameters.Add_Choice(
 		NULL	, "LEVEL"		, _TL("Neighbourhood"),
 		_TL(""),
@@ -123,10 +129,6 @@ CGridding_Spline_TPS_TIN::CGridding_Spline_TPS_TIN(void)
 	);
 }
 
-//---------------------------------------------------------
-CGridding_Spline_TPS_TIN::~CGridding_Spline_TPS_TIN(void)
-{}
-
 
 ///////////////////////////////////////////////////////////
 //														 //
@@ -137,12 +139,13 @@ CGridding_Spline_TPS_TIN::~CGridding_Spline_TPS_TIN(void)
 //---------------------------------------------------------
 bool CGridding_Spline_TPS_TIN::_Initialise(void)
 {
-	m_Level			= Parameters("LEVEL")	->asInt();
+	m_Regularisation	= Parameters("REGULARISATION")->asDouble();
+	m_Level				= Parameters("LEVEL")->asInt();
 
-	m_Points		= NULL;
-	m_nPoints_Buf	= 0;
+	m_Points			= NULL;
+	m_nPoints_Buf		= 0;
 
-	return( CGridding_Spline_TPS_Global::On_Initialise() );
+	return( CGridding_Spline_Base::On_Initialise() );
 }
 
 //---------------------------------------------------------
@@ -156,8 +159,6 @@ bool CGridding_Spline_TPS_TIN::_Finalise(void)
 	m_Points		= NULL;
 	m_nPoints_Buf	= 0;
 
-	m_Spline.Destroy();
-
 	return( true );
 }
 
@@ -199,37 +200,38 @@ bool CGridding_Spline_TPS_TIN::On_Execute(void)
 //---------------------------------------------------------
 void CGridding_Spline_TPS_TIN::_Set_Triangle(CSG_TIN_Triangle *pTriangle)
 {
-	int			i, j;
-	CSG_TIN_Node	*pPoint;
-
 	if( m_pGrid->Get_Extent().Intersects(pTriangle->Get_Extent()) != INTERSECTION_None )
 	{
+		int		i, j;
+
 		for(j=0, m_nPoints=0; j<3; j++)
 		{
-			for(i=0, pPoint=pTriangle->Get_Node(j); i<pPoint->Get_Neighbor_Count(); i++)
+			CSG_TIN_Node	*pPoint = pTriangle->Get_Node(j);
+
+			for(i=0; i<pPoint->Get_Neighbor_Count(); i++)
 			{
 				_Add_Points(pPoint->Get_Neighbor(i), 0);
 			}
 		}
 
-		m_Spline.Destroy();
+		CSG_Thin_Plate_Spline	Spline;
 
 		for(i=0; i<m_nPoints; i++)
 		{
-			pPoint	= m_Points[i];
+			CSG_TIN_Node	*pPoint = m_Points[i];
 
-			m_Spline.Add_Point(pPoint->Get_Point().x, pPoint->Get_Point().y, pPoint->asDouble(m_zField));
+			Spline.Add_Point(pPoint->Get_Point().x, pPoint->Get_Point().y, pPoint->asDouble(0));
 		}
 
-		if( m_Spline.Create(m_Regularisation, true) )
+		if( Spline.Create(m_Regularisation, true) )
 		{
-			_Set_Grid(pTriangle);
+			_Set_Grid(pTriangle, Spline);
 		}
 	}
 }
 
 //---------------------------------------------------------
-void CGridding_Spline_TPS_TIN::_Set_Grid(CSG_TIN_Triangle *pTriangle)
+void CGridding_Spline_TPS_TIN::_Set_Grid(CSG_TIN_Triangle *pTriangle, CSG_Thin_Plate_Spline &Spline)
 {
 	int		ix, iy, ax, ay, bx, by;
 	double	x, y, xMin, yMin;
@@ -247,7 +249,7 @@ void CGridding_Spline_TPS_TIN::_Set_Grid(CSG_TIN_Triangle *pTriangle)
 		{
 			if( pTriangle->is_Containing(x, y) )
 			{
-				m_pGrid->Set_Value(ix, iy, m_Spline.Get_Value(x, y));
+				m_pGrid->Set_Value(ix, iy, Spline.Get_Value(x, y));
 			}
 		}
 	}
@@ -263,16 +265,15 @@ void CGridding_Spline_TPS_TIN::_Set_Grid(CSG_TIN_Triangle *pTriangle)
 //---------------------------------------------------------
 void CGridding_Spline_TPS_TIN::_Add_Points(CSG_TIN_Node *pPoint, int Level)
 {
-	int			i, j;
-	CSG_TIN_Node	*p;
-
 	_Add_Point(pPoint);
 
 	if( Level < m_Level )
 	{
-		for(j=0; j<pPoint->Get_Neighbor_Count(); j++)
+		for(int j=0; j<pPoint->Get_Neighbor_Count(); j++)
 		{
-			for(i=0, p=pPoint->Get_Neighbor(j); i<p->Get_Neighbor_Count(); i++)
+			CSG_TIN_Node	*p	= pPoint->Get_Neighbor(j);
+
+			for(int i=0; i<p->Get_Neighbor_Count(); i++)
 			{
 				_Add_Points(p->Get_Neighbor(i), Level + 1);
 			}
@@ -314,67 +315,63 @@ bool CGridding_Spline_TPS_TIN::_Get_TIN(CSG_TIN &TIN)
 {
 	TIN.Destroy();
 
-	if( Parameters("FRAME")->asBool() )
-	{
-		int			iShape, iPart, iPoint, iCorner, iField, z[4];
-		double		x[4], y[4], dMin[4], d;
-		TSG_Point	p;
-		CSG_Shape		*pShape;
+	bool		bFrame		= Parameters("FRAME" )->asBool  ();
+	int			zField		= Parameters("FIELD" )->asInt   ();
+	CSG_Shapes	*pShapes	= Parameters("SHAPES")->asShapes();
 
-		for(iField=0; iField<m_pShapes->Get_Field_Count(); iField++)
-		{
-			TIN.Add_Field(m_pShapes->Get_Field_Name(iField), m_pShapes->Get_Field_Type(iField));
-		}
+	double	x[4], y[4], z[4], dMin[4];
 
-		x[0]	= m_pGrid->Get_Extent().Get_XMin();	y[0]	= m_pGrid->Get_Extent().Get_YMin();	dMin[0]	= -1.0;
-		x[1]	= m_pGrid->Get_Extent().Get_XMin();	y[1]	= m_pGrid->Get_Extent().Get_YMax();	dMin[1]	= -1.0;
-		x[2]	= m_pGrid->Get_Extent().Get_XMax();	y[2]	= m_pGrid->Get_Extent().Get_YMax();	dMin[2]	= -1.0;
-		x[3]	= m_pGrid->Get_Extent().Get_XMax();	y[3]	= m_pGrid->Get_Extent().Get_YMin();	dMin[3]	= -1.0;
+	x[0]	= m_pGrid->Get_Extent().Get_XMin();	y[0]	= m_pGrid->Get_Extent().Get_YMin();	dMin[0]	= -1.0;
+	x[1]	= m_pGrid->Get_Extent().Get_XMin();	y[1]	= m_pGrid->Get_Extent().Get_YMax();	dMin[1]	= -1.0;
+	x[2]	= m_pGrid->Get_Extent().Get_XMax();	y[2]	= m_pGrid->Get_Extent().Get_YMax();	dMin[2]	= -1.0;
+	x[3]	= m_pGrid->Get_Extent().Get_XMax();	y[3]	= m_pGrid->Get_Extent().Get_YMin();	dMin[3]	= -1.0;
 
-		for(iShape=0; iShape<m_pShapes->Get_Count() && Set_Progress(iShape, m_pShapes->Get_Count()); iShape++)
-		{
-			pShape	= m_pShapes->Get_Shape(iShape);
+	TIN.Add_Field("Z", SG_DATATYPE_Double);
 
-			for(iPart=0; iPart<pShape->Get_Part_Count(); iPart++)
+	for (int iShape=0; iShape<pShapes->Get_Count() && Set_Progress(iShape, pShapes->Get_Count()); iShape++)
+	{
+		CSG_Shape	*pShape	= pShapes->Get_Shape(iShape);
+
+		for(int iPart=0; iPart<pShape->Get_Part_Count(); iPart++)
+		{
+			for(int iPoint=0; iPoint<pShape->Get_Point_Count(iPart); iPoint++)
 			{
-				for(iPoint=0; iPoint<pShape->Get_Point_Count(iPart); iPoint++)
-				{
-					p	= pShape->Get_Point(iPoint, iPart);
+				TSG_Point	p = pShape->Get_Point(iPoint, iPart);
 
-					TIN.Add_Node(p, pShape, false);
+				TIN.Add_Node(p, NULL, false)->Set_Value(0, pShape->asDouble(zField));
 
-					for(iCorner=0; iCorner<4; iCorner++)
+				if( bFrame )
+				{
+					for(int iCorner=0; iCorner<4; iCorner++)
 					{
-						d	= SG_Get_Distance(p.x, p.y, x[iCorner], y[iCorner]);
+						double d	= SG_Get_Distance(p.x, p.y, x[iCorner], y[iCorner]);
 
 						if( dMin[iCorner] < 0.0 || d < dMin[iCorner] )
 						{
 							dMin[iCorner]	= d;
-							z   [iCorner]	= iShape;
+							z   [iCorner]	= pShape->asDouble(zField);
 						}
 					}
 				}
 			}
 		}
+	}
 
-		for(iCorner=0; iCorner<4; iCorner++)
+	if( bFrame )
+	{
+		for(int iCorner=0; iCorner<4; iCorner++)
 		{
 			if( dMin[iCorner] >= 0.0 )
 			{
-				p.x	= x[iCorner];
-				p.y	= y[iCorner];
+				CSG_Point	p(x[iCorner], y[iCorner]);
 
-				TIN.Add_Node(p, m_pShapes->Get_Shape(z[iCorner]), false);
+				TIN.Add_Node(p, NULL, false)->Set_Value(0, z[iCorner]);
 			}
 		}
-
-		TIN.Update();
-	}
-	else
-	{
-		TIN.Create(m_pShapes);
 	}
 
+	TIN.Update();
+
 	return( TIN.Get_Triangle_Count() > 0 );
 }
 
diff --git a/src/modules/grid/grid_spline/Gridding_Spline_TPS_TIN.h b/src/modules/grid/grid_spline/Gridding_Spline_TPS_TIN.h
index a9297ab..ea1f528 100644
--- a/src/modules/grid/grid_spline/Gridding_Spline_TPS_TIN.h
+++ b/src/modules/grid/grid_spline/Gridding_Spline_TPS_TIN.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Gridding_Spline_TPS_TIN.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: Gridding_Spline_TPS_TIN.h 2388 2015-02-01 22:28:39Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -72,7 +72,7 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#include "Gridding_Spline_TPS_Global.h"
+#include "Gridding_Spline_Base.h"
 
 
 ///////////////////////////////////////////////////////////
@@ -82,11 +82,10 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-class grid_spline_EXPORT CGridding_Spline_TPS_TIN : public CGridding_Spline_TPS_Global
+class CGridding_Spline_TPS_TIN : public CGridding_Spline_Base
 {
 public:
 	CGridding_Spline_TPS_TIN(void);
-	virtual ~CGridding_Spline_TPS_TIN(void);
 
 
 protected:
@@ -96,6 +95,8 @@ protected:
 
 private:
 
+	double					m_Regularisation;
+
 	int						m_nPoints, m_nPoints_Buf, m_Level;
 
 	CSG_TIN_Node			**m_Points;
@@ -105,7 +106,7 @@ private:
 	bool					_Finalise		(void);
 
 	void					_Set_Triangle	(CSG_TIN_Triangle *pTriangle);
-	void					_Set_Grid		(CSG_TIN_Triangle *pTriangle);
+	void					_Set_Grid		(CSG_TIN_Triangle *pTriangle, CSG_Thin_Plate_Spline &Spline);
 
 	void					_Add_Points		(CSG_TIN_Node *Point, int Level);
 	bool					_Add_Point		(CSG_TIN_Node *Point);
diff --git a/src/modules/grid/grid_gridding/Interpolation.cpp b/src/modules/grid/grid_spline/MBASpline_for_Categories.cpp
similarity index 53%
copy from src/modules/grid/grid_gridding/Interpolation.cpp
copy to src/modules/grid/grid_spline/MBASpline_for_Categories.cpp
index ea9c9b6..65b0d4a 100644
--- a/src/modules/grid/grid_gridding/Interpolation.cpp
+++ b/src/modules/grid/grid_spline/MBASpline_for_Categories.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Interpolation.cpp 2221 2014-09-04 16:02:43Z oconrad $
+ * Version $Id: MBASpline_for_Categories.cpp 1921 2014-01-09 10:24:11Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -9,13 +9,13 @@
 //      System for Automated Geoscientific Analyses      //
 //                                                       //
 //                    Module Library:                    //
-//                     Grid_Gridding                     //
+//                     grid_spline                       //
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//                   Interpolation.cpp                   //
+//               MBASpline_for_Categories.cpp            //
 //                                                       //
-//                 Copyright (C) 2003 by                 //
+//                 Copyright (C) 2015 by                 //
 //                      Olaf Conrad                      //
 //                                                       //
 //-------------------------------------------------------//
@@ -44,9 +44,7 @@
 //                                                       //
 //    contact:    Olaf Conrad                            //
 //                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
+//                University of Hamburg                  //
 //                Germany                                //
 //                                                       //
 ///////////////////////////////////////////////////////////
@@ -61,7 +59,7 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#include "Interpolation.h"
+#include "MBASpline_for_Categories.h"
 
 
 ///////////////////////////////////////////////////////////
@@ -71,42 +69,53 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-CInterpolation::CInterpolation(void)
+CMBASpline_for_Categories::CMBASpline_for_Categories(void)
 {
+	Set_Name		(_TL("Multilevel B-Spline Interpolation for Categories"));
+
+	Set_Author		("O.Conrad (c) 2015");
+
+	Set_Description	(_TW(
+		""
+	));
+
+	//-----------------------------------------------------
 	CSG_Parameter	*pNode	= Parameters.Add_Shapes(
-		NULL	, "SHAPES"		, _TL("Points"),
+		NULL	, "POINTS"	, _TL("Points"),
 		_TL(""),
-		PARAMETER_INPUT, SHAPE_TYPE_Point
+		PARAMETER_INPUT
 	);
 
 	Parameters.Add_Table_Field(
-		pNode	, "FIELD"		, _TL("Attribute"),
+		pNode	, "FIELD"	, _TL("Attribute"),
 		_TL("")
 	);
 
-	m_Grid_Target.Create(SG_UI_Get_Window_Main() ? &Parameters : Add_Parameters("TARGET", _TL("Target System"), _TL("")));
+	//-----------------------------------------------------
+	m_Grid_Target.Create(SG_UI_Get_Window_Main() ? &Parameters : Add_Parameters("TARGET", _TL("Target System"), _TL("")), false);
+
+	m_Grid_Target.Add_Grid("CATEGORIES" , _TL("Categories" ), false);
+	m_Grid_Target.Add_Grid("PROPABILITY", _TL("Propability"), false);
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-int CInterpolation::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+int CMBASpline_for_Categories::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	if( !SG_STR_CMP(pParameter->Get_Identifier(), "SHAPES") && pParameter->asShapes() )
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "POINTS") )
 	{
-		m_Grid_Target.Set_User_Defined(pParameters, pParameter->asShapes()->Get_Extent());
+		m_Grid_Target.Set_User_Defined(pParameters, pParameter->asShapes());
 	}
 
 	return( m_Grid_Target.On_Parameter_Changed(pParameters, pParameter) ? 1 : 0 );
 }
 
 //---------------------------------------------------------
-int CInterpolation::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+int CMBASpline_for_Categories::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
 	return( m_Grid_Target.On_Parameters_Enable(pParameters, pParameter) ? 1 : 0 );
 }
@@ -114,128 +123,107 @@ int CInterpolation::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parame
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CInterpolation::On_Execute(void)
+bool CMBASpline_for_Categories::On_Execute(void)
 {
-	//-----------------------------------------------------
-	m_pShapes	= Parameters("SHAPES")->asShapes();
-	m_zField	= Parameters("FIELD" )->asInt();
+	CSG_Shapes	Points;
 
 	//-----------------------------------------------------
-	bool	bResult	= false;
+	SG_RUN_MODULE_ExitOnError("table_tools", 20,	// Add Indicator Fields for Categories
+			SG_MODULE_PARAMETER_SET("TABLE"     , Parameters("POINTS")->asShapes())
+		&&	SG_MODULE_PARAMETER_SET("FIELD"     , Parameters("FIELD"))
+		&&	SG_MODULE_PARAMETER_SET("OUT_SHAPES", &Points)	// >> Indicators
+	)
 
-	m_Grid_Target.Set_User_Defined(Get_Parameters("TARGET"), m_pShapes->Get_Extent());	Dlg_Parameters("TARGET");	// if called from saga_cmd
+	int	nCategories	= Points.Get_Field_Count() - 1;
 
-	if( (m_pGrid = m_Grid_Target.Get_Grid()) != NULL )
+	if( nCategories < 2 )
 	{
-		m_pGrid->Set_Name(CSG_String::Format(SG_T("%s [%s]"), Parameters("FIELD")->asString(), Get_Name().c_str()));
+		Error_Set(_TL("found less than two categories, nothing to do"));
 
-		bResult	= Interpolate();
+		return( false );
 	}
 
 	//-----------------------------------------------------
-	m_Search.Destroy();
+	CSG_Grid	*pGrid, *pProp, Prop;
 
-	if( m_pShapes != Parameters("SHAPES")->asShapes() )
+	m_Grid_Target.Cmd_Update(&Points);	// if called from saga_cmd
+
+	if( !(pGrid = m_Grid_Target.Get_Grid("CATEGORIES", nCategories < 128 ? SG_DATATYPE_Char : SG_DATATYPE_Int))
+	||  !(pProp = m_Grid_Target.Get_Grid("PROPABILITY")) )
 	{
-		delete(m_pShapes);
+		return( false );
 	}
 
-	return( bResult );
-}
+	//-----------------------------------------------------
+	CSG_Parameter	*pLUT	= DataObject_Get_Parameter(pGrid, "LUT");
 
+	if( pLUT && pLUT->asTable() )
+	{
+		CSG_Colors	Colors(nCategories);	Colors.Random();
 
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
+		CSG_Table	*pClasses	= pLUT->asTable();
 
-//---------------------------------------------------------
-bool CInterpolation::Interpolate(void)
-{
-	if( On_Initialize() )
-	{
-		int		ix, iy;
-		double	x, y, z;
+		pClasses->Set_Record_Count(nCategories);
 
-		for(iy=0, y=m_pGrid->Get_YMin(); iy<m_pGrid->Get_NY() && Set_Progress(iy, m_pGrid->Get_NY()); iy++, y+=m_pGrid->Get_Cellsize())
+		for(int iClass=0; iClass<nCategories; iClass++)
 		{
-			for(ix=0, x=m_pGrid->Get_XMin(); ix<m_pGrid->Get_NX(); ix++, x+=m_pGrid->Get_Cellsize())
-			{
-				if( Get_Value(x, y, z) )
-				{
-					m_pGrid->Set_Value(ix, iy, z);
-				}
-				else
-				{
-					m_pGrid->Set_NoData(ix, iy);
-				}
-			}
-		}
+			CSG_Table_Record	*pClass	= pClasses->Get_Record(iClass);
 
-		On_Finalize();
+			pClass->Set_Value(0, Colors[iClass]);
+			pClass->Set_Value(1, Points.Get_Field_Name(1 + iClass));
+			pClass->Set_Value(2, "");
+			pClass->Set_Value(3, iClass);
+			pClass->Set_Value(4, iClass);
+		}
 
-		return( true );
+		DataObject_Set_Parameter(pGrid, pLUT);	// Lookup Table
+		DataObject_Set_Parameter(pGrid, "COLORS_TYPE", 1);	// Color Classification Type: Lookup Table
 	}
 
-	return( false );
-}
+	//-----------------------------------------------------
+	pGrid->Set_Name(CSG_String::Format("%s"     , Points.Get_Field_Name(0)));
+	pProp->Set_Name(CSG_String::Format("%s [%s]", Points.Get_Field_Name(0), _TL("Propability")));
 
+	pProp->Assign(0.0);
+	pProp->Set_NoData_Value(0.0);
 
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-CSG_Shapes * CInterpolation::Get_Points(bool bOnlyNonPoints)
-{
-	m_pShapes	= Parameters("SHAPES")	->asShapes();
+	Prop.Create(pGrid->Get_System());
 
-	if( !bOnlyNonPoints || m_pShapes->Get_Type() != SHAPE_TYPE_Point )
+	//-----------------------------------------------------
+	for(int i=0; i<nCategories; i++)
 	{
-		CSG_Shapes	*pPoints	= SG_Create_Shapes(SHAPE_TYPE_Point);
+		Process_Set_Text(CSG_String::Format("%s: %s", _TL("processing"), Points.Get_Field_Name(1 + i)));
 
-		pPoints->Set_NoData_Value_Range(m_pShapes->Get_NoData_Value(), m_pShapes->Get_NoData_hiValue());
-		pPoints->Add_Field(SG_T("Z"), SG_DATATYPE_Double);
+		SG_UI_Progress_Lock(true);
 
-		for(int iShape=0; iShape<m_pShapes->Get_Count() && Set_Progress(iShape, m_pShapes->Get_Count()); iShape++)
-		{
-			CSG_Shape	*pShape	= m_pShapes->Get_Shape(iShape);
+		SG_RUN_MODULE_ExitOnError("grid_spline", 4,	// Multilevel B-Spline Interpolation
+				SG_MODULE_PARAMETER_SET("SHAPES"    , &Points)
+			&&	SG_MODULE_PARAMETER_SET("FIELD"     , 1 + i)	// indicator field
+			&&	SG_MODULE_PARAMETER_SET("DEFINITION", 1)		// grid or grid system
+			&&	SG_MODULE_PARAMETER_SET("OUT_GRID"  , &Prop)	// target grid
+		)
+
+		SG_UI_Progress_Lock(false);
 
-			if( !pShape->is_NoData(m_zField) )
+		#pragma omp parallel for
+		for(int y=0; y<pGrid->Get_NY(); y++)
+		{
+			for(int x=0; x<pGrid->Get_NX(); x++)
 			{
-				for(int iPart=0; iPart<pShape->Get_Part_Count(); iPart++)
+				if( pProp->asDouble(x, y) < Prop.asDouble(x, y) )
 				{
-					for(int iPoint=0; iPoint<pShape->Get_Point_Count(iPart); iPoint++)
-					{
-						CSG_Shape	*pPoint	= pPoints->Add_Shape();
-
-						pPoint->Add_Point(pShape->Get_Point(iPoint, iPart));
-
-						pPoint->Set_Value(0, pShape->asDouble(m_zField));
-					}
+					pProp->Set_Value(x, y, Prop.asDouble(x, y));
+					pGrid->Set_Value(x, y, i);
 				}
 			}
 		}
-
-		m_zField	= 0;
-		m_pShapes	= pPoints;
 	}
 
-	return( m_pShapes );
-}
-
-//---------------------------------------------------------
-bool CInterpolation::Set_Search_Engine(void)
-{
-	return( m_Search.Create(m_pShapes, m_zField) );
+	//-----------------------------------------------------
+	return( true );
 }
 
 
diff --git a/src/modules/grid/grid_spline/Gridding_Spline_TPS_Global.h b/src/modules/grid/grid_spline/MBASpline_for_Categories.h
similarity index 80%
rename from src/modules/grid/grid_spline/Gridding_Spline_TPS_Global.h
rename to src/modules/grid/grid_spline/MBASpline_for_Categories.h
index 31f2a61..8b57529 100644
--- a/src/modules/grid/grid_spline/Gridding_Spline_TPS_Global.h
+++ b/src/modules/grid/grid_spline/MBASpline_for_Categories.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Gridding_Spline_TPS_Global.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: MBASpline_for_Categories.h 1921 2014-01-09 10:24:11Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -13,9 +13,9 @@
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//              Gridding_Spline_TPS_Global.h             //
+//                MBASpline_for_Categories.h             //
 //                                                       //
-//                 Copyright (C) 2006 by                 //
+//                 Copyright (C) 2015 by                 //
 //                      Olaf Conrad                      //
 //                                                       //
 //-------------------------------------------------------//
@@ -44,9 +44,7 @@
 //                                                       //
 //    contact:    Olaf Conrad                            //
 //                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
+//                University of Hamburg                  //
 //                Germany                                //
 //                                                       //
 ///////////////////////////////////////////////////////////
@@ -61,8 +59,8 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#ifndef HEADER_INCLUDED__Gridding_Spline_TPS_Global_H
-#define HEADER_INCLUDED__Gridding_Spline_TPS_Global_H
+#ifndef HEADER_INCLUDED__MBASpline_for_Categories_H
+#define HEADER_INCLUDED__MBASpline_for_Categories_H
 
 
 ///////////////////////////////////////////////////////////
@@ -72,7 +70,7 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#include "Gridding_Spline_Base.h"
+#include "MLB_Interface.h"
 
 
 ///////////////////////////////////////////////////////////
@@ -82,29 +80,26 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-class grid_spline_EXPORT CGridding_Spline_TPS_Global : public CGridding_Spline_Base
+class CMBASpline_for_Categories : public CSG_Module
 {
 public:
-	CGridding_Spline_TPS_Global(void);
+	CMBASpline_for_Categories(void);
 
+	virtual CSG_String			Get_MenuPath			(void)	{	return( _TL("R:Spline Interpolation") );	}
 
-protected:
-
-	virtual bool			On_Execute		(void);
-
-	virtual bool			On_Initialise	(void);
 
+protected:
 
-	int						m_zField;
+	virtual int					On_Parameter_Changed	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
 
-	double					m_Regularisation;
+	virtual bool				On_Execute				(void);
 
-	CSG_Shapes				*m_pShapes;
 
-	CSG_Thin_Plate_Spline	m_Spline;
+private:
 
+	CSG_Parameters_Grid_Target	m_Grid_Target;
 
-private:
 
 };
 
@@ -116,4 +111,4 @@ private:
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED__Gridding_Spline_TPS_Global_H
+#endif // #ifndef HEADER_INCLUDED__MBASpline_for_Categories_H
diff --git a/src/modules/grid/grid_spline/MLB_Interface.cpp b/src/modules/grid/grid_spline/MLB_Interface.cpp
index d51d8cc..0d26c82 100644
--- a/src/modules/grid/grid_spline/MLB_Interface.cpp
+++ b/src/modules/grid/grid_spline/MLB_Interface.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: MLB_Interface.cpp 2281 2014-10-09 15:49:41Z oconrad $
+ * Version $Id: MLB_Interface.cpp 2388 2015-02-01 22:28:39Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -100,7 +100,6 @@ CSG_String Get_Info(int i)
 //---------------------------------------------------------
 // 3. Include the headers of your modules here...
 
-#include "Gridding_Spline_TPS_Global.h"
 #include "Gridding_Spline_TPS_Local.h"
 #include "Gridding_Spline_TPS_TIN.h"
 #include "Gridding_Spline_BA.h"
@@ -108,6 +107,8 @@ CSG_String Get_Info(int i)
 #include "Gridding_Spline_MBA_Grid.h"
 #include "Gridding_Spline_CSA.h"
 
+#include "MBASpline_for_Categories.h"
+
 
 //---------------------------------------------------------
 // 4. Allow your modules to be created here...
@@ -116,16 +117,18 @@ CSG_Module *		Create_Module(int i)
 {
 	switch( i )
 	{
-	case 0:		return( new CGridding_Spline_TPS_Global );
 	case 1:		return( new CGridding_Spline_TPS_Local );
 	case 2:		return( new CGridding_Spline_TPS_TIN );
 	case 3:		return( new CGridding_Spline_BA );
 	case 4:		return( new CGridding_Spline_MBA );
 	case 5:		return( new CGridding_Spline_MBA_Grid );
 	case 6:		return( new CGridding_Spline_CSA );
-	}
 
-	return( NULL );
+	case 7:		return( new CMBASpline_for_Categories );
+
+	case 10:	return( NULL );
+	default:	return( MLB_INTERFACE_SKIP_MODULE );
+	}
 }
 
 
diff --git a/src/modules/grid/grid_spline/Makefile.am b/src/modules/grid/grid_spline/Makefile.am
index 40cf22c..1de9a1e 100644
--- a/src/modules/grid/grid_spline/Makefile.am
+++ b/src/modules/grid/grid_spline/Makefile.am
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.am 1277 2011-12-22 15:48:59Z reklov_w $
+# $Id: Makefile.am 2388 2015-02-01 22:28:39Z oconrad $
 #
 if DEBUG
 DBGFLAGS = -g -DDEBUG
@@ -19,9 +19,9 @@ Gridding_Spline_Base.cpp\
 Gridding_Spline_CSA.cpp\
 Gridding_Spline_MBA.cpp\
 Gridding_Spline_MBA_Grid.cpp\
-Gridding_Spline_TPS_Global.cpp\
 Gridding_Spline_TPS_Local.cpp\
 Gridding_Spline_TPS_TIN.cpp\
+MBASpline_for_Categories.cpp\
 MLB_Interface.cpp\
 csa.h\
 Gridding_Spline_BA.h\
@@ -29,9 +29,9 @@ Gridding_Spline_Base.h\
 Gridding_Spline_MBA.h\
 Gridding_Spline_CSA.h\
 Gridding_Spline_MBA_Grid.h\
-Gridding_Spline_TPS_Global.h\
 Gridding_Spline_TPS_Local.h\
 Gridding_Spline_TPS_TIN.h\
+MBASpline_for_Categories.h\
 MLB_Interface.h
 
 libgrid_spline_la_LIBADD = $(top_srcdir)/src/saga_core/saga_api/libsaga_api.la $(ADD_MLBS)
diff --git a/src/modules/grid/grid_spline/Makefile.in b/src/modules/grid/grid_spline/Makefile.in
index c85b392..1695a7f 100644
--- a/src/modules/grid/grid_spline/Makefile.in
+++ b/src/modules/grid/grid_spline/Makefile.in
@@ -130,8 +130,8 @@ libgrid_spline_la_DEPENDENCIES =  \
 am_libgrid_spline_la_OBJECTS = csa.lo Gridding_Spline_BA.lo \
 	Gridding_Spline_Base.lo Gridding_Spline_CSA.lo \
 	Gridding_Spline_MBA.lo Gridding_Spline_MBA_Grid.lo \
-	Gridding_Spline_TPS_Global.lo Gridding_Spline_TPS_Local.lo \
-	Gridding_Spline_TPS_TIN.lo MLB_Interface.lo
+	Gridding_Spline_TPS_Local.lo Gridding_Spline_TPS_TIN.lo \
+	MBASpline_for_Categories.lo MLB_Interface.lo
 libgrid_spline_la_OBJECTS = $(am_libgrid_spline_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
@@ -365,7 +365,7 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
 #
-# $Id: Makefile.am 1277 2011-12-22 15:48:59Z reklov_w $
+# $Id: Makefile.am 2388 2015-02-01 22:28:39Z oconrad $
 #
 @DEBUG_TRUE at DBGFLAGS = -g -DDEBUG
 @SAGA_UNICODE_TRUE at UC_DEFS = -D_SAGA_UNICODE
@@ -381,9 +381,9 @@ Gridding_Spline_Base.cpp\
 Gridding_Spline_CSA.cpp\
 Gridding_Spline_MBA.cpp\
 Gridding_Spline_MBA_Grid.cpp\
-Gridding_Spline_TPS_Global.cpp\
 Gridding_Spline_TPS_Local.cpp\
 Gridding_Spline_TPS_TIN.cpp\
+MBASpline_for_Categories.cpp\
 MLB_Interface.cpp\
 csa.h\
 Gridding_Spline_BA.h\
@@ -391,9 +391,9 @@ Gridding_Spline_Base.h\
 Gridding_Spline_MBA.h\
 Gridding_Spline_CSA.h\
 Gridding_Spline_MBA_Grid.h\
-Gridding_Spline_TPS_Global.h\
 Gridding_Spline_TPS_Local.h\
 Gridding_Spline_TPS_TIN.h\
+MBASpline_for_Categories.h\
 MLB_Interface.h
 
 libgrid_spline_la_LIBADD = $(top_srcdir)/src/saga_core/saga_api/libsaga_api.la $(ADD_MLBS)
@@ -481,50 +481,56 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Gridding_Spline_CSA.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Gridding_Spline_MBA.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Gridding_Spline_MBA_Grid.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Gridding_Spline_TPS_Global.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Gridding_Spline_TPS_Local.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Gridding_Spline_TPS_TIN.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MBASpline_for_Categories.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MLB_Interface.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/csa.Plo at am__quote@
 
 .c.o:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(COMPILE) -c -o $@ $<
 
 .c.obj:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .c.lo:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LTCOMPILE) -c -o $@ $<
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/grid/grid_tools/Grid_Fill.cpp b/src/modules/grid/grid_tools/Grid_Fill.cpp
index d882a4a..b87a5ba 100644
--- a/src/modules/grid/grid_tools/Grid_Fill.cpp
+++ b/src/modules/grid/grid_tools/Grid_Fill.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Grid_Fill.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: Grid_Fill.cpp 2447 2015-03-19 14:43:42Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -269,7 +269,7 @@ bool CGrid_Fill::On_Execute_Position(CSG_Point ptWorld, TSG_Module_Interactive_M
 			Push(x, y);
 
 			//---------------------------------------------
-			while( m_iStack > 0 && Set_Progress(nReplaced, m_pGrid->Get_NCells()) )
+			while( m_iStack > 0 && Set_Progress_NCells(nReplaced) )
 			{
 				Pop(x, y);
 
diff --git a/src/modules/grid/grid_tools/Grid_Merge.cpp b/src/modules/grid/grid_tools/Grid_Merge.cpp
index 8b0d8ac..58945ae 100644
--- a/src/modules/grid/grid_tools/Grid_Merge.cpp
+++ b/src/modules/grid/grid_tools/Grid_Merge.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Grid_Merge.cpp 2229 2014-09-09 13:48:23Z oconrad $
+ * Version $Id: Grid_Merge.cpp 2447 2015-03-19 14:43:42Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -378,7 +378,7 @@ bool CGrid_Merge::Initialize(void)
 //---------------------------------------------------------
 bool CGrid_Merge::Set_Target(CSG_Parameters *pParameters, CSG_Parameter_Grid_List *pGrids)
 {
-	if( pGrids && pGrids->Get_Count() > 0 )
+	if( pParameters && pGrids && pGrids->Get_Count() > 0 )
 	{
 		double		d	= pGrids->asGrid(0)->Get_Cellsize();
 		CSG_Rect	r	= pGrids->asGrid(0)->Get_Extent();
@@ -591,7 +591,7 @@ bool CGrid_Merge::Set_Weight(CSG_Grid *pGrid)
 		{
 			if( pGrid->is_NoData(x, y) )
 				m_Weight.Set_Value(x, y, d = 0);
-			else //if( m_Weight.asDouble(x, y) > d )
+			else //if( m_Weight.asInt(x, y) > d )
 				m_Weight.Set_Value(x, y, d);
 
 			if( dBlend <= 0 || d < dBlend )	d++;
@@ -601,10 +601,10 @@ bool CGrid_Merge::Set_Weight(CSG_Grid *pGrid)
 		{
 			if( pGrid->is_NoData(x, y) )
 				m_Weight.Set_Value(x, y, d = 0);
-			else if( m_Weight.asDouble(x, y) > d )
+			else if( m_Weight.asInt(x, y) > d )
 				m_Weight.Set_Value(x, y, d);
 			else
-				d	= m_Weight.asDouble(x, y);
+				d	= m_Weight.asInt(x, y);
 
 			if( dBlend <= 0 || d < dBlend )	d++;
 		}
@@ -616,10 +616,10 @@ bool CGrid_Merge::Set_Weight(CSG_Grid *pGrid)
 		{
 			if( pGrid->is_NoData(x, y) )
 				m_Weight.Set_Value(x, y, d = 0);
-			else if( m_Weight.asDouble(x, y) > d )
+			else if( m_Weight.asInt(x, y) > d )
 				m_Weight.Set_Value(x, y, d);
 			else
-				d	= m_Weight.asDouble(x, y);
+				d	= m_Weight.asInt(x, y);
 
 			if( dBlend <= 0 || d < dBlend )	d++;
 		}
@@ -628,10 +628,10 @@ bool CGrid_Merge::Set_Weight(CSG_Grid *pGrid)
 		{
 			if( pGrid->is_NoData(x, y) )
 				m_Weight.Set_Value(x, y, d = 0);
-			else if( m_Weight.asDouble(x, y) > d )
+			else if( m_Weight.asInt(x, y) > d )
 				m_Weight.Set_Value(x, y, d);
 			else
-				d	= m_Weight.asDouble(x, y);
+				d	= m_Weight.asInt(x, y);
 
 			if( dBlend <= 0 || d < dBlend )	d++;
 		}
@@ -696,7 +696,7 @@ void CGrid_Merge::Get_Match(CSG_Grid *pGrid)
 
 		CSG_Regression	r;
 
-		if( r.Calculate(Z[0].Get_Size(), Z[0].Get_Data(), Z[1].Get_Data()) )
+		if( r.Calculate((int)Z[0].Get_Size(), Z[0].Get_Data(), Z[1].Get_Data()) )
 		{
 			m_Match.Create(2);
 
diff --git a/src/modules/grid/grid_tools/Grid_Resample.cpp b/src/modules/grid/grid_tools/Grid_Resample.cpp
index 8e3be80..958e3e3 100644
--- a/src/modules/grid/grid_tools/Grid_Resample.cpp
+++ b/src/modules/grid/grid_tools/Grid_Resample.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Grid_Resample.cpp 2221 2014-09-04 16:02:43Z oconrad $
+ * Version $Id: Grid_Resample.cpp 2415 2015-02-18 14:27:34Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -73,33 +73,24 @@
 //---------------------------------------------------------
 CGrid_Resample::CGrid_Resample(void)
 {
-	CSG_Parameter	*pNode;
-	CSG_Parameters	*pParameters;
-
 	//-----------------------------------------------------
 	Set_Name		(_TL("Resampling"));
 
-	Set_Author		(SG_T("O.Conrad (c) 2003"));
+	Set_Author		("O.Conrad (c) 2003");
 
 	Set_Description	(_TW(
 		"Resampling of grids."
 	));
 
 	//-----------------------------------------------------
-	Parameters.Add_Grid(
-		NULL	, "INPUT"		, _TL("Grid"),
-		_TL(""),
-		PARAMETER_INPUT
-	);
-
 	Parameters.Add_Grid_List(
-		NULL	, "INPUT_ADD"	, _TL("Additional Grids"),
+		NULL	, "INPUT"		, _TL("Grids"),
 		_TL(""),
-		PARAMETER_INPUT_OPTIONAL
+		PARAMETER_INPUT
 	);
 
 	Parameters.Add_Grid_List(
-		NULL	, "OUTPUT_ADD"	, _TL("Additional Grids"),
+		NULL	, "OUTPUT"		, _TL("Output"),
 		_TL(""),
 		PARAMETER_OUTPUT_OPTIONAL
 	);
@@ -111,10 +102,8 @@ CGrid_Resample::CGrid_Resample(void)
 	);
 
 	//-----------------------------------------------------
-	pParameters	= Add_Parameters("SCALE_UP"	, _TL("Up-Scaling")				, _TL(""));
-
-	pNode	= pParameters->Add_Choice(
-		NULL	, "METHOD"		, _TL("Interpolation Method"),
+	Parameters.Add_Choice(
+		NULL	, "SCALE_UP"	, _TL("Upscaling Method"),
 		_TL(""),
 		CSG_String::Format(SG_T("%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|"),
 			_TL("Nearest Neighbor"),
@@ -131,10 +120,8 @@ CGrid_Resample::CGrid_Resample(void)
 	);
 
 	//-----------------------------------------------------
-	pParameters	= Add_Parameters("SCALE_DOWN"	, _TL("Down-Scaling")			, _TL(""));
-
-	pNode	= pParameters->Add_Choice(
-		NULL	, "METHOD"		, _TL("Interpolation Method"),
+	Parameters.Add_Choice(
+		NULL	, "SCALE_DOWN"	, _TL("Downscaling Method"),
 		_TL(""),
 		CSG_String::Format(SG_T("%s|%s|%s|%s|%s|"),
 			_TL("Nearest Neighbor"),
@@ -146,7 +133,7 @@ CGrid_Resample::CGrid_Resample(void)
 	);
 
 	//-----------------------------------------------------
-	m_Grid_Target.Create(SG_UI_Get_Window_Main() ? &Parameters : Add_Parameters("TARGET", _TL("Target System"), _TL("")));
+	m_Grid_Target.Create(SG_UI_Get_Window_Main() ? &Parameters : Add_Parameters("TARGET", _TL("Target System"), _TL("")), false);
 }
 
 
@@ -159,9 +146,14 @@ CGrid_Resample::CGrid_Resample(void)
 //---------------------------------------------------------
 int CGrid_Resample::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	if( !SG_STR_CMP(pParameter->Get_Identifier(), "INPUT") && pParameter->asGrid() )
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "PARAMETERS_GRID_SYSTEM") )
 	{
-		m_Grid_Target.Set_User_Defined(pParameters, pParameter->asGrid()->Get_Extent());
+		if( pParameter->asGrid_System() )
+		{
+			CSG_Grid_System	Input	= *pParameter->asGrid_System();
+
+			m_Grid_Target.Set_User_Defined(pParameters, Input.Get_Extent(), Input.Get_NY(), false, 0);
+		}
 	}
 
 	return( m_Grid_Target.On_Parameter_Changed(pParameters, pParameter) ? 1 : 0 );
@@ -170,6 +162,28 @@ int CGrid_Resample::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parame
 //---------------------------------------------------------
 int CGrid_Resample::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
+	if( SG_UI_Get_Window_Main() )
+	{
+		double	Scaling	= 0.0;
+
+		if( pParameters->Get_Parameter("INPUT")->asGridList()->Get_Count() > 0 )
+		{
+			double	Input	= pParameters->Get_Parameter("INPUT")->asGridList()->asGrid(0)->Get_System().Get_Cellsize();
+
+			if( pParameters->Get_Parameter("DEFINITION")->asInt() == 0 )	// user defined
+			{
+				Scaling	= Input - pParameters->Get_Parameter("USER_SIZE")->asDouble();
+			}
+			else if( pParameters->Get_Parameter("SYSTEM")->asGrid_System() && pParameters->Get_Parameter("SYSTEM")->asGrid_System()->Get_Cellsize() > 0.0 )
+			{
+				Scaling	= Input - pParameters->Get_Parameter("SYSTEM")->asGrid_System()->Get_Cellsize();
+			}
+		}
+
+		pParameters->Set_Enabled("SCALE_UP"  , Scaling < 0.0);
+		pParameters->Set_Enabled("SCALE_DOWN", Scaling > 0.0);
+	}
+
 	return( m_Grid_Target.On_Parameters_Enable(pParameters, pParameter) ? 1 : 0 );
 }
 
@@ -184,29 +198,34 @@ int CGrid_Resample::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parame
 bool CGrid_Resample::On_Execute(void)
 {
 	//-----------------------------------------------------
-	CSG_Grid	*pInput	= Parameters("INPUT")->asGrid();
+	CSG_Parameter_Grid_List	*pInputs	= Parameters("INPUT" )->asGridList();
+	CSG_Parameter_Grid_List	*pOutputs	= Parameters("OUTPUT")->asGridList();
+
+	if( pInputs->Get_Count() <= 0 )
+	{
+		return( false );
+	}
 
 	//-----------------------------------------------------
-	m_Grid_Target.Set_User_Defined(Get_Parameters("TARGET"), pInput->Get_Extent());	Dlg_Parameters("TARGET");	// if called from saga_cmd
+	CSG_Grid_System	Input	= pInputs->asGrid(0)->Get_System();
+
+	m_Grid_Target.Cmd_Update(Input.Get_Extent());	// if called from saga_cmd
 
-	CSG_Grid	*pOutput	= m_Grid_Target.Get_Grid(Parameters("KEEP_TYPE")->asBool() ? pInput->Get_Type() : SG_DATATYPE_Undefined);
+	CSG_Grid_System	Output	= m_Grid_Target.Get_System();
 
-	if( !pOutput || !pInput->is_Intersecting(pOutput->Get_Extent()) )
+	if( Input.Get_Extent().Intersects(Output.Get_Extent()) == INTERSECTION_None )
 	{
+		Error_Set(_TL("clip extent does not match extent of input grids"));
+
 		return( false );
 	}
 
 	//-------------------------------------------------
 	TSG_Grid_Interpolation	Interpolation;
 
-	if( pInput->Get_Cellsize() < pOutput->Get_Cellsize() )	// Up-Scaling...
+	if( Input.Get_Cellsize() < Output.Get_Cellsize() )	// Up-Scaling...
 	{
-		if( !Dlg_Parameters("SCALE_UP") )
-		{
-			return( false );
-		}
-
-		switch( Get_Parameters("SCALE_UP")->Get_Parameter("METHOD")->asInt() )
+		switch( Parameters("SCALE_UP")->asInt() )
 		{
 		case  0:	Interpolation	= GRID_INTERPOLATION_NearestNeighbour;	break;
 		case  1:	Interpolation	= GRID_INTERPOLATION_Bilinear;			break;
@@ -222,12 +241,7 @@ bool CGrid_Resample::On_Execute(void)
 	}
 	else	// Down-Scaling...
 	{
-		if( !Dlg_Parameters("SCALE_DOWN") )
-		{
-			return( false );
-		}
-
-		switch( Get_Parameters("SCALE_DOWN")->Get_Parameter("METHOD")->asInt() )
+		switch( Parameters("SCALE_DOWN")->asInt() )
 		{
 		case  0:	Interpolation	= GRID_INTERPOLATION_NearestNeighbour;	break;
 		case  1:	Interpolation	= GRID_INTERPOLATION_Bilinear;			break;
@@ -238,22 +252,13 @@ bool CGrid_Resample::On_Execute(void)
 	}
 
 	//-------------------------------------------------
-	pOutput->Assign(pInput, Interpolation);
-	pOutput->Set_Name(pInput->Get_Name());
-
-	//-------------------------------------------------
-	CSG_Grid_System	System(pOutput->Get_System());
-
-	CSG_Parameter_Grid_List	*pInputs	= Parameters("INPUT_ADD" )->asGridList();
-	CSG_Parameter_Grid_List	*pOutputs	= Parameters("OUTPUT_ADD")->asGridList();
-
 	pOutputs->Del_Items();
 
 	for(int i=0; i<pInputs->Get_Count() && Process_Get_Okay(); i++)
 	{
-		pInput	= pInputs->asGrid(i);
+		CSG_Grid	*pInput		= pInputs->asGrid(i);
 
-		pOutput	= SG_Create_Grid(pOutput->Get_System(),
+		CSG_Grid	*pOutput	= SG_Create_Grid(Output,
 			Parameters("KEEP_TYPE")->asBool() ? pInput->Get_Type() : SG_DATATYPE_Undefined
 		);
 
@@ -263,6 +268,7 @@ bool CGrid_Resample::On_Execute(void)
 		pOutputs->Add_Item(pOutput);
 	}
 
+	//-------------------------------------------------
 	return( true );
 }
 
diff --git a/src/modules/grid/grid_tools/Grid_SortRaster.cpp b/src/modules/grid/grid_tools/Grid_SortRaster.cpp
index 1c57b06..c3226a0 100644
--- a/src/modules/grid/grid_tools/Grid_SortRaster.cpp
+++ b/src/modules/grid/grid_tools/Grid_SortRaster.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Grid_SortRaster.cpp 2241 2014-09-22 11:04:27Z oconrad $
+ * Version $Id: Grid_SortRaster.cpp 2447 2015-03-19 14:43:42Z oconrad $
  *********************************************************/
 /*******************************************************************************
     SortRaster.cpp
@@ -76,7 +76,7 @@ bool CSortRaster::On_Execute(void)
 
 	pIndex->Set_NoData_Value(0.0);
 
-	for(sLong i=0, Index=0; i<Get_NCells() && Set_Progress(i, Get_NCells()); i++)
+	for(sLong i=0, Index=0; i<Get_NCells() && Set_Progress_NCells(i); i++)
 	{
 		int	ix, iy;
 
diff --git a/src/modules/imagery/imagery_classification/classify_supervised_polygons.h b/src/modules/grid/grid_tools/Grid_Support_Tool_Chains.cpp
similarity index 71%
copy from src/modules/imagery/imagery_classification/classify_supervised_polygons.h
copy to src/modules/grid/grid_tools/Grid_Support_Tool_Chains.cpp
index 5ada73b..742ba55 100644
--- a/src/modules/imagery/imagery_classification/classify_supervised_polygons.h
+++ b/src/modules/grid/grid_tools/Grid_Support_Tool_Chains.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: classify_supervised_polygons.h 2104 2014-04-21 15:24:01Z reklov_w $
+ * Version $Id: Grid_Support_Tool_Chains.cpp 2447 2015-03-19 14:43:42Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -9,13 +9,13 @@
 //      System for Automated Geoscientific Analyses      //
 //                                                       //
 //                    Module Library:                    //
-//                imagery_classification                 //
+//                      Grid_Tools                       //
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//             classify_supervised_polygons.h            //
+//              Grid_Support_Tool_Chains.cpp             //
 //                                                       //
-//                 Copyright (C) 2012 by                 //
+//                 Copyright (C) 2015 by                 //
 //                      Olaf Conrad                      //
 //                                                       //
 //-------------------------------------------------------//
@@ -59,8 +59,7 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#ifndef HEADER_INCLUDED__classify_supervised_polygons_H
-#define HEADER_INCLUDED__classify_supervised_polygons_H
+#include "Grid_Support_Tool_Chains.h"
 
 
 ///////////////////////////////////////////////////////////
@@ -70,41 +69,62 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#include "MLB_Interface.h"
-
-
-///////////////////////////////////////////////////////////
-//														 //
-///////////////////////////////////////////////////////////
+CSelect_Grid_From_List::CSelect_Grid_From_List(void)
+{
+	//-----------------------------------------------------
+	Set_Name		(_TL("Select Grid from List"));
+
+	Set_Author		("O.Conrad (c) 2015");
+
+	Set_Description	(_TW(
+		"Main use of this tool is to support tool chain development, allowing to pick a single grid from a grid list. "
+	));
+
+	//-----------------------------------------------------
+	Parameters.Add_Grid_List(
+		NULL	, "GRIDS"	, _TL("Grid List"),
+		_TL(""),
+		PARAMETER_INPUT
+	);
+
+	Parameters.Add_Grid(
+		NULL	, "GRID"	, _TL("Grid"),
+		_TL(""),
+		PARAMETER_OUTPUT_OPTIONAL
+	);
+
+	Parameters.Add_Value(
+		NULL	, "INDEX"	, _TL("Index"),
+		_TL(""),
+		PARAMETER_TYPE_Int, 0, 0, true
+	);
+}
 
 //---------------------------------------------------------
-class CPolygon_Classify_Supervised : public CSG_Module
+bool CSelect_Grid_From_List::On_Execute(void)
 {
-public:
-	CPolygon_Classify_Supervised(void);
-
-
-protected:
-
-	virtual bool				On_Execute				(void);
-
-	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
-
-
-private:
+	CSG_Parameter_Grid_List	*pGrids	= Parameters("GRIDS")->asGridList();
 
-	bool						m_bNormalise;
+	if( pGrids->Get_Count() <= 0 )
+	{
+		Error_Set(_TL("no grids in list"));
 
-	int							m_Class_ID, *m_Features, m_nFeatures;
+		return( false );
+	}
 
-	CSG_Classifier_Supervised	m_Classifier;
+	int	Index	= Parameters("INDEX")->asInt();
 
-	CSG_Shapes					*m_pPolygons, *m_pClasses;
+	if( Index >= pGrids->Get_Count() )
+	{
+		Error_Set(_TL("index out of range"));
 
+		return( false );
+	}
 
-	bool						Finalize				(void);
+	Parameters("GRID")->Set_Value(pGrids->asGrid(Index));
 
-};
+	return( true );	
+}
 
 
 ///////////////////////////////////////////////////////////
@@ -114,4 +134,3 @@ private:
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED__classify_supervised_polygons_H
diff --git a/src/modules/grid/grid_filter/Filter_Majority.h b/src/modules/grid/grid_tools/Grid_Support_Tool_Chains.h
similarity index 85%
copy from src/modules/grid/grid_filter/Filter_Majority.h
copy to src/modules/grid/grid_tools/Grid_Support_Tool_Chains.h
index 83bf64c..b56271f 100644
--- a/src/modules/grid/grid_filter/Filter_Majority.h
+++ b/src/modules/grid/grid_tools/Grid_Support_Tool_Chains.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Filter_Majority.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: Grid_Support_Tool_Chains.h 1921 2014-01-09 10:24:11Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -9,13 +9,13 @@
 //      System for Automated Geoscientific Analyses      //
 //                                                       //
 //                    Module Library:                    //
-//                      Grid_Filter                      //
+//                      Grid_Tools                       //
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//                   Filter_Majority.h                   //
+//               Grid_Support_Tool_Chains.h              //
 //                                                       //
-//                 Copyright (C) 2010 by                 //
+//                 Copyright (C) 2015 by                 //
 //                      Olaf Conrad                      //
 //                                                       //
 //-------------------------------------------------------//
@@ -59,8 +59,8 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#ifndef HEADER_INCLUDED__Filter_Majority_H
-#define HEADER_INCLUDED__Filter_Majority_H
+#ifndef HEADER_INCLUDED__Grid_Support_Tool_Chains_H
+#define HEADER_INCLUDED__Grid_Support_Tool_Chains_H
 
 
 ///////////////////////////////////////////////////////////
@@ -80,27 +80,17 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-class CFilter_Majority : public CSG_Module_Grid
+class CSelect_Grid_From_List : public CSG_Module_Grid
 {
 public:
-	CFilter_Majority(void);
+	CSelect_Grid_From_List(void);
 
+	virtual CSG_String		Get_MenuPath		(void)	{	return( _TL("A:Grid|Tools") );	}
 
-protected:
-
-	virtual bool			On_Execute		(void);
-
-
-private:
-
-	int						m_Radius, m_Threshold;
-
-	CSG_Grid				m_Kernel, *m_pInput;
-
-	CSG_Class_Statistics	m_Majority;
 
+protected:
 
-	double					Get_Majority	(int x, int y);
+	virtual bool			On_Execute			(void);
 
 };
 
@@ -112,4 +102,4 @@ private:
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED__Filter_Majority_H
+#endif // #ifndef HEADER_INCLUDED__Grid_Support_Tool_Chains_H
diff --git a/src/modules/grid/grid_tools/MLB_Interface.cpp b/src/modules/grid/grid_tools/MLB_Interface.cpp
index 6fef65c..166c4e3 100644
--- a/src/modules/grid/grid_tools/MLB_Interface.cpp
+++ b/src/modules/grid/grid_tools/MLB_Interface.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: MLB_Interface.cpp 2281 2014-10-09 15:49:41Z oconrad $
+ * Version $Id: MLB_Interface.cpp 2528 2015-06-30 16:08:22Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -137,6 +137,8 @@ CSG_String Get_Info(int i)
 
 #include "Grid_Transpose.h"
 
+#include "Grid_Support_Tool_Chains.h"
+
 
 //---------------------------------------------------------
 // 4. Allow your modules to be created here...
@@ -177,6 +179,7 @@ CSG_Module *		Create_Module(int i)
 	case 29: 	return( new CGrid_Gaps_Resampling );
 	case 30: 	return( new CGrid_Transpose );
 	case 31: 	return( new CGrid_Clip );
+	case 32: 	return( new CSelect_Grid_From_List );
 
 	case 40:	return( NULL );
 	default:	return( MLB_INTERFACE_SKIP_MODULE );
diff --git a/src/modules/grid/grid_tools/Makefile.am b/src/modules/grid/grid_tools/Makefile.am
index 576efb5..3040c1b 100644
--- a/src/modules/grid/grid_tools/Makefile.am
+++ b/src/modules/grid/grid_tools/Makefile.am
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.am 1844 2013-09-18 10:49:54Z oconrad $
+# $Id: Makefile.am 2528 2015-06-30 16:08:22Z oconrad $
 #
 if DEBUG
 DBGFLAGS = -g -DDEBUG
@@ -35,6 +35,7 @@ Grid_Proximity.cpp\
 Grid_Resample.cpp\
 Grid_Shrink_Expand.cpp\
 Grid_SortRaster.cpp\
+Grid_Support_Tool_Chains.cpp\
 Grid_ThresholdBuffer.cpp\
 Grid_Tiling.cpp\
 Grid_Transpose.cpp\
@@ -67,6 +68,7 @@ Grid_Proximity.h\
 Grid_Resample.h\
 Grid_Shrink_Expand.h\
 Grid_SortRaster.h\
+Grid_Support_Tool_Chains.h\
 Grid_ThresholdBuffer.h\
 Grid_Tiling.h\
 Grid_Transpose.h\
diff --git a/src/modules/grid/grid_tools/Makefile.in b/src/modules/grid/grid_tools/Makefile.in
index cae5627..4565ee2 100644
--- a/src/modules/grid/grid_tools/Makefile.in
+++ b/src/modules/grid/grid_tools/Makefile.in
@@ -135,10 +135,11 @@ am_libgrid_tools_la_OBJECTS = CreateGridSystem.lo Grid_Aggregate.lo \
 	Grid_InvertNoData.lo Grid_Mask.lo Grid_Merge.lo \
 	Grid_Orientation.lo Grid_Proximity.lo Grid_Resample.lo \
 	Grid_Shrink_Expand.lo Grid_SortRaster.lo \
-	Grid_ThresholdBuffer.lo Grid_Tiling.lo Grid_Transpose.lo \
-	Grid_Value_Reclassify.lo Grid_Value_Replace.lo \
-	Grid_Value_Replace_Interactive.lo Grid_Value_Request.lo \
-	Grid_Value_Type.lo GridsFromTableAndGrid.lo MLB_Interface.lo
+	Grid_Support_Tool_Chains.lo Grid_ThresholdBuffer.lo \
+	Grid_Tiling.lo Grid_Transpose.lo Grid_Value_Reclassify.lo \
+	Grid_Value_Replace.lo Grid_Value_Replace_Interactive.lo \
+	Grid_Value_Request.lo Grid_Value_Type.lo \
+	GridsFromTableAndGrid.lo MLB_Interface.lo
 libgrid_tools_la_OBJECTS = $(am_libgrid_tools_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
@@ -372,7 +373,7 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
 #
-# $Id: Makefile.am 1844 2013-09-18 10:49:54Z oconrad $
+# $Id: Makefile.am 2528 2015-06-30 16:08:22Z oconrad $
 #
 @DEBUG_TRUE at DBGFLAGS = -g -DDEBUG
 @SAGA_UNICODE_TRUE at UC_DEFS = -D_SAGA_UNICODE
@@ -404,6 +405,7 @@ Grid_Proximity.cpp\
 Grid_Resample.cpp\
 Grid_Shrink_Expand.cpp\
 Grid_SortRaster.cpp\
+Grid_Support_Tool_Chains.cpp\
 Grid_ThresholdBuffer.cpp\
 Grid_Tiling.cpp\
 Grid_Transpose.cpp\
@@ -436,6 +438,7 @@ Grid_Proximity.h\
 Grid_Resample.h\
 Grid_Shrink_Expand.h\
 Grid_SortRaster.h\
+Grid_Support_Tool_Chains.h\
 Grid_ThresholdBuffer.h\
 Grid_Tiling.h\
 Grid_Transpose.h\
@@ -549,6 +552,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Grid_Resample.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Grid_Shrink_Expand.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Grid_SortRaster.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Grid_Support_Tool_Chains.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Grid_ThresholdBuffer.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Grid_Tiling.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Grid_Transpose.Plo at am__quote@
@@ -561,22 +565,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MLB_Interface.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/imagery/imagery_classification/classify_supervised_polygons.h b/src/modules/grid/grid_visualisation/Grid_LUT_Assign.cpp
similarity index 72%
copy from src/modules/imagery/imagery_classification/classify_supervised_polygons.h
copy to src/modules/grid/grid_visualisation/Grid_LUT_Assign.cpp
index 5ada73b..d87b006 100644
--- a/src/modules/imagery/imagery_classification/classify_supervised_polygons.h
+++ b/src/modules/grid/grid_visualisation/Grid_LUT_Assign.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: classify_supervised_polygons.h 2104 2014-04-21 15:24:01Z reklov_w $
+ * Version $Id: grid_lut_assign.cpp 2463 2015-04-02 09:02:26Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -9,13 +9,13 @@
 //      System for Automated Geoscientific Analyses      //
 //                                                       //
 //                    Module Library:                    //
-//                imagery_classification                 //
+//                  Grid_Visualisation                   //
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//             classify_supervised_polygons.h            //
+//                  grid_lut_assign.cpp                  //
 //                                                       //
-//                 Copyright (C) 2012 by                 //
+//                 Copyright (C) 2015 by                 //
 //                      Olaf Conrad                      //
 //                                                       //
 //-------------------------------------------------------//
@@ -59,8 +59,7 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#ifndef HEADER_INCLUDED__classify_supervised_polygons_H
-#define HEADER_INCLUDED__classify_supervised_polygons_H
+#include "Grid_LUT_Assign.h"
 
 
 ///////////////////////////////////////////////////////////
@@ -70,41 +69,58 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#include "MLB_Interface.h"
-
-
-///////////////////////////////////////////////////////////
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-class CPolygon_Classify_Supervised : public CSG_Module
+CGrid_LUT_Assign::CGrid_LUT_Assign(void)
 {
-public:
-	CPolygon_Classify_Supervised(void);
+	//-----------------------------------------------------
+	Set_Name		(_TL("Select Look-up Table for Grid Visualization"));
 
+	Set_Author		("O.Conrad (c) 2015");
 
-protected:
+	Set_Description	(_TW(
+		"Select a look-up table for visual classification of a grid. "
+		"Useful in combination with tool chains. "
+	));
 
-	virtual bool				On_Execute				(void);
+	//-----------------------------------------------------
+	Parameters.Add_Grid(
+		NULL	, "GRID"	, _TL("Grid"),
+		_TL(""),
+		PARAMETER_INPUT
+	);
 
-	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+	Parameters.Add_Table(
+		NULL	, "LUT"		, _TL("Look-up Table"),
+		_TL(""),
+		PARAMETER_INPUT
+	);
+}
 
 
-private:
-
-	bool						m_bNormalise;
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
 
-	int							m_Class_ID, *m_Features, m_nFeatures;
+//---------------------------------------------------------
+bool CGrid_LUT_Assign::On_Execute(void)
+{
+	//-----------------------------------------------------
+	CSG_Grid	*pGrid	= Parameters("GRID")->asGrid();
 
-	CSG_Classifier_Supervised	m_Classifier;
+	CSG_Parameter	*pLUT	= DataObject_Get_Parameter(pGrid, "LUT");
 
-	CSG_Shapes					*m_pPolygons, *m_pClasses;
+	if( pLUT && pLUT->asTable() && pLUT->asTable()->Assign_Values(Parameters("LUT")->asTable()) )
+	{
+		DataObject_Set_Parameter(pGrid, pLUT);
+		DataObject_Set_Parameter(pGrid, "COLORS_TYPE", 1);	// Color Classification Type: Lookup Table
 
+		DataObject_Update(pGrid);
 
-	bool						Finalize				(void);
+		return( true );
+	}
 
-};
+	//-----------------------------------------------------
+	return( false );
+}
 
 
 ///////////////////////////////////////////////////////////
@@ -114,4 +130,3 @@ private:
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED__classify_supervised_polygons_H
diff --git a/src/modules/grid/grid_filter/Filter_Majority.h b/src/modules/grid/grid_visualisation/Grid_LUT_Assign.h
similarity index 85%
copy from src/modules/grid/grid_filter/Filter_Majority.h
copy to src/modules/grid/grid_visualisation/Grid_LUT_Assign.h
index 83bf64c..b7280ad 100644
--- a/src/modules/grid/grid_filter/Filter_Majority.h
+++ b/src/modules/grid/grid_visualisation/Grid_LUT_Assign.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Filter_Majority.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: grid_lut_assign.h 2155 2014-06-11 14:00:23Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -9,13 +9,13 @@
 //      System for Automated Geoscientific Analyses      //
 //                                                       //
 //                    Module Library:                    //
-//                      Grid_Filter                      //
+//                  Grid_Visualisation                   //
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//                   Filter_Majority.h                   //
+//                   grid_lut_assign.h                   //
 //                                                       //
-//                 Copyright (C) 2010 by                 //
+//                 Copyright (C) 2015 by                 //
 //                      Olaf Conrad                      //
 //                                                       //
 //-------------------------------------------------------//
@@ -59,8 +59,8 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#ifndef HEADER_INCLUDED__Filter_Majority_H
-#define HEADER_INCLUDED__Filter_Majority_H
+#ifndef HEADER_INCLUDED__grid_lut_assign_H
+#define HEADER_INCLUDED__grid_lut_assign_H
 
 
 ///////////////////////////////////////////////////////////
@@ -80,27 +80,15 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-class CFilter_Majority : public CSG_Module_Grid
+class CGrid_LUT_Assign : public CSG_Module_Grid  
 {
 public:
-	CFilter_Majority(void);
+	CGrid_LUT_Assign(void);
 
 
 protected:
 
-	virtual bool			On_Execute		(void);
-
-
-private:
-
-	int						m_Radius, m_Threshold;
-
-	CSG_Grid				m_Kernel, *m_pInput;
-
-	CSG_Class_Statistics	m_Majority;
-
-
-	double					Get_Majority	(int x, int y);
+	virtual bool		On_Execute				(void);
 
 };
 
@@ -112,4 +100,4 @@ private:
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED__Filter_Majority_H
+#endif // #ifndef HEADER_INCLUDED__grid_lut_assign_H
diff --git a/src/modules/grid/grid_visualisation/Grid_RGB_Composite.cpp b/src/modules/grid/grid_visualisation/Grid_RGB_Composite.cpp
index 652136d..dfc3e16 100644
--- a/src/modules/grid/grid_visualisation/Grid_RGB_Composite.cpp
+++ b/src/modules/grid/grid_visualisation/Grid_RGB_Composite.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Grid_RGB_Composite.cpp 2208 2014-08-27 16:00:51Z oconrad $
+ * Version $Id: Grid_RGB_Composite.cpp 2463 2015-04-02 09:02:26Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -299,6 +299,7 @@ CSG_Grid * CGrid_RGB_Composite::_Get_Grid(CSG_Grid *pGrid, int Method, CSG_Param
 
 		case 4:	// Standard deviation
 			Min		= pGrid->Get_Mean() - StdDev * pGrid->Get_StdDev();
+			if( Min < 0.0 ) Min = 0.0;
 			Range	= 2.0 * StdDev * pGrid->Get_StdDev();
 			break;
 		}
diff --git a/src/modules/grid/grid_visualisation/Grid_Terrain_Map.cpp b/src/modules/grid/grid_visualisation/Grid_Terrain_Map.cpp
index 82f2f7f..0abc4fb 100644
--- a/src/modules/grid/grid_visualisation/Grid_Terrain_Map.cpp
+++ b/src/modules/grid/grid_visualisation/Grid_Terrain_Map.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Grid_Terrain_Map.cpp 2328 2014-11-05 09:50:46Z reklov_w $
+ * Version $Id: Grid_Terrain_Map.cpp 2484 2015-05-02 13:46:42Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -365,7 +365,7 @@ bool CGrid_Terrain_Map::Generate_Contours()
 	//-----------------------------------------------------
 	if( pContours == NULL )
 	{
-		pContours = SG_Create_Shapes();
+		pContours = SG_Create_Shapes(SHAPE_TYPE_Line);
 		Parameters("CONTOURS")->Set_Value(pContours);
 		DataObject_Add(pContours);
 	}
@@ -390,7 +390,8 @@ bool CGrid_Terrain_Map::Generate_Contours()
 		DataObject_Set_Parameters(pContours, Parms);
 	}
 
-	DataObject_Update(pContours			, SG_UI_DATAOBJECT_SHOW_LAST_MAP);
+	pContours->Set_Name(CSG_String::Format(SG_T("Contours_%s"), Parameters("DEM")->asGrid()->Get_Name()));
+	DataObject_Update(pContours, SG_UI_DATAOBJECT_SHOW_LAST_MAP);
 
 
 	//-----------------------------------------------------
diff --git a/src/modules/grid/grid_visualisation/MLB_Interface.cpp b/src/modules/grid/grid_visualisation/MLB_Interface.cpp
index 6619bc8..e2d3aa4 100644
--- a/src/modules/grid/grid_visualisation/MLB_Interface.cpp
+++ b/src/modules/grid/grid_visualisation/MLB_Interface.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: MLB_Interface.cpp 2289 2014-10-16 13:45:05Z oconrad $
+ * Version $Id: MLB_Interface.cpp 2529 2015-07-01 07:06:33Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -106,6 +106,8 @@ CSG_String Get_Info(int i)
 #include "Grid_Histogram_Surface.h"
 #include "Grid_Aspect_Slope_Map.h"
 #include "Grid_Terrain_Map.h"
+#include "Grid_LUT_Assign.h"
+
 
 //---------------------------------------------------------
 // 4. Allow your modules to be created here...
@@ -124,6 +126,10 @@ CSG_Module *		Create_Module(int i)
 	case  7:	return( new CGrid_Aspect_Slope_Map );
 	case  8:	return( new CGrid_Terrain_Map );
 	case  9:	return( new CGrid_RGB_Split );
+	case 10:	return( new CGrid_LUT_Assign );
+
+	case 11:	return( NULL );
+	default:	return( MLB_INTERFACE_SKIP_MODULE );
 	}
 
 	return( NULL );
diff --git a/src/modules/grid/grid_visualisation/Makefile.am b/src/modules/grid/grid_visualisation/Makefile.am
index 8a8b171..473a828 100644
--- a/src/modules/grid/grid_visualisation/Makefile.am
+++ b/src/modules/grid/grid_visualisation/Makefile.am
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.am 2131 2014-05-27 13:34:07Z reklov_w $
+# $Id: Makefile.am 2526 2015-06-29 16:04:38Z oconrad $
 #
 if DEBUG
 DBGFLAGS = -g -DDEBUG
@@ -20,6 +20,7 @@ Grid_Color_Triangle.cpp\
 Grid_Color_Rotate.cpp\
 Grid_Colors_Fit.cpp\
 Grid_Histogram_Surface.cpp\
+Grid_LUT_Assign.cpp\
 Grid_RGB_Composite.cpp\
 Grid_Terrain_Map.cpp\
 MLB_Interface.cpp\
@@ -30,6 +31,7 @@ Grid_Color_Rotate.h\
 Grid_Color_Triangle.h\
 Grid_Colors_Fit.h\
 Grid_Histogram_Surface.h\
+Grid_LUT_Assign.h\
 Grid_RGB_Composite.h\
 Grid_Terrain_Map.h\
 MLB_Interface.h
diff --git a/src/modules/grid/grid_visualisation/Makefile.in b/src/modules/grid/grid_visualisation/Makefile.in
index 40d4f67..7cc6f44 100644
--- a/src/modules/grid/grid_visualisation/Makefile.in
+++ b/src/modules/grid/grid_visualisation/Makefile.in
@@ -130,8 +130,8 @@ libgrid_visualisation_la_DEPENDENCIES =  \
 am_libgrid_visualisation_la_OBJECTS = Grid_3D_Image.lo \
 	Grid_Aspect_Slope_Map.lo Grid_Color_Blend.lo \
 	Grid_Color_Triangle.lo Grid_Color_Rotate.lo Grid_Colors_Fit.lo \
-	Grid_Histogram_Surface.lo Grid_RGB_Composite.lo \
-	Grid_Terrain_Map.lo MLB_Interface.lo
+	Grid_Histogram_Surface.lo Grid_LUT_Assign.lo \
+	Grid_RGB_Composite.lo Grid_Terrain_Map.lo MLB_Interface.lo
 libgrid_visualisation_la_OBJECTS =  \
 	$(am_libgrid_visualisation_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
@@ -366,7 +366,7 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
 #
-# $Id: Makefile.am 2131 2014-05-27 13:34:07Z reklov_w $
+# $Id: Makefile.am 2526 2015-06-29 16:04:38Z oconrad $
 #
 @DEBUG_TRUE at DBGFLAGS = -g -DDEBUG
 @SAGA_UNICODE_TRUE at UC_DEFS = -D_SAGA_UNICODE
@@ -383,6 +383,7 @@ Grid_Color_Triangle.cpp\
 Grid_Color_Rotate.cpp\
 Grid_Colors_Fit.cpp\
 Grid_Histogram_Surface.cpp\
+Grid_LUT_Assign.cpp\
 Grid_RGB_Composite.cpp\
 Grid_Terrain_Map.cpp\
 MLB_Interface.cpp\
@@ -393,6 +394,7 @@ Grid_Color_Rotate.h\
 Grid_Color_Triangle.h\
 Grid_Colors_Fit.h\
 Grid_Histogram_Surface.h\
+Grid_LUT_Assign.h\
 Grid_RGB_Composite.h\
 Grid_Terrain_Map.h\
 MLB_Interface.h
@@ -484,27 +486,31 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Grid_Color_Triangle.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Grid_Colors_Fit.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Grid_Histogram_Surface.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Grid_LUT_Assign.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Grid_RGB_Composite.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Grid_Terrain_Map.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MLB_Interface.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/imagery/Makefile.am b/src/modules/imagery/Makefile.am
index 0accf3c..f3135bd 100644
--- a/src/modules/imagery/Makefile.am
+++ b/src/modules/imagery/Makefile.am
@@ -1 +1 @@
-SUBDIRS = imagery_classification imagery_opencv imagery_photogrammetry imagery_segmentation imagery_svm imagery_tools imagery_vigra
+SUBDIRS = imagery_classification imagery_maxent imagery_opencv imagery_photogrammetry imagery_segmentation imagery_svm imagery_tools imagery_vigra
diff --git a/src/modules/imagery/Makefile.in b/src/modules/imagery/Makefile.in
index 5e90b14..6c2319c 100644
--- a/src/modules/imagery/Makefile.in
+++ b/src/modules/imagery/Makefile.in
@@ -322,7 +322,7 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-SUBDIRS = imagery_classification imagery_opencv imagery_photogrammetry imagery_segmentation imagery_svm imagery_tools imagery_vigra
+SUBDIRS = imagery_classification imagery_maxent imagery_opencv imagery_photogrammetry imagery_segmentation imagery_svm imagery_tools imagery_vigra
 all: all-recursive
 
 .SUFFIXES:
diff --git a/src/modules/imagery/imagery_classification/MLB_Interface.cpp b/src/modules/imagery/imagery_classification/MLB_Interface.cpp
index 24ba546..8171b8d 100644
--- a/src/modules/imagery/imagery_classification/MLB_Interface.cpp
+++ b/src/modules/imagery/imagery_classification/MLB_Interface.cpp
@@ -115,10 +115,12 @@ CSG_Module *		Create_Module(int i)
 	case  1:	return( new CGrid_Cluster_Analysis );
 	case  2:	return( new CChange_Detection );
 	case  3:	return( new CDecision_Tree );
-	case  4:	return( new CPolygon_Classify_Supervised );
-	}
+	case  4:	return( new CPolygon_Classify_Supervised( true) );
+	case  5:	return( new CPolygon_Classify_Supervised(false) );
 
-	return( NULL );
+	case  6:	return( NULL );
+	default:	return( MLB_INTERFACE_SKIP_MODULE );
+	}
 }
 
 
diff --git a/src/modules/imagery/imagery_classification/Makefile.in b/src/modules/imagery/imagery_classification/Makefile.in
index a3c25f1..bd701f5 100644
--- a/src/modules/imagery/imagery_classification/Makefile.in
+++ b/src/modules/imagery/imagery_classification/Makefile.in
@@ -472,22 +472,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/decision_tree.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/imagery/imagery_classification/classify_cluster_analysis.cpp b/src/modules/imagery/imagery_classification/classify_cluster_analysis.cpp
index 05dc85c..0bbbf42 100644
--- a/src/modules/imagery/imagery_classification/classify_cluster_analysis.cpp
+++ b/src/modules/imagery/imagery_classification/classify_cluster_analysis.cpp
@@ -178,7 +178,8 @@ bool CGrid_Cluster_Analysis::On_Execute(void)
 
 	//-----------------------------------------------------
 	bool					bNormalize;
-	sLong					iFeature, iElement, nElements;
+	int						iFeature;
+	sLong					iElement, nElements;
 	CSG_Cluster_Analysis	Analysis;
 	CSG_Grid				*pCluster;
 	CSG_Parameter_Grid_List	*pGrids;
diff --git a/src/modules/imagery/imagery_classification/classify_supervised.cpp b/src/modules/imagery/imagery_classification/classify_supervised.cpp
index 57a4249..29232ff 100644
--- a/src/modules/imagery/imagery_classification/classify_supervised.cpp
+++ b/src/modules/imagery/imagery_classification/classify_supervised.cpp
@@ -71,26 +71,6 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-enum
-{
-	CLASS_ID	= 0,
-	CLASS_ROI_M,
-	CLASS_ROI_S,
-	CLASS_TOT_N,
-	CLASS_ROI_N
-};
-
-//---------------------------------------------------------
-#define CLASS_NPARMS	(CLASS_ROI_S - CLASS_ROI_M + 1)
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
 CGrid_Classify_Supervised::CGrid_Classify_Supervised(void)
 {
 	int				i;
@@ -98,42 +78,25 @@ CGrid_Classify_Supervised::CGrid_Classify_Supervised(void)
 	CSG_Parameter	*pNode;
 
 	//-----------------------------------------------------
-	Set_Name		(_TL("Supervised Classification"));
+	Set_Name		(_TL("Supervised Classification for Grids"));
 
-	Set_Author		(SG_T("O.Conrad (c) 2005"));
+	Set_Author		("O.Conrad (c) 2005");
 
 	Set_Description	(_TW(
 		"Supervised Classification"
 	));
 
 	//-----------------------------------------------------
-	Parameters.Add_Grid_List(
-		NULL	, "GRIDS"			, _TL("Grids"),
+	pNode	= Parameters.Add_Grid_List(
+		NULL	, "GRIDS"			, _TL("Features"),
 		_TL(""),
 		PARAMETER_INPUT
 	);
 
-	pNode	= Parameters.Add_Shapes(
-		NULL	, "ROI"				, _TL("Training Areas"),
-		_TL(""),
-		PARAMETER_INPUT, SHAPE_TYPE_Polygon
-	);
-
-	Parameters.Add_Table_Field(
-		pNode	, "ROI_ID"			, _TL("Class Identifier"),
-		_TL("")
-	);
-
-	Parameters.Add_Table(
-		NULL	, "STATS"			, _TL("Class Statistics"),
-		_TL(""),
-		PARAMETER_INPUT
-	);
-
-	Parameters.Add_Table(
-		NULL	, "CLASS_INFO"		, _TL("Summary"),
+	Parameters.Add_Value(
+		pNode	, "NORMALISE"		, _TL("Normalise"),
 		_TL(""),
-		PARAMETER_OUTPUT
+		PARAMETER_TYPE_Bool, false
 	);
 
 	Parameters.Add_Grid(
@@ -148,18 +111,34 @@ CGrid_Classify_Supervised::CGrid_Classify_Supervised(void)
 		PARAMETER_OUTPUT_OPTIONAL
 	);
 
-	Parameters.Add_Choice(
-		NULL	, "STATS_SRC"		, _TL("Get Class Statistics from..."),
+	//-----------------------------------------------------
+	pNode	= Parameters.Add_Shapes(
+		NULL	, "TRAINING"		, _TL("Training Areas"),
+		_TL(""),
+		PARAMETER_INPUT_OPTIONAL, SHAPE_TYPE_Polygon
+	);
+
+	Parameters.Add_Table_Field(
+		pNode	, "TRAINING_CLASS"	, _TL("Class Identifier"),
+		_TL("")
+	);
+
+	Parameters.Add_FilePath(
+		pNode	, "FILE_LOAD"		, _TL("Load Statistics from File..."),
+		_TL(""),
+		NULL, NULL, false
+	);
+
+	Parameters.Add_FilePath(
+		NULL	, "FILE_SAVE"		, _TL("Save Statistics to File..."),
 		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("training areas"),
-			_TL("table")
-		), 0
+		NULL, NULL, true
 	);
 
+	//-----------------------------------------------------
 	for(i=0; i<=SG_CLASSIFY_SUPERVISED_WTA; i++)
 	{
-		s	+= CSG_Classifier_Supervised::Get_Name_of_Method(i) + SG_T("|");
+		s	+= CSG_Classifier_Supervised::Get_Name_of_Method(i) + "|";
 	}
 
 	Parameters.Add_Choice(
@@ -169,38 +148,32 @@ CGrid_Classify_Supervised::CGrid_Classify_Supervised(void)
 	);
 
 	Parameters.Add_Value(
-		NULL	, "NORMALISE"		, _TL("Normalise"),
-		_TL(""),
-		PARAMETER_TYPE_Bool, false
+		NULL	, "THRESHOLD_DIST"	, _TL("Distance Threshold"),
+		_TL("Let pixel stay unclassified, if minimum euclidian or mahalanobis distance is greater than threshold."),
+		PARAMETER_TYPE_Double, 0.0, 0.0, true
 	);
 
 	Parameters.Add_Value(
-		NULL	, "THRESHOLD_DIST"	, _TL("Distance Threshold"),
-		_TL("Let pixel stay unclassified, if minimum or mahalanobis distance is greater than threshold."),
-		PARAMETER_TYPE_Double, 0.0, 0.0, true
+		NULL	, "THRESHOLD_ANGLE"	, _TL("Spectral Angle Threshold (Degree)"),
+		_TL("Let pixel stay unclassified, if spectral angle distance is greater than threshold."),
+		PARAMETER_TYPE_Double, 0.0, 0.0, true, 90.0, true
 	);
 
 	Parameters.Add_Value(
-		NULL	, "THRESHOLD_PROB"	, _TL("Probability Threshold (Percent)"),
-		_TL("Let pixel stay unclassified, if maximum likelihood probability is less than threshold."),
+		NULL	, "THRESHOLD_PROB"	, _TL("Probability Threshold"),
+		_TL("Let pixel stay unclassified, if maximum likelihood probability value is less than threshold."),
 		PARAMETER_TYPE_Double, 0.0, 0.0, true, 100.0, true
 	);
 
 	Parameters.Add_Choice(
 		NULL	, "RELATIVE_PROB"	, _TL("Probability Reference"),
 		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
+		CSG_String::Format("%s|%s|",
 			_TL("absolute"),
 			_TL("relative")
 		), 1
 	);
 
-	Parameters.Add_Value(
-		NULL	, "THRESHOLD_ANGLE"	, _TL("Spectral Angle Threshold (Degree)"),
-		_TL("Let pixel stay unclassified, if spectral angle distance is greater than threshold."),
-		PARAMETER_TYPE_Double, 0.0, 0.0, true, 90.0, true
-	);
-
 	pNode	= Parameters.Add_Node(
 		NULL	, "WTA"				, _TL("Winner Takes All"),
 		_TL("")
@@ -209,7 +182,7 @@ CGrid_Classify_Supervised::CGrid_Classify_Supervised(void)
 	for(i=0; i<SG_CLASSIFY_SUPERVISED_WTA; i++)
 	{
 		Parameters.Add_Value(
-			pNode, CSG_String::Format(SG_T("WTA_%d"), i), CSG_Classifier_Supervised::Get_Name_of_Method(i), _TL(""),
+			pNode, CSG_String::Format("WTA_%d", i), CSG_Classifier_Supervised::Get_Name_of_Method(i), _TL(""),
 			PARAMETER_TYPE_Bool, false
 		);
 	}
@@ -218,232 +191,205 @@ CGrid_Classify_Supervised::CGrid_Classify_Supervised(void)
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 int CGrid_Classify_Supervised::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("STATS_SRC")) )
+	if(	!SG_STR_CMP(pParameter->Get_Identifier(), "TRAINING") )
 	{
-		int	Value	= pParameter->asInt();
-
-		pParameters->Get_Parameter("ROI"  )->Set_Enabled(Value == 0);
-		pParameters->Get_Parameter("STATS")->Set_Enabled(Value == 1);
+		pParameters->Set_Enabled("FILE_LOAD", pParameter->asShapes() == NULL);
+		pParameters->Set_Enabled("FILE_SAVE", pParameter->asShapes() != NULL);
 	}
 
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("METHOD")) )
+	if(	!SG_STR_CMP(pParameter->Get_Identifier(), "METHOD") )
 	{
-		int	Value	= pParameter->asInt();
-
-		pParameters->Get_Parameter("THRESHOLD_DIST" )->Set_Enabled(Value == SG_CLASSIFY_SUPERVISED_MinimumDistance || Value == SG_CLASSIFY_SUPERVISED_Mahalonobis);
-		pParameters->Get_Parameter("THRESHOLD_PROB" )->Set_Enabled(Value == SG_CLASSIFY_SUPERVISED_MaximumLikelihood);
-		pParameters->Get_Parameter("RELATIVE_PROB"  )->Set_Enabled(Value == SG_CLASSIFY_SUPERVISED_MaximumLikelihood);
-		pParameters->Get_Parameter("THRESHOLD_ANGLE")->Set_Enabled(Value == SG_CLASSIFY_SUPERVISED_SAM);
-		pParameters->Get_Parameter("WTA"            )->Set_Enabled(Value == SG_CLASSIFY_SUPERVISED_WTA);
+		pParameters->Set_Enabled("THRESHOLD_DIST" , pParameter->asInt() == SG_CLASSIFY_SUPERVISED_MinimumDistance
+			||                                      pParameter->asInt() == SG_CLASSIFY_SUPERVISED_Mahalonobis      );
+		pParameters->Set_Enabled("THRESHOLD_PROB" , pParameter->asInt() == SG_CLASSIFY_SUPERVISED_MaximumLikelihood);
+		pParameters->Set_Enabled("RELATIVE_PROB"  , pParameter->asInt() == SG_CLASSIFY_SUPERVISED_MaximumLikelihood);
+		pParameters->Set_Enabled("THRESHOLD_ANGLE", pParameter->asInt() == SG_CLASSIFY_SUPERVISED_SAM              );
+		pParameters->Set_Enabled("WTA"            , pParameter->asInt() == SG_CLASSIFY_SUPERVISED_WTA              );
 	}
 
-	//-----------------------------------------------------
-	return( 1 );
+	return( CSG_Module_Grid::On_Parameters_Enable(pParameters, pParameter) );
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-inline double CGrid_Classify_Supervised::Get_Value(int x, int y, int iGrid)
-{
-	CSG_Grid	*pGrid	= m_pGrids->asGrid(iGrid);
-
-	return( m_bNormalise
-		? (pGrid->asDouble(x, y) - pGrid->Get_Mean()) / pGrid->Get_StdDev()
-		:  pGrid->asDouble(x, y)
-	);
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 bool CGrid_Classify_Supervised::On_Execute(void)
 {
-	int			Method, Class, i;
-	double		Quality;
+	//-----------------------------------------------------
+	if( !Get_Features() )
+	{
+		Error_Set(_TL("invalid features"));
 
-	//-------------------------------------------------
-	m_pGrids		= Parameters("GRIDS"    )->asGridList();
- 	m_pClasses		= Parameters("CLASSES"  )->asGrid();
-	m_pQuality		= Parameters("QUALITY"  )->asGrid();
-	m_bNormalise	= Parameters("NORMALISE")->asBool();
-	Method			= Parameters("METHOD"   )->asInt();
+		return( false );
+	}
 
-	m_Classifier.Set_Distance_Threshold   (Parameters("THRESHOLD_DIST" )->asDouble());
-	m_Classifier.Set_Probability_Threshold(Parameters("THRESHOLD_PROB" )->asDouble() / 100.0);
-	m_Classifier.Set_Probability_Relative (Parameters("RELATIVE_PROB"  )->asBool  ());
-	m_Classifier.Set_Angle_Threshold      (Parameters("THRESHOLD_ANGLE")->asDouble() * M_DEG_TO_RAD);
+	//-----------------------------------------------------
+	CSG_Classifier_Supervised	Classifier;
 
-	for(i=0; i<SG_CLASSIFY_SUPERVISED_WTA; i++)
+	if( !Set_Classifier(Classifier) )
 	{
-		m_Classifier.Set_WTA(i, Parameters(CSG_String::Format(SG_T("WTA_%d"), i))->asBool());
+		return( false );
 	}
 
 	//-----------------------------------------------------
-	for(i=m_pGrids->Get_Count()-1; i>=0; i--)
+	CSG_Grid	*pClasses	= Parameters("CLASSES")->asGrid();
+	CSG_Grid	*pQuality	= Parameters("QUALITY")->asGrid();
+
+	pClasses->Set_NoData_Value(0);
+	pClasses->Assign(0.0);
+
+	//-----------------------------------------------------
+	Process_Set_Text(_TL("prediction"));
+
+	int	Method	= Parameters("METHOD")->asInt();
+
+	for(int y=0; y<Get_NY() && Set_Progress(y); y++)
 	{
-		if( m_pGrids->asGrid(i)->Get_ZRange() <= 0.0 )
+		#pragma omp parallel for
+		for(int x=0; x<Get_NX(); x++)
 		{
-			Message_Add(CSG_String::Format(SG_T("%s: %s"), _TL("grid has been dropped"), m_pGrids->asGrid(i)->Get_Name()));
+			int			Class;
+			double		Quality;
+			CSG_Vector	Features(m_pFeatures->Get_Count());
 
-			m_pGrids->Del_Item(i);
+			if( Get_Features(x, y, Features) && Classifier.Get_Class(Features, Class, Quality, Method) )
+			{
+				SG_GRID_PTR_SAFE_SET_VALUE(pClasses, x, y, 1 + Class);
+				SG_GRID_PTR_SAFE_SET_VALUE(pQuality, x, y, Quality  );
+			}
+			else
+			{
+				SG_GRID_PTR_SAFE_SET_NODATA(pClasses, x, y);
+				SG_GRID_PTR_SAFE_SET_NODATA(pQuality, x, y);
+			}
 		}
 	}
 
-	if( m_pGrids->Get_Count() <= 0 )
-	{
-		Error_Set(_TL("no valid grid in list."));
+	//-----------------------------------------------------
+	return( Set_Classification(Classifier) );
+}
 
-		return( false );
-	}
 
-	//-------------------------------------------------
-	Process_Set_Text(_TL("initializing"));
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
 
-	if( !Initialize() )
+//---------------------------------------------------------
+bool CGrid_Classify_Supervised::Get_Features(void)
+{
+	m_pFeatures		= Parameters("GRIDS"    )->asGridList();
+	m_bNormalise	= Parameters("NORMALISE")->asBool();
+
+	for(int i=m_pFeatures->Get_Count()-1; i>=0; i--)
 	{
-		return( false );
-	}
+		if( m_pFeatures->asGrid(i)->Get_ZRange() <= 0.0 )
+		{
+			Message_Add(CSG_String::Format("%s: %s", _TL("feature has been dropped"), m_pFeatures->asGrid(i)->Get_Name()));
 
-	//-------------------------------------------------
-	Process_Set_Text(_TL("running classification"));
+			m_pFeatures->Del_Item(i);
+		}
+	}
 
-	CSG_Vector	Features(m_pGrids->Get_Count());
+	return( m_pFeatures->Get_Count() > 0 );
+}
 
-	for(int y=0; y<Get_NY() && Set_Progress(y); y++)
+//---------------------------------------------------------
+bool CGrid_Classify_Supervised::Get_Features(int x, int y, CSG_Vector &Features)
+{
+	for(int i=0; i<m_pFeatures->Get_Count(); i++)
 	{
-		for(int x=0; x<Get_NX(); x++)
-		{
-			if( !m_pClasses->is_NoData(x, y) )
-			{
-				for(i=0; i<m_pGrids->Get_Count(); i++)
-				{
-					Features[i]	= Get_Value(x, y, i);
-				}
+		CSG_Grid	*pGrid	= m_pFeatures->asGrid(i);
 
-				if( m_Classifier.Get_Class(Features, Class, Quality, Method) )
-				{
-					m_pClasses->Set_Value(x, y, 1 + Class);
-				}
-				else
-				{
-					m_pClasses->Set_NoData(x, y);
-				}
-
-				if( m_pQuality )
-				{
-					m_pQuality->Set_Value(x, y, Quality);
-				}
-			}
+		if( pGrid->is_NoData(x, y) )
+		{
+			return( false );
 		}
+
+		Features[i]	= m_bNormalise ? (pGrid->asDouble(x, y) - pGrid->Get_Mean()) / pGrid->Get_StdDev() : pGrid->asDouble(x, y);
 	}
 
-	return( Finalize() );
+	return( true );
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CGrid_Classify_Supervised::Initialize(void)
+bool CGrid_Classify_Supervised::Set_Classifier(CSG_Classifier_Supervised &Classifier)
 {
-	bool		bNoData;
-	int			x, y, iGrid, iROI_ID;
-	TSG_Point	p;
-	CSG_Shapes	*pROIs;
-
-	//-----------------------------------------------------
-	m_pClasses->Set_NoData_Value(-1);
-	m_pClasses->Assign(0.0);
+	Classifier.Create(m_pFeatures->Get_Count());
 
-	m_Classifier.Create(m_pGrids->Get_Count());
+	Classifier.Set_Threshold_Distance   (Parameters("THRESHOLD_DIST" )->asDouble());
+	Classifier.Set_Threshold_Angle      (Parameters("THRESHOLD_ANGLE")->asDouble() * M_DEG_TO_RAD);
+	Classifier.Set_Threshold_Probability(Parameters("THRESHOLD_PROB" )->asDouble());
+	Classifier.Set_Probability_Relative (Parameters("RELATIVE_PROB"  )->asBool  ());
 
-	if( Parameters("STATS_SRC")->asInt() == 0 )
+	for(int i=0; i<SG_CLASSIFY_SUPERVISED_WTA; i++)
 	{
-		pROIs	= Parameters("ROI"   )->asShapes();
-		iROI_ID	= Parameters("ROI_ID")->asInt();
+		Classifier.Set_WTA(i, Parameters(CSG_String::Format("WTA_%d", i))->asBool());
 	}
-	else
-	{
-		pROIs	= NULL;
-
-		CSG_Table	*pStats	= Parameters("STATS")->asTable();
 
-		if( pStats->Get_Field_Count() < (1 + 2 * m_pGrids->Get_Count()) )
+	//-----------------------------------------------------
+	if( Parameters("TRAINING")->asShapes() != NULL )	// training areas
+	{
+		if( !Set_Classifier(Classifier, Parameters("TRAINING")->asShapes(), Parameters("TRAINING_CLASS")->asInt()) )
 		{
-			Error_Set(_TL("not entries in statistics table."));
+			Error_Set(_TL("could not initialize classifier from training areas"));
 
 			return( false );
 		}
-
-		for(int iClass=0; iClass<pStats->Get_Count(); iClass++)
+	}
+	else	// from file
+	{
+		if( !Classifier.Load(Parameters("FILE_LOAD")->asString()) )
 		{
-			CSG_Table_Record		*pRecord	= pStats->Get_Record(iClass);
-			CSG_Simple_Statistics	*pClass		= m_Classifier.Get_Statistics(pRecord->asString(0));
+			Error_Set(_TL("could not initialize classifier from file"));
 
-			for(iGrid=0; iGrid<m_pGrids->Get_Count(); iGrid++)
-			{
-				pClass[iGrid].Create(pRecord->asDouble(1 + 2 * iGrid), pRecord->asDouble(2 + 2 * iGrid));
-			}
+			return( false );
 		}
 	}
 
 	//-----------------------------------------------------
-	for(y=0, p.y=Get_YMin(); y<Get_NY() && Set_Progress(y); y++, p.y+=Get_Cellsize())
+	Message_Add(Classifier.Print(), false);
+
+	return( true );
+}
+
+//---------------------------------------------------------
+bool CGrid_Classify_Supervised::Set_Classifier(CSG_Classifier_Supervised &Classifier, CSG_Shapes *pPolygons, int Field)
+{
+	Process_Set_Text(_TL("training"));
+
+	//-----------------------------------------------------
+	TSG_Point	p;	p.y	= Get_YMin();
+
+	for(int y=0; y<Get_NY() && Set_Progress(y); y++, p.y+=Get_Cellsize())
 	{
-		for(x=0, p.x=Get_XMin(); x<Get_NX(); x++, p.x+=Get_Cellsize())
-		{
-			for(iGrid=0, bNoData=false; iGrid<m_pGrids->Get_Count() && !bNoData; iGrid++)
-			{
-				if( m_pGrids->asGrid(iGrid)->is_NoData(x, y) )
-				{
-					bNoData	= true;
-				}
-			}
+		p.x	= Get_XMin();
 
-			if( bNoData )
-			{
-				m_pClasses->Set_NoData(x, y);
+		for(int x=0; x<Get_NX(); x++, p.x+=Get_Cellsize())
+		{
+			CSG_Vector	Features(m_pFeatures->Get_Count());
 
-				if( m_pQuality )
-				{
-					m_pQuality->Set_NoData(x, y);
-				}
-			}
-			else if( pROIs )
+			if( Get_Features(x, y, Features) )
 			{
-				for(int iROI=0; iROI<pROIs->Get_Count(); iROI++)
+				for(int iPolygon=0; iPolygon<pPolygons->Get_Count(); iPolygon++)
 				{
-					CSG_Simple_Statistics	*pClass;
-					CSG_Shape_Polygon		*pROI	= (CSG_Shape_Polygon *)pROIs->Get_Shape(iROI);
+					CSG_Shape_Polygon	*pPolygon	= (CSG_Shape_Polygon *)pPolygons->Get_Shape(iPolygon);
 
-					if( pROI->Contains(p) && (pClass = m_Classifier.Get_Statistics(pROI->asString(iROI_ID))) != NULL )
+					if( pPolygon->Contains(p) )
 					{
-						for(iGrid=0; iGrid<m_pGrids->Get_Count(); iGrid++)
-						{
-							pClass[iGrid].Add_Value(Get_Value(x, y, iGrid));
-						}
+						Classifier.Train_Add_Sample(pPolygon->asString(Field), Features);
 					}
 				}
 			}
@@ -451,118 +397,63 @@ bool CGrid_Classify_Supervised::Initialize(void)
 	}
 
 	//-----------------------------------------------------
-	if( m_Classifier.Get_Class_Count() <= 0 )
+	if( Classifier.Train(true) )
 	{
-		Error_Set(_TL("no training areas could be analysed."));
+		Classifier.Save(Parameters("FILE_SAVE")->asString());
 
-		return( false );
+		return( true );
 	}
 
-	return( true );
+	return( false );
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CGrid_Classify_Supervised::Finalize(void)
+bool CGrid_Classify_Supervised::Set_Classification(CSG_Classifier_Supervised &Classifier)
 {
-	int			iClass, iGrid, iOffset, nClasses;
-	CSG_String	Name_Method, Name_Quality;
-	CSG_Table	*pTable;
-
 	//-----------------------------------------------------
-	Name_Method		= CSG_Classifier_Supervised::Get_Name_of_Method (Parameters("METHOD")->asInt());
-	Name_Quality	= CSG_Classifier_Supervised::Get_Name_of_Quality(Parameters("METHOD")->asInt());
+	CSG_Grid	*pClasses	= Parameters("CLASSES")->asGrid();
 
 	//-----------------------------------------------------
-	pTable	= Parameters("CLASS_INFO")->asTable();
-
-	pTable->Destroy();
-	pTable->Set_Name(CSG_String::Format(SG_T("%s [%s]"), _TL("Class Information"), Name_Method.c_str()));
+	CSG_Parameter	*pLUT	= DataObject_Get_Parameter(pClasses, "LUT");
 
-	pTable->Add_Field(_TL("ID")   , SG_DATATYPE_String);	// CLASS_ID
-
-	for(iGrid=0; iGrid<m_pGrids->Get_Count(); iGrid++)
-	{
-		pTable->Add_Field(CSG_String::Format(SG_T("B%02d_MEAN")  , iGrid + 1), SG_DATATYPE_Double);	// CLASS_ROI_M
-		pTable->Add_Field(CSG_String::Format(SG_T("B%02d_STDDEV"), iGrid + 1), SG_DATATYPE_Double);	// CLASS_ROI_S
-	}
-
-	pTable->Add_Field(_TL("TOT_N"), SG_DATATYPE_Int);		// CLASS_TOT_N
-	pTable->Add_Field(_TL("ROI_N"), SG_DATATYPE_Int);		// CLASS_ROI_N
-
-	for(iClass=0; iClass<m_Classifier.Get_Class_Count(); iClass++)
+	if( pLUT && pLUT->asTable() )
 	{
-		CSG_Table_Record	*pRecord	= pTable->Add_Record();
-
-		pRecord->Set_Value(CLASS_ID   , m_Classifier.Get_Class_ID(iClass).c_str());
-
-		for(iGrid=0, iOffset=0; iGrid<m_Classifier.Get_Feature_Count(); iGrid++, iOffset+=CLASS_NPARMS)
+		for(int iClass=0; iClass<Classifier.Get_Class_Count(); iClass++)
 		{
-			CSG_Simple_Statistics	*pStatistics	= m_Classifier.Get_Statistics(iClass) + iGrid;
-
-			double	m	= m_bNormalise ? m_pGrids->asGrid(iGrid)->Get_Mean() : 0.0;
-			double	s	= m_bNormalise ? m_pGrids->asGrid(iGrid)->Get_StdDev()    : 1.0;
-
-			pRecord->Set_Value(iOffset + CLASS_ROI_M  , pStatistics->Get_Mean   () * s + m);
-			pRecord->Set_Value(iOffset + CLASS_ROI_S  , pStatistics->Get_StdDev () * s);
-		//	pRecord->Set_Value(iOffset + CLASS_ROI_MIN, pStatistics->Get_Minimum() * s + m);
-		//	pRecord->Set_Value(iOffset + CLASS_ROI_MAX, pStatistics->Get_Maximum() * s + m);
-		}
-
-		pRecord->Set_Value(CLASS_NPARMS * m_Classifier.Get_Feature_Count() + 1, m_Classifier.Get_Statistics(iClass)->Get_Count());
-		pRecord->Set_Value(CLASS_NPARMS * m_Classifier.Get_Feature_Count() + 2, m_Classifier.Get_Element_Count(iClass));
-	}
+			CSG_Table_Record	*pClass	= pLUT->asTable()->Get_Record(iClass);
 
-	//-----------------------------------------------------
-	CSG_Parameters	P;
-
-	if( DataObject_Get_Parameters(m_pClasses, P) && P("COLORS_TYPE") && P("LUT") )
-	{
-		pTable	= P("LUT")->asTable();
-
-		for(iClass=0, nClasses=0; iClass<m_Classifier.Get_Class_Count(); iClass++)
-		{
-			if( m_Classifier.Get_Element_Count(iClass) > 0 )
+			if( !pClass )
 			{
-				CSG_Table_Record	*pRecord	= pTable->Get_Record(nClasses++);
-
-				if( pRecord == NULL )
-				{
-					pRecord	= pTable->Add_Record();
-					pRecord->Set_Value(0, SG_GET_RGB(rand() * 255.0 / RAND_MAX, rand() * 255.0 / RAND_MAX, rand() * 255.0 / RAND_MAX));
-				}
-
-				pRecord->Set_Value(1, m_Classifier.Get_Class_ID(iClass).c_str());
-				pRecord->Set_Value(2, m_Classifier.Get_Class_ID(iClass).c_str());
-				pRecord->Set_Value(3, iClass + 1);
-				pRecord->Set_Value(4, iClass + 1);
+				(pClass	= pLUT->asTable()->Add_Record())->Set_Value(0, SG_Color_Get_Random());
 			}
-		}
 
-		while( pTable->Get_Record_Count() > m_Classifier.Get_Class_Count() )
-		{
-			pTable->Del_Record(pTable->Get_Record_Count() - 1);
+			pClass->Set_Value(1, Classifier.Get_Class_ID(iClass).c_str());
+			pClass->Set_Value(2, "");
+			pClass->Set_Value(3, iClass + 1);
+			pClass->Set_Value(4, iClass + 1);
 		}
 
-		P("COLORS_TYPE")->Set_Value(1);	// Color Classification Type: Lookup Table
+		pLUT->asTable()->Set_Record_Count(Classifier.Get_Class_Count());
 
-		DataObject_Set_Parameters(m_pClasses, P);
+		DataObject_Set_Parameter(pClasses, pLUT);
+		DataObject_Set_Parameter(pClasses, "COLORS_TYPE", 1);	// Color Classification Type: Lookup Table
 	}
 
+	pClasses->Set_Name(CSG_String::Format("%s [%s]", _TL("Classification"), CSG_Classifier_Supervised::Get_Name_of_Method(Parameters("METHOD")->asInt()).c_str()));
+
 	//-----------------------------------------------------
-	m_pClasses->Set_Name(CSG_String::Format(SG_T("%s [%s]"), _TL("Classification"), Name_Method.c_str()));
+	CSG_Grid	*pQuality	= Parameters("QUALITY")->asGrid();
 
-	if( m_pQuality )
+	if( pQuality )
 	{
-		m_pQuality->Set_Name(CSG_String::Format(SG_T("%s [%s]"), _TL("Classification Quality"), Name_Quality.c_str()));
+		DataObject_Set_Colors(pQuality, 11, SG_COLORS_YELLOW_GREEN);
 
-		DataObject_Set_Colors(m_pQuality, 100, SG_COLORS_WHITE_GREEN);
+		pQuality->Set_Name(CSG_String::Format("%s [%s]", _TL("Classification Quality"), CSG_Classifier_Supervised::Get_Name_of_Quality(Parameters("METHOD")->asInt()).c_str()));
 	}
 
 	//-----------------------------------------------------
diff --git a/src/modules/imagery/imagery_classification/classify_supervised.h b/src/modules/imagery/imagery_classification/classify_supervised.h
index 241699c..d2bbb61 100644
--- a/src/modules/imagery/imagery_classification/classify_supervised.h
+++ b/src/modules/imagery/imagery_classification/classify_supervised.h
@@ -88,26 +88,25 @@ public:
 
 protected:
 
-	virtual bool				On_Execute				(void);
-
 	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
 
+	virtual bool				On_Execute				(void);
+
 
 private:
 
 	bool						m_bNormalise;
 
-	CSG_Classifier_Supervised	m_Classifier;
-
-	CSG_Grid					*m_pClasses, *m_pQuality;
+	CSG_Parameter_Grid_List		*m_pFeatures;
 
-	CSG_Parameter_Grid_List		*m_pGrids;
 
+	bool						Get_Features			(void);
+	bool						Get_Features			(int x, int y, CSG_Vector &Features);
 
-	double						Get_Value				(int x, int y, int iGrid);
+	bool						Set_Classifier			(CSG_Classifier_Supervised &Classifier);
+	bool						Set_Classifier			(CSG_Classifier_Supervised &Classifier, CSG_Shapes *pPolygons, int Field);
 
-	bool						Initialize				(void);
-	bool						Finalize				(void);
+	bool						Set_Classification		(CSG_Classifier_Supervised &Classifier);
 
 };
 
diff --git a/src/modules/imagery/imagery_classification/classify_supervised_polygons.cpp b/src/modules/imagery/imagery_classification/classify_supervised_polygons.cpp
index fd6bfa7..b1f7c8f 100644
--- a/src/modules/imagery/imagery_classification/classify_supervised_polygons.cpp
+++ b/src/modules/imagery/imagery_classification/classify_supervised_polygons.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: classify_supervised_polygons.cpp 2104 2014-04-21 15:24:01Z reklov_w $
+ * Version $Id: classify_supervised_polygons.cpp 2452 2015-03-20 14:37:10Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -69,86 +69,103 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-enum
+CPolygon_Classify_Supervised::CPolygon_Classify_Supervised(bool bShapes)
 {
-	CLASS_ID	= 0,
-	CLASS_ROI_M,
-	CLASS_ROI_S,
-	CLASS_TOT_N,
-	CLASS_ROI_N
-};
+	m_bShapes	= bShapes;
 
-//---------------------------------------------------------
-#define CLASS_NPARMS	(CLASS_ROI_S - CLASS_ROI_M + 1)
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-CPolygon_Classify_Supervised::CPolygon_Classify_Supervised(void)
-{
+	//-----------------------------------------------------
+	int				i;
+	CSG_String		s;
 	CSG_Parameter	*pNode;
 
 	//-----------------------------------------------------
-	Set_Name		(_TL("Supervised Classification for Polygons"));
+	Set_Name		(m_bShapes
+		? _TL("Supervised Classification for Shapes")
+		: _TL("Supervised Classification for Tables")
+	);
 
-	Set_Author		(SG_T("O.Conrad (c) 2012"));
+	Set_Author		("O.Conrad (c) 2012");
 
 	Set_Description	(_TW(
-		"Supervised Classification"
+		"Supervised classification for attribute data. To train the classifier "
+		"choose an attribute that provides class identifiers for those records, "
+		"for which the target class is known, and no data for all other records."
 	));
 
 	//-----------------------------------------------------
-	pNode	= Parameters.Add_Shapes(
-		NULL	, "POLYGONS"		, _TL("Polygons"),
-		_TL(""),
-		PARAMETER_INPUT, SHAPE_TYPE_Polygon
-	);
+	if( m_bShapes )
+	{
+		pNode	= Parameters.Add_Shapes(
+			NULL	, "SHAPES"		, _TL("Shapes"),
+			_TL(""),
+			PARAMETER_INPUT
+		);
+
+		Parameters.Add_Shapes(
+			NULL	, "CLASSES"		, _TL("Classification"),
+			_TL(""),
+			PARAMETER_OUTPUT
+		);
+	}
+	else
+	{
+		pNode	= Parameters.Add_Table(
+			NULL	, "TABLE"		, _TL("Table"),
+			_TL(""),
+			PARAMETER_INPUT
+		);
+
+		Parameters.Add_Table(
+			NULL	, "CLASSES"		, _TL("Classification"),
+			_TL(""),
+			PARAMETER_OUTPUT
+		);
+	}
 
-	Parameters.Add_Table_Field(
-		pNode	, "CLASS_ID"		, _TL("Class Identifier"),
+	Parameters.Add_Table_Fields(
+		pNode	, "FEATURES"		, _TL("Features"),
 		_TL("")
 	);
 
-	Parameters.Add_Table_Fields(
-		pNode	, "FIELDS"		, _TL("Attributes"),
-		_TL("")
+	Parameters.Add_Value(
+		pNode	, "NORMALISE"		, _TL("Normalise"),
+		_TL(""),
+		PARAMETER_TYPE_Bool, false
 	);
 
-	Parameters.Add_Shapes(
-		NULL	, "CLASSES"			, _TL("Classification"),
+	Parameters.Add_Table_Field(
+		pNode	, "TRAINING"		, _TL("Training Classes"),
 		_TL(""),
-		PARAMETER_OUTPUT, SHAPE_TYPE_Polygon
+		true
 	);
 
-	Parameters.Add_Table(
-		NULL	, "CLASS_INFO"		, _TL("Summary"),
+	Parameters.Add_FilePath(
+		pNode	, "FILE_LOAD"		, _TL("Load Statistics from File..."),
 		_TL(""),
-		PARAMETER_OUTPUT
+		NULL, NULL, false
 	);
 
-	Parameters.Add_Choice(
-		NULL	, "METHOD"			, _TL("Method"),
+	Parameters.Add_FilePath(
+		NULL	, "FILE_SAVE"		, _TL("Save Statistics to File..."),
 		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			CSG_Classifier_Supervised::Get_Name_of_Method(SG_CLASSIFY_SUPERVISED_MinimumDistance).c_str(),
-			CSG_Classifier_Supervised::Get_Name_of_Method(SG_CLASSIFY_SUPERVISED_SAM).c_str()
-		), 0
+		NULL, NULL, true
 	);
 
-	Parameters.Add_Value(
-		NULL	, "NORMALISE"		, _TL("Normalise"),
+	//-----------------------------------------------------
+	for(i=0; i<=SG_CLASSIFY_SUPERVISED_WTA; i++)
+	{
+		s	+= CSG_Classifier_Supervised::Get_Name_of_Method(i) + "|";
+	}
+
+	Parameters.Add_Choice(
+		NULL	, "METHOD"			, _TL("Method"),
 		_TL(""),
-		PARAMETER_TYPE_Bool, false
+		s, SG_CLASSIFY_SUPERVISED_MinimumDistance
 	);
 
 	Parameters.Add_Value(
 		NULL	, "THRESHOLD_DIST"	, _TL("Distance Threshold"),
-		_TL("Let pixel stay unclassified, if minimum or mahalanobis distance is greater than threshold."),
+		_TL("Let pixel stay unclassified, if minimum euclidian or mahalanobis distance is greater than threshold."),
 		PARAMETER_TYPE_Double, 0.0, 0.0, true
 	);
 
@@ -157,266 +174,295 @@ CPolygon_Classify_Supervised::CPolygon_Classify_Supervised(void)
 		_TL("Let pixel stay unclassified, if spectral angle distance is greater than threshold."),
 		PARAMETER_TYPE_Double, 0.0, 0.0, true, 90.0, true
 	);
+
+	Parameters.Add_Value(
+		NULL	, "THRESHOLD_PROB"	, _TL("Probability Threshold"),
+		_TL("Let pixel stay unclassified, if maximum likelihood probability value is less than threshold."),
+		PARAMETER_TYPE_Double, 0.0, 0.0, true, 100.0, true
+	);
+
+	Parameters.Add_Choice(
+		NULL	, "RELATIVE_PROB"	, _TL("Probability Reference"),
+		_TL(""),
+		CSG_String::Format("%s|%s|",
+			_TL("absolute"),
+			_TL("relative")
+		), 1
+	);
+
+	pNode	= Parameters.Add_Node(
+		NULL	, "WTA"				, _TL("Winner Takes All"),
+		_TL("")
+	);
+
+	for(i=0; i<SG_CLASSIFY_SUPERVISED_WTA; i++)
+	{
+		Parameters.Add_Value(
+			pNode, CSG_String::Format("WTA_%d", i), CSG_Classifier_Supervised::Get_Name_of_Method(i), _TL(""),
+			PARAMETER_TYPE_Bool, false
+		);
+	}
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 int CPolygon_Classify_Supervised::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("METHOD")) )
+	if(	!SG_STR_CMP(pParameter->Get_Identifier(), "TRAINING") )
 	{
-		int	Value	= pParameter->asInt();
+		pParameters->Set_Enabled("FILE_LOAD", pParameter->asInt() <  0);
+		pParameters->Set_Enabled("FILE_SAVE", pParameter->asInt() >= 0);
+	}
 
-		pParameters->Get_Parameter("THRESHOLD_DIST" )->Set_Enabled(Value == 0);
-		pParameters->Get_Parameter("THRESHOLD_ANGLE")->Set_Enabled(Value == 1);
+	if(	!SG_STR_CMP(pParameter->Get_Identifier(), "METHOD") )
+	{
+		pParameters->Set_Enabled("THRESHOLD_DIST" , pParameter->asInt() == SG_CLASSIFY_SUPERVISED_MinimumDistance
+			||                                      pParameter->asInt() == SG_CLASSIFY_SUPERVISED_Mahalonobis      );
+		pParameters->Set_Enabled("THRESHOLD_PROB" , pParameter->asInt() == SG_CLASSIFY_SUPERVISED_MaximumLikelihood);
+		pParameters->Set_Enabled("RELATIVE_PROB"  , pParameter->asInt() == SG_CLASSIFY_SUPERVISED_MaximumLikelihood);
+		pParameters->Set_Enabled("THRESHOLD_ANGLE", pParameter->asInt() == SG_CLASSIFY_SUPERVISED_SAM              );
+		pParameters->Set_Enabled("WTA"            , pParameter->asInt() == SG_CLASSIFY_SUPERVISED_WTA              );
 	}
 
-	//-----------------------------------------------------
-	return( 1 );
+	return( CSG_Module::On_Parameters_Enable(pParameters, pParameter) );
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 bool CPolygon_Classify_Supervised::On_Execute(void)
 {
-	bool		bNoData;
-	int			Method, Class, i, iPolygon;
-	double		Quality;
+	//-----------------------------------------------------
+	if( !Get_Features() )
+	{
+		Error_Set(_TL("invalid features"));
 
-	//-------------------------------------------------
-	m_pPolygons		= Parameters("POLYGONS" )->asShapes();
-	m_Class_ID		= Parameters("CLASS_ID" )->asInt();
- 	m_pClasses		= Parameters("CLASSES"  )->asShapes();
-	m_bNormalise	= Parameters("NORMALISE")->asBool();
-	Method			= Parameters("METHOD"   )->asInt();
+		return( false );
+	}
 
-	m_Classifier.Set_Distance_Threshold   (Parameters("THRESHOLD_DIST" )->asDouble());
-	m_Classifier.Set_Angle_Threshold      (Parameters("THRESHOLD_ANGLE")->asDouble() * M_DEG_TO_RAD);
+	//-----------------------------------------------------
+	CSG_Classifier_Supervised	Classifier;
 
-	switch( Method )
+	if( !Set_Classifier(Classifier) )
 	{
-	default:
-	case  0:	Method	= SG_CLASSIFY_SUPERVISED_MinimumDistance;	break;
-	case  1:	Method	= SG_CLASSIFY_SUPERVISED_SAM;				break;
+		return( false );
 	}
 
 	//-------------------------------------------------
-	m_Features	= (int *)Parameters("FIELDS")->asPointer();
-	m_nFeatures	=        Parameters("FIELDS")->asInt    ();
+	CSG_Table	*pClasses	= Parameters("CLASSES")->asTable();
+
+	pClasses->Destroy();
 
-	if( !m_Features || m_nFeatures <= 0 )
+	if( m_bShapes )
 	{
-		Error_Set(_TL("no features in selection"));
+		CSG_Shapes	*pShapes	= (CSG_Shapes *)m_pTable;
 
-		return( false );
+		((CSG_Shapes *)pClasses)->Create(pShapes->Get_Type(), NULL, NULL, pShapes->Get_Vertex_Type());
 	}
 
-	//-------------------------------------------------
-	m_pClasses->Create(SHAPE_TYPE_Polygon, CSG_String::Format(SG_T("%s [%s]"), m_pPolygons->Get_Name(), _TL("Classified")), NULL, m_pPolygons->Get_Vertex_Type());
-	m_pClasses->Add_Field(_TL("CLASS_NR"), SG_DATATYPE_Int);
-	m_pClasses->Add_Field(_TL("CLASS_ID"), SG_DATATYPE_String);
-	m_pClasses->Add_Field(_TL("QUALITY" ), SG_DATATYPE_Double);
-
-	CSG_Vector	Features(m_nFeatures);
+	pClasses->Add_Field(_TL("CLASS_NR"), SG_DATATYPE_Int);
+	pClasses->Add_Field(_TL("CLASS_ID"), SG_DATATYPE_String);
+	pClasses->Add_Field(_TL("QUALITY" ), SG_DATATYPE_Double);
 
-	m_Classifier.Create (m_nFeatures);
+	//-------------------------------------------------
+	Process_Set_Text(_TL("prediction"));
 
-	//-----------------------------------------------------
-	Process_Set_Text(_TL("analyzing known classes"));
+	int	Method	= Parameters("METHOD")->asInt();
 
-	for(iPolygon=0; iPolygon<m_pPolygons->Get_Count() && Set_Progress(iPolygon, m_pPolygons->Get_Count()); iPolygon++)
+	for(int iRecord=0; iRecord<m_pTable->Get_Count() && Set_Progress(iRecord, m_pTable->Get_Count()); iRecord++)
 	{
-		CSG_Shape	*pPolygon	= m_pPolygons->Get_Shape(iPolygon);
+		int			Class;
+		double		Quality;
+		CSG_Vector	Features(m_nFeatures);
 
-		if( SG_STR_LEN(pPolygon->asString(m_Class_ID)) > 0 )
+		if( Get_Features(iRecord, Features) && Classifier.Get_Class(Features, Class, Quality, Method) )
 		{
-			for(i=0, bNoData=false; i<m_nFeatures && !bNoData; i++)
-			{
-				if( pPolygon->is_NoData(m_Features[i]) )
-				{
-					bNoData	= true;
-				}
-				else
-				{
-					Features[i]	= pPolygon->asDouble(m_Features[i]);
-
-					if( m_bNormalise )
-					{
-						Features[i]	= (Features[i] - m_pPolygons->Get_Mean(m_Features[i])) / m_pPolygons->Get_StdDev(m_Features[i]);
-					}
-				}
-			}
+			CSG_Table_Record	*pClass	= pClasses->Add_Record();
 
-			if( !bNoData )
-			{
-				CSG_Simple_Statistics	*pClass	= m_Classifier.Get_Statistics(pPolygon->asString(m_Class_ID));
+			pClass->Set_Value(0, 1 + Class);
+			pClass->Set_Value(1, Classifier.Get_Class_ID(Class));
+			pClass->Set_Value(2, Quality);
 
-				for(i=0; i<m_nFeatures; i++)
-				{
-					pClass[i].Add_Value(Features[i]);
-				}
+			if( m_bShapes )
+			{
+				((CSG_Shape	*)pClass)->Assign((CSG_Shape *)m_pTable->Get_Record(iRecord), false);
 			}
 		}
 	}
 
-	if( m_Classifier.Get_Class_Count() <= 0 )
-	{
-		Error_Set(_TL("no training areas could be analysed."));
+	//-----------------------------------------------------
+	return( Set_Classification(Classifier) );
+}
 
-		return( false );
-	}
 
-	//-------------------------------------------------
-	Process_Set_Text(_TL("running classification"));
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CPolygon_Classify_Supervised::Get_Features(void)
+{
+	m_pTable		= Parameters(m_bShapes ? "SHAPES" : "TABLE")->asTable();
+
+	m_Features		= (int *)Parameters("FEATURES" )->asPointer();
+	m_nFeatures		=        Parameters("FEATURES" )->asInt    ();
+	m_bNormalise	=        Parameters("NORMALISE")->asBool   ();
 
-	for(iPolygon=0; iPolygon<m_pPolygons->Get_Count() && Set_Progress(iPolygon, m_pPolygons->Get_Count()); iPolygon++)
+	return( m_Features && m_nFeatures > 0 );
+}
+
+//---------------------------------------------------------
+bool CPolygon_Classify_Supervised::Get_Features(int iRecord, CSG_Vector &Features)
+{
+	CSG_Table_Record	*pRecord	= m_pTable->Get_Record(iRecord);
+
+	if( !pRecord )
 	{
-		CSG_Shape	*pPolygon	= m_pPolygons->Get_Shape(iPolygon);
+		return( false );
+	}
 
-		for(i=0, bNoData=false; i<m_nFeatures && !bNoData; i++)
+	for(int i=0; i<m_nFeatures; i++)
+	{
+		if( pRecord->is_NoData(m_Features[i]) )
 		{
-			if( pPolygon->is_NoData(m_Features[i]) )
-			{
-				bNoData	= true;
-			}
-			else
-			{
-				Features[i]	= pPolygon->asDouble(m_Features[i]);
-
-				if( m_bNormalise )
-				{
-					Features[i]	= (Features[i] - m_pPolygons->Get_Mean(m_Features[i])) / m_pPolygons->Get_StdDev(m_Features[i]);
-				}
-			}
+			return( false );
 		}
 
-		if( !bNoData )
-		{
-			if( m_Classifier.Get_Class(Features, Class, Quality, Method) )
-			{
-				CSG_Shape	*pClass	= m_pClasses->Add_Shape(pPolygon);
+		Features[i]	= pRecord->asDouble(m_Features[i]);
 
-				pClass->Set_Value(0, 1 + Class);
-				pClass->Set_Value(1, m_Classifier.Get_Class_ID(Class));
-				pClass->Set_Value(2, Quality);
-			}
+		if( m_bNormalise && m_pTable->Get_StdDev(m_Features[i]) > 0.0 )
+		{
+			Features[i]	= (Features[i] - m_pTable->Get_Mean(m_Features[i])) / m_pTable->Get_StdDev(m_Features[i]);
 		}
 	}
 
-	//-----------------------------------------------------
-	Finalize();
-
-
 	return( true );
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CPolygon_Classify_Supervised::Finalize(void)
+bool CPolygon_Classify_Supervised::Set_Classifier(CSG_Classifier_Supervised &Classifier)
 {
-	int			iClass, iFeature, iOffset, nClasses;
-	CSG_String	Name_Method, Name_Quality;
-	CSG_Table	*pTable;
+	Classifier.Create(m_nFeatures);
 
-	//-----------------------------------------------------
-	Name_Method		= CSG_Classifier_Supervised::Get_Name_of_Method (Parameters("METHOD")->asInt());
-	Name_Quality	= CSG_Classifier_Supervised::Get_Name_of_Quality(Parameters("METHOD")->asInt());
+	Classifier.Set_Threshold_Distance   (Parameters("THRESHOLD_DIST" )->asDouble());
+	Classifier.Set_Threshold_Angle      (Parameters("THRESHOLD_ANGLE")->asDouble() * M_DEG_TO_RAD);
+	Classifier.Set_Threshold_Probability(Parameters("THRESHOLD_PROB" )->asDouble());
+	Classifier.Set_Probability_Relative (Parameters("RELATIVE_PROB"  )->asBool  ());
 
-	//-----------------------------------------------------
-	pTable	= Parameters("CLASS_INFO")->asTable();
-
-	pTable->Destroy();
-	pTable->Set_Name(CSG_String::Format(SG_T("%s [%s]"), _TL("Class Information"), Name_Method.c_str()));
+	for(int i=0; i<SG_CLASSIFY_SUPERVISED_WTA; i++)
+	{
+		Classifier.Set_WTA(i, Parameters(CSG_String::Format("WTA_%d", i))->asBool());
+	}
 
-	pTable->Add_Field(_TL("ID")   , SG_DATATYPE_String);	// CLASS_ID
+	//-----------------------------------------------------
+	if( Parameters("TRAINING")->asInt() >= 0 )	// training areas
+	{
+		if( !Set_Classifier(Classifier, Parameters("TRAINING")->asInt()) )
+		{
+			Error_Set(_TL("could not initialize classifier from training areas"));
 
-	for(iFeature=0; iFeature<m_Classifier.Get_Feature_Count(); iFeature++)
+			return( false );
+		}
+	}
+	else	// from file
 	{
-		pTable->Add_Field(CSG_String::Format(SG_T("B%02d_MEAN")  , iFeature + 1), SG_DATATYPE_Double);	// CLASS_ROI_M
-		pTable->Add_Field(CSG_String::Format(SG_T("B%02d_STDDEV"), iFeature + 1), SG_DATATYPE_Double);	// CLASS_ROI_S
+		if( !Classifier.Load(Parameters("FILE_LOAD")->asString()) )
+		{
+			Error_Set(_TL("could not initialize classifier from file"));
+
+			return( false );
+		}
 	}
 
-	pTable->Add_Field(_TL("TOT_N"), SG_DATATYPE_Int);		// CLASS_TOT_N
-	pTable->Add_Field(_TL("ROI_N"), SG_DATATYPE_Int);		// CLASS_ROI_N
+	//-----------------------------------------------------
+	Message_Add(Classifier.Print(), false);
 
-	for(iClass=0; iClass<m_Classifier.Get_Class_Count(); iClass++)
-	{
-		CSG_Table_Record	*pRecord	= pTable->Add_Record();
+	return( true );
+}
 
-		pRecord->Set_Value(CLASS_ID   , m_Classifier.Get_Class_ID(iClass).c_str());
+//---------------------------------------------------------
+bool CPolygon_Classify_Supervised::Set_Classifier(CSG_Classifier_Supervised &Classifier, int Training)
+{
+	//-----------------------------------------------------
+	Process_Set_Text(_TL("training"));
 
-		for(iFeature=0, iOffset=0; iFeature<m_Classifier.Get_Feature_Count(); iFeature++, iOffset+=CLASS_NPARMS)
-		{
-			CSG_Simple_Statistics	*pStatistics	= m_Classifier.Get_Statistics(iClass) + iFeature;
+	for(int iRecord=0; iRecord<m_pTable->Get_Count() && Set_Progress(iRecord, m_pTable->Get_Count()); iRecord++)
+	{
+		CSG_Table_Record	*pRecord	= m_pTable->Get_Record(iRecord);
 
-			double	m	= m_bNormalise ? m_pPolygons->Get_Mean  (m_Features[iFeature]) : 0.0;
-			double	s	= m_bNormalise ? m_pPolygons->Get_StdDev(m_Features[iFeature]) : 1.0;
+		if( SG_STR_LEN(pRecord->asString(Training)) > 0 )
+		{
+			CSG_Vector	Features(m_nFeatures);
 
-			pRecord->Set_Value(iOffset + CLASS_ROI_M  , pStatistics->Get_Mean   () * s + m);
-			pRecord->Set_Value(iOffset + CLASS_ROI_S  , pStatistics->Get_StdDev () * s);
-		//	pRecord->Set_Value(iOffset + CLASS_ROI_MIN, pStatistics->Get_Minimum() * s + m);
-		//	pRecord->Set_Value(iOffset + CLASS_ROI_MAX, pStatistics->Get_Maximum() * s + m);
+			if( Get_Features(iRecord, Features) )
+			{
+				Classifier.Train_Add_Sample(pRecord->asString(Training), Features);
+			}
 		}
+	}
 
-		pRecord->Set_Value(CLASS_NPARMS * m_Classifier.Get_Feature_Count() + 1, m_Classifier.Get_Statistics(iClass)->Get_Count());
-		pRecord->Set_Value(CLASS_NPARMS * m_Classifier.Get_Feature_Count() + 2, m_Classifier.Get_Element_Count(iClass));
+	//-----------------------------------------------------
+	if( Classifier.Train(true) )
+	{
+		Classifier.Save(Parameters("FILE_SAVE")->asString());
+
+		return( true );
 	}
 
+	return( false );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CPolygon_Classify_Supervised::Set_Classification(CSG_Classifier_Supervised &Classifier)
+{
 	//-----------------------------------------------------
-	CSG_Parameters	P;
+	CSG_Table	*pClasses	= Parameters("CLASSES")->asTable();
 
-	if( DataObject_Get_Parameters(m_pClasses, P) && P("COLORS_TYPE") && P("LUT") )
-	{
-		pTable	= P("LUT")->asTable();
+	CSG_Parameter	*pLUT	= DataObject_Get_Parameter(pClasses, "LUT");
 
-		for(iClass=0, nClasses=0; iClass<m_Classifier.Get_Class_Count(); iClass++)
+	if( pLUT && pLUT->asTable() )
+	{
+		for(int iClass=0; iClass<Classifier.Get_Class_Count(); iClass++)
 		{
-			if( m_Classifier.Get_Element_Count(iClass) > 0 )
+			CSG_Table_Record	*pClass	= pLUT->asTable()->Get_Record(iClass);
+
+			if( !pClass )
 			{
-				CSG_Table_Record	*pRecord	= pTable->Get_Record(nClasses++);
-
-				if( pRecord == NULL )
-				{
-					pRecord	= pTable->Add_Record();
-					pRecord->Set_Value(0, SG_GET_RGB(rand() * 255.0 / RAND_MAX, rand() * 255.0 / RAND_MAX, rand() * 255.0 / RAND_MAX));
-				}
-
-				pRecord->Set_Value(1, m_Classifier.Get_Class_ID(iClass).c_str());
-				pRecord->Set_Value(2, m_Classifier.Get_Class_ID(iClass).c_str());
-				pRecord->Set_Value(3, iClass + 1);
-				pRecord->Set_Value(4, iClass + 1);
+				(pClass	= pLUT->asTable()->Add_Record())->Set_Value(0, SG_Color_Get_Random());
 			}
-		}
 
-		while( pTable->Get_Record_Count() > m_Classifier.Get_Class_Count() )
-		{
-			pTable->Del_Record(pTable->Get_Record_Count() - 1);
+			pClass->Set_Value(1, Classifier.Get_Class_ID(iClass).c_str());
+			pClass->Set_Value(2, "");
+			pClass->Set_Value(3, iClass + 1);
+			pClass->Set_Value(4, iClass + 1);
 		}
 
-		P.Set_Parameter("COLORS_TYPE", 1);	// Color Classification Type: Lookup Table
-		P.Set_Parameter("LUT_ATTRIB" , 0);	// Lookup Table Attribute
+		pLUT->asTable()->Set_Record_Count(Classifier.Get_Class_Count());
 
-		DataObject_Set_Parameters(m_pClasses, P);
+		DataObject_Set_Parameter(pClasses, pLUT);
+		DataObject_Set_Parameter(pClasses, "COLORS_TYPE", 1);	// Color Classification Type: Lookup Table
+		DataObject_Set_Parameter(pClasses, "LUT_ATTRIB" , 0);	// Lookup Table Attribute
 	}
 
+	pClasses->Set_Name(CSG_String::Format("%s [%s]", m_pTable->Get_Name(), CSG_Classifier_Supervised::Get_Name_of_Method(Parameters("METHOD")->asInt()).c_str()));
+
 	//-----------------------------------------------------
 	return( true );
 }
diff --git a/src/modules/imagery/imagery_classification/classify_supervised_polygons.h b/src/modules/imagery/imagery_classification/classify_supervised_polygons.h
index 5ada73b..913ea4f 100644
--- a/src/modules/imagery/imagery_classification/classify_supervised_polygons.h
+++ b/src/modules/imagery/imagery_classification/classify_supervised_polygons.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: classify_supervised_polygons.h 2104 2014-04-21 15:24:01Z reklov_w $
+ * Version $Id: classify_supervised_polygons.h 2444 2015-03-18 19:56:49Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -81,28 +81,34 @@
 class CPolygon_Classify_Supervised : public CSG_Module
 {
 public:
-	CPolygon_Classify_Supervised(void);
+	CPolygon_Classify_Supervised(bool bShapes);
 
+	virtual CSG_String			Get_MenuPath			(void)	{	return( m_bShapes ? _TL("A:Shapes|Table") : _TL("A:Table|Tools") );	}
 
-protected:
 
-	virtual bool				On_Execute				(void);
+protected:
 
 	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
 
+	virtual bool				On_Execute				(void);
+
 
 private:
 
-	bool						m_bNormalise;
+	bool						m_bShapes, m_bNormalise;
+
+	int							*m_Features, m_nFeatures;
 
-	int							m_Class_ID, *m_Features, m_nFeatures;
+	CSG_Table					*m_pTable;
 
-	CSG_Classifier_Supervised	m_Classifier;
 
-	CSG_Shapes					*m_pPolygons, *m_pClasses;
+	bool						Get_Features			(void);
+	bool						Get_Features			(int iRecord, CSG_Vector &Features);
 
+	bool						Set_Classifier			(CSG_Classifier_Supervised &Classifier);
+	bool						Set_Classifier			(CSG_Classifier_Supervised &Classifier, int Training);
 
-	bool						Finalize				(void);
+	bool						Set_Classification		(CSG_Classifier_Supervised &Classifier);
 
 };
 
diff --git a/src/modules/simulation/sim_erosion/MLB_Interface.cpp b/src/modules/imagery/imagery_maxent/MLB_Interface.cpp
similarity index 79%
copy from src/modules/simulation/sim_erosion/MLB_Interface.cpp
copy to src/modules/imagery/imagery_maxent/MLB_Interface.cpp
index 59a2521..5a95965 100644
--- a/src/modules/simulation/sim_erosion/MLB_Interface.cpp
+++ b/src/modules/imagery/imagery_maxent/MLB_Interface.cpp
@@ -1,138 +1,129 @@
-/**********************************************************
- * Version $Id: MLB_Interface.cpp 1921 2014-01-09 10:24:11Z oconrad $
- *********************************************************/
-
-///////////////////////////////////////////////////////////
-//                                                       //
-//                         SAGA                          //
-//                                                       //
-//      System for Automated Geoscientific Analyses      //
-//                                                       //
-//                    Module Library:                    //
-//                      sim_erosion                      //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//                    MLB_Interface.h                    //
-//                                                       //
-//                 Copyright (C) 2003 by                 //
-//                      Olaf Conrad                      //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-// This file is part of 'SAGA - System for Automated     //
-// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
-//                                                       //
-// SAGA is distributed in the hope that it will be       //
-// useful, but WITHOUT ANY WARRANTY; without even the    //
-// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
-// PARTICULAR PURPOSE. See the GNU General Public        //
-// License for more details.                             //
-//                                                       //
-// You should have received a copy of the GNU General    //
-// Public License along with this program; if not,       //
-// write to the Free Software Foundation, Inc.,          //
-// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
-// USA.                                                  //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//    e-mail:     oconrad at saga-gis.org                   //
-//                                                       //
-//    contact:    Olaf Conrad                            //
-//                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
-//                Germany                                //
-//                                                       //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-
-///////////////////////////////////////////////////////////
-//														 //
-//			The Module Link Library Interface			 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-// 1. Include the appropriate SAGA-API header...
-
-#include "MLB_Interface.h"
-
-
-//---------------------------------------------------------
-// 2. Place general module library informations here...
-
-CSG_String Get_Info(int i)
-{
-	switch( i )
-	{
-	case MLB_INFO_Name:	default:
-		return(_TL("Erosion"));
-
+/**********************************************************
+ * Version $Id: MLB_Interface.cpp 911 2011-11-11 11:11:11Z oconrad $
+ *********************************************************/
+
+///////////////////////////////////////////////////////////
+//                                                       //
+//                         SAGA                          //
+//                                                       //
+//      System for Automated Geoscientific Analyses      //
+//                                                       //
+//                    Module Library:                    //
+//                    maximum_entropy                    //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//                   MLB_Interface.cpp                   //
+//                                                       //
+//                 Copyright (C) 2015 by                 //
+//                     Olaf Conrad                       //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+// This file is part of 'SAGA - System for Automated     //
+// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
+//                                                       //
+// SAGA is distributed in the hope that it will be       //
+// useful, but WITHOUT ANY WARRANTY; without even the    //
+// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
+// PARTICULAR PURPOSE. See the GNU General Public        //
+// License for more details.                             //
+//                                                       //
+// You should have received a copy of the GNU General    //
+// Public License along with this program; if not,       //
+// write to the Free Software Foundation, Inc.,          //
+// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
+// USA.                                                  //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//    e-mail:     oconrad at saga-gis.de                    //
+//                                                       //
+//    contact:    Olaf Conrad                            //
+//                Institute of Geography                 //
+//                University of Hamburg                  //
+//                Germany                                //
+//                                                       //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//			The Module Link Library Interface			 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+// 1. Include the appropriate SAGA-API header...
+
+#include "MLB_Interface.h"
+
+
+//---------------------------------------------------------
+// 2. Place general module library informations here...
+
+CSG_String Get_Info(int i)
+{
+	switch( i )
+	{
+	case MLB_INFO_Name:	default:
+		return( _TL("Maximum Entropy") );
+
 	case MLB_INFO_Category:
-		return( _TL("Simulation") );
-
-	case MLB_INFO_Author:
-		return(_TL("V. Wichmann, M. Setiawan (c) 2009-2012"));
-
-	case MLB_INFO_Description:
-		return(_TL("Modelling erosion processes."));
-
-	case MLB_INFO_Version:
-		return(_TL("1.0"));
-
-	case MLB_INFO_Menu_Path:
-		return(_TL("Simulation|Erosion"));
-	}
-}
-
-
-//---------------------------------------------------------
-// 3. Include the headers of your modules here...
-
-
-#include "MMF_SAGA.h"
-
-
-//---------------------------------------------------------
-// 4. Allow your modules to be created here...
-
-CSG_Module *		Create_Module(int i)
-{
-
-	CSG_Module	*pModule;
-
-	switch( i )
-	{
-	case 0:
-		pModule	= new CMMF_SAGA;
-		break;
-
-	default:
-		pModule	= NULL;
-		break;
-	}
-
-	return( pModule );
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-//{{AFX_SAGA
-
-	MLB_INTERFACE
-
-//}}AFX_SAGA
-
+		return( _TL("Imagery") );
+
+	case MLB_INFO_Author:
+		return( "O. Conrad (c) 2015" );
+
+	case MLB_INFO_Description:
+		return( _TL("Maximum entropy based classification and prediction.") );
+
+	case MLB_INFO_Version:
+		return( "1.0" );
+
+	case MLB_INFO_Menu_Path:
+		return( _TL("Maximum Entropy") );
+	}
+}
+
+
+//---------------------------------------------------------
+// 3. Include the headers of your modules here...
+
+#include "classify_grid.h"
+#include "presence_prediction.h"
+
+
+//---------------------------------------------------------
+// 4. Allow your modules to be created here...
+
+CSG_Module *		Create_Module(int i)
+{
+	switch( i )
+	{
+	case  0:	return( new CClassify_Grid );
+	case  1:	return( new CPresence_Prediction );
+
+	case  2:	return( NULL );
+	default:	return( MLB_INTERFACE_SKIP_MODULE );
+	}
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+//{{AFX_SAGA
+
+	MLB_INTERFACE
+
+//}}AFX_SAGA
diff --git a/src/modules/statistics/statistics_regression/MLB_Interface.h b/src/modules/imagery/imagery_maxent/MLB_Interface.h
similarity index 80%
copy from src/modules/statistics/statistics_regression/MLB_Interface.h
copy to src/modules/imagery/imagery_maxent/MLB_Interface.h
index 0612195..33d34a1 100644
--- a/src/modules/statistics/statistics_regression/MLB_Interface.h
+++ b/src/modules/imagery/imagery_maxent/MLB_Interface.h
@@ -1,57 +1,57 @@
 /**********************************************************
- * Version $Id: MLB_Interface.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: MLB_Interface.h 1938 2014-01-12 13:44:06Z reklov_w $
  *********************************************************/
-
-///////////////////////////////////////////////////////////
-//                                                       //
-//                         SAGA                          //
-//                                                       //
-//      System for Automated Geoscientific Analyses      //
-//                                                       //
-//                    Module Library:                    //
-//                 statistics_regression                 //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//                    MLB_Interface.h                    //
-//                                                       //
-//                 Copyright (C) 2003 by                 //
-//                      Olaf Conrad                      //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-// This file is part of 'SAGA - System for Automated     //
-// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
-//                                                       //
-// SAGA is distributed in the hope that it will be       //
-// useful, but WITHOUT ANY WARRANTY; without even the    //
-// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
-// PARTICULAR PURPOSE. See the GNU General Public        //
-// License for more details.                             //
-//                                                       //
-// You should have received a copy of the GNU General    //
-// Public License along with this program; if not,       //
-// write to the Free Software Foundation, Inc.,          //
-// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
-// USA.                                                  //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//    e-mail:     oconrad at saga-gis.org                   //
-//                                                       //
-//    contact:    Olaf Conrad                            //
-//                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
-//                Germany                                //
-//                                                       //
-///////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////
+//                                                       //
+//                         SAGA                          //
+//                                                       //
+//      System for Automated Geoscientific Analyses      //
+//                                                       //
+//                    Module Library:                    //
+//                    maximum_entropy                    //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//                   MLB_Interface.cpp                   //
+//                                                       //
+//                 Copyright (C) 2015 by                 //
+//                     Olaf Conrad                       //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+// This file is part of 'SAGA - System for Automated     //
+// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
+//                                                       //
+// SAGA is distributed in the hope that it will be       //
+// useful, but WITHOUT ANY WARRANTY; without even the    //
+// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
+// PARTICULAR PURPOSE. See the GNU General Public        //
+// License for more details.                             //
+//                                                       //
+// You should have received a copy of the GNU General    //
+// Public License along with this program; if not,       //
+// write to the Free Software Foundation, Inc.,          //
+// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
+// USA.                                                  //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//    e-mail:     oconrad at saga-gis.de                    //
+//                                                       //
+//    contact:    Olaf Conrad                            //
+//                Institute of Geography                 //
+//                University of Hamburg                  //
+//                Germany                                //
+//                                                       //
+///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
+#ifndef HEADER_INCLUDED__MLB_Interface_H
+#define HEADER_INCLUDED__MLB_Interface_H
 
 
 ///////////////////////////////////////////////////////////
@@ -61,10 +61,6 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#ifndef HEADER_INCLUDED__statistics_regression_H
-#define HEADER_INCLUDED__statistics_regression_H
-
-//---------------------------------------------------------
 #include <saga_api/saga_api.h>
 
 
@@ -75,4 +71,4 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED__statistics_regression_H
+#endif // #ifndef HEADER_INCLUDED__MLB_Interface_H
diff --git a/src/modules/imagery/imagery_maxent/Makefile.am b/src/modules/imagery/imagery_maxent/Makefile.am
new file mode 100644
index 0000000..c9132ab
--- /dev/null
+++ b/src/modules/imagery/imagery_maxent/Makefile.am
@@ -0,0 +1,30 @@
+if DEBUG
+DBGFLAGS = -g -DDEBUG
+endif
+if SAGA_UNICODE
+UC_DEFS = -D_SAGA_UNICODE
+endif
+DEF_SAGA           = -D_SAGA_LINUX -D_TYPEDEF_BYTE -D_TYPEDEF_WORD
+CXX_INCS           = -I$(top_srcdir)/src/saga_core
+AM_CXXFLAGS        = -fPIC $(CXX_INCS) $(DEF_SAGA) $(UC_DEFS) $(DBGFLAGS) $(GOMPFLAGS)
+AM_LDFLAGS         = -fPIC -shared -avoid-version
+pkglib_LTLIBRARIES = libimagery_maxent.la
+libimagery_maxent_la_SOURCES =\
+classify_grid.cpp\
+lbfgs.cpp\
+maxent.cpp\
+me.cpp\
+MLB_Interface.cpp\
+owlqn.cpp\
+presence_prediction.cpp\
+sgd.cpp\
+classify_grid.h\
+lbfgs.h\
+mathvec.h\
+maxent.h\
+me.h\
+MLB_Interface.h\
+presence_prediction.h
+
+libimagery_maxent_la_LIBADD = $(top_srcdir)/src/saga_core/saga_api/libsaga_api.la
+
diff --git a/src/modules/imagery/imagery_svm/Makefile.in b/src/modules/imagery/imagery_maxent/Makefile.in
similarity index 90%
copy from src/modules/imagery/imagery_svm/Makefile.in
copy to src/modules/imagery/imagery_maxent/Makefile.in
index d272772..3b43ed8 100644
--- a/src/modules/imagery/imagery_svm/Makefile.in
+++ b/src/modules/imagery/imagery_maxent/Makefile.in
@@ -78,7 +78,7 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-subdir = src/modules/imagery/imagery_svm
+subdir = src/modules/imagery/imagery_maxent
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
 	$(top_srcdir)/depcomp
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -125,10 +125,11 @@ am__uninstall_files_from_dir = { \
   }
 am__installdirs = "$(DESTDIR)$(pkglibdir)"
 LTLIBRARIES = $(pkglib_LTLIBRARIES)
-libimagery_svm_la_DEPENDENCIES =  \
+libimagery_maxent_la_DEPENDENCIES =  \
 	$(top_srcdir)/src/saga_core/saga_api/libsaga_api.la
-am_libimagery_svm_la_OBJECTS = MLB_Interface.lo svm.lo svm_grids.lo
-libimagery_svm_la_OBJECTS = $(am_libimagery_svm_la_OBJECTS)
+am_libimagery_maxent_la_OBJECTS = classify_grid.lo lbfgs.lo maxent.lo \
+	me.lo MLB_Interface.lo owlqn.lo presence_prediction.lo sgd.lo
+libimagery_maxent_la_OBJECTS = $(am_libimagery_maxent_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
 am__v_lt_0 = --silent
@@ -185,8 +186,8 @@ AM_V_CCLD = $(am__v_CCLD_ at AM_V@)
 am__v_CCLD_ = $(am__v_CCLD_ at AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
-SOURCES = $(libimagery_svm_la_SOURCES)
-DIST_SOURCES = $(libimagery_svm_la_SOURCES)
+SOURCES = $(libimagery_maxent_la_SOURCES)
+DIST_SOURCES = $(libimagery_maxent_la_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -365,16 +366,25 @@ DEF_SAGA = -D_SAGA_LINUX -D_TYPEDEF_BYTE -D_TYPEDEF_WORD
 CXX_INCS = -I$(top_srcdir)/src/saga_core
 AM_CXXFLAGS = -fPIC $(CXX_INCS) $(DEF_SAGA) $(UC_DEFS) $(DBGFLAGS) $(GOMPFLAGS)
 AM_LDFLAGS = -fPIC -shared -avoid-version
-pkglib_LTLIBRARIES = libimagery_svm.la
-libimagery_svm_la_SOURCES = \
+pkglib_LTLIBRARIES = libimagery_maxent.la
+libimagery_maxent_la_SOURCES = \
+classify_grid.cpp\
+lbfgs.cpp\
+maxent.cpp\
+me.cpp\
 MLB_Interface.cpp\
-svm.cpp\
-svm_grids.cpp\
+owlqn.cpp\
+presence_prediction.cpp\
+sgd.cpp\
+classify_grid.h\
+lbfgs.h\
+mathvec.h\
+maxent.h\
+me.h\
 MLB_Interface.h\
-svm.h\
-svm_grids.h
+presence_prediction.h
 
-libimagery_svm_la_LIBADD = $(top_srcdir)/src/saga_core/saga_api/libsaga_api.la
+libimagery_maxent_la_LIBADD = $(top_srcdir)/src/saga_core/saga_api/libsaga_api.la
 all: all-am
 
 .SUFFIXES:
@@ -388,9 +398,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/modules/imagery/imagery_svm/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/modules/imagery/imagery_maxent/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign src/modules/imagery/imagery_svm/Makefile
+	  $(AUTOMAKE) --foreign src/modules/imagery/imagery_maxent/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -445,8 +455,8 @@ clean-pkglibLTLIBRARIES:
 	  rm -f $${locs}; \
 	}
 
-libimagery_svm.la: $(libimagery_svm_la_OBJECTS) $(libimagery_svm_la_DEPENDENCIES) $(EXTRA_libimagery_svm_la_DEPENDENCIES) 
-	$(AM_V_CXXLD)$(CXXLINK) -rpath $(pkglibdir) $(libimagery_svm_la_OBJECTS) $(libimagery_svm_la_LIBADD) $(LIBS)
+libimagery_maxent.la: $(libimagery_maxent_la_OBJECTS) $(libimagery_maxent_la_DEPENDENCIES) $(EXTRA_libimagery_maxent_la_DEPENDENCIES) 
+	$(AM_V_CXXLD)$(CXXLINK) -rpath $(pkglibdir) $(libimagery_maxent_la_OBJECTS) $(libimagery_maxent_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -455,26 +465,34 @@ distclean-compile:
 	-rm -f *.tab.c
 
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MLB_Interface.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/svm.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/svm_grids.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/classify_grid.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lbfgs.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/maxent.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/me.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/owlqn.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/presence_prediction.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sgd.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/imagery/imagery_maxent/classify_grid.cpp b/src/modules/imagery/imagery_maxent/classify_grid.cpp
new file mode 100644
index 0000000..c89b294
--- /dev/null
+++ b/src/modules/imagery/imagery_maxent/classify_grid.cpp
@@ -0,0 +1,771 @@
+/**********************************************************
+ * Version $Id: template.cpp 911 2011-11-11 11:11:11Z oconrad $
+ *********************************************************/
+
+///////////////////////////////////////////////////////////
+//                                                       //
+//                         SAGA                          //
+//                                                       //
+//      System for Automated Geoscientific Analyses      //
+//                                                       //
+//                    Module Library:                    //
+//                        maxent                         //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//                   classify_grid.cpp                   //
+//                                                       //
+//                 Copyright (C) 2015 by                 //
+//                     Olaf Conrad                       //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+// This file is part of 'SAGA - System for Automated     //
+// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
+//                                                       //
+// SAGA is distributed in the hope that it will be       //
+// useful, but WITHOUT ANY WARRANTY; without even the    //
+// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
+// PARTICULAR PURPOSE. See the GNU General Public        //
+// License for more details.                             //
+//                                                       //
+// You should have received a copy of the GNU General    //
+// Public License along with this program; if not,       //
+// write to the Free Software Foundation, Inc.,          //
+// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
+// USA.                                                  //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//    e-mail:     oconrad at saga-gis.de                    //
+//                                                       //
+//    contact:    Olaf Conrad                            //
+//                Institute of Geography                 //
+//                University of Hamburg                  //
+//                Germany                                //
+//                                                       //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#include "classify_grid.h"
+
+//---------------------------------------------------------
+#include "me.h"
+
+//---------------------------------------------------------
+using namespace std;
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+CClassify_Grid::CClassify_Grid(void)
+{
+	CSG_Parameter	*pNode;
+
+	//-----------------------------------------------------
+	Set_Name		(_TL("Maximum Entropy Classifcation"));
+
+	Set_Author		("O.Conrad (c) 2015");
+
+	Set_Description	(_TW(
+		"\nReferences:\n"
+		"- Yoshimasa Tsuruoka: A simple C++ library for maximum entropy classification. "
+		" <a target=\"_blank\" href=\"http://www.logos.t.u-tokyo.ac.jp/~tsuruoka/maxent/\">online</a>.\n"
+		"- Dekang Lin: A MaxEnt Package in C++. "
+		" <a target=\"_blank\" href=\"http://webdocs.cs.ualberta.ca/~lindek/downloads.htm\">online</a>.\n"
+	));
+
+	//-----------------------------------------------------
+	pNode	= Parameters.Add_Shapes(
+		NULL	, "TRAINING"		, _TL("Training Areas"),
+		_TL(""),
+		PARAMETER_INPUT, SHAPE_TYPE_Polygon
+	);
+
+	Parameters.Add_Table_Field(
+		pNode	, "FIELD"			, _TL("Class Name"),
+		_TL("")
+	);
+
+	Parameters.Add_Grid_List(
+		NULL	, "FEATURES_NUM"	, _TL("Numerical Features"),
+		_TL(""),
+		PARAMETER_INPUT_OPTIONAL
+	);
+
+	Parameters.Add_Grid_List(
+		NULL	, "FEATURES_CAT"	, _TL("Categorical Features"),
+		_TL(""),
+		PARAMETER_INPUT_OPTIONAL
+	);
+
+	Parameters.Add_Grid(
+		NULL	, "CLASSES"			, _TL("Classes"),
+		_TL(""),
+		PARAMETER_OUTPUT, true, SG_DATATYPE_Short
+	);
+
+	Parameters.Add_Grid(
+		NULL	, "PROB"			, _TL("Probability"),
+		_TL(""),
+		PARAMETER_OUTPUT
+	);
+
+	Parameters.Add_Grid_List(
+		NULL	, "PROBS"			, _TL("Probabilities"),
+		_TL(""),
+		PARAMETER_OUTPUT
+	);
+
+	Parameters.Add_Value(
+		NULL	, "PROBS_CREATE"	, _TL("Create Propabilities"),
+		_TL(""),
+		PARAMETER_TYPE_Bool, false
+	);
+
+	//-----------------------------------------------------
+	Parameters.Add_Choice(
+		NULL	, "METHOD"			, _TL("Method"),
+		_TL(""),
+		CSG_String::Format("%s|%s|",
+			_TL("Yoshimasa Tsuruoka"),
+			_TL("Dekang Lin")
+		)
+	);
+
+	//-----------------------------------------------------
+	Parameters.Add_FilePath(
+		NULL	, "YT_FILE_LOAD"	, _TL("Load from File..."),
+		_TL(""),
+		NULL, NULL, false
+	);
+
+	Parameters.Add_FilePath(
+		NULL	, "YT_FILE_SAVE"	, _TL("Save to File..."),
+		_TL(""),
+		NULL, NULL, true
+	);
+
+	pNode	= Parameters.Add_Choice(
+		NULL	, "YT_REGUL"		, _TL("Regularization"),
+		_TL(""),
+		CSG_String::Format(SG_T("%s|%s|%s|"),
+			_TL("none"),
+			SG_T("L1"),
+			SG_T("L2")
+		), 1
+	);
+
+	Parameters.Add_Value(
+		pNode	, "YT_REGUL_VAL"	, _TL("Regularization Factor"),
+		_TL(""),
+		PARAMETER_TYPE_Double, 1.0, 0.0, true
+	);
+
+	Parameters.Add_Value(
+		NULL	, "YT_NUMASREAL"	, _TL("Real-valued Numerical Features"),
+		_TL(""),
+		PARAMETER_TYPE_Bool, true
+	);
+
+	//-----------------------------------------------------
+	Parameters.Add_Value(
+		NULL	, "DL_ALPHA"		, _TL("Alpha"),
+		_TL(""),
+		PARAMETER_TYPE_Double, 0.1
+	);
+
+	Parameters.Add_Value(
+		NULL	, "DL_THRESHOLD"	, _TL("Threshold"),
+		_TL(""),
+		PARAMETER_TYPE_Double, 0.0, 0.0, true
+	);
+
+	Parameters.Add_Value(
+		NULL	, "DL_ITERATIONS"	, _TL("Maximum Iterations"),
+		_TL(""),
+		PARAMETER_TYPE_Int, 100, 1, true
+	);
+
+	//-----------------------------------------------------
+	Parameters.Add_Value(
+		NULL	, "NUM_CLASSES"		, _TL("Number of Numeric Value Classes"),
+		_TL(""),
+		PARAMETER_TYPE_Int, 32, 1, true
+	);
+
+	Parameters.Add_Value(
+		NULL	, "PROB_MIN"		, _TL("Minimum Probability"),
+		_TL("Minimum probability to accept a classification result for a cell."),
+		PARAMETER_TYPE_Double, 0.0, 0.0, true, 1.0, true
+	);
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+int CClassify_Grid::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+{
+	bool	bFile	= SG_File_Exists(pParameters->Get_Parameter("YT_FILE_LOAD")->asString());
+	int		Method	= pParameters->Get_Parameter("METHOD")->asInt();
+
+	pParameters->Set_Enabled("NUM_CLASSES"  , Method == 1 || !pParameters->Get_Parameter("YT_NUMASREAL")->asBool());
+
+	pParameters->Set_Enabled("TRAINING"     , Method == 1 || !bFile);
+
+	pParameters->Set_Enabled("YT_REGUL"     , Method == 0 && !bFile);
+	pParameters->Set_Enabled("YT_REGUL_VAL" , Method == 0 && !bFile);
+	pParameters->Set_Enabled("YT_FILE_SAVE" , Method == 0 && !bFile);
+	pParameters->Set_Enabled("YT_FILE_LOAD" , Method == 0);
+	pParameters->Set_Enabled("YT_NUMASREAL" , Method == 0);
+
+	pParameters->Set_Enabled("DL_ALPHA"     , Method == 1);
+	pParameters->Set_Enabled("DL_THRESHOLD" , Method == 1);
+	pParameters->Set_Enabled("DL_ITERATIONS", Method == 1);
+
+	return( 1 );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CClassify_Grid::On_Execute(void)
+{
+	//-----------------------------------------------------
+	EventSet	DL_Events ;	m_DL_Events  = &DL_Events ;
+	GISTrainer	DL_Trainer;	m_DL_Trainer = &DL_Trainer;
+	MaxEntModel	DL_Model  ;	m_DL_Model   = &DL_Model  ;
+
+	m_YT_Model.clear();
+
+	//-----------------------------------------------------
+	CSG_Grid	*pClasses	= Parameters("CLASSES")->asGrid();
+	CSG_Grid	*pProb		= Parameters("PROB"   )->asGrid();
+
+	m_pProbs		= Parameters("PROBS_CREATE")->asBool() ? Parameters("PROBS")->asGridList() : NULL;
+	m_Method		= Parameters("METHOD"      )->asInt ();
+	m_nNumClasses	= Parameters("NUM_CLASSES" )->asInt ();
+	m_bYT_Weights	= Parameters("YT_NUMASREAL")->asBool();
+
+	//-----------------------------------------------------
+	CSG_Array	Features;
+
+	if( !Get_Features(Features) )
+	{
+		Error_Set(_TL("invalid features"));
+
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	if( m_Method == 0 && SG_File_Exists(Parameters("YT_FILE_LOAD")->asString()) )
+	{
+		if( !Get_File(Parameters("YT_FILE_LOAD")->asString()) )
+		{
+			return( false );
+		}
+	}
+	else if( !Get_Training() )
+	{
+		return( false );
+	}
+
+	pClasses->Set_NoData_Value(-1);
+
+	if( !pProb->Get_ZRange() )	DataObject_Set_Colors(pProb, 11, SG_COLORS_YELLOW_GREEN);
+
+	//-----------------------------------------------------
+	Process_Set_Text(_TL("prediction"));
+
+	double	minProb	= Parameters("PROB_MIN")->asDouble();
+
+	for(int y=0; y<Get_NY() && Set_Progress(y); y++)
+	{
+		#pragma omp parallel for
+		for(int x=0; x<Get_NX(); x++)
+		{
+			int			i;
+			CSG_Strings	Values;
+
+			for(i=0; i<m_nFeatures; i++)
+			{
+				if( !m_Features[i].pGrid->is_NoData(x, y) )
+				{
+					Values.Add(Get_Feature(x, y, i));
+				}
+				else
+				{
+					break;
+				}
+			}
+
+			if( Values.Get_Count() != m_nFeatures )
+			{
+				pClasses->Set_NoData(x, y);
+
+				for(i=0; m_pProbs && i<m_pProbs->Get_Count(); i++)
+				{
+					m_pProbs->asGrid(i)->Set_NoData(x, y);
+				}
+			}
+			else switch( m_Method )
+			{
+			//---------------------------------------------
+			default:	// Kyoshida
+				{
+					ME_Sample	Sample;
+
+					for(i=0; i<m_nFeatures; i++)
+					{
+						if( m_bYT_Weights && m_Features[i].bNumeric )
+						{
+							Sample.add_feature(m_Features[i].Name, m_Features[i].pGrid->asDouble(x, y));
+						}
+						else
+						{
+							Sample.add_feature(Values[i].b_str());
+						}
+					}
+
+					vector<double> Probs	= m_YT_Model.classify(Sample);
+
+					pProb   ->Set_Value(x, y, Probs[i = m_YT_Model.get_class_id(Sample.label)]);
+					pClasses->Set_Value(x, y, Probs[i] >= minProb ? i : -1);
+
+					for(i=0; m_pProbs && i<m_pProbs->Get_Count() && i<(int)Probs.size(); i++)
+					{
+						m_pProbs->asGrid(i)->Set_Value(x, y, Probs[i]);
+					}
+				}
+				break;
+
+			//---------------------------------------------
+			case  1:	// Dekang Lin
+				{
+					MaxEntEvent Event;	Event.count(1);
+
+					for(i=0; i<m_nFeatures; i++)
+					{
+						Event.push_back(m_DL_Trainer->getId(Values[i].b_str()));
+					}
+
+					vector<double> Probs;
+
+					pProb   ->Set_Value(x, y, Probs[i = m_DL_Model->getProbs(Event, Probs)]);
+					pClasses->Set_Value(x, y, Probs[i] >= minProb ? i : -1);
+
+					for(i=0; m_pProbs && i<m_pProbs->Get_Count() && i<(int)Probs.size(); i++)
+					{
+						m_pProbs->asGrid(i)->Set_Value(x, y, Probs[i]);
+					}
+				}
+				break;
+			}
+		}
+	}
+
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+CSG_String CClassify_Grid::Get_Feature(int x, int y, int i)
+{
+	CSG_Grid	*pFeature	= m_Features[i].pGrid;
+
+	if( m_nNumClasses > 1 && m_Features[i].bNumeric )
+	{
+		return( CSG_String::Format("%d", (int)(m_nNumClasses * (pFeature->asDouble(x, y) - pFeature->Get_ZMin()) / pFeature->Get_ZRange())) );
+	}
+
+	return( SG_Get_String(pFeature->asDouble(x, y), -2) );
+}
+
+//---------------------------------------------------------
+bool CClassify_Grid::Get_Features(CSG_Array &Features)
+{
+	CSG_Parameter_Grid_List	*pNum	= Parameters("FEATURES_NUM")->asGridList();
+	CSG_Parameter_Grid_List	*pCat	= Parameters("FEATURES_CAT")->asGridList();
+
+	m_Features	= (TFeature *)Features.Create(sizeof(TFeature), m_nFeatures = pNum->Get_Count() + pCat->Get_Count());
+
+	for(int i=0; i<m_nFeatures; i++)
+	{
+		if( i < pNum->Get_Count() )
+		{
+			m_Features[i].bNumeric	= true;
+			m_Features[i].pGrid		= pNum->asGrid(i);
+		}
+		else
+		{
+			m_Features[i].bNumeric	= false;
+			m_Features[i].pGrid		= pCat->asGrid(i - pNum->Get_Count());
+		}
+
+		CSG_String	Name(m_Features[i].pGrid->Get_Name());
+		strncpy(m_Features[i].Name, Name.b_str(), 255);	m_Features[i].Name[255]	= '\0';
+	}
+
+	return( m_nFeatures > 0 );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CClassify_Grid::Get_Training(void)
+{
+	//-----------------------------------------------------
+	CSG_Shapes	*pTraining	= Parameters("TRAINING")->asShapes();
+	int			Field		= Parameters("FIELD"   )->asInt   ();
+
+	if( pTraining->Get_Count() <= 0 )
+	{
+		Error_Set(_TL("invalid training data"));
+
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	int				nClasses	= 0;
+	CSG_String		Name;
+	CSG_Parameter	*pLUT	= DataObject_Get_Parameter(Parameters("CLASSES")->asGrid(), "LUT");
+
+	pTraining->Set_Index(Field, TABLE_INDEX_Ascending);
+
+	for(int i=0; i<pTraining->Get_Count(); i++)
+	{
+		CSG_Shape	*pArea	= pTraining->Get_Shape_byIndex(i);
+
+		if( i == 0 || Name.Cmp(pArea->asString(Field)) )
+		{
+			Name	= pTraining->Get_Shape_byIndex(i)->asString(Field);
+
+			if( m_pProbs )
+			{
+				CSG_Grid	*pGrid	= m_pProbs->asGrid(i);
+
+				if( !pGrid )
+				{
+					m_pProbs->Add_Item(pGrid = SG_Create_Grid(*Get_System()));
+
+					DataObject_Set_Colors(pGrid, 11, SG_COLORS_YELLOW_GREEN);
+				}
+
+				pGrid->Set_Name(Name);
+			}
+
+			if( pLUT && pLUT->asTable() )
+			{
+				CSG_Table_Record	*pClass	= pLUT->asTable()->Get_Record(nClasses);
+
+				if( !pClass )
+				{
+					(pClass	= pLUT->asTable()->Add_Record())->Set_Value(0, SG_Color_Get_Random());
+				}
+
+				pClass->Set_Value(1, Name);
+				pClass->Set_Value(3, nClasses);
+				pClass->Set_Value(4, nClasses);
+			}
+
+			if( m_Method == 1 )	// Dekang Lin
+			{
+				m_DL_Trainer->addClass(Name.b_str());
+			}
+
+			nClasses++;
+		}
+
+		Get_Training(Name, (CSG_Shape_Polygon *)pArea);
+	}
+
+	if( nClasses <= 1 )
+	{
+		Error_Set(_TL("only one class in training data"));
+
+		return( false );
+	}
+
+	if( pLUT && pLUT->asTable() )
+	{
+		pLUT->asTable()->Set_Record_Count(nClasses);
+
+		DataObject_Set_Parameter(Parameters("CLASSES")->asGrid(), pLUT);
+		DataObject_Set_Parameter(Parameters("CLASSES")->asGrid(), "COLORS_TYPE", 1);	// Color Classification Type: Lookup Table
+	}
+
+	//-----------------------------------------------------
+	Process_Set_Text(_TL("training"));
+
+	switch( m_Method )
+	{
+	//-----------------------------------------------------
+	default:	// Kyoshida
+		switch( Parameters("YT_REGUL")->asInt() )
+		{
+		default:
+			m_YT_Model.use_l1_regularizer(0.0);
+			m_YT_Model.use_l2_regularizer(0.0);
+			break;
+
+		case  1:
+			m_YT_Model.use_l1_regularizer(Parameters("YT_REGUL_VAL")->asDouble());
+			m_YT_Model.use_l2_regularizer(0.0);
+			break;
+
+		case  2:
+			m_YT_Model.use_l1_regularizer(0.0);
+			m_YT_Model.use_l2_regularizer(Parameters("YT_REGUL_VAL")->asDouble());
+			break;
+		}
+
+	//	m_YT_Model.use_SGD(Parameters("SGD_ITER")->asInt());
+
+		m_YT_Model.train();
+
+		{
+		/*	list< pair< pair<string, string>, double > > Features;
+
+			m_YT_Model.get_features(Features);
+
+			for(list< pair< pair<string, string>, double> >::const_iterator i=Features.begin(); i!=Features.end(); i++)
+			{
+				Message_Add(CSG_String::Format("\n%10.3f  %-10s %s",
+					i->second, i->first.first.c_str(), i->first.second.c_str()
+				), false);
+			}/**/
+
+			CSG_String	File(Parameters("YT_FILE_SAVE")->asString());
+
+			if( !File.is_Empty() )
+			{
+				m_YT_Model.save_to_file(File.b_str());
+			}
+		}
+		break;
+
+	//-----------------------------------------------------
+	case  1:	// Dekang Lin
+		m_DL_Trainer->printDetails(true);	// show the parameters during training
+
+		m_DL_Trainer->Set_Alpha     (Parameters("DL_ALPHA"     )->asDouble());
+		m_DL_Trainer->Set_Threshold (Parameters("DL_THRESHOLD" )->asDouble());
+		m_DL_Trainer->Set_Iterations(Parameters("DL_ITERATIONS")->asInt());
+
+		m_DL_Model->classes(m_DL_Trainer->classes().size());
+
+		m_DL_Trainer->train(*m_DL_Model, *m_DL_Events);	// train the model
+
+		break;
+	}
+
+	//-----------------------------------------------------
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+void CClassify_Grid::Get_Training(const CSG_String &ID, CSG_Shape_Polygon *pArea)
+{
+	int	xMin	= Get_System()->Get_xWorld_to_Grid(pArea->Get_Extent().Get_XMin());
+	int	xMax	= Get_System()->Get_xWorld_to_Grid(pArea->Get_Extent().Get_XMax());
+	int	yMin	= Get_System()->Get_yWorld_to_Grid(pArea->Get_Extent().Get_YMin());
+	int	yMax	= Get_System()->Get_yWorld_to_Grid(pArea->Get_Extent().Get_YMax());
+
+	if( xMin < 0 ) xMin = 0; else if( xMin >= Get_NX() ) xMin = Get_NX() - 1;
+	if( xMax < 0 ) xMax = 0; else if( xMax >= Get_NX() ) xMax = Get_NX() - 1;
+	if( yMin < 0 ) yMin = 0; else if( yMin >= Get_NY() ) yMin = Get_NY() - 1;
+	if( yMax < 0 ) yMax = 0; else if( yMax >= Get_NY() ) yMax = Get_NY() - 1;
+
+	//-----------------------------------------------------
+	for(int y=yMin; y<=yMax; y++)
+	{
+		for(int x=xMin; x<=xMax; x++)
+		{
+			if( pArea->Contains(Get_System()->Get_Grid_to_World(x, y)) )
+			{
+				int			i;
+				CSG_Strings	Values;
+
+				for(i=0; i<m_nFeatures; i++)
+				{
+					if( !m_Features[i].pGrid->is_NoData(x, y) )
+					{
+						Values.Add(Get_Feature(x, y, i));
+					}
+					else
+					{
+						break;
+					}
+				}
+
+				if( Values.Get_Count() == m_nFeatures )
+				{
+					switch( m_Method )
+					{
+					default:	// Kyoshida
+						{
+							ME_Sample	Sample(ID.b_str());
+
+							for(i=0; i<m_nFeatures; i++)
+							{
+								if( m_bYT_Weights && m_Features[i].bNumeric )
+								{
+									Sample.add_feature(m_Features[i].Name, m_Features[i].pGrid->asDouble(x, y));
+								}
+								else
+								{
+									Sample.add_feature(Values[i].b_str());
+								}
+							}
+
+							m_YT_Model.add_training_sample(Sample);
+						}
+						break;
+
+					case  1:	// Dekang Lin
+						{
+							MaxEntEvent	*pEvent	= new MaxEntEvent;
+
+							pEvent->count(1);
+							pEvent->classId(m_DL_Trainer->getClassId(ID.b_str()));
+
+							for(i=0; i<m_nFeatures; i++)
+							{
+								pEvent->push_back(m_DL_Trainer->getId(Values[i].b_str()));
+							}
+
+							m_DL_Events->push_back(pEvent);
+						}
+						break;
+					}
+				}
+			}
+		}
+	}
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CClassify_Grid::Get_File(const CSG_String &File)
+{
+	//-----------------------------------------------------
+	if( !m_YT_Model.load_from_file(File.b_str()) )
+	{
+		Error_Set(_TL("could not load model from file"));
+
+		return( false );
+	}
+
+	//-----------------------------------------------------
+/*	list< pair< pair<string, string>, double > > Features;
+
+	m_YT_Model.get_features(Features);
+
+	if( (int)Features.size() != m_nFeatures )
+	{
+		Error_Set(_TL("number of model features do not fit input features list"));
+
+		return( false );
+	}/**/
+
+	//-----------------------------------------------------
+	if( m_YT_Model.num_classes() <= 1 )
+	{
+		Error_Set(_TL("less than two classes in model"));
+
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	CSG_Parameter	*pLUT	= DataObject_Get_Parameter(Parameters("CLASSES")->asGrid(), "LUT");
+
+	for(int iClass=0; iClass<m_YT_Model.num_classes(); iClass++)
+	{
+		if( m_pProbs )
+		{
+			CSG_Grid	*pGrid	= m_pProbs->asGrid(iClass);
+
+			if( !pGrid )
+			{
+				m_pProbs->Add_Item(pGrid = SG_Create_Grid(*Get_System()));
+
+				DataObject_Set_Colors(pGrid, 11, SG_COLORS_YELLOW_GREEN);
+			}
+
+			pGrid->Set_Name(m_YT_Model.get_class_label(iClass).c_str());
+		}
+
+		if( pLUT && pLUT->asTable() )
+		{
+			CSG_Table_Record	*pClass	= pLUT->asTable()->Get_Record(iClass);
+
+			if( !pClass )
+			{
+				(pClass	= pLUT->asTable()->Add_Record())->Set_Value(0, SG_Color_Get_Random());
+			}
+
+			pClass->Set_Value(1, m_YT_Model.get_class_label(iClass).c_str());
+			pClass->Set_Value(3, m_YT_Model.get_class_id(m_YT_Model.get_class_label(iClass)));
+			pClass->Set_Value(4, m_YT_Model.get_class_id(m_YT_Model.get_class_label(iClass)));
+		}
+	}
+
+	if( pLUT && pLUT->asTable() )
+	{
+		pLUT->asTable()->Set_Record_Count(m_YT_Model.num_classes());
+
+		DataObject_Set_Parameter(Parameters("CLASSES")->asGrid(), pLUT);
+		DataObject_Set_Parameter(Parameters("CLASSES")->asGrid(), "COLORS_TYPE", 1);	// Color Classification Type: Lookup Table
+	}
+
+	//-----------------------------------------------------
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
diff --git a/src/modules/pointcloud/pointcloud_tools/pc_cut.h b/src/modules/imagery/imagery_maxent/classify_grid.h
similarity index 71%
copy from src/modules/pointcloud/pointcloud_tools/pc_cut.h
copy to src/modules/imagery/imagery_maxent/classify_grid.h
index f59cc9b..5a7a4b2 100644
--- a/src/modules/pointcloud/pointcloud_tools/pc_cut.h
+++ b/src/modules/imagery/imagery_maxent/classify_grid.h
@@ -1,140 +1,148 @@
-/**********************************************************
- * Version $Id: pc_cut.h 1921 2014-01-09 10:24:11Z oconrad $
- *********************************************************/
-
-///////////////////////////////////////////////////////////
-//                                                       //
-//                         SAGA                          //
-//                                                       //
-//      System for Automated Geoscientific Analyses      //
-//                                                       //
-//                    Module Library:                    //
-//                   pointcloud_tools                    //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//                       pc_cut.h                        //
-//                                                       //
-//                 Copyright (C) 2009 by                 //
-//                      Olaf Conrad                      //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-// This file is part of 'SAGA - System for Automated     //
-// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
-//                                                       //
-// SAGA is distributed in the hope that it will be       //
-// useful, but WITHOUT ANY WARRANTY; without even the    //
-// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
-// PARTICULAR PURPOSE. See the GNU General Public        //
-// License for more details.                             //
-//                                                       //
-// You should have received a copy of the GNU General    //
-// Public License along with this program; if not,       //
-// write to the Free Software Foundation, Inc.,          //
-// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
-// USA.                                                  //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//    e-mail:     oconrad at saga-gis.org                   //
-//                                                       //
-//    contact:    Olaf Conrad                            //
-//                Institute of Geography                 //
-//                University of Hamburg                  //
-//                Germany                                //
-//                                                       //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#ifndef HEADER_INCLUDED__PC_Cut_H
-#define HEADER_INCLUDED__PC_Cut_H
-
-//---------------------------------------------------------
-#include "MLB_Interface.h"
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-class CPC_Cut : public CSG_Module
-{
-public:
-	CPC_Cut(void);
-
-	virtual CSG_String			Get_MenuPath			(void)	{	return( _TL("R:Tools") );	}
-
-	static bool					Get_Cut					(CSG_PointCloud *pPoints, CSG_PointCloud *pCut, const CSG_Rect &Extent, bool bInverse);
-	static bool					Get_Cut					(CSG_PointCloud *pPoints, CSG_PointCloud *pCut, CSG_Shapes *pPolygons, bool bInverse);
-
-
-protected:
-
-	virtual bool				On_Execute				(void);
-
-
-private:
-
-	static bool					Contains				(CSG_Shapes *pPolygons, double x, double y);
-
-};
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-class CPC_Cut_Interactive : public CSG_Module_Interactive
-{
-public:
-	CPC_Cut_Interactive(void);
-
-	virtual CSG_String			Get_MenuPath			(void)	{	return( _TL("R:Tools") );	}
-
-
-protected:
-
-	virtual bool				On_Execute				(void);
-	virtual bool				On_Execute_Position		(CSG_Point ptWorld, TSG_Module_Interactive_Mode Mode);
-
-
-private:
-
-	CSG_Point					m_ptDown;
-
-	CSG_PointCloud				*m_pPoints, *m_pCut;
-
-	CSG_Shapes					*m_pAOI;
-
-	bool						m_bAOIBox, m_bAdd, m_bInverse;
-
-};
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED__PC_Cut_H
+/**********************************************************
+ * Version $Id: classify_grid.cpp 911 2011-11-11 11:11:11Z oconrad $
+ *********************************************************/
+
+///////////////////////////////////////////////////////////
+//                                                       //
+//                         SAGA                          //
+//                                                       //
+//      System for Automated Geoscientific Analyses      //
+//                                                       //
+//                    Module Library:                    //
+//                        maxent                         //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//                    classify_grid.h                    //
+//                                                       //
+//                 Copyright (C) 2015 by                 //
+//                     Olaf Conrad                       //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+// This file is part of 'SAGA - System for Automated     //
+// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
+//                                                       //
+// SAGA is distributed in the hope that it will be       //
+// useful, but WITHOUT ANY WARRANTY; without even the    //
+// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
+// PARTICULAR PURPOSE. See the GNU General Public        //
+// License for more details.                             //
+//                                                       //
+// You should have received a copy of the GNU General    //
+// Public License along with this program; if not,       //
+// write to the Free Software Foundation, Inc.,          //
+// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
+// USA.                                                  //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//    e-mail:     oconrad at saga-gis.de                    //
+//                                                       //
+//    contact:    Olaf Conrad                            //
+//                Institute of Geography                 //
+//                University of Hamburg                  //
+//                Germany                                //
+//                                                       //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#ifndef HEADER_INCLUDED__classify_grid_H
+#define HEADER_INCLUDED__classify_grid_H
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#include "MLB_Interface.h"
+
+//---------------------------------------------------------
+#include "maxent.h"
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+class CClassify_Grid : public CSG_Module_Grid
+{
+public:
+	CClassify_Grid(void);
+
+	virtual CSG_String			Get_MenuPath	(void)	{	return( _TL("A:Imagery|Classification") );	}
+
+
+protected:
+
+	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+
+	virtual bool				On_Execute				(void);
+
+
+private:
+
+	typedef struct
+	{
+		bool					bNumeric;
+
+		char					Name[256];
+
+		CSG_Grid				*pGrid;
+	}
+	TFeature;
+
+	bool						m_bYT_Weights;
+
+	int							m_Method, m_nNumClasses, m_nFeatures;
+
+	TFeature					*m_Features;
+
+	CSG_Parameter_Grid_List		*m_pProbs;
+
+	ME_Model					m_YT_Model;
+
+	class EventSet				*m_DL_Events;
+
+	class GISTrainer			*m_DL_Trainer;
+
+	class MaxEntModel			*m_DL_Model;
+
+
+	CSG_String					Get_Feature		(int x, int y, int i);
+	bool						Get_Features	(CSG_Array &Features);
+
+	bool						Get_Training	(void);
+	void						Get_Training	(const CSG_String &ID, CSG_Shape_Polygon *pArea);
+
+	bool						Get_File		(const CSG_String &File);
+
+};
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#endif // #ifndef HEADER_INCLUDED__classify_grid_H
diff --git a/src/modules/imagery/imagery_maxent/lbfgs.cpp b/src/modules/imagery/imagery_maxent/lbfgs.cpp
new file mode 100644
index 0000000..0fc54bf
--- /dev/null
+++ b/src/modules/imagery/imagery_maxent/lbfgs.cpp
@@ -0,0 +1,110 @@
+#include <vector>
+#include <iostream>
+#include <stdio.h>
+#include <cmath>
+#include "mathvec.h"
+#include "lbfgs.h"
+#include "maxent.h"
+
+using namespace std;
+
+const static int    M = LBFGS_M;
+const static double LINE_SEARCH_ALPHA = 0.1;
+const static double LINE_SEARCH_BETA  = 0.5;
+
+// stopping criteria
+int    LBFGS_MAX_ITER      = 300;
+const static double MIN_GRAD_NORM = 0.0001;
+
+
+double 
+ME_Model::backtracking_line_search(
+			 const Vec & x0, const Vec & grad0, const double f0, 
+			 const Vec & dx, Vec & x, Vec & grad1)
+{
+  double t = 1.0 / LINE_SEARCH_BETA;
+
+  double f;
+  do {
+    t *= LINE_SEARCH_BETA;
+    x = x0 + t * dx;
+    f = FunctionGradient(x.STLVec(), grad1.STLVec());
+    //        cout << "*";
+  } while (f > f0 + LINE_SEARCH_ALPHA * t * dot_product(dx, grad0));
+
+  return f;
+}
+
+//
+// Jorge Nocedal, "Updating Quasi-Newton Matrices With Limited Storage",
+// Mathematics of Computation, Vol. 35, No. 151, pp. 773-782, 1980.
+//
+Vec 
+approximate_Hg(const int iter, const Vec & grad,
+	       const Vec s[],  const Vec y[], const double z[])
+{
+  int offset, bound;
+  if (iter <= M) { offset = 0;        bound = iter; }
+  else           { offset = iter - M; bound = M;    }
+
+  Vec q = grad;
+  double alpha[M], beta[M];
+  for (int i = bound - 1; i >= 0; i--) {
+    const int j = (i + offset) % M;
+    alpha[i]    = z[j]   * dot_product(s[j], q);
+    q          += -alpha[i] * y[j];
+  }
+  if (iter > 0) {
+    const int j = (iter - 1) % M;
+    const double gamma = ((1.0 / z[j]) / dot_product(y[j], y[j]));
+    //    static double gamma;
+    //    if (gamma == 0) gamma = ((1.0 / z[j]) / dot_product(y[j], y[j]));
+    q *= gamma;
+  }
+  for (int i = 0; i <= bound - 1; i++) {
+    const int j = (i + offset) % M;
+    beta[i]     = z[j] * dot_product(y[j], q);
+    q          += s[j] * (alpha[i] - beta[i]);
+  }
+
+  return q;
+}
+
+vector<double> 
+ME_Model::perform_LBFGS(const vector<double> & x0)
+{
+  const size_t dim = x0.size();
+  Vec x = x0;
+
+  Vec grad(dim), dx(dim);
+  double f = FunctionGradient(x.STLVec(), grad.STLVec());
+
+  Vec s[M], y[M];
+  double z[M];  // rho
+
+  for (int iter = 0; iter < LBFGS_MAX_ITER; iter++) {
+
+    fprintf(stderr, "%3d  obj(err) = %f (%6.4f)", iter+1, -f, _train_error);
+    if (_nheldout > 0) {
+      const double heldout_logl = heldout_likelihood();
+      fprintf(stderr, "  heldout_logl(err) = %f (%6.4f)", heldout_logl, _heldout_error);
+    }
+    fprintf(stderr, "\n");
+
+    if (sqrt(dot_product(grad, grad)) < MIN_GRAD_NORM) break;
+
+    dx = -1 * approximate_Hg(iter, grad, s, y, z);
+
+    Vec x1(dim), grad1(dim);
+    f = backtracking_line_search(x, grad, f, dx, x1, grad1);
+
+    s[iter % M] = x1 - x;
+    y[iter % M] = grad1 - grad;
+    z[iter % M] = 1.0 / dot_product(y[iter % M], s[iter % M]);
+    x = x1;
+    grad = grad1;
+  }
+
+  return x.STLVec();
+}
+
diff --git a/src/modules/imagery/imagery_maxent/lbfgs.h b/src/modules/imagery/imagery_maxent/lbfgs.h
new file mode 100644
index 0000000..113919a
--- /dev/null
+++ b/src/modules/imagery/imagery_maxent/lbfgs.h
@@ -0,0 +1,21 @@
+#ifndef _LBFGS_H_
+#define _LBFGS_H_
+
+//template<class FuncGrad>
+//std::vector<double> 
+//perform_LBFGS(FuncGrad func_grad, const std::vector<double> & x0);
+
+std::vector<double> 
+perform_LBFGS(double (*func_grad)(const std::vector<double> &, std::vector<double> &), 
+	      const std::vector<double> & x0);
+
+
+std::vector<double> 
+perform_OWLQN(double (*func_grad)(const std::vector<double> &, std::vector<double> &), 
+	      const std::vector<double> & x0,
+	      const double C);
+
+//const int    LBFGS_M = 7;
+const int    LBFGS_M = 10;
+
+#endif
diff --git a/src/modules/imagery/imagery_maxent/mathvec.h b/src/modules/imagery/imagery_maxent/mathvec.h
new file mode 100644
index 0000000..4ec8279
--- /dev/null
+++ b/src/modules/imagery/imagery_maxent/mathvec.h
@@ -0,0 +1,97 @@
+#ifndef _MATH_VECTOR_H_
+#define _MATH_VECTOR_H_
+
+#include <vector>
+#include <iostream>
+#include <cassert>
+
+class Vec
+{
+private:
+  std::vector<double> _v;
+public:
+  Vec(const size_t n = 0, const double val = 0) { _v.resize(n, val); }
+  Vec(const std::vector<double> & v) : _v(v)    {}
+  const std::vector<double> & STLVec() const { return _v; }
+  std::vector<double>       & STLVec()       { return _v; }
+  size_t Size() const { return _v.size(); }
+  double       & operator[](int i)       { return _v[i]; }
+  const double & operator[](int i) const { return _v[i]; }
+  Vec & operator+=(const Vec & b) {
+    assert(b.Size() == _v.size());
+    for (size_t i = 0; i < _v.size(); i++) {
+      _v[i] += b[i];
+    }
+    return *this;
+  }
+  Vec & operator*=(const double c) {
+    for (size_t i = 0; i < _v.size(); i++) {
+      _v[i] *= c;
+    }
+    return *this;
+  }
+  void Project(const Vec & y) {
+    for (size_t i = 0; i < _v.size(); i++) {
+      //      if (sign(_v[i]) != sign(y[i])) _v[i] = 0;
+      if (_v[i] * y[i] <=0) _v[i] = 0;
+    }
+  }
+};
+
+inline double dot_product(const Vec & a, const Vec & b)
+{
+  double sum = 0;
+  for (size_t i = 0; i < a.Size(); i++) {
+    sum += a[i] * b[i];
+  }
+  return sum;
+}
+
+inline std::ostream & operator<<(std::ostream & s, const Vec & a)
+{
+  s << "(";
+  for (size_t i = 0; i < a.Size(); i++) {
+    if (i != 0) s << ", ";
+    s << a[i];
+  }
+  s << ")";
+  return s;
+}
+
+inline const Vec operator+(const Vec & a, const Vec & b)
+{
+  Vec v(a.Size());
+  assert(a.Size() == b.Size());
+  for (size_t i = 0; i < a.Size(); i++) {
+    v[i] = a[i] + b[i];
+  }
+  return v;
+}
+
+inline const Vec operator-(const Vec & a, const Vec & b)
+{
+  Vec v(a.Size());
+  assert(a.Size() == b.Size());
+  for (size_t i = 0; i < a.Size(); i++) {
+    v[i] = a[i] - b[i];
+  }
+  return v;
+}
+
+inline const Vec operator*(const Vec & a, const double c)
+{
+  Vec v(a.Size());
+  for (size_t i = 0; i < a.Size(); i++) {
+    v[i] = a[i] * c;
+  }
+  return v;
+}
+
+inline const Vec operator*(const double c, const Vec & a)
+{
+  return a * c;
+}
+
+
+
+#endif
diff --git a/src/modules/imagery/imagery_maxent/maxent.cpp b/src/modules/imagery/imagery_maxent/maxent.cpp
new file mode 100644
index 0000000..feb0efd
--- /dev/null
+++ b/src/modules/imagery/imagery_maxent/maxent.cpp
@@ -0,0 +1,698 @@
+/*
+ * $Id: maxent.cpp,v 1.1.1.1 2007/05/15 08:30:35 kyoshida Exp $
+ */
+
+#include "maxent.h"
+#include <cmath>
+#include <cstdio>
+#include "lbfgs.h"
+
+using namespace std;
+
+double
+ME_Model::FunctionGradient(const vector<double> & x, vector<double> & grad)
+{
+  assert((int)_fb.Size() == x.size());
+  for (size_t i = 0; i < x.size(); i++) {
+    _vl[i] = x[i];
+  }
+  
+  double score = update_model_expectation();
+
+  if (_l2reg == 0) {
+    for (size_t i = 0; i < x.size(); i++) {
+      grad[i] = -(_vee[i] - _vme[i]);
+    }
+  } else {
+    const double c = _l2reg * 2;
+    for (size_t i = 0; i < x.size(); i++) {
+      grad[i] = -(_vee[i] - _vme[i] - c * _vl[i]);
+    }
+  }
+
+  return -score;
+}
+
+int
+ME_Model::perform_GIS(int C)
+{
+  cerr << "C = " << C << endl;
+  C = 1;
+  cerr << "performing AGIS" << endl;
+  vector<double> pre_v;
+  double pre_logl = -999999;
+  for (int iter = 0; iter < 200; iter++) {
+
+    double logl =  update_model_expectation();
+    fprintf(stderr, "iter = %2d  C = %d  f = %10.7f  train_err = %7.5f", iter, C, logl, _train_error);
+    if (_heldout.size() > 0) {
+      double hlogl = heldout_likelihood();
+      fprintf(stderr, "  heldout_logl(err) = %f (%6.4f)", hlogl, _heldout_error);
+    }
+    cerr << endl;
+
+    if (logl < pre_logl) {
+      C += 1;
+      _vl = pre_v;
+      iter--;
+      continue;
+    }
+    if (C > 1 && iter % 10 == 0) C--;
+
+    pre_logl = logl;
+    pre_v = _vl;
+    for (int i = 0; i < _fb.Size(); i++) {
+      double coef = _vee[i] / _vme[i];
+      _vl[i] += log(coef) / C;
+    }
+  }
+  cerr << endl;
+
+  return 0;
+}
+
+int
+ME_Model::perform_QUASI_NEWTON()
+{
+  const int dim = _fb.Size();
+  vector<double> x0(dim);
+
+  for (int i = 0; i < dim; i++) { x0[i] = _vl[i]; }
+
+  vector<double> x;
+  if (_l1reg > 0) {
+    cerr << "performing OWLQN" << endl;
+    x = perform_OWLQN(x0, _l1reg);
+  } else {
+    cerr << "performing LBFGS" << endl;
+    x = perform_LBFGS(x0);
+  }
+
+  for (int i = 0; i < dim; i++) { _vl[i] = x[i]; }
+
+  return 0;
+}
+
+int
+ME_Model::conditional_probability(const Sample & s,
+                                  std::vector<double> & membp) const
+{
+  //int num_classes = membp.size();
+  double sum = 0;
+  int max_label = -1;
+  //  double maxp = 0;
+
+  vector<double> powv(_num_classes, 0.0);
+  for (vector<int>::const_iterator j = s.positive_features.begin(); j != s.positive_features.end(); j++){
+    for (vector<int>::const_iterator k = _feature2mef[*j].begin(); k != _feature2mef[*j].end(); k++) {
+      powv[_fb.Feature(*k).label()] += _vl[*k];
+    }
+  }
+  for (vector<pair<int, double> >::const_iterator j = s.rvfeatures.begin(); j != s.rvfeatures.end(); j++) {
+    for (vector<int>::const_iterator k = _feature2mef[j->first].begin(); k != _feature2mef[j->first].end(); k++) {
+      powv[_fb.Feature(*k).label()] += _vl[*k] * j->second;
+    }
+  }
+
+  std::vector<double>::const_iterator pmax = max_element(powv.begin(), powv.end());
+  double offset = max(0.0, *pmax - 700); // to avoid overflow
+  for (int label = 0; label < _num_classes; label++) {
+    double pow = powv[label] - offset;
+    double prod = exp(pow);
+    //      cout << pow << " " << prod << ", ";
+    //      if (_ref_modelp != NULL) prod *= _train_refpd[n][label];
+    if (_ref_modelp != NULL) prod *= s.ref_pd[label];
+    assert(prod != 0);
+    membp[label] = prod;
+    sum += prod;
+  }
+  for (int label = 0; label < _num_classes; label++) {
+    membp[label] /= sum;
+    if (membp[label] > membp[max_label]) max_label = label;
+  }
+  assert(max_label >= 0);
+  return max_label;
+}
+
+int
+ME_Model::make_feature_bag(const int cutoff)
+{
+  int max_num_features = 0;
+
+  // count the occurrences of features
+#ifdef USE_HASH_MAP
+  typedef __gnu_cxx::hash_map<unsigned int, int> map_type;
+#else    
+  typedef std::map<unsigned int, int> map_type;
+#endif
+  map_type count;
+  if (cutoff > 0) {
+    for (std::vector<Sample>::const_iterator i = _vs.begin(); i != _vs.end(); i++) {
+      for (std::vector<int>::const_iterator j = i->positive_features.begin(); j != i->positive_features.end(); j++) {
+        count[ME_Feature(i->label, *j).body()]++;
+      }
+      for (std::vector<pair<int, double> >::const_iterator j = i->rvfeatures.begin(); j != i->rvfeatures.end(); j++) {
+        count[ME_Feature(i->label, j->first).body()]++;
+      }
+    }
+  }
+
+  int n = 0; 
+  for (std::vector<Sample>::const_iterator i = _vs.begin(); i != _vs.end(); i++, n++) {
+    max_num_features = max(max_num_features, (int)(i->positive_features.size()));
+    for (std::vector<int>::const_iterator j = i->positive_features.begin(); j != i->positive_features.end(); j++) {
+      const ME_Feature feature(i->label, *j);
+      //      if (cutoff > 0 && count[feature.body()] < cutoff) continue;
+      if (cutoff > 0 && count[feature.body()] <= cutoff) continue;
+      _fb.Put(feature);
+      //      cout << i->label << "\t" << *j << "\t" << id << endl;
+      //      feature2sample[id].push_back(n);
+    }
+    for (std::vector<pair<int, double> >::const_iterator j = i->rvfeatures.begin(); j != i->rvfeatures.end(); j++) {
+      const ME_Feature feature(i->label, j->first);
+      //      if (cutoff > 0 && count[feature.body()] < cutoff) continue;
+      if (cutoff > 0 && count[feature.body()] <= cutoff) continue;
+      _fb.Put(feature);
+    }
+  }
+  count.clear();
+  
+  //  cerr << "num_classes = " << _num_classes << endl;
+  //  cerr << "max_num_features = " << max_num_features << endl;
+
+  init_feature2mef();
+  
+  return max_num_features;
+}
+
+double
+ME_Model::heldout_likelihood()
+{
+  double logl = 0;
+  int ncorrect = 0;
+  for (std::vector<Sample>::const_iterator i = _heldout.begin(); i != _heldout.end(); i++) {
+    vector<double> membp(_num_classes);
+    int l = classify(*i, membp);
+    logl += log(membp[i->label]);
+    if (l == i->label) ncorrect++;
+  }
+  _heldout_error = 1 - (double)ncorrect / _heldout.size();
+  
+  return logl /= _heldout.size();
+}
+
+double
+ME_Model::update_model_expectation()
+{
+  double logl = 0;
+  int ncorrect = 0;
+
+  _vme.resize(_fb.Size());
+  for (int i = 0; i < _fb.Size(); i++) _vme[i] = 0;
+  
+  int n = 0;
+  for (vector<Sample>::const_iterator i = _vs.begin(); i != _vs.end(); i++, n++) {
+    vector<double> membp(_num_classes);
+    int max_label = conditional_probability(*i, membp);
+    
+    logl += log(membp[i->label]);
+    //    cout << membp[*i] << " " << logl << " ";
+    if (max_label == i->label) ncorrect++;
+
+    // model_expectation
+    for (vector<int>::const_iterator j = i->positive_features.begin(); j != i->positive_features.end(); j++){
+      for (vector<int>::const_iterator k = _feature2mef[*j].begin(); k != _feature2mef[*j].end(); k++) {
+	_vme[*k] += membp[_fb.Feature(*k).label()];
+      }
+    }
+    for (vector<pair<int, double> >::const_iterator j = i->rvfeatures.begin(); j != i->rvfeatures.end(); j++) {
+      for (vector<int>::const_iterator k = _feature2mef[j->first].begin(); k != _feature2mef[j->first].end(); k++) {
+	_vme[*k] += membp[_fb.Feature(*k).label()] * j->second;
+      }
+    }
+    
+  }
+
+  for (int i = 0; i < _fb.Size(); i++) {
+    _vme[i] /= _vs.size();
+  }
+  
+  _train_error = 1 - (double)ncorrect / _vs.size();
+
+  logl /= _vs.size();
+  
+  if (_l2reg > 0) {
+    const double c = _l2reg;
+    for (int i = 0; i < _fb.Size(); i++) {
+      logl -= _vl[i] * _vl[i] * c;
+    }
+  }
+
+  //logl /= _vs.size();
+  
+  //  fprintf(stderr, "iter =%3d  logl = %10.7f  train_acc = %7.5f\n", iter, logl, (double)ncorrect/train.size());
+  //  fprintf(stderr, "logl = %10.7f  train_acc = %7.5f\n", logl, (double)ncorrect/_train.size());
+
+  return logl;
+}
+
+int
+ME_Model::train(const vector<ME_Sample> & vms)
+{
+  _vs.clear();
+  for (vector<ME_Sample>::const_iterator i = vms.begin(); i != vms.end(); i++) {
+    add_training_sample(*i);
+  }
+
+  return train();
+}
+
+void
+ME_Model::add_training_sample(const ME_Sample & mes)
+{
+  Sample s;
+  s.label = _label_bag.Put(mes.label);
+  if (s.label > ME_Feature::MAX_LABEL_TYPES) {
+    cerr << "error: too many types of labels." << endl;
+    exit(1);
+  }
+  for (vector<string>::const_iterator j = mes.features.begin(); j != mes.features.end(); j++) {
+    s.positive_features.push_back(_featurename_bag.Put(*j));
+  }
+  for (vector<pair<string, double> >::const_iterator j = mes.rvfeatures.begin(); j != mes.rvfeatures.end(); j++) {
+    s.rvfeatures.push_back(pair<int, double>(_featurename_bag.Put(j->first), j->second));
+  }
+  if (_ref_modelp != NULL) {
+    ME_Sample tmp = mes;;
+    s.ref_pd = _ref_modelp->classify(tmp);
+  }
+  //  cout << s.label << "\t";
+  //  for (vector<int>::const_iterator j = s.positive_features.begin(); j != s.positive_features.end(); j++){
+  //    cout << *j << " ";
+  //  }
+  //  cout << endl;
+  
+  _vs.push_back(s);
+}
+
+int
+ME_Model::train()
+{
+  if (_l1reg > 0 && _l2reg > 0) {
+    cerr << "error: L1 and L2 regularizers cannot be used simultaneously." << endl;
+    return 0;
+  }
+  if (_vs.size() == 0) {
+    cerr << "error: no training data." << endl;
+    return 0;
+  }
+  if (_nheldout >= (int)_vs.size()) {
+    cerr << "error: too much heldout data. no training data is available." << endl;
+    return 0;
+  }
+  //  if (_nheldout > 0) random_shuffle(_vs.begin(), _vs.end());
+
+  int max_label = 0;
+  for (std::vector<Sample>::const_iterator i = _vs.begin(); i != _vs.end(); i++) {
+    max_label = max(max_label, i->label);
+  }
+  _num_classes = max_label + 1;
+  if (_num_classes != _label_bag.Size()) {
+    cerr << "warning: _num_class != _label_bag.Size()" << endl;
+  }
+  
+  if (_ref_modelp != NULL) {
+    cerr << "setting reference distribution...";
+    for (int i = 0; i < _ref_modelp->num_classes(); i++) {
+      _label_bag.Put(_ref_modelp->get_class_label(i));
+    }
+    _num_classes = _label_bag.Size();
+    for (vector<Sample>::iterator i = _vs.begin(); i != _vs.end(); i++) {
+      set_ref_dist(*i);
+    }
+    cerr << "done" << endl;
+  }
+  
+  for (int i = 0; i < _nheldout; i++) {
+    _heldout.push_back(_vs.back());
+    _vs.pop_back();
+  }
+
+  sort(_vs.begin(), _vs.end());
+
+  int cutoff = 0;
+  if (cutoff > 0) cerr << "cutoff threshold = " << cutoff << endl;
+  if (_l1reg > 0) cerr << "L1 regularizer = " << _l1reg << endl;
+  if (_l2reg > 0) cerr << "L2 regularizer = " << _l2reg << endl;
+
+  // normalize
+  _l1reg /= _vs.size();
+  _l2reg /= _vs.size();
+
+  cerr << "preparing for estimation...";
+  make_feature_bag(cutoff);
+  //  _vs.clear();
+  cerr << "done" << endl;
+  cerr << "number of samples = " << _vs.size() << endl;
+  cerr << "number of features = " << _fb.Size() << endl;
+
+  cerr << "calculating empirical expectation...";
+  _vee.resize(_fb.Size());
+  for (int i = 0; i < _fb.Size(); i++) {
+    _vee[i] = 0;
+  }
+  for (int n = 0; n < (int)_vs.size(); n++) {
+    const Sample * i = &_vs[n];
+    for (vector<int>::const_iterator j = i->positive_features.begin(); j != i->positive_features.end(); j++){
+      for (vector<int>::const_iterator k = _feature2mef[*j].begin(); k != _feature2mef[*j].end(); k++) {
+	if (_fb.Feature(*k).label() == i->label) _vee[*k] += 1.0;
+      }
+    }
+
+    for (vector<pair<int, double> >::const_iterator j = i->rvfeatures.begin(); j != i->rvfeatures.end(); j++) {
+      for (vector<int>::const_iterator k = _feature2mef[j->first].begin(); k != _feature2mef[j->first].end(); k++) {
+	if (_fb.Feature(*k).label() == i->label) _vee[*k] += j->second;
+      }
+    }
+
+  }
+  for (int i = 0; i < _fb.Size(); i++) {
+    _vee[i] /= _vs.size();
+  }
+  cerr << "done" << endl;
+  
+  _vl.resize(_fb.Size());
+  for (int i = 0; i < _fb.Size(); i++) _vl[i] = 0.0;
+
+  if (_optimization_method == SGD) {
+    perform_SGD();
+  } else {
+    perform_QUASI_NEWTON();
+  }
+
+  int num_active = 0;
+  for (int i = 0; i < _fb.Size(); i++) {
+    if (_vl[i] != 0) num_active++;
+  }
+  cerr << "number of active features = " << num_active << endl;
+
+  return 0;
+}
+
+void
+ME_Model::get_features(list< pair< pair<string, string>, double> > & fl)
+{
+  fl.clear();
+  //  for (int i = 0; i < _fb.Size(); i++) {
+  //    ME_Feature f = _fb.Feature(i);
+  //    fl.push_back( make_pair(make_pair(_label_bag.Str(f.label()), _featurename_bag.Str(f.feature())), _vl[i]));
+  //  }
+  for (MiniStringBag::map_type::const_iterator i = _featurename_bag.begin();
+       i != _featurename_bag.end(); i++) {
+    for (int j = 0; j < _label_bag.Size(); j++) {
+      string label = _label_bag.Str(j);
+      string history = i->first;
+      int id = _fb.Id(ME_Feature(j, i->second));
+      if (id < 0) continue;
+      fl.push_back( make_pair(make_pair(label, history), _vl[id]) );
+    }
+  }
+}
+
+void
+ME_Model::clear()
+{
+  _vl.clear();
+  _label_bag.Clear();
+  _featurename_bag.Clear();
+  _fb.Clear();
+  _feature2mef.clear();
+  _vee.clear();
+  _vme.clear();
+  _vs.clear();
+  _heldout.clear();
+}
+
+bool
+ME_Model::load_from_file(const string & filename)
+{
+  FILE * fp = fopen(filename.c_str(), "r");
+  if (!fp) {
+    cerr << "error: cannot open " << filename << "!" << endl;
+    return false;
+  }
+
+  _vl.clear();
+  _label_bag.Clear();
+  _featurename_bag.Clear();
+  _fb.Clear();
+  char buf[1024];
+  while(fgets(buf, 1024, fp)) {
+    string line(buf);
+    string::size_type t1 = line.find_first_of('\t');
+    string::size_type t2 = line.find_last_of('\t');
+    string classname = line.substr(0, t1);
+    string featurename = line.substr(t1 + 1, t2 - (t1 + 1) );
+    float lambda;
+    string w = line.substr(t2+1);
+    sscanf(w.c_str(), "%f", &lambda);
+      
+    int label = _label_bag.Put(classname);
+    int feature = _featurename_bag.Put(featurename);
+    _fb.Put(ME_Feature(label, feature));
+    _vl.push_back(lambda);
+  }
+    
+  _num_classes = _label_bag.Size();
+
+  init_feature2mef();
+
+  fclose(fp);
+
+  return true;
+}
+
+void
+ME_Model::init_feature2mef()
+{
+  _feature2mef.clear();
+  for (int i = 0; i < _featurename_bag.Size(); i++) {
+    vector<int> vi;
+    for (int k = 0; k < _num_classes; k++) {
+      int id = _fb.Id(ME_Feature(k, i));
+      if (id >= 0) vi.push_back(id);
+    }
+    _feature2mef.push_back(vi);
+  }
+}
+
+bool
+ME_Model::load_from_array(const ME_Model_Data data[])
+{
+  _vl.clear();
+  for (int i = 0;; i++) {
+    if (string(data[i].label) == "///") break;
+    int label = _label_bag.Put(data[i].label);
+    int feature = _featurename_bag.Put(data[i].feature);
+    _fb.Put(ME_Feature(label, feature));
+    _vl.push_back(data[i].weight);
+  }
+  _num_classes = _label_bag.Size();
+
+  init_feature2mef();
+  
+  return true;
+}
+
+bool
+ME_Model::save_to_file(const string & filename, const double th) const
+{
+  FILE * fp = fopen(filename.c_str(), "w");
+  if (!fp) {
+    cerr << "error: cannot open " << filename << "!" << endl;
+    return false;
+  }
+
+  //  for (int i = 0; i < _fb.Size(); i++) {
+  //    if (_vl[i] == 0) continue; // ignore zero-weight features
+  //    ME_Feature f = _fb.Feature(i);
+  //    fprintf(fp, "%s\t%s\t%f\n", _label_bag.Str(f.label()).c_str(), _featurename_bag.Str(f.feature()).c_str(), _vl[i]);
+  //  }
+  for (MiniStringBag::map_type::const_iterator i = _featurename_bag.begin();
+       i != _featurename_bag.end(); i++) {
+    for (int j = 0; j < _label_bag.Size(); j++) {
+      string label = _label_bag.Str(j);
+      string history = i->first;
+      int id = _fb.Id(ME_Feature(j, i->second));
+      if (id < 0) continue;
+      if (_vl[id] == 0) continue; // ignore zero-weight features
+      if (fabs(_vl[id]) < th) continue; // cut off low-weight features
+      fprintf(fp, "%s\t%s\t%f\n", label.c_str(), history.c_str(), _vl[id]);
+    }
+  }
+
+  fclose(fp);
+
+  return true;
+}
+
+void
+ME_Model::set_ref_dist(Sample & s) const
+{
+  vector<double> v0 = s.ref_pd;
+  vector<double> v(_num_classes);
+  for (unsigned int i = 0; i < v.size(); i++) {
+    v[i] = 0;
+    string label = get_class_label(i);
+    int id_ref = _ref_modelp->get_class_id(label);
+    if (id_ref != -1) {
+      v[i] = v0[id_ref];
+    }
+    if (v[i] == 0) v[i] = 0.001; // to avoid -inf logl
+  }
+  s.ref_pd = v;
+}
+  
+int
+ME_Model::classify(const Sample & nbs, vector<double> & membp) const
+{
+  //  vector<double> membp(_num_classes);
+  assert(_num_classes == (int)membp.size());
+  conditional_probability(nbs, membp);
+  int max_label = 0;
+  double max = 0.0;
+  for (int i = 0; i < (int)membp.size(); i++) {
+    //    cout << membp[i] << " ";
+    if (membp[i] > max) { max_label = i; max = membp[i]; }
+  }
+  //  cout << endl;
+  return max_label;
+}
+
+vector<double>
+ME_Model::classify(ME_Sample & mes) const
+{
+  Sample s;
+  for (vector<string>::const_iterator j = mes.features.begin(); j != mes.features.end(); j++) {
+    int id = _featurename_bag.Id(*j);
+    if (id >= 0)
+      s.positive_features.push_back(id);
+  }
+  for (vector<pair<string, double> >::const_iterator j = mes.rvfeatures.begin(); j != mes.rvfeatures.end(); j++) {
+    int id = _featurename_bag.Id(j->first);
+    if (id >= 0) {
+      s.rvfeatures.push_back(pair<int, double>(id, j->second));
+    }
+  }
+  if (_ref_modelp != NULL) {
+    s.ref_pd = _ref_modelp->classify(mes);
+    set_ref_dist(s);
+  }
+
+  vector<double> vp(_num_classes);
+  int label = classify(s, vp);
+  mes.label = get_class_label(label);
+  return vp;
+}
+
+
+/*
+ * $Log: maxent.cpp,v $
+ * Revision 1.1.1.1  2007/05/15 08:30:35  kyoshida
+ * stepp tagger, by Okanohara and Tsuruoka
+ *
+ * Revision 1.28  2006/08/21 17:30:38  tsuruoka
+ * use MAX_LABEL_TYPES
+ *
+ * Revision 1.27  2006/07/25 13:19:53  tsuruoka
+ * sort _vs[]
+ *
+ * Revision 1.26  2006/07/18 11:13:15  tsuruoka
+ * modify comments
+ *
+ * Revision 1.25  2006/07/18 10:02:15  tsuruoka
+ * remove sample2feature[]
+ * speed up conditional_probability()
+ *
+ * Revision 1.24  2006/07/18 05:10:51  tsuruoka
+ * add ref_dist
+ *
+ * Revision 1.23  2005/12/24 07:05:32  tsuruoka
+ * modify conditional_probability() to avoid overflow
+ *
+ * Revision 1.22  2005/12/24 07:01:25  tsuruoka
+ * add cutoff for real-valued features
+ *
+ * Revision 1.21  2005/12/23 10:33:02  tsuruoka
+ * support real-valued features
+ *
+ * Revision 1.20  2005/12/23 09:15:29  tsuruoka
+ * modify _train to reduce memory consumption
+ *
+ * Revision 1.19  2005/10/28 13:10:14  tsuruoka
+ * fix for overflow (thanks to Ming Li)
+ *
+ * Revision 1.18  2005/10/28 13:03:07  tsuruoka
+ * add progress_bar
+ *
+ * Revision 1.17  2005/09/12 13:51:16  tsuruoka
+ * Sample: list -> vector
+ *
+ * Revision 1.16  2005/09/12 13:27:10  tsuruoka
+ * add add_training_sample()
+ *
+ * Revision 1.15  2005/04/27 11:22:27  tsuruoka
+ * bugfix
+ * ME_Sample: list -> vector
+ *
+ * Revision 1.14  2005/04/27 10:00:42  tsuruoka
+ * remove tmpfb
+ *
+ * Revision 1.13  2005/04/26 14:25:53  tsuruoka
+ * add MiniStringBag, USE_HASH_MAP
+ *
+ * Revision 1.12  2005/02/11 10:20:08  tsuruoka
+ * modify cutoff
+ *
+ * Revision 1.11  2004/10/04 05:50:25  tsuruoka
+ * add Clear()
+ *
+ * Revision 1.10  2004/08/26 16:52:26  tsuruoka
+ * fix load_from_file()
+ *
+ * Revision 1.9  2004/08/09 12:27:21  tsuruoka
+ * change messages
+ *
+ * Revision 1.8  2004/08/04 13:55:18  tsuruoka
+ * modify _sample2feature
+ *
+ * Revision 1.7  2004/07/28 13:42:58  tsuruoka
+ * add AGIS
+ *
+ * Revision 1.6  2004/07/28 05:54:13  tsuruoka
+ * get_class_name() -> get_class_label()
+ * ME_Feature: bugfix
+ *
+ * Revision 1.5  2004/07/27 16:58:47  tsuruoka
+ * modify the interface of classify()
+ *
+ * Revision 1.4  2004/07/26 17:23:46  tsuruoka
+ * _sample2feature: list -> vector
+ *
+ * Revision 1.3  2004/07/26 15:49:23  tsuruoka
+ * modify ME_Feature
+ *
+ * Revision 1.2  2004/07/26 13:52:18  tsuruoka
+ * modify cutoff
+ *
+ * Revision 1.1  2004/07/26 13:10:55  tsuruoka
+ * add files
+ *
+ * Revision 1.20  2004/07/22 08:34:45  tsuruoka
+ * modify _sample2feature[]
+ *
+ * Revision 1.19  2004/07/21 16:33:01  tsuruoka
+ * remove some comments
+ *
+ */
+
diff --git a/src/modules/imagery/imagery_maxent/maxent.h b/src/modules/imagery/imagery_maxent/maxent.h
new file mode 100644
index 0000000..61c6648
--- /dev/null
+++ b/src/modules/imagery/imagery_maxent/maxent.h
@@ -0,0 +1,396 @@
+/*
+ * $Id: maxent.h,v 1.1.1.1 2007/05/15 08:30:35 kyoshida Exp $
+ */
+
+#ifndef __MAXENT_H_
+#define __MAXENT_H_
+
+#include <string>
+#include <vector>
+#include <list>
+#include <map>
+#include <algorithm>
+#include <iostream>
+#include <string>
+#include <cassert>
+#include "mathvec.h"
+#include <stdio.h>
+
+//#define USE_HASH_MAP  // if you encounter errors with hash, try commenting out this line. (the program will be a bit slower, though)
+#ifdef USE_HASH_MAP
+#include <ext/hash_map>
+#endif
+
+//
+// data format for each sample for training/testing
+//
+struct ME_Sample
+{
+public:
+  ME_Sample() : label("") {};
+  ME_Sample(const std::string & l) : label(l) {};
+  void set_label(const std::string & l) { label = l; }
+
+  // to add a binary feature
+  void add_feature(const std::string & f) {
+    features.push_back(f);   
+  }
+
+  // to add a real-valued feature
+  void add_feature(const std::string & s, const double d) {
+    rvfeatures.push_back(std::pair<std::string, double>(s, d)); 
+  }
+
+public:
+  std::string label;
+  std::vector<std::string> features;
+  std::vector<std::pair<std::string, double> > rvfeatures;
+
+  // obsolete
+  void add_feature(const std::pair<std::string, double> & f) {  
+    rvfeatures.push_back(f); // real-valued features
+  }
+};
+
+
+//
+// for those who want to use load_from_array()
+//
+typedef struct ME_Model_Data
+{
+  char * label;
+  char * feature;
+  double weight;
+} ME_Model_Data;
+
+
+class ME_Model
+{
+public:
+
+  void add_training_sample(const ME_Sample & s);
+  int train();
+  std::vector<double> classify(ME_Sample & s) const;
+  bool load_from_file(const std::string & filename);
+  bool save_to_file(const std::string & filename, const double th = 0) const;
+  int num_classes() const { return _num_classes; }
+  std::string get_class_label(int i) const { return _label_bag.Str(i); }
+  int get_class_id(const std::string & s) const { return _label_bag.Id(s); }
+  void get_features(std::list< std::pair< std::pair<std::string, std::string>, double> > & fl);
+  void set_heldout(const int h, const int n = 0) { _nheldout = h; _early_stopping_n = n; };
+  void use_l1_regularizer(const double v) { _l1reg = v; }
+  void use_l2_regularizer(const double v) { _l2reg = v; }
+  void use_SGD(int iter = 30, double eta0 = 1, double alpha = 0.85) {
+    _optimization_method = SGD;
+    SGD_ITER = iter; SGD_ETA0 = eta0; SGD_ALPHA = alpha;
+  }
+  bool load_from_array(const ME_Model_Data data[]);
+  void set_reference_model(const ME_Model & ref_model) { _ref_modelp = &ref_model; };
+  void clear();
+
+  ME_Model() {
+    _l1reg = _l2reg = 0;
+    _nheldout = 0;
+    _early_stopping_n = 0;
+    _ref_modelp = NULL;
+    _optimization_method = LBFGS;
+  }
+
+public:
+  // obsolete. just for downward compatibility
+  int train(const std::vector<ME_Sample> & train);
+
+private:  
+
+  enum OPTIMIZATION_METHOD { LBFGS, OWLQN, SGD } _optimization_method;
+  // OWLQN and SGD are available only for L1-regularization
+
+  int SGD_ITER;
+  double SGD_ETA0;
+  double SGD_ALPHA;
+
+  double _l1reg, _l2reg;
+  
+  struct Sample {
+    int label;
+    std::vector<int> positive_features;
+    std::vector<std::pair<int, double> > rvfeatures;
+    std::vector<double> ref_pd; // reference probability distribution
+    bool operator<(const Sample & x) const {
+      for (unsigned int i = 0; i < positive_features.size(); i++) {
+        if (i >= x.positive_features.size()) return false;
+        int v0 = positive_features[i];
+        int v1 = x.positive_features[i];
+        if (v0 < v1) return true;
+        if (v0 > v1) return false;
+      }
+      return false;
+    }
+  };
+
+  struct ME_Feature
+  {
+    enum { MAX_LABEL_TYPES = 255 };
+      
+    //    ME_Feature(const int l, const int f) : _body((l << 24) + f) {
+    //      assert(l >= 0 && l < 256);
+    //      assert(f >= 0 && f <= 0xffffff);
+    //    };
+    //    int label() const { return _body >> 24; }
+    //    int feature() const { return _body & 0xffffff; }
+    ME_Feature(const int l, const int f) : _body((f << 8) + l) {
+      assert(l >= 0 && l <= MAX_LABEL_TYPES);
+      assert(f >= 0 && f <= 0xffffff);
+    };
+    int label() const { return _body & 0xff; }
+    int feature() const { return _body >> 8; }
+    unsigned int body() const { return _body; }
+  private:
+    unsigned int _body;
+  };
+
+  struct ME_FeatureBag
+  {
+#ifdef USE_HASH_MAP
+    typedef __gnu_cxx::hash_map<unsigned int, int> map_type;
+#else    
+    typedef std::map<unsigned int, int> map_type;
+#endif
+    map_type mef2id;
+    std::vector<ME_Feature> id2mef;
+    int Put(const ME_Feature & i) {
+      map_type::const_iterator j = mef2id.find(i.body());
+      if (j == mef2id.end()) {
+        int id = id2mef.size();
+        id2mef.push_back(i);
+        mef2id[i.body()] = id;
+        return id;
+      }
+      return j->second;
+    }
+    int Id(const ME_Feature & i) const {
+      map_type::const_iterator j = mef2id.find(i.body());
+      if (j == mef2id.end()) {
+        return -1;
+      }
+      return j->second;
+    }
+    ME_Feature Feature(int id) const {
+      assert(id >= 0 && id < (int)id2mef.size());
+      return id2mef[id];
+    }
+    int Size() const {
+      return id2mef.size();
+    }
+    void Clear() {
+      mef2id.clear();
+      id2mef.clear();
+    }
+  };
+
+  struct hashfun_str
+  {
+    size_t operator()(const std::string& s) const {
+      assert(sizeof(int) == 4 && sizeof(char) == 1);
+      const int* p = reinterpret_cast<const int*>(s.c_str());
+      size_t v = 0;
+      int n = s.size() / 4;
+      for (int i = 0; i < n; i++, p++) {
+        //      v ^= *p;
+        v ^= *p << (4 * (i % 2)); // note) 0 <= char < 128
+      }
+      int m = s.size() % 4;
+      for (int i = 0; i < m; i++) {
+        v ^= s[4 * n + i] << (i * 8);
+      }
+      return v;
+    }
+  };
+
+  struct MiniStringBag
+  {
+#ifdef USE_HASH_MAP
+    typedef __gnu_cxx::hash_map<std::string, int, hashfun_str> map_type;
+#else    
+    typedef std::map<std::string, int> map_type;
+#endif
+    int _size;
+    map_type str2id;
+    MiniStringBag() : _size(0) {}
+    int Put(const std::string & i) {
+      map_type::const_iterator j = str2id.find(i);
+      if (j == str2id.end()) {
+        int id = _size;
+        _size++;
+        str2id[i] = id;
+        return id;
+      }
+      return j->second;
+    }
+    int Id(const std::string & i) const {
+      map_type::const_iterator j = str2id.find(i);
+      if (j == str2id.end())  return -1;
+      return j->second;
+    }
+    int Size() const { return _size; }
+    void Clear() { str2id.clear(); _size = 0; }
+    map_type::const_iterator begin() const { return str2id.begin(); }
+    map_type::const_iterator end()   const { return str2id.end(); }
+  };
+
+  struct StringBag : public MiniStringBag
+  {
+    std::vector<std::string> id2str;
+    int Put(const std::string & i) {
+      map_type::const_iterator j = str2id.find(i);
+      if (j == str2id.end()) {
+        int id = id2str.size();
+        id2str.push_back(i);
+        str2id[i] = id;
+        return id;
+      }
+      return j->second;
+    }
+    std::string Str(const int id) const {
+      assert(id >= 0 && id < (int)id2str.size());
+      return id2str[id];
+    }
+    int Size() const { return id2str.size(); }
+    void Clear() {
+      str2id.clear();
+      id2str.clear();
+    }
+  };
+
+  std::vector<Sample> _vs; // vector of training_samples
+  StringBag _label_bag;
+  MiniStringBag _featurename_bag;
+  std::vector<double> _vl;  // vector of lambda
+  ME_FeatureBag _fb;
+  int _num_classes;
+  std::vector<double> _vee;  // empirical expectation
+  std::vector<double> _vme;  // empirical expectation
+  std::vector< std::vector< int > > _feature2mef;
+  std::vector< Sample > _heldout;
+  double _train_error;   // current error rate on the training data
+  double _heldout_error; // current error rate on the heldout data
+  int _nheldout;
+  int _early_stopping_n;
+  std::vector<double> _vhlogl;
+  const ME_Model * _ref_modelp;
+
+  double heldout_likelihood();
+  int conditional_probability(const Sample & nbs, std::vector<double> & membp) const;
+  int make_feature_bag(const int cutoff);
+  int classify(const Sample & nbs, std::vector<double> & membp) const;
+  double update_model_expectation();
+  int perform_QUASI_NEWTON();
+  int perform_SGD();
+  int perform_GIS(int C);
+  std::vector<double> perform_LBFGS(const std::vector<double> & x0);
+  std::vector<double> perform_OWLQN(const std::vector<double> & x0, const double C);
+  double backtracking_line_search(const Vec & x0, const Vec & grad0, const double f0, const Vec & dx, Vec & x, Vec & grad1);
+  double regularized_func_grad(const double C, const Vec & x, Vec & grad);
+  double constrained_line_search(double C, const Vec & x0, const Vec & grad0, const double f0, const Vec & dx, Vec & x, Vec & grad1);
+
+
+  void set_ref_dist(Sample & s) const;
+  void init_feature2mef();
+
+  double FunctionGradient(const std::vector<double> & x, std::vector<double> & grad);
+  static double FunctionGradientWrapper(const std::vector<double> & x, std::vector<double> & grad);
+  
+};
+
+
+#endif
+
+
+/*
+ * $Log: maxent.h,v $
+ * Revision 1.1.1.1  2007/05/15 08:30:35  kyoshida
+ * stepp tagger, by Okanohara and Tsuruoka
+ *
+ * Revision 1.24  2006/08/21 17:30:38  tsuruoka
+ * use MAX_LABEL_TYPES
+ *
+ * Revision 1.23  2006/07/25 13:19:53  tsuruoka
+ * sort _vs[]
+ *
+ * Revision 1.22  2006/07/18 11:13:15  tsuruoka
+ * modify comments
+ *
+ * Revision 1.21  2006/07/18 10:02:15  tsuruoka
+ * remove sample2feature[]
+ * speed up conditional_probability()
+ *
+ * Revision 1.20  2006/07/18 05:10:51  tsuruoka
+ * add ref_dist
+ *
+ * Revision 1.19  2005/12/23 10:33:02  tsuruoka
+ * support real-valued features
+ *
+ * Revision 1.18  2005/12/23 09:15:29  tsuruoka
+ * modify _train to reduce memory consumption
+ *
+ * Revision 1.17  2005/10/28 13:02:34  tsuruoka
+ * set_heldout(): add default value
+ * Feature()
+ *
+ * Revision 1.16  2005/09/12 13:51:16  tsuruoka
+ * Sample: list -> vector
+ *
+ * Revision 1.15  2005/09/12 13:27:10  tsuruoka
+ * add add_training_sample()
+ *
+ * Revision 1.14  2005/04/27 11:22:27  tsuruoka
+ * bugfix
+ * ME_Sample: list -> vector
+ *
+ * Revision 1.13  2005/04/27 10:20:19  tsuruoka
+ * MiniStringBag -> StringBag
+ *
+ * Revision 1.12  2005/04/27 10:00:42  tsuruoka
+ * remove tmpfb
+ *
+ * Revision 1.11  2005/04/26 14:25:53  tsuruoka
+ * add MiniStringBag, USE_HASH_MAP
+ *
+ * Revision 1.10  2004/10/04 05:50:25  tsuruoka
+ * add Clear()
+ *
+ * Revision 1.9  2004/08/09 12:27:21  tsuruoka
+ * change messages
+ *
+ * Revision 1.8  2004/08/04 13:55:19  tsuruoka
+ * modify _sample2feature
+ *
+ * Revision 1.7  2004/07/29 05:51:13  tsuruoka
+ * remove modeldata.h
+ *
+ * Revision 1.6  2004/07/28 13:42:58  tsuruoka
+ * add AGIS
+ *
+ * Revision 1.5  2004/07/28 05:54:14  tsuruoka
+ * get_class_name() -> get_class_label()
+ * ME_Feature: bugfix
+ *
+ * Revision 1.4  2004/07/27 16:58:47  tsuruoka
+ * modify the interface of classify()
+ *
+ * Revision 1.3  2004/07/26 17:23:46  tsuruoka
+ * _sample2feature: list -> vector
+ *
+ * Revision 1.2  2004/07/26 15:49:23  tsuruoka
+ * modify ME_Feature
+ *
+ * Revision 1.1  2004/07/26 13:10:55  tsuruoka
+ * add files
+ *
+ * Revision 1.18  2004/07/22 08:34:45  tsuruoka
+ * modify _sample2feature[]
+ *
+ * Revision 1.17  2004/07/21 16:33:01  tsuruoka
+ * remove some comments
+ *
+ */
diff --git a/src/modules/imagery/imagery_maxent/me.cpp b/src/modules/imagery/imagery_maxent/me.cpp
new file mode 100644
index 0000000..c5da854
--- /dev/null
+++ b/src/modules/imagery/imagery_maxent/me.cpp
@@ -0,0 +1,274 @@
+/////////////////////////////////////////////////////////////////////////
+//Copyright (C) 2003 Dekang Lin, lindek at cs.ualberta.ca
+//
+//Permission to use, copy, modify, and distribute this software for any
+//purpose is hereby granted without fee, provided that the above
+//copyright notice appear in all copies and that both that copyright
+//notice and this permission notice appear in supporting documentation.
+//No representations about the suitability of this software for any
+//purpose is made. It is provided "as is" without express or implied
+//warranty.
+//
+/////////////////////////////////////////////////////////////////////////
+
+#include <iostream>
+#include <cmath>
+#include <float.h>
+
+#include "me.h"
+
+/////////////////////////////////////////////////////////////////////////
+#ifdef _SAGA_MSW
+#define isinf(x) (!_finite(x))
+#else
+#define isinf(x) (!finite(x))
+#endif
+
+/** The input array contains a set of log probabilities lp1, lp2, lp3
+    ... The return value should be the log of the sum of the
+    probabilities: log(e^lp1 + e^lp2 + e^lp3 + ...) */
+double sumLogProb(vector<double>& logprobs)
+{
+  double max = 0;
+  unsigned int i;
+  for (i = 0; i<logprobs.size(); i++) {
+    if (i==0 || logprobs[i]>max)
+      max = logprobs[i];
+  }
+  if (isinf(max)) // the largest probability is 0 (log prob= -inf)
+    return max;   // return log 0
+  double p = 0;
+  for (i = 0; i<logprobs.size(); i++) {
+    p += exp(logprobs[i]-max);
+  }
+  return max + log(p);
+}
+
+/** returns log (e^logprob1 + e^logprob2). */
+double sumLogProb(double logprob1, double logprob2)
+{
+  if (isinf(logprob1) && isinf(logprob2)) 
+    return logprob1; // both prob1 and prob2 are 0, return log 0.
+  if (logprob1>logprob2)
+    return logprob1+log(1+exp(logprob2-logprob1));
+  else
+    return logprob2+log(1+exp(logprob1-logprob2));
+}
+/////////////////////////////////////////////////////////////////////////
+
+
+void MaxEntModel::addFeature(unsigned long f)
+{
+  _index[f] = _lambda.size();
+  for (unsigned int i = 0; i<_classes; i++) {
+    _lambda.push_back(0);
+  }
+}
+
+void MaxEntModel::print(ostream& ostrm, MaxEntTrainer& trainer)
+{
+  for (FtMap::iterator it = _index.begin(); it!=_index.end(); it++) {
+    unsigned long i = it->second;
+    for (unsigned long c = 0; c<_classes; c++) {
+      ostrm << "lambda(" << trainer.className(c) << ", " 
+	    << trainer.getStr(it->first) << ")=" 
+	    << _lambda[i+c] << endl;
+    }
+  }
+}
+
+int MaxEntModel::getProbs(MaxEntEvent& event, vector<double>& probs)
+{
+  probs.clear();
+  probs.assign(_classes, 0);
+  int max = -1;
+  for (unsigned int c = 0; c<_classes; c++) {
+    double s = 0;
+    for (unsigned int f = 0; f<event.size(); f++) {
+      FtMap::iterator it = _index.find(event[f]);
+      if (it!=_index.end()) 
+	s += _lambda[it->second+c];
+    }
+    probs[c] = s;
+    if (max<0 || probs[max]<s)
+      max = c;
+  }
+  double sum = sumLogProb(probs);
+  for (unsigned int i = 0; i<_classes; i++) {
+    probs[i] = exp(probs[i])/exp(sum);
+  }
+  return max;
+}
+
+EventSet::~EventSet()
+{
+  for (EventSet::iterator it = begin(); it!=end(); it++) {
+    delete *it;
+  }
+}
+
+double MaxEntModel::getExpects(EventSet& events, vector<double>& expects)
+{
+  expects.clear();
+  expects.assign(_lambda.size(), 0);
+  double sumLogProb = 0;
+  for (unsigned int i = 0; i<events.size(); i++) {
+    MaxEntEvent& e = *events[i];
+    vector<double> probs;
+    getProbs(e, probs);
+    for (unsigned long c = 0; c < _classes; ++c) {
+      double count = probs[c] * e.count();
+      for (unsigned long j = 0; j < e.size(); j++) {
+	FtMap::iterator it = _index.find(e[j]);
+	if (it!=_index.end())
+	  expects[it->second + c] += count;
+      }
+    }
+    sumLogProb += log(probs[e.classId()]);
+  }
+  return sumLogProb;
+}
+
+double MaxEntModel::getObsCounts(EventSet& events, vector<double>& obsCounts)
+{
+  vector<double> probs;
+  obsCounts.clear();
+  obsCounts.assign(_lambda.size(), 0);
+  double maxFtSum = 0;
+  for (unsigned int i = 0; i<events.size(); i++) {
+    MaxEntEvent& e = *events[i];
+    unsigned long c = e.classId();
+    double count = e.count();
+    double ftSum = 0;
+    for (unsigned long j=0; j<e.size(); j++) {
+      FtMap::iterator it = _index.find(e[j]);
+      if (it!=_index.end()) 
+	obsCounts[it->second+c] += count;
+      else { // new feature, need to expand obsCounts and _lambda
+	for (unsigned int k = 0; k<_classes; k++) 
+	  obsCounts.push_back(0);
+	obsCounts[_lambda.size()+c] += count;
+	addFeature(e[j]);
+      }
+      ftSum++;
+    }
+    if (ftSum>maxFtSum)
+      maxFtSum = ftSum;
+  }
+  return maxFtSum;
+}
+
+void GISTrainer::train(MaxEntModel& model, EventSet& events)
+{
+  vector<double> obsCounts, expects;
+  double C = model.getObsCounts(events, obsCounts);
+  double sumLogProb=0, prevSumLogProb=0;
+  for (int i = 0; i<_maxIterations; i++) {
+    sumLogProb = model.getExpects(events, expects);
+    if (_printDetails)
+      cerr << "Iteration " << i+1 <<  " logProb=" << sumLogProb << endl;
+    if (i>0 && sumLogProb-prevSumLogProb<=_threshold)
+      break;
+    prevSumLogProb = sumLogProb;
+    vector<double>& lambda = model.lambda();
+    for (unsigned int i = 0; i<lambda.size(); i++) {
+      double obs = (obsCounts[i]-_alpha);
+      double newLambda = 0;
+      if (obs>0)
+	newLambda = lambda[i]+log(obs/expects[i])/C;
+      if (newLambda>0)
+	lambda[i] = newLambda;
+      else
+	lambda[i] = 0;
+    }
+  }
+}
+
+unsigned long MaxEntTrainer::getClassId(string c)
+{
+  for (unsigned long i = 0; i<_classes.size(); i++) {
+    if (c==_classes[i])
+      return i;
+  }
+  return _classes.size();
+}
+
+double MaxEntTrainer::Test_Event(MaxEntEvent &Event, MaxEntModel &Model)
+{
+	vector<double> probs;
+	double total=0, error = 0;
+
+	int c = Model.getProbs(Event, probs);
+
+	if( c != (int)Event.classId() )
+	{
+		error++;
+	}
+
+	cerr << className(Event.classId()) << '\t';
+
+	for (unsigned int cl = 0; cl<probs.size(); cl++)
+	{
+		cerr << className(cl) << ' ' << probs[cl] << '\t';
+	}
+	cerr << endl;
+
+	return c;
+}
+
+double MaxEntTrainer::test(EventSet& events, MaxEntModel& model)
+{
+  vector<double> probs;
+  double total=0, error = 0;
+  for (unsigned int i = 0; i<events.size(); i++) {
+    int c = model.getProbs(*events[i], probs);
+    if (c!=(int)events[i]->classId()) {
+      error++;
+      if (_printDetails) cerr << '*';
+    }
+    if (_printDetails) {
+      cerr << className(events[i]->classId()) << '\t';
+      for (unsigned int cl = 0; cl<probs.size(); cl++) {
+	cerr << className(cl) << ' ' << probs[cl] << '\t';
+      }
+      cerr << endl;
+    }
+    total++;
+  }
+  return error/total;
+}
+
+void MaxEntTrainer::Add_Event(EventSet &events, const char *name, const char *data)
+{
+	const string delims(" ");
+
+	MaxEntEvent	*event	= new MaxEntEvent;
+	getIds(data, *event, delims);
+	event->classId(getClassId(name));
+	event->count(1);
+	events.push_back(event);
+}
+
+void MaxEntTrainer::readEvents(istream& istrm, EventSet& events)
+{
+  string line, cls;
+  const string delims(" ");
+  while ((istrm>>cls) && getline(istrm, line)) {
+    MaxEntEvent* event = new MaxEntEvent;
+    getIds(line, *event, delims);
+    event->classId(getClassId(cls));
+    event->count(1);
+    events.push_back(event);
+  }
+}
+
+void MaxEntTrainer::loadParams(istream& istrm)
+{
+  string name;
+  int c;
+  istrm >> _alpha >> _threshold >> _maxIterations;
+  istrm >> c;
+  for (int i = 0; i<c && (istrm >> name); i++) {
+    addClass(name);
+  }
+}
diff --git a/src/modules/imagery/imagery_maxent/me.h b/src/modules/imagery/imagery_maxent/me.h
new file mode 100644
index 0000000..87781e1
--- /dev/null
+++ b/src/modules/imagery/imagery_maxent/me.h
@@ -0,0 +1,203 @@
+/////////////////////////////////////////////////////////////////////////
+//Copyright (C) 2003 Dekang Lin, lindek at cs.ualberta.ca
+//
+//Permission to use, copy, modify, and distribute this software for any
+//purpose is hereby granted without fee, provided that the above
+//copyright notice appear in all copies and that both that copyright
+//notice and this permission notice appear in supporting documentation.
+//No representations about the suitability of this software for any
+//purpose is made. It is provided "as is" without express or implied
+//warranty.
+//
+/////////////////////////////////////////////////////////////////////////
+
+#ifndef ME_H
+#define ME_H
+
+/////////////////////////////////////////////////////////////////////////
+#ifndef STR2IDMAP_H
+#define STR2IDMAP_H
+
+#include <vector>
+#include <string>
+#include <map>
+using namespace std;
+
+/** Establish a mapping between strings and integers so that a string
+ can be converted to an integer id as well as the other way
+ around. The integer id 0 is always reserved for the empty string. The
+ ids of other strings begin with 1. 
+*/
+class Str2IdMap {
+  map<string, unsigned long> _toId; // mapping from string to id
+  vector<string> _toStr;            // mapping from id to string
+public:
+  /** return the string corresponding to an id */
+  string getStr(unsigned long id) {
+    return _toStr[id];
+  }
+  
+  Str2IdMap() { _toStr.push_back(""); }
+
+  /** Return the id corresponding to the string. If it is not
+      currently in the mapping, it will be added to the mapping and
+      assigned an id. */
+  unsigned long getId(string str) {
+    map<string, unsigned long>::iterator f = _toId.find(str);
+    unsigned long id;
+    if (f==_toId.end()) {
+      id = _toStr.size();
+      _toId[str] = id;
+      _toStr.push_back(str);
+      return id;
+    }
+    else 
+      return f->second;
+  }
+
+  /** Like getId() except that if the string is not currently in the
+      mapping, the id 0 will be returned and it is NOT added to the
+      mapping. */
+  unsigned long getExistingId(string str) {
+    map<string, unsigned long>::iterator f = _toId.find(str);
+    if (f==_toId.end()) 
+      return 0;
+    else 
+      return f->second;
+  }
+
+  /** Convert the sequence of tokens in line into a sequence of
+      integer ids. delim is the separator between the tokens.  */
+  void getIds(string line, vector<unsigned long>& seq, string delim) {
+    string::size_type begIdx, endIdx;
+    begIdx = line.find_first_not_of(delim);
+    while (begIdx!=string::npos) {
+      endIdx = line.find_first_of(delim, begIdx);
+      if (endIdx==string::npos) {
+	endIdx = line.length();
+      }
+      string word = line.substr(begIdx, endIdx-begIdx);
+      seq.push_back(getId(word));
+      begIdx = line.find_first_not_of(delim, endIdx);
+    }
+  }
+};
+
+#endif
+/////////////////////////////////////////////////////////////////////////
+
+
+class MaxEntTrainer;
+
+/** A Event consists of a set of binary features (corresponding to the
+    integers in the vector).
+*/
+class MaxEntEvent : public vector<unsigned long> {
+  double _count; // the number of instances of this event (typicall 1).
+  unsigned long _classId; // the class that this event belongs to.
+public:
+  double count() const { return _count;}
+  void count(double c) { _count = c;}
+  unsigned long classId() { return _classId;}
+  void classId(unsigned long id) { _classId = id;}
+  MaxEntEvent() {
+    _count = 0;
+    _classId = 0;
+  }
+};
+  
+/** A set of events. */
+class EventSet : public vector<MaxEntEvent*> {
+public:
+  ~EventSet();
+};
+
+/**
+   The parameters in a maximum entropy classifier. 
+ */
+class MaxEntModel {
+  typedef map<unsigned long, unsigned long> FtMap;
+  unsigned long _classes; // the number of possible output classes
+  FtMap _index;           // mapping features to indices in the _lambda vector
+  vector<double> _lambda; // _lambda[_index[f]+c] is the lambda value for
+                          // feature f and class c;
+public:
+  MaxEntModel(unsigned long classes=0) { _classes = classes;}
+
+  vector<double>& lambda() { return _lambda;}
+
+  /** Compute the probability of all classes given the event. Return
+      the class with the highest probability. */
+  int getProbs(MaxEntEvent& event, vector<double>& probs);
+
+  /** Compute the observed counts of all features. Return the maximum
+      number of features in any event. */
+  double getObsCounts(EventSet& events, vector<double>& obsCounts);  
+
+  /** Compute the expected value of all features. Return the log
+      likelihood of the events.*/
+  double getExpects(EventSet& events, vector<double>& expects);
+
+  void classes(unsigned long classes) { _classes = classes;}
+
+  /** Add a feature to the model. */
+  void addFeature(unsigned long f);
+
+  /** print the parameters in the model. */
+  void print(ostream& ostrm, MaxEntTrainer& trainer);
+};
+
+/** The super class of all trainers for Maximum Entropy Models. It is
+    also responsible for converting string form of features and
+    classes into integer ids.  */
+class MaxEntTrainer : public Str2IdMap {
+protected:
+  vector<string> _classes;
+  double _alpha; // used as exponential prior
+  double _threshold; // stop running GIS if the log likelihood is
+                     // smaller than this
+  double _maxIterations;
+
+  bool _printDetails; 
+public:  
+  MaxEntTrainer() { _alpha = 0.1; _threshold = 0; _maxIterations = 100; _printDetails = false;}
+
+	void	Set_Alpha			(double alpha)		{	_alpha			= alpha;		}
+	void	Set_Threshold		(double threshold)	{	_threshold		= threshold;	}
+	void	Set_Iterations		(double Iterations)	{	_maxIterations	= Iterations;	}
+
+	void	Add_Event			(EventSet &events, const char *name, const char *data);
+
+	double	Test_Event			(MaxEntEvent &Event, MaxEntModel &Model);
+
+  void printDetails(bool flag) { _printDetails = flag;}
+
+  virtual void train(MaxEntModel& model, EventSet& events) = 0;
+
+  vector<string>& classes() { return _classes;}
+
+  void addClass(string c) { _classes.push_back(c); }
+
+  //  unsigned long getClass(unsigned long c) { return _classes[c];}
+  string className(unsigned long c) { return _classes[c];}
+
+  unsigned long getClassId(string c);
+
+  /** Test the classification of the events. Return the error rate. */
+  double test(EventSet& events, MaxEntModel& model);
+
+  /** Read a set of events from istrm. Each event occupies a line. The
+      first token is the class. The rest of the line are the features. */
+  void readEvents(istream& istrm, EventSet& events);
+
+  void loadParams(istream& istrm);
+
+  virtual ~MaxEntTrainer() {};
+};
+
+class GISTrainer : public MaxEntTrainer {
+public:
+  virtual void train(MaxEntModel& model, EventSet& events);
+};
+
+#endif
diff --git a/src/modules/imagery/imagery_maxent/owlqn.cpp b/src/modules/imagery/imagery_maxent/owlqn.cpp
new file mode 100644
index 0000000..70615bc
--- /dev/null
+++ b/src/modules/imagery/imagery_maxent/owlqn.cpp
@@ -0,0 +1,136 @@
+#include <vector>
+#include <iostream>
+#include <cmath>
+#include "mathvec.h"
+#include "lbfgs.h"
+#include "maxent.h"
+
+using namespace std;
+
+const static int    M = LBFGS_M;
+const static double LINE_SEARCH_ALPHA = 0.1;
+const static double LINE_SEARCH_BETA  = 0.5;
+
+// stopping criteria
+int    OWLQN_MAX_ITER      = 300;
+const static double MIN_GRAD_NORM = 0.0001;
+
+
+Vec approximate_Hg(const int iter, const Vec & grad,
+		   const Vec s[],  const Vec y[], const double z[]);
+
+
+inline int sign(double x) 
+{
+  if (x > 0) return 1;
+  if (x < 0) return -1;
+  return 0;
+};
+
+static Vec
+pseudo_gradient(const Vec & x, const Vec & grad0, const double C)
+{
+  Vec grad = grad0;
+  for (size_t i = 0; i < x.Size(); i++) {
+    if (x[i] != 0) {
+      grad[i] += C * sign(x[i]);
+      continue;
+    }
+    const double gm = grad0[i] - C;
+    if (gm > 0) {
+      grad[i] = gm;
+      continue;
+    }
+    const double gp = grad0[i] + C;
+    if (gp < 0) {
+      grad[i] = gp;
+      continue;
+    }
+    grad[i] = 0;
+  }
+
+  return grad;
+}
+
+double 
+ME_Model::regularized_func_grad(const double C, const Vec & x, Vec & grad)
+{
+  double f = FunctionGradient(x.STLVec(), grad.STLVec());
+  for (size_t i = 0; i < x.Size(); i++) {
+    f += C * fabs(x[i]);
+  }
+
+  return f;
+}
+
+double 
+ME_Model::constrained_line_search(double C,
+			const Vec & x0, const Vec & grad0, const double f0, 
+			const Vec & dx, Vec & x, Vec & grad1)
+{
+  // compute the orthant to explore
+  Vec orthant = x0;
+  for (size_t i = 0; i < orthant.Size(); i++) {
+    if (orthant[i] == 0) orthant[i] = -grad0[i];
+  }
+
+  double t = 1.0 / LINE_SEARCH_BETA;
+
+  double f;
+  do {
+    t *= LINE_SEARCH_BETA;
+    x = x0 + t * dx;
+    x.Project(orthant);
+    //    for (size_t i = 0; i < x.Size(); i++) {
+    //      if (x0[i] != 0 && sign(x[i]) != sign(x0[i])) x[i] = 0;
+    //    }
+
+    f = regularized_func_grad(C, x, grad1);
+    //        cout << "*";
+  } while (f > f0 + LINE_SEARCH_ALPHA * dot_product(x - x0, grad0));
+
+  return f;
+}
+
+vector<double> 
+ME_Model::perform_OWLQN(const vector<double> & x0, const double C)
+{
+  const size_t dim = x0.size();
+  Vec x = x0;
+
+  Vec grad(dim), dx(dim);
+  double f = regularized_func_grad(C, x, grad);
+
+  Vec s[M], y[M];
+  double z[M];  // rho
+
+  for (int iter = 0; iter < OWLQN_MAX_ITER; iter++) {
+    Vec pg = pseudo_gradient(x, grad, C);
+
+    fprintf(stderr, "%3d  obj(err) = %f (%6.4f)", iter+1, -f, _train_error);
+    if (_nheldout > 0) {
+      const double heldout_logl = heldout_likelihood();
+      fprintf(stderr, "  heldout_logl(err) = %f (%6.4f)", heldout_logl, _heldout_error);
+    }
+    fprintf(stderr, "\n");
+
+    if (sqrt(dot_product(pg, pg)) < MIN_GRAD_NORM) break;
+
+    dx = -1 * approximate_Hg(iter, pg, s, y, z);
+    if (dot_product(dx, pg) >= 0)
+      dx.Project(-1 * pg);
+
+    Vec x1(dim), grad1(dim);
+    f = constrained_line_search(C, x, pg, f, dx, x1, grad1);
+
+    s[iter % M] = x1 - x;
+    y[iter % M] = grad1 - grad;
+    z[iter % M] = 1.0 / dot_product(y[iter % M], s[iter % M]);
+
+    x = x1;
+    grad = grad1;
+  }
+
+  return x.STLVec();
+}
+
diff --git a/src/modules/imagery/imagery_maxent/presence_prediction.cpp b/src/modules/imagery/imagery_maxent/presence_prediction.cpp
new file mode 100644
index 0000000..b55459a
--- /dev/null
+++ b/src/modules/imagery/imagery_maxent/presence_prediction.cpp
@@ -0,0 +1,641 @@
+/**********************************************************
+ * Version $Id: template.cpp 911 2011-11-11 11:11:11Z oconrad $
+ *********************************************************/
+
+///////////////////////////////////////////////////////////
+//                                                       //
+//                         SAGA                          //
+//                                                       //
+//      System for Automated Geoscientific Analyses      //
+//                                                       //
+//                    Module Library:                    //
+//                        maxent                         //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//                presence_prediction.cpp                //
+//                                                       //
+//                 Copyright (C) 2015 by                 //
+//                     Olaf Conrad                       //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+// This file is part of 'SAGA - System for Automated     //
+// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
+//                                                       //
+// SAGA is distributed in the hope that it will be       //
+// useful, but WITHOUT ANY WARRANTY; without even the    //
+// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
+// PARTICULAR PURPOSE. See the GNU General Public        //
+// License for more details.                             //
+//                                                       //
+// You should have received a copy of the GNU General    //
+// Public License along with this program; if not,       //
+// write to the Free Software Foundation, Inc.,          //
+// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
+// USA.                                                  //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//    e-mail:     oconrad at saga-gis.de                    //
+//                                                       //
+//    contact:    Olaf Conrad                            //
+//                Institute of Geography                 //
+//                University of Hamburg                  //
+//                Germany                                //
+//                                                       //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#include "presence_prediction.h"
+
+//---------------------------------------------------------
+#include "me.h"
+
+//---------------------------------------------------------
+using namespace std;
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+CPresence_Prediction::CPresence_Prediction(void)
+{
+	CSG_Parameter	*pNode;
+
+	//-----------------------------------------------------
+	Set_Name		(_TL("Maximum Entropy Presence Prediction"));
+
+	Set_Author		("O.Conrad (c) 2015");
+
+	Set_Description	(_TW(
+		"\nReferences:\n"
+		"- Yoshimasa Tsuruoka: A simple C++ library for maximum entropy classification. "
+		" <a target=\"_blank\" href=\"http://www.logos.t.u-tokyo.ac.jp/~tsuruoka/maxent/\">online</a>.\n"
+		"- Dekang Lin: A MaxEnt Package in C++. "
+		" <a target=\"_blank\" href=\"http://webdocs.cs.ualberta.ca/~lindek/downloads.htm\">online</a>.\n"
+	));
+
+	//-----------------------------------------------------
+	Parameters.Add_Shapes(
+		NULL	, "PRESENCE"		, _TL("Presence Data"),
+		_TL(""),
+		PARAMETER_INPUT, SHAPE_TYPE_Point
+	);
+
+	Parameters.Add_Grid_List(
+		NULL	, "FEATURES_NUM"	, _TL("Numerical Features"),
+		_TL(""),
+		PARAMETER_INPUT_OPTIONAL
+	);
+
+	Parameters.Add_Grid_List(
+		NULL	, "FEATURES_CAT"	, _TL("Categorical Features"),
+		_TL(""),
+		PARAMETER_INPUT_OPTIONAL
+	);
+
+	Parameters.Add_Grid(
+		NULL	, "PREDICTION"		, _TL("Presence Prediction"),
+		_TL(""),
+		PARAMETER_OUTPUT, true, SG_DATATYPE_Char
+	);
+
+	Parameters.Add_Grid(
+		NULL	, "PROBABILITY"		, _TL("Presence Probability"),
+		_TL(""),
+		PARAMETER_OUTPUT
+	);
+
+	Parameters.Add_Value(
+		NULL	, "BACKGROUND"		, _TL("Background Sample Density [Percent]"),
+		_TL(""),
+		PARAMETER_TYPE_Double, 1, 0.0, true, 100, true
+	);
+
+	//-----------------------------------------------------
+	Parameters.Add_Choice(
+		NULL	, "METHOD"			, _TL("Method"),
+		_TL(""),
+		CSG_String::Format("%s|%s|",
+			_TL("Yoshimasa Tsuruoka"),
+			_TL("Dekang Lin")
+		)
+	);
+
+	//-----------------------------------------------------
+	Parameters.Add_FilePath(
+		NULL	, "YT_FILE_LOAD"	, _TL("Load from File..."),
+		_TL(""),
+		NULL, NULL, false
+	);
+
+	Parameters.Add_FilePath(
+		NULL	, "YT_FILE_SAVE"	, _TL("Save to File..."),
+		_TL(""),
+		NULL, NULL, true
+	);
+
+	pNode	= Parameters.Add_Choice(
+		NULL	, "YT_REGUL"		, _TL("Regularization"),
+		_TL(""),
+		CSG_String::Format(SG_T("%s|%s|%s|"),
+			_TL("none"),
+			SG_T("L1"),
+			SG_T("L2")
+		), 1
+	);
+
+	Parameters.Add_Value(
+		pNode	, "YT_REGUL_VAL"	, _TL("Regularization Factor"),
+		_TL(""),
+		PARAMETER_TYPE_Double, 1.0, 0.0, true
+	);
+
+	Parameters.Add_Value(
+		NULL	, "YT_NUMASREAL"	, _TL("Real-valued Numerical Features"),
+		_TL(""),
+		PARAMETER_TYPE_Bool, true
+	);
+
+	//-----------------------------------------------------
+	Parameters.Add_Value(
+		NULL	, "DL_ALPHA"		, _TL("Alpha"),
+		_TL(""),
+		PARAMETER_TYPE_Double, 0.1
+	);
+
+	Parameters.Add_Value(
+		NULL	, "DL_THRESHOLD"	, _TL("Threshold"),
+		_TL(""),
+		PARAMETER_TYPE_Double, 0.0, 0.0, true
+	);
+
+	Parameters.Add_Value(
+		NULL	, "DL_ITERATIONS"	, _TL("Maximum Iterations"),
+		_TL(""),
+		PARAMETER_TYPE_Int, 100, 1, true
+	);
+
+	//-----------------------------------------------------
+	Parameters.Add_Value(
+		NULL	, "NUM_CLASSES"		, _TL("Number of Numeric Value Classes"),
+		_TL(""),
+		PARAMETER_TYPE_Int, 32, 1, true
+	);
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+int CPresence_Prediction::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+{
+	bool	bFile	= SG_File_Exists(pParameters->Get_Parameter("YT_FILE_LOAD")->asString());
+	int		Method	= pParameters->Get_Parameter("METHOD")->asInt();
+
+	pParameters->Set_Enabled("NUM_CLASSES"  , Method == 1 || !pParameters->Get_Parameter("YT_NUMASREAL")->asBool());
+
+	pParameters->Set_Enabled("TRAINING"     , Method == 1 || !bFile);
+
+	pParameters->Set_Enabled("YT_REGUL"     , Method == 0 && !bFile);
+	pParameters->Set_Enabled("YT_REGUL_VAL" , Method == 0 && !bFile);
+	pParameters->Set_Enabled("YT_FILE_SAVE" , Method == 0 && !bFile);
+	pParameters->Set_Enabled("YT_FILE_LOAD" , Method == 0);
+	pParameters->Set_Enabled("YT_NUMASREAL" , Method == 0);
+
+	pParameters->Set_Enabled("DL_ALPHA"     , Method == 1);
+	pParameters->Set_Enabled("DL_THRESHOLD" , Method == 1);
+	pParameters->Set_Enabled("DL_ITERATIONS", Method == 1);
+
+	return( 1 );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CPresence_Prediction::On_Execute(void)
+{
+	//-----------------------------------------------------
+	EventSet	DL_Events ;	m_DL_Events  = &DL_Events ;
+	GISTrainer	DL_Trainer;	m_DL_Trainer = &DL_Trainer;
+	MaxEntModel	DL_Model  ;	m_DL_Model   = &DL_Model  ;
+
+	m_YT_Model.clear();
+
+	//-----------------------------------------------------
+	CSG_Grid	*pPrediction	= Parameters("PREDICTION" )->asGrid();
+	CSG_Grid	*pProbability	= Parameters("PROBABILITY")->asGrid();
+
+	if( !pPrediction ->Get_ZRange() ) DataObject_Set_Colors(pPrediction , 11, SG_COLORS_YELLOW_GREEN);
+	if( !pProbability->Get_ZRange() ) DataObject_Set_Colors(pProbability, 11, SG_COLORS_YELLOW_GREEN);
+
+	m_Method		= Parameters("METHOD"      )->asInt ();
+	m_nNumClasses	= Parameters("NUM_CLASSES" )->asInt ();
+	m_bYT_Weights	= Parameters("YT_NUMASREAL")->asBool();
+
+	//-----------------------------------------------------
+	CSG_Array	Features;
+
+	if( !Get_Features(Features) )
+	{
+		Error_Set(_TL("invalid features"));
+
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	if( m_Method == 0 && SG_File_Exists(Parameters("YT_FILE_LOAD")->asString()) )
+	{
+		if( !Get_File(Parameters("YT_FILE_LOAD")->asString()) )
+		{
+			return( false );
+		}
+	}
+	else if( !Get_Training() )
+	{
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	Process_Set_Text(_TL("prediction"));
+
+	for(int y=0; y<Get_NY() && Set_Progress(y); y++)
+	{
+		#pragma omp parallel for
+		for(int x=0; x<Get_NX(); x++)
+		{
+			int			i;
+			CSG_Strings	Values;
+
+			for(i=0; i<m_nFeatures; i++)
+			{
+				if( !m_Features[i].pGrid->is_NoData(x, y) )
+				{
+					Values.Add(Get_Feature(x, y, i));
+				}
+				else
+				{
+					break;
+				}
+			}
+
+			if( Values.Get_Count() != m_nFeatures )
+			{
+				pPrediction ->Set_NoData(x, y);
+				pProbability->Set_NoData(x, y);
+			}
+			else switch( m_Method )
+			{
+			//---------------------------------------------
+			default:	// Kyoshida
+				{
+					ME_Sample	Sample;
+
+					for(i=0; i<m_nFeatures; i++)
+					{
+						if( m_bYT_Weights && m_Features[i].bNumeric )
+						{
+							Sample.add_feature(m_Features[i].Name, m_Features[i].pGrid->asDouble(x, y));
+						}
+						else
+						{
+							Sample.add_feature(Values[i].b_str());
+						}
+					}
+
+					vector<double> Probs	= m_YT_Model.classify(Sample);
+
+					pPrediction ->Set_Value(x, y, m_YT_Model.get_class_id(Sample.label) == 0 ? 1 : 0);
+					pProbability->Set_Value(x, y, Probs[0]);
+				}
+				break;
+
+			//---------------------------------------------
+			case  1:	// Dekang Lin
+				{
+					MaxEntEvent Event;	Event.count(1);
+
+					for(i=0; i<m_nFeatures; i++)
+					{
+						Event.push_back(m_DL_Trainer->getId(Values[i].b_str()));
+					}
+
+					vector<double> Probs;
+
+					pPrediction ->Set_Value(x, y, m_DL_Model->getProbs(Event, Probs) == 0 ? 1 : 0);
+					pProbability->Set_Value(x, y, Probs[0]);
+				}
+				break;
+			}
+		}
+	}
+
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+CSG_String CPresence_Prediction::Get_Feature(int x, int y, int i)
+{
+	CSG_Grid	*pFeature	= m_Features[i].pGrid;
+
+	if( m_nNumClasses > 1 && m_Features[i].bNumeric )
+	{
+		return( CSG_String::Format("%d", (int)(m_nNumClasses * (pFeature->asDouble(x, y) - pFeature->Get_ZMin()) / pFeature->Get_ZRange())) );
+	}
+
+	return( SG_Get_String(pFeature->asDouble(x, y), -2) );
+}
+
+//---------------------------------------------------------
+bool CPresence_Prediction::Get_Features(CSG_Array &Features)
+{
+	CSG_Parameter_Grid_List	*pNum	= Parameters("FEATURES_NUM")->asGridList();
+	CSG_Parameter_Grid_List	*pCat	= Parameters("FEATURES_CAT")->asGridList();
+
+	m_Features	= (TFeature *)Features.Create(sizeof(TFeature), m_nFeatures = pNum->Get_Count() + pCat->Get_Count());
+
+	for(int i=0; i<m_nFeatures; i++)
+	{
+		if( i < pNum->Get_Count() )
+		{
+			m_Features[i].bNumeric	= true;
+			m_Features[i].pGrid		= pNum->asGrid(i);
+		}
+		else
+		{
+			m_Features[i].bNumeric	= false;
+			m_Features[i].pGrid		= pCat->asGrid(i - pNum->Get_Count());
+		}
+
+		CSG_String	Name(m_Features[i].pGrid->Get_Name());
+		strncpy(m_Features[i].Name, Name.b_str(), 255);	m_Features[i].Name[255]	= '\0';
+	}
+
+	return( m_nFeatures > 0 );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CPresence_Prediction::Get_Training(void)
+{
+	//-----------------------------------------------------
+	Process_Set_Text(_TL("collecting presence data"));
+
+	if( m_Method == 1 )	// Dekang Lin
+	{
+		m_DL_Trainer->addClass("0");
+		m_DL_Trainer->addClass("1");
+	}
+
+	CSG_Shapes	*pPresence	= Parameters("PRESENCE")->asShapes();
+
+	if( pPresence->Get_Count() < 1 )
+	{
+		Error_Set(_TL("invalid training data"));
+
+		return( false );
+	}
+
+	for(int iPoint=0; iPoint<pPresence->Get_Count() && Set_Progress(iPoint, pPresence->Get_Count()); iPoint++)
+	{
+		TSG_Point	p	= pPresence->Get_Shape(iPoint)->Get_Point(0);
+
+		int	x	= Get_System()->Get_xWorld_to_Grid(p.x);
+		int	y	= Get_System()->Get_yWorld_to_Grid(p.y);
+
+		Get_Training(x, y, "0");
+	}
+
+	//-----------------------------------------------------
+	Process_Set_Text(_TL("collecting background data"));
+
+	double	Background	= Parameters("BACKGROUND")->asDouble() / 100.0;
+
+	for(int y=0; y<Get_NY() && Set_Progress(y); y++)
+	{
+		for(int x=0; x<Get_NX(); x++)
+		{
+			if( CSG_Random::Get_Uniform() <= Background )
+			{
+				Get_Training(x, y, "1");
+			}
+		}
+	}
+
+	//-----------------------------------------------------
+	Process_Set_Text(_TL("training"));
+
+	switch( m_Method )
+	{
+	//-----------------------------------------------------
+	default:	// Kyoshida
+		switch( Parameters("YT_REGUL")->asInt() )
+		{
+		default:
+			m_YT_Model.use_l1_regularizer(0.0);
+			m_YT_Model.use_l2_regularizer(0.0);
+			break;
+
+		case  1:
+			m_YT_Model.use_l1_regularizer(Parameters("YT_REGUL_VAL")->asDouble());
+			m_YT_Model.use_l2_regularizer(0.0);
+			break;
+
+		case  2:
+			m_YT_Model.use_l1_regularizer(0.0);
+			m_YT_Model.use_l2_regularizer(Parameters("YT_REGUL_VAL")->asDouble());
+			break;
+		}
+
+	//	m_YT_Model.use_SGD(Parameters("SGD_ITER")->asInt());
+
+		m_YT_Model.train();
+
+		{
+		/*	list< pair< pair<string, string>, double > > Features;
+
+			m_YT_Model.get_features(Features);
+
+			for(list< pair< pair<string, string>, double> >::const_iterator i=Features.begin(); i!=Features.end(); i++)
+			{
+				Message_Add(CSG_String::Format("\n%10.3f  %-10s %s",
+					i->second, i->first.first.c_str(), i->first.second.c_str()
+				), false);
+			}/**/
+
+			CSG_String	File(Parameters("YT_FILE_SAVE")->asString());
+
+			if( !File.is_Empty() )
+			{
+				m_YT_Model.save_to_file(File.b_str());
+			}
+		}
+		break;
+
+	//-----------------------------------------------------
+	case  1:	// Dekang Lin
+		m_DL_Trainer->printDetails(true);	// show the parameters during training
+
+		m_DL_Trainer->Set_Alpha     (Parameters("DL_ALPHA"     )->asDouble());
+		m_DL_Trainer->Set_Threshold (Parameters("DL_THRESHOLD" )->asDouble());
+		m_DL_Trainer->Set_Iterations(Parameters("DL_ITERATIONS")->asInt());
+
+		m_DL_Model->classes(m_DL_Trainer->classes().size());
+
+		m_DL_Trainer->train(*m_DL_Model, *m_DL_Events);	// train the model
+
+		break;
+	}
+
+	//-----------------------------------------------------
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CPresence_Prediction::Get_Training(int x, int y, const char *ID)
+{
+	int		i;
+
+	//-----------------------------------------------------
+	CSG_Strings	Values;
+
+	for(i=0; i<m_nFeatures; i++)
+	{
+		if( !m_Features[i].pGrid->is_InGrid(x, y) )
+		{
+			return( false );
+		}
+
+		Values.Add(Get_Feature(x, y, i));
+	}
+
+	//-----------------------------------------------------
+	switch( m_Method )
+	{
+	//-----------------------------------------------------
+	default:	// Kyoshida
+		{
+			ME_Sample	Sample(ID);
+
+			for(i=0; i<m_nFeatures; i++)
+			{
+				if( m_bYT_Weights && m_Features[i].bNumeric )
+				{
+					Sample.add_feature(m_Features[i].Name, m_Features[i].pGrid->asDouble(x, y));
+				}
+				else
+				{
+					Sample.add_feature(Values[i].b_str());
+				}
+			}
+
+			m_YT_Model.add_training_sample(Sample);
+		}
+		break;
+
+	//-----------------------------------------------------
+	case  1:	// Dekang Lin
+		{
+			MaxEntEvent	*pEvent	= new MaxEntEvent;
+
+			pEvent->count(1);
+			pEvent->classId(m_DL_Trainer->getClassId(ID));
+
+			for(i=0; i<m_nFeatures; i++)
+			{
+				pEvent->push_back(m_DL_Trainer->getId(Values[i].b_str()));
+			}
+
+			m_DL_Events->push_back(pEvent);
+		}
+		break;
+	}
+
+	//-----------------------------------------------------
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CPresence_Prediction::Get_File(const CSG_String &File)
+{
+	//-----------------------------------------------------
+	if( !m_YT_Model.load_from_file(File.b_str()) )
+	{
+		Error_Set(_TL("could not load model from file"));
+
+		return( false );
+	}
+
+	//-----------------------------------------------------
+/*	list< pair< pair<string, string>, double > > Features;
+
+	m_YT_Model.get_features(Features);
+
+	if( (int)Features.size() != m_nFeatures )
+	{
+		Error_Set(_TL("number of model features do not fit input features list"));
+
+		return( false );
+	}/**/
+
+	//-----------------------------------------------------
+	if( m_YT_Model.num_classes() <= 1 )
+	{
+		Error_Set(_TL("less than two classes in model"));
+
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
diff --git a/src/modules/pointcloud/pointcloud_tools/pc_cut.h b/src/modules/imagery/imagery_maxent/presence_prediction.h
similarity index 71%
copy from src/modules/pointcloud/pointcloud_tools/pc_cut.h
copy to src/modules/imagery/imagery_maxent/presence_prediction.h
index f59cc9b..9d30c3b 100644
--- a/src/modules/pointcloud/pointcloud_tools/pc_cut.h
+++ b/src/modules/imagery/imagery_maxent/presence_prediction.h
@@ -1,140 +1,146 @@
-/**********************************************************
- * Version $Id: pc_cut.h 1921 2014-01-09 10:24:11Z oconrad $
- *********************************************************/
-
-///////////////////////////////////////////////////////////
-//                                                       //
-//                         SAGA                          //
-//                                                       //
-//      System for Automated Geoscientific Analyses      //
-//                                                       //
-//                    Module Library:                    //
-//                   pointcloud_tools                    //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//                       pc_cut.h                        //
-//                                                       //
-//                 Copyright (C) 2009 by                 //
-//                      Olaf Conrad                      //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-// This file is part of 'SAGA - System for Automated     //
-// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
-//                                                       //
-// SAGA is distributed in the hope that it will be       //
-// useful, but WITHOUT ANY WARRANTY; without even the    //
-// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
-// PARTICULAR PURPOSE. See the GNU General Public        //
-// License for more details.                             //
-//                                                       //
-// You should have received a copy of the GNU General    //
-// Public License along with this program; if not,       //
-// write to the Free Software Foundation, Inc.,          //
-// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
-// USA.                                                  //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//    e-mail:     oconrad at saga-gis.org                   //
-//                                                       //
-//    contact:    Olaf Conrad                            //
-//                Institute of Geography                 //
-//                University of Hamburg                  //
-//                Germany                                //
-//                                                       //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#ifndef HEADER_INCLUDED__PC_Cut_H
-#define HEADER_INCLUDED__PC_Cut_H
-
-//---------------------------------------------------------
-#include "MLB_Interface.h"
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-class CPC_Cut : public CSG_Module
-{
-public:
-	CPC_Cut(void);
-
-	virtual CSG_String			Get_MenuPath			(void)	{	return( _TL("R:Tools") );	}
-
-	static bool					Get_Cut					(CSG_PointCloud *pPoints, CSG_PointCloud *pCut, const CSG_Rect &Extent, bool bInverse);
-	static bool					Get_Cut					(CSG_PointCloud *pPoints, CSG_PointCloud *pCut, CSG_Shapes *pPolygons, bool bInverse);
-
-
-protected:
-
-	virtual bool				On_Execute				(void);
-
-
-private:
-
-	static bool					Contains				(CSG_Shapes *pPolygons, double x, double y);
-
-};
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-class CPC_Cut_Interactive : public CSG_Module_Interactive
-{
-public:
-	CPC_Cut_Interactive(void);
-
-	virtual CSG_String			Get_MenuPath			(void)	{	return( _TL("R:Tools") );	}
-
-
-protected:
-
-	virtual bool				On_Execute				(void);
-	virtual bool				On_Execute_Position		(CSG_Point ptWorld, TSG_Module_Interactive_Mode Mode);
-
-
-private:
-
-	CSG_Point					m_ptDown;
-
-	CSG_PointCloud				*m_pPoints, *m_pCut;
-
-	CSG_Shapes					*m_pAOI;
-
-	bool						m_bAOIBox, m_bAdd, m_bInverse;
-
-};
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED__PC_Cut_H
+/**********************************************************
+ * Version $Id: presence_prediction.cpp 911 2011-11-11 11:11:11Z oconrad $
+ *********************************************************/
+
+///////////////////////////////////////////////////////////
+//                                                       //
+//                         SAGA                          //
+//                                                       //
+//      System for Automated Geoscientific Analyses      //
+//                                                       //
+//                    Module Library:                    //
+//                        maxent                         //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//                 presence_prediction.h                 //
+//                                                       //
+//                 Copyright (C) 2015 by                 //
+//                     Olaf Conrad                       //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+// This file is part of 'SAGA - System for Automated     //
+// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
+//                                                       //
+// SAGA is distributed in the hope that it will be       //
+// useful, but WITHOUT ANY WARRANTY; without even the    //
+// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
+// PARTICULAR PURPOSE. See the GNU General Public        //
+// License for more details.                             //
+//                                                       //
+// You should have received a copy of the GNU General    //
+// Public License along with this program; if not,       //
+// write to the Free Software Foundation, Inc.,          //
+// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
+// USA.                                                  //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//    e-mail:     oconrad at saga-gis.de                    //
+//                                                       //
+//    contact:    Olaf Conrad                            //
+//                Institute of Geography                 //
+//                University of Hamburg                  //
+//                Germany                                //
+//                                                       //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#ifndef HEADER_INCLUDED__presence_prediction_H
+#define HEADER_INCLUDED__presence_prediction_H
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#include "MLB_Interface.h"
+
+//---------------------------------------------------------
+#include "maxent.h"
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+class CPresence_Prediction : public CSG_Module_Grid
+{
+public:
+	CPresence_Prediction(void);
+
+	virtual CSG_String			Get_MenuPath	(void)	{	return( _TL("A:Grid|Analysis|Macroecology") );	}
+
+
+protected:
+
+	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+
+	virtual bool				On_Execute				(void);
+
+
+private:
+
+	typedef struct
+	{
+		bool					bNumeric;
+
+		char					Name[256];
+
+		CSG_Grid				*pGrid;
+	}
+	TFeature;
+
+	bool						m_bYT_Weights;
+
+	int							m_Method, m_nNumClasses, m_nFeatures;
+
+	TFeature					*m_Features;
+
+	ME_Model					m_YT_Model;
+
+	class EventSet				*m_DL_Events;
+
+	class GISTrainer			*m_DL_Trainer;
+
+	class MaxEntModel			*m_DL_Model;
+
+
+	CSG_String					Get_Feature		(int x, int y, int i);
+	bool						Get_Features	(CSG_Array &Features);
+
+	bool						Get_Training	(void);
+	bool						Get_Training	(int x, int y, const char *ID);
+
+	bool						Get_File		(const CSG_String &File);
+
+};
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#endif // #ifndef HEADER_INCLUDED__presence_prediction_H
diff --git a/src/modules/imagery/imagery_maxent/sgd.cpp b/src/modules/imagery/imagery_maxent/sgd.cpp
new file mode 100644
index 0000000..ec3de4d
--- /dev/null
+++ b/src/modules/imagery/imagery_maxent/sgd.cpp
@@ -0,0 +1,179 @@
+#include "maxent.h"
+#include <cmath>
+
+using namespace std;
+
+//const double SGD_ETA0 = 1;
+//const double SGD_ITER = 30;
+//const double SGD_ALPHA = 0.85;
+
+
+//#define FOLOS_NAIVE
+//#define FOLOS_LAZY
+#define SGD_CP
+
+inline void
+apply_l1_penalty(const int i, const double u,
+		 vector<double> & _vl, vector<double> & q)
+{
+  double & w = _vl[i];
+  const double z = w;
+  double & qi = q[i];
+  if (w > 0) { 
+    w = max(0.0, w - (u + qi));
+  } else if (w < 0) {
+    w = min(0.0, w + (u - qi));
+  }
+  qi += w - z;
+}
+
+static double
+l1norm(const vector<double>& v)
+{
+  double sum = 0;
+  for (size_t i = 0; i < v.size(); i++) sum += abs(v[i]);
+  return sum;
+}
+
+inline void
+update_folos_lazy(const int iter_sample,
+		  const int k, vector<double> & _vl, const vector<double> & sum_eta,
+		  vector<int> & last_updated)
+{
+  const double penalty = sum_eta[iter_sample] - sum_eta[last_updated[k]];
+  double & x = _vl[k];
+  if (x > 0) x = max(0.0, x - penalty);
+  else       x = min(0.0, x + penalty);
+  last_updated[k] = iter_sample;
+}
+
+int
+ME_Model::perform_SGD()
+{
+  if (_l2reg > 0) {
+    cerr << "error: L2 regularization is currently not supported in SGD mode." << endl;
+    exit(1);
+  }
+
+  cerr << "performing SGD" << endl;
+
+  const double l1param = _l1reg;
+
+  const int d = _fb.Size();
+
+  vector<int> ri(_vs.size());
+  for (size_t i = 0; i < ri.size(); i++) ri[i] = i;
+
+  vector<double> grad(d);
+  int iter_sample = 0;
+  const double eta0 = SGD_ETA0;
+
+  //  cerr << "l1param = " << l1param << endl;
+  cerr << "eta0 = " << eta0 << " alpha = " << SGD_ALPHA << endl;
+
+  double u = 0;
+  vector<double> q(d, 0);
+  vector<int> last_updated(d, 0);
+  vector<double> sum_eta;
+  sum_eta.push_back(0);
+
+  for (int iter = 0; iter < SGD_ITER; iter++) {
+
+    random_shuffle(ri.begin(), ri.end());
+
+    double logl = 0;
+    int ncorrect = 0, ntotal = 0;
+    for (size_t i = 0; i < _vs.size(); i++, ntotal++, iter_sample++) {
+      const Sample & s = _vs[ri[i]];
+
+#ifdef FOLOS_LAZY
+      for (vector<int>::const_iterator j = s.positive_features.begin(); j != s.positive_features.end(); j++){
+	for (vector<int>::const_iterator k = _feature2mef[*j].begin(); k != _feature2mef[*j].end(); k++) {
+	  update_folos_lazy(iter_sample, *k, _vl, sum_eta, last_updated);
+	}
+      }
+#endif
+
+      vector<double> membp(_num_classes);
+      const int max_label = conditional_probability(s, membp);
+
+      const double eta = eta0 * pow(SGD_ALPHA, (double)iter_sample / _vs.size()); // exponential decay
+      //      const double eta = eta0 / (1.0 + (double)iter_sample / _vs.size());
+
+      //      if (iter_sample % _vs.size() == 0) cerr << "eta = " << eta << endl;
+      u += eta * l1param;
+
+      sum_eta.push_back(sum_eta.back() + eta * l1param);
+    
+      logl += log(membp[s.label]);
+      if (max_label == s.label) ncorrect++;
+
+      // binary features
+      for (vector<int>::const_iterator j = s.positive_features.begin(); j != s.positive_features.end(); j++){
+	for (vector<int>::const_iterator k = _feature2mef[*j].begin(); k != _feature2mef[*j].end(); k++) {
+	  const double me = membp[_fb.Feature(*k).label()];
+	  const double ee = (_fb.Feature(*k).label() == s.label ? 1.0 : 0);
+	  const double grad = (me - ee);
+	  _vl[*k] -= eta * grad;
+#ifdef SGD_CP
+	  apply_l1_penalty(*k, u, _vl, q);
+#endif
+	}
+      }
+      // real-valued features
+      for (vector<pair<int, double> >::const_iterator j = s.rvfeatures.begin(); j != s.rvfeatures.end(); j++) {
+	for (vector<int>::const_iterator k = _feature2mef[j->first].begin(); k != _feature2mef[j->first].end(); k++) {
+	  const double me = membp[_fb.Feature(*k).label()];
+	  const double ee = (_fb.Feature(*k).label() == s.label ? 1.0 : 0);
+	  const double grad = (me - ee) * j->second;
+	  _vl[*k] -= eta * grad;
+#ifdef SGD_CP
+	  apply_l1_penalty(*k, u, _vl, q);
+#endif
+	}
+      }
+
+#ifdef FOLOS_NAIVE
+      for (size_t j = 0; j < d; j++) {
+	double & x = _vl[j];
+	if (x > 0) x = max(0.0, x - eta * l1param);
+	else       x = min(0.0, x + eta * l1param);
+      }
+#endif
+
+    }
+    logl /= _vs.size();
+    //    fprintf(stderr, "%4d logl = %8.3f acc = %6.4f ", iter, logl, (double)ncorrect / ntotal);
+
+#ifdef FOLOS_LAZY
+    if (l1param > 0) {
+      for (size_t j = 0; j < d; j++)
+	update_folos_lazy(iter_sample, j, _vl, sum_eta, last_updated);
+    }
+#endif
+
+    double f = logl;
+    if (l1param > 0) {
+      const double l1 = l1norm(_vl); // this is not accurate when lazy update is used
+      //      cerr << "f0 = " <<  update_model_expectation() - l1param * l1 << " ";
+      f -= l1param * l1;
+      int nonzero = 0;
+      for (int j = 0; j < d; j++) if (_vl[j] != 0) nonzero++;
+      //      cerr << " f = " << f << " l1 = " << l1 << " nonzero_features = " << nonzero << endl;
+    }
+    //    fprintf(stderr, "%4d  obj = %7.3f acc = %6.4f", iter+1, f, (double)ncorrect/ntotal);
+    //    fprintf(stderr, "%4d  obj = %f", iter+1, f);
+    fprintf(stderr, "%3d  obj(err) = %f (%6.4f)", iter+1, f, 1 - (double)ncorrect/ntotal);
+
+    if (_nheldout > 0) {
+      double heldout_logl = heldout_likelihood();
+      //      fprintf(stderr, "  heldout_logl = %f  acc = %6.4f\n", heldout_logl, 1 - _heldout_error);
+      fprintf(stderr, "  heldout_logl(err) = %f (%6.4f)", heldout_logl, _heldout_error);
+    }
+    fprintf(stderr, "\n");
+
+    
+  }
+
+  return 0;
+}
diff --git a/src/modules/imagery/imagery_opencv/Makefile.in b/src/modules/imagery/imagery_opencv/Makefile.in
index 344d82a..24e066a 100644
--- a/src/modules/imagery/imagery_opencv/Makefile.in
+++ b/src/modules/imagery/imagery_opencv/Makefile.in
@@ -483,22 +483,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/opencv_svd.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/imagery/imagery_opencv/opencv_fourier.cpp b/src/modules/imagery/imagery_opencv/opencv_fourier.cpp
index b97d08a..aaa5838 100644
--- a/src/modules/imagery/imagery_opencv/opencv_fourier.cpp
+++ b/src/modules/imagery/imagery_opencv/opencv_fourier.cpp
@@ -227,7 +227,6 @@ bool DFT(IplImage *im, IplImage **ppReal, IplImage **ppImag)
 	CvMat* dft_A, tmp;
 	IplImage * image_Re;
 	IplImage * image_Im;
-	double m, M;
 
 	if( !im )
 		return false;
diff --git a/src/modules/imagery/imagery_photogrammetry/Makefile.in b/src/modules/imagery/imagery_photogrammetry/Makefile.in
index 65e7be9..aaaed05 100644
--- a/src/modules/imagery/imagery_photogrammetry/Makefile.in
+++ b/src/modules/imagery/imagery_photogrammetry/Makefile.in
@@ -464,22 +464,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/methods.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/imagery/imagery_segmentation/Makefile.in b/src/modules/imagery/imagery_segmentation/Makefile.in
index 346b905..4e7505f 100644
--- a/src/modules/imagery/imagery_segmentation/Makefile.in
+++ b/src/modules/imagery/imagery_segmentation/Makefile.in
@@ -471,22 +471,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/watershed_segmentation.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/imagery/imagery_segmentation/skeletonization.cpp b/src/modules/imagery/imagery_segmentation/skeletonization.cpp
index 6d563c2..b81cef5 100644
--- a/src/modules/imagery/imagery_segmentation/skeletonization.cpp
+++ b/src/modules/imagery/imagery_segmentation/skeletonization.cpp
@@ -123,7 +123,7 @@ CSkeletonization::CSkeletonization(void)
 
 		CSG_String::Format(SG_T("%s|%s|"),
 			_TL("Less than"),
-			_TL("Greater than") 
+			_TL("Greater than")
 		),1
 	);
 
@@ -171,14 +171,14 @@ bool CSkeletonization::On_Execute(void)
 		switch( Initiation )
 		{
 		case 0: default:
-			if( pInput->asDouble(n) < Threshold )
+			if( !pInput->is_NoData(n) && pInput->asDouble(n) < Threshold )
 			{
 				pResult->Set_Value(n, 1);
 			}
 			break;
 
 		case 1:
-			if( pInput->asDouble(n) > Threshold )
+			if( !pInput->is_NoData(n) && pInput->asDouble(n) > Threshold )
 			{
 				pResult->Set_Value(n, 1);
 			}
@@ -207,14 +207,14 @@ bool CSkeletonization::On_Execute(void)
 			switch( Initiation )
 			{
 			case 0: default:
-				if( pInput->asDouble(n) < Threshold )
+				if( !pInput->is_NoData(n) && pInput->asDouble(n) < Threshold )
 				{
 					pResult->Add_Value(n, 1);
 				}
 				break;
 
 			case 1:
-				if( pInput->asDouble(n) > Threshold )
+				if( !pInput->is_NoData(n) && pInput->asDouble(n) > Threshold )
 				{
 					pResult->Add_Value(n, 1);
 				}
@@ -293,7 +293,7 @@ int CSkeletonization::Vectorize(CSG_Shapes *pShapes)
 			if( pResult->asByte(x, y) )
 			{
 				n	= Get_Neighbours(x, y, pResult, z);
-				
+
 				if( n == 1 )
 				{
 					Lock_Set(x, y, SEGMENT_END);
@@ -802,7 +802,7 @@ void CSkeletonization::SK_Execute(void)
 	// 2.) Find channels...
 
 	for(n=0; n<Get_NCells() && Set_Progress_NCells(n); n++)
-	{	
+	{
 		if( pInput->Get_Sorted(n, x, y) )	// Von oben nach unten...
 		{
 			z	= pInput->asDouble(x, y);
diff --git a/src/modules/imagery/imagery_svm/Makefile.in b/src/modules/imagery/imagery_svm/Makefile.in
index d272772..57b255a 100644
--- a/src/modules/imagery/imagery_svm/Makefile.in
+++ b/src/modules/imagery/imagery_svm/Makefile.in
@@ -459,22 +459,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/svm_grids.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/imagery/imagery_svm/svm.cpp b/src/modules/imagery/imagery_svm/svm.cpp
new file mode 100644
index 0000000..1ecb291
--- /dev/null
+++ b/src/modules/imagery/imagery_svm/svm.cpp
@@ -0,0 +1,3089 @@
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <float.h>
+#include <string.h>
+#include <stdarg.h>
+#include <limits.h>
+#include "svm.h"
+int libsvm_version = LIBSVM_VERSION;
+typedef float Qfloat;
+typedef signed char schar;
+#ifndef min
+template <class T> static inline T min(T x,T y) { return (x<y)?x:y; }
+#endif
+#ifndef max
+template <class T> static inline T max(T x,T y) { return (x>y)?x:y; }
+#endif
+template <class T> static inline void swap(T& x, T& y) { T t=x; x=y; y=t; }
+template <class S, class T> static inline void clone(T*& dst, S* src, int n)
+{
+	dst = new T[n];
+	memcpy((void *)dst,(void *)src,sizeof(T)*n);
+}
+static inline double powi(double base, int times)
+{
+	double tmp = base, ret = 1.0;
+
+	for(int t=times; t>0; t/=2)
+	{
+		if(t%2==1) ret*=tmp;
+		tmp = tmp * tmp;
+	}
+	return ret;
+}
+#define INF HUGE_VAL
+#define TAU 1e-12
+#define Malloc(type,n) (type *)malloc((n)*sizeof(type))
+
+static void print_string_stdout(const char *s)
+{
+	fputs(s,stdout);
+	fflush(stdout);
+}
+static void (*svm_print_string) (const char *) = &print_string_stdout;
+#if 1
+static void info(const char *fmt,...)
+{
+	char buf[BUFSIZ];
+	va_list ap;
+	va_start(ap,fmt);
+	vsprintf(buf,fmt,ap);
+	va_end(ap);
+	(*svm_print_string)(buf);
+}
+#else
+static void info(const char *fmt,...) {}
+#endif
+
+//
+// Kernel Cache
+//
+// l is the number of total data items
+// size is the cache size limit in bytes
+//
+class Cache
+{
+public:
+	Cache(int l,long int size);
+	~Cache();
+
+	// request data [0,len)
+	// return some position p where [p,len) need to be filled
+	// (p >= len if nothing needs to be filled)
+	int get_data(const int index, Qfloat **data, int len);
+	void swap_index(int i, int j);	
+private:
+	int l;
+	long int size;
+	struct head_t
+	{
+		head_t *prev, *next;	// a circular list
+		Qfloat *data;
+		int len;		// data[0,len) is cached in this entry
+	};
+
+	head_t *head;
+	head_t lru_head;
+	void lru_delete(head_t *h);
+	void lru_insert(head_t *h);
+};
+
+Cache::Cache(int l_,long int size_):l(l_),size(size_)
+{
+	head = (head_t *)calloc(l,sizeof(head_t));	// initialized to 0
+	size /= sizeof(Qfloat);
+	size -= l * sizeof(head_t) / sizeof(Qfloat);
+	size = max(size, 2 * (long int) l);	// cache must be large enough for two columns
+	lru_head.next = lru_head.prev = &lru_head;
+}
+
+Cache::~Cache()
+{
+	for(head_t *h = lru_head.next; h != &lru_head; h=h->next)
+		free(h->data);
+	free(head);
+}
+
+void Cache::lru_delete(head_t *h)
+{
+	// delete from current location
+	h->prev->next = h->next;
+	h->next->prev = h->prev;
+}
+
+void Cache::lru_insert(head_t *h)
+{
+	// insert to last position
+	h->next = &lru_head;
+	h->prev = lru_head.prev;
+	h->prev->next = h;
+	h->next->prev = h;
+}
+
+int Cache::get_data(const int index, Qfloat **data, int len)
+{
+	head_t *h = &head[index];
+	if(h->len) lru_delete(h);
+	int more = len - h->len;
+
+	if(more > 0)
+	{
+		// free old space
+		while(size < more)
+		{
+			head_t *old = lru_head.next;
+			lru_delete(old);
+			free(old->data);
+			size += old->len;
+			old->data = 0;
+			old->len = 0;
+		}
+
+		// allocate new space
+		h->data = (Qfloat *)realloc(h->data,sizeof(Qfloat)*len);
+		size -= more;
+		swap(h->len,len);
+	}
+
+	lru_insert(h);
+	*data = h->data;
+	return len;
+}
+
+void Cache::swap_index(int i, int j)
+{
+	if(i==j) return;
+
+	if(head[i].len) lru_delete(&head[i]);
+	if(head[j].len) lru_delete(&head[j]);
+	swap(head[i].data,head[j].data);
+	swap(head[i].len,head[j].len);
+	if(head[i].len) lru_insert(&head[i]);
+	if(head[j].len) lru_insert(&head[j]);
+
+	if(i>j) swap(i,j);
+	for(head_t *h = lru_head.next; h!=&lru_head; h=h->next)
+	{
+		if(h->len > i)
+		{
+			if(h->len > j)
+				swap(h->data[i],h->data[j]);
+			else
+			{
+				// give up
+				lru_delete(h);
+				free(h->data);
+				size += h->len;
+				h->data = 0;
+				h->len = 0;
+			}
+		}
+	}
+}
+
+//
+// Kernel evaluation
+//
+// the static method k_function is for doing single kernel evaluation
+// the constructor of Kernel prepares to calculate the l*l kernel matrix
+// the member function get_Q is for getting one column from the Q Matrix
+//
+class QMatrix {
+public:
+	virtual Qfloat *get_Q(int column, int len) const = 0;
+	virtual double *get_QD() const = 0;
+	virtual void swap_index(int i, int j) const = 0;
+	virtual ~QMatrix() {}
+};
+
+class Kernel: public QMatrix {
+public:
+	Kernel(int l, svm_node * const * x, const svm_parameter& param);
+	virtual ~Kernel();
+
+	static double k_function(const svm_node *x, const svm_node *y,
+				 const svm_parameter& param);
+	virtual Qfloat *get_Q(int column, int len) const = 0;
+	virtual double *get_QD() const = 0;
+	virtual void swap_index(int i, int j) const	// no so const...
+	{
+		swap(x[i],x[j]);
+		if(x_square) swap(x_square[i],x_square[j]);
+	}
+protected:
+
+	double (Kernel::*kernel_function)(int i, int j) const;
+
+private:
+	const svm_node **x;
+	double *x_square;
+
+	// svm_parameter
+	const int kernel_type;
+	const int degree;
+	const double gamma;
+	const double coef0;
+
+	static double dot(const svm_node *px, const svm_node *py);
+	double kernel_linear(int i, int j) const
+	{
+		return dot(x[i],x[j]);
+	}
+	double kernel_poly(int i, int j) const
+	{
+		return powi(gamma*dot(x[i],x[j])+coef0,degree);
+	}
+	double kernel_rbf(int i, int j) const
+	{
+		return exp(-gamma*(x_square[i]+x_square[j]-2*dot(x[i],x[j])));
+	}
+	double kernel_sigmoid(int i, int j) const
+	{
+		return tanh(gamma*dot(x[i],x[j])+coef0);
+	}
+	double kernel_precomputed(int i, int j) const
+	{
+		return x[i][(int)(x[j][0].value)].value;
+	}
+};
+
+Kernel::Kernel(int l, svm_node * const * x_, const svm_parameter& param)
+:kernel_type(param.kernel_type), degree(param.degree),
+ gamma(param.gamma), coef0(param.coef0)
+{
+	switch(kernel_type)
+	{
+		case LINEAR:
+			kernel_function = &Kernel::kernel_linear;
+			break;
+		case POLY:
+			kernel_function = &Kernel::kernel_poly;
+			break;
+		case RBF:
+			kernel_function = &Kernel::kernel_rbf;
+			break;
+		case SIGMOID:
+			kernel_function = &Kernel::kernel_sigmoid;
+			break;
+		case PRECOMPUTED:
+			kernel_function = &Kernel::kernel_precomputed;
+			break;
+	}
+
+	clone(x,x_,l);
+
+	if(kernel_type == RBF)
+	{
+		x_square = new double[l];
+		for(int i=0;i<l;i++)
+			x_square[i] = dot(x[i],x[i]);
+	}
+	else
+		x_square = 0;
+}
+
+Kernel::~Kernel()
+{
+	delete[] x;
+	delete[] x_square;
+}
+
+double Kernel::dot(const svm_node *px, const svm_node *py)
+{
+	double sum = 0;
+	while(px->index != -1 && py->index != -1)
+	{
+		if(px->index == py->index)
+		{
+			sum += px->value * py->value;
+			++px;
+			++py;
+		}
+		else
+		{
+			if(px->index > py->index)
+				++py;
+			else
+				++px;
+		}			
+	}
+	return sum;
+}
+
+double Kernel::k_function(const svm_node *x, const svm_node *y,
+			  const svm_parameter& param)
+{
+	switch(param.kernel_type)
+	{
+		case LINEAR:
+			return dot(x,y);
+		case POLY:
+			return powi(param.gamma*dot(x,y)+param.coef0,param.degree);
+		case RBF:
+		{
+			double sum = 0;
+			while(x->index != -1 && y->index !=-1)
+			{
+				if(x->index == y->index)
+				{
+					double d = x->value - y->value;
+					sum += d*d;
+					++x;
+					++y;
+				}
+				else
+				{
+					if(x->index > y->index)
+					{	
+						sum += y->value * y->value;
+						++y;
+					}
+					else
+					{
+						sum += x->value * x->value;
+						++x;
+					}
+				}
+			}
+
+			while(x->index != -1)
+			{
+				sum += x->value * x->value;
+				++x;
+			}
+
+			while(y->index != -1)
+			{
+				sum += y->value * y->value;
+				++y;
+			}
+			
+			return exp(-param.gamma*sum);
+		}
+		case SIGMOID:
+			return tanh(param.gamma*dot(x,y)+param.coef0);
+		case PRECOMPUTED:  //x: test (validation), y: SV
+			return x[(int)(y->value)].value;
+		default:
+			return 0;  // Unreachable 
+	}
+}
+
+// An SMO algorithm in Fan et al., JMLR 6(2005), p. 1889--1918
+// Solves:
+//
+//	min 0.5(\alpha^T Q \alpha) + p^T \alpha
+//
+//		y^T \alpha = \delta
+//		y_i = +1 or -1
+//		0 <= alpha_i <= Cp for y_i = 1
+//		0 <= alpha_i <= Cn for y_i = -1
+//
+// Given:
+//
+//	Q, p, y, Cp, Cn, and an initial feasible point \alpha
+//	l is the size of vectors and matrices
+//	eps is the stopping tolerance
+//
+// solution will be put in \alpha, objective value will be put in obj
+//
+class Solver {
+public:
+	Solver() {};
+	virtual ~Solver() {};
+
+	struct SolutionInfo {
+		double obj;
+		double rho;
+		double upper_bound_p;
+		double upper_bound_n;
+		double r;	// for Solver_NU
+	};
+
+	void Solve(int l, const QMatrix& Q, const double *p_, const schar *y_,
+		   double *alpha_, double Cp, double Cn, double eps,
+		   SolutionInfo* si, int shrinking);
+protected:
+	int active_size;
+	schar *y;
+	double *G;		// gradient of objective function
+	enum { LOWER_BOUND, UPPER_BOUND, FREE };
+	char *alpha_status;	// LOWER_BOUND, UPPER_BOUND, FREE
+	double *alpha;
+	const QMatrix *Q;
+	const double *QD;
+	double eps;
+	double Cp,Cn;
+	double *p;
+	int *active_set;
+	double *G_bar;		// gradient, if we treat free variables as 0
+	int l;
+	bool unshrink;	// XXX
+
+	double get_C(int i)
+	{
+		return (y[i] > 0)? Cp : Cn;
+	}
+	void update_alpha_status(int i)
+	{
+		if(alpha[i] >= get_C(i))
+			alpha_status[i] = UPPER_BOUND;
+		else if(alpha[i] <= 0)
+			alpha_status[i] = LOWER_BOUND;
+		else alpha_status[i] = FREE;
+	}
+	bool is_upper_bound(int i) { return alpha_status[i] == UPPER_BOUND; }
+	bool is_lower_bound(int i) { return alpha_status[i] == LOWER_BOUND; }
+	bool is_free(int i) { return alpha_status[i] == FREE; }
+	void swap_index(int i, int j);
+	void reconstruct_gradient();
+	virtual int select_working_set(int &i, int &j);
+	virtual double calculate_rho();
+	virtual void do_shrinking();
+private:
+	bool be_shrunk(int i, double Gmax1, double Gmax2);	
+};
+
+void Solver::swap_index(int i, int j)
+{
+	Q->swap_index(i,j);
+	swap(y[i],y[j]);
+	swap(G[i],G[j]);
+	swap(alpha_status[i],alpha_status[j]);
+	swap(alpha[i],alpha[j]);
+	swap(p[i],p[j]);
+	swap(active_set[i],active_set[j]);
+	swap(G_bar[i],G_bar[j]);
+}
+
+void Solver::reconstruct_gradient()
+{
+	// reconstruct inactive elements of G from G_bar and free variables
+
+	if(active_size == l) return;
+
+	int i,j;
+	int nr_free = 0;
+
+	for(j=active_size;j<l;j++)
+		G[j] = G_bar[j] + p[j];
+
+	for(j=0;j<active_size;j++)
+		if(is_free(j))
+			nr_free++;
+
+	if(2*nr_free < active_size)
+		info("\nWARNING: using -h 0 may be faster\n");
+
+	if (nr_free*l > 2*active_size*(l-active_size))
+	{
+		for(i=active_size;i<l;i++)
+		{
+			const Qfloat *Q_i = Q->get_Q(i,active_size);
+			for(j=0;j<active_size;j++)
+				if(is_free(j))
+					G[i] += alpha[j] * Q_i[j];
+		}
+	}
+	else
+	{
+		for(i=0;i<active_size;i++)
+			if(is_free(i))
+			{
+				const Qfloat *Q_i = Q->get_Q(i,l);
+				double alpha_i = alpha[i];
+				for(j=active_size;j<l;j++)
+					G[j] += alpha_i * Q_i[j];
+			}
+	}
+}
+
+void Solver::Solve(int l, const QMatrix& Q, const double *p_, const schar *y_,
+		   double *alpha_, double Cp, double Cn, double eps,
+		   SolutionInfo* si, int shrinking)
+{
+	this->l = l;
+	this->Q = &Q;
+	QD=Q.get_QD();
+	clone(p, p_,l);
+	clone(y, y_,l);
+	clone(alpha,alpha_,l);
+	this->Cp = Cp;
+	this->Cn = Cn;
+	this->eps = eps;
+	unshrink = false;
+
+	// initialize alpha_status
+	{
+		alpha_status = new char[l];
+		for(int i=0;i<l;i++)
+			update_alpha_status(i);
+	}
+
+	// initialize active set (for shrinking)
+	{
+		active_set = new int[l];
+		for(int i=0;i<l;i++)
+			active_set[i] = i;
+		active_size = l;
+	}
+
+	// initialize gradient
+	{
+		G = new double[l];
+		G_bar = new double[l];
+		int i;
+		for(i=0;i<l;i++)
+		{
+			G[i] = p[i];
+			G_bar[i] = 0;
+		}
+		for(i=0;i<l;i++)
+			if(!is_lower_bound(i))
+			{
+				const Qfloat *Q_i = Q.get_Q(i,l);
+				double alpha_i = alpha[i];
+				int j;
+				for(j=0;j<l;j++)
+					G[j] += alpha_i*Q_i[j];
+				if(is_upper_bound(i))
+					for(j=0;j<l;j++)
+						G_bar[j] += get_C(i) * Q_i[j];
+			}
+	}
+
+	// optimization step
+
+	int iter = 0;
+	int max_iter = max(10000000, l>INT_MAX/100 ? INT_MAX : 100*l);
+	int counter = min(l,1000)+1;
+	
+	while(iter < max_iter)
+	{
+		// show progress and do shrinking
+
+		if(--counter == 0)
+		{
+			counter = min(l,1000);
+			if(shrinking) do_shrinking();
+			info(".");
+		}
+
+		int i,j;
+		if(select_working_set(i,j)!=0)
+		{
+			// reconstruct the whole gradient
+			reconstruct_gradient();
+			// reset active set size and check
+			active_size = l;
+			info("*");
+			if(select_working_set(i,j)!=0)
+				break;
+			else
+				counter = 1;	// do shrinking next iteration
+		}
+		
+		++iter;
+
+		// update alpha[i] and alpha[j], handle bounds carefully
+		
+		const Qfloat *Q_i = Q.get_Q(i,active_size);
+		const Qfloat *Q_j = Q.get_Q(j,active_size);
+
+		double C_i = get_C(i);
+		double C_j = get_C(j);
+
+		double old_alpha_i = alpha[i];
+		double old_alpha_j = alpha[j];
+
+		if(y[i]!=y[j])
+		{
+			double quad_coef = QD[i]+QD[j]+2*Q_i[j];
+			if (quad_coef <= 0)
+				quad_coef = TAU;
+			double delta = (-G[i]-G[j])/quad_coef;
+			double diff = alpha[i] - alpha[j];
+			alpha[i] += delta;
+			alpha[j] += delta;
+			
+			if(diff > 0)
+			{
+				if(alpha[j] < 0)
+				{
+					alpha[j] = 0;
+					alpha[i] = diff;
+				}
+			}
+			else
+			{
+				if(alpha[i] < 0)
+				{
+					alpha[i] = 0;
+					alpha[j] = -diff;
+				}
+			}
+			if(diff > C_i - C_j)
+			{
+				if(alpha[i] > C_i)
+				{
+					alpha[i] = C_i;
+					alpha[j] = C_i - diff;
+				}
+			}
+			else
+			{
+				if(alpha[j] > C_j)
+				{
+					alpha[j] = C_j;
+					alpha[i] = C_j + diff;
+				}
+			}
+		}
+		else
+		{
+			double quad_coef = QD[i]+QD[j]-2*Q_i[j];
+			if (quad_coef <= 0)
+				quad_coef = TAU;
+			double delta = (G[i]-G[j])/quad_coef;
+			double sum = alpha[i] + alpha[j];
+			alpha[i] -= delta;
+			alpha[j] += delta;
+
+			if(sum > C_i)
+			{
+				if(alpha[i] > C_i)
+				{
+					alpha[i] = C_i;
+					alpha[j] = sum - C_i;
+				}
+			}
+			else
+			{
+				if(alpha[j] < 0)
+				{
+					alpha[j] = 0;
+					alpha[i] = sum;
+				}
+			}
+			if(sum > C_j)
+			{
+				if(alpha[j] > C_j)
+				{
+					alpha[j] = C_j;
+					alpha[i] = sum - C_j;
+				}
+			}
+			else
+			{
+				if(alpha[i] < 0)
+				{
+					alpha[i] = 0;
+					alpha[j] = sum;
+				}
+			}
+		}
+
+		// update G
+
+		double delta_alpha_i = alpha[i] - old_alpha_i;
+		double delta_alpha_j = alpha[j] - old_alpha_j;
+		
+		for(int k=0;k<active_size;k++)
+		{
+			G[k] += Q_i[k]*delta_alpha_i + Q_j[k]*delta_alpha_j;
+		}
+
+		// update alpha_status and G_bar
+
+		{
+			bool ui = is_upper_bound(i);
+			bool uj = is_upper_bound(j);
+			update_alpha_status(i);
+			update_alpha_status(j);
+			int k;
+			if(ui != is_upper_bound(i))
+			{
+				Q_i = Q.get_Q(i,l);
+				if(ui)
+					for(k=0;k<l;k++)
+						G_bar[k] -= C_i * Q_i[k];
+				else
+					for(k=0;k<l;k++)
+						G_bar[k] += C_i * Q_i[k];
+			}
+
+			if(uj != is_upper_bound(j))
+			{
+				Q_j = Q.get_Q(j,l);
+				if(uj)
+					for(k=0;k<l;k++)
+						G_bar[k] -= C_j * Q_j[k];
+				else
+					for(k=0;k<l;k++)
+						G_bar[k] += C_j * Q_j[k];
+			}
+		}
+	}
+
+	if(iter >= max_iter)
+	{
+		if(active_size < l)
+		{
+			// reconstruct the whole gradient to calculate objective value
+			reconstruct_gradient();
+			active_size = l;
+			info("*");
+		}
+		info("\nWARNING: reaching max number of iterations");
+	}
+
+	// calculate rho
+
+	si->rho = calculate_rho();
+
+	// calculate objective value
+	{
+		double v = 0;
+		int i;
+		for(i=0;i<l;i++)
+			v += alpha[i] * (G[i] + p[i]);
+
+		si->obj = v/2;
+	}
+
+	// put back the solution
+	{
+		for(int i=0;i<l;i++)
+			alpha_[active_set[i]] = alpha[i];
+	}
+
+	// juggle everything back
+	/*{
+		for(int i=0;i<l;i++)
+			while(active_set[i] != i)
+				swap_index(i,active_set[i]);
+				// or Q.swap_index(i,active_set[i]);
+	}*/
+
+	si->upper_bound_p = Cp;
+	si->upper_bound_n = Cn;
+
+	info("\noptimization finished, #iter = %d\n",iter);
+
+	delete[] p;
+	delete[] y;
+	delete[] alpha;
+	delete[] alpha_status;
+	delete[] active_set;
+	delete[] G;
+	delete[] G_bar;
+}
+
+// return 1 if already optimal, return 0 otherwise
+int Solver::select_working_set(int &out_i, int &out_j)
+{
+	// return i,j such that
+	// i: maximizes -y_i * grad(f)_i, i in I_up(\alpha)
+	// j: minimizes the decrease of obj value
+	//    (if quadratic coefficeint <= 0, replace it with tau)
+	//    -y_j*grad(f)_j < -y_i*grad(f)_i, j in I_low(\alpha)
+	
+	double Gmax = -INF;
+	double Gmax2 = -INF;
+	int Gmax_idx = -1;
+	int Gmin_idx = -1;
+	double obj_diff_min = INF;
+
+	for(int t=0;t<active_size;t++)
+		if(y[t]==+1)	
+		{
+			if(!is_upper_bound(t))
+				if(-G[t] >= Gmax)
+				{
+					Gmax = -G[t];
+					Gmax_idx = t;
+				}
+		}
+		else
+		{
+			if(!is_lower_bound(t))
+				if(G[t] >= Gmax)
+				{
+					Gmax = G[t];
+					Gmax_idx = t;
+				}
+		}
+
+	int i = Gmax_idx;
+	const Qfloat *Q_i = NULL;
+	if(i != -1) // NULL Q_i not accessed: Gmax=-INF if i=-1
+		Q_i = Q->get_Q(i,active_size);
+
+	for(int j=0;j<active_size;j++)
+	{
+		if(y[j]==+1)
+		{
+			if (!is_lower_bound(j))
+			{
+				double grad_diff=Gmax+G[j];
+				if (G[j] >= Gmax2)
+					Gmax2 = G[j];
+				if (grad_diff > 0)
+				{
+					double obj_diff; 
+					double quad_coef = QD[i]+QD[j]-2.0*y[i]*Q_i[j];
+					if (quad_coef > 0)
+						obj_diff = -(grad_diff*grad_diff)/quad_coef;
+					else
+						obj_diff = -(grad_diff*grad_diff)/TAU;
+
+					if (obj_diff <= obj_diff_min)
+					{
+						Gmin_idx=j;
+						obj_diff_min = obj_diff;
+					}
+				}
+			}
+		}
+		else
+		{
+			if (!is_upper_bound(j))
+			{
+				double grad_diff= Gmax-G[j];
+				if (-G[j] >= Gmax2)
+					Gmax2 = -G[j];
+				if (grad_diff > 0)
+				{
+					double obj_diff; 
+					double quad_coef = QD[i]+QD[j]+2.0*y[i]*Q_i[j];
+					if (quad_coef > 0)
+						obj_diff = -(grad_diff*grad_diff)/quad_coef;
+					else
+						obj_diff = -(grad_diff*grad_diff)/TAU;
+
+					if (obj_diff <= obj_diff_min)
+					{
+						Gmin_idx=j;
+						obj_diff_min = obj_diff;
+					}
+				}
+			}
+		}
+	}
+
+	if(Gmax+Gmax2 < eps)
+		return 1;
+
+	out_i = Gmax_idx;
+	out_j = Gmin_idx;
+	return 0;
+}
+
+bool Solver::be_shrunk(int i, double Gmax1, double Gmax2)
+{
+	if(is_upper_bound(i))
+	{
+		if(y[i]==+1)
+			return(-G[i] > Gmax1);
+		else
+			return(-G[i] > Gmax2);
+	}
+	else if(is_lower_bound(i))
+	{
+		if(y[i]==+1)
+			return(G[i] > Gmax2);
+		else	
+			return(G[i] > Gmax1);
+	}
+	else
+		return(false);
+}
+
+void Solver::do_shrinking()
+{
+	int i;
+	double Gmax1 = -INF;		// max { -y_i * grad(f)_i | i in I_up(\alpha) }
+	double Gmax2 = -INF;		// max { y_i * grad(f)_i | i in I_low(\alpha) }
+
+	// find maximal violating pair first
+	for(i=0;i<active_size;i++)
+	{
+		if(y[i]==+1)	
+		{
+			if(!is_upper_bound(i))	
+			{
+				if(-G[i] >= Gmax1)
+					Gmax1 = -G[i];
+			}
+			if(!is_lower_bound(i))	
+			{
+				if(G[i] >= Gmax2)
+					Gmax2 = G[i];
+			}
+		}
+		else	
+		{
+			if(!is_upper_bound(i))	
+			{
+				if(-G[i] >= Gmax2)
+					Gmax2 = -G[i];
+			}
+			if(!is_lower_bound(i))	
+			{
+				if(G[i] >= Gmax1)
+					Gmax1 = G[i];
+			}
+		}
+	}
+
+	if(unshrink == false && Gmax1 + Gmax2 <= eps*10) 
+	{
+		unshrink = true;
+		reconstruct_gradient();
+		active_size = l;
+		info("*");
+	}
+
+	for(i=0;i<active_size;i++)
+		if (be_shrunk(i, Gmax1, Gmax2))
+		{
+			active_size--;
+			while (active_size > i)
+			{
+				if (!be_shrunk(active_size, Gmax1, Gmax2))
+				{
+					swap_index(i,active_size);
+					break;
+				}
+				active_size--;
+			}
+		}
+}
+
+double Solver::calculate_rho()
+{
+	double r;
+	int nr_free = 0;
+	double ub = INF, lb = -INF, sum_free = 0;
+	for(int i=0;i<active_size;i++)
+	{
+		double yG = y[i]*G[i];
+
+		if(is_upper_bound(i))
+		{
+			if(y[i]==-1)
+				ub = min(ub,yG);
+			else
+				lb = max(lb,yG);
+		}
+		else if(is_lower_bound(i))
+		{
+			if(y[i]==+1)
+				ub = min(ub,yG);
+			else
+				lb = max(lb,yG);
+		}
+		else
+		{
+			++nr_free;
+			sum_free += yG;
+		}
+	}
+
+	if(nr_free>0)
+		r = sum_free/nr_free;
+	else
+		r = (ub+lb)/2;
+
+	return r;
+}
+
+//
+// Solver for nu-svm classification and regression
+//
+// additional constraint: e^T \alpha = constant
+//
+class Solver_NU : public Solver
+{
+public:
+	Solver_NU() {}
+	void Solve(int l, const QMatrix& Q, const double *p, const schar *y,
+		   double *alpha, double Cp, double Cn, double eps,
+		   SolutionInfo* si, int shrinking)
+	{
+		this->si = si;
+		Solver::Solve(l,Q,p,y,alpha,Cp,Cn,eps,si,shrinking);
+	}
+private:
+	SolutionInfo *si;
+	int select_working_set(int &i, int &j);
+	double calculate_rho();
+	bool be_shrunk(int i, double Gmax1, double Gmax2, double Gmax3, double Gmax4);
+	void do_shrinking();
+};
+
+// return 1 if already optimal, return 0 otherwise
+int Solver_NU::select_working_set(int &out_i, int &out_j)
+{
+	// return i,j such that y_i = y_j and
+	// i: maximizes -y_i * grad(f)_i, i in I_up(\alpha)
+	// j: minimizes the decrease of obj value
+	//    (if quadratic coefficeint <= 0, replace it with tau)
+	//    -y_j*grad(f)_j < -y_i*grad(f)_i, j in I_low(\alpha)
+
+	double Gmaxp = -INF;
+	double Gmaxp2 = -INF;
+	int Gmaxp_idx = -1;
+
+	double Gmaxn = -INF;
+	double Gmaxn2 = -INF;
+	int Gmaxn_idx = -1;
+
+	int Gmin_idx = -1;
+	double obj_diff_min = INF;
+
+	for(int t=0;t<active_size;t++)
+		if(y[t]==+1)
+		{
+			if(!is_upper_bound(t))
+				if(-G[t] >= Gmaxp)
+				{
+					Gmaxp = -G[t];
+					Gmaxp_idx = t;
+				}
+		}
+		else
+		{
+			if(!is_lower_bound(t))
+				if(G[t] >= Gmaxn)
+				{
+					Gmaxn = G[t];
+					Gmaxn_idx = t;
+				}
+		}
+
+	int ip = Gmaxp_idx;
+	int in = Gmaxn_idx;
+	const Qfloat *Q_ip = NULL;
+	const Qfloat *Q_in = NULL;
+	if(ip != -1) // NULL Q_ip not accessed: Gmaxp=-INF if ip=-1
+		Q_ip = Q->get_Q(ip,active_size);
+	if(in != -1)
+		Q_in = Q->get_Q(in,active_size);
+
+	for(int j=0;j<active_size;j++)
+	{
+		if(y[j]==+1)
+		{
+			if (!is_lower_bound(j))	
+			{
+				double grad_diff=Gmaxp+G[j];
+				if (G[j] >= Gmaxp2)
+					Gmaxp2 = G[j];
+				if (grad_diff > 0)
+				{
+					double obj_diff; 
+					double quad_coef = QD[ip]+QD[j]-2*Q_ip[j];
+					if (quad_coef > 0)
+						obj_diff = -(grad_diff*grad_diff)/quad_coef;
+					else
+						obj_diff = -(grad_diff*grad_diff)/TAU;
+
+					if (obj_diff <= obj_diff_min)
+					{
+						Gmin_idx=j;
+						obj_diff_min = obj_diff;
+					}
+				}
+			}
+		}
+		else
+		{
+			if (!is_upper_bound(j))
+			{
+				double grad_diff=Gmaxn-G[j];
+				if (-G[j] >= Gmaxn2)
+					Gmaxn2 = -G[j];
+				if (grad_diff > 0)
+				{
+					double obj_diff; 
+					double quad_coef = QD[in]+QD[j]-2*Q_in[j];
+					if (quad_coef > 0)
+						obj_diff = -(grad_diff*grad_diff)/quad_coef;
+					else
+						obj_diff = -(grad_diff*grad_diff)/TAU;
+
+					if (obj_diff <= obj_diff_min)
+					{
+						Gmin_idx=j;
+						obj_diff_min = obj_diff;
+					}
+				}
+			}
+		}
+	}
+
+	if(max(Gmaxp+Gmaxp2,Gmaxn+Gmaxn2) < eps)
+		return 1;
+
+	if (y[Gmin_idx] == +1)
+		out_i = Gmaxp_idx;
+	else
+		out_i = Gmaxn_idx;
+	out_j = Gmin_idx;
+
+	return 0;
+}
+
+bool Solver_NU::be_shrunk(int i, double Gmax1, double Gmax2, double Gmax3, double Gmax4)
+{
+	if(is_upper_bound(i))
+	{
+		if(y[i]==+1)
+			return(-G[i] > Gmax1);
+		else	
+			return(-G[i] > Gmax4);
+	}
+	else if(is_lower_bound(i))
+	{
+		if(y[i]==+1)
+			return(G[i] > Gmax2);
+		else	
+			return(G[i] > Gmax3);
+	}
+	else
+		return(false);
+}
+
+void Solver_NU::do_shrinking()
+{
+	double Gmax1 = -INF;	// max { -y_i * grad(f)_i | y_i = +1, i in I_up(\alpha) }
+	double Gmax2 = -INF;	// max { y_i * grad(f)_i | y_i = +1, i in I_low(\alpha) }
+	double Gmax3 = -INF;	// max { -y_i * grad(f)_i | y_i = -1, i in I_up(\alpha) }
+	double Gmax4 = -INF;	// max { y_i * grad(f)_i | y_i = -1, i in I_low(\alpha) }
+
+	// find maximal violating pair first
+	int i;
+	for(i=0;i<active_size;i++)
+	{
+		if(!is_upper_bound(i))
+		{
+			if(y[i]==+1)
+			{
+				if(-G[i] > Gmax1) Gmax1 = -G[i];
+			}
+			else	if(-G[i] > Gmax4) Gmax4 = -G[i];
+		}
+		if(!is_lower_bound(i))
+		{
+			if(y[i]==+1)
+			{	
+				if(G[i] > Gmax2) Gmax2 = G[i];
+			}
+			else	if(G[i] > Gmax3) Gmax3 = G[i];
+		}
+	}
+
+	if(unshrink == false && max(Gmax1+Gmax2,Gmax3+Gmax4) <= eps*10) 
+	{
+		unshrink = true;
+		reconstruct_gradient();
+		active_size = l;
+	}
+
+	for(i=0;i<active_size;i++)
+		if (be_shrunk(i, Gmax1, Gmax2, Gmax3, Gmax4))
+		{
+			active_size--;
+			while (active_size > i)
+			{
+				if (!be_shrunk(active_size, Gmax1, Gmax2, Gmax3, Gmax4))
+				{
+					swap_index(i,active_size);
+					break;
+				}
+				active_size--;
+			}
+		}
+}
+
+double Solver_NU::calculate_rho()
+{
+	int nr_free1 = 0,nr_free2 = 0;
+	double ub1 = INF, ub2 = INF;
+	double lb1 = -INF, lb2 = -INF;
+	double sum_free1 = 0, sum_free2 = 0;
+
+	for(int i=0;i<active_size;i++)
+	{
+		if(y[i]==+1)
+		{
+			if(is_upper_bound(i))
+				lb1 = max(lb1,G[i]);
+			else if(is_lower_bound(i))
+				ub1 = min(ub1,G[i]);
+			else
+			{
+				++nr_free1;
+				sum_free1 += G[i];
+			}
+		}
+		else
+		{
+			if(is_upper_bound(i))
+				lb2 = max(lb2,G[i]);
+			else if(is_lower_bound(i))
+				ub2 = min(ub2,G[i]);
+			else
+			{
+				++nr_free2;
+				sum_free2 += G[i];
+			}
+		}
+	}
+
+	double r1,r2;
+	if(nr_free1 > 0)
+		r1 = sum_free1/nr_free1;
+	else
+		r1 = (ub1+lb1)/2;
+	
+	if(nr_free2 > 0)
+		r2 = sum_free2/nr_free2;
+	else
+		r2 = (ub2+lb2)/2;
+	
+	si->r = (r1+r2)/2;
+	return (r1-r2)/2;
+}
+
+//
+// Q matrices for various formulations
+//
+class SVC_Q: public Kernel
+{ 
+public:
+	SVC_Q(const svm_problem& prob, const svm_parameter& param, const schar *y_)
+	:Kernel(prob.l, prob.x, param)
+	{
+		clone(y,y_,prob.l);
+		cache = new Cache(prob.l,(long int)(param.cache_size*(1<<20)));
+		QD = new double[prob.l];
+		for(int i=0;i<prob.l;i++)
+			QD[i] = (this->*kernel_function)(i,i);
+	}
+	
+	Qfloat *get_Q(int i, int len) const
+	{
+		Qfloat *data;
+		int start, j;
+		if((start = cache->get_data(i,&data,len)) < len)
+		{
+			for(j=start;j<len;j++)
+				data[j] = (Qfloat)(y[i]*y[j]*(this->*kernel_function)(i,j));
+		}
+		return data;
+	}
+
+	double *get_QD() const
+	{
+		return QD;
+	}
+
+	void swap_index(int i, int j) const
+	{
+		cache->swap_index(i,j);
+		Kernel::swap_index(i,j);
+		swap(y[i],y[j]);
+		swap(QD[i],QD[j]);
+	}
+
+	~SVC_Q()
+	{
+		delete[] y;
+		delete cache;
+		delete[] QD;
+	}
+private:
+	schar *y;
+	Cache *cache;
+	double *QD;
+};
+
+class ONE_CLASS_Q: public Kernel
+{
+public:
+	ONE_CLASS_Q(const svm_problem& prob, const svm_parameter& param)
+	:Kernel(prob.l, prob.x, param)
+	{
+		cache = new Cache(prob.l,(long int)(param.cache_size*(1<<20)));
+		QD = new double[prob.l];
+		for(int i=0;i<prob.l;i++)
+			QD[i] = (this->*kernel_function)(i,i);
+	}
+	
+	Qfloat *get_Q(int i, int len) const
+	{
+		Qfloat *data;
+		int start, j;
+		if((start = cache->get_data(i,&data,len)) < len)
+		{
+			for(j=start;j<len;j++)
+				data[j] = (Qfloat)(this->*kernel_function)(i,j);
+		}
+		return data;
+	}
+
+	double *get_QD() const
+	{
+		return QD;
+	}
+
+	void swap_index(int i, int j) const
+	{
+		cache->swap_index(i,j);
+		Kernel::swap_index(i,j);
+		swap(QD[i],QD[j]);
+	}
+
+	~ONE_CLASS_Q()
+	{
+		delete cache;
+		delete[] QD;
+	}
+private:
+	Cache *cache;
+	double *QD;
+};
+
+class SVR_Q: public Kernel
+{ 
+public:
+	SVR_Q(const svm_problem& prob, const svm_parameter& param)
+	:Kernel(prob.l, prob.x, param)
+	{
+		l = prob.l;
+		cache = new Cache(l,(long int)(param.cache_size*(1<<20)));
+		QD = new double[2*l];
+		sign = new schar[2*l];
+		index = new int[2*l];
+		for(int k=0;k<l;k++)
+		{
+			sign[k] = 1;
+			sign[k+l] = -1;
+			index[k] = k;
+			index[k+l] = k;
+			QD[k] = (this->*kernel_function)(k,k);
+			QD[k+l] = QD[k];
+		}
+		buffer[0] = new Qfloat[2*l];
+		buffer[1] = new Qfloat[2*l];
+		next_buffer = 0;
+	}
+
+	void swap_index(int i, int j) const
+	{
+		swap(sign[i],sign[j]);
+		swap(index[i],index[j]);
+		swap(QD[i],QD[j]);
+	}
+	
+	Qfloat *get_Q(int i, int len) const
+	{
+		Qfloat *data;
+		int j, real_i = index[i];
+		if(cache->get_data(real_i,&data,l) < l)
+		{
+			for(j=0;j<l;j++)
+				data[j] = (Qfloat)(this->*kernel_function)(real_i,j);
+		}
+
+		// reorder and copy
+		Qfloat *buf = buffer[next_buffer];
+		next_buffer = 1 - next_buffer;
+		schar si = sign[i];
+		for(j=0;j<len;j++)
+			buf[j] = (Qfloat) si * (Qfloat) sign[j] * data[index[j]];
+		return buf;
+	}
+
+	double *get_QD() const
+	{
+		return QD;
+	}
+
+	~SVR_Q()
+	{
+		delete cache;
+		delete[] sign;
+		delete[] index;
+		delete[] buffer[0];
+		delete[] buffer[1];
+		delete[] QD;
+	}
+private:
+	int l;
+	Cache *cache;
+	schar *sign;
+	int *index;
+	mutable int next_buffer;
+	Qfloat *buffer[2];
+	double *QD;
+};
+
+//
+// construct and solve various formulations
+//
+static void solve_c_svc(
+	const svm_problem *prob, const svm_parameter* param,
+	double *alpha, Solver::SolutionInfo* si, double Cp, double Cn)
+{
+	int l = prob->l;
+	double *minus_ones = new double[l];
+	schar *y = new schar[l];
+
+	int i;
+
+	for(i=0;i<l;i++)
+	{
+		alpha[i] = 0;
+		minus_ones[i] = -1;
+		if(prob->y[i] > 0) y[i] = +1; else y[i] = -1;
+	}
+
+	Solver s;
+	s.Solve(l, SVC_Q(*prob,*param,y), minus_ones, y,
+		alpha, Cp, Cn, param->eps, si, param->shrinking);
+
+	double sum_alpha=0;
+	for(i=0;i<l;i++)
+		sum_alpha += alpha[i];
+
+	if (Cp==Cn)
+		info("nu = %f\n", sum_alpha/(Cp*prob->l));
+
+	for(i=0;i<l;i++)
+		alpha[i] *= y[i];
+
+	delete[] minus_ones;
+	delete[] y;
+}
+
+static void solve_nu_svc(
+	const svm_problem *prob, const svm_parameter *param,
+	double *alpha, Solver::SolutionInfo* si)
+{
+	int i;
+	int l = prob->l;
+	double nu = param->nu;
+
+	schar *y = new schar[l];
+
+	for(i=0;i<l;i++)
+		if(prob->y[i]>0)
+			y[i] = +1;
+		else
+			y[i] = -1;
+
+	double sum_pos = nu*l/2;
+	double sum_neg = nu*l/2;
+
+	for(i=0;i<l;i++)
+		if(y[i] == +1)
+		{
+			alpha[i] = min(1.0,sum_pos);
+			sum_pos -= alpha[i];
+		}
+		else
+		{
+			alpha[i] = min(1.0,sum_neg);
+			sum_neg -= alpha[i];
+		}
+
+	double *zeros = new double[l];
+
+	for(i=0;i<l;i++)
+		zeros[i] = 0;
+
+	Solver_NU s;
+	s.Solve(l, SVC_Q(*prob,*param,y), zeros, y,
+		alpha, 1.0, 1.0, param->eps, si,  param->shrinking);
+	double r = si->r;
+
+	info("C = %f\n",1/r);
+
+	for(i=0;i<l;i++)
+		alpha[i] *= y[i]/r;
+
+	si->rho /= r;
+	si->obj /= (r*r);
+	si->upper_bound_p = 1/r;
+	si->upper_bound_n = 1/r;
+
+	delete[] y;
+	delete[] zeros;
+}
+
+static void solve_one_class(
+	const svm_problem *prob, const svm_parameter *param,
+	double *alpha, Solver::SolutionInfo* si)
+{
+	int l = prob->l;
+	double *zeros = new double[l];
+	schar *ones = new schar[l];
+	int i;
+
+	int n = (int)(param->nu*prob->l);	// # of alpha's at upper bound
+
+	for(i=0;i<n;i++)
+		alpha[i] = 1;
+	if(n<prob->l)
+		alpha[n] = param->nu * prob->l - n;
+	for(i=n+1;i<l;i++)
+		alpha[i] = 0;
+
+	for(i=0;i<l;i++)
+	{
+		zeros[i] = 0;
+		ones[i] = 1;
+	}
+
+	Solver s;
+	s.Solve(l, ONE_CLASS_Q(*prob,*param), zeros, ones,
+		alpha, 1.0, 1.0, param->eps, si, param->shrinking);
+
+	delete[] zeros;
+	delete[] ones;
+}
+
+static void solve_epsilon_svr(
+	const svm_problem *prob, const svm_parameter *param,
+	double *alpha, Solver::SolutionInfo* si)
+{
+	int l = prob->l;
+	double *alpha2 = new double[2*l];
+	double *linear_term = new double[2*l];
+	schar *y = new schar[2*l];
+	int i;
+
+	for(i=0;i<l;i++)
+	{
+		alpha2[i] = 0;
+		linear_term[i] = param->p - prob->y[i];
+		y[i] = 1;
+
+		alpha2[i+l] = 0;
+		linear_term[i+l] = param->p + prob->y[i];
+		y[i+l] = -1;
+	}
+
+	Solver s;
+	s.Solve(2*l, SVR_Q(*prob,*param), linear_term, y,
+		alpha2, param->C, param->C, param->eps, si, param->shrinking);
+
+	double sum_alpha = 0;
+	for(i=0;i<l;i++)
+	{
+		alpha[i] = alpha2[i] - alpha2[i+l];
+		sum_alpha += fabs(alpha[i]);
+	}
+	info("nu = %f\n",sum_alpha/(param->C*l));
+
+	delete[] alpha2;
+	delete[] linear_term;
+	delete[] y;
+}
+
+static void solve_nu_svr(
+	const svm_problem *prob, const svm_parameter *param,
+	double *alpha, Solver::SolutionInfo* si)
+{
+	int l = prob->l;
+	double C = param->C;
+	double *alpha2 = new double[2*l];
+	double *linear_term = new double[2*l];
+	schar *y = new schar[2*l];
+	int i;
+
+	double sum = C * param->nu * l / 2;
+	for(i=0;i<l;i++)
+	{
+		alpha2[i] = alpha2[i+l] = min(sum,C);
+		sum -= alpha2[i];
+
+		linear_term[i] = - prob->y[i];
+		y[i] = 1;
+
+		linear_term[i+l] = prob->y[i];
+		y[i+l] = -1;
+	}
+
+	Solver_NU s;
+	s.Solve(2*l, SVR_Q(*prob,*param), linear_term, y,
+		alpha2, C, C, param->eps, si, param->shrinking);
+
+	info("epsilon = %f\n",-si->r);
+
+	for(i=0;i<l;i++)
+		alpha[i] = alpha2[i] - alpha2[i+l];
+
+	delete[] alpha2;
+	delete[] linear_term;
+	delete[] y;
+}
+
+//
+// decision_function
+//
+struct decision_function
+{
+	double *alpha;
+	double rho;	
+};
+
+static decision_function svm_train_one(
+	const svm_problem *prob, const svm_parameter *param,
+	double Cp, double Cn)
+{
+	double *alpha = Malloc(double,prob->l);
+	Solver::SolutionInfo si;
+	switch(param->svm_type)
+	{
+		case C_SVC:
+			solve_c_svc(prob,param,alpha,&si,Cp,Cn);
+			break;
+		case NU_SVC:
+			solve_nu_svc(prob,param,alpha,&si);
+			break;
+		case ONE_CLASS:
+			solve_one_class(prob,param,alpha,&si);
+			break;
+		case EPSILON_SVR:
+			solve_epsilon_svr(prob,param,alpha,&si);
+			break;
+		case NU_SVR:
+			solve_nu_svr(prob,param,alpha,&si);
+			break;
+	}
+
+	info("obj = %f, rho = %f\n",si.obj,si.rho);
+
+	// output SVs
+
+	int nSV = 0;
+	int nBSV = 0;
+	for(int i=0;i<prob->l;i++)
+	{
+		if(fabs(alpha[i]) > 0)
+		{
+			++nSV;
+			if(prob->y[i] > 0)
+			{
+				if(fabs(alpha[i]) >= si.upper_bound_p)
+					++nBSV;
+			}
+			else
+			{
+				if(fabs(alpha[i]) >= si.upper_bound_n)
+					++nBSV;
+			}
+		}
+	}
+
+	info("nSV = %d, nBSV = %d\n",nSV,nBSV);
+
+	decision_function f;
+	f.alpha = alpha;
+	f.rho = si.rho;
+	return f;
+}
+
+// Platt's binary SVM Probablistic Output: an improvement from Lin et al.
+static void sigmoid_train(
+	int l, const double *dec_values, const double *labels, 
+	double& A, double& B)
+{
+	double prior1=0, prior0 = 0;
+	int i;
+
+	for (i=0;i<l;i++)
+		if (labels[i] > 0) prior1+=1;
+		else prior0+=1;
+	
+	int max_iter=100;	// Maximal number of iterations
+	double min_step=1e-10;	// Minimal step taken in line search
+	double sigma=1e-12;	// For numerically strict PD of Hessian
+	double eps=1e-5;
+	double hiTarget=(prior1+1.0)/(prior1+2.0);
+	double loTarget=1/(prior0+2.0);
+	double *t=Malloc(double,l);
+	double fApB,p,q,h11,h22,h21,g1,g2,det,dA,dB,gd,stepsize;
+	double newA,newB,newf,d1,d2;
+	int iter; 
+	
+	// Initial Point and Initial Fun Value
+	A=0.0; B=log((prior0+1.0)/(prior1+1.0));
+	double fval = 0.0;
+
+	for (i=0;i<l;i++)
+	{
+		if (labels[i]>0) t[i]=hiTarget;
+		else t[i]=loTarget;
+		fApB = dec_values[i]*A+B;
+		if (fApB>=0)
+			fval += t[i]*fApB + log(1+exp(-fApB));
+		else
+			fval += (t[i] - 1)*fApB +log(1+exp(fApB));
+	}
+	for (iter=0;iter<max_iter;iter++)
+	{
+		// Update Gradient and Hessian (use H' = H + sigma I)
+		h11=sigma; // numerically ensures strict PD
+		h22=sigma;
+		h21=0.0;g1=0.0;g2=0.0;
+		for (i=0;i<l;i++)
+		{
+			fApB = dec_values[i]*A+B;
+			if (fApB >= 0)
+			{
+				p=exp(-fApB)/(1.0+exp(-fApB));
+				q=1.0/(1.0+exp(-fApB));
+			}
+			else
+			{
+				p=1.0/(1.0+exp(fApB));
+				q=exp(fApB)/(1.0+exp(fApB));
+			}
+			d2=p*q;
+			h11+=dec_values[i]*dec_values[i]*d2;
+			h22+=d2;
+			h21+=dec_values[i]*d2;
+			d1=t[i]-p;
+			g1+=dec_values[i]*d1;
+			g2+=d1;
+		}
+
+		// Stopping Criteria
+		if (fabs(g1)<eps && fabs(g2)<eps)
+			break;
+
+		// Finding Newton direction: -inv(H') * g
+		det=h11*h22-h21*h21;
+		dA=-(h22*g1 - h21 * g2) / det;
+		dB=-(-h21*g1+ h11 * g2) / det;
+		gd=g1*dA+g2*dB;
+
+
+		stepsize = 1;		// Line Search
+		while (stepsize >= min_step)
+		{
+			newA = A + stepsize * dA;
+			newB = B + stepsize * dB;
+
+			// New function value
+			newf = 0.0;
+			for (i=0;i<l;i++)
+			{
+				fApB = dec_values[i]*newA+newB;
+				if (fApB >= 0)
+					newf += t[i]*fApB + log(1+exp(-fApB));
+				else
+					newf += (t[i] - 1)*fApB +log(1+exp(fApB));
+			}
+			// Check sufficient decrease
+			if (newf<fval+0.0001*stepsize*gd)
+			{
+				A=newA;B=newB;fval=newf;
+				break;
+			}
+			else
+				stepsize = stepsize / 2.0;
+		}
+
+		if (stepsize < min_step)
+		{
+			info("Line search fails in two-class probability estimates\n");
+			break;
+		}
+	}
+
+	if (iter>=max_iter)
+		info("Reaching maximal iterations in two-class probability estimates\n");
+	free(t);
+}
+
+static double sigmoid_predict(double decision_value, double A, double B)
+{
+	double fApB = decision_value*A+B;
+	// 1-p used later; avoid catastrophic cancellation
+	if (fApB >= 0)
+		return exp(-fApB)/(1.0+exp(-fApB));
+	else
+		return 1.0/(1+exp(fApB)) ;
+}
+
+// Method 2 from the multiclass_prob paper by Wu, Lin, and Weng
+static void multiclass_probability(int k, double **r, double *p)
+{
+	int t,j;
+	int iter = 0, max_iter=max(100,k);
+	double **Q=Malloc(double *,k);
+	double *Qp=Malloc(double,k);
+	double pQp, eps=0.005/k;
+	
+	for (t=0;t<k;t++)
+	{
+		p[t]=1.0/k;  // Valid if k = 1
+		Q[t]=Malloc(double,k);
+		Q[t][t]=0;
+		for (j=0;j<t;j++)
+		{
+			Q[t][t]+=r[j][t]*r[j][t];
+			Q[t][j]=Q[j][t];
+		}
+		for (j=t+1;j<k;j++)
+		{
+			Q[t][t]+=r[j][t]*r[j][t];
+			Q[t][j]=-r[j][t]*r[t][j];
+		}
+	}
+	for (iter=0;iter<max_iter;iter++)
+	{
+		// stopping condition, recalculate QP,pQP for numerical accuracy
+		pQp=0;
+		for (t=0;t<k;t++)
+		{
+			Qp[t]=0;
+			for (j=0;j<k;j++)
+				Qp[t]+=Q[t][j]*p[j];
+			pQp+=p[t]*Qp[t];
+		}
+		double max_error=0;
+		for (t=0;t<k;t++)
+		{
+			double error=fabs(Qp[t]-pQp);
+			if (error>max_error)
+				max_error=error;
+		}
+		if (max_error<eps) break;
+		
+		for (t=0;t<k;t++)
+		{
+			double diff=(-Qp[t]+pQp)/Q[t][t];
+			p[t]+=diff;
+			pQp=(pQp+diff*(diff*Q[t][t]+2*Qp[t]))/(1+diff)/(1+diff);
+			for (j=0;j<k;j++)
+			{
+				Qp[j]=(Qp[j]+diff*Q[t][j])/(1+diff);
+				p[j]/=(1+diff);
+			}
+		}
+	}
+	if (iter>=max_iter)
+		info("Exceeds max_iter in multiclass_prob\n");
+	for(t=0;t<k;t++) free(Q[t]);
+	free(Q);
+	free(Qp);
+}
+
+// Cross-validation decision values for probability estimates
+static void svm_binary_svc_probability(
+	const svm_problem *prob, const svm_parameter *param,
+	double Cp, double Cn, double& probA, double& probB)
+{
+	int i;
+	int nr_fold = 5;
+	int *perm = Malloc(int,prob->l);
+	double *dec_values = Malloc(double,prob->l);
+
+	// random shuffle
+	for(i=0;i<prob->l;i++) perm[i]=i;
+	for(i=0;i<prob->l;i++)
+	{
+		int j = i+rand()%(prob->l-i);
+		swap(perm[i],perm[j]);
+	}
+	for(i=0;i<nr_fold;i++)
+	{
+		int begin = i*prob->l/nr_fold;
+		int end = (i+1)*prob->l/nr_fold;
+		int j,k;
+		struct svm_problem subprob;
+
+		subprob.l = prob->l-(end-begin);
+		subprob.x = Malloc(struct svm_node*,subprob.l);
+		subprob.y = Malloc(double,subprob.l);
+			
+		k=0;
+		for(j=0;j<begin;j++)
+		{
+			subprob.x[k] = prob->x[perm[j]];
+			subprob.y[k] = prob->y[perm[j]];
+			++k;
+		}
+		for(j=end;j<prob->l;j++)
+		{
+			subprob.x[k] = prob->x[perm[j]];
+			subprob.y[k] = prob->y[perm[j]];
+			++k;
+		}
+		int p_count=0,n_count=0;
+		for(j=0;j<k;j++)
+			if(subprob.y[j]>0)
+				p_count++;
+			else
+				n_count++;
+
+		if(p_count==0 && n_count==0)
+			for(j=begin;j<end;j++)
+				dec_values[perm[j]] = 0;
+		else if(p_count > 0 && n_count == 0)
+			for(j=begin;j<end;j++)
+				dec_values[perm[j]] = 1;
+		else if(p_count == 0 && n_count > 0)
+			for(j=begin;j<end;j++)
+				dec_values[perm[j]] = -1;
+		else
+		{
+			svm_parameter subparam = *param;
+			subparam.probability=0;
+			subparam.C=1.0;
+			subparam.nr_weight=2;
+			subparam.weight_label = Malloc(int,2);
+			subparam.weight = Malloc(double,2);
+			subparam.weight_label[0]=+1;
+			subparam.weight_label[1]=-1;
+			subparam.weight[0]=Cp;
+			subparam.weight[1]=Cn;
+			struct svm_model *submodel = svm_train(&subprob,&subparam);
+			for(j=begin;j<end;j++)
+			{
+				svm_predict_values(submodel,prob->x[perm[j]],&(dec_values[perm[j]])); 
+				// ensure +1 -1 order; reason not using CV subroutine
+				dec_values[perm[j]] *= submodel->label[0];
+			}		
+			svm_free_and_destroy_model(&submodel);
+			svm_destroy_param(&subparam);
+		}
+		free(subprob.x);
+		free(subprob.y);
+	}		
+	sigmoid_train(prob->l,dec_values,prob->y,probA,probB);
+	free(dec_values);
+	free(perm);
+}
+
+// Return parameter of a Laplace distribution 
+static double svm_svr_probability(
+	const svm_problem *prob, const svm_parameter *param)
+{
+	int i;
+	int nr_fold = 5;
+	double *ymv = Malloc(double,prob->l);
+	double mae = 0;
+
+	svm_parameter newparam = *param;
+	newparam.probability = 0;
+	svm_cross_validation(prob,&newparam,nr_fold,ymv);
+	for(i=0;i<prob->l;i++)
+	{
+		ymv[i]=prob->y[i]-ymv[i];
+		mae += fabs(ymv[i]);
+	}		
+	mae /= prob->l;
+	double std=sqrt(2*mae*mae);
+	int count=0;
+	mae=0;
+	for(i=0;i<prob->l;i++)
+		if (fabs(ymv[i]) > 5*std) 
+			count=count+1;
+		else 
+			mae+=fabs(ymv[i]);
+	mae /= (prob->l-count);
+	info("Prob. model for test data: target value = predicted value + z,\nz: Laplace distribution e^(-|z|/sigma)/(2sigma),sigma= %g\n",mae);
+	free(ymv);
+	return mae;
+}
+
+
+// label: label name, start: begin of each class, count: #data of classes, perm: indices to the original data
+// perm, length l, must be allocated before calling this subroutine
+static void svm_group_classes(const svm_problem *prob, int *nr_class_ret, int **label_ret, int **start_ret, int **count_ret, int *perm)
+{
+	int l = prob->l;
+	int max_nr_class = 16;
+	int nr_class = 0;
+	int *label = Malloc(int,max_nr_class);
+	int *count = Malloc(int,max_nr_class);
+	int *data_label = Malloc(int,l);	
+	int i;
+
+	for(i=0;i<l;i++)
+	{
+		int this_label = (int)prob->y[i];
+		int j;
+		for(j=0;j<nr_class;j++)
+		{
+			if(this_label == label[j])
+			{
+				++count[j];
+				break;
+			}
+		}
+		data_label[i] = j;
+		if(j == nr_class)
+		{
+			if(nr_class == max_nr_class)
+			{
+				max_nr_class *= 2;
+				label = (int *)realloc(label,max_nr_class*sizeof(int));
+				count = (int *)realloc(count,max_nr_class*sizeof(int));
+			}
+			label[nr_class] = this_label;
+			count[nr_class] = 1;
+			++nr_class;
+		}
+	}
+
+	int *start = Malloc(int,nr_class);
+	start[0] = 0;
+	for(i=1;i<nr_class;i++)
+		start[i] = start[i-1]+count[i-1];
+	for(i=0;i<l;i++)
+	{
+		perm[start[data_label[i]]] = i;
+		++start[data_label[i]];
+	}
+	start[0] = 0;
+	for(i=1;i<nr_class;i++)
+		start[i] = start[i-1]+count[i-1];
+
+	*nr_class_ret = nr_class;
+	*label_ret = label;
+	*start_ret = start;
+	*count_ret = count;
+	free(data_label);
+}
+
+//
+// Interface functions
+//
+svm_model *svm_train(const svm_problem *prob, const svm_parameter *param)
+{
+	svm_model *model = Malloc(svm_model,1);
+	model->param = *param;
+	model->free_sv = 0;	// XXX
+
+	if(param->svm_type == ONE_CLASS ||
+	   param->svm_type == EPSILON_SVR ||
+	   param->svm_type == NU_SVR)
+	{
+		// regression or one-class-svm
+		model->nr_class = 2;
+		model->label = NULL;
+		model->nSV = NULL;
+		model->probA = NULL; model->probB = NULL;
+		model->sv_coef = Malloc(double *,1);
+
+		if(param->probability && 
+		   (param->svm_type == EPSILON_SVR ||
+		    param->svm_type == NU_SVR))
+		{
+			model->probA = Malloc(double,1);
+			model->probA[0] = svm_svr_probability(prob,param);
+		}
+
+		decision_function f = svm_train_one(prob,param,0,0);
+		model->rho = Malloc(double,1);
+		model->rho[0] = f.rho;
+
+		int nSV = 0;
+		int i;
+		for(i=0;i<prob->l;i++)
+			if(fabs(f.alpha[i]) > 0) ++nSV;
+		model->l = nSV;
+		model->SV = Malloc(svm_node *,nSV);
+		model->sv_coef[0] = Malloc(double,nSV);
+		int j = 0;
+		for(i=0;i<prob->l;i++)
+			if(fabs(f.alpha[i]) > 0)
+			{
+				model->SV[j] = prob->x[i];
+				model->sv_coef[0][j] = f.alpha[i];
+				++j;
+			}		
+
+		free(f.alpha);
+	}
+	else
+	{
+		// classification
+		int l = prob->l;
+		int nr_class;
+		int *label = NULL;
+		int *start = NULL;
+		int *count = NULL;
+		int *perm = Malloc(int,l);
+
+		// group training data of the same class
+		svm_group_classes(prob,&nr_class,&label,&start,&count,perm);
+		if(nr_class == 1) 
+			info("WARNING: training data in only one class. See README for details.\n");
+		
+		svm_node **x = Malloc(svm_node *,l);
+		int i;
+		for(i=0;i<l;i++)
+			x[i] = prob->x[perm[i]];
+
+		// calculate weighted C
+
+		double *weighted_C = Malloc(double, nr_class);
+		for(i=0;i<nr_class;i++)
+			weighted_C[i] = param->C;
+		for(i=0;i<param->nr_weight;i++)
+		{	
+			int j;
+			for(j=0;j<nr_class;j++)
+				if(param->weight_label[i] == label[j])
+					break;
+			if(j == nr_class)
+				fprintf(stderr,"WARNING: class label %d specified in weight is not found\n", param->weight_label[i]);
+			else
+				weighted_C[j] *= param->weight[i];
+		}
+
+		// train k*(k-1)/2 models
+		
+		bool *nonzero = Malloc(bool,l);
+		for(i=0;i<l;i++)
+			nonzero[i] = false;
+		decision_function *f = Malloc(decision_function,nr_class*(nr_class-1)/2);
+
+		double *probA=NULL,*probB=NULL;
+		if (param->probability)
+		{
+			probA=Malloc(double,nr_class*(nr_class-1)/2);
+			probB=Malloc(double,nr_class*(nr_class-1)/2);
+		}
+
+		int p = 0;
+		for(i=0;i<nr_class;i++)
+			for(int j=i+1;j<nr_class;j++)
+			{
+				svm_problem sub_prob;
+				int si = start[i], sj = start[j];
+				int ci = count[i], cj = count[j];
+				sub_prob.l = ci+cj;
+				sub_prob.x = Malloc(svm_node *,sub_prob.l);
+				sub_prob.y = Malloc(double,sub_prob.l);
+				int k;
+				for(k=0;k<ci;k++)
+				{
+					sub_prob.x[k] = x[si+k];
+					sub_prob.y[k] = +1;
+				}
+				for(k=0;k<cj;k++)
+				{
+					sub_prob.x[ci+k] = x[sj+k];
+					sub_prob.y[ci+k] = -1;
+				}
+
+				if(param->probability)
+					svm_binary_svc_probability(&sub_prob,param,weighted_C[i],weighted_C[j],probA[p],probB[p]);
+
+				f[p] = svm_train_one(&sub_prob,param,weighted_C[i],weighted_C[j]);
+				for(k=0;k<ci;k++)
+					if(!nonzero[si+k] && fabs(f[p].alpha[k]) > 0)
+						nonzero[si+k] = true;
+				for(k=0;k<cj;k++)
+					if(!nonzero[sj+k] && fabs(f[p].alpha[ci+k]) > 0)
+						nonzero[sj+k] = true;
+				free(sub_prob.x);
+				free(sub_prob.y);
+				++p;
+			}
+
+		// build output
+
+		model->nr_class = nr_class;
+		
+		model->label = Malloc(int,nr_class);
+		for(i=0;i<nr_class;i++)
+			model->label[i] = label[i];
+		
+		model->rho = Malloc(double,nr_class*(nr_class-1)/2);
+		for(i=0;i<nr_class*(nr_class-1)/2;i++)
+			model->rho[i] = f[i].rho;
+
+		if(param->probability)
+		{
+			model->probA = Malloc(double,nr_class*(nr_class-1)/2);
+			model->probB = Malloc(double,nr_class*(nr_class-1)/2);
+			for(i=0;i<nr_class*(nr_class-1)/2;i++)
+			{
+				model->probA[i] = probA[i];
+				model->probB[i] = probB[i];
+			}
+		}
+		else
+		{
+			model->probA=NULL;
+			model->probB=NULL;
+		}
+
+		int total_sv = 0;
+		int *nz_count = Malloc(int,nr_class);
+		model->nSV = Malloc(int,nr_class);
+		for(i=0;i<nr_class;i++)
+		{
+			int nSV = 0;
+			for(int j=0;j<count[i];j++)
+				if(nonzero[start[i]+j])
+				{	
+					++nSV;
+					++total_sv;
+				}
+			model->nSV[i] = nSV;
+			nz_count[i] = nSV;
+		}
+		
+		info("Total nSV = %d\n",total_sv);
+
+		model->l = total_sv;
+		model->SV = Malloc(svm_node *,total_sv);
+		p = 0;
+		for(i=0;i<l;i++)
+			if(nonzero[i]) model->SV[p++] = x[i];
+
+		int *nz_start = Malloc(int,nr_class);
+		nz_start[0] = 0;
+		for(i=1;i<nr_class;i++)
+			nz_start[i] = nz_start[i-1]+nz_count[i-1];
+
+		model->sv_coef = Malloc(double *,nr_class-1);
+		for(i=0;i<nr_class-1;i++)
+			model->sv_coef[i] = Malloc(double,total_sv);
+
+		p = 0;
+		for(i=0;i<nr_class;i++)
+			for(int j=i+1;j<nr_class;j++)
+			{
+				// classifier (i,j): coefficients with
+				// i are in sv_coef[j-1][nz_start[i]...],
+				// j are in sv_coef[i][nz_start[j]...]
+
+				int si = start[i];
+				int sj = start[j];
+				int ci = count[i];
+				int cj = count[j];
+				
+				int q = nz_start[i];
+				int k;
+				for(k=0;k<ci;k++)
+					if(nonzero[si+k])
+						model->sv_coef[j-1][q++] = f[p].alpha[k];
+				q = nz_start[j];
+				for(k=0;k<cj;k++)
+					if(nonzero[sj+k])
+						model->sv_coef[i][q++] = f[p].alpha[ci+k];
+				++p;
+			}
+		
+		free(label);
+		free(probA);
+		free(probB);
+		free(count);
+		free(perm);
+		free(start);
+		free(x);
+		free(weighted_C);
+		free(nonzero);
+		for(i=0;i<nr_class*(nr_class-1)/2;i++)
+			free(f[i].alpha);
+		free(f);
+		free(nz_count);
+		free(nz_start);
+	}
+	return model;
+}
+
+// Stratified cross validation
+void svm_cross_validation(const svm_problem *prob, const svm_parameter *param, int nr_fold, double *target)
+{
+	int i;
+	int *fold_start = Malloc(int,nr_fold+1);
+	int l = prob->l;
+	int *perm = Malloc(int,l);
+	int nr_class;
+
+	// stratified cv may not give leave-one-out rate
+	// Each class to l folds -> some folds may have zero elements
+	if((param->svm_type == C_SVC ||
+	    param->svm_type == NU_SVC) && nr_fold < l)
+	{
+		int *start = NULL;
+		int *label = NULL;
+		int *count = NULL;
+		svm_group_classes(prob,&nr_class,&label,&start,&count,perm);
+
+		// random shuffle and then data grouped by fold using the array perm
+		int *fold_count = Malloc(int,nr_fold);
+		int c;
+		int *index = Malloc(int,l);
+		for(i=0;i<l;i++)
+			index[i]=perm[i];
+		for (c=0; c<nr_class; c++) 
+			for(i=0;i<count[c];i++)
+			{
+				int j = i+rand()%(count[c]-i);
+				swap(index[start[c]+j],index[start[c]+i]);
+			}
+		for(i=0;i<nr_fold;i++)
+		{
+			fold_count[i] = 0;
+			for (c=0; c<nr_class;c++)
+				fold_count[i]+=(i+1)*count[c]/nr_fold-i*count[c]/nr_fold;
+		}
+		fold_start[0]=0;
+		for (i=1;i<=nr_fold;i++)
+			fold_start[i] = fold_start[i-1]+fold_count[i-1];
+		for (c=0; c<nr_class;c++)
+			for(i=0;i<nr_fold;i++)
+			{
+				int begin = start[c]+i*count[c]/nr_fold;
+				int end = start[c]+(i+1)*count[c]/nr_fold;
+				for(int j=begin;j<end;j++)
+				{
+					perm[fold_start[i]] = index[j];
+					fold_start[i]++;
+				}
+			}
+		fold_start[0]=0;
+		for (i=1;i<=nr_fold;i++)
+			fold_start[i] = fold_start[i-1]+fold_count[i-1];
+		free(start);	
+		free(label);
+		free(count);	
+		free(index);
+		free(fold_count);
+	}
+	else
+	{
+		for(i=0;i<l;i++) perm[i]=i;
+		for(i=0;i<l;i++)
+		{
+			int j = i+rand()%(l-i);
+			swap(perm[i],perm[j]);
+		}
+		for(i=0;i<=nr_fold;i++)
+			fold_start[i]=i*l/nr_fold;
+	}
+
+	for(i=0;i<nr_fold;i++)
+	{
+		int begin = fold_start[i];
+		int end = fold_start[i+1];
+		int j,k;
+		struct svm_problem subprob;
+
+		subprob.l = l-(end-begin);
+		subprob.x = Malloc(struct svm_node*,subprob.l);
+		subprob.y = Malloc(double,subprob.l);
+			
+		k=0;
+		for(j=0;j<begin;j++)
+		{
+			subprob.x[k] = prob->x[perm[j]];
+			subprob.y[k] = prob->y[perm[j]];
+			++k;
+		}
+		for(j=end;j<l;j++)
+		{
+			subprob.x[k] = prob->x[perm[j]];
+			subprob.y[k] = prob->y[perm[j]];
+			++k;
+		}
+		struct svm_model *submodel = svm_train(&subprob,param);
+		if(param->probability && 
+		   (param->svm_type == C_SVC || param->svm_type == NU_SVC))
+		{
+			double *prob_estimates=Malloc(double,svm_get_nr_class(submodel));
+			for(j=begin;j<end;j++)
+				target[perm[j]] = svm_predict_probability(submodel,prob->x[perm[j]],prob_estimates);
+			free(prob_estimates);			
+		}
+		else
+			for(j=begin;j<end;j++)
+				target[perm[j]] = svm_predict(submodel,prob->x[perm[j]]);
+		svm_free_and_destroy_model(&submodel);
+		free(subprob.x);
+		free(subprob.y);
+	}		
+	free(fold_start);
+	free(perm);	
+}
+
+
+int svm_get_svm_type(const svm_model *model)
+{
+	return model->param.svm_type;
+}
+
+int svm_get_nr_class(const svm_model *model)
+{
+	return model->nr_class;
+}
+
+void svm_get_labels(const svm_model *model, int* label)
+{
+	if (model->label != NULL)
+		for(int i=0;i<model->nr_class;i++)
+			label[i] = model->label[i];
+}
+
+double svm_get_svr_probability(const svm_model *model)
+{
+	if ((model->param.svm_type == EPSILON_SVR || model->param.svm_type == NU_SVR) &&
+	    model->probA!=NULL)
+		return model->probA[0];
+	else
+	{
+		fprintf(stderr,"Model doesn't contain information for SVR probability inference\n");
+		return 0;
+	}
+}
+
+double svm_predict_values(const svm_model *model, const svm_node *x, double* dec_values)
+{
+	int i;
+	if(model->param.svm_type == ONE_CLASS ||
+	   model->param.svm_type == EPSILON_SVR ||
+	   model->param.svm_type == NU_SVR)
+	{
+		double *sv_coef = model->sv_coef[0];
+		double sum = 0;
+		for(i=0;i<model->l;i++)
+			sum += sv_coef[i] * Kernel::k_function(x,model->SV[i],model->param);
+		sum -= model->rho[0];
+		*dec_values = sum;
+
+		if(model->param.svm_type == ONE_CLASS)
+			return (sum>0)?1:-1;
+		else
+			return sum;
+	}
+	else
+	{
+		int nr_class = model->nr_class;
+		int l = model->l;
+		
+		double *kvalue = Malloc(double,l);
+		for(i=0;i<l;i++)
+			kvalue[i] = Kernel::k_function(x,model->SV[i],model->param);
+
+		int *start = Malloc(int,nr_class);
+		start[0] = 0;
+		for(i=1;i<nr_class;i++)
+			start[i] = start[i-1]+model->nSV[i-1];
+
+		int *vote = Malloc(int,nr_class);
+		for(i=0;i<nr_class;i++)
+			vote[i] = 0;
+
+		int p=0;
+		for(i=0;i<nr_class;i++)
+			for(int j=i+1;j<nr_class;j++)
+			{
+				double sum = 0;
+				int si = start[i];
+				int sj = start[j];
+				int ci = model->nSV[i];
+				int cj = model->nSV[j];
+				
+				int k;
+				double *coef1 = model->sv_coef[j-1];
+				double *coef2 = model->sv_coef[i];
+				for(k=0;k<ci;k++)
+					sum += coef1[si+k] * kvalue[si+k];
+				for(k=0;k<cj;k++)
+					sum += coef2[sj+k] * kvalue[sj+k];
+				sum -= model->rho[p];
+				dec_values[p] = sum;
+
+				if(dec_values[p] > 0)
+					++vote[i];
+				else
+					++vote[j];
+				p++;
+			}
+
+		int vote_max_idx = 0;
+		for(i=1;i<nr_class;i++)
+			if(vote[i] > vote[vote_max_idx])
+				vote_max_idx = i;
+
+		free(kvalue);
+		free(start);
+		free(vote);
+		return model->label[vote_max_idx];
+	}
+}
+
+double svm_predict(const svm_model *model, const svm_node *x)
+{
+	int nr_class = model->nr_class;
+	double *dec_values;
+	if(model->param.svm_type == ONE_CLASS ||
+	   model->param.svm_type == EPSILON_SVR ||
+	   model->param.svm_type == NU_SVR)
+		dec_values = Malloc(double, 1);
+	else 
+		dec_values = Malloc(double, nr_class*(nr_class-1)/2);
+	double pred_result = svm_predict_values(model, x, dec_values);
+	free(dec_values);
+	return pred_result;
+}
+
+double svm_predict_probability(
+	const svm_model *model, const svm_node *x, double *prob_estimates)
+{
+	if ((model->param.svm_type == C_SVC || model->param.svm_type == NU_SVC) &&
+	    model->probA!=NULL && model->probB!=NULL)
+	{
+		int i;
+		int nr_class = model->nr_class;
+		double *dec_values = Malloc(double, nr_class*(nr_class-1)/2);
+		svm_predict_values(model, x, dec_values);
+
+		double min_prob=1e-7;
+		double **pairwise_prob=Malloc(double *,nr_class);
+		for(i=0;i<nr_class;i++)
+			pairwise_prob[i]=Malloc(double,nr_class);
+		int k=0;
+		for(i=0;i<nr_class;i++)
+			for(int j=i+1;j<nr_class;j++)
+			{
+				pairwise_prob[i][j]=min(max(sigmoid_predict(dec_values[k],model->probA[k],model->probB[k]),min_prob),1-min_prob);
+				pairwise_prob[j][i]=1-pairwise_prob[i][j];
+				k++;
+			}
+		multiclass_probability(nr_class,pairwise_prob,prob_estimates);
+
+		int prob_max_idx = 0;
+		for(i=1;i<nr_class;i++)
+			if(prob_estimates[i] > prob_estimates[prob_max_idx])
+				prob_max_idx = i;
+		for(i=0;i<nr_class;i++)
+			free(pairwise_prob[i]);
+		free(dec_values);
+		free(pairwise_prob);	     
+		return model->label[prob_max_idx];
+	}
+	else 
+		return svm_predict(model, x);
+}
+
+static const char *svm_type_table[] =
+{
+	"c_svc","nu_svc","one_class","epsilon_svr","nu_svr",NULL
+};
+
+static const char *kernel_type_table[]=
+{
+	"linear","polynomial","rbf","sigmoid","precomputed",NULL
+};
+
+int svm_save_model(const char *model_file_name, const svm_model *model)
+{
+	FILE *fp = fopen(model_file_name,"w");
+	if(fp==NULL) return -1;
+
+	const svm_parameter& param = model->param;
+
+	fprintf(fp,"svm_type %s\n", svm_type_table[param.svm_type]);
+	fprintf(fp,"kernel_type %s\n", kernel_type_table[param.kernel_type]);
+
+	if(param.kernel_type == POLY)
+		fprintf(fp,"degree %d\n", param.degree);
+
+	if(param.kernel_type == POLY || param.kernel_type == RBF || param.kernel_type == SIGMOID)
+		fprintf(fp,"gamma %g\n", param.gamma);
+
+	if(param.kernel_type == POLY || param.kernel_type == SIGMOID)
+		fprintf(fp,"coef0 %g\n", param.coef0);
+
+	int nr_class = model->nr_class;
+	int l = model->l;
+	fprintf(fp, "nr_class %d\n", nr_class);
+	fprintf(fp, "total_sv %d\n",l);
+	
+	{
+		fprintf(fp, "rho");
+		for(int i=0;i<nr_class*(nr_class-1)/2;i++)
+			fprintf(fp," %g",model->rho[i]);
+		fprintf(fp, "\n");
+	}
+	
+	if(model->label)
+	{
+		fprintf(fp, "label");
+		for(int i=0;i<nr_class;i++)
+			fprintf(fp," %d",model->label[i]);
+		fprintf(fp, "\n");
+	}
+
+	if(model->probA) // regression has probA only
+	{
+		fprintf(fp, "probA");
+		for(int i=0;i<nr_class*(nr_class-1)/2;i++)
+			fprintf(fp," %g",model->probA[i]);
+		fprintf(fp, "\n");
+	}
+	if(model->probB)
+	{
+		fprintf(fp, "probB");
+		for(int i=0;i<nr_class*(nr_class-1)/2;i++)
+			fprintf(fp," %g",model->probB[i]);
+		fprintf(fp, "\n");
+	}
+
+	if(model->nSV)
+	{
+		fprintf(fp, "nr_sv");
+		for(int i=0;i<nr_class;i++)
+			fprintf(fp," %d",model->nSV[i]);
+		fprintf(fp, "\n");
+	}
+
+	fprintf(fp, "SV\n");
+	const double * const *sv_coef = model->sv_coef;
+	const svm_node * const *SV = model->SV;
+
+	for(int i=0;i<l;i++)
+	{
+		for(int j=0;j<nr_class-1;j++)
+			fprintf(fp, "%.16g ",sv_coef[j][i]);
+
+		const svm_node *p = SV[i];
+
+		if(param.kernel_type == PRECOMPUTED)
+			fprintf(fp,"0:%d ",(int)(p->value));
+		else
+			while(p->index != -1)
+			{
+				fprintf(fp,"%d:%.8g ",p->index,p->value);
+				p++;
+			}
+		fprintf(fp, "\n");
+	}
+	if (ferror(fp) != 0 || fclose(fp) != 0) return -1;
+	else return 0;
+}
+
+static char *line = NULL;
+static int max_line_len;
+
+static char* readline(FILE *input)
+{
+	int len;
+
+	if(fgets(line,max_line_len,input) == NULL)
+		return NULL;
+
+	while(strrchr(line,'\n') == NULL)
+	{
+		max_line_len *= 2;
+		line = (char *) realloc(line,max_line_len);
+		len = (int) strlen(line);
+		if(fgets(line+len,max_line_len-len,input) == NULL)
+			break;
+	}
+	return line;
+}
+
+svm_model *svm_load_model(const char *model_file_name)
+{
+	FILE *fp = fopen(model_file_name,"rb");
+	if(fp==NULL) return NULL;
+	
+	// read parameters
+
+	svm_model *model = Malloc(svm_model,1);
+	svm_parameter& param = model->param;
+	model->rho = NULL;
+	model->probA = NULL;
+	model->probB = NULL;
+	model->label = NULL;
+	model->nSV = NULL;
+
+	char cmd[81];
+	while(1)
+	{
+		fscanf(fp,"%80s",cmd);
+
+		if(strcmp(cmd,"svm_type")==0)
+		{
+			fscanf(fp,"%80s",cmd);
+			int i;
+			for(i=0;svm_type_table[i];i++)
+			{
+				if(strcmp(svm_type_table[i],cmd)==0)
+				{
+					param.svm_type=i;
+					break;
+				}
+			}
+			if(svm_type_table[i] == NULL)
+			{
+				fprintf(stderr,"unknown svm type.\n");
+				free(model->rho);
+				free(model->label);
+				free(model->nSV);
+				free(model);
+				return NULL;
+			}
+		}
+		else if(strcmp(cmd,"kernel_type")==0)
+		{		
+			fscanf(fp,"%80s",cmd);
+			int i;
+			for(i=0;kernel_type_table[i];i++)
+			{
+				if(strcmp(kernel_type_table[i],cmd)==0)
+				{
+					param.kernel_type=i;
+					break;
+				}
+			}
+			if(kernel_type_table[i] == NULL)
+			{
+				fprintf(stderr,"unknown kernel function.\n");
+				free(model->rho);
+				free(model->label);
+				free(model->nSV);
+				free(model);
+				return NULL;
+			}
+		}
+		else if(strcmp(cmd,"degree")==0)
+			fscanf(fp,"%d",&param.degree);
+		else if(strcmp(cmd,"gamma")==0)
+			fscanf(fp,"%lf",&param.gamma);
+		else if(strcmp(cmd,"coef0")==0)
+			fscanf(fp,"%lf",&param.coef0);
+		else if(strcmp(cmd,"nr_class")==0)
+			fscanf(fp,"%d",&model->nr_class);
+		else if(strcmp(cmd,"total_sv")==0)
+			fscanf(fp,"%d",&model->l);
+		else if(strcmp(cmd,"rho")==0)
+		{
+			int n = model->nr_class * (model->nr_class-1)/2;
+			model->rho = Malloc(double,n);
+			for(int i=0;i<n;i++)
+				fscanf(fp,"%lf",&model->rho[i]);
+		}
+		else if(strcmp(cmd,"label")==0)
+		{
+			int n = model->nr_class;
+			model->label = Malloc(int,n);
+			for(int i=0;i<n;i++)
+				fscanf(fp,"%d",&model->label[i]);
+		}
+		else if(strcmp(cmd,"probA")==0)
+		{
+			int n = model->nr_class * (model->nr_class-1)/2;
+			model->probA = Malloc(double,n);
+			for(int i=0;i<n;i++)
+				fscanf(fp,"%lf",&model->probA[i]);
+		}
+		else if(strcmp(cmd,"probB")==0)
+		{
+			int n = model->nr_class * (model->nr_class-1)/2;
+			model->probB = Malloc(double,n);
+			for(int i=0;i<n;i++)
+				fscanf(fp,"%lf",&model->probB[i]);
+		}
+		else if(strcmp(cmd,"nr_sv")==0)
+		{
+			int n = model->nr_class;
+			model->nSV = Malloc(int,n);
+			for(int i=0;i<n;i++)
+				fscanf(fp,"%d",&model->nSV[i]);
+		}
+		else if(strcmp(cmd,"SV")==0)
+		{
+			while(1)
+			{
+				int c = getc(fp);
+				if(c==EOF || c=='\n') break;	
+			}
+			break;
+		}
+		else
+		{
+			fprintf(stderr,"unknown text in model file: [%s]\n",cmd);
+			free(model->rho);
+			free(model->label);
+			free(model->nSV);
+			free(model);
+			return NULL;
+		}
+	}
+
+	// read sv_coef and SV
+
+	int elements = 0;
+	long pos = ftell(fp);
+
+	max_line_len = 1024;
+	line = Malloc(char,max_line_len);
+	char *p,*endptr,*idx,*val;
+
+	while(readline(fp)!=NULL)
+	{
+		p = strtok(line,":");
+		while(1)
+		{
+			p = strtok(NULL,":");
+			if(p == NULL)
+				break;
+			++elements;
+		}
+	}
+	elements += model->l;
+
+	fseek(fp,pos,SEEK_SET);
+
+	int m = model->nr_class - 1;
+	int l = model->l;
+	model->sv_coef = Malloc(double *,m);
+	int i;
+	for(i=0;i<m;i++)
+		model->sv_coef[i] = Malloc(double,l);
+	model->SV = Malloc(svm_node*,l);
+	svm_node *x_space = NULL;
+	if(l>0) x_space = Malloc(svm_node,elements);
+
+	int j=0;
+	for(i=0;i<l;i++)
+	{
+		readline(fp);
+		model->SV[i] = &x_space[j];
+
+		p = strtok(line, " \t");
+		model->sv_coef[0][i] = strtod(p,&endptr);
+		for(int k=1;k<m;k++)
+		{
+			p = strtok(NULL, " \t");
+			model->sv_coef[k][i] = strtod(p,&endptr);
+		}
+
+		while(1)
+		{
+			idx = strtok(NULL, ":");
+			val = strtok(NULL, " \t");
+
+			if(val == NULL)
+				break;
+			x_space[j].index = (int) strtol(idx,&endptr,10);
+			x_space[j].value = strtod(val,&endptr);
+
+			++j;
+		}
+		x_space[j++].index = -1;
+	}
+	free(line);
+
+	if (ferror(fp) != 0 || fclose(fp) != 0)
+		return NULL;
+
+	model->free_sv = 1;	// XXX
+	return model;
+}
+
+void svm_free_model_content(svm_model* model_ptr)
+{
+	if(model_ptr->free_sv && model_ptr->l > 0 && model_ptr->SV != NULL)
+		free((void *)(model_ptr->SV[0]));
+	if(model_ptr->sv_coef)
+	{
+		for(int i=0;i<model_ptr->nr_class-1;i++)
+			free(model_ptr->sv_coef[i]);
+	}
+
+	free(model_ptr->SV);
+	model_ptr->SV = NULL;
+
+	free(model_ptr->sv_coef);
+	model_ptr->sv_coef = NULL;
+
+	free(model_ptr->rho);
+	model_ptr->rho = NULL;
+
+	free(model_ptr->label);
+	model_ptr->label= NULL;
+
+	free(model_ptr->probA);
+	model_ptr->probA = NULL;
+
+	free(model_ptr->probB);
+	model_ptr->probB= NULL;
+
+	free(model_ptr->nSV);
+	model_ptr->nSV = NULL;
+}
+
+void svm_free_and_destroy_model(svm_model** model_ptr_ptr)
+{
+	if(model_ptr_ptr != NULL && *model_ptr_ptr != NULL)
+	{
+		svm_free_model_content(*model_ptr_ptr);
+		free(*model_ptr_ptr);
+		*model_ptr_ptr = NULL;
+	}
+}
+
+void svm_destroy_param(svm_parameter* param)
+{
+	free(param->weight_label);
+	free(param->weight);
+}
+
+const char *svm_check_parameter(const svm_problem *prob, const svm_parameter *param)
+{
+	// svm_type
+
+	int svm_type = param->svm_type;
+	if(svm_type != C_SVC &&
+	   svm_type != NU_SVC &&
+	   svm_type != ONE_CLASS &&
+	   svm_type != EPSILON_SVR &&
+	   svm_type != NU_SVR)
+		return "unknown svm type";
+	
+	// kernel_type, degree
+	
+	int kernel_type = param->kernel_type;
+	if(kernel_type != LINEAR &&
+	   kernel_type != POLY &&
+	   kernel_type != RBF &&
+	   kernel_type != SIGMOID &&
+	   kernel_type != PRECOMPUTED)
+		return "unknown kernel type";
+
+	if(param->gamma < 0)
+		return "gamma < 0";
+
+	if(param->degree < 0)
+		return "degree of polynomial kernel < 0";
+
+	// cache_size,eps,C,nu,p,shrinking
+
+	if(param->cache_size <= 0)
+		return "cache_size <= 0";
+
+	if(param->eps <= 0)
+		return "eps <= 0";
+
+	if(svm_type == C_SVC ||
+	   svm_type == EPSILON_SVR ||
+	   svm_type == NU_SVR)
+		if(param->C <= 0)
+			return "C <= 0";
+
+	if(svm_type == NU_SVC ||
+	   svm_type == ONE_CLASS ||
+	   svm_type == NU_SVR)
+		if(param->nu <= 0 || param->nu > 1)
+			return "nu <= 0 or nu > 1";
+
+	if(svm_type == EPSILON_SVR)
+		if(param->p < 0)
+			return "p < 0";
+
+	if(param->shrinking != 0 &&
+	   param->shrinking != 1)
+		return "shrinking != 0 and shrinking != 1";
+
+	if(param->probability != 0 &&
+	   param->probability != 1)
+		return "probability != 0 and probability != 1";
+
+	if(param->probability == 1 &&
+	   svm_type == ONE_CLASS)
+		return "one-class SVM probability output not supported yet";
+
+
+	// check whether nu-svc is feasible
+	
+	if(svm_type == NU_SVC)
+	{
+		int l = prob->l;
+		int max_nr_class = 16;
+		int nr_class = 0;
+		int *label = Malloc(int,max_nr_class);
+		int *count = Malloc(int,max_nr_class);
+
+		int i;
+		for(i=0;i<l;i++)
+		{
+			int this_label = (int)prob->y[i];
+			int j;
+			for(j=0;j<nr_class;j++)
+				if(this_label == label[j])
+				{
+					++count[j];
+					break;
+				}
+			if(j == nr_class)
+			{
+				if(nr_class == max_nr_class)
+				{
+					max_nr_class *= 2;
+					label = (int *)realloc(label,max_nr_class*sizeof(int));
+					count = (int *)realloc(count,max_nr_class*sizeof(int));
+				}
+				label[nr_class] = this_label;
+				count[nr_class] = 1;
+				++nr_class;
+			}
+		}
+	
+		for(i=0;i<nr_class;i++)
+		{
+			int n1 = count[i];
+			for(int j=i+1;j<nr_class;j++)
+			{
+				int n2 = count[j];
+				if(param->nu*(n1+n2)/2 > min(n1,n2))
+				{
+					free(label);
+					free(count);
+					return "specified nu is infeasible";
+				}
+			}
+		}
+		free(label);
+		free(count);
+	}
+
+	return NULL;
+}
+
+int svm_check_probability_model(const svm_model *model)
+{
+	return ((model->param.svm_type == C_SVC || model->param.svm_type == NU_SVC) &&
+		model->probA!=NULL && model->probB!=NULL) ||
+		((model->param.svm_type == EPSILON_SVR || model->param.svm_type == NU_SVR) &&
+		 model->probA!=NULL);
+}
+
+void svm_set_print_string_function(void (*print_func)(const char *))
+{
+	if(print_func == NULL)
+		svm_print_string = &print_string_stdout;
+	else
+		svm_print_string = print_func;
+}
diff --git a/src/modules/imagery/imagery_svm/svm.h b/src/modules/imagery/imagery_svm/svm.h
new file mode 100644
index 0000000..dbc5e08
--- /dev/null
+++ b/src/modules/imagery/imagery_svm/svm.h
@@ -0,0 +1,101 @@
+#ifndef _LIBSVM_H
+#define _LIBSVM_H
+
+#define LIBSVM_VERSION 311
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int libsvm_version;
+
+struct svm_node
+{
+	int index;
+	double value;
+};
+
+struct svm_problem
+{
+	int l;
+	double *y;
+	struct svm_node **x;
+};
+
+enum { C_SVC, NU_SVC, ONE_CLASS, EPSILON_SVR, NU_SVR };	/* svm_type */
+enum { LINEAR, POLY, RBF, SIGMOID, PRECOMPUTED }; /* kernel_type */
+
+struct svm_parameter
+{
+	int svm_type;
+	int kernel_type;
+	int degree;	/* for poly */
+	double gamma;	/* for poly/rbf/sigmoid */
+	double coef0;	/* for poly/sigmoid */
+
+	/* these are for training only */
+	double cache_size; /* in MB */
+	double eps;	/* stopping criteria */
+	double C;	/* for C_SVC, EPSILON_SVR and NU_SVR */
+	int nr_weight;		/* for C_SVC */
+	int *weight_label;	/* for C_SVC */
+	double* weight;		/* for C_SVC */
+	double nu;	/* for NU_SVC, ONE_CLASS, and NU_SVR */
+	double p;	/* for EPSILON_SVR */
+	int shrinking;	/* use the shrinking heuristics */
+	int probability; /* do probability estimates */
+};
+
+//
+// svm_model
+// 
+struct svm_model
+{
+	struct svm_parameter param;	/* parameter */
+	int nr_class;		/* number of classes, = 2 in regression/one class svm */
+	int l;			/* total #SV */
+	struct svm_node **SV;		/* SVs (SV[l]) */
+	double **sv_coef;	/* coefficients for SVs in decision functions (sv_coef[k-1][l]) */
+	double *rho;		/* constants in decision functions (rho[k*(k-1)/2]) */
+	double *probA;		/* pariwise probability information */
+	double *probB;
+
+	/* for classification only */
+
+	int *label;		/* label of each class (label[k]) */
+	int *nSV;		/* number of SVs for each class (nSV[k]) */
+				/* nSV[0] + nSV[1] + ... + nSV[k-1] = l */
+	/* XXX */
+	int free_sv;		/* 1 if svm_model is created by svm_load_model*/
+				/* 0 if svm_model is created by svm_train */
+};
+
+struct svm_model *svm_train(const struct svm_problem *prob, const struct svm_parameter *param);
+void svm_cross_validation(const struct svm_problem *prob, const struct svm_parameter *param, int nr_fold, double *target);
+
+int svm_save_model(const char *model_file_name, const struct svm_model *model);
+struct svm_model *svm_load_model(const char *model_file_name);
+
+int svm_get_svm_type(const struct svm_model *model);
+int svm_get_nr_class(const struct svm_model *model);
+void svm_get_labels(const struct svm_model *model, int *label);
+double svm_get_svr_probability(const struct svm_model *model);
+
+double svm_predict_values(const struct svm_model *model, const struct svm_node *x, double* dec_values);
+double svm_predict(const struct svm_model *model, const struct svm_node *x);
+double svm_predict_probability(const struct svm_model *model, const struct svm_node *x, double* prob_estimates);
+
+void svm_free_model_content(struct svm_model *model_ptr);
+void svm_free_and_destroy_model(struct svm_model **model_ptr_ptr);
+void svm_destroy_param(struct svm_parameter *param);
+
+const char *svm_check_parameter(const struct svm_problem *prob, const struct svm_parameter *param);
+int svm_check_probability_model(const struct svm_model *model);
+
+void svm_set_print_string_function(void (*print_func)(const char *));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LIBSVM_H */
diff --git a/src/modules/imagery/imagery_tools/Makefile.in b/src/modules/imagery/imagery_tools/Makefile.in
index 2db6d86..5fedf83 100644
--- a/src/modules/imagery/imagery_tools/Makefile.in
+++ b/src/modules/imagery/imagery_tools/Makefile.in
@@ -483,22 +483,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tasseled_cap.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/imagery/imagery_tools/landsat_import.cpp b/src/modules/imagery/imagery_tools/landsat_import.cpp
index c57e6fa..5edcfd6 100644
--- a/src/modules/imagery/imagery_tools/landsat_import.cpp
+++ b/src/modules/imagery/imagery_tools/landsat_import.cpp
@@ -231,8 +231,8 @@ bool CLandsat_Import::On_Execute(void)
 		{
 			DataObject_Set_Parameter(pR, "COLORS_TYPE" , 5);	// _TL("RGB Overlay")	// CLASSIFY_OVERLAY
 			DataObject_Set_Parameter(pR, "OVERLAY_MODE", 0);	// _TL("red=this, green=1, blue=2")
-			DataObject_Set_Parameter(pR, "OVERLAY_1"   , pG);
-			DataObject_Set_Parameter(pR, "OVERLAY_2"   , pB);
+			DataObject_Set_Parameter(pR, "OVERLAY_G"   , pG);
+			DataObject_Set_Parameter(pR, "OVERLAY_B"   , pB);
 
 			DataObject_Update(pR, true);
 		}
diff --git a/src/modules/imagery/imagery_tools/landsat_toar_core.cpp b/src/modules/imagery/imagery_tools/landsat_toar_core.cpp
index 155f0a3..3b8f3b2 100644
--- a/src/modules/imagery/imagery_tools/landsat_toar_core.cpp
+++ b/src/modules/imagery/imagery_tools/landsat_toar_core.cpp
@@ -212,7 +212,7 @@ bool Get_MetaData(const CSG_MetaData &MetaData, const CSG_String &key, CSG_Strin
 #define IF_GET_METADATA(key)	if( Get_MetaData(m, key, s) == true )
 
 //---------------------------------------------------------
-int lsat_old_mtl(const CSG_MetaData &m, lsat_data *lsat)
+bool lsat_old_mtl(const CSG_MetaData &m, lsat_data *lsat)
 {
 	CSG_String	s;
 
@@ -270,7 +270,7 @@ int lsat_old_mtl(const CSG_MetaData &m, lsat_data *lsat)
 }
 
 //---------------------------------------------------------
-int lsat_new_mtl(const CSG_MetaData &m, lsat_data * lsat)
+bool lsat_new_mtl(const CSG_MetaData &m, lsat_data * lsat)
 {
 	CSG_String	s;
 
@@ -423,7 +423,7 @@ bool lsat_metadata(const char *metafile, lsat_data *lsat)
 
 	//-----------------------------------------------------
 	char	mtldata[METADATA_SIZE];
-	int		i	= fread(mtldata, METADATA_SIZE, 1, f);
+	size_t	i	= fread(mtldata, METADATA_SIZE, 1, f);
 	fclose(f);
 
 	//-----------------------------------------------------
diff --git a/src/modules/imagery/imagery_tools/pansharpening.cpp b/src/modules/imagery/imagery_tools/pansharpening.cpp
index 47467af..58feb66 100644
--- a/src/modules/imagery/imagery_tools/pansharpening.cpp
+++ b/src/modules/imagery/imagery_tools/pansharpening.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: pansharpening.cpp 2208 2014-08-27 16:00:51Z oconrad $
+ * Version $Id: pansharpening.cpp 2464 2015-04-02 10:14:04Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -126,7 +126,7 @@ CPanSharp_IHS::CPanSharp_IHS(void)
 	Parameters.Add_Grid(pNode	, "B_SHARP"	, _TL("Blue")	, _TL(""), PARAMETER_OUTPUT, false);
 
 	Parameters.Add_Grid_List(
-		NULL	, "SHARPEN"		, _TL("Sharpend Channels"),
+		NULL	, "SHARPEN"		, _TL("Sharpened Channels"),
 		_TL(""),
 		PARAMETER_OUTPUT
 	);
@@ -341,7 +341,7 @@ CPanSharp_Brovey::CPanSharp_Brovey(void)
 	Parameters.Add_Grid(pNode	, "B_SHARP"	, _TL("Blue")	, _TL(""), PARAMETER_OUTPUT, false);
 
 	Parameters.Add_Grid_List(
-		NULL	, "SHARPEN"		, _TL("Sharpend Channels"),
+		NULL	, "SHARPEN"		, _TL("Sharpened Channels"),
 		_TL(""),
 		PARAMETER_OUTPUT
 	);
@@ -471,7 +471,7 @@ CPanSharp_CN::CPanSharp_CN(void)
 	);
 
 	Parameters.Add_Grid_List(
-		NULL	, "SHARPEN"		, _TL("Sharpend Channels"),
+		NULL	, "SHARPEN"		, _TL("Sharpened Channels"),
 		_TL(""),
 		PARAMETER_OUTPUT
 	);
@@ -609,7 +609,7 @@ CPanSharp_PCA::CPanSharp_PCA(void)
 	);
 
 	Parameters.Add_Grid_List(
-		NULL	, "SHARPEN"		, _TL("Sharpend Channels"),
+		NULL	, "SHARPEN"		, _TL("Sharpened Channels"),
 		_TL(""),
 		PARAMETER_OUTPUT
 	);
@@ -621,7 +621,7 @@ CPanSharp_PCA::CPanSharp_PCA(void)
 			_TL("correlation matrix"),
 			_TL("variance-covariance matrix"),
 			_TL("sums-of-squares-and-cross-products matrix")
-		), 1
+		), 2
 	);
 
 	Parameters.Add_Choice(
@@ -640,7 +640,13 @@ CPanSharp_PCA::CPanSharp_PCA(void)
 		CSG_String::Format(SG_T("%s|%s|"),
 			_TL("normalized"),
 			_TL("standardized")
-		), 0
+		), 1
+	);
+
+	Parameters.Add_Value(
+		NULL	, "OVERWRITE"	, _TL("Overwrite"),
+		_TL("overwrite previous output if adequate"),
+		PARAMETER_TYPE_Bool, true
 	);
 }
 
@@ -658,25 +664,23 @@ CPanSharp_PCA::CPanSharp_PCA(void)
 	\
 	if(	pModule == NULL )\
 	{\
-		Error_Set(CSG_String::Format(SG_T("%s: %s"), _TL("could not find module"), SG_T(LIBRARY)));\
+		Error_Fmt("%s: %s", _TL("could not find module"), SG_T(LIBRARY));\
 	}\
 	else if( pModule->is_Grid() )\
 	{\
 		Process_Set_Text(pModule->Get_Name());\
 		\
-		CSG_Parameters	P_tmp; P_tmp.Assign(pModule->Get_Parameters());\
-		\
-		pModule->Set_Manager(NULL);\
+		pModule->Settings_Push();\
 		\
 		((CSG_Module_Grid *)pModule)->Get_System()->Assign(GRIDSYSTEM);\
 		\
 		if( !(CONDITION) )\
 		{\
-			Error_Set(CSG_String::Format(SG_T("%s: %s > %s"), _TL("could not initialize module"), SG_T(LIBRARY), pModule->Get_Name().c_str()));\
+			Error_Fmt("%s: %s.%s", _TL("could not initialize module"), SG_T(LIBRARY), pModule->Get_Name().c_str());\
 		}\
 		else if( !pModule->Execute() )\
 		{\
-			Error_Set(CSG_String::Format(SG_T("%s: %s > %s"), _TL("could not execute module")   , SG_T(LIBRARY), pModule->Get_Name().c_str()));\
+			Error_Fmt("%s: %s.%s", _TL("could not execute module"   ), SG_T(LIBRARY), pModule->Get_Name().c_str());\
 		}\
 		else\
 		{\
@@ -685,13 +689,10 @@ CPanSharp_PCA::CPanSharp_PCA(void)
 		\
 		PARAMETERS.Assign(pModule->Get_Parameters());\
 		\
-		pModule->Get_Parameters()->Assign_Values(&P_tmp);\
+		pModule->Settings_Pop();\
 	}\
 }
 
-//---------------------------------------------------------
-#define SET_PARAMETER(IDENTIFIER, VALUE)	pModule->Get_Parameters()->Set_Parameter(SG_T(IDENTIFIER), VALUE)
-
 
 ///////////////////////////////////////////////////////////
 //														 //
@@ -701,19 +702,18 @@ CPanSharp_PCA::CPanSharp_PCA(void)
 bool CPanSharp_PCA::On_Execute(void)
 {
 	//-----------------------------------------------------
-	TSG_Grid_Interpolation	Interpolation	= Get_Interpolation(Parameters("RESAMPLING")->asInt());
-
-	//-----------------------------------------------------
 	bool			bResult;
-	CSG_Parameters	P;
+	CSG_Parameters	Tool_Parms;
 	CSG_Table		Eigen;
 
 	//-----------------------------------------------------
-	RUN_MODULE(bResult, "statistics_grid", 8, P, Parameters("GRIDS")->asGridList()->asGrid(0)->Get_System(),
-			SET_PARAMETER("GRIDS"	, Parameters("GRIDS"))
-		&&	SET_PARAMETER("METHOD"	, Parameters("METHOD"))
-		&&	SET_PARAMETER("EIGEN"	, &Eigen)
-		&&	SET_PARAMETER("NFIRST"	, 0)
+	// get the principle components for the low resolution bands
+
+	RUN_MODULE(bResult, "statistics_grid", 8, Tool_Parms, *Parameters("GRIDS")->Get_Parent()->asGrid_System(),
+			SG_MODULE_PARAMETER_SET("GRIDS" , Parameters("GRIDS"))
+		&&	SG_MODULE_PARAMETER_SET("METHOD", Parameters("METHOD"))
+		&&	SG_MODULE_PARAMETER_SET("EIGEN" , &Eigen)
+		&&	SG_MODULE_PARAMETER_SET("NFIRST", 0)	// get all components
 	);
 
 	if( !bResult )
@@ -722,31 +722,38 @@ bool CPanSharp_PCA::On_Execute(void)
 	}
 
 	//-----------------------------------------------------
-	CSG_Parameter_Grid_List	*pPCA_0	= P.Get_Parameter("PCA")->asGridList();
-	CSG_Parameter_Grid_List	*pPCA_1	= P.Add_Grid_List(NULL, "PCA_1", SG_T(""), SG_T(""), PARAMETER_INPUT, false)->asGridList();
+	CSG_Parameter_Grid_List	*pPCA	= Tool_Parms.Get_Parameter("PCA")->asGridList();
+
+	int			i, n	= pPCA->Get_Count();
 
-	CSG_Grid	*PCA	= new CSG_Grid[pPCA_0->Get_Count()];
+	CSG_Grid	*PCA	= new CSG_Grid[n];
 	CSG_Grid	*pPan	= Parameters("PAN")->asGrid();
 
+	//-----------------------------------------------------
+	// replace first principle component with the high resolution panchromatic band
+
+	Process_Set_Text(_TL("Replace first PC with PAN"));
+
 	double	Offset_Pan, Offset, Scale;
 
-	if( Parameters("PAN_MATCH")->asInt() == 0 )
+	if( Parameters("PAN_MATCH")->asInt() == 0 )	// scale PAN band to fit first PC histogram
 	{
 		Offset_Pan	= pPan->Get_ZMin();
-		Offset		= pPCA_0->asGrid(0)->Get_ZMin();
-		Scale		= pPCA_0->asGrid(0)->Get_ZRange() / pPan->Get_ZRange();
+		Offset		= pPCA->asGrid(0)->Get_ZMin();
+		Scale		= pPCA->asGrid(0)->Get_ZRange() / pPan->Get_ZRange();
 	}
 	else
 	{
 		Offset_Pan	= pPan->Get_Mean();
-		Offset		= pPCA_0->asGrid(0)->Get_Mean();
-		Scale		= pPCA_0->asGrid(0)->Get_StdDev() / pPan->Get_StdDev();
+		Offset		= pPCA->asGrid(0)->Get_Mean();
+		Scale		= pPCA->asGrid(0)->Get_StdDev() / pPan->Get_StdDev();
 	}
 
 	PCA[0].Create(*Get_System());
 
 	for(int y=0; y<Get_NY() && Set_Progress(y); y++)
 	{
+		#pragma omp parallel for
 		for(int x=0; x<Get_NX(); x++)
 		{
 			if( pPan->is_NoData(x, y) )
@@ -760,25 +767,37 @@ bool CPanSharp_PCA::On_Execute(void)
 		}
 	}
 
-	pPCA_1->Add_Item(&PCA[0]);
+	//-----------------------------------------------------
+	// resample all other PCs to match the high resolution of the PAN band
 
-	delete(pPCA_0->asGrid(0));
+	TSG_Grid_Interpolation	Interpolation	= Get_Interpolation(Parameters("RESAMPLING")->asInt());
 
-	for(int i=1; i<pPCA_0->Get_Count(); i++)
+	for(i=1; i<n; i++)
 	{
-		Process_Set_Text(CSG_String::Format(SG_T("%s: %s ..."), _TL("Resampling"), pPCA_0->asGrid(i)->Get_Name()));
+		Process_Set_Text(CSG_String::Format("%s: %s ...", _TL("Resampling"), pPCA->asGrid(i)->Get_Name()));
 
 		PCA[i].Create(*Get_System());
-		PCA[i].Assign(pPCA_0->asGrid(i), Interpolation);
-		pPCA_1->Add_Item(&PCA[i]);
-		delete(pPCA_0->asGrid(i));
+		PCA[i].Assign(pPCA->asGrid(i), Interpolation);
+
+		delete(pPCA->asGrid(i));	// PCA tool was unmanaged, so we have to delete the output
+	}
+
+	delete(pPCA->asGrid(0));
+
+	pPCA->Del_Items();
+
+	for(i=0; i<n; i++)
+	{
+		pPCA->Add_Item(&PCA[i]);
 	}
 
 	//-----------------------------------------------------
-	RUN_MODULE(bResult, "statistics_grid", 10, P, *Get_System(),
-			SET_PARAMETER("PCA"		, P("PCA_1"))
-		&&	SET_PARAMETER("GRIDS"	, Parameters("SHARPEN"))
-		&&	SET_PARAMETER("EIGEN"	, &Eigen)
+	// inverse principle component rotation for the high resolution bands
+
+	RUN_MODULE(bResult, "statistics_grid", 10, Tool_Parms, *Get_System(),
+			SG_MODULE_PARAMETER_SET("PCA"  , Tool_Parms("PCA"))
+		&&	SG_MODULE_PARAMETER_SET("GRIDS", Parameters("SHARPEN"))
+		&&	SG_MODULE_PARAMETER_SET("EIGEN", &Eigen)
 	);
 
 	delete[](PCA);
@@ -788,14 +807,29 @@ bool CPanSharp_PCA::On_Execute(void)
 		return( false );
 	}
 
-	Parameters.Set_Parameter("SHARPEN", P.Get_Parameter("GRIDS"));
+	CSG_Parameter_Grid_List	*pHiRes	= Parameters("SHARPEN")->asGridList();
+	CSG_Parameter_Grid_List	*pLoRes	= Parameters("GRIDS"  )->asGridList();
+	CSG_Parameter_Grid_List	*pGrids	= Tool_Parms("GRIDS"  )->asGridList();
 
-	CSG_Parameter_Grid_List	*pGrids	= Parameters("GRIDS"  )->asGridList();
-	CSG_Parameter_Grid_List	*pSharp	= Parameters("SHARPEN")->asGridList();
+	if( !Parameters("OVERWRITE")->asBool() )
+	{
+		pHiRes->Del_Items();
+	}
 
-	for(int j=0; j<pGrids->Get_Count() && j<pSharp->Get_Count(); j++)
+	for(i=0; i<pLoRes->Get_Count() && i<pGrids->Get_Count(); i++)
 	{
-		pSharp->asGrid(j)->Set_Name(pGrids->asGrid(j)->Get_Name());
+		if( pHiRes->asGrid(i) )
+		{
+			pHiRes->asGrid(i)->Assign(pGrids->asGrid(i));
+
+			delete(pGrids->asGrid(i));
+		}
+		else
+		{
+			pHiRes->Add_Item(pGrids->asGrid(i));
+		}
+
+		pHiRes->asGrid(i)->Set_Name(pLoRes->asGrid(i)->Get_Name());
 	}
 
 	return( true );
diff --git a/src/modules/imagery/imagery_vigra/MLB_Interface.cpp b/src/modules/imagery/imagery_vigra/MLB_Interface.cpp
index cbe6673..e1c611d 100644
--- a/src/modules/imagery/imagery_vigra/MLB_Interface.cpp
+++ b/src/modules/imagery/imagery_vigra/MLB_Interface.cpp
@@ -141,9 +141,10 @@ CSG_Module *		Create_Module(int i)
 	case  7:	return( new CViGrA_FFT_Real );
 	case  8:	return( new CViGrA_FFT_Filter );
 	case  9:	return( new CViGrA_Random_Forest );
-	}
+	case 10:	return( new CViGrA_RF_Presence );
 
-	return( NULL );
+	default:	return( NULL );
+	}
 }
 
 
diff --git a/src/modules/imagery/imagery_vigra/Makefile.in b/src/modules/imagery/imagery_vigra/Makefile.in
index f8ec04b..d89008e 100644
--- a/src/modules/imagery/imagery_vigra/Makefile.in
+++ b/src/modules/imagery/imagery_vigra/Makefile.in
@@ -492,22 +492,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vigra_watershed.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/imagery/imagery_vigra/vigra_random_forest.cpp b/src/modules/imagery/imagery_vigra/vigra_random_forest.cpp
index 7cbeeec..7a2ab0b 100644
--- a/src/modules/imagery/imagery_vigra/vigra_random_forest.cpp
+++ b/src/modules/imagery/imagery_vigra/vigra_random_forest.cpp
@@ -71,14 +71,18 @@
 //---------------------------------------------------------
 #if !defined(VIGRA_VERSION_MAJOR) || VIGRA_VERSION_MAJOR < 1 || VIGRA_VERSION_MINOR < 10
 // define some dummies
-CViGrA_Random_Forest::CViGrA_Random_Forest()	{}
-int                       CViGrA_Random_Forest::On_Parameters_Enable (CSG_Parameters *pParameters, CSG_Parameter *pParameter)	{	return(0);		}
-bool                      CViGrA_Random_Forest::On_Execute           (void)														{	return(false);	}
-CSG_Grid *                CViGrA_Random_Forest::Get_Class_Grid       (void)														{	return(NULL);	}
-void                      CViGrA_Random_Forest::Set_Classification   (CSG_Table &Classes)										{					}
-CSG_Parameter_Grid_List * CViGrA_Random_Forest::Get_Propability_Grids(CSG_Table &Classes)										{	return(NULL);	}
-bool                      CViGrA_Random_Forest::Get_Training         (CSG_Matrix &Data, CSG_Table &Classes)						{	return(false);	}
-int                       CViGrA_Random_Forest::Get_Training         (CSG_Matrix &Data, int ID, CSG_Shape_Polygon *pArea)		{	return(0);		}
+#include <vigra\matrix.hxx>
+class CRandom_Forest
+{
+public:
+	CRandom_Forest(CSG_Parameters *pParameters)	{}
+	static bool				Parameters_Create	(CSG_Parameters &Parameters)		{	return( true );	}
+	bool					Load_Model			(bool bLoadNow)						{	return( true );	}
+	bool					Train_Model			(const CSG_Matrix &Data)			{	return( true );	}
+	int						Get_Feature_Count	(void)								{	return( 0 );	}
+	int						Get_Prediction		(vigra::Matrix<double> features)	{	return( 0 );	}
+	vigra::Matrix<double>	Get_Probabilities	(vigra::Matrix<double> features)	{	vigra::Matrix<double> p(0, 0); return( p );	}
+};
 #else
 
 
@@ -99,6 +103,241 @@ int                       CViGrA_Random_Forest::Get_Training         (CSG_Matrix
 
 ///////////////////////////////////////////////////////////
 //														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+class CRandom_Forest
+{
+public:
+	CRandom_Forest(CSG_Parameters *pParameters);
+
+	static bool					Parameters_Create		(CSG_Parameters &Parameters);
+
+	bool						Load_Model				(bool bLoadNow);
+	bool						Train_Model				(const CSG_Matrix &Data);
+
+	int							Get_Feature_Count		(void)	{	return( m_Forest.feature_count() );	}
+
+	int							Get_Prediction			(vigra::Matrix<double> features);
+	vigra::Matrix<double>		Get_Probabilities		(vigra::Matrix<double> features);
+
+
+private:
+
+	CSG_Parameters				*m_pParameters;
+
+	vigra::RandomForest<int>	m_Forest;
+	
+};
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+CRandom_Forest::CRandom_Forest(CSG_Parameters *pParameters)
+{
+	m_pParameters	= pParameters;
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CRandom_Forest::Parameters_Create(CSG_Parameters &Parameters)
+{
+	CSG_Parameter	*pNode;
+
+	//-----------------------------------------------------
+#if defined(WITH_HDF5)
+	Parameters.Add_FilePath(
+		NULL	, "RF_IMPORT"			, _TL("Import from File"),
+		_TL(""),
+		NULL, NULL, false
+	);
+#endif
+
+	//-----------------------------------------------------
+	pNode	= Parameters.Add_Node(
+		NULL	, "RF_OPTIONS"			, _TL("Random Forest Options"),
+		_TL("")
+	);
+
+#if defined(WITH_HDF5)
+	Parameters.Add_FilePath(
+		pNode	, "RF_EXPORT"			, _TL("Export to File"),
+		_TL(""),
+		NULL, NULL, true
+	);
+#endif
+
+	Parameters.Add_Value(
+		pNode	, "RF_TREE_COUNT"		, _TL("Tree Count"),
+		_TL("How many trees to create?"),
+		PARAMETER_TYPE_Int, 32, 1, true
+	);
+
+	Parameters.Add_Value(
+		pNode	, "RF_TREE_SAMPLES"		, _TL("Samples per Tree"),
+		_TL("Specifies the fraction of the total number of samples used per tree for learning."),
+		PARAMETER_TYPE_Double, 1.0, 0.0, true, 1.0, true
+	);
+
+	Parameters.Add_Value(
+		pNode	, "RF_REPLACE"			, _TL("Sample with Replacement"),
+		_TL("Sample from training population with or without replacement?"),
+		PARAMETER_TYPE_Bool, true
+	);
+
+	Parameters.Add_Value(
+		pNode	, "RF_SPLIT_MIN_SIZE"	, _TL("Minimum Node Split Size"),
+		_TL("Number of examples required for a node to be split. Choose 1 for complete growing."),
+		PARAMETER_TYPE_Int, 1, 1, true
+	);
+
+	Parameters.Add_Choice(
+		pNode	, "RF_NODE_FEATURES"	, _TL("Features per Node"),
+		_TL(""),
+		CSG_String::Format(SG_T("%s|%s|%s|"),
+			_TL("logarithmic"),
+			_TL("square root"),
+			_TL("all")
+		), 1
+	);
+
+	Parameters.Add_Choice(
+		pNode	, "RF_STRATIFICATION"	, _TL("Stratification"),
+		_TL("Specifies stratification strategy. Either none, equal amount of class samples, or proportional to fraction of class samples."),
+		CSG_String::Format(SG_T("%s|%s|%s|"),
+			_TL("none"),
+			_TL("equal"),
+			_TL("proportional")
+		), 0
+	);
+
+	//-----------------------------------------------------
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CRandom_Forest::Load_Model(bool bLoadNow)
+{
+#if defined(WITH_HDF5)
+	if( SG_File_Exists((*m_pParameters)("RF_IMPORT")->asString()) )
+	{
+		if( bLoadNow == false )
+		{
+			return( true );
+		}
+
+		if( vigra::rf_import_HDF5(m_Forest, CSG_String((*m_pParameters)("RF_IMPORT")->asString()).b_str()) )
+		{
+			return( true );
+		}
+	}
+#endif
+
+	return( false );
+}
+
+//---------------------------------------------------------
+bool CRandom_Forest::Train_Model(const CSG_Matrix &Data)
+{
+	//-----------------------------------------------------
+	int	nFeatures	= Data.Get_NCols() - 1;
+
+	vigra::Matrix<double>	train_features(Data.Get_NRows(), nFeatures);
+	vigra::Matrix<int>		train_response(Data.Get_NRows(), 1);
+
+	for(int iSample=0; iSample<Data.Get_NRows(); iSample++)
+	{
+		train_response(iSample, 0)	= (int)Data[iSample][nFeatures];
+
+		for(int iFeature=0; iFeature<nFeatures; iFeature++)
+		{
+			train_features(iSample, iFeature)	= Data[iSample][iFeature];
+		}
+	}
+
+	//-----------------------------------------------------
+	m_Forest.set_options().tree_count             ((*m_pParameters)("RF_TREE_COUNT"    )->asInt   ());
+	m_Forest.set_options().samples_per_tree       ((*m_pParameters)("RF_TREE_SAMPLES"  )->asDouble());
+	m_Forest.set_options().sample_with_replacement((*m_pParameters)("RF_REPLACE"       )->asBool  ());
+	m_Forest.set_options().min_split_node_size    ((*m_pParameters)("RF_SPLIT_MIN_SIZE")->asInt   ());
+
+	switch( (*m_pParameters)("RF_NODE_FEATURES")->asInt() )
+	{
+	case  0:	m_Forest.set_options().features_per_node(vigra::RF_LOG );	break;
+	default:	m_Forest.set_options().features_per_node(vigra::RF_SQRT);	break;
+	case  1:	m_Forest.set_options().features_per_node(vigra::RF_ALL );	break;
+	}
+
+	switch( (*m_pParameters)("RF_STRATIFICATION")->asInt() )
+	{
+	default:	m_Forest.set_options().use_stratification(vigra::RF_NONE        );	break;
+	case  1:	m_Forest.set_options().use_stratification(vigra::RF_EQUAL       );	break;
+	case  2:	m_Forest.set_options().use_stratification(vigra::RF_PROPORTIONAL);	break;
+	}
+
+	//-----------------------------------------------------
+	SG_UI_Process_Set_Text(_TL("learning"));
+
+	vigra::rf::visitors::OOB_Error	oob_v;	// construct visitor to calculate out-of-bag error
+
+	m_Forest.learn(train_features, train_response, vigra::rf::visitors::create_visitor(oob_v));
+
+	SG_UI_Msg_Add_Execution(CSG_String::Format(SG_T("\n%s: %f"), _TL("out-of-bag error"), oob_v.oob_breiman), false);
+
+#if defined(WITH_HDF5)
+	if( (*m_pParameters)("RF_EXPORT")->asString() && *(*m_pParameters)("RF_EXPORT")->asString() )
+	{
+		vigra::rf_export_HDF5(m_Forest, CSG_String((*m_pParameters)("RF_EXPORT")->asString()).b_str());
+	}
+#endif
+
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+int CRandom_Forest::Get_Prediction(vigra::Matrix<double> features)
+{
+	return( m_Forest.predictLabel(features) );
+}
+
+//---------------------------------------------------------
+vigra::Matrix<double> CRandom_Forest::Get_Probabilities(vigra::Matrix<double> features)
+{
+	vigra::Matrix<double>	p(1, m_Forest.class_count());
+
+	m_Forest.predictProbabilities(features, p);
+
+	return( p );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#endif // !defined(VIGRA_VERSION_MAJOR) || VIGRA_VERSION_MAJOR < 1 || VIGRA_VERSION_MINOR < 10
+
+
+///////////////////////////////////////////////////////////
+//														 //
 //														 //
 //														 //
 ///////////////////////////////////////////////////////////
@@ -114,8 +353,6 @@ enum
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
@@ -124,7 +361,7 @@ CViGrA_Random_Forest::CViGrA_Random_Forest(void)
 	CSG_Parameter	*pNode;
 
 	//-----------------------------------------------------
-	Set_Name		(_TL("Random Forest (ViGrA)"));
+	Set_Name		(_TL("Random Forest Classification (ViGrA)"));
 
 	Set_Author		("O.Conrad (c) 2013");
 
@@ -166,15 +403,6 @@ CViGrA_Random_Forest::CViGrA_Random_Forest(void)
 	);
 
 	//-----------------------------------------------------
-#if defined(WITH_HDF5)
-	Parameters.Add_FilePath(
-		NULL	, "RF_IMPORT"			, _TL("Import from File"),
-		_TL(""),
-		NULL, NULL, false
-	);
-#endif
-
-	//-----------------------------------------------------
 	pNode	= Parameters.Add_Shapes(
 		NULL	, "TRAINING"			, _TL("Training Areas"),
 		_TL(""),
@@ -199,69 +427,12 @@ CViGrA_Random_Forest::CViGrA_Random_Forest(void)
 	));
 
 	//-----------------------------------------------------
-	pNode	= Parameters.Add_Node(
-		NULL	, "RF_OPTIONS"			, _TL("Options"),
-		_TL("")
-	);
-
-#if defined(WITH_HDF5)
-	Parameters.Add_FilePath(
-		pNode	, "RF_EXPORT"			, _TL("Export to File"),
-		_TL(""),
-		NULL, NULL, true
-	);
-#endif
-
-	Parameters.Add_Value(
-		pNode	, "RF_TREE_COUNT"		, _TL("Tree Count"),
-		_TL("How many trees to create?"),
-		PARAMETER_TYPE_Int, 32, 1, true
-	);
-
-	Parameters.Add_Value(
-		pNode	, "RF_TREE_SAMPLES"		, _TL("Samples per Tree"),
-		_TL("Specifies the fraction of the total number of samples used per tree for learning."),
-		PARAMETER_TYPE_Double, 1.0, 0.0, true, 1.0, true
-	);
-
-	Parameters.Add_Value(
-		pNode	, "RF_REPLACE"			, _TL("Sample with Replacement"),
-		_TL("Sample from training population with or without replacement?"),
-		PARAMETER_TYPE_Bool, true
-	);
-
-	Parameters.Add_Value(
-		pNode	, "RF_SPLIT_MIN_SIZE"	, _TL("Minimum Node Split Size"),
-		_TL("Number of examples required for a node to be split. Choose 1 for complete growing."),
-		PARAMETER_TYPE_Int, 1, 1, true
-	);
-
-	Parameters.Add_Choice(
-		pNode	, "RF_NODE_FEATURES"	, _TL("Features per Node"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|%s|"),
-			_TL("logarithmic"),
-			_TL("square root"),
-			_TL("all")
-		), 1
-	);
-
-	Parameters.Add_Choice(
-		pNode	, "RF_STRATIFICATION"	, _TL("Stratification"),
-		_TL("Specifies stratification strategy. Either none, equal amount of class samples, or proportional to fraction of class samples."),
-		CSG_String::Format(SG_T("%s|%s|%s|"),
-			_TL("none"),
-			_TL("equal"),
-			_TL("proportional")
-		), 0
-	);
+	CRandom_Forest::Parameters_Create(Parameters);
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
@@ -291,8 +462,6 @@ int CViGrA_Random_Forest::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
@@ -329,35 +498,30 @@ bool CViGrA_Random_Forest::On_Execute(void)
 
 
 	//-----------------------------------------------------
-	CSG_Table	Classes;
+	// Model Creation
 
-	vigra::RandomForestOptions	Options;
-	vigra::RandomForest<int>	Forest(Options);
+	CRandom_Forest	Model(&Parameters);
 
+	CSG_Table		Classes;
 
-#if defined(WITH_HDF5)
-	if( SG_File_Exists(Parameters("RF_IMPORT")->asString()) )
+	if( Model.Load_Model(false) )	// load model from file ...
 	{
-		if( !vigra::rf_import_HDF5(Forest, CSG_String(Parameters("RF_IMPORT")->asString()).b_str()) )
+		if( !Model.Load_Model(true) )
 		{
 			Error_Set(_TL("could not import random forest"));
 
 			return( false );
 		}
 
-		if( Forest.feature_count() != m_nFeatures )
+		if( Model.Get_Feature_Count() != m_nFeatures )
 		{
-			Error_Set(CSG_String::Format(SG_T("%s\n%s: %d"), _TL("invalid number of features"), _TL("expected"), Forest.feature_count()));
+			Error_Set(CSG_String::Format(SG_T("%s\n%s: %d"), _TL("invalid number of features"), _TL("expected"), Model.Get_Feature_Count()));
 
 			return( false );
 		}
 	}
-	else
-#endif
+	else							// train model from training data ...
 	{
-		//-------------------------------------------------
-		// Training Data
-
 		CSG_Matrix	Data;
 
 		if( !Get_Training(Data, Classes) )
@@ -367,63 +531,9 @@ bool CViGrA_Random_Forest::On_Execute(void)
 			return( false );
 		}
 
-		vigra::Matrix<double>	train_features(Data.Get_NRows(), m_nFeatures);
-		vigra::Matrix<int>		train_response(Data.Get_NRows(), 1);
+		Model.Train_Model(Data);
+	}
 
-		for(int iSample=0; iSample<Data.Get_NRows(); iSample++)
-		{
-			train_response(iSample, 0)	= (int)Data[iSample][m_nFeatures];
-
-			for(int iFeature=0; iFeature<m_nFeatures; iFeature++)
-			{
-				train_features(iSample, iFeature)	= Data[iSample][iFeature];
-			}
-		}
-
-		Data.Destroy();
-
-
-		//-------------------------------------------------
-		// Random Forest Options
-
-		Forest.set_options().tree_count             (Parameters("RF_TREE_COUNT"    )->asInt   ());
-		Forest.set_options().samples_per_tree       (Parameters("RF_TREE_SAMPLES"  )->asDouble());
-		Forest.set_options().sample_with_replacement(Parameters("RF_REPLACE"       )->asBool  ());
-		Forest.set_options().min_split_node_size    (Parameters("RF_SPLIT_MIN_SIZE")->asInt   ());
-
-		switch( Parameters("RF_NODE_FEATURES")->asInt() )
-		{
-		case  0:	Forest.set_options().features_per_node(vigra::RF_LOG );	break;
-		default:	Forest.set_options().features_per_node(vigra::RF_SQRT);	break;
-		case  1:	Forest.set_options().features_per_node(vigra::RF_ALL );	break;
-		}
-
-		switch( Parameters("RF_STRATIFICATION")->asInt() )
-		{
-		default:	Forest.set_options().use_stratification(vigra::RF_NONE        );	break;
-		case  1:	Forest.set_options().use_stratification(vigra::RF_EQUAL       );	break;
-		case  2:	Forest.set_options().use_stratification(vigra::RF_PROPORTIONAL);	break;
-		}
-
-
-		//-------------------------------------------------
-		// Learning
-
-		Process_Set_Text(_TL("learning"));
-
-		vigra::rf::visitors::OOB_Error	oob_v;	// construct visitor to calculate out-of-bag error
-
-		Forest.learn(train_features, train_response, vigra::rf::visitors::create_visitor(oob_v));
-
-		Message_Add(CSG_String::Format(SG_T("\n%s: %f"), _TL("out-of-bag error"), oob_v.oob_breiman), false);
-
-#if defined(WITH_HDF5)
-		if( Parameters("RF_EXPORT")->asString() && *Parameters("RF_EXPORT")->asString() )
-		{
-			vigra::rf_export_HDF5(Forest, CSG_String(Parameters("RF_EXPORT")->asString()).b_str());
-		}
-#endif
-	}
 
 	//-----------------------------------------------------
 	// Output Grids
@@ -434,7 +544,7 @@ bool CViGrA_Random_Forest::On_Execute(void)
 
 	CSG_Parameter_Grid_List	*pProbabilities	= Get_Propability_Grids(Classes);
 
-	DataObject_Set_Colors(pProbability, 11, SG_COLORS_WHITE_GREEN);
+	if( pProbability && !pProbability->Get_ZRange() ) DataObject_Set_Colors(pProbability, 11, SG_COLORS_WHITE_GREEN);
 
 
 	//-----------------------------------------------------
@@ -456,20 +566,15 @@ bool CViGrA_Random_Forest::On_Execute(void)
 					features(0, iFeature)	= m_pFeatures[iFeature]->asDouble(x, y);
 				}
 
-				int		id	= Forest.predictLabel(features);
+				int	id	= Model.Get_Prediction(features);
 
 				pClasses->Set_Value(x, y, id);
 
 				if( pProbability || pProbabilities )
 				{
-					vigra::Matrix<double>	p(1, Forest.class_count());
+					vigra::Matrix<double>	p	= Model.Get_Probabilities(features);
 
-					Forest.predictProbabilities(features, p);
-
-					if( pProbability )
-					{
-						pProbability->Set_Value(x, y, p(0, id - 1));
-					}
+					SG_GRID_PTR_SAFE_SET_VALUE(pProbability, x, y, p(0, id - 1));
 
 					for(int i=0; pProbabilities && i<pProbabilities->Get_Count(); i++)
 					{
@@ -479,10 +584,7 @@ bool CViGrA_Random_Forest::On_Execute(void)
 			}
 			else // if( pClasses->is_NoData(x, y) )
 			{
-				if( pProbability )
-				{
-					pProbability->Set_NoData(x, y);
-				}
+				SG_GRID_PTR_SAFE_SET_NODATA(pProbability, x, y);
 
 				for(int i=0; pProbabilities && i<pProbabilities->Get_Count(); i++)
 				{
@@ -498,15 +600,12 @@ bool CViGrA_Random_Forest::On_Execute(void)
 
 	Set_Classification(Classes);
 
-	//-----------------------------------------------------
 	return( true );
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
@@ -610,25 +709,26 @@ int CViGrA_Random_Forest::Get_Training(CSG_Matrix &Data, int ID, CSG_Shape_Polyg
 		{
 			if( pArea->Contains(Get_System()->Get_Grid_to_World(x, y)) )
 			{
-				int	iRow	= Data.Get_NRows();
+				CSG_Vector	z(1 + m_nFeatures);
 
-				if( iRow == 0 )
-				{
-					Data.Create(1 + m_nFeatures, 1);
-				}
-				else
-				{
-					Data.Add_Row();
-				}
+				z[m_nFeatures]	= ID;
 
-				Data[iRow][m_nFeatures]	= ID;
+				bool	bOkay	= true;
 
-				for(int i=0; i<m_nFeatures; i++)
+				for(int i=0; bOkay && i<m_nFeatures; i++)
 				{
-					Data[iRow][i]	= m_pFeatures[i]->asDouble(x, y);
+					if( (bOkay = !m_pFeatures[i]->is_NoData(x, y)) == true )
+					{
+						z[i]	= m_pFeatures[i]->asDouble(x, y);
+					}
 				}
 
-				Count++;
+				if( bOkay )
+				{
+					Data.Add_Row(z);
+
+					Count++;
+				}
 			}
 		}
 	}
@@ -639,8 +739,6 @@ int CViGrA_Random_Forest::Get_Training(CSG_Matrix &Data, int ID, CSG_Shape_Polyg
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
@@ -710,8 +808,6 @@ void CViGrA_Random_Forest::Set_Classification(CSG_Table &Classes)
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
@@ -753,7 +849,309 @@ CSG_Parameter_Grid_List * CViGrA_Random_Forest::Get_Propability_Grids(CSG_Table
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#endif // !defined(VIGRA_VERSION_MAJOR) || VIGRA_VERSION_MAJOR < 1 || VIGRA_VERSION_MINOR < 10
+CViGrA_RF_Presence::CViGrA_RF_Presence(void)
+{
+	//-----------------------------------------------------
+	Set_Name		(_TL("Random Forest Presence Prediction (ViGrA)"));
+
+	Set_Author		("O.Conrad (c) 2015");
+
+	Set_Description	(_TW(
+		"References:\n"
+		"ViGrA - Vision with Generic Algorithms\n"
+		"<a target=\"_blank\" href=\"http://hci.iwr.uni-heidelberg.de/vigra\">http://hci.iwr.uni-heidelberg.de</a>"
+	));
+
+	//-----------------------------------------------------
+	Parameters.Add_Grid_List(
+		NULL	, "FEATURES"			, _TL("Features"),
+		_TL(""),
+		PARAMETER_INPUT
+	);
+
+	Parameters.Add_Grid(
+		NULL	, "PREDICTION"			, _TL("Presence Prediction"),
+		_TL(""),
+		PARAMETER_OUTPUT, true, SG_DATATYPE_Char
+	);
+
+	Parameters.Add_Grid(
+		NULL	, "PROBABILITY"			, _TL("Presence Probability"),
+		_TL(""),
+		PARAMETER_OUTPUT_OPTIONAL
+	);
+
+	Parameters.Add_Shapes(
+		NULL	, "PRESENCE"			, _TL("Presence Data"),
+		_TL(""),
+		PARAMETER_INPUT, SHAPE_TYPE_Point
+	);
+
+	Parameters.Add_Value(
+		NULL	, "BACKGROUND"			, _TL("Background Sample Density [Percent]"),
+		_TL(""),
+		PARAMETER_TYPE_Double, 1, 0.0, true, 100, true
+	);
+
+	//-----------------------------------------------------
+	CSG_mRMR::Parameters_Add(&Parameters, Parameters.Add_Value(
+		NULL	, "DO_MRMR"				, _TL("Minimum Redundancy Feature Selection"),
+		_TL("Use only features selected by the minimum Redundancy Maximum Relevance (mRMR) algorithm"),
+		PARAMETER_TYPE_Bool, false
+	));
+
+	//-----------------------------------------------------
+	CRandom_Forest::Parameters_Create(Parameters);
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+int CViGrA_RF_Presence::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+{
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "RF_IMPORT") )
+	{
+		bool	bTraining	= !SG_File_Exists(pParameter->asString());
+
+		pParameters->Set_Enabled("RF_OPTIONS", bTraining);
+		pParameters->Set_Enabled("PRESENCE"  , bTraining);
+	}
+
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "DO_MRMR") )
+	{
+		pParameters->Get("DO_MRMR")->Set_Children_Enabled(pParameter->asBool());
+	}
+
+	if( pParameters->Get("DO_MRMR")->asBool() )
+	{
+		CSG_mRMR::Parameters_Enable(pParameters, pParameter);
+	}
+
+	return( 1 );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CViGrA_RF_Presence::On_Execute(void)
+{
+	//-----------------------------------------------------
+	CSG_Parameter_Grid_List		*pFeatures	= Parameters("FEATURES")->asGridList();
+
+	CSG_Array	Features(sizeof(CSG_Grid *), pFeatures->Get_Count());
+
+	m_pFeatures	= (CSG_Grid **)Features.Get_Array();
+	m_nFeatures	= 0;
+
+	for(int i=pFeatures->Get_Count()-1; i>=0; i--)
+	{
+		if( pFeatures->asGrid(i)->Get_ZRange() <= 0.0 )
+		{
+			Message_Add(CSG_String::Format(SG_T("%s: %s"), _TL("grid has been dropped"), pFeatures->asGrid(i)->Get_Name()));
+		}
+		else
+		{
+			m_pFeatures[m_nFeatures++]	= pFeatures->asGrid(i);
+		}
+	}
+
+	if( m_nFeatures <= 0 )
+	{
+		Error_Set(_TL("no valid grid in features list."));
+
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	CRandom_Forest	Model(&Parameters);
+
+	if( Model.Load_Model(false) )	// load model from file ...
+	{
+		if( !Model.Load_Model(true) )
+		{
+			Error_Set(_TL("could not import random forest"));
+
+			return( false );
+		}
+
+		if( Model.Get_Feature_Count() != m_nFeatures )
+		{
+			Error_Set(CSG_String::Format(SG_T("%s\n%s: %d"), _TL("invalid number of features"), _TL("expected"), Model.Get_Feature_Count()));
+
+			return( false );
+		}
+	}
+	else							// train model from training data ...
+	{
+		CSG_Matrix	Data;
+
+		if( !Get_Training(Data) )
+		{
+			Error_Set(_TL("insufficient training samples"));
+
+			return( false );
+		}
+
+		Process_Set_Text(_TL("training"));
+
+		Model.Train_Model(Data);
+	}
+
+	//-----------------------------------------------------
+	CSG_Grid	*pPrediction	= Parameters("PREDICTION" )->asGrid();
+	CSG_Grid	*pProbability	= Parameters("PROBABILITY")->asGrid();
+
+	if( !pPrediction ->Get_ZRange() ) DataObject_Set_Colors(pPrediction , 11, SG_COLORS_YELLOW_GREEN);
+	if( !pProbability->Get_ZRange() ) DataObject_Set_Colors(pProbability, 11, SG_COLORS_YELLOW_GREEN);
+
+	//-----------------------------------------------------
+	Process_Set_Text(_TL("prediction"));
+
+	for(int y=0; y<Get_NY() && Set_Progress(y); y++)
+	{
+		#pragma omp parallel for
+		for(int x=0; x<Get_NX(); x++)
+		{
+			bool	bOkay	= true;
+
+			vigra::Matrix<double>	features(1, m_nFeatures);
+
+			for(int iFeature=0; bOkay && iFeature<m_nFeatures; iFeature++)
+			{
+				if( (bOkay = !m_pFeatures[iFeature]->is_NoData(x, y)) == true )
+				{
+					features(0, iFeature)	= m_pFeatures[iFeature]->asDouble(x, y);
+				}
+			}
+
+			if( bOkay )
+			{
+			//	vigra::Matrix<double>	p	= Model.Get_Probabilities(features);
+			//	pProbability->Set_Value(x, y, p(0, 0));
+				pPrediction ->Set_Value(x, y, Model.Get_Prediction   (features));
+				pProbability->Set_Value(x, y, Model.Get_Probabilities(features)(0, 0));
+			}
+			else // if( pClasses->is_NoData(x, y) )
+			{
+				pPrediction ->Set_NoData(x, y);
+				pProbability->Set_NoData(x, y);
+			}
+		}
+	}
+
+	//-----------------------------------------------------
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CViGrA_RF_Presence::Get_Training(CSG_Matrix &Data)
+{
+	//-----------------------------------------------------
+	Process_Set_Text(_TL("collecting presence data"));
+
+	CSG_Shapes	*pPresence	= Parameters("PRESENCE")->asShapes();
+
+	for(int iPoint=0; iPoint<pPresence->Get_Count() && Set_Progress(iPoint, pPresence->Get_Count()); iPoint++)
+	{
+		TSG_Point	p	= pPresence->Get_Shape(iPoint)->Get_Point(0);
+
+		int	x	= Get_System()->Get_xWorld_to_Grid(p.x);
+		int	y	= Get_System()->Get_yWorld_to_Grid(p.y);
+
+		Get_Training(Data, x, y, 1);
+	}
+
+	//-----------------------------------------------------
+	Process_Set_Text(_TL("collecting background data"));
+
+	double	Background	= Parameters("BACKGROUND")->asDouble() / 100.0;
+
+	for(int y=0; y<Get_NY() && Set_Progress(y); y++)
+	{
+		for(int x=0; x<Get_NX(); x++)
+		{
+			if( CSG_Random::Get_Uniform() <= Background )
+			{
+				Get_Training(Data, x, y, 0);
+			}
+		}
+	}
+
+	//-----------------------------------------------------
+	if( Data.Get_NCols() > 1 && Data.Get_NRows() > 1 && Parameters("DO_MRMR")->asBool() )
+	{
+		CSG_mRMR	Selector;
+
+		if( Selector.Set_Data(Data, m_nFeatures, &Parameters) && Selector.Get_Selection(&Parameters)
+		&&  Selector.Get_Count() > 0 && Selector.Get_Count() < m_nFeatures )
+		{
+			int	i, j, *bSelected	= (int *)SG_Calloc(m_nFeatures, sizeof(int));
+
+			for(i=0; i<Selector.Get_Count(); i++)
+			{
+				bSelected[j = Selector.Get_Index(i) - 1]	= 1;
+
+				Message_Add(CSG_String::Format(SG_T("\n%02d. %s (%s: %f)"),
+					i + 1, m_pFeatures[j]->Get_Name(), _TL("Score"), Selector.Get_Score(i)
+				), false);
+			}
+
+			Message_Add("\n", false);
+
+			for(i=0, j=0; i<m_nFeatures; i++)
+			{
+				if( bSelected[m_nFeatures - i - 1] == 0 )
+				{
+					Data.Del_Col(m_nFeatures - i - 1);
+				}
+
+				if( bSelected[i] == 1 )
+				{
+					m_pFeatures[j++]	= m_pFeatures[i];
+				}
+			}
+
+			m_nFeatures	= Selector.Get_Count();
+
+			delete[](bSelected);
+		}
+	}
+
+	return( Data.Get_NCols() > 1 && Data.Get_NRows() > 1 );
+}
+
+//---------------------------------------------------------
+bool CViGrA_RF_Presence::Get_Training(CSG_Matrix &Data, int x, int y, int ID)
+{
+	CSG_Vector	z(1 + m_nFeatures);
+
+	z[m_nFeatures]	= ID;
+
+	for(int i=0; i<m_nFeatures; i++)
+	{
+		if( !m_pFeatures[i]->is_InGrid(x, y) )
+		{
+			return( false );
+		}
+
+		z[i]	= m_pFeatures[i]->asDouble(x, y);
+	}
+
+	Data.Add_Row(z);
+
+	return( true );
+}
 
 
 ///////////////////////////////////////////////////////////
diff --git a/src/modules/imagery/imagery_vigra/vigra_random_forest.h b/src/modules/imagery/imagery_vigra/vigra_random_forest.h
index 9827566..9cd7c8c 100644
--- a/src/modules/imagery/imagery_vigra/vigra_random_forest.h
+++ b/src/modules/imagery/imagery_vigra/vigra_random_forest.h
@@ -115,6 +115,39 @@ private:
 
 ///////////////////////////////////////////////////////////
 //														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+class CViGrA_RF_Presence : public CSG_Module_Grid
+{
+public:
+	CViGrA_RF_Presence(void);
+
+	virtual CSG_String			Get_MenuPath	(void)	{	return( _TL("A:Grid|Analysis|Macroecology") );	}
+
+
+protected:
+
+	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+
+	virtual bool				On_Execute				(void);
+
+
+private:
+
+	int							m_nFeatures;
+
+	CSG_Grid					**m_pFeatures;
+
+
+	bool						Get_Training			(CSG_Matrix &Data);
+	bool						Get_Training			(CSG_Matrix &Data, int x, int y, int ID);
+
+};
+
+
+///////////////////////////////////////////////////////////
+//														 //
 //														 //
 //														 //
 ///////////////////////////////////////////////////////////
diff --git a/src/modules/io/io_esri_e00/Makefile.in b/src/modules/io/io_esri_e00/Makefile.in
index 2a3c472..142e80e 100644
--- a/src/modules/io/io_esri_e00/Makefile.in
+++ b/src/modules/io/io_esri_e00/Makefile.in
@@ -127,9 +127,11 @@ am__installdirs = "$(DESTDIR)$(pkglibdir)"
 LTLIBRARIES = $(pkglib_LTLIBRARIES)
 libio_esri_e00_la_DEPENDENCIES =  \
 	$(top_srcdir)/src/saga_core/saga_api/libsaga_api.la
+am__dirstamp = $(am__leading_dot)dirstamp
 am_libio_esri_e00_la_OBJECTS = ESRI_E00_Import.lo MLB_Interface.lo \
-	cpl_conv.lo cpl_error.lo cpl_vsisimple.lo e00read.lo \
-	e00write.lo
+	e00compr/cpl_conv.lo e00compr/cpl_error.lo \
+	e00compr/cpl_vsisimple.lo e00compr/e00read.lo \
+	e00compr/e00write.lo
 libio_esri_e00_la_OBJECTS = $(am_libio_esri_e00_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
@@ -458,97 +460,86 @@ clean-pkglibLTLIBRARIES:
 	  echo rm -f $${locs}; \
 	  rm -f $${locs}; \
 	}
+e00compr/$(am__dirstamp):
+	@$(MKDIR_P) e00compr
+	@: > e00compr/$(am__dirstamp)
+e00compr/$(DEPDIR)/$(am__dirstamp):
+	@$(MKDIR_P) e00compr/$(DEPDIR)
+	@: > e00compr/$(DEPDIR)/$(am__dirstamp)
+e00compr/cpl_conv.lo: e00compr/$(am__dirstamp) \
+	e00compr/$(DEPDIR)/$(am__dirstamp)
+e00compr/cpl_error.lo: e00compr/$(am__dirstamp) \
+	e00compr/$(DEPDIR)/$(am__dirstamp)
+e00compr/cpl_vsisimple.lo: e00compr/$(am__dirstamp) \
+	e00compr/$(DEPDIR)/$(am__dirstamp)
+e00compr/e00read.lo: e00compr/$(am__dirstamp) \
+	e00compr/$(DEPDIR)/$(am__dirstamp)
+e00compr/e00write.lo: e00compr/$(am__dirstamp) \
+	e00compr/$(DEPDIR)/$(am__dirstamp)
 
 libio_esri_e00.la: $(libio_esri_e00_la_OBJECTS) $(libio_esri_e00_la_DEPENDENCIES) $(EXTRA_libio_esri_e00_la_DEPENDENCIES) 
 	$(AM_V_CXXLD)$(CXXLINK) -rpath $(pkglibdir) $(libio_esri_e00_la_OBJECTS) $(libio_esri_e00_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
+	-rm -f e00compr/*.$(OBJEXT)
+	-rm -f e00compr/*.lo
 
 distclean-compile:
 	-rm -f *.tab.c
 
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ESRI_E00_Import.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MLB_Interface.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cpl_conv.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cpl_error.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cpl_vsisimple.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/e00read.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/e00write.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at e00compr/$(DEPDIR)/cpl_conv.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at e00compr/$(DEPDIR)/cpl_error.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at e00compr/$(DEPDIR)/cpl_vsisimple.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at e00compr/$(DEPDIR)/e00read.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at e00compr/$(DEPDIR)/e00write.Plo at am__quote@
 
 .c.o:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(COMPILE) -c -o $@ $<
 
 .c.obj:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .c.lo:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LTCOMPILE) -c -o $@ $<
 
-cpl_conv.lo: e00compr/cpl_conv.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpl_conv.lo -MD -MP -MF $(DEPDIR)/cpl_conv.Tpo -c -o cpl_conv.lo `test -f 'e00compr/cpl_conv.c' || echo '$(srcdir)/'`e00compr/cpl_conv.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/cpl_conv.Tpo $(DEPDIR)/cpl_conv.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='e00compr/cpl_conv.c' object='cpl_conv.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpl_conv.lo `test -f 'e00compr/cpl_conv.c' || echo '$(srcdir)/'`e00compr/cpl_conv.c
-
-cpl_error.lo: e00compr/cpl_error.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpl_error.lo -MD -MP -MF $(DEPDIR)/cpl_error.Tpo -c -o cpl_error.lo `test -f 'e00compr/cpl_error.c' || echo '$(srcdir)/'`e00compr/cpl_error.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/cpl_error.Tpo $(DEPDIR)/cpl_error.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='e00compr/cpl_error.c' object='cpl_error.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpl_error.lo `test -f 'e00compr/cpl_error.c' || echo '$(srcdir)/'`e00compr/cpl_error.c
-
-cpl_vsisimple.lo: e00compr/cpl_vsisimple.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpl_vsisimple.lo -MD -MP -MF $(DEPDIR)/cpl_vsisimple.Tpo -c -o cpl_vsisimple.lo `test -f 'e00compr/cpl_vsisimple.c' || echo '$(srcdir)/'`e00compr/cpl_vsisimple.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/cpl_vsisimple.Tpo $(DEPDIR)/cpl_vsisimple.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='e00compr/cpl_vsisimple.c' object='cpl_vsisimple.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpl_vsisimple.lo `test -f 'e00compr/cpl_vsisimple.c' || echo '$(srcdir)/'`e00compr/cpl_vsisimple.c
-
-e00read.lo: e00compr/e00read.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT e00read.lo -MD -MP -MF $(DEPDIR)/e00read.Tpo -c -o e00read.lo `test -f 'e00compr/e00read.c' || echo '$(srcdir)/'`e00compr/e00read.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/e00read.Tpo $(DEPDIR)/e00read.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='e00compr/e00read.c' object='e00read.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o e00read.lo `test -f 'e00compr/e00read.c' || echo '$(srcdir)/'`e00compr/e00read.c
-
-e00write.lo: e00compr/e00write.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT e00write.lo -MD -MP -MF $(DEPDIR)/e00write.Tpo -c -o e00write.lo `test -f 'e00compr/e00write.c' || echo '$(srcdir)/'`e00compr/e00write.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/e00write.Tpo $(DEPDIR)/e00write.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='e00compr/e00write.c' object='e00write.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o e00write.lo `test -f 'e00compr/e00write.c' || echo '$(srcdir)/'`e00compr/e00write.c
-
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
@@ -558,6 +549,7 @@ mostlyclean-libtool:
 
 clean-libtool:
 	-rm -rf .libs _libs
+	-rm -rf e00compr/.libs e00compr/_libs
 
 ID: $(am__tagged_files)
 	$(am__define_uniq_tagged_files); mkid -fID $$unique
@@ -674,6 +666,8 @@ clean-generic:
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-rm -f e00compr/$(DEPDIR)/$(am__dirstamp)
+	-rm -f e00compr/$(am__dirstamp)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -684,7 +678,7 @@ clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
 	mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+	-rm -rf ./$(DEPDIR) e00compr/$(DEPDIR)
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -730,7 +724,7 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+	-rm -rf ./$(DEPDIR) e00compr/$(DEPDIR)
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
diff --git a/src/modules/io/io_gdal/Makefile.in b/src/modules/io/io_gdal/Makefile.in
index 0cf0f01..0fbe2b3 100644
--- a/src/modules/io/io_gdal/Makefile.in
+++ b/src/modules/io/io_gdal/Makefile.in
@@ -488,22 +488,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ogr_import.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/io/io_gdal/gdal_driver.cpp b/src/modules/io/io_gdal/gdal_driver.cpp
index a3c2dc2..eabd372 100644
--- a/src/modules/io/io_gdal/gdal_driver.cpp
+++ b/src/modules/io/io_gdal/gdal_driver.cpp
@@ -283,8 +283,8 @@ bool CSG_GDAL_DataSet::Open_Read(const CSG_String &File_Name)
 	{
 		m_bTransform	= true;
 		m_Cellsize		= 1.0;
-		m_xMin			= 0.5;
-		m_yMin			= 0.5;
+		m_xMin			= 0.0;
+		m_yMin			= 0.0;
 	}
 
 	m_TF_A[0]		= Transform[0];
@@ -772,6 +772,143 @@ bool CSG_GDAL_DataSet::Write(int i, CSG_Grid *pGrid)
 
 ///////////////////////////////////////////////////////////
 //														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CSG_GDAL_DataSet::Get_Transformation(CSG_Grid_System &System, bool bVerbose) const
+{
+	CSG_Vector	A;
+	CSG_Matrix	B;
+
+	Get_Transformation(A, B);
+
+	//-----------------------------------------------------
+	if( Needs_Transformation() )
+	{
+		CSG_Vector	v(2);
+		CSG_Rect	r;
+
+		v[0]	= Get_xMin() + 0.5;	v[1]	= Get_yMin() + 0.5;	v	= B * v + A;	r.Assign(v[0], v[1], v[0], v[1]);
+		v[0]	= Get_xMin() + 0.5;	v[1]	= Get_yMax() - 0.5;	v	= B * v + A;	r.Union(CSG_Point(v[0], v[1]));
+		v[0]	= Get_xMax() - 0.5;	v[1]	= Get_yMax() - 0.5;	v	= B * v + A;	r.Union(CSG_Point(v[0], v[1]));
+		v[0]	= Get_xMax() - 0.5;	v[1]	= Get_yMin() + 0.5;	v	= B * v + A;	r.Union(CSG_Point(v[0], v[1]));
+
+		v[0]	= 1;	v[1] = 0;	v = B * v;	double	dx	= v.Get_Length();
+		v[0]	= 0;	v[1] = 1;	v = B * v;	double	dy	= v.Get_Length();
+
+		if( dx != dy )
+		{
+			if( bVerbose )
+			{
+				SG_UI_Msg_Add_Execution(CSG_String::Format("\n%s: %s\n\t%s: %f",
+					_TL("warning"), _TL("top-to-bottom and left-to-right cell sizes differ."), _TL("Difference"), fabs(dy - dx)), false
+				);
+			}
+
+			if( dx > dy )
+			{
+				dx	= dy;
+			}
+
+			if( bVerbose )
+			{
+				SG_UI_Msg_Add_Execution(CSG_String::Format("\n\t%s: %f\n", _TL("using cellsize"), dx), false);
+			}
+		}
+
+		return( System.Assign(dx, r) );
+	}
+
+	//-----------------------------------------------------
+	return( false );
+}
+
+//---------------------------------------------------------
+bool CSG_GDAL_DataSet::Get_Transformation(CSG_Grid **ppGrid, TSG_Grid_Interpolation	Interpolation, bool bVerbose)	const
+{
+	CSG_Grid_System	System;
+
+	if( Get_Transformation(System, bVerbose) )
+	{
+		return( Get_Transformation(ppGrid, Interpolation, System, bVerbose) );
+	}
+
+	return( false );
+}
+
+//---------------------------------------------------------
+bool CSG_GDAL_DataSet::Get_Transformation(CSG_Grid **ppGrid, TSG_Grid_Interpolation	Interpolation, const CSG_Grid_System &System, bool bVerbose)	const
+{
+	if( !System.is_Valid() )
+	{
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	CSG_Vector	A;
+	CSG_Matrix	B, BInv;
+
+	Get_Transformation(A, B);
+
+	BInv	= B.Get_Inverse();
+
+	//-----------------------------------------------------
+	CSG_Grid	*pImage	= *ppGrid;
+	CSG_Grid	*pWorld	= SG_Create_Grid(System, pImage->Get_Type());
+
+	if( !pWorld )
+	{
+		return( false );
+	}
+
+	*ppGrid	= pWorld;
+
+	pWorld->Set_Name              (pImage->Get_Name        ());
+	pWorld->Set_Description       (pImage->Get_Description ());
+	pWorld->Set_Unit              (pImage->Get_Unit        ());
+	pWorld->Set_Scaling           (pImage->Get_Scaling     (), pImage->Get_Offset());
+	pWorld->Set_NoData_Value_Range(pImage->Get_NoData_Value(), pImage->Get_NoData_hiValue());
+	pWorld->Get_MetaData()	     = pImage->Get_MetaData    ();
+	pWorld->Get_Projection()     = pImage->Get_Projection  ();
+
+	//-----------------------------------------------------
+//	#pragma omp parallel for
+//	for(int y=0; y<pWorld->Get_NY(); y++)
+//	{
+//		Process_Get_Okay();
+
+	for(int y=0; y<pWorld->Get_NY() && SG_UI_Process_Set_Progress(y, pWorld->Get_NY()); y++)
+	{
+		#pragma omp parallel for
+		for(int x=0; x<pWorld->Get_NX(); x++)
+		{
+			double		z;
+			CSG_Vector	vWorld(2), vImage;
+
+			vWorld[0]	= pWorld->Get_XMin() + x * pWorld->Get_Cellsize();
+			vWorld[1]	= pWorld->Get_YMin() + y * pWorld->Get_Cellsize();
+
+			vImage	= BInv * (vWorld - A);
+
+			if( pImage->Get_Value(vImage[0], vImage[1], z, Interpolation, false, true) )
+			{
+				pWorld->Set_Value(x, y, z);
+			}
+			else
+			{
+				pWorld->Set_NoData(x, y);
+			}
+		}
+	}
+
+	delete(pImage);
+
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
 //														 //
 //														 //
 ///////////////////////////////////////////////////////////
diff --git a/src/modules/io/io_gdal/gdal_driver.h b/src/modules/io/io_gdal/gdal_driver.h
index 79ded4d..788e1ae 100644
--- a/src/modules/io/io_gdal/gdal_driver.h
+++ b/src/modules/io/io_gdal/gdal_driver.h
@@ -139,8 +139,11 @@ public:
 	double						Get_xMax			(void)	const	{	return( m_xMin + m_NX * m_Cellsize );	}
 	double						Get_yMax			(void)	const	{	return( m_yMin + m_NY * m_Cellsize );	}
 
-	bool						Needs_Transform		(void)	const	{	return( m_bTransform );	}
-	void						Get_Transform		(CSG_Vector &A, CSG_Matrix &B)	const	{	A	= m_TF_A;	B	= m_TF_B;	}
+	bool						Needs_Transformation(void)	const	{	return( m_bTransform );	}
+	void						Get_Transformation	(CSG_Vector &A, CSG_Matrix &B)				const	{	A	= m_TF_A;	B	= m_TF_B;	}
+	bool						Get_Transformation	(CSG_Grid_System &System, bool bVerbose)	const;
+	bool						Get_Transformation	(CSG_Grid **ppGrid, TSG_Grid_Interpolation Interpolation, bool bVerbose)	const;
+	bool						Get_Transformation	(CSG_Grid **ppGrid, TSG_Grid_Interpolation Interpolation, const CSG_Grid_System &System, bool bVerbose)	const;
 
 	class GDALDriver *			Get_Driver			(void)	const;
 	CSG_String					Get_DriverID		(void)	const;
diff --git a/src/modules/io/io_gdal/gdal_import.cpp b/src/modules/io/io_gdal/gdal_import.cpp
index d6d3c4a..99ae9e7 100644
--- a/src/modules/io/io_gdal/gdal_import.cpp
+++ b/src/modules/io/io_gdal/gdal_import.cpp
@@ -74,7 +74,7 @@ CGDAL_Import::CGDAL_Import(void)
 	//-----------------------------------------------------
 	Set_Name	(_TL("GDAL: Import Raster"));
 
-	Set_Author	(SG_T("O.Conrad (c) 2007 (A.Ringeler)"));
+	Set_Author	("O.Conrad (c) 2007 (A.Ringeler)");
 
 	CSG_String	Description;
 
@@ -86,7 +86,7 @@ CGDAL_Import::CGDAL_Import(void)
 		"  http://www.gdal.org</a>\n"
 	);
 
-	Description	+= CSG_String::Format(SG_T("\nGDAL %s:%s\n\n"), _TL("Version"), SG_Get_GDAL_Drivers().Get_Version().c_str());
+	Description	+= CSG_String::Format("\nGDAL %s:%s\n\n", _TL("Version"), SG_Get_GDAL_Drivers().Get_Version().c_str());
 
 	Description	+= _TW(
 		"Following raster formats are currently supported:\n"
@@ -95,13 +95,13 @@ CGDAL_Import::CGDAL_Import(void)
 
 	for(int i=0; i<SG_Get_GDAL_Drivers().Get_Count(); i++)
     {
-		Description	+= CSG_String::Format(SG_T("<tr><td>%s</td><td>%s</td></tr>\n"),
+		Description	+= CSG_String::Format("<tr><td>%s</td><td>%s</td></tr>\n",
 			SG_Get_GDAL_Drivers().Get_Description(i).c_str(),
 			SG_Get_GDAL_Drivers().Get_Name       (i).c_str()
 		);
     }
 
-	Description	+= SG_T("</table>");
+	Description	+= "</table>";
 
 	Set_Description(Description);
 
@@ -138,7 +138,7 @@ CGDAL_Import::CGDAL_Import(void)
 	Parameters.Add_Choice(
 		pNode	, "INTERPOL"	, _TL("Interpolation"),
 		_TL("interpolation method to use if grid needs to be aligned to coordinate system"),
-		CSG_String::Format(SG_T("%s|%s|%s|%s|%s|"),
+		CSG_String::Format("%s|%s|%s|%s|%s|",
 			_TL("Nearest Neighbor"),
 			_TL("Bilinear Interpolation"),
 			_TL("Inverse Distance Interpolation"),
@@ -161,13 +161,13 @@ CGDAL_Import::CGDAL_Import(void)
 //---------------------------------------------------------
 int CGDAL_Import::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("TRANSFORM")) )
+	if(	!SG_STR_CMP(pParameter->Get_Identifier(), "TRANSFORM") )
 	{
 		pParameters->Get_Parameter("INTERPOL")->Set_Enabled(pParameter->asBool());
 	}
 
-	if( !SG_STR_CMP(pParameters->Get_Identifier(), SG_T("SELECTION"))
-	&&  !SG_STR_CMP(pParameter ->Get_Identifier(), SG_T("ALL")) && pParameters->Get_Parameter("BANDS") )
+	if( !SG_STR_CMP(pParameters->Get_Identifier(), "SELECTION")
+	&&  !SG_STR_CMP(pParameter ->Get_Identifier(), "ALL") && pParameters->Get_Parameter("BANDS") )
 	{
 		pParameters->Get_Parameter("BANDS")->Set_Enabled(!pParameter->asBool());
 	}
@@ -200,7 +200,7 @@ bool CGDAL_Import::On_Execute(void)
 
 	for(int i=0; i<Files.Get_Count(); i++)
 	{
-		Message_Add(CSG_String::Format(SG_T("\n%s: %s"), _TL("loading"), Files[i].c_str()), false);
+		Message_Add(CSG_String::Format("\n%s: %s", _TL("loading"), Files[i].c_str()), false);
 
 		if( DataSet.Open_Read(Files[i]) == false )
 		{
@@ -236,14 +236,14 @@ bool CGDAL_Import::Load_Sub(CSG_GDAL_DataSet &DataSet)
 
 	for(i=0, n=0; i==n; i++)
 	{
-		CSG_MetaData	*pName	= MetaData.Get_Child(CSG_String::Format(SG_T("SUBDATASET_%d_NAME"), i + 1));
-		CSG_MetaData	*pDesc	= MetaData.Get_Child(CSG_String::Format(SG_T("SUBDATASET_%d_DESC"), i + 1));
+		CSG_MetaData	*pName	= MetaData.Get_Child(CSG_String::Format("SUBDATASET_%d_NAME", i + 1));
+		CSG_MetaData	*pDesc	= MetaData.Get_Child(CSG_String::Format("SUBDATASET_%d_DESC", i + 1));
 
 		if( pName )
 		{
 			n++;
 
-			Message_Add(CSG_String::Format(SG_T("\n%s"), pName->Get_Content().c_str()), false);
+			Message_Add(CSG_String::Format("\n%s", pName->Get_Content().c_str()), false);
 
 			P.Add_Value(NULL, pName->Get_Content(), pDesc ? pDesc->Get_Content().c_str() : _TL("unnamed"), SG_T(""), PARAMETER_TYPE_Bool, SG_UI_Get_Window_Main() == NULL);
 		}
@@ -290,19 +290,18 @@ bool CGDAL_Import::Load(CSG_GDAL_DataSet &DataSet, const CSG_String &Name)
 	CSG_Vector	A;
 	CSG_Matrix	B;
 
-	DataSet.Get_Transform(A, B);
+	DataSet.Get_Transformation(A, B);
 
-	//-----------------------------------------------------
-	Message_Add(SG_T("\n"), false);
-	Message_Add(CSG_String::Format(SG_T("\n%s: %s"), _TL("Driver" ), DataSet.Get_DriverID().c_str()   ), false);
-	Message_Add(CSG_String::Format(SG_T("\n%s: %d"), _TL("Bands"  ), DataSet.Get_Count()              ), false);
-	Message_Add(CSG_String::Format(SG_T("\n%s: %d"), _TL("Rows"   ), DataSet.Get_NX()                 ), false);
-	Message_Add(CSG_String::Format(SG_T("\n%s: %d"), _TL("Columns"), DataSet.Get_NY()                 ), false);
-	Message_Add(SG_T("\n"), false);
-	Message_Add(CSG_String::Format(SG_T("\n%s:"), _TL("Transformation")                               ), false);
-	Message_Add(CSG_String::Format(SG_T("\n  x' = %.6f + x * %.6f + y * %.6f"), A[0], B[0][0], B[0][1]), false);
-	Message_Add(CSG_String::Format(SG_T("\n  y' = %.6f + x * %.6f + y * %.6f"), A[1], B[1][0], B[1][1]), false);
-	Message_Add(SG_T("\n"), false);
+	Message_Add("\n", false);
+	Message_Add(CSG_String::Format("\n%s: %s", _TL("Driver" ), DataSet.Get_DriverID().c_str()   ), false);
+	Message_Add(CSG_String::Format("\n%s: %d", _TL("Bands"  ), DataSet.Get_Count()              ), false);
+	Message_Add(CSG_String::Format("\n%s: %d", _TL("Rows"   ), DataSet.Get_NX()                 ), false);
+	Message_Add(CSG_String::Format("\n%s: %d", _TL("Columns"), DataSet.Get_NY()                 ), false);
+	Message_Add("\n", false);
+	Message_Add(CSG_String::Format("\n%s:", _TL("Transformation")                               ), false);
+	Message_Add(CSG_String::Format("\n  x' = %.6f + x * %.6f + y * %.6f", A[0], B[0][0], B[0][1]), false);
+	Message_Add(CSG_String::Format("\n  y' = %.6f + x * %.6f + y * %.6f", A[1], B[1][0], B[1][1]), false);
+	Message_Add("\n", false);
 
 	//-----------------------------------------------------
 	int			i, n;
@@ -351,35 +350,20 @@ bool CGDAL_Import::Load(CSG_GDAL_DataSet &DataSet, const CSG_String &Name)
 	}
 
 	//-----------------------------------------------------
-	CSG_Grid_System	Transform;
+	TSG_Grid_Interpolation	Interpolation;
 
-	if( Parameters("TRANSFORM")->asBool() && DataSet.Needs_Transform() )
+	switch( Parameters("INTERPOL")->asInt() )
 	{
-		double		s;
-		CSG_Vector	v(2);
-		CSG_Rect	r;
-
-		v[0]	= DataSet.Get_xMin();	v[1]	= DataSet.Get_yMin();	v	= B * v + A;	r.Assign(v[0], v[1], v[0], v[1]);
-		v[0]	= DataSet.Get_xMin();	v[1]	= DataSet.Get_yMax();	v	= B * v + A;	r.Union(CSG_Point(v[0], v[1]));
-		v[0]	= DataSet.Get_xMax();	v[1]	= DataSet.Get_yMax();	v	= B * v + A;	r.Union(CSG_Point(v[0], v[1]));
-		v[0]	= DataSet.Get_xMax();	v[1]	= DataSet.Get_yMin();	v	= B * v + A;	r.Union(CSG_Point(v[0], v[1]));
-
-		v[0]	= 0;	v[1] = 1;	v = B * v;	s	= fabs(v.Get_Length());
-		v[0]	= 1;	v[1] = 0;	v = B * v;
-
-		if( s != fabs(v.Get_Length()) )
-		{
-			if( s > fabs(v.Get_Length()) )
-			{
-				s	= fabs(v.Get_Length());
-			}
-
-			Message_Add(CSG_String::Format(SG_T("\n%s: %s\n\t%s: %f\n"), _TL("warning"), _TL("top-to-bottom and left-to-right cell sizes differ."), _TL("using cellsize"), s), false);
-		}
-
-		Transform.Assign(s, r);
+	default:
+	case 0:	Interpolation	= GRID_INTERPOLATION_NearestNeighbour;	break;
+	case 1:	Interpolation	= GRID_INTERPOLATION_Bilinear;			break;
+	case 2:	Interpolation	= GRID_INTERPOLATION_InverseDistance;	break;
+	case 3:	Interpolation	= GRID_INTERPOLATION_BicubicSpline;		break;
+	case 4:	Interpolation	= GRID_INTERPOLATION_BSpline;			break;
 	}
 
+	bool	bTransform	= Parameters("TRANSFORM")->asBool() && DataSet.Needs_Transformation();
+
 	//-----------------------------------------------------
 	for(i=0, n=0; i<DataSet.Get_Count() && Process_Get_Okay(); i++)
 	{
@@ -387,7 +371,7 @@ bool CGDAL_Import::Load(CSG_GDAL_DataSet &DataSet, const CSG_String &Name)
 
 		if( !Bands.Get_Selection_Count() || pBand->is_Selected() )
 		{
-			Process_Set_Text(CSG_String::Format(SG_T("%s [%d/%d]"), _TL("loading band"), i + 1, DataSet.Get_Count()));
+			Process_Set_Text(CSG_String::Format("%s [%d/%d]", _TL("loading band"), i + 1, DataSet.Get_Count()));
 
 			CSG_Grid	*pGrid	= DataSet.Read(pBand->Get_Index());
 
@@ -395,22 +379,22 @@ bool CGDAL_Import::Load(CSG_GDAL_DataSet &DataSet, const CSG_String &Name)
 			{
 				n++;
 
-				if( Transform.is_Valid() )
+				if( bTransform )
 				{
-					Process_Set_Text(CSG_String::Format(SG_T("%s [%d/%d]"), _TL("band transformation"), i + 1, DataSet.Get_Count()));
+					Process_Set_Text(CSG_String::Format("%s [%d/%d]", _TL("band transformation"), i + 1, DataSet.Get_Count()));
 
-					Set_Transformation(&pGrid, Transform, A, B);
+					DataSet.Get_Transformation(&pGrid, Interpolation, true);
 				}
 
 				pGrid->Set_Name(DataSet.Get_Count() > 1
-					? CSG_String::Format(SG_T("%s [%s]"), Name.c_str(), pGrid->Get_Name()).c_str()
+					? CSG_String::Format("%s [%s]", Name.c_str(), pGrid->Get_Name()).c_str()
 					: Name.c_str()
 				);
 
 				m_pGrids->Add_Item(pGrid);
 
 				DataObject_Add			(pGrid);
-				DataObject_Set_Colors	(pGrid, CSG_Colors(100, SG_COLORS_BLACK_WHITE, false));
+				DataObject_Set_Colors	(pGrid, CSG_Colors(11, SG_COLORS_BLACK_WHITE, false));
 			}
 		}
     }
@@ -422,74 +406,6 @@ bool CGDAL_Import::Load(CSG_GDAL_DataSet &DataSet, const CSG_String &Name)
 
 ///////////////////////////////////////////////////////////
 //														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-void CGDAL_Import::Set_Transformation(CSG_Grid **ppGrid, const CSG_Grid_System &System, const CSG_Vector &A, const CSG_Matrix &B)
-{
-	//-----------------------------------------------------
-	TSG_Grid_Interpolation	Interpolation;
-
-	switch( Parameters("INTERPOL")->asInt() )
-	{
-	default:
-	case 0:	Interpolation	= GRID_INTERPOLATION_NearestNeighbour;	break;
-	case 1:	Interpolation	= GRID_INTERPOLATION_Bilinear;			break;
-	case 2:	Interpolation	= GRID_INTERPOLATION_InverseDistance;	break;
-	case 3:	Interpolation	= GRID_INTERPOLATION_BicubicSpline;		break;
-	case 4:	Interpolation	= GRID_INTERPOLATION_BSpline;			break;
-	}
-
-	//-----------------------------------------------------
-	CSG_Matrix	BInv(B.Get_Inverse());
-
-	CSG_Grid	*pImage	= *ppGrid;
-	CSG_Grid	*pWorld	= *ppGrid	= SG_Create_Grid(System, pImage->Get_Type());
-
-	pWorld->Set_Name              (pImage->Get_Name        ());
-	pWorld->Set_Description       (pImage->Get_Description ());
-	pWorld->Set_Unit              (pImage->Get_Unit        ());
-	pWorld->Set_Scaling           (pImage->Get_Scaling     (), pImage->Get_Offset());
-	pWorld->Set_NoData_Value_Range(pImage->Get_NoData_Value(), pImage->Get_NoData_hiValue());
-	pWorld->Get_MetaData()	     = pImage->Get_MetaData    ();
-	pWorld->Get_Projection()     = pImage->Get_Projection  ();
-
-	//-----------------------------------------------------
-//	#pragma omp parallel for
-//	for(int y=0; y<pWorld->Get_NY(); y++)
-//	{
-//		Process_Get_Okay();
-
-	for(int y=0; y<pWorld->Get_NY() && Set_Progress(y, pWorld->Get_NY()); y++)
-	{
-		#pragma omp parallel for
-		for(int x=0; x<pWorld->Get_NX(); x++)
-		{
-			double		z;
-			CSG_Vector	vWorld(2), vImage;
-
-			vWorld[0]	= pWorld->Get_XMin() + x * pWorld->Get_Cellsize();
-			vWorld[1]	= pWorld->Get_YMin() + y * pWorld->Get_Cellsize();
-
-			vImage	= BInv * (vWorld - A);
-
-			if( pImage->Get_Value(vImage[0], vImage[1], z, Interpolation, false, true) )
-			{
-				pWorld->Set_Value(x, y, z);
-			}
-			else
-			{
-				pWorld->Set_NoData(x, y);
-			}
-		}
-	}
-
-	delete(pImage);
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
 //														 //
 //														 //
 ///////////////////////////////////////////////////////////
@@ -499,7 +415,7 @@ bool	SG_GDAL_Import	(const CSG_String &File_Name)
 {
 	CGDAL_Import	Import;
 
-	if(	!Import.Get_Parameters()->Set_Parameter(SG_T("FILES"), File_Name, PARAMETER_TYPE_FilePath) )
+	if(	!Import.Get_Parameters()->Set_Parameter("FILES", File_Name, PARAMETER_TYPE_FilePath) )
 	{
 		return( false );
 	}
@@ -509,7 +425,7 @@ bool	SG_GDAL_Import	(const CSG_String &File_Name)
 		return( false );
 	}
 
-	CSG_Parameter_Grid_List	*pGrids	= Import.Get_Parameters()->Get_Parameter(SG_T("GRIDS"))->asGridList();
+	CSG_Parameter_Grid_List	*pGrids	= Import.Get_Parameters()->Get_Parameter("GRIDS")->asGridList();
 
 	for(int i=0; i<pGrids->Get_Count(); i++)
 	{
diff --git a/src/modules/io/io_gdal/gdal_import.h b/src/modules/io/io_gdal/gdal_import.h
index c616077..8b33de1 100644
--- a/src/modules/io/io_gdal/gdal_import.h
+++ b/src/modules/io/io_gdal/gdal_import.h
@@ -92,8 +92,6 @@ private:
 	bool						Load_Sub				(CSG_GDAL_DataSet &DataSet);
 	bool						Load					(CSG_GDAL_DataSet &DataSet, const CSG_String &Name);
 
-	void						Set_Transformation		(CSG_Grid **ppGrid, const CSG_Grid_System &System, const CSG_Vector &A, const CSG_Matrix &B);
-
 };
 
 
diff --git a/src/modules/io/io_gdal/gdal_import_netcdf.cpp b/src/modules/io/io_gdal/gdal_import_netcdf.cpp
index 57f0b17..02b2226 100644
--- a/src/modules/io/io_gdal/gdal_import_netcdf.cpp
+++ b/src/modules/io/io_gdal/gdal_import_netcdf.cpp
@@ -112,6 +112,25 @@ CGDAL_Import_NetCDF::CGDAL_Import_NetCDF(void)
 		_TL(""),
 		NULL, NULL, true, true
 	);
+
+	//-----------------------------------------------------
+	pNode	= Parameters.Add_Value(
+		NULL	, "TRANSFORM"	, _TL("Transformation"),
+		_TL("apply coordinate transformation if appropriate"),
+		PARAMETER_TYPE_Bool, true
+	);
+
+	Parameters.Add_Choice(
+		pNode	, "INTERPOL"	, _TL("Interpolation"),
+		_TL("interpolation method to use if grid needs to be aligned to coordinate system"),
+		CSG_String::Format(SG_T("%s|%s|%s|%s|%s|"),
+			_TL("Nearest Neighbor"),
+			_TL("Bilinear Interpolation"),
+			_TL("Inverse Distance Interpolation"),
+			_TL("Bicubic Spline Interpolation"),
+			_TL("B-Spline Interpolation")
+		), 4
+	);
 }
 
 
@@ -144,6 +163,11 @@ int CGDAL_Import_NetCDF::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_P
 		pParameters->Get_Parameter("LEVEL")->Set_Enabled(!pParameter->asBool());
 	}
 
+	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("TRANSFORM")) )
+	{
+		pParameters->Get_Parameter("INTERPOL")->Set_Enabled(pParameter->asBool());
+	}
+
 	return( 1 );
 }
 
@@ -353,6 +377,21 @@ bool CGDAL_Import_NetCDF::Load(CSG_GDAL_DataSet &DataSet, const CSG_String &Desc
 	}
 
 	//-----------------------------------------------------
+	TSG_Grid_Interpolation	Interpolation;
+
+	switch( Parameters("INTERPOL")->asInt() )
+	{
+	default:
+	case 0:	Interpolation	= GRID_INTERPOLATION_NearestNeighbour;	break;
+	case 1:	Interpolation	= GRID_INTERPOLATION_Bilinear;			break;
+	case 2:	Interpolation	= GRID_INTERPOLATION_InverseDistance;	break;
+	case 3:	Interpolation	= GRID_INTERPOLATION_BicubicSpline;		break;
+	case 4:	Interpolation	= GRID_INTERPOLATION_BSpline;			break;
+	}
+
+	bool	bTransform	= Parameters("TRANSFORM")->asBool() && DataSet.Needs_Transformation();
+
+	//-----------------------------------------------------
 	for(i=0; i<DataSet.Get_Count() && Set_Progress(i, DataSet.Get_Count()); i++)
 	{
 		CSG_Grid		*pGrid;
@@ -366,6 +405,13 @@ bool CGDAL_Import_NetCDF::Load(CSG_GDAL_DataSet &DataSet, const CSG_String &Desc
 
 			if( (pGrid = DataSet.Read(i)) != NULL )
 			{
+				if( bTransform )
+				{
+					Process_Set_Text(CSG_String::Format(SG_T("%s [%d/%d]"), _TL("band transformation"), i + 1, DataSet.Get_Count()));
+
+					DataSet.Get_Transformation(&pGrid, Interpolation, true);
+				}
+
 				CSG_String	Name(_TL("unknown"));
 				
 				if( (s = Get_Variable(DataSet, i)) != NULL && *s )	Name	= s;
diff --git a/src/modules/io/io_gdal/ogr_driver.cpp b/src/modules/io/io_gdal/ogr_driver.cpp
index 9954f50..69c9abd 100644
--- a/src/modules/io/io_gdal/ogr_driver.cpp
+++ b/src/modules/io/io_gdal/ogr_driver.cpp
@@ -86,12 +86,21 @@ const CSG_OGR_Drivers &	SG_Get_OGR_Drivers	(void)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
+#ifdef USE_GDAL_V2
+CSG_OGR_Drivers::CSG_OGR_Drivers(void)
+{
+	GDALAllRegister();
+
+	m_pDrivers	= GetGDALDriverManager();
+}
+#else
 CSG_OGR_Drivers::CSG_OGR_Drivers(void)
 {
 	OGRRegisterAll();
 
 	m_pDrivers	= OGRSFDriverRegistrar::GetRegistrar();
 }
+#endif
 
 //---------------------------------------------------------
 CSG_OGR_Drivers::~CSG_OGR_Drivers(void)
@@ -110,13 +119,37 @@ int CSG_OGR_Drivers::Get_Count(void) const
 	return( m_pDrivers->GetDriverCount() );
 }
 
+#ifdef USE_GDAL_V2
 //---------------------------------------------------------
-OGRSFDriver * CSG_OGR_Drivers::Get_Driver(int Index) const
+GDALDriver * CSG_OGR_Drivers::Get_Driver(int Index) const
 {
 	return( m_pDrivers->GetDriver(Index) );
 }
 
+GDALDriver * CSG_OGR_Drivers::Get_Driver(const CSG_String &Name) const
+{
+	return( m_pDrivers ? m_pDrivers->GetDriverByName(Name) : NULL );
+}
+
+//---------------------------------------------------------
+CSG_String CSG_OGR_Drivers::Get_Name(int Index) const
+{
+	return( m_pDrivers->GetDriver(Index)->GetMetadataItem(GDAL_DMD_LONGNAME) );
+}
+
+//---------------------------------------------------------
+CSG_String CSG_OGR_Drivers::Get_Description(int Index) const
+{
+	return( m_pDrivers->GetDriver(Index)->GetDescription() );
+}
+
+#else
 //---------------------------------------------------------
+OGRSFDriver * CSG_OGR_Drivers::Get_Driver(int Index) const
+{
+	return( m_pDrivers->GetDriver(Index) );
+}
+
 OGRSFDriver * CSG_OGR_Drivers::Get_Driver(const CSG_String &Name) const
 {
 	return( m_pDrivers ? m_pDrivers->GetDriverByName(Name) : NULL );
@@ -162,6 +195,8 @@ CSG_String CSG_OGR_Drivers::Get_Description(int Index) const
 	return( s );
 }
 
+#endif
+
 //---------------------------------------------------------
 bool CSG_OGR_Drivers::Can_Read(int Index) const
 {
@@ -330,6 +365,45 @@ CSG_OGR_DataSource::~CSG_OGR_DataSource(void)
 	Destroy();
 }
 
+#ifdef USE_GDAL_V2
+//---------------------------------------------------------
+bool CSG_OGR_DataSource::Create(const CSG_String &File)
+{
+	Destroy();
+
+	m_pDataSource	= (GDALDataset *)GDALOpenEx(File, GDAL_OF_VECTOR, NULL, NULL, NULL);
+
+	return( m_pDataSource != NULL );
+}
+
+bool CSG_OGR_DataSource::Create(const CSG_String &File, const CSG_String &DriverName)
+{
+	GDALDriver	*pDriver;
+
+	Destroy();
+
+	if( (pDriver = gSG_OGR_Drivers.Get_Driver(DriverName)) != NULL )
+	{
+		m_pDataSource	= pDriver->Create(File, 0, 0, 0, GDT_Unknown, NULL);
+	}
+
+	return( m_pDataSource != NULL );
+}
+
+//---------------------------------------------------------
+bool CSG_OGR_DataSource::Destroy(void)
+{
+	if( m_pDataSource )
+	{
+		GDALClose(m_pDataSource);
+
+		m_pDataSource	= NULL;
+	}
+
+	return( true );
+}
+
+#else
 //---------------------------------------------------------
 bool CSG_OGR_DataSource::Create(const CSG_String &File)
 {
@@ -367,6 +441,8 @@ bool CSG_OGR_DataSource::Destroy(void)
 	return( true );
 }
 
+#endif
+
 
 ///////////////////////////////////////////////////////////
 //														 //
diff --git a/src/modules/io/io_gdal/ogr_driver.h b/src/modules/io/io_gdal/ogr_driver.h
index ea6276a..ce2fead 100644
--- a/src/modules/io/io_gdal/ogr_driver.h
+++ b/src/modules/io/io_gdal/ogr_driver.h
@@ -63,6 +63,11 @@
 //---------------------------------------------------------
 #include "MLB_Interface.h"
 
+#include <gdal.h>
+
+#if defined(GDAL_VERSION_MAJOR) && GDAL_VERSION_MAJOR == 2
+#define USE_GDAL_V2
+#endif
 
 //---------------------------------------------------------
 typedef enum ESG_Geom_Type_Choice_Key
@@ -86,7 +91,6 @@ typedef enum ESG_Geom_Type_Choice_Key
 }
 TSG_Geom_Type_Choice_Key;
 
-
 //---------------------------------------------------------
 const SG_Char	gSG_Geom_Type_Choice_Key_Name[GEOM_TYPE_KEY_Count][32]	=
 {
@@ -107,6 +111,7 @@ const SG_Char	gSG_Geom_Type_Choice_Key_Name[GEOM_TYPE_KEY_Count][32]	=
 	SG_T("wkbGeometryCollection25D")
 };
 
+
 ///////////////////////////////////////////////////////////
 //														 //
 //														 //
@@ -122,8 +127,13 @@ public:
 
 	int							Get_Count			(void)						const;
 
+#ifdef USE_GDAL_V2
+	class GDALDriver *			Get_Driver			(const CSG_String &Name)	const;
+	class GDALDriver *			Get_Driver			(int Index)					const;
+#else
 	class OGRSFDriver *			Get_Driver			(const CSG_String &Name)	const;
 	class OGRSFDriver *			Get_Driver			(int Index)					const;
+#endif
 
 	CSG_String					Get_Name			(int Index)					const;
 	CSG_String					Get_Description		(int Index)					const;
@@ -141,7 +151,11 @@ public:
 
 private:
 
+#ifdef USE_GDAL_V2
+	class GDALDriverManager		*m_pDrivers;
+#else
 	class OGRSFDriverRegistrar	*m_pDrivers;
+#endif
 
 };
 
@@ -178,7 +192,11 @@ public:
 
 private:
 
+#ifdef USE_GDAL_V2
+	class GDALDataset			*m_pDataSource;
+#else
 	class OGRDataSource			*m_pDataSource;
+#endif
 
 
 	int							_Get_GeomType_Choice(int iGeomTypeChoice);
diff --git a/src/modules/io/io_gps/Makefile.in b/src/modules/io/io_gps/Makefile.in
index 025e437..070136a 100644
--- a/src/modules/io/io_gps/Makefile.in
+++ b/src/modules/io/io_gps/Makefile.in
@@ -463,22 +463,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gpx2shp.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/io/io_grid/MLB_Interface.cpp b/src/modules/io/io_grid/MLB_Interface.cpp
index 67d9ba8..53ea279 100644
--- a/src/modules/io/io_grid/MLB_Interface.cpp
+++ b/src/modules/io/io_grid/MLB_Interface.cpp
@@ -109,6 +109,7 @@ CSG_String Get_Info(int i)
 #include "grid_table.h"
 #include "wrf.h"
 #include "citygml_import.h"
+#include "import_clip_resample.h"
 
 
 //---------------------------------------------------------
@@ -118,24 +119,27 @@ CSG_Module *		Create_Module(int i)
 {
 	switch( i )
 	{
-	case 0:		return( new CESRI_ArcInfo_Export );
-	case 1:		return( new CESRI_ArcInfo_Import );
-	case 2:		return( new CSurfer_Export );
-	case 3:		return( new CSurfer_Import );
-	case 4:		return( new CRaw_Import );
-	case 5:		return( new CXYZ_Export );
-	case 6:		return( new CXYZ_Import );
-	case 7:		return( new CUSGS_SRTM_Import );
-	case 8:		return( new CMOLA_Import );
-	case 9:		return( new CSRTM30_Import );
+	case 0 :	return( new CESRI_ArcInfo_Export );
+	case 1 :	return( new CESRI_ArcInfo_Import );
+	case 2 :	return( new CSurfer_Export );
+	case 3 :	return( new CSurfer_Import );
+	case 4 :	return( new CRaw_Import );
+	case 5 :	return( new CXYZ_Export );
+	case 6 :	return( new CXYZ_Import );
+	case 7 :	return( new CUSGS_SRTM_Import );
+	case 8 :	return( new CMOLA_Import );
+	case 9 :	return( new CSRTM30_Import );
 	case 10:	return( new CBMP_Export );
 	case 11:	return( new CErdas_LAN_Import );
 	case 12:	return( new CGrid_Table_Import );
 	case 13:	return( new CWRF_Import );
 	case 14:	return( new CWRF_Export );
 	case 15:	return( new CCityGML_Import );
+	case 16:	return( new CImport_Clip_Resample );
 
-	default:	return( NULL );
+	//-----------------------------------------------------
+	case 17:	return( NULL );
+	default:	return( MLB_INTERFACE_SKIP_MODULE );
 	}
 }
 
diff --git a/src/modules/io/io_grid/Makefile.am b/src/modules/io/io_grid/Makefile.am
index 2914d64..58d8d8a 100644
--- a/src/modules/io/io_grid/Makefile.am
+++ b/src/modules/io/io_grid/Makefile.am
@@ -18,6 +18,7 @@ citygml_import.cpp\
 erdas_lan.cpp\
 esri_arcinfo.cpp\
 grid_table.cpp\
+import_clip_resample.cpp\
 MLB_Interface.cpp\
 mola.cpp\
 raw.cpp\
@@ -31,6 +32,7 @@ citygml_import.h\
 erdas_lan.h\
 esri_arcinfo.h\
 grid_table.h\
+import_clip_resample.h\
 MLB_Interface.h\
 mola.h\
 raw.h\
diff --git a/src/modules/io/io_grid/Makefile.in b/src/modules/io/io_grid/Makefile.in
index 6ac6dc8..f11912f 100644
--- a/src/modules/io/io_grid/Makefile.in
+++ b/src/modules/io/io_grid/Makefile.in
@@ -128,8 +128,9 @@ LTLIBRARIES = $(pkglib_LTLIBRARIES)
 libio_grid_la_DEPENDENCIES =  \
 	$(top_srcdir)/src/saga_core/saga_api/libsaga_api.la
 am_libio_grid_la_OBJECTS = bmp_export.lo citygml_import.lo \
-	erdas_lan.lo esri_arcinfo.lo grid_table.lo MLB_Interface.lo \
-	mola.lo raw.lo srtm30.lo surfer.lo usgs_srtm.lo wrf.lo xyz.lo
+	erdas_lan.lo esri_arcinfo.lo grid_table.lo \
+	import_clip_resample.lo MLB_Interface.lo mola.lo raw.lo \
+	srtm30.lo surfer.lo usgs_srtm.lo wrf.lo xyz.lo
 libio_grid_la_OBJECTS = $(am_libio_grid_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
@@ -378,6 +379,7 @@ citygml_import.cpp\
 erdas_lan.cpp\
 esri_arcinfo.cpp\
 grid_table.cpp\
+import_clip_resample.cpp\
 MLB_Interface.cpp\
 mola.cpp\
 raw.cpp\
@@ -391,6 +393,7 @@ citygml_import.h\
 erdas_lan.h\
 esri_arcinfo.h\
 grid_table.h\
+import_clip_resample.h\
 MLB_Interface.h\
 mola.h\
 raw.h\
@@ -486,6 +489,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/erdas_lan.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/esri_arcinfo.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/grid_table.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/import_clip_resample.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mola.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/raw.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/srtm30.Plo at am__quote@
@@ -495,22 +499,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xyz.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/grid/grid_spline/Gridding_Spline_TPS_Global.cpp b/src/modules/io/io_grid/import_clip_resample.cpp
similarity index 60%
rename from src/modules/grid/grid_spline/Gridding_Spline_TPS_Global.cpp
rename to src/modules/io/io_grid/import_clip_resample.cpp
index 6ff0601..3eaa9ba 100644
--- a/src/modules/grid/grid_spline/Gridding_Spline_TPS_Global.cpp
+++ b/src/modules/io/io_grid/import_clip_resample.cpp
@@ -1,169 +1,201 @@
-/**********************************************************
- * Version $Id: Gridding_Spline_TPS_Global.cpp 1921 2014-01-09 10:24:11Z oconrad $
- *********************************************************/
-
-///////////////////////////////////////////////////////////
-//                                                       //
-//                         SAGA                          //
-//                                                       //
-//      System for Automated Geoscientific Analyses      //
-//                                                       //
-//                    Module Library:                    //
-//                     grid_spline                       //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//             Gridding_Spline_TPS_Global.cpp            //
-//                                                       //
-//                 Copyright (C) 2006 by                 //
-//                      Olaf Conrad                      //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-// This file is part of 'SAGA - System for Automated     //
-// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
-//                                                       //
-// SAGA is distributed in the hope that it will be       //
-// useful, but WITHOUT ANY WARRANTY; without even the    //
-// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
-// PARTICULAR PURPOSE. See the GNU General Public        //
-// License for more details.                             //
-//                                                       //
-// You should have received a copy of the GNU General    //
-// Public License along with this program; if not,       //
-// write to the Free Software Foundation, Inc.,          //
-// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
-// USA.                                                  //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//    e-mail:     oconrad at saga-gis.org                   //
-//                                                       //
-//    contact:    Olaf Conrad                            //
-//                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
-//                Germany                                //
-//                                                       //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#include "Gridding_Spline_TPS_Global.h"
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-CGridding_Spline_TPS_Global::CGridding_Spline_TPS_Global(void)
-	: CGridding_Spline_Base()
-{
-	Set_Name		(_TL("Thin Plate Spline (Global)"));
-
-	Set_Author		(SG_T("O.Conrad (c) 2006"));
-
-	Set_Description	(_TW(
-		"Creates a 'Thin Plate Spline' function using all points of selected input. "
-		"Suitable for the gridding of a small number of points. "
-		"\n\n"
-		"References:\n"
-		"- Donato G., Belongie S. (2002):"
-		" 'Approximation Methods for Thin Plate Spline Mappings and Principal Warps',"
-		" In Heyden, A., Sparr, G., Nielsen, M., Johansen, P. (Eds.):"
-		" 'Computer Vision - ECCV 2002: 7th European Conference on Computer Vision, Copenhagen, Denmark, May 28-31, 2002',"
-		" Proceedings, Part III, Lecture Notes in Computer Science."
-		" Springer-Verlag Heidelberg; pp.21-31."
-		"\n"
-		"\n"
-		"- Elonen, J. (2005):"
-		" 'Thin Plate Spline editor - an example program in C++',"
-		" <a target=\"_blank\" href=\"http://elonen.iki.fi/code/tpsdemo/index.html\">http://elonen.iki.fi/code/tpsdemo/index.html</a>."
-		"\n"
-	));
-
-	//-----------------------------------------------------
-	Parameters.Add_Value(
-		NULL	, "REGULARISATION"	, _TL("Regularisation"),
-		_TL(""),
-		PARAMETER_TYPE_Double, 0.0001, 0.0, true
-	);
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-bool CGridding_Spline_TPS_Global::On_Initialise(void)
+/**********************************************************
+ * Version $Id: import_clip_resample.cpp 1380 2012-04-26 12:02:19Z reklov_w $
+ *********************************************************/
+
+///////////////////////////////////////////////////////////
+//                                                       //
+//                         SAGA                          //
+//                                                       //
+//      System for Automated Geoscientific Analyses      //
+//                                                       //
+//                    Module Library:                    //
+//                     climate_tools                     //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//                import_clip_resample.cpp               //
+//                                                       //
+//                 Copyright (C) 2015 by                 //
+//                      Olaf Conrad                      //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+// This file is part of 'SAGA - System for Automated     //
+// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
+//                                                       //
+// SAGA is distributed in the hope that it will be       //
+// useful, but WITHOUT ANY WARRANTY; without even the    //
+// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
+// PARTICULAR PURPOSE. See the GNU General Public        //
+// License for more details.                             //
+//                                                       //
+// You should have received a copy of the GNU General    //
+// Public License along with this program; if not,       //
+// write to the Free Software Foundation, Inc.,          //
+// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
+// USA.                                                  //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//    e-mail:     oconrad at saga-gis.org                   //
+//                                                       //
+//    contact:    Olaf Conrad                            //
+//                Institute of Geography                 //
+//                University of Hamburg                  //
+//                Germany                                //
+//                                                       //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#include "import_clip_resample.h"
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+CImport_Clip_Resample::CImport_Clip_Resample(void)
+{
+	//-----------------------------------------------------
+	Set_Name		(_TL("Import, Clip and Resample Grids"));
+
+	Set_Author		("O.Conrad (c) 2015");
+
+	Set_Description	(_TW(
+		""
+	));
+
+	//-----------------------------------------------------
+	Parameters.Add_FilePath(
+		NULL	, "FILES"		, _TL("Image Files"),
+		_TL(""),
+		CSG_String::Format("%s|*.tif;*.tiff|%s|*.*",
+			_TL("GeoTIFF Files"),
+			_TL("All Files")
+		), NULL, false, false, true
+	);
+
+	Parameters.Add_Grid_List(
+		NULL	, "GRIDS"		, _TL("Grids"),
+		_TL(""),
+		PARAMETER_OUTPUT
+	);
+
+	Parameters.Add_Shapes(
+		NULL	, "CLIP"		, _TL("Region of Interest"),
+		_TL(""),
+		PARAMETER_INPUT, SHAPE_TYPE_Polygon
+	);
+
+	Parameters.Add_Value(
+		NULL	, "CELLSIZE"	, _TL("Target Cell Size"),
+		_TL(""),
+		PARAMETER_TYPE_Double, 100.0, 0.0, true
+	);
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CImport_Clip_Resample::On_Execute(void)
+{
+	//-----------------------------------------------------
+	CSG_Strings	Files;
+
+	if( !Parameters("FILES")->asFilePath()->Get_FilePaths(Files) || Files.Get_Count() == 0 )
+	{
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	CSG_Shapes	*pClip	= Parameters("CLIP")->asShapes();
+
+	m_System.Assign(Parameters("CELLSIZE")->asDouble(), pClip->Get_Extent());
+
+	//-----------------------------------------------------
+	m_pGrids	= Parameters("GRIDS")->asGridList();
+
+	m_pGrids->Del_Items();
+
+	for(int i=0; i<Files.Get_Count() && Process_Get_Okay(); i++)
+	{
+		Load_File(Files[i]);
+	}
+
+	//-----------------------------------------------------
+	if( m_pGrids->Get_Count() == 0 )
+	{
+		Error_Set(_TL("no grids have been imported"));
+	}
+
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CImport_Clip_Resample::Load_File(const CSG_String &File)
 {
-	m_pShapes			= Parameters("SHAPES"        )->asShapes();
-	m_zField			= Parameters("FIELD"         )->asInt   ();
-	m_Regularisation	= Parameters("REGULARISATION")->asDouble();
+	CSG_Data_Manager	Grids;
 
-	return( true );
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-bool CGridding_Spline_TPS_Global::On_Execute(void)
-{
-	if( !Initialise(m_Spline.Get_Points()) )
-	{
-		return( false );
-	}
-		
-	if( !m_Spline.Create(m_Regularisation, false) )
+	if( !Grids.Add(File) || !Grids.Get_Grid_System(0) || !Grids.Get_Grid_System(0)->Get(0) )
 	{
+		Error_Set(CSG_String::Format(SG_T("%s: %s"), _TL("could not load file"), File.c_str()));
+
 		return( false );
 	}
 
-	//-----------------------------------------------------
-	int			x, y;
-	TSG_Point	p;
+	int	n	= 0;
 
-	for(y=0, p.y=m_pGrid->Get_YMin(); y<m_pGrid->Get_NY() && Set_Progress(y, m_pGrid->Get_NY()); y++, p.y+=m_pGrid->Get_Cellsize())
+	for(size_t iSystem=0; iSystem<Grids.Grid_System_Count(); iSystem++)
 	{
-		for(x=0, p.x=m_pGrid->Get_XMin(); x<m_pGrid->Get_NX(); x++, p.x+=m_pGrid->Get_Cellsize())
+		for(size_t iGrid=0; iGrid<Grids.Get_Grid_System(iSystem)->Count(); iGrid++)
 		{
-			m_pGrid->Set_Value(x, y, m_Spline.Get_Value(p.x, p.y));
-		}
-	}
+			CSG_Grid	*pImport	= (CSG_Grid *)Grids.Get_Grid_System(iSystem)->Get(iGrid);
 
-	m_Spline.Destroy();
+			if( m_System.Get_Extent().Intersects(pImport->Get_Extent()) )
+			{
+				CSG_Grid	*pGrid	= SG_Create_Grid(m_System, SG_DATATYPE_Float);
 
-	return( true );
-}
+				pGrid->Assign  (pImport);
+				pGrid->Set_Name(pImport->Get_Name());
 
+				m_pGrids->Add_Item(pGrid);
 
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
+				n++;
+			}
+		}
+	}
+
+	return( n > 0 );
+}
 
-//---------------------------------------------------------
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
diff --git a/src/modules/grid/grid_spline/Gridding_Spline_CSA.h b/src/modules/io/io_grid/import_clip_resample.h
similarity index 81%
copy from src/modules/grid/grid_spline/Gridding_Spline_CSA.h
copy to src/modules/io/io_grid/import_clip_resample.h
index 067fcdc..dd5b4f5 100644
--- a/src/modules/grid/grid_spline/Gridding_Spline_CSA.h
+++ b/src/modules/io/io_grid/import_clip_resample.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Gridding_Spline_CSA.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: import_clip_resample.h 1380 2012-04-26 12:02:19Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -9,13 +9,13 @@
 //      System for Automated Geoscientific Analyses      //
 //                                                       //
 //                    Module Library:                    //
-//                     grid_spline                       //
+//                     climate_tools                     //
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//                 Gridding_Spline_CSA.h                 //
+//                 import_clip_resample.h                //
 //                                                       //
-//                 Copyright (C) 2008 by                 //
+//                 Copyright (C) 2015 by                 //
 //                      Olaf Conrad                      //
 //                                                       //
 //-------------------------------------------------------//
@@ -44,9 +44,7 @@
 //                                                       //
 //    contact:    Olaf Conrad                            //
 //                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
+//                University of Hamburg                  //
 //                Germany                                //
 //                                                       //
 ///////////////////////////////////////////////////////////
@@ -61,11 +59,11 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#ifndef HEADER_INCLUDED__Gridding_Spline_CSA_H
-#define HEADER_INCLUDED__Gridding_Spline_CSA_H
+#ifndef HEADER_INCLUDED__import_clip_resample_H
+#define HEADER_INCLUDED__import_clip_resample_H
 
 //---------------------------------------------------------
-#include "Gridding_Spline_Base.h"
+#include "MLB_Interface.h"
 
 
 ///////////////////////////////////////////////////////////
@@ -75,23 +73,27 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-class CGridding_Spline_CSA : public CGridding_Spline_Base
+class CImport_Clip_Resample : public CSG_Module
 {
 public:
-	CGridding_Spline_CSA(void);
+	CImport_Clip_Resample(void);
 
+	virtual CSG_String			Get_MenuPath(void)		{	return( _TL("R:Import") );	}
 
-protected:
 
-	virtual bool			On_Execute		(void);
+protected:
 
-	virtual bool			On_Initialise	(void);
+	virtual bool				On_Execute				(void);
 
 
 private:
 
-	CSG_Points_Z			m_Points;
+	CSG_Grid_System				m_System;
+
+	CSG_Parameter_Grid_List		*m_pGrids;
+
 
+	bool						Load_File				(const CSG_String &File);
 
 };
 
@@ -103,4 +105,4 @@ private:
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED__Gridding_Spline_CSA_H
+#endif // #ifndef HEADER_INCLUDED__import_clip_resample_H
diff --git a/src/modules/io/io_grid/raw.cpp b/src/modules/io/io_grid/raw.cpp
index 6647538..72b4730 100644
--- a/src/modules/io/io_grid/raw.cpp
+++ b/src/modules/io/io_grid/raw.cpp
@@ -302,7 +302,7 @@ CSG_Grid * CRaw_Import::Load_Data(FILE *Stream, TSG_Data_Type data_type, int nx,
 		if( !feof(Stream) )
 		{
 			pGrid			= SG_Create_Grid(data_type, nx, ny, dxy, xmin, ymin);
-			nBytes_Value	= SG_Data_Type_Get_Size(data_type);
+			nBytes_Value	= (int)SG_Data_Type_Get_Size(data_type);
 			nBytes_Line		= nBytes_Value * nx;
 			pLine			= (char *)SG_Malloc(nBytes_Line);
 
diff --git a/src/modules/io/io_grid/wrf.cpp b/src/modules/io/io_grid/wrf.cpp
index 5d5a1ee..48707ea 100644
--- a/src/modules/io/io_grid/wrf.cpp
+++ b/src/modules/io/io_grid/wrf.cpp
@@ -913,8 +913,8 @@ bool CWRF_Export::On_Execute(void)
 
 	if( m_Index.m_TILE_Z == 1 )
 	{
-		m_Index.m_CATEGORY_MIN	= m_Index.m_TYPE == VAL_CATEGORICAL ? pGrids->asGrid(0)->Get_ZMin() : 0;
-		m_Index.m_CATEGORY_MAX	= m_Index.m_TYPE == VAL_CATEGORICAL ? pGrids->asGrid(0)->Get_ZMax() : 0;
+		m_Index.m_CATEGORY_MIN	= m_Index.m_TYPE == VAL_CATEGORICAL ? (int)pGrids->asGrid(0)->Get_ZMin() : 0;
+		m_Index.m_CATEGORY_MAX	= m_Index.m_TYPE == VAL_CATEGORICAL ? (int)pGrids->asGrid(0)->Get_ZMax() : 0;
 	}
 	else
 	{
diff --git a/src/modules/io/io_grid_grib2/Makefile.in b/src/modules/io/io_grid_grib2/Makefile.in
index 0740b26..d191797 100644
--- a/src/modules/io/io_grid_grib2/Makefile.in
+++ b/src/modules/io/io_grid_grib2/Makefile.in
@@ -127,17 +127,30 @@ am__installdirs = "$(DESTDIR)$(pkglibdir)"
 LTLIBRARIES = $(pkglib_LTLIBRARIES)
 libio_grid_grib2_la_DEPENDENCIES =  \
 	$(top_srcdir)/src/saga_core/saga_api/libsaga_api.la
-am_libio_grid_grib2_la_OBJECTS = cmplxpack.lo compack.lo comunpack.lo \
-	dec_jpeg2000.lo dec_png.lo drstemplates.lo enc_jpeg2000.lo \
-	enc_png.lo g2_addfield.lo g2_addgrid.lo g2_addlocal.lo \
-	g2_create.lo g2_free.lo g2_getfld.lo g2_gribend.lo g2_info.lo \
-	g2_miss.lo g2_unpack1.lo g2_unpack2.lo g2_unpack3.lo \
-	g2_unpack4.lo g2_unpack5.lo g2_unpack6.lo g2_unpack7.lo \
-	gbits.lo getdim.lo getpoly.lo gridtemplates.lo int_power.lo \
-	jpcpack.lo jpcunpack.lo misspack.lo mkieee.lo pack_gp.lo \
-	pdstemplates.lo pngpack.lo pngunpack.lo rdieee.lo reduce.lo \
-	seekgb.lo simpack.lo simunpack.lo specpack.lo specunpack.lo \
-	grib2_import.lo MLB_Interface.lo
+am__dirstamp = $(am__leading_dot)dirstamp
+am_libio_grid_grib2_la_OBJECTS = ./g2clib-1.0.4/cmplxpack.lo \
+	./g2clib-1.0.4/compack.lo ./g2clib-1.0.4/comunpack.lo \
+	./g2clib-1.0.4/dec_jpeg2000.lo ./g2clib-1.0.4/dec_png.lo \
+	./g2clib-1.0.4/drstemplates.lo ./g2clib-1.0.4/enc_jpeg2000.lo \
+	./g2clib-1.0.4/enc_png.lo ./g2clib-1.0.4/g2_addfield.lo \
+	./g2clib-1.0.4/g2_addgrid.lo ./g2clib-1.0.4/g2_addlocal.lo \
+	./g2clib-1.0.4/g2_create.lo ./g2clib-1.0.4/g2_free.lo \
+	./g2clib-1.0.4/g2_getfld.lo ./g2clib-1.0.4/g2_gribend.lo \
+	./g2clib-1.0.4/g2_info.lo ./g2clib-1.0.4/g2_miss.lo \
+	./g2clib-1.0.4/g2_unpack1.lo ./g2clib-1.0.4/g2_unpack2.lo \
+	./g2clib-1.0.4/g2_unpack3.lo ./g2clib-1.0.4/g2_unpack4.lo \
+	./g2clib-1.0.4/g2_unpack5.lo ./g2clib-1.0.4/g2_unpack6.lo \
+	./g2clib-1.0.4/g2_unpack7.lo ./g2clib-1.0.4/gbits.lo \
+	./g2clib-1.0.4/getdim.lo ./g2clib-1.0.4/getpoly.lo \
+	./g2clib-1.0.4/gridtemplates.lo ./g2clib-1.0.4/int_power.lo \
+	./g2clib-1.0.4/jpcpack.lo ./g2clib-1.0.4/jpcunpack.lo \
+	./g2clib-1.0.4/misspack.lo ./g2clib-1.0.4/mkieee.lo \
+	./g2clib-1.0.4/pack_gp.lo ./g2clib-1.0.4/pdstemplates.lo \
+	./g2clib-1.0.4/pngpack.lo ./g2clib-1.0.4/pngunpack.lo \
+	./g2clib-1.0.4/rdieee.lo ./g2clib-1.0.4/reduce.lo \
+	./g2clib-1.0.4/seekgb.lo ./g2clib-1.0.4/simpack.lo \
+	./g2clib-1.0.4/simunpack.lo ./g2clib-1.0.4/specpack.lo \
+	./g2clib-1.0.4/specunpack.lo grib2_import.lo MLB_Interface.lo
 libio_grid_grib2_la_OBJECTS = $(am_libio_grid_grib2_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
@@ -505,409 +518,203 @@ clean-pkglibLTLIBRARIES:
 	  echo rm -f $${locs}; \
 	  rm -f $${locs}; \
 	}
+g2clib-1.0.4/$(am__dirstamp):
+	@$(MKDIR_P) ./g2clib-1.0.4
+	@: > g2clib-1.0.4/$(am__dirstamp)
+g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp):
+	@$(MKDIR_P) ./g2clib-1.0.4/$(DEPDIR)
+	@: > g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/cmplxpack.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/compack.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/comunpack.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/dec_jpeg2000.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/dec_png.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/drstemplates.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/enc_jpeg2000.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/enc_png.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/g2_addfield.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/g2_addgrid.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/g2_addlocal.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/g2_create.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/g2_free.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/g2_getfld.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/g2_gribend.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/g2_info.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/g2_miss.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/g2_unpack1.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/g2_unpack2.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/g2_unpack3.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/g2_unpack4.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/g2_unpack5.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/g2_unpack6.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/g2_unpack7.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/gbits.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/getdim.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/getpoly.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/gridtemplates.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/int_power.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/jpcpack.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/jpcunpack.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/misspack.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/mkieee.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/pack_gp.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/pdstemplates.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/pngpack.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/pngunpack.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/rdieee.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/reduce.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/seekgb.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/simpack.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/simunpack.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/specpack.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+./g2clib-1.0.4/specunpack.lo: g2clib-1.0.4/$(am__dirstamp) \
+	g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
 
 libio_grid_grib2.la: $(libio_grid_grib2_la_OBJECTS) $(libio_grid_grib2_la_DEPENDENCIES) $(EXTRA_libio_grid_grib2_la_DEPENDENCIES) 
 	$(AM_V_CXXLD)$(CXXLINK) -rpath $(pkglibdir) $(libio_grid_grib2_la_OBJECTS) $(libio_grid_grib2_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
+	-rm -f ./g2clib-1.0.4/*.$(OBJEXT)
+	-rm -f ./g2clib-1.0.4/*.lo
 
 distclean-compile:
 	-rm -f *.tab.c
 
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MLB_Interface.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cmplxpack.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/compack.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/comunpack.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dec_jpeg2000.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dec_png.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/drstemplates.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/enc_jpeg2000.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/enc_png.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/g2_addfield.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/g2_addgrid.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/g2_addlocal.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/g2_create.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/g2_free.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/g2_getfld.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/g2_gribend.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/g2_info.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/g2_miss.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/g2_unpack1.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/g2_unpack2.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/g2_unpack3.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/g2_unpack4.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/g2_unpack5.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/g2_unpack6.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/g2_unpack7.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gbits.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/getdim.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/getpoly.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/grib2_import.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gridtemplates.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/int_power.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/jpcpack.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/jpcunpack.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/misspack.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mkieee.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pack_gp.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pdstemplates.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pngpack.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pngunpack.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rdieee.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/reduce.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seekgb.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/simpack.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/simunpack.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/specpack.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/specunpack.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/cmplxpack.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/compack.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/comunpack.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/dec_jpeg2000.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/dec_png.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/drstemplates.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/enc_jpeg2000.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/enc_png.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/g2_addfield.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/g2_addgrid.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/g2_addlocal.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/g2_create.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/g2_free.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/g2_getfld.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/g2_gribend.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/g2_info.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/g2_miss.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/g2_unpack1.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/g2_unpack2.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/g2_unpack3.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/g2_unpack4.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/g2_unpack5.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/g2_unpack6.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/g2_unpack7.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/gbits.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/getdim.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/getpoly.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/gridtemplates.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/int_power.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/jpcpack.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/jpcunpack.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/misspack.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/mkieee.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/pack_gp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/pdstemplates.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/pngpack.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/pngunpack.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/rdieee.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/reduce.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/seekgb.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/simpack.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/simunpack.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/specpack.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./g2clib-1.0.4/$(DEPDIR)/specunpack.Plo at am__quote@
 
 .c.o:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(COMPILE) -c -o $@ $<
 
 .c.obj:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .c.lo:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LTCOMPILE) -c -o $@ $<
 
-cmplxpack.lo: ./g2clib-1.0.4/cmplxpack.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cmplxpack.lo -MD -MP -MF $(DEPDIR)/cmplxpack.Tpo -c -o cmplxpack.lo `test -f './g2clib-1.0.4/cmplxpack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/cmplxpack.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/cmplxpack.Tpo $(DEPDIR)/cmplxpack.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/cmplxpack.c' object='cmplxpack.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cmplxpack.lo `test -f './g2clib-1.0.4/cmplxpack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/cmplxpack.c
-
-compack.lo: ./g2clib-1.0.4/compack.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT compack.lo -MD -MP -MF $(DEPDIR)/compack.Tpo -c -o compack.lo `test -f './g2clib-1.0.4/compack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/compack.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/compack.Tpo $(DEPDIR)/compack.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/compack.c' object='compack.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o compack.lo `test -f './g2clib-1.0.4/compack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/compack.c
-
-comunpack.lo: ./g2clib-1.0.4/comunpack.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT comunpack.lo -MD -MP -MF $(DEPDIR)/comunpack.Tpo -c -o comunpack.lo `test -f './g2clib-1.0.4/comunpack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/comunpack.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/comunpack.Tpo $(DEPDIR)/comunpack.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/comunpack.c' object='comunpack.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o comunpack.lo `test -f './g2clib-1.0.4/comunpack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/comunpack.c
-
-dec_jpeg2000.lo: ./g2clib-1.0.4/dec_jpeg2000.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dec_jpeg2000.lo -MD -MP -MF $(DEPDIR)/dec_jpeg2000.Tpo -c -o dec_jpeg2000.lo `test -f './g2clib-1.0.4/dec_jpeg2000.c' || echo '$(srcdir)/'`./g2clib-1.0.4/dec_jpeg2000.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/dec_jpeg2000.Tpo $(DEPDIR)/dec_jpeg2000.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/dec_jpeg2000.c' object='dec_jpeg2000.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dec_jpeg2000.lo `test -f './g2clib-1.0.4/dec_jpeg2000.c' || echo '$(srcdir)/'`./g2clib-1.0.4/dec_jpeg2000.c
-
-dec_png.lo: ./g2clib-1.0.4/dec_png.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dec_png.lo -MD -MP -MF $(DEPDIR)/dec_png.Tpo -c -o dec_png.lo `test -f './g2clib-1.0.4/dec_png.c' || echo '$(srcdir)/'`./g2clib-1.0.4/dec_png.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/dec_png.Tpo $(DEPDIR)/dec_png.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/dec_png.c' object='dec_png.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dec_png.lo `test -f './g2clib-1.0.4/dec_png.c' || echo '$(srcdir)/'`./g2clib-1.0.4/dec_png.c
-
-drstemplates.lo: ./g2clib-1.0.4/drstemplates.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT drstemplates.lo -MD -MP -MF $(DEPDIR)/drstemplates.Tpo -c -o drstemplates.lo `test -f './g2clib-1.0.4/drstemplates.c' || echo '$(srcdir)/'`./g2clib-1.0.4/drstemplates.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/drstemplates.Tpo $(DEPDIR)/drstemplates.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/drstemplates.c' object='drstemplates.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o drstemplates.lo `test -f './g2clib-1.0.4/drstemplates.c' || echo '$(srcdir)/'`./g2clib-1.0.4/drstemplates.c
-
-enc_jpeg2000.lo: ./g2clib-1.0.4/enc_jpeg2000.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT enc_jpeg2000.lo -MD -MP -MF $(DEPDIR)/enc_jpeg2000.Tpo -c -o enc_jpeg2000.lo `test -f './g2clib-1.0.4/enc_jpeg2000.c' || echo '$(srcdir)/'`./g2clib-1.0.4/enc_jpeg2000.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/enc_jpeg2000.Tpo $(DEPDIR)/enc_jpeg2000.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/enc_jpeg2000.c' object='enc_jpeg2000.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o enc_jpeg2000.lo `test -f './g2clib-1.0.4/enc_jpeg2000.c' || echo '$(srcdir)/'`./g2clib-1.0.4/enc_jpeg2000.c
-
-enc_png.lo: ./g2clib-1.0.4/enc_png.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT enc_png.lo -MD -MP -MF $(DEPDIR)/enc_png.Tpo -c -o enc_png.lo `test -f './g2clib-1.0.4/enc_png.c' || echo '$(srcdir)/'`./g2clib-1.0.4/enc_png.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/enc_png.Tpo $(DEPDIR)/enc_png.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/enc_png.c' object='enc_png.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o enc_png.lo `test -f './g2clib-1.0.4/enc_png.c' || echo '$(srcdir)/'`./g2clib-1.0.4/enc_png.c
-
-g2_addfield.lo: ./g2clib-1.0.4/g2_addfield.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT g2_addfield.lo -MD -MP -MF $(DEPDIR)/g2_addfield.Tpo -c -o g2_addfield.lo `test -f './g2clib-1.0.4/g2_addfield.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_addfield.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/g2_addfield.Tpo $(DEPDIR)/g2_addfield.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/g2_addfield.c' object='g2_addfield.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o g2_addfield.lo `test -f './g2clib-1.0.4/g2_addfield.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_addfield.c
-
-g2_addgrid.lo: ./g2clib-1.0.4/g2_addgrid.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT g2_addgrid.lo -MD -MP -MF $(DEPDIR)/g2_addgrid.Tpo -c -o g2_addgrid.lo `test -f './g2clib-1.0.4/g2_addgrid.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_addgrid.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/g2_addgrid.Tpo $(DEPDIR)/g2_addgrid.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/g2_addgrid.c' object='g2_addgrid.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o g2_addgrid.lo `test -f './g2clib-1.0.4/g2_addgrid.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_addgrid.c
-
-g2_addlocal.lo: ./g2clib-1.0.4/g2_addlocal.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT g2_addlocal.lo -MD -MP -MF $(DEPDIR)/g2_addlocal.Tpo -c -o g2_addlocal.lo `test -f './g2clib-1.0.4/g2_addlocal.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_addlocal.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/g2_addlocal.Tpo $(DEPDIR)/g2_addlocal.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/g2_addlocal.c' object='g2_addlocal.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o g2_addlocal.lo `test -f './g2clib-1.0.4/g2_addlocal.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_addlocal.c
-
-g2_create.lo: ./g2clib-1.0.4/g2_create.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT g2_create.lo -MD -MP -MF $(DEPDIR)/g2_create.Tpo -c -o g2_create.lo `test -f './g2clib-1.0.4/g2_create.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_create.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/g2_create.Tpo $(DEPDIR)/g2_create.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/g2_create.c' object='g2_create.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o g2_create.lo `test -f './g2clib-1.0.4/g2_create.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_create.c
-
-g2_free.lo: ./g2clib-1.0.4/g2_free.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT g2_free.lo -MD -MP -MF $(DEPDIR)/g2_free.Tpo -c -o g2_free.lo `test -f './g2clib-1.0.4/g2_free.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_free.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/g2_free.Tpo $(DEPDIR)/g2_free.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/g2_free.c' object='g2_free.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o g2_free.lo `test -f './g2clib-1.0.4/g2_free.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_free.c
-
-g2_getfld.lo: ./g2clib-1.0.4/g2_getfld.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT g2_getfld.lo -MD -MP -MF $(DEPDIR)/g2_getfld.Tpo -c -o g2_getfld.lo `test -f './g2clib-1.0.4/g2_getfld.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_getfld.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/g2_getfld.Tpo $(DEPDIR)/g2_getfld.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/g2_getfld.c' object='g2_getfld.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o g2_getfld.lo `test -f './g2clib-1.0.4/g2_getfld.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_getfld.c
-
-g2_gribend.lo: ./g2clib-1.0.4/g2_gribend.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT g2_gribend.lo -MD -MP -MF $(DEPDIR)/g2_gribend.Tpo -c -o g2_gribend.lo `test -f './g2clib-1.0.4/g2_gribend.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_gribend.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/g2_gribend.Tpo $(DEPDIR)/g2_gribend.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/g2_gribend.c' object='g2_gribend.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o g2_gribend.lo `test -f './g2clib-1.0.4/g2_gribend.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_gribend.c
-
-g2_info.lo: ./g2clib-1.0.4/g2_info.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT g2_info.lo -MD -MP -MF $(DEPDIR)/g2_info.Tpo -c -o g2_info.lo `test -f './g2clib-1.0.4/g2_info.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_info.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/g2_info.Tpo $(DEPDIR)/g2_info.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/g2_info.c' object='g2_info.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o g2_info.lo `test -f './g2clib-1.0.4/g2_info.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_info.c
-
-g2_miss.lo: ./g2clib-1.0.4/g2_miss.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT g2_miss.lo -MD -MP -MF $(DEPDIR)/g2_miss.Tpo -c -o g2_miss.lo `test -f './g2clib-1.0.4/g2_miss.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_miss.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/g2_miss.Tpo $(DEPDIR)/g2_miss.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/g2_miss.c' object='g2_miss.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o g2_miss.lo `test -f './g2clib-1.0.4/g2_miss.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_miss.c
-
-g2_unpack1.lo: ./g2clib-1.0.4/g2_unpack1.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT g2_unpack1.lo -MD -MP -MF $(DEPDIR)/g2_unpack1.Tpo -c -o g2_unpack1.lo `test -f './g2clib-1.0.4/g2_unpack1.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_unpack1.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/g2_unpack1.Tpo $(DEPDIR)/g2_unpack1.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/g2_unpack1.c' object='g2_unpack1.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o g2_unpack1.lo `test -f './g2clib-1.0.4/g2_unpack1.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_unpack1.c
-
-g2_unpack2.lo: ./g2clib-1.0.4/g2_unpack2.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT g2_unpack2.lo -MD -MP -MF $(DEPDIR)/g2_unpack2.Tpo -c -o g2_unpack2.lo `test -f './g2clib-1.0.4/g2_unpack2.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_unpack2.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/g2_unpack2.Tpo $(DEPDIR)/g2_unpack2.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/g2_unpack2.c' object='g2_unpack2.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o g2_unpack2.lo `test -f './g2clib-1.0.4/g2_unpack2.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_unpack2.c
-
-g2_unpack3.lo: ./g2clib-1.0.4/g2_unpack3.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT g2_unpack3.lo -MD -MP -MF $(DEPDIR)/g2_unpack3.Tpo -c -o g2_unpack3.lo `test -f './g2clib-1.0.4/g2_unpack3.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_unpack3.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/g2_unpack3.Tpo $(DEPDIR)/g2_unpack3.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/g2_unpack3.c' object='g2_unpack3.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o g2_unpack3.lo `test -f './g2clib-1.0.4/g2_unpack3.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_unpack3.c
-
-g2_unpack4.lo: ./g2clib-1.0.4/g2_unpack4.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT g2_unpack4.lo -MD -MP -MF $(DEPDIR)/g2_unpack4.Tpo -c -o g2_unpack4.lo `test -f './g2clib-1.0.4/g2_unpack4.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_unpack4.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/g2_unpack4.Tpo $(DEPDIR)/g2_unpack4.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/g2_unpack4.c' object='g2_unpack4.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o g2_unpack4.lo `test -f './g2clib-1.0.4/g2_unpack4.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_unpack4.c
-
-g2_unpack5.lo: ./g2clib-1.0.4/g2_unpack5.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT g2_unpack5.lo -MD -MP -MF $(DEPDIR)/g2_unpack5.Tpo -c -o g2_unpack5.lo `test -f './g2clib-1.0.4/g2_unpack5.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_unpack5.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/g2_unpack5.Tpo $(DEPDIR)/g2_unpack5.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/g2_unpack5.c' object='g2_unpack5.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o g2_unpack5.lo `test -f './g2clib-1.0.4/g2_unpack5.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_unpack5.c
-
-g2_unpack6.lo: ./g2clib-1.0.4/g2_unpack6.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT g2_unpack6.lo -MD -MP -MF $(DEPDIR)/g2_unpack6.Tpo -c -o g2_unpack6.lo `test -f './g2clib-1.0.4/g2_unpack6.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_unpack6.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/g2_unpack6.Tpo $(DEPDIR)/g2_unpack6.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/g2_unpack6.c' object='g2_unpack6.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o g2_unpack6.lo `test -f './g2clib-1.0.4/g2_unpack6.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_unpack6.c
-
-g2_unpack7.lo: ./g2clib-1.0.4/g2_unpack7.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT g2_unpack7.lo -MD -MP -MF $(DEPDIR)/g2_unpack7.Tpo -c -o g2_unpack7.lo `test -f './g2clib-1.0.4/g2_unpack7.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_unpack7.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/g2_unpack7.Tpo $(DEPDIR)/g2_unpack7.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/g2_unpack7.c' object='g2_unpack7.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o g2_unpack7.lo `test -f './g2clib-1.0.4/g2_unpack7.c' || echo '$(srcdir)/'`./g2clib-1.0.4/g2_unpack7.c
-
-gbits.lo: ./g2clib-1.0.4/gbits.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gbits.lo -MD -MP -MF $(DEPDIR)/gbits.Tpo -c -o gbits.lo `test -f './g2clib-1.0.4/gbits.c' || echo '$(srcdir)/'`./g2clib-1.0.4/gbits.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/gbits.Tpo $(DEPDIR)/gbits.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/gbits.c' object='gbits.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gbits.lo `test -f './g2clib-1.0.4/gbits.c' || echo '$(srcdir)/'`./g2clib-1.0.4/gbits.c
-
-getdim.lo: ./g2clib-1.0.4/getdim.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT getdim.lo -MD -MP -MF $(DEPDIR)/getdim.Tpo -c -o getdim.lo `test -f './g2clib-1.0.4/getdim.c' || echo '$(srcdir)/'`./g2clib-1.0.4/getdim.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/getdim.Tpo $(DEPDIR)/getdim.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/getdim.c' object='getdim.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o getdim.lo `test -f './g2clib-1.0.4/getdim.c' || echo '$(srcdir)/'`./g2clib-1.0.4/getdim.c
-
-getpoly.lo: ./g2clib-1.0.4/getpoly.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT getpoly.lo -MD -MP -MF $(DEPDIR)/getpoly.Tpo -c -o getpoly.lo `test -f './g2clib-1.0.4/getpoly.c' || echo '$(srcdir)/'`./g2clib-1.0.4/getpoly.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/getpoly.Tpo $(DEPDIR)/getpoly.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/getpoly.c' object='getpoly.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o getpoly.lo `test -f './g2clib-1.0.4/getpoly.c' || echo '$(srcdir)/'`./g2clib-1.0.4/getpoly.c
-
-gridtemplates.lo: ./g2clib-1.0.4/gridtemplates.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gridtemplates.lo -MD -MP -MF $(DEPDIR)/gridtemplates.Tpo -c -o gridtemplates.lo `test -f './g2clib-1.0.4/gridtemplates.c' || echo '$(srcdir)/'`./g2clib-1.0.4/gridtemplates.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/gridtemplates.Tpo $(DEPDIR)/gridtemplates.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/gridtemplates.c' object='gridtemplates.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gridtemplates.lo `test -f './g2clib-1.0.4/gridtemplates.c' || echo '$(srcdir)/'`./g2clib-1.0.4/gridtemplates.c
-
-int_power.lo: ./g2clib-1.0.4/int_power.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT int_power.lo -MD -MP -MF $(DEPDIR)/int_power.Tpo -c -o int_power.lo `test -f './g2clib-1.0.4/int_power.c' || echo '$(srcdir)/'`./g2clib-1.0.4/int_power.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/int_power.Tpo $(DEPDIR)/int_power.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/int_power.c' object='int_power.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o int_power.lo `test -f './g2clib-1.0.4/int_power.c' || echo '$(srcdir)/'`./g2clib-1.0.4/int_power.c
-
-jpcpack.lo: ./g2clib-1.0.4/jpcpack.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT jpcpack.lo -MD -MP -MF $(DEPDIR)/jpcpack.Tpo -c -o jpcpack.lo `test -f './g2clib-1.0.4/jpcpack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/jpcpack.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/jpcpack.Tpo $(DEPDIR)/jpcpack.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/jpcpack.c' object='jpcpack.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o jpcpack.lo `test -f './g2clib-1.0.4/jpcpack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/jpcpack.c
-
-jpcunpack.lo: ./g2clib-1.0.4/jpcunpack.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT jpcunpack.lo -MD -MP -MF $(DEPDIR)/jpcunpack.Tpo -c -o jpcunpack.lo `test -f './g2clib-1.0.4/jpcunpack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/jpcunpack.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/jpcunpack.Tpo $(DEPDIR)/jpcunpack.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/jpcunpack.c' object='jpcunpack.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o jpcunpack.lo `test -f './g2clib-1.0.4/jpcunpack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/jpcunpack.c
-
-misspack.lo: ./g2clib-1.0.4/misspack.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT misspack.lo -MD -MP -MF $(DEPDIR)/misspack.Tpo -c -o misspack.lo `test -f './g2clib-1.0.4/misspack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/misspack.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/misspack.Tpo $(DEPDIR)/misspack.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/misspack.c' object='misspack.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o misspack.lo `test -f './g2clib-1.0.4/misspack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/misspack.c
-
-mkieee.lo: ./g2clib-1.0.4/mkieee.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mkieee.lo -MD -MP -MF $(DEPDIR)/mkieee.Tpo -c -o mkieee.lo `test -f './g2clib-1.0.4/mkieee.c' || echo '$(srcdir)/'`./g2clib-1.0.4/mkieee.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/mkieee.Tpo $(DEPDIR)/mkieee.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/mkieee.c' object='mkieee.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mkieee.lo `test -f './g2clib-1.0.4/mkieee.c' || echo '$(srcdir)/'`./g2clib-1.0.4/mkieee.c
-
-pack_gp.lo: ./g2clib-1.0.4/pack_gp.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pack_gp.lo -MD -MP -MF $(DEPDIR)/pack_gp.Tpo -c -o pack_gp.lo `test -f './g2clib-1.0.4/pack_gp.c' || echo '$(srcdir)/'`./g2clib-1.0.4/pack_gp.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/pack_gp.Tpo $(DEPDIR)/pack_gp.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/pack_gp.c' object='pack_gp.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pack_gp.lo `test -f './g2clib-1.0.4/pack_gp.c' || echo '$(srcdir)/'`./g2clib-1.0.4/pack_gp.c
-
-pdstemplates.lo: ./g2clib-1.0.4/pdstemplates.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pdstemplates.lo -MD -MP -MF $(DEPDIR)/pdstemplates.Tpo -c -o pdstemplates.lo `test -f './g2clib-1.0.4/pdstemplates.c' || echo '$(srcdir)/'`./g2clib-1.0.4/pdstemplates.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/pdstemplates.Tpo $(DEPDIR)/pdstemplates.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/pdstemplates.c' object='pdstemplates.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pdstemplates.lo `test -f './g2clib-1.0.4/pdstemplates.c' || echo '$(srcdir)/'`./g2clib-1.0.4/pdstemplates.c
-
-pngpack.lo: ./g2clib-1.0.4/pngpack.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pngpack.lo -MD -MP -MF $(DEPDIR)/pngpack.Tpo -c -o pngpack.lo `test -f './g2clib-1.0.4/pngpack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/pngpack.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/pngpack.Tpo $(DEPDIR)/pngpack.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/pngpack.c' object='pngpack.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pngpack.lo `test -f './g2clib-1.0.4/pngpack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/pngpack.c
-
-pngunpack.lo: ./g2clib-1.0.4/pngunpack.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pngunpack.lo -MD -MP -MF $(DEPDIR)/pngunpack.Tpo -c -o pngunpack.lo `test -f './g2clib-1.0.4/pngunpack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/pngunpack.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/pngunpack.Tpo $(DEPDIR)/pngunpack.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/pngunpack.c' object='pngunpack.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pngunpack.lo `test -f './g2clib-1.0.4/pngunpack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/pngunpack.c
-
-rdieee.lo: ./g2clib-1.0.4/rdieee.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rdieee.lo -MD -MP -MF $(DEPDIR)/rdieee.Tpo -c -o rdieee.lo `test -f './g2clib-1.0.4/rdieee.c' || echo '$(srcdir)/'`./g2clib-1.0.4/rdieee.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/rdieee.Tpo $(DEPDIR)/rdieee.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/rdieee.c' object='rdieee.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rdieee.lo `test -f './g2clib-1.0.4/rdieee.c' || echo '$(srcdir)/'`./g2clib-1.0.4/rdieee.c
-
-reduce.lo: ./g2clib-1.0.4/reduce.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT reduce.lo -MD -MP -MF $(DEPDIR)/reduce.Tpo -c -o reduce.lo `test -f './g2clib-1.0.4/reduce.c' || echo '$(srcdir)/'`./g2clib-1.0.4/reduce.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/reduce.Tpo $(DEPDIR)/reduce.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/reduce.c' object='reduce.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o reduce.lo `test -f './g2clib-1.0.4/reduce.c' || echo '$(srcdir)/'`./g2clib-1.0.4/reduce.c
-
-seekgb.lo: ./g2clib-1.0.4/seekgb.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT seekgb.lo -MD -MP -MF $(DEPDIR)/seekgb.Tpo -c -o seekgb.lo `test -f './g2clib-1.0.4/seekgb.c' || echo '$(srcdir)/'`./g2clib-1.0.4/seekgb.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/seekgb.Tpo $(DEPDIR)/seekgb.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/seekgb.c' object='seekgb.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o seekgb.lo `test -f './g2clib-1.0.4/seekgb.c' || echo '$(srcdir)/'`./g2clib-1.0.4/seekgb.c
-
-simpack.lo: ./g2clib-1.0.4/simpack.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT simpack.lo -MD -MP -MF $(DEPDIR)/simpack.Tpo -c -o simpack.lo `test -f './g2clib-1.0.4/simpack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/simpack.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/simpack.Tpo $(DEPDIR)/simpack.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/simpack.c' object='simpack.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o simpack.lo `test -f './g2clib-1.0.4/simpack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/simpack.c
-
-simunpack.lo: ./g2clib-1.0.4/simunpack.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT simunpack.lo -MD -MP -MF $(DEPDIR)/simunpack.Tpo -c -o simunpack.lo `test -f './g2clib-1.0.4/simunpack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/simunpack.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/simunpack.Tpo $(DEPDIR)/simunpack.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/simunpack.c' object='simunpack.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o simunpack.lo `test -f './g2clib-1.0.4/simunpack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/simunpack.c
-
-specpack.lo: ./g2clib-1.0.4/specpack.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT specpack.lo -MD -MP -MF $(DEPDIR)/specpack.Tpo -c -o specpack.lo `test -f './g2clib-1.0.4/specpack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/specpack.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/specpack.Tpo $(DEPDIR)/specpack.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/specpack.c' object='specpack.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o specpack.lo `test -f './g2clib-1.0.4/specpack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/specpack.c
-
-specunpack.lo: ./g2clib-1.0.4/specunpack.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT specunpack.lo -MD -MP -MF $(DEPDIR)/specunpack.Tpo -c -o specunpack.lo `test -f './g2clib-1.0.4/specunpack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/specunpack.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/specunpack.Tpo $(DEPDIR)/specunpack.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='./g2clib-1.0.4/specunpack.c' object='specunpack.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o specunpack.lo `test -f './g2clib-1.0.4/specunpack.c' || echo '$(srcdir)/'`./g2clib-1.0.4/specunpack.c
-
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
@@ -917,6 +724,7 @@ mostlyclean-libtool:
 
 clean-libtool:
 	-rm -rf .libs _libs
+	-rm -rf ./g2clib-1.0.4/.libs ./g2clib-1.0.4/_libs
 
 ID: $(am__tagged_files)
 	$(am__define_uniq_tagged_files); mkid -fID $$unique
@@ -1033,6 +841,8 @@ clean-generic:
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-rm -f g2clib-1.0.4/$(DEPDIR)/$(am__dirstamp)
+	-rm -f g2clib-1.0.4/$(am__dirstamp)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -1043,7 +853,7 @@ clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
 	mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+	-rm -rf ./$(DEPDIR) ./g2clib-1.0.4/$(DEPDIR)
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -1089,7 +899,7 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+	-rm -rf ./$(DEPDIR) ./g2clib-1.0.4/$(DEPDIR)
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
diff --git a/src/modules/io/io_grid_image/Makefile.in b/src/modules/io/io_grid_image/Makefile.in
index b471347..3516f4f 100644
--- a/src/modules/io/io_grid_image/Makefile.in
+++ b/src/modules/io/io_grid_image/Makefile.in
@@ -466,22 +466,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/grid_to_kml.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/io/io_grid_image/grid_export.cpp b/src/modules/io/io_grid_image/grid_export.cpp
index 56e0e27..4c6e216 100644
--- a/src/modules/io/io_grid_image/grid_export.cpp
+++ b/src/modules/io/io_grid_image/grid_export.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: grid_export.cpp 2321 2014-11-03 21:10:22Z johanvdw $
+ * Version $Id: grid_export.cpp 2533 2015-07-02 11:47:01Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -81,10 +81,9 @@ CGrid_Export::CGrid_Export(void)
 	Set_Author		(SG_T("O.Conrad (c) 2005"));
 
 	Set_Description	(_TW(
-		"The module allows to save a grid as image.\n\n"
-		"On the command line, in case a shade grid is specified, "
-		"it's minimum and maximum brightness values can be specified in "
-		"percent.\n")
+		"The module allows one to save a grid as image.\n"
+		"Optionally, a shade grid can be overlayed and it's "
+		"transparency and brightness can be adjusted.\n\n")
 	);
 
 	Parameters.Add_Grid(
@@ -102,12 +101,12 @@ CGrid_Export::CGrid_Export(void)
 	Parameters.Add_FilePath(
 		NULL	, "FILE"		, _TL("Image File"),
 		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|%s|%s|%s|%s|%s|%s|%s|%s"),
-			_TL("Windows or OS/2 Bitmap (*.bmp)")				, SG_T("*.bmp"),
-			_TL("JPEG - JFIF Compliant (*.jpg, *.jif, *.jpeg)")	, SG_T("*.jpg;*.jif;*.jpeg"),
-			_TL("Zsoft Paintbrush (*.pcx)")						, SG_T("*.pcx"),
+		CSG_String::Format("%s|%s|%s|%s|%s|%s|%s|%s|%s|%s",
 			_TL("Portable Network Graphics (*.png)")			, SG_T("*.png"),
-			_TL("Tagged Image File Format (*.tif, *.tiff)")		, SG_T("*.tif;*.tiff")
+			_TL("JPEG - JFIF Compliant (*.jpg, *.jif, *.jpeg)")	, SG_T("*.jpg;*.jif;*.jpeg"),
+			_TL("Tagged Image File Format (*.tif, *.tiff)")		, SG_T("*.tif;*.tiff"),
+			_TL("Windows or OS/2 Bitmap (*.bmp)")				, SG_T("*.bmp"),
+			_TL("Zsoft Paintbrush (*.pcx)")						, SG_T("*.pcx")
 		), NULL, true
 	);
 
@@ -196,14 +195,17 @@ CGrid_Export::CGrid_Export(void)
 		PARAMETER_INPUT_OPTIONAL
 	);
 
-	if( !SG_UI_Get_Window_Main() )
-	{
-		Parameters.Add_Range(
-			NULL	, "SHADE_BRIGHT", _TL("Shade Brightness"),
-			_TL("Allows one to scale shade brightness [percent]"),
-			0.0, 100.0, 0.0, true, 100.0, true
-		);
-	}
+	Parameters.Add_Value(
+		NULL	, "SHADE_TRANS"	, _TL("Shade Transparency [%]"),
+		_TL("The transparency of the shade [%]"),
+		PARAMETER_TYPE_Double, 40.0, 0.0, true, 100.0, true
+	);
+
+	Parameters.Add_Range(
+		NULL	, "SHADE_BRIGHT", _TL("Shade Brightness [%]"),
+		_TL("Allows one to scale shade brightness [%]"),
+		0.0, 100.0, 0.0, true, 100.0, true
+	);
 }
 
 
@@ -224,6 +226,12 @@ int CGrid_Export::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Paramete
 		pParameters->Get_Parameter("LUT"        )->Set_Enabled(pParameter->asInt() == 3);
 	}
 
+	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("SHADE")) )
+	{
+		pParameters->Get_Parameter("SHADE_TRANS"	)->Set_Enabled(pParameter->asGrid() != NULL);
+		pParameters->Get_Parameter("SHADE_BRIGHT"	)->Set_Enabled(pParameter->asGrid() != NULL);
+	}
+
 	return( 1 );
 }
 
@@ -239,12 +247,14 @@ bool CGrid_Export::On_Execute(void)
 {
 	//-----------------------------------------------------
 	int			y, iy, Method;
+	double		dTrans;
 	CSG_Grid	*pGrid, *pShade, Grid, Shade;
 
 	//-----------------------------------------------------
-	pGrid	= Parameters("GRID"     )->asGrid();
-	pShade	= Parameters("SHADE"    )->asGrid();
-	Method	= Parameters("COLOURING")->asInt ();
+	pGrid		= Parameters("GRID"			)->asGrid();
+	pShade		= Parameters("SHADE"		)->asGrid();
+	Method		= Parameters("COLOURING"	)->asInt ();
+	dTrans		= Parameters("SHADE_TRANS"	)->asDouble() / 100.0;
 
 	if( !pGrid )
 	{
@@ -376,7 +386,7 @@ bool CGrid_Export::On_Execute(void)
 	{
 		pShade	= NULL;
 	}
-	else if( !SG_UI_DataObject_asImage(pShade, &Shade) )
+	else
 	{
 		double	dMinBright, dMaxBright;
 
@@ -426,7 +436,7 @@ bool CGrid_Export::On_Execute(void)
 		#pragma omp parallel for
 		for(int x=0; x<Get_NX(); x++)
 		{
-			if( Grid.is_NoData(x, y) )
+			if( Grid.is_NoData(x, y) || (pShade != NULL && Shade.is_NoData(x, y)) )
 			{
 				if( Image.HasAlpha() )
 				{
@@ -452,11 +462,9 @@ bool CGrid_Export::On_Execute(void)
 				{
 					c	= Shade.asInt(x, y);
 
-					double d	= (SG_GET_R(c) + SG_GET_G(c) + SG_GET_B(c)) / (3.0 * 255.0);
-
-					r	= (int)(d * r);
-					g	= (int)(d * g);
-					b	= (int)(d * b);
+					r	= dTrans * r + SG_GET_R(c) * (1.0 - dTrans);
+					g	= dTrans * g + SG_GET_G(c) * (1.0 - dTrans);
+					b	= dTrans * b + SG_GET_B(c) * (1.0 - dTrans);
 				}
 
 				Image.SetRGB(x, y, r, g, b);
@@ -474,6 +482,8 @@ bool CGrid_Export::On_Execute(void)
 	&&  !SG_File_Cmp_Extension(fName, SG_T("tif")) )
 	{
 		fName	= SG_File_Make_Path(NULL, fName, SG_T("png"));
+
+		Parameters("FILE")->Set_Value(fName);
 	}
 
 	//-----------------------------------------------------
@@ -481,7 +491,7 @@ bool CGrid_Export::On_Execute(void)
 
 	if( !SG_UI_Get_Window_Main() )
 	{
-		if( SG_File_Cmp_Extension(fName, SG_T("jpg")) )
+		if(      SG_File_Cmp_Extension(fName, SG_T("jpg")) )
 			pImgHandler = new wxJPEGHandler;
 		else if( SG_File_Cmp_Extension(fName, SG_T("pcx")) )
 			pImgHandler = new wxPCXHandler;
diff --git a/src/modules/io/io_grid_image/grid_to_kml.cpp b/src/modules/io/io_grid_image/grid_to_kml.cpp
index 73537ba..8ce9429 100644
--- a/src/modules/io/io_grid_image/grid_to_kml.cpp
+++ b/src/modules/io/io_grid_image/grid_to_kml.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: grid_to_kml.cpp 2177 2014-06-30 13:45:37Z oconrad $
+ * Version $Id: grid_to_kml.cpp 2533 2015-07-02 11:47:01Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -59,6 +59,11 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
+#include <wx/wfstream.h>
+#include <wx/zipstrm.h>
+#include <wx/dir.h>
+
+//---------------------------------------------------------
 #include "grid_to_kml.h"
 
 
@@ -95,21 +100,31 @@ CGrid_to_KML::CGrid_to_KML(void)
 	Parameters.Add_FilePath(
 		NULL	, "FILE"		, _TL("Image File"),
 		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|%s|%s|%s|%s|%s|%s|%s|%s"),
-			_TL("Windows or OS/2 Bitmap (*.bmp)")				, SG_T("*.bmp"),
-			_TL("JPEG - JFIF Compliant (*.jpg, *.jif, *.jpeg)")	, SG_T("*.jpg;*.jif;*.jpeg"),
-			_TL("Zsoft Paintbrush (*.pcx)")						, SG_T("*.pcx"),
+		CSG_String::Format("%s|%s|%s|%s|%s|%s|%s|%s|%s|%s",
 			_TL("Portable Network Graphics (*.png)")			, SG_T("*.png"),
-			_TL("Tagged Image File Format (*.tif, *.tiff)")		, SG_T("*.tif;*.tiff")
+			_TL("JPEG - JFIF Compliant (*.jpg, *.jif, *.jpeg)")	, SG_T("*.jpg;*.jif;*.jpeg"),
+			_TL("Tagged Image File Format (*.tif, *.tiff)")		, SG_T("*.tif;*.tiff"),
+			_TL("Windows or OS/2 Bitmap (*.bmp)")				, SG_T("*.bmp"),
+			_TL("Zsoft Paintbrush (*.pcx)")						, SG_T("*.pcx")
 		), NULL, true
 	);
 
+	Parameters.Add_Choice(
+		NULL	, "OUTPUT"		, _TL("Output"),
+		_TL(""),
+		CSG_String::Format("%s|%s|%s|",
+			_TL("kml and image files"),
+			_TL("kmz, kml and image files"),
+			_TL("kmz file")
+		), 2
+	);
+
 	if( SG_UI_Get_Window_Main() )
 	{
 		Parameters.Add_Choice(
 			NULL	, "COLOURING"	, _TL("Colouring"),
 			_TL(""),
-			CSG_String::Format(SG_T("%s|%s|%s|%s|%s|%s|"),
+			CSG_String::Format("%s|%s|%s|%s|%s|%s|",
 				_TL("stretch to grid's standard deviation"),
 				_TL("stretch to grid's value range"),
 				_TL("stretch to specified value range"),
@@ -129,7 +144,7 @@ CGrid_to_KML::CGrid_to_KML(void)
 		Parameters.Add_Choice(
 			NULL	, "COLOURING"	, _TL("Colouring"),
 			_TL(""),
-			CSG_String::Format(SG_T("%s|%s|%s|%s|%s|"),
+			CSG_String::Format("%s|%s|%s|%s|%s|",
 				_TL("stretch to grid's standard deviation"),
 				_TL("stretch to grid's value range"),
 				_TL("stretch to specified value range"),
@@ -141,7 +156,7 @@ CGrid_to_KML::CGrid_to_KML(void)
 		Parameters.Add_Choice(
 			NULL	, "COL_PALETTE"	, _TL("Color Palette"),
 			_TL(""),
-			CSG_String::Format(SG_T("%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|"),
+			CSG_String::Format("%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|",
 				_TL("DEFAULT"),			_TL("DEFAULT_BRIGHT"),	_TL("BLACK_WHITE"),		_TL("BLACK_RED"),
 				_TL("BLACK_GREEN"),		_TL("BLACK_BLUE"),		_TL("WHITE_RED"),		_TL("WHITE_GREEN"),
 				_TL("WHITE_BLUE"),		_TL("YELLOW_RED"),		_TL("YELLOW_GREEN"),	_TL("YELLOW_BLUE"),
@@ -202,8 +217,6 @@ CGrid_to_KML::CGrid_to_KML(void)
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
@@ -235,8 +248,6 @@ int CGrid_to_KML::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Paramete
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
@@ -245,11 +256,10 @@ bool CGrid_to_KML::On_Execute(void)
 	//-----------------------------------------------------
 	bool	bDelete	= false;
 
-	CSG_Parameters	P;
 	CSG_Module		*pModule;
 
-	CSG_Grid	Grid , *pGrid	= Parameters("GRID" )->asGrid(), Image;
-	CSG_Grid	Shade, *pShade	= Parameters("SHADE")->asGrid();
+	CSG_Grid	*pGrid	= Parameters("GRID" )->asGrid(), Image;
+	CSG_Grid	*pShade	= Parameters("SHADE")->asGrid();
 
 	//-----------------------------------------------------
 	int	Method	= Parameters("COLOURING")->asInt();
@@ -275,31 +285,27 @@ bool CGrid_to_KML::On_Execute(void)
 	}
 	else if( pGrid->Get_Projection().Get_Type() != SG_PROJ_TYPE_CS_Geographic )
 	{
-		Message_Add(CSG_String::Format(SG_T("\n%s (%s: %s)\n"), _TL("re-projection to geographic coordinates"), _TL("original"), pGrid->Get_Projection().Get_Name().c_str()), false);
+		Message_Add(CSG_String::Format("\n%s (%s: %s)\n", _TL("re-projection to geographic coordinates"), _TL("original"), pGrid->Get_Projection().Get_Name().c_str()), false);
 
-		if(	(pModule = SG_Get_Module_Library_Manager().Get_Module(SG_T("pj_proj4"), 4)) == NULL )	// Coordinate Transformation (Grid)
+		if(	(pModule = SG_Get_Module_Library_Manager().Get_Module("pj_proj4", 4)) == NULL )	// Coordinate Transformation (Grid)
 		{
 			return( false );
 		}
 
-		P.Assign(pModule->Get_Parameters());
+		pModule->Settings_Push();
 
-		pModule->Set_Manager(NULL);
-
-		if( pModule->Get_Parameters()->Set_Parameter("CRS_PROJ4"    , SG_T("+proj=longlat +ellps=WGS84 +datum=WGS84"))
-		&&  pModule->Get_Parameters()->Set_Parameter("INTERPOLATION", Parameters("INTERPOL")->asBool() ? 4 : 0)
-		&&  pModule->Get_Parameters()->Set_Parameter("SOURCE"       , pGrid)
+		if( pModule->Set_Parameter("CRS_PROJ4"    , SG_T("+proj=longlat +ellps=WGS84 +datum=WGS84"))
+		&&  pModule->Set_Parameter("INTERPOLATION", Parameters("INTERPOL")->asBool() ? 4 : 0)
+		&&  pModule->Set_Parameter("SOURCE"       , pGrid)
 		&&  pModule->Execute() )
 		{
 			bDelete	= true;
 
-			pGrid	= pModule->Get_Parameters("GET_USER")->Get_Parameter("GRID")->asGrid();
+			pGrid	= pModule->Get_Parameters("TARGET")->Get_Parameter("GRID")->asGrid();
 
-			if( pShade
-			&&  pModule->Get_Parameters()->Set_Parameter("SOURCE", pShade)
-			&&  pModule->Execute() )
+			if( pShade && pModule->Set_Parameter("SOURCE", pShade) && pModule->Execute() )
 			{
-				pShade	= pModule->Get_Parameters("GET_USER")->Get_Parameter("GRID")->asGrid();
+				pShade	= pModule->Get_Parameters("TARGET")->Get_Parameter("GRID")->asGrid();
 			}
 			else
 			{
@@ -307,48 +313,44 @@ bool CGrid_to_KML::On_Execute(void)
 			}
 		}
 
-		pModule->Get_Parameters()->Assign_Values(&P);
-		pModule->Set_Manager(P.Get_Manager());
+		pModule->Settings_Pop();
 
 		if( !bDelete )
 		{
-			Message_Add(CSG_String::Format(SG_T("\n%s: %s\n"), _TL("re-projection"), _TL("failed")), false);
+			Message_Add(CSG_String::Format("\n%s: %s\n", _TL("re-projection"), _TL("failed")), false);
 
 			return( false );
 		}
 	}
 
 	//-----------------------------------------------------
-	if(	(pModule = SG_Get_Module_Library_Manager().Get_Module(SG_T("io_grid_image"), 0)) == NULL )	// Export Image
+	if(	(pModule = SG_Get_Module_Library_Manager().Get_Module("io_grid_image", 0)) == NULL )	// Export Image
 	{
 		return( false );
 	}
 
-	P.Assign(pModule->Get_Parameters());
-
-	pModule->Set_Manager(NULL);
-
 	bool	bResult	= false;
 
-	if( pModule->Get_Parameters()->Set_Parameter("GRID"        , pGrid)
-	&&  pModule->Get_Parameters()->Set_Parameter("SHADE"       , pShade)
-	&&  pModule->Get_Parameters()->Set_Parameter("FILE_KML"    , true)
-	&&  pModule->Get_Parameters()->Set_Parameter("FILE"        , Parameters("FILE"))
-	&&  pModule->Get_Parameters()->Set_Parameter("COLOURING"   , Method)
-	&&  pModule->Get_Parameters()->Set_Parameter("COL_PALETTE" , Parameters("COL_PALETTE"))
-	&&  pModule->Get_Parameters()->Set_Parameter("STDDEV"      , Parameters("STDDEV"))
-	&&  pModule->Get_Parameters()->Set_Parameter("STRETCH"     , Parameters("STRETCH"))
-	&&  pModule->Get_Parameters()->Set_Parameter("LUT"         , Parameters("LUT"))
-	&&  (SG_UI_Get_Window_Main() || pModule->Get_Parameters()->Set_Parameter("SHADE_BRIGHT", Parameters("SHADE_BRIGHT")))
+	pModule->Settings_Push();
+
+	if( pModule->Set_Parameter("GRID"        , pGrid)
+	&&  pModule->Set_Parameter("SHADE"       , pShade)
+	&&  pModule->Set_Parameter("FILE_KML"    , true)
+	&&  pModule->Set_Parameter("FILE"        , Parameters("FILE"))
+	&&  pModule->Set_Parameter("COLOURING"   , Method)
+	&&  pModule->Set_Parameter("COL_PALETTE" , Parameters("COL_PALETTE"))
+	&&  pModule->Set_Parameter("STDDEV"      , Parameters("STDDEV"))
+	&&  pModule->Set_Parameter("STRETCH"     , Parameters("STRETCH"))
+	&&  pModule->Set_Parameter("LUT"         , Parameters("LUT"))
+	&&  (SG_UI_Get_Window_Main() || pModule->Set_Parameter("SHADE_BRIGHT", Parameters("SHADE_BRIGHT")))
 	&&  pModule->Execute() )
 	{
 		bResult	= true;
 	}
 
-	//-----------------------------------------------------
-	pModule->Get_Parameters()->Assign_Values(&P);
-	pModule->Set_Manager(P.Get_Manager());
+	pModule->Settings_Pop();
 
+	//-----------------------------------------------------
 	if( bDelete )
 	{
 		delete(pGrid);
@@ -359,6 +361,58 @@ bool CGrid_to_KML::On_Execute(void)
 		}
 	}
 
+//---------------------------------------------------------
+#define ZIP_ADD_FILE(zip, fn)	{\
+	wxFileInputStream	*pInput;\
+	\
+	if( SG_File_Exists(fn) && (pInput = new wxFileInputStream(fn)) != NULL )\
+	{\
+		zip.PutNextEntry(SG_File_Get_Name(fn, true).c_str());\
+		zip.Write(*pInput);\
+		delete(pInput);\
+	}\
+}
+//---------------------------------------------------------
+
+	if( Parameters("OUTPUT")->asInt() != 0 )	// create kmz
+	{
+		CSG_String	Filename	= Parameters("FILE")->asString();	SG_File_Set_Extension(Filename, "kmz");
+		
+		wxDir		dir;
+		wxString	file;
+
+		//-------------------------------------------------
+		if( dir.Open(SG_File_Get_Path(Filename).c_str()) && dir.GetFirst(&file, wxString::Format("%s.*", SG_File_Get_Name(Filename, false).c_str()), wxDIR_FILES) )
+		{
+			CSG_Strings	Files;
+
+			do
+			{
+				if( !SG_File_Cmp_Extension(file, SG_T("kmz")) )
+				{
+					Files	+= SG_File_Make_Path(SG_File_Get_Path(Filename), file);
+				}
+			}
+			while( dir.GetNext(&file) );
+
+			dir.Close();
+
+			//---------------------------------------------
+			wxZipOutputStream	Zip(new wxFileOutputStream(Filename.c_str()));
+
+			for(int i=0; i<Files.Get_Count(); i++)
+			{
+				ZIP_ADD_FILE(Zip, Files[i].c_str());
+
+				if( Parameters("OUTPUT")->asInt() != 1 )	// delete kml, image and associated files
+				{
+					SG_File_Delete(Files[i]);
+				}
+			}
+		}
+	}
+
+	//-----------------------------------------------------
 	return( bResult );
 }
 
diff --git a/src/modules/io/io_shapes/Makefile.in b/src/modules/io/io_shapes/Makefile.in
index 4cd36a7..1cfb348 100644
--- a/src/modules/io/io_shapes/Makefile.in
+++ b/src/modules/io/io_shapes/Makefile.in
@@ -503,22 +503,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xyz.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/io/io_shapes_dxf/Makefile.in b/src/modules/io/io_shapes_dxf/Makefile.in
index ceaa043..8da6b94 100644
--- a/src/modules/io/io_shapes_dxf/Makefile.in
+++ b/src/modules/io/io_shapes_dxf/Makefile.in
@@ -127,8 +127,9 @@ am__installdirs = "$(DESTDIR)$(pkglibdir)"
 LTLIBRARIES = $(pkglib_LTLIBRARIES)
 libio_shapes_dxf_la_DEPENDENCIES =  \
 	$(top_srcdir)/src/saga_core/saga_api/libsaga_api.la
+am__dirstamp = $(am__leading_dot)dirstamp
 am_libio_shapes_dxf_la_OBJECTS = dxf_import.lo MLB_Interface.lo \
-	dl_dxf.lo dl_writer_ascii.lo
+	./dxflib/dl_dxf.lo ./dxflib/dl_writer_ascii.lo
 libio_shapes_dxf_la_OBJECTS = $(am_libio_shapes_dxf_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
@@ -459,61 +460,63 @@ clean-pkglibLTLIBRARIES:
 	  echo rm -f $${locs}; \
 	  rm -f $${locs}; \
 	}
+dxflib/$(am__dirstamp):
+	@$(MKDIR_P) ./dxflib
+	@: > dxflib/$(am__dirstamp)
+dxflib/$(DEPDIR)/$(am__dirstamp):
+	@$(MKDIR_P) ./dxflib/$(DEPDIR)
+	@: > dxflib/$(DEPDIR)/$(am__dirstamp)
+./dxflib/dl_dxf.lo: dxflib/$(am__dirstamp) \
+	dxflib/$(DEPDIR)/$(am__dirstamp)
+./dxflib/dl_writer_ascii.lo: dxflib/$(am__dirstamp) \
+	dxflib/$(DEPDIR)/$(am__dirstamp)
 
 libio_shapes_dxf.la: $(libio_shapes_dxf_la_OBJECTS) $(libio_shapes_dxf_la_DEPENDENCIES) $(EXTRA_libio_shapes_dxf_la_DEPENDENCIES) 
 	$(AM_V_CXXLD)$(CXXLINK) -rpath $(pkglibdir) $(libio_shapes_dxf_la_OBJECTS) $(libio_shapes_dxf_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
+	-rm -f ./dxflib/*.$(OBJEXT)
+	-rm -f ./dxflib/*.lo
 
 distclean-compile:
 	-rm -f *.tab.c
 
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MLB_Interface.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dl_dxf.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dl_writer_ascii.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dxf_import.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./dxflib/$(DEPDIR)/dl_dxf.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./dxflib/$(DEPDIR)/dl_writer_ascii.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
 
-dl_dxf.lo: ./dxflib/dl_dxf.cpp
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT dl_dxf.lo -MD -MP -MF $(DEPDIR)/dl_dxf.Tpo -c -o dl_dxf.lo `test -f './dxflib/dl_dxf.cpp' || echo '$(srcdir)/'`./dxflib/dl_dxf.cpp
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/dl_dxf.Tpo $(DEPDIR)/dl_dxf.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='./dxflib/dl_dxf.cpp' object='dl_dxf.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dl_dxf.lo `test -f './dxflib/dl_dxf.cpp' || echo '$(srcdir)/'`./dxflib/dl_dxf.cpp
-
-dl_writer_ascii.lo: ./dxflib/dl_writer_ascii.cpp
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT dl_writer_ascii.lo -MD -MP -MF $(DEPDIR)/dl_writer_ascii.Tpo -c -o dl_writer_ascii.lo `test -f './dxflib/dl_writer_ascii.cpp' || echo '$(srcdir)/'`./dxflib/dl_writer_ascii.cpp
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/dl_writer_ascii.Tpo $(DEPDIR)/dl_writer_ascii.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='./dxflib/dl_writer_ascii.cpp' object='dl_writer_ascii.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dl_writer_ascii.lo `test -f './dxflib/dl_writer_ascii.cpp' || echo '$(srcdir)/'`./dxflib/dl_writer_ascii.cpp
-
 mostlyclean-libtool:
 	-rm -f *.lo
 
 clean-libtool:
 	-rm -rf .libs _libs
+	-rm -rf ./dxflib/.libs ./dxflib/_libs
 
 ID: $(am__tagged_files)
 	$(am__define_uniq_tagged_files); mkid -fID $$unique
@@ -630,6 +633,8 @@ clean-generic:
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-rm -f dxflib/$(DEPDIR)/$(am__dirstamp)
+	-rm -f dxflib/$(am__dirstamp)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -640,7 +645,7 @@ clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
 	mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+	-rm -rf ./$(DEPDIR) ./dxflib/$(DEPDIR)
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -686,7 +691,7 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+	-rm -rf ./$(DEPDIR) ./dxflib/$(DEPDIR)
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
diff --git a/src/modules/io/io_shapes_las/Makefile.in b/src/modules/io/io_shapes_las/Makefile.in
index a8ef8d6..9e39c71 100644
--- a/src/modules/io/io_shapes_las/Makefile.in
+++ b/src/modules/io/io_shapes_las/Makefile.in
@@ -471,22 +471,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/las_info.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/io/io_shapes_las/las_export.cpp b/src/modules/io/io_shapes_las/las_export.cpp
index fe14650..580f524 100644
--- a/src/modules/io/io_shapes_las/las_export.cpp
+++ b/src/modules/io/io_shapes_las/las_export.cpp
@@ -67,6 +67,7 @@
 #include <liblas/capi/las_version.h>
 #include <fstream>
 #include <iostream>
+#include <cstddef>
 
 
 //---------------------------------------------------------
diff --git a/src/modules/io/io_table/Makefile.in b/src/modules/io/io_table/Makefile.in
index ae974ba..79e2fc8 100644
--- a/src/modules/io/io_table/Makefile.in
+++ b/src/modules/io/io_table/Makefile.in
@@ -460,22 +460,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/io_table_txt.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/io/io_table/io_table_txt.cpp b/src/modules/io/io_table/io_table_txt.cpp
index 010e7f8..ee7a4e9 100644
--- a/src/modules/io/io_table/io_table_txt.cpp
+++ b/src/modules/io/io_table/io_table_txt.cpp
@@ -234,7 +234,7 @@ CTable_Text_Import::CTable_Text_Import(void)
 	//-----------------------------------------------------
 	Set_Name		(_TL("Import Text Table"));
 
-	Set_Author		(SG_T("O. Conrad (c) 2008"));
+	Set_Author		("O. Conrad (c) 2008");
 
 	Set_Description	(_TW(
 		""
@@ -285,36 +285,29 @@ CTable_Text_Import::CTable_Text_Import(void)
 //---------------------------------------------------------
 bool CTable_Text_Import::On_Execute(void)
 {
-	bool		bHeader;
-	CSG_String	Separator;
-	CSG_Table	*pTable;
-
 	//-----------------------------------------------------
-	pTable	= Parameters("TABLE")		->asTable();
-	bHeader	= Parameters("HEADLINE")	->asBool();
+	CSG_Table	*pTable	= Parameters("TABLE")->asTable();
+
+	CSG_String	Separator;
 
 	switch( Parameters("SEPARATOR")->asInt() )
 	{
-	case 0:		Separator	= "\t";	break;
-	case 1:		Separator	=  ";";	break;
-	case 2:		Separator	=  ",";	break;
-	case 3:		Separator	=  " ";	break;
+	case  0:	Separator	= "\t";	break;
+	case  1:	Separator	=  ";";	break;
+	case  2:	Separator	=  ",";	break;
+	case  3:	Separator	=  " ";	break;
 	default:	Separator	= Parameters("SEP_OTHER")->asString();	break;
 	}
 
 	//-----------------------------------------------------
-	if( !pTable->Create(Parameters("FILENAME")->asString(), bHeader ? TABLE_FILETYPE_Text : TABLE_FILETYPE_Text_NoHeadLine, Separator) )
+	if( !pTable->Create(Parameters("FILENAME")->asString(), Parameters("HEADLINE")->asBool() ? TABLE_FILETYPE_Text : TABLE_FILETYPE_Text_NoHeadLine, Separator) )
 	{
-		Message_Add(_TL("table could not be opened."));
-	}
+		Error_Set(_TL("table could not be opened."));
 
-	//-----------------------------------------------------
-	else
-	{
-		return( true );
+		return( false );
 	}
 
-	return( false );
+	return( true );
 }
 
 
@@ -327,9 +320,12 @@ bool CTable_Text_Import::On_Execute(void)
 //---------------------------------------------------------
 CTable_Text_Import_Numbers::CTable_Text_Import_Numbers(void)
 {
+	CSG_Parameter	*pNode;
+
+	//-----------------------------------------------------
 	Set_Name		(_TL("Import Text Table with Numbers only"));
 
-	Set_Author		(SG_T("O. Conrad (c) 2008"));
+	Set_Author		("O. Conrad (c) 2008");
 
 	Set_Description	(_TW(
 		""
@@ -343,24 +339,31 @@ CTable_Text_Import_Numbers::CTable_Text_Import_Numbers(void)
 	);
 
 	Parameters.Add_Value(
-		NULL	, "HEADLINE"	, _TL("File contains headline"),
+		NULL	, "SKIP"		, _TL("Skip Lines"),
 		_TL(""),
-		PARAMETER_TYPE_Bool		, false
+		PARAMETER_TYPE_Int, 0, 0, true
 	);
 
-	Parameters.Add_Choice(
+	Parameters.Add_Value(
+		NULL	, "HEADLINE"	, _TL("Headline"),
+		_TL(""),
+		PARAMETER_TYPE_Bool, false
+	);
+
+	pNode	= Parameters.Add_Choice(
 		NULL	, "SEPARATOR"	, _TL("Separator"),
 		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|%s|%s|"),
+		CSG_String::Format(SG_T("%s|%s|%s|%s|%s|"),
 			_TL("tabulator"),
-			_TL(";"),
-			_TL(","),
+			SG_T(";"),
+			SG_T(","),
+			_TL("space"),
 			_TL("other")
 		), 0
 	);
 
 	Parameters.Add_String(
-		NULL	, "SEP_OTHER"	, _TL("Separator (other)"),
+		pNode	, "SEP_OTHER"	, _TL("other"),
 		_TL(""),
 		SG_T("*")
 	);
@@ -379,89 +382,116 @@ CTable_Text_Import_Numbers::CTable_Text_Import_Numbers(void)
 //---------------------------------------------------------
 bool CTable_Text_Import_Numbers::On_Execute(void)
 {
-	bool		bHeader;
-	double		Value;
-	CSG_String	sLine, sHead, Separator;
+	CSG_String	sHead, sLine, Separator;
 	CSG_File	Stream;
-	CSG_Table	*pTable;
 
 	//-----------------------------------------------------
-	pTable	= Parameters("TABLE")		->asTable();
-	bHeader	= Parameters("HEADLINE")	->asBool();
+	if( !Stream.Open(Parameters("FILENAME")->asString(), SG_FILE_R, false) )
+	{
+		Error_Set(_TL("file could not be opened"));
 
-	switch( Parameters("SEPARATOR")->asInt() )
+		return( false );
+	}
+
+	if( Parameters("SKIP")->asInt() > 0 )
 	{
-	case 0:		Separator	= "\t";	break;
-	case 1:		Separator	=  ";";	break;
-	case 2:		Separator	=  ",";	break;
-	default:	Separator	= Parameters("SEP_OTHER")->asString();	break;
+		int	i	= Parameters("SKIP")->asInt();
+		
+		while( i > 0 && Stream.Read_Line(sLine) )	{ i--; }
 	}
 
-	//-----------------------------------------------------
-	if( !Stream.Open(Parameters("FILENAME")->asString(), SG_FILE_R, false) )
+	if( !Stream.Read_Line(sHead) || sHead.Length() == 0 )
 	{
-		Message_Add(_TL("file could not be opened"));
+		Error_Set(_TL("empty or corrupted file"));
+
+		return( false );
 	}
 
+	if( !Parameters("HEADLINE")->asBool() )
+	{
+		sLine	= sHead;
+	}
 	else if( !Stream.Read_Line(sLine) || sLine.Length() == 0 )
 	{
-		Message_Add(_TL("empty or corrupted file"));
+		Error_Set(_TL("empty or corrupted file"));
+
+		return( false );
 	}
 
-	else if( bHeader && (!Stream.Read_Line(sLine) || sLine.Length() == 0) )
+	//-----------------------------------------------------
+	switch( Parameters("SEPARATOR")->asInt() )
 	{
-		Message_Add(_TL("empty or corrupted file"));
+	case  0:	Separator	= "\t";	break;
+	case  1:	Separator	=  ";";	break;
+	case  2:	Separator	=  ",";	break;
+	case  3:	Separator	=  " ";	break;
+	default:	Separator	= Parameters("SEP_OTHER")->asString();	break;
 	}
 
 	//-----------------------------------------------------
-	else
-	{
-		pTable->Destroy();
-		pTable->Set_Name(SG_File_Get_Name(Parameters("FILENAME")->asString(), false));
+	CSG_Table	*pTable	= Parameters("TABLE")->asTable();
 
-		sLine.Replace(Separator, SG_T("\t"));
-		sHead	= sLine;
+	pTable->Destroy();
+	pTable->Set_Name(SG_File_Get_Name(Parameters("FILENAME")->asString(), false));
 
-		do
-		{
-			sHead.Trim();
+	sHead.Trim(true);
+	sHead.Replace(Separator, "\t");
 
-			if( sHead.asDouble(Value) )
-			{
-				pTable->Add_Field(CSG_String::Format(SG_T("%d"), 1 + pTable->Get_Field_Count()), SG_DATATYPE_Double);
-			}
+	while( sHead.Length() > 0 )
+	{
+		sHead.Trim();
 
-			sHead	= sHead.AfterFirst('\t');
+		if( Parameters("HEADLINE")->asBool() )
+		{
+			pTable->Add_Field(sHead.BeforeFirst('\t'), SG_DATATYPE_Double);
 		}
-		while( sHead.Length() > 0 );
-
-		//-------------------------------------------------
-		if( pTable->Get_Field_Count() > 0 )
+		else
 		{
-			int		fLength	= Stream.Length();
+			pTable->Add_Field(CSG_String::Format("FIELD%02d", 1 + pTable->Get_Field_Count()), SG_DATATYPE_Double);
+		}
 
-			do
-			{
-				sLine.Replace(Separator, SG_T("\t"));
+		sHead	= sHead.AfterFirst('\t');
+	}
 
-				CSG_Table_Record	*pRecord	= pTable->Add_Record();
+	if( pTable->Get_Field_Count() <= 0 )
+	{
+		Error_Set(_TL("empty or corrupted file"));
 
-				for(int i=0; i<pTable->Get_Field_Count(); i++)
-				{
-					sLine.Trim();
+		return( false );
+	}
 
-					pRecord->Set_Value(i, sLine.asDouble());
+	//-----------------------------------------------------
+	int		fLength	= Stream.Length();
 
-					sLine	= sLine.AfterFirst('\t');
-				}
+	bool	bOkay	= true;
+
+	do
+	{
+		sLine.Replace(Separator, "\t");
+
+		CSG_Table_Record	*pRecord	= pTable->Add_Record();
+
+		for(int i=0; bOkay && i<pTable->Get_Field_Count(); i++)
+		{
+			double	Value;
+
+			sLine.Trim();
+
+			if( (bOkay = sLine.asDouble(Value)) == true )
+			{
+				pRecord->Set_Value(i, Value);
+
+				sLine	= sLine.AfterFirst('\t');
+			}
+			else
+			{
+				pTable->Del_Record(pTable->Get_Count() - 1);
 			}
-			while( Stream.Read_Line(sLine) && sLine.Length() > 0 && Set_Progress(Stream.Tell(), fLength) );
 		}
-
-		return( true );
 	}
+	while( bOkay && Stream.Read_Line(sLine) && Set_Progress(Stream.Tell(), fLength) );
 
-	return( false );
+	return( pTable->Get_Count() > 0 );
 }
 
 
diff --git a/src/modules/io/io_virtual/MLB_Interface.cpp b/src/modules/io/io_virtual/MLB_Interface.cpp
index 916e786..ae1eb99 100644
--- a/src/modules/io/io_virtual/MLB_Interface.cpp
+++ b/src/modules/io/io_virtual/MLB_Interface.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: MLB_Interface.cpp 2281 2014-10-09 15:49:41Z oconrad $
+ * Version $Id: MLB_Interface.cpp 2359 2014-12-27 12:46:46Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -101,6 +101,7 @@ CSG_String Get_Info(int i)
 #include "pc_get_subset_spcvf.h"
 #include "pc_tileshape_from_spcvf.h"
 #include "pc_get_grid_spcvf.h"
+#include "pc_remove_overlap_from_spcvf.h"
 
 
 //---------------------------------------------------------
@@ -116,6 +117,7 @@ CSG_Module *		Create_Module(int i)
 	case 3:		return( new CPointCloud_Get_Subset_SPCVF_Interactive );
 	case 4:		return( new CPointCloud_Get_Grid_SPCVF );
 	case 5:		return( new CPointCloud_Get_Grid_SPCVF_Interactive );
+	case 6:		return( new CPointCloud_Remove_Overlap_From_SPCVF );
 	}
 
 	return( NULL );
diff --git a/src/modules/io/io_virtual/Makefile.am b/src/modules/io/io_virtual/Makefile.am
index 106d1b3..e59a56a 100644
--- a/src/modules/io/io_virtual/Makefile.am
+++ b/src/modules/io/io_virtual/Makefile.am
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.am 2269 2014-10-02 13:33:04Z reklov_w $
+# $Id: Makefile.am 2359 2014-12-27 12:46:46Z reklov_w $
 #
 if DEBUG
 DBGFLAGS = -g -DDEBUG
@@ -23,10 +23,12 @@ pc_tileshape_from_spcvf.cpp\
 pc_create_spcvf.cpp\
 pc_get_grid_spcvf.cpp\
 pc_get_subset_spcvf.cpp\
+pc_remove_overlap_from_spcvf.cpp\
 MLB_Interface.h\
 pc_tileshape_from_spcvf.h\
 pc_create_spcvf.h\
 pc_get_grid_spcvf.h\
-pc_get_subset_spcvf.h
+pc_get_subset_spcvf.h\
+pc_remove_overlap_from_spcvf.h
 
 libio_virtual_la_LIBADD = $(top_srcdir)/src/saga_core/saga_api/libsaga_api.la $(ADD_MLBS)
diff --git a/src/modules/io/io_virtual/Makefile.in b/src/modules/io/io_virtual/Makefile.in
index 2a9f97c..a1b2438 100644
--- a/src/modules/io/io_virtual/Makefile.in
+++ b/src/modules/io/io_virtual/Makefile.in
@@ -129,7 +129,8 @@ libio_virtual_la_DEPENDENCIES =  \
 	$(top_srcdir)/src/saga_core/saga_api/libsaga_api.la
 am_libio_virtual_la_OBJECTS = MLB_Interface.lo \
 	pc_tileshape_from_spcvf.lo pc_create_spcvf.lo \
-	pc_get_grid_spcvf.lo pc_get_subset_spcvf.lo
+	pc_get_grid_spcvf.lo pc_get_subset_spcvf.lo \
+	pc_remove_overlap_from_spcvf.lo
 libio_virtual_la_OBJECTS = $(am_libio_virtual_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
@@ -363,7 +364,7 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
 #
-# $Id: Makefile.am 2269 2014-10-02 13:33:04Z reklov_w $
+# $Id: Makefile.am 2359 2014-12-27 12:46:46Z reklov_w $
 #
 @DEBUG_TRUE at DBGFLAGS = -g -DDEBUG
 @SAGA_UNICODE_FALSE at DEP_DEFS = -fPIC `wx-config --unicode=no --static=no --cxxflags` $(DBGFLAGS)
@@ -382,11 +383,13 @@ pc_tileshape_from_spcvf.cpp\
 pc_create_spcvf.cpp\
 pc_get_grid_spcvf.cpp\
 pc_get_subset_spcvf.cpp\
+pc_remove_overlap_from_spcvf.cpp\
 MLB_Interface.h\
 pc_tileshape_from_spcvf.h\
 pc_create_spcvf.h\
 pc_get_grid_spcvf.h\
-pc_get_subset_spcvf.h
+pc_get_subset_spcvf.h\
+pc_remove_overlap_from_spcvf.h
 
 libio_virtual_la_LIBADD = $(top_srcdir)/src/saga_core/saga_api/libsaga_api.la $(ADD_MLBS)
 all: all-am
@@ -472,25 +475,29 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pc_create_spcvf.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pc_get_grid_spcvf.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pc_get_subset_spcvf.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pc_remove_overlap_from_spcvf.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pc_tileshape_from_spcvf.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/io/io_virtual/pc_create_spcvf.cpp b/src/modules/io/io_virtual/pc_create_spcvf.cpp
index e862c55..31aecd4 100644
--- a/src/modules/io/io_virtual/pc_create_spcvf.cpp
+++ b/src/modules/io/io_virtual/pc_create_spcvf.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: pc_create_spcvf.cpp 2321 2014-11-03 21:10:22Z johanvdw $
+ * Version $Id: pc_create_spcvf.cpp 2405 2015-02-13 10:34:33Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -83,7 +83,10 @@ CPointCloud_Create_SPCVF::CPointCloud_Create_SPCVF(void)
 
 	Set_Description	(_TW(
 		"The module allows one to create a virtual point cloud dataset "
-		"from a set of SAGA point cloud files. Such a virtual "
+		"from a set of SAGA point cloud files. For a large number of "
+		"files, it is advised to use an input file list, i.e. a text "
+		"file with the full path to an input point cloud on each line.\n"
+		"A virtual point cloud "
 		"dataset is a simple XML format with the file extension .spcvf, "
 		"which describes a mosaic of individual point cloud files. Such "
 		"a virtual point cloud dataset can be used for seamless data "
@@ -103,6 +106,15 @@ CPointCloud_Create_SPCVF::CPointCloud_Create_SPCVF(void)
 	);
 
 	Parameters.Add_FilePath(
+		NULL	, "INPUT_FILE_LIST"		, _TL("Input File List"),
+		_TL("A text file with the full path to an input point cloud on each line"),
+		CSG_String::Format(SG_T("%s|%s|%s|%s"),
+			_TL("Text Files")			, SG_T("*.txt"),
+            _TL("All Files")            , SG_T("*.*")
+        ), NULL, false, false, false
+	);
+
+	Parameters.Add_FilePath(
 		NULL	, "FILENAME"		, _TL("Filename"),
 		_TL("The full path and name of the .spcvf file"),
 		CSG_String::Format(SG_T("%s|%s|%s|%s"),
@@ -132,7 +144,7 @@ CPointCloud_Create_SPCVF::CPointCloud_Create_SPCVF(void)
 bool CPointCloud_Create_SPCVF::On_Execute(void)
 {
 	CSG_Strings					sFiles;
-	CSG_String					sFileName;
+	CSG_String					sFileInputList, sFileName;
 	int							iMethodPaths;
 
 	CSG_MetaData				SPCVF;
@@ -145,21 +157,49 @@ bool CPointCloud_Create_SPCVF::On_Execute(void)
 	double						dBBoxXMax = std::numeric_limits<int>::min();
 	double						dBBoxYMax = std::numeric_limits<int>::min();
 	int							iSkipped = 0, iEmpty = 0;
+	int							iDatasetCount = 0;
+	double						dPointCount = 0.0;
+	double						dZMin = std::numeric_limits<double>::max();
+	double						dZMax = std::numeric_limits<double>::min();
 
 	//-----------------------------------------------------
 	sFileName		= Parameters("FILENAME")->asString();
 	iMethodPaths	= Parameters("METHOD_PATHS")->asInt();
+	sFileInputList	= Parameters("INPUT_FILE_LIST")->asString();
 
 	//-----------------------------------------------------
-    if( !Parameters("FILES")->asFilePath()->Get_FilePaths(sFiles) )
+	if( !Parameters("FILES")->asFilePath()->Get_FilePaths(sFiles) && sFileInputList.Length() <= 0 )
 	{
 		SG_UI_Msg_Add_Error(_TL("Please provide some input files!"));
 		return( false );
 	}
 
 	//-----------------------------------------------------
+	if( sFiles.Get_Count() <= 0 )
+	{
+		CSG_Table	*pTable = new CSG_Table();
+
+		if( !pTable->Create(sFileInputList, TABLE_FILETYPE_Text_NoHeadLine) )
+		{
+			SG_UI_Msg_Add_Error(_TL("Input file list could not be opened!"));
+			delete( pTable );
+			return( false );
+		}
+
+		sFiles.Clear();
+
+		for (int i=0; i<pTable->Get_Record_Count(); i++)
+		{
+			sFiles.Add(pTable->Get_Record(i)->asString(0));
+		}
+
+		delete( pTable );
+	}
+
+
+	//-----------------------------------------------------
 	SPCVF.Set_Name(SG_T("SPCVFDataset"));
-	SPCVF.Add_Property(SG_T("Version"), SG_T("1.0"));
+	SPCVF.Add_Property(SG_T("Version"), SG_T("1.1"));
 	
 	switch( iMethodPaths )
 	{
@@ -169,10 +209,18 @@ bool CPointCloud_Create_SPCVF::On_Execute(void)
 	}
 
 	//-----------------------------------------------------
-	CSG_MetaData	*pSPCVFBBox		= SPCVF.Add_Child(SG_T("BBox"));
+	CSG_MetaData	*pSPCVFHeader	= SPCVF.Add_Child(			SG_T("Header"));
 
-	//-----------------------------------------------------
-	CSG_MetaData	*pSPCVFDatasets;
+	CSG_MetaData	*pSPCVFFiles	= pSPCVFHeader->Add_Child(	SG_T("Datasets"));
+	CSG_MetaData	*pSPCVFPoints	= pSPCVFHeader->Add_Child(	SG_T("Points"));
+	CSG_MetaData	*pSRS			= pSPCVFHeader->Add_Child(	SG_T("SRS"));
+	CSG_MetaData	*pSPCVFBBox		= pSPCVFHeader->Add_Child(	SG_T("BBox"));
+	CSG_MetaData	*pSPCVFZStats	= pSPCVFHeader->Add_Child(	SG_T("ZStats"));
+	CSG_MetaData	*pSPCVFNoData	= pSPCVFHeader->Add_Child(	SG_T("NoData"));
+	CSG_MetaData	*pSPCVFAttr		= pSPCVFHeader->Add_Child(	SG_T("Attributes"));
+
+	CSG_MetaData	*pSPCVFDatasets	= NULL;
+	
 
 	//-----------------------------------------------------
 	for(int i=0; i<sFiles.Get_Count() && Set_Progress(i, sFiles.Get_Count()); i++)
@@ -185,17 +233,31 @@ bool CPointCloud_Create_SPCVF::On_Execute(void)
 			projSPCVF	= pPC->Get_Projection();
 			dNoData		= pPC->Get_NoData_Value();
 
+			pSPCVFNoData->Add_Property(SG_T("Value"), dNoData);
+
+			pSPCVFAttr->Add_Property(SG_T("Count"), pPC->Get_Field_Count());
+
 			for(int iField=0; iField<pPC->Get_Field_Count(); iField++)
 			{
 				vFieldTypes.push_back(pPC->Get_Field_Type(iField));
 				vFieldNames.push_back(pPC->Get_Field_Name(iField));
+
+				CSG_MetaData	*pSPCVFField = pSPCVFAttr->Add_Child(CSG_String::Format(SG_T("Field_%d"), iField + 1));
+
+				pSPCVFField->Add_Property(SG_T("Name"), pPC->Get_Field_Name(iField));
+				pSPCVFField->Add_Property(SG_T("Type"), gSG_Data_Type_Identifier[pPC->Get_Field_Type(iField)]);
+
 			}
 
 			if( projSPCVF.is_Okay() )
 			{
-				CSG_MetaData	*pSRS	= SPCVF.Add_Child(SG_T("SRS"));
+				pSRS->Add_Property(SG_T("Projection"), projSPCVF.Get_Name());
 				pSRS->Add_Property(SG_T("WKT"), projSPCVF.Get_WKT());
 			}
+			else
+			{
+				pSRS->Add_Property(SG_T("Projection"), SG_T("Undefined Coordinate System"));
+			}
 
 			pSPCVFDatasets	= SPCVF.Add_Child(SG_T("Datasets"));
 		}
@@ -269,6 +331,9 @@ bool CPointCloud_Create_SPCVF::On_Execute(void)
 
 		pDataset->Add_Property(SG_T("Points"), pPC->Get_Point_Count());
 
+		pDataset->Add_Property(SG_T("ZMin"), pPC->Get_ZMin());
+		pDataset->Add_Property(SG_T("ZMax"), pPC->Get_ZMax());
+
 		//-----------------------------------------------------
 		CSG_MetaData	*pBBox		= pDataset->Add_Child(SG_T("BBox"));
 
@@ -286,6 +351,15 @@ bool CPointCloud_Create_SPCVF::On_Execute(void)
 		if( dBBoxYMax < pPC->Get_Extent().Get_YMax() )
 			dBBoxYMax = pPC->Get_Extent().Get_YMax();
 		
+		iDatasetCount	+= 1;
+		dPointCount		+= pPC->Get_Point_Count();
+
+		if( dZMin > pPC->Get_ZMin() )
+			dZMin = pPC->Get_ZMin();
+		if( dZMax < pPC->Get_ZMax() )
+			dZMax = pPC->Get_ZMax();
+
+
 		delete( pPC );
 	}
 
@@ -295,6 +369,11 @@ bool CPointCloud_Create_SPCVF::On_Execute(void)
 	pSPCVFBBox->Add_Property(SG_T("XMax"), dBBoxXMax);
 	pSPCVFBBox->Add_Property(SG_T("YMax"), dBBoxYMax);
 
+	pSPCVFFiles->Add_Property(SG_T("Count"), iDatasetCount);
+	pSPCVFPoints->Add_Property(SG_T("Count"), CSG_String::Format(SG_T("%.0f"), dPointCount));
+	pSPCVFZStats->Add_Property(SG_T("ZMin"), dZMin);
+	pSPCVFZStats->Add_Property(SG_T("ZMax"), dZMax);
+
 	//-----------------------------------------------------
 	if( !SPCVF.Save(sFileName) )
 	{
@@ -314,7 +393,7 @@ bool CPointCloud_Create_SPCVF::On_Execute(void)
 		SG_UI_Msg_Add(CSG_String::Format(_TL("WARNING: %d dataset(s) skipped because they are empty!"), iEmpty), true);
 	}
 
-	SG_UI_Msg_Add(CSG_String::Format(_TL("SPCVF successfully created from %d dataset(s)."), sFiles.Get_Count() - iSkipped - iEmpty), true);
+	SG_UI_Msg_Add(CSG_String::Format(_TL("SPCVF successfully created from %d dataset(s)."), iDatasetCount), true);
 
 	//-----------------------------------------------------
 	return( true );
diff --git a/src/modules/io/io_virtual/pc_get_grid_spcvf.cpp b/src/modules/io/io_virtual/pc_get_grid_spcvf.cpp
index 01ff94a..baeb808 100644
--- a/src/modules/io/io_virtual/pc_get_grid_spcvf.cpp
+++ b/src/modules/io/io_virtual/pc_get_grid_spcvf.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: pc_get_grid_spcvf.cpp 2321 2014-11-03 21:10:22Z johanvdw $
+ * Version $Id: pc_get_grid_spcvf.cpp 2439 2015-03-16 13:35:26Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -88,7 +88,9 @@ CPointCloud_Get_Grid_SPCVF_Base::~CPointCloud_Get_Grid_SPCVF_Base(void)
 
 
 //---------------------------------------------------------
-void CPointCloud_Get_Grid_SPCVF_Base::Initialise(int iOutputs, CSG_Rect AOI, CSG_Shapes *pShapes, int iFieldName, bool bMultiple, bool bAddOverlap, double dOverlap, CSG_String sFileName, CSG_Parameter_File_Name *pFilePath, CSG_Parameter_Grid_List *pGridList, double dCellsize, bool bFitToCells, int iMethod)
+void CPointCloud_Get_Grid_SPCVF_Base::Initialise(int iOutputs, CSG_Rect AOI, CSG_Shapes *pShapes, int iFieldName, bool bMultiple, bool bAddOverlap, double dOverlap,
+												 CSG_String sFileName, CSG_Parameter_File_Name *pFilePath, CSG_Parameter_Grid_List *pGridList, double dCellsize,
+												 bool bFitToCells, int iMethod, bool bConstrain, int iField, double dMinAttrRange, double dMaxAttrRange)
 {
 	m_iOutputs		= iOutputs;
 	m_AOI			= AOI;
@@ -103,6 +105,10 @@ void CPointCloud_Get_Grid_SPCVF_Base::Initialise(int iOutputs, CSG_Rect AOI, CSG
 	m_dCellsize		= dCellsize;
 	m_bFitToCells	= bFitToCells;
 	m_iMethod		= iMethod;
+	m_bConstrain	= bConstrain;
+	m_iField		= iField;
+	m_dMinAttrRange	= dMinAttrRange;
+	m_dMaxAttrRange	= dMaxAttrRange;
 
 	return;
 }
@@ -120,13 +126,13 @@ void CPointCloud_Get_Grid_SPCVF_Base::Finalise(void)
 
 
 //---------------------------------------------------------
-bool CPointCloud_Get_Grid_SPCVF_Base::Get_Subset(void)
+bool CPointCloud_Get_Grid_SPCVF_Base::Get_Subset(int iFieldToGrid)
 {
-	CSG_String		sPathSPCVF, sMethodPaths;
+	CSG_String		sVersion, sPathSPCVF, sMethodPaths;
 	double			dBBoxXMin, dBBoxYMin, dBBoxXMax, dBBoxYMax;
 	CSG_Rect		BBoxSPCVF;
 	CSG_MetaData	SPCVF;
-	
+
 
 	//-----------------------------------------------------
 	if( !SPCVF.Create(m_sFileName) || SPCVF.Get_Name().CmpNoCase(SG_T("SPCVFDataset")) )
@@ -135,7 +141,36 @@ bool CPointCloud_Get_Grid_SPCVF_Base::Get_Subset(void)
 		return( false );
 	}
 
+
+	CSG_MetaData	*pHeader = SPCVF.Get_Child(SG_T("Header"));
+
+	if( pHeader != NULL )
+	{
+		int		iFieldCount;
+
+		pHeader->Get_Child(SG_T("Attributes"))->Get_Property(SG_T("Count"), iFieldCount);
+
+		if( iFieldToGrid < 0 || iFieldToGrid >= iFieldCount )
+		{
+			SG_UI_Msg_Add_Error(_TL("Attribute field number to grid is out of range!"));
+			return( false );
+		}
+
+		if( m_bConstrain )
+		{
+			if( m_iField >= iFieldCount )
+			{
+				SG_UI_Msg_Add_Error(_TL("Constraining attribute field number is out of range!"));
+				return( false );
+			}
+		}
+	}
+
+
+
 	//-----------------------------------------------------
+	SPCVF.Get_Property(SG_T("Version"), sVersion);
+
 	SPCVF.Get_Property(SG_T("Paths"), sMethodPaths);
 
 	if( !sMethodPaths.CmpNoCase(SG_T("absolute")) )
@@ -154,10 +189,23 @@ bool CPointCloud_Get_Grid_SPCVF_Base::Get_Subset(void)
 	}
 
 	//-----------------------------------------------------
-	SPCVF.Get_Child(SG_T("BBox"))->Get_Property(SG_T("XMin"), dBBoxXMin);
-	SPCVF.Get_Child(SG_T("BBox"))->Get_Property(SG_T("YMin"), dBBoxYMin);
-	SPCVF.Get_Child(SG_T("BBox"))->Get_Property(SG_T("XMax"), dBBoxXMax);
-	SPCVF.Get_Child(SG_T("BBox"))->Get_Property(SG_T("YMax"), dBBoxYMax);
+	if( !sVersion.CmpNoCase(SG_T("1.0")) )
+	{
+		SPCVF.Get_Child(SG_T("BBox"))->Get_Property(SG_T("XMin"), dBBoxXMin);
+		SPCVF.Get_Child(SG_T("BBox"))->Get_Property(SG_T("YMin"), dBBoxYMin);
+		SPCVF.Get_Child(SG_T("BBox"))->Get_Property(SG_T("XMax"), dBBoxXMax);
+		SPCVF.Get_Child(SG_T("BBox"))->Get_Property(SG_T("YMax"), dBBoxYMax);
+	}
+	else // 1.1
+	{
+		CSG_MetaData	*pHeader = SPCVF.Get_Child(SG_T("Header"));
+
+		pHeader->Get_Child(SG_T("BBox"))->Get_Property(SG_T("XMin"), dBBoxXMin);
+		pHeader->Get_Child(SG_T("BBox"))->Get_Property(SG_T("YMin"), dBBoxYMin);
+		pHeader->Get_Child(SG_T("BBox"))->Get_Property(SG_T("XMax"), dBBoxXMax);
+		pHeader->Get_Child(SG_T("BBox"))->Get_Property(SG_T("YMax"), dBBoxYMax);
+	}
+
 	BBoxSPCVF.Assign(dBBoxXMin, dBBoxYMin, dBBoxXMax, dBBoxYMax);
 
 
@@ -200,7 +248,7 @@ bool CPointCloud_Get_Grid_SPCVF_Base::Get_Subset(void)
 		{
 			m_dOverlap = 0.0;
 		}
-	
+
 		if( m_AOI.Intersects(BBoxSPCVF) == INTERSECTION_None )
 		{
 			SG_UI_Msg_Add(_TL("AOI does not intersect bounding box of SPCVF, nothing to do!"), true);
@@ -279,7 +327,8 @@ bool CPointCloud_Get_Grid_SPCVF_Base::Get_Subset(void)
 
 			for(int iPoint=0; iPoint<pPC->Get_Count(); iPoint++)
 			{
-				if( m_AOI.Contains(pPC->Get_X(iPoint), pPC->Get_Y(iPoint)) )
+				if( m_AOI.Get_XMin() <= pPC->Get_X(iPoint) && pPC->Get_X(iPoint) < m_AOI.Get_XMax() &&
+					m_AOI.Get_YMin() <= pPC->Get_Y(iPoint) && pPC->Get_Y(iPoint) < m_AOI.Get_YMax() )
 				{
 					if( m_pShapes != NULL && !m_bAddOverlap )
 					{
@@ -288,21 +337,29 @@ bool CPointCloud_Get_Grid_SPCVF_Base::Get_Subset(void)
 						if( !pPolygon->Contains(pPC->Get_X(iPoint), pPC->Get_Y(iPoint)) )
 							continue;
 					}
-							
+
+					if( m_bConstrain )
+					{
+						if( pPC->Get_Value(iPoint, m_iField) < m_dMinAttrRange || pPC->Get_Value(iPoint, m_iField) > m_dMaxAttrRange)
+						{
+							continue;
+						}
+					}
+
 					if( System.Get_World_to_Grid(x, y, pPC->Get_X(iPoint), pPC->Get_Y(iPoint)) )
 					{
 						switch( m_iMethod )
 						{
 						default:
-						case 0:		if( pGrid->is_NoData(x, y) || pGrid->asDouble(x, y) > pPC->Get_Z(iPoint) )
+						case 0:		if( pGrid->is_NoData(x, y) || pGrid->asDouble(x, y) > pPC->Get_Value(iPoint, iFieldToGrid) )
 									{
-										pGrid->Set_Value(x, y, pPC->Get_Z(iPoint));
+										pGrid->Set_Value(x, y, pPC->Get_Value(iPoint, iFieldToGrid));
 									}
 									break;
 
-						case 1:		if( pGrid->is_NoData(x, y) || pGrid->asDouble(x, y) < pPC->Get_Z(iPoint) )
+						case 1:		if( pGrid->is_NoData(x, y) || pGrid->asDouble(x, y) < pPC->Get_Value(iPoint, iFieldToGrid) )
 									{
-										pGrid->Set_Value(x, y, pPC->Get_Z(iPoint));
+										pGrid->Set_Value(x, y, pPC->Get_Value(iPoint, iFieldToGrid));
 									}
 									break;
 						}
@@ -339,7 +396,7 @@ bool CPointCloud_Get_Grid_SPCVF_Base::Get_Subset(void)
 	}
 
 	//---------------------------------------------------------
-	if( !m_bMultiple )
+	if( !m_bMultiple && pGrid != NULL)
 	{
 		if( pGrid != NULL && dPoints == 0.0 )
 		{
@@ -431,6 +488,8 @@ CPointCloud_Get_Grid_SPCVF::CPointCloud_Get_Grid_SPCVF(void)
 		"list or written to an output directory. For the latter, "
 		"you must provide a valid file path with the 'Optional Output "
 		"Filepath' parameter.\n"
+		"Optionally, the query can be constrained by providing an "
+		"attribute field and a value range that must be met.\n"
 		"A virtual point cloud dataset is a simple XML format "
 		"with the file extension .spcvf, which can be created "
 		"with the 'Create Virtual Point Cloud Dataset' module.\n\n"
@@ -461,6 +520,12 @@ CPointCloud_Get_Grid_SPCVF::CPointCloud_Get_Grid_SPCVF(void)
 	);
 
 	Parameters.Add_Value(
+		NULL	, "ATTR_FIELD_GRID"	, _TL("Attribute Field to Grid"),
+		_TL("The attribute field to grid. Field numbers start with 1, so elevation is attribute field 3."),
+		PARAMETER_TYPE_Int, 1, 3, true
+	);
+
+	Parameters.Add_Value(
 		NULL	, "CELL_SIZE"	, _TL("Cellsize"),
 		_TL("Cellsize of the output grid [map units]"),
 		PARAMETER_TYPE_Double, 1.0, 0.001, true
@@ -474,16 +539,34 @@ CPointCloud_Get_Grid_SPCVF::CPointCloud_Get_Grid_SPCVF(void)
 			_TL("cells")
 		), 1
 	);
-	
+
 	Parameters.Add_Choice(
 		NULL	, "METHOD"	, _TL("Aggregation"),
 		_TL("Choose how to aggregate the values"),
 		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("lowest z"),
-			_TL("highest z")
+			_TL("lowest"),
+			_TL("highest")
 		), 1
 	);
 
+	Parameters.Add_Value(
+		NULL	, "CONSTRAIN_QUERY"	, _TL("Constrain Query"),
+		_TL("Check this parameter to constrain the query by an attribute range."),
+		PARAMETER_TYPE_Bool, false
+	);
+
+	Parameters.Add_Value(
+		Parameters("CONSTRAIN_QUERY")	, "ATTR_FIELD"	, _TL("Attribute Field"),
+		_TL("The attribute field to use as constraint. Field numbers start with 1."),
+		PARAMETER_TYPE_Int, 1, 1, true
+	);
+
+	Parameters.Add_Range(
+		Parameters("CONSTRAIN_QUERY")	, "VALUE_RANGE"	, _TL("Value Range"),
+		_TL("Minimum and maximum of attribute range []."),
+		2.0, 2.0
+	);
+
 
 	CSG_Parameter *pNode = Parameters.Add_Node(NULL, "NODE_AOI", _TL("AOI"), _TL("AOI Input Settings"));
 
@@ -540,9 +623,13 @@ bool CPointCloud_Get_Grid_SPCVF::On_Execute(void)
 	CSG_String		sFileName;
 	CSG_Parameter_Grid_List	*pGridList = NULL;
 	CSG_Parameter_File_Name	*pFilePath = NULL;
+	int				iFieldToGrid;
 	double			dCellsize;
 	bool			bFitToCells;
 	int				iMethod;
+	bool			bConstrain;
+	int				iField;
+	double			dMinAttrRange, dMaxAttrRange;
 	CSG_Shapes		*pShapes;
 	int				iFieldName;
 	CSG_Grid		*pAOIGrid = NULL;
@@ -558,9 +645,14 @@ bool CPointCloud_Get_Grid_SPCVF::On_Execute(void)
 	sFileName		= Parameters("FILENAME")->asString();
 	pGridList		= Parameters("GRID_OUT")->asGridList();
 	pFilePath		= Parameters("FILEPATH")->asFilePath();
+	iFieldToGrid	= Parameters("ATTR_FIELD_GRID")->asInt() - 1;
 	dCellsize		= Parameters("CELL_SIZE")->asDouble();
 	bFitToCells		= Parameters("GRID_SYSTEM_FIT")->asBool();
 	iMethod			= Parameters("METHOD")->asInt();
+	bConstrain		= Parameters("CONSTRAIN_QUERY")->asBool();
+	iField			= Parameters("ATTR_FIELD")->asInt() - 1;
+	dMinAttrRange	= Parameters("VALUE_RANGE")->asRange()->Get_LoVal();
+	dMaxAttrRange	= Parameters("VALUE_RANGE")->asRange()->Get_HiVal();
 	pShapes			= Parameters("AOI_SHP")->asShapes();
 	iFieldName		= Parameters("FIELD_TILENAME")->asInt();
 	pAOIGrid		= Parameters("AOI_GRID")->asGrid();
@@ -583,7 +675,7 @@ bool CPointCloud_Get_Grid_SPCVF::On_Execute(void)
 	}
 
 	CSG_String	sPath = pFilePath->asString();
-	
+
 	if( sPath.Length() <= 1 )
 	{
 		pFilePath = NULL;
@@ -614,9 +706,10 @@ bool CPointCloud_Get_Grid_SPCVF::On_Execute(void)
 
 	//---------------------------------------------------------
 
-	m_Get_Grid_SPCVF.Initialise(iOutputs, AOI, pShapes, iFieldName, bMultiple, bAddOverlap, dOverlap, sFileName, pFilePath, pGridList, dCellsize, bFitToCells, iMethod);
+	m_Get_Grid_SPCVF.Initialise(iOutputs, AOI, pShapes, iFieldName, bMultiple, bAddOverlap, dOverlap, sFileName, pFilePath, pGridList, dCellsize, bFitToCells, iMethod,
+								bConstrain, iField, dMinAttrRange, dMaxAttrRange);
 
-	bool bResult = m_Get_Grid_SPCVF.Get_Subset();
+	bool bResult = m_Get_Grid_SPCVF.Get_Subset(iFieldToGrid);
 
 	m_Get_Grid_SPCVF.Finalise();
 
@@ -627,16 +720,22 @@ bool CPointCloud_Get_Grid_SPCVF::On_Execute(void)
 //---------------------------------------------------------
 int CPointCloud_Get_Grid_SPCVF::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
+	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("CONSTRAIN_QUERY")) )
+	{
+		pParameters->Get_Parameter("ATTR_FIELD"			)->Set_Enabled(pParameter->asBool());
+		pParameters->Get_Parameter("VALUE_RANGE"		)->Set_Enabled(pParameter->asBool());
+	}
+
 	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("AOI_ADD_OVERLAP")) )
 	{
-		pParameters->Get_Parameter("OVERLAP")->Set_Enabled(pParameter->asBool());
+		pParameters->Get_Parameter("OVERLAP"			)->Set_Enabled(pParameter->asBool());
 	}
 
 	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("AOI_SHP")) )
 	{
-		pParameters->Get_Parameter("FIELD_TILENAME"			)->Set_Enabled(pParameter->asShapes() != NULL);
+		pParameters->Get_Parameter("FIELD_TILENAME"		)->Set_Enabled(pParameter->asShapes() != NULL);
 	}
-	
+
 	//-----------------------------------------------------
 	return (1);
 }
@@ -658,6 +757,8 @@ CPointCloud_Get_Grid_SPCVF_Interactive::CPointCloud_Get_Grid_SPCVF_Interactive(v
 	Set_Description	(_TW(
 		"The module allows one to retrieve a grid from a virtual "
 		"point cloud dataset by dragging a box (AOI) in a Map View.\n"
+		"Optionally, the query can be constrained by providing an "
+		"attribute field and a value range that must be met.\n"
 		"A virtual point cloud dataset is a simple XML format "
 		"with the file extension .spcvf, which can be created "
 		"with the 'Create Virtual Point Cloud Dataset' module.\n\n"
@@ -681,6 +782,12 @@ CPointCloud_Get_Grid_SPCVF_Interactive::CPointCloud_Get_Grid_SPCVF_Interactive(v
 	);
 
 	Parameters.Add_Value(
+		NULL	, "ATTR_FIELD_GRID"	, _TL("Attribute Field to Grid"),
+		_TL("The attribute field to grid. Field numbers start with 1, so elevation is attribute field 3."),
+		PARAMETER_TYPE_Int, 1, 3, true
+	);
+
+	Parameters.Add_Value(
 		NULL	, "CELL_SIZE"	, _TL("Cellsize"),
 		_TL("Cellsize of the output grid [map units]"),
 		PARAMETER_TYPE_Double, 1.0, 0.001, true
@@ -699,10 +806,28 @@ CPointCloud_Get_Grid_SPCVF_Interactive::CPointCloud_Get_Grid_SPCVF_Interactive(v
 		NULL	, "METHOD"	, _TL("Aggregation"),
 		_TL("Choose how to aggregate the values"),
 		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("lowest z"),
-			_TL("highest z")
+			_TL("lowest"),
+			_TL("highest")
 		), 1
 	);
+
+	Parameters.Add_Value(
+		NULL	, "CONSTRAIN_QUERY"	, _TL("Constrain Query"),
+		_TL("Check this parameter to constrain the query by an attribute range."),
+		PARAMETER_TYPE_Bool, false
+	);
+
+	Parameters.Add_Value(
+		Parameters("CONSTRAIN_QUERY")	, "ATTR_FIELD"	, _TL("Attribute Field"),
+		_TL("The attribute field to use as constraint. Field numbers start with 1."),
+		PARAMETER_TYPE_Int, 1, 1, true
+	);
+
+	Parameters.Add_Range(
+		Parameters("CONSTRAIN_QUERY")	, "VALUE_RANGE"	, _TL("Value Range"),
+		_TL("Minimum and maximum of attribute range []."),
+		2.0, 2.0
+	);
 }
 
 
@@ -740,14 +865,16 @@ bool CPointCloud_Get_Grid_SPCVF_Interactive::On_Execute_Position(CSG_Point ptWor
 		// to use CSG_Rect instead of CSG_Shape for point in polygon check in Get_Subset():
 		m_Get_Grid_SPCVF.Initialise(1, AOI, NULL, -1, false, true, 0.0, Parameters("FILENAME")->asString(),
 									NULL, Parameters("GRID_OUT")->asGridList(), Parameters("CELL_SIZE")->asDouble(),
-									Parameters("GRID_SYSTEM_FIT")->asBool(), Parameters("METHOD")->asInt());
+									Parameters("GRID_SYSTEM_FIT")->asBool(), Parameters("METHOD")->asInt(),
+									Parameters("CONSTRAIN_QUERY")->asBool(), Parameters("ATTR_FIELD")->asInt()-1,
+									Parameters("VALUE_RANGE")->asRange()->Get_LoVal(), Parameters("VALUE_RANGE")->asRange()->Get_HiVal());
 
-		bool bResult = m_Get_Grid_SPCVF.Get_Subset();
+		bool bResult = m_Get_Grid_SPCVF.Get_Subset(Parameters("ATTR_FIELD_GRID")->asInt()-1);
 
 		if( bResult )
 		{
 			CSG_Grid *pGrid = Parameters("GRID_OUT")->asGridList()->asGrid(Parameters("GRID_OUT")->asGridList()->Get_Count()-1);
-	
+
 			DataObject_Update(pGrid, SG_UI_DATAOBJECT_SHOW_LAST_MAP);
 		}
 
@@ -760,6 +887,20 @@ bool CPointCloud_Get_Grid_SPCVF_Interactive::On_Execute_Position(CSG_Point ptWor
 }
 
 
+//---------------------------------------------------------
+int CPointCloud_Get_Grid_SPCVF_Interactive::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+{
+	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("CONSTRAIN_QUERY")) )
+	{
+		pParameters->Get_Parameter("ATTR_FIELD"			)->Set_Enabled(pParameter->asBool());
+		pParameters->Get_Parameter("VALUE_RANGE"		)->Set_Enabled(pParameter->asBool());
+	}
+
+	//-----------------------------------------------------
+	return (1);
+}
+
+
 ///////////////////////////////////////////////////////////
 //														 //
 //														 //
diff --git a/src/modules/io/io_virtual/pc_get_grid_spcvf.h b/src/modules/io/io_virtual/pc_get_grid_spcvf.h
index 19a49ed..329ad8d 100644
--- a/src/modules/io/io_virtual/pc_get_grid_spcvf.h
+++ b/src/modules/io/io_virtual/pc_get_grid_spcvf.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: pc_get_grid_spcvf.h 2269 2014-10-02 13:33:04Z reklov_w $
+ * Version $Id: pc_get_grid_spcvf.h 2385 2015-02-01 15:19:57Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -89,9 +89,11 @@ public:
 	CPointCloud_Get_Grid_SPCVF_Base(void);
 	virtual ~CPointCloud_Get_Grid_SPCVF_Base(void);
 
-	void					Initialise	(int iOutputs, CSG_Rect	AOI, CSG_Shapes *pShapes, int iFieldName, bool bMultiple, bool bAddOverlap, double dOverlap, CSG_String sFilename, CSG_Parameter_File_Name *pFilePath, CSG_Parameter_Grid_List *pGridList, double dCellsize, bool bFitToCells, int iMethod);
+	void					Initialise	(int iOutputs, CSG_Rect	AOI, CSG_Shapes *pShapes, int iFieldName, bool bMultiple, bool bAddOverlap, double dOverlap,
+										 CSG_String sFilename, CSG_Parameter_File_Name *pFilePath, CSG_Parameter_Grid_List *pGridList, double dCellsize,
+										 bool bFitToCells, int iMethod, bool bConstrain, int iField, double dMinAttrRange, double dMaxAttrRange);
 	void					Finalise	(void);
-	bool					Get_Subset	(void);
+	bool					Get_Subset	(int iFieldToGrid);
 	void					Write_Subset(CSG_Grid *pGrid, int iAOI, int iDatasets, double dPoints);
 
 protected:
@@ -111,6 +113,9 @@ private:
 	double					m_dCellsize;
 	bool					m_bFitToCells;
 	int						m_iMethod;
+	bool					m_bConstrain;
+	int						m_iField;
+	double					m_dMinAttrRange, m_dMaxAttrRange;
 
 };
 
@@ -152,6 +157,8 @@ protected:
 	virtual bool				On_Execute			(void);
 	virtual bool				On_Execute_Position	(CSG_Point ptWorld, TSG_Module_Interactive_Mode Mode);
 
+	virtual int					On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+
 
 private:
 
diff --git a/src/modules/io/io_virtual/pc_get_subset_spcvf.cpp b/src/modules/io/io_virtual/pc_get_subset_spcvf.cpp
index 25adc9f..6d12fd7 100644
--- a/src/modules/io/io_virtual/pc_get_subset_spcvf.cpp
+++ b/src/modules/io/io_virtual/pc_get_subset_spcvf.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: pc_get_subset_spcvf.cpp 2277 2014-10-07 13:17:58Z reklov_w $
+ * Version $Id: pc_get_subset_spcvf.cpp 2439 2015-03-16 13:35:26Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -77,6 +77,8 @@ CPointCloud_Get_Subset_SPCVF_Base::CPointCloud_Get_Subset_SPCVF_Base(void)
 	m_pShapes			= NULL;
 	m_pFilePath			= NULL;
 	m_pPointCloudList	= NULL;
+
+	m_vAttrMapper.clear();
 }
 
 
@@ -88,7 +90,10 @@ CPointCloud_Get_Subset_SPCVF_Base::~CPointCloud_Get_Subset_SPCVF_Base(void)
 
 
 //---------------------------------------------------------
-void CPointCloud_Get_Subset_SPCVF_Base::Initialise(int iOutputs, CSG_Rect AOI, CSG_Shapes *pShapes, int iFieldName, bool bMultiple, bool bAddOverlap, double dOverlap, CSG_String sFileName, CSG_Parameter_File_Name *pFilePath, CSG_Parameter_PointCloud_List *pPointCloudList)
+bool CPointCloud_Get_Subset_SPCVF_Base::Initialise(int iOutputs, CSG_Rect AOI, CSG_Shapes *pShapes, int iFieldName, bool bMultiple, bool bAddOverlap, double dOverlap,
+												   CSG_String sFileNameTileInfo, CSG_String sFileName, CSG_Parameter_File_Name *pFilePath,
+												   CSG_Parameter_PointCloud_List *pPointCloudList, bool bConstrain, int iField, double dMinAttrRange, double dMaxAttrRange,
+												   bool bCopyAttr, CSG_String sAttrList)
 {
 	m_iOutputs			= iOutputs;
 	m_AOI				= AOI;
@@ -97,11 +102,63 @@ void CPointCloud_Get_Subset_SPCVF_Base::Initialise(int iOutputs, CSG_Rect AOI, C
 	m_bMultiple			= bMultiple;
 	m_bAddOverlap		= bAddOverlap;
 	m_dOverlap			= dOverlap;
+	m_sFileNameTileInfo	= sFileNameTileInfo;
 	m_sFileName			= sFileName;
 	m_pFilePath			= pFilePath;
 	m_pPointCloudList	= pPointCloudList;
+	m_bConstrain		= bConstrain;
+	m_iField			= iField;
+	m_dMinAttrRange		= dMinAttrRange;
+	m_dMaxAttrRange		= dMaxAttrRange;
 
-	return;
+	if (!bCopyAttr)
+	{
+		CSG_String_Tokenizer	tkz_fields(sAttrList, ";", SG_TOKEN_STRTOK);
+		CSG_String				token;
+		int						iValue;
+		std::vector<int>		vValues;
+
+		while( tkz_fields.Has_More_Tokens() )
+		{
+			token	= tkz_fields.Get_Next_Token();
+
+			if( token.Length() == 0 )
+				break;
+
+			if( !token.asInt(iValue) )
+			{
+				SG_UI_Msg_Add_Error(_TL("Error parsing attribute fields: can't convert to number!"));
+				return( false );
+			}
+
+			iValue	-= 1;
+
+			if( iValue < 0)
+			{
+				SG_UI_Msg_Add_Error(_TL("Error parsing attribute fields: field index out of range!"));
+				return( false );
+			}
+			else
+				vValues.push_back(iValue);
+		}
+
+		std::sort(vValues.begin(), vValues.end());
+
+		if( vValues.at(0) != 0 || vValues.at(1) != 1 || vValues.at(2) != 2)
+		{
+			SG_UI_Msg_Add_Error(_TL("Attribute fields one to three (x;y;z) are mandatory!"));
+			return( false );
+		}
+
+		m_vAttrMapper.clear();
+
+		for(int i=3; i<(int)vValues.size(); i++)
+		{
+			m_vAttrMapper.push_back(vValues.at(i) - 3);
+		}
+	}
+
+	return( true );
 }
 
 
@@ -112,18 +169,23 @@ void CPointCloud_Get_Subset_SPCVF_Base::Finalise(void)
 	m_pFilePath			= NULL;
 	m_pPointCloudList	= NULL;
 
+	m_vAttrMapper.clear();
+
 	return;
 }
 
 
 //---------------------------------------------------------
-bool CPointCloud_Get_Subset_SPCVF_Base::Get_Subset(void)
+bool CPointCloud_Get_Subset_SPCVF_Base::Get_Subset(bool bCopyAttr)
 {
-	CSG_String		sPathSPCVF, sMethodPaths;
+	CSG_String		sVersion, sPathSPCVF, sMethodPaths;
 	double			dBBoxXMin, dBBoxYMin, dBBoxXMax, dBBoxYMax;
 	CSG_Rect		BBoxSPCVF;
 	CSG_MetaData	SPCVF;
-	
+
+	CSG_MetaData	SPCVF_Tile_Info;
+	CSG_MetaData	*pSPCVF_Tiles = NULL;
+	bool			bAbsolutePaths = false;
 
 	//-----------------------------------------------------
 	if( !SPCVF.Create(m_sFileName) || SPCVF.Get_Name().CmpNoCase(SG_T("SPCVFDataset")) )
@@ -132,12 +194,46 @@ bool CPointCloud_Get_Subset_SPCVF_Base::Get_Subset(void)
 		return( false );
 	}
 
+	if( !bCopyAttr || m_bConstrain )
+	{
+		CSG_MetaData	*pHeader = SPCVF.Get_Child(SG_T("Header"));
+
+		if( pHeader != NULL )
+		{
+			int		iFieldCount;
+
+			pHeader->Get_Child(SG_T("Attributes"))->Get_Property(SG_T("Count"), iFieldCount);
+
+			if( !bCopyAttr )
+			{
+				if( m_vAttrMapper.at(m_vAttrMapper.size()-1) >= iFieldCount-3 )
+				{
+					SG_UI_Msg_Add_Error(_TL("Attribute field number to copy is out of range!"));
+					return( false );
+				}
+			}
+
+			if( m_bConstrain )
+			{
+				if( m_iField < 0 || m_iField >= iFieldCount )
+				{
+					SG_UI_Msg_Add_Error(_TL("Constraining attribute field number is out of range!"));
+					return( false );
+				}
+			}
+		}
+	}
+
+
 	//-----------------------------------------------------
+	SPCVF.Get_Property(SG_T("Version"), sVersion);
+
 	SPCVF.Get_Property(SG_T("Paths"), sMethodPaths);
 
 	if( !sMethodPaths.CmpNoCase(SG_T("absolute")) )
 	{
 		sPathSPCVF = SG_T("");
+		bAbsolutePaths = true;
 	}
 	else if( !sMethodPaths.CmpNoCase(SG_T("relative")) )
 	{
@@ -151,14 +247,46 @@ bool CPointCloud_Get_Subset_SPCVF_Base::Get_Subset(void)
 	}
 
 	//-----------------------------------------------------
-	SPCVF.Get_Child(SG_T("BBox"))->Get_Property(SG_T("XMin"), dBBoxXMin);
-	SPCVF.Get_Child(SG_T("BBox"))->Get_Property(SG_T("YMin"), dBBoxYMin);
-	SPCVF.Get_Child(SG_T("BBox"))->Get_Property(SG_T("XMax"), dBBoxXMax);
-	SPCVF.Get_Child(SG_T("BBox"))->Get_Property(SG_T("YMax"), dBBoxYMax);
+	if( !sVersion.CmpNoCase(SG_T("1.0")) )
+	{
+		SPCVF.Get_Child(SG_T("BBox"))->Get_Property(SG_T("XMin"), dBBoxXMin);
+		SPCVF.Get_Child(SG_T("BBox"))->Get_Property(SG_T("YMin"), dBBoxYMin);
+		SPCVF.Get_Child(SG_T("BBox"))->Get_Property(SG_T("XMax"), dBBoxXMax);
+		SPCVF.Get_Child(SG_T("BBox"))->Get_Property(SG_T("YMax"), dBBoxYMax);
+	}
+	else // 1.1
+	{
+		CSG_MetaData	*pHeader = SPCVF.Get_Child(SG_T("Header"));
+
+		pHeader->Get_Child(SG_T("BBox"))->Get_Property(SG_T("XMin"), dBBoxXMin);
+		pHeader->Get_Child(SG_T("BBox"))->Get_Property(SG_T("YMin"), dBBoxYMin);
+		pHeader->Get_Child(SG_T("BBox"))->Get_Property(SG_T("XMax"), dBBoxXMax);
+		pHeader->Get_Child(SG_T("BBox"))->Get_Property(SG_T("YMax"), dBBoxYMax);
+	}
+
 	BBoxSPCVF.Assign(dBBoxXMin, dBBoxYMin, dBBoxXMax, dBBoxYMax);
 
 
 	//-----------------------------------------------------
+	if( !m_sFileNameTileInfo.is_Empty() )
+	{
+		SPCVF_Tile_Info.Set_Name(SG_T("SPCVF_Tile_Info"));
+		SPCVF_Tile_Info.Add_Property(SG_T("Version"), SG_T("1.0"));
+
+		if( bAbsolutePaths )
+		{
+			SPCVF_Tile_Info.Add_Property(SG_T("Paths"), SG_T("absolute"));
+		}
+		else
+		{
+			SPCVF_Tile_Info.Add_Property(SG_T("Paths"), SG_T("relative"));
+		}
+
+		pSPCVF_Tiles = SPCVF_Tile_Info.Add_Child(SG_T("Tiles"));
+	}
+
+
+	//-----------------------------------------------------
 	int				iDatasets = 0;
 	CSG_PointCloud	*pPC_out = NULL;
 
@@ -196,7 +324,7 @@ bool CPointCloud_Get_Subset_SPCVF_Base::Get_Subset(void)
 		{
 			m_dOverlap = 0.0;
 		}
-	
+
 		if( m_AOI.Intersects(BBoxSPCVF) == INTERSECTION_None )
 		{
 			SG_UI_Msg_Add(_TL("AOI does not intersect bounding box of SPCVF, nothing to do!"), true);
@@ -251,14 +379,30 @@ bool CPointCloud_Get_Subset_SPCVF_Base::Get_Subset(void)
 
 			if( pPC_out == NULL && i == 0 )
 			{
-				pPC_out = SG_Create_PointCloud(pPC);
+				if( bCopyAttr )
+				{
+					pPC_out = SG_Create_PointCloud(pPC);
+				}
+				else
+				{
+					pPC_out = SG_Create_PointCloud();
+
+					for(size_t iField=0; iField<m_vAttrMapper.size(); iField++)
+					{
+						if( iField >= pPC->Get_Attribute_Count() )
+							continue;
+
+						pPC_out->Add_Field(pPC->Get_Attribute_Name(m_vAttrMapper.at(iField)), pPC->Get_Attribute_Type(m_vAttrMapper.at(iField)));
+					}
+				}
 			}
 
 			bool bFound = false;
 
 			for(int iPoint=0; iPoint<pPC->Get_Count(); iPoint++)
 			{
-				if( m_AOI.Contains(pPC->Get_X(iPoint), pPC->Get_Y(iPoint)) )
+				if( m_AOI.Get_XMin() <= pPC->Get_X(iPoint) && pPC->Get_X(iPoint) < m_AOI.Get_XMax() &&
+					m_AOI.Get_YMin() <= pPC->Get_Y(iPoint) && pPC->Get_Y(iPoint) < m_AOI.Get_YMax() )
 				{
 					if( m_pShapes != NULL && !m_bAddOverlap )
 					{
@@ -267,12 +411,33 @@ bool CPointCloud_Get_Subset_SPCVF_Base::Get_Subset(void)
 						if( !pPolygon->Contains(pPC->Get_X(iPoint), pPC->Get_Y(iPoint)) )
 							continue;
 					}
-							
+
+					if( m_bConstrain )
+					{
+						if( pPC->Get_Value(iPoint, m_iField) < m_dMinAttrRange || pPC->Get_Value(iPoint, m_iField) > m_dMaxAttrRange)
+						{
+							continue;
+						}
+					}
+
 					pPC_out->Add_Point(pPC->Get_X(iPoint), pPC->Get_Y(iPoint), pPC->Get_Z(iPoint));
 
-					for(int iField=0; iField<pPC->Get_Attribute_Count(); iField++)
+					if( bCopyAttr )
 					{
-						pPC_out->Set_Attribute(iField, pPC->Get_Attribute(iPoint, iField));
+						for(int iField=0; iField<pPC->Get_Attribute_Count(); iField++)
+						{
+							pPC_out->Set_Attribute(iField, pPC->Get_Attribute(iPoint, iField));
+						}
+					}
+					else
+					{
+						for(int iField=0; iField<(int)m_vAttrMapper.size(); iField++)
+						{
+							if( iField >= pPC->Get_Attribute_Count() )
+								continue;
+
+							pPC_out->Set_Attribute(iField, pPC->Get_Attribute(iPoint, m_vAttrMapper.at(iField)));
+						}
 					}
 
 					bFound = true;
@@ -298,14 +463,14 @@ bool CPointCloud_Get_Subset_SPCVF_Base::Get_Subset(void)
 				continue;
 			}
 
-			Write_Subset(pPC_out, iAOI, iDatasets);
+			Write_Subset(pPC_out, iAOI, iDatasets, pSPCVF_Tiles, bAbsolutePaths);
 
 			pPC_out = NULL;
 		}
 	}
 
 	//---------------------------------------------------------
-	if( !m_bMultiple )
+	if( !m_bMultiple && pPC_out != NULL)
 	{
 		if( pPC_out != NULL && pPC_out->Get_Count() == 0 )
 		{
@@ -314,7 +479,19 @@ bool CPointCloud_Get_Subset_SPCVF_Base::Get_Subset(void)
 			return( true );
 		}
 
-		Write_Subset(pPC_out, 0, iDatasets);
+		Write_Subset(pPC_out, 0, iDatasets, pSPCVF_Tiles, bAbsolutePaths);
+	}
+
+
+	//-----------------------------------------------------
+	if( !m_sFileNameTileInfo.is_Empty() )
+	{
+		if( !SPCVF_Tile_Info.Save(m_sFileNameTileInfo) )
+		{
+			SG_UI_Msg_Add_Error(CSG_String::Format(_TL("Unable to save file %s!"), m_sFileNameTileInfo.c_str()));
+
+			return( false );
+		}
 	}
 
 	return( true );
@@ -322,7 +499,7 @@ bool CPointCloud_Get_Subset_SPCVF_Base::Get_Subset(void)
 
 
 //---------------------------------------------------------
-void CPointCloud_Get_Subset_SPCVF_Base::Write_Subset(CSG_PointCloud *pPC_out, int iAOI, int iDatasets)
+void CPointCloud_Get_Subset_SPCVF_Base::Write_Subset(CSG_PointCloud *pPC_out, int iAOI, int iDatasets, CSG_MetaData *pSPCVF_Tiles, bool bAbsolutePaths)
 {
 	CSG_String	sPath = SG_T("");
 
@@ -348,6 +525,35 @@ void CPointCloud_Get_Subset_SPCVF_Base::Write_Subset(CSG_PointCloud *pPC_out, in
 		pPC_out->Set_Name(CSG_String::Format(SG_T("%spc_subset_%s"), sPath.c_str(), SG_File_Get_Name(m_sFileName, false).c_str()));
 	}
 
+	//-----------------------------------------------------
+	if( pSPCVF_Tiles != NULL )
+	{
+		CSG_MetaData	*pDataset = pSPCVF_Tiles->Add_Child(SG_T("PointCloud"));
+
+		CSG_String		sTilePath;
+
+		if( bAbsolutePaths )
+			sTilePath = pPC_out->Get_Name();
+		else
+			sTilePath = SG_File_Get_Path_Relative(SG_File_Get_Path(m_sFileNameTileInfo), pPC_out->Get_Name());
+
+		sTilePath.Replace(SG_T("\\"), SG_T("/"));
+		sTilePath.Append(SG_T(".spc"));
+
+		pDataset->Add_Property(SG_T("File"), sTilePath);
+
+
+		//-----------------------------------------------------
+		CSG_MetaData	*pBBox = pDataset->Add_Child(SG_T("BBox"));
+
+		pBBox->Add_Property(SG_T("XMin"), m_AOI.Get_XMin() + m_dOverlap);
+		pBBox->Add_Property(SG_T("YMin"), m_AOI.Get_YMin() + m_dOverlap);
+		pBBox->Add_Property(SG_T("XMax"), m_AOI.Get_XMax() - m_dOverlap);
+		pBBox->Add_Property(SG_T("YMax"), m_AOI.Get_YMax() - m_dOverlap);
+	}
+
+
+	//-----------------------------------------------------
 	SG_UI_Msg_Add(CSG_String::Format(_TL("%d points from %d dataset(s) written to output point cloud %s."), pPC_out->Get_Count(), iDatasets, pPC_out->Get_Name()), true);
 
 	if( m_pFilePath == NULL )
@@ -382,7 +588,9 @@ CPointCloud_Get_Subset_SPCVF::CPointCloud_Get_Subset_SPCVF(void)
 		"point cloud dataset by applying the provided area-of-interest "
 		"(AOI). The extent of the AOI can be provided either as polygon "
 		"shapefile, grid or by coordinates. Optionally, an overlap can "
-		"be added to the AOI. In case an overlap is used and the AOI "
+		"be added to the AOI and a spcvf tile info file can be outputted. "
+		"The latter can be used to remove the overlap later.\n"
+		"In case an overlap is used and the AOI "
 		"is provided as polygon shapfile, only the bounding boxes of the "
 		"polygons are used.\n"
 		"With polygon shapefiles additional functionality is available:\n"
@@ -398,6 +606,8 @@ CPointCloud_Get_Subset_SPCVF::CPointCloud_Get_Subset_SPCVF(void)
 		"list or written to an output directory. For the latter, "
 		"you must provide a valid file path with the 'Optional Output "
 		"Filepath' parameter.\n"
+		"Optionally, the query can be constrained by providing an "
+		"attribute field and a value range that must be met.\n"
 		"A virtual point cloud dataset is a simple XML format "
 		"with the file extension .spcvf, which can be created "
 		"with the 'Create Virtual Point Cloud Dataset' module.\n\n"
@@ -427,6 +637,35 @@ CPointCloud_Get_Subset_SPCVF::CPointCloud_Get_Subset_SPCVF(void)
 		true, true, false
 	);
 
+	Parameters.Add_Value(
+		NULL	, "COPY_ATTR"	, _TL("Copy existing Attributes"),
+		_TL("Copy attributes from input to output point cloud."),
+		PARAMETER_TYPE_Bool, true
+	);
+	Parameters.Add_String(
+		Parameters("COPY_ATTR")	, "ATTRIBUTE_LIST"	, _TL("Copy Attributes"),
+		_TL("Field numbers (starting from 1) of the attributes to copy, separated by semicolon; fields one to three (x;y;z) are mandatory."),
+		SG_T("1;2;3")
+	);
+
+	Parameters.Add_Value(
+		NULL	, "CONSTRAIN_QUERY"	, _TL("Constrain Query"),
+		_TL("Check this parameter to constrain the query by an attribute range."),
+		PARAMETER_TYPE_Bool, false
+	);
+
+	Parameters.Add_Value(
+		Parameters("CONSTRAIN_QUERY")	, "ATTR_FIELD"	, _TL("Attribute Field"),
+		_TL("The attribute field to use as constraint. Field numbers start with 1."),
+		PARAMETER_TYPE_Int, 1, 1, true
+	);
+
+	Parameters.Add_Range(
+		Parameters("CONSTRAIN_QUERY")	, "VALUE_RANGE"	, _TL("Value Range"),
+		_TL("Minimum and maximum of attribute range []."),
+		2.0, 2.0
+	);
+
 
 	CSG_Parameter *pNode = Parameters.Add_Node(NULL, "NODE_AOI", _TL("AOI"), _TL("AOI Input Settings"));
 
@@ -468,6 +707,17 @@ CPointCloud_Get_Subset_SPCVF::CPointCloud_Get_Subset_SPCVF(void)
 		PARAMETER_TYPE_Double,
 		50.0, 0.0, true
 	);
+	Parameters.Add_FilePath(
+		Parameters("AOI_ADD_OVERLAP")	, "FILENAME_TILE_INFO"	, _TL("Optional Tile Info Filename"),
+		_TW("The full path and name of an optional spcvf tile info file. "
+		"Such a file contains information about the bounding boxes without "
+		"overlap and can be used to remove the overlap from the tiles later. "
+		"Leave empty to not output such a file."),
+		CSG_String::Format(SG_T("%s|%s|%s|%s"),
+			_TL("SAGA Point Cloud Virtual Format Tile Info (*.spcvf_tile_info)"), SG_T("*.spcvf_tile_info"),
+			_TL("All Files")													, SG_T("*.*")
+		), NULL, true, false, false
+	);
 
 	Parameters.Add_Value(
 		pNode	, "ONE_PC_PER_POLYGON"	, _TL("One Point Cloud per Polygon"),
@@ -489,32 +739,45 @@ bool CPointCloud_Get_Subset_SPCVF::On_Execute(void)
 	CSG_String		sFileName;
 	CSG_Parameter_PointCloud_List	*pPointCloudList = NULL;
 	CSG_Parameter_File_Name	*pFilePath = NULL;
+	bool			bConstrain;
+	int				iField;
+	double			dMinAttrRange, dMaxAttrRange;
 	CSG_Shapes		*pShapes;
 	int				iFieldName;
 	CSG_Grid		*pGrid = NULL;
 	double			dAoiXMin, dAoiYMin, dAoiXMax, dAoiYMax;
 	bool			bAddOverlap;
 	double			dOverlap;
+	CSG_String		sFileNameTileInfo;
 	bool			bMultiple;
 	int				iOutputs = 1;
 	CSG_Rect		AOI;
-
+	bool			bCopyAttr;
+	CSG_String		sAttrList;
 
 	//-----------------------------------------------------
-	sFileName		= Parameters("FILENAME")->asString();
-	pPointCloudList	= Parameters("PC_OUT")->asPointCloudList();
-	pFilePath		= Parameters("FILEPATH")->asFilePath();
-	pShapes			= Parameters("AOI_SHP")->asShapes();
-	iFieldName		= Parameters("FIELD_TILENAME")->asInt();
-	pGrid			= Parameters("AOI_GRID")->asGrid();
-	dAoiXMin		= Parameters("AOI_XRANGE")->asRange()->Get_LoVal();
-	dAoiXMax		= Parameters("AOI_XRANGE")->asRange()->Get_HiVal();
-	dAoiYMin		= Parameters("AOI_YRANGE")->asRange()->Get_LoVal();
-	dAoiYMax		= Parameters("AOI_YRANGE")->asRange()->Get_HiVal();
-
-	bAddOverlap		= Parameters("AOI_ADD_OVERLAP")->asBool();
-	dOverlap		= Parameters("OVERLAP")->asDouble();
-	bMultiple		= Parameters("ONE_PC_PER_POLYGON")->asBool();
+	sFileName			= Parameters("FILENAME")->asString();
+	pPointCloudList		= Parameters("PC_OUT")->asPointCloudList();
+	pFilePath			= Parameters("FILEPATH")->asFilePath();
+	bConstrain			= Parameters("CONSTRAIN_QUERY")->asBool();
+	iField				= Parameters("ATTR_FIELD")->asInt() - 1;
+	dMinAttrRange		= Parameters("VALUE_RANGE")->asRange()->Get_LoVal();
+	dMaxAttrRange		= Parameters("VALUE_RANGE")->asRange()->Get_HiVal();
+	pShapes				= Parameters("AOI_SHP")->asShapes();
+	iFieldName			= Parameters("FIELD_TILENAME")->asInt();
+	pGrid				= Parameters("AOI_GRID")->asGrid();
+	dAoiXMin			= Parameters("AOI_XRANGE")->asRange()->Get_LoVal();
+	dAoiXMax			= Parameters("AOI_XRANGE")->asRange()->Get_HiVal();
+	dAoiYMin			= Parameters("AOI_YRANGE")->asRange()->Get_LoVal();
+	dAoiYMax			= Parameters("AOI_YRANGE")->asRange()->Get_HiVal();
+
+	bAddOverlap			= Parameters("AOI_ADD_OVERLAP")->asBool();
+	dOverlap			= Parameters("OVERLAP")->asDouble();
+	sFileNameTileInfo	= Parameters("FILENAME_TILE_INFO")->asString();
+	bMultiple			= Parameters("ONE_PC_PER_POLYGON")->asBool();
+
+	bCopyAttr			= Parameters("COPY_ATTR")->asBool();
+	sAttrList			= Parameters("ATTRIBUTE_LIST")->asString();
 
 	if( pShapes == NULL )
 	{
@@ -522,7 +785,7 @@ bool CPointCloud_Get_Subset_SPCVF::On_Execute(void)
 	}
 
 	CSG_String	sPath = pFilePath->asString();
-	
+
 	if( sPath.Length() <= 1 )
 	{
 		pFilePath = NULL;
@@ -551,9 +814,13 @@ bool CPointCloud_Get_Subset_SPCVF::On_Execute(void)
 		AOI.Assign(dAoiXMin, dAoiYMin, dAoiXMax, dAoiYMax);
 	}
 
-	m_Get_Subset_SPCVF.Initialise(iOutputs, AOI, pShapes, iFieldName, bMultiple, bAddOverlap, dOverlap, sFileName, pFilePath, pPointCloudList);
+	if( !m_Get_Subset_SPCVF.Initialise(iOutputs, AOI, pShapes, iFieldName, bMultiple, bAddOverlap, dOverlap, sFileNameTileInfo, sFileName, pFilePath, pPointCloudList,
+								  bConstrain, iField, dMinAttrRange, dMaxAttrRange, bCopyAttr, sAttrList) )
+	{
+		return( false );
+	}
 
-	bool bResult = m_Get_Subset_SPCVF.Get_Subset();
+	bool bResult = m_Get_Subset_SPCVF.Get_Subset(bCopyAttr);
 
 	//---------------------------------------------------------
 	if( SG_UI_Get_Window_Main() )
@@ -569,7 +836,7 @@ bool CPointCloud_Get_Subset_SPCVF::On_Execute(void)
 			}
 
 			DataObject_Set_Parameters(pPointCloudList->asPointCloud(i), sParms);
-	
+
 			DataObject_Update(pPointCloudList->asPointCloud(i));
 		}
 	}
@@ -583,9 +850,21 @@ bool CPointCloud_Get_Subset_SPCVF::On_Execute(void)
 //---------------------------------------------------------
 int CPointCloud_Get_Subset_SPCVF::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
+	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("COPY_ATTR")) )
+	{
+		pParameters->Get_Parameter("ATTRIBUTE_LIST"		)->Set_Enabled(pParameter->asBool() == false);
+	}
+
+	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("CONSTRAIN_QUERY")) )
+	{
+		pParameters->Get_Parameter("ATTR_FIELD"			)->Set_Enabled(pParameter->asBool());
+		pParameters->Get_Parameter("VALUE_RANGE"		)->Set_Enabled(pParameter->asBool());
+	}
+
 	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("AOI_ADD_OVERLAP")) )
 	{
-		pParameters->Get_Parameter("OVERLAP")->Set_Enabled(pParameter->asBool());
+		pParameters->Get_Parameter("OVERLAP"			)->Set_Enabled(pParameter->asBool());
+		pParameters->Get_Parameter("FILENAME_TILE_INFO"	)->Set_Enabled(pParameter->asBool());
 	}
 
 	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("AOI_SHP")) )
@@ -593,7 +872,7 @@ int CPointCloud_Get_Subset_SPCVF::On_Parameters_Enable(CSG_Parameters *pParamete
 		pParameters->Get_Parameter("FIELD_TILENAME"		)->Set_Enabled(pParameter->asShapes() != NULL);
 		pParameters->Get_Parameter("ONE_PC_PER_POLYGON"	)->Set_Enabled(pParameter->asShapes() != NULL);
 	}
-	
+
 	//-----------------------------------------------------
 	return (1);
 }
@@ -615,6 +894,8 @@ CPointCloud_Get_Subset_SPCVF_Interactive::CPointCloud_Get_Subset_SPCVF_Interacti
 	Set_Description	(_TW(
 		"The module allows to retrieve a point cloud from a virtual "
 		"point cloud dataset by dragging a box (AOI) in a Map View.\n"
+		"Optionally, the query can be constrained by providing an "
+		"attribute field and a value range that must be met.\n"
 		"A virtual point cloud dataset is a simple XML format "
 		"with the file extension .spcvf, which can be created "
 		"with the 'Create Virtual Point Cloud Dataset' module.\n\n"
@@ -636,6 +917,34 @@ CPointCloud_Get_Subset_SPCVF_Interactive::CPointCloud_Get_Subset_SPCVF_Interacti
 		_TL("The output point cloud")
 	);
 
+	Parameters.Add_Value(
+		NULL	, "COPY_ATTR"	, _TL("Copy existing Attributes"),
+		_TL("Copy attributes from input to output point cloud."),
+		PARAMETER_TYPE_Bool, true
+	);
+	Parameters.Add_String(
+		Parameters("COPY_ATTR")	, "ATTRIBUTE_LIST"	, _TL("Copy Attributes"),
+		_TL("Field numbers (starting from 1) of the attributes to copy, separated by semicolon; fields one to three (x;y;z) are mandatory."),
+		SG_T("1;2;3")
+	);
+
+	Parameters.Add_Value(
+		NULL	, "CONSTRAIN_QUERY"	, _TL("Constrain Query"),
+		_TL("Check this parameter to constrain the query by an attribute range."),
+		PARAMETER_TYPE_Bool, false
+	);
+
+	Parameters.Add_Value(
+		Parameters("CONSTRAIN_QUERY")	, "ATTR_FIELD"	, _TL("Attribute Field"),
+		_TL("The attribute field to use as constraint. Field numbers start with 1."),
+		PARAMETER_TYPE_Int, 1, 1, true
+	);
+
+	Parameters.Add_Range(
+		Parameters("CONSTRAIN_QUERY")	, "VALUE_RANGE"	, _TL("Value Range"),
+		_TL("Minimum and maximum of attribute range []."),
+		2.0, 2.0
+	);
 }
 
 
@@ -674,9 +983,15 @@ bool CPointCloud_Get_Subset_SPCVF_Interactive::On_Execute_Position(CSG_Point ptW
 
 		// as long as this module only supports to drag a box, we initialize it with a fake overlap in order
 		// to use CSG_Rect instead of CSG_Shape for point in polygon check in Get_Subset():
-		m_Get_Subset_SPCVF.Initialise(1, AOI, NULL, -1, false, true, 0.0, Parameters("FILENAME")->asString(), NULL, &PointCloudList);
+		if( !m_Get_Subset_SPCVF.Initialise(1, AOI, NULL, -1, false, true, 0.0, SG_T(""), Parameters("FILENAME")->asString(), NULL, &PointCloudList,
+									  Parameters("CONSTRAIN_QUERY")->asBool(), Parameters("ATTR_FIELD")->asInt()-1,
+									  Parameters("VALUE_RANGE")->asRange()->Get_LoVal(), Parameters("VALUE_RANGE")->asRange()->Get_HiVal(),
+									  Parameters("COPY_ATTR")->asBool(), Parameters("ATTRIBUTE_LIST")->asString()) )
+		{
+			return( false );
+		}
 
-		bool bResult = m_Get_Subset_SPCVF.Get_Subset();
+		bool bResult = m_Get_Subset_SPCVF.Get_Subset(Parameters("COPY_ATTR")->asBool());
 
 		if( bResult )
 		{
@@ -692,7 +1007,7 @@ bool CPointCloud_Get_Subset_SPCVF_Interactive::On_Execute_Position(CSG_Point ptW
 			}
 
 			DataObject_Set_Parameters(pPC, sParms);
-	
+
 			DataObject_Update(pPC, SG_UI_DATAOBJECT_SHOW_LAST_MAP);
 		}
 
@@ -705,6 +1020,25 @@ bool CPointCloud_Get_Subset_SPCVF_Interactive::On_Execute_Position(CSG_Point ptW
 }
 
 
+//---------------------------------------------------------
+int CPointCloud_Get_Subset_SPCVF_Interactive::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+{
+	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("COPY_ATTR")) )
+	{
+		pParameters->Get_Parameter("ATTRIBUTE_LIST"		)->Set_Enabled(pParameter->asBool() == false);
+	}
+
+	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("CONSTRAIN_QUERY")) )
+	{
+		pParameters->Get_Parameter("ATTR_FIELD"			)->Set_Enabled(pParameter->asBool());
+		pParameters->Get_Parameter("VALUE_RANGE"		)->Set_Enabled(pParameter->asBool());
+	}
+
+	//-----------------------------------------------------
+	return (1);
+}
+
+
 ///////////////////////////////////////////////////////////
 //														 //
 //														 //
diff --git a/src/modules/io/io_virtual/pc_get_subset_spcvf.h b/src/modules/io/io_virtual/pc_get_subset_spcvf.h
index efd5242..dcd99d2 100644
--- a/src/modules/io/io_virtual/pc_get_subset_spcvf.h
+++ b/src/modules/io/io_virtual/pc_get_subset_spcvf.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: pc_get_subset_spcvf.h 2209 2014-08-28 12:24:03Z reklov_w $
+ * Version $Id: pc_get_subset_spcvf.h 2384 2015-02-01 15:18:44Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -74,6 +74,8 @@
 
 //---------------------------------------------------------
 #include "MLB_Interface.h"
+#include <vector>
+#include <algorithm>
 
 
 ///////////////////////////////////////////////////////////
@@ -89,10 +91,13 @@ public:
 	CPointCloud_Get_Subset_SPCVF_Base(void);
 	virtual ~CPointCloud_Get_Subset_SPCVF_Base(void);
 
-	void					Initialise	(int iOutputs, CSG_Rect	AOI, CSG_Shapes *pShapes, int iFieldName, bool bMultiple, bool bAddOverlap, double dOverlap, CSG_String sFilename, CSG_Parameter_File_Name *pFilePath, CSG_Parameter_PointCloud_List *pPointCloudList);
+	bool					Initialise	(int iOutputs, CSG_Rect	AOI, CSG_Shapes *pShapes, int iFieldName, bool bMultiple, bool bAddOverlap, double dOverlap,
+										 CSG_String sFileNameTileInfo, CSG_String sFilename, CSG_Parameter_File_Name *pFilePath,
+										 CSG_Parameter_PointCloud_List *pPointCloudList, bool bConstrain, int iField, double dMinAttrRange, double dMaxAttrRange,
+										 bool bCopyAttr, CSG_String sAttrList);
 	void					Finalise	(void);
-	bool					Get_Subset	(void);
-	void					Write_Subset(CSG_PointCloud *pPC_out, int iAOI, int iDatasets);
+	bool					Get_Subset	(bool bCopyAttr);
+	void					Write_Subset(CSG_PointCloud *pPC_out, int iAOI, int iDatasets, CSG_MetaData *pSPCVF_Tiles, bool bAbsolutePaths);
 
 protected:
 
@@ -105,9 +110,14 @@ private:
 	int						m_iFieldName;
 	bool					m_bMultiple, m_bAddOverlap;
 	double					m_dOverlap;
+	CSG_String				m_sFileNameTileInfo;
 	CSG_String				m_sFileName;
 	CSG_Parameter_File_Name	*m_pFilePath;
 	CSG_Parameter_PointCloud_List	*m_pPointCloudList;
+	bool					m_bConstrain;
+	int						m_iField;
+	double					m_dMinAttrRange, m_dMaxAttrRange;
+	std::vector<int>		m_vAttrMapper;
 
 };
 
@@ -149,6 +159,8 @@ protected:
 	virtual bool				On_Execute			(void);
 	virtual bool				On_Execute_Position	(CSG_Point ptWorld, TSG_Module_Interactive_Mode Mode);
 
+	virtual int					On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+
 
 private:
 
diff --git a/src/modules/io/io_virtual/pc_tileshape_from_spcvf.cpp b/src/modules/io/io_virtual/pc_remove_overlap_from_spcvf.cpp
similarity index 63%
copy from src/modules/io/io_virtual/pc_tileshape_from_spcvf.cpp
copy to src/modules/io/io_virtual/pc_remove_overlap_from_spcvf.cpp
index 564fcd7..57ab761 100644
--- a/src/modules/io/io_virtual/pc_tileshape_from_spcvf.cpp
+++ b/src/modules/io/io_virtual/pc_remove_overlap_from_spcvf.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: pc_tileshape_from_spcvf.cpp 2015 2014-02-25 14:32:09Z reklov_w $
+ * Version $Id: pc_remove_overlap_from_spcvf.cpp 2359 2014-12-27 12:46:46Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -13,7 +13,7 @@
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//              pc_tileshape_from_spcvf.cpp              //
+//            pc_remove_overlap_from_spcvf.cpp           //
 //                                                       //
 //                 Copyright (C) 2014 by                 //
 //                    Volker Wichmann                    //
@@ -62,7 +62,7 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#include "pc_tileshape_from_spcvf.h"
+#include "pc_remove_overlap_from_spcvf.h"
 
 
 ///////////////////////////////////////////////////////////
@@ -72,35 +72,44 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-CPointCloud_Create_Tileshape_From_SPCVF::CPointCloud_Create_Tileshape_From_SPCVF(void)
+CPointCloud_Remove_Overlap_From_SPCVF::CPointCloud_Remove_Overlap_From_SPCVF(void)
 {
-	Set_Name		(_TL("Create Tileshape from Virtual Point Cloud"));
+	Set_Name		(_TL("Remove Overlap from Virtual Point Cloud Tiles"));
 
 	Set_Author		(SG_T("V. Wichmann, LASERDATA GmbH (c) 2014"));
 
 	Set_Description	(_TW(
-		"The module allows to create a polygon shapefile with the "
-		"bounding boxes of a virtual point cloud dataset.\n"
+		"The module allows to remove the overlap from point cloud "
+		"tiles created from a virtual point cloud dataset. The "
+		"tiles must have been created with an overlap and a spcvf "
+		"tile info file must have been outputted too. The latter "
+		"decribes the original bounding boxes of the tiles (i.e. "
+		"without overlap) and is used by this module to remove "
+		"the overlap.\n"
 		"A virtual point cloud dataset is a simple XML format "
 		"with the file extension .spcvf, which can be created "
-		"with the 'Create Virtual Point Cloud Dataset' module.\n\n"
+		"with the 'Create Virtual Point Cloud Dataset' module. "
+		"Point cloud tiles with an overlap are usually created "
+		"from such an virtual point cloud dataset with the "
+		"'Get Subset from Virtual Point Cloud' module.\n\n"
 	));
 
 
 	//-----------------------------------------------------
 	Parameters.Add_FilePath(
-		NULL	, "FILENAME"		, _TL("Filename"),
-		_TL("The full path and name of the .spcvf file"),
+		NULL	, "FILENAME"		, _TL("Tile Info File"),
+		_TL("The full path and name of the spcvf tile info file describing the point cloud tiles without overlap"),
 		CSG_String::Format(SG_T("%s|%s|%s|%s"),
-			_TL("SAGA Point Cloud Virtual Format (*.spcvf)")	, SG_T("*.spcvf"),
-			_TL("All Files")									, SG_T("*.*")
+			_TL("SAGA Point Cloud Virtual Format Tile Info (*.spcvf_tile_info)"), SG_T("*.spcvf_tile_info"),
+			_TL("All Files")													, SG_T("*.*")
 		)
  	);
 
-	Parameters.Add_Shapes(
-		NULL	, "TILE_SHP"		, _TL("Tileshape"),
-		_TL("Polygon shapefile describing the bounding boxes of spcvf tiles."),
-		PARAMETER_OUTPUT, SHAPE_TYPE_Polygon
+	Parameters.Add_FilePath(
+		NULL	, "FILEPATH"		, _TL("Output Filepath"),
+		_TL("The full path to which the point cloud tiles without overlap should be written."),
+		(const wchar_t *)0, (const wchar_t *)0,
+		true, true, false
 	);
 }
 
@@ -112,33 +121,38 @@ CPointCloud_Create_Tileshape_From_SPCVF::CPointCloud_Create_Tileshape_From_SPCVF
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CPointCloud_Create_Tileshape_From_SPCVF::On_Execute(void)
+bool CPointCloud_Remove_Overlap_From_SPCVF::On_Execute(void)
 {
 	CSG_String		sFileName;
-	CSG_Shapes		*pShapes;
+	CSG_Parameter_File_Name	*pFilePath = NULL;
 
-	CSG_MetaData	SPCVF;
+	CSG_MetaData	SPCVF_Tile_Info;
 	CSG_String		sPathSPCVF, sFilePath;
-	int				iPoints;
 	double			dBBoxXMin, dBBoxYMin, dBBoxXMax, dBBoxYMax;
 
 
 	//-----------------------------------------------------
 	sFileName	= Parameters("FILENAME")->asString();
-	pShapes		= Parameters("TILE_SHP")->asShapes();
+	pFilePath	= Parameters("FILEPATH")->asFilePath();
 	
 
 	//-----------------------------------------------------
-	if( !SPCVF.Create(sFileName) || SPCVF.Get_Name().CmpNoCase(SG_T("SPCVFDataset")) )
+	if( !pFilePath->is_Valid() || !pFilePath->is_Directory() )
+	{
+		SG_UI_Msg_Add_Error(_TL("Please provide a valid output file path!"));
+		return( false );
+	}
+
+	if( !SPCVF_Tile_Info.Create(sFileName) || SPCVF_Tile_Info.Get_Name().CmpNoCase(SG_T("SPCVF_Tile_Info")) )
 	{
-		SG_UI_Msg_Add_Error(_TL("Please provide a valid *.scpvf file!"));
+		SG_UI_Msg_Add_Error(_TL("Please provide a valid *.scpvf_tile_info file!"));
 		return( false );
 	}
 
 
 	//-----------------------------------------------------
 	CSG_String	sMethodPaths;
-	SPCVF.Get_Property(SG_T("Paths"), sMethodPaths);
+	SPCVF_Tile_Info.Get_Property(SG_T("Paths"), sMethodPaths);
 
 	if( !sMethodPaths.CmpNoCase(SG_T("absolute")) )
 	{
@@ -151,61 +165,68 @@ bool CPointCloud_Create_Tileshape_From_SPCVF::On_Execute(void)
 	}
 	else
 	{
-		SG_UI_Msg_Add_Error(_TL("Encountered invalid path description in *.spcvf file!"));
+		SG_UI_Msg_Add_Error(_TL("Encountered invalid path description in *.spcvf_tile_info file!"));
 		return( false );
 	}
 
 
 	//-----------------------------------------------------
-	pShapes->Destroy();
-
-	pShapes->Add_Field(_TL("ID"),		SG_DATATYPE_Int);
-	pShapes->Add_Field(_TL("Filepath"),	SG_DATATYPE_String);
-	pShapes->Add_Field(_TL("File"),		SG_DATATYPE_String);
-	pShapes->Add_Field(_TL("Points"),	SG_DATATYPE_Int);
-
-	pShapes->Set_Name(CSG_String::Format(_TL("Tileshape_%s"), SG_File_Get_Name(sFileName, false).c_str()));
-
-
-	//-----------------------------------------------------
-	CSG_MetaData	*pDatasets = SPCVF.Get_Child(SG_T("Datasets"));
+	CSG_MetaData	*pDatasets = SPCVF_Tile_Info.Get_Child(SG_T("Tiles"));
 
 	for(int i=0; i<pDatasets->Get_Children_Count(); i++)
 	{
 		CSG_MetaData	*pDataset	= pDatasets->Get_Child(i);
 		CSG_MetaData	*pBBox		= pDataset->Get_Child(SG_T("BBox"));
 
-		pDataset->Get_Property(SG_T("File"), sFilePath);
-
-		pDataset->Get_Property(SG_T("Points"), iPoints);
-
 		pBBox->Get_Property(SG_T("XMin"), dBBoxXMin);
 		pBBox->Get_Property(SG_T("YMin"), dBBoxYMin);
 		pBBox->Get_Property(SG_T("XMax"), dBBoxXMax);
 		pBBox->Get_Property(SG_T("YMax"), dBBoxYMax);
 
+		CSG_Rect BBox(dBBoxXMin, dBBoxYMin, dBBoxXMax, dBBoxYMax);
+
+		CSG_String sFilePath;
+
+		pDataset->Get_Property(SG_T("File"), sFilePath);
+		sFilePath.Prepend(sPathSPCVF);
+
 		//-----------------------------------------------------
-		CSG_Shape	*pShape = pShapes->Add_Shape();
+		CSG_PointCloud	*pPC = SG_Create_PointCloud(sFilePath);
 
-		pShape->Add_Point(dBBoxXMin, dBBoxYMin);
-		pShape->Add_Point(dBBoxXMin, dBBoxYMax);
-		pShape->Add_Point(dBBoxXMax, dBBoxYMax);
-		pShape->Add_Point(dBBoxXMax, dBBoxYMin);
+		CSG_PointCloud	*pPC_out = SG_Create_PointCloud(pPC);
 
-		pShape->Set_Value(0, i + 1);
+		for(int iPoint=0; iPoint<pPC->Get_Count(); iPoint++)
+		{
+			if( dBBoxXMin <= pPC->Get_X(iPoint) && pPC->Get_X(iPoint) < dBBoxXMax &&
+				dBBoxYMin <= pPC->Get_Y(iPoint) && pPC->Get_Y(iPoint) < dBBoxYMax )
+			{
+				pPC_out->Add_Point(pPC->Get_X(iPoint), pPC->Get_Y(iPoint), pPC->Get_Z(iPoint));
+
+				for(int iField=0; iField<pPC->Get_Attribute_Count(); iField++)
+				{
+					pPC_out->Set_Attribute(iField, pPC->Get_Attribute(iPoint, iField));
+				}
+			}
+		}
 
-		if( sPathSPCVF.Length() == 0 )	// absolute paths
+		if( pPC_out->Get_Point_Count() > 0 )
 		{
-			pShape->Set_Value(1, sFilePath.BeforeLast('/'));
-			pShape->Set_Value(2, sFilePath.AfterLast('/'));
+			CSG_String	sPath;
+
+			sPath = pFilePath->asString();
+			sPath += SG_T("/");
+
+			pPC_out->Set_Name(CSG_String::Format(SG_T("%s%s"), sPath.c_str(), SG_File_Get_Name(pPC->Get_Name(), false).c_str()));
+	
+			pPC_out->Save(pPC_out->Get_Name());
 		}
-		else							// relative paths
+		else
 		{
-			pShape->Set_Value(1, sPathSPCVF);
-			pShape->Set_Value(2, sFilePath);
+			SG_UI_Msg_Add(CSG_String::Format(_TL("Point Cloud %s is empty after removing overlap, skipping dataset!"), SG_File_Get_Name(pPC->Get_Name(), false).c_str()), true);
 		}
-
-		pShape->Set_Value(3, iPoints);
+		
+		delete( pPC );
+		delete( pPC_out );
 	}
 
 
diff --git a/src/modules/terrain_analysis/ta_channels/Watersheds.h b/src/modules/io/io_virtual/pc_remove_overlap_from_spcvf.h
similarity index 74%
copy from src/modules/terrain_analysis/ta_channels/Watersheds.h
copy to src/modules/io/io_virtual/pc_remove_overlap_from_spcvf.h
index c95f36b..f8840dd 100644
--- a/src/modules/terrain_analysis/ta_channels/Watersheds.h
+++ b/src/modules/io/io_virtual/pc_remove_overlap_from_spcvf.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Watersheds.h 1922 2014-01-09 10:28:46Z oconrad $
+ * Version $Id: pc_remove_overlap_from_spcvf.h 2359 2014-12-27 12:46:46Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -9,14 +9,14 @@
 //      System for Automated Geoscientific Analyses      //
 //                                                       //
 //                    Module Library:                    //
-//                      ta_channels                      //
+//                      io_virtual                       //
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//                     Watersheds.h                      //
+//             pc_remove_overlap_from_spcvf.h            //
 //                                                       //
-//                 Copyright (C) 2003 by                 //
-//                      Olaf Conrad                      //
+//                 Copyright (C) 2014 by                 //
+//                    Volker Wichmann                    //
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
@@ -40,14 +40,15 @@
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//    e-mail:     oconrad at saga-gis.org                   //
+//    e-mail:     wichmann at laserdata.at                  //
 //                                                       //
-//    contact:    Olaf Conrad                            //
-//                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
-//                Germany                                //
+//    contact:    LASERDATA GmbH                         //
+//                Management and Analysis of             //
+//                Laserscanning Data                     //
+//                Technikerstr. 21a                      //
+//                6020 Innsbruck                         //
+//                Austria                                //
+//                www.laserdata.at                       //
 //                                                       //
 ///////////////////////////////////////////////////////////
 
@@ -61,8 +62,8 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#ifndef HEADER_INCLUDED__Watersheds_H
-#define HEADER_INCLUDED__Watersheds_H
+#ifndef HEADER_INCLUDED__pc_remove_overlap_from_spcvf_H
+#define HEADER_INCLUDED__pc_remove_overlap_from_spcvf_H
 
 
 ///////////////////////////////////////////////////////////
@@ -82,27 +83,21 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-class ta_channels_EXPORT CWatersheds : public CSG_Module_Grid
+class CPointCloud_Remove_Overlap_From_SPCVF : public CSG_Module
 {
 public:
-	CWatersheds(void);
-	virtual ~CWatersheds(void);
+	CPointCloud_Remove_Overlap_From_SPCVF(void);
+
+	virtual CSG_String			Get_MenuPath		(void)	{	return( _TL("R:Point Cloud") );	}
 
 
 protected:
 
-	virtual bool			On_Execute	(void);
+	virtual bool				On_Execute			(void);
 
 
 private:
 
-	int						m_nBasins;
-
-	CSG_Grid					*m_pBasins, m_Direction;
-
-
-	int						Get_Basin	(int x, int y);
-
 };
 
 
@@ -113,4 +108,4 @@ private:
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED__Watersheds_H
+#endif // #ifndef HEADER_INCLUDED__pc_remove_overlap_from_spcvf_H
diff --git a/src/modules/io/io_virtual/pc_tileshape_from_spcvf.cpp b/src/modules/io/io_virtual/pc_tileshape_from_spcvf.cpp
index 564fcd7..60273b0 100644
--- a/src/modules/io/io_virtual/pc_tileshape_from_spcvf.cpp
+++ b/src/modules/io/io_virtual/pc_tileshape_from_spcvf.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: pc_tileshape_from_spcvf.cpp 2015 2014-02-25 14:32:09Z reklov_w $
+ * Version $Id: pc_tileshape_from_spcvf.cpp 2390 2015-02-02 15:11:13Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -80,7 +80,9 @@ CPointCloud_Create_Tileshape_From_SPCVF::CPointCloud_Create_Tileshape_From_SPCVF
 
 	Set_Description	(_TW(
 		"The module allows to create a polygon shapefile with the "
-		"bounding boxes of a virtual point cloud dataset.\n"
+		"bounding boxes of a virtual point cloud dataset. Additionally, "
+		"the header information of the chosen virtual point cloud "
+		"dataset is reported (since SPCVFDataset version 1.1).\n"
 		"A virtual point cloud dataset is a simple XML format "
 		"with the file extension .spcvf, which can be created "
 		"with the 'Create Virtual Point Cloud Dataset' module.\n\n"
@@ -120,7 +122,7 @@ bool CPointCloud_Create_Tileshape_From_SPCVF::On_Execute(void)
 	CSG_MetaData	SPCVF;
 	CSG_String		sPathSPCVF, sFilePath;
 	int				iPoints;
-	double			dBBoxXMin, dBBoxYMin, dBBoxXMax, dBBoxYMax;
+	double			dBBoxXMin, dBBoxYMin, dBBoxXMax, dBBoxYMax, dZMin, dZMax;
 
 
 	//-----------------------------------------------------
@@ -157,6 +159,64 @@ bool CPointCloud_Create_Tileshape_From_SPCVF::On_Execute(void)
 
 
 	//-----------------------------------------------------
+	CSG_MetaData	*pSPCVFHeader = SPCVF.Get_Child(SG_T("Header"));
+
+	if( pSPCVFHeader != NULL )	// i.e. we have a file version >= 1.1
+	{
+		int				iValue;
+		double			dValue;
+		CSG_String		sValue;
+		CSG_Projection	projSPCVF;
+
+		SG_UI_Msg_Add(SG_T(""), true);
+		SG_UI_Msg_Add(_TL("Metadata from Header:"), true);
+
+		pSPCVFHeader->Get_Child(SG_T("Datasets"))->Get_Property(SG_T("Count"), iValue);
+		SG_UI_Msg_Add(CSG_String::Format(_TL("Total number of referenced datasets: %d"), iValue), true);
+
+		pSPCVFHeader->Get_Child(SG_T("Points"))->Get_Property(SG_T("Count"), sValue);
+		SG_UI_Msg_Add(CSG_String::Format(_TL("Total number of points: %s"), sValue.c_str()), true);
+
+		pSPCVFHeader->Get_Child(SG_T("SRS"))->Get_Property(SG_T("Projection"), sValue);
+		SG_UI_Msg_Add(CSG_String::Format(_TL("Spatial Reference System: %s"), sValue.c_str()), true);
+
+		if( pSPCVFHeader->Get_Child(SG_T("SRS"))->Get_Property(SG_T("WKT"), sValue) )
+			SG_UI_Msg_Add(CSG_String::Format(_TL("WKT: %s"), sValue.c_str()), true);
+
+		pSPCVFHeader->Get_Child(SG_T("NoData"))->Get_Property(SG_T("Value"), dValue);
+		SG_UI_Msg_Add(CSG_String::Format(_TL("NoData Value: %.6f"), dValue), true);
+
+		SG_UI_Msg_Add(SG_T(""), true);
+		SG_UI_Msg_Add(_TL("Overall Bounding Box:"), true);
+		pSPCVFHeader->Get_Child(SG_T("BBox"))->Get_Property(SG_T("XMin"), dValue);
+		SG_UI_Msg_Add(CSG_String::Format(_TL("XMin: %.6f"), dValue), true);
+		pSPCVFHeader->Get_Child(SG_T("BBox"))->Get_Property(SG_T("YMin"), dValue);
+		SG_UI_Msg_Add(CSG_String::Format(_TL("YMin: %.6f"), dValue), true);
+		pSPCVFHeader->Get_Child(SG_T("BBox"))->Get_Property(SG_T("XMax"), dValue);
+		SG_UI_Msg_Add(CSG_String::Format(_TL("XMax: %.6f"), dValue), true);
+		pSPCVFHeader->Get_Child(SG_T("BBox"))->Get_Property(SG_T("YMax"), dValue);
+		SG_UI_Msg_Add(CSG_String::Format(_TL("YMax: %.6f"), dValue), true);
+		pSPCVFHeader->Get_Child(SG_T("ZStats"))->Get_Property(SG_T("ZMin"), dValue);
+		SG_UI_Msg_Add(CSG_String::Format(_TL("ZMin: %.6f"), dValue), true);
+		pSPCVFHeader->Get_Child(SG_T("ZStats"))->Get_Property(SG_T("ZMax"), dValue);
+		SG_UI_Msg_Add(CSG_String::Format(_TL("ZMax: %.6f"), dValue), true);
+
+		SG_UI_Msg_Add(SG_T(""), true);
+		pSPCVFHeader->Get_Child(SG_T("Attributes"))->Get_Property(SG_T("Count"), iValue);
+		SG_UI_Msg_Add(CSG_String::Format(_TL("Number of attribute fields: %d"), iValue), true);
+
+		for (int iField=0; iField<iValue; iField++)
+		{
+			CSG_MetaData	*pField = pSPCVFHeader->Get_Child(SG_T("Attributes"))->Get_Child(CSG_String::Format(SG_T("Field_%d"), iField + 1));
+			pField->Get_Property(SG_T("Name"), sValue);
+			SG_UI_Msg_Add(CSG_String::Format(_TL("Field %d: Name=\"%s\" "), iField + 1, sValue.c_str()), true);
+			pField->Get_Property(SG_T("Type"), sValue);
+			SG_UI_Msg_Add(CSG_String::Format(_TL("Type=\"%s\""), sValue.c_str()), false);
+		}
+	}
+
+
+	//-----------------------------------------------------
 	pShapes->Destroy();
 
 	pShapes->Add_Field(_TL("ID"),		SG_DATATYPE_Int);
@@ -164,6 +224,12 @@ bool CPointCloud_Create_Tileshape_From_SPCVF::On_Execute(void)
 	pShapes->Add_Field(_TL("File"),		SG_DATATYPE_String);
 	pShapes->Add_Field(_TL("Points"),	SG_DATATYPE_Int);
 
+	if( pSPCVFHeader != NULL )
+	{
+		pShapes->Add_Field(_TL("ZMin"),		SG_DATATYPE_Double);
+		pShapes->Add_Field(_TL("ZMax"),		SG_DATATYPE_Double);
+	}
+
 	pShapes->Set_Name(CSG_String::Format(_TL("Tileshape_%s"), SG_File_Get_Name(sFileName, false).c_str()));
 
 
@@ -206,6 +272,15 @@ bool CPointCloud_Create_Tileshape_From_SPCVF::On_Execute(void)
 		}
 
 		pShape->Set_Value(3, iPoints);
+
+		if( pSPCVFHeader != NULL )
+		{
+			pDataset->Get_Property(SG_T("ZMin"), dZMin);
+			pDataset->Get_Property(SG_T("ZMax"), dZMax);
+
+			pShape->Set_Value(4, dZMin);
+			pShape->Set_Value(5, dZMax);
+		}
 	}
 
 
diff --git a/src/modules/pointcloud/pointcloud_tools/Makefile.in b/src/modules/pointcloud/pointcloud_tools/Makefile.in
index 3bc0985..ccdb7cb 100644
--- a/src/modules/pointcloud/pointcloud_tools/Makefile.in
+++ b/src/modules/pointcloud/pointcloud_tools/Makefile.in
@@ -497,22 +497,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pc_transform.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/pointcloud/pointcloud_tools/pc_cut.cpp b/src/modules/pointcloud/pointcloud_tools/pc_cut.cpp
index 4a7870a..fa42eb9 100644
--- a/src/modules/pointcloud/pointcloud_tools/pc_cut.cpp
+++ b/src/modules/pointcloud/pointcloud_tools/pc_cut.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: pc_cut.cpp 2322 2014-11-03 21:29:57Z johanvdw $
+ * Version $Id: pc_cut.cpp 2427 2015-02-26 16:24:53Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -77,10 +77,11 @@ CPC_Cut::CPC_Cut(void)
 	//-----------------------------------------------------
 	Set_Name		(_TL("Point Cloud Cutter"));
 
-	Set_Author		(SG_T("O. Conrad, V. Wichmann (c) 2009-10"));
+	Set_Author		(SG_T("O. Conrad, V. Wichmann (c) 2009-15"));
 
 	Set_Description	(_TW(
-		"This modules allows one to extract subsets from a Point Cloud. The area-of-interest "
+		"This modules allows one to extract subsets from one or several "
+		"point cloud datasets. The area-of-interest "
 		"is defined either by bounding box coordinates, the extent of a grid system or "
 		"a shapes layer, or by polygons of a shapes layer. Note that the latter "
 		"does not support the inverse selection.\n\n"
@@ -88,15 +89,15 @@ CPC_Cut::CPC_Cut(void)
 
 
 	//-----------------------------------------------------
-	Parameters.Add_PointCloud(
+	Parameters.Add_PointCloud_List(
 		NULL	, "POINTS"		, _TL("Points"),
-		_TL(""),
+		_TL("One or several input point cloud datasets to cut."),
 		PARAMETER_INPUT
 	);
 
-	Parameters.Add_PointCloud(
+	Parameters.Add_PointCloud_List(
 		NULL	, "CUT"			, _TL("Cut"),
-		_TL(""),
+		_TL("The cutted output point cloud dataset(s)."),
 		PARAMETER_OUTPUT
 	);
 
@@ -154,8 +155,8 @@ CPC_Cut::CPC_Cut(void)
 //---------------------------------------------------------
 bool CPC_Cut::On_Execute(void)
 {
-	CSG_PointCloud	*pPoints	= Parameters("POINTS")	->asPointCloud();
-	CSG_PointCloud	*pCut		= Parameters("CUT")		->asPointCloud();
+	CSG_Parameter_PointCloud_List	*pPointsList	= Parameters("POINTS")	->asPointCloudList();
+	CSG_Parameter_PointCloud_List	*pCutList		= Parameters("CUT")		->asPointCloudList();
 
 	switch( Parameters("AREA")->asInt() )
 	{
@@ -170,7 +171,7 @@ bool CPC_Cut::On_Execute(void)
 				Get_Parameters("USER")->Get_Parameter("YMAX")->asDouble()
 			);
 
-			return( Get_Cut(pPoints, pCut, r, Parameters("INVERSE")->asBool()) );
+			return( Get_Cut(pPointsList, pCutList, r, Parameters("INVERSE")->asBool()) );
 		}
 		break;
 
@@ -178,7 +179,7 @@ bool CPC_Cut::On_Execute(void)
 	case 1:	// Grid System Extent
 		if( Dlg_Parameters("GRID") )
 		{
-			return( Get_Cut(pPoints, pCut, Get_Parameters("GRID")->Get_Parameter("GRID")->asGrid_System()->Get_Extent(), Parameters("INVERSE")->asBool()) );
+			return( Get_Cut(pPointsList, pCutList, Get_Parameters("GRID")->Get_Parameter("GRID")->asGrid_System()->Get_Extent(), Parameters("INVERSE")->asBool()) );
 		}
 		break;
 
@@ -193,7 +194,7 @@ bool CPC_Cut::On_Execute(void)
 				return( false );
 			}
 
-			return( Get_Cut(pPoints, pCut, Get_Parameters("EXTENT")->Get_Parameter("EXTENT")->asShapes()->Get_Extent(), Parameters("INVERSE")->asBool()) );
+			return( Get_Cut(pPointsList, pCutList, Get_Parameters("EXTENT")->Get_Parameter("EXTENT")->asShapes()->Get_Extent(), Parameters("INVERSE")->asBool()) );
 		}
 		break;
 
@@ -215,7 +216,7 @@ bool CPC_Cut::On_Execute(void)
 				return (false);
 			}
 
-			return( Get_Cut(pPoints, pCut, Get_Parameters("POLYGONS")->Get_Parameter("POLYGONS")->asShapes(), Parameters("INVERSE")->asBool()) );
+			return( Get_Cut(pPointsList, pCutList, Get_Parameters("POLYGONS")->Get_Parameter("POLYGONS")->asShapes(), Parameters("INVERSE")->asBool()) );
 		}
 		break;
 	}
@@ -230,67 +231,105 @@ bool CPC_Cut::On_Execute(void)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CPC_Cut::Get_Cut(CSG_PointCloud *pPoints, CSG_PointCloud *pCut, const CSG_Rect &Extent, bool bInverse)
+bool CPC_Cut::Get_Cut(CSG_Parameter_PointCloud_List *pPointsList, CSG_Parameter_PointCloud_List *pCutList, const CSG_Rect &Extent, bool bInverse)
 {
-	if( pPoints && pPoints->is_Valid() && pCut )
+	for(int iItem=0; iItem<pPointsList->Get_Count(); iItem++)
 	{
-		pCut->Create(pPoints);
-		pCut->Set_Name(CSG_String::Format(SG_T("%s [%s]"), pPoints->Get_Name(), _TL("Cut")));
+		SG_UI_Process_Set_Text(CSG_String::Format(_TL("Processing dataset %d"), iItem+1));
+
+		CSG_PointCloud	*pPoints = pPointsList->asPointCloud(iItem);
 
-		if( Extent.Intersects(pPoints->Get_Extent()) )
+		if( pPoints && pPoints->is_Valid() )
 		{
-			for(int i=0; i<pPoints->Get_Point_Count() && SG_UI_Process_Set_Progress(i, pPoints->Get_Point_Count()); i++)
-			{
-				pPoints->Set_Cursor(i);
+			CSG_PointCloud *pCut = new CSG_PointCloud(pPoints);
+
+			pCut->Set_Name(CSG_String::Format(SG_T("%s [%s]"), pPoints->Get_Name(), _TL("Cut")));
 
-				if( (Extent.Contains(pPoints->Get_X(), pPoints->Get_Y()) && !bInverse) || (!Extent.Contains(pPoints->Get_X(), pPoints->Get_Y()) && bInverse) )
+			if( Extent.Intersects(pPoints->Get_Extent()) )
+			{
+				for(int i=0; i<pPoints->Get_Point_Count() && SG_UI_Process_Set_Progress(i, pPoints->Get_Point_Count()); i++)
 				{
-					pCut->Add_Point(pPoints->Get_X(), pPoints->Get_Y(), pPoints->Get_Z());
+					pPoints->Set_Cursor(i);
 
-					for(int j=0; j<pPoints->Get_Field_Count() - 3; j++)
+					if( (Extent.Contains(pPoints->Get_X(), pPoints->Get_Y()) && !bInverse) || (!Extent.Contains(pPoints->Get_X(), pPoints->Get_Y()) && bInverse) )
 					{
-						pCut->Set_Attribute(j, pPoints->Get_Attribute(j));
+						pCut->Add_Point(pPoints->Get_X(), pPoints->Get_Y(), pPoints->Get_Z());
+
+						for(int j=0; j<pPoints->Get_Field_Count() - 3; j++)
+						{
+							pCut->Set_Attribute(j, pPoints->Get_Attribute(j));
+						}
 					}
 				}
 			}
-		}
 
-		return( pCut->Get_Count() > 0 );
+			if( pCut->Get_Count() <= 0 )
+			{
+				delete pCut;
+
+				SG_UI_Msg_Add(CSG_String::Format(_TL("Cutting %s resulted in an empty point cloud, skipping output!"), pPoints->Get_Name()), true);
+			}
+			else
+			{
+				pCutList->Add_Item(pCut);
+
+				SG_UI_Msg_Add(CSG_String::Format(_TL("%d points from %s written to output %s."), pCut->Get_Point_Count(), pPoints->Get_Name(), pCut->Get_Name()), true);
+			}
+		}
 	}
 
-	return( false );
+	return( true );
 }
 
 //---------------------------------------------------------
-bool CPC_Cut::Get_Cut(CSG_PointCloud *pPoints, CSG_PointCloud *pCut, CSG_Shapes *pPolygons, bool bInverse)
+bool CPC_Cut::Get_Cut(CSG_Parameter_PointCloud_List *pPointsList, CSG_Parameter_PointCloud_List *pCutList, CSG_Shapes *pPolygons, bool bInverse)
 {
-	if( pPoints && pPoints->is_Valid() && pCut )
+	for(int iItem=0; iItem<pPointsList->Get_Count(); iItem++)
 	{
-		pCut->Create(pPoints);
-		pCut->Set_Name(CSG_String::Format(SG_T("%s [%s]"), pPoints->Get_Name(), pPolygons->Get_Name()));
+		SG_UI_Process_Set_Text(CSG_String::Format(_TL("Processing dataset %d"), iItem+1));
+
+		CSG_PointCloud	*pPoints = pPointsList->asPointCloud(iItem);
 
-		if( pPolygons && pPolygons->Get_Type() == SHAPE_TYPE_Polygon && pPolygons->Get_Extent().Intersects(pPoints->Get_Extent()) )
+		if( pPoints && pPoints->is_Valid() )
 		{
-			for(int i=0; i<pPoints->Get_Point_Count() && SG_UI_Process_Set_Progress(i, pPoints->Get_Point_Count()); i++)
-			{
-				pPoints->Set_Cursor(i);
+			CSG_PointCloud *pCut = new CSG_PointCloud(pPoints);
+
+			pCut->Set_Name(CSG_String::Format(SG_T("%s [%s]"), pPoints->Get_Name(), pPolygons->Get_Name()));
 
-				if( (Contains(pPolygons, pPoints->Get_X(), pPoints->Get_Y()) && !bInverse) || (!Contains(pPolygons, pPoints->Get_X(), pPoints->Get_Y()) && bInverse) )
+			if( pPolygons && pPolygons->Get_Type() == SHAPE_TYPE_Polygon && pPolygons->Get_Extent().Intersects(pPoints->Get_Extent()) )
+			{
+				for(int i=0; i<pPoints->Get_Point_Count() && SG_UI_Process_Set_Progress(i, pPoints->Get_Point_Count()); i++)
 				{
-					pCut->Add_Point(pPoints->Get_X(), pPoints->Get_Y(), pPoints->Get_Z());
+					pPoints->Set_Cursor(i);
 
-					for(int j=0; j<pPoints->Get_Field_Count() - 3; j++)
+					if( (Contains(pPolygons, pPoints->Get_X(), pPoints->Get_Y()) && !bInverse) || (!Contains(pPolygons, pPoints->Get_X(), pPoints->Get_Y()) && bInverse) )
 					{
-						pCut->Set_Attribute(j, pPoints->Get_Attribute(j));
+						pCut->Add_Point(pPoints->Get_X(), pPoints->Get_Y(), pPoints->Get_Z());
+
+						for(int j=0; j<pPoints->Get_Field_Count() - 3; j++)
+						{
+							pCut->Set_Attribute(j, pPoints->Get_Attribute(j));
+						}
 					}
 				}
 			}
-		}
 
-		return( pCut->Get_Count() > 0 );
+			if( pCut->Get_Count() <= 0 )
+			{
+				delete pCut;
+
+				SG_UI_Msg_Add(CSG_String::Format(_TL("Cutting %s resulted in an empty point cloud, skipping output!"), pPoints->Get_Name()), true);
+			}
+			else
+			{
+				pCutList->Add_Item(pCut);
+
+				SG_UI_Msg_Add(CSG_String::Format(_TL("%d points from %s written to output %s."), pCut->Get_Point_Count(), pPoints->Get_Name(), pCut->Get_Name()), true);
+			}
+		}
 	}
 
-	return( false );
+	return( true );
 }
 
 //---------------------------------------------------------
@@ -325,10 +364,11 @@ CPC_Cut_Interactive::CPC_Cut_Interactive(void)
 	//-----------------------------------------------------
 	Set_Name		(_TL("Point Cloud Cutter"));
 
-	Set_Author		(SG_T("O. Conrad, V. Wichmann (c) 2009-10"));
+	Set_Author		(SG_T("O. Conrad, V. Wichmann (c) 2009-15"));
 
 	Set_Description	(_TW(
-		"This modules allows one to extract subsets from a Point Cloud. The area-of-interest "
+		"This modules allows one to extract subsets from one or several "
+		"point cloud datasets. The area-of-interest "
 		"is interactively defined either by dragging a box or by digitizing a polygon.\n"
 		"Best practice is to display the Point Cloud in a new Map View first and then "
 		"execute the module. Use the Action tool to define the AOI.\n\n"
@@ -336,15 +376,15 @@ CPC_Cut_Interactive::CPC_Cut_Interactive(void)
 
 
 	//-----------------------------------------------------
-	Parameters.Add_PointCloud(
+	Parameters.Add_PointCloud_List(
 		NULL	, "POINTS"		, _TL("Points"),
-		_TL(""),
+		_TL("One or several input point cloud datasets to cut."),
 		PARAMETER_INPUT
 	);
 
-	Parameters.Add_PointCloud(
+	Parameters.Add_PointCloud_List(
 		NULL	, "CUT"			, _TL("Cut"),
-		_TL(""),
+		_TL("The cutted output point cloud dataset(s)."),
 		PARAMETER_OUTPUT
 	);
 
@@ -382,11 +422,11 @@ CPC_Cut_Interactive::CPC_Cut_Interactive(void)
 //---------------------------------------------------------
 bool CPC_Cut_Interactive::On_Execute(void)
 {
-	m_pPoints	= Parameters("POINTS")	->asPointCloud();
-	m_pCut		= Parameters("CUT")		->asPointCloud();
-	m_bAOIBox	= Parameters("AOI")		->asInt() == 0 ? true : false;
-	m_pAOI		= Parameters("AOISHAPE")->asShapes();
-	m_bInverse	= Parameters("INVERSE")	->asBool();
+	m_pPointsList	= Parameters("POINTS")	->asPointCloudList();
+	m_pCutList		= Parameters("CUT")		->asPointCloudList();
+	m_bAOIBox		= Parameters("AOI")		->asInt() == 0 ? true : false;
+	m_pAOI			= Parameters("AOISHAPE")->asShapes();
+	m_bInverse		= Parameters("INVERSE")	->asBool();
 
 
 	if( !m_bAOIBox )
@@ -396,7 +436,7 @@ bool CPC_Cut_Interactive::On_Execute(void)
 
 		if( m_pAOI == NULL )
 		{
-			m_pAOI = SG_Create_Shapes(SHAPE_TYPE_Polygon, CSG_String::Format(SG_T("AOI_%s"), m_pPoints->Get_Name()));
+			m_pAOI = SG_Create_Shapes(SHAPE_TYPE_Polygon, SG_T("AOI_Cutter"));
 			m_pAOI->Add_Field("ID", SG_DATATYPE_Int);
 			Parameters("AOISHAPE")->Set_Value(m_pAOI);
 			DataObject_Add(m_pAOI, true);
@@ -404,7 +444,7 @@ bool CPC_Cut_Interactive::On_Execute(void)
 		else if( m_pAOI->Get_Field_Count() < 1)
 			m_pAOI->Add_Field("ID", SG_DATATYPE_Int);
 
-		
+
 		CSG_Parameters	sParms;
 		if( DataObject_Get_Parameters(m_pAOI, sParms) && sParms("DISPLAY_BRUSH") && sParms("OUTLINE_COLOR"))
 		{
@@ -472,10 +512,7 @@ bool CPC_Cut_Interactive::On_Execute_Position(CSG_Point ptWorld, TSG_Module_Inte
 					pParameters->Get_Parameter("YMAX")->asDouble()
 				);
 
-				if( CPC_Cut::Get_Cut(m_pPoints, m_pCut, r, m_bInverse) )
-				{
-					DataObject_Update(m_pCut);
-				}
+				CPC_Cut::Get_Cut(m_pPointsList, m_pCutList, r, m_bInverse);
 			}
 
 			return( true );
@@ -490,10 +527,7 @@ bool CPC_Cut_Interactive::On_Execute_Position(CSG_Point ptWorld, TSG_Module_Inte
 		{
 			m_bAdd    = false;
 
-			if( CPC_Cut::Get_Cut(m_pPoints, m_pCut, m_pAOI, m_bInverse) )
-			{
-				DataObject_Update(m_pCut);
-			}
+			CPC_Cut::Get_Cut(m_pPointsList, m_pCutList, m_pAOI, m_bInverse);
 
 			return( true );
 		}
diff --git a/src/modules/pointcloud/pointcloud_tools/pc_cut.h b/src/modules/pointcloud/pointcloud_tools/pc_cut.h
index f59cc9b..447477e 100644
--- a/src/modules/pointcloud/pointcloud_tools/pc_cut.h
+++ b/src/modules/pointcloud/pointcloud_tools/pc_cut.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: pc_cut.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: pc_cut.h 2427 2015-02-26 16:24:53Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -80,8 +80,8 @@ public:
 
 	virtual CSG_String			Get_MenuPath			(void)	{	return( _TL("R:Tools") );	}
 
-	static bool					Get_Cut					(CSG_PointCloud *pPoints, CSG_PointCloud *pCut, const CSG_Rect &Extent, bool bInverse);
-	static bool					Get_Cut					(CSG_PointCloud *pPoints, CSG_PointCloud *pCut, CSG_Shapes *pPolygons, bool bInverse);
+	static bool					Get_Cut					(CSG_Parameter_PointCloud_List *pPointsList, CSG_Parameter_PointCloud_List *pCutList, const CSG_Rect &Extent, bool bInverse);
+	static bool					Get_Cut					(CSG_Parameter_PointCloud_List *pPointsList, CSG_Parameter_PointCloud_List *pCutList, CSG_Shapes *pPolygons, bool bInverse);
 
 
 protected:
@@ -119,13 +119,13 @@ protected:
 
 private:
 
-	CSG_Point					m_ptDown;
+	CSG_Point						m_ptDown;
 
-	CSG_PointCloud				*m_pPoints, *m_pCut;
+	CSG_Parameter_PointCloud_List	*m_pPointsList, *m_pCutList;
 
-	CSG_Shapes					*m_pAOI;
+	CSG_Shapes						*m_pAOI;
 
-	bool						m_bAOIBox, m_bAdd, m_bInverse;
+	bool							m_bAOIBox, m_bAdd, m_bInverse;
 
 };
 
diff --git a/src/modules/pointcloud/pointcloud_viewer/Makefile.in b/src/modules/pointcloud/pointcloud_viewer/Makefile.in
index 6924a4e..a828dd5 100644
--- a/src/modules/pointcloud/pointcloud_viewer/Makefile.in
+++ b/src/modules/pointcloud/pointcloud_viewer/Makefile.in
@@ -472,22 +472,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/points_view_module.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/projection/pj_georeference/MLB_Interface.cpp b/src/modules/projection/pj_georeference/MLB_Interface.cpp
index c92ce29..241d6db 100644
--- a/src/modules/projection/pj_georeference/MLB_Interface.cpp
+++ b/src/modules/projection/pj_georeference/MLB_Interface.cpp
@@ -108,6 +108,7 @@ CSG_Module *		Create_Module(int i)
 	case  2:	return( new CGeoref_Shapes );
 	case  3:	return( new CGeoref_Grid_Move );
 	case  4:	return( new CDirect_Georeferencing );
+	case  6:	return( new CDirect_Georeferencing_WorldFile );
 	case  5:	return( new CSet_Grid_Georeference );
 
 	case 10:	return( NULL );
diff --git a/src/modules/projection/pj_georeference/Makefile.in b/src/modules/projection/pj_georeference/Makefile.in
index 3ce96cd..284fbcb 100644
--- a/src/modules/projection/pj_georeference/Makefile.in
+++ b/src/modules/projection/pj_georeference/Makefile.in
@@ -481,22 +481,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/set_grid_georeference.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/projection/pj_georeference/direct_georeferencing.cpp b/src/modules/projection/pj_georeference/direct_georeferencing.cpp
index 279a715..d900608 100644
--- a/src/modules/projection/pj_georeference/direct_georeferencing.cpp
+++ b/src/modules/projection/pj_georeference/direct_georeferencing.cpp
@@ -69,45 +69,18 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-CDirect_Georeferencing::CDirect_Georeferencing(void)
-{
-	CSG_Parameter	*pNode;
-
-	//-----------------------------------------------------
-	Set_Name		(_TL("Direct Georeferencing of Airborne Photographs"));
-
-	Set_Author		(SG_T("O.Conrad (c) 2012"));
-
-	Set_Description	(_TW(
-		"Direct georeferencing of aerial photographs uses extrinsic "
-		"(position, attitude) and intrinsic (focal length, physical "
-		"pixel size) camera parameters. Orthorectification routine supports "
-		"additional data from a Digital Elevation Model (DEM).\n"
-		"\nReferences:\n"
-		"Baumker, M. / Heimes, F.J. (2001): "
-		"New Calibration and Computing Method for Direct Georeferencing of Image and Scanner Data Using the Position and Angular Data of an Hybrid Inertial Navigation System. "
-		"OEEPE Workshop, Integrated Sensor Orientation, Hannover 2001. "
-		"<a target=\"_blank\" href=\"http://www.hochschule-bochum.de/fileadmin/media/fb_v/veroeffentlichungen/baeumker/baheimesoeepe.pdf\">online</a>.\n"
-	));
+CSG_Direct_Georeferencer::CSG_Direct_Georeferencer(void)
+{}
 
-	//-----------------------------------------------------
-	Parameters.Add_Grid_List(
-		NULL	, "INPUT"		, _TL("Unreferenced Grids"),
-		_TL(""),
-		PARAMETER_INPUT
-	);
 
-	Parameters.Add_Grid_List(
-		NULL	, "OUTPUT"		, _TL("Referenced Grids"),
-		_TL(""),
-		PARAMETER_OUTPUT, false
-	);
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
 
-	Parameters.Add_Shapes(
-		NULL	, "EXTENT"		, _TL("Extent"),
-		_TL(""),
-		PARAMETER_OUTPUT_OPTIONAL, SHAPE_TYPE_Polygon
-	);
+//---------------------------------------------------------
+bool CSG_Direct_Georeferencer::Add_Parameters(CSG_Parameters &Parameters)
+{
+	CSG_Parameter	*pNode;
 
 	//-----------------------------------------------------
 	pNode	= Parameters.Add_Node(
@@ -191,18 +164,171 @@ CDirect_Georeferencing::CDirect_Georeferencing(void)
 	);
 
 	//-----------------------------------------------------
-	Parameters.Add_Value(
-		NULL	, "ZREF"		, _TL("Reference Height"),
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CSG_Direct_Georeferencer::Set_Transformation(CSG_Parameters &Parameters, int nCols, int nRows)
+{
+	//-----------------------------------------------------
+	m_O.Create(2);
+
+	m_O[0]	= nCols / 2.0;
+	m_O[1]	= nRows / 2.0;
+
+	m_f		= Parameters("CFL"   )->asDouble() / 1000;		// [mm]     -> [m]
+	m_s		= Parameters("PXSIZE")->asDouble() / 1000000;	// [micron] -> [m]
+
+	//-----------------------------------------------------
+	m_T.Create(3);
+
+	m_T[0]	= Parameters("X")->asDouble();
+	m_T[1]	= Parameters("Y")->asDouble();
+	m_T[2]	= Parameters("Z")->asDouble();
+
+	//-----------------------------------------------------
+	double		a;
+	CSG_Matrix	Rx(3, 3), Ry(3, 3), Rz(3, 3);
+
+	a	= Parameters("OMEGA")->asDouble() * M_DEG_TO_RAD;
+	Rx[0][0] =       1; Rx[0][1] =       0; Rx[0][2] =       0;
+	Rx[1][0] =       0; Rx[1][1] =  cos(a); Rx[1][2] = -sin(a);
+	Rx[2][0] =       0; Rx[2][1] =  sin(a); Rx[2][2] =  cos(a);
+
+	a	= Parameters("PHI"  )->asDouble() * M_DEG_TO_RAD;
+	Ry[0][0] =  cos(a); Ry[0][1] =       0; Ry[0][2] =  sin(a);
+	Ry[1][0] =       0; Ry[1][1] =       1; Ry[1][2] =       0;
+	Ry[2][0] = -sin(a); Ry[2][1] =       0; Ry[2][2] =  cos(a);
+
+	a	= Parameters("KAPPA")->asDouble() * M_DEG_TO_RAD + Parameters("KAPPA_OFF")->asDouble() * M_DEG_TO_RAD;
+	Rz[0][0] =  cos(a); Rz[0][1] = -sin(a); Rz[0][2] =       0;
+	Rz[1][0] =  sin(a); Rz[1][1] =  cos(a); Rz[1][2] =       0;
+	Rz[2][0] =       0; Rz[2][1] =       0; Rz[2][2] =       1;
+
+	switch( Parameters("ORIENTATION")->asInt() )
+	{
+	case 0:	default:	m_R	= Rz * Rx * Ry;	break;	// BLUH
+	case 1:				m_R	= Rx * Ry * Rz;	break;	// PATB
+	}
+
+	m_Rinv	= m_R.Get_Inverse();
+
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+inline TSG_Point CSG_Direct_Georeferencer::World_to_Image(double x_w, double y_w, double z_w)
+{
+	TSG_Point	p;
+	CSG_Vector	Pw(3), Pc;
+	
+	Pw[0]	= x_w;
+	Pw[1]	= y_w;
+	Pw[2]	= z_w;
+
+	Pc		= m_Rinv * (Pw - m_T);
+
+	p.x		= m_O[0] - (m_f / m_s) * (Pc[0] / Pc[2]);
+	p.y		= m_O[1] - (m_f / m_s) * (Pc[1] / Pc[2]);
+
+	return( p );
+}
+
+//---------------------------------------------------------
+inline TSG_Point CSG_Direct_Georeferencer::Image_to_World(double x_i, double y_i, double z_w)
+{
+	double		k;
+	TSG_Point	p;
+	CSG_Vector	Pc(3), Pw;
+	
+	Pc[0]	= (m_O[0] - x_i) * m_s;
+	Pc[1]	= (m_O[1] - y_i) * m_s;
+	Pc[2]	= m_f;
+
+	Pw		= m_R * Pc;
+
+	k		= (z_w - m_T[2]) / Pw[2];
+
+	p.x		= m_T[0] + k * Pw[0];
+	p.y		= m_T[1] + k * Pw[1];
+
+	return( p );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+CDirect_Georeferencing::CDirect_Georeferencing(void)
+{
+	CSG_Parameter	*pNode;
+
+	//-----------------------------------------------------
+	Set_Name		(_TL("Direct Georeferencing of Airborne Photographs"));
+
+	Set_Author		(SG_T("O.Conrad (c) 2012"));
+
+	Set_Description	(_TW(
+		"Direct georeferencing of aerial photographs uses extrinsic "
+		"(position, attitude) and intrinsic (focal length, physical "
+		"pixel size) camera parameters. Orthorectification routine supports "
+		"additional data from a Digital Elevation Model (DEM).\n"
+		"\nReferences:\n"
+		"Baumker, M. / Heimes, F.J. (2001): "
+		"New Calibration and Computing Method for Direct Georeferencing of Image and Scanner Data Using the Position and Angular Data of an Hybrid Inertial Navigation System. "
+		"OEEPE Workshop, Integrated Sensor Orientation, Hannover 2001. "
+		"<a target=\"_blank\" href=\"http://www.hochschule-bochum.de/fileadmin/media/fb_v/veroeffentlichungen/baeumker/baheimesoeepe.pdf\">online</a>.\n"
+	));
+
+	//-----------------------------------------------------
+	Parameters.Add_Grid_List(
+		NULL	, "INPUT"		, _TL("Unreferenced Grids"),
 		_TL(""),
-		PARAMETER_TYPE_Double	, 0.0
+		PARAMETER_INPUT
+	);
+
+	Parameters.Add_Grid_List(
+		NULL	, "OUTPUT"		, _TL("Referenced Grids"),
+		_TL(""),
+		PARAMETER_OUTPUT, false
 	);
 
-	Parameters.Add_Grid(
+	Parameters.Add_Shapes(
+		NULL	, "EXTENT"		, _TL("Extent"),
+		_TL(""),
+		PARAMETER_OUTPUT_OPTIONAL, SHAPE_TYPE_Polygon
+	);
+
+	//-----------------------------------------------------
+	pNode	= Parameters.Add_Grid(
 		NULL	, "DEM"			, _TL("Elevation"),
 		_TL(""),
 		PARAMETER_INPUT_OPTIONAL, false
 	);
 
+	Parameters.Add_Value(
+		pNode	, "ZREF"		, _TL("Default Reference Height"),
+		_TL(""),
+		PARAMETER_TYPE_Double	, 0.0
+	);
+
+	//-----------------------------------------------------
+	m_Georeferencer.Add_Parameters(Parameters);
+
 	//-----------------------------------------------------
 	Parameters.Add_Choice(
 		NULL	, "INTERPOLATION"	, _TL("Interpolation"),
@@ -233,14 +359,15 @@ CDirect_Georeferencing::CDirect_Georeferencing(void)
 	);
 
 	Parameters.Add_Choice(
-		NULL	, "TARGET_TYPE"	, _TL("Target"),
+		NULL	, "ROW_ORDER"	, _TL("Row Order"),
 		_TL(""),
 		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("user defined grid system"),
-			_TL("existing grid system")
+			_TL("top down"),
+			_TL("bottom up")
 		), 0
 	);
 
+	//-----------------------------------------------------
 	m_Grid_Target.Create(Add_Parameters("TARGET", _TL("Target Grid System"), _TL("")), false);
 }
 
@@ -270,7 +397,7 @@ int CDirect_Georeferencing::On_Parameters_Enable(CSG_Parameters *pParameters, CS
 bool CDirect_Georeferencing::On_Execute(void)
 {
 	//-----------------------------------------------------
-	if( !Set_Transformation() )
+	if( !m_Georeferencer.Set_Transformation(Parameters, Get_NX(), Get_NY()) )
 	{
 		return( false );
 	}
@@ -279,18 +406,17 @@ bool CDirect_Georeferencing::On_Execute(void)
 	CSG_Grid	*pDEM			= Parameters("DEM"          )->asGrid();
 	double		zRef			= Parameters("ZREF"         )->asDouble();
 	int			Interpolation	= Parameters("INTERPOLATION")->asInt();
+	bool		bFlip			= Parameters("ROW_ORDER"    )->asInt() == 1;
 
 	//-----------------------------------------------------
 	TSG_Point	p[4];
 
-	p[0]	= Image_to_World(       0,        0, zRef);
-	p[1]	= Image_to_World(Get_NX(),        0, zRef);
-	p[2]	= Image_to_World(Get_NX(), Get_NY(), zRef);
-	p[3]	= Image_to_World(       0, Get_NY(), zRef);
+	p[0]	= m_Georeferencer.Image_to_World(       0,        0, zRef);
+	p[1]	= m_Georeferencer.Image_to_World(Get_NX(),        0, zRef);
+	p[2]	= m_Georeferencer.Image_to_World(Get_NX(), Get_NY(), zRef);
+	p[3]	= m_Georeferencer.Image_to_World(       0, Get_NY(), zRef);
 
-	CSG_Rect	r(p[0], p[1]);
-	r.Union(p[2]);
-	r.Union(p[3]);
+	CSG_Rect	r(p[0], p[1]);	r.Union(p[2]);	r.Union(p[3]);
 
 	//-----------------------------------------------------
 	CSG_Shapes	*pShapes	= Parameters("EXTENT")->asShapes();
@@ -314,7 +440,6 @@ bool CDirect_Georeferencing::On_Execute(void)
 	CSG_Grid_System	System(Cellsize, r);
 
 	m_Grid_Target.Set_User_Defined(Get_Parameters("TARGET"), r, Get_NX());
-//	m_Grid_Target.Set_User_Defined(Get_Parameters("TARGET"), r, (int)(1 + r.Get_YRange() / Cellsize));
 
 	if( !Dlg_Parameters("TARGET") )
 	{
@@ -390,7 +515,12 @@ bool CDirect_Georeferencing::On_Execute(void)
 				pz	= zRef;
 			}
 
-			TSG_Point	p	= World_to_Image(px, py, pz);
+			TSG_Point	p	= m_Georeferencer.World_to_Image(px, py, pz);
+
+			if( bFlip )
+			{
+				p.y	= (Get_NY() - 1) - p.y;
+			}
 
 			for(int i=0; i<pInput->Get_Count(); i++)
 			{
@@ -413,103 +543,136 @@ bool CDirect_Georeferencing::On_Execute(void)
 
 ///////////////////////////////////////////////////////////
 //														 //
+//														 //
+//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CDirect_Georeferencing::Set_Transformation(void)
+CDirect_Georeferencing_WorldFile::CDirect_Georeferencing_WorldFile(void)
 {
-	//-----------------------------------------------------
-	m_O.Create(2);
-	m_O[0]	= Get_NX() / 2.0;
-	m_O[1]	= Get_NY() / 2.0;
-
-	m_f		= Parameters("CFL"   )->asDouble() / 1000;		// [mm]     -> [m]
-	m_s		= Parameters("PXSIZE")->asDouble() / 1000000;	// [micron] -> [m]
+	CSG_Parameter	*pNode;
 
 	//-----------------------------------------------------
-	m_T.Create(3);
+	Set_Name		(_TL("World File from Flight and Camera Settings"));
 
-	m_T[0]	= Parameters("X")->asDouble();
-	m_T[1]	= Parameters("Y")->asDouble();
-	m_T[2]	= Parameters("Z")->asDouble();
+	Set_Author		(SG_T("O.Conrad (c) 2014"));
 
-	//-----------------------------------------------------
-	double		a;
-	CSG_Matrix	Rx(3, 3), Ry(3, 3), Rz(3, 3);
+	Set_Description	(_TW(
+		"Creates a world file (RST = rotation, scaling, translation) "
+		"for georeferencing images by direct georeferencing. "
+		"Direct georeferencing uses extrinsic "
+		"(position, attitude) and intrinsic (focal length, physical "
+		"pixel size) camera parameters.\n"
+		"\nReferences:\n"
+		"Baumker, M. / Heimes, F.J. (2001): "
+		"New Calibration and Computing Method for Direct Georeferencing of Image and Scanner Data Using the Position and Angular Data of an Hybrid Inertial Navigation System. "
+		"OEEPE Workshop, Integrated Sensor Orientation, Hannover 2001. "
+		"<a target=\"_blank\" href=\"http://www.hochschule-bochum.de/fileadmin/media/fb_v/veroeffentlichungen/baeumker/baheimesoeepe.pdf\">online</a>.\n"
+	));
 
-	a	= Parameters("OMEGA" )->asDouble() * M_DEG_TO_RAD;
-	Rx[0][0] =       1; Rx[0][1] =       0; Rx[0][2] =       0;
-	Rx[1][0] =       0; Rx[1][1] =  cos(a); Rx[1][2] = -sin(a);
-	Rx[2][0] =       0; Rx[2][1] =  sin(a); Rx[2][2] =  cos(a);
+	//-----------------------------------------------------
+	Parameters.Add_Shapes(
+		NULL	, "EXTENT"		, _TL("Extent"),
+		_TL(""),
+		PARAMETER_OUTPUT_OPTIONAL, SHAPE_TYPE_Polygon
+	);
 
-	a	= Parameters("PHI"   )->asDouble() * M_DEG_TO_RAD;
-	Ry[0][0] =  cos(a); Ry[0][1] =       0; Ry[0][2] =  sin(a);
-	Ry[1][0] =       0; Ry[1][1] =       1; Ry[1][2] =       0;
-	Ry[2][0] = -sin(a); Ry[2][1] =       0; Ry[2][2] =  cos(a);
+	Parameters.Add_FilePath(
+		NULL	, "FILE"		, _TL("World File"),
+		_TL(""),
+		CSG_String::Format(SG_T("%s|*.*"), _TL("All Files")), NULL, true
+	);
 
-	a	= Parameters("KAPPA" )->asDouble() * M_DEG_TO_RAD + Parameters("KAPPA_OFF" )->asDouble() * M_DEG_TO_RAD;
-	Rz[0][0] =  cos(a); Rz[0][1] = -sin(a); Rz[0][2] =       0;
-	Rz[1][0] =  sin(a); Rz[1][1] =  cos(a); Rz[1][2] =       0;
-	Rz[2][0] =       0; Rz[2][1] =       0; Rz[2][2] =       1;
+	pNode	= Parameters.Add_Node(
+		NULL	, "NODE_IMAGE"	, _TL("Image Properties"),
+		_TL("")
+	);
 
-	switch( Parameters("ORIENTATION")->asInt() )
-	{
-	case 0:	default:	m_R	= Rz * Rx * Ry;	break;	// BLUH
-	case 1:				m_R	= Rx * Ry * Rz;	break;	// PATB
-	}
+	Parameters.Add_Value(
+		pNode	, "NX"			, _TL("Number of Columns"),
+		_TL(""),
+		PARAMETER_TYPE_Int, 100, 1, true
+	);
 
-	m_Rinv	= m_R.Get_Inverse();
+	Parameters.Add_Value(
+		pNode	, "NY"			, _TL("Number of Columns"),
+		_TL(""),
+		PARAMETER_TYPE_Int, 100, 1, true
+	);
 
-	return( true );
+	//-----------------------------------------------------
+	m_Georeferencer.Add_Parameters(Parameters);
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-inline TSG_Point CDirect_Georeferencing::World_to_Image(double x_w, double y_w, double z_w)
+bool CDirect_Georeferencing_WorldFile::On_Execute(void)
 {
-	TSG_Point	p;
-	CSG_Vector	Pw(3), Pc;
-	
-	Pw[0]	= x_w;
-	Pw[1]	= y_w;
-	Pw[2]	= z_w;
+	//-----------------------------------------------------
+	int	nx	= Parameters("NX")->asInt();
+	int	ny	= Parameters("NY")->asInt();
 
-	Pc		= m_Rinv * (Pw - m_T);
+	if( !m_Georeferencer.Set_Transformation(Parameters, nx, ny) )
+	{
+		return( false );
+	}
 
-	p.x		= m_O[0] - (m_f / m_s) * (Pc[0] / Pc[2]);
-	p.y		= m_O[1] - (m_f / m_s) * (Pc[1] / Pc[2]);
+	//-----------------------------------------------------
+	CSG_String	File	= Parameters("FILE")->asString();
 
-	p.x		= Get_XMin() + p.x * Get_Cellsize();
-	p.y		= Get_YMin() + p.y * Get_Cellsize();
+	if( File.is_Empty() )
+	{
+		return( false );
+	}
 
-	return( p );
-}
+	//-----------------------------------------------------
+	CSG_File	Stream;
 
-//---------------------------------------------------------
-inline TSG_Point CDirect_Georeferencing::Image_to_World(double x_i, double y_i, double z_w)
-{
-	double		k;
-	TSG_Point	p;
-	CSG_Vector	Pc(3), Pw;
-	
-	Pc[0]	= (m_O[0] - x_i) * m_s;
-	Pc[1]	= (m_O[1] - y_i) * m_s;
-	Pc[2]	= m_f;
+	if( !Stream.Open(File, SG_FILE_W, false) )
+	{
+		return( false );
+	}
 
-	Pw		= m_R * Pc;
+	//-----------------------------------------------------
+	CSG_Matrix	R(m_Georeferencer.Get_Transformation());
 
-	k		= (z_w - m_T[2]) / Pw[2];
+	R	*= 0.001 * Parameters("Z")->asDouble() / Parameters("CFL")->asDouble() * Parameters("PXSIZE")->asDouble();
 
-	p.x		= m_T[0] + k * Pw[0];
-	p.y		= m_T[1] + k * Pw[1];
+	TSG_Point	p	= m_Georeferencer.Image_to_World(0, ny);
 
-	return( p );
+	Stream.Printf(SG_T("%.10f\n%.10f\n%.10f\n%.10f\n%.10f\n%.10f\n"),
+		 R[0][0],	// A: pixel size in the x-direction in map units/pixel
+		 R[1][0],	// D: rotation about y-axis
+		-R[0][1],	// B: rotation about x-axis
+		-R[1][1],	// E: pixel size in the y-direction in map units, almost always negative
+		     p.x,	// X: top left pixel center
+		     p.y	// Y: top left pixel center
+	);
+
+	//-----------------------------------------------------
+	CSG_Shapes	*pExtents	= Parameters("EXTENT")->asShapes();
+
+	if( pExtents )
+	{
+		pExtents->Create(SHAPE_TYPE_Polygon, SG_File_Get_Name(File, false));
+		pExtents->Add_Field(_TL("NAME"), SG_DATATYPE_String);
+
+		CSG_Shape	*pExtent	= pExtents->Add_Shape();
+
+		p	= m_Georeferencer.Image_to_World( 0,  0);	pExtent->Add_Point(p.x, p.y);
+		p	= m_Georeferencer.Image_to_World( 0, ny);	pExtent->Add_Point(p.x, p.y);
+		p	= m_Georeferencer.Image_to_World(nx, ny);	pExtent->Add_Point(p.x, p.y);
+		p	= m_Georeferencer.Image_to_World(nx,  0);	pExtent->Add_Point(p.x, p.y);
+
+		pExtent->Set_Value(0, SG_File_Get_Name(File, false));
+	}
+
+	//-----------------------------------------------------
+	return( true );
 }
 
 
diff --git a/src/modules/projection/pj_georeference/direct_georeferencing.h b/src/modules/projection/pj_georeference/direct_georeferencing.h
index 50cd069..b9dc1b6 100644
--- a/src/modules/projection/pj_georeference/direct_georeferencing.h
+++ b/src/modules/projection/pj_georeference/direct_georeferencing.h
@@ -73,6 +73,36 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
+class CSG_Direct_Georeferencer
+{
+public:
+	CSG_Direct_Georeferencer(void);
+
+	bool						Add_Parameters			(CSG_Parameters &Parameters);
+
+	bool						Set_Transformation		(CSG_Parameters &Parameters, int nCols, int nRows);
+	const CSG_Matrix &			Get_Transformation		(void)	const	{	return( m_R );	}
+
+	TSG_Point					World_to_Image			(double x_w, double y_w, double z_w = 0.0);
+	TSG_Point					Image_to_World			(double x_i, double y_i, double z_w = 0.0);
+
+
+private:
+
+	double						m_f, m_s;
+
+	CSG_Vector					m_T, m_O;
+
+	CSG_Matrix					m_R, m_Rinv;
+
+};
+
+
+///////////////////////////////////////////////////////////
+//                                                       //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
 class CDirect_Georeferencing : public CSG_Module_Grid
 {
 public:
@@ -89,19 +119,32 @@ protected:
 
 private:
 
-	double						m_f, m_s;
+	CSG_Parameters_Grid_Target	m_Grid_Target;
 
-	CSG_Vector					m_T, m_O;
+	CSG_Direct_Georeferencer	m_Georeferencer;
 
-	CSG_Matrix					m_R, m_Rinv;
+};
 
-	CSG_Parameters_Grid_Target	m_Grid_Target;
 
+///////////////////////////////////////////////////////////
+//                                                       //
+///////////////////////////////////////////////////////////
 
-	bool						Set_Transformation		(void);
+//---------------------------------------------------------
+class CDirect_Georeferencing_WorldFile : public CSG_Module
+{
+public:
+	CDirect_Georeferencing_WorldFile(void);
+
+
+protected:
+
+	virtual bool				On_Execute				(void);
+
+
+private:
 
-	TSG_Point					World_to_Image			(double x_w, double y_w, double z_w);
-	TSG_Point					Image_to_World			(double x_i, double y_i, double z_w);
+	CSG_Direct_Georeferencer	m_Georeferencer;
 
 };
 
diff --git a/src/modules/projection/pj_proj4/MLB_Interface.cpp b/src/modules/projection/pj_proj4/MLB_Interface.cpp
index 91f02ba..280991a 100644
--- a/src/modules/projection/pj_proj4/MLB_Interface.cpp
+++ b/src/modules/projection/pj_proj4/MLB_Interface.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: MLB_Interface.cpp 2281 2014-10-09 15:49:41Z oconrad $
+ * Version $Id: MLB_Interface.cpp 2462 2015-03-27 16:29:25Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -113,6 +113,9 @@ CSG_String Get_Info(int i)
 
 #include "crs_transform_pointcloud.h"
 
+#include "crs_distance.h"
+
+
 //---------------------------------------------------------
 // 4. Allow your modules to be created here...
 
@@ -121,33 +124,36 @@ CSG_Module *		Create_Module(int i)
 	switch( i )
 	{
 	case  0:	return( new CCRS_Assign() );
-	case  1:	return( new CCRS_Transform_Shapes(true ) );
-	case  2:	return( new CCRS_Transform_Shapes(false) );
-	case  3:	return( new CCRS_Transform_Grid  (true ) );
-	case  4:	return( new CCRS_Transform_Grid  (false) );
 
-	case  5:	return( new CPROJ4_Shapes	(PROJ4_INTERFACE_SIMPLE, false) );
-	case  6:	return( new CPROJ4_Shapes	(PROJ4_INTERFACE_DIALOG, false) );
-	case  7:	return( new CPROJ4_Grid		(PROJ4_INTERFACE_SIMPLE, false) );
-	case  8:	return( new CPROJ4_Grid		(PROJ4_INTERFACE_DIALOG, false) );
-	case  9:	return( new CPROJ4_Shapes	(PROJ4_INTERFACE_SIMPLE, true) );
-	case 10:	return( new CPROJ4_Shapes	(PROJ4_INTERFACE_DIALOG, true) );
-	case 11:	return( new CPROJ4_Grid		(PROJ4_INTERFACE_SIMPLE, true) );
-	case 12:	return( new CPROJ4_Grid		(PROJ4_INTERFACE_DIALOG, true) );
+	case  1:	return( new CCRS_Transform_Shapes    (true ) );
+	case  2:	return( new CCRS_Transform_Shapes    (false) );
+	case  3:	return( new CCRS_Transform_Grid      (true ) );
+	case  4:	return( new CCRS_Transform_Grid      (false) );
+	case 18:	return( new CCRS_Transform_PointCloud(true ) );
+	case 19:	return( new CCRS_Transform_PointCloud(false) );
+
+	case 15:	return( new CCRS_Picker() );
 
 	case 13:	return( new CGCS_Grid_Longitude_Range() );
 
 	case 14:	return( new CGCS_Graticule() );
 
-	case 15:	return( new CCRS_Picker() );
-
 	case 16:	return( new CCRS_Indicatrix() );
 	case 17:	return( new CCRS_Grid_GeogCoords() );
+	case 20:	return( new CCRS_Distance_Lines() );
+	case 21:	return( new CCRS_Distance_Points() );
+	case 22:	return( new CCRS_Distance_Interactive() );
 
-	case 18:	return( new CCRS_Transform_PointCloud(true ) );
-	case 19:	return( new CCRS_Transform_PointCloud(false) );
+	case  5:	return( new CPROJ4_Shapes	(PROJ4_INTERFACE_SIMPLE, false) );
+	case  6:	return( new CPROJ4_Shapes	(PROJ4_INTERFACE_DIALOG, false) );
+	case  7:	return( new CPROJ4_Grid		(PROJ4_INTERFACE_SIMPLE, false) );
+	case  8:	return( new CPROJ4_Grid		(PROJ4_INTERFACE_DIALOG, false) );
+	case  9:	return( new CPROJ4_Shapes	(PROJ4_INTERFACE_SIMPLE, true) );
+	case 10:	return( new CPROJ4_Shapes	(PROJ4_INTERFACE_DIALOG, true) );
+	case 11:	return( new CPROJ4_Grid		(PROJ4_INTERFACE_SIMPLE, true) );
+	case 12:	return( new CPROJ4_Grid		(PROJ4_INTERFACE_DIALOG, true) );
 
-	case 20:	return( NULL );
+	case 23:	return( NULL );
 	default:	return( MLB_INTERFACE_SKIP_MODULE );
 	}
 }
diff --git a/src/modules/projection/pj_proj4/Makefile.am b/src/modules/projection/pj_proj4/Makefile.am
index 7de7a49..f5cb3b6 100644
--- a/src/modules/projection/pj_proj4/Makefile.am
+++ b/src/modules/projection/pj_proj4/Makefile.am
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.am 2147 2014-06-10 12:57:19Z reklov_w $
+# $Id: Makefile.am 2462 2015-03-27 16:29:25Z oconrad $
 #
 DEP_LIBS = -lproj
 if DEBUG
@@ -17,6 +17,7 @@ libpj_proj4_la_SOURCES =\
 MLB_Interface.cpp\
 crs_assign.cpp\
 crs_base.cpp\
+crs_distance.cpp\
 crs_grid_geogcoords.cpp\
 crs_indicatrix.cpp\
 crs_transform.cpp\
@@ -31,6 +32,7 @@ PROJ4_Shapes.cpp\
 MLB_Interface.h\
 crs_assign.h\
 crs_base.h\
+crs_distance.h\
 crs_grid_geogcoords.h\
 crs_indicatrix.h\
 crs_transform.h\
diff --git a/src/modules/projection/pj_proj4/Makefile.in b/src/modules/projection/pj_proj4/Makefile.in
index 50054ba..ddf123a 100644
--- a/src/modules/projection/pj_proj4/Makefile.in
+++ b/src/modules/projection/pj_proj4/Makefile.in
@@ -128,10 +128,11 @@ LTLIBRARIES = $(pkglib_LTLIBRARIES)
 libpj_proj4_la_DEPENDENCIES =  \
 	$(top_srcdir)/src/saga_core/saga_api/libsaga_api.la
 am_libpj_proj4_la_OBJECTS = MLB_Interface.lo crs_assign.lo crs_base.lo \
-	crs_grid_geogcoords.lo crs_indicatrix.lo crs_transform.lo \
-	crs_transform_grid.lo crs_transform_pointcloud.lo \
-	crs_transform_shapes.lo gcs_graticule.lo gcs_lon_range.lo \
-	PROJ4_Base.lo PROJ4_Grid.lo PROJ4_Shapes.lo
+	crs_distance.lo crs_grid_geogcoords.lo crs_indicatrix.lo \
+	crs_transform.lo crs_transform_grid.lo \
+	crs_transform_pointcloud.lo crs_transform_shapes.lo \
+	gcs_graticule.lo gcs_lon_range.lo PROJ4_Base.lo PROJ4_Grid.lo \
+	PROJ4_Shapes.lo
 libpj_proj4_la_OBJECTS = $(am_libpj_proj4_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
@@ -365,7 +366,7 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
 #
-# $Id: Makefile.am 2147 2014-06-10 12:57:19Z reklov_w $
+# $Id: Makefile.am 2462 2015-03-27 16:29:25Z oconrad $
 #
 DEP_LIBS = -lproj
 @DEBUG_TRUE at DBGFLAGS = -g -DDEBUG
@@ -379,6 +380,7 @@ libpj_proj4_la_SOURCES = \
 MLB_Interface.cpp\
 crs_assign.cpp\
 crs_base.cpp\
+crs_distance.cpp\
 crs_grid_geogcoords.cpp\
 crs_indicatrix.cpp\
 crs_transform.cpp\
@@ -393,6 +395,7 @@ PROJ4_Shapes.cpp\
 MLB_Interface.h\
 crs_assign.h\
 crs_base.h\
+crs_distance.h\
 crs_grid_geogcoords.h\
 crs_indicatrix.h\
 crs_transform.h\
@@ -491,6 +494,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/PROJ4_Shapes.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/crs_assign.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/crs_base.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/crs_distance.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/crs_grid_geogcoords.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/crs_indicatrix.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/crs_transform.Plo at am__quote@
@@ -501,22 +505,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gcs_lon_range.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/projection/pj_proj4/PROJ4_Grid.cpp b/src/modules/projection/pj_proj4/PROJ4_Grid.cpp
index a003e2e..3cdaf32 100644
--- a/src/modules/projection/pj_proj4/PROJ4_Grid.cpp
+++ b/src/modules/projection/pj_proj4/PROJ4_Grid.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: PROJ4_Grid.cpp 2289 2014-10-16 13:45:05Z oconrad $
+ * Version $Id: PROJ4_Grid.cpp 2447 2015-03-19 14:43:42Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -74,8 +74,6 @@
 CPROJ4_Grid::CPROJ4_Grid(int Interface, bool bInputList)
 	: CPROJ4_Base(Interface, bInputList)
 {
-	CSG_Parameters	*pParameters;
-
 	//-----------------------------------------------------
 	Set_Name		(CSG_String::Format(SG_T("[deprecated] %s (%s, %s)"),
 		_TL("Proj.4"),
diff --git a/src/modules/projection/pj_proj4/crs_base.cpp b/src/modules/projection/pj_proj4/crs_base.cpp
index 1391ef1..2d8ad68 100644
--- a/src/modules/projection/pj_proj4/crs_base.cpp
+++ b/src/modules/projection/pj_proj4/crs_base.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: crs_base.cpp 2150 2014-06-10 14:47:45Z reklov_w $
+ * Version $Id: crs_base.cpp 2469 2015-04-17 13:02:24Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -146,7 +146,7 @@ CCRS_Base::CCRS_Base(void)
 	pNode_1	= Parameters.Add_Value(
 		pNode_0	, "CRS_EPSG"	, _TL("EPSG Code"),
 		_TL(""),
-		PARAMETER_TYPE_Int, m_Projection.Get_EPSG(), -1, true, 99999, true
+		PARAMETER_TYPE_Int, m_Projection.Get_EPSG(), -1, true
 	);
 
 	if( SG_UI_Get_Window_Main() )
@@ -338,26 +338,32 @@ int CCRS_Base::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *
 //---------------------------------------------------------
 bool CCRS_Base::Get_Projection(CSG_Projection &Projection)
 {
-	if( Parameters("CRS_METHOD") )
+	if( !Parameters("CRS_METHOD") )
 	{
-		switch( Parameters("CRS_METHOD")->asInt() )
+		Projection	= m_Projection;
+	}
+	else switch( Parameters("CRS_METHOD")->asInt() )
+	{
+	default:	// Proj4 Parameters
+		if( !Projection.Create(Parameters("CRS_PROJ4")->asString(), SG_PROJ_FMT_Proj4) )
 		{
-		case 0:	default:	// Proj4 Parameters
-			Projection.Create(Parameters("CRS_PROJ4")->asString(), SG_PROJ_FMT_Proj4);
-			break;
+			Error_Set(_TL("Proj4 definition string error"));
+		}
+		break;
 
-		case 1:				// EPSG Code
-			Projection.Create(Parameters("CRS_EPSG" )->asInt());
-			break;
+	case  1:	// EPSG Code
+		if( !Projection.Create(Parameters("CRS_EPSG" )->asInt()) )
+		{
+			Error_Set(_TL("EPSG code error"));
+		}
+		break;
 
-		case 2:				// Well Known Text File
-			Projection.Load (Parameters("CRS_FILE"  )->asString());
-			break;
+	case  2:	// Well Known Text File
+		if( !Projection.Load (Parameters("CRS_FILE"  )->asString()) )
+		{
+			Error_Set(_TL("Well Known Text file error"));
 		}
-	}
-	else
-	{
-		Projection	= m_Projection;
+		break;
 	}
 
 	return( Projection.is_Okay() );
diff --git a/src/modules/projection/pj_proj4/crs_distance.cpp b/src/modules/projection/pj_proj4/crs_distance.cpp
new file mode 100644
index 0000000..28fa3c7
--- /dev/null
+++ b/src/modules/projection/pj_proj4/crs_distance.cpp
@@ -0,0 +1,524 @@
+/**********************************************************
+ * Version $Id: crs_distance.cpp 2148 2014-06-10 12:59:52Z reklov_w $
+ *********************************************************/
+
+///////////////////////////////////////////////////////////
+//                                                       //
+//                         SAGA                          //
+//                                                       //
+//      System for Automated Geoscientific Analyses      //
+//                                                       //
+//                    Module Library:                    //
+//                   Projection_Proj4                    //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//                   crs_distance.cpp                    //
+//                                                       //
+//                 Copyright (C) 2015 by                 //
+//                      Olaf Conrad                      //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+// This file is part of 'SAGA - System for Automated     //
+// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
+//                                                       //
+// SAGA is distributed in the hope that it will be       //
+// useful, but WITHOUT ANY WARRANTY; without even the    //
+// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
+// PARTICULAR PURPOSE. See the GNU General Public        //
+// License for more details.                             //
+//                                                       //
+// You should have received a copy of the GNU General    //
+// Public License along with this program; if not,       //
+// write to the Free Software Foundation, Inc.,          //
+// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
+// USA.                                                  //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//    e-mail:     oconrad at saga-gis.org                   //
+//                                                       //
+//    contact:    Olaf Conrad                            //
+//                Institute of Geography                 //
+//                University of Hamburg                  //
+//                Germany                                //
+//                                                       //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#include "crs_distance.h"
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+CCRS_Distance_Calculator::CCRS_Distance_Calculator(void)
+{}
+
+//---------------------------------------------------------
+CCRS_Distance_Calculator::CCRS_Distance_Calculator(const CSG_Projection &Projection, double Epsilon)
+{
+	Create(Projection, Epsilon);
+}
+
+//---------------------------------------------------------
+CCRS_Distance_Calculator::~CCRS_Distance_Calculator(void)
+{}
+
+//---------------------------------------------------------
+bool CCRS_Distance_Calculator::Create(const CSG_Projection &Projection, double Epsilon)
+{
+	if( !m_ProjToGCS.Set_Source(Projection)
+	||  !m_ProjToGCS.Set_Target(CSG_Projection("+proj=longlat +datum=WGS84", SG_PROJ_FMT_Proj4))
+	||  !m_Projector.Set_Target(Projection) )
+	{
+		return( false );
+	}
+
+	m_Epsilon	= Epsilon;
+
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+double CCRS_Distance_Calculator::Get_Orthodrome(const TSG_Point &A, const TSG_Point &B, CSG_Shape *pLine)
+{
+	static const TSG_Point	P0	= { 0.0, 0.0 };
+
+	TSG_Point	P	= A;
+
+	if( m_ProjToGCS.Get_Projection(P) )
+	{
+		m_Projector.Set_Source(CSG_Projection(
+			CSG_String::Format("+proj=aeqd +R=6371000 +lon_0=%f +lat_0=%f", P.x, P.y), SG_PROJ_FMT_Proj4)
+		);
+
+		m_Projector.Set_Inverse();
+
+		if( m_Projector.Get_Projection(P = B) )
+		{
+			m_Projector.Set_Inverse(false);
+
+			Add_Segment(P0, P, pLine);
+
+			return( SG_Get_Distance(P0, P) );
+		}
+	}
+
+	return( Get_Distance(A, B) );
+}
+
+//---------------------------------------------------------
+double CCRS_Distance_Calculator::Get_Loxodrome(const TSG_Point &A, const TSG_Point &B, CSG_Shape *pLine)
+{
+	TSG_Point	AA, BB;
+
+	m_Projector.Set_Source(CSG_Projection("+proj=merc +datum=WGS84", SG_PROJ_FMT_Proj4));
+
+	m_Projector.Set_Inverse();
+
+	if( m_Projector.Get_Projection(AA = A)
+	&&  m_Projector.Get_Projection(BB = B) )
+	{
+		double	Length	= 0.0;
+
+		m_Projector.Set_Inverse(false);
+
+		Add_Segment(AA, BB, pLine, &Length);
+
+		return( Length );
+	}
+
+	return( Get_Distance(A, B) );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+double CCRS_Distance_Calculator::Get_Distance(TSG_Point A, TSG_Point B)
+{
+	if( m_ProjToGCS.Get_Projection(A) && m_ProjToGCS.Get_Projection(B) )
+	{
+		return( SG_Get_Distance_Polar(A, B) );
+	}
+
+	return( 0.0 );
+}
+
+//---------------------------------------------------------
+void CCRS_Distance_Calculator::Add_Segment(const TSG_Point &A, const TSG_Point &B, CSG_Shape *pLine, double *Length)
+{
+	if( SG_Get_Distance(A, B) >= m_Epsilon )
+	{
+		TSG_Point	C, CC;
+
+		C.x	= CC.x = A.x + 0.5 * (B.x - A.x);
+		C.y	= CC.y = A.y + 0.5 * (B.y - A.y);
+
+		if( m_Projector.Get_Projection(CC) )
+		{
+			Add_Segment(A, C, pLine);
+
+			pLine->Add_Point(CC);
+
+			Add_Segment(C, B, pLine);
+		}
+	}
+	else if( Length != NULL )
+	{
+		TSG_Point	AA, BB;
+
+		if( m_Projector.Get_Projection(AA = A) && m_Projector.Get_Projection(BB = B) )
+		{
+			*Length	+= Get_Distance(AA, BB);
+		}
+	}
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+CCRS_Distance_Lines::CCRS_Distance_Lines(void)
+{
+	//-----------------------------------------------------
+	Set_Name		(_TL("Geographic Distances"));
+
+	Set_Author		("O. Conrad (c) 2015");
+
+	Set_Description	(_TW(
+		"Calculates for all segments of the input lines the planar, great elliptic, "
+		"and loxodrome distance and re-projects the latter two to the projection "
+		"of the input lines. "
+	));
+
+	Set_Description	(Get_Description() + "\n" + CSG_CRSProjector::Get_Description());
+
+	//-----------------------------------------------------
+	Parameters.Add_Shapes(
+		NULL	, "PLANAR"		, _TL("Segments"),
+		_TL(""),
+		PARAMETER_INPUT, SHAPE_TYPE_Line
+	);
+
+	Parameters.Add_Shapes(
+		NULL	, "ORTHODROME"	, _TL("Great Elliptic"),
+		_TL(""),
+		PARAMETER_OUTPUT, SHAPE_TYPE_Line
+	);
+
+	Parameters.Add_Shapes(
+		NULL	, "LOXODROME"	, _TL("Loxodrome"),
+		_TL(""),
+		PARAMETER_OUTPUT, SHAPE_TYPE_Line
+	);
+
+	Parameters.Add_Value(
+		NULL	, "EPSILON"	, _TL("Epsilon"),
+		_TL("defines the maximum resolution [km] for the re-projected distance segments"),
+		PARAMETER_TYPE_Double, 100.0, 1.0, true
+	);
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CCRS_Distance_Lines::On_Execute(void)
+{
+	//-----------------------------------------------------
+	CSG_Shapes	*pPlanars		= Parameters("PLANAR"    )->asShapes();
+	CSG_Shapes	*pOrthodromes	= Parameters("ORTHODROME")->asShapes();
+	CSG_Shapes	*pLoxodromes	= Parameters("LOXODROME" )->asShapes();
+
+	//-----------------------------------------------------
+	CCRS_Distance_Calculator	Distance;
+
+	if( !Distance.Create(pPlanars->Get_Projection(), Parameters("EPSILON")->asDouble() * 1000.0) )
+	{
+		Error_Set(_TL("projection initialization failed"));
+
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	pOrthodromes->Create(pPlanars->Get_Type(), CSG_String::Format("%s [%s]", pPlanars->Get_Name(), _TL("Orthodromes")), pPlanars);
+	pOrthodromes->Add_Field("LENGTH_PLAN", SG_DATATYPE_Double);
+	pOrthodromes->Add_Field("LENGTH"     , SG_DATATYPE_Double);
+
+	pLoxodromes ->Create(pPlanars->Get_Type(), CSG_String::Format("%s [%s]", pPlanars->Get_Name(), _TL("Loxodromes" )), pPlanars);
+	pLoxodromes ->Add_Field("LENGTH_PLAN", SG_DATATYPE_Double);
+	pLoxodromes ->Add_Field("LENGTH"     , SG_DATATYPE_Double);
+
+	//-----------------------------------------------------
+	for(int iShape=0; iShape<pPlanars->Get_Count() && Set_Progress(iShape, pPlanars->Get_Count()); iShape++)
+	{
+		CSG_Shape_Line	*pProj	= (CSG_Shape_Line *)pPlanars->Get_Shape(iShape);
+
+		for(int iPart=0; iPart<pProj->Get_Part_Count(); iPart++)
+		{
+			if( pProj->Get_Point_Count(iPart) > 1 )
+			{
+				TSG_Point	A, B	= pProj->Get_Point(0, iPart);
+
+				CSG_Shape_Line	*pOrthodrome = (CSG_Shape_Line *)pOrthodromes->Add_Shape(pProj, SHAPE_COPY_ATTR);
+				CSG_Shape_Line	*pLoxodrome  = (CSG_Shape_Line *)pLoxodromes->Add_Shape(pProj, SHAPE_COPY_ATTR);
+
+				pOrthodrome->Set_Value(pPlanars->Get_Field_Count() + 0, pProj->Get_Length(iPart));
+				pLoxodrome ->Set_Value(pPlanars->Get_Field_Count() + 0, pProj->Get_Length(iPart));
+
+				pOrthodrome->Add_Point(B);
+				pLoxodrome ->Add_Point(B);
+
+				double	dOrthodrome	= 0.0;
+				double	dLoxodrome	= 0.0;
+
+				for(int iPoint=1; iPoint<pProj->Get_Point_Count(iPart); iPoint++)
+				{
+					A	= B;	B	= pProj->Get_Point(iPoint, iPart);
+
+					dOrthodrome	+= Distance.Get_Orthodrome(A, B, pOrthodrome);
+					dLoxodrome	+= Distance.Get_Loxodrome (A, B, pLoxodrome );
+
+					pOrthodrome->Add_Point(B);
+					pLoxodrome ->Add_Point(B);
+				}
+
+				pOrthodrome->Set_Value(pPlanars->Get_Field_Count() + 1, dOrthodrome);
+				pLoxodrome ->Set_Value(pPlanars->Get_Field_Count() + 1, dLoxodrome );
+			}
+		}
+	}
+
+	//-----------------------------------------------------
+	return( pOrthodromes->Get_Count() > 0 );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+CCRS_Distance_Points::CCRS_Distance_Points(void)
+{
+	Set_Name		(_TL("Geographic Distances (Pair of Coordinates)"));
+
+	Set_Author		("O. Conrad (c) 2015");
+
+	Set_Description	(_TW(
+		"Calculates for all segments of the input lines the planar, great elliptic, "
+		"and loxodrome distance and re-projects the latter two to the projection "
+		"of the input lines. "
+	));
+
+	Parameters.Add_Shapes(
+		NULL	, "DISTANCES"	, _TL("Geographic Distances"),
+		_TL(""),
+		PARAMETER_OUTPUT, SHAPE_TYPE_Line
+	);
+
+	CSG_Parameter	*pNode;
+
+	pNode	= Parameters.Add_Node(NULL, "NODE_A", _TL("From"), _TL(""));
+	Parameters.Add_Value(pNode, "COORD_X1", _TL("X"), _TL(""), PARAMETER_TYPE_Double,  10.0);
+	Parameters.Add_Value(pNode, "COORD_Y1", _TL("Y"), _TL(""), PARAMETER_TYPE_Double,  53.5);
+
+	pNode	= Parameters.Add_Node(NULL, "NODE_B", _TL("To"  ), _TL(""));
+	Parameters.Add_Value(pNode, "COORD_X2", _TL("X"), _TL(""), PARAMETER_TYPE_Double, 116.5);
+	Parameters.Add_Value(pNode, "COORD_Y2", _TL("Y"), _TL(""), PARAMETER_TYPE_Double,   6.4);
+
+	Parameters.Add_Value(
+		NULL	, "EPSILON"		, _TL("Epsilon"),
+		_TL("defines the maximum resolution [km] for the re-projected distance segments"),
+		PARAMETER_TYPE_Double, 100.0, 1.0, true
+	);
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CCRS_Distance_Points::On_Execute(void)
+{
+	//-----------------------------------------------------
+	CSG_Projection	Projection;
+
+	if( !Get_Projection(Projection) )
+	{
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	CCRS_Distance_Calculator	Distance;
+
+	if( !Distance.Create(Projection, Parameters("EPSILON")->asDouble() * 1000.0) )
+	{
+		Error_Set(_TL("projection initialization failed"));
+
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	TSG_Point	A, B;
+
+	A.x	= Parameters("COORD_X1")->asDouble();
+	A.y	= Parameters("COORD_Y1")->asDouble();
+
+	B.x	= Parameters("COORD_X2")->asDouble();
+	B.y	= Parameters("COORD_Y2")->asDouble();
+
+	//-----------------------------------------------------
+	CSG_Shapes	*pDistances	= Parameters("DISTANCES")->asShapes();
+
+	pDistances	->Create(SHAPE_TYPE_Line, CSG_String::Format("%s", _TL("Geographic Distances")));
+
+	pDistances	->Add_Field("TYPE"  , SG_DATATYPE_String);
+	pDistances	->Add_Field("LENGTH", SG_DATATYPE_Double);
+
+	pDistances	->Get_Projection().Create(Projection);
+
+	//-----------------------------------------------------
+	CSG_Shape	*pPlanar     = pDistances->Add_Shape();	pPlanar    ->Set_Value(0, "Planar"    );
+	CSG_Shape	*pOrthodrome = pDistances->Add_Shape();	pOrthodrome->Set_Value(0, "Orthodrome");
+	CSG_Shape	*pLoxodrome  = pDistances->Add_Shape();	pLoxodrome ->Set_Value(0, "Loxodrome" );
+
+	pPlanar    ->Add_Point(A);
+	pOrthodrome->Add_Point(A);
+	pLoxodrome ->Add_Point(A);
+
+	pPlanar    ->Set_Value(1, SG_Get_Distance        (A, B             ));
+	pOrthodrome->Set_Value(1, Distance.Get_Orthodrome(A, B, pOrthodrome));
+	pLoxodrome ->Set_Value(1, Distance.Get_Loxodrome (A, B, pLoxodrome ));
+
+	pPlanar    ->Add_Point(B);
+	pOrthodrome->Add_Point(B);
+	pLoxodrome ->Add_Point(B);
+
+	//-----------------------------------------------------
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+CCRS_Distance_Interactive::CCRS_Distance_Interactive(void)
+{
+	Set_Name		(_TL("Geographic Distances"));
+
+	Set_Author		("O. Conrad (c) 2015");
+
+	Set_Description	(_TW(
+		"Calculates for all segments of the input lines the planar, great elliptic, "
+		"and loxodrome distance and re-projects the latter two to the projection "
+		"of the input lines. "
+	));
+
+	Parameters.Add_Shapes(
+		NULL	, "DISTANCES"	, _TL("Geographic Distances"),
+		_TL(""),
+		PARAMETER_OUTPUT, SHAPE_TYPE_Line
+	);
+
+	Parameters.Add_Value(
+		NULL	, "EPSILON"		, _TL("Epsilon"),
+		_TL("defines the maximum resolution [km] for the re-projected distance segments"),
+		PARAMETER_TYPE_Double, 100.0, 1.0, true
+	);
+
+	Set_Drag_Mode(MODULE_INTERACTIVE_DRAG_LINE);
+}
+
+//---------------------------------------------------------
+bool CCRS_Distance_Interactive::On_Execute(void)
+{
+	CCRS_Picker	CRS;
+
+	if( !Dlg_Parameters(CRS.Get_Parameters(), CRS.Get_Name()) )
+	{
+		m_Projection.Destroy();
+
+		return( false );
+	}
+
+	return( m_Projection.Create(CRS.Get_Parameters()->Get_Parameter("CRS_PROJ4")->asString(), SG_PROJ_FMT_Proj4) );
+}
+
+//---------------------------------------------------------
+bool CCRS_Distance_Interactive::On_Execute_Position(CSG_Point ptWorld, TSG_Module_Interactive_Mode Mode)
+{
+	if( Mode == MODULE_INTERACTIVE_LDOWN )
+	{
+		m_Down	= ptWorld;
+	}
+	else if( Mode == MODULE_INTERACTIVE_LUP )
+	{
+		if( m_Down != ptWorld )
+		{
+			CCRS_Distance_Points	Distance;
+
+			Distance.Set_Parameter("DISTANCES", Parameters("DISTANCES")->asShapes());
+			Distance.Set_Parameter("EPSILON"  , Parameters("EPSILON"  )->asDouble());
+			Distance.Set_Parameter("CRS_PROJ4", m_Projection.Get_Proj4());
+			Distance.Set_Parameter("COORD_X1" , m_Down .Get_X());
+			Distance.Set_Parameter("COORD_Y1" , m_Down .Get_Y());
+			Distance.Set_Parameter("COORD_X2" , ptWorld.Get_X());
+			Distance.Set_Parameter("COORD_Y2" , ptWorld.Get_Y());
+
+			Distance.Execute();
+
+			DataObject_Update(Parameters("DISTANCES")->asShapes());
+		}
+	}
+
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
diff --git a/src/modules/statistics/statistics_kriging/variogram_dialog.h b/src/modules/projection/pj_proj4/crs_distance.h
similarity index 66%
copy from src/modules/statistics/statistics_kriging/variogram_dialog.h
copy to src/modules/projection/pj_proj4/crs_distance.h
index 5e13541..253ddfa 100644
--- a/src/modules/statistics/statistics_kriging/variogram_dialog.h
+++ b/src/modules/projection/pj_proj4/crs_distance.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: variogram_dialog.h 1922 2014-01-09 10:28:46Z oconrad $
+ * Version $Id: crs_distance.h 2148 2014-06-10 12:59:52Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -9,13 +9,13 @@
 //      System for Automated Geoscientific Analyses      //
 //                                                       //
 //                    Module Library:                    //
-//                       image_io                        //
+//                   Projection_Proj4                    //
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//                  Variogram_Dialog.h                   //
+//                    crs_distance.h                     //
 //                                                       //
-//                 Copyright (C) 2008 by                 //
+//                 Copyright (C) 2015 by                 //
 //                      Olaf Conrad                      //
 //                                                       //
 //-------------------------------------------------------//
@@ -42,11 +42,9 @@
 //                                                       //
 //    e-mail:     oconrad at saga-gis.org                   //
 //                                                       //
-//    contact:    SAGA User Group Association            //
+//    contact:    Olaf Conrad                            //
 //                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
+//                University of Hamburg                  //
 //                Germany                                //
 //                                                       //
 ///////////////////////////////////////////////////////////
@@ -61,20 +59,11 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#ifndef HEADER_INCLUDED__Variogram_Dialog_H
-#define HEADER_INCLUDED__Variogram_Dialog_H
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
+#ifndef HEADER_INCLUDED__crs_distance_H
+#define HEADER_INCLUDED__crs_distance_H
 
 //---------------------------------------------------------
-#include "MLB_Interface.h"
-
-#include <saga_gdi/saga_gdi.h>
+#include "crs_base.h"
 
 
 ///////////////////////////////////////////////////////////
@@ -84,93 +73,100 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-class CSG_Variogram
+class CCRS_Distance_Calculator
 {
 public:
-	enum ESG_Variogram_Field
-	{
-		FIELD_CLASS	= 0,
-		FIELD_DISTANCE,
-		FIELD_COUNT,
-		FIELD_VAR_EXP,
-		FIELD_VAR_CUM,
-		FIELD_VAR_MODEL
-	};
+	CCRS_Distance_Calculator(void);
+	CCRS_Distance_Calculator(const CSG_Projection &Projection, double Epsilon);
+	virtual ~CCRS_Distance_Calculator(void);
+
+	bool					Create					(const CSG_Projection &Projection, double Epsilon);
 
-	CSG_Variogram(void);
+	double					Get_Orthodrome			(const TSG_Point &A, const TSG_Point &B, CSG_Shape *pLine);
+	double					Get_Loxodrome			(const TSG_Point &A, const TSG_Point &B, CSG_Shape *pLine);
 
-	static bool		Calculate			(CSG_Shapes *pPoints, int Attribute, bool bLog, CSG_Table *pVariogram, int nClasses = 25, double maxDistance = 0.0, int nSkip = 1);
 
-	static double	Get_Lag_Distance	(CSG_Shapes *pPoints, int Method, int nSkip = 1);
+private:
+
+	double					m_Epsilon;
+
+	CSG_CRSProjector		m_Projector, m_ProjToGCS;
+
+
+	double					Get_Distance			(TSG_Point A, TSG_Point B);
+
+	void					Add_Segment				(const TSG_Point &A, const TSG_Point &B, CSG_Shape *pLine, double *Length = NULL);
 
 };
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-class CVariogram_Dialog : public CSGDI_Dialog
+class CCRS_Distance_Lines : public CSG_Module
 {
 public:
-	CVariogram_Dialog(void);
+	CCRS_Distance_Lines(void);
 
-	bool						Execute		(CSG_Shapes *pPoints, int Attribute, bool bLog, CSG_Table *pVariogram, CSG_Trend *pModel);
+	virtual CSG_String		Get_MenuPath			(void)	{	return( _TL("R:Tools") );	}
 
 
-private:
-
-	wxButton					*m_pSettings;
+protected:
 
-	wxCheckBox					*m_pPairs;
+	virtual bool			On_Execute				(void);
 
-	wxChoice					*m_pFormulas;
+};
 
-	wxTextCtrl					*m_pFormula, *m_pParameters;
 
-	CSGDI_Slider				*m_pDistance;
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
 
-	class CVariogram_Diagram	*m_pDiagram;
+//---------------------------------------------------------
+class CCRS_Distance_Points : public CCRS_Base
+{
+public:
+	CCRS_Distance_Points(void);
 
-	CSG_Parameters				m_Settings;
+	virtual CSG_String		Get_MenuPath			(void)	{	return( _TL("R:Tools") );	}
 
-	CSG_Trend					*m_pModel;
 
-	CSG_Table					*m_pVariogram;
+protected:
 
-	CSG_Shapes					*m_pPoints;
+	virtual bool			On_Execute				(void);
+
+};
 
-	bool						m_bLog;
 
-	int							m_Attribute;
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
 
-	double						m_Distance;
+//---------------------------------------------------------
+class CCRS_Distance_Interactive : public CSG_Module_Interactive
+{
+public:
+	CCRS_Distance_Interactive(void);
 
+	virtual CSG_String		Get_MenuPath			(void)	{	return( _TL("R:Tools") );	}
 
-	void						On_Update_Control		(wxCommandEvent &event);
-	void						On_Update_Choices		(wxCommandEvent &event);
-	void						On_Button				(wxCommandEvent &event);
 
-	void						Set_Variogram			(void);
-	void						Set_Model				(void);
+protected:
 
+	virtual bool			On_Execute				(void);
+
+	virtual bool			On_Execute_Position		(CSG_Point ptWorld, TSG_Module_Interactive_Mode Mode);
 
-	DECLARE_EVENT_TABLE()
 
-};
+private:
 
+	CSG_Point				m_Down;
 
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
+	CSG_Projection			m_Projection;
 
-//---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED__Variogram_Dialog_H
+};
 
 
 ///////////////////////////////////////////////////////////
@@ -180,3 +176,4 @@ private:
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
+#endif // #ifndef HEADER_INCLUDED__crs_distance_H
diff --git a/src/modules/shapes/shapes_grid/Grid_Polygon_Clip.cpp b/src/modules/shapes/shapes_grid/Grid_Polygon_Clip.cpp
index e53d63f..4b5faa0 100644
--- a/src/modules/shapes/shapes_grid/Grid_Polygon_Clip.cpp
+++ b/src/modules/shapes/shapes_grid/Grid_Polygon_Clip.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Grid_Polygon_Clip.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: Grid_Polygon_Clip.cpp 2346 2014-11-28 11:39:34Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -233,6 +233,7 @@ bool CGrid_Polygon_Clip::Get_Extent(int &xMin, int &xCount, int &yMin, int &yCou
 				bFound	= is_InGrid(x, yMax, pMask, pGrids);
 			}
 		}
+		yMax++;
 
 		for(xMin=0, bFound=false; xMin<Get_NX() && !bFound && Process_Get_Okay(true); xMin++)
 		{
@@ -250,6 +251,7 @@ bool CGrid_Polygon_Clip::Get_Extent(int &xMin, int &xCount, int &yMin, int &yCou
 				bFound	= is_InGrid(xMax, y, pMask, pGrids);
 			}
 		}
+		xMax++;
 
 		xCount	= 1 + xMax - xMin;
 		yCount	= 1 + yMax - yMin;
diff --git a/src/modules/shapes/shapes_grid/Grid_Statistics_AddTo_Polygon.cpp b/src/modules/shapes/shapes_grid/Grid_Statistics_AddTo_Polygon.cpp
index 8960a52..475e82b 100644
--- a/src/modules/shapes/shapes_grid/Grid_Statistics_AddTo_Polygon.cpp
+++ b/src/modules/shapes/shapes_grid/Grid_Statistics_AddTo_Polygon.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Grid_Statistics_AddTo_Polygon.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: Grid_Statistics_AddTo_Polygon.cpp 2443 2015-03-18 19:52:26Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -65,9 +65,6 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#include <vector>
-#include <list>
-
 #include "Grid_Statistics_AddTo_Polygon.h"
 
 
@@ -80,23 +77,16 @@
 //---------------------------------------------------------
 CGrid_Statistics_AddTo_Polygon::CGrid_Statistics_AddTo_Polygon(void)
 {
-	CSG_Parameter	*pNode;
-
 	//-----------------------------------------------------
-	// 1. Info...
-
 	Set_Name		(_TL("Grid Statistics for Polygons"));
 
-	Set_Author		(SG_T("(c) 2003 by Olaf Conrad, Quantile Calculation (c) 2007 by Johan Van de Wauw"));
+	Set_Author		("O.Conrad (c) 2003, Quantile Calculation (c) 2007 by Johan Van de Wauw");
 
 	Set_Description	(_TW(
-		"For each polygon statistics about the values of all contained grid nodes will be generated."
+		"Zonal grid statistics. For each polygon statistics based on all covered grid cells will be calculated."
 	));
 
-
 	//-----------------------------------------------------
-	// 2. Parameters...
-
 	Parameters.Add_Grid_List(
 		NULL	, "GRIDS"		, _TL("Grids"),
 		_TL(""),
@@ -112,7 +102,7 @@ CGrid_Statistics_AddTo_Polygon::CGrid_Statistics_AddTo_Polygon(void)
 	Parameters.Add_Choice(
 		NULL	, "METHOD"		, _TL("Method"),
 		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
+		CSG_String::Format("%s|%s|",
 			_TL("standard"),
 			_TL("shape wise, supports overlapping polygons")
 		), 0
@@ -121,27 +111,28 @@ CGrid_Statistics_AddTo_Polygon::CGrid_Statistics_AddTo_Polygon(void)
 	Parameters.Add_Choice(
 		NULL	, "NAMING"		, _TL("Field Naming"),
 		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
+		CSG_String::Format("%s|%s|",
 			_TL("grid number"),
 			_TL("grid name")
 		), 1
 	);
 
-	pNode	= Parameters.Add_Shapes(
+	//-----------------------------------------------------
+	CSG_Parameter	*pNode	= Parameters.Add_Shapes(
 		NULL	, "RESULT"		, _TL("Statistics"),
 		_TL(""),
 		PARAMETER_OUTPUT_OPTIONAL, SHAPE_TYPE_Polygon
 	);
 
-	Parameters.Add_Value(pNode, "COUNT"   , _TL("Number of Cells")   , _TL(""), PARAMETER_TYPE_Bool, true);
-	Parameters.Add_Value(pNode, "MIN"     , _TL("Minimum")           , _TL(""), PARAMETER_TYPE_Bool, true);
-	Parameters.Add_Value(pNode, "MAX"     , _TL("Maximum")           , _TL(""), PARAMETER_TYPE_Bool, true);
-	Parameters.Add_Value(pNode, "RANGE"   , _TL("Range")             , _TL(""), PARAMETER_TYPE_Bool, true);
-	Parameters.Add_Value(pNode, "SUM"     , _TL("Sum")               , _TL(""), PARAMETER_TYPE_Bool, true);
-	Parameters.Add_Value(pNode, "MEAN"    , _TL("Mean")              , _TL(""), PARAMETER_TYPE_Bool, true);
-	Parameters.Add_Value(pNode, "VAR"     , _TL("Variance")          , _TL(""), PARAMETER_TYPE_Bool, true);
+	Parameters.Add_Value(pNode, "COUNT"   , _TL("Number of Cells"   ), _TL(""), PARAMETER_TYPE_Bool, true);
+	Parameters.Add_Value(pNode, "MIN"     , _TL("Minimum"           ), _TL(""), PARAMETER_TYPE_Bool, true);
+	Parameters.Add_Value(pNode, "MAX"     , _TL("Maximum"           ), _TL(""), PARAMETER_TYPE_Bool, true);
+	Parameters.Add_Value(pNode, "RANGE"   , _TL("Range"             ), _TL(""), PARAMETER_TYPE_Bool, true);
+	Parameters.Add_Value(pNode, "SUM"     , _TL("Sum"               ), _TL(""), PARAMETER_TYPE_Bool, true);
+	Parameters.Add_Value(pNode, "MEAN"    , _TL("Mean"              ), _TL(""), PARAMETER_TYPE_Bool, true);
+	Parameters.Add_Value(pNode, "VAR"     , _TL("Variance"          ), _TL(""), PARAMETER_TYPE_Bool, true);
 	Parameters.Add_Value(pNode, "STDDEV"  , _TL("Standard Deviation"), _TL(""), PARAMETER_TYPE_Bool, true);
-	Parameters.Add_Value(pNode, "QUANTILE", _TL("Quantile")          , 
+	Parameters.Add_Value(pNode, "QUANTILE", _TL("Quantile"          ), 
 		_TL("Calculate distribution quantiles. Value specifies interval (median=50, quartiles=25, deciles=10, ...). Set to zero to omit quantile calculation."),
 		PARAMETER_TYPE_Int, 0, 0, true, 50, true
 	);
@@ -155,23 +146,42 @@ CGrid_Statistics_AddTo_Polygon::CGrid_Statistics_AddTo_Polygon(void)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#define GET_FIELD_NAME(VAR)	Naming == 0 ? CSG_String::Format(SG_T("G%02d_%s"), iGrid + 1, VAR) : CSG_String::Format(SG_T("%s [%s]"), pGrid->Get_Name(), VAR)
+#define GET_FIELD_NAME(VAR)	Naming == 0 ? CSG_String::Format("G%02d_%s", iGrid + 1, VAR) : CSG_String::Format("%s [%s]", pGrids->asGrid(iGrid)->Get_Name(), VAR)
 
 //---------------------------------------------------------
 bool CGrid_Statistics_AddTo_Polygon::On_Execute(void)
 {
-	int						Method, Naming, Quantile;
-	CSG_Parameter_Grid_List	*pGrids;
-	CSG_Shapes				*pShapes;
+	//-----------------------------------------------------
+	CSG_Shapes	*pPolygons	= Parameters("POLYGONS")->asShapes();
+
+	if( pPolygons->Get_Count() <= 0 )
+	{
+		Error_Set(_TL("no polygons in input layer"));
+
+		return( false );
+	}
 
 	//-----------------------------------------------------
-	pGrids			= Parameters("GRIDS"   )->asGridList();
-	pShapes			= Parameters("POLYGONS")->asShapes();
-	Method			= Parameters("METHOD"  )->asInt();
-	Naming			= Parameters("NAMING"  )->asInt();
-	Quantile		= Parameters("QUANTILE")->asInt();
+	CSG_Parameter_Grid_List	*pGrids	= Parameters("GRIDS")->asGridList();
 
+	if( pGrids->Get_Count() < 1 )
+	{
+		Error_Set(_TL("no grids in selection"));
+
+		return( false );
+	}
+
+	if( !Get_System()->Get_Extent().Intersects(pPolygons->Get_Extent()) )
+	{
+		Error_Set(_TL("no spatial intersection between grid(s) and polygon layer"));
+
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	int	Quantile	= Parameters("QUANTILE")->asInt();
 	int	nFields		= 0;
+
 	int	fCOUNT		= Parameters("COUNT"   )->asBool() ? nFields++ : -1;
 	int	fMIN		= Parameters("MIN"     )->asBool() ? nFields++ : -1;
 	int	fMAX		= Parameters("MAX"     )->asBool() ? nFields++ : -1;
@@ -189,121 +199,102 @@ bool CGrid_Statistics_AddTo_Polygon::On_Execute(void)
 		return( false );
 	}
 
-	if( pShapes->Get_Count() <= 0 )
-	{
-		Error_Set(_TL("no polygons in polygon layer"));
-
-		return( false );
-	}
+	//-----------------------------------------------------
+	int	Naming	= Parameters("NAMING")->asInt();
+	int	Method	= Parameters("METHOD")->asInt();
 
-	if( !Get_System()->Get_Extent().Intersects(pShapes->Get_Extent()) )
+	if( Method == 0 && !Get_Index(pPolygons) )
 	{
-		Error_Set(_TL("no spatial intersection between grid(s) and polygon layer"));
+		Error_Set(_TL("no grids in selection"));
 
 		return( false );
 	}
 
-	if( Method == 0 && !Get_ShapeIDs(pShapes) )
-	{
-		return( false );
-	}
-
 	//-----------------------------------------------------
-	if( Parameters("RESULT")->asShapes() != NULL && Parameters("RESULT")->asShapes() != pShapes )
+	if( Parameters("RESULT")->asShapes() != NULL && Parameters("RESULT")->asShapes() != pPolygons )
 	{
-		pShapes		= Parameters("RESULT")->asShapes();
-		pShapes		->Assign(Parameters("POLYGONS")->asShapes());
+		pPolygons	= Parameters("RESULT")->asShapes();
+		pPolygons	->Assign(Parameters("POLYGONS")->asShapes());
+		pPolygons	->Set_Name(CSG_String::Format("%s [%s]", Parameters("POLYGONS")->asShapes()->Get_Name(), _TL("Grid Statistics")));
 	}
 
+	CSG_Simple_Statistics	*Statistics	= new CSG_Simple_Statistics[pPolygons->Get_Count()];
+
 	//-----------------------------------------------------
 	for(int iGrid=0; iGrid<pGrids->Get_Count() && Process_Get_Okay(); iGrid++)
 	{
-		CSG_Simple_Statistics	*Statistics	= new CSG_Simple_Statistics[pShapes->Get_Count()];
-		CSG_Table				*Values		= fQUANTILE >= 0 ? new CSG_Table[pShapes->Get_Count()] : NULL;
-		CSG_Grid				*pGrid		= pGrids->asGrid(iGrid);
-
-		Process_Set_Text(CSG_String::Format(SG_T("[%d/%d] %s"), 1 + iGrid, pGrids->Get_Count(), pGrid->Get_Name()));
+		Process_Set_Text(CSG_String::Format("[%d/%d] %s", 1 + iGrid, pGrids->Get_Count(), pGrids->asGrid(iGrid)->Get_Name()));
 
-		if( (Method == 0 && Get_Statistics    (pGrid, pShapes, Statistics, Values))
-		||  (Method == 1 && Get_Statistics_Alt(pGrid, pShapes, Statistics, Values)) )
+		if( (Method == 0 && Get_Statistics    (pGrids->asGrid(iGrid), pPolygons, Statistics, Quantile > 0))
+		||  (Method == 1 && Get_Statistics_Alt(pGrids->asGrid(iGrid), pPolygons, Statistics, Quantile > 0)) )
 		{
-			nFields		= pShapes->Get_Field_Count();
-
-			if( fCOUNT    >= 0 )	pShapes->Add_Field(GET_FIELD_NAME(_TL("CELLS")   ), SG_DATATYPE_Int   );
-			if( fMIN      >= 0 )	pShapes->Add_Field(GET_FIELD_NAME(_TL("MIN")     ), SG_DATATYPE_Double);
-			if( fMAX      >= 0 )	pShapes->Add_Field(GET_FIELD_NAME(_TL("MAX")     ), SG_DATATYPE_Double);
-			if( fRANGE    >= 0 )	pShapes->Add_Field(GET_FIELD_NAME(_TL("RANGE")   ), SG_DATATYPE_Double);
-			if( fSUM      >= 0 )	pShapes->Add_Field(GET_FIELD_NAME(_TL("SUM")     ), SG_DATATYPE_Double);
-			if( fMEAN     >= 0 )	pShapes->Add_Field(GET_FIELD_NAME(_TL("MEAN")    ), SG_DATATYPE_Double);
-			if( fVAR      >= 0 )	pShapes->Add_Field(GET_FIELD_NAME(_TL("VARIANCE")), SG_DATATYPE_Double);
-			if( fSTDDEV   >= 0 )	pShapes->Add_Field(GET_FIELD_NAME(_TL("STDDEV")  ), SG_DATATYPE_Double);
+			nFields	= pPolygons->Get_Field_Count();
+
+			if( fCOUNT    >= 0 )	pPolygons->Add_Field(GET_FIELD_NAME(_TL("CELLS"   )), SG_DATATYPE_Int   );
+			if( fMIN      >= 0 )	pPolygons->Add_Field(GET_FIELD_NAME(_TL("MIN"     )), SG_DATATYPE_Double);
+			if( fMAX      >= 0 )	pPolygons->Add_Field(GET_FIELD_NAME(_TL("MAX"     )), SG_DATATYPE_Double);
+			if( fRANGE    >= 0 )	pPolygons->Add_Field(GET_FIELD_NAME(_TL("RANGE"   )), SG_DATATYPE_Double);
+			if( fSUM      >= 0 )	pPolygons->Add_Field(GET_FIELD_NAME(_TL("SUM"     )), SG_DATATYPE_Double);
+			if( fMEAN     >= 0 )	pPolygons->Add_Field(GET_FIELD_NAME(_TL("MEAN"    )), SG_DATATYPE_Double);
+			if( fVAR      >= 0 )	pPolygons->Add_Field(GET_FIELD_NAME(_TL("VARIANCE")), SG_DATATYPE_Double);
+			if( fSTDDEV   >= 0 )	pPolygons->Add_Field(GET_FIELD_NAME(_TL("STDDEV"  )), SG_DATATYPE_Double);
 			if( fQUANTILE >= 0 )
 			{
 				for(int iQuantile=Quantile; iQuantile<100; iQuantile+=Quantile)
 				{
-					pShapes->Add_Field(GET_FIELD_NAME(CSG_String::Format(SG_T("Q%02d"), iQuantile).c_str()), SG_DATATYPE_Double);
+					pPolygons->Add_Field(GET_FIELD_NAME(CSG_String::Format("Q%02d", iQuantile).c_str()), SG_DATATYPE_Double);
 				}
 			}
 
 			//---------------------------------------------
-			for(int iShape=0; iShape<pShapes->Get_Count() && Set_Progress(iShape, pShapes->Get_Count()); iShape++)
+			for(int i=0; i<pPolygons->Get_Count() && Set_Progress(i, pPolygons->Get_Count()); i++)
 			{
-				CSG_Shape	*pShape	= pShapes->Get_Shape(iShape);
+				CSG_Shape	*pPolygon	= pPolygons->Get_Shape(i);
 
-				if( Statistics[iShape].Get_Count() == 0 )
+				if( Statistics[i].Get_Count() == 0 )
 				{
-					if( fCOUNT    >= 0 )	pShape->Set_NoData(nFields + fCOUNT);
-					if( fMIN      >= 0 )	pShape->Set_NoData(nFields + fMIN);
-					if( fMAX      >= 0 )	pShape->Set_NoData(nFields + fMAX);
-					if( fRANGE    >= 0 )	pShape->Set_NoData(nFields + fRANGE);
-					if( fSUM      >= 0 )	pShape->Set_NoData(nFields + fSUM);
-					if( fMEAN     >= 0 )	pShape->Set_NoData(nFields + fMEAN);
-					if( fVAR      >= 0 )	pShape->Set_NoData(nFields + fVAR);
-					if( fSTDDEV   >= 0 )	pShape->Set_NoData(nFields + fSTDDEV);
+					if( fCOUNT    >= 0 )	pPolygon->Set_NoData(nFields + fCOUNT );
+					if( fMIN      >= 0 )	pPolygon->Set_NoData(nFields + fMIN   );
+					if( fMAX      >= 0 )	pPolygon->Set_NoData(nFields + fMAX   );
+					if( fRANGE    >= 0 )	pPolygon->Set_NoData(nFields + fRANGE );
+					if( fSUM      >= 0 )	pPolygon->Set_NoData(nFields + fSUM   );
+					if( fMEAN     >= 0 )	pPolygon->Set_NoData(nFields + fMEAN  );
+					if( fVAR      >= 0 )	pPolygon->Set_NoData(nFields + fVAR   );
+					if( fSTDDEV   >= 0 )	pPolygon->Set_NoData(nFields + fSTDDEV);
 					if( fQUANTILE >= 0 )
 					{
 						for(int iQuantile=Quantile, iField=nFields + fQUANTILE; iQuantile<100; iQuantile+=Quantile, iField++)
 						{
-							pShape->Set_NoData(iField);
+							pPolygon->Set_NoData(iField);
 						}
 					}
 				}
 				else
 				{
-					if( fCOUNT    >= 0 )	pShape->Set_Value(nFields + fCOUNT	, Statistics[iShape].Get_Count   ());
-					if( fMIN      >= 0 )	pShape->Set_Value(nFields + fMIN	, Statistics[iShape].Get_Minimum ());
-					if( fMAX      >= 0 )	pShape->Set_Value(nFields + fMAX	, Statistics[iShape].Get_Maximum ());
-					if( fRANGE    >= 0 )	pShape->Set_Value(nFields + fRANGE	, Statistics[iShape].Get_Range   ());
-					if( fSUM      >= 0 )	pShape->Set_Value(nFields + fSUM	, Statistics[iShape].Get_Sum     ());
-					if( fMEAN     >= 0 )	pShape->Set_Value(nFields + fMEAN	, Statistics[iShape].Get_Mean    ());
-					if( fVAR      >= 0 )	pShape->Set_Value(nFields + fVAR	, Statistics[iShape].Get_Variance());
-					if( fSTDDEV   >= 0 )	pShape->Set_Value(nFields + fSTDDEV	, Statistics[iShape].Get_StdDev  ());
+					if( fCOUNT    >= 0 )	pPolygon->Set_Value(nFields + fCOUNT , Statistics[i].Get_Count   ());
+					if( fMIN      >= 0 )	pPolygon->Set_Value(nFields + fMIN   , Statistics[i].Get_Minimum ());
+					if( fMAX      >= 0 )	pPolygon->Set_Value(nFields + fMAX   , Statistics[i].Get_Maximum ());
+					if( fRANGE    >= 0 )	pPolygon->Set_Value(nFields + fRANGE , Statistics[i].Get_Range   ());
+					if( fSUM      >= 0 )	pPolygon->Set_Value(nFields + fSUM   , Statistics[i].Get_Sum     ());
+					if( fMEAN     >= 0 )	pPolygon->Set_Value(nFields + fMEAN  , Statistics[i].Get_Mean    ());
+					if( fVAR      >= 0 )	pPolygon->Set_Value(nFields + fVAR   , Statistics[i].Get_Variance());
+					if( fSTDDEV   >= 0 )	pPolygon->Set_Value(nFields + fSTDDEV, Statistics[i].Get_StdDev  ());
 					if( fQUANTILE >= 0 )
 					{
-						Values[iShape].Set_Index(0, TABLE_INDEX_Ascending);
-
-						double	dQuantile	= Values[iShape].Get_Count() / 100.0;
-
 						for(int iQuantile=Quantile, iField=nFields + fQUANTILE; iQuantile<100; iQuantile+=Quantile, iField++)
 						{
-							pShape->Set_Value(iField, Values[iShape].Get_Record_byIndex((int)(iQuantile * dQuantile))->asDouble(0));
+							pPolygon->Set_Value(iField, Statistics[i].Get_Quantile(iQuantile));
 						}
 					}
 				}
 			}
 		}
-
-		//-------------------------------------------------
-		delete[](Statistics);
-
-		if( Values )
-		{
-			delete[](Values);
-		}
 	}
 
 	//-----------------------------------------------------
-	DataObject_Update(pShapes);
+	delete[](Statistics);
+
+	DataObject_Update(pPolygons);
 
 	return( true );
 }
@@ -316,27 +307,22 @@ bool CGrid_Statistics_AddTo_Polygon::On_Execute(void)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CGrid_Statistics_AddTo_Polygon::Get_Statistics(CSG_Grid *pGrid, CSG_Shapes *pShapes, CSG_Simple_Statistics *Statistics, CSG_Table *Values)
+bool CGrid_Statistics_AddTo_Polygon::Get_Statistics(CSG_Grid *pGrid, CSG_Shapes *pPolygons, CSG_Simple_Statistics *Statistics, bool bQuantiles)
 {
-	int		x, y, iShape;
+	int		i;
+
+	for(i=0; i<pPolygons->Get_Count(); i++)
+	{
+		Statistics[i].Create(bQuantiles);
+	}
 
-	for(y=0; y<Get_NY() && Set_Progress(y); y++)
+	for(int y=0; y<Get_NY() && Set_Progress(y); y++)
 	{
-		for(x=0; x<Get_NX(); x++)
+		for(int x=0; x<Get_NX(); x++)
 		{
-			if( !pGrid->is_NoData(x, y) && (iShape = m_ShapeIDs.asInt(x, y)) >= 0 && iShape < pShapes->Get_Count() )
+			if( (i = m_Index.asInt(x, y)) >= 0 && i < pPolygons->Get_Count() )
 			{
-				Statistics[iShape].Add_Value(pGrid->asDouble(x, y));
-
-				if( Values )
-				{
-					if( Values[iShape].Get_Field_Count() == 0 )
-					{
-						Values[iShape].Add_Field("Z", SG_DATATYPE_Double);
-					}
-
-					Values[iShape].Add_Record()->Set_Value(0, pGrid->asDouble(x, y));
-				}
+				Statistics[i]	+= pGrid->asDouble(x, y);
 			}
 		}
 	}
@@ -345,16 +331,18 @@ bool CGrid_Statistics_AddTo_Polygon::Get_Statistics(CSG_Grid *pGrid, CSG_Shapes
 }
 
 //---------------------------------------------------------
-bool CGrid_Statistics_AddTo_Polygon::Get_Statistics_Alt(CSG_Grid *pGrid, CSG_Shapes *pShapes, CSG_Simple_Statistics *Statistics, CSG_Table *Values)
+bool CGrid_Statistics_AddTo_Polygon::Get_Statistics_Alt(CSG_Grid *pGrid, CSG_Shapes *pPolygons, CSG_Simple_Statistics *Statistics, bool bQuantiles)
 {
-	for(int iShape=0; iShape<pShapes->Get_Count() && Set_Progress(iShape, pShapes->Get_Count()); iShape++)
+	for(int i=0; i<pPolygons->Get_Count() && Set_Progress(i, pPolygons->Get_Count()); i++)
 	{
-		CSG_Shape_Polygon	*pShape	= (CSG_Shape_Polygon *)pShapes->Get_Shape(iShape);
+		Statistics[i].Create(bQuantiles);
 
-		int	ax	= Get_System()->Get_xWorld_to_Grid(pShapes->Get_Extent().Get_XMin()) - 1;	if( ax < 0 )			ax	= 0;
-		int	bx	= Get_System()->Get_xWorld_to_Grid(pShapes->Get_Extent().Get_XMax()) + 1;	if( bx >= Get_NX() )	bx	= Get_NX() - 1;
-		int	ay	= Get_System()->Get_yWorld_to_Grid(pShapes->Get_Extent().Get_YMin()) - 1;	if( ay < 0 )			ay	= 0;
-		int	by	= Get_System()->Get_yWorld_to_Grid(pShapes->Get_Extent().Get_YMax()) + 1;	if( by >= Get_NY() )	by	= Get_NY() - 1;
+		CSG_Shape_Polygon	*pPolygon	= (CSG_Shape_Polygon *)pPolygons->Get_Shape(i);
+
+		int	ax	= Get_System()->Get_xWorld_to_Grid(pPolygons->Get_Extent().Get_XMin()) - 1;	if( ax < 0         )	ax	= 0;
+		int	bx	= Get_System()->Get_xWorld_to_Grid(pPolygons->Get_Extent().Get_XMax()) + 1;	if( bx >= Get_NX() )	bx	= Get_NX() - 1;
+		int	ay	= Get_System()->Get_yWorld_to_Grid(pPolygons->Get_Extent().Get_YMin()) - 1;	if( ay < 0         )	ay	= 0;
+		int	by	= Get_System()->Get_yWorld_to_Grid(pPolygons->Get_Extent().Get_YMax()) + 1;	if( by >= Get_NY() )	by	= Get_NY() - 1;
 
 		double	py	= Get_System()->Get_yGrid_to_World(ay);
 
@@ -364,19 +352,9 @@ bool CGrid_Statistics_AddTo_Polygon::Get_Statistics_Alt(CSG_Grid *pGrid, CSG_Sha
 
 			for(int x=ax; x<=bx; x++, px+=Get_Cellsize())
 			{
-				if( !pGrid->is_NoData(x, y) && pShape->Contains(px, py) )
+				if( !pGrid->is_NoData(x, y) && pPolygon->Contains(px, py) )
 				{
-					Statistics[iShape].Add_Value(pGrid->asDouble(x, y));
-
-					if( Values )
-					{
-						if( Values[iShape].Get_Field_Count() == 0 )
-						{
-							Values[iShape].Add_Field("Z", SG_DATATYPE_Double);
-						}
-
-						Values[iShape].Add_Record()->Set_Value(0, pGrid->asDouble(x, y));
-					}
+					Statistics[i]	+= pGrid->asDouble(x, y);
 				}
 			}
 		}
@@ -393,26 +371,26 @@ bool CGrid_Statistics_AddTo_Polygon::Get_Statistics_Alt(CSG_Grid *pGrid, CSG_Sha
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CGrid_Statistics_AddTo_Polygon::Get_ShapeIDs(CSG_Shapes *pShapes)
+bool CGrid_Statistics_AddTo_Polygon::Get_Index(CSG_Shapes *pPolygons)
 {
 	bool		bFill, *bCrossing;
 	int			x, y, ix, xStart, xStop, iShape, iPart, iPoint;
 	double		yPos;
 	TSG_Point	pLeft, pRight, pa, pb, p;
 	TSG_Rect	Extent;
-	CSG_Shape	*pShape;
+	CSG_Shape	*pPolygon;
 
 	//-----------------------------------------------------
-	m_ShapeIDs.Create(*Get_System(), pShapes->Get_Count() < 32767 ? SG_DATATYPE_Short : SG_DATATYPE_Int);
-	m_ShapeIDs.Assign(-1.0);
+	m_Index.Create(*Get_System(), pPolygons->Get_Count() < 32767 ? SG_DATATYPE_Short : SG_DATATYPE_Int);
+	m_Index.Assign(-1.0);
 
 	bCrossing	= (bool *)SG_Malloc(Get_NX() * sizeof(bool));
 
 	//-----------------------------------------------------
-	for(iShape=0; iShape<pShapes->Get_Count() && Set_Progress(iShape, pShapes->Get_Count()); iShape++)
+	for(iShape=0; iShape<pPolygons->Get_Count() && Set_Progress(iShape, pPolygons->Get_Count()); iShape++)
 	{
-		pShape		= pShapes->Get_Shape(iShape);
-		Extent		= pShape->Get_Extent().m_rect;
+		pPolygon		= pPolygons->Get_Shape(iShape);
+		Extent		= pPolygon->Get_Extent().m_rect;
 
 		xStart		= Get_System()->Get_xWorld_to_Grid(Extent.xMin) - 1;	if( xStart < 0 )		xStart	= 0;
 		xStop		= Get_System()->Get_xWorld_to_Grid(Extent.xMax) + 1;	if( xStop >= Get_NX() )	xStop	= Get_NX() - 1;
@@ -430,14 +408,14 @@ bool CGrid_Statistics_AddTo_Polygon::Get_ShapeIDs(CSG_Shapes *pShapes)
 				pLeft.y	= pRight.y	= yPos;
 
 				//-----------------------------------------
-				for(iPart=0; iPart<pShape->Get_Part_Count(); iPart++)
+				for(iPart=0; iPart<pPolygon->Get_Part_Count(); iPart++)
 				{
-					pb		= pShape->Get_Point(pShape->Get_Point_Count(iPart) - 1, iPart);
+					pb		= pPolygon->Get_Point(pPolygon->Get_Point_Count(iPart) - 1, iPart);
 
-					for(iPoint=0; iPoint<pShape->Get_Point_Count(iPart); iPoint++)
+					for(iPoint=0; iPoint<pPolygon->Get_Point_Count(iPart); iPoint++)
 					{
 						pa	= pb;
-						pb	= pShape->Get_Point(iPoint, iPart);
+						pb	= pPolygon->Get_Point(iPoint, iPart);
 
 						if(	(	(pa.y <= yPos && yPos < pb.y)
 							||	(pa.y > yPos && yPos >= pb.y)	)	)
@@ -470,7 +448,7 @@ bool CGrid_Statistics_AddTo_Polygon::Get_ShapeIDs(CSG_Shapes *pShapes)
 
 					if( bFill )
 					{
-						m_ShapeIDs.Set_Value(x, y, iShape);
+						m_Index.Set_Value(x, y, iShape);
 					}
 				}
 			}
diff --git a/src/modules/shapes/shapes_grid/Grid_Statistics_AddTo_Polygon.h b/src/modules/shapes/shapes_grid/Grid_Statistics_AddTo_Polygon.h
index 2f1ef96..6fe3ae9 100644
--- a/src/modules/shapes/shapes_grid/Grid_Statistics_AddTo_Polygon.h
+++ b/src/modules/shapes/shapes_grid/Grid_Statistics_AddTo_Polygon.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Grid_Statistics_AddTo_Polygon.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: Grid_Statistics_AddTo_Polygon.h 2443 2015-03-18 19:52:26Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -97,13 +97,13 @@ protected:
 
 private:
 
-	CSG_Grid				m_ShapeIDs;
+	CSG_Grid				m_Index;
 
 
-	bool					Get_Statistics		(CSG_Grid *pGrid, CSG_Shapes *pShapes, CSG_Simple_Statistics *Statistics, CSG_Table *Values);
-	bool					Get_Statistics_Alt	(CSG_Grid *pGrid, CSG_Shapes *pShapes, CSG_Simple_Statistics *Statistics, CSG_Table *Values);
+	bool					Get_Statistics		(CSG_Grid *pGrid, CSG_Shapes *pPolygons, CSG_Simple_Statistics *Statistics, bool bQuantiles);
+	bool					Get_Statistics_Alt	(CSG_Grid *pGrid, CSG_Shapes *pPolygons, CSG_Simple_Statistics *Statistics, bool bQuantiles);
 
-	bool					Get_ShapeIDs		(CSG_Shapes *pShapes);
+	bool					Get_Index			(CSG_Shapes *pPolygons);
 
 };
 
diff --git a/src/modules/shapes/shapes_grid/Grid_Statistics_For_Points.cpp b/src/modules/shapes/shapes_grid/Grid_Statistics_For_Points.cpp
new file mode 100644
index 0000000..8d5a6d4
--- /dev/null
+++ b/src/modules/shapes/shapes_grid/Grid_Statistics_For_Points.cpp
@@ -0,0 +1,338 @@
+/**********************************************************
+ * Version $Id: Grid_Statistics_For_Points.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ *********************************************************/
+
+///////////////////////////////////////////////////////////
+//                                                       //
+//                         SAGA                          //
+//                                                       //
+//      System for Automated Geoscientific Analyses      //
+//                                                       //
+//                    Module Library:                    //
+//                      Grid_Shapes                      //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//             Grid_Statistics_For_Points.cpp            //
+//                                                       //
+//                 Copyright (C) 2015 by                 //
+//                      Olaf Conrad                      //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+// This file is part of 'SAGA - System for Automated     //
+// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
+//                                                       //
+// SAGA is distributed in the hope that it will be       //
+// useful, but WITHOUT ANY WARRANTY; without even the    //
+// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
+// PARTICULAR PURPOSE. See the GNU General Public        //
+// License for more details.                             //
+//                                                       //
+// You should have received a copy of the GNU General    //
+// Public License along with this program; if not,       //
+// write to the Free Software Foundation, Inc.,          //
+// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
+// USA.                                                  //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//    e-mail:     oconrad at saga-gis.org                   //
+//                                                       //
+//    contact:    Olaf Conrad                            //
+//                Institute of Geography                 //
+//                University of Hamburg                  //
+//                Germany                                //
+//                                                       //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#include "Grid_Statistics_For_Points.h"
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+CGrid_Statistics_For_Points::CGrid_Statistics_For_Points(void)
+{
+	//-----------------------------------------------------
+	Set_Name		(_TL("Grid Statistics for Points"));
+
+	Set_Author		("O.Conrad (c) 2015");
+
+	Set_Description	(_TW(
+		"For each given point statistics based on all grid cells in the defined neighbourhood will be calculated."
+	));
+
+	//-----------------------------------------------------
+	Parameters.Add_Grid_List(
+		NULL	, "GRIDS"		, _TL("Grids"),
+		_TL(""),
+		PARAMETER_INPUT
+	);
+
+	Parameters.Add_Shapes(
+		NULL	, "POINTS"		, _TL("Points"),
+		_TL(""),
+		PARAMETER_INPUT, SHAPE_TYPE_Point
+	);
+
+	Parameters.Add_Choice(
+		NULL	, "KERNEL_TYPE"	, _TL("Kernel Type"),
+		_TL(""),
+		CSG_String::Format("%s|%s|",
+			_TL("square"),
+			_TL("circle")
+		), 0
+	);
+
+	Parameters.Add_Value(
+		NULL	, "KERNEL_SIZE"	, _TL("Kernel Size"),
+		_TL("kernel size defined as radius number of cells"),
+		PARAMETER_TYPE_Int, 1, 1, true
+	);
+
+	Parameters.Add_Choice(
+		NULL	, "NAMING"		, _TL("Field Naming"),
+		_TL(""),
+		CSG_String::Format("%s|%s|",
+			_TL("grid number"),
+			_TL("grid name")
+		), 1
+	);
+
+	//-----------------------------------------------------
+	CSG_Parameter	*pNode	= Parameters.Add_Shapes(
+		NULL	, "RESULT"		, _TL("Statistics"),
+		_TL(""),
+		PARAMETER_OUTPUT_OPTIONAL, SHAPE_TYPE_Point
+	);
+
+	Parameters.Add_Value(pNode, "COUNT"   , _TL("Number of Cells"   ), _TL(""), PARAMETER_TYPE_Bool, true);
+	Parameters.Add_Value(pNode, "MIN"     , _TL("Minimum"           ), _TL(""), PARAMETER_TYPE_Bool, true);
+	Parameters.Add_Value(pNode, "MAX"     , _TL("Maximum"           ), _TL(""), PARAMETER_TYPE_Bool, true);
+	Parameters.Add_Value(pNode, "RANGE"   , _TL("Range"             ), _TL(""), PARAMETER_TYPE_Bool, true);
+	Parameters.Add_Value(pNode, "SUM"     , _TL("Sum"               ), _TL(""), PARAMETER_TYPE_Bool, true);
+	Parameters.Add_Value(pNode, "MEAN"    , _TL("Mean"              ), _TL(""), PARAMETER_TYPE_Bool, true);
+	Parameters.Add_Value(pNode, "VAR"     , _TL("Variance"          ), _TL(""), PARAMETER_TYPE_Bool, true);
+	Parameters.Add_Value(pNode, "STDDEV"  , _TL("Standard Deviation"), _TL(""), PARAMETER_TYPE_Bool, true);
+	Parameters.Add_Value(pNode, "QUANTILE", _TL("Quantile"          ), 
+		_TL("Calculate distribution quantiles. Value specifies interval (median=50, quartiles=25, deciles=10, ...). Set to zero to omit quantile calculation."),
+		PARAMETER_TYPE_Int, 0, 0, true, 50, true
+	);
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CGrid_Statistics_For_Points::On_Execute(void)
+{
+	//-----------------------------------------------------
+	CSG_Shapes	*pPoints	= Parameters("POINTS")->asShapes();
+
+	if( pPoints->Get_Count() <= 0 )
+	{
+		Error_Set(_TL("no points in input layer"));
+
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	CSG_Parameter_Grid_List	*pGrids	= Parameters("GRIDS")->asGridList();
+
+	if( pGrids->Get_Count() < 1 )
+	{
+		Error_Set(_TL("no grids in selection"));
+
+		return( false );
+	}
+
+	if( !Get_System()->Get_Extent().Intersects(pPoints->Get_Extent()) )
+	{
+		Error_Set(_TL("no spatial intersection between grid(s) and points layer"));
+
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	if( !m_Kernel.Set_Radius(Parameters("KERNEL_SIZE")->asInt(), Parameters("KERNEL_TYPE")->asInt() == 0) )
+	{
+		Error_Set(_TL("could not initialize kernel"));
+
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	int	Quantile	= Parameters("QUANTILE")->asInt();
+	int	nFields		= 0, offField;
+
+	int	fCOUNT		= Parameters("COUNT"   )->asBool() ? nFields++ : -1;
+	int	fMIN		= Parameters("MIN"     )->asBool() ? nFields++ : -1;
+	int	fMAX		= Parameters("MAX"     )->asBool() ? nFields++ : -1;
+	int	fRANGE		= Parameters("RANGE"   )->asBool() ? nFields++ : -1;
+	int	fSUM		= Parameters("SUM"     )->asBool() ? nFields++ : -1;
+	int	fMEAN		= Parameters("MEAN"    )->asBool() ? nFields++ : -1;
+	int	fVAR		= Parameters("VAR"     )->asBool() ? nFields++ : -1;
+	int	fSTDDEV		= Parameters("STDDEV"  )->asBool() ? nFields++ : -1;
+	int	fQUANTILE	= Quantile > 0                     ? nFields++ : -1;
+
+	if( nFields == 0 )
+	{
+		Error_Set(_TL("no output parameter in selection"));
+
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	if( Parameters("RESULT")->asShapes() != NULL && Parameters("RESULT")->asShapes() != pPoints )
+	{
+		pPoints	= Parameters("RESULT")->asShapes();
+		pPoints	->Assign(Parameters("POINTS")->asShapes());
+		pPoints	->Set_Name(CSG_String::Format("%s [%s]", Parameters("POINTS")->asShapes()->Get_Name(), _TL("Grid Statistics")));
+	}
+
+	//-----------------------------------------------------
+	{
+		#define GET_FIELD_NAME(VAR)	Naming == 0 ? CSG_String::Format(SG_T("G%02d_%s"), iGrid + 1, VAR) : CSG_String::Format(SG_T("%s [%s]"), pGrids->asGrid(iGrid)->Get_Name(), VAR)
+
+		int	Naming	= Parameters("NAMING")->asInt();
+
+		offField	= pPoints->Get_Field_Count();
+
+		for(int iGrid=0; iGrid<pGrids->Get_Count(); iGrid++)
+		{
+			int	iField	= pPoints->Get_Field_Count();
+
+			if( fCOUNT    >= 0 )	pPoints->Add_Field(GET_FIELD_NAME(_TL("CELLS"   )), SG_DATATYPE_Int   );
+			if( fMIN      >= 0 )	pPoints->Add_Field(GET_FIELD_NAME(_TL("MIN"     )), SG_DATATYPE_Double);
+			if( fMAX      >= 0 )	pPoints->Add_Field(GET_FIELD_NAME(_TL("MAX"     )), SG_DATATYPE_Double);
+			if( fRANGE    >= 0 )	pPoints->Add_Field(GET_FIELD_NAME(_TL("RANGE"   )), SG_DATATYPE_Double);
+			if( fSUM      >= 0 )	pPoints->Add_Field(GET_FIELD_NAME(_TL("SUM"     )), SG_DATATYPE_Double);
+			if( fMEAN     >= 0 )	pPoints->Add_Field(GET_FIELD_NAME(_TL("MEAN"    )), SG_DATATYPE_Double);
+			if( fVAR      >= 0 )	pPoints->Add_Field(GET_FIELD_NAME(_TL("VARIANCE")), SG_DATATYPE_Double);
+			if( fSTDDEV   >= 0 )	pPoints->Add_Field(GET_FIELD_NAME(_TL("STDDEV"  )), SG_DATATYPE_Double);
+			if( fQUANTILE >= 0 )
+			{
+				for(int iQuantile=Quantile; iQuantile<100; iQuantile+=Quantile)
+				{
+					pPoints->Add_Field(GET_FIELD_NAME(CSG_String::Format(SG_T("Q%02d"), iQuantile).c_str()), SG_DATATYPE_Double);
+
+					if( iGrid == 0 && iQuantile > Quantile )
+					{
+						nFields++;
+					}
+				}
+			}
+		}
+	}
+
+	//-----------------------------------------------------
+	for(int iPoint=0; iPoint<pPoints->Get_Count() && Set_Progress(iPoint, pPoints->Get_Count()); iPoint++)
+	{
+		CSG_Shape	*pPoint	= pPoints->Get_Shape(iPoint);
+
+		for(int iGrid=0; iGrid<pGrids->Get_Count(); iGrid++)
+		{
+			CSG_Simple_Statistics	Statistics(Quantile >= 0);
+
+			int	iField	= offField + iGrid * nFields;
+
+			if( !Get_Statistics(pPoint->Get_Point(0), pGrids->asGrid(iGrid), Statistics) )
+			{
+				if( fCOUNT    >= 0 )	pPoint->Set_NoData(iField + fCOUNT );
+				if( fMIN      >= 0 )	pPoint->Set_NoData(iField + fMIN   );
+				if( fMAX      >= 0 )	pPoint->Set_NoData(iField + fMAX   );
+				if( fRANGE    >= 0 )	pPoint->Set_NoData(iField + fRANGE );
+				if( fSUM      >= 0 )	pPoint->Set_NoData(iField + fSUM   );
+				if( fMEAN     >= 0 )	pPoint->Set_NoData(iField + fMEAN  );
+				if( fVAR      >= 0 )	pPoint->Set_NoData(iField + fVAR   );
+				if( fSTDDEV   >= 0 )	pPoint->Set_NoData(iField + fSTDDEV);
+				if( fQUANTILE >= 0 )
+				{
+					for(int iQuantile=Quantile; iQuantile<100; iQuantile+=Quantile, iField++)
+					{
+						pPoint->Set_NoData(iField + fQUANTILE);
+					}
+				}
+			}
+			else
+			{
+				if( fCOUNT    >= 0 )	pPoint->Set_Value(iField + fCOUNT , Statistics.Get_Count   ());
+				if( fMIN      >= 0 )	pPoint->Set_Value(iField + fMIN   , Statistics.Get_Minimum ());
+				if( fMAX      >= 0 )	pPoint->Set_Value(iField + fMAX   , Statistics.Get_Maximum ());
+				if( fRANGE    >= 0 )	pPoint->Set_Value(iField + fRANGE , Statistics.Get_Range   ());
+				if( fSUM      >= 0 )	pPoint->Set_Value(iField + fSUM   , Statistics.Get_Sum     ());
+				if( fMEAN     >= 0 )	pPoint->Set_Value(iField + fMEAN  , Statistics.Get_Mean    ());
+				if( fVAR      >= 0 )	pPoint->Set_Value(iField + fVAR   , Statistics.Get_Variance());
+				if( fSTDDEV   >= 0 )	pPoint->Set_Value(iField + fSTDDEV, Statistics.Get_StdDev  ());
+				if( fQUANTILE >= 0 )
+				{
+					for(int iQuantile=Quantile; iQuantile<100; iQuantile+=Quantile, iField++)
+					{
+						pPoint->Set_Value(iField + fQUANTILE, Statistics.Get_Quantile(iQuantile));
+					}
+				}
+			}
+		}
+	}
+
+	//-----------------------------------------------------
+	DataObject_Update(pPoints);
+
+	m_Kernel.Destroy();
+
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CGrid_Statistics_For_Points::Get_Statistics(const TSG_Point &Point, CSG_Grid *pGrid, CSG_Simple_Statistics &Statistics)
+{
+	int	x	= Get_System()->Get_xWorld_to_Grid(Point.x);
+	int	y	= Get_System()->Get_yWorld_to_Grid(Point.y);
+
+	for(int i=0; i<m_Kernel.Get_Count(); i++)
+	{
+		int	ix	= m_Kernel.Get_X(i, x);
+		int	iy	= m_Kernel.Get_Y(i, y);
+
+		if( pGrid->is_InGrid(ix, iy) )
+		{
+			Statistics	+= pGrid->asDouble(ix, iy);
+		}
+	}
+
+	return( Statistics.Get_Count() > 0 );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
diff --git a/src/modules/grid/grid_filter/Filter_Majority.h b/src/modules/shapes/shapes_grid/Grid_Statistics_For_Points.h
similarity index 83%
copy from src/modules/grid/grid_filter/Filter_Majority.h
copy to src/modules/shapes/shapes_grid/Grid_Statistics_For_Points.h
index 83bf64c..80482d5 100644
--- a/src/modules/grid/grid_filter/Filter_Majority.h
+++ b/src/modules/shapes/shapes_grid/Grid_Statistics_For_Points.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Filter_Majority.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: Grid_Statistics_For_Points.h 1921 2014-01-09 10:24:11Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -9,13 +9,13 @@
 //      System for Automated Geoscientific Analyses      //
 //                                                       //
 //                    Module Library:                    //
-//                      Grid_Filter                      //
+//                      Grid_Shapes                      //
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//                   Filter_Majority.h                   //
+//              Grid_Statistics_For_Points.h             //
 //                                                       //
-//                 Copyright (C) 2010 by                 //
+//                 Copyright (C) 2015 by                 //
 //                      Olaf Conrad                      //
 //                                                       //
 //-------------------------------------------------------//
@@ -59,8 +59,8 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#ifndef HEADER_INCLUDED__Filter_Majority_H
-#define HEADER_INCLUDED__Filter_Majority_H
+#ifndef HEADER_INCLUDED__Grid_Statistics_For_Points_H
+#define HEADER_INCLUDED__Grid_Statistics_For_Points_H
 
 
 ///////////////////////////////////////////////////////////
@@ -80,27 +80,25 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-class CFilter_Majority : public CSG_Module_Grid
+class CGrid_Statistics_For_Points : public CSG_Module_Grid  
 {
 public:
-	CFilter_Majority(void);
+	CGrid_Statistics_For_Points(void);
+
+	virtual CSG_String		Get_MenuPath		(void)	{	return( _TL("R:Grid Values") );	}
 
 
 protected:
 
-	virtual bool			On_Execute		(void);
+	virtual bool			On_Execute			(void);
 
 
 private:
 
-	int						m_Radius, m_Threshold;
-
-	CSG_Grid				m_Kernel, *m_pInput;
-
-	CSG_Class_Statistics	m_Majority;
+	CSG_Grid_Cell_Addressor	m_Kernel;
 
 
-	double					Get_Majority	(int x, int y);
+	bool					Get_Statistics		(const TSG_Point &Point, CSG_Grid *pGrid, CSG_Simple_Statistics &Statistics);
 
 };
 
@@ -112,4 +110,4 @@ private:
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED__Filter_Majority_H
+#endif // #ifndef HEADER_INCLUDED__Grid_Statistics_For_Points_H
diff --git a/src/modules/shapes/shapes_grid/Grid_To_Contour.cpp b/src/modules/shapes/shapes_grid/Grid_To_Contour.cpp
index 4da5fca..9cc84f7 100644
--- a/src/modules/shapes/shapes_grid/Grid_To_Contour.cpp
+++ b/src/modules/shapes/shapes_grid/Grid_To_Contour.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Grid_To_Contour.cpp 2305 2014-10-24 10:12:20Z oconrad $
+ * Version $Id: Grid_To_Contour.cpp 2487 2015-05-06 12:06:58Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -76,28 +76,34 @@ CGrid_To_Contour::CGrid_To_Contour(void)
 	//-----------------------------------------------------
 	Set_Name		(_TL("Contour Lines from Grid"));
 
-	Set_Author		(SG_T("(c) 2001 by O.Conrad"));
+	Set_Author		("O.Conrad (c) 2001");
 
 	Set_Description	(_TW(
-		"Create contour lines (isolines) from grid values. "
+		"Derive contour lines (isolines) from grid. "
 	));
 
 
 	//-----------------------------------------------------
 	Parameters.Add_Grid(
-		NULL, "GRID"	, _TL("Grid"),
+		NULL	, "GRID"		, _TL("Grid"),
 		_TL(""),
 		PARAMETER_INPUT
 	);
 
 	Parameters.Add_Shapes(
-		NULL, "CONTOUR"	, _TL("Contour"),
+		NULL	, "CONTOUR"		, _TL("Contour"),
 		_TL(""),
-		PARAMETER_OUTPUT
+		PARAMETER_OUTPUT, SHAPE_TYPE_Line
+	);
+
+	Parameters.Add_Shapes(
+		NULL	, "POLYGONS"	, _TL("Polygons"),
+		_TL(""),
+		PARAMETER_OUTPUT_OPTIONAL, SHAPE_TYPE_Polygon
 	);
 
 	Parameters.Add_Choice(
-		NULL, "VERTEX"	, _TL("Vertex Type"),
+		NULL	, "VERTEX"		, _TL("Vertex Type"),
 		_TL("choose vertex type for resulting contours"),
 		CSG_String::Format("%s|%s|",
 			SG_T("x, y"),
@@ -106,19 +112,37 @@ CGrid_To_Contour::CGrid_To_Contour(void)
 	);
 
 	Parameters.Add_Value(
-		NULL, "ZMIN"	, _TL("Minimum Contour Value"),
+		NULL	, "SCALE"		, _TL("Interpolation Scale"),
+		_TL("set greater one for line smoothing"),
+		PARAMETER_TYPE_Double, 1.0, 0, true
+	);
+
+	Parameters.Add_Value(
+		NULL	, "LINE_PARTS"	, _TL("Split Parts"),
+		_TL(""),
+		PARAMETER_TYPE_Bool, true
+	);
+
+	Parameters.Add_Value(
+		NULL	, "POLY_PARTS"	, _TL("Split Polygon Parts"),
+		_TL(""),
+		PARAMETER_TYPE_Bool, false
+	);
+
+	Parameters.Add_Value(
+		NULL	, "ZMIN"		, _TL("Minimum Contour Value"),
 		_TL(""),
 		PARAMETER_TYPE_Double, 0.0
 	);
 
 	Parameters.Add_Value(
-		NULL, "ZMAX"	, _TL("Maximum Contour Value"),
+		NULL	, "ZMAX"		, _TL("Maximum Contour Value"),
 		_TL(""),
 		PARAMETER_TYPE_Double, 10000.0
 	);
 
 	Parameters.Add_Value(
-		NULL, "ZSTEP"	, _TL("Equidistance"),
+		NULL	, "ZSTEP"		, _TL("Equidistance"),
 		_TL(""),
 		PARAMETER_TYPE_Double, 10.0, 0, true
 	);
@@ -127,8 +151,6 @@ CGrid_To_Contour::CGrid_To_Contour(void)
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
@@ -136,13 +158,22 @@ int CGrid_To_Contour::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Para
 {
 	if( !SG_STR_CMP(pParameter->Get_Identifier(), "GRID") && pParameter->asGrid() != NULL )
 	{
-		double	zStep	= pParameter->asGrid()->Get_ZRange() / 10.0;
+		double	zStep	= SG_Get_Rounded_To_SignificantFigures(pParameter->asGrid()->Get_ZRange() / 10.0, 1);
 
-		pParameters->Get_Parameter("ZMIN" )->Set_Value(pParameter->asGrid()->Get_ZMin  ());
-		pParameters->Get_Parameter("ZMAX" )->Set_Value(pParameter->asGrid()->Get_ZMax  ());
 		pParameters->Get_Parameter("ZSTEP")->Set_Value(zStep);
 
 		pParameters->Set_Enabled("ZMAX", zStep > 0.0);
+
+		if( zStep > 0.0 )
+		{
+			pParameters->Get_Parameter("ZMIN")->Set_Value(zStep * floor(pParameter->asGrid()->Get_ZMin() / zStep));
+			pParameters->Get_Parameter("ZMAX")->Set_Value(zStep * ceil (pParameter->asGrid()->Get_ZMax() / zStep));
+		}
+		else
+		{
+			pParameters->Get_Parameter("ZMIN")->Set_Value(pParameter->asGrid()->Get_ZMin());
+			pParameters->Get_Parameter("ZMAX")->Set_Value(pParameter->asGrid()->Get_ZMax());
+		}
 	}
 
 	return( 0 );
@@ -156,35 +187,54 @@ int CGrid_To_Contour::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Para
 		pParameters->Set_Enabled("ZMAX", pParameter->asDouble() > 0.0);
 	}
 
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "POLYGONS") )
+	{
+		pParameters->Set_Enabled("LINE_PARTS", pParameter->asShapes() == NULL);
+		pParameters->Set_Enabled("POLY_PARTS", pParameter->asShapes() != NULL);
+	}
+
 	return( 0 );
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 bool CGrid_To_Contour::On_Execute(void)
 {
-	m_pGrid			= Parameters("GRID"   )->asGrid  ();
-	m_pContours		= Parameters("CONTOUR")->asShapes();
+	CSG_Grid	Grid;
+
+	//-----------------------------------------------------
+	m_pGrid			= Parameters("GRID"      )->asGrid  ();
+	m_pContours		= Parameters("CONTOUR"   )->asShapes();
+	m_pPolygons		= Parameters("POLYGONS"  )->asShapes();
 
-	double	zMin	= Parameters("ZMIN"   )->asDouble();
-	double	zMax	= Parameters("ZMAX"   )->asDouble();
-	double	zStep	= Parameters("ZSTEP"  )->asDouble();
+	m_bParts		= Parameters("LINE_PARTS")->asBool  () && !m_pPolygons;	// only split parts if polygons are not requested
+
+	double	zMin	= Parameters("ZMIN"      )->asDouble();
+	double	zMax	= Parameters("ZMAX"      )->asDouble();
+	double	zStep	= Parameters("ZSTEP"     )->asDouble();
 
 	//-----------------------------------------------------
+	CSG_String	Name;
+
 	if( zStep <= 0 )	// just one contour value (zMin)
 	{
 		zStep	= 1;
 		zMax	= zMin;
+
+		Name = Name.Format("%s [%s %s]", m_pGrid->Get_Name(), _TL("Contour" ), SG_Get_String(zMin ).c_str());
 	}
-	else if( zMin < m_pGrid->Get_ZMin() )
+	else
 	{
-		zMin	+= zStep * (int)((m_pGrid->Get_ZMin() - zMin) / zStep);
+		if( zMin < m_pGrid->Get_ZMin() )
+		{
+			zMin	+= zStep * (int)((m_pGrid->Get_ZMin() - zMin) / zStep);
+		}
+
+		Name = Name.Format("%s [%s %s]", m_pGrid->Get_Name(), _TL("Interval"), SG_Get_String(zStep).c_str());
 	}
 
 	if( zMax > m_pGrid->Get_ZMax() )
@@ -193,16 +243,42 @@ bool CGrid_To_Contour::On_Execute(void)
 	}
 
 	//-----------------------------------------------------
-	m_pContours->Create(SHAPE_TYPE_Line, m_pGrid->Get_Name(), NULL,
-		Parameters("VERTEX")->asInt() == 0 ? SG_VERTEX_TYPE_XY : SG_VERTEX_TYPE_XYZ
-	);
+	m_pContours->Create(SHAPE_TYPE_Line, Name, NULL, Parameters("VERTEX")->asInt() == 0 ? SG_VERTEX_TYPE_XY : SG_VERTEX_TYPE_XYZ);
 
 	m_pContours->Add_Field("ID", SG_DATATYPE_Int);
-	m_pContours->Add_Field(CSG_String::Format(SG_T("%s"),m_pGrid->Get_Name()).BeforeFirst(SG_Char('.')), SG_DATATYPE_Double);
+	m_pContours->Add_Field("Z" , SG_DATATYPE_Double);
+
+	if( m_pPolygons )
+	{
+		m_pPolygons->Create(SHAPE_TYPE_Polygon, m_pContours->Get_Name(), NULL,
+			Parameters("VERTEX")->asInt() == 0 ? SG_VERTEX_TYPE_XY : SG_VERTEX_TYPE_XYZ
+		);
+
+		m_pPolygons->Add_Field("ID"   , SG_DATATYPE_Int   );
+		m_pPolygons->Add_Field("MIN"  , SG_DATATYPE_Double);
+		m_pPolygons->Add_Field("MAX"  , SG_DATATYPE_Double);
+		m_pPolygons->Add_Field("RANGE", SG_DATATYPE_String);
+	}
+
+	//-----------------------------------------------------
+	double	Scale	= Parameters("SCALE")->asDouble();
+
+	if( Scale > 0.0 && Scale != 1.0 )
+	{
+		if( !Grid.Create(CSG_Grid_System(m_pGrid->Get_Cellsize() / Scale, m_pGrid->Get_Extent()), m_pGrid->Get_Type()) )
+		{
+			Error_Set(_TL("could allocate memory for scaled grid"));
+
+			return( false );
+		}
+
+		Grid.Assign(m_pGrid, GRID_INTERPOLATION_BSpline);
+
+		m_pGrid	= &Grid;
+	}
 
 	//-----------------------------------------------------
-	m_Rows.Create(SG_DATATYPE_Char, Get_NX() + 1, Get_NY() + 1);
-	m_Cols.Create(SG_DATATYPE_Char, Get_NX() + 1, Get_NY() + 1);
+	m_Edge.Create(SG_DATATYPE_Char, m_pGrid->Get_NX() + 1, m_pGrid->Get_NY() + 1, m_pGrid->Get_Cellsize(), m_pGrid->Get_XMin(), m_pGrid->Get_YMin());
 
 	for(double z=zMin; z<=zMax && Set_Progress(z - zMin, zMax - zMin); z+=zStep)
 	{
@@ -214,8 +290,28 @@ bool CGrid_To_Contour::On_Execute(void)
 		}
 	}
 
-	m_Rows.Destroy();
-	m_Cols.Destroy();
+	//-----------------------------------------------------
+	if( m_pPolygons && m_pContours->Get_Count() > 0 && Set_Progress(0))
+	{
+		Get_Polygons(NULL, (CSG_Shape_Line *)m_pContours->Get_Shape(0));
+
+		for(int i=1; i<m_pContours->Get_Count() && Set_Progress(i, m_pContours->Get_Count()); i++)
+		{
+			Get_Polygons((CSG_Shape_Line *)m_pContours->Get_Shape(i - 1), (CSG_Shape_Line *)m_pContours->Get_Shape(i));
+		}
+
+		if( Set_Progress(100) )
+		{
+			Get_Polygons((CSG_Shape_Line *)m_pContours->Get_Shape(m_pContours->Get_Count() - 1), NULL);
+		}
+
+		if( Parameters("POLY_PARTS")->asBool() )
+		{
+			Split_Polygon_Parts(m_pPolygons);
+		}
+	}
+
+	m_Edge.Destroy();
 
 	//-----------------------------------------------------
 	return( m_pContours->Get_Count() > 0 );
@@ -224,81 +320,110 @@ bool CGrid_To_Contour::On_Execute(void)
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#define IS_EDGE(x, y)	((!m_pGrid->is_InGrid(x, y) || m_pGrid->asDouble(x, y) < z) ? 1.0 : 0.0)
+#define EDGE_ROW	0x01
+#define EDGE_COL	0x02
+
+//---------------------------------------------------------
+inline bool CGrid_To_Contour::is_Edge(int x, int y)
+{
+	return(  m_pGrid->is_InGrid(x    , y    )
+		&& (!m_pGrid->is_InGrid(x - 1, y - 1)
+		||  !m_pGrid->is_InGrid(x    , y - 1)
+		||  !m_pGrid->is_InGrid(x + 1, y - 1)
+		||  !m_pGrid->is_InGrid(x + 1, y    )
+		||  !m_pGrid->is_InGrid(x + 1, y + 1)
+		||  !m_pGrid->is_InGrid(x    , y + 1)
+		||  !m_pGrid->is_InGrid(x - 1, y + 1)
+		||  !m_pGrid->is_InGrid(x - 1, y    ) )
+	);
+}
+
+//---------------------------------------------------------
+inline void CGrid_To_Contour::Set_Row(int x, int y, bool bOn)
+{
+	int	Edge	= m_Edge.asInt(x, y);
+
+	m_Edge.Set_Value(x, y, bOn ? (Edge | EDGE_ROW) : (Edge & EDGE_COL));
+}
+
+inline bool CGrid_To_Contour::Get_Row(int x, int y)
+{
+	return( (m_Edge.asInt(x, y) & EDGE_ROW) != 0 );
+}
+
+//---------------------------------------------------------
+inline void CGrid_To_Contour::Set_Col(int x, int y, bool bOn)
+{
+	int	Edge	= m_Edge.asInt(x, y);
+
+	m_Edge.Set_Value(x, y, bOn ? (Edge | EDGE_COL) : (Edge & EDGE_ROW));
+}
+
+inline bool CGrid_To_Contour::Get_Col(int x, int y)
+{
+	return( (m_Edge.asInt(x, y) & EDGE_COL) != 0 );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 bool CGrid_To_Contour::Get_Contour(double z)
 {
-	int		y;
+	int		x, y;
 
 	//-----------------------------------------------------
-	#pragma omp parallel for private(y)
-	for(y=0; y<Get_NY()-1; y++)	// Find Border Cells
+	#pragma omp parallel for private(x, y)
+	for(y=0; y<m_pGrid->Get_NY(); y++)	// Find Border Cells
 	{
-		for(int x=0; x<Get_NX()-1; x++)
+		for(x=0; x<m_pGrid->Get_NX(); x++)
 		{
 			if( !m_pGrid->is_NoData(x, y) )
 			{
 				if( m_pGrid->asDouble(x, y) >= z )
 				{
-					m_Rows.Set_Value(x, y, !m_pGrid->is_NoData(x + 1, y    ) && m_pGrid->asDouble(x + 1, y    ) <  z ? 1 : 0);
-					m_Cols.Set_Value(x, y, !m_pGrid->is_NoData(x    , y + 1) && m_pGrid->asDouble(x    , y + 1) <  z ? 1 : 0);
+					if( m_pGrid->is_InGrid(x + 1, y    ) && m_pGrid->asDouble(x + 1, y    ) <  z ) Set_Row(x, y, true);
+					if( m_pGrid->is_InGrid(x    , y + 1) && m_pGrid->asDouble(x    , y + 1) <  z ) Set_Col(x, y, true);
 				}
-				else
+				else // if( m_pGrid->asDouble(x, y) < z )
 				{
-					m_Rows.Set_Value(x, y, !m_pGrid->is_NoData(x + 1, y    ) && m_pGrid->asDouble(x + 1, y    ) >= z ? 1 : 0);
-					m_Cols.Set_Value(x, y, !m_pGrid->is_NoData(x    , y + 1) && m_pGrid->asDouble(x    , y + 1) >= z ? 1 : 0);
+					if( m_pGrid->is_InGrid(x + 1, y    ) && m_pGrid->asDouble(x + 1, y    ) >= z ) Set_Row(x, y, true);
+					if( m_pGrid->is_InGrid(x    , y + 1) && m_pGrid->asDouble(x    , y + 1) >= z ) Set_Col(x, y, true);
 				}
 			}
 		}
  	}
 
-	/*/-----------------------------------------------------
-	#pragma omp parallel for private(y)
-	for(y=0; y<Get_NY(); y++)	// mark edges
+	//-----------------------------------------------------
+	if( m_bParts == false )
 	{
-		for(int x=0; x<Get_NX(); x++)
-		{
-			if( !m_pGrid->is_NoData(x, y) && m_pGrid->asDouble(x, y) >= z )
-			{
-				m_Rows.Set_Value(x    , y    , IS_EDGE(x - 1, y    ));
-				m_Rows.Set_Value(x + 1, y    , IS_EDGE(x + 1, y    ));
+		CSG_Shape	*pContour	= m_pContours->Add_Shape();
 
-				m_Cols.Set_Value(x    , y    , IS_EDGE(x    , y - 1));
-				m_Cols.Set_Value(x    , y + 1, IS_EDGE(x    , y + 1));
-			}
-		}
- 	}/**/
+		pContour->Set_Value(0, m_pContours->Get_Count());
+		pContour->Set_Value(1, z);
+	}
 
-	//-----------------------------------------------------
-	for(y=0; y<Get_NY()-1; y++)	// Interpolation + Delineation
+	for(y=0; y<m_pGrid->Get_NY(); y++)	// find unclosed contours first so that these start/end at edges and not somewhere else
 	{
-		for(int x=0; x<Get_NX()-1; x++)
+		for(x=0; x<m_pGrid->Get_NX(); x++)
 		{
-			if( m_Rows(x, y) )
+			if( m_Edge.asInt(x, y) && is_Edge(x, y) )
 			{
-				for(int i=0; i<2; i++)
-				{
-					Start(x, y, z, true);
-				}
-
-				m_Rows.Set_Value(x, y, 0.0);
+				Get_Contour(z, x, y);
 			}
+		}
+	}
 
-			if( m_Cols(x, y) )
-			{
-				for(int i=0; i<2; i++)
-				{
-					Start(x, y, z, false);
-				}
-
-				m_Cols.Set_Value(x, y, 0.0);
-			}
+	for(y=0; y<m_pGrid->Get_NY(); y++)
+	{
+		for(x=0; x<m_pGrid->Get_NX(); x++)
+		{
+			while( Get_Contour(z, x, y) );
 		}
 	}
 
@@ -306,78 +431,101 @@ bool CGrid_To_Contour::Get_Contour(double z)
 	return( true );
 }
 
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
 //---------------------------------------------------------
-bool CGrid_To_Contour::Start(int x, int y, double z, bool bRow)
+bool CGrid_To_Contour::Get_Contour(double z, int x, int y)
 {
-	CSG_Shape	*pContour	= m_pContours->Add_Shape();
+	//-----------------------------------------------------
+	bool	bRow;
 
-	pContour->Set_Value(0, m_pContours->Get_Count());
-	pContour->Set_Value(1, z);
+	if( Get_Row(x, y) )
+	{
+		bRow	= true;
+	}
+	else if( Get_Col(x, y) )
+	{
+		bRow	= false;
+	}
+	else
+	{
+		return( false );
+	}
 
 	//-----------------------------------------------------
-	bool	bContinue;
+	int			iPart;
+	CSG_Shape	*pContour;
+
+	if( m_bParts == false )
+	{
+		pContour	= m_pContours->Get_Shape(m_pContours->Get_Count() - 1);
+		iPart		= pContour->Get_Part_Count();
+	}
+	else
+	{
+		pContour	= m_pContours->Add_Shape();
+		iPart		= 0;
 
-	int		zx	= bRow ? x + 1 : x;
-	int		zy	= bRow ? y : y + 1, Dir	= 0;
+		pContour->Set_Value(0, m_pContours->Get_Count());
+		pContour->Set_Value(1, z);
+	}
 
 	//-----------------------------------------------------
-	do
+	for(int Dir=0, x0=x, y0=y, bRow0=bRow?1:0; Dir>=0; )
 	{
+		int		zx	= bRow ? x + 1 : x;
+		int		zy	= bRow ? y : y + 1;
+
 		double	d	= m_pGrid->asDouble(x, y);	d	= (d - z) / (d - m_pGrid->asDouble(zx, zy));
 
 		pContour->Add_Point(
-			m_pGrid->Get_XMin() + Get_Cellsize() * (x + d * (zx - x)),
-			m_pGrid->Get_YMin() + Get_Cellsize() * (y + d * (zy - y))
+			m_pGrid->Get_XMin() + m_pGrid->Get_Cellsize() * (x + d * (zx - x)),
+			m_pGrid->Get_YMin() + m_pGrid->Get_Cellsize() * (y + d * (zy - y)), iPart
 		);
 
 		if( pContour->Get_Vertex_Type() != SG_VERTEX_TYPE_XY )
 		{
-			pContour->Set_Z(z, pContour->Get_Point_Count() - 1);
+			pContour->Set_Z(z, pContour->Get_Point_Count(iPart) - 1, iPart);
 		}
 
-		//-------------------------------------------------
-		bContinue	= Find_Next(Dir, x, y, bRow) || Find_Next(Dir, x, y, bRow);
-
-		Dir		= (Dir + 5) % 8;
-
-		//-------------------------------------------------
-		if( bRow )
+		if( Get_Contour_Cell(Dir, x, y, bRow) || Get_Contour_Cell(Dir, x, y, bRow) )
 		{
-			m_Rows.Set_Value(x, y, 0.0);
-			zx	= x + 1;
-			zy	= y;
+			if( bRow  )	{	Set_Row(x , y , false);	}	else	{	Set_Col(x , y , false);	}
 		}
 		else
 		{
-			m_Cols.Set_Value(x, y, 0.0);
-			zx	= x;
-			zy	= y + 1;
+			if( bRow0 )	{	Set_Row(x0, y0, false);	}	else	{	Set_Col(x0, y0, false);	}
+
+			Dir	= -1;
 		}
+
 	}
-	while( bContinue );
 
 	//-----------------------------------------------------
-	return( pContour->Get_Point_Count(0) > 1 );
+	return( pContour->Get_Point_Count(iPart) > 1 );
 }
 
 //---------------------------------------------------------
-inline bool CGrid_To_Contour::Find_Next(int &Dir, int &x, int &y, bool &bRow)
+inline bool CGrid_To_Contour::Get_Contour_Cell(int &Dir, int &x, int &y, bool &bRow)
 {
 	if( bRow )
 	{
 		switch( Dir )
 		{
-		case  0: if( m_Rows(x    , y + 1) ) { Dir = 0;                    y++; return( true ); }	// Norden
-		case  1: if( m_Cols(x + 1, y    ) ) { Dir = 1; bRow = false; x++;      return( true ); }	// Nord-Ost
+		case  0: if( Get_Row(x    , y + 1) ) { Dir = 5;                    y++; return( true ); }	// Norden
+		case  1: if( Get_Col(x + 1, y    ) ) { Dir = 6; bRow = false; x++;      return( true ); }	// Nord-Ost
 		case  2:	// Osten ist nicht...
 		case  3: if( y - 1 >= 0
-				 &&  m_Cols(x + 1, y - 1) ) { Dir = 3; bRow = false; x++; y--; return( true ); }	// Sued-Ost
+				 &&  Get_Col(x + 1, y - 1) ) { Dir = 0; bRow = false; x++; y--; return( true ); }	// Sued-Ost
 		case  4: if( y - 1 >= 0
-				 &&  m_Rows(x    , y - 1) ) { Dir = 4;      y--;               return( true ); }	// Sueden
+				 &&  Get_Row(x    , y - 1) ) { Dir = 1;                    y--; return( true ); }	// Sueden
 		case  5: if( y - 1 >= 0
-				 &&  m_Cols(x    , y - 1) ) { Dir = 5; bRow = false;      y--; return( true ); }	// Sued-West
+				 &&  Get_Col(x    , y - 1) ) { Dir = 2; bRow = false;      y--; return( true ); }	// Sued-West
 		case  6:	// Westen ist nicht...
-		case  7: if( m_Cols(x    , y    ) ) { Dir = 7; bRow = false;           return( true ); }	// Nord-West
+		case  7: if( Get_Col(x    , y    ) ) { Dir = 4; bRow = false;           return( true ); }	// Nord-West
 		default:
 			Dir = 0;
 		}
@@ -387,16 +535,16 @@ inline bool CGrid_To_Contour::Find_Next(int &Dir, int &x, int &y, bool &bRow)
 		switch( Dir )
 		{
 		case  0:	// Norden ist nicht...
-		case  1: if( m_Rows(x    , y + 1) ) { Dir = 1; bRow =  true;      y++; return( true ); }	// Nord-Ost
-		case  2: if( m_Cols(x + 1, y    ) ) { Dir = 2;               x++;      return( true ); }	// Osten
-		case  3: if( m_Rows(x    , y    ) ) { Dir = 3; bRow =  true;           return( true ); }	// Sued-Ost
+		case  1: if( Get_Row(x    , y + 1) ) { Dir = 6; bRow =  true;      y++; return( true ); }	// Nord-Ost
+		case  2: if( Get_Col(x + 1, y    ) ) { Dir = 7;               x++;      return( true ); }	// Osten
+		case  3: if( Get_Row(x    , y    ) ) { Dir = 0; bRow =  true;           return( true ); }	// Sued-Ost
 		case  4:	// Sueden ist nicht...
 		case  5: if( x - 1 >= 0
-				 &&  m_Rows(x - 1, y    ) ) { Dir = 5; bRow =  true; x--;      return( true ); }	// Sued-West
+				 &&  Get_Row(x - 1, y    ) ) { Dir = 2; bRow =  true; x--;      return( true ); }	// Sued-West
 		case  6: if( x - 1 >= 0
-				 &&  m_Cols(x - 1, y    ) ) { Dir = 6; x--;                    return( true ); }	// Westen
+				 &&  Get_Col(x - 1, y    ) ) { Dir = 3;               x--;      return( true ); }	// Westen
 		case  7: if( x - 1 >= 0
-				 &&  m_Rows(x - 1, y + 1) ) { Dir = 7; bRow =  true; x--; y++; return( true ); }	// Nord-West
+				 &&  Get_Row(x - 1, y + 1) ) { Dir = 5; bRow =  true; x--; y++; return( true ); }	// Nord-West
 		default:
 			Dir = 0;
 		}
@@ -408,6 +556,333 @@ inline bool CGrid_To_Contour::Find_Next(int &Dir, int &x, int &y, bool &bRow)
 
 ///////////////////////////////////////////////////////////
 //														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#define EDGE_LINE		1
+#define EDGE_NODE_ONE	2
+#define EDGE_NODE_TWO	3
+
+//---------------------------------------------------------
+bool CGrid_To_Contour::Get_Polygons(CSG_Shape_Line *pContour_Lo, CSG_Shape_Line *pContour_Hi)
+{
+	int		x, y;
+
+	//-----------------------------------------------------
+	double	zMin	= pContour_Lo ? pContour_Lo->asDouble(1) : m_pGrid->Get_ZMin();
+	double	zMax	= pContour_Hi ? pContour_Hi->asDouble(1) : m_pGrid->Get_ZMax();
+
+	#pragma omp parallel for private(x, y)
+	for(y=0; y<m_pGrid->Get_NY(); y++)
+	{
+		for(x=0; x<m_pGrid->Get_NX(); x++)
+		{
+			m_Edge.Set_Value(x, y, is_Edge(x, y) && zMin <= m_pGrid->asDouble(x, y) && m_pGrid->asDouble(x, y) <= zMax ? EDGE_LINE : 0);
+		}
+	}
+
+	//-----------------------------------------------------
+	CSG_Shape_Polygon	*pPolygon	= (CSG_Shape_Polygon *)m_pPolygons->Add_Shape();
+
+	pPolygon->Set_Value(0, m_pPolygons->Get_Count());
+	pPolygon->Set_Value(1, zMin);
+	pPolygon->Set_Value(2, zMax);
+	pPolygon->Set_Value(3, SG_Get_String(zMin) + " - " + SG_Get_String(zMax));
+
+	//-----------------------------------------------------
+	CSG_Shapes	Segments(SHAPE_TYPE_Line);
+
+	Segments.Add_Field("x0", SG_DATATYPE_Int);
+	Segments.Add_Field("y0", SG_DATATYPE_Int);
+	Segments.Add_Field("x1", SG_DATATYPE_Int);
+	Segments.Add_Field("y1", SG_DATATYPE_Int);
+	
+	if( pContour_Lo )	{	Add_Contour(Segments, pPolygon, pContour_Lo);	}
+	if( pContour_Hi )	{	Add_Contour(Segments, pPolygon, pContour_Hi);	}
+
+	//-----------------------------------------------------
+	if( Segments.Get_Count() == 0 )	// no edge crossing line
+	{
+		for(y=0; y<m_pGrid->Get_NY(); y++)
+		{
+			for(x=0; x<m_pGrid->Get_NX(); x++)
+			{
+				if( m_Edge.asInt(x, y) == EDGE_LINE )	// add outer ring
+				{
+					Add_Edge(Segments, x, y);
+
+					if( Segments.Get_Count() )
+					{
+						pPolygon->Add_Part(((CSG_Shape_Polygon *)Segments.Get_Shape(0))->Get_Part(0));
+
+						Segments.Del_Shapes();
+					}
+				}
+			}
+		}
+
+		return( true );
+	}
+
+	//-----------------------------------------------------
+//	{	CSG_Grid *pGrid	= SG_Create_Grid(m_Edge); pGrid->Set_NoData_Value(0); DataObject_Add(pGrid);	}
+	for(y=0; y<m_pGrid->Get_NY(); y++)
+	{
+		for(x=0; x<m_pGrid->Get_NX(); x++)
+		{
+			if( m_Edge.asInt(x, y) == EDGE_NODE_ONE )
+			{
+				Add_Edge(Segments, x, y);
+			}
+		}
+	}
+//	DataObject_Add(SG_Create_Shapes(Segments));
+
+	//-----------------------------------------------------
+	while( Segments.Get_Count() > 0 )
+	{
+		int	iPart	= pPolygon->Get_Part_Count();
+
+		CSG_Shape	*pSegment	= Segments.Get_Shape(0);
+
+		int	x	= pSegment->asInt(2);
+		int	y	= pSegment->asInt(3);
+
+		bool	bAscending	= true;
+
+		do
+		{
+			Add_Segment(pPolygon, iPart, pSegment, bAscending);
+		}
+		while( (pSegment = Get_Segment(Segments, x, y, bAscending)) != NULL );
+
+		if( pPolygon->Get_Point_Count(iPart) < 3 )
+		{
+			pPolygon->Del_Part(iPart);
+		}
+	}
+
+	//-----------------------------------------------------
+	return( true );
+}
+
+//---------------------------------------------------------
+bool CGrid_To_Contour::Add_Contour(CSG_Shapes &Segments, CSG_Shape_Polygon *pPolygon, CSG_Shape_Line *pContour)
+{
+	//-----------------------------------------------------
+	for(int iPart=0; iPart<pContour->Get_Part_Count(); iPart++)
+	{
+		CSG_Shape_Part	*pPart	= pContour->Get_Part(iPart);
+
+		if( !CSG_Point(pPart->Get_Point(0, true)).is_Equal(pPart->Get_Point(0, false)) )	// island
+		{
+			CSG_Shape	*pSegment	= Segments.Add_Shape();	pSegment->Add_Part(pPart);
+
+			int		x, y;
+
+			m_Edge.Get_System().Get_World_to_Grid(x, y, pPart->Get_Point(0,  true));
+			m_Edge.Set_Value(x, y, m_Edge.asInt(x, y) == EDGE_NODE_ONE ? EDGE_NODE_TWO : EDGE_NODE_ONE);
+			pSegment->Set_Value(0, x);
+			pSegment->Set_Value(1, y);
+
+			m_Edge.Get_System().Get_World_to_Grid(x, y, pPart->Get_Point(0, false));
+			m_Edge.Set_Value(x, y, m_Edge.asInt(x, y) == EDGE_NODE_ONE ? EDGE_NODE_TWO : EDGE_NODE_ONE);
+			pSegment->Set_Value(2, x);
+			pSegment->Set_Value(3, y);
+		}
+		else if( pPart->Get_Count() >= 3 )
+		{
+			pPolygon->Add_Part(pPart);
+		}
+	}
+
+	//-----------------------------------------------------
+	return( true );
+}
+
+//---------------------------------------------------------
+bool CGrid_To_Contour::Add_Edge(CSG_Shapes &Segments, int x, int y)
+{
+	int		i;
+
+	//-----------------------------------------------------
+	CSG_Shape	*pSegment	= NULL;
+
+	for(i=0; i<8 && !pSegment; i+=2)
+	{
+		int	ix	= CSG_Grid_System::Get_xTo(i, x);
+		int	iy	= CSG_Grid_System::Get_yTo(i, y);
+
+		if( m_Edge.is_InGrid(ix, iy) && m_Edge.asInt(ix, iy) == EDGE_LINE )
+		{
+			pSegment	= Segments.Add_Shape();
+
+			pSegment->Set_Value(0, x);
+			pSegment->Set_Value(1, y);
+
+			x = ix; y = iy;
+		}
+	}
+
+	if( !pSegment )
+	{
+		for(i=0; i<8 && !pSegment; i+=2)
+		{
+			int	ix	= CSG_Grid_System::Get_xTo(i, x);
+			int	iy	= CSG_Grid_System::Get_yTo(i, y);
+
+			if( m_Edge.is_InGrid(ix, iy) && m_Edge.asInt(ix, iy) == EDGE_NODE_ONE )
+			{
+				pSegment	= Segments.Add_Shape();
+
+				pSegment->Set_Value(0,  x);
+				pSegment->Set_Value(1,  y);
+				pSegment->Set_Value(2, ix);
+				pSegment->Set_Value(3, iy);
+			}
+		}
+
+		return( pSegment != NULL );
+	}
+
+	//-----------------------------------------------------
+	int	iLast	= -1;
+
+	for(bool bNext=true; bNext; )
+	{
+		bNext	= false;
+
+		m_Edge.Set_Value(x, y, 0);
+
+		for(i=0; i<8 && !bNext; i+=2)
+		{
+			int	ix	= CSG_Grid_System::Get_xTo(i, x);
+			int	iy	= CSG_Grid_System::Get_yTo(i, y);
+
+			if( m_Edge.is_InGrid(ix, iy) && m_Edge.asInt(ix, iy) == EDGE_LINE )
+			{
+				bNext	= true;
+
+				if( i != iLast )
+				{
+					iLast	= i;
+
+					pSegment->Add_Point(m_Edge.Get_System().Get_Grid_to_World(x, y));
+				}
+
+				x = ix; y = iy;
+			}
+		}
+	}
+
+	//-----------------------------------------------------
+	pSegment->Add_Point(m_Edge.Get_System().Get_Grid_to_World(x, y));
+
+	for(int i=0; i<8; i+=2)
+	{
+		int	ix	= CSG_Grid_System::Get_xTo(i, x);
+		int	iy	= CSG_Grid_System::Get_yTo(i, y);
+
+		if( m_Edge.is_InGrid(ix, iy) && m_Edge.asInt(ix, iy) != 0 )
+		{
+			pSegment->Set_Value(2, ix);
+			pSegment->Set_Value(3, iy);
+
+			return( true );
+		}
+	}
+
+	pSegment->Set_Value(2, x);
+	pSegment->Set_Value(3, y);
+
+	return( false );
+}
+
+//---------------------------------------------------------
+CSG_Shape * CGrid_To_Contour::Get_Segment(const CSG_Shapes &Segments, int &x, int &y, bool &bAscending)
+{
+	for(int i=0; i<Segments.Get_Count(); i++)
+	{
+		if( Segments[i].asInt(0) == x && Segments[i].asInt(1) == y )
+		{
+			bAscending	= true;
+
+			x	= Segments[i].asInt(2);
+			y	= Segments[i].asInt(3);
+
+			return( Segments.Get_Shape(i) );
+		}
+
+		if( Segments[i].asInt(2) == x && Segments[i].asInt(3) == y )
+		{
+			bAscending	= false;
+
+			x	= Segments[i].asInt(0);
+			y	= Segments[i].asInt(1);
+
+			return( Segments.Get_Shape(i) );
+		}
+	}
+
+	return( NULL );
+}
+
+//---------------------------------------------------------
+bool CGrid_To_Contour::Add_Segment(CSG_Shape *pPolygon, int iPart, CSG_Shape *pSegment, bool bAscending)
+{
+	for(int i=0; i<pSegment->Get_Point_Count(0); i++)
+	{
+		pPolygon->Add_Point(pSegment->Get_Point(i, 0, bAscending), iPart);
+	}
+
+	((CSG_Shapes *)pSegment->Get_Table())->Del_Shape(pSegment);
+
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CGrid_To_Contour::Split_Polygon_Parts(CSG_Shapes *pPolygons)
+{
+	CSG_Shapes	Polygons(*pPolygons);
+
+	pPolygons->Del_Shapes();
+
+	//-----------------------------------------------------
+	for(int iPolygon=0; iPolygon<Polygons.Get_Count() && Set_Progress(iPolygon, Polygons.Get_Count()); iPolygon++)
+	{
+		CSG_Shape_Polygon	*pPolygon	= (CSG_Shape_Polygon *)Polygons.Get_Shape(iPolygon);
+
+		for(int iPart=0; iPart<pPolygon->Get_Part_Count() && Process_Get_Okay(); iPart++)
+		{
+			if( !pPolygon->is_Lake(iPart) )
+			{
+				CSG_Shape_Polygon	*pPart	= (CSG_Shape_Polygon *)pPolygons->Add_Shape(pPolygon, SHAPE_COPY_ATTR);
+
+				pPart->Add_Part(pPolygon->Get_Part(iPart));
+
+				for(int jPart=0; jPart<pPolygon->Get_Part_Count(); jPart++)
+				{
+					if(	pPolygon->is_Lake(jPart) && pPart->Contains(pPolygon->Get_Point(0, jPart)) )
+					{
+						pPart->Add_Part(pPolygon->Get_Part(jPart));
+					}
+				}
+			}
+		}
+	}
+
+	//-----------------------------------------------------
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
 //														 //
 //														 //
 ///////////////////////////////////////////////////////////
diff --git a/src/modules/shapes/shapes_grid/Grid_To_Contour.h b/src/modules/shapes/shapes_grid/Grid_To_Contour.h
index 5827f4d..334d31e 100644
--- a/src/modules/shapes/shapes_grid/Grid_To_Contour.h
+++ b/src/modules/shapes/shapes_grid/Grid_To_Contour.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Grid_To_Contour.h 2305 2014-10-24 10:12:20Z oconrad $
+ * Version $Id: Grid_To_Contour.h 2483 2015-04-30 15:36:20Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -84,7 +84,7 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-class CGrid_To_Contour : public CSG_Module_Grid
+class CGrid_To_Contour : public CSG_Module
 {
 public:
 	CGrid_To_Contour(void);
@@ -102,16 +102,31 @@ protected:
 
 private:
 
-	CSG_Grid				*m_pGrid, m_Cols, m_Rows;
+	bool					m_bParts;
 
-	CSG_Shapes				*m_pContours;
+	CSG_Grid				*m_pGrid, m_Edge;
 
+	CSG_Shapes				*m_pContours, *m_pPolygons;
+
+
+	bool					is_Edge					(int x, int y);
+
+	void					Set_Row					(int x, int y, bool bOn);
+	bool					Get_Row					(int x, int y);
+	void					Set_Col					(int x, int y, bool bOn);
+	bool					Get_Col					(int x, int y);
 
 	bool					Get_Contour				(double z);
+	bool					Get_Contour				(double z, int x, int y);
+	bool					Get_Contour_Cell		(int &Dir, int &x, int &y, bool &bRow);
 
-	bool					Start					(int x, int y, double z, bool bRow);
+	bool					Get_Polygons			(CSG_Shape_Line *pContour_Lo, CSG_Shape_Line *pContour_Hi);
+	bool					Add_Contour				(CSG_Shapes &Segments, CSG_Shape_Polygon *pPolygon, CSG_Shape_Line *pContour);
+	bool					Add_Edge				(CSG_Shapes &Segments, int x, int y);
+	bool					Add_Segment				(CSG_Shape *pPolygon, int iPart, CSG_Shape *pContour, bool bAscending);
+	CSG_Shape *				Get_Segment				(const CSG_Shapes &Segments, int &x, int &y, bool &bAscending);
 
-	bool					Find_Next				(int &Dir, int &x, int &y, bool &bRow);
+	bool					Split_Polygon_Parts		(CSG_Shapes *pPolygons);
 
 };
 
diff --git a/src/modules/shapes/shapes_grid/MLB_Interface.cpp b/src/modules/shapes/shapes_grid/MLB_Interface.cpp
index 4f94116..f08e1f7 100644
--- a/src/modules/shapes/shapes_grid/MLB_Interface.cpp
+++ b/src/modules/shapes/shapes_grid/MLB_Interface.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: MLB_Interface.cpp 2281 2014-10-09 15:49:41Z oconrad $
+ * Version $Id: MLB_Interface.cpp 2443 2015-03-18 19:52:26Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -100,6 +100,7 @@ CSG_String Get_Info(int i)
 #include "Grid_Values_AddTo_Points.h"
 #include "Grid_Values_AddTo_Shapes.h"
 #include "Grid_Statistics_AddTo_Polygon.h"
+#include "Grid_Statistics_For_Points.h"
 #include "Grid_To_Points.h"
 #include "Grid_To_Points_Random.h"
 #include "Grid_To_Contour.h"
@@ -121,6 +122,7 @@ CSG_Module *		Create_Module(int i)
 	case  0:	return( new CGrid_Values_AddTo_Points );
 	case  1:	return( new CGrid_Values_AddTo_Shapes );
 	case  2:	return( new CGrid_Statistics_AddTo_Polygon );
+	case  8:	return( new CGrid_Statistics_For_Points );
 	case  3:	return( new CGrid_To_Points );
 	case  4:	return( new CGrid_To_Points_Random );
 	case  5:	return( new CGrid_To_Contour );
@@ -136,9 +138,8 @@ CSG_Module *		Create_Module(int i)
 	case 17:	return( new CGrid_To_Gradient(2) );
 
 	case 20:	return( NULL );
+	default:	return( MLB_INTERFACE_SKIP_MODULE );
 	}
-
-	return( MLB_INTERFACE_SKIP_MODULE );
 }
 
 
diff --git a/src/modules/shapes/shapes_grid/Makefile.am b/src/modules/shapes/shapes_grid/Makefile.am
index 34d7620..a1d15bd 100644
--- a/src/modules/shapes/shapes_grid/Makefile.am
+++ b/src/modules/shapes/shapes_grid/Makefile.am
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.am 1758 2013-06-27 13:35:47Z reklov_w $
+# $Id: Makefile.am 2443 2015-03-18 19:52:26Z oconrad $
 #
 if DEBUG
 DBGFLAGS = -g -DDEBUG
@@ -19,6 +19,7 @@ grid_local_extremes_to_points.cpp\
 Grid_Polygon_Clip.cpp\
 grid_rectangle_clip.cpp\
 Grid_Statistics_AddTo_Polygon.cpp\
+Grid_Statistics_For_Points.cpp\
 Grid_To_Contour.cpp\
 Grid_To_Gradient.cpp\
 Grid_To_Points.cpp\
@@ -32,6 +33,7 @@ grid_local_extremes_to_points.h\
 Grid_Polygon_Clip.h\
 grid_rectangle_clip.h\
 Grid_Statistics_AddTo_Polygon.h\
+Grid_Statistics_For_Points.h\
 Grid_To_Contour.h\
 Grid_To_Gradient.h\
 Grid_To_Points.h\
diff --git a/src/modules/shapes/shapes_grid/Makefile.in b/src/modules/shapes/shapes_grid/Makefile.in
index fa68afb..ce294bc 100644
--- a/src/modules/shapes/shapes_grid/Makefile.in
+++ b/src/modules/shapes/shapes_grid/Makefile.in
@@ -130,10 +130,10 @@ libshapes_grid_la_DEPENDENCIES =  \
 am_libshapes_grid_la_OBJECTS = Grid_Classes_To_Shapes.lo \
 	grid_extent.lo grid_local_extremes_to_points.lo \
 	Grid_Polygon_Clip.lo grid_rectangle_clip.lo \
-	Grid_Statistics_AddTo_Polygon.lo Grid_To_Contour.lo \
-	Grid_To_Gradient.lo Grid_To_Points.lo Grid_To_Points_Random.lo \
-	Grid_Values_AddTo_Points.lo Grid_Values_AddTo_Shapes.lo \
-	MLB_Interface.lo
+	Grid_Statistics_AddTo_Polygon.lo Grid_Statistics_For_Points.lo \
+	Grid_To_Contour.lo Grid_To_Gradient.lo Grid_To_Points.lo \
+	Grid_To_Points_Random.lo Grid_Values_AddTo_Points.lo \
+	Grid_Values_AddTo_Shapes.lo MLB_Interface.lo
 libshapes_grid_la_OBJECTS = $(am_libshapes_grid_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
@@ -367,7 +367,7 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
 #
-# $Id: Makefile.am 1758 2013-06-27 13:35:47Z reklov_w $
+# $Id: Makefile.am 2443 2015-03-18 19:52:26Z oconrad $
 #
 @DEBUG_TRUE at DBGFLAGS = -g -DDEBUG
 @SAGA_UNICODE_TRUE at UC_DEFS = -D_SAGA_UNICODE
@@ -383,6 +383,7 @@ grid_local_extremes_to_points.cpp\
 Grid_Polygon_Clip.cpp\
 grid_rectangle_clip.cpp\
 Grid_Statistics_AddTo_Polygon.cpp\
+Grid_Statistics_For_Points.cpp\
 Grid_To_Contour.cpp\
 Grid_To_Gradient.cpp\
 Grid_To_Points.cpp\
@@ -396,6 +397,7 @@ grid_local_extremes_to_points.h\
 Grid_Polygon_Clip.h\
 grid_rectangle_clip.h\
 Grid_Statistics_AddTo_Polygon.h\
+Grid_Statistics_For_Points.h\
 Grid_To_Contour.h\
 Grid_To_Gradient.h\
 Grid_To_Points.h\
@@ -487,6 +489,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Grid_Classes_To_Shapes.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Grid_Polygon_Clip.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Grid_Statistics_AddTo_Polygon.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Grid_Statistics_For_Points.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Grid_To_Contour.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Grid_To_Gradient.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Grid_To_Points.Plo at am__quote@
@@ -499,22 +502,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/grid_rectangle_clip.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/shapes/shapes_lines/MLB_Interface.cpp b/src/modules/shapes/shapes_lines/MLB_Interface.cpp
index 9675986..072842f 100644
--- a/src/modules/shapes/shapes_lines/MLB_Interface.cpp
+++ b/src/modules/shapes/shapes_lines/MLB_Interface.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: MLB_Interface.cpp 2281 2014-10-09 15:49:41Z oconrad $
+ * Version $Id: MLB_Interface.cpp 2338 2014-11-17 10:06:18Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -76,11 +76,11 @@ CSG_String Get_Info(int i)
 	case MLB_INFO_Name:	default:
 		return( _TL("Lines") );
 
-	case MLB_INFO_Category:
-		return( _TL("Shapes") );
+	case MLB_INFO_Category:
+		return( _TL("Shapes") );
 
 	case MLB_INFO_Author:
-		return( SG_T("O. Conrad (c) 2005") );
+		return( SG_T("O. Conrad, V. Wichmann (c) 2005-2014") );
 
 	case MLB_INFO_Description:
 		return( _TL("Tools for lines.") );
@@ -104,6 +104,7 @@ CSG_String Get_Info(int i)
 #include "line_simplification.h"
 #include "line_dissolve.h"
 #include "line_split_with_lines.h"
+#include "line_smoothing.h"
 
 
 //---------------------------------------------------------
@@ -120,6 +121,7 @@ CSG_Module *		Create_Module(int i)
 	case  4:	return( new CLine_Simplification );
 	case  5:	return( new CLine_Dissolve );
 	case  6:	return( new CLine_Split_with_Lines );
+	case  7:	return( new CLine_Smoothing );
 
 	case 10:	return( NULL );
 	default:	return( MLB_INTERFACE_SKIP_MODULE );
diff --git a/src/modules/shapes/shapes_lines/Makefile.am b/src/modules/shapes/shapes_lines/Makefile.am
index 5fdd14b..dc5d02c 100644
--- a/src/modules/shapes/shapes_lines/Makefile.am
+++ b/src/modules/shapes/shapes_lines/Makefile.am
@@ -19,6 +19,7 @@ Lines_From_Polygons.cpp\
 line_polygon_intersection.cpp\
 line_properties.cpp\
 line_simplification.cpp\
+line_smoothing.cpp\
 line_split_with_lines.cpp\
 MLB_Interface.cpp\
 line_dissolve.h\
@@ -27,6 +28,7 @@ Lines_From_Polygons.h\
 line_polygon_intersection.h\
 line_properties.h\
 line_simplification.h\
+line_smoothing.h\
 line_split_with_lines.h\
 MLB_Interface.h
 
diff --git a/src/modules/shapes/shapes_lines/Makefile.in b/src/modules/shapes/shapes_lines/Makefile.in
index ac41e39..0508545 100644
--- a/src/modules/shapes/shapes_lines/Makefile.in
+++ b/src/modules/shapes/shapes_lines/Makefile.in
@@ -129,7 +129,7 @@ libshapes_lines_la_DEPENDENCIES =  \
 	$(top_srcdir)/src/saga_core/saga_api/libsaga_api.la
 am_libshapes_lines_la_OBJECTS = line_dissolve.lo Lines_From_Points.lo \
 	Lines_From_Polygons.lo line_polygon_intersection.lo \
-	line_properties.lo line_simplification.lo \
+	line_properties.lo line_simplification.lo line_smoothing.lo \
 	line_split_with_lines.lo MLB_Interface.lo
 libshapes_lines_la_OBJECTS = $(am_libshapes_lines_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
@@ -380,6 +380,7 @@ Lines_From_Polygons.cpp\
 line_polygon_intersection.cpp\
 line_properties.cpp\
 line_simplification.cpp\
+line_smoothing.cpp\
 line_split_with_lines.cpp\
 MLB_Interface.cpp\
 line_dissolve.h\
@@ -388,6 +389,7 @@ Lines_From_Polygons.h\
 line_polygon_intersection.h\
 line_properties.h\
 line_simplification.h\
+line_smoothing.h\
 line_split_with_lines.h\
 MLB_Interface.h
 
@@ -478,25 +480,29 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/line_polygon_intersection.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/line_properties.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/line_simplification.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/line_smoothing.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/line_split_with_lines.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/shapes/shapes_lines/line_smoothing.cpp b/src/modules/shapes/shapes_lines/line_smoothing.cpp
new file mode 100644
index 0000000..547fa03
--- /dev/null
+++ b/src/modules/shapes/shapes_lines/line_smoothing.cpp
@@ -0,0 +1,729 @@
+/**********************************************************
+ * Version $Id: line_smoothing.cpp 2347 2014-12-04 10:37:10Z reklov_w $
+ *********************************************************/
+
+///////////////////////////////////////////////////////////
+//                                                       //
+//                         SAGA                          //
+//                                                       //
+//      System for Automated Geoscientific Analyses      //
+//                                                       //
+//                    Module Library:                    //
+//                     shapes_lines                      //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//                  line_smoothing.cpp                   //
+//                                                       //
+//                 Copyright (C) 2014 by                 //
+//                    Volker Wichmann                    //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+// This file is part of 'SAGA - System for Automated     //
+// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
+//                                                       //
+// SAGA is distributed in the hope that it will be       //
+// useful, but WITHOUT ANY WARRANTY; without even the    //
+// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
+// PARTICULAR PURPOSE. See the GNU General Public        //
+// License for more details.                             //
+//                                                       //
+// You should have received a copy of the GNU General    //
+// Public License along with this program; if not,       //
+// write to the Free Software Foundation, Inc.,          //
+// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
+// USA.                                                  //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//    e-mail:     wichmann at laserdata.at                  //
+//                                                       //
+//    contact:    Volker Wichmann                        //
+//                LASERDATA GmbH                         //
+//                Management and analysis of             //
+//                laserscanning data                     //
+//                Innsbruck, Austria                     //
+//                                                       //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#include "line_smoothing.h"
+
+#define MIN_WEIGHT	0.0005
+#define EPSILON		1.0e-07
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+CLine_Smoothing::CLine_Smoothing(void)
+{
+	//-----------------------------------------------------
+	Set_Name		(_TL("Line Smoothing"));
+
+	Set_Author		(SG_T("V. Wichmann, J. Engels (c) 2014"));
+
+	Set_Description	(_TW(
+		"The module provides methods for line smoothing including iterative averaging "
+		"(SIA) and Gaussian filtering.\n\n"
+		
+		"Iterative averaging (SIA) is described by Mansouryar & Hedayati (2012). "
+		"A higher smoothing sensitivity results in a "
+		"stronger smoothing in less iterations and vice versa. The 'improved SIA "
+		"model' simply applies a preservation factor in the first iteration and "
+		"then runs the 'basic SIA model' for the following iterations.\n\n"
+
+		"Gaussian filtering with shrinkage correction is described by Lowe (1989).\n\n"
+
+		"In case the density of line vertices is too high, the 'Line Simplification' "
+		"tool can be applied first. If the density of line vertices is too low, "
+		"additional vertices can be inserted by applying the 'Convert Lines to Points' "
+		"and the 'Convert Points to Line(s)' tools prior to smoothing.\n\n"
+
+		"References:\n"
+		"Lowe, D. (1989): Organization of Smooth Image Curves at Multiple Scales. "
+		"International Journal of Computer Vision, 3: 119-130. "
+		"(<a target=\"_blank\" href=\"http://www.cs.ubc.ca/~lowe/papers/iccv88.pdf\">pdf</a>)\n\n"
+
+		"Mansouryar, M. & Hedayati, A. (2012): Smoothing Via Iterative Averaging (SIA) "
+		"- A Basic Technique for Line Smoothing. International Journal of Computer and "
+		"Electrical Engineering Vol. 4, No. 3: 307-311. "
+		"(<a target=\"_blank\" href=\"http://www.ijcee.org/papers/501-P063.pdf\">pdf</a>)\n\n"
+	));
+
+	//-----------------------------------------------------
+	Parameters.Add_Shapes(
+		NULL	, "LINES_IN"		, _TL("Lines"),
+		_TL("The input line shapefile to smooth."),
+		PARAMETER_INPUT, SHAPE_TYPE_Line
+	);
+	
+	Parameters.Add_Shapes(
+		NULL	, "LINES_OUT"	, _TL("Smoothed Lines"),
+		_TL("The smoothed output line shapefile."),
+		PARAMETER_OUTPUT, SHAPE_TYPE_Line
+	);
+
+	Parameters.Add_Choice(
+		NULL	, "METHOD"		, _TL("Method"),
+		_TL("Choose the method to apply."),
+		CSG_String::Format(SG_T("%s|%s|%s|"),
+			_TL("basic SIA model"),
+			_TL("improved SIA model"),
+			_TL("Gaussian Filtering")
+		), 2
+	);
+	
+	Parameters.Add_Value(
+		NULL	, "SENSITIVITY"	, _TL("Sensitivity"),
+		_TL("Half the size of the moving window [vertex count], controls smoothing sensitivity."),
+		PARAMETER_TYPE_Int, 3, 1, true
+	);
+
+	Parameters.Add_Value(
+		NULL	, "ITERATIONS"	, _TL("Iterations"),
+		_TL("The number of smoothing iterations [-]."),
+		PARAMETER_TYPE_Int, 10, 1, true
+	);
+
+	Parameters.Add_Value(
+		NULL	, "PRESERVATION"	, _TL("Preservation"),
+		_TL("The smoothing preservation factor [-]."),
+		PARAMETER_TYPE_Double, 10.0, 1.0, true
+	);
+
+	Parameters.Add_Value(
+		NULL	, "SIGMA"	, _TL("Sigma"),
+		_TL("Standard deviation of the Gaussian filter [-]."),
+		PARAMETER_TYPE_Double, 2.0, 0.5, true
+	);
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+int CLine_Smoothing::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+{
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "METHOD") )
+	{
+		pParameters->Set_Enabled("SENSITIVITY",		pParameter->asInt() <= 1);
+		pParameters->Set_Enabled("ITERATIONS",		pParameter->asInt() <= 1);
+		pParameters->Set_Enabled("PRESERVATION",	pParameter->asInt() == 1);
+		pParameters->Set_Enabled("SIGMA",			pParameter->asInt() == 2);
+	}
+
+	return( 0 );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CLine_Smoothing::On_Execute(void)
+{
+	CSG_Shapes	*pLines, *pSmooth;
+	int			iMethod, iSS, iSI;
+	double		dSP, dSigma;
+	bool		bResult;
+
+
+	pLines		= Parameters("LINES_IN")->asShapes();
+	pSmooth		= Parameters("LINES_OUT")->asShapes();
+	iMethod		= Parameters("METHOD")->asInt();
+	iSS			= Parameters("SENSITIVITY")->asInt();
+	iSI			= Parameters("ITERATIONS")->asInt();
+	dSP			= Parameters("PRESERVATION")->asDouble();
+	dSigma		= Parameters("SIGMA")->asDouble();
+
+
+	//--------------------------------------------------------
+	pSmooth->Create(SHAPE_TYPE_Line, CSG_String::Format(SG_T("%s_smoothed"), pLines->Get_Name()), pLines, pLines->Get_Vertex_Type());
+
+
+	if( iMethod <= 1 )
+	{
+		bResult = Calc_SIA(pLines, pSmooth, iMethod, iSS, iSI, dSP);
+	}
+	else
+	{
+		bResult = Calc_Gaussian(pLines, pSmooth, dSigma);
+	}
+
+
+	return( bResult );
+}
+
+
+//---------------------------------------------------------
+bool CLine_Smoothing::Calc_SIA(CSG_Shapes *pLines, CSG_Shapes *pSmooth, int iMethod, int iSS, int iSI, double dSP)
+{
+	int		iOffset;
+
+
+	if(	iSS > iSI )
+	{
+		SG_UI_Msg_Add(_TL("WARNING: smoothing sensitivity is greater than the number of iterations!"), true);
+	}
+
+	if(	iMethod == 1 && iSI < 2 )
+	{
+		SG_UI_Msg_Add_Error(_TL("The improved SIA model requires more than one smoothing iteration!"));
+		return( false );
+	}
+
+
+	//--------------------------------------------------------
+	for(int iLine=0; iLine<pLines->Get_Count() && Set_Progress(iLine, pLines->Get_Count()); iLine++)
+	{
+		CSG_Shape *pLine = pLines->Get_Shape(iLine);
+		
+		CSG_Shape *pSmoothed = pSmooth->Add_Shape(pLine, SHAPE_COPY_ATTR);
+
+
+		//--------------------------------------------------------
+		for(int iPart=0; iPart<pLine->Get_Part_Count(); iPart++)
+		{
+			std::vector<TSG_Point>	verticesA(pLine->Get_Point_Count(iPart));
+			std::vector<TSG_Point>	verticesB(pLine->Get_Point_Count(iPart));
+			TSG_Point				p;
+
+			for(int iPoint=0; iPoint<pLine->Get_Point_Count(iPart); iPoint++)
+			{
+				p.x	= pLine->Get_Point(iPoint, iPart).x;
+				p.y	= pLine->Get_Point(iPoint, iPart).y;
+
+				verticesB.at(iPoint) = p;
+			}
+
+
+			//--------------------------------------------------------
+			for(int i=0; i<iSI; i++)
+			{
+				verticesA = verticesB;
+
+				for(int iPoint=0; iPoint<(int)verticesA.size(); iPoint++)
+				{
+					if( iPoint < iSS )
+					{
+						iOffset = iPoint;
+					}
+					else if( iSS <= iPoint && iPoint < (int)verticesA.size() - iSS )
+					{
+						iOffset = iSS;
+					}
+					else // if( iPoint >= (int)verticesA.size() - iSS )
+					{
+						iOffset = (int)verticesA.size() - 1 - iPoint;
+					}
+
+					if( iPoint - iOffset < 0 )	// validate lower ...
+					{
+						iOffset = 0;
+					}
+					if( iPoint + iOffset >= verticesA.size() )	// ... and upper limit
+					{
+						iOffset = (int)verticesA.size() - 1 - iPoint;
+					}
+
+
+					if( iMethod == 1 && i == 0 )	// improved SIA, apply preservation in first iteration
+					{
+						p.x = (verticesA.at(iPoint - iOffset).x + verticesA.at(iPoint).x + verticesA.at(iPoint + iOffset).x) / 3.0;
+						p.y = (verticesA.at(iPoint - iOffset).y + verticesA.at(iPoint).y + verticesA.at(iPoint + iOffset).y) / 3.0;
+
+						TSG_Point	p_GA;	// vector GA (triangle centroid - point)
+
+						p_GA.x = verticesA.at(iPoint).x - p.x;
+						p_GA.y = verticesA.at(iPoint).y - p.y;
+
+						double dLength = sqrt(p_GA.x * p_GA.x + p_GA.y * p_GA.y);
+
+						if( dLength > 0.0 )
+						{
+							double dScaled = dLength * dSP;	// scale by preservation
+
+							p.x = verticesA.at(iPoint).x + (p_GA.x / dLength) * dScaled;	// shift point
+							p.y = verticesA.at(iPoint).y + (p_GA.y / dLength) * dScaled;
+						}
+						else
+						{
+							p = verticesA.at(iPoint);
+						}
+					}
+					else	// basic SIA
+					{
+						p.x = (verticesA.at(iPoint - iOffset).x + verticesA.at(iPoint).x + verticesA.at(iPoint + iOffset).x) / 3.0;
+						p.y = (verticesA.at(iPoint - iOffset).y + verticesA.at(iPoint).y + verticesA.at(iPoint + iOffset).y) / 3.0;
+					}
+
+					verticesB.at(iPoint) = p;
+				} // iPoint
+			} // iIteration
+
+
+			//--------------------------------------------------------
+			for(int iPoint=0; iPoint<pLine->Get_Point_Count(iPart); iPoint++)
+			{
+				pSmoothed->Add_Point(verticesB.at(iPoint).x, verticesB.at(iPoint).y, iPart);
+				
+				if( pLines->Get_Vertex_Type() != SG_VERTEX_TYPE_XY )
+				{
+					pSmoothed->Set_Z(pLine->Get_Z(iPoint, iPart), iPoint, iPart);
+
+					if( pLines->Get_Vertex_Type() == SG_VERTEX_TYPE_XYZM )
+					{
+						pSmoothed->Set_M(pLine->Get_M(iPoint, iPart), iPoint, iPart);
+					}
+				}
+			}	
+		} // iPart
+	} // iLine
+
+
+	return( true );
+}
+
+
+//---------------------------------------------------------
+bool CLine_Smoothing::Calc_Gaussian(CSG_Shapes *pLines, CSG_Shapes *pSmooth, double dSigma)
+{
+	int			half_window_width;
+	bool		bClosed;
+	double      variance;
+
+	variance			= dSigma * dSigma;
+	double t0d			= sqrt (-2.0 * variance * log ( MIN_WEIGHT ));
+	half_window_width	= (int) floor (t0d);
+	double nfac			= 1.0 / dSigma / sqrt (2.0 * M_PI);
+	
+	if(	2 * half_window_width + 1 < 3 )
+	{
+		SG_UI_Msg_Add_Error(_TL("The length of the Gaussian window is too small, please provide a larger sigma."));
+		return( false );
+	}
+
+	std::vector<double>	gauss_window(2 * half_window_width + 1);
+	std::vector<double>	first_deriv_gauss_window(2 * half_window_width + 1);
+	std::vector<double>	snd_deriv_gauss_window(2 * half_window_width + 1);
+	std::vector<double>	gauss_window_corr(2 * half_window_width + 1);
+	std::vector<double>	snd_deriv_gauss_window_corr(2 * half_window_width + 1);
+
+	double zero_sum_weights	= 0.0 ;
+	double snd_sum_weights	= 0.0 ;
+
+
+	SG_UI_Msg_Add(CSG_String::Format(_TL("Length of the Gaussian window:\t %d"), 2 * half_window_width + 1), true);
+
+	for (int k=-half_window_width, l=0; k<=half_window_width; k++, l++)
+	{
+		double kd = (double)k;
+
+		gauss_window [l] = nfac * exp (-kd * kd / (2.0 * variance));
+		zero_sum_weights += gauss_window [l];
+
+		first_deriv_gauss_window [l] = -nfac * kd * exp (-kd * kd / (2.0 * variance)) / variance;
+
+		snd_deriv_gauss_window [l] = nfac * (kd * kd / variance - 1.0) * exp (-kd * kd / (2.0 * variance)) / variance;
+		snd_sum_weights += snd_deriv_gauss_window [l];
+	}
+
+	// The filter kernels have to be corrected because of the discretization
+	// The sum of the elements of the first-derivative-kernel is zero due to antisymmetry
+	
+	for (int k=-half_window_width, l=0; k<=half_window_width; k++, l++)
+	{
+		double kd = (double) k ;
+
+		gauss_window_corr [l] = gauss_window [l] / zero_sum_weights ;
+
+		snd_deriv_gauss_window_corr [l] = snd_deriv_gauss_window [l] - snd_sum_weights * gauss_window_corr [l] ;
+	}
+
+
+	//--------------------------------------------------------
+	for(int iLine=0; iLine<pLines->Get_Count() && Set_Progress (iLine, pLines->Get_Count ()); iLine++)
+	{
+		CSG_Shape *pLine = pLines->Get_Shape(iLine);
+		
+		CSG_Shape *pSmoothed = pSmooth->Add_Shape(pLine, SHAPE_COPY_ATTR);
+
+		//--------------------------------------------------------
+		for(int iPart=0; iPart<pLine->Get_Part_Count(); iPart++)
+		{
+			int curve_length = pLine -> Get_Point_Count(iPart);
+
+			std::vector<TSG_Point>	verticesA (curve_length) ;  // the original points
+			std::vector<TSG_Point>	verticesB (curve_length) ;  // the intermediate points (after smoothing)
+			std::vector<TSG_Point>	verticesC (curve_length) ;  // the points after smoothing and shrinkage correction
+			TSG_Point				p;
+
+			if (pLine->Get_Point(0, iPart).x == pLine->Get_Point(curve_length - 1, iPart).x &&
+				pLine->Get_Point(0, iPart).y == pLine->Get_Point(curve_length - 1, iPart).y )
+			{
+				bClosed = true;
+				curve_length--;
+			}
+			else
+				bClosed = false;
+
+
+			double mean_X = 0.0;
+			double mean_Y = 0.0;
+
+			for(int iPoint=0; iPoint<curve_length; iPoint++)
+			{
+				mean_X += (pLine->Get_Point(iPoint, iPart).x);
+				mean_Y += (pLine->Get_Point(iPoint, iPart).y);
+			}
+
+			mean_X /= curve_length;
+			mean_Y /= curve_length;
+
+			for(int iPoint=0; iPoint<curve_length; iPoint++)
+			{
+				p.x	= pLine->Get_Point(iPoint, iPart).x - mean_X;
+				p.y	= pLine->Get_Point(iPoint, iPart).y - mean_Y;
+
+				verticesA.at(iPoint) = p;
+			}
+
+			if( curve_length < 2 * half_window_width + 1 )
+			{
+				SG_UI_Msg_Add(_TL("WARNING: unable to smooth line because Gaussian window too large (number of line vertices too small or sigma too big)."), true);
+
+				for(int iPoint=0; iPoint<pLine->Get_Point_Count(iPart); iPoint++)
+				{
+					pSmoothed->Add_Point(pLine->Get_Point(iPoint, iPart).x, pLine->Get_Point(iPoint, iPart).y, iPart);
+				
+					if( pLines->Get_Vertex_Type() != SG_VERTEX_TYPE_XY )
+					{
+						pSmoothed->Set_Z(pLine->Get_Z(iPoint, iPart), iPoint, iPart);
+
+						if( pLines->Get_Vertex_Type() == SG_VERTEX_TYPE_XYZM )
+						{
+							pSmoothed->Set_M(pLine->Get_M(iPoint, iPart), iPoint, iPart);
+						}
+					}
+				}	
+
+				continue;
+			}
+
+			for(int iPoint=0; iPoint<curve_length; iPoint++)
+			{
+				double value_x = 0.0;
+				double value_y = 0.0;
+
+				double first_deriv_x = 0.0;
+				double first_deriv_y = 0.0;
+
+				double snd_deriv_x = 0.0;
+				double snd_deriv_y = 0.0;
+
+				double mean_loc_x = verticesA.at(iPoint).x;
+				double mean_loc_y = verticesA.at(iPoint).y;
+				int loc_hw;
+
+			    if( (iPoint == 0 || iPoint == curve_length - 1) && bClosed == false)
+				{
+					verticesB.at(iPoint) = verticesA.at(iPoint);
+					verticesC.at(iPoint) = verticesA.at(iPoint);
+					continue;
+				}
+				else if( (iPoint < half_window_width || iPoint > curve_length - half_window_width - 1) && bClosed == false)
+				{
+				    if( iPoint < half_window_width )
+						loc_hw = iPoint ;
+					else
+						loc_hw = curve_length - 1 - iPoint ;
+
+					// same story as before, but with different window length
+
+					std::vector<double>	gwloc(2 * loc_hw + 1);
+					std::vector<double>	first_deriv_gwloc(2 * loc_hw + 1);
+					std::vector<double>	snd_deriv_gwloc(2 * loc_hw + 1);
+
+					std::vector<double>	gwloc_corr(2 * loc_hw + 1);
+					std::vector<double>	first_deriv_gwloc_corr(2 * loc_hw + 1);
+					std::vector<double>	snd_deriv_gwloc_corr(2 * loc_hw + 1);
+
+					double zero_sum_loc = 0.0;
+					double snd_sum_loc = 0.0;
+
+					for(int k=-loc_hw, l=0; k<=loc_hw; k++, l++)
+					{
+						double kd = (double)k;
+						gwloc [l] = nfac * exp (-kd * kd / (2.0 * variance));
+						first_deriv_gwloc [l] = -kd * nfac * exp (-kd * kd / (2.0 * variance)) / variance;
+						snd_deriv_gwloc [l] = nfac * (kd * kd / variance - 1.0) * exp (-kd * kd / (2.0 * variance)) / variance;
+
+						zero_sum_loc += gwloc [l];
+						snd_sum_loc += snd_deriv_gwloc [l];
+					}
+
+
+					// The filter kernels have to be corrected because of the discretization
+
+					double first_k_sum_loc = 0.0 ;
+
+					for(int k=-loc_hw, l=0; k<=loc_hw; k++, l++)
+					{
+						double kd = (double)k;
+						gwloc_corr [l] = gwloc [l] / zero_sum_loc;
+
+						snd_deriv_gwloc_corr [l] = snd_deriv_gwloc [l] - snd_sum_loc * gwloc_corr [l];
+
+						// attention: it is convolution not correlation, therefore the minus sign
+						first_k_sum_loc -= kd * first_deriv_gwloc [l];
+					}
+
+					double snd_kk_sum_loc = 0.0;
+
+					for(int k=-loc_hw, l=0; k<=loc_hw; k++, l++)
+					{
+						double kd = (double)k;
+						first_deriv_gwloc_corr [l] = first_deriv_gwloc [l] / first_k_sum_loc;
+
+						snd_kk_sum_loc += kd * kd * snd_deriv_gwloc_corr [l];
+					}
+
+
+					for(int k=-loc_hw, l=0; k<=loc_hw; k++, l++)
+					{
+						snd_deriv_gwloc_corr [l] *= (2.0 / snd_kk_sum_loc);
+					}
+
+
+					std::vector<double>	values_red_x(2 * half_window_width + 1);
+					std::vector<double>	values_red_y(2 * half_window_width + 1);
+
+
+					for(int l=iPoint - loc_hw, k=0; l<=iPoint + loc_hw; k++, l++)
+					{
+						values_red_x [k] = verticesA.at(l).x - mean_loc_x;
+						values_red_y [k] = verticesA.at(l).y - mean_loc_y;
+					}
+
+					
+					int lstart = iPoint - loc_hw;
+					int lend   = iPoint + loc_hw;
+
+					for(int i=0, l=lstart; l<=lend; i++, l++)
+					{
+						value_x += gwloc_corr [i] * values_red_x [i];
+						value_y += gwloc_corr [i] * values_red_y [i];
+
+						// attention: it is convolution not correlation, and the first-derivative-kernel is antisymmetric
+
+						first_deriv_x -= first_deriv_gwloc [i] * values_red_x [i];
+						first_deriv_y -= first_deriv_gwloc [i] * values_red_y [i];
+
+						snd_deriv_x += snd_deriv_gwloc_corr [i] * values_red_x [i];
+						snd_deriv_y += snd_deriv_gwloc_corr [i] * values_red_y [i];
+					}
+
+					value_x += mean_loc_x;
+					value_y += mean_loc_y;
+
+					if( loc_hw <= 3 )
+					{
+						p.x = value_x;
+						p.y = value_y;
+						verticesB.at(iPoint) = p;
+						verticesC.at(iPoint) = p;
+						continue;
+					}
+				}				
+				else     // if( (half_window_width <= iPoint && iPoint < curve_length - half_window_width) || bClosed == true )
+				{
+					std::vector<double>	values_red_x(2 * half_window_width + 1);
+					std::vector<double>	values_red_y(2 * half_window_width + 1);
+
+					loc_hw = half_window_width;
+
+					for(int l=iPoint - half_window_width, k=0; l<=iPoint + half_window_width; k++, l++)
+					{
+						int leff = l;
+
+						if( l < 0 ) 
+							leff = curve_length + l ;
+						else if( l >= curve_length ) 
+							leff = l - curve_length ;
+
+						values_red_x [k] = verticesA.at(leff).x - mean_loc_x;
+						values_red_y [k] = verticesA.at(leff).y - mean_loc_y;
+					}
+
+					for(int l=iPoint - half_window_width, k=0; l<=iPoint + half_window_width; k++, l++)
+					{
+						value_x += gauss_window [k] * values_red_x [k];
+						value_y += gauss_window [k] * values_red_y [k];
+
+						first_deriv_x -= first_deriv_gauss_window [k] * values_red_x [k];
+						first_deriv_y -= first_deriv_gauss_window [k] * values_red_y [k];
+
+						snd_deriv_x += snd_deriv_gauss_window_corr [k] * values_red_x [k];
+						snd_deriv_y += snd_deriv_gauss_window_corr [k] * values_red_y [k];
+					}
+
+					value_x += mean_loc_x;
+					value_y += mean_loc_y;
+				}
+		
+
+				double denom = first_deriv_x * first_deriv_x + first_deriv_y * first_deriv_y;
+
+				if( abs(denom) < EPSILON )
+				{
+					Error_Set(_TL("First Derivative is singular! Probably the shape containes consecutive identical points.\n\n"));
+
+					return( false );
+				}
+
+				double sqrt_denom = sqrt (denom);
+				double kappa = (first_deriv_x * snd_deriv_y - first_deriv_y * snd_deriv_x) / (denom * sqrt_denom);
+
+				p.x = value_x;
+				p.y = value_y;
+				verticesB.at(iPoint) = p;
+
+
+				if( abs(kappa) < EPSILON )
+				{
+					verticesC.at(iPoint) = verticesB.at(iPoint);
+					continue;
+				}
+
+				// Newton's method for the determination of the (original) curvature radius
+
+				double rsmooth = 1.0 / kappa;
+				double r = rsmooth;
+
+				for(int k=0; ; k++)
+				{
+					double efunc = exp (- denom * variance / (2.0 * r * r));
+					double f = r * efunc - rsmooth;
+					double fs = efunc * (1.0 + denom * variance / r / r);
+
+					if( abs(fs) < EPSILON )
+					{
+						r = rsmooth;
+						break;
+					}
+
+					r = r - f / fs;
+
+					if( k == 5 || abs(f) < EPSILON )
+					{
+						break;
+					}
+				}
+
+
+				first_deriv_x /= sqrt_denom;
+				first_deriv_y /= sqrt_denom;
+
+				value_x  += first_deriv_y * (r - rsmooth);
+				value_y  += first_deriv_x * (rsmooth - r);
+
+				p.x = value_x;
+				p.y = value_y;
+				verticesC.at(iPoint) = p;
+			} // iPoint
+
+
+			//--------------------------------------------------------
+			for(int iPoint = 0 ; iPoint<curve_length; iPoint++)
+			{
+				pSmoothed->Add_Point(verticesC.at(iPoint).x + mean_X, verticesC.at(iPoint).y + mean_Y, iPart);
+				
+				if( pLines -> Get_Vertex_Type () != SG_VERTEX_TYPE_XY )
+				{
+					pSmoothed-> Set_Z (pLine->Get_Z (iPoint, iPart), iPoint, iPart);
+
+					if( pLines -> Get_Vertex_Type () == SG_VERTEX_TYPE_XYZM )
+					{
+						pSmoothed -> Set_M (pLine -> Get_M (iPoint, iPart), iPoint, iPart);
+					}
+				}
+			}	
+		} // iPart
+	} // iLine
+
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
diff --git a/src/modules/statistics/statistics_kriging/_kriging_ordinary.h b/src/modules/shapes/shapes_lines/line_smoothing.h
similarity index 73%
rename from src/modules/statistics/statistics_kriging/_kriging_ordinary.h
rename to src/modules/shapes/shapes_lines/line_smoothing.h
index eea0aa7..41672ed 100644
--- a/src/modules/statistics/statistics_kriging/_kriging_ordinary.h
+++ b/src/modules/shapes/shapes_lines/line_smoothing.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: _kriging_ordinary.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: line_smoothing.h 2347 2014-12-04 10:37:10Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -9,14 +9,14 @@
 //      System for Automated Geoscientific Analyses      //
 //                                                       //
 //                    Module Library:                    //
-//                 Geostatistics_Kriging                 //
+//                     shapes_lines                      //
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//                  _Kriging_Ordinary.h                  //
+//                   line_smoothing.h                    //
 //                                                       //
-//                 Copyright (C) 2003 by                 //
-//                      Olaf Conrad                      //
+//                 Copyright (C) 2014 by                 //
+//                    Volker Wichmann                    //
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
@@ -40,14 +40,13 @@
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//    e-mail:     oconrad at saga-gis.org                   //
+//    e-mail:     wichmann at laserdata.at                  //
 //                                                       //
-//    contact:    Olaf Conrad                            //
-//                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
-//                Germany                                //
+//    contact:    Volker Wichmann                        //
+//                LASERDATA GmbH                         //
+//                Management and analysis of             //
+//                laserscanning data                     //
+//                Innsbruck, Austria                     //
 //                                                       //
 ///////////////////////////////////////////////////////////
 
@@ -61,8 +60,8 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#ifndef _INTERPOLATION__Kriging_ORDINARY_H
-#define _INTERPOLATION__Kriging_ORDINARY_H
+#ifndef HEADER_INCLUDED__line_smoothing_H
+#define HEADER_INCLUDED__line_smoothing_H
 
 
 ///////////////////////////////////////////////////////////
@@ -72,7 +71,9 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#include "_kriging_ordinary_global.h"
+#include "MLB_Interface.h"
+
+#include <vector>
 
 
 ///////////////////////////////////////////////////////////
@@ -82,28 +83,21 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-class C_Kriging_Ordinary : public C_Kriging_Ordinary_Global
+class CLine_Smoothing : public CSG_Module  
 {
 public:
-	C_Kriging_Ordinary(void);
-	virtual ~C_Kriging_Ordinary(void);
+	CLine_Smoothing(void);
 
 
 protected:
 
-	virtual bool			On_Initialise	(void);
-
-	virtual bool			Get_Value		(double x, double y, double &z, double &Variance);
-
+	virtual bool			On_Execute			(void);
+	virtual int				On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
 
 private:
 
-	int						m_nPoints_Min, m_nPoints_Max;
-
-	double					m_Radius;
-
-
-	int						Get_Weights		(double x, double y);
+	bool					Calc_SIA(CSG_Shapes *pLines, CSG_Shapes *pSmooth, int iMethod, int iSS, int iSI, double dSP);
+	bool					Calc_Gaussian(CSG_Shapes *pLines, CSG_Shapes *pSmooth, double dSigma);
 
 };
 
@@ -115,4 +109,4 @@ private:
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#endif // #ifndef _INTERPOLATION__Kriging_ORDINARY_H
+#endif // #ifndef HEADER_INCLUDED__line_smoothing_H
diff --git a/src/modules/shapes/shapes_points/Makefile.in b/src/modules/shapes/shapes_points/Makefile.in
index 4212904..f260e6f 100644
--- a/src/modules/shapes/shapes_points/Makefile.in
+++ b/src/modules/shapes/shapes_points/Makefile.in
@@ -521,22 +521,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/thiessen_polygons.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/shapes/shapes_points/Points_From_Lines.cpp b/src/modules/shapes/shapes_points/Points_From_Lines.cpp
index 209c631..46bb6fc 100644
--- a/src/modules/shapes/shapes_points/Points_From_Lines.cpp
+++ b/src/modules/shapes/shapes_points/Points_From_Lines.cpp
@@ -1,11 +1,11 @@
 /**********************************************************
- * Version $Id: Points_From_Lines.cpp 2072 2014-03-31 08:50:43Z reklov_w $
+ * Version $Id: Points_From_Lines.cpp 2515 2015-06-21 11:45:31Z reklov_w $
  *********************************************************/
 
 /*******************************************************************************
     Points_From_Lines.cpp
     Copyright (C) Victor Olaya
-    
+
     This program 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
@@ -19,7 +19,7 @@
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
     Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, USA
-*******************************************************************************/ 
+*******************************************************************************/
 
 ///////////////////////////////////////////////////////////
 //														 //
@@ -88,9 +88,9 @@ CPoints_From_Lines::CPoints_From_Lines(void)
 //---------------------------------------------------------
 bool CPoints_From_Lines::On_Execute(void)
 {
-	int			iLine, iPart, iPoint, jPoint, nPoints;
-	double		dx, dy, dz, dm, dDist, A_z, B_z, A_m, B_m;
-	TSG_Point	Pt_A, Pt_B;	
+	int			iLine, iPart, iPoint, jPoint;
+	double		dx, dy, dz, dm, dDist, dLine,  A_z, B_z, A_m, B_m;
+	TSG_Point	Pt_A, Pt_B;
 	CSG_Shapes	*pLines, *pPoints;
 	CSG_Shape	*pLine, *pPoint;
 	bool		bAddPtOrder;
@@ -134,7 +134,7 @@ bool CPoints_From_Lines::On_Execute(void)
 				{
 					Pt_A	= Pt_B;
 					Pt_B	= pLine->Get_Point(iPoint, iPart);
-					
+
 					if( pLines->Get_Vertex_Type() != SG_VERTEX_TYPE_XY )
 					{
 						A_z = B_z;
@@ -149,17 +149,17 @@ bool CPoints_From_Lines::On_Execute(void)
 
 					dx		= Pt_B.x - Pt_A.x;
 					dy		= Pt_B.y - Pt_A.y;
-					nPoints	= 1 + (int)(sqrt(dx*dx + dy*dy) / dDist);
-					dx		/= nPoints;
-					dy		/= nPoints;
+					dLine	= sqrt(dx*dx + dy*dy);
+					dx		/= dLine;
+					dy		/= dLine;
 
 					if( pLines->Get_Vertex_Type() != SG_VERTEX_TYPE_XY )
 					{
-						dz		= (B_z - A_z) / nPoints;
+						dz		= (B_z - A_z) / dLine;
 
 						if( pLines->Get_Vertex_Type() == SG_VERTEX_TYPE_XYZM )
 						{
-							dm		= (B_m - A_m) / nPoints;
+							dm		= (B_m - A_m) / dLine;
 						}
 					}
 
@@ -182,22 +182,24 @@ bool CPoints_From_Lines::On_Execute(void)
 						iPoints++;
 					}
 
-					for(jPoint=1; jPoint<nPoints; jPoint++)
+					double dLength = 0.0;
+
+					while( dLength + dDist < dLine )
 					{
-						Pt_A.x	+= dx;
-						Pt_A.y	+= dy;
+						Pt_A.x	+= dDist * dx;
+						Pt_A.y	+= dDist * dy;
 
 						pPoint	= pPoints->Add_Shape(pLine, SHAPE_COPY_ATTR);
 						pPoint	->Add_Point(Pt_A);
 
 						if( pLines->Get_Vertex_Type() != SG_VERTEX_TYPE_XY )
 						{
-							A_z	+= dz;
+							A_z	+= dDist * dz;
 							pPoint->Set_Z(A_z, 0);
 
 							if( pLines->Get_Vertex_Type() == SG_VERTEX_TYPE_XYZM )
 							{
-								A_m	+= dm;
+								A_m	+= dDist * dm;
 								pPoint->Set_M(A_m, 0);
 							}
 						}
@@ -207,6 +209,8 @@ bool CPoints_From_Lines::On_Execute(void)
 							pPoint->Set_Value(pPoints->Get_Field_Count()-1, iPoints);
 							iPoints++;
 						}
+
+						dLength += dDist;
 					}
 				}
 			}
diff --git a/src/modules/shapes/shapes_points/remove_duplicates.cpp b/src/modules/shapes/shapes_points/remove_duplicates.cpp
index 640ef2e..5a44da0 100644
--- a/src/modules/shapes/shapes_points/remove_duplicates.cpp
+++ b/src/modules/shapes/shapes_points/remove_duplicates.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: remove_duplicates.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: remove_duplicates.cpp 2447 2015-03-19 14:43:42Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -275,7 +275,7 @@ void CRemove_Duplicates::Set_Attributes(CSG_Shape *pPoint, CSG_PRQuadTree_Leaf_L
 	//-----------------------------------------------------
 	if( m_Method == 1 )	// last point
 	{
-		pKeep	= m_pPoints->Get_Shape((int)pList->Get_Value(pList->Get_Count() - 1));
+		pKeep	= m_pPoints->Get_Shape((int)pList->Get_Value((int)(pList->Get_Count() - 1)));
 	}
 
 	if( pKeep )
@@ -283,7 +283,7 @@ void CRemove_Duplicates::Set_Attributes(CSG_Shape *pPoint, CSG_PRQuadTree_Leaf_L
 		((CSG_Table_Record *)pPoint)->Assign(pKeep);
 	}
 
-	pPoint->Set_Value(m_pPoints->Get_Field_Count() - 1, pList->Get_Count());
+	pPoint->Set_Value(m_pPoints->Get_Field_Count() - 1, (double)pList->Get_Count());
 
 	//-----------------------------------------------------
 	if( m_Numeric > 0 )
diff --git a/src/modules/shapes/shapes_polygons/Makefile.in b/src/modules/shapes/shapes_polygons/Makefile.in
index 1aa5089..5a8fbf6 100644
--- a/src/modules/shapes/shapes_polygons/Makefile.in
+++ b/src/modules/shapes/shapes_polygons/Makefile.in
@@ -512,22 +512,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/shape_index.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/shapes/shapes_tools/CreateChartLayer.cpp b/src/modules/shapes/shapes_tools/CreateChartLayer.cpp
index 2694818..93b3603 100644
--- a/src/modules/shapes/shapes_tools/CreateChartLayer.cpp
+++ b/src/modules/shapes/shapes_tools/CreateChartLayer.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: CreateChartLayer.cpp 2072 2014-03-31 08:50:43Z reklov_w $
+ * Version $Id: CreateChartLayer.cpp 2447 2015-03-19 14:43:42Z oconrad $
  *********************************************************/
 /*******************************************************************************
     CCreateChartLayer.cpp
@@ -95,8 +95,8 @@ bool CCreateChartLayer::On_Execute(void){
 	if (GetExtraParameters()){
 
 		iSizeField = Parameters("SIZE")->asInt();
-		m_fMaxSize = (float) Parameters("MAXSIZE")->asDouble();
-		m_fMinSize = (float) Parameters("MINSIZE")->asDouble();
+		m_fMaxSize = (double) Parameters("MAXSIZE")->asDouble();
+		m_fMinSize = (double) Parameters("MINSIZE")->asDouble();
 
 		if (m_fMinSize > m_fMaxSize){
 			m_fMinSize = m_fMaxSize;
@@ -210,10 +210,10 @@ void CCreateChartLayer::AddPieChart(CSG_Shape* pShape, int iType){
 	int iSteps;
 	int iSizeField;
 	int iField;
-	float fSum = 0;
-	float fPartialSum = 0;
-	float fSize;	
-	float fSectorSize;
+	double fSum = 0;
+	double fPartialSum = 0;
+	double fSize;	
+	double fSectorSize;
 	double dX, dY;
 	CSG_Shape *pSector;
 	CSG_Table_Record *pRecord;
@@ -256,8 +256,8 @@ void CCreateChartLayer::AddPieChart(CSG_Shape* pShape, int iType){
 			pSector->Add_Point(dX,dY);
 			iSteps = (int) (fSectorSize * 200.);
 			for (j = 0; j < iSteps; j++){
-				pSector->Add_Point(dX + fSize * sin((fPartialSum + (float)j / 200.) * PI2),
-									dY + fSize * cos((fPartialSum + (float)j / 200.) * PI2));
+				pSector->Add_Point(dX + fSize * sin((fPartialSum + (double)j / 200.) * PI2),
+									dY + fSize * cos((fPartialSum + (double)j / 200.) * PI2));
 			}//for
 			fPartialSum +=fSectorSize;
 			pSector->Add_Point(dX + fSize * sin(fPartialSum * PI2),
@@ -276,10 +276,10 @@ void CCreateChartLayer::AddBarChart(CSG_Shape* pShape, int iType){
 	int iSizeField;
 	int iField;
 	int iValidFields = 0;
-	float fMax;	
-	float fMin;
-	float fSize;	
-	float fBarHeight, fBarWidth;
+	double fMax;	
+	double fMin;
+	double fSize;	
+	double fBarHeight, fBarWidth;
 	double dX, dY;
 	CSG_Shape *pSector;
 	CSG_Table_Record *pRecord;
@@ -332,7 +332,7 @@ void CCreateChartLayer::AddBarChart(CSG_Shape* pShape, int iType){
 	dX = Point.x;
 	dY = Point.y;
 	
-	fBarWidth = fSize / (float)iValidFields;
+	fBarWidth = fSize / (double)iValidFields;
 
 	iField = 1;
 	for (i = 0; i < pRecord->Get_Table()->Get_Field_Count(); i++){
@@ -358,8 +358,8 @@ void CCreateChartLayer::AddBarChart(CSG_Shape* pShape, int iType){
 TSG_Point CCreateChartLayer::GetLineMidPoint(CSG_Shape_Line *pLine){
 
 	int i;
-	float fDist, fAccDist = 0;
-	float fLength = pLine->Get_Length(0) / 2.;
+	double fDist, fAccDist = 0;
+	double fLength = pLine->Get_Length(0) / 2.;
 	TSG_Point Point, Point2, ReturnPoint;
 
 	for (i = 0; i < pLine->Get_Point_Count(0) - 1; i++){
diff --git a/src/modules/shapes/shapes_tools/CreateChartLayer.h b/src/modules/shapes/shapes_tools/CreateChartLayer.h
index c14ffa7..77f4c03 100644
--- a/src/modules/shapes/shapes_tools/CreateChartLayer.h
+++ b/src/modules/shapes/shapes_tools/CreateChartLayer.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: CreateChartLayer.h 2072 2014-03-31 08:50:43Z reklov_w $
+ * Version $Id: CreateChartLayer.h 2447 2015-03-19 14:43:42Z oconrad $
  *********************************************************/
 /*******************************************************************************
     CreateChartLayer.cpp
@@ -33,8 +33,8 @@ public:
 	virtual bool is_ProjectDependent(void) {return( false );}
 
 private:
-	float m_fMaxValue, m_fMinValue;
-	float m_fMaxSize, m_fMinSize;
+	double m_fMaxValue, m_fMinValue;
+	double m_fMaxSize, m_fMinSize;
 	CSG_Parameters *m_pExtraParameters;
 	bool *m_bIncludeParam;
 	CSG_Shapes *m_pOutput;
diff --git a/src/modules/shapes/shapes_tools/LandUse_Scenario.cpp b/src/modules/shapes/shapes_tools/LandUse_Scenario.cpp
new file mode 100644
index 0000000..e4527ba
--- /dev/null
+++ b/src/modules/shapes/shapes_tools/LandUse_Scenario.cpp
@@ -0,0 +1,433 @@
+/**********************************************************
+ * Version $Id: LandUse_Scenario.h 911 2011-02-14 16:38:15Z reklov_w $
+ *********************************************************/
+
+///////////////////////////////////////////////////////////
+//                                                       //
+//                         SAGA                          //
+//                                                       //
+//      System for Automated Geoscientific Analyses      //
+//                                                       //
+//                    Module Library:                    //
+//                      statistics                       //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//                 LandUse_Scenario.cpp                  //
+//                                                       //
+//                 Copyright (C) 2015 by                 //
+//                      Olaf Conrad                      //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+// This file is part of 'SAGA - System for Automated     //
+// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
+//                                                       //
+// SAGA is distributed in the hope that it will be       //
+// useful, but WITHOUT ANY WARRANTY; without even the    //
+// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
+// PARTICULAR PURPOSE. See the GNU General Public        //
+// License for more details.                             //
+//                                                       //
+// You should have received a copy of the GNU General    //
+// Public License along with this program; if not,       //
+// write to the Free Software Foundation, Inc.,          //
+// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
+// USA.                                                  //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//    e-mail:     oconrad at saga-gis.org                   //
+//                                                       //
+//    contact:    Olaf Conrad                            //
+//                Institute of Geography                 //
+//                University of Hamburg                  //
+//                Germany                                //
+//                                                       //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#include "LandUse_Scenario.h"
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#define STATISTICS_HEADCOLS	3
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+CLandUse_Scenario::CLandUse_Scenario(void)
+{
+	CSG_Parameter	*pNode;
+
+	//-----------------------------------------------------
+	Set_Name		(_TL("Land Use Scenario Generator"));
+
+	Set_Author		("O.Conrad (c) 2015");
+
+	Set_Description	(_TW(
+		"This tool generates land use scenarios for fields under "
+		"agricultural use based on statistics about the amount of "
+		"crop types grown in the investigated area of interest. "
+	));
+
+	//-----------------------------------------------------
+	pNode	= Parameters.Add_Shapes(
+		NULL	, "FIELDS"			, _TL("Fields"),
+		_TL(""),
+		PARAMETER_INPUT, SHAPE_TYPE_Polygon
+	);
+
+	Parameters.Add_Table_Field(
+		pNode	, "FIELD_ID"		, _TL("Field Identifier"),
+		_TL("")
+	);
+
+	pNode	= Parameters.Add_Shapes(
+		NULL	, "SCENARIO"		, _TL("Land Use Scenario"),
+		_TL(""),
+		PARAMETER_OUTPUT, SHAPE_TYPE_Polygon
+	);
+
+	Parameters.Add_Choice(
+		pNode	, "OUTPUT"			, _TL("Output of..."),
+		_TL(""),
+		CSG_String::Format("%s|%s|",
+			_TL("Identifier"),
+			_TL("Name")
+		), 0
+	);
+
+	//-----------------------------------------------------
+	Parameters.Add_Table(
+		NULL	, "STATISTICS"		, _TL("Crop Statistics"),
+		_TW("The first column specifies a crop type id. "
+			"The second column provides a human readible name for the crop type (e.g. 'potatoes') ."
+			"The third column must be an integer value, though this value is not yet used by this module. "
+			"The following columns provide the yearly amount of each crop type [%] for a sequence of years. "),
+		PARAMETER_INPUT
+	);
+
+	Parameters.Add_Table(
+		NULL	, "KNOWN_CROPS"		, _TL("Known Crops"),
+		_TW("The first column specifies the field id as given by the 'Fields' layer. "
+			"The following columns specify the crop type for each field and year "
+			"and refer to the crop type identifiers used in the crop statistics table. "
+			"The sequence of years must be identical with that of the crop statistics table."),
+		PARAMETER_INPUT_OPTIONAL
+	);
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CLandUse_Scenario::On_Execute(void)
+{
+	//-----------------------------------------------------
+	CSG_Table	*pStatistics	= Parameters("STATISTICS")->asTable();
+
+	if( pStatistics->Get_Field_Count() <= STATISTICS_HEADCOLS )
+	{
+		Error_Set(_TL("statistics table is missing required fields"));
+
+		return( false );
+	}
+
+	if( pStatistics->Get_Count() <= 0 )
+	{
+		Error_Set(_TL("statistics table does not contain any records"));
+
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	CSG_Shapes	*pFields	= Parameters("FIELDS"  )->asShapes();
+	int			Field_ID	= Parameters("FIELD_ID")->asInt   ();
+
+	if( pFields->Get_Count() <= 0 )
+	{
+		Error_Set(_TL("fields layer does not contain any records"));
+
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	int		nYears, iYear, iField, iType;
+
+	//-----------------------------------------------------
+	CSG_Table	Types;
+
+	Types.Add_Field("ID"    , SG_DATATYPE_Int);
+	Types.Add_Field("NAME"  , SG_DATATYPE_String);
+	Types.Add_Field("RETURN", SG_DATATYPE_Int);
+
+	Types.Set_Record_Count(pStatistics->Get_Count());
+
+	nYears		= pStatistics->Get_Field_Count() - STATISTICS_HEADCOLS;
+
+	CSG_Matrix	Crops(nYears, Types.Get_Count());
+
+	for(iType=0; iType<Types.Get_Count(); iType++)
+	{
+		CSG_Table_Record	*pRecord	= pStatistics->Get_Record(iType);
+
+		Types[iType][0]	= pRecord->asInt   (0);
+		Types[iType][1]	= pRecord->asString(1);
+		Types[iType][2]	= pRecord->asInt   (2);
+
+		for(iYear=0; iYear<nYears; iYear++)
+		{
+			Crops[iType][iYear]	= pRecord->asDouble(iYear + STATISTICS_HEADCOLS);
+		}
+	}
+
+	//-----------------------------------------------------
+	CSG_Table	Scenario;
+
+	for(iYear=0; iYear<nYears; iYear++)
+	{
+		Scenario.Add_Field(pStatistics->Get_Field_Name(iYear + STATISTICS_HEADCOLS), SG_DATATYPE_Int);
+	}
+
+	Scenario.Add_Field("ID"  , SG_DATATYPE_Int);
+	Scenario.Add_Field("AREA", SG_DATATYPE_Double);
+
+	Scenario.Set_Record_Count(pFields->Get_Count());
+
+	for(iField=0; iField<pFields->Get_Count(); iField++)
+	{
+		CSG_Shape_Polygon	*pField		= (CSG_Shape_Polygon *)pFields->Get_Shape(iField);
+
+		Scenario[iField][nYears + 0]	= pField->asInt(Field_ID);
+		Scenario[iField][nYears + 1]	= pField->Get_Area();
+
+		for(iYear=0; iYear<nYears; iYear++)
+		{
+			Scenario[iField][iYear]	= -1;
+		}
+	}
+
+	//-----------------------------------------------------
+	Get_Known_LandUse(nYears, Scenario, Types);
+	Get_Scenario     (nYears, Scenario, Crops);
+
+	//-----------------------------------------------------
+	CSG_Shapes	*pScenario	= Parameters("SCENARIO")->asShapes();
+
+	bool	bID	= Parameters("OUTPUT")->asInt() == 0;
+
+	pScenario->Create(SHAPE_TYPE_Polygon, CSG_String::Format("%s [%s]", pFields->Get_Name(), _TL("Land Use Scenario")));
+
+	pScenario->Add_Field("ID", SG_DATATYPE_Int);
+
+	for(iYear=0; iYear<nYears; iYear++)
+	{
+		pScenario->Add_Field(pStatistics->Get_Field_Name(iYear + STATISTICS_HEADCOLS), bID ? SG_DATATYPE_Int : SG_DATATYPE_String);
+	}
+
+	//-----------------------------------------------------
+	for(iField=0; iField<pFields->Get_Count(); iField++)
+	{
+		CSG_Shape	*pField	= pScenario->Add_Shape(pFields->Get_Shape(iField), SHAPE_COPY_GEOM);
+
+		pField->Set_Value(0, pFields->Get_Shape(iField)->asInt(Field_ID));
+
+		for(iYear=0; iYear<nYears; iYear++)
+		{
+			(*pField)[iYear + 1]	= Types[Scenario[iField][iYear].asInt()][bID ? 0 : 1];
+		}
+	}
+
+	//-----------------------------------------------------
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CLandUse_Scenario::Get_Known_LandUse(int nYears, CSG_Table &Scenario, const CSG_Table &Types)
+{
+	CSG_Table	*pLandUse_Known	= Parameters("KNOWN_CROPS")->asTable();
+
+	if( !pLandUse_Known || pLandUse_Known->Get_Field_Count() != nYears + 1 )
+	{
+		return( true );
+	}
+
+	for(int iKnown=0; iKnown<pLandUse_Known->Get_Count(); iKnown++)
+	{
+		CSG_Table_Record	*pKnown	= pLandUse_Known->Get_Record(iKnown);
+
+		for(int iField=0, Field_ID=pKnown->asInt(0); iField<Scenario.Get_Count(); iField++)
+		{
+			if( Field_ID == Scenario[iField][nYears + 0].asInt() )
+			{
+				for(int iYear=0; iYear<nYears; iYear++)
+				{
+					int	Type_ID	= pKnown->asInt(iYear + 1);
+
+					for(int iType=0; iType<Types.Get_Count(); iType++)
+					{
+						if( Type_ID == Types[iType][0].asInt() )
+						{
+							Scenario[iField][iYear]	= iType;
+
+							break;
+						}
+					}
+				}
+
+				break;
+			}
+		}
+	}
+
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CLandUse_Scenario::Get_Scenario(int nYears, CSG_Table &Scenario, const CSG_Matrix &Crops)
+{
+	int		iType, iField;
+	double	Sum_Area;
+
+	//-----------------------------------------------------
+	for(iField=0, Sum_Area=0.0; iField<Scenario.Get_Count(); iField++)
+	{
+		Sum_Area	+= Scenario[iField][nYears + 1];
+	}
+
+	if( Sum_Area <= 0.0 )
+	{
+		return( false );
+	}
+
+	CSG_Vector	Area_Crop(Crops.Get_NRows());
+
+	//-----------------------------------------------------
+	for(int iYear=0; iYear<nYears; iYear++)
+	{
+		//-------------------------------------------------
+		// 1. determine percentage and absolute area for each crop type...
+
+		double	Sum_Crops	= 0.0;
+
+		for(iType=0; iType<Crops.Get_NRows(); iType++)
+		{
+			Sum_Crops	+= Crops[iType][iYear];
+		}
+
+		if( Sum_Crops <= 0.0 )
+		{
+			continue;
+		}
+
+		for(iType=0; iType<Crops.Get_NRows(); iType++)
+		{
+			Area_Crop[iType]	= Crops[iType][iYear] * Sum_Area / Sum_Crops;
+		}
+
+		//-------------------------------------------------
+		// 2. remove known field crops...
+
+		double	Area_Left	= Sum_Area;
+
+		for(iField=0; iField<Scenario.Get_Count(); iField++)
+		{
+			if( Scenario[iField][iYear] >= 0 )
+			{
+				iType				 = Scenario[iField][iYear].asInt();
+				Area_Left			-= Scenario[iField][nYears + 1];
+				Area_Crop[iType]	-= Scenario[iField][nYears + 1];
+			}
+		}
+
+		//-------------------------------------------------
+		// 3. fill remaining gaps with randomized scenario...
+
+		for(iField=0; iField<Scenario.Get_Count(); iField++)
+		{
+			if( Scenario[iField][iYear].asInt() < 0 )
+			{
+				//-----------------------------------------
+				// (a) select a crop type...
+
+				double	pArea	= 0.0, pCrop	= CSG_Random::Get_Uniform(0.0, Area_Left);
+
+				int		Type	= -1;
+
+				for(iType=0; Type<0 && iType<Crops.Get_NRows(); iType++)
+				{
+					pArea	+= Area_Crop[iType];
+
+					if( pCrop - pArea < 0.000001 )	// if( pCrop < pArea ) pech mit flie�kommagenauigkeit...
+					{
+						Type	= iType;
+					}
+				}
+
+				//-----------------------------------------
+				// (b) Set the Crop...
+
+				if( Type >= 0 )
+				{
+					Area_Left		-= Scenario[iField][nYears + 1];
+					Area_Crop[Type]	-= Scenario[iField][nYears + 1];
+
+					Scenario[iField][iYear]	= Type;
+				}
+			}
+		}
+	}
+
+	//-----------------------------------------------------
+	return( true );
+}
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
diff --git a/src/modules/grid/grid_filter/Filter_Majority.h b/src/modules/shapes/shapes_tools/LandUse_Scenario.h
similarity index 78%
copy from src/modules/grid/grid_filter/Filter_Majority.h
copy to src/modules/shapes/shapes_tools/LandUse_Scenario.h
index 83bf64c..64e4232 100644
--- a/src/modules/grid/grid_filter/Filter_Majority.h
+++ b/src/modules/shapes/shapes_tools/LandUse_Scenario.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Filter_Majority.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: LandUse_Scenario.h 911 2011-02-14 16:38:15Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -9,13 +9,13 @@
 //      System for Automated Geoscientific Analyses      //
 //                                                       //
 //                    Module Library:                    //
-//                      Grid_Filter                      //
+//                      statistics                       //
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//                   Filter_Majority.h                   //
+//                  LandUse_Scenario.h                   //
 //                                                       //
-//                 Copyright (C) 2010 by                 //
+//                 Copyright (C) 2015 by                 //
 //                      Olaf Conrad                      //
 //                                                       //
 //-------------------------------------------------------//
@@ -53,63 +53,50 @@
 
 
 ///////////////////////////////////////////////////////////
-//														 //
 //                                                       //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#ifndef HEADER_INCLUDED__Filter_Majority_H
-#define HEADER_INCLUDED__Filter_Majority_H
-
-
-///////////////////////////////////////////////////////////
-//														 //
 //                                                       //
-//														 //
+//                                                       //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#include "MLB_Interface.h"
-
+#ifndef HEADER_INCLUDED__LandUse_Scenario_H
+#define HEADER_INCLUDED__LandUse_Scenario_H
+
+#include "MLB_Interface.h"
+
 
 ///////////////////////////////////////////////////////////
-//														 //
 //                                                       //
-//														 //
+//                                                       //
+//                                                       //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-class CFilter_Majority : public CSG_Module_Grid
-{
-public:
-	CFilter_Majority(void);
-
-
-protected:
-
-	virtual bool			On_Execute		(void);
-
-
-private:
-
-	int						m_Radius, m_Threshold;
-
-	CSG_Grid				m_Kernel, *m_pInput;
-
-	CSG_Class_Statistics	m_Majority;
-
-
-	double					Get_Majority	(int x, int y);
-
-};
-
+class CLandUse_Scenario : public CSG_Module
+{
+public:
+	CLandUse_Scenario(void);
+
+
+protected:
+
+	virtual bool			On_Execute(void);
+
+
+private:
+
+	bool					Get_Known_LandUse	(int nYears, CSG_Table &Scenario, const CSG_Table &Types);
+
+	bool					Get_Scenario		(int nYears, CSG_Table &Scenario, const CSG_Matrix &Crops);
+
+};
+
 
 ///////////////////////////////////////////////////////////
-//														 //
 //                                                       //
-//														 //
+//                                                       //
+//                                                       //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED__Filter_Majority_H
+#endif // #ifndef HEADER_INCLUDED__LandUse_Scenario_H
diff --git a/src/modules/shapes/shapes_tools/MLB_Interface.cpp b/src/modules/shapes/shapes_tools/MLB_Interface.cpp
index 8401bfb..c1fc124 100644
--- a/src/modules/shapes/shapes_tools/MLB_Interface.cpp
+++ b/src/modules/shapes/shapes_tools/MLB_Interface.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: MLB_Interface.cpp 2281 2014-10-09 15:49:41Z oconrad $
+ * Version $Id: MLB_Interface.cpp 2417 2015-02-19 15:14:52Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -124,6 +124,8 @@ CSG_String Get_Info(int i)
 #include "shapes_generate.h"
 #include "shapes_convert_vertex_type.h"
 
+#include "LandUse_Scenario.h"
+
 
 //---------------------------------------------------------
 // 4. Allow your modules to be created here...
@@ -161,6 +163,8 @@ CSG_Module *		Create_Module(int i)
 	case 22:	return( new CShapes_Generate );
 	case 23:	return( new CShapes_Convert_Vertex_Type );
 
+	case 25:	return( new CLandUse_Scenario );
+
 	case 30:	return( NULL );
 	}
 
diff --git a/src/modules/shapes/shapes_tools/Makefile.am b/src/modules/shapes/shapes_tools/Makefile.am
index a264828..0336fc2 100644
--- a/src/modules/shapes/shapes_tools/Makefile.am
+++ b/src/modules/shapes/shapes_tools/Makefile.am
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.am 1917 2013-12-28 16:38:41Z reklov_w $
+# $Id: Makefile.am 2417 2015-02-19 15:14:52Z oconrad $
 #
 if DEBUG
 DBGFLAGS = -g -DDEBUG
@@ -15,6 +15,7 @@ pkglib_LTLIBRARIES = libshapes_tools.la
 libshapes_tools_la_SOURCES =\
 CreateChartLayer.cpp\
 GraticuleBuilder.cpp\
+LandUse_Scenario.cpp\
 MLB_Interface.cpp\
 NewLayerFromSelectedShapes.cpp\
 quadtree_structure.cpp\
@@ -37,6 +38,7 @@ shapes_split_by_attribute.cpp\
 shapes_split_randomly.cpp\
 CreateChartLayer.h\
 GraticuleBuilder.h\
+LandUse_Scenario.h\
 MLB_Interface.h\
 NewLayerFromSelectedShapes.h\
 quadtree_structure.h\
diff --git a/src/modules/shapes/shapes_tools/Makefile.in b/src/modules/shapes/shapes_tools/Makefile.in
index 607ddd0..3b2add7 100644
--- a/src/modules/shapes/shapes_tools/Makefile.in
+++ b/src/modules/shapes/shapes_tools/Makefile.in
@@ -128,7 +128,7 @@ LTLIBRARIES = $(pkglib_LTLIBRARIES)
 libshapes_tools_la_DEPENDENCIES =  \
 	$(top_srcdir)/src/saga_core/saga_api/libsaga_api.la
 am_libshapes_tools_la_OBJECTS = CreateChartLayer.lo \
-	GraticuleBuilder.lo MLB_Interface.lo \
+	GraticuleBuilder.lo LandUse_Scenario.lo MLB_Interface.lo \
 	NewLayerFromSelectedShapes.lo quadtree_structure.lo \
 	QueryBuilder.lo SearchInTable.lo SelectByTheme.lo \
 	SeparateShapes.lo Shapes_Create_Empty.lo Shapes_Merge.lo \
@@ -370,7 +370,7 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
 #
-# $Id: Makefile.am 1917 2013-12-28 16:38:41Z reklov_w $
+# $Id: Makefile.am 2417 2015-02-19 15:14:52Z oconrad $
 #
 @DEBUG_TRUE at DBGFLAGS = -g -DDEBUG
 @SAGA_UNICODE_TRUE at UC_DEFS = -D_SAGA_UNICODE
@@ -382,6 +382,7 @@ pkglib_LTLIBRARIES = libshapes_tools.la
 libshapes_tools_la_SOURCES = \
 CreateChartLayer.cpp\
 GraticuleBuilder.cpp\
+LandUse_Scenario.cpp\
 MLB_Interface.cpp\
 NewLayerFromSelectedShapes.cpp\
 quadtree_structure.cpp\
@@ -404,6 +405,7 @@ shapes_split_by_attribute.cpp\
 shapes_split_randomly.cpp\
 CreateChartLayer.h\
 GraticuleBuilder.h\
+LandUse_Scenario.h\
 MLB_Interface.h\
 NewLayerFromSelectedShapes.h\
 quadtree_structure.h\
@@ -507,6 +509,7 @@ distclean-compile:
 
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/CreateChartLayer.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/GraticuleBuilder.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/LandUse_Scenario.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MLB_Interface.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/NewLayerFromSelectedShapes.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/QueryBuilder.Plo at am__quote@
@@ -529,22 +532,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/shapes_split_randomly.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/shapes/shapes_tools/Shapes_Create_Empty.cpp b/src/modules/shapes/shapes_tools/Shapes_Create_Empty.cpp
index dca2ede..6e0302b 100644
--- a/src/modules/shapes/shapes_tools/Shapes_Create_Empty.cpp
+++ b/src/modules/shapes/shapes_tools/Shapes_Create_Empty.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Shapes_Create_Empty.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: Shapes_Create_Empty.cpp 2355 2014-12-19 09:55:41Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -90,17 +90,25 @@ CShapes_Create_Empty::CShapes_Create_Empty(void)
 
 	Set_Author		(SG_T("O. Conrad (c) 2008"));
 
-	Set_Description	(_TW(
+	Set_Description	(CSG_String::Format(_TW(
 		"Creates a new empty shapes layer of given type, "
-		"which might be either point, multipoint, line or polygon. "
+		"which might be either point, multipoint, line or polygon.\n\n"
 		"Possible field types for the attributes table are:\n"
-		" - character string\n"
-		" - 1 byte integer\n"
-		" - 2 byte integer\n"
-		" - 4 byte integer\n"
-		" - 4 byte floating point\n"
-		" - 8 byte floating point\n"
-		" - 32 bit true color (RGB)\n"
+		"- %s\n- %s\n- %s\n- %s\n- %s\n- %s\n- %s\n- %s\n- %s\n- %s\n- %s\n- %s\n- %s\n- %s\n"),
+		SG_Data_Type_Get_Name(SG_DATATYPE_String).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_Date  ).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_Color ).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_Byte  ).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_Char  ).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_Word  ).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_Short ).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_DWord ).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_Int   ).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_ULong ).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_Long  ).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_Float ).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_Double).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_Binary).c_str()
 	));
 
 
@@ -170,14 +178,21 @@ void CShapes_Create_Empty::_Set_Field_Count(CSG_Parameters *pAttributes, int nAt
 	//-----------------------------------------------------
 	CSG_String	Types;
 
-	Types.Printf(SG_T("%s|%s|%s|%s|%s|%s|%s|"),
-		_TL("character string"),
-		_TL("1 byte integer"),
-		_TL("2 byte integer"),
-		_TL("4 byte integer"),
-		_TL("4 byte floating point"),
-		_TL("8 byte floating point"),
-		_TL("color (rgb)")
+	Types = CSG_String::Format(SG_T("%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|"),
+			SG_Data_Type_Get_Name(SG_DATATYPE_String).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Date  ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Color ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Byte  ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Char  ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Word  ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Short ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_DWord ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Int   ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_ULong ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Long  ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Float ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Double).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Binary).c_str()
 	);
 
 	//-----------------------------------------------------
@@ -285,13 +300,20 @@ bool CShapes_Create_Empty::On_Execute(void)
 		switch( pAttributes->Get_Parameter(GET_TYPE(i))->asInt() )
 		{
 		default:
-		case 0:	Type	= SG_DATATYPE_String;	break;
-		case 1:	Type	= SG_DATATYPE_Char  ;	break;
-		case 2:	Type	= SG_DATATYPE_Short ;	break;
-		case 3:	Type	= SG_DATATYPE_Int   ;	break;
-		case 4:	Type	= SG_DATATYPE_Float ;	break;
-		case 5:	Type	= SG_DATATYPE_Double;	break;
-		case 6:	Type	= SG_DATATYPE_Color ;	break;
+		case  0:	Type	= SG_DATATYPE_String;	break;
+		case  1:	Type	= SG_DATATYPE_Date;		break;
+		case  2:	Type	= SG_DATATYPE_Color;	break;
+		case  3:	Type	= SG_DATATYPE_Byte;		break;
+		case  4:	Type	= SG_DATATYPE_Char;		break;
+		case  5:	Type	= SG_DATATYPE_Word;		break;
+		case  6:	Type	= SG_DATATYPE_Short;	break;
+		case  7:	Type	= SG_DATATYPE_DWord;	break;
+		case  8:	Type	= SG_DATATYPE_Int;		break;
+		case  9:	Type	= SG_DATATYPE_ULong;	break;
+		case 10:	Type	= SG_DATATYPE_Long;		break;
+		case 11:	Type	= SG_DATATYPE_Float;	break;
+		case 12:	Type	= SG_DATATYPE_Double;	break;
+		case 13:	Type	= SG_DATATYPE_Binary;	break;
 		}
 
 		pShapes->Add_Field(pAttributes->Get_Parameter(GET_NAME(i))->asString(), Type);
diff --git a/src/modules/shapes/shapes_tools/TransformShapes.cpp b/src/modules/shapes/shapes_tools/TransformShapes.cpp
index 25c33f5..1af64be 100644
--- a/src/modules/shapes/shapes_tools/TransformShapes.cpp
+++ b/src/modules/shapes/shapes_tools/TransformShapes.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: TransformShapes.cpp 2072 2014-03-31 08:50:43Z reklov_w $
+ * Version $Id: TransformShapes.cpp 2339 2014-11-17 16:15:58Z reklov_w $
  *********************************************************/
 /*******************************************************************************
     TransformShapes.cpp
@@ -32,19 +32,19 @@ CTransformShapes::CTransformShapes(void)
 		"(c) 2004 by Victor Olaya. Use this module to move, rotate and/or scale shapes."
 	));
 
-	CSG_Parameter *pNode_0, *pNode_1;
+	CSG_Parameter *pNode_0;
 
 	//-----------------------------------------------------
 	Parameters.Add_Shapes(
-		NULL	, "OUT"		, _TL("Output"), 
+		NULL	, "IN"		, _TL("Shapes"),
 		_TL(""),
-		PARAMETER_OUTPUT
+		PARAMETER_INPUT
 	);
 
 	Parameters.Add_Shapes(
-		NULL	, "IN"		, _TL("Shapes"),
+		NULL	, "OUT"		, _TL("Output"), 
 		_TL(""),
-		PARAMETER_INPUT
+		PARAMETER_OUTPUT
 	);
 
 	//-----------------------------------------------------
@@ -53,15 +53,21 @@ CTransformShapes::CTransformShapes(void)
 		_TL("")
 	);
 
-	pNode_1 = Parameters.Add_Value(
+	Parameters.Add_Value(
 		pNode_0	, "DX"		, _TL("dX"), 
-		_TL("dX(GridUnits)"), 
+		_TL("dX (Map Units)"), 
 		PARAMETER_TYPE_Double, 0.0
 	);
 
-	pNode_1 = Parameters.Add_Value(
+	Parameters.Add_Value(
 		pNode_0, "DY"		, _TL("dY"), 
-		_TL("dY(GridUnits)"), 
+		_TL("dY (Map Units)"), 
+		PARAMETER_TYPE_Double, 0.0
+	);
+
+	Parameters.Add_Value(
+		pNode_0, "DZ"		, _TL("dZ"),
+		_TL("dZ (Map Units)"),
 		PARAMETER_TYPE_Double, 0.0
 	);
 
@@ -71,9 +77,21 @@ CTransformShapes::CTransformShapes(void)
 		_TL("Rotate"),
 		_TL(""));
 	
-	pNode_1 = Parameters.Add_Value(
-		pNode_0	, "ANGLE"	, _TL("Angle"), 
-		_TL("Angle in degrees, counting clockwise from north"), 
+	Parameters.Add_Value(
+		pNode_0	, "ANGLE"	, _TL("Angle"),
+		_TL("Angle in degrees, counting clockwise from north"),
+		PARAMETER_TYPE_Double, 0.0
+	);
+
+	Parameters.Add_Value(
+		pNode_0	, "ROTATEX"	, _TL("Rotation X"),
+		_TL("Angle in degrees, clockwise around x axis"),
+		PARAMETER_TYPE_Double, 0.0
+	);
+
+	Parameters.Add_Value(
+		pNode_0	, "ROTATEY"	, _TL("Rotation Y"),
+		_TL("Angle in degrees, clockwise around y axis"),
 		PARAMETER_TYPE_Double, 0.0
 	);
 
@@ -83,59 +101,100 @@ CTransformShapes::CTransformShapes(void)
 		_TL("")
 	);
 
-	pNode_1 = Parameters.Add_Value(
+	Parameters.Add_Value(
 		pNode_0	, "SCALEX"	, _TL("Scale Factor X"), 
 		_TL("Scale Factor X"), 
 		PARAMETER_TYPE_Double, 1.0
 	);
 
-	pNode_1 = Parameters.Add_Value(
+	Parameters.Add_Value(
 		pNode_0	, "SCALEY"	, _TL("Scale Factor Y"), 
 		_TL("Scale Factor Y"), 
 		PARAMETER_TYPE_Double, 1.0
 	);
 
+	Parameters.Add_Value(
+		pNode_0	, "SCALEZ"	, _TL("Scale Factor Z"),
+		_TL("Scale Factor Z"),
+		PARAMETER_TYPE_Double, 1.0
+	);
+
 	//-----------------------------------------------------
 	pNode_0	= Parameters.Add_Node(
 		NULL	, "ANCHOR"	, _TL("Anchor Point"),
 		_TL("")
 	);
 
-	pNode_1 = Parameters.Add_Value(
+	Parameters.Add_Value(
 		pNode_0	, "ANCHORX"	, _TL("X"), 
 		_TL("X"), 
 		PARAMETER_TYPE_Double, 0.0
 	);
 
-	pNode_1 = Parameters.Add_Value(
+	Parameters.Add_Value(
 		pNode_0	, "ANCHORY"	, _TL("Y"), 
 		_TL("Y"), 
 		PARAMETER_TYPE_Double, 0.0
-	);	
+	);
+
+	Parameters.Add_Value(
+		pNode_0	, "ANCHORZ"	, _TL("Z"),
+		_TL("Z"),
+		PARAMETER_TYPE_Double, 0.0
+	);
 }//constructor
 
 //---------------------------------------------------------
 CTransformShapes::~CTransformShapes(void)
 {}
 
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+int CTransformShapes::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+{
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), SG_T("IN")) && pParameter->asShapes() != NULL )
+	{
+		pParameters->Set_Enabled("ROTATEX",	pParameter->asShapes()->Get_Vertex_Type() != SG_VERTEX_TYPE_XY);
+		pParameters->Set_Enabled("ROTATEY",	pParameter->asShapes()->Get_Vertex_Type() != SG_VERTEX_TYPE_XY);
+		pParameters->Set_Enabled("DZ",		pParameter->asShapes()->Get_Vertex_Type() != SG_VERTEX_TYPE_XY);
+		pParameters->Set_Enabled("SCALEZ",	pParameter->asShapes()->Get_Vertex_Type() != SG_VERTEX_TYPE_XY);
+		pParameters->Set_Enabled("ANCHORZ",	pParameter->asShapes()->Get_Vertex_Type() != SG_VERTEX_TYPE_XY);
+	}
+
+	return( 0 );
+}
+
+
 //---------------------------------------------------------
 bool CTransformShapes::On_Execute(void)
 {
 	bool		bCopy;
-	double		Angle;
-	TSG_Point	P, Q, Move, Scale, Anchor;
+	double		angleX, angleY, angleZ;
+	TSG_Point_Z	P, Q, Move, Scale, Anchor;
 	CSG_Shapes	*pIn, *pOut;
+	double		a11, a12, a13, a21, a22, a23, a31, a32, a33;
 
 	//-----------------------------------------------------
 	pIn			= Parameters("IN")		->asShapes();
 	pOut		= Parameters("OUT")		->asShapes();
 	Scale.x		= Parameters("SCALEX")	->asDouble();
 	Scale.y		= Parameters("SCALEY")	->asDouble();
+	Scale.z		= Parameters("SCALEZ")	->asDouble();
 	Move.x		= Parameters("DX")		->asDouble();
 	Move.y		= Parameters("DY")		->asDouble();
+	Move.z		= Parameters("DZ")		->asDouble();
 	Anchor.x	= Parameters("ANCHORX")	->asDouble();
 	Anchor.y	= Parameters("ANCHORY")	->asDouble();
-	Angle		= Parameters("ANGLE")	->asDouble() * -M_DEG_TO_RAD;
+	Anchor.z	= Parameters("ANCHORZ")	->asDouble();
+	angleX		= Parameters("ROTATEX")	->asDouble() * -M_DEG_TO_RAD;
+	angleY		= Parameters("ROTATEY")	->asDouble() * -M_DEG_TO_RAD;
+	angleZ		= Parameters("ANGLE")	->asDouble() * -M_DEG_TO_RAD;
+
 
 	if( pIn == pOut )
 	{
@@ -147,7 +206,7 @@ bool CTransformShapes::On_Execute(void)
 		bCopy = false;
 	}//else
 
-	pOut->Create(pIn->Get_Type(), CSG_String::Format(SG_T("%s [%s]"), pIn->Get_Name(), _TL("Transformed")), pIn);
+	pOut->Create(pIn->Get_Type(), CSG_String::Format(SG_T("%s [%s]"), pIn->Get_Name(), _TL("Transformed")), pIn, pIn->Get_Vertex_Type());
 
 	//-----------------------------------------------------
 	for(int iShape=0; iShape<pIn->Get_Count(); iShape++)
@@ -158,20 +217,64 @@ bool CTransformShapes::On_Execute(void)
 		{
 			for(int iPoint=0; iPoint<pShape->Get_Point_Count(iPart); iPoint++)
 			{
-				// move first, then rotate and scale...
+				P.x	= pShape->Get_Point(iPoint, iPart).x;
+				P.y	= pShape->Get_Point(iPoint, iPart).y;
+
+				if( pIn->Get_Vertex_Type() < SG_VERTEX_TYPE_XYZ )
+				{
+					// move first, then rotate and scale...
+
+					P.x	+= Move.x - Anchor.x;
+					P.y	+= Move.y - Anchor.y;
+
+					Q.x	= Anchor.x + Scale.x * (P.x * cos(angleZ) - P.y * sin(angleZ));
+					Q.y	= Anchor.y + Scale.y * (P.x * sin(angleZ) + P.y * cos(angleZ));
+
+					pShape->Set_Point(Q.x, Q.y, iPoint, iPart);
+				}
+				else
+				{
+					P.z	= pIn->Get_Shape(iShape)->Get_Z(iPoint, iPart);
+
+					//anchor shift
+					P.x	-= Anchor.x;
+					P.y	-= Anchor.y;
+					P.z -= Anchor.z;
+
+					// create rotation matrix
+					a11 = cos(angleY) * cos(angleZ);
+					a12 = -cos(angleX) * sin(angleZ) + sin(angleX) * sin(angleY) * cos(angleZ);
+					a13 = sin(angleX) * sin(angleZ) + cos(angleX) * sin(angleY) * cos(angleZ);
+
+					a21 = cos(angleY) * sin(angleZ);
+					a22 = cos(angleX) * cos(angleZ) + sin(angleX) * sin(angleY) * sin(angleZ);
+					a23 = -sin(angleX) * cos(angleZ) + cos(angleX) * sin(angleY) * sin(angleZ);
+
+					a31 = -sin(angleY);
+					a32 = sin(angleX) * cos(angleY);
+					a33 = cos(angleX) * cos(angleY);
 
-				P	= pShape->Get_Point(iPoint, iPart);
+					//transform
+					Q.x = (P.x * a11 + P.y * a12 + P.z * a13) * Scale.x;
+					Q.y = (P.x * a21 + P.y * a22 + P.z * a23) * Scale.y;
+					Q.z = (P.x * a31 + P.y * a32 + P.z * a33) * Scale.z;
 
-				P.x	+= Move.x - Anchor.x;
-				P.y	+= Move.y - Anchor.y;
+					//undo anchor shift and apply move
+					Q.x	+= Anchor.x + Move.x;
+					Q.y	+= Anchor.y + Move.y;
+					Q.z += Anchor.z + Move.z;
 
-				Q.x	= Anchor.x + Scale.x * (P.x * cos(Angle) - P.y * sin(Angle));
-				Q.y	= Anchor.y + Scale.y * (P.x * sin(Angle) + P.y * cos(Angle));
+					pShape->Set_Point(Q.x, Q.y, iPoint, iPart);
+					pShape->Set_Z(Q.z, iPoint, iPart);
 
-				pShape->Set_Point(Q, iPoint, iPart);
-			}//for
-		}//for
-	}//for
+					if( pIn->Get_Vertex_Type() == SG_VERTEX_TYPE_XYZM )
+					{
+						pShape->Set_M(pIn->Get_Shape(iShape)->Get_M(iPoint, iPart), iPoint, iPart);
+					}
+				}
+			}//for iPoint
+		}//for iPart
+	}//for iShape
 
 	//-----------------------------------------------------
 	if( bCopy )
diff --git a/src/modules/shapes/shapes_tools/TransformShapes.h b/src/modules/shapes/shapes_tools/TransformShapes.h
index 54a3822..8f82081 100644
--- a/src/modules/shapes/shapes_tools/TransformShapes.h
+++ b/src/modules/shapes/shapes_tools/TransformShapes.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: TransformShapes.h 2072 2014-03-31 08:50:43Z reklov_w $
+ * Version $Id: TransformShapes.h 2339 2014-11-17 16:15:58Z reklov_w $
  *********************************************************/
 /*******************************************************************************
     TransformShapes.h
@@ -33,6 +33,7 @@ public:
 
 protected:
 	virtual bool On_Execute(void);
+	virtual int	 On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
 
 private:
 
diff --git a/src/modules/shapes/shapes_transect/Makefile.in b/src/modules/shapes/shapes_transect/Makefile.in
index fb829e2..153e6f4 100644
--- a/src/modules/shapes/shapes_transect/Makefile.in
+++ b/src/modules/shapes/shapes_transect/Makefile.in
@@ -461,22 +461,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Polygon_Transect.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/simulation/sim_cellular_automata/Makefile.in b/src/modules/simulation/sim_cellular_automata/Makefile.in
index e5f5e11..e597247 100644
--- a/src/modules/simulation/sim_cellular_automata/Makefile.in
+++ b/src/modules/simulation/sim_cellular_automata/Makefile.in
@@ -465,22 +465,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Wator.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/simulation/sim_ecosystems_hugget/Makefile.in b/src/modules/simulation/sim_ecosystems_hugget/Makefile.in
index f391254..4a47739 100644
--- a/src/modules/simulation/sim_ecosystems_hugget/Makefile.in
+++ b/src/modules/simulation/sim_ecosystems_hugget/Makefile.in
@@ -468,22 +468,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MLB_Interface.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/simulation/sim_erosion/MLB_Interface.cpp b/src/modules/simulation/sim_erosion/MLB_Interface.cpp
index 59a2521..d8c0683 100644
--- a/src/modules/simulation/sim_erosion/MLB_Interface.cpp
+++ b/src/modules/simulation/sim_erosion/MLB_Interface.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: MLB_Interface.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: MLB_Interface.cpp 2454 2015-03-22 15:48:12Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -75,8 +75,8 @@ CSG_String Get_Info(int i)
 	case MLB_INFO_Name:	default:
 		return(_TL("Erosion"));
 
-	case MLB_INFO_Category:
-		return( _TL("Simulation") );
+	case MLB_INFO_Category:
+		return( _TL("Simulation") );
 
 	case MLB_INFO_Author:
 		return(_TL("V. Wichmann, M. Setiawan (c) 2009-2012"));
diff --git a/src/modules/simulation/sim_erosion/MLB_Interface.h b/src/modules/simulation/sim_erosion/MLB_Interface.h
index 75eb3e0..918ebb7 100644
--- a/src/modules/simulation/sim_erosion/MLB_Interface.h
+++ b/src/modules/simulation/sim_erosion/MLB_Interface.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: MLB_Interface.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: MLB_Interface.h 2454 2015-03-22 15:48:12Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
diff --git a/src/modules/simulation/sim_erosion/MMF_SAGA.cpp b/src/modules/simulation/sim_erosion/MMF_SAGA.cpp
index 103c811..303598f 100644
--- a/src/modules/simulation/sim_erosion/MMF_SAGA.cpp
+++ b/src/modules/simulation/sim_erosion/MMF_SAGA.cpp
@@ -1,4 +1,7 @@
-
+/**********************************************************
+ * Version $Id: MMF_SAGA.cpp 2455 2015-03-22 15:54:14Z reklov_w $
+ *********************************************************/
+ 
 ///////////////////////////////////////////////////////////
 //                                                       //
 //                         SAGA                          //
@@ -74,7 +77,7 @@ CMMF_SAGA::CMMF_SAGA(void)
 	Set_Name	(_TL("MMF-SAGA Soil Erosion Model"));
 
 	Set_Author	(SG_T("(c) 2009-2012 V. Wichmann, M. Setiawan"));
-	
+
 	Set_Description(_TW("Soil erosion modelling with a modified MMF (Morgan-Morgan-Finney) model "
 						"(Morgan & Duzant 2008).<br/>"
 						"This module is called MMF-SAGA because some things have been implemented differently "
@@ -106,106 +109,107 @@ CMMF_SAGA::CMMF_SAGA(void)
 
 	// comments on equation numbers refer to Morgan & Duzant (2008)
 
-	
+
 	//pNodeTerrain = Parameters.Add_Node(NULL, "TERRAIN", _TL("Terrain"), _TL("Terrain parameters"));
 	Parameters.Add_Grid(
-		NULL, "DTM", _TL("Digital Terrain Model"), 
-		_TL("DTM, digital terrain model [m]"), 
+		NULL, "DTM", _TL("Digital Terrain Model"),
+		_TL("DTM, digital terrain model [m]"),
 		PARAMETER_INPUT
 	);
 	Parameters.Add_Grid(
-		NULL, "S", _TL("Slope"), 
-		_TL("S, slope [rad]"), 
+		NULL, "S", _TL("Slope"),
+		_TL("S, slope [rad]"),
 		PARAMETER_INPUT
 	);
     Parameters.Add_Grid(
-		NULL, "CHANNEL", _TL("Channel Network"), 
-		_TL("Channel network, all other cells NoData"), 
+		NULL, "CHANNEL", _TL("Channel Network"),
+		_TL("Channel network, all other cells NoData"),
 		PARAMETER_INPUT_OPTIONAL
 	);
 
 	//pNodeVegetation = Parameters.Add_Node(NULL, "VEGETATION", _TL("Vegetation"), _TL("Vegetation parameters"));
-	Parameters.Add_Grid(	
-		NULL, "PI", _TL("Permament Interception"), 
-		_TL("PI, permanent interception expressed as the proportion [between 0-1] of rainfall"), 
+	Parameters.Add_Grid(
+		NULL, "PI", _TL("Permament Interception"),
+		_TL("PI, permanent interception expressed as the proportion [between 0-1] of rainfall"),
 		PARAMETER_INPUT
 	);
-	Parameters.Add_Grid(	
-		NULL, "CC", _TL("Canopy Cover"), 
-		_TL("CC, canopy cover expressed as a portion [between 0-1] of the soil surface protected by vegetation or crop"), 
+	Parameters.Add_Grid(
+		NULL, "CC", _TL("Canopy Cover"),
+		_TL("CC, canopy cover expressed as a portion [between 0-1] of the soil surface protected by vegetation or crop"),
 		PARAMETER_INPUT
 	);
-	Parameters.Add_Grid(	
-		NULL, "PH", _TL("Plant Height"), 
-		_TL("PH, plant height [m], representing the effective height from which raindrops fall from the crop or vegetation"), 
+	Parameters.Add_Grid(
+		NULL, "PH", _TL("Plant Height"),
+		_TL("PH, plant height [m], representing the effective height from which raindrops fall from the crop or vegetation"),
 		PARAMETER_INPUT
 	);
-	Parameters.Add_Grid(	
-		NULL, "EtEo", _TL("Ratio Evapotranspiration"), 
-		_TL("Et/Eo, ratio of actual to potential evapotranspiration"), 
+	Parameters.Add_Grid(
+		NULL, "EtEo", _TL("Ratio Evapotranspiration"),
+		_TL("Et/Eo, ratio of actual to potential evapotranspiration"),
 		PARAMETER_INPUT
 	);
-	Parameters.Add_Grid(	
-		NULL, "GC", _TL("Ground cover"), 
-		_TL("GC, Ground cover expressed as a portion [between 0-1] of the soil surface protected by vegetation or crop cover on the ground"), 
+	Parameters.Add_Grid(
+		NULL, "GC", _TL("Ground cover"),
+		_TL("GC, Ground cover expressed as a portion [between 0-1] of the soil surface protected by vegetation or crop cover on the ground"),
 		PARAMETER_INPUT
 	);
-	Parameters.Add_Grid(	
-		NULL, "D", _TL("Diameter plant elements"), 
-		_TL("D, Average diameter [m] of the individual plants elements (stem, leaves) at the ground surface"), 
+	Parameters.Add_Grid(
+		NULL, "D", _TL("Diameter plant elements"),
+		_TL("D, Average diameter [m] of the individual plants elements (stem, leaves) at the ground surface"),
 		PARAMETER_INPUT
 	);
-	Parameters.Add_Grid(	
-		NULL, "NV", _TL("Number plant elements"), 
-		_TL("NV, Number of plant elements per unit area [number/unit area] at the ground surface"), 
+	Parameters.Add_Grid(
+		NULL, "NV", _TL("Number plant elements"),
+		_TL("NV, Number of plant elements per unit area [number/unit area] at the ground surface"),
 		PARAMETER_INPUT
 	);
 
 	//pNodeSoil = Parameters.Add_Node(NULL, "SOIL", _TL("Soil"), _TL("Soil parameters"));
-	Parameters.Add_Grid(	
-		NULL, "MS", _TL("Soil moisture (at FC)"), 
-		_TL("MS, Soil moisture at field capacity [% w/w]"), 
+	Parameters.Add_Grid(
+		NULL, "MS", _TL("Soil moisture (at FC)"),
+		_TL("MS, Soil moisture at field capacity [% w/w]"),
 		PARAMETER_INPUT
 	);
-	Parameters.Add_Grid(	
-		NULL, "BD", _TL("Bulk density top layer"), 
-		_TL("BD, Bulk density of the top layer [Mg/m3]"), 
+	Parameters.Add_Grid(
+		NULL, "BD", _TL("Bulk density top layer"),
+		_TL("BD, Bulk density of the top layer [Mg/m3]"),
 		PARAMETER_INPUT
 	);
-	Parameters.Add_Grid(	
-		NULL, "EHD", _TL("Effective hydrological depth"), 
-		_TL("EHD, Effective hydrological depth of the soil [m]"), 
+	Parameters.Add_Grid(
+		NULL, "EHD", _TL("Effective hydrological depth"),
+		_TL("EHD, Effective hydrological depth of the soil [m]"),
 		PARAMETER_INPUT
 	);
-	Parameters.Add_Grid(	
-		NULL, "LP", _TL("Sat. lateral permeability"), 
-		_TL("LP, Saturated lateral permeability of the soil [m/day]"), 
+	Parameters.Add_Grid(
+		NULL, "LP", _TL("Sat. lateral permeability"),
+		_TL("LP, Saturated lateral permeability of the soil [m/day]"),
 		PARAMETER_INPUT
 	);
-	Parameters.Add_Grid(	
-		NULL, "PER_C", _TL("Percentage clays"), 
-		_TL("c, Percentage clays [%]"), 
+	Parameters.Add_Grid(
+		NULL, "PER_C", _TL("Percentage clays"),
+		_TL("c, Percentage clays [%]"),
 		PARAMETER_INPUT
 	);
-	Parameters.Add_Grid(	
-		NULL, "PER_Z", _TL("Percentage silt"), 
-		_TL("z, Percentage silt [%]"), 
+	Parameters.Add_Grid(
+		NULL, "PER_Z", _TL("Percentage silt"),
+		_TL("z, Percentage silt [%]"),
 		PARAMETER_INPUT
 	);
-	Parameters.Add_Grid(	
-		NULL, "PER_S", _TL("Percentage sand"), 
-		_TL("s, Percentage sand [%]"), 
+	Parameters.Add_Grid(
+		NULL, "PER_S", _TL("Percentage sand"),
+		_TL("s, Percentage sand [%]"),
 		PARAMETER_INPUT
 	);
-	Parameters.Add_Grid(	
-		NULL, "ST", _TL("Percentage rock fragments"), 
-		_TL("ST, Percentage rock fragments on the soil surface [%]"), 
+	Parameters.Add_Grid(
+		NULL, "ST", _TL("Percentage rock fragments"),
+		_TL("ST, Percentage rock fragments on the soil surface [%]"),
 		PARAMETER_INPUT
 	);
-	Parameters.Add_Grid(	
-		NULL, "RFR", _TL("Surface roughness"), 
-		_TL("RFR, Surface roughness [cm/m]"), 
-		PARAMETER_INPUT
+	Parameters.Add_Grid(
+		NULL, "RFR", _TL("Surface roughness"),
+		_TW("RFR, Surface roughness [cm/m]. In case the surface roughness is not provided as input, v_flow_t is "
+			"set to 1.0, i.e. natural soil surface roughness is not accounted for."),
+		PARAMETER_INPUT_OPTIONAL
 	);
 
 	Parameters.Add_Table(
@@ -213,9 +217,9 @@ CMMF_SAGA::CMMF_SAGA(void)
 		_TL("Meteorological data for multiple timestep modelling [model step (day); temperature (Celsius); rainfall (mm), rainfall intensity (mm/h); rainfall duration (day); timespan (days)]"),
 		PARAMETER_INPUT_OPTIONAL
 	);
-	Parameters.Add_FilePath( 
-		Parameters("TAB_METEO"), "OUT_PATH", _TL("Output file path"), 
-		_TL("Full path to the directory for the output grids of each model step"), 
+	Parameters.Add_FilePath(
+		Parameters("TAB_METEO"), "OUT_PATH", _TL("Output file path"),
+		_TL("Full path to the directory for the output grids of each model step"),
 		SG_T("\0*.*\0\0*.*\0"), _TL(""), true, true
 	);
 
@@ -226,41 +230,41 @@ CMMF_SAGA::CMMF_SAGA(void)
 		PARAMETER_TYPE_Bool, true
 	);
 
-	Parameters.Add_Value( 
-		Parameters("INTERFLOW"), "T", _TL("Mean temperature"), 
-		_TL("T, mean temperature [degree C]"), 
-		PARAMETER_TYPE_Double, 
+	Parameters.Add_Value(
+		Parameters("INTERFLOW"), "T", _TL("Mean temperature"),
+		_TL("T, mean temperature [degree C]"),
+		PARAMETER_TYPE_Double,
 		18.0
 	);
 
-	Parameters.Add_Value( 
-		Parameters("INTERFLOW"), "TIMESPAN", _TL("Timespan (days)"), 
-		_TL("The number of days to model."), 
+	Parameters.Add_Value(
+		Parameters("INTERFLOW"), "TIMESPAN", _TL("Timespan (days)"),
+		_TL("The number of days to model."),
 		PARAMETER_TYPE_Int, 30.0,
         1.0, true, 365, true
 	);
 
-	Parameters.Add_Grid(	
-		Parameters("INTERFLOW"), "IF", _TL("Interflow"), 
-		_TL("IF"), 
+	Parameters.Add_Grid(
+		Parameters("INTERFLOW"), "IF", _TL("Interflow"),
+		_TL("IF"),
 		PARAMETER_OUTPUT_OPTIONAL
 	);
-	Parameters.Add_Value( 
-		NULL, "R", _TL("Rainfall"), 
-		_TL("R, height of precipitation in timespan [mm]"), 
-		PARAMETER_TYPE_Double, 
+	Parameters.Add_Value(
+		NULL, "R", _TL("Rainfall"),
+		_TL("R, height of precipitation in timespan [mm]"),
+		PARAMETER_TYPE_Double,
 		200.0
 	);
-	Parameters.Add_Value( 
-		NULL, "I", _TL("Rainfall intensity"), 
-		_TL("I, rainfall intensity [mm/h]"), 
-		PARAMETER_TYPE_Double, 
+	Parameters.Add_Value(
+		NULL, "I", _TL("Rainfall intensity"),
+		_TL("I, rainfall intensity [mm/h]"),
+		PARAMETER_TYPE_Double,
 		20.0
 	);
-	Parameters.Add_Value( 
-		NULL, "Rn", _TL("Rainfall Duration"), 
-		_TL("Rn, number of rain days in timespan [-]"), 
-		PARAMETER_TYPE_Double, 
+	Parameters.Add_Value(
+		NULL, "Rn", _TL("Rainfall Duration"),
+		_TL("Rn, number of rain days in timespan [-]"),
+		PARAMETER_TYPE_Double,
 		20.0
 	);
 
@@ -277,9 +281,9 @@ CMMF_SAGA::CMMF_SAGA(void)
 	);
 
     //pNodeOptions = Parameters.Add_Node(NULL, "OPTIONS", _TL("Model Options"), _TL("Model parameters"));
-    Parameters.Add_Value( 
-		NULL, "FLOWD_VA", _TL("Flow Depth (actual flow velocity)"), 
-		_TL("The flow depth used to calculate the actual flow velocity [m] (e.g. 0.005 unchannelled flow, 0.01 shallow rills, 0.25 deeper rills."), 
+    Parameters.Add_Value(
+		NULL, "FLOWD_VA", _TL("Flow Depth (actual flow velocity)"),
+		_TL("The flow depth used to calculate the actual flow velocity [m] (e.g. 0.005 unchannelled flow, 0.01 shallow rills, 0.25 deeper rills."),
 		PARAMETER_TYPE_Double, 0.005,
         0.00000001, true
 	);
@@ -291,96 +295,96 @@ CMMF_SAGA::CMMF_SAGA(void)
 
 
 	//pNodeOutput = Parameters.Add_Node(NULL, "OUTPUT", _TL("Output"), _TL("Output parameters"));
-	Parameters.Add_Grid(	
-		NULL, "Q", _TL("Mean runoff"), 
-		_TL("Q, estimation of mean runoff [mm]"), 
+	Parameters.Add_Grid(
+		NULL, "Q", _TL("Mean runoff"),
+		_TL("Q, estimation of mean runoff [mm]"),
 		PARAMETER_OUTPUT
 	);
-	Parameters.Add_Grid(	
-		NULL, "SL", _TL("Mean soil loss"), 
-		_TL("SL, estimation of mean soil loss [kg]"), 
+	Parameters.Add_Grid(
+		NULL, "SL", _TL("Mean soil loss"),
+		_TL("SL, estimation of mean soil loss [kg]"),
 		PARAMETER_OUTPUT
 	);
 
 	#ifdef _TMP_OUT			// define this preprocessor variable to get intermediate grids as output
-		Parameters.Add_Grid(	
-			NULL, "Rf", _TL("Effective Rainfall"), 
-			_TL("Rf"), 
+		Parameters.Add_Grid(
+			NULL, "Rf", _TL("Effective Rainfall"),
+			_TL("Rf"),
 			PARAMETER_OUTPUT
 		);
-		Parameters.Add_Grid(	
-			NULL, "KE", _TL("Total Kinetic Energy"), 
-			_TL("KE"), 
+		Parameters.Add_Grid(
+			NULL, "KE", _TL("Total Kinetic Energy"),
+			_TL("KE"),
 			PARAMETER_OUTPUT
 		);
-		Parameters.Add_Grid(	
-				NULL, "Rc", _TL("Soil moisture storage capacity"), 
-				_TL("Rc"), 
+		Parameters.Add_Grid(
+				NULL, "Rc", _TL("Soil moisture storage capacity"),
+				_TL("Rc"),
 				PARAMETER_OUTPUT
 			);
-		Parameters.Add_Grid(	
-			NULL, "TCc", _TL("Transport Capacity Clay"), 
-			_TL("TCc"), 
+		Parameters.Add_Grid(
+			NULL, "TCc", _TL("Transport Capacity Clay"),
+			_TL("TCc"),
 			PARAMETER_OUTPUT
 		);
-		Parameters.Add_Grid(	
-			NULL, "TCz", _TL("Transport Capacity Silt"), 
-			_TL("TCz"), 
+		Parameters.Add_Grid(
+			NULL, "TCz", _TL("Transport Capacity Silt"),
+			_TL("TCz"),
 			PARAMETER_OUTPUT
 		);
-		Parameters.Add_Grid(	
-			NULL, "TCs", _TL("Transport Capacity Sand"), 
-			_TL("SLs"), 
+		Parameters.Add_Grid(
+			NULL, "TCs", _TL("Transport Capacity Sand"),
+			_TL("SLs"),
 			PARAMETER_OUTPUT
 		);
-		Parameters.Add_Grid(	
-			NULL, "Gc", _TL("Available Clay"), 
-			_TL("Gc"), 
+		Parameters.Add_Grid(
+			NULL, "Gc", _TL("Available Clay"),
+			_TL("Gc"),
 			PARAMETER_OUTPUT
 		);
-		Parameters.Add_Grid(	
-			NULL, "Gz", _TL("Available Silt"), 
-			_TL("Gz"), 
+		Parameters.Add_Grid(
+			NULL, "Gz", _TL("Available Silt"),
+			_TL("Gz"),
 			PARAMETER_OUTPUT
 		);
-		Parameters.Add_Grid(	
-			NULL, "Gs", _TL("Available Sand"), 
-			_TL("Gs"), 
+		Parameters.Add_Grid(
+			NULL, "Gs", _TL("Available Sand"),
+			_TL("Gs"),
 			PARAMETER_OUTPUT
 		);
-		Parameters.Add_Grid(	
-			NULL, "SLc", _TL("Sediment Balance Clay"), 
-			_TL("SLc"), 
+		Parameters.Add_Grid(
+			NULL, "SLc", _TL("Sediment Balance Clay"),
+			_TL("SLc"),
 			PARAMETER_OUTPUT
 		);
-		Parameters.Add_Grid(	
-			NULL, "SLz", _TL("Sediment Balance Silt"), 
-			_TL("SLz"), 
+		Parameters.Add_Grid(
+			NULL, "SLz", _TL("Sediment Balance Silt"),
+			_TL("SLz"),
 			PARAMETER_OUTPUT
 		);
-		Parameters.Add_Grid(	
-			NULL, "SLs", _TL("Sediment Balance Sand"), 
-			_TL("SLs"), 
+		Parameters.Add_Grid(
+			NULL, "SLs", _TL("Sediment Balance Sand"),
+			_TL("SLs"),
 			PARAMETER_OUTPUT
 		);
-		Parameters.Add_Grid(	
-			NULL, "TCONDc", _TL("Transport Condition Clay"), 
-			CSG_String::Format(_TL("Sediment Limited [%d], Transport Limited (SL = TC) [%d], Transport Limited (SL = G) [%d]"), TCOND_SED_LIMITED, TCOND_TRANS_LIMITED_TC, TCONF_TRANS_LIMITED_G), 
+		Parameters.Add_Grid(
+			NULL, "TCONDc", _TL("Transport Condition Clay"),
+			CSG_String::Format(_TL("Sediment Limited [%d], Transport Limited (SL = TC) [%d], Transport Limited (SL = G) [%d]"), TCOND_SED_LIMITED, TCOND_TRANS_LIMITED_TC, TCONF_TRANS_LIMITED_G),
 			PARAMETER_OUTPUT, true, SG_DATATYPE_Int
 		);
-		Parameters.Add_Grid(	
-			NULL, "TCONDz", _TL("Transport Condition Silt"), 
-			CSG_String::Format(_TL("Sediment Limited [%d], Transport Limited (SL = TC) [%d], Transport Limited (SL = G) [%d]"), TCOND_SED_LIMITED, TCOND_TRANS_LIMITED_TC, TCONF_TRANS_LIMITED_G), 
+		Parameters.Add_Grid(
+			NULL, "TCONDz", _TL("Transport Condition Silt"),
+			CSG_String::Format(_TL("Sediment Limited [%d], Transport Limited (SL = TC) [%d], Transport Limited (SL = G) [%d]"), TCOND_SED_LIMITED, TCOND_TRANS_LIMITED_TC, TCONF_TRANS_LIMITED_G),
 			PARAMETER_OUTPUT, true, SG_DATATYPE_Int
 		);
-		Parameters.Add_Grid(	
-			NULL, "TCONDs", _TL("Transport Condition Sand"), 
-			CSG_String::Format(_TL("Sediment Limited [%d], Transport Limited (SL = TC) [%d], Transport Limited (SL = G) [%d]"), TCOND_SED_LIMITED, TCOND_TRANS_LIMITED_TC, TCONF_TRANS_LIMITED_G), 
+		Parameters.Add_Grid(
+			NULL, "TCONDs", _TL("Transport Condition Sand"),
+			CSG_String::Format(_TL("Sediment Limited [%d], Transport Limited (SL = TC) [%d], Transport Limited (SL = G) [%d]"), TCOND_SED_LIMITED, TCOND_TRANS_LIMITED_TC, TCONF_TRANS_LIMITED_G),
 			PARAMETER_OUTPUT, true, SG_DATATYPE_Int
 		);
-		Parameters.Add_Grid(	
-			NULL, "W_up", _TL("Upslope Flow Width"), 
-			_TL("W_up"), 
+		Parameters.Add_Grid(
+			NULL, "W_up", _TL("Upslope Flow Width"),
+			_TL("W_up"),
 			PARAMETER_OUTPUT
 		);
 	#endif
@@ -423,7 +427,7 @@ bool CMMF_SAGA::On_Execute(void)
 	// input parameters
 	double		R, I, Rn;
 	int			KE_I_method;
-	
+
 	// temporary variables
 	double		    LD, DT, KE_DT, KE_LD, L, Q, Ro;
 	double		    per_c, per_z, per_s, ST, KE, GC, sin_S;
@@ -498,7 +502,7 @@ bool CMMF_SAGA::On_Execute(void)
 	pD			= Parameters("D")->asGrid();
 	pNV			= Parameters("NV")->asGrid();
 	pRFR		= Parameters("RFR")->asGrid();
-	
+
 	pMeteoTab	= Parameters("TAB_METEO")->asTable();
 	sOutPath	= Parameters("OUT_PATH")->asString();
 
@@ -559,7 +563,7 @@ bool CMMF_SAGA::On_Execute(void)
 					InvalidGrid = SG_T("D");
 				if (pNV->is_NoData(x, y))
 					InvalidGrid = SG_T("NV");
-				if (pRFR->is_NoData(x, y))
+				if (pRFR != NULL && pRFR->is_NoData(x, y))
 					InvalidGrid = SG_T("RFR");
 
 				if (InvalidGrid.Length() > 0)
@@ -571,8 +575,8 @@ bool CMMF_SAGA::On_Execute(void)
 			}
 		}
 	}
-	
-	#ifdef _TMP_OUT								
+
+	#ifdef _TMP_OUT
 		pRf		= Parameters("Rf")->asGrid();
 		pKE		= Parameters("KE")->asGrid();
 		pRc		= Parameters("Rc")->asGrid();
@@ -675,7 +679,7 @@ bool CMMF_SAGA::On_Execute(void)
 					pRf->Set_Value(x, y, (R * (1-pPI->asDouble(x, y))) / cos(pS->asDouble(x, y)));	// Equ. (1)
 					LD = pRf->asDouble(x, y) * pCC->asDouble(x, y);									// Equ. (2)
 					DT = pRf->asDouble(x, y) - LD;													// Equ. (3)
-				
+
 					switch (KE_I_method)		// Equ. (4), see Table 2 in Morgan (2001)
 					{
 					case MMF_KE_I_WISCHMEIER_SMITH_1978:
@@ -696,7 +700,7 @@ bool CMMF_SAGA::On_Execute(void)
 					case MMF_KE_I_MCISAAC_1990:
 						KE_DT = DT * (26.8 * (1 - 0.29 * exp(-0.049 * I))); break;
 					}
-				
+
 					if (pPH->asDouble(x, y) < 0.15)
 						KE_LD = 0.0;																// Equ. (5)
 					else
@@ -717,7 +721,7 @@ bool CMMF_SAGA::On_Execute(void)
 
 		if (bInterflow)
 		{
-			Z		= 300 + (25 * T) + (0.05 * T * T * T);		// Equ. (12)
+			Z		= 300 + (25 * T) + (0.05 * T * T * T);		// Equ. (12), wrong in Morgan and Duzant (2008) -> original annual Turc equation uses T^3, not T^2
 			Rmod	= R * (365/timespan);						// scale up from timespan to annual values
 			E		= Rmod / sqrt(0.9 + (Rmod*Rmod)/(Z*Z));		// Equ. (11)
 			E		= E / (365/timespan);                       // calculate E for timespan
@@ -726,7 +730,7 @@ bool CMMF_SAGA::On_Execute(void)
 		Ro	= R / Rn;											// Equ. (9) mean rain per rain day
 
 
-		for (sLong n=0; n<Get_NCells() && Set_Progress(n); n++)
+		for (sLong n=0; n<Get_NCells() && Set_Progress_NCells(n); n++)
 		{
 			pDTM->Get_Sorted(n, x, y, true, false);
 
@@ -756,9 +760,9 @@ bool CMMF_SAGA::On_Execute(void)
 					Q = pRf->asDouble(x, y) + pQ->asDouble(x, y);
 				else
 					Q = (pRf->asDouble(x, y) + pQ->asDouble(x, y)) * exp((-1.0 * pRc->asDouble(x, y)) / Ro) * pow(L/10,0.1);		// Equ. (9)
-            
+
 				//double Qe = pRf->asDouble(x, y) * exp((-1.0 * pRc->asDouble(x, y)) / Ro);
-			
+
 				if (bInterflow)
 				{
 					IF = ((R - E - Q) * pLP->asDouble(x, y) * sin(pS->asDouble(x, y))) / timespan;		// Equ. (13)
@@ -790,8 +794,8 @@ bool CMMF_SAGA::On_Execute(void)
 				{
 					for (int i=0; i<8; i++)
 					{
-						ix	= Get_xTo(i, x);			
-						iy	= Get_yTo(i, y);			
+						ix	= Get_xTo(i, x);
+						iy	= Get_yTo(i, y);
 
 						if( pDTM->is_InGrid(ix, iy) )
 						{
@@ -822,7 +826,7 @@ bool CMMF_SAGA::On_Execute(void)
 						}
 					}
 				}
-			
+
 				// flow routing
 				//-----------------------------------------------------
 				if (dzSum > 0.0)
@@ -834,7 +838,7 @@ bool CMMF_SAGA::On_Execute(void)
 							ix	= Get_xTo(steepestN, x);
 							iy	= Get_yTo(steepestN, y);
 
-							pQ->Add_Value(ix, iy, Q);								// distribute				
+							pQ->Add_Value(ix, iy, Q);								// distribute
 							pW_up->Add_Value(ix, iy, Get_Length(steepestN));		// upslope CL of ix,iy
 							W_down = Get_Length(steepestN);							// downslope CL of x,y
 							if (bInterflow)
@@ -898,16 +902,16 @@ bool CMMF_SAGA::On_Execute(void)
 					// ... for standard bare soil
 					n_manning = 0.015;
 					d_flow = 0.005;
-	
+
 					slopeFract = tan(pS->asDouble(x, y));
 					if (slopeFract == 0.0)
 						slopeFract = 0.001;	// workaround for velocity calculations, otherwise v_flow and thus TC may become NaN!
 
 					v_flow_b = 1.0 / n_manning * pow(d_flow, 0.67) * pow(slopeFract, 0.5);	// Equ. (22)
-				
+
 					// ... actual flow velocity
 					n_manning = 0.015;
-					// if ....		     // global method							
+					// if ....		     // global method
 					//d_flow = 0.005;	// unchannelled flow
 					//d_flow = 0.01;	// shallow rills
 					//d_flow = 0.25;	// deeper rills
@@ -922,10 +926,16 @@ bool CMMF_SAGA::On_Execute(void)
 
 					// ... for the effect of tillage
 					d_flow = 0.005;
-					//n_manning = pow(M_EULER, log(-2.1132 + 0.0349 * pRFR->asDouble(x, y)));	// Equ. (27)
-					n_manning = pow(M_EULER, -2.1132 + 0.0349 * pRFR->asDouble(x, y));	// Equ. (27)
-					v_flow_t = 1.0 / n_manning * pow(d_flow, 0.67) * pow(slopeFract, 0.5);
-					// v_flow_t = 1.0 if not under arable cultivation and natural soil surface roughness is not accounted for
+
+					if (pRFR != NULL)
+					{
+						n_manning = pow(M_EULER, -2.1132 + 0.0349 * pRFR->asDouble(x, y));	// Equ. (27)
+						v_flow_t = 1.0 / n_manning * pow(d_flow, 0.67) * pow(slopeFract, 0.5);
+					}
+					else
+					{
+						v_flow_t = 1.0; // if not under arable cultivation and natural soil surface roughness is not accounted for
+					}
 
 					// particle fall number
 					//d_flow = 0.005;
@@ -962,7 +972,7 @@ bool CMMF_SAGA::On_Execute(void)
 
 					if (pW_up->asDouble(x, y) == 0)
 						W_up = W_down;
-				
+
 
 					Gc	= (Fc + Hc) * (1.0 - DEPc / 100.0) + (pSLc->asDouble(x, y) * W_up/W_down);	// Equ. (35)
 					Gz	= (Fz + Hz) * (1.0 - DEPz / 100.0) + (pSLz->asDouble(x, y) * W_up/W_down);	// Equ. (36)
@@ -1090,7 +1100,7 @@ bool CMMF_SAGA::On_Execute(void)
 						if (pChannel != NULL && !pChannel->is_NoData(x, y) && bChannelT)		// Transport along channel, ignore (new) sediment balance within channel
 						{
 							if (steepestN != -1)
-							{					
+							{
 								ix	= Get_xTo(steepestN, x);
 								iy	= Get_yTo(steepestN, y);
 
diff --git a/src/modules/simulation/sim_erosion/MMF_SAGA.h b/src/modules/simulation/sim_erosion/MMF_SAGA.h
index 79dafdd..fcd2cdd 100644
--- a/src/modules/simulation/sim_erosion/MMF_SAGA.h
+++ b/src/modules/simulation/sim_erosion/MMF_SAGA.h
@@ -1,4 +1,7 @@
-
+/**********************************************************
+ * Version $Id: MMF_SAGA.h 2455 2015-03-22 15:54:14Z reklov_w $
+ *********************************************************/
+ 
 ///////////////////////////////////////////////////////////
 //                                                       //
 //                         SAGA                          //
diff --git a/src/modules/simulation/sim_erosion/Makefile.in b/src/modules/simulation/sim_erosion/Makefile.in
index 7baa6c9..cea577d 100644
--- a/src/modules/simulation/sim_erosion/Makefile.in
+++ b/src/modules/simulation/sim_erosion/Makefile.in
@@ -460,22 +460,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MMF_SAGA.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/simulation/sim_hydrology/MLB_Interface.cpp b/src/modules/simulation/sim_hydrology/MLB_Interface.cpp
index b2137ea..74f514a 100644
--- a/src/modules/simulation/sim_hydrology/MLB_Interface.cpp
+++ b/src/modules/simulation/sim_hydrology/MLB_Interface.cpp
@@ -101,43 +101,25 @@ CSG_String Get_Info(int i)
 #include "KinWav_D8.h"
 #include "topmodel.h"
 #include "WaterRetentionCapacity.h"
+#include "diffuse_pollution_risk.h"
+
 
 //---------------------------------------------------------
 // 4. Allow your modules to be created here...
 
 CSG_Module *		Create_Module(int i)
 {
-	// Don't forget to continuously enumerate the case switches
-	// when adding new modules! Also bear in mind that the
-	// enumeration always has to start with [case 0:] and
-	// that [default:] must return NULL!...
-
-	CSG_Module	*pModule;
-
 	switch( i )
 	{
-	case 0:
-		pModule	= new CDVWK_SoilMoisture;
-		break;
-
-	case 1:
-		pModule	= new CKinWav_D8;
-		break;
-
-	case 2:
-		pModule	= new CTOPMODEL;
-		break;
-	
-	case 3:
-		pModule = new CWaterRetentionCapacity;
-		break;
-
-	default:
-		pModule	= NULL;
-		break;
+	case  0:	return( new CDVWK_SoilMoisture );
+	case  1:	return( new CKinWav_D8 );
+	case  2:	return( new CTOPMODEL );
+	case  3:	return( new CWaterRetentionCapacity );
+	case  4:	return( new CDiffuse_Pollution_Risk );
+
+	case  5:	return( NULL );
+	default:	return( MLB_INTERFACE_SKIP_MODULE );
 	}
-
-	return( pModule );
 }
 
 
diff --git a/src/modules/simulation/sim_hydrology/Makefile.am b/src/modules/simulation/sim_hydrology/Makefile.am
index f254ec1..91fbed5 100644
--- a/src/modules/simulation/sim_hydrology/Makefile.am
+++ b/src/modules/simulation/sim_hydrology/Makefile.am
@@ -14,12 +14,14 @@ AM_LDFLAGS         = -fPIC -shared -avoid-version
 pkglib_LTLIBRARIES = libsim_hydrology.la
 libsim_hydrology_la_SOURCES =\
 DVWK_SoilMoisture.cpp\
+diffuse_pollution_risk.cpp\
 idw.cpp\
 KinWav_D8.cpp\
 MLB_Interface.cpp\
 topmodel.cpp\
 topmodel_values.cpp\
 WaterRetentionCapacity.cpp\
+diffuse_pollution_risk.h\
 DVWK_SoilMoisture.h\
 idw.h\
 KinWav_D8.h\
diff --git a/src/modules/simulation/sim_hydrology/Makefile.in b/src/modules/simulation/sim_hydrology/Makefile.in
index 815a920..2dc5e76 100644
--- a/src/modules/simulation/sim_hydrology/Makefile.in
+++ b/src/modules/simulation/sim_hydrology/Makefile.in
@@ -127,9 +127,9 @@ am__installdirs = "$(DESTDIR)$(pkglibdir)"
 LTLIBRARIES = $(pkglib_LTLIBRARIES)
 libsim_hydrology_la_DEPENDENCIES =  \
 	$(top_srcdir)/src/saga_core/saga_api/libsaga_api.la
-am_libsim_hydrology_la_OBJECTS = DVWK_SoilMoisture.lo idw.lo \
-	KinWav_D8.lo MLB_Interface.lo topmodel.lo topmodel_values.lo \
-	WaterRetentionCapacity.lo
+am_libsim_hydrology_la_OBJECTS = DVWK_SoilMoisture.lo \
+	diffuse_pollution_risk.lo idw.lo KinWav_D8.lo MLB_Interface.lo \
+	topmodel.lo topmodel_values.lo WaterRetentionCapacity.lo
 libsim_hydrology_la_OBJECTS = $(am_libsim_hydrology_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
@@ -374,12 +374,14 @@ AM_LDFLAGS = -fPIC -shared -avoid-version
 pkglib_LTLIBRARIES = libsim_hydrology.la
 libsim_hydrology_la_SOURCES = \
 DVWK_SoilMoisture.cpp\
+diffuse_pollution_risk.cpp\
 idw.cpp\
 KinWav_D8.cpp\
 MLB_Interface.cpp\
 topmodel.cpp\
 topmodel_values.cpp\
 WaterRetentionCapacity.cpp\
+diffuse_pollution_risk.h\
 DVWK_SoilMoisture.h\
 idw.h\
 KinWav_D8.h\
@@ -472,27 +474,31 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/KinWav_D8.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MLB_Interface.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/WaterRetentionCapacity.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/diffuse_pollution_risk.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/idw.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/topmodel.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/topmodel_values.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/simulation/sim_hydrology/diffuse_pollution_risk.cpp b/src/modules/simulation/sim_hydrology/diffuse_pollution_risk.cpp
new file mode 100644
index 0000000..d7c0c54
--- /dev/null
+++ b/src/modules/simulation/sim_hydrology/diffuse_pollution_risk.cpp
@@ -0,0 +1,495 @@
+/**********************************************************
+ * Version $Id: diffuse_pollution_risk.cpp 911 2011-11-11 11:11:11Z oconrad $
+ *********************************************************/
+
+///////////////////////////////////////////////////////////
+//                                                       //
+//                         SAGA                          //
+//                                                       //
+//      System for Automated Geoscientific Analyses      //
+//                                                       //
+//                    Module Library:                    //
+//                     sim_hydrology                     //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//               diffuse_pollution_risk.cpp              //
+//                                                       //
+//                 Copyright (C) 2015 by                 //
+//                     Cosima Berger                     //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+// This file is part of 'SAGA - System for Automated     //
+// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
+//                                                       //
+// SAGA is distributed in the hope that it will be       //
+// useful, but WITHOUT ANY WARRANTY; without even the    //
+// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
+// PARTICULAR PURPOSE. See the GNU General Public        //
+// License for more details.                             //
+//                                                       //
+// You should have received a copy of the GNU General    //
+// Public License along with this program; if not,       //
+// write to the Free Software Foundation, Inc.,          //
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307,   //
+// USA.                                                  //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//    e-mail:     oconrad at saga-gis.de                    //
+//                                                       //
+//    contact:    Cosima Berger                          //
+//                Institute of Geography                 //
+//                University of Hamburg                  //
+//                Germany                                //
+//                                                       //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#include "diffuse_pollution_risk.h"
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+CDiffuse_Pollution_Risk::CDiffuse_Pollution_Risk(void)
+{
+	//-----------------------------------------------------
+	Set_Name		(_TL("Diffuse Pollution Risk"));
+
+	Set_Author		("Cosima Berger, Olaf Conrad (c) 2014");
+
+	Set_Description	(_TW(
+		"Diffuse Pollution Risk Mapping.\n"
+		"This tool tries to reproduce in parts the methodology of the "
+		"<a target=\"_blank\" href=\"http://www.scimap.org.uk/\">SCIMAP - Diffuse Pollution Risk Mapping - Framework</a>.\n"
+		"\nReferences:\n"
+		"Lane, S.N.; Brookes, C.J.; Kirkby, M.J.; Holden, J. (2004): "
+		"A network-index-based version of TOPMODEL for use with high-resolution digital topographic data. "
+		"In: Hydrological processes. Vol. 18, S. 191-201.\n"
+		"\n"
+		"Milledge, D.G.; Lane, N.S.; Heathwait, A.L.; Reaney, S.M. (2012): "
+		"A monte carlo approach to the invers problem of diffuse pollution risk in agricultural catchments. "
+		"In: Science of the Total Environment. Vol. 433, S. 434-449.\n"
+	));
+
+	//-----------------------------------------------------
+	Parameters.Add_Grid(
+		NULL	, "DEM"				, _TL("Elevation"),
+		_TL(""),
+		PARAMETER_INPUT
+	);
+
+	Parameters.Add_Grid(
+		NULL	, "CHANNEL"			, _TL("Channel Network"),
+		_TL(""),
+		PARAMETER_INPUT_OPTIONAL
+	);
+
+	Parameters.Add_Grid_or_Const(
+		NULL	, "WEIGHT"			, _TL("Land Cover Weights"),
+		_TL(""),
+		1.0, 0.0, true
+	);
+
+	Parameters.Add_Grid_or_Const(
+		NULL	, "RAIN"			, _TL("Rainfall"),
+		_TL(""),
+		500.0, 0.0, true
+	);
+
+	Parameters.Add_Grid(
+		NULL	, "DELIVERY"		, _TL("Delivery Index"),
+		_TL(""),
+		PARAMETER_OUTPUT
+	);
+
+	Parameters.Add_Grid(
+		NULL	, "RISK_POINT"		, _TL("Locational Risk"),
+		_TL(""),
+		PARAMETER_OUTPUT
+	);
+
+	Parameters.Add_Grid(
+		NULL	, "RISK_DIFFUSE"	, _TL("Diffuse Pollution Risk"),
+		_TL(""),
+		PARAMETER_OUTPUT
+	);
+
+	//-----------------------------------------------------
+	Parameters.Add_Choice(
+		NULL	, "METHOD"			, _TL("Flow Direction Algorithm"),
+		_TL(""),
+		CSG_String::Format("%s|%s|",
+			_TL("single"),
+			_TL("multiple")
+		), 1
+	);
+
+	Parameters.Add_Value(
+		NULL	, "CHANNEL_START"	, _TL("Channel Initiation Threshold"),
+		_TL("minimum number of upslope contributing cells to start a channel"),
+		PARAMETER_TYPE_Int, 150, 1, true
+	);
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+int CDiffuse_Pollution_Risk::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+{
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "CHANNEL") )
+	{
+		pParameters->Set_Enabled("CHANNEL_START", pParameter->asGrid() == NULL);
+	}
+
+	return( CSG_Module_Grid::On_Parameters_Enable(pParameters, pParameter) );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CDiffuse_Pollution_Risk::On_Execute(void)
+{	
+	//-----------------------------------------------------
+	m_pDEM			= Parameters("DEM"         )->asGrid();
+	m_pDelivery		= Parameters("DELIVERY"    )->asGrid();
+	m_pRisk_Point	= Parameters("RISK_POINT"  )->asGrid();
+	m_pRisk_Diffuse	= Parameters("RISK_DIFFUSE")->asGrid();
+	m_bSingle		= Parameters("METHOD"      )->asInt() == 0;
+
+	DataObject_Set_Colors(m_pDelivery    , 11, SG_COLORS_RED_GREY_GREEN, true);
+	DataObject_Set_Colors(m_pRisk_Point  , 11, SG_COLORS_RED_GREY_GREEN, true);
+	DataObject_Set_Colors(m_pRisk_Diffuse, 11, SG_COLORS_RED_GREY_GREEN, true);
+
+	//-----------------------------------------------------
+	bool	bResult	= false;
+
+	if( !Set_Flow() )
+	{
+		Error_Set(_TL("initialization failed"));
+	}
+	else if( !Set_Delivery_Index() )
+	{
+		Error_Set(_TL("delivery index calculation failed"));
+	}
+	else if( !Get_Risk_Diffuse() )
+	{
+		Error_Set(_TL("diffuse pollution risk calculation failed"));
+	}
+	else
+	{
+		bResult	= true;
+	}
+
+	//-----------------------------------------------------
+	m_FlowDir.Destroy();
+	m_RainAcc.Destroy();
+	m_TWI    .Destroy();
+
+	return( bResult );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CDiffuse_Pollution_Risk::Get_Flow_Proportions(int x, int y, double Proportion[8])
+{
+	if( m_pDEM->is_InGrid(x, y) )
+	{
+		double Sum = 0.0;
+
+		for(int i=0; i<8; i++)
+		{
+			int	ix	= Get_xTo(i, x);
+			int	iy	= Get_yTo(i, y);
+
+			if( m_pDEM->is_InGrid(ix, iy) && m_pDEM->asDouble(x, y) > m_pDEM->asDouble(ix, iy) )
+			{
+				Sum	+= (Proportion[i]	= ((m_pDEM->asDouble(x, y) - m_pDEM->asDouble(ix, iy)) / Get_Length(i)));
+			}
+			else
+			{
+				Proportion[i]	= 0.0;
+			}
+		}
+
+		if( Sum > 0.0 )
+		{
+			for(int i=0; i<8; i++)
+			{
+				if( Proportion[i] > 0.0 )
+				{
+					Proportion[i]	/= Sum;
+				}
+			}
+
+			return( true );
+		}
+	}
+
+	return( false );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CDiffuse_Pollution_Risk::Set_Flow(void)
+{
+	Process_Set_Text(_TL("initialization"));
+
+	CSG_Grid	*pWeight	= Parameters("WEIGHT")->asGrid  ();
+	double		  Weight	= Parameters("WEIGHT")->asDouble();
+
+	CSG_Grid	*pRain		= Parameters("RAIN"  )->asGrid  ();
+	double		  Rain		= Parameters("RAIN"  )->asDouble();
+
+	m_FlowDir.Create(*Get_System(), SG_DATATYPE_Char);
+	m_RainAcc.Create(*Get_System());
+	m_TWI    .Create(*Get_System());
+
+	for(sLong n=0; n<Get_NCells() && Set_Progress_NCells(n); n++)
+	{
+		int		x, y;
+
+		if( !m_pDEM->Get_Sorted(n, x, y, true) || (pRain && pRain->is_NoData(x, y)) || !Set_Flow(x, y, pRain ? pRain->asDouble(x, y) : Rain) )
+		{
+			m_FlowDir     .Set_NoData(x, y);
+			m_RainAcc     .Set_NoData(x, y);
+			m_TWI         .Set_NoData(x, y);
+			m_pRisk_Point->Set_NoData(x, y);
+		}
+		else
+		{
+			double	s, a;
+
+			m_pDEM->Get_Gradient(x, y, s, a);
+			
+			s	= tan(s);											// tangens of slope
+			a	= (fabs(sin(a)) + fabs(cos(a))) * Get_Cellsize();	// flow width
+
+			double	SCA	= m_RainAcc.asDouble(x, y) / a;				// rain * specific catchment area
+
+			m_TWI.Set_Value(x, y, log(SCA / (s < M_ALMOST_ZERO ? M_ALMOST_ZERO : s)));
+
+			if( pWeight && pWeight->is_NoData(x, y) )
+			{
+				m_pRisk_Point->Set_NoData(x, y);
+			}
+			else
+			{
+				m_pRisk_Point->Set_Value(x, y, SCA * s * (pWeight ? pWeight->asDouble(x, y) : Weight));	// Point Scale Risk Calculation according to Milledge et al. 2012
+			}
+		}
+	}
+
+	return( true );
+}
+
+//---------------------------------------------------------
+bool CDiffuse_Pollution_Risk::Set_Flow(int x, int y, double Rain)
+{
+	//-----------------------------------------------------
+	if( m_pDEM->is_NoData(x, y) )
+	{
+		return( false );
+	}
+
+	double	d[8];
+
+	m_FlowDir.Set_Value(x, y, m_pDEM->Get_Gradient_NeighborDir(x, y));
+	m_RainAcc.Set_Value(x, y, Rain = Rain * Get_Cellarea() + m_RainAcc.asDouble(x, y));
+
+	//-----------------------------------------------------
+	if( m_bSingle )
+	{
+		if( Get_System()->Get_Neighbor_Pos(m_FlowDir.asInt(x, y), x, y, x, y) && m_pDEM->is_InGrid(x, y) )
+		{
+			m_RainAcc.Add_Value(x, y, Rain);
+		}
+	}
+	else if( Get_Flow_Proportions(x, y, d) )
+	{
+		for(int i=0; i<8; i++)
+		{
+			if( d[i] > 0.0 )
+			{
+				m_RainAcc.Add_Value(Get_xTo(i, x), Get_yTo(i, y), Rain * d[i]);
+			}
+		}
+	}
+
+	//-----------------------------------------------------
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+// Calculation according to Lane et al. 2004, p. 198.
+//---------------------------------------------------------
+bool CDiffuse_Pollution_Risk::Set_Delivery_Index(void)
+{
+	//-----------------------------------------------------
+	CSG_Grid	Channel, *pChannel	= Parameters("CHANNEL")->asGrid();
+
+	if( !pChannel )	// no channel network is provided, so create a tempory channel network out of the box!
+	{
+		Process_Set_Text(_TL("Channel Network"));
+
+		int	Threshold	= Parameters("CHANNEL_START")->asInt();
+
+		pChannel	= &Channel;	Channel.Create(*Get_System(), SG_DATATYPE_Word);	Channel.Assign(0.0);	Channel.Set_NoData_Value(0.0);
+
+		for(sLong n=0; n<Get_NCells() && Set_Progress_NCells(n); n++)
+		{
+			int		x, y, ix, iy;
+
+			if( m_pDEM->Get_Sorted(n, x, y, true) )
+			{
+				if( Get_System()->Get_Neighbor_Pos(m_FlowDir.asInt(x, y), x, y, ix, iy) && m_FlowDir.is_InGrid(ix, iy) )
+				{
+					Channel.Add_Value(ix, iy, 1.0 + Channel.asDouble(x, y));
+				}
+
+				Channel.Set_Value(x, y, Channel.asInt(x, y) > Threshold ? 1.0 : 0.0);
+			}
+		}
+	}
+
+	//-----------------------------------------------------
+	Process_Set_Text(_TL("Delivery Index"));
+
+	for(sLong n=0; n<Get_NCells() && Set_Progress_NCells(n); n++)
+	{
+		int		x, y, ix, iy;
+
+		double	TWI_min	= -1.0;
+
+		if( m_pDEM->Get_Sorted(n, x, y, false) )	// bottom up
+		{
+			if( m_TWI.is_InGrid(x, y) )
+			{
+				TWI_min	= m_TWI.asDouble(x, y);
+			}
+
+			if( m_FlowDir.is_InGrid(x, y) && Get_System()->Get_Neighbor_Pos(m_FlowDir.asInt(x, y), x, y, ix, iy) && m_TWI.is_InGrid(ix, iy) )
+			{
+				if( TWI_min < 0.0 || TWI_min > m_TWI.asDouble(ix, iy) )
+				{
+					TWI_min	= m_TWI.asDouble(ix, iy);
+				}
+			}
+		}
+
+		if( TWI_min < 0.0 )
+		{
+			m_pDelivery->Set_NoData(x, y);
+		}
+		else
+		{
+			m_pDelivery->Set_Value(x, y, TWI_min);
+		}
+	}
+
+	//-----------------------------------------------------
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+// Calculation according to Milledge et al. 2012
+//---------------------------------------------------------
+bool CDiffuse_Pollution_Risk::Get_Risk_Diffuse(void)
+{
+	Process_Set_Text(_TL("Difuse Pollution Risk"));
+
+	m_pRisk_Diffuse->Assign(0.0);
+
+	//-----------------------------------------------------
+	for(sLong n=0; n<Get_NCells() && Set_Progress_NCells(n); n++)
+	{
+		int		x, y;
+
+		if( !m_pDEM->Get_Sorted(n, x, y, true) || m_pDelivery->is_NoData(x, y) || m_pRisk_Point->is_NoData(x, y) || m_RainAcc.asDouble(x, y) <= 0.0 )
+		{
+			m_pRisk_Diffuse->Set_NoData(x, y);
+		}
+		else
+		{
+			double d[8], Risk;
+
+			m_pRisk_Point->Mul_Value(x, y, m_pDelivery->asDouble(x, y));				// locational risk = generation risk * connection risk
+			Risk	= m_pRisk_Diffuse->asDouble(x, y) + m_pRisk_Point->asDouble(x, y);	// risk load = sum of upslope locational risk
+			m_pRisk_Diffuse->Set_Value(x, y, Risk / m_RainAcc.asDouble(x, y));			// risk concentration = risk load / sum of upslope rain
+
+			if( m_bSingle )
+			{
+				int		i	= !m_FlowDir.is_NoData(x, y) ? m_FlowDir.asInt(x, y) : -1;
+
+				if( i > 0 && m_pDEM->is_InGrid(Get_xTo(i, x), Get_yTo(i, y)) )
+				{
+					m_pRisk_Diffuse->Add_Value(Get_xTo(i, x), Get_yTo(i, y), Risk);
+				}
+			}
+			else if( Get_Flow_Proportions(x, y, d) )
+			{
+				for(int i=0; i<8; i++)
+				{
+					if( d[i] > 0.0 )
+					{
+						m_pRisk_Diffuse->Add_Value(Get_xTo(i, x), Get_yTo(i, y), Risk * d[i]);
+					}
+				}
+			}
+		}
+	}
+
+	//-----------------------------------------------------
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
diff --git a/src/modules/imagery/imagery_classification/classify_supervised_polygons.h b/src/modules/simulation/sim_hydrology/diffuse_pollution_risk.h
similarity index 71%
copy from src/modules/imagery/imagery_classification/classify_supervised_polygons.h
copy to src/modules/simulation/sim_hydrology/diffuse_pollution_risk.h
index 5ada73b..19aff58 100644
--- a/src/modules/imagery/imagery_classification/classify_supervised_polygons.h
+++ b/src/modules/simulation/sim_hydrology/diffuse_pollution_risk.h
@@ -1,117 +1,115 @@
-/**********************************************************
- * Version $Id: classify_supervised_polygons.h 2104 2014-04-21 15:24:01Z reklov_w $
- *********************************************************/
-
-///////////////////////////////////////////////////////////
-//                                                       //
-//                         SAGA                          //
-//                                                       //
-//      System for Automated Geoscientific Analyses      //
-//                                                       //
-//                    Module Library:                    //
-//                imagery_classification                 //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//             classify_supervised_polygons.h            //
-//                                                       //
-//                 Copyright (C) 2012 by                 //
-//                      Olaf Conrad                      //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-// This file is part of 'SAGA - System for Automated     //
-// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
-//                                                       //
-// SAGA is distributed in the hope that it will be       //
-// useful, but WITHOUT ANY WARRANTY; without even the    //
-// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
-// PARTICULAR PURPOSE. See the GNU General Public        //
-// License for more details.                             //
-//                                                       //
-// You should have received a copy of the GNU General    //
-// Public License along with this program; if not,       //
-// write to the Free Software Foundation, Inc.,          //
-// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
-// USA.                                                  //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//    e-mail:     oconrad at saga-gis.org                   //
-//                                                       //
-//    contact:    Olaf Conrad                            //
-//                Institute of Geography                 //
-//                University of Hamburg                  //
-//                Germany                                //
-//                                                       //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#ifndef HEADER_INCLUDED__classify_supervised_polygons_H
-#define HEADER_INCLUDED__classify_supervised_polygons_H
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#include "MLB_Interface.h"
-
-
-///////////////////////////////////////////////////////////
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-class CPolygon_Classify_Supervised : public CSG_Module
-{
-public:
-	CPolygon_Classify_Supervised(void);
-
-
-protected:
-
-	virtual bool				On_Execute				(void);
-
-	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
-
-
-private:
-
-	bool						m_bNormalise;
-
-	int							m_Class_ID, *m_Features, m_nFeatures;
-
-	CSG_Classifier_Supervised	m_Classifier;
-
-	CSG_Shapes					*m_pPolygons, *m_pClasses;
-
-
-	bool						Finalize				(void);
-
-};
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED__classify_supervised_polygons_H
+/**********************************************************
+ * Version $Id: diffuse_pollution_risk.cpp 911 2011-11-11 11:11:11Z oconrad $
+ *********************************************************/
+
+///////////////////////////////////////////////////////////
+//                                                       //
+//                         SAGA                          //
+//                                                       //
+//      System for Automated Geoscientific Analyses      //
+//                                                       //
+//                    Module Library:                    //
+//                     sim_hydrology                     //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//                diffuse_pollution_risk.h               //
+//                                                       //
+//                 Copyright (C) 2015 by                 //
+//                     Cosima Berger                     //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+// This file is part of 'SAGA - System for Automated     //
+// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
+//                                                       //
+// SAGA is distributed in the hope that it will be       //
+// useful, but WITHOUT ANY WARRANTY; without even the    //
+// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
+// PARTICULAR PURPOSE. See the GNU General Public        //
+// License for more details.                             //
+//                                                       //
+// You should have received a copy of the GNU General    //
+// Public License along with this program; if not,       //
+// write to the Free Software Foundation, Inc.,          //
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307,   //
+// USA.                                                  //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//    e-mail:     oconrad at saga-gis.de                    //
+//                                                       //
+//    contact:    Cosima Berger                          //
+//                Institute of Geography                 //
+//                University of Hamburg                  //
+//                Germany                                //
+//                                                       //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#ifndef HEADER_INCLUDED__diffuse_pollution_risk_H
+#define HEADER_INCLUDED__diffuse_pollution_risk_H
+
+//---------------------------------------------------------
+#include "MLB_Interface.h"
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+class CDiffuse_Pollution_Risk : public CSG_Module_Grid
+{
+public:
+	CDiffuse_Pollution_Risk(void);
+	
+
+protected:
+
+	virtual int					On_Parameters_Enable		(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+
+	virtual bool				On_Execute					(void);
+
+
+private:
+
+	bool						m_bSingle;
+
+	CSG_Grid					*m_pDEM, m_FlowDir, m_RainAcc, m_TWI, *m_pDelivery, *m_pRisk_Point, *m_pRisk_Diffuse;
+	
+
+	bool						Get_Flow_Proportions		(int x, int y, double Proportion[8]);
+
+	bool						Set_Flow					(void);
+	bool						Set_Flow					(int x, int y, double Rain);
+
+	bool						Set_Delivery_Index			(void);
+
+	bool						Get_Risk_Diffuse			(void);
+
+};
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#endif // #ifndef HEADER_INCLUDED__diffuse_pollution_risk_H
diff --git a/src/modules/simulation/sim_ihacres/Makefile.in b/src/modules/simulation/sim_ihacres/Makefile.in
index 28dda9d..e8bd022 100644
--- a/src/modules/simulation/sim_ihacres/Makefile.in
+++ b/src/modules/simulation/sim_ihacres/Makefile.in
@@ -490,22 +490,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/snow_module.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/simulation/sim_ihacres/ihacres_eq.cpp b/src/modules/simulation/sim_ihacres/ihacres_eq.cpp
index b21c34c..c0ba3a8 100644
--- a/src/modules/simulation/sim_ihacres/ihacres_eq.cpp
+++ b/src/modules/simulation/sim_ihacres/ihacres_eq.cpp
@@ -58,7 +58,7 @@ Cihacres_eq::Cihacres_eq(date_array date_in,
 						 double l, double p,
 						 double aq, double as, double bq, double bs)
 {
-	sizeAll			= streamflow.size();
+	sizeAll			= (int)streamflow.size();
 	date			= date_in;
 	streamflow_obs	= streamflow;
 	precipitation	= pcp;
@@ -72,7 +72,7 @@ Cihacres_eq::Cihacres_eq(date_array date_in,
 	this->bq		= bq;
 	this->bs		= bs;
 	// Initialize Vectors
-	_InitVectorsStart(streamflow_obs.size());
+	_InitVectorsStart((int)streamflow_obs.size());
 }
 //---------------------------------------------------------------------
 // two storages
@@ -94,7 +94,7 @@ Cihacres_eq::Cihacres_eq(date_array date_in,
 						 int delay)
 {
 	// Initialize Parameters and Vectors
-	sizeAll			= streamflow.size();
+	sizeAll			= (int)streamflow.size();
 	date			= date_in;
 	streamflow_obs	= streamflow;
 	precipitation	= pcp;
@@ -223,7 +223,7 @@ Cihacres_eq::Cihacres_eq(int size, // array size
 	this->bq		= bq;
 	this->bs		= bs;
 	// Initialize Vectors
-	_InitVectorsStart(streamflow_obs.size());
+	_InitVectorsStart((int)streamflow_obs.size());
 }
 //---------------------------------------------------------------------
 // end constructors ///////////////////////////////////////////////////
@@ -306,7 +306,7 @@ void Cihacres_eq::SimStreamflowSingle(vector_d &excessRain, double initVal,
 									  double a, double b)
 {
 	int i;
-	int size = streamflow_sim.size();
+	int size = (int)streamflow_sim.size();
 	// using the first observed streamflow value as initial simulation value
 	for (i = 0; i < delay; i++)
 		streamflow_sim[i] = initVal;
@@ -344,7 +344,7 @@ void Cihacres_eq::SimStreamflow2Parallel(vector_d &excessRain, vector_d &streamf
 										 int IHAC_vers, int delay)
 {
 	int i;
-	int size = streamflow_sim.size();
+	int size = (int)streamflow_sim.size();
 	double *sf_q = new double[size]; // quick streamflow component
 	double *sf_s = new double[size]; // slow streamflow component
 
diff --git a/src/modules/statistics/statistics_grid/Makefile.in b/src/modules/statistics/statistics_grid/Makefile.in
index 7ea610c..db249f1 100644
--- a/src/modules/statistics/statistics_grid/Makefile.in
+++ b/src/modules/statistics/statistics_grid/Makefile.in
@@ -495,22 +495,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/multiband_variation.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/statistics/statistics_kriging/MLB_Interface.cpp b/src/modules/statistics/statistics_kriging/MLB_Interface.cpp
index 0fc7dae..be9fa87 100644
--- a/src/modules/statistics/statistics_kriging/MLB_Interface.cpp
+++ b/src/modules/statistics/statistics_kriging/MLB_Interface.cpp
@@ -97,18 +97,13 @@ CSG_String Get_Info(int i)
 //---------------------------------------------------------
 // 3. Include the headers of your modules here...
 
+#include "kriging_simple.h"
 #include "kriging_ordinary.h"
-#include "kriging_ordinary_global.h"
 #include "kriging_universal.h"
-#include "kriging_universal_global.h"
+#include "kriging_regression.h"
 
 #include "semivariogram.h"
 
-#include "_kriging_ordinary.h"
-#include "_kriging_ordinary_global.h"
-#include "_kriging_universal.h"
-#include "_kriging_universal_global.h"
-
 
 //---------------------------------------------------------
 // 4. Allow your modules to be created here...
@@ -117,20 +112,16 @@ CSG_Module *		Create_Module(int i)
 {
 	switch( i )
 	{
-	case 0:		return( new CKriging_Ordinary );
-	case 1:		return( new CKriging_Ordinary_Global );
-	case 2:		return( new CKriging_Universal );
-	case 3:		return( new CKriging_Universal_Global );
+	case  1:	return( new CKriging_Simple );
+	case  0:	return( new CKriging_Ordinary );
+	case  2:	return( new CKriging_Universal );
+	case  3:	return( new CKriging_Regression );
 
-	case 4:		return( new CSemiVariogram );
+	case  4:	return( new CSemiVariogram );
 
-	case 5:		return( new C_Kriging_Ordinary );
-	case 6:		return( new C_Kriging_Ordinary_Global );
-	case 7:		return( new C_Kriging_Universal );
-	case 8:		return( new C_Kriging_Universal_Global );
+	case  5:	return( NULL );
+	default:	return( MLB_INTERFACE_SKIP_MODULE );
 	}
-
-	return( NULL );
 }
 
 
diff --git a/src/modules/statistics/statistics_kriging/Makefile.am b/src/modules/statistics/statistics_kriging/Makefile.am
index aae3613..788d6b0 100644
--- a/src/modules/statistics/statistics_kriging/Makefile.am
+++ b/src/modules/statistics/statistics_kriging/Makefile.am
@@ -14,29 +14,19 @@ AM_CXXFLAGS        = $(CXX_INCS) $(DEF_SAGA) $(DEP_DEFS) $(DBGFLAGS) $(GOMPFLAGS
 AM_LDFLAGS         = $(DEP_LFLG) -avoid-version
 pkglib_LTLIBRARIES = libstatistics_kriging.la
 libstatistics_kriging_la_SOURCES =\
-_kriging_base.cpp\
-_kriging_ordinary.cpp\
-_kriging_ordinary_global.cpp\
-_kriging_universal.cpp\
-_kriging_universal_global.cpp\
 kriging_base.cpp\
 kriging_ordinary.cpp\
-kriging_ordinary_global.cpp\
+kriging_regression.cpp\
+kriging_simple.cpp\
 kriging_universal.cpp\
-kriging_universal_global.cpp\
 MLB_Interface.cpp\
 semivariogram.cpp\
 variogram_dialog.cpp\
-_kriging_base.h\
-_kriging_ordinary.h\
-_kriging_ordinary_global.h\
-_kriging_universal.h\
-_kriging_universal_global.h\
 kriging_base.h\
 kriging_ordinary.h\
-kriging_ordinary_global.h\
+kriging_regression.h\
+kriging_simple.h\
 kriging_universal.h\
-kriging_universal_global.h\
 MLB_Interface.h\
 semivariogram.h\
 variogram_dialog.h
diff --git a/src/modules/statistics/statistics_kriging/Makefile.in b/src/modules/statistics/statistics_kriging/Makefile.in
index 64c8d4c..56e7e67 100644
--- a/src/modules/statistics/statistics_kriging/Makefile.in
+++ b/src/modules/statistics/statistics_kriging/Makefile.in
@@ -128,12 +128,10 @@ LTLIBRARIES = $(pkglib_LTLIBRARIES)
 libstatistics_kriging_la_DEPENDENCIES =  \
 	$(top_srcdir)/src/saga_core/saga_api/libsaga_api.la \
 	$(top_srcdir)/src/saga_core/saga_gdi/libsaga_gdi.la
-am_libstatistics_kriging_la_OBJECTS = _kriging_base.lo \
-	_kriging_ordinary.lo _kriging_ordinary_global.lo \
-	_kriging_universal.lo _kriging_universal_global.lo \
-	kriging_base.lo kriging_ordinary.lo kriging_ordinary_global.lo \
-	kriging_universal.lo kriging_universal_global.lo \
-	MLB_Interface.lo semivariogram.lo variogram_dialog.lo
+am_libstatistics_kriging_la_OBJECTS = kriging_base.lo \
+	kriging_ordinary.lo kriging_regression.lo kriging_simple.lo \
+	kriging_universal.lo MLB_Interface.lo semivariogram.lo \
+	variogram_dialog.lo
 libstatistics_kriging_la_OBJECTS =  \
 	$(am_libstatistics_kriging_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
@@ -377,29 +375,19 @@ AM_CXXFLAGS = $(CXX_INCS) $(DEF_SAGA) $(DEP_DEFS) $(DBGFLAGS) $(GOMPFLAGS)
 AM_LDFLAGS = $(DEP_LFLG) -avoid-version
 pkglib_LTLIBRARIES = libstatistics_kriging.la
 libstatistics_kriging_la_SOURCES = \
-_kriging_base.cpp\
-_kriging_ordinary.cpp\
-_kriging_ordinary_global.cpp\
-_kriging_universal.cpp\
-_kriging_universal_global.cpp\
 kriging_base.cpp\
 kriging_ordinary.cpp\
-kriging_ordinary_global.cpp\
+kriging_regression.cpp\
+kriging_simple.cpp\
 kriging_universal.cpp\
-kriging_universal_global.cpp\
 MLB_Interface.cpp\
 semivariogram.cpp\
 variogram_dialog.cpp\
-_kriging_base.h\
-_kriging_ordinary.h\
-_kriging_ordinary_global.h\
-_kriging_universal.h\
-_kriging_universal_global.h\
 kriging_base.h\
 kriging_ordinary.h\
-kriging_ordinary_global.h\
+kriging_regression.h\
+kriging_simple.h\
 kriging_universal.h\
-kriging_universal_global.h\
 MLB_Interface.h\
 semivariogram.h\
 variogram_dialog.h
@@ -485,36 +473,34 @@ distclean-compile:
 	-rm -f *.tab.c
 
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MLB_Interface.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/_kriging_base.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/_kriging_ordinary.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/_kriging_ordinary_global.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/_kriging_universal.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/_kriging_universal_global.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kriging_base.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kriging_ordinary.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kriging_ordinary_global.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kriging_regression.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kriging_simple.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kriging_universal.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kriging_universal_global.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/semivariogram.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/variogram_dialog.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/statistics/statistics_kriging/_kriging_base.cpp b/src/modules/statistics/statistics_kriging/_kriging_base.cpp
deleted file mode 100644
index 5dca3de..0000000
--- a/src/modules/statistics/statistics_kriging/_kriging_base.cpp
+++ /dev/null
@@ -1,522 +0,0 @@
-/**********************************************************
- * Version $Id: _kriging_base.cpp 1921 2014-01-09 10:24:11Z oconrad $
- *********************************************************/
-
-///////////////////////////////////////////////////////////
-//                                                       //
-//                         SAGA                          //
-//                                                       //
-//      System for Automated Geoscientific Analyses      //
-//                                                       //
-//                    Module Library:                    //
-//                 Geostatistics_Kriging                 //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//                    _Kriging_Base.cpp                  //
-//                                                       //
-//                 Copyright (C) 2006 by                 //
-//                      Olaf Conrad                      //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-// This file is part of 'SAGA - System for Automated     //
-// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
-//                                                       //
-// SAGA is distributed in the hope that it will be       //
-// useful, but WITHOUT ANY WARRANTY; without even the    //
-// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
-// PARTICULAR PURPOSE. See the GNU General Public        //
-// License for more details.                             //
-//                                                       //
-// You should have received a copy of the GNU General    //
-// Public License along with this program; if not,       //
-// write to the Free Software Foundation, Inc.,          //
-// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
-// USA.                                                  //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//    e-mail:     oconrad at saga-gis.org                   //
-//                                                       //
-//    contact:    Olaf Conrad                            //
-//                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
-//                Germany                                //
-//                                                       //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#include "_kriging_base.h"
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-C_Kriging_Base::C_Kriging_Base(void)
-{
-	CSG_Parameter	*pNode;
-	CSG_Parameters	*pParameters;
-
-	//-----------------------------------------------------
-	Parameters.Add_Grid_Output(
-		NULL	, "GRID"		, _TL("Grid"),
-		_TL("")
-	);
-
-	Parameters.Add_Grid_Output(
-		NULL	, "VARIANCE"	, _TL("Variance"),
-		_TL("")
-	);
-
-	pNode	= Parameters.Add_Shapes(
-		NULL	, "SHAPES"		, _TL("Points"),
-		_TL(""),
-		PARAMETER_INPUT
-	);
-
-	Parameters.Add_Table_Field(
-		pNode	, "FIELD"		, _TL("Attribute"),
-		_TL("")
-	);
-
-	Parameters.Add_Value(
-		NULL	, "BVARIANCE"	, _TL("Create Variance Grid"),
-		_TL(""),
-		PARAMETER_TYPE_Bool		, true
-	);
-
-	Parameters.Add_Choice(
-		NULL	, "TARGET"		, _TL("Target Grid"),
-		_TL(""),
-
-		CSG_String::Format(SG_T("%s|%s|%s|"),
-			_TL("user defined"),
-			_TL("grid system"),
-			_TL("grid")
-		), 0
-	);
-
-	Parameters.Add_Choice(
-		NULL	, "MODEL"		, _TL("Variogram Model"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|%s|%s|%s|%s|"),
-			_TL("Spherical Model"),
-			_TL("Exponential Model"),
-			_TL("Gaussian Model"),
-			_TL("Linear Regression"),
-			_TL("Exponential Regression"),
-			_TL("Power Function Regression")
-		), 3
-	);
-
-	Parameters.Add_Value(
-		NULL	, "BLOCK"		, _TL("Block Kriging"),
-		_TL(""),
-		PARAMETER_TYPE_Bool		, false
-	);
-
-	Parameters.Add_Value(
-		NULL	, "DBLOCK"		, _TL("Block Size"),
-		_TL(""),
-		PARAMETER_TYPE_Double	, 100.0, 0.0, true
-	);
-
-	Parameters.Add_Value(
-		NULL	, "BLOG"		, _TL("Logarithmic Transformation"),
-		_TL(""),
-		PARAMETER_TYPE_Bool
-	);
-
-	Parameters.Add_Value(
-		NULL	, "NUGGET"		, _TL("Nugget"),
-		_TL(""),
-		PARAMETER_TYPE_Double, 0.0, 0.0, true
-	);
-
-	Parameters.Add_Value(
-		NULL	, "SILL"		, _TL("Sill"),
-		_TL(""),
-		PARAMETER_TYPE_Double, 10.0, 0.0, true
-	);
-
-	Parameters.Add_Value(
-		NULL	, "RANGE"		, _TL("Range"),
-		_TL(""),
-		PARAMETER_TYPE_Double, 100.0, 0.0, true
-	);
-
-	pNode	= Parameters.Add_Node(
-		NULL	, "PARMS"		, _TL("Additional Parameters"),
-		_TL("")
-	);
-
-	Parameters.Add_Value(
-		pNode	, "LIN_B"		, _TL("Linear Regression"),
-		_TL("Parameter B for Linear Regression:\n   y = Nugget + B * x"),
-		PARAMETER_TYPE_Double, 1.0
-	);
-
-	Parameters.Add_Value(
-		pNode	, "EXP_B"		, _TL("Exponential Regression"),
-		_TL("Parameter B for Exponential Regression:\n   y = Nugget * e ^ (B * x)"),
-		PARAMETER_TYPE_Double, 0.1
-	);
-
-	Parameters.Add_Value(
-		pNode	, "POW_A"		, _TL("Power Function - A"),
-		_TL("Parameter A for Power Function Regression:\n   y = A * x ^ B"),
-		PARAMETER_TYPE_Double, 1.0
-	);
-
-	Parameters.Add_Value(
-		pNode	, "POW_B"		, _TL("Power Function - B"),
-		_TL("Parameter B for Power Function Regression:\n   y = A * x ^ B"),
-		PARAMETER_TYPE_Double, 0.5
-	);
-
-	//-----------------------------------------------------
-	pParameters	= Add_Parameters(SG_T("USER")	, _TL("User defined grid")	, _TL(""));
-
-	pParameters->Add_Value(
-		NULL	, "CELL_SIZE"	, _TL("Grid Size"),
-		_TL(""),
-		PARAMETER_TYPE_Double, 100.0, 0.0, true
-	);
-
-	pNode	= pParameters->Add_Value(
-		NULL	, "FIT_EXTENT"	, _TL("Fit Extent"),
-		_TL("Automatically fits the grid to the shapes layers extent."),
-		PARAMETER_TYPE_Bool		, true
-	);
-
-	pParameters->Add_Range(
-		pNode	, "X_EXTENT"	, _TL("X-Extent"),
-		_TL("")
-	);
-
-	pParameters->Add_Range(
-		pNode	, "Y_EXTENT"	, _TL("Y-Extent"),
-		_TL("")
-	);
-
-	//-----------------------------------------------------
-	pParameters	= Add_Parameters(SG_T("SYSTEM")	, _TL("Choose Grid System")	, _TL(""));
-
-	pParameters->Add_Grid_System(
-		NULL	, "SYSTEM"		, _TL("Grid System"),
-		_TL("")
-	);
-
-	//-----------------------------------------------------
-	pParameters	= Add_Parameters(SG_T("GRID")	, _TL("Choose Grid")		, _TL(""));
-
-	pNode	= pParameters->Add_Grid_System(
-		NULL	, "SYSTEM"		, _TL("Grid System"),
-		_TL("")
-	);
-
-	pParameters->Add_Grid(
-		pNode	, "GRID"		, _TL("Grid"),
-		_TL(""),
-		PARAMETER_INPUT	, false
-	);
-
-	pParameters->Add_Grid(
-		pNode	, "VARIANCE"	, _TL("Variance"),
-		_TL(""),
-		PARAMETER_INPUT_OPTIONAL, false
-	);
-}
-
-//---------------------------------------------------------
-C_Kriging_Base::~C_Kriging_Base(void)
-{}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-bool C_Kriging_Base::On_Execute(void)
-{
-	bool	bResult	= false;
-
-	m_pShapes	= NULL;
-
-	m_bLog		= Parameters("BLOG")	->asBool();
-
-	m_Model		= Parameters("MODEL")	->asInt();
-
-	m_Nugget	= Parameters("NUGGET")	->asDouble();
-	m_Sill		= Parameters("SILL")	->asDouble() - m_Nugget;	
-	m_Range		= Parameters("RANGE")	->asDouble();
-
-	m_Block		= Parameters("DBLOCK")	->asDouble() / 2.0;
-	m_bBlock	= Parameters("BLOCK")	->asBool() && m_Block > 0.0;
-
-	m_BLIN		= Parameters("LIN_B")	->asDouble();
-	m_BEXP		= Parameters("EXP_B")	->asDouble();
-	m_APOW		= Parameters("POW_A")	->asDouble();
-	m_BPOW		= Parameters("POW_B")	->asDouble();
-
-	//-----------------------------------------------------
-	if( _Get_Grid() && _Get_Points() && On_Initialise() )
-	{
-		int		ix, iy;
-		double	x, y, z, v;
-
-		for(iy=0, y=m_pGrid->Get_YMin(); iy<m_pGrid->Get_NY() && Set_Progress(iy, m_pGrid->Get_NY()); iy++, y+=m_pGrid->Get_Cellsize())
-		{
-			for(ix=0, x=m_pGrid->Get_XMin(); ix<m_pGrid->Get_NX(); ix++, x+=m_pGrid->Get_Cellsize())
-			{
-				if( Get_Value(x, y, z, v) )
-				{
-					m_pGrid->Set_Value(ix, iy, m_bLog ? exp(z) : z);
-
-					if( m_pVariance )
-					{
-						m_pVariance->Set_Value(ix, iy, v);
-					}
-				}
-				else
-				{
-					m_pGrid->Set_NoData(ix, iy);
-
-					if( m_pVariance )
-					{
-						m_pVariance->Set_NoData(ix, iy);
-					}
-				}
-			}
-		}
-
-		bResult	= true;
-	}
-
-	//-----------------------------------------------------
-	m_Points.Clear();
-	m_Search.Destroy();
-	m_G		.Destroy();
-	m_W		.Destroy();
-
-	if( m_pShapes && m_pShapes != Parameters("SHAPES")->asShapes() )
-	{
-		delete(m_pShapes);
-	}
-
-	return( bResult );
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-double C_Kriging_Base::Get_Weight(double d)
-{
-	if( d > 0.0 )
-	{
-		switch( m_Model )
-		{
-		case 0:
-			return(	// Spherical Model
-				d >= m_Range
-			?	m_Nugget + m_Sill
-			:	m_Nugget + m_Sill * (3.0 * d / (2.0 * m_Range) - d*d*d / (2.0 * m_Range*m_Range*m_Range))
-			);
-
-		case 1:
-			return(	// Exponential Model
-				m_Nugget + m_Sill * (1.0 - exp(-3.0 * d / m_Range))
-			);
-
-		case 2:
-			return(	// Gaussian Model
-				m_Nugget + m_Sill * SG_Get_Square(1.0 - exp(-3.0 * d / (m_Range*m_Range)))
-			);
-
-		case 3: default:
-			return(	// Linear Regression
-				m_Nugget + d * m_BLIN
-			);
-
-		case 4:
-			return(	// Exponential Regression
-				m_Nugget * exp(d * m_BEXP)
-			);
-
-		case 5:
-			return(	// Power Function Regression
-				m_Nugget + m_APOW * pow(d, m_BPOW)
-			);
-		}
-	}
-
-	return( m_Nugget > 0.0 ? m_Nugget : 0.00001 );
-}
-
-//---------------------------------------------------------
-double C_Kriging_Base::Get_Weight(double dx, double dy)
-{
-	return( Get_Weight(sqrt(dx*dx + dy*dy)) );
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-bool C_Kriging_Base::_Get_Points(void)
-{
-	int		iShape, iPart, iPoint;
-	CSG_Shape	*pShape , *pPoint;
-	CSG_Shapes	*pPoints;
-
-	m_pShapes	= Parameters("SHAPES")	->asShapes();
-	m_zField	= Parameters("FIELD")	->asInt();
-
-	if( m_pShapes->Get_Type() != SHAPE_TYPE_Point )
-	{
-		pPoints	= SG_Create_Shapes(SHAPE_TYPE_Point, SG_T(""), m_pShapes);
-
-		for(iShape=0; iShape<m_pShapes->Get_Count() && Set_Progress(iShape, m_pShapes->Get_Count()); iShape++)
-		{
-			pShape	= m_pShapes->Get_Shape(iShape);
-
-			if( !pShape->is_NoData(m_zField) )
-			{
-				for(iPart=0; iPart<pShape->Get_Part_Count(); iPart++)
-				{
-					for(iPoint=0; iPoint<pShape->Get_Point_Count(iPart); iPoint++)
-					{
-						pPoint	= pPoints->Add_Shape(pShape, SHAPE_COPY_ATTR);
-						pPoint->Add_Point(pShape->Get_Point(iPoint, iPart));
-					}
-				}
-			}
-		}
-
-		m_pShapes	= pPoints;
-	}
-
-	return( m_pShapes->Get_Count() > 1 );
-}
-
-//---------------------------------------------------------
-bool C_Kriging_Base::_Get_Grid(void)
-{
-	CSG_Shapes	*pShapes	= Parameters("SHAPES")->asShapes();
-
-	m_pGrid		= NULL;
-	m_pVariance	= NULL;
-
-	//-------------------------------------------------
-	switch( Parameters("TARGET")->asInt() )
-	{
-	case 0:	// user defined...
-		if( Dlg_Parameters("USER") )
-		{
-			m_pGrid		= _Get_Grid(pShapes->Get_Extent());
-		}
-		break;
-
-	case 1:	// grid system...
-		if( Dlg_Parameters("SYSTEM") )
-		{
-			m_pGrid		= SG_Create_Grid(*Get_Parameters("SYSTEM")->Get_Parameter("SYSTEM")->asGrid_System(), SG_DATATYPE_Float);
-		}
-		break;
-
-	case 2:	// grid...
-		if( Dlg_Parameters("GRID") )
-		{
-			m_pGrid		= Get_Parameters("GRID")->Get_Parameter("GRID")		->asGrid();
-			m_pVariance	= Get_Parameters("GRID")->Get_Parameter("VARIANCE")	->asGrid();
-		}
-		break;
-	}
-
-	//-------------------------------------------------
-	if( m_pGrid )
-	{
-		if( !m_pVariance && Parameters("BVARIANCE")->asBool() )
-		{
-			m_pVariance	= SG_Create_Grid(m_pGrid, SG_DATATYPE_Float);
-		}
-
-		m_pGrid->Set_Name(CSG_String::Format(SG_T("%s [%s]"), Parameters("FIELD")->asString(), Get_Name().c_str()));
-		Parameters("GRID")->Set_Value(m_pGrid);
-
-		if( m_pVariance )
-		{
-			m_pVariance->Set_Name(CSG_String::Format(SG_T("%s [%s %s]"), Parameters("FIELD")->asString(), Get_Name().c_str(), _TL("Variance")));
-			Parameters("VARIANCE")->Set_Value(m_pVariance);
-		}
-
-		if( Parameters("TARGET")->asInt() == 2 )
-		{
-			Get_Parameters("GRID")->Get_Parameter("VARIANCE")->Set_Value(m_pVariance);
-		}
-	}
-
-	//-----------------------------------------------------
-	return( m_pGrid != NULL );
-}
-
-//---------------------------------------------------------
-CSG_Grid * C_Kriging_Base::_Get_Grid(TSG_Rect Extent)
-{
-	CSG_Parameters	*P	= Get_Parameters("USER");
-
-	if( !P->Get_Parameter("FIT_EXTENT")->asBool() )
-	{
-		Extent.xMin	= P->Get_Parameter("X_EXTENT")->asRange()->Get_LoVal();
-		Extent.yMin	= P->Get_Parameter("Y_EXTENT")->asRange()->Get_LoVal();
-		Extent.xMax	= P->Get_Parameter("X_EXTENT")->asRange()->Get_HiVal();
-		Extent.yMax	= P->Get_Parameter("Y_EXTENT")->asRange()->Get_HiVal();
-	}
-
-	double	d	= P->Get_Parameter("CELL_SIZE")->asDouble();
-
-	int		nx	= 1 + (int)((Extent.xMax - Extent.xMin) / d);
-	int		ny	= 1 + (int)((Extent.yMax - Extent.yMin) / d);
-
-	return( nx > 1 && ny > 1 ? SG_Create_Grid(SG_DATATYPE_Float, nx, ny, d, Extent.xMin, Extent.yMin) : NULL );
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
diff --git a/src/modules/statistics/statistics_kriging/_kriging_base.h b/src/modules/statistics/statistics_kriging/_kriging_base.h
deleted file mode 100644
index 02fce3f..0000000
--- a/src/modules/statistics/statistics_kriging/_kriging_base.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/**********************************************************
- * Version $Id: _kriging_base.h 1921 2014-01-09 10:24:11Z oconrad $
- *********************************************************/
-
-///////////////////////////////////////////////////////////
-//                                                       //
-//                         SAGA                          //
-//                                                       //
-//      System for Automated Geoscientific Analyses      //
-//                                                       //
-//                    Module Library:                    //
-//                 Geostatistics_Kriging                 //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//                    _Kriging_Base.h                    //
-//                                                       //
-//                 Copyright (C) 2006 by                 //
-//                      Olaf Conrad                      //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-// This file is part of 'SAGA - System for Automated     //
-// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
-//                                                       //
-// SAGA is distributed in the hope that it will be       //
-// useful, but WITHOUT ANY WARRANTY; without even the    //
-// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
-// PARTICULAR PURPOSE. See the GNU General Public        //
-// License for more details.                             //
-//                                                       //
-// You should have received a copy of the GNU General    //
-// Public License along with this program; if not,       //
-// write to the Free Software Foundation, Inc.,          //
-// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
-// USA.                                                  //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//    e-mail:     oconrad at saga-gis.org                   //
-//                                                       //
-//    contact:    Olaf Conrad                            //
-//                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
-//                Germany                                //
-//                                                       //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#ifndef HEADER_INCLUDED___Kriging_Base_H
-#define HEADER_INCLUDED___Kriging_Base_H
-
-//---------------------------------------------------------
-#include "MLB_Interface.h"
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-class C_Kriging_Base : public CSG_Module
-{
-public:
-	C_Kriging_Base(void);
-	virtual ~C_Kriging_Base(void);
-
-	virtual CSG_String		Get_MenuPath	(void)	{	return( _TL("R:Without Variogram Fit") );	}
-
-
-protected:
-
-	virtual bool			On_Execute		(void);
-
-
-	bool					m_bBlock;
-
-	int						m_zField;
-
-	double					m_Block;
-
-	CSG_Points_Z			m_Points;
-
-	CSG_Vector				m_G;
-
-	CSG_Matrix				m_W;
-
-	CSG_PRQuadTree			m_Search;
-
-	CSG_Grid				*m_pGrid, *m_pVariance;
-
-	CSG_Shapes				*m_pShapes;
-
-
-	virtual bool			On_Initialise	(void)	{	return( true );	}
-
-	virtual bool			Get_Value		(double x, double y, double &z, double &Variance)	= 0;
-
-	double					Get_Weight		(double Distance);
-	double					Get_Weight		(double dx, double dy);
-
-
-private:
-
-	bool					m_bLog;
-
-	int						m_Model;
-
-	double					m_Nugget, m_Sill, m_Range, m_BLIN, m_BEXP, m_APOW, m_BPOW;
-
-
-	bool					_Get_Points		(void);
-	bool					_Get_Grid		(void);
-	CSG_Grid *				_Get_Grid		(TSG_Rect Extent);
-
-};
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED___Kriging_Base_H
diff --git a/src/modules/statistics/statistics_kriging/_kriging_ordinary.cpp b/src/modules/statistics/statistics_kriging/_kriging_ordinary.cpp
deleted file mode 100644
index 6dd4f1d..0000000
--- a/src/modules/statistics/statistics_kriging/_kriging_ordinary.cpp
+++ /dev/null
@@ -1,236 +0,0 @@
-/**********************************************************
- * Version $Id: _kriging_ordinary.cpp 1921 2014-01-09 10:24:11Z oconrad $
- *********************************************************/
-
-///////////////////////////////////////////////////////////
-//                                                       //
-//                         SAGA                          //
-//                                                       //
-//      System for Automated Geoscientific Analyses      //
-//                                                       //
-//                    Module Library:                    //
-//                 Geostatistics_Kriging                 //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//                 _Kriging_Ordinary.cpp                 //
-//                                                       //
-//                 Copyright (C) 2003 by                 //
-//                      Olaf Conrad                      //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-// This file is part of 'SAGA - System for Automated     //
-// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
-//                                                       //
-// SAGA is distributed in the hope that it will be       //
-// useful, but WITHOUT ANY WARRANTY; without even the    //
-// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
-// PARTICULAR PURPOSE. See the GNU General Public        //
-// License for more details.                             //
-//                                                       //
-// You should have received a copy of the GNU General    //
-// Public License along with this program; if not,       //
-// write to the Free Software Foundation, Inc.,          //
-// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
-// USA.                                                  //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//    e-mail:     oconrad at saga-gis.org                   //
-//                                                       //
-//    contact:    Olaf Conrad                            //
-//                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
-//                Germany                                //
-//                                                       //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#include "_kriging_ordinary.h"
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-C_Kriging_Ordinary::C_Kriging_Ordinary(void)
-	: C_Kriging_Ordinary_Global()
-{
-	Set_Name		(_TL("[deprecated] Ordinary Kriging"));
-
-	Set_Author		(SG_T("(c) 2008 by O.Conrad"));
-
-	Set_Description	(_TW(
-		"Ordinary Kriging for grid interpolation from irregular sample points."
-	));
-
-	//-----------------------------------------------------
-	Parameters.Add_Value(
-		NULL	, "MAXRADIUS"	, _TL("Maximum Search Radius (map units)"),
-		_TL(""),
-		PARAMETER_TYPE_Double	, 1000.0, 0, true
-	);
-
-	Parameters.Add_Range(
-		NULL	, "NPOINTS"		, _TL("Min./Max. Number of m_Points"),
-		_TL(""), 4, 20, 1, true
-	);
-}
-
-//---------------------------------------------------------
-C_Kriging_Ordinary::~C_Kriging_Ordinary(void)
-{}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-bool C_Kriging_Ordinary::On_Initialise(void)
-{
-	m_Radius		= Parameters("MAXRADIUS")->asDouble();
-
-	m_nPoints_Min	= (int)Parameters("NPOINTS")->asRange()->Get_LoVal();
-	m_nPoints_Max	= (int)Parameters("NPOINTS")->asRange()->Get_HiVal();
-
-	//-----------------------------------------------------
-	if( m_Search.Create(m_pShapes, m_zField) )
-	{
-		m_Points.Set_Count	(m_nPoints_Max);
-		m_G		.Create		(m_nPoints_Max + 1);
-		m_W		.Create		(m_nPoints_Max + 1, m_nPoints_Max + 1);
-
-		return( true );
-	}
-
-	return( false );
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-bool C_Kriging_Ordinary::Get_Value(double x, double y, double &z, double &v)
-{
-	int		i, j, n;
-	double	Lambda;
-
-	//-----------------------------------------------------
-	if(	(n = Get_Weights(x, y)) > 0 )
-	{
-		for(i=0; i<n; i++)
-		{
-			if( !m_bBlock )
-			{
-				m_G[i]	=	Get_Weight(x - m_Points[i].x, y - m_Points[i].y);
-			}
-			else
-			{
-				m_G[i]	= (	Get_Weight((x          ) - m_Points[i].x, (y          ) - m_Points[i].y)
-						+	Get_Weight((x + m_Block) - m_Points[i].x, (y + m_Block) - m_Points[i].y)
-						+	Get_Weight((x + m_Block) - m_Points[i].x, (y - m_Block) - m_Points[i].y)
-						+	Get_Weight((x - m_Block) - m_Points[i].x, (y + m_Block) - m_Points[i].y)
-						+	Get_Weight((x - m_Block) - m_Points[i].x, (y - m_Block) - m_Points[i].y) ) / 5.0;
-			}
-		}
-
-		m_G[n]	= 1.0;
-
-		//-------------------------------------------------
-		for(i=0, z=0.0, v=0.0; i<n; i++)
-		{
-			for(j=0, Lambda=0.0; j<=n; j++)
-			{
-				Lambda	+= m_W[i][j] * m_G[j];
-			}
-
-			z	+= Lambda * m_Points[i].z;
-			v	+= Lambda * m_G[i];
-		}
-
-		//-------------------------------------------------
-		return( true );
-	}
-
-	return( false );
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-int C_Kriging_Ordinary::Get_Weights(double x, double y)
-{
-	int		i, j, n;
-
-	//-----------------------------------------------------
-	if( (n = m_Search.Select_Nearest_Points(x, y, m_nPoints_Max, m_Radius)) >= m_nPoints_Min )
-	{
-		for(i=0; i<n; i++)
-		{
-			m_Search.Get_Selected_Point(i, m_Points[i].x, m_Points[i].y, m_Points[i].z);
-		}
-
-		//-------------------------------------------------
-		for(i=0; i<n; i++)
-		{
-			m_W[i][i]	= 0.0;				// diagonale...
-			m_W[i][n]	= m_W[n][i]	= 1.0;	// edge...
-
-			for(j=i+1; j<n; j++)
-			{
-				m_W[i][j]	= m_W[j][i]	= Get_Weight(
-					m_Points[i].x - m_Points[j].x,
-					m_Points[i].y - m_Points[j].y
-				);
-			}
-		}
-
-		m_W[n][n]	= 0.0;
-
-		if( m_W.Set_Inverse(true, 1 + n) )
-		{
-			return( n );
-		}
-	}
-
-	return( 0 );
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
diff --git a/src/modules/statistics/statistics_kriging/_kriging_ordinary_global.cpp b/src/modules/statistics/statistics_kriging/_kriging_ordinary_global.cpp
deleted file mode 100644
index 1311100..0000000
--- a/src/modules/statistics/statistics_kriging/_kriging_ordinary_global.cpp
+++ /dev/null
@@ -1,226 +0,0 @@
-/**********************************************************
- * Version $Id: _kriging_ordinary_global.cpp 1921 2014-01-09 10:24:11Z oconrad $
- *********************************************************/
-
-///////////////////////////////////////////////////////////
-//                                                       //
-//                         SAGA                          //
-//                                                       //
-//      System for Automated Geoscientific Analyses      //
-//                                                       //
-//                    Module Library:                    //
-//                 Geostatistics_Kriging                 //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//              _Kriging_Ordinary_Global.cpp             //
-//                                                       //
-//                 Copyright (C) 2003 by                 //
-//                      Olaf Conrad                      //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-// This file is part of 'SAGA - System for Automated     //
-// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
-//                                                       //
-// SAGA is distributed in the hope that it will be       //
-// useful, but WITHOUT ANY WARRANTY; without even the    //
-// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
-// PARTICULAR PURPOSE. See the GNU General Public        //
-// License for more details.                             //
-//                                                       //
-// You should have received a copy of the GNU General    //
-// Public License along with this program; if not,       //
-// write to the Free Software Foundation, Inc.,          //
-// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
-// USA.                                                  //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//    e-mail:     oconrad at saga-gis.org                   //
-//                                                       //
-//    contact:    Olaf Conrad                            //
-//                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
-//                Germany                                //
-//                                                       //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#include "_kriging_ordinary_global.h"
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-C_Kriging_Ordinary_Global::C_Kriging_Ordinary_Global(void)
-	: C_Kriging_Base()
-{
-	Set_Name		(_TL("[deprecated] Ordinary Kriging (Global)"));
-
-	Set_Author		(SG_T("(c) 2008 by O.Conrad"));
-
-	Set_Description	(_TW(
-		"Ordinary Kriging for grid interpolation from irregular sample points. "
-		"This implementation does not use a maximum search radius. The weighting "
-		"matrix is generated once globally for all points."
-	));
-}
-
-//---------------------------------------------------------
-C_Kriging_Ordinary_Global::~C_Kriging_Ordinary_Global(void)
-{}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-bool C_Kriging_Ordinary_Global::On_Initialise(void)
-{
-	return( Get_Weights() );
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-bool C_Kriging_Ordinary_Global::Get_Value(double x, double y, double &z, double &v)
-{
-	int		i, j, n;
-	double	Lambda;
-
-	//-----------------------------------------------------
-	if(	(n = m_Points.Get_Count()) > 0 )
-	{
-		for(i=0; i<n; i++)
-		{
-			if( !m_bBlock )
-			{
-				m_G[i]	=	Get_Weight(x - m_Points[i].x, y - m_Points[i].y);
-			}
-			else
-			{
-				m_G[i]	= (	Get_Weight((x          ) - m_Points[i].x, (y          ) - m_Points[i].y)
-						+	Get_Weight((x + m_Block) - m_Points[i].x, (y + m_Block) - m_Points[i].y)
-						+	Get_Weight((x + m_Block) - m_Points[i].x, (y - m_Block) - m_Points[i].y)
-						+	Get_Weight((x - m_Block) - m_Points[i].x, (y + m_Block) - m_Points[i].y)
-						+	Get_Weight((x - m_Block) - m_Points[i].x, (y - m_Block) - m_Points[i].y) ) / 5.0;
-			}
-		}
-
-		m_G[n]	= 1.0;
-
-		//-------------------------------------------------
-		for(i=0, z=0.0, v=0.0; i<n; i++)
-		{
-			for(j=0, Lambda=0.0; j<=n; j++)
-			{
-				Lambda	+= m_W[i][j] * m_G[j];
-			}
-
-			z	+= Lambda * m_Points[i].z;
-			v	+= Lambda * m_G[i];
-		}
-
-		//-------------------------------------------------
-		return( true );
-	}
-
-	return( false );
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-bool C_Kriging_Ordinary_Global::Get_Weights(void)
-{
-	int		i, j, n;
-
-	//-----------------------------------------------------
-	for(int iShape=0; iShape<m_pShapes->Get_Count(); iShape++)
-	{
-		CSG_Shape	*pShape	= m_pShapes->Get_Shape(iShape);
-
-		if( !pShape->is_NoData(m_zField) )
-		{
-			for(int iPart=0; iPart<pShape->Get_Part_Count(); iPart++)
-			{
-				for(int iPoint=0; iPoint<pShape->Get_Point_Count(iPart); iPoint++)
-				{
-					m_Points.Add(
-						pShape->Get_Point(iPoint, iPart).x,
-						pShape->Get_Point(iPoint, iPart).y,
-						pShape->asDouble(m_zField)
-					);
-				}
-			}
-		}
-	}
-
-	//-----------------------------------------------------
-	if( (n = m_Points.Get_Count()) > 4 )
-	{
-		m_G	.Create(n + 1);
-		m_W	.Create(n + 1, n + 1);
-
-		for(i=0; i<n; i++)
-		{
-			m_W[i][i]	= 0.0;				// diagonal...
-			m_W[i][n]	= m_W[n][i]	= 1.0;	// edge...
-
-			for(j=i+1; j<n; j++)
-			{
-				m_W[i][j]	= m_W[j][i]	= Get_Weight(
-					m_Points[i].x - m_Points[j].x,
-					m_Points[i].y - m_Points[j].y
-				);
-			}
-		}
-
-		m_W[n][n]	= 0.0;
-
-		return( m_W.Set_Inverse(false) );
-	}
-
-	return( false );
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
diff --git a/src/modules/statistics/statistics_kriging/_kriging_universal.cpp b/src/modules/statistics/statistics_kriging/_kriging_universal.cpp
deleted file mode 100644
index ab73d89..0000000
--- a/src/modules/statistics/statistics_kriging/_kriging_universal.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-/**********************************************************
- * Version $Id: _kriging_universal.cpp 1921 2014-01-09 10:24:11Z oconrad $
- *********************************************************/
-
-///////////////////////////////////////////////////////////
-//                                                       //
-//                         SAGA                          //
-//                                                       //
-//      System for Automated Geoscientific Analyses      //
-//                                                       //
-//                    Module Library:                    //
-//                 Geostatistics_Kriging                 //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//                 _Kriging_Universal.cpp                //
-//                                                       //
-//                 Copyright (C) 2003 by                 //
-//                      Olaf Conrad                      //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-// This file is part of 'SAGA - System for Automated     //
-// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
-//                                                       //
-// SAGA is distributed in the hope that it will be       //
-// useful, but WITHOUT ANY WARRANTY; without even the    //
-// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
-// PARTICULAR PURPOSE. See the GNU General Public        //
-// License for more details.                             //
-//                                                       //
-// You should have received a copy of the GNU General    //
-// Public License along with this program; if not,       //
-// write to the Free Software Foundation, Inc.,          //
-// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
-// USA.                                                  //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//    e-mail:     oconrad at saga-gis.org                   //
-//                                                       //
-//    contact:    Olaf Conrad                            //
-//                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
-//                Germany                                //
-//                                                       //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#include "_kriging_universal.h"
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-C_Kriging_Universal::C_Kriging_Universal(void)
-	: C_Kriging_Universal_Global()
-{
-	Set_Name		(_TL("[deprecated] Universal Kriging"));
-
-	Set_Author		(SG_T("(c) 2003 by O.Conrad"));
-
-	Set_Description	(_TW(
-		"Universal Kriging for grid interpolation from irregular sample points."
-	));
-
-	//-----------------------------------------------------
-	Parameters.Add_Value(
-		NULL	, "MAXRADIUS"	, _TL("Maximum Search Radius (map units)"),
-		_TL(""),
-		PARAMETER_TYPE_Double	, 1000.0, 0, true
-	);
-
-	Parameters.Add_Range(
-		NULL	, "NPOINTS"		, _TL("Min./Max. Number of m_Points"),
-		_TL(""), 4, 20, 1, true
-	);
-}
-
-//---------------------------------------------------------
-C_Kriging_Universal::~C_Kriging_Universal(void)
-{}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-bool C_Kriging_Universal::On_Initialise(void)
-{
-	m_pGrids		= Parameters("GRIDS")		->asGridList();
-	m_Interpolation	= Parameters("INTERPOL")	->asInt();
-
-	m_Radius		= Parameters("MAXRADIUS")	->asDouble();
-
-	m_nPoints_Min	= (int)Parameters("NPOINTS")->asRange()->Get_LoVal();
-	m_nPoints_Max	= (int)Parameters("NPOINTS")->asRange()->Get_HiVal();
-
-	//-----------------------------------------------------
-	if( m_Search.Create(m_pShapes, m_zField) )
-	{
-		m_Points.Set_Count	(m_nPoints_Max);
-		m_G		.Create		(m_nPoints_Max + 1 + m_pGrids->Get_Count());
-		m_W		.Create		(m_nPoints_Max + 1 + m_pGrids->Get_Count(), m_nPoints_Max + 1 + m_pGrids->Get_Count());
-
-		return( true );
-	}
-
-	return( false );
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-bool C_Kriging_Universal::Get_Value(double x, double y, double &z, double &v)
-{
-	int		i, j, n, nGrids;
-	double	Lambda;
-
-	//-----------------------------------------------------
-	if(	(n = Get_Weights(x, y)) > 0 && (nGrids = m_pGrids->Get_Count()) > 0 )
-	{
-		for(i=0; i<n; i++)
-		{
-			if( !m_bBlock )
-			{
-				m_G[i]	=	Get_Weight(x - m_Points[i].x, y - m_Points[i].y);
-			}
-			else
-			{
-				m_G[i]	= (	Get_Weight((x          ) - m_Points[i].x, (y          ) - m_Points[i].y)
-						+	Get_Weight((x + m_Block) - m_Points[i].x, (y + m_Block) - m_Points[i].y)
-						+	Get_Weight((x + m_Block) - m_Points[i].x, (y - m_Block) - m_Points[i].y)
-						+	Get_Weight((x - m_Block) - m_Points[i].x, (y + m_Block) - m_Points[i].y)
-						+	Get_Weight((x - m_Block) - m_Points[i].x, (y - m_Block) - m_Points[i].y) ) / 5.0;
-			}
-		}
-
-		m_G[n]	= 1.0;
-
-		for(i=0, j=n+1; i<nGrids; i++, j++)
-		{
-			if( !m_pGrids->asGrid(i)->Get_Value(x, y, m_G[j], m_Interpolation) )
-			{
-				return( false );
-			}
-		}
-
-		//-------------------------------------------------
-		for(i=0, z=0.0, v=0.0; i<n; i++)
-		{
-			for(j=0, Lambda=0.0; j<=n+nGrids; j++)
-			{
-				Lambda	+= m_W[i][j] * m_G[j];
-			}
-
-			z	+= Lambda * m_Points[i].z;
-			v	+= Lambda * m_G[i];
-		}
-
-		//-------------------------------------------------
-		return( true );
-	}
-
-	return( false );
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-int C_Kriging_Universal::Get_Weights(double x, double y)
-{
-	int		i, j, n, iGrid, nGrids;
-
-	//-----------------------------------------------------
-	if( (n = m_Search.Select_Nearest_Points(x, y, m_nPoints_Max, m_Radius)) >= m_nPoints_Min  && (nGrids = m_pGrids->Get_Count()) > 0 )
-	{
-		for(i=0; i<n; i++)
-		{
-			m_Search.Get_Selected_Point(i, m_Points[i].x, m_Points[i].y, m_Points[i].z);
-		}
-
-		//-------------------------------------------------
-		for(i=0; i<n; i++)
-		{
-			m_W[i][i]	= 0.0;				// diagonal...
-			m_W[i][n]	= m_W[n][i]	= 1.0;	// edge...
-
-			for(j=i+1; j<n; j++)
-			{
-				m_W[i][j]	= m_W[j][i]	= Get_Weight(
-					m_Points[i].x - m_Points[j].x,
-					m_Points[i].y - m_Points[j].y
-				);
-			}
-
-			for(iGrid=0, j=n+1; iGrid<nGrids; iGrid++, j++)
-			{
-				m_W[i][j]	= m_W[j][i]	= m_pGrids->asGrid(iGrid)->Get_Value(
-					m_Points[i].x, m_Points[i].y, m_Interpolation
-				);
-			}
-		}
-
-		for(i=n; i<=n+nGrids; i++)
-		{
-			for(j=n; j<=n+nGrids; j++)
-			{
-				m_W[i][j]	= 0.0;
-			}
-		}
-
-		if( m_W.Set_Inverse(true, n + 1 + nGrids) )
-		{
-			return( n );
-		}
-	}	
-
-	return( 0 );
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
diff --git a/src/modules/statistics/statistics_kriging/_kriging_universal.h b/src/modules/statistics/statistics_kriging/_kriging_universal.h
deleted file mode 100644
index 0dc62ec..0000000
--- a/src/modules/statistics/statistics_kriging/_kriging_universal.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/**********************************************************
- * Version $Id: _kriging_universal.h 1921 2014-01-09 10:24:11Z oconrad $
- *********************************************************/
-
-///////////////////////////////////////////////////////////
-//                                                       //
-//                         SAGA                          //
-//                                                       //
-//      System for Automated Geoscientific Analyses      //
-//                                                       //
-//                    Module Library:                    //
-//                 Geostatistics_Kriging                 //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//                  _Kriging_Universal.h                 //
-//                                                       //
-//                 Copyright (C) 2003 by                 //
-//                      Olaf Conrad                      //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-// This file is part of 'SAGA - System for Automated     //
-// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
-//                                                       //
-// SAGA is distributed in the hope that it will be       //
-// useful, but WITHOUT ANY WARRANTY; without even the    //
-// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
-// PARTICULAR PURPOSE. See the GNU General Public        //
-// License for more details.                             //
-//                                                       //
-// You should have received a copy of the GNU General    //
-// Public License along with this program; if not,       //
-// write to the Free Software Foundation, Inc.,          //
-// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
-// USA.                                                  //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//    e-mail:     oconrad at saga-gis.org                   //
-//                                                       //
-//    contact:    Olaf Conrad                            //
-//                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
-//                Germany                                //
-//                                                       //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//                                                       //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#ifndef HEADER_INCLUDED___Kriging_UNIVERSAL_H
-#define HEADER_INCLUDED___Kriging_UNIVERSAL_H
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#include "_kriging_universal_global.h"
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-class C_Kriging_Universal : public C_Kriging_Universal_Global
-{
-public:
-	C_Kriging_Universal(void);
-	virtual ~C_Kriging_Universal(void);
-
-
-protected:
-
-	virtual bool			On_Initialise	(void);
-
-	virtual bool			Get_Value		(double x, double y, double &z, double &Variance);
-
-
-private:
-
-	int						m_nPoints_Min, m_nPoints_Max;
-
-	double					m_Radius;
-
-
-	int						Get_Weights		(double x, double y);
-
-};
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED___Kriging_UNIVERSAL_H
diff --git a/src/modules/statistics/statistics_kriging/_kriging_universal_global.cpp b/src/modules/statistics/statistics_kriging/_kriging_universal_global.cpp
deleted file mode 100644
index aa6ae39..0000000
--- a/src/modules/statistics/statistics_kriging/_kriging_universal_global.cpp
+++ /dev/null
@@ -1,282 +0,0 @@
-/**********************************************************
- * Version $Id: _kriging_universal_global.cpp 1921 2014-01-09 10:24:11Z oconrad $
- *********************************************************/
-
-///////////////////////////////////////////////////////////
-//                                                       //
-//                         SAGA                          //
-//                                                       //
-//      System for Automated Geoscientific Analyses      //
-//                                                       //
-//                    Module Library:                    //
-//                 Geostatistics_Kriging                 //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//             _Kriging_Universal_Global.cpp             //
-//                                                       //
-//                 Copyright (C) 2003 by                 //
-//                      Olaf Conrad                      //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-// This file is part of 'SAGA - System for Automated     //
-// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
-//                                                       //
-// SAGA is distributed in the hope that it will be       //
-// useful, but WITHOUT ANY WARRANTY; without even the    //
-// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
-// PARTICULAR PURPOSE. See the GNU General Public        //
-// License for more details.                             //
-//                                                       //
-// You should have received a copy of the GNU General    //
-// Public License along with this program; if not,       //
-// write to the Free Software Foundation, Inc.,          //
-// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
-// USA.                                                  //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//    e-mail:     oconrad at saga-gis.org                   //
-//                                                       //
-//    contact:    Olaf Conrad                            //
-//                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
-//                Germany                                //
-//                                                       //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#include "_kriging_universal_global.h"
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-C_Kriging_Universal_Global::C_Kriging_Universal_Global(void)
-	: C_Kriging_Base()
-{
-	Set_Name		(_TL("[deprecated] Universal Kriging (Global)"));
-
-	Set_Author		(SG_T("(c) 2003 by O.Conrad"));
-
-	Set_Description	(_TW(
-		"Universal Kriging for grid interpolation from irregular sample points.\n"
-		"This implementation does not use a maximum search radius. The weighting "
-		"matrix is generated globally for all points."
-	));
-
-	//-----------------------------------------------------
-	Parameters.Add_Grid_List(
-		NULL	, "GRIDS"		, _TL("Grids"),
-		_TL(""),
-		PARAMETER_INPUT
-	);
-
-	Parameters.Add_Choice(
-		NULL	,"INTERPOL"		, _TL("Grid Interpolation"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|%s|%s|%s|"),
-			_TL("Nearest Neighbor"),
-			_TL("Bilinear Interpolation"),
-			_TL("Inverse Distance Interpolation"),
-			_TL("Bicubic Spline Interpolation"),
-			_TL("B-Spline Interpolation")
-		), 4
-	);
-}
-
-//---------------------------------------------------------
-C_Kriging_Universal_Global::~C_Kriging_Universal_Global(void)
-{}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-bool C_Kriging_Universal_Global::On_Initialise(void)
-{
-	m_pGrids		= Parameters("GRIDS")		->asGridList();
-	m_Interpolation	= Parameters("INTERPOL")	->asInt();
-
-	return( Get_Weights() );
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-bool C_Kriging_Universal_Global::Get_Value(double x, double y, double &z, double &v)
-{
-	int		i, j, n, nGrids;
-	double	Lambda;
-
-	//-----------------------------------------------------
-	if(	(n = m_Points.Get_Count()) > 1 && (nGrids = m_pGrids->Get_Count()) > 0 )
-	{
-		for(i=0; i<n; i++)
-		{
-			if( !m_bBlock )
-			{
-				m_G[i]	=	Get_Weight(x - m_Points[i].x, y - m_Points[i].y);
-			}
-			else
-			{
-				m_G[i]	= (	Get_Weight((x          ) - m_Points[i].x, (y          ) - m_Points[i].y)
-						+	Get_Weight((x + m_Block) - m_Points[i].x, (y + m_Block) - m_Points[i].y)
-						+	Get_Weight((x + m_Block) - m_Points[i].x, (y - m_Block) - m_Points[i].y)
-						+	Get_Weight((x - m_Block) - m_Points[i].x, (y + m_Block) - m_Points[i].y)
-						+	Get_Weight((x - m_Block) - m_Points[i].x, (y - m_Block) - m_Points[i].y) ) / 5.0;
-			}
-		}
-
-		m_G[n]	= 1.0;
-
-		for(i=0, j=n+1; i<nGrids; i++, j++)
-		{
-			if( !m_pGrids->asGrid(i)->Get_Value(x, y, m_G[j], m_Interpolation, false, true) )
-			{
-				return( false );
-			}
-		}
-
-		//-------------------------------------------------
-		for(i=0, z=0.0, v=0.0; i<n; i++)
-		{
-			for(j=0, Lambda=0.0; j<=n+nGrids; j++)
-			{
-				Lambda	+= m_W[i][j] * m_G[j];
-			}
-
-			z	+= Lambda * m_Points[i].z;
-			v	+= Lambda * m_G[i];
-		}
-
-		//-------------------------------------------------
-		return( true );
-	}
-
-	return( false );
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-bool C_Kriging_Universal_Global::Get_Weights(void)
-{
-	int		i, j, n, iGrid, nGrids;
-
-	//-----------------------------------------------------
-	if( (nGrids = m_pGrids->Get_Count()) > 0 )
-	{
-		for(int iShape=0; iShape<m_pShapes->Get_Count(); iShape++)
-		{
-			CSG_Shape	*pShape	= m_pShapes->Get_Shape(iShape);
-
-			if( !pShape->is_NoData(m_zField) )
-			{
-				for(int iPart=0; iPart<pShape->Get_Part_Count(); iPart++)
-				{
-					for(int iPoint=0; iPoint<pShape->Get_Point_Count(iPart); iPoint++)
-					{
-						bool		bAdd;
-						CSG_Point	p(pShape->Get_Point(iPoint, iPart));
-
-						for(j=0, bAdd=true; j<nGrids && bAdd; j++)
-						{
-							if( !m_pGrids->asGrid(j)->is_InGrid_byPos(p) )
-							{
-								bAdd	= false;
-							}
-						}
-
-						if( bAdd )
-						{
-							m_Points.Add(p.Get_X(), p.Get_Y(), pShape->asDouble(m_zField));
-						}
-					}
-				}
-			}
-		}
-
-		//-------------------------------------------------
-		if( (n = m_Points.Get_Count()) > 1 )
-		{
-			m_G.Create(n + 1 + nGrids);
-			m_W.Create(n + 1 + nGrids, n + 1 + nGrids);
-
-			for(i=0; i<n; i++)
-			{
-				m_W[i][i]	= 0.0;				// diagonal...
-				m_W[i][n]	= m_W[n][i]	= 1.0;	// edge...
-
-				for(j=i+1; j<n; j++)
-				{
-					m_W[i][j]	= m_W[j][i]	= Get_Weight(
-						m_Points[i].x - m_Points[j].x,
-						m_Points[i].y - m_Points[j].y
-					);
-				}
-
-				for(iGrid=0, j=n+1; iGrid<nGrids; iGrid++, j++)
-				{
-					m_W[i][j]	= m_W[j][i]	= m_pGrids->asGrid(iGrid)->Get_Value(
-						m_Points[i].x, m_Points[i].y, m_Interpolation
-					);
-				}
-			}
-
-			for(i=n; i<=n+nGrids; i++)
-			{
-				for(j=n; j<=n+nGrids; j++)
-				{
-					m_W[i][j]	= 0.0;
-				}
-			}
-
-			return( m_W.Set_Inverse() );
-		}
-	}
-
-	return( 0 );
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
diff --git a/src/modules/statistics/statistics_kriging/_kriging_universal_global.h b/src/modules/statistics/statistics_kriging/_kriging_universal_global.h
deleted file mode 100644
index a4a44fb..0000000
--- a/src/modules/statistics/statistics_kriging/_kriging_universal_global.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/**********************************************************
- * Version $Id: _kriging_universal_global.h 1921 2014-01-09 10:24:11Z oconrad $
- *********************************************************/
-
-///////////////////////////////////////////////////////////
-//                                                       //
-//                         SAGA                          //
-//                                                       //
-//      System for Automated Geoscientific Analyses      //
-//                                                       //
-//                    Module Library:                    //
-//                 Geostatistics_Kriging                 //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//              _Kriging_Universal_Global.h              //
-//                                                       //
-//                 Copyright (C) 2003 by                 //
-//                      Olaf Conrad                      //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-// This file is part of 'SAGA - System for Automated     //
-// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
-//                                                       //
-// SAGA is distributed in the hope that it will be       //
-// useful, but WITHOUT ANY WARRANTY; without even the    //
-// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
-// PARTICULAR PURPOSE. See the GNU General Public        //
-// License for more details.                             //
-//                                                       //
-// You should have received a copy of the GNU General    //
-// Public License along with this program; if not,       //
-// write to the Free Software Foundation, Inc.,          //
-// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
-// USA.                                                  //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//    e-mail:     oconrad at saga-gis.org                   //
-//                                                       //
-//    contact:    Olaf Conrad                            //
-//                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
-//                Germany                                //
-//                                                       //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//                                                       //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#ifndef HEADER_INCLUDED___Kriging_Universal_Global_H
-#define HEADER_INCLUDED___Kriging_Universal_Global_H
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#include "_kriging_base.h"
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-class C_Kriging_Universal_Global : public C_Kriging_Base
-{
-public:
-	C_Kriging_Universal_Global(void);
-	virtual ~C_Kriging_Universal_Global(void);
-
-
-protected:
-
-	int						m_Interpolation;
-
-	CSG_Parameter_Grid_List	*m_pGrids;
-
-
-	virtual bool			On_Initialise	(void);
-
-	virtual bool			Get_Value		(double x, double y, double &z, double &Variance);
-
-
-private:
-
-	bool					Get_Weights		(void);
-
-};
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED___Kriging_Universal_Global_H
diff --git a/src/modules/statistics/statistics_kriging/kriging_base.cpp b/src/modules/statistics/statistics_kriging/kriging_base.cpp
index ac74f98..42f9239 100644
--- a/src/modules/statistics/statistics_kriging/kriging_base.cpp
+++ b/src/modules/statistics/statistics_kriging/kriging_base.cpp
@@ -76,8 +76,8 @@
 CKriging_Base::CKriging_Base(void)
 {
 	CSG_Parameter	*pNode;
-	CSG_Parameters	*pParameters;
 
+	///////////////////////////////////////////////////////
 	//-----------------------------------------------------
 	pNode	= Parameters.Add_Shapes(
 		NULL	, "POINTS"		, _TL("Points"),
@@ -86,10 +86,11 @@ CKriging_Base::CKriging_Base(void)
 	);
 
 	Parameters.Add_Table_Field(
-		pNode	, "ZFIELD"		, _TL("Attribute"),
+		pNode	, "FIELD"		, _TL("Attribute"),
 		_TL("")
 	);
 
+	///////////////////////////////////////////////////////
 	//-----------------------------------------------------
 	Parameters.Add_Choice(
 		NULL	, "TQUALITY"	, _TL("Type of Quality Measure"),
@@ -100,7 +101,6 @@ CKriging_Base::CKriging_Base(void)
 		), 0
 	);
 
-	//-----------------------------------------------------
 	Parameters.Add_Value(
 		NULL	, "LOG"			, _TL("Logarithmic Transformation"),
 		_TL(""),
@@ -110,13 +110,13 @@ CKriging_Base::CKriging_Base(void)
 	pNode	= Parameters.Add_Value(
 		NULL	, "BLOCK"		, _TL("Block Kriging"),
 		_TL(""),
-		PARAMETER_TYPE_Bool		, false
+		PARAMETER_TYPE_Bool, false
 	);
 
 	Parameters.Add_Value(
 		pNode	, "DBLOCK"		, _TL("Block Size"),
 		_TL(""),
-		PARAMETER_TYPE_Double	, 100.0, 0.0, true
+		PARAMETER_TYPE_Double, 100.0, 0.0, true
 	);
 
 	///////////////////////////////////////////////////////
@@ -126,13 +126,13 @@ CKriging_Base::CKriging_Base(void)
 		Parameters.Add_Value(
 			NULL	, "VAR_MAXDIST"		, _TL("Maximum Distance"),
 			_TL(""),
-			PARAMETER_TYPE_Double	, -1.0
+			PARAMETER_TYPE_Double, -1.0
 		);
 
 		Parameters.Add_Value(
 			NULL	, "VAR_NCLASSES"	, _TL("Lag Distance Classes"),
 			_TL("initial number of lag distance classes"),
-			PARAMETER_TYPE_Int		, 100, 1, true
+			PARAMETER_TYPE_Int, 100, 1, true
 		);
 
 		Parameters.Add_Value(
@@ -146,6 +146,12 @@ CKriging_Base::CKriging_Base(void)
 			_TL(""),
 			SG_T("a + b * x")
 		);
+
+		m_pVariogram	= NULL;
+	}
+	else
+	{
+		m_pVariogram	= new CVariogram_Dialog;
 	}
 
 	///////////////////////////////////////////////////////
@@ -154,21 +160,36 @@ CKriging_Base::CKriging_Base(void)
 
 	m_Grid_Target.Add_Grid("PREDICTION", _TL("Prediction"     ), false);
 	m_Grid_Target.Add_Grid("VARIANCE"  , _TL("Quality Measure"), true);
+
+	//-----------------------------------------------------
+	m_Search.Create(&Parameters, Parameters.Add_Node(NULL, "NODE_SEARCH", _TL("Search Options"), _TL("")), 16);
+}
+
+///////////////////////////////////////////////////////////
+//---------------------------------------------------------
+CKriging_Base::~CKriging_Base(void)
+{
+	if( m_pVariogram && SG_UI_Get_Window_Main() )	// don't destroy dialog, if gui is closing (i.e. main window == NULL)
+	{
+		m_pVariogram->Destroy();
+
+		delete(m_pVariogram);
+	}
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 int CKriging_Base::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	if( !SG_STR_CMP(pParameter->Get_Identifier(), "POINTS") && pParameter->asShapes() )
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "POINTS") )
 	{
-		m_Grid_Target.Set_User_Defined(pParameters, pParameter->asShapes()->Get_Extent());
+		m_Search.On_Parameter_Changed(pParameters, pParameter);
+
+		m_Grid_Target.Set_User_Defined(pParameters, pParameter->asShapes());
 	}
 
 	return( m_Grid_Target.On_Parameter_Changed(pParameters, pParameter) ? 1 : 0 );
@@ -177,30 +198,19 @@ int CKriging_Base::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Paramet
 //---------------------------------------------------------
 int CKriging_Base::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), "SEARCH_RANGE") )
-	{
-		pParameters->Set_Enabled("SEARCH_RADIUS"    , pParameter->asInt() == 0);	// local
-	}
-
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), "SEARCH_POINTS_ALL") )
-	{
-		pParameters->Set_Enabled("SEARCH_POINTS_MAX", pParameter->asInt() == 0);	// maximum number of points
-		pParameters->Set_Enabled("SEARCH_DIRECTION" , pParameter->asInt() == 0);	// maximum number of points per quadrant
-	}
-
 	if(	!SG_STR_CMP(pParameter->Get_Identifier(), "BLOCK") )
 	{
-		pParameters->Set_Enabled("DBLOCK"           , pParameter->asBool()    );	// block size
+		pParameters->Set_Enabled("DBLOCK", pParameter->asBool());	// block size
 	}
 
+	m_Search.On_Parameters_Enable(pParameters, pParameter);
+
 	return( m_Grid_Target.On_Parameters_Enable(pParameters, pParameter) ? 1 : 0 );
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
@@ -214,7 +224,7 @@ bool CKriging_Base::On_Execute(void)
 	m_bLog		= Parameters("LOG"     )->asBool();
 
 	m_pPoints	= Parameters("POINTS"  )->asShapes();
-	m_zField	= Parameters("ZFIELD"  )->asInt();
+	m_zField	= Parameters("FIELD"   )->asInt();
 
 	if( m_pPoints->Get_Count() <= 1 )
 	{
@@ -226,11 +236,9 @@ bool CKriging_Base::On_Execute(void)
 	//-----------------------------------------------------
 	CSG_Table	Variogram;
 
-	if( SG_UI_Get_Window_Main() )
+	if( m_pVariogram )
 	{
-		static CVariogram_Dialog	dlg;
-
-		if( dlg.Execute(m_pPoints, m_zField, m_bLog, &Variogram, &m_Model) )
+		if( m_pVariogram->Execute(m_pPoints, m_zField, m_bLog, &Variogram, &m_Model) )
 		{
 			bResult	= true;
 		}
@@ -283,9 +291,10 @@ bool CKriging_Base::On_Execute(void)
 	}
 
 	//-----------------------------------------------------
-	m_Model.Clr_Data();
-
-	On_Finalize();
+	m_Model .Clr_Data();
+	m_Search.Finalize();
+	m_Data  .Clear();
+	m_W     .Destroy();
 
 	return( bResult );
 }
@@ -293,22 +302,20 @@ bool CKriging_Base::On_Execute(void)
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 bool CKriging_Base::_Initialise_Grids(void)
 {
-	m_Grid_Target.Set_User_Defined(Get_Parameters("TARGET"), m_pPoints->Get_Extent());	Dlg_Parameters("TARGET");	// if called from saga_cmd
+	m_Grid_Target.Cmd_Update(m_pPoints);	// if called from saga_cmd
 
 	if( (m_pGrid = m_Grid_Target.Get_Grid("PREDICTION")) != NULL )
 	{
-		m_pGrid->Set_Name(CSG_String::Format(SG_T("%s [%s]"), Parameters("ZFIELD")->asString(), Get_Name().c_str()));
+		m_pGrid->Set_Name(CSG_String::Format(SG_T("%s.%s [%s]"), Parameters("POINTS")->asShapes()->Get_Name(), Parameters("FIELD")->asString(), Get_Name().c_str()));
 
 		if( (m_pVariance = m_Grid_Target.Get_Grid("VARIANCE")) != NULL )
 		{
-			m_pVariance->Set_Name(CSG_String::Format(SG_T("%s [%s %s]"), Parameters("ZFIELD")->asString(), Get_Name().c_str(), m_bStdDev ? _TL("Standard Deviation") : _TL("Variance")));
+			m_pVariance->Set_Name(CSG_String::Format(SG_T("%s.%s [%s %s]"), Parameters("POINTS")->asShapes()->Get_Name(), Parameters("FIELD")->asString(), Get_Name().c_str(), m_bStdDev ? _TL("Standard Deviation") : _TL("Variance")));
 		}
 
 		return( true );
@@ -320,6 +327,54 @@ bool CKriging_Base::_Initialise_Grids(void)
 
 ///////////////////////////////////////////////////////////
 //														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CKriging_Base::On_Initialize(void)
+{
+	//-----------------------------------------------------
+	if( m_Search.Do_Use_All(true) )	// global
+	{
+		m_Data.Clear();
+
+		for(int i=0; i<m_pPoints->Get_Count(); i++)
+		{
+			CSG_Shape	*pPoint	= m_pPoints->Get_Shape(i);
+
+			if( !pPoint->is_NoData(m_zField) )
+			{
+				m_Data.Add(pPoint->Get_Point(0).x, pPoint->Get_Point(0).y, m_bLog ? log(pPoint->asDouble(m_zField)) : pPoint->asDouble(m_zField));
+			}
+		}
+
+		return( Get_Weights(m_Data, m_W) );
+	}
+
+	//-----------------------------------------------------
+	if( m_bLog )
+	{
+		CSG_Shapes	Points(SHAPE_TYPE_Point); Points.Add_Field("Z", SG_DATATYPE_Double);
+
+		for(int i=0; i<m_pPoints->Get_Count() && Set_Progress(i, m_pPoints->Get_Count()); i++)
+		{
+			CSG_Shape	*pPoint	= m_pPoints->Get_Shape(i);
+
+			if( !pPoint->is_NoData(m_zField) )
+			{
+				Points.Add_Shape(pPoint, SHAPE_COPY_GEOM)->Set_Value(0, log(pPoint->asDouble(m_zField)));
+			}
+		}
+
+		return( m_Search.Initialize(&Points, 0) );
+	}
+
+	//-----------------------------------------------------
+	return( m_Search.Initialize(m_pPoints, m_zField) );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
 //														 //
 //														 //
 ///////////////////////////////////////////////////////////
diff --git a/src/modules/statistics/statistics_kriging/kriging_base.h b/src/modules/statistics/statistics_kriging/kriging_base.h
index b46861a..c2c599a 100644
--- a/src/modules/statistics/statistics_kriging/kriging_base.h
+++ b/src/modules/statistics/statistics_kriging/kriging_base.h
@@ -86,31 +86,40 @@ class CKriging_Base : public CSG_Module
 {
 public:
 	CKriging_Base(void);
+	~CKriging_Base(void);
 
 
 protected:
 
-	bool						m_bLog;
+	bool							m_bLog;
 
-	int							m_zField;
+	int								m_zField;
 
-	CSG_Shapes					*m_pPoints;
+	CSG_Points_Z					m_Data;
 
+	CSG_Matrix						m_W;
 
-	virtual bool				On_Execute				(void);
+	CSG_Shapes						*m_pPoints;
 
-	virtual int					On_Parameter_Changed	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
-	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+	CSG_Parameters_Search_Points	m_Search;
 
-	virtual bool				On_Initialize			(void)	{	return( true );	}
-	virtual bool				On_Finalize				(void)	{	return( true );	}
 
-	virtual bool				Get_Value				(const TSG_Point &p, double &z, double &v)	= 0;
+	virtual bool					On_Execute				(void);
 
-	double						Get_Weight				(double d)											{	return( m_Model.Get_Value(d) );	}
-	double						Get_Weight				(double dx, double dy)								{	return( Get_Weight(sqrt(dx*dx + dy*dy)) );	}
-	double						Get_Weight				(const TSG_Point_Z &a, const TSG_Point_Z &b)		{	return( Get_Weight(a.x - b.x, a.y - b.y) );	}
-	double						Get_Weight				(double ax, double ay, double bx, double by)
+	virtual int						On_Parameter_Changed	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+	virtual int						On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+
+	virtual bool					On_Initialize			(void);
+
+	virtual bool					Get_Weights				(const CSG_Points_Z &Points, CSG_Matrix &W)	= 0;
+
+	virtual bool					Get_Value				(const TSG_Point &p, double &z, double &v)	= 0;
+
+	double							Get_Weight				(double d)											{	return( m_Model.Get_Value(d) );	}
+	double							Get_Weight				(double dx, double dy)								{	return( Get_Weight(sqrt(dx*dx + dy*dy)) );	}
+	double							Get_Weight				(const TSG_Point_Z &a, const TSG_Point_Z &b)		{	return( Get_Weight(a.x - b.x, a.y - b.y) );	}
+	double							Get_Weight				(const TSG_Point   &a, const TSG_Point_Z &b)		{	return( Get_Weight(a.x - b.x, a.y - b.y) );	}
+	double							Get_Weight				(double ax, double ay, double bx, double by)
 	{
 		if( m_Block > 0.0 )
 		{
@@ -125,13 +134,13 @@ protected:
 		return( Get_Weight(ax - bx, ay - by) );
 	}
 
-	void						Set_Value				(int x, int y, double z, double v)
+	void							Set_Value				(int x, int y, double z, double v)
 	{
 		if( m_pGrid     )	m_pGrid    ->Set_Value(x, y, m_bLog    ? exp (z) : z);
 		if( m_pVariance )	m_pVariance->Set_Value(x, y, m_bStdDev ? sqrt(v) : v);
 	}
 
-	void						Set_NoData				(int x, int y)
+	void							Set_NoData				(int x, int y)
 	{
 		if( m_pGrid     )	m_pGrid    ->Set_NoData(x, y);
 		if( m_pVariance )	m_pVariance->Set_NoData(x, y);
@@ -140,18 +149,20 @@ protected:
 
 private:
 
-	bool						m_bStdDev;
+	bool							m_bStdDev;
+
+	double							m_Block;
 
-	double						m_Block;
+	CSG_Parameters_Grid_Target		m_Grid_Target;
 
-	CSG_Parameters_Grid_Target	m_Grid_Target;
+	CSG_Trend						m_Model;
 
-	CSG_Trend					m_Model;
+	CSG_Grid						*m_pGrid, *m_pVariance;
 
-	CSG_Grid					*m_pGrid, *m_pVariance;
+	class CVariogram_Dialog			*m_pVariogram;
 
 
-	bool						_Initialise_Grids		(void);
+	bool							_Initialise_Grids		(void);
 
 };
 
diff --git a/src/modules/statistics/statistics_kriging/kriging_ordinary.cpp b/src/modules/statistics/statistics_kriging/kriging_ordinary.cpp
index 6af8ee1..8cf6291 100644
--- a/src/modules/statistics/statistics_kriging/kriging_ordinary.cpp
+++ b/src/modules/statistics/statistics_kriging/kriging_ordinary.cpp
@@ -72,139 +72,30 @@
 
 //---------------------------------------------------------
 CKriging_Ordinary::CKriging_Ordinary(void)
-	: CKriging_Ordinary_Global()
 {
-	CSG_Parameter	*pNode;
-
 	//-----------------------------------------------------
 	Set_Name		(_TL("Ordinary Kriging"));
 
-	Set_Author		(SG_T("O.Conrad (c) 2008"));
+	Set_Author		("O.Conrad (c) 2008");
 
 	Set_Description	(_TW(
 		"Ordinary Kriging for grid interpolation from irregular sample points."
 	));
 
 	//-----------------------------------------------------
-	CSG_Parameter	*pSearch	= Parameters.Add_Node(
-		NULL	, "NODE_SEARCH"			, _TL("Search Options"),
-		_TL("")
-	);
-
-	pNode	= Parameters.Add_Choice(
-		pSearch	, "SEARCH_RANGE"		, _TL("Search Range"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("local"),
-			_TL("global")
-		)
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_RADIUS"		, _TL("Maximum Search Distance"),
-		_TL("local maximum search distance given in map units"),
-		PARAMETER_TYPE_Double	, 1000.0, 0, true
-	);
-
-	pNode	= Parameters.Add_Choice(
-		pSearch	, "SEARCH_POINTS_ALL"	, _TL("Number of Points"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("maximum number of nearest points"),
-			_TL("all points within search distance")
-		)
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_POINTS_MIN"	, _TL("Minimum"),
-		_TL("minimum number of points to use"),
-		PARAMETER_TYPE_Int, 4, 1, true
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_POINTS_MAX"	, _TL("Maximum"),
-		_TL("maximum number of nearest points"),
-		PARAMETER_TYPE_Int, 20, 1, true
-	);
-
-	Parameters.Add_Choice(
-		pNode	, "SEARCH_DIRECTION"	, _TL("Search Direction"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("all directions"),
-			_TL("quadrants")
-		)
-	);
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CKriging_Ordinary::On_Initialize(void)
+bool CKriging_Ordinary::Get_Weights(const CSG_Points_Z &Points, CSG_Matrix &W)
 {
-	m_nPoints_Min	= Parameters("SEARCH_POINTS_MIN")->asInt   ();
-	m_nPoints_Max	= Parameters("SEARCH_POINTS_ALL")->asInt   () == 0
-					? Parameters("SEARCH_POINTS_MAX")->asInt   () : 0;
-	m_Radius		= Parameters("SEARCH_RANGE"     )->asInt   () == 0
-					? Parameters("SEARCH_RADIUS"    )->asDouble() : 0.0;
-	m_Direction		= Parameters("SEARCH_DIRECTION" )->asInt   () == 0 ? -1 : 4;
-
-	//-----------------------------------------------------
-	if( m_nPoints_Max <= 0 && m_Radius <= 0 )	// global
-	{
-		return( CKriging_Ordinary_Global::On_Initialize() );
-	}
-
-	//-----------------------------------------------------
-	m_Search.Create(m_pPoints->Get_Extent());
-
-	for(int iPoint=0; iPoint<m_pPoints->Get_Count() && Set_Progress(iPoint, m_pPoints->Get_Count()); iPoint++)
-	{
-		CSG_Shape	*pPoint	= m_pPoints->Get_Shape(iPoint);
-
-		if( !pPoint->is_NoData(m_zField) )
-		{
-			m_Search.Add_Point(pPoint->Get_Point(0).x, pPoint->Get_Point(0).y, m_bLog ? log(pPoint->asDouble(m_zField)) : pPoint->asDouble(m_zField));
-		}
-	}
+	int	n	= Points.Get_Count();
 
-	if( !m_Search.is_Okay() )
-	{
-		SG_UI_Msg_Add(_TL("could not initialize point search engine"), true);
-
-		return( false );
-	}
-
-	//-----------------------------------------------------
-	return( true );
-}
-
-//---------------------------------------------------------
-bool CKriging_Ordinary::On_Finalize(void)
-{
-	m_Search.Destroy();
-
-	return( CKriging_Ordinary_Global::On_Finalize() );
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-int CKriging_Ordinary::Get_Weights(const TSG_Point &p, CSG_Matrix &W, CSG_Points_Z &Points)
-{
-	int		n	= m_Search.Get_Nearest_Points(Points, p, m_nPoints_Max, m_Radius, m_Direction);
-
-	if( n >= m_nPoints_Min )
+	if( n > 0 )
 	{
 		W.Create(n + 1, n + 1);
 
@@ -215,50 +106,55 @@ int CKriging_Ordinary::Get_Weights(const TSG_Point &p, CSG_Matrix &W, CSG_Points
 
 			for(int j=i+1; j<n; j++)
 			{
-				W[i][j]	= W[j][i]	= Get_Weight(Points[i], Points[j]);
+				W[i][j]	= W[j][i]	= Get_Weight(Points.Get_X(i), Points.Get_Y(i), Points.Get_X(j), Points.Get_Y(j));
 			}
 		}
 
 		W[n][n]	= 0.0;
 
-		if( W.Set_Inverse(true, 1 + n) )
-		{
-			return( n );
-		}
+		return( W.Set_Inverse(!m_Search.Do_Use_All(), n + 1) );
 	}
 
-	return( 0 );
+	return( false );
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 bool CKriging_Ordinary::Get_Value(const TSG_Point &p, double &z, double &v)
 {
 	//-----------------------------------------------------
-	if( m_nPoints_Max <= 0 && m_Radius <= 0 )	// global
+	int				i, n;
+	double			**W;
+	CSG_Matrix		_W;
+	CSG_Points_Z	_Data, *pData;
+
+	if( m_Search.Do_Use_All() )	// global
 	{
-		return( CKriging_Ordinary_Global::Get_Value(p, z, v) );
+		pData	= &m_Data;
+		W		= m_W.Get_Data();
+	}
+	else if( m_Search.Get_Points(p, _Data) && Get_Weights(_Data, _W) )	// local
+	{
+		pData	= &_Data;
+		W		= _W.Get_Data();
+	}
+	else
+	{
+		return( false );
 	}
 
 	//-----------------------------------------------------
-	int				i, j, n;
-	CSG_Points_Z	Points;
-	CSG_Matrix		W;
-
-	//-----------------------------------------------------
-	if(	(n = Get_Weights(p, W, Points)) > 0 )
+	if(	(n = pData->Get_Count()) > 0 )
 	{
 		CSG_Vector	G(n + 1);
 
 		for(i=0; i<n; i++)
 		{
-			G[i]	=	Get_Weight(p.x, p.y, Points[i].x, Points[i].y);
+			G[i]	= Get_Weight(p, pData->Get_Point(i));
 		}
 
 		G[n]	= 1.0;
@@ -268,12 +164,12 @@ bool CKriging_Ordinary::Get_Value(const TSG_Point &p, double &z, double &v)
 		{
 			double	Lambda	= 0.0;
 
-			for(j=0; j<=n; j++)
+			for(int j=0; j<=n; j++)
 			{
 				Lambda	+= W[i][j] * G[j];
 			}
 
-			z	+= Lambda * Points[i].z;
+			z	+= Lambda * pData->Get_Z(i);
 			v	+= Lambda * G[i];
 		}
 
diff --git a/src/modules/statistics/statistics_kriging/kriging_ordinary.h b/src/modules/statistics/statistics_kriging/kriging_ordinary.h
index e079a90..9959d26 100644
--- a/src/modules/statistics/statistics_kriging/kriging_ordinary.h
+++ b/src/modules/statistics/statistics_kriging/kriging_ordinary.h
@@ -72,7 +72,7 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#include "kriging_ordinary_global.h"
+#include "kriging_base.h"
 
 
 ///////////////////////////////////////////////////////////
@@ -82,7 +82,7 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-class CKriging_Ordinary : public CKriging_Ordinary_Global
+class CKriging_Ordinary : public CKriging_Base
 {
 public:
 	CKriging_Ordinary(void);
@@ -90,23 +90,10 @@ public:
 
 protected:
 
-	virtual bool			On_Initialize		(void);
-	virtual bool			On_Finalize			(void);
+	virtual bool			Get_Weights			(const CSG_Points_Z &Points, CSG_Matrix &W);
 
 	virtual bool			Get_Value			(const TSG_Point &p, double &z, double &v);
 
-
-private:
-
-	int						m_nPoints_Min, m_nPoints_Max, m_Direction;
-
-	double					m_Radius;
-
-	CSG_PRQuadTree			m_Search;
-
-
-	int						Get_Weights			(const TSG_Point &p, CSG_Matrix &W, CSG_Points_Z &Points);
-
 };
 
 
diff --git a/src/modules/statistics/statistics_kriging/kriging_regression.cpp b/src/modules/statistics/statistics_kriging/kriging_regression.cpp
new file mode 100644
index 0000000..5ffc969
--- /dev/null
+++ b/src/modules/statistics/statistics_kriging/kriging_regression.cpp
@@ -0,0 +1,405 @@
+/**********************************************************
+ * Version $Id: kriging_regression.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ *********************************************************/
+
+///////////////////////////////////////////////////////////
+//                                                       //
+//                         SAGA                          //
+//                                                       //
+//      System for Automated Geoscientific Analyses      //
+//                                                       //
+//                    Module Library:                    //
+//                 Geostatistics_Kriging                 //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//                 kriging_regression.cpp                //
+//                                                       //
+//                 Copyright (C) 2015 by                 //
+//                      Olaf Conrad                      //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+// This file is part of 'SAGA - System for Automated     //
+// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
+//                                                       //
+// SAGA is distributed in the hope that it will be       //
+// useful, but WITHOUT ANY WARRANTY; without even the    //
+// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
+// PARTICULAR PURPOSE. See the GNU General Public        //
+// License for more details.                             //
+//                                                       //
+// You should have received a copy of the GNU General    //
+// Public License along with this program; if not,       //
+// write to the Free Software Foundation, Inc.,          //
+// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
+// USA.                                                  //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//    e-mail:     oconrad at saga-gis.org                   //
+//                                                       //
+//    contact:    Olaf Conrad                            //
+//                Institute of Geography                 //
+//                University of Hamburg                  //
+//                Germany                                //
+//                                                       //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#include "kriging_regression.h"
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+CKriging_Regression::CKriging_Regression(void)
+{
+	CSG_Parameter	*pNode;
+
+	//-----------------------------------------------------
+	Set_Name		(_TL("Regression Kriging"));
+
+	Set_Author		("O.Conrad (c) 2015");
+
+	Set_Description	(_TW(
+		"Regression Kriging for grid interpolation from irregular sample points."
+	));
+
+	///////////////////////////////////////////////////////
+	//-----------------------------------------------------
+	pNode	= Parameters.Add_Shapes(
+		NULL	, "POINTS"		, _TL("Points"),
+		_TL(""),
+		PARAMETER_INPUT, SHAPE_TYPE_Point
+	);
+
+	Parameters.Add_Table_Field(
+		pNode	, "FIELD"		, _TL("Attribute"),
+		_TL("")
+	);
+
+	//-----------------------------------------------------
+	Parameters.Add_Grid_List(
+		NULL	, "PREDICTORS"	, _TL("Predictors"),
+		_TL(""),
+		PARAMETER_INPUT, true
+	);
+
+	Parameters.Add_Grid(
+		NULL	, "REGRESSION"	, _TL("Regression"),
+		_TL("regression model applied to predictor grids"),
+		PARAMETER_OUTPUT
+	);
+
+	Parameters.Add_Grid(
+		NULL	, "PREDICTION"	, _TL("Prediction"),
+		_TL(""),
+		PARAMETER_OUTPUT
+	);
+
+	Parameters.Add_Grid(
+		NULL	, "RESIDUALS"	, _TL("Residuals"),
+		_TL(""),
+		PARAMETER_OUTPUT_OPTIONAL
+	);
+
+	Parameters.Add_Grid(
+		NULL	, "VARIANCE"	, _TL("Quality Measure"),
+		_TL(""),
+		PARAMETER_OUTPUT_OPTIONAL
+	);
+
+	Parameters.Add_Choice(
+		NULL	, "TQUALITY"	, _TL("Type of Quality Measure"),
+		_TL(""),
+		CSG_String::Format(SG_T("%s|%s|"),
+			_TL("standard deviation"),
+			_TL("variance")
+		), 0
+	);
+
+	///////////////////////////////////////////////////////
+	//-----------------------------------------------------
+	Parameters.Add_Value(
+		NULL	, "LOG"			, _TL("Logarithmic Transformation"),
+		_TL(""),
+		PARAMETER_TYPE_Bool
+	);
+
+	pNode	= Parameters.Add_Value(
+		NULL	, "BLOCK"		, _TL("Block Kriging"),
+		_TL(""),
+		PARAMETER_TYPE_Bool, false
+	);
+
+	Parameters.Add_Value(
+		pNode	, "DBLOCK"		, _TL("Block Size"),
+		_TL(""),
+		PARAMETER_TYPE_Double, 100.0, 0.0, true
+	);
+
+	///////////////////////////////////////////////////////
+	//-----------------------------------------------------
+	if( !SG_UI_Get_Window_Main() )
+	{
+		Parameters.Add_Value(
+			NULL	, "VAR_MAXDIST"		, _TL("Maximum Distance"),
+			_TL(""),
+			PARAMETER_TYPE_Double, -1.0
+		);
+
+		Parameters.Add_Value(
+			NULL	, "VAR_NCLASSES"	, _TL("Lag Distance Classes"),
+			_TL("initial number of lag distance classes"),
+			PARAMETER_TYPE_Int, 100, 1, true
+		);
+
+		Parameters.Add_Value(
+			NULL	, "VAR_NSKIP"		, _TL("Skip"),
+			_TL(""),
+			PARAMETER_TYPE_Int, 1, 1, true
+		);
+
+		Parameters.Add_String(
+			NULL	, "VAR_MODEL"		, _TL("Model"),
+			_TL(""),
+			SG_T("a + b * x")
+		);
+	}
+
+	///////////////////////////////////////////////////////
+	//-----------------------------------------------------
+	Parameters.Add_Table(NULL	, "INFO_COEFF"	, _TL("Regression: Coefficients"), _TL(""), PARAMETER_OUTPUT_OPTIONAL);
+	Parameters.Add_Table(NULL	, "INFO_MODEL"	, _TL("Regression: Model"       ), _TL(""), PARAMETER_OUTPUT_OPTIONAL);
+	Parameters.Add_Table(NULL	, "INFO_STEPS"	, _TL("Regression: Steps"       ), _TL(""), PARAMETER_OUTPUT_OPTIONAL);
+
+	pNode	= Parameters.Add_Node(
+		NULL	, "NODE_REG",	_TL("Regression"),
+		_TL("")
+	);
+
+	Parameters.Add_Value(pNode	, "COORD_X"		, _TL("Include X Coordinate"), _TL(""), PARAMETER_TYPE_Bool, false);
+	Parameters.Add_Value(pNode	, "COORD_Y"		, _TL("Include Y Coordinate"), _TL(""), PARAMETER_TYPE_Bool, false);
+	Parameters.Add_Value(pNode	, "INTERCEPT"	, _TL("Intercept"           ), _TL(""), PARAMETER_TYPE_Bool, true );
+
+	Parameters.Add_Choice(
+		pNode	,"METHOD"		, _TL("Method"),
+		_TL(""),
+		CSG_String::Format(SG_T("%s|%s|%s|%s|"),
+			_TL("include all"),
+			_TL("forward"),
+			_TL("backward"),
+			_TL("stepwise")
+		), 3
+	);
+
+	Parameters.Add_Value(
+		pNode	, "P_VALUE"		, _TL("Significance Level"),
+		_TL("Significance level (aka p-value) as threshold for automated predictor selection, given as percentage"),
+		PARAMETER_TYPE_Double, 5.0, 0.0, true, 100.0, true
+	);
+
+	Parameters.Add_Choice(
+		pNode	,"INTERPOL"		, _TL("Grid Interpolation"),
+		_TL(""),
+		CSG_String::Format(SG_T("%s|%s|%s|%s|%s|"),
+			_TL("Nearest Neighbor"),
+			_TL("Bilinear Interpolation"),
+			_TL("Inverse Distance Interpolation"),
+			_TL("Bicubic Spline Interpolation"),
+			_TL("B-Spline Interpolation")
+		), 4
+	);
+
+	///////////////////////////////////////////////////////
+	//-----------------------------------------------------
+	m_Search.Create(&Parameters, Parameters.Add_Node(NULL, "NODE_SEARCH", _TL("Search Options"), _TL("")), 16);
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+int CKriging_Regression::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+{
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "POINTS") )
+	{
+		m_Search.On_Parameter_Changed(pParameters, pParameter);
+	}
+
+	//-----------------------------------------------------
+	return( CSG_Module_Grid::On_Parameter_Changed(pParameters, pParameter) );
+}
+
+//---------------------------------------------------------
+int CKriging_Regression::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+{
+	m_Search.On_Parameters_Enable(pParameters, pParameter);
+
+	//-----------------------------------------------------
+	return( CSG_Module_Grid::On_Parameters_Enable(pParameters, pParameter) );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CKriging_Regression::On_Execute(void)
+{
+	//-----------------------------------------------------
+	CSG_Shapes	Points(SHAPE_TYPE_Point);
+
+	CSG_Grid	*pPrediction	= Parameters("PREDICTION")->asGrid();
+	CSG_Grid	*pRegression	= Parameters("REGRESSION")->asGrid();
+	CSG_Grid	*pResiduals		= Parameters("RESIDUALS" )->asGrid();
+	CSG_Grid	*pVariance		= Parameters("VARIANCE"  )->asGrid();
+
+	//-----------------------------------------------------
+	if( !pResiduals )
+	{
+		pResiduals	= pPrediction;
+	}
+
+	//-----------------------------------------------------
+	SG_RUN_MODULE_ExitOnError("statistics_regression", 1,	// Multiple Regression Analysis (Points and Predictor Grids)
+			SG_MODULE_PARAMETER_SET("PREDICTORS", Parameters("PREDICTORS"))
+		&&	SG_MODULE_PARAMETER_SET("POINTS"    , Parameters("POINTS"    ))
+		&&	SG_MODULE_PARAMETER_SET("ATTRIBUTE" , Parameters("FIELD"     ))
+		&&	SG_MODULE_PARAMETER_SET("INFO_COEFF", Parameters("INFO_COEFF"))
+		&&	SG_MODULE_PARAMETER_SET("INFO_MODEL", Parameters("INFO_MODEL"))
+		&&	SG_MODULE_PARAMETER_SET("INFO_STEPS", Parameters("INFO_STEPS"))
+		&&	SG_MODULE_PARAMETER_SET("INTERPOL"  , Parameters("INTERPOL"  ))
+		&&	SG_MODULE_PARAMETER_SET("COORD_X"   , Parameters("COORD_X"   ))
+		&&	SG_MODULE_PARAMETER_SET("COORD_Y"   , Parameters("COORD_Y"   ))
+		&&	SG_MODULE_PARAMETER_SET("INTERCEPT" , Parameters("INTERCEPT" ))
+		&&	SG_MODULE_PARAMETER_SET("METHOD"    , Parameters("METHOD"    ))
+		&&	SG_MODULE_PARAMETER_SET("P_VALUE"   , Parameters("P_VALUE"   ))
+		&&	SG_MODULE_PARAMETER_SET("REGRESSION", pRegression)
+		&&	SG_MODULE_PARAMETER_SET("RESIDUALS" , &Points )
+	);
+
+	//-----------------------------------------------------
+	Process_Set_Text(m_OK.Get_Name());
+
+	m_OK.Set_Manager(NULL);
+
+	if( !SG_UI_Get_Window_Main() )	// saga_cmd
+	{
+		if( !m_OK.Set_Parameter("POINTS"           , &Points)
+		||  !m_OK.Set_Parameter("FIELD"            , 2)	// residual
+		||  !m_OK.Set_Parameter("LOG"              , Parameters("LOG"              ))
+		||  !m_OK.Set_Parameter("BLOCK"            , Parameters("BLOCK"            ))
+		||  !m_OK.Set_Parameter("DBLOCK"           , Parameters("DBLOCK"           ))
+		||  !m_OK.Set_Parameter("SEARCH_RANGE"     , Parameters("SEARCH_RANGE"     ))
+		||  !m_OK.Set_Parameter("SEARCH_RADIUS"    , Parameters("SEARCH_RADIUS"    ))
+		||  !m_OK.Set_Parameter("SEARCH_POINTS_ALL", Parameters("SEARCH_POINTS_ALL"))
+		||  !m_OK.Set_Parameter("SEARCH_POINTS_MIN", Parameters("SEARCH_POINTS_MIN"))
+		||  !m_OK.Set_Parameter("SEARCH_POINTS_MAX", Parameters("SEARCH_POINTS_MAX"))
+		||  !m_OK.Set_Parameter("SEARCH_DIRECTION" , Parameters("SEARCH_DIRECTION" ))
+		||  !m_OK.Set_Parameter("VAR_MAXDIST"      , Parameters("VAR_MAXDIST"      ))
+		||  !m_OK.Set_Parameter("VAR_NCLASSES"     , Parameters("VAR_NCLASSES"     ))
+		||  !m_OK.Set_Parameter("VAR_NSKIP"        , Parameters("VAR_NSKIP"        ))
+		||  !m_OK.Set_Parameter("VAR_MODEL"        , Parameters("VAR_MODEL"        ))
+		||  !m_OK.Set_Parameter("TARGET_DEFINITION", 1)	// grid or grid system
+		||  !m_OK.Set_Parameter("TARGET_PREDICTION", pResiduals)
+		||  !m_OK.Set_Parameter("TARGET_VARIANCE"  , pVariance ) )
+		{
+			Error_Set(CSG_String::Format(SG_T("%s [%s].[%s]"), _TL("could not initialize tool"), SG_T("statistics_regression"), m_OK.Get_Name().c_str()));
+
+			return( false );
+		}
+	}
+	else
+	{
+		if( !m_OK.Set_Parameter("POINTS"           , &Points)
+		||  !m_OK.Set_Parameter("FIELD"            , 2)	// residual
+		||  !m_OK.Set_Parameter("LOG"              , Parameters("LOG"              ))
+		||  !m_OK.Set_Parameter("BLOCK"            , Parameters("BLOCK"            ))
+		||  !m_OK.Set_Parameter("DBLOCK"           , Parameters("DBLOCK"           ))
+		||  !m_OK.Set_Parameter("SEARCH_RANGE"     , Parameters("SEARCH_RANGE"     ))
+		||  !m_OK.Set_Parameter("SEARCH_RADIUS"    , Parameters("SEARCH_RADIUS"    ))
+		||  !m_OK.Set_Parameter("SEARCH_POINTS_ALL", Parameters("SEARCH_POINTS_ALL"))
+		||  !m_OK.Set_Parameter("SEARCH_POINTS_MIN", Parameters("SEARCH_POINTS_MIN"))
+		||  !m_OK.Set_Parameter("SEARCH_POINTS_MAX", Parameters("SEARCH_POINTS_MAX"))
+		||  !m_OK.Set_Parameter("SEARCH_DIRECTION" , Parameters("SEARCH_DIRECTION" ))
+		||  !m_OK.Set_Parameter("DEFINITION"       , 1)	// grid or grid system
+		||  !m_OK.Set_Parameter("PREDICTION"       , pResiduals)
+		||  !m_OK.Set_Parameter("VARIANCE"         , pVariance ) )
+		{
+			Error_Set(CSG_String::Format(SG_T("%s [%s].[%s]"), _TL("could not initialize tool"), SG_T("statistics_regression"), m_OK.Get_Name().c_str()));
+
+			return( false );
+		}
+	}
+
+	if( !m_OK.Execute() )
+	{
+		Error_Set(CSG_String::Format(SG_T("%s [%s].[%s]"), _TL("could not execute tool"), SG_T("statistics_regression"), m_OK.Get_Name().c_str()));\
+
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	#pragma omp parallel for
+	for(int y=0; y<Get_NY(); y++)
+	{
+		for(int x=0; x<Get_NX(); x++)
+		{
+			if( pRegression->is_NoData(x, y) || pResiduals->is_NoData(x, y) )
+			{
+				pPrediction->Set_NoData(x, y);
+			}
+			else
+			{
+				pPrediction->Add_Value(x, y, pRegression->asDouble(x, y) + pResiduals->asDouble(x, y));
+			}
+		}
+	}
+
+	//-----------------------------------------------------
+	pRegression->Set_Name(CSG_String::Format("%s.%s [%s]", Parameters("POINTS")->asGrid()->Get_Name(), Parameters("FIELD")->asString(), _TL("Regression")));
+	pPrediction->Set_Name(CSG_String::Format("%s.%s [%s]", Parameters("POINTS")->asGrid()->Get_Name(), Parameters("FIELD")->asString(), _TL("Prediction")));
+
+	if( Parameters("RESIDUALS")->asGrid() )
+	{
+		pResiduals->Set_Name(CSG_String::Format("%s.%s [%s]", Parameters("POINTS")->asGrid()->Get_Name(), Parameters("FIELD")->asString(), _TL("Residuals")));
+	}
+
+	if( pVariance )
+	{
+		pVariance ->Set_Name(CSG_String::Format("%s.%s [%s]", Parameters("POINTS")->asGrid()->Get_Name(), Parameters("FIELD")->asString(), _TL("Quality")));
+	}
+
+	//-----------------------------------------------------
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
diff --git a/src/modules/statistics/statistics_kriging/_kriging_ordinary_global.h b/src/modules/statistics/statistics_kriging/kriging_regression.h
similarity index 80%
rename from src/modules/statistics/statistics_kriging/_kriging_ordinary_global.h
rename to src/modules/statistics/statistics_kriging/kriging_regression.h
index ccd1247..16fc366 100644
--- a/src/modules/statistics/statistics_kriging/_kriging_ordinary_global.h
+++ b/src/modules/statistics/statistics_kriging/kriging_regression.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: _kriging_ordinary_global.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: kriging_regression.h 1921 2014-01-09 10:24:11Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -9,13 +9,13 @@
 //      System for Automated Geoscientific Analyses      //
 //                                                       //
 //                    Module Library:                    //
-//                 Geostatistics_Kriging                 //
+//                  statistics_kriging                   //
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//               _Kriging_Ordinary_Global.h              //
+//                  kriging_regression.h                 //
 //                                                       //
-//                 Copyright (C) 2003 by                 //
+//                 Copyright (C) 2015 by                 //
 //                      Olaf Conrad                      //
 //                                                       //
 //-------------------------------------------------------//
@@ -44,9 +44,7 @@
 //                                                       //
 //    contact:    Olaf Conrad                            //
 //                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
+//                University of Hamburg                  //
 //                Germany                                //
 //                                                       //
 ///////////////////////////////////////////////////////////
@@ -61,8 +59,8 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#ifndef HEADER_INCLUDED___Kriging_Ordinary_Global_H
-#define HEADER_INCLUDED___Kriging_Ordinary_Global_H
+#ifndef HEADER_INCLUDED__kriging_regression_H
+#define HEADER_INCLUDED__kriging_regression_H
 
 
 ///////////////////////////////////////////////////////////
@@ -72,7 +70,7 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#include "_kriging_base.h"
+#include "kriging_ordinary.h"
 
 
 ///////////////////////////////////////////////////////////
@@ -82,23 +80,25 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-class C_Kriging_Ordinary_Global : public C_Kriging_Base
+class CKriging_Regression : public CSG_Module_Grid
 {
 public:
-	C_Kriging_Ordinary_Global(void);
-	virtual ~C_Kriging_Ordinary_Global(void);
+	CKriging_Regression(void);
 
 
 protected:
 
-	virtual bool			On_Initialise	(void);
+	virtual int						On_Parameter_Changed	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+	virtual int						On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
 
-	virtual bool			Get_Value		(double x, double y, double &z, double &Variance);
+	virtual bool					On_Execute				(void);
 
 
 private:
 
-	bool					Get_Weights		(void);
+	CKriging_Ordinary				m_OK;
+
+	CSG_Parameters_Search_Points	m_Search;
 
 };
 
@@ -110,4 +110,4 @@ private:
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED___Kriging_Ordinary_Global_H
+#endif // #ifndef HEADER_INCLUDED__kriging_regression_H
diff --git a/src/modules/statistics/statistics_kriging/kriging_ordinary_global.cpp b/src/modules/statistics/statistics_kriging/kriging_simple.cpp
similarity index 68%
rename from src/modules/statistics/statistics_kriging/kriging_ordinary_global.cpp
rename to src/modules/statistics/statistics_kriging/kriging_simple.cpp
index efbd090..dffe334 100644
--- a/src/modules/statistics/statistics_kriging/kriging_ordinary_global.cpp
+++ b/src/modules/statistics/statistics_kriging/kriging_simple.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: kriging_ordinary_global.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: kriging_simple.cpp 1921 2014-01-09 10:24:11Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -13,9 +13,9 @@
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//              Kriging_Ordinary_Global.cpp              //
+//                  kriging_simple.cpp                   //
 //                                                       //
-//                 Copyright (C) 2008 by                 //
+//                 Copyright (C) 2015 by                 //
 //                      Olaf Conrad                      //
 //                                                       //
 //-------------------------------------------------------//
@@ -44,9 +44,7 @@
 //                                                       //
 //    contact:    Olaf Conrad                            //
 //                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
+//                University of Hamburg                  //
 //                Germany                                //
 //                                                       //
 ///////////////////////////////////////////////////////////
@@ -61,7 +59,7 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#include "kriging_ordinary_global.h"
+#include "kriging_simple.h"
 
 
 ///////////////////////////////////////////////////////////
@@ -71,113 +69,102 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-CKriging_Ordinary_Global::CKriging_Ordinary_Global(void)
-	: CKriging_Base()
+CKriging_Simple::CKriging_Simple(void)
 {
-	Set_Name		(_TL("Ordinary Kriging (Global)"));
+	//-----------------------------------------------------
+	Set_Name		(_TL("Simple Kriging"));
 
-	Set_Author		(SG_T("O.Conrad (c) 2008"));
+	Set_Author		("O.Conrad (c) 2015");
 
 	Set_Description	(_TW(
-		"Ordinary Kriging for grid interpolation from irregular sample points. "
-		"This implementation does not use a maximum search radius. The weighting "
-		"matrix is generated once globally for all points."
+		"Simple Kriging for grid interpolation from irregular sample points."
 	));
+
+	//-----------------------------------------------------
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CKriging_Ordinary_Global::On_Initialize(void)
+bool CKriging_Simple::Get_Weights(const CSG_Points_Z &Points, CSG_Matrix &W)
 {
-	int		i, j, n;
-
-	//-----------------------------------------------------
-	m_Points.Clear();
+	int	n	= Points.Get_Count();
 
-	for(i=0; i<m_pPoints->Get_Count(); i++)
+	if( n > 0 )
 	{
-		CSG_Shape	*pPoint	= m_pPoints->Get_Shape(i);
-
-		if( !pPoint->is_NoData(m_zField) )
-		{
-			m_Points.Add(pPoint->Get_Point(0).x, pPoint->Get_Point(0).y, m_bLog ? log(pPoint->asDouble(m_zField)) : pPoint->asDouble(m_zField));
-		}
-	}
+		int	n	= Points.Get_Count();
 
-	//-----------------------------------------------------
-	if( (n = m_Points.Get_Count()) > 1 )
-	{
-		m_W.Create(n + 1, n + 1);
+		W.Create(n, n);
 
-		for(i=0; i<n; i++)
+		for(int i=0; i<n; i++)
 		{
-			m_W[i][i]	= 0.0;				// diagonal...
-			m_W[i][n]	= m_W[n][i]	= 1.0;	// edge...
+			W[i][i]	= 0.0;				// diagonal...
 
-			for(j=i+1; j<n; j++)
+			for(int j=i+1; j<n; j++)
 			{
-				m_W[i][j]	= m_W[j][i]	= Get_Weight(m_Points[i], m_Points[j]);
+				W[i][j]	= W[j][i]	= Get_Weight(Points.Get_X(i), Points.Get_Y(i), Points.Get_X(j), Points.Get_Y(j));
 			}
 		}
 
-		m_W[n][n]	= 0.0;
-
-		return( m_W.Set_Inverse(false) );
+		return( W.Set_Inverse(!m_Search.Do_Use_All(), n) );
 	}
 
 	return( false );
 }
 
-//---------------------------------------------------------
-bool CKriging_Ordinary_Global::On_Finalize(void)
-{
-	m_Points.Clear();
-	m_W.Destroy();
-
-	return( true );
-}
-
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CKriging_Ordinary_Global::Get_Value(const TSG_Point &p, double &z, double &v)
+bool CKriging_Simple::Get_Value(const TSG_Point &p, double &z, double &v)
 {
-	int		i, j, n;
+	//-----------------------------------------------------
+	int				i, n;
+	double			**W;
+	CSG_Matrix		_W;
+	CSG_Points_Z	_Data, *pData;
+
+	if( m_Search.Do_Use_All() )	// global
+	{
+		pData	= &m_Data;
+		W		= m_W.Get_Data();
+	}
+	else if( m_Search.Get_Points(p, _Data) && Get_Weights(_Data, _W) )	// local
+	{
+		pData	= &_Data;
+		W		= _W.Get_Data();
+	}
+	else
+	{
+		return( false );
+	}
 
 	//-----------------------------------------------------
-	if(	(n = m_Points.Get_Count()) > 0 )
+	if(	(n = pData->Get_Count()) > 0 )
 	{
-		CSG_Vector	G(n + 1);
+		CSG_Vector	G(n);
 
 		for(i=0; i<n; i++)
 		{
-			G[i]	= Get_Weight(p.x, p.y, m_Points[i].x, m_Points[i].y);
+			G[i]	= Get_Weight(p, pData->Get_Point(i));
 		}
 
-		G[n]	= 1.0;
-
 		//-------------------------------------------------
 		for(i=0, z=0.0, v=0.0; i<n; i++)
 		{
 			double	Lambda	= 0.0;
 
-			for(j=0; j<=n; j++)
+			for(int j=0; j<n; j++)
 			{
-				Lambda	+= m_W[i][j] * G[j];
+				Lambda	+= W[i][j] * G[j];
 			}
 
-			z	+= Lambda * m_Points[i].z;
+			z	+= Lambda * pData->Get_Z(i);
 			v	+= Lambda * G[i];
 		}
 
diff --git a/src/modules/statistics/statistics_kriging/kriging_ordinary_global.h b/src/modules/statistics/statistics_kriging/kriging_simple.h
similarity index 83%
rename from src/modules/statistics/statistics_kriging/kriging_ordinary_global.h
rename to src/modules/statistics/statistics_kriging/kriging_simple.h
index cc244a4..09e22b1 100644
--- a/src/modules/statistics/statistics_kriging/kriging_ordinary_global.h
+++ b/src/modules/statistics/statistics_kriging/kriging_simple.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: kriging_ordinary_global.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: kriging_simple.h 1921 2014-01-09 10:24:11Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -13,9 +13,9 @@
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//               Kriging_Ordinary_Global.h               //
+//                   kriging_simple.h                    //
 //                                                       //
-//                 Copyright (C) 2008 by                 //
+//                 Copyright (C) 2015 by                 //
 //                      Olaf Conrad                      //
 //                                                       //
 //-------------------------------------------------------//
@@ -44,9 +44,7 @@
 //                                                       //
 //    contact:    Olaf Conrad                            //
 //                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
+//                University of Hamburg                  //
 //                Germany                                //
 //                                                       //
 ///////////////////////////////////////////////////////////
@@ -61,8 +59,8 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#ifndef HEADER_INCLUDED__Kriging_Ordinary_Global_H
-#define HEADER_INCLUDED__Kriging_Ordinary_Global_H
+#ifndef HEADER_INCLUDED__kriging_simple_H
+#define HEADER_INCLUDED__kriging_simple_H
 
 
 ///////////////////////////////////////////////////////////
@@ -82,27 +80,18 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-class CKriging_Ordinary_Global : public CKriging_Base
+class CKriging_Simple : public CKriging_Base
 {
 public:
-	CKriging_Ordinary_Global(void);
+	CKriging_Simple(void);
 
 
 protected:
 
-	virtual bool			On_Initialize		(void);
-	virtual bool			On_Finalize			(void);
+	virtual bool			Get_Weights			(const CSG_Points_Z &Points, CSG_Matrix &W);
 
 	virtual bool			Get_Value			(const TSG_Point &p, double &z, double &v);
 
-
-private:
-
-	CSG_Points_Z			m_Points;
-
-	CSG_Matrix				m_W;
-
-
 };
 
 
@@ -113,4 +102,4 @@ private:
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED__Kriging_Ordinary_Global_H
+#endif // #ifndef HEADER_INCLUDED__kriging_simple_H
diff --git a/src/modules/statistics/statistics_kriging/kriging_universal.cpp b/src/modules/statistics/statistics_kriging/kriging_universal.cpp
index c951966..2b95a76 100644
--- a/src/modules/statistics/statistics_kriging/kriging_universal.cpp
+++ b/src/modules/statistics/statistics_kriging/kriging_universal.cpp
@@ -72,158 +72,132 @@
 
 //---------------------------------------------------------
 CKriging_Universal::CKriging_Universal(void)
-	: CKriging_Universal_Global()
 {
-	CSG_Parameter	*pNode;
-
 	//-----------------------------------------------------
 	Set_Name		(_TL("Universal Kriging"));
 
-	Set_Author		(SG_T("O.Conrad (c) 2008"));
+	Set_Author		("O.Conrad (c) 2008");
 
 	Set_Description	(_TW(
 		"Universal Kriging for grid interpolation from irregular sample points."
 	));
 
 	//-----------------------------------------------------
-	CSG_Parameter	*pSearch	= Parameters.Add_Node(
-		NULL	, "NODE_SEARCH"			, _TL("Search Options"),
+	CSG_Parameter	*pNode	= Parameters.Add_Node(
+		NULL	, "NODE_UK"		, _TL("Universal Kriging"),
 		_TL("")
 	);
 
-	pNode	= Parameters.Add_Choice(
-		pSearch	, "SEARCH_RANGE"		, _TL("Search Range"),
+	Parameters.Add_Grid_List(
+		pNode	, "PREDICTORS"	, _TL("Predictors"),
 		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("local"),
-			_TL("global")
-		)
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_RADIUS"		, _TL("Maximum Search Distance"),
-		_TL("local maximum search distance given in map units"),
-		PARAMETER_TYPE_Double	, 1000.0, 0, true
+		PARAMETER_INPUT_OPTIONAL, false
 	);
 
-	pNode	= Parameters.Add_Choice(
-		pSearch	, "SEARCH_POINTS_ALL"	, _TL("Number of Points"),
+	Parameters.Add_Choice(
+		pNode	,"INTERPOL"		, _TL("Grid Interpolation"),
 		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("maximum number of nearest points"),
-			_TL("all points within search distance")
-		)
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_POINTS_MIN"	, _TL("Minimum"),
-		_TL("minimum number of points to use"),
-		PARAMETER_TYPE_Int, 4, 1, true
+		CSG_String::Format(SG_T("%s|%s|%s|%s|%s|"),
+			_TL("Nearest Neighbor"),
+			_TL("Bilinear Interpolation"),
+			_TL("Inverse Distance Interpolation"),
+			_TL("Bicubic Spline Interpolation"),
+			_TL("B-Spline Interpolation")
+		), 4
 	);
 
 	Parameters.Add_Value(
-		pNode	, "SEARCH_POINTS_MAX"	, _TL("Maximum"),
-		_TL("maximum number of nearest points"),
-		PARAMETER_TYPE_Int, 20, 1, true
-	);
-
-	Parameters.Add_Choice(
-		pNode	, "SEARCH_DIRECTION"	, _TL("Search Direction"),
+		pNode	, "COORDS"		, _TL("Coordinates"),
 		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("all directions"),
-			_TL("quadrants")
-		)
+		PARAMETER_TYPE_Bool, false
 	);
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 bool CKriging_Universal::On_Initialize(void)
 {
-	m_pGrids		= Parameters("GRIDS"            )->asGridList();
-	m_Interpolation	= Parameters("INTERPOL"         )->asInt();
-
-	m_nPoints_Min	= Parameters("SEARCH_POINTS_MIN")->asInt   ();
-	m_nPoints_Max	= Parameters("SEARCH_POINTS_ALL")->asInt   () == 0
-					? Parameters("SEARCH_POINTS_MAX")->asInt   () : 0;
-	m_Radius		= Parameters("SEARCH_RANGE"     )->asInt   () == 0
-					? Parameters("SEARCH_RADIUS"    )->asDouble() : 0.0;
-	m_Direction		= Parameters("SEARCH_DIRECTION" )->asInt   () == 0 ? -1 : 4;
+	m_pGrids		= Parameters("PREDICTORS")->asGridList();
+	m_Interpolation	= Parameters("INTERPOL"  )->asInt();
+	m_bCoords		= Parameters("COORDS"    )->asBool();
 
 	//-----------------------------------------------------
-	if( m_nPoints_Max <= 0 && m_Radius <= 0 )	// global
+	if( m_Search.Do_Use_All(true) )	// global
 	{
-		return( CKriging_Universal_Global::On_Initialize() );
+		m_Data.Clear();
+
+		for(int i=0; i<m_pPoints->Get_Count(); i++)
+		{
+			CSG_Shape	*pPoint	= m_pPoints->Get_Shape(i);
+
+			if( !pPoint->is_NoData(m_zField) )
+			{
+				bool	bAdd	= true;	// for better performance, make sure all predictors supply a value now
+
+				for(int j=0; bAdd && j<m_pGrids->Get_Count(); j++)
+				{
+					bAdd	= m_pGrids->asGrid(j)->is_InGrid_byPos(pPoint->Get_Point(0));
+				}
+
+				if( bAdd )
+				{
+					m_Data.Add(pPoint->Get_Point(0).x, pPoint->Get_Point(0).y, m_bLog ? log(pPoint->asDouble(m_zField)) : pPoint->asDouble(m_zField));
+				}
+			}
+		}
+
+		return( Get_Weights(m_Data, m_W) );
 	}
 
 	//-----------------------------------------------------
-	m_Search.Create(m_pPoints->Get_Extent());
-
-	for(int iPoint=0; iPoint<m_pPoints->Get_Count() && Set_Progress(iPoint, m_pPoints->Get_Count()); iPoint++)
+	if( m_bLog )
 	{
-		CSG_Shape	*pPoint	= m_pPoints->Get_Shape(iPoint);
+		CSG_Shapes	Points(SHAPE_TYPE_Point); Points.Add_Field("Z", SG_DATATYPE_Double);
 
-		if( !pPoint->is_NoData(m_zField) )
+		for(int iPoint=0; iPoint<m_pPoints->Get_Count() && Set_Progress(iPoint, m_pPoints->Get_Count()); iPoint++)
 		{
-			bool		bAdd	= true;
+			CSG_Shape	*pPoint	= m_pPoints->Get_Shape(iPoint);
 
-			for(int iGrid=0; iGrid<m_pGrids->Get_Count(); iGrid++)
+			if( !pPoint->is_NoData(m_zField) )
 			{
-				if( !m_pGrids->asGrid(iGrid)->is_InGrid_byPos(pPoint->Get_Point(0)) )
+				bool	bAdd	= true;	// for better performance, make sure all predictors supply a value now
+
+				for(int j=0; bAdd && j<m_pGrids->Get_Count(); j++)
 				{
-					bAdd	= false;
+					bAdd	= m_pGrids->asGrid(j)->is_InGrid_byPos(pPoint->Get_Point(0));
 				}
-			}
 
-			if( bAdd )
-			{
-				m_Search.Add_Point(pPoint->Get_Point(0).x, pPoint->Get_Point(0).y, m_bLog ? log(pPoint->asDouble(m_zField)) : pPoint->asDouble(m_zField));
+				if( bAdd )
+				{
+					Points.Add_Shape(pPoint, SHAPE_COPY_GEOM)->Set_Value(0, log(pPoint->asDouble(m_zField)));
+				}
 			}
 		}
-	}
 
-	if( !m_Search.is_Okay() )
-	{
-		SG_UI_Msg_Add(_TL("could not initialize point search engine"), true);
-
-		return( false );
+		return( m_Search.Initialize(&Points, 0) );
 	}
 
 	//-----------------------------------------------------
-	return( true );
-}
-
-//---------------------------------------------------------
-bool CKriging_Universal::On_Finalize(void)
-{
-	m_Search.Destroy();
-
-	return( CKriging_Universal_Global::On_Finalize() );
+	return( m_Search.Initialize(m_pPoints, m_zField) );
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-int CKriging_Universal::Get_Weights(const TSG_Point &p, CSG_Matrix &W, CSG_Points_Z &Points)
+bool CKriging_Universal::Get_Weights(const CSG_Points_Z &Points, CSG_Matrix &W)
 {
-	//-----------------------------------------------------
-	int		n	= m_Search.Get_Nearest_Points(Points, p, m_nPoints_Max, m_Radius, m_Direction);
+	int	n	= Points.Get_Count();
 
-	if( n >= m_nPoints_Min )
+	if( n > 0 )
 	{
-		int		i, j, k;
+		int	i, j, k;
 
 		int	nCoords	= m_bCoords ? 2 : 0;
 		int	nGrids	= m_pGrids->Get_Count();
@@ -238,17 +212,17 @@ int CKriging_Universal::Get_Weights(const TSG_Point &p, CSG_Matrix &W, CSG_Point
 
 			for(j=i+1; j<n; j++)
 			{
-				W[i][j]	= W[j][i]	= Get_Weight(Points[i], Points[j]);
+				W[i][j]	= W[j][i]	= Get_Weight(Points.Get_X(i), Points.Get_Y(i), Points.Get_X(j), Points.Get_Y(j));
 			}
 
 			for(k=0, j=n+1; k<nGrids; k++, j++)
 			{
-				W[i][j]	= W[j][i]	= m_pGrids->asGrid(k)->Get_Value(Points[i].x, Points[i].y, m_Interpolation);
+				W[i][j]	= W[j][i]	= m_pGrids->asGrid(k)->Get_Value(Points.Get_X(i), Points.Get_Y(i), m_Interpolation);
 			}
 
 			for(k=0, j=n+nGrids+1; k<nCoords; k++, j++)
 			{
-				W[i][j]	= W[j][i]	= k == 0 ? Points[i].x : Points[i].y;
+				W[i][j]	= W[j][i]	= k == 0 ? Points.Get_X(i) : Points.Get_Y(i);
 			}
 		}
 
@@ -260,47 +234,52 @@ int CKriging_Universal::Get_Weights(const TSG_Point &p, CSG_Matrix &W, CSG_Point
 			}
 		}
 
-		if( W.Set_Inverse(true, n + 1 + nGrids + nCoords) )
-		{
-			return( n );
-		}
+		return( W.Set_Inverse(!m_Search.Do_Use_All(), n + 1 + nGrids + nCoords) );
 	}	
 
-	return( 0 );
+	return( false );
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 bool CKriging_Universal::Get_Value(const TSG_Point &p, double &z, double &v)
 {
 	//-----------------------------------------------------
-	if( m_nPoints_Max <= 0 && m_Radius <= 0 )	// global
+	int				i, j, n;
+	double			**W;
+	CSG_Matrix		_W;
+	CSG_Points_Z	_Data, *pData;
+
+	if( m_Search.Do_Use_All() )	// global
 	{
-		return( CKriging_Universal_Global::Get_Value(p, z, v) );
+		pData	= &m_Data;
+		W		= m_W.Get_Data();
+	}
+	else if( m_Search.Get_Points(p, _Data) && Get_Weights(_Data, _W) )	// local
+	{
+		pData	= &_Data;
+		W		= _W.Get_Data();
+	}
+	else
+	{
+		return( false );
 	}
 
 	//-----------------------------------------------------
-	int				i, j, n, nGrids, nCoords;
-	CSG_Points_Z	Points;
-	CSG_Matrix		W;
-
-	//-----------------------------------------------------
-	if(	(n = Get_Weights(p, W, Points)) > 1 )
+	if(	(n = pData->Get_Count()) > 0 )
 	{
-		nCoords	= m_bCoords ? 2 : 0;
-		nGrids	= m_pGrids->Get_Count();
+		int	nCoords	= m_bCoords ? 2 : 0;
+		int	nGrids	= m_pGrids->Get_Count();
 
 		CSG_Vector	G(n + 1 + nGrids + nCoords);
 
 		for(i=0; i<n; i++)
 		{
-			G[i]	=	Get_Weight(p.x, p.y, Points[i].x, Points[i].y);
+			G[i]	= Get_Weight(p, pData->Get_Point(i));
 		}
 
 		G[n]	= 1.0;
@@ -329,7 +308,7 @@ bool CKriging_Universal::Get_Value(const TSG_Point &p, double &z, double &v)
 				Lambda	+= W[i][j] * G[j];
 			}
 
-			z	+= Lambda * Points[i].z;
+			z	+= Lambda * pData->Get_Z(i);
 			v	+= Lambda * G[i];
 		}
 
diff --git a/src/modules/statistics/statistics_kriging/kriging_universal.h b/src/modules/statistics/statistics_kriging/kriging_universal.h
index c041105..e036d71 100644
--- a/src/modules/statistics/statistics_kriging/kriging_universal.h
+++ b/src/modules/statistics/statistics_kriging/kriging_universal.h
@@ -72,7 +72,7 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#include "kriging_universal_global.h"
+#include "kriging_base.h"
 
 
 ///////////////////////////////////////////////////////////
@@ -82,7 +82,7 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-class CKriging_Universal : public CKriging_Universal_Global
+class CKriging_Universal : public CKriging_Base
 {
 public:
 	CKriging_Universal(void);
@@ -91,21 +91,19 @@ public:
 protected:
 
 	virtual bool			On_Initialize		(void);
-	virtual bool			On_Finalize			(void);
+
+	virtual bool			Get_Weights			(const CSG_Points_Z &Points, CSG_Matrix &W);
 
 	virtual bool			Get_Value			(const TSG_Point &p, double &z, double &v);
 
 
 private:
 
-	int						m_nPoints_Min, m_nPoints_Max, m_Direction;
-
-	double					m_Radius;
-
-	CSG_PRQuadTree			m_Search;
+	bool					m_bCoords;
 
+	int						m_Interpolation;
 
-	int						Get_Weights			(const TSG_Point &p, CSG_Matrix &W, CSG_Points_Z &Points);
+	CSG_Parameter_Grid_List	*m_pGrids;
 
 };
 
diff --git a/src/modules/statistics/statistics_kriging/kriging_universal_global.h b/src/modules/statistics/statistics_kriging/kriging_universal_global.h
deleted file mode 100644
index 0449ff0..0000000
--- a/src/modules/statistics/statistics_kriging/kriging_universal_global.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/**********************************************************
- * Version $Id: kriging_universal_global.h 1921 2014-01-09 10:24:11Z oconrad $
- *********************************************************/
-
-///////////////////////////////////////////////////////////
-//                                                       //
-//                         SAGA                          //
-//                                                       //
-//      System for Automated Geoscientific Analyses      //
-//                                                       //
-//                    Module Library:                    //
-//            geostatistics_kriging_variogram            //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//              Kriging_Universal_Global.h               //
-//                                                       //
-//                 Copyright (C) 2008 by                 //
-//                      Olaf Conrad                      //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-// This file is part of 'SAGA - System for Automated     //
-// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
-//                                                       //
-// SAGA is distributed in the hope that it will be       //
-// useful, but WITHOUT ANY WARRANTY; without even the    //
-// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
-// PARTICULAR PURPOSE. See the GNU General Public        //
-// License for more details.                             //
-//                                                       //
-// You should have received a copy of the GNU General    //
-// Public License along with this program; if not,       //
-// write to the Free Software Foundation, Inc.,          //
-// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
-// USA.                                                  //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//    e-mail:     oconrad at saga-gis.org                   //
-//                                                       //
-//    contact:    Olaf Conrad                            //
-//                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
-//                Germany                                //
-//                                                       //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//                                                       //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#ifndef HEADER_INCLUDED__Kriging_Universal_Global_H
-#define HEADER_INCLUDED__Kriging_Universal_Global_H
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#include "kriging_base.h"
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-class CKriging_Universal_Global : public CKriging_Base
-{
-public:
-	CKriging_Universal_Global(void);
-
-
-protected:
-
-	bool					m_bCoords;
-
-	int						m_Interpolation;
-
-	CSG_Parameter_Grid_List	*m_pGrids;
-
-
-	virtual bool			On_Initialize		(void);
-	virtual bool			On_Finalize			(void);
-
-	virtual bool			Get_Value			(const TSG_Point &p, double &z, double &v);
-
-
-private:
-
-	CSG_Points_Z			m_Points;
-
-	CSG_Matrix				m_W;
-
-
-	bool					Get_Weights			(void);
-
-};
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED__Kriging_Universal_Global_H
diff --git a/src/modules/statistics/statistics_kriging/semivariogram.cpp b/src/modules/statistics/statistics_kriging/semivariogram.cpp
index d08b5e7..25751a7 100644
--- a/src/modules/statistics/statistics_kriging/semivariogram.cpp
+++ b/src/modules/statistics/statistics_kriging/semivariogram.cpp
@@ -76,13 +76,13 @@ CSemiVariogram::CSemiVariogram(void)
 	CSG_Parameter	*pNode;
 
 	//-----------------------------------------------------
-	Set_Name		(_TL("Variogram (Dialog))"));
+	Set_Name		(_TL("Variogram (Dialog)"));
 
-	Set_Author		(SG_T("O.Conrad (c) 2009"));
+	Set_Author		("O.Conrad (c) 2009");
 
-	Set_Description(
-		_TL("")
-	);
+	Set_Description	(_TW(
+		""
+	));
 
 	//-----------------------------------------------------
 	pNode	= Parameters.Add_Shapes(
diff --git a/src/modules/statistics/statistics_kriging/variogram_dialog.cpp b/src/modules/statistics/statistics_kriging/variogram_dialog.cpp
index 1533288..bd10d5c 100644
--- a/src/modules/statistics/statistics_kriging/variogram_dialog.cpp
+++ b/src/modules/statistics/statistics_kriging/variogram_dialog.cpp
@@ -345,6 +345,7 @@ CVariogram_Dialog::CVariogram_Dialog(void)
 	: CSGDI_Dialog(_TL("Variogram"))
 {
 	m_pPoints		= NULL;
+	m_nPoints		= 0;
 	m_Attribute		= 0;
 	m_pVariogram	= NULL;
 	m_pModel		= NULL;
@@ -358,7 +359,7 @@ CVariogram_Dialog::CVariogram_Dialog(void)
 	Formulas.Add(SG_T("a + b * x + c * x^2"));										// 2nd order polynom (quadric)
 	Formulas.Add(SG_T("a + b * x + c * x^2 + d * x^3"));							// 3rd order polynom (cubic)
 	Formulas.Add(SG_T("a + b * x + c * x^2 + d * x^3 + e * x^4"));					// 4th order polynom
-	Formulas.Add(SG_T("a + b * sqrt(c + x)"));										// square root
+	Formulas.Add(SG_T("a + b * sqrt(x)"));											// square root
 	Formulas.Add(SG_T("a + b * ln(x)"));											// logarithmic
 	Formulas.Add(SG_T("a + b * x^c"));												// exponential
 	Formulas.Add(SG_T("a + b * (1 - exp(-(x / b)^2))"));							// gaussian
@@ -393,18 +394,20 @@ CVariogram_Dialog::CVariogram_Dialog(void)
 	//-----------------------------------------------------
 	m_Settings.Set_Name(_TL("Variogram Settings"));
 
-	m_Settings.Add_Value (NULL, "SKIP"		, _TL("Skip")				, _TL(""), PARAMETER_TYPE_Int   , 1,   1, true);
-	m_Settings.Add_Value (NULL, "LAGDIST"	, _TL("Lag Distance")		, _TL(""), PARAMETER_TYPE_Double, 1, 0.0, true);
-	m_Settings.Add_Value (NULL, "MAXDIST"	, _TL("Maximum Distance")	, _TL(""), PARAMETER_TYPE_Double, 1, 0.0, true);
-	m_Settings.Add_String(NULL, "MODEL"		, _TL("Model")				, _TL(""), SG_T("a + b * x"));
+	m_Settings.Add_Value (NULL, "SKIP"   , _TL("Skip"            ), _TL(""), PARAMETER_TYPE_Int   , 1,   1, true);
+	m_Settings.Add_Value (NULL, "LAGDIST", _TL("Lag Distance"    ), _TL(""), PARAMETER_TYPE_Double, 1, 0.0, true);
+	m_Settings.Add_Value (NULL, "MAXDIST", _TL("Maximum Distance"), _TL(""), PARAMETER_TYPE_Double, 1, 0.0, true);
+	m_Settings.Add_String(NULL, "MODEL"  , _TL("Model"           ), _TL(""), SG_T("a + b * x"));
 }
 
 //---------------------------------------------------------
 bool CVariogram_Dialog::Execute(CSG_Shapes *pPoints, int Attribute, bool bLog, CSG_Table *pVariogram, CSG_Trend *pModel)
 {
-	if( m_pPoints != pPoints )
+	if( m_pPoints != pPoints || m_nPoints != pPoints->Get_Count() || !m_Extent.is_Equal(pPoints->Get_Extent()) )
 	{
 		m_pPoints	= pPoints;
+		m_nPoints	= pPoints->Get_Count();
+		m_Extent	= pPoints->Get_Extent();
 		m_Distance	= -1;
 
 		int	nSkip	= 1 + m_pPoints->Get_Count() / 10000;
diff --git a/src/modules/statistics/statistics_kriging/variogram_dialog.h b/src/modules/statistics/statistics_kriging/variogram_dialog.h
index 5e13541..39a26a1 100644
--- a/src/modules/statistics/statistics_kriging/variogram_dialog.h
+++ b/src/modules/statistics/statistics_kriging/variogram_dialog.h
@@ -143,9 +143,11 @@ private:
 
 	CSG_Shapes					*m_pPoints;
 
+	CSG_Rect					m_Extent;
+
 	bool						m_bLog;
 
-	int							m_Attribute;
+	int							m_Attribute, m_nPoints;
 
 	double						m_Distance;
 
diff --git a/src/modules/statistics/statistics_points/Makefile.in b/src/modules/statistics/statistics_points/Makefile.in
index fb887a7..1c351ef 100644
--- a/src/modules/statistics/statistics_points/Makefile.in
+++ b/src/modules/statistics/statistics_points/Makefile.in
@@ -476,22 +476,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MLB_Interface.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/statistics/statistics_regression/MLB_Interface.cpp b/src/modules/statistics/statistics_regression/MLB_Interface.cpp
index 1f55028..c1f98de 100644
--- a/src/modules/statistics/statistics_regression/MLB_Interface.cpp
+++ b/src/modules/statistics/statistics_regression/MLB_Interface.cpp
@@ -98,6 +98,7 @@ CSG_String Get_Info(int i)
 #include "point_grid_regression.h"
 #include "point_multi_grid_regression.h"
 #include "point_trend_surface.h"
+#include "point_zonal_multi_grid_regression.h"
 
 #include "gw_regression.h"
 #include "gw_regression_grid.h"
@@ -122,6 +123,7 @@ CSG_Module *		Create_Module(int i)
 	{
 	case  0:	return( new CPoint_Grid_Regression );
 	case  1:	return( new CPoint_Multi_Grid_Regression );
+	case 15:	return( new CPoint_Zonal_Multi_Grid_Regression );
 	case  2:	return( new CPoint_Trend_Surface );
 
 	case  3:	return( new CGW_Regression );
@@ -159,3 +161,42 @@ CSG_Module *		Create_Module(int i)
 	MLB_INTERFACE
 
 //}}AFX_SAGA
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+double	GWR_Fit_To_Density(CSG_Shapes *pPoints, double Bandwidth, int Rounding)
+{
+	if (pPoints && pPoints->Get_Count() > 0 && pPoints->Get_Extent().Get_Area() > 0.0)
+	{
+		double	d = sqrt(pPoints->Get_Extent().Get_Area() / pPoints->Get_Count());	// get a rough estimation of point density for band width suggestion
+
+		if (Bandwidth > 0.0)
+		{
+			d *= Bandwidth;
+		}
+
+		if (Rounding > 0)
+		{
+			d = SG_Get_Rounded_To_SignificantFigures(d, Rounding);
+		}
+
+		return(d);
+	}
+
+	return(-1.0);
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
diff --git a/src/modules/statistics/statistics_regression/MLB_Interface.h b/src/modules/statistics/statistics_regression/MLB_Interface.h
index 0612195..cf589aa 100644
--- a/src/modules/statistics/statistics_regression/MLB_Interface.h
+++ b/src/modules/statistics/statistics_regression/MLB_Interface.h
@@ -75,4 +75,28 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
+const CSG_String	GWR_References =
+	"- Fotheringham, S.A., Brunsdon, C., Charlton, M. (2002):"
+	"  Geographically Weighted Regression: the analysis of spatially varying relationships. John Wiley & Sons."
+	"  <a target=\"_blank\" href=\"http://onlinelibrary.wiley.com/doi/10.1111/j.1538-4632.2003.tb01114.x/abstract\">online</a>.\n"
+	"\n"
+	"- Fotheringham, S.A., Charlton, M., Brunsdon, C. (1998):"
+	"  Geographically weighted regression: a natural evolution of the expansion method for spatial data analysis."
+	"  Environment and Planning A 30(11), 1905�1927."
+	"  <a target=\"_blank\" href=\"http://www.envplan.com/abstract.cgi?id=a301905\">online</a>.\n"
+	"\n"
+	"- Lloyd, C. (2010):"
+	"  Spatial Data Analysis - An Introduction for GIS Users. Oxford, 206p.\n";
+
+//---------------------------------------------------------
+double	GWR_Fit_To_Density(CSG_Shapes *pPoints, double Bandwidth, int Rounding = 1);
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
 #endif // #ifndef HEADER_INCLUDED__statistics_regression_H
diff --git a/src/modules/statistics/statistics_regression/Makefile.am b/src/modules/statistics/statistics_regression/Makefile.am
index 61a7a6a..e980f00 100644
--- a/src/modules/statistics/statistics_regression/Makefile.am
+++ b/src/modules/statistics/statistics_regression/Makefile.am
@@ -25,6 +25,7 @@ MLB_Interface.cpp\
 point_grid_regression.cpp\
 point_multi_grid_regression.cpp\
 point_trend_surface.cpp\
+point_zonal_multi_grid_regression.cpp\
 table_regression_multiple.cpp\
 table_trend.cpp\
 grid_multi_grid_regression.h\
@@ -39,6 +40,7 @@ MLB_Interface.h\
 point_grid_regression.h\
 point_multi_grid_regression.h\
 point_trend_surface.h\
+point_zonal_multi_grid_regression.h\
 table_regression_multiple.h\
 table_trend.h
 
diff --git a/src/modules/statistics/statistics_regression/Makefile.in b/src/modules/statistics/statistics_regression/Makefile.in
index bee8f91..d05511c 100644
--- a/src/modules/statistics/statistics_regression/Makefile.in
+++ b/src/modules/statistics/statistics_regression/Makefile.in
@@ -133,8 +133,8 @@ am_libstatistics_regression_la_OBJECTS =  \
 	gw_regression.lo gw_regression_grid.lo gwr_grid_downscaling.lo \
 	grids_trend_polynom.lo MLB_Interface.lo \
 	point_grid_regression.lo point_multi_grid_regression.lo \
-	point_trend_surface.lo table_regression_multiple.lo \
-	table_trend.lo
+	point_trend_surface.lo point_zonal_multi_grid_regression.lo \
+	table_regression_multiple.lo table_trend.lo
 libstatistics_regression_la_OBJECTS =  \
 	$(am_libstatistics_regression_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
@@ -391,6 +391,7 @@ MLB_Interface.cpp\
 point_grid_regression.cpp\
 point_multi_grid_regression.cpp\
 point_trend_surface.cpp\
+point_zonal_multi_grid_regression.cpp\
 table_regression_multiple.cpp\
 table_trend.cpp\
 grid_multi_grid_regression.h\
@@ -405,6 +406,7 @@ MLB_Interface.h\
 point_grid_regression.h\
 point_multi_grid_regression.h\
 point_trend_surface.h\
+point_zonal_multi_grid_regression.h\
 table_regression_multiple.h\
 table_trend.h
 
@@ -500,26 +502,30 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/point_grid_regression.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/point_multi_grid_regression.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/point_trend_surface.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/point_zonal_multi_grid_regression.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/table_regression_multiple.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/table_trend.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/statistics/statistics_regression/grid_multi_grid_regression.cpp b/src/modules/statistics/statistics_regression/grid_multi_grid_regression.cpp
index f1fa0d0..08e7efe 100644
--- a/src/modules/statistics/statistics_regression/grid_multi_grid_regression.cpp
+++ b/src/modules/statistics/statistics_regression/grid_multi_grid_regression.cpp
@@ -74,9 +74,9 @@
 CGrid_Multi_Grid_Regression::CGrid_Multi_Grid_Regression(void)
 {
 	//-----------------------------------------------------
-	Set_Name		(_TL("Multiple Regression Analysis (Grid/Grids)"));
+	Set_Name		(_TL("Multiple Regression Analysis (Grid and Predictor Grids)"));
 
-	Set_Author		(SG_T("O.Conrad (c) 2011"));
+	Set_Author		("O.Conrad (c) 2011");
 
 	Set_Description	(_TW(
 		"Linear regression analysis of one grid as dependent and multiple grids as indepentent (predictor) variables. "
@@ -92,13 +92,13 @@ CGrid_Multi_Grid_Regression::CGrid_Multi_Grid_Regression(void)
 
 	//-----------------------------------------------------
 	Parameters.Add_Grid(
-		NULL	, "DEPENDENT"	, _TL("Dependent"),
+		NULL	, "DEPENDENT"	, _TL("Dependent Variable"),
 		_TL(""),
 		PARAMETER_INPUT
 	);
 
 	Parameters.Add_Grid_List(
-		NULL	, "GRIDS"		, _TL("Grids"),
+		NULL	, "PREDICTORS"	, _TL("Predictors"),
 		_TL(""),
 		PARAMETER_INPUT, false
 	);
@@ -169,15 +169,26 @@ CGrid_Multi_Grid_Regression::CGrid_Multi_Grid_Regression(void)
 	);
 
 	Parameters.Add_Value(
-		NULL	, "P_IN"		, _TL("P in"),
-		_TL("Level of significance for automated predictor selection, given as percentage"),
+		NULL	, "P_VALUE"		, _TL("Significance Level"),
+		_TL("Significance level (aka p-value) as threshold for automated predictor selection, given as percentage"),
 		PARAMETER_TYPE_Double, 5.0, 0.0, true, 100.0, true
 	);
 
+	Parameters.Add_Choice(
+		NULL	,"CROSSVAL"		, _TL("Cross Validation"),
+		_TL(""),
+		CSG_String::Format(SG_T("%s|%s|%s|%s|"),
+			_TL("none"),
+			_TL("leave one out"),
+			_TL("2-fold"),
+			_TL("k-fold")
+		), 0
+	);
+
 	Parameters.Add_Value(
-		NULL	, "P_OUT"		, _TL("P out"),
-		_TL("Level of significance for automated predictor selection, given as percentage"),
-		PARAMETER_TYPE_Double, 5.0, 0.0, true, 100.0, true
+		NULL	, "CROSSVAL_K"	, _TL("Cross Validation Subsamples"),
+		_TL("number of subsamples for k-fold cross validation"),
+		PARAMETER_TYPE_Int, 10, 2, true
 	);
 }
 
@@ -189,22 +200,44 @@ CGrid_Multi_Grid_Regression::CGrid_Multi_Grid_Regression(void)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
+int CGrid_Multi_Grid_Regression::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+{
+	if(	!SG_STR_CMP(pParameter->Get_Identifier(), "CROSSVAL") )
+	{
+		pParameters->Set_Enabled("CROSSVAL_K", pParameter->asInt() == 3);	// k-fold
+	}
+
+	if(	!SG_STR_CMP(pParameter->Get_Identifier(), "METHOD") )
+	{
+		pParameters->Set_Enabled("P_VALUE", pParameter->asInt() > 0);
+	}
+
+	return( 0 );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
 bool CGrid_Multi_Grid_Regression::On_Execute(void)
 {
 	bool					bResult;
-	double					P_in, P_out;
+	double					P;
 	CSG_Strings				Names;
 	CSG_Matrix				Samples;
 	CSG_Grid				*pDependent, *pRegression, *pResiduals;
 	CSG_Parameter_Grid_List	*pGrids;
 
 	//-----------------------------------------------------
-	pDependent		= Parameters("DEPENDENT")	->asGrid();
-	pGrids			= Parameters("GRIDS")		->asGridList();
-	pRegression		= Parameters("REGRESSION")	->asGrid();
-	pResiduals		= Parameters("RESIDUALS")	->asGrid();
-	P_in			= Parameters("P_IN")		->asDouble() / 100.0;
-	P_out			= Parameters("P_OUT")		->asDouble() / 100.0;
+	pDependent		= Parameters("DEPENDENT" )->asGrid();
+	pGrids			= Parameters("PREDICTORS")->asGridList();
+	pRegression		= Parameters("REGRESSION")->asGrid();
+	pResiduals		= Parameters("RESIDUALS" )->asGrid();
+	P				= Parameters("P_VALUE"   )->asDouble() / 100.0;
 
 	//-----------------------------------------------------
 	if( !Get_Samples(pGrids, pDependent, Samples, Names) )
@@ -216,10 +249,10 @@ bool CGrid_Multi_Grid_Regression::On_Execute(void)
 	switch( Parameters("METHOD")->asInt() )
 	{
 	default:
-	case 0:	bResult	= m_Regression.Get_Model         (Samples             , &Names);	break;
-	case 1:	bResult	= m_Regression.Get_Model_Forward (Samples, P_in       , &Names);	break;
-	case 2:	bResult	= m_Regression.Get_Model_Backward(Samples,       P_out, &Names);	break;
-	case 3:	bResult	= m_Regression.Get_Model_Stepwise(Samples, P_in, P_out, &Names);	break;
+	case 0:	bResult	= m_Regression.Get_Model         (Samples      , &Names);	break;
+	case 1:	bResult	= m_Regression.Get_Model_Forward (Samples, P   , &Names);	break;
+	case 2:	bResult	= m_Regression.Get_Model_Backward(Samples,    P, &Names);	break;
+	case 3:	bResult	= m_Regression.Get_Model_Stepwise(Samples, P, P, &Names);	break;
 	}
 
 	if( bResult == false )
@@ -230,6 +263,27 @@ bool CGrid_Multi_Grid_Regression::On_Execute(void)
 	Message_Add(m_Regression.Get_Info(), false);
 
 	//-----------------------------------------------------
+	int	CrossVal;
+
+	switch( Parameters("CROSSVAL")->asInt() )
+	{
+	default:	CrossVal	= 0;									break;	// none
+	case 1:		CrossVal	= 1;									break;	// leave one out (LOOVC)
+	case 2:		CrossVal	= 2;									break;	// 2-fold
+	case 3:		CrossVal	= Parameters("CROSSVAL_K")->asInt();	break;	// k-fold
+	}
+
+	if( CrossVal > 0 && m_Regression.Get_CrossValidation(CrossVal) )
+	{
+		Message_Add(CSG_String::Format(SG_T("\n%s:\n"      ), _TL("Cross Validation")), false);
+		Message_Add(CSG_String::Format(SG_T("\t%s:\t%s\n"  ), _TL("Type"   ), Parameters("CROSSVAL")->asString() ), false);
+		Message_Add(CSG_String::Format(SG_T("\t%s:\t%d\n"  ), _TL("Samples"), m_Regression.Get_CV_nSamples()     ), false);
+		Message_Add(CSG_String::Format(SG_T("\t%s:\t%f\n"  ), _TL("RMSE"   ), m_Regression.Get_CV_RMSE()         ), false);
+		Message_Add(CSG_String::Format(SG_T("\t%s:\t%.2f\n"), _TL("NRMSE"  ), m_Regression.Get_CV_NRMSE() * 100.0), false);
+		Message_Add(CSG_String::Format(SG_T("\t%s:\t%.2f\n"), _TL("R2"     ), m_Regression.Get_CV_R2()    * 100.0), false);
+	}
+
+	//-----------------------------------------------------
 	Set_Regression(pGrids, pDependent, pRegression, pResiduals, CSG_String::Format(SG_T("%s [%s]"), pDependent->Get_Name(), _TL("Regression Model")));
 
 	//-----------------------------------------------------
diff --git a/src/modules/statistics/statistics_regression/grid_multi_grid_regression.h b/src/modules/statistics/statistics_regression/grid_multi_grid_regression.h
index fda4161..79d8ab7 100644
--- a/src/modules/statistics/statistics_regression/grid_multi_grid_regression.h
+++ b/src/modules/statistics/statistics_regression/grid_multi_grid_regression.h
@@ -83,7 +83,9 @@ public:
 
 protected:
 
-	virtual bool				On_Execute			(void);
+	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+
+	virtual bool				On_Execute				(void);
 
 
 private:
@@ -91,9 +93,9 @@ private:
 	CSG_Regression_Multiple		m_Regression;
 
 
-	bool						Get_Samples			(CSG_Parameter_Grid_List *pGrids, CSG_Grid *pDependent, CSG_Matrix &Samples, CSG_Strings &Names);
+	bool						Get_Samples		(CSG_Parameter_Grid_List *pGrids, CSG_Grid *pDependent, CSG_Matrix &Samples, CSG_Strings &Names);
 
-	bool						Set_Regression		(CSG_Parameter_Grid_List *pGrids, CSG_Grid *pDependent, CSG_Grid *pRegression, CSG_Grid *pResiduals, const CSG_String &Name);
+	bool						Set_Regression	(CSG_Parameter_Grid_List *pGrids, CSG_Grid *pDependent, CSG_Grid *pRegression, CSG_Grid *pResiduals, const CSG_String &Name);
 
 };
 
diff --git a/src/modules/statistics/statistics_regression/gw_multi_regression.cpp b/src/modules/statistics/statistics_regression/gw_multi_regression.cpp
index 7727caf..4a06051 100644
--- a/src/modules/statistics/statistics_regression/gw_multi_regression.cpp
+++ b/src/modules/statistics/statistics_regression/gw_multi_regression.cpp
@@ -69,17 +69,6 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#define SG_ARRAY_DELETE(A)		if( A ) { delete[](A); A = NULL; }
-#define SG_ARRAY_FREE(A)		if( A ) { SG_Free (A); A = NULL; }
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
 CGW_Multi_Regression::CGW_Multi_Regression(void)
 {
 	CSG_Parameter	*pNode;
@@ -91,20 +80,10 @@ CGW_Multi_Regression::CGW_Multi_Regression(void)
 
 	Set_Description	(_TW(
 		"Geographically Weighted Regression for multiple predictors. "
-		"Determination coefficients and regression model parameters "
-		"are given as grids.\n"
+		"Predictors have to be supplied as attributes of ingoing points data. "
+		"Regression model parameters are generated as continuous fields, i.e. as grids.\n"
 		"Reference:\n"
-		"- Fotheringham, S.A., Brunsdon, C., Charlton, M. (2002):"
-		" Geographically Weighted Regression: the analysis of spatially varying relationships. John Wiley & Sons."
-		" <a target=\"_blank\" href=\"http://onlinelibrary.wiley.com/doi/10.1111/j.1538-4632.2003.tb01114.x/abstract\">online</a>.\n"
-		"\n"
-		"- Fotheringham, S.A., Charlton, M., Brunsdon, C. (1998):"
-		" Geographically weighted regression: a natural evolution of the expansion method for spatial data analysis."
-		" Environment and Planning A 30(11), 1905�1927."
-		" <a target=\"_blank\" href=\"http://www.envplan.com/abstract.cgi?id=a301905\">online</a>.\n"
-		"\n"
-		" - Lloyd, C. (2010): Spatial Data Analysis - An Introduction for GIS Users. Oxford, 206p.\n"
-	));
+	) + GWR_References);
 
 	//-----------------------------------------------------
 	pNode	= Parameters.Add_Shapes(
@@ -124,7 +103,7 @@ CGW_Multi_Regression::CGW_Multi_Regression(void)
 	);
 
 	Parameters.Add_Shapes(
-		NULL	, "REGRESSION"		, _TL("Regression"),
+		NULL	, "REGRESSION"	, _TL("Regression"),
 		_TL(""),
 		PARAMETER_OUTPUT, SHAPE_TYPE_Point
 	);
@@ -146,55 +125,10 @@ CGW_Multi_Regression::CGW_Multi_Regression(void)
 	m_Weighting.Create_Parameters(&Parameters, false);
 
 	//-----------------------------------------------------
-	CSG_Parameter	*pSearch	= Parameters.Add_Node(
-		NULL	, "NODE_SEARCH"			, _TL("Search Options"),
-		_TL("")
-	);
+	m_Search.Create(&Parameters, Parameters.Add_Node(NULL, "NODE_SEARCH", _TL("Search Options"), _TL("")), 16);
 
-	pNode	= Parameters.Add_Choice(
-		pSearch	, "SEARCH_RANGE"		, _TL("Search Range"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("local"),
-			_TL("global")
-		)
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_RADIUS"		, _TL("Maximum Search Distance"),
-		_TL("local maximum search distance given in map units"),
-		PARAMETER_TYPE_Double	, 1000.0, 0, true
-	);
-
-	pNode	= Parameters.Add_Choice(
-		pSearch	, "SEARCH_POINTS_ALL"	, _TL("Number of Points"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("maximum number of nearest points"),
-			_TL("all points within search distance")
-		)
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_POINTS_MIN"	, _TL("Minimum"),
-		_TL("minimum number of points to use"),
-		PARAMETER_TYPE_Int, 4, 1, true
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_POINTS_MAX"	, _TL("Maximum"),
-		_TL("maximum number of nearest points"),
-		PARAMETER_TYPE_Int, 20, 1, true
-	);
-
-	Parameters.Add_Choice(
-		pNode	, "SEARCH_DIRECTION"	, _TL("Search Direction"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("all directions"),
-			_TL("quadrants")
-		)
-	);
+	Parameters("SEARCH_RANGE"     )->Set_Value(1);
+	Parameters("SEARCH_POINTS_ALL")->Set_Value(1);
 
 	//-----------------------------------------------------
 	m_iPredictor	= NULL;
@@ -204,16 +138,18 @@ CGW_Multi_Regression::CGW_Multi_Regression(void)
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 int CGW_Multi_Regression::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	if( !SG_STR_CMP(pParameter->Get_Identifier(), "POINTS") && pParameter->asShapes() )
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "POINTS") )
 	{
-		m_Grid_Target.Set_User_Defined(pParameters, pParameter->asShapes()->Get_Extent());
+		m_Grid_Target.Set_User_Defined(pParameters, pParameter->asShapes());
+
+		m_Search.On_Parameter_Changed(pParameters, pParameter);
+
+		pParameters->Set_Parameter("DW_BANDWIDTH", GWR_Fit_To_Density(pParameter->asShapes(), 4.0, 1));
 	}
 
 	return( m_Grid_Target.On_Parameter_Changed(pParameters, pParameter) ? 1 : 0 );
@@ -222,16 +158,7 @@ int CGW_Multi_Regression::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_
 //---------------------------------------------------------
 int CGW_Multi_Regression::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), "SEARCH_RANGE") )
-	{
-		pParameters->Set_Enabled("SEARCH_RADIUS"    , pParameter->asInt() == 0);	// local
-	}
-
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), "SEARCH_POINTS_ALL") )
-	{
-		pParameters->Set_Enabled("SEARCH_POINTS_MAX", pParameter->asInt() == 0);	// maximum number of points
-		pParameters->Set_Enabled("SEARCH_DIRECTION" , pParameter->asInt() == 0);	// maximum number of points per quadrant
-	}
+	m_Search.On_Parameters_Enable(pParameters, pParameter);
 
 	m_Weighting.Enable_Parameters(pParameters);
 
@@ -241,12 +168,10 @@ int CGW_Multi_Regression::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CGW_Multi_Regression::Get_Predictors(void)
+bool CGW_Multi_Regression::Initialize(void)
 {
 	CSG_Parameter_Table_Fields	*pFields	= Parameters("PREDICTORS")->asTableFields();
 
@@ -268,49 +193,33 @@ bool CGW_Multi_Regression::Get_Predictors(void)
 //---------------------------------------------------------
 void CGW_Multi_Regression::Finalize(void)
 {
-	SG_ARRAY_DELETE(m_iPredictor);
-
-	SG_ARRAY_FREE  (m_pSlopes);
-
-	m_Search.Destroy();
+	SG_DELETE_ARRAY(m_iPredictor);
+	SG_FREE_SAFE   (m_pSlopes);
 
-	m_y.Destroy();
-	m_z.Destroy();
-	m_w.Destroy();
+	m_Search.Finalize();
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 bool CGW_Multi_Regression::On_Execute(void)
 {
 	//-----------------------------------------------------
-	m_pPoints		= Parameters("POINTS"           )->asShapes();
-	m_iDependent	= Parameters("DEPENDENT"        )->asInt   ();
-
-	m_nPoints_Min	= Parameters("SEARCH_POINTS_MIN")->asInt   ();
-	m_nPoints_Max	= Parameters("SEARCH_POINTS_ALL")->asInt   () == 0
-					? Parameters("SEARCH_POINTS_MAX")->asInt   () : 0;
-	m_Radius		= Parameters("SEARCH_RANGE"     )->asInt   () == 0
-					? Parameters("SEARCH_RADIUS"    )->asDouble() : 0.0;
-	m_Direction		= Parameters("SEARCH_DIRECTION" )->asInt   () == 0 ? -1 : 4;
-
-	m_Weighting.Set_Parameters(&Parameters);
+	m_pPoints		= Parameters("POINTS"   )->asShapes();
+	m_iDependent	= Parameters("DEPENDENT")->asInt   ();
 
 	//-----------------------------------------------------
-	if( !Get_Predictors() )
+	if( !Initialize() )
 	{
 		Finalize();
 
 		return( false );
 	}
 
-	if( (m_nPoints_Max > 0 || m_Radius > 0.0) && !m_Search.Create(m_pPoints, -1) )
+	if( !m_Search.Initialize(m_pPoints, -1) )
 	{
 		Finalize();
 
@@ -318,9 +227,11 @@ bool CGW_Multi_Regression::On_Execute(void)
 	}
 
 	//-----------------------------------------------------
-	m_Grid_Target.Set_User_Defined(Get_Parameters("TARGET"), m_pPoints->Get_Extent());	Dlg_Parameters("TARGET");	// if called from saga_cmd
+	m_Grid_Target.Cmd_Update(m_pPoints);	// if called from saga_cmd
+
+	m_Weighting.Set_Parameters(&Parameters);
 
-	m_pQuality		= m_Grid_Target.Get_Grid("QUALITY"  );
+	m_pQuality		= m_Grid_Target.Get_Grid("QUALITY");
 	m_pIntercept	= m_Grid_Target.Get_Grid("INTERCEPT");
 
 	if( !m_pQuality || !m_pIntercept )
@@ -346,18 +257,23 @@ bool CGW_Multi_Regression::On_Execute(void)
 	}
 
 	//-----------------------------------------------------
-	int	nPoints_Max	= m_nPoints_Max > 0 ? m_nPoints_Max : m_pPoints->Get_Count();
-
-	m_y.Create(1 + m_nPredictors, nPoints_Max);
-	m_z.Create(nPoints_Max);
-	m_w.Create(nPoints_Max);
-
-	//-----------------------------------------------------
 	for(int y=0; y<m_pIntercept->Get_NY() && Set_Progress(y, m_pIntercept->Get_NY()); y++)
 	{
 		for(int x=0; x<m_pIntercept->Get_NX(); x++)
 		{
-			if( !Get_Regression(x, y) )
+			CSG_Regression_Weighted	Model;
+
+			if( Get_Model(x, y, Model) )
+			{
+				m_pQuality  ->Set_Value(x, y, Model.Get_R2());
+				m_pIntercept->Set_Value(x, y, Model[0]);
+
+				for(int i=0; i<m_nPredictors; i++)
+				{
+					m_pSlopes[i]->Set_Value(x, y, Model[i + 1]);
+				}
+			}
+			else
 			{
 				m_pQuality  ->Set_NoData(x, y);
 				m_pIntercept->Set_NoData(x, y);
@@ -379,126 +295,55 @@ bool CGW_Multi_Regression::On_Execute(void)
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-int CGW_Multi_Regression::Set_Variables(int x, int y)
+bool CGW_Multi_Regression::Get_Model(int x, int y, CSG_Regression_Weighted &Model)
 {
-	int			iPoint, jPoint, nPoints, iPredictor;
-	TSG_Point	Point;
-	CSG_Shape	*pPoint;
+	//-----------------------------------------------------
+	TSG_Point	Point	= m_pIntercept->Get_System().Get_Grid_to_World(x, y);
+	int			nPoints = m_Search.Set_Location(Point);
+
+	CSG_Vector	Predictors(m_nPredictors);
 
-	Point	= m_pIntercept->Get_System().Get_Grid_to_World(x, y);
-	nPoints	= m_Search.is_Okay() ? (int)m_Search.Select_Nearest_Points(Point.x, Point.y, m_nPoints_Max, m_Radius, m_Direction) : m_pPoints->Get_Count();
+	Model.Destroy();
 
-	for(iPoint=0, jPoint=0; iPoint<nPoints; iPoint++)
+	for(int iPoint=0; iPoint<nPoints; iPoint++)
 	{
-		if( m_Search.is_Okay() )
-		{
-			double	ix, iy, iz;
+		double	ix, iy, iz;
 
-			m_Search.Get_Selected_Point(iPoint, ix, iy, iz);
-
-			pPoint	= m_pPoints->Get_Shape((int)iz);
-		}
-		else
-		{
-			pPoint	= m_pPoints->Get_Shape(iPoint);
-		}
+		CSG_Shape	*pPoint = m_Search.Do_Use_All() && m_Search.Get_Point(iPoint, ix, iy, iz)
+			? m_pPoints->Get_Shape((int)iz)
+			: m_pPoints->Get_Shape(iPoint);
 
 		if( !pPoint->is_NoData(m_iDependent) )
 		{
-			m_z[jPoint]	= pPoint->asDouble(m_iDependent);
-			m_w[jPoint]	= m_Weighting.Get_Weight(SG_Get_Distance(Point, pPoint->Get_Point(0)));
+			bool	bOkay	= true;
 
-			for(iPredictor=0; iPredictor<m_nPredictors; iPredictor++)
+			for(int iPredictor=0; iPredictor<m_nPredictors && bOkay; iPredictor++)
 			{
 				if( !pPoint->is_NoData(m_iPredictor[iPredictor]) )
 				{
-					m_y[jPoint][iPredictor]	= pPoint->asDouble(m_iPredictor[iPredictor]);
+					Predictors[iPredictor]	= pPoint->asDouble(m_iPredictor[iPredictor]);
 				}
 				else
 				{
-					iPredictor	= m_nPredictors + 1;
+					bOkay	= false;
 				}
 			}
 
-			if( iPredictor == m_nPredictors )
+			if( bOkay )
 			{
-				jPoint++;
+				Model.Add_Sample(
+					m_Weighting.Get_Weight(SG_Get_Distance(Point, pPoint->Get_Point(0))),
+					pPoint->asDouble(m_iDependent), Predictors
+				);
 			}
 		}
 	}
 
-	return( jPoint );
-}
-
-//---------------------------------------------------------
-bool CGW_Multi_Regression::Get_Regression(int x, int y)
-{
-	int		nPoints	= Set_Variables(x, y);
-
-	if( nPoints < m_nPoints_Min )
-	{
-		return( false );
-	}
-
-	//-----------------------------------------------------
-	int			i;
-	double		zMean, rss, tss;
-	CSG_Vector	b, z;
-	CSG_Matrix	Y, YtW;
-
-	//-----------------------------------------------------
-	z  .Create(nPoints);
-	Y  .Create(1 + m_nPredictors, nPoints);
-	YtW.Create(nPoints, 1 + m_nPredictors);
-
-	for(i=0, zMean=0.0; i<nPoints; i++)
-	{
-		Y  [i][0]	= 1.0;
-		YtW[0][i]	= m_w[i];
-
-		for(int j=0; j<m_nPredictors; j++)
-		{
-			Y  [i][j + 1]	= m_y[i][j];
-			YtW[j + 1][i]	= m_y[i][j] * m_w[i];
-		}
-
-		zMean		+= (z[i] = m_z[i]);
-	}
-
 	//-----------------------------------------------------
-	b		= (YtW * Y).Get_Inverse() * (YtW * z);
-
-	zMean	/= nPoints;
-
-	for(i=0, rss=0.0, tss=0.0; i<nPoints; i++)
-	{
-		double	zr	= b[0];
-
-		for(int j=0; j<m_nPredictors; j++)
-		{
-			zr	+= b[j + 1] * m_y[i][j];
-		}
-
-		rss	+= m_w[i] * SG_Get_Square(m_z[i] - zr);
-		tss	+= m_w[i] * SG_Get_Square(m_z[i] - zMean);
-	}
-
-	m_pQuality  ->Set_Value(x, y, tss > 0.0 ? (tss - rss) / tss : 0.0);
-
-	m_pIntercept->Set_Value(x, y, b[0]);
-
-	for(i=0; i<m_nPredictors; i++)
-	{
-		m_pSlopes[i]->Set_Value(x, y, b[i + 1]);
-	}
-
-	//-----------------------------------------------------
-	return( true );
+	return( Model.Calculate() );
 }
 
 
diff --git a/src/modules/statistics/statistics_regression/gw_multi_regression.h b/src/modules/statistics/statistics_regression/gw_multi_regression.h
index 5e1dfa8..a72a922 100644
--- a/src/modules/statistics/statistics_regression/gw_multi_regression.h
+++ b/src/modules/statistics/statistics_regression/gw_multi_regression.h
@@ -78,47 +78,38 @@ class CGW_Multi_Regression : public CSG_Module
 public:
 	CGW_Multi_Regression(void);
 
-	virtual CSG_String			Get_MenuPath			(void)	{	return( _TL("R:GWR") );	}
+	virtual CSG_String				Get_MenuPath			(void)	{ return(_TL("A:Spatial and Geostatistics|Geographically Weighted Regression")); }
 
 
 protected:
 
-	virtual bool				On_Execute				(void);
+	virtual bool					On_Execute				(void);
 
-	virtual int					On_Parameter_Changed	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
-	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+	virtual int						On_Parameter_Changed	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+	virtual int						On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
 
 
 private:
 
-	int							m_iDependent, *m_iPredictor, m_nPredictors, m_nPoints_Min, m_nPoints_Max, m_Direction;
+	int								m_iDependent, *m_iPredictor, m_nPredictors;
 
-	double						m_Radius;
+	CSG_Parameters_Grid_Target		m_Grid_Target;
 
-	CSG_Parameters_Grid_Target	m_Grid_Target;
+	CSG_Distance_Weighting			m_Weighting;
 
-	CSG_Distance_Weighting		m_Weighting;
+	CSG_Parameters_Search_Points	m_Search;
 
-	CSG_PRQuadTree				m_Search;
+	CSG_Shapes						*m_pPoints;
 
-	CSG_Vector					m_z, m_w;
+	CSG_Grid						*m_pQuality, *m_pIntercept, **m_pSlopes;
 
-	CSG_Matrix					m_y;
 
-	CSG_Shapes					*m_pPoints;
+	bool							Initialize				(void);
+	void							Finalize				(void);
 
-	CSG_Grid					*m_pQuality, *m_pIntercept, **m_pSlopes;
+	bool							Get_Model				(int x, int y, CSG_Regression_Weighted &Model);
 
-
-	void						Finalize				(void);
-
-	bool						Get_Predictors			(void);
-
-	int							Set_Variables			(int x, int y);
-
-	bool						Get_Regression			(int x, int y);
-
-	bool						Set_Residuals			(void);
+	bool							Set_Residuals			(void);
 
 };
 
diff --git a/src/modules/statistics/statistics_regression/gw_multi_regression_grid.cpp b/src/modules/statistics/statistics_regression/gw_multi_regression_grid.cpp
index c00e5ac..7754f94 100644
--- a/src/modules/statistics/statistics_regression/gw_multi_regression_grid.cpp
+++ b/src/modules/statistics/statistics_regression/gw_multi_regression_grid.cpp
@@ -69,17 +69,6 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#define GRID_SET_NODATA(g, x, y)	if( g ) { g->Set_NoData(x, y); }
-#define GRID_SET_VALUE(g, x, y, z)	if( g ) { g->Set_Value(x, y, z); }
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
 CGW_Multi_Regression_Grid::CGW_Multi_Regression_Grid(void)
 {
 	CSG_Parameter	*pNode;
@@ -91,17 +80,25 @@ CGW_Multi_Regression_Grid::CGW_Multi_Regression_Grid(void)
 
 	Set_Description	(_TW(
 		"References:\n"
-		"- Fotheringham, S.A., Brunsdon, C., Charlton, M. (2002):"
-		" Geographically Weighted Regression: the analysis of spatially varying relationships. John Wiley & Sons."
-		" <a target=\"_blank\" href=\"http://onlinelibrary.wiley.com/doi/10.1111/j.1538-4632.2003.tb01114.x/abstract\">online</a>.\n"
-		"\n"
-		"- Fotheringham, S.A., Charlton, M., Brunsdon, C. (1998):"
-		" Geographically weighted regression: a natural evolution of the expansion method for spatial data analysis."
-		" Environment and Planning A 30(11), 1905�1927."
-		" <a target=\"_blank\" href=\"http://www.envplan.com/abstract.cgi?id=a301905\">online</a>.\n"
-		"\n"
-		"- Lloyd, C. (2010): Spatial Data Analysis - An Introduction for GIS Users. Oxford, 206p.\n"
-	));
+	) + GWR_References);
+
+	//-----------------------------------------------------
+	pNode = Parameters.Add_Shapes(
+		NULL	, "POINTS"		, _TL("Points"),
+		_TL(""),
+		PARAMETER_INPUT, SHAPE_TYPE_Point
+	);
+
+	Parameters.Add_Table_Field(
+		pNode	, "DEPENDENT"	, _TL("Dependent Variable"),
+		_TL("")
+	);
+
+	Parameters.Add_Shapes(
+		NULL	, "RESIDUALS"	, _TL("Residuals"),
+		_TL(""),
+		PARAMETER_OUTPUT_OPTIONAL, SHAPE_TYPE_Point
+	);
 
 	//-----------------------------------------------------
 	Parameters.Add_Grid_List(
@@ -134,23 +131,6 @@ CGW_Multi_Regression_Grid::CGW_Multi_Regression_Grid(void)
 		PARAMETER_TYPE_Bool, false
 	);
 
-	pNode	= Parameters.Add_Shapes(
-		NULL	, "POINTS"		, _TL("Points"),
-		_TL(""),
-		PARAMETER_INPUT, SHAPE_TYPE_Point
-	);
-
-	Parameters.Add_Table_Field(
-		pNode	, "DEPENDENT"	, _TL("Dependent Variable"),
-		_TL("")
-	);
-
-	Parameters.Add_Shapes(
-		NULL	, "RESIDUALS"	, _TL("Residuals"),
-		_TL(""),
-		PARAMETER_OUTPUT_OPTIONAL, SHAPE_TYPE_Point
-	);
-
 	//-----------------------------------------------------
 	pNode	= Parameters.Add_Choice(
 		NULL	, "RESOLUTION"	, _TL("Model Resolution"),
@@ -172,72 +152,26 @@ CGW_Multi_Regression_Grid::CGW_Multi_Regression_Grid(void)
 	m_Weighting.Create_Parameters(&Parameters, false);
 
 	//-----------------------------------------------------
-	CSG_Parameter	*pSearch	= Parameters.Add_Node(
-		NULL	, "NODE_SEARCH"			, _TL("Search Options"),
-		_TL("")
-	);
-
-	pNode	= Parameters.Add_Choice(
-		pSearch	, "SEARCH_RANGE"		, _TL("Search Range"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("local"),
-			_TL("global")
-		), 1
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_RADIUS"		, _TL("Maximum Search Distance"),
-		_TL("local maximum search distance given in map units"),
-		PARAMETER_TYPE_Double	, 1000.0, 0, true
-	);
-
-	pNode	= Parameters.Add_Choice(
-		pSearch	, "SEARCH_POINTS_ALL"	, _TL("Number of Points"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("maximum number of nearest points"),
-			_TL("all points within search distance")
-		), 0
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_POINTS_MIN"	, _TL("Minimum"),
-		_TL("minimum number of points to use"),
-		PARAMETER_TYPE_Int, 4, 1, true
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_POINTS_MAX"	, _TL("Maximum"),
-		_TL("maximum number of nearest points"),
-		PARAMETER_TYPE_Int, 50, 1, true
-	);
+	m_Search.Create(&Parameters, Parameters.Add_Node(NULL, "NODE_SEARCH", _TL("Search Options"), _TL("")), 16);
 
-	Parameters.Add_Choice(
-		pNode	, "SEARCH_DIRECTION"	, _TL("Search Direction"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("all directions"),
-			_TL("quadrants")
-		)
-	);
+	Parameters("SEARCH_RANGE"     )->Set_Value(1);
+	Parameters("SEARCH_POINTS_ALL")->Set_Value(1);
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 int CGW_Multi_Regression_Grid::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("POINTS")) && pParameter->asShapes() )
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "POINTS") && pParameter->asShapes() )
 	{
-		double	d	= pParameter->asShapes()->Get_Extent().Get_XRange() / 20.0;
+		m_Search.On_Parameter_Changed(pParameters, pParameter);
 
-		pParameters->Get_Parameter("RESOLUTION_VAL")->Set_Value(d);
+		pParameters->Set_Parameter("RESOLUTION_VAL", GWR_Fit_To_Density(pParameter->asShapes(), 4.0, 1));
+		pParameters->Set_Parameter("DW_BANDWIDTH"  , GWR_Fit_To_Density(pParameter->asShapes(), 4.0, 1));
 	}
 
 	return( 1 );
@@ -248,20 +182,10 @@ int CGW_Multi_Regression_Grid::On_Parameters_Enable(CSG_Parameters *pParameters,
 {
 	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("RESOLUTION")) )
 	{
-		pParameters->Get_Parameter("RESOLUTION_VAL"   )->Set_Enabled(pParameter->asInt() == 1);
+		pParameters->Get_Parameter("RESOLUTION_VAL")->Set_Enabled(pParameter->asInt() == 1);
 	}
 
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("SEARCH_RANGE")) )
-	{
-		pParameters->Get_Parameter("SEARCH_RADIUS"    )->Set_Enabled(pParameter->asInt() == 0);	// local
-		pParameters->Get_Parameter("SEARCH_POINTS_MIN")->Set_Enabled(pParameter->asInt() == 0);	// local
-	}
-
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("SEARCH_POINTS_ALL")) )
-	{
-		pParameters->Get_Parameter("SEARCH_POINTS_MAX")->Set_Enabled(pParameter->asInt() == 0);	// maximum number of points
-		pParameters->Get_Parameter("SEARCH_DIRECTION" )->Set_Enabled(pParameter->asInt() == 0);	// maximum number of points per quadrant
-	}
+	m_Search.On_Parameters_Enable(pParameters, pParameter);
 
 	m_Weighting.Enable_Parameters(pParameters);
 
@@ -271,8 +195,6 @@ int CGW_Multi_Regression_Grid::On_Parameters_Enable(CSG_Parameters *pParameters,
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
@@ -390,8 +312,6 @@ bool CGW_Multi_Regression_Grid::On_Execute(void)
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
@@ -452,32 +372,21 @@ bool CGW_Multi_Regression_Grid::Initialize(CSG_Shapes *pPoints, int iDependent,
 	}
 
 	//-----------------------------------------------------
-	m_nPoints_Min	= Parameters("SEARCH_POINTS_MIN")->asInt   ();
-	m_nPoints_Max	= Parameters("SEARCH_POINTS_ALL")->asInt   () == 0
-					? Parameters("SEARCH_POINTS_MAX")->asInt   () : 0;
-	m_Radius		= Parameters("SEARCH_RANGE"     )->asInt   () == 0
-					? Parameters("SEARCH_RADIUS"    )->asDouble() : 0.0;
-	m_Direction		= Parameters("SEARCH_DIRECTION" )->asInt   () == 0 ? -1 : 4;
-
 	m_Weighting.Set_Parameters(&Parameters);
 
-	return( m_Points.Get_Count() > m_nPredictors
-		&& ((m_nPoints_Max <= 0 && m_Radius <= 0.0) || m_Search.Create(&m_Points, -1))
-	);
+	return( m_Points.Get_Count() > m_nPredictors && m_Search.Initialize(&m_Points, -1) );
 }
 
 //---------------------------------------------------------
 void CGW_Multi_Regression_Grid::Finalize(void)
 {
+	m_Search.Finalize();
 	m_Points.Destroy();
-	m_Search.Destroy();
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
@@ -488,18 +397,17 @@ bool CGW_Multi_Regression_Grid::Get_Model(void)
 	{
 		for(int x=0; x<m_dimModel.Get_NX(); x++)
 		{
-			double		q;
-			CSG_Vector	b;
+			CSG_Regression_Weighted	Model;
 
-			if( Get_Regression(x, y, q, b) )
+			if( Get_Model(x, y, Model) )
 			{
-				m_pQuality->Set_Value(x, y, q);
+				m_pQuality->Set_Value(x, y, Model.Get_R2());
 
-				m_pModel[m_nPredictors]->Set_Value(x, y, b[0]);
+				m_pModel[m_nPredictors]->Set_Value(x, y, Model[0]);
 
 				for(int i=0; i<m_nPredictors; i++)
 				{
-					m_pModel[i]->Set_Value(x, y, b[i + 1]);
+					m_pModel[i]->Set_Value(x, y, Model[i + 1]);
 				}
 			}
 			else
@@ -519,120 +427,46 @@ bool CGW_Multi_Regression_Grid::Get_Model(void)
 }
 
 //---------------------------------------------------------
-bool CGW_Multi_Regression_Grid::Get_Regression(int x, int y, double &Quality, CSG_Vector &b)
+bool CGW_Multi_Regression_Grid::Get_Model(int x, int y, CSG_Regression_Weighted &Model)
 {
 	//-----------------------------------------------------
-	int			i, nPoints;
-	double		zMean, zr, rss, tss;
-	CSG_Vector	z, w;
-	CSG_Matrix	Y, YtW;
-
-	if( (nPoints = Get_Variables(x, y, z, w, Y)) <= m_nPredictors )
-	{
-		return( false );
-	}
-
-	//-----------------------------------------------------
-	YtW.Create(nPoints, 1 + m_nPredictors);
-
-	for(i=0, zMean=0.0; i<nPoints; i++)
-	{
-		zMean		+= z[i];
-		YtW[0][i]	 = w[i];
-
-		for(int j=1; j<=m_nPredictors; j++)
-		{
-			YtW[j][i]	= Y[i][j] * w[i];
-		}
-	}
-
-	//-----------------------------------------------------
-	b		= (YtW * Y).Get_Inverse() * (YtW * z);
-
-	zMean	/= nPoints;
-
-	for(i=0, rss=0.0, tss=0.0; i<nPoints; i++)
-	{
-		zr	= b[0];
-
-		for(int j=1; j<=m_nPredictors; j++)
-		{
-			zr	+= b[j] * Y[i][j];
-		}
-
-		rss	+= w[i] * SG_Get_Square(z[i] - zr);
-		tss	+= w[i] * SG_Get_Square(z[i] - zMean);
-	}
-
-	Quality	= tss > 0.0 ? (tss - rss) / tss : 0.0;
-
-	//-----------------------------------------------------
-	return( true );
-}
-
-//---------------------------------------------------------
-int CGW_Multi_Regression_Grid::Get_Variables(int x, int y, CSG_Vector &z, CSG_Vector &w, CSG_Matrix &Y)
-{
 	TSG_Point	Point	= m_dimModel.Get_Grid_to_World(x, y);
-	int			nPoints	= m_Search.is_Okay() ? (int)m_Search.Select_Nearest_Points(Point.x, Point.y, m_nPoints_Max, m_Radius, m_Direction) : m_Points.Get_Count();
+	int			nPoints = m_Search.Set_Location(Point);
+
+	CSG_Vector	Predictors(m_nPredictors);
 
-	z.Create(nPoints);
-	w.Create(nPoints);
-	Y.Create(1 + m_nPredictors, nPoints);
+	Model.Destroy();
 
 	for(int iPoint=0; iPoint<nPoints; iPoint++)
 	{
 		double	ix, iy, iz;
 
-		CSG_Shape	*pPoint	= m_Search.is_Okay() && m_Search.Get_Selected_Point(iPoint, ix, iy, iz)
+		CSG_Shape	*pPoint = m_Search.Do_Use_All() && m_Search.Get_Point(iPoint, ix, iy, iz)
 			? m_Points.Get_Shape((int)iz)
 			: m_Points.Get_Shape(iPoint);
 
-		z[iPoint]		= pPoint->asDouble(0);
-		w[iPoint]		= m_Weighting.Get_Weight(SG_Get_Distance(Point, pPoint->Get_Point(0)));
-		Y[iPoint][0]	= 1.0;
-
-		for(int iPredictor=1; iPredictor<=m_nPredictors; iPredictor++)
+		for(int iPredictor=0; iPredictor<m_nPredictors; iPredictor++)
 		{
-			Y[iPoint][iPredictor]	= pPoint->asDouble(iPredictor);
+			Predictors[iPredictor]	= pPoint->asDouble(1 + iPredictor);
 		}
+
+		Model.Add_Sample(
+			m_Weighting.Get_Weight(SG_Get_Distance(Point, pPoint->Get_Point(0))),
+			pPoint->asDouble(0),
+			Predictors
+		);
 	}
 
-	return( nPoints );
+	//-----------------------------------------------------
+	return( Model.Calculate() );
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CGW_Multi_Regression_Grid::Set_Model(double x, double y, double &Value)
-{
-	if( !m_pModel[m_nPredictors]->Get_Value(x, y, Value, GRID_INTERPOLATION_BSpline) )
-	{
-		return( false );
-	}
-
-	double	Model, Predictor;
-
-	for(int i=0; i<m_nPredictors; i++)
-	{
-		if( !m_pModel     [i]->Get_Value(x, y, Model    , GRID_INTERPOLATION_BSpline)
-		||  !m_pPredictors[i]->Get_Value(x, y, Predictor, GRID_INTERPOLATION_NearestNeighbour) )
-		{
-			return( false );
-		}
-
-		Value	+= Model * Predictor;
-	}
-
-	return( true );
-}
-
-//---------------------------------------------------------
 bool CGW_Multi_Regression_Grid::Set_Model(void)
 {
 	CSG_Grid	*pRegression	= Parameters("REGRESSION")->asGrid();
@@ -658,13 +492,13 @@ bool CGW_Multi_Regression_Grid::Set_Model(void)
 
 			if( Set_Model(p_x, p_y, Value) )
 			{
-				GRID_SET_VALUE(pRegression, x, y, Value);
-				GRID_SET_VALUE(pQuality   , x, y, m_pQuality->Get_Value(p_x, p_y));
+				SG_GRID_PTR_SAFE_SET_VALUE(pRegression, x, y, Value);
+				SG_GRID_PTR_SAFE_SET_VALUE(pQuality   , x, y, m_pQuality->Get_Value(p_x, p_y));
 			}
 			else
 			{
-				GRID_SET_NODATA(pRegression, x, y);
-				GRID_SET_NODATA(pQuality   , x, y);
+				SG_GRID_PTR_SAFE_SET_NODATA(pRegression, x, y);
+				SG_GRID_PTR_SAFE_SET_NODATA(pQuality   , x, y);
 			}
 		}
 	}
@@ -675,11 +509,33 @@ bool CGW_Multi_Regression_Grid::Set_Model(void)
 	return( true );
 }
 
+//---------------------------------------------------------
+bool CGW_Multi_Regression_Grid::Set_Model(double x, double y, double &Value)
+{
+	if( !m_pModel[m_nPredictors]->Get_Value(x, y, Value, GRID_INTERPOLATION_BSpline) )
+	{
+		return( false );
+	}
+
+	double	Model, Predictor;
+
+	for(int i=0; i<m_nPredictors; i++)
+	{
+		if( !m_pModel     [i]->Get_Value(x, y, Model    , GRID_INTERPOLATION_BSpline)
+		||  !m_pPredictors[i]->Get_Value(x, y, Predictor, GRID_INTERPOLATION_NearestNeighbour) )
+		{
+			return( false );
+		}
+
+		Value	+= Model * Predictor;
+	}
+
+	return( true );
+}
+
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
diff --git a/src/modules/statistics/statistics_regression/gw_multi_regression_grid.h b/src/modules/statistics/statistics_regression/gw_multi_regression_grid.h
index e949e72..2e76571 100644
--- a/src/modules/statistics/statistics_regression/gw_multi_regression_grid.h
+++ b/src/modules/statistics/statistics_regression/gw_multi_regression_grid.h
@@ -78,45 +78,42 @@ class CGW_Multi_Regression_Grid : public CSG_Module_Grid
 public:
 	CGW_Multi_Regression_Grid(void);
 
-	virtual CSG_String			Get_MenuPath			(void)	{	return( _TL("R:GWR") );	}
+	virtual CSG_String				Get_MenuPath			(void)	{	return( _TL("A:Spatial and Geostatistics|Geographically Weighted Regression") );	}
 
 
 protected:
 
-	virtual int					On_Parameter_Changed	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
-	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+	virtual int						On_Parameter_Changed	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+	virtual int						On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
 
-	virtual bool				On_Execute				(void);
+	virtual bool					On_Execute				(void);
 
 
 private:
 
-	int							m_nPredictors, m_nPoints_Min, m_nPoints_Max, m_Direction;
+	int								m_nPredictors;
 
-	CSG_Grid					**m_pPredictors, **m_pModel, *m_pQuality;
+	CSG_Grid						**m_pPredictors, **m_pModel, *m_pQuality;
 
-	CSG_Grid_System				m_dimModel;
+	CSG_Grid_System					m_dimModel;
 
-	double						m_Radius;
+	CSG_Distance_Weighting			m_Weighting;
 
-	CSG_Distance_Weighting		m_Weighting;
+	CSG_Parameters_Search_Points	m_Search;
 
-	CSG_PRQuadTree				m_Search;
+	CSG_Shapes						m_Points;
 
-	CSG_Shapes					m_Points;
 
+	bool							Initialize				(CSG_Shapes *pPoints, int iDependent, CSG_Parameter_Grid_List *pPredictors);
+	void							Finalize				(void);
 
-	bool						Initialize				(CSG_Shapes *pPoints, int iDependent, CSG_Parameter_Grid_List *pPredictors);
-	void						Finalize				(void);
+	bool							Get_Model				(void);
+	bool							Get_Model				(int x, int y, CSG_Regression_Weighted &Model);
 
-	bool						Get_Model				(void);
-	bool						Get_Regression			(int x, int y, double &Quality, CSG_Vector &b);
-	int							Get_Variables			(int x, int y, CSG_Vector &z, CSG_Vector &w, CSG_Matrix &Y);
+	bool							Set_Model				(void);
+	bool							Set_Model				(double x, double y, double &Value);
 
-	bool						Set_Model				(void);
-	bool						Set_Model				(double x, double y, double &Value);
-
-	bool						Set_Residuals			(void);
+	bool							Set_Residuals			(void);
 
 };
 
diff --git a/src/modules/statistics/statistics_regression/gw_multi_regression_points.cpp b/src/modules/statistics/statistics_regression/gw_multi_regression_points.cpp
index 4e2d5aa..d10e211 100644
--- a/src/modules/statistics/statistics_regression/gw_multi_regression_points.cpp
+++ b/src/modules/statistics/statistics_regression/gw_multi_regression_points.cpp
@@ -69,16 +69,6 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#define SG_ARRAY_FREE(A)		if( A ) { SG_Free (A); A = NULL; }
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
 CGW_Multi_Regression_Points::CGW_Multi_Regression_Points(void)
 {
 	CSG_Parameter	*pNode;
@@ -92,17 +82,7 @@ CGW_Multi_Regression_Points::CGW_Multi_Regression_Points(void)
 		"Geographically Weighted Regression for multiple predictors. "
 		"Regression details are stored in a copy of input points.\n"
 		"Reference:\n"
-		"- Fotheringham, S.A., Brunsdon, C., Charlton, M. (2002):"
-		" Geographically Weighted Regression: the analysis of spatially varying relationships. John Wiley & Sons."
-		" <a target=\"_blank\" href=\"http://onlinelibrary.wiley.com/doi/10.1111/j.1538-4632.2003.tb01114.x/abstract\">online</a>.\n"
-		"\n"
-		"- Fotheringham, S.A., Charlton, M., Brunsdon, C. (1998):"
-		" Geographically weighted regression: a natural evolution of the expansion method for spatial data analysis."
-		" Environment and Planning A 30(11), 1905�1927."
-		" <a target=\"_blank\" href=\"http://www.envplan.com/abstract.cgi?id=a301905\">online</a>.\n"
-		"\n"
-		" - Lloyd, C. (2010): Spatial Data Analysis - An Introduction for GIS Users. Oxford, 206p.\n"
-	));
+	) + GWR_References);
 
 	//-----------------------------------------------------
 	pNode	= Parameters.Add_Shapes(
@@ -132,83 +112,34 @@ CGW_Multi_Regression_Points::CGW_Multi_Regression_Points(void)
 	m_Weighting.Create_Parameters(&Parameters, false);
 
 	//-----------------------------------------------------
-	CSG_Parameter	*pSearch	= Parameters.Add_Node(
-		NULL	, "NODE_SEARCH"			, _TL("Search Options"),
-		_TL("")
-	);
-
-	pNode	= Parameters.Add_Choice(
-		pSearch	, "SEARCH_RANGE"		, _TL("Search Range"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("local"),
-			_TL("global")
-		)
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_RADIUS"		, _TL("Maximum Search Distance"),
-		_TL("local maximum search distance given in map units"),
-		PARAMETER_TYPE_Double	, 1000.0, 0, true
-	);
+	m_Search.Create(&Parameters, Parameters.Add_Node(NULL, "NODE_SEARCH", _TL("Search Options"), _TL("")), 16);
 
-	pNode	= Parameters.Add_Choice(
-		pSearch	, "SEARCH_POINTS_ALL"	, _TL("Number of Points"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("maximum number of nearest points"),
-			_TL("all points within search distance")
-		)
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_POINTS_MIN"	, _TL("Minimum"),
-		_TL("minimum number of points to use"),
-		PARAMETER_TYPE_Int, 4, 1, true
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_POINTS_MAX"	, _TL("Maximum"),
-		_TL("maximum number of nearest points"),
-		PARAMETER_TYPE_Int, 20, 1, true
-	);
-
-	Parameters.Add_Choice(
-		pNode	, "SEARCH_DIRECTION"	, _TL("Search Direction"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("all directions"),
-			_TL("quadrants")
-		)
-	);
+	Parameters("SEARCH_RANGE"     )->Set_Value(1);
+	Parameters("SEARCH_POINTS_ALL")->Set_Value(1);
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 int CGW_Multi_Regression_Points::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "POINTS") )
+	{
+		m_Search.On_Parameter_Changed(pParameters, pParameter);
+
+		pParameters->Set_Parameter("DW_BANDWIDTH", GWR_Fit_To_Density(pParameter->asShapes(), 4.0, 1));
+	}
+
 	return( 1 );
 }
 
 //---------------------------------------------------------
 int CGW_Multi_Regression_Points::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("SEARCH_RANGE")) )
-	{
-		pParameters->Get_Parameter("SEARCH_RADIUS"    )->Set_Enabled(pParameter->asInt() == 0);	// local
-	}
-
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("SEARCH_POINTS_ALL")) )
-	{
-		pParameters->Get_Parameter("SEARCH_POINTS_MAX")->Set_Enabled(pParameter->asInt() == 0);	// maximum number of points
-		pParameters->Get_Parameter("SEARCH_DIRECTION" )->Set_Enabled(pParameter->asInt() == 0);	// maximum number of points per quadrant
-	}
+	m_Search.On_Parameters_Enable(pParameters, pParameter);
 
 	m_Weighting.Enable_Parameters(pParameters);
 
@@ -218,31 +149,19 @@ int CGW_Multi_Regression_Points::On_Parameters_Enable(CSG_Parameters *pParameter
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CGW_Multi_Regression_Points::Get_Predictors(void)
+bool CGW_Multi_Regression_Points::Initialize(void)
 {
-	int				i, iDependent;
-	CSG_Shapes		*pPoints;
-
 	//-----------------------------------------------------
-	m_pPoints		= Parameters("REGRESSION"       )->asShapes();
-
-	m_nPoints_Min	= Parameters("SEARCH_POINTS_MIN")->asInt   ();
-	m_nPoints_Max	= Parameters("SEARCH_POINTS_ALL")->asInt   () == 0
-					? Parameters("SEARCH_POINTS_MAX")->asInt   () : 0;
-	m_Radius		= Parameters("SEARCH_RANGE"     )->asInt   () == 0
-					? Parameters("SEARCH_RADIUS"    )->asDouble() : 0.0;
-	m_Direction		= Parameters("SEARCH_DIRECTION" )->asInt   () == 0 ? -1 : 4;
+	m_pPoints	= Parameters("REGRESSION")->asShapes();
 
 	m_Weighting.Set_Parameters(&Parameters);
 
 	//-----------------------------------------------------
-	iDependent	= Parameters("DEPENDENT")->asInt   ();
-	pPoints		= Parameters("POINTS"   )->asShapes();
+	int			iDependent	= Parameters("DEPENDENT")->asInt   ();
+	CSG_Shapes	*pPoints	= Parameters("POINTS"   )->asShapes();
 
 	m_pPoints->Create(SHAPE_TYPE_Point, CSG_String::Format(SG_T("%s.%s [%s]"), pPoints->Get_Name(), pPoints->Get_Field_Name(iDependent), _TL("GWR")));
 	m_pPoints->Add_Field(pPoints->Get_Field_Name(iDependent), SG_DATATYPE_Double);
@@ -258,7 +177,9 @@ bool CGW_Multi_Regression_Points::Get_Predictors(void)
 	}
 
 	//-----------------------------------------------------
-	for(i=0; i<m_nPredictors; i++)
+	int		i;
+
+	for(i=0; i<m_nPredictors; i++)	// predictor values
 	{
 		m_pPoints->Add_Field(pPoints->Get_Field_Name(pFields->Get_Index(i)), SG_DATATYPE_Double);
 	}
@@ -269,18 +190,23 @@ bool CGW_Multi_Regression_Points::Get_Predictors(void)
 	m_pPoints->Add_Field("RESIDUAL"  , SG_DATATYPE_Double);	// m_nPredictors + 3
 	m_pPoints->Add_Field("INTERCEPT" , SG_DATATYPE_Double);	// m_nPredictors + 4
 
+	for(i=0; i<m_nPredictors; i++)	// predictor model slopes
+	{
+		m_pPoints->Add_Field(CSG_String::Format("%s.%s", _TL("SLOPE"), pPoints->Get_Field_Name(pFields->Get_Index(i))), SG_DATATYPE_Double);
+	}
+
 	for(int iPoint=0; iPoint<pPoints->Get_Count(); iPoint++)
 	{
 		CSG_Shape	*pPoint	= pPoints->Get_Shape(iPoint);
 
-		bool	bAdd	= !pPoint->is_NoData(iDependent);
+		bool	bOkay	= !pPoint->is_NoData(iDependent);
 
-		for(i=0; bAdd && i<m_nPredictors; i++)
+		for(i=0; bOkay && i<m_nPredictors; i++)
 		{
-			bAdd	= !pPoint->is_NoData(pFields->Get_Index(i));
+			bOkay	= !pPoint->is_NoData(pFields->Get_Index(i));
 		}
 
-		if( bAdd )
+		if( bOkay )
 		{
 			CSG_Shape	*pAdd	= m_pPoints->Add_Shape(pPoint, SHAPE_COPY_GEOM);
 
@@ -301,7 +227,7 @@ bool CGW_Multi_Regression_Points::Get_Predictors(void)
 		return( false );
 	}
 
-	if( (m_nPoints_Max > 0 || m_Radius > 0.0) && !m_Search.Create(m_pPoints, -1) )
+	if( !m_Search.Initialize(m_pPoints, -1) )
 	{
 		Error_Set(_TL("failed to create searche engine"));
 
@@ -309,37 +235,25 @@ bool CGW_Multi_Regression_Points::Get_Predictors(void)
 	}
 
 	//-----------------------------------------------------
-	int	nPoints_Max	= m_nPoints_Max > 0 ? m_nPoints_Max : m_pPoints->Get_Count();
-
-	m_y.Create(1 + m_nPredictors, nPoints_Max);
-	m_z.Create(nPoints_Max);
-	m_w.Create(nPoints_Max);
-
 	return( true );
 }
 
 //---------------------------------------------------------
 void CGW_Multi_Regression_Points::Finalize(void)
 {
-	m_Search.Destroy();
-
-	m_y.Destroy();
-	m_z.Destroy();
-	m_w.Destroy();
+	m_Search.Finalize();
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 bool CGW_Multi_Regression_Points::On_Execute(void)
 {
 	//-----------------------------------------------------
-	if( !Get_Predictors() )
+	if( !Initialize() )
 	{
 		Finalize();
 
@@ -349,8 +263,24 @@ bool CGW_Multi_Regression_Points::On_Execute(void)
 	//-----------------------------------------------------
 	for(int iPoint=0; iPoint<m_pPoints->Get_Count() && Set_Progress(iPoint, m_pPoints->Get_Count()); iPoint++)
 	{
-		if( !Get_Regression(m_pPoints->Get_Shape(iPoint)) )
+		CSG_Shape	*pPoint = m_pPoints->Get_Shape(iPoint);
+
+		CSG_Regression_Weighted	Model;
+
+		if( Get_Model(pPoint->Get_Point(0), Model) )
 		{
+			double	Regression	= 0.0;
+
+			for(int i=0; i<=m_nPredictors; i++)
+			{
+				pPoint->Set_Value(m_nPredictors + 4 + i, Model[i]);
+
+				Regression += i == 0 ? Model[i] : Model[i] * pPoint->asDouble(i);
+			}
+
+			pPoint->Set_Value(m_nPredictors + 1, Model.Get_R2());
+			pPoint->Set_Value(m_nPredictors + 2, Regression);
+			pPoint->Set_Value(m_nPredictors + 3, pPoint->asDouble(0) - Regression);	// Residual
 		}
 	}
 
@@ -363,118 +293,39 @@ bool CGW_Multi_Regression_Points::On_Execute(void)
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-int CGW_Multi_Regression_Points::Set_Variables(const TSG_Point &Point)
-{
-	int			iPoint, jPoint, nPoints, iPredictor;
-	CSG_Shape	*pPoint;
-
-	nPoints	= m_Search.is_Okay() ? (int)m_Search.Select_Nearest_Points(Point.x, Point.y, m_nPoints_Max, m_Radius, m_Direction) : m_pPoints->Get_Count();
-
-	for(iPoint=0, jPoint=0; iPoint<nPoints; iPoint++)
-	{
-		if( m_Search.is_Okay() )
-		{
-			double	ix, iy, iz;
-
-			m_Search.Get_Selected_Point(iPoint, ix, iy, iz);
-
-			pPoint	= m_pPoints->Get_Shape((int)iz);
-		}
-		else
-		{
-			pPoint	= m_pPoints->Get_Shape(iPoint);
-		}
-
-		m_z[iPoint]	= pPoint->asDouble(m_nPredictors);
-		m_w[iPoint]	= m_Weighting.Get_Weight(SG_Get_Distance(Point, pPoint->Get_Point(0)));
-
-		for(iPredictor=0; iPredictor<m_nPredictors; iPredictor++)
-		{
-			m_y[iPoint][iPredictor]	= pPoint->asDouble(iPredictor);
-		}
-	}
-
-	return( nPoints );
-}
-
-//---------------------------------------------------------
-bool CGW_Multi_Regression_Points::Get_Regression(CSG_Shape *pPoint)
+bool CGW_Multi_Regression_Points::Get_Model(const TSG_Point &Point, CSG_Regression_Weighted &Model)
 {
-	int		nPoints	= Set_Variables(pPoint->Get_Point(0));
-
-	if( nPoints < m_nPoints_Min )
-	{
-		return( false );
-	}
-
 	//-----------------------------------------------------
-	int			i;
-	double		zMean, rss, tss;
-	CSG_Vector	b, z;
-	CSG_Matrix	Y, YtW;
-
-	//-----------------------------------------------------
-	z  .Create(nPoints);
-	Y  .Create(1 + m_nPredictors, nPoints);
-	YtW.Create(nPoints, 1 + m_nPredictors);
-
-	for(i=0, zMean=0.0; i<nPoints; i++)
-	{
-		Y  [i][0]	= 1.0;
-		YtW[0][i]	= m_w[i];
-
-		for(int j=0; j<m_nPredictors; j++)
-		{
-			Y  [i][j + 1]	= m_y[i][j];
-			YtW[j + 1][i]	= m_y[i][j] * m_w[i];
-		}
-
-		zMean		+= (z[i] = m_z[i]);
-	}
+	int	nPoints	= m_Search.Set_Location(Point);
 
-	//-----------------------------------------------------
-	b		= (YtW * Y).Get_Inverse() * (YtW * m_z);
+	CSG_Vector	Predictors(m_nPredictors);
 
-	zMean	/= nPoints;
+	Model.Destroy();
 
-	for(i=0, rss=0.0, tss=0.0; i<nPoints; i++)
+	for(int iPoint=0; iPoint<nPoints; iPoint++)
 	{
-		double	zr	= b[0];
+		double	ix, iy, iz;
+
+		CSG_Shape	*pPoint = m_Search.Do_Use_All() && m_Search.Get_Point(iPoint, ix, iy, iz)
+			? m_pPoints->Get_Shape((int)iz)
+			: m_pPoints->Get_Shape(iPoint);
 
-		for(int j=0; j<m_nPredictors; j++)
+		for(int iPredictor=0; iPredictor<m_nPredictors; iPredictor++)
 		{
-			zr	+= b[j + 1] * m_y[i][j];
+			Predictors[iPredictor]	= pPoint->asDouble(iPredictor);
 		}
 
-		rss	+= m_w[i] * SG_Get_Square(m_z[i] - zr);
-		tss	+= m_w[i] * SG_Get_Square(m_z[i] - zMean);
-	}
-
-	//-----------------------------------------------------
-	double	Regression	= b[0];
-
-	for(i=1; i<=m_nPredictors; i++)
-	{
-		Regression	+= b[i] * pPoint->asDouble(i);
+		Model.Add_Sample(
+			m_Weighting.Get_Weight(SG_Get_Distance(Point, pPoint->Get_Point(0))),
+			pPoint->asDouble(m_nPredictors), Predictors
+		);
 	}
 
 	//-----------------------------------------------------
-	pPoint->Set_Value(1 + m_nPredictors, tss > 0.0 ? (tss - rss) / tss : 0.0);	// R2
-	pPoint->Set_Value(2 + m_nPredictors, Regression);							// Regression
-	pPoint->Set_Value(3 + m_nPredictors, pPoint->asDouble(0) - Regression);		// Residual
-
-	for(i=0; i<=m_nPredictors; i++)
-	{
-		pPoint->Set_Value(4 + m_nPredictors + i, b[i]);
-	}
-
-	//-----------------------------------------------------
-	return( true );
+	return( Model.Calculate() );
 }
 
 
diff --git a/src/modules/statistics/statistics_regression/gw_multi_regression_points.h b/src/modules/statistics/statistics_regression/gw_multi_regression_points.h
index 53587b0..e3e2132 100644
--- a/src/modules/statistics/statistics_regression/gw_multi_regression_points.h
+++ b/src/modules/statistics/statistics_regression/gw_multi_regression_points.h
@@ -78,43 +78,32 @@ class CGW_Multi_Regression_Points : public CSG_Module
 public:
 	CGW_Multi_Regression_Points(void);
 
-	virtual CSG_String			Get_MenuPath			(void)	{	return( _TL("R:GWR") );	}
+	virtual CSG_String				Get_MenuPath			(void)	{ return(_TL("A:Spatial and Geostatistics|Geographically Weighted Regression")); }
 
 
 protected:
 
-	virtual bool				On_Execute				(void);
+	virtual bool					On_Execute				(void);
 
-	virtual int					On_Parameter_Changed	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
-	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+	virtual int						On_Parameter_Changed	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+	virtual int						On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
 
 
 private:
 
-	int							m_nPredictors, m_nPoints_Min, m_nPoints_Max, m_Direction;
+	int								m_nPredictors;
 
-	double						m_Radius;
+	CSG_Distance_Weighting			m_Weighting;
 
-	CSG_Distance_Weighting		m_Weighting;
+	CSG_Parameters_Search_Points	m_Search;
 
-	CSG_PRQuadTree				m_Search;
+	CSG_Shapes						*m_pPoints;
 
-	CSG_Vector					m_z, m_w;
 
-	CSG_Matrix					m_y;
+	bool							Initialize				(void);
+	void							Finalize				(void);
 
-	CSG_Shapes					*m_pPoints;
-
-
-	void						Finalize				(void);
-
-	bool						Get_Predictors			(void);
-
-	int							Set_Variables			(const TSG_Point &Point);
-
-	bool						Get_Regression			(CSG_Shape *pPoint);
-
-	bool						Set_Residuals			(void);
+	bool							Get_Model				(const TSG_Point &Point, CSG_Regression_Weighted &Model);
 
 };
 
diff --git a/src/modules/statistics/statistics_regression/gw_regression.cpp b/src/modules/statistics/statistics_regression/gw_regression.cpp
index 03b6262..d0ed972 100644
--- a/src/modules/statistics/statistics_regression/gw_regression.cpp
+++ b/src/modules/statistics/statistics_regression/gw_regression.cpp
@@ -80,17 +80,7 @@ CGW_Regression::CGW_Regression(void)
 
 	Set_Description	(_TW(
 		"Reference:\n"
-		"- Fotheringham, S.A., Brunsdon, C., Charlton, M. (2002):"
-		" Geographically Weighted Regression: the analysis of spatially varying relationships. John Wiley & Sons."
-		" <a target=\"_blank\" href=\"http://onlinelibrary.wiley.com/doi/10.1111/j.1538-4632.2003.tb01114.x/abstract\">online</a>.\n"
-		"\n"
-		"- Fotheringham, S.A., Charlton, M., Brunsdon, C. (1998):"
-		" Geographically weighted regression: a natural evolution of the expansion method for spatial data analysis."
-		" Environment and Planning A 30(11), 1905�1927."
-		" <a target=\"_blank\" href=\"http://www.envplan.com/abstract.cgi?id=a301905\">online</a>.\n"
-		"\n"
-		" - Lloyd, C. (2010): Spatial Data Analysis - An Introduction for GIS Users. Oxford, 206p.\n"
-	));
+	) + GWR_References);
 
 	//-----------------------------------------------------
 	pNode	= Parameters.Add_Shapes(
@@ -121,70 +111,27 @@ CGW_Regression::CGW_Regression(void)
 	m_Weighting.Create_Parameters(&Parameters, false);
 
 	//-----------------------------------------------------
-	CSG_Parameter	*pSearch	= Parameters.Add_Node(
-		NULL	, "NODE_SEARCH"			, _TL("Search Options"),
-		_TL("")
-	);
-
-	pNode	= Parameters.Add_Choice(
-		pSearch	, "SEARCH_RANGE"		, _TL("Search Range"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("local"),
-			_TL("global")
-		)
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_RADIUS"		, _TL("Maximum Search Distance"),
-		_TL("local maximum search distance given in map units"),
-		PARAMETER_TYPE_Double	, 1000.0, 0, true
-	);
-
-	pNode	= Parameters.Add_Choice(
-		pSearch	, "SEARCH_POINTS_ALL"	, _TL("Number of Points"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("maximum number of nearest points"),
-			_TL("all points within search distance")
-		)
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_POINTS_MIN"	, _TL("Minimum"),
-		_TL("minimum number of points to use"),
-		PARAMETER_TYPE_Int, 4, 1, true
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_POINTS_MAX"	, _TL("Maximum"),
-		_TL("maximum number of nearest points"),
-		PARAMETER_TYPE_Int, 20, 1, true
-	);
+	m_Search.Create(&Parameters, Parameters.Add_Node(NULL, "NODE_SEARCH", _TL("Search Options"), _TL("")), 16);
 
-	Parameters.Add_Choice(
-		pNode	, "SEARCH_DIRECTION"	, _TL("Search Direction"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("all directions"),
-			_TL("quadrants")
-		)
-	);
+	Parameters("SEARCH_RANGE")->Set_Value(1);
+	Parameters("SEARCH_POINTS_ALL")->Set_Value(1);
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
 int CGW_Regression::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	if( !SG_STR_CMP(pParameter->Get_Identifier(), "POINTS") && pParameter->asShapes() )
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "POINTS") )
 	{
-		m_Grid_Target.Set_User_Defined(pParameters, pParameter->asShapes()->Get_Extent());
+		m_Grid_Target.Set_User_Defined(pParameters, pParameter->asShapes());
+
+		m_Search.On_Parameter_Changed(pParameters, pParameter);
+
+		pParameters->Set_Parameter("DW_BANDWIDTH", GWR_Fit_To_Density(pParameter->asShapes(), 4.0, 1));
 	}
 
 	return( m_Grid_Target.On_Parameter_Changed(pParameters, pParameter) ? 1 : 0 );
@@ -193,16 +140,7 @@ int CGW_Regression::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parame
 //---------------------------------------------------------
 int CGW_Regression::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), "SEARCH_RANGE") )
-	{
-		pParameters->Set_Enabled("SEARCH_RADIUS"    , pParameter->asInt() == 0);	// local
-	}
-
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), "SEARCH_POINTS_ALL") )
-	{
-		pParameters->Set_Enabled("SEARCH_POINTS_MAX", pParameter->asInt() == 0);	// maximum number of points
-		pParameters->Set_Enabled("SEARCH_DIRECTION" , pParameter->asInt() == 0);	// maximum number of points per quadrant
-	}
+	m_Search.On_Parameters_Enable(pParameters, pParameter);
 
 	m_Weighting.Enable_Parameters(pParameters);
 
@@ -212,8 +150,6 @@ int CGW_Regression::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parame
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
@@ -224,23 +160,16 @@ bool CGW_Regression::On_Execute(void)
 	m_iDependent	= Parameters("DEPENDENT")->asInt   ();
 	m_iPredictor	= Parameters("PREDICTOR")->asInt   ();
 
-	m_nPoints_Min	= Parameters("SEARCH_POINTS_MIN")->asInt   ();
-	m_nPoints_Max	= Parameters("SEARCH_POINTS_ALL")->asInt   () == 0
-					? Parameters("SEARCH_POINTS_MAX")->asInt   () : 0;
-	m_Radius		= Parameters("SEARCH_RANGE"     )->asInt   () == 0
-					? Parameters("SEARCH_RADIUS"    )->asDouble() : 0.0;
-	m_Direction		= Parameters("SEARCH_DIRECTION" )->asInt   () == 0 ? -1 : 4;
-
 	m_Weighting.Set_Parameters(&Parameters);
 
 	//-----------------------------------------------------
-	if( (m_nPoints_Max > 0 || m_Radius > 0.0) && !m_Search.Create(m_pPoints, -1) )
+	if( !m_Search.Initialize(m_pPoints, -1) )
 	{
 		return( false );
 	}
 
 	//-----------------------------------------------------
-	m_Grid_Target.Set_User_Defined(Get_Parameters("TARGET"), m_pPoints->Get_Extent());	Dlg_Parameters("TARGET");	// if called from saga_cmd
+	m_Grid_Target.Cmd_Update(m_pPoints);	// if called from saga_cmd
 
 	m_pQuality		= m_Grid_Target.Get_Grid("QUALITY"  );
 	m_pSlope		= m_Grid_Target.Get_Grid("SLOPE"    );
@@ -248,7 +177,7 @@ bool CGW_Regression::On_Execute(void)
 
 	if( !m_pIntercept || !m_pSlope || !m_pQuality )
 	{
-		m_Search.Destroy();
+		m_Search.Finalize();
 
 		return( false );
 	}
@@ -258,18 +187,19 @@ bool CGW_Regression::On_Execute(void)
 	m_pQuality  ->Set_Name(CSG_String::Format(SG_T("%s (%s)"), Parameters("DEPENDENT")->asString(), _TL("GWR Quality")));
 
 	//-----------------------------------------------------
-	int	nPoints_Max	= m_nPoints_Max > 0 ? m_nPoints_Max : m_pPoints->Get_Count();
-
-	m_y.Create(nPoints_Max);
-	m_z.Create(nPoints_Max);
-	m_w.Create(nPoints_Max);
-
-	//-----------------------------------------------------
 	for(int y=0; y<m_pIntercept->Get_NY() && Set_Progress(y, m_pIntercept->Get_NY()); y++)
 	{
 		for(int x=0; x<m_pIntercept->Get_NX(); x++)
 		{
-			if( !Get_Regression(x, y) )
+			CSG_Regression_Weighted	Model;
+
+			if( Get_Model(x, y, Model) )
+			{
+				m_pIntercept->Set_Value(x, y, Model[0]);
+				m_pSlope    ->Set_Value(x, y, Model[1]);
+				m_pQuality  ->Set_Value(x, y, Model.Get_R2());
+			}
+			else
 			{
 				m_pIntercept->Set_NoData(x, y);
 				m_pSlope    ->Set_NoData(x, y);
@@ -279,11 +209,7 @@ bool CGW_Regression::On_Execute(void)
 	}
 
 	//-----------------------------------------------------
-	m_y.Destroy();
-	m_z.Destroy();
-	m_w.Destroy();
-
-	m_Search.Destroy();
+	m_Search.Finalize();
 
 	DataObject_Update(m_pIntercept);
 	DataObject_Update(m_pSlope);
@@ -295,96 +221,36 @@ bool CGW_Regression::On_Execute(void)
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-int CGW_Regression::Set_Variables(int x, int y)
+bool CGW_Regression::Get_Model(int x, int y, CSG_Regression_Weighted &Model)
 {
-	int			iPoint, jPoint, nPoints;
-	TSG_Point	Point;
-	CSG_Shape	*pPoint;
+	//-----------------------------------------------------
+	TSG_Point	Point	= m_pIntercept->Get_System().Get_Grid_to_World(x, y);
+	int			nPoints	= m_Search.Set_Location(Point);
 
-	Point	= m_pIntercept->Get_System().Get_Grid_to_World(x, y);
-	nPoints	= m_Search.is_Okay() ? (int)m_Search.Select_Nearest_Points(Point.x, Point.y, m_nPoints_Max, m_Radius, m_Direction) : m_pPoints->Get_Count();
+	Model.Destroy();
 
-	for(iPoint=0, jPoint=0; iPoint<nPoints; iPoint++)
+	for(int iPoint=0; iPoint<nPoints; iPoint++)
 	{
-		if( m_Search.is_Okay() )
-		{
-			double	ix, iy, iz;
+		double	ix, iy, iz;
 
-			m_Search.Get_Selected_Point(iPoint, ix, iy, iz);
-
-			pPoint	= m_pPoints->Get_Shape((int)iz);
-		}
-		else
-		{
-			pPoint	= m_pPoints->Get_Shape(iPoint);
-		}
+		CSG_Shape	*pPoint = m_Search.Do_Use_All() && m_Search.Get_Point(iPoint, ix, iy, iz)
+			? m_pPoints->Get_Shape((int)iz)
+			: m_pPoints->Get_Shape(iPoint);
 
 		if( !pPoint->is_NoData(m_iDependent) && !pPoint->is_NoData(m_iPredictor) )
 		{
-			m_z[jPoint]	= pPoint->asDouble(m_iDependent);
-			m_y[jPoint]	= pPoint->asDouble(m_iPredictor);
-			m_w[jPoint]	= m_Weighting.Get_Weight(SG_Get_Distance(Point, pPoint->Get_Point(0)));
-
-			jPoint++;
+			Model.Add_Sample(
+				m_Weighting.Get_Weight(SG_Get_Distance(Point, pPoint->Get_Point(0))),
+				pPoint->asDouble(m_iDependent), CSG_Vector(1, &(iz = pPoint->asDouble(m_iPredictor)))
+			);
 		}
 	}
 
-	return( jPoint );
-}
-
-//---------------------------------------------------------
-bool CGW_Regression::Get_Regression(int x, int y)
-{
-	int		nPoints	= Set_Variables(x, y);
-
-	if( nPoints < m_nPoints_Min )
-	{
-		return( false );
-	}
-
-	//-----------------------------------------------------
-	int			i;
-	double		zMean, rss, tss;
-	CSG_Vector	b, z;
-	CSG_Matrix	Y, YtW;
-
-	//-----------------------------------------------------
-	z  .Create(nPoints);
-	Y  .Create(2, nPoints);
-	YtW.Create(nPoints, 2);
-
-	for(i=0, zMean=0.0; i<nPoints; i++)
-	{
-		Y  [i][0]	= 1.0;
-		Y  [i][1]	= m_y[i];
-		YtW[0][i]	= m_w[i];
-		YtW[1][i]	= m_w[i] * m_y[i];
-
-		zMean		+= (z[i] = m_z[i]);
-	}
-
 	//-----------------------------------------------------
-	b		= (YtW * Y).Get_Inverse() * (YtW * z);
-
-	zMean	/= nPoints;
-
-	for(i=0, rss=0.0, tss=0.0; i<nPoints; i++)
-	{
-		rss	+= m_w[i] * SG_Get_Square(m_z[i] - (b[0] + b[1] * m_y[i]));
-		tss	+= m_w[i] * SG_Get_Square(m_z[i] - zMean);
-	}
-
-	m_pIntercept->Set_Value(x, y, b[0]);
-	m_pSlope    ->Set_Value(x, y, b[1]);
-	m_pQuality  ->Set_Value(x, y, (tss - rss) / tss);
-
-	//-----------------------------------------------------
-	return( true );
+	return( Model.Calculate() );
 }
 
 
diff --git a/src/modules/statistics/statistics_regression/gw_regression.h b/src/modules/statistics/statistics_regression/gw_regression.h
index 5251670..c88e48b 100644
--- a/src/modules/statistics/statistics_regression/gw_regression.h
+++ b/src/modules/statistics/statistics_regression/gw_regression.h
@@ -78,41 +78,37 @@ class CGW_Regression : public CSG_Module
 public:
 	CGW_Regression(void);
 
-	virtual CSG_String			Get_MenuPath			(void)	{	return( _TL("R:GWR") );	}
+	virtual CSG_String				Get_MenuPath			(void)	{ return(_TL("A:Spatial and Geostatistics|Geographically Weighted Regression")); }
 
 
 protected:
 
-	virtual bool				On_Execute				(void);
+	virtual bool					On_Execute				(void);
 
-	virtual int					On_Parameter_Changed	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
-	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+	virtual int						On_Parameter_Changed	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+	virtual int						On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
 
 
 private:
 
-	int							m_iDependent, m_iPredictor, m_nPoints_Min, m_nPoints_Max, m_Direction;
+	int								m_iDependent, m_iPredictor;
 
-	double						m_Radius;
+	CSG_Parameters_Grid_Target		m_Grid_Target;
 
-	CSG_Parameters_Grid_Target	m_Grid_Target;
+	CSG_Distance_Weighting			m_Weighting;
 
-	CSG_Distance_Weighting		m_Weighting;
+	CSG_Parameters_Search_Points	m_Search;
 
-	CSG_PRQuadTree				m_Search;
+	CSG_Shapes						*m_pPoints;
 
-	CSG_Vector					m_y, m_z, m_w;
+	CSG_Grid						*m_pIntercept, *m_pSlope, *m_pQuality;
 
-	CSG_Shapes					*m_pPoints;
 
-	CSG_Grid					*m_pIntercept, *m_pSlope, *m_pQuality;
+	int								Set_Variables			(int x, int y);
 
+	bool							Get_Model				(int x, int y, CSG_Regression_Weighted &Model);
 
-	int							Set_Variables			(int x, int y);
-
-	bool						Get_Regression			(int x, int y);
-
-	bool						Set_Residuals			(void);
+	bool							Set_Residuals			(void);
 
 };
 
diff --git a/src/modules/statistics/statistics_regression/gw_regression_grid.cpp b/src/modules/statistics/statistics_regression/gw_regression_grid.cpp
index e7b701b..74743c9 100644
--- a/src/modules/statistics/statistics_regression/gw_regression_grid.cpp
+++ b/src/modules/statistics/statistics_regression/gw_regression_grid.cpp
@@ -69,9 +69,7 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#define GRID_INIT(g, s)				if( g ) { g->Set_Name(CSG_String::Format(SG_T("%s (%s - %s)"), Parameters("DEPENDENT")->asString(), s, m_pPredictor->Get_Name())); }
-#define GRID_SET_NODATA(g, x, y)	if( g ) { g->Set_NoData(x, y); }
-#define GRID_SET_VALUE(g, x, y, z)	if( g ) { g->Set_Value(x, y, z); }
+#define GRID_INIT(g, s)		if( g ) { g->Set_Name(CSG_String::Format(SG_T("%s (%s - %s)"), Parameters("DEPENDENT")->asString(), s, m_pPredictor->Get_Name())); }
 
 
 ///////////////////////////////////////////////////////////
@@ -94,17 +92,25 @@ CGW_Regression_Grid::CGW_Regression_Grid(void)
 		"Geographically Weighted Regression for a single predictor supplied as grid, "
 		"to which the regression model is applied. Further details can be stored optionally.\n"
 		"Reference:\n"
-		"- Fotheringham, S.A., Brunsdon, C., Charlton, M. (2002):"
-		" Geographically Weighted Regression: the analysis of spatially varying relationships. John Wiley & Sons."
-		" <a target=\"_blank\" href=\"http://onlinelibrary.wiley.com/doi/10.1111/j.1538-4632.2003.tb01114.x/abstract\">online</a>.\n"
-		"\n"
-		"- Fotheringham, S.A., Charlton, M., Brunsdon, C. (1998):"
-		" Geographically weighted regression: a natural evolution of the expansion method for spatial data analysis."
-		" Environment and Planning A 30(11), 1905�1927."
-		" <a target=\"_blank\" href=\"http://www.envplan.com/abstract.cgi?id=a301905\">online</a>.\n"
-		"\n"
-		" - Lloyd, C. (2010): Spatial Data Analysis - An Introduction for GIS Users. Oxford, 206p.\n"
-	));
+	) + GWR_References);
+
+	//-----------------------------------------------------
+	pNode = Parameters.Add_Shapes(
+		NULL	, "POINTS"		, _TL("Points"),
+		_TL(""),
+		PARAMETER_INPUT, SHAPE_TYPE_Point
+	);
+
+	Parameters.Add_Table_Field(
+		pNode	, "DEPENDENT"	, _TL("Dependent Variable"),
+		_TL("")
+	);
+
+	Parameters.Add_Shapes(
+		NULL	, "RESIDUALS"	, _TL("Residuals"),
+		_TL(""),
+		PARAMETER_OUTPUT_OPTIONAL, SHAPE_TYPE_Point
+	);
 
 	//-----------------------------------------------------
 	Parameters.Add_Grid(
@@ -137,100 +143,40 @@ CGW_Regression_Grid::CGW_Regression_Grid(void)
 		PARAMETER_OUTPUT_OPTIONAL
 	);
 
-	pNode	= Parameters.Add_Shapes(
-		NULL	, "POINTS"		, _TL("Points"),
-		_TL(""),
-		PARAMETER_INPUT, SHAPE_TYPE_Point
-	);
-
-	Parameters.Add_Table_Field(
-		pNode	, "DEPENDENT"	, _TL("Dependent Variable"),
-		_TL("")
-	);
-
-	Parameters.Add_Shapes(
-		NULL	, "RESIDUALS"	, _TL("Residuals"),
-		_TL(""),
-		PARAMETER_OUTPUT_OPTIONAL, SHAPE_TYPE_Point
-	);
-
 	//-----------------------------------------------------
 	m_Weighting.Set_Weighting(SG_DISTWGHT_GAUSS);
 	m_Weighting.Create_Parameters(&Parameters, false);
 
 	//-----------------------------------------------------
-	CSG_Parameter	*pSearch	= Parameters.Add_Node(
-		NULL	, "NODE_SEARCH"			, _TL("Search Options"),
-		_TL("")
-	);
-
-	pNode	= Parameters.Add_Choice(
-		pSearch	, "SEARCH_RANGE"		, _TL("Search Range"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("local"),
-			_TL("global")
-		)
-	);
+	m_Search.Create(&Parameters, Parameters.Add_Node(NULL, "NODE_SEARCH", _TL("Search Options"), _TL("")), 16);
 
-	Parameters.Add_Value(
-		pNode	, "SEARCH_RADIUS"		, _TL("Maximum Search Distance"),
-		_TL("local maximum search distance given in map units"),
-		PARAMETER_TYPE_Double	, 1000.0, 0, true
-	);
-
-	pNode	= Parameters.Add_Choice(
-		pSearch	, "SEARCH_POINTS_ALL"	, _TL("Number of Points"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("maximum number of nearest points"),
-			_TL("all points within search distance")
-		)
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_POINTS_MIN"	, _TL("Minimum"),
-		_TL("minimum number of points to use"),
-		PARAMETER_TYPE_Int, 4, 1, true
-	);
-
-	Parameters.Add_Value(
-		pNode	, "SEARCH_POINTS_MAX"	, _TL("Maximum"),
-		_TL("maximum number of nearest points"),
-		PARAMETER_TYPE_Int, 20, 1, true
-	);
-
-	Parameters.Add_Choice(
-		pNode	, "SEARCH_DIRECTION"	, _TL("Search Direction"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("all directions"),
-			_TL("quadrants")
-		)
-	);
+	Parameters("SEARCH_RANGE"     )->Set_Value(1);
+	Parameters("SEARCH_POINTS_ALL")->Set_Value(1);
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-int CGW_Regression_Grid::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+int CGW_Regression_Grid::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("SEARCH_RANGE")) )
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "POINTS") )
 	{
-		pParameters->Get_Parameter("SEARCH_RADIUS"    )->Set_Enabled(pParameter->asInt() == 0);	// local
-	}
+		m_Search.On_Parameter_Changed(pParameters, pParameter);
 
-	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("SEARCH_POINTS_ALL")) )
-	{
-		pParameters->Get_Parameter("SEARCH_POINTS_MAX")->Set_Enabled(pParameter->asInt() == 0);	// maximum number of points
-		pParameters->Get_Parameter("SEARCH_DIRECTION" )->Set_Enabled(pParameter->asInt() == 0);	// maximum number of points per quadrant
+		pParameters->Set_Parameter("DW_BANDWIDTH", GWR_Fit_To_Density(pParameter->asShapes(), 4.0, 1));
 	}
 
+	return( 1 );
+}
+
+//---------------------------------------------------------
+int CGW_Regression_Grid::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+{
+	m_Search.On_Parameters_Enable(pParameters, pParameter);
+
 	m_Weighting.Enable_Parameters(pParameters);
 
 	return( 1 );
@@ -239,8 +185,6 @@ int CGW_Regression_Grid::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_P
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
@@ -255,17 +199,10 @@ bool CGW_Regression_Grid::On_Execute(void)
 	m_pPoints		= Parameters("POINTS"    )->asShapes();
 	m_iDependent	= Parameters("DEPENDENT" )->asInt   ();
 
-	m_nPoints_Min	= Parameters("SEARCH_POINTS_MIN")->asInt   ();
-	m_nPoints_Max	= Parameters("SEARCH_POINTS_ALL")->asInt   () == 0
-					? Parameters("SEARCH_POINTS_MAX")->asInt   () : 0;
-	m_Radius		= Parameters("SEARCH_RANGE"     )->asInt   () == 0
-					? Parameters("SEARCH_RADIUS"    )->asDouble() : 0.0;
-	m_Direction		= Parameters("SEARCH_DIRECTION" )->asInt   () == 0 ? -1 : 4;
-
 	m_Weighting.Set_Parameters(&Parameters);
 
 	//-----------------------------------------------------
-	if( (m_nPoints_Max > 0 || m_Radius > 0.0) && !m_Search.Create(m_pPoints, -1) )
+	if( !m_Search.Initialize(m_pPoints, -1) )
 	{
 		return( false );
 	}
@@ -277,23 +214,25 @@ bool CGW_Regression_Grid::On_Execute(void)
 	GRID_INIT(m_pSlope     , _TL("GWR Slope"));
 
 	//-----------------------------------------------------
-	int	nPoints_Max	= m_nPoints_Max > 0 ? m_nPoints_Max : m_pPoints->Get_Count();
-
-	m_y.Create(nPoints_Max);
-	m_z.Create(nPoints_Max);
-	m_w.Create(nPoints_Max);
-
-	//-----------------------------------------------------
 	for(int y=0; y<Get_NY() && Set_Progress(y); y++)
 	{
 		for(int x=0; x<Get_NX(); x++)
 		{
-			if( m_pPredictor->is_NoData(x, y) || !Get_Regression(x, y) )
+			CSG_Regression_Weighted	Model;
+
+			if (!m_pPredictor->is_NoData(x, y) && Get_Model(x, y, Model))
 			{
-				GRID_SET_NODATA(m_pRegression , x, y);
-				GRID_SET_NODATA(m_pIntercept  , x, y);
-				GRID_SET_NODATA(m_pSlope      , x, y);
-				GRID_SET_NODATA(m_pQuality    , x, y);
+				SG_GRID_PTR_SAFE_SET_VALUE(m_pRegression, x, y, Model[0] + Model[1] * m_pPredictor->asDouble(x, y));
+				SG_GRID_PTR_SAFE_SET_VALUE(m_pIntercept , x, y, Model[0]);
+				SG_GRID_PTR_SAFE_SET_VALUE(m_pSlope     , x, y, Model[1]);
+				SG_GRID_PTR_SAFE_SET_VALUE(m_pQuality   , x, y, Model.Get_CV_R2());
+			}
+			else
+			{
+				SG_GRID_PTR_SAFE_SET_NODATA(m_pRegression, x, y);
+				SG_GRID_PTR_SAFE_SET_NODATA(m_pIntercept , x, y);
+				SG_GRID_PTR_SAFE_SET_NODATA(m_pSlope     , x, y);
+				SG_GRID_PTR_SAFE_SET_NODATA(m_pQuality   , x, y);
 			}
 		}
 	}
@@ -301,11 +240,7 @@ bool CGW_Regression_Grid::On_Execute(void)
 	//-----------------------------------------------------
 	Set_Residuals();
 
-	m_y.Destroy();
-	m_z.Destroy();
-	m_w.Destroy();
-
-	m_Search.Destroy();
+	m_Search.Finalize();
 
 	DataObject_Update(m_pIntercept);
 	DataObject_Update(m_pSlope);
@@ -317,105 +252,41 @@ bool CGW_Regression_Grid::On_Execute(void)
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-int CGW_Regression_Grid::Set_Variables(int x, int y)
+bool CGW_Regression_Grid::Get_Model(int x, int y, CSG_Regression_Weighted &Model)
 {
-	int			iPoint, jPoint, nPoints;
-	double		z;
-	TSG_Point	Point;
-	CSG_Shape	*pPoint;
+	//-----------------------------------------------------
+	TSG_Point	Point	= Get_System()->Get_Grid_to_World(x, y);
+	int			nPoints = m_Search.Set_Location(Point);
 
-	Point	= Get_System()->Get_Grid_to_World(x, y);
-	nPoints	= m_Search.is_Okay() ? (int)m_Search.Select_Nearest_Points(Point.x, Point.y, m_nPoints_Max, m_Radius, m_Direction) : m_pPoints->Get_Count();
+	Model.Destroy();
 
-	for(iPoint=0, jPoint=0; iPoint<nPoints; iPoint++)
+	for(int iPoint=0; iPoint<nPoints; iPoint++)
 	{
-		if( m_Search.is_Okay() )
-		{
-			double	ix, iy, iz;
+		double	ix, iy, iz;
 
-			m_Search.Get_Selected_Point(iPoint, ix, iy, iz);
+		CSG_Shape	*pPoint = m_Search.Do_Use_All() && m_Search.Get_Point(iPoint, ix, iy, iz)
+			? m_pPoints->Get_Shape((int)iz)
+			: m_pPoints->Get_Shape(iPoint);
 
-			pPoint	= m_pPoints->Get_Shape((int)iz);
-		}
-		else
-		{
-			pPoint	= m_pPoints->Get_Shape(iPoint);
-		}
-
-		if( !pPoint->is_NoData(m_iDependent) && m_pPredictor->Get_Value(pPoint->Get_Point(0), z) )
+		if( !pPoint->is_NoData(m_iDependent) && m_pPredictor->Get_Value(pPoint->Get_Point(0), iz) )
 		{
-			m_w[jPoint]	= m_Weighting.Get_Weight(SG_Get_Distance(Point, pPoint->Get_Point(0)));
-			m_z[jPoint]	= pPoint->asDouble(m_iDependent);
-			m_y[jPoint]	= z;
-
-			jPoint++;
+			Model.Add_Sample(
+				m_Weighting.Get_Weight(SG_Get_Distance(Point, pPoint->Get_Point(0))),
+				pPoint->asDouble(m_iDependent), CSG_Vector(1, &iz)
+			);
 		}
 	}
 
-	return( jPoint );
-}
-
-//---------------------------------------------------------
-bool CGW_Regression_Grid::Get_Regression(int x, int y)
-{
-	int		nPoints	= Set_Variables(x, y);
-
-	if( nPoints < m_nPoints_Min )
-	{
-		return( false );
-	}
-
-	//-----------------------------------------------------
-	int			i;
-	double		zMean, rss, tss;
-	CSG_Vector	b, z;
-	CSG_Matrix	Y, YtW;
-
-	//-----------------------------------------------------
-	z  .Create(nPoints);
-	Y  .Create(2, nPoints);
-	YtW.Create(nPoints, 2);
-
-	for(i=0, zMean=0.0; i<nPoints; i++)
-	{
-		Y  [i][0]	= 1.0;
-		Y  [i][1]	= m_y[i];
-		YtW[0][i]	= m_w[i];
-		YtW[1][i]	= m_w[i] * m_y[i];
-
-		zMean		+= (z[i] = m_z[i]);
-	}
-
 	//-----------------------------------------------------
-	b		= (YtW * Y).Get_Inverse() * (YtW * z);
-
-	zMean	/= nPoints;
-
-	for(i=0, rss=0.0, tss=0.0; i<nPoints; i++)
-	{
-		rss	+= m_w[i] * SG_Get_Square(m_z[i] - (b[0] + b[1] * m_y[i]));
-		tss	+= m_w[i] * SG_Get_Square(m_z[i] - zMean);
-	}
-
-	GRID_SET_VALUE(m_pRegression, x, y, b[0] + b[1] * m_pPredictor->asDouble(x, y));
-	GRID_SET_VALUE(m_pIntercept , x, y, b[0]);
-	GRID_SET_VALUE(m_pSlope     , x, y, b[1]);
-	GRID_SET_VALUE(m_pQuality   , x, y, (tss - rss) / tss);
-
-	//-----------------------------------------------------
-	return( true );
+	return( Model.Calculate() );
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
diff --git a/src/modules/statistics/statistics_regression/gw_regression_grid.h b/src/modules/statistics/statistics_regression/gw_regression_grid.h
index b2254a0..551bb70 100644
--- a/src/modules/statistics/statistics_regression/gw_regression_grid.h
+++ b/src/modules/statistics/statistics_regression/gw_regression_grid.h
@@ -78,38 +78,33 @@ class CGW_Regression_Grid : public CSG_Module_Grid
 public:
 	CGW_Regression_Grid(void);
 
-	virtual CSG_String			Get_MenuPath			(void)	{	return( _TL("R:GWR") );	}
+	virtual CSG_String				Get_MenuPath			(void)	{ return(_TL("A:Spatial and Geostatistics|Geographically Weighted Regression")); }
 
 
 protected:
 
-	virtual bool				On_Execute				(void);
+	virtual bool					On_Execute				(void);
 
-	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+	virtual int						On_Parameter_Changed	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+	virtual int						On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
 
 
 private:
 
-	int							m_iDependent, m_nPoints_Min, m_nPoints_Max, m_Direction;
+	int								m_iDependent;
 
-	double						m_Radius;
+	CSG_Distance_Weighting			m_Weighting;
 
-	CSG_Distance_Weighting		m_Weighting;
+	CSG_Parameters_Search_Points	m_Search;
 
-	CSG_PRQuadTree				m_Search;
+	CSG_Shapes						*m_pPoints;
 
-	CSG_Vector					m_y, m_z, m_w;
+	CSG_Grid						*m_pPredictor, *m_pRegression, *m_pQuality, *m_pIntercept, *m_pSlope;
 
-	CSG_Shapes					*m_pPoints;
 
-	CSG_Grid					*m_pPredictor, *m_pRegression, *m_pQuality, *m_pIntercept, *m_pSlope;
+	bool							Get_Model				(int x, int y, CSG_Regression_Weighted &Model);
 
-
-	int							Set_Variables			(int x, int y);
-
-	bool						Get_Regression			(int x, int y);
-
-	bool						Set_Residuals			(void);
+	bool							Set_Residuals			(void);
 
 };
 
diff --git a/src/modules/statistics/statistics_regression/gwr_grid_downscaling.cpp b/src/modules/statistics/statistics_regression/gwr_grid_downscaling.cpp
index de2df41..76143d5 100644
--- a/src/modules/statistics/statistics_regression/gwr_grid_downscaling.cpp
+++ b/src/modules/statistics/statistics_regression/gwr_grid_downscaling.cpp
@@ -300,8 +300,8 @@ bool CGWR_Grid_Downscaling::Set_Model(double x, double y, double &Value, double
 
 	for(int i=0; i<m_nPredictors; i++)
 	{
-		if( !m_pModel     [i]->Get_Value(x, y, Model    , GRID_INTERPOLATION_BSpline)
-		||  !m_pPredictors[i]->Get_Value(x, y, Predictor, GRID_INTERPOLATION_NearestNeighbour) )
+		if( !m_pModel     [i]->Get_Value(x, y, Model    , GRID_INTERPOLATION_BSpline, false, true)
+		||  !m_pPredictors[i]->Get_Value(x, y, Predictor, GRID_INTERPOLATION_BSpline, false, true) )
 		{
 			return( false );
 		}
@@ -395,15 +395,29 @@ bool CGWR_Grid_Downscaling::Get_Model(void)
 		#pragma omp parallel for
 		for(int x=0; x<System.Get_NX(); x++)
 		{
-			if( !Get_Regression(x, y) )
+			CSG_Regression_Weighted	Model;
+
+			if( Get_Model(x, y, Model) )
 			{
-				m_pQuality  ->Set_NoData(x, y);
-				m_pResiduals->Set_NoData(x, y);
+				m_pQuality->Set_Value(x, y, Model.Get_R2());
+
+				m_pModel[m_nPredictors]->Set_Value(x, y, Model[0]);	// intercept
+
+				for(int i=0; i<m_nPredictors; i++)
+				{
+					m_pModel[i]->Set_Value(x, y, Model[i + 1]);
+				}
+			}
+			else
+			{
+				m_pQuality->Set_NoData(x, y);
 
 				for(int i=0; i<=m_nPredictors; i++)
 				{
 					m_pModel[i]->Set_NoData(x, y);
 				}
+
+				m_pResiduals->Set_NoData(x, y);
 			}
 		}
 	}
@@ -422,133 +436,67 @@ bool CGWR_Grid_Downscaling::Get_Model(void)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-int CGWR_Grid_Downscaling::Get_Variables(int x, int y, CSG_Vector &z, CSG_Vector &w, CSG_Matrix &Y)
+bool CGWR_Grid_Downscaling::Get_Model(int x, int y, CSG_Regression_Weighted &Model)
 {
-	int		n	= 0;
+	//-----------------------------------------------------
+	CSG_Vector	Predictors(m_nPredictors);
 
-	z.Create(m_Search.Get_Count());
-	w.Create(m_Search.Get_Count());
-	Y.Create(1 + m_nPredictors, m_Search.Get_Count());
+	Model.Destroy();
 
 	//-----------------------------------------------------
 	for(int i=0, ix, iy; i<m_Search.Get_Count(); i++)
 	{
-		double	id, iw;
+		double	Distance, Weight;
 
-		if( m_Search.Get_Values(i, ix = x, iy = y, id, iw, true) && m_pDependent->is_InGrid(ix, iy) )
+		if( m_Search.Get_Values(i, ix = x, iy = y, Distance, Weight, true) && m_pDependent->is_InGrid(ix, iy) )
 		{
-			z[n]	= m_pDependent->asDouble(ix, iy);
-			w[n]	= iw;
-			Y[n][0]	= 1.0;
-
-			for(int j=0; j<m_nPredictors && iw>0.0; j++)
+			for(int iPredictor=0; iPredictor<m_nPredictors && Weight>0.0; iPredictor++)
 			{
-				if( !m_pPredictors[j]->is_NoData(ix, iy) )
+				if( !m_pPredictors[iPredictor]->is_NoData(ix, iy) )
 				{
-					Y[n][j + 1]	= m_pPredictors[j]->asDouble(ix, iy);
+					Predictors[iPredictor]	= m_pPredictors[iPredictor]->asDouble(ix, iy);
 				}
 				else
 				{
-					iw	= 0.0;
+					Weight	= 0.0;
 				}
 			}
 
-			if( iw > 0.0 )
+			if( Weight > 0.0 )
 			{
-				n++;
+				Model.Add_Sample(Weight, m_pDependent->asDouble(ix, iy), Predictors);
 			}
 		}
 	}
 
 	//-----------------------------------------------------
-	z.Set_Rows(n);
-	w.Set_Rows(n);
-	Y.Set_Rows(n);
-
-	return( n );
-}
-
-//---------------------------------------------------------
-bool CGWR_Grid_Downscaling::Get_Regression(int x, int y)
-{
-	//-----------------------------------------------------
-	int			i, nPoints;
-	double		zMean, zr, rss, tss;
-	CSG_Vector	b, z, w;
-	CSG_Matrix	Y, YtW;
-
-	if( (nPoints = Get_Variables(x, y, z, w, Y)) <= m_nPredictors )
-	{
-		return( false );
-	}
-
-	//-----------------------------------------------------
-	YtW.Create(nPoints, 1 + m_nPredictors);
-
-	for(i=0, zMean=0.0; i<nPoints; i++)
-	{
-		zMean		+= z[i];
-		YtW[0][i]	 = w[i];
-
-		for(int j=1; j<=m_nPredictors; j++)
-		{
-			YtW[j][i]	= Y[i][j] * w[i];
-		}
-	}
-
-	//-----------------------------------------------------
-	b		= (YtW * Y).Get_Inverse() * (YtW * z);
-
-	zMean	/= nPoints;
-
-	for(i=0, rss=0.0, tss=0.0; i<nPoints; i++)
+	if( Model.Calculate() )
 	{
-		zr	= b[0];
+		m_pResiduals->Set_NoData(x, y);
 
-		for(int j=1; j<=m_nPredictors; j++)
+		if( m_pDependent->is_NoData(x, y) )
 		{
-			zr	+= b[j] * Y[i][j];
+			return( true );
 		}
 
-		rss	+= w[i] * SG_Get_Square(z[i] - zr);
-		tss	+= w[i] * SG_Get_Square(z[i] - zMean);
-	}
-
-	m_pQuality->Set_Value(x, y, tss > 0.0 ? (tss - rss) / tss : 0.0);
-
-	for(i=0; i<m_nPredictors; i++)
-	{
-		m_pModel[i]->Set_Value(x, y, b[i + 1]);
-	}
-
-	m_pModel[m_nPredictors]->Set_Value(x, y, b[0]);
-
-	//-----------------------------------------------------
-	if( m_pDependent->is_NoData(x, y) )
-	{
-		m_pResiduals->Set_NoData(x, y);
-	}
-	else
-	{
-		zr	= b[0];
+		double	Value	= Model[0];
 
-		for(i=0; i<m_nPredictors; i++)
+		for(int iPredictor=0; iPredictor<m_nPredictors; iPredictor++)
 		{
-			if( m_pPredictors[i]->is_NoData(x, y) )
+			if( m_pPredictors[iPredictor]->is_NoData(x, y) )
 			{
-				m_pResiduals->Set_NoData(x, y);
-
 				return( true );
 			}
 
-			zr	+= b[i + 1] * m_pPredictors[i]->asDouble(x, y);
+			Value	+= Model[1 + iPredictor] * m_pPredictors[iPredictor]->asDouble(x, y);
 		}
 
-		m_pResiduals->Set_Value(x, y, m_pDependent->asDouble(x, y) - zr);
+		m_pResiduals->Set_Value(x, y, m_pDependent->asDouble(x, y) - Value);
+
+		return( true );
 	}
 
-	//-----------------------------------------------------
-	return( true );
+	return( false );
 }
 
 
diff --git a/src/modules/statistics/statistics_regression/gwr_grid_downscaling.h b/src/modules/statistics/statistics_regression/gwr_grid_downscaling.h
index f09123d..bbbf544 100644
--- a/src/modules/statistics/statistics_regression/gwr_grid_downscaling.h
+++ b/src/modules/statistics/statistics_regression/gwr_grid_downscaling.h
@@ -78,31 +78,30 @@ class CGWR_Grid_Downscaling : public CSG_Module_Grid
 public:
 	CGWR_Grid_Downscaling(void);
 
-	virtual CSG_String			Get_MenuPath			(void)	{	return( _TL("R:GWR") );	}
+	virtual CSG_String				Get_MenuPath			(void)	{ return(_TL("A:Spatial and Geostatistics|Geographically Weighted Regression")); }
 
 
 protected:
 
-	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+	virtual int						On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
 
-	virtual bool				On_Execute				(void);
+	virtual bool					On_Execute				(void);
 
 
 private:
 
-	int							m_nPredictors;
+	int								m_nPredictors;
 
-	CSG_Grid_Cell_Addressor		m_Search;
+	CSG_Grid_Cell_Addressor			m_Search;
 
-	CSG_Grid					*m_pDependent, **m_pPredictors, **m_pModel, *m_pQuality, *m_pResiduals;
+	CSG_Grid						*m_pDependent, **m_pPredictors, **m_pModel, *m_pQuality, *m_pResiduals;
 
 
-	bool						Set_Model				(double x, double y, double &Value, double &Residual);
-	bool						Set_Model				(void);
+	bool							Set_Model				(double x, double y, double &Value, double &Residual);
+	bool							Set_Model				(void);
 
-	bool						Get_Model				(void);
-	int							Get_Variables			(int x, int y, CSG_Vector &z, CSG_Vector &w, CSG_Matrix &Y);
-	bool						Get_Regression			(int x, int y);
+	bool							Get_Model				(void);
+	bool							Get_Model				(int x, int y, CSG_Regression_Weighted &Model);
 
 };
 
diff --git a/src/modules/statistics/statistics_regression/point_grid_regression.cpp b/src/modules/statistics/statistics_regression/point_grid_regression.cpp
index 9b9f5f4..41b753a 100644
--- a/src/modules/statistics/statistics_regression/point_grid_regression.cpp
+++ b/src/modules/statistics/statistics_regression/point_grid_regression.cpp
@@ -76,12 +76,12 @@ CPoint_Grid_Regression::CPoint_Grid_Regression(void)
 	CSG_Parameter	*pNode;
 
 	//-----------------------------------------------------
-	Set_Name		(_TL("Regression Analysis (Points/Grid)"));
+	Set_Name		(_TL("Regression Analysis (Points and Predictor Grid)"));
 
 	Set_Author		(SG_T("O.Conrad (c) 2004"));
 
 	Set_Description	(_TW(
-		"Regression analysis of point attributes with grid values. "
+		"Regression analysis of point attributes with a grid as predictor. "
 		"The regression function is used to create a new grid with regression based values. \n"
 		"\n"
 		"Reference:\n"
@@ -92,19 +92,19 @@ CPoint_Grid_Regression::CPoint_Grid_Regression(void)
 
 	//-----------------------------------------------------
 	Parameters.Add_Grid(
-		NULL	, "GRID"		, _TL("Grid"),
+		NULL	, "PREDICTOR"	, _TL("Predictor"),
 		_TL(""),
 		PARAMETER_INPUT
 	);
 
 	pNode	= Parameters.Add_Shapes(
-		NULL	, "SHAPES"		, _TL("Shapes"),
+		NULL	, "POINTS"		, _TL("Points"),
 		_TL(""),
 		PARAMETER_INPUT
 	);
 
 	Parameters.Add_Table_Field(
-		pNode	, "ATTRIBUTE"	, _TL("Attribute"),
+		pNode	, "ATTRIBUTE"	, _TL("Dependent Variable"),
 		_TL("")
 	);
 
@@ -164,12 +164,12 @@ bool CPoint_Grid_Regression::On_Execute(void)
 	CSG_Grid			*pGrid, *pRegression;
 
 	//-----------------------------------------------------
-	pGrid			= Parameters("GRID")		->asGrid();
-	pRegression		= Parameters("REGRESSION")	->asGrid();
-	pShapes			= Parameters("SHAPES")		->asShapes();
-	pResiduals		= Parameters("RESIDUAL")	->asShapes();
-	iAttribute		= Parameters("ATTRIBUTE")	->asInt();
-	m_Interpolation	= Parameters("INTERPOL")	->asInt();
+	pGrid			= Parameters("PREDICTOR" )->asGrid();
+	pRegression		= Parameters("REGRESSION")->asGrid();
+	pShapes			= Parameters("POINTS"    )->asShapes();
+	iAttribute		= Parameters("ATTRIBUTE" )->asInt();
+	pResiduals		= Parameters("RESIDUAL"  )->asShapes();
+	m_Interpolation	= Parameters("INTERPOL"  )->asInt();
 
 	switch( Parameters("METHOD")->asInt() )
 	{
diff --git a/src/modules/statistics/statistics_regression/point_multi_grid_regression.cpp b/src/modules/statistics/statistics_regression/point_multi_grid_regression.cpp
index 454615f..e2d40a5 100644
--- a/src/modules/statistics/statistics_regression/point_multi_grid_regression.cpp
+++ b/src/modules/statistics/statistics_regression/point_multi_grid_regression.cpp
@@ -76,7 +76,7 @@ CPoint_Multi_Grid_Regression::CPoint_Multi_Grid_Regression(void)
 	CSG_Parameter	*pNode;
 
 	//-----------------------------------------------------
-	Set_Name		(_TL("Multiple Regression Analysis (Points/Grids)"));
+	Set_Name		(_TL("Multiple Regression Analysis (Points and Predictor Grids)"));
 
 	Set_Author		("O.Conrad (c) 2004");
 
@@ -94,7 +94,7 @@ CPoint_Multi_Grid_Regression::CPoint_Multi_Grid_Regression(void)
 
 	//-----------------------------------------------------
 	Parameters.Add_Grid_List(
-		NULL	, "GRIDS"		, _TL("Grids"),
+		NULL	, "PREDICTORS"	, _TL("Predictors"),
 		_TL(""),
 		PARAMETER_INPUT, true
 	);
@@ -106,7 +106,7 @@ CPoint_Multi_Grid_Regression::CPoint_Multi_Grid_Regression(void)
 	);
 
 	Parameters.Add_Table_Field(
-		pNode	, "ATTRIBUTE"	, _TL("Attribute"),
+		pNode	, "ATTRIBUTE"	, _TL("Dependent Variable"),
 		_TL("")
 	);
 
@@ -136,10 +136,16 @@ CPoint_Multi_Grid_Regression::CPoint_Multi_Grid_Regression(void)
 
 	Parameters.Add_Grid(
 		NULL	, "REGRESSION"	, _TL("Regression"),
-		_TL(""),
+		_TL("regression model applied to predictor grids"),
 		PARAMETER_OUTPUT
 	);
 
+	Parameters.Add_Grid(
+		NULL	, "REGRESCORR"	, _TL("Regression with Residual Correction"),
+		_TL("regression model applied to predictor grids with interpolated residuals added"),
+		PARAMETER_OUTPUT_OPTIONAL
+	);
+
 	Parameters.Add_Choice(
 		NULL	,"INTERPOL"		, _TL("Grid Interpolation"),
 		_TL(""),
@@ -182,14 +188,8 @@ CPoint_Multi_Grid_Regression::CPoint_Multi_Grid_Regression(void)
 	);
 
 	Parameters.Add_Value(
-		NULL	, "P_IN"		, _TL("P in"),
-		_TL("Level of significance for automated predictor selection, given as percentage"),
-		PARAMETER_TYPE_Double, 5.0, 0.0, true, 100.0, true
-	);
-
-	Parameters.Add_Value(
-		NULL	, "P_OUT"		, _TL("P out"),
-		_TL("Level of significance for automated predictor selection, given as percentage"),
+		NULL	, "P_VALUE"		, _TL("Significance Level"),
+		_TL("Significance level (aka p-value) as threshold for automated predictor selection, given as percentage"),
 		PARAMETER_TYPE_Double, 5.0, 0.0, true, 100.0, true
 	);
 
@@ -209,6 +209,15 @@ CPoint_Multi_Grid_Regression::CPoint_Multi_Grid_Regression(void)
 		_TL("number of subsamples for k-fold cross validation"),
 		PARAMETER_TYPE_Int, 10, 2, true
 	);
+
+	Parameters.Add_Choice(
+		NULL	,"RESIDUAL_COR"	, _TL("Residual Interpolation"),
+		_TL(""),
+		CSG_String::Format(SG_T("%s|%s|"),
+			_TL("Multleve B-Spline Interpolation"),
+			_TL("Inverse Distance Weighted")
+		), 0
+	);
 }
 
 
@@ -228,8 +237,12 @@ int CPoint_Multi_Grid_Regression::On_Parameters_Enable(CSG_Parameters *pParamete
 
 	if(	!SG_STR_CMP(pParameter->Get_Identifier(), "METHOD") )
 	{
-		pParameters->Set_Enabled("P_IN" , pParameter->asInt() == 1 || pParameter->asInt() == 3);
-		pParameters->Set_Enabled("P_OUT", pParameter->asInt() == 2 || pParameter->asInt() == 3);
+		pParameters->Set_Enabled("P_VALUE", pParameter->asInt() > 0);
+	}
+
+	if(	!SG_STR_CMP(pParameter->Get_Identifier(), "REGRESCORR") )
+	{
+		pParameters->Set_Enabled("RESIDUAL_COR", pParameter->asGrid() != NULL);
 	}
 
 	return( 0 );
@@ -247,7 +260,7 @@ bool CPoint_Multi_Grid_Regression::On_Execute(void)
 {
 	bool					bResult;
 	int						iAttribute;
-	double					P_in, P_out;
+	double					P;
 	CSG_Strings				Names;
 	CSG_Matrix				Samples;
 	CSG_Shapes				*pPoints;
@@ -255,12 +268,11 @@ bool CPoint_Multi_Grid_Regression::On_Execute(void)
 	CSG_Parameter_Grid_List	*pGrids;
 
 	//-----------------------------------------------------
-	pGrids		= Parameters("GRIDS"     )->asGridList();
+	pGrids		= Parameters("PREDICTORS")->asGridList();
 	pRegression	= Parameters("REGRESSION")->asGrid();
 	pPoints		= Parameters("POINTS"    )->asShapes();
 	iAttribute	= Parameters("ATTRIBUTE" )->asInt();
-	P_in		= Parameters("P_IN"      )->asDouble() / 100.0;
-	P_out		= Parameters("P_OUT"     )->asDouble() / 100.0;
+	P			= Parameters("P_VALUE"   )->asDouble() / 100.0;
 
 	//-----------------------------------------------------
 	if( !Get_Samples(pGrids, pPoints, iAttribute, Samples, Names) )
@@ -274,10 +286,10 @@ bool CPoint_Multi_Grid_Regression::On_Execute(void)
 	switch( Parameters("METHOD")->asInt() )
 	{
 	default:
-	case 0:	bResult	= m_Regression.Get_Model         (Samples             , &Names);	break;
-	case 1:	bResult	= m_Regression.Get_Model_Forward (Samples, P_in       , &Names);	break;
-	case 2:	bResult	= m_Regression.Get_Model_Backward(Samples,       P_out, &Names);	break;
-	case 3:	bResult	= m_Regression.Get_Model_Stepwise(Samples, P_in, P_out, &Names);	break;
+	case 0:	bResult	= m_Regression.Get_Model         (Samples      , &Names);	break;
+	case 1:	bResult	= m_Regression.Get_Model_Forward (Samples, P   , &Names);	break;
+	case 2:	bResult	= m_Regression.Get_Model_Backward(Samples,    P, &Names);	break;
+	case 3:	bResult	= m_Regression.Get_Model_Stepwise(Samples, P, P, &Names);	break;
 	}
 
 	if( bResult == false )
@@ -312,9 +324,7 @@ bool CPoint_Multi_Grid_Regression::On_Execute(void)
 	}
 
 	//-----------------------------------------------------
-	Set_Regression(pGrids, pRegression, CSG_String::Format(SG_T("%s [%s]"), Parameters("ATTRIBUTE")->asString(), _TL("Regression Model")));
-
-	Set_Residuals(pPoints, iAttribute, pRegression);
+	Set_Regression(pGrids, pRegression, CSG_String::Format("%s.%s [%s]", pPoints->Get_Name(), Parameters("ATTRIBUTE")->asString(), _TL("Regression")));
 
 	//-----------------------------------------------------
 	if( Parameters("INFO_COEFF")->asTable() )
@@ -336,6 +346,10 @@ bool CPoint_Multi_Grid_Regression::On_Execute(void)
 	}
 
 	//-----------------------------------------------------
+	Set_Residuals(Parameters("RESIDUALS")->asShapes());
+
+	Set_Residual_Corr(pRegression, Parameters("RESIDUALS")->asShapes(), Parameters("REGRESCORR")->asGrid());
+
 	m_Regression.Destroy();
 
 	return( true );
@@ -356,9 +370,9 @@ bool CPoint_Multi_Grid_Regression::Get_Samples(CSG_Parameter_Grid_List *pGrids,
 	CSG_Vector	Sample;
 
 	//-----------------------------------------------------
-	int		Interpolation	= Parameters("INTERPOL")	->asInt();
-	bool	bCoord_X		= Parameters("COORD_X")		->asBool();
-	bool	bCoord_Y		= Parameters("COORD_Y")		->asBool();
+	int		Interpolation	= Parameters("INTERPOL")->asInt ();
+	bool	bCoord_X		= Parameters("COORD_X" )->asBool();
+	bool	bCoord_Y		= Parameters("COORD_Y" )->asBool();
 
 	Names	+= pPoints->Get_Field_Name(iAttribute);		// Dependent Variable
 
@@ -435,7 +449,7 @@ bool CPoint_Multi_Grid_Regression::Set_Regression(CSG_Parameter_Grid_List *pGrid
 	int			iGrid, nGrids, x, y;
 	TSG_Point	p;
 
-	int		Interpolation	= Parameters("INTERPOL")	->asInt();
+	int		Interpolation	= Parameters("INTERPOL")->asInt();
 
 	CSG_Grid	**ppGrids	= (CSG_Grid **)SG_Malloc(m_Regression.Get_nPredictors() * sizeof(CSG_Grid *));
 
@@ -518,24 +532,26 @@ bool CPoint_Multi_Grid_Regression::Set_Regression(CSG_Parameter_Grid_List *pGrid
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CPoint_Multi_Grid_Regression::Set_Residuals(CSG_Shapes *pPoints, int iAttribute, CSG_Grid *pRegression)
+bool CPoint_Multi_Grid_Regression::Set_Residuals(CSG_Shapes *pResiduals)
 {
-	CSG_Shapes	*pResiduals		= Parameters("RESIDUALS")->asShapes();
-
-	if( !pRegression || !pResiduals )
+	if( !pResiduals )
 	{
 		return( false );
 	}
 
 	//-----------------------------------------------------
-	pResiduals->Create(SHAPE_TYPE_Point, CSG_String::Format(SG_T("%s [%s]"), Parameters("ATTRIBUTE")->asString(), _TL("Residuals")));
+	CSG_Shapes	*pPoints		= Parameters("POINTS"    )->asShapes();
+	CSG_Grid	*pRegression	= Parameters("REGRESSION")->asGrid();
+	int			iAttribute		= Parameters("ATTRIBUTE" )->asInt();
+	int			Interpolation	= Parameters("INTERPOL"  )->asInt();
+
+	//-----------------------------------------------------
+	pResiduals->Create(SHAPE_TYPE_Point, CSG_String::Format("%s.%s [%s]", pPoints->Get_Name(), Parameters("ATTRIBUTE")->asString(), _TL("Residuals")));
 	pResiduals->Add_Field(pPoints->Get_Field_Name(iAttribute), SG_DATATYPE_Double);
 	pResiduals->Add_Field("TREND"	, SG_DATATYPE_Double);
 	pResiduals->Add_Field("RESIDUAL", SG_DATATYPE_Double);
 
-	int	Interpolation	= Parameters("INTERPOL")->asInt();
-
-	//-------------------------------------------------
+	//-----------------------------------------------------
 	for(int iShape=0; iShape<pPoints->Get_Count() && Set_Progress(iShape, pPoints->Get_Count()); iShape++)
 	{
 		CSG_Shape	*pShape	= pPoints->Get_Shape(iShape);
@@ -569,6 +585,101 @@ bool CPoint_Multi_Grid_Regression::Set_Residuals(CSG_Shapes *pPoints, int iAttri
 	return( true );
 }
 
+//---------------------------------------------------------
+bool CPoint_Multi_Grid_Regression::Set_Residual_Corr(CSG_Grid *pRegression, CSG_Shapes *pResiduals, CSG_Grid *pCorrection)
+{
+	//-----------------------------------------------------
+	if( !pCorrection )
+	{
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	CSG_Shapes	Residuals;
+
+	if( !pResiduals )
+	{
+		if( !Set_Residuals(&Residuals) )
+		{
+			return( false );
+		}
+
+		pResiduals	= &Residuals;
+	}
+
+	//-----------------------------------------------------
+	switch( Parameters("RESIDUAL_COR")->asInt() )
+	{
+	default:	// Multleve B-Spline Interpolation
+		if( !SG_UI_Get_Window_Main() )	// saga_cmd
+		{
+			SG_RUN_MODULE_ExitOnError("grid_spline", 4,
+				   SG_MODULE_PARAMETER_SET("SHAPES"           , pResiduals)
+				&& SG_MODULE_PARAMETER_SET("FIELD"            , 2)
+				&& SG_MODULE_PARAMETER_SET("TARGET_DEFINITION", 1)	// grid or grid system
+				&& SG_MODULE_PARAMETER_SET("TARGET_OUT_GRID"  , pCorrection)
+			);
+		}
+		else
+		{
+			SG_RUN_MODULE_ExitOnError("grid_spline", 4,
+				   SG_MODULE_PARAMETER_SET("SHAPES"           , pResiduals)
+				&& SG_MODULE_PARAMETER_SET("FIELD"            , 2)
+				&& SG_MODULE_PARAMETER_SET("DEFINITION"       , 1)	// grid or grid system
+				&& SG_MODULE_PARAMETER_SET("OUT_GRID"         , pCorrection)
+			);
+		}
+		break;
+
+	case  1:	// Inverse Distance Weighted
+		if( !SG_UI_Get_Window_Main() )	// saga_cmd
+		{
+			SG_RUN_MODULE_ExitOnError("grid_gridding", 1,
+				   SG_MODULE_PARAMETER_SET("SHAPES"           , pResiduals)
+				&& SG_MODULE_PARAMETER_SET("FIELD"            , 2)
+				&& SG_MODULE_PARAMETER_SET("TARGET_DEFINITION", 1)	// grid or grid system
+				&& SG_MODULE_PARAMETER_SET("TARGET_OUT_GRID"  , pCorrection)
+				&& SG_MODULE_PARAMETER_SET("SEARCH_RANGE"     , 1)	// global
+				&& SG_MODULE_PARAMETER_SET("SEARCH_POINTS_ALL", 1)	// all points within search distance
+			);
+		}
+		else
+		{
+			SG_RUN_MODULE_ExitOnError("grid_gridding", 1,
+				   SG_MODULE_PARAMETER_SET("SHAPES"           , pResiduals)
+				&& SG_MODULE_PARAMETER_SET("FIELD"            , 2)
+				&& SG_MODULE_PARAMETER_SET("DEFINITION"       , 1)
+				&& SG_MODULE_PARAMETER_SET("OUT_GRID"         , pCorrection)
+				&& SG_MODULE_PARAMETER_SET("SEARCH_RANGE"     , 1)	// global
+				&& SG_MODULE_PARAMETER_SET("SEARCH_POINTS_ALL", 1)	// all points within search distance
+			);
+		}
+		break;
+	}
+
+	//-----------------------------------------------------
+	#pragma omp parallel for
+	for(int y=0; y<Get_NY(); y++)
+	{
+		for(int x=0; x<Get_NX(); x++)
+		{
+			if( pRegression->is_NoData(x, y) || pCorrection->is_NoData(x, y) )
+			{
+				pCorrection->Set_NoData(x, y);
+			}
+			else
+			{
+				pCorrection->Add_Value(x, y, pRegression->asDouble(x, y));
+			}
+		}
+	}
+
+	pCorrection->Set_Name(CSG_String::Format("%s.%s [%s]", Parameters("POINTS")->asShapes()->Get_Name(), Parameters("ATTRIBUTE")->asString(), _TL("Residual Corrected Regression")));
+
+	//-----------------------------------------------------
+	return( true );
+}
+
 
 ///////////////////////////////////////////////////////////
 //														 //
diff --git a/src/modules/statistics/statistics_regression/point_multi_grid_regression.h b/src/modules/statistics/statistics_regression/point_multi_grid_regression.h
index a4414f6..6e15702 100644
--- a/src/modules/statistics/statistics_regression/point_multi_grid_regression.h
+++ b/src/modules/statistics/statistics_regression/point_multi_grid_regression.h
@@ -97,7 +97,9 @@ private:
 
 	bool						Set_Regression		(CSG_Parameter_Grid_List *pGrids, CSG_Grid *pRegression, const CSG_String &Name);
 
-	bool						Set_Residuals		(CSG_Shapes *pShapes, int iAttribute, CSG_Grid *pRegression);
+	bool						Set_Residuals		(CSG_Shapes *pResiduals);
+
+	bool						Set_Residual_Corr	(CSG_Grid *pRegression, CSG_Shapes *pResiduals, CSG_Grid *pCorrection);
 
 };
 
diff --git a/src/modules/statistics/statistics_regression/point_trend_surface.cpp b/src/modules/statistics/statistics_regression/point_trend_surface.cpp
index f7bce13..0d55af6 100644
--- a/src/modules/statistics/statistics_regression/point_trend_surface.cpp
+++ b/src/modules/statistics/statistics_regression/point_trend_surface.cpp
@@ -150,9 +150,9 @@ CPoint_Trend_Surface::CPoint_Trend_Surface(void)
 //---------------------------------------------------------
 int CPoint_Trend_Surface::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	if( !SG_STR_CMP(pParameter->Get_Identifier(), "POINTS") && pParameter->asShapes() )
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "POINTS") )
 	{
-		m_Grid_Target.Set_User_Defined(pParameters, pParameter->asShapes()->Get_Extent());
+		m_Grid_Target.Set_User_Defined(pParameters, pParameter->asShapes());
 	}
 
 	return( m_Grid_Target.On_Parameter_Changed(pParameters, pParameter) ? 1 : 0 );
@@ -210,7 +210,7 @@ bool CPoint_Trend_Surface::On_Execute(void)
 	Set_Message();
 
 	//-----------------------------------------------------
-	m_Grid_Target.Set_User_Defined(Get_Parameters("TARGET"), pPoints->Get_Extent());	Dlg_Parameters("TARGET");	// if called from saga_cmd
+	m_Grid_Target.Cmd_Update(pPoints);	// if called from saga_cmd
 
 	if( (pRegression = m_Grid_Target.Get_Grid()) == NULL )
 	{
diff --git a/src/modules/statistics/statistics_regression/point_zonal_multi_grid_regression.cpp b/src/modules/statistics/statistics_regression/point_zonal_multi_grid_regression.cpp
new file mode 100644
index 0000000..0f56381
--- /dev/null
+++ b/src/modules/statistics/statistics_regression/point_zonal_multi_grid_regression.cpp
@@ -0,0 +1,368 @@
+/**********************************************************
+ * Version $Id: point_zonal_multi_grid_regression.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ *********************************************************/
+
+///////////////////////////////////////////////////////////
+//                                                       //
+//                         SAGA                          //
+//                                                       //
+//      System for Automated Geoscientific Analyses      //
+//                                                       //
+//                    Module Library:                    //
+//                 statistics_regression                 //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//          point_zonal_multi_grid_regression.cpp        //
+//                                                       //
+//                 Copyright (C) 2015 by                 //
+//                      Olaf Conrad                      //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+// This file is part of 'SAGA - System for Automated     //
+// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
+//                                                       //
+// SAGA is distributed in the hope that it will be       //
+// useful, but WITHOUT ANY WARRANTY; without even the    //
+// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
+// PARTICULAR PURPOSE. See the GNU General Public        //
+// License for more details.                             //
+//                                                       //
+// You should have received a copy of the GNU General    //
+// Public License along with this program; if not,       //
+// write to the Free Software Foundation, Inc.,          //
+// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
+// USA.                                                  //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//    e-mail:     oconrad at saga-gis.org                   //
+//                                                       //
+//    contact:    Olaf Conrad                            //
+//                Institute of Geography                 //
+//                University of Hamburg                  //
+//                Germany                                //
+//                                                       //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#include "point_zonal_multi_grid_regression.h"
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+CPoint_Zonal_Multi_Grid_Regression::CPoint_Zonal_Multi_Grid_Regression(void)
+{
+	CSG_Parameter	*pNode;
+
+	//-----------------------------------------------------
+	Set_Name		(_TL("Zonal Multiple Regression Analysis (Points and Predictor Grids)"));
+
+	Set_Author		("O.Conrad, P.Gandelli (c) 2015");
+
+	Set_Description	(_TW(
+		"Linear regression analysis of point attributes using multiple predictor grids. "
+		"Details of the regression/correlation analysis will be saved to a table. "
+		"The regression function is used to create a new grid with regression based values. "
+		"The multiple regression analysis uses a forward selection procedure. "
+		"Each polygon in the zones layer is processed as individual zone. "
+		"\n"
+		"Reference:\n"
+		"- Bahrenberg, G., Giese, E., Nipper, J. (1992): "
+		"'Statistische Methoden in der Geographie 2 - Multivariate Statistik', "
+		"Stuttgart, 415p.\n"
+	));
+
+	//-----------------------------------------------------
+	Parameters.Add_Grid_List(
+		NULL	, "PREDICTORS"	, _TL("Predictors"),
+		_TL(""),
+		PARAMETER_INPUT, true
+	);
+
+	Parameters.Add_Shapes(
+		NULL	, "ZONES"		, _TL("Zones"),
+		_TL(""),
+		PARAMETER_INPUT, SHAPE_TYPE_Polygon
+	);
+
+	pNode	= Parameters.Add_Shapes(
+		NULL	, "POINTS"		, _TL("Points"),
+		_TL(""),
+		PARAMETER_INPUT
+	);
+
+	Parameters.Add_Table_Field(
+		pNode	, "ATTRIBUTE"	, _TL("Dependent Variable"),
+		_TL("")
+	);
+
+	Parameters.Add_Shapes(
+		NULL	, "RESIDUALS"	, _TL("Residuals"),
+		_TL(""),
+		PARAMETER_OUTPUT_OPTIONAL, SHAPE_TYPE_Point
+	);
+
+	Parameters.Add_Grid(
+		NULL	, "REGRESSION"	, _TL("Regression"),
+		_TL(""),
+		PARAMETER_OUTPUT
+	);
+
+	Parameters.Add_Choice(
+		NULL	,"INTERPOL"		, _TL("Grid Interpolation"),
+		_TL(""),
+		CSG_String::Format(SG_T("%s|%s|%s|%s|%s|"),
+			_TL("Nearest Neighbor"),
+			_TL("Bilinear Interpolation"),
+			_TL("Inverse Distance Interpolation"),
+			_TL("Bicubic Spline Interpolation"),
+			_TL("B-Spline Interpolation")
+		), 4
+	);
+
+	Parameters.Add_Value(
+		NULL	, "COORD_X"		, _TL("Include X Coordinate"),
+		_TL(""),
+		PARAMETER_TYPE_Bool, false
+	);
+
+	Parameters.Add_Value(
+		NULL	, "COORD_Y"		, _TL("Include Y Coordinate"),
+		_TL(""),
+		PARAMETER_TYPE_Bool, false
+	);
+
+	Parameters.Add_Value(
+		NULL	, "INTERCEPT"	, _TL("Intercept"),
+		_TL(""),
+		PARAMETER_TYPE_Bool, true
+	);
+
+	Parameters.Add_Choice(
+		NULL	,"METHOD"		, _TL("Method"),
+		_TL(""),
+		CSG_String::Format(SG_T("%s|%s|%s|%s|"),
+			_TL("include all"),
+			_TL("forward"),
+			_TL("backward"),
+			_TL("stepwise")
+		), 3
+	);
+
+	Parameters.Add_Value(
+		NULL	, "P_VALUE"		, _TL("Significance Level"),
+		_TL("Significance level (aka p-value) as threshold for automated predictor selection, given as percentage"),
+		PARAMETER_TYPE_Double, 5.0, 0.0, true, 100.0, true
+	);
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+int CPoint_Zonal_Multi_Grid_Regression::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+{
+	if(	!SG_STR_CMP(pParameter->Get_Identifier(), "METHOD") )
+	{
+		pParameters->Set_Enabled("P_VALUE", pParameter->asInt() > 0);
+	}
+
+	return( 0 );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CPoint_Zonal_Multi_Grid_Regression::On_Execute(void)
+{
+	//-----------------------------------------------------
+	CSG_Shapes	*pPoints		= Parameters("POINTS"    )->asShapes();
+	CSG_Shapes	*pZones			= Parameters("ZONES"     )->asShapes();
+	CSG_Grid	*pRegression	= Parameters("REGRESSION")->asGrid  ();
+
+	pRegression->Assign_NoData();
+
+	CSG_Grid	Regression(*Get_System(), SG_DATATYPE_Float);
+
+	SG_UI_Progress_Lock(true);	// suppress dialogs from popping up
+
+	for(int i=0; i<pZones->Get_Count() && Process_Get_Okay(); i++)
+	{
+		CSG_Shape_Polygon	*pZone	= (CSG_Shape_Polygon *)pZones->Get_Shape(i);
+
+		//-------------------------------------------------
+		// select all points located in current zone polygon
+
+		bool	bResult;
+
+		CSG_Shapes Zone(SHAPE_TYPE_Polygon);	Zone.Add_Shape(pZone);
+
+		SG_RUN_MODULE(bResult, "shapes_tools", 5,	// select points by location
+			   SG_MODULE_PARAMETER_SET("LOCATIONS", &Zone)
+			&& SG_MODULE_PARAMETER_SET("SHAPES"   , pPoints)
+		);
+
+		if( !bResult )
+		{
+			SG_UI_Process_Set_Okay();	// don't stop overall work flow, if tool execution failed for current zone
+		}
+		else if( pPoints->Get_Selection_Count() > 0 )
+		{
+			//---------------------------------------------
+			// copy selected points to a new (temporary) points layer
+
+			CSG_Shapes	Selection;
+
+			SG_RUN_MODULE(bResult, "shapes_tools", 6,	// copy selected points to a new layer
+				   SG_MODULE_PARAMETER_SET("INPUT" , pPoints)
+				&& SG_MODULE_PARAMETER_SET("OUTPUT", &Selection)
+			);
+
+			pPoints->asShapes()->Select();	// unselect everything from original points layer
+
+			//---------------------------------------------
+			// perform the regression analysis, regression grid for zone is temporary
+
+			SG_RUN_MODULE(bResult, "statistics_regression", 1,	// multiple linear regression for points and predictor grids
+				   SG_MODULE_PARAMETER_SET("PREDICTORS", Parameters("PREDICTORS"))
+				&& SG_MODULE_PARAMETER_SET("REGRESSION", &Regression             )
+				&& SG_MODULE_PARAMETER_SET("POINTS"    , &Selection              )
+				&& SG_MODULE_PARAMETER_SET("ATTRIBUTE" , Parameters("ATTRIBUTE" ))
+				&& SG_MODULE_PARAMETER_SET("INTERPOL"  , Parameters("INTERPOL"  ))
+				&& SG_MODULE_PARAMETER_SET("COORD_X"   , Parameters("COORD_X"   ))
+				&& SG_MODULE_PARAMETER_SET("COORD_Y"   , Parameters("COORD_Y"   ))
+				&& SG_MODULE_PARAMETER_SET("INTERCEPT" , Parameters("INTERCEPT" ))
+				&& SG_MODULE_PARAMETER_SET("METHOD"    , Parameters("METHOD"    ))
+				&& SG_MODULE_PARAMETER_SET("P_VALUE"   , Parameters("P_VALUE"   ))
+			);
+
+			//---------------------------------------------
+			// use zone polygon as mask for copying zonal regression result to final regression grid
+
+			if( !bResult )
+			{
+				SG_UI_Process_Set_Okay();	// don't stop overall work flow, if tool execution failed for current zone
+			}
+			else
+			{
+				#pragma omp parallel for	// speed up using multiple processors
+				for(int y=0; y<Get_NY(); y++)
+				{
+					for(int x=0; x<Get_NX(); x++)
+					{
+						if( !Regression.is_NoData(x, y) && pZone->Contains(Get_System()->Get_Grid_to_World(x, y)) )
+						{
+							pRegression->Set_Value(x, y, Regression.asDouble(x, y));
+						}
+					}
+				}
+			}
+		}
+	}
+
+	//-----------------------------------------------------
+	SG_UI_Progress_Lock(false);
+
+	//-----------------------------------------------------
+	Set_Residuals(pPoints, pRegression);
+
+	//-----------------------------------------------------
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CPoint_Zonal_Multi_Grid_Regression::Set_Residuals(CSG_Shapes *pPoints, CSG_Grid *pRegression)
+{
+	CSG_Shapes	*pResiduals	= Parameters("RESIDUALS")->asShapes();
+	int			iAttribute	= Parameters("ATTRIBUTE")->asInt   ();
+
+	if( !pRegression || !pResiduals )
+	{
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	pResiduals->Create(SHAPE_TYPE_Point, CSG_String::Format(SG_T("%s [%s]"), Parameters("ATTRIBUTE")->asString(), _TL("Residuals")));
+	pResiduals->Add_Field(pPoints->Get_Field_Name(iAttribute), SG_DATATYPE_Double);
+	pResiduals->Add_Field("TREND"	, SG_DATATYPE_Double);
+	pResiduals->Add_Field("RESIDUAL", SG_DATATYPE_Double);
+
+	int	Interpolation	= Parameters("INTERPOL")->asInt();
+
+	//-----------------------------------------------------
+	for(int iShape=0; iShape<pPoints->Get_Count() && Set_Progress(iShape, pPoints->Get_Count()); iShape++)
+	{
+		CSG_Shape	*pShape	= pPoints->Get_Shape(iShape);
+
+		if( !pShape->is_NoData(iAttribute) )
+		{
+			double	zShape	= pShape->asDouble(iAttribute);
+
+			for(int iPart=0; iPart<pShape->Get_Part_Count(); iPart++)
+			{
+				for(int iPoint=0; iPoint<pShape->Get_Point_Count(iPart); iPoint++)
+				{
+					double		zGrid;
+					TSG_Point	Point	= pShape->Get_Point(iPoint, iPart);
+
+					if( pRegression->Get_Value(Point, zGrid, Interpolation) )
+					{
+						CSG_Shape	*pResidual	= pResiduals->Add_Shape();
+
+						pResidual->Add_Point(Point);
+						pResidual->Set_Value(0, zShape);
+						pResidual->Set_Value(1, zGrid);
+						pResidual->Set_Value(2, zShape - zGrid);
+					}
+				}
+			}
+		}
+	}
+
+	//-----------------------------------------------------
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
diff --git a/src/modules/imagery/imagery_classification/classify_supervised_polygons.h b/src/modules/statistics/statistics_regression/point_zonal_multi_grid_regression.h
similarity index 81%
copy from src/modules/imagery/imagery_classification/classify_supervised_polygons.h
copy to src/modules/statistics/statistics_regression/point_zonal_multi_grid_regression.h
index 5ada73b..a524c3a 100644
--- a/src/modules/imagery/imagery_classification/classify_supervised_polygons.h
+++ b/src/modules/statistics/statistics_regression/point_zonal_multi_grid_regression.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: classify_supervised_polygons.h 2104 2014-04-21 15:24:01Z reklov_w $
+ * Version $Id: point_zonal_multi_grid_regression.h 1921 2014-01-09 10:24:11Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -9,13 +9,13 @@
 //      System for Automated Geoscientific Analyses      //
 //                                                       //
 //                    Module Library:                    //
-//                imagery_classification                 //
+//                 statistics_regression                 //
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//             classify_supervised_polygons.h            //
+//           point_zonal_multi_grid_regression.h         //
 //                                                       //
-//                 Copyright (C) 2012 by                 //
+//                 Copyright (C) 2015 by                 //
 //                      Olaf Conrad                      //
 //                                                       //
 //-------------------------------------------------------//
@@ -59,15 +59,8 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#ifndef HEADER_INCLUDED__classify_supervised_polygons_H
-#define HEADER_INCLUDED__classify_supervised_polygons_H
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
+#ifndef HEADER_INCLUDED__point_zonal_multi_grid_regression_H
+#define HEADER_INCLUDED__point_zonal_multi_grid_regression_H
 
 //---------------------------------------------------------
 #include "MLB_Interface.h"
@@ -75,34 +68,27 @@
 
 ///////////////////////////////////////////////////////////
 //														 //
+//														 //
+//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-class CPolygon_Classify_Supervised : public CSG_Module
+class CPoint_Zonal_Multi_Grid_Regression : public CSG_Module_Grid
 {
 public:
-	CPolygon_Classify_Supervised(void);
+	CPoint_Zonal_Multi_Grid_Regression(void);
 
 
 protected:
 
-	virtual bool				On_Execute				(void);
-
 	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
 
+	virtual bool				On_Execute				(void);
 
-private:
-
-	bool						m_bNormalise;
-
-	int							m_Class_ID, *m_Features, m_nFeatures;
-
-	CSG_Classifier_Supervised	m_Classifier;
-
-	CSG_Shapes					*m_pPolygons, *m_pClasses;
 
+private:
 
-	bool						Finalize				(void);
+	bool						Set_Residuals			(CSG_Shapes *pShapes, CSG_Grid *pRegression);
 
 };
 
@@ -114,4 +100,4 @@ private:
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED__classify_supervised_polygons_H
+#endif // #ifndef HEADER_INCLUDED__point_zonal_multi_grid_regression_H
diff --git a/src/modules/statistics/statistics_regression/table_regression_multiple.cpp b/src/modules/statistics/statistics_regression/table_regression_multiple.cpp
index d793b3a..b04656e 100644
--- a/src/modules/statistics/statistics_regression/table_regression_multiple.cpp
+++ b/src/modules/statistics/statistics_regression/table_regression_multiple.cpp
@@ -87,7 +87,7 @@ void CTable_Regression_Multiple_Base::Initialise(void)
 	);
 
 	Parameters.Add_Parameters(
-		pNode	, "PREDICTORS"	, _TL("Independent Variables"),
+		pNode	, "PREDICTORS"	, _TL("Predictors"),
 		_TL("")
 	);
 
@@ -121,14 +121,8 @@ void CTable_Regression_Multiple_Base::Initialise(void)
 	);
 
 	Parameters.Add_Value(
-		NULL	, "P_IN"		, _TL("P in"),
-		_TL("Level of significance for automated predictor selection, given as percentage"),
-		PARAMETER_TYPE_Double, 5.0, 0.0, true, 100.0, true
-	);
-
-	Parameters.Add_Value(
-		NULL	, "P_OUT"		, _TL("P out"),
-		_TL("Level of significance for automated predictor selection, given as percentage"),
+		NULL	, "P_VALUE"		, _TL("Significance Level"),
+		_TL("Significance level (aka p-value) as threshold for automated predictor selection, given as percentage"),
 		PARAMETER_TYPE_Double, 5.0, 0.0, true, 100.0, true
 	);
 
@@ -185,8 +179,7 @@ int CTable_Regression_Multiple_Base::On_Parameters_Enable(CSG_Parameters *pParam
 {
 	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("METHOD")) )
 	{
-		pParameters->Get_Parameter("P_IN" )->Set_Enabled(pParameter->asInt() == 1 || pParameter->asInt() == 3);	// forward or stepwise
-		pParameters->Get_Parameter("P_OUT")->Set_Enabled(pParameter->asInt() == 2 || pParameter->asInt() == 3);	// backward or stepwise
+		pParameters->Set_Enabled("P_VALUE", pParameter->asInt() > 0);
 	}
 
 	if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("CROSSVAL")) )
@@ -291,16 +284,15 @@ bool CTable_Regression_Multiple_Base::On_Execute(void)
 	//-----------------------------------------------------
 	CSG_Regression_Multiple	Regression;
 
-	double	P_in	= Parameters("P_IN" )->asDouble();
-	double	P_out	= Parameters("P_OUT")->asDouble();
+	double	P	= Parameters("P_VALUE")->asDouble();
 
 	switch( Parameters("METHOD")->asInt() )
 	{
 	default:
-	case 0:	if( !Regression.Get_Model         (Samples             , &Names) )	return( false );	break;
-	case 1:	if( !Regression.Get_Model_Forward (Samples, P_in       , &Names) )	return( false );	break;
-	case 2:	if( !Regression.Get_Model_Backward(Samples,       P_out, &Names) )	return( false );	break;
-	case 3:	if( !Regression.Get_Model_Stepwise(Samples, P_in, P_out, &Names) )	return( false );	break;
+	case 0:	if( !Regression.Get_Model         (Samples      , &Names) )	return( false );	break;
+	case 1:	if( !Regression.Get_Model_Forward (Samples, P   , &Names) )	return( false );	break;
+	case 2:	if( !Regression.Get_Model_Backward(Samples,    P, &Names) )	return( false );	break;
+	case 3:	if( !Regression.Get_Model_Stepwise(Samples, P, P, &Names) )	return( false );	break;
 	}
 
 	Message_Add(Regression.Get_Info(), false);
diff --git a/src/modules/table/table_calculus/Fit.cpp b/src/modules/table/table_calculus/Fit.cpp
index 0c5a07e..a35f464 100644
--- a/src/modules/table/table_calculus/Fit.cpp
+++ b/src/modules/table/table_calculus/Fit.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Fit.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: Fit.cpp 2447 2015-03-19 14:43:42Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -239,7 +239,7 @@ bool CFit::On_Execute(void)
 		if (uservars[i] >='a' && uservars[i] <= 'z')
 		{
 			if (uservars[i] != 'x')
-				vars[NrVars++] = uservars[i];
+				vars[NrVars++] = (char)(uservars[i]);
 		}
 	}
 	
diff --git a/src/modules/table/table_calculus/MLB_Interface.cpp b/src/modules/table/table_calculus/MLB_Interface.cpp
index 275a58c..31716e2 100644
--- a/src/modules/table/table_calculus/MLB_Interface.cpp
+++ b/src/modules/table/table_calculus/MLB_Interface.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: MLB_Interface.cpp 2304 2014-10-24 08:55:03Z reklov_w $
+ * Version $Id: MLB_Interface.cpp 2345 2014-11-27 11:27:59Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -76,11 +76,11 @@ CSG_String Get_Info(int i)
 	case MLB_INFO_Name:	default:
 		return( _TL("Calculus") );
 
-	case MLB_INFO_Category:
-		return( _TL("Table") );
+	case MLB_INFO_Category:
+		return( _TL("Table") );
 
 	case MLB_INFO_Author:
-		return( _TL("SAGA User Group Associaton (c) 2002") );
+		return( _TL("SAGA User Group Associaton (c) 2002-2014") );
 
 	case MLB_INFO_Description:
 		return( _TL("Tools for table based analyses and calculations.") );
@@ -105,6 +105,7 @@ CSG_String Get_Info(int i)
 #include "table_fill_record_gaps.h"
 #include "table_field_analyzer.h"
 #include "table_mRMR.h"
+#include "table_field_statistics.h"
 
 
 //---------------------------------------------------------
@@ -130,6 +131,8 @@ CSG_Module *		Create_Module(int i)
 
 	case 12:	return( new CTable_mRMR );
 
+	case 15:	return( new CTable_Field_Statistics() );
+
 	//-----------------------------------------------------
 	case 19:	return( NULL );
 	default:	return( MLB_INTERFACE_SKIP_MODULE );
diff --git a/src/modules/table/table_calculus/Makefile.am b/src/modules/table/table_calculus/Makefile.am
index 24db1e6..1b81cbc 100644
--- a/src/modules/table/table_calculus/Makefile.am
+++ b/src/modules/table/table_calculus/Makefile.am
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.am 2164 2014-06-17 13:46:29Z reklov_w $
+# $Id: Makefile.am 2345 2014-11-27 11:27:59Z reklov_w $
 #
 if DEBUG
 DBGFLAGS = -g -DDEBUG
@@ -19,6 +19,7 @@ MLB_Interface.cpp\
 Table_Calculator.cpp\
 table_cluster_analysis.cpp\
 table_field_analyzer.cpp\
+table_field_statistics.cpp\
 table_fill_record_gaps.cpp\
 table_mRMR.cpp\
 table_pca.cpp\
@@ -29,6 +30,7 @@ MLB_Interface.h\
 Table_Calculator.h\
 table_cluster_analysis.h\
 table_field_analyzer.h\
+table_field_statistics.h\
 table_fill_record_gaps.h\
 table_mRMR.h\
 table_pca.h\
diff --git a/src/modules/table/table_calculus/Makefile.in b/src/modules/table/table_calculus/Makefile.in
index 3f5ac0f..89eff4a 100644
--- a/src/modules/table/table_calculus/Makefile.in
+++ b/src/modules/table/table_calculus/Makefile.in
@@ -129,8 +129,9 @@ libtable_calculus_la_DEPENDENCIES =  \
 	$(top_srcdir)/src/saga_core/saga_api/libsaga_api.la
 am_libtable_calculus_la_OBJECTS = Fit.lo LMFit.lo MLB_Interface.lo \
 	Table_Calculator.lo table_cluster_analysis.lo \
-	table_field_analyzer.lo table_fill_record_gaps.lo \
-	table_mRMR.lo table_pca.lo table_running_average.lo
+	table_field_analyzer.lo table_field_statistics.lo \
+	table_fill_record_gaps.lo table_mRMR.lo table_pca.lo \
+	table_running_average.lo
 libtable_calculus_la_OBJECTS = $(am_libtable_calculus_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
@@ -364,7 +365,7 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
 #
-# $Id: Makefile.am 2164 2014-06-17 13:46:29Z reklov_w $
+# $Id: Makefile.am 2345 2014-11-27 11:27:59Z reklov_w $
 #
 @DEBUG_TRUE at DBGFLAGS = -g -DDEBUG
 @SAGA_UNICODE_TRUE at UC_DEFS = -D_SAGA_UNICODE
@@ -380,6 +381,7 @@ MLB_Interface.cpp\
 Table_Calculator.cpp\
 table_cluster_analysis.cpp\
 table_field_analyzer.cpp\
+table_field_statistics.cpp\
 table_fill_record_gaps.cpp\
 table_mRMR.cpp\
 table_pca.cpp\
@@ -390,6 +392,7 @@ MLB_Interface.h\
 Table_Calculator.h\
 table_cluster_analysis.h\
 table_field_analyzer.h\
+table_field_statistics.h\
 table_fill_record_gaps.h\
 table_mRMR.h\
 table_pca.h\
@@ -481,28 +484,32 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Table_Calculator.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/table_cluster_analysis.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/table_field_analyzer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/table_field_statistics.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/table_fill_record_gaps.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/table_mRMR.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/table_pca.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/table_running_average.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/table/table_calculus/table_cluster_analysis.cpp b/src/modules/table/table_calculus/table_cluster_analysis.cpp
index d1c23af..573914a 100644
--- a/src/modules/table/table_calculus/table_cluster_analysis.cpp
+++ b/src/modules/table/table_calculus/table_cluster_analysis.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: table_cluster_analysis.cpp 2270 2014-10-02 15:39:13Z oconrad $
+ * Version $Id: table_cluster_analysis.cpp 2343 2014-11-26 16:21:11Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -76,12 +76,10 @@ CTable_Cluster_Analysis::CTable_Cluster_Analysis(bool bShapes)
 	CSG_Parameter	*pNode;
 
 	//-----------------------------------------------------
-	Set_Name		(_TL("Cluster Analysis"));
-
 	Set_Author		("O. Conrad (c) 2010");
 
 	Set_Description	(_TW(
-		"Cluster Analysis for grids.\n\nReferences:\n\n"
+		"Cluster Analysis for tables.\n\nReferences:\n\n"
 		                                                                                                                                                                                                                  
 		"Iterative Minimum Distance:\n"
 		"- Forgy, E. (1965):\n"
@@ -97,12 +95,16 @@ CTable_Cluster_Analysis::CTable_Cluster_Analysis(bool bShapes)
 	//-----------------------------------------------------
 	if( m_bShapes )
 	{
+		Set_Name		(_TL("Cluster Analysis (Shapes)"));
+
 		pNode	= 
 		Parameters.Add_Shapes(NULL, "INPUT" , _TL("Shapes"), _TL(""), PARAMETER_INPUT);
 		Parameters.Add_Shapes(NULL, "RESULT", _TL("Result"), _TL(""), PARAMETER_OUTPUT_OPTIONAL);
 	}
 	else
 	{
+		Set_Name		(_TL("Cluster Analysis"));
+
 		pNode	=
 		Parameters.Add_Table(NULL, "INPUT"  , _TL("Table" ), _TL(""), PARAMETER_INPUT);
 		Parameters.Add_Table(NULL, "RESULT" , _TL("Result"), _TL(""), PARAMETER_OUTPUT_OPTIONAL);
diff --git a/src/modules/statistics/statistics_kriging/semivariogram.cpp b/src/modules/table/table_calculus/table_field_statistics.cpp
similarity index 54%
copy from src/modules/statistics/statistics_kriging/semivariogram.cpp
copy to src/modules/table/table_calculus/table_field_statistics.cpp
index d08b5e7..1c44e23 100644
--- a/src/modules/statistics/statistics_kriging/semivariogram.cpp
+++ b/src/modules/table/table_calculus/table_field_statistics.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: semivariogram.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: table_field_statistics.cpp 2345 2014-11-27 11:27:59Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -9,14 +9,14 @@
 //      System for Automated Geoscientific Analyses      //
 //                                                       //
 //                    Module Library:                    //
-//                 Geostatistics_Points                  //
+//                    table_calculus                     //
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//                  semivariogram.cpp                    //
+//               table_field_statistics.cpp              //
 //                                                       //
-//                 Copyright (C) 2009 by                 //
-//                      Olaf Conrad                      //
+//                 Copyright (C) 2014 by                 //
+//                    Volker Wichmann                    //
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
@@ -40,12 +40,13 @@
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//    e-mail:     oconrad at saga-gis.org                   //
+//    e-mail:     wichmann at laserdata.at                  //
 //                                                       //
-//    contact:    Olaf Conrad                            //
-//                Institute of Geography                 //
-//                University of Hamburg                  //
-//                Germany                                //
+//    contact:    Volker Wichmann                        //
+//                LASERDATA GmbH                         //
+//                Management and analysis of             //
+//                laserscanning data                     //
+//                Innsbruck, Austria                     //
 //                                                       //
 ///////////////////////////////////////////////////////////
 
@@ -59,9 +60,7 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#include "semivariogram.h"
-
-#include "variogram_dialog.h"
+#include "table_field_statistics.h"
 
 
 ///////////////////////////////////////////////////////////
@@ -71,70 +70,38 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-CSemiVariogram::CSemiVariogram(void)
+CTable_Field_Statistics::CTable_Field_Statistics(void)
 {
 	CSG_Parameter	*pNode;
 
 	//-----------------------------------------------------
-	Set_Name		(_TL("Variogram (Dialog))"));
+	Set_Name		(_TL("Field Statistics"));
 
-	Set_Author		(SG_T("O.Conrad (c) 2009"));
+	Set_Author		(SG_T("V. Wichmann (c) 2014"));
 
-	Set_Description(
-		_TL("")
-	);
+	Set_Description	(_TW(
+		"The modules allows one to calculate statistics (n, min, max, range, sum, "
+		"mean, variance and standard deviation) for attribute fields of tables, "
+		"shapefiles or point clouds.\n\n"
+	));
 
 	//-----------------------------------------------------
-	pNode	= Parameters.Add_Shapes(
-		NULL	, "POINTS"		, _TL("Points"),
-		_TL(""),
-		PARAMETER_INPUT, SHAPE_TYPE_Point
+	pNode	= Parameters.Add_Table(
+		NULL	, "TABLE"		, _TL("Table"),
+		_TL("The input table."),
+		PARAMETER_INPUT
 	);
 
-	Parameters.Add_Table_Field(
-		pNode	, "ATTRIBUTE"	, _TL("Attribute"),
-		_TL("")
+	Parameters.Add_Table_Fields(
+		pNode	, "FIELDS"		, _TL("Attributes"),
+		_TL("The (numeric) fields to calculate the statistics for.")
 	);
 
 	Parameters.Add_Table(
-		NULL	, "VARIOGRAM"	, _TL("Variogram"),
-		_TL(""),
+		NULL	, "STATISTICS"	, _TL("Statistics"),
+		_TL("The calculated statistics."),
 		PARAMETER_OUTPUT
 	);
-
-	Parameters.Add_Value(
-		NULL	, "LOG"			, _TL("Logarithmic Transformation"),
-		_TL(""),
-		PARAMETER_TYPE_Bool
-	);
-
-	//-----------------------------------------------------
-	if( !SG_UI_Get_Window_Main() )
-	{
-		Parameters.Add_Value(
-			NULL	, "VAR_MAXDIST"		, _TL("Maximum Distance"),
-			_TL(""),
-			PARAMETER_TYPE_Double	, -1.0
-		);
-
-		Parameters.Add_Value(
-			NULL	, "VAR_NCLASSES"	, _TL("Lag Distance Classes"),
-			_TL("initial number of lag distance classes"),
-			PARAMETER_TYPE_Int		, 100, 1, true
-		);
-
-		Parameters.Add_Value(
-			NULL	, "VAR_NSKIP"		, _TL("Skip"),
-			_TL(""),
-			PARAMETER_TYPE_Int, 1, 1, true
-		);
-
-		Parameters.Add_String(
-			NULL	, "VAR_MODEL"		, _TL("Model"),
-			_TL(""),
-			SG_T("a + b * x")
-		);
-	}
 }
 
 
@@ -145,69 +112,67 @@ CSemiVariogram::CSemiVariogram(void)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CSemiVariogram::On_Execute(void)
+bool CTable_Field_Statistics::On_Execute(void)
 {
-	bool		bLog, bResult	= false;
-	int			Attribute;
-	CSG_Trend	Model;
-	CSG_Shapes	*pPoints;
-	CSG_Table	*pVariogram;
+	CSG_Table	*pTab_in, *pTab_out;
+	int			nFeatures, *Features;
 
 	//-----------------------------------------------------
-	pPoints		= Parameters("POINTS")		->asShapes();
-	Attribute	= Parameters("ATTRIBUTE")	->asInt();
-	bLog		= Parameters("LOG")			->asBool();
-	pVariogram	= Parameters("VARIOGRAM")	->asTable();
+	pTab_in		= Parameters("TABLE")->asTable();
+	pTab_out	= Parameters("STATISTICS")->asTable();
+	
+	Features	= (int *)Parameters("FIELDS")->asPointer();
+	nFeatures	=        Parameters("FIELDS")->asInt    ();
 
 	//-----------------------------------------------------
-	if( SG_UI_Get_Window_Main() )
+	if( !Features || nFeatures <= 0 )
 	{
-		static CVariogram_Dialog	dlg;
+		Error_Set(_TL("No attribute fields selected!"));
 
-		if( dlg.Execute(pPoints, Attribute, bLog, pVariogram, &Model) )
-		{
-			bResult	= true;
-		}
+		return( false );
 	}
 
 	//-----------------------------------------------------
-	else
-	{
-		int		nSkip		= Parameters("VAR_NSKIP")		->asInt();
-		int		nClasses	= Parameters("VAR_NCLASSES")	->asInt();
-		double	maxDistance	= Parameters("VAR_MAXDIST")		->asDouble();
-
-		Model.Set_Formula(Parameters("VAR_MODEL")->asString());
-
-		if( CSG_Variogram::Calculate(pPoints, Attribute, bLog, pVariogram, nClasses, maxDistance, nSkip) )
-		{
-			Model.Clr_Data();
-
-			for(int i=0; i<pVariogram->Get_Count(); i++)
-			{
-				CSG_Table_Record	*pRecord	= pVariogram->Get_Record(i);
-
-				Model.Add_Data(pRecord->asDouble(CSG_Variogram::FIELD_DISTANCE), pRecord->asDouble(CSG_Variogram::FIELD_VAR_EXP));
-			}
-
-			bResult	= Model.Get_Trend() || Model.Get_Parameter_Count() == 0;
-		}
-	}
+	pTab_out->Destroy();
+	pTab_out->Set_Name(CSG_String::Format(_TL("%s_stats"), pTab_in->Get_Name()));
+	
+	pTab_out->Add_Field(_TL("Field")	, SG_DATATYPE_String);
+	pTab_out->Add_Field(_TL("n")		, SG_DATATYPE_Long);
+	pTab_out->Add_Field(_TL("min")		, SG_DATATYPE_Double);
+	pTab_out->Add_Field(_TL("max")		, SG_DATATYPE_Double);
+	pTab_out->Add_Field(_TL("range")	, SG_DATATYPE_Double);
+	pTab_out->Add_Field(_TL("sum")		, SG_DATATYPE_Double);
+	pTab_out->Add_Field(_TL("mean")		, SG_DATATYPE_Double);
+	pTab_out->Add_Field(_TL("variance")	, SG_DATATYPE_Double);
+	pTab_out->Add_Field(_TL("stddev")	, SG_DATATYPE_Double);
 
 	//-----------------------------------------------------
-	if( bResult )
+	for(int iFeature=0; iFeature<nFeatures; iFeature++)
 	{
-		Message_Add(Model.Get_Formula(), false);
-
-		for(int i=0; i<pVariogram->Get_Count(); i++)
+		if( SG_Data_Type_is_Numeric(pTab_in->Get_Field_Type(iFeature)) )
 		{
-			CSG_Table_Record	*pRecord	= pVariogram->Get_Record(i);
-
-			pRecord->Set_Value(CSG_Variogram::FIELD_VAR_MODEL, Model.Get_Value(pRecord->asDouble(CSG_Variogram::FIELD_DISTANCE)));
+			CSG_Table_Record *pRecord = pTab_out->Add_Record();
+
+			pRecord->Set_Value(0, pTab_in->Get_Field_Name(iFeature));
+			pRecord->Set_Value(1, pTab_in->Get_N(iFeature));
+			pRecord->Set_Value(2, pTab_in->Get_Minimum(iFeature));
+			pRecord->Set_Value(3, pTab_in->Get_Maximum(iFeature));
+			pRecord->Set_Value(4, pTab_in->Get_Range(iFeature));
+			pRecord->Set_Value(5, pTab_in->Get_Sum(iFeature));
+			pRecord->Set_Value(6, pTab_in->Get_Mean(iFeature));
+			pRecord->Set_Value(7, pTab_in->Get_Variance(iFeature));
+			pRecord->Set_Value(8, pTab_in->Get_StdDev(iFeature));
+		}
+		else
+		{
+			SG_UI_Msg_Add(CSG_String::Format(_TL("WARNING: skipping non-numeric field '%s'!"), pTab_in->Get_Field_Name(iFeature)), true);
 		}
 	}
 
-	return( bResult );
+	//-----------------------------------------------------
+	DataObject_Update(pTab_out);
+
+	return( true );
 }
 
 
diff --git a/src/modules/grid/grid_filter/Filter_Majority.h b/src/modules/table/table_calculus/table_field_statistics.h
similarity index 70%
copy from src/modules/grid/grid_filter/Filter_Majority.h
copy to src/modules/table/table_calculus/table_field_statistics.h
index 83bf64c..5c8b0a6 100644
--- a/src/modules/grid/grid_filter/Filter_Majority.h
+++ b/src/modules/table/table_calculus/table_field_statistics.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Filter_Majority.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: table_field_statistics.h 2345 2014-11-27 11:27:59Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -9,14 +9,14 @@
 //      System for Automated Geoscientific Analyses      //
 //                                                       //
 //                    Module Library:                    //
-//                      Grid_Filter                      //
+//                    table_calculus                     //
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//                   Filter_Majority.h                   //
+//                table_field_statistics.h               //
 //                                                       //
-//                 Copyright (C) 2010 by                 //
-//                      Olaf Conrad                      //
+//                 Copyright (C) 2014 by                 //
+//                    Volker Wichmann                    //
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
@@ -40,76 +40,59 @@
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//    e-mail:     oconrad at saga-gis.org                   //
+//    e-mail:     wichmann at laserdata.at                  //
 //                                                       //
-//    contact:    Olaf Conrad                            //
-//                Institute of Geography                 //
-//                University of Hamburg                  //
-//                Germany                                //
+//    contact:    Volker Wichmann                        //
+//                LASERDATA GmbH                         //
+//                Management and analysis of             //
+//                laserscanning data                     //
+//                Innsbruck, Austria                     //
 //                                                       //
 ///////////////////////////////////////////////////////////
 
-//---------------------------------------------------------
-
-
 ///////////////////////////////////////////////////////////
-//														 //
 //                                                       //
-//														 //
+//                                                       //
+//                                                       //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#ifndef HEADER_INCLUDED__Filter_Majority_H
-#define HEADER_INCLUDED__Filter_Majority_H
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//                                                       //
-//														 //
-///////////////////////////////////////////////////////////
+#ifndef HEADER_INCLUDED__table_field_statistics_H
+#define HEADER_INCLUDED__table_field_statistics_H
 
 //---------------------------------------------------------
 #include "MLB_Interface.h"
 
 
 ///////////////////////////////////////////////////////////
-//														 //
 //                                                       //
-//														 //
+//                                                       //
+//                                                       //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-class CFilter_Majority : public CSG_Module_Grid
+class CTable_Field_Statistics : public CSG_Module
 {
 public:
-	CFilter_Majority(void);
+	CTable_Field_Statistics(void);
 
 
 protected:
 
-	virtual bool			On_Execute		(void);
+	virtual bool			On_Execute				(void);
 
 
 private:
 
-	int						m_Radius, m_Threshold;
-
-	CSG_Grid				m_Kernel, *m_pInput;
-
-	CSG_Class_Statistics	m_Majority;
-
-
-	double					Get_Majority	(int x, int y);
 
 };
 
 
 ///////////////////////////////////////////////////////////
-//														 //
 //                                                       //
-//														 //
+//                                                       //
+//                                                       //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED__Filter_Majority_H
+#endif // #ifndef HEADER_INCLUDED__table_field_statistics_H
diff --git a/src/modules/table/table_tools/Join_Tables.cpp b/src/modules/table/table_tools/Join_Tables.cpp
index 318c2b2..5cced7b 100644
--- a/src/modules/table/table_tools/Join_Tables.cpp
+++ b/src/modules/table/table_tools/Join_Tables.cpp
@@ -386,9 +386,9 @@ CJoin_Tables_Shapes::CJoin_Tables_Shapes(void)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-CTable_Append_Rows::CTable_Append_Rows(void)
+CTable_Append_Cols::CTable_Append_Cols(void)
 {
-	Set_Name		(_TL("Append Rows from Table"));
+	Set_Name		(_TL("Append Fields from another Table"));
 
 	Set_Author		(SG_T("O.Conrad (c) 2012"));
 
@@ -421,7 +421,7 @@ CTable_Append_Rows::CTable_Append_Rows(void)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CTable_Append_Rows::On_Execute(void)
+bool CTable_Append_Cols::On_Execute(void)
 {
 	CSG_Table	*pTable, *pOutput, *pAppend;
 
diff --git a/src/modules/table/table_tools/Join_Tables.h b/src/modules/table/table_tools/Join_Tables.h
index 3afa1ef..9b14b60 100644
--- a/src/modules/table/table_tools/Join_Tables.h
+++ b/src/modules/table/table_tools/Join_Tables.h
@@ -116,10 +116,10 @@ public:
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-class CTable_Append_Rows : public CSG_Module  
+class CTable_Append_Cols : public CSG_Module  
 {
 public:
-	CTable_Append_Rows(void);
+	CTable_Append_Cols(void);
 
 
 protected:
diff --git a/src/modules/table/table_tools/MLB_Interface.cpp b/src/modules/table/table_tools/MLB_Interface.cpp
index 0fa4174..ecb802d 100644
--- a/src/modules/table/table_tools/MLB_Interface.cpp
+++ b/src/modules/table/table_tools/MLB_Interface.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: MLB_Interface.cpp 2304 2014-10-24 08:55:03Z reklov_w $
+ * Version $Id: MLB_Interface.cpp 2481 2015-04-30 15:31:49Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -107,6 +107,7 @@ CSG_String Get_Info(int i)
 #include "table_text_replacer.h"
 #include "table_field_deletion.h"
 #include "table_selection.h"
+#include "table_categories_to_indicators.h"
 
 
 //---------------------------------------------------------
@@ -124,7 +125,7 @@ CSG_Module *		Create_Module(int i)
 	case  5:	return( new CTable_Change_Date_Format );
 	case  6:	return( new CTable_Change_Time_Format );
 	case  7:	return( new CTable_Change_Field_Type );
-	case  8:	return( new CTable_Append_Rows );
+	case  8:	return( new CTable_Append_Cols );
 	case  9:	return( new CTable_Change_Color_Format );
 	case 10:	return( new CTable_Text_Replacer );
 	case 11:	return( new CTable_Field_Deletion );
@@ -135,7 +136,9 @@ CSG_Module *		Create_Module(int i)
 	case 18:	return( new CSelect_Numeric );
 	case 19:	return( new CSelect_String );
 
-	case 20:	return( NULL );
+	case 20:	return( new CTable_Categories_to_Indicators );
+
+	case 25:	return( NULL );
 	default:	return( MLB_INTERFACE_SKIP_MODULE );
 	}
 }
diff --git a/src/modules/table/table_tools/Makefile.am b/src/modules/table/table_tools/Makefile.am
index a9d34cf..3f5d6f3 100644
--- a/src/modules/table/table_tools/Makefile.am
+++ b/src/modules/table/table_tools/Makefile.am
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.am 1841 2013-09-17 08:11:24Z oconrad $
+# $Id: Makefile.am 2366 2015-01-09 15:13:32Z oconrad $
 #
 if DEBUG
 DBGFLAGS = -g -DDEBUG
@@ -15,6 +15,7 @@ pkglib_LTLIBRARIES = libtable_tools.la
 libtable_tools_la_SOURCES =\
 Join_Tables.cpp\
 MLB_Interface.cpp\
+table_categories_to_indicators.cpp\
 table_change_color_format.cpp\
 table_change_date_format.cpp\
 table_change_field_type.cpp\
@@ -26,6 +27,7 @@ table_selection.cpp\
 table_text_replacer.cpp\
 Join_Tables.h\
 MLB_Interface.h\
+table_categories_to_indicators.h\
 table_change_color_format.h\
 table_change_date_format.h\
 table_change_field_type.h\
diff --git a/src/modules/table/table_tools/Makefile.in b/src/modules/table/table_tools/Makefile.in
index 0cbdbb1..c62b790 100644
--- a/src/modules/table/table_tools/Makefile.in
+++ b/src/modules/table/table_tools/Makefile.in
@@ -128,10 +128,11 @@ LTLIBRARIES = $(pkglib_LTLIBRARIES)
 libtable_tools_la_DEPENDENCIES =  \
 	$(top_srcdir)/src/saga_core/saga_api/libsaga_api.la
 am_libtable_tools_la_OBJECTS = Join_Tables.lo MLB_Interface.lo \
-	table_change_color_format.lo table_change_date_format.lo \
-	table_change_field_type.lo Table_Create_Empty.lo \
-	Table_Enumerate.lo table_field_deletion.lo Table_Rotate.lo \
-	table_selection.lo table_text_replacer.lo
+	table_categories_to_indicators.lo table_change_color_format.lo \
+	table_change_date_format.lo table_change_field_type.lo \
+	Table_Create_Empty.lo Table_Enumerate.lo \
+	table_field_deletion.lo Table_Rotate.lo table_selection.lo \
+	table_text_replacer.lo
 libtable_tools_la_OBJECTS = $(am_libtable_tools_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
@@ -365,7 +366,7 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
 #
-# $Id: Makefile.am 1841 2013-09-17 08:11:24Z oconrad $
+# $Id: Makefile.am 2366 2015-01-09 15:13:32Z oconrad $
 #
 @DEBUG_TRUE at DBGFLAGS = -g -DDEBUG
 @SAGA_UNICODE_TRUE at UC_DEFS = -D_SAGA_UNICODE
@@ -377,6 +378,7 @@ pkglib_LTLIBRARIES = libtable_tools.la
 libtable_tools_la_SOURCES = \
 Join_Tables.cpp\
 MLB_Interface.cpp\
+table_categories_to_indicators.cpp\
 table_change_color_format.cpp\
 table_change_date_format.cpp\
 table_change_field_type.cpp\
@@ -388,6 +390,7 @@ table_selection.cpp\
 table_text_replacer.cpp\
 Join_Tables.h\
 MLB_Interface.h\
+table_categories_to_indicators.h\
 table_change_color_format.h\
 table_change_date_format.h\
 table_change_field_type.h\
@@ -483,6 +486,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Table_Create_Empty.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Table_Enumerate.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Table_Rotate.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/table_categories_to_indicators.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/table_change_color_format.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/table_change_date_format.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/table_change_field_type.Plo at am__quote@
@@ -491,22 +495,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/table_text_replacer.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/table/table_tools/Table_Create_Empty.cpp b/src/modules/table/table_tools/Table_Create_Empty.cpp
index 37b9933..4e4ff52 100644
--- a/src/modules/table/table_tools/Table_Create_Empty.cpp
+++ b/src/modules/table/table_tools/Table_Create_Empty.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Table_Create_Empty.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: Table_Create_Empty.cpp 2355 2014-12-19 09:55:41Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -90,19 +90,26 @@ CTable_Create_Empty::CTable_Create_Empty(void)
 
 	Set_Author		(SG_T("O. Conrad (c) 2005"));
 
-	Set_Description	(_TW(
-		"Creates a new empty table. "
+	Set_Description	(CSG_String::Format(_TW(
+		"Creates a new empty table.\n\n"
 		"Possible field types are:\n"
-		" - character string\n"
-		" - 1 byte integer\n"
-		" - 2 byte integer\n"
-		" - 4 byte integer\n"
-		" - 4 byte floating point\n"
-		" - 8 byte floating point\n"
-		" - 32 bit true color (RGB)\n"
+		"- %s\n- %s\n- %s\n- %s\n- %s\n- %s\n- %s\n- %s\n- %s\n- %s\n- %s\n- %s\n- %s\n- %s\n"),
+		SG_Data_Type_Get_Name(SG_DATATYPE_String).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_Date  ).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_Color ).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_Byte  ).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_Char  ).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_Word  ).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_Short ).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_DWord ).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_Int   ).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_ULong ).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_Long  ).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_Float ).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_Double).c_str(),
+		SG_Data_Type_Get_Name(SG_DATATYPE_Binary).c_str()
 	));
 
-
 	//-----------------------------------------------------
 	Parameters.Add_Table_Output(
 		NULL	, "TABLE"	, _TL("Table"),
@@ -148,16 +155,24 @@ void CTable_Create_Empty::_Set_Field_Count(CSG_Parameters *pAttributes, int nAtt
 	//-----------------------------------------------------
 	CSG_String	Types;
 
-	Types.Printf(SG_T("%s|%s|%s|%s|%s|%s|%s|"),
-		_TL("character string"),
-		_TL("1 byte integer"),
-		_TL("2 byte integer"),
-		_TL("4 byte integer"),
-		_TL("4 byte floating point"),
-		_TL("8 byte floating point"),
-		_TL("color (rgb)")
+	Types = CSG_String::Format(SG_T("%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|"),
+			SG_Data_Type_Get_Name(SG_DATATYPE_String).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Date  ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Color ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Byte  ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Char  ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Word  ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Short ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_DWord ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Int   ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_ULong ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Long  ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Float ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Double).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Binary).c_str()
 	);
 
+
 	//-----------------------------------------------------
 	if( pAttributes && nAttributes > 0 )
 	{
@@ -245,13 +260,20 @@ bool CTable_Create_Empty::On_Execute(void)
 		switch( pAttributes->Get_Parameter(GET_TYPE(i))->asInt() )
 		{
 		default:
-		case 0:	Type	= SG_DATATYPE_String;	break;
-		case 1:	Type	= SG_DATATYPE_Char  ;	break;
-		case 2:	Type	= SG_DATATYPE_Short ;	break;
-		case 3:	Type	= SG_DATATYPE_Int   ;	break;
-		case 4:	Type	= SG_DATATYPE_Float ;	break;
-		case 5:	Type	= SG_DATATYPE_Double;	break;
-		case 6:	Type	= SG_DATATYPE_Color ;	break;
+		case  0:	Type	= SG_DATATYPE_String;	break;
+		case  1:	Type	= SG_DATATYPE_Date;		break;
+		case  2:	Type	= SG_DATATYPE_Color;	break;
+		case  3:	Type	= SG_DATATYPE_Byte;		break;
+		case  4:	Type	= SG_DATATYPE_Char;		break;
+		case  5:	Type	= SG_DATATYPE_Word;		break;
+		case  6:	Type	= SG_DATATYPE_Short;	break;
+		case  7:	Type	= SG_DATATYPE_DWord;	break;
+		case  8:	Type	= SG_DATATYPE_Int;		break;
+		case  9:	Type	= SG_DATATYPE_ULong;	break;
+		case 10:	Type	= SG_DATATYPE_Long;		break;
+		case 11:	Type	= SG_DATATYPE_Float;	break;
+		case 12:	Type	= SG_DATATYPE_Double;	break;
+		case 13:	Type	= SG_DATATYPE_Binary;	break;
 		}
 
 		pTable->Add_Field(pAttributes->Get_Parameter(GET_NAME(i))->asString(), Type);
diff --git a/src/modules/statistics/statistics_kriging/kriging_universal_global.cpp b/src/modules/table/table_tools/table_categories_to_indicators.cpp
similarity index 51%
rename from src/modules/statistics/statistics_kriging/kriging_universal_global.cpp
rename to src/modules/table/table_tools/table_categories_to_indicators.cpp
index df4c648..c4203b1 100644
--- a/src/modules/statistics/statistics_kriging/kriging_universal_global.cpp
+++ b/src/modules/table/table_tools/table_categories_to_indicators.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: kriging_universal_global.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: table_categories_to_indicators.cpp 911 2011-02-14 16:38:15Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -9,13 +9,13 @@
 //      System for Automated Geoscientific Analyses      //
 //                                                       //
 //                    Module Library:                    //
-//                 Geostatistics_Kriging                 //
+//                     table_tools                       //
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//             Kriging_Universal_Global.cpp              //
+//           table_categories_to_indicators.cpp          //
 //                                                       //
-//                 Copyright (C) 2008 by                 //
+//                 Copyright (C) 2015 by                 //
 //                      Olaf Conrad                      //
 //                                                       //
 //-------------------------------------------------------//
@@ -44,9 +44,7 @@
 //                                                       //
 //    contact:    Olaf Conrad                            //
 //                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
+//                University of Hamburg                  //
 //                Germany                                //
 //                                                       //
 ///////////////////////////////////////////////////////////
@@ -61,7 +59,7 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#include "kriging_universal_global.h"
+#include "table_categories_to_indicators.h"
 
 
 ///////////////////////////////////////////////////////////
@@ -71,206 +69,161 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-CKriging_Universal_Global::CKriging_Universal_Global(void)
-	: CKriging_Base()
+CTable_Categories_to_Indicators::CTable_Categories_to_Indicators(void)
 {
-	Set_Name		(_TL("Universal Kriging (Global)"));
+	//-----------------------------------------------------
+	Set_Name	(_TL("Add Indicator Fields for Categories"));
 
-	Set_Author		(SG_T("O.Conrad (c) 2008"));
+	Set_Author	("O.Conrad (c) 2015");
 
 	Set_Description	(_TW(
-		"Universal Kriging for grid interpolation from irregular sample points.\n"
-		"This implementation does not use a maximum search radius. The weighting "
-		"matrix is generated globally for all points."
+		"Adds for each unique value found in the category field "
+		"an indicator field that will show a value of one (1) "
+		"for all records with this category value and zero (0) "
+		"for all others. This might be used e.g. for subsequent "
+		"indicator kriging. "
 	));
 
 	//-----------------------------------------------------
-	CSG_Parameter	*pNode	= Parameters.Add_Node(
-		NULL	, "NODE_UK"		, _TL("Universal Kriging"),
-		_TL("")
+	CSG_Parameter	*pNode	= Parameters.Add_Table(
+		NULL	, "TABLE"		, _TL("Table"),
+		_TL("Input table or shapefile"),
+		PARAMETER_INPUT
 	);
 
-	Parameters.Add_Grid_List(
-		pNode	, "GRIDS"		, _TL("Grids"),
-		_TL(""),
-		PARAMETER_INPUT_OPTIONAL, false
+	Parameters.Add_Table_Field(
+		pNode	, "FIELD"		, _TL("Categories"),
+		_TL("")
 	);
 
-	Parameters.Add_Choice(
-		pNode	,"INTERPOL"		, _TL("Grid Interpolation"),
+	Parameters.Add_Table(
+		NULL	, "OUT_TABLE"	, _TL("Output table with field(s) deleted"),
 		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|%s|%s|%s|"),
-			_TL("Nearest Neighbor"),
-			_TL("Bilinear Interpolation"),
-			_TL("Inverse Distance Interpolation"),
-			_TL("Bicubic Spline Interpolation"),
-			_TL("B-Spline Interpolation")
-		), 4
+		PARAMETER_OUTPUT_OPTIONAL
 	);
 
-	Parameters.Add_Value(
-		pNode	, "COORDS"		, _TL("Coordinates"),
+	Parameters.Add_Shapes(
+		NULL	, "OUT_SHAPES"	, _TL("Output shapes with field(s) deleted"),
 		_TL(""),
-		PARAMETER_TYPE_Bool, false
+		PARAMETER_OUTPUT_OPTIONAL
 	);
 }
 
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CKriging_Universal_Global::On_Initialize(void)
+int CTable_Categories_to_Indicators::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	m_pGrids		= Parameters("GRIDS"   )->asGridList();
-	m_Interpolation	= Parameters("INTERPOL")->asInt();
-	m_bCoords		= Parameters("COORDS"  )->asBool();
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "TABLE") )
+	{
+		CSG_Data_Object	*pObject	= pParameter->asDataObject();
 
-	//-----------------------------------------------------
-	int		i, j, k, n, nGrids, nCoords;
+		pParameters->Get_Parameter("OUT_TABLE" )->Set_Enabled(pObject &&
+			pObject->Get_ObjectType() == DATAOBJECT_TYPE_Table
+		);
 
-	nCoords	= m_bCoords ? 2 : 0;
-	nGrids	= m_pGrids->Get_Count();
+		pParameters->Get_Parameter("OUT_SHAPES")->Set_Enabled(pObject &&
+			pObject->Get_ObjectType() == DATAOBJECT_TYPE_Shapes
+		);
+	}
 
+	return( 1 );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CTable_Categories_to_Indicators::On_Execute(void)
+{
 	//-----------------------------------------------------
-	m_Points.Clear();
+	int		iCategory	= Parameters("FIELD")->asInt();
 
-	for(i=0; i<m_pPoints->Get_Count(); i++)
-	{
-		CSG_Shape	*pPoint	= m_pPoints->Get_Shape(i);
+	CSG_Table	*pTable	= Parameters("TABLE")->asTable();
 
-		if( !pPoint->is_NoData(m_zField) )
+	//-----------------------------------------------------
+	if( pTable->Get_ObjectType() == DATAOBJECT_TYPE_Shapes )
+	{
+		if( Parameters("OUT_SHAPES")->asShapes() != NULL && Parameters("OUT_SHAPES")->asShapes() != pTable )
 		{
-			bool		bAdd;
+			CSG_Shapes	*pOutput	= Parameters("OUT_SHAPES")->asShapes();
 
-			for(j=0, bAdd=true; j<nGrids && bAdd; j++)
-			{
-				if( !m_pGrids->asGrid(j)->is_InGrid_byPos(pPoint->Get_Point(0)) )
-				{
-					bAdd	= false;
-				}
-			}
+			pOutput->Create(((CSG_Shapes *)pTable)->Get_Type(), NULL, (CSG_Table *)0, ((CSG_Shapes *)pTable)->Get_Vertex_Type());
+			pOutput->Set_Name(CSG_String::Format(SG_T("%s [%s]"), pTable->Get_Name(), pTable->Get_Field_Name(iCategory)));
+			pOutput->Add_Field(pTable->Get_Field_Name(iCategory), pTable->Get_Field_Type(iCategory));
 
-			if( bAdd )
+			for(int i=0; i<pTable->Get_Count(); i++)
 			{
-				m_Points.Add(pPoint->Get_Point(0).x, pPoint->Get_Point(0).y, m_bLog ? log(pPoint->asDouble(m_zField)) : pPoint->asDouble(m_zField));
+				CSG_Table_Record	*pRecord	= pOutput->Add_Shape((CSG_Shape *)pTable->Get_Record(i), SHAPE_COPY_GEOM);
+
+				*(pRecord->Get_Value(0))	= *(pTable->Get_Record(i)->Get_Value(iCategory));
 			}
+
+			pTable		= pOutput;
+			iCategory	= 0;
 		}
 	}
 
 	//-----------------------------------------------------
-	if( (n = m_Points.Get_Count()) > 1 )
+	else // if( pTable->Get_ObjectType() == DATAOBJECT_TYPE_Table )
 	{
-		m_W.Create(n + 1 + nGrids + nCoords, n + 1 + nGrids + nCoords);
-
-		for(i=0; i<n; i++)
+		if( Parameters("OUT_TABLE"  )->asTable() != NULL && Parameters("OUT_TABLE"  )->asTable() != pTable )
 		{
-			m_W[i][i]	= 0.0;				// diagonal...
-			m_W[i][n]	= m_W[n][i]	= 1.0;	// edge...
+			CSG_Table	*pOutput	= Parameters("OUT_SHAPES")->asTable();
 
-			for(j=i+1; j<n; j++)
-			{
-				m_W[i][j]	= m_W[j][i]	= Get_Weight(m_Points[i], m_Points[j]);
-			}
+			pOutput->Destroy();
+			pOutput->Set_Name(CSG_String::Format(SG_T("%s [%s]"), pTable->Get_Name(), pTable->Get_Field_Name(iCategory)));
+			pOutput->Add_Field(pTable->Get_Field_Name(iCategory), pTable->Get_Field_Type(iCategory));
 
-			for(k=0, j=n+1; k<nGrids; k++, j++)
+			for(int i=0; i<pTable->Get_Count(); i++)
 			{
-				m_W[i][j]	= m_W[j][i]	= m_pGrids->asGrid(k)->Get_Value(m_Points[i].x, m_Points[i].y, m_Interpolation);
-			}
+				CSG_Table_Record	*pRecord	= pOutput->Add_Record();
 
-			for(k=0, j=n+nGrids+1; k<nCoords; k++, j++)
-			{
-				m_W[i][j]	= m_W[j][i]	= k == 0 ? m_Points[i].x : m_Points[i].y;
+				*(pRecord->Get_Value(0))	= *(pTable->Get_Record(i)->Get_Value(iCategory));
 			}
-		}
 
-		for(i=n; i<=n+nGrids+nCoords; i++)
-		{
-			for(j=n; j<=n+nGrids+nCoords; j++)
-			{
-				m_W[i][j]	= 0.0;
-			}
+			pTable		= pOutput;
+			iCategory	= 0;
 		}
-
-		return( m_W.Set_Inverse(false) );
 	}
 
 	//-----------------------------------------------------
-	return( false );
-}
+	TSG_Table_Index_Order	old_Order	= pTable->Get_Index_Order(0);
+	int						old_Field	= pTable->Get_Index_Field(0);
 
-//---------------------------------------------------------
-bool CKriging_Universal_Global::On_Finalize(void)
-{
-	m_Points.Clear();
-	m_W.Destroy();
+	pTable->Set_Index(iCategory, TABLE_INDEX_Descending);
 
-	return( true );
-}
+	int		nCategories	= 0;
 
+	CSG_String	Value;
 
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-bool CKriging_Universal_Global::Get_Value(const TSG_Point &p, double &z, double &v)
-{
-	int		i, j, n, nGrids, nCoords;
-
-	//-----------------------------------------------------
-	if(	(n = m_Points.Get_Count()) > 1 )
+	for(int iRecord=0; iRecord<pTable->Get_Count() && Set_Progress(iRecord, pTable->Get_Count()); iRecord++)
 	{
-		nCoords	= m_bCoords ? 2 : 0;
-		nGrids	= m_pGrids->Get_Count();
-
-		CSG_Vector	G(n + 1 + nGrids + nCoords);
+		CSG_Table_Record	*pRecord	= pTable->Get_Record_byIndex(iRecord);
 
-		for(i=0; i<n; i++)
+		if( iRecord == 0 || Value.Cmp(pRecord->asString(iCategory)) )
 		{
-			G[i]	=	Get_Weight(p.x, p.y, m_Points[i].x, m_Points[i].y);
-		}
-
-		G[n]	= 1.0;
+			Value	= pRecord->asString(iCategory);
 
-		for(i=0, j=n+1; i<nGrids; i++, j++)
-		{
-			if( !m_pGrids->asGrid(i)->Get_Value(p, G[j], m_Interpolation, false, true) )
-			{
-				return( false );
-			}
-		}
+			pTable->Add_Field(Value, SG_DATATYPE_Int);
 
-		if( m_bCoords )
-		{
-			G[n + 1 + nGrids]	= p.x;
-			G[n + 2 + nGrids]	= p.y;
+			nCategories++;
 		}
 
-		//-------------------------------------------------
-		for(i=0, z=0.0, v=0.0; i<n; i++)
-		{
-			double	Lambda	= 0.0;
-
-			for(j=0; j<=n+nGrids+nCoords; j++)
-			{
-				Lambda	+= m_W[i][j] * G[j];
-			}
+		pRecord->Set_Value(pTable->Get_Field_Count() - 1, 1.0);
+	}
 
-			z	+= Lambda * m_Points[i].z;
-			v	+= Lambda * G[i];
-		}
+	pTable->Set_Index(old_Field, old_Order);
 
-		//-------------------------------------------------
-		return( true );
-	}
+	Message_Add(CSG_String::Format("\n%s: %d\n", _TL("number of categories"), nCategories), false);
 
-	return( false );
+	//-----------------------------------------------------
+	return( true );
 }
 
 
diff --git a/src/modules/table/table_tools/table_text_replacer.h b/src/modules/table/table_tools/table_categories_to_indicators.h
similarity index 89%
copy from src/modules/table/table_tools/table_text_replacer.h
copy to src/modules/table/table_tools/table_categories_to_indicators.h
index 211c1ca..6a3f61e 100644
--- a/src/modules/table/table_tools/table_text_replacer.h
+++ b/src/modules/table/table_tools/table_categories_to_indicators.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: table_text_replacer.h 911 2011-02-14 16:38:15Z reklov_w $
+ * Version $Id: table_categories_to_indicators.h 911 2011-02-14 16:38:15Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -13,9 +13,9 @@
 //                                                       //
 //-------------------------------------------------------//
 //                                                       //
-//                 table_text_replacer.h                 //
+//            table_categories_to_indicators.h           //
 //                                                       //
-//                 Copyright (C) 2013 by                 //
+//                 Copyright (C) 2015 by                 //
 //                      Olaf Conrad                      //
 //                                                       //
 //-------------------------------------------------------//
@@ -58,8 +58,8 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#ifndef HEADER_INCLUDED__table_text_replacer_H
-#define HEADER_INCLUDED__table_text_replacer_H
+#ifndef HEADER_INCLUDED__table_categories_to_indicators_H
+#define HEADER_INCLUDED__table_categories_to_indicators_H
 
 
 ///////////////////////////////////////////////////////////
@@ -79,10 +79,10 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-class CTable_Text_Replacer : public CSG_Module
+class CTable_Categories_to_Indicators : public CSG_Module
 {
 public:
-	CTable_Text_Replacer(void);
+	CTable_Categories_to_Indicators(void);
 
 
 protected:
@@ -92,13 +92,6 @@ protected:
 	virtual bool		On_Execute				(void);
 
 
-private:
-
-	CSG_Table			*m_pReplacer;
-
-
-	int					Replace					(CSG_Table_Record *pRecord, int iField);
-
 };
 
 
@@ -109,4 +102,4 @@ private:
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED__table_text_replacer_H
+#endif // #ifndef HEADER_INCLUDED__table_categories_to_indicators_H
diff --git a/src/modules/table/table_tools/table_text_replacer.cpp b/src/modules/table/table_tools/table_text_replacer.cpp
index e291f76..41fd629 100644
--- a/src/modules/table/table_tools/table_text_replacer.cpp
+++ b/src/modules/table/table_tools/table_text_replacer.cpp
@@ -198,9 +198,10 @@ bool CTable_Text_Replacer::On_Execute(void)
 	}
 
 	//-----------------------------------------------------
-	m_pReplacer		= Parameters("REPLACE")->asTable();
-	int	iField		= Parameters("FIELD"  )->asInt();
-	int	nChanges	= 0;
+	m_pReplacer	= Parameters("REPLACE")->asTable();
+	int	iField	= Parameters("FIELD"  )->asInt  ();
+
+	size_t	nChanges	= 0;
 
 	for(int iRecord=0; iRecord<pTable->Get_Count(); iRecord++)
 	{
@@ -236,11 +237,11 @@ bool CTable_Text_Replacer::On_Execute(void)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-inline int CTable_Text_Replacer::Replace(CSG_Table_Record *pRecord, int iField)
+inline size_t CTable_Text_Replacer::Replace(CSG_Table_Record *pRecord, int iField)
 {
 	CSG_String	Text(pRecord->asString(iField));
 
-	int	nChanges	= 0;
+	size_t	nChanges	= 0;
 
 	for(int i=0; i<m_pReplacer->Get_Count(); i++)
 	{
diff --git a/src/modules/table/table_tools/table_text_replacer.h b/src/modules/table/table_tools/table_text_replacer.h
index 211c1ca..8a1e4ee 100644
--- a/src/modules/table/table_tools/table_text_replacer.h
+++ b/src/modules/table/table_tools/table_text_replacer.h
@@ -97,7 +97,7 @@ private:
 	CSG_Table			*m_pReplacer;
 
 
-	int					Replace					(CSG_Table_Record *pRecord, int iField);
+	size_t				Replace					(CSG_Table_Record *pRecord, int iField);
 
 };
 
diff --git a/src/modules/terrain_analysis/ta_channels/ChannelNetwork.cpp b/src/modules/terrain_analysis/ta_channels/ChannelNetwork.cpp
index 104aef8..f5cc4b7 100644
--- a/src/modules/terrain_analysis/ta_channels/ChannelNetwork.cpp
+++ b/src/modules/terrain_analysis/ta_channels/ChannelNetwork.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: ChannelNetwork.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: ChannelNetwork.cpp 2342 2014-11-26 13:41:35Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
diff --git a/src/modules/terrain_analysis/ta_channels/ChannelNetwork.h b/src/modules/terrain_analysis/ta_channels/ChannelNetwork.h
index 53f664a..7404182 100644
--- a/src/modules/terrain_analysis/ta_channels/ChannelNetwork.h
+++ b/src/modules/terrain_analysis/ta_channels/ChannelNetwork.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: ChannelNetwork.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: ChannelNetwork.h 2342 2014-11-26 13:41:35Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
diff --git a/src/modules/terrain_analysis/ta_channels/ChannelNetwork_Altitude.cpp b/src/modules/terrain_analysis/ta_channels/ChannelNetwork_Altitude.cpp
index 368a184..546c93f 100644
--- a/src/modules/terrain_analysis/ta_channels/ChannelNetwork_Altitude.cpp
+++ b/src/modules/terrain_analysis/ta_channels/ChannelNetwork_Altitude.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: ChannelNetwork_Altitude.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: ChannelNetwork_Altitude.cpp 2342 2014-11-26 13:41:35Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -247,7 +247,7 @@ void CChannelNetwork_Altitude::Set_Surface(int nCells)
 			}
 			else
 			{
-				m_Mask.Set_Value(x, y, 1.0);
+				m_Mask.Set_Value(x, y, 0.0);
 
 				if( m_pDistance->is_NoData(x, y) )
 				{
diff --git a/src/modules/terrain_analysis/ta_channels/ChannelNetwork_Altitude.h b/src/modules/terrain_analysis/ta_channels/ChannelNetwork_Altitude.h
index ac2ce4e..66e4579 100644
--- a/src/modules/terrain_analysis/ta_channels/ChannelNetwork_Altitude.h
+++ b/src/modules/terrain_analysis/ta_channels/ChannelNetwork_Altitude.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: ChannelNetwork_Altitude.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: ChannelNetwork_Altitude.h 2342 2014-11-26 13:41:35Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
diff --git a/src/modules/terrain_analysis/ta_channels/ChannelNetwork_Distance.cpp b/src/modules/terrain_analysis/ta_channels/ChannelNetwork_Distance.cpp
index 28ad958..968a711 100644
--- a/src/modules/terrain_analysis/ta_channels/ChannelNetwork_Distance.cpp
+++ b/src/modules/terrain_analysis/ta_channels/ChannelNetwork_Distance.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: ChannelNetwork_Distance.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: ChannelNetwork_Distance.cpp 2342 2014-11-26 13:41:35Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
diff --git a/src/modules/terrain_analysis/ta_channels/ChannelNetwork_Distance.h b/src/modules/terrain_analysis/ta_channels/ChannelNetwork_Distance.h
index 27bfdeb..50432d2 100644
--- a/src/modules/terrain_analysis/ta_channels/ChannelNetwork_Distance.h
+++ b/src/modules/terrain_analysis/ta_channels/ChannelNetwork_Distance.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: ChannelNetwork_Distance.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: ChannelNetwork_Distance.h 2342 2014-11-26 13:41:35Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
diff --git a/src/modules/terrain_analysis/ta_channels/D8_Flow_Analysis.cpp b/src/modules/terrain_analysis/ta_channels/D8_Flow_Analysis.cpp
index f4a382b..eec680d 100644
--- a/src/modules/terrain_analysis/ta_channels/D8_Flow_Analysis.cpp
+++ b/src/modules/terrain_analysis/ta_channels/D8_Flow_Analysis.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: D8_Flow_Analysis.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: D8_Flow_Analysis.cpp 2342 2014-11-26 13:41:35Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
diff --git a/src/modules/terrain_analysis/ta_channels/D8_Flow_Analysis.h b/src/modules/terrain_analysis/ta_channels/D8_Flow_Analysis.h
index 946ea0e..90b0191 100644
--- a/src/modules/terrain_analysis/ta_channels/D8_Flow_Analysis.h
+++ b/src/modules/terrain_analysis/ta_channels/D8_Flow_Analysis.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: D8_Flow_Analysis.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: D8_Flow_Analysis.h 2342 2014-11-26 13:41:35Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
diff --git a/src/modules/terrain_analysis/ta_channels/MLB_Interface.cpp b/src/modules/terrain_analysis/ta_channels/MLB_Interface.cpp
index 443d454..4687b3f 100644
--- a/src/modules/terrain_analysis/ta_channels/MLB_Interface.cpp
+++ b/src/modules/terrain_analysis/ta_channels/MLB_Interface.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: MLB_Interface.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: MLB_Interface.cpp 2342 2014-11-26 13:41:35Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -72,8 +72,8 @@ CSG_String Get_Info(int i)
 	case MLB_INFO_Name:	default:
 		return( _TL("Channels") );
 
-	case MLB_INFO_Category:
-		return( _TL("Terrain Analysis") );
+	case MLB_INFO_Category:
+		return( _TL("Terrain Analysis") );
 
 	case MLB_INFO_Author:
 		return( SG_T("O. Conrad, V. Olaya (c) 2002-4") );
diff --git a/src/modules/terrain_analysis/ta_channels/MLB_Interface.h b/src/modules/terrain_analysis/ta_channels/MLB_Interface.h
index 2e38e9f..c8d8511 100644
--- a/src/modules/terrain_analysis/ta_channels/MLB_Interface.h
+++ b/src/modules/terrain_analysis/ta_channels/MLB_Interface.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: MLB_Interface.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: MLB_Interface.h 2342 2014-11-26 13:41:35Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
diff --git a/src/modules/terrain_analysis/ta_channels/Makefile.in b/src/modules/terrain_analysis/ta_channels/Makefile.in
index 6b3fae7..98a6949 100644
--- a/src/modules/terrain_analysis/ta_channels/Makefile.in
+++ b/src/modules/terrain_analysis/ta_channels/Makefile.in
@@ -481,22 +481,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Watersheds_ext.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/terrain_analysis/ta_channels/Strahler.cpp b/src/modules/terrain_analysis/ta_channels/Strahler.cpp
index 973dd7e..28c2d64 100644
--- a/src/modules/terrain_analysis/ta_channels/Strahler.cpp
+++ b/src/modules/terrain_analysis/ta_channels/Strahler.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Strahler.cpp 911 2011-02-14 16:38:15Z reklov_w $
+ * Version $Id: Strahler.cpp 2342 2014-11-26 13:41:35Z reklov_w $
  *********************************************************/
 /*******************************************************************************
     Strahler.cpp
diff --git a/src/modules/terrain_analysis/ta_channels/Strahler.h b/src/modules/terrain_analysis/ta_channels/Strahler.h
index e05a7ee..4f2c6c1 100644
--- a/src/modules/terrain_analysis/ta_channels/Strahler.h
+++ b/src/modules/terrain_analysis/ta_channels/Strahler.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Strahler.h 911 2011-02-14 16:38:15Z reklov_w $
+ * Version $Id: Strahler.h 2342 2014-11-26 13:41:35Z reklov_w $
  *********************************************************/
 /*******************************************************************************
     Strahler.h
diff --git a/src/modules/terrain_analysis/ta_channels/Watersheds.cpp b/src/modules/terrain_analysis/ta_channels/Watersheds.cpp
index 363a04c..f74d5c3 100644
--- a/src/modules/terrain_analysis/ta_channels/Watersheds.cpp
+++ b/src/modules/terrain_analysis/ta_channels/Watersheds.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Watersheds.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: Watersheds.cpp 2447 2015-03-19 14:43:42Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -165,7 +165,7 @@ bool CWatersheds::On_Execute(void)
 					n	= pDTM->Get_Gradient_NeighborDir(x, y);
 				}
 
-				m_Direction.Set_Value(x, y, n < 0 ? -1 : (n + 4) % 8);
+				m_Direction.Set_Value(x, y, (int)(n < 0 ? -1 : (n + 4) % 8));
 			}
 		}
 	}
diff --git a/src/modules/terrain_analysis/ta_channels/Watersheds.h b/src/modules/terrain_analysis/ta_channels/Watersheds.h
index c95f36b..be2774b 100644
--- a/src/modules/terrain_analysis/ta_channels/Watersheds.h
+++ b/src/modules/terrain_analysis/ta_channels/Watersheds.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Watersheds.h 1922 2014-01-09 10:28:46Z oconrad $
+ * Version $Id: Watersheds.h 2342 2014-11-26 13:41:35Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
diff --git a/src/modules/terrain_analysis/ta_channels/Watersheds_ext.cpp b/src/modules/terrain_analysis/ta_channels/Watersheds_ext.cpp
index c054995..edae0f9 100644
--- a/src/modules/terrain_analysis/ta_channels/Watersheds_ext.cpp
+++ b/src/modules/terrain_analysis/ta_channels/Watersheds_ext.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Watersheds_ext.cpp 947 2011-03-03 11:56:34Z oconrad $
+ * Version $Id: Watersheds_ext.cpp 2342 2014-11-26 13:41:35Z reklov_w $
  *********************************************************/
 /*******************************************************************************
     Watersheds.cpp
diff --git a/src/modules/terrain_analysis/ta_channels/Watersheds_ext.h b/src/modules/terrain_analysis/ta_channels/Watersheds_ext.h
index 4f70159..0ed3934 100644
--- a/src/modules/terrain_analysis/ta_channels/Watersheds_ext.h
+++ b/src/modules/terrain_analysis/ta_channels/Watersheds_ext.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: Watersheds_ext.h 946 2011-03-02 15:32:39Z oconrad $
+ * Version $Id: Watersheds_ext.h 2342 2014-11-26 13:41:35Z reklov_w $
  *********************************************************/
 /*******************************************************************************
     Watersheds.h
diff --git a/src/modules/terrain_analysis/ta_compound/Makefile.in b/src/modules/terrain_analysis/ta_compound/Makefile.in
index d6ebd3c..47b4507 100644
--- a/src/modules/terrain_analysis/ta_compound/Makefile.in
+++ b/src/modules/terrain_analysis/ta_compound/Makefile.in
@@ -460,22 +460,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/TA_Standard.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/terrain_analysis/ta_compound/TA_Standard.cpp b/src/modules/terrain_analysis/ta_compound/TA_Standard.cpp
index cdb4205..e509a0f 100644
--- a/src/modules/terrain_analysis/ta_compound/TA_Standard.cpp
+++ b/src/modules/terrain_analysis/ta_compound/TA_Standard.cpp
@@ -91,7 +91,7 @@ CTA_Standard::CTA_Standard(void)
 	Parameters.Add_Grid  (NULL, "VCURV"      , _TL("Profile Curvature"         ), _TL(""), PARAMETER_OUTPUT);
 	Parameters.Add_Grid  (NULL, "CONVERGENCE", _TL("Convergence Index"         ), _TL(""), PARAMETER_OUTPUT);
 	Parameters.Add_Grid  (NULL, "SINKS"      , _TL("Closed Depressions"        ), _TL(""), PARAMETER_OUTPUT);
-	Parameters.Add_Grid  (NULL, "CAREA"      , _TL("Catchment Area"            ), _TL(""), PARAMETER_OUTPUT);
+	Parameters.Add_Grid  (NULL, "CAREA"      , _TL("Total Catchment Area"      ), _TL(""), PARAMETER_OUTPUT);
 	Parameters.Add_Grid  (NULL, "WETNESS"    , _TL("Topographic Wetness Index" ), _TL(""), PARAMETER_OUTPUT);
 	Parameters.Add_Grid  (NULL, "LSFACTOR"   , _TL("LS-Factor"                 ), _TL(""), PARAMETER_OUTPUT);
 	Parameters.Add_Shapes(NULL, "CHANNELS"   , _TL("Channel Network"           ), _TL(""), PARAMETER_OUTPUT, SHAPE_TYPE_Line);
diff --git a/src/modules/terrain_analysis/ta_hydrology/EdgeContamination.h b/src/modules/terrain_analysis/ta_hydrology/EdgeContamination.h
index 0026136..dbbedb3 100644
--- a/src/modules/terrain_analysis/ta_hydrology/EdgeContamination.h
+++ b/src/modules/terrain_analysis/ta_hydrology/EdgeContamination.h
@@ -43,7 +43,7 @@ class CEdgeContamination : public CSG_Module_Grid
 public:
 	CEdgeContamination(void);
 
-	virtual CSG_String		Get_MenuPath		(void)	{	return( _TL("R:Catchment Area" ));	}
+	virtual CSG_String		Get_MenuPath		(void)	{	return( _TL("Flow Accumulation" ));	}
 
 
 protected:
diff --git a/src/modules/terrain_analysis/ta_hydrology/Flow.cpp b/src/modules/terrain_analysis/ta_hydrology/Flow.cpp
index 0384b94..95162fe 100644
--- a/src/modules/terrain_analysis/ta_hydrology/Flow.cpp
+++ b/src/modules/terrain_analysis/ta_hydrology/Flow.cpp
@@ -89,16 +89,11 @@ CFlow::CFlow(void)
 	m_bPoint	= false;
 
 	//-----------------------------------------------------
-	Set_Description (_TW(
-		""
-	));
-
-	//-----------------------------------------------------
 	Parameters.Add_Grid(NULL, "ELEVATION" , _TL("Elevation"                                ), _TL(""), PARAMETER_INPUT);
 	Parameters.Add_Grid(NULL, "SINKROUTE" , _TL("Sink Routes"                              ), _TL(""), PARAMETER_INPUT_OPTIONAL);
 	Parameters.Add_Grid(NULL, "WEIGHT"    , _TL("Weight"                                   ), _TL(""), PARAMETER_INPUT_OPTIONAL);
 
-	Parameters.Add_Grid(NULL, "CAREA"     , _TL("Catchment Area"                           ), _TL(""), PARAMETER_OUTPUT);
+	Parameters.Add_Grid(NULL, "CAREA"     , _TL("Flow Accumulation"                        ), _TL(""), PARAMETER_OUTPUT);
 
 	Parameters.Add_Grid(NULL, "VAL_INPUT" , _TL("Input for Mean over Catchment Calculation"), _TL(""), PARAMETER_INPUT_OPTIONAL);
 	Parameters.Add_Grid(NULL, "VAL_MEAN"  , _TL("Mean over Catchment"                      ), _TL(""), PARAMETER_OUTPUT);
@@ -115,6 +110,15 @@ CFlow::CFlow(void)
 		_TL(""),
 		PARAMETER_TYPE_Int, 1, 1, true
 	);
+
+	Parameters.Add_Choice(
+		NULL	, "CAREA_UNIT"	, _TL("Flow Accumulation Unit"),
+		_TL(""),
+		CSG_String::Format("%s|%s|",
+			_TL("number of cells"),
+			_TL("cell area")
+		), 1
+	);
 }
 
 
@@ -148,7 +152,12 @@ int CFlow::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pPar
 		pParameters->Set_Enabled("VAL_MEAN", pParameter->asGrid() != NULL);
 	}
 
-	return( 1 );
+	if( !SG_STR_CMP(pParameter->Get_Identifier(), "WEIGHT") )
+	{
+		pParameters->Set_Enabled("WEIGHT_GT_0", pParameter->asGrid() != NULL);
+	}
+
+	return( CSG_Module_Grid::On_Parameters_Enable(pParameters, pParameter) );
 }
 
 
@@ -187,6 +196,7 @@ bool CFlow::On_Execute(void)
 	m_pAccu_Right	= NULL;
 
 	m_Step			= Parameters("STEP")->asInt();
+	m_bGT_Zero		= false;
 
 	//-----------------------------------------------------
 	On_Initialize();
@@ -275,6 +285,8 @@ void CFlow::Init_Cell(int x, int y)
 //---------------------------------------------------------
 void CFlow::_Finalize(void)
 {
+	bool	bCellsToArea	= Parameters("CAREA_UNIT")->asInt() == 1;
+
 	#pragma omp parallel for
 	for(sLong n=0; n<Get_NCells(); n++)
 	{
@@ -292,7 +304,7 @@ void CFlow::_Finalize(void)
 			//---------------------------------------------
 			double	Catch	= m_pCatch->asDouble(n);
 
-			if( m_pCatch )
+			if( m_pCatch && bCellsToArea )
 			{
 				m_pCatch->Set_Value(n, Catch * Get_System()->Get_Cellarea());
 			}
diff --git a/src/modules/terrain_analysis/ta_hydrology/Flow.h b/src/modules/terrain_analysis/ta_hydrology/Flow.h
index 032841d..3ff91fd 100644
--- a/src/modules/terrain_analysis/ta_hydrology/Flow.h
+++ b/src/modules/terrain_analysis/ta_hydrology/Flow.h
@@ -106,13 +106,15 @@ class ta_hydrology_EXPORT CFlow : public CSG_Module_Grid
 public:
 	CFlow(void);
 
-	virtual CSG_String		Get_MenuPath			(void)	{	return( _TL("R:Catchment Area" ));	}
+	virtual CSG_String		Get_MenuPath			(void)	{	return( _TL("Flow Accumulation" ));	}
 
 	void					Set_Point				(int x, int y);
 
 
 protected:
 
+	bool					m_bGT_Zero;
+
 	int						m_Step;
 
 	double					m_Converge;
diff --git a/src/modules/terrain_analysis/ta_hydrology/Flow_AreaDownslope.h b/src/modules/terrain_analysis/ta_hydrology/Flow_AreaDownslope.h
index 1eb3a44..a7d0d39 100644
--- a/src/modules/terrain_analysis/ta_hydrology/Flow_AreaDownslope.h
+++ b/src/modules/terrain_analysis/ta_hydrology/Flow_AreaDownslope.h
@@ -88,7 +88,7 @@ public:
 	CFlow_AreaDownslope(void);
 	virtual ~CFlow_AreaDownslope(void);
 
-	virtual CSG_String		Get_MenuPath	(void)	{	return( _TL("R:Catchment Area" ));	}
+	virtual CSG_String		Get_MenuPath	(void)	{	return( _TL("Flow Accumulation" ));	}
 
 
 protected:
diff --git a/src/modules/terrain_analysis/ta_hydrology/Flow_AreaUpslope.h b/src/modules/terrain_analysis/ta_hydrology/Flow_AreaUpslope.h
index a706334..c611bf0 100644
--- a/src/modules/terrain_analysis/ta_hydrology/Flow_AreaUpslope.h
+++ b/src/modules/terrain_analysis/ta_hydrology/Flow_AreaUpslope.h
@@ -131,7 +131,7 @@ public:
 	CFlow_AreaUpslope_Interactive(void);
 	virtual ~CFlow_AreaUpslope_Interactive(void);
 
-	virtual CSG_String		Get_MenuPath		(void)	{	return( _TL("R:Catchment Area" ));	}
+	virtual CSG_String		Get_MenuPath		(void)	{	return( _TL("Flow Accumulation" ));	}
 
 
 protected:
@@ -154,7 +154,7 @@ public:
 	CFlow_AreaUpslope_Area(void);
 	virtual ~CFlow_AreaUpslope_Area(void);
 
-	virtual CSG_String		Get_MenuPath		(void)	{	return( _TL("R:Catchment Area" ));	}
+	virtual CSG_String		Get_MenuPath		(void)	{	return( _TL("Flow Accumulation" ));	}
 
 
 protected:
diff --git a/src/modules/terrain_analysis/ta_hydrology/Flow_Distance.h b/src/modules/terrain_analysis/ta_hydrology/Flow_Distance.h
index 51d650c..24bab22 100644
--- a/src/modules/terrain_analysis/ta_hydrology/Flow_Distance.h
+++ b/src/modules/terrain_analysis/ta_hydrology/Flow_Distance.h
@@ -88,7 +88,7 @@ public:
 	CFlow_Distance(void);
 	virtual ~CFlow_Distance(void);
 
-	virtual CSG_String		Get_MenuPath	(void)	{	return( SG_T("R:Catchment Area") );	}
+	virtual CSG_String		Get_MenuPath	(void)	{	return( SG_T("Flow Accumulation") );	}
 
 
 protected:
diff --git a/src/modules/terrain_analysis/ta_hydrology/Flow_Parallel.cpp b/src/modules/terrain_analysis/ta_hydrology/Flow_Parallel.cpp
index 01b6c1d..54e74f8 100644
--- a/src/modules/terrain_analysis/ta_hydrology/Flow_Parallel.cpp
+++ b/src/modules/terrain_analysis/ta_hydrology/Flow_Parallel.cpp
@@ -73,7 +73,7 @@
 //---------------------------------------------------------
 CFlow_Parallel::CFlow_Parallel(void)
 {
-	Set_Name		(_TL("Catchment Area (Top-Down)"));
+	Set_Name		(_TL("Flow Accumulation (Top-Down)"));
 
 	Set_Author		("O.Conrad (c) 2001-2014, T.Grabs portions (c) 2010");
 
@@ -136,7 +136,7 @@ CFlow_Parallel::CFlow_Parallel(void)
 
 	Parameters.Add_Grid(
 		NULL	, "LINEAR_VAL"	, _TL("Linear Flow Threshold Grid"),
-		_TL("optional grid providing values to be compared with linear flow threshold instead of catchment area"),
+		_TL("optional grid providing values to be compared with linear flow threshold instead of flow accumulation"),
 		PARAMETER_INPUT_OPTIONAL
 	);
 
@@ -168,13 +168,13 @@ CFlow_Parallel::CFlow_Parallel(void)
 
 	pNode	= Parameters.Add_Value(
 		NULL	, "LINEAR_DO"	, _TL("Thresholded Linear Flow"),
-		_TL("apply linear flow routing (D8) to all cells, having a catchment area greater than the specified threshold"),
+		_TL("apply linear flow routing (D8) to all cells, having a flow accumulation greater than the specified threshold"),
 		PARAMETER_TYPE_Bool
 	);
 
 	Parameters.Add_Value(
 		pNode	, "LINEAR_MIN"	, _TL("Linear Flow Threshold"),
-		_TL("catchment area threshold (cells) for linear flow routing"),
+		_TL("flow accumulation threshold (cells) for linear flow routing"),
 		PARAMETER_TYPE_Int,	500
 	);
 	
@@ -183,6 +183,12 @@ CFlow_Parallel::CFlow_Parallel(void)
 		_TL("Convergence factor for Multiple Flow Direction Algorithm (Freeman 1991).\nApplies also to the Multiple Triangular Flow Directon Algorithm."),
 		PARAMETER_TYPE_Double, 1.1, 0.0, true
 	);
+
+	Parameters.Add_Value(
+		NULL	, "WEIGHT_GT_0"	, _TL("Suppress Negative Flow Accumulation Values"),
+		_TL("keep accumulated weights above zero; useful e.g. when accumulating measures of water balance."),
+		PARAMETER_TYPE_Bool, true
+	);
 }
 
 
@@ -219,8 +225,9 @@ int CFlow_Parallel::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parame
 //---------------------------------------------------------
 void CFlow_Parallel::On_Initialize(void)
 {
-	m_pFlowPath	= Parameters("FLOWLEN"    )->asGrid  ();
+	m_pFlowPath	= Parameters("FLOWLEN")->asGrid();
 	m_Converge	= Parameters("CONVERGENCE")->asDouble();
+	m_bGT_Zero	= m_pWeight ? Parameters("WEIGHT_GT_0")->asBool() : false;
 }
 
 
@@ -290,6 +297,11 @@ bool CFlow_Parallel::Set_Flow(void)
 
 		if( m_pDTM->Get_Sorted(n, x, y) )
 		{
+			if( m_bGT_Zero && m_pCatch->asDouble(x, y) < 0.0 )
+			{
+				m_pCatch->Set_Value(x, y, 0.0);
+			}
+
 			if( pLinear_Dir && !pLinear_Dir->is_NoData(x, y) )
 			{
 				Set_D8(x, y, pLinear_Dir->asInt(x, y));
diff --git a/src/modules/terrain_analysis/ta_hydrology/Flow_RecursiveDown.cpp b/src/modules/terrain_analysis/ta_hydrology/Flow_RecursiveDown.cpp
index 8123fb5..a55e57f 100644
--- a/src/modules/terrain_analysis/ta_hydrology/Flow_RecursiveDown.cpp
+++ b/src/modules/terrain_analysis/ta_hydrology/Flow_RecursiveDown.cpp
@@ -82,7 +82,7 @@
 //---------------------------------------------------------
 CFlow_RecursiveDown::CFlow_RecursiveDown(void)
 {
-	Set_Name		(_TL("Catchment Area (Flow Tracing)"));
+	Set_Name		(_TL("Flow Accumulation (Flow Tracing)"));
 
 	Set_Author		(SG_T("O.Conrad (c) 2001"));
 
diff --git a/src/modules/terrain_analysis/ta_hydrology/Flow_RecursiveUp.cpp b/src/modules/terrain_analysis/ta_hydrology/Flow_RecursiveUp.cpp
index 48aaa28..e572163 100644
--- a/src/modules/terrain_analysis/ta_hydrology/Flow_RecursiveUp.cpp
+++ b/src/modules/terrain_analysis/ta_hydrology/Flow_RecursiveUp.cpp
@@ -73,9 +73,9 @@
 //---------------------------------------------------------
 CFlow_RecursiveUp::CFlow_RecursiveUp(void)
 {
-	Set_Name		(_TL("Catchment Area (Recursive)"));
+	Set_Name		(_TL("Flow Accumulation (Recursive)"));
 
-	Set_Author		(SG_T("O.Conrad (c) 2001"));
+	Set_Author		("O.Conrad (c) 2001");
 
 	Set_Description	(_TW(
 		"Recursive upward processing of cells for calculation of flow accumulation and related parameters. "
@@ -123,7 +123,7 @@ CFlow_RecursiveUp::CFlow_RecursiveUp(void)
 	// Output...
 
 	Parameters.Add_Grid(
-		NULL	, "FLOWLEN"		, _TL("m_Flow Path Length"),
+		NULL	, "FLOWLEN"		, _TL("Flow Path Length"),
 		_TL(""),
 		PARAMETER_OUTPUT_OPTIONAL
 	);
@@ -153,6 +153,12 @@ CFlow_RecursiveUp::CFlow_RecursiveUp(void)
 		PARAMETER_TYPE_Double	, 1.1
 	);
 
+	Parameters.Add_Value(
+		NULL	, "WEIGHT_GT_0"	, _TL("Suppress Negative Flow Accumulation Values"),
+		_TL("keep accumulated weights above zero; useful e.g. when accumulating measures of water balance."),
+		PARAMETER_TYPE_Bool, true
+	);
+
 	
 	//-----------------------------------------------------
 	// Initialisations...
@@ -243,8 +249,8 @@ void CFlow_RecursiveUp::On_Destroy(void)
 void CFlow_RecursiveUp::On_Initialize(void)
 {
 	m_pFlowPath	= Parameters("FLOWLEN")->asGrid();
-
 	m_Converge	= Parameters("CONVERGENCE")->asDouble();
+	m_bGT_Zero	= m_pWeight ? Parameters("WEIGHT_GT_0")->asBool() : false;
 }
 
 
@@ -299,33 +305,33 @@ bool CFlow_RecursiveUp::Calculate(int x, int y)
 //---------------------------------------------------------
 void CFlow_RecursiveUp::Get_Flow(int x, int y)
 {
-	int		i, ix, iy, j;
-
-	double	jFlow;
-
-	if( !is_Locked(x,y) )
+	if( is_Locked(x, y) == false )
 	{
-		Lock_Set(x,y);
+		Lock_Set (x, y);
+		Init_Cell(x, y);
 
-		Init_Cell(x,y);
-
-		for(i=0, j=4; i<8; i++, j=(j+1)%8)
+		for(int i=0; i<8; i++)
 		{
-			ix	= Get_xTo(i,x);
-			iy	= Get_yTo(i,y);
+			int	ix	= Get_xTo(i, x);
+			int	iy	= Get_yTo(i, y);
 
-			if( is_InGrid(ix,iy) )
+			if( is_InGrid(ix, iy) )
 			{
-				jFlow	= m_Flow[iy][ix][j];
+				int		iDir	= (i + 4) % 8;
+				double	iFlow	= m_Flow[iy][ix][iDir];
 
-				if( jFlow > 0 )
+				if( iFlow > 0.0 )
 				{
-					Get_Flow(ix,iy);
-
-					Add_Fraction(ix,iy,j,jFlow);
+					Get_Flow    (ix, iy);
+					Add_Fraction(ix, iy, iDir, iFlow);
 				}
 			}
 		}
+
+		if( m_bGT_Zero && m_pCatch->asDouble(x, y) < 0.0 )
+		{
+			m_pCatch->Set_Value(x, y, 0.0);
+		}
 	}
 }
 
diff --git a/src/modules/terrain_analysis/ta_hydrology/Helper.cpp b/src/modules/terrain_analysis/ta_hydrology/Helper.cpp
index 071ac67..1d431b9 100644
--- a/src/modules/terrain_analysis/ta_hydrology/Helper.cpp
+++ b/src/modules/terrain_analysis/ta_hydrology/Helper.cpp
@@ -22,6 +22,19 @@
 
 #include "Helper.h"
 
+void Init_FlowDirectionsD8(CSG_Grid *pDEM, CSG_Grid *pDirection)
+{
+	for(int y=0; y<pDEM->Get_NY() && SG_UI_Process_Set_Progress(y, pDEM->Get_NY()); y++)
+	{
+		#pragma omp parallel for
+		for(int x=0; x<pDEM->Get_NX(); x++)
+		{
+			pDirection->Set_Value(x, y, pDEM->Get_Gradient_NeighborDir(x, y), false);
+		}
+	}
+}
+
+
 void getNextCell(
 		CSG_Grid *g,
 		int iX,
diff --git a/src/modules/terrain_analysis/ta_hydrology/Helper.h b/src/modules/terrain_analysis/ta_hydrology/Helper.h
index a0195c5..4aacd8a 100644
--- a/src/modules/terrain_analysis/ta_hydrology/Helper.h
+++ b/src/modules/terrain_analysis/ta_hydrology/Helper.h
@@ -27,6 +27,7 @@
 
 #define GLOBAL_BASIN -1
 
+void Init_FlowDirectionsD8(CSG_Grid *pDEM, CSG_Grid *pDirection);
 void getNextCell(CSG_Grid*,int,int,int &,int &);
 void getNextCell(CSG_Grid*,CSG_Grid*,int,int,int&,int&);
 double FlowDistance(CSG_Grid*,CSG_Grid*,int,int,int,int,int);
diff --git a/src/modules/terrain_analysis/ta_hydrology/IsochronesConst.cpp b/src/modules/terrain_analysis/ta_hydrology/IsochronesConst.cpp
index a5de9d2..72885e7 100644
--- a/src/modules/terrain_analysis/ta_hydrology/IsochronesConst.cpp
+++ b/src/modules/terrain_analysis/ta_hydrology/IsochronesConst.cpp
@@ -23,12 +23,17 @@
 #include "Helper.h"
 #include "IsochronesConst.h"
 
+//-----------------------------------------------------
 CIsochronesConst::CIsochronesConst(void){
 
 	Set_Name(_TL("Isochrones Constant Speed"));
-	Set_Author(_TL("Copyrights (c) 2004 by Victor Olaya"));
-	Set_Description	(_TW(
-		"(c) 2004 by Victor Olaya. Isochrones calculation with constant speed"));
+	Set_Author(_TL("V.Olaya (c) 2004, V.Wichmann (c) 2015"));
+	Set_Description	(_TW("Isochrones calculation with constant speed based on a user "
+						"provided Time of Concentration. For each selected pour point, "
+						"the longest watercourse length and the average slope of the "
+						"watercourse are reported. These can be used to estimate the "
+						"Time of Concentration with one of the empirical equations "
+						"available.\n\n"));
 
 	Parameters.Add_Grid(NULL, 
 						"DEM", 
@@ -38,73 +43,88 @@ CIsochronesConst::CIsochronesConst(void){
 
 	Parameters.Add_Grid(NULL, 
 						"TIME", 
-						_TL("Time Out (h)"), 
+						_TL("Time Out [min]"), 
 						_TL(""), 
 						PARAMETER_OUTPUT, 
 						true, 
 						SG_DATATYPE_Double);
 
+	Parameters.Add_Value(
+		NULL, "TIME_OF_CONCENTRATION", _TL("Time of Concentration [min]"),
+		_TL("Time of Concentration [min] used to estimate flow speed."),
+		PARAMETER_TYPE_Double, 60.0, 0.001, true
+	);
+		
+
 }//constructor
 
 
+//-----------------------------------------------------
 CIsochronesConst::~CIsochronesConst(void){
 	On_Execute_Finish();
 }
 
 
-void CIsochronesConst::writeTimeOut(
-        int iX1,
-        int iY1,
-        int iX2,
-        int iY2) {
-	
-    int iNextX, iNextY;
-	double dDist = 1;
-	
-	if (iX1 < 0 || iX1 >= m_pDEM->Get_NX() || iY1 < 0 || iY1 >= m_pDEM->Get_NY()
-            || m_pDEM->is_NoData(iX1,iY1)) {        
-    }// if
-	else {				
-		if (abs(iX1 - iX2 + iY1 - iY2) == 1) {
-            dDist = m_pDEM->Get_Cellsize();
-        }// if
-        else {
-            dDist = 1.414 * m_pDEM->Get_Cellsize();
-        }// else
-		m_pTime->Set_Value(iX1,iY1,m_pTime->asDouble(iX2,iY2) + dDist);        
-
-		for (int i = -1; i<2; i++){
-			for (int j = -1; j<2; j++){
-				if (!(i == 0) || !(j == 0)) {
-					getNextCell(m_pDEM, iX1 + i, iY1 + j, iNextX, iNextY);
-					if (iNextY == iY1 && iNextX == iX1) {
-						writeTimeOut(iX1 + i, iY1 + j, iX1, iY1);
-					}// if				
-				}//if				
-			}//for
-		}//for
-    }// else
-
-}// method
-
-bool CIsochronesConst::On_Execute(void){
-	
+//-----------------------------------------------------
+void CIsochronesConst::_CalculateDistance(int x, int y)
+{
+	CSG_Grid_Stack	Stack;
+
+	Stack.Push(x, y);
+
+	//-----------------------------------------------------
+	while( Stack.Get_Size() > 0 && Process_Get_Okay() )
+	{
+		Stack.Pop(x, y);
+
+		//-------------------------------------------------
+		for(int i=0; i<8; i++)
+		{
+			int	ix	= Get_xFrom(i, x);
+			int	iy	= Get_yFrom(i, y);
+
+			if( m_pDEM->is_InGrid(ix, iy) && i == m_Direction.asInt(ix, iy) )
+			{
+				m_pTime->Set_Value(ix, iy, m_pTime->asDouble(x, y) + Get_Length(i));
+				Stack.Push(ix, iy);
+			}
+		}
+	}
+
+	return;
+}
+
+
+//-----------------------------------------------------
+bool CIsochronesConst::On_Execute(void)
+{	
 	m_pDEM = Parameters("DEM")->asGrid(); 
 	m_pTime = Parameters("TIME")->asGrid();
 	m_pTime->Assign(0.0);
 
-	return true;
+	m_dConcTime = Parameters("TIME_OF_CONCENTRATION")->asDouble();
+
+	m_Direction.Create(*Get_System(), SG_DATATYPE_Char);
+	m_Direction.Set_NoData_Value(-1);
+
+	Init_FlowDirectionsD8(m_pDEM, &m_Direction);
+
+	return( true );
+}
 
-}//method
 
+//-----------------------------------------------------
 bool CIsochronesConst::On_Execute_Finish(void)
 {
+	m_Direction.Destroy();
+
 	return( true );
 }
 
+
+//-----------------------------------------------------
 bool CIsochronesConst::On_Execute_Position(CSG_Point ptWorld, TSG_Module_Interactive_Mode Mode)
 {	
-	int x,y;
 	int iX, iY;		
 	int iHighX, iHighY;
 
@@ -115,39 +135,56 @@ bool CIsochronesConst::On_Execute_Position(CSG_Point ptWorld, TSG_Module_Interac
 
 	m_pTime->Assign(0.0);
 	
-	writeTimeOut(iX, iY, iX, iY);
+	_CalculateDistance(iX, iY);
     
-	double dMax = m_pTime->Get_ZMax();
+	double	dMax = m_pTime->Get_ZMax();
+	bool	bMaxFound = false;
+
+    for(int y=0; y<Get_NY() && Set_Progress(y); y++)
+	{
+		if( bMaxFound )
+			break;
 
-    for(y=0; y<Get_NY() && Set_Progress(y); y++){		
-		for(x=0; x<Get_NX(); x++){
+		#pragma omp parallel for
+		for(int x=0; x<Get_NX(); x++)
+		{
 			double dValue = m_pTime->asDouble(x,y);
-            if (dValue == dMax){
-				iHighX = x;
-				iHighY = y;				
-			}//if
+            
+			if (dValue == dMax)
+			{
+				#pragma omp critical
+				{
+					iHighX = x;
+					iHighY = y;
+					bMaxFound = true;
+				}
+			}
         }// for
     }// for
 	
 	double dMaxDist = m_pTime->Get_ZMax();
-	double dH1 = m_pDEM->asDouble(iX,iY);
-	double dH2 = m_pDEM->asDouble(iHighX,iHighY);
-	double dConcTime = pow(0.87 * pow(dMaxDist / 1000, 3)
-                / (dH2 - dH1),
-                0.385);
-	double dSpeed = dMaxDist / dConcTime;
+	double dH1 = m_pDEM->asDouble(iX, iY);
+	double dH2 = m_pDEM->asDouble(iHighX, iHighY);
+	double dSpeed = dMaxDist / m_dConcTime;
+
+	SG_UI_Msg_Add(SG_T("--------------------------------------------------------------------------------"), true);
+	SG_UI_Msg_Add(CSG_String::Format(_TL("Longest watercourse length: %.2f m"), dMaxDist), true);
+	SG_UI_Msg_Add(CSG_String::Format(_TL("Average slope of watercourse: %.2f m/m"), (dH2 - dH1) / dMaxDist), true);
+	SG_UI_Msg_Add(CSG_String::Format(_TL("Average velocity in watercourse: %.2f m/min"), dSpeed), true);
+	SG_UI_Msg_Add(SG_T("--------------------------------------------------------------------------------"), true);
 	
-	for(y=0; y<Get_NY() && Set_Progress(y); y++){		
-		for(x=0; x<Get_NX(); x++){
-			if (m_pTime->asDouble(x,y)){
-				m_pTime->Set_Value(x,y, m_pTime->asDouble(x,y)/dSpeed);
-			}//if
-		}//for
-	}//for
+	for(int y=0; y<Get_NY() && Set_Progress(y); y++)
+	{
+		#pragma omp parallel for
+		for(int x=0; x<Get_NX(); x++)
+		{
+			m_pTime->Set_Value(x, y, m_pTime->asDouble(x, y) / dSpeed);
+		}
+	}
 
 	m_pTime->Set_NoData_Value(0.0);
 
-	DataObject_Update(m_pTime, true);
+	DataObject_Update(m_pTime, SG_UI_DATAOBJECT_SHOW_LAST_MAP);
 
 	return (true);
 
diff --git a/src/modules/terrain_analysis/ta_hydrology/IsochronesConst.h b/src/modules/terrain_analysis/ta_hydrology/IsochronesConst.h
index a4f297e..64d0053 100644
--- a/src/modules/terrain_analysis/ta_hydrology/IsochronesConst.h
+++ b/src/modules/terrain_analysis/ta_hydrology/IsochronesConst.h
@@ -40,9 +40,11 @@ protected:
 
 private:
 	CSG_Grid *m_pDEM;
-	CSG_Grid *m_pTime;	
-	void writeTimeOut(int,int,int,int);
+	CSG_Grid *m_pTime;
+	CSG_Grid m_Direction;
+	double	m_dConcTime;
 
+	void _CalculateDistance(int x, int y);
 };
 
 #endif // #ifndef HEADER_INCLUDED__IsochronesConst_H
diff --git a/src/modules/terrain_analysis/ta_hydrology/IsochronesVar.cpp b/src/modules/terrain_analysis/ta_hydrology/IsochronesVar.cpp
index e827d00..940f8c0 100644
--- a/src/modules/terrain_analysis/ta_hydrology/IsochronesVar.cpp
+++ b/src/modules/terrain_analysis/ta_hydrology/IsochronesVar.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: IsochronesVar.cpp 911 2011-02-14 16:38:15Z reklov_w $
+ * Version $Id: IsochronesVar.cpp 2492 2015-05-18 12:37:39Z reklov_w $
  *********************************************************/
 /*******************************************************************************
     IsochronesVar.cpp
@@ -27,19 +27,24 @@
 #define max(a,b) (((a) > (b)) ? (a) : (b))
 #endif
 
+
+//-----------------------------------------------------
 CIsochronesVar::CIsochronesVar(void){
 
 	Parameters.Set_Name(_TL("Isochrones Variable Speed"));
+	Set_Author(_TL("V.Olaya (c) 2004, V.Wichmann (c) 2015"));
 	Parameters.Set_Description(_TW(
-		"(c) 2004 by Victor Olaya. C�lculo del tiempo de salida con velocidad variable.\r\n"
-		"References:\r\n"
+		"Calculation of isochrones with variable speed.\n"
+		"In case a cell in an optional input grid is NoData, the corresponding parameter value will "
+		"be used instead of skipping this cell.\n\n"
+		"References:\n"
 		"1. Al-Smadi, Mohammad: Incorporating spatial and temporal variation of "
 		"watershed response in a gis-based hydrologic model. Faculty of the Virginia Polythecnic"
-		"Insitute and State University. MsC Thesis. 1998 \r\n"
-		"Available at scholar.lib.vt.edu/theses/available/ etd-121698-112858/unrestricted/smadi.pdf"
+		"Insitute and State University. MsC Thesis. 1998\n"
+		"Available at scholar.lib.vt.edu/theses/available/etd-121698-112858/unrestricted/smadi.pdf"
 		"2. Mart�nez �lvarez, V.; Dal-R� Tenreiro, R.; Garc�a Garc�a, A. I.; Ayuga T�llez, F. "
-		"Modelaci�n distribuida de la escorrent�a superficial en peque�as cuencas mediante SIG. Evaluaci�n experimental.\r\n "
-		"3. Olaya, V. Hidrologia computacional y modelos digitales del terreno. Alqua. 536 pp. 2004"));
+		"Modelaci�n distribuida de la escorrent�a superficial en peque�as cuencas mediante SIG. Evaluaci�n experimental.\n"
+		"3. Olaya, V. Hidrologia computacional y modelos digitales del terreno. Alqua. 536 pp. 2004\n\n"));
 
 	Parameters.Add_Grid(NULL,
 						"DEM",
@@ -140,135 +145,146 @@ CIsochronesVar::CIsochronesVar(void){
 }//constructor
 
 
+//-----------------------------------------------------
 CIsochronesVar::~CIsochronesVar(void){
 	Execute_Finish();
 }
 
 
-void CIsochronesVar::writeTimeOut(
-        int iX1,
-        int iY1,
-        int iX2,
-        int iY2) {
-
-    double dDist = 1;
-    double dD = 0;
-    double dSlope;
-    double dSpeed;
-    double dQ = 0;
-    double dH;
-    double dSup;
-    double dInf;
-    double dAcc;
-    double dArea = 0;
-    double dPerim;
-    double dDif;
-    double dManning;
-	double dCN;
-    double dI = 0;
-	int iIter;
-	int iNextX, iNextY;
-
-	if (iX1 < 0 || iX1 >= m_pDEM->Get_NX() || iY1 < 0 || iY1 >= m_pDEM->Get_NY()
-            || m_pDEM->asFloat(iX1,iY1) == m_pDEM->Get_NoData_Value()) {
-    }// if
-	else {
-
-		if (m_pCN!=NULL){
-			dCN = m_pCN->asDouble(iX1, iY1);
-			if (dCN == m_pCN->Get_NoData_Value()) {
-                dCN = m_dCN;
-			}// if
-		}//if
-		else{
+//-----------------------------------------------------
+void CIsochronesVar::_CalculateTime(int x, int y)
+{
+	CSG_Grid_Stack	Stack;
+	double	dDist = 1;
+    double	dD = 0;
+    double	dSlope;
+    double	dSpeed;
+    double	dQ = 0;
+    double	dH;
+    double	dSup;
+    double	dInf;
+    double	dAcc;
+    double	dArea = 0;
+    double	dPerim;
+    double	dDif;
+    double	dManning;
+	double	dCN;
+    double	dI = 0;
+	int		iIter = 0;
+	int		iDir;
+
+
+	Stack.Push(x, y);
+
+	//-----------------------------------------------------
+	while( Stack.Get_Size() > 0 && Process_Get_Okay() )
+	{
+		Stack.Pop(x, y);
+
+		if (m_pCN != NULL && !m_pCN->is_NoData(x, y))
+		{
+			dCN = m_pCN->asDouble(x, y);
+		}
+		else
+		{
 			dCN = m_dCN;
-		}//else
+		}
+
 		dI = Runoff(m_dRainfall, dCN);
-		dI /= 3600.0;// in mm/s
-        dI /= 1000.0;// m/s of runoff;
-
-		if (abs(iX1 - iX2 + iY1 - iY2) == 1) {
-            dDist = m_pDEM->Get_Cellsize();
-        }// if
-        else {
-            dDist = 1.44 * m_pDEM->Get_Cellsize();
-        }// else
-		dSlope = m_pSlope->asDouble(iX1,iY1);
+		dI /= 3600.0;	// in mm/s
+        dI /= 1000.0;	// m/s of runoff;
+
+		iDir  = m_Direction.asInt(x, y);
+		dDist = Get_Length(iDir);	// length to previous, i.e. successor cell
+
+		dSlope = m_pSlope->asDouble(x, y);
 		dSlope = fabs(tan(dSlope));
 		dSlope = max(0.001, dSlope);
-		dAcc = m_pCatchArea->asDouble(iX1,iY1);
-        if (dAcc < m_dMixedThresh) {
+
+		dAcc = m_pCatchArea->asDouble(x, y);
+
+        if (dAcc < m_dMixedThresh)
+		{
             dD = sqrt(2.0 * dAcc / 3.14159);
-			if (m_pManning!=NULL){
-				dManning = m_pManning->asDouble(iX1, iY1);
-				if (dManning == m_pManning->Get_NoData_Value()) {
-	                dManning = m_dManning;
-		        }// if
-			}//id
-			else{
+			
+			if (m_pManning != NULL && !m_pManning->is_NoData(x, y))
+			{
+				dManning = m_pManning->asDouble(x, y);
+			}
+			else
+			{
 				dManning = m_dManning;
-			}//else
-            dSpeed = max(m_dMinSpeed, pow(dI * dD, 0.4)
-                    * pow(dSlope, 0.3) / pow(dManning, 0.6));
-        }// if
-        else{
-			if (dAcc < m_dChannelThresh) {
+			}
+
+            dSpeed = max(m_dMinSpeed, pow(dI * dD, 0.4) * pow(dSlope, 0.3) / pow(dManning, 0.6));
+        }
+        else
+		{
+			if (dAcc < m_dChannelThresh)
+			{
 				dManning = 0.06;
-			}//if
-			else{
+			}
+			else
+			{
 				dManning= 0.05;
-			}//if
-            dQ = dI * dAcc; // Q m3/s
-            dSup = 60;
-            dInf = 0;
-            dH = 2;
-            dArea = dH * dH / m_dChannelSlope;
-            dPerim = 2.0 * (dH / m_dChannelSlope + sqrt(dH * dH
-					+ pow(dH / m_dChannelSlope, 2.0)));
-            dDif = (sqrt(dSlope)
-                    * pow(dArea, 5.0 / 3.0)
-                    / pow(dPerim, 2.0 / 3.0) / dManning)
-                    - dQ;
-            iIter = 0;
-			do {
-                if (dDif > 0) {
-                    dSup = dH;
-                    dH = (dInf + dH) / 2.0;
-                }// if
-                else if (dDif < 0) {
-                    dInf = dH;
-                    dH = (dSup + dH) / 2.0;
-                }// else if
-                dArea = dH * dH / m_dChannelSlope;
-                dPerim = 2.0 * (dH / m_dChannelSlope + sqrt(dH * dH
-						+ pow(dH / m_dChannelSlope, 2.0)));
-                dDif = (sqrt(dSlope)
-                        * pow(dArea, 5.0 / 3.0)
-                        / pow(dPerim, 2.0 / 3.0) / dManning)
-                        - dQ;
+			}
+
+            dQ		= dI * dAcc; // Q m3/s
+            dSup	= 60;
+            dInf	= 0;
+            dH		= 2;
+            dArea	= dH * dH / m_dChannelSlope;
+            dPerim	= 2.0 * (dH / m_dChannelSlope + sqrt(dH * dH + pow(dH / m_dChannelSlope, 2.0)));
+            dDif	= (sqrt(dSlope) * pow(dArea, 5.0 / 3.0) / pow(dPerim, 2.0 / 3.0) / dManning) - dQ;
+            iIter	= 0;
+
+			do
+			{
+                if (dDif > 0)
+				{
+                    dSup	= dH;
+                    dH		= (dInf + dH) / 2.0;
+                }
+                else if (dDif < 0)
+				{
+                    dInf	= dH;
+                    dH		= (dSup + dH) / 2.0;
+                }
+
+                dArea	= dH * dH / m_dChannelSlope;
+                dPerim	= 2.0 * (dH / m_dChannelSlope + sqrt(dH * dH + pow(dH / m_dChannelSlope, 2.0)));
+                dDif	= (sqrt(dSlope) * pow(dArea, 5.0 / 3.0) / pow(dPerim, 2.0 / 3.0) / dManning) - dQ;
 				iIter++;
-            }while (fabs(dDif) > 0.1);
+            }
+			while (fabs(dDif) > 0.1);
+
             dSpeed = max(m_dMinSpeed, dQ / dArea);
-        }// else
+        }
 
-		m_pTime->Set_Value(iX1,iY1,m_pTime->asDouble(iX2,iY2) + dDist / dSpeed);
-		m_pSpeed->Set_Value(iX1,iY1, dSpeed);
+		int ix = Get_xTo(iDir, x);
+		int iy = Get_yTo(iDir, y);
 
-		for (int i = -1; i<2; i++){
-			for (int j = -1; j<2; j++){
-				if (!(i == 0) || !(j == 0)) {
-					getNextCell(m_pDEM, iX1 + i, iY1 + j, iNextX, iNextY);
-					if (iNextY == iY1 && iNextX == iX1) {
-						writeTimeOut(iX1 + i, iY1 + j, iX1, iY1);
-					}// if
-				}//if
-			}//for
-		}//for
+		m_pTime->Set_Value(x, y, m_pTime->asDouble(ix, iy) + dDist / dSpeed);
+		m_pSpeed->Set_Value(x, y, dSpeed);
 
-    }// else
+		//-------------------------------------------------
+		for(int i=0; i<8; i++)
+		{
+			ix	= Get_xFrom(i, x);
+			iy	= Get_yFrom(i, y);
 
-}// method
+			if( m_pDEM->is_InGrid(ix, iy) && i == m_Direction.asInt(ix, iy) )
+			{
+				Stack.Push(ix, iy);
+			}
+		}
+	}
+
+	return;
+}
 
+
+//-----------------------------------------------------
 double CIsochronesVar::Runoff(
         double dRainfall,
         double dCN) {
@@ -289,22 +305,32 @@ double CIsochronesVar::Runoff(
 
 }// method
 
+
+//-----------------------------------------------------
 void CIsochronesVar::ZeroToNoData(void){
 
 
-    for(int y=0; y<Get_NY() && Set_Progress(y); y++){
-		for(int x=0; x<Get_NX(); x++){
-            if (m_pTime->asDouble(x,y) == 0){
-				m_pTime->Set_Value(x,y,m_pTime->Get_NoData_Value());
-			}//if
-            if (m_pSpeed->asDouble(x,y) == 0){
-				m_pSpeed->Set_Value(x,y,m_pSpeed->Get_NoData_Value());
-			}//if
+    for(int y=0; y<Get_NY() && Set_Progress(y); y++)
+	{
+		#pragma omp parallel for
+		for(int x=0; x<Get_NX(); x++)
+		{
+            if (m_pTime->asDouble(x, y) == 0)
+			{
+				m_pTime->Set_NoData(x, y);
+			}
+
+            if (m_pSpeed->asDouble(x, y) == 0)
+			{
+				m_pSpeed->Set_NoData(x, y);
+			}
         }// for
     }// for
 
 }//method
 
+
+//-----------------------------------------------------
 bool CIsochronesVar::On_Execute(void){
 
 	m_pDEM = Parameters("DEM")->asGrid();
@@ -322,17 +348,28 @@ bool CIsochronesVar::On_Execute(void){
 	m_dChannelSlope = Parameters("CHANSLOPE")->asDouble();
 	m_dMinSpeed = Parameters("MINSPEED")->asDouble();
 
-	m_pTime->Assign((double)0);
+	m_pTime->Assign(0.0);
 
-	return true;
+	m_Direction.Create(*Get_System(), SG_DATATYPE_Char);
+	m_Direction.Set_NoData_Value(-1);
+
+	Init_FlowDirectionsD8(m_pDEM, &m_Direction);
+
+	return( true );
 
 }//method
 
+
+//-----------------------------------------------------
 bool CIsochronesVar::On_Execute_Finish()
 {
+	m_Direction.Destroy();
+
 	return( true );
 }
 
+
+//-----------------------------------------------------
 bool CIsochronesVar::On_Execute_Position(CSG_Point ptWorld, TSG_Module_Interactive_Mode Mode)
 {
 	int iX, iY;
@@ -342,20 +379,23 @@ bool CIsochronesVar::On_Execute_Position(CSG_Point ptWorld, TSG_Module_Interacti
 		return( false );
 	}
 	
-	m_pTime->Assign((double)0);
+	m_pTime->Assign(0.0);
 
-	writeTimeOut(iX, iY, iX, iY);
+	_CalculateTime(iX, iY);
 
-	for(int y=0; y<Get_NY() && Set_Progress(y); y++){
-		for(int x=0; x<Get_NX(); x++){
-			m_pTime->Set_Value(x,y,m_pTime->asDouble(x,y)/3600.);
-        }// for
-    }// for
+	for(int y=0; y<Get_NY() && Set_Progress(y); y++)
+	{
+		#pragma omp parallel for
+		for(int x=0; x<Get_NX(); x++)
+		{
+			m_pTime->Set_Value(x, y, m_pTime->asDouble(x,y)/3600.0);
+        }
+    }
 
 	ZeroToNoData();
 
-	DataObject_Update(m_pTime, true);
+	DataObject_Update(m_pTime, SG_UI_DATAOBJECT_SHOW_LAST_MAP);
 
-	return (true);
+	return( true );
 
 }//method
diff --git a/src/modules/terrain_analysis/ta_hydrology/IsochronesVar.h b/src/modules/terrain_analysis/ta_hydrology/IsochronesVar.h
index 49d9c5c..e9fd5a8 100644
--- a/src/modules/terrain_analysis/ta_hydrology/IsochronesVar.h
+++ b/src/modules/terrain_analysis/ta_hydrology/IsochronesVar.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: IsochronesVar.h 1246 2011-11-25 13:42:38Z oconrad $
+ * Version $Id: IsochronesVar.h 2492 2015-05-18 12:37:39Z reklov_w $
  *********************************************************/
 /*******************************************************************************
     IsochronesVar.h
@@ -47,6 +47,7 @@ private:
 	CSG_Grid *m_pCN;
 	CSG_Grid *m_pCatchArea;
 	CSG_Grid *m_pSlope;
+	CSG_Grid m_Direction;
 	double m_dManning;
 	double m_dCN;
 	double m_dRainfall;
@@ -54,9 +55,10 @@ private:
 	double m_dChannelThresh;
 	double m_dChannelSlope;
 	double m_dMinSpeed;
-	void writeTimeOut(int,int,int,int);
 	void ZeroToNoData(void);
 	double Runoff(double, double);
 
+	void _CalculateTime(int x, int y);
+
 };
 
diff --git a/src/modules/terrain_analysis/ta_hydrology/Makefile.in b/src/modules/terrain_analysis/ta_hydrology/Makefile.in
index 20e69fc..1b2808d 100644
--- a/src/modules/terrain_analysis/ta_hydrology/Makefile.in
+++ b/src/modules/terrain_analysis/ta_hydrology/Makefile.in
@@ -537,22 +537,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/melton_ruggedness.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/terrain_analysis/ta_hydrology/SAGA_Wetness_Index.cpp b/src/modules/terrain_analysis/ta_hydrology/SAGA_Wetness_Index.cpp
index 1d1a8d4..e83adea 100644
--- a/src/modules/terrain_analysis/ta_hydrology/SAGA_Wetness_Index.cpp
+++ b/src/modules/terrain_analysis/ta_hydrology/SAGA_Wetness_Index.cpp
@@ -92,7 +92,12 @@ CSAGA_Wetness_Index::CSAGA_Wetness_Index(void)
 		"- Boehner, J., Koethe, R. Conrad, O., Gross, J., Ringeler, A., Selige, T. (2002): "
 		"Soil Regionalisation by Means of Terrain Analysis and Process Parameterisation. "
 		"In: Micheli, E., Nachtergaele, F., Montanarella, L. [Ed.]: Soil Classification 2001. "
-		"European Soil Bureau, Research Report No. 7, EUR 20398 EN, Luxembourg. pp.213-222."
+		"European Soil Bureau, Research Report No. 7, EUR 20398 EN, Luxembourg. pp.213-222.\n\n"
+		"- Boehner, J. and Selige, T. (2006): Spatial prediction of soil attributes using "
+		"terrain analysis and climate regionalisation. In: Boehner, J., McCloy, K.R., Strobl, J. "
+		"[Ed.]: SAGA - Analysis and Modelling Applications, Goettinger Geographische Abhandlungen, "
+		"Goettingen: 13-28. "
+		"(<a target=\"_blank\" href=\"http://downloads.sourceforge.net/saga-gis/gga115_02.pdf\">pdf</a>)\n\n"
 	));
 
 
@@ -545,8 +550,8 @@ Float a, wul, wll, wol, woo, wor, wrr, wur, wuu;
 Integer t, h, i, j, gefunden;
 
 a = 0.0174532;
-t = 10; 
-pul.x = -1;	pul.y = -1; 
+t = 10;
+pul.x = -1;	pul.y = -1;
 pu.x = 0;	pu.y = -1;
 pur.x = 1;	pur.y = -1;
 pl.x = -1;	pl.y = 0;
@@ -611,15 +616,15 @@ foreach p in Z do
 {
 if(p.x == 0 && p.y == 0)
 	{
-	if((M[p] - M[p+po]) > 0) 
+	if((M[p] - M[p+po]) > 0)
 	{woo = atan	((M[p] - M[p+po])	/	M.dxy);}
 	else
 	{woo = 0;}
-	if((M[p] - M[p+por]) > 0) 
+	if((M[p] - M[p+por]) > 0)
 	{wor = atan	((M[p] - M[p+por])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wor = 0;}
-	if((M[p] - M[p+pr]) > 0) 
+	if((M[p] - M[p+pr]) > 0)
 	{wrr = atan	((M[p] - M[p+pr])	/	M.dxy);}
 	else
 	{wrr = 0;}
@@ -632,15 +637,15 @@ else
 {
 if(p.x == 0 && p.y == (M.yanz - 1))
 	{
-	if((M[p] - M[p+pr]) > 0) 
+	if((M[p] - M[p+pr]) > 0)
 	{wrr = atan	((M[p] - M[p+pr])	/	M.dxy);}
 	else
 	{wrr = 0;}
-	if((M[p] - M[p+pur]) > 0) 
+	if((M[p] - M[p+pur]) > 0)
 	{wur = atan	((M[p] - M[p+pur])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wur = 0;}
-	if((M[p] - M[p+pu]) > 0) 
+	if((M[p] - M[p+pu]) > 0)
 	{wuu = atan	((M[p] - M[p+pu])	/	M.dxy);}
 	else
 	{wuu = 0;}
@@ -649,19 +654,19 @@ if(p.x == 0 && p.y == (M.yanz - 1))
 	else
 	{Z[p] = wrr + wur + wuu;}
 	}
-else	
+else
 {
 if(p.x == M.xanz - 1 && p.y == M.yanz - 1)
 	{
-	if((M[p] - M[p+pul]) > 0) 
+	if((M[p] - M[p+pul]) > 0)
 	{wul = atan	((M[p] - M[p+pul])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wul = 0;}
-	if((M[p] - M[p+pl]) > 0) 
+	if((M[p] - M[p+pl]) > 0)
 	{wll = atan	((M[p] - M[p+pl])	/	M.dxy);}
 	else
 	{wll = 0;}
-	if((M[p] - M[p+pu]) > 0) 
+	if((M[p] - M[p+pu]) > 0)
 	{wuu = atan	((M[p] - M[p+pu])	/	M.dxy);}
 	else
 	{wuu = 0;}
@@ -670,19 +675,19 @@ if(p.x == M.xanz - 1 && p.y == M.yanz - 1)
 	else
 	{Z[p] = wul + wll + wuu;}
 	}
-else	
+else
 {
 if(p.x == M.xanz - 1 && p.y == 0)
 	{
-	if((M[p] - M[p+pl]) > 0) 
+	if((M[p] - M[p+pl]) > 0)
 	{wll = atan	((M[p] - M[p+pl])	/	M.dxy);}
 	else
 	{wll = 0;}
-	if((M[p] - M[p+pol]) > 0) 
+	if((M[p] - M[p+pol]) > 0)
 	{wol = atan	((M[p] - M[p+pol])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wol = 0;}
-	if((M[p] - M[p+po]) > 0) 
+	if((M[p] - M[p+po]) > 0)
 	{woo = atan	((M[p] - M[p+po])	/	M.dxy);}
 	else
 	{woo = 0;}
@@ -691,27 +696,27 @@ if(p.x == M.xanz - 1 && p.y == 0)
 	else
 	{Z[p] = wll + wol + woo;}
 	}
-else	
+else
 {
 if(p.x == 0)
 	{
-	if((M[p] - M[p+po]) > 0) 
+	if((M[p] - M[p+po]) > 0)
 	{woo = atan	((M[p] - M[p+po])	/	M.dxy);}
 	else
 	{woo = 0;}
-	if((M[p] - M[p+por]) > 0) 
+	if((M[p] - M[p+por]) > 0)
 	{wor = atan	((M[p] - M[p+por])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wor = 0;}
-	if((M[p] - M[p+pr]) > 0) 
+	if((M[p] - M[p+pr]) > 0)
 	{wrr = atan	((M[p] - M[p+pr])	/	M.dxy);}
 	else
 	{wrr = 0;}
-	if((M[p] - M[p+pur]) > 0) 
+	if((M[p] - M[p+pur]) > 0)
 	{wur = atan	((M[p] - M[p+pur])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wur = 0;}
-	if((M[p] - M[p+pu]) > 0) 
+	if((M[p] - M[p+pu]) > 0)
 	{wuu = atan	((M[p] - M[p+pu])	/	M.dxy);}
 	else
 	{wuu = 0;}
@@ -720,27 +725,27 @@ if(p.x == 0)
 	else
 	{Z[p] = woo + wor + wrr + wur + wuu;}
 	}
-else	
+else
 {
 if(p.x == M.xanz - 1)
 	{
-	if((M[p] - M[p+pul]) > 0) 
+	if((M[p] - M[p+pul]) > 0)
 	{wul = atan	((M[p] - M[p+pul])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wul = 0;}
-	if((M[p] - M[p+pl]) > 0) 
+	if((M[p] - M[p+pl]) > 0)
 	{wll = atan	((M[p] - M[p+pl])	/	M.dxy);}
 	else
 	{wll = 0;}
-	if((M[p] - M[p+pol]) > 0) 
+	if((M[p] - M[p+pol]) > 0)
 	{wol = atan	((M[p] - M[p+pol])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wol = 0;}
-	if((M[p] - M[p+po]) > 0) 
+	if((M[p] - M[p+po]) > 0)
 	{woo = atan	((M[p] - M[p+po])	/	M.dxy);}
 	else
 	{woo = 0;}
-	if((M[p] - M[p+pu]) > 0) 
+	if((M[p] - M[p+pu]) > 0)
 	{wuu = atan	((M[p] - M[p+pu])	/	M.dxy);}
 	else
 	{wuu = 0;}
@@ -749,27 +754,27 @@ if(p.x == M.xanz - 1)
 	else
 	{Z[p] = wul + wll + wol + woo + wuu;}
 	}
-else	
+else
 {
 if(p.y == 0)
 	{
-	if((M[p] - M[p+pl]) > 0) 
+	if((M[p] - M[p+pl]) > 0)
 	{wll = atan	((M[p] - M[p+pl])	/	M.dxy);}
 	else
 	{wll = 0;}
-	if((M[p] - M[p+pol]) > 0) 
+	if((M[p] - M[p+pol]) > 0)
 	{wol = atan	((M[p] - M[p+pol])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wol = 0;}
-	if((M[p] - M[p+po]) > 0) 
+	if((M[p] - M[p+po]) > 0)
 	{woo = atan	((M[p] - M[p+po])	/	M.dxy);}
 	else
 	{woo = 0;}
-	if((M[p] - M[p+por]) > 0) 
+	if((M[p] - M[p+por]) > 0)
 	{wor = atan	((M[p] - M[p+por])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wor = 0;}
-	if((M[p] - M[p+pr]) > 0) 
+	if((M[p] - M[p+pr]) > 0)
 	{wrr = atan	((M[p] - M[p+pr])	/	M.dxy);}
 	else
 	{wrr = 0;}
@@ -778,27 +783,27 @@ if(p.y == 0)
 	else
 	{Z[p] = wll + wol + woo + wor + wrr;}
 	}
-else	
+else
 {
 if(p.y == M.yanz - 1)
 	{
-	if((M[p] - M[p+pul]) > 0) 
+	if((M[p] - M[p+pul]) > 0)
 	{wul = atan	((M[p] - M[p+pul])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wul = 0;}
-	if((M[p] - M[p+pl]) > 0) 
+	if((M[p] - M[p+pl]) > 0)
 	{wll = atan	((M[p] - M[p+pl])	/	M.dxy);}
 	else
 	{wll = 0;}
-	if((M[p] - M[p+pr]) > 0) 
+	if((M[p] - M[p+pr]) > 0)
 	{wrr = atan	((M[p] - M[p+pr])	/	M.dxy);}
 	else
 	{wrr = 0;}
-	if((M[p] - M[p+pur]) > 0) 
+	if((M[p] - M[p+pur]) > 0)
 	{wur = atan	((M[p] - M[p+pur])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wur = 0;}
-	if((M[p] - M[p+pu]) > 0) 
+	if((M[p] - M[p+pu]) > 0)
 	{wuu = atan	((M[p] - M[p+pu])	/	M.dxy);}
 	else
 	{wuu = 0;}
@@ -807,37 +812,37 @@ if(p.y == M.yanz - 1)
 	else
 	{Z[p] = wul + wll + wrr + wur + wuu;}
 	}
-else	
-{	
-	if((M[p] - M[p+pul]) > 0) 
+else
+{
+	if((M[p] - M[p+pul]) > 0)
 	{wul = atan	((M[p] - M[p+pul])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wul = 0;}
-	if((M[p] - M[p+pl]) > 0) 
+	if((M[p] - M[p+pl]) > 0)
 	{wll = atan	((M[p] - M[p+pl])	/	M.dxy);}
 	else
 	{wll = 0;}
-	if((M[p] - M[p+pol]) > 0) 
+	if((M[p] - M[p+pol]) > 0)
 	{wol = atan	((M[p] - M[p+pol])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wol = 0;}
-	if((M[p] - M[p+po]) > 0) 
+	if((M[p] - M[p+po]) > 0)
 	{woo = atan	((M[p] - M[p+po])	/	M.dxy);}
 	else
 	{woo = 0;}
-	if((M[p] - M[p+por]) > 0) 
+	if((M[p] - M[p+por]) > 0)
 	{wor = atan	((M[p] - M[p+por])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wor = 0;}
-	if((M[p] - M[p+pr]) > 0) 
+	if((M[p] - M[p+pr]) > 0)
 	{wrr = atan	((M[p] - M[p+pr])	/	M.dxy);}
 	else
 	{wrr = 0;}
-	if((M[p] - M[p+pur]) > 0) 
+	if((M[p] - M[p+pur]) > 0)
 	{wur = atan	((M[p] - M[p+pur])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wur = 0;}
-	if((M[p] - M[p+pu]) > 0) 
+	if((M[p] - M[p+pu]) > 0)
 	{wuu = atan	((M[p] - M[p+pu])	/	M.dxy);}
 	else
 	{wuu = 0;}
@@ -852,7 +857,7 @@ foreach p in UL do
 {	if (p.x == 0 || p.y == 0)
 	{UL[p] = 0;}
 	else	{
-		if((M[p] - M[p+pul]) < 0 && Z[p+pul] > 0) 
+		if((M[p] - M[p+pul]) < 0 && Z[p+pul] > 0)
 		{UL[p] = (atan((M[p+pul] - M[p])/(2 * M.dxy^2)^0.5))/Z[p+pul];}
 		else
 		{UL[p] = 0;}
@@ -862,7 +867,7 @@ foreach p in LL do
 {	if (p.x == 0)
 	{LL[p] = 0;}
 	else	{
-		if((M[p] - M[p+pl]) < 0 && Z[p+pl] > 0) 
+		if((M[p] - M[p+pl]) < 0 && Z[p+pl] > 0)
 		{LL[p] = (atan((M[p+pl] - M[p])/M.dxy))/Z[p+pl];}
 		else
 		{LL[p] = 0;}
@@ -872,7 +877,7 @@ foreach p in OL do
 {	if (p.x == 0 || p.y == M.yanz - 1)
 	{OL[p] = 0;}
 	else	{
-		if((M[p] - M[p+pol]) < 0 && Z[p+pol] > 0) 
+		if((M[p] - M[p+pol]) < 0 && Z[p+pol] > 0)
 		{OL[p] = (atan((M[p+pol] - M[p])/(2 * M.dxy^2)^0.5))/Z[p+pol];}
 		else
 		{OL[p] = 0;}
@@ -882,7 +887,7 @@ foreach p in OO do
 {	if (p.y == M.yanz - 1)
 	{OO[p] = 0;}
 	else	{
-		if((M[p] - M[p+po]) < 0 && Z[p+po] > 0) 
+		if((M[p] - M[p+po]) < 0 && Z[p+po] > 0)
 		{OO[p] = (atan((M[p+po] - M[p])/M.dxy))/Z[p+po];}
 		else
 		{OO[p] = 0;}
@@ -892,7 +897,7 @@ foreach p in OR do
 {	if (p.x == M.xanz - 1 || p.y == M.yanz - 1)
 	{OR[p] = 0;}
 	else	{
-		if((M[p] - M[p+por]) < 0 && Z[p+por] > 0) 
+		if((M[p] - M[p+por]) < 0 && Z[p+por] > 0)
 		{OR[p] = (atan((M[p+por] - M[p])/(2 * M.dxy^2)^0.5))/Z[p+por];}
 		else
 		{OR[p] = 0;}
@@ -902,7 +907,7 @@ foreach p in RR do
 {	if (p.x == M.xanz - 1)
 	{RR[p] = 0;}
 	else	{
-		if((M[p] - M[p+pr]) < 0 && Z[p+pr] > 0) 
+		if((M[p] - M[p+pr]) < 0 && Z[p+pr] > 0)
 		{RR[p] = (atan((M[p+pr] - M[p])/M.dxy))/Z[p+pr];}
 		else
 		{RR[p] = 0;}
@@ -912,7 +917,7 @@ foreach p in UR do
 {	if (p.x == M.xanz - 1 || p.y == 0)
 	{UR[p] = 0;}
 	else	{
-		if((M[p] - M[p+pur]) < 0 && Z[p+pur] > 0) 
+		if((M[p] - M[p+pur]) < 0 && Z[p+pur] > 0)
 		{UR[p] = (atan((M[p+pur] - M[p])/(2 * M.dxy^2)^0.5))/Z[p+pur];}
 		else
 		{UR[p] = 0;}
@@ -922,7 +927,7 @@ foreach p in UU do
 {	if (p.y == 0)
 	{UU[p] = 0;}
 	else	{
-		if((M[p] - M[p+pu]) < 0 && Z[p+pu] > 0) 
+		if((M[p] - M[p+pu]) < 0 && Z[p+pu] > 0)
 		{UU[p] = (atan((M[p+pu] - M[p])/M.dxy))/Z[p+pu];}
 		else
 		{UU[p] = 0;}
@@ -965,17 +970,17 @@ foreach p in CS do
 	{
 	if(X[p] > C[p] || X[p+pul] > C[p+pul] || X[p+pl] > X[p+pl] || X[p+pol] > C[p+pol] || X[p+po] > C[p+po] || X[p+por] > C[p+por] || X[p+pr] > C[p+pr] || X[p+pur] > C[p+pur] || X[p+pu] > C[p+pu])
 	{CS[p] = ln((X[p] + X[p+pul] + X[p+pu] + X[p+pur] + X[p+pl] + X[p+pr] + X[p+pol] + X[p+po] + X[p+por])/9);}
-	else	
+	else
 	{CS[p] = ln(X[p]);}
 	}
 }
-setRandN (CS);	
+setRandN (CS);
 showMatrix(CS);
 // in den folgenden zwei Schritten wird der SAGA Bodenfeuchteindex SB ermittelt. Der a-Parameter muss bei den Settings definiert werden und sorgt dafuer, das nicht durch 0 dividiert wird //
 foreach p in SB do
 {SB[p] = exp(CS[p])/tan(N[p] + a);}
 foreach p in SB do
-{SB[p] = ln(SB[p]);}	
+{SB[p] = ln(SB[p]);}
 showMatrix(SB);
 /**/
 
diff --git a/src/modules/terrain_analysis/ta_hydrology/flow_by_slope.h b/src/modules/terrain_analysis/ta_hydrology/flow_by_slope.h
index b4a25db..b3bee4c 100644
--- a/src/modules/terrain_analysis/ta_hydrology/flow_by_slope.h
+++ b/src/modules/terrain_analysis/ta_hydrology/flow_by_slope.h
@@ -86,7 +86,7 @@ public: ////// public members and functions: //////////////
 
 	CFlow_by_Slope(void);
 
-	virtual CSG_String	Get_MenuPath			(void)	{	return( _TL("R:Catchment Area" ));	}
+	virtual CSG_String	Get_MenuPath			(void)	{	return( _TL("Flow Accumulation" ));	}
 
 
 protected: /// protected members and functions: ///////////
diff --git a/src/modules/terrain_analysis/ta_hydrology/flow_massflux.cpp b/src/modules/terrain_analysis/ta_hydrology/flow_massflux.cpp
index 63b3c5f..7d0a053 100644
--- a/src/modules/terrain_analysis/ta_hydrology/flow_massflux.cpp
+++ b/src/modules/terrain_analysis/ta_hydrology/flow_massflux.cpp
@@ -81,9 +81,9 @@ const int	yDir[4]	= {	1, 0, 0, 1	};
 //---------------------------------------------------------
 CFlow_MassFlux::CFlow_MassFlux(void)
 {
-	Set_Name		(_TL("Catchment Area (Mass-Flux Method)"));
+	Set_Name		(_TL("Flow Accumulation (Mass-Flux Method)"));
 
-	Set_Author		(SG_T("O. Conrad (c) 2009"));
+	Set_Author		("O. Conrad (c) 2009");
 
 	Set_Description	(_TW(
 		"The Mass-Flux Method (MFM) for the DEM based calculation of flow accumulation "
diff --git a/src/modules/terrain_analysis/ta_hydrology/flow_massflux.h b/src/modules/terrain_analysis/ta_hydrology/flow_massflux.h
index d926afe..f47fa0f 100644
--- a/src/modules/terrain_analysis/ta_hydrology/flow_massflux.h
+++ b/src/modules/terrain_analysis/ta_hydrology/flow_massflux.h
@@ -71,7 +71,7 @@ public: ////// public members and functions: //////////////
 
 	CFlow_MassFlux(void);
 
-	virtual CSG_String		Get_MenuPath	(void)	{	return( _TL("R:Catchment Area" ));	}
+	virtual CSG_String		Get_MenuPath	(void)	{	return( _TL("Flow Accumulation" ));	}
 
 
 protected: /// protected members and functions: ///////////
diff --git a/src/modules/terrain_analysis/ta_hydrology/flow_width.h b/src/modules/terrain_analysis/ta_hydrology/flow_width.h
index 632ee5a..ee3b66f 100644
--- a/src/modules/terrain_analysis/ta_hydrology/flow_width.h
+++ b/src/modules/terrain_analysis/ta_hydrology/flow_width.h
@@ -71,7 +71,7 @@ public: ////// public members and functions: //////////////
 
 	CFlow_Width(void);
 
-	virtual CSG_String		Get_MenuPath	(void)	{	return( _TL("R:Catchment Area" ));	}
+	virtual CSG_String		Get_MenuPath	(void)	{	return( _TL("Flow Accumulation" ));	}
 
 
 protected: /// protected members and functions: ///////////
diff --git a/src/modules/terrain_analysis/ta_lighting/Makefile.in b/src/modules/terrain_analysis/ta_lighting/Makefile.in
index b9d42db..7cd0eae 100644
--- a/src/modules/terrain_analysis/ta_lighting/Makefile.in
+++ b/src/modules/terrain_analysis/ta_lighting/Makefile.in
@@ -484,22 +484,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/view_shed.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/terrain_analysis/ta_morphometry/Curvature_UpDownSlope.cpp b/src/modules/terrain_analysis/ta_morphometry/Curvature_UpDownSlope.cpp
new file mode 100644
index 0000000..859b218
--- /dev/null
+++ b/src/modules/terrain_analysis/ta_morphometry/Curvature_UpDownSlope.cpp
@@ -0,0 +1,331 @@
+/**********************************************************
+* Version $Id: Curvature_UpDownSlope.cpp 911 2011-11-11 11:11:11Z oconrad $
+*********************************************************/
+
+///////////////////////////////////////////////////////////
+//                                                       //
+//                         SAGA                          //
+//                                                       //
+//      System for Automated Geoscientific Analyses      //
+//                                                       //
+//                    Module Library:                    //
+//                    ta_morphometry                     //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//                Curvature_UpDownSlope.cpp              //
+//                                                       //
+//                 Copyright (C) 2015 by                 //
+//                    Paolo Gandelli                     //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+// This file is part of 'SAGA - System for Automated     //
+// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
+//                                                       //
+// SAGA is distributed in the hope that it will be       //
+// useful, but WITHOUT ANY WARRANTY; without even the    //
+// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
+// PARTICULAR PURPOSE. See the GNU General Public        //
+// License for more details.                             //
+//                                                       //
+// You should have received a copy of the GNU General    //
+// Public License along with this program; if not,       //
+// write to the Free Software Foundation, Inc.,          //
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307,   //
+// USA.                                                  //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//    e-mail:     gandelli.paolo at gmail.com               //
+//                                                       //
+//    contact:    Paolo Gandelli                         //
+//                Engineering Geology and Geomorphology  //
+//                Department of Earth Sciences           //
+//                University of Firenze                  //
+//                Italy                                  //
+//                                                       //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#include "Curvature_UpDownSlope.h"
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+CCurvature_UpDownSlope::CCurvature_UpDownSlope(void)
+{
+	Set_Name		(_TL("Upslope and Downslope Curvature"));
+
+	Set_Author		("P.Gandelli, O.Conrad (c) 2015");
+
+	Set_Description	(_TW(
+		"Calculates the local curvature of a cell as sum of the gradients to its neighbour cells. "
+		"Upslope curvature is the distance weighted average local curvature in a cell's upslope "
+		"contributing area based on multiple flow direction after Freeman 1994. "
+		"\nReferences:\n"
+		"- Freeman, G.T. (1991): Calculating catchment area with divergent flow based on a regular grid. "
+		"  Computers and Geosciences, 17:413-22\n"
+	));
+
+	Parameters.Add_Grid(NULL, "DEM"         , _TL("Elevation"                ), _TL(""), PARAMETER_INPUT );
+	Parameters.Add_Grid(NULL, "C_LOCAL"     , _TL("Local Curvature"          ), _TL(""), PARAMETER_OUTPUT);
+	Parameters.Add_Grid(NULL, "C_UP"        , _TL("Upslope Curvature"        ), _TL(""), PARAMETER_OUTPUT);
+	Parameters.Add_Grid(NULL, "C_UP_LOCAL"  , _TL("Local Upslope Curvature"  ), _TL(""), PARAMETER_OUTPUT);
+	Parameters.Add_Grid(NULL, "C_DOWN"      , _TL("Downslope Curvature"      ), _TL(""), PARAMETER_OUTPUT);
+	Parameters.Add_Grid(NULL, "C_DOWN_LOCAL", _TL("Local Downslope Curvature"), _TL(""), PARAMETER_OUTPUT);
+
+	Parameters.Add_Value(
+		NULL	, "WEIGHTING"	, _TL("Upslope Weighting"),
+		_TL(""),
+		PARAMETER_TYPE_Double, 0.5, 0.0, true, 1.0, true
+	);
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CCurvature_UpDownSlope::On_Execute(void)
+{
+	m_pDEM			= Parameters("DEM"         )->asGrid();
+	m_pC_Local		= Parameters("C_LOCAL"     )->asGrid();
+	m_pC_Up			= Parameters("C_UP"        )->asGrid();
+	m_pC_Up_Local	= Parameters("C_UP_LOCAL"  )->asGrid();
+	m_pC_Down		= Parameters("C_DOWN"      )->asGrid();
+	m_pC_Down_Local	= Parameters("C_DOWN_LOCAL")->asGrid();
+
+	m_Weighting		= Parameters("WEIGHTING")->asDouble();
+
+	m_pC_Up        ->Assign(0.0);
+	m_pC_Up_Local  ->Assign(0.0);
+	m_pC_Down      ->Assign(0.0);
+	m_pC_Down_Local->Assign(0.0);
+
+	DataObject_Set_Colors(m_pC_Local     , 11, SG_COLORS_RED_GREY_BLUE, true);
+	DataObject_Set_Colors(m_pC_Up        , 11, SG_COLORS_RED_GREY_BLUE, true);
+	DataObject_Set_Colors(m_pC_Up_Local  , 11, SG_COLORS_RED_GREY_BLUE, true);
+	DataObject_Set_Colors(m_pC_Down      , 11, SG_COLORS_RED_GREY_BLUE, true);
+	DataObject_Set_Colors(m_pC_Down_Local, 11, SG_COLORS_RED_GREY_BLUE, true);
+
+	if( !m_Weights.Create(*Get_System()) )
+	{
+		Error_Set(_TL("could not allocate memory for temporary grid."));
+
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	int		x, y;
+
+	for(y=0; y<Get_NY() && Set_Progress(y); y++)
+	{
+		for(x=0; x<Get_NX(); x++)
+		{
+			if( m_pDEM->is_NoData(x, y) )
+			{
+				m_pC_Local     ->Set_NoData(x, y);
+				m_pC_Up        ->Set_NoData(x, y);
+				m_pC_Up_Local  ->Set_NoData(x, y);
+				m_pC_Down      ->Set_NoData(x, y);
+				m_pC_Down_Local->Set_NoData(x, y);
+			}
+			else
+			{
+				m_pC_Local     ->Set_Value(x, y, Get_Local(x, y));
+			}
+		}
+	}
+
+	//-----------------------------------------------------
+	for(sLong i=0; i<Get_NCells() && Set_Progress((double)i, (double)Get_NCells()); i++)
+	{
+		if( m_pDEM->Get_Sorted(i, x, y, true) )
+		{
+			Get_Upslope(x, y);
+		}
+
+		if( m_pDEM->Get_Sorted(i, x, y, false) )
+		{
+			Get_Downslope(x, y);
+		}
+	}
+
+	//-----------------------------------------------------
+	m_Weights.Destroy();
+
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+double CCurvature_UpDownSlope::Get_Local(int x, int y)
+{
+	double	Sum	= 0.0;
+
+	for(int i=0; i<8; i++)
+	{
+		int	ix	= Get_xTo(i, x);
+		int	iy	= Get_yTo(i, y);
+
+		if( m_pDEM->is_InGrid(ix, iy) )
+		{
+			Sum += ((m_pDEM->asDouble(x, y) - m_pDEM->asDouble(ix, iy)) / Get_Length(i));
+		}
+	}
+
+	return( Sum );
+}
+
+//---------------------------------------------------------
+bool CCurvature_UpDownSlope::Get_Upslope(int x, int y)
+{
+	double	cLocal	= m_pC_Local->asDouble(x, y);
+
+	//-----------------------------------------------------
+	double	cUp, cUp_Local, Weights;
+
+	if( (Weights = m_Weights.asDouble(x, y)) > 0.0 )
+	{
+		cUp			= (m_pC_Up->asDouble(x, y) + m_Weighting * cLocal) / (Weights + m_Weighting);
+		cUp_Local	= m_pC_Up_Local->asDouble(x, y) / Weights;
+	}
+	else
+	{
+		cUp			= cLocal;
+		cUp_Local	= cLocal;
+	}
+
+	m_pC_Up      ->Set_Value(x, y, cUp      );
+	m_pC_Up_Local->Set_Value(x, y, cUp_Local);
+
+	//-----------------------------------------------------
+	double Proportion[8];
+
+	if( Get_Flow_Proportions(x, y, Proportion) )
+	{
+		for(int i=0; i<8; i++)
+		{
+			if( Proportion[i] > 0.0 )
+			{
+				int	ix	= Get_xTo(i, x);
+				int	iy	= Get_yTo(i, y);
+
+				m_pC_Up      ->Add_Value(ix, iy, Proportion[i] * cUp);
+				m_pC_Up_Local->Add_Value(ix, iy, Proportion[i] * cLocal);
+				m_Weights     .Add_Value(ix, iy, Proportion[i]);
+			}
+		}
+	}
+
+	return( true );
+}
+
+//---------------------------------------------------------
+bool CCurvature_UpDownSlope::Get_Downslope(int x, int y)
+{
+	//-----------------------------------------------------
+	double	Proportion[8];
+
+	if( Get_Flow_Proportions(x, y, Proportion) )
+	{
+		double	Weights = 0.0, cDown = 0.0, cDown_Local = 0.0;
+
+		for(int i=0; i<8; i++)
+		{
+			if( Proportion[i] > 0.0 )
+			{
+				int	ix	= Get_xTo(i, x);
+				int	iy	= Get_yTo(i, y);
+
+				if( m_pC_Local->is_InGrid(ix, iy) )
+				{
+					cDown_Local	+= Proportion[i] * m_pC_Local->asDouble(ix, iy);
+					cDown		+= Proportion[i] * m_pC_Down ->asDouble(ix, iy);
+					Weights		+= Proportion[i];
+				}
+			}
+		}
+
+		if( Weights > 0.0 )
+		{
+			m_pC_Down_Local->Set_Value(x, y, cDown_Local / Weights);
+			m_pC_Down      ->Set_Value(x, y, (m_Weighting * m_pC_Local->asDouble(x, y) + cDown) / (m_Weighting + Weights));
+		}
+
+		return( true );
+	}
+
+	m_pC_Down_Local->Set_Value(x, y, m_pC_Local->asDouble(x, y));
+	m_pC_Down      ->Set_Value(x, y, m_pC_Local->asDouble(x, y));
+
+	return( false );
+}
+
+//---------------------------------------------------------
+bool CCurvature_UpDownSlope::Get_Flow_Proportions(int x, int y, double Proportion[8])
+{
+	if( m_pDEM->is_InGrid(x, y) )
+	{
+		double Sum = 0.0;
+
+		for(int i=0; i<8; i++)
+		{
+			int	ix	= Get_xTo(i, x);
+			int	iy	= Get_yTo(i, y);
+
+			if( m_pDEM->is_InGrid(ix, iy) && m_pDEM->asDouble(x, y) > m_pDEM->asDouble(ix, iy) )
+			{
+				Sum	+= (Proportion[i]	= ((m_pDEM->asDouble(x, y) - m_pDEM->asDouble(ix, iy)) / Get_Length(i)));
+			}
+			else
+			{
+				Proportion[i]	= 0.0;
+			}
+		}
+
+		if( Sum > 0.0 )
+		{
+			for(int i=0; i<8; i++)
+			{
+				Proportion[i]	/= Sum;
+			}
+
+			return( true );
+		}
+	}
+
+	return( false );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
diff --git a/src/modules/terrain_analysis/ta_channels/Watersheds.h b/src/modules/terrain_analysis/ta_morphometry/Curvature_UpDownSlope.h
similarity index 68%
copy from src/modules/terrain_analysis/ta_channels/Watersheds.h
copy to src/modules/terrain_analysis/ta_morphometry/Curvature_UpDownSlope.h
index c95f36b..c461729 100644
--- a/src/modules/terrain_analysis/ta_channels/Watersheds.h
+++ b/src/modules/terrain_analysis/ta_morphometry/Curvature_UpDownSlope.h
@@ -1,116 +1,119 @@
-/**********************************************************
- * Version $Id: Watersheds.h 1922 2014-01-09 10:28:46Z oconrad $
- *********************************************************/
-
-///////////////////////////////////////////////////////////
-//                                                       //
-//                         SAGA                          //
-//                                                       //
-//      System for Automated Geoscientific Analyses      //
-//                                                       //
-//                    Module Library:                    //
-//                      ta_channels                      //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//                     Watersheds.h                      //
-//                                                       //
-//                 Copyright (C) 2003 by                 //
-//                      Olaf Conrad                      //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-// This file is part of 'SAGA - System for Automated     //
-// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
-//                                                       //
-// SAGA is distributed in the hope that it will be       //
-// useful, but WITHOUT ANY WARRANTY; without even the    //
-// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
-// PARTICULAR PURPOSE. See the GNU General Public        //
-// License for more details.                             //
-//                                                       //
-// You should have received a copy of the GNU General    //
-// Public License along with this program; if not,       //
-// write to the Free Software Foundation, Inc.,          //
-// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
-// USA.                                                  //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//    e-mail:     oconrad at saga-gis.org                   //
-//                                                       //
-//    contact:    Olaf Conrad                            //
-//                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
-//                Germany                                //
-//                                                       //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#ifndef HEADER_INCLUDED__Watersheds_H
-#define HEADER_INCLUDED__Watersheds_H
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#include "MLB_Interface.h"
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-class ta_channels_EXPORT CWatersheds : public CSG_Module_Grid
-{
-public:
-	CWatersheds(void);
-	virtual ~CWatersheds(void);
-
-
-protected:
-
-	virtual bool			On_Execute	(void);
-
-
-private:
-
-	int						m_nBasins;
-
-	CSG_Grid					*m_pBasins, m_Direction;
-
-
-	int						Get_Basin	(int x, int y);
-
-};
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED__Watersheds_H
+/**********************************************************
+* Version $Id: Curvature_UpDownSlope.cpp 911 2011-11-11 11:11:11Z oconrad $
+*********************************************************/
+
+///////////////////////////////////////////////////////////
+//                                                       //
+//                         SAGA                          //
+//                                                       //
+//      System for Automated Geoscientific Analyses      //
+//                                                       //
+//                    Module Library:                    //
+//                    ta_morphometry                     //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//                Curvature_UpDownSlope.h                //
+//                                                       //
+//                 Copyright (C) 2015 by                 //
+//                    Paolo Gandelli                     //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+// This file is part of 'SAGA - System for Automated     //
+// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
+//                                                       //
+// SAGA is distributed in the hope that it will be       //
+// useful, but WITHOUT ANY WARRANTY; without even the    //
+// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
+// PARTICULAR PURPOSE. See the GNU General Public        //
+// License for more details.                             //
+//                                                       //
+// You should have received a copy of the GNU General    //
+// Public License along with this program; if not,       //
+// write to the Free Software Foundation, Inc.,          //
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307,   //
+// USA.                                                  //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//    e-mail:     gandelli.paolo at gmail.com               //
+//                                                       //
+//    contact:    Paolo Gandelli                         //
+//                Engineering Geology and Geomorphology  //
+//                Department of Earth Sciences           //
+//                University of Firenze                  //
+//                Italy                                  //
+//                                                       //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#ifndef HEADER_INCLUDED__Curvature_UpDownSlope_H
+#define HEADER_INCLUDED__Curvature_UpDownSlope_H
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#include "MLB_Interface.h"
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+class CCurvature_UpDownSlope : public CSG_Module_Grid
+{
+public:
+	CCurvature_UpDownSlope(void);
+
+
+protected:
+
+	virtual bool		On_Execute(void);
+
+
+private:
+
+	double				m_Weighting;
+
+	CSG_Grid			*m_pDEM, *m_pC_Local, *m_pC_Up, *m_pC_Up_Local, *m_pC_Down, *m_pC_Down_Local, m_Weights;
+
+
+	double				Get_Local				(int x, int y);
+
+	bool				Get_Upslope				(int x, int y);
+	bool				Get_Downslope			(int x, int y);
+
+	bool				Get_Flow_Proportions	(int x, int y, double Proportion[8]);
+
+};
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#endif // #ifndef HEADER_INCLUDED__Curvature_UpDownSlope_H
diff --git a/src/modules/terrain_analysis/ta_morphometry/MLB_Interface.cpp b/src/modules/terrain_analysis/ta_morphometry/MLB_Interface.cpp
index 91cce7e..16e7da8 100644
--- a/src/modules/terrain_analysis/ta_morphometry/MLB_Interface.cpp
+++ b/src/modules/terrain_analysis/ta_morphometry/MLB_Interface.cpp
@@ -113,22 +113,24 @@ CSG_String Get_Info(int i)
 #include "param_scale.h"
 #include "top_hat.h"
 #include "fuzzy_landform_elements.h"
+#include "Curvature_UpDownSlope.h"
+
 
 //---------------------------------------------------------
 CSG_Module *		Create_Module(int i)
 {
 	switch( i )
 	{
-	case 0:		return( new CMorphometry );
-	case 1:		return( new CConvergence );
-	case 2:		return( new CConvergence_Radius );
-	case 3:		return( new CSurfaceSpecificPoints );
-	case 4:		return( new CCurvature_Classification );
-	case 5:		return( new CHypsometry );
-	case 6:		return( new CRealArea );
-	case 7:		return( new CProtectionIndex );
-	case 8:		return( new CMRVBF );
-	case 9:		return( new CDistance_Gradient );
+	case  0:	return( new CMorphometry );
+	case  1:	return( new CConvergence );
+	case  2:	return( new CConvergence_Radius );
+	case  3:	return( new CSurfaceSpecificPoints );
+	case  4:	return( new CCurvature_Classification );
+	case  5:	return( new CHypsometry );
+	case  6:	return( new CRealArea );
+	case  7:	return( new CProtectionIndex );
+	case  8:	return( new CMRVBF );
+	case  9:	return( new CDistance_Gradient );
 	case 10:	return( new CMass_Balance_Index );
 	case 11:	return( new CAir_Flow_Height );
 	case 12:	return( new CAnisotropic_Heating );
@@ -145,6 +147,10 @@ CSG_Module *		Create_Module(int i)
 	case 23:	return( new CParam_Scale );
 	case 24:	return( new CTop_Hat );
 	case 25:	return( new CFuzzy_Landform_Elements );
+	case 26:	return( new CCurvature_UpDownSlope );
+
+	case 30:	return( NULL );
+	default:	return( MLB_INTERFACE_SKIP_MODULE );
 	}
 
 	return( NULL );
diff --git a/src/modules/terrain_analysis/ta_morphometry/Makefile.am b/src/modules/terrain_analysis/ta_morphometry/Makefile.am
index 766ebac..de16247 100644
--- a/src/modules/terrain_analysis/ta_morphometry/Makefile.am
+++ b/src/modules/terrain_analysis/ta_morphometry/Makefile.am
@@ -16,6 +16,7 @@ libta_morphometry_la_SOURCES =\
 Convergence.cpp\
 Convergence_Radius.cpp\
 Curvature_Classification.cpp\
+Curvature_UpDownSlope.cpp\
 Hypsometry.cpp\
 MLB_Interface.cpp\
 Morphometry.cpp\
@@ -39,6 +40,7 @@ wind_effect.cpp\
 Convergence.h\
 Convergence_Radius.h\
 Curvature_Classification.h\
+Curvature_UpDownSlope.h\
 Hypsometry.h\
 MLB_Interface.h\
 Morphometry.h\
diff --git a/src/modules/terrain_analysis/ta_morphometry/Makefile.in b/src/modules/terrain_analysis/ta_morphometry/Makefile.in
index e09e176..dc3b3ad 100644
--- a/src/modules/terrain_analysis/ta_morphometry/Makefile.in
+++ b/src/modules/terrain_analysis/ta_morphometry/Makefile.in
@@ -128,10 +128,10 @@ LTLIBRARIES = $(pkglib_LTLIBRARIES)
 libta_morphometry_la_DEPENDENCIES =  \
 	$(top_srcdir)/src/saga_core/saga_api/libsaga_api.la
 am_libta_morphometry_la_OBJECTS = Convergence.lo Convergence_Radius.lo \
-	Curvature_Classification.lo Hypsometry.lo MLB_Interface.lo \
-	Morphometry.lo ProtectionIndex.lo RealArea.lo \
-	SurfaceSpecificPoints.lo air_flow_height.lo \
-	anisotropic_heating.lo distance_gradient.lo \
+	Curvature_Classification.lo Curvature_UpDownSlope.lo \
+	Hypsometry.lo MLB_Interface.lo Morphometry.lo \
+	ProtectionIndex.lo RealArea.lo SurfaceSpecificPoints.lo \
+	air_flow_height.lo anisotropic_heating.lo distance_gradient.lo \
 	fuzzy_landform_elements.lo land_surface_temperature.lo \
 	mass_balance_index.lo mrvbf.lo param_scale.lo \
 	relative_heights.lo ruggedness.lo tc_iwahashi_pike.lo \
@@ -382,6 +382,7 @@ libta_morphometry_la_SOURCES = \
 Convergence.cpp\
 Convergence_Radius.cpp\
 Curvature_Classification.cpp\
+Curvature_UpDownSlope.cpp\
 Hypsometry.cpp\
 MLB_Interface.cpp\
 Morphometry.cpp\
@@ -405,6 +406,7 @@ wind_effect.cpp\
 Convergence.h\
 Convergence_Radius.h\
 Curvature_Classification.h\
+Curvature_UpDownSlope.h\
 Hypsometry.h\
 MLB_Interface.h\
 Morphometry.h\
@@ -509,6 +511,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Convergence.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Convergence_Radius.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Curvature_Classification.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Curvature_UpDownSlope.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Hypsometry.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MLB_Interface.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Morphometry.Plo at am__quote@
@@ -531,22 +534,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/wind_effect.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/terrain_analysis/ta_morphometry/param_scale.cpp b/src/modules/terrain_analysis/ta_morphometry/param_scale.cpp
index 756987b..0c86936 100644
--- a/src/modules/terrain_analysis/ta_morphometry/param_scale.cpp
+++ b/src/modules/terrain_analysis/ta_morphometry/param_scale.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: param_scale.cpp 911 2011-11-11 11:11:11Z oconrad $
+ * Version $Id: param_scale.cpp 2435 2015-03-05 17:17:00Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -148,8 +148,8 @@ CParam_Scale::CParam_Scale(void)
 	Parameters.Add_Grid(NULL, "PLANC"    , _TL("Plan Curvature")           , _TL(""), PARAMETER_OUTPUT_OPTIONAL);
 	Parameters.Add_Grid(NULL, "LONGC"    , _TL("Longitudinal Curvature")   , _TL(""), PARAMETER_OUTPUT_OPTIONAL);
 	Parameters.Add_Grid(NULL, "CROSC"    , _TL("Cross-Sectional Curvature"), _TL(""), PARAMETER_OUTPUT_OPTIONAL);
-	Parameters.Add_Grid(NULL, "MINIC"    , _TL("Maximum Curvature")        , _TL(""), PARAMETER_OUTPUT_OPTIONAL);
-	Parameters.Add_Grid(NULL, "MAXIC"    , _TL("Minimum Curvature")        , _TL(""), PARAMETER_OUTPUT_OPTIONAL);
+	Parameters.Add_Grid(NULL, "MAXIC"    , _TL("Maximum Curvature")        , _TL(""), PARAMETER_OUTPUT_OPTIONAL);
+	Parameters.Add_Grid(NULL, "MINIC"    , _TL("Minimum Curvature")        , _TL(""), PARAMETER_OUTPUT_OPTIONAL);
 
 	Parameters.Add_Value(
 		NULL	, "SIZE"		, _TL("Scale Radius (Cells)"),
diff --git a/src/modules/terrain_analysis/ta_morphometry/param_scale.h b/src/modules/terrain_analysis/ta_morphometry/param_scale.h
index cb89a80..b3ff031 100644
--- a/src/modules/terrain_analysis/ta_morphometry/param_scale.h
+++ b/src/modules/terrain_analysis/ta_morphometry/param_scale.h
@@ -1,115 +1,115 @@
-/**********************************************************
- * Version $Id: param_scale.cpp 911 2011-11-11 11:11:11Z oconrad $
- *********************************************************/
-
-///////////////////////////////////////////////////////////
-//                                                       //
-//                         SAGA                          //
-//                                                       //
-//      System for Automated Geoscientific Analyses      //
-//                                                       //
-//                    Module Library:                    //
-//                      morphometry                      //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//                     param_scale.h                     //
-//                                                       //
-//                 Copyright (C) 2013 by                 //
-//                     Olaf Conrad                       //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-// This file is part of 'SAGA - System for Automated     //
-// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
-//                                                       //
-// SAGA is distributed in the hope that it will be       //
-// useful, but WITHOUT ANY WARRANTY; without even the    //
-// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
-// PARTICULAR PURPOSE. See the GNU General Public        //
-// License for more details.                             //
-//                                                       //
-// You should have received a copy of the GNU General    //
-// Public License along with this program; if not,       //
-// write to the Free Software Foundation, Inc.,          //
-// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
-// USA.                                                  //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//    e-mail:     oconrad at saga-gis.de                    //
-//                                                       //
-//    contact:    Olaf Conrad                            //
-//                Institute of Geography                 //
-//                University of Hamburg                  //
-//                Germany                                //
-//                                                       //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#ifndef HEADER_INCLUDED__param_scale_H
-#define HEADER_INCLUDED__param_scale_H
-
-//---------------------------------------------------------
-#include "MLB_Interface.h"
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-class CParam_Scale : public CSG_Module_Grid
-{
-public:
-	CParam_Scale(void);
-
-	virtual CSG_String		Get_MenuPath		(void)	{	return( _TL("A:Terrain Analysis|Terrain Classification" ));	}
-
-
-protected:
-
-	virtual bool			On_Execute		(void);
-
-
-private:
-
-	int						m_Radius;
-
-	CSG_Matrix				m_Weights;
-
-	CSG_Grid				*m_pDEM;
-
-
-	bool					Get_Parameters	(double zScale, double coeff[6], double &elevation, double &slope, double &aspect, double &profc, double &planc, double &longc, double &crosc, double &minic, double &maxic);
-	int						Get_Feature		(double slope, double minic, double maxic, double crosc, double Tol_Slope, double Tol_Curve);
-
-	bool					Get_Weights		(void);
-	bool					Get_Normal		(CSG_Matrix &Normal);
-	bool					Get_Observed	(int x, int y, CSG_Vector &Observed, bool bConstrain);
-
-};
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED__param_scale_H
+/**********************************************************
+ * Version $Id: param_scale.h 2435 2015-03-05 17:17:00Z reklov_w $
+ *********************************************************/
+
+///////////////////////////////////////////////////////////
+//                                                       //
+//                         SAGA                          //
+//                                                       //
+//      System for Automated Geoscientific Analyses      //
+//                                                       //
+//                    Module Library:                    //
+//                      morphometry                      //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//                     param_scale.h                     //
+//                                                       //
+//                 Copyright (C) 2013 by                 //
+//                     Olaf Conrad                       //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+// This file is part of 'SAGA - System for Automated     //
+// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
+//                                                       //
+// SAGA is distributed in the hope that it will be       //
+// useful, but WITHOUT ANY WARRANTY; without even the    //
+// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
+// PARTICULAR PURPOSE. See the GNU General Public        //
+// License for more details.                             //
+//                                                       //
+// You should have received a copy of the GNU General    //
+// Public License along with this program; if not,       //
+// write to the Free Software Foundation, Inc.,          //
+// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
+// USA.                                                  //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//    e-mail:     oconrad at saga-gis.de                    //
+//                                                       //
+//    contact:    Olaf Conrad                            //
+//                Institute of Geography                 //
+//                University of Hamburg                  //
+//                Germany                                //
+//                                                       //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#ifndef HEADER_INCLUDED__param_scale_H
+#define HEADER_INCLUDED__param_scale_H
+
+//---------------------------------------------------------
+#include "MLB_Interface.h"
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+class CParam_Scale : public CSG_Module_Grid
+{
+public:
+	CParam_Scale(void);
+
+	virtual CSG_String		Get_MenuPath		(void)	{	return( _TL("A:Terrain Analysis|Terrain Classification" ));	}
+
+
+protected:
+
+	virtual bool			On_Execute		(void);
+
+
+private:
+
+	int						m_Radius;
+
+	CSG_Matrix				m_Weights;
+
+	CSG_Grid				*m_pDEM;
+
+
+	bool					Get_Parameters	(double zScale, double coeff[6], double &elevation, double &slope, double &aspect, double &profc, double &planc, double &longc, double &crosc, double &minic, double &maxic);
+	int						Get_Feature		(double slope, double minic, double maxic, double crosc, double Tol_Slope, double Tol_Curve);
+
+	bool					Get_Weights		(void);
+	bool					Get_Normal		(CSG_Matrix &Normal);
+	bool					Get_Observed	(int x, int y, CSG_Vector &Observed, bool bConstrain);
+
+};
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#endif // #ifndef HEADER_INCLUDED__param_scale_H
diff --git a/src/modules/terrain_analysis/ta_morphometry/relative_heights.cpp b/src/modules/terrain_analysis/ta_morphometry/relative_heights.cpp
index 8e5082f..9bef515 100644
--- a/src/modules/terrain_analysis/ta_morphometry/relative_heights.cpp
+++ b/src/modules/terrain_analysis/ta_morphometry/relative_heights.cpp
@@ -79,7 +79,14 @@ CRelative_Heights::CRelative_Heights(void)
 	Set_Author		(SG_T("J.Boehner, O.Conrad (c) 2008"));
 
 	Set_Description	(_TW(
-		""
+		"The module allows one to calculate several terrain indices from a digital "
+		"elevation model.\n\n"
+		"General information on the computational concept can be found in:\n"
+		"- Boehner, J. and Selige, T. (2006): Spatial prediction of soil attributes using "
+		"terrain analysis and climate regionalisation. In: Boehner, J., McCloy, K.R., Strobl, J. "
+		"[Ed.]: SAGA - Analysis and Modelling Applications, Goettinger Geographische Abhandlungen, "
+		"Goettingen: 13-28. "
+		"(<a target=\"_blank\" href=\"http://downloads.sourceforge.net/saga-gis/gga115_02.pdf\">pdf</a>)\n\n"
 	));
 
 
@@ -122,19 +129,26 @@ CRelative_Heights::CRelative_Heights(void)
 
 	Parameters.Add_Value(
 		NULL	, "W"			, _TL("w"),
-		_TL(""),
+		_TW("The parameter weights the influence of catchment size on relative elevation "
+			"(inversely proportional)."),
 		PARAMETER_TYPE_Double	,  0.5, 0.0, true
 	);
 
 	Parameters.Add_Value(
 		NULL	, "T"			, _TL("t"),
-		_TL(""),
+		_TW("The parameter controls the amount by which a maximum in the neighbourhood "
+			"of a cell is taken over into the cell (considering the local slope between the cells). "
+			"The smaller 't' and/or the smaller the slope, the more of the maximum value "
+			"is taken over into the cell. This results in a greater generalization/smoothing "
+			"of the result. The greater 't' and/or the higher the slope, the less is taken "
+			"over into the cell and the result will show a more irregular pattern caused "
+			"by small changes in elevation between the cells."),
 		PARAMETER_TYPE_Double	, 10.0, 0.0, true
 	);
 
 	Parameters.Add_Value(
 		NULL	, "E"			, _TL("e"),
-		_TL(""),
+		_TL("The parameter controls the position of relative height maxima as a function of slope."),
 		PARAMETER_TYPE_Double	,  2.0, 0.0, true
 	);
 }
@@ -429,7 +443,7 @@ bool CRelative_Heights::Get_Heights_Modified(CSG_Grid *pDEM, CSG_Grid *pH, doubl
 
 					z	= z / (double)n;
 				}
-				else	
+				else
 				{
 					z	= H.asDouble(x, y);
 				}
@@ -542,9 +556,9 @@ Float w, e, wul, wll, wol, woo, wor, wrr, wur, wuu;
 Integer t, h, i, j, k, l, m, n, o, gefunden;
 
 w = 0.5;
-e = 2; 
-t = 10; 
-pul.x = -1;	pul.y = -1; 
+e = 2;
+t = 10;
+pul.x = -1;	pul.y = -1;
 pu.x = 0;	pu.y = -1;
 pur.x = 1;	pur.y = -1;
 pl.x = -1;	pl.y = 0;
@@ -587,7 +601,7 @@ n = 0;
 o = 0;
 
 // Das gesamte Verfahren besteht aus zwei identischen Schritten zur Bestimmung von H�he �ber Kulmination (HO) und H�he unter Kulmination (HU). F�r HO wird das DGM zun�chst umgedreht //
-foreach p in M do 
+foreach p in M do
 {M[p] = -1 * O[p];}
 // hier wird eine Hilfsmatrix X erzeugt, die in der folgenden Schleife faf�r sorgt, dass noch nicht attributisierte Rasterzellen in Ihrer Position identifiziert werden k�nnen //
 foreach p in X do
@@ -622,15 +636,15 @@ foreach p in Z do
 {
 if(p.x == 0 && p.y == 0)
 	{
-	if((M[p] - M[p+po]) > 0) 
+	if((M[p] - M[p+po]) > 0)
 	{woo = atan	((M[p] - M[p+po])	/	M.dxy);}
 	else
 	{woo = 0;}
-	if((M[p] - M[p+por]) > 0) 
+	if((M[p] - M[p+por]) > 0)
 	{wor = atan	((M[p] - M[p+por])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wor = 0;}
-	if((M[p] - M[p+pr]) > 0) 
+	if((M[p] - M[p+pr]) > 0)
 	{wrr = atan	((M[p] - M[p+pr])	/	M.dxy);}
 	else
 	{wrr = 0;}
@@ -643,15 +657,15 @@ else
 {
 if(p.x == 0 && p.y == (M.yanz - 1))
 	{
-	if((M[p] - M[p+pr]) > 0) 
+	if((M[p] - M[p+pr]) > 0)
 	{wrr = atan	((M[p] - M[p+pr])	/	M.dxy);}
 	else
 	{wrr = 0;}
-	if((M[p] - M[p+pur]) > 0) 
+	if((M[p] - M[p+pur]) > 0)
 	{wur = atan	((M[p] - M[p+pur])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wur = 0;}
-	if((M[p] - M[p+pu]) > 0) 
+	if((M[p] - M[p+pu]) > 0)
 	{wuu = atan	((M[p] - M[p+pu])	/	M.dxy);}
 	else
 	{wuu = 0;}
@@ -660,19 +674,19 @@ if(p.x == 0 && p.y == (M.yanz - 1))
 	else
 	{Z[p] = wrr + wur + wuu;}
 	}
-else	
+else
 {
 if(p.x == M.xanz - 1 && p.y == M.yanz - 1)
 	{
-	if((M[p] - M[p+pul]) > 0) 
+	if((M[p] - M[p+pul]) > 0)
 	{wul = atan	((M[p] - M[p+pul])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wul = 0;}
-	if((M[p] - M[p+pl]) > 0) 
+	if((M[p] - M[p+pl]) > 0)
 	{wll = atan	((M[p] - M[p+pl])	/	M.dxy);}
 	else
 	{wll = 0;}
-	if((M[p] - M[p+pu]) > 0) 
+	if((M[p] - M[p+pu]) > 0)
 	{wuu = atan	((M[p] - M[p+pu])	/	M.dxy);}
 	else
 	{wuu = 0;}
@@ -681,19 +695,19 @@ if(p.x == M.xanz - 1 && p.y == M.yanz - 1)
 	else
 	{Z[p] = wul + wll + wuu;}
 	}
-else	
+else
 {
 if(p.x == M.xanz - 1 && p.y == 0)
 	{
-	if((M[p] - M[p+pl]) > 0) 
+	if((M[p] - M[p+pl]) > 0)
 	{wll = atan	((M[p] - M[p+pl])	/	M.dxy);}
 	else
 	{wll = 0;}
-	if((M[p] - M[p+pol]) > 0) 
+	if((M[p] - M[p+pol]) > 0)
 	{wol = atan	((M[p] - M[p+pol])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wol = 0;}
-	if((M[p] - M[p+po]) > 0) 
+	if((M[p] - M[p+po]) > 0)
 	{woo = atan	((M[p] - M[p+po])	/	M.dxy);}
 	else
 	{woo = 0;}
@@ -702,27 +716,27 @@ if(p.x == M.xanz - 1 && p.y == 0)
 	else
 	{Z[p] = wll + wol + woo;}
 	}
-else	
+else
 {
 if(p.x == 0)
 	{
-	if((M[p] - M[p+po]) > 0) 
+	if((M[p] - M[p+po]) > 0)
 	{woo = atan	((M[p] - M[p+po])	/	M.dxy);}
 	else
 	{woo = 0;}
-	if((M[p] - M[p+por]) > 0) 
+	if((M[p] - M[p+por]) > 0)
 	{wor = atan	((M[p] - M[p+por])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wor = 0;}
-	if((M[p] - M[p+pr]) > 0) 
+	if((M[p] - M[p+pr]) > 0)
 	{wrr = atan	((M[p] - M[p+pr])	/	M.dxy);}
 	else
 	{wrr = 0;}
-	if((M[p] - M[p+pur]) > 0) 
+	if((M[p] - M[p+pur]) > 0)
 	{wur = atan	((M[p] - M[p+pur])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wur = 0;}
-	if((M[p] - M[p+pu]) > 0) 
+	if((M[p] - M[p+pu]) > 0)
 	{wuu = atan	((M[p] - M[p+pu])	/	M.dxy);}
 	else
 	{wuu = 0;}
@@ -731,27 +745,27 @@ if(p.x == 0)
 	else
 	{Z[p] = woo + wor + wrr + wur + wuu;}
 	}
-else	
+else
 {
 if(p.x == M.xanz - 1)
 	{
-	if((M[p] - M[p+pul]) > 0) 
+	if((M[p] - M[p+pul]) > 0)
 	{wul = atan	((M[p] - M[p+pul])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wul = 0;}
-	if((M[p] - M[p+pl]) > 0) 
+	if((M[p] - M[p+pl]) > 0)
 	{wll = atan	((M[p] - M[p+pl])	/	M.dxy);}
 	else
 	{wll = 0;}
-	if((M[p] - M[p+pol]) > 0) 
+	if((M[p] - M[p+pol]) > 0)
 	{wol = atan	((M[p] - M[p+pol])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wol = 0;}
-	if((M[p] - M[p+po]) > 0) 
+	if((M[p] - M[p+po]) > 0)
 	{woo = atan	((M[p] - M[p+po])	/	M.dxy);}
 	else
 	{woo = 0;}
-	if((M[p] - M[p+pu]) > 0) 
+	if((M[p] - M[p+pu]) > 0)
 	{wuu = atan	((M[p] - M[p+pu])	/	M.dxy);}
 	else
 	{wuu = 0;}
@@ -760,27 +774,27 @@ if(p.x == M.xanz - 1)
 	else
 	{Z[p] = wul + wll + wol + woo + wuu;}
 	}
-else	
+else
 {
 if(p.y == 0)
 	{
-	if((M[p] - M[p+pl]) > 0) 
+	if((M[p] - M[p+pl]) > 0)
 	{wll = atan	((M[p] - M[p+pl])	/	M.dxy);}
 	else
 	{wll = 0;}
-	if((M[p] - M[p+pol]) > 0) 
+	if((M[p] - M[p+pol]) > 0)
 	{wol = atan	((M[p] - M[p+pol])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wol = 0;}
-	if((M[p] - M[p+po]) > 0) 
+	if((M[p] - M[p+po]) > 0)
 	{woo = atan	((M[p] - M[p+po])	/	M.dxy);}
 	else
 	{woo = 0;}
-	if((M[p] - M[p+por]) > 0) 
+	if((M[p] - M[p+por]) > 0)
 	{wor = atan	((M[p] - M[p+por])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wor = 0;}
-	if((M[p] - M[p+pr]) > 0) 
+	if((M[p] - M[p+pr]) > 0)
 	{wrr = atan	((M[p] - M[p+pr])	/	M.dxy);}
 	else
 	{wrr = 0;}
@@ -789,27 +803,27 @@ if(p.y == 0)
 	else
 	{Z[p] = wll + wol + woo + wor + wrr;}
 	}
-else	
+else
 {
 if(p.y == M.yanz - 1)
 	{
-	if((M[p] - M[p+pul]) > 0) 
+	if((M[p] - M[p+pul]) > 0)
 	{wul = atan	((M[p] - M[p+pul])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wul = 0;}
-	if((M[p] - M[p+pl]) > 0) 
+	if((M[p] - M[p+pl]) > 0)
 	{wll = atan	((M[p] - M[p+pl])	/	M.dxy);}
 	else
 	{wll = 0;}
-	if((M[p] - M[p+pr]) > 0) 
+	if((M[p] - M[p+pr]) > 0)
 	{wrr = atan	((M[p] - M[p+pr])	/	M.dxy);}
 	else
 	{wrr = 0;}
-	if((M[p] - M[p+pur]) > 0) 
+	if((M[p] - M[p+pur]) > 0)
 	{wur = atan	((M[p] - M[p+pur])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wur = 0;}
-	if((M[p] - M[p+pu]) > 0) 
+	if((M[p] - M[p+pu]) > 0)
 	{wuu = atan	((M[p] - M[p+pu])	/	M.dxy);}
 	else
 	{wuu = 0;}
@@ -818,37 +832,37 @@ if(p.y == M.yanz - 1)
 	else
 	{Z[p] = wul + wll + wrr + wur + wuu;}
 	}
-else	
-{	
-	if((M[p] - M[p+pul]) > 0) 
+else
+{
+	if((M[p] - M[p+pul]) > 0)
 	{wul = atan	((M[p] - M[p+pul])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wul = 0;}
-	if((M[p] - M[p+pl]) > 0) 
+	if((M[p] - M[p+pl]) > 0)
 	{wll = atan	((M[p] - M[p+pl])	/	M.dxy);}
 	else
 	{wll = 0;}
-	if((M[p] - M[p+pol]) > 0) 
+	if((M[p] - M[p+pol]) > 0)
 	{wol = atan	((M[p] - M[p+pol])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wol = 0;}
-	if((M[p] - M[p+po]) > 0) 
+	if((M[p] - M[p+po]) > 0)
 	{woo = atan	((M[p] - M[p+po])	/	M.dxy);}
 	else
 	{woo = 0;}
-	if((M[p] - M[p+por]) > 0) 
+	if((M[p] - M[p+por]) > 0)
 	{wor = atan	((M[p] - M[p+por])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wor = 0;}
-	if((M[p] - M[p+pr]) > 0) 
+	if((M[p] - M[p+pr]) > 0)
 	{wrr = atan	((M[p] - M[p+pr])	/	M.dxy);}
 	else
 	{wrr = 0;}
-	if((M[p] - M[p+pur]) > 0) 
+	if((M[p] - M[p+pur]) > 0)
 	{wur = atan	((M[p] - M[p+pur])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wur = 0;}
-	if((M[p] - M[p+pu]) > 0) 
+	if((M[p] - M[p+pu]) > 0)
 	{wuu = atan	((M[p] - M[p+pu])	/	M.dxy);}
 	else
 	{wuu = 0;}
@@ -863,7 +877,7 @@ foreach p in UL do
 {	if (p.x == 0 || p.y == 0)
 	{UL[p] = 0;}
 	else	{
-		if((M[p] - M[p+pul]) < 0 && Z[p+pul] > 0) 
+		if((M[p] - M[p+pul]) < 0 && Z[p+pul] > 0)
 		{UL[p] = (atan((M[p+pul] - M[p])/(2 * M.dxy^2)^0.5))/Z[p+pul];}
 		else
 		{UL[p] = 0;}
@@ -873,7 +887,7 @@ foreach p in LL do
 {	if (p.x == 0)
 	{LL[p] = 0;}
 	else	{
-		if((M[p] - M[p+pl]) < 0 && Z[p+pl] > 0) 
+		if((M[p] - M[p+pl]) < 0 && Z[p+pl] > 0)
 		{LL[p] = (atan((M[p+pl] - M[p])/M.dxy))/Z[p+pl];}
 		else
 		{LL[p] = 0;}
@@ -883,7 +897,7 @@ foreach p in OL do
 {	if (p.x == 0 || p.y == M.yanz - 1)
 	{OL[p] = 0;}
 	else	{
-		if((M[p] - M[p+pol]) < 0 && Z[p+pol] > 0) 
+		if((M[p] - M[p+pol]) < 0 && Z[p+pol] > 0)
 		{OL[p] = (atan((M[p+pol] - M[p])/(2 * M.dxy^2)^0.5))/Z[p+pol];}
 		else
 		{OL[p] = 0;}
@@ -893,7 +907,7 @@ foreach p in OO do
 {	if (p.y == M.yanz - 1)
 	{OO[p] = 0;}
 	else	{
-		if((M[p] - M[p+po]) < 0 && Z[p+po] > 0) 
+		if((M[p] - M[p+po]) < 0 && Z[p+po] > 0)
 		{OO[p] = (atan((M[p+po] - M[p])/M.dxy))/Z[p+po];}
 		else
 		{OO[p] = 0;}
@@ -903,7 +917,7 @@ foreach p in OR do
 {	if (p.x == M.xanz - 1 || p.y == M.yanz - 1)
 	{OR[p] = 0;}
 	else	{
-		if((M[p] - M[p+por]) < 0 && Z[p+por] > 0) 
+		if((M[p] - M[p+por]) < 0 && Z[p+por] > 0)
 		{OR[p] = (atan((M[p+por] - M[p])/(2 * M.dxy^2)^0.5))/Z[p+por];}
 		else
 		{OR[p] = 0;}
@@ -913,7 +927,7 @@ foreach p in RR do
 {	if (p.x == M.xanz - 1)
 	{RR[p] = 0;}
 	else	{
-		if((M[p] - M[p+pr]) < 0 && Z[p+pr] > 0) 
+		if((M[p] - M[p+pr]) < 0 && Z[p+pr] > 0)
 		{RR[p] = (atan((M[p+pr] - M[p])/M.dxy))/Z[p+pr];}
 		else
 		{RR[p] = 0;}
@@ -923,7 +937,7 @@ foreach p in UR do
 {	if (p.x == M.xanz - 1 || p.y == 0)
 	{UR[p] = 0;}
 	else	{
-		if((M[p] - M[p+pur]) < 0 && Z[p+pur] > 0) 
+		if((M[p] - M[p+pur]) < 0 && Z[p+pur] > 0)
 		{UR[p] = (atan((M[p+pur] - M[p])/(2 * M.dxy^2)^0.5))/Z[p+pur];}
 		else
 		{UR[p] = 0;}
@@ -933,7 +947,7 @@ foreach p in UU do
 {	if (p.y == 0)
 	{UU[p] = 0;}
 	else	{
-		if((M[p] - M[p+pu]) < 0 && Z[p+pu] > 0) 
+		if((M[p] - M[p+pu]) < 0 && Z[p+pu] > 0)
 		{UU[p] = (atan((M[p+pu] - M[p])/M.dxy))/Z[p+pu];}
 		else
 		{UU[p] = 0;}
@@ -1012,11 +1026,11 @@ foreach p in HO do
 	{
 	if(H[p]^e < X[p] || H[p+pul]^e < X[p+pul] || H[p+pl]^e < X[p+pl] || H[p+pol]^e < X[p+pol] || H[p+po]^e < X[p+po] || H[p+por]^e < X[p+por] || H[p+pr]^e < X[p+pr] || H[p+pur]^e < X[p+pur] || H[p+pu]^e < X[p+pu])
 	{HO[p] = ((X[p] + X[p+pul] + X[p+pu] + X[p+pur] + X[p+pl] + X[p+pr] + X[p+pol] + X[p+po] + X[p+por])/9)^(1/e);}
-	else	
+	else
 	{HO[p] = X[p]^(1/e);}
 	}
 }
-setRandN(HO);	
+setRandN(HO);
 foreach p in Z do
 {
 h = 0;
@@ -1027,7 +1041,7 @@ l = 0;
 m = 0;
 }
 // hier wird das DGM nicht umgedreht //
-foreach p in M do 
+foreach p in M do
 {M[p] = O[p];}
 // hier wird eine Hilfsmatrix X erzeugt, die in der folgenden Schleife faf�r sorgt, dass noch nicht attributisierte Rasterzellen in Ihrer Position identifiziert werden k�nnen //
 foreach p in X do
@@ -1062,15 +1076,15 @@ foreach p in Z do
 {
 if(p.x == 0 && p.y == 0)
 	{
-	if((M[p] - M[p+po]) > 0) 
+	if((M[p] - M[p+po]) > 0)
 	{woo = atan	((M[p] - M[p+po])	/	M.dxy);}
 	else
 	{woo = 0;}
-	if((M[p] - M[p+por]) > 0) 
+	if((M[p] - M[p+por]) > 0)
 	{wor = atan	((M[p] - M[p+por])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wor = 0;}
-	if((M[p] - M[p+pr]) > 0) 
+	if((M[p] - M[p+pr]) > 0)
 	{wrr = atan	((M[p] - M[p+pr])	/	M.dxy);}
 	else
 	{wrr = 0;}
@@ -1083,15 +1097,15 @@ else
 {
 if(p.x == 0 && p.y == (M.yanz - 1))
 	{
-	if((M[p] - M[p+pr]) > 0) 
+	if((M[p] - M[p+pr]) > 0)
 	{wrr = atan	((M[p] - M[p+pr])	/	M.dxy);}
 	else
 	{wrr = 0;}
-	if((M[p] - M[p+pur]) > 0) 
+	if((M[p] - M[p+pur]) > 0)
 	{wur = atan	((M[p] - M[p+pur])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wur = 0;}
-	if((M[p] - M[p+pu]) > 0) 
+	if((M[p] - M[p+pu]) > 0)
 	{wuu = atan	((M[p] - M[p+pu])	/	M.dxy);}
 	else
 	{wuu = 0;}
@@ -1100,19 +1114,19 @@ if(p.x == 0 && p.y == (M.yanz - 1))
 	else
 	{Z[p] = wrr + wur + wuu;}
 	}
-else	
+else
 {
 if(p.x == M.xanz - 1 && p.y == M.yanz - 1)
 	{
-	if((M[p] - M[p+pul]) > 0) 
+	if((M[p] - M[p+pul]) > 0)
 	{wul = atan	((M[p] - M[p+pul])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wul = 0;}
-	if((M[p] - M[p+pl]) > 0) 
+	if((M[p] - M[p+pl]) > 0)
 	{wll = atan	((M[p] - M[p+pl])	/	M.dxy);}
 	else
 	{wll = 0;}
-	if((M[p] - M[p+pu]) > 0) 
+	if((M[p] - M[p+pu]) > 0)
 	{wuu = atan	((M[p] - M[p+pu])	/	M.dxy);}
 	else
 	{wuu = 0;}
@@ -1121,19 +1135,19 @@ if(p.x == M.xanz - 1 && p.y == M.yanz - 1)
 	else
 	{Z[p] = wul + wll + wuu;}
 	}
-else	
+else
 {
 if(p.x == M.xanz - 1 && p.y == 0)
 	{
-	if((M[p] - M[p+pl]) > 0) 
+	if((M[p] - M[p+pl]) > 0)
 	{wll = atan	((M[p] - M[p+pl])	/	M.dxy);}
 	else
 	{wll = 0;}
-	if((M[p] - M[p+pol]) > 0) 
+	if((M[p] - M[p+pol]) > 0)
 	{wol = atan	((M[p] - M[p+pol])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wol = 0;}
-	if((M[p] - M[p+po]) > 0) 
+	if((M[p] - M[p+po]) > 0)
 	{woo = atan	((M[p] - M[p+po])	/	M.dxy);}
 	else
 	{woo = 0;}
@@ -1142,27 +1156,27 @@ if(p.x == M.xanz - 1 && p.y == 0)
 	else
 	{Z[p] = wll + wol + woo;}
 	}
-else	
+else
 {
 if(p.x == 0)
 	{
-	if((M[p] - M[p+po]) > 0) 
+	if((M[p] - M[p+po]) > 0)
 	{woo = atan	((M[p] - M[p+po])	/	M.dxy);}
 	else
 	{woo = 0;}
-	if((M[p] - M[p+por]) > 0) 
+	if((M[p] - M[p+por]) > 0)
 	{wor = atan	((M[p] - M[p+por])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wor = 0;}
-	if((M[p] - M[p+pr]) > 0) 
+	if((M[p] - M[p+pr]) > 0)
 	{wrr = atan	((M[p] - M[p+pr])	/	M.dxy);}
 	else
 	{wrr = 0;}
-	if((M[p] - M[p+pur]) > 0) 
+	if((M[p] - M[p+pur]) > 0)
 	{wur = atan	((M[p] - M[p+pur])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wur = 0;}
-	if((M[p] - M[p+pu]) > 0) 
+	if((M[p] - M[p+pu]) > 0)
 	{wuu = atan	((M[p] - M[p+pu])	/	M.dxy);}
 	else
 	{wuu = 0;}
@@ -1171,27 +1185,27 @@ if(p.x == 0)
 	else
 	{Z[p] = woo + wor + wrr + wur + wuu;}
 	}
-else	
+else
 {
 if(p.x == M.xanz - 1)
 	{
-	if((M[p] - M[p+pul]) > 0) 
+	if((M[p] - M[p+pul]) > 0)
 	{wul = atan	((M[p] - M[p+pul])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wul = 0;}
-	if((M[p] - M[p+pl]) > 0) 
+	if((M[p] - M[p+pl]) > 0)
 	{wll = atan	((M[p] - M[p+pl])	/	M.dxy);}
 	else
 	{wll = 0;}
-	if((M[p] - M[p+pol]) > 0) 
+	if((M[p] - M[p+pol]) > 0)
 	{wol = atan	((M[p] - M[p+pol])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wol = 0;}
-	if((M[p] - M[p+po]) > 0) 
+	if((M[p] - M[p+po]) > 0)
 	{woo = atan	((M[p] - M[p+po])	/	M.dxy);}
 	else
 	{woo = 0;}
-	if((M[p] - M[p+pu]) > 0) 
+	if((M[p] - M[p+pu]) > 0)
 	{wuu = atan	((M[p] - M[p+pu])	/	M.dxy);}
 	else
 	{wuu = 0;}
@@ -1200,27 +1214,27 @@ if(p.x == M.xanz - 1)
 	else
 	{Z[p] = wul + wll + wol + woo + wuu;}
 	}
-else	
+else
 {
 if(p.y == 0)
 	{
-	if((M[p] - M[p+pl]) > 0) 
+	if((M[p] - M[p+pl]) > 0)
 	{wll = atan	((M[p] - M[p+pl])	/	M.dxy);}
 	else
 	{wll = 0;}
-	if((M[p] - M[p+pol]) > 0) 
+	if((M[p] - M[p+pol]) > 0)
 	{wol = atan	((M[p] - M[p+pol])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wol = 0;}
-	if((M[p] - M[p+po]) > 0) 
+	if((M[p] - M[p+po]) > 0)
 	{woo = atan	((M[p] - M[p+po])	/	M.dxy);}
 	else
 	{woo = 0;}
-	if((M[p] - M[p+por]) > 0) 
+	if((M[p] - M[p+por]) > 0)
 	{wor = atan	((M[p] - M[p+por])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wor = 0;}
-	if((M[p] - M[p+pr]) > 0) 
+	if((M[p] - M[p+pr]) > 0)
 	{wrr = atan	((M[p] - M[p+pr])	/	M.dxy);}
 	else
 	{wrr = 0;}
@@ -1229,27 +1243,27 @@ if(p.y == 0)
 	else
 	{Z[p] = wll + wol + woo + wor + wrr;}
 	}
-else	
+else
 {
 if(p.y == M.yanz - 1)
 	{
-	if((M[p] - M[p+pul]) > 0) 
+	if((M[p] - M[p+pul]) > 0)
 	{wul = atan	((M[p] - M[p+pul])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wul = 0;}
-	if((M[p] - M[p+pl]) > 0) 
+	if((M[p] - M[p+pl]) > 0)
 	{wll = atan	((M[p] - M[p+pl])	/	M.dxy);}
 	else
 	{wll = 0;}
-	if((M[p] - M[p+pr]) > 0) 
+	if((M[p] - M[p+pr]) > 0)
 	{wrr = atan	((M[p] - M[p+pr])	/	M.dxy);}
 	else
 	{wrr = 0;}
-	if((M[p] - M[p+pur]) > 0) 
+	if((M[p] - M[p+pur]) > 0)
 	{wur = atan	((M[p] - M[p+pur])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wur = 0;}
-	if((M[p] - M[p+pu]) > 0) 
+	if((M[p] - M[p+pu]) > 0)
 	{wuu = atan	((M[p] - M[p+pu])	/	M.dxy);}
 	else
 	{wuu = 0;}
@@ -1258,37 +1272,37 @@ if(p.y == M.yanz - 1)
 	else
 	{Z[p] = wul + wll + wrr + wur + wuu;}
 	}
-else	
-{	
-	if((M[p] - M[p+pul]) > 0) 
+else
+{
+	if((M[p] - M[p+pul]) > 0)
 	{wul = atan	((M[p] - M[p+pul])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wul = 0;}
-	if((M[p] - M[p+pl]) > 0) 
+	if((M[p] - M[p+pl]) > 0)
 	{wll = atan	((M[p] - M[p+pl])	/	M.dxy);}
 	else
 	{wll = 0;}
-	if((M[p] - M[p+pol]) > 0) 
+	if((M[p] - M[p+pol]) > 0)
 	{wol = atan	((M[p] - M[p+pol])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wol = 0;}
-	if((M[p] - M[p+po]) > 0) 
+	if((M[p] - M[p+po]) > 0)
 	{woo = atan	((M[p] - M[p+po])	/	M.dxy);}
 	else
 	{woo = 0;}
-	if((M[p] - M[p+por]) > 0) 
+	if((M[p] - M[p+por]) > 0)
 	{wor = atan	((M[p] - M[p+por])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wor = 0;}
-	if((M[p] - M[p+pr]) > 0) 
+	if((M[p] - M[p+pr]) > 0)
 	{wrr = atan	((M[p] - M[p+pr])	/	M.dxy);}
 	else
 	{wrr = 0;}
-	if((M[p] - M[p+pur]) > 0) 
+	if((M[p] - M[p+pur]) > 0)
 	{wur = atan	((M[p] - M[p+pur])	/	(2 * M.dxy^2)^0.5);}
 	else
 	{wur = 0;}
-	if((M[p] - M[p+pu]) > 0) 
+	if((M[p] - M[p+pu]) > 0)
 	{wuu = atan	((M[p] - M[p+pu])	/	M.dxy);}
 	else
 	{wuu = 0;}
@@ -1303,7 +1317,7 @@ foreach p in UL do
 {	if (p.x == 0 || p.y == 0)
 	{UL[p] = 0;}
 	else	{
-		if((M[p] - M[p+pul]) < 0 && Z[p+pul] > 0) 
+		if((M[p] - M[p+pul]) < 0 && Z[p+pul] > 0)
 		{UL[p] = (atan((M[p+pul] - M[p])/(2 * M.dxy^2)^0.5))/Z[p+pul];}
 		else
 		{UL[p] = 0;}
@@ -1313,7 +1327,7 @@ foreach p in LL do
 {	if (p.x == 0)
 	{LL[p] = 0;}
 	else	{
-		if((M[p] - M[p+pl]) < 0 && Z[p+pl] > 0) 
+		if((M[p] - M[p+pl]) < 0 && Z[p+pl] > 0)
 		{LL[p] = (atan((M[p+pl] - M[p])/M.dxy))/Z[p+pl];}
 		else
 		{LL[p] = 0;}
@@ -1323,7 +1337,7 @@ foreach p in OL do
 {	if (p.x == 0 || p.y == M.yanz - 1)
 	{OL[p] = 0;}
 	else	{
-		if((M[p] - M[p+pol]) < 0 && Z[p+pol] > 0) 
+		if((M[p] - M[p+pol]) < 0 && Z[p+pol] > 0)
 		{OL[p] = (atan((M[p+pol] - M[p])/(2 * M.dxy^2)^0.5))/Z[p+pol];}
 		else
 		{OL[p] = 0;}
@@ -1333,7 +1347,7 @@ foreach p in OO do
 {	if (p.y == M.yanz - 1)
 	{OO[p] = 0;}
 	else	{
-		if((M[p] - M[p+po]) < 0 && Z[p+po] > 0) 
+		if((M[p] - M[p+po]) < 0 && Z[p+po] > 0)
 		{OO[p] = (atan((M[p+po] - M[p])/M.dxy))/Z[p+po];}
 		else
 		{OO[p] = 0;}
@@ -1343,7 +1357,7 @@ foreach p in OR do
 {	if (p.x == M.xanz - 1 || p.y == M.yanz - 1)
 	{OR[p] = 0;}
 	else	{
-		if((M[p] - M[p+por]) < 0 && Z[p+por] > 0) 
+		if((M[p] - M[p+por]) < 0 && Z[p+por] > 0)
 		{OR[p] = (atan((M[p+por] - M[p])/(2 * M.dxy^2)^0.5))/Z[p+por];}
 		else
 		{OR[p] = 0;}
@@ -1353,7 +1367,7 @@ foreach p in RR do
 {	if (p.x == M.xanz - 1)
 	{RR[p] = 0;}
 	else	{
-		if((M[p] - M[p+pr]) < 0 && Z[p+pr] > 0) 
+		if((M[p] - M[p+pr]) < 0 && Z[p+pr] > 0)
 		{RR[p] = (atan((M[p+pr] - M[p])/M.dxy))/Z[p+pr];}
 		else
 		{RR[p] = 0;}
@@ -1363,7 +1377,7 @@ foreach p in UR do
 {	if (p.x == M.xanz - 1 || p.y == 0)
 	{UR[p] = 0;}
 	else	{
-		if((M[p] - M[p+pur]) < 0 && Z[p+pur] > 0) 
+		if((M[p] - M[p+pur]) < 0 && Z[p+pur] > 0)
 		{UR[p] = (atan((M[p+pur] - M[p])/(2 * M.dxy^2)^0.5))/Z[p+pur];}
 		else
 		{UR[p] = 0;}
@@ -1373,7 +1387,7 @@ foreach p in UU do
 {	if (p.y == 0)
 	{UU[p] = 0;}
 	else	{
-		if((M[p] - M[p+pu]) < 0 && Z[p+pu] > 0) 
+		if((M[p] - M[p+pu]) < 0 && Z[p+pu] > 0)
 		{UU[p] = (atan((M[p+pu] - M[p])/M.dxy))/Z[p+pu];}
 		else
 		{UU[p] = 0;}
@@ -1452,7 +1466,7 @@ foreach p in HU do
 	{
 	if(H[p]^e < X[p] || H[p+pul]^e < X[p+pul] || H[p+pl]^e < X[p+pl] || H[p+pol]^e < X[p+pol] || H[p+po]^e < X[p+po] || H[p+por]^e < X[p+por] || H[p+pr]^e < X[p+pr] || H[p+pur]^e < X[p+pur] || H[p+pu]^e < X[p+pu])
 	{HU[p] = (((X[p] + X[p+pul] + X[p+pu] + X[p+pur] + X[p+pl] + X[p+pr] + X[p+pol] + X[p+po] + X[p+por])/9)^(1/e));}
-	else	
+	else
 	{HU[p] = (X[p]^(1/e));}
 	}
 }
diff --git a/src/modules/terrain_analysis/ta_preprocessor/Makefile.in b/src/modules/terrain_analysis/ta_preprocessor/Makefile.in
index 035cc52..f97a724 100644
--- a/src/modules/terrain_analysis/ta_preprocessor/Makefile.in
+++ b/src/modules/terrain_analysis/ta_preprocessor/Makefile.in
@@ -479,22 +479,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/burn_in_streams.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/terrain_analysis/ta_preprocessor/Pit_Eliminator.cpp b/src/modules/terrain_analysis/ta_preprocessor/Pit_Eliminator.cpp
index 3334f7b..9e0a0a8 100644
--- a/src/modules/terrain_analysis/ta_preprocessor/Pit_Eliminator.cpp
+++ b/src/modules/terrain_analysis/ta_preprocessor/Pit_Eliminator.cpp
@@ -117,7 +117,8 @@ CPit_Eliminator::CPit_Eliminator(void)
 
 	Parameters.Add_Value(
 		NULL	, "THRSHEIGHT"	, _TL("Threshold Height"),
-		_TL(""),
+		_TW("The parameter describes the maximum depth of a sink to be considered for removal [map units]. "
+			"This allows to exclude deeper sinks from filling."),
 		PARAMETER_TYPE_Double	, 100
 	);
 }
diff --git a/src/modules/terrain_analysis/ta_profiles/Makefile.in b/src/modules/terrain_analysis/ta_profiles/Makefile.in
index 3d087f4..fdc2d73 100644
--- a/src/modules/terrain_analysis/ta_profiles/Makefile.in
+++ b/src/modules/terrain_analysis/ta_profiles/Makefile.in
@@ -478,22 +478,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MLB_Interface.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/terrain_analysis/ta_slope_stability/Makefile.in b/src/modules/terrain_analysis/ta_slope_stability/Makefile.in
index 625368e..45467e3 100644
--- a/src/modules/terrain_analysis/ta_slope_stability/Makefile.in
+++ b/src/modules/terrain_analysis/ta_slope_stability/Makefile.in
@@ -478,22 +478,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/WETNESS_01.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/tin/tin_tools/Makefile.in b/src/modules/tin/tin_tools/Makefile.in
index 0be4905..67c088a 100644
--- a/src/modules/tin/tin_tools/Makefile.in
+++ b/src/modules/tin/tin_tools/Makefile.in
@@ -481,22 +481,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/TIN_To_Shapes.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/modules/tin/tin_viewer/Makefile.in b/src/modules/tin/tin_viewer/Makefile.in
index 4924691..8d45528 100644
--- a/src/modules/tin/tin_viewer/Makefile.in
+++ b/src/modules/tin/tin_viewer/Makefile.in
@@ -467,22 +467,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tin_view_module.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/saga_core/saga_api/Makefile.am b/src/saga_core/saga_api/Makefile.am
index 8468c17..6aeffa5 100644
--- a/src/saga_core/saga_api/Makefile.am
+++ b/src/saga_core/saga_api/Makefile.am
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.am 2214 2014-09-01 15:47:38Z oconrad $
+# $Id: Makefile.am 2370 2015-01-16 14:14:52Z oconrad $
 #
 if DEBUG
 DBGFLAGS = -g -DDEBUG
@@ -64,6 +64,7 @@ mat_indexing.cpp\
 mat_matrix.cpp\
 mat_regression.cpp\
 mat_regression_multiple.cpp\
+mat_regression_weighted.cpp\
 mat_mRMR.cpp\
 mat_spline.cpp\
 mat_tools.cpp\
diff --git a/src/saga_core/saga_api/Makefile.in b/src/saga_core/saga_api/Makefile.in
index bad9673..ff7d9e4 100644
--- a/src/saga_core/saga_api/Makefile.in
+++ b/src/saga_core/saga_api/Makefile.in
@@ -148,13 +148,13 @@ am_libsaga_api_la_OBJECTS = api_callback.lo api_colors.lo api_core.lo \
 	grid_operation.lo grid_pyramid.lo grid_system.lo \
 	mat_formula.lo mat_grid_radius.lo mat_indexing.lo \
 	mat_matrix.lo mat_regression.lo mat_regression_multiple.lo \
-	mat_mRMR.lo mat_spline.lo mat_tools.lo mat_trend.lo \
-	metadata.lo module.lo module_chain.lo module_grid.lo \
-	module_grid_interactive.lo module_interactive.lo \
-	module_interactive_base.lo module_library.lo \
-	module_library_interface.lo parameter.lo parameter_data.lo \
-	parameters.lo pointcloud.lo projections.lo quadtree.lo \
-	saga_api.lo shape.lo shape_line.lo shape_part.lo \
+	mat_regression_weighted.lo mat_mRMR.lo mat_spline.lo \
+	mat_tools.lo mat_trend.lo metadata.lo module.lo \
+	module_chain.lo module_grid.lo module_grid_interactive.lo \
+	module_interactive.lo module_interactive_base.lo \
+	module_library.lo module_library_interface.lo parameter.lo \
+	parameter_data.lo parameters.lo pointcloud.lo projections.lo \
+	quadtree.lo saga_api.lo shape.lo shape_line.lo shape_part.lo \
 	shape_point.lo shape_points.lo shape_polygon.lo shapes.lo \
 	shapes_io.lo shapes_ogis.lo shapes_polygons.lo \
 	shapes_search.lo shapes_selection.lo table.lo table_dbase.lo \
@@ -398,7 +398,7 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
 #
-# $Id: Makefile.am 2214 2014-09-01 15:47:38Z oconrad $
+# $Id: Makefile.am 2370 2015-01-16 14:14:52Z oconrad $
 #
 @DEBUG_TRUE at DBGFLAGS = -g -DDEBUG
 @SAGA_PYTHON_TRUE at SAGAPYTHONFLAGS = -D_SAGA_PYTHON
@@ -454,6 +454,7 @@ mat_indexing.cpp\
 mat_matrix.cpp\
 mat_regression.cpp\
 mat_regression_multiple.cpp\
+mat_regression_weighted.cpp\
 mat_mRMR.cpp\
 mat_spline.cpp\
 mat_tools.cpp\
@@ -666,6 +667,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mat_matrix.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mat_regression.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mat_regression_multiple.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mat_regression_weighted.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mat_spline.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mat_tools.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mat_trend.Plo at am__quote@
@@ -707,22 +709,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tin_triangulation.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
@@ -735,22 +740,25 @@ _saga_api_la-saga_api_wrap.lo: saga_api_wrap.cxx
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_saga_api_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o _saga_api_la-saga_api_wrap.lo `test -f 'saga_api_wrap.cxx' || echo '$(srcdir)/'`saga_api_wrap.cxx
 
 .cxx.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cxx.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cxx.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/saga_core/saga_api/api_callback.cpp b/src/saga_core/saga_api/api_callback.cpp
index e080f96..70a0d1a 100644
--- a/src/saga_core/saga_api/api_callback.cpp
+++ b/src/saga_core/saga_api/api_callback.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: api_callback.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: api_callback.cpp 2428 2015-02-26 17:14:47Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -291,11 +291,14 @@ void		SG_UI_Dlg_Message(const CSG_String &Message, const CSG_String &Caption)
 //---------------------------------------------------------
 bool		SG_UI_Dlg_Continue(const CSG_String &Message, const CSG_String &Caption)
 {
-	if( gSG_UI_Callback )
+	if( gSG_UI_Progress_Lock == 0 )
 	{
-		CSG_UI_Parameter	p1(Message), p2(Caption);
+		if( gSG_UI_Callback )
+		{
+			CSG_UI_Parameter	p1(Message), p2(Caption);
 
-		return( gSG_UI_Callback(CALLBACK_DLG_CONTINUE, p1, p2) != 0 );
+			return( gSG_UI_Callback(CALLBACK_DLG_CONTINUE, p1, p2) != 0 );
+		}
 	}
 
 	return( true );
@@ -304,6 +307,14 @@ bool		SG_UI_Dlg_Continue(const CSG_String &Message, const CSG_String &Caption)
 //---------------------------------------------------------
 int			SG_UI_Dlg_Error(const CSG_String &Message, const CSG_String &Caption)
 {
+	if( gSG_UI_Progress_Lock != 0 )
+	{
+		SG_UI_Msg_Add_Error(Caption);
+		SG_UI_Msg_Add_Error(Message);
+
+		return( 0 );
+	}
+
 	if( gSG_UI_Callback )
 	{
 		CSG_UI_Parameter	p1(Message), p2(Caption);
@@ -385,9 +396,6 @@ void		SG_UI_Msg_Add(const CSG_String &Message, bool bNewLine, TSG_UI_MSG_STYLE S
 //---------------------------------------------------------
 void		SG_UI_Msg_Add_Error(const CSG_String &Message)
 {
-	if( gSG_UI_Msg_Lock )
-		return;
-
 	if( gSG_UI_Callback )
 	{
 		CSG_UI_Parameter	p1(Message), p2;
diff --git a/src/saga_core/saga_api/api_core.h b/src/saga_core/saga_api/api_core.h
index 485c446..f88398c 100644
--- a/src/saga_core/saga_api/api_core.h
+++ b/src/saga_core/saga_api/api_core.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: api_core.h 2252 2014-09-25 15:59:01Z oconrad $
+ * Version $Id: api_core.h 2497 2015-06-02 14:30:08Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -201,7 +201,8 @@ SAGA_API_DLL_EXPORT void *			SG_Calloc			(size_t num, size_t size);
 SAGA_API_DLL_EXPORT void *			SG_Realloc			(void *memblock, size_t size);
 SAGA_API_DLL_EXPORT void			SG_Free				(void *memblock);
 
-#define SG_FREE_SAFE(PTR)			{ if( PTR ) { SG_Free(PTR); PTR = NULL; } }
+#define SG_FREE_SAFE(PTR)			{ if( PTR ) { SG_Free (PTR); PTR = NULL; } }
+#define SG_DELETE_ARRAY(PTR)		{ if( PTR ) { delete[](PTR); PTR = NULL; } }
 
 //---------------------------------------------------------
 SAGA_API_DLL_EXPORT void			SG_Swap_Bytes		(void *Buffer, int nBytes);
@@ -916,13 +917,13 @@ public:
 	bool							is_Open				(void)	const	{	return( m_pStream != NULL );	}
 	bool							is_EOF				(void)	const;
 
-	long							Length				(void)	const;
+	sLong							Length				(void)	const;
 
-	bool							Seek				(long Offset, int Origin = SG_FILE_START)	const;
+	bool							Seek				(sLong Offset, int Origin = SG_FILE_START)	const;
 	bool							Seek_Start			(void)	const;
 	bool							Seek_End			(void)	const;
 
-	long							Tell				(void)	const;
+	sLong							Tell				(void)	const;
 
 	bool							Flush				(void)	const;
 
diff --git a/src/saga_core/saga_api/api_file.cpp b/src/saga_core/saga_api/api_file.cpp
index c6e78dd..2d71599 100644
--- a/src/saga_core/saga_api/api_file.cpp
+++ b/src/saga_core/saga_api/api_file.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: api_file.cpp 2259 2014-09-29 15:01:52Z oconrad $
+ * Version $Id: api_file.cpp 2497 2015-06-02 14:30:08Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -68,6 +68,15 @@
 
 #include "api_core.h"
 
+#if defined(_SAGA_VC)
+	#define SG_FILE_TELL	_ftelli64
+	#define SG_FILE_SEEK	_fseeki64
+	#define SG_FILE_SIZE	__int64
+#else
+	#define SG_FILE_TELL	ftell
+	#define SG_FILE_SEEK	fseek
+	#define SG_FILE_SIZE	long
+#endif
 
 ///////////////////////////////////////////////////////////
 //														 //
@@ -165,16 +174,12 @@ bool CSG_File::Close(void)
 }
 
 //---------------------------------------------------------
-long CSG_File::Length(void)	const
+sLong CSG_File::Length(void)	const
 {
 	if( m_pStream )
 	{
-		long	pos, len;
-
-		pos	= ftell(m_pStream);
-		fseek(m_pStream, 0, SEEK_END);
-		len	= ftell(m_pStream);
-		fseek(m_pStream, pos, SEEK_SET);
+		SG_FILE_SIZE	pos	= SG_FILE_TELL(m_pStream);	SG_FILE_SEEK(m_pStream,   0, SEEK_END);
+		SG_FILE_SIZE	len	= SG_FILE_TELL(m_pStream);	SG_FILE_SEEK(m_pStream, pos, SEEK_SET);
 
 		return( len );
 	}
@@ -189,7 +194,7 @@ bool CSG_File::is_EOF(void)	const
 }
 
 //---------------------------------------------------------
-bool CSG_File::Seek(long Offset, int Origin) const
+bool CSG_File::Seek(sLong Offset, int Origin) const
 {
 	switch( Origin )
 	{
@@ -199,25 +204,25 @@ bool CSG_File::Seek(long Offset, int Origin) const
 	case SG_FILE_END:		Origin	= SEEK_END;	break;
 	}
 
-	return( m_pStream ? !fseek(m_pStream, Offset, Origin) : false );
+	return( m_pStream ? !SG_FILE_SEEK(m_pStream, Offset, Origin) : false );
 }
 
 //---------------------------------------------------------
 bool CSG_File::Seek_Start(void) const
 {
-	return( m_pStream && fseek(m_pStream, 0, SEEK_SET) == 0 );
+	return( m_pStream && SG_FILE_SEEK(m_pStream, 0, SEEK_SET) == 0 );
 }
 
 //---------------------------------------------------------
 bool CSG_File::Seek_End(void) const
 {
-	return( m_pStream && fseek(m_pStream, 0, SEEK_END) == 0 );
+	return( m_pStream && SG_FILE_SEEK(m_pStream, 0, SEEK_END) == 0 );
 }
 
 //---------------------------------------------------------
-long CSG_File::Tell(void) const
+sLong CSG_File::Tell(void) const
 {
-	return( m_pStream ? ftell(m_pStream) : -1 );
+	return( m_pStream ? SG_FILE_TELL(m_pStream) : -1 );
 }
 
 //---------------------------------------------------------
diff --git a/src/saga_core/saga_api/geo_tools.h b/src/saga_core/saga_api/geo_tools.h
index 8fb5995..82682fb 100644
--- a/src/saga_core/saga_api/geo_tools.h
+++ b/src/saga_core/saga_api/geo_tools.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: geo_tools.h 2190 2014-08-12 14:26:06Z oconrad $
+ * Version $Id: geo_tools.h 2380 2015-01-29 16:51:02Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -464,8 +464,11 @@ public:
 	double						Get_XRange		(void) const	{	return( m_rect.xMax - m_rect.xMin );	}
 	double						Get_YRange		(void) const	{	return( m_rect.yMax - m_rect.yMin );	}
 
-	CSG_Point					Get_TopLeft		(void)			{	return( CSG_Point(m_rect.xMin, m_rect.yMax) );	}
-	CSG_Point					Get_BottomRight	(void)			{	return( CSG_Point(m_rect.xMax, m_rect.yMin) );	}
+	double						Get_Area		(void) const	{	return( Get_XRange() * Get_YRange() );	}
+	double						Get_Diameter	(void) const	{	return( sqrt(Get_XRange()*Get_XRange() + Get_YRange()*Get_YRange()) );	}
+
+	CSG_Point					Get_TopLeft		(void) const	{	return( CSG_Point(m_rect.xMin, m_rect.yMax) );	}
+	CSG_Point					Get_BottomRight	(void) const	{	return( CSG_Point(m_rect.xMax, m_rect.yMin) );	}
 
 	CSG_Point					Get_Center		(void) const	{	return( CSG_Point(Get_XCenter(), Get_YCenter()) );	}
 	double						Get_XCenter		(void) const	{	return( (m_rect.xMin + m_rect.xMax) / 2.0 );	}
diff --git a/src/saga_core/saga_api/grid.cpp b/src/saga_core/saga_api/grid.cpp
index 31743c8..5380f1f 100644
--- a/src/saga_core/saga_api/grid.cpp
+++ b/src/saga_core/saga_api/grid.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: grid.cpp 2248 2014-09-23 16:26:33Z oconrad $
+ * Version $Id: grid.cpp 2466 2015-04-15 13:57:31Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -818,9 +818,10 @@ inline double CSG_Grid::_Get_ValAtPos_BSpline(int x, int y, double dx, double dy
 //---------------------------------------------------------
 inline bool CSG_Grid::_Get_ValAtPos_Fill4x4Submatrix(int x, int y, double z_xy[4][4]) const
 {
-	int		ix, iy, jx, jy, nNoData;
+	int		ix, iy, jx, jy, nNoData	= 0;
 
-	for(iy=0, jy=y-1, nNoData=0; iy<4; iy++, jy++)
+	//-----------------------------------------------------
+	for(iy=0, jy=y-1; iy<4; iy++, jy++)
 	{
 		for(ix=0, jx=x-1; ix<4; ix++, jx++)
 		{
@@ -838,32 +839,22 @@ inline bool CSG_Grid::_Get_ValAtPos_Fill4x4Submatrix(int x, int y, double z_xy[4
 	}
 
 	//-----------------------------------------------------
-	if( nNoData >= 16 )
-	{
-		return( false );
-	}
-
-	if( nNoData > 0 )
+	if( nNoData > 0 && nNoData < 16 )	// guess missing values as average of surrounding data values
 	{
-		double	t_xy[4][4];
-
-		for(iy=0; iy<4; iy++)
+		for(int i=0; nNoData>0 && i<16; i++)	// avoid the possibility of endless loop
 		{
-			for(ix=0; ix<4; ix++)
-			{
-				t_xy[ix][iy]	= z_xy[ix][iy];
-			}
-		}
+			double	t_xy[4][4];
 
-		do
-		{
 			for(iy=0; iy<4; iy++)
 			{
 				for(ix=0; ix<4; ix++)
 				{
+					t_xy[ix][iy]	= z_xy[ix][iy];
+
 					if( is_NoData_Value(z_xy[ix][iy]) )
 					{
 						int		n	= 0;
+						double	s	= 0.0;
 
 						for(jy=iy-1; jy<=iy+1; jy++)
 						{
@@ -871,18 +862,10 @@ inline bool CSG_Grid::_Get_ValAtPos_Fill4x4Submatrix(int x, int y, double z_xy[4
 							{
 								for(jx=ix-1; jx<=ix+1; jx++)
 								{
-									if( jx >= 0 && jx < 4 && !(jx == ix && jy == iy) && !is_NoData_Value(z_xy[jx][jy]) )
+									if( jx >= 0 && jx < 4 && !is_NoData_Value(z_xy[jx][jy]) )
 									{
-										if( n == 0 )
-										{
-											t_xy[ix][iy]	 = z_xy[jx][jy];
-										}
-										else
-										{
-											t_xy[ix][iy]	+= z_xy[jx][jy];
-										}
-
-										n++;
+										s	+= z_xy[jx][jy];
+										n	++;
 									}
 								}
 							}
@@ -890,10 +873,7 @@ inline bool CSG_Grid::_Get_ValAtPos_Fill4x4Submatrix(int x, int y, double z_xy[4
 
 						if( n > 0 )
 						{
-							if( n > 1 )
-							{
-								t_xy[ix][iy]	/= n;
-							}
+							t_xy[ix][iy]	= s / n;
 
 							nNoData--;
 						}
@@ -905,25 +885,23 @@ inline bool CSG_Grid::_Get_ValAtPos_Fill4x4Submatrix(int x, int y, double z_xy[4
 			{
 				for(ix=0; ix<4; ix++)
 				{
-					if( t_xy[ix][iy] != z_xy[ix][iy] )
-					{
-						z_xy[ix][iy]	= t_xy[ix][iy];
-					}
+					z_xy[ix][iy]	= t_xy[ix][iy];
 				}
 			}
 		}
-		while( nNoData > 0 );
 	}
 
-	return( true );
+	//-----------------------------------------------------
+	return( nNoData == 0 );
 }
 
 //---------------------------------------------------------
 inline bool CSG_Grid::_Get_ValAtPos_Fill4x4Submatrix(int x, int y, double z_xy[4][4][4]) const
 {
-	int		ix, iy, jx, jy, nNoData;
+	int		ix, iy, jx, jy, nNoData	= 0;
 
-	for(iy=0, jy=y-1, nNoData=0; iy<4; iy++, jy++)
+	//-----------------------------------------------------
+	for(iy=0, jy=y-1; iy<4; iy++, jy++)
 	{
 		for(ix=0, jx=x-1; ix<4; ix++, jx++)
 		{
@@ -946,35 +924,25 @@ inline bool CSG_Grid::_Get_ValAtPos_Fill4x4Submatrix(int x, int y, double z_xy[4
 	}
 
 	//-----------------------------------------------------
-	if( nNoData >= 16 )
-	{
-		return( false );
-	}
-
-	if( nNoData > 0 )
+	if( nNoData > 0 && nNoData < 16 )	// guess missing values as average of surrounding data values
 	{
-		double	t_xy[4][4][4];
-
-		for(iy=0; iy<4; iy++)
+		for(int i=0; nNoData>0 && i<16; i++)	// avoid the possibility of endless loop
 		{
-			for(ix=0; ix<4; ix++)
-			{
-				t_xy[0][ix][iy]	= z_xy[0][ix][iy];
-				t_xy[1][ix][iy]	= z_xy[1][ix][iy];
-				t_xy[2][ix][iy]	= z_xy[2][ix][iy];
-				t_xy[3][ix][iy]	= z_xy[3][ix][iy];
-			}
-		}
+			double	t_xy[4][4][4];
 
-		do
-		{
 			for(iy=0; iy<4; iy++)
 			{
 				for(ix=0; ix<4; ix++)
 				{
+					t_xy[0][ix][iy]	 = z_xy[0][ix][iy];
+					t_xy[1][ix][iy]	 = z_xy[1][ix][iy];
+					t_xy[2][ix][iy]	 = z_xy[2][ix][iy];
+					t_xy[3][ix][iy]	 = z_xy[3][ix][iy];
+
 					if( is_NoData_Value(z_xy[0][ix][iy]) )
 					{
 						int		n	= 0;
+						double	s[4]; s[0] = s[1] = s[2] = s[3] = 0;
 
 						for(jy=iy-1; jy<=iy+1; jy++)
 						{
@@ -982,24 +950,13 @@ inline bool CSG_Grid::_Get_ValAtPos_Fill4x4Submatrix(int x, int y, double z_xy[4
 							{
 								for(jx=ix-1; jx<=ix+1; jx++)
 								{
-									if( jx >= 0 && jx < 4 && !(jx == ix && jy == iy) && !is_NoData_Value(z_xy[0][jx][jy]) )
+									if( jx >= 0 && jx < 4 && !is_NoData_Value(z_xy[0][jx][jy]) )
 									{
-										if( n == 0 )
-										{
-											t_xy[0][ix][iy]	 = z_xy[0][jx][jy];
-											t_xy[1][ix][iy]	 = z_xy[1][jx][jy];
-											t_xy[2][ix][iy]	 = z_xy[2][jx][jy];
-											t_xy[3][ix][iy]	 = z_xy[3][jx][jy];
-										}
-										else
-										{
-											t_xy[0][ix][iy]	+= z_xy[0][jx][jy];
-											t_xy[1][ix][iy]	+= z_xy[1][jx][jy];
-											t_xy[2][ix][iy]	+= z_xy[2][jx][jy];
-											t_xy[3][ix][iy]	+= z_xy[3][jx][jy];
-										}
-
-										n++;
+										s[0]	+= z_xy[0][jx][jy];
+										s[1]	+= z_xy[1][jx][jy];
+										s[2]	+= z_xy[2][jx][jy];
+										s[3]	+= z_xy[3][jx][jy];
+										n		++;
 									}
 								}
 							}
@@ -1007,13 +964,10 @@ inline bool CSG_Grid::_Get_ValAtPos_Fill4x4Submatrix(int x, int y, double z_xy[4
 
 						if( n > 0 )
 						{
-							if( n > 1 )
-							{
-								t_xy[0][ix][iy]	/= n;
-								t_xy[1][ix][iy]	/= n;
-								t_xy[2][ix][iy]	/= n;
-								t_xy[3][ix][iy]	/= n;
-							}
+							t_xy[0][ix][iy]	= s[0] / n;
+							t_xy[1][ix][iy]	= s[1] / n;
+							t_xy[2][ix][iy]	= s[2] / n;
+							t_xy[3][ix][iy]	= s[3] / n;
 
 							nNoData--;
 						}
@@ -1025,20 +979,17 @@ inline bool CSG_Grid::_Get_ValAtPos_Fill4x4Submatrix(int x, int y, double z_xy[4
 			{
 				for(ix=0; ix<4; ix++)
 				{
-					if( t_xy[0][ix][iy] != z_xy[0][ix][iy] )
-					{
-						z_xy[0][ix][iy]	= t_xy[0][ix][iy];
-						z_xy[1][ix][iy]	= t_xy[1][ix][iy];
-						z_xy[2][ix][iy]	= t_xy[2][ix][iy];
-						z_xy[3][ix][iy]	= t_xy[3][ix][iy];
-					}
+					z_xy[0][ix][iy]	= t_xy[0][ix][iy];
+					z_xy[1][ix][iy]	= t_xy[1][ix][iy];
+					z_xy[2][ix][iy]	= t_xy[2][ix][iy];
+					z_xy[3][ix][iy]	= t_xy[3][ix][iy];
 				}
 			}
 		}
-		while( nNoData > 0 );
 	}
 
-	return( true );
+	//-----------------------------------------------------
+	return( nNoData == 0 );
 }
 
 
diff --git a/src/saga_core/saga_api/grid.h b/src/saga_core/saga_api/grid.h
index bc81348..b82d98e 100644
--- a/src/saga_core/saga_api/grid.h
+++ b/src/saga_core/saga_api/grid.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: grid.h 2242 2014-09-22 13:27:38Z oconrad $
+ * Version $Id: grid.h 2399 2015-02-05 16:07:16Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -573,17 +573,17 @@ public:		///////////////////////////////////////////////
 
 	bool						Get_Sorted		(sLong Position, sLong &n, bool bDown = true, bool bCheckNoData = true)
 	{
-		return( (n = Get_Sorted(Position, bDown, bCheckNoData)) >= 0 );
+		return( (n = Get_Sorted(Position, bDown, false)) >= 0 && (!bCheckNoData || !is_NoData(n)) );
 	}
 
 	bool						Get_Sorted		(sLong Position, int &x, int &y, bool bDown = true, bool bCheckNoData = true)
 	{
-		if( (Position = Get_Sorted(Position, bDown, bCheckNoData)) >= 0 )
+		if( (Position = Get_Sorted(Position, bDown, false)) >= 0 )
 		{
 			x	= (int)(Position % Get_NX());
 			y	= (int)(Position / Get_NX());
 
-			return( true );
+			return( !bCheckNoData || !is_NoData(x, y) );
 		}
 
 		return( false );
@@ -879,6 +879,10 @@ private:	///////////////////////////////////////////////
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
+#define SG_GRID_PTR_SAFE_SET_NODATA(g, x, y)	{ if( g && g->is_InGrid(x, y, false) ) { g->Set_NoData(x, y   ); } }
+#define SG_GRID_PTR_SAFE_SET_VALUE(g, x, y, z)	{ if( g && g->is_InGrid(x, y, false) ) { g->Set_Value (x, y, z); } }
+
+//---------------------------------------------------------
 /** Safe grid construction */
 SAGA_API_DLL_EXPORT CSG_Grid *		SG_Create_Grid		(void);
 
diff --git a/src/saga_core/saga_api/grid_system.cpp b/src/saga_core/saga_api/grid_system.cpp
index ca192cf..b442794 100644
--- a/src/saga_core/saga_api/grid_system.cpp
+++ b/src/saga_core/saga_api/grid_system.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: grid_system.cpp 2064 2014-03-21 13:20:57Z oconrad $
+ * Version $Id: grid_system.cpp 2494 2015-05-21 14:09:38Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -72,42 +72,35 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
+#define GRID_SYSTEM_PRECISION 10000000000	// 10 decimal digits, precision used for storing cellsize and extent
+
+//---------------------------------------------------------
 CSG_Grid_System::CSG_Grid_System(void)
 {
-	m_Cellsize		= -1.0;
-
-	m_NX	= m_NY	= 0;
+	Assign(0.0, 0.0, 0.0, 0, 0);
 }
 
 //---------------------------------------------------------
 CSG_Grid_System::CSG_Grid_System(const CSG_Grid_System &System)
 {
-	m_Cellsize	= -1.0;
-
 	Assign(System);
 }
 
 //---------------------------------------------------------
 CSG_Grid_System::CSG_Grid_System(double Cellsize, const CSG_Rect &Extent)
 {
-	m_Cellsize	= -1.0;
-
 	Assign(Cellsize, Extent);
 }
 
 //---------------------------------------------------------
 CSG_Grid_System::CSG_Grid_System(double Cellsize, double xMin, double yMin, double xMax, double yMax)
 {
-	m_Cellsize	= -1.0;
-
 	Assign(Cellsize, xMin, yMin, xMax, yMax);
 }
 
 //---------------------------------------------------------
 CSG_Grid_System::CSG_Grid_System(double Cellsize, double xMin, double yMin, int NX, int NY)
 {
-	m_Cellsize	= -1.0;
-
 	Assign(Cellsize, xMin, yMin, NX, NY);
 }
 
@@ -137,25 +130,18 @@ const SG_Char * CSG_Grid_System::Get_Name(bool bShort)
 		if( bShort )
 		{
 			m_Name.Printf(SG_T("%.*f; %dx %dy; %.*fx %.*fy"),
-				SG_Get_Significant_Decimals(Get_Cellsize()),
-				Get_Cellsize(),
-				Get_NX(),
-				Get_NY(),
-				SG_Get_Significant_Decimals(Get_XMin()), Get_XMin(),
-				SG_Get_Significant_Decimals(Get_YMin()), Get_YMin()
+				SG_Get_Significant_Decimals(Get_Cellsize()), Get_Cellsize(),
+				Get_NX(), Get_NY(),
+				SG_Get_Significant_Decimals(Get_XMin    ()), Get_XMin    (),
+				SG_Get_Significant_Decimals(Get_YMin    ()), Get_YMin    ()
 			);
 		}
 		else
 		{
 			m_Name.Printf(SG_T("%s: %f, %s: %dx/%dy, %s: %fx/%fy"),
-				_TL("Cell size"),
-				Get_Cellsize(),
-				_TL("Number of cells"),
-				Get_NX(),
-				Get_NY(),
-				_TL("Lower left corner"),
-				Get_XMin(),
-				Get_YMin()
+				_TL("Cell size"        ), Get_Cellsize(),
+				_TL("Number of cells"  ), Get_NX(), Get_NY(),
+				_TL("Lower left corner"), Get_XMin(), Get_YMin()
 			);
 		}
 	}
@@ -196,24 +182,38 @@ void CSG_Grid_System::operator = (const CSG_Grid_System &System)
 //---------------------------------------------------------
 bool CSG_Grid_System::Assign(const CSG_Grid_System &System)
 {
-	return( Assign(System.m_Cellsize, System.m_Extent) );
+	m_NX			= System.m_NX;
+	m_NY			= System.m_NY;
+	m_NCells		= System.m_NCells;
+
+	m_Cellsize		= System.m_Cellsize;
+	m_Cellarea		= System.m_Cellarea;
+	m_Diagonal		= System.m_Diagonal;
+
+	m_Extent		= System.m_Extent;
+	m_Extent_Cells	= System.m_Extent_Cells;
+
+	return( is_Valid() );
 }
 
 //---------------------------------------------------------
 bool CSG_Grid_System::Assign(double Cellsize, const CSG_Rect &Extent)
 {
-	return( Assign(Cellsize, Extent.m_rect.xMin, Extent.m_rect.yMin, Extent.m_rect.xMax, Extent.m_rect.yMax) );
+	if( Cellsize > 0.0 && Extent.Get_XRange() >= 0.0 && Extent.Get_YRange() >= 0.0 )
+	{
+		return( Assign(Cellsize, Extent.Get_XMin(), Extent.Get_YMin(),
+			1 + (int)(0.5 + Extent.Get_XRange() / Cellsize),
+			1 + (int)(0.5 + Extent.Get_YRange() / Cellsize))
+		);
+	}
+
+	return( Assign(0.0, 0.0, 0.0, 0, 0) );
 }
 
 //---------------------------------------------------------
 bool CSG_Grid_System::Assign(double Cellsize, double xMin, double yMin, double xMax, double yMax)
 {
-	if( Cellsize > 0.0 && xMin < xMax && yMin < yMax )
-	{
-		return( Assign(Cellsize, xMin, yMin, 1 + (int)(0.5 + (xMax - xMin) / Cellsize), 1 + (int)(0.5 + (yMax - yMin) / Cellsize)) );
-	}
-
-	return( Assign(0.0, 0.0, 0.0, 0, 0) );
+	return( Assign(Cellsize, CSG_Rect(xMin, yMin, xMax, yMax)) );
 }
 
 //---------------------------------------------------------
@@ -221,39 +221,41 @@ bool CSG_Grid_System::Assign(double Cellsize, double xMin, double yMin, int NX,
 {
 	if( Cellsize > 0.0 && NX > 0 && NY > 0 )
 	{
-		m_NX		= NX;
-		m_NY		= NY;
-		m_NCells	= (sLong)NY * NX;
-
-		m_Cellsize	= Cellsize;
-		m_Cellarea	= Cellsize * Cellsize;
-
-		m_Extent		.Assign(
-			xMin,
-			yMin,
-			xMin + (NX - 1.0) * Cellsize,
-			yMin + (NY - 1.0) * Cellsize
-		);
+		Cellsize	= (sLong)(Cellsize * GRID_SYSTEM_PRECISION) / (double)GRID_SYSTEM_PRECISION;
+		xMin		= (sLong)(xMin     * GRID_SYSTEM_PRECISION) / (double)GRID_SYSTEM_PRECISION;
+		yMin		= (sLong)(yMin     * GRID_SYSTEM_PRECISION) / (double)GRID_SYSTEM_PRECISION;
 
-		m_Extent_Cells	.Assign(
-			xMin - 0.5 * Cellsize,
-			yMin - 0.5 * Cellsize,
-			xMin + (NX - 0.5) * Cellsize,
-			yMin + (NY - 0.5) * Cellsize
-		);
+		if( Cellsize > 0.0 )
+		{
+			m_NX		= NX;
+			m_NY		= NY;
+			m_NCells	= (sLong)NY * NX;
 
-		m_Diagonal	= Cellsize * sqrt(2.0);
+			m_Cellsize	= Cellsize;
+			m_Cellarea	= Cellsize * Cellsize;
+			m_Diagonal	= Cellsize * sqrt(2.0);
 
-		return( true );
+			m_Extent.m_rect.xMin	= xMin;
+			m_Extent.m_rect.yMin	= yMin;
+			m_Extent.m_rect.xMax	= xMin + (NX - 1.0) * Cellsize;
+			m_Extent.m_rect.yMax	= yMin + (NY - 1.0) * Cellsize;
+
+			m_Extent_Cells	= m_Extent;
+			m_Extent_Cells.Inflate(0.5 * Cellsize, false);
+
+			return( true );
+		}
 	}
 
-	m_Cellsize		= -1.0;
+	//-----------------------------------------------------
 	m_NX			= 0;
 	m_NY			= 0;
 	m_NCells		= 0;
+
 	m_Cellsize		= 0.0;
 	m_Cellarea		= 0.0;
 	m_Diagonal		= 0.0;
+
 	m_Extent		.Assign(0.0, 0.0, 0.0, 0.0);
 	m_Extent_Cells	.Assign(0.0, 0.0, 0.0, 0.0);
 
@@ -270,7 +272,12 @@ bool CSG_Grid_System::Assign(double Cellsize, double xMin, double yMin, int NX,
 //---------------------------------------------------------
 bool CSG_Grid_System::is_Equal(const CSG_Grid_System &System) const
 {
-	return( is_Equal(System.m_Cellsize, System.m_Extent.m_rect) );
+	return( m_Cellsize           == System.m_Cellsize
+		&&  m_NX                 == System.m_NX
+		&&  m_NY                 == System.m_NY
+		&&  m_Extent.m_rect.xMin == System.m_Extent.m_rect.xMin
+		&&  m_Extent.m_rect.yMin == System.m_Extent.m_rect.yMin
+	);
 }
 
 //---------------------------------------------------------
diff --git a/src/saga_core/saga_api/mat_formula.cpp b/src/saga_core/saga_api/mat_formula.cpp
index 51bd0bb..ac1ef1f 100644
--- a/src/saga_core/saga_api/mat_formula.cpp
+++ b/src/saga_core/saga_api/mat_formula.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: mat_formula.cpp 2064 2014-03-21 13:20:57Z oconrad $
+ * Version $Id: mat_formula.cpp 2451 2015-03-19 16:59:41Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -118,6 +118,12 @@ static double f_atan2(double x, double val)
 }
 
 //---------------------------------------------------------
+static double f_pow(double x, double val)
+{
+	return( pow(x, val) );
+}
+
+//---------------------------------------------------------
 static double f_gt(double x, double val)
 {
 	return( x > val ? 1.0 : 0.0 );
@@ -148,6 +154,12 @@ static double f_int(double x)
 }
 
 //---------------------------------------------------------
+static double f_sqr(double x)
+{
+	return( x*x );
+}
+
+//---------------------------------------------------------
 static double f_fmod(double x, double val)
 {
 	return( fmod(x, val) );
@@ -156,7 +168,8 @@ static double f_fmod(double x, double val)
 //---------------------------------------------------------
 static double f_ifelse(double condition, double x, double y)
 {
-	return( fabs(condition - 1.0) < EPSILON ? x : y );
+	return( condition ? x : y );
+//	return( fabs(condition) >= EPSILON ? x : y );
 }
 
 
@@ -169,26 +182,28 @@ static double f_ifelse(double condition, double x, double y)
 //---------------------------------------------------------
 static CSG_Formula::TSG_Formula_Item gSG_Functions[MAX_CTABLE]	=
 {
-	{SG_T("exp")	,						exp		, 1, 0},	//  1
-	{SG_T("ln")		,						log		, 1, 0},	//  2
-	{SG_T("sin")	,						sin		, 1, 0},	//  3
-	{SG_T("cos")	,						cos		, 1, 0},	//  4
-	{SG_T("tan")	,						tan		, 1, 0},	//  5
-	{SG_T("asin")	,						asin	, 1, 0},	//  6
-	{SG_T("acos")	,						acos	, 1, 0},	//  7
-	{SG_T("atan")	,						atan	, 1, 0},	//  8
-	{SG_T("atan2")	, (TSG_PFNC_Formula_1)	f_atan2	, 2, 0},	//  9
-	{SG_T("abs")	,						fabs	, 1, 0},	// 10
-	{SG_T("sqrt")	,						sqrt	, 1, 0},	// 11
-	{SG_T("gt")		, (TSG_PFNC_Formula_1)	f_gt	, 2, 0},	// 12
-	{SG_T("lt")		, (TSG_PFNC_Formula_1)	f_lt	, 2, 0},	// 13
-	{SG_T("eq")		, (TSG_PFNC_Formula_1)	f_eq	, 2, 0},	// 14
-	{SG_T("pi")		, (TSG_PFNC_Formula_1)	f_pi	, 0, 0},	// 15
-	{SG_T("int")	, (TSG_PFNC_Formula_1)	f_int	, 1, 0},	// 16
-	{SG_T("mod")	, (TSG_PFNC_Formula_1)	f_fmod	, 2, 0},	// 17
-	{SG_T("ifelse")	, (TSG_PFNC_Formula_1)	f_ifelse, 3, 0},	// 18
-	{SG_T("log")	,						log10	, 1, 0},	// 19
-	{NULL			,						NULL	, 0, 0}
+	{SG_T("exp"   ),                      exp     , 1, 0},	//  1
+	{SG_T("ln"    ),                      log     , 1, 0},	//  2
+	{SG_T("sin"   ),                      sin     , 1, 0},	//  3
+	{SG_T("cos"   ),                      cos     , 1, 0},	//  4
+	{SG_T("tan"   ),                      tan     , 1, 0},	//  5
+	{SG_T("asin"  ),                      asin    , 1, 0},	//  6
+	{SG_T("acos"  ),                      acos    , 1, 0},	//  7
+	{SG_T("atan"  ),                      atan    , 1, 0},	//  8
+	{SG_T("atan2" ), (TSG_PFNC_Formula_1) f_atan2 , 2, 0},	//  9
+	{SG_T("abs"   ),                      fabs    , 1, 0},	// 10
+	{SG_T("sqrt"  ),                      sqrt    , 1, 0},	// 11
+	{SG_T("gt"    ), (TSG_PFNC_Formula_1) f_gt    , 2, 0},	// 12
+	{SG_T("lt"    ), (TSG_PFNC_Formula_1) f_lt    , 2, 0},	// 13
+	{SG_T("eq"    ), (TSG_PFNC_Formula_1) f_eq    , 2, 0},	// 14
+	{SG_T("pi"    ), (TSG_PFNC_Formula_1) f_pi    , 0, 0},	// 15
+	{SG_T("int"   ), (TSG_PFNC_Formula_1) f_int   , 1, 0},	// 16
+	{SG_T("mod"   ), (TSG_PFNC_Formula_1) f_fmod  , 2, 0},	// 17
+	{SG_T("ifelse"), (TSG_PFNC_Formula_1) f_ifelse, 3, 0},	// 18
+	{SG_T("log"   ),                      log10   , 1, 0},	// 19
+	{SG_T("pow"   ), (TSG_PFNC_Formula_1) f_pow   , 2, 0},	// 20
+	{SG_T("sqr"   ), (TSG_PFNC_Formula_1) f_sqr   , 1, 0},	// 11
+	{NULL          ,                      NULL    , 0, 0}
 };
 
 
@@ -244,10 +259,12 @@ CSG_String CSG_Formula::Get_Help_Operators(void)
 		SG_T("/ Division\n")
 		SG_T("^ power\n")
 		SG_T("abs(x)          - absolute value\n")
+		SG_T("sqr(x)          - square\n")
 		SG_T("sqrt(x)         - square root\n")
 		SG_T("ln(x)           - natural logarithm\n")
 		SG_T("log(x)          - base 10 logarithm\n")
 		SG_T("exp(x)          - exponential\n")
+		SG_T("pow(x, y)       - power with mantisse x and exponent y\n")
 		SG_T("sin(x)          - sine\n")
 		SG_T("cos(x)          - cosine\n")
 		SG_T("tan(x)          - tangent\n")
@@ -255,11 +272,14 @@ CSG_String CSG_Formula::Get_Help_Operators(void)
 		SG_T("acos(x)         - arccosine\n")
 		SG_T("atan(x)         - arctangent\n")
 		SG_T("atan2(x, y)     - arctangent of x/y\n")
-		SG_T("gt(x, y)        - if x>y the result is 1.0, else 0.0\n")
-		SG_T("lt(x, y)        - if x<y the result is 1.0, else 0.0\n")
-		SG_T("eq(x, y)        - if x=y the result is 1.0, else 0.0\n")
+		SG_T("gt(x, y)        - the result is 1.0, if x is greater than y else 0.0\n")
+		SG_T("x > y           - the result is 1.0, if x is greater than y else 0.0\n")
+		SG_T("lt(x, y)        - the result is 1.0, if x is less than y, else 0.0\n")
+		SG_T("x < y           - the result is 1.0, if x is less than y, else 0.0\n")
+		SG_T("eq(x, y)        - the result is 1.0, if x equals y, else 0.0\n")
+		SG_T("x = y           - the result is 1.0, if x equals y, else 0.0\n")
 		SG_T("mod(x, y)       - returns the floating point remainder of x/y\n")
-		SG_T("ifelse(c, x, y) - if c=1 the result is x, else y\n")
+		SG_T("ifelse(c, x, y) - if condition c is not 0.0 the result is x, else y\n")
 		SG_T("int(x)          - integer part of floating point value x\n")
 		SG_T("pi()            - returns the value of Pi\n")
 	));
diff --git a/src/saga_core/saga_api/mat_matrix.cpp b/src/saga_core/saga_api/mat_matrix.cpp
index e810ecf..e865ce8 100644
--- a/src/saga_core/saga_api/mat_matrix.cpp
+++ b/src/saga_core/saga_api/mat_matrix.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: mat_matrix.cpp 1953 2014-01-22 14:19:31Z oconrad $
+ * Version $Id: mat_matrix.cpp 2456 2015-03-23 11:27:09Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -216,8 +216,16 @@ bool CSG_Vector::Add_Row(double Value)
 }
 
 //---------------------------------------------------------
-bool CSG_Vector::Del_Row(void)
+bool CSG_Vector::Del_Row(int iRow)
 {
+	if( iRow >= 0 && iRow < Get_N() - 1 )
+	{
+		for(int i=iRow, j=iRow+1; j<Get_N(); i++, j++)
+		{
+			Get_Data()[i]	= Get_Data()[j];
+		}
+	}
+
 	return( m_Array.Dec_Array() );
 }
 
@@ -229,18 +237,39 @@ bool CSG_Vector::Del_Row(void)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-CSG_String CSG_Vector::asString(int Width, int Precision, bool bScientific)	const
+CSG_String CSG_Vector::to_String(int Width, int Precision, bool bScientific, const SG_Char *Separator)	const
 {
-	CSG_String	s;
+	CSG_String	s, sep(Separator && *Separator ? Separator : SG_T(" "));
 
 	for(int i=0; i<Get_N(); i++)
 	{
-		s	+= SG_Get_Double_asString(Get_Data(i), Width, Precision, bScientific) + "\n";
+		s	+= sep + SG_Get_Double_asString(Get_Data(i), Width, Precision, bScientific);
 	}
 
 	return( s );
 }
 
+//---------------------------------------------------------
+bool CSG_Vector::from_String(const CSG_String &String)
+{
+	Destroy();
+
+	CSG_String_Tokenizer	Line(String);
+
+	while( Line.Has_More_Tokens() )
+	{
+		double		d;
+		CSG_String	s(Line.Get_Next_Token());
+
+		if( s.asDouble(d) )
+		{
+			Add_Row(d);
+		}
+	}
+
+	return( Get_N() > 0 );
+}
+
 
 ///////////////////////////////////////////////////////////
 //														 //
@@ -576,6 +605,26 @@ bool CSG_Vector::Set_Unity(void)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
+bool CSG_Vector::Sort(void)
+{
+	if( Get_Size() > 0 )
+	{
+		qsort(Get_Data(), Get_Size(), sizeof(double), SG_Compare_Double);
+
+		return( true );
+	}
+
+	return( false );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
 double CSG_Vector::Get_Length(void) const
 {
 	if( Get_N() > 0 )
@@ -1126,25 +1175,55 @@ CSG_Vector CSG_Matrix::Get_Row(int iRow)	const
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-CSG_String CSG_Matrix::asString(int Width, int Precision, bool bScientific)	const
+CSG_String CSG_Matrix::to_String(int Width, int Precision, bool bScientific, const SG_Char *Separator)	const
 {
-	CSG_String	s;
+	CSG_String	s, sep(Separator && *Separator ? Separator : SG_T(" "));
 
 	for(int y=0, n=SG_Get_Digit_Count(m_ny + 1); y<m_ny; y++)
 	{
-		s	+= CSG_String::Format(SG_T("%0*d:"), n, y + 1);
+		s	+= CSG_String::Format("\n%0*d:", n, y + 1);
 
 		for(int x=0; x<m_nx; x++)
 		{
-			s	+= "\t" + SG_Get_Double_asString(m_z[y][x], Width, Precision, bScientific);
+			s	+= sep + SG_Get_Double_asString(m_z[y][x], Width, Precision, bScientific);
 		}
-
-		s	+= "\n";
 	}
 
+	s	+= "\n";
+
 	return( s );
 }
 
+//---------------------------------------------------------
+bool CSG_Matrix::from_String(const CSG_String &String)
+{
+	Destroy();
+
+	CSG_String_Tokenizer	Lines(String, "\r\n");
+
+	while( Lines.Has_More_Tokens() )
+	{
+		CSG_String_Tokenizer	Line(Lines.Get_Next_Token().AfterFirst(':'));
+
+		CSG_Vector	z;
+
+		while( Line.Has_More_Tokens() )
+		{
+			double		d;
+			CSG_String	s(Line.Get_Next_Token());
+
+			if( s.asDouble(d) )
+			{
+				z.Add_Row(d);
+			}
+		}
+
+		Add_Row(z);
+	}
+
+	return( Get_NRows() > 0 );
+}
+
 
 ///////////////////////////////////////////////////////////
 //														 //
@@ -1521,10 +1600,9 @@ bool CSG_Matrix::Set_Transpose(void)
 //---------------------------------------------------------
 bool CSG_Matrix::Set_Inverse(bool bSilent, int nSubSquare)
 {
-	bool	bResult	= false;
-	int		n		= 0;
-
 	//-----------------------------------------------------
+	int		n	= 0;
+
 	if( nSubSquare > 0 )
 	{
 		if( nSubSquare <= m_nx && nSubSquare <= m_ny )
@@ -1541,9 +1619,9 @@ bool CSG_Matrix::Set_Inverse(bool bSilent, int nSubSquare)
 	if( n > 0 )
 	{
 		CSG_Matrix	m(*this);
-		int		*Permutation	= (int *)SG_Malloc(n * sizeof(int));
+		CSG_Array	p(sizeof(int), n);
 
-		if( SG_Matrix_LU_Decomposition(n, Permutation, m.Get_Data(), bSilent) )
+		if( SG_Matrix_LU_Decomposition(n, (int *)p.Get_Array(), m.Get_Data(), bSilent) )
 		{
 			CSG_Vector	v(n);
 
@@ -1552,7 +1630,7 @@ bool CSG_Matrix::Set_Inverse(bool bSilent, int nSubSquare)
 				v.Set_Zero();
 				v[j]	= 1.0;
 
-				SG_Matrix_LU_Solve(n, Permutation, m, v.Get_Data(), true);
+				SG_Matrix_LU_Solve(n, (int *)p.Get_Array(), m, v.Get_Data(), true);
 
 				for(int i=0; i<n; i++)
 				{
@@ -1560,13 +1638,11 @@ bool CSG_Matrix::Set_Inverse(bool bSilent, int nSubSquare)
 				}
 			}
 
-			bResult	= true;
+			return( true );
 		}
-
-		SG_Free(Permutation);
 	}
 
-	return( bResult );
+	return( false );
 }
 
 
@@ -1581,10 +1657,20 @@ double CSG_Matrix::Get_Determinant(void) const
 {
 	double	d	= 0.0;
 
-	for(int y=0; y<m_ny; y++)
+	if( is_Square() )	// det is only defined for squared matrices !
 	{
-		for(int x=0; x<m_nx; x++)
+		int			n;
+		CSG_Matrix	m(*this);
+		CSG_Array	p(sizeof(int), m_nx);
+
+		if( SG_Matrix_LU_Decomposition(m_nx, (int *)p.Get_Array(), m.Get_Data(), true, &n) )
 		{
+			d	= n % 2 ? -1.0 : 1.0;
+
+			for(int i=0; i<m_nx; i++)
+			{
+				d	*= m[i][i];
+			}
 		}
 	}
 
@@ -1627,24 +1713,19 @@ CSG_Matrix CSG_Matrix::Get_Inverse(bool bSilent, int nSubSquare) const
 //---------------------------------------------------------
 bool		SG_Matrix_Solve(CSG_Matrix &Matrix, CSG_Vector &Vector, bool bSilent)
 {
-	bool	bResult	= false;
-	int		n		= Vector.Get_N();
+	int	n	= Vector.Get_N();
 
 	if( n > 0 && n == Matrix.Get_NX() && n == Matrix.Get_NY() )
 	{
-		int	*Permutation	= (int *)SG_Malloc(n * sizeof(int));
+		CSG_Array	Permutation(sizeof(int), n);
 
-		if( SG_Matrix_LU_Decomposition(n, Permutation, Matrix.Get_Data(), bSilent) )
+		if( SG_Matrix_LU_Decomposition(n, (int *)Permutation.Get_Array(), Matrix.Get_Data(), bSilent) )
 		{
-			SG_Matrix_LU_Solve(n, Permutation, Matrix, Vector.Get_Data(), bSilent);
-
-			bResult	= true;
+			return( SG_Matrix_LU_Solve(n, (int *)Permutation.Get_Array(), Matrix, Vector.Get_Data(), bSilent) );
 		}
-
-		SG_Free(Permutation);
 	}
 
-	return( bResult );
+	return( false );
 }
 
 
@@ -1672,7 +1753,7 @@ bool		SG_Matrix_Eigen_Reduction(const CSG_Matrix &Matrix, CSG_Matrix &Eigen_Vect
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool		SG_Matrix_LU_Decomposition(int n, int *Permutation, double **Matrix, bool bSilent)
+bool		SG_Matrix_LU_Decomposition(int n, int *Permutation, double **Matrix, bool bSilent, int *nRowChanges)
 {
 	int			i, j, k, iMax;
 	double		dMax, d, Sum;
@@ -1680,6 +1761,8 @@ bool		SG_Matrix_LU_Decomposition(int n, int *Permutation, double **Matrix, bool
 	
 	Vector.Create(n);
 
+	if( nRowChanges )	(*nRowChanges)	= 0;
+
 	for(i=0, iMax=0; i<n && (bSilent || SG_UI_Process_Set_Progress(i, n)); i++)
 	{
 		dMax	= 0.0;
@@ -1742,6 +1825,8 @@ bool		SG_Matrix_LU_Decomposition(int n, int *Permutation, double **Matrix, bool
 			}
 
 			Vector[iMax]	= Vector[j];
+
+			if( nRowChanges )	(*nRowChanges)++;
 		}
 
 		Permutation[j]	= iMax;
diff --git a/src/saga_core/saga_api/mat_regression_weighted.cpp b/src/saga_core/saga_api/mat_regression_weighted.cpp
new file mode 100644
index 0000000..dd2cbe4
--- /dev/null
+++ b/src/saga_core/saga_api/mat_regression_weighted.cpp
@@ -0,0 +1,332 @@
+/**********************************************************
+ * Version $Id: mat_regression_multiple.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ *********************************************************/
+
+///////////////////////////////////////////////////////////
+//                                                       //
+//                         SAGA                          //
+//                                                       //
+//      System for Automated Geoscientific Analyses      //
+//                                                       //
+//           Application Programming Interface           //
+//                                                       //
+//                  Library: SAGA_API                    //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//              mat_regression_multiple.cpp              //
+//                                                       //
+//          Copyright (C) 2005 by Olaf Conrad            //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+// This file is part of 'SAGA - System for Automated     //
+// Geoscientific Analyses'.                              //
+//                                                       //
+// 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 of the License.      //
+//                                                       //
+// This library is distributed in the hope that it will  //
+// be useful, but WITHOUT ANY WARRANTY; without even the //
+// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
+// PARTICULAR PURPOSE. See the GNU Lesser General Public //
+// License for more details.                             //
+//                                                       //
+// You should have received a copy of the GNU Lesser     //
+// General Public License along with this program; if    //
+// not, write to the Free Software Foundation, Inc.,     //
+// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
+// USA.                                                  //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//    contact:    Olaf Conrad                            //
+//                Institute of Geography                 //
+//                University of Goettingen               //
+//                Goldschmidtstr. 5                      //
+//                37077 Hamburg                          //
+//                Germany                                //
+//                                                       //
+//    e-mail:     oconrad at saga-gis.org                   //
+//                                                       //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#include "mat_tools.h"
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+CSG_Regression_Weighted::CSG_Regression_Weighted(void)
+{
+	m_r2	= -1.0;
+}
+
+//---------------------------------------------------------
+CSG_Regression_Weighted::~CSG_Regression_Weighted(void)
+{
+	Destroy();
+}
+
+//---------------------------------------------------------
+bool CSG_Regression_Weighted::Destroy(void)
+{
+	m_r2	= -1.0;
+
+	m_x.Destroy();
+	m_w.Destroy();
+	m_Y.Destroy();
+	m_b.Destroy();
+
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CSG_Regression_Weighted::Add_Sample(double Weight, double Dependent, const CSG_Vector &Predictors)
+{
+	if( m_Y.Get_NRows() == 0 )
+	{
+		m_Y.Create(Predictors.Get_N() + 1, 1);
+	}
+	else if( m_Y.Get_NCols() == Predictors.Get_N() + 1 )
+	{
+		m_Y.Add_Row();
+	}
+	else
+	{
+		return( false );
+	}
+
+	m_w.Add_Row(Weight   );
+	m_x.Add_Row(Dependent);
+
+	double	*y	= m_Y[m_Y.Get_NRows() - 1];
+
+	y[0]	= 1.0;
+
+	for(int i=0; i<Predictors.Get_N(); i++)
+	{
+		y[i + 1]	= Predictors[i];
+	}
+
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CSG_Regression_Weighted::Calculate(const CSG_Vector &Weights, const CSG_Vector &Dependents, const CSG_Matrix &Predictors)
+{
+	Destroy();
+
+	if( Weights.Get_N() == Dependents.Get_N() && Weights.Get_N() == Predictors.Get_NRows() )
+	{
+		for(int i=0; i<Weights.Get_N(); i++)
+		{
+			Add_Sample(Weights[i], Dependents[i], Predictors.Get_Row(i));
+
+			return( Calculate() );
+		}
+	}
+
+	return( false );
+}
+
+//---------------------------------------------------------
+bool CSG_Regression_Weighted::Calculate(void)
+{
+	//-----------------------------------------------------
+	int			i, nSamples, nPredictors;
+
+	if( (nSamples = m_w.Get_N()) <= (nPredictors = m_Y.Get_NCols() - 1) || nSamples < 2 )
+	{
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	CSG_Matrix	YtW(nSamples, 1 + nPredictors);
+
+	double	xMean	= 0.0;
+
+	for(i=0; i<nSamples; i++)
+	{
+		xMean		+= m_x[i];
+		YtW[0][i]	 = m_w[i];
+
+		for(int j=1; j<=nPredictors; j++)
+		{
+			YtW[j][i]	= m_w[i] * m_Y[i][j];
+		}
+	}
+
+	xMean	/= nSamples;
+
+	m_b		 = (YtW * m_Y).Get_Inverse() * (YtW * m_x);
+
+	//-----------------------------------------------------
+	double	rss	= 0.0, tss	= 0.0;
+
+	for(i=0; i<nSamples; i++)
+	{
+		double	xr	= m_b[0];
+
+		for(int j=1; j<=nPredictors; j++)
+		{
+			xr	+= m_b[j] * m_Y[i][j];
+		}
+
+		rss	+= m_w[i] * SG_Get_Square(m_x[i] - xr);
+		tss	+= m_w[i] * SG_Get_Square(m_x[i] - xMean);
+	}
+
+	//-----------------------------------------------------
+	if( tss > 0.0 && tss >= rss )
+	{
+		m_r2	= (tss - rss) / tss;
+
+		return( true );
+	}
+
+	m_r2	= -1.0;
+
+	return( false );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CSG_Regression_Weighted::Get_CrossValidation(int nSubSamples)
+{
+/*	if( Get_Predictor_Count() <= 1 )
+	{
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	CSG_Regression_Weighted	Model;
+	CSG_Simple_Statistics	Stats, SR, SE;
+
+	int		i, nModels	= 0;
+
+	for(i=0; i<m_Samples_Model.Get_NRows(); i++)
+	{
+		Stats	+= m_Samples_Model[i][0];
+	}
+
+	//-----------------------------------------------------
+	// leave-one-out cross validation (LOOCV)
+	if( nSubSamples <= 1 || nSubSamples > m_Samples_Model.Get_NRows() / 2 )
+	{
+		for(i=0; i<m_Samples_Model.Get_NRows() && SG_UI_Process_Get_Okay(); i++)
+		{
+			CSG_Vector	w(m_w);	w.Del_Row(i);	Model
+			CSG_Vector	x(m_x);	x.Del_Row(i);
+			CSG_Matrix	Y(m_Y);	Y.Del_Row(i);
+
+			if( Model.Calculate(w, x, Y) )
+			{
+				nModels++;
+
+				double	dObsrv	= m_Samples_Model[i][0];
+				double	dModel	= Model.Get_Value(CSG_Vector(m_nPredictors, m_Samples_Model[i] + 1));
+
+				SE	+= SG_Get_Square(dModel - dObsrv);
+				SR	+= SG_Get_Square(dModel - (Stats.Get_Sum() - dObsrv) / Samples.Get_NRows());
+			}
+		}
+	}
+
+	//-----------------------------------------------------
+	// k-fold cross validation
+	else
+	{
+		int	*SubSet	= new int[m_Samples_Model.Get_NRows()];
+
+		for(i=0; i<m_Samples_Model.Get_NRows(); i++)
+		{
+			SubSet[i]	= i % nSubSamples;
+		}
+
+		//-------------------------------------------------
+		for(int iSubSet=0; iSubSet<nSubSamples && SG_UI_Process_Get_Okay(); iSubSet++)
+		{
+			CSG_Simple_Statistics	Samples_Stats;
+			CSG_Matrix	Samples(m_Samples_Model), Validation;
+
+			for(i=Samples.Get_NRows()-1; i>=0; i--)
+			{
+				if( SubSet[i] == iSubSet )
+				{
+					Validation.Add_Row(Samples.Get_Row(i));
+					Samples   .Del_Row(i);
+				}
+				else
+				{
+					Samples_Stats	+= Samples[i][0];
+				}
+			}
+
+			//---------------------------------------------
+			if( Model.Get_Model(Samples) )
+			{
+				nModels++;
+
+				for(i=0; i<Validation.Get_NRows(); i++)
+				{
+					double	dObsrv	= Validation[i][0];
+					double	dModel	= Model.Get_Value(CSG_Vector(m_nPredictors, Validation[i] + 1));
+
+					SE	+= SG_Get_Square(dModel - dObsrv);
+					SR	+= SG_Get_Square(dModel - Samples_Stats.Get_Mean());
+				}
+			}
+		}
+
+		delete[](SubSet);
+	}
+
+	//-----------------------------------------------------
+	m_CV_RMSE		= sqrt(SE.Get_Mean());
+	m_CV_NRMSE		= sqrt(SE.Get_Mean()) / Stats.Get_Range();
+	m_CV_R2			= SR.Get_Sum() / (SR.Get_Sum() + SE.Get_Sum());
+	m_CV_nSamples	= nModels;
+/**/
+	//-----------------------------------------------------
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
diff --git a/src/saga_core/saga_api/mat_tools.cpp b/src/saga_core/saga_api/mat_tools.cpp
index 48e1fa7..4226ae2 100644
--- a/src/saga_core/saga_api/mat_tools.cpp
+++ b/src/saga_core/saga_api/mat_tools.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: mat_tools.cpp 2141 2014-06-06 13:57:12Z oconrad $
+ * Version $Id: mat_tools.cpp 2457 2015-03-23 11:27:57Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -101,6 +101,36 @@ double			SG_Get_Rounded(double Value, int Decimals)
 	return( ((int)(0.5 + d * Value)) / d );
 }
 
+//---------------------------------------------------------
+double			SG_Get_Rounded_To_SignificantFigures(double Value, int Decimals)
+{
+	if( Decimals <= 0 || Value == 0.0 )
+	{
+		return( (int)(0.5 + Value) );
+	}
+
+	Decimals	= (int)(-(ceil(log10(fabs(Value))) - Decimals));
+
+	if( Decimals > 0 )
+	{
+		double	d	= pow(10.0, Decimals);
+
+		return( Value < 0.0
+			? -((int)(0.5 - Value * d)) / d
+			:  ((int)(0.5 + Value * d)) / d
+		); 
+	}
+	else
+	{
+		double	d	= pow(10.0, -Decimals);
+
+		return( Value < 0.0
+			? -((int)(0.5 - Value / d)) * d
+			:  ((int)(0.5 + Value / d)) * d
+		);
+	}
+}
+
 
 ///////////////////////////////////////////////////////////
 //                                                       //
@@ -152,6 +182,43 @@ CSG_String		SG_Get_Double_asString(double Number, int Width, int Precision, bool
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
+int SG_Compare_Int(const void *a, const void *b)
+{
+	if( *((int *)a) < *((int *)b) )
+		return( -1  );
+
+	if( *((int *)a) > *((int *)b) )
+		return(  1  );
+
+	return(  0  );
+}
+
+//---------------------------------------------------------
+int SG_Compare_Double(const void *a, const void *b)
+{
+	if( *((double *)a) < *((double *)b) )
+		return( -1  );
+
+	if( *((double *)a) > *((double *)b) )
+		return(  1  );
+
+	return(  0  );
+}
+
+//---------------------------------------------------------
+int SG_Compare_Char_Ptr(const void *a, const void *b)
+{
+	return( strcmp((const char *)a, (const char *)b) );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
 CSG_Random::CSG_Random(void)
 {
 	Initialize();
@@ -242,6 +309,11 @@ CSG_Simple_Statistics::CSG_Simple_Statistics(double Mean, double StdDev, sLong C
 	Create(Mean, StdDev, Count);
 }
 
+CSG_Simple_Statistics::CSG_Simple_Statistics(const CSG_Vector &Values, bool bHoldValues)
+{
+	Create(Values, bHoldValues);
+}
+
 //---------------------------------------------------------
 bool CSG_Simple_Statistics::Create(bool bHoldValues)
 {
@@ -268,6 +340,7 @@ bool CSG_Simple_Statistics::Create(const CSG_Simple_Statistics &Statistics)
 	m_Variance		= Statistics.m_Variance;
 	m_StdDev		= Statistics.m_StdDev;
 
+	m_bSorted		= Statistics.m_bSorted;
 	m_Values		.Create(Statistics.m_Values);
 
 	return( true );
@@ -290,11 +363,27 @@ bool CSG_Simple_Statistics::Create(double Mean, double StdDev, sLong Count)
 	m_Maximum		= m_Mean + 1.5 * m_StdDev;
 	m_Range			= m_Maximum - m_Minimum;
 
+	m_bSorted		= false;
 	m_Values		.Destroy();
 
 	return( true );
 }
 
+bool CSG_Simple_Statistics::Create(const CSG_Vector &Values, bool bHoldValues)
+{
+	if( Create(bHoldValues) )
+	{
+		for(size_t i=0; i<Values.Get_Size(); i++)
+		{
+			Add_Value(Values[i]);
+		}
+
+		return( true );
+	}
+
+	return( false );
+}
+
 //---------------------------------------------------------
 void CSG_Simple_Statistics::Invalidate(void)
 {
@@ -312,6 +401,7 @@ void CSG_Simple_Statistics::Invalidate(void)
 	m_Variance		= 0.0;
 	m_StdDev		= 0.0;
 
+	m_bSorted		= false;
 	m_Values		.Destroy();
 }
 
@@ -331,7 +421,7 @@ void CSG_Simple_Statistics::Add(const CSG_Simple_Statistics &Statistics)
 	}
 
 	//--------------------------------------------------------
-	if( m_Values.Get_Size() == m_nValues && Statistics.m_Values.Get_Size() == Statistics.m_nValues && m_Values.Set_Array(m_nValues + Statistics.m_nValues) )
+	if( m_Values.Get_Size() == m_nValues && Statistics.m_Values.Get_Size() == Statistics.m_nValues && m_Values.Set_Array((size_t)(m_nValues + Statistics.m_nValues)) )
 	{
 		for(sLong i=0, j=m_nValues; i<Statistics.m_nValues; i++, j++)
 		{
@@ -355,6 +445,7 @@ void CSG_Simple_Statistics::Add(const CSG_Simple_Statistics &Statistics)
 		m_Maximum	= Statistics.m_Maximum;
 
 	m_bEvaluated	= false;
+	m_bSorted		= false;
 }
 
 //---------------------------------------------------------
@@ -384,6 +475,8 @@ void CSG_Simple_Statistics::Add_Value(double Value, double Weight)
 
 	if( m_Values.Get_Value_Size() > 0 && m_Values.Inc_Array() )
 	{
+		m_bSorted		= false;
+
 		((double *)m_Values.Get_Array())[m_nValues]	= Value;
 	}
 
@@ -404,6 +497,30 @@ void CSG_Simple_Statistics::_Evaluate(void)
 	}
 }
 
+//---------------------------------------------------------
+/**
+  * The quantile is expected to be given as percentage.
+  * A percentage of 50 returns the median. Remark:
+  * Quantile calculation is only possible, if statistics
+  * has been created with the bHoldValues option set to true.
+*/
+double CSG_Simple_Statistics::Get_Quantile(double Quantile)
+{
+	if( m_Values.Get_Size() > 0 )
+	{
+		if( !m_bSorted )
+		{
+			qsort(m_Values.Get_Array(), m_Values.Get_Size(), sizeof(double), SG_Compare_Double);
+
+			m_bSorted	= true;
+		}
+
+		return( Get_Value((sLong)(0.5 + (m_Values.Get_Size() - 1) * Quantile / 100.0)) );
+	}
+
+	return( m_Mean );
+}
+
 
 ///////////////////////////////////////////////////////////
 //														 //
@@ -903,14 +1020,15 @@ bool CSG_Cluster_Analysis::Hill_Climbing(bool bInitialize, int nMaxIterations)
 //---------------------------------------------------------
 CSG_Classifier_Supervised::CSG_Classifier_Supervised(void)
 {
-	m_Statistics			= NULL;
-	m_nElements				= NULL;
 	m_nFeatures				= 0;
 
-	m_Distance_Threshold	= 0.0;
-	m_Probability_Threshold	= 0.0;
+	m_nClasses				= 0;
+	m_pClasses				= NULL;
+
+	m_Threshold_Distance	= 0.0;
+	m_Threshold_Angle		= 0.0;
+	m_Threshold_Probability	= 0.0;
 	m_Probability_Relative	= false;
-	m_Angle_Threshold		= 0.0;
 
 	for(int i=0; i<SG_CLASSIFY_SUPERVISED_WTA; i++)
 	{
@@ -941,82 +1059,164 @@ void CSG_Classifier_Supervised::Create(int nFeatures)
 //---------------------------------------------------------
 void CSG_Classifier_Supervised::Destroy(void)
 {
-	if( Get_Class_Count() > 0 )
+	if( m_nClasses > 0 )
 	{
-		for(int i=0; i<Get_Class_Count(); i++)
+		for(int i=0; i<m_nClasses; i++)
 		{
-			delete[](m_Statistics[i]);
+			delete(m_pClasses[i]);
 		}
 
-		SG_Free(m_Statistics);
-		SG_Free(m_nElements);
-
-		m_Statistics	= NULL;
-		m_nElements		= NULL;
-
-		m_BE_m	.Destroy();
-		m_BE_s	.Destroy();
-		m_SAM_l	.Destroy();
-		m_ML_s	.Destroy();
-		m_ML_a	.Destroy();
-		m_ML_b	.Destroy();
-
-		m_IDs	.Clear();
+		SG_FREE_SAFE(m_pClasses);
 	}
 
 	m_nFeatures	= 0;
+
+	m_Info.Clear();
 }
 
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+void   CSG_Classifier_Supervised::Set_Threshold_Distance   (double Value)	{	m_Threshold_Distance	= Value;	}
+double CSG_Classifier_Supervised::Get_Threshold_Distance   (void)			{	return( m_Threshold_Distance );		}
+
+//---------------------------------------------------------
+void   CSG_Classifier_Supervised::Set_Threshold_Angle      (double Value)	{	m_Threshold_Angle		= Value;	}
+double CSG_Classifier_Supervised::Get_Threshold_Angle      (void)			{	return( m_Threshold_Angle );		}
+
+//---------------------------------------------------------
+void   CSG_Classifier_Supervised::Set_Threshold_Probability(double Value)	{	m_Threshold_Probability	= Value;	}
+double CSG_Classifier_Supervised::Get_Threshold_Probability(void)			{	return( m_Threshold_Probability );	}
+
+//---------------------------------------------------------
+void   CSG_Classifier_Supervised::Set_Probability_Relative (bool   Value)	{	m_Probability_Relative	= Value;	}
+bool   CSG_Classifier_Supervised::Get_Probability_Relative (void)			{	return( m_Probability_Relative );	}
+
+//---------------------------------------------------------
+void CSG_Classifier_Supervised::Set_WTA(int Method, bool bOn)
+{
+	if( Method >= 0 && Method < SG_CLASSIFY_SUPERVISED_WTA )
+	{
+		m_bWTA[Method]	= bOn;
+	}
+}
+
+bool CSG_Classifier_Supervised::Get_WTA(int Method)
+{
+	return( Method >= 0 && Method < SG_CLASSIFY_SUPERVISED_WTA ? m_bWTA[Method] : false );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
 //---------------------------------------------------------
-void CSG_Classifier_Supervised::Del_Element_Count(void)
+#include "saga_api.h"
+
+//---------------------------------------------------------
+bool CSG_Classifier_Supervised::Load(const CSG_String &File)
 {
-	for(int i=0; i<Get_Class_Count(); i++)
+	int	nFeatures	= m_nFeatures;	Destroy();	m_nFeatures	= nFeatures;
+
+	//-----------------------------------------------------
+	CSG_MetaData	Data;
+
+	if( !Data.Load(File) || !Data.Cmp_Name("supervised_classifier") || SG_Compare_Version(Data.Get_Property("saga-version"), "2.1.4") < 0 )
 	{
-		m_nElements[i]	= 0;
+		return( false );
 	}
-}
 
-//---------------------------------------------------------
-int CSG_Classifier_Supervised::Get_Class(const CSG_String &Class_ID)
-{
-	if( m_nFeatures > 0 )
+	if( !Data("classes") || !Data("features") || !Data["features"]("count") || Data["features"]["count"].Get_Content().asInt() != m_nFeatures || m_nFeatures == 0 )
 	{
-		for(int iClass=0; iClass<Get_Class_Count(); iClass++)
+		return( false );
+	}
+
+	if( Data["features"]("info") )
+	{
+		m_Info	= Data["features"]["info"].Get_Content();
+	}
+
+	//-----------------------------------------------------
+	CSG_MetaData	&Classes	= *Data.Get_Child("CLASSES");
+
+	for(int i=0; i<Classes.Get_Children_Count(); i++)
+	{
+		if( Classes[i].Cmp_Name("class") && Classes[i].Get_Child("id") )
 		{
-			if( !Get_Class_ID(iClass).Cmp(Class_ID) )
+			bool	bAdd	= true;
+
+			CClass	*pClass	= new CClass(Classes[i]["id"].Get_Content());
+
+			if( !pClass->m_Cov .from_String(Classes[i]["cov" ].Get_Content()) || pClass->m_Cov .Get_NX() != m_nFeatures || !pClass->m_Cov.is_Square() )	{	bAdd	= false;	}
+			if( !pClass->m_Mean.from_String(Classes[i]["mean"].Get_Content()) || pClass->m_Mean.Get_N () != m_nFeatures )	{	bAdd	= false;	}
+			if( !pClass->m_Min .from_String(Classes[i]["min" ].Get_Content()) || pClass->m_Min .Get_N () != m_nFeatures )	{	bAdd	= false;	}
+			if( !pClass->m_Max .from_String(Classes[i]["max" ].Get_Content()) || pClass->m_Max .Get_N () != m_nFeatures )	{	bAdd	= false;	}
+
+			//---------------------------------------------
+			if( !bAdd )
 			{
-				return( iClass );
+				delete(pClass);
+			}
+			else
+			{
+				m_pClasses	= (CClass **)SG_Realloc(m_pClasses, (m_nClasses + 1) * sizeof(CClass *));
+				m_pClasses[m_nClasses++]	= pClass;
+
+				pClass->m_Cov_Det	= pClass->m_Cov.Get_Determinant();
+				pClass->m_Cov_Inv	= pClass->m_Cov.Get_Inverse();
+
+				pClass->m_Mean_Spectral	= CSG_Simple_Statistics(pClass->m_Mean).Get_Mean();
 			}
 		}
 	}
 
-	return( -1 );
+	return( m_nClasses > 0 );
 }
 
 //---------------------------------------------------------
-CSG_Simple_Statistics * CSG_Classifier_Supervised::Get_Statistics(const CSG_String &Class_ID)
+bool CSG_Classifier_Supervised::Save(const CSG_String &File, const SG_Char *Feature_Info)
 {
-	if( m_nFeatures > 0 )
+	if( m_nFeatures < 1 || m_nClasses < 1 || File.is_Empty() )
 	{
-		int		iClass	= Get_Class(Class_ID);
+		return( false );
+	}
 
-		if( iClass < 0 )
-		{
-			iClass					 = Get_Class_Count();
+	CSG_MetaData	Data;
 
-			m_IDs					+= Class_ID;
+	Data.Set_Name    ("supervised_classifier");
+	Data.Add_Property("saga-version", SAGA_VERSION);
 
-			m_nElements				 = (int *)SG_Realloc(m_nElements, m_IDs.Get_Count() * sizeof(int));
-			m_nElements[iClass]		 = 0;
+	CSG_MetaData	&Features	= *Data.Add_Child("features");
+	
+	Features.Add_Child("count", m_nFeatures);
 
-			m_Statistics			 = (CSG_Simple_Statistics **)SG_Realloc(m_Statistics, m_IDs.Get_Count() * sizeof(CSG_Simple_Statistics *));
-			m_Statistics[iClass]	 = new CSG_Simple_Statistics[m_nFeatures];
-		}
+	if( Feature_Info && *Feature_Info )
+	{
+		Features.Add_Child("info", Feature_Info);
+	}
+
+	CSG_MetaData	&Classes	= *Data.Add_Child("classes");
+	
+	Classes.Add_Property("count", m_nClasses);
 
-		return( m_Statistics[iClass] );
+	for(int i=0; i<m_nClasses; i++)
+	{
+		CSG_MetaData	&Class	= *Classes.Add_Child("class");
+
+		CClass	*pClass	= m_pClasses[i];
+
+		Class.Add_Child("id"  , pClass->m_ID              );
+		Class.Add_Child("mean", pClass->m_Mean.to_String());
+		Class.Add_Child("min" , pClass->m_Min .to_String());
+		Class.Add_Child("max" , pClass->m_Max .to_String());
+		Class.Add_Child("cov" , pClass->m_Cov .to_String());
 	}
 
-	return( NULL );
+	return( Data.Save(File) );
 }
 
 
@@ -1025,95 +1225,229 @@ CSG_Simple_Statistics * CSG_Classifier_Supervised::Get_Statistics(const CSG_Stri
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-void CSG_Classifier_Supervised::_Update(void)
-{
-	if( m_SAM_l.Get_N() != Get_Class_Count() )
+CSG_String CSG_Classifier_Supervised::Print(void)
+{
+	CSG_String	s;
+
+	if( m_nFeatures > 0 && m_nClasses > 0 )
 	{
-		int		iClass, iFeature;
+		s	+= "\n";
 
-		m_BE_s	.Create(Get_Feature_Count(), Get_Class_Count());
-		m_BE_m	.Create(Get_Class_Count());
-		m_SAM_l	.Create(Get_Class_Count());
-		m_ML_s	.Create(Get_Class_Count());
-		m_ML_a	.Create(Get_Feature_Count(), Get_Class_Count());
-		m_ML_b	.Create(Get_Feature_Count(), Get_Class_Count());
-
-		for(iClass=0; iClass<Get_Class_Count(); iClass++)
+		for(int iClass=0; iClass<m_nClasses; iClass++)
 		{
-			CSG_Simple_Statistics	*Statistic	= m_Statistics[iClass];
+			CClass	*pClass	= m_pClasses[iClass];
 
-			double	m	= 0.0;
-			double	l	= 0.0;
-			double	s	= 1.0;
+			s	+= "\n____\n" + pClass->m_ID + "\nFeature\tMean\tMin\tMax\tStdDev";
 
-			for(iFeature=0; iFeature<Get_Feature_Count(); iFeature++)
+			for(int i=0; i<m_nFeatures; i++)
 			{
-				m	+= Statistic[iFeature].Get_Mean();
-				l	+= SG_Get_Square(Statistic[iFeature].Get_Mean());
-				s	*= Statistic[iFeature].Get_Variance();
-
-				m_ML_a[iClass][iFeature]	=  1.0 / sqrt(Statistic[iFeature].Get_Variance() * 2.0 * M_PI);
-				m_ML_b[iClass][iFeature]	= -1.0 /     (Statistic[iFeature].Get_Variance() * 2.0);
+				s	+= CSG_String::Format("\n%3d.", i + 1);
+				s	+= "\t" + SG_Get_String(pClass->m_Mean[i]);
+				s	+= "\t" + SG_Get_String(pClass->m_Min [i]);
+				s	+= "\t" + SG_Get_String(pClass->m_Max [i]);
+				s	+= "\t" + SG_Get_String(sqrt(pClass->m_Cov[i][i]));
 			}
-
-			m_BE_m  [iClass]	= m / Get_Feature_Count();
-			m_SAM_l	[iClass]	= sqrt(l);
-			m_ML_s	[iClass]	= 1.0 / (pow(2.0 * M_PI, Get_Feature_Count() / 2.0) * sqrt(s));
+
+			s	+= "\n";
 		}
+	}
+
+	return( s );
+}
+
 
-		for(iClass=0; iClass<Get_Class_Count(); iClass++)
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CSG_Classifier_Supervised::Add_Class(const CSG_String &Class_ID, const CSG_Vector &Mean, const CSG_Vector &Min, const CSG_Vector &Max, const CSG_Matrix &Cov)
+{
+	if( m_nFeatures < 1 || Mean.Get_N() != m_nFeatures || Min.Get_N() != m_nFeatures || Max.Get_N() != m_nFeatures || Cov.Get_NCols() != m_nFeatures || Cov.Get_NRows() != m_nFeatures )
+	{
+		return( false );
+	}
+
+	CClass	*pClass, **pClasses	= (CClass **)SG_Realloc(m_pClasses, (m_nClasses + 1) * sizeof(CClass *));
+
+	if( pClasses )
+	{
+		m_pClasses	= pClasses;
+
+		m_pClasses[m_nClasses++]	= pClass	= new CClass(Class_ID);
+
+		pClass->m_ID	= Class_ID;
+
+		pClass->m_Mean	= Mean;
+		pClass->m_Min	= Min;
+		pClass->m_Max	= Max;
+		pClass->m_Cov	= Cov;
+
+		pClass->m_Cov_Inv	= Cov.Get_Inverse();
+		pClass->m_Cov_Det	= Cov.Get_Determinant();
+
+		pClass->m_Mean_Spectral	= CSG_Simple_Statistics(Mean).Get_Mean();
+
+		return( true );
+	}
+
+	return( false );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CSG_Classifier_Supervised::Train_Clr_Samples(void)
+{
+	for(int i=0; i<m_nClasses; i++)
+	{
+		m_pClasses[i]->m_Samples.Destroy();
+	}
+
+	return( true );
+}
+
+//---------------------------------------------------------
+bool CSG_Classifier_Supervised::Train_Add_Sample(const CSG_String &Class_ID, const CSG_Vector &Features)
+{
+	if( m_nFeatures > 0 && m_nFeatures == Features.Get_N() )
+	{
+		int	iClass	= Get_Class(Class_ID);
+
+		if( iClass < 0 )
 		{
-			CSG_Simple_Statistics	*Statistic	= m_Statistics[iClass];
+			CClass	**pClasses	= (CClass **)SG_Realloc(m_pClasses, (m_nClasses + 1) * sizeof(CClass *));
 
-			for(iFeature=0; iFeature<Get_Feature_Count(); iFeature++)
+			if( pClasses )
 			{
-				m_BE_s[iClass][iFeature]	= Statistic[iFeature].Get_Mean() < m_BE_m[iClass] ? 0.0 : 1.0;
+				m_pClasses	= pClasses;
+
+				m_pClasses[iClass = m_nClasses++]	= new CClass(Class_ID);
 			}
 		}
+
+		if( iClass >= 0 )
+		{
+			return( m_pClasses[iClass]->m_Samples.Add_Row(Features) );
+		}
 	}
+
+	return( false );
 }
 
+//---------------------------------------------------------
+bool CSG_Classifier_Supervised::Train(bool bClear_Samples)
+{
+	if( m_nFeatures < 1 || m_nClasses < 1 )
+	{
+		return( false );
+	}
+
+	for(int iClass=0; iClass<m_nClasses; iClass++)
+	{
+		if( !m_pClasses[iClass]->Train() )
+		{
+			return( false );
+		}
+	}
+
+	if( bClear_Samples )
+	{
+		Train_Clr_Samples();
+	}
+
+	return( true );
+}
 
+
 ///////////////////////////////////////////////////////////
 //														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-CSG_String CSG_Classifier_Supervised::Get_Name_of_Method(int Method)
+bool CSG_Classifier_Supervised::CClass::Train(void)
 {
-	switch( Method )
+	if( m_Samples.Get_NCols() < 1 || m_Samples.Get_NRows() < 1 )
 	{
-	case SG_CLASSIFY_SUPERVISED_BinaryEncoding:		return( _TL("Binary Encoding") );
-	case SG_CLASSIFY_SUPERVISED_ParallelEpiped:		return( _TL("Parallelepiped") );
-	case SG_CLASSIFY_SUPERVISED_MinimumDistance:	return( _TL("Minimum Distance") );
-	case SG_CLASSIFY_SUPERVISED_Mahalonobis:		return( _TL("Mahalanobis Distance") );
-	case SG_CLASSIFY_SUPERVISED_MaximumLikelihood:	return( _TL("Maximum Likelihood") );
-	case SG_CLASSIFY_SUPERVISED_SAM:				return( _TL("Spectral Angle Mapping") );
-	case SG_CLASSIFY_SUPERVISED_SID:				return( _TL("Spectral Information Divergence") );
-	case SG_CLASSIFY_SUPERVISED_SVM:				return( _TL("Support Vector Machine") );
-	case SG_CLASSIFY_SUPERVISED_WTA:				return( _TL("Winner Takes All") );
+		return( false );
 	}
 
-	return( SG_T("") );
+	int	iFeature;
+
+	//-----------------------------------------------------
+	m_Mean.Create(m_Samples.Get_NCols());
+	m_Min .Create(m_Samples.Get_NCols());
+	m_Max .Create(m_Samples.Get_NCols());
+
+	for(iFeature=0; iFeature<m_Samples.Get_NCols(); iFeature++)
+	{
+		CSG_Simple_Statistics	s;
+
+		for(int iSample=0; iSample<m_Samples.Get_NRows(); iSample++)
+		{
+			s	+= m_Samples[iSample][iFeature];
+		}
+
+		m_Mean[iFeature]	= s.Get_Mean   ();
+		m_Min [iFeature]	= s.Get_Minimum();
+		m_Max [iFeature]	= s.Get_Maximum();
+	}
+
+	//-----------------------------------------------------
+	m_Cov.Create(m_Samples.Get_NCols(), m_Samples.Get_NCols());
+
+	for(iFeature=0; iFeature<m_Samples.Get_NCols(); iFeature++)
+	{
+		for(int jFeature=iFeature; jFeature<m_Samples.Get_NCols(); jFeature++)
+		{
+			double	cov	= 0.0;
+
+			for(int iSample=0; iSample<m_Samples.Get_NRows(); iSample++)
+			{
+				cov	+= (m_Samples[iSample][iFeature] - m_Mean[iFeature]) * (m_Samples[iSample][jFeature] - m_Mean[jFeature]); 
+			}
+
+			if( m_Samples.Get_NRows() > 1 )
+			{
+				cov	/= m_Samples.Get_NRows() - 1;
+			}
+
+			m_Cov[iFeature][jFeature]	= m_Cov[jFeature][iFeature]	= cov;
+		}
+	}
+
+	m_Cov_Inv	= m_Cov.Get_Inverse    ();
+	m_Cov_Det	= m_Cov.Get_Determinant();
+
+	m_Mean_Spectral	= CSG_Simple_Statistics(m_Mean).Get_Mean();
+
+	//-----------------------------------------------------
+	return( true );
 }
 
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
 //---------------------------------------------------------
-CSG_String CSG_Classifier_Supervised::Get_Name_of_Quality(int Method)
+int CSG_Classifier_Supervised::Get_Class(const CSG_String &Class_ID)
 {
-	switch( Method )
+	if( m_nFeatures > 0 )
 	{
-	case SG_CLASSIFY_SUPERVISED_BinaryEncoding:		return( _TL("Difference") );
-	case SG_CLASSIFY_SUPERVISED_ParallelEpiped:		return( _TL("Memberships") );
-	case SG_CLASSIFY_SUPERVISED_MinimumDistance:	return( _TL("Distance") );
-	case SG_CLASSIFY_SUPERVISED_Mahalonobis:		return( _TL("Distance") );
-	case SG_CLASSIFY_SUPERVISED_MaximumLikelihood:	return( _TL("Proximity") );
-	case SG_CLASSIFY_SUPERVISED_SAM:				return( _TL("Angle") );
-	case SG_CLASSIFY_SUPERVISED_SID:				return( _TL("Divergence") );
-	case SG_CLASSIFY_SUPERVISED_SVM:				return( _TL("") );
-	case SG_CLASSIFY_SUPERVISED_WTA:				return( _TL("Votes") );
+		for(int iClass=0; iClass<Get_Class_Count(); iClass++)
+		{
+			if( !Get_Class_ID(iClass).Cmp(Class_ID) )
+			{
+				return( iClass );
+			}
+		}
 	}
 
-	return( SG_T("") );
+	return( -1 );
 }
 
 //---------------------------------------------------------
@@ -1124,30 +1458,66 @@ bool CSG_Classifier_Supervised::Get_Class(const CSG_Vector &Features, int &Class
 
 	if( Get_Feature_Count() == Features.Get_N() )
 	{
-		_Update();
-
 		switch( Method )
 		{
-		case SG_CLASSIFY_SUPERVISED_BinaryEncoding:		_Get_Binary_Encoding       (Features, Class, Quality);	break;
-		case SG_CLASSIFY_SUPERVISED_ParallelEpiped:		_Get_Parallel_Epiped       (Features, Class, Quality);	break;
-		case SG_CLASSIFY_SUPERVISED_MinimumDistance:	_Get_Minimum_Distance      (Features, Class, Quality);	break;
-		case SG_CLASSIFY_SUPERVISED_Mahalonobis:		_Get_Mahalanobis_Distance  (Features, Class, Quality);	break;
+		case SG_CLASSIFY_SUPERVISED_BinaryEncoding   :	_Get_Binary_Encoding       (Features, Class, Quality);	break;
+		case SG_CLASSIFY_SUPERVISED_ParallelEpiped   :	_Get_Parallel_Epiped       (Features, Class, Quality);	break;
+		case SG_CLASSIFY_SUPERVISED_MinimumDistance  :	_Get_Minimum_Distance      (Features, Class, Quality);	break;
+		case SG_CLASSIFY_SUPERVISED_Mahalonobis      :	_Get_Mahalanobis_Distance  (Features, Class, Quality);	break;
 		case SG_CLASSIFY_SUPERVISED_MaximumLikelihood:	_Get_Maximum_Likelihood    (Features, Class, Quality);	break;
-		case SG_CLASSIFY_SUPERVISED_SAM:				_Get_Spectral_Angle_Mapping(Features, Class, Quality);	break;
-		case SG_CLASSIFY_SUPERVISED_SID:				_Get_Spectral_Divergence   (Features, Class, Quality);	break;
-		case SG_CLASSIFY_SUPERVISED_WTA:				_Get_Winner_Takes_All      (Features, Class, Quality);	break;
+		case SG_CLASSIFY_SUPERVISED_SAM              :	_Get_Spectral_Angle_Mapping(Features, Class, Quality);	break;
+		case SG_CLASSIFY_SUPERVISED_SID              :	_Get_Spectral_Divergence   (Features, Class, Quality);	break;
+		case SG_CLASSIFY_SUPERVISED_WTA              :	_Get_Winner_Takes_All      (Features, Class, Quality);	break;
 		}
 
-		if( Class >= 0 )
-		{
-			m_nElements[Class]++;
-
-			return( true );
-		}
+		return( Class >= 0 );
 	}
 
 	return( false );
 }
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+CSG_String CSG_Classifier_Supervised::Get_Name_of_Method(int Method)
+{
+	switch( Method )
+	{
+	case SG_CLASSIFY_SUPERVISED_BinaryEncoding   :	return( _TL("Binary Encoding") );
+	case SG_CLASSIFY_SUPERVISED_ParallelEpiped   :	return( _TL("Parallelepiped") );
+	case SG_CLASSIFY_SUPERVISED_MinimumDistance  :	return( _TL("Minimum Distance") );
+	case SG_CLASSIFY_SUPERVISED_Mahalonobis      :	return( _TL("Mahalanobis Distance") );
+	case SG_CLASSIFY_SUPERVISED_MaximumLikelihood:	return( _TL("Maximum Likelihood") );
+	case SG_CLASSIFY_SUPERVISED_SAM              :	return( _TL("Spectral Angle Mapping") );
+	case SG_CLASSIFY_SUPERVISED_SID              :	return( _TL("Spectral Information Divergence") );
+	case SG_CLASSIFY_SUPERVISED_SVM              :	return( _TL("Support Vector Machine") );
+	case SG_CLASSIFY_SUPERVISED_WTA              :	return( _TL("Winner Takes All") );
+	}
+
+	return( SG_T("") );
+}
+
+//---------------------------------------------------------
+CSG_String CSG_Classifier_Supervised::Get_Name_of_Quality(int Method)
+{
+	switch( Method )
+	{
+	case SG_CLASSIFY_SUPERVISED_BinaryEncoding   :	return( _TL("Difference") );
+	case SG_CLASSIFY_SUPERVISED_ParallelEpiped   :	return( _TL("Memberships") );
+	case SG_CLASSIFY_SUPERVISED_MinimumDistance  :	return( _TL("Distance") );
+	case SG_CLASSIFY_SUPERVISED_Mahalonobis      :	return( _TL("Distance") );
+	case SG_CLASSIFY_SUPERVISED_MaximumLikelihood:	return( _TL("Proximity") );
+	case SG_CLASSIFY_SUPERVISED_SAM              :	return( _TL("Angle") );
+	case SG_CLASSIFY_SUPERVISED_SID              :	return( _TL("Divergence") );
+	case SG_CLASSIFY_SUPERVISED_SVM              :	return( _TL("") );
+	case SG_CLASSIFY_SUPERVISED_WTA              :	return( _TL("Votes") );
+	}
+
+	return( SG_T("") );
+}
 
 
 ///////////////////////////////////////////////////////////
@@ -1155,21 +1525,39 @@ bool CSG_Classifier_Supervised::Get_Class(const CSG_Vector &Features, int &Class
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
+// Mazer, A. S., Martin, M., Lee, M., and Solomon, J. E. (1988):
+// Image Processing Software for Imaging Spectrometry Analysis.
+// Remote Sensing of Environment, v. 24, no. 1, p. 201-210.
+//
 void CSG_Classifier_Supervised::_Get_Binary_Encoding(const CSG_Vector &Features, int &Class, double &Quality)
 {
 	for(int iClass=0; iClass<Get_Class_Count(); iClass++)
 	{
+		CClass	*pClass	= m_pClasses[iClass];
+
+		double	Mean_Spectral	= CSG_Simple_Statistics(Features).Get_Mean();
+
 		int		d	= 0;
 
 		for(int iFeature=0; iFeature<Get_Feature_Count(); iFeature++)
 		{
-			if(	(Features(iFeature) < m_BE_m[iClass]) != (m_BE_s[iClass][iFeature] != 0.0) )
+			d	+= (Features(iFeature) < Mean_Spectral) == (pClass->m_Mean[iFeature] < pClass->m_Mean_Spectral) ? 0 : 1;
+
+			if( iFeature == 0 )	// spectral slopes
+			{
+				d	+= (Features[iFeature    ] < Features[iFeature + 1]) == (pClass->m_Mean[iFeature    ] < pClass->m_Mean[iFeature + 1]) ? 0 : 1;
+			}
+			else if( iFeature == Get_Feature_Count() - 1 )
+			{
+				d	+= (Features[iFeature - 1] < Features[iFeature    ]) == (pClass->m_Mean[iFeature - 1] < pClass->m_Mean[iFeature    ]) ? 0 : 1;
+			}
+			else
 			{
-				d	++;
+				d	+= (Features[iFeature - 1] < Features[iFeature + 1]) == (pClass->m_Mean[iFeature - 1] < pClass->m_Mean[iFeature + 1]) ? 0 : 1;
 			}
 		}
 
-		if( Class < 0 || Quality < d )
+		if( Class < 0 || Quality > d )	// find the minimum 'Hamming' distance
 		{
 			Quality	= d;
 			Class	= iClass;
@@ -1182,17 +1570,13 @@ void CSG_Classifier_Supervised::_Get_Parallel_Epiped(const CSG_Vector &Features,
 {
 	for(int iClass=0; iClass<Get_Class_Count(); iClass++)
 	{
+		CClass	*pClass	= m_pClasses[iClass];
+
 		bool	bMember	= true;
 
 		for(int iFeature=0; bMember && iFeature<Get_Feature_Count(); iFeature++)
 		{
-			double	d	= Features(iFeature);
-
-			if(	d < m_Statistics[iClass][iFeature].Get_Minimum()
-			||	d > m_Statistics[iClass][iFeature].Get_Maximum() )
-			{
-				bMember	= false;
-			}
+			bMember	= pClass->m_Min[iFeature] <= Features[iFeature] && Features[iFeature] <= pClass->m_Max[iFeature];
 		}
 
 		if( bMember )
@@ -1208,23 +1592,18 @@ void CSG_Classifier_Supervised::_Get_Minimum_Distance(const CSG_Vector &Features
 {
 	for(int iClass=0; iClass<Get_Class_Count(); iClass++)
 	{
-		double	d	= 0.0;
+		CClass	*pClass	= m_pClasses[iClass];
 
-		for(int iFeature=0; iFeature<Get_Feature_Count(); iFeature++)
-		{
-			d	+= SG_Get_Square(Features(iFeature) - m_Statistics[iClass][iFeature].Get_Mean());
-		}
+		double	Distance	= (Features - pClass->m_Mean).Get_Length();
 
-		if( Class < 0 || Quality > d )
+		if( Class < 0 || Quality > Distance )
 		{
-			Quality	= d;
+			Quality	= Distance;
 			Class	= iClass;
 		}
 	}
 
-	Quality	= sqrt(Quality);
-
-	if( m_Distance_Threshold > 0.0 && Quality > m_Distance_Threshold )
+	if( m_Threshold_Distance > 0.0 && Quality > m_Threshold_Distance )
 	{
 		Class	= -1;
 	}
@@ -1235,23 +1614,20 @@ void CSG_Classifier_Supervised::_Get_Mahalanobis_Distance(const CSG_Vector &Feat
 {
 	for(int iClass=0; iClass<Get_Class_Count(); iClass++)
 	{
-		double	d	= 0.0;
+		CClass	*pClass	= m_pClasses[iClass];
 
-		for(int iFeature=0; iFeature<Get_Feature_Count(); iFeature++)
-		{
-			d	+= SG_Get_Square((Features(iFeature) - m_Statistics[iClass][iFeature].Get_Mean()) / m_Statistics[iClass][iFeature].Get_StdDev());
-		}
+		CSG_Vector	D	= Features - pClass->m_Mean;
 
-		if( Class < 0 || Quality > d )
+		double	Distance	= D * (pClass->m_Cov_Inv * D);
+
+		if( Class < 0 || Quality > Distance )
 		{
-			Quality	= d;
+			Quality	= Distance;
 			Class	= iClass;
 		}
 	}
 
-	Quality	= sqrt(Quality);
-
-	if( m_Distance_Threshold > 0.0 && Quality > m_Distance_Threshold )
+	if( m_Threshold_Distance > 0.0 && Quality > m_Threshold_Distance )
 	{
 		Class	= -1;
 	}
@@ -1264,38 +1640,35 @@ void CSG_Classifier_Supervised::_Get_Maximum_Likelihood(const CSG_Vector &Featur
 
 	for(int iClass=0; iClass<Get_Class_Count(); iClass++)
 	{
-		double	d	= 1.0;
+		CClass	*pClass	= m_pClasses[iClass];
 
-		for(int iFeature=0; iFeature<Get_Feature_Count(); iFeature++)
-		{
-			d	*= m_ML_a[iClass][iFeature] * exp(m_ML_b[iClass][iFeature] * SG_Get_Square(Features(iFeature) - m_Statistics[iClass][iFeature].Get_Mean()));
-		}
+		CSG_Vector	D	= Features - pClass->m_Mean;
 
-		dSum	+= (d	= pow(d, 1.0 / Get_Feature_Count()));
+		double	Distance	= D * (pClass->m_Cov_Inv * D);
 
-		/*
-		double	d	= 0.0;
+		double	Probability	= pow(2.0 * M_PI, -0.5 * m_nFeatures) * pow(pClass->m_Cov_Det, -0.5) * exp(-0.5 * Distance);
+	//	double	Probability	= -log(pClass->m_Cov_Det) - Distance;
 
-		for(int iFeature=0; iFeature<Get_Feature_Count(); iFeature++)
-		{
-			d	+= SG_Get_Square((Features(iFeature) - m_Statistics[iClass][iFeature].Get_Mean()) / m_Statistics[iClass][iFeature].Get_StdDev());
-		}
+		dSum	+= Probability;
 
-		dSum	+= (d	= m_ML_s[iClass] * exp(-0.5 * d));
-		*/
-
-		if( Quality < d )
+		if( Class < 0 || Quality < Probability )
 		{
-			Quality	= d;
+			Quality	= Probability;
 			Class	= iClass;
 		}
 	}
 
-	Quality	= m_Probability_Relative ? 100.0 * Quality / dSum : 100.0 * Quality;
-
-	if( m_Probability_Threshold > 0.0 && Quality < m_Probability_Threshold )
+	if( Class >= 0 )
 	{
-		Class	= -1;
+		if( m_Probability_Relative )
+		{
+			Quality	= 100.0 * Quality / dSum;
+		}
+
+		if( m_Threshold_Probability > 0.0 && Quality < m_Threshold_Probability )
+		{
+			Class	= -1;
+		}
 	}
 }
 
@@ -1304,29 +1677,20 @@ void CSG_Classifier_Supervised::_Get_Spectral_Angle_Mapping(const CSG_Vector &Fe
 {
 	for(int iClass=0; iClass<Get_Class_Count(); iClass++)
 	{
-		double	d	= 0.0;
-		double	e	= 0.0;
+		CClass	*pClass	= m_pClasses[iClass];
 
-		for(int iFeature=0; iFeature<Get_Feature_Count(); iFeature++)
-		{
-			double	v	= Features(iFeature);
+		double	Angle	= Features.Get_Angle(pClass->m_Mean);
 
-			d	+= v * m_Statistics[iClass][iFeature].Get_Mean();
-			e	+= v*v;
-		}
-
-		d	= acos(d / (sqrt(e) * m_SAM_l[iClass]));
-
-		if( Class < 0 || Quality > d )
+		if( Class < 0 || Quality > Angle )
 		{
-			Quality	= d;
+			Quality	= Angle;
 			Class	= iClass;
 		}
 	}
 
 	Quality	*= M_RAD_TO_DEG;
 
-	if( m_Angle_Threshold > 0.0 && Quality > m_Angle_Threshold )
+	if( m_Threshold_Angle > 0.0 && Quality > m_Threshold_Angle )
 	{
 		Class	= -1;
 	}
diff --git a/src/saga_core/saga_api/mat_tools.h b/src/saga_core/saga_api/mat_tools.h
index ed776bb..11850ff 100644
--- a/src/saga_core/saga_api/mat_tools.h
+++ b/src/saga_core/saga_api/mat_tools.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: mat_tools.h 2208 2014-08-27 16:00:51Z oconrad $
+ * Version $Id: mat_tools.h 2452 2015-03-20 14:37:10Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -141,7 +141,8 @@
 //---------------------------------------------------------
 SAGA_API_DLL_EXPORT double		SG_Get_Square			(double Value);
 
-SAGA_API_DLL_EXPORT double		SG_Get_Rounded			(double Value, int Decimals = 0);
+SAGA_API_DLL_EXPORT double		SG_Get_Rounded							(double Value, int Decimals = 0);
+SAGA_API_DLL_EXPORT double		SG_Get_Rounded_To_SignificantFigures	(double Value, int Decimals);
 
 //---------------------------------------------------------
 SAGA_API_DLL_EXPORT int			SG_Get_Digit_Count		(int Number);
@@ -149,6 +150,11 @@ SAGA_API_DLL_EXPORT int			SG_Get_Digit_Count		(int Number);
 //---------------------------------------------------------
 SAGA_API_DLL_EXPORT	CSG_String	SG_Get_Double_asString	(double Number, int Width = -1, int Precision = -1, bool bScientific = false);
 
+//---------------------------------------------------------
+SAGA_API_DLL_EXPORT	int			SG_Compare_Int			(const void *a, const void *b);
+SAGA_API_DLL_EXPORT	int			SG_Compare_Double		(const void *a, const void *b);
+SAGA_API_DLL_EXPORT	int			SG_Compare_Char_Ptr		(const void *a, const void *b);
+
 
 ///////////////////////////////////////////////////////////
 //														 //
@@ -227,7 +233,7 @@ public:
 	bool						Add_Rows			(int nRows);
 	bool						Del_Rows			(int nRows);
 	bool						Add_Row				(double Value = 0.0);
-	bool						Del_Row				(void);
+	bool						Del_Row				(int iRow = -1);
 
 	int							Get_N				(void)	const	{	return( (int)Get_Size() );					}
 	size_t						Get_Size			(void)	const	{	return( m_Array.Get_Size() );				}
@@ -237,7 +243,8 @@ public:
 	double &					operator []			(int x)			{	return( Get_Data()[x] );	}
 	operator const double *							(void)	const	{	return( Get_Data() );		}
 
-	CSG_String					asString			(int Width = -1, int Precision = -1, bool bScientific = false)	const;
+	CSG_String					to_String			(int Width = -1, int Precision = -1, bool bScientific = false, const SG_Char *Separator = NULL)	const;
+	bool						from_String			(const CSG_String &String);
 
 	bool						is_Equal			(const CSG_Vector &Vector)	const;
 
@@ -271,6 +278,8 @@ public:
 	bool						Set_Zero			(void);
 	bool						Set_Unity			(void);
 
+	bool						Sort				(void);
+
 	double						Get_Length			(void)						const;
 	double						Get_Angle			(const CSG_Vector &Vector)	const;
 	CSG_Vector					Get_Unity			(void)						const;
@@ -349,7 +358,8 @@ public:
 	double						operator ()			(int y, int x)	const	{	return( m_z[y][x] );	}
 	double *					operator []			(int y)			const	{	return( m_z[y] );		}
 
-	CSG_String					asString			(int Width = -1, int Precision = -1, bool bScientific = false)	const;
+	CSG_String					to_String			(int Width = -1, int Precision = -1, bool bScientific = false, const SG_Char *Separator = NULL)	const;
+	bool						from_String			(const CSG_String &String);
 
 	bool						is_Square			(void)	const	{	return( m_nx > 0 && m_nx == m_ny );	}
 	bool						is_Equal			(const CSG_Matrix &Matrix)	const;
@@ -405,7 +415,7 @@ private:
 SAGA_API_DLL_EXPORT CSG_Matrix	operator *			(double Scalar, const CSG_Matrix &Matrix);
 
 //---------------------------------------------------------
-SAGA_API_DLL_EXPORT bool		SG_Matrix_LU_Decomposition	(int n,       int *Permutation,       double **Matrix                , bool bSilent = true);
+SAGA_API_DLL_EXPORT bool		SG_Matrix_LU_Decomposition	(int n,       int *Permutation,       double **Matrix                , bool bSilent = true, int *nRowChanges = NULL);
 SAGA_API_DLL_EXPORT bool		SG_Matrix_LU_Solve			(int n, const int *Permutation, const double **Matrix, double *Vector, bool bSilent = true);
 
 SAGA_API_DLL_EXPORT bool		SG_Matrix_Solve				(CSG_Matrix &Matrix, CSG_Vector &Vector, bool bSilent = true);
@@ -540,10 +550,12 @@ public:
 	CSG_Simple_Statistics(bool bHoldValues);
 	CSG_Simple_Statistics(const CSG_Simple_Statistics &Statistics);
 	CSG_Simple_Statistics(double Mean, double StdDev, sLong Count = 1000);
+	CSG_Simple_Statistics(const CSG_Vector &Values, bool bHoldValues = false);
 
 	bool						Create				(bool bHoldValues = false);
 	bool						Create				(const CSG_Simple_Statistics &Statistics);
 	bool						Create				(double Mean, double StdDev, sLong Count = 1000);
+	bool						Create				(const CSG_Vector &Values, bool bHoldValues = false);
 
 	void						Invalidate			(void);
 
@@ -560,6 +572,9 @@ public:
 	double						Get_Variance		(void)		{	if( !m_bEvaluated )	_Evaluate(); return( m_Variance	);	}
 	double						Get_StdDev			(void)		{	if( !m_bEvaluated )	_Evaluate(); return( m_StdDev	);	}
 
+	double						Get_Median			(void)		{	return( Get_Quantile(50.0) );	}
+	double						Get_Quantile		(double Quantile);
+
 	void						Add					(const CSG_Simple_Statistics &Statistics);
 
 	void						Add_Value			(double Value, double Weight = 1.0);
@@ -575,7 +590,7 @@ public:
 
 protected:
 
-	bool						m_bEvaluated;
+	bool						m_bEvaluated, m_bSorted;
 
 	sLong						m_nValues;
 
@@ -758,35 +773,41 @@ public:
 	void						Create						(int nFeatures);
 	void						Destroy						(void);
 
-	int							Get_Feature_Count			(void)			{	return( m_nFeatures );			}
+	bool						Load						(const CSG_String &File);
+	bool						Save						(const CSG_String &File, const SG_Char *Feature_Info = NULL);
 
-	int							Get_Element_Count			(int iClass)	{	return( m_nElements[iClass] );	}
-	void						Del_Element_Count			(void);
+	bool						Train_Clr_Samples			(void);
+	bool						Train_Add_Sample			(const CSG_String &Class_ID, const CSG_Vector &Features);
+	bool						Train						(bool bClr_Samples = false);
 
-	int							Get_Class_Count				(void)			{	return( m_IDs.Get_Count() );	}
-	const CSG_String &			Get_Class_ID				(int iClass)	{	return( m_IDs[iClass] );		}
+	bool						Add_Class					(const CSG_String &Class_ID, const CSG_Vector &Mean, const CSG_Vector &Min, const CSG_Vector &Max, const CSG_Matrix &Cov);
 
-	int							Get_Class					(const CSG_String &Class_ID);
+	CSG_String					Print						(void);
 
-	CSG_Simple_Statistics *		Get_Statistics				(const CSG_String &Class_ID);
-	CSG_Simple_Statistics *		Get_Statistics				(int iClass)	{	return( m_Statistics[iClass] );	}
-	CSG_Simple_Statistics *		operator []					(int iClass)	{	return( m_Statistics[iClass] );	}
+	//-----------------------------------------------------
+	int							Get_Feature_Count			(void)			{	return( m_nFeatures );				}
 
+	int							Get_Class_Count				(void)			{	return( m_nClasses );				}
+	const CSG_String &			Get_Class_ID				(int iClass)	{	return( m_pClasses[iClass]->m_ID );	}
+
+	int							Get_Class					(const CSG_String &Class_ID);
 	bool						Get_Class					(const CSG_Vector &Features, int &Class, double &Quality, int Method);
 
-	void						Set_Distance_Threshold		(double Value)	{	m_Distance_Threshold	= Value;	}
-	double						Get_Distance_Threshold		(void)			{	return( m_Distance_Threshold );		}
+	//-----------------------------------------------------
+	void						Set_Threshold_Distance		(double Value);
+	double						Get_Threshold_Distance		(void);
 
-	void						Set_Probability_Threshold	(double Value)	{	m_Probability_Threshold	= Value;	}
-	double						Get_Probability_Threshold	(void)			{	return( m_Probability_Threshold );	}
-	void						Set_Probability_Relative	(bool   Value)	{	m_Probability_Relative	= Value;	}
-	bool						Get_Probability_Relative	(void)			{	return( m_Probability_Relative );	}
+	void						Set_Threshold_Angle			(double Value);
+	double						Get_Threshold_Angle			(void);
 
-	void						Set_Angle_Threshold			(double Value)	{	m_Angle_Threshold		= Value;	}
-	double						Get_Angle_Threshold			(void)			{	return( m_Angle_Threshold );		}
+	void						Set_Threshold_Probability	(double Value);
+	double						Get_Threshold_Probability	(void);
 
-	void						Set_WTA						(int Method, bool bOn)	{	if( Method >= 0 && Method < SG_CLASSIFY_SUPERVISED_WTA ) m_bWTA[Method]	= bOn;		}
-	bool						Get_WTA						(int Method)			{	return( Method >= 0 && Method < SG_CLASSIFY_SUPERVISED_WTA ? m_bWTA[Method] : false );	}
+	void						Set_Probability_Relative	(bool   Value);
+	bool						Get_Probability_Relative	(void);
+
+	void						Set_WTA						(int Method, bool bOn);
+	bool						Get_WTA						(int Method);
 
 	static CSG_String			Get_Name_of_Method			(int Method);
 	static CSG_String			Get_Name_of_Quality			(int Method);
@@ -794,22 +815,36 @@ public:
 
 private:
 
-	bool						m_Probability_Relative, m_bWTA[SG_CLASSIFY_SUPERVISED_WTA];
+	//-----------------------------------------------------
+	class CClass
+	{
+	public:
+		CClass(const CSG_String &ID) : m_ID(ID)	{}
+
+		CSG_String				m_ID;
+
+		double					m_Cov_Det, m_Mean_Spectral;
+
+		CSG_Vector				m_Mean, m_Min, m_Max;
 
-	int							m_nFeatures, *m_nElements;
+		CSG_Matrix				m_Cov, m_Cov_Inv, m_Samples;
 
-	double						m_Distance_Threshold, m_Probability_Threshold, m_Angle_Threshold;
 
-	CSG_Strings					m_IDs;
+		bool					Train						(void);
+
+	};
+
+	//-----------------------------------------------------
+	bool						m_Probability_Relative, m_bWTA[SG_CLASSIFY_SUPERVISED_WTA];
 
-	CSG_Simple_Statistics		**m_Statistics;
+	int							m_nFeatures, m_nClasses;
 
-	CSG_Vector					m_ML_s, m_SAM_l, m_BE_m;
+	double						m_Threshold_Distance, m_Threshold_Probability, m_Threshold_Angle;
 
-	CSG_Matrix					m_ML_a, m_ML_b, m_BE_s;
+	CSG_String					m_Info;
 
+	CClass						**m_pClasses;
 
-	void						_Update						(void);
 
 	void						_Get_Binary_Encoding		(const CSG_Vector &Features, int &Class, double &Quality);
 	void						_Get_Parallel_Epiped		(const CSG_Vector &Features, int &Class, double &Quality);
@@ -1297,6 +1332,53 @@ protected:
 	bool						_Set_Step_Info		(const CSG_Matrix &X, double R2_prev, int iVariable, bool bIn);
 
 };
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+class SAGA_API_DLL_EXPORT CSG_Regression_Weighted
+{
+public:
+	CSG_Regression_Weighted(void);
+	virtual ~CSG_Regression_Weighted(void);
+
+	bool						Destroy				(void);
+
+	bool						Add_Sample			(double Weight, double Dependent, const CSG_Vector &Predictors);
+	int							Get_Sample_Count	(void)	const	{	return( m_Y.Get_NRows()     );	}
+	int							Get_Predictor_Count	(void)	const	{	return( m_Y.Get_NCols() - 1 );	}
+
+	bool						Calculate			(const CSG_Vector &Weights, const CSG_Vector &Dependents, const CSG_Matrix &Predictors);
+	bool						Calculate			(void);
+
+	double						Get_R2				(void)	const	{	return( m_r2   );	}
+	const CSG_Vector &			Get_RCoeff			(void)	const	{	return( m_b    );	}
+	double						Get_RCoeff			(int i)	const	{	return( m_b[i] );	}
+	double						operator []			(int i)	const	{	return( m_b[i] );	}
+
+	//-----------------------------------------------------
+	bool						Get_CrossValidation	(int nSubSamples = 0);
+
+	int							Get_CV_nSamples		(void)	const	{	return( m_CV_nSamples );	}
+	double						Get_CV_RMSE			(void)	const	{	return( m_CV_RMSE     );	}
+	double						Get_CV_NRMSE		(void)	const	{	return( m_CV_NRMSE    );	}
+	double						Get_CV_R2			(void)	const	{	return( m_CV_R2       );	}
+
+
+private:
+
+	int							m_CV_nSamples;
+
+	double						m_r2, m_CV_RMSE, m_CV_NRMSE, m_CV_R2;
+
+	CSG_Vector					m_x, m_w, m_b;
+
+	CSG_Matrix					m_Y;
+
+};
 
 
 ///////////////////////////////////////////////////////////
diff --git a/src/saga_core/saga_api/module.cpp b/src/saga_core/saga_api/module.cpp
index d194cba..54e635f 100644
--- a/src/saga_core/saga_api/module.cpp
+++ b/src/saga_core/saga_api/module.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: module.cpp 2327 2014-11-04 14:32:44Z oconrad $
+ * Version $Id: module.cpp 2432 2015-03-04 15:09:34Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -182,6 +182,39 @@ const CSG_String & CSG_Module::Get_Author(void) const
 	return( m_Author );
 }
 
+//---------------------------------------------------------
+CSG_String CSG_Module::Get_MenuPath(bool bSolved)
+{
+	if( !bSolved )
+	{
+		return( Get_MenuPath() );
+	}
+
+	CSG_String	Menu	= Get_MenuPath();
+
+	if( Menu.Length() > 1 && Menu[1] == ':' )
+	{
+		if( Menu[0] == 'A' || Menu[0] == 'a' )	// absolute menu path, overwrites library's default menu path
+		{
+			return( Menu.AfterFirst(':') );
+		}
+
+		Menu	= Menu.AfterFirst(':');	// Menu[0] == 'R' || Menu[0] == 'r'	// menu path explicitly declared as relative to library's default menu path
+	}
+
+	if( m_Library_Menu.is_Empty() )
+	{
+		return( Menu );
+	}
+
+	if( Menu.is_Empty() )
+	{
+		return( m_Library_Menu );
+	}
+
+	return( m_Library_Menu + "|" + Menu );
+}
+
 
 ///////////////////////////////////////////////////////////
 //														 //
@@ -444,6 +477,17 @@ bool CSG_Module::Dlg_Parameters(CSG_Parameters *pParameters, const CSG_String &C
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
+void CSG_Module::Set_Callback(bool bActive)
+{
+	Parameters.Set_Callback(bActive);
+
+	for(int i=0; i<m_npParameters; i++)
+	{
+		m_pParameters[i]->Set_Callback(bActive);
+	}
+}
+
+//---------------------------------------------------------
 void CSG_Module::Set_Manager(class CSG_Data_Manager *pManager)
 {
 	Parameters.Set_Manager(pManager);
@@ -469,21 +513,19 @@ bool CSG_Module::Settings_Push(CSG_Data_Manager *pManager)
 		m_Settings_Stack.Create(sizeof(CSG_Parameters *));
 	}
 
-	int	n	= m_Settings_Stack.Get_Size();
+	size_t	n	= m_Settings_Stack.Get_Size();
 
 	CSG_Parameters	**pP	= (CSG_Parameters **)m_Settings_Stack.Get_Array(n + 1 + m_npParameters);
 
 	if( pP )
 	{
-		pP[n++]	= new CSG_Parameters(Parameters);	Parameters.Restore_Defaults();
+		pP[n++]	= new CSG_Parameters(Parameters); Parameters.Restore_Defaults(true); Parameters.Set_Manager(pManager);
 
 		for(int i=0; i<m_npParameters; i++)
 		{
-			pP[n++]	= new CSG_Parameters(*m_pParameters[i]);	m_pParameters[i]->Restore_Defaults();
+			pP[n++]	= new CSG_Parameters(*m_pParameters[i]); m_pParameters[i]->Restore_Defaults(true); m_pParameters[i]->Set_Manager(pManager);
 		}
 
-		Set_Manager(pManager);
-
 		return( true );
 	}
 
@@ -497,16 +539,14 @@ bool CSG_Module::Settings_Pop(void)
 
 	if( pP && (int)m_Settings_Stack.Get_Size() >= 1 + m_npParameters )
 	{
-		int	n	= m_Settings_Stack.Get_Size() - 1;
+		size_t	n	= m_Settings_Stack.Get_Size() - 1;
 
 		for(int i=m_npParameters-1; i>=0; i--, n--)
 		{
-			m_pParameters[i]->Assign_Values(pP[n]); delete(pP[n]);
+			m_pParameters[i]->Assign_Values(pP[n]); m_pParameters[i]->Set_Manager(pP[n]->Get_Manager()); delete(pP[n]);
 		}
 
-		Set_Manager(pP[n]->Get_Manager());
-
-		Parameters.Assign_Values(pP[n]); delete(pP[n]);
+		Parameters.Assign_Values(pP[n]); Parameters.Set_Manager(pP[n]->Get_Manager()); delete(pP[n]);
 
 		m_Settings_Stack.Set_Array(n);
 
diff --git a/src/saga_core/saga_api/module.h b/src/saga_core/saga_api/module.h
index fce0587..671084e 100644
--- a/src/saga_core/saga_api/module.h
+++ b/src/saga_core/saga_api/module.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: module.h 2327 2014-11-04 14:32:44Z oconrad $
+ * Version $Id: module.h 2412 2015-02-17 22:18:08Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -205,6 +205,7 @@ public:
 	CSG_String					Get_Summary					(bool bParameters = true, const CSG_String &Menu = "", const CSG_String &Description = "", bool bXML = false);
 
 	virtual CSG_String			Get_MenuPath				(void)	{	return( SG_T("") );	}
+	virtual CSG_String			Get_MenuPath				(bool bSolved);
 
 	int							Get_Parameters_Count		(void)	{	return( m_npParameters );	}
 	CSG_Parameters *			Get_Parameters				(void)	{	return( &Parameters );	}
@@ -219,6 +220,7 @@ public:
 
 	bool						Update_Parameter_States		(void);
 
+	void						Set_Callback				(bool bActive = true);
 	void						Set_Manager					(class CSG_Data_Manager *pManager);
 
 	bool						Settings_Push				(class CSG_Data_Manager *pManager = NULL);
@@ -323,7 +325,7 @@ private:
 
 	CSG_Parameters				**m_pParameters;
 
-	CSG_String					m_ID, m_Library, m_File_Name, m_Author;
+	CSG_String					m_ID, m_Library, m_Library_Menu, m_File_Name, m_Author;
 
 
 	bool						_Synchronize_DataObjects	(void);
@@ -645,17 +647,18 @@ extern "C" _SAGA_DLL_EXPORT const SG_Char *					Get_Version			(void)\
 //---------------------------------------------------------
 #define MLB_INTERFACE_INITIALIZE	extern "C" _SAGA_DLL_EXPORT bool MLB_Initialize	(const SG_Char *File_Name)\
 {\
-	MLB_Interface.Set_File_Name(File_Name);\
-\
-	int		i	= 0;\
+	int		i;\
 \
-	while( MLB_Interface.Add_Module(Create_Module(i), i) ) i++;\
+	MLB_Interface.Set_File_Name(File_Name);\
 \
 	for(i=0; i<MLB_INFO_User; i++)\
 	{\
 		MLB_Interface.Set_Info(i, Get_Info(i));\
 	}\
 \
+	for(i=0; MLB_Interface.Add_Module(Create_Module(i), i); i++)\
+	{}\
+\
 	return( MLB_Interface.Get_Count() > 0 );\
 }\
 
diff --git a/src/saga_core/saga_api/module_chain.cpp b/src/saga_core/saga_api/module_chain.cpp
index 451caf7..cb4bb17 100644
--- a/src/saga_core/saga_api/module_chain.cpp
+++ b/src/saga_core/saga_api/module_chain.cpp
@@ -73,7 +73,10 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#define GET_XML_CONTENT(md, id, def)	(md(id) ? md(id)->Get_Content() : CSG_String(def))
+#define GET_XML_CONTENT(md, id, def)		(md(id) ? md(id)->Get_Content() : CSG_String(def))
+
+#define IS_TRUE_STRING(String)				(!String.CmpNoCase("true") || !String.CmpNoCase("1"))
+#define IS_TRUE_PROPERTY(Item, Property)	(Item.Cmp_Property(Property, "true") || Item.Cmp_Property(Property, "1"))
 
 
 ///////////////////////////////////////////////////////////
@@ -105,9 +108,17 @@ void CSG_Module_Chain::Reset(void)
 
 	m_Chain.Destroy();
 
+	m_Conditions.Destroy();
+
 	m_Menu.Clear();
 }
 
+//---------------------------------------------------------
+void CSG_Module_Chain::Set_Library_Menu(const CSG_String &Menu)
+{
+	m_Library_Menu	= Menu;
+}
+
 
 ///////////////////////////////////////////////////////////
 //														 //
@@ -151,27 +162,50 @@ bool CSG_Module_Chain::Create(const CSG_String &File)
 	{
 		const CSG_MetaData	&Parameter	= m_Chain["parameters"][i];
 
+		CSG_String	ID	= Parameter.Get_Property("varname");
+
+		if( ID.is_Empty() || Parameters(ID) )
+		{
+			continue;
+		}
+
+		//-------------------------------------------------
 		int			Constraint	= 0;
-		CSG_String	Value, ID	= Parameter.Get_Property("varname");
+		CSG_String	Value;
+		bool		bMin = false, bMax = false;
+		double		 Min = 0.0  ,  Max = 0.0;
 
 		if( Parameter.Cmp_Name("input") )
 		{
-			Constraint	= PARAMETER_INPUT;
+			Constraint	= IS_TRUE_PROPERTY(Parameter, "optional") ? PARAMETER_INPUT_OPTIONAL : PARAMETER_INPUT;
 		}
 		else if( Parameter.Cmp_Name("output") )
 		{
-			Constraint	= PARAMETER_OUTPUT;
+			Constraint	= IS_TRUE_PROPERTY(Parameter, "optional") ? PARAMETER_OUTPUT_OPTIONAL : PARAMETER_OUTPUT;
 		}
-		else if( Parameter.Cmp_Name("option") )
+		else if( Parameter.Cmp_Name("option") && Parameter("value") )
 		{
-			Value		= Parameter.Get_Content("value");
+			Value	= Parameter.Get_Content("value");
+
+			bMin	= Parameter["value"].Get_Property("min", Min);
+			bMax	= Parameter["value"].Get_Property("max", Max);
 		}
 
-		if( ID.is_Empty() || Parameters(ID) )
+		//-------------------------------------------------
+		if( Parameter("condition") )
 		{
-			continue;
+			CSG_MetaData	&Conditions	= *m_Conditions.Add_Child(ID);
+
+			for(int j=0; j<Parameter.Get_Children_Count(); j++)	// there might be more than one condition to be checked
+			{
+				if( Parameter[j].Cmp_Name("condition") )
+				{
+					Conditions.Add_Child(Parameter[j]);
+				}
+			}
 		}
 
+		//-------------------------------------------------
 		CSG_String	Name	= Parameter.Get_Content("name"       );
 		CSG_String	Desc	= Parameter.Get_Content("description");
 
@@ -194,20 +228,21 @@ bool CSG_Module_Chain::Create(const CSG_String &File)
 		case PARAMETER_TYPE_Shapes_List    : Parameters.Add_Shapes_List    (pParent, ID, Name, Desc, Constraint);	break;
 		case PARAMETER_TYPE_TIN_List       : Parameters.Add_TIN_List       (pParent, ID, Name, Desc, Constraint);	break;
 
-		case PARAMETER_TYPE_Bool           : Parameters.Add_Value          (pParent, ID, Name, Desc, PARAMETER_TYPE_Bool  ,!Value.CmpNoCase("TRUE"));	break;
-		case PARAMETER_TYPE_Int            : Parameters.Add_Value          (pParent, ID, Name, Desc, PARAMETER_TYPE_Int   , Value.asInt   ());	break;
-		case PARAMETER_TYPE_Double         : Parameters.Add_Value          (pParent, ID, Name, Desc, PARAMETER_TYPE_Double, Value.asDouble());	break;
-		case PARAMETER_TYPE_Degree         : Parameters.Add_Value          (pParent, ID, Name, Desc, PARAMETER_TYPE_Degree, Value.asDouble());	break;
+		case PARAMETER_TYPE_Bool           : Parameters.Add_Value          (pParent, ID, Name, Desc, PARAMETER_TYPE_Bool  , IS_TRUE_STRING(Value));	break;
+		case PARAMETER_TYPE_Int            : Parameters.Add_Value          (pParent, ID, Name, Desc, PARAMETER_TYPE_Int   , Value.asInt   (), Min, bMin, Max, bMax);	break;
+		case PARAMETER_TYPE_Double         : Parameters.Add_Value          (pParent, ID, Name, Desc, PARAMETER_TYPE_Double, Value.asDouble(), Min, bMin, Max, bMax);	break;
+		case PARAMETER_TYPE_Degree         : Parameters.Add_Value          (pParent, ID, Name, Desc, PARAMETER_TYPE_Degree, Value.asDouble(), Min, bMin, Max, bMax);	break;
 
 		case PARAMETER_TYPE_String         : Parameters.Add_String         (pParent, ID, Name, Desc, Value, false);	break;
 		case PARAMETER_TYPE_Text           : Parameters.Add_String         (pParent, ID, Name, Desc, Value,  true);	break;
 
-		case PARAMETER_TYPE_FilePath       : Parameters.Add_FilePath       (pParent, ID, Name, Desc, Value);	break;
+		case PARAMETER_TYPE_FilePath       : Parameters.Add_FilePath       (pParent, ID, Name, Desc, Parameter.Get_Content("filter"), Value,
+												 IS_TRUE_PROPERTY(Parameter, "save"), IS_TRUE_PROPERTY(Parameter, "directory"), IS_TRUE_PROPERTY(Parameter, "multiple" ));	break;
 
 		case PARAMETER_TYPE_Choice         : Parameters.Add_Choice         (pParent, ID, Name, Desc, Parameter.Get_Content("choices"))->Set_Value(Value);	break;
-		case PARAMETER_TYPE_Range          : Parameters.Add_Range          (pParent, ID, Name, Desc, Value.BeforeFirst(';').asDouble(), Value.AfterFirst (';').asDouble());	break;
+		case PARAMETER_TYPE_Range          : Parameters.Add_Range          (pParent, ID, Name, Desc, Value.BeforeFirst(';').asDouble(), Value.AfterFirst (';').asDouble(), Min, bMin, Max, bMax);	break;
 
-		case PARAMETER_TYPE_Table_Field    : Parameters.Add_Table_Field    (pParent, ID, Name, Desc, !Value.CmpNoCase("TRUE"));	break;
+		case PARAMETER_TYPE_Table_Field    : Parameters.Add_Table_Field    (pParent, ID, Name, Desc, (!Value.CmpNoCase("true") || !Value.CmpNoCase("1")));	break;
 		case PARAMETER_TYPE_Table_Fields   : Parameters.Add_Table_Fields   (pParent, ID, Name, Desc);	break;
 
 		case PARAMETER_TYPE_Grid_System    : Parameters.Add_Grid_System    (pParent, ID, Name, Desc);	break;
@@ -226,18 +261,48 @@ bool CSG_Module_Chain::Create(const CSG_String &File)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CSG_Module_Chain::On_Execute(void)
+int CSG_Module_Chain::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
 {
-	bool	bResult	= true;
-
-	if( Data_Initialize() )
+	for(int iParameter=0; iParameter<m_Conditions.Get_Children_Count(); iParameter++)
 	{
-		for(int i=0; i<m_Chain["tools"].Get_Children_Count() && bResult; i++)
+		const CSG_MetaData	&Conditions	= m_Conditions[iParameter];
+
+		if( pParameters->Get_Parameter(Conditions.Get_Name()) )
 		{
-			bResult	= Tool_Run(m_Chain["tools"][i]);
+			bool	bEnable	= true;
+
+			for(int iCondition=0; bEnable && iCondition<Conditions.Get_Children_Count(); iCondition++)
+			{
+				bEnable	= Check_Condition(Conditions[iCondition], pParameters);
+			}
+
+			pParameters->Get_Parameter(Conditions.Get_Name())->Set_Enabled(bEnable);
 		}
 	}
 
+	return( CSG_Module::On_Parameters_Enable(pParameters, pParameter) );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CSG_Module_Chain::On_Execute(void)
+{
+	bool	bResult	= Data_Initialize();
+
+	if( !bResult )
+	{
+		Error_Set(_TL("no data objects"));
+	}
+
+	for(int i=0; bResult && i<m_Chain["tools"].Get_Children_Count(); i++)
+	{
+		bResult	= Tool_Run(m_Chain["tools"][i]);
+	}
+
 	Data_Finalize();
 
 	return( bResult );
@@ -270,7 +335,11 @@ bool CSG_Module_Chain::Data_Add(const CSG_String &ID, CSG_Parameter *pData)
 	case PARAMETER_TYPE_Shapes_List    : m_Data.Add_Shapes_List    (NULL, ID, "", "", 0)->Assign(pData);	break;
 	case PARAMETER_TYPE_TIN_List       : m_Data.Add_TIN_List       (NULL, ID, "", "", 0)->Assign(pData);	break;
 
-	default: return( false );
+	case PARAMETER_TYPE_DataObject_Output:
+		return( true );
+
+	default:
+		return( false );
 	}
 
 	if( pData->is_DataObject() )
@@ -320,12 +389,17 @@ bool CSG_Module_Chain::Data_Initialize(void)
 {
 	m_Data.Set_Manager(NULL);
 
+	bool	bResult	= false;
+
 	for(int i=0; i<Parameters.Get_Count(); i++)
 	{
-		Data_Add(Parameters(i)->Get_Identifier(), Parameters(i));
+		if( Data_Add(Parameters(i)->Get_Identifier(), Parameters(i)) )
+		{
+			bResult	= true;
+		}
 	}
 
-	return( m_Data.Get_Count() > 0 );
+	return( bResult );
 }
 
 //---------------------------------------------------------
@@ -395,9 +469,150 @@ bool CSG_Module_Chain::Data_Finalize(void)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
+bool CSG_Module_Chain::Check_Condition(const CSG_MetaData &Condition, CSG_Parameters *pData)
+{
+	//-----------------------------------------------------
+	CSG_String	Type, Value;
+
+	if( !Condition.Cmp_Name("condition") || !Condition.Get_Property("type", Type) )
+	{
+		return( true );
+	}
+
+	if( !Condition.Get_Property("variable", Value) )
+	{
+		Value	= Condition.Get_Content();
+	}
+
+	//-----------------------------------------------------
+	if( !Type.CmpNoCase("has_gui"   ) )	// executed from saga_gui ? (tool might offer different parameters if called from saga_cmd, python etc.)
+	{
+		return( IS_TRUE_STRING(Value) ? SG_UI_Get_Window_Main() != NULL : SG_UI_Get_Window_Main() == NULL );
+	}
+
+	//-----------------------------------------------------
+	if( !Type.CmpNoCase("exists"    ) )	// data object exists
+	{
+		CSG_Parameter	*pParameter	= pData->Get_Parameter(Value);
+
+		return( pParameter && ((pParameter->is_DataObject() && pParameter->asDataObject()) || (pParameter->is_DataObject_List() && pParameter->asList()->Get_Count())) );
+	}
+
+	if( !Type.CmpNoCase("not_exists") )	// data object does not exist
+	{
+		return( pData->Get_Parameter(Value) == NULL );
+	}
+
+	//-----------------------------------------------------
+	CSG_Parameter	*pOption	= Parameters(Value);
+
+	if( pOption == NULL )
+	{
+		return( true );
+	}
+
+	switch( pOption->Get_Type() )
+	{
+	//-----------------------------------------------------
+	case PARAMETER_TYPE_Bool    :
+		{
+			CSG_String	Value;
+
+			if( Condition.Get_Property("value", Value) )
+			{
+				if(      !Type.CmpNoCase("=") || !Type.CmpNoCase("equal"    ) )	{	if( IS_TRUE_STRING(Value) == pOption->asBool() )	{	return( false );	}	}
+				else if( !Type.CmpNoCase("!") || !Type.CmpNoCase("not_equal") )	{	if( IS_TRUE_STRING(Value) != pOption->asBool() )	{	return( false );	}	}
+			}
+		}
+		break;
+
+	//-----------------------------------------------------
+	case PARAMETER_TYPE_Int     :
+	case PARAMETER_TYPE_Color   :
+	case PARAMETER_TYPE_Choice  :
+		{
+			int		Value;
+
+			if( Condition.Get_Property("value", Value) )
+			{
+				if(      !Type.CmpNoCase("=") || !Type.CmpNoCase("equal"    ) )	{	if( Value != pOption->asInt() )	{	return( false );	}	}
+				else if( !Type.CmpNoCase("!") || !Type.CmpNoCase("not_equal") )	{	if( Value == pOption->asInt() )	{	return( false );	}	}
+				else if( !Type.CmpNoCase("<") || !Type.CmpNoCase("less"     ) )	{	if( Value >= pOption->asInt() )	{	return( false );	}	}
+				else if( !Type.CmpNoCase(">") || !Type.CmpNoCase("greater"  ) )	{	if( Value <= pOption->asInt() )	{	return( false );	}	}
+			}
+		}
+		break;
+
+	//-----------------------------------------------------
+	case PARAMETER_TYPE_Double  :
+	case PARAMETER_TYPE_Degree  :
+		{
+			double	Value;
+
+			if( Condition.Get_Property("value", Value) )
+			{
+				if(      !Type.CmpNoCase("=") || !Type.CmpNoCase("equal"    ) )	{	if( Value != pOption->asDouble() )	{	return( false );	}	}
+				else if( !Type.CmpNoCase("!") || !Type.CmpNoCase("not_equal") )	{	if( Value == pOption->asDouble() )	{	return( false );	}	}
+				else if( !Type.CmpNoCase("<") || !Type.CmpNoCase("less"     ) )	{	if( Value >= pOption->asDouble() )	{	return( false );	}	}
+				else if( !Type.CmpNoCase(">") || !Type.CmpNoCase("greater"  ) )	{	if( Value <= pOption->asDouble() )	{	return( false );	}	}
+			}
+		}
+		break;
+
+	//-----------------------------------------------------
+	case PARAMETER_TYPE_String  :
+	case PARAMETER_TYPE_Text    :
+	case PARAMETER_TYPE_FilePath:
+		{
+			CSG_String	Value;
+
+			Condition.Get_Property("value", Value);	// no 'if', bcos empty string would return false !!
+
+			{
+				if(      !Type.CmpNoCase("=") || !Type.CmpNoCase("equal"    ) )	{	if( Value.Cmp(pOption->asString()) != 0 )	{	return( false );	}	}
+				else if( !Type.CmpNoCase("!") || !Type.CmpNoCase("not_equal") )	{	if( Value.Cmp(pOption->asString()) == 0 )	{	return( false );	}	}
+				else if( !Type.CmpNoCase("<") || !Type.CmpNoCase("less"     ) )	{	if( Value.Cmp(pOption->asString()) >= 0 )	{	return( false );	}	}
+				else if( !Type.CmpNoCase(">") || !Type.CmpNoCase("greater"  ) )	{	if( Value.Cmp(pOption->asString()) <= 0 )	{	return( false );	}	}
+			}
+		}
+		break;
+
+	//-----------------------------------------------------
+	default:
+		// nop
+		break;
+	}
+
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
 bool CSG_Module_Chain::Tool_Run(const CSG_MetaData &Tool)
 {
 	//-----------------------------------------------------
+	if( Tool.Cmp_Name("condition") )
+	{
+		if( !Check_Condition(Tool, &m_Data) )
+		{
+			return( true );
+		}
+
+		bool	bResult	= true;
+
+		for(int i=0; bResult && i<Tool.Get_Children_Count(); i++)
+		{
+			bResult	= Tool_Run(Tool[i]);
+		}
+
+		return( bResult );
+	}
+
+	//-----------------------------------------------------
 	if( !Tool.Cmp_Name("tool") || !Tool.Get_Property("library") || !Tool.Get_Property("module") )
 	{
 		Error_Set(_TL("invalid tool definition"));
@@ -410,8 +625,7 @@ bool CSG_Module_Chain::Tool_Run(const CSG_MetaData &Tool)
 
 	CSG_Module	*pModule;
 
-	if(	!(pModule = SG_Get_Module_Library_Manager().Get_Module(Tool.Get_Property("library"), Module        ))
-	&&  !(pModule = SG_Get_Module_Library_Manager().Get_Module(Tool.Get_Property("library"), Module.asInt())) )
+	if(	!(pModule = SG_Get_Module_Library_Manager().Get_Module(Tool.Get_Property("library"), Module)) )
 	{
 		Error_Fmt("%s [%s].[%s]", _TL("could not find tool"),  Tool.Get_Property("library"), Module.c_str());
 
@@ -441,6 +655,28 @@ bool CSG_Module_Chain::Tool_Run(const CSG_MetaData &Tool)
 
 	return( bResult );
 }
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CSG_Module_Chain::Tool_Check_Condition(const CSG_MetaData &Tool)
+{
+	if( Tool("condition") )
+	{
+		for(int i=0; i<Tool.Get_Children_Count(); i++)	// there might be more than one condition to be checked
+		{
+			if( !Check_Condition(Tool[i], &m_Data) )
+			{
+				return( false );
+			}
+		}
+	}
+
+	return( true );
+}
 
 
 ///////////////////////////////////////////////////////////
@@ -448,28 +684,52 @@ bool CSG_Module_Chain::Tool_Run(const CSG_MetaData &Tool)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
+bool CSG_Module_Chain::Tool_Get_Parameter(const CSG_MetaData &Parameter, CSG_Module *pModule, CSG_Parameter **ppParameter, CSG_Parameter **ppParameters)
+{
+	CSG_String	ID	= Parameter.Get_Property("id");
+
+	*ppParameters	= NULL;
+
+	CSG_Parameter	*pParameters	= pModule->Get_Parameters()->Get_Parameter(Parameter.Get_Property("parms"));
+
+	if( pParameters && pParameters->Get_Type() == PARAMETER_TYPE_Parameters && pParameters->asParameters()->Get_Parameter(ID) )
+	{
+		*ppParameters	= pParameters;
+		*ppParameter	= pParameters->asParameters()->Get_Parameter(ID);
+	}
+	else if( pModule->Get_Parameters(Parameter.Get_Property("parms")) )
+	{
+		*ppParameter	= pModule->Get_Parameters(Parameter.Get_Property("parms"))->Get_Parameter(ID);
+	}
+	else
+	{
+		*ppParameter	= pModule->Get_Parameters()->Get_Parameter(ID);
+	}
+
+	return( *ppParameter != NULL );
+}
+
+//---------------------------------------------------------
 bool CSG_Module_Chain::Tool_Initialize(const CSG_MetaData &Tool, CSG_Module *pModule)
 {
 	//-----------------------------------------------------
-	pModule->Get_Parameters()->Set_Callback();	// ???!!!
+	pModule->Set_Callback();	// ???!!!
 
 	int		i;
 
-	CSG_String	Tool_ID	= Tool.Get_Property("id");
-
 	//-----------------------------------------------------
 	for(i=0; i<Tool.Get_Children_Count(); i++)	// set data objects first
 	{
-		const CSG_MetaData	&Parameter	= Tool[i];
+		const CSG_MetaData	&Parameter	= Tool[i];	if( Parameter.Cmp_Name("condition") )	{	continue;	}
 
 		CSG_String	ID	= Parameter.Get_Property("id");
 
-		CSG_Parameter	*pParameter	= pModule->Get_Parameters(Parameter.Get_Property("parms"))
-			? pModule->Get_Parameters(Parameter.Get_Property("parms"))->Get_Parameter(ID)
-			: pModule->Get_Parameters()->Get_Parameter(ID);
+		CSG_Parameter	*pParameter, *pOwner;
 
-		if( !pParameter )
+		if( !Tool_Get_Parameter(Parameter, pModule, &pParameter, &pOwner) )
 		{
+			Error_Set(CSG_String::Format("%s: %s", _TL("parameter not found"), ID.c_str()));
+
 			return( false );
 		}
 		else if( Parameter.Cmp_Name("option") )
@@ -489,6 +749,8 @@ bool CSG_Module_Chain::Tool_Initialize(const CSG_MetaData &Tool, CSG_Module *pMo
 
 			if( !pData )	// each input for this tool should be available now !!!
 			{
+				Error_Set(CSG_String::Format("%s: %s", _TL("input"), ID.c_str()));
+
 				return( false );
 			}
 
@@ -498,6 +760,8 @@ bool CSG_Module_Chain::Tool_Initialize(const CSG_MetaData &Tool, CSG_Module *pMo
 				{
 					if( !pParameter->Assign(pData) )
 					{
+						Error_Set(CSG_String::Format("%s: %s", _TL("set input"), ID.c_str()));
+
 						return( false );
 					}
 				}
@@ -507,6 +771,11 @@ bool CSG_Module_Chain::Tool_Initialize(const CSG_MetaData &Tool, CSG_Module *pMo
 				}
 
 				pParameter->has_Changed();
+
+				if( pOwner )
+				{
+					pOwner->has_Changed();
+				}
 			}
 		}
 		else if( Parameter.Cmp_Name("output") )
@@ -521,15 +790,13 @@ bool CSG_Module_Chain::Tool_Initialize(const CSG_MetaData &Tool, CSG_Module *pMo
 	//-----------------------------------------------------
 	for(i=0; i<Tool.Get_Children_Count(); i++)	// now set options
 	{
-		const CSG_MetaData	&Parameter	= Tool[i];
+		const CSG_MetaData	&Parameter	= Tool[i];	if( Parameter.Cmp_Name("condition") )	{	continue;	}
 
 		CSG_String	ID	= Parameter.Get_Property("id");
 
-		CSG_Parameter	*pParameter	= pModule->Get_Parameters(Parameter.Get_Property("parms"))
-			? pModule->Get_Parameters(Parameter.Get_Property("parms"))->Get_Parameter(ID)
-			: pModule->Get_Parameters()->Get_Parameter(ID);
+		CSG_Parameter	*pParameter, *pOwner;
 
-		if( !pParameter )
+		if( !Tool_Get_Parameter(Parameter, pModule, &pParameter, &pOwner) )
 		{
 			return( false );
 		}
@@ -687,6 +954,8 @@ bool CSG_Module_Chains::Add_Module(CSG_Module_Chain *pModule)
 	m_pModules	= (CSG_Module_Chain **)SG_Realloc(m_pModules, (m_nModules + 1) * sizeof(CSG_Module_Chain *));
 	m_pModules[m_nModules++]	= pModule;
 
+	pModule->Set_Library_Menu(Get_Info(MLB_INFO_Menu_Path));
+
 	return( true );
 }
 
diff --git a/src/saga_core/saga_api/module_chain.h b/src/saga_core/saga_api/module_chain.h
index 686550b..ff3a3d5 100644
--- a/src/saga_core/saga_api/module_chain.h
+++ b/src/saga_core/saga_api/module_chain.h
@@ -99,13 +99,15 @@ public:
 
 	bool						is_Okay					(void)	const	{	return( m_Chain.Get_Children_Count() > 0 );	}
 
+	void						Set_Library_Menu		(const CSG_String &Menu);
 	virtual CSG_String			Get_MenuPath			(void)			{	return( m_Menu );	}
-
 	const CSG_String &			Get_Library_Name		(void)	const	{	return( m_Library_Name );	}
 
 
 protected:
 
+	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+
 	virtual bool				On_Execute				(void);
 
 
@@ -113,7 +115,7 @@ private:
 
 	CSG_String					m_Library_Name, m_Menu;
 
-	CSG_MetaData				m_Chain;
+	CSG_MetaData				m_Chain, m_Conditions;
 
 	CSG_Parameters				m_Data;
 
@@ -127,7 +129,11 @@ private:
 	bool						Data_Initialize			(void);
 	bool						Data_Finalize			(void);
 
+	bool						Check_Condition			(const CSG_MetaData &Condition, CSG_Parameters *pData);
+
 	bool						Tool_Run				(const CSG_MetaData &Tool);
+	bool						Tool_Check_Condition	(const CSG_MetaData &Tool);
+	bool						Tool_Get_Parameter		(const CSG_MetaData &Parameter, CSG_Module *pModule, CSG_Parameter **ppParameter, CSG_Parameter **ppParameters);
 	bool						Tool_Initialize			(const CSG_MetaData &Tool, CSG_Module *pModule);
 	bool						Tool_Finalize			(const CSG_MetaData &Tool, CSG_Module *pModule);
 
diff --git a/src/saga_core/saga_api/module_library.cpp b/src/saga_core/saga_api/module_library.cpp
index 09ae2de..dd7e91b 100644
--- a/src/saga_core/saga_api/module_library.cpp
+++ b/src/saga_core/saga_api/module_library.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: module_library.cpp 2313 2014-10-30 09:42:40Z oconrad $
+ * Version $Id: module_library.cpp 2378 2015-01-28 19:26:13Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -267,13 +267,13 @@ CSG_Module * CSG_Module_Library::Get_Module(int Index, TSG_Module_Type Type) con
 }
 
 //---------------------------------------------------------
-CSG_Module * CSG_Module_Library::Get_Module(const SG_Char *Name, TSG_Module_Type Type) const
+CSG_Module * CSG_Module_Library::Get_Module(const CSG_String &Module, TSG_Module_Type Type) const
 {
 	for(int i=0; i<Get_Count(); i++)
 	{
 		CSG_Module	*pModule	= Get_Module(i, Type);
 
-		if( pModule && (!pModule->Get_ID().Cmp(Name) || !pModule->Get_Name().Cmp(Name)) )
+		if( pModule && (!pModule->Get_ID().Cmp(Module) || !pModule->Get_Name().Cmp(Module)) )
 		{
 			return( pModule );
 		}
@@ -284,24 +284,24 @@ CSG_Module * CSG_Module_Library::Get_Module(const SG_Char *Name, TSG_Module_Type
 
 //---------------------------------------------------------
 CSG_Module_Grid * CSG_Module_Library::Get_Module_Grid(int Index) const
-{	return( (CSG_Module_Grid *)Get_Module(Index, MODULE_TYPE_Grid) );	}
+{	return( (CSG_Module_Grid *)Get_Module(Index , MODULE_TYPE_Grid) );	}
 
-CSG_Module_Grid * CSG_Module_Library::Get_Module_Grid(const SG_Char *Name) const
-{	return( (CSG_Module_Grid *)Get_Module(Name , MODULE_TYPE_Grid) );	}
+CSG_Module_Grid * CSG_Module_Library::Get_Module_Grid(const CSG_String &Module) const
+{	return( (CSG_Module_Grid *)Get_Module(Module, MODULE_TYPE_Grid) );	}
 
 //---------------------------------------------------------
 CSG_Module_Interactive * CSG_Module_Library::Get_Module_Interactive(int Index) const
-{	return( (CSG_Module_Interactive *)Get_Module(Index, MODULE_TYPE_Interactive) );	}
+{	return( (CSG_Module_Interactive *)Get_Module(Index , MODULE_TYPE_Interactive) );	}
 
-CSG_Module_Interactive * CSG_Module_Library::Get_Module_Interactive(const SG_Char *Name) const
-{	return( (CSG_Module_Interactive *)Get_Module(Name , MODULE_TYPE_Interactive) );	}
+CSG_Module_Interactive * CSG_Module_Library::Get_Module_Interactive(const CSG_String &Module) const
+{	return( (CSG_Module_Interactive *)Get_Module(Module, MODULE_TYPE_Interactive) );	}
 
 //---------------------------------------------------------
 CSG_Module_Grid_Interactive * CSG_Module_Library::Get_Module_Grid_Interactive(int Index) const
-{	return( (CSG_Module_Grid_Interactive *)Get_Module(Index, MODULE_TYPE_Grid_Interactive) );	}
+{	return( (CSG_Module_Grid_Interactive *)Get_Module(Index , MODULE_TYPE_Grid_Interactive) );	}
 
-CSG_Module_Grid_Interactive * CSG_Module_Library::Get_Module_Grid_Interactive(const SG_Char *Name) const
-{	return( (CSG_Module_Grid_Interactive *)Get_Module(Name , MODULE_TYPE_Grid_Interactive) );	}
+CSG_Module_Grid_Interactive * CSG_Module_Library::Get_Module_Grid_Interactive(const CSG_String &Module) const
+{	return( (CSG_Module_Grid_Interactive *)Get_Module(Module, MODULE_TYPE_Grid_Interactive) );	}
 
 
 ///////////////////////////////////////////////////////////
@@ -311,42 +311,12 @@ CSG_Module_Grid_Interactive * CSG_Module_Library::Get_Module_Grid_Interactive(co
 //---------------------------------------------------------
 CSG_String CSG_Module_Library::Get_Menu(int i) const
 {
-	CSG_String	Menu;
-
 	if( Get_Module(i) )
 	{
-		Menu	= Get_Module(i)->Get_MenuPath();
-
-		if( Menu.Length() > 2 && Menu[1] == ':' )
-		{
-			if( Menu[0] == 'A' || Menu[0] == 'a' )
-			{	// menu path is absolute, i.e. relative to top menu...
-				return( Menu.Right(2) + '|' + Get_Info(MLB_INFO_Name) );
-			}
-
-			Menu	= Menu.Right(2);	// menu path is relative to library menu...
-		}
-
-		CSG_String	Root(Get_Info(MLB_INFO_Menu_Path));
-
-		if( Menu.is_Empty() )
-		{
-			Menu	= Root;
-		}
-		else if( !Root.is_Empty() )
-		{
-			Menu	= Root + '|' + Menu;
-		}
-
-		if( Menu.Length() > 0 )
-		{
-			Menu	+= '|';
-		}
-
-		Menu	+= Get_Info(MLB_INFO_Name);
+		return( Get_Module(i)->Get_MenuPath(true) );
 	}
 
-	return( Menu );
+	return( "" );
 }
 
 
@@ -699,15 +669,15 @@ bool CSG_Module_Library_Manager::is_Loaded(CSG_Module_Library *pLibrary) const
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-CSG_Module * CSG_Module_Library_Manager::Get_Module(const SG_Char *Library, int Module)	const
+CSG_Module * CSG_Module_Library_Manager::Get_Module(const CSG_String &Library, int ID)	const
 {
 	CSG_Module_Library	*pLibrary	= Get_Library(Library, true);
 
-	return( pLibrary ? pLibrary->Get_Module(Module) : NULL );
+	return( pLibrary ? pLibrary->Get_Module(CSG_String::Format("%d", ID)) : NULL );
 }
 
 //---------------------------------------------------------
-CSG_Module * CSG_Module_Library_Manager::Get_Module(const SG_Char *Library, const SG_Char *Module)	const
+CSG_Module * CSG_Module_Library_Manager::Get_Module(const CSG_String &Library, const CSG_String &Module)	const
 {
 	CSG_Module_Library	*pLibrary	= Get_Library(Library, true);
 
@@ -770,7 +740,7 @@ CSG_String CSG_Module_Library_Manager::Get_Summary(int Format)	const
 		for(i=0; i<Get_Count(); i++)
 		{
 			s	+= CSG_String::Format(SG_T("<tr><td>%s</td><td>%d</td><td>%s</td><td>%s</td></tr>"),
-					SG_File_Get_Name(Get_Library(i)->Get_File_Name(), false).c_str(),
+					Get_Library(i)->Get_Library_Name().c_str(),
 					Get_Library(i)->Get_Count(),
 					Get_Library(i)->Get_Name().c_str(),
 					SG_File_Get_Path(Get_Library(i)->Get_File_Name()).c_str()
diff --git a/src/saga_core/saga_api/module_library.h b/src/saga_core/saga_api/module_library.h
index 8240037..e70c907 100644
--- a/src/saga_core/saga_api/module_library.h
+++ b/src/saga_core/saga_api/module_library.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: module_library.h 2282 2014-10-09 15:50:47Z oconrad $
+ * Version $Id: module_library.h 2378 2015-01-28 19:26:13Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -134,15 +134,15 @@ public:
 
 	virtual int						Get_Count			(void)	const	{	return( m_pInterface ? m_pInterface->Get_Count() : 0 );	}
 
-	virtual CSG_Module *			Get_Module			(int           Index, TSG_Module_Type Type = MODULE_TYPE_Base)	const;
-	virtual CSG_Module *			Get_Module			(const SG_Char *Name, TSG_Module_Type Type = MODULE_TYPE_Base)	const;
+	virtual CSG_Module *			Get_Module			(int               Index , TSG_Module_Type Type = MODULE_TYPE_Base)	const;
+	virtual CSG_Module *			Get_Module			(const CSG_String &Module, TSG_Module_Type Type = MODULE_TYPE_Base)	const;
 
-	CSG_Module_Grid *				Get_Module_Grid				(int           Index)	const;
-	CSG_Module_Grid *				Get_Module_Grid				(const SG_Char *Name)	const;
-	CSG_Module_Interactive *		Get_Module_Interactive		(int           Index)	const;
-	CSG_Module_Interactive *		Get_Module_Interactive		(const SG_Char *Name)	const;
-	CSG_Module_Grid_Interactive *	Get_Module_Grid_Interactive	(int           Index)	const;
-	CSG_Module_Grid_Interactive *	Get_Module_Grid_Interactive	(const SG_Char *Name)	const;
+	CSG_Module_Grid *				Get_Module_Grid				(int               Index )	const;
+	CSG_Module_Grid *				Get_Module_Grid				(const CSG_String &Module)	const;
+	CSG_Module_Interactive *		Get_Module_Interactive		(int               Index )	const;
+	CSG_Module_Interactive *		Get_Module_Interactive		(const CSG_String &Module)	const;
+	CSG_Module_Grid_Interactive *	Get_Module_Grid_Interactive	(int               Index )	const;
+	CSG_Module_Grid_Interactive *	Get_Module_Grid_Interactive	(const CSG_String &Module)	const;
 
 	virtual CSG_String				Get_File_Name		(int i)	const	{	return( "" );	}
 	virtual CSG_String				Get_Menu			(int i)	const;
@@ -198,8 +198,8 @@ public:
 
 	bool							is_Loaded			(CSG_Module_Library *pLibrary)	const;
 
-	CSG_Module *					Get_Module			(const SG_Char *Library, int            Module)	const;
-	CSG_Module *					Get_Module			(const SG_Char *Library, const SG_Char *Module)	const;
+	CSG_Module *					Get_Module			(const CSG_String &Library, int               ID    )	const;
+	CSG_Module *					Get_Module			(const CSG_String &Library, const CSG_String &Module)	const;
 
 	CSG_String						Get_Summary			(int Format = SG_SUMMARY_FMT_HTML)	const;
 	bool							Get_Summary			(const CSG_String &Path)			const;
diff --git a/src/saga_core/saga_api/module_library_interface.cpp b/src/saga_core/saga_api/module_library_interface.cpp
index d1aa6c8..28746e7 100644
--- a/src/saga_core/saga_api/module_library_interface.cpp
+++ b/src/saga_core/saga_api/module_library_interface.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: module_library_interface.cpp 2251 2014-09-24 15:46:10Z oconrad $
+ * Version $Id: module_library_interface.cpp 2378 2015-01-28 19:26:13Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -134,26 +134,22 @@ int CSG_Module_Library_Interface::Get_Count(void)
 //---------------------------------------------------------
 bool CSG_Module_Library_Interface::Add_Module(CSG_Module *pModule, int ID)
 {
-	if( pModule )
+	if( pModule == NULL )
 	{
-		if( pModule == MLB_INTERFACE_SKIP_MODULE )
-		{
-			pModule	= NULL;
-		}
-		else
-		{
-			pModule->m_ID.Printf(SG_T("%d"), ID);
-			pModule->m_Library		= Get_Info(MLB_INFO_Library);
-			pModule->m_File_Name	= Get_Info(MLB_INFO_File);
-		}
+		return( false );
+	}
 
+	if( pModule != MLB_INTERFACE_SKIP_MODULE )
+	{
+		pModule->m_ID.Printf(SG_T("%d"), ID);
+		pModule->m_Library		= Get_Info(MLB_INFO_Library);
+		pModule->m_Library_Menu	= Get_Info(MLB_INFO_Menu_Path);
+		pModule->m_File_Name	= Get_Info(MLB_INFO_File);
 		m_Modules				= (CSG_Module **)SG_Realloc(m_Modules, (m_nModules + 1) * sizeof(CSG_Module *));
 		m_Modules[m_nModules++]	= pModule;
-
-		return( true );
 	}
 
-	return( false );
+	return( true );
 }
 
 //---------------------------------------------------------
diff --git a/src/saga_core/saga_api/parameter.cpp b/src/saga_core/saga_api/parameter.cpp
index 1d803dc..db7943b 100644
--- a/src/saga_core/saga_api/parameter.cpp
+++ b/src/saga_core/saga_api/parameter.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: parameter.cpp 2256 2014-09-26 15:08:53Z oconrad $
+ * Version $Id: parameter.cpp 2415 2015-02-18 14:27:34Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -901,10 +901,18 @@ bool CSG_Parameters_Grid_Target::On_Parameters_Enable(CSG_Parameters *pParameter
   * Initializes the grid system from Extent and number of rows.
   * If bFitToCells is true, the extent is deflated by half a cell size,
   * so automatically adjusting the extent based on grid nodes to
-  * to an extent based on the grid cells.
+  * an extent based on the grid cells. If Rounding is greater than
+  * zero it specifies the number of significant figures to which
+  * the cell size is rounded and also adjuts the extent coordinates
+  * to be a multiple of cell size.
 */
-bool CSG_Parameters_Grid_Target::Set_User_Defined(CSG_Parameters *pParameters, const TSG_Rect &Extent, int Rows, bool bFitToCells)
+bool CSG_Parameters_Grid_Target::Set_User_Defined(CSG_Parameters *pParameters, const TSG_Rect &Extent, int Rows, bool bFitToCells, int Rounding)
 {
+	if( !SG_UI_Get_Window_Main() )	// no cancel button, so set parameters directly
+	{
+		pParameters	= m_pParameters;
+	}
+
 	if( !m_pParameters || !pParameters || m_pParameters->Get_Identifier().Cmp(pParameters->Get_Identifier()) )
 	{
 		return( false );
@@ -938,18 +946,34 @@ bool CSG_Parameters_Grid_Target::Set_User_Defined(CSG_Parameters *pParameters, c
 	//-----------------------------------------------------
 	m_bFitToCells	= bFitToCells;
 
-	double	Size	= r.Get_YRange() / Rows;
+	double	Size	= r.Get_YRange() / ((m_bFitToCells ? 1 : 0) + Rows);
+
+	if( Rounding > 0 )
+	{
+		Size	= SG_Get_Rounded_To_SignificantFigures(Size, Rounding);
+
+		r.m_rect.xMin	= Size * floor(r.m_rect.xMin / Size);
+		r.m_rect.yMin	= Size * floor(r.m_rect.yMin / Size);
+		r.m_rect.yMax	= Size * ceil (r.m_rect.yMax / Size);
+	}
 
+	//-----------------------------------------------------
 	int		Cols	= (bFitToCells ? 0 : 1) + (int)(r.Get_XRange() / Size);
 
-	pParameters->Get_Parameter(m_Prefix + "USER_XMIN")->Set_Value(r.Get_XMin());
-	pParameters->Get_Parameter(m_Prefix + "USER_XMAX")->Set_Value(r.Get_XMax());
-	pParameters->Get_Parameter(m_Prefix + "USER_YMIN")->Set_Value(r.Get_YMin());
-	pParameters->Get_Parameter(m_Prefix + "USER_YMAX")->Set_Value(r.Get_YMax());
-	pParameters->Get_Parameter(m_Prefix + "USER_SIZE")->Set_Value(Size);
-	pParameters->Get_Parameter(m_Prefix + "USER_COLS")->Set_Value(Cols);
-	pParameters->Get_Parameter(m_Prefix + "USER_ROWS")->Set_Value(Rows);
-	pParameters->Get_Parameter(m_Prefix + "USER_FITS")->Set_Value(m_bFitToCells);
+	r.m_rect.xMax	= r.Get_XMin() + Cols * Size;
+
+	bool	bCallback	= pParameters->Set_Callback(false);
+
+	pParameters->Set_Parameter(m_Prefix + "USER_XMIN", r.Get_XMin() );
+	pParameters->Set_Parameter(m_Prefix + "USER_XMAX", r.Get_XMax() );
+	pParameters->Set_Parameter(m_Prefix + "USER_YMIN", r.Get_YMin() );
+	pParameters->Set_Parameter(m_Prefix + "USER_YMAX", r.Get_YMax() );
+	pParameters->Set_Parameter(m_Prefix + "USER_SIZE", Size         );
+	pParameters->Set_Parameter(m_Prefix + "USER_COLS", Cols         );
+	pParameters->Set_Parameter(m_Prefix + "USER_ROWS", Rows         );
+	pParameters->Set_Parameter(m_Prefix + "USER_FITS", m_bFitToCells);
+
+	pParameters->Set_Callback(bCallback);
 
 	return( true );
 }
@@ -970,7 +994,63 @@ bool CSG_Parameters_Grid_Target::Set_User_Defined(CSG_Parameters *pParameters, d
 		Extent.m_rect.yMax	+= Size;
 	}
 
-	return( Set_User_Defined(pParameters, Extent, ny, bFitToCells) );
+	return( Set_User_Defined(pParameters, Extent, ny, bFitToCells, 0) );
+}
+
+//---------------------------------------------------------
+bool CSG_Parameters_Grid_Target::Set_User_Defined(CSG_Parameters *pParameters, CSG_Shapes *pPoints, int Scale, bool bFitToCells, int Rounding)
+{
+	if( !pPoints || pPoints->Get_Count() <= 0 || pPoints->Get_Extent().Get_Area() <= 0.0 )
+	{
+		return( false );
+	}
+
+	double	d	= sqrt(pPoints->Get_Extent().Get_Area() / pPoints->Get_Count());	// edge length of a square given as average area per point (cell size)
+
+	int	Rows	= (int)(0.5 + pPoints->Get_Extent().Get_YRange() / d);	if( Scale > 1 ) Rows *= Scale;
+
+	return( Set_User_Defined(pParameters, pPoints->Get_Extent(), Rows, bFitToCells, Rounding) );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CSG_Parameters_Grid_Target::Cmd_Update(const TSG_Rect &Extent)
+{
+	if( m_pParameters && !SG_UI_Get_Window_Main() )	// tool is run by saga_cmd ...
+	{
+		if( m_pParameters->Get_Manager() == &SG_Get_Data_Manager() )	// ... but tool is not run as part of a tool chain
+		{
+			Set_User_Defined(m_pParameters, Extent);
+
+			SG_UI_Dlg_Parameters(m_pParameters, m_pParameters->Get_Name());
+
+			return( true );
+		}
+	}
+
+	return( false );
+}
+
+//---------------------------------------------------------
+bool CSG_Parameters_Grid_Target::Cmd_Update(CSG_Shapes *pPoints)
+{
+	if( m_pParameters && !SG_UI_Get_Window_Main() )	// tool is run by saga_cmd ...
+	{
+		if( m_pParameters->Get_Manager() == &SG_Get_Data_Manager() )	// ... but tool is not run as part of a tool chain
+		{
+			Set_User_Defined(m_pParameters, pPoints);
+
+			SG_UI_Dlg_Parameters(m_pParameters, m_pParameters->Get_Name());
+
+			return( true );
+		}
+	}
+
+	return( false );
 }
 
 
diff --git a/src/saga_core/saga_api/parameter_data.cpp b/src/saga_core/saga_api/parameter_data.cpp
index efbd0fd..a463113 100644
--- a/src/saga_core/saga_api/parameter_data.cpp
+++ b/src/saga_core/saga_api/parameter_data.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: parameter_data.cpp 2310 2014-10-28 10:39:25Z oconrad $
+ * Version $Id: parameter_data.cpp 2432 2015-03-04 15:09:34Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -2474,7 +2474,10 @@ void CSG_Parameter_List::On_Assign(CSG_Parameter_Data *pSource)
 
 	for(int i=0; i<((CSG_Parameter_List *)pSource)->Get_Count(); i++)
 	{
-		Add_Item(((CSG_Parameter_List *)pSource)->asDataObject(i));
+		if( m_pOwner->Get_Manager() != &SG_Get_Data_Manager() || SG_Get_Data_Manager().Exists(((CSG_Parameter_List *)pSource)->asDataObject(i)) )
+		{
+			Add_Item(((CSG_Parameter_List *)pSource)->asDataObject(i));
+		}
 	}
 }
 
diff --git a/src/saga_core/saga_api/parameters.cpp b/src/saga_core/saga_api/parameters.cpp
index 5f98958..8318540 100644
--- a/src/saga_core/saga_api/parameters.cpp
+++ b/src/saga_core/saga_api/parameters.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: parameters.cpp 2237 2014-09-18 15:07:21Z oconrad $
+ * Version $Id: parameters.cpp 2432 2015-03-04 15:09:34Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -970,8 +970,12 @@ bool CSG_Parameters::Del_Parameters(void)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-void CSG_Parameters::Set_Callback_On_Parameter_Changed(TSG_PFNC_Parameter_Changed Callback)
+// Callback function used to react on parameter changes.
+// Return value is the previously set callback function.
+TSG_PFNC_Parameter_Changed CSG_Parameters::Set_Callback_On_Parameter_Changed(TSG_PFNC_Parameter_Changed Callback)
 {
+	TSG_PFNC_Parameter_Changed	Previous	= m_Callback;
+
 	m_Callback	= Callback;
 
 	for(int i=0; i<m_nParameters; i++)
@@ -981,11 +985,18 @@ void CSG_Parameters::Set_Callback_On_Parameter_Changed(TSG_PFNC_Parameter_Change
 			m_Parameters[i]->asParameters()->Set_Callback_On_Parameter_Changed(Callback);
 		}
 	}
+
+	return( Previous );
 }
 
 //---------------------------------------------------------
-void CSG_Parameters::Set_Callback(bool bActive)
+// If switched off parameter changes will not invoke a
+// consecutive call to the On_Parameter_Changed function.
+// Return value is the previous state.
+bool CSG_Parameters::Set_Callback(bool bActive)
 {
+	bool	bPrevious	= m_bCallback;
+
 	m_bCallback	= bActive;
 
 	for(int i=0; i<m_nParameters; i++)
@@ -995,6 +1006,8 @@ void CSG_Parameters::Set_Callback(bool bActive)
 			m_Parameters[i]->asParameters()->Set_Callback(bActive);
 		}
 	}
+
+	return( bPrevious );
 }
 
 //---------------------------------------------------------
@@ -1100,11 +1113,23 @@ bool CSG_Parameters::Set_Parameter(const CSG_String &Identifier, const SG_Char *
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-bool CSG_Parameters::Restore_Defaults(void)
+bool CSG_Parameters::Restore_Defaults(bool bClearData)
 {
 	for(int i=0; i<Get_Count(); i++)
 	{
 		m_Parameters[i]->Restore_Default();
+
+		if( bClearData )
+		{
+			if( m_Parameters[i]->is_DataObject() )
+			{
+				m_Parameters[i]->Set_Value(DATAOBJECT_NOTSET);
+			}
+			else if( m_Parameters[i]->is_DataObject_List() )
+			{
+				m_Parameters[i]->asList()->Del_Items();
+			}
+		}
 	}
 
 	return( true );
diff --git a/src/saga_core/saga_api/parameters.h b/src/saga_core/saga_api/parameters.h
index cf67a7b..1ad1df2 100644
--- a/src/saga_core/saga_api/parameters.h
+++ b/src/saga_core/saga_api/parameters.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: parameters.h 2265 2014-10-01 14:59:02Z oconrad $
+ * Version $Id: parameters.h 2432 2015-03-04 15:09:34Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -1198,8 +1198,12 @@ public:
 	bool						On_Parameter_Changed	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
 	bool						On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
 
-	bool						Set_User_Defined		(CSG_Parameters *pParameters, const TSG_Rect &Extent, int Rows = 0, bool bFitToCells = false);
+	bool						Set_User_Defined		(CSG_Parameters *pParameters, const TSG_Rect &Extent, int Rows = 0, bool bFitToCells = false, int Rounding = 2);
 	bool						Set_User_Defined		(CSG_Parameters *pParameters, double xMin, double yMin, double Size, int nx, int ny, bool bFitToCells = false);
+	bool						Set_User_Defined		(CSG_Parameters *pParameters, CSG_Shapes *pPoints, int Scale = 4  , bool bFitToCells = false, int Rounding = 2);
+
+	bool						Cmd_Update				(const TSG_Rect &Extent);
+	bool						Cmd_Update				(CSG_Shapes *pPoints);
 
 	CSG_Grid_System				Get_System				(void);
 
@@ -1397,8 +1401,8 @@ public:
 	void						Set_Enabled				(const CSG_String &Identifier, bool bEnabled = true);
 
 	//-----------------------------------------------------
-	void						Set_Callback_On_Parameter_Changed	(TSG_PFNC_Parameter_Changed pCallback);
-	void						Set_Callback			(bool bActive = true);
+	TSG_PFNC_Parameter_Changed	Set_Callback_On_Parameter_Changed	(TSG_PFNC_Parameter_Changed pCallback);
+	bool						Set_Callback			(bool bActive = true);
 
 	//-----------------------------------------------------
 	CSG_Parameters &			operator =				(const CSG_Parameters &Parameters)	{	Create(Parameters);	return( *this );	}
@@ -1475,7 +1479,7 @@ public:
 	bool						Set_Parameter			(const CSG_String &Identifier, void          *Value, int Type = PARAMETER_TYPE_Undefined);
 	bool						Set_Parameter			(const CSG_String &Identifier, const SG_Char *Value, int Type = PARAMETER_TYPE_Undefined);
 
-	bool						Restore_Defaults		(void);
+	bool						Restore_Defaults		(bool bClearData = false);
 
 	bool						Assign					(CSG_Parameters *pSource);
 	bool						Assign_Values			(CSG_Parameters *pSource);
diff --git a/src/saga_core/saga_api/pointcloud.cpp b/src/saga_core/saga_api/pointcloud.cpp
index 2dfc13e..72cd434 100644
--- a/src/saga_core/saga_api/pointcloud.cpp
+++ b/src/saga_core/saga_api/pointcloud.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: pointcloud.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: pointcloud.cpp 2436 2015-03-11 09:31:04Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -71,7 +71,11 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-#define POINTCLOUD_FILE_VERSION	"SGPC01"
+#define PC_FILE_VERSION		"SGPC01"
+
+#define PC_STR_NBYTES		32
+
+#define PC_GET_NBYTES(type)	(type == SG_DATATYPE_String ? PC_STR_NBYTES : (int)SG_Data_Type_Get_Size(type))
 
 
 ///////////////////////////////////////////////////////////
@@ -283,7 +287,7 @@ bool CSG_PointCloud::_Load(const CSG_String &File_Name)
 		return( false );
 	}
 
-	if( !Stream.Read(ID, 6) || strncmp(ID, POINTCLOUD_FILE_VERSION, 5) != 0 )
+	if( !Stream.Read(ID, 6) || strncmp(ID, PC_FILE_VERSION, 5) != 0 )
 	{
 		SG_UI_Msg_Add(_TL("failed"), false, SG_UI_MSG_STYLE_FAILURE);
 		SG_UI_Msg_Add_Error(_TL("incompatible file."));
@@ -404,7 +408,7 @@ bool CSG_PointCloud::_Save(const CSG_String &File_Name)
 
 	int		i, iBuffer, nPointBytes	= m_nPointBytes - 1;
 
-	Stream.Write((void *)POINTCLOUD_FILE_VERSION, 6);
+	Stream.Write((void *)PC_FILE_VERSION, 6);
 	Stream.Write(&nPointBytes	, sizeof(int));
 	Stream.Write(&m_nFields		, sizeof(int));
 
@@ -515,7 +519,7 @@ bool CSG_PointCloud::is_Compatible(CSG_PointCloud *pPointCloud) const
 //---------------------------------------------------------
 bool CSG_PointCloud::_Add_Field(const SG_Char *Name, TSG_Data_Type Type, int iField)
 {
-	if( !Name || SG_Data_Type_Get_Size(Type) <= 0 )
+	if( !Name || PC_GET_NBYTES(Type) <= 0 )
 	{
 		return( false );
 	}
@@ -528,14 +532,14 @@ bool CSG_PointCloud::_Add_Field(const SG_Char *Name, TSG_Data_Type Type, int iFi
 	m_Field_Name  [m_nFields]	= new CSG_String(Name);
 	m_Field_Type  [m_nFields]	= Type;
 	m_Field_Stats [m_nFields]	= new CSG_Simple_Statistics();
-	m_Field_Offset[m_nFields]	= m_nFields == 0 ? 1 : m_Field_Offset[m_nFields - 1] + (int)SG_Data_Type_Get_Size(m_Field_Type[m_nFields - 1]);
+	m_Field_Offset[m_nFields]	= m_nFields == 0 ? 1 : m_Field_Offset[m_nFields - 1] + PC_GET_NBYTES(m_Field_Type[m_nFields - 1]);
 
 	if( m_nFields == 0 )
 	{
 		m_nPointBytes	= 1;
 	}
 
-	m_nPointBytes	+= (int)SG_Data_Type_Get_Size(m_Field_Type[m_nFields]);
+	m_nPointBytes	+= PC_GET_NBYTES(m_Field_Type[m_nFields]);
 	m_nFields		++;
 
 	m_Shapes.Add_Field(Name, Type);
@@ -580,7 +584,7 @@ bool CSG_PointCloud::Del_Field(int iField)
 
 	//-----------------------------------------------------
 	m_nFields		--;
-	m_nPointBytes	-= (int)SG_Data_Type_Get_Size(m_Field_Type[iField]);
+	m_nPointBytes	-= PC_GET_NBYTES(m_Field_Type[iField]);
 
 	for(i=0; i<m_nRecords; i++)
 	{
@@ -605,7 +609,7 @@ bool CSG_PointCloud::Del_Field(int iField)
 		m_Field_Name  [i]	= m_Field_Name  [i + 1];
 		m_Field_Type  [i]	= m_Field_Type  [i + 1];
 		m_Field_Stats [i]	= m_Field_Stats [i + 1];
-		m_Field_Offset[i]	= m_Field_Offset[i - 1] + (int)SG_Data_Type_Get_Size(m_Field_Type[i - 1]);
+		m_Field_Offset[i]	= m_Field_Offset[i - 1] + PC_GET_NBYTES(m_Field_Type[i - 1]);
 	}
 
 	m_Field_Name	= (CSG_String            **)SG_Realloc(m_Field_Name  , m_nFields * sizeof(CSG_String *));
@@ -629,15 +633,16 @@ bool CSG_PointCloud::_Set_Field_Value(char *pPoint, int iField, double Value)
 		{
 		default:
 		case SG_DATATYPE_Undefined:	break;
-		case SG_DATATYPE_Byte:		*((BYTE   *)pPoint)	= (BYTE  )Value;	break;
-		case SG_DATATYPE_Char:		*((char   *)pPoint)	= (char  )Value;	break;
-		case SG_DATATYPE_Word:		*((WORD   *)pPoint)	= (WORD  )Value;	break;
-		case SG_DATATYPE_Short:		*((short  *)pPoint)	= (short )Value;	break;
-		case SG_DATATYPE_DWord:		*((DWORD  *)pPoint)	= (DWORD )Value;	break;
-		case SG_DATATYPE_Int:		*((int    *)pPoint)	= (int   )Value;	break;
-		case SG_DATATYPE_Long:		*((long   *)pPoint)	= (long  )Value;	break;
-		case SG_DATATYPE_Float:		*((float  *)pPoint)	= (float )Value;	break;
+		case SG_DATATYPE_Byte  :	*((BYTE   *)pPoint)	= (BYTE  )Value;	break;
+		case SG_DATATYPE_Char  :	*((char   *)pPoint)	= (char  )Value;	break;
+		case SG_DATATYPE_Word  :	*((WORD   *)pPoint)	= (WORD  )Value;	break;
+		case SG_DATATYPE_Short :	*((short  *)pPoint)	= (short )Value;	break;
+		case SG_DATATYPE_DWord :	*((DWORD  *)pPoint)	= (DWORD )Value;	break;
+		case SG_DATATYPE_Int   :	*((int    *)pPoint)	= (int   )Value;	break;
+		case SG_DATATYPE_Long  :	*((long   *)pPoint)	= (long  )Value;	break;
+		case SG_DATATYPE_Float :	*((float  *)pPoint)	= (float )Value;	break;
 		case SG_DATATYPE_Double:	*((double *)pPoint)	= (double)Value;	break;
+		case SG_DATATYPE_String:	sprintf(    pPoint, "%f"    , Value);	break;
 		}
 
 		m_Field_Stats[iField]->Invalidate();
@@ -653,20 +658,21 @@ double CSG_PointCloud::_Get_Field_Value(char *pPoint, int iField) const
 {
 	if( pPoint && iField >= 0 && iField < m_nFields )
 	{
-		pPoint	= ((char *)pPoint) + m_Field_Offset[iField];
+		pPoint	+= m_Field_Offset[iField];
 
 		switch( m_Field_Type[iField] )
 		{
 		case SG_DATATYPE_Undefined:		default:	break;
-		case SG_DATATYPE_Byte:			return( *((BYTE   *)pPoint) );
-		case SG_DATATYPE_Char:			return( *((char   *)pPoint) );
-		case SG_DATATYPE_Word:			return( *((WORD   *)pPoint) );
-		case SG_DATATYPE_Short:			return( *((short  *)pPoint) );
-		case SG_DATATYPE_DWord:			return( *((DWORD  *)pPoint) );
-		case SG_DATATYPE_Int:			return( *((int    *)pPoint) );
-		case SG_DATATYPE_Long:			return( *((long   *)pPoint) );
-		case SG_DATATYPE_Float:			return( *((float  *)pPoint) );
-		case SG_DATATYPE_Double:		return( *((double *)pPoint) );
+		case SG_DATATYPE_Byte  :	return( *((BYTE   *)pPoint) );
+		case SG_DATATYPE_Char  :	return( *((char   *)pPoint) );
+		case SG_DATATYPE_Word  :	return( *((WORD   *)pPoint) );
+		case SG_DATATYPE_Short :	return( *((short  *)pPoint) );
+		case SG_DATATYPE_DWord :	return( *((DWORD  *)pPoint) );
+		case SG_DATATYPE_Int   :	return( *((int    *)pPoint) );
+		case SG_DATATYPE_Long  :	return( *((long   *)pPoint) );
+		case SG_DATATYPE_Float :	return( *((float  *)pPoint) );
+		case SG_DATATYPE_Double:	return( *((double *)pPoint) );
+		case SG_DATATYPE_String:	return( atof(       pPoint) );
 		}
 	}
 
@@ -676,14 +682,23 @@ double CSG_PointCloud::_Get_Field_Value(char *pPoint, int iField) const
 //---------------------------------------------------------
 bool CSG_PointCloud::Set_Value(int iPoint, int iField, const SG_Char *Value)
 {
-	if( iPoint >= 0 && iPoint < m_nRecords && Value && *Value )
+	if( iPoint >= 0 && iPoint < m_nRecords && iField >= 0 && iField < m_nFields && Value && *Value )
 	{
-		double		d;
 		CSG_String	s(Value);
 
-		if( s.asDouble(d) )
+		if( m_Field_Type[iField] == SG_DATATYPE_String )
 		{
-			return( _Set_Field_Value(m_Points[iPoint], iField, d) );
+			memset(m_Points[iPoint] + m_Field_Offset[iField], 0, PC_STR_NBYTES);
+			memcpy(m_Points[iPoint] + m_Field_Offset[iField], s.b_str(), s.Length() > PC_STR_NBYTES ? PC_STR_NBYTES : s.Length());
+		}
+		else
+		{
+			double	d;
+
+			if( s.asDouble(d) )
+			{
+				return( _Set_Field_Value(m_Points[iPoint], iField, d) );
+			}
 		}
 	}
 
@@ -695,7 +710,20 @@ bool CSG_PointCloud::Get_Value(int iPoint, int iField, CSG_String &Value)	const
 {
 	if( iPoint >= 0 && iPoint < m_nRecords && iField >= 0 && iField < m_nFields )
 	{
-		Value.Printf(SG_T("%f"), _Get_Field_Value(m_Points[iPoint], iField));
+		if( m_Field_Type[iField] == SG_DATATYPE_String )
+		{
+			char	s[PC_STR_NBYTES + 1];
+
+			memcpy(s, m_Points[iPoint] + m_Field_Offset[iField], PC_STR_NBYTES);
+
+			s[PC_STR_NBYTES]	= '\0';
+
+			Value	= s;
+		}
+		else
+		{
+			Value.Printf("%f", _Get_Field_Value(m_Points[iPoint], iField));
+		}
 
 		return( true );
 	}
@@ -894,11 +922,15 @@ bool CSG_PointCloud::On_Update(void)
 
 		_Stats_Update(0);
 		_Stats_Update(1);
+		_Stats_Update(2);
 
 		m_Extent.Assign(
 			m_Field_Stats[0]->Get_Minimum(), m_Field_Stats[1]->Get_Minimum(),
 			m_Field_Stats[0]->Get_Maximum(), m_Field_Stats[1]->Get_Maximum()
 		);
+
+		m_ZMin = m_Field_Stats[2]->Get_Minimum();
+		m_ZMax = m_Field_Stats[2]->Get_Maximum();
 	}
 
 	return( true );
diff --git a/src/saga_core/saga_api/quadtree.cpp b/src/saga_core/saga_api/quadtree.cpp
index f6d2f11..288b132 100644
--- a/src/saga_core/saga_api/quadtree.cpp
+++ b/src/saga_core/saga_api/quadtree.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: quadtree.cpp 2142 2014-06-06 13:58:39Z oconrad $
+ * Version $Id: quadtree.cpp 2431 2015-03-03 17:21:59Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -169,7 +169,7 @@ bool CSG_PRQuadTree_Node::Add_Point(double x, double y, double z)
 		}
 
 		//-----------------------------------------------------
-		else if( m_pChildren[i]->is_Leaf() )
+		if( m_pChildren[i]->is_Leaf() )
 		{
 			CSG_PRQuadTree_Leaf	*pLeaf	= m_pChildren[i]->asLeaf();
 
@@ -202,7 +202,7 @@ bool CSG_PRQuadTree_Node::Add_Point(double x, double y, double z)
 		}
 
 		//-------------------------------------------------
-		else // if( m_pChildren[i]->is_Node() )
+	//	if( m_pChildren[i]->is_Node() )
 		{
 			return( ((CSG_PRQuadTree_Node *)m_pChildren[i])->Add_Point(x, y, z) );
 		}
@@ -323,7 +323,7 @@ void CSG_PRQuadTree::Destroy(void)
 		m_pRoot	= NULL;
 	}
 
-	m_nPoints		= 0;
+	m_nPoints	= 0;
 
 	m_Selection.Destroy();
 }
@@ -611,7 +611,7 @@ CSG_PRQuadTree_Leaf	* CSG_PRQuadTree::_Get_Nearest_Point(CSG_PRQuadTree_Item *pI
 //---------------------------------------------------------
 inline CSG_PRQuadTree::TLeaf * CSG_PRQuadTree::_Get_Selected(const CSG_Array &Selection, size_t i)	const
 {
-	return( i < Selection.Get_Size() ? ((TLeaf *)Selection.Get_Array()) + i : NULL );
+	return( (TLeaf *)Selection.Get_Entry(i) );
 }
 
 //---------------------------------------------------------
@@ -619,7 +619,7 @@ inline bool CSG_PRQuadTree::_Add_Selected(CSG_Array &Selection, CSG_PRQuadTree_L
 {
 	if( Selection.Inc_Array() )
 	{
-		TLeaf	*pL		= _Get_Selected(Selection, Selection.Get_Size() - 1);
+		TLeaf	*pL		= (TLeaf *)Selection.Get_Entry(Selection.Get_Size() - 1);
 
 		pL->pLeaf		= pLeaf;
 		pL->Distance	= Distance;
@@ -633,7 +633,7 @@ inline bool CSG_PRQuadTree::_Add_Selected(CSG_Array &Selection, CSG_PRQuadTree_L
 //---------------------------------------------------------
 inline bool CSG_PRQuadTree::_Set_Selected(CSG_Array &Selection, size_t i, CSG_PRQuadTree_Leaf *pLeaf, double Distance)	const
 {
-	TLeaf	*pL		= _Get_Selected(Selection, i);
+	TLeaf	*pL		= (TLeaf *)Selection.Get_Entry(i);
 
 	if( pL )
 	{
@@ -666,7 +666,14 @@ size_t CSG_PRQuadTree::Select_Nearest_Points(double x, double y, size_t maxPoint
 //---------------------------------------------------------
 size_t CSG_PRQuadTree::_Select_Nearest_Points(CSG_Array &Selection, double x, double y, size_t maxPoints, double Radius, int iQuadrant)	const
 {
-	Selection.Create(sizeof(TLeaf), 0, SG_ARRAY_GROWTH_3);
+	if( Selection.Get_Value_Size() != sizeof(TLeaf) )
+	{
+		Selection.Create(sizeof(TLeaf), 0, SG_ARRAY_GROWTH_3);
+	}
+	else
+	{
+		Selection.Set_Array(0, false);
+	}
 
 	if( m_pRoot )
 	{
@@ -820,3 +827,267 @@ size_t CSG_PRQuadTree::Get_Nearest_Points(CSG_Points_Z &Points, double x, double
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
+#include "parameters.h"
+
+//---------------------------------------------------------
+CSG_Parameters_Search_Points::CSG_Parameters_Search_Points(void)
+{
+	m_pParameters	= NULL;
+
+	Finalize();
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CSG_Parameters_Search_Points::Create(CSG_Parameters *pParameters, CSG_Parameter *pNode, int nPoints_Min)
+{
+	if( pParameters == NULL || m_pParameters != NULL )
+	{
+		return( false );
+	}
+
+	m_pParameters	= pParameters;
+
+	//-----------------------------------------------------
+	CSG_Parameter	*pSub;
+
+	pSub	= m_pParameters->Add_Choice(
+		pNode	, "SEARCH_RANGE"		, _TL("Search Range"),
+		_TL(""),
+		CSG_String::Format(SG_T("%s|%s|"),
+			_TL("local"),
+			_TL("global")
+		)
+	);
+
+	m_pParameters->Add_Value(
+		pSub	, "SEARCH_RADIUS"		, _TL("Maximum Search Distance"),
+		_TL("local maximum search distance given in map units"),
+		PARAMETER_TYPE_Double	, 1000.0, 0, true
+	);
+
+	pSub	= m_pParameters->Add_Choice(
+		pNode	, "SEARCH_POINTS_ALL"	, _TL("Number of Points"),
+		_TL(""),
+		CSG_String::Format(SG_T("%s|%s|"),
+			_TL("maximum number of nearest points"),
+			_TL("all points within search distance")
+		)
+	);
+
+	if( m_nPoints_Min >= 0 )
+	{
+		m_pParameters->Add_Value(
+			pSub	, "SEARCH_POINTS_MIN"	, _TL("Minimum"),
+			_TL("minimum number of points to use"),
+			PARAMETER_TYPE_Int, nPoints_Min, 1, true
+		);
+	}
+
+	m_pParameters->Add_Value(
+		pSub	, "SEARCH_POINTS_MAX"	, _TL("Maximum"),
+		_TL("maximum number of nearest points"),
+		PARAMETER_TYPE_Int, 20, 1, true
+	);
+
+	m_pParameters->Add_Choice(
+		pSub	, "SEARCH_DIRECTION"	, _TL("Direction"),
+		_TL(""),
+		CSG_String::Format(SG_T("%s|%s|"),
+			_TL("all directions"),
+			_TL("quadrants")
+		)
+	);
+
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CSG_Parameters_Search_Points::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+{
+	if( !m_pParameters || !pParameters || m_pParameters->Get_Identifier().Cmp(pParameters->Get_Identifier()) || !pParameter
+		|| !pParameter->asShapes() )
+	{
+		return( false );
+	}
+
+	pParameters->Set_Parameter("SEARCH_RADIUS", SG_Get_Rounded_To_SignificantFigures(
+		5 * sqrt(pParameter->asShapes()->Get_Extent().Get_Area() / pParameter->asShapes()->Get_Count()), 1
+	));
+
+	return( true );
+}
+
+//---------------------------------------------------------
+bool CSG_Parameters_Search_Points::On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
+{
+	if( !m_pParameters || !pParameters || m_pParameters->Get_Identifier().Cmp(pParameters->Get_Identifier()) || !pParameter )
+	{
+		return( false );
+	}
+
+	if(	!SG_STR_CMP(pParameter->Get_Identifier(), "SEARCH_RANGE") )
+	{
+		pParameters->Set_Enabled("SEARCH_RADIUS"    , pParameter->asInt() == 0);	// local
+		pParameters->Set_Enabled("SEARCH_POINTS_MIN", pParameter->asInt() == 0);	// when global, no minimum number of points
+	}
+
+	if(	!SG_STR_CMP(pParameter->Get_Identifier(), "SEARCH_POINTS_ALL") )
+	{
+		pParameters->Set_Enabled("SEARCH_POINTS_MAX", pParameter->asInt() == 0);	// maximum number of points
+		pParameters->Set_Enabled("SEARCH_DIRECTION" , pParameter->asInt() == 0);	// maximum number of points per quadrant
+	}
+
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CSG_Parameters_Search_Points::Do_Use_All(bool bUpdate)
+{
+	if( bUpdate && m_pParameters )
+	{
+		m_nPoints_Min	= m_pParameters->Get_Parameter("SEARCH_POINTS_MIN")
+						? m_pParameters->Get_Parameter("SEARCH_POINTS_MIN")->asInt   () : 0;
+		m_nPoints_Max	= m_pParameters->Get_Parameter("SEARCH_POINTS_ALL")->asInt   () == 0
+						? m_pParameters->Get_Parameter("SEARCH_POINTS_MAX")->asInt   () : 0;
+		m_Radius		= m_pParameters->Get_Parameter("SEARCH_RANGE"     )->asInt   () == 0
+						? m_pParameters->Get_Parameter("SEARCH_RADIUS"    )->asDouble() : 0.0;
+		m_Quadrant		= m_pParameters->Get_Parameter("SEARCH_DIRECTION" )->asInt   () == 0 ? -1 : 4;
+	}
+
+	return( m_nPoints_Max <= 0 && m_Radius <= 0.0 );
+}
+//---------------------------------------------------------
+bool CSG_Parameters_Search_Points::Initialize(CSG_Shapes *pPoints, int zField)
+{
+	Finalize();
+
+	if( !m_pParameters || !pPoints || pPoints->Get_Count() < 1 )
+	{
+		return( false );
+	}
+
+	if( Do_Use_All(true) )
+	{
+		m_pPoints	= pPoints;
+		m_zField	= zField;
+
+		return( true );
+	}
+
+	return( m_Search.Create(pPoints, zField) );
+}
+
+//---------------------------------------------------------
+bool CSG_Parameters_Search_Points::Finalize(void)
+{
+	m_pPoints	= NULL;
+	m_zField	= -1;
+
+	m_Radius	= 0.0;
+	m_nPoints	= m_nPoints_Min	= m_nPoints_Max = 0;
+	m_Quadrant	= -1;
+
+	m_Search.Destroy();
+
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+int CSG_Parameters_Search_Points::Set_Location(double x, double y)
+{
+	if( m_nPoints_Max > 0 || m_Radius > 0.0 )	// using search engine
+	{
+		m_nPoints	= m_Search.Select_Nearest_Points(x, y, m_nPoints_Max, m_Radius, m_Quadrant);
+	}
+	else										// without search engine
+	{
+		m_nPoints	= m_pPoints->Get_Count();
+	}
+
+	return( m_nPoints );
+}
+
+int CSG_Parameters_Search_Points::Set_Location(const TSG_Point &p)
+{
+	return( Set_Location(p.x, p.y) );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CSG_Parameters_Search_Points::Get_Point(int Index, double &x, double &y, double &z)
+{
+	if( m_pPoints )	// without search engine
+	{
+		CSG_Shape	*pPoint	= m_pPoints->Get_Shape(Index);
+
+		if( !pPoint || pPoint->is_NoData(m_zField) )
+		{
+			return( false );
+		}
+
+		x	= pPoint->Get_Point(0).x;
+		y	= pPoint->Get_Point(0).y;
+		z	= m_zField < 0 ? Index : pPoint->asDouble(m_zField);
+	}
+	else			// using search engine
+	{
+		if( !m_Search.Get_Selected_Point(Index, x, y, z) )
+		{
+			return( false );
+		}
+	}
+
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CSG_Parameters_Search_Points::Get_Points(double x, double y, CSG_Points_Z &Points)
+{
+	CSG_Point	p(x, y);
+
+	return( Get_Points(p, Points) );
+}
+
+//---------------------------------------------------------
+bool CSG_Parameters_Search_Points::Get_Points(const TSG_Point &p, CSG_Points_Z &Points)
+{
+	return( m_Search.Get_Nearest_Points(Points, p, m_nPoints_Max, m_Radius, m_Quadrant) >= m_nPoints_Min );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
diff --git a/src/saga_core/saga_api/saga_api.h b/src/saga_core/saga_api/saga_api.h
index 8c7855c..c7bae9d 100644
--- a/src/saga_core/saga_api/saga_api.h
+++ b/src/saga_core/saga_api/saga_api.h
@@ -127,9 +127,9 @@
 
 //---------------------------------------------------------
 #define SAGA_MAJOR_VERSION		2
-#define SAGA_MINOR_VERSION		1
-#define SAGA_RELEASE_NUMBER		4
-#define SAGA_VERSION			SG_T("2.1.4")
+#define SAGA_MINOR_VERSION		2
+#define SAGA_RELEASE_NUMBER		0
+#define SAGA_VERSION			SG_T("2.2.0")
 
 
 ///////////////////////////////////////////////////////////
diff --git a/src/saga_core/saga_api/shape_points.cpp b/src/saga_core/saga_api/shape_points.cpp
index 6b9a7e5..04895de 100644
--- a/src/saga_core/saga_api/shape_points.cpp
+++ b/src/saga_core/saga_api/shape_points.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: shape_points.cpp 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: shape_points.cpp 2486 2015-05-06 12:02:12Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -115,11 +115,20 @@ bool CSG_Shape_Points::On_Assign(CSG_Shape *pShape)
 {
 	Del_Parts();
 
+	TSG_Vertex_Type	Vertex_Type	= Get_Vertex_Type();
+
 	for(int iPart=0; iPart<pShape->Get_Part_Count(); iPart++)
 	{
 		for(int iPoint=0; iPoint<pShape->Get_Point_Count(iPart); iPoint++)
 		{
 			CSG_Shape::Add_Point(pShape->Get_Point(iPoint, iPart), iPart);
+
+			switch( Vertex_Type )
+			{
+			case SG_VERTEX_TYPE_XYZM:	CSG_Shape::Set_M(pShape->Get_M(iPoint, iPart), iPoint, iPart);
+			case SG_VERTEX_TYPE_XYZ :	CSG_Shape::Set_Z(pShape->Get_Z(iPoint, iPart), iPoint, iPart);
+			default:	break;
+			}
 		}
 	}
  
@@ -145,6 +154,23 @@ int CSG_Shape_Points::_Add_Part(void)
 }
 
 //---------------------------------------------------------
+int CSG_Shape_Points::Add_Part(CSG_Shape_Part *pPart)
+{
+	if( pPart )
+	{
+		for(int iPoint=0, iPart=Get_Part_Count(); iPoint<pPart->Get_Count(); iPoint++)
+		{
+			Add_Point(pPart->Get_Point(iPoint), iPart);
+
+			if( Get_Vertex_Type() != SG_VERTEX_TYPE_XY )
+				Set_Z(pPart->Get_Z(iPoint), Get_Point_Count(iPart) - 1, iPart);
+		}
+	}
+
+	return( m_nParts );
+}
+
+//---------------------------------------------------------
 int CSG_Shape_Points::Del_Part(int del_Part)
 {
 	if( del_Part >= 0 && del_Part < m_nParts )
diff --git a/src/saga_core/saga_api/shapes.h b/src/saga_core/saga_api/shapes.h
index 28eba3b..ae8535a 100644
--- a/src/saga_core/saga_api/shapes.h
+++ b/src/saga_core/saga_api/shapes.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: shapes.h 2181 2014-07-09 16:56:37Z oconrad $
+ * Version $Id: shapes.h 2475 2015-04-22 18:39:29Z oconrad $
  *********************************************************/
 ///////////////////////////////////////////////////////////
 //                                                       //
@@ -140,6 +140,7 @@ public:
 	virtual int					Ins_Point			(TSG_Point Point,    int iPoint, int iPart = 0);
 	virtual int					Set_Point			(TSG_Point Point,    int iPoint, int iPart = 0);
 
+	virtual int					Add_Part			(class CSG_Shape_Part *pPart)					= 0;
 	virtual int					Del_Part			(int iPart)										= 0;
 	virtual int					Del_Parts			(void)											= 0;
 
@@ -209,6 +210,7 @@ public:
 	virtual int					Set_Point			(double x, double y, int iPoint, int iPart = 0)		{	return( Add_Point(x, y) );	}
 	virtual int					Del_Point			(                    int iPoint, int iPart = 0)		{	return( -1 );				}
 
+	virtual int					Add_Part			(class CSG_Shape_Part *pPart)						{	return( -1 );				}
 	virtual int					Del_Part			(int iPart)											{	return( -1 );				}
 	virtual int					Del_Parts			(void)												{	return( -1 );				}
 
@@ -393,6 +395,7 @@ public:
 	int							Ins_Point			(const TSG_Point &p, int iPoint, int iPart = 0)	{	return( Ins_Point(p.x, p.y, iPoint, iPart) );	}
 	int							Set_Point			(const TSG_Point &p, int iPoint, int iPart = 0)	{	return( Set_Point(p.x, p.y, iPoint, iPart) );	}
 
+	virtual int					Add_Part			(class CSG_Shape_Part *pPart);
 	virtual int					Del_Part			(int iPart);
 	virtual int					Del_Parts			(void);
 
@@ -776,6 +779,8 @@ protected:
 		m_Size		= Size;
 	}
 
+	virtual ~CSG_PRQuadTree_Item(void)	{}
+
 
 	double					m_xCenter, m_yCenter, m_Size;
 
@@ -806,6 +811,8 @@ protected:
 		m_z			= z;
 	}
 
+	virtual ~CSG_PRQuadTree_Leaf(void)	{}
+
 
 	double					m_z;
 
@@ -843,6 +850,8 @@ protected:
 		s_z.Add_Value(z);
 	}
 
+	virtual ~CSG_PRQuadTree_Leaf_List(void)	{}
+
 	void					Add_Value		(double z)
 	{
 		s_z.Add_Value(z);
@@ -909,6 +918,8 @@ protected:
 		: CSG_PRQuadTree_Node(pLeaf)
 	{}
 
+	virtual ~CSG_PRQuadTree_Node_Statistics(void)	{}
+
 
 	CSG_Simple_Statistics	m_x, m_y, m_z;
 
@@ -1022,6 +1033,53 @@ private:
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
+class SAGA_API_DLL_EXPORT CSG_Parameters_Search_Points
+{
+public:
+	CSG_Parameters_Search_Points(void);
+
+	bool						Create					(CSG_Parameters *pParameters, CSG_Parameter *pNode = NULL, int nPoints_Min = -1);
+
+	bool						On_Parameter_Changed	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+	bool						On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
+
+	bool						Initialize				(CSG_Shapes *pPoints, int zField);
+	bool						Finalize				(void);
+
+	int							Set_Location			(double x, double y);
+	int							Set_Location			(const TSG_Point &p);
+
+	int							Get_Count				(void)	const	{	return( m_nPoints );	}
+	bool						Get_Point				(int Index, double &x, double &y, double &z);
+
+	bool						Get_Points				(double x, double y, CSG_Points_Z &Points);
+	bool						Get_Points				(const TSG_Point &p, CSG_Points_Z &Points);
+
+	bool						Do_Use_All				(bool bUpdate = false);
+
+
+private:
+
+	int							m_zField, m_nPoints, m_nPoints_Min, m_nPoints_Max, m_Quadrant;
+
+	double						m_Radius;
+
+	CSG_Shapes					*m_pPoints;
+
+	CSG_Parameters				*m_pParameters;
+
+	CSG_PRQuadTree				m_Search;
+
+};
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//					Search Engine						 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
 class SAGA_API_DLL_EXPORT CSG_Shapes_Search
 {
 public:
diff --git a/src/saga_core/saga_api/table.h b/src/saga_core/saga_api/table.h
index 400a5b2..1284806 100644
--- a/src/saga_core/saga_api/table.h
+++ b/src/saga_core/saga_api/table.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: table.h 2064 2014-03-21 13:20:57Z oconrad $
+ * Version $Id: table.h 2431 2015-03-03 17:21:59Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -156,8 +156,8 @@ public:
 	short						asShort			(const CSG_String &Field)	const	{	return( (short  )asInt   ( Field) );	}
 	int							asInt			(int              iField)	const;
 	int							asInt			(const CSG_String &Field)	const;
-	sLong						asLong			(int              iField)	const	{	return( (sLong  )asDouble(iField) );	}
-	sLong						asLong			(const CSG_String &Field)	const	{	return( (sLong  )asDouble( Field) );	}
+	sLong						asLong			(int              iField)	const;
+	sLong						asLong			(const CSG_String &Field)	const;
 	float						asFloat			(int              iField)	const	{	return( (float  )asDouble(iField) );	}
 	float						asFloat			(const CSG_String &Field)	const	{	return( (float  )asDouble( Field) );	}
 	double						asDouble		(int              iField)	const;
@@ -260,9 +260,11 @@ public:
 	bool							Set_Field_Name		(int iField, const SG_Char *Name);
 	bool							Set_Field_Type		(int iField, TSG_Data_Type  Type);
 
+	sLong							Get_N				(int iField)	const	{	return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_Count()    : 0   );	}
 	double							Get_Minimum			(int iField)	const	{	return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_Minimum()  : 0.0 );	}
 	double							Get_Maximum			(int iField)	const	{	return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_Maximum()  : 0.0 );	}
 	double							Get_Range			(int iField)	const	{	return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_Range()    : 0.0 );	}
+	double							Get_Sum				(int iField)	const	{	return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_Sum()      : 0.0 );	}
 	double							Get_Mean			(int iField)	const	{	return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_Mean()     : 0.0 );	}
 	double							Get_StdDev			(int iField)	const	{	return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_StdDev()   : 0.0 );	}
 	double							Get_Variance		(int iField)	const	{	return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_Variance() : 0.0 );	}
diff --git a/src/saga_core/saga_api/table_record.cpp b/src/saga_core/saga_api/table_record.cpp
index 9aa4246..db23590 100644
--- a/src/saga_core/saga_api/table_record.cpp
+++ b/src/saga_core/saga_api/table_record.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: table_record.cpp 2054 2014-03-18 09:49:22Z oconrad $
+ * Version $Id: table_record.cpp 2431 2015-03-03 17:21:59Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -129,19 +129,20 @@ CSG_Table_Value * CSG_Table_Record::_Create_Value(TSG_Data_Type Type)
 	default:
 	case SG_DATATYPE_String:	return( new CSG_Table_Value_String() );
 
-	case SG_DATATYPE_Date:		return( new CSG_Table_Value_Date() );
+	case SG_DATATYPE_Date  :	return( new CSG_Table_Value_Date  () );
 
-	case SG_DATATYPE_Color:
-	case SG_DATATYPE_Byte:
-	case SG_DATATYPE_Char:
-	case SG_DATATYPE_Word:
-	case SG_DATATYPE_Short:
-	case SG_DATATYPE_DWord:
-	case SG_DATATYPE_Int:
-	case SG_DATATYPE_ULong:
-	case SG_DATATYPE_Long:		return( new CSG_Table_Value_Int() );
+	case SG_DATATYPE_Color :
+	case SG_DATATYPE_Byte  :
+	case SG_DATATYPE_Char  :
+	case SG_DATATYPE_Word  :
+	case SG_DATATYPE_Short :
+	case SG_DATATYPE_DWord :
+	case SG_DATATYPE_Int   :	return( new CSG_Table_Value_Int   () );
 
-	case SG_DATATYPE_Float:
+	case SG_DATATYPE_ULong :
+	case SG_DATATYPE_Long  :	return( new CSG_Table_Value_Long  () );
+
+	case SG_DATATYPE_Float :
 	case SG_DATATYPE_Double:	return( new CSG_Table_Value_Double() );
 
 	case SG_DATATYPE_Binary:	return( new CSG_Table_Value_Binary() );
@@ -493,6 +494,17 @@ int CSG_Table_Record::asInt(const CSG_String &Field) const
 }
 
 //---------------------------------------------------------
+sLong CSG_Table_Record::asLong(int iField) const
+{
+	return( iField >= 0 && iField < m_pTable->Get_Field_Count() ? m_Values[iField]->asLong() : 0 );
+}
+
+sLong CSG_Table_Record::asLong(const CSG_String &Field) const
+{
+	return( asLong(_Get_Field(Field)) );
+}
+
+//---------------------------------------------------------
 double CSG_Table_Record::asDouble(int iField) const
 {
 	return( iField >= 0 && iField < m_pTable->Get_Field_Count() ? m_Values[iField]->asDouble() : 0.0 );
diff --git a/src/saga_core/saga_api/table_value.h b/src/saga_core/saga_api/table_value.h
index 846efe8..068203f 100644
--- a/src/saga_core/saga_api/table_value.h
+++ b/src/saga_core/saga_api/table_value.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: table_value.h 2161 2014-06-13 10:15:36Z oconrad $
+ * Version $Id: table_value.h 2431 2015-03-03 17:21:59Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -90,6 +90,7 @@ typedef enum ESG_Table_Value_Type
 	SG_TABLE_VALUE_TYPE_String,
 	SG_TABLE_VALUE_TYPE_Date,
 	SG_TABLE_VALUE_TYPE_Int,
+	SG_TABLE_VALUE_TYPE_Long,
 	SG_TABLE_VALUE_TYPE_Double
 }
 TSG_Table_Value_Type;
@@ -114,6 +115,7 @@ public:
 	virtual bool					Set_Value		(const CSG_Bytes &Value)	= 0;
 	virtual bool					Set_Value		(const SG_Char   *Value)	= 0;
 	virtual bool					Set_Value		(int              Value)	= 0;
+	virtual bool					Set_Value		(sLong            Value)	= 0;
 	virtual bool					Set_Value		(double           Value)	= 0;
 
 	//-----------------------------------------------------
@@ -126,6 +128,7 @@ public:
 
 	virtual const SG_Char *			asString		(int Decimals = -1)	const	= 0;
 	virtual int						asInt			(void)				const	= 0;
+	virtual sLong					asLong			(void)				const	= 0;
 	virtual double					asDouble		(void)				const	= 0;
 
 	//-----------------------------------------------------
@@ -142,8 +145,6 @@ public:
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
@@ -171,6 +172,11 @@ public:
 		return( m_Value.Create((BYTE *)&Value, sizeof(Value)) );
 	}
 
+	virtual bool					Set_Value		(sLong            Value)
+	{
+		return( m_Value.Create((BYTE *)&Value, sizeof(Value)) );
+	}
+
 	virtual bool					Set_Value		(double           Value)
 	{
 		return( m_Value.Create((BYTE *)&Value, sizeof(Value)) );
@@ -184,6 +190,7 @@ public:
 	virtual CSG_Bytes				asBinary		(void)				const	{	return( m_Value );					}
 	virtual const SG_Char *			asString		(int Decimals = -1)	const	{	return( (const SG_Char *)m_Value.Get_Bytes() );	}
 	virtual int						asInt			(void)				const	{	return( m_Value.Get_Count() );		}
+	virtual sLong					asLong			(void)				const	{	return( m_Value.Get_Count() );		}
 	virtual double					asDouble		(void)				const	{	return( 0.0 );	}
 
 	virtual CSG_Table_Value &		operator = (const CSG_Table_Value &Value)	{	Set_Value(Value.asBinary());	return( *this );	}
@@ -201,8 +208,6 @@ private:
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
@@ -237,6 +242,11 @@ public:
 		return( Set_Value(CSG_String::Format(SG_T("%d"), Value).c_str()) );
 	}
 
+	virtual bool					Set_Value		(sLong            Value)
+	{
+		return( Set_Value(CSG_String::Format(SG_T("%ld"), Value).c_str()) );
+	}
+
 	virtual bool					Set_Value		(double           Value)
 	{
 		return( Set_Value(CSG_String::Format(SG_T("%f"), Value).c_str()) );
@@ -245,6 +255,7 @@ public:
 	//-----------------------------------------------------
 	virtual const SG_Char *			asString		(int Decimals = -1)	const	{	return( m_Value );							}
 	virtual int						asInt			(void)				const	{	return( m_Value.asInt() );					}
+	virtual sLong					asLong			(void)				const	{	return( m_Value.asInt() );					}
 	virtual double					asDouble		(void)				const	{	return( m_Value.asDouble() );				}
 
 	//-----------------------------------------------------
@@ -260,8 +271,6 @@ private:
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
@@ -297,6 +306,11 @@ public:
 		return( false );
 	}
 
+	virtual bool					Set_Value		(sLong            Value)
+	{
+		return( Set_Value((int)Value) );
+	}
+
 	virtual bool					Set_Value		(double           Value)
 	{
 		return( Set_Value((int)Value) );
@@ -305,6 +319,7 @@ public:
 	//-----------------------------------------------------
 	virtual const SG_Char *			asString		(int Decimals = -1)	const	{	return( m_Date );	}
 	virtual int						asInt			(void)				const	{	return( m_Value );	}
+	virtual sLong					asLong			(void)				const	{	return( m_Value );	}
 	virtual double					asDouble		(void)				const	{	return( m_Value );	}
 
 	virtual CSG_Table_Value &		operator = (const CSG_Table_Value &Value)	{	Set_Value(Value.asString());	return( *this );	}
@@ -321,8 +336,6 @@ private:
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
@@ -360,6 +373,11 @@ public:
 		return( false );
 	}
 
+	virtual bool					Set_Value		(sLong            Value)
+	{
+		return( Set_Value((int)Value) );
+	}
+
 	virtual bool					Set_Value		(double           Value)
 	{
 		return( Set_Value((int)Value) );
@@ -376,6 +394,7 @@ public:
 	}
 
 	virtual int						asInt			(void)				const	{	return( m_Value );	}
+	virtual sLong					asLong			(void)				const	{	return( m_Value );	}
 	virtual double					asDouble		(void)				const	{	return( m_Value );	}
 
 	virtual CSG_Table_Value &		operator = (const CSG_Table_Value &Value)	{	Set_Value(Value.asInt());	return( *this );	}
@@ -390,7 +409,78 @@ private:
 
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+class CSG_Table_Value_Long : public CSG_Table_Value
+{
+public:
+	CSG_Table_Value_Long(void)	{	m_Value	= 0;	}
+	virtual ~CSG_Table_Value_Long(void) {}
+
+	virtual TSG_Table_Value_Type	Get_Type		(void)				const	{	return( SG_TABLE_VALUE_TYPE_Long );	}
+
+	//-----------------------------------------------------
+	virtual bool					Set_Value		(const CSG_Bytes &Value)
+	{
+		return( Set_Value((SG_Char *)Value.Get_Bytes()) );
+	}
+
+	virtual bool					Set_Value		(const SG_Char   *Value)
+	{
+		int			i;
+		CSG_String	s(Value);
+
+		return( s.asInt(i) ? Set_Value(i) : false );
+	}
+
+	virtual bool					Set_Value		(int              Value)
+	{
+		return( Set_Value((sLong)Value) );
+	}
+
+	virtual bool					Set_Value		(sLong            Value)
+	{
+		if( m_Value != Value )
+		{
+			m_Value	= Value;
+
+			return( true );
+		}
+
+		return( false );
+	}
+
+	virtual bool					Set_Value		(double           Value)
+	{
+		return( Set_Value((sLong)Value) );
+	}
+
+	//-----------------------------------------------------
+	virtual const SG_Char *			asString		(int Decimals = -1)	const
+	{
+		static CSG_String	s;
+
+		s.Printf(SG_T("%ld"), m_Value);
+
+		return( s.c_str() );
+	}
+
+	virtual int						asInt			(void)				const	{	return(    (int)m_Value );	}
+	virtual sLong					asLong			(void)				const	{	return(         m_Value );	}
+	virtual double					asDouble		(void)				const	{	return( (double)m_Value );	}
+
+	virtual CSG_Table_Value &		operator = (const CSG_Table_Value &Value)	{	Set_Value(Value.asLong());	return( *this );	}
+
+
+private:
+
+	sLong							m_Value;
+
+};
+
+
+///////////////////////////////////////////////////////////
 //														 //
 ///////////////////////////////////////////////////////////
 
@@ -417,7 +507,12 @@ public:
 		return( s.asDouble(d) ? Set_Value(d) : false );
 	}
 
-	virtual bool					Set_Value		(int             Value)
+	virtual bool					Set_Value		(int              Value)
+	{
+		return( Set_Value((double)Value) );
+	}
+
+	virtual bool					Set_Value		(sLong            Value)
 	{
 		return( Set_Value((double)Value) );
 	}
@@ -444,8 +539,9 @@ public:
 		return( s.c_str() );
 	}
 
-	virtual int						asInt			(void)				const	{	return( (int)m_Value );	}
-	virtual double					asDouble		(void)				const	{	return( m_Value );		}
+	virtual int						asInt			(void)				const	{	return( (int  )m_Value );	}
+	virtual sLong					asLong			(void)				const	{	return( (sLong)m_Value );	}
+	virtual double					asDouble		(void)				const	{	return(        m_Value );	}
 
 	virtual CSG_Table_Value &		operator = (const CSG_Table_Value &Value)	{	Set_Value(Value.asDouble());	return( *this );	}
 
diff --git a/src/saga_core/saga_cmd/Makefile.in b/src/saga_core/saga_cmd/Makefile.in
index aa62b15..ad535d9 100644
--- a/src/saga_core/saga_cmd/Makefile.in
+++ b/src/saga_core/saga_cmd/Makefile.in
@@ -495,22 +495,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/saga_cmd.Po at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/saga_core/saga_cmd/module_library.cpp b/src/saga_core/saga_cmd/module_library.cpp
index 6a8c54c..53929a1 100644
--- a/src/saga_core/saga_cmd/module_library.cpp
+++ b/src/saga_core/saga_cmd/module_library.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: module_library.cpp 2235 2014-09-17 16:32:26Z oconrad $
+ * Version $Id: module_library.cpp 2410 2015-02-17 11:38:56Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -720,39 +720,36 @@ bool CCMD_Module::_Save_Output(CSG_Parameters *pParameters)
 			{
 				CSG_Strings	FileNames;
 
-				while( FileName.Length() > 0 )
+				while( !FileName.IsEmpty() && FileNames.Get_Count() < pParameter->asList()->Get_Count() )
 				{
-					CSG_String	s(&FileName); s = s.BeforeFirst(';');
+					wxString	s = FileName.BeforeFirst(';'); s.Trim(true); s.Trim(false);
 
-					if( s.Length() > 0 )
+					if( !s.IsEmpty() )
 					{
-						FileNames	+= s;
-						FileName	 = FileName.AfterFirst(';');
+						FileNames	+= &s;
 					}
-					else
-					{
-						FileNames	+= &FileName;
-						FileName	.Clear();
-					}
-				}
 
-				int	nFileNames	= pParameter->asList()->Get_Count() <= FileNames.Get_Count() ? FileNames.Get_Count() : FileNames.Get_Count() - 1;
+					FileName = FileName.AfterFirst(';');
+				}
 
-				for(int i=0; i<pParameter->asList()->Get_Count(); i++)
+				if( FileNames.Get_Count() > 0 )	// e.g.: GRIDS=" ;;"
 				{
-					FileNames[i].Trim();
+					int	nFileNames	= pParameter->asList()->Get_Count() <= FileNames.Get_Count() ? FileNames.Get_Count() : FileNames.Get_Count() - 1;
 
-					if( i < nFileNames )
-					{
-						pParameter->asList()->asDataObject(i)->Save(FileNames[i]);
-					}
-					else
+					for(int i=0; i<pParameter->asList()->Get_Count(); i++)
 					{
-						pParameter->asList()->asDataObject(i)->Save(CSG_String::Format(SG_T("%s_%0*d"),
-							FileNames[FileNames.Get_Count() - 1].c_str(),
-							SG_Get_Digit_Count(pParameter->asList()->Get_Count()),
-							1 + i - nFileNames
-						));
+						if( i < nFileNames )
+						{
+							pParameter->asList()->asDataObject(i)->Save(FileNames[i]);
+						}
+						else
+						{
+							pParameter->asList()->asDataObject(i)->Save(CSG_String::Format(SG_T("%s_%0*d"),
+								FileNames[nFileNames].c_str(),
+								SG_Get_Digit_Count(pParameter->asList()->Get_Count()),
+								1 + i - nFileNames
+							));
+						}
 					}
 				}
 			}
diff --git a/src/saga_core/saga_cmd/saga_cmd.cpp b/src/saga_core/saga_cmd/saga_cmd.cpp
index d173759..383c0ba 100644
--- a/src/saga_core/saga_cmd/saga_cmd.cpp
+++ b/src/saga_core/saga_cmd/saga_cmd.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: saga_cmd.cpp 2281 2014-10-09 15:49:41Z oconrad $
+ * Version $Id: saga_cmd.cpp 2418 2015-02-19 20:58:24Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -231,9 +231,7 @@ bool		Execute(int argc, char *argv[])
 		return( false );
 	}
 
-	if( argc == 2
-	||  (  (pModule = pLibrary->Get_Module(CSG_String(argv[2])        )) == NULL
-	    && (pModule = pLibrary->Get_Module(CSG_String(argv[2]).asInt())) == NULL) )
+	if( argc == 2 || (pModule = pLibrary->Get_Module(argv[2])) == NULL )
 	{
 		Print_Modules(pLibrary);
 
@@ -763,7 +761,7 @@ void		Create_Example	(void)
 	Stream.Printf(
 		"@ECHO OFF\n"
 		"\n"
-		"SET FLAGS=-f=q\n"
+		"SET FLAGS=-f=s\n"
 		"REM SET SAGA=.\n"
 		"REM SET SAGA_MLB=%%SAGA%%\\_private\n"
 		"REM PATH=PATH;%%SAGA%%\n"
@@ -773,13 +771,13 @@ void		Create_Example	(void)
 		"\n"
 		"ECHO ____________________________\n"
 		"ECHO create a Gaussian landscape\n"
-		"saga_cmd %%FLAGS%% recreations_fractals 5 -GRID=dem.sgrd -NX=400 -NY=400 -H=0.75\n"
+		"saga_cmd %%FLAGS%% garden_fractals 5 -GRID=dem.sgrd -NX=400 -NY=400 -H=0.75\n"
 		"GOTO :GO\n"
 		"\n"
 		":SRTM\n"
 		"ECHO ____________________________\n"
 		"ECHO import and project srtm (geotiff)\n"
-		"saga_cmd %%FLAGS%% io_gdal              0 -FILES=srtm.tif -GRIDS=srtm -TRANSFORM\n"
+		"saga_cmd %%FLAGS%% io_gdal              0 -FILES=srtm.tif -GRIDS=srtm -TRANSFORM=true\n"
 		"saga_cmd %%FLAGS%% pj_proj4             7 -SOURCE=srtm.sgrd -GET_USER_GRID=dem.sgrd -GET_USER_SIZE=1000.0 -SOURCE_PROJ=\"+proj=longlat +datum=WGS84\" -TARGET_PROJ=\"+proj=cea +datum=WGS84 +lat_ts=0\"\n"
 		"REM alternative method 4 might need to load projection data base with EPSG codes (use --flags=p)\n"
 		"REM saga_cmd -f=qp pj_proj4             4 -SOURCE=srtm.sgrd -GET_USER_GRID=dem.sgrd -GET_USER_SIZE=1000.0 -CRS_PROJ4=\"+proj=cea +datum=WGS84 +lat_ts=0\"\n"
@@ -787,13 +785,13 @@ void		Create_Example	(void)
 		":GO\n"
 		"ECHO ____________________________\n"
 		"ECHO create contour lines from DEM\n"
-		"saga_cmd %%FLAGS%% shapes_grid          5 -INPUT=dem.sgrd -CONTOUR=contour.shp -ZSTEP=100.0\n"
+		"saga_cmd %%FLAGS%% shapes_grid          5 -GRID=dem.sgrd -CONTOUR=contour.shp -ZSTEP=100.0\n"
 		"\n"
 		"ECHO ____________________________\n"
 		"ECHO do some terrain analysis\n"
 		"saga_cmd %%FLAGS%% ta_preprocessor      2 -DEM=dem.sgrd -DEM_PREPROC=dem.sgrd\n"
 		"saga_cmd %%FLAGS%% ta_lighting          0 -ELEVATION=dem.sgrd -SHADE=shade.sgrd -METHOD=0 -AZIMUTH=-45 -DECLINATION=45\n"
-		"saga_cmd %%FLAGS%% ta_morphometry       0 -ELEVATION=dem.sgrd -SLOPE=slope.sgrd -ASPECT=aspect.sgrd -HCURV=hcurv.sgrd -VCURV=vcurv.sgrd\n"
+		"saga_cmd %%FLAGS%% ta_morphometry       0 -ELEVATION=dem.sgrd -SLOPE=slope.sgrd -ASPECT=aspect.sgrd -C_CROS=hcurv.sgrd -C_LONG=vcurv.sgrd\n"
 		"saga_cmd %%FLAGS%% ta_hydrology         0 -ELEVATION=dem.sgrd -CAREA=carea.sgrd\n"
 		"\n"
 		"ECHO ____________________________\n"
@@ -820,7 +818,7 @@ void		Create_Example	(void)
 		"ECHO cluster analysis and vectorisation\n"
 		"\n"
 		"# cluster analysis\n"
-		"imagery_classification 1 -GRIDS=%%INPUT%% -CLUSTER=cluster.sgrd -NORMALISE -NCLUSTER=5\n"
+		"imagery_classification 1 -GRIDS=%%INPUT%% -CLUSTER=cluster.sgrd -NORMALISE=true -NCLUSTER=5\n"
 		"\n"
 		"# majority filter\n"
 		"grid_filter            6 -INPUT=cluster.sgrd -RADIUS=3\n"
diff --git a/src/saga_core/saga_gdi/3d_view_canvas.cpp b/src/saga_core/saga_gdi/3d_view_canvas.cpp
index 11c04f4..d4f0459 100644
--- a/src/saga_core/saga_gdi/3d_view_canvas.cpp
+++ b/src/saga_core/saga_gdi/3d_view_canvas.cpp
@@ -147,11 +147,7 @@ bool CSG_3DView_Canvas::Draw(void)
 		m_Data_Min.z + 0.5 * (m_Data_Max.z - m_Data_Min.z)
 	);
 
-	m_Projector.Set_Scale(
-		 (m_Image_NX / (double)m_Image_NY) > ((m_Data_Max.x - m_Data_Min.x) / (m_Data_Max.y - m_Data_Min.y))
-		? m_Image_NX / (m_Data_Max.x - m_Data_Min.x)
-		: m_Image_NY / (m_Data_Max.y - m_Data_Min.y)
-	);
+	m_Projector.Set_Scale(SG_Get_Length(m_Image_NX, m_Image_NY) / SG_Get_Length(m_Data_Max.x - m_Data_Min.x, m_Data_Max.y - m_Data_Min.y));
 
 	//-------------------------------------------------
 	if( m_bStereo == false )
diff --git a/src/saga_core/saga_gdi/3d_view_panel.cpp b/src/saga_core/saga_gdi/3d_view_panel.cpp
index cd270d9..3b8db35 100644
--- a/src/saga_core/saga_gdi/3d_view_panel.cpp
+++ b/src/saga_core/saga_gdi/3d_view_panel.cpp
@@ -416,8 +416,8 @@ void CSG_3DView_Panel::On_Mouse_RUp(wxMouseEvent &event)
 
 	if( m_Down_Screen.x != event.GetX() || m_Down_Screen.y != event.GetY() )
 	{
-		m_Projector.Set_xShift(m_Down_Value.x - GET_MOUSE_X_RELDIFF * 1000.0);
-		m_Projector.Set_yShift(m_Down_Value.y - GET_MOUSE_Y_RELDIFF * 1000.0);
+		m_Projector.Set_xShift(m_Down_Value.x - (m_Down_Screen.x - event.GetX()));
+		m_Projector.Set_yShift(m_Down_Value.y - (m_Down_Screen.y - event.GetY()));
 
 		Update_View();
 		Update_Parent();
@@ -446,7 +446,7 @@ void CSG_3DView_Panel::On_Mouse_MUp(wxMouseEvent &event)
 	if( m_Down_Screen.x != event.GetX() || m_Down_Screen.y != event.GetY() )
 	{
 		m_Projector.Set_yRotation(m_Down_Value.x + GET_MOUSE_X_RELDIFF * M_PI_180);
-		m_Projector.Set_zShift   (m_Down_Value.y + GET_MOUSE_Y_RELDIFF * 1000.0);
+		m_Projector.Set_zShift   (m_Down_Value.y + (m_Down_Screen.y - event.GetY()));
 
 		Update_View();
 		Update_Parent();
@@ -465,13 +465,13 @@ void CSG_3DView_Panel::On_Mouse_Motion(wxMouseEvent &event)
 		}
 		else if( event.RightIsDown() )
 		{
-			m_Projector.Set_xShift   (m_Down_Value.x - GET_MOUSE_X_RELDIFF * 1000.0);
-			m_Projector.Set_yShift   (m_Down_Value.y - GET_MOUSE_Y_RELDIFF * 1000.0);
+			m_Projector.Set_xShift   (m_Down_Value.x - (m_Down_Screen.x - event.GetX()));
+			m_Projector.Set_yShift   (m_Down_Value.y - (m_Down_Screen.y - event.GetY()));
 		}
 		else if( event.MiddleIsDown() )
 		{
 			m_Projector.Set_yRotation(m_Down_Value.x + GET_MOUSE_X_RELDIFF * M_PI_180);
-			m_Projector.Set_zShift   (m_Down_Value.y + GET_MOUSE_Y_RELDIFF * 1000.0);
+			m_Projector.Set_zShift   (m_Down_Value.y + (m_Down_Screen.y - event.GetY()));
 		}
 		else
 		{
@@ -488,7 +488,7 @@ void CSG_3DView_Panel::On_Mouse_Wheel(wxMouseEvent &event)
 {
 	if( event.GetWheelRotation() )
 	{
-		m_Projector.Set_zShift(m_Projector.Get_zShift()	+ 0.5 * event.GetWheelRotation());
+		m_Projector.Set_zShift(m_Projector.Get_zShift()	+ event.GetWheelRotation());
 
 		Update_View();
 	}
diff --git a/src/saga_core/saga_gdi/3d_view_projector.cpp b/src/saga_core/saga_gdi/3d_view_projector.cpp
index 9885ffc..3a62ea4 100644
--- a/src/saga_core/saga_gdi/3d_view_projector.cpp
+++ b/src/saga_core/saga_gdi/3d_view_projector.cpp
@@ -80,7 +80,7 @@ CSG_3DView_Projector::CSG_3DView_Projector(void)
 
 	m_Scale		= 1.0;
 	m_bCentral	= true;
-	m_dCentral	= 1000.0;
+	m_dCentral	= 1500.0;
 }
 
 
@@ -185,9 +185,9 @@ void CSG_3DView_Projector::Get_Projection(double &x, double &y, double &z)
 	double		a, b;
 	TSG_Point_Z	q;
 
-	x	= (x - m_Center.x) * m_Scale * m_Scaling.x;
-	y	= (y - m_Center.y) * m_Scale * m_Scaling.y;
-	z	= (z - m_Center.z) * m_Scale * m_Scaling.z;
+	x	= m_Scale * (x - m_Center.x) * m_Scaling.x;
+	y	= m_Scale * (y - m_Center.y) * m_Scaling.y;
+	z	= m_Scale * (z - m_Center.z) * m_Scaling.z;
 
 	a	= (m_Cos.y * z + m_Sin.y * (m_Sin.z * y + m_Cos.z * x));
 	b	= (m_Cos.z * y - m_Sin.z * x);
@@ -203,14 +203,12 @@ void CSG_3DView_Projector::Get_Projection(double &x, double &y, double &z)
 	}
 	else
 	{
-		double	z	= m_dCentral / m_Shift.z;
-		q.x	*= z;
-		q.y	*= z;
-	//	q.z	 = -q.z;
+		q.x	*= m_dCentral / m_Shift.z;
+		q.y	*= m_dCentral / m_Shift.z;
 	}
 
-	x	= q.x + 0.5 * m_Screen_NX;
-	y	= q.y + 0.5 * m_Screen_NY;
+	x	= q.x + m_Screen_NX / 2;
+	y	= q.y + m_Screen_NY / 2;
 	z	= q.z;
 }
 
diff --git a/src/saga_core/saga_gdi/3d_view_tools.h b/src/saga_core/saga_gdi/3d_view_tools.h
index ef35fb4..d20722e 100644
--- a/src/saga_core/saga_gdi/3d_view_tools.h
+++ b/src/saga_core/saga_gdi/3d_view_tools.h
@@ -111,10 +111,10 @@ public:
 	void				Set_xShift				(double x);
 	void				Set_yShift				(double y);
 	void				Set_zShift				(double z);
-	const TSG_Point_Z &	Get_Shift				(void)	const	{	return( m_Shift   );	}
-	double				Get_xShift				(void)	const	{	return( m_Shift.x );	}
-	double				Get_yShift				(void)	const	{	return( m_Shift.y );	}
-	double				Get_zShift				(void)	const	{	return( m_Shift.z );	}
+	const TSG_Point_Z &	Get_Shift				(void)	const	{	return( m_Shift    );	}
+	double				Get_xShift				(void)	const	{	return( m_Shift.x  );	}
+	double				Get_yShift				(void)	const	{	return( m_Shift.y  );	}
+	double				Get_zShift				(void)	const	{	return( m_Shift.z  );	}
 
 	void				Set_Screen				(int Width, int Height);
 
diff --git a/src/saga_core/saga_gdi/Makefile.in b/src/saga_core/saga_gdi/Makefile.in
index 6ef280b..3e98b7e 100644
--- a/src/saga_core/saga_gdi/Makefile.in
+++ b/src/saga_core/saga_gdi/Makefile.in
@@ -494,22 +494,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sgdi_helper.Plo at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/saga_core/saga_gui/Makefile.in b/src/saga_core/saga_gui/Makefile.in
index 49255b1..ffb1340 100644
--- a/src/saga_core/saga_gui/Makefile.in
+++ b/src/saga_core/saga_gui/Makefile.in
@@ -866,22 +866,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/wksp_tin_manager.Po at am__quote@
 
 .cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+ at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+ at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+ at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
diff --git a/src/saga_core/saga_gui/dlg_about.cpp b/src/saga_core/saga_gui/dlg_about.cpp
index 76de8e8..f0bdc9d 100644
--- a/src/saga_core/saga_gui/dlg_about.cpp
+++ b/src/saga_core/saga_gui/dlg_about.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: dlg_about.cpp 1978 2014-02-10 09:15:37Z oconrad $
+ * Version $Id: dlg_about.cpp 2471 2015-04-19 09:32:08Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -205,8 +205,8 @@ wxString CDLG_About::_Get_Version(void)
 	s	+= "SAGA GUI\n";
 	s	+= "SAGA Graphical User Interface\n";
 	s	+= "\n";
-	s	+= "Copyrights (c) 2005-2014 by Olaf Conrad\n";
-	s	+= "Portions (c) 2008-2014 by Volker Wichmann\n";
+	s	+= "Copyrights (c) 2005-2015 by Olaf Conrad\n";
+	s	+= "Portions (c) 2008-2015 by Volker Wichmann\n";
 	s	+= "\n";
 	s	+= "GNU General Public License (GPL)\n";
 
@@ -215,8 +215,8 @@ wxString CDLG_About::_Get_Version(void)
 	s	+= "SAGA API\n";
 	s	+= "SAGA Application Programming Interface\n";
 	s	+= "\n";
-	s	+= "Copyrights (c) 2002-2014 by Olaf Conrad\n";
-	s	+= "Portions (c) 2008-2014 by Volker Wichmann\n";
+	s	+= "Copyrights (c) 2002-2015 by Olaf Conrad\n";
+	s	+= "Portions (c) 2008-2015 by Volker Wichmann\n";
 	s	+= "Portions (c) 2005-2006 by Victor Olaya\n";
 	s	+= "Portions (c) 2002 by Andre Ringeler\n";	// " (mat_formula.cpp)\n";
 	s	+= "\n";
diff --git a/src/saga_core/saga_gui/dlg_list_base.cpp b/src/saga_core/saga_gui/dlg_list_base.cpp
index ae744ad..a513076 100644
--- a/src/saga_core/saga_gui/dlg_list_base.cpp
+++ b/src/saga_core/saga_gui/dlg_list_base.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: dlg_list_base.cpp 2153 2014-06-11 11:51:04Z reklov_w $
+ * Version $Id: dlg_list_base.cpp 2447 2015-03-19 14:43:42Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -374,7 +374,7 @@ void CDLG_List_Base::On_Down(wxCommandEvent &event)
 	{
 		Selections.Sort(ArrayInt_CMP_Down);
 
-		if( Selections.Item(0) < m_pAdd->GetCount() - 1 )
+		if( (int)Selections.Item(0) < m_pAdd->GetCount() - 1 )
 		{
 			for(size_t i=0; i<Selections.GetCount(); i++)
 			{
diff --git a/src/saga_core/saga_gui/helper.cpp b/src/saga_core/saga_gui/helper.cpp
index ca5aa35..962e911 100644
--- a/src/saga_core/saga_gui/helper.cpp
+++ b/src/saga_core/saga_gui/helper.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: helper.cpp 2279 2014-10-07 14:46:43Z oconrad $
+ * Version $Id: helper.cpp 2511 2015-06-17 13:22:42Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -194,13 +194,15 @@ double		Get_Random(double loValue, double hiValue)
 //---------------------------------------------------------
 wxString	Get_FilePath_Relative(const wxString &Directory, const wxString &FileName)
 {
-	wxFileName	fn(FileName);
-
-	if( fn.GetPath().Find(Directory) == 0 )
+	if( FileName.Find(Directory) != 0 )
 	{
-		fn.MakeRelativeTo(Directory);
+		return( FileName );
 	}
 
+	wxFileName	fn(FileName);
+
+	fn.MakeRelativeTo(Directory);
+
 	return( fn.GetFullPath() );
 }
 
@@ -901,38 +903,52 @@ void		STATUSBAR_Set_Text(const wxString &Text, int iPane)
 //---------------------------------------------------------
 bool		Open_Application(const wxString &Reference, const wxString &Mime_Extension)
 {
-	bool		bResult		= false;
+	if( Reference.IsEmpty() )
+	{
+		return( false );
+	}
 
-	if( Reference.Length() )
+	if( Reference.Find("ftp:"   ) == 0
+	||  Reference.Find("file:"  ) == 0
+	||  Reference.Find("http:"  ) == 0
+	||  Reference.Find("https:" ) == 0
+	||  Reference.Find("mailto:") == 0 )
 	{
-		wxString	Extension, sReference(Reference);
-		wxFileType	*pFileType;
+		return( wxLaunchDefaultBrowser(Reference) );
+	}
 
-		if( Mime_Extension.Length() )
-		{
-			Extension	= Mime_Extension;
-		}
-		else if( sReference.Find(SG_T("ftp:")) == 0 || sReference.Find(SG_T("http:")) == 0 || sReference.Find(SG_T("https:")) == 0 )
+	//-----------------------------------------------------
+	bool	bResult	= false;
+
+	wxFileName	FileName(Reference);
+
+	if( FileName.IsRelative() )	// very likely that this will not work
+	{
+		FileName.MakeAbsolute(g_pSAGA->Get_App_Path());	// this might not work either, but give it a try
+	}
+
+	//-----------------------------------------------------
+	if( Mime_Extension.IsEmpty() )
+	{
+		if( (bResult = wxLaunchDefaultApplication(FileName.GetFullPath())) == false )
 		{
-			Extension	= wxT("html");
+			MSG_Error_Add(wxString::Format("%s:\n%s\n", _TL("failed to launch default application"), FileName.GetFullPath().c_str()));
 		}
-		else
-		{
-			wxFileName	FileName(Reference);
+	}
 
-			Extension	= FileName.GetExt();
-		}
+	//-----------------------------------------------------
+	else
+	{
+		wxFileType	*pFileType	= wxTheMimeTypesManager->GetFileTypeFromExtension(Mime_Extension);
 
-		if( Extension.Length() > 0 && (pFileType = wxTheMimeTypesManager->GetFileTypeFromExtension(Extension)) != NULL )
+		if( pFileType )
 		{
 			wxString	Command;
 
-			if( pFileType->GetOpenCommand(&Command, wxFileType::MessageParameters(Reference, wxT(""))) )
+			if( !pFileType->GetOpenCommand(&Command, wxFileType::MessageParameters(FileName.GetFullPath(), ""))
+			||  !(bResult = wxExecute(Command) == 0) )
 			{
-				MSG_Execution_Add_Line();
-				MSG_Execution_Add(Command, true, true);
-
-				bResult	= wxExecute(Command) == 0;
+				MSG_Error_Add(wxString::Format("%s:\n%s\n", _TL("command execution failed"), Command.c_str()));
 			}
 
 			delete(pFileType);
@@ -945,7 +961,7 @@ bool		Open_Application(const wxString &Reference, const wxString &Mime_Extension
 //---------------------------------------------------------
 bool		Open_WebBrowser(const wxString &Reference)
 {
-	return( Open_Application(Reference, wxT("html")) );
+	return( wxLaunchDefaultBrowser(Reference) );
 }
 
 
diff --git a/src/saga_core/saga_gui/info_messages.cpp b/src/saga_core/saga_gui/info_messages.cpp
index d5706c2..22a79d3 100644
--- a/src/saga_core/saga_gui/info_messages.cpp
+++ b/src/saga_core/saga_gui/info_messages.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: info_messages.cpp 2110 2014-05-05 12:45:44Z reklov_w $
+ * Version $Id: info_messages.cpp 2375 2015-01-28 19:18:55Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -78,16 +78,13 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-IMPLEMENT_CLASS(CINFO_Messages, wxTextCtrl)
+wxBEGIN_EVENT_TABLE(CINFO_Messages, wxTextCtrl)
+	EVT_RIGHT_UP	(CINFO_Messages::On_Context_Menu)
 
-//---------------------------------------------------------
-BEGIN_EVENT_TABLE(CINFO_Messages, wxTextCtrl)
-    EVT_CONTEXT_MENU(CINFO_Messages::On_Context_Menu)
-
-	EVT_MENU		(ID_CMD_INFO_COPY	, CINFO_Messages::On_Copy)
-	EVT_MENU		(ID_CMD_INFO_CLEAR	, CINFO_Messages::On_Clear)
-
-END_EVENT_TABLE()
+	EVT_MENU		(ID_CMD_INFO_SELECTALL	, CINFO_Messages::On_SelectAll)
+	EVT_MENU		(ID_CMD_INFO_COPY		, CINFO_Messages::On_Copy)
+	EVT_MENU		(ID_CMD_INFO_CLEAR		, CINFO_Messages::On_Clear)
+wxEND_EVENT_TABLE()
 
 
 ///////////////////////////////////////////////////////////
@@ -103,11 +100,6 @@ CINFO_Messages::CINFO_Messages(wxWindow *pParent)
 	m_MaxLength	= 0x10000;
 }
 
-//---------------------------------------------------------
-CINFO_Messages::~CINFO_Messages(void)
-{
-}
-
 
 ///////////////////////////////////////////////////////////
 //														 //
@@ -116,22 +108,39 @@ CINFO_Messages::~CINFO_Messages(void)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-void CINFO_Messages::On_Context_Menu(wxContextMenuEvent &event)
+void CINFO_Messages::On_Context_Menu(wxMouseEvent &event)
 {
 	wxMenu	Menu;
 
-	Menu.Append(ID_CMD_INFO_COPY		, _TL("Copy"));
-	Menu.Append(ID_CMD_INFO_CLEAR		, _TL("Clear"));
+	CMD_Menu_Add_Item(&Menu, false, ID_CMD_INFO_CLEAR);
+	CMD_Menu_Add_Item(&Menu, false, ID_CMD_INFO_SELECTALL);
+
+	if( CanCopy() )
+	{
+		CMD_Menu_Add_Item(&Menu, false, ID_CMD_INFO_COPY);
+	}
 
 	PopupMenu(&Menu);
 }
 
 //---------------------------------------------------------
+void CINFO_Messages::On_Clear(wxCommandEvent &WXUNUSED(event))
+{
+	Clear();
+}
+
+//---------------------------------------------------------
+void CINFO_Messages::On_SelectAll(wxCommandEvent &WXUNUSED(event))
+{
+	SelectAll();
+}
+
+//---------------------------------------------------------
 void CINFO_Messages::On_Copy(wxCommandEvent &WXUNUSED(event))
 {
 	if( GetStringSelection().IsEmpty() )
 	{
-		SetSelection(-1, -1);
+		SelectAll();
 		Copy();
 		SetSelection(GetLastPosition(), GetLastPosition());
 	}
@@ -141,12 +150,6 @@ void CINFO_Messages::On_Copy(wxCommandEvent &WXUNUSED(event))
 	}
 }
 
-//---------------------------------------------------------
-void CINFO_Messages::On_Clear(wxCommandEvent &WXUNUSED(event))
-{
-	Clear();
-}
-
 
 ///////////////////////////////////////////////////////////
 //														 //
diff --git a/src/saga_core/saga_gui/info_messages.h b/src/saga_core/saga_gui/info_messages.h
index 6849749..4503e95 100644
--- a/src/saga_core/saga_gui/info_messages.h
+++ b/src/saga_core/saga_gui/info_messages.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: info_messages.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: info_messages.h 2375 2015-01-28 19:18:55Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -84,11 +84,8 @@
 //---------------------------------------------------------
 class CINFO_Messages : public wxTextCtrl
 {
-	DECLARE_CLASS(CINFO_Messages)
-
 public:
 	CINFO_Messages(wxWindow *pParent);
-	virtual ~CINFO_Messages(void);
 
 	void						Add_Time		(bool bNewLine = true);
 	void						Add_Line		(void);
@@ -100,10 +97,11 @@ private:
 	int							m_MaxLength;
 
 
-	void						On_Context_Menu	(wxContextMenuEvent &event);
+	void						On_Context_Menu	(wxMouseEvent   &event);
 
 	void						On_Copy			(wxCommandEvent &event);
 	void						On_Clear		(wxCommandEvent &event);
+	void						On_SelectAll	(wxCommandEvent &event);
 
 	void						_Add_Text		(wxString Text);
 
@@ -111,7 +109,7 @@ private:
 
 
 //---------------------------------------------------------
-DECLARE_EVENT_TABLE()
+wxDECLARE_EVENT_TABLE();
 };
 
 
diff --git a/src/saga_core/saga_gui/project.cpp b/src/saga_core/saga_gui/project.cpp
index 1b1b346..b0cace9 100644
--- a/src/saga_core/saga_gui/project.cpp
+++ b/src/saga_core/saga_gui/project.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: project.cpp 2234 2014-09-16 15:08:19Z oconrad $
+ * Version $Id: project.cpp 2514 2015-06-19 16:03:47Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -292,6 +292,12 @@ bool CWKSP_Project::_Load(const wxString &FileName, bool bAdd, bool bUpdateMenu)
 			}
 		}
 
+		switch( g_pData->Get_Parameter("PROJECT_MAP_ARRANGE")->asInt() )
+		{
+		case 1:	g_pSAGA_Frame->Tile(wxHORIZONTAL);	break;
+		case 2:	g_pSAGA_Frame->Tile(wxVERTICAL  );	break;
+		}
+
 		g_pSAGA_Frame->Thaw();
 	}
 
@@ -347,11 +353,11 @@ bool CWKSP_Project::_Save(const wxString &FileName, bool bSaveModified, bool bUp
 	//-----------------------------------------------------
 	ProjectDir	= SG_File_Get_Path(FileName).w_str();
 
-	Project.Set_Name    (SG_T("SAGA_PROJECT"));
-	Project.Add_Property(SG_T("VERSION"), SAGA_VERSION);
+	Project.Set_Name    ("SAGA_PROJECT");
+	Project.Add_Property("VERSION", SAGA_VERSION);
 
 	//-----------------------------------------------------
-	pNode		= Project.Add_Child(SG_T("DATA"));
+	pNode		= Project.Add_Child("DATA");
 
 	if( (pTables = g_pData->Get_Tables()) != NULL )
 	{
@@ -417,7 +423,7 @@ bool CWKSP_Project::_Save(const wxString &FileName, bool bSaveModified, bool bUp
 	//-----------------------------------------------------
 	if( g_pMaps->Get_Count() > 0 )
 	{
-		pNode		= Project.Add_Child(SG_T("MAPS"));
+		pNode		= Project.Add_Child("MAPS");
 
 		for(i=0; i<g_pMaps->Get_Count(); i++)
 		{
@@ -501,7 +507,34 @@ bool CWKSP_Project::_Load_Data(CSG_MetaData &Entry, const wxString &ProjectDir,
 		return( false );
 	}
 
+	//-----------------------------------------------------
+	CSG_MetaData	*pEntry	= Entry("PARAMETERS");
+
+	for(int i=0; i<pEntry->Get_Children_Count(); i++)
+	{
+		if( !pEntry->Get_Child(i)->Get_Name().CmpNoCase("DATA") && !pEntry->Get_Child(i)->Get_Content().is_Empty() )
+		{
+			wxString	s(Get_FilePath_Absolute(ProjectDir, pEntry->Get_Child(i)->Get_Content().w_str()));
+
+			pEntry->Get_Child(i)->Set_Content(&s);
+
+		// if( SG_Compare_SAGA_Version(Version) < 0 )
+			{
+				if( pEntry->Get_Child(i)->Cmp_Property("id", "OVERLAY_1") )
+				{
+					pEntry->Get_Child(i)->Set_Property("id", "OVERLAY_G");
+				}
+
+				if( pEntry->Get_Child(i)->Cmp_Property("id", "OVERLAY_2") )
+				{
+					pEntry->Get_Child(i)->Set_Property("id", "OVERLAY_B");
+				}
+			}
+		}
+	}
+
 	pItem->Get_Parameters()->Serialize(*Entry.Get_Child("PARAMETERS"), false);
+
 	pItem->Parameters_Changed();
 
 	return( true );
@@ -515,16 +548,16 @@ bool CWKSP_Project::_Save_Data(CSG_MetaData &Entry, const wxString &ProjectDir,
 		return( false );
 	}
 
-	CSG_MetaData	*pEntry	= Entry.Add_Child(SG_T("DATASET"));
+	CSG_MetaData	*pEntry	= Entry.Add_Child("DATASET");
 
 	switch( pDataObject->Get_ObjectType() )
 	{
 	default:	return( false );
-	case DATAOBJECT_TYPE_Grid:			pEntry->Add_Property(SG_T("type"), SG_T("GRID"));	break;
-	case DATAOBJECT_TYPE_Table:			pEntry->Add_Property(SG_T("type"), SG_T("TABLE"));	break;
-	case DATAOBJECT_TYPE_Shapes:		pEntry->Add_Property(SG_T("type"), SG_T("SHAPES"));	break;
-	case DATAOBJECT_TYPE_TIN:			pEntry->Add_Property(SG_T("type"), SG_T("TIN"));	break;
-	case DATAOBJECT_TYPE_PointCloud:	pEntry->Add_Property(SG_T("type"), SG_T("POINTS"));	break;
+	case DATAOBJECT_TYPE_Grid:			pEntry->Add_Property("type", "GRID"  );	break;
+	case DATAOBJECT_TYPE_Table:			pEntry->Add_Property("type", "TABLE" );	break;
+	case DATAOBJECT_TYPE_Shapes:		pEntry->Add_Property("type", "SHAPES");	break;
+	case DATAOBJECT_TYPE_TIN:			pEntry->Add_Property("type", "TIN"   );	break;
+	case DATAOBJECT_TYPE_PointCloud:	pEntry->Add_Property("type", "POINTS");	break;
 	}
 
 	wxString	s(Get_FilePath_Relative(ProjectDir, pDataObject->Get_File_Name()));
@@ -535,7 +568,20 @@ bool CWKSP_Project::_Save_Data(CSG_MetaData &Entry, const wxString &ProjectDir,
 	{
 		pParameters->DataObjects_Check(true);
 
-		pParameters->Serialize(*pEntry->Add_Child(SG_T("PARAMETERS")), true);
+		pParameters->Serialize(*pEntry->Add_Child("PARAMETERS"), true);
+
+		//-------------------------------------------------
+		pEntry	= pEntry->Get_Child("PARAMETERS");
+
+		for(int i=0; i<pEntry->Get_Children_Count(); i++)
+		{
+			if( !pEntry->Get_Child(i)->Get_Name().CmpNoCase("DATA") && SG_File_Exists(pEntry->Get_Child(i)->Get_Content()) )
+			{
+				wxString	s(Get_FilePath_Relative(ProjectDir, pEntry->Get_Child(i)->Get_Content().w_str()));
+
+				pEntry->Get_Child(i)->Set_Content(&s);
+			}
+		}
 	}
 
 	return( true );
@@ -766,6 +812,8 @@ bool CWKSP_Project::_Compatibility_Load_Data(const wxString &FileName)
 		return( false );
 	}
 
+	g_pSAGA_Frame->Freeze();
+
 	g_pData->Get_Menu_Files()->Set_Update(false);
 	while( _Compatibility_Load_Data(Stream, SG_File_Get_Path(FileName).w_str()) );
 	g_pData->Get_Menu_Files()->Set_Update(true);
@@ -778,6 +826,14 @@ bool CWKSP_Project::_Compatibility_Load_Data(const wxString &FileName)
 		while( _Compatibility_Load_Map(Stream, SG_File_Get_Path(FileName).w_str()) );
 	}
 
+	switch( g_pData->Get_Parameter("PROJECT_MAP_ARRANGE")->asInt() )
+	{
+	case 1:	g_pSAGA_Frame->Tile(wxHORIZONTAL);	break;
+	case 2:	g_pSAGA_Frame->Tile(wxVERTICAL  );	break;
+	}
+
+	g_pSAGA_Frame->Thaw();
+
 	return( true );
 }
 
diff --git a/src/saga_core/saga_gui/res/tool_menus.xml b/src/saga_core/saga_gui/res/tool_menus.xml
new file mode 100644
index 0000000..febb47a
--- /dev/null
+++ b/src/saga_core/saga_gui/res/tool_menus.xml
@@ -0,0 +1,734 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<saga_gui_tool_menus saga-version="2.2.0">
+  <description>
+    This file shall serve as a template for user defined tool menus.
+	A tool's entry has to be defined as a subitem of its library entry
+	and is identified by either its identifier or name property ('id_or_name=...').
+	The desired menu path is given as the entry's content. Optionally the 
+	menu command's name can be changed with the 'name=...' property. If
+	you don't want to have a menu entry for a tool at all, then simply
+	remove its entry from this file. Activate your user defined tool menus
+	by choosing your file in the SAGA GUI's tool manager settings option:
+	'User defined tool menus'.
+  </description>
+  <library name="climate_tools">
+    <tool id_or_name="Multi Level to Surface Interpolation">Climate</tool>
+    <tool id_or_name="Multi Level to Points Interpolation">Climate</tool>
+    <tool id_or_name="Earth's Orbital Parameters">Climate|Earth's Orbital Parameters</tool>
+    <tool id_or_name="Annual Course of Daily Insolation">Climate|Earth's Orbital Parameters</tool>
+    <tool id_or_name="Daily Insolation over Latitude">Climate|Earth's Orbital Parameters</tool>
+    <tool id_or_name="Monthly Global by Latitude">Climate|Earth's Orbital Parameters</tool>
+    <tool id_or_name="PET (after Hargreave)">Climate|Evapotranspiration</tool>
+    <tool id_or_name="Daily to Hourly PET">Climate|Evapotranspiration</tool>
+  </library>
+  <library name="docs_html">
+    <tool id_or_name="Create Web Content">File|Reports</tool>
+    <tool id_or_name="SVG Interactive Map">File|Reports</tool>
+  </library>
+  <library name="docs_pdf">
+    <tool id_or_name="Shapes Report">File|Reports</tool>
+    <tool id_or_name="Shapes Summary Report">File|Reports</tool>
+    <tool id_or_name="Terrain Path Cross Sections">File|Reports</tool>
+  </library>
+  <library name="garden_fractals">
+    <tool id_or_name="Bifurcation">Garden|Recreations|Fractals</tool>
+    <tool id_or_name="Pythagoras' Tree">Garden|Recreations|Fractals</tool>
+    <tool id_or_name="Mandelbrot Set">Garden|Recreations|Fractals</tool>
+    <tool id_or_name="Fractal Dimension of Grid Surface">Garden|Recreations|Fractals</tool>
+    <tool id_or_name="Newton-Raphson">Garden|Recreations|Fractals</tool>
+    <tool id_or_name="Gaussian Landscapes">Garden|Recreations|Fractals</tool>
+  </library>
+  <library name="garden_games">
+    <tool id_or_name="Mine Sweeper">Garden|Recreations|Games</tool>
+    <tool id_or_name="Sudoku">Garden|Recreations|Games</tool>
+  </library>
+  <library name="contrib_perego">
+    <tool id_or_name="Average With Thereshold 1">Grid|Filter|Averages</tool>
+    <tool id_or_name="Average With Thereshold 2">Grid|Filter|Averages</tool>
+    <tool id_or_name="Average With Thereshold 3">Grid|Filter|Averages</tool>
+    <tool id_or_name="Average With Mask 1">Grid|Filter|Averages</tool>
+    <tool id_or_name="Average With Mask 2">Grid|Filter|Averages</tool>
+    <tool id_or_name="Destriping">Grid|Filter</tool>
+    <tool id_or_name="Destriping with Mask">Grid|Filter</tool>
+    <tool id_or_name="Directional Average">Grid|Filter|Averages</tool>
+  </library>
+  <library name="grid_analysis">
+    <tool id_or_name="Accumulated Cost (Isotropic)">Grid|Analysis|Cost Analysis</tool>
+    <tool id_or_name="Accumulated Cost (Anisotropic)">Grid|Analysis|Cost Analysis</tool>
+    <tool id_or_name="Least Cost Path">Grid|Analysis|Cost Analysis</tool>
+    <tool id_or_name="Least Cost Paths">Grid|Analysis|Cost Analysis</tool>
+    <tool id_or_name="Change Vector Analysis">Imagery|Tools</tool>
+    <tool id_or_name="Covered Distance">Grid|Analysis</tool>
+    <tool id_or_name="Pattern Analysis">Grid|Analysis</tool>
+    <tool id_or_name="Layer of extreme value">Grid|Analysis</tool>
+    <tool id_or_name="Analytical Hierarchy Process">Grid|Analysis</tool>
+    <tool id_or_name="Ordered Weighted Averaging (OWA)">Grid|Analysis</tool>
+    <tool id_or_name="Aggregation Index">Grid|Analysis</tool>
+    <tool id_or_name="Cross-Classification and Tabulation">Grid|Analysis</tool>
+    <tool id_or_name="Soil Texture Classification">Grid|Analysis|Soil Analysis</tool>
+    <tool id_or_name="Fragmentation (Standard)">Grid|Analysis|Fragmentation Analysis</tool>
+    <tool id_or_name="Fragmentation (Alternative)">Grid|Analysis|Fragmentation Analysis</tool>
+    <tool id_or_name="Fragmentation Classes from Density and Connectivity">Grid|Analysis|Fragmentation Analysis</tool>
+    <tool id_or_name="Accumulation Functions">Grid|Analysis</tool>
+    <tool id_or_name="IMCORR - Feature Tracking">Grid|Analysis</tool>
+  </library>
+  <library name="grid_calculus">
+    <tool id_or_name="Grid Normalisation">Grid|Calculus</tool>
+    <tool id_or_name="Grid Calculator">Grid|Calculus</tool>
+    <tool id_or_name="Grid Volume">Grid|Calculus</tool>
+    <tool id_or_name="Grid Difference">Grid|Calculus</tool>
+    <tool id_or_name="Function">Grid|Calculus|Grid Generation</tool>
+    <tool id_or_name="Geometric Figures">Grid|Calculus|Grid Generation</tool>
+    <tool id_or_name="Random Terrain Generation">Grid|Calculus|Grid Generation</tool>
+    <tool id_or_name="Random Field">Grid|Calculus|Grid Generation</tool>
+    <tool id_or_name="Grids Sum">Grid|Calculus</tool>
+    <tool id_or_name="Grids Product">Grid|Calculus</tool>
+    <tool id_or_name="Grid Standardisation">Grid|Calculus</tool>
+    <tool id_or_name="Fuzzify">Grid|Calculus|Fuzzy Logic</tool>
+    <tool id_or_name="Fuzzy Intersection (AND)">Grid|Calculus|Fuzzy Logic</tool>
+    <tool id_or_name="Fuzzy Union (OR)">Grid|Calculus|Fuzzy Logic</tool>
+    <tool id_or_name="Metric Conversions">Grid|Calculus|Conversions</tool>
+    <tool id_or_name="Gradient Vector from Cartesian to Polar Coordinates">Grid|Calculus|Conversions</tool>
+    <tool id_or_name="Gradient Vector from Polar to Cartesian Coordinates">Grid|Calculus|Conversions</tool>
+    <tool id_or_name="Grid Division">Grid|Calculus</tool>
+    <tool id_or_name="Spherical Harmonic Synthesis">Grid|Calculus|Grid Generation</tool>
+  </library>
+  <library name="grid_calculus_bsl">
+    <tool id_or_name="BSL">Grid|Calculus</tool>
+    <tool id_or_name="BSL from File">Grid|Calculus</tool>
+  </library>
+  <library name="grid_filter">
+    <tool id_or_name="Simple Filter">Grid|Filter</tool>
+    <tool id_or_name="Gaussian Filter">Grid|Filter</tool>
+    <tool id_or_name="Laplacian Filter">Grid|Filter</tool>
+    <tool id_or_name="Multi Direction Lee Filter">Grid|Filter</tool>
+    <tool id_or_name="User Defined Filter">Grid|Filter</tool>
+    <tool id_or_name="Filter Clumps">Grid|Filter</tool>
+    <tool id_or_name="Majority Filter">Grid|Filter</tool>
+    <tool id_or_name="DTM Filter (slope-based)">Grid|Filter</tool>
+    <tool id_or_name="Morphological Filter">Grid|Filter</tool>
+    <tool id_or_name="Rank Filter">Grid|Filter</tool>
+    <tool id_or_name="Mesh Denoise">Grid|Filter</tool>
+    <tool id_or_name="Resampling Filter">Grid|Filter</tool>
+    <tool id_or_name="Geodesic Morphological Reconstruction">Grid|Filter</tool>
+    <tool id_or_name="Binary Erosion-Reconstruction">Grid|Filter</tool>
+    <tool id_or_name="Connectivity Analysis">Grid|Filter</tool>
+    <tool id_or_name="Sieving Classes">Grid|Filter</tool>
+  </library>
+  <library name="grid_gridding">
+    <tool id_or_name="Shapes to Grid">Grid|Gridding</tool>
+    <tool id_or_name="Inverse Distance Weighted">Grid|Gridding|Interpolation from Points</tool>
+    <tool id_or_name="Nearest Neighbour">Grid|Gridding|Interpolation from Points</tool>
+    <tool id_or_name="Natural Neighbour">Grid|Gridding|Interpolation from Points</tool>
+    <tool id_or_name="Modifed Quadratic Shepard">Grid|Gridding|Interpolation from Points</tool>
+    <tool id_or_name="Triangulation">Grid|Gridding|Interpolation from Points</tool>
+    <tool id_or_name="Kernel Density Estimation">Grid|Gridding</tool>
+    <tool id_or_name="Angular Distance Weighted">Grid|Gridding|Interpolation from Points</tool>
+  </library>
+  <library name="grid_spline">
+    <tool id_or_name="Thin Plate Spline (Global)">Grid|Gridding|Spline Interpolation</tool>
+    <tool id_or_name="Thin Plate Spline (Local)">Grid|Gridding|Spline Interpolation</tool>
+    <tool id_or_name="Thin Plate Spline (TIN)">Grid|Gridding|Spline Interpolation</tool>
+    <tool id_or_name="B-Spline Approximation">Grid|Gridding|Spline Interpolation</tool>
+    <tool id_or_name="Multilevel B-Spline Interpolation">Grid|Gridding|Spline Interpolation</tool>
+    <tool id_or_name="Multilevel B-Spline Interpolation (from Grid)">Grid|Gridding|Spline Interpolation</tool>
+    <tool id_or_name="Cubic Spline Approximation">Grid|Gridding|Spline Interpolation</tool>
+  </library>
+  <library name="grid_tools">
+    <tool id_or_name="Resampling">Grid|Grid System</tool>
+    <tool id_or_name="Aggregate">Grid|Grid System</tool>
+    <tool id_or_name="Clip Grids">Grid|Grid System</tool>
+    <tool id_or_name="Mosaicking">Grid|Grid System</tool>
+    <tool id_or_name="Constant Grid">Grid|Values</tool>
+    <tool id_or_name="Patching">Grid|Gaps</tool>
+    <tool id_or_name="Close One Cell Gaps">Grid|Gaps</tool>
+    <tool id_or_name="Close Gaps">Grid|Gaps</tool>
+    <tool id_or_name="Grid Buffer">Grid|Distances</tool>
+    <tool id_or_name="Threshold Buffer">Grid|Distances</tool>
+    <tool id_or_name="Grid Proximity Buffer">Grid|Distances</tool>
+    <tool id_or_name="Change Data Storage">Grid|Values</tool>
+    <tool id_or_name="Change Grid Values">Grid|Values</tool>
+    <tool id_or_name="Change Cell Values">Grid|Values</tool>
+    <tool id_or_name="Grid Value Request">Grid|Values</tool>
+    <tool id_or_name="Reclassify Grid Values">Grid|Values</tool>
+    <tool id_or_name="Change Grid Values - Flood Fill">Grid|Values</tool>
+    <tool id_or_name="Crop to Data">Grid|Grid System</tool>
+    <tool id_or_name="Invert Data/No-Data">Grid|Values</tool>
+    <tool id_or_name="Grid Orientation">Grid|Values</tool>
+    <tool id_or_name="Combine Grids">Grid|Values</tool>
+    <tool id_or_name="Grid Cell Index">Grid|Values</tool>
+    <tool id_or_name="Grids from classified grid and table">Grid|Values</tool>
+    <tool id_or_name="Create Grid System">Grid|Grid System</tool>
+    <tool id_or_name="Grid Masking">Grid|Values</tool>
+    <tool id_or_name="Close Gaps with Spline">Grid|Gaps</tool>
+    <tool id_or_name="Proximity Grid">Grid|Distances</tool>
+    <tool id_or_name="Tiling">Grid|Grid System</tool>
+    <tool id_or_name="Shrink and Expand">Grid|Gaps</tool>
+    <tool id_or_name="Close Gaps with Stepwise Resampling">Grid|Gaps</tool>
+    <tool id_or_name="Transpose Grids">Grid|Grid System</tool>
+    <tool id_or_name="Clip Grids">Grid|Grid System</tool>
+  </library>
+  <library name="imagery_classification">
+    <tool id_or_name="Supervised Classification">Imagery|Classification</tool>
+    <tool id_or_name="Cluster Analysis for Grids">Imagery|Classification</tool>
+    <tool id_or_name="Change Detection">Imagery|Classification</tool>
+    <tool id_or_name="Decision Tree">Imagery|Classification</tool>
+    <tool id_or_name="Supervised Classification for Polygons">Imagery|Classification</tool>
+  </library>
+  <library name="imagery_opencv">
+    <tool id_or_name="Morphological Filter (OpenCV)">Grid|Filter</tool>
+    <tool id_or_name="Fourier Transformation (OpenCV)">Imagery|Fourier Analysis</tool>
+    <tool id_or_name="Single Value Decomposition (OpenCV)">Imagery|Fourier Analysis</tool>
+    <tool id_or_name="Neural Networks (OpenCV)">Imagery|Classification</tool>
+    <tool id_or_name="Stereo Match (OpenCV)">Garden|Imagery</tool>
+  </library>
+  <library name="imagery_photogrammetry">
+    <tool id_or_name="Resection (Terrestrial)">Imagery|Photogrammetry</tool>
+    <tool id_or_name="Colorisation (PC)">Imagery|Photogrammetry</tool>
+  </library>
+  <library name="imagery_segmentation">
+    <tool id_or_name="Watershed Segmentation">Imagery|Segmentation</tool>
+    <tool id_or_name="Grid Skeletonization">Imagery|Segmentation</tool>
+    <tool id_or_name="Seed Generation">Imagery|Segmentation</tool>
+    <tool id_or_name="Seeded Region Growing">Imagery|Segmentation</tool>
+  </library>
+  <library name="imagery_svm">
+    <tool id_or_name="SVM Classification">Imagery|Classification</tool>
+  </library>
+  <library name="imagery_tools">
+    <tool id_or_name="Vegetation Index (Distance Based)">Imagery|Vegetation Indices</tool>
+    <tool id_or_name="Vegetation Index (Slope Based)">Imagery|Vegetation Indices</tool>
+    <tool id_or_name="Enhanced Vegetation Index">Imagery|Vegetation Indices</tool>
+    <tool id_or_name="Tasseled Cap Transformation">Imagery|Vegetation Indices</tool>
+    <tool id_or_name="IHS Sharpening">Imagery|Image Sharpening</tool>
+    <tool id_or_name="Colour Normalized Brovey Sharpening">Imagery|Image Sharpening</tool>
+    <tool id_or_name="Colour Normalized Spectral Sharpening">Imagery|Image Sharpening</tool>
+    <tool id_or_name="Principle Components Based Image Sharpening">Imagery|Image Sharpening</tool>
+    <tool id_or_name="Top of Atmosphere Reflectance">Imagery|Landsat</tool>
+    <tool id_or_name="Automated Cloud Cover Assessment">Imagery|Landsat</tool>
+    <tool id_or_name="Landsat Import with Options">Imagery|Landsat</tool>
+  </library>
+  <library name="imagery_vigra">
+    <tool id_or_name="Smoothing (ViGrA)">Grid|Filter</tool>
+    <tool id_or_name="Edge Detection (ViGrA)">Imagery|Segmentation</tool>
+    <tool id_or_name="Morphological Filter (ViGrA)">Grid|Filter</tool>
+    <tool id_or_name="Distance (ViGrA)">Grid|Distances</tool>
+    <tool id_or_name="Watershed Segmentation (ViGrA)">Imagery|Segmentation</tool>
+    <tool id_or_name="Fourier Transform (ViGrA)">Imagery|Fourier Analysis</tool>
+    <tool id_or_name="Fourier Transform Inverse (ViGrA)">Imagery|Fourier Analysis</tool>
+    <tool id_or_name="Fourier Transform (Real, ViGrA)">Imagery|Fourier Analysis</tool>
+    <tool id_or_name="Fourier Filter (ViGrA)">Imagery|Fourier Analysis</tool>
+    <tool id_or_name="Random Forest (ViGrA)">Imagery|Classification</tool>
+  </library>
+  <library name="db_odbc">
+    <tool id_or_name="Connect to ODBC Source">Database|ODBC</tool>
+    <tool id_or_name="Disconnect from ODBC Source">Database|ODBC</tool>
+    <tool id_or_name="Commit/Rollback Transaction">Database|ODBC|Tools</tool>
+    <tool id_or_name="Execute SQL">Database|ODBC|Tools</tool>
+    <tool id_or_name="List Table Fields">Database|ODBC|Tools</tool>
+    <tool id_or_name="Import Table">Database|ODBC|Tables</tool>
+    <tool id_or_name="Export Table">Database|ODBC|Tables</tool>
+    <tool id_or_name="Drop Table">Database|ODBC|Tables</tool>
+    <tool id_or_name="Import Table from SQL Query">Database|ODBC|Tables</tool>
+    <tool id_or_name="List ODBC Servers">Database|ODBC|Tools</tool>
+    <tool id_or_name="List Tables">Database|ODBC|Tools</tool>
+    <tool id_or_name="Disconnect All">Database|ODBC|Tools</tool>
+  </library>
+  <library name="db_pgsql">
+    <tool id_or_name="List PostgreSQL Connections">Database|PostgreSQL|Tools</tool>
+    <tool id_or_name="Connect to PostgreSQL">Database|PostgreSQL</tool>
+    <tool id_or_name="Disconnect from PostgreSQL">Database|PostgreSQL</tool>
+    <tool id_or_name="Disconnect All">Database|PostgreSQL|Tools</tool>
+    <tool id_or_name="Begin Transaction">Database|PostgreSQL|Tools</tool>
+    <tool id_or_name="Commit/Rollback Transaction">Database|PostgreSQL|Tools</tool>
+    <tool id_or_name="Execute SQL">Database|PostgreSQL|Tools</tool>
+    <tool id_or_name="List Tables">Database|PostgreSQL|Tools</tool>
+    <tool id_or_name="List Table Fields">Database|PostgreSQL|Tools</tool>
+    <tool id_or_name="Import Table">Database|PostgreSQL|Tables</tool>
+    <tool id_or_name="Export Table">Database|PostgreSQL|Tables</tool>
+    <tool id_or_name="Drop Table">Database|PostgreSQL|Tables</tool>
+    <tool id_or_name="Import Table from SQL Query">Database|PostgreSQL|Tables</tool>
+    <tool id_or_name="Import Shapes from PostGIS">Database|PostgreSQL|Shapes</tool>
+    <tool id_or_name="Export Shapes to PostGIS">Database|PostgreSQL|Shapes</tool>
+    <tool id_or_name="Update Shapes SRID">Database|PostgreSQL|Shapes</tool>
+    <tool id_or_name="Import Raster from PostGIS">Database|PostgreSQL|Raster</tool>
+    <tool id_or_name="Export Raster to PostGIS">Database|PostgreSQL|Raster</tool>
+    <tool id_or_name="Update Raster SRID">Database|PostgreSQL|Raster</tool>
+  </library>
+  <library name="io_esri_e00">
+    <tool id_or_name="Import ESRI E00 File">File|ESRI E00</tool>
+  </library>
+  <library name="io_gdal">
+    <tool id_or_name="GDAL: Import Raster">File|GDAL/OGR</tool>
+    <tool id_or_name="GDAL: Export Raster">File|GDAL/OGR</tool>
+    <tool id_or_name="GDAL: Export Raster to GeoTIFF">File|GDAL/OGR</tool>
+    <tool id_or_name="OGR: Import Vector Data">File|GDAL/OGR</tool>
+    <tool id_or_name="OGR: Export Vector Data">File|GDAL/OGR</tool>
+    <tool id_or_name="OGR: Export Shapes to KML">File|GDAL/OGR</tool>
+    <tool id_or_name="GDAL: Import NetCDF">File|GDAL/OGR</tool>
+  </library>
+  <library name="io_gps">
+    <tool id_or_name="GPX to shapefile">File|GPS Import</tool>
+    <tool id_or_name="GPSBabel">File|GPS Import</tool>
+  </library>
+  <library name="io_grid">
+    <tool id_or_name="Export ESRI Arc/Info Grid">File|Grid|Export</tool>
+    <tool id_or_name="Import ESRI Arc/Info Grid">File|Grid|Import</tool>
+    <tool id_or_name="Export Surfer Grid">File|Grid|Export</tool>
+    <tool id_or_name="Import Surfer Grid">File|Grid|Import</tool>
+    <tool id_or_name="Import Binary Raw Data">File|Grid|Import</tool>
+    <tool id_or_name="Export Grid to XYZ">File|Grid|Export</tool>
+    <tool id_or_name="Import Grid from XYZ">File|Grid|Import</tool>
+    <tool id_or_name="Import USGS SRTM Grid">File|Grid|Import</tool>
+    <tool id_or_name="Import MOLA Grid (MEGDR)">File|Grid|Import</tool>
+    <tool id_or_name="Import SRTM30 DEM">File|Grid|Import</tool>
+    <tool id_or_name="Export True Color Bitmap">File|Grid|Export</tool>
+    <tool id_or_name="Import Erdas LAN/GIS">File|Grid|Import</tool>
+    <tool id_or_name="Import Grid from Table">File|Grid|Import</tool>
+    <tool id_or_name="Import WRF Geogrid Binary Format">File|Grid|Import</tool>
+    <tool id_or_name="Export WRF Geogrid Binary Format">File|Grid|Export</tool>
+    <tool id_or_name="Import Building Sketches from CityGML">File|Grid|Import</tool>
+  </library>
+  <library name="io_grid_grib2">
+    <tool id_or_name="Import GRIB2 record">File|Grid|Import</tool>
+  </library>
+  <library name="io_grid_image">
+    <tool id_or_name="Export Image (bmp, jpg, pcx, png, tif)">File|Grid|Export</tool>
+    <tool id_or_name="Import Image (bmp, jpg, png, tif, gif, pnm, xpm)">File|Grid|Import</tool>
+    <tool id_or_name="Export Grid to KML">File|Grid|Export</tool>
+  </library>
+  <library name="io_shapes">
+    <tool id_or_name="Export GStat Shapes">File|Shapes|Export</tool>
+    <tool id_or_name="Import GStat Shapes">File|Shapes|Import</tool>
+    <tool id_or_name="Export Shapes to XYZ">File|Shapes|Export</tool>
+    <tool id_or_name="Import Shapes from XYZ">File|Shapes|Import</tool>
+    <tool id_or_name="Export Shapes to Generate">File|Shapes|Export</tool>
+    <tool id_or_name="Export Surfer Blanking File">File|Shapes|Export</tool>
+    <tool id_or_name="Import Surfer Blanking Files">File|Shapes|Import</tool>
+    <tool id_or_name="Export Atlas Boundary File">File|Shapes|Export</tool>
+    <tool id_or_name="Import Atlas Boundary File">File|Shapes|Import</tool>
+    <tool id_or_name="Export WASP terrain map file">File|Shapes|Export</tool>
+    <tool id_or_name="Import WASP terrain map file">File|Shapes|Import</tool>
+    <tool id_or_name="Import Stereo Lithography File (STL)">File|Shapes|Import</tool>
+    <tool id_or_name="Export TIN to Stereo Lithography File (STL)">File|Shapes|Export</tool>
+    <tool id_or_name="Import GPX">File|Shapes|Import</tool>
+    <tool id_or_name="Export GPX">File|Shapes|Export</tool>
+    <tool id_or_name="Import Point Cloud from Shape File">File|Shapes|Import</tool>
+    <tool id_or_name="Import Point Cloud from Text File">File|Shapes|Import</tool>
+    <tool id_or_name="Export Scalable Vector Graphics (SVG) File">File|Shapes|Export</tool>
+    <tool id_or_name="Export Point Cloud to Text File">File|Shapes|Export</tool>
+    <tool id_or_name="Import Simple Features from Well Known Text">File|Shapes|Import</tool>
+    <tool id_or_name="Export Simple Features to Well Known Text">File|Shapes|Export</tool>
+  </library>
+  <library name="io_shapes_dxf">
+    <tool id_or_name="Import DXF Files">File|Shapes|Import</tool>
+  </library>
+  <library name="io_table">
+    <tool id_or_name="Export Text Table">File|Tables|Export</tool>
+    <tool id_or_name="Import Text Table">File|Tables|Import</tool>
+    <tool id_or_name="Import Text Table with Numbers only">File|Tables|Import</tool>
+    <tool id_or_name="Import Text Table (Fixed Column Sizes)">File|Tables|Import</tool>
+  </library>
+  <library name="io_virtual">
+    <tool id_or_name="Create Virtual Point Cloud Dataset">File|Virtual|Point Cloud</tool>
+    <tool id_or_name="Get Subset from Virtual Point Cloud">File|Virtual|Point Cloud</tool>
+    <tool id_or_name="Create Tileshape from Virtual Point Cloud">File|Virtual|Point Cloud</tool>
+    <tool id_or_name="Get Subset from Virtual Point Cloud">File|Virtual|Point Cloud</tool>
+    <tool id_or_name="Get Grid from Virtual Point Cloud">File|Virtual|Point Cloud</tool>
+    <tool id_or_name="Get Grid from Virtual Point Cloud">File|Virtual|Point Cloud</tool>
+  </library>
+  <library name="pj_georeference">
+    <tool id_or_name="Create Reference Points">Projection|Georeferencing</tool>
+    <tool id_or_name="Rectify Grid">Projection|Georeferencing</tool>
+    <tool id_or_name="Warping Shapes">Projection|Georeferencing</tool>
+    <tool id_or_name="Move Grid">Projection|Georeferencing</tool>
+    <tool id_or_name="Direct Georeferencing of Airborne Photographs">Projection|Georeferencing</tool>
+    <tool id_or_name="Define Georeference for Grids">Projection|Georeferencing</tool>
+  </library>
+  <library name="pj_geotrans">
+    <tool id_or_name="GeoTrans (Shapes)">Projection|Alternatives</tool>
+    <tool id_or_name="GeoTrans (Grid)">Projection|Alternatives</tool>
+  </library>
+  <library name="pj_proj4">
+    <tool id_or_name="Set Coordinate Reference System">Projection</tool>
+    <tool id_or_name="Coordinate Transformation (Shapes List)">Projection</tool>
+    <tool id_or_name="Coordinate Transformation (Shapes)">Projection</tool>
+    <tool id_or_name="Coordinate Transformation (Grid List)">Projection</tool>
+    <tool id_or_name="Coordinate Transformation (Grid)">Projection</tool>
+    <tool id_or_name="[deprecated] Proj.4 (Command Line Arguments, Shapes)">Projection|Alternatives</tool>
+    <tool id_or_name="[deprecated] Proj.4 (Dialog, Shapes)">Projection|Alternatives</tool>
+    <tool id_or_name="[deprecated] Proj.4 (Command Line Arguments, Grid)">Projection|Alternatives</tool>
+    <tool id_or_name="[deprecated] Proj.4 (Dialog, Grid)">Projection|Alternatives</tool>
+    <tool id_or_name="[deprecated] Proj.4 (Command Line Arguments, List of Shapes Layers)">Projection|Alternatives</tool>
+    <tool id_or_name="[deprecated] Proj.4 (Dialog, List of Shapes Layers)">Projection|Alternatives</tool>
+    <tool id_or_name="[deprecated] Proj.4 (Command Line Arguments, List of Grids)">Projection|Alternatives</tool>
+    <tool id_or_name="[deprecated] Proj.4 (Dialog, List of Grids)">Projection|Alternatives</tool>
+    <tool id_or_name="Change Longitudinal Range for Grids">Projection|Tools</tool>
+    <tool id_or_name="Latitude/Longitude Graticule">Projection|Tools</tool>
+    <tool id_or_name="Coordinate Reference System Picker">Projection|Tools</tool>
+    <tool id_or_name="Tissot's Indicatrix">Projection|Tools</tool>
+    <tool id_or_name="Geographic Coordinate Grids">Projection|Tools</tool>
+    <tool id_or_name="Coordinate Transformation (Point Cloud List)">Projection</tool>
+    <tool id_or_name="Coordinate Transformation (Point Cloud)">Projection</tool>
+  </library>
+  <library name="garden_3d_viewer">
+    <tool id_or_name="TIN Viewer">Visualization|3D Viewer</tool>
+    <tool id_or_name="Point Cloud Viewer">Visualization|3D Viewer</tool>
+    <tool id_or_name="3D Shapes Viewer">Visualization|3D Viewer</tool>
+    <tool id_or_name="Globe Viewer for Grids">Visualization|3D Viewer</tool>
+    <tool id_or_name="Multiple Grids Viewer">Visualization|3D Viewer</tool>
+  </library>
+  <library name="grid_visualisation">
+    <tool id_or_name="Color Palette Rotation">Visualization|Grid</tool>
+    <tool id_or_name="Color Blending">Visualization|Grid</tool>
+    <tool id_or_name="Fit Color Palette to Grid Values">Visualization|Grid</tool>
+    <tool id_or_name="RGB Composite">Visualization|Grid</tool>
+    <tool id_or_name="Create 3D Image">Visualization|Grid</tool>
+    <tool id_or_name="Color Triangle Composite">Visualization|Grid</tool>
+    <tool id_or_name="Histogram Surface">Visualization|Grid</tool>
+    <tool id_or_name="Aspect-Slope Grid">Visualization|Grid</tool>
+    <tool id_or_name="Terrain Map View">Visualization|Grid</tool>
+    <tool id_or_name="Split RGB Composite">Visualization|Grid</tool>
+  </library>
+  <library name="pointcloud_viewer">
+    <tool id_or_name="[deprecated] Point Cloud Viewer">Visualization|3D Viewer</tool>
+  </library>
+  <library name="pointcloud_tools">
+    <tool id_or_name="Point Cloud Cutter">Shapes|Point Clouds|Tools</tool>
+    <tool id_or_name="Point Cloud Cutter">Shapes|Point Clouds|Tools</tool>
+    <tool id_or_name="Point Cloud from Grid Points">Shapes|Point Clouds|Conversion</tool>
+    <tool id_or_name="Point Cloud from Shapes">Shapes|Point Clouds|Conversion</tool>
+    <tool id_or_name="Point Cloud to Grid">Shapes|Point Clouds|Conversion</tool>
+    <tool id_or_name="Point Cloud to Shapes">Shapes|Point Clouds|Conversion</tool>
+    <tool id_or_name="Point Cloud Reclassifier / Subset Extractor">Shapes|Point Clouds|Tools</tool>
+    <tool id_or_name="Drop Point Cloud Attributes">Shapes|Point Clouds|Tools</tool>
+    <tool id_or_name="Transform Point Cloud">Shapes|Point Clouds|Tools</tool>
+    <tool id_or_name="Point Cloud Thinning (simple)">Shapes|Point Clouds|Tools</tool>
+    <tool id_or_name="Point Cloud Attribute Calculator">Shapes|Point Clouds|Tools</tool>
+    <tool id_or_name="Cluster Analysis for Point Clouds">Shapes|Point Clouds|Classification</tool>
+    <tool id_or_name="Merge Point Clouds">Shapes|Point Clouds|Tools</tool>
+  </library>
+  <library name="shapes_grid">
+    <tool id_or_name="Add Grid Values to Points">Shapes|Grid|Grid Values</tool>
+    <tool id_or_name="Add Grid Values to Shapes">Shapes|Grid|Grid Values</tool>
+    <tool id_or_name="Grid Statistics for Polygons">Shapes|Grid|Grid Values</tool>
+    <tool id_or_name="Grid Values to Points">Shapes|Grid|Vectorization</tool>
+    <tool id_or_name="Grid Values to Points (randomly)">Shapes|Grid|Vectorization</tool>
+    <tool id_or_name="Contour Lines from Grid">Shapes|Grid|Vectorization</tool>
+    <tool id_or_name="Vectorising Grid Classes">Shapes|Grid|Vectorization</tool>
+    <tool id_or_name="Clip Grid with Polygon">Shapes|Grid|Spatial Extent</tool>
+    <tool id_or_name="Local Minima and Maxima">Shapes|Grid|Grid Values</tool>
+    <tool id_or_name="Grid System Extent">Shapes|Grid|Spatial Extent</tool>
+    <tool id_or_name="Clip Grid with Rectangle">Shapes|Grid|Spatial Extent</tool>
+    <tool id_or_name="Gradient Vectors from Surface">Shapes|Grid|Vectorization</tool>
+    <tool id_or_name="Gradient Vectors from Direction and Length">Shapes|Grid|Vectorization</tool>
+    <tool id_or_name="Gradient Vectors from Directional Components">Shapes|Grid|Vectorization</tool>
+  </library>
+  <library name="shapes_lines">
+    <tool id_or_name="Convert Polygons to Lines">Shapes|Conversion</tool>
+    <tool id_or_name="Convert Points to Line(s)">Shapes|Conversion</tool>
+    <tool id_or_name="Line Properties">Shapes|Lines</tool>
+    <tool id_or_name="Line-Polygon Intersection">Shapes|Lines</tool>
+    <tool id_or_name="Line Simplification">Shapes|Lines</tool>
+    <tool id_or_name="Line Dissolve">Shapes|Lines</tool>
+    <tool id_or_name="Split Lines with Lines">Shapes|Lines</tool>
+    <tool id_or_name="Line Smoothing">Shapes|Lines</tool>
+  </library>
+  <library name="shapes_points">
+    <tool id_or_name="Convert Table to Points">Shapes|Conversion</tool>
+    <tool id_or_name="Count Points in Polygons">Shapes|Points</tool>
+    <tool id_or_name="Create Point Grid">Shapes|Points</tool>
+    <tool id_or_name="Point Distances">Shapes|Points</tool>
+    <tool id_or_name="Fit N Points to shape">Shapes|Points</tool>
+    <tool id_or_name="Convert Lines to Points">Shapes|Conversion</tool>
+    <tool id_or_name="Add Coordinates to points">Shapes|Points</tool>
+    <tool id_or_name="Remove Duplicate Points">Shapes|Points</tool>
+    <tool id_or_name="Clip Points with Polygons">Shapes|Points</tool>
+    <tool id_or_name="Separate points by direction">Shapes|Points</tool>
+    <tool id_or_name="Add Polygon Attributes to Points">Shapes|Points</tool>
+    <tool id_or_name="Points Filter">Shapes|Points</tool>
+    <tool id_or_name="Convex Hull">Shapes|Tools</tool>
+    <tool id_or_name="Select Points">Shapes|Selection</tool>
+    <tool id_or_name="Points Thinning">Shapes|Points</tool>
+    <tool id_or_name="Convert Multipoints to Points">Shapes|Conversion</tool>
+    <tool id_or_name="Thiessen Polygons">Shapes|Points</tool>
+    <tool id_or_name="Aggregate Point Observations">Shapes|Points</tool>
+    <tool id_or_name="Snap Points to Points">Shapes|Points</tool>
+    <tool id_or_name="Snap Points to Lines">Shapes|Points</tool>
+    <tool id_or_name="Snap Points to Grid">Shapes|Points</tool>
+  </library>
+  <library name="shapes_polygons">
+    <tool id_or_name="Polygon Centroids">Shapes|Polygons</tool>
+    <tool id_or_name="Polygon Properties">Shapes|Polygons</tool>
+    <tool id_or_name="Convert Lines to Polygons">Shapes|Conversion</tool>
+    <tool id_or_name="Point Statistics for Polygons">Shapes|Polygons</tool>
+    <tool id_or_name="Polygon Dissolve">Shapes|Polygons</tool>
+    <tool id_or_name="Convert Polygon/Line Vertices to Points">Shapes|Conversion</tool>
+    <tool id_or_name="Polygon Shape Indices">Shapes|Polygons</tool>
+    <tool id_or_name="Polygon-Line Intersection">Shapes|Polygons</tool>
+    <tool id_or_name="Polygons to Edges and Nodes">Shapes|Polygons</tool>
+    <tool id_or_name="Polygon Parts to Separate Polygons">Shapes|Polygons</tool>
+    <tool id_or_name="Polygon Clipping">Shapes|Polygons</tool>
+    <tool id_or_name="Polygon Self-Intersection">Shapes|Polygons</tool>
+    <tool id_or_name="Intersect">Shapes|Polygons|Overlay</tool>
+    <tool id_or_name="Difference">Shapes|Polygons|Overlay</tool>
+    <tool id_or_name="Symmetrical Difference">Shapes|Polygons|Overlay</tool>
+    <tool id_or_name="Union">Shapes|Polygons|Overlay</tool>
+    <tool id_or_name="Update">Shapes|Polygons|Overlay</tool>
+    <tool id_or_name="Identity">Shapes|Polygons|Overlay</tool>
+    <tool id_or_name="Add Point Attributes to Polygons">Shapes|Polygons</tool>
+    <tool id_or_name="Flatten Polygon Layer">Shapes|Polygons</tool>
+    <tool id_or_name="Shared Polygon Edges">Shapes|Polygons</tool>
+  </library>
+  <library name="shapes_tools">
+    <tool id_or_name="Create New Shapes Layer">Shapes|Construction</tool>
+    <tool id_or_name="Merge Layers">Shapes|Construction</tool>
+    <tool id_or_name="Select by Attributes... (Numerical Expression)">Shapes|Selection</tool>
+    <tool id_or_name="Select by Attributes... (String Expression)">Shapes|Selection</tool>
+    <tool id_or_name="Select by Location...">Shapes|Selection</tool>
+    <tool id_or_name="Copy Selection to New Shapes Layer">Shapes|Selection</tool>
+    <tool id_or_name="Delete Selection from Shapes Layer">Shapes|Selection</tool>
+    <tool id_or_name="Invert Selection of Shapes Layer">Shapes|Selection</tool>
+    <tool id_or_name="Split Shapes Layer Completely">Shapes|Construction</tool>
+    <tool id_or_name="Transform Shapes">Shapes|Tools</tool>
+    <tool id_or_name="Create Chart Layer (bars/sectors)">Shapes|Tools</tool>
+    <tool id_or_name="Create Graticule">Shapes|Tools</tool>
+    <tool id_or_name="Cut Shapes Layer">Shapes|Construction</tool>
+    <tool id_or_name="Cut Shapes Layer">Shapes|Construction</tool>
+    <tool id_or_name="Split Shapes Layer">Shapes|Construction</tool>
+    <tool id_or_name="Split Shapes Layer Randomly">Shapes|Construction</tool>
+    <tool id_or_name="Split Table/Shapes by Attribute">Shapes|Construction</tool>
+    <tool id_or_name="Shapes Buffer">Shapes|Tools</tool>
+    <tool id_or_name="Get Shapes Extents">Shapes|Tools</tool>
+    <tool id_or_name="QuadTree Structure to Shapes">Shapes|Tools</tool>
+    <tool id_or_name="Polar to Cartesian Coordinates">Shapes|Tools</tool>
+    <tool id_or_name="Generate Shapes">Shapes|Construction</tool>
+    <tool id_or_name="Convert Vertex Type (2D/3D)">Shapes|Conversion</tool>
+    <tool id_or_name="Merge Tables">Table|Tools</tool>
+  </library>
+  <library name="shapes_transect">
+    <tool id_or_name="Transect through polygon shapefile">Shapes|Lines|Transects</tool>
+  </library>
+  <library name="sim_cellular_automata">
+    <tool id_or_name="Conway's Life">Simulation|Cellular Automata</tool>
+    <tool id_or_name="Wa-Tor">Simulation|Cellular Automata</tool>
+  </library>
+  <library name="sim_erosion">
+    <tool id_or_name="MMF-SAGA Soil Erosion Model">Simulation|Erosion</tool>
+  </library>
+  <library name="sim_fire_spreading">
+    <tool id_or_name="Fire Risk Analysis">Simulation|Fire Spreading</tool>
+    <tool id_or_name="Simulation">Simulation|Fire Spreading</tool>
+  </library>
+  <library name="sim_hydrology">
+    <tool id_or_name="Soil Moisture Content">Simulation|Hydrology</tool>
+    <tool id_or_name="Overland Flow - Kinematic Wave D8">Simulation|Hydrology</tool>
+    <tool id_or_name="TOPMODEL">Simulation|Hydrology</tool>
+    <tool id_or_name="Water Retention Capacity">Simulation|Hydrology</tool>
+  </library>
+  <library name="sim_ihacres">
+    <tool id_or_name="IHACRES Calibration (2)">Simulation|Hydrology|IHACRES</tool>
+    <tool id_or_name="IHACRES Version 1.0">Simulation|Hydrology|IHACRES</tool>
+    <tool id_or_name="IHACRES Basin">Simulation|Hydrology|IHACRES</tool>
+    <tool id_or_name="IHACRES Elevation Bands">Simulation|Hydrology|IHACRES</tool>
+    <tool id_or_name="IHACRES Elevation Bands Calibration">Simulation|Hydrology|IHACRES</tool>
+  </library>
+  <library name="statistics_grid">
+    <tool id_or_name="Fast Representativeness">Spatial and Geostatistics|Grids</tool>
+    <tool id_or_name="Residual Analysis (Grid)">Spatial and Geostatistics|Grids</tool>
+    <tool id_or_name="Representativeness (Grid)">Spatial and Geostatistics|Grids</tool>
+    <tool id_or_name="Radius of Variance (Grid)">Spatial and Geostatistics|Grids</tool>
+    <tool id_or_name="Statistics for Grids">Spatial and Geostatistics|Grids</tool>
+    <tool id_or_name="Zonal Grid Statistics">Spatial and Geostatistics|Grids</tool>
+    <tool id_or_name="Directional Statistics for Single Grid">Spatial and Geostatistics|Grids</tool>
+    <tool id_or_name="Global Moran's I for Grids">Spatial and Geostatistics|Grids</tool>
+    <tool id_or_name="Principle Components Analysis">Spatial and Geostatistics|Grids|Principle Components</tool>
+    <tool id_or_name="Multi-Band Variation">Spatial and Geostatistics|Grids</tool>
+    <tool id_or_name="Inverse Principle Components Rotation">Spatial and Geostatistics|Grids|Principle Components</tool>
+    <tool id_or_name="Longitudinal Grid Statistics">Spatial and Geostatistics|Grids</tool>
+    <tool id_or_name="Meridional Grid Statistics">Spatial and Geostatistics|Grids</tool>
+    <tool id_or_name="Save Grid Statistics to Table">Spatial and Geostatistics|Grids</tool>
+  </library>
+  <library name="statistics_kriging">
+    <tool id_or_name="Ordinary Kriging">Spatial and Geostatistics|Kriging</tool>
+    <tool id_or_name="Ordinary Kriging (Global)">Spatial and Geostatistics|Kriging</tool>
+    <tool id_or_name="Universal Kriging">Spatial and Geostatistics|Kriging</tool>
+    <tool id_or_name="Universal Kriging (Global)">Spatial and Geostatistics|Kriging</tool>
+    <tool id_or_name="Variogram (Dialog))">Spatial and Geostatistics|Points</tool>
+    <tool id_or_name="[deprecated] Ordinary Kriging">Spatial and Geostatistics|Kriging|Without Variogram Fit</tool>
+    <tool id_or_name="[deprecated] Ordinary Kriging (Global)">Spatial and Geostatistics|Kriging|Without Variogram Fit</tool>
+    <tool id_or_name="[deprecated] Universal Kriging">Spatial and Geostatistics|Kriging|Without Variogram Fit</tool>
+    <tool id_or_name="[deprecated] Universal Kriging (Global)">Spatial and Geostatistics|Kriging|Without Variogram Fit</tool>
+  </library>
+  <library name="statistics_points">
+    <tool id_or_name="Variogram">Spatial and Geostatistics|Points</tool>
+    <tool id_or_name="Variogram Cloud">Spatial and Geostatistics|Points</tool>
+    <tool id_or_name="Variogram Surface">Spatial and Geostatistics|Points</tool>
+    <tool id_or_name="Minimum Distance Analysis">Spatial and Geostatistics|Points</tool>
+    <tool id_or_name="Spatial Point Pattern Analysis">Spatial and Geostatistics|Points</tool>
+  </library>
+  <library name="statistics_regression">
+    <tool id_or_name="Regression Analysis (Points/Grid)">Spatial and Geostatistics|Regression</tool>
+    <tool id_or_name="Multiple Regression Analysis (Points/Grids)">Spatial and Geostatistics|Regression</tool>
+    <tool id_or_name="Polynomial Regression">Spatial and Geostatistics|Regression</tool>
+    <tool id_or_name="GWR for Single Predictor (Gridded Model Output)">Spatial and Geostatistics|Regression|GWR</tool>
+    <tool id_or_name="GWR for Single Predictor Grid">Spatial and Geostatistics|Regression|GWR</tool>
+    <tool id_or_name="GWR for Multiple Predictors (Gridded Model Output)">Spatial and Geostatistics|Regression|GWR</tool>
+    <tool id_or_name="GWR for Multiple Predictor Grids">Spatial and Geostatistics|Regression|GWR</tool>
+    <tool id_or_name="GWR for Multiple Predictors">Spatial and Geostatistics|Regression|GWR</tool>
+    <tool id_or_name="Multiple Regression Analysis (Grid/Grids)">Spatial and Geostatistics|Regression</tool>
+    <tool id_or_name="Polynomial Trend from Grids">Spatial and Geostatistics|Regression</tool>
+    <tool id_or_name="Trend Analysis">Spatial and Geostatistics|Regression|Table</tool>
+    <tool id_or_name="Trend Analysis (Shapes)">Spatial and Geostatistics|Regression|Shapes</tool>
+    <tool id_or_name="Multiple Linear Regression Analysis">Spatial and Geostatistics|Regression|Table</tool>
+    <tool id_or_name="Multiple Linear Regression Analysis (Shapes)">Spatial and Geostatistics|Regression|Shapes</tool>
+    <tool id_or_name="GWR for Grid Downscaling">Spatial and Geostatistics|Regression|GWR</tool>
+  </library>
+  <library name="table_calculus">
+    <tool id_or_name="Function Fit">Table|Calculus</tool>
+    <tool id_or_name="Table Calculator">Table|Calculus</tool>
+    <tool id_or_name="Table Calculator (Shapes)">Shapes|Table</tool>
+    <tool id_or_name="Running Average">Table|Calculus</tool>
+    <tool id_or_name="Cluster Analysis">Table|Calculus</tool>
+    <tool id_or_name="Principle Components Analysis">Table|Calculus</tool>
+    <tool id_or_name="Fill Gaps in Records">Table|Calculus</tool>
+    <tool id_or_name="Find Field of Extreme Value">Table|Calculus</tool>
+    <tool id_or_name="Minimum Redundancy Feature Selection">Table|Calculus</tool>
+    <tool id_or_name="Cluster Analysis (Shapes)">Shapes|Table</tool>
+    <tool id_or_name="Field Statistics">Table|Calculus</tool>
+  </library>
+  <library name="table_tools">
+    <tool id_or_name="Create New Table">Table|Construction</tool>
+    <tool id_or_name="Transpose Table">Table|Tools</tool>
+    <tool id_or_name="Enumerate Table Field">Table|Tools</tool>
+    <tool id_or_name="Join Attributes from a Table">Table|Tools</tool>
+    <tool id_or_name="Join Attributes from a Table (Shapes)">Shapes|Table</tool>
+    <tool id_or_name="Change Date Format">Table|Tools</tool>
+    <tool id_or_name="Change Time Format">Table|Tools</tool>
+    <tool id_or_name="Change Field Type">Table|Tools</tool>
+    <tool id_or_name="Append Rows from Table">Table|Tools</tool>
+    <tool id_or_name="Change Color Format">Table|Tools</tool>
+    <tool id_or_name="Replace Text">Table|Tools</tool>
+    <tool id_or_name="Delete Fields">Table|Tools</tool>
+    <tool id_or_name="Copy Selection">Table|Selection</tool>
+    <tool id_or_name="Delete Selection">Table|Selection</tool>
+    <tool id_or_name="Invert Selection">Table|Selection</tool>
+    <tool id_or_name="Select by Numerical Expression">Table|Selection</tool>
+    <tool id_or_name="Select by String Expression">Table|Selection</tool>
+  </library>
+  <library name="ta_channels">
+    <tool id_or_name="Channel Network">Terrain Analysis|Channels</tool>
+    <tool id_or_name="Watershed Basins">Terrain Analysis|Channels</tool>
+    <tool id_or_name="Watershed Basins (Extended)">Terrain Analysis|Channels</tool>
+    <tool id_or_name="Vertical Distance to Channel Network">Terrain Analysis|Channels</tool>
+    <tool id_or_name="Overland Flow Distance to Channel Network">Terrain Analysis|Channels</tool>
+    <tool id_or_name="Channel Network and Drainage Basins">Terrain Analysis|Channels</tool>
+    <tool id_or_name="Strahler Order">Terrain Analysis|Channels</tool>
+    <tool id_or_name="Valley Depth">Terrain Analysis|Channels</tool>
+  </library>
+  <library name="ta_compound">
+    <tool id_or_name="Basic Terrain Analysis">Terrain Analysis</tool>
+  </library>
+  <library name="ta_hydrology">
+    <tool id_or_name="Catchment Area (Top-Down)">Terrain Analysis|Hydrology|Catchment Area</tool>
+    <tool id_or_name="Catchment Area (Recursive)">Terrain Analysis|Hydrology|Catchment Area</tool>
+    <tool id_or_name="Catchment Area (Flow Tracing)">Terrain Analysis|Hydrology|Catchment Area</tool>
+    <tool id_or_name="Upslope Area">Terrain Analysis|Hydrology|Catchment Area</tool>
+    <tool id_or_name="Upslope Area">Terrain Analysis|Hydrology|Catchment Area</tool>
+    <tool id_or_name="Downslope Area">Terrain Analysis|Hydrology|Catchment Area</tool>
+    <tool id_or_name="Flow Path Length">Terrain Analysis|Hydrology|Catchment Area</tool>
+    <tool id_or_name="Slope Length">Terrain Analysis|Hydrology|Miscellaneous</tool>
+    <tool id_or_name="Isochrones Constant Speed">Terrain Analysis|Hydrology|Dynamics</tool>
+    <tool id_or_name="Isochrones Variable Speed">Terrain Analysis|Hydrology|Dynamics</tool>
+    <tool id_or_name="Cell Balance">Terrain Analysis|Hydrology|Miscellaneous</tool>
+    <tool id_or_name="Flow Sinuosity">Terrain Analysis|Hydrology|Dynamics</tool>
+    <tool id_or_name="Flow Depth">Terrain Analysis|Hydrology|Dynamics</tool>
+    <tool id_or_name="Edge Contamination">Terrain Analysis|Hydrology|Catchment Area</tool>
+    <tool id_or_name="SAGA Wetness Index">Terrain Analysis|Hydrology|Topographic Indices</tool>
+    <tool id_or_name="Lake Flood">Terrain Analysis|Hydrology|Miscellaneous</tool>
+    <tool id_or_name="Lake Flood">Terrain Analysis|Hydrology|Miscellaneous</tool>
+    <tool id_or_name="Catchment Area (Mass-Flux Method)">Terrain Analysis|Hydrology|Catchment Area</tool>
+    <tool id_or_name="Flow Width and Specific Catchment Area">Terrain Analysis|Hydrology|Catchment Area</tool>
+    <tool id_or_name="Topographic Wetness Index (TWI)">Terrain Analysis|Hydrology|Topographic Indices</tool>
+    <tool id_or_name="Stream Power Index">Terrain Analysis|Hydrology|Topographic Indices</tool>
+    <tool id_or_name="LS Factor">Terrain Analysis|Hydrology|Topographic Indices</tool>
+    <tool id_or_name="Melton Ruggedness Number">Terrain Analysis|Hydrology|Topographic Indices</tool>
+    <tool id_or_name="TCI Low">Terrain Analysis|Hydrology|Topographic Indices</tool>
+    <tool id_or_name="LS-Factor, Field Based">Terrain Analysis|Hydrology|Topographic Indices</tool>
+    <tool id_or_name="Slope Limited Flow Accumulation">Terrain Analysis|Hydrology|Catchment Area</tool>
+  </library>
+  <library name="ta_lighting">
+    <tool id_or_name="Analytical Hillshading">Terrain Analysis|Lighting</tool>
+    <tool id_or_name="Visibility (single point)">Terrain Analysis|Lighting</tool>
+    <tool id_or_name="Potential Incoming Solar Radiation">Terrain Analysis|Lighting</tool>
+    <tool id_or_name="Sky View Factor">Terrain Analysis|Lighting</tool>
+    <tool id_or_name="Topographic Correction">Terrain Analysis|Lighting</tool>
+    <tool id_or_name="Topographic Openness">Terrain Analysis|Lighting</tool>
+    <tool id_or_name="Visibility (points)">Terrain Analysis|Lighting</tool>
+  </library>
+  <library name="ta_morphometry">
+    <tool id_or_name="Slope, Aspect, Curvature">Terrain Analysis|Morphometry</tool>
+    <tool id_or_name="Convergence Index">Terrain Analysis|Morphometry</tool>
+    <tool id_or_name="Convergence Index (Search Radius)">Terrain Analysis|Morphometry</tool>
+    <tool id_or_name="Surface Specific Points">Terrain Analysis|Terrain Classification</tool>
+    <tool id_or_name="Curvature Classification">Terrain Analysis|Terrain Classification</tool>
+    <tool id_or_name="Hypsometry">Terrain Analysis|Morphometry</tool>
+    <tool id_or_name="Real Surface Area">Terrain Analysis|Morphometry</tool>
+    <tool id_or_name="Morphometric Protection Index">Terrain Analysis|Morphometry</tool>
+    <tool id_or_name="Multiresolution Index of Valley Bottom Flatness (MRVBF)">Terrain Analysis|Morphometry</tool>
+    <tool id_or_name="Downslope Distance Gradient">Terrain Analysis|Morphometry</tool>
+    <tool id_or_name="Mass Balance Index">Terrain Analysis|Morphometry</tool>
+    <tool id_or_name="Effective Air Flow Heights">Terrain Analysis|Climate and Weather</tool>
+    <tool id_or_name="Diurnal Anisotropic Heating">Terrain Analysis|Climate and Weather</tool>
+    <tool id_or_name="Land Surface Temperature">Terrain Analysis|Climate and Weather</tool>
+    <tool id_or_name="Relative Heights and Slope Positions">Terrain Analysis|Morphometry</tool>
+    <tool id_or_name="Wind Effect (Windward / Leeward Index)">Terrain Analysis|Climate and Weather</tool>
+    <tool id_or_name="Terrain Ruggedness Index (TRI)">Terrain Analysis|Morphometry</tool>
+    <tool id_or_name="Vector Ruggedness Measure (VRM)">Terrain Analysis|Morphometry</tool>
+    <tool id_or_name="Topographic Position Index (TPI)">Terrain Analysis|Morphometry</tool>
+    <tool id_or_name="TPI Based Landform Classification">Terrain Analysis|Terrain Classification</tool>
+    <tool id_or_name="Terrain Surface Texture">Terrain Analysis|Morphometry</tool>
+    <tool id_or_name="Terrain Surface Convexity">Terrain Analysis|Morphometry</tool>
+    <tool id_or_name="Terrain Surface Classification">Terrain Analysis|Terrain Classification</tool>
+    <tool id_or_name="Morphometric Features">Terrain Analysis|Terrain Classification</tool>
+    <tool id_or_name="Valley and Ridge Detection (Top Hat Approach)">Terrain Analysis|Terrain Classification</tool>
+    <tool id_or_name="Fuzzy Landform Element Classification">Terrain Analysis|Terrain Classification</tool>
+  </library>
+  <library name="ta_preprocessor">
+    <tool id_or_name="Flat Detection">Terrain Analysis|Preprocessing</tool>
+    <tool id_or_name="Sink Drainage Route Detection">Terrain Analysis|Preprocessing</tool>
+    <tool id_or_name="Sink Removal">Terrain Analysis|Preprocessing</tool>
+    <tool id_or_name="Fill Sinks (Planchon/Darboux, 2001)">Terrain Analysis|Preprocessing</tool>
+    <tool id_or_name="Fill Sinks (Wang & Liu)">Terrain Analysis|Preprocessing</tool>
+    <tool id_or_name="Fill Sinks XXL (Wang & Liu)">Terrain Analysis|Preprocessing</tool>
+    <tool id_or_name="Burn Stream Network into DEM">Terrain Analysis|Preprocessing</tool>
+  </library>
+  <library name="ta_profiles">
+    <tool id_or_name="Profile">Terrain Analysis|Profiles</tool>
+    <tool id_or_name="Flow Path Profile">Terrain Analysis|Profiles</tool>
+    <tool id_or_name="Swath Profile">Terrain Analysis|Profiles</tool>
+    <tool id_or_name="Cross Profiles">Terrain Analysis|Profiles</tool>
+    <tool id_or_name="Profiles from Lines">Terrain Analysis|Profiles</tool>
+    <tool id_or_name="Profile from points">Terrain Analysis|Profiles</tool>
+  </library>
+  <library name="ta_slope_stability">
+    <tool id_or_name="SAFETYFACTOR">Terrain Analysis|Slope Stability</tool>
+    <tool id_or_name="TOBIA">Terrain Analysis|Slope Stability</tool>
+    <tool id_or_name="SHALSTAB">Terrain Analysis|Slope Stability</tool>
+    <tool id_or_name="WETNESS">Terrain Analysis|Slope Stability</tool>
+    <tool id_or_name="WEDGEFAIL">Terrain Analysis|Slope Stability</tool>
+    <tool id_or_name="ANGMAP">Terrain Analysis|Slope Stability</tool>
+  </library>
+  <library name="tin_tools">
+    <tool id_or_name="Grid to TIN">TIN|Conversion</tool>
+    <tool id_or_name="Grid to TIN (Surface Specific Points)">TIN|Conversion</tool>
+    <tool id_or_name="Shapes to TIN">TIN|Conversion</tool>
+    <tool id_or_name="TIN to Shapes">TIN|Conversion</tool>
+    <tool id_or_name="Gradient">TIN|Terrain Analysis</tool>
+    <tool id_or_name="Flow Accumulation (Trace)">TIN|Terrain Analysis</tool>
+    <tool id_or_name="Flow Accumulation (Parallel)">TIN|Terrain Analysis</tool>
+  </library>
+  <library name="tin_viewer">
+    <tool id_or_name="[deprecated] TIN Viewer">Visualization|3D Viewer</tool>
+  </library>
+</saga_gui_tool_menus>
diff --git a/src/saga_core/saga_gui/res/tool_menus_example.xml b/src/saga_core/saga_gui/res/tool_menus_example.xml
new file mode 100644
index 0000000..5a7f74f
--- /dev/null
+++ b/src/saga_core/saga_gui/res/tool_menus_example.xml
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<saga_gui_tool_menus saga-version="2.2.0">
+  <description>
+    This file shall serve as a template for user defined tool menus.
+	A tool's entry has to be defined as a subitem of its library entry
+	and is identified by either its identifier or name property ('id_or_name=...').
+	The desired menu path is given as the entry's content. Optionally the 
+	menu command's name can be changed with the 'name=...' property. If
+	you don't want to have a menu entry for a tool at all, then simply
+	remove its entry from this file. Activate your user defined tool menus
+	by choosing your file in the SAGA GUI's tool manager settings option:
+	'User defined tool menus'.
+  </description>
+  <library name="io_gdal">
+    <tool id_or_name="GDAL: Import Raster" name="Load Raster">File</tool>
+    <tool id_or_name="GDAL: Export Raster" name="Save Raster">File</tool>
+    <tool id_or_name="GDAL: Export Raster to GeoTIFF" name="Export GeoTIFF">File|Export</tool>
+  </library>
+  <library name="io_grid">
+    <tool id_or_name="Export ESRI Arc/Info Grid">File|Export</tool>
+    <tool id_or_name="Import ESRI Arc/Info Grid">File|Import</tool>
+  </library>
+  <library name="io_grid_image">
+    <tool id_or_name="Export Image (bmp, jpg, pcx, png, tif)">File|Export</tool>
+    <tool id_or_name="Import Image (bmp, jpg, png, tif, gif, pnm, xpm)">File|Import</tool>
+    <tool id_or_name="Export Grid to KML">File|Export</tool>
+  </library>
+  <library name="imagery_vigra">
+    <tool id_or_name="Edge Detection (ViGrA)">Segmentation</tool>
+    <tool id_or_name="Morphological Filter (ViGrA)">Filter</tool>
+    <tool id_or_name="Watershed Segmentation (ViGrA)">Segmentation</tool>
+    <tool id_or_name="Random Forest (ViGrA)">Classification</tool>
+  </library>
+  <library name="imagery_tools">
+    <tool id_or_name="Vegetation Index (Distance Based)">Image Tools|Vegetation Indices</tool>
+    <tool id_or_name="Vegetation Index (Slope Based)">Image Tools|Vegetation Indices</tool>
+    <tool id_or_name="Enhanced Vegetation Index">Image Tools|Vegetation Indices</tool>
+    <tool id_or_name="Tasseled Cap Transformation">Image Tools|Vegetation Indices</tool>
+    <tool id_or_name="IHS Sharpening">Image Tools|Image Sharpening</tool>
+    <tool id_or_name="Colour Normalized Brovey Sharpening">Image Tools|Image Sharpening</tool>
+    <tool id_or_name="Colour Normalized Spectral Sharpening">Image Tools|Image Sharpening</tool>
+    <tool id_or_name="Principle Components Based Image Sharpening">Image Tools|Image Sharpening</tool>
+    <tool id_or_name="Top of Atmosphere Reflectance">Image Tools|Landsat</tool>
+    <tool id_or_name="Automated Cloud Cover Assessment">Image Tools|Landsat</tool>
+    <tool id_or_name="Landsat Import with Options">File|Import</tool>
+  </library>
+  <library name="imagery_svm">
+    <tool id_or_name="SVM Classification">Classification</tool>
+  </library>
+  <library name="imagery_segmentation">
+    <tool id_or_name="Watershed Segmentation">Segmentation</tool>
+    <tool id_or_name="Grid Skeletonization">Segmentation</tool>
+    <tool id_or_name="Seed Generation">Segmentation</tool>
+    <tool id_or_name="Seeded Region Growing">Segmentation</tool>
+  </library>
+  <library name="imagery_opencv">
+    <tool id_or_name="Morphological Filter (OpenCV)">Filter</tool>
+    <tool id_or_name="Neural Networks Classification">Classification</tool>
+  </library>
+  <library name="imagery_classification">
+    <tool id_or_name="Supervised Classification">Classification</tool>
+    <tool id_or_name="Cluster Analysis for Grids" name="Unsupervised Classification">Classification</tool>
+    <tool id_or_name="Change Detection">Classification</tool>
+  </library>
+  <library name="toolchains">
+    <tool id_or_name="Object Based Image Segmentation">Segmentation</tool>
+    <tool id_or_name="Sieve and Clump">Filter</tool>
+  </library>
+  <library name="ta_lighting">
+    <tool id_or_name="Topographic Correction">Raster Tools</tool>
+  </library>
+  <library name="shapes_grid">
+    <tool id_or_name="Vectorising Classes">Classification</tool>
+  </library>
+  <library name="grid_visualisation">
+    <tool id_or_name="RGB Composite">Image Tools|Composites</tool>
+    <tool id_or_name="Color Triangle Composite">Image Tools|Composites</tool>
+    <tool id_or_name="Split RGB Composite">Image Tools|Composites</tool>
+  </library>
+  <library name="pj_proj4">
+    <tool id_or_name="Set Coordinate Reference System">Projection</tool>
+    <tool id_or_name="Coordinate Transformation (Shapes List)" name="Project Features">Projection</tool>
+    <tool id_or_name="Coordinate Transformation (Grid List)" name="Project Raster">Projection</tool>
+  </library>
+  <library name="pj_georeference">
+    <tool id_or_name="Create Reference Points">Projection|Georeferencing</tool>
+    <tool id_or_name="Rectify Grid">Projection|Georeferencing</tool>
+    <tool id_or_name="Move Grid">Projection|Georeferencing</tool>
+    <tool id_or_name="Direct Georeferencing of Airborne Photographs">Projection|Georeferencing</tool>
+    <tool id_or_name="Define Georeference for Grids">Projection|Georeferencing</tool>
+  </library>
+  <library name="grid_tools">
+    <tool id_or_name="Resampling">Raster Tools</tool>
+    <tool id_or_name="Aggregate">Raster Tools</tool>
+    <tool id_or_name="Clip Grids">Raster Tools</tool>
+    <tool id_or_name="Mosaicking">Raster Tools</tool>
+    <tool id_or_name="Patching">Raster Tools</tool>
+    <tool id_or_name="Close Gaps with Spline">Raster Tools</tool>
+    <tool id_or_name="Tiling">Raster Tools</tool>
+    <tool id_or_name="Shrink and Expand">Raster Tools</tool>
+    <tool id_or_name="Clip Grids">Raster Tools</tool>
+  </library>
+  <library name="grid_filter">
+    <tool id_or_name="Gaussian Filter">Filter</tool>
+    <tool id_or_name="Laplacian Filter">Filter</tool>
+    <tool id_or_name="User Defined Filter">Filter</tool>
+    <tool id_or_name="Majority Filter">Filter</tool>
+    <tool id_or_name="Morphological Filter">Filter</tool>
+    <tool id_or_name="Rank Filter">Filter</tool>
+    <tool id_or_name="Mesh Denoise">Filter</tool>
+    <tool id_or_name="Resampling Filter">Filter</tool>
+    <tool id_or_name="Sieving Classes">Filter</tool>
+  </library>
+  <library name="grid_calculus">
+    <tool id_or_name="Grid Normalisation">Raster Tools</tool>
+    <tool id_or_name="Grid Calculator">Raster Tools</tool>
+    <tool id_or_name="Grid Difference">Raster Tools</tool>
+    <tool id_or_name="Grid Standardisation">Raster Tools</tool>
+  </library>
+</saga_gui_tool_menus>
diff --git a/src/saga_core/saga_gui/res_commands.cpp b/src/saga_core/saga_gui/res_commands.cpp
index 973599d..b96382f 100644
--- a/src/saga_core/saga_gui/res_commands.cpp
+++ b/src/saga_core/saga_gui/res_commands.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: res_commands.cpp 2291 2014-10-16 13:46:55Z oconrad $
+ * Version $Id: res_commands.cpp 2527 2015-06-30 15:38:35Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -118,6 +118,7 @@ wxString CMD_Get_Name(int Cmd_ID)
 
 	case ID_CMD_INFO_CLEAR:				return( _TL("Clear") );
 	case ID_CMD_INFO_COPY:				return( _TL("Copy") );
+	case ID_CMD_INFO_SELECTALL:			return( _TL("Select All") );
 
 	case ID_CMD_DATASOURCE_REFRESH:		return( _TL("Refresh") );
 
@@ -134,8 +135,8 @@ wxString CMD_Get_Name(int Cmd_ID)
 
 	case ID_CMD_MODULES_OPEN:			return( _TL("Load Tool Library") );
 	case ID_CMD_MODULES_SEARCH:			return( _TL("Find and Run Tool") );
-	case ID_CMD_MODULES_SAVE_SCRIPT:	return( _TL("Create Script Command File") );
 	case ID_CMD_MODULES_SAVE_DOCS:		return( _TL("Create Tool Description Files") );
+	case ID_CMD_MODULES_SAVE_SCRIPT:		return( _TL("Save to Script File") );
 	case ID_CMD_MODULES_SAVE_TO_CLIPBOARD:	return( _TL("Save to Clipboard") );
 	case ID_CMD_MODULES_CHAIN_RELOAD:	return( _TL("Reload") );
 	case ID_CMD_MODULES_CHAIN_EDIT:		return( _TL("Edit") );
@@ -145,6 +146,7 @@ wxString CMD_Get_Name(int Cmd_ID)
 	case ID_CMD_DATA_PROJECT_OPEN_ADD:	return( _TL("Add Project") );
 	case ID_CMD_DATA_PROJECT_SAVE:		return( _TL("Save Project") );
 	case ID_CMD_DATA_PROJECT_SAVE_AS:	return( _TL("Save Project As...") );
+	case ID_CMD_DATA_PROJECT_BROWSE:	return( _TL("Search for Projects...") );		
 	case ID_CMD_DATA_LEGEND_COPY:		return( _TL("Copy Legend to Clipboard...") );
 	case ID_CMD_DATA_LEGEND_SIZE_INC:	return( _TL("Increase Legend Size") );
 	case ID_CMD_DATA_LEGEND_SIZE_DEC:	return( _TL("Decrease Legend Size") );
diff --git a/src/saga_core/saga_gui/res_commands.h b/src/saga_core/saga_gui/res_commands.h
index acee8de..092bd30 100644
--- a/src/saga_core/saga_gui/res_commands.h
+++ b/src/saga_core/saga_gui/res_commands.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: res_commands.h 2291 2014-10-16 13:46:55Z oconrad $
+ * Version $Id: res_commands.h 2501 2015-06-12 10:02:42Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -123,6 +123,7 @@ enum ID_COMMANDS
 	ID_CMD_WKSP_ITEM_SHOW,
 
 	ID_CMD_INFO_CLEAR,
+	ID_CMD_INFO_SELECTALL,
 	ID_CMD_INFO_COPY,
 
 	ID_CMD_DATASOURCE_REFRESH,
@@ -158,6 +159,7 @@ enum ID_COMMANDS
 	ID_CMD_DATA_PROJECT_OPEN_ADD,
 	ID_CMD_DATA_PROJECT_SAVE,
 	ID_CMD_DATA_PROJECT_SAVE_AS,
+	ID_CMD_DATA_PROJECT_BROWSE,
 	ID_CMD_DATA_LEGEND_COPY,
 	ID_CMD_DATA_LEGEND_SIZE_INC,
 	ID_CMD_DATA_LEGEND_SIZE_DEC,
diff --git a/src/saga_core/saga_gui/res_dialogs.cpp b/src/saga_core/saga_gui/res_dialogs.cpp
index d7ab420..0455d45 100644
--- a/src/saga_core/saga_gui/res_dialogs.cpp
+++ b/src/saga_core/saga_gui/res_dialogs.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: res_dialogs.cpp 2275 2014-10-02 15:48:59Z oconrad $
+ * Version $Id: res_dialogs.cpp 2397 2015-02-03 15:07:22Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -733,12 +733,24 @@ bool		DLG_Directory(wxString &Directory, const wxString &Caption)
 //---------------------------------------------------------
 bool		DLG_Save(wxString &File_Path, const wxString &Caption, const wxString &def_Dir, const wxString &def_File, const wxString &Filter)
 {
-	wxFileDialog	dlg(MDI_Get_Top_Window(), Caption, def_Dir, def_File, Filter, wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
+	wxString	Dir(def_Dir);
+
+	if( !wxDirExists(def_Dir) )
+	{
+		CONFIG_Read(CONFIG_GROUP_FILE_DLG, DLG_Get_FILE_Config(-1), Dir);
+	}
+
+	wxFileDialog	dlg(MDI_Get_Top_Window(), Caption, Dir, def_File, Filter, wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
 
 	if( dlg.ShowModal() == wxID_OK )
 	{
 		File_Path	= dlg.GetPath();
 
+		if( !wxDirExists(def_Dir) )
+		{
+			CONFIG_Write(CONFIG_GROUP_FILE_DLG, DLG_Get_FILE_Config(-1), SG_File_Get_Path(File_Path).w_str());
+		}
+
 		return( true );
 	}
 
@@ -752,7 +764,7 @@ bool		DLG_Save(wxString &File_Path, int ID_DLG)
 	def_Name	= SG_File_Get_Name(File_Path, true).w_str();
 	def_Dir		= SG_File_Get_Path(File_Path).w_str();
 
-	if( !wxFileExists(def_Dir) )
+	if( !wxDirExists(def_Dir) )
 	{
 		CONFIG_Read(CONFIG_GROUP_FILE_DLG, DLG_Get_FILE_Config(ID_DLG), def_Dir);
 	}
@@ -775,12 +787,24 @@ bool		DLG_Save(wxString &File_Path, const wxString &Caption, const wxString &Fil
 //---------------------------------------------------------
 bool		DLG_Open(wxString &File_Path, const wxString &Caption, const wxString &def_Dir, const wxString &def_File, const wxString &Filter)
 {
-	wxFileDialog	dlg(MDI_Get_Top_Window(), Caption, def_Dir, def_File, Filter, wxFD_OPEN|wxFD_FILE_MUST_EXIST);
+	wxString	Dir(def_Dir);
+
+	if( !wxDirExists(def_Dir) )
+	{
+		CONFIG_Read(CONFIG_GROUP_FILE_DLG, DLG_Get_FILE_Config(-1), Dir);
+	}
+
+	wxFileDialog	dlg(MDI_Get_Top_Window(), Caption, Dir, def_File, Filter, wxFD_OPEN|wxFD_FILE_MUST_EXIST);
 
 	if( dlg.ShowModal() == wxID_OK )
 	{
 		File_Path	= dlg.GetPath();
 
+		if( !wxDirExists(def_Dir) )
+		{
+			CONFIG_Write(CONFIG_GROUP_FILE_DLG, DLG_Get_FILE_Config(-1), SG_File_Get_Path(File_Path).w_str());
+		}
+
 		return( true );
 	}
 
@@ -811,13 +835,28 @@ bool		DLG_Open(wxString &File_Path, const wxString &Caption, const wxString &Fil
 //---------------------------------------------------------
 bool		DLG_Open(wxArrayString &File_Paths, const wxString &Caption, const wxString &def_Dir, const wxString &Filter)
 {
-	wxFileDialog	dlg(MDI_Get_Top_Window(), Caption, def_Dir, wxT(""), Filter, wxFD_OPEN|wxFD_FILE_MUST_EXIST|wxFD_MULTIPLE);
+	wxString	Dir(def_Dir);
+
+	if( !wxDirExists(def_Dir) )
+	{
+		CONFIG_Read(CONFIG_GROUP_FILE_DLG, DLG_Get_FILE_Config(-1), Dir);
+	}
+
+	wxFileDialog	dlg(MDI_Get_Top_Window(), Caption, Dir, wxT(""), Filter, wxFD_OPEN|wxFD_FILE_MUST_EXIST|wxFD_MULTIPLE);
 
 	if( dlg.ShowModal() == wxID_OK )
 	{
 		dlg.GetPaths(File_Paths);
 
-		return( File_Paths.GetCount() > 0 );
+		if( File_Paths.GetCount() > 0 )
+		{
+			if( !wxDirExists(def_Dir) )
+			{
+				CONFIG_Write(CONFIG_GROUP_FILE_DLG, DLG_Get_FILE_Config(-1), SG_File_Get_Path(File_Paths[0]).w_str());
+			}
+
+			return( true );
+		}
 	}
 
 	return( false );
@@ -856,8 +895,15 @@ bool		DLG_Image_Save(wxString &File_Path, int &Type, const wxString &def_Dir, co
 {
 	static	int	Filter_Index	= 3;
 
+	wxString	Dir(def_Dir);
+
+	if( !wxDirExists(def_Dir) )
+	{
+		CONFIG_Read(CONFIG_GROUP_FILE_DLG, DLG_Get_FILE_Config(-1), Dir);
+	}
+
 	wxFileDialog	dlg(
-		MDI_Get_Top_Window(), _TL("Save As Image"), def_Dir, def_File, wxString::Format(
+		MDI_Get_Top_Window(), _TL("Save As Image"), Dir, def_File, wxString::Format(
 			wxT("%s (*.bmp)|*.bmp|")
 			wxT("%s (*.jpg)|*.jpg;*.jif;*.jpeg|")
 			wxT("%s (*.tif)|*.tif;*.tiff|")
@@ -892,6 +938,11 @@ bool		DLG_Image_Save(wxString &File_Path, int &Type, const wxString &def_Dir, co
 		case 6:	Type	= wxBITMAP_TYPE_PNM;	break;
 		}
 
+		if( !wxDirExists(def_Dir) )
+		{
+			CONFIG_Write(CONFIG_GROUP_FILE_DLG, DLG_Get_FILE_Config(-1), SG_File_Get_Path(File_Path).w_str());
+		}
+
 		return( true );
 	}
 
diff --git a/src/saga_core/saga_gui/saga.cpp b/src/saga_core/saga_gui/saga.cpp
index 9579dc7..530c452 100644
--- a/src/saga_core/saga_gui/saga.cpp
+++ b/src/saga_core/saga_gui/saga.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: saga.cpp 2124 2014-05-15 16:22:16Z oconrad $
+ * Version $Id: saga.cpp 2510 2015-06-17 13:21:54Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -140,7 +140,9 @@ bool CSAGA::OnInit(void)
 
 	wxInitAllImageHandlers();
 
-	m_App_Path			= wxFileName(argv[0]).GetPath();
+	wxFileName			App_Path(argv[0]);	App_Path.MakeAbsolute();
+
+	m_App_Path			= App_Path.GetPath();
 
 #if !defined(_DEBUG)
 	wxSetAssertHandler(NULL);		// disable all wx asserts in SAGA release builds
@@ -287,21 +289,41 @@ int CSAGA::OnExit(void)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
+#include <wx/wfstream.h>
+
+//---------------------------------------------------------
 void CSAGA::_Init_Config(void)
 {
 	wxConfigBase	*pConfig;
 
 #if defined(_SAGA_MSW)
-	wxFileName	fConfig(Get_App_Path(), "saga_gui", "ini");
+	wxString	fPath;
 
-	if(	( fConfig.FileExists() && (!fConfig.IsFileReadable() || !fConfig.IsFileWritable()))
-	||	(!fConfig.FileExists() && (!fConfig.IsDirReadable () || !fConfig.IsDirWritable ())) )
 	{
-		fConfig.Assign(wxGetHomeDir(), "saga_gui", "ini");
-		//fConfig.Assign(wxFileName::GetTempDir(), "saga_gui", "ini");
+		wxFileName	fLocal(Get_App_Path(), "saga_gui", "ini");
+		wxFileName	fUser (wxGetHomeDir(), "saga_gui", "ini");
+	//	wxFileName	fUser (wxStandardPaths::Get().GetUserConfigDir(), "saga_gui", "ini");
+
+		if(	fLocal.FileExists() && fLocal.IsFileReadable() && !fLocal.IsFileWritable() && !fUser.FileExists() )
+		{
+			wxFileInputStream	is(fLocal.GetFullPath());
+			wxFileOutputStream	os(fUser .GetFullPath());
+			wxFileConfig		ic(is);	ic.Save(os);
+		}
+
+		fPath	=  ( fLocal.FileExists() && (!fLocal.IsFileReadable() || !fLocal.IsFileWritable()))
+				|| (!fLocal.FileExists() && (!fLocal.IsDirReadable () || !fLocal.IsDirWritable ()))
+				? fUser.GetFullPath() : fLocal.GetFullPath();
 	}
 
-	pConfig = new wxFileConfig(wxEmptyString, wxEmptyString, fConfig.GetFullPath(), fConfig.GetFullPath(), wxCONFIG_USE_LOCAL_FILE|wxCONFIG_USE_GLOBAL_FILE|wxCONFIG_USE_RELATIVE_PATH);
+	if( wxFileExists(fPath) )
+	{
+		pConfig = new wxFileConfig(wxEmptyString, wxEmptyString, fPath, fPath, wxCONFIG_USE_LOCAL_FILE|wxCONFIG_USE_GLOBAL_FILE|wxCONFIG_USE_RELATIVE_PATH);
+	}
+	else
+	{
+		pConfig	= new wxConfig;
+	}
 #else
 	pConfig	= new wxConfig;
 #endif
@@ -356,7 +378,7 @@ bool CSAGA::Process_Wait(bool bEnforce)
 	static bool			bYield	= false;
 	static wxDateTime	tYield	= wxDateTime::UNow();
 
-	if( !bYield && (bEnforce || m_Process_Frequency <= 0 || (wxDateTime::Now() - tYield).GetMilliseconds() > m_Process_Frequency) )
+	if( !bYield && (bEnforce || m_Process_Frequency <= 0 || (wxDateTime::UNow() - tYield).GetMilliseconds() > m_Process_Frequency) )
 	{
 		bYield	= true;
 
diff --git a/src/saga_core/saga_gui/saga_frame.cpp b/src/saga_core/saga_gui/saga_frame.cpp
index 559a7f3..f0578b2 100644
--- a/src/saga_core/saga_gui/saga_frame.cpp
+++ b/src/saga_core/saga_gui/saga_frame.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: saga_frame.cpp 2274 2014-10-02 15:44:21Z oconrad $
+ * Version $Id: saga_frame.cpp 2482 2015-04-30 15:34:11Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -265,7 +265,7 @@ CSAGA_Frame::CSAGA_Frame(void)
 	SetDropTarget		(new CSAGA_Frame_DropTarget);
 
 	//-----------------------------------------------------
-	int		STATUSBAR_Sizes[STATUSBAR_COUNT]	= {	-1, 100, 100, 100, -1	};
+	int		STATUSBAR_Sizes[STATUSBAR_COUNT]	= {	-1, 125, 125, 125, -1	};
 
 	CreateStatusBar		(STATUSBAR_COUNT);
 	SetStatusWidths		(STATUSBAR_COUNT, STATUSBAR_Sizes);
diff --git a/src/saga_core/saga_gui/view_histogram.cpp b/src/saga_core/saga_gui/view_histogram.cpp
index 764ce1f..6ac215f 100644
--- a/src/saga_core/saga_gui/view_histogram.cpp
+++ b/src/saga_core/saga_gui/view_histogram.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: view_histogram.cpp 2272 2014-10-02 15:41:39Z oconrad $
+ * Version $Id: view_histogram.cpp 2431 2015-03-03 17:21:59Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -593,10 +593,10 @@ void CVIEW_Histogram::On_AsTable(wxCommandEvent &event)
 
 		pTable->Set_Name(CSG_String::Format(SG_T("%s: %s"), _TL("Histogram"), pObject->Get_Name()));
 
-		pTable->Add_Field(_TL("CLASS" ), SG_DATATYPE_Int);
+		pTable->Add_Field(_TL("CLASS" ), SG_DATATYPE_Int   );
 		pTable->Add_Field(_TL("AREA"  ), SG_DATATYPE_Double);
-		pTable->Add_Field(_TL("COUNT" ), SG_DATATYPE_Int);
-		pTable->Add_Field(_TL("CUMUL" ), SG_DATATYPE_Int);
+		pTable->Add_Field(_TL("COUNT" ), SG_DATATYPE_Long  );
+		pTable->Add_Field(_TL("CUMUL" ), SG_DATATYPE_Long  );
 		pTable->Add_Field(_TL("NAME"  ), SG_DATATYPE_String);
 		pTable->Add_Field(_TL("MIN"   ), SG_DATATYPE_Double);
 		pTable->Add_Field(_TL("CENTER"), SG_DATATYPE_Double);
diff --git a/src/saga_core/saga_gui/view_map_3d.cpp b/src/saga_core/saga_gui/view_map_3d.cpp
index 9004dd3..5a1088f 100644
--- a/src/saga_core/saga_gui/view_map_3d.cpp
+++ b/src/saga_core/saga_gui/view_map_3d.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: view_map_3d.cpp 2331 2014-11-07 12:15:10Z oconrad $
+ * Version $Id: view_map_3d.cpp 2473 2015-04-21 16:03:37Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -321,12 +321,34 @@ void CVIEW_Map_3D::On_Command(wxCommandEvent &event)
 	//-----------------------------------------------------
 	case ID_CMD_MAP3D_SAVE:
 		{
-			int			FileType;
-			wxString	FileName;
+			int				FileType;
+			wxString		FileName;
+			CSG_Parameters	P(NULL, _TL("Image Resolution"), _TL(""));
 
-			if( DLG_Image_Save(FileName, FileType) )
+			P.Add_Value(NULL, "NX", _TL("Width" ), _TL(""), PARAMETER_TYPE_Int, m_pPanel->GetSize().x, 1, true);
+			P.Add_Value(NULL, "NY", _TL("Height"), _TL(""), PARAMETER_TYPE_Int, m_pPanel->GetSize().y, 1, true);
+
+			if( DLG_Image_Save(FileName, FileType) && DLG_Parameters(&P) )
 			{
-				m_pPanel->Save_asImage(&FileName);
+				Set_Buisy_Cursor(true);
+
+				if( P("NX")->asInt() == m_pPanel->GetSize().x
+				&&  P("NY")->asInt() == m_pPanel->GetSize().y )
+				{
+					m_pPanel->Save_asImage(&FileName);
+				}
+				else
+				{
+					wxSize	Size(m_pPanel->GetSize());
+
+					Freeze();
+					m_pPanel->SetSize(P("NX")->asInt(), P("NY")->asInt());
+					m_pPanel->Save_asImage(&FileName);
+					m_pPanel->SetSize(Size);
+					Thaw();
+				}
+
+				Set_Buisy_Cursor(false);
 			}
 		}
 		return;
@@ -361,7 +383,7 @@ void CVIEW_Map_3D::On_Command(wxCommandEvent &event)
 	case ID_CMD_MAP3D_SHIFT_Z_LESS   :	m_pPanel->Get_Projector().Set_zShift(m_pPanel->Get_Projector().Get_zShift() - 10.0);	break;
 	case ID_CMD_MAP3D_SHIFT_Z_MORE   :	m_pPanel->Get_Projector().Set_zShift(m_pPanel->Get_Projector().Get_zShift() + 10.0);	break;
 
-//	case ID_CMD_MAP3D_DRAW_BOX       :	m_pPanel->m_Parameters("DRAW_BOX"    )->Set_Value(m_pPanel->m_Parameters("DRAW_BOX"    )->asBool() == false    );	break;
+//	case ID_CMD_MAP3D_DRAW_BOX       :	m_pPanel->m_Parameters("DRAW_BOX"    )->Set_Value(m_pPanel->m_Parameters("DRAW_BOX"    )->asBool() ==  true    );	break;
 	case ID_CMD_MAP3D_STEREO         :	m_pPanel->m_Parameters("STEREO"      )->Set_Value(m_pPanel->m_Parameters("STEREO"      )->asBool() == false    );	break;
 	case ID_CMD_MAP3D_STEREO_LESS    :	m_pPanel->m_Parameters("STEREO_DIST" )->Set_Value(m_pPanel->m_Parameters("STEREO_DIST" )->asDouble() - 2       );	break;
 	case ID_CMD_MAP3D_STEREO_MORE    :	m_pPanel->m_Parameters("STEREO_DIST" )->Set_Value(m_pPanel->m_Parameters("STEREO_DIST" )->asDouble() + 2       );	break;
@@ -445,9 +467,10 @@ void CVIEW_Map_3D::Parameters_Update(bool bFromPanel)
 		m_Parameters("CENTRAL"     )->Set_Value(m_pPanel->Get_Projector().is_Central() ? 1 : 0);
 		m_Parameters("CENTRAL_DIST")->Set_Value(m_pPanel->Get_Projector().Get_Central_Distance());
 
-		m_Parameters("BGCOLOR"     )->Set_Value(m_pPanel->m_Parameters("BGCOLOR"    )->asInt());
-		m_Parameters("STEREO"      )->Set_Value(m_pPanel->m_Parameters("STEREO"     )->asInt());
-		m_Parameters("STEREO_DIST" )->Set_Value(m_pPanel->m_Parameters("STEREO_DIST")->asDouble());
+		m_Parameters("BGCOLOR"     )->Set_Value(m_pPanel->m_Parameters("BGCOLOR"    ));
+		m_Parameters("STEREO"      )->Set_Value(m_pPanel->m_Parameters("STEREO"     ));
+		m_Parameters("STEREO_DIST" )->Set_Value(m_pPanel->m_Parameters("STEREO_DIST"));
+		m_Parameters("DRAW_BOX"    )->Set_Value(m_pPanel->m_Parameters("DRAW_BOX"   ));
 
 		m_Parameters("Z_SCALE"     )->Set_Value(m_pPanel->m_zScale);
 		m_Parameters("DEM_RES"     )->Set_Value(m_pPanel->Get_DEM_Res());
@@ -469,18 +492,14 @@ void CVIEW_Map_3D::Parameters_Update(bool bFromPanel)
 			m_Parameters("SHIFT_Z")->asDouble()
 		);
 
-		m_pPanel->Get_Projector().do_Central(
-			m_Parameters("CENTRAL")->asInt() == 1
-		);
+		m_pPanel->m_Parameters("CENTRAL"     )->Set_Value(m_Parameters("CENTRAL"     ));
+		m_pPanel->m_Parameters("CENTRAL_DIST")->Set_Value(m_Parameters("CENTRAL_DIST"));
 
-		m_pPanel->Get_Projector().Set_Central_Distance(
-			m_Parameters("CENTRAL_DIST")->asDouble()
-		);
-
-		m_pPanel->m_Parameters("BGCOLOR"    )->Set_Value(m_Parameters("BGCOLOR"    )->asInt());
-		m_pPanel->m_Parameters("STEREO"     )->Set_Value(m_Parameters("STEREO"     )->asInt());
-		m_pPanel->m_Parameters("STEREO_DIST")->Set_Value(m_Parameters("STEREO_DIST")->asDouble());
-		m_pPanel->m_Parameters("DRAPE_MODE" )->Set_Value(m_Parameters("DRAPE_MODE" )->asInt());
+		m_pPanel->m_Parameters("BGCOLOR"     )->Set_Value(m_Parameters("BGCOLOR"     ));
+		m_pPanel->m_Parameters("STEREO"      )->Set_Value(m_Parameters("STEREO"      ));
+		m_pPanel->m_Parameters("STEREO_DIST" )->Set_Value(m_Parameters("STEREO_DIST" ));
+		m_pPanel->m_Parameters("DRAPE_MODE"  )->Set_Value(m_Parameters("DRAPE_MODE"  ));
+		m_pPanel->m_Parameters("DRAW_BOX"    )->Set_Value(m_Parameters("DRAW_BOX"    ));
 
 		m_pPanel->m_zScale	= m_Parameters("Z_SCALE")->asDouble();
 
@@ -525,6 +544,12 @@ void CVIEW_Map_3D::Parameters_Create(void)
 		PARAMETER_TYPE_Double, 1.0
 	);
 
+	m_Parameters.Add_Value(
+		pNode	, "DRAW_BOX"	, _TL("Bounding Box"),
+		_TL(""),
+		PARAMETER_TYPE_Bool, false
+	);
+
 	//-----------------------------------------------------
 	pNode	= m_Parameters.Add_Node(NULL, "MAP", _TL("Map"), _TL(""));
 
@@ -575,7 +600,7 @@ void CVIEW_Map_3D::Parameters_Create(void)
 	m_Parameters.Add_Value(
 		pNode	, "CENTRAL_DIST"	, _TL("Perspectivic Distance"),
 		_TL(""),
-		PARAMETER_TYPE_Double, 200, 1, true
+		PARAMETER_TYPE_Double, 1500, 1, true
 	);
 
 	//-----------------------------------------------------
diff --git a/src/saga_core/saga_gui/view_map_control.cpp b/src/saga_core/saga_gui/view_map_control.cpp
index 94c7e7a..b1963be 100644
--- a/src/saga_core/saga_gui/view_map_control.cpp
+++ b/src/saga_core/saga_gui/view_map_control.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: view_map_control.cpp 2027 2014-02-27 15:14:20Z oconrad $
+ * Version $Id: view_map_control.cpp 2482 2015-04-30 15:34:11Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -202,20 +202,71 @@ bool CVIEW_Map_Control::Set_Mode(int Mode)
 //---------------------------------------------------------
 inline void CVIEW_Map_Control::_Set_StatusBar(CSG_Point ptWorld)
 {
-	STATUSBAR_Set_Text(wxString::Format(wxT("X%f"), ptWorld.Get_X()), STATUSBAR_VIEW_X);
-	STATUSBAR_Set_Text(wxString::Format(wxT("Y%f"), ptWorld.Get_Y()), STATUSBAR_VIEW_Y);
+	static bool	bBuisy	= false;
 
-	if( m_Mode == MAP_MODE_DISTANCE )
+	if( bBuisy == false )
 	{
-		STATUSBAR_Set_Text(wxString::Format(wxT("D %f"), m_Distance + m_Distance_Move), STATUSBAR_VIEW_Z);
-	}
-	else if( Get_Active_Layer() )
-	{
-		STATUSBAR_Set_Text(wxString::Format(wxT("Z %s"), Get_Active_Layer()->Get_Value(ptWorld, _Get_World(2.0)).c_str()), STATUSBAR_VIEW_Z);
-	}
-	else
-	{
-		STATUSBAR_Set_Text(wxT("Z"), STATUSBAR_VIEW_Z);
+		bBuisy	= true;
+
+		CSG_Module	*pProjector	= NULL;
+
+		if( m_pMap->Get_Parameter("GCS_POSITION")->asBool() && m_pMap->Get_Projection().is_Okay() && (pProjector = SG_Get_Module_Library_Manager().Get_Module("pj_proj4", 2)) != NULL )	// Coordinate Transformation (Shapes)
+		{
+			if( pProjector->is_Executing() )
+			{
+				pProjector	= NULL;
+			}
+			else
+			{
+				SG_UI_Progress_Lock(true);
+				SG_UI_Msg_Lock     (true);
+
+				CSG_Shapes	prj(SHAPE_TYPE_Point), gcs(SHAPE_TYPE_Point); prj.Add_Shape()->Add_Point(ptWorld); prj.Get_Projection().Assign(m_pMap->Get_Projection());
+
+				pProjector->Settings_Push(NULL);
+
+				if( pProjector->Set_Parameter("CRS_PROJ4", SG_T("+proj=longlat +ellps=WGS84 +datum=WGS84"))
+				&&  pProjector->Set_Parameter("SOURCE"   , &prj)
+				&&  pProjector->Set_Parameter("TARGET"   , &gcs)
+				&&  pProjector->Execute() )
+				{
+					ptWorld	= gcs.Get_Shape(0)->Get_Point(0);
+
+					STATUSBAR_Set_Text(wxString::Format("X %s", SG_Double_To_Degree(ptWorld.Get_X()).c_str()), STATUSBAR_VIEW_X);
+					STATUSBAR_Set_Text(wxString::Format("Y %s", SG_Double_To_Degree(ptWorld.Get_Y()).c_str()), STATUSBAR_VIEW_Y);
+
+					pProjector->Settings_Pop();
+				}
+				else
+				{
+					pProjector->Settings_Pop();		pProjector	= NULL;
+				}
+
+				SG_UI_Progress_Lock(false);
+				SG_UI_Msg_Lock     (false);
+			}
+		}
+
+		if( !pProjector )
+		{
+			STATUSBAR_Set_Text(wxString::Format("X %f", ptWorld.Get_X()), STATUSBAR_VIEW_X);
+			STATUSBAR_Set_Text(wxString::Format("Y %f", ptWorld.Get_Y()), STATUSBAR_VIEW_Y);
+		}
+
+		if( m_Mode == MAP_MODE_DISTANCE )
+		{
+			STATUSBAR_Set_Text(wxString::Format(wxT("D %f"), m_Distance + m_Distance_Move), STATUSBAR_VIEW_Z);
+		}
+		else if( Get_Active_Layer() )
+		{
+			STATUSBAR_Set_Text(wxString::Format(wxT("Z %s"), Get_Active_Layer()->Get_Value(ptWorld, _Get_World(2.0)).c_str()), STATUSBAR_VIEW_Z);
+		}
+		else
+		{
+			STATUSBAR_Set_Text(wxT("Z"), STATUSBAR_VIEW_Z);
+		}
+
+		bBuisy	= false;
 	}
 }
 
diff --git a/src/saga_core/saga_gui/view_table_control.cpp b/src/saga_core/saga_gui/view_table_control.cpp
index f605b9e..530b4b9 100644
--- a/src/saga_core/saga_gui/view_table_control.cpp
+++ b/src/saga_core/saga_gui/view_table_control.cpp
@@ -1,549 +1,549 @@
-/**********************************************************
- * Version $Id: view_table_control.cpp 2074 2014-03-31 10:32:12Z oconrad $
- *********************************************************/
-
-///////////////////////////////////////////////////////////
-//                                                       //
-//                         SAGA                          //
-//                                                       //
-//      System for Automated Geoscientific Analyses      //
-//                                                       //
-//                    User Interface                     //
-//                                                       //
-//                    Program: SAGA                      //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//                VIEW_Table_Control.cpp                 //
-//                                                       //
-//          Copyright (C) 2005 by Olaf Conrad            //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-// This file is part of 'SAGA - System for Automated     //
-// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
-//                                                       //
-// SAGA is distributed in the hope that it will be       //
-// useful, but WITHOUT ANY WARRANTY; without even the    //
-// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
-// PARTICULAR PURPOSE. See the GNU General Public        //
-// License for more details.                             //
-//                                                       //
-// You should have received a copy of the GNU General    //
-// Public License along with this program; if not,       //
-// write to the Free Software Foundation, Inc.,          //
-// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
-// USA.                                                  //
-//                                                       //
-//-------------------------------------------------------//
-//                                                       //
-//    contact:    Olaf Conrad                            //
-//                Institute of Geography                 //
-//                University of Goettingen               //
-//                Goldschmidtstr. 5                      //
-//                37077 Goettingen                       //
-//                Germany                                //
-//                                                       //
-//    e-mail:     oconrad at saga-gis.org                   //
-//                                                       //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#include <wx/window.h>
-
-#include <saga_api/saga_api.h>
-
-#include "res_commands.h"
-#include "res_dialogs.h"
-
-#include "active.h"
-#include "active_attributes.h"
-
-#include "helper.h"
-
-#include "wksp_data_manager.h"
-
-#include "view_table_control.h"
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#define FIXED_COLS		((m_Constraint & TABLE_CTRL_FIXED_COLS)   != 0)
-#define FIXED_ROWS		((m_Constraint & TABLE_CTRL_FIXED_ROWS)   != 0)
-#define LABEL_COL		((m_Constraint & TABLE_CTRL_COL1ISLABEL)  != 0)
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-IMPLEMENT_CLASS(CVIEW_Table_Control, wxGrid)
-
-//---------------------------------------------------------
-BEGIN_EVENT_TABLE(CVIEW_Table_Control, wxGrid)
-	EVT_SIZE					(CVIEW_Table_Control::On_Size)
+/**********************************************************
+ * Version $Id: view_table_control.cpp 2355 2014-12-19 09:55:41Z reklov_w $
+ *********************************************************/
+
+///////////////////////////////////////////////////////////
+//                                                       //
+//                         SAGA                          //
+//                                                       //
+//      System for Automated Geoscientific Analyses      //
+//                                                       //
+//                    User Interface                     //
+//                                                       //
+//                    Program: SAGA                      //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//                VIEW_Table_Control.cpp                 //
+//                                                       //
+//          Copyright (C) 2005 by Olaf Conrad            //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+// This file is part of 'SAGA - System for Automated     //
+// Geoscientific Analyses'. SAGA 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; version 2 of the License.   //
+//                                                       //
+// SAGA is distributed in the hope that it will be       //
+// useful, but WITHOUT ANY WARRANTY; without even the    //
+// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
+// PARTICULAR PURPOSE. See the GNU General Public        //
+// License for more details.                             //
+//                                                       //
+// You should have received a copy of the GNU General    //
+// Public License along with this program; if not,       //
+// write to the Free Software Foundation, Inc.,          //
+// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
+// USA.                                                  //
+//                                                       //
+//-------------------------------------------------------//
+//                                                       //
+//    contact:    Olaf Conrad                            //
+//                Institute of Geography                 //
+//                University of Goettingen               //
+//                Goldschmidtstr. 5                      //
+//                37077 Goettingen                       //
+//                Germany                                //
+//                                                       //
+//    e-mail:     oconrad at saga-gis.org                   //
+//                                                       //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#include <wx/window.h>
+
+#include <saga_api/saga_api.h>
+
+#include "res_commands.h"
+#include "res_dialogs.h"
+
+#include "active.h"
+#include "active_attributes.h"
+
+#include "helper.h"
+
+#include "wksp_data_manager.h"
+
+#include "view_table_control.h"
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+#define FIXED_COLS		((m_Constraint & TABLE_CTRL_FIXED_COLS)   != 0)
+#define FIXED_ROWS		((m_Constraint & TABLE_CTRL_FIXED_ROWS)   != 0)
+#define LABEL_COL		((m_Constraint & TABLE_CTRL_COL1ISLABEL)  != 0)
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+IMPLEMENT_CLASS(CVIEW_Table_Control, wxGrid)
+
+//---------------------------------------------------------
+BEGIN_EVENT_TABLE(CVIEW_Table_Control, wxGrid)
+	EVT_SIZE					(CVIEW_Table_Control::On_Size)
 	EVT_KEY_DOWN				(CVIEW_Table_Control::On_Key)
-
-	EVT_GRID_EDITOR_SHOWN		(CVIEW_Table_Control::On_Edit_Start)
-	EVT_GRID_EDITOR_HIDDEN		(CVIEW_Table_Control::On_Edit_Stop)
-	EVT_GRID_CELL_CHANGED		(CVIEW_Table_Control::On_Changed)
-	EVT_GRID_CELL_LEFT_CLICK	(CVIEW_Table_Control::On_LClick)
-	EVT_GRID_LABEL_LEFT_CLICK	(CVIEW_Table_Control::On_LClick_Label)
-	EVT_GRID_LABEL_LEFT_DCLICK	(CVIEW_Table_Control::On_LDClick_Label)
-	EVT_GRID_LABEL_RIGHT_CLICK	(CVIEW_Table_Control::On_RClick_Label)
-	EVT_GRID_RANGE_SELECT		(CVIEW_Table_Control::On_Select)
-
-	EVT_MENU					(ID_CMD_TABLE_FIELD_ADD			, CVIEW_Table_Control::On_Field_Add)
-	EVT_UPDATE_UI				(ID_CMD_TABLE_FIELD_ADD			, CVIEW_Table_Control::On_Field_Add_UI)
-	EVT_MENU					(ID_CMD_TABLE_FIELD_DEL			, CVIEW_Table_Control::On_Field_Del)
-	EVT_UPDATE_UI				(ID_CMD_TABLE_FIELD_DEL			, CVIEW_Table_Control::On_Field_Del_UI)
-	EVT_MENU					(ID_CMD_TABLE_FIELD_SORT		, CVIEW_Table_Control::On_Field_Sort)
-	EVT_UPDATE_UI				(ID_CMD_TABLE_FIELD_SORT		, CVIEW_Table_Control::On_Field_Sort_UI)
-	EVT_MENU					(ID_CMD_TABLE_FIELD_RENAME		, CVIEW_Table_Control::On_Field_Rename)
-	EVT_UPDATE_UI				(ID_CMD_TABLE_FIELD_RENAME		, CVIEW_Table_Control::On_Field_Rename_UI)
-	EVT_MENU					(ID_CMD_TABLE_FIELD_TYPE		, CVIEW_Table_Control::On_Field_Type)
-	EVT_UPDATE_UI				(ID_CMD_TABLE_FIELD_TYPE		, CVIEW_Table_Control::On_Field_Type_UI)
-
-	EVT_MENU					(ID_CMD_TABLE_RECORD_ADD		, CVIEW_Table_Control::On_Record_Add)
-	EVT_UPDATE_UI				(ID_CMD_TABLE_RECORD_ADD		, CVIEW_Table_Control::On_Record_Add_UI)
-	EVT_MENU					(ID_CMD_TABLE_RECORD_INS		, CVIEW_Table_Control::On_Record_Ins)
-	EVT_UPDATE_UI				(ID_CMD_TABLE_RECORD_INS		, CVIEW_Table_Control::On_Record_Ins_UI)
-	EVT_MENU					(ID_CMD_TABLE_RECORD_DEL		, CVIEW_Table_Control::On_Record_Del)
-	EVT_UPDATE_UI				(ID_CMD_TABLE_RECORD_DEL		, CVIEW_Table_Control::On_Record_Del_UI)
-	EVT_MENU					(ID_CMD_TABLE_RECORD_DEL_ALL	, CVIEW_Table_Control::On_Record_Clr)
-	EVT_UPDATE_UI				(ID_CMD_TABLE_RECORD_DEL_ALL	, CVIEW_Table_Control::On_Record_Clr_UI)
-
-	EVT_MENU					(ID_CMD_TABLE_SELECTION_ONLY	, CVIEW_Table_Control::On_Sel_Only)
-	EVT_UPDATE_UI				(ID_CMD_TABLE_SELECTION_ONLY	, CVIEW_Table_Control::On_Sel_Only_UI)
-
-	EVT_MENU					(ID_CMD_TABLE_SELECTION_TO_TOP	, CVIEW_Table_Control::On_Sel_To_Top)
-	EVT_UPDATE_UI				(ID_CMD_TABLE_SELECTION_TO_TOP	, CVIEW_Table_Control::On_Sel_To_Top_UI)
-
-	EVT_MENU					(ID_CMD_TABLE_AUTOSIZE_COLS		, CVIEW_Table_Control::On_Autosize_Cols)
-	EVT_MENU					(ID_CMD_TABLE_AUTOSIZE_ROWS		, CVIEW_Table_Control::On_Autosize_Rows)
-END_EVENT_TABLE()
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-CVIEW_Table_Control::CVIEW_Table_Control(wxWindow *pParent, CSG_Table *pTable, int Constraint)
-	: wxGrid(pParent, -1, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS|wxSUNKEN_BORDER)
-{
-	m_pTable		= pTable;
-	m_pRecords		= NULL;
-	m_Constraint	= Constraint;
-	m_bSelOnly		= false;
-	m_bEditing		= false;
-
-	Set_Labeling(false);
-
-	CreateGrid(m_pTable->Get_Record_Count(), m_pTable->Get_Field_Count(), wxGrid::wxGridSelectRows);
-
-	Update_Table();
-}
-
-//---------------------------------------------------------
-CVIEW_Table_Control::~CVIEW_Table_Control(void)
-{
-	if( m_pRecords )
-	{
-		SG_Free(m_pRecords);
-	}
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::Set_Labeling(bool bOn)
-{
-	if( bOn && m_Field_Offset == 0 )
-	{
-		m_Field_Offset	= 1;
-
-		SetRowLabelAlignment(wxALIGN_RIGHT, wxALIGN_CENTRE);
-	}
-	else if( !bOn && m_Field_Offset != 0 )
-	{
-		m_Field_Offset	= 0;
-
-		SetRowLabelAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE);
-
-		Freeze();
-
-		for(int i=0; i<GetRows(); i++)
-		{
-			SetRowLabelValue(i, wxString::Format("%d", 1 + i));
-		}
-
-		Thaw();
-	}
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::_Update_Views(void)
-{
-	if( GetBatchCount() == 0 )
-	{
-		BeginBatch();
-
-		g_pData->Update_Views(m_pTable);
-
-		EndBatch();
-	}
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-bool CVIEW_Table_Control::Update_Table(void)
-{
-	if( GetBatchCount() > 0 )
-	{
-		return( false );
-	}
-
-	BeginBatch();
-
-	//-----------------------------------------------------
-	int	Difference	= (m_pTable->Get_Field_Count() - m_Field_Offset) - GetNumberCols();
-
-	if( Difference > 0 )
-	{
-		AppendCols(Difference);
-	}
-	else if( (Difference = -Difference < GetNumberCols() ? -Difference : GetNumberCols()) > 0 )
-	{	// here is (or was!?) a memory leak - solution: use own wxGridTableBase derived grid table class
-		DeleteCols(0, Difference);
-	}
-
-	//-----------------------------------------------------
-	for(int iCol=0, iField=m_Field_Offset; iField<m_pTable->Get_Field_Count(); iCol++, iField++)
-	{
-		SetColLabelValue(iCol, m_pTable->Get_Field_Name(iField));
-
-		switch( m_pTable->Get_Field_Type(iField) )
-		{
-		default:
-		case SG_DATATYPE_Byte:
-		case SG_DATATYPE_Char:
-		case SG_DATATYPE_String:
-		case SG_DATATYPE_Date:
-		case SG_DATATYPE_Binary:
-			SetColFormatCustom(iCol, wxGRID_VALUE_STRING);
-			break;
-
-		case SG_DATATYPE_Bit:
-		case SG_DATATYPE_Word:
-		case SG_DATATYPE_Short:
-		case SG_DATATYPE_DWord:
-		case SG_DATATYPE_Int:
-		case SG_DATATYPE_ULong:
-		case SG_DATATYPE_Long:
-		case SG_DATATYPE_Color:
-			SetColFormatNumber(iCol);
-			break;
-
-		case SG_DATATYPE_Float:
-		case SG_DATATYPE_Double:
-			SetColFormatFloat(iCol);
-			break;
-		}
-	}
-
-	//-----------------------------------------------------
-	EndBatch();
-
-	return( _Set_Records() );
-}
-
-//---------------------------------------------------------
-bool CVIEW_Table_Control::_Set_Records(bool bSelection_To_Top)
-{
-	BeginBatch();
-
-	//-----------------------------------------------------
-	if( m_bSelOnly && m_pTable->Get_Selection_Count() <= 0 )
-	{
-		m_bSelOnly	= false;
-	}
-
-	int	Difference, nRecords	= m_bSelOnly ? m_pTable->Get_Selection_Count() : m_pTable->Get_Count();
-
-	if( (Difference = nRecords - GetNumberRows()) > 0 )
-	{
-		AppendRows(Difference);
-	}
-	else if( Difference < 0 && (Difference = -Difference < GetNumberRows() ? -Difference : GetNumberRows()) > 0 )
-	{
-		DeleteRows(0, Difference);
-	}
-
-	m_pRecords	= (CSG_Table_Record **)SG_Realloc(m_pRecords, nRecords * sizeof(CSG_Table_Record *));
-
-	ClearSelection();
-
-	//-----------------------------------------------------
-	if( m_bSelOnly )
-	{
-	//	#pragma omp parallel for
-		for(int iRecord=0; iRecord<nRecords; iRecord++)
-		{
-			_Set_Record(iRecord, m_pTable->Get_Selection(iRecord));
-		}
-	}
-	else if( !bSelection_To_Top )
-	{
-	//	#pragma omp parallel for
-		for(int iRecord=0; iRecord<nRecords; iRecord++)
-		{
-			_Set_Record(iRecord, m_pTable->Get_Record_byIndex(iRecord));
-		}
-	}
-	else // if( bSelection_To_Top && m_pTable->Get_Selection_Count() > 0 )
-	{
-		for(int iRecord=0, iSel=0, iNoSel=m_pTable->Get_Selection_Count(); iRecord<nRecords && PROGRESSBAR_Set_Position(iRecord, nRecords); iRecord++)
-		{
-			CSG_Table_Record	*pRecord	= m_pTable->Get_Record_byIndex(iRecord);
-
-			if( pRecord->is_Selected() )
-			{
-				_Set_Record(iSel  ++, pRecord);
-			}
-			else
-			{
-				_Set_Record(iNoSel++, pRecord);
-			}
-		}
-
-		PROCESS_Set_Okay();
-	}
-
-	//-----------------------------------------------------
-	EndBatch();
-
-	_Update_Views();
-
-	return( true );
-}
-
-//---------------------------------------------------------
-bool CVIEW_Table_Control::_Set_Record(int iRecord, CSG_Table_Record *pRecord)
-{
-	m_pRecords[iRecord]	= pRecord;
-
-	if( m_Field_Offset )
-	{
-		SetRowLabelValue(iRecord, pRecord->asString(0));
-	}
-
-	for(int iCol=0, iField=m_Field_Offset; iField<m_pTable->Get_Field_Count(); iCol++, iField++)
-	{
-		switch( m_pTable->Get_Field_Type(iField) )
-		{
-		default:
-			SetCellValue(iRecord, iCol, pRecord->is_NoData(iField) ? SG_T("") : pRecord->asString(iField));
-			break;
-
-		case SG_DATATYPE_Color:
-			SetCellBackgroundColour(iRecord, iCol, Get_Color_asWX(pRecord->asInt(iField)));
-			break;
-		}
-	}
-
-	if( pRecord->is_Selected() )
-	{
-		SelectRow(iRecord, true);
-	}
-
-	return( true );
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-bool CVIEW_Table_Control::Update_Sorting(int iField, int Direction)
-{
-	if( iField >= 0 && iField < m_pTable->Get_Field_Count() )
-	{
-		switch( Direction )
-		{
-		default:	m_pTable->Toggle_Index(iField);	break;
-		case 0:		m_pTable->Set_Index(iField, TABLE_INDEX_None      );	break;
-		case 1:		m_pTable->Set_Index(iField, TABLE_INDEX_Ascending );	break;
-		case 2:		m_pTable->Set_Index(iField, TABLE_INDEX_Descending);	break;
-		}
-
-		return( _Set_Records() );
-	}
-
-	return( false );
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-bool CVIEW_Table_Control::Add_Record(void)
-{
-	if( !FIXED_ROWS && m_pTable->Get_ObjectType() == DATAOBJECT_TYPE_Table )
-	{
-		AppendRows();
-
-		m_pRecords	= (CSG_Table_Record **)SG_Realloc(m_pRecords, GetNumberRows() * sizeof(CSG_Table_Record *));
-
-		_Set_Record(GetNumberRows() - 1, m_pTable->Add_Record());
-
-		return( true );
-	}
-
-	return( false );
-}
-
-//---------------------------------------------------------
-bool CVIEW_Table_Control::Ins_Record(void)
-{
-	if( !FIXED_ROWS && m_pTable->Get_ObjectType() == DATAOBJECT_TYPE_Table )
-	{
-		int		iRecord	= GetGridCursorRow();
-
-		if( iRecord >= 0 && iRecord < GetNumberRows() )
-		{
-			InsertRows(iRecord);
-
-			m_pRecords	= (CSG_Table_Record **)SG_Realloc(m_pRecords, GetNumberRows() * sizeof(CSG_Table_Record *));
-
-			for(int i=GetNumberRows()-1; i>iRecord; i--)
-			{
-				m_pRecords[i]	= m_pRecords[i - 1];
-			}
-
-			_Set_Record(iRecord, m_pTable->Ins_Record(iRecord));
-
-			return( true );
-		}
-	}
-
-	return( false );
-}
-
-//---------------------------------------------------------
-bool CVIEW_Table_Control::Del_Record(void)
-{
-	return( !FIXED_ROWS && m_pTable->Del_Selection() && Update_Table() );
-}
-
-//---------------------------------------------------------
-bool CVIEW_Table_Control::Del_Records(void)
-{
-	return( !FIXED_ROWS && m_pTable->Del_Records() && Update_Table() );
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-bool CVIEW_Table_Control::Load(const wxString &File_Name)
-{
-	CSG_Table	Table(&File_Name);
-
-	bool	bResult	= Table.Get_Count() > 0
-		&& Table.Get_Field_Count() == m_pTable->Get_Field_Count()
-		&& m_pTable->Assign_Values(&Table)
-		&& Update_Table();
-
-	PROCESS_Set_Okay();
-
-	return( bResult );
-}
-
-//---------------------------------------------------------
-bool CVIEW_Table_Control::Save(const wxString &File_Name, int Format)
-{
-	bool	bResult	= m_pTable->Save(&File_Name);
-
-	PROCESS_Set_Okay();
-
-	return( bResult );
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::On_Size(wxSizeEvent &event)//&WXUNUSED(event))
-{
-	if( m_Field_Offset && GetNumberCols() && GetClientSize().x > GetRowLabelSize() )
-	{
-		SetColSize(0, GetClientSize().x - GetRowLabelSize());
-	}
-
-	event.Skip();
-}
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::On_Key(wxKeyEvent &event)
+
+	EVT_GRID_EDITOR_SHOWN		(CVIEW_Table_Control::On_Edit_Start)
+	EVT_GRID_EDITOR_HIDDEN		(CVIEW_Table_Control::On_Edit_Stop)
+	EVT_GRID_CELL_CHANGED		(CVIEW_Table_Control::On_Changed)
+	EVT_GRID_CELL_LEFT_CLICK	(CVIEW_Table_Control::On_LClick)
+	EVT_GRID_LABEL_LEFT_CLICK	(CVIEW_Table_Control::On_LClick_Label)
+	EVT_GRID_LABEL_LEFT_DCLICK	(CVIEW_Table_Control::On_LDClick_Label)
+	EVT_GRID_LABEL_RIGHT_CLICK	(CVIEW_Table_Control::On_RClick_Label)
+	EVT_GRID_RANGE_SELECT		(CVIEW_Table_Control::On_Select)
+
+	EVT_MENU					(ID_CMD_TABLE_FIELD_ADD			, CVIEW_Table_Control::On_Field_Add)
+	EVT_UPDATE_UI				(ID_CMD_TABLE_FIELD_ADD			, CVIEW_Table_Control::On_Field_Add_UI)
+	EVT_MENU					(ID_CMD_TABLE_FIELD_DEL			, CVIEW_Table_Control::On_Field_Del)
+	EVT_UPDATE_UI				(ID_CMD_TABLE_FIELD_DEL			, CVIEW_Table_Control::On_Field_Del_UI)
+	EVT_MENU					(ID_CMD_TABLE_FIELD_SORT		, CVIEW_Table_Control::On_Field_Sort)
+	EVT_UPDATE_UI				(ID_CMD_TABLE_FIELD_SORT		, CVIEW_Table_Control::On_Field_Sort_UI)
+	EVT_MENU					(ID_CMD_TABLE_FIELD_RENAME		, CVIEW_Table_Control::On_Field_Rename)
+	EVT_UPDATE_UI				(ID_CMD_TABLE_FIELD_RENAME		, CVIEW_Table_Control::On_Field_Rename_UI)
+	EVT_MENU					(ID_CMD_TABLE_FIELD_TYPE		, CVIEW_Table_Control::On_Field_Type)
+	EVT_UPDATE_UI				(ID_CMD_TABLE_FIELD_TYPE		, CVIEW_Table_Control::On_Field_Type_UI)
+
+	EVT_MENU					(ID_CMD_TABLE_RECORD_ADD		, CVIEW_Table_Control::On_Record_Add)
+	EVT_UPDATE_UI				(ID_CMD_TABLE_RECORD_ADD		, CVIEW_Table_Control::On_Record_Add_UI)
+	EVT_MENU					(ID_CMD_TABLE_RECORD_INS		, CVIEW_Table_Control::On_Record_Ins)
+	EVT_UPDATE_UI				(ID_CMD_TABLE_RECORD_INS		, CVIEW_Table_Control::On_Record_Ins_UI)
+	EVT_MENU					(ID_CMD_TABLE_RECORD_DEL		, CVIEW_Table_Control::On_Record_Del)
+	EVT_UPDATE_UI				(ID_CMD_TABLE_RECORD_DEL		, CVIEW_Table_Control::On_Record_Del_UI)
+	EVT_MENU					(ID_CMD_TABLE_RECORD_DEL_ALL	, CVIEW_Table_Control::On_Record_Clr)
+	EVT_UPDATE_UI				(ID_CMD_TABLE_RECORD_DEL_ALL	, CVIEW_Table_Control::On_Record_Clr_UI)
+
+	EVT_MENU					(ID_CMD_TABLE_SELECTION_ONLY	, CVIEW_Table_Control::On_Sel_Only)
+	EVT_UPDATE_UI				(ID_CMD_TABLE_SELECTION_ONLY	, CVIEW_Table_Control::On_Sel_Only_UI)
+
+	EVT_MENU					(ID_CMD_TABLE_SELECTION_TO_TOP	, CVIEW_Table_Control::On_Sel_To_Top)
+	EVT_UPDATE_UI				(ID_CMD_TABLE_SELECTION_TO_TOP	, CVIEW_Table_Control::On_Sel_To_Top_UI)
+
+	EVT_MENU					(ID_CMD_TABLE_AUTOSIZE_COLS		, CVIEW_Table_Control::On_Autosize_Cols)
+	EVT_MENU					(ID_CMD_TABLE_AUTOSIZE_ROWS		, CVIEW_Table_Control::On_Autosize_Rows)
+END_EVENT_TABLE()
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+CVIEW_Table_Control::CVIEW_Table_Control(wxWindow *pParent, CSG_Table *pTable, int Constraint)
+	: wxGrid(pParent, -1, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS|wxSUNKEN_BORDER)
+{
+	m_pTable		= pTable;
+	m_pRecords		= NULL;
+	m_Constraint	= Constraint;
+	m_bSelOnly		= false;
+	m_bEditing		= false;
+
+	Set_Labeling(false);
+
+	CreateGrid(m_pTable->Get_Record_Count(), m_pTable->Get_Field_Count(), wxGrid::wxGridSelectRows);
+
+	Update_Table();
+}
+
+//---------------------------------------------------------
+CVIEW_Table_Control::~CVIEW_Table_Control(void)
+{
+	if( m_pRecords )
+	{
+		SG_Free(m_pRecords);
+	}
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::Set_Labeling(bool bOn)
+{
+	if( bOn && m_Field_Offset == 0 )
+	{
+		m_Field_Offset	= 1;
+
+		SetRowLabelAlignment(wxALIGN_RIGHT, wxALIGN_CENTRE);
+	}
+	else if( !bOn && m_Field_Offset != 0 )
+	{
+		m_Field_Offset	= 0;
+
+		SetRowLabelAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE);
+
+		Freeze();
+
+		for(int i=0; i<GetRows(); i++)
+		{
+			SetRowLabelValue(i, wxString::Format("%d", 1 + i));
+		}
+
+		Thaw();
+	}
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::_Update_Views(void)
+{
+	if( GetBatchCount() == 0 )
+	{
+		BeginBatch();
+
+		g_pData->Update_Views(m_pTable);
+
+		EndBatch();
+	}
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CVIEW_Table_Control::Update_Table(void)
+{
+	if( GetBatchCount() > 0 )
+	{
+		return( false );
+	}
+
+	BeginBatch();
+
+	//-----------------------------------------------------
+	int	Difference	= (m_pTable->Get_Field_Count() - m_Field_Offset) - GetNumberCols();
+
+	if( Difference > 0 )
+	{
+		AppendCols(Difference);
+	}
+	else if( (Difference = -Difference < GetNumberCols() ? -Difference : GetNumberCols()) > 0 )
+	{	// here is (or was!?) a memory leak - solution: use own wxGridTableBase derived grid table class
+		DeleteCols(0, Difference);
+	}
+
+	//-----------------------------------------------------
+	for(int iCol=0, iField=m_Field_Offset; iField<m_pTable->Get_Field_Count(); iCol++, iField++)
+	{
+		SetColLabelValue(iCol, m_pTable->Get_Field_Name(iField));
+
+		switch( m_pTable->Get_Field_Type(iField) )
+		{
+		default:
+		case SG_DATATYPE_Byte:
+		case SG_DATATYPE_Char:
+		case SG_DATATYPE_String:
+		case SG_DATATYPE_Date:
+		case SG_DATATYPE_Binary:
+			SetColFormatCustom(iCol, wxGRID_VALUE_STRING);
+			break;
+
+		case SG_DATATYPE_Bit:
+		case SG_DATATYPE_Word:
+		case SG_DATATYPE_Short:
+		case SG_DATATYPE_DWord:
+		case SG_DATATYPE_Int:
+		case SG_DATATYPE_ULong:
+		case SG_DATATYPE_Long:
+		case SG_DATATYPE_Color:
+			SetColFormatNumber(iCol);
+			break;
+
+		case SG_DATATYPE_Float:
+		case SG_DATATYPE_Double:
+			SetColFormatFloat(iCol);
+			break;
+		}
+	}
+
+	//-----------------------------------------------------
+	EndBatch();
+
+	return( _Set_Records() );
+}
+
+//---------------------------------------------------------
+bool CVIEW_Table_Control::_Set_Records(bool bSelection_To_Top)
+{
+	BeginBatch();
+
+	//-----------------------------------------------------
+	if( m_bSelOnly && m_pTable->Get_Selection_Count() <= 0 )
+	{
+		m_bSelOnly	= false;
+	}
+
+	int	Difference, nRecords	= m_bSelOnly ? m_pTable->Get_Selection_Count() : m_pTable->Get_Count();
+
+	if( (Difference = nRecords - GetNumberRows()) > 0 )
+	{
+		AppendRows(Difference);
+	}
+	else if( Difference < 0 && (Difference = -Difference < GetNumberRows() ? -Difference : GetNumberRows()) > 0 )
+	{
+		DeleteRows(0, Difference);
+	}
+
+	m_pRecords	= (CSG_Table_Record **)SG_Realloc(m_pRecords, nRecords * sizeof(CSG_Table_Record *));
+
+	ClearSelection();
+
+	//-----------------------------------------------------
+	if( m_bSelOnly )
+	{
+	//	#pragma omp parallel for
+		for(int iRecord=0; iRecord<nRecords; iRecord++)
+		{
+			_Set_Record(iRecord, m_pTable->Get_Selection(iRecord));
+		}
+	}
+	else if( !bSelection_To_Top )
+	{
+	//	#pragma omp parallel for
+		for(int iRecord=0; iRecord<nRecords; iRecord++)
+		{
+			_Set_Record(iRecord, m_pTable->Get_Record_byIndex(iRecord));
+		}
+	}
+	else // if( bSelection_To_Top && m_pTable->Get_Selection_Count() > 0 )
+	{
+		for(int iRecord=0, iSel=0, iNoSel=m_pTable->Get_Selection_Count(); iRecord<nRecords && PROGRESSBAR_Set_Position(iRecord, nRecords); iRecord++)
+		{
+			CSG_Table_Record	*pRecord	= m_pTable->Get_Record_byIndex(iRecord);
+
+			if( pRecord->is_Selected() )
+			{
+				_Set_Record(iSel  ++, pRecord);
+			}
+			else
+			{
+				_Set_Record(iNoSel++, pRecord);
+			}
+		}
+
+		PROCESS_Set_Okay();
+	}
+
+	//-----------------------------------------------------
+	EndBatch();
+
+	_Update_Views();
+
+	return( true );
+}
+
+//---------------------------------------------------------
+bool CVIEW_Table_Control::_Set_Record(int iRecord, CSG_Table_Record *pRecord)
+{
+	m_pRecords[iRecord]	= pRecord;
+
+	if( m_Field_Offset )
+	{
+		SetRowLabelValue(iRecord, pRecord->asString(0));
+	}
+
+	for(int iCol=0, iField=m_Field_Offset; iField<m_pTable->Get_Field_Count(); iCol++, iField++)
+	{
+		switch( m_pTable->Get_Field_Type(iField) )
+		{
+		default:
+			SetCellValue(iRecord, iCol, pRecord->is_NoData(iField) ? SG_T("") : pRecord->asString(iField));
+			break;
+
+		case SG_DATATYPE_Color:
+			SetCellBackgroundColour(iRecord, iCol, Get_Color_asWX(pRecord->asInt(iField)));
+			break;
+		}
+	}
+
+	if( pRecord->is_Selected() )
+	{
+		SelectRow(iRecord, true);
+	}
+
+	return( true );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CVIEW_Table_Control::Update_Sorting(int iField, int Direction)
+{
+	if( iField >= 0 && iField < m_pTable->Get_Field_Count() )
+	{
+		switch( Direction )
+		{
+		default:	m_pTable->Toggle_Index(iField);	break;
+		case 0:		m_pTable->Set_Index(iField, TABLE_INDEX_None      );	break;
+		case 1:		m_pTable->Set_Index(iField, TABLE_INDEX_Ascending );	break;
+		case 2:		m_pTable->Set_Index(iField, TABLE_INDEX_Descending);	break;
+		}
+
+		return( _Set_Records() );
+	}
+
+	return( false );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CVIEW_Table_Control::Add_Record(void)
+{
+	if( !FIXED_ROWS && m_pTable->Get_ObjectType() == DATAOBJECT_TYPE_Table )
+	{
+		AppendRows();
+
+		m_pRecords	= (CSG_Table_Record **)SG_Realloc(m_pRecords, GetNumberRows() * sizeof(CSG_Table_Record *));
+
+		_Set_Record(GetNumberRows() - 1, m_pTable->Add_Record());
+
+		return( true );
+	}
+
+	return( false );
+}
+
+//---------------------------------------------------------
+bool CVIEW_Table_Control::Ins_Record(void)
+{
+	if( !FIXED_ROWS && m_pTable->Get_ObjectType() == DATAOBJECT_TYPE_Table )
+	{
+		int		iRecord	= GetGridCursorRow();
+
+		if( iRecord >= 0 && iRecord < GetNumberRows() )
+		{
+			InsertRows(iRecord);
+
+			m_pRecords	= (CSG_Table_Record **)SG_Realloc(m_pRecords, GetNumberRows() * sizeof(CSG_Table_Record *));
+
+			for(int i=GetNumberRows()-1; i>iRecord; i--)
+			{
+				m_pRecords[i]	= m_pRecords[i - 1];
+			}
+
+			_Set_Record(iRecord, m_pTable->Ins_Record(iRecord));
+
+			return( true );
+		}
+	}
+
+	return( false );
+}
+
+//---------------------------------------------------------
+bool CVIEW_Table_Control::Del_Record(void)
+{
+	return( !FIXED_ROWS && m_pTable->Del_Selection() && Update_Table() );
+}
+
+//---------------------------------------------------------
+bool CVIEW_Table_Control::Del_Records(void)
+{
+	return( !FIXED_ROWS && m_pTable->Del_Records() && Update_Table() );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CVIEW_Table_Control::Load(const wxString &File_Name)
+{
+	CSG_Table	Table(&File_Name);
+
+	bool	bResult	= Table.Get_Count() > 0
+		&& Table.Get_Field_Count() == m_pTable->Get_Field_Count()
+		&& m_pTable->Assign_Values(&Table)
+		&& Update_Table();
+
+	PROCESS_Set_Okay();
+
+	return( bResult );
+}
+
+//---------------------------------------------------------
+bool CVIEW_Table_Control::Save(const wxString &File_Name, int Format)
+{
+	bool	bResult	= m_pTable->Save(&File_Name);
+
+	PROCESS_Set_Okay();
+
+	return( bResult );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::On_Size(wxSizeEvent &event)//&WXUNUSED(event))
+{
+	if( m_Field_Offset && GetNumberCols() && GetClientSize().x > GetRowLabelSize() )
+	{
+		SetColSize(0, GetClientSize().x - GetRowLabelSize());
+	}
+
+	event.Skip();
+}
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::On_Key(wxKeyEvent &event)
 {
 	event.Skip(true);
-
+
 	if( event.GetKeyCode() == WXK_RETURN )
 	{
 		if( !m_bEditing && GetParent() == g_pACTIVE->Get_Attributes() )
@@ -553,659 +553,690 @@ void CVIEW_Table_Control::On_Key(wxKeyEvent &event)
 			g_pACTIVE->Get_Attributes()->Save_Changes(false);
 		}
 	}
-}
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::On_Edit_Start(wxGridEvent &event)
-{
-	m_bEditing	= true;
-
-	event.Skip();
-}
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::On_Edit_Stop(wxGridEvent &event)
-{
-	m_bEditing	= false;
-
-	event.Skip();
-}
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::On_Changed(wxGridEvent &event)
-{
-	CSG_Table_Record	*pRecord	= m_pRecords[event.GetRow()];
-
-	if( pRecord )
-	{
-		int	iField	= m_Field_Offset + event.GetCol();
-
-		if( iField >= m_Field_Offset && iField < m_pTable->Get_Field_Count() )
-		{
-			pRecord->Set_Value(iField, GetCellValue(event.GetRow(), event.GetCol()).wx_str());
-
-			SetCellValue(event.GetRow(), event.GetCol(), pRecord->asString(iField));
-		}
-	}
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::On_Field_Add(wxCommandEvent &event)
-{
-	int				i;
-	CSG_String		sFields;
-	CSG_Parameters	P;
-
-	//-----------------------------------------------------
-	for(i=0; i<m_pTable->Get_Field_Count(); i++)
-	{
-		sFields.Append(m_pTable->Get_Field_Name(i));	sFields.Append(wxT('|'));
-	}
-
-	//-----------------------------------------------------
-	P.Set_Name(_TL("Add Field"));
-
-	P.Add_String(
-		NULL	, "NAME"	, _TL("Name"),
-		_TL(""),
-		_TL("Field")
-	);
-
-	P.Add_Choice(
-		NULL	, "TYPE"	, _TL("Field Type"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|%s|%s|%s|%s|%s|%s|"),
-			_TL("character string"),
-			_TL("1 byte integer"),
-			_TL("2 byte integer"),
-			_TL("4 byte integer"),
-			_TL("4 byte floating point"),
-			_TL("8 byte floating point"),
-			_TL("date (dd.mm.yyyy)"),
-			_TL("color (rgb)")
-		)
-	);
-
-	P.Add_Choice(
-		NULL	, "FIELD"	, _TL("Insert Position"),
-		_TL(""),
-		sFields, m_pTable->Get_Field_Count() - 1
-	);
-
-	P.Add_Choice(
-		NULL	, "INSERT"	, _TL("Insert Method"),
-		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|"),
-			_TL("before"),
-			_TL("after")
-		), 1
-	);
-
-	//-----------------------------------------------------
-	if( DLG_Parameters(&P) )
-	{
-		int				Position;
-		TSG_Data_Type	Type;
-
-		switch( P("TYPE")->asInt() )
-		{
-		default:
-		case 0:	Type	= SG_DATATYPE_String;	break;
-		case 1:	Type	= SG_DATATYPE_Char;		break;
-		case 2:	Type	= SG_DATATYPE_Short;	break;
-		case 3:	Type	= SG_DATATYPE_Int;		break;
-		case 4:	Type	= SG_DATATYPE_Float;	break;
-		case 5:	Type	= SG_DATATYPE_Double;	break;
-		case 6:	Type	= SG_DATATYPE_Date;		break;
-		case 7:	Type	= SG_DATATYPE_Color;	break;
-		}
-
-		Position	= P("FIELD")->asInt() + P("INSERT")->asInt();
-
-		m_pTable->Add_Field(P("NAME")->asString(), Type, Position);
-
-		g_pData->Update(m_pTable, NULL);
-	}
-}
-
-void CVIEW_Table_Control::On_Field_Add_UI(wxUpdateUIEvent &event)
-{
-	event.Enable(FIXED_COLS == false);
-}
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::On_Field_Del(wxCommandEvent &event)
-{
-	int				i;
-	CSG_Parameters	P;
-
-	//-----------------------------------------------------
-	P.Set_Name(_TL("Delete Fields"));
-
-	for(i=0; i<m_pTable->Get_Field_Count(); i++)
-	{
-		P.Add_Value(NULL, SG_Get_String(i, 0), m_pTable->Get_Field_Name(i), _TL(""), PARAMETER_TYPE_Bool, false);
-	}
-
-	//-----------------------------------------------------
-	if( DLG_Parameters(&P) )
-	{
-		for(i=m_pTable->Get_Field_Count()-1; i>=0; i--)
-		{
-			if( P(SG_Get_String(i, 0))->asBool() )
-			{
-				m_pTable->Del_Field(i);
-
-				DeleteCols(i);
-			}
-		}
-
-		g_pData->Update(m_pTable, NULL);
-	}
-}
-
-void CVIEW_Table_Control::On_Field_Del_UI(wxUpdateUIEvent &event)
-{
-	event.Enable(FIXED_COLS == false);
-}
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::On_Field_Sort(wxCommandEvent &event)
-{
-	CSG_String		sFields, sOrder;
-	CSG_Parameter	*pNode;
-	CSG_Parameters	P;
-
-	//-----------------------------------------------------
-	for(int i=0; i<m_pTable->Get_Field_Count(); i++)
-	{
-		sFields.Append(m_pTable->Get_Field_Name(i));	sFields.Append('|');
-	}
-
-	sOrder.Printf(SG_T("%s|%s|%s|"),
-		_TL("unsorted"),
-		_TL("ascending"),
-		_TL("descending")
-	);
-
-	//-----------------------------------------------------
-	P.Set_Name(_TL("Sort Table"));
-
-	pNode	= P.Add_Choice(NULL , "FIELD_1"	, _TL("Sort first by")	,	_TL(""),	sFields	, !m_pTable->is_Indexed() ? 0 : m_pTable->Get_Index_Field(0));
-	pNode	= P.Add_Choice(pNode, "ORDER_1"	, _TL("Direction")		,	_TL(""),	sOrder	, !m_pTable->is_Indexed() ? 1 : m_pTable->Get_Index_Order(0));
-
-	pNode	= P.Add_Choice(NULL , "FIELD_2"	, _TL("Sort second by")	,	_TL(""),	sFields	, !m_pTable->is_Indexed() ? 0 : m_pTable->Get_Index_Field(1));
-	pNode	= P.Add_Choice(pNode, "ORDER_2"	, _TL("Direction")		,	_TL(""),	sOrder	, !m_pTable->is_Indexed() ? 0 : m_pTable->Get_Index_Order(1));
-
-	pNode	= P.Add_Choice(NULL , "FIELD_3"	, _TL("Sort third by")	,	_TL(""),	sFields	, !m_pTable->is_Indexed() ? 0 : m_pTable->Get_Index_Field(2));
-	pNode	= P.Add_Choice(pNode, "ORDER_3"	, _TL("Direction")		,	_TL(""),	sOrder	, !m_pTable->is_Indexed() ? 0 : m_pTable->Get_Index_Order(2));
-
-	//-----------------------------------------------------
-	if( DLG_Parameters(&P) )
-	{
-		m_pTable->Set_Index(
-			P("FIELD_1")->asInt(), P("ORDER_1")->asInt() == 1 ? TABLE_INDEX_Ascending : P("ORDER_1")->asInt() == 2 ? TABLE_INDEX_Descending : TABLE_INDEX_None,
-			P("FIELD_2")->asInt(), P("ORDER_2")->asInt() == 1 ? TABLE_INDEX_Ascending : P("ORDER_2")->asInt() == 2 ? TABLE_INDEX_Descending : TABLE_INDEX_None,
-			P("FIELD_3")->asInt(), P("ORDER_3")->asInt() == 1 ? TABLE_INDEX_Ascending : P("ORDER_3")->asInt() == 2 ? TABLE_INDEX_Descending : TABLE_INDEX_None
-		);
-
-		_Set_Records();
-	}
-}
-
-void CVIEW_Table_Control::On_Field_Sort_UI(wxUpdateUIEvent &event)
-{
-	event.Enable(m_pTable->Get_Field_Count() > 0 && m_pTable->Get_Record_Count() > 1);
-}
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::On_Field_Rename(wxCommandEvent &event)
-{
-	int				i;
-	CSG_Parameters	P;
-
-	P.Set_Name(_TL("Rename Fields"));
-
-	for(i=0; i<m_pTable->Get_Field_Count(); i++)
-	{
-		P.Add_String(NULL, "", m_pTable->Get_Field_Name(i), _TL(""), m_pTable->Get_Field_Name(i));
-	}
-
-	//-----------------------------------------------------
-	if( DLG_Parameters(&P) )
-	{
-		for(i=0; i<m_pTable->Get_Field_Count(); i++)
-		{
-			CSG_String	s(P(i)->asString());
-
-			if( s.Length() > 0 && s.Cmp(m_pTable->Get_Field_Name(i)) )
-			{
-				m_pTable->Set_Field_Name(i, s);
-
-				SetColLabelValue(i, s.c_str());
-			}
-		}
-
-		g_pData->Update(m_pTable, NULL);
-	}
-}
-
-void CVIEW_Table_Control::On_Field_Rename_UI(wxUpdateUIEvent &event)
-{
-	event.Enable(m_pTable->Get_Field_Count() > 0);
-}
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::On_Field_Type(wxCommandEvent &event)
-{
-	int				i, *Types	= new int[m_pTable->Get_Field_Count()];
-	CSG_Parameters	P;
-
-	P.Set_Name(_TL("Change Field Type"));
-
-	for(i=0; i<m_pTable->Get_Field_Count(); i++)
-	{
-		switch( m_pTable->Get_Field_Type(i) )
-		{
-		default:
-		case SG_DATATYPE_String:	Types[i]	= 0;	break;
-		case SG_DATATYPE_Char:		Types[i]	= 1;	break;
-		case SG_DATATYPE_Short:		Types[i]	= 2;	break;
-		case SG_DATATYPE_Int:		Types[i]	= 3;	break;
-		case SG_DATATYPE_Float:	    Types[i]	= 4;	break;
-		case SG_DATATYPE_Double:	Types[i]	= 5;	break;
-		case SG_DATATYPE_Date:	    Types[i]	= 6;	break;
-		case SG_DATATYPE_Binary:	Types[i]	= 7;	break;
-		}
-
-        P.Add_Choice(NULL, "", m_pTable->Get_Field_Name(i), _TL(""),
-            CSG_String::Format(SG_T("%s|%s|%s|%s|%s|%s|%s|%s|"),
-                _TL("character string"),
-                _TL("1 byte integer"),
-                _TL("2 byte integer"),
-                _TL("4 byte integer"),
-                _TL("4 byte floating point"),
-                _TL("8 byte floating point"),
-                _TL("date (dd.mm.yyyy)"),
-                _TL("color (rgb)")
-            ), Types[i]
-        );
-	}
-
-	//-----------------------------------------------------
-	if( DLG_Parameters(&P) )
-	{
-		bool	bChanged	= false;
-
-		for(i=0; i<m_pTable->Get_Field_Count(); i++)
-		{
-			TSG_Data_Type	Type;
-
-			switch( P(i)->asInt() )
-			{
-			default:
-			case 0:	Type	= SG_DATATYPE_String;	break;
-            case 1:	Type	= SG_DATATYPE_Char;		break;
-            case 2:	Type	= SG_DATATYPE_Short;	break;
-            case 3:	Type	= SG_DATATYPE_Int;		break;
-            case 4:	Type	= SG_DATATYPE_Float;	break;
-            case 5:	Type	= SG_DATATYPE_Double;	break;
-            case 6:	Type	= SG_DATATYPE_Date;		break;
-            case 7:	Type	= SG_DATATYPE_Color;	break;
-			}
-
-			if( Type != Types[i] )
-			{
-				m_pTable->Set_Field_Type(i, Type);
-
-				bChanged	= true;
-			}
-		}
-
-		if( bChanged )
-		{
-			Update_Table();
-		}
-	}
-}
-
-void CVIEW_Table_Control::On_Field_Type_UI(wxUpdateUIEvent &event)
-{
-	event.Enable(m_pTable->Get_Field_Count() > 0);
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::On_Record_Add(wxCommandEvent &event)
-{
-	Add_Record();
-}
-
-void CVIEW_Table_Control::On_Record_Add_UI(wxUpdateUIEvent &event)
-{
-	event.Enable(!FIXED_ROWS && m_pTable->Get_ObjectType() == DATAOBJECT_TYPE_Table);
-}
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::On_Record_Ins(wxCommandEvent &event)
-{
-	Ins_Record();
-}
-
-void CVIEW_Table_Control::On_Record_Ins_UI(wxUpdateUIEvent &event)
-{
-	event.Enable(!FIXED_ROWS && m_pTable->Get_ObjectType() == DATAOBJECT_TYPE_Table);
-}
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::On_Record_Del(wxCommandEvent &event)
-{
-	Del_Record();
-}
-
-void CVIEW_Table_Control::On_Record_Del_UI(wxUpdateUIEvent &event)
-{
-	event.Enable(!FIXED_ROWS && m_pTable->Get_Selection_Count() > 0);
-}
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::On_Record_Clr(wxCommandEvent &event)
-{
-	Del_Records();
-}
-
-void CVIEW_Table_Control::On_Record_Clr_UI(wxUpdateUIEvent &event)
-{
-	event.Enable(!FIXED_ROWS);
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::On_Sel_To_Top(wxCommandEvent  &event)
-{
-	if( m_pTable->Get_Selection_Count() > 0 )
-	{
-		_Set_Records(true);
-	}
-}
-
-void CVIEW_Table_Control::On_Sel_To_Top_UI(wxUpdateUIEvent &event)
-{
-	event.Enable(m_pTable->Get_Selection_Count() > 0);
-}
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::On_Sel_Only(wxCommandEvent  &event)
-{
-	if( m_pTable->Get_Selection_Count() > 0 && m_pTable->Get_Selection_Count() < GetNumberRows() )
-	{
-		m_bSelOnly	= true;
-
-		_Set_Records();
-	}
-	else if( m_bSelOnly )
-	{
-		m_bSelOnly	= false;
-
-		_Set_Records();
-	}
-}
-
-void CVIEW_Table_Control::On_Sel_Only_UI(wxUpdateUIEvent &event)
-{
-	event.Check(m_bSelOnly);
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::On_Autosize_Cols(wxCommandEvent &event)
-{
-	AutoSizeColumns(false);
-}
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::On_Autosize_Rows(wxCommandEvent &event)
-{
-	AutoSizeRows(false);
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::On_LClick(wxGridEvent &event)
-{
-	int					iField		= m_Field_Offset + event.GetCol();
-	CSG_Table_Record	*pRecord	= m_pRecords[event.GetRow()];
-
-	//-----------------------------------------------------
-	if( event.ControlDown() )
-	{
-		m_pTable->Select(pRecord, true);
-
-		Update_Selection();
-	}
-
-	else if( event.ShiftDown() )
-	{
-		SelectBlock(event.GetRow(), 0, GetGridCursorRow(), GetNumberCols(), false);
-	}
-
-	else if( event.AltDown() )
-	{
-		if( m_pTable->Get_Field_Type(iField) == SG_DATATYPE_String )
-		{
-			Open_Application(pRecord->asString(iField));
-		}
-	}
-
-	else
-	{
-		SelectRow(event.GetRow(), false);
-
-		if( pRecord && iField >= m_Field_Offset && iField < m_pTable->Get_Field_Count() && m_pTable->Get_Field_Type(iField) == SG_DATATYPE_Color )
-		{
-			long	lValue;
-
-			if( DLG_Color(lValue = pRecord->asInt(iField)) )
-			{
-				pRecord->Set_Value(iField, lValue);
-
-				SetCellBackgroundColour(event.GetRow(), event.GetCol(), Get_Color_asWX(pRecord->asInt(iField)));
-
-				ForceRefresh();
-			}
-		}
-	}
-
-	//-----------------------------------------------------
-	SetGridCursor(event.GetRow(), event.GetCol());
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::On_LClick_Label(wxGridEvent &event)
-{
-	if( event.GetCol() >= 0 )
-	{
-		SetGridCursor	(GetGridCursorRow(), event.GetCol());
-	}
-	else if( event.GetRow() >= 0 )
-	{
-		SetGridCursor	(event.GetRow(), GetGridCursorCol());
-	}
-	else
-	{
-	//	SelectAll();
-	}
-}
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::On_RClick_Label(wxGridEvent &event)
-{
-	wxMenu	Menu;
-
-	//-----------------------------------------------------
-	if( event.GetCol() != -1 )
-	{
-		Menu.SetTitle(wxString::Format(wxT("%s"), _TL("Columns")));
-
-		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_ADD);
-		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_DEL);
-
-		Menu.AppendSeparator();
-		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_AUTOSIZE_COLS);
-		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_SORT);
-		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_RENAME);
-		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_TYPE);
-
-		PopupMenu(&Menu, event.GetPosition().x, event.GetPosition().y - GetColLabelSize());
-	}
-
-	//-----------------------------------------------------
-	else if( event.GetRow() != -1 )
-	{
-		Menu.SetTitle(wxString::Format(wxT("%s"), _TL("Rows")));
-
-		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_RECORD_ADD);
-		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_RECORD_INS);
-		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_RECORD_DEL);
-		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_RECORD_DEL_ALL);
-
-		Menu.AppendSeparator();
-		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_AUTOSIZE_ROWS);
-
-		if( !FIXED_ROWS )
-		{
-			Menu.AppendSeparator();
-			CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_SELECTION_TO_TOP);
-			CMD_Menu_Add_Item(&Menu,  true, ID_CMD_TABLE_SELECTION_ONLY);
-		}
-
-		PopupMenu(&Menu, event.GetPosition().x - GetRowLabelSize(), event.GetPosition().y);
-	}
-
-	//-----------------------------------------------------
-	else
-	{
-		ClearSelection();
-	}
-}
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::On_LDClick_Label(wxGridEvent &event)
-{
-	Update_Sorting(event.GetCol(), -1);
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-bool CVIEW_Table_Control::Update_Selection(void)
-{
-	if( GetBatchCount() == 0 )
-	{
-		BeginBatch();
-
-		if( m_pTable->Get_Selection_Count() >= m_pTable->Get_Count() )
-		{
-			SelectAll();
-		}
-		else
-		{
-			ClearSelection();
-
-			if( m_pTable->Get_Selection_Count() > 0 )
-			{
-				#pragma omp parallel for
-				for(int iRecord=0; iRecord<GetNumberRows(); iRecord++)
-				{
-					if( m_pRecords[iRecord]->is_Selected() )
-					{
-						SelectRow(iRecord, true);
-					}
-				}
-			}
-		}
-
-		EndBatch();
-
-		_Update_Views();
-
-		return( true );
-	}
-
-	return( false );
-}
-
-//---------------------------------------------------------
-void CVIEW_Table_Control::On_Select(wxGridRangeSelectEvent &event)
-{
-	if( GetBatchCount() == 0 )
-	{
-		BeginBatch();
-
-		for(int iRow=event.GetTopRow(); iRow<=event.GetBottomRow(); iRow++)
-		{
-			if( m_pRecords[iRow]->is_Selected() != event.Selecting() )
-			{
-				m_pTable->Select(m_pRecords[iRow], true);
-			}
-		}
-
-		EndBatch();
-
-		_Update_Views();
-	}
-
-	event.Skip();
-}
-
-
-///////////////////////////////////////////////////////////
-//														 //
-//														 //
-//														 //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
+}
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::On_Edit_Start(wxGridEvent &event)
+{
+	m_bEditing	= true;
+
+	event.Skip();
+}
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::On_Edit_Stop(wxGridEvent &event)
+{
+	m_bEditing	= false;
+
+	event.Skip();
+}
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::On_Changed(wxGridEvent &event)
+{
+	CSG_Table_Record	*pRecord	= m_pRecords[event.GetRow()];
+
+	if( pRecord )
+	{
+		int	iField	= m_Field_Offset + event.GetCol();
+
+		if( iField >= m_Field_Offset && iField < m_pTable->Get_Field_Count() )
+		{
+			pRecord->Set_Value(iField, GetCellValue(event.GetRow(), event.GetCol()).wx_str());
+
+			SetCellValue(event.GetRow(), event.GetCol(), pRecord->asString(iField));
+		}
+	}
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::On_Field_Add(wxCommandEvent &event)
+{
+	int				i;
+	CSG_String		sFields;
+	CSG_Parameters	P;
+
+	//-----------------------------------------------------
+	for(i=0; i<m_pTable->Get_Field_Count(); i++)
+	{
+		sFields.Append(m_pTable->Get_Field_Name(i));	sFields.Append(wxT('|'));
+	}
+
+	//-----------------------------------------------------
+	P.Set_Name(_TL("Add Field"));
+
+	P.Add_String(
+		NULL	, "NAME"	, _TL("Name"),
+		_TL(""),
+		_TL("Field")
+	);
+
+	P.Add_Choice(
+		NULL	, "TYPE"	, _TL("Field Type"),
+		_TL(""),
+		CSG_String::Format(SG_T("%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|"),
+			SG_Data_Type_Get_Name(SG_DATATYPE_String).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Date  ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Color ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Byte  ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Char  ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Word  ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Short ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_DWord ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Int   ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_ULong ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Long  ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Float ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Double).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Binary).c_str()
+		), 0
+	);
+
+	P.Add_Choice(
+		NULL	, "FIELD"	, _TL("Insert Position"),
+		_TL(""),
+		sFields, m_pTable->Get_Field_Count() - 1
+	);
+
+	P.Add_Choice(
+		NULL	, "INSERT"	, _TL("Insert Method"),
+		_TL(""),
+		CSG_String::Format(SG_T("%s|%s|"),
+			_TL("before"),
+			_TL("after")
+		), 1
+	);
+
+	//-----------------------------------------------------
+	if( DLG_Parameters(&P) )
+	{
+		int				Position;
+		TSG_Data_Type	Type;
+
+		switch( P("TYPE")->asInt() )
+		{
+		default:
+		case  0:	Type	= SG_DATATYPE_String;	break;
+		case  1:	Type	= SG_DATATYPE_Date;		break;
+		case  2:	Type	= SG_DATATYPE_Color;	break;
+		case  3:	Type	= SG_DATATYPE_Byte;		break;
+		case  4:	Type	= SG_DATATYPE_Char;		break;
+		case  5:	Type	= SG_DATATYPE_Word;		break;
+		case  6:	Type	= SG_DATATYPE_Short;	break;
+		case  7:	Type	= SG_DATATYPE_DWord;	break;
+		case  8:	Type	= SG_DATATYPE_Int;		break;
+		case  9:	Type	= SG_DATATYPE_ULong;	break;
+		case 10:	Type	= SG_DATATYPE_Long;		break;
+		case 11:	Type	= SG_DATATYPE_Float;	break;
+		case 12:	Type	= SG_DATATYPE_Double;	break;
+		case 13:	Type	= SG_DATATYPE_Binary;	break;
+		}
+
+		Position	= P("FIELD")->asInt() + P("INSERT")->asInt();
+
+		m_pTable->Add_Field(P("NAME")->asString(), Type, Position);
+
+		g_pData->Update(m_pTable, NULL);
+	}
+}
+
+void CVIEW_Table_Control::On_Field_Add_UI(wxUpdateUIEvent &event)
+{
+	event.Enable(FIXED_COLS == false);
+}
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::On_Field_Del(wxCommandEvent &event)
+{
+	int				i;
+	CSG_Parameters	P;
+
+	//-----------------------------------------------------
+	P.Set_Name(_TL("Delete Fields"));
+
+	for(i=0; i<m_pTable->Get_Field_Count(); i++)
+	{
+		P.Add_Value(NULL, SG_Get_String(i, 0), m_pTable->Get_Field_Name(i), _TL(""), PARAMETER_TYPE_Bool, false);
+	}
+
+	//-----------------------------------------------------
+	if( DLG_Parameters(&P) )
+	{
+		for(i=m_pTable->Get_Field_Count()-1; i>=0; i--)
+		{
+			if( P(SG_Get_String(i, 0))->asBool() )
+			{
+				m_pTable->Del_Field(i);
+
+				DeleteCols(i);
+			}
+		}
+
+		g_pData->Update(m_pTable, NULL);
+	}
+}
+
+void CVIEW_Table_Control::On_Field_Del_UI(wxUpdateUIEvent &event)
+{
+	event.Enable(FIXED_COLS == false);
+}
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::On_Field_Sort(wxCommandEvent &event)
+{
+	CSG_String		sFields, sOrder;
+	CSG_Parameter	*pNode;
+	CSG_Parameters	P;
+
+	//-----------------------------------------------------
+	for(int i=0; i<m_pTable->Get_Field_Count(); i++)
+	{
+		sFields.Append(m_pTable->Get_Field_Name(i));	sFields.Append('|');
+	}
+
+	sOrder.Printf(SG_T("%s|%s|%s|"),
+		_TL("unsorted"),
+		_TL("ascending"),
+		_TL("descending")
+	);
+
+	//-----------------------------------------------------
+	P.Set_Name(_TL("Sort Table"));
+
+	pNode	= P.Add_Choice(NULL , "FIELD_1"	, _TL("Sort first by")	,	_TL(""),	sFields	, !m_pTable->is_Indexed() ? 0 : m_pTable->Get_Index_Field(0));
+	pNode	= P.Add_Choice(pNode, "ORDER_1"	, _TL("Direction")		,	_TL(""),	sOrder	, !m_pTable->is_Indexed() ? 1 : m_pTable->Get_Index_Order(0));
+
+	pNode	= P.Add_Choice(NULL , "FIELD_2"	, _TL("Sort second by")	,	_TL(""),	sFields	, !m_pTable->is_Indexed() ? 0 : m_pTable->Get_Index_Field(1));
+	pNode	= P.Add_Choice(pNode, "ORDER_2"	, _TL("Direction")		,	_TL(""),	sOrder	, !m_pTable->is_Indexed() ? 0 : m_pTable->Get_Index_Order(1));
+
+	pNode	= P.Add_Choice(NULL , "FIELD_3"	, _TL("Sort third by")	,	_TL(""),	sFields	, !m_pTable->is_Indexed() ? 0 : m_pTable->Get_Index_Field(2));
+	pNode	= P.Add_Choice(pNode, "ORDER_3"	, _TL("Direction")		,	_TL(""),	sOrder	, !m_pTable->is_Indexed() ? 0 : m_pTable->Get_Index_Order(2));
+
+	//-----------------------------------------------------
+	if( DLG_Parameters(&P) )
+	{
+		m_pTable->Set_Index(
+			P("FIELD_1")->asInt(), P("ORDER_1")->asInt() == 1 ? TABLE_INDEX_Ascending : P("ORDER_1")->asInt() == 2 ? TABLE_INDEX_Descending : TABLE_INDEX_None,
+			P("FIELD_2")->asInt(), P("ORDER_2")->asInt() == 1 ? TABLE_INDEX_Ascending : P("ORDER_2")->asInt() == 2 ? TABLE_INDEX_Descending : TABLE_INDEX_None,
+			P("FIELD_3")->asInt(), P("ORDER_3")->asInt() == 1 ? TABLE_INDEX_Ascending : P("ORDER_3")->asInt() == 2 ? TABLE_INDEX_Descending : TABLE_INDEX_None
+		);
+
+		_Set_Records();
+	}
+}
+
+void CVIEW_Table_Control::On_Field_Sort_UI(wxUpdateUIEvent &event)
+{
+	event.Enable(m_pTable->Get_Field_Count() > 0 && m_pTable->Get_Record_Count() > 1);
+}
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::On_Field_Rename(wxCommandEvent &event)
+{
+	int				i;
+	CSG_Parameters	P;
+
+	P.Set_Name(_TL("Rename Fields"));
+
+	for(i=0; i<m_pTable->Get_Field_Count(); i++)
+	{
+		P.Add_String(NULL, "", m_pTable->Get_Field_Name(i), _TL(""), m_pTable->Get_Field_Name(i));
+	}
+
+	//-----------------------------------------------------
+	if( DLG_Parameters(&P) )
+	{
+		for(i=0; i<m_pTable->Get_Field_Count(); i++)
+		{
+			CSG_String	s(P(i)->asString());
+
+			if( s.Length() > 0 && s.Cmp(m_pTable->Get_Field_Name(i)) )
+			{
+				m_pTable->Set_Field_Name(i, s);
+
+				SetColLabelValue(i, s.c_str());
+			}
+		}
+
+		g_pData->Update(m_pTable, NULL);
+	}
+}
+
+void CVIEW_Table_Control::On_Field_Rename_UI(wxUpdateUIEvent &event)
+{
+	event.Enable(m_pTable->Get_Field_Count() > 0);
+}
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::On_Field_Type(wxCommandEvent &event)
+{
+	int				i, *Types	= new int[m_pTable->Get_Field_Count()];
+	CSG_Parameters	P;
+
+	P.Set_Name(_TL("Change Field Type"));
+
+	for(i=0; i<m_pTable->Get_Field_Count(); i++)
+	{
+		switch( m_pTable->Get_Field_Type(i) )
+		{
+		default:
+		case SG_DATATYPE_String:	Types[i]	=  0;	break;
+		case SG_DATATYPE_Date:		Types[i]	=  1;	break;
+		case SG_DATATYPE_Color:		Types[i]	=  2;	break;
+		case SG_DATATYPE_Byte:		Types[i]	=  3;	break;
+		case SG_DATATYPE_Char:		Types[i]	=  4;	break;
+		case SG_DATATYPE_Word:		Types[i]	=  5;	break;
+		case SG_DATATYPE_Short:		Types[i]	=  6;	break;
+		case SG_DATATYPE_DWord:		Types[i]	=  7;	break;
+		case SG_DATATYPE_Int:		Types[i]	=  8;	break;
+		case SG_DATATYPE_ULong:		Types[i]	=  9;	break;
+		case SG_DATATYPE_Long:		Types[i]	= 10;	break;
+		case SG_DATATYPE_Float:		Types[i]	= 11;	break;
+		case SG_DATATYPE_Double:	Types[i]	= 12;	break;
+		case SG_DATATYPE_Binary:	Types[i]	= 13;	break;
+		}
+
+        P.Add_Choice(NULL, "", m_pTable->Get_Field_Name(i), _TL(""),
+            CSG_String::Format(SG_T("%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|"),
+			SG_Data_Type_Get_Name(SG_DATATYPE_String).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Date  ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Color ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Byte  ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Char  ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Word  ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Short ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_DWord ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Int   ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_ULong ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Long  ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Float ).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Double).c_str(),
+			SG_Data_Type_Get_Name(SG_DATATYPE_Binary).c_str()
+            ), Types[i]
+        );
+	}
+
+	//-----------------------------------------------------
+	if( DLG_Parameters(&P) )
+	{
+		bool	bChanged	= false;
+
+		for(i=0; i<m_pTable->Get_Field_Count(); i++)
+		{
+			TSG_Data_Type	Type;
+
+			switch( P(i)->asInt() )
+			{
+			default:
+			case  0:	Type	= SG_DATATYPE_String;	break;
+			case  1:	Type	= SG_DATATYPE_Date;		break;
+			case  2:	Type	= SG_DATATYPE_Color;	break;
+			case  3:	Type	= SG_DATATYPE_Byte;		break;
+			case  4:	Type	= SG_DATATYPE_Char;		break;
+			case  5:	Type	= SG_DATATYPE_Word;		break;
+			case  6:	Type	= SG_DATATYPE_Short;	break;
+			case  7:	Type	= SG_DATATYPE_DWord;	break;
+			case  8:	Type	= SG_DATATYPE_Int;		break;
+			case  9:	Type	= SG_DATATYPE_ULong;	break;
+			case 10:	Type	= SG_DATATYPE_Long;		break;
+			case 11:	Type	= SG_DATATYPE_Float;	break;
+			case 12:	Type	= SG_DATATYPE_Double;	break;
+			case 13:	Type	= SG_DATATYPE_Binary;	break;
+			}
+
+			if( Type != Types[i] )
+			{
+				m_pTable->Set_Field_Type(i, Type);
+
+				bChanged	= true;
+			}
+		}
+
+		if( bChanged )
+		{
+			Update_Table();
+			g_pData->Update(m_pTable, NULL);
+		}
+	}
+}
+
+void CVIEW_Table_Control::On_Field_Type_UI(wxUpdateUIEvent &event)
+{
+	event.Enable(m_pTable->Get_Field_Count() > 0);
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::On_Record_Add(wxCommandEvent &event)
+{
+	Add_Record();
+}
+
+void CVIEW_Table_Control::On_Record_Add_UI(wxUpdateUIEvent &event)
+{
+	event.Enable(!FIXED_ROWS && m_pTable->Get_ObjectType() == DATAOBJECT_TYPE_Table);
+}
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::On_Record_Ins(wxCommandEvent &event)
+{
+	Ins_Record();
+}
+
+void CVIEW_Table_Control::On_Record_Ins_UI(wxUpdateUIEvent &event)
+{
+	event.Enable(!FIXED_ROWS && m_pTable->Get_ObjectType() == DATAOBJECT_TYPE_Table);
+}
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::On_Record_Del(wxCommandEvent &event)
+{
+	Del_Record();
+}
+
+void CVIEW_Table_Control::On_Record_Del_UI(wxUpdateUIEvent &event)
+{
+	event.Enable(!FIXED_ROWS && m_pTable->Get_Selection_Count() > 0);
+}
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::On_Record_Clr(wxCommandEvent &event)
+{
+	Del_Records();
+}
+
+void CVIEW_Table_Control::On_Record_Clr_UI(wxUpdateUIEvent &event)
+{
+	event.Enable(!FIXED_ROWS);
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::On_Sel_To_Top(wxCommandEvent  &event)
+{
+	if( m_pTable->Get_Selection_Count() > 0 )
+	{
+		_Set_Records(true);
+	}
+}
+
+void CVIEW_Table_Control::On_Sel_To_Top_UI(wxUpdateUIEvent &event)
+{
+	event.Enable(m_pTable->Get_Selection_Count() > 0);
+}
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::On_Sel_Only(wxCommandEvent  &event)
+{
+	if( m_pTable->Get_Selection_Count() > 0 && m_pTable->Get_Selection_Count() < GetNumberRows() )
+	{
+		m_bSelOnly	= true;
+
+		_Set_Records();
+	}
+	else if( m_bSelOnly )
+	{
+		m_bSelOnly	= false;
+
+		_Set_Records();
+	}
+}
+
+void CVIEW_Table_Control::On_Sel_Only_UI(wxUpdateUIEvent &event)
+{
+	event.Check(m_bSelOnly);
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::On_Autosize_Cols(wxCommandEvent &event)
+{
+	AutoSizeColumns(false);
+}
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::On_Autosize_Rows(wxCommandEvent &event)
+{
+	AutoSizeRows(false);
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::On_LClick(wxGridEvent &event)
+{
+	int					iField		= m_Field_Offset + event.GetCol();
+	CSG_Table_Record	*pRecord	= m_pRecords[event.GetRow()];
+
+	//-----------------------------------------------------
+	if( event.ControlDown() )
+	{
+		m_pTable->Select(pRecord, true);
+
+		Update_Selection();
+	}
+
+	else if( event.ShiftDown() )
+	{
+		SelectBlock(event.GetRow(), 0, GetGridCursorRow(), GetNumberCols(), false);
+	}
+
+	else if( event.AltDown() )
+	{
+		if( m_pTable->Get_Field_Type(iField) == SG_DATATYPE_String )
+		{
+			Open_Application(pRecord->asString(iField));
+		}
+	}
+
+	else
+	{
+		SelectRow(event.GetRow(), false);
+
+		if( pRecord && iField >= m_Field_Offset && iField < m_pTable->Get_Field_Count() && m_pTable->Get_Field_Type(iField) == SG_DATATYPE_Color )
+		{
+			long	lValue;
+
+			if( DLG_Color(lValue = pRecord->asInt(iField)) )
+			{
+				pRecord->Set_Value(iField, lValue);
+
+				SetCellBackgroundColour(event.GetRow(), event.GetCol(), Get_Color_asWX(pRecord->asInt(iField)));
+
+				ForceRefresh();
+			}
+		}
+	}
+
+	//-----------------------------------------------------
+	SetGridCursor(event.GetRow(), event.GetCol());
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::On_LClick_Label(wxGridEvent &event)
+{
+	if( event.GetCol() >= 0 )
+	{
+		SetGridCursor	(GetGridCursorRow(), event.GetCol());
+	}
+	else if( event.GetRow() >= 0 )
+	{
+		SetGridCursor	(event.GetRow(), GetGridCursorCol());
+	}
+	else
+	{
+	//	SelectAll();
+	}
+}
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::On_RClick_Label(wxGridEvent &event)
+{
+	wxMenu	Menu;
+
+	//-----------------------------------------------------
+	if( event.GetCol() != -1 )
+	{
+		Menu.SetTitle(wxString::Format(wxT("%s"), _TL("Columns")));
+
+		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_ADD);
+		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_DEL);
+
+		Menu.AppendSeparator();
+		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_AUTOSIZE_COLS);
+		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_SORT);
+		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_RENAME);
+		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_TYPE);
+
+		PopupMenu(&Menu, event.GetPosition().x, event.GetPosition().y - GetColLabelSize());
+	}
+
+	//-----------------------------------------------------
+	else if( event.GetRow() != -1 )
+	{
+		Menu.SetTitle(wxString::Format(wxT("%s"), _TL("Rows")));
+
+		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_RECORD_ADD);
+		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_RECORD_INS);
+		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_RECORD_DEL);
+		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_RECORD_DEL_ALL);
+
+		Menu.AppendSeparator();
+		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_AUTOSIZE_ROWS);
+
+		if( !FIXED_ROWS )
+		{
+			Menu.AppendSeparator();
+			CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_SELECTION_TO_TOP);
+			CMD_Menu_Add_Item(&Menu,  true, ID_CMD_TABLE_SELECTION_ONLY);
+		}
+
+		PopupMenu(&Menu, event.GetPosition().x - GetRowLabelSize(), event.GetPosition().y);
+	}
+
+	//-----------------------------------------------------
+	else
+	{
+		ClearSelection();
+	}
+}
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::On_LDClick_Label(wxGridEvent &event)
+{
+	Update_Sorting(event.GetCol(), -1);
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
+bool CVIEW_Table_Control::Update_Selection(void)
+{
+	if( GetBatchCount() == 0 )
+	{
+		BeginBatch();
+
+		if( m_pTable->Get_Selection_Count() >= m_pTable->Get_Count() )
+		{
+			SelectAll();
+		}
+		else
+		{
+			ClearSelection();
+
+			if( m_pTable->Get_Selection_Count() > 0 )
+			{
+				#pragma omp parallel for
+				for(int iRecord=0; iRecord<GetNumberRows(); iRecord++)
+				{
+					if( m_pRecords[iRecord]->is_Selected() )
+					{
+						SelectRow(iRecord, true);
+					}
+				}
+			}
+		}
+
+		EndBatch();
+
+		_Update_Views();
+
+		return( true );
+	}
+
+	return( false );
+}
+
+//---------------------------------------------------------
+void CVIEW_Table_Control::On_Select(wxGridRangeSelectEvent &event)
+{
+	if( GetBatchCount() == 0 )
+	{
+		BeginBatch();
+
+		for(int iRow=event.GetTopRow(); iRow<=event.GetBottomRow(); iRow++)
+		{
+			if( m_pRecords[iRow]->is_Selected() != event.Selecting() )
+			{
+				m_pTable->Select(m_pRecords[iRow], true);
+			}
+		}
+
+		EndBatch();
+
+		_Update_Views();
+	}
+
+	event.Skip();
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
diff --git a/src/saga_core/saga_gui/wksp.cpp b/src/saga_core/saga_gui/wksp.cpp
index 60318ba..561e3f8 100644
--- a/src/saga_core/saga_gui/wksp.cpp
+++ b/src/saga_core/saga_gui/wksp.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: wksp.cpp 1995 2014-02-14 12:02:16Z oconrad $
+ * Version $Id: wksp.cpp 2501 2015-06-12 10:02:42Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -326,6 +326,7 @@ void CWKSP::On_Command(wxCommandEvent &event)
 	case ID_CMD_DATA_PROJECT_OPEN_ADD:
 	case ID_CMD_DATA_PROJECT_SAVE:
 	case ID_CMD_DATA_PROJECT_SAVE_AS:
+	case ID_CMD_DATA_PROJECT_BROWSE:
 	case ID_CMD_TABLES_OPEN:
 	case ID_CMD_SHAPES_OPEN:
 	case ID_CMD_TIN_OPEN:
diff --git a/src/saga_core/saga_gui/wksp_base_control.cpp b/src/saga_core/saga_gui/wksp_base_control.cpp
index 5bbc0b5..a13a20b 100644
--- a/src/saga_core/saga_gui/wksp_base_control.cpp
+++ b/src/saga_core/saga_gui/wksp_base_control.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: wksp_base_control.cpp 2231 2014-09-15 14:47:01Z oconrad $
+ * Version $Id: wksp_base_control.cpp 2419 2015-02-19 21:00:10Z oconrad $
  *********************************************************/
 	
 ///////////////////////////////////////////////////////////
@@ -83,6 +83,7 @@
 
 #include "wksp_module_control.h"
 #include "wksp_module_manager.h"
+#include "wksp_module.h"
 
 #include "wksp_data_manager.h"
 #include "wksp_data_layers.h"
@@ -91,6 +92,7 @@
 #include "wksp_map_manager.h"
 #include "wksp_map.h"
 #include "wksp_map_buttons.h"
+#include "wksp_layer.h"
 
 
 ///////////////////////////////////////////////////////////
@@ -284,6 +286,11 @@ bool CWKSP_Base_Control::_Del_Item(CWKSP_Base_Item *pItem, bool bSilent)
 		return( false );
 	}
 
+	if( pItem->Get_Type() == WKSP_ITEM_Module && ((CWKSP_Module *)pItem)->Get_Module()->Get_Type() != MODULE_TYPE_Chain )
+	{	// tool libraries can be unloaded, tools not! (except of tool chain tools)
+		return( false );
+	}
+
 	if( pItem->Get_Type() == WKSP_ITEM_Table &&	((CWKSP_Table *)pItem)->Get_Object()->Get_ObjectType() != DATAOBJECT_TYPE_Table )
 	{
 		return( false );
@@ -301,14 +308,10 @@ bool CWKSP_Base_Control::_Del_Item(CWKSP_Base_Item *pItem, bool bSilent)
 		{
 			Freeze();
 
-			if( g_pData_Buttons )
-			{
-				g_pData_Buttons->Freeze();
-			}
-
-			if( g_pMap_Buttons )
+			if( m_pManager == g_pData || m_pManager == g_pMaps )
 			{
-				g_pMap_Buttons->Freeze();
+				if( g_pData_Buttons )	{	g_pData_Buttons->Freeze();	}
+				if( g_pMap_Buttons  )	{	g_pMap_Buttons ->Freeze();	}
 			}
 
 			//---------------------------------------------
@@ -316,7 +319,7 @@ bool CWKSP_Base_Control::_Del_Item(CWKSP_Base_Item *pItem, bool bSilent)
 			AppendItem		(m_pManager->GetId(), _TL("<no items>"), 0, 0, NULL);
 			Expand			(m_pManager->GetId());
 
-			if( g_pModule_Ctrl && m_pManager->Get_Type() == WKSP_ITEM_Module_Manager )
+			if( g_pModules == m_pManager )
 			{
 				g_pModules->Update();
 			}
@@ -324,16 +327,10 @@ bool CWKSP_Base_Control::_Del_Item(CWKSP_Base_Item *pItem, bool bSilent)
 			//---------------------------------------------
 			Thaw();
 
-			if( g_pData_Buttons )
+			if( m_pManager == g_pData || m_pManager == g_pMaps )
 			{
-				g_pData_Buttons->Thaw();
-				g_pData_Buttons->Update_Buttons();
-			}
-
-			if( g_pMap_Buttons )
-			{
-				g_pMap_Buttons->Thaw();
-				g_pMap_Buttons->Update_Buttons();
+				if( g_pData_Buttons )	{	g_pData_Buttons->Thaw();	g_pData_Buttons->Update_Buttons();	}
+				if( g_pMap_Buttons  )	{	g_pMap_Buttons ->Thaw();	g_pMap_Buttons ->Update_Buttons();	}
 			}
 
 			return( true );
diff --git a/src/saga_core/saga_gui/wksp_base_item.cpp b/src/saga_core/saga_gui/wksp_base_item.cpp
index 01befd7..7e77537 100644
--- a/src/saga_core/saga_gui/wksp_base_item.cpp
+++ b/src/saga_core/saga_gui/wksp_base_item.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: wksp_base_item.cpp 2275 2014-10-02 15:48:59Z oconrad $
+ * Version $Id: wksp_base_item.cpp 2488 2015-05-13 10:08:58Z reklov_w $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -281,13 +281,13 @@ int CWKSP_Base_Item::_On_Parameter_Changed(CSG_Parameter *pParameter, int Flags)
 {
 	if( pParameter && pParameter->Get_Owner() && pParameter->Get_Owner()->Get_Owner() )
 	{
-		((CWKSP_Base_Item *)pParameter->Get_Owner()->Get_Owner())->
+		return ((CWKSP_Base_Item *)pParameter->Get_Owner()->Get_Owner())->
 			On_Parameter_Changed(pParameter->Get_Owner(), pParameter, Flags);
 	}
 
 	if( g_pACTIVE )
 	{
-		g_pACTIVE->Get_Parameters()->Update_Parameters(pParameter->Get_Owner(), false);
+		return g_pACTIVE->Get_Parameters()->Update_Parameters(pParameter->Get_Owner(), false);
 	}
 
 	return( 0 );
diff --git a/src/saga_core/saga_gui/wksp_data_manager.cpp b/src/saga_core/saga_gui/wksp_data_manager.cpp
index 4d79f73..a93a3be 100644
--- a/src/saga_core/saga_gui/wksp_data_manager.cpp
+++ b/src/saga_core/saga_gui/wksp_data_manager.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: wksp_data_manager.cpp 2145 2014-06-06 14:02:05Z oconrad $
+ * Version $Id: wksp_data_manager.cpp 2511 2015-06-17 13:22:42Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -144,6 +144,20 @@ CWKSP_Data_Manager::CWKSP_Data_Manager(void)
 		), 2
 	);
 
+	pNode_1	= m_Parameters.Add_Choice(
+		pNode	, "PROJECT_MAP_ARRANGE"		, _TL("Map Window Arrangement"),
+		_TL("initial map window arrangement after a project is loaded"),
+		CSG_String::Format(SG_T("%s|%s|%s|"),
+			_TL("Cascade"),
+			_TL("Tile Horizontally"),
+			_TL("Tile Vertically")
+		), 2
+	);
+
+#ifndef _SAGA_MSW
+	pNode_1->Set_Enabled(false);
+#endif
+
 	m_Parameters.Add_Value(
 		pNode	, "NUMBERING"				, _TL("Numbering of Data Sets"),
 		_TL("Leading zeros for data set numbering. Set to -1 for not using numbers at all."),
@@ -283,9 +297,11 @@ bool CWKSP_Data_Manager::Initialise(void)
 	{
 		return( m_pProject->Load(false) );
 	}
-	else
+	else if( CONFIG_Read("/DATA", "PROJECT_FILE", FileName) )
 	{
-		return( CONFIG_Read("/DATA", "PROJECT_FILE", FileName) && wxFileExists(FileName) && m_pProject->Load(FileName, false, false) );
+		FileName	= Get_FilePath_Absolute(g_pSAGA->Get_App_Path(), FileName);
+
+		return( wxFileExists(FileName) && m_pProject->Load(FileName, false, false) );
 	}
 
 	return( false );
@@ -304,7 +320,7 @@ bool CWKSP_Data_Manager::Finalise(void)
 	wxFileName	fProject(sHome.c_str(), "saga_gui", "cfg");
 #else
 	wxFileName	fProject(g_pSAGA->Get_App_Path(), "saga_gui", "cfg");
-	wxString(getenv("HOME"));
+
 	if(	( fProject.FileExists() && (!fProject.IsFileReadable() || !fProject.IsFileWritable()))
 	||	(!fProject.FileExists() && (!fProject.IsDirReadable () || !fProject.IsDirWritable ())) )
 	{
@@ -331,13 +347,18 @@ bool CWKSP_Data_Manager::Finalise(void)
             wxRemoveFile(fProject.GetFullPath());
 		}
 
-		CONFIG_Write(wxT("/DATA"), wxT("PROJECT_FILE"), m_pProject->Get_File_Name());
+		CONFIG_Write("/DATA", "PROJECT_FILE", m_pProject->Get_File_Name());
 	}
 	else
 	{	// automatically save and load
 		m_pProject->Save(fProject.GetFullPath(), false);
 
-		CONFIG_Write(wxT("/DATA"), wxT("PROJECT_FILE"), fProject.GetFullPath());
+		if( fProject.GetPath().Find(g_pSAGA->Get_App_Path()) == 0 )
+		{
+			fProject.MakeRelativeTo(g_pSAGA->Get_App_Path());
+		}
+
+		CONFIG_Write("/DATA", "PROJECT_FILE", fProject.GetFullPath());
 	}
 
 	m_pProject->Clr_File_Name();
@@ -485,6 +506,7 @@ bool CWKSP_Data_Manager::On_Command(int Cmd_ID)
 	case ID_CMD_DATA_PROJECT_OPEN_ADD:	m_pProject->Load(true);				break;
 	case ID_CMD_DATA_PROJECT_SAVE:		m_pProject->Save(true);				break;
 	case ID_CMD_DATA_PROJECT_SAVE_AS:	m_pProject->Save();					break;
+	case ID_CMD_DATA_PROJECT_BROWSE:	Open_Browser();						break;
 
 	//-----------------------------------------------------
 	case ID_CMD_TABLES_OPEN:			Open(DATAOBJECT_TYPE_Table);		break;
@@ -687,6 +709,83 @@ bool CWKSP_Data_Manager::Open_CMD(int Cmd_ID)
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
+bool CWKSP_Data_Manager::Open_Browser(void)
+{
+	//-----------------------------------------------------
+	wxString	Directory	= wxDirSelector(_TL("Search for Projects"));
+
+	if( Directory.IsEmpty() )
+	{
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	wxArrayString	Projects;
+
+	Open_Browser(Projects, Directory);
+
+	if( Projects.Count() == 0 )
+	{
+		wxMessageBox(_TL("No projects in directory"), _TL("Search for Projects"), wxOK|wxICON_EXCLAMATION);
+
+		return( false );
+	}
+
+	//-----------------------------------------------------
+	wxSingleChoiceDialog	dlg(MDI_Get_Top_Window(), _TL("Open Project"), _TL("Search for Projects"), Projects);
+
+	return( dlg.ShowModal() == wxID_OK && Open(dlg.GetStringSelection()) );
+}
+
+//---------------------------------------------------------
+#include <wx/dir.h>
+
+//---------------------------------------------------------
+bool CWKSP_Data_Manager::Open_Browser(wxArrayString &Projects, const wxString &Directory)
+{
+	wxDir	Dir;
+
+	if( Dir.Open(Directory) )
+	{
+		wxString	FileName;
+
+		if( Dir.GetFirst(&FileName, wxEmptyString, wxDIR_FILES) )
+		{
+			do
+			{
+				wxFileName	fn(Dir.GetName(), FileName);
+
+				if( !fn.GetExt().CmpNoCase("sprj") )
+				{
+					Projects.Add(fn.GetFullPath());
+				}
+			}
+			while( Dir.GetNext(&FileName) );
+		}
+
+		if( Dir.GetFirst(&FileName, wxEmptyString, wxDIR_DIRS) )
+		{
+			do
+			{
+				wxFileName	fn(Dir.GetName(), FileName);
+
+				Open_Browser(Projects, fn.GetFullPath());
+			}
+			while( Dir.GetNext(&FileName) );
+		}
+	}
+
+	return( Projects.Count() > 0 );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+//														 //
+//														 //
+///////////////////////////////////////////////////////////
+
+//---------------------------------------------------------
 bool CWKSP_Data_Manager::Save_Modified(CWKSP_Base_Item *pItem, bool bSelections)
 {
 	CSG_Parameters	Parameters(this, _TL("Save Modified Data"), _TL(""));
@@ -1105,7 +1204,7 @@ bool CWKSP_Data_Manager::Get_Parameters(CSG_Data_Object *pObject, CSG_Parameters
 {
 	CWKSP_Data_Item	*pItem	= pParameters ? Get(pObject) : NULL;
 
-	return( pItem && pParameters->Assign(pItem->Get_Parameters()) > 0 );
+	return( pItem && pParameters->Assign(pItem->Get_Parameters()) );
 }
 
 //---------------------------------------------------------
@@ -1113,7 +1212,7 @@ bool CWKSP_Data_Manager::Set_Parameters(CSG_Data_Object *pObject, CSG_Parameters
 {
 	CWKSP_Data_Item	*pItem	= pParameters ? Get(pObject) : NULL;
 
-	if( pItem && pItem->Get_Parameters()->Assign_Values(pParameters) > 0 )
+	if( pItem && pItem->Get_Parameters()->Assign_Values(pParameters) )
 	{
 		pItem->Parameters_Changed();
 
diff --git a/src/saga_core/saga_gui/wksp_data_manager.h b/src/saga_core/saga_gui/wksp_data_manager.h
index a35b053..4573b47 100644
--- a/src/saga_core/saga_gui/wksp_data_manager.h
+++ b/src/saga_core/saga_gui/wksp_data_manager.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: wksp_data_manager.h 1955 2014-01-23 13:49:11Z oconrad $
+ * Version $Id: wksp_data_manager.h 2501 2015-06-12 10:02:42Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -123,6 +123,8 @@ public:
 	bool							Open				(const wxString &File);
 	bool							Open				(int DataType);
 	bool							Open_CMD			(int Cmd_ID);
+	bool							Open_Browser		(void);
+	bool							Open_Browser		(wxArrayString &Projects, const wxString &Directory);
 
 	bool							Save_Modified		(class CWKSP_Base_Item *pItem = NULL, bool bSelections = false);
 	bool							Save_Modified_Sel	(void);
diff --git a/src/saga_core/saga_gui/wksp_data_menu_file.cpp b/src/saga_core/saga_gui/wksp_data_menu_file.cpp
index 3cc82cf..1333c9f 100644
--- a/src/saga_core/saga_gui/wksp_data_menu_file.cpp
+++ b/src/saga_core/saga_gui/wksp_data_menu_file.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: wksp_data_menu_file.cpp 1955 2014-01-23 13:49:11Z oconrad $
+ * Version $Id: wksp_data_menu_file.cpp 2501 2015-06-12 10:02:42Z oconrad $
  *********************************************************/
 	
 ///////////////////////////////////////////////////////////
@@ -223,6 +223,7 @@ void CWKSP_Data_Menu_File::Update(wxMenu *pMenu)
 //			CMD_Menu_Add_Item(pMenu, false, ID_CMD_DATA_PROJECT_OPEN_ADD);
 //			CMD_Menu_Add_Item(pMenu, false, ID_CMD_DATA_PROJECT_SAVE);
 			CMD_Menu_Add_Item(pMenu, false, ID_CMD_DATA_PROJECT_SAVE_AS);
+			CMD_Menu_Add_Item(pMenu, false, ID_CMD_DATA_PROJECT_BROWSE);
 			break;
 
 		case DATAOBJECT_TYPE_Table:
diff --git a/src/saga_core/saga_gui/wksp_grid.cpp b/src/saga_core/saga_gui/wksp_grid.cpp
index 7e14270..5cecaf9 100644
--- a/src/saga_core/saga_gui/wksp_grid.cpp
+++ b/src/saga_core/saga_gui/wksp_grid.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: wksp_grid.cpp 2318 2014-10-31 12:10:58Z oconrad $
+ * Version $Id: wksp_grid.cpp 2512 2015-06-19 15:16:18Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -95,10 +95,6 @@
 CWKSP_Grid::CWKSP_Grid(CSG_Grid *pGrid)
 	: CWKSP_Layer(pGrid)
 {
-	m_pOverlay[0]	= NULL;
-	m_pOverlay[1]	= NULL;
-
-	//-----------------------------------------------------
 	On_Create_Parameters();
 
 	DataObject_Changed();
@@ -360,8 +356,8 @@ void CWKSP_Grid::On_Create_Parameters(void)
 			_TL("Discrete Colors" ),	// CLASSIFY_METRIC
 			_TL("Graduated Colors"),	// CLASSIFY_GRADUATED
 			_TL("Shade"           ),	// CLASSIFY_SHADE
-			_TL("RGB Overlay"     ),	// CLASSIFY_OVERLAY
-			_TL("RGB Composite"   )		// CLASSIFY_RGB
+			_TL("RGB Composite"   ),	// CLASSIFY_OVERLAY
+			_TL("RGB Coded Values")		// CLASSIFY_RGB
 		)
 	);
 
@@ -390,31 +386,34 @@ void CWKSP_Grid::On_Create_Parameters(void)
 
 	//-----------------------------------------------------
 	m_Parameters.Add_Node(
-		m_Parameters("NODE_COLORS")		, "NODE_OVERLAY"	, _TL("RGB Overlay"),
+		m_Parameters("NODE_COLORS")		, "NODE_OVERLAY"	, _TL("RGB Composite"),
 		_TL("")
 	);
 
 	m_Parameters.Add_Choice(
-		m_Parameters("NODE_OVERLAY")	, "OVERLAY_MODE"	, _TL("Coloring"),
+		m_Parameters("NODE_OVERLAY")	, "OVERLAY_MODE"	, _TL("This Color"),
 		_TL(""),
-		CSG_String::Format(SG_T("%s|%s|%s|%s|%s|%s|"),
-			_TL("red=this, green=1, blue=2"),
-			_TL("red=this, green=2, blue=1"),
-			_TL("red=1, green=this, blue=2"),
-			_TL("red=2, green=this, blue=1"),
-			_TL("red=1, green=2, blue=this"),
-			_TL("red=2, green=1, blue=this")
+		CSG_String::Format(SG_T("%s|%s|%s|"),
+			_TL("Red"),
+			_TL("Green"),
+			_TL("Blue")
 		), 0
 	);
 
 	m_Parameters.Add_Grid(
-		m_Parameters("NODE_OVERLAY")	, "OVERLAY_1"		, _TL("Overlay 1"),
+		m_Parameters("NODE_OVERLAY")	, "OVERLAY_R"		, _TL("Red"),
+		_TL(""),
+		PARAMETER_INPUT_OPTIONAL, false
+	)->Get_Parent()->Set_Value((void *)&Get_Grid()->Get_System());
+
+	m_Parameters.Add_Grid(
+		m_Parameters("NODE_OVERLAY")	, "OVERLAY_G"		, _TL("Green"),
 		_TL(""),
 		PARAMETER_INPUT_OPTIONAL, false
 	)->Get_Parent()->Set_Value((void *)&Get_Grid()->Get_System());
 
 	m_Parameters.Add_Grid(
-		m_Parameters("NODE_OVERLAY")	, "OVERLAY_2"		, _TL("Overlay 2"),
+		m_Parameters("NODE_OVERLAY")	, "OVERLAY_B"		, _TL("Blue"),
 		_TL(""),
 		PARAMETER_INPUT_OPTIONAL, false
 	)->Get_Parent()->Set_Value((void *)&Get_Grid()->Get_System());
@@ -533,10 +532,6 @@ void CWKSP_Grid::On_Parameters_Changed(void)
 	Get_Grid()->Set_Scaling(m_Parameters("GENERAL_Z_FACTOR")->asDouble(), m_Parameters("GENERAL_Z_OFFSET")->asDouble());
 
 	//-----------------------------------------------------
-	m_pOverlay[0]	= (CWKSP_Grid *)g_pData->Get(m_Parameters("OVERLAY_1")->asGrid());
-	m_pOverlay[1]	= (CWKSP_Grid *)g_pData->Get(m_Parameters("OVERLAY_2")->asGrid());
-	m_bOverlay		= m_Parameters("COLORS_TYPE")->asInt() == CLASSIFY_OVERLAY;
-
 	m_pClassify->Set_Shade_Mode(m_Parameters("SHADE_MODE")->asInt());
 
 	//-----------------------------------------------------
@@ -569,6 +564,25 @@ void CWKSP_Grid::On_Parameters_Changed(void)
 	}
 }
 
+//---------------------------------------------------------
+bool CWKSP_Grid::Update(CWKSP_Layer *pChanged)
+{
+	if( pChanged == this )
+	{
+		return( true );
+	}
+
+	if( pChanged && pChanged->Get_Type() == WKSP_ITEM_Grid )
+	{
+		return(	(((CWKSP_Grid *)pChanged)->Get_Grid() == m_Parameters("OVERLAY_R")->asGrid() && m_Parameters("OVERLAY_R")->is_Enabled())
+			||  (((CWKSP_Grid *)pChanged)->Get_Grid() == m_Parameters("OVERLAY_G")->asGrid() && m_Parameters("OVERLAY_G")->is_Enabled())
+			||  (((CWKSP_Grid *)pChanged)->Get_Grid() == m_Parameters("OVERLAY_B")->asGrid() && m_Parameters("OVERLAY_B")->is_Enabled())
+		);
+	}
+
+	return( false );
+}
+
 
 ///////////////////////////////////////////////////////////
 //														 //
@@ -581,39 +595,46 @@ int CWKSP_Grid::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter
 {
 	if( Flags & PARAMETER_CHECK_ENABLE )
 	{
-		if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("COLORS_TYPE")) )
+		if(	!SG_STR_CMP(pParameter->Get_Identifier(), "COLORS_TYPE") )
 		{
 			int		Value	= pParameter->asInt();
 
-			pParameters->Get_Parameter("NODE_UNISYMBOL")->Set_Enabled(Value == CLASSIFY_UNIQUE);
-			pParameters->Get_Parameter("NODE_LUT"      )->Set_Enabled(Value == CLASSIFY_LUT);
-			pParameters->Get_Parameter("NODE_METRIC"   )->Set_Enabled(Value != CLASSIFY_UNIQUE && Value != CLASSIFY_LUT);
-			pParameters->Get_Parameter("NODE_SHADE"    )->Set_Enabled(Value == CLASSIFY_SHADE);
-			pParameters->Get_Parameter("NODE_OVERLAY"  )->Set_Enabled(Value == CLASSIFY_OVERLAY);
+			pParameters->Set_Enabled("NODE_UNISYMBOL", Value == CLASSIFY_UNIQUE);
+			pParameters->Set_Enabled("NODE_LUT"      , Value == CLASSIFY_LUT);
+			pParameters->Set_Enabled("NODE_METRIC"   , Value != CLASSIFY_UNIQUE && Value != CLASSIFY_LUT);
+			pParameters->Set_Enabled("NODE_SHADE"    , Value == CLASSIFY_SHADE);
+			pParameters->Set_Enabled("NODE_OVERLAY"  , Value == CLASSIFY_OVERLAY);
+		}
+
+		if( !SG_STR_CMP(pParameter->Get_Identifier(), "OVERLAY_MODE") )
+		{
+			pParameters->Get_Parameter("OVERLAY_R")->Get_Parent()->Set_Enabled(pParameter->asInt() != 0);
+			pParameters->Get_Parameter("OVERLAY_G")->Get_Parent()->Set_Enabled(pParameter->asInt() != 1);
+			pParameters->Get_Parameter("OVERLAY_B")->Get_Parent()->Set_Enabled(pParameter->asInt() != 2);
 		}
 
-		if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("VALUES_SHOW")) )
+		if(	!SG_STR_CMP(pParameter->Get_Identifier(), "VALUES_SHOW") )
 		{
 			bool	Value	= pParameter->asBool();
 
-			pParameters->Get_Parameter("VALUES_FONT"    )->Set_Enabled(Value);
-			pParameters->Get_Parameter("VALUES_SIZE"    )->Set_Enabled(Value);
-			pParameters->Get_Parameter("VALUES_DECIMALS")->Set_Enabled(Value);
-			pParameters->Get_Parameter("VALUES_EFFECT"  )->Set_Enabled(Value);
+			pParameters->Set_Enabled("VALUES_FONT"    , Value);
+			pParameters->Set_Enabled("VALUES_SIZE"    , Value);
+			pParameters->Set_Enabled("VALUES_DECIMALS", Value);
+			pParameters->Set_Enabled("VALUES_EFFECT"  , Value);
 		}
 
-		if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("VALUES_EFFECT")) )
+		if(	!SG_STR_CMP(pParameter->Get_Identifier(), "VALUES_EFFECT") )
 		{
 			bool	Value	= pParameter->asInt() > 0;
 
-			pParameters->Get_Parameter("VALUES_EFFECT_COLOR")->Set_Enabled(Value);
+			pParameters->Set_Enabled("VALUES_EFFECT_COLOR", Value);
 		}
 
-		if(	!SG_STR_CMP(pParameter->Get_Identifier(), SG_T("MEMORY_MODE")) )
+		if(	!SG_STR_CMP(pParameter->Get_Identifier(), "MEMORY_MODE") )
 		{
 			int		Value	= pParameter->asInt();
 
-			pParameters->Get_Parameter("MEMORY_BUFFER_SIZE")->Set_Enabled(Value != 0);
+			pParameters->Set_Enabled("MEMORY_BUFFER_SIZE", Value != 0);
 		}
 	}
 
@@ -1349,7 +1370,8 @@ void CWKSP_Grid::On_Draw(CWKSP_Map_DC &dc_Map, bool bEdit)
 							: m_Parameters("DISPLAY_INTERPOLATION")->asInt();
 
 			if(	dc_Map.m_DC2World >= Get_Grid()->Get_Cellsize()
-			||	Interpolation != GRID_INTERPOLATION_NearestNeighbour || m_bOverlay )
+			||	Interpolation != GRID_INTERPOLATION_NearestNeighbour
+			||  m_Parameters("COLORS_TYPE" )->asInt() == CLASSIFY_OVERLAY )
 			{
 				_Draw_Grid_Points	(dc_Map, Interpolation);
 			}
@@ -1373,37 +1395,43 @@ void CWKSP_Grid::On_Draw(CWKSP_Map_DC &dc_Map, bool bEdit)
 //---------------------------------------------------------
 void CWKSP_Grid::_Draw_Grid_Points(CWKSP_Map_DC &dc_Map, int Interpolation)
 {
-	bool		bByteWise	= m_pClassify->Get_Mode() == CLASSIFY_RGB;
-	int			axDC, ayDC, bxDC, byDC, nyDC, r, g, b;
-	CSG_Rect	rMap(dc_Map.m_rWorld);
+	int	Mode	= m_Parameters("COLORS_TYPE" )->asInt() == CLASSIFY_OVERLAY
+				? m_Parameters("OVERLAY_MODE")->asInt()
+				: m_pClassify->Get_Mode() == CLASSIFY_RGB ? -2 : -1;
 
-	switch( m_Parameters("OVERLAY_MODE")->asInt() )
+	CWKSP_Grid	*pOverlay[2];
+
+	switch( Mode )
 	{
-	default:
-	case 0:	r = 0; g = 1; b = 2;	break;
-	case 1:	r = 0; g = 2; b = 1;	break;
-	case 2:	r = 1; g = 0; b = 2;	break;
-	case 3:	r = 2; g = 0; b = 1;	break;
-	case 4:	r = 1; g = 2; b = 0;	break;
-	case 5:	r = 2; g = 1; b = 0;	break;
-	}
+	case 0:
+		pOverlay[0]	= (CWKSP_Grid *)g_pData->Get(m_Parameters("OVERLAY_G")->asGrid());
+		pOverlay[1]	= (CWKSP_Grid *)g_pData->Get(m_Parameters("OVERLAY_B")->asGrid());
+		break;
 
-	m_pOverlay[0]	= (CWKSP_Grid *)g_pData->Get(m_Parameters("OVERLAY_1")->asGrid());
-	m_pOverlay[1]	= (CWKSP_Grid *)g_pData->Get(m_Parameters("OVERLAY_2")->asGrid());
+	case 1:
+		pOverlay[0]	= (CWKSP_Grid *)g_pData->Get(m_Parameters("OVERLAY_R")->asGrid());
+		pOverlay[1]	= (CWKSP_Grid *)g_pData->Get(m_Parameters("OVERLAY_B")->asGrid());
+		break;
 
-	rMap.Intersect(Get_Grid()->Get_Extent(true));
+	case 2:
+		pOverlay[0]	= (CWKSP_Grid *)g_pData->Get(m_Parameters("OVERLAY_R")->asGrid());
+		pOverlay[1]	= (CWKSP_Grid *)g_pData->Get(m_Parameters("OVERLAY_G")->asGrid());
+		break;
+	}
 
-	axDC	= (int)dc_Map.xWorld2DC(rMap.Get_XMin());	if( axDC < 0 )	axDC	= 0;
-	bxDC	= (int)dc_Map.xWorld2DC(rMap.Get_XMax());	if( bxDC >= dc_Map.m_rDC.GetWidth () )	bxDC	= dc_Map.m_rDC.GetWidth () - 1;
-	ayDC	= (int)dc_Map.yWorld2DC(rMap.Get_YMin());	if( ayDC >= dc_Map.m_rDC.GetHeight() )	ayDC	= dc_Map.m_rDC.GetHeight() - 1;
-	byDC	= (int)dc_Map.yWorld2DC(rMap.Get_YMax());	if( byDC < 0 )	byDC	= 0;
-	nyDC	= abs(ayDC - byDC);
+	CSG_Rect	rMap(dc_Map.m_rWorld);	rMap.Intersect(Get_Grid()->Get_Extent(true));
+
+	int	axDC	= (int)dc_Map.xWorld2DC(rMap.Get_XMin());	if( axDC < 0 )	axDC	= 0;
+	int	bxDC	= (int)dc_Map.xWorld2DC(rMap.Get_XMax());	if( bxDC >= dc_Map.m_rDC.GetWidth () )	bxDC	= dc_Map.m_rDC.GetWidth () - 1;
+	int	ayDC	= (int)dc_Map.yWorld2DC(rMap.Get_YMin());	if( ayDC >= dc_Map.m_rDC.GetHeight() )	ayDC	= dc_Map.m_rDC.GetHeight() - 1;
+	int	byDC	= (int)dc_Map.yWorld2DC(rMap.Get_YMax());	if( byDC < 0 )	byDC	= 0;
+	int	nyDC	= abs(ayDC - byDC);
 
 	if( Get_Grid()->is_Cached() || Get_Grid()->is_Compressed() )
 	{
 		for(int iyDC=0; iyDC<=nyDC; iyDC++)
 		{
-			_Draw_Grid_Line(dc_Map, Interpolation, bByteWise, ayDC - iyDC, axDC, bxDC, r, g, b);
+			_Draw_Grid_Line(dc_Map, Interpolation, Mode, pOverlay, ayDC - iyDC, axDC, bxDC);
 		}
 	}
 	else
@@ -1411,24 +1439,24 @@ void CWKSP_Grid::_Draw_Grid_Points(CWKSP_Map_DC &dc_Map, int Interpolation)
 		#pragma omp parallel for
 		for(int iyDC=0; iyDC<=nyDC; iyDC++)
 		{
-			_Draw_Grid_Line(dc_Map, Interpolation, bByteWise, ayDC - iyDC, axDC, bxDC, r, g, b);
+			_Draw_Grid_Line(dc_Map, Interpolation, Mode, pOverlay, ayDC - iyDC, axDC, bxDC);
 		}
 	}
 }
 
 //---------------------------------------------------------
-void CWKSP_Grid::_Draw_Grid_Line(CWKSP_Map_DC &dc_Map, int Interpolation, bool bByteWise, int yDC, int axDC, int bxDC, int r, int g, int b)
+void CWKSP_Grid::_Draw_Grid_Line(CWKSP_Map_DC &dc_Map, int Interpolation, int Mode, CWKSP_Grid *pOverlay[2], int yDC, int axDC, int bxDC)
 {
-	int		xDC;
-	double	xMap, yMap	= dc_Map.yDC2World(yDC);
+	double	xMap	= dc_Map.xDC2World(axDC);
+	double	yMap	= dc_Map.yDC2World( yDC);
 
-	for(xMap=dc_Map.xDC2World(axDC), xDC=axDC; xDC<=bxDC; xMap+=dc_Map.m_DC2World, xDC++)
+	for(int xDC=axDC; xDC<=bxDC; xMap+=dc_Map.m_DC2World, xDC++)
 	{
 		double	Value;
 
-		if( Get_Grid()->Get_Value(xMap, yMap, Value, Interpolation, bByteWise, true) )
+		if( Get_Grid()->Get_Value(xMap, yMap, Value, Interpolation, Mode == -2, true) )
 		{
-			if( m_bOverlay == false )
+			if( Mode < 0 )
 			{
 				int		c;
 
@@ -1443,17 +1471,22 @@ void CWKSP_Grid::_Draw_Grid_Line(CWKSP_Map_DC &dc_Map, int Interpolation, bool b
 
 				c[0]	= (int)(255.0 * m_pClassify->Get_MetricToRelative(Value));
 
-				c[1]	= m_pOverlay[0] && m_pOverlay[0]->Get_Grid()->Get_Value(xMap, yMap, Value, Interpolation, false, true)
-						? (int)(255.0 * m_pOverlay[0]->m_pClassify->Get_MetricToRelative(Value)) : 255;
+				c[1]	= pOverlay[0] && pOverlay[0]->Get_Grid()->Get_Value(xMap, yMap, Value, Interpolation, false, true)
+						? (int)(255.0 * pOverlay[0]->m_pClassify->Get_MetricToRelative(Value)) : 255;
+
+				c[2]	= pOverlay[1] && pOverlay[1]->Get_Grid()->Get_Value(xMap, yMap, Value, Interpolation, false, true)
+						? (int)(255.0 * pOverlay[1]->m_pClassify->Get_MetricToRelative(Value)) : 255;
 
-				c[2]	= m_pOverlay[1] && m_pOverlay[1]->Get_Grid()->Get_Value(xMap, yMap, Value, Interpolation, false, true)
-						? (int)(255.0 * m_pOverlay[1]->m_pClassify->Get_MetricToRelative(Value)) : 255;
+				if( c[0] < 0 ) c[0] = 0; else if( c[0] > 255 ) c[0] = 255;
+				if( c[1] < 0 ) c[1] = 0; else if( c[1] > 255 ) c[1] = 255;
+				if( c[2] < 0 ) c[2] = 0; else if( c[2] > 255 ) c[2] = 255;
 
-				dc_Map.IMG_Set_Pixel(xDC, yDC, SG_GET_RGB(
-					c[r] < 0 ? 0 : c[r] > 255 ? 255 : c[r],
-					c[g] < 0 ? 0 : c[g] > 255 ? 255 : c[g],
-					c[b] < 0 ? 0 : c[b] > 255 ? 255 : c[b]
-				));
+				switch( Mode )
+				{
+				case 0:	dc_Map.IMG_Set_Pixel(xDC, yDC, SG_GET_RGB(c[0], c[1], c[2]));	break;
+				case 1:	dc_Map.IMG_Set_Pixel(xDC, yDC, SG_GET_RGB(c[1], c[0], c[2]));	break;
+				case 2:	dc_Map.IMG_Set_Pixel(xDC, yDC, SG_GET_RGB(c[1], c[2], c[0]));	break;
+				}
 			}
 		}
 	}
diff --git a/src/saga_core/saga_gui/wksp_grid.h b/src/saga_core/saga_gui/wksp_grid.h
index 1cfb6a1..6d0f59d 100644
--- a/src/saga_core/saga_gui/wksp_grid.h
+++ b/src/saga_core/saga_gui/wksp_grid.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: wksp_grid.h 2003 2014-02-19 17:08:18Z oconrad $
+ * Version $Id: wksp_grid.h 2512 2015-06-19 15:16:18Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -106,7 +106,7 @@ public:
 
 	virtual bool				asImage					(CSG_Grid *pImage);
 
-	virtual bool				Update					(CWKSP_Layer *pChanged)	{	return( pChanged == this || pChanged == m_pOverlay[0] || pChanged == m_pOverlay[1] );	}
+	virtual bool				Update					(CWKSP_Layer *pChanged);
 
 	virtual wxMenu *			Edit_Get_Menu			(void);
 	virtual TSG_Rect			Edit_Get_Extent			(void);
@@ -130,12 +130,8 @@ protected:
 
 private:
 
-	bool						m_bOverlay;
-
 	int							m_xSel, m_ySel;
 
-	CWKSP_Grid					*m_pOverlay[2];
-
 
 	void						_LUT_Create				(void);
 
@@ -145,7 +141,7 @@ private:
 	void						_Save_Image				(void);
 
 	void						_Draw_Grid_Points		(CWKSP_Map_DC &dc_Map, int Interpolation);
-	void						_Draw_Grid_Line			(CWKSP_Map_DC &dc_Map, int Interpolation, bool bByteWise, int yDC, int axDC, int bxDC, int r, int g, int b);
+	void						_Draw_Grid_Line			(CWKSP_Map_DC &dc_Map, int Interpolation, int Mode, CWKSP_Grid *pOverlay[2], int yDC, int axDC, int bxDC);
 	void						_Draw_Grid_Cells		(CWKSP_Map_DC &dc_Map);
 
 	void						_Draw_Values			(CWKSP_Map_DC &dc_Map);
diff --git a/src/saga_core/saga_gui/wksp_layer_classify.cpp b/src/saga_core/saga_gui/wksp_layer_classify.cpp
index 01be8cf..32d4041 100644
--- a/src/saga_core/saga_gui/wksp_layer_classify.cpp
+++ b/src/saga_core/saga_gui/wksp_layer_classify.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: wksp_layer_classify.cpp 2241 2014-09-22 11:04:27Z oconrad $
+ * Version $Id: wksp_layer_classify.cpp 2431 2015-03-03 17:21:59Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -89,19 +89,14 @@ CWKSP_Layer_Classify::CWKSP_Layer_Classify(void)
 	m_pLUT			= NULL;
 
 	m_HST_Count		= NULL;
+	m_HST_Cumul		= NULL;
 }
 
 //---------------------------------------------------------
 CWKSP_Layer_Classify::~CWKSP_Layer_Classify(void)
 {
-	if( m_HST_Count )
-	{
-		SG_Free(m_HST_Count);
-		m_HST_Count	= NULL;
-
-		SG_Free(m_HST_Cumul);
-		m_HST_Cumul	= NULL;
-	}
+	SG_FREE_SAFE(m_HST_Count);
+	SG_FREE_SAFE(m_HST_Cumul);
 }
 
 
@@ -520,24 +515,17 @@ void CWKSP_Layer_Classify::Metric2EqualElements(void)
 //---------------------------------------------------------
 bool CWKSP_Layer_Classify::Histogram_Update(void)
 {
-	int		i;
-
 	//-----------------------------------------------------
-	if( m_HST_Count )
-	{
-		SG_Free(m_HST_Count);
-		SG_Free(m_HST_Cumul);
-		m_HST_Count	= NULL;
-		m_HST_Cumul	= NULL;
-	}
+	SG_FREE_SAFE(m_HST_Count);
+	SG_FREE_SAFE(m_HST_Cumul);
 
 	//-----------------------------------------------------
 	if( Get_Class_Count() > 0 )
 	{
 		STATUSBAR_Set_Text(_TL("Build Histogram..."));
 
-		m_HST_Count	= (int *)SG_Calloc(Get_Class_Count(), sizeof(int));
-		m_HST_Cumul	= (int *)SG_Calloc(Get_Class_Count(), sizeof(int));
+		m_HST_Count	= (sLong *)SG_Calloc(Get_Class_Count(), sizeof(sLong));
+		m_HST_Cumul	= (sLong *)SG_Calloc(Get_Class_Count(), sizeof(sLong));
 
 		switch( m_pLayer->Get_Type() )
 		{
@@ -560,6 +548,8 @@ bool CWKSP_Layer_Classify::Histogram_Update(void)
 		PROCESS_Set_Okay();
 
 		//-------------------------------------------------
+		int		i;
+
 		for(i=0, m_HST_Maximum=0, m_HST_Total=0; i<Get_Class_Count(); i++)
 		{
 			m_HST_Cumul[i]	= (m_HST_Total += m_HST_Count[i]);
diff --git a/src/saga_core/saga_gui/wksp_layer_classify.h b/src/saga_core/saga_gui/wksp_layer_classify.h
index e977a2a..e78b0a5 100644
--- a/src/saga_core/saga_gui/wksp_layer_classify.h
+++ b/src/saga_core/saga_gui/wksp_layer_classify.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: wksp_layer_classify.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: wksp_layer_classify.h 2431 2015-03-03 17:21:59Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -468,9 +468,9 @@ public: ///////////////////////////////////////////////////
 
 protected: ////////////////////////////////////////////////
 
-	int							m_Mode, m_zMode, m_Shade_Mode, m_Count,
-								m_UNI_Color,
-								*m_HST_Count, *m_HST_Cumul, m_HST_Maximum, m_HST_Total;
+	int							m_Mode, m_zMode, m_Shade_Mode, m_Count, m_UNI_Color;
+
+	sLong						*m_HST_Count, *m_HST_Cumul, m_HST_Maximum, m_HST_Total;
 
 	double						m_zMin, m_zRange, m_zLogRange, m_zLogMax;
 
diff --git a/src/saga_core/saga_gui/wksp_map.cpp b/src/saga_core/saga_gui/wksp_map.cpp
index a05df94..ae8590d 100644
--- a/src/saga_core/saga_gui/wksp_map.cpp
+++ b/src/saga_core/saga_gui/wksp_map.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: wksp_map.cpp 2331 2014-11-07 12:15:10Z oconrad $
+ * Version $Id: wksp_map.cpp 2495 2015-05-21 14:14:52Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -457,6 +457,13 @@ void CWKSP_Map::On_Create_Parameters(void)
 
 	//-----------------------------------------------------
 	pNode_1	= m_Parameters.Add_Value(
+		pNode_0	, "GCS_POSITION"	, _TL("Position as Geographic Coordinates"),
+		_TL("show mouse position in statusbar using geographic coordinates if possible"),
+		PARAMETER_TYPE_Bool, false
+	);
+
+	//-----------------------------------------------------
+	pNode_1	= m_Parameters.Add_Value(
 		pNode_0	, "SCALE_SHOW"		, _TL("Scale Bar"),
 		_TL(""),
 		PARAMETER_TYPE_Bool, g_pMaps->Get_Parameter("SCALE_BAR")->asBool()
@@ -1710,14 +1717,25 @@ void CWKSP_Map::Draw_Frame(wxDC &dc, const CSG_Rect &rWorld, wxRect rMap, int Wi
 	r		= wxRect(rMap.GetLeft()    , rFrame.GetTop()    , rMap.GetWidth(), Width);
 	Draw_Scale(dc, r, rWorld.Get_XMin(), rWorld.Get_XMax()  , true , true , false);
 
-	r		= wxRect(rMap.GetLeft()    , rMap.GetBottom()   , rMap.GetWidth(), Width);
-	Draw_Scale(dc, r, 0.0              , rWorld.Get_XRange(), true , true , true);
-
 	r		= wxRect(rFrame.GetLeft()  , rMap.GetTop()      , Width, rMap.GetHeight());
 	Draw_Scale(dc, r, rWorld.Get_YMin(), rWorld.Get_YMax()  , false, false, false);
 
-	r		= wxRect(rMap.GetRight()   , rMap.GetTop()      , Width, rMap.GetHeight());
-	Draw_Scale(dc, r, 0.0              , rWorld.Get_YRange(), false, false, true);
+	if( is_ScaleBar() )
+	{
+		r		= wxRect(rMap.GetLeft()    , rMap.GetBottom()   , rMap.GetWidth(), Width);
+		Draw_Scale(dc, r, rWorld.Get_XMin(), rWorld.Get_XMax()  , true , true , false);
+
+		r		= wxRect(rMap.GetRight()   , rMap.GetTop()      , Width, rMap.GetHeight());
+		Draw_Scale(dc, r, rWorld.Get_YMin(), rWorld.Get_YMax()  , false, false, false);
+	}
+	else
+	{
+		r		= wxRect(rMap.GetLeft()    , rMap.GetBottom()   , rMap.GetWidth(), Width);
+		Draw_Scale(dc, r, 0.0              , rWorld.Get_XRange(), true , true , true);
+
+		r		= wxRect(rMap.GetRight()   , rMap.GetTop()      , Width, rMap.GetHeight());
+		Draw_Scale(dc, r, 0.0              , rWorld.Get_YRange(), false, false, true);
+	}
 
 	Draw_Edge(dc, EDGE_STYLE_SIMPLE, rFrame.GetLeft(), rFrame.GetTop(), rFrame.GetRight(), rFrame.GetBottom());
 }
diff --git a/src/saga_core/saga_gui/wksp_map_layer.cpp b/src/saga_core/saga_gui/wksp_map_layer.cpp
index 004000c..782cc61 100644
--- a/src/saga_core/saga_gui/wksp_map_layer.cpp
+++ b/src/saga_core/saga_gui/wksp_map_layer.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: wksp_map_layer.cpp 2152 2014-06-10 15:06:07Z oconrad $
+ * Version $Id: wksp_map_layer.cpp 2513 2015-06-19 15:30:32Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -210,12 +210,17 @@ bool CWKSP_Map_Layer::On_Command(int Cmd_ID)
 
 			if( m_pLayer->Get_Parameter("COLORS_TYPE")->asInt() == CLASSIFY_OVERLAY )
 			{
-				if( (pGrid = (CWKSP_Grid *)g_pData->Get(m_pLayer->Get_Parameter("OVERLAY_1")->asGrid())) != NULL )
+				if( m_pLayer->Get_Parameter("OVERLAY_R")->is_Enabled() && (pGrid = (CWKSP_Grid *)g_pData->Get(m_pLayer->Get_Parameter("OVERLAY_R")->asGrid())) != NULL )
 				{
 					pGrid->Fit_Color_Range(rWorld);
 				}
 
-				if( (pGrid = (CWKSP_Grid *)g_pData->Get(m_pLayer->Get_Parameter("OVERLAY_2")->asGrid())) != NULL )
+				if( m_pLayer->Get_Parameter("OVERLAY_G")->is_Enabled() && (pGrid = (CWKSP_Grid *)g_pData->Get(m_pLayer->Get_Parameter("OVERLAY_R")->asGrid())) != NULL )
+				{
+					pGrid->Fit_Color_Range(rWorld);
+				}
+
+				if( m_pLayer->Get_Parameter("OVERLAY_B")->is_Enabled() && (pGrid = (CWKSP_Grid *)g_pData->Get(m_pLayer->Get_Parameter("OVERLAY_B")->asGrid())) != NULL )
 				{
 					pGrid->Fit_Color_Range(rWorld);
 				}
diff --git a/src/saga_core/saga_gui/wksp_module.cpp b/src/saga_core/saga_gui/wksp_module.cpp
index 1d67063..b432a29 100644
--- a/src/saga_core/saga_gui/wksp_module.cpp
+++ b/src/saga_core/saga_gui/wksp_module.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: wksp_module.cpp 2301 2014-10-21 08:52:29Z oconrad $
+ * Version $Id: wksp_module.cpp 2530 2015-07-01 07:08:40Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -136,38 +136,6 @@ wxString CWKSP_Module::Get_Name(void)
 }
 
 //---------------------------------------------------------
-wxString CWKSP_Module::Get_Menu_Path(void)
-{
-	//-----------------------------------------------------
-	wxString	Menu	= m_pModule->Get_MenuPath().c_str();
-
-	if( Menu.Length() > 1 && Menu[1] == ':' )
-	{
-		if( Menu[0] == 'A' || Menu[0] == 'a' )		// absolute menu path, overwrites library's default menu path
-		{
-			return( Menu.AfterFirst(':') );
-		}
-
-		Menu	= Menu.AfterFirst(':');	// Menu[0] == 'R' || Menu[0] == 'r'	// menu path explicitly declared as relative to library's default menu path
-	}
-
-	//-----------------------------------------------------
-	wxString	Root	= ((CWKSP_Module_Library *)Get_Manager())->Get_Library()->Get_Menu().c_str();
-
-	if( Root.IsEmpty() )
-	{
-		return( Menu );
-	}
-
-	if( Menu.IsEmpty() )
-	{
-		return( Root );
-	}
-
-	return( Root + "|" + Menu );
-}
-
-//---------------------------------------------------------
 wxString CWKSP_Module::Get_File_Name(void)
 {
 	return( m_pModule->Get_File_Name().c_str() );
@@ -202,7 +170,7 @@ wxString CWKSP_Module::Get_Description(void)
 	}
 
 	//-----------------------------------------------------
-	wxString	Menu(Get_Menu_Path()), Description;
+	wxString	Menu(m_pModule->Get_MenuPath(true).c_str()), Description;
 
 	if( g_pModules->Get_Parameter("HELP_SOURCE")->asInt() == 1 )
 	{
@@ -447,167 +415,196 @@ bool CWKSP_Module::Execute(CSG_Point ptWorld, TSG_Module_Interactive_Mode Mode,
 //---------------------------------------------------------
 void CWKSP_Module::_Save_to_Clipboard(void)
 {
-	CSG_MetaData	Tool;	Tool.Set_Name("tool");
-
-	Tool.Add_Property("library", m_pModule->Get_Library());
-	Tool.Add_Property("module" , m_pModule->Get_ID     ());
-	Tool.Add_Property("name"   , m_pModule->Get_Name   ());
+	//-----------------------------------------------------
+	wxArrayString	Choices;
 
-	_Save_to_Clipboard(Tool, m_pModule->Get_Parameters());
+	Choices.Add(_TL("Tool Chain"              ));
+	Choices.Add(_TL("Tool Chain with Header"  ));
+	Choices.Add(_TL("Command Line"            ));
+	Choices.Add(_TL("Command Line with Header"));
+	Choices.Add(_TL("Python"                  ));
+	Choices.Add(_TL("Python with Header"      ));
 
-	for(int i=0; i<m_pModule->Get_Parameters_Count(); i++)
-	{
-		_Save_to_Clipboard(Tool, m_pModule->Get_Parameters());
-	}
+	wxSingleChoiceDialog	dlg(MDI_Get_Top_Window(), _TL("Select Format"), _TL("Save to Clipboard"), Choices);
 
-	if( wxTheClipboard->Open() )
+	if( dlg.ShowModal() == wxID_OK )
 	{
-		CSG_MetaData	Tools;	Tools.Set_Name("toolchain");
-
-		Tools.Add_Property("saga-version", SAGA_VERSION);
-
-		Tools.Add_Child("group");
-		Tools.Add_Child("identifier");
-		Tools.Add_Child("name");
-		Tools.Add_Child("author");
-		Tools.Add_Child("description");
-		Tools.Add_Child("menu");
-		Tools.Add_Child("parameters");
-		Tools.Add_Child("tools")->Add_Child(Tool);
+		CSG_String	s;
 
-		CSG_String	s(Tools.asText(1));
+		switch( dlg.GetSelection() )
+		{
+		case 0:	s	= _Get_XML   (false);	break;	// Tool Chain
+		case 1:	s	= _Get_XML   ( true);	break;	// Tool Chain with Header
+		case 2:	s	= _Get_CMD   (false);	break;	// Command Line
+		case 3:	s	= _Get_CMD   ( true);	break;	// Command Line with Header
+		case 4:	s	= _Get_Python(false);	break;	// Python
+		case 5:	s	= _Get_Python( true);	break;	// Python with Header
+		}
 
-		wxTheClipboard->SetData(new wxTextDataObject(s.c_str()));
-		wxTheClipboard->Close();
+		if( !s.is_Empty() && wxTheClipboard->Open() )
+		{
+			wxTheClipboard->SetData(new wxTextDataObject(s.c_str()));
+			wxTheClipboard->Close();
+		}
 	}
 }
 
 //---------------------------------------------------------
-void CWKSP_Module::_Save_to_Clipboard(CSG_MetaData &Tool, CSG_Parameters *pParameters)
+void CWKSP_Module::_Save_to_Script(void)
 {
-	for(int iParameter=0; iParameter<pParameters->Get_Count(); iParameter++)
+	wxString	FileName;
+
+	if( DLG_Save(FileName, _TL("Create Script Command File"), SG_T("DOS Batch Script (*.bat)|*.bat|Bash Script (*.sh)|*.sh|Python Script (*.py)|*.py|SAGA Tool Chain (*.xml)|*.xml")) )
 	{
-		CSG_Parameter	*p	= pParameters->Get_Parameter(iParameter);
+		CSG_String	Script;
 
-		if( !p->is_Enabled() )
+		if( SG_File_Cmp_Extension(FileName, SG_T("xml")) )
 		{
-			continue;
+			Script	= _Get_XML(true);
 		}
 
-		CSG_MetaData	*pChild	= NULL;
-
-		switch( p->Get_Type() )
+		if( SG_File_Cmp_Extension(FileName, SG_T("bat")) )
 		{
-		case PARAMETER_TYPE_Parameters  :
-			_Save_to_Clipboard(Tool, p->asParameters());
-			break;
-
-		case PARAMETER_TYPE_Bool        :
-		case PARAMETER_TYPE_Int         :
-		case PARAMETER_TYPE_Double      :
-		case PARAMETER_TYPE_Degree      :
-		case PARAMETER_TYPE_Range       :
-		case PARAMETER_TYPE_String      :
-		case PARAMETER_TYPE_Text        :
-		case PARAMETER_TYPE_FilePath    :
-		case PARAMETER_TYPE_Table_Field :
-		case PARAMETER_TYPE_Table_Fields:
-			pChild	= Tool.Add_Child("option", p->asString());
-			break;
-
-		case PARAMETER_TYPE_Choice      :
-			pChild	= Tool.Add_Child("option", p->asInt());
-			break;
+			Script	= _Get_CMD(true, 0);
+		}
 
-		case PARAMETER_TYPE_Grid_System :
-			if( p->Get_Children_Count() == 0 )
-			{
-				pChild	= Tool.Add_Child("option", p->asString());
-			}
-			break;
+		if( SG_File_Cmp_Extension(FileName, SG_T("sh")) )
+		{
+			Script	= _Get_CMD(true, 1);
+		}
 
-		default:
-			if( p->is_Input() )
-			{
-				pChild	= Tool.Add_Child("input");
-				pChild->Set_Content(p->is_Optional() ? "input_optional" : "input");
-			}
-			else if( p->is_Output() )
-			{
-				pChild	= Tool.Add_Child("output");
-				pChild->Set_Content("output");
-			}
-			break;
+		if( SG_File_Cmp_Extension(FileName, SG_T("py")) )
+		{
+			Script	= _Get_Python(true);
 		}
 
-		if( pChild )
+		//-------------------------------------------------
+		CSG_File	File;
+
+		if( !Script.is_Empty() && File.Open(&FileName, SG_FILE_W, false) )
 		{
-			pChild->Add_Property("parms", pParameters->Get_Identifier());
-			pChild->Add_Property("id"   , p          ->Get_Identifier());
+			File.Write(Script);
 		}
 	}
 }
 
-
 ///////////////////////////////////////////////////////////
 //														 //
-//														 //
-//														 //
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
-void CWKSP_Module::_Save_to_Script(void)
+CSG_String CWKSP_Module::_Get_XML(bool bHeader)
 {
-	wxString	FileName;
+	CSG_MetaData	Tool;	Tool.Set_Name("tool");
 
-	if( !DLG_Save(FileName, _TL("Create Script Command File"), SG_T("DOS Batch Script (*.bat)|*.bat|Bash Script (*.sh)|*.sh|Python Script (*.py)|*.py")) )
+	Tool.Add_Property("library", m_pModule->Get_Library());
+	Tool.Add_Property("module" , m_pModule->Get_ID     ());
+	Tool.Add_Property("name"   , m_pModule->Get_Name   ());
+
+	_Get_XML(Tool, m_pModule->Get_Parameters());
+
+	for(int i=0; i<m_pModule->Get_Parameters_Count(); i++)
 	{
-		return;
+		_Get_XML(Tool, m_pModule->Get_Parameters());
+	}
+
+	if( !bHeader )
+	{
+		return( Tool.asText(1) );
+	}
+	else
+	{
+		CSG_MetaData	Tools;	Tools.Set_Name("toolchain");
+
+		Tools.Add_Property("saga-version", SAGA_VERSION);
+
+		Tools.Add_Child("group");
+		Tools.Add_Child("identifier");
+		Tools.Add_Child("name");
+		Tools.Add_Child("author");
+		Tools.Add_Child("description");
+		Tools.Add_Child("menu");
+		Tools.Add_Child("parameters");
+		Tools.Add_Child("tools")->Add_Child(Tool);
+
+		return( Tools.asText(1) );
 	}
+}
 
+//---------------------------------------------------------
+CSG_String CWKSP_Module::_Get_CMD(bool bHeader, int Type)
+{
 	CSG_String	s;
 
+	if( Type != 0 && Type != 1 )	// default type ??
+	{
+#ifdef _SAGA_MSW
+		Type	= 0;
+#else
+		Type	= 1;
+#endif
+	}
+
 	//-----------------------------------------------------
-	if( SG_File_Cmp_Extension(FileName, SG_T("bat")) )
+	if( Type == 0 )	// DOS/Windows Batch Script
 	{
-		s	+= "@ECHO OFF\n\n";
-		s	+= "REM SET SAGA_MLB=C:\\SAGA\\Modules\n";
-		s	+= "REM SET PATH=%PATH%;C:\\SAGA\n\n";
-		s	+= "REM Tool: ";
-		s	+= m_pModule->Get_Name() + "\n\n";
+		if( bHeader )
+		{
+			s	+= "@ECHO OFF\n\n";
+			s	+= "REM SET SAGA_MLB=C:\\SAGA\\Modules\n";
+			s	+= "REM SET PATH=%PATH%;C:\\SAGA\n\n";
+			s	+= "REM Tool: ";
+			s	+= m_pModule->Get_Name() + "\n\n";
+		}
+
 		s	+= "saga_cmd ";
-		s	+= m_pModule->Get_Library() + " " + m_pModule->Get_ID() + "\n";
+		s	+= m_pModule->Get_Library() + " " + m_pModule->Get_ID();
 
-		_Save_to_Script_CMD(s, m_pModule->Get_Parameters());
+		_Get_CMD(s, m_pModule->Get_Parameters());
 
 		for(int i=0; i<m_pModule->Get_Parameters_Count(); i++)
 		{
-			_Save_to_Script_CMD(s, m_pModule->Get_Parameters(i));
+			_Get_CMD(s, m_pModule->Get_Parameters(i));
 		}
 
-		s	+= "\n\nPAUSE\n";
+		if( bHeader )
+		{
+			s	+= "\n\nPAUSE\n";
+		}
 	}
 
 	//-----------------------------------------------------
-	if( SG_File_Cmp_Extension(FileName, SG_T("sh")) )
+	if( Type == 1 )	// Bash Shell Script
 	{
-		s	+= "#!/bin/bash\n\n";
-		s	+= "# export SAGA_MLB=/usr/lib/saga\n\n";
-		s	+= "# tool: ";
-		s	+= m_pModule->Get_Name() + "\n\n";
+		if( bHeader )
+		{
+			s	+= "#!/bin/bash\n\n";
+			s	+= "# export SAGA_MLB=/usr/lib/saga\n\n";
+			s	+= "# tool: ";
+			s	+= m_pModule->Get_Name() + "\n\n";
+		}
+
 		s	+= "saga_cmd ";
-		s	+= m_pModule->Get_Library() + " " + m_pModule->Get_ID() + "\n";
+		s	+= m_pModule->Get_Library() + " " + m_pModule->Get_ID();
 
-		_Save_to_Script_CMD(s, m_pModule->Get_Parameters());
+		_Get_CMD(s, m_pModule->Get_Parameters());
 
 		for(int i=0; i<m_pModule->Get_Parameters_Count(); i++)
 		{
-			_Save_to_Script_CMD(s, m_pModule->Get_Parameters(i));
+			_Get_CMD(s, m_pModule->Get_Parameters(i));
 		}
 	}
 
+	return( s );
+}
+
+//---------------------------------------------------------
+CSG_String CWKSP_Module::_Get_Python(bool bHeader)
+{
+	CSG_String	s;
+
 	//-----------------------------------------------------
-	if( SG_File_Cmp_Extension(FileName, SG_T("py")) )
+	if( bHeader )
 	{
 		#ifndef _SAGA_MSW
 		s	+= "#! /usr/bin/env python\n";
@@ -616,72 +613,79 @@ void CWKSP_Module::_Save_to_Script(void)
 		s	+= "import saga_api, sys, os\n";
 		s	+= "\n";
 		s	+= "##########################################\n";
-		s	+= "def Call_SAGA_Module(fDEM):            # pass your input file(s) here\n";
-		s	+= "\n";
-		s	+= "    # ------------------------------------\n";
-		s	+= "    # initialize input dataset(s)\n";
-		s	+= "    dem    = saga_api.SG_Get_Data_Manager().Add_Grid(unicode(fDEM))\n";
-		s	+= "    if dem == None or dem.is_Valid() == 0:\n";
-		s	+= "        print 'ERROR: loading grid [' + fDEM + ']'\n";
-		s	+= "        return 0\n";
-		s	+= "\n";
-		s	+= "    # ------------------------------------\n";
-		s	+= "    # initialize output dataset(s)\n";
-		s	+= "    outgrid = saga_api.SG_Get_Data_Manager().Add_Grid(dem.Get_System())\n";
-		s	+= "\n";
-		s	+= "    # ------------------------------------\n";
-		s	+= "    # call module: ";
-		s	+= m_pModule->Get_Name() + "\n";
-		s	+= "    Module = saga_api.SG_Get_Module_Library_Manager().Get_Module('";
-		s	+= m_pModule->Get_Library() + "','" + m_pModule->Get_ID() + "')\n";
+	}
 
-		if( m_pModule->Get_Type() == MODULE_TYPE_Grid )
-		{
-			s	+= "    Module.Get_Parameters().Get_Grid_System().Assign(dem.Get_System())\n";
-		}
+	//-----------------------------------------------------
+	s	+= "def Call_SAGA_Module(fDEM):            # pass your input file(s) here\n";
+	s	+= "\n";
+	s	+= "    # ------------------------------------\n";
+	s	+= "    # initialize input dataset(s)\n";
+	s	+= "    dem    = saga_api.SG_Get_Data_Manager().Add_Grid(unicode(fDEM))\n";
+	s	+= "    if dem == None or dem.is_Valid() == 0:\n";
+	s	+= "        print 'ERROR: loading grid [' + fDEM + ']'\n";
+	s	+= "        return 0\n";
+	s	+= "\n";
+	s	+= "    # ------------------------------------\n";
+	s	+= "    # initialize output dataset(s)\n";
+	s	+= "    outgrid = saga_api.SG_Get_Data_Manager().Add_Grid(dem.Get_System())\n";
+	s	+= "\n";
+	s	+= "    # ------------------------------------\n";
+	s	+= "    # call module: ";
+	s	+= m_pModule->Get_Name() + "\n";
+	s	+= "    Module = saga_api.SG_Get_Module_Library_Manager().Get_Module('";
+	s	+= m_pModule->Get_Library() + "','" + m_pModule->Get_ID() + "')\n";
+
+	if( m_pModule->Get_Type() == MODULE_TYPE_Grid )
+	{
+		s	+= "    Module.Get_Parameters().Get_Grid_System().Assign(dem.Get_System())\n";
+	}
 
-		s	+= "\n";
-		s	+= "    Parms = Module.Get_Parameters() # default parameter list\n";
+	s	+= "\n";
+	s	+= "    Parms = Module.Get_Parameters() # default parameter list\n";
 
-		//-------------------------------------------------
-		_Save_to_Script_Python(s, m_pModule->Get_Parameters());
+	//-------------------------------------------------
+	_Get_Python(s, m_pModule->Get_Parameters());
 
-		for(int i=0; i<m_pModule->Get_Parameters_Count(); i++)
-		{
-			s	+= "\n";
-			s	+= CSG_String::Format("    Parms = Module.Get_Parameters(%d) # additional parameter list\n", i);
+	for(int i=0; i<m_pModule->Get_Parameters_Count(); i++)
+	{
+		s	+= "\n";
+		s	+= CSG_String::Format("    Parms = Module.Get_Parameters(%d) # additional parameter list\n", i);
 
-			_Save_to_Script_Python(s, m_pModule->Get_Parameters(i));
-		}
+		_Get_Python(s, m_pModule->Get_Parameters(i));
+	}
 
-		//-------------------------------------------------
-		s	+= "\n";
-		s	+= "    if Module.Execute() == 0:\n";
-		s	+= "        print 'Module execution failed!'\n";
-		s	+= "        return 0\n";
-		s	+= "\n";
-		s	+= "    print\n";
-		s	+= "    print 'The module has been executed.'\n";
-		s	+= "    print 'Now you would like to save your output datasets, please edit the script to do so.'\n";
-		s	+= "    return 0                           # remove this line once you have edited the script\n";
-		s	+= "\n";
-		s	+= "    # ------------------------------------\n";
-		s	+= "    # save results\n";
-		s	+= "    path   = os.path.split(fDEM)[0]\n";
-		s	+= "    if path == '':\n";
-		s	+= "        path = './'\n";
-		s	+= "    outgrid.Save(saga_api.CSG_String(path + '/outgrid'))\n";
-		s	+= "\n";
-		s	+= "    print\n";
-		s	+= "    print 'Module successfully executed!'\n";
-		s	+= "    return 1\n";
-		s	+= "\n";
+	//-------------------------------------------------
+	s	+= "\n";
+	s	+= "    if Module.Execute() == 0:\n";
+	s	+= "        print 'Module execution failed!'\n";
+	s	+= "        return 0\n";
+	s	+= "\n";
+	s	+= "    print\n";
+	s	+= "    print 'The module has been executed.'\n";
+	s	+= "    print 'Now you would like to save your output datasets, please edit the script to do so.'\n";
+	s	+= "    return 0                           # remove this line once you have edited the script\n";
+	s	+= "\n";
+	s	+= "    # ------------------------------------\n";
+	s	+= "    # save results\n";
+	s	+= "    path   = os.path.split(fDEM)[0]\n";
+	s	+= "    if path == '':\n";
+	s	+= "        path = './'\n";
+	s	+= "    outgrid.Save(saga_api.CSG_String(path + '/outgrid'))\n";
+	s	+= "\n";
+	s	+= "    print\n";
+	s	+= "    print 'Module successfully executed!'\n";
+	s	+= "    return 1\n";
+	s	+= "\n";
+
+	//-----------------------------------------------------
+	if( bHeader )
+	{
 		s	+= "##########################################\n";
 		s	+= "if __name__ == '__main__':\n";
 		s	+= "    print 'Python - Version ' + sys.version\n";
 		s	+= "    print saga_api.SAGA_API_Get_Version()\n";
 		s	+= "    print\n";
-		s	+= CSG_String::Format("    print 'Usage: %s <in: filename>'\n", FileName.wc_str());
+		s	+= "    print 'Usage: %s <in: filename>'\n";
 		s	+= "    print\n";
 		s	+= "    print 'This is a simple template, please edit the script and add the necessary input and output file(s)!'\n";
 		s	+= "    print 'We will exit the script for now.'\n";
@@ -712,12 +716,77 @@ void CWKSP_Module::_Save_to_Script(void)
 	//	s	+= "            shapes_out.Save(saga_api.CSG_String(sys.argv[4]))\n";
 	}
 
-	//-----------------------------------------------------
-	CSG_File	File;
+	return( s );
+}
+
+
+///////////////////////////////////////////////////////////
+//														 //
+///////////////////////////////////////////////////////////
 
-	if( File.Open(&FileName, SG_FILE_W, false) && s.Length() > 0 )
+//---------------------------------------------------------
+void CWKSP_Module::_Get_XML(CSG_MetaData &Tool, CSG_Parameters *pParameters)
+{
+	for(int iParameter=0; iParameter<pParameters->Get_Count(); iParameter++)
 	{
-		File.Write(s);
+		CSG_Parameter	*p	= pParameters->Get_Parameter(iParameter);
+
+		if( !p->is_Enabled() )
+		{
+			continue;
+		}
+
+		CSG_MetaData	*pChild	= NULL;
+
+		switch( p->Get_Type() )
+		{
+		case PARAMETER_TYPE_Parameters  :
+			_Get_XML(Tool, p->asParameters());
+			break;
+
+		case PARAMETER_TYPE_Bool        :
+		case PARAMETER_TYPE_Int         :
+		case PARAMETER_TYPE_Double      :
+		case PARAMETER_TYPE_Degree      :
+		case PARAMETER_TYPE_Range       :
+		case PARAMETER_TYPE_String      :
+		case PARAMETER_TYPE_Text        :
+		case PARAMETER_TYPE_FilePath    :
+		case PARAMETER_TYPE_Table_Field :
+		case PARAMETER_TYPE_Table_Fields:
+			pChild	= Tool.Add_Child("option", p->asString());
+			break;
+
+		case PARAMETER_TYPE_Choice      :
+			pChild	= Tool.Add_Child("option", p->asInt());
+			break;
+
+		case PARAMETER_TYPE_Grid_System :
+			if( p->Get_Children_Count() == 0 )
+			{
+				pChild	= Tool.Add_Child("option", p->asString());
+			}
+			break;
+
+		default:
+			if( p->is_Input() )
+			{
+				pChild	= Tool.Add_Child("input");
+				pChild->Set_Content(p->is_Optional() ? "input_optional" : "input");
+			}
+			else if( p->is_Output() )
+			{
+				pChild	= Tool.Add_Child("output");
+				pChild->Set_Content("output");
+			}
+			break;
+		}
+
+		if( pChild )
+		{
+			pChild->Add_Property("parms", pParameters->Get_Identifier());
+			pChild->Add_Property("id"   , p          ->Get_Identifier());
+		}
 	}
 }
 
@@ -731,7 +800,7 @@ void CWKSP_Module::_Save_to_Script(void)
 #define GET_ID2(p, s)	CSG_String::Format(SG_T("%s_%s"), GET_ID1(p), s).c_str()
 
 //---------------------------------------------------------
-void CWKSP_Module::_Save_to_Script_CMD(CSG_String &Command, CSG_Parameters *pParameters)
+void CWKSP_Module::_Get_CMD(CSG_String &Command, CSG_Parameters *pParameters)
 {
 	for(int iParameter=0; iParameter<pParameters->Get_Count(); iParameter++)
 	{
@@ -834,7 +903,7 @@ void CWKSP_Module::_Save_to_Script_CMD(CSG_String &Command, CSG_Parameters *pPar
 }
 
 //---------------------------------------------------------
-void CWKSP_Module::_Save_to_Script_Python(CSG_String &Command, CSG_Parameters *pParameters)
+void CWKSP_Module::_Get_Python(CSG_String &Command, CSG_Parameters *pParameters)
 {
 	for(int iParameter=0; iParameter<pParameters->Get_Count(); iParameter++)
 	{
diff --git a/src/saga_core/saga_gui/wksp_module.h b/src/saga_core/saga_gui/wksp_module.h
index 7e894b8..9eea957 100644
--- a/src/saga_core/saga_gui/wksp_module.h
+++ b/src/saga_core/saga_gui/wksp_module.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: wksp_module.h 2301 2014-10-21 08:52:29Z oconrad $
+ * Version $Id: wksp_module.h 2527 2015-06-30 15:38:35Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -105,7 +105,6 @@ public:
 
 	void							Set_Menu_ID			(int Menu_ID);
 	int								Get_Menu_ID			(void)			{	return( m_Menu_ID );	}
-	wxString						Get_Menu_Path		(void);
 
 	wxString						Get_File_Name		(void);
 
@@ -124,11 +123,16 @@ private:
 
 
 	void							_Save_to_Clipboard		(void);
-	void							_Save_to_Clipboard		(CSG_MetaData &Tool, CSG_Parameters *pParameters);
-
 	void							_Save_to_Script			(void);
-	void							_Save_to_Script_CMD		(CSG_String &Command, CSG_Parameters *pParameters);
-	void							_Save_to_Script_Python	(CSG_String &Command, CSG_Parameters *pParameters);
+
+	CSG_String						_Get_XML				(bool bHeader);
+	void							_Get_XML				(CSG_MetaData &Tool, CSG_Parameters *pParameters);
+
+	CSG_String						_Get_CMD				(bool bHeader, int Type = -1);
+	void							_Get_CMD				(CSG_String &Command, CSG_Parameters *pParameters);
+
+	CSG_String						_Get_Python				(bool bHeader);
+	void							_Get_Python				(CSG_String &Command, CSG_Parameters *pParameters);
 
 };
 
diff --git a/src/saga_core/saga_gui/wksp_module_library.cpp b/src/saga_core/saga_gui/wksp_module_library.cpp
index d76d735..dc41995 100644
--- a/src/saga_core/saga_gui/wksp_module_library.cpp
+++ b/src/saga_core/saga_gui/wksp_module_library.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: wksp_module_library.cpp 2281 2014-10-09 15:49:41Z oconrad $
+ * Version $Id: wksp_module_library.cpp 2408 2015-02-16 14:21:06Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -93,6 +93,11 @@ CWKSP_Module_Library::CWKSP_Module_Library(CSG_Module_Library *pLibrary)
 CWKSP_Module_Library::~CWKSP_Module_Library(void)
 {
 	_Del_Modules();
+
+	if( MDI_Get_Frame() )	// don't unload library, if gui is closing (i.e. main window == NULL)
+	{
+		SG_Get_Module_Library_Manager().Del_Library(m_pLibrary);
+	}
 }
 
 
diff --git a/src/saga_core/saga_gui/wksp_module_manager.cpp b/src/saga_core/saga_gui/wksp_module_manager.cpp
index f7ae05a..5c0e289 100644
--- a/src/saga_core/saga_gui/wksp_module_manager.cpp
+++ b/src/saga_core/saga_gui/wksp_module_manager.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: wksp_module_manager.cpp 2281 2014-10-09 15:49:41Z oconrad $
+ * Version $Id: wksp_module_manager.cpp 2496 2015-05-21 14:16:21Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -162,13 +162,13 @@ CWKSP_Module_Manager::CWKSP_Module_Manager(void)
 
 	m_Parameters.Add_Value(
 		pNode	, "LNG_OLDSTYLE"	, _TL("Old Style Namings"),
-		_TL("Use old style namings (e.g. 'modules' instead of 'tools'). Ignored if translation file is used. You need to restart SAGA to apply changes."),
+		_TL("Use old style namings (e.g. 'modules' instead of 'tools'). Ignored if translation file is used. You need to restart SAGA to apply the changes."),
 		PARAMETER_TYPE_Bool, false
 	);
 
 	m_Parameters.Add_FilePath(
 		pNode	, "LNG_FILE_DIC"	, _TL("Language Translations"),
-		_TL("Dictionary for translations from built-in (English) to local language (editable text table). You need to restart SAGA to apply changes."),
+		_TL("Dictionary for translations from built-in (English) to local language (editable text table). You need to restart SAGA to apply the changes."),
 		CSG_String::Format(SG_T("%s|*.lng|%s|*.txt|%s|*.*"),
 			_TL("Dictionary Files (*.lng)"),
 			_TL("Text Table (*.txt)"),
@@ -178,7 +178,7 @@ CWKSP_Module_Manager::CWKSP_Module_Manager(void)
 
 	m_Parameters.Add_FilePath(
 		pNode	, "CRS_FILE_SRS"		, _TL("CRS Database"),
-		_TL("Database with Coordinate Reference System (CRS) definitions. You have to restart SAGA to make changes take affect!"),
+		_TL("Database with Coordinate Reference System (CRS) definitions. A restart of SAGA is required to have the changes take effect!"),
 		CSG_String::Format(SG_T("%s|*.srs|%s|*.*"),
 			_TL("Spatial Reference System Files (*.srs)"),
 			_TL("All Files")
@@ -187,12 +187,21 @@ CWKSP_Module_Manager::CWKSP_Module_Manager(void)
 
 	m_Parameters.Add_FilePath(
 		pNode	, "CRS_FILE_DIC"		, _TL("CRS Dictionary"),
-		_TL("Dictionary for Proj.4/OGC WKT translations. You have to restart SAGA to make changes take affect!"),
+		_TL("Dictionary for Proj.4/OGC WKT translations. A restart of SAGA is required to have the changes take effect!"),
 		CSG_String::Format(SG_T("%s|*.dic|%s|*.*"),
 			_TL("Dictionary Files (*.dic)"),
 			_TL("All Files")
 		)
 	);
+
+	m_Parameters.Add_FilePath(
+		pNode	, "TOOL_MENUS"			, _TL("User defined tool menus"),
+		_TL("User defined tool menus."),
+		CSG_String::Format(SG_T("%s|*.xml|%s|*.*"),
+			_TL("XML Files (*.xml)"),
+			_TL("All Files")
+		)
+	);
 }
 
 //---------------------------------------------------------
@@ -230,6 +239,13 @@ bool CWKSP_Module_Manager::Initialise(void)
 
 	for(int i=0; CONFIG_Read(CFG_LIBS, wxString::Format(CFG_LIBF, i), Library); i++)
 	{
+		if( !wxFileExists(Library) )
+		{
+			wxFileName	fn(Library);	fn.MakeAbsolute(g_pSAGA->Get_App_Path());
+
+			Library	= fn.GetFullPath();
+		}
+
 		SG_Get_Module_Library_Manager().Add_Library(Library);
 	}
 
@@ -444,6 +460,8 @@ void CWKSP_Module_Manager::Parameters_Changed(void)
 #ifdef _OPENMP
 	SG_Set_Max_Num_Threads_Omp(m_Parameters("OMP_THREADS_MAX")->asInt());
 #endif
+
+	m_pMenu_Modules->Update();
 }
 
 //---------------------------------------------------------
@@ -493,20 +511,16 @@ CWKSP_Module_Library * CWKSP_Module_Manager::Get_Library(CSG_Module_Library *pLi
 //---------------------------------------------------------
 bool CWKSP_Module_Manager::_Update(bool bSyncToCtrl)
 {
-//	Get_Control()->Freeze();
-
-	for(int i=SG_Get_Module_Library_Manager().Get_Count()-1; i>=0; i--)
+	if( !bSyncToCtrl )
 	{
-		CSG_Module_Library	*pLibrary	= SG_Get_Module_Library_Manager().Get_Library(i);
-		CWKSP_Module_Library	*pItem	= Get_Library(pLibrary);
+	//	Get_Control()->Freeze();
 
-		if( !pItem )
+		for(int i=SG_Get_Module_Library_Manager().Get_Count()-1; i>=0; i--)
 		{
-			if( bSyncToCtrl )
-			{
-				SG_Get_Module_Library_Manager().Del_Library(i);
-			}
-			else
+			CSG_Module_Library	*pLibrary	= SG_Get_Module_Library_Manager().Get_Library(i);
+			CWKSP_Module_Library	*pItem	= Get_Library(pLibrary);
+
+			if( !pItem )
 			{
 				CWKSP_Module_Group	*pGroup	= Get_Group(pLibrary->Get_Category().c_str());
 
@@ -517,14 +531,14 @@ bool CWKSP_Module_Manager::_Update(bool bSyncToCtrl)
 
 				pGroup->Add_Library(pLibrary);
 			}
+			else if( pItem->Get_Library()->Get_Type() == MODULE_CHAINS )
+			{
+				pItem->Update();
+			}
 		}
-		else if( !bSyncToCtrl && pItem->Get_Library()->Get_Type() == MODULE_CHAINS )
-		{
-			pItem->Update();
-		}
-	}
 
-//	Get_Control()->Thaw();
+	//	Get_Control()->Thaw();
+	}
 
 	m_pMenu_Modules->Update();
 
diff --git a/src/saga_core/saga_gui/wksp_module_menu.cpp b/src/saga_core/saga_gui/wksp_module_menu.cpp
index 5d60ece..aa10ae6 100644
--- a/src/saga_core/saga_gui/wksp_module_menu.cpp
+++ b/src/saga_core/saga_gui/wksp_module_menu.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: wksp_module_menu.cpp 2275 2014-10-02 15:48:59Z oconrad $
+ * Version $Id: wksp_module_menu.cpp 2349 2014-12-11 13:42:58Z oconrad $
  *********************************************************/
 	
 ///////////////////////////////////////////////////////////
@@ -60,13 +60,17 @@
 ///////////////////////////////////////////////////////////
 
 //---------------------------------------------------------
+#include <wx/tokenzr.h>
+
+#include "helper.h"
+
 #include "res_commands.h"
 
 #include "wksp_module_manager.h"
 #include "wksp_module_library.h"
 #include "wksp_module_menu.h"
 #include "wksp_module.h"
-#include <wx/tokenzr.h>
+
 
 ///////////////////////////////////////////////////////////
 //														 //
@@ -99,6 +103,14 @@ CWKSP_Menu_Modules::~CWKSP_Menu_Modules(void)
 void CWKSP_Menu_Modules::Update(void)
 {
 	//-----------------------------------------------------
+	CSG_MetaData	User;
+
+	if( !g_pModules->Get_Parameters()->Get_Parameter("TOOL_MENUS") || !User.Load(g_pModules->Get_Parameters()->Get_Parameter("TOOL_MENUS")->asString()) || !User.Cmp_Name("saga_gui_tool_menus") || SG_Compare_Version(User.Get_Property("saga-version"), "2.2.0") < 0 )
+	{
+		User.Destroy();
+	}
+
+	//-----------------------------------------------------
 	int		ID_Menu;
 
 	while( (ID_Menu = m_pMenu->GetMenuItemCount()) > 0 )
@@ -117,30 +129,29 @@ void CWKSP_Menu_Modules::Update(void)
 			{
 				CWKSP_Module_Library	*pLibrary	= g_pModules->Get_Group(iGroup)->Get_Library(iLibrary);
 
-				for(int iModule=0; iModule<pLibrary->Get_Count(); iModule++, ID_Menu++)
-				{
-					CWKSP_Module	*pModule	= pLibrary->Get_Module(iModule);
-					wxMenu			*pSubMenu	= _Get_SubMenu(m_pMenu, pModule->Get_Menu_Path());
-
-					pModule->Set_Menu_ID(ID_Menu);
-
-					size_t	iPos;
+				//-----------------------------------------
+				CSG_MetaData	*pUser	= NULL;
 
-					for(iPos=0; iPos<pSubMenu->GetMenuItemCount(); iPos++)
+				if( User.Get_Children_Count() > 0 )
+				{
+					for(int i=0; i<User.Get_Children_Count() && !pUser; i++)
 					{
-					#if defined(MODULES_MENU_SORT_SIMPLE)
-						if( pSubMenu->FindItemByPosition(iPos)->GetItemLabelText().Cmp(pModule->Get_Name()) > 0 )
-					#else
-						if(	pSubMenu->FindItemByPosition(iPos)->IsSubMenu() == false
-						&&	pSubMenu->FindItemByPosition(iPos)->GetItemLabelText().Cmp(pModule->Get_Name()) > 0 )
-					#endif
+						if( User[i].Cmp_Property("name", pLibrary->Get_Library()->Get_Library_Name()) )
 						{
-							break;
+							pUser	= User(i);
 						}
 					}
+				}
+
+				//-----------------------------------------
+				for(int iModule=0; iModule<pLibrary->Get_Count(); iModule++, ID_Menu++)
+				{
+					pLibrary->Get_Module(iModule)->Set_Menu_ID(ID_Menu);
 
-					pSubMenu->InsertCheckItem(iPos, ID_Menu, pModule->Get_Name(), pModule->Get_Name());
-				//	pSubMenu->AppendCheckItem(ID_Menu, pModule->Get_Name(), pModule->Get_Name());
+					if( User.Get_Children_Count() <= 0 || pUser )	// ignore if have user defined menus but no entries defined for this library...
+					{
+						_Get_SubMenu(pLibrary->Get_Module(iModule), pUser);
+					}
 				}
 			}
 		}
@@ -158,12 +169,45 @@ void CWKSP_Menu_Modules::Update(void)
 }
 
 //---------------------------------------------------------
-wxMenu * CWKSP_Menu_Modules::_Get_SubMenu(wxMenu *pMenu, wxString Menu_Path)
+bool CWKSP_Menu_Modules::_Get_SubMenu(CWKSP_Module *pModule, CSG_MetaData *pUser)
 {
-	wxStringTokenizer	Tk(Menu_Path, SG_T("|"));
+	//-----------------------------------------------------
+	wxString	Menu	= pModule->Get_Module()->Get_MenuPath(true).c_str();
+	wxString	Name	= pModule->Get_Name();
+
+	if( pUser )
+	{
+		bool	bFound	= false;
+
+		for(int i=0; i<pUser->Get_Children_Count() && !bFound; i++)
+		{
+			if( pUser->Get_Child(i)->Cmp_Property("id_or_name", pModule->Get_Module()->Get_ID  ())
+			||  pUser->Get_Child(i)->Cmp_Property("id_or_name", pModule->Get_Module()->Get_Name()) )
+			{
+				Menu	= pUser->Get_Child(i)->Get_Content().c_str();
+
+				if( pUser->Get_Child(i)->Get_Property("name") )
+				{
+					Name	= pUser->Get_Child(i)->Get_Property("name");
+				}
+
+				bFound	= true;
+			}
+		}
+
+		if( !bFound )
+		{
+			return( false );
+		}
+	}
+
+	//-----------------------------------------------------
+	wxStringTokenizer	Tk(Menu, SG_T("|"));
 
 	wxString	SubMenu(Tk.GetNextToken());
 
+	wxMenu	*pMenu	= m_pMenu;
+
 	while( !SubMenu.IsNull() )
 	{
 		wxMenu	*pSubMenu	= _Get_SubMenu_byToken(pMenu, SubMenu);
@@ -188,14 +232,33 @@ wxMenu * CWKSP_Menu_Modules::_Get_SubMenu(wxMenu *pMenu, wxString Menu_Path)
 			}
 
 			pMenu->Insert(iPos, ID_CMD_MODULES_FIRST, SubMenu, pSubMenu);
-		//	pMenu->Append(ID_CMD_MODULES_FIRST, SubMenu, pSubMenu);
+		//	pMenu->Append(      ID_CMD_MODULES_FIRST, SubMenu, pSubMenu);
 		}
 
 		pMenu	= pSubMenu;
 		SubMenu	= Tk.GetNextToken();
 	}
 
-	return( pMenu );
+	//-----------------------------------------------------
+	size_t	iPos;
+
+	for(iPos=0; iPos<pMenu->GetMenuItemCount(); iPos++)
+	{
+	#if defined(MODULES_MENU_SORT_SIMPLE)
+		if( pMenu->FindItemByPosition(iPos)->GetItemLabelText().Cmp(Name) > 0 )
+	#else
+		if(	pMenu->FindItemByPosition(iPos)->IsSubMenu() == false
+		&&	pMenu->FindItemByPosition(iPos)->GetItemLabelText().Cmp(Name) > 0 )
+	#endif
+		{
+			break;
+		}
+	}
+
+	pMenu->InsertCheckItem(iPos, pModule->Get_Menu_ID(), Name, Name);
+//	pMenu->AppendCheckItem(      pModule->Get_Menu_ID(), Name, Name);
+
+	return( true );
 }
 
 //---------------------------------------------------------
diff --git a/src/saga_core/saga_gui/wksp_module_menu.h b/src/saga_core/saga_gui/wksp_module_menu.h
index fea6f92..4d08aeb 100644
--- a/src/saga_core/saga_gui/wksp_module_menu.h
+++ b/src/saga_core/saga_gui/wksp_module_menu.h
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: wksp_module_menu.h 1921 2014-01-09 10:24:11Z oconrad $
+ * Version $Id: wksp_module_menu.h 2349 2014-12-11 13:42:58Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -106,7 +106,7 @@ private:
 
 
 	void						_Update				(wxMenu *pMenu);
-	wxMenu *					_Get_SubMenu		(wxMenu *pMenu, wxString Menu_Path);
+	bool						_Get_SubMenu		(class CWKSP_Module *pModule, class CSG_MetaData *pUser);
 	wxMenu *					_Get_SubMenu_byToken(wxMenu *pMenu, wxString Token);
 	void						_Set_Recent			(wxMenu *pMenu);
 
diff --git a/src/saga_core/saga_gui/wksp_shapes.cpp b/src/saga_core/saga_gui/wksp_shapes.cpp
index fd9ce74..13d630b 100644
--- a/src/saga_core/saga_gui/wksp_shapes.cpp
+++ b/src/saga_core/saga_gui/wksp_shapes.cpp
@@ -1,5 +1,5 @@
 /**********************************************************
- * Version $Id: wksp_shapes.cpp 2331 2014-11-07 12:15:10Z oconrad $
+ * Version $Id: wksp_shapes.cpp 2503 2015-06-12 12:44:14Z oconrad $
  *********************************************************/
 
 ///////////////////////////////////////////////////////////
@@ -503,6 +503,14 @@ void CWKSP_Shapes::On_Parameters_Changed(void)
 	case 3:	m_iColor	= m_Parameters("METRIC_ATTRIB")->asInt();	break;	// CLASSIFY_GRADUATED
 	}
 
+	if( m_Parameters("COLORS_TYPE")->asInt() == 1 )	// CLASSIFY_LUT
+	{
+		TSG_Data_Type	Type	= SG_Data_Type_is_Numeric(Get_Shapes()->Get_Field_Type(m_Parameters("LUT_ATTRIB")->asInt())) ? SG_DATATYPE_Double : SG_DATATYPE_String;
+
+		m_Parameters("LUT")->asTable()->Set_Field_Type(LUT_MIN, Type);
+		m_Parameters("LUT")->asTable()->Set_Field_Type(LUT_MAX, Type);
+	}
+
 	if( m_iColor >= Get_Shapes()->Get_Field_Count() )
 	{
 		m_iColor	= -1;
@@ -572,8 +580,8 @@ int CWKSP_Shapes::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Paramete
 			TSG_Data_Type	Type	= SG_Data_Type_is_Numeric(Get_Shapes()->Get_Field_Type(pParameter->asInt()))
 									? SG_DATATYPE_Double : SG_DATATYPE_String;
 
-			m_Parameters("LUT")->asTable()->Set_Field_Type(LUT_MIN, Type);
-			m_Parameters("LUT")->asTable()->Set_Field_Type(LUT_MAX, Type);
+			pParameters->Get_Parameter("LUT")->asTable()->Set_Field_Type(LUT_MIN, Type);
+			pParameters->Get_Parameter("LUT")->asTable()->Set_Field_Type(LUT_MAX, Type);
 		}
 	}
 
@@ -710,6 +718,8 @@ void CWKSP_Shapes::_LUT_Create(void)
 	}
 
 	//-----------------------------------------------------
+	DataObject_Changed();
+
 	pColors	= Parameters("COLOR" )->asColors();
 	iField	= Parameters("FIELD" )->asInt();
 	Method	= !SG_Data_Type_is_Numeric(Get_Shapes()->Get_Field_Type(iField)) ? 0	// unique values
@@ -841,8 +851,6 @@ void CWKSP_Shapes::_LUT_Create(void)
 	}
 
 	//-----------------------------------------------------
-	DataObject_Changed();
-
 	m_Parameters("COLORS_TYPE")->Set_Value(CLASSIFY_LUT);	// Lookup Table
 	m_Parameters("LUT_ATTRIB" )->Set_Value(iField);
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/saga.git



More information about the Pkg-grass-devel mailing list