2009-06-29

uDig的map動作監聽

net.refractions.udig.project.mapInterceptor 這個Extension 可以讓你知道 layer Added, layerRemoved, mapClosing, mapCreation and mapOpening。
layer Added 和 layerRemoved 需要實作 LayerInterceptor ,
mapClosing, mapCreation and mapOpening 需要實作 MapInterceptor

動作都寫在plugin.xml中

2009-06-23

uDig View ID

View ID:
BOOKMARKS = "org.tcat.citd.sim.udig.bookmarks.internal.ui.BookmarksView"
PROJECTS = "net.refractions.udig.project.ui.projectExplorer";
LAYERS = "net.refractions.udig.project.ui.layerManager";

2009-06-19

使用過的Dependencies and Extension

  1. Distance Tool (will make contrubutions to the UI)
    Dependencies: net.refractions.udig.project.ui
    Extension: net.refractions.udig.project.ui.tool

  2. CustomApp (will not make contrubutions to the UI)
    Dependencies: net.refractions.udig.ui
    Extension: org.eclipse.core.runtime.applications, org.eclipse.ui.perspectives, org.eclipse.ui.perspectiveExtensions

uDig顯示全圖 範例

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

}

}