示例#1
0
 /**
  * Updates selection status of this graphic. Selection is visualized by changing the line color of
  * this graphic.
  *
  * @param selected True if the graphic is now selected, false if the graphic is no longer
  *     selected.
  */
 @Override
 public void setSelectionStatus(boolean selected) {
   super.setSelectionStatus(selected);
   // Simply change the color of the outline when selected.
   if (selected) {
     this.setLinePaint(this.selectionColor);
   } else {
     this.setLinePaint(this.lineColor);
   }
 }
示例#2
0
  /**
   * Updates the display of this {@code VesselOutline} with new position and static data.
   *
   * <p>This method calls the super implementation as part of the update process:<br>
   * {@inheritDoc}
   */
  @Override
  public void updateGraphic(VesselTarget vesselTarget, float mapScale) {
    VesselPositionData positionData = vesselTarget != null ? vesselTarget.getPositionData() : null;
    VesselStaticData staticData = vesselTarget != null ? vesselTarget.getStaticData() : null;
    if (positionData == null || staticData == null) {
      // We cannot update the graphic if either position or static data is not available.
      return;
    }
    // Let super store reference to the updated VesselTarget.
    super.updateGraphic(vesselTarget, mapScale);

    VesselPortrayalData outlineData =
        new VesselPortrayalData(
            positionData.getPos(),
            positionData.getTrueHeading(),
            staticData.getDimBow(),
            staticData.getDimStern(),
            staticData.getDimPort(),
            staticData.getDimStarboard());

    this.updateGraphic(outlineData);
  }