Changeset 36015 in osm for applications/editors


Ignore:
Timestamp:
2022-08-23T20:06:58+02:00 (2 years ago)
Author:
taylor.smock
Message:

Fix #22303: Open drone image as background image

  • Add additional files to be merged in META-INF for JAI (this fixes an issue where ShadedRelief could not be found). This is done by modifying build.xml to concat multiple files with the same path and name in different jar files together
  • Add CompressorSpi and DecompressorSpi so that compressed image formats can be read. This requires us to call CompressionRegistry#registerApplicationClasspathSpis with the geotools plugin classloader.
Location:
applications/editors/josm/plugins/geotools
Files:
3 added
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/geotools/build.xml

    r35959 r36015  
    11<?xml version="1.0" encoding="utf-8"?>
    2   <project name="geotools" default="dist" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
     2  <project name="geotools" default="dist" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:rsel="antlib:org.apache.tools.ant.types.resources.selectors">
    33    <!-- enter the SVN commit message -->
    44    <property name="commit.message" value="Commit message"/>
     
    2929        <!--<include name="jackson.jar"/>-->
    3030    </fileset>
     31    <macrodef name="merge-text-files">
     32      <attribute name="mergefile"/>
     33      <attribute name="targetdir"/>
     34      <sequential>
     35        <concat destfile="@{targetdir}/@{mergefile}">
     36          <restrict>
     37            <rsel:name name="@{mergefile}"/>
     38            <archives>
     39                <zips>
     40                    <fileset dir="${plugin.lib.dir}" includes="*.jar" excludes="*-sources.jar, *-javadoc.jar" erroronmissingdir="no"/>
     41                </zips>
     42            </archives>
     43          </restrict>
     44        </concat>
     45      </sequential>
     46    </macrodef>
    3147
    3248    <target name="merge-geotools-services" depends="fetch_dependencies">
     
    4056            </fileset>
    4157        </merge-services>
    42     <echo>Check the updated files in jar/META-INF/services for lines where two
    43     services got merged. Example:
    44     org.geotools.coverage.util.FilterFunction_isCoverageorg.geotools.filter.AreaFunction
    45     </echo>
     58        <echo>Check the updated files in jar/META-INF/services for lines where two
     59        services got merged. Example:
     60        org.geotools.coverage.util.FilterFunction_isCoverageorg.geotools.filter.AreaFunction
     61        </echo>
     62
     63        <merge-text-files mergefile="META-INF/javax.media.jai.registryFile.jai" targetdir="jar"/>
     64        <merge-text-files mergefile="META-INF/registryFile.jai"                 targetdir="jar"/>
     65        <merge-text-files mergefile="META-INF/registryFile.jaiext"              targetdir="jar"/>
    4666    </target>
    4767
  • applications/editors/josm/plugins/geotools/jar/META-INF/registryFile.jai

    r31599 r36015  
     1#
     2# The registry file for Geotools Grid Coverage implementation. This file should be automatically
     3# parsed by JAI under initialization. If it is not, then Registry.registerServices(...) can parse
     4# it. This may happen if this file is unreachable from the JAI class loader.
     5#
     6# If this file is updated, remember to update Registry.registerServices(...) accordingly.
     7#
     8# Version: $Id$
     9#
     10##################################################################################################
     11#
     12# Each line can be in one of the formats described below. Space or tab characters separate
     13# keywords in each line. The comment character is '#'; on each line all characters following
     14# the first comment character are ignored. The file must be encoded in UTF-8.
     15#
     16# 1. To register descriptors :
     17#
     18#      descriptor <descriptor-class-name>
     19#
     20# 2. To register factory objects under a product against a specific mode :
     21#
     22#      <registry-mode-name>  <factory-class-name>  <product-name>  <descriptor-name>  <local-name>
     23#
     24#    The <local-name> is (only) used later on in this file to set preferences
     25#    between factory objects, if wanted.
     26#
     27##################################################################################################
    128#
    229# Image operation descriptors :
    330#
    4 descriptor  org.jaitools.media.jai.contour.ContourDescriptor
    5 descriptor  org.jaitools.media.jai.rangelookup.RangeLookupDescriptor
    6 descriptor  org.jaitools.media.jai.vectorbinarize.VectorBinarizeDescriptor
    7 descriptor  org.jaitools.media.jai.vectorize.VectorizeDescriptor
    8 descriptor  org.jaitools.media.jai.zonalstats.ZonalStatsDescriptor
    931descriptor  org.geotools.image.palette.ColorReductionDescriptor
    1032descriptor  org.geotools.image.palette.ColorInversionDescriptor
     33
     34#
     35# "rendered" factory objects
     36#
     37rendered  org.geotools.image.palette.ColorReductionCRIF org.geotools  org.geotools.ColorReduction ColorReduction
     38rendered  org.geotools.image.palette.ColorInversionCRIF org.geotools  org.geotools.ColorInversion ColorInversion
     39#
     40# The registry file for Geotools Grid Coverage implementation. This file should be automatically
     41# parsed by JAI under initialization. If it is not, then Registry.registerServices(...) can parse
     42# it. This may happen if this file is unreachable from the JAI class loader.
     43#
     44# If this file is updated, remember to update Registry.registerServices(...) accordingly.
     45#
     46##################################################################################################
     47#
     48# Each line can be in one of the formats described below. Space or tab characters separate
     49# keywords in each line. The comment character is '#'; on each line all characters following
     50# the first comment character are ignored. The file must be encoded in UTF-8.
     51#
     52# 1. To register descriptors :
     53#
     54#      descriptor <descriptor-class-name>
     55#
     56# 2. To register factory objects under a product against a specific mode :
     57#
     58#      <registry-mode-name>  <factory-class-name>  <product-name>  <descriptor-name>  <local-name>
     59#
     60#    The <local-name> is (only) used later on in this file to set preferences
     61#    between factory objects, if wanted.
     62#
     63##################################################################################################
     64#
     65# Image operation descriptors :
     66#
     67descriptor  it.geosolutions.imageio.imageioimpl.imagereadmt.ImageReadDescriptorMT
    1168
    1269
     
    1471# "rendered" factory objects
    1572#
    16 rendered  org.jaitools.media.jai.contour.ContourRIF  org.jaitools.media.jai  Contour  Contour
    17 rendered  org.jaitools.media.jai.rangelookup.RangeLookupRIF  org.jaitools.media.jai  RangeLookup  RangeLookup
    18 rendered  org.jaitools.media.jai.vectorbinarize.VectorBinarizeRIF  org.jaitools.media.jai  VectorBinarize  VectorBinarize
    19 rendered  org.jaitools.media.jai.vectorize.VectorizeRIF  org.jaitools.media.jai  Vectorize  Vectorize
     73rendered  it.geosolutions.imageio.imageioimpl.imagereadmt.ImageReadMTCRIF       it.geosolutions.imageio.imageioimpl.imagereadmt  ImageReadMT       ImageReadMT
     74
     75#
     76# Image operation descriptors :
     77#
     78descriptor  org.jaitools.media.jai.zonalstats.ZonalStatsDescriptor
     79
     80
     81#
     82# "rendered" factory objects
     83#
    2084rendered  org.jaitools.media.jai.zonalstats.ZonalStatsRIF  org.jaitools.media.jai  ZonalStats  ZonalStats
    21 rendered  org.geotools.image.palette.ColorReductionCRIF org.geotools  org.geotools.ColorReduction ColorReduction
    22 rendered  org.geotools.image.palette.ColorInversionCRIF org.geotools  org.geotools.ColorInversion ColorInversion
  • applications/editors/josm/plugins/geotools/jar/META-INF/registryFile.jaiext

    r31752 r36015  
    11#
     2# Image descriptors
     3#
     4
     5descriptor  it.geosolutions.jaiext.affine.AffineDescriptor
     6
     7#
     8# RenderedImageFactories
     9#
     10
     11rendered  it.geosolutions.jaiext.affine.AffineCRIF  it.geosolutions.jaiext  Affine Affine#
     12# Image descriptors
     13#
     14
     15descriptor  it.geosolutions.jaiext.algebra.AlgebraDescriptor
     16descriptor  it.geosolutions.jaiext.algebra.constant.OperationConstDescriptor
     17
     18#
     19# RenderedImageFactories
     20#
     21
     22rendered  it.geosolutions.jaiext.algebra.AlgebraCRIF  it.geosolutions.jaiext  algebric algebric
     23rendered  it.geosolutions.jaiext.algebra.constant.OperationConstCRIF  it.geosolutions.jaiext  operationConst operationConst #
     24# Image descriptors
     25#
     26
     27descriptor  it.geosolutions.jaiext.bandcombine.BandCombineDescriptor
     28
     29#
     30# RenderedImageFactories
     31#
     32
     33rendered  it.geosolutions.jaiext.bandcombine.BandCombineCRIF  it.geosolutions.jaiext  BandCombine BandCombine #
     34# Image descriptors
     35#
     36
     37descriptor  it.geosolutions.jaiext.bandmerge.BandMergeDescriptor
     38
     39#
     40# RenderedImageFactories
     41#
     42
     43rendered  it.geosolutions.jaiext.bandmerge.BandMergeCRIF  it.geosolutions.jaiext  BandMerge BandMerge #
     44# Image descriptors
     45#
     46
     47descriptor  it.geosolutions.jaiext.bandselect.BandSelectDescriptor
     48
     49#
     50# RenderedImageFactories
     51#
     52
     53rendered  it.geosolutions.jaiext.bandselect.BandSelectCRIF  it.geosolutions.jaiext  BandSelect BandSelect #
     54# Image descriptors
     55#
     56
     57descriptor  it.geosolutions.jaiext.binarize.BinarizeDescriptor
     58
     59#
     60# RenderedImageFactories
     61#
     62
     63rendered  it.geosolutions.jaiext.binarize.BinarizeCRIF  it.geosolutions.jaiext  Binarize Binarize #
     64# Image descriptors
     65#
     66
     67descriptor  it.geosolutions.jaiext.border.BorderDescriptor
     68
     69#
     70# RenderedImageFactories
     71#
     72
     73rendered  it.geosolutions.jaiext.border.BorderRIF  it.geosolutions.jaiext  Border Border #
     74# Image descriptors
     75#
     76
     77descriptor  it.geosolutions.jaiext.buffer.BufferDescriptor
     78
     79#
     80# RenderedImageFactories
     81#
     82
     83rendered  it.geosolutions.jaiext.buffer.BufferRIF it.geosolutions.jaiext  Buffer Buffer #
     84# Image descriptors
     85#
     86
     87descriptor  it.geosolutions.jaiext.classifier.RasterClassifierDescriptor
     88
     89#
     90# RenderedImageFactories
     91#
     92
     93rendered  it.geosolutions.jaiext.classifier.RasterClassifierCRIF  it.geosolutions.jaiext  RasterClassifier RasterClassifier#
     94# Image descriptors
     95#
     96
     97descriptor  it.geosolutions.jaiext.colorconvert.ColorConvertDescriptor
     98
     99#
     100# RenderedImageFactories
     101#
     102
     103rendered  it.geosolutions.jaiext.colorconvert.ColorConvertCRIF  it.geosolutions.jaiext  ColorConvert ColorConvert#
     104# Image descriptors
     105#
     106
     107descriptor  it.geosolutions.jaiext.colorindexer.ColorIndexerDescriptor
     108
     109#
     110# RenderedImageFactories
     111#
     112
     113rendered  it.geosolutions.jaiext.colorindexer.ColorIndexerCRIF it.geosolutions.jaiext  ColorIndexer ColorIndexer #
    2114# Image operation descriptors :
    3115#
    4 descriptor  it.geosolutions.jaiext.colorconvert.ColorConvertDescriptor
     116
     117descriptor  it.geosolutions.jaiext.crop.CropDescriptor
     118
     119
     120#
     121# "rendered" factory objects
     122#
     123rendered  it.geosolutions.jaiext.crop.CropCRIF     it.geosolutions.jaiext  Crop   Crop
     124#
     125# Image descriptors
     126#
     127
     128descriptor  it.geosolutions.jaiext.errordiffusion.ErrorDiffusionDescriptor
     129
     130#
     131# RenderedImageFactories
     132#
     133
     134rendered  it.geosolutions.jaiext.errordiffusion.ErrorDiffusionRIF  it.geosolutions.jaiext  ErrorDiffusion ErrorDiffusion#
     135# Image descriptors
     136#
     137
     138descriptor  it.geosolutions.jaiext.format.FormatDescriptor
     139
     140#
     141# RenderedImageFactories
     142#
     143
     144rendered  it.geosolutions.jaiext.format.FormatCRIF  it.geosolutions.jaiext  Format Format #
     145# Image descriptors
     146#
     147
     148descriptor  it.geosolutions.jaiext.imagefunction.ImageFunctionDescriptor
     149
     150#
     151# RenderedImageFactories
     152#
     153
     154rendered  it.geosolutions.jaiext.imagefunction.ImageFunctionRIF  it.geosolutions.jaiext  ImageFunction ImageFunction#
     155# Image descriptors
     156#
     157
     158descriptor  it.geosolutions.jaiext.lookup.LookupDescriptor
     159
     160#
     161# RenderedImageFactories
     162#
     163
     164rendered  it.geosolutions.jaiext.lookup.LookupCRIF  it.geosolutions.jaiext  Lookup Lookup #
     165# Image descriptors
     166#
     167
     168descriptor  it.geosolutions.jaiext.mosaic.MosaicDescriptor
     169
     170#
     171# RenderedImageFactories
     172#
     173
     174rendered  it.geosolutions.jaiext.mosaic.MosaicRIF  it.geosolutions.jaiext  Mosaic Mosaic #
     175# Image descriptors
     176#
     177
     178descriptor  it.geosolutions.jaiext.nullop.NullDescriptor
     179
     180#
     181# RenderedImageFactories
     182#
     183
     184rendered  it.geosolutions.jaiext.nullop.NullCRIF  it.geosolutions.jaiext  Null Null #
     185# Image descriptors
     186#
     187
     188descriptor  it.geosolutions.jaiext.orderdither.OrderedDitherDescriptor
     189
     190#
     191# RenderedImageFactories
     192#
     193
     194rendered  it.geosolutions.jaiext.orderdither.OrderedDitherRIF  it.geosolutions.jaiext  OrderedDither OrderedDither#
     195# Image descriptors
     196#
     197
     198descriptor  it.geosolutions.jaiext.piecewise.GenericPiecewiseDescriptor
     199
     200#
     201# RenderedImageFactories
     202#
     203
     204rendered  it.geosolutions.jaiext.piecewise.GenericPiecewiseCRIF  it.geosolutions.jaiext  GenericPiecewise GenericPiecewise#
     205# Image descriptors
     206#
     207
     208descriptor  it.geosolutions.jaiext.rescale.RescaleDescriptor
     209
     210#
     211# RenderedImageFactories
     212#
     213
     214rendered  it.geosolutions.jaiext.rescale.RescaleCRIF  it.geosolutions.jaiext  Rescale Rescale #
     215# Image operation descriptors :
     216#
     217descriptor  it.geosolutions.jaiext.rlookup.RangeLookupDescriptor
     218
     219
     220#
     221# "rendered" factory objects
     222#
     223rendered  it.geosolutions.jaiext.rlookup.RangeLookupRIF  it.geosolutions.jaiext  RLookup  RLookup
     224#
     225# Image descriptors
     226#
     227
     228descriptor  it.geosolutions.jaiext.scale.ScaleDescriptor
     229
     230#
     231# RenderedImageFactories
     232#
     233
     234rendered  it.geosolutions.jaiext.scale.ScaleCRIF  it.geosolutions.jaiext  Scale Scale #
     235# Image descriptors
     236#
     237
     238descriptor  it.geosolutions.jaiext.scale.Scale2Descriptor
     239
     240#
     241# RenderedImageFactories
     242#
     243
     244rendered  it.geosolutions.jaiext.scale.Scale2CRIF  it.geosolutions.jaiext  Scale2 Scale2 #
     245# Image descriptors
     246#
     247
     248descriptor  it.geosolutions.jaiext.shadedrelief.ShadedReliefDescriptor
     249
     250#
     251# RenderedImageFactories
     252#
     253
     254rendered  it.geosolutions.jaiext.shadedrelief.ShadedReliefRIF  it.geosolutions.jaiext  ShadedRelief ShadedRelief
     255#
     256# Image descriptors
     257#
     258
     259descriptor  it.geosolutions.jaiext.stats.StatisticsDescriptor
     260
     261#
     262# RenderedImageFactories
     263#
     264
     265rendered  it.geosolutions.jaiext.stats.StatisticsRIF  it.geosolutions.jaiext  Stats Stats #
     266# Image descriptors
     267#
     268
     269descriptor  it.geosolutions.jaiext.translate.TranslateDescriptor
     270
     271#
     272# RenderedImageFactories
     273#
     274
     275rendered  it.geosolutions.jaiext.translate.TranslateCRIF  it.geosolutions.jaiext  Translate Translate #
     276# Image operation descriptors :
     277#
     278descriptor  it.geosolutions.jaiext.vectorbin.VectorBinarizeDescriptor
     279
     280
     281#
     282# "rendered" factory objects
     283#
     284rendered  it.geosolutions.jaiext.vectorbin.VectorBinarizeRIF  it.geosolutions.jaiext  VectorBinarize  VectorBinarize
     285#
     286# Image descriptors
     287#
     288
    5289descriptor  it.geosolutions.jaiext.warp.WarpDescriptor
    6 descriptor  it.geosolutions.jaiext.stats.StatisticsDescriptor
     290
     291#
     292# RenderedImageFactories
     293#
     294
     295rendered  it.geosolutions.jaiext.warp.WarpRIF  it.geosolutions.jaiext  Warp Warp #
     296# Image descriptors
     297#
     298
    7299descriptor  it.geosolutions.jaiext.zonal.ZonalStatsDescriptor
    8300
    9301#
    10 # "rendered" factory objects
    11 #
    12 rendered  it.geosolutions.jaiext.colorconvert.ColorConvertCRIF  it.geosolutions.jaiext  ColorConvert ColorConvert
    13 rendered  it.geosolutions.jaiext.warp.WarpRIF  it.geosolutions.jaiext  Warp Warp
    14 rendered  it.geosolutions.jaiext.stats.StatisticsRIF  it.geosolutions.jaiext  Stats Stats
    15 rendered  it.geosolutions.jaiext.zonal.ZonalStatsRIF  it.geosolutions.jaiext  Zonal Zonal
     302# RenderedImageFactories
     303#
     304
     305rendered  it.geosolutions.jaiext.zonal.ZonalStatsRIF  it.geosolutions.jaiext  Zonal Zonal
  • applications/editors/josm/plugins/geotools/src/org/openstreetmap/josm/plugins/geotools/GeoToolsPlugin.java

    r34097 r36015  
    1212import javax.media.jai.OperationRegistry;
    1313
     14import it.geosolutions.imageio.compression.CompressionRegistry;
    1415import org.geotools.image.ImageWorker;
    1516import org.geotools.referencing.CRS;
     
    3839    }
    3940
    40     private void initJAI() {
     41    private static void initJAI() {
    4142        // Disable mediaLib searching that produces unwanted errors
    4243        // See https://www.java.net/node/666373
     
    5051        // As the JAI jars are bundled in the geotools plugin, JAI initialization does not work,
    5152        // so we need to perform the tasks described here ("Initialization and automatic loading of registry objects"):
    52         // https://docs.oracle.com//cd/E17802_01/products/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/OperationRegistry.html
     53        // https://docs.oracle.com/cd/E17802_01/products/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/OperationRegistry.html
    5354        OperationRegistry registry = JAI.getDefaultInstance().getOperationRegistry();
    5455        if (registry == null) {
     
    9293    }
    9394
    94     private void initGeoTools() {
     95    private static void initGeoTools() {
    9596        // Force Axis order. Fix #8248
    9697        // See http://docs.geotools.org/stable/userguide/library/referencing/order.html
    9798        System.setProperty("org.geotools.referencing.forceXY", "true");
     99        // Force registration of compression. Fix #22303.
     100        CompressionRegistry.getDefaultInstance().registerApplicationClasspathSpis();
    98101    }
    99102
    100     private void checkEPSG() {
     103    private static void checkEPSG() {
    101104        try {
    102105            CRS.decode("EPSG:4326");
Note: See TracChangeset for help on using the changeset viewer.