arcIMS的Java Connector開發模式與mapxteme的開發模式是相同的原理。下面的代碼是實現一個arcIMS Java Connector開發模式的起點:

代碼
?1
map=new?Map();//新建立一個com.esri.aims.mtier.model.map.Map對象,用于保存地圖狀態
?2
conn?=?new?ConnectionProxy();//新建一個com.esri.aims.mtier.io.ConnectionProxy對象,用于連接arcIMS應用服務器
?3
conn.setHost("menglikun");//設置連接的主機名或IP地址
?4
conn.setPort(5300);//設置端口號,記住是arcIMS應用服務器的端口號而不是web服務器的端口號
?5
conn.setService("test");//設置service的名稱
?6
conn.setDisplayMessages(true);//設置是否在控制臺打印出提示信息
?7
map.setWidth(500);//設置地圖的寬
?8
map.setHeight(350);//設置地圖的高
?9
map.initMap(conn,?0,?false,?false,?false,?false);//初始化地圖
10
11
//以下均為設置圖例
12
map.getLegend().setAntialiasing(true);
13
map.getLegend().setWidth(200);
14
map.getLegend().setHeight(175);
15
map.getLegend().setTitle("Legend");
16
map.getLegend().setTitleFontSize(12);
17
map.getLegend().setFont("arial");
18
map.getLegend().setValueFontSize(15);
19
map.getLegend().setSwatchHeight(15);
20
map.getLegend().setSwatchWidth(15);
21
map.getLegend().setLayerFontSize(10);
22
23
map.refresh();//必須更新一下地圖


?1

?2

?3

?4

?5

?6

?7

?8

?9

10

11

12

13

14

15

16

17

18

19

20

21

22

23
