Exemplo n.º 1
0
        public void composeElevations(Sector sector, List <T> latlons, int tileWidth, double[] buffer) where T : LatLon
        {
            if (sector == null)
            {
                String msg = Logging.getMessage("nullValue.SectorIsNull");
                Logging.logger().severe(msg);
                throw new ArgumentException(msg);
            }

            if (latlons == null)
            {
                String msg = Logging.getMessage("nullValue.LatLonListIsNull");
                Logging.logger().severe(msg);
                throw new ArgumentException(msg);
            }

            if (buffer == null)
            {
                String msg = Logging.getMessage("nullValue.ElevationsBufferIsNull");
                Logging.logger().severe(msg);
                throw new ArgumentException(msg);
            }

            if (buffer.Length < latlons.Count || tileWidth > latlons.Count)
            {
                String msg = Logging.getMessage("ElevationModel.ElevationsBufferTooSmall", latlons.Count);
                Logging.logger().severe(msg);
                throw new ArgumentException(msg);
            }

            WMSBasicElevationModel.ElevationCompositionTile tile = new WMSBasicElevationModel.ElevationCompositionTile(
                sector, this.getLevels().getLastLevel(),
                tileWidth, latlons.Count / tileWidth);

            this.downloadElevations(tile);
            tile.setElevations(this.readElevations(tile.getFile().toURI().toURL()), this);

            for (int i = 0; i < latlons.Count; i++)
            {
                LatLon ll = latlons[i];
                if (ll == null)
                {
                    continue;
                }

                double value = this.lookupElevation(ll.getLatitude(), ll.getLongitude(), tile);

                // If an elevation at the given location is available, then write that elevation to the destination buffer.
                // Otherwise do nothing.
                if (value != this.getMissingDataSignal())
                {
                    buffer[i] = value;
                }
            }
        }
Exemplo n.º 2
0
        protected void downloadElevations(WMSBasicElevationModel.ElevationCompositionTile tile)
        {
            URL url = tile.getResourceURL();

            Retriever retriever = new HTTPRetriever(url,
                                                    new WMSBasicElevationModel.CompositionRetrievalPostProcessor(tile.getFile()));

            retriever.setConnectTimeout(10000);
            retriever.setReadTimeout(60000);
            retriever.call();
        }