Revision: 5936 http://sourceforge.net/p/jump-pilot/code/5936 Author: ma15569 Date: 2018-08-29 05:24:12 +0000 (Wed, 29 Aug 2018) Log Message: ----------- Added OpenKLEM source code to repository
Added Paths: ----------- plug-ins/OpenKLEM/ plug-ins/OpenKLEM/OpenKLEMCore/ plug-ins/OpenKLEM/OpenKLEMCore/dist/ plug-ins/OpenKLEM/OpenKLEMCore/dist/OpenKLEM-20180828-source.zip plug-ins/OpenKLEM/OpenKLEMCore/dist/OpenKLEM-20180828.jar plug-ins/OpenKLEM/OpenKLEMCore/trunk/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/lib/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/lib/jep-2.4.0.jar plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/ChangeLog plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/Log.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/aspect/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/aspect/AspectCalculator.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/aspect/AspectStripe.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/cn/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/cn/CurveNumberCalculator.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/cn/LandUseSoilGroupTuple.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/cn/SoilGroupLandUseTable.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/cn/ValuesRange.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/drainageTime/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/drainageTime/DrainageTimeCalculator.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/drainageTime/DrainageTimeStripe.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/drainageTime/VelocityCalculator.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/exceptions/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/exceptions/NotSpatiallyConsistentGridsException.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/DemFiller.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/DemFillerStripe.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/DemFillerStripe2.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/FlatAreasProcessor.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/FlatAreasProcessor2.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/FlatAreasProcessorStripe.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/flowdir/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/flowdir/BitOps.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/flowdir/FlowDirsCalculator.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/flowdir/FlowDirsStripe.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/grid/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/grid/BasicGrid.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/grid/BooleanBasicGrid.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/grid/ByteBasicGrid.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/grid/DoubleBasicGrid.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/grid/FloatBasicGrid.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/grid/FlowDirBasicGrid.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/grid/GridDestriper.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/grid/GridStriper.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/grid/IntBasicGrid.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/grid/LongBasicGrid.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/hillshade/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/hillshade/HillshadeCalculator.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/hillshade/HillshadeStripe.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/hydrodistance/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/hydrodistance/HydroDistCalculator.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/hydrodistance/HydroDistStripe.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/hydrology/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/hydrology/HydrographGeo.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/hydrology/Hydrology.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/hydrology/UnitHydrograph.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/lspp/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/lspp/Lspp.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/parallel/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/parallel/AbstractStripe.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/parallel/DependencyAbstractStripe.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/parallel/DependencyCalculator.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/parallel/DependencyStripe.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/parallel/ExecutorBuilder.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/parallel/GridClipper.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/parallel/Shifter.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/parallel/UpwardAbstractStripe.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/parallel/Utils.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/parallel2/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/parallel2/AbstractStripe2.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/parallel2/ByteStripeGrid2.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/parallel2/DoubleStripeGrid2.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/parallel2/IntStripeGrid2.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/rastertools/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/rastertools/HistogramCalculator.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/rastertools/RasterAggregator.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/rastertools/RasterAverager.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/rastertools/RasterClipper.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/rastertools/RasterComb.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/rastertools/RasterReclassifier.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/rastertools/Rasterizer.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/rastertools/ReclassTuple.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/rastertools/Utils.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/rastertools/Vectorizer.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/rastertools/classifiers/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/rastertools/classifiers/Autoscale.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/rastertools/classifiers/ClassAlgo.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/routing/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/routing/RoutingTimeAdvancedParameters.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/routing/RoutingTimeCalculator.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/routing/RoutingTimeParameters.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/routing/RoutingTimeStripe.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/slope/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/slope/SlopeCalculator.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/slope/SlopeStripe.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/units/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/units/Angle.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/units/Area.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/units/Length.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/units/Speed.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/units/Time.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/upslopearea/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/upslopearea/UpslopeAreaCalculator.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/upslopearea/UpslopeAreaStripe.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/upslopearea/UpslopeAreaStripeD8.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/upslopearea/UpslopeAreaStripeMF.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/watersheds/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/watersheds/WatershedExtractor.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/watersheds/WatershedStripe.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/gpl_2.rtf plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/it/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/it/geomaticaeambiente/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/it/geomaticaeambiente/klem/ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/it/geomaticaeambiente/klem/BaseflowParams.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/it/geomaticaeambiente/klem/DesignRain.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/it/geomaticaeambiente/klem/DrainageArea.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/it/geomaticaeambiente/klem/FlowModeller.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/it/geomaticaeambiente/klem/FlowModellerWorker.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/it/geomaticaeambiente/klem/Geomorphology.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/it/geomaticaeambiente/klem/Hyetograph.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/it/geomaticaeambiente/klem/HyetographGenerator.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/it/geomaticaeambiente/klem/InitialAbstraction.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/it/geomaticaeambiente/klem/Klem.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/it/geomaticaeambiente/klem/LsppCalculator.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/it/geomaticaeambiente/klem/ParallelFlowModeller.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/it/geomaticaeambiente/klem/RainfallRecession.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/it/geomaticaeambiente/klem/SimulationOutput.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/it/geomaticaeambiente/klem/TimeInterval.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/it/geomaticaeambiente/klem/Utils.java plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/it/geomaticaeambiente/klem/Watershed.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/dist/ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/dist/OpenKLEMOJ-20180828-source.zip plug-ins/OpenKLEM/OpenKLEMOpenJUMP/dist/OpenKLEMOJ-20180828.jar plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/lib/ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/lib/commons-validator-1.4.1.jar plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/lib/java-rdfa-0.4.2.jar plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/lib/jcommon-1.0.14.jar plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/lib/jena-core-2.13.0.jar plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/lib/jena-iri-1.1.2.jar plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/lib/jfreechart-1.0.11.jar plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/lib/odfdom-java-0.8.10-incubating.jar plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/ChangeLog plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/exceptions/ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/exceptions/MessageTypes.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/exceptions/WarningException.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/images/ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/images/ExclamationMark.png plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/images/ExclamationMarkRed.png plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/images/Hydrology_01.png plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/images/OpenKlem.png plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/images/Raster.png plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/images/Raster_01.png plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/images/RoundArrow00.png plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/images/RoundArrow01.png plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/images/Wrench.gif plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/images/add.png plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/images/cog.png plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/images/cross.png plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/images/disk.png plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/images/folder-horizontal-open_16.png plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/images/folder_page.png plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/images/hydrograph.png plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/images/rainbow.png plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/images/weather_cloudy.png plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/images/wrench_orange.png plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/KlemExtension.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/StartPlugIn.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/CurveNumberPlugIn.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/CurveNumberTable.table6 plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/DemFillerPlugIn.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/FlowDirectionPlugIn.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/HydroDistPlugIn.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/HydrologyGroupsPlugin.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/HyetographPlugIn.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/RoutingTimePlugIn.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/SlopeAspectHillshadePlugIn.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/UpslopeAreaPlugIn.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/WatershedPlugIn.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/HydroOutputPanel.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/HydrographGeomorphologicalPlugin.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/HydrographHortonTriangularPlugin.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/HydrographNashPlugin.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/HydrographSCSPlugin.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/HydrographTriangularPlugin.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/klem/ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/klem/AdvancedParamsOutput.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/klem/HydrographKlemPlugin.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/klem/KlemProperties.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/klem/KlemUtils.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/klem/OdsOutput.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/klem/OutputTab.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/klem/OutputTab2.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/klem/ParamsTab.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/klem/SAXParserKlem.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/klem/VetoableSingleSelectionModel.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/klem/WatershedInformation.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/klem/XMLCreatorKlem.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/klem/model.ods plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/AggregateRastersPlugin.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/CutRasterPlugin.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/PolygonsVectorizerPlugIn.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/RasterCombPlugIn.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/RasterConversionsPlugIn.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/RasterConverter.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/RasterHistogramPlugIn.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/RasterizeVectorLayerPlugIn.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/ReclassRasterPlugin.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/setting/ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/setting/OptionPlugIn.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/setting/SetWorkspacePlugin.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/resources/ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/resources/Bundle.properties plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/resources/Bundle_en.properties plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/resources/Bundle_it.properties plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/AboutDialog.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/CommonHydroPanel.form plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/CommonHydroPanel.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/CustomComboBox.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/GUIUtils.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/HelpDialog.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/InitialDialog.form plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/InitialDialog.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/LayerablesList.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/LayersChangedListener.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/MainPanel.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/PersonalChartPanelComponent.form plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/PersonalChartPanelComponent.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/PersonalComponentAbstract.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/PersonalRasterCombPanel.form plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/PersonalRasterCombPanel.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/PersonalTableComponents.form plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/PersonalTableComponents.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/PersonalTreeNode.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/RadioButtonsPanel.form plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/RadioButtonsPanel.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/SubPanel.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/Symbologies.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/TextStyles.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/ui/YourTableCellRenderer1.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/AbstractInputKlemPlugin.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/ActionObject.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/CombinationComponents.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/CommonHydrographData.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/ComponentEntry.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/ComponentsTreeMap.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/FileUtils.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/GeometryUtils.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/Header.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/HydroUtils.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/InitialData.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/PersonalChart.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/PersonalChartHistogram.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/PersonalChartHydrograph.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/PersonalChartHyetograph.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/PersonalChartKlem.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/PersonalRadioButtons.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/PersonalTable.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/PluginGUIComponentsInterface.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/PluginUtils.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/RasterCombinationComponent.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/RasterUtils.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/ShapefileUtils.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/TextUtils.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/ValueRangeGroup.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/WatershedTool.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/utils/gpl_2.txt plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/gpl_2.txt plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/workbench-properties.xml plug-ins/OpenKLEM/doc/ plug-ins/OpenKLEM/doc/README.txt Added: plug-ins/OpenKLEM/OpenKLEMCore/dist/OpenKLEM-20180828-source.zip =================================================================== (Binary files differ) Index: plug-ins/OpenKLEM/OpenKLEMCore/dist/OpenKLEM-20180828-source.zip =================================================================== --- plug-ins/OpenKLEM/OpenKLEMCore/dist/OpenKLEM-20180828-source.zip 2018-08-28 12:49:14 UTC (rev 5935) +++ plug-ins/OpenKLEM/OpenKLEMCore/dist/OpenKLEM-20180828-source.zip 2018-08-29 05:24:12 UTC (rev 5936) Property changes on: plug-ins/OpenKLEM/OpenKLEMCore/dist/OpenKLEM-20180828-source.zip ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: plug-ins/OpenKLEM/OpenKLEMCore/dist/OpenKLEM-20180828.jar =================================================================== (Binary files differ) Index: plug-ins/OpenKLEM/OpenKLEMCore/dist/OpenKLEM-20180828.jar =================================================================== --- plug-ins/OpenKLEM/OpenKLEMCore/dist/OpenKLEM-20180828.jar 2018-08-28 12:49:14 UTC (rev 5935) +++ plug-ins/OpenKLEM/OpenKLEMCore/dist/OpenKLEM-20180828.jar 2018-08-29 05:24:12 UTC (rev 5936) Property changes on: plug-ins/OpenKLEM/OpenKLEMCore/dist/OpenKLEM-20180828.jar ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: plug-ins/OpenKLEM/OpenKLEMCore/trunk/lib/jep-2.4.0.jar =================================================================== (Binary files differ) Index: plug-ins/OpenKLEM/OpenKLEMCore/trunk/lib/jep-2.4.0.jar =================================================================== --- plug-ins/OpenKLEM/OpenKLEMCore/trunk/lib/jep-2.4.0.jar 2018-08-28 12:49:14 UTC (rev 5935) +++ plug-ins/OpenKLEM/OpenKLEMCore/trunk/lib/jep-2.4.0.jar 2018-08-29 05:24:12 UTC (rev 5936) Property changes on: plug-ins/OpenKLEM/OpenKLEMCore/trunk/lib/jep-2.4.0.jar ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/ChangeLog =================================================================== --- plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/ChangeLog (rev 0) +++ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/ChangeLog 2018-08-29 05:24:12 UTC (rev 5936) @@ -0,0 +1,15 @@ +# NOTE: <Adopted from OpenJUMP ChangeLog file> +# 1. for display continuity sake please use 2 spaces instead of tabs +# 2. make sure that lines break at 80 chars for constricted display situations +#<-------------------------------- 80 chars ----------------------------------># + +2018-13-07 Giuseppe Aruta + * Class: com.geomaticaeambiente.openjump.klem.slope.SlopeStripe + Added radians output + +2018-07-26 Giuseppe Aruta. Ricompiled the libraries: + * Enabled project specific setting on Project/Java compiler/Error-Warning + to deactivated some warning on compiling + * Delate class it.geomaticaambiente.klem.klemDA as creating error on compiling + + Added: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/Log.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/Log.java (rev 0) +++ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/Log.java 2018-08-29 05:24:12 UTC (rev 5936) @@ -0,0 +1,7 @@ +package com.geomaticaeambiente.openjump.klem; + +public class Log { + + public static boolean log = true; + +} \ No newline at end of file Property changes on: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/Log.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/aspect/AspectCalculator.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/aspect/AspectCalculator.java (rev 0) +++ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/aspect/AspectCalculator.java 2018-08-29 05:24:12 UTC (rev 5936) @@ -0,0 +1,155 @@ +package com.geomaticaeambiente.openjump.klem.aspect; + +import com.geomaticaeambiente.openjump.klem.grid.DoubleBasicGrid; +import com.geomaticaeambiente.openjump.klem.grid.GridDestriper; +import com.geomaticaeambiente.openjump.klem.grid.GridStriper; +import com.geomaticaeambiente.openjump.klem.parallel.ExecutorBuilder; +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.Envelope; +import com.vividsolutions.jts.geom.LineString; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; + +/** + * + * @author AdL + */ +public class AspectCalculator { + + /** + * Calculates the aspect + * @param demGrid + * @param bluelines Optional + * @param bluelinesWeight Optional + */ + public AspectCalculator(DoubleBasicGrid demGrid, LineString[] bluelines, + Double bluelinesWeight) { + this.demGrid = demGrid; + this.bluelinesLineStrings = bluelines; + this.bluelinesWeight = bluelinesWeight; + } + + /** + * Calculates the aspect (in radians). + * @return The aspect (radians). + * @throws InterruptedException + * @throws ExecutionException + * @throws IOException + */ + public DoubleBasicGrid calculate() throws InterruptedException, ExecutionException, IOException { + + int rowCount = demGrid.getRowCount(); + ExecutorBuilder execBuilder = new ExecutorBuilder(rowCount); + int stripeRowCount = execBuilder.getRowPerStripeCount(); + int stripeCount = execBuilder.getStripeCount(); + + List<Callable<DoubleBasicGrid>> asepectToDos_l = new ArrayList<Callable<DoubleBasicGrid>>(); + + DoubleBasicGrid[] demStripes = GridStriper.stripeDoubleGrid(demGrid, stripeRowCount); + + /* Rasterize bluelines */ + boolean[][] bluelines = null; + if(bluelinesLineStrings != null && bluelinesLineStrings.length != 0) { + Envelope bluelinesEnvelope = new Envelope(); + for(LineString lineString : bluelinesLineStrings) { + bluelinesEnvelope.expandToInclude(lineString.getEnvelopeInternal()); + } + + bluelines = rasterize(bluelinesLineStrings, + demGrid.getColumnCount(), demGrid.getRowCount(), + demGrid.getCellSize(), demGrid.getLowerLeftCoord()); + + } + + /* Stripe flow directions */ + for(int s=0; s<stripeCount; s++) { + + int stripeEffectiveRows; + if(s != stripeCount -1) { + stripeEffectiveRows = stripeRowCount; + } else { + stripeEffectiveRows = rowCount - (s * stripeRowCount); + } + + double[] upRow = new double[demGrid.getColumnCount()]; + Arrays.fill(upRow, demGrid.getNoData()); + double[] bottomRow = new double[demGrid.getColumnCount()]; + Arrays.fill(bottomRow, demGrid.getNoData()); + + if(s > 0) { + upRow = Arrays.copyOf( + demGrid.getData()[s*stripeRowCount-1], demGrid.getColumnCount()); + } + + if(s < stripeCount - 1) { + bottomRow = Arrays.copyOf( + demGrid.getData()[s*stripeRowCount+stripeEffectiveRows], demGrid.getColumnCount()); + } + + AspectStripe aspectStripe = new AspectStripe( + demStripes[s], upRow, bottomRow, bluelines, bluelinesWeight); + + asepectToDos_l.add(aspectStripe); + + } + + /* Calculate */ + List<Future<DoubleBasicGrid>> aspectFutures_l = execBuilder.getExecutorService().invokeAll(asepectToDos_l); + List<DoubleBasicGrid> aspectGrids_l = new ArrayList<DoubleBasicGrid>(); + for(Future<DoubleBasicGrid> asepctFuture : aspectFutures_l) { + aspectGrids_l.add(asepctFuture.get()); + } + + return GridDestriper.assembleDoubleStrips(aspectGrids_l); + + } + + public boolean[][] rasterize(LineString[] lineStrings, + int colCount, int rowCount, double cellSize, Coordinate llCorner) { + + int n_step; + + boolean[][] bluelines = new boolean[rowCount][colCount]; + for(int r=0; r<rowCount; r++){ + for(int c=0; c<colCount; c++){ + bluelines[r][c] = false; + } + } + + for(LineString lineString : lineStrings) { + + if(lineString.getCoordinates().length > 1){ + Coordinate coord1 = lineString.getCoordinates()[0]; + for(int p=1; p<lineString.getCoordinates().length; p++){ + Coordinate coord2 = lineString.getCoordinates()[p]; + + n_step = (int)Math.round(Math.max( + Math.abs(coord2.x-coord1.x) / (cellSize/2.0), + Math.max(Math.abs(coord2.y-coord1.y)/(cellSize/2.0), 1.0))); + for(int k=0; k<=n_step; k++){ + double x = coord1.x + k * (coord2.x - coord1.x) / n_step; + double y = coord1.y + k * (coord2.y - coord1.y) / n_step; + int ic = (int)((x - llCorner.x) / cellSize + 0.9999 - 1); + int ir = rowCount - (int)((y - llCorner.y) / cellSize + 0.9999); +// System.out.println(ic + "," + ir); + if (ic > 0 && ic < colCount && ir > 0 && ir < rowCount) { + bluelines[ir][ic] = true; + } + } + coord1 = coord2; + } + } + } + return bluelines; + } + + private final DoubleBasicGrid demGrid; + private final LineString[] bluelinesLineStrings; + private final Double bluelinesWeight; + +} Property changes on: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/aspect/AspectCalculator.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/aspect/AspectStripe.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/aspect/AspectStripe.java (rev 0) +++ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/aspect/AspectStripe.java 2018-08-29 05:24:12 UTC (rev 5936) @@ -0,0 +1,129 @@ +package com.geomaticaeambiente.openjump.klem.aspect; + +import com.geomaticaeambiente.openjump.klem.grid.DoubleBasicGrid; +import com.geomaticaeambiente.openjump.klem.parallel.Shifter; +import java.io.IOException; +import java.util.concurrent.Callable; + +/** + * + * @author AdL + */ +public class AspectStripe implements Callable<DoubleBasicGrid> { + + public AspectStripe(DoubleBasicGrid demStripe, double[] upRow, + double[] bottomRow, boolean[][] bluelinesGrid, Double bluelinesWeight) { + + this.demStripe = demStripe; + this.upRow = upRow; + this.bottomRow = bottomRow; + this.bluelinesGrid = bluelinesGrid; + this.bluelinesWeight = bluelinesWeight; + + } + + @Override + public DoubleBasicGrid call() throws Exception { + return calcAspect(); + } + + private DoubleBasicGrid calcAspect() throws IOException { + + int nRows = demStripe.getRowCount(); + int nCols = demStripe.getColumnCount(); + + DoubleBasicGrid aspectDegsGrid = new DoubleBasicGrid(new byte[nRows][nCols], + demStripe.getCellSize(), -9999, demStripe.getLowerLeftCoord()); + + for(int row=0; row<nRows; row++) { + for(int col=0; col<nCols; col++) { + + aspectDegsGrid.setValue(col, row, aspectDegsGrid.getNoData()); + + // Bluelines + double[] elev = new double[8]; + for(int i=0; i<8; i++) { + + int c1 = col + Shifter.getColShift(i); + int r1 = row + Shifter.getRowShift(i); + if(c1>=0 && c1<nCols && r1>=0 && r1<nRows) { + if(!demStripe.isNoData(demStripe.getData()[r1][c1])) { + elev[i] = demStripe.getData()[r1][c1]; + } + } else if(c1>=0 && c1<nCols && r1<0) { + if(!demStripe.isNoData(upRow[c1])) { + elev[i] = upRow[c1]; + } + } else if(c1>=0 && c1<nCols && r1==nRows) { + if(!demStripe.isNoData(bottomRow[c1])) { + elev[i] = bottomRow[c1]; + } + } + + if(bluelinesGrid != null) { + if(c1>0 && c1<nCols && r1>0 && r1<nRows && bluelinesGrid[r1][c1]) { + if(elev[i] < demStripe.getData()[row][col] && !demStripe.isNoData(elev[i])) { + elev[i] -= bluelinesWeight; + } + } + } + + } + + if(!demStripe.isNoData(demStripe.getData()[row][col])) { + + // a b c + // d e f + // g h i + + // e = current cell + + double a = elev[3]; + double b = elev[2]; + double c = elev[1]; + double d = elev[4]; + double f = elev[0]; + double g = elev[5]; + double h = elev[6]; + double i = elev[7]; + + if(demStripe.isNoData(a) || demStripe.isNoData(b) || + demStripe.isNoData(c) || demStripe.isNoData(d) || + demStripe.isNoData(f) || demStripe.isNoData(g) || + demStripe.isNoData(h) || demStripe.isNoData(i)) { + + aspectDegsGrid.setValue(col, row, demStripe.getNoData()); + continue; + + } + + double dz_dx = ((c + 2*f + i) - (a + 2*d + g)) / 8; + double dz_dy = ((g + 2*h + i) - (a + 2*b + c)) / 8; + + double aspect = Math.toDegrees(Math.atan2(dz_dy, -dz_dx)); + + if(aspect < 0) { + aspect = 90.0 - aspect; + } else if (aspect > 90.0) { + aspect = 360.0 - aspect + 90.0; + } else { + aspect = 90.0 - aspect; + } + + aspectDegsGrid.setValue(col, row, aspect); + + } + } + } + + return aspectDegsGrid; + + } + + private final DoubleBasicGrid demStripe; + private final double[] upRow; + private final double[] bottomRow; + private final boolean[][] bluelinesGrid; + private final Double bluelinesWeight; + +} Property changes on: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/aspect/AspectStripe.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/cn/CurveNumberCalculator.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/cn/CurveNumberCalculator.java (rev 0) +++ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/cn/CurveNumberCalculator.java 2018-08-29 05:24:12 UTC (rev 5936) @@ -0,0 +1,54 @@ +package com.geomaticaeambiente.openjump.klem.cn; + +import com.geomaticaeambiente.openjump.klem.exceptions.NotSpatiallyConsistentGridsException; +import com.geomaticaeambiente.openjump.klem.grid.DoubleBasicGrid; + +/** + * + * @author AdL + */ +public class CurveNumberCalculator { + + /** + * Calculates the Curve Number grid from land use and hydrological soil + * group grids, with the given reclassification parameters. + * @param landCoverGrid + * @param soilGroupGrid + * @param soilGroupLandUseTable + * @return + * @throws NotSpatiallyConsistentGridsException + */ + public DoubleBasicGrid calculateCn( + DoubleBasicGrid landCoverGrid, DoubleBasicGrid soilGroupGrid, + SoilGroupLandUseTable soilGroupLandUseTable) throws NotSpatiallyConsistentGridsException { + + if(!landCoverGrid.isSpatiallyConsistentWith(soilGroupGrid)) { + throw new NotSpatiallyConsistentGridsException(); + } + + int columnCount = landCoverGrid.getColumnCount(); + int rowCount = landCoverGrid.getRowCount(); + + double[][] cnData = new double[rowCount][columnCount]; + + for (int r=0; r<rowCount; r++) { + for (int c=0; c<columnCount; c++) { + cnData[r][c] = landCoverGrid.getNoData(); + if(!landCoverGrid.isNoData(landCoverGrid.getData()[r][c]) && + !soilGroupGrid.isNoData(soilGroupGrid.getData()[r][c])) { + + cnData[r][c] = soilGroupLandUseTable.getCnValue( + landCoverGrid.getData()[r][c], + soilGroupGrid.getData()[r][c]); + + } + } + } + + return new DoubleBasicGrid( + cnData, landCoverGrid.getCellSize(), + landCoverGrid.getNoData(), landCoverGrid.getLowerLeftCoord()); + + } + +} Property changes on: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/cn/CurveNumberCalculator.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/cn/LandUseSoilGroupTuple.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/cn/LandUseSoilGroupTuple.java (rev 0) +++ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/cn/LandUseSoilGroupTuple.java 2018-08-29 05:24:12 UTC (rev 5936) @@ -0,0 +1,36 @@ +package com.geomaticaeambiente.openjump.klem.cn; + +/** + * + * @author AdL + */ +public class LandUseSoilGroupTuple { + + public LandUseSoilGroupTuple( + ValuesRange landUseRange, + ValuesRange soilGroupRange, + double cnValue) { + + this.landUseRange = landUseRange; + this.soilGroupRange = soilGroupRange; + this.cnValue = cnValue; + + } + + public ValuesRange getLandUseRange() { + return landUseRange; + } + + public ValuesRange getSoilGroupRange() { + return soilGroupRange; + } + + public double getCnValue() { + return cnValue; + } + + private final ValuesRange landUseRange; + private final ValuesRange soilGroupRange; + private final double cnValue; + +} Property changes on: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/cn/LandUseSoilGroupTuple.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/cn/SoilGroupLandUseTable.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/cn/SoilGroupLandUseTable.java (rev 0) +++ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/cn/SoilGroupLandUseTable.java 2018-08-29 05:24:12 UTC (rev 5936) @@ -0,0 +1,43 @@ +package com.geomaticaeambiente.openjump.klem.cn; + +import java.util.ArrayList; +import java.util.List; + +/** + * + * @author AdL + */ +public class SoilGroupLandUseTable { + + + public void addTuple(LandUseSoilGroupTuple landUseSoilGroupTuple) { + + tuples_l.add(landUseSoilGroupTuple); + + } + + public Double getCnValue(double landUseValue, double soilGroupValue) { + + Double cnValue = null; + + for(LandUseSoilGroupTuple tuple : tuples_l) { + if(tuple.getLandUseRange().getMinValue() <= landUseValue && + tuple.getLandUseRange().getMaxValue() >= landUseValue) { + + if(tuple.getSoilGroupRange().getMinValue() >= soilGroupValue && + tuple.getSoilGroupRange().getMaxValue() <= soilGroupValue) { + + return tuple.getCnValue(); + } + } + } + + + return cnValue; + + } + + private final List<LandUseSoilGroupTuple> tuples_l = new ArrayList<LandUseSoilGroupTuple>(); + + +} Property changes on: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/cn/SoilGroupLandUseTable.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/cn/ValuesRange.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/cn/ValuesRange.java (rev 0) +++ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/cn/ValuesRange.java 2018-08-29 05:24:12 UTC (rev 5936) @@ -0,0 +1,25 @@ +package com.geomaticaeambiente.openjump.klem.cn; + +/** + * + * @author AdL + */ +public class ValuesRange { + + public ValuesRange(double minValue, double maxValue) { + this.minValue = minValue; + this.maxValue = maxValue; + } + + public double getMinValue() { + return minValue; + } + + public double getMaxValue() { + return maxValue; + } + + private final double minValue; + private final double maxValue; + +} Property changes on: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/cn/ValuesRange.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/drainageTime/DrainageTimeCalculator.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/drainageTime/DrainageTimeCalculator.java (rev 0) +++ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/drainageTime/DrainageTimeCalculator.java 2018-08-29 05:24:12 UTC (rev 5936) @@ -0,0 +1,149 @@ +package com.geomaticaeambiente.openjump.klem.drainageTime; + +import com.geomaticaeambiente.openjump.klem.Log; +import com.geomaticaeambiente.openjump.klem.grid.ByteBasicGrid; +import com.geomaticaeambiente.openjump.klem.grid.DoubleBasicGrid; +import com.geomaticaeambiente.openjump.klem.grid.FlowDirBasicGrid; +import com.geomaticaeambiente.openjump.klem.parallel.DependencyCalculator; +import com.geomaticaeambiente.openjump.klem.parallel.DependencyStripe; +import com.geomaticaeambiente.openjump.klem.parallel.Utils; +import com.geomaticaeambiente.openjump.klem.parallel.ExecutorBuilder; +import com.geomaticaeambiente.openjump.klem.parallel.GridClipper; +import com.vividsolutions.jts.geom.Coordinate; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.Callable; +import java.util.concurrent.Future; + +/** + * + * @author AdL + */ +public class DrainageTimeCalculator { + + public DoubleBasicGrid calculate(DoubleBasicGrid slopeGrid, FlowDirBasicGrid flowDirsGrid, + Coordinate[] outlets, double maxDrainageTime, VelocityCalculator velCalc) throws Exception { + + if(flowDirsGrid == null) { + throw new Exception ("The flow directions grid cannot be null."); + } + + /* Striping */ + int rowCount = flowDirsGrid.getRowCount(); + ExecutorBuilder execBuilder = new ExecutorBuilder(rowCount); + int stripeRowCount = execBuilder.getRowPerStripeCount(); + int stripeCount = execBuilder.getStripeCount(); + + /* Plug custom outlets */ + if(outlets != null) { + for(int r=0; r<flowDirsGrid.getRowCount(); r++) { + for(int c=0; c<flowDirsGrid.getColumnCount(); c++) { + if(flowDirsGrid.isOutlet(c, r)) { + flowDirsGrid.setNoData(c, r, true); + } + } + } + + for(Coordinate outlet : outlets) { + java.awt.Point outletColRow = Utils.getColRow(outlet, flowDirsGrid); + flowDirsGrid.setOutlet(outletColRow); + } + } + + /* Calculate dependency grid */ + if(Log.log) System.out.println("Calc dependency grid..."); + DependencyCalculator depGridCalculator = new DependencyCalculator( + DependencyStripe.Origin.OUTLET, flowDirsGrid); + ByteBasicGrid dependencyGrid = depGridCalculator.calculate(); + + /* Extract watershed */ + if(Log.log) System.out.println("Extract watershed..."); + double[][] watershedData = new double[flowDirsGrid.getRowCount()][flowDirsGrid.getColumnCount()]; + for(int r=0; r<watershedData.length; r++) { + for(int c=0; c<watershedData[r].length; c++) { + if(flowDirsGrid.isNoData(c, r)) { + watershedData[r][c] = -9; + } + } + } + + /* Striping */ + DrainageTimeStripe[] stripes = new DrainageTimeStripe[stripeCount]; + + for(int s=0; s<stripes.length; s++) { + + int stripeEffectiveRows; + if(s != stripes.length -1) { + stripeEffectiveRows = stripeRowCount; + } else { + stripeEffectiveRows = rowCount - (s * stripeRowCount); + } + + byte[][] dependencyStripe = new byte[stripeEffectiveRows][flowDirsGrid.getColumnCount()]; + + int offset = s * stripeRowCount; + + for(int r=0; r<stripeEffectiveRows; r++) { + dependencyStripe[r] = Arrays.copyOf(dependencyGrid.getData()[r+offset], flowDirsGrid.getColumnCount()); + } + + stripes[s] = new DrainageTimeStripe( + s, slopeGrid, flowDirsGrid, dependencyStripe, + watershedData, offset, maxDrainageTime, velCalc); + + } + + /* Process stripes */ + if(Log.log) System.out.println("Process stripes..."); + boolean terminate = false; + while(!terminate) { + + // This part can be parallelized + List<Callable<Boolean>> todos_l = new ArrayList<Callable<Boolean>>(); + + for(int s=0; s<stripes.length; s++) { + if(Log.log) System.out.println("Processing stripe: " + (s+1)); + todos_l.add(stripes[s]); + } + + List<Future<Boolean>> futures_l = execBuilder.getExecutorService().invokeAll(todos_l); + + /* Swap buffers */ + if(stripes.length == 1) { + break; + } + + terminate = true; + for(int s=0; s<stripes.length-1; s++) { + + byte[] s2above = stripes[s+1].getAboveBuffer(); + byte[] s1below = stripes[s].getBelowBuffer(); + + stripes[s].plugNewBelowBuffer(s2above); + stripes[s+1].plugNewAboveBuffer(s1below); + + if(stripes[s].getQsCount() != 0 || stripes[s+1].getQsCount() != 0) { + terminate = false; + } + + } + + } + + execBuilder.getExecutorService().shutdown(); + + DoubleBasicGrid watershedGrid = new DoubleBasicGrid(watershedData, flowDirsGrid.getCellSize(), + -9, flowDirsGrid.getLowerLeftCoord()); + + /* If only one outlet specified, clip output */ + if(outlets != null && outlets.length == 1) { + if(Log.log) System.out.println("Clipping output..."); + return GridClipper.extractValues(watershedGrid, null); + } + + return watershedGrid; + + } + +} Property changes on: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/drainageTime/DrainageTimeCalculator.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/drainageTime/DrainageTimeStripe.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/drainageTime/DrainageTimeStripe.java (rev 0) +++ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/drainageTime/DrainageTimeStripe.java 2018-08-29 05:24:12 UTC (rev 5936) @@ -0,0 +1,110 @@ +package com.geomaticaeambiente.openjump.klem.drainageTime; + +import com.geomaticaeambiente.openjump.klem.grid.DoubleBasicGrid; +import com.geomaticaeambiente.openjump.klem.grid.FlowDirBasicGrid; +import com.geomaticaeambiente.openjump.klem.parallel.Shifter; +import com.geomaticaeambiente.openjump.klem.parallel.UpwardAbstractStripe; +import java.awt.Point; + +/** + * + * @author AdL + */ +public class DrainageTimeStripe extends UpwardAbstractStripe { + + public DrainageTimeStripe(int id, DoubleBasicGrid slopeGridRads, FlowDirBasicGrid flowDirData, + byte[][] dependencyStripe, double[][] outputData, int yOffset, + double maxDrainageTime, VelocityCalculator velCalc) { + super(id, flowDirData, dependencyStripe, outputData, yOffset); + + this.slopeGridRads = slopeGridRads; + this.maxDrainageTime = maxDrainageTime; + this.orthoDistance = flowDirData.getCellSize(); + this.diagDistance = orthoDistance * Math.sqrt(2); + this.velCalc = velCalc; + + } + + @Override + protected void findQs () { + + for(int r=0; r<stripeNRows; r++) { + for(int c=0; c<stripeNCols; c++) { + if(dependencyStripe[r][c] == 1 && + outputData[r + yOffset][c] == 0) { + Qs_l.add(new java.awt.Point(c, r)); + } + } + } + + } + + @Override + public void process() { + + while(!Qs_l.isEmpty()) { + + java.awt.Point cell = Qs_l.get(Qs_l.size()-1); + + Qs_l.remove(Qs_l.size()-1); + if(flowDirsGrid.isOutlet(cell)) { + outputData[cell.y][cell.x] = -9; + } + + updateCell(cell); + + // Update dependency maps + updateDependencyMaps(cell, 1); + + } + + } + + @Override + public void updateCell(Point cell) { + + java.awt.Point cellGrid = new java.awt.Point(cell.x, cell.y + yOffset); + + int noData = -9; + + if(flowDirsGrid.isOutlet(cellGrid)) { + outputData[cellGrid.y][cellGrid.x] = orthoDistance; + return; + } + + /* Find the sink cell */ + int colShift = Shifter.getColShift(flowDirsGrid.getTarbotonianFlowDirValue(cellGrid)); + int rowShift = Shifter.getRowShift(flowDirsGrid.getTarbotonianFlowDirValue(cellGrid)); + + java.awt.Point sinkCell = new java.awt.Point( + cellGrid.x + colShift, + cellGrid.y + rowShift); + + if(outputData[sinkCell.y][sinkCell.x] == noData) { + outputData[cellGrid.y][cellGrid.x] = noData; + return; + } + + double distance = orthoDistance; + if(sinkCell.x - cellGrid.x != 0 && sinkCell.y - cellGrid.y != 0) { + distance = diagDistance; + } + + double slope = slopeGridRads.getValue(cellGrid); + double cellDrainageTime = distance / velCalc.calcVelocity(slope); + + double drainageTime = outputData[sinkCell.y][sinkCell.x] + cellDrainageTime; + + outputData[cellGrid.y][cellGrid.x] = + drainageTime <= maxDrainageTime ? + outputData[sinkCell.y][sinkCell.x] + cellDrainageTime : noData; + + } + + private final DoubleBasicGrid slopeGridRads; + private final double maxDrainageTime; + private final double orthoDistance; + private final double diagDistance; + private final VelocityCalculator velCalc; + +} Property changes on: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/drainageTime/DrainageTimeStripe.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/drainageTime/VelocityCalculator.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/drainageTime/VelocityCalculator.java (rev 0) +++ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/drainageTime/VelocityCalculator.java 2018-08-29 05:24:12 UTC (rev 5936) @@ -0,0 +1,11 @@ +package com.geomaticaeambiente.openjump.klem.drainageTime; + +/** + * + * @author AdL + */ +public interface VelocityCalculator { + + public abstract double calcVelocity(double slopeRads); + +} Property changes on: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/drainageTime/VelocityCalculator.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/exceptions/NotSpatiallyConsistentGridsException.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/exceptions/NotSpatiallyConsistentGridsException.java (rev 0) +++ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/exceptions/NotSpatiallyConsistentGridsException.java 2018-08-29 05:24:12 UTC (rev 5936) @@ -0,0 +1,9 @@ +package com.geomaticaeambiente.openjump.klem.exceptions; + +/** + * + * @author AdL + */ +public class NotSpatiallyConsistentGridsException extends Exception { + +} Property changes on: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/exceptions/NotSpatiallyConsistentGridsException.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/DemFiller.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/DemFiller.java (rev 0) +++ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/DemFiller.java 2018-08-29 05:24:12 UTC (rev 5936) @@ -0,0 +1,129 @@ +package com.geomaticaeambiente.openjump.klem.fill; + +import com.geomaticaeambiente.openjump.klem.Log; +import com.geomaticaeambiente.openjump.klem.grid.BooleanBasicGrid; +import com.geomaticaeambiente.openjump.klem.grid.DoubleBasicGrid; +import com.geomaticaeambiente.openjump.klem.grid.GridDestriper; +import com.geomaticaeambiente.openjump.klem.grid.GridStriper; +import com.geomaticaeambiente.openjump.klem.parallel.ExecutorBuilder; +import com.geomaticaeambiente.openjump.klem.parallel.Shifter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; + +/** + * + * @author AdL + */ +public class DemFiller { + + public DemFiller(DoubleBasicGrid demGrid) { + this.demGrid = demGrid; + } + + public DoubleBasicGrid calculate() throws InterruptedException, ExecutionException, Exception { + + int rowCount = demGrid.getRowCount(); + ExecutorBuilder execBuilder = new ExecutorBuilder(rowCount); + int stripeRowCount = execBuilder.getRowPerStripeCount(); + int stripeCount = execBuilder.getStripeCount(); + + DoubleBasicGrid[] demGrids = GridStriper.stripeDoubleGrid(demGrid, stripeRowCount); + DemFillerStripe[] demStripes = new DemFillerStripe[stripeCount]; + + /* Create stripes */ + BooleanBasicGrid borderGrid = new BooleanBasicGrid( + new boolean[demGrid.getRowCount()][demGrid.getColumnCount()], + demGrid.getCellSize(), false, demGrid.getLowerLeftCoord()); + + for(int s=0; s<stripeCount; s++) { + + int stripeEffectiveRows; + if(s != stripeCount -1) { + stripeEffectiveRows = stripeRowCount; + } else { + stripeEffectiveRows = rowCount - (s * stripeRowCount); + } + + double[] upRow = new double[demGrid.getColumnCount()]; + Arrays.fill(upRow, demGrid.getNoData()); + double[] bottomRow = new double[demGrid.getColumnCount()]; + Arrays.fill(bottomRow, demGrid.getNoData()); + + if(s > 0) { + upRow = Arrays.copyOf( + demGrid.getData()[s*stripeRowCount-1], demGrid.getColumnCount()); + } + + if(s < stripeCount - 1) { + bottomRow = Arrays.copyOf( + demGrid.getData()[s*stripeRowCount+stripeEffectiveRows], demGrid.getColumnCount()); + } + + DemFillerStripe demFillerStripe = new DemFillerStripe( + s, demGrids[s], s*stripeRowCount, upRow, bottomRow, demGrid, borderGrid); + + demStripes[s] = demFillerStripe; + + } + + /* Process stripes */ + if(Log.log) System.out.println("Process stripes..."); + boolean terminate = false; + + while(!terminate) { + + List<Callable<DoubleBasicGrid>> demFillToDos_l = new ArrayList<Callable<DoubleBasicGrid>>(); + demFillToDos_l.addAll(Arrays.asList(demStripes)); + + List<Future<DoubleBasicGrid>> flowDirFutures_l = execBuilder.getExecutorService().invokeAll(demFillToDos_l); + + terminate = true; + + for (DemFillerStripe demStripe : demStripes) { + if (!demStripe.isTerminated()) { + terminate = false; + } + } + + // Swap buffers + for(int s=0; s<demStripes.length-1; s++) { + + double[] s2above = demStripes[s+1].getAboveBuffer(); + double[] s1below = demStripes[s].getBelowBuffer(); + + demStripes[s].plugNewBelowBuffer(s2above); + demStripes[s+1].plugNewAboveBuffer(s1below); + + } + + if(terminate == true) { + + List<DoubleBasicGrid> demFillGrids_l = new ArrayList<DoubleBasicGrid>(); + for(Future<DoubleBasicGrid> demFillFuture : flowDirFutures_l) { + demFillGrids_l.add(demFillFuture.get()); + } + DoubleBasicGrid filledDem = GridDestriper.assembleDoubleStrips(demFillGrids_l); + return filledDem; + +// // Remove flat areas +// // TODO: parallelise flat area remover +// FlatAreasProcessor2 flatAreasProcessor2 = new FlatAreasProcessor2(); +// return flatAreasProcessor2.process(filledDem); + + + } + + } + + return null; + + } + + private final DoubleBasicGrid demGrid; + + +} Property changes on: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/DemFiller.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/DemFillerStripe.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/DemFillerStripe.java (rev 0) +++ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/DemFillerStripe.java 2018-08-29 05:24:12 UTC (rev 5936) @@ -0,0 +1,324 @@ +package com.geomaticaeambiente.openjump.klem.fill; + +import com.geomaticaeambiente.openjump.klem.Log; +import com.geomaticaeambiente.openjump.klem.grid.BooleanBasicGrid; +import com.geomaticaeambiente.openjump.klem.grid.DoubleBasicGrid; +import com.geomaticaeambiente.openjump.klem.parallel.AbstractStripe; +import com.geomaticaeambiente.openjump.klem.parallel.Shifter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.Callable; + +/** + * + * @author AdL + */ +public class DemFillerStripe extends AbstractStripe implements Callable<DoubleBasicGrid> { + + public DemFillerStripe ( + int stripeId, DoubleBasicGrid demStripe, int yOffset, + double[] aboveBuffer, double[] belowBuffer, + DoubleBasicGrid wholeDem, + BooleanBasicGrid wholeBorder) { + super(stripeId, demStripe, yOffset, aboveBuffer, belowBuffer); + + this.wholeDem = wholeDem; + this.wholeBorder = wholeBorder; + + this.outputGrid = demStripe; + this.aboveBuffer = aboveBuffer; + this.belowBuffer = belowBuffer; + stripeNCols = demStripe.getColumnCount(); + stripeNRows = demStripe.getRowCount(); + + aboveOutBuffer = new double[stripeNCols]; + belowOutBuffer = new double[stripeNCols]; + + gridNRows = wholeDem.getRowCount(); + + } + + @Override + protected void process() { + + /* Initialization is done only once */ + if(initialize) { + /* Initialize output grids */ + outputGrid = new DoubleBasicGrid(new double[stripeNRows][stripeNCols], + outputGrid.getCellSize(), outputGrid.getNoData(), outputGrid.getLowerLeftCoord()); + + for(int r=0; r<stripeNRows; r++) { + Arrays.fill(outputGrid.getData()[r], outputGrid.getNoData()); + } + findBorder(); + findPits(); + + initialize = false; + } + + + terminated = false; + if(!theSwitch) { + if(Log.log) System.out.println(stripeId + " Qs: " + Qs_l.size()); + process(Qs_l, Qs1_l); + } else { + if(Log.log) System.out.println(stripeId + " Qs1: " + Qs1_l.size()); + process(Qs1_l, Qs_l); + } + theSwitch = !theSwitch; + + } + + private void findBorder() { + + // Needs to calcualte border for the buffer too + for (int r=0; r<stripeNRows; r++) { + for (int c=0; c<stripeNCols; c++) { + + if(r+yOffset < 0 || r+yOffset >= gridNRows) { + continue; + } + + boolean border = false; + double dValue; + + if(!wholeDem.isNoData(wholeDem.getData()[r + yOffset][c])) { + for (int i = 0; i < 8; i++) { + + int ic = c + Shifter.getColShift(i); + int ir = r + Shifter.getRowShift(i); + + if(ic < 0 || ic >= stripeNCols || + ir+yOffset < 0 || ir+yOffset >= gridNRows) { + border = true; + break; + } + + dValue = wholeDem.getData()[ir+yOffset][ic]; + + if (wholeDem.isNoData(dValue)) { + border = true; + break; + } + + } + + wholeBorder.getData()[r+yOffset][c] = border; + + if(r == 0) { + outputGrid.getData()[r][c] = border ? wholeDem.getData()[r+yOffset][c] : Double.MAX_VALUE; + aboveOutBuffer[c] = border ? aboveBuffer[c] : Double.MAX_VALUE; + } else if(r == stripeNRows-1) { + outputGrid.getData()[r][c] = border ? wholeDem.getData()[r+yOffset][c] : Double.MAX_VALUE; + belowOutBuffer[c] = border ? belowBuffer[c] : Double.MAX_VALUE; + } else { + outputGrid.getData()[r][c] = border ? wholeDem.getData()[r+yOffset][c] : Double.MAX_VALUE; + } + + } + } + } + + } + + private void findPits() { + + for (int r=0; r<stripeNRows; r++) { + for (int c=0; c<stripeNCols; c++) { + + if(r+yOffset < 0 || r+yOffset >= gridNRows) { + continue; + } + + if(!wholeBorder.getData()[r+yOffset][c]) { + + if(r < 0) { + if(aboveOutBuffer[c] <= wholeDem.getData()[r+yOffset][c]) { + continue; + } + } else if (r >= stripeNRows) { + if(belowOutBuffer[c] <= wholeDem.getData()[r+yOffset][c]) { + continue; + } + } else { + if(outputGrid.getData()[r][c] <= wholeDem.getData()[r+yOffset][c]) { + continue; + } + } + + if(!wholeDem.isNoData(wholeDem.getData()[r+yOffset][c])) { + + double neighbourDouble = Double.MAX_VALUE; + + for(int i=0; i<8; i++) { + int ic = c + Shifter.getColShift(i); + int ir = r + Shifter.getRowShift(i); + + if(ir < 0) { + + if(!wholeDem.isNoData(aboveOutBuffer[ic]) && + aboveOutBuffer[ic] < neighbourDouble) { + + neighbourDouble = aboveOutBuffer[ic]; + } + + } else if(ir >= stripeNRows) { + + if(!wholeDem.isNoData(belowOutBuffer[ic]) && + belowOutBuffer[ic] < neighbourDouble) { + + neighbourDouble = belowOutBuffer[ic]; + } + + } else { + + if(!wholeDem.isNoData(outputGrid.getData()[ir][ic]) && + outputGrid.getData()[ir][ic] < neighbourDouble) { + + neighbourDouble = outputGrid.getData()[ir][ic]; + + } + + } + } + + if(r == 0) { + if(wholeDem.getData()[r+yOffset][c] >= neighbourDouble) { + outputGrid.getData()[r][c] = wholeDem.getData()[r+yOffset][c]; + aboveOutBuffer[c] = wholeDem.getData()[r+yOffset][c]; + } else { + Qs_l.add(new java.awt.Point(c, r)); + outputGrid.getData()[r][c] = neighbourDouble; + aboveOutBuffer[c] = neighbourDouble; + } + } else if(r == stripeNRows-1) { + if(wholeDem.getData()[r+yOffset][c] >= neighbourDouble) { + outputGrid.getData()[r][c] = wholeDem.getData()[r+yOffset][c]; + belowOutBuffer[c] = wholeDem.getData()[r+yOffset][c]; + } else { + Qs_l.add(new java.awt.Point(c, r)); + outputGrid.getData()[r][c] = neighbourDouble; + belowOutBuffer[c] = neighbourDouble; + } + } else { + if(wholeDem.getData()[r+yOffset][c] >= neighbourDouble) { + outputGrid.getData()[r][c] = wholeDem.getData()[r+yOffset][c]; + } else { + Qs_l.add(new java.awt.Point(c, r)); + outputGrid.getData()[r][c] = neighbourDouble; + } + } + } + + } + } + } + + } + + private void process(List<java.awt.Point> fromCue, List<java.awt.Point> toCue) { + + terminated = true; + while(!fromCue.isEmpty()) { + + java.awt.Point cell = fromCue.get(fromCue.size()-1); + fromCue.remove(fromCue.size()-1); + + double neighbourDouble = Double.MAX_VALUE; + + int r = cell.y; + int c = cell.x; + + for(int i=0; i<8; i++) { + int ic = c + Shifter.getColShift(i); + int ir = r + Shifter.getRowShift(i); + + if(ic < 0 || ic >= stripeNCols) { + continue; + } + + if(ir < 0) { + if(!wholeDem.isNoData(aboveOutBuffer[ic]) && + aboveOutBuffer[ic] < neighbourDouble) { + neighbourDouble = aboveOutBuffer[ic]; + } + } else if (ir == stripeNRows) { + if(!wholeDem.isNoData(belowOutBuffer[ic]) && + belowOutBuffer[ic] < neighbourDouble) { + neighbourDouble = belowOutBuffer[ic]; + } + } else { + if(!wholeDem.isNoData(outputGrid.getData()[ir][ic]) && + outputGrid.getData()[ir][ic] < neighbourDouble) { + neighbourDouble = outputGrid.getData()[ir][ic]; + } + } + + } + + if(wholeDem.getData()[r+yOffset][c] >= neighbourDouble) { + outputGrid.getData()[r][c] = wholeDem.getData()[r+yOffset][c]; + terminated = false; + } else { + toCue.add(new java.awt.Point(c, r)); + if(outputGrid.getData()[r][c] > neighbourDouble) { + outputGrid.getData()[r][c] = neighbourDouble; + terminated = false; + } + } + + // Update buffers if on first or last row + if(r==0) { + if(!wholeDem.isNoData(aboveOutBuffer[c])) { + aboveOutBuffer[c] = outputGrid.getData()[r][c]; + } + } else if (r==stripeNRows-1) { + if(!wholeDem.isNoData(belowOutBuffer[c])) { + belowOutBuffer[c] = outputGrid.getData()[r][c]; + } + } + + } + + } + + @Override + public double[] getBelowBuffer() { + return belowOutBuffer; + } + + @Override + public double[] getAboveBuffer() { + return aboveOutBuffer; + } + + @Override + public void plugNewBelowBuffer(double[] newBuffer) { + belowOutBuffer = newBuffer; + } + + @Override + public void plugNewAboveBuffer(double[] newBuffer) { + aboveOutBuffer = newBuffer; + } + + public boolean isTerminated() { + return terminated; + } + + private boolean initialize = true; + + private final DoubleBasicGrid wholeDem; + private final BooleanBasicGrid wholeBorder; + + private final int gridNRows; + + private final List<java.awt.Point> Qs1_l = new ArrayList<java.awt.Point>(); + private boolean terminated = false; + private boolean theSwitch = false; + + private double[] aboveOutBuffer; + private double[] belowOutBuffer; + +} Property changes on: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/DemFillerStripe.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/DemFillerStripe2.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/DemFillerStripe2.java (rev 0) +++ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/DemFillerStripe2.java 2018-08-29 05:24:12 UTC (rev 5936) @@ -0,0 +1,332 @@ +package com.geomaticaeambiente.openjump.klem.fill; + +import com.geomaticaeambiente.openjump.klem.Log; +import com.geomaticaeambiente.openjump.klem.grid.BooleanBasicGrid; +import com.geomaticaeambiente.openjump.klem.grid.DoubleBasicGrid; +import com.geomaticaeambiente.openjump.klem.parallel.AbstractStripe; +import com.geomaticaeambiente.openjump.klem.parallel.Shifter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.Callable; + +/** + * + * @author AdL + */ +public class DemFillerStripe2 extends AbstractStripe implements Callable<DoubleBasicGrid> { + + public DemFillerStripe2 ( + int stripeId, DoubleBasicGrid demStripe, int yOffset, + double[] aboveBuffer, double[] belowBuffer, + DoubleBasicGrid wholeDem, + BooleanBasicGrid wholeBorder) { + super(stripeId, demStripe, yOffset, aboveBuffer, belowBuffer); + + this.wholeDem = wholeDem; + this.wholeBorder = wholeBorder; + + this.outputGrid = demStripe; + this.aboveBuffer = aboveBuffer; + this.belowBuffer = belowBuffer; + stripeNCols = demStripe.getColumnCount(); + stripeNRows = demStripe.getRowCount(); + + aboveOutBuffer = new double[stripeNCols]; + belowOutBuffer = new double[stripeNCols]; + + gridNRows = wholeDem.getRowCount(); + + } + + @Override + protected void process() { + + /* Initialization is done only once */ + if(initialize) { + /* Initialize output grids */ + outputGrid = new DoubleBasicGrid(new double[stripeNRows][stripeNCols], + outputGrid.getCellSize(), outputGrid.getNoData(), outputGrid.getLowerLeftCoord()); + + for(int r=0; r<stripeNRows; r++) { + Arrays.fill(outputGrid.getData()[r], outputGrid.getNoData()); + } + findBorder(); + //findPits(); + + initialize = false; + } + + + terminated = false; + if(!theSwitch) { + if(Log.log) System.out.println(stripeId + " Qs: " + Qs_l.size()); + process(Qs_l, Qs1_l); + } else { + if(Log.log) System.out.println(stripeId + " Qs1: " + Qs1_l.size()); + process(Qs1_l, Qs_l); + } + theSwitch = !theSwitch; + + } + + private void findBorder() { + + // Needs to calcualte border for the buffer too + for (int r=0; r<stripeNRows; r++) { + for (int c=0; c<stripeNCols; c++) { + + if(r+yOffset < 0 || r+yOffset >= gridNRows) { + continue; + } + + boolean border = false; + double dValue; + + if(!wholeDem.isNoData(wholeDem.getData()[r + yOffset][c])) { + for (int i = 0; i < 8; i++) { + + int ic = c + Shifter.getColShift(i); + int ir = r + Shifter.getRowShift(i); + + if(ic < 0 || ic >= stripeNCols || + ir+yOffset < 0 || ir+yOffset >= gridNRows) { + border = true; + break; + } + + dValue = wholeDem.getData()[ir+yOffset][ic]; + + if (wholeDem.isNoData(dValue)) { + border = true; + break; + } + + } + + wholeBorder.getData()[r+yOffset][c] = border; + + if(r == 0) { + outputGrid.getData()[r][c] = border ? wholeDem.getData()[r+yOffset][c] : Double.MAX_VALUE; + aboveOutBuffer[c] = border ? aboveBuffer[c] : Double.MAX_VALUE; + } else if(r == stripeNRows-1) { + outputGrid.getData()[r][c] = border ? wholeDem.getData()[r+yOffset][c] : Double.MAX_VALUE; + belowOutBuffer[c] = border ? belowBuffer[c] : Double.MAX_VALUE; + } else { + outputGrid.getData()[r][c] = border ? wholeDem.getData()[r+yOffset][c] : Double.MAX_VALUE; + } + + } + } + } + + } + + private void findPits() { + + for (int r=0; r<stripeNRows; r++) { + for (int c=0; c<stripeNCols; c++) { + + if(r+yOffset < 0 || r+yOffset >= gridNRows) { + continue; + } + + if(!wholeBorder.getData()[r+yOffset][c]) { + + if(r < 0) { + if(aboveOutBuffer[c] <= wholeDem.getData()[r+yOffset][c]) { + continue; + } + } else if (r >= stripeNRows) { + if(belowOutBuffer[c] <= wholeDem.getData()[r+yOffset][c]) { + continue; + } + } else { + if(outputGrid.getData()[r][c] <= wholeDem.getData()[r+yOffset][c]) { + continue; + } + } + + if(!wholeDem.isNoData(wholeDem.getData()[r+yOffset][c])) { + + double neighbourDouble = Double.MAX_VALUE; + + for(int i=0; i<8; i++) { + int ic = c + Shifter.getColShift(i); + int ir = r + Shifter.getRowShift(i); + + if(ir < 0) { + + if(!wholeDem.isNoData(aboveOutBuffer[ic]) && + aboveOutBuffer[ic] < neighbourDouble) { + + neighbourDouble = aboveOutBuffer[ic]; + } + + } else if(ir >= stripeNRows) { + + if(!wholeDem.isNoData(belowOutBuffer[ic]) && + belowOutBuffer[ic] < neighbourDouble) { + + neighbourDouble = belowOutBuffer[ic]; + } + + } else { + + if(!wholeDem.isNoData(outputGrid.getData()[ir][ic]) && + outputGrid.getData()[ir][ic] < neighbourDouble) { + + neighbourDouble = outputGrid.getData()[ir][ic]; + + } + + } + } + + if(r == 0) { + if(wholeDem.getData()[r+yOffset][c] >= neighbourDouble) { + outputGrid.getData()[r][c] = wholeDem.getData()[r+yOffset][c]; + aboveOutBuffer[c] = wholeDem.getData()[r+yOffset][c]; + } else { + Qs_l.add(new java.awt.Point(c, r)); + outputGrid.getData()[r][c] = neighbourDouble; + aboveOutBuffer[c] = neighbourDouble; + } + } else if(r == stripeNRows-1) { + if(wholeDem.getData()[r+yOffset][c] >= neighbourDouble) { + outputGrid.getData()[r][c] = wholeDem.getData()[r+yOffset][c]; + belowOutBuffer[c] = wholeDem.getData()[r+yOffset][c]; + } else { + Qs_l.add(new java.awt.Point(c, r)); + outputGrid.getData()[r][c] = neighbourDouble; + belowOutBuffer[c] = neighbourDouble; + } + } else { + if(wholeDem.getData()[r+yOffset][c] >= neighbourDouble) { + outputGrid.getData()[r][c] = wholeDem.getData()[r+yOffset][c]; + } else { + Qs_l.add(new java.awt.Point(c, r)); + outputGrid.getData()[r][c] = neighbourDouble; + } + } + } + + } + } + } + + } + + private void process(List<java.awt.Point> fromCue, List<java.awt.Point> toCue) { + + long modified = 0; + + terminated = true; + for(int r=0; r<stripeNRows; r++) { + for(int c=0; c<stripeNCols; c++) { + + if(r+yOffset < 0 || r+yOffset >= gridNRows) { + continue; + } + + if(!wholeBorder.getData()[r+yOffset][c] && + !wholeDem.isNoData(wholeDem.getData()[r+yOffset][c])) { + + double minNeighbour = Double.MAX_VALUE; + + for(int i=0; i<8; i++) { + int ic = c + Shifter.getColShift(i); + int ir = r + Shifter.getRowShift(i); + + if(ir < 0) { + + if(!wholeDem.isNoData(aboveOutBuffer[ic]) && + aboveOutBuffer[ic] < minNeighbour) { + minNeighbour = aboveOutBuffer[ic]; + } + + } else if(ir >= stripeNRows) { + + if(!wholeDem.isNoData(belowOutBuffer[ic]) && + belowOutBuffer[ic] < minNeighbour) { + minNeighbour = belowOutBuffer[ic]; + } + + } else { + + if(!wholeDem.isNoData(outputGrid.getData()[ir][ic]) && + outputGrid.getData()[ir][ic] < minNeighbour) { + minNeighbour = outputGrid.getData()[ir][ic]; + } + } + } + + double outputAnte = outputGrid.getValue(c, r); + if(wholeDem.getData()[r+yOffset][c] >= minNeighbour) { + outputGrid.getData()[r][c] = wholeDem.getData()[r+yOffset][c]; + } else { + outputGrid.getData()[r][c] = minNeighbour; + } + if(outputGrid.getValue(c, r) != outputAnte) { + modified++; + terminated = false; + } + + if(r == 0) { + if(wholeDem.getData()[r+yOffset][c] >= minNeighbour) { + aboveOutBuffer[c] = outputGrid.getData()[r][c]; + } else { + aboveOutBuffer[c] = minNeighbour; + } + } else if(r == stripeNRows-1) { + if(wholeDem.getData()[r+yOffset][c] >= minNeighbour) { + belowOutBuffer[c] = outputGrid.getData()[r][c]; + } else { + belowOutBuffer[c] = minNeighbour; + } + } + } + } + } + + } + + @Override + public double[] getBelowBuffer() { + return belowOutBuffer; + } + + @Override + public double[] getAboveBuffer() { + return aboveOutBuffer; + } + + @Override + public void plugNewBelowBuffer(double[] newBuffer) { + belowOutBuffer = newBuffer; + } + + @Override + public void plugNewAboveBuffer(double[] newBuffer) { + aboveOutBuffer = newBuffer; + } + + public boolean isTerminated() { + return terminated; + } + + private boolean initialize = true; + + private final DoubleBasicGrid wholeDem; + private final BooleanBasicGrid wholeBorder; + + private final int gridNRows; + + private final List<java.awt.Point> Qs1_l = new ArrayList<java.awt.Point>(); + private boolean terminated = false; + private boolean theSwitch = false; + + private double[] aboveOutBuffer; + private double[] belowOutBuffer; + +} Property changes on: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/DemFillerStripe2.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/FlatAreasProcessor.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/FlatAreasProcessor.java (rev 0) +++ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/FlatAreasProcessor.java 2018-08-29 05:24:12 UTC (rev 5936) @@ -0,0 +1,343 @@ +package com.geomaticaeambiente.openjump.klem.fill; + +import com.geomaticaeambiente.openjump.klem.Log; +import com.geomaticaeambiente.openjump.klem.grid.DoubleBasicGrid; +import com.geomaticaeambiente.openjump.klem.grid.FlowDirBasicGrid; +import com.geomaticaeambiente.openjump.klem.grid.IntBasicGrid; +import com.geomaticaeambiente.openjump.klem.parallel.Shifter; +import java.awt.Point; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; + +/** + * + * @author deluca + */ +public class FlatAreasProcessor { + + public Results process(DoubleBasicGrid demGrid, FlowDirBasicGrid flowDirGrid) throws Exception { + + this.demGrid = demGrid; + this.flowDirGrid = flowDirGrid; + + rowCount = demGrid.getRowCount(); + colCount = demGrid.getColumnCount(); + + // 1 - Calculate flow directions + //calcFlowDirs(); + + // 2 - Flat edges + calcFlatEdges(); + + // 3 - Label flats + if(Log.log) System.out.println("Labelling flats"); + labelFlats(); + +// DoubleBasicGrid flatMaskGridDouble = new DoubleBasicGrid(labelsGrid.getData(), labelsGrid.getCellSize(), -9999, labelsGrid.getLowerLeftCoord()); +// if(1==1) return flatMaskGridDouble; + + // 4 - Process away from higer + if(Log.log) System.out.println("Process away from higher"); + awayFromHigher(); + +// DoubleBasicGrid flatMaskGridDouble = new DoubleBasicGrid(flatMaskGrid.getData(), flatMaskGrid.getCellSize(), -9999, flatMaskGrid.getLowerLeftCoord()); +// if(1==1) return flatMaskGridDouble; + + // 5 - Process towards lower + if(Log.log) System.out.println("Process towards lower"); + towardsLower(); + +// DoubleBasicGrid flatMaskGridDouble = new DoubleBasicGrid(flatMaskGrid.getData(), flatMaskGrid.getCellSize(), -9999, flatMaskGrid.getLowerLeftCoord()); +// if(1==1) return flatMaskGridDouble; + + for(int r=0; r<flatMaskGrid.getRowCount(); r++) { + for(int c=0; c<flatMaskGrid.getColumnCount(); c++) { + if(flatMaskGrid.getValue(c, r) == 0) { + flatMaskGrid.setValue(c, r, flatMaskGrid.getNoData()); + } + } + } + + return new Results(flatMaskGrid, labelsGrid); + + } + + private void calcFlatEdges() { + + for(int r=0; r<rowCount; r++) { + for(int c=0; c<colCount; c++) { + + if(!demGrid.isNoData(demGrid.getValue(c, r))) { + + for(int i=0; i<8; i++) { + + int ic = c + Shifter.getColShift(i); + int ir = r + Shifter.getRowShift(i); + + if(!flowDirGrid.belongsToGrid(ic, ir)) { + continue; + } + if(flowDirGrid.isNoData(ic, ir)) { + continue; + } + + if(!flowDirGrid.isOutlet(c, r) + && flowDirGrid.isOutlet(ic, ir) + && demGrid.getValue(c, r) == demGrid.getValue(ic, ir)) { + + lowEdges_l.add(new java.awt.Point(c, r)); + break; + + } else if(flowDirGrid.isOutlet(c, r) + && demGrid.getValue(c, r) < demGrid.getValue(ic, ir)) { + + highEdges_l.add(new java.awt.Point(c, r)); + break; + } + + } + + } + } + } + + } + + private void labelFlats() { + + List<java.awt.Point> toFill = new ArrayList<java.awt.Point>(); + + labelsGrid = new IntBasicGrid(new int[rowCount][colCount], demGrid.getCellSize(), -Integer.MAX_VALUE, demGrid.getLowerLeftCoord()); + + lMax = 0; + for(Point lowEdge : lowEdges_l) { + + lMax++; + + toFill.add(lowEdge); + double E = demGrid.getValue(lowEdge); + while(toFill.size() > 0) { + + Point cCell = toFill.get(toFill.size()-1); + toFill.remove(toFill.size()-1); + + if(!demGrid.belongsToGrid(cCell)) { + continue; + } + + if(demGrid.isNoData(demGrid.getValue(cCell))) { + continue; + } + + if(demGrid.getValue(cCell) != E) { + continue; + } + if(labelsGrid.getValue(cCell) != 0) { + continue; + } + + labelsGrid.setValue(cCell, lMax); + + for(int i=0; i<8; i++) { + + int ic = cCell.x + Shifter.getColShift(i); + int ir = cCell.y + Shifter.getRowShift(i); + + if(!flowDirGrid.belongsToGrid(ic, ir)) { + continue; + } + + if(demGrid.getValue(cCell) != demGrid.getValue(ic, ir)) { + continue; + } + + toFill.add(new java.awt.Point(ic, ir)); + + } + + } + + } + + // Purge highEdges + for(Iterator<Point> it = highEdges_l.iterator(); it.hasNext(); ){ + Point highEdge = it.next(); + if(labelsGrid.getValue(highEdge) == 0) { + it.remove(); + } + } + + + } + + public void awayFromHigher() { + + flatMaskGrid = new DoubleBasicGrid( + new int[rowCount][colCount], demGrid.getCellSize(), -9999, demGrid.getLowerLeftCoord()); + + flatHeight = new int[lMax]; + + int loops = 1; + + List<Point> highEdges2_l = new ArrayList<Point>(); + + boolean somethingToDo = true; + while(somethingToDo) { + + while(highEdges_l.size() > 0) { + + Point cCell = highEdges_l.get(highEdges_l.size()-1); + highEdges_l.remove(highEdges_l.size()-1); + + if(flatMaskGrid.getValue(cCell) > 0) { + continue; + } + + flatMaskGrid.setValue(cCell.x, cCell.y, loops); + flatHeight[labelsGrid.getValue(cCell) - 1] = loops; + + for(int i=0; i<8; i++) { + + int ic = cCell.x + Shifter.getColShift(i); + int ir = cCell.y + Shifter.getRowShift(i); + + if(!flowDirGrid.belongsToGrid(ic, ir)) { + continue; + } + + if(labelsGrid.getValue(ic, ir) == labelsGrid.getValue(cCell) + && flowDirGrid.isOutlet(ic, ir) + && flatMaskGrid.getValue(ic, ir) == 0) { + highEdges2_l.add(new Point(ic, ir)); + } + + } + + } + + // Switch cues + loops++; + highEdges_l = new ArrayList<java.awt.Point>(highEdges2_l); + highEdges2_l.clear(); + if(highEdges_l.isEmpty()) { + somethingToDo = false; + } + + } + + // Reverse gradient values and make flatMask negative + for(int r=0; r<rowCount; r++) { + for(int c=0; c<colCount; c++) { + + if(!flatMaskGrid.isNoData(flatMaskGrid.getValue(c, r)) + && flatMaskGrid.getValue(c, r) > 0) { + flatMaskGrid.setValue(c, r, -(flatHeight[labelsGrid.getValue(c, r) - 1] - flatMaskGrid.getValue(c, r))); + } + + } + } + + + } + + private void towardsLower() { + + // flatMask already negative! + int loops = 1; + + List<Point> lowEdges2_l = new ArrayList<Point>(); + + boolean somethingToDo = true; + while(somethingToDo) { + + while(lowEdges_l.size() > 0) { + + Point cCell = lowEdges_l.get(lowEdges_l.size()-1); + lowEdges_l.remove(lowEdges_l.size()-1); + + if(flatMaskGrid.getValue(cCell) > 0) { + continue; + } + + if(flatMaskGrid.getValue(cCell) < 0) { + flatMaskGrid.setValue(cCell.x, cCell.y,//flatHeight[labelsGrid.getValue(cCell) - 1] + - flatMaskGrid.getValue(cCell) + 2 * loops); + } else { + flatMaskGrid.setValue(cCell.x, cCell.y, 2 * loops); + } + + for(int i=0; i<8; i++) { + + int ic = cCell.x + Shifter.getColShift(i); + int ir = cCell.y + Shifter.getRowShift(i); + + if(!flowDirGrid.belongsToGrid(ic, ir)) { + continue; + } + + if(labelsGrid.getValue(ic, ir) == labelsGrid.getValue(cCell) + && flowDirGrid.isOutlet(ic, ir)) { + lowEdges2_l.add(new Point(ic, ir)); + } + + } + + } + + loops++; + lowEdges_l = new ArrayList<java.awt.Point>(lowEdges2_l); + lowEdges2_l.clear(); + if(lowEdges_l.isEmpty()) { + somethingToDo = false; + } + + } + + + } + + public class Results { + + public Results(DoubleBasicGrid flowDirGrid, IntBasicGrid labelsGrid) { + this.gradientGrid = flowDirGrid; + this.labelsGrid = labelsGrid; + this.flatsCount = lMax; + } + + public DoubleBasicGrid getGradientGrid() { + return gradientGrid; + } + + public IntBasicGrid getLabelsGrid() { + return labelsGrid; + } + + public int getFlatsCount() { + return flatsCount; + } + + private final DoubleBasicGrid gradientGrid; + private final IntBasicGrid labelsGrid; + private final int flatsCount; + + } + + + private int rowCount = 0; + private int colCount = 0; + private int lMax = 0; + + private DoubleBasicGrid demGrid; + private FlowDirBasicGrid flowDirGrid; + private IntBasicGrid labelsGrid; + private DoubleBasicGrid flatMaskGrid; + + private List<java.awt.Point> lowEdges_l = new ArrayList<java.awt.Point>(); + private List<java.awt.Point> highEdges_l = new ArrayList<java.awt.Point>(); + + private int[] flatHeight; + + +} Property changes on: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/FlatAreasProcessor.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/FlatAreasProcessor2.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/FlatAreasProcessor2.java (rev 0) +++ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/FlatAreasProcessor2.java 2018-08-29 05:24:12 UTC (rev 5936) @@ -0,0 +1,461 @@ +package com.geomaticaeambiente.openjump.klem.fill; + +import java.awt.Point; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import com.geomaticaeambiente.openjump.klem.Log; +import com.geomaticaeambiente.openjump.klem.grid.DoubleBasicGrid; +import com.geomaticaeambiente.openjump.klem.grid.IntBasicGrid; +import com.geomaticaeambiente.openjump.klem.parallel.Shifter; + +/** + * + * @author deluca + */ +public class FlatAreasProcessor2 { + + @SuppressWarnings("unused") + public DoubleBasicGrid process(DoubleBasicGrid demGrid) throws Exception { + + inputDemGrid = demGrid; + + rowCount = demGrid.getRowCount(); + colCount = demGrid.getColumnCount(); + + // 1 - Calculate flow directions + calcFlowDirs(); + + // 2 - Flat edges + calcFlatEdges(); + + // 3 - Label flats + if (Log.log) { + System.out.println("Labelling flats"); + } + labelFlats(); + + // DoubleBasicGrid flatMaskGridDouble = new + // DoubleBasicGrid(labelsGrid.getData(), labelsGrid.getCellSize(), + // -9999, labelsGrid.getLowerLeftCoord()); + // if(1==1) return flatMaskGridDouble; + + // 4 - Process away from higer + if (Log.log) { + System.out.println("Process away from higher"); + } + awayFromHigher(); + + // DoubleBasicGrid flatMaskGridDouble = new + // DoubleBasicGrid(flatMaskGrid.getData(), flatMaskGrid.getCellSize(), + // -9999, flatMaskGrid.getLowerLeftCoord()); + // if(1==1) return flatMaskGridDouble; + + // 5 - Process towards lower + if (Log.log) { + System.out.println("Process towards lower"); + } + towardsLower(); + + final DoubleBasicGrid flatMaskGridDouble = new DoubleBasicGrid( + flatMaskGrid.getData(), flatMaskGrid.getCellSize(), -9999, + flatMaskGrid.getLowerLeftCoord()); + if (1 == 1) { + return flatMaskGridDouble; + } + + // 6 - Alter DEM + if (Log.log) { + System.out.println("Alter DEM"); + } + alterDem(); + + return demGrid; + + } + + // TODO: replace with parallel version + private void calcFlowDirs() { + + final int flowDirNoData = -Integer.MAX_VALUE; + + flowDirGrid = new IntBasicGrid(new int[rowCount][colCount], + inputDemGrid.getCellSize(), flowDirNoData, + inputDemGrid.getLowerLeftCoord()); + + for (int r = 0; r < rowCount; r++) { + for (int c = 0; c < colCount; c++) { + + if (inputDemGrid.isNoData(inputDemGrid.getValue(c, r))) { + flowDirGrid.setValue(c, r, flowDirGrid.getNoData()); + } else { + + double eMin = inputDemGrid.getValue(c, r); + int nMin = noFlow; + + for (int i = 0; i < 8; i++) { + + final int ic = c + Shifter.getColShift(i); + final int ir = r + Shifter.getRowShift(i); + + if (!inputDemGrid.belongsToGrid(ic, ir)) { + continue; + } + + if (inputDemGrid.getValue(ic, ir) < eMin) { + eMin = inputDemGrid.getValue(ic, ir); + nMin = i; + } + + } + + flowDirGrid.setValue(c, r, nMin); + + } + + } + } + + } + + private void calcFlatEdges() { + + for (int r = 0; r < rowCount; r++) { + for (int c = 0; c < colCount; c++) { + + if (!flowDirGrid.isNoData(flowDirGrid.getValue(c, r))) { + + for (int i = 0; i < 8; i++) { + + final int ic = c + Shifter.getColShift(i); + final int ir = r + Shifter.getRowShift(i); + + if (!flowDirGrid.belongsToGrid(ic, ir)) { + continue; + } + if (flowDirGrid.isNoData(flowDirGrid.getValue(ic, ir))) { + continue; + } + + if (flowDirGrid.getValue(c, r) != noFlow + && flowDirGrid.getValue(ic, ir) == noFlow + && inputDemGrid.getValue(c, r) == inputDemGrid + .getValue(ic, ir)) { + + lowEdges_l.add(new java.awt.Point(c, r)); + break; + + } else if (flowDirGrid.getValue(c, r) == noFlow + && inputDemGrid.getValue(c, r) < inputDemGrid + .getValue(ic, ir)) { + + highEdges_l.add(new java.awt.Point(c, r)); + break; + } + + } + + } + } + } + + } + + private void labelFlats() { + + final List<java.awt.Point> toFill = new ArrayList<java.awt.Point>(); + + labelsGrid = new IntBasicGrid(new int[rowCount][colCount], + inputDemGrid.getCellSize(), -Integer.MAX_VALUE, + inputDemGrid.getLowerLeftCoord()); + + lMax = 0; + for (final Point lowEdge : lowEdges_l) { + + lMax++; + + toFill.add(lowEdge); + final double E = inputDemGrid.getValue(lowEdge); + while (toFill.size() > 0) { + + final Point cCell = toFill.get(toFill.size() - 1); + toFill.remove(toFill.size() - 1); + + if (!inputDemGrid.belongsToGrid(cCell)) { + continue; + } + + if (inputDemGrid.isNoData(inputDemGrid.getValue(cCell))) { + continue; + } + + if (inputDemGrid.getValue(cCell) != E) { + continue; + } + if (labelsGrid.getValue(cCell) != 0) { + continue; + } + + labelsGrid.setValue(cCell, lMax); + + for (int i = 0; i < 8; i++) { + + final int ic = cCell.x + Shifter.getColShift(i); + final int ir = cCell.y + Shifter.getRowShift(i); + + if (!flowDirGrid.belongsToGrid(ic, ir)) { + continue; + } + + if (inputDemGrid.getValue(cCell) != inputDemGrid.getValue( + ic, ir)) { + continue; + } + + toFill.add(new java.awt.Point(ic, ir)); + + } + + } + + } + + // Purge highEdges + for (final Iterator<Point> it = highEdges_l.iterator(); it.hasNext();) { + final Point highEdge = it.next(); + if (labelsGrid.getValue(highEdge) == 0) { + it.remove(); + } + } + + } + + public void awayFromHigher() { + + flatMaskGrid = new IntBasicGrid(new int[rowCount][colCount], + inputDemGrid.getCellSize(), -Integer.MAX_VALUE, + inputDemGrid.getLowerLeftCoord()); + flatHeight = new int[lMax]; + + int loops = 1; + + final List<Point> highEdges2_l = new ArrayList<Point>(); + + boolean somethingToDo = true; + while (somethingToDo) { + + while (highEdges_l.size() > 0) { + + final Point cCell = highEdges_l.get(highEdges_l.size() - 1); + highEdges_l.remove(highEdges_l.size() - 1); + + if (flatMaskGrid.getValue(cCell) > 0) { + continue; + } + + flatMaskGrid.setValue(cCell, loops); + flatHeight[labelsGrid.getValue(cCell) - 1] = loops; + + for (int i = 0; i < 8; i++) { + + final int ic = cCell.x + Shifter.getColShift(i); + final int ir = cCell.y + Shifter.getRowShift(i); + + if (!flowDirGrid.belongsToGrid(ic, ir)) { + continue; + } + + if (labelsGrid.getValue(ic, ir) == labelsGrid + .getValue(cCell) + && flowDirGrid.getValue(ic, ir) == noFlow + && flatMaskGrid.getValue(ic, ir) == 0) { + highEdges2_l.add(new Point(ic, ir)); + } + + } + + } + + // Switch cues + loops++; + highEdges_l = new ArrayList<java.awt.Point>(highEdges2_l); + highEdges2_l.clear(); + if (highEdges_l.isEmpty()) { + somethingToDo = false; + } + + } + + // Reverse gradient values and make flatMask negative + for (int r = 0; r < rowCount; r++) { + for (int c = 0; c < colCount; c++) { + + if (!flatMaskGrid.isNoData(flatMaskGrid.getValue(c, r)) + && flatMaskGrid.getValue(c, r) > 0) { + flatMaskGrid + .setValue(c, r, -(flatHeight[labelsGrid.getValue(c, + r) - 1] - flatMaskGrid.getValue(c, r))); + } + + } + } + + } + + private void towardsLower() { + + // flatMask already negative! + int loops = 1; + + final List<Point> lowEdges2_l = new ArrayList<Point>(); + + boolean somethingToDo = true; + while (somethingToDo) { + + while (lowEdges_l.size() > 0) { + + final Point cCell = lowEdges_l.get(lowEdges_l.size() - 1); + lowEdges_l.remove(lowEdges_l.size() - 1); + + if (flatMaskGrid.getValue(cCell) > 0) { + continue; + } + + if (flatMaskGrid.getValue(cCell) < 0) { + flatMaskGrid.setValue(cCell, // flatHeight[labelsGrid.getValue(cCell) + // - 1] + -flatMaskGrid.getValue(cCell) + 2 * loops); + } else { + flatMaskGrid.setValue(cCell, 2 * loops); + } + + for (int i = 0; i < 8; i++) { + + final int ic = cCell.x + Shifter.getColShift(i); + final int ir = cCell.y + Shifter.getRowShift(i); + + if (!flowDirGrid.belongsToGrid(ic, ir)) { + continue; + } + + if (labelsGrid.getValue(ic, ir) == labelsGrid + .getValue(cCell) + && flowDirGrid.getValue(ic, ir) == noFlow) { + lowEdges2_l.add(new Point(ic, ir)); + } + + } + + } + + loops++; + lowEdges_l = new ArrayList<java.awt.Point>(lowEdges2_l); + lowEdges2_l.clear(); + if (lowEdges_l.isEmpty()) { + somethingToDo = false; + } + + } + + } + + private void alterDem() throws Exception { + + for (int r = 0; r < rowCount; r++) { + for (int c = 0; c < colCount; c++) { + + if (inputDemGrid.isNoData(inputDemGrid.getValue(c, r)) + || labelsGrid.getValue(c, r) == 0 + || flatMaskGrid.getValue(c, r) == 0) { + continue; + } + + final boolean[] nIsLower = new boolean[8]; + for (int i = 0; i < 8; i++) { + + final int ic = c + Shifter.getColShift(i); + final int ir = r + Shifter.getRowShift(i); + + if (!inputDemGrid.belongsToGrid(ic, ir) + || inputDemGrid.isNoData(inputDemGrid.getValue(ic, + ir)) + || labelsGrid.getValue(c, r) == labelsGrid + .getValue(ic, ir)) { + continue; + } + + if (inputDemGrid.getValue(c, r) > inputDemGrid.getValue(ic, + ir)) { + nIsLower[i] = true; + } + + } + + if (labelsGrid.getValue(c, r) == 8064) { + System.out.println("wait"); + } + + // Correction + for (int j = 0; j < flatMaskGrid.getValue(c, r); j++) { + inputDemGrid.setValue(c, r, Math.nextAfter( + (float) inputDemGrid.getValue(c, r), + Double.MAX_VALUE)); + } + + // Check + for (int i = 0; i < 8; i++) { + + final int ic = c + Shifter.getColShift(i); + final int ir = r + Shifter.getRowShift(i); + + if (!labelsGrid.belongsToGrid(ic, ir)) { + continue; + } + + if (labelsGrid.getValue(ic, ir) == labelsGrid + .getValue(c, r)) { + continue; + } + + if (inputDemGrid.getValue(c, r) > inputDemGrid.getValue(ic, + ir)) { + if (!nIsLower[i]) { + if (Log.log) { + System.out.println("Problem with col " + c + + " row " + r); + } + } + } + + } + + } + } + + } + + public IntBasicGrid getFlowDirGrid() { + return flowDirGrid; + } + + public IntBasicGrid getLabelsGrid() { + return labelsGrid; + } + + private int rowCount = 0; + private int colCount = 0; + private final int noFlow = -1; + private int lMax = 0; + + private DoubleBasicGrid inputDemGrid; + private IntBasicGrid flowDirGrid; + private IntBasicGrid labelsGrid; + private IntBasicGrid flatMaskGrid; + + private List<java.awt.Point> lowEdges_l = new ArrayList<java.awt.Point>(); + private List<java.awt.Point> highEdges_l = new ArrayList<java.awt.Point>(); + + private int[] flatHeight; + +} Property changes on: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/FlatAreasProcessor2.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/FlatAreasProcessorStripe.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/FlatAreasProcessorStripe.java (rev 0) +++ plug-ins/OpenKLEM/OpenKLEMCore/trunk/src/com/geomaticaeambiente/openjump/klem/fill/FlatAreasProcessorStripe.java 2018-08-29 05:24:12 UTC (rev 5936) @@ -0,0 +1,389 @@ +package com.geomaticaeambiente.openjump.klem.fill; + +import com.geomaticaeambiente.openjump.klem.grid.DoubleBasicGrid; +import com.geomaticaeambiente.openjump.klem.grid.IntBasicGrid; +import com.geomaticaeambiente.openjump.klem.parallel.Shifter; +import java.awt.Point; +import java.util.ArrayList; +import java.util.List; +/** + * + * @author AdL + */ +public class FlatAreasProcessorStripe { + + public DoubleBasicGrid process(DoubleBasicGrid filledDem) { + + columnCount = filledDem.getColumnCount(); + rowCount = filledDem.getRowCount(); + + /* 0 - Convert to integer */ + int[][] demIntData = new int[rowCount][columnCount]; + boolean[][] flatsMap = new boolean[rowCount][columnCount]; + + int[][] totalGradient = new int[rowCount][columnCount]; + + // Initialize + for(int r=0; r<rowCount; r++) { + for(int c=0; c<columnCount; c++) { + + if(filledDem.isNoData(filledDem.getValue(c, r))) { + demIntData[r][c] = Integer.MIN_VALUE; + } else { + demIntData[r][c] = (int) Math.round(filledDem.getValue(c, r) * 100) * 1000; + } + totalGradient[r][c] = Integer.MIN_VALUE; + flatsMap[r][c] = false; + + } + } + + IntBasicGrid filledIntDem = new IntBasicGrid(demIntData, + filledDem.getCellSize(), Integer.MIN_VALUE, filledDem.getLowerLeftCoord()); + + /* 1 - Find flat cells */ + List<java.awt.Point> flatCells_l = findFlats(filledIntDem, flatsMap); + + // Find flats outlets and uphill limit + Gradient[] gradients = findOutletsAndInlets(flatCells_l, filledIntDem, flatsMap, 2); + Gradient gradientUpwards = gradients[0]; + Gradient gradientDownwards = gradients[1]; + + /* 2 - Gradient towards lower terrain */ + Gradient gradientUpwards1 = new Gradient(gradientUpwards.getFlatCells_l(), gradientUpwards.getGradient()); + Gradient gradientUpwards2 = null; + + boolean terminated = false; + boolean theSwitch = true; + + while(!terminated) { + + if(theSwitch) { + gradientUpwards2 = processUpwards(filledIntDem, gradientUpwards1, 2); + if(gradientUpwards2.getFlatCells_l().isEmpty()) { + terminated = true; + } + gradientUpwards = gradientUpwards2; + } else { + gradientUpwards1 = processUpwards(filledIntDem, gradientUpwards2, 2); + if(gradientUpwards1.getFlatCells_l().isEmpty()) { + terminated = true; + } + gradientUpwards = gradientUpwards1; + } + theSwitch = !theSwitch; + + } + + /* 3 - Gradient away from lower terrain */ + processDownwards(filledIntDem, gradientDownwards, 2); + + /* 4 - Combine */ + for(int r=0; r<rowCount; r++) { + for(int c=0; c<columnCount; c++) { + if(!filledIntDem.isNoData(gradientUpwards.getGradient()[r][c]) && + !filledIntDem.isNoData(gradientDownwards.getGradient()[r][c])) { + + totalGradient[r][c] = gradientUpwards.getGradient()[r][c] + + gradientDownwards.getGradient()[r][c] - filledIntDem.getValue(c, r); + + } + } + } + + IntBasicGrid totalGradientGrid = new IntBasicGrid(totalGradient, + filledIntDem.getCellSize(), filledIntDem.getNoData(), filledIntDem.getLowerLeftCoord()); + + /* 5 - Find remaining unresolved cells */ + totalGradient = new int[rowCount][columnCount]; + + // Initialize + for(int r=0; r<rowCount; r++) { + for(int c=0; c<columnCount; c++) { + + if(filledDem.isNoData(filledDem.getValue(c, r))) { + demIntData[r][c] = Integer.MIN_VALUE; + } else { + demIntData[r][c] = (int) Math.round(filledDem.getValue(c, r) * 100); + } + + totalGradient[r][c] = Integer.MIN_VALUE; + flatsMap[r][c] = false; @@ Diff output truncated at 100000 characters. @@ ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel