Exemplo n.º 1
0
  /**
   * Set the working projection.
   *
   * @param proj projection to use
   */
  private void setWorkingProjection(ProjectionImpl proj) {
    if (proj == null) {
      return;
    }
    if (debug) {
      System.out.println("ProjManager.setWorkingProjection " + proj);
    }
    current = (ProjectionImpl) proj.constructCopy();
    if (debug) {
      System.out.println(
          "ProjManager.setWorkingProjection map area = " + current.getDefaultMapArea());
    }

    if (current != null) {
      mapLabel.setText(current.getName());
    }
    npViewControl.setProjectionImpl(current);
  }
Exemplo n.º 2
0
    /** user has hit the "accept/save" button */
    private void accept() {
      ProjectionClass projClass = findProjectionClass(editProjection);
      if (null == projClass) {
        System.out.println(
            "Projection Manager accept: findProjectionClass failed" + editProjection);
        return;
      }
      setProjFromDialog(projClass, editProjection);
      ProjectionRect mapArea = mapEditPanel.getSelectedRegion();
      if (mapArea == null) {
        mapArea = mapEditPanel.getMapArea();
      }
      editProjection.setDefaultMapArea(mapArea);

      if (debug) {
        System.out.println("Projection Manager accept bb =" + editProjection.getDefaultMapArea());
      }
      ProjectionImpl newProj = (ProjectionImpl) editProjection.constructCopy(); // use a copy

      if (viewDialog != null) {
        //                if ( !viewDialog.checkSaveOK(startingName,
        //                                             newProj.getName())) {
        //                    return;
        //                }
      }

      if (ProjectionManager.this.contains(newProj.getName())) {
        projTable.replaceProjection(newProj);
      } else {
        projTable.addProjection(newProj);
      }

      // set new projection to working projection and exit this Dialog
      setWorkingProjection(newProj);
      NewProjectionDialog.this.setVisible(false);
    }