Beispiel #1
0
        // 确定
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            try
            {
                string pointCount  = txtPointCount.Text.Trim();
                string planeScale  = txtPlaneModelScale.Text.Trim();
                string sallteScale = txtSallteModelScaleEx.Text.Trim();;

                string      xmlConfig = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\GlobeConfig.xml");
                XmlDocument doc       = new XmlDocument();
                doc.Load(xmlConfig);

                XmlNode node;
                node          = doc.SelectSingleNode("Globe/Config/TrackPointLimit");
                node.InnerXml = pointCount;
                node          = doc.SelectSingleNode("Globe/Config/PlaneModelScale");
                node.InnerXml = planeScale;
                node          = doc.SelectSingleNode("Globe/Config/SallteModelScale");
                node.InnerXml = sallteScale;
                doc.Save(xmlConfig);

                XtraMessageBox.Show("参数保存成功,重启后生效。");

                Utils.TrackPointNum = Convert.ToInt32(pointCount);
            }
            catch (Exception ex)
            {
                Log4Allen.WriteLog(typeof(frmSet), ex.Message);
            }

            this.DialogResult = DialogResult.OK;
        }
Beispiel #2
0
        /// <summary>
        /// 程序启动时加载一个矢量图层,解决加载切片服务时,地球两级有黑洞的现象
        /// </summary>
        private void LoadLyrFile()
        {
            string north = AppDomain.CurrentDomain.BaseDirectory + "Maps\\north.lyr";

            if (File.Exists(north))
            {
                try
                {
                    mfMap.LoadMap(north);
                }
                catch (Exception ex)
                {
                    Log4Allen.WriteLog(typeof(AxGlobeControlEx), ex.Message);
                }
            }

            string south = AppDomain.CurrentDomain.BaseDirectory + "Maps\\south.lyr";

            if (File.Exists(south))
            {
                try
                {
                    mfMap.LoadMap(south);
                }
                catch (Exception ex)
                {
                    Log4Allen.WriteLog(typeof(AxGlobeControlEx), ex.Message);
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// 设置父节点的选中状态
        /// </summary>
        /// <param name="node">当前节点</param>
        /// <param name="check">选中状态</param>
        private void SetCheckedParentNodes(TreeListNode node, CheckState check)
        {
            try
            {
                if (node.ParentNode != null)
                {
                    bool       b = false;
                    CheckState state;

                    for (int i = 0; i < node.ParentNode.Nodes.Count; i++)
                    {
                        state = (CheckState)node.ParentNode.Nodes[i].CheckState;
                        if (!check.Equals(state))
                        {
                            b = !b;
                            break;
                        }
                    }

                    node.ParentNode.CheckState = b ? CheckState.Indeterminate : check;
                    SetCheckedParentNodes(node.ParentNode, check);
                }
            }
            catch (System.Exception ex)
            {
                Log4Allen.WriteLog(typeof(LayersControl), ex);
            }
        }
Beispiel #4
0
        // 加载陪参数
        private void LoadParamFromConfig()
        {
            try
            {
                string ip   = "";
                string port = "";

                string      xmlConfig = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\GlobeConfig.xml");
                XmlDocument doc       = new XmlDocument();
                doc.Load(xmlConfig);

                XmlNode node;
                node = doc.SelectSingleNode("Globe/Config/TCPServer");

                ip   = node.Attributes["Ip"].InnerXml;
                port = node.Attributes["Port"].InnerXml;

                txtIp.Text   = ip;
                txtPort.Text = port;
            }
            catch (Exception ex)
            {
                Log4Allen.WriteLog(typeof(frmSet), ex.Message);
            }
        }
Beispiel #5
0
        // 读取配置
        private void ReadConfig()
        {
            try
            {
                string      xmlConfig = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\GlobeConfig.xml");
                XmlDocument doc       = new XmlDocument();
                doc.Load(xmlConfig);

                XmlNode node;
                node           = doc.SelectSingleNode("Globe/Config/PlaneModelScale");
                planeScale     = Convert.ToInt32(node.InnerXml);
                node           = doc.SelectSingleNode("Globe/Config/SallteModelScale");
                satelliteScale = Convert.ToInt32(node.InnerXml);
                node           = doc.SelectSingleNode("Globe/Config/BeamAlpha");
                beamAlpha      = Convert.ToInt32(node.InnerXml);
                node           = doc.SelectSingleNode("Globe/Config/StepValue");
                stepValue      = Convert.ToInt32(node.InnerXml);
                node           = doc.SelectSingleNode("Globe/Config/BeamRadius");
                beamRadius     = Convert.ToSingle(node.InnerXml);
            }
            catch (Exception ex)
            {
                Log4Allen.WriteLog(typeof(ArcGlobeBusiness), ex.Message);
            }
        }
Beispiel #6
0
        // 从服务器加载地图
        public void LoadTitleFromServer()
        {
            try
            {
                LoadLyrFile();

                globeBusiness.AddLayerInit();

                List <TileServer> imgServers = GetServerPath();
                if (imgServers == null || imgServers.Count <= 0)
                {
                    return;
                }

                foreach (var server in imgServers)
                {
                    IImageServerLayer layer = new ImageServerLayerClass();
                    layer.SpatialReference = new SpatialReferenceEnvironmentClass().CreateProjectedCoordinateSystem(3857);
                    //layer.SpatialReference = new SpatialReferenceEnvironmentClass().CreateProjectedCoordinateSystem((int)esriSRProjCS3Type.esriSRProjCS_WGS1984WebMercatorMajorAuxSphere);

                    layer.Initialize(server.Url);
                    IRaster      raster       = layer.Raster;
                    IRasterLayer pRasterLayer = new RasterLayerClass();
                    pRasterLayer.Name = server.Name;
                    pRasterLayer.CreateFromRaster(raster);

                    axGlobeControl1.Globe.AddLayerType(pRasterLayer, esriGlobeLayerType.esriGlobeLayerTypeDraped);
                }
            }
            catch (Exception ex)
            {
                Log4Allen.WriteLog(typeof(AxGlobeControlEx), ex.Message);
            }
        }
Beispiel #7
0
        // 添加卫星模型图元
        private bool AddModel2Earth(Model3D model)
        {
            var layer = mapLogic.AddLayer(model.LayerName);

            if (layer == null)
            {
                Log4Allen.WriteLog(typeof(ArcGlobeBusiness), "创建卫星模型失败:添加图层失败。");
                return(false);
            }

            Kml kml = new Kml();

            kml.Placemark.Name = model.ModelName;
            KmlModel3d modelKml = new KmlModel3d();

            modelKml.ModelFilePath = model.ModelPath;
            modelKml.Description   = model.ModelName;
            modelKml.Position      = model.Coordinate;
            modelKml.Scale         = model.Scale;
            modelKml.Azimuth       = model.Azimuth;
            kml.Placemark.Graph    = modelKml;

            MapFrame.Core.Interface.IMFElement element = null;
            var ret = layer.AddElement(kml, out element);

            if (ret)
            {
                EventPublisher.PublishElementAddEvent(this, new ElementAddEventArgs(model.LayerName, model.ModelName));
            }

            return(ret);
        }
Beispiel #8
0
        // 确定
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                string ip   = txtIp.Text.Trim();
                string port = txtPort.Text.Trim();

                string      xmlConfig = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\GlobeConfig.xml");
                XmlDocument doc       = new XmlDocument();
                doc.Load(xmlConfig);

                XmlNode node;
                node = doc.SelectSingleNode("Globe/Config/TCPServer");
                node.Attributes["Ip"].InnerXml   = ip;
                node.Attributes["Port"].InnerXml = port;

                doc.Save(xmlConfig);

                XtraMessageBox.Show("参数保存成功,重启后生效。");
            }
            catch (Exception ex)
            {
                Log4Allen.WriteLog(typeof(frmSet), ex.Message);
            }

            this.DialogResult = DialogResult.OK;
        }
Beispiel #9
0
        // 显示、隐藏设备
        private void repositoryItemComboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                ComboBoxEdit cmb = sender as ComboBoxEdit;
                if (cmb == null)
                {
                    return;
                }
                DataRow row = gridView1.GetFocusedDataRow();
                if (row == null)
                {
                    return;
                }

                string name    = row["DeviceNumber"].ToString();
                bool   visible = cmb.SelectedIndex == 0 ? true : false;
                globeBusiness.SetDeviceVisible(name, visible);
                mapBusiness.SetDeviceVisible(name, visible);
            }
            catch (Exception ex)
            {
                Log4Allen.WriteLog(typeof(DeviceDataList), ex.Message);
            }
        }
Beispiel #10
0
        private void 查看统计分析ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (gvPointList.FocusedRowHandle >= 0)
                {
                    DataRow row = gvAreaList.GetFocusedDataRow();
                    if (row == null)
                    {
                        return;
                    }

                    string name = row["areaName"].ToString();

                    WarnArea area = wanrMgr.GetAreaByName(name);
                    if (area == null)
                    {
                        return;
                    }

                    frmWarnStat f = new frmWarnStat(area);
                    {
                        f.TopMost = true;
                        f.Show();
                    }
                }
            }
            catch (Exception ex)
            {
                Log4Allen.WriteLog(typeof(frmAreaManager), ex.Message);
            }
        }
Beispiel #11
0
        private void 闪烁ToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            RealData data = gvRealData.GetFocusedRow() as RealData;

            if (data == null)
            {
                return;
            }

            try
            {
                var element = globeBusiness.mapLogic.GetElement(data.TargetNum.ToString());
                if (element == null)
                {
                    return;
                }
                I3DModel model = element as I3DModel;
                if (model == null)
                {
                    return;
                }

                bool flash = !model.IsFlash;
                model.Flash(flash, 500);
            }
            catch (Exception ex)
            {
                Log4Allen.WriteLog(typeof(RealDataListControl), ex.Message);
            }
        }
Beispiel #12
0
        // 加载陪参数
        private void LoadParamFromConfig()
        {
            try
            {
                string pointCount  = "";
                string planeScale  = "";
                string sallteScale = "";

                string      xmlConfig = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\GlobeConfig.xml");
                XmlDocument doc       = new XmlDocument();
                doc.Load(xmlConfig);

                XmlNode node;
                node        = doc.SelectSingleNode("Globe/Config/TrackPointLimit");
                pointCount  = node.InnerXml;
                node        = doc.SelectSingleNode("Globe/Config/PlaneModelScale");
                planeScale  = node.InnerXml;
                node        = doc.SelectSingleNode("Globe/Config/SallteModelScale");
                sallteScale = node.InnerXml;

                txtPointCount.Text         = pointCount;
                txtSallteModelScaleEx.Text = sallteScale;
                txtPlaneModelScale.Text    = planeScale;
            }
            catch (Exception ex)
            {
                Log4Allen.WriteLog(typeof(frmSet), ex.Message);
            }
        }
Beispiel #13
0
        /// <summary>
        /// 保存信息
        /// </summary>
        private void SaveSetInfo()
        {
            Utils.bStartWarn  = cbRecvData.Checked;
            Utils.bStartSound = cbSound.Checked;
            Utils.bStartTip   = cbTip.Checked;

            return;  // 暂时不保存到本地配置文件

            string      xmlConfig = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\GlobeConfig.xml");
            XmlDocument doc       = new XmlDocument();

            try
            {
                doc.Load(xmlConfig);
                XmlNode node;
                node          = doc.SelectSingleNode("Globe/Config/StartWarn");
                node.InnerXml = Utils.bStartWarn == true ? "true" : "false";
                node          = doc.SelectSingleNode("Globe/Config/StartSound");
                node.InnerXml = Utils.bStartSound == true ? "true" : "false";
                node          = doc.SelectSingleNode("Globe/Config/StartTip");
                node.InnerXml = Utils.bStartTip == true ? "true" : "false";

                doc.Save(xmlConfig);
            }
            catch (Exception ex)
            {
                Log4Allen.WriteLog(typeof(frmWarnSet), ex.Message);
                throw;
            }
        }
Beispiel #14
0
        /// <summary>
        /// 加载皮肤与图标
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmMain_Load(object sender, EventArgs e)
        {
            SkinHelper.InitSkinGallery(rgbiSkins);
            ribbonControl1.Toolbar.ItemLinks.Add(rgbiSkins);

            Log4Allen.InitLog();     // 初始化日志
            //Thread.Sleep(1000);
            defaultLookAndFeel1.LookAndFeel.SkinName = AppConfigFacade.DefaultTheme;
            this.Icon = notifyIcon.Icon = global::GlobleSituation.Properties.Resources.App;
        }
Beispiel #15
0
 // 断开之后重连
 public void OnDisconnected(IClientNetConnection connection)
 {
     try
     {
         client.Stop();
         client.Start();
     }
     catch (Exception ex)
     {
         Log4Allen.WriteLog(typeof(GXStroreClient), ex.Message);
     }
 }
Beispiel #16
0
 // 清除设备
 private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     try
     {
         globeBusiness.ClearDevice();
         mapBusiness.ClearDevice();
     }
     catch (Exception ex)
     {
         Log4Allen.WriteLog(typeof(DeviceDataList), ex.Message);
     }
 }
Beispiel #17
0
 /// <summary>
 /// 添加模型
 /// </summary>
 /// <param name="model">模型对象</param>
 public bool AddModel(Plane model)
 {
     try
     {
         models.Add(model);
         return(true);
     }
     catch (Exception ex)
     {
         Log4Allen.WriteLog(typeof(ModelManager), ex.Message);
         return(false);
     }
 }
Beispiel #18
0
 /// <summary>
 /// 清除数据
 /// </summary>
 public void ClearData()
 {
     try
     {
         tracks.Clear();
         modelDic.Clear();
         drawPointDic.Clear();
     }
     catch (Exception ex)
     {
         Log4Allen.WriteLog(typeof(TrackLineManager), ex.Message);
     }
 }
Beispiel #19
0
 /// <summary>
 /// 停止
 /// </summary>
 public void Stop()
 {
     try
     {
         if (readDataThd.ThreadState == (ThreadState.Background))
         {
             readDataThd.Suspend();
         }
     }
     catch (Exception ex)
     {
         Log4Allen.WriteLog(typeof(ReadBeamData), ex.Message);
     }
 }
Beispiel #20
0
        /// <summary>
        /// 删除所选目标
        /// </summary>
        private void DeleteFocusedItem()
        {
            if (DevExpress.XtraEditors.XtraMessageBox.Show("是否从列表删除所选实时数据?", "删除提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                if (gvRealData.FocusedRowHandle < 0)
                {
                    DevExpress.XtraEditors.XtraMessageBox.Show("您还未选中任何数据!", "删除提示", MessageBoxButtons.OK);
                }
                else
                {
                    try
                    {
                        dataLst.RemoveAt(gvRealData.FocusedRowHandle);

                        //TODO:删除地图数据
                        RealData data = gvRealData.GetFocusedRow() as RealData;
                        if (data == null)
                        {
                            return;
                        }

                        string elementName = data.TargetNum.ToString();
                        string lineName    = elementName + "line";

                        var layer = globeBusiness.mapLogic.GetLayer(layerName);
                        if (layer == null)
                        {
                            return;
                        }

                        layer.RemoveElement(elementName);
                        layer.RemoveElement(lineName);

                        var layerMap = mapBusiness.mapLogic.GetLayer(layerName);
                        if (layerMap != null)
                        {
                            layerMap.RemoveElement(elementName);
                            layerMap.RemoveElement(lineName);
                        }

                        gcRealData.RefreshDataSource();
                    }
                    catch (Exception ex)
                    {
                        Log4Allen.WriteLog(typeof(RealDataListControl), ex.Message);
                    }
                }
            }
        }
Beispiel #21
0
 private void InitEnvironment()
 {
     try
     {
         string path = AppDomain.CurrentDomain.BaseDirectory + "Config\\Bookmark.xml";
         if (File.Exists(path))
         {
             File.Delete(path);
         }
     }
     catch (Exception ex)
     {
         Log4Allen.WriteLog(typeof(MainControl), ex.Message);
     }
 }
Beispiel #22
0
 // 删除目标
 private void  除ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (prevPicture != null)
         {
             mapBusiness.DeletePlane(prevPicture.BelongLayer.LayerName, prevPicture.ElementName);
             prevPicture = null;
         }
     }
     catch (Exception ex)
     {
         Log4Allen.WriteLog(typeof(GMapControlEx), ex.Message);
     }
 }
Beispiel #23
0
        /// <summary>
        /// 清理态势数据
        /// </summary>
        public void ClearRealData()
        {
            try
            {
                for (int i = 0; i < 4; i++)
                {
                    mapLogic.RemoveLayer(GetModelLayerName((byte)i));
                }

                tsModelMgr.ClearData();
                trackMgr.ClearData();
            }
            catch (Exception ex)
            {
                Log4Allen.WriteLog(typeof(ArcGlobeBusiness), ex.Message);
            }
        }
Beispiel #24
0
        // 读取配置
        private void ReadConfig()
        {
            try
            {
                string      xmlConfig = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\GlobeConfig.xml");
                XmlDocument doc       = new XmlDocument();
                doc.Load(xmlConfig);

                XmlNode node;
                node = doc.SelectSingleNode("Globe/Config/TrackPointLimit");
                Utils.TrackPointNum = Convert.ToInt32(node.InnerXml);
            }
            catch (Exception ex)
            {
                Log4Allen.WriteLog(typeof(ArcGlobeBusiness), ex.Message);
            }
        }
Beispiel #25
0
        // 跳转到三维地球
        private void 暂停全部目标预警效果ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                DataRow row = gvWarnInfo.GetFocusedDataRow();
                if (row == null)
                {
                    return;
                }

                string name = row["TargetNumCol"].ToString();
                byte   type = Convert.ToByte(row["TargetType"]);
                globeBusiness.JumpToPlane(type, name);
            }
            catch (Exception ex)
            {
                Log4Allen.WriteLog(typeof(frmWarnInfo), ex.Message);
            }
        }
Beispiel #26
0
        /// <summary>
        /// 删除所有目标
        /// </summary>
        private void ClearListDelegate()
        {
            try
            {
                if (dataLst != null)
                {
                    dataLst.Clear();
                    gcRealData.RefreshDataSource();
                    //TODO:清空

                    globeBusiness.ClearRealData();
                    mapBusiness.ClearRealData();
                }
            }
            catch (Exception ex)
            {
                Log4Allen.WriteLog(typeof(RealDataListControl), ex.Message);
            }
        }
Beispiel #27
0
 /// <summary>
 /// 定位
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BtnPosition_Click(object sender, EventArgs e)
 {
     try
     {
         ISceneViewer m_ActiveView = globe.GlobeDisplay.ActiveViewer;
         IEnvelope    enve         = new EnvelopeClass();
         double       newLng       = Convert.ToDouble(countLong);
         double       newLat       = Convert.ToDouble(countLat);
         enve.PutCoords(newLng, newLat, newLng + 2, newLat + 2);
         enve.ZMin = 0;
         enve.ZMax = 0;
         globe.GlobeCamera.SetToZoomToExtents(enve, globe.Globe, m_ActiveView);
         m_ActiveView.Redraw(false);
     }
     catch (Exception ex)
     {
         Log4Allen.WriteLog(typeof(frmLngLatCalculate), ex.Message);
     }
 }
Beispiel #28
0
        /// <summary>
        /// 添加航迹点
        /// </summary>
        /// <param name="modelName"></param>
        /// <param name="point"></param>
        public void AddTrackPoint(string modelName, byte type, MapLngLat point)
        {
            try
            {
                if (modelDic.ContainsKey(modelName))
                {
                    TrackPoint tp = new TrackPoint();
                    tp.Index     = index;
                    tp.PointName = modelName + "point_" + index;
                    tp.Position  = point;

                    modelDic[modelName].Points.Add(tp);

                    if (modelDic[modelName].Points.Count > Utils.TrackPointNum)
                    {
                        modelDic[modelName].Points.RemoveAt(0);
                    }
                }
                else
                {
                    TrackPoint tp = new TrackPoint();
                    tp.Index     = index;
                    tp.PointName = modelName + "point_" + index;
                    tp.Position  = point;

                    TrackLine line = new TrackLine();
                    line.LineName  = modelName + "line";
                    line.ModelName = modelName;
                    line.Points    = new List <TrackPoint>();
                    line.Points.Add(tp);
                    line.TargetType = type;

                    modelDic.Add(modelName, line);
                }

                index++;
            }
            catch (Exception ex)
            {
                Log4Allen.WriteLog(typeof(TrackLineManager), ex.Message);
            }
        }
Beispiel #29
0
        /// <summary>
        /// 设置所有子节点的选中状态
        /// </summary>
        /// <param name="node">当前节点</param>
        /// <param name="check">选中状态</param>
        private void SetCheckedChildNodes(TreeListNode node, CheckState check)
        {
            try
            {
                //显示、隐藏元素
                if (node.HasChildren)
                {
                    for (int i = 0; i < node.Nodes.Count; i++)
                    {
                        if (node.Nodes[i].CheckState != check)
                        {
                            node.Nodes[i].CheckState = check;
                            SetCheckedChildNodes(node.Nodes[i], check);
                        }
                    }
                }
                else
                {
                    if (node.Tag != null)
                    {
                        string nodeName = node.Tag.ToString();

                        if (beamDic.ContainsKey(nodeName))
                        {
                            foreach (string em in beamDic[nodeName])
                            {
                                ShowElement(em, node.CheckState, false);
                            }
                        }
                        else
                        {
                            ShowElement(nodeName, node.CheckState, true);
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                Log4Allen.WriteLog(typeof(LayersControl), ex);
            }
        }
Beispiel #30
0
        // 初始化客户端
        private void InitTCPClient()
        {
            try
            {
                string      xmlConfig = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\GlobeConfig.xml");
                XmlDocument doc       = new XmlDocument();
                doc.Load(xmlConfig);

                XmlNode node;
                node = doc.SelectSingleNode("Globe/Config/StroreInfo");
                string ip   = node.Attributes["Ip"].InnerXml;
                int    port = Convert.ToInt32(node.Attributes["Port"].InnerXml);

                client = new TCPClient(ip, port, this);
                client.Start();
            }
            catch (Exception ex)
            {
                Log4Allen.WriteLog(typeof(GXStroreClient), ex.Message);
            }
        }