【新手请问】arcgis engine+c# 怎么在mapcontrol上添加picture
发布时间:2010-06-06 17:16:09 文章来源:www.iduyao.cn 采编人员:星星草
【新手请教】arcgis engine+c# 如何在mapcontrol上添加picture
请教各位:
如何将picture导入mapcontrol中?
------解决方案--------------------
这需要使用到javascript api,以下是代码
var graphicCount = 0;
function drawGraphic(point)
{
var symbol = new ESRI.ADF.Graphics.MarkerSymbol("images/图片.gif", 8, 8, "");
var coords = point.toString("<br>", ",");
var attributes = { "ID": graphicCount, "featureCoordinates": coords };
var graphicFeature = $create(ESRI.ADF.Graphics.GraphicFeature, { "id": graphicCount.toString(), "geometry": point, "symbol": symbol, "attributes": attributes});
map.addGraphic(graphicFeature);
graphicCount++;
}
函数中的point参数在调用时传入,初始化方法如下:
//x和y分别表示当前的经纬度,可在mouseClick事件中设置
var ppp = new ESRI.ADF.Geometries.Point(x,y);
drawGraphic(ppp);
------解决方案--------------------
object missing =Type.Missing ;
IActiveView pActiveView = axMapControl1.ActiveView as IActiveView ;
OpenFileDialog pOpenFileDialog = new OpenFileDialog ();
pOpenFileDialog.Filter ="jpg files (*.jpg)|*.jpg|bmp files (*.bmp)|*.bmp";
pOpenFileDialog.RestoreDirectory=true;
if(pOpenFileDialog.ShowDialog ()==DialogResult.OK ){
IElement pElement = GetPicture(pOpenFileDialog.FileName);
IPictureElement pPictureElement;
if( pElement is IPictureElement ){
pPictureElement = pElement as IPictureElement ;
pPictureElement.MaintainAspectRatio =false;
pPictureElement.SavePictureInDocument =true;
}
//图片的大小和显示位置可以通过修改pEnv的坐标来自己决定
IEnvelope pEnv = new EnvelopeClass ();
//pEnv.PutCoords(....)
pEnv = axMapControl1.ActiveView.Extent ;
pElement.Geometry =pEnv as IGeometry ;
axMapControl1.ActiveView.GraphicsContainer.AddElement(pElement,0);
axMapControl1.CtlRefresh(esriViewDrawPhase.esriViewBackground ,missing,missing);
}
private IElement GetPicture(string sPath)
{
IRasterPicture pRasterPicture = new RasterPictureClass ();
IOlePictureElement pOlePicture = new BmpPictureElementClass ();
pOlePicture.ImportPicture (pRasterPicture.LoadPicture (sPath) as stdole .IPictureDisp );
return pOlePicture as IElement ;
}
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。
其他相似内容:
-
谁能发个mapxtreme java开发地图的简单例子
我的邮箱是dpc13583522718@163.com,使用jsp页面输出,并能对地图进行放大、缩小、平移...
-
win7家庭版64位的,安装的ArcGis9.3和Arcgis10遇到问题!!各位大哥达人帮帮忙!!!
我的系统是win7家庭版64位的,先安装的ArcGis9.3,没成功!有...
-
mapinfo是否支持地图合并?
我现在已经购买了一个城市的地图(MAPINFO格式的),但是它是分为东、西两个城区(东西两区的图层名称和结构都...
-
向Postgis数据库增删改数据后,前台Openlayers刷新不出来?
向Postgis数据库增删改数据后,前台Openlayers刷新不出来?版本2.6。
[color=...
-
MapInfo如何实现Google Map中info window那样的功能?
各位大虾,刚开始学习MapInfo,用MapXtreme + C#开发。
可以载入地图(tab格式),然后...
-
怎样实现在地图上画出公交线路(包括各个站点),急
如题
暂时不求具体的实现,主要是关于思路的流程和实现的大致流程
我老是想不通mapin...
-
谁能发一个mapxtreme for java的例子!!!谢谢...
谁能发一个mapxtreme for java的例子!!!我的邮箱是:jeff_tang1114@sina.com,万分感谢.......
-
3维GIS的问题
各位看官,能否推荐下开源的3DGIS开发套件:用什么api,什么数据库,等?最好是c++的。
多谢指点。
------解决方案------...
-
Mapx开发中,经常会有GPS位置偏离道路的情况,这种情况下,客户希望把GPS点重新拉回到公路上,请问这样该怎么做?
在Mapx开发中,经常会因为...
-
mapx中如何通过线段来生成区域,求一算法
各位好!
现在有个这样的问题想请教下:
mapx中有判断点是不是在区域(手工绘制的多变形)中的方...