/**
* 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.googlemap;
import java.awt.BasicStroke;
import chunmap.app.MapCtrl;
import chunmap.data.provider.LayerFactory;
import chunmap.example.BaseMap;
import chunmap.model.crs.CoordinateRef;
import chunmap.model.crs.proj.Mercator;
import chunmap.model.crs.proj.ReProjOp;
import chunmap.raster.gmap.*;
import chunmap.view.layer.Layer;
import chunmap.view.layer.VectorLayer;
import chunmap.view.render.GeneralSymbol;
import chunmap.view.render.Style2D;
import chunmap.view.render.Symbol;
public class GMClient extends BaseMap {
public static void main(String[] args) {
GMClient me = new GMClient();
me.init();
}
@Override
protected void addLayer(MapCtrl map) {
Layer layer = new GMLayer();
map.getLayerCollection().add(layer);
String path1="D:\\Temp\\mapdata\\cntry02\\cntry02.shp";
VectorLayer layer1 = (VectorLayer) LayerFactory.openShapeFile(path1);
//style
Style2D style = new Style2D();
style.setNeedArea(false);
style.setStroke(new BasicStroke(3));
layer1.setDefaultStyle(new Symbol[]{new GeneralSymbol(style)});
//reproj
CoordinateRef target = new CoordinateRef();
target.setProjection(new Mercator());
ReProjOp.changeCRS(layer1.getFeatures(), target);
map.getLayerCollection().add(layer1);
}
}