gpt4 book ai didi

gov.nasa.worldwind.WorldWindow.requestRedraw()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-23 02:43:05 26 4
gpt4 key购买 nike

本文整理了Java中gov.nasa.worldwind.WorldWindow.requestRedraw()方法的一些代码示例,展示了WorldWindow.requestRedraw()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WorldWindow.requestRedraw()方法的具体详情如下:
包路径:gov.nasa.worldwind.WorldWindow
类名称:WorldWindow
方法名:requestRedraw

WorldWindow.requestRedraw介绍

[英]Request that this WorldWindow update its display. Prior changes to this WorldWindow's Navigator, Globe and Layers (including the contents of layers) are reflected on screen sometime after calling this method. May be called from any thread.
[中]请求此WorldWindow更新其显示。调用此方法后,之前对此WorldWindow的导航器、全局和层(包括层的内容)所做的更改会反映在屏幕上。可以从任何线程调用。

代码示例

代码示例来源:origin: NASAWorldWind/WorldWindAndroid

@Override
public void onMessage(String name, Object sender, Map<Object, Object> userProperties) {
  if (name.equals(WorldWind.REQUEST_REDRAW)) {
    this.requestRedraw(); // may be called on any thread
  }
}

代码示例来源:origin: NASAWorldWind/WorldWindAndroid

/**
 * Updates the status overlay after the background processing is complete.
 */
@Override
protected void onPostExecute(Void notUsed) {
  super.onPostExecute(notUsed);
  statusText.setText(String.format(Locale.US, "%,d places, %,d highways and %,d countries created",
    this.numPlacesCreated,
    this.numHighwaysCreated,
    this.numCountriesCreated));
  getWorldWindow().requestRedraw();
}

代码示例来源:origin: NASAWorldWind/WorldWindAndroid

/**
   * Updates the aircraft placemark positions on the UI Thread.
   */
  @Override
  protected void onPostExecute(Void notUsed) {
    super.onPostExecute(notUsed);
    // Update the aircraft placemark positions with the positions computed on the background thread.
    for (Placemark aircraft : aircraftPositions.keySet()) {
      aircraft.setPosition(aircraftPositions.get(aircraft));
    }
    getWorldWindow().requestRedraw();
    // Determine if the animation is done
    if (frameCount > ANIMATION_FRAMES) {
      // All the aircraft have arrived at their destinations; pause the animation
      pauseAnimation = true;
      statusText.setText("Animation complete");
    }
    // Re-execute the animation after the prescribed delay
    if (!pauseAnimation) {
      handler.postDelayed(PlacemarksMilStd2525DemoActivity.this, DELAY_TIME);
    }
  }
}

代码示例来源:origin: NASAWorldWind/WorldWindAndroid

/**
 * Updates the WorldWindow layer list on the UI Thread.
 */
@Override
protected void onPostExecute(Void notUsed) {
  super.onPostExecute(notUsed);
  getWorldWindow().getLayers().addLayer(this.placeLayer);
  statusText.setText(String.format(Locale.US, "%,d US places created", this.numPlacesCreated));
  getWorldWindow().requestRedraw();
}

代码示例来源:origin: NASAWorldWind/WorldWindAndroid

@Override
  public boolean handleMessage(Message msg) {
    if (msg.what == MSG_ID_CLEAR_CACHE) {
      renderResourceCache.clear();
    } else if (msg.what == MSG_ID_REQUEST_REDRAW) {
      requestRedraw();
    } else if (msg.what == MSG_ID_SET_VIEWPORT) {
      viewport.set((Viewport) msg.obj);
    } else if (msg.what == MSG_ID_SET_DEPTH_BITS) {
      depthBits = (Integer) msg.obj;
    }
    return false;
  }
});

代码示例来源:origin: NASAWorldWind/WorldWindAndroid

/**
 * Updates the RenderableLayer on the UI Thread. Invoked by calls to publishProgress.
 *
 * @param renderables An array of Renderables (length = 1) to add to the shapes layer.
 */
@Override
protected void onProgressUpdate(Renderable... renderables) {
  super.onProgressUpdate(renderables);
  Renderable shape = renderables[0];
  statusText.setText("Added " + shape.getDisplayName() + " feature...");
  shapesLayer.addRenderable(shape);
  getWorldWindow().requestRedraw();
}

代码示例来源:origin: NASAWorldWind/WorldWindAndroid

/**
   * Toggles the highlighted state of a picked object.
   */
  public void togglePickedObjectHighlights() {
    String message = "";
    for (Object pickedObject : pickedObjects) {
      if (pickedObject instanceof Highlightable) {
        Highlightable highlightable = (Highlightable) pickedObject;
        highlightable.setHighlighted(!highlightable.isHighlighted());
        if (highlightable.isHighlighted()) {
          if (!message.isEmpty()) {
            message += ", ";
          }
          message += ((Renderable) highlightable).getDisplayName();
        }
      }
    }
    if (!message.isEmpty()) {
      Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
    }
    this.getWorldWindow().requestRedraw();
  }
}

代码示例来源:origin: NASAWorldWind/WorldWindAndroid

/**
   * Toggles the selected state of a picked object.
   */
  public void toggleSelection() {
    // Display the highlight or normal attributes to indicate the
    // selected or unselected state respectively.
    if (pickedObject instanceof Highlightable) {
      // Determine if we've picked a "new" object so we know to deselect the previous selection
      boolean isNewSelection = pickedObject != this.selectedObject;
      // Only one object can be selected at time, deselect any previously selected object
      if (isNewSelection && this.selectedObject instanceof Highlightable) {
        ((Highlightable) this.selectedObject).setHighlighted(false);
      }
      // Show the selection by showing its highlight attributes
      ((Highlightable) pickedObject).setHighlighted(isNewSelection);
      this.getWorldWindow().requestRedraw();
      // Track the selected object
      this.selectedObject = isNewSelection ? pickedObject : null;
    }
  }
}

代码示例来源:origin: NASAWorldWind/WorldWindAndroid

@Override
  public void run() {
    this.wwd.getNavigator().setAsCamera(this.wwd.getGlobe(), this.camera);
    this.wwd.requestRedraw();
    pool.release(this.reset());
  }
}

代码示例来源:origin: NASAWorldWind/WorldWindAndroid

public void onFinished(String vehicleType) {
  PlacemarksSelectDragActivity activity = (PlacemarksSelectDragActivity) getActivity();
  if (activity.controller.selectedObject instanceof Placemark) {
    Placemark placemark = (Placemark) activity.controller.selectedObject;
    String currentType = (String) placemark.getUserProperty(this.vehicleKey);
    if (currentType.equals(vehicleType)) {
      return;
    }
    // Update the placemark's icon attributes and vehicle type property.
    ImageSource imageSource = ImageSource.fromResource(this.vehicleIcons.get(vehicleType));
    placemark.putUserProperty(this.vehicleKey, vehicleType);
    placemark.getAttributes().setImageSource(imageSource);
    placemark.getHighlightAttributes().setImageSource(imageSource);
    // Show the change
    activity.getWorldWindow().requestRedraw();
  }
}

代码示例来源:origin: NASAWorldWind/WorldWindAndroid

@Override
public void doFrame(long frameTimeNanos) {
  if (this.lastFrameTimeNanos != 0) {
    // Compute the frame duration in seconds.
    double frameDurationSeconds = (frameTimeNanos - this.lastFrameTimeNanos) * 1.0e-9;
    double cameraDegrees = (frameDurationSeconds * this.cameraDegreesPerSecond);
    // Move the navigator to continuously bring new tiles into view.
    Navigator navigator = getWorldWindow().getNavigator();
    navigator.setLongitude(navigator.getLongitude() + cameraDegrees);
    // Redraw the WorldWindow to display the above changes.
    this.getWorldWindow().requestRedraw();
  }
  Choreographer.getInstance().postFrameCallback(this);
  this.lastFrameTimeNanos = frameTimeNanos;
}

代码示例来源:origin: NASAWorldWind/WorldWindAndroid

@Override
public void doFrame(long frameTimeNanos) {
  if (this.lastFrameTimeNanos != 0) {
    // Compute the frame duration in seconds.
    double frameDurationSeconds = (frameTimeNanos - this.lastFrameTimeNanos) * 1.0e-9;
    double cameraDegrees = (frameDurationSeconds * this.cameraDegreesPerSecond);
    // Move the navigator to simulate the Earth's rotation about its axis.
    Navigator navigator = getWorldWindow().getNavigator();
    navigator.setLongitude(navigator.getLongitude() - cameraDegrees);
    // Redraw the WorldWindow to display the above changes.
    this.getWorldWindow().requestRedraw();
  }
  if (!this.activityPaused) { // stop animating when this Activity is paused
    Choreographer.getInstance().postFrameCallback(this);
  }
  this.lastFrameTimeNanos = frameTimeNanos;
}

代码示例来源:origin: NASAWorldWind/WorldWindAndroid

@Override
public void doFrame(long frameTimeNanos) {
  if (this.lastFrameTimeNanos != 0) {
    // Compute the frame duration in seconds.
    double frameDurationSeconds = (frameTimeNanos - this.lastFrameTimeNanos) * 1.0e-9;
    double cameraDegrees = (frameDurationSeconds * this.cameraDegreesPerSecond);
    // Move the navigator to simulate the Earth's rotation about its axis.
    Navigator navigator = getWorldWindow().getNavigator();
    navigator.setLongitude(navigator.getLongitude() - cameraDegrees);
    // Redraw the WorldWindow to display the above changes.
    this.getWorldWindow().requestRedraw();
  }
  if (!this.activityPaused) { // stop animating when this Activity is paused
    Choreographer.getInstance().postFrameCallback(this);
  }
  this.lastFrameTimeNanos = frameTimeNanos;
}

代码示例来源:origin: NASAWorldWind/WorldWindAndroid

protected void handlePinch(GestureRecognizer recognizer) {
  int state = recognizer.getState();
  float scale = ((PinchRecognizer) recognizer).getScale();
  if (state == WorldWind.BEGAN) {
    this.gestureDidBegin();
  } else if (state == WorldWind.CHANGED) {
    if (scale != 0) {
      // Apply the change in scale to the navigator, relative to when the gesture began.
      this.lookAt.range = this.beginLookAt.range / scale;
      this.applyLimits(this.lookAt);
      this.wwd.getNavigator().setAsLookAt(this.wwd.getGlobe(), this.lookAt);
      this.wwd.requestRedraw();
    }
  } else if (state == WorldWind.ENDED || state == WorldWind.CANCELLED) {
    this.gestureDidEnd();
  }
}

代码示例来源:origin: NASAWorldWind/WorldWindAndroid

protected void handleRotate(GestureRecognizer recognizer) {
  int state = recognizer.getState();
  float rotation = ((RotationRecognizer) recognizer).getRotation();
  if (state == WorldWind.BEGAN) {
    this.gestureDidBegin();
    this.lastRotation = 0;
  } else if (state == WorldWind.CHANGED) {
    // Apply the change in rotation to the navigator, relative to the navigator's current values.
    double headingDegrees = this.lastRotation - rotation;
    this.lookAt.heading = WWMath.normalizeAngle360(this.lookAt.heading + headingDegrees);
    this.lastRotation = rotation;
    this.wwd.getNavigator().setAsLookAt(this.wwd.getGlobe(), this.lookAt);
    this.wwd.requestRedraw();
  } else if (state == WorldWind.ENDED || state == WorldWind.CANCELLED) {
    this.gestureDidEnd();
  }
}

代码示例来源:origin: NASAWorldWind/WorldWindAndroid

@Override
protected void handleRotate(GestureRecognizer recognizer) {
  int state = recognizer.getState();
  float rotation = ((RotationRecognizer) recognizer).getRotation();
  if (state == WorldWind.BEGAN) {
    this.gestureDidBegin();
    this.lastRotation = 0;
  } else if (state == WorldWind.CHANGED) {
    // Apply the change in rotation to the navigator, relative to the navigator's current values.
    double headingDegrees = this.lastRotation - rotation;
    this.camera.heading = WWMath.normalizeAngle360(this.camera.heading + headingDegrees);
    this.lastRotation = rotation;
    this.wwd.getNavigator().setAsCamera(this.wwd.getGlobe(), this.camera);
    this.wwd.requestRedraw();
  } else if (state == WorldWind.ENDED || state == WorldWind.CANCELLED) {
    this.gestureDidEnd();
  }
}

代码示例来源:origin: NASAWorldWind/WorldWindAndroid

@Override
protected void handlePinch(GestureRecognizer recognizer) {
  int state = recognizer.getState();
  float scale = ((PinchRecognizer) recognizer).getScale();
  if (state == WorldWind.BEGAN) {
    this.gestureDidBegin();
  } else if (state == WorldWind.CHANGED) {
    if (scale != 0) {
      // Apply the change in scale to the navigator, relative to when the gesture began.
      scale = ((scale - 1) * 0.1f) + 1; // dampen the scale factor
      this.camera.altitude = this.camera.altitude * scale;
      this.applyLimits(this.camera);
      this.wwd.getNavigator().setAsCamera(this.wwd.getGlobe(), this.camera);
      this.wwd.requestRedraw();
    }
  } else if (state == WorldWind.ENDED || state == WorldWind.CANCELLED) {
    this.gestureDidEnd();
  }
}

代码示例来源:origin: NASAWorldWind/WorldWindAndroid

@Override
public void doFrame(long frameTimeNanos) {
  if (this.lastFrameTimeNanos != 0) {
    // Compute the frame duration in seconds.
    double frameDurationSeconds = (frameTimeNanos - this.lastFrameTimeNanos) * 1.0e-9;
    double cameraDegrees = (frameDurationSeconds * this.cameraDegreesPerSecond);
    double lightDegrees = (frameDurationSeconds * this.lightDegreesPerSecond);
    // Move the navigator to simulate the Earth's rotation about its axis.
    Navigator navigator = getWorldWindow().getNavigator();
    navigator.setLongitude(navigator.getLongitude() - cameraDegrees);
    // Move the sun location to simulate the Sun's rotation about the Earth.
    this.sunLocation.set(this.sunLocation.latitude, this.sunLocation.longitude - lightDegrees);
    this.atmosphereLayer.setLightLocation(this.sunLocation);
    // Redraw the WorldWindow to display the above changes.
    this.getWorldWindow().requestRedraw();
  }
  if (!this.activityPaused) { // stop animating when this Activity is paused
    Choreographer.getInstance().postFrameCallback(this);
  }
  this.lastFrameTimeNanos = frameTimeNanos;
}

代码示例来源:origin: NASAWorldWind/WorldWindAndroid

protected void handleTilt(GestureRecognizer recognizer) {
  int state = recognizer.getState();
  float dx = recognizer.getTranslationX();
  float dy = recognizer.getTranslationY();
  if (state == WorldWind.BEGAN) {
    this.gestureDidBegin();
    this.lastRotation = 0;
  } else if (state == WorldWind.CHANGED) {
    // Apply the change in tilt to the navigator, relative to when the gesture began.
    double headingDegrees = 180 * dx / this.wwd.getWidth();
    double tiltDegrees = -180 * dy / this.wwd.getHeight();
    this.lookAt.heading = WWMath.normalizeAngle360(this.beginLookAt.heading + headingDegrees);
    this.lookAt.tilt = this.beginLookAt.tilt + tiltDegrees;
    this.applyLimits(this.lookAt);
    this.wwd.getNavigator().setAsLookAt(this.wwd.getGlobe(), this.lookAt);
    this.wwd.requestRedraw();
  } else if (state == WorldWind.ENDED || state == WorldWind.CANCELLED) {
    this.gestureDidEnd();
  }
}

代码示例来源:origin: NASAWorldWind/WorldWindAndroid

@Override
protected void handleTilt(GestureRecognizer recognizer) {
  int state = recognizer.getState();
  float dx = recognizer.getTranslationX();
  float dy = recognizer.getTranslationY();
  if (state == WorldWind.BEGAN) {
    this.gestureDidBegin();
    this.lastRotation = 0;
  } else if (state == WorldWind.CHANGED) {
    // Apply the change in tilt to the navigator, relative to when the gesture began.
    double headingDegrees = 180 * dx / this.wwd.getWidth();
    double tiltDegrees = -180 * dy / this.wwd.getHeight();
    this.camera.heading = WWMath.normalizeAngle360(this.beginCamera.heading + headingDegrees);
    this.camera.tilt = this.beginCamera.tilt + tiltDegrees;
    this.applyLimits(camera);
    this.wwd.getNavigator().setAsCamera(this.wwd.getGlobe(), this.camera);
    this.wwd.requestRedraw();
  } else if (state == WorldWind.ENDED || state == WorldWind.CANCELLED) {
    this.gestureDidEnd();
  }
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com