Пример #1
0
        /// <summary>
        /// Load the Application, D8TopLevel, and make a call to its own get text.
        /// </summary>
        /// <param name="eTextEvent"></param>
        /// <param name="pMapProdInfo"></param>
        /// <returns></returns>
        protected override string GetText(mmAutoTextEvents eTextEvent, IMMMapProductionInfo pMapProdInfo)
        {
            if (App == null)
            {
                App = DesignerUtility.GetApplication();
            }
            if (App == null)
            {
                ToolUtility.LogError(_ProgID + ": Could not load Application Extension");
                return(_defaultDisplay);
            }

            ID8TopLevel topLevel = App.FindExtensionByName("DesignerTopLevel") as ID8TopLevel;

            if (topLevel == null)
            {
                return(_defaultDisplay);
            }

            string DisplayString = GetDxText(eTextEvent, pMapProdInfo, topLevel);

            if (string.IsNullOrEmpty(DisplayString))
            {
                return(_defaultDisplay);
            }
            else
            {
                return(DisplayString);
            }
        }
Пример #2
0
        /// <summary>
        ///     Returns the text string that will appear on the map layout based on the <paramref name="eTextEvent" /> value
        ///     and the status of the <paramref name="pMapProdInfo" /> parameter.
        ///     The <paramref name="pMapProdInfo" /> parameter passed in will be "Nothing" for all <paramref name="eTextEvent" />
        ///     except mmPlotNewPage and mmFinishPlot.
        /// </summary>
        /// <param name="eTextEvent">The text event.</param>
        /// <param name="pMapProdInfo">The map production information.</param>
        /// <returns></returns>
        /// Returns the text string that will appear on the map layout based on the
        /// <paramref name="eTextEvent" />
        /// value
        /// and the status of the
        /// <paramref name="pMapProdInfo" />
        /// parameter.
        /// <remarks>
        ///     This method should always return a non-empty string. If nothing is provided, it is automatically set to " ".
        /// </remarks>
        public string TextString(mmAutoTextEvents eTextEvent, IMMMapProductionInfo pMapProdInfo)
        {
            var value = " ";

            try
            {
                switch (eTextEvent)
                {
                case mmAutoTextEvents.mmCreate:
                    value = this.OnCreate();
                    break;

                case mmAutoTextEvents.mmDraw:
                    value = this.OnDraw();
                    break;

                case mmAutoTextEvents.mmFinishPlot:
                    value = this.OnFinish();
                    break;

                case mmAutoTextEvents.mmPlotNewPage:
                    value = this.GetText(pMapProdInfo);
                    break;

                case mmAutoTextEvents.mmPrint:
                    value = this.OnPrint(pMapProdInfo);
                    break;

                case mmAutoTextEvents.mmRefresh:
                    value = this.OnRefresh();
                    break;

                default:
                    value = this.OnStart(pMapProdInfo);
                    break;
                }
            }
            catch (Exception e)
            {
                if (MinerRuntimeEnvironment.IsUserInterfaceSupported)
                {
                    MessageBox.Show(Document.ParentWindow, e.Message, string.Format("Error Executing Auto Text {0}", this.Caption), MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                Log.Error("Error Executing Auto Text " + this.Caption, e);
            }

            // An empty string will remove the auto text element.
            return(string.IsNullOrEmpty(value) ? " " : value);
        }
Пример #3
0
        string IMMAutoTextSource.TextString(mmAutoTextEvents eTextEvent, IMMMapProductionInfo pMapProdInfo)
        {
            string sReturnVal = _defaultDisplay;

            try
            {
                sReturnVal = GetText(eTextEvent, pMapProdInfo);
            }
            catch (Exception ex)
            {
                ToolUtility.LogError("Error getting autotext", ex);
            }

            if (string.IsNullOrEmpty(sReturnVal))
                return _NullString;
            else
                return sReturnVal;
        }
Пример #4
0
        /// <summary>
        /// Load the Application, D8TopLevel, and make a call to its own get text.
        /// </summary>
        /// <param name="eTextEvent"></param>
        /// <param name="pMapProdInfo"></param>
        /// <returns></returns>
        protected override string GetText(mmAutoTextEvents eTextEvent, IMMMapProductionInfo pMapProdInfo)
        {
            if (App == null)
                App = DesignerUtility.GetApplication();
            if (App == null)
            {
                ToolUtility.LogError(_ProgID + ": Could not load Application Extension");
                return _defaultDisplay;
            }

            ID8TopLevel topLevel = App.FindExtensionByName("DesignerTopLevel") as ID8TopLevel;
            if (topLevel == null)
                return _defaultDisplay;

            string DisplayString = GetDxText(eTextEvent, pMapProdInfo,topLevel);
            if (string.IsNullOrEmpty(DisplayString))
                return _defaultDisplay;
            else
                return DisplayString;
        }
Пример #5
0
        string IMMAutoTextSource.TextString(mmAutoTextEvents eTextEvent, IMMMapProductionInfo pMapProdInfo)
        {
            string sReturnVal = _defaultDisplay;

            try
            {
                sReturnVal = GetText(eTextEvent, pMapProdInfo);
            }
            catch (Exception ex)
            {
                ToolUtility.LogError("Error getting autotext", ex);
            }

            if (string.IsNullOrEmpty(sReturnVal))
            {
                return(_NullString);
            }
            else
            {
                return(sReturnVal);
            }
        }
Пример #6
0
 /// <summary>
 /// Pass the D8TopLevel to its child
 /// </summary>
 /// <param name="eTextEvent"></param>
 /// <param name="pMapProdInfo"></param>
 /// <param name="topLevel"></param>
 /// <returns></returns>
 protected abstract string GetDxText(mmAutoTextEvents eTextEvent, IMMMapProductionInfo pMapProdInfo, ID8TopLevel topLevel);
Пример #7
0
 bool IMMAutoTextSource.NeedRefresh(mmAutoTextEvents eTextEvent)
 {
     return(true);
 }
Пример #8
0
 protected abstract string GetText(mmAutoTextEvents eTextEvent, IMMMapProductionInfo pMapProdInfo);
Пример #9
0
 /// <summary>
 ///     Returns a boolean value indicating whether the element should be refreshed based on the
 ///     <paramref name="eTextEvent" /> value.
 /// </summary>
 /// <param name="eTextEvent">The text event.</param>
 /// <returns>
 ///     Returns a boolean value indicating whether the element should be refreshed based on the mmAutoTextEvents value.
 /// </returns>
 public virtual bool NeedRefresh(mmAutoTextEvents eTextEvent)
 {
     return(true);
 }
Пример #10
0
        protected override string GetDxText(mmAutoTextEvents eTextEvent, IMMMapProductionInfo pMapProdInfo, ID8TopLevel topLevel)
        {
            //Only render the ATE when printing/plotting or previewing a print.
            //This boosts performance when working in page layout view
            //without having to 'pause' rendering.
            switch (eTextEvent)
            {
            case mmAutoTextEvents.mmCreate:
            case mmAutoTextEvents.mmDraw:
            case mmAutoTextEvents.mmFinishPlot:
            case mmAutoTextEvents.mmRefresh:
            default:
                return(_defaultDisplay);

            case mmAutoTextEvents.mmPlotNewPage:
            case mmAutoTextEvents.mmPrint:
            case mmAutoTextEvents.mmStartPlot:
                break;
            }

            IEnvelope CurrentExtent = null;

            try
            {
                IMap Map = null;
                if (pMapProdInfo != null && pMapProdInfo.Map != null)
                {
                    Map = pMapProdInfo.Map;
                }
                else
                {
                    //This is requried for print preview or file->export map.
                    //During these times there will be no map production object
                    //and we will just use the current extent.  Useful for testing
                    //and "one-off" maps.
                    IApplication App   = DesignerUtility.GetApplication();
                    IMxDocument  MxDoc = App.Document as IMxDocument;
                    if (MxDoc == null)
                    {
                        throw new Exception("Unable to load Map Document from Application");
                    }

                    Map = MxDoc.FocusMap;
                }

                IActiveView ActiveView = Map as IActiveView;
                if (ActiveView == null)
                {
                    throw new Exception("Unable to load Active View from Map");
                }

                CurrentExtent = ActiveView.Extent;
                if (CurrentExtent == null ||
                    CurrentExtent.IsEmpty)
                {
                    throw new Exception("Unable to determine map extent.");
                }
            }
            catch (Exception ex)
            {
                ToolUtility.LogError("Unable to load extents of the focus map", ex);
                return(_defaultDisplay);
            }

            return(GetConstructionNotes(topLevel, CurrentExtent));
        }
Пример #11
0
 /// <summary>
 /// Pass the D8TopLevel to its child
 /// </summary>
 /// <param name="eTextEvent"></param>
 /// <param name="pMapProdInfo"></param>
 /// <param name="topLevel"></param>
 /// <returns></returns>
 protected abstract string GetDxText(mmAutoTextEvents eTextEvent, IMMMapProductionInfo pMapProdInfo, ID8TopLevel topLevel);
Пример #12
0
 protected abstract string GetText(mmAutoTextEvents eTextEvent, IMMMapProductionInfo pMapProdInfo);
Пример #13
0
 bool IMMAutoTextSource.NeedRefresh(mmAutoTextEvents eTextEvent)
 {
     return true;
 }