/**
* 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.raster.wms;
import java.io.IOException;
import chunmap.data.feature.Raster;
import chunmap.model.elem.Envelope;
import chunmap.view.Renderer;
import chunmap.view.layer.AbstractLayer;
import chunmap.view.render.Symbol;
/**
* @author yangjiandong
*
*/
public class WmsLayer extends AbstractLayer {
private WmsDataSource dataSource;
public WmsLayer(String url){
dataSource=new WmsDataSource(url);
this.setName("wms");
}
@Override
protected void subRender(Symbol smb,int i, Renderer r) {
Raster raster = null;
try {
raster = dataSource.getImage(r.getViewEnvelop(), r.getWidth(), r.getHeight());
} catch (IOException e) {
e.printStackTrace();
}
r.draw(raster, smb,i);
}
public WmsDataSource getDataSource() {
return dataSource;
}
public void setDataSource(WmsDataSource dataSource) {
this.dataSource = dataSource;
}
@Override
public Envelope getEnvelop() {
return dataSource.getEnvelop();
}
}