Beispiel #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);
            }
        }
        public string GetConstructionNotes(ID8TopLevel topLevel, IEnvelope FilterExtent)
        {
            //Parse the Design Tree
            ID8List TopList = topLevel as ID8List;

            TopList.Reset();

            IMMPxApplication PxApp = null;

            try
            {
                PxApp = DesignerUtility.GetPxApplication();
            }
            catch (Exception ex)
            {
                ToolUtility.LogError(_ProgID + ": Could obtain a Px Application reference.", ex);
                return(_defaultDisplay);
            }

            try
            {
                TopList.Reset();
                ID8List WorkRequest = TopList.Next(false) as ID8List;
                if (WorkRequest == null)
                {
                    return("");
                }

                //WorkRequest.Reset();
                //ID8List Design = WorkRequest.Next(false) as ID8List;

                //Get the Design XML
                IMMPersistentXML WrXml = WorkRequest as IMMPersistentXML;

                string result = Utility.LabellingUtility.GetConstructionNotes(PxApp, WrXml, FilterExtent);
                if (string.IsNullOrEmpty(result))
                {
                    return(_NoFeatures);
                }
                else
                {
                    return(result);
                }
            }
            catch (ApplicationException apex)
            {
                //ignore exception, no features
                return(_NoFeatures);
            }
            catch (Exception ex)
            {
                ToolUtility.LogError(_ProgID + ": Error Retrieving Construction Notes", ex);
                return(_defaultDisplay);
            }
        }
Beispiel #3
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);
        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));
        }
Beispiel #5
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);