Package chunmap.example.crs

Source Code of chunmap.example.crs.ProjTest

/**
* Copyright (c) 2009-2011, chunquedong(YangJiandong)
*
* This file is part of ChunMap project
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE(Version >=3)
*
* History:
*     2010-05-05  Jed Young  Creation
*/
package chunmap.example.crs;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import chunmap.app.MapCtrl;
import chunmap.data.provider.LayerFactory;
import chunmap.example.BaseMap;
import chunmap.example.UiUtil;
import chunmap.model.crs.BLGrid;
import chunmap.model.crs.CoordinateRef;
import chunmap.model.crs.proj.Mercator;
import chunmap.model.crs.proj.ReProjOp;
import chunmap.view.layer.VectorLayer;

public class ProjTest extends BaseMap {
  public static void main(String[] args) {

    ProjTest me = new ProjTest();
    me.init();
  }

  @Override
  protected void addLayer(MapCtrl map) {
    String path1="D:\\Temp\\mapdata\\cntry02\\cntry02.shp";
    VectorLayer layer = (VectorLayer) LayerFactory.openShapeFile(path1);
    map.getLayerCollection().add(layer);
   
    VectorLayer grid = new BLGrid().createGrid();
        map.getLayerCollection().add(grid);
  }
 
  @Override
  protected void addButton(){
    super.addButton();
   
    UiUtil.addButton(frame,map,"墨卡托投影",new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent arg0) {
        CoordinateRef target = new CoordinateRef();
              target.setProjection(new Mercator());

              ReProjOp.changeMapCRS(map.getLayerCollection(), target);

              map.fullView();
              map.refreshMap();
      }
    });
   
    UiUtil.addButton(frame,map,"墨卡托反解",new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent arg0) {
        ReProjOp.changeMapCRS(map.getLayerCollection(), CoordinateRef.Unknow);

              map.fullView();
              map.refreshMap();
      }
    });
  }
}
TOP

Related Classes of chunmap.example.crs.ProjTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.