internal override void OnFlashPointCommand(object obj) { if ((ArcMap.Document == null) || (ArcMap.Document.ActiveView == null) || (ArcMap.Document.FocusMap == null)) { return; } ProcessInput(InputCoordinate); Mediator.NotifyColleagues(CoordinateConversionLibrary.Constants.RequestOutputUpdate, null); IGeometry address = obj as IGeometry; if (address == null && amCoordGetter != null && amCoordGetter.Point != null) { address = amCoordGetter.Point; AddCollectionPoint(amCoordGetter.Point); } if (address != null) { IActiveView activeView = ArcMap.Document.ActiveView; IMap map = ArcMap.Document.FocusMap; IEnvelope envelope = activeView.Extent; IScreenDisplay screenDisplay = activeView.ScreenDisplay; short screenCache = Convert.ToInt16(esriScreenCache.esriNoScreenCache); ISpatialReference outgoingCoordSystem = map.SpatialReference; address.Project(outgoingCoordSystem); // is point within current extent // if so, pan to point var relationOp = envelope as IRelationalOperator; if (relationOp != null && activeView is IMap) { if (!relationOp.Contains(address)) { // pan to envelope.CenterAt(address as IPoint); activeView.Extent = envelope; activeView.Refresh(); } } IRgbColor color = new RgbColorClass(); color.Green = 80; color.Red = 22; color.Blue = 68; ISimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(); simpleMarkerSymbol.Color = color; simpleMarkerSymbol.Size = 15; simpleMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSDiamond; IMarkerElement markerElement = new MarkerElementClass(); markerElement.Symbol = simpleMarkerSymbol; IPolygon poly = null; if (InputCoordinateType == CoordinateType.MGRS || InputCoordinateType == CoordinateType.USNG) { poly = GetMGRSPolygon(address as IPoint); } if (poly != null) { address = poly; } ArcMapHelpers.FlashGeometry(address, color, activeView.ScreenDisplay, 500, activeView.Extent); } }
internal virtual void OnFlashPointCommand(object obj) { ProcessInput(InputCoordinate); Mediator.NotifyColleagues(CoordinateConversionLibrary.Constants.RequestOutputUpdate, null); IGeometry address = obj as IGeometry; if (address == null && amCoordGetter != null && amCoordGetter.Point != null) { address = amCoordGetter.Point; } if (address != null) { // Map und View IMxDocument mxdoc = ArcMap.Application.Document as IMxDocument; IActiveView activeView = mxdoc.ActivatedView; IMap map = mxdoc.FocusMap; IEnvelope envelope = activeView.Extent; //ClearGraphicsContainer(map); IScreenDisplay screenDisplay = activeView.ScreenDisplay; short screenCache = Convert.ToInt16(esriScreenCache.esriNoScreenCache); ISpatialReference outgoingCoordSystem = map.SpatialReference; address.Project(outgoingCoordSystem); // is point within current extent // if so, pan to point var relationOp = envelope as IRelationalOperator; if (relationOp != null && activeView is IMap) { if (!relationOp.Contains(address)) { // pan to envelope.CenterAt(address as IPoint); activeView.Extent = envelope; activeView.Refresh(); } } IRgbColor color = new RgbColorClass(); color.Green = 80; color.Red = 22; color.Blue = 68; ISimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(); simpleMarkerSymbol.Color = color; simpleMarkerSymbol.Size = 15; simpleMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSDiamond; IElement element = null; IMarkerElement markerElement = new MarkerElementClass(); markerElement.Symbol = simpleMarkerSymbol; element = markerElement as IElement; IPolygon poly = null; if (InputCoordinateType == CoordinateType.MGRS || InputCoordinateType == CoordinateType.USNG) { poly = GetMGRSPolygon(address as IPoint); } if (poly != null) { address = poly; } var av = mxdoc.FocusMap as IActiveView; ArcMapHelpers.FlashGeometry(address, color, av.ScreenDisplay, 500, av.Extent); //AddElement(map, address); // do not center if in layout view //if (mxdoc.ActiveView is IMap) //{ // if (poly != null && !poly.IsEmpty && (poly as IArea) != null) // envelope.CenterAt((poly as IArea).Centroid); // else // envelope.CenterAt(amCoordGetter.Point); // activeView.Extent = envelope; // activeView.Refresh(); //} } }