/**
   * Updates the renderer (using the given {@link UpdateType}), with then given set of UI elements.
   * Depending on the value of {@link UpdateType}, current sources will either have their state
   * updated, or will be overwritten by the given set of UI elements.
   */
  protected void redraw(
      final ArrayList<TextSource> textSources,
      final ArrayList<PointSource> pointSources,
      final ArrayList<LineSource> lineSources,
      final ArrayList<ImageSource> imageSources,
      EnumSet<UpdateType> updateTypes) {

    //    Log.d(TAG, getLayerName() + "RLP Updating renderer: " + updateTypes);
    if (renderer == null) {
      Log.w(TAG, "RLP Renderer not set - aborting: " + this.getClass().getSimpleName());
      return;
    }

    renderMapLock.lock();
    try {
      // Blog.d(this, "Redraw: " + updateTypes);
      AtomicSection atomic = renderer.createAtomic();
      setSources(textSources, updateTypes, TextSource.class, atomic);
      setSources(pointSources, updateTypes, PointSource.class, atomic);
      setSources(lineSources, updateTypes, LineSource.class, atomic);
      setSources(imageSources, updateTypes, ImageSource.class, atomic);
      renderer.queueAtomic(atomic);
    } finally {
      renderMapLock.unlock();
    }
  }
  @Override
  public void setVisible(boolean visible) {
    Log.w(TAG, "RLP setVisible: entry");
    renderMapLock.lock();
    try {
      if (renderer == null) {
        Log.w(
            TAG, "RLP setVisible: Renderer not set - aborting " + this.getClass().getSimpleName());
        return;
      }

      AtomicSection atomic = renderer.createAtomic();
      for (Entry<Class<?>, RenderManager<?>> entry : renderMap.entrySet()) {
        entry.getValue().queueEnabled(visible, atomic);
      }
      renderer.queueAtomic(atomic);
    } finally {
      renderMapLock.unlock();
    }
  }
Example #3
0
 @Override
 public void setVisible(boolean visible) {
   Log.d(TAG, "Setting showSkyGradient " + visible);
   if (visible) {
     redraw();
   } else {
     rendererLock.lock();
     try {
       renderer.queueDisableSkyGradient();
     } finally {
       rendererLock.unlock();
     }
   }
 }
Example #4
0
  /** Redraws the sky shading gradient using the model's current time. */
  protected void redraw() {
    Date modelTime = model.getTime();
    if (Math.abs(modelTime.getTime() - lastUpdateTimeMs) > UPDATE_FREQUENCY_MS) {
      lastUpdateTimeMs = modelTime.getTime();

      RaDec sunPosition = SolarPositionCalculator.getSolarPosition(modelTime);
      // Log.d(TAG, "Enabling sky gradient with sun position " + sunPosition);
      rendererLock.lock();
      try {
        renderer.queueEnableSkyGradient(GeocentricCoordinates.getInstance(sunPosition));
      } finally {
        rendererLock.unlock();
      }
    }
  }
 protected void addUpdateClosure(UpdateClosure closure) {
   if (renderer != null) {
     renderer.addUpdateClosure(closure);
   }
 }
 protected void removeUpdateClosure(UpdateClosure closure) {
   if (renderer != null) {
     renderer.removeUpdateCallback(closure);
   }
 }