示例#1
0
        /// <summary>
        ///     Adds a black rectangle in the lower right corner area just below the mapframe. The white
        ///     text CITY OF MEDFORD is added on top of this rectangle.
        /// </summary>
        public override void addMedfordRectangle()
        {
            CSpatialSubs       oSpatialSubs = new CSpatialSubs();
            IMxDocument        pMxDoc       = (IMxDocument)ArcMap.Document;
            IGraphicsContainer pGC          = (IGraphicsContainer)pMxDoc.PageLayout;

            try
            {
                ILineSymbol       pLineSym    = oSpatialSubs.createSimpleLineSymbol(oSpatialSubs.createRGB(0, 0, 0), base.XFactor, esriSimpleLineStyle.esriSLSSolid);
                ISimpleFillSymbol pFillSymbol = (ISimpleFillSymbol)oSpatialSubs.createSimpleFillSymbol(oSpatialSubs.createRGB(0, 0, 0), pLineSym, esriSimpleFillStyle.esriSFSSolid);

                oSpatialSubs.addRectangleToGraphicsContainer(pGC,
                                                             (IFillSymbol)pFillSymbol,
                                                             (base.XFactor * SPrintConst.MapFrame_XMax),
                                                             (base.XFactor * SPrintConst.Neatline_XMax),
                                                             (base.YFactor * (SPrintConst.Neatline_YMax - SPrintConst.Logo_Offset)),
                                                             (base.YFactor * SPrintConst.Neatline_YMax));
                pLineSym    = null;
                pFillSymbol = null;
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("Errors: CLandscapeLayout:addMedfordRectangle()\r\n" + ex.Message, "Errors occurred", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
            finally
            {
                oSpatialSubs.Dispose();
                pMxDoc = null;
                pGC    = null;
            }
        }
示例#2
0
        private void addBottomLine()
        {
            CSpatialSubs       oSpatialSubs = new CSpatialSubs();
            ISimpleLineSymbol  pLineSym     = null;
            IMxDocument        pMxDoc       = (IMxDocument)ArcMap.Document;
            IGraphicsContainer pGC          = (IGraphicsContainer)pMxDoc.PageLayout;

            try
            {
                pLineSym = (ISimpleLineSymbol)oSpatialSubs.createSimpleLineSymbol(oSpatialSubs.createRGB(0, 0, 0), (1 * base.XFactor), esriSimpleLineStyle.esriSLSSolid);
                oSpatialSubs.addLineToGraphicsContainer(pGC,
                                                        pLineSym,
                                                        SPrintConst.MapFrame_XMax * base.XFactor,
                                                        SPrintConst.Neatline_XMax * base.XFactor,
                                                        (SPrintConst.Name_YMin - .02) * base.YFactor,
                                                        (SPrintConst.Name_YMin - .02) * base.YFactor);
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("Errors: CPortraitLayout:addCenterLine()\r\n" + ex.Message, "Errors occurred", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
            finally
            {
                oSpatialSubs.Dispose();
                pLineSym = null;
                pMxDoc   = null;
                pGC      = null;
            }
        }
示例#3
0
        /// <summary>
        ///     Add the SMARTMAP text as an ITextElement to the map layout. Place the text on top
        ///     off the black rectangle that was placed in the lower right hand corner between
        ///     the mapframe and the neatline.
        /// </summary>
        public override void addMedfordText()
        {
            CSpatialSubs       oSpatialSubs = new CSpatialSubs();
            IMxDocument        pMxDoc       = (IMxDocument)ArcMap.Document;
            IGraphicsContainer pGC          = (IGraphicsContainer)pMxDoc.PageLayout;

            try
            {
                ITextSymbol  pTextSym  = oSpatialSubs.createTextSymbol(255, 255, 255, (9 * base.YFactor), esriTextHorizontalAlignment.esriTHACenter, esriTextVerticalAlignment.esriTVACenter, "Arial");
                string       sText     = "CITY OF MEDFORD";
                ITextElement pTextElem = oSpatialSubs.addTextToGraphicsContainer(pGC,
                                                                                 pTextSym,
                                                                                 ((base.XFactor * 1.19) * SPrintConst.MapFrame_XMax),
                                                                                 (base.XFactor * SPrintConst.MapFrame_XMax),
                                                                                 (base.YFactor * (SPrintConst.Neatline_YMax - SPrintConst.Logo_Offset)),
                                                                                 (base.YFactor * SPrintConst.Neatline_YMax),
                                                                                 sText);
                pTextSym  = null;
                pTextElem = null;
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("Errors: CLandscapeLayout:addMedfordText()\r\n" + ex.Message, "Errors occurred", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
            finally
            {
                oSpatialSubs.Dispose();
                pMxDoc = null;
                pGC    = null;
            }
        }
示例#4
0
        private string returnCurrentLicense()
        {
            string       sRetVal      = "";
            CSpatialSubs oSpatialSubs = new CSpatialSubs();

            switch (oSpatialSubs.returnCurrentProductCode())
            {
            case ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcView:
                sRetVal = "ArcView";
                break;

            case ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcEditor:
                sRetVal = "ArcEditor";
                break;

            case ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcInfo:
                sRetVal = "ArcInfo";
                break;

            default:
                sRetVal = "unspecified";
                break;
            }
            oSpatialSubs.Dispose();
            return(sRetVal);
        }
示例#5
0
        public override void addSeperatorLine()
        {
            CSpatialSubs       oSpatialSubs = new CSpatialSubs();
            IMxDocument        pMxDoc       = (IMxDocument)ArcMap.Document;
            IGraphicsContainer pGC          = (IGraphicsContainer)pMxDoc.PageLayout;

            try
            {
                ISimpleLineSymbol pLineSymbol = (ISimpleLineSymbol)oSpatialSubs.createSimpleLineSymbol(oSpatialSubs.createRGB(0, 0, 0), (this.XFactor * 2), esriSimpleLineStyle.esriSLSSolid);
                //oSpatialSubs.addLineToGraphicsContainer(pGC, pLineSymbol, (SPrintConst.MapFrame_XMax * this.XFactor), (SPrintConst.MapFrame_XMax * this.XFactor), (SPrintConst.MapFrame_YMin * this.YFactor), (SPrintConst.MapFrame_YMax * this.YFactor));
                oSpatialSubs.addLineToGraphicsContainer(pGC, pLineSymbol, (SPrintConst.MapFrame_XMax * this.XFactor), (SPrintConst.MapFrame_XMax * this.XFactor), (SPrintConst.Neatline_YMin * this.YFactor), (SPrintConst.Neatline_YMax * this.YFactor));

                addCenterLine();
                addBottomLine();

                pLineSymbol = null;
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("Errors: CLandscapeLayout:addSeperatorLine()\r\n" + ex.Message, "Errors occurred", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
            finally
            {
                oSpatialSubs.Dispose();
                pMxDoc = null;
                pGC    = null;
            }
        }
示例#6
0
        public override void addSeperatorLine()
        {
            CSpatialSubs       oSpatialSubs = new CSpatialSubs();
            IMxDocument        pMxDoc       = (IMxDocument)base.App.Document;
            IGraphicsContainer pGC          = (IGraphicsContainer)pMxDoc.PageLayout;
            ISimpleLineSymbol  pLineSym     = null;

            try
            {
                pLineSym = (ISimpleLineSymbol)oSpatialSubs.createSimpleLineSymbol(oSpatialSubs.createRGB(0, 0, 0), (2 * base.XFactor), esriSimpleLineStyle.esriSLSSolid);
                oSpatialSubs.addLineToGraphicsContainer(pGC, pLineSym,
                                                        (SPrintConst.Neatline_XMin * base.XFactor),
                                                        (SPrintConst.Neatline_XMax * base.XFactor),
                                                        (SPrintConst.Neatline_YMin * base.YFactor),
                                                        (SPrintConst.Neatline_YMin * base.YFactor));
                addRightOfTitleLine();
                addLeftLine();
                addCenterLine();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("Errors: CPortraitLayout:addSeperatorLine()\r\n" + ex.Message, "Errors occurred", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
            finally
            {
                oSpatialSubs.Dispose();
                pMxDoc   = null;
                pGC      = null;
                pLineSym = null;
            }
        }
示例#7
0
        private bool editorCheckedOut()
        {
            bool         bRetVal      = false;
            CSpatialSubs oSpatialSubs = new CSpatialSubs();

            ESRI.ArcGIS.esriSystem.esriLicenseProductCode productCode = oSpatialSubs.returnCurrentProductCode();


            if (productCode == ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcEditor)
            {
                bRetVal = true;
            }
            else
            {
                //if (CMedToolsSubs.isProductAvailable(ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcEditor) == ESRI.ArcGIS.esriSystem.esriLicenseStatus.esriLicenseAvailable)
                //{
                ESRI.ArcGIS.esriSystem.esriLicenseStatus status = oSpatialSubs.checkOutLicenses(ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcEditor);
                if ((status == ESRI.ArcGIS.esriSystem.esriLicenseStatus.esriLicenseAlreadyInitialized) || (status == ESRI.ArcGIS.esriSystem.esriLicenseStatus.esriLicenseAlreadyInitialized))
                {
                    bRetVal = true;
                }

                //}
            }
            oSpatialSubs.Dispose();
            return(bRetVal);
        }
示例#8
0
        /// <summary>
        /// Add the mapscale text to the Graphic Container. Places this text under the scale bar.
        /// </summary>
        /// <param name="sMapScale"></param>
        public override void addMapScaleText(string sMapScale)
        {
            CSpatialSubs       oSpatialSubs = new CSpatialSubs();
            IMxDocument        pMxDoc       = (IMxDocument)this.App.Document;
            IGraphicsContainer pGC          = (IGraphicsContainer)pMxDoc.PageLayout;

            IMapSurroundFrame pMSFrame  = null;
            IEnvelope         pEnv      = null;
            ITextSymbol       pTextSym  = null;
            ITextElement      pTextElem = null;

            try
            {
                //Locate the scalebar in the graphics container because we
                //want to put the mapscale right under it.
                //A scalebar is contained within a MapSurroundFrame.
                pGC.Reset();
                IElement pElem = pGC.Next();
                while (pElem != null)
                {
                    if (pElem is IMapSurroundFrame)
                    {
                        pMSFrame = (IMapSurroundFrame)pElem;
                        if (pMSFrame.Object is IScaleBar)
                        {
                            break;  // we got the scalebar
                        }
                    }
                    pElem = pGC.Next();
                }

                pEnv = new EnvelopeClass();
                //get the envelope of the scalebar
                pElem.QueryBounds(pMxDoc.ActiveView.ScreenDisplay, pEnv);

                double xMin = SPrintConst.MapscaleText_XMin * base.XFactor;
                double xMax = SPrintConst.MapscaleText_XMax * base.XFactor;
                double yMax = pEnv.YMin - 0.02;  //this is the min y value of the scalebar envelope - .02
                double yMin = SPrintConst.MapscaleText_YMin * base.YFactor;

                //Set pMapscaleText symbol to the textsymbol
                pTextSym  = oSpatialSubs.createTextSymbol(0, 0, 0, 7 * this.YFactor, esriTextHorizontalAlignment.esriTHALeft, esriTextVerticalAlignment.esriTVATop, "Arial");
                pTextElem = oSpatialSubs.addTextToGraphicsContainer(pGC, pTextSym, xMin, xMax, yMin, yMax, sMapScale);
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("Errors: CPortraitLayout:addMapScaleText()\r\n" + ex.Message, "Errors occurred", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
            finally
            {
                oSpatialSubs.Dispose();
                pMxDoc    = null;
                pGC       = null;
                pMSFrame  = null;
                pEnv      = null;
                pTextSym  = null;
                pTextElem = null;
            }
        }
示例#9
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            CSpatialSubs oSpatialSubs = new CSpatialSubs();

            if (oSpatialSubs.returnCurrentProductCode() == ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcView)
            {
                string sMsg = "This action requires that you use at least an ArcEditor license\r\n\r\n";
                sMsg += "Click 'YES' below to have the application restart for you (you will NOT be prompted to save)\r\n";
                sMsg += "or\r\nclick 'No' below to restart later and then checkout an Editor license from the Desktop Administrator";
                sMsg += "\r\n\r\nDo you want to restart the application?";

                if (MessageBox.Show(sMsg, "Editor License Required", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
                {
                    //if (CMedToolsSubs.isProductAvailable(ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcEditor) == ESRI.ArcGIS.esriSystem.esriLicenseStatus.esriLicenseAvailable)
                    //{
                    //// shut down the app and restart
                    CMedToolsSubs.ResetAsEditor = true;
                    CloseForm();
                    //}
                    //else
                    //{
                    //    MessageBox.Show("There is no Editor license available at the moment.", "License problem", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    //}
                }
            }
            else
            {
                Cursor = Cursors.WaitCursor;
                try
                {
                    ///
                    /// rev. 12/13/2007
                    /// by: David Renz
                    /// changed to just use the selected featureclass
                    ///
                    oSpatialSubs.addFeatureLayerToMap(this.App, lbEditabelLayers.SelectedItem.ToString(), true);

                    // add the layers to ArcMap
                    //foreach (object obj in lbEditabelLayers.Items)
                    //{
                    //    CMedToolsSubs.addFeatureLayerToMap(this.App, obj.ToString(), true);
                    //}
                    CloseForm();
                }
                catch (Exception ex)
                {
                    //MessageBox.Show("An error occurred while loading the layers into the application.\r\n\r\nPlease check with the GIS administrator to ensure that you have edit priviledges on the selected layers.");
                    this.lblEditMsg.Text = ex.Message.ToString(); //"An error occurred while starting an editing session.\r\n\r\nPlease check with the GIS administrator to ensure\r\nthat you have edit priviledges on the selected layers.";
                    //this.lblEditMsg.Text += "\r\n\r\n" + ex.Message;
                    return;
                }
                finally
                {
                    Cursor = Cursors.Default;
                    oSpatialSubs.Dispose();
                }
            }
        }
示例#10
0
        private void loadLayers(ref IMap pMap, Dictionary <string, string> dctLayers, Collection <string> colOnLayers)
        {
            Collection <string> colMissingLayers = new Collection <string>();
            CSpatialSubs        oSpatialSubs     = new CSpatialSubs();

            try
            {
                foreach (KeyValuePair <string, string> pair in dctLayers)
                {
                    if (CMedToolsSubs.layerExists(dctLayers[pair.Key].ToString(), "I://GIS//Layers//"))               // SConst.LayerLocation))
                    {
                        pMap.AddLayer(oSpatialSubs.returnLayer(dctLayers[pair.Key].ToString(), "I://GIS//Layers//")); //  SConst.LayerLocation));
                    }
                    else
                    {
                        colMissingLayers.Add(pair.Key);
                    }
                }

                for (int i = 0; i < pMap.LayerCount; i++)
                {
                    ILayer pLayer = pMap.get_Layer(i);
                    if (!colMissingLayers.Contains(pLayer.Name))
                    {
                        if (!colOnLayers.Contains(pLayer.Name))
                        {
                            pLayer.Visible = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                oSpatialSubs.Dispose();
            }
        }
示例#11
0
        public override void addTitles(string sTitle, string sSubTitle)
        {
            CSpatialSubs       oSpatialSubs = new CSpatialSubs();
            IMxDocument        pMxDoc       = (IMxDocument)ArcMap.Document;
            IGraphicsContainer pGC          = (IGraphicsContainer)pMxDoc.PageLayout;

            ITextSymbol  pTitleTextSym     = null;
            ITextElement pTitleTextElem    = null;
            ITextSymbol  pSubTitleTextSym  = null;
            ITextElement pSubTitleTextElem = null;

            try
            {
                // count line breaks in sTitle
                int iTitleLineBreaks = sTitle.Split(new string[] { "\r\n" }, StringSplitOptions.None).Length - 1;

                double dblXMin = 0; double dblXMax = 0; double dblYMin = 0; double dblYMax = 0;

                // do the title stuff
                dblXMin = SPrintConst.Title_XMin * base.XFactor; //(SPrintConst.MapFrame_XMax + SPrintConst.Title_XOffset) * base.XFactor;
                dblXMax = SPrintConst.Title_XMax * base.XFactor; //(SPrintConst.Neatline_XMax * base.XFactor);
                //dblYMin = (SPrintConst.Subtitle_YMax + SPrintConst.Title_XOffset) * base.YFactor;
                dblYMin = SPrintConst.Title_YMin * base.YFactor; //(SPrintConst.Title_YMin * base.YFactor);
                dblYMax = SPrintConst.Title_YMax * base.YFactor; //SPrintConst.Title_YMax * base.YFactor;

                if (sTitle.Length > 0)
                {
                    pTitleTextSym  = oSpatialSubs.createTextSymbol(0, 0, 0, 16 * base.XFactor, esriTextHorizontalAlignment.esriTHALeft, esriTextVerticalAlignment.esriTVATop, "Arial");
                    pTitleTextElem = oSpatialSubs.addTextToGraphicsContainer(pGC, pTitleTextSym, dblXMin, dblXMax, dblYMin, dblYMax, sTitle);

                    //move the title right where we want it
                    oSpatialSubs.moveElementToXMinYmin(pTitleTextElem as IElement, dblXMin, dblYMax);
                }

                // do the subtitle stuff
                dblXMin = SPrintConst.Subtitle_XMin * base.XFactor;     //(SPrintConst.MapFrame_XMax + SPrintConst.Title_XOffset) * base.XFactor;
                dblXMax = SPrintConst.Subtitle_XMax * base.XFactor;     //(SPrintConst.Neatline_XMax * base.XFactor);
                //dblYMin = (SPrintConst.Legend_YMax + SPrintConst.Title_XOffset) * base.YFactor;
                dblYMin = SPrintConst.Subtitle_YMin * base.YFactor;     //(SPrintConst.Title_YMin - .20) * base.YFactor;
                dblYMax = SPrintConst.Subtitle_YMax * base.YFactor;     //SPrintConst.Subtitle_YMax * base.YFactor;

                if (sSubTitle.Length > 0)
                {
                    if (iTitleLineBreaks > 0)
                    {
                        dblYMin -= (.39 * base.YFactor);
                    }

                    pSubTitleTextSym  = oSpatialSubs.createTextSymbol(108, 108, 108, 9 * base.XFactor, esriTextHorizontalAlignment.esriTHALeft, esriTextVerticalAlignment.esriTVATop, "Arial");
                    pSubTitleTextElem = oSpatialSubs.addTextToGraphicsContainer(pGC, pSubTitleTextSym, dblXMin, dblXMax, dblYMin, dblYMax, sSubTitle);

                    //move the title right where we want it
                    oSpatialSubs.moveElementToXMinYmin(pSubTitleTextElem as IElement, dblXMin, dblYMin);
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("Errors: CLandscapeLayout:addTitles()\r\n" + ex.Message, "Errors occurred", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
            finally
            {
                oSpatialSubs.Dispose();
                pMxDoc = null;
                pGC    = null;

                pTitleTextSym     = null;
                pTitleTextElem    = null;
                pSubTitleTextSym  = null;
                pSubTitleTextElem = null;
            }
        }
示例#12
0
        public override void doPrintSetup(IPageLayout2 pPageLayout)
        {
            CSpatialSubs oSpatialSubs = new CSpatialSubs();

            //short shPageForm = 0;  // see ms-help://ESRI.EDNv9.2/esricarto/html/esriPageFormID.htm for IPrinter::FormID constants
            int iPageFormID = 0;   // see http://msdn.microsoft.com/en-us/library/ms776398(VS.85).aspx for IPaper::FormID constants
            //double dblPageWidth = 0;
            //double dblPageHeight = 0;

            IMxApplication pMxApp = (IMxApplication)this.App;
            IMxDocument    pMxDoc = (IMxDocument)this.App.Document;

            IPrinter pPrinter = pMxApp.Printer;
            IPaper   pPaper   = pPrinter.Paper;

            try
            {
                pMxDoc.PageLayout.Page.Orientation = 1;
                pPaper.Orientation = 1;

                switch (this.MapSize)
                {
                case "34 x 44":
                    //shPageForm = 5; // esriPageFormID.esriPageFormE;

                    base.XFactor = 4;
                    base.YFactor = 4;

                    if (pPrinter.DriverName.ToUpper().Contains("DESIGNJET"))
                    {
                        iPageFormID = oSpatialSubs.getPaperFormID(pPaper, "34 x 44");
                    }
                    else
                    {
                        iPageFormID = 26;
                    }

                    break;

                case "17 x 22":
                    //shPageForm = 3; // esriPageFormID.esriPageFormC;

                    base.XFactor = 2;
                    base.YFactor = 2;

                    if (pPrinter.DriverName.ToUpper().Contains("DESIGNJET"))
                    {
                        iPageFormID = oSpatialSubs.getPaperFormID(pPaper, "17 x 22");
                    }
                    else
                    {
                        iPageFormID = 24;
                    }

                    break;

                case "11 x 17":
                    //shPageForm = 2; // esriPageFormID.esriPageFormTabloid;

                    base.XFactor = 1.3;      //1.2941
                    base.YFactor = 1.5455;   //1.5455

                    if (pPrinter.DriverName.ToUpper().Contains("DESIGNJET"))
                    {
                        iPageFormID = oSpatialSubs.getPaperFormID(pPaper, "11 x 17");
                    }
                    else
                    {
                        iPageFormID = 17;
                    }

                    break;

                case "8.5 x 11":
                    //shPageForm = 0; // esriPageFormID.esriPageFormLetter;

                    base.XFactor = 1;
                    base.YFactor = 1;

                    if (pPrinter.DriverName.ToUpper().Contains("DESIGNJET"))
                    {
                        iPageFormID = oSpatialSubs.getPaperFormID(pPaper, "8.5 x 11 ");
                    }
                    else
                    {
                        iPageFormID = 1;
                    }
                    break;
                }

                pPaper.PrinterName = base.PrinterName;
                pPaper.FormID      = (short)iPageFormID;

                double dblWidth  = 0;
                double dblHeight = 0;
                pPaper.QueryPaperSize(out dblWidth, out dblHeight);

                pMxDoc.PageLayout.Page.PutCustomSize(dblWidth, dblHeight);
                pMxDoc.PageLayout.Page.FormID = (esriPageFormID)Enum.Parse(typeof(esriPageFormID), iPageFormID.ToString());


                pMxDoc.ActiveView.PrinterChanged(pPrinter);



                //////----------------------------------------------------------------------------
                //////Set the layout page size and orientation.
                //////----------------------------------------------------------------------------
                //pPage = pMxDoc.PageLayout.Page;
                //pPage.Orientation = 1;
                //pPage.FormID = (esriPageFormID)Enum.Parse(typeof(esriPageFormID), iPageFormID.ToString());

                ////----------------------------------------------------------------------------
                ////Set the printer paper size and orientation.
                ////----------------------------------------------------------------------------
                //pPrinter = pMxApp.Printer;
                //pPrinter.Paper.PrinterName = base.PrinterName;
                //pPrinter.Paper.FormID = shPageForm;
                //pPrinter.Paper.Orientation = 1;

                ////----------------------------------------------------------------------------
                //// deal with the paper
                ////----------------------------------------------------------------------------
                //pPaper = pMxApp.Paper;
                //pPaper.Orientation = 1;
                //pPaper.FormID = (short)iPageFormID;
                //pPaper.PrinterName = base.PrinterName;


                //pMxDoc.ActiveView.PrinterChanged(pPrinter);

                ////////----------------------------------------------------------------------------
                ////////Set the layout page size and orientation.
                ////////----------------------------------------------------------------------------
                ////pPage = pMxDoc.PageLayout.Page;
                ////pPage.Orientation = 1;
                ////pPage.FormID = esriPageFormID.esriPageFormCUSTOM;
                ////pPage.PutCustomSize(dblPageWidth + .1, dblPageHeight + .1);
                ////pPage.PrinterChanged(pPrinter);

                ////double dblWidth = 0; double dblHeight = 0;
                ////pPaper.QueryPaperSize(out dblWidth, out dblHeight);

                ////pPage.PutCustomSize(dblWidth, dblHeight);   //(dblWidth, dblHeight);
                ////pPage.FormID = esriPageFormID.esriPageFormCUSTOM;
                ////pPage.PrinterChanged(pPrinter);

                ////pPage.PutCustomSize(dblWidth, dblHeight);
                ////pPage.PageToPrinterMapping = esriPageToPrinterMapping.esriPageMappingTile;

                //pMxApp.Printer = pPrinter;
                ////pMxDoc.PageLayout = (IPageLayout)pPage;
                //pMxDoc.PageLayout.Page.PutCustomSize(dblPageWidth - 1.8, dblPageHeight - 1.8);
                //pMxDoc.PageLayout.Page.FormID = esriPageFormID.esriPageFormSameAsPrinter;
                //pMxDoc.ActiveView.PrinterChanged(pPrinter);

                //pActiveView = (IActiveView)pMxDoc.ActiveView;
                //pActiveView.Refresh();

                //pMxApp.Printer.Paper.PrinterName = base.PrinterName;
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("Errors: CPortraitLayout:doPrintSetup()\r\n" + ex.Message, "Errors occurred", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
            finally
            {
                pMxDoc   = null;
                pPrinter = null;
                pPaper   = null;
                oSpatialSubs.Dispose();
            }
        }
示例#13
0
        private void getResults(string sWhere)
        {
            CSpatialSubs oSpatialSubs = new CSpatialSubs();
            object       oResults     = oSpatialSubs.searchTaxlots(sWhere, m_pApp);

            try
            {
                if (oResults is IFeatureCursor)
                {
                    // this means that there were multiple results returned
                    // from the user search criteria
                    // so ... show the multiple results window
                    this.Hide();

                    // show multiple results
                    fmMultipleResults oMultRes = new fmMultipleResults();
                    oMultRes.SearchResults = (IFeatureCursor)oResults;
                    oMultRes.App           = this.m_pApp;
                    oMultRes.Show(new WindowWrapper((System.IntPtr)m_pApp.hWnd));

                    this.Dispose();
                }
                else
                {
                    // this means that there was only one feature returned from
                    // the user search criteria

                    IFeature pFeat = (IFeature)oResults;
                    if (pFeat != null)
                    {
                        // zoom to table
                        this.Hide();

                        string sAccount = oSpatialSubs.returnValueFromSingleSelection("ACCOUNT", this.App, SConst.Taxlots);
                        string sMaplot  = oSpatialSubs.returnValueFromSingleSelection("MAPLOT", this.App, SConst.Taxlots);
                        string sAddNum  = oSpatialSubs.returnValueFromSingleSelection("ADDRESSNUM", this.App, SConst.Taxlots);
                        if (sAddNum.IndexOf(" ") > 0)
                        {
                            sAddNum = "";
                        }
                        string sStreet     = oSpatialSubs.returnValueFromSingleSelection("STREETNAME", this.App, SConst.Taxlots);
                        string sObjectID   = oSpatialSubs.returnValueFromSingleSelection("OBJECTID", this.App, SConst.Taxlots);
                        object oLocResults = new object();

                        // go get the location id and check for subaccounts

                        //if (CMedToolsSubs.canConnect(CConst.LXConnString))
                        if (SConst.GotDBConn)
                        {
                            using (CData oData = new CData(SConst.LXConnString.ToString()))
                            {
                                string sDir        = CMedToolsSubs.returnStreetDirectionFromTaxlotsAddress(sStreet);
                                string sStreetName = CMedToolsSubs.returnStreetNameFromTaxlotsAddress(sStreet, SConst.CountyStreets);
                                string sStreetType = CMedToolsSubs.returnStreetTypeFromTaxlotsAddress(sStreet, SConst.CountyStreets);
                                oLocResults = oData.returnLocID(sAddNum, sDir, sStreetName, sStreetType, sMaplot, sAccount);
                            }
                        }
                        else
                        {
                            oLocResults = null;
                        }

                        if (oLocResults is Hashtable)
                        {
                            // the hashtable means that there are multiple subaccounts
                            // so ... go to the sub account window
                            fmSubAccount oSubAccount = new fmSubAccount();
                            oSubAccount.App         = this.App;
                            oSubAccount.ObjectID    = sObjectID;
                            oSubAccount.SubAccounts = oLocResults as Hashtable;
                            oSubAccount.Show(new WindowWrapper((System.IntPtr)m_pApp.hWnd));
                        }
                        else
                        {
                            // there is only one account here ...
                            // so ... go to the results
                            fmSearchResults oSearchResults = new fmSearchResults();
                            oSearchResults.ObjectID = sObjectID;
                            oSearchResults.App      = this.App;
                            if (oLocResults != null)
                            {
                                oSearchResults.LocationID = (int)oLocResults;
                            }
                            else
                            {
                                oSearchResults.LocationID = 0;
                            }
                            oSearchResults.Show(new WindowWrapper((System.IntPtr)m_pApp.hWnd));
                        }
                        this.Dispose();
                    }
                    else
                    {
                        MessageBox.Show("There were no matches found.", "Taxlot Search: Results", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        // reset the form
                    }
                }
            }
            catch (Exception ex)
            {
                string s = ex.Message;
                s += "done";
            }
            finally
            {
                oSpatialSubs.Dispose();
            }
        }