public void coordLabel()
        {
            try
            {
                double x_label = mPoint3D.X;
                double y_label = mPoint3D.Y;
                double z_label = mPoint3D.Z;
                String coord   = "X: " + x_label + "\n\n" + "Y: " + y_label + "\n\n" + "Z: " + z_label;

                TextPart3D mText1 = new TextPart3D();
                mText1.Text        = coord;
                mText1.AnchorPoint = mPoint3D;
                TextStyle mTextStyle1 = new TextStyle();
                mTextStyle1.FontName    = "微软雅黑";
                mTextStyle1.ForeColor   = Color.Red;
                mTextStyle1.FontHeight  = 7;
                mTextStyle1.IsSizeFixed = false;
                mTextStyle1.Alignment   = TextAlignment.MiddleCenter;
                GeoText3D  geoText_1  = new GeoText3D(mText1, mTextStyle1);
                GeoStyle3D geostyle_1 = new GeoStyle3D();
                geostyle_1.AltitudeMode = AltitudeMode.RelativeToGround;
                geoText_1.Style3D       = geostyle_1;
                TrackingLayer3D trackinglayer = mSceneControl.Scene.TrackingLayer;
                trackinglayer.IsEditable = true;
                trackinglayer.IsVisible  = true;
                trackinglayer.Add(geoText_1, "Coord");
                mSceneControl.Scene.Refresh();
            }
            catch (Exception)
            {
            }
        }
Example #2
0
        //鼠标在场景中停留两秒中显示坡度坡向信息
        private void timer_tick(Object sender, EventArgs e)
        {
            if (m_slope != null)
            {
                if (m_lastPoint3D != m_point3D)
                {
                    this.m_sceneControl.Scene.TrackingLayer.Clear();
                    double slopeValue     = m_slope.GetSlopeValue(m_point3D);
                    double slopeDirection = m_slope.GetSlopeDirectionValue(m_point3D);

                    TextStyle textstyle = new TextStyle();
                    textstyle.IsSizeFixed = true;
                    textstyle.FontName    = "微软雅黑";
                    textstyle.ForeColor   = Color.Black;
                    textstyle.FontScale   = 2;
                    textstyle.FontHeight  = 3;

                    TextPart3D textPart3D = new TextPart3D();
                    textPart3D.Text        = String.Format("Longitude: {0}\nLatitude:{1}\nAltitude: {2}\nSlopeValue: {3}\nSlopeDirection: {4}", m_point3D.X, m_point3D.Y, m_point3D.Z, slopeValue, slopeDirection);
                    textPart3D.AnchorPoint = m_point3D;
                    GeoText3D geoText3D = new GeoText3D(textPart3D);
                    geoText3D.TextStyle = textstyle;
                    GeoStyle3D style3D = new GeoStyle3D();
                    style3D.AltitudeMode   = AltitudeMode.Absolute;
                    style3D.BottomAltitude = 10;
                    geoText3D.Style3D      = style3D;
                    this.m_sceneControl.Scene.TrackingLayer.Add(geoText3D, "Text");


                    m_lastPoint3D = m_point3D;
                }
            }
        }
 /// <summary>
 /// 设置量算结果文本的风格
 /// </summary>
 /// <param name="text"></param>
 private void SetResultTextStyle(GeoText3D text)
 {
     try
     {
         TextStyle textStyle = new TextStyle();
         textStyle.ForeColor = Color.White;
         textStyle.Outline = true;
         textStyle.BackColor = Color.Black;
         textStyle.FontHeight = 10;
         text.TextStyle = textStyle;
         GeoStyle3D style = new GeoStyle3D();
         if (m_sceneControl.Action == Action3D.MeasureAltitude)
         {
             style.AltitudeMode = AltitudeMode.Absolute;
         }
         else
         {
             style.AltitudeMode = AltitudeMode.ClampToGround;
         }
         text.Style3D = style;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 private GeoText3D GetGeoText3DMessage()
 {
     GeoText3D text = CreateText3DMessage();
     m_sceneControl.Scene.TrackingLayer.Add(text, m_messageTag);
     m_currentGeoText3DMessage = text;
     return text;
 }
        /// <summary>
        /// 获取文本信息
        /// </summary>
        /// <returns></returns>
        private GeoText3D GetGeoText3DMessage()
        {
            GeoText3D text = CreateText3DMessage();

            mSceneControl.Scene.TrackingLayer.Add(text, MessageTag);
            mCurrentGeoText3DMessage = text;
            return(text);
        }
 private void ClearTextMessageTag()
 {
     int index = m_sceneControl.Scene.TrackingLayer.IndexOf(m_messageTag);
     while (index >= 0)
     {
         m_sceneControl.Scene.TrackingLayer.Remove(index);
         index = m_sceneControl.Scene.TrackingLayer.IndexOf(m_messageTag);
     }
     m_currentGeoText3DMessage = null;
 }
 /// <summary>
 /// 清空量算结果
 /// </summary>
 public void ClearResult()
 {
     try
     {
         m_sceneControl.Scene.TrackingLayer.Clear();
         m_sceneControl.Action = Action3D.Pan;
         m_currentGeoText3DMessage = null;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 /// <summary>
 /// 清空量算结果
 /// </summary>
 public void ClearResult()
 {
     try
     {
         mSceneControl.Scene.TrackingLayer.Clear();
         mSceneControl.Action     = Action3D.Pan2;
         mCurrentGeoText3DMessage = null;
         mIndex = 0;
     }
     catch (Exception ex)
     {
         Trace.WriteLine(ex.Message);
     }
 }
        /// <summary>
        /// 设置结果文本样式
        /// </summary>
        /// <param name="text"></param>
        private void SetResultTextStyle(GeoText3D text)
        {
            TextStyle textStyle = new TextStyle();

            textStyle.ForeColor  = Color.White;
            textStyle.Outline    = true;
            textStyle.BackColor  = Color.Black;
            textStyle.FontHeight = 10;
            text.TextStyle       = textStyle;
            GeoStyle3D style = new GeoStyle3D();

            style.AltitudeMode = AltitudeMode.RelativeToUnderground;
            text.Style3D       = style;
        }
Example #10
0
		private GeoText3D CreateText3DMessage()
		{
			TextPart3D textPart3D = new TextPart3D();
			textPart3D.AnchorPoint = new Point3D(0, 0, 0);
			textPart3D.Text = String.Empty;

			TextStyle style = new TextStyle();
			style.ForeColor = Color.White;
			style.IsSizeFixed = true;
			style.FontHeight = 4;
			GeoText3D text3D = new GeoText3D(textPart3D, style);
			text3D.Style3D = new GeoStyle3D();
			text3D.Style3D.AltitudeMode = AltitudeMode.RelativeToGround;
			return text3D;
		}
Example #11
0
        private GeoText3D CreateText3DMessage()
        {
            TextPart3D textPart3D = new TextPart3D();
            textPart3D.AnchorPoint = new Point3D(0, 0, 0);
            textPart3D.Text = String.Empty;

            TextStyle style = new TextStyle();
            style.ForeColor = Color.White;
            style.IsSizeFixed = true;
            style.FontHeight = 4;
            GeoText3D text3D = new GeoText3D(textPart3D, style);
            text3D.Style3D = new GeoStyle3D();
            text3D.Style3D.AltitudeMode = AltitudeMode.RelativeToGround;
            return text3D;
        }
        /// <summary>
        /// 显示覆土分析结果
        /// </summary>
        private void ShowC()
        {
            String    text         = String.Empty;
            Point3D   textLocation = new Point3D(0, 0, 0);
            GeoLine3D geoLine      = new GeoLine3D(mTextPoint3Ds);

            SetGeometry3DStyle(geoLine);
            mSceneControl.Scene.TrackingLayer.Add(geoLine, "覆土深度");
            text         = String.Format("{0}{1}{2}", "覆土深度:", Math.Round(Convert.ToDouble(mCDistance), 2), "米");
            textLocation = geoLine.InnerPoint3D;
            GeoText3D geoText = new GeoText3D(new TextPart3D(text, textLocation));

            SetResultTextStyle(geoText);
            mSceneControl.Scene.TrackingLayer.Add(geoText, "覆土");
            mSceneControl.ObjectSelected -= new ObjectSelectedEventHandler(mSceneControlSelected);
        }
        private void OutputMeasureAltitude(SuperMap.UI.Tracking3DEventArgs e)
        {
            try
            {
                Point location = mSceneControl.PointToClient(Cursor.Position);
                location.Offset(30, 30);

                if (location.X > mSceneControl.Bounds.Width / 5 * 4)
                {
                    location.X = mSceneControl.Bounds.Width / 5 * 4;
                }
                if (location.Y > mSceneControl.Bounds.Height)
                {
                    location.Y = location.Y - 60;
                }

                GeoText3D text3d = GetGeoText3DMessage();

                text3d.TextStyle.FontHeight = 6;
                text3d.TextStyle.Alignment  = TextAlignment.BottomLeft;
                text3d.TextStyle.BackColor  = Color.Black;
                text3d.TextStyle.Outline    = true;
                text3d.Style3D.AltitudeMode = AltitudeMode.RelativeToGround;

                text3d[0].Text = e.CurrentHeight.ToString("##.00") + "米";
                text3d[0].X    = e.X;
                text3d[0].Y    = e.Y;
                text3d[0].Z    = e.Z + e.CurrentHeight;

                Console.WriteLine(text3d[0].Z);

                text3d.Style3D.AltitudeMode = AltitudeMode.Absolute;

                ClearTextMessageTag();
                mSceneControl.Scene.TrackingLayer.Add(text3d, MessageTag);
                mCurAltitude = e.CurrentHeight;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }
        /// <summary>
        /// 设置结果文本样式
        /// </summary>
        /// <param name="text"></param>
        private void SetResultTextStyle(GeoText3D text)
        {
            try
            {
                TextStyle textStyle = new TextStyle();
                textStyle.ForeColor  = Color.White;
                textStyle.Outline    = true;
                textStyle.BackColor  = Color.Black;
                textStyle.FontHeight = 10;
                text.TextStyle       = textStyle;
                GeoStyle3D style = new GeoStyle3D();

                style.AltitudeMode = AltitudeMode.RelativeToUnderground;

                text.Style3D = style;
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
        }
Example #15
0
        //鼠标选择对象事件
        void m_sceneControl_MouseUp(object sender, MouseEventArgs e)
        {
            if (m_bAnalyisSucess == true)
            {
                this.m_sceneControl.Scene.TrackingLayer.Clear();

                if (m_shadowQuery != null && e.Button == MouseButtons.Left)
                {
                    Point point = new Point(e.X, e.Y);

                    double shadowRatio = m_shadowQuery.GetShadowRatio(point);

                    if (shadowRatio != -1)
                    {
                        this.label_shadowRatio.Text = String.Format("当前点的阴影率为:{0}%", shadowRatio * 100);


                        TextStyle textstyle = new TextStyle();
                        textstyle.IsSizeFixed = true;
                        textstyle.FontName    = "微软雅黑";
                        textstyle.ForeColor   = Color.Red;
                        textstyle.FontScale   = 2;
                        textstyle.FontHeight  = 2;

                        Point3D    point3D    = m_sceneControl.Scene.PixelToGlobe(e.Location);
                        TextPart3D textPart3D = new TextPart3D();
                        textPart3D.Text        = String.Format("阴影率:{0}%", shadowRatio * 100);
                        textPart3D.AnchorPoint = point3D;
                        GeoText3D geoText3D = new GeoText3D(textPart3D);
                        geoText3D.TextStyle = textstyle;
                        this.m_sceneControl.Scene.TrackingLayer.Add(geoText3D, "Text");
                    }
                    else
                    {
                        this.label_shadowRatio.Text = "当前点的阴影率为:***";
                    }
                }
            }
        }
Example #16
0
		private void ClearTextMessageTag()
		{
			int index = SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.IndexOf(m_messageTag);
			while (index >= 0)
			{
				SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.Remove(index);
				index = SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.IndexOf(m_messageTag);
			}
			m_currentGeoText3DMessage = null;
		}
        /// <summary>
        /// 标注名称
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void NameLabel()
        {
            try
            {
                Selection3D[] selection = mSceneControl.Scene.FindSelection(true);
                //判断选择集是否为空
                if (selection == null || selection.Length == 0)
                {
                    MessageBox.Show("请选择要标注名称的空间对象");
                    return;
                }
                //将选择集转换为记录
                Recordset recordset = selection[0].ToRecordset();
                //获取名称字段的值
                string str  = "";
                string str1 = "";
                object obj;
                bool   bol = false;
                for (int i = 0; i < recordset.FieldCount; i++)
                {
                    str = recordset.GetFieldInfos()[i].Name;
                    if (str == "Name")
                    {
                        bol  = true;
                        obj  = recordset.GetFieldValue(i);
                        str1 = "名称: " + obj.ToString() + "\n";
                        break;
                    }
                    else
                    {
                        continue;
                    }
                }
                if (bol == false)
                {
                    MessageBox.Show("该对象没有名称属性!");
                }
                recordset.Dispose();

                TextPart3D mText1 = new TextPart3D();
                mText1.Text        = str1;
                mText1.AnchorPoint = mPoint3D;
                TextStyle mTextStyle1 = new TextStyle();
                mTextStyle1.FontName    = "微软雅黑";
                mTextStyle1.ForeColor   = Color.Red;
                mTextStyle1.FontHeight  = 7;
                mTextStyle1.IsSizeFixed = false;
                mTextStyle1.Alignment   = TextAlignment.MiddleCenter;
                GeoText3D  geoText_1  = new GeoText3D(mText1, mTextStyle1);
                GeoStyle3D geostyle_1 = new GeoStyle3D();
                geostyle_1.AltitudeMode = AltitudeMode.RelativeToGround;
                geoText_1.Style3D       = geostyle_1;
                TrackingLayer3D trackinglayer = mSceneControl.Scene.TrackingLayer;
                trackinglayer.IsEditable = true;
                trackinglayer.IsVisible  = true;
                trackinglayer.Add(geoText_1, "NameLabel");
                mSceneControl.Scene.Refresh();
            }
            catch (Exception)
            {
            }
        }
Example #18
0
		private GeoText3D GetGeoText3DMessage()
		{
			GeoText3D text = CreateText3DMessage();
			SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.Add(text, m_messageTag);
			m_currentGeoText3DMessage = text;
			return text;
		}
        public void LineInsertQuery()
        {
            Layer3Ds m_layer = mSceneControl.Scene.Layers;

            foreach (Layer3D mlayer in m_layer)
            {
                if (mlayer.Selection != null)
                {
                    mlayer.Selection.Clear();
                }
            }

            QueryParameter para = new QueryParameter();

            para.HasGeometry        = true;
            para.SpatialQueryMode   = SpatialQueryMode.Intersect;
            para.SpatialQueryObject = mRec2D;

            Recordset      recordset        = null;
            Layer3DDataset layer            = null;
            String         m_textID         = String.Empty;
            String         m_textName       = String.Empty;
            String         m_textDepth      = String.Empty;
            String         m_textDiameter   = String.Empty;
            String         m_InfomationText = String.Empty;

            for (int i = 0; i < 3; i++)
            {
                if (i == 0)
                {
                    recordset = mUseData.OutWaterNetWork.Query(para);
                    layer     = mUseData.OutWaterLines;
                }
                else if (i == 1)
                {
                    recordset = mUseData.SupplyWaterNetWork.Query(para);
                    layer     = mUseData.SupplyWaterLines;
                }
                else if (i == 2)
                {
                    recordset = mUseData.ElectricNetWork.Query(para);
                    layer     = mUseData.ElectricLayer;
                }


                List <Int32> ids = new List <int>(recordset.RecordCount);
                while (!recordset.IsEOF)
                {
                    m_textID          = System.Convert.ToString(recordset.GetFieldValue("SmID"));
                    m_textName        = System.Convert.ToString(recordset.GetFieldValue("Name"));
                    m_textDepth       = System.Convert.ToString(recordset.GetFieldValue("BottomAltitude"));
                    m_textDiameter    = System.Convert.ToString(recordset.GetFieldValue("PipeDiameter"));
                    m_InfomationText += m_textID + "      " + m_textName + "    " + m_textDepth + "            " + m_textDiameter + "\n";
                    ids.Add(recordset.GetID());
                    recordset.MoveNext();
                }
                layer.Selection.AddRange(ids.ToArray());
                layer.Selection.UpdateData();
                layer.Selection.Style.LineColor = Color.GreenYellow;
                mSceneControl.Scene.Refresh();
            }

            //进行文本标注
            String m_text = "编号" + "  " + "管线类别" + "  " + "埋设深度" + "  " + "管径" + "\n";

            m_text += m_InfomationText;
            TextPart3D mText1 = new TextPart3D();

            mText1.Text        = m_text;
            mText1.AnchorPoint = mAnchorPoint3D;
            TextStyle mTextStyle1 = new TextStyle();

            mTextStyle1.FontName    = "微软雅黑";
            mTextStyle1.ForeColor   = Color.Red;
            mTextStyle1.FontHeight  = 7;
            mTextStyle1.IsSizeFixed = false;
            mTextStyle1.Alignment   = TextAlignment.MiddleCenter;
            GeoText3D  geoText_1  = new GeoText3D(mText1, mTextStyle1);
            GeoStyle3D geostyle_1 = new GeoStyle3D();

            geostyle_1.AltitudeMode = AltitudeMode.RelativeToGround;
            geoText_1.Style3D       = geostyle_1;
            TrackingLayer3D trackinglayer = mSceneControl.Scene.TrackingLayer;

            trackinglayer.IsEditable = true;
            trackinglayer.IsVisible  = true;
            trackinglayer.Add(geoText_1, "PullFlatLabel");
        }
Example #20
0
		/// <summary>
		/// 设置量算结果文本的风格
		/// </summary>
		/// <param name="text"></param>
		private void SetResultTextStyle(GeoText3D text)
		{
			try
			{
				TextStyle textStyle = new TextStyle();
				textStyle.ForeColor = Color.White;
				textStyle.Outline = true;
				textStyle.BackColor = Color.Black;
				textStyle.FontHeight = 10;
				text.TextStyle = textStyle;
				GeoStyle3D style = new GeoStyle3D();
				if (SmObjectLocator.getInstance().GlobeObject.Action == Action3D.MeasureAltitude)
				{
					style.AltitudeMode = AltitudeMode.Absolute;
					style.BottomAltitude = 200;
				}
				else
				{
					style.AltitudeMode = AltitudeMode.ClampToGround;
				}
				text.Style3D = style;
			}
			catch (Exception ex)
			{
				Trace.WriteLine(ex.Message);
			}
		}
Example #21
0
		/// <summary>
		/// 显示最终量算的结果
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		void TrackedHandler(object sender, Tracked3DEventArgs e)
		{
			try
			{
				// 清空临时结果
				m_point3Ds.Clear();
				m_curLength = 0.0;

				Geometry3D geometry = e.Geometry;
				Point3D textLocation = new Point3D(0, 0, 0);

				String text = String.Empty;
				if (SmObjectLocator.getInstance().GlobeObject.Action == Action3D.MeasureDistance || SmObjectLocator.getInstance().GlobeObject.Action == Action3D.MeasureTerrainDistance)
				{
					//绘制量算线对象
					GeoLine3D geoLine3D = e.Geometry.Clone() as GeoLine3D;
					geoLine3D.Style3D = m_GeoStyle3D.Clone();
					if (SmObjectLocator.getInstance().GlobeObject.Action == Action3D.MeasureDistance)
					{
						geoLine3D.Style3D.AltitudeMode = AltitudeMode.Absolute;
						geoLine3D.Style3D.BottomAltitude = 100;
					}
					else
					{
						geoLine3D.Style3D.AltitudeMode = AltitudeMode.ClampToGround;
					}
					SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.Add(geoLine3D, m_MeasureDistanceTag);

					//绘制量算点对象
					Point3D point3D = Point3D.Empty;
					for (Int32 i = 0; i < geoLine3D.PartCount; i++)
					{
						for (Int32 j = 0; j < geoLine3D[i].Count; j++)
						{
							GeoPoint3D geoPoint3D = new GeoPoint3D(geoLine3D[i][j]);
							geoPoint3D.Style3D = m_GeoStyle3D.Clone();
							if (SmObjectLocator.getInstance().GlobeObject.Action == Action3D.MeasureDistance)
							{
								geoPoint3D.Style3D.AltitudeMode = AltitudeMode.Absolute;
								geoPoint3D.Style3D.BottomAltitude = 100;
							}
							else if (SmObjectLocator.getInstance().GlobeObject.Action == Action3D.MeasureTerrainDistance)
							{
								geoPoint3D.Style3D.AltitudeMode = AltitudeMode.ClampToGround;
							}
							SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.Add(geoPoint3D, m_MeasureDistanceTag);
							point3D = geoLine3D[i][j];
						}
					}

					//量算结果
					int index = SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.IndexOf(m_messageTrackingTag);
					if (index >= 0)
					{
						SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.Remove(index);
					}

					// 添加结果文字
					if (SmObjectLocator.getInstance().GlobeObject.Action == Action3D.MeasureDistance)
					{
						text = String.Format("{0}{1}{2}", "空间距离:", Math.Round(Convert.ToDecimal(e.Length), 2), "米");
					}
					else
					{
						text = String.Format("{0}{1}{2}", "依地距离:", Math.Round(Convert.ToDecimal(e.Length), 2), "米");
					}

					textLocation = geoLine3D[0][geoLine3D[0].Count - 1];
					GeoText3D geoText = new GeoText3D(new TextPart3D(text, textLocation));
					SetResultTextStyle(geoText);
					SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.Add(geoText, m_MeasureDistanceTag);

					//计算首尾点高度差
					Point3Ds point3Ds = geoLine3D[0];
					double height = point3Ds[point3Ds.Count - 1].Z - point3Ds[0].Z;

					//m_formMain.ClearOutputMessage();
					//m_formMain.OutputMessage(text);
					//String message = string.Format("首尾点高度差为:{0}米。", height.ToString("##.00"));
					//m_formMain.OutputMessage(message);
				}

				else if (SmObjectLocator.getInstance().GlobeObject.Action == Action3D.MeasureArea || SmObjectLocator.getInstance().GlobeObject.Action == Action3D.MeasureTerrainArea)
				{
					//绘制量算面对象
					GeoRegion3D geoRegion3D = e.Geometry as GeoRegion3D;
					//绘制量算面对象
					geoRegion3D.Style3D = m_GeoStyle3D.Clone();
					if (SmObjectLocator.getInstance().GlobeObject.Action == Action3D.MeasureArea)
					{
						geoRegion3D.Style3D.AltitudeMode = AltitudeMode.Absolute;
						geoRegion3D.Style3D.BottomAltitude = 100;
					}
					else
					{
						geoRegion3D.Style3D.AltitudeMode = AltitudeMode.ClampToGround;
					}
					geoRegion3D.Style3D.FillForeColor = Color.FromArgb(120, 250, 250, 50);
					ClearTextMessageTag();
					int index = SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.IndexOf(m_messageTrackingTag);
					if (index >= 0)
					{
						SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.Remove(index);
					}
					SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.Add(geoRegion3D, "Measure_geoRegion3D");

					//绘制量算点对象
					for (Int32 i = 0; i < geoRegion3D.PartCount; i++)
					{
						for (Int32 j = 0; j < geoRegion3D[i].Count; j++)
						{
							GeoPoint3D geoPoint3D = new GeoPoint3D(geoRegion3D[i][j]);
							geoPoint3D.Style3D = m_GeoStyle3D.Clone();
							if (SmObjectLocator.getInstance().GlobeObject.Action == Action3D.MeasureArea)
							{
								geoPoint3D.Style3D.AltitudeMode = AltitudeMode.Absolute;
							}
							else if (SmObjectLocator.getInstance().GlobeObject.Action == Action3D.MeasureTerrainArea)
							{
								geoPoint3D.Style3D.AltitudeMode = AltitudeMode.ClampToGround;
							}
							SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.Add(geoPoint3D, m_MeasureAreaTag + i.ToString() + j.ToString());
						}
					}

					ClearTextMessageTag();

					//量算结果
					if (SmObjectLocator.getInstance().GlobeObject.Action == Action3D.MeasureArea)
					{
						m_strResult = String.Format("{0}{1}{2}", "空间面积:", Math.Round(Convert.ToDecimal(e.Area), 2), "平方米");
					}
					else
					{
						m_strResult = String.Format("{0}{1}{2}", "依地面积:", Math.Round(Convert.ToDecimal(e.Area), 2), "平方米");
					}
					GeoText3D text3d = GetGeoText3DMessage();
					text3d[0].Text = m_strResult;
					text3d[0].X = geoRegion3D.InnerPoint3D.X;
					text3d[0].Y = geoRegion3D.InnerPoint3D.Y;
					text3d[0].Z = geoRegion3D.InnerPoint3D.Z;

					GeoText3D geoText = new GeoText3D(text3d);
					// 添加结果文字
					SetResultTextStyle(geoText);
					SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.Add(geoText, m_MeasureAreaTag);

					//m_formMain.ClearOutputMessage();
					//m_formMain.OutputMessage(m_strResult);
				}

				else if (SmObjectLocator.getInstance().GlobeObject.Action == Action3D.MeasureAltitude)
				{
					//绘制量算线对象
					GeoLine3D geoLine3D = e.Geometry as GeoLine3D;
					geoLine3D.Style3D = m_GeoStyle3D.Clone();
					geoLine3D.Style3D.AltitudeMode = AltitudeMode.Absolute;
					SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.Add(geoLine3D, "Measure_Altitude");
					// 添加结果文字
					text = String.Format("{0}{1}{2}", "高度:", Math.Round(Convert.ToDecimal(e.Height), 2), "米");
					textLocation = geoLine3D[0][geoLine3D[0].Count - 1];
					GeoText3D geoText = new GeoText3D(new TextPart3D(text, textLocation));
					SetResultTextStyle(geoText);
					SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.Add(geoText, "Measure_Altitude");

					//输出首尾点高度
					Point3Ds point3Ds = geoLine3D[0];
					double startHeight = point3Ds[0].Z;
					double endHeight = point3Ds[1].Z;
					string message = string.Format("首点高度为:{0}米。", startHeight.ToString("##.00"));

					//m_formMain.ClearOutputMessage();
					//m_formMain.OutputMessage(message);
					//message = string.Format("尾点高度为:{0}米。", endHeight.ToString("##.00"));
					//m_formMain.OutputMessage(message);

					//绘制量算点对象
					for (Int32 i = 0; i < geoLine3D.PartCount; i++)
					{
						for (Int32 j = 0; j < geoLine3D[i].Count; j++)
						{
							GeoPoint3D geoPoint3D = new GeoPoint3D(geoLine3D[i][j]);
							geoPoint3D.Style3D = m_GeoStyle3D.Clone();
							geoPoint3D.Style3D.AltitudeMode = AltitudeMode.Absolute;
							SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.Add(geoPoint3D, m_MeasureAltitudeTag + j.ToString());
						}
					}
					ClearTextMessageTag();
					if (!(Toolkit.IsZero(m_curAltitude)))
					{
						EndOneMeasure();
					}
				}

				else if (SmObjectLocator.getInstance().GlobeObject.Action == Action3D.MeasureHorizontalDistance)
				{
					// 结果线
					GeoLine3D resLine3D = e.Geometry as GeoLine3D;
					resLine3D.Style3D = m_GeoStyle3D.Clone();
					resLine3D.Style3D.AltitudeMode = AltitudeMode.Absolute;


					// 结果点
					Point3Ds resPoints = resLine3D[0];
					for (Int32 i = 0; i < resPoints.Count; i++)
					{
						GeoPoint3D geoPoint = new GeoPoint3D(resPoints[i]);
						SetGeometry3DStyle(geoPoint);
						SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.Add(geoPoint, "Measure_Geometry" + i.ToString());
					}

					EndOneMeasure();
					SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.Add(resLine3D, "Measure_Geometry");

					// 添加结果文字
					text = String.Format("{0}{1}{2}", "总长度: ", Math.Round(Convert.ToDecimal(e.Length), 2), "米");
					GeoLine3D line = (geometry as GeoLine3D);
					textLocation = line[0][line[0].Count - 2];

					//ClearTextMessageTag();
					int index = SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.IndexOf(m_messageTrackingTag);
					if (index >= 0)
					{
						SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.Remove(index);
					}
					GeoText3D geoText = new GeoText3D(new TextPart3D(text, textLocation));
					SetResultTextStyle(geoText);

					SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.Add(geoText, "MeasureResult");

					//m_formMain.ClearOutputMessage();
					//m_formMain.OutputMessage(text);

					//计算首尾点高度差
					Point3Ds point3Ds = resLine3D[0];
					double height = point3Ds[point3Ds.Count - 1].Z - point3Ds[0].Z;
					string message = string.Format("首尾点高度差为:{0}米。", height.ToString("##.00"));
					//m_formMain.OutputMessage(message);
				}
			}
			catch (Exception ex)
			{
				Trace.WriteLine(ex.Message);
			}
			finally
			{
				m_label.Visible = false;
			}
		}
Example #22
0
		private void OutputMeasureArea(SuperMap.UI.Tracking3DEventArgs e)
		{
			try
			{
				Point location = SmObjectLocator.getInstance().GlobeObject.PointToClient(Cursor.Position);

				if (m_tempPoint != Point3D.Empty)
				{
					m_point3Ds.Remove(m_point3Ds.Count - 1);
				}
				m_tempPoint = new Point3D(e.X, e.Y, e.Z);
				m_point3Ds.Add(m_tempPoint);

				GeoRegion3D geoRegion3D = null;
				if (m_point3Ds.Count >= 3)
				{
					geoRegion3D = new GeoRegion3D(m_point3Ds);
					geoRegion3D.Style3D = m_GeoStyle3DTemp.Clone();

					location.Offset(30, 30);
					if (location.X > SmObjectLocator.getInstance().GlobeObject.Bounds.Width / 4 * 3)
					{
						location.X = SmObjectLocator.getInstance().GlobeObject.Bounds.Width / 4 * 3;
					}
					if (location.Y > SmObjectLocator.getInstance().GlobeObject.Bounds.Height)
					{
						location.Y = location.Y - 60;
					}

					TextPart3D textPart3D = new TextPart3D();
					textPart3D.AnchorPoint = new Point3D(0, 0, 0);
					textPart3D.Text = String.Empty;

					TextStyle style = new TextStyle();
					style.ForeColor = Color.White;
					style.IsSizeFixed = true;
					style.FontHeight = 6;
					style.Alignment = TextAlignment.BottomLeft;
					style.BackColor = Color.Black;
					style.Outline = true;
					GeoText3D text3d = new GeoText3D(textPart3D, style);
					text3d.Style3D = new GeoStyle3D();
					text3d.Style3D.AltitudeMode = AltitudeMode.Absolute;
					text3d.Style3D.BottomAltitude = 100;

					text3d[0].Text = e.TotalArea.ToString("##.00") + "平方米";
					if (e.Geometry != null)
					{
						text3d[0].X = e.Geometry.InnerPoint.X;
						text3d[0].Y = e.Geometry.InnerPoint.Y;
					}
					else
					{
						text3d[0].X = geoRegion3D.InnerPoint.X;
						text3d[0].Y = geoRegion3D.InnerPoint.Y;
					}

					int index = SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.IndexOf(m_messageTrackingTag);
					if (index >= 0)
					{
						SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.Remove(index);
					}
					SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.Add(text3d, m_messageTrackingTag);
					m_curArea = e.TotalArea;
				}
			}
			catch (Exception ex)
			{
				Console.WriteLine(ex.StackTrace);
			}
		}
Example #23
0
		/// <summary>
		/// 清空量算结果
		/// </summary>
		public void ClearResult()
		{
			try
			{
				ClearAllResult("Measure");

				SmObjectLocator.getInstance().GlobeObject.Action = Action3D.Pan;
				m_currentGeoText3DMessage = null;
			}
			catch (Exception ex)
			{
				Trace.WriteLine(ex.Message);
			}
		}
        /// <summary>
        /// 测量面积
        /// </summary>
        /// <param name="e"></param>
        private void OutputMeasureArea(SuperMap.UI.Tracking3DEventArgs e)
        {
            try
            {
                Point location = mSceneControl.PointToClient(Cursor.Position);

                if (mTempPoint != Point3D.Empty)
                {
                    mPoint3Ds.Remove(mPoint3Ds.Count - 1);
                }
                mTempPoint = new Point3D(e.X, e.Y, e.Z);
                mPoint3Ds.Add(mTempPoint);

                GeoRegion3D geoRegion3D = null;
                if (mPoint3Ds.Count >= 3)
                {
                    geoRegion3D         = new GeoRegion3D(mPoint3Ds);
                    geoRegion3D.Style3D = mGeoStyle3DTemp.Clone();

                    location.Offset(30, 30);

                    if (location.X > mSceneControl.Bounds.Width / 4 * 3)
                    {
                        location.X = mSceneControl.Bounds.Width / 4 * 3;
                    }
                    if (location.Y > mSceneControl.Bounds.Height)
                    {
                        location.Y = location.Y - 60;
                    }

                    TextPart3D textPart3D = new TextPart3D();
                    textPart3D.AnchorPoint = new Point3D(0, 0, 0);
                    textPart3D.Text        = String.Empty;

                    TextStyle style = new TextStyle();
                    style.ForeColor   = Color.White;
                    style.IsSizeFixed = true;
                    style.FontHeight  = 6;
                    style.Alignment   = TextAlignment.BottomLeft;
                    style.BackColor   = Color.Black;
                    style.Outline     = true;
                    GeoText3D text3d = new GeoText3D(textPart3D, style);
                    text3d.Style3D = new GeoStyle3D();
                    text3d.Style3D.AltitudeMode = AltitudeMode.Absolute;

                    text3d[0].Text = e.TotalArea.ToString("##.00") + "平方米";

                    if (e.Geometry != null)
                    {
                        text3d[0].X = e.Geometry.InnerPoint.X;
                        text3d[0].Y = e.Geometry.InnerPoint.Y;
                    }
                    else
                    {
                        text3d[0].X = geoRegion3D.InnerPoint.X;
                        text3d[0].Y = geoRegion3D.InnerPoint.Y;
                    }

                    int index = mSceneControl.Scene.TrackingLayer.IndexOf(MessageTrackingTag);
                    if (index >= 0)
                    {
                        mSceneControl.Scene.TrackingLayer.Remove(index);
                    }
                    mSceneControl.Scene.TrackingLayer.Add(text3d, MessageTrackingTag);
                    mCurArea = e.TotalArea;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }
        private void OutputMeasureDistance(SuperMap.UI.Tracking3DEventArgs e)
        {
            try
            {
                Point location = mSceneControl.PointToClient(Cursor.Position);

                if (mTempPoint != Point3D.Empty && mPoint3Ds.Count > 1)
                {
                    mPoint3Ds.Remove(mPoint3Ds.Count - 1);
                }
                mTempPoint = new Point3D(e.X, e.Y, e.Z);
                mPoint3Ds.Add(mTempPoint);

                location.Offset(30, 30);
                if (location.X > mSceneControl.Bounds.Width / 3 * 2)
                {
                    location.X = mSceneControl.Bounds.Width / 3 * 2;
                }
                if (location.Y > mSceneControl.Bounds.Height)
                {
                    location.Y = location.Y - 60;
                }

                TextPart3D textPart3D = new TextPart3D();
                textPart3D.AnchorPoint = new Point3D(0, 0, 0);
                textPart3D.Text        = String.Empty;

                TextStyle style = new TextStyle();
                style.ForeColor   = Color.White;
                style.IsSizeFixed = true;
                style.FontHeight  = 6;
                style.Alignment   = TextAlignment.BottomLeft;
                style.BackColor   = Color.Black;
                style.Outline     = true;
                GeoText3D text3d = new GeoText3D(textPart3D, style);
                text3d.Style3D = new GeoStyle3D();
                text3d.Style3D.AltitudeMode = AltitudeMode.Absolute;

                text3d[0].Text = e.CurrentLength.ToString("##.00") + "米";
                Point3D lastPoint = Point3D.Empty;
                if (e.Geometry != null)
                {
                    Point3Ds points = (e.Geometry as GeoLine3D)[0];
                    lastPoint = points[points.Count - 1];
                }
                else
                {
                    lastPoint = mPoint3Ds[0];
                }
                text3d[0].X = (lastPoint.X + e.X) / 2;
                text3d[0].Y = (lastPoint.Y + e.Y) / 2;

                int index = mSceneControl.Scene.TrackingLayer.IndexOf(MessageTrackingTag);
                if (index >= 0)
                {
                    mSceneControl.Scene.TrackingLayer.Remove(index);
                }
                mSceneControl.Scene.TrackingLayer.Add(text3d, MessageTrackingTag);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }
Example #26
0
		private void OutputMeasureDistance(SuperMap.UI.Tracking3DEventArgs e)
		{
			try
			{
				Point location = SmObjectLocator.getInstance().GlobeObject.PointToClient(Cursor.Position);

				if (m_tempPoint != Point3D.Empty && m_point3Ds.Count > 1)
				{
					m_point3Ds.Remove(m_point3Ds.Count - 1);
				}
				m_tempPoint = new Point3D(e.X, e.Y, e.Z);
				m_point3Ds.Add(m_tempPoint);

				location.Offset(30, 30);
				if (location.X > SmObjectLocator.getInstance().GlobeObject.Bounds.Width / 3 * 2)
				{
					location.X = SmObjectLocator.getInstance().GlobeObject.Bounds.Width / 3 * 2;
				}
				if (location.Y > SmObjectLocator.getInstance().GlobeObject.Bounds.Height)
				{
					location.Y = location.Y - 60;
				}

				TextPart3D textPart3D = new TextPart3D();
				textPart3D.AnchorPoint = new Point3D(0, 0, 0);
				textPart3D.Text = String.Empty;

				TextStyle style = new TextStyle();
				style.ForeColor = Color.White;
				style.IsSizeFixed = true;
				style.FontHeight = 6;
				style.Alignment = TextAlignment.BottomLeft;
				style.BackColor = Color.Black;
				style.Outline = true;
				GeoText3D text3d = new GeoText3D(textPart3D, style);
				text3d.Style3D = new GeoStyle3D();
				text3d.Style3D.AltitudeMode = AltitudeMode.Absolute;
				text3d.Style3D.BottomAltitude = 100;

				text3d[0].Text = e.CurrentLength.ToString("##.00") + "米";
				Point3D lastPoint = Point3D.Empty;
				if (e.Geometry != null)
				{
					Point3Ds points = (e.Geometry as GeoLine3D)[0];
					lastPoint = points[points.Count - 1];
				}
				else
				{
					lastPoint = m_point3Ds[0];
				}
				text3d[0].X = (lastPoint.X + e.X) / 2;
				text3d[0].Y = (lastPoint.Y + e.Y) / 2;

				int index = SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.IndexOf(m_messageTrackingTag);
				if (index >= 0)
				{
					SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.Remove(index);
				}
				SmObjectLocator.getInstance().GlobeObject.Scene.TrackingLayer.Add(text3d, m_messageTrackingTag);
			}
			catch (Exception ex)
			{
				Console.WriteLine(ex.StackTrace);
			}
		}
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void TrackedHandler(object sender, Tracked3DEventArgs e)
        {
            try
            {
                // 清空临时结果
                mPoint3Ds.Clear();
                mCurLength = 0.0;

                Geometry3D geometry     = e.Geometry;
                Point3D    textLocation = new Point3D(0, 0, 0);

                String text = String.Empty;
                if (mSceneControl.Action == Action3D.MeasureDistance && mIndex == 8 ||
                    mSceneControl.Action == Action3D.MeasureTerrainDistance)
                {
                    //绘制量算线对象
                    GeoLine3D geoLine3D = e.Geometry.Clone() as GeoLine3D;
                    geoLine3D.Style3D = mGeoStyle3D.Clone();
                    if (mSceneControl.Action == Action3D.MeasureDistance && mIndex == 8)
                    {
                        geoLine3D.Style3D.AltitudeMode = AltitudeMode.Absolute;
                    }
                    else
                    {
                        geoLine3D.Style3D.AltitudeMode = AltitudeMode.ClampToGround;
                    }
                    mSceneControl.Scene.TrackingLayer.Add(geoLine3D, MeasureDistanceTag);

                    //绘制量算点对象
                    Point3D point3D = Point3D.Empty;
                    for (Int32 i = 0; i < geoLine3D.PartCount; i++)
                    {
                        for (Int32 j = 0; j < geoLine3D[i].Count; j++)
                        {
                            GeoPoint3D geoPoint3D = new GeoPoint3D(geoLine3D[i][j]);
                            geoPoint3D.Style3D = mGeoStyle3D.Clone();
                            if (mSceneControl.Action == Action3D.MeasureDistance && mIndex == 8)
                            {
                                geoPoint3D.Style3D.AltitudeMode = AltitudeMode.Absolute;
                            }
                            else if (mSceneControl.Action == Action3D.MeasureTerrainDistance)
                            {
                                geoPoint3D.Style3D.AltitudeMode = AltitudeMode.ClampToGround;
                            }
                            mSceneControl.Scene.TrackingLayer.Add(geoPoint3D, MeasureDistanceTag);
                            point3D = geoLine3D[i][j];
                        }
                    }

                    //量算结果
                    int index = mSceneControl.Scene.TrackingLayer.IndexOf(MessageTrackingTag);
                    if (index >= 0)
                    {
                        mSceneControl.Scene.TrackingLayer.Remove(index);
                    }

                    // 添加结果文字
                    if (mSceneControl.Action == Action3D.MeasureDistance && mIndex == 8)
                    {
                        text = String.Format("{0}{1}{2}", "空间距离:", Math.Round(Convert.ToDecimal(e.Length), 2), "米");
                    }
                    else
                    {
                        text = String.Format("{0}{1}{2}", "依地距离:", Math.Round(Convert.ToDecimal(e.Length), 2), "米");
                    }

                    textLocation = geoLine3D[0][geoLine3D[0].Count - 1];
                    GeoText3D geoText = new GeoText3D(new TextPart3D(text, textLocation));
                    SetResultTextStyle(geoText);
                    mSceneControl.Scene.TrackingLayer.Add(geoText, "MeasureDistance");

                    //计算首尾点高度差
                    Point3Ds point3Ds = geoLine3D[0];
                    double   height   = point3Ds[point3Ds.Count - 1].Z - point3Ds[0].Z;
                    String   message  = string.Format("首尾点高度差为:{0}米。", height.ToString("##.00"));
                }

                else if (mSceneControl.Action == Action3D.MeasureArea && mIndex == 10 ||
                         mSceneControl.Action == Action3D.MeasureTerrainArea)
                {
                    //绘制量算面对象
                    GeoRegion3D geoRegion3D = e.Geometry as GeoRegion3D;
                    //绘制量算面对象
                    geoRegion3D.Style3D = mGeoStyle3D.Clone();
                    if (mSceneControl.Action == Action3D.MeasureArea)
                    {
                        geoRegion3D.Style3D.AltitudeMode = AltitudeMode.Absolute;
                    }
                    else
                    {
                        geoRegion3D.Style3D.AltitudeMode = AltitudeMode.ClampToGround;
                    }
                    geoRegion3D.Style3D.FillForeColor = Color.FromArgb(120, 250, 250, 50);
                    ClearTextMessageTag();
                    int index = mSceneControl.Scene.TrackingLayer.IndexOf(MessageTrackingTag);
                    if (index >= 0)
                    {
                        mSceneControl.Scene.TrackingLayer.Remove(index);
                    }

                    if (mIndex == 10)
                    {
                        mSceneControl.Scene.TrackingLayer.Add(geoRegion3D, "geoRegion3D");
                    }


                    //绘制量算点对象
                    for (Int32 i = 0; i < geoRegion3D.PartCount; i++)
                    {
                        for (Int32 j = 0; j < geoRegion3D[i].Count; j++)
                        {
                            GeoPoint3D geoPoint3D = new GeoPoint3D(geoRegion3D[i][j]);
                            geoPoint3D.Style3D = mGeoStyle3D.Clone();
                            if (mSceneControl.Action == Action3D.MeasureArea && mIndex == 10)
                            {
                                geoPoint3D.Style3D.AltitudeMode = AltitudeMode.Absolute;
                            }
                            else if (mSceneControl.Action == Action3D.MeasureTerrainArea)
                            {
                                geoPoint3D.Style3D.AltitudeMode = AltitudeMode.ClampToGround;
                            }
                            mSceneControl.Scene.TrackingLayer.Add(geoPoint3D, MeasureAreaTag + i.ToString() + j.ToString());
                        }
                    }

                    ClearTextMessageTag();

                    //量算结果
                    if (mSceneControl.Action == Action3D.MeasureArea && mIndex == 10)
                    {
                        mStrResult = String.Format("{0}{1}{2}", "空间面积:", Math.Round(Convert.ToDecimal(e.Area), 2), "平方米");
                    }
                    else
                    {
                        mStrResult = String.Format("{0}{1}{2}", "依地面积:", Math.Round(Convert.ToDecimal(e.Area), 2), "平方米");
                    }
                    GeoText3D text3d = GetGeoText3DMessage();
                    text3d[0].Text = mStrResult;
                    text3d[0].X    = geoRegion3D.InnerPoint3D.X;
                    text3d[0].Y    = geoRegion3D.InnerPoint3D.Y;
                    text3d[0].Z    = geoRegion3D.InnerPoint3D.Z;

                    GeoText3D geoText = new GeoText3D(text3d);

                    // 添加结果文字
                    SetResultTextStyle(geoText);
                    mSceneControl.Scene.TrackingLayer.Add(geoText, "MeasureArea");
                }

                else if (mSceneControl.Action == Action3D.MeasureAltitude && mIndex == 9)
                {
                    //绘制量算线对象
                    GeoLine3D geoLine3D = e.Geometry as GeoLine3D;
                    geoLine3D.Style3D = mGeoStyle3D.Clone();
                    geoLine3D.Style3D.AltitudeMode = AltitudeMode.Absolute;
                    mSceneControl.Scene.TrackingLayer.Add(geoLine3D, "Altitude");
                    // 添加结果文字
                    text         = String.Format("{0}{1}{2}", "高度:", Math.Round(Convert.ToDecimal(e.Height), 2), "米");
                    textLocation = geoLine3D[0][geoLine3D[0].Count - 1];
                    GeoText3D geoText = new GeoText3D(new TextPart3D(text, textLocation));
                    SetResultTextStyle(geoText);
                    mSceneControl.Scene.TrackingLayer.Add(geoText, "Altitude");

                    //输出首尾点高度
                    Point3Ds point3Ds    = geoLine3D[0];
                    double   startHeight = point3Ds[0].Z;
                    double   endHeight   = point3Ds[1].Z;
                    string   message     = string.Format("首点高度为:{0}米。", startHeight.ToString("##.00"));

                    //bd_formMain.ClearOutputMessage();
                    //bd_formMain.OutputMessage(message);
                    message = string.Format("尾点高度为:{0}米。", endHeight.ToString("##.00"));
                    //bd_formMain.OutputMessage(message);

                    //绘制量算点对象
                    for (Int32 i = 0; i < geoLine3D.PartCount; i++)
                    {
                        for (Int32 j = 0; j < geoLine3D[i].Count; j++)
                        {
                            GeoPoint3D geoPoint3D = new GeoPoint3D(geoLine3D[i][j]);
                            geoPoint3D.Style3D = mGeoStyle3D.Clone();
                            geoPoint3D.Style3D.AltitudeMode = AltitudeMode.Absolute;
                            mSceneControl.Scene.TrackingLayer.Add(geoPoint3D, MeasureAltitudeTag + j.ToString());
                        }
                    }
                    ClearTextMessageTag();
                    if (!(Toolkit.IsZero(mCurAltitude)))
                    {
                        EndOneMeasure();
                    }
                }

                else if (mSceneControl.Action == Action3D.MeasureHorizontalDistance)
                {
                    // 结果线
                    GeoLine3D resLine3D = e.Geometry as GeoLine3D;
                    resLine3D.Style3D = mGeoStyle3D.Clone();
                    resLine3D.Style3D.AltitudeMode = AltitudeMode.Absolute;


                    // 结果点
                    Point3Ds resPoints = resLine3D[0];
                    for (Int32 i = 0; i < resPoints.Count; i++)
                    {
                        GeoPoint3D geoPoint = new GeoPoint3D(resPoints[i]);
                        SetGeometry3DStyle(geoPoint);
                        mSceneControl.Scene.TrackingLayer.Add(geoPoint, "Geometry" + i.ToString());
                    }

                    EndOneMeasure();
                    mSceneControl.Scene.TrackingLayer.Add(resLine3D, "Geometry");

                    // 添加结果文字
                    text = String.Format("{0}{1}{2}", "总长度: ", Math.Round(Convert.ToDecimal(e.Length), 2), "米");
                    GeoLine3D line = (geometry as GeoLine3D);
                    textLocation = line[0][line[0].Count - 2];

                    //ClearTextMessageTag();
                    int index = mSceneControl.Scene.TrackingLayer.IndexOf(MessageTrackingTag);
                    if (index >= 0)
                    {
                        mSceneControl.Scene.TrackingLayer.Remove(index);
                    }
                    GeoText3D geoText = new GeoText3D(new TextPart3D(text, textLocation));
                    SetResultTextStyle(geoText);

                    mSceneControl.Scene.TrackingLayer.Add(geoText, "MeasureResult");

                    //bd_formMain.ClearOutputMessage();
                    //bd_formMain.OutputMessage(text);

                    //计算首尾点高度差
                    Point3Ds point3Ds = resLine3D[0];
                    double   height   = point3Ds[point3Ds.Count - 1].Z - point3Ds[0].Z;
                    string   message  = string.Format("首尾点高度差为:{0}米。", height.ToString("##.00"));
                    //bd_formMain.OutputMessage(message);
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
            finally
            {
                mLabel.Visible = false;
            }
        }
        /// <summary>
        /// 鼠标动作Up
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void SceneControlMouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                EndOneMeasure();
            }

            if (e.Button == MouseButtons.Left)
            {
                if (mPoint3Ds.Count == 0)
                {
                    //ClearMeasureResult();
                }

                if (mTempPoint != Point3D.Empty && mPoint3Ds.Count > 1)
                {
                    mPoint3Ds.Remove(mPoint3Ds.Count - 1);
                    mTempPoint = Point3D.Empty;
                }

                Point   location = mSceneControl.PointToClient(Cursor.Position);
                Point3D point3D  = new Point3D();

                if (mSceneControl.Action == Action3D.MeasureDistance && mIndex == 8 ||
                    mSceneControl.Action == Action3D.MeasureAltitude && mIndex == 9 ||
                    mSceneControl.Action == Action3D.MeasureHorizontalDistance)
                {
                    point3D = mSceneControl.Scene.PixelToGlobe(new Point(e.X, e.Y), SuperMap.Realspace.PixelToGlobeMode.TerrainAndModel);
                }
                else
                {
                    point3D = mSceneControl.Scene.PixelToGlobe(new Point(e.X, e.Y));
                }

                if (!Double.IsNaN(point3D.X) && !Double.IsNaN(point3D.Y) && !Double.IsNaN(point3D.Z))
                {
                    mPoint3Ds.Add(point3D);


                    if (mSceneControl.Action == Action3D.MeasureHorizontalDistance ||
                        mSceneControl.Action == Action3D.MeasureDistance && mIndex == 8)
                    {
                        //添加部分段长度
                        if (!Toolkit.IsZero(mCurLength))
                        {
                            if (mPoint3Ds.Count >= 2)
                            {
                                mPoint3Ds.RemoveRange(0, mPoint3Ds.Count - 2);
                                String     distanceUnit = "米";
                                GeoLine3D  geoLine3D    = new GeoLine3D(mPoint3Ds);
                                TextPart3D textPart3D   = new TextPart3D();
                                textPart3D.AnchorPoint = new Point3D(0, 0, 0);
                                Double tempCurLength = mCurLength;
                                textPart3D.Text = String.Format("{0:F2}{1}", tempCurLength, " " + distanceUnit);
                                if (mPoint3Ds[0].X > 0 && mPoint3Ds[1].X > 0 ||
                                    mPoint3Ds[0].X < 0 && mPoint3Ds[1].X < 0)
                                {
                                    textPart3D.X = geoLine3D.InnerPoint3D.X;
                                }
                                else
                                {
                                    textPart3D.X = 180;
                                }

                                textPart3D.Y = geoLine3D.InnerPoint3D.Y;
                                textPart3D.Z = geoLine3D.InnerPoint3D.Z;

                                GeoText3D text3d = mCurrentGeoText3DMessage == null?GetGeoText3DMessage() : mCurrentGeoText3DMessage;

                                text3d.AddPart(textPart3D);

                                //设置文字样式
                                text3d.TextStyle.FontHeight = 6;
                                text3d.TextStyle.Alignment  = TextAlignment.BottomLeft;
                                text3d.TextStyle.BackColor  = Color.Black;
                                text3d.TextStyle.Outline    = true;
                                text3d.Style3D.AltitudeMode = AltitudeMode.Absolute;

                                int index = mSceneControl.Scene.TrackingLayer.IndexOf(MessageTag);
                                if (index >= 0)
                                {
                                    mSceneControl.Scene.TrackingLayer.Remove(index);
                                }
                                //ClearTextMessageTag();
                                mSceneControl.Scene.TrackingLayer.Add(text3d, MessageTag);
                            }
                        }

                        //测地形距离
                        else if (mSceneControl.Action == Action3D.MeasureTerrainDistance)
                        {
                            //添加部分段长度
                            if (!Toolkit.IsZero(mCurLength))
                            {
                                if (mPoint3Ds.Count >= 2)
                                {
                                    mPoint3Ds.RemoveRange(0, mPoint3Ds.Count - 2);

                                    GeoLine3D  geoLine3D    = new GeoLine3D(mPoint3Ds);
                                    String     distanceUnit = "米";
                                    TextPart3D textPart3D   = new TextPart3D();
                                    textPart3D.AnchorPoint = new Point3D(0, 0, 0);
                                    Double tempCurLength = mCurLength;
                                    textPart3D.Text = String.Format("{0:F2}{1}", tempCurLength, " " + distanceUnit);
                                    if (mPoint3Ds[0].X > 0 && mPoint3Ds[1].X > 0 ||
                                        mPoint3Ds[0].X < 0 && mPoint3Ds[1].X < 0)
                                    {
                                        textPart3D.X = geoLine3D.InnerPoint.X;
                                        textPart3D.Y = geoLine3D.InnerPoint.Y;
                                    }
                                    else
                                    {
                                        textPart3D.X = 180;
                                        textPart3D.Y = geoLine3D.InnerPoint.Y;
                                    }
                                    textPart3D.Z = 0;
                                    GeoText3D text3d = GetGeoText3DMessage();
                                    text3d.AddPart(textPart3D);
                                    text3d.TextStyle.FontHeight = 6;
                                    text3d.TextStyle.Alignment  = TextAlignment.BottomLeft;
                                    text3d.TextStyle.BackColor  = Color.Black;
                                    text3d.TextStyle.Outline    = true;
                                    text3d.Style3D.AltitudeMode = AltitudeMode.ClampToGround;//贴地高程模式
                                    ClearTextMessageTag();
                                    mSceneControl.Scene.TrackingLayer.Add(text3d, MessageTag);
                                }
                            }
                        }
                        else if (mSceneControl.Action == Action3D.MeasureArea && mIndex == 10)
                        {
                        }
                        else if (mSceneControl.Action == Action3D.MeasureAltitude && mIndex == 9)
                        {
                            //清除量算高度信息
                            if (!(Toolkit.IsZero(mCurAltitude)))
                            {
                                EndOneMeasure();
                            }
                        }
                    }
                }
            }
        }