This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sis.git
commit 09d75edb69aaaaea5c0f394c768ac7cdf4a5de80 Merge: 78262e7625 b2d141b5e9 Author: Martin Desruisseaux <[email protected]> AuthorDate: Thu Jun 30 12:13:16 2022 +0200 Merge branch 'geoapi-3.1' application/sis-console/src/main/artifact/README | 6 +- .../org/apache/sis/console/TransformCommand.java | 4 +- application/sis-javafx/pom.xml | 5 + application/sis-javafx/src/main/artifact/README | 4 +- .../main/java/org/apache/sis/gui/DataViewer.java | 13 +- .../apache/sis/gui/coverage/CoverageCanvas.java | 286 ++++--- .../apache/sis/gui/coverage/CoverageControls.java | 107 +-- .../apache/sis/gui/coverage/CoverageExplorer.java | 128 ++- .../apache/sis/gui/coverage/CoverageStyling.java | 12 +- .../org/apache/sis/gui/coverage/GridControls.java | 45 +- .../apache/sis/gui/coverage/GridSliceSelector.java | 638 +++++++++++++++ .../java/org/apache/sis/gui/coverage/GridView.java | 95 ++- .../org/apache/sis/gui/coverage/GridViewSkin.java | 19 +- .../org/apache/sis/gui/coverage/ImageRequest.java | 181 ++--- .../gui/coverage/MultiResolutionImageLoader.java | 74 +- .../apache/sis/gui/coverage/ViewAndControls.java | 188 +++-- .../org/apache/sis/gui/coverage/package-info.java | 2 +- .../org/apache/sis/gui/dataset/DataWindow.java | 116 --- .../org/apache/sis/gui/dataset/FeatureTable.java | 7 +- .../java/org/apache/sis/gui/dataset/LoadEvent.java | 47 -- .../java/org/apache/sis/gui/dataset/LogViewer.java | 2 +- .../org/apache/sis/gui/dataset/ResourceEvent.java | 2 +- .../apache/sis/gui/dataset/ResourceExplorer.java | 170 ++-- .../org/apache/sis/gui/dataset/ResourceTree.java | 113 +-- .../org/apache/sis/gui/dataset/SelectedData.java | 91 --- .../org/apache/sis/gui/dataset/WindowHandler.java | 474 +++++++++++ .../org/apache/sis/gui/dataset/WindowManager.java | 246 ++---- .../org/apache/sis/gui/dataset/package-info.java | 2 +- .../org/apache/sis/gui/map/GestureFollower.java | 293 +++++++ .../java/org/apache/sis/gui/map/MapCanvas.java | 339 +++++++- .../java/org/apache/sis/gui/map/MapCanvasAWT.java | 16 +- .../main/java/org/apache/sis/gui/map/MapMenu.java | 4 +- .../org/apache/sis/gui/map/OperationFinder.java | 8 +- .../java/org/apache/sis/gui/map/StatusBar.java | 862 ++++++++++++++++----- .../org/apache/sis/gui/map/ValuesUnderCursor.java | 74 +- .../java/org/apache/sis/gui/map/package-info.java | 2 +- .../org/apache/sis/gui/metadata/MetadataTree.java | 4 +- .../main/java/org/apache/sis/gui/package-info.java | 2 +- .../apache/sis/gui/referencing/AuthorityCodes.java | 4 +- .../org/apache/sis/gui/referencing/MenuSync.java | 291 +++++-- .../sis/gui/referencing/ObjectStringConverter.java | 14 +- .../gui/referencing/PositionableProjection.java | 4 +- .../gui/referencing/RecentReferenceSystems.java | 391 +++++++--- .../java/org/apache/sis/gui/referencing/Utils.java | 4 +- .../apache/sis/internal/gui/BackgroundThreads.java | 28 +- .../apache/sis/internal/gui/DataStoreOpener.java | 106 ++- .../apache/sis/internal/gui/ExceptionReporter.java | 62 +- .../org/apache/sis/internal/gui/GUIUtilities.java | 54 +- .../apache/sis/internal/gui/ImageConverter.java | 4 +- .../sis/internal/gui/OptionalDataDownloader.java | 2 +- .../org/apache/sis/internal/gui/PrivateAccess.java | 54 ++ .../org/apache/sis/internal/gui/Resources.java | 15 + .../apache/sis/internal/gui/Resources.properties | 3 + .../sis/internal/gui/Resources_fr.properties | 3 + .../java/org/apache/sis/internal/gui/Styles.java | 13 +- .../org/apache/sis/internal/gui/ToolbarButton.java | 8 +- .../internal/gui/control/ColorColumnHandler.java | 5 +- .../sis/internal/gui/control/SyncWindowList.java | 252 ++++++ .../sis/internal/gui/control/TabularWidget.java | 99 +++ .../sis/internal/gui/control/ValueColorMapper.java | 26 +- .../sis/internal/gui/control/package-info.java | 2 +- .../org/apache/sis/internal/gui/package-info.java | 2 +- .../apache/sis/gui/coverage/CoverageCanvasApp.java | 4 +- .../sis/gui/coverage/GridSliceSelectorApp.java | 80 ++ .../java/org/apache/sis/openoffice/CalcAddins.java | 3 +- .../org/apache/sis/internal/book/Assembler.java | 111 +-- .../book/{Resources.java => Characters.java} | 37 +- .../apache/sis/internal/book/CodeColorizer.java | 37 +- .../org/apache/sis/internal/book/Resources_en.java | 33 - .../org/apache/sis/internal/book/Resources_fr.java | 47 -- .../org/apache/sis/internal/book/package-info.java | 8 +- .../org/apache/sis/internal/doclet/Rewriter.java | 3 +- .../sis/coverage/grid/BufferedGridCoverage.java | 82 +- .../sis/coverage/grid/ConvertedGridCoverage.java | 66 +- .../coverage/grid/CoordinateOperationFinder.java | 8 +- .../apache/sis/coverage/grid/DomainLinearizer.java | 2 +- .../org/apache/sis/coverage/grid/GridCoverage.java | 17 +- .../apache/sis/coverage/grid/GridCoverage2D.java | 5 +- .../sis/coverage/grid/GridCoverageBuilder.java | 2 +- .../sis/coverage/grid/GridCoverageProcessor.java | 86 +- .../apache/sis/coverage/grid/GridDerivation.java | 39 +- .../apache/sis/coverage/grid/GridEvaluator.java | 207 ++++- .../org/apache/sis/coverage/grid/GridExtent.java | 357 ++++++--- .../apache/sis/coverage/grid/GridExtentCRS.java | 266 ++++++- .../org/apache/sis/coverage/grid/GridGeometry.java | 124 ++- .../apache/sis/coverage/grid/ImageRenderer.java | 18 +- .../sis/coverage/grid/ResampledGridCoverage.java | 13 +- .../apache/sis/coverage/grid/ReshapedImage.java | 31 +- .../apache/sis/coverage/grid/SliceGeometry.java | 9 +- .../org/apache/sis/coverage/grid/package-info.java | 2 +- .../java/org/apache/sis/feature/FeatureFormat.java | 4 +- .../java/org/apache/sis/image/AnnotatedImage.java | 9 +- .../java/org/apache/sis/image/BandSelectImage.java | 23 +- .../apache/sis/image/BandedSampleConverter.java | 60 +- .../java/org/apache/sis/image/ComputedImage.java | 27 + .../main/java/org/apache/sis/image/DataType.java | 14 +- .../java/org/apache/sis/image/ErrorAction.java | 5 +- .../java/org/apache/sis/image/ImageAdapter.java | 11 +- .../java/org/apache/sis/image/ImageProcessor.java | 18 +- .../main/java/org/apache/sis/image/MaskImage.java | 32 +- .../java/org/apache/sis/image/MaskedImage.java | 9 +- .../java/org/apache/sis/image/PlanarImage.java | 10 + .../sis/image/PositionalConsistencyImage.java | 23 +- .../java/org/apache/sis/image/PrefetchedImage.java | 30 +- .../java/org/apache/sis/image/RecoloredImage.java | 8 +- .../java/org/apache/sis/image/ResampledImage.java | 13 +- .../org/apache/sis/image/SourceAlignedImage.java | 28 +- .../org/apache/sis/image/StatisticsCalculator.java | 2 +- .../java/org/apache/sis/image/Visualization.java | 26 +- .../java/org/apache/sis/image/package-info.java | 2 +- .../sis/internal/coverage/CoverageCombiner.java | 4 +- .../internal/coverage/j2d/ColorModelFactory.java | 2 +- .../sis/internal/coverage/j2d/ImageUtilities.java | 4 +- .../org/apache/sis/internal/feature/Resources.java | 5 + .../sis/internal/feature/Resources.properties | 1 + .../sis/internal/feature/Resources_fr.properties | 1 + .../org/apache/sis/internal/feature/jts/JTS.java | 25 +- .../java/org/apache/sis/internal/filter/Node.java | 2 +- .../internal/filter/sqlmm/FunctionWithSRID.java | 8 +- .../sis/internal/filter/sqlmm/OneGeometry.java | 4 +- .../sis/internal/filter/sqlmm/TwoGeometries.java | 4 +- .../sis/internal/filter/sqlmm/package-info.java | 2 +- .../coverage/grid/ConvertedGridCoverageTest.java | 47 +- .../sis/coverage/grid/GridDerivationTest.java | 33 +- .../apache/sis/coverage/grid/GridExtentTest.java | 80 +- .../apache/sis/coverage/grid/GridGeometryTest.java | 59 +- .../apache/sis/image/StatisticsCalculatorTest.java | 6 +- .../apache/sis/internal/feature/jts/JTSTest.java | 16 + .../internal/filter/sqlmm/RegistryTestCase.java | 5 +- .../sis/internal/filter/sqlmm/SQLMMTest.java | 65 +- .../sis/internal/geoapi/evolution/Interim.java | 4 +- .../java/org/apache/sis/internal/jaxb/Context.java | 3 +- .../apache/sis/internal/metadata/AxisNames.java | 4 +- .../sis/internal/metadata/ServicesForUtility.java | 5 +- .../sis/internal/metadata/sql/Initializer.java | 7 +- .../sis/internal/metadata/sql/LocalDataSource.java | 4 +- .../sis/internal/simple/CitationConstant.java | 4 +- .../apache/sis/metadata/PropertyInformation.java | 5 +- .../sis/metadata/StandardImplementation.java | 4 +- .../apache/sis/metadata/sql/CachedStatement.java | 3 +- .../main/java/org/apache/sis/util/iso/Types.java | 4 +- .../java/org/apache/sis/xml/MarshallerPool.java | 4 +- .../src/main/java/org/apache/sis/xml/XLink.java | 4 +- .../identification/DefaultBrowseGraphicTest.java | 6 +- .../sis/test/xml/AnnotationConsistencyCheck.java | 2 +- .../coverage/MultiResolutionCoverageLoader.java | 28 +- .../sis/internal/map/coverage/RenderingData.java | 121 ++- .../sis/internal/map/coverage/package-info.java | 2 +- .../main/java/org/apache/sis/portrayal/Canvas.java | 139 ++-- .../org/apache/sis/portrayal/CanvasExtent.java | 10 +- .../org/apache/sis/portrayal/CanvasFollower.java | 534 +++++++++++++ .../java/org/apache/sis/portrayal/Observable.java | 24 +- .../org/apache/sis/portrayal/PlanarCanvas.java | 40 +- .../apache/sis/portrayal/TransformChangeEvent.java | 380 +++++++++ .../org/apache/sis/portrayal/package-info.java | 2 +- .../apache/sis/internal/gazetteer/Resources.java | 5 + .../sis/internal/gazetteer/Resources.properties | 1 + .../sis/internal/gazetteer/Resources_fr.properties | 1 + .../referencing/gazetteer/GazetteerFactory.java | 106 +++ .../gazetteer/GeohashReferenceSystem.java | 214 ++++- .../gazetteer/MilitaryGridReferenceSystem.java | 204 ++++- .../gazetteer/ReferencingByIdentifiers.java | 144 +++- .../sis/referencing/gazetteer/package-info.java | 2 +- .../gazetteer/GazetteerFactoryTest.java | 55 ++ .../gazetteer/GeohashReferenceSystemTest.java | 111 ++- .../gazetteer/MilitaryGridReferenceSystemTest.java | 32 +- .../gazetteer/ReferencingByIdentifiersTest.java | 8 +- .../suite/ReferencingByIdentifiersTestSuite.java | 5 +- .../org/apache/sis/geometry/CoordinateFormat.java | 94 ++- .../org/apache/sis/geometry/DirectPosition2D.java | 14 +- .../java/org/apache/sis/geometry/Envelopes.java | 132 +++- .../apache/sis/geometry/WraparoundAdjustment.java | 4 +- .../java/org/apache/sis/geometry/package-info.java | 2 +- .../sis/internal/referencing/DatabaseListener.java | 4 +- .../apache/sis/internal/referencing/Formulas.java | 17 +- .../internal/referencing/ServicesForMetadata.java | 4 +- .../sis/internal/referencing/j2d/AffineMatrix.java | 42 +- .../referencing/j2d/AffineTransform2D.java | 57 +- .../sis/internal/referencing/j2d/package-info.java | 2 +- .../sis/internal/referencing/package-info.java | 2 +- .../referencing/provider/AbstractProvider.java | 4 +- .../referencing/provider/Equirectangular.java | 2 +- .../referencing/provider/GeocentricAffine.java | 4 +- .../java/org/apache/sis/io/wkt/AbstractParser.java | 3 +- .../sis/parameter/DefaultParameterValue.java | 3 +- .../org/apache/sis/parameter/ParameterFormat.java | 18 +- .../org/apache/sis/parameter/package-info.java | 2 +- .../main/java/org/apache/sis/referencing/CRS.java | 9 +- .../java/org/apache/sis/referencing/CommonCRS.java | 3 +- .../apache/sis/referencing/IdentifiedObjects.java | 3 +- .../sis/referencing/crs/DefaultProjectedCRS.java | 3 +- .../sis/referencing/crs/DefaultTemporalCRS.java | 48 +- .../apache/sis/referencing/crs/package-info.java | 2 +- .../org/apache/sis/referencing/cs/AbstractCS.java | 3 +- .../org/apache/sis/referencing/cs/AxisName.java | 84 ++ .../sis/referencing/cs/CoordinateSystems.java | 24 +- .../sis/referencing/cs/DirectionAlongMeridian.java | 4 +- .../apache/sis/referencing/cs/package-info.java | 2 +- .../sis/referencing/datum/DefaultEllipsoid.java | 21 +- .../referencing/datum/DefaultGeodeticDatum.java | 5 +- .../apache/sis/referencing/datum/package-info.java | 2 +- .../factory/CommonAuthorityFactory.java | 4 +- .../factory/ConcurrentAuthorityFactory.java | 4 +- .../referencing/factory/GeodeticObjectFactory.java | 3 +- .../factory/sql/CloseableReference.java | 4 +- .../referencing/factory/sql/EPSGCodeFinder.java | 3 +- .../referencing/factory/sql/EPSGDataAccess.java | 6 +- .../operation/AbstractCoordinateOperation.java | 3 +- .../operation/CoordinateOperationRegistry.java | 4 +- .../operation/matrix/AffineTransforms2D.java | 2 +- .../operation/projection/Initializer.java | 2 +- .../referencing/operation/projection/Mercator.java | 84 +- .../operation/projection/NormalizedProjection.java | 3 +- .../operation/transform/ConcatenatedTransform.java | 4 +- .../transform/ConcatenatedTransform2D.java | 2 +- .../operation/transform/ContextualParameters.java | 32 +- .../transform/DefaultMathTransformFactory.java | 6 +- .../transform/PassThroughTransform2D.java | 2 +- .../operation/transform/WraparoundTransform.java | 10 +- .../operation/transform/package-info.java | 2 +- .../apache/sis/geometry/CoordinateFormatTest.java | 11 +- .../org/apache/sis/geometry/EnvelopesTest.java | 22 +- .../sis/internal/referencing/FormulasTest.java | 15 +- .../referencing/crs/DefaultTemporalCRSTest.java | 15 +- .../sis/referencing/cs/CoordinateSystemsTest.java | 13 +- .../referencing/datum/DefaultEllipsoidTest.java | 14 +- .../factory/ConcurrentAuthorityFactoryTest.java | 4 +- .../sis/referencing/factory/TestFactorySource.java | 6 +- .../operation/projection/MercatorTest.java | 50 +- .../apache/sis/internal/system/DataDirectory.java | 4 +- .../sis/internal/system/DefaultFactories.java | 6 +- .../sis/internal/system/DelayedExecutor.java | 4 +- .../org/apache/sis/internal/system/Loggers.java | 4 +- .../internal/system/ReferenceQueueConsumer.java | 4 +- .../org/apache/sis/internal/system/Shutdown.java | 4 +- .../org/apache/sis/internal/system/Threads.java | 4 +- .../apache/sis/internal/util/AbstractIterator.java | 2 +- .../apache/sis/internal/util/CollectionsExt.java | 2 +- .../org/apache/sis/internal/util/Constants.java | 2 +- .../apache/sis/internal/util/DefinitionURI.java | 5 +- .../org/apache/sis/internal/util/package-info.java | 2 +- .../main/java/org/apache/sis/io/package-info.java | 2 +- .../src/main/java/org/apache/sis/math/Vector.java | 3 +- .../org/apache/sis/measure/AbstractConverter.java | 3 + .../java/org/apache/sis/measure/AbstractUnit.java | 4 +- .../java/org/apache/sis/measure/NumberRange.java | 36 +- .../java/org/apache/sis/measure/UnitFormat.java | 4 +- .../java/org/apache/sis/measure/UnitServices.java | 4 +- .../main/java/org/apache/sis/measure/Units.java | 1 + .../java/org/apache/sis/measure/package-info.java | 2 +- .../src/main/java/org/apache/sis/setup/About.java | 22 +- .../main/java/org/apache/sis/setup/OptionKey.java | 8 +- .../java/org/apache/sis/util/ArgumentChecks.java | 2 +- .../main/java/org/apache/sis/util/Exceptions.java | 48 +- .../src/main/java/org/apache/sis/util/Locales.java | 3 +- .../org/apache/sis/util/collection/WeakEntry.java | 3 +- .../org/apache/sis/util/logging/DualLogger.java | 107 --- .../apache/sis/util/logging/DualLoggerFactory.java | 89 --- .../org/apache/sis/util/logging/LoggerAdapter.java | 806 ------------------- .../org/apache/sis/util/logging/LoggerFactory.java | 153 ---- .../java/org/apache/sis/util/logging/Logging.java | 123 +-- .../apache/sis/util/logging/MonolineFormatter.java | 8 +- .../apache/sis/util/logging/PerformanceLevel.java | 30 +- .../org/apache/sis/util/logging/package-info.java | 31 +- .../java/org/apache/sis/util/package-info.java | 2 +- .../sis/util/resources/IndexedResourceBundle.java | 16 +- .../org/apache/sis/util/resources/Vocabulary.java | 18 +- .../sis/util/resources/Vocabulary.properties | 4 +- .../sis/util/resources/Vocabulary_fr.properties | 6 +- .../apache/sis/util/resources/package-info.java | 2 +- .../org/apache/sis/measure/NumberRangeTest.java | 43 +- .../java/org/apache/sis/test/LoggingWatcher.java | 2 +- .../apache/sis/test/suite/UtilityTestSuite.java | 1 - .../org/apache/sis/util/logging/DummyLogger.java | 114 --- .../apache/sis/util/logging/LoggerAdapterTest.java | 74 -- .../sis/util/logging/PerformanceLevelTest.java | 38 +- ide-project/NetBeans/nbproject/project.properties | 2 +- pom.xml | 3 +- storage/sis-earth-observation/pom.xml | 2 +- .../org/apache/sis/storage/landsat/BandGroup.java | 14 +- .../apache/sis/storage/landsat/LandsatStore.java | 5 +- .../apache/sis/storage/landsat/package-info.java | 2 +- .../storage/inflater/CompressionChannel.java | 28 +- .../storage/inflater/HorizontalPredictor.java | 49 +- .../sis/internal/storage/inflater/Inflater.java | 5 +- .../internal/storage/inflater/PixelChannel.java | 2 +- .../storage/inflater/PredictorChannel.java | 34 +- .../internal/storage/inflater/package-info.java | 2 +- .../apache/sis/storage/geotiff/GeoTiffStore.java | 26 +- .../sis/storage/geotiff/GridGeometryBuilder.java | 2 +- .../sis/storage/geotiff/ImageFileDirectory.java | 23 +- .../sis/storage/geotiff/MultiResolutionImage.java | 31 +- .../java/org/apache/sis/storage/geotiff/Type.java | 7 +- .../apache/sis/storage/geotiff/package-info.java | 2 +- .../org/apache/sis/internal/netcdf/Decoder.java | 8 +- .../sis/internal/netcdf/DiscreteSampling.java | 24 +- .../org/apache/sis/internal/netcdf/FeatureSet.java | 11 +- .../org/apache/sis/internal/netcdf/Raster.java | 37 +- .../apache/sis/internal/netcdf/RasterResource.java | 26 +- .../apache/sis/internal/netcdf/package-info.java | 2 +- .../sis/internal/netcdf/ucar/DecoderWrapper.java | 5 +- .../sis/internal/netcdf/ucar/FeaturesWrapper.java | 5 +- .../sis/internal/netcdf/ucar/package-info.java | 2 +- .../org/apache/sis/storage/netcdf/NetcdfStore.java | 5 +- .../apache/sis/storage/netcdf/package-info.java | 2 +- .../apache/sis/internal/shapefile/AutoChecker.java | 4 +- .../sis/storage/shapefile/InputFeatureStream.java | 3 +- .../jdbc/AbstractTestBaseForInternalJDBC.java | 3 +- .../sis/storage/shapefile/ShapeFileTest.java | 4 +- .../java/org/apache/sis/storage/sql/SQLStore.java | 5 +- .../org/apache/sis/storage/sql/package-info.java | 2 +- .../internal/storage/DocumentedStoreProvider.java | 4 +- .../org/apache/sis/internal/storage/Resources.java | 5 + .../sis/internal/storage/Resources.properties | 1 + .../sis/internal/storage/Resources_fr.properties | 1 + .../apache/sis/internal/storage/StoreResource.java | 29 +- .../sis/internal/storage/StoreUtilities.java | 3 +- .../sis/internal/storage/TiledGridCoverage.java | 4 +- .../org/apache/sis/internal/storage/csv/Store.java | 5 +- .../sis/internal/storage/csv/package-info.java | 2 +- .../sis/internal/storage/esri/AsciiGridStore.java | 3 +- .../sis/internal/storage/esri/RasterStore.java | 3 +- .../sis/internal/storage/esri/RawRasterStore.java | 3 +- .../sis/internal/storage/esri/WritableStore.java | 3 +- .../sis/internal/storage/esri/package-info.java | 2 +- .../apache/sis/internal/storage/folder/Store.java | 5 +- .../sis/internal/storage/folder/package-info.java | 2 +- .../sis/internal/storage/image/WorldFileStore.java | 48 +- .../sis/internal/storage/image/WritableStore.java | 3 +- .../sis/internal/storage/image/package-info.java | 2 +- .../org/apache/sis/internal/storage/wkt/Store.java | 5 +- .../sis/internal/storage/wkt/package-info.java | 2 +- .../org/apache/sis/internal/storage/xml/Store.java | 5 +- .../sis/internal/storage/xml/package-info.java | 2 +- .../sis/storage/AbstractGridCoverageResource.java | 2 +- .../org/apache/sis/storage/CoverageSubset.java | 5 +- .../java/org/apache/sis/storage/DataStore.java | 18 +- .../java/org/apache/sis/storage/FeatureSubset.java | 5 +- .../org/apache/sis/storage/StorageConnector.java | 14 + .../sis/storage/event/CascadedStoreEvent.java | 131 ++++ .../org/apache/sis/storage/event/CloseEvent.java | 62 ++ .../org/apache/sis/storage/event/StoreEvent.java | 47 +- .../apache/sis/storage/event/StoreListener.java | 6 +- .../apache/sis/storage/event/StoreListeners.java | 332 ++++++-- .../org/apache/sis/storage/event/package-info.java | 2 +- .../java/org/apache/sis/storage/package-info.java | 2 +- .../storage/io/ChannelImageInputStreamTest.java | 1 + .../java/org/apache/sis/storage/DataStoreMock.java | 15 +- .../sis/storage/event/StoreListenersTest.java | 39 +- .../apache/sis/test/storage/SubsampledImage.java | 27 +- .../org/apache/sis/internal/storage/gpx/Store.java | 5 +- .../sis/internal/storage/gpx/package-info.java | 2 +- .../internal/storage/xml/stream/StaxDataStore.java | 4 + 353 files changed, 10299 insertions(+), 4539 deletions(-) diff --cc application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageExplorer.java index 5b2b938e5e,9823132672..68e811310f --- a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageExplorer.java +++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageExplorer.java @@@ -62,10 -68,10 +68,10 @@@ import org.apache.sis.gui.Widget * * <h2>Limitations</h2> * Current implementation is restricted to {@link GridCoverage} instances, but a future - * implementation may generalize to {@link org.opengis.coverage.Coverage} instances. + * implementation may generalize to {@code org.opengis.coverage.Coverage} instances. * * @author Martin Desruisseaux (Geomatys) - * @version 1.2 + * @version 1.3 * * @see CoverageCanvas * @see GridView diff --cc application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/FeatureTable.java index 64582f1054,9e023999ea..b1ad7d7305 --- a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/FeatureTable.java +++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/FeatureTable.java @@@ -46,11 -51,8 +46,14 @@@ import org.apache.sis.internal.feature. import org.apache.sis.internal.gui.IdentityValueFactory; import org.apache.sis.internal.gui.ExceptionReporter; + import static java.util.logging.Logger.getLogger; + ++// Branch-dependent imports +import org.apache.sis.feature.AbstractFeature; +import org.apache.sis.feature.DefaultFeatureType; +import org.apache.sis.feature.AbstractIdentifiedType; +import org.apache.sis.feature.DefaultAttributeType; + /** * A view of {@link FeatureSet} data organized as a table. The features are specified by a call diff --cc application/sis-javafx/src/main/java/org/apache/sis/gui/map/StatusBar.java index 1f2496a503,7e62bffa90..ce79908eac --- a/application/sis-javafx/src/main/java/org/apache/sis/gui/map/StatusBar.java +++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/map/StatusBar.java @@@ -581,6 -692,50 +692,49 @@@ public class StatusBar extends Widget i */ public void applyCanvasGeometry(final GridGeometry geometry) { position.setText(null); + xDimension = 0; + yDimension = 1; + apply(geometry); + } + + /** + * Configures this status bar for showing coordinates of a slice of a grid coverage. + * This method is useful for tracking the pixel coordinates of an image obtained by + * a call to {@link GridCoverage#render(GridExtent)}. + * By {@code render(GridExtent)} contract, the {@link RenderedImage} pixel coordinates + * are relative to the requested {@link GridExtent}. Consequently we need to translate + * the grid coordinates so that the request coordinates start at zero. + * This method handles that translation. + * + * @param geometry geometry of the coverage which produced the {@link RenderedImage} to track, or {@code null}. + * @param sliceExtent the extent specified in call to {@link GridCoverage#render(GridExtent)} (can be {@code null}). + * @param xdim the grid dimension where to assign the values of <var>x</var> pixel coordinates. + * @param ydim the grid dimension where to assign the values of <var>y</var> pixel coordinates. + * + * @since 1.3 + */ + public void applyCanvasGeometry(GridGeometry geometry, GridExtent sliceExtent, final int xdim, final int ydim) { + position.setText(null); + if (geometry != null) { + final int dimension = geometry.getDimension(); - ArgumentChecks.ensureDimensionMatches("sliceExtent", dimension, sliceExtent); + ArgumentChecks.ensureBetween("xdim", 0, dimension-1, xdim); + ArgumentChecks.ensureBetween("ydim", xdim+1, dimension-1, ydim); + xDimension = xdim; + yDimension = ydim; // Shall be assigned before call to `getXYDimensions()` below. + if (sliceExtent != null) { + final long[] offset = new long[dimension]; + for (final int i : getXYDimensions()) { + offset[i] = Math.negateExact(sliceExtent.getLow(i)); + } + sliceExtent = sliceExtent.translate(offset); + geometry = geometry.translate(offset); // Does not change the "real world" envelope. + try { + geometry = geometry.relocate(sliceExtent); // Changes the "real world" envelope. + } catch (TransformException e) { + setErrorMessage(null, e); + } + } + } apply(geometry); } diff --cc application/sis-javafx/src/main/java/org/apache/sis/gui/map/ValuesUnderCursor.java index 23e0041ca4,8a8a1e0c2a..7b20e57370 --- a/application/sis-javafx/src/main/java/org/apache/sis/gui/map/ValuesUnderCursor.java +++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/map/ValuesUnderCursor.java @@@ -50,11 -52,11 +51,12 @@@ import org.apache.sis.math.MathFunction import org.apache.sis.measure.NumberRange; import org.apache.sis.measure.UnitFormat; import org.apache.sis.util.Characters; - import org.apache.sis.util.Localized; import org.apache.sis.util.logging.Logging; import org.apache.sis.util.resources.Vocabulary; +import org.apache.sis.coverage.CannotEvaluateException; + import static java.util.logging.Logger.getLogger; + /** * Provider of textual content to show in a {@link StatusBar} for values under cursor position. diff --cc core/sis-feature/src/main/java/org/apache/sis/coverage/grid/ConvertedGridCoverage.java index 68e1cde3c3,8c30d9b63d..43b601f938 --- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/ConvertedGridCoverage.java +++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/ConvertedGridCoverage.java @@@ -30,7 -32,7 +31,8 @@@ import org.apache.sis.coverage.SampleDi import org.apache.sis.measure.MeasurementRange; import org.apache.sis.measure.NumberRange; import org.apache.sis.image.DataType; +import org.apache.sis.coverage.CannotEvaluateException; + import org.apache.sis.image.ImageProcessor; /** diff --cc core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverage2D.java index cac591c6c7,273e8b2e53..5e3a75548d --- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverage2D.java +++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverage2D.java @@@ -540,11 -541,12 +541,11 @@@ public class GridCoverage2D extends Gri return null; } throw (PointOutsideCoverageException) new PointOutsideCoverageException( - gc.pointOutsideCoverage(gridGeometry.extent), point).initCause(ex); + gc.pointOutsideCoverage(gridGeometry.extent)).initCause(ex); } } catch (PointOutsideCoverageException ex) { - ex.setOffendingLocation(point); throw ex; - } catch (RuntimeException | TransformException ex) { + } catch (RuntimeException | FactoryException | TransformException ex) { throw new CannotEvaluateException(ex.getMessage(), ex); } } diff --cc core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridEvaluator.java index 8a38c1a27e,6a40742dbb..11b09923dd --- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridEvaluator.java +++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridEvaluator.java @@@ -26,18 -30,27 +30,27 @@@ import org.opengis.referencing.operatio import org.opengis.referencing.operation.TransformException; import org.opengis.referencing.operation.CoordinateOperation; import org.opengis.referencing.crs.CoordinateReferenceSystem; + import org.opengis.referencing.operation.NoninvertibleTransformException; -import org.opengis.coverage.CannotEvaluateException; -import org.opengis.coverage.PointOutsideCoverageException; import org.apache.sis.coverage.SampleDimension; + import org.apache.sis.internal.feature.Resources; + import org.apache.sis.internal.util.CollectionsExt; import org.apache.sis.internal.coverage.j2d.ImageUtilities; import org.apache.sis.internal.referencing.DirectPositionView; import org.apache.sis.internal.referencing.WraparoundAxesFinder; + import org.apache.sis.referencing.operation.matrix.Matrices; + import org.apache.sis.referencing.operation.matrix.MatrixSIS; import org.apache.sis.referencing.operation.transform.MathTransforms; + import org.apache.sis.referencing.operation.transform.TransformSeparator; import org.apache.sis.referencing.CRS; import org.apache.sis.internal.system.Modules; + import org.apache.sis.util.ArraysExt; import org.apache.sis.util.ArgumentChecks; import org.apache.sis.util.logging.Logging; +import org.apache.sis.coverage.CannotEvaluateException; +import org.apache.sis.coverage.PointOutsideCoverageException; + import static java.util.logging.Logger.getLogger; + /** * Computes or interpolates values of sample dimensions at given positions. @@@ -301,8 -380,9 +380,8 @@@ public class GridEvaluator implements G } } } catch (PointOutsideCoverageException ex) { - ex.setOffendingLocation(point); throw ex; - } catch (RuntimeException | TransformException ex) { + } catch (RuntimeException | FactoryException | TransformException ex) { throw new CannotEvaluateException(ex.getMessage(), ex); } return null; // May reach this point only if `nullIfOutside` is true. diff --cc core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java index 8eda52b18b,6b40ce9100..f4df0847a1 --- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java +++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java @@@ -62,10 -65,15 +65,11 @@@ import org.apache.sis.util.LenientCompa import org.apache.sis.util.iso.Types; import org.apache.sis.util.logging.Logging; import org.apache.sis.internal.system.Modules; +import org.apache.sis.coverage.CannotEvaluateException; +import org.apache.sis.coverage.PointOutsideCoverageException; + import static java.util.logging.Logger.getLogger; -// Branch-dependent imports -import org.opengis.coverage.grid.GridEnvelope; -import org.opengis.coverage.grid.GridCoordinates; -import org.opengis.coverage.CannotEvaluateException; -import org.opengis.coverage.PointOutsideCoverageException; - /** * A range of grid coverage coordinates, also known as "grid envelope". @@@ -81,13 -89,9 +85,13 @@@ * <p>{@code GridExtent} instances are immutable and thread-safe. * The same instance can be shared by different {@link GridGeometry} instances.</p> * + * <div class="note"><b>Upcoming API generalization:</b> + * this class may implement the {@code GridEnvelope} interface in a future Apache SIS version. + * This is pending GeoAPI update.</div> + * * @author Martin Desruisseaux (IRD, Geomatys) * @author Alexis Manin (Geomatys) - * @version 1.2 + * @version 1.3 * @since 1.0 * @module */ @@@ -647,8 -689,11 +651,10 @@@ public class GridExtent implements Seri * The sequence contains a minimum value for each dimension of the grid coverage. * * @return the valid minimum grid coordinates, inclusive. + * + * @see #getLow(int) */ - @Override - public GridCoordinates getLow() { + GridCoordinatesView getLow() { return new GridCoordinatesView(coordinates, 0); } @@@ -657,8 -702,11 +663,10 @@@ * The sequence contains a maximum value for each dimension of the grid coverage. * * @return the valid maximum grid coordinates, <strong>inclusive</strong>. + * + * @see #getHigh(int) */ - @Override - public GridCoordinates getHigh() { + GridCoordinatesView getHigh() { return new GridCoordinatesView(coordinates, getDimension()); } @@@ -670,8 -718,11 +678,9 @@@ * @throws IndexOutOfBoundsException if the given index is negative or is equals or greater * than the {@linkplain #getDimension() grid dimension}. * - * @see #getLow() * @see #getHigh(int) + * @see #withRange(int, long, long) */ - @Override public long getLow(final int index) { ArgumentChecks.ensureValidIndex(getDimension(), index); return coordinates[index]; @@@ -685,8 -736,11 +694,9 @@@ * @throws IndexOutOfBoundsException if the given index is negative or is equals or greater * than the {@linkplain #getDimension() grid dimension}. * - * @see #getHigh() * @see #getLow(int) + * @see #withRange(int, long, long) */ - @Override public long getHigh(final int index) { final int dimension = getDimension(); ArgumentChecks.ensureValidIndex(dimension, index); @@@ -705,7 -759,9 +715,8 @@@ * * @see #getLow(int) * @see #getHigh(int) + * @see #resize(long...) */ - @Override public long getSize(final int index) { final int dimension = getDimension(); ArgumentChecks.ensureValidIndex(dimension, index); @@@ -889,12 -1033,12 +988,12 @@@ */ public GeneralEnvelope toEnvelope(final MathTransform cornerToCRS) throws TransformException { ArgumentChecks.ensureNonNull("cornerToCRS", cornerToCRS); - final GeneralEnvelope envelope = toCRS(cornerToCRS, cornerToCRS, null); + final GeneralEnvelope envelope = toEnvelope(cornerToCRS, cornerToCRS, null); final Matrix gridToCRS = MathTransforms.getMatrix(cornerToCRS); if (gridToCRS != null && Matrices.isAffine(gridToCRS)) try { - envelope.setCoordinateReferenceSystem(GridExtentCRS.build(gridToCRS, (types != null) ? types : DEFAULT_TYPES, null)); + envelope.setCoordinateReferenceSystem(GridExtentCRS.forExtentAlone(gridToCRS, getAxisTypes())); } catch (FactoryException e) { - throw new TransformException(e); + throw new TransformException(e.getMessage(), e); } return envelope; } diff --cc core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java index 37a922c33b,150a87b06c..b0b4a20d03 --- a/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java +++ b/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java @@@ -51,6 -51,20 +51,8 @@@ import org.apache.sis.internal.system.M import org.apache.sis.referencing.IdentifiedObjects; import org.apache.sis.math.MathFunctions; + import static java.util.logging.Logger.getLogger; + -// Branch-dependent imports -import org.opengis.feature.IdentifiedType; -import org.opengis.feature.Property; -import org.opengis.feature.PropertyType; -import org.opengis.feature.Attribute; -import org.opengis.feature.AttributeType; -import org.opengis.feature.Feature; -import org.opengis.feature.FeatureType; -import org.opengis.feature.FeatureAssociation; -import org.opengis.feature.FeatureAssociationRole; -import org.opengis.feature.Operation; - /** * Formats {@linkplain AbstractFeature features} or {@linkplain DefaultFeatureType feature types} in a tabular format. diff --cc core/sis-feature/src/main/java/org/apache/sis/internal/filter/sqlmm/FunctionWithSRID.java index 05924a5e06,08a167efe8..bdb6eb41d5 --- a/core/sis-feature/src/main/java/org/apache/sis/internal/filter/sqlmm/FunctionWithSRID.java +++ b/core/sis-feature/src/main/java/org/apache/sis/internal/filter/sqlmm/FunctionWithSRID.java @@@ -42,9 -43,10 +42,10 @@@ import org.apache.sis.internal.geoapi.f * * @author Johann Sorel (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 1.1 + * @author Alexis Manin (Geomatys) + * @version 1.3 * - * @param <R> the type of resources (e.g. {@link org.opengis.feature.Feature}) used as inputs. + * @param <R> the type of resources (e.g. {@code Feature}) used as inputs. * * @since 1.1 * @module diff --cc core/sis-feature/src/main/java/org/apache/sis/internal/filter/sqlmm/OneGeometry.java index 3a12233162,d219252ed3..558649a2ae --- a/core/sis-feature/src/main/java/org/apache/sis/internal/filter/sqlmm/OneGeometry.java +++ b/core/sis-feature/src/main/java/org/apache/sis/internal/filter/sqlmm/OneGeometry.java @@@ -33,9 -33,9 +33,9 @@@ import org.apache.sis.filter.Expression * * @author Johann Sorel (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 1.1 + * @version 1.3 * - * @param <R> the type of resources (e.g. {@link org.opengis.feature.Feature}) used as inputs. + * @param <R> the type of resources (e.g. {@code Feature}) used as inputs. * @param <G> the implementation type of geometry objects. * * @since 1.1 diff --cc core/sis-feature/src/main/java/org/apache/sis/internal/filter/sqlmm/TwoGeometries.java index 2c17802271,b4575408b3..c5562590b8 --- a/core/sis-feature/src/main/java/org/apache/sis/internal/filter/sqlmm/TwoGeometries.java +++ b/core/sis-feature/src/main/java/org/apache/sis/internal/filter/sqlmm/TwoGeometries.java @@@ -37,9 -38,9 +37,9 @@@ import org.apache.sis.internal.geoapi.f * * @author Johann Sorel (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 1.1 + * @version 1.3 * - * @param <R> the type of resources (e.g. {@link org.opengis.feature.Feature}) used as inputs. + * @param <R> the type of resources (e.g. {@code Feature}) used as inputs. * @param <G> the implementation type of geometry objects. * * @since 1.1 diff --cc core/sis-feature/src/test/java/org/apache/sis/internal/filter/sqlmm/SQLMMTest.java index c015b2abd8,9d889701dc..76ebfeaa4d --- a/core/sis-feature/src/test/java/org/apache/sis/internal/filter/sqlmm/SQLMMTest.java +++ b/core/sis-feature/src/test/java/org/apache/sis/internal/filter/sqlmm/SQLMMTest.java @@@ -16,9 -16,13 +16,14 @@@ */ package org.apache.sis.internal.filter.sqlmm; +import java.util.function.Function; + import java.util.function.BiFunction; + import org.opengis.util.FactoryException; + import org.opengis.referencing.crs.CoordinateReferenceSystem; + import org.locationtech.jts.geom.Point; import org.locationtech.jts.geom.Polygon; - import org.apache.sis.feature.AbstractFeature; + import org.apache.sis.internal.feature.jts.JTS; + import org.apache.sis.referencing.crs.HardCodedCRS; import org.apache.sis.filter.DefaultFilterFactory; import org.apache.sis.referencing.CommonCRS; import org.apache.sis.test.TestCase; @@@ -26,6 -30,12 +31,10 @@@ import org.junit.Test import static org.opengis.test.Assert.*; + // Branch-dependent imports -import org.opengis.filter.Literal; -import org.opengis.feature.Feature; -import org.opengis.filter.Expression; -import org.opengis.filter.FilterFactory; ++import org.apache.sis.feature.AbstractFeature; ++import org.apache.sis.filter.Expression; + /** * Apply some validation on the {@link SQLMM} enumeration. @@@ -76,4 -87,55 +86,55 @@@ public final strictfp class SQLMMTest e assertEquals(wkt, polygon.toText()); assertEquals(CommonCRS.WGS84.geographic(), polygon.getUserData()); } + + /** + * Tests {@link FilterFactory#function(String, Expression...)} where the last argument + * is an optional CRS. The {@code ST_Point} function is used for this test. + * + * @throws FactoryException if an error occurred while fetching the CRS from a JTS geometry. + */ + @Test + @SuppressWarnings({"rawtypes", "unchecked"}) // Because of generic array creation. + public void testOptionalCrsInSTPoint() throws FactoryException { + /* + * Ensure that when argument array is of size 2, the `FunctionWithSRID` + * constructor will not fail with an `ArrayIndexOutOfBoundsException`. + * This bug happened in SIS 1.2. + */ + verifyPoint(null, (x, y) -> new Expression[] { x, y }); + /* + * Ensure that point function will correctly interpret + * a literal with a null value as "no CRS available". + */ + verifyPoint(null, (x, y) -> new Expression[] { x, y, factory.literal(null) }); + /* + * Ensure that CRS is fetched properly. + */ + verifyPoint(HardCodedCRS.WGS84, (x, y) -> new Expression[] { x, y, factory.literal(HardCodedCRS.WGS84) }); + } + + /** + * Verifies that a point function properly build a point with expected CRS and coordinate. + * + * @param expectedCRS the CRS that should be found in the point created with {@code argumentBundler}. + * @param argumentBundler given (x,y) coordinates, provides the list of arguments for {@code ST_Point(…)}. + * @throws FactoryException if an error occurred while fetching the CRS from a JTS geometry. + */ + private void verifyPoint(final CoordinateReferenceSystem expectedCRS, - final BiFunction<Expression<Feature, Double>, - Expression<Feature, Double>, - Expression<Feature, ?>[]> argumentBundler) ++ final BiFunction<Expression<AbstractFeature, Double>, ++ Expression<AbstractFeature, Double>, ++ Expression<AbstractFeature, ?>[]> argumentBundler) + throws FactoryException + { - final Literal<Feature, Double> x = factory.literal(1.0); - final Literal<Feature, Double> y = factory.literal(2.0); - Expression<Feature, ?> fn = factory.function("ST_Point", argumentBundler.apply(x, y)); ++ final Expression<AbstractFeature, Double> x = factory.literal(1.0); ++ final Expression<AbstractFeature, Double> y = factory.literal(2.0); ++ Expression<AbstractFeature, ?> fn = factory.function("ST_Point", argumentBundler.apply(x, y)); + Object rawPoint = fn.apply(null); + assertInstanceOf("ST_Point should create a Point geometry", Point.class, rawPoint); + Point point = (Point) rawPoint; + CoordinateReferenceSystem pointCRS = JTS.getCoordinateReferenceSystem(point); + assertEquals("Point CRS", expectedCRS, pointCRS); - assertEquals(point.getX(), x.getValue(), STRICT); - assertEquals(point.getY(), y.getValue(), STRICT); ++ assertEquals(point.getX(), x.apply(null), STRICT); ++ assertEquals(point.getY(), y.apply(null), STRICT); + } } diff --cc core/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/evolution/Interim.java index 0536d4e771,0000000000..6db35107d5 mode 100644,000000..100644 --- a/core/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/evolution/Interim.java +++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/evolution/Interim.java @@@ -1,68 -1,0 +1,70 @@@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.sis.internal.geoapi.evolution; + +import java.lang.reflect.Method; +import org.apache.sis.util.Static; +import org.apache.sis.util.logging.Logging; +import org.apache.sis.internal.system.Modules; +import org.opengis.geometry.Envelope; +import org.opengis.geometry.Geometry; + ++import static java.util.logging.Logger.getLogger; ++ + +/** + * Temporary methods used until a new major GeoAPI release provides the missing functionalities. + * + * @author Martin Desruisseaux (Geomatys) + * @version 1.1 + * @since 0.8 + * @module + */ +public final class Interim extends Static { + /** + * Do not allow instantiation of this class. + */ + private Interim() { + } + + /** + * Returns the return type of the given method, or the interim type if the method is annotated + * with {@link InterimType}. + * + * @param method the method from which to get the return type. + * @return the return type or the interim type. + */ + public static Class<?> getReturnType(final Method method) { + final InterimType an = method.getAnnotation(InterimType.class); + return (an != null) ? an.value() : method.getReturnType(); + } + + /** + * Invokes {@code Geometry.getEnvelope()} if that method exists. + * + * @param geometry the geometry from which to get the envelope. + * @return the geometry envelope, or {@code null} if none. + */ + public static Envelope getEnvelope(final Geometry geometry) { + try { + return (Envelope) geometry.getClass().getMethod("getEnvelope").invoke(geometry); + } catch (ReflectiveOperationException | ClassCastException e) { - Logging.recoverableException(Logging.getLogger(Modules.METADATA), Interim.class, "getEnvelope", e); ++ Logging.recoverableException(getLogger(Modules.METADATA), Interim.class, "getEnvelope", e); + return null; + } + } +} diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java index 8aae1487db,b54389bc7b..6cd2ecee7b --- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java +++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java @@@ -143,22 -150,17 +145,22 @@@ final class StandardImplementation exte } } /* - * Try to instantiate the implementation class. + * Try to insert a prefix in front of the class name, until a match is found. */ final int prefixPosition = buffer.lastIndexOf(".") + 1; - buffer.insert(prefixPosition, isAbstract(type) ? "Abstract" : "Default"); - classname = buffer.toString(); - try { - candidate = Class.forName(classname); + int length = 0; + for (final String p : prefix) { + classname = buffer.replace(prefixPosition, prefixPosition + length, p).toString(); + try { + candidate = Class.forName(classname); + } catch (ClassNotFoundException e) { - Logging.recoverableException(Logging.getLogger(Modules.METADATA), ++ Logging.recoverableException(getLogger(Modules.METADATA), + MetadataStandard.class, "getImplementation", e); + length = p.length(); + continue; + } implementations.put(type, candidate); return candidate.asSubclass(type); - } catch (ClassNotFoundException e) { - Logging.recoverableException(getLogger(Modules.METADATA), MetadataStandard.class, "getImplementation", e); } implementations.put(type, Void.TYPE); // Marker for "class not found". } diff --cc core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/GeohashReferenceSystem.java index fb80427e0b,6740f00dc3..2638ffe946 --- a/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/GeohashReferenceSystem.java +++ b/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/GeohashReferenceSystem.java @@@ -166,10 -199,10 +195,10 @@@ public class GeohashReferenceSystem ext * ("Relax constraint on placement of this()/super() call in constructors"). */ @Workaround(library="JDK", version="1.8") - private static LocationType[] types() { + private static ModifiableLocationType[] types() { - final ModifiableLocationType gzd = new ModifiableLocationType("Geohash"); + final ModifiableLocationType gzd = new ModifiableLocationType(IDENTIFIER); gzd.addIdentification(Vocabulary.formatInternational(Vocabulary.Keys.Code)); - return new LocationType[] {gzd}; + return new ModifiableLocationType[] {gzd}; } /** @@@ -359,7 -531,8 +532,8 @@@ * @return a new geographic coordinate for the given geohash. * @throws TransformException if an error occurred while parsing the given string. */ + @Override - public Location decode(final CharSequence geohash) throws TransformException { + public AbstractLocation decode(final CharSequence geohash) throws TransformException { ArgumentChecks.ensureNonEmpty("geohash", geohash); return new Decoder(geohash, coordinates); } diff --cc core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java index fe920b42b6,12ade70c13..d73cc6fcee --- a/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java +++ b/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java @@@ -63,14 -71,22 +68,18 @@@ import org.apache.sis.geometry.Shapes2D import org.apache.sis.geometry.Envelopes; import org.apache.sis.geometry.Envelope2D; import org.apache.sis.geometry.DirectPosition2D; + import org.apache.sis.internal.referencing.Formulas; -import org.apache.sis.internal.system.Modules; import org.apache.sis.internal.util.Strings; import org.apache.sis.math.DecimalFunctions; import org.apache.sis.measure.Longitude; import org.apache.sis.measure.Latitude; + import org.apache.sis.measure.Quantities; + import org.apache.sis.measure.Units; + -import static java.util.logging.Logger.getLogger; // Branch-dependent imports +import org.apache.sis.metadata.iso.citation.AbstractParty; import org.apache.sis.internal.jdk9.JDK9; -import org.opengis.metadata.citation.Party; -import org.opengis.referencing.gazetteer.Location; -import org.opengis.referencing.gazetteer.LocationType; /** @@@ -266,8 -302,16 +295,8 @@@ public class MilitaryGridReferenceSyste */ @Workaround(library="JDK", version="1.8") private static Map<String,?> properties() { - Party party; - try { - party = MetadataSource.getProvided().lookup(Party.class, "{org}NATO"); - } catch (MetadataStoreException e) { - party = null; - Logging.unexpectedException(getLogger(Modules.REFERENCING_BY_IDENTIFIERS), - MilitaryGridReferenceSystem.class, "<init>", e); - } - NamedIdentifier name = new NamedIdentifier(null, "NATO", Resources.formatInternational(Resources.Keys.MGRS), null, null); - return properties(name, IDENTIFIER, party); + AbstractParty party = new AbstractParty("North Atlantic Treaty Organization", null); - return properties(new NamedIdentifier(null, "NATO", Resources.formatInternational(Resources.Keys.MGRS), null, null), party); ++ return properties(new NamedIdentifier(null, "NATO", Resources.formatInternational(Resources.Keys.MGRS), null, null), IDENTIFIER, party); } /** @@@ -639,7 -788,8 +778,8 @@@ * @return a new position with the longitude at coordinate 0 and latitude at coordinate 1. * @throws TransformException if an error occurred while parsing the given string. */ + @Override - public Location decode(final CharSequence reference) throws TransformException { + public AbstractLocation decode(final CharSequence reference) throws TransformException { ArgumentChecks.ensureNonEmpty("reference", reference); return new Decoder(this, reference); } diff --cc core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ReferencingByIdentifiers.java index 7c7bbfb7a0,45477c973e..3ca0660889 --- a/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ReferencingByIdentifiers.java +++ b/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ReferencingByIdentifiers.java @@@ -59,25 -72,7 +69,25 @@@ import org.apache.sis.metadata.iso.cita * @module */ @XmlTransient - public class ReferencingByIdentifiers extends AbstractReferenceSystem { -public abstract class ReferencingByIdentifiers extends AbstractReferenceSystem implements ReferenceSystemUsingIdentifiers { ++public abstract class ReferencingByIdentifiers extends AbstractReferenceSystem { + /** + * Key for the <code>{@value}</code> property to be given to the + * object factory {@code createFoo(…)} methods. + * This is used for setting the value to be returned by {@link #getTheme()}. + * + * @see #getTheme() + */ + public static final String THEME_KEY = "theme"; + + /** + * Key for the <code>{@value}</code> property to be given to the + * object factory {@code createFoo(…)} methods. + * This is used for setting the value to be returned by {@link #getOverallOwner()}. + * + * @see #getOverallOwner() + */ + public static final String OVERALL_OWNER_KEY = "overallOwner"; + /** * Serial number for inter-operability with different versions. */ @@@ -193,11 -183,13 +203,13 @@@ * The returned properties have the domain of validity set to the whole word and the theme to "mapping". * * @param name the reference system name as an {@link org.opengis.metadata.Identifier} or a {@link String}. + * @param id an identifier for the reference system. Use SIS namespace until we find an authority for them. * @param party the overall owner, or {@code null} if none. */ - static Map<String,Object> properties(final Object name, final AbstractParty party) { - final Map<String,Object> properties = new HashMap<>(6); - static Map<String,Object> properties(final Object name, final String id, final Party party) { ++ static Map<String,Object> properties(final Object name, final String id, final AbstractParty party) { + final Map<String,Object> properties = new HashMap<>(8); properties.put(NAME_KEY, name); + properties.put(IDENTIFIERS_KEY, new ImmutableIdentifier(Citations.SIS, Constants.SIS, id)); properties.put(DOMAIN_OF_VALIDITY_KEY, Extents.WORLD); properties.put(THEME_KEY, Vocabulary.formatInternational(Vocabulary.Keys.Mapping)); properties.put(OVERALL_OWNER_KEY, party); @@@ -256,6 -253,125 +268,130 @@@ return locationTypes.get(0); } + /** + * Returns a new object performing conversions between {@code DirectPosition} and identifiers. + * The returned object is <strong>not</strong> thread-safe; a new instance must be created + * for each thread, or synchronization must be applied by the caller. + * + * @return a new object performing conversions between {@link DirectPosition} and identifiers. + * + * @since 1.3 + */ + public abstract Coder createCoder(); + + /** + * Conversions between direct positions and identifiers. + * Each {@code Coder} instance can read references at arbitrary precision, + * but formats at the {@linkplain #setPrecision specified approximate precision}. + * The same {@code Coder} instance can be reused for reading or writing many identifiers. + * + * <h2>Immutability and thread safety</h2> + * This class is <strong>not</strong> thread-safe. A new instance must be created for each thread, + * or synchronization must be applied by the caller. + * + * @author Martin Desruisseaux (Geomatys) + * @version 1.3 + * @since 1.3 + * @module + */ + public abstract static class Coder { + /** + * Creates a new instance. + */ + protected Coder() { + } + + /** + * Returns the reference system for which this coder is reading or writing identifiers. + * + * @return the enclosing reference system. + */ + public abstract ReferencingByIdentifiers getReferenceSystem(); + + /** + * Returns approximate precision of the identifiers formatted by this coder at the given location. + * The returned value is typically a length in linear unit (e.g. metres). + * Precisions in angular units should be converted to linear units at the specified location. + * If the location is {@code null}, then this method should return a precision for the worst case scenario. + * + * @param position where to evaluate the precision, or {@code null} for the worst case scenario. + * @return approximate precision in metres of formatted identifiers. + */ + public abstract Quantity<?> getPrecision(DirectPosition position); + + /** + * Sets the desired precision of the identifiers formatted by this coder. + * The given value is converted to coder-specific representation (e.g. number of digits). + * The value returned by {@link #getPrecision(DirectPosition)} may be different than the + * value specified to this method. + * + * @param precision the desired precision. + * @param position location where the specified precision is desired, or {@code null} for the worst case scenario. + * @throws IncommensurableException if the given precision uses incompatible units of measurement. + */ + public abstract void setPrecision(Quantity<?> precision, DirectPosition position) throws IncommensurableException; + + /** + * A combined method which sets the encoder precision to the given value, then formats the given position. + * The default implementation is equivalent to the following code: + * + * {@preformat java + * setPrecision(precision, position); + * return encode(position); + * } + * + * Subclasses should override with more efficient implementation, + * for example by transforming the given position only once. + * + * @param position the coordinate to encode. + * @param precision the desired precision. + * @return identifier of the given position. + * @throws IncommensurableException if the given precision uses incompatible units of measurement. + * @throws TransformException if an error occurred while transforming the given coordinate to an identifier. + */ + public String encode(DirectPosition position, Quantity<?> precision) throws IncommensurableException, TransformException { + setPrecision(precision, position); + return encode(position); + } + + /** + * Encodes the given position into an identifier. + * The given position must have a Coordinate Reference System (CRS) associated to it. + * + * @param position the coordinate to encode. + * @return identifier of the given position. + * @throws TransformException if an error occurred while transforming the given coordinate to an identifier. + */ + public abstract String encode(DirectPosition position) throws TransformException; + + /** + * Decodes the given identifier into a latitude and a longitude. + * The axis order depends on the coordinate reference system of the enclosing {@link ReferencingByIdentifiers}. + * ++ * <div class="warning"><b>Upcoming API change — generalization</b><br> ++ * in a future SIS version, the type of returned element may be generalized ++ * to the {@code org.opengis.referencing.gazetteer.Location} interface. ++ * This change is pending GeoAPI revision.</div> ++ * + * @param identifier identifier string to decode. + * @return a new geographic coordinate for the given identifier. + * @throws TransformException if an error occurred while parsing the given string. + */ - public abstract Location decode(CharSequence identifier) throws TransformException; ++ public abstract AbstractLocation decode(CharSequence identifier) throws TransformException; + + /** + * Logs a warning for a recoverable error while transforming a position. This is used for implementations + * of method such as {@link #getPrecision(DirectPosition)}, which can fallback on "worst case" scenario. + * + * @param caller the class that wanted to transform a position. + * @param method the method that wanted to transform a position. + * @param e the transformation error. + */ + static void recoverableException(final Class<?> caller, final String method, final Exception e) { + Logging.recoverableException(Logger.getLogger(Modules.REFERENCING_BY_IDENTIFIERS), caller, method, e); + } + } + /** * Compares this reference system with the specified object for equality. * If the {@code mode} argument value is {@link ComparisonMode#STRICT STRICT} or diff --cc core/sis-referencing-by-identifiers/src/test/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystemTest.java index d062496de6,2a76f68343..9964b4c221 --- a/core/sis-referencing-by-identifiers/src/test/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystemTest.java +++ b/core/sis-referencing-by-identifiers/src/test/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystemTest.java @@@ -41,8 -43,14 +43,10 @@@ import org.apache.sis.test.TestCase import org.apache.sis.test.TestUtilities; import org.junit.Test; + import static org.apache.sis.internal.metadata.ReferencingServices.NAUTICAL_MILE; + import static org.apache.sis.measure.Units.ARC_MINUTE; import static org.junit.Assert.*; -// Branch-dependent imports -import org.opengis.referencing.gazetteer.Location; -import org.opengis.referencing.gazetteer.LocationType; - /** * Tests {@link MilitaryGridReferenceSystem}. diff --cc core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterFormat.java index aa4f842fa8,320aebdd9e..e74d27e39f --- a/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterFormat.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterFormat.java @@@ -39,6 -39,8 +39,8 @@@ import javax.measure.Unit import org.opengis.parameter.*; import org.opengis.util.ScopedName; import org.opengis.util.GenericName; + import org.opengis.util.InternationalString; -import org.opengis.util.ControlledVocabulary; ++import org.opengis.util.CodeList; import org.opengis.metadata.Identifier; import org.opengis.referencing.IdentifiedObject; import org.opengis.referencing.ReferenceIdentifier; @@@ -720,9 -724,15 +724,15 @@@ public class ParameterFormat extends Ta if (format instanceof NumberFormat && value instanceof Number) { configure((NumberFormat) format, Math.abs(((Number) value).doubleValue())); } - value = format.format(value, buffer, dummyFP); + text = format.format(value, buffer, dummyFP); - } else if (value instanceof ControlledVocabulary) { - text = Types.getCodeTitle((ControlledVocabulary) value).toString(getLocale()); ++ } else if (value instanceof CodeList<?>) { ++ text = Types.getCodeTitle((CodeList<?>) value).toString(getLocale()); + } else if (value instanceof InternationalString) { + text = ((InternationalString) value).toString(getLocale()); + } else { + text = value.toString(); } - table.append(value.toString()); + table.append(text); buffer.setLength(0); int pad = unitWidth; final String unit = (String) row.units.get(i); diff --cc core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java index 235fe30ec2,587b43c6a2..3b4882e0f1 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java @@@ -88,6 -90,11 +88,8 @@@ import org.apache.sis.util.ArgumentChec import org.apache.sis.util.Utilities; import org.apache.sis.util.Static; + import static java.util.logging.Logger.getLogger; + -// Branch-dependent imports -import org.opengis.geometry.Geometry; - /** * Static methods working on {@linkplain CoordinateReferenceSystem Coordinate Reference Systems}. diff --cc core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java index 335a4a4763,cbb7874eb3..150ff20678 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java @@@ -61,10 -62,8 +61,11 @@@ import org.apache.sis.util.resources.Er import org.apache.sis.util.logging.Logging; import static java.lang.Math.*; + import static java.util.logging.Logger.getLogger; +// Branch-dependent imports +import org.opengis.referencing.ReferenceIdentifier; + /** * Base class for conversion services between ellipsoidal and cartographic projections. diff --cc pom.xml index 13f2bfb710,1ec987cb4a..477f9affdd --- a/pom.xml +++ b/pom.xml @@@ -557,8 -557,8 +557,8 @@@ <maven.compiler.target>8</maven.compiler.target> <sis.plugin.version>${project.version}</sis.plugin.version> <sis.non-free.version>1.2</sis.non-free.version> <!-- Used only if "non-free" profile is activated. --> - <javafx.version>17</javafx.version> <!-- Used only if "javafx" profile is activated. --> + <javafx.version>18.0.1</javafx.version> <!-- Used only if "javafx" profile is activated. --> - <geoapi.version>3.1-SNAPSHOT</geoapi.version> + <geoapi.version>3.0.1</geoapi.version> </properties> <profiles> diff --cc storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/InputFeatureStream.java index 93efbfb4cc,fe3500fcca..c31abda683 --- a/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/InputFeatureStream.java +++ b/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/InputFeatureStream.java @@@ -38,8 -38,7 +38,7 @@@ import org.apache.sis.internal.shapefil import org.apache.sis.internal.shapefile.jdbc.statement.DBFStatement; import org.apache.sis.internal.system.Modules; import org.apache.sis.storage.DataStoreClosedException; - import org.apache.sis.util.logging.Logging; -import org.opengis.feature.Feature; +import org.apache.sis.feature.AbstractFeature; /** * Input Stream of features. diff --cc storage/sis-shapefile/src/test/java/org/apache/sis/storage/shapefile/ShapeFileTest.java index ad42bdf0d3,86d8fbfd74..d4d1b84fa4 --- a/storage/sis-shapefile/src/test/java/org/apache/sis/storage/shapefile/ShapeFileTest.java +++ b/storage/sis-shapefile/src/test/java/org/apache/sis/storage/shapefile/ShapeFileTest.java @@@ -118,12 -117,12 +118,12 @@@ public final strictfp class ShapeFileTe @Test @Ignore // TODO Adapt with another shapefile. public void testHandleEofNotification() throws URISyntaxException, DataStoreException { ShapeFile shp = new ShapeFile(path("DEPARTEMENT.SHP")); - Feature first = null, last = null; + AbstractFeature first = null, last = null; - Logger log = org.apache.sis.util.logging.Logging.getLogger(ShapeFileTest.class); + Logger log = Logger.getLogger("org.apache.sis.storage.shapefile"); try(InputFeatureStream is = shp.findAll()) { - Feature feature = is.readFeature(); + AbstractFeature feature = is.readFeature(); // Read and retain the first and the last feature. while(feature != null) { diff --cc storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreUtilities.java index 2d9ea780ad,cd8fd65d9a..ab3a861076 --- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreUtilities.java +++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreUtilities.java @@@ -51,11 -51,9 +51,10 @@@ import org.apache.sis.internal.system.M import org.apache.sis.util.resources.Errors; import org.apache.sis.util.CharSequences; import org.apache.sis.util.Classes; - import org.apache.sis.util.logging.Logging; // Branch-dependent imports -import org.opengis.feature.Feature; +import org.apache.sis.feature.AbstractFeature; +import org.apache.sis.metadata.iso.identification.AbstractIdentification; /** diff --cc storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSubset.java index 0ba2a9b9d6,4affc9612e..8edc78ff42 --- a/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSubset.java +++ b/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSubset.java @@@ -20,14 -20,13 +20,13 @@@ import java.util.OptionalLong import java.util.stream.Stream; import org.apache.sis.internal.feature.FeatureUtilities; import org.apache.sis.internal.storage.Resources; - import org.apache.sis.storage.event.StoreListeners; // Branch-dependent imports -import org.opengis.feature.Feature; -import org.opengis.feature.FeatureType; -import org.opengis.filter.Filter; -import org.opengis.filter.Expression; -import org.opengis.filter.SortBy; +import org.apache.sis.feature.AbstractFeature; +import org.apache.sis.feature.DefaultFeatureType; +import org.apache.sis.filter.Expression; +import org.apache.sis.filter.Filter; +import org.apache.sis.internal.geoapi.filter.SortBy; /**
