示例#1
0
        /// <summary>
        /// This function will flash the geometry on the map as an indicator of its location
        /// </summary>
        /// <param name="activeView">the map's active view</param>
        /// <param name="geom">the IGeometry object to flash</param>
        /// <param name="size">the size to make the flashing object</param>
        /// <param name="interval">how long to keep the flash object visible</param>
        /// <param name="numFlash">the number of times to flash</param>
        public static void FlashGeometry(IActiveView activeView, IGeometry geom, double size, short interval, short numFlash)
        {
            if (activeView != null)
            {
                // this will refresh the display, so that the zoom happens before the flash
                activeView.ScreenDisplay.UpdateWindow();

                IColor pColor = new RgbColorClass();
                pColor.RGB = 255;
                IMMMapUtilities pMapUtils = new mmMapUtilsClass();
                pMapUtils.FlashGeometry(geom, activeView.ScreenDisplay, pColor, size, interval, numFlash);
            }
        }
示例#2
0
        public bool ARCFM_ZOOMTO(string sScale, string sX, string sY)
        {
            IPoint pPoint;
            double dScale;
            IMxDocument pMXDoc;
            Miner.Interop.IMMMapUtilities pMMMapUtils;
            ESRI.ArcGIS.Framework.IAppROT pAppRot = new ESRI.ArcGIS.Framework.AppROT();
            ESRI.ArcGIS.Framework.IApplication pApp;

            //Set pExt = pApp.FindExtensionByName("MMSessionManager")
            try
            {
                pMMMapUtils = new mmMapUtilsClass();
                Type t = Type.GetTypeFromProgID("esriFramework.AppRef");
                System.Object obj = Activator.CreateInstance(t);
                pApp = obj as IApplication;
                pMXDoc = (IMxDocument)pApp.Document;
                // Convert X,Y to point
                pPoint = new Point();
                pPoint.SpatialReference = pMXDoc.FocusMap.SpatialReference;

                pPoint.X = System.Convert.ToDouble(sX);
                pPoint.Y = System.Convert.ToDouble(sY);
                dScale = 1.0 / System.Convert.ToDouble(sScale);
                // Convert Scale to double
                Logger.WriteLine("Scale:" + dScale.ToString() + " X:" + pPoint.X.ToString() + " Y:" + pPoint.Y.ToString());
                SW1.Reset();
                SW1.Start();
                pMMMapUtils.ZoomTo(pPoint, pMXDoc.ActiveView, dScale);
                pMXDoc.ActiveView.Refresh();
                SW1.Stop();
                RecordActionTime("ARCFM_ZOOMTO:" ,SW1.ElapsedMilliseconds);
                return true;
            }
            catch (Exception EX)
            {
                this.Logger.WriteLine("ArcFM_ZoomTo" + EX.Message + " " + EX.StackTrace);

                return false;
            }
        }