Revision: 5198 http://sourceforge.net/p/jump-pilot/code/5198 Author: ma15569 Date: 2016-11-19 11:21:51 +0000 (Sat, 19 Nov 2016) Log Message: ----------- Added external libraries
Added Paths: ----------- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfo.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfo3DRasterLayer.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoBand.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoBoolean.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoDataObject.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoFilepath.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoFixedTable.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoImageLayer.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoMultipleInput.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoMultipleTableField.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoNumericalValue.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoPoint.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoRasterLayer.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoSelection.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoString.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoTable.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoTableField.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoVectorLayer.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalResults/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalResults/CorrelationGraphCreator.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/AbstractInputFactory.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/AlgorithmsAndResources.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/AnalysisExtent.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/GeoAlgorithm.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/IGeoAlgorithmFilter.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/IInputFactory.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/IMonitorableTask.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/ITaskMonitor.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/LogElement.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/NamedExtent.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/ObjectAndDescription.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/OutputFactory.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/OutputObjectsSet.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/ParametersSet.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/ProcessTask.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/Sextante.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/SextanteLogHandler.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/SilentTaskMonitor.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/dataObjects/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/dataObjects/AbstractRasterLayer.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/dataObjects/AbstractTable.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/dataObjects/AbstractVectorLayer.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/dataObjects/FeatureImpl.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/dataObjects/I3DRasterLayer.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/dataObjects/IDataObject.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/dataObjects/IFeature.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/dataObjects/IFeatureIterator.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/dataObjects/ILayer.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/dataObjects/IRasterLayer.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/dataObjects/IRecord.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/dataObjects/IRecordsetIterator.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/dataObjects/ITable.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/dataObjects/IVectorLayer.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/dataObjects/RecordImpl.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/dataObjects/vectorFilters/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/dataObjects/vectorFilters/BoundingBoxFilter.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/dataObjects/vectorFilters/GenericVectorFilter.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/dataObjects/vectorFilters/IVectorLayerFilter.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/dataObjects/vectorFilters/SelectionFilter.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/dataObjects/vectorFilters/VectorShapeTypeFilter.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/docEngines/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/docEngines/html/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/docEngines/html/HTMLDoc.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/exceptions/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/exceptions/GeoAlgorithmExecutionException.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/exceptions/IncompleteModelException.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/exceptions/IteratorException.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/exceptions/NullParameterAdditionalInfoException.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/exceptions/NullParameterValueException.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/exceptions/OptionalParentParameterException.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/exceptions/RepeatedParameterNameException.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/exceptions/UndefinedParentParameterNameException.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/exceptions/UnsupportedOutputChannelException.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/exceptions/WrongAnalysisExtentException.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/exceptions/WrongInputException.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/exceptions/WrongOutputChannelDataException.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/exceptions/WrongOutputIDException.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/exceptions/WrongParameterIDException.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/exceptions/WrongParameterTypeException.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/exceptions/WrongParameterValueException.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/exceptions/WrongSerializedStringParameterValueException.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/io3d/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/io3d/ASCII3DFileTools.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/io3d/Default3DRasterLayer.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/modeler/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/modeler/elements/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/modeler/elements/IModelElement.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/modeler/elements/ModelElement3DRasterLayer.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/modeler/elements/ModelElementBand.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/modeler/elements/ModelElementBoolean.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/modeler/elements/ModelElementFactory.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/modeler/elements/ModelElementFilepath.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/modeler/elements/ModelElementFixedTable.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/modeler/elements/ModelElementImageLayer.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/modeler/elements/ModelElementInputArray.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/modeler/elements/ModelElementNumericalValue.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/modeler/elements/ModelElementPoint.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/modeler/elements/ModelElementRasterLayer.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/modeler/elements/ModelElementSelection.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/modeler/elements/ModelElementString.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/modeler/elements/ModelElementTable.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/modeler/elements/ModelElementTableField.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/modeler/elements/ModelElementVectorLayer.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/outputs/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/outputs/DatabaseOutputChannel.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/outputs/FileOutputChannel.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/outputs/IOutputChannel.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/outputs/ImageContainer.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/outputs/NullOutputChannel.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/outputs/Output.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/outputs/Output3DRasterLayer.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/outputs/OutputChart.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/outputs/OutputImage.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/outputs/OutputNumericalValue.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/outputs/OutputRasterLayer.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/outputs/OutputTable.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/outputs/OutputText.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/outputs/OutputVectorLayer.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/outputs/OverwriteOutputChannel.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/outputs/StreamOutputChannel.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/parameters/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/parameters/FixedTableModel.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/parameters/Parameter.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/parameters/Parameter3DRasterLayer.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/parameters/ParameterBand.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/parameters/ParameterBoolean.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/parameters/ParameterDataObject.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/parameters/ParameterFilepath.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/parameters/ParameterFixedTable.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/parameters/ParameterImageLayer.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/parameters/ParameterMultipleInput.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/parameters/ParameterMultipleTableField.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/parameters/ParameterNumericalValue.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/parameters/ParameterPoint.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/parameters/ParameterRasterLayer.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/parameters/ParameterSelection.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/parameters/ParameterString.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/parameters/ParameterTable.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/parameters/ParameterTableField.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/parameters/ParameterVectorLayer.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/parameters/RasterLayerAndBand.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/rasterWrappers/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/rasterWrappers/Grid3DCell.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/rasterWrappers/GridCell.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/rasterWrappers/GridWrapper.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/rasterWrappers/GridWrapperInterpolated.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/rasterWrappers/GridWrapperNotInterpolated.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/shapesTools/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/shapesTools/ShapesTools.java plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/i18n/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/i18n/sextante.properties plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/i18n/sextante_es.properties plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/i18n/sextante_fr.properties plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/jaitools/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/jaitools/package.html plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/jaitools/tilecache/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/jaitools/tilecache/package.html plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/jaitools/tiledimage/ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/jaitools/tiledimage/package.html plug-ins/SextantePlugIn/sextante-lib-source/readme_first.txt plug-ins/SextantePlugIn/sextante-lib-source/sextante/lib/ plug-ins/SextantePlugIn/sextante-lib-source/sextante/lib/jcommon-1.0.14.jar plug-ins/SextantePlugIn/sextante-lib-source/sextante/lib/jfreechart-1.0.11.jar plug-ins/SextantePlugIn/sextante-lib-source/sextante/lib/jts-1.12.jar plug-ins/SextantePlugIn/sextante-lib-source/sextante/lib/kxml2.jar plug-ins/SextantePlugIn/sextante-lib-source/sextante_algorithms/lib/ plug-ins/SextantePlugIn/sextante-lib-source/sextante_algorithms/lib/aparapi.jar plug-ins/SextantePlugIn/sextante-lib-source/sextante_algorithms/lib/aparapi_x86_64.dll plug-ins/SextantePlugIn/sextante-lib-source/sextante_algorithms/lib/gishur_core.jar plug-ins/SextantePlugIn/sextante-lib-source/sextante_algorithms/lib/gishur_x.jar plug-ins/SextantePlugIn/sextante-lib-source/sextante_algorithms/lib/trove-0.1.8.jar plug-ins/SextantePlugIn/sextante-lib-source/sextante_algorithms_others/lib/ plug-ins/SextantePlugIn/sextante-lib-source/sextante_algorithms_others/lib/readme.txt plug-ins/SextantePlugIn/sextante-lib-source/sextante_gui/lib/ plug-ins/SextantePlugIn/sextante-lib-source/sextante_gui/lib/TableLayout-bin-jdk1.5-2007-04-21.jar plug-ins/SextantePlugIn/sextante-lib-source/sextante_gui/lib/bsh-2.0b4.jar plug-ins/SextantePlugIn/sextante-lib-source/sextante_gui/lib/japura-1.14.0.jar plug-ins/SextantePlugIn/sextante-lib-source/sextante_gui/lib/jgraph.jar plug-ins/SextantePlugIn/sextante-lib-source/sextante_gui/lib/jna-4.1.0.jar plug-ins/SextantePlugIn/sextante-lib-source/sextante_libMath/lib/ plug-ins/SextantePlugIn/sextante-lib-source/sextante_libMath/lib/Jama-1.0.2.jar plug-ins/SextantePlugIn/sextante-lib-source/sextante_libMath/lib/jep-2.4.0.jar plug-ins/SextantePlugIn/sextante-lib-source/sextante_libMath/lib/trove-0.1.8.jar Added: plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfo.java =================================================================== --- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfo.java (rev 0) +++ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfo.java 2016-11-19 11:21:51 UTC (rev 5198) @@ -0,0 +1,16 @@ +package es.unex.sextante.additionalInfo; + +/** + * Additional information for a {@link es.unex.sextante.parameters.Parameter} in a {@link es.unex.sextante.core.OutputObjectsSet} + * + * This information includes all the necessary elements to fully define the parameter, like a default value, a range of possible + * values, or any other thing needed. + * + * @author Victor Olaya vol...@unex.es + * + */ +public interface AdditionalInfo { + + public String getTextDescription(); + +} Added: plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfo3DRasterLayer.java =================================================================== --- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfo3DRasterLayer.java (rev 0) +++ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfo3DRasterLayer.java 2016-11-19 11:21:51 UTC (rev 5198) @@ -0,0 +1,20 @@ +package es.unex.sextante.additionalInfo; + + +public class AdditionalInfo3DRasterLayer + extends + AdditionalInfoDataObject { + + public AdditionalInfo3DRasterLayer(final boolean bIsMandatory) { + + super(bIsMandatory); + + } + + + public String getTextDescription() { + // TODO Auto-generated method stub + return null; + } + +} Added: plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoBand.java =================================================================== --- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoBand.java (rev 0) +++ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoBand.java 2016-11-19 11:21:51 UTC (rev 5198) @@ -0,0 +1,61 @@ +package es.unex.sextante.additionalInfo; + +/** + * Additional information for a parameter representing a band + * + * @author Victor Olaya vol...@unex.es + * + */ +public class AdditionalInfoBand + implements + AdditionalInfo { + + private String m_sParentParameterName; + + + /** + * Creates a new instance + * + * @param sParentParameterName + * the name of the parent parameter. This should be the name of a parameter representing a layer from which the + * band should be taken + */ + public AdditionalInfoBand(final String sParentParameterName) { + + m_sParentParameterName = sParentParameterName; + + } + + + /** + * Returns the name of the parent parameter + * + * @return the name of the parent parameter + */ + public String getParentParameterName() { + + return m_sParentParameterName; + + } + + + /** + * Sets the name of the parent parameter + * + * @param sParentParameterName + * the name of the parent parameter + */ + public void setParentParameterName(final String sParentParameterName) { + + m_sParentParameterName = sParentParameterName; + + } + + + public String getTextDescription() { + + return "Parent parameter:" + m_sParentParameterName; + + } + +} Added: plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoBoolean.java =================================================================== --- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoBoolean.java (rev 0) +++ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoBoolean.java 2016-11-19 11:21:51 UTC (rev 5198) @@ -0,0 +1,60 @@ +package es.unex.sextante.additionalInfo; + +/** + * Additional information for a parameter representing a boolean value + * + * @author Victor Olaya vol...@unex.es + * + */ +public class AdditionalInfoBoolean + implements + AdditionalInfo { + + private boolean m_bDefaultValue = false; + + + /** + * Creates a new instance + * + * @param bDefault + * the default value of the boolean parameter + */ + public AdditionalInfoBoolean(final boolean bDefault) { + + m_bDefaultValue = bDefault; + + } + + + /** + * Sets a new default value for the associated boolean parameter + * + * @param bDefault + * the new default value + */ + public void setDefaultValue(final boolean bDefault) { + + m_bDefaultValue = bDefault; + + } + + + /** + * Returns the current default value + * + * @return the default value + */ + public boolean getDefaultValue() { + + return m_bDefaultValue; + + } + + + public String getTextDescription() { + + return ""; + + } + +} Added: plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoDataObject.java =================================================================== --- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoDataObject.java (rev 0) +++ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoDataObject.java 2016-11-19 11:21:51 UTC (rev 5198) @@ -0,0 +1,53 @@ +package es.unex.sextante.additionalInfo; + +/** + * Additional information for a parameter representing a data object (layer or table) + * + * @author Victor Olaya vol...@unex.es + * + */ +public abstract class AdditionalInfoDataObject + implements + AdditionalInfo { + + private boolean m_bIsMandatory = false; + + + /** + * Creates a new instance + * + * @param bIsMandatory + * indicates whether the data object is mandatory (is needed to run the algorithm) or not + */ + public AdditionalInfoDataObject(final boolean bIsMandatory) { + + m_bIsMandatory = bIsMandatory; + + } + + + /** + * Sets whether the data object is mandatory or not + * + * @param bIsMandatory + * indicates wheteher the data object is mandatory or not + */ + public void setIsMandatory(final boolean bIsMandatory) { + + m_bIsMandatory = bIsMandatory; + + } + + + /** + * Returns true if the data object is mandatory + * + * @return true if the data object is mandatory + */ + public boolean getIsMandatory() { + + return m_bIsMandatory; + + } + +} Added: plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoFilepath.java =================================================================== --- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoFilepath.java (rev 0) +++ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoFilepath.java 2016-11-19 11:21:51 UTC (rev 5198) @@ -0,0 +1,173 @@ +package es.unex.sextante.additionalInfo; + +/** + * Additional info for a parameter representing a filepath + * + * @author Victor Olaya vol...@unex.es + */ +public class AdditionalInfoFilepath + implements + AdditionalInfo { + + private boolean m_bFolder = false; + private boolean m_bOpenDialog = false; + private boolean m_bIsVoxelData = false; //true if the file is a voxel data file + private String[] m_sExtensions = null; + + + public AdditionalInfoFilepath() {} + + + /** + * + * @param bFolder + * true if the parameter contains a folder and not a file path + * @param bOpenDialog + * true if it is a file to be opened. False if it is a filename to be used to save something. This will define + * the type of file chooser dialog to show. + * @param bIsVoxel + * true if the file is a voxel data file + * @param sExtension + * the allowed extensions extensions + */ + public AdditionalInfoFilepath(final boolean bFolder, + final boolean bOpenDialog, + final boolean bIsVoxel, + final String[] sExtensions) { + + m_bFolder = bFolder; + m_bOpenDialog = bOpenDialog; + m_bIsVoxelData = bIsVoxel; + m_sExtensions = sExtensions; + + } + + + /** + * Returns the extensions that the file must have + * + * @return the file extension + */ + public String[] getExtensions() { + + return m_sExtensions; + + } + + + /** + * Sets a new mandatory extension for the filename + * + * @param sExt + * the new extension + */ + public void setExtensions(final String[] sExt) { + + m_sExtensions = sExt; + + } + + + /** + * Return true if the parameter contains a folder and not a file path + * + * @return whether the paramete contais a folder and not a file path + */ + public boolean isFolder() { + + return m_bFolder; + + } + + + /** + * Sets whether the parameter contains a folder and not a file path + * + * @param folder + */ + public void setIsFolder(final boolean folder) { + + m_bFolder = folder; + + } + + + /** + * Returns whether a open file dialog or a save file dialog should be used to set the value of this parameter + * + * @return whether a open file dialog or a save file dialog should be used to set the value of this parameter + */ + public boolean isOpenDialog() { + + return m_bOpenDialog; + + } + + + /** + * Sets whether a open file dialog or a save file dialog should be used to set the value of this parameter + * + * @param openDialog + * true if a open file dialog should be used + */ + public void setIsOpenDialog(final boolean openDialog) { + + m_bOpenDialog = openDialog; + + } + + + /** + * Sets whether the file is a voxel data file. + * + * @param isVoxelData + * true if it is a voxel data file. + */ + public void setIsVoxelData(final boolean isVoxelData) { + m_bIsVoxelData = isVoxelData; + } + + + /** + * Checks whether the file is a voxel data file. + * + * @return true if it is a voxel data file, false otherwise. + * + */ + public boolean getIsVoxelData() { + return (m_bIsVoxelData); + } + + + public String getTextDescription() { + + final StringBuffer sb = new StringBuffer(); + sb.append("Folder: " + new Boolean(m_bFolder).toString() + "\n"); + String sOpen; + if (m_bOpenDialog) { + sOpen = "Open"; + } + else { + sOpen = "Save"; + } + sb.append("Open/Save: " + sOpen + "\n"); + if (!m_bFolder) { + sb.append("Extensions: "); + for (int i = 0; i < m_sExtensions.length; i++) { + sb.append(m_sExtensions[i]); + if (i < m_sExtensions.length - 1) { + sb.append(","); + } + } + if ( m_bIsVoxelData ) { + sb.append("\n"); + sb.append("(voxel data)"); + } + } + + return sb.toString(); + + } + + +} Added: plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoFixedTable.java =================================================================== --- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoFixedTable.java (rev 0) +++ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoFixedTable.java 2016-11-19 11:21:51 UTC (rev 5198) @@ -0,0 +1,142 @@ +package es.unex.sextante.additionalInfo; + +/** + * Additional info for a parameter representing a fixed table + * + * @author Victor Olaya vol...@unex.es + */ +public class AdditionalInfoFixedTable + implements + AdditionalInfo { + + private boolean m_bIsNumberOfRowsFixed = true; + private int m_iRows = 3; + private String[] m_sCols = { "", "", "" }; + + + /** + * Constructor + * + * @param sCols + * the number of columns + * @param iRows + * the number of rows + * @param bIsNumberOfRowsFixed + * true if the number of rows cannot be modified + */ + public AdditionalInfoFixedTable(final String[] sCols, + final int iRows, + final boolean bIsNumberOfRowsFixed) { + + m_iRows = iRows; + m_sCols = sCols; + m_bIsNumberOfRowsFixed = bIsNumberOfRowsFixed; + } + + + /** + * Returns the number of columns + * + * @return the number of columns + */ + public int getColsCount() { + + return m_sCols.length; + + } + + + /** + * Returns an array with column names + * + * @return the names of the columns + */ + public String[] getCols() { + + return m_sCols; + + } + + + /** + * Sets the name of the columns + * + * @param sCols + * an array with column names + */ + public void setCols(final String[] sCols) { + + m_sCols = sCols; + + } + + + /** + * Returns the number of rows + * + * @return the number of rows + */ + public int getRowsCount() { + + return m_iRows; + + } + + + /** + * Sets the number of rows + * + * @param iRows + * the newn umber of rows + */ + public void setRows(final int iRows) { + + m_iRows = iRows; + + } + + + /** + * Returns whether the number of rows is fixed or not + * + * @return True if the number of rows cannot be modified + */ + public boolean isNumberOfRowsFixed() { + + return m_bIsNumberOfRowsFixed; + + } + + + /** + * Sets whether the number of rows is fixed or not + * + * @param bIsNumberOfRowsFixed + * True if the number of rows cannot be modified + */ + public void setIsNumberOfRowsFixed(final boolean bIsNumberOfRowsFixed) { + + m_bIsNumberOfRowsFixed = bIsNumberOfRowsFixed; + + } + + + public String getTextDescription() { + + final StringBuffer sb = new StringBuffer(); + if (m_bIsNumberOfRowsFixed) { + sb.append("Number of rows: fixed(" + Integer.toString(m_iRows) + ")\n"); + } + else { + sb.append("Number of rows: variable\n"); + } + + sb.append("Cols: |"); + for (final String element : m_sCols) { + sb.append(element + "|"); + } + return sb.toString(); + + } + +} Added: plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoImageLayer.java =================================================================== --- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoImageLayer.java (rev 0) +++ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoImageLayer.java 2016-11-19 11:21:51 UTC (rev 5198) @@ -0,0 +1,21 @@ +package es.unex.sextante.additionalInfo; + +public class AdditionalInfoImageLayer + extends + AdditionalInfoDataObject { + + + + public AdditionalInfoImageLayer(final boolean bIsMandatory) { + + super(bIsMandatory); + + } + + + public String getTextDescription() { + // TODO Auto-generated method stub + return null; + } + +} Added: plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoMultipleInput.java =================================================================== --- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoMultipleInput.java (rev 0) +++ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoMultipleInput.java 2016-11-19 11:21:51 UTC (rev 5198) @@ -0,0 +1,71 @@ +package es.unex.sextante.additionalInfo; + +/** + * Additional information for a parameter representing a multiple input + * + * @author user + * + */ +public class AdditionalInfoMultipleInput + implements + AdditionalInfo { + + //public static final int DATA_TYPE_UNDEFINED = 0; + public static final int DATA_TYPE_RASTER = 1; + public static final int DATA_TYPE_VECTOR_POINT = 2; + public static final int DATA_TYPE_VECTOR_LINE = 3; + public static final int DATA_TYPE_VECTOR_POLYGON = 4; + public static final int DATA_TYPE_VECTOR_ANY = 5; + public static final int DATA_TYPE_TABLE = 6; + public static final int DATA_TYPE_BAND = 7; + public static final int DATA_TYPE_RASTER_3D = 8; + //public static final int DATA_TYPE_FIELD = 9; + + private int m_iDataType = 0; + private boolean m_bIsMandatory = false; + + + public AdditionalInfoMultipleInput(final int iDataType, + final boolean bIsMandatory) { + + m_iDataType = iDataType; + m_bIsMandatory = bIsMandatory; + + } + + + public int getDataType() { + + return m_iDataType; + + } + + + public void setDataType(final int dataType) { + + m_iDataType = dataType; + + } + + + public void setIsMandatory(final boolean bIsMandatory) { + + m_bIsMandatory = bIsMandatory; + + } + + + public boolean getIsMandatory() { + + return m_bIsMandatory; + + } + + + public String getTextDescription() { + // TODO Auto-generated method stub + return null; + } + + +} Added: plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoMultipleTableField.java =================================================================== --- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoMultipleTableField.java (rev 0) +++ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoMultipleTableField.java 2016-11-19 11:21:51 UTC (rev 5198) @@ -0,0 +1,84 @@ + + +package es.unex.sextante.additionalInfo; + +public class AdditionalInfoMultipleTableField + implements + AdditionalInfo { + + private String m_sParentParameterName; + private boolean m_bIsMandatory; + + + /** + * + * @param sParentParameterName + * The name of the parent parameter + * @param bIsMandatory + * specifies whether the field is mandatory or not + */ + public AdditionalInfoMultipleTableField(final String sParentParameterName, + final boolean bIsMandatory) { + + m_sParentParameterName = sParentParameterName; + m_bIsMandatory = bIsMandatory; + + } + + + /** + * Returns the name of the parent parameter + * + * @return the name of the parent parameter + */ + public String getParentParameterName() { + + return m_sParentParameterName; + + } + + + /** + * Sets the name of the parent parameter + * + * @param sParentParameterName + * The name of the parent parameter + */ + public void setParentParameterName(final String sParentParameterName) { + + m_sParentParameterName = sParentParameterName; + + } + + + /** + * Sets whether the field is mandatory or not + * + * @param bIsMandatory + * indicates whether the field is mandatory or not + */ + public void setIsMandatory(final boolean bIsMandatory) { + + m_bIsMandatory = bIsMandatory; + + } + + + /** + * Returns true if the field is mandatory + * + * @return true if the field is mandatory + */ + public boolean getIsMandatory() { + + return m_bIsMandatory; + + } + + + public String getTextDescription() { + // TODO Auto-generated method stub + return null; + } + +} Added: plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoNumericalValue.java =================================================================== --- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoNumericalValue.java (rev 0) +++ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoNumericalValue.java 2016-11-19 11:21:51 UTC (rev 5198) @@ -0,0 +1,165 @@ +package es.unex.sextante.additionalInfo; + +/** + * Additional information for a parameter representing a numerical value + * + * @author volaya + * + */ +public class AdditionalInfoNumericalValue + implements + AdditionalInfo { + + public static final int NUMERICAL_VALUE_INTEGER = 1; + public static final int NUMERICAL_VALUE_DOUBLE = 2; + + private int m_iType; + private double m_dMinValue = Double.NEGATIVE_INFINITY; + private double m_dMaxValue = Double.MAX_VALUE; + private double m_dDefaultValue = Double.MAX_VALUE; + + + /** + * Constructor + * + * @param iType + * the type of numerical value(integer or double) + * @param dDefaultValue + * the default value + * @param dMinValue + * the minimum value allowed for this parameter + * @param dMaxValue + * the maximum value allowed for this parameter + */ + public AdditionalInfoNumericalValue(final int iType, + final double dDefaultValue, + final double dMinValue, + final double dMaxValue) { + + m_iType = iType; + m_dDefaultValue = dDefaultValue; + m_dMaxValue = dMaxValue; + m_dMinValue = dMinValue; + + } + + + /** + * Returns the maximum value allowed for this parameter + * + * @return the maximum value allowed for this parameter + */ + public double getMaxValue() { + + return m_dMaxValue; + + } + + + /** + * Sets the maximum value allowed for this parameter + * + * @param dMaxValue + * the maximum value allowed for this parameter + */ + public void setMaxValue(final double dMaxValue) { + + m_dMaxValue = dMaxValue; + + } + + + /** + * Returns the maximum value allowed for this parameter + * + * @return the maximum value allowed for this parameter + */ + public double getMinValue() { + + return m_dMinValue; + + } + + + /** + * Sets the minimum value allowed for this parameter + * + * @param dMinValue + * the minimum value allowed for this parameter + */ + public void setMinValue(final double dMinValue) { + + m_dMinValue = dMinValue; + + } + + + /** + * Returns the type of numerical value (integer or double) + * + * @return the type of numerical value (integer or double) + */ + public int getType() { + + return m_iType; + + } + + + /** + * Sets the type of numerical value (integer or double) + * + * @param iType + * the type of numerical value (integer or double) + */ + public void setType(final int iType) { + + m_iType = iType; + + } + + + /** + * Returns the default value + * + * @return the default value + */ + public double getDefaultValue() { + + return m_dDefaultValue; + + } + + + /** + * Sets the default value + * + * @param defaultValue + * the default value + */ + public void setDefaultValue(final double defaultValue) { + + m_dDefaultValue = defaultValue; + + } + + + public String getTextDescription() { + + final StringBuffer sb = new StringBuffer(); + if (m_iType == NUMERICAL_VALUE_DOUBLE) { + sb.append("Value type: double\n"); + + } + else { + sb.append("Value type: integer\n"); + } + sb.append("Max value: " + Double.toString(m_dMaxValue) + "\n"); + sb.append("Min value: " + Double.toString(m_dMinValue) + "\n"); + sb.append("Default value: " + Double.toString(m_dDefaultValue) + "\n"); + + return sb.toString(); + + } + +} Added: plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoPoint.java =================================================================== --- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoPoint.java (rev 0) +++ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoPoint.java 2016-11-19 11:21:51 UTC (rev 5198) @@ -0,0 +1,16 @@ +package es.unex.sextante.additionalInfo; + +public class AdditionalInfoPoint + implements + AdditionalInfo { + + public AdditionalInfoPoint() {} + + + public String getTextDescription() { + + return ""; + + } + +} Added: plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoRasterLayer.java =================================================================== --- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoRasterLayer.java (rev 0) +++ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoRasterLayer.java 2016-11-19 11:21:51 UTC (rev 5198) @@ -0,0 +1,19 @@ +package es.unex.sextante.additionalInfo; + +public class AdditionalInfoRasterLayer + extends + AdditionalInfoDataObject { + + + public AdditionalInfoRasterLayer(final boolean bIsMandatory) { + + super(bIsMandatory); + + } + + public String getTextDescription() { + // TODO Auto-generated method stub + return null; + } + +} Added: plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoSelection.java =================================================================== --- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoSelection.java (rev 0) +++ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoSelection.java 2016-11-19 11:21:51 UTC (rev 5198) @@ -0,0 +1,42 @@ +package es.unex.sextante.additionalInfo; + +public class AdditionalInfoSelection +implements +AdditionalInfo { + + private final String[] m_sValues; + private String m_sSelectionPath = ""; + + + public AdditionalInfoSelection(final String[] sValues) { + + m_sValues = sValues; + } + + + public String getSelectionPath() { + + return m_sSelectionPath; + + } + + + public void setSelectionPath(final String sSelectionPath) { + + m_sSelectionPath = sSelectionPath; + + } + + public String[] getValues() { + + return m_sValues; + + } + + + public String getTextDescription() { + // TODO Auto-generated method stub + return null; + } + +} Added: plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoString.java =================================================================== --- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoString.java (rev 0) +++ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoString.java 2016-11-19 11:21:51 UTC (rev 5198) @@ -0,0 +1,50 @@ +package es.unex.sextante.additionalInfo; + +public class AdditionalInfoString + implements + AdditionalInfo { + + private String m_sDefaultString = ""; + + + //set to true if it's an attribute table field name (GRASS) + private boolean m_bIsField = false; + + + public AdditionalInfoString() {} + + + public String getDefaultString() { + + return m_sDefaultString; + + } + + + public void setDefaultString(final String sDefaultString) { + + m_sDefaultString = sDefaultString; + + } + + + public void setIsField(final boolean bIsField) { + + m_bIsField = bIsField; + + } + + + public boolean getIsField() { + + return (m_bIsField); + + } + + + public String getTextDescription() { + // TODO Auto-generated method stub + return null; + } + +} Added: plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoTable.java =================================================================== --- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoTable.java (rev 0) +++ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoTable.java 2016-11-19 11:21:51 UTC (rev 5198) @@ -0,0 +1,19 @@ +package es.unex.sextante.additionalInfo; + +public class AdditionalInfoTable + extends + AdditionalInfoDataObject { + + public AdditionalInfoTable(final boolean bIsMandatory) { + + super(bIsMandatory); + + } + + + public String getTextDescription() { + // TODO Auto-generated method stub + return null; + } + +} Added: plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoTableField.java =================================================================== --- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoTableField.java (rev 0) +++ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoTableField.java 2016-11-19 11:21:51 UTC (rev 5198) @@ -0,0 +1,75 @@ +package es.unex.sextante.additionalInfo; + +public class AdditionalInfoTableField + implements + AdditionalInfo { + + private String m_sParentParameterName; + private boolean m_bIsMandatory; + + + /** + * + * @param sParentParameterName The name of the parent parameter + * @param bIsMandatory specifies whether the field is mandatory or not + */ + public AdditionalInfoTableField(final String sParentParameterName, boolean bIsMandatory) { + + m_sParentParameterName = sParentParameterName; + m_bIsMandatory = bIsMandatory; + + } + + + /** + * Returns the name of the parent parameter + * @return the name of the parent parameter + */ + public String getParentParameterName() { + + return m_sParentParameterName; + + } + + + /** + * Sets the name of the parent parameter + * @param sParentParameterName The name of the parent parameter + */ + public void setParentParameterName(final String sParentParameterName) { + + m_sParentParameterName = sParentParameterName; + + } + + /** + * Sets whether the field is mandatory or not + * + * @param bIsMandatory + * indicates whether the field is mandatory or not + */ + public void setIsMandatory(final boolean bIsMandatory) { + + m_bIsMandatory = bIsMandatory; + + } + + + /** + * Returns true if the field is mandatory + * + * @return true if the field is mandatory + */ + public boolean getIsMandatory() { + + return m_bIsMandatory; + + } + + + public String getTextDescription() { + // TODO Auto-generated method stub + return null; + } + +} Added: plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoVectorLayer.java =================================================================== --- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoVectorLayer.java (rev 0) +++ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalInfo/AdditionalInfoVectorLayer.java 2016-11-19 11:21:51 UTC (rev 5198) @@ -0,0 +1,67 @@ +package es.unex.sextante.additionalInfo; + +public class AdditionalInfoVectorLayer + extends + AdditionalInfoDataObject { + + public static final int SHAPE_TYPE_POINT = 0; + public static final int SHAPE_TYPE_LINE = 1; + public static final int SHAPE_TYPE_POLYGON = 2; + public static final int SHAPE_TYPE_ANY = -1; + + private int m_iShapeType = -1; + //true, if this is a 3D raster (=voxel data) + private boolean m_bIs3d = false; + + + public AdditionalInfoVectorLayer(final int iShapeType, + final boolean bIsMandatory) { + + super(bIsMandatory); + + m_iShapeType = iShapeType; + + } + + + /** + * Checks whether the vector layer is 3D. + * + * @return true if it is a 3D layer. + * + */ + public boolean getIs3d() { + return m_bIs3d; + } + + + /** + * Sets whether the vector layer is 3D. + * + * @param is3d + * true if it is a 3D layer. + */ + public void setIs3d(final boolean is3d) { + m_bIs3d = is3d; + } + + + public void setShapeType(final int iShapeType) { + + m_iShapeType = iShapeType; + + } + + + public int getShapeType() { + + return m_iShapeType; + } + + + public String getTextDescription() { + // TODO Auto-generated method stub + return null; + } + +} Added: plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalResults/CorrelationGraphCreator.java =================================================================== --- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalResults/CorrelationGraphCreator.java (rev 0) +++ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/additionalResults/CorrelationGraphCreator.java 2016-11-19 11:21:51 UTC (rev 5198) @@ -0,0 +1,144 @@ +package es.unex.sextante.additionalResults; + +import java.awt.BasicStroke; +import java.awt.Color; + +import org.jfree.chart.ChartFactory; +import org.jfree.chart.ChartPanel; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.plot.Plot; +import org.jfree.chart.plot.PlotOrientation; +import org.jfree.chart.plot.XYPlot; +import org.jfree.chart.renderer.xy.StandardXYItemRenderer; +import org.jfree.chart.renderer.xy.XYDotRenderer; +import org.jfree.chart.renderer.xy.XYItemRenderer; +import org.jfree.data.xy.XYDataset; +import org.jfree.data.xy.XYSeries; +import org.jfree.data.xy.XYSeriesCollection; + +import es.unex.sextante.math.regression.Regression; + +/** + * This class creates a graph representing a regression analysis, with a cloud + * of points and an adjusted function + * + * @author volaya + * + */ +public class CorrelationGraphCreator { + + private JFreeChart chart; + private ChartPanel jPanelChart = null; + private final Regression regression; + + /** + * Constructs the graph based on a given regression + * + * @param reg + * the regression + */ + public CorrelationGraphCreator(final Regression reg) { + + regression = reg; + + createChart(); + + final Plot plot = chart.getPlot(); + plot.setOutlineStroke(new BasicStroke(1)); + plot.setOutlinePaint(Color.blue); + + } + + /** + * Returns a panel containing the chart + * + * @return a panel containing the chart + */ + public ChartPanel getChartPanel() { + + if (jPanelChart == null) { + jPanelChart = new ChartPanel(chart); + } + return jPanelChart; + } + + /** + * Returns the regression chart + * + * @return the regression chart + */ + public JFreeChart getChart() { + + return chart; + + } + + private void createChart() { + + final XYDataset data1 = getOriginalDataset(); + chart = ChartFactory.createScatterPlot(null, null, null, data1, + PlotOrientation.VERTICAL, false, true, true); + + final XYPlot plot = chart.getXYPlot(); + plot.setRenderer(new XYDotRenderer()); + plot.setDomainCrosshairVisible(true); + plot.setRangeCrosshairVisible(true); + plot.getRenderer().setSeriesPaint(0, Color.blue); + // plot.setBackgroundPaint(Color.white); + final XYDataset data2 = getDatasetFromFitting(); + final XYItemRenderer renderer = new StandardXYItemRenderer(); + renderer.setSeriesPaint(0, Color.red); + + plot.setDataset(1, data2); + plot.setRenderer(1, renderer); + + } + + private XYDataset getOriginalDataset() { + + int i; + final XYSeries series = new XYSeries(""); + final int NUM_POINTS_FOR_GRAPH = 2000; + + final double cellValue1[] = new double[NUM_POINTS_FOR_GRAPH]; + final double cellValue2[] = new double[NUM_POINTS_FOR_GRAPH]; + regression.getRestrictedSample(cellValue1, cellValue2, + NUM_POINTS_FOR_GRAPH); + for (i = 0; i < cellValue1.length; i++) { + series.add(cellValue1[i], cellValue2[i]); + } + + XYSeriesCollection dataset; + + dataset = new XYSeriesCollection(); + dataset.addSeries(series); + + return dataset; + + } + + private XYDataset getDatasetFromFitting() { + + int i; + final int STEPS = 200; + double x, y; + final XYSeries series = new XYSeries(""); + XYSeriesCollection dataset; + + final double dStep = (regression.getXMax() - regression.getXMin()) + / STEPS; + + for (i = 0; i < STEPS; i++) { + x = regression.getXMin() + dStep * i; + y = regression.getY(x); + series.add(x, y); + } + + dataset = new XYSeriesCollection(); + dataset.addSeries(series); + + return dataset; + + } + +} Added: plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/AbstractInputFactory.java =================================================================== --- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/AbstractInputFactory.java (rev 0) +++ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/AbstractInputFactory.java 2016-11-19 11:21:51 UTC (rev 5198) @@ -0,0 +1,322 @@ +package es.unex.sextante.core; + +import java.util.ArrayList; + +import es.unex.sextante.additionalInfo.AdditionalInfoVectorLayer; +import es.unex.sextante.dataObjects.I3DRasterLayer; +import es.unex.sextante.dataObjects.IDataObject; +import es.unex.sextante.dataObjects.ILayer; +import es.unex.sextante.dataObjects.IRasterLayer; +import es.unex.sextante.dataObjects.ITable; +import es.unex.sextante.dataObjects.IVectorLayer; +import es.unex.sextante.parameters.RasterLayerAndBand; + +public abstract class AbstractInputFactory implements IInputFactory { + + public static final int SHAPE_TYPE_ANY = AdditionalInfoVectorLayer.SHAPE_TYPE_ANY; + + protected IDataObject[] m_Objects; + + public void clearDataObjects() { + + m_Objects = null; + + } + + public void removeDataObject(final String sName) { + + if (m_Objects == null) { + return; + } + + final ArrayList<IDataObject> list = new ArrayList<IDataObject>(); + for (int i = 0; i < m_Objects.length; i++) { + if (!m_Objects[i].getName().equals(sName)) { + list.add(m_Objects[i]); + } + } + + m_Objects = list.toArray(new IDataObject[0]); + + } + + public void addDataObject(final IDataObject obj) { + + final IDataObject[] newObjects = new IDataObject[m_Objects.length + 1]; + System.arraycopy(m_Objects, 0, newObjects, 0, m_Objects.length); + newObjects[m_Objects.length] = obj; + m_Objects = newObjects; + + } + + public void removeObject(final IDataObject obj) { + + if (m_Objects == null) { + return; + } + + final ArrayList<IDataObject> list = new ArrayList(); + for (int i = 0; i < m_Objects.length; i++) { + if (m_Objects[i] != obj) { + list.add(m_Objects[i]); + } + } + m_Objects = list.toArray(new IDataObject[0]); + } + + /** + * + * Returns array with currently available raster bands. Returns empty array + * of size zero [0] if there are no available raster bands. + * + */ + public RasterLayerAndBand[] getBands() { + + final ArrayList list = new ArrayList(); + + final IRasterLayer[] layers = getRasterLayers(); + + if (layers == null) { + // Return an empty array. + return (new RasterLayerAndBand[0]); + } + + for (int i = 0; i < layers.length; i++) { + for (int j = 0; j < layers[i].getBandsCount(); j++) { + final RasterLayerAndBand rab = new RasterLayerAndBand( + layers[i], j); + list.add(rab); + } + } + + final RasterLayerAndBand[] bands = new RasterLayerAndBand[list.size()]; + for (int i = 0; i < list.size(); i++) { + bands[i] = (RasterLayerAndBand) list.get(i); + } + + return bands; + + } + + /** + * + * Returns array with currently available layers. Returns empty array of + * size zero [0] if there are no available layers. + * + */ + public ILayer[] getLayers() { + + final ArrayList list = new ArrayList(); + + final Object[] objs = getDataObjects(); + + if (objs == null) { + // Return an empty array. + return (new ILayer[0]); + } + + for (int i = 0; i < objs.length; i++) { + if (objs[i] instanceof ILayer) { + list.add(objs[i]); + } + } + + final ILayer[] layers = new ILayer[list.size()]; + for (int i = 0; i < layers.length; i++) { + layers[i] = (ILayer) list.get(i); + } + + return layers; + + } + + /** + * + * Returns array with currently available raster layers. Returns empty array + * of size zero [0] if there are no available raster layers. + * + */ + public IRasterLayer[] getRasterLayers() { + + final ArrayList list = new ArrayList(); + + final Object[] objs = getDataObjects(); + + if (objs == null) { + // Return an empty array. + return (new IRasterLayer[0]); + } + + for (int i = 0; i < objs.length; i++) { + if (objs[i] instanceof IRasterLayer) { + list.add(objs[i]); + } + } + + final IRasterLayer[] layers = new IRasterLayer[list.size()]; + for (int i = 0; i < layers.length; i++) { + layers[i] = (IRasterLayer) list.get(i); + } + + return layers; + + } + + /** + * + * Returns array with currently available image (=multi-band raster) layers. + * An image layer is simply a raster layer that has more than one band. + * Returns empty array of size zero [0] if there are no available image + * layers. + * + */ + public IRasterLayer[] getImageLayers() { + + final ArrayList list = new ArrayList(); + + final Object[] objs = getDataObjects(); + + if (objs == null) { + // Return an empty array. + return (new IRasterLayer[0]); + } + + for (int i = 0; i < objs.length; i++) { + if (objs[i] instanceof IRasterLayer) { + IRasterLayer raster = (IRasterLayer) objs[i]; + if (raster.getBandsCount() > 1) { + list.add(objs[i]); + } + } + } + + final IRasterLayer[] layers = new IRasterLayer[list.size()]; + for (int i = 0; i < layers.length; i++) { + layers[i] = (IRasterLayer) list.get(i); + } + + return layers; + + } + + /** + * + * Returns array with currently available 3D raster layers. Returns empty + * array of size zero [0] if there are no available 3D raster layers. + * + */ + public I3DRasterLayer[] get3DRasterLayers() { + + final ArrayList list = new ArrayList(); + + final Object[] objs = getDataObjects(); + + if (objs == null) { + // Return an empty array. + return (new I3DRasterLayer[0]); + } + + for (int i = 0; i < objs.length; i++) { + if (objs[i] instanceof I3DRasterLayer) { + list.add(objs[i]); + } + } + + final I3DRasterLayer[] layers = new I3DRasterLayer[list.size()]; + for (int i = 0; i < layers.length; i++) { + layers[i] = (I3DRasterLayer) list.get(i); + } + + return layers; + + } + + /** + * + * Returns array with currently available vector layers. Returns empty array + * of size zero [0] if there are no available vector layers. + * + */ + public IVectorLayer[] getVectorLayers(final int shapeType) { + + final ArrayList list = new ArrayList(); + + final Object[] objs = getDataObjects(); + + if (objs == null) { + // Return an empty array. + return (new IVectorLayer[0]); + } + + for (int i = 0; i < objs.length; i++) { + if (objs[i] instanceof IVectorLayer) { + final IVectorLayer layer = (IVectorLayer) objs[i]; + if (layer.getShapeType() != IVectorLayer.SHAPE_TYPE_WRONG) { + if ((layer.getShapeType() == shapeType) + || (shapeType == SHAPE_TYPE_ANY)) { + list.add(objs[i]); + } + } + } + } + + final IVectorLayer[] layers = new IVectorLayer[list.size()]; + for (int i = 0; i < layers.length; i++) { + layers[i] = (IVectorLayer) list.get(i); + } + + return layers; + + } + + /** + * + * Returns array with currently available tables. Returns empty array of + * size zero [0] if there are no available tables. + * + */ + public ITable[] getTables() { + + final ArrayList list = new ArrayList(); + + final Object[] objs = getDataObjects(); + + if (objs == null) { + // Return an empty array. + return (new ITable[0]); + } + + for (int i = 0; i < objs.length; i++) { + if (objs[i] instanceof ITable) { + list.add(objs[i]); + } + } + + final ITable[] tables = new ITable[list.size()]; + for (int i = 0; i < tables.length; i++) { + tables[i] = (ITable) list.get(i); + } + + return tables; + + } + + public IDataObject[] getDataObjects() { + + return m_Objects; + + } + + public IDataObject getInputFromName(final String sName) { + + for (int i = 0; i < m_Objects.length; i++) { + if (m_Objects[i].getName().equals(sName)) { + return m_Objects[i]; + } + } + + return null; + + } + +} Added: plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/AlgorithmsAndResources.java =================================================================== --- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/AlgorithmsAndResources.java (rev 0) +++ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/AlgorithmsAndResources.java 2016-11-19 11:21:51 UTC (rev 5198) @@ -0,0 +1,184 @@ + + +package es.unex.sextante.core; + +import java.io.File; +import java.net.URL; +import java.net.URLClassLoader; +import java.net.URLDecoder; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.StringTokenizer; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + + +/** + * + * Methods in this class act as entry points for algorithms and resource files. + * + * Algorithms are loaded when the library is initialized. Adding new algorithms after calling {@link Sextante#initialize()} will + * not add them to the list of currently available ones, so all additional algorithms should be added before initializing the + * library + * + */ +public class AlgorithmsAndResources { + + private static ArrayList<String> m_ClassNames = new ArrayList<String>(); + private static ArrayList<String> m_PropertiesFiles = new ArrayList<String>(); + + + /** + * Returns an array of class names of all the algorithms currently included in the library + * + * @return an array of algorithm class names + */ + public static String[] getAlgorithmClassNames() { + + return m_ClassNames.toArray(new String[m_ClassNames.size()]); + + } + + + /** + * Returns an array of names of properties files containing resource strings for i18N + * + * @return an array of properties filenames + */ + public static String[] getPropertiesFilenames() { + + return m_PropertiesFiles.toArray(new String[m_PropertiesFiles.size()]); + + } + + + /** + * Adds a new algorithm to the list or currently available ones + * + * @param sAlgClassName + * the name of the class representing the algorithm + */ + public static void addAlgorithm(final String sAlgClassName) { + + m_ClassNames.add(sAlgClassName); + + } + + + /** + * Adds a new properties file to the list + * + * @param sName + * the base name of the properties file + */ + public static void addPropertiesFile(final String sName) { + + m_PropertiesFiles.add(sName); + + } + + + /** + * Adds all sextante algorithms and properties files located in the jar files in the classpath. + */ + public static void addAlgorithmsAndPropertiesFromClasspath() { + + final StringTokenizer localTokenizer = new StringTokenizer(System.getProperty("java.class.path"), File.pathSeparator, false); + + //final Set<String> filenames = new LinkedHashSet(); + + while (localTokenizer.hasMoreTokens()) { + final String classpathElement = localTokenizer.nextToken(); + final File classpathFile = new File(classpathElement); + final String sFilename = classpathFile.getName(); + if (classpathFile.exists() && classpathFile.canRead()) { + if (sFilename.toLowerCase().endsWith(".jar") && sFilename.toLowerCase().startsWith("sextante")) { + addAlgorithmsAndResourcesFromJarFile(classpathElement); + } + + } + } + + final ClassLoader classloader = AlgorithmsAndResources.class.getClassLoader(); + URL[] webappClasses = new URL[0]; + if (classloader instanceof URLClassLoader) { + final URLClassLoader urlClassLoader = (URLClassLoader) classloader; + webappClasses = urlClassLoader.getURLs(); + } + + addAlgorithmsAndPropertiesFromURLs(webappClasses); + + } + + + public static void addAlgorithmsAndPropertiesFromURLs(final URL[] urls) { + + for (final URL url : urls) { + final File classpathFile = new File(URLDecoder.decode(url.getFile())); + final String sFilename = classpathFile.getName(); + if (classpathFile.exists() && classpathFile.canRead()) { + if (sFilename.toLowerCase().endsWith(".jar") && sFilename.toLowerCase().startsWith("sextante")) { + addAlgorithmsAndResourcesFromJarFile(classpathFile.getAbsolutePath()); + } + } + } + + + } + + + /** + * Adds all sextante algorithms and properties files located in the jar files of a given folder. + * + * <b>NOTE:</b> i18n files must be named like 'nameOfPackage.properties' (without any '_' character on the name, except that + * files of other languages, e.g, nameOfPackage_es.properties + * + * @param sFolder + * the folder where jar files are located + */ + public static void addAlgorithmsAndPropertiesFromFolder(final String sFolder) { + + final File folder = new File(sFolder); + final File[] directoryFiles = folder.listFiles(); + for (int i = 0; i < directoryFiles.length; i++) { + if (!directoryFiles[i].isDirectory()) { + final String sFilename = directoryFiles[i].getName(); + if (sFilename.endsWith(".jar") && sFilename.startsWith("sextante")) { + addAlgorithmsAndResourcesFromJarFile(directoryFiles[i].getAbsolutePath()); + } + } + } + } + + + /** + * Adds all sextante algorithms and properties files located in a given jar file + * + * @param sFilename + * the filename of the jar file + */ + private static void addAlgorithmsAndResourcesFromJarFile(final String sFilename) { + + try { + final ZipFile zip = new ZipFile(sFilename); + final Enumeration entries = zip.entries(); + while (entries.hasMoreElements()) { + final ZipEntry entry = (ZipEntry) entries.nextElement(); + final String sName = entry.getName(); + if (!entry.isDirectory()) { + if (sName.toLowerCase().endsWith("algorithm.class")) { + final String sClassName = sName.substring(0, sName.lastIndexOf('.')).replace('/', '.'); + addAlgorithm(sClassName); + } + else if (sName.endsWith(".properties") && (sName.indexOf("_") == -1)) { + addPropertiesFile(sName.substring(0, sName.lastIndexOf('.'))); + } + } + } + } + catch (final Exception e) {/*ignore file*/ + } + + } + +} Added: plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/AnalysisExtent.java =================================================================== --- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/AnalysisExtent.java (rev 0) +++ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/AnalysisExtent.java 2016-11-19 11:21:51 UTC (rev 5198) @@ -0,0 +1,725 @@ + + +package es.unex.sextante.core; + +import java.awt.geom.Point2D; +import java.awt.geom.Rectangle2D; + +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.Geometry; +import com.vividsolutions.jts.geom.GeometryFactory; + +import es.unex.sextante.dataObjects.I3DRasterLayer; +import es.unex.sextante.dataObjects.ILayer; +import es.unex.sextante.dataObjects.IRasterLayer; +import es.unex.sextante.rasterWrappers.Grid3DCell; +import es.unex.sextante.rasterWrappers.GridCell; + + +/** + * This class defines an output region (extent coordinates and cellsize) + * + * @author Victor Olaya + * + */ +public class AnalysisExtent { + + //these values are cell border coordinates, not centered ones + double m_dXMin = 0; + double m_dYMin = 0; + double m_dZMin = 0; + double m_dXMax = 0; + double m_dYMax = 0; + double m_dZMax = 0; + double m_dCellSizeX = 1; + double m_dCellSizeY = 1; + double m_dCellSizeZ = 1; + int m_iNX; + int m_iNY; + int m_iNZ; + + + public AnalysisExtent() { + } + + + /** + * Creates a new grid extent using the extent of a layer. If it is a raster layer, it will also use its cellsize. If it is a 3d + * raster layer, it will use its z values + * + * @param layer + * a layer + */ + public AnalysisExtent(final ILayer layer) { + + m_dXMin = layer.getFullExtent().getMinX(); + m_dXMax = layer.getFullExtent().getMaxX(); + m_dYMin = layer.getFullExtent().getMinY(); + m_dYMax = layer.getFullExtent().getMaxY(); + + if (layer instanceof IRasterLayer) { + final IRasterLayer rasterLayer = (IRasterLayer) layer; + m_dCellSizeX = rasterLayer.getLayerGridExtent().getCellSizeX(); + m_dCellSizeY = rasterLayer.getLayerGridExtent().getCellSizeY(); + recalculateNXAndNY(); + } + else if (layer instanceof I3DRasterLayer) { + final I3DRasterLayer raster3DLayer = (I3DRasterLayer) layer; + m_dZMin = raster3DLayer.getLayerExtent().getZMin(); + m_dZMax = raster3DLayer.getLayerExtent().getZMax(); + m_dCellSizeZ = raster3DLayer.getCellSizeZ(); + recalculateNZ(); + } + + } + + + /** + * Sets a new range for X coordinates. Coordinates are not center cell ones, but border ones + * + * @param dXMin + * the minimum x coordinate of the extent. + * @param dXMax + * the maximum x coordinate of the extent + * @param bRecalculateWithCellsize + * if this parameter is true, the range will be adapted to match the cellsize. Use this when you are working + * with raster layers. Make sure that the cellsize has been set in advance. + */ + public void setXRange(final double dXMin, + final double dXMax, + final boolean bRecalculateWithCellsize) { + + m_dXMin = Math.min(dXMin, dXMax); + m_dXMax = Math.max(dXMin, dXMax); + if (bRecalculateWithCellsize) { + recalculateNXAndNY(); + } + + } + + + /** + * Sets a new range for Y coordinates. Coordinates are not center cell ones, but border ones + * + * @param dYMin + * the minimum Y coordinate of the extent. + * @param dYMax + * the maximum Y coordinate of the extent + * @param bRecalculateWithCellsize + * if this parameter is true, the range will be adapted to match the cellsize. Use this when you are working + * with raster layers. Make sure that the cellsize has been set in advance. + */ + public void setYRange(final double dYMin, + final double dYMax, + final boolean bRecalculateWithCellsize) { + + m_dYMin = Math.min(dYMin, dYMax); + m_dYMax = Math.max(dYMin, dYMax); + if (bRecalculateWithCellsize) { + recalculateNXAndNY(); + } + + } + + + /** + * Sets a new range for Z coordinates. Coordinates are not center cell ones, but border ones + * + * @param dZMin + * the minimum z coordinate of the extent. + * @param dZMax + * the maximum z coordinate of the extent + * @param bRecalculateWithCellsize + * if this parameter is true, the range will be adapted to match the cellsize. Use this when you are working + * with raster layers. Make sure that the cellsize has been set in advance. + */ + public void setZRange(final double dZMin, + final double dZMax, + final boolean bRecalculateWithCellsize) { + + m_dZMin = Math.min(dZMin, dZMax); + m_dZMax = Math.max(dZMin, dZMax); + if (bRecalculateWithCellsize) { + recalculateNZ(); + } + + } + + + /** + * Returns the X cellsize of this extent + * + * @return the X cellsize of this extent + */ + public double getCellSizeX() { + + return m_dCellSizeX; + + } + + + /** + * Returns the Y cellsize of this extent + * + * @return Y cell size (always positive) + */ + public double getCellSizeY() { + + return m_dCellSizeY; + + } + + + /** + * Sets a new X cellsize for this extent + * + * @param cellSize + * the new X cellsize + */ + public void setCellSizeX(final double cellSize) { + + m_dCellSizeX = cellSize; + recalculateNXAndNY(); + + } + + + /** + * Sets a new Y cellsize for this extent + * + * @param cellSize + * the new Y cellsize + */ + public void setCellSizeY(final double cellSize) { + + m_dCellSizeY = cellSize; + recalculateNXAndNY(); + + } + + + /** + * Returns the z cellsize of this extent + * + * @return the z cellsize of this extent + */ + public double getCellSizeZ() { + + return m_dCellSizeZ; + + } + + + /** + * Sets a new z cellsize for this extent + * + * @param cellSize + * the new cellsize + */ + public void setCellSizeZ(final double cellSize) { + + m_dCellSizeZ = cellSize; + recalculateNZ(); + + } + + + /** + * Returns the number of columns in the extent + * + * @return the number of columns + */ + public int getNX() { + + return m_iNX; + + } + + + /** + * Returns the number of rows in the extent + * + * @return the number of rows + */ + public int getNY() { + + return m_iNY; + + } + + + /** + * Returns the number of Z levels in the extent + * + * @return the number of Z levels + */ + public int getNZ() { + + return m_iNZ; + + } + + + private void recalculateNXAndNY() { + m_iNX = (int) Math.round((m_dXMax - m_dXMin) / m_dCellSizeX); + m_iNY = (int) Math.round((m_dYMax - m_dYMin) / m_dCellSizeY); + m_dXMax = m_dXMin + m_dCellSizeX * m_iNX; + m_dYMax = m_dYMin + m_dCellSizeY * m_iNY; + } + + + private void recalculateNZ() { + + m_iNZ = (int) Math.round((m_dZMax - m_dZMin) / m_dCellSizeZ); + m_dZMax = m_dZMin + m_dCellSizeZ * m_iNZ; + + } + + + /** + * Return the minimum x coordinate of the extent. For raster layers, this is not the coordinate of the center of the left-most + * cell, but the the coordinate of its left border + * + * @return the minimum x coordinate of the extent + */ + public double getXMin() { + + return m_dXMin; + + } + + + /** + * Return the maximum x coordinate of the extent. For raster layers, this is not the coordinate of the center of the right-most + * cell, but the the coordinate of its right border + * + * @return the maximum x coordinate of the extent + */ + public double getXMax() { + + return m_dXMax; + + } + + + /** + * Return the minimum x coordinate of the extent. For raster layers, this is not the coordinate of the center of the lower + * cell, but the the coordinate of its lower border + * + * @return the minimum y coordinate of the extent + */ + public double getYMin() { + + return m_dYMin; + + } + + + /** + * Return the maximum y coordinate of the extent. For raster layers, this is not the coordinate of the center of the upper + * cell, but the the coordinate of its upper border + * + * @return the maximum y coordinate of the extent + */ + public double getYMax() { + + return m_dYMax; + + } + + + /** + * Return the minimum z coordinate of the extent. For raster layers, this is not the coordinate of the center of the lower + * cell, but the the coordinate of its lower border + * + * @return the minimum y coordinate of the extent + */ + public double getZMin() { + + return m_dZMin; + + } + + + /** + * Return the maximum z coordinate of the extent. For raster layers, this is not the coordinate of the center of the upper + * cell, but the the coordinate of its upper border + * + * @return the maximum z coordinate of the extent + */ + public double getZMax() { + + return m_dZMax; + + } + + + /** + * Returns the real X distance spanned by this extent + * + * @return the real X distance spanned by this extent + */ + public double getWidth() { + + return m_dXMax - m_dXMin; + + } + + + /** + * Returns the real Y distance spanned by this extent + * + * @return the real Y distance spanned by this extent + */ + public double getLength() { + + return m_dYMax - m_dYMin; + + } + + + /** + * Returns the real Z distance spanned by this extent + * + * @return the real Z distance spanned by this extent + */ + public double getHeight() { + + return m_dZMax - m_dZMin; + + } + + + /** + * Returns true if the given point falls within the area covered by this extent + * + * @param x + * the x coordinate of the point + * @param y + * the y coordinate of the point + * @return whether the given point falls within the XY area covered by this extent + */ + public boolean contains(final double x, + final double y) { + + return ((x >= m_dXMin) && (x <= m_dXMax) && (y >= m_dYMin) && (y <= m_dYMax)); + + } + + + /** + * Returns true if the given 3D point falls within the 3D area (volume) covered by this extent + * + * @param x + * the x coordinate of the point + * @param y + * the y coordinate of the point + * @param z + * the z coordinate of the point + * + * @return whether the given point falls within the volume covered by this extent + */ + public boolean contains(final double x, + final double y, + final double z) { + + return ((x >= m_dXMin) && (x <= m_dXMax) + && (y >= m_dYMin) && (y <= m_dYMax) + && (z >= m_dZMin) && (z <= m_dZMax)); + + } + + + /** + * Returns true if the given extent matches the grid defined by + * this extent extent (has same size and cell boundaries match) + * + * @param extent + * @return whether the passed extent fits into this extent + */ + public boolean fitsIn(final AnalysisExtent extent) { + + boolean bFitsX, bFitsY, bFitsZ; + double dOffset; + double dOffsetCols; + double dOffsetRows; + double dOffsetZ; + final double MIN_DIF_XY = 0.0000000000001; //TOLERANCE: must be very small for lat/lon. + final double MIN_DIF_Z = 0.00001; //TOLERANCE: can be larger for depth (Z). + + if (extent.getCellSizeX() != this.getCellSizeX()) { + return false; + } + + if (extent.getCellSizeY() != this.getCellSizeY()) { + return false; + } + + dOffset = Math.abs(extent.getXMin() - this.getXMin()); + dOffsetCols = dOffset / this.getCellSizeX(); + bFitsX = (dOffsetCols - Math.floor(dOffsetCols + 0.5) < MIN_DIF_XY); + + dOffset = Math.abs(extent.getYMax() - this.getYMax()); + dOffsetRows = dOffset / this.getCellSizeY(); + bFitsY = (Math.abs(dOffsetRows - Math.floor(dOffsetRows + 0.5)) < MIN_DIF_XY); + + dOffset = Math.abs(extent.getZMax() - this.getZMax()); + dOffsetZ = dOffset / this.getCellSizeZ(); + bFitsZ = (Math.abs(dOffsetZ - Math.floor(dOffsetZ + 0.5)) < MIN_DIF_Z); + + return bFitsX && bFitsY && bFitsZ; + + } + + + /** + * Returns true if this extent has the same characteristics as a given one + * + * @param extent + * @return whether this extent equals the given extent + */ + public boolean equals(final AnalysisExtent extent) { + + return ( m_dXMin == extent.getXMin()) + && (m_dXMax == extent.getXMax()) + && (m_dYMin == extent.getYMin()) + && (m_dYMax == extent.getYMax()) + && (m_dCellSizeX == extent.getCellSizeX()) + && (m_dCellSizeY == extent.getCellSizeY()) + && (m_dZMin == extent.getZMin()) + && (m_dZMax == extent.getZMax()) + && (m_dCellSizeZ == extent.getCellSizeZ()); + + } + + + /** + * Modifies this extent to incorporate another one into its boundaries + * + * @param extent + * the extent to add + */ + public void addExtent(final AnalysisExtent extent) { + + m_dXMin = Math.min(extent.getXMin(), m_dXMin); + m_dXMax = Math.max(extent.getXMax(), m_dXMax); + m_dYMin = Math.min(extent.getYMin(), m_dYMin); + m_dYMax = Math.max(extent.getYMax(), m_dYMax); + m_dZMin = Math.min(extent.getZMin(), m_dZMin); + m_dZMax = Math.max(extent.getZMax(), m_dZMax); + m_dCellSizeX = Math.min(extent.getCellSizeX(), m_dCellSizeX); + m_dCellSizeY = Math.min(extent.getCellSizeY(), m_dCellSizeY); + m_dCellSizeZ = Math.min(extent.getCellSizeZ(), m_dCellSizeZ); + recalculateNXAndNY(); + recalculateNZ(); + + } + + + /** + * Modifies this extent to incorporate another one into its boundaries + * + * @param extent + * the extent to add + */ + public void addExtent(final Rectangle2D extent) { + + m_dXMin = Math.min(extent.getMinX(), m_dXMin); + m_dXMax = Math.max(extent.getMaxX(), m_dXMax); + m_dYMin = Math.min(extent.getMinY(), m_dYMin); + m_dYMax = Math.max(extent.getMaxY(), m_dYMax); + recalculateNXAndNY(); + + } + + + /** + * Converts a world coordinate to grid coordinates + * + * @param pt + * a point in world coordinates + * @return a grid cell with coordinates of the given point in grid coordinates referred to this grid extent + */ + public GridCell getGridCoordsFromWorldCoords(final Point2D pt) { + + final int x = (int) Math.floor((pt.getX() - m_dXMin) / m_dCellSizeX); + final int y = (int) Math.floor((m_dYMax - pt.getY()) / m_dCellSizeY); + + final GridCell cell = new GridCell(x, y, 0.0); + + return cell; + + } + + + /** + * Converts a world coordinate to grid coordinates + * + * @param x + * the x coordinate of the point + * @param y + * the y coordinate of the point + * @return a grid cell representing the given point in grid coordinates referred to this grid extent + */ + public GridCell getGridCoordsFromWorldCoords(final double x, + final double y) { + + return getGridCoordsFromWorldCoords(new Point2D.Double(x, y)); + + } + + + public Grid3DCell getGridCoordsFromWorldCoords(final double x, + final double y, + final double z) { + + final int iX = (int) Math.floor((x - m_dXMin) / m_dCellSizeX); + final int iY = (int) Math.floor((m_dYMax - y) / m_dCellSizeY); + final int iZ = (int) Math.floor((z - m_dZMin) / m_dCellSizeZ); + + final Grid3DCell cell = new Grid3DCell(iX, iY, iZ, 0.0); + + return cell; + + } + + + /** + * /** Converts a grid cell into a world coordinate representing the center of that cell + * + * @param cell + * the cell to convert + * @return a point representing the given cell in world coordinates + */ + public Point2D getWorldCoordsFromGridCoords(final GridCell cell) { + + final double x = m_dXMin + (cell.getX() + 0.5) * m_dCellSizeX; + final double y = m_dYMax - (cell.getY() + 0.5) * m_dCellSizeY; + + final Point2D pt = new Point2D.Double(x, y); + + return pt; + + } + + + /** + * Converts a grid cell into a world coordinate representing the center of that cell + * + * @param x + * the x coordinate (col) of the cell + * @param y + * the y coordinate (row) of the cell + * @return a point representing the given cell in world coordinates + */ + public Point2D getWorldCoordsFromGridCoords(final int x, + final int y) { + + return getWorldCoordsFromGridCoords(new GridCell(x, y, 0)); + + } + + + /** + * Converts a grid cell into a world coordinate representing the center of that cell + * + * @param x + * the x coordinate of the cell + * @param y + * the y coordinate of the cell + * @param z + * the z coordinate of the cell + * + * @return a coordinate representing the given cell in world coordinates + */ + public Coordinate getWorldCoordsFromGridCoords(final int x, + final int y, + final int z) { + + final double dX = m_dXMin + (x + 0.5) * m_dCellSizeX; + final double dY = m_dYMax - (y + 0.5) * m_dCellSizeY; + final double dZ = m_dZMin + (y + 0.5) * m_dCellSizeZ; + + final Coordinate coord = new Coordinate(dX, dY, dZ); + + return coord; + + } + + + @Override + public String toString() { + final String s = Double.toString(m_dXMin) + ", " + Double.toString(m_dYMin) + ", " + Double.toString(m_dZMin) + ", " + + Double.toString(m_dXMax) + ", " + Double.toString(m_dYMax) + ", " + Double.toString(m_dZMax) + ", " + + Double.toString(m_dCellSizeX) + ", " + Double.toString(m_dCellSizeY) + + ", " + Double.toString(m_dCellSizeZ); + return s; + } + + + /** + * Enlarges this grid extent one cell in each direction (only X and Y) + */ + public void enlargeOneCell() { + m_dXMin = m_dXMin - m_dCellSizeX; + m_dYMin = m_dYMin - m_dCellSizeY; + m_dXMax = m_dXMax + m_dCellSizeX; + m_dYMax = m_dYMax + m_dCellSizeY; + this.recalculateNXAndNY(); + + } + + + /** + * Returns this extent as a Java Rectangle2D. Z coordinates are neglected + * + * @return the boundary of this extent a Java Rectangle2D + */ + public Rectangle2D getAsRectangle2D() { + + final Rectangle2D rect = new Rectangle2D.Double(); + rect.setRect(m_dXMin, m_dYMin, m_dXMax - m_dXMin, m_dYMax - m_dYMin); + + return rect; + + } + + + /** + * Returns true if the cell is within the limits of this grid extent + * + * @param x + * the x coordinate (col) of the cell + * @param y + * the y coordinate (row) of the cell + * @return whether the cell is within the limits of this grid extent + */ + public boolean containsCell(final int x, + final int y) { + + return (x >= 0) && (x < m_iNX) && (y >= 0) && (y < m_iNY); + + } + + + /** + * Return this extent as a JTS Polygon + * + * @return this extent as a JTS polygon + */ + public Geometry getAsJTSGeometry() { + + final GeometryFactory gf = new GeometryFactory(); + final Coordinate[] coords = new Coordinate[5]; + coords[0] = new Coordinate(m_dXMin, m_dYMin); + coords[1] = new Coordinate(m_dXMax, m_dYMin); + coords[2] = new Coordinate(m_dXMax, m_dYMax); + coords[3] = new Coordinate(m_dXMin, m_dYMax); + coords[4] = new Coordinate(m_dXMin, m_dYMin); + final Geometry geom = gf.createPolygon(gf.createLinearRing(coords), null); + + return geom; + } + + +} Added: plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/GeoAlgorithm.java =================================================================== --- plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/GeoAlgorithm.java (rev 0) +++ plug-ins/SextantePlugIn/sextante-lib-source/Sextante/src/es/unex/sextante/core/GeoAlgorithm.java 2016-11-19 11:21:51 UTC (rev 5198) @@ -0,0 +1,2801 @@ +package es.unex.sextante.core; + +import java.io.File; +import java.text.DateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import org.jfree.chart.ChartPanel; + +//import com.iver.utiles.Utils; +import es.unex.sextante.additionalInfo.AdditionalInfoDataObject; +import es.unex.sextante.additionalInfo.AdditionalInfoFixedTable; +import es.unex.sextante.additionalInfo.AdditionalInfoMultipleInput; +import es.unex.sextante.additionalInfo.AdditionalInfoTableField; +import es.unex.sextante.dataObjects.I3DRasterLayer; +import es.unex.sextante.dataObjects.IDataObject; +import es.unex.sextante.dataObjects.ILayer; +import es.unex.sextante.dataObjects.IRasterLayer; +import es.unex.sextante.dataObjects.ITable; +import es.unex.sextante.dataObjects.IVectorLayer; +import es.unex.sextante.exceptions.GeoAlgorithmExecutionException; +import es.unex.sextante.exceptions.NullParameterAdditionalInfoException; +import es.unex.sextante.exceptions.NullParameterValueException; +import es.unex.sextante.exceptions.UnsupportedOutputChannelException; +import es.unex.sextante.exceptions.WrongAnalysisExtentException; +import es.unex.sextante.exceptions.WrongParameterIDException; +import es.unex.sextante.exceptions.WrongParameterTypeException; +import es.unex.sextante.outputs.FileOutputChannel; +import es.unex.sextante.outputs.IOutputChannel; +import es.unex.sextante.outputs.Output; +import es.unex.sextante.outputs.Output3DRasterLayer; +import es.unex.sextante.outputs.OutputChart; +import es.unex.sextante.outputs.OutputImage; +import es.unex.sextante.outputs.OutputNumericalValue; +import es.unex.sextante.outputs.OutputRasterLayer; +import es.unex.sextante.outputs.OutputTable; +import es.unex.sextante.outputs.OutputText; +import es.unex.sextante.outputs.OutputVectorLayer; +import es.unex.sextante.parameters.Parameter; +import es.unex.sextante.parameters.ParameterDataObject; +import es.unex.sextante.parameters.ParameterFixedTable; +import es.unex.sextante.parameters.ParameterMultipleInput; +import es.unex.sextante.parameters.ParameterTableField; +import es.unex.sextante.parameters.RasterLayerAndBand; + +/** + * A class defining a geo-algorithm + * + * @author Victor Olaya vol...@unex.es + * + */ +public abstract class GeoAlgorithm { + + /** + * The set of input parameters and their values + */ + protected ParametersSet m_Parameters; + + /** + * The set of output objects. Results will be stored in this set once the + * execution is finished + */ + protected OutputObjectsSet m_OutputObjects; + + /** + * A task to track progress of the algorithm + */ + protected ITaskMonitor m_Task; + + /** + * The extent will be used to analyze layers and create create new output + * layers + */ + protected AnalysisExtent m_AnalysisExtent; + + /** + * True if the algorithm generates output layers and its extent can be + * defined by the user + */ + protected boolean m_bUserCanDefineAnalysisExtent = true; + + /** + * true if the number of steps needed to execute the algorithm can be known + * in advance + */ + protected boolean m_bIsDeterminatedProcess = true; + + /** + * true if the algorithm is a silent background task + */ + protected boolean m_bIsSilentProcess = false; + + /** + * The name of the algorithm + */ + private String m_sName; + + /** + * The name of the group this algorithm belongs to + */ + private String m_sGroup; + + /** + * A description string for misc. use + */ + private String m_sDescription = null; + + /** + * A (list of) PID(s) for this algorithms. The list will only be non-null if + * this algorithms spawns one or more external processes (e.g. GRASS GIS + * provider) + */ + private List<Integer> m_lPID = null; + + /** + * Color values useful for e.g. coloring algorithm nodes in the modeler + */ + private int i_R = Sextante.i_R_Algorithm; + private int i_G = Sextante.i_G_Algorithm; + private int i_B = Sextante.i_B_Algorithm; + private int i_Alpha = Sextante.i_Alpha_Algorithm; + + /** + * Process metadata + */ + private HashMap m_ProcessMetadata; + + /** + * Used to indicate if the extent has been set by the user or automatically + * by the algorithm + */ + protected boolean m_bIsAutoExtent; + + /** + * Used to indicate that one ore more NULL value params have been passed to + * this algorithm + */ + protected boolean m_bIncompleteParams = false; + + /** + * The CRS to use if the algorithm generates new layers + */ + protected Object m_CRS; + + private long m_lInitTime; + private long m_lEndTime; + + /** + * The output factory to use for generating new data objects from this + * algorithm + */ + protected OutputFactory m_OutputFactory; + + /** + * Alternative names for outputs + */ + private HashMap<String, String> m_OutputMap; + + public GeoAlgorithm() { + + m_Parameters = new ParametersSet(); + m_OutputObjects = new OutputObjectsSet(); + + defineCharacteristics(); + + } + + /** + * This method should be overridden and used to specify the parameters + * needed by the GeoAlgorithm, using the corresponding methods of the + * ParametersSet object. + * + * Also, output objects must be added, so SEXTANTE knows in advance which + * outputs will be generated by the algorithm. See the addOutputXXXX family + * of methods ({@link #addOutputRasterLayer}, {@link #addOutputVectorLayer}, + * etc.) + * + */ + public abstract void defineCharacteristics(); + + /** + * This method should be used to execute the algorithm once the parameters + * have been assigned. + * + * @param task + * a ITaskMonitor to track the progress of the execution. If is + * null, a + * @see {@link SilentTaskMonitor} will be used. + * @param outputFactory + * The output factory to use to generate new data objects + * @return true if the algorithm was correctly executed. False if it was + * canceled + * @throws GeoAlgorithmExecutionException + */ + public boolean execute(final ITaskMonitor task, + final OutputFactory outputFactory) + throws GeoAlgorithmExecutionException { + return execute(task, outputFactory, null); + } + + /** + * This method should be used to execute the algorithm once the parameters + * have been assigned. + * + * @param task + * a ITaskMonitor to track the progress of the execution. If is + * null, a + * @see {@link SilentTaskMonitor} will be used. + * @param outputFactory + * The output factory to use to generate new data objects + * @param outputMap + * Maps {@link IDataObject} algorithm output names to the desired + * output name. At IDataObject output creation, + * {@link OutputFactory} implementations will receive the values + * in this map as names. + * @return true if the algorithm was correctly executed. False if it was + * canceled + * @throws GeoAlgorithmExecutionException + */ + public boolean execute(final ITaskMonitor task, + final OutputFactory outputFactory, + final HashMap<String, String> outputMap) + throws GeoAlgorithmExecutionException { + + final StringBuffer sb = new StringBuffer(); + + if (task == null) { + m_Task = new SilentTaskMonitor(); + } else { + m_Task = task; + m_Task.setProgressText(""); + } + m_OutputFactory = outputFactory; + + initInputDataObjects(); + + if (!adjustOutputExtent()) { + throw new WrongAnalysisExtentException(); + } + + final DateFormat formatter = DateFormat.getDateTimeInstance(); + + final String[] cmd = this.getAlgorithmAsCommandLineSentences(); + + if (cmd != null) { + for (final String element : cmd) { + sb.append("Executing command: " + element + "\n"); + } + } + + m_OutputMap = outputMap; + + m_lInitTime = System.currentTimeMillis(); + sb.append("Starting algorithm execution: " + + formatter.format(new Date(m_lInitTime)) + "\n"); + + final boolean bReturn = processAlgorithm(); + + m_lEndTime = System.currentTimeMillis(); + sb.append("Finished algorithm execution: " + + formatter.format(new Date(m_lEndTime)) + "\n"); + sb.append("Execution time (millisecs): " + + Long.toString(m_lEndTime - m_lInitTime) + "\n"); + + Sextante.addInfoToLog(sb.toString()); + + closeInputDataObjects(); + createProcessMetadata(); + + if (bReturn) { + postProcessOutputDataObjects(); + } else { + sb.append("Algorithm was canceled!!\n"); + } + + return bReturn; + + } + + /** + * Creates metadata for the process once it has been executed + */ + private void createProcessMetadata() { + + m_ProcessMetadata = new HashMap(); + + m_ProcessMetadata.put("PROCESS_DATE", new Date(m_lInitTime)); + m_ProcessMetadata.put("PROCESS_DURATION", new Long(m_lEndTime + - m_lInitTime)); + + // TODO: add more metadata + + } + + /** + * Returns a map with metadata entries. It will return an empty map if the + * process has not been executed yet. + * + * @return the metadata of the process. + */ + public HashMap getProcessMetadata() { + + return m_ProcessMetadata; + + } + + /** + * post-processes all output objects + * + */ + private void postProcessOutputDataObjects() + throws GeoAlgorithmExecutionException { + + try { + for (int i = 0; i < m_OutputObjects.getOutputObjectsCount(); i++) { + final Output out = m_OutputObjects.getOutput(i); + final Object obj = out.getOutputObject(); + if (obj instanceof IDataObject) { + final IDataObject dataObject = (IDataObject) obj; + dataObject.postProcess(); + } + } + } catch (final Exception e) { + Sextante.addErrorToLog(e); + throw new GeoAlgorithmExecutionException(e.getMessage()); + } + + } + + /** + * Closes all input data objects when they are not needed anymore + */ + private void closeInputDataObjects() { + + for (int i = 0; i < m_Parameters.getNumberOfParameters(); i++) { + try { + final Parameter param = m_Parameters.getParameter(i); + final Object obj = param.getParameterValueAsObject(); + if (obj instanceof ILayer) { + final ILayer layer = (ILayer) obj; + layer.close(); + } else if (obj instanceof ITable) { + final ITable table = (ITable) obj; + table.close(); + } else if (obj instanceof ArrayList) { + final ArrayList list = (ArrayList) obj; + for (int j = 0; j < list.size(); j++) { + closeInputDataObject(list.get(j)); + } + } + } catch (final Exception e) { + Sextante.addErrorToLog(e); + } + } + + } + + /** + * Closes an input object + * + * @param obj + * the input object to close + */ + private void closeInputDataObject(final Object obj) { + + if (obj instanceof ILayer) { + final ILayer layer = (ILayer) obj; + layer.close(); + } else if (obj instanceof ITable) { + final ITable table = (ITable) obj; + table.close(); + } else if (obj instanceof RasterLayerAndBand) { + final RasterLayerAndBand rab = (RasterLayerAndBand) obj; + final IRasterLayer layer = rab.getRasterLayer(); + layer.close(); + } + + } + + /** + * Opens data objects before using them. It also sets the CRS for output + * layers as the CRS of the first valid input layers, or the default one if + * no layer is used. (see {@link OuputFactory#getDefualtCRS}). Sextante does + * not perform any coordinate transformation, and all input layers are + * assumed to have the same CRS, which will be the one assigned to all + * output layers. + */ + private void initInputDataObjects() { + + for (int i = 0; i < m_Parameters.getNumberOfParameters(); i++) { + final Parameter param = m_Parameters.getParameter(i); + final Object obj = param.getParameterValueAsObject(); + initInputDataObject(obj); + } + + if (m_CRS == null) { + m_CRS = m_OutputFactory.getDefaultCRS(); + } + } + + /** + * Opens a single data objects before using it. It also sets the CRS for + * output layers if a layer is passed and the current output CRS is not set. + */ + private void initInputDataObject(final Object obj) { + + if (obj instanceof ILayer) { + final ILayer layer = (ILayer) obj; + layer.open(); + if (m_CRS == null) { + m_CRS = layer.getCRS(); + } else { + if ((layer.getCRS() == null) || !layer.getCRS().equals(m_CRS)) { + Sextante.addWarningToLog(Sextante.getText("Distintos_CRS") + + ": '" + layer.getName() + "'."); + } + } + } else if (obj instanceof ITable) { + final ITable table = (ITable) obj; + table.open(); + } else if (obj instanceof RasterLayerAndBand) { + final RasterLayerAndBand rlab = (RasterLayerAndBand) obj; + final IRasterLayer layer = rlab.getRasterLayer(); + layer.open(); + if (m_CRS == null) { + m_CRS = layer.getCRS(); + } + } else if (obj instanceof ArrayList) { + final ArrayList list = (ArrayList) obj; + for (int j = 0; j < list.size(); j++) { + initInputDataObject(list.get(j)); + } + } + + } + + /** + * This method should implement the algorithm itself, using the values of + * the parameters and processing them. + * + * @return true if the algorithm was correctly executed. False if it was + * canceled. + * @throws GeoAlgorithmExecutionException + * if there were problems during algorithm execution + */ + public abstract boolean processAlgorithm() + throws GeoAlgorithmExecutionException; + + /** + * This method sets the output extent according to input layers, in case it + * hasn't been set. + * + * To do so, it takes the minimum extent that covers all input layers, and + * the minimum cellsize in case there are input raster layers. + * + * @return false if there are not enough layers to adjust the output extent + * for running this algorithm + */ + public boolean adjustOutputExtent() { + + boolean bRasterLayers = false; + boolean bLayers = false; + boolean bOK = true; + IRasterLayer rasterLayer; + RasterLayerAndBand rlab; + IVectorLayer vectorLayer; + ArrayList layers; + int i, j; + + if (!getUserCanDefineAnalysisExtent()) { + m_bIsAutoExtent = false; + return true; + } + + if (m_bIsAutoExtent && (m_AnalysisExtent != null)) { + return true; + } + + if (m_AnalysisExtent == null) { + m_bIsAutoExtent = true; + for (i = 0; i < m_Parameters.getNumberOfParameters(); i++) { + try { + if (m_Parameters.getParameter(i).getParameterTypeName() + .equals("Raster Layer") + || m_Parameters.getParameter(i) + .getParameterTypeName() + .equals("Image Layer")) { + rasterLayer = m_Parameters + .getParameterValueAsRasterLayer(m_Parameters + .getParameter(i).getParameterName()); + if (rasterLayer != null) { + if (!bRasterLayers) { + bLayers = true; + bRasterLayers = true; + m_AnalysisExtent = new AnalysisExtent( + rasterLayer); + } else { + if (!bRasterLayers) { + m_AnalysisExtent.setCellSizeX(rasterLayer + .getLayerGridExtent() + .getCellSizeX()); + m_AnalysisExtent.setCellSizeY(rasterLayer + .getLayerGridExtent() + .getCellSizeY()); + } + m_AnalysisExtent.addExtent(rasterLayer + .getLayerGridExtent()); + } + } + } else if (m_Parameters.getParameter(i) + .getParameterTypeName().equals("Vector Layer")) { + vectorLayer = m_Parameters + .getParameterValueAsVectorLayer(m_Parameters + .getParameter(i).getParameterName()); + if (vectorLayer != null) { + if (!bLayers) { + bLayers = true; + m_AnalysisExtent = new AnalysisExtent( + vectorLayer); + } else { + m_AnalysisExtent.addExtent(vectorLayer + .getFullExtent()); + } + } + } else if (m_Parameters.getParameter(i) + .getParameterTypeName().equals("Multiple Input")) { + final AdditionalInfoMultipleInput additionalInfo = (AdditionalInfoMultipleInput) m_Parameters + .getParameter(i).getParameterAdditionalInfo(); + if (additionalInfo.getDataType() == AdditionalInfoMultipleInput.DATA_TYPE_RASTER) { + layers = m_Parameters + .getParameterValueAsArrayList(m_Parameters + .getParameter(i).getParameterName()); + for (j = 0; j < layers.size(); j++) { + rasterLayer = (IRasterLayer) layers.get(j); + if (!bLayers) { + bLayers = true; + bRasterLayers = true; + m_AnalysisExtent = new AnalysisExtent( + rasterLayer); + } else { + m_AnalysisExtent.addExtent(rasterLayer + .getLayerGridExtent()); + } + } + } + if (additionalInfo.getDataType() == AdditionalInfoMultipleInput.DATA_TYPE_BAND) { + layers = m_Parameters + .getParameterValueAsArrayList(m_Parameters + .getParameter(i).getParameterName()); + for (j = 0; j < layers.size(); j++) { + rlab = (RasterLayerAndBand) layers.get(j); + rasterLayer = rlab.getRasterLayer(); + if (!bRasterLayers) { + bLayers = true; + bRasterLayers = true; + m_AnalysisExtent = new AnalysisExtent( + rasterLayer); + } else { + m_AnalysisExtent.addExtent(rasterLayer + .getLayerGridExtent()); + } + } + } + if ((additionalInfo.getDataType() == AdditionalInfoMultipleInput.DATA_TYPE_VECTOR_ANY) + || (additionalInfo.getDataType() == AdditionalInfoMultipleInput.DATA_TYPE_VECTOR_POINT) + || (additionalInfo.getDataType() == AdditionalInfoMultipleInput.DATA_TYPE_VECTOR_LINE) + || (additionalInfo.getDataType() == AdditionalInfoMultipleInput.DATA_TYPE_VECTOR_POLYGON)) { + layers = m_Parameters + .getParameterValueAsArrayList(m_Parameters + .getParameter(i).getParameterName()); + for (j = 0; j < layers.size(); j++) { + vectorLayer = (IVectorLayer) layers.get(j); + if (!bLayers) { + bLayers = true; + m_AnalysisExtent = new AnalysisExtent( + vectorLayer); + } else { + m_AnalysisExtent.addExtent(vectorLayer + .getFullExtent()); + } + } + } + } + } catch (final ArrayIndexOutOfBoundsException e) { + Sextante.addErrorToLog(e); + } catch (final WrongParameterTypeException e) { + Sextante.addErrorToLog(e); + } catch (final WrongParameterIDException e) { + Sextante.addErrorToLog(e); + } catch (final NullParameterValueException e) { + Sextante.addErrorToLog(e); + } catch (final NullParameterAdditionalInfoException e) { + Sextante.addErrorToLog(e); + } + } + if (m_OutputObjects.getOutputLayersCount() != 0) { + bOK = bOK && bLayers; + } + if (m_OutputObjects.getRasterLayersCount() != 0) { + bOK = bOK && bRasterLayers; + } + } else { + bOK = true; + m_bIsAutoExtent = false; + } + + return bOK; + + } + + /** + * Returns the name of the algorithm + * + * @return The algorithm name. Might return different strings depending on + * the current SEXTANTE language + */ + public String getName() { + + return m_sName; + + } + + /** + * Sets the algorithm name. Use this in the defineCharacteristics() method + * Use + * + * @see {@link Sextante#getText(String)} to support internationalization + * @param sName + * the name of the algorithm + */ + public void setName(final String sName) { + + m_sName = sName; + + } + + /** + * Returns the group this algorithm belongs to + * + * @return The group to which the algorithm belongs. Might return different + * strings depending on the current SEXTANTE language + */ + public String getGroup() { + + return m_sGroup; + + } + + /** + * Sets the name of the group this algorithm belongs to. Use this in the + * defineCharacteristics() method Use + * + * @see {@link Sextante#getText(String)} to support internationalization + * @param sGroup + * the name of the group + */ + public void setGroup(final String sGroup) { + + m_sGroup = sGroup; + + } + + /** + * Returns the description string of the algorithm + * + * @return The description. This string is user-definable and e.g. used by + * the graphical modeler to label processing nodes. + */ + public String getDescription() { + + return m_sDescription; + + } + + public int getColorR() { + return (i_R); + } + + public int getColorG() { + return (i_G); + } + + public int getColorB() { + return (i_B); + } + + public int getColorAlpha() { + return (i_Alpha); + } + + /** + * Sets the algorithm's description string. null by default. This string is + * e.g. used by the graphical modeler to label processing nodes. + * + * @param sDescription + * description string to be associated with this algorithm + */ + public void setDescription(final String sDescription) { + + m_sDescription = sDescription; + + } + + public void setColorR(final int red) { + i_R = red; + } + + public void setColorG(final int green) { + i_G = green; + } + + public void setColorB(final int blue) { + i_B = blue; + } + + public void setColorAlpha(final int alpha) { + i_Alpha = alpha; + } + + /** + * + * @return the set of parameters needed to run the algorithm + */ + public ParametersSet getParameters() { + + return m_Parameters; + + } + + /** + * sets a new set of parameters for the algorithm + * + * @param parameters + * the new set of parameters + */ + public void setParameters(final ParametersSet parameters) { + + m_Parameters = parameters; + + } + + /** + * Returns the extent that will be used to analyse layers and create create + * new output layers + * + * @return The extent that will be used to analyse layers and create create + * new output layers + */ + public AnalysisExtent getAnalysisExtent() { + + return m_AnalysisExtent; + + } + + /** + * Sets a new extent will be used to analyse layers and create create new + * output layers + * + * @param extent + * the new extent that will be used to analyse layers and create + * create new output layers + */ + public void setAnalysisExtent(final AnalysisExtent extent) { + + m_AnalysisExtent = extent; + + } + + /** + * Sets the current step in the progress bar, based on the ratio between the + * current task step and the total number of steps needed to complete the + * task + * + * @param iStep + * the current step + * @param iTotalNumberOfSteps + * the total number of steps + * @return true if the task hasn't been canceled + */ + protected boolean setProgress(final int iStep, final int iTotalNumberOfSteps) { + + m_Task.setProgress(iStep, iTotalNumberOfSteps); + return !m_Task.isCanceled(); + + } + + /** + * Shows an informational message in the progress monitor's text area. + * + * @param sMsg + * the message string + */ + public void showInfo(final String sMsg) { + m_Task.showInfo(sMsg); + } + + /** + * Shows a warning message in the progress monitor's text area. + * + * @param sMsg + * the message string + */ + public void showWarning(final String sMsg) { + m_Task.showWarning(sMsg); + } + + /** + * Shows an error message in the progress monitor's text area. + * + * @param sMsg + * the message string + */ + public void showError(final String sMsg) { + m_Task.showError(sMsg); + } + + /** + * Shows a note in the progress monitor's text area. + * + * @param sMsg + * the message string + */ + public void showNote(final String sMsg) { + m_Task.showNote(sMsg); + } + + /** + * Sets the current progress text. Use this to inform the user about the + * work that the algorithm is currently doing. + * + * @param sText + * the new progress text + */ + protected void setProgressText(final String sText) { + + m_Task.setProgressText(sText); + + } + + /** + * + * @return true if the algorithm requires parameters other than input layers + * or tables + */ + public boolean requiresNonDataObjects() { + + return m_Parameters.requiresNonDataObjects(); + + } + + /** + * @return The number of parameters needed to run the algorithm + */ + public int getNumberOfParameters() { + @@ Diff output truncated at 100000 characters. @@ ------------------------------------------------------------------------------ _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel