コード例 #1
0
 /** Sets the layer-selection checkboxes to replicate the "current view". */
 public void setToDefault() {
   final Zone zone = TabletopTool.getFrame().getCurrentZoneRenderer().getZone();
   if (this == ExportLayers.LAYER_FOG) {
     ExportLayers.LAYER_FOG.setChecked(zone.hasFog());
   } else if (this == ExportLayers.LAYER_VISIBILITY) {
     ExportLayers.LAYER_VISIBILITY.setChecked(zone.getVisionType() != Zone.VisionType.OFF);
   } else {
     setChecked(true);
   }
 }
コード例 #2
0
  /**
   * This is a wrapper that preserves the layer settings on the Zone object. It calls {@link
   * takeEntireMapScreenShot()} to to the real work.
   *
   * @return the image to be saved to a file
   */
  private static BufferedImage entireMapScreenShotWithLayers() throws Exception, OutOfMemoryError {
    final Zone zone = TabletopTool.getFrame().getCurrentZoneRenderer().getZone();

    //
    // Preserve settings
    //
    // psuedo-layers
    final Zone.VisionType savedVision = zone.getVisionType();
    final boolean savedFog = zone.hasFog();
    final boolean savedBoard = zone.drawBoard();
    // real layers
    final boolean savedToken = Zone.Layer.TOKEN.isEnabled();
    final boolean savedHidden = Zone.Layer.GM.isEnabled();
    final boolean savedObject = Zone.Layer.OBJECT.isEnabled();
    final boolean savedBackground = Zone.Layer.BACKGROUND.isEnabled();

    //
    // set according to dialog options
    //
    zone.setHasFog(ExportLayers.LAYER_FOG.isChecked());
    if (!ExportLayers.LAYER_VISIBILITY.isChecked()) zone.setVisionType(Zone.VisionType.OFF);
    zone.setDrawBoard(ExportLayers.LAYER_BOARD.isChecked());
    Zone.Layer.TOKEN.setEnabled(ExportLayers.LAYER_TOKEN.isChecked());
    Zone.Layer.GM.setEnabled(ExportLayers.LAYER_HIDDEN.isChecked());
    Zone.Layer.OBJECT.setEnabled(ExportLayers.LAYER_OBJECT.isChecked());
    Zone.Layer.BACKGROUND.setEnabled(ExportLayers.LAYER_BACKGROUND.isChecked());
    // This 'cache invalidation' is handled by setZone inside takeEntireMapScreenShot()
    // but it should be more robust.
    // TabletopTool.getFrame().getCurrentZoneRenderer().invalidateCurrentViewCache();

    //
    // screenshot!
    //   MCL: NOTE: while turning off Fog, there is a possibility the players
    //    may see the map flash for a second with fog turned off-- need to look into
    //    whether this is true.
    BufferedImage image = null;
    try {
      image = takeEntireMapScreenShot();
    } finally {
      //
      // Restore settings
      //
      zone.setHasFog(savedFog);
      zone.setVisionType(savedVision);
      zone.setDrawBoard(savedBoard);
      Zone.Layer.TOKEN.setEnabled(savedToken);
      Zone.Layer.GM.setEnabled(savedHidden);
      Zone.Layer.OBJECT.setEnabled(savedObject);
      Zone.Layer.BACKGROUND.setEnabled(savedBackground);
      //			TabletopTool.getFrame().getCurrentZoneRenderer().invalidateCurrentViewCache();
    }

    return image;
  }
コード例 #3
0
 public static void setDefaultChecked() {
   // everything defaults to 'on' since the layers don't really have on/off capability
   // outside of this screenshot code
   for (ExportLayers layer : ExportLayers.values()) {
     layer.setChecked(true);
   }
   // however, some psuedo-layers do have a state, so set that appropriately
   final Zone zone = TabletopTool.getFrame().getCurrentZoneRenderer().getZone();
   ExportLayers.LAYER_VISIBILITY.setChecked(zone.getVisionType() != Zone.VisionType.OFF);
   ExportLayers.LAYER_FOG.setChecked(zone.hasFog());
 }