Beispiel #1
0
        /// <summary>
        /// 左键单击事件
        /// 获取建筑物信息
        /// </summary>
        /// <param name="Flags"></param>
        /// <param name="X"></param>mo
        /// <param name="Y"></param>
        /// <param name="pbHandled"></param>
        void TE_OnLButtonDown(int Flags, int X, int Y, ref object pbHandled)
        {
            try
            {
                object longitude, latitude, objectID, height, objType;
                objType = 1;
                Program.pRender.ScreenToWorld(X, Y, ref objType, out longitude, out height, out latitude, out objectID);
                if (objectID.ToString() == "")
                {
                    objType = 16;
                    Program.pRender.ScreenToWorld(X, Y, ref objType, out longitude, out height, out latitude, out objectID);
                }
                IFeature61 pf61 = pf.GetFeature(objectID.ToString());

                string fid = pf61.FeatureAttributes.GetFeatureAttribute(this.ModelID).Value.ToString();
                // Program.TE.ScreenToWorld(X, Y, ref objType, out longitude, out height, out latitude, out objectID);
                this.ShowBuilderInfo(fid);
                this.xtraTabControl1.SelectedTabPageIndex = 1;
            }
            catch (Exception ex)
            {
            }
        }
Beispiel #2
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (m_Flag)
            {
                if (MessageBox.Show("已经分析过了,确定要再次分析吗?", "Sunz", MessageBoxButtons.YesNo) != DialogResult.Yes)
                {
                    return;
                }
            }
            else
            {
                this.Height = this.Height + txtResult.Height;
                this.Refresh();
                Application.DoEvents();
            }

            Clear();

            try
            {
                // 获取设置
                double lampHeight       = (double)spinEdit1.Value;
                double carHeight        = (double)spinEdit2.Value;
                double setHeight        = (double)spinEdit3.Value;
                double carLength        = (double)spinEdit4.Value;
                double lampMustDistance = (double)spinEdit5.Value;

                LampSetting lampSetting = new LampSetting();
                lampSetting.MostLampHeight   = lampHeight;
                lampSetting.MostCarHeight    = carHeight;
                lampSetting.LestSetHeight    = setHeight;
                lampSetting.MostCarLength    = carLength;
                lampSetting.MustViewDistance = lampMustDistance;
                m_Result.Setting             = lampSetting;

                object[] args    = { lampHeight, carHeight, setHeight, carLength, lampMustDistance };
                string   strArgs = string.Format("信号灯最大高度:{0}米;车辆最大高度:{1}米;车座最小高度:{2}米;车辆最大长度:{3}米;信号灯最小必须可见距离:{4}米", args);

                string lyr   = ConfigurationManager.AppSettings["CrossLayer"];
                int    lyrID = m_Hook.ProjectTree.FindItem(lyr);
                if (lyrID < 0)
                {
                    MessageBox.Show("您的配置有问题或者路口图层没有加载");
                    return;
                }

                ILayer61 teLayer = null;
                try
                {
                    teLayer = m_Hook.ProjectTree.GetLayer(lyrID);
                    if (teLayer == null)
                    {
                        return;
                    }
                }
                catch
                {
                    MessageBox.Show("您配置的路口图层不是矢量图层");
                    return;
                }

                // 准备信号灯图层

                int lampGroup = m_Hook.ProjectTree.FindItem(m_LampGroup);
                if (lampGroup > -1)
                {
                    m_Hook.ProjectTree.DeleteItem(lampGroup);
                }
                lampGroup = m_Hook.ProjectTree.CreateGroup(m_LampGroup);

                int      fCount     = teLayer.FeatureGroups.Point.Count;
                string[] strDirects = { "东", "南", "西", "北" };
                int      fIndex     = 0;
                while (true)
                {
                    double crossWidth = 10;

                    SendMessage(string.Format("正在分析第{0}个路口...", fIndex + 1));

                    IFeature61 tefCurrent = teLayer.FeatureGroups.Point[fIndex] as IFeature61;
                    for (int i = 0; i < 4; i++)
                    {
                        SendMessage(string.Format("  正在分析{0}面的信号灯...", strDirects[i]));
                        crossWidth = Convert.ToDouble(tefCurrent.FeatureAttributes.GetFeatureAttribute(m_RoadWidthFields[i]).Value);
                        if (crossWidth <= 0)
                        {
                            SendMessage(string.Format("    {0}没有支路,不需要信号灯。", strDirects[i]));
                            continue;
                        }

                        string strRoadInfo = string.Format("路口宽度:{0}米", crossWidth);

                        SendMessage(string.Format("    加载参数:{0};{1}...", strArgs, strRoadInfo));
                        SendMessage(string.Format("    正在添加信号灯..."));
                        // 添加信号灯
                        IPoint fPoint = tefCurrent.Geometry as IPoint;
                        double offSet = crossWidth / 2.0;
                        if (fPoint.X < 180) // 坐标转换
                        {
                            offSet = offSet / 102166.66666666666666666666666667;
                        }

                        // 按东南西北移动到对面的斑马线
                        double modelX = fPoint.X + (i == 0 ? -offSet : (i == 2 ? offSet : 0));
                        double modelY = fPoint.Y + (i == 1 ? offSet : (i == 3 ? -offSet : 0));

                        // 按东南西北移动到右侧
                        modelX = modelX + (i == 1 ? offSet : (i == 3 ? -offSet : 0));
                        modelY = modelY + (i == 0 ? offSet : (i == 2 ? -offSet : 0));

                        // 根据路口实际方位与正东南西北方位偏移角做位置调整
                        double rawOffSet = Convert.ToDouble(tefCurrent.FeatureAttributes.GetFeatureAttribute(m_RoadOffsetFields[i]).Value);
                        double dgree     = rawOffSet / 180 * Math.PI;
                        double dgreeBase = Math.PI / 4;
                        double dOffsetX  = 0;
                        double dOffsetY  = 0;
                        switch (i)
                        {
                        case 0:
                            dOffsetX = offSet * (Math.Cos(dgreeBase) - Math.Cos(dgree + dgreeBase));
                            dOffsetY = offSet * (Math.Sin(dgree + dgreeBase) - Math.Sin(dgreeBase));
                            break;

                        case 1:
                            dOffsetX = offSet * (Math.Sin(dgree + dgreeBase) - Math.Sin(dgreeBase));
                            dOffsetY = -offSet * (Math.Cos(dgreeBase) - Math.Cos(dgree + dgreeBase));
                            break;

                        case 2:
                            dOffsetX = -offSet * (Math.Cos(dgreeBase) - Math.Cos(dgree + dgreeBase));
                            dOffsetY = -offSet * (Math.Sin(dgree + dgreeBase) - Math.Sin(dgreeBase));
                            break;

                        case 3:
                            dOffsetX = -offSet * (Math.Sin(dgree + dgreeBase) - Math.Sin(dgreeBase));
                            dOffsetY = offSet * (Math.Cos(dgreeBase) - Math.Cos(dgree + dgreeBase));
                            break;
                        }
                        modelX = modelX + dOffsetX;
                        modelY = modelY + dOffsetY;

                        double          raw      = (rawOffSet + 90 * (1 + i)) % 360;
                        IPosition61     position = m_Hook.Creator.CreatePosition(modelX, modelY, fPoint.Z, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, raw);
                        string          strName  = string.Format("第{0}个路口{1}面支路", fIndex + 1, strDirects[i]);
                        ITerrainModel61 theModel = m_Hook.Creator.CreateModel(position, m_ModelFile, 1, ModelTypeCode.MT_NORMAL, lampGroup, strName);
                        //m_Hook.Navigate.SetPosition(position);
                        //Application.DoEvents();


                        // 信号灯信息
                        LampInfo lampInfo = new LampInfo();
                        lampInfo.CrossName    = (fIndex + 1).ToString();
                        lampInfo.Name         = strName;
                        lampInfo.DirectString = strDirects[i];
                        lampInfo.CrossWidth   = crossWidth;
                        lampInfo.RawOffset    = rawOffSet;
                        lampInfo.TheLamp      = theModel;
                        lampInfo.X            = modelX;
                        lampInfo.Y            = modelY;
                        m_Result.AddLamp(lampInfo);         // 无论后来计算的结果如何,先添加到结果

                        // 计算大车遮挡
                        // 计算时间太短,停一秒
                        System.Threading.Thread.Sleep(Convert.ToInt32(ConfigurationManager.AppSettings["HeightSleep"]));
                        double lampMustHeight = (carHeight - setHeight) * (lampMustDistance + crossWidth) / (lampMustDistance - carLength) + setHeight;
                        lampInfo.LestHeight = lampMustHeight;

                        SendMessage(string.Format("    信号最小理论高度为{0}米...", lampMustHeight));
                        if (lampHeight < lampMustHeight)
                        {
                            lampInfo.HeightFlag = true;

                            SendMessage(string.Format("    信号灯在有大车情况下不能在规定的最小距离内看到信号灯,必须在路对面增加辅助信号灯."));
                            SendMessage(string.Format("    正在添加辅助信号灯..."));

                            // 添加辅助信号灯
                            position = m_Hook.Creator.CreatePosition(fPoint.X + (i < 1 ? -offSet : offSet), fPoint.Y + (i == 1 || i == 2 ? offSet : -offSet), fPoint.Z);
                            ITerrainModel61 assistantModel = m_Hook.Creator.CreateModel(position, m_ModelFile, 1, ModelTypeCode.MT_NORMAL, lampGroup, string.Format("第{0}个路口{1}辅助", fIndex + 1, strDirects[i]));

                            lampInfo.AssistantLamp = assistantModel;

                            continue;
                        }

                        SendMessage(string.Format("    正在计算是否会因为建筑物及绿化带等引起信号灯盲区..."));

                        // 计算因为建筑物及绿化带等引起的
                        // 计算过程就先不计算了,从数据里读吧,停2秒
                        System.Threading.Thread.Sleep(Convert.ToInt32(ConfigurationManager.AppSettings["BuildingSleep"]));
                        if (Convert.ToInt32(tefCurrent.FeatureAttributes.GetFeatureAttribute(m_FlagField).Value) > 0)
                        // 引起盲区
                        {
                            lampInfo.ViewFlag = false;

                            SendMessage(string.Format("    由于建筑物及绿化带等将引起信号灯盲区,必须在路对面增加辅助信号灯."));
                            SendMessage(string.Format("    正在添加辅助信号灯..."));

                            // 添加辅助信号灯
                            position = m_Hook.Creator.CreatePosition(fPoint.X + (i < 1 ? -offSet : offSet), fPoint.Y + (i == 1 || i == 2 ? offSet : -offSet), fPoint.Z);
                            ITerrainModel61 assistantModel = m_Hook.Creator.CreateModel(position, m_ModelFile, 1, ModelTypeCode.MT_NORMAL, lampGroup, string.Format("第{0}个路口{1}辅助", fIndex + 1, strDirects[i]));

                            lampInfo.AssistantLamp = assistantModel;
                        }
                    }

                    fIndex++;
                    if (fIndex == fCount)
                    {
                        break;
                    }
                }

                SendMessage("自动化分析已完成。");
                m_Result.LampAnalysisFinished();

                m_Flag = true;
            }
            catch
            {
                MessageBox.Show("对不起,分析过程出现错误,这通常是由配置与数据不匹配引起的");
                return;
            }
        }
Beispiel #3
0
        /// <summary>
        /// 左键单击事件
        /// 获取建筑物信息
        /// </summary>
        /// <param name="Flags"></param>
        /// <param name="X"></param>mo
        /// <param name="Y"></param>
        /// <param name="pbHandled"></param>
        void TE_OnLButtonDown(int Flags, int X, int Y, ref object pbHandled)
        {
            try
            {

                int modelLayerID = Hook.ProjectTree.FindItem(ConfigurationManager.AppSettings["LayerPath"]);

                // 模型复原
                // 显示
                int groupID = Hook.ProjectTree.FindItem(Pipe_Group_Name);
                if (groupID > 0)
                {
                    Hook.ProjectTree.DeleteItem(groupID);
                }
                if (m_FeatureSelected != null)
                {

                    //m_FeatureSelected.FeatureAttributes.GetFeatureAttribute("MODELNAME").Value = m_ModelName;

                    if (modelLayerID > 0)
                    {
                        ILayer61 lyrModel = Hook.ProjectTree.GetLayer(modelLayerID);
                        lyrModel.Filter = "";
                        //lyrModel.Refresh();
                        //lyrModel.Save();
                        //lyrModel.Refresh();
                    }
                }

                // 开始新的
                // 取到模型
                object longitude, latitude, objectID, height, objType;
                objType = 17;
                Program.pRender.ScreenToWorld(X, Y, ref objType, out longitude, out height, out latitude, out objectID);
                if (objectID.ToString() == "")
                {
                    objType = 16;
                    Program.pRender.ScreenToWorld(X, Y, ref objType, out longitude, out height, out latitude, out objectID);
                }

                if (objectID.ToString() == "")
                    return;

                groupID = Hook.ProjectTree.CreateGroup(Pipe_Group_Name);

                ITerraExplorerObject61 teOjbect = Program.pCreator6.GetObject(objectID as string);
                m_FeatureSelected = teOjbect as IFeature61;
                if (m_FeatureSelected == null)
                {
                    return;
                }

                m_ModelName = m_FeatureSelected.FeatureAttributes.GetFeatureAttribute(m_ModelField).Value;

                string strFile = System.IO.Path.Combine(ConfigurationManager.AppSettings["ModelPath"], m_ModelName);

                IPoint pSel = m_FeatureSelected.Geometry as IPoint;

                ITerrainModel61 m_Model =Hook.Creator.CreateModel( Hook.Creator.CreatePosition(pSel.X, pSel.Y),strFile,1,ModelTypeCode.MT_NORMAL,groupID,"Temp");

                m_Model.Visibility.Show = false;
                if (m_Model == null)
                    return;

                m_AnalysisResult=false;
                string strPipedFileList = ConfigurationManager.AppSettings["PipedFileList"];
                strPipedFileList = strPipedFileList.ToLower();

                m_HoleBox = m_Model.Terrain.BBox;
                Hook.Creator.DeleteObject(m_Model.ID);

                double[] points =
                {
                    m_HoleBox.MinX,m_HoleBox.MinY,0,
                    m_HoleBox.MaxX,m_HoleBox.MinY,0,
                    m_HoleBox.MaxX,m_HoleBox.MaxY,0,
                    m_HoleBox.MinX,m_HoleBox.MaxY,0
                };

                IPolygon polygonHole = Hook.Creator.GeometryCreator.CreatePolygonGeometry(points);

                Hook.Creator.CreateHoleOnTerrain(polygonHole as IGeometry, groupID, Pipe_Hole_Name);

                if (strPipedFileList.Contains(m_ModelName.ToLower()))
                {
                    m_AnalysisResult = true;
                }

                // 隐藏
               // m_FeatureSelected.FeatureAttributes.GetFeatureAttribute("MODELNAME").Value = "";
                if (modelLayerID > 0)
                {
                    ILayer61 lyrModel = Hook.ProjectTree.GetLayer(modelLayerID);
                    //lyrModel.Save();
                    lyrModel.Filter = string.Format("{0} <> '{1}'",m_ModelField, m_ModelName);
                    lyrModel.Refresh();
                }

            }
            catch (Exception ex)
            {
                HasError = true;
            }
            finally
            {
                if (Analysised != null)
                    Analysised.Invoke();
                EndPipeAnalysis();

            }
        }
Beispiel #4
0
        /// <summary>
        /// 左键单击事件
        /// 获取建筑物信息
        /// </summary>
        /// <param name="Flags"></param>
        /// <param name="X"></param>mo
        /// <param name="Y"></param>
        /// <param name="pbHandled"></param>
        void TE_OnLButtonDown(int Flags, int X, int Y, ref object pbHandled)
        {
            try
            {
                int modelLayerID = Hook.ProjectTree.FindItem(ConfigurationManager.AppSettings["LayerPath"]);


                // 模型复原
                // 显示
                int groupID = Hook.ProjectTree.FindItem(Pipe_Group_Name);
                if (groupID > 0)
                {
                    Hook.ProjectTree.DeleteItem(groupID);
                }
                if (m_FeatureSelected != null)
                {
                    //m_FeatureSelected.FeatureAttributes.GetFeatureAttribute("MODELNAME").Value = m_ModelName;

                    if (modelLayerID > 0)
                    {
                        ILayer61 lyrModel = Hook.ProjectTree.GetLayer(modelLayerID);
                        lyrModel.Filter = "";
                        //lyrModel.Refresh();
                        //lyrModel.Save();
                        //lyrModel.Refresh();
                    }
                }


                // 开始新的
                // 取到模型
                object longitude, latitude, objectID, height, objType;
                objType = 17;
                Program.pRender.ScreenToWorld(X, Y, ref objType, out longitude, out height, out latitude, out objectID);
                if (objectID.ToString() == "")
                {
                    objType = 16;
                    Program.pRender.ScreenToWorld(X, Y, ref objType, out longitude, out height, out latitude, out objectID);
                }

                if (objectID.ToString() == "")
                {
                    return;
                }

                groupID = Hook.ProjectTree.CreateGroup(Pipe_Group_Name);

                ITerraExplorerObject61 teOjbect = Program.pCreator6.GetObject(objectID as string);
                m_FeatureSelected = teOjbect as IFeature61;
                if (m_FeatureSelected == null)
                {
                    return;
                }

                m_ModelName = m_FeatureSelected.FeatureAttributes.GetFeatureAttribute(m_ModelField).Value;

                string strFile = System.IO.Path.Combine(ConfigurationManager.AppSettings["ModelPath"], m_ModelName);

                IPoint pSel = m_FeatureSelected.Geometry as IPoint;

                ITerrainModel61 m_Model = Hook.Creator.CreateModel(Hook.Creator.CreatePosition(pSel.X, pSel.Y), strFile, 1, ModelTypeCode.MT_NORMAL, groupID, "Temp");

                m_Model.Visibility.Show = false;
                if (m_Model == null)
                {
                    return;
                }

                m_AnalysisResult = false;
                string strPipedFileList = ConfigurationManager.AppSettings["PipedFileList"];
                strPipedFileList = strPipedFileList.ToLower();

                m_HoleBox = m_Model.Terrain.BBox;
                Hook.Creator.DeleteObject(m_Model.ID);

                double[] points =
                {
                    m_HoleBox.MinX, m_HoleBox.MinY, 0,
                    m_HoleBox.MaxX, m_HoleBox.MinY, 0,
                    m_HoleBox.MaxX, m_HoleBox.MaxY, 0,
                    m_HoleBox.MinX, m_HoleBox.MaxY, 0
                };

                IPolygon polygonHole = Hook.Creator.GeometryCreator.CreatePolygonGeometry(points);


                Hook.Creator.CreateHoleOnTerrain(polygonHole as IGeometry, groupID, Pipe_Hole_Name);

                if (strPipedFileList.Contains(m_ModelName.ToLower()))
                {
                    m_AnalysisResult = true;
                }

                // 隐藏
                // m_FeatureSelected.FeatureAttributes.GetFeatureAttribute("MODELNAME").Value = "";
                if (modelLayerID > 0)
                {
                    ILayer61 lyrModel = Hook.ProjectTree.GetLayer(modelLayerID);
                    //lyrModel.Save();
                    lyrModel.Filter = string.Format("{0} <> '{1}'", m_ModelField, m_ModelName);
                    lyrModel.Refresh();
                }
            }
            catch (Exception ex)
            {
                HasError = true;
            }
            finally
            {
                if (Analysised != null)
                {
                    Analysised.Invoke();
                }
                EndPipeAnalysis();
            }
        }
Beispiel #5
0
        /// <summary>
        /// 鼠标左键按下时发生的事件(建立缓冲区的主要方法)
        /// </summary>
        /// <param name="Flags"></param>
        /// <param name="X"></param>
        /// <param name="Y"></param>
        /// <param name="pbHandled"></param>
        void TE_OnLButtonDown(int Flags, int X, int Y, ref object pbHandled)
        {
            if (En == "DrawGeo")
            {
            }
            else if (En == "SelectModle")
            {
                // 2012-9-20 张航宇
                // 若成功的完成了一次缓冲分析,则将状态释放,要求重新点击
                IWorldPointInfo61 pIWorldPointInfo = this.SgWorld.Window.PixelToWorld(X, Y, WorldPointType.WPT_MODEL);
                if (pIWorldPointInfo.ObjectID != "" && pIWorldPointInfo.ObjectID != null)
                {
                    try
                    {
                        ITerraExplorerObject61 pp = this.SgWorld.Creator.GetObject(pIWorldPointInfo.ObjectID);
                        if (pp.ObjectType == ObjectTypeCode.OT_FEATURE)
                        {
                            IFeature61 pIF = pp as IFeature61;
                            this.geo = pIF.GeometryZ.SpatialOperator.buffer((double)this.spinEdit1.Value);
                            ITerrainPolygon61 polygon = this.SgWorld.Creator.CreatePolygon(this.geo, -16711936, -10197916, cbRelative.Checked?AltitudeTypeCode.ATC_TERRAIN_RELATIVE: AltitudeTypeCode.ATC_ON_TERRAIN, GroupID, "Buffer" + System.Guid.NewGuid().ToString().Substring(0, 6));

                            if (cbRelative.Checked)
                            {
                                polygon.Position.Altitude = (double)speHeight.Value;
                            }

                            this.En             = null;
                            this.Select.Checked = false;
                        }
                        else
                        {
                            ITerrainModel61 pITerrainModel = this.SgWorld.Creator.GetObject(pIWorldPointInfo.ObjectID) as ITerrainModel61;
                            IBBox3D61       pBBox          = pITerrainModel.Terrain.BBox;
                            cVerticesArray = new double[] {
                                pBBox.MaxX, pBBox.MinY, 0,
                                pBBox.MaxX, pBBox.MaxY, 0,
                                pBBox.MinX, pBBox.MaxY, 0,
                                pBBox.MinX, pBBox.MinY, 0,
                            };
                            ILinearRing cRing            = this.SgWorld.Creator.GeometryCreator.CreateLinearRingGeometry(cVerticesArray);
                            IPolygon    cPolygonGeometry = this.SgWorld.Creator.GeometryCreator.CreatePolygonGeometry(cRing, null);
                            //this.geo = cPolygonGeometry as IGeometry;
                            ISpatialOperator _SpatialOperator = cPolygonGeometry.SpatialOperator;

                            this.geo = _SpatialOperator.buffer((double)this.spinEdit1.Value);
                            ITerrainPolygon61 polygon = this.SgWorld.Creator.CreatePolygon(this.geo, -16711936, -10197916, cbRelative.Checked ? AltitudeTypeCode.ATC_TERRAIN_RELATIVE : AltitudeTypeCode.ATC_ON_TERRAIN, GroupID, "Buffer" + System.Guid.NewGuid().ToString().Substring(0, 6));

                            if (cbRelative.Checked)
                            {
                                polygon.Position.Altitude = (double)speHeight.Value;
                            }

                            this.En             = null;
                            this.Select.Checked = false;
                        }
                    }
                    catch
                    {
                    }
                }
            }
        }
Beispiel #6
0
        /// <summary>
        /// 加载shape文件添加模型
        /// 模型数据要与shape在同一路径下
        /// 2012-09-21 张航宇
        /// 添加Z修正 -56
        /// </summary>
        /// <param name="FileName"></param>
        ///
        public void LoadShapeAdd3model(ISGWorld61 sgworld, ITerraExplorer te, string FileName)
        {
            IInformationTree5 infoTree5 = te as IInformationTree5;

            if (string.IsNullOrEmpty(FileName))
            {
                return;
            }
            if (File.Exists(FileName))
            {
                bool   PathType     = true;
                string PathFileName = "";
                string GroupName    = "模型组群" + System.Guid.NewGuid().ToString().Substring(0, 6);
                infoTree5.CreateGroup(GroupName, 0);
                int    GroupID         = sgworld.ProjectTree.FindItem(GroupName);
                string ModelFilename   = "";
                string UNModelFilename = "";
                string _XMLLayerInfo   = "<PlugData>" +

                                         "<PlugType>shape</PlugType>" +

                                         "<LayerName>" + FileName + "</LayerName>" +

                                         "<Server></Server>" +

                                         "<user></user>" +

                                         "<password></password>" +

                                         "<TableName></TableName>" +

                                         "<AttributesToLoad>*</AttributesToLoad >" +

                                         "<Feature>1</Feature >" +

                                         "<Annotation>1</Annotation>" +

                                         "<SaveItems>0</SaveItems>" +

                                         "<GroupKey>LAT-LONG</GroupKey>" +

                                         "<SysKey>LAT-LONG</SysKey>" +

                                         "<DatumKey>WGS84</DatumKey>" +

                                         "<UnitKey>METERS</UnitKey>" +

                                         "<UseZValue>0</UseZValue>" +

                                         "<AltitudeUnit>Meters</AltitudeUnit>" +

                                         "<Reproject>1</Reproject>" +

                                         "<StreamedLayer>0</StreamedLayer></PlugData >";
                ILayer5 iLyr = infoTree5.CreateLayer("3DModleGoto", _XMLLayerInfo, GroupID);//在根目录下装载shp数据
                iLyr.Load();
                IFeature61 sqfeature61 = null;
                int        itemid      = sgworld.ProjectTree.FindItem("" + GroupName + "\\3DModleGoto");

                ILayer61 m_layer61 = sgworld.ProjectTree.GetLayer(itemid);
                m_layer61.Streaming = false;

                IFeatureGroups61 pFeatureGroups61 = m_layer61.FeatureGroups;

                IFeatureGroup61 pFeatureGroup61 = pFeatureGroups61.Point as IFeatureGroup61;
                if (pFeatureGroup61 == null)
                {
                    MessageBox.Show("当前操作要求是正确的点图层");
                    return;
                }
                else
                {
                    if (pFeatureGroup61.Count == 0)
                    {
                        MessageBox.Show("图层为空!");
                        return;
                    }
                    else
                    {
                        sqfeature61 = pFeatureGroup61[0] as IFeature61;
                        IFeatureAttributes61 m_FeatureAttributes = sqfeature61.FeatureAttributes;
                        int      AttributesCount = m_FeatureAttributes.Count;
                        string[] FiledArry       = new string[AttributesCount];
                        for (int f = 0; f < AttributesCount; f++)
                        {
                            IFeatureAttribute61 m_FeatureAttribute = m_FeatureAttributes[f] as IFeatureAttribute61;
                            FiledArry[f] = m_FeatureAttribute.Name;
                        }
                        Skyline.Core.UI.FrmAddModelShape pFrmAddModelShape = new Skyline.Core.UI.FrmAddModelShape();
                        pFrmAddModelShape.GetFiledName = FiledArry;
                        pFrmAddModelShape.ShowDialog();
                        PathFileName = pFrmAddModelShape.Filed;
                        PathType     = pFrmAddModelShape.PathType;
                        pFrmAddModelShape.Dispose();

                        int m_FeatureCount     = pFeatureGroup61.Count;
                        int ImportFeatureCount = pFeatureGroup61.Count;
                        for (int i = 0; i < m_FeatureCount; i++)
                        {
                            sqfeature61 = pFeatureGroup61[i] as IFeature61;
                            IFeatureAttributes61     _FeatureAttributes = sqfeature61.FeatureAttributes;
                            TerraExplorerX.IGeometry _Geometry          = sqfeature61.GeometryZ;
                            TerraExplorerX.IPoint    pPoint             = _Geometry as TerraExplorerX.IPoint;
                            //IPosition61 TPosition61 = sgworld.Window.PixelToWorld(pPoint.X, pPoint.Y, WorldPointType.WPT_ALL).Position;
                            IPosition61         TPosition61       = sgworld.Creator.CreatePosition(pPoint.X, pPoint.Y, -56, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, 0, 0);
                            IFeatureAttribute61 _FeatureAttribute = _FeatureAttributes.GetFeatureAttribute(PathFileName);
                            UNModelFilename = _FeatureAttribute.Value.ToString();
                            if (PathType)
                            {
                                ModelFilename = System.IO.Path.GetDirectoryName(FileName) + "\\" + UNModelFilename;
                            }
                            else
                            {
                                ModelFilename = UNModelFilename;
                            }

                            try
                            {
                                sgworld.Creator.CreateModel(TPosition61, ModelFilename, 1, ModelTypeCode.MT_NORMAL, GroupID, UNModelFilename);
                            }
                            catch
                            {
                                ImportFeatureCount--;
                                continue;
                            }
                        }
                        MessageBox.Show(ImportFeatureCount + "个模型加载成功," + (m_FeatureCount - ImportFeatureCount) + "个模型加载失败!");

                        /****20130227杨漾(添加文件有效性判断,分步判断图层有效性,增加加载统计情况提示)****/
                    }
                }
            }
        }