コード例 #1
0
        protected void downloadElevations(ElevationCompositionTile tile)
        {
            URL url = tile.getResourceURL();

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

            retriever.setConnectTimeout(10000);
            retriever.setReadTimeout(60000);
            retriever.call();
        }
コード例 #2
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.size() || tileWidth > latlons.size())
            {
                String msg = Logging.getMessage("ElevationModel.ElevationsBufferTooSmall", latlons.size());
                Logging.logger().severe(msg);
                throw new ArgumentException(msg);
            }

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

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

            for (int i = 0; i < latlons.size(); i++)
            {
                LatLon ll = latlons.get(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;
                }
            }
        }