2009-09-10

星巴克招待

2009/9/12上午11點開始,凡點購任一杯飲料,另一杯飲料由星巴克招待。

2009-08-24

Java 四捨五入

public static void main(String[] args) {
double d = 123.12345678d;
double f = 123.12356789d;
System.out.println(BigDecimal.valueOf(d).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue()+" "+BigDecimal.valueOf(f).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue());
}

結果為
123.123 123.124

2009-07-16

uDig連接Oracle需要SID

uDig連接Oracle時要填入Host,Username,Password,Database,Schema.
其中Database是Oracle SID,SID可以用以下的SQL COMMAND來取得

select instance_name from v$instance;

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

}

}