예제 #1
0
        void mapControlEvents_OnMouseUp(int button, int shift, int X, int Y, double mapX, double mapY)
        {
            if (this.axMapControl.Map.LayerCount > 0)
            {
                Map2DView view = UCService.GetContent(typeof(Map2DView)) as Map2DView;
                if (view == null)
                {
                    return;
                }

                IPoint ptNew = new PointClass();
                if (bPtInEnvelope)
                {
                    interEnvelope.PutCoords(interEnvelope.XMin + (mapX - ptInEnvelope.X), interEnvelope.YMin + (mapY - ptInEnvelope.Y),
                                            interEnvelope.XMax + (mapX - ptInEnvelope.X), interEnvelope.YMax + (mapY - ptInEnvelope.Y));
                    ptNew.PutCoords((interEnvelope.XMax + interEnvelope.XMin) / 2, (interEnvelope.YMax + interEnvelope.YMin) / 2);
                    ptInEnvelope.PutCoords(mapX, mapY);
                }
                else
                {
                    ptNew.PutCoords(mapX, mapY);
                }
                view.MapControl.CenterAt(ptNew);
                view.MapControl.ActiveView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGeography, null, null);
            }
        }
예제 #2
0
        public override void Init(object sender)
        {
            BarEditItem item = sender as BarEditItem;

            if (item.Edit is RepositoryItemComboBox)
            {
                RepositoryItemComboBox ricb = item.Edit as RepositoryItemComboBox;
                string[] scale = new string[] { "1:500", "1:1000", "1:2000", "1:5000", "1:10000", "1:20000" };
                ricb.Items.AddRange(scale);
                item.EditValue = ricb.Items[0];
            }

            Map2DView mapView = (Map2DView)UCService.GetContent(typeof(Map2DView));

            mapView.Bind(this);
        }
예제 #3
0
        public override void Run(object sender, System.EventArgs e)
        {
            Map2DView mapView = (Map2DView)UCService.GetContent(typeof(Map2DView));
            bool      bBind   = mapView.Bind(this);

            if (!bBind)
            {
                return;
            }

            DF2DApplication app = (DF2DApplication)this.Hook;

            if (app == null || app.Current2DMapControl == null)
            {
                return;
            }
            try
            {
                Layer2DTreePad wsPad = (Layer2DTreePad)UCService.GetContent(typeof(Layer2DTreePad));
                EagleEyePad    epad  = UCService.GetContent(typeof(EagleEyePad)) as EagleEyePad;
                if (wsPad == null || epad == null)
                {
                    return;
                }
                app.Workbench.SetStatusInfo("二维数据加载中…");
                SplashScreenManager.Default.SendCommand(null, "开始加载二维数据......");

                if (wsPad != null && epad != null)
                {
                    DataUtils2D.AddAndVisualizeTreelistPipe(wsPad.TreeList, app.Current2DMapControl);       //加载管线图层
                    DataUtils2D.AddAndVisualizeTreelistBackground(wsPad.TreeList, app.Current2DMapControl); //加载背景图及辅助图层,为鹰眼加载影像图
                    DataUtils2D.AddAndVisualizeEgleEyeControlBackground(epad.MapControl);
                }
                app.Workbench.SetStatusInfo("就绪");
                LoggingService.Info("二维数据加载成功!");
            }
            catch (Exception ex)
            {
                app.Workbench.SetStatusInfo("二维数据加载错误");
                LoggingService.Error(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
예제 #4
0
 private void mapControlEvents_OnMouseDown(int button, int shift, int X, int Y, double mapX, double mapY)
 {
     if (this.axMapControl.Map.LayerCount > 0)
     {
         if (button == 1)
         {
             if (interEnvelope == null)
             {
                 Map2DView view = UCService.GetContent(typeof(Map2DView)) as Map2DView;
                 if (view == null)
                 {
                     return;
                 }
                 interEnvelope = view.MapControl.Extent;
             }
             if (interEnvelope == null)
             {
                 return;
             }
             IPoint pt = new PointClass();
             pt.PutCoords(mapX, mapY);
             IRelationalOperator relOper = interEnvelope as IRelationalOperator;
             bPtInEnvelope = relOper.Contains(pt);
             if (bPtInEnvelope)
             {
                 ptInEnvelope = pt;
             }
             else
             {
                 interEnvelope.PutCoords(mapX - interEnvelope.Width / 2, mapY - interEnvelope.Height / 2, mapX + interEnvelope.Width / 2, mapY + interEnvelope.Height / 2);
             }
             DrawEnvelope(interEnvelope);
         }
         else if (button == 2)
         {
             //interEnvelope = this.axMapControl.TrackRectangle();
             //view.MapControl.Extent = interEnvelope;
         }
     }
 }