engine下标注如何随着地图变化而变大,变小

本文介绍了一种在地图应用中绘制标注信息的方法。该方法通过遍历存储的标注信息集合,利用公共函数将标注的位置转换为地图上的实际距离,并判断这些位置是否位于当前屏幕的可视范围内。对于位于可视范围内的标注,会进一步计算其显示位置并设置相应的字体样式及颜色,最后在地图上绘制出标注文本。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一般情况是不应该变的,如果想变的话是可以的,自己把要标注的信息画上去了




public void  Draw(ref IActiveView pActiveView)
  {  
   if(m_Array.Count<1)return;
   else
   {
    ClsFunction m_Function = new ClsFunction(pActiveView);//调用公共函数
    double pTempDis=m_Function.ConvetToMapDistance(10,pActiveView.ScreenDisplay);
    IEnvelope pEnve = pActiveView.Extent;
    for(int i=0;i<m_Array.Count;i++)
    {    
     IGeometry pGeom ;
     IClone pClone;    
     LabelInfo pLabelInfo = m_Array.GetByIndex(i) as  LabelInfo;
     IPoint pPoit = new PointClass();          
     pGeom =pLabelInfo.m_Geometry;
     pClone=pGeom as IClone ;
     pPoit =pClone.Clone () as IPoint;    
     if(ClsGlobal.InEnve(pPoit.X,pPoit.Y,ref pEnve))//判断是否当前屏幕可视范围内
     {
      string strValue = pLabelInfo.Label;
      IPoint mPoit = new PointClass();
      mPoit.X = pPoit.X+ pTempDis;
      mPoit.Y =pPoit.Y+ pTempDis;
      IFormattedTextSymbol  pTextSymbol = new TextSymbolClass();
      System.Drawing.Font drawFont = new System.Drawing.Font(nFont, int.Parse(pFont), FontStyle.Regular);
      pTextSymbol.Font =(stdole.IFontDisp) OLE.GetIFontDispFromFont(drawFont);//字体
      pTextSymbol.Color=m_Function.CreateColor(panel1.BackColor.R,panel1.BackColor.G,panel1.BackColor.B);
      pActiveView.ScreenDisplay.SetSymbol(pTextSymbol as ISymbol);
      pActiveView.ScreenDisplay.DrawText(mPoit,strValue);
     }
    
    }    
   }
  }

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值