protected Header readHeaderFromBuffer(ByteBuffer buffer) throws WWRuntimeException {
    // Read file code - first byte
    int fileCode = buffer.get();
    if (fileCode > 5) {
      String message = Logging.getMessage("SHP.NotADBaseFile", file.getPath());
      Logging.logger().log(java.util.logging.Level.SEVERE, message);
      throw new WWRuntimeException(message);
    }

    // Last update date
    int yy = 0xFF & buffer.get(); // unsigned
    int mm = buffer.get();
    int dd = buffer.get();

    // Number of records
    int numRecords = buffer.getInt();

    // Header struct length
    int headerLength = buffer.getShort();

    // Record length
    int recordLength = buffer.getShort();

    // Assemble header
    Header header = new Header();
    header.fileCode = fileCode;
    Calendar cal = Calendar.getInstance();
    cal.set(1900 + yy, mm - 1, dd);
    header.lastModificationDate = cal.getTime();
    header.numberOfRecords = numRecords;
    header.headerLength = headerLength;
    header.recordLength = recordLength;

    return header;
  }
  public int countImagesInSector(Sector sector, int levelNumber) {
    if (sector == null) {
      String msg = Logging.getMessage("nullValue.SectorIsNull");
      Logging.logger().severe(msg);
      throw new IllegalArgumentException(msg);
    }

    Level targetLevel = this.levels.getLastLevel();
    if (levelNumber >= 0) {
      for (int i = levelNumber; i < this.getLevels().getLastLevel().getLevelNumber(); i++) {
        if (this.levels.isLevelEmpty(i)) continue;

        targetLevel = this.levels.getLevel(i);
        break;
      }
    }

    // Collect all the tiles intersecting the input sector.
    LatLon delta = targetLevel.getTileDelta();
    Angle latOrigin = this.levels.getTileOrigin().getLatitude();
    Angle lonOrigin = this.levels.getTileOrigin().getLongitude();
    final int nwRow = Tile.computeRow(delta.getLatitude(), sector.getMaxLatitude(), latOrigin);
    final int nwCol = Tile.computeColumn(delta.getLongitude(), sector.getMinLongitude(), lonOrigin);
    final int seRow = Tile.computeRow(delta.getLatitude(), sector.getMinLatitude(), latOrigin);
    final int seCol = Tile.computeColumn(delta.getLongitude(), sector.getMaxLongitude(), lonOrigin);

    int numRows = nwRow - seRow + 1;
    int numCols = seCol - nwCol + 1;

    return numRows * numCols;
  }
  public DBaseFile(InputStream is) {
    if (is == null) {
      String message = Logging.getMessage("nullValue.InputStreamIsNull");
      Logging.logger().severe(message);
      throw new IllegalArgumentException(message);
    }

    this.file = null;
    try {
      this.header = this.readHeaderFromStream(is);
      this.fields = this.readFieldsFromBuffer(this.header.fieldsHeaderBuffer);
      this.records = this.readRecordsFromStream(is);
    } catch (Exception e) {
      String message = Logging.getMessage("generic.ExceptionAttemptingToReadFrom", is.toString());
      Logging.logger().log(java.util.logging.Level.SEVERE, message, e);
      throw new WWRuntimeException(message, e);
    }
  }
  @Override
  protected Layer doCreateFromCapabilities(OGCCapabilities caps, AVList params) {
    String serviceName = caps.getServiceInformation().getServiceName();
    if (serviceName == null
        || !(serviceName.equalsIgnoreCase(OGCConstants.WMS_SERVICE_NAME)
            || serviceName.equalsIgnoreCase("WMS"))) {
      String message =
          Logging.getMessage("WMS.NotWMSService", serviceName != null ? serviceName : "null");
      Logging.logger().severe(message);
      throw new IllegalArgumentException(message);
    }

    if (params == null) params = new AVListImpl();

    if (params.getStringValue(AVKey.LAYER_NAMES) == null) {
      // Use the first named layer since no other guidance given
      List<WMSLayerCapabilities> namedLayers = ((WMSCapabilities) caps).getNamedLayers();

      if (namedLayers == null || namedLayers.size() == 0 || namedLayers.get(0) == null) {
        String message = Logging.getMessage("WMS.NoLayersFound");
        Logging.logger().severe(message);
        throw new IllegalStateException(message);
      }

      params.setValue(AVKey.LAYER_NAMES, namedLayers.get(0).getName());
    }

    return new WMSTiledImageLayer((WMSCapabilities) caps, params);
  }
Example #5
0
  public void makeOrderedRenderable(DrawContext dc, AirspaceRenderer renderer) {
    if (dc == null) {
      String message = Logging.getMessage("nullValue.DrawContextIsNull");
      Logging.logger().severe(message);
      throw new IllegalArgumentException(message);
    }

    if (renderer == null) {
      String message = Logging.getMessage("nullValue.RendererIsNull");
      Logging.logger().severe(message);
      throw new IllegalArgumentException(message);
    }

    for (Layer layer : this.layers) {
      if (!layer.isVisible()) continue;

      if (!layer.isAirspaceVisible(dc)) continue;

      // The layer is responsible for applying its own attributes, so we override its attributes
      // with our own just
      // before rendering.
      layer.setAttributes(this.getAttributes());

      // Create an ordered renderable that draws each layer, but specifies this Cake as the picked
      // object.
      OrderedRenderable or =
          renderer.createOrderedRenderable(dc, layer, layer.computeEyeDistance(dc), this);
      dc.addOrderedRenderable(or);
    }
  }
  protected boolean loadTile(Tile tile, java.net.URL url) {
    if (WWIO.isFileOutOfDate(url, this.placeNameServiceSet.getExpiryTime())) {
      // The file has expired. Delete it then request download of newer.
      this.getDataFileStore().removeFile(url);
      String message = Logging.getMessage("generic.DataFileExpired", url);
      Logging.logger().fine(message);
      return false;
    }

    PlaceNameChunk tileData;
    synchronized (this.fileLock) {
      tileData = readTileData(tile, url);
    }

    if (tileData == null) {
      // Assume that something's wrong with the file and delete it.
      this.getDataFileStore().removeFile(url);
      tile.getPlaceNameService()
          .markResourceAbsent(tile.getPlaceNameService().getTileNumber(tile.row, tile.column));
      String message = Logging.getMessage("generic.DeletedCorruptDataFile", url);
      Logging.logger().fine(message);
      return false;
    }

    tile.setDataChunk(tileData);
    WorldWind.getMemoryCache(Tile.class.getName()).add(tile.getFileCachePath(), tile);
    return true;
  }
  public int computeLevelForResolution(Sector sector, Globe globe, double resolution) {
    if (sector == null) {
      String message = Logging.getMessage("nullValue.SectorIsNull");
      Logging.logger().severe(message);
      throw new IllegalStateException(message);
    }

    if (globe == null) {
      String message = Logging.getMessage("nullValue.GlobeIsNull");
      Logging.logger().severe(message);
      throw new IllegalStateException(message);
    }

    double texelSize = 0;
    Level targetLevel = this.levels.getLastLevel();
    for (int i = 0; i < this.getLevels().getLastLevel().getLevelNumber(); i++) {
      if (this.levels.isLevelEmpty(i)) continue;

      texelSize = this.levels.getLevel(i).getTexelSize();
      if (texelSize > resolution) continue;

      targetLevel = this.levels.getLevel(i);
      break;
    }

    Logging.logger()
        .info(
            Logging.getMessage(
                "layers.TiledImageLayer.LevelSelection", targetLevel.getLevelNumber(), texelSize));
    return targetLevel.getLevelNumber();
  }
  public void write(DataRaster raster) throws IOException, IllegalArgumentException {
    if (null == raster) {
      String msg = Logging.getMessage("nullValue.RasterIsNull");
      Logging.logger().finest(msg);
      throw new IllegalArgumentException(msg);
    }

    if (!(raster.getWidth() > 0)) {
      String msg = Logging.getMessage("generic.InvalidWidth", raster.getWidth());
      Logging.logger().finest(msg);
      throw new IllegalArgumentException(msg);
    }

    if (!(raster.getHeight() > 0)) {
      String msg = Logging.getMessage("generic.InvalidHeight", raster.getHeight());
      Logging.logger().finest(msg);
      throw new IllegalArgumentException(msg);
    }

    if (raster instanceof BufferedImageRaster) {
      this.write(((BufferedImageRaster) raster).getBufferedImage(), raster);
    } else if (raster instanceof BufferWrapperRaster) {
      this.writeRaster((BufferWrapperRaster) raster);
    }
  }
  /**
   * Create an instance.
   *
   * @param tc the current {@link KMLTraversalContext}.
   * @param placemark the <i>Placemark</i> element containing the <i>Point</i>.
   * @param geom the {@link gov.nasa.worldwind.ogc.kml.KMLPoint} geometry.
   * @throws NullPointerException if the geometry is null.
   * @throws IllegalArgumentException if the parent placemark or the traversal context is null.
   */
  public KMLModelPlacemarkImpl(
      KMLTraversalContext tc, KMLPlacemark placemark, KMLAbstractGeometry geom) {
    if (tc == null) {
      String msg = Logging.getMessage("nullValue.TraversalContextIsNull");
      Logging.logger().severe(msg);
      throw new IllegalArgumentException(msg);
    }

    if (placemark == null) {
      String msg = Logging.getMessage("nullValue.ParentIsNull");
      Logging.logger().severe(msg);
      throw new IllegalArgumentException(msg);
    }

    if (geom == null) {
      String msg = Logging.getMessage("nullValue.GeometryIsNull");
      Logging.logger().severe(msg);
      throw new IllegalArgumentException(msg);
    }

    this.model = (KMLModel) geom;
    this.parent = placemark;

    this.resourceMap = this.createResourceMap(this.model);
  }
  /**
   * Create a new WebView.
   *
   * @param frameSize The size of the WebView rectangle.
   * @throws UnsupportedOperationException if this class is instantiated on a non-Windows operating
   *     system.
   * @throws WWRuntimeException if creating the native web browser window fails for any reason. For
   *     example, because the process has run out of User Object handles (see documentation <a
   *     href="#limits">above</a>).
   */
  public WindowsWebView(Dimension frameSize) {
    if (frameSize == null) {
      String message = Logging.getMessage("nullValue.SizeIsNull");
      Logging.logger().severe(message);
      throw new IllegalArgumentException(message);
    }

    if (!Configuration.isWindowsOS()) {
      String message =
          Logging.getMessage(
              "NativeLib.UnsupportedOperatingSystem",
              "Windows WebView",
              System.getProperty("os.name"));
      Logging.logger().severe(message);
      throw new UnsupportedOperationException(message);
    }

    this.frameSize = frameSize;

    try {
      // Increment the instance counter
      instances.incrementAndGet();

      // Make sure that the message loop thread is running
      this.ensureMessageLoopRunning();

      // Create the web view
      this.webViewWindowPtr = WindowsWebViewJNI.newWebViewWindow(webViewMessageLoop);
      if (this.webViewWindowPtr == 0) {
        String message = Logging.getMessage("WebView.NativeExceptionInitializingWebView");
        Logging.logger().severe(message);
        throw new WWRuntimeException(message);
      }

      WindowsWebViewJNI.setFrameSize(
          this.webViewWindowPtr, this.frameSize.width, this.frameSize.height);

      this.observerPtr = WindowsWebViewJNI.newNotificationAdapter(this);

      WindowsWebViewJNI.addWindowUpdateObserver(this.webViewWindowPtr, observerPtr);
    } catch (RuntimeException e) {
      // If the WebView was not created successfully do not increment the instance counter.
      instances.decrementAndGet();
      this.handleWebViewCreationError();
      throw e;
    } catch (Error e) {
      // If the WebView was not created successfully do not increment the instance counter.
      instances.decrementAndGet();
      this.handleWebViewCreationError();
      throw e;
    }
  }
  /**
   * Verifies that the record's shape type matches the expected one, typically that of the
   * shapefile. All non-null records in a Shapefile must be of the same type. Throws an exception if
   * the types do not match and the shape type is not <code>{@link Shapefile#SHAPE_NULL}</code>.
   * Records of type <code>SHAPE_NULL</code> are always valid, and may appear in any Shapefile.
   *
   * <p>For details, see the ESRI Shapefile specification at <a
   * href="http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf"/>, pages 4 and 5.
   *
   * @param shapefile the shapefile.
   * @param shapeType the record's shape type.
   * @throws WWRuntimeException if the shape types do not match.
   * @throws IllegalArgumentException if the specified shape type is null.
   */
  protected void validateShapeType(Shapefile shapefile, String shapeType) {
    if (shapeType == null) {
      String message = Logging.getMessage("nullValue.ShapeType");
      Logging.logger().severe(message);
      throw new IllegalArgumentException(message);
    }

    if (!shapeType.equals(shapefile.getShapeType()) && !shapeType.equals(Shapefile.SHAPE_NULL)) {
      String message = Logging.getMessage("SHP.UnsupportedShapeType", shapeType);
      Logging.logger().severe(message);
      throw new WWRuntimeException(message);
    }
  }
 public synchronized void removePropertyChangeListener(
     String propertyName, java.beans.PropertyChangeListener listener) {
   if (propertyName == null) {
     String msg = Logging.getMessage("nullValue.PropertyNameIsNull");
     Logging.logger().severe(msg);
     throw new IllegalArgumentException(msg);
   }
   if (listener == null) {
     String msg = Logging.getMessage("nullValue.ListenerIsNull");
     Logging.logger().severe(msg);
     throw new IllegalArgumentException(msg);
   }
   this.getChangeSupport().removePropertyChangeListener(propertyName, listener);
 }
 public synchronized String getStringValue(String key) {
   if (key == null) {
     String msg = Logging.getMessage("nullValue.AttributeKeyIsNull");
     Logging.logger().severe(msg);
     throw new IllegalStateException(msg);
   }
   try {
     return (String) this.getValue(key);
   } catch (ClassCastException e) {
     String msg = Logging.getMessage("AVAAccessibleImpl.AttributeValueForKeyIsNotAString", key);
     Logging.logger().severe(msg);
     throw new WWRuntimeException(msg, e);
   }
 }
    public void run() {
      if (Thread.currentThread().isInterrupted())
        return; // the task was cancelled because it's a duplicate or for some other reason

      try {
        this.placemark.retrieveModel(this.address);
      } catch (IOException e) {
        String message = Logging.getMessage("generic.ExceptionWhileReading", e.getMessage());
        Logging.logger().warning(message);
      } catch (XMLStreamException e) {
        String message =
            Logging.getMessage("generic.ExceptionAttemptingToParseXml", e.getMessage());
        Logging.logger().warning(message);
      }
    }
  /**
   * Causes resources used by the World Window to be freed. The World Window cannot be used once
   * this method is called. An OpenGL context for the window must be current.
   */
  public void shutdown() {
    WorldWind.getDataFileStore().removePropertyChangeListener(this);

    if (this.inputHandler != null) {
      this.inputHandler.dispose();
      this.inputHandler = new NoOpInputHandler();
    }

    // Clear the texture cache
    if (this.getGpuResourceCache() != null) this.getGpuResourceCache().clear();

    // Dispose all the layers //  TODO: Need per-window dispose for layers
    if (this.getModel() != null && this.getModel().getLayers() != null) {
      for (Layer layer : this.getModel().getLayers()) {
        try {
          layer.dispose();
        } catch (Exception e) {
          Logging.logger()
              .log(
                  java.util.logging.Level.SEVERE,
                  Logging.getMessage("WorldWindowGLCanvas.ExceptionWhileShuttingDownWorldWindow"),
                  e);
        }
      }
    }

    SceneController sc = this.getSceneController();
    if (sc != null) sc.dispose();
  }
  public boolean isLayerInView(DrawContext dc) {
    if (dc == null) {
      String message = Logging.getMessage("nullValue.DrawContextIsNull");
      Logging.logger().severe(message);
      throw new IllegalStateException(message);
    }

    if (dc.getView() == null) {
      String message = Logging.getMessage("layers.AbstractLayer.NoViewSpecifiedInDrawingContext");
      Logging.logger().severe(message);
      throw new IllegalStateException(message);
    }

    return !(dc.getVisibleSector() != null
        && !this.levels.getSector().intersects(dc.getVisibleSector()));
  }
  /**
   * @param placeNameServiceSet the set of PlaceNameService objects that PlaceNameLayer will render.
   * @throws IllegalArgumentException if {@link
   *     gov.nasa.worldwind.layers.placename.PlaceNameServiceSet} is null
   */
  public PlaceNameLayer(PlaceNameServiceSet placeNameServiceSet) {
    if (placeNameServiceSet == null) {
      String message = Logging.getMessage("nullValue.PlaceNameServiceSetIsNull");
      Logging.logger().fine(message);
      throw new IllegalArgumentException(message);
    }

    //
    this.placeNameServiceSet = placeNameServiceSet.deepCopy();
    for (int i = 0; i < this.placeNameServiceSet.getServiceCount(); i++) {
      // todo do this for long as well and pick min
      int calc1 =
          (int)
              (PlaceNameService.TILING_SECTOR.getDeltaLatDegrees()
                  / this.placeNameServiceSet
                      .getService(i)
                      .getTileDelta()
                      .getLatitude()
                      .getDegrees());
      int numLevels = (int) Math.log(calc1);
      navTiles.add(
          new NavigationTile(
              this.placeNameServiceSet.getService(i),
              PlaceNameService.TILING_SECTOR,
              numLevels,
              "top"));
    }

    if (!WorldWind.getMemoryCacheSet().containsCache(Tile.class.getName())) {
      long size = Configuration.getLongValue(AVKey.PLACENAME_LAYER_CACHE_SIZE, 2000000L);
      MemoryCache cache = new BasicMemoryCache((long) (0.85 * size), size);
      cache.setName("Placename Tiles");
      WorldWind.getMemoryCacheSet().addCache(Tile.class.getName(), cache);
    }
  }
  public synchronized void logUnavailableHost(URL url) {
    if (this.offlineMode) return;

    if (url == null) {
      String message = Logging.getMessage("nullValue.URLIsNull");
      Logging.error(message);
      throw new IllegalArgumentException(message);
    }

    String hostName = url.getHost();
    HostInfo hi = this.hostMap.get(hostName);
    if (hi != null) {
      if (!hi.isUnavailable()) {
        hi.logCount.incrementAndGet();
        if (hi.isUnavailable()) // host just became unavailable
        this.firePropertyChange(NetworkStatus.HOST_UNAVAILABLE, null, url);
      }
      hi.lastLogTime.set(System.currentTimeMillis());
    } else {
      hi = new HostInfo(this.attemptLimit.get(), this.tryAgainInterval.get());
      hi.logCount.set(1);
      if (hi.isUnavailable()) // the attempt limit may be as low as 1, so handle that case here
      this.firePropertyChange(NetworkStatus.HOST_UNAVAILABLE, null, url);
      this.hostMap.put(hostName, hi);
    }

    this.lastUnavailableLogTime.set(System.currentTimeMillis());
  }
    /**
     * Construct a request task for a specified network link resource.
     *
     * @param placemark the placemark for which to construct the request task.
     * @param address the address of the resource to request.
     */
    protected RequestTask(KMLModelPlacemarkImpl placemark, String address) {
      if (placemark == null) {
        String message = Logging.getMessage("nullValue.ObjectIsNull");
        Logging.logger().severe(message);
        throw new IllegalArgumentException(message);
      }

      if (address == null) {
        String message = Logging.getMessage("nullValue.PathIsNull");
        Logging.logger().severe(message);
        throw new IllegalArgumentException(message);
      }

      this.placemark = placemark;
      this.address = address;
    }
Example #20
0
  public boolean isAirspaceVisible(DrawContext dc) {
    if (dc == null) {
      String message = Logging.getMessage("nullValue.DrawContextIsNull");
      Logging.logger().severe(message);
      throw new IllegalArgumentException(message);
    }

    // If the parent Cake is not visible, then return false immediately without testing the child
    // layers.
    if (!super.isAirspaceVisible(dc)) return false;

    boolean visible = false;

    // The parent Cake is visible. Since the parent Cake's extent potentially contains volumes where
    // no child
    // geometry exists, test that at least one of the child layers are visible.
    for (Layer l : this.layers) {
      if (l.isAirspaceVisible(dc)) {
        visible = true;
        break;
      }
    }

    return visible;
  }
  /**
   * Create a {@link TiledImageLayer} layer described by an XML layer description.
   *
   * @param domElement the XML element describing the layer to create. The element must inculde a
   *     service name identifying the type of service to use to retrieve layer data. Recognized
   *     service types are "Offline", "WWTileService" and "OGC:WMS".
   * @param params any parameters to apply when creating the layer.
   * @return a new layer
   * @throws WWUnrecognizedException if the service type given in the describing element is
   *     unrecognized.
   */
  protected Layer createTiledImageLayer(Element domElement, AVList params) {
    Layer layer;

    String serviceName = WWXML.getText(domElement, "Service/@serviceName");

    if ("Offline".equals(serviceName)) {
      layer = new BasicTiledImageLayer(domElement, params);
    } else if ("WWTileService".equals(serviceName)) {
      layer = new BasicTiledImageLayer(domElement, params);
    } else if (OGCConstants.WMS_SERVICE_NAME.equals(serviceName)) {
      layer = new WMSTiledImageLayer(domElement, params);
    } else if (AVKey.SERVICE_NAME_LOCAL_RASTER_SERVER.equals(serviceName)) {
      layer = new LocalRasterServerLayer(domElement, params);
    } else {
      String msg = Logging.getMessage("generic.UnrecognizedServiceName", serviceName);
      throw new WWUnrecognizedException(msg);
    }
    //
    //        String name = layer.getStringValue(AVKey.DISPLAY_NAME);
    //        System.out.println(name);

    String actuate = WWXML.getText(domElement, "@actuate");
    layer.setEnabled(actuate != null && actuate.equals("onLoad"));

    return layer;
  }
  /** {@inheritDoc} */
  public void dispose() {
    if (this.disposed) // Do not dispose the WebView multiple times
    return;

    try {
      // Remove the notification adapter
      if (webViewWindowPtr != 0 && observerPtr != 0)
        WindowsWebViewJNI.removeWindowUpdateObserver(webViewWindowPtr, observerPtr);
      // Free the native WebView object associated with this Java WebView object.
      if (webViewWindowPtr != 0) {
        WindowsWebViewJNI.releaseWebView(webViewWindowPtr);
        // Decrement the instance counter. Only do this if the webViewWindow pointer was non-zero,
        // indicating
        // that native resources were actually allocated.
        instances.decrementAndGet();
      }
      if (observerPtr != 0) WindowsWebViewJNI.releaseComObject(observerPtr);

      this.webViewWindowPtr = 0;
      this.observerPtr = 0;

      // Terminate the message loop thread if this is the last active instance.
      this.stopMessageLoopIfNoInstances();

      this.disposed = true;
    } catch (Exception e) {
      Logging.logger()
          .log(
              Level.SEVERE,
              Logging.getMessage("generic.ExceptionAttemptingToDisposeRenderable"),
              e);
    }
  }
  /**
   * Create a layer described by an XML layer description.
   *
   * @param domElement the XML element describing the layer to create.
   * @param params any parameters to apply when creating the layer.
   * @return a new layer
   * @throws WWUnrecognizedException if the layer type or service type given in the describing
   *     element is unrecognized.
   * @see #createTiledImageLayer(org.w3c.dom.Element, gov.nasa.worldwind.avlist.AVList).
   */
  protected Layer createFromLayerDocument(Element domElement, AVList params) {
    String className = WWXML.getText(domElement, "@className");
    if (className != null && className.length() > 0) {
      Layer layer = (Layer) WorldWind.createComponent(className);
      String actuate = WWXML.getText(domElement, "@actuate");
      layer.setEnabled(WWUtil.isEmpty(actuate) || actuate.equals("onLoad"));
      WWXML.invokePropertySetters(layer, domElement);
      return layer;
    }

    AVList props = WWXML.copyProperties(domElement, null);
    if (props != null) { // Copy params and add any properties for this layer to the copy
      if (params != null) props.setValues(params);
      params = props;
    }

    Layer layer;
    String href = WWXML.getText(domElement, "@href");
    if (href != null && href.length() > 0) {
      Object o = this.createFromConfigSource(href, params);
      if (o == null) return null;

      if (!(o instanceof Layer)) {
        String msg =
            Logging.getMessage("LayerFactory.UnexpectedTypeForLayer", o.getClass().getName());
        throw new WWRuntimeException(msg);
      }

      layer = (Layer) o;
    } else {
      String layerType = WWXML.getText(domElement, "@layerType");
      if (layerType != null && layerType.equals("TiledImageLayer")) {
        layer = this.createTiledImageLayer(domElement, params);
      } else {
        String msg = Logging.getMessage("generic.UnrecognizedLayerType", layerType);
        throw new WWUnrecognizedException(msg);
      }
    }

    if (layer != null) {
      String actuate = WWXML.getText(domElement, "@actuate");
      layer.setEnabled(actuate != null && actuate.equals("onLoad"));
      WWXML.invokePropertySetters(layer, domElement);
    }

    return layer;
  }
 static int computeColumn(Angle delta, Angle longitude) {
   if (delta == null || longitude == null) {
     String msg = Logging.getMessage("nullValue.AngleIsNull");
     Logging.logger().severe(msg);
     throw new IllegalArgumentException(msg);
   }
   return (int) ((longitude.getDegrees() + 180d) / delta.getDegrees());
 }
 static Angle computeRowLatitude(int row, Angle delta) {
   if (delta == null) {
     String msg = Logging.getMessage("nullValue.AngleIsNull");
     Logging.logger().severe(msg);
     throw new IllegalArgumentException(msg);
   }
   return Angle.fromDegrees(-90d + delta.getDegrees() * row);
 }
 static Angle computeColumnLongitude(int column, Angle delta) {
   if (delta == null) {
     String msg = Logging.getMessage("nullValue.AngleIsNull");
     Logging.logger().severe(msg);
     throw new IllegalArgumentException(msg);
   }
   return Angle.fromDegrees(-180 + delta.getDegrees() * column);
 }
 public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
   if (propertyName == null) {
     String msg = Logging.getMessage("nullValue.PropertyNameIsNull");
     Logging.logger().severe(msg);
     throw new IllegalArgumentException(msg);
   }
   this.getChangeSupport().firePropertyChange(propertyName, oldValue, newValue);
 }
 public void firePropertyChange(java.beans.PropertyChangeEvent propertyChangeEvent) {
   if (propertyChangeEvent == null) {
     String msg = Logging.getMessage("nullValue.PropertyChangeEventIsNull");
     Logging.logger().severe(msg);
     throw new IllegalArgumentException(msg);
   }
   this.getChangeSupport().firePropertyChange(propertyChangeEvent);
 }
 /**
  * This method is called by the constructor if an exception is thrown creating the WebView. It
  * gives the WebView a change to cleanup static state that may have been set during the failed
  * WebView construction.
  */
 protected void handleWebViewCreationError() {
   try {
     this.stopMessageLoopIfNoInstances();
   } catch (Throwable t) {
     String message = Logging.getMessage("WebView.ExceptionStoppingWebViewThread", t);
     Logging.logger().severe(message);
   }
 }
Example #30
0
  public DBaseFile(File file) {
    if (file == null) {
      String message = Logging.getMessage("nullValue.FileIsNull");
      Logging.logger().severe(message);
      throw new IllegalArgumentException(message);
    }

    this.file = file;
    try {
      this.header = this.readHeaderFromFile(file);
      this.fields = this.readFieldsFromBuffer(this.header.fieldsHeaderBuffer);
      // Delay records loading until getRecords() is called.
    } catch (Exception e) {
      String message = Logging.getMessage("SHP.ExceptionAttemptingToReadFile", file.getPath());
      Logging.logger().log(java.util.logging.Level.SEVERE, message, e);
      throw new WWRuntimeException(message, e);
    }
  }