Exemplo n.º 1
0
 private void mapCtl_Station_Tracked(object sender, TrackedEventArgs e)
 {
     if (mapCtl_Station.Action == Action.CreatePolyline)
     {
         XtraMessageBox.Show(string.Format("量算距离为:{0:.00}米", e.Length), "距离量算");
     }
     else if (mapCtl_Station.Action == Action.CreatePolygon)
     {
         XtraMessageBox.Show(string.Format("量算距离为:{0:.00}平方米", e.Area), "面积量算");
     }
 }
Exemplo n.º 2
0
        /// <summary>
        //跟踪层绘制事件,用于添加文本对象---绘制完几何对象后,判断 是否要继续绘制文本 或者 绘制沿线文本
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_mapControl_Tracked(Object sender, TrackedEventArgs e)
        {
            try
            {
                //绘制文本
                if (mMapControl.Action.Equals(SuperMap.UI.Action.CreateText)) //若 地图操作状态为添加注记
                {
                    GeoText geoText = e.Geometry as GeoText;                  //获取刚刚绘制完成的几何图形 转为 GeoText文本类
                    geoText.TextStyle.ForeColor  = Color.Green;               //设置文本风格--前景色
                    geoText.TextStyle.FontHeight = 32;                        //文本字体的高度为32
                    if (mTextLayer.IsEditable)                                //若 文本类图层 可编辑
                    {
                        String text = Microsoft.VisualBasic.Interaction.InputBox("请输入文本", "绘制文本", "", mMapControl.Size.Width / 2 - 150, mMapControl.Size.Height / 2);
                        // public static string InputBox(string Prompt, string Title = "", string DefaultResponse = "", int XPos = -1, int YPos = -1);
                        geoText[0].Text = text;//文本内容赋值
                    }
                }
                //绘制沿线文本
                if (mMapControl.Action == SuperMap.UI.Action.CreateAlongLineText) //若 地图操作状态为添加沿线标注
                {
                    GeoCompound geoCompound = e.Geometry as GeoCompound;          //转为 复合几何对象类
                    if (mTextLayer.IsEditable)                                    //若 文本类图层 可编辑
                    {
                        String  text    = Microsoft.VisualBasic.Interaction.InputBox("请输入沿线文本", "绘制沿线文本", "", mMapControl.Size.Width / 2 - 150, mMapControl.Size.Height / 2);
                        GeoText geoText = geoCompound[0] as GeoText;
                        geoText.TextStyle.ForeColor  = Color.Green;
                        geoText.TextStyle.FontHeight = 32;
                        geoText[0].Text = text;
                    }
                }

                mMapControl.Map.Refresh();//重新绘制当前地图
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
        }
Exemplo n.º 3
0
        private void TrackedHandler(object sender, TrackedEventArgs e)
        {
            try
            {
                switch (m_myAction)
                {
                case MeasureAction.Distance:
                {
                    String totalLength = String.Format("{0}{1}{2}", m_length, Math.Round(Convert.ToDecimal(e.Length), 2), m_meter);
                    m_textBoxResult.Text = totalLength;
                }
                break;

                case MeasureAction.Area:
                {
                    String totalArea = String.Format("{0}{1}{2}", m_area, Math.Round(Convert.ToDecimal(e.Area), 2), m_squareMeter);
                    m_textBoxResult.Text = totalArea;
                }
                break;

                case MeasureAction.Angle:
                {
                    String currentAzimuth = String.Format("{0}{1}{2}", m_azimuth, Math.Round(Convert.ToDecimal(e.Azimuth), 2), m_degree);
                    String currentAngle   = String.Format("{0}{1}{2}", m_angle, Math.Round(Convert.ToDecimal(e.Angle), 2), m_degree);
                    m_textBoxResult.Text = currentAzimuth + ",  " + currentAngle;
                }
                break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
        }
Exemplo n.º 4
0
 private void mapCtl_Station_Tracked(object sender, TrackedEventArgs e)
 {
     if(mapCtl_Station.Action==Action.CreatePolyline)
     {
         XtraMessageBox.Show(string.Format("量算距离为:{0:.00}米", e.Length), "距离量算");
     }
     else if(mapCtl_Station.Action==Action.CreatePolygon)
     {
         XtraMessageBox.Show(string.Format("量算距离为:{0:.00}平方米", e.Area), "面积量算");
     }
 }