import net.refractions.udig.project.ui.ApplicationGIS;
import net.refractions.udig.project.ui.tool.AbstractActionTool;
import org.eclipse.core.runtime.NullProgressMonitor;
import com.vividsolutions.jts.geom.Envelope;
/**
*
* @author Freepisces
*
*/
public class ShowAllMap extends AbstractActionTool {
public ShowAllMap() {
// TODO Auto-generated constructor stub
}
@Override
public void run() {
Envelope newbbox = ApplicationGIS.getActiveMap().getMapLayers().get(0).getBounds(new NullProgressMonitor(), getContext().getCRS());/*get layer's evenlope*/
NavCommand showallmapcommand = getContext().getNavigationFactory().createSetViewportBBoxCommand(newbbox); /*create a Navigation Command*/
getContext().sendASyncCommand(showallmapcommand); /*send command to refresh viewport*/
}
@Override
public void dispose() {
// TODO Auto-generated method stub
}
}
沒有留言:
張貼留言