예제 #1
0
 /**
  * Updates the panel's text or the grids second settable dimension.
  *
  * @param toPanel true = from grid to panel, false = from panel to grid
  * @param grid
  */
 private void updateSecondDimension(Grid grid, boolean toPanel) {
   if (grid.getCapabilities().isSecondDimensionAdjustmentSupported()) {
     if (toPanel) {
       // truncate to 3 decimal places
       double secondDim = Math.round(grid.getSecondDimension() * 1000.0) / 1000.0;
       gridSecondDimension.setText(Double.toString(secondDim));
     } else { // toGrid
       double newMajDiameter = getDouble(gridSecondDimension.getText(), 0);
       grid.setSecondDimension(newMajDiameter);
     }
   }
 }
예제 #2
0
  /*
   * (non-Javadoc)
   *
   * @see maptool.client.Tool#attachTo(maptool.client.ZoneRenderer)
   */
  @Override
  protected void attachTo(ZoneRenderer renderer) {
    oldShowGrid = AppState.isShowGrid();
    AppState.setShowGrid(true);

    Grid grid = renderer.getZone().getGrid();

    boolean showSecond =
        grid.getCapabilities().isSecondDimensionAdjustmentSupported() ? true : false;
    gridSecondDimension.setVisible(showSecond);
    gridSecondDimensionLabel.setVisible(showSecond);

    MapTool.getFrame().showControlPanel(controlPanel);
    renderer.repaint();

    super.attachTo(renderer);

    copyGridToControlPanel();
  }