コード例 #1
0
            protected URLBuilder(String version, AVList parameters)
            {
                Double d = (Double)parameters.getValue(AVKey.MISSING_DATA_SIGNAL);

                this.layerNames  = parameters.getStringValue(AVKey.LAYER_NAMES);
                this.styleNames  = parameters.getStringValue(AVKey.STYLE_NAMES);
                this.imageFormat = parameters.getStringValue(AVKey.IMAGE_FORMAT);

                String coordSystemKey;
                String defaultCS;

                if (version == null || WWUtil.compareVersion(version, "1.3.0") >= 0) // version 1.3.0 or greater
                {
                    this.wmsVersion = MAX_VERSION;
                    coordSystemKey  = "&crs=";
                    defaultCS       = "CRS:84"; // would like to do EPSG:4326 but that's incompatible with our old WMS server, see WWJ-474
                }
                else
                {
                    this.wmsVersion = version;
                    coordSystemKey  = "&srs=";
                    defaultCS       = "EPSG:4326";
                }

                String coordinateSystem = parameters.getStringValue(AVKey.COORDINATE_SYSTEM);

                this.crs = coordSystemKey + (coordinateSystem != null ? coordinateSystem : defaultCS);
            }
コード例 #2
0
        protected void createRasterServer(AVList parameters)
        {
            if (params == null)
            {
                String reason = Logging.getMessage("nullValue.ParamsIsNull");
                String msg    = Logging.getMessage("generic.CannotCreateRasterServer", reason);
                Logging.logger().severe(msg);
                throw new IllegalStateException(msg);
            }

            if (this.getDataFileStore() == null)
            {
                String reason = Logging.getMessage("nullValue.FileStoreIsNull");
                String msg    = Logging.getMessage("generic.CannotCreateRasterServer", reason);
                Logging.logger().severe(msg);
                throw new IllegalStateException(msg);
            }

            String datasetName = parameters.getStringValue(AVKey.DATASET_NAME);

            if (WWUtil.isEmpty(datasetName))
            {
                String reason = Logging.getMessage("generic.MissingRequiredParameter", AVKey.DATASET_NAME);
                String msg    = Logging.getMessage("generic.CannotCreateRasterServer", reason);
                Logging.logger().severe(msg);
                throw new IllegalStateException(msg);
            }

            String dataCacheName = parameters.getStringValue(AVKey.DATA_CACHE_NAME);

            if (WWUtil.isEmpty(dataCacheName))
            {
                String reason = Logging.getMessage("generic.MissingRequiredParameter", AVKey.DATA_CACHE_NAME);
                String msg    = Logging.getMessage("generic.CannotCreateRasterServer", reason);
                Logging.logger().severe(msg);
                throw new IllegalStateException(msg);
            }

            String rasterServerConfigFilename = dataCacheName + File.separator + datasetName + ".RasterServer.xml";

            final URL rasterServerFileURL = this.getDataFileStore().findFile(rasterServerConfigFilename, false);

            if (WWUtil.isEmpty(rasterServerFileURL))
            {
                String reason = Logging.getMessage("Configuration.ConfigNotFound", rasterServerConfigFilename);
                String msg    = Logging.getMessage("generic.CannotCreateRasterServer", reason);
                Logging.logger().severe(msg);
                throw new IllegalStateException(msg);
            }

            final AVList rasterServerParams = parameters.copy();

            rasterServerParams.setValue(AVKey.FILE_STORE, this.getDataFileStore());

            RetrieverFactory retrieverFactory = new RetrieverFactory()
            {
                final protected RasterServer rasterServer = new BasicRasterServer(rasterServerFileURL, rasterServerParams);
コード例 #3
0
        public static AVList getWCSElevationModelConfigParams(WCS100Capabilities caps, WCS100DescribeCoverage coverage,
                                                              AVList parameters)
        {
            DataConfigurationUtils.getWCSConfigParameters(caps, coverage, parameters); // checks for null args

            // Ensure that we found all the necessary information.
            if (parameters.getStringValue(AVKey.DATASET_NAME) == null)
            {
                Logging.logger().warning(Logging.getMessage("WCS.NoCoverageName"));
                throw new WWRuntimeException(Logging.getMessage("WCS.NoCoverageName"));
            }

            if (parameters.getStringValue(AVKey.SERVICE) == null)
            {
                Logging.logger().warning(Logging.getMessage("WCS.NoGetCoverageURL"));
                throw new WWRuntimeException(Logging.getMessage("WCS.NoGetCoverageURL"));
            }

            if (parameters.getStringValue(AVKey.DATA_CACHE_NAME) == null)
            {
                Logging.logger().warning(Logging.getMessage("nullValue.DataCacheIsNull"));
                throw new WWRuntimeException(Logging.getMessage("nullValue.DataCacheIsNull"));
            }

            if (parameters.getStringValue(AVKey.IMAGE_FORMAT) == null)
            {
                Logging.logger().severe("WCS.NoImageFormats");
                throw new WWRuntimeException(Logging.getMessage("WCS.NoImageFormats"));
            }

            if (parameters.getValue(AVKey.SECTOR) == null)
            {
                Logging.logger().severe("WCS.NoLonLatEnvelope");
                throw new WWRuntimeException(Logging.getMessage("WCS.NoLonLatEnvelope"));
            }

            if (parameters.getStringValue(AVKey.COORDINATE_SYSTEM) == null)
            {
                String msg = Logging.getMessage("WCS.RequiredCRSNotSupported", "EPSG:4326");
                Logging.logger().severe(msg);
                throw new WWRuntimeException(msg);
            }

            return(parameters);
        }
コード例 #4
0
 public static String getStringValue(AVList avList, String key)
 {
     try
     {
         return(avList.getStringValue(key));
     }
     catch (Exception e)
     {
         return(null);
     }
 }
コード例 #5
0
            public URLBuilder(AVList parameters)
            {
                this.layerNames      = parameters.getStringValue(AVKey.LAYER_NAMES);
                this.styleNames      = parameters.getStringValue(AVKey.STYLE_NAMES);
                this.imageFormat     = parameters.getStringValue(AVKey.IMAGE_FORMAT);
                this.backgroundColor = parameters.getStringValue(AVKey.WMS_BACKGROUND_COLOR);
                String version = parameters.getStringValue(AVKey.WMS_VERSION);

                String coordSystemKey;
                String defaultCS;

                if (version == null || WWUtil.compareVersion(version, "1.3.0") >= 0)
                {
                    this.wmsVersion = MAX_VERSION;
                    coordSystemKey  = "&crs=";
                    defaultCS       = "CRS:84"; // would like to do EPSG:4326 but that's incompatible with our old WMS server, see WWJ-474
                }
                else
                {
                    this.wmsVersion = version;
                    coordSystemKey  = "&srs=";
                    defaultCS       = "EPSG:4326";
                }

                String coordinateSystem = parameters.getStringValue(AVKey.COORDINATE_SYSTEM);

                this.crs = coordSystemKey + (coordinateSystem != null ? coordinateSystem : defaultCS);
            }
コード例 #6
0
        //**************************************************************//
        //********************  Configuration  *************************//
        //**************************************************************//

        /**
         * Parses WMSBasicElevationModel configuration parameters from a specified WMS Capabilities source. This writes
         * output as key-value pairs to parameters. Supported key and parameter names are: <table>
         * <th><td>Parameter</td><td>Value</td><td>Type</td></th> <tr><td>{@link AVKey#ELEVATION_MAX}</td><td>WMS layer's
         * maximum extreme elevation</td><td>Double</td></tr> <tr><td>{@link AVKey#ELEVATION_MIN}</td><td>WMS layer's
         * minimum extreme elevation</td><td>Double</td></tr> <tr><td>{@link AVKey#DATA_TYPE}</td><td>Translate WMS layer's
         * image format to a matching data type</td><td>String</td></tr> </table> This also parses common WMS layer
         * parameters by invoking {@link DataConfigurationUtils#getWMSLayerConfigParams(gov.nasa.worldwind.ogc.wms.WMSCapabilities,
         * String[], SharpEarth.avlist.AVList)}.
         *
         * @param caps                  the WMS Capabilities source to parse for WMSBasicElevationModel configuration
         *                              parameters.
         * @param formatOrderPreference an ordered array of preferred image formats, or null to use the default format.
         * @param parameters                the output key-value pairs which recieve the WMSBasicElevationModel configuration
         *                              parameters.
         *
         * @return a reference to parameters.
         *
         * @throws ArgumentException if either the document or parameters are null, or if parameters does not contain the
         *                                  required key-value pairs.
         * @throws SharpEarth.exception.WWRuntimeException
         *                                  if the Capabilities document does not contain any of the required information.
         */
        public static AVList getWMSElevationModelConfigParams(WMSCapabilities caps, String[] formatOrderPreference,
                                                              AVList parameters)
        {
            if (caps == null)
            {
                String message = Logging.getMessage("nullValue.WMSCapabilities");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            if (parameters == null)
            {
                String message = Logging.getMessage("nullValue.ElevationModelConfigParams");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            // Get common WMS layer parameters.
            DataConfigurationUtils.getWMSLayerConfigParams(caps, formatOrderPreference, parameters);

            // Attempt to extract the WMS layer names from the specified parameters.
            String layerNames = parameters.getStringValue(AVKey.LAYER_NAMES);

            if (layerNames == null || layerNames.Length == 0)
            {
                String message = Logging.getMessage("nullValue.WMSLayerNames");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            String[] names = layerNames.Split(',');
            if (names == null || names.Length == 0)
            {
                String message = Logging.getMessage("nullValue.WMSLayerNames");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            // Get the layer's extreme elevations.
            Double[] extremes = caps.getLayerExtremeElevations(names);

            Double d = (Double)parameters.getValue(AVKey.ELEVATION_MIN);

            if (d == null && extremes != null && extremes[0] != null)
            {
                parameters.setValue(AVKey.ELEVATION_MIN, extremes[0]);
            }

            d = (Double)parameters.getValue(AVKey.ELEVATION_MAX);
            if (d == null && extremes != null && extremes[1] != null)
            {
                parameters.setValue(AVKey.ELEVATION_MAX, extremes[1]);
            }

            // Compute the internal pixel type from the image format.
            if (parameters.getValue(AVKey.DATA_TYPE) == null && parameters.getValue(AVKey.IMAGE_FORMAT) != null)
            {
                String s = WWIO.makeDataTypeForMimeType(parameters.getValue(AVKey.IMAGE_FORMAT).ToString());
                if (s != null)
                {
                    parameters.setValue(AVKey.DATA_TYPE, s);
                }
            }

            // Use the default data type.
            if (parameters.getValue(AVKey.DATA_TYPE) == null)
            {
                parameters.setValue(AVKey.DATA_TYPE, AVKey.INT16);
            }

            // Use the default byte order.
            if (parameters.getValue(AVKey.BYTE_ORDER) == null)
            {
                parameters.setValue(AVKey.BYTE_ORDER, AVKey.LITTLE_ENDIAN);
            }

            return(parameters);
        }
コード例 #7
0
 protected URLBuilder(String version, AVList parameters)
 {
     this.serviceVersion = version;
     this.layerNames     = parameters.getStringValue(AVKey.COVERAGE_IDENTIFIERS);
     this.imageFormat    = parameters.getStringValue(AVKey.IMAGE_FORMAT);
 }