Esempio n. 1
0
 public override void OnClick()
 {
     if (this._context.FocusMap.MapUnits == esriUnits.esriUnknownUnits)
     {
         System.Windows.Forms.MessageBox.Show("请设置地图单位后,再执行该命令!");
     }
     else
     {
         frmMapTemplateApplyWizard frmMapTemplateApplyWizard = new frmMapTemplateApplyWizard(_plugin.TemplateGallery);
         frmMapTemplateApplyWizard.FixDataRange = true;
         if (frmMapTemplateApplyWizard.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             _context.MainView.ActivatePageLayout();
             if (this._context.ActiveView != null)
             {
                 this.ClearElements(this._context.ActiveView as IActiveView);
                 frmMapTemplateApplyWizard.MapTemplateHelp.ApplyMapTemplate(
                     this._context.ActiveView as IPageLayout);
             }
         }
     }
 }
Esempio n. 2
0
 public override void OnMouseDown(int button, int shift, int x, int y)
 {
     if (this._context.FocusMap.MapUnits == esriUnits.esriUnknownUnits)
     {
         System.Windows.Forms.MessageBox.Show("请设置地图单位后,再执行该命令!");
     }
     else
     {
         IPoint point = (this._context.FocusMap as IActiveView).ScreenDisplay.DisplayTransformation.ToMapPoint(
             x, y);
         double X;
         double Y;
         if (this._context.FocusMap.MapUnits == esriUnits.esriKilometers)
         {
             X = point.X * 1000.0;
             Y = point.Y * 1000.0;
         }
         else
         {
             X = point.X;
             Y = point.Y;
         }
         frmMapTemplateApplyWizard frmMapTemplateApplyWizard = new frmMapTemplateApplyWizard();
         frmMapTemplateApplyWizard.SetMouseClick(X, Y);
         if (frmMapTemplateApplyWizard.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             _context.MainView.ActivatePageLayout();
             if (this._context.ActiveView != null)
             {
                 this.ClearElements(this._context.ActiveView as IActiveView);
                 frmMapTemplateApplyWizard.MapTemplateHelp.ApplyMapTemplate(
                     this._context.ActiveView as IPageLayout);
             }
         }
     }
 }