public bool AddMapFrame() { IActiveView arg_0B_0 = this._context.ActiveView; IGraphicsContainer graphicsContainer = this._context.ActiveView as IGraphicsContainer; bool result; if (graphicsContainer == null) { result = false; } else { IMapFrame mapFrame = new MapFrame() as IMapFrame; IMap map = new Map(); this.button++; map.Name = string.Format("新建地图 {0}", this.button); mapFrame.Map = map; IElement element = mapFrame as IElement; IEnvelope envelope = new Envelope() as IEnvelope; envelope.PutCoords(0.0, 0.0, 5.0, 5.0); element.Geometry = envelope; INewElementOperation operation = new NewElementOperation { ActiveView = this._context.ActiveView, Element = element }; this._context.OperationStack.Do(operation); result = true; } return(result); }
public override void OnClick() { LegendWizard legendWizard = new LegendWizard(); legendWizard.StyleGallery = this._context.StyleGallery; IGraphicsContainer graphicsContainer = this._context.ActiveView as IGraphicsContainer; IMapFrame mapFrame = graphicsContainer.FindFrame(this._context.FocusMap) as IMapFrame; IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(new UID { Value = "esriCarto.Legend" }, null); legendWizard.InitialLegendFrame = mapSurroundFrame; legendWizard.FocusMap = this._context.FocusMap; legendWizard.ShowDialog(); IEnvelope envelope = new Envelope() as IEnvelope; envelope.PutCoords(0.0, 0.0, 5.0, 10.0); IEnvelope envelope2 = new Envelope() as IEnvelope; mapSurroundFrame.MapSurround.QueryBounds(this._context.ActiveView.ScreenDisplay, envelope, envelope2); (mapSurroundFrame as IElement).Geometry = envelope2; INewElementOperation newElementOperation = new NewElementOperation(); newElementOperation.ActiveView = this._context.ActiveView; newElementOperation.Element = (mapSurroundFrame as IElement); this._context.OperationStack.Do(newElementOperation); }
public override void OnMouseUp(int button, int shift, int x, int y) { if (this.inewEnvelopeFeedback_0 != null) { IEnvelope geometry = this.inewEnvelopeFeedback_0.Stop(); this.inewEnvelopeFeedback_0 = null; IElement element = new RectangleElement { Geometry = geometry }; INewElementOperation operation = new NewElementOperation { ActiveView = this._context.ActiveView, Element = element, ContainHook = this.method_0() }; this._context.OperationStack.Do(operation); //if (this._context.Hook is IApplication) //{ // if ((this._context.Hook as IApplication).ContainerHook != null) // { // DocumentManager.DocumentChanged((this._context.Hook as IApplication).ContainerHook); // } // else // { // DocumentManager.DocumentChanged((this._context.Hook as IApplication).Hook); // } //} //else //{ // DocumentManager.DocumentChanged(this._context.Hook); //} } }
public override void OnMouseDown(int button, int shift, int x, int y) { IActiveView activeView = this._context.ActiveView; IPoint geometry = activeView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y); IElement element = new MarkerElement(); element.Geometry = geometry; ISimpleMarkerSymbol symbol = new SimpleMarkerSymbol(); (element as IMarkerElement).Symbol = symbol; INewElementOperation newElementOperation = new NewElementOperation(); newElementOperation.ActiveView = this._context.ActiveView; newElementOperation.ContainHook = this.GetActiveView(); newElementOperation.Element = element; this._context.OperationStack.Do(newElementOperation); //if (this._context.Hook is IApplication) //{ // if ((this._context.Hook as IApplication).ContainerHook != null) // { // DocumentManager.DocumentChanged((this._context.Hook as IApplication).ContainerHook); // } // else // { // DocumentManager.DocumentChanged((this._context.Hook as IApplication).Hook); // } //} //else //{ // DocumentManager.DocumentChanged(this._context.Hook); //} }
public override void OnClick() { int num = -1; if (this._context.MainView.ControlType == GISControlType.PageLayout) { num = (this._context.MainView.ActiveGISControl as IPageLayoutControl).hWnd; } else if (this._context.MainView.ControlType == GISControlType.MapControl) { num = (this._context.MainView.ActiveGISControl as IMapControl2).hWnd; } if (num != -1) { ArcGIS.Common.ExtendClass.IOleFrame oleFrame = new OleFrame(); if (oleFrame.CreateOleClientItem(this._context.ActiveView.ScreenDisplay, num)) { INewElementOperation operation = new NewElementOperation { ActiveView = this._context.ActiveView, Element = oleFrame as IElement }; this._context.OperationStack.Do(operation); } } }
public override void OnDblClick() { if (this.inewPolygonFeedback_0 != null) { IPolygon geometry = this.inewPolygonFeedback_0.Stop(); this.inewPolygonFeedback_0 = null; IElement element = new PolygonElement { Geometry = geometry }; INewElementOperation operation = new NewElementOperation { ActiveView = this._context.ActiveView, Element = element, ContainHook = this.method_0() }; this._context.OperationStack.Do(operation); //if (this._context.Hook is IApplication) //{ // if ((this._context.Hook as IApplication).ContainerHook != null) // { // DocumentManager.DocumentChanged((this._context.Hook as IApplication).ContainerHook); // } // else // { // DocumentManager.DocumentChanged((this._context.Hook as IApplication).Hook); // } //} //else //{ // DocumentManager.DocumentChanged(this._context.Hook); //} } }
public override void OnClick() { int num = -1; if (this._context.Hook is IPageLayoutControl) { num = (this._context.Hook as IPageLayoutControl).hWnd; } else if (this._context.Hook is IMapControl2) { num = (this._context.Hook as IMapControl2).hWnd; } else if (this._context.Hook is IApplication) { if ((this._context.Hook as IApplication).Hook is IPageLayoutControl) { num = ((this._context.Hook as IApplication).Hook as IPageLayoutControl).hWnd; } else if ((this._context.Hook as IApplication).Hook is IMapControl2) { num = ((this._context.Hook as IApplication).Hook as IMapControl2).hWnd; } } if (num != -1) { DataGraphicsElement element = new DataGraphicsElement(); INewElementOperation operation = new NewElementOperation { ActiveView = this._context.ActiveView, Element = element }; this._context.OperationStack.Do(operation); } }
public override void OnDblClick() { if (this.inewLineFeedback_0 != null) { IPolyline polyline = this.inewLineFeedback_0.Stop(); this.inewLineFeedback_0 = null; if (!polyline.IsEmpty) { IElement element = new LineElement(); element.Geometry = polyline; INewElementOperation newElementOperation = new NewElementOperation(); newElementOperation.ActiveView = this._context.ActiveView; newElementOperation.ContainHook = this.GetActiveView(); newElementOperation.Element = element; this._context.OperationStack.Do(newElementOperation); //if (this._context.Hook is IApplication) //{ // if ((this._context.Hook as IApplication).ContainerHook != null) // { // DocumentManager.DocumentChanged((this._context.Hook as IApplication).ContainerHook); // } // else // { // DocumentManager.DocumentChanged((this._context.Hook as IApplication).Hook); // } //} //else //{ // DocumentManager.DocumentChanged(this._context.Hook); //} } } }
private bool method_0() { IActiveView activeView = this._context.ActiveView; IGraphicsContainer graphicsContainer = activeView.GraphicsContainer; bool result; if (graphicsContainer == null) { return(false); } try { frmSymbolSelector frmSymbolSelector = new frmSymbolSelector(); if (frmSymbolSelector == null) { return(false); } INorthArrow northArrow = new MarkerNorthArrow(); frmSymbolSelector.SetSymbol(northArrow); frmSymbolSelector.SetStyleGallery(this._context.StyleGallery); if (frmSymbolSelector.ShowDialog() == System.Windows.Forms.DialogResult.OK) { northArrow = (frmSymbolSelector.GetSymbol() as INorthArrow); if (northArrow == null) { result = false; return(result); } northArrow.Refresh(); IEnvelope envelope = new Envelope() as IEnvelope; envelope.PutCoords(5.0, 10.0, 8.0, 13.0); IEnvelope envelope2 = new Envelope() as IEnvelope; northArrow.QueryBounds(this._context.ActiveView.ScreenDisplay, envelope, envelope2); UID clsid = new UID { Value = "esriCarto.MarkerNorthArrow" }; IMapFrame mapFrame = graphicsContainer.FindFrame(activeView.FocusMap) as IMapFrame; IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(clsid, northArrow); IElement element = mapSurroundFrame as IElement; element.Geometry = envelope2; INewElementOperation operation = new NewElementOperation { ActiveView = this._context.ActiveView, Element = element }; this._context.OperationStack.Do(operation); result = true; return(result); } } catch { } result = false; return(result); }
private bool method_0() { IActiveView activeView = this._context.ActiveView; IGraphicsContainer graphicsContainer = activeView.GraphicsContainer; bool result; if (graphicsContainer == null) { result = false; } else { try { frmSymbolSelector frmSymbolSelector = new frmSymbolSelector(); if (frmSymbolSelector == null) { result = false; return(result); } IScaleBar scaleBar = new HollowScaleBar(); frmSymbolSelector.SetSymbol(scaleBar); frmSymbolSelector.SetStyleGallery(this._context.StyleGallery); if (frmSymbolSelector.ShowDialog() == System.Windows.Forms.DialogResult.OK) { scaleBar = (frmSymbolSelector.GetSymbol() as IScaleBar); if (scaleBar == null) { result = false; return(result); } UID clsid = new UID { Value = "esriCarto.ScaleBar" }; IMapFrame mapFrame = graphicsContainer.FindFrame(activeView.FocusMap) as IMapFrame; scaleBar.Units = mapFrame.Map.DistanceUnits; IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(clsid, scaleBar); IElement element = mapSurroundFrame as IElement; IEnvelope envelope = new Envelope() as IEnvelope; envelope.PutCoords(2.0, 8.0, 9.0, 10.0); IEnvelope envelope2 = new Envelope() as IEnvelope; scaleBar.QueryBounds(this._context.ActiveView.ScreenDisplay, envelope, envelope2); element.Geometry = envelope2; INewElementOperation newElementOperation = new NewElementOperation(); newElementOperation.ActiveView = this._context.ActiveView; newElementOperation.Element = element; this._context.OperationStack.Do(newElementOperation); result = true; return(result); } } catch { } result = false; } return(result); }
public override void OnClick() { frmInputText frmInputText = new frmInputText(); if (frmInputText.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string text = frmInputText.txtText.Text; IElement element = new TextElement(); ITextElement textElement = element as ITextElement; ITextSymbol textSymbol = new TextSymbol(); textSymbol.Text = text; textSymbol.Size = 48.0; IActiveView activeView = this._context.ActiveView as IActiveView; activeView.ScreenDisplay.StartDrawing(0, 0); double num; double num2; textSymbol.GetTextSize(activeView.ScreenDisplay.WindowDC, activeView.ScreenDisplay.DisplayTransformation, text, out num, out num2); activeView.ScreenDisplay.FinishDrawing(); textSymbol.Text = text; num *= 0.0353; num2 *= 0.0353; IEnvelope extent = (this._context.ActiveView as IActiveView).Extent; double num3; double num4; double num5; double num6; extent.QueryCoords(out num3, out num4, out num5, out num6); num3 = (num3 + num5) / 2.0; num4 = num6 - 3.0; num5 = num3 + 1.2 * num; num6 = num4 + 1.2 * num2; num3 = (double)((int)num3); num4 = (double)((int)num4); num5 = (double)((int)num5); num6 = (double)((int)num6); extent.PutCoords(num3, num4, num5, num6); textElement.Symbol = textSymbol; textElement.Text = text; IPoint point = new ESRI.ArcGIS.Geometry.Point(); point.PutCoords(num3, num4); element.Geometry = point; IGraphicsContainer arg_181_0 = activeView.GraphicsContainer; (element as IElementProperties2).AutoTransform = true; INewElementOperation operation = new NewElementOperation { ActiveView = this._context.ActiveView, Element = element }; this._context.OperationStack.Do(operation); } }
public override void OnClick() { frmFractionTextElement frmFractionTextElement = new frmFractionTextElement(); if (frmFractionTextElement.ShowDialog() == System.Windows.Forms.DialogResult.OK) { IElement element = new FractionTextElement(); (element as IFractionTextElement).DenominatorText = frmFractionTextElement.txtDenominatorText.Text; (element as IFractionTextElement).NumeratorText = frmFractionTextElement.txtNumeratorText.Text; IActiveView activeView = this._context.ActiveView as IActiveView; activeView.ScreenDisplay.StartDrawing(0, 0); IPoint geometry = new Point { X = 3.0, Y = 3.0 }; IPolygon polygon = new Polygon() as IPolygon; ((element as IFractionTextElement).NumeratorTextSymbol as ISymbol).QueryBoundary( activeView.ScreenDisplay.hDC, activeView.ScreenDisplay.DisplayTransformation, geometry, polygon); double width = polygon.Envelope.Width; double height = polygon.Envelope.Height; ((element as IFractionTextElement).DenominatorTextSymbol as ISymbol).QueryBoundary( activeView.ScreenDisplay.hDC, activeView.ScreenDisplay.DisplayTransformation, geometry, polygon); double width2 = polygon.Envelope.Width; double height2 = polygon.Envelope.Height; double num = (width > width2) ? width : width2; double num2 = height + height2; activeView.ScreenDisplay.FinishDrawing(); IEnvelope extent = (this._context.ActiveView as IActiveView).Extent; double num3; double num4; double num5; double num6; extent.QueryCoords(out num3, out num4, out num5, out num6); num3 = (num3 + num5) / 2.0; num4 = (num4 + num6) / 2.0; num5 = num3 + 1.1 * num; num6 = num4 + 1.1 * num2; extent.PutCoords(num3, num4, num5, num6); IPoint point = new Point(); point.PutCoords(num3, num4); element.Geometry = extent; (element as IElementProperties2).AutoTransform = true; INewElementOperation operation = new NewElementOperation { ActiveView = this._context.ActiveView, Element = element }; this._context.OperationStack.Do(operation); } }
public override void OnMouseUp(int button, int shift, int x, int y) { if (this._circleFeedback != null) { try { ICircularArc circularArc = this._circleFeedback.Stop(); this._circleFeedback = null; IPolygon polygon = new Polygon() as IPolygon; object value = Missing.Value; (polygon as ISegmentCollection).AddSegment(circularArc as ISegment, ref value, ref value); IElement element = new CircleElement { Geometry = polygon }; INewElementOperation operation = new NewElementOperation { ActiveView = this._context.ActiveView, ContainHook = this.GetActiveView(), Element = element }; this._context.OperationStack.Do(operation); //if (this._context.Hook is IApplication) //{ // if ((this._context.Hook as IApplication).ContainerHook != null) // { // DocumentManager.DocumentChanged((this._context.Hook as IApplication).ContainerHook); // } // else // { // DocumentManager.DocumentChanged((this._context.Hook as IApplication).Hook); // } //} //else //{ // DocumentManager.DocumentChanged(this._context.Hook); //} } catch (Exception exception_) { //CErrorLog.writeErrorLog(this, exception_, ""); } } }
public override void OnDblClick() { if (this.curveFeedback == null) { return; } IPolyline polyline = this.curveFeedback.Stop(); this.curveFeedback = null; if (polyline.IsEmpty) { return; } IElement element = new LineElement { Geometry = polyline }; ISimpleLineSymbol symbol = new SimpleLineSymbol(); (element as ILineElement).Symbol = symbol; INewElementOperation operation = new NewElementOperation { ActiveView = this._context.ActiveView, Element = element, ContainHook = this.method_0() }; this._context.OperationStack.Do(operation); //if (this._context.Hook is IApplication) //{ // if ((this._context.Hook as IApplication).ContainerHook != null) // { // DocumentManager.DocumentChanged((this._context.Hook as IApplication).ContainerHook); // } // else // { // DocumentManager.DocumentChanged((this._context.Hook as IApplication).Hook); // } //} //else //{ // DocumentManager.DocumentChanged(this._context.Hook); //} }
public override void OnMouseUp(int button, int shift, int x, int y) { if (this.inewEnvelopeFeedback_0 != null) { IEnvelope boundingEnvelope = this.inewEnvelopeFeedback_0.Stop(); IEllipticArc ellipticArc = new EllipticArc(); (ellipticArc as IConstructEllipticArc).ConstructEnvelope(boundingEnvelope); this.inewEnvelopeFeedback_0 = null; IPolygon polygon = new Polygon() as IPolygon; object value = Missing.Value; (polygon as ISegmentCollection).AddSegment(ellipticArc as ISegment, ref value, ref value); IElement element = new EllipseElement { Geometry = polygon }; INewElementOperation operation = new NewElementOperation { ActiveView = this._context.ActiveView, Element = element, ContainHook = this.GetActiveView() }; this._context.OperationStack.Do(operation); //if (this._context.Hook is IApplication) //{ // if ((this._context.Hook as IApplication).ContainerHook != null) // { // DocumentManager.DocumentChanged((this._context.Hook as IApplication).ContainerHook); // } // else // { // DocumentManager.DocumentChanged((this._context.Hook as IApplication).Hook); // } //} //else //{ // DocumentManager.DocumentChanged(this._context.Hook); //} } }
public override void OnDblClick() { if (this._lineFeedback != null) { this._Point = null; IPolyline polyline = this._lineFeedback.Stop(); this._lineFeedback = null; if (!polyline.IsEmpty) { IElement lineElementClass = new LineElement() { Geometry = polyline }; (lineElementClass as ILineElement).Symbol = new SimpleLineSymbol(); NewElementOperation newElementOperation = new NewElementOperation() { ActiveView = this._context.ActiveView, ContainHook = this.GetActiveView(), Element = lineElementClass }; this._context.OperationStack.Do(newElementOperation); } } }
public override void OnClick() { System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog(); openFileDialog.Filter = "所有支持格式|*.bmp;*.jpg;*.gif;*.emf;*.tif;*.png|位图文件|*.bmp|JPEG|*.jpg|TIFF|*.tif|EMF|*.emf|PNG|*.png|GIF|*.gif"; if (openFileDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } string fileName = openFileDialog.FileName; string text = System.IO.Path.GetExtension(fileName).ToLower(); string text2 = text; IElement element; if (text2 != null) { if (text2 == ".bmp") { element = new BmpPictureElement(); } else if (text2 == ".jpg") { element = new JpgPictureElement(); } else if (text2 == ".gif") { element = new GifPictureElement(); } else if (text2 == ".tif") { element = new TifPictureElement(); } else if (text2 == ".emf") { element = new EmfPictureElement(); } else { element = new PngPictureElement(); } } else { element = new PngPictureElement(); } (element as IPictureElement).ImportPictureFromFile(fileName); (element as IPictureElement).MaintainAspectRatio = true; double num = 0.0; double num2 = 0.0; (element as IPictureElement2).QueryIntrinsicSize(ref num, ref num2); num *= 0.0353; num2 *= 0.0353; IGraphicsContainer arg_11B_0 = this._context.ActiveView as IGraphicsContainer; (element as IElementProperties2).AutoTransform = true; IEnvelope envelope = new Envelope() as IEnvelope; envelope.PutCoords(0.0, 0.0, num, num2); element.Geometry = envelope; INewElementOperation operation = new NewElementOperation { ActiveView = this._context.ActiveView, Element = element }; this._context.OperationStack.Do(operation); }