arcIMS的Java Connector開(kāi)發(fā)模式與mapxteme的開(kāi)發(fā)模式是相同的原理。下面的代碼是實(shí)現(xiàn)一個(gè)arcIMS Java Connector開(kāi)發(fā)模式的起點(diǎn):

代碼
?1
map=new?Map();//新建立一個(gè)com.esri.aims.mtier.model.map.Map對(duì)象,用于保存地圖狀態(tài)
?2
conn?=?new?ConnectionProxy();//新建一個(gè)com.esri.aims.mtier.io.ConnectionProxy對(duì)象,用于連接arcIMS應(yīng)用服務(wù)器
?3
conn.setHost("menglikun");//設(shè)置連接的主機(jī)名或IP地址
?4
conn.setPort(5300);//設(shè)置端口號(hào),記住是arcIMS應(yīng)用服務(wù)器的端口號(hào)而不是web服務(wù)器的端口號(hào)
?5
conn.setService("test");//設(shè)置service的名稱(chēng)
?6
conn.setDisplayMessages(true);//設(shè)置是否在控制臺(tái)打印出提示信息
?7
map.setWidth(500);//設(shè)置地圖的寬
?8
map.setHeight(350);//設(shè)置地圖的高
?9
map.initMap(conn,?0,?false,?false,?false,?false);//初始化地圖
10
11
//以下均為設(shè)置圖例
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
