国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > 綜合 > 正文

如何在c#中使用mapx5.0(二)

2024-07-21 02:19:05
字體:
供稿:網(wǎng)友

商業(yè)源碼熱門下載www.html.org.cn

接著第一篇文章,繼續(xù),這是在frmain.cs文件中除了第一篇文章里的代碼外的第二部分:
//*******************************

#region 創(chuàng)建自定義工具,用來測(cè)量距離(可以折線)和測(cè)量面積
//****************************888
private void mapmain_polytoolused(object sender, axmapxlib.cmapxevents_polytoolusedevent e) //在創(chuàng)建好自己定義的工具后,會(huì)根據(jù)工具id來選擇執(zhí)行

{

if(e.toolnum == 10)//測(cè)量距離,這是自定義工具,測(cè)量多點(diǎn)的距離

{

mapxlib.points pts = (mapxlib.points)e.points;

mapxlib.point pt1,pt2;

double d=0.0;

//計(jì)算順序兩個(gè)點(diǎn)距離,累計(jì)得到總距離

for(int i=1;i<pts.count;i++)

{

pt1=pts._item(i);

pt2=pts._item(i+1);

d += axmap1.distance(pt1.x,pt1.y,pt2.x,pt2.y);

}

label1.text="距離:" + d.tostring();

}

else if(e.toolnum == 11) //面積,這是自定義工具,這里借用了某位網(wǎng)友的文章,謝謝

{

mapxlib.points pts = (mapxlib.points)e.points;

mapxlib.featurefactory dd = axmap1.featurefactory;

mapxlib.style style = axmap1.defaultstyle;

label1.text="面積:" + dd.createregion(pts,style).area.tostring();

}

}
#endregion
//*******************************

private void axmap1_mapviewchanged(object sender, system.eventargs e) //在地圖大小改變時(shí),顯示出比例
{
label1.text=axmap1.zoom.tostring();
}

//*******************************
private void mutuceng_click(object sender, system.eventargs e) //菜單按鈕事件,顯示圖層控制面板
{
axmap1.layers.layersdlg(null,null);
}

private void menuitem31_click(object sender, system.eventargs e) //菜單按鈕事件,顯示圖層圖層選擇顯示窗口
{
frmviewlyr frm=new frmviewlyr();
frm.owner=this;
frm.showdialog();
}
private void menuitem32_click(object sender, system.eventargs e) //菜單按鈕事件,在新窗口中控制圖層的顯示比例等,
{
#region 新窗口中控制圖層的顯示比例,此處是省略代碼
//***********此處省略,主要使用到的是 mapunit 和mapzoom *******************
//此處是偽代碼,是mapx5.0的示例程序的vb代碼,和上面的大同小異
//
// zoomtext.text = fmainform.map1.zoom

// ' set the unit combo box to the current unit

// ' take a short cut: units # 0 through 13 correspond to combo list number

// if fmainform.map1.mapunit < 14 then

// unitcombo.listindex = fmainform.map1.mapunit

// else

// select case fmainform.map1.mapunit

// case miunitlink

// unitcombo.listindex = 14

// case miunitchain

// unitcombo.listindex = 15

// case miunitrod

// unitcombo.listindex = 16

// end select

// end if



// ' save the current parameters so that the view can be

// ' restored if "cancel" is pressed

// oldzoom = fmainform.map1.zoom

// oldunit = fmainform.map1.mapunit
#endregion

}
//*******************************
private void axmap1_thememodifyrequested(object sender, axmapxlib.cmapxevents_thememodifyrequestedevent e)
{
//e.theme
}

private void axmap1_mousedownevent(object sender, axmapxlib.cmapxevents_mousedownevent e)
{
//e.button=
}

private void menuitem4_click(object sender, system.eventargs e) //菜單按鈕事件,普通選擇地圖
{
axmap1.currenttool=mapxlib.toolconstants.miselecttool;
menuitem4.radiocheck=true;
}

private void menuitem5_click(object sender, system.eventargs e) //菜單按鈕事件,長方形選擇地圖
{
axmap1.currenttool=mapxlib.toolconstants.mirectselecttool;
menuitem5.radiocheck=true;
}

private void menuitem6_click(object sender, system.eventargs e) //菜單按鈕事件,圓形選擇地圖
{
axmap1.currenttool=mapxlib.toolconstants.miradiusselecttool;
menuitem6.radiocheck=true;
}

private void menuitem7_click(object sender, system.eventargs e)
{
axmap1.currenttool=mapxlib.toolconstants.mipolygonselecttool; //菜單按鈕事件,多邊形選擇地圖
menuitem7.radiocheck=true;
}

private void menuitem8_click(object sender, system.eventargs e)
{
axmap1.currenttool=mapxlib.toolconstants.milabeltool; //菜單按鈕事件,直線標(biāo)注地圖
}

private void menuitem9_click(object sender, system.eventargs e)
{
//axmap1.currenttool=mapxlib.toolconstants. ; //菜單按鈕事件,折線標(biāo)注地圖
}

private void menuitem11_click(object sender, system.eventargs e)
{
axmap1.currenttool=mapxlib.toolconstants.misymboltool; //菜單按鈕事件,創(chuàng)建工具,可以在地圖上添加符號(hào),其實(shí)是對(duì) mapx 的 annotations 操作
}

private void menuitem12_click(object sender, system.eventargs e)
{
axmap1.currenttool=mapxlib.toolconstants.mitexttool; //菜單按鈕事件,創(chuàng)建工具,可以在地圖上添加文本,其實(shí)是對(duì) mapx 的 annotations 操作
}

private void menuitem13_click(object sender, system.eventargs e)
{
axmap1.annotations.removeall(); // 把注釋信息全部移除, 其實(shí)是對(duì) mapx 的 annotations 操作
}

private void menuitem14_click(object sender, system.eventargs e)
{
gistestbymyself.frmannotation frm=new frmannotation( axmap1.defaultstyle.clone() );
frm.owner=this;
frm.showdialog(); // //未完成的,參見d:/program files/mapinfo/mapx 5.0/samples50/visualbasic/vb5sample
}

private void menuitem16_click(object sender, system.eventargs e) //菜單按鈕事件,顯示屬性窗口
{
axmap1.propertypage();
}

private void menuitem19_click(object sender, system.eventargs e) //顯示mapx的關(guān)于對(duì)話框
{
axmap1.aboutbox();
}

private void menuitem29_click(object sender, system.eventargs e) //菜單按鈕事件,調(diào)用窗口,對(duì)地圖的坐標(biāo)進(jìn)行改變,或叫投影
{
axmap1.displaycoordsys.pickcoordsys(null,null);
axmap1.numericcoordsys=axmap1.displaycoordsys;
}

private void axmap1_mouseupevent(object sender, axmapxlib.cmapxevents_mouseupevent e) //鼠標(biāo)事件,點(diǎn)擊右鍵,彈出屬性框
{
if(e.button==2)
axmap1.propertypage();
}



發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 区。| 邹城市| 富阳市| 房产| 闽侯县| 遂平县| 长宁区| 昌宁县| 家居| 万荣县| 鄂温| 德惠市| 怀安县| 乾安县| 苏尼特右旗| 德格县| 稻城县| 新密市| 寿阳县| 汤原县| 新晃| 万安县| 台江县| 怀集县| 包头市| 从江县| 肥东县| 南阳市| 水城县| 板桥市| 衡水市| 精河县| 措美县| 恭城| 湘西| 太仓市| 德庆县| 阿瓦提县| 中牟县| 桂东县| 德保县|