请问,如何在ArcGIS9 下画线(web,.net) [急,在线等]

izzard 2005-03-26 01:40:26
请问,如何在ArcGIS9 下画线(web,.net) 谢谢
...全文
689 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
icemerlin99 2005-03-28
  • 打赏
  • 举报
回复
up
abi2000 2005-03-28
  • 打赏
  • 举报
回复
希望能对你有所帮助

这个是ArcgisServer的画线的,然后标出线的长度的


if (!(args.Control is ESRI.ArcGIS.Server.WebControls.Map))
return;

ESRI.ArcGIS.Server.WebControls.Map map = args.Control as ESRI.ArcGIS.Server.WebControls.Map;

using (WebMap webMap = map.CreateWebMap())
{

IServerContext ctx = webMap.ServerContext;
Polyline line= ctx.CreateObject("esriGeometry.Polyline") as Polyline;
PolylineEventArgs polyLine = args as PolylineEventArgs;
// Get a reference to the Web Page that contains the Map Control
System.Web.UI.Page page = polyLine.Control.Page;
string coords;
coords = polyLine.ToString();
webMap.ManageLifetime(line);
IPoint pt = ctx.CreateObject("esriGeometry.Point") as IPoint;
webMap.ManageLifetime(pt);

string[] pairs;
string [] xy;
pairs = coords.Split(char.Parse("|"));

for (int i = 0;i<pairs.Length;i++)
{
xy = pairs[i].Split(char.Parse(":"));
pt = webMap.ToMapPoint(Convert.ToInt32(xy[0]), Convert.ToInt32(xy[1]));
line.AddPoints(1,ref pt);
}
ICurve iCurve = line as ICurve;

ISimpleLineSymbol pSym = ctx.CreateObject("esriDisplay.SimpleLineSymbol") as ISimpleLineSymbol;
webMap.ManageLifetime(pSym);
Color c = ColorTranslator.FromHtml("#" + m_linecolor);
pSym.Color = (IColor)Converter.ToRGBColor(ctx, c);
pSym.Style = m_linestyle;
pSym.Width = m_linewidth;
ILineElement pElem = ctx.CreateObject("esriCarto.LineElement") as ILineElement;
webMap.ManageLifetime(pElem);
pElem.Symbol = pSym;
LineElement pElement = ctx.CreateObject("esriCarto.MarkerElement") as LineElement;
webMap.ManageLifetime(pElement);
pElement = pElem as LineElement;
pElement.Geometry = line as IGeometry;

IGraphicElements graphics = ctx.CreateObject("esriCarto.GraphicElements") as IGraphicElements;
webMap.ManageLifetime(graphics);
IMapDescription mapDesc = webMap.MapDescription;
if (mapDesc.CustomGraphics != null)
graphics = mapDesc.CustomGraphics;
graphics.Add(pElement as IGraphicElement);
webMap.MapDescription.CustomGraphics = graphics;
//webMap.Refresh();
double cx, cy;
cx = pElement.Geometry.Envelope.XMin + (pElement.Geometry.Envelope.Width / 2);
cy = pElement.Geometry.Envelope.YMin + (pElement.Geometry.Envelope.Height / 2);
pt.PutCoords(cx, cy);
m_centerpoint = webMap.FromMapPoint(pt);

IPoint point = ctx.CreateObject("esriGeometry.Point") as IPoint;
double length = Math.Abs(Math.Round(iCurve.Length,3));
m_text = Convert.ToString(length) + " feet";

m_x = webMap.FromMapPoint(pt).X;
m_y = webMap.FromMapPoint(pt).Y;

IPoint pt1= ctx.CreateObject("esriGeometry.Point") as IPoint;
webMap.ManageLifetime(pt1);
pt1 = webMap.ToMapPoint(m_x,m_y);
IFormattedTextSymbol tSym = ctx.CreateObject("esriDisplay.TextSymbol") as IFormattedTextSymbol;
webMap.ManageLifetime(tSym);
tSym.Color = (IColor)Converter.ToRGBColor(ctx, c);
tSym.VerticalAlignment = m_textvertalign;
tSym.HorizontalAlignment = m_texthorizalign;
stdole.IFontDisp pFontDisp = tSym.Font;
pFontDisp.Name = m_fontname;
pFontDisp.Bold = m_fontbold;
if (pFontDisp!=null)
{
tSym.Font = pFontDisp;
}

tSym.Size = m_textsize;
tSym.Angle = m_textangle;
ITextElement tElem = ctx.CreateObject("esriCarto.TextElement") as ITextElement;
webMap.ManageLifetime(tElem);
tElem.Symbol = tSym as ITextSymbol;
tElem.Text = m_text;
TextElement tElement = ctx.CreateObject("esriCarto.TextElement") as TextElement;
webMap.ManageLifetime(tElement);
tElement = tElem as TextElement;
tElement.Geometry = pt1;

webMap.ManageLifetime(graphics);
if (mapDesc.CustomGraphics != null)
graphics = mapDesc.CustomGraphics;
graphics.Add(tElement as IGraphicElement);
webMap.MapDescription.CustomGraphics = graphics;
webMap.Refresh();

顺便问一下,你是有ArcIMs,还是Arcgisserver,还是别的进行WebGis开发的


izzard 2005-03-26
  • 打赏
  • 举报
回复
UP,各位帮忙啊。。。
bj_yanhang 2005-03-26
  • 打赏
  • 举报
回复
不知道,帮顶

2,142

社区成员

发帖
与我相关
我的任务
社区描述
它是一种特定的十分重要的空间信息系统。它是在计算机硬、软件系统支持下,对整个或部分地球表层(包括大气层)空间中的有关地理分布数据进行采集、储存、管理、运算、分析、显示和描述的技术系统。
社区管理员
  • 地理信息系统
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧