示例#1
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;
            }
        }
示例#2
0
        private void showPrintDialog(string sPrinterName)
        {
            //System.Windows.Forms.MessageBox.Show("OOPS!!!! Keith , I found a bug here  at the last minute.Go to File --> Print to print. Sorry.", "OOPS!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

            //// create and show...

            IMxDocument pMxDoc = (IMxDocument)this.App.Document;
            IPage       pPage  = (IPage)pMxDoc.PageLayout.Page;

            CSpatialSubs   oSpatialSubs = new CSpatialSubs();
            IMxApplication pMxApp       = (IMxApplication)this.App;

            ESRI.ArcGIS.Output.IPrinter pPrinter = pMxApp.Printer;
            ESRI.ArcGIS.Output.IPaper   pPaper   = pPrinter.Paper;

            int iPageFormID = 0;   // see http://msdn.microsoft.com/en-us/library/ms776398(VS.85).aspx for IPaper::FormID constants

            pMxDoc.PageLayout.Page.Orientation = 2;
            pPaper.Orientation = 2;

            ESRI.ArcGIS.OutputUI.IPrintDialog dialog = new ESRI.ArcGIS.OutputUI.PrintDialogClass();
            dialog.PageLayout = pMxDoc.PageLayout;
            dialog.Printer    = pMxApp.Printer;
            dialog.DoModal(0, pPage);



            //dialog.Printer.Paper.PrinterName = sPrinterName;
            //dialog.Printer.Paper.FormID = (short)iPageFormID;
            //dialog.DoModal(0,pPage);


            //switch (this.cboMapSize.SelectedItem.ToString())
            //{
            //    case "34 x 44": //34 x 44
            //        if (pPrinter.DriverName.ToUpper().Contains("DESIGNJET"))
            //            iPageFormID = oSpatialSubs.getPaperFormID(pPaper, "34 x 44");
            //        else
            //            iPageFormID = 26;
            //        break;
            //    case "17 x 22": // 17 x 22
            //        if (pPrinter.DriverName.ToUpper().Contains("DESIGNJET"))
            //            iPageFormID = oSpatialSubs.getPaperFormID(pPaper, "17 x 22");
            //        else
            //            iPageFormID = 24;
            //        break;
            //    case "11 x 17": // 11 x 22
            //        if (pPrinter.DriverName.ToUpper().Contains("DESIGNJET"))
            //            iPageFormID = oSpatialSubs.getPaperFormID(pPaper, "11 x 17");
            //        else
            //            iPageFormID = 17;
            //        break;
            //    case "8.5 x 11": // 8.5 x 11
            //        if (pPrinter.DriverName.ToUpper().Contains("DESIGNJET"))
            //            iPageFormID = oSpatialSubs.getPaperFormID(pPaper, "8.5 x 11");
            //        else
            //            iPageFormID = 1;
            //        break;
            //}
        }
示例#3
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);
        }
示例#4
0
        private void saveEdits(IFeatureLayer pFLayer)
        {
            CSpatialSubs oSubs = new CSpatialSubs();

            IFeatureClass pFC    = pFLayer.FeatureClass;
            IWorkspace    pWkSpc = oSubs.returnWorkspace(pFC);

            if (pWkSpc.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace)
            {
                if (SConst.EnableMedfordContent == true)
                {
                    if (System.Windows.Forms.MessageBox.Show("Would you like to update all the production and publication databases?", SConst.OrganizationName + " GIS Tools: Update Data", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        try
                        {
                            using (CSpatialSubs oSpatialSubs = new CSpatialSubs())
                            {
                                oSpatialSubs.updateAllSDEDatabases(pFC);
                            }
                        }
                        catch (Exception ex)
                        {
                            System.Windows.Forms.MessageBox.Show("The update of the publication and production databases did not succeed.\r\n" + ex.Message, SConst.OrganizationName + " GIS Tools: Update Data", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                        }
                    }
                }
            }
        }
示例#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
        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);
        }
示例#7
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;
            }
        }
示例#8
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;
            }
        }
示例#9
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;
            }
        }
示例#10
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;
            }
        }
示例#11
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();
                }
            }
        }
示例#12
0
        private void setEditableLayer(IFeature pFeat)
        {
            CSpatialSubs oSubs = new CSpatialSubs();

            IEditLayers   pEditLayers = this.m_editor as IEditLayers;
            IFeatureLayer pFLayer     = oSubs.returnFLayerByName(pFeat.Class.AliasName, true);

            pEditLayers.SetCurrentLayer(pFLayer, 0);
        }
示例#13
0
        private void button1_Click(object sender, EventArgs e)
        {
            CSpatialSubs oSubs = new CSpatialSubs();

            IFeatureLayer pFLayer     = oSubs.returnFLayerByName(lbLayers.SelectedItem.ToString(), true);
            IEditLayers   pEditLayers = this.m_pEditor as IEditLayers;

            pEditLayers.SetCurrentLayer(pFLayer, 0);
            this.Close();
        }
示例#14
0
        private void doSearch()
        {
            this.Cursor = Cursors.WaitCursor;

            using (CSpatialSubs oSpatialSubs = new CSpatialSubs())
            {
                // check if taxlots is in the data frame
                if (!oSpatialSubs.doesMapLayerExist(SConst.Taxlots, this.App))
                {
                    //CMedToolsSubs.addFeatureLayerToMap(m_pApp, CConst.Taxlots, false);
                    oSpatialSubs.addSingleLayerToMap(m_pApp, SConst.LayerLocation, SConst.TaxlotLayerName);
                }
            }

            string sWhere = "";

            switch (m_iSearchType)
            {
            case 0:     //Int32.Parse(SearchType.OWNER):
                sWhere = "FEEOWNER LIKE '%" + txtOwner.Text.Replace(",", " ") + "%'";
                break;

            //case 1: //Int32.Parse(SearchType.SITUS):
            //    sWhere = "SITEADD = '" + txtSitus.Text + "'";
            //    break;
            case 2:     //Int32.Parse(SearchType.MAPLOT):
                sWhere = "MAPLOT = '" + txtMaplot.Text + "'";
                break;

            case 3:     //Int32.Parse(SearchType.ACCOUNT):
                sWhere = "ACCOUNT = " + txtAccount.Text + "";
                break;

            case 4:     //Int32.Parse(SearchType.MAPNUMBER):
                sWhere = "MAPNUM = '" + txtMapnum.Text + "'";
                break;

            default:

                break;
            }

            if (sWhere.Length > 0)
            {
                getResults(sWhere);
            }

            this.Cursor = Cursors.Default;
        }
示例#15
0
        public static bool isAllowedDatasetFC(string sLayer)
        {
            bool bRetVal = false;

            ESRI.ArcGIS.Geodatabase.IWorkspace pWorkSpace;
            using (CSpatialSubs oSpatialSubs = new CSpatialSubs())
            {
                pWorkSpace = oSpatialSubs.returnEditableSDEWorkspace();
            }

            if (pWorkSpace != null)
            {
                // get the feature classes from each dataset
                IEnumDataset enumFeatureDatasets = pWorkSpace.get_Datasets(esriDatasetType.esriDTFeatureDataset);
                enumFeatureDatasets.Reset();

                IFeatureDataset featureDataset = (IFeatureDataset)enumFeatureDatasets.Next();

                while (featureDataset != null)
                {
                    ISQLPrivilege oDSPriv = (ISQLPrivilege)featureDataset.FullName;
                    int           iDSPriv = oDSPriv.SQLPrivileges;

                    if (iDSPriv > 1)
                    {
                        IFeatureClassContainer fcContainer        = (IFeatureClassContainer)featureDataset;
                        IEnumFeatureClass      enumFeatureClasses = fcContainer.Classes;
                        enumFeatureClasses.Reset();
                        IFeatureClass fc = (IFeatureClass)enumFeatureClasses.Next();
                        while (fc != null)
                        {
                            if (sLayer == fc.AliasName.ToString())
                            {
                                bRetVal = true;
                                break;
                            }

                            fc = (IFeatureClass)enumFeatureClasses.Next();
                        }
                    }
                    featureDataset = (IFeatureDataset)enumFeatureDatasets.Next();
                }
            }
            return(bRetVal);
        }
示例#16
0
        private void zoomFromDataGrid(string sWhere)
        {
            //Set the query filter. use the arguements passed into the function
            IQueryFilter pQueryFilter = new QueryFilterClass();

            pQueryFilter.WhereClause = sWhere;

            ESRI.ArcGIS.ArcMapUI.IMxDocument pMxDoc = (ESRI.ArcGIS.ArcMapUI.IMxDocument) this.App.Document;
            IMap pMap = (IMap)pMxDoc.FocusMap;

            IFeatureLayer pTaxlotLayer;

            using (CSpatialSubs oSpatialSubs = new CSpatialSubs())
            {
                pTaxlotLayer = (IFeatureLayer)oSpatialSubs.returnFeatureLayer(pMap, SConst.Taxlots);
                oSpatialSubs.selectFeatures(pQueryFilter, this.App, pTaxlotLayer, true);
            }
        }
示例#17
0
        protected override void OnClick()
        {
            if (results != null)
            {
                try
                {
                    results.Close();
                    results = null;
                }
                catch
                {
                    // just move on.
                    int i = 1;
                }
            }

            using (CSpatialSubs oSpatialSubs = new CSpatialSubs())
            {
                // check if taxlots is in the data frame
                //if (!oSpatialSubs.doesMapLayerExist("MEDSDE.DBO.TAXLOTS", ArcMap.Application))

                if (!oSpatialSubs.doesMapLayerExist("MEDSDE.DBO.TAXLOTS", ArcMap.Application))
                {
                    System.Windows.Forms.MessageBox.Show("Taxlots layer does not exist." + Environment.NewLine + Environment.NewLine + "Please ensure that you have taxlots loaded into your project and " + Environment.NewLine + "that have your target taxlots selected.", "Related Party Query: Oops!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
                    return;
                }

                IFeatureLayer     pFLayer = (IFeatureLayer)oSpatialSubs.returnFeatureLayer(ArcMap.Document.FocusMap, "Tax Lots");
                IFeatureSelection pFSel   = pFLayer as IFeatureSelection;
                ISelectionSet2    pSelSet = pFSel.SelectionSet as ISelectionSet2;

                if (pSelSet.Count < 1)
                {
                    System.Windows.Forms.MessageBox.Show("There were no selected features found." + Environment.NewLine + Environment.NewLine + "Please select taxlots before using this tool.", "Related Party Query: Oops!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
                    return;
                }

                ICursor pCursor;
                pSelSet.Search(null, false, out pCursor);

                doQuery(returnSearchCriteria(pCursor as IFeatureCursor));
            }
        }
示例#18
0
        private void btnDone_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            if (SConst.m_pCheckedLayers != null)
            {
                if (SConst.m_pCheckedLayers.Count > 0)
                {
                    using (CSpatialSubs oSpatialSubs = new CSpatialSubs())
                    {
                        oSpatialSubs.addLayers(ArcMap.Application, SConst.LayerLocation);
                    }
                }
            }

            //SConst.clearLayerList();
            this.Cursor = Cursors.Default;
            closeForm();
        }
示例#19
0
        //Invoked at the end of an editor session (Editor->Stop Editing).
        private void Events_OnStopEditing(bool Save)
        {
            CSpatialSubs oSubs = new CSpatialSubs();

            IEditLayers   pEditLayers = this.m_editor as IEditLayers;
            IFeatureLayer pFLayer     = pEditLayers.CurrentLayer as IFeatureLayer;

            if (pFLayer == null)
            {
                //System.Windows.Forms.MessageBox.Show("Please ensure that you have selected the edited feature class in the editor window.\r\n", "City of Medford GIS Tools: Update Data", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                //returnEditLayer();
                //return;
            }
            else
            {
                if (Save)
                {
                    saveEdits(pFLayer);
                }
            }
        }
示例#20
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();
            }
        }
示例#21
0
        private void btnDone_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            if (SConst.m_pCheckedLayers != null)
            {
                if (SConst.m_pCheckedLayers.Count > 0)
                {
                    using (CSpatialSubs oSpatialSubs = new CSpatialSubs())
                    {
                        oSpatialSubs.addLayers(this.App, SConst.LayerLocation);
                    }
                }
            }
            if (SConst.m_pCheckedLayers != null)
            {
                SConst.m_pCheckedLayers.Clear();
            }

            this.Cursor = Cursors.Default;
            this.Dispose();
        }
示例#22
0
        public static bool isAllowedStandaloneFC(string sLayer)
        {
            bool bRetVal = false;

            ESRI.ArcGIS.Geodatabase.IWorkspace pWorkSpace;

            using (CSpatialSubs oSpatialSubs = new CSpatialSubs())
            {
                pWorkSpace = oSpatialSubs.returnEditableSDEWorkspace();
            }

            if (pWorkSpace != null)
            {
                IEnumDataset enumFC = pWorkSpace.get_Datasets(esriDatasetType.esriDTFeatureClass);
                enumFC.Reset();

                IFeatureClass fc = (IFeatureClass)enumFC.Next();

                while (fc != null)
                {
                    IDataset      ds      = fc as IDataset;
                    ISQLPrivilege oFCPriv = (ISQLPrivilege)ds.FullName;

                    int iFCPriv = oFCPriv.SQLPrivileges;

                    if (iFCPriv > 1)
                    {
                        if (sLayer == fc.AliasName.ToString())
                        {
                            bRetVal = true;
                            break;
                        }

                        fc = (IFeatureClass)enumFC.Next();
                    }
                }
            }
            return(bRetVal);
        }
示例#23
0
        public override void doPrintSetup(IPageLayout2 pPageLayout)
        {
            //IMxApplication pMxApp = (IMxApplication)this.App;
            //IMxDocument pMxDoc = (IMxDocument)this.App.Document;
            //ESRI.ArcGIS.esriSystem.IEnumNamedID pEnumNamedID = (ESRI.ArcGIS.esriSystem.IEnumNamedID)pMxApp.Printer.Paper.Forms;

            //IPrinter pPrinter = null;
            //IPaper pPaper = null;
            //IPage pPage = null;
            //IActiveView pActiveView = null;

            //short shPageForm = 0;  // see ms-help://ESRI.EDNv9.2/esricarto/html/esriPaperFormID.htm for IPrinter::FormID constants

            CSpatialSubs   oSpatialSubs = new CSpatialSubs();
            IMxApplication pMxApp       = (IMxApplication)ArcMap.ThisApplication;
            IMxDocument    pMxDoc       = (IMxDocument)ArcMap.Document;
            esriPageFormID pFormID      = esriPageFormID.esriPageFormLetter;

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

            int iPageFormID = 0;   // see http://msdn.microsoft.com/en-us/library/ms776398(VS.85).aspx for IPaper::FormID constants

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

                switch (base.MapSize)
                {
                case "34 x 44":     //34 x 44
                    if (pPrinter.DriverName.ToUpper().Contains("DESIGNJET"))
                    {
                        iPageFormID = oSpatialSubs.getPaperFormID(pPaper, "34 x 44");
                    }
                    else
                    {
                        iPageFormID = 26;
                    }
                    pFormID      = esriPageFormID.esriPageFormE;
                    base.XFactor = 4;
                    base.YFactor = 4;
                    break;

                case "17 x 22":     // 17 x 22
                    if (pPrinter.DriverName.ToUpper().Contains("DESIGNJET"))
                    {
                        iPageFormID = oSpatialSubs.getPaperFormID(pPaper, "17 x 22");
                    }
                    else
                    {
                        iPageFormID = 24;
                    }
                    pFormID      = esriPageFormID.esriPageFormD;
                    base.XFactor = 2;
                    base.YFactor = 2;
                    break;

                case "11 x 17":     // 11 x 22
                    if (pPrinter.DriverName.ToUpper().Contains("DESIGNJET"))
                    {
                        iPageFormID = oSpatialSubs.getPaperFormID(pPaper, "11 x 17");
                    }
                    else
                    {
                        iPageFormID = 17;
                    }
                    pFormID      = esriPageFormID.esriPageFormLegal;
                    base.XFactor = 1.5455;       //1.5455;
                    base.YFactor = 1.2941;       //1.2941;
                    break;

                case "8.5 x 11":     // 8.5 x 11
                    if (pPrinter.DriverName.ToUpper().Contains("DESIGNJET"))
                    {
                        iPageFormID = oSpatialSubs.getPaperFormID(pPaper, "8.5 x 11");
                    }
                    else
                    {
                        iPageFormID = 1;
                    }
                    pFormID      = esriPageFormID.esriPageFormLetter;
                    base.XFactor = 1;
                    base.YFactor = 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.PageLayout.Page.FormID = pFormID;

                IPage pPage = pMxDoc.PageLayout.Page;
                pPage.Orientation = 2;
                pPage.FormID      = esriPageFormID.esriPageFormSameAsPrinter;

                pMxDoc.ActiveView.PrinterChanged(pPrinter);
                pMxDoc.ActiveView.Refresh();


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

                //pPaper = pMxApp.Paper;
                //pPaper.Orientation = 2;
                //pPaper.FormID = (short)iPaperFormID;

                //pPaper.PrinterName = base.PrinterName;

                //pMxDoc.ActiveView.PrinterChanged(pPrinter);

                ////----------------------------------------------------------------------------
                ////Set the layout page size and orientation.
                ////----------------------------------------------------------------------------
                //pPage = pMxDoc.PageLayout.Page;
                //pPage.Orientation = 1;

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

                //pPage.PutCustomSize(dblWidth, dblHeight);

                ////pPage.FormID = esriPaperFormID.esriPageFormSameAsPrinter; // (esriPaperFormID)Enum.Parse(typeof(esriPaperFormID), shPageForm.ToString());
                ////pPage.PageToPrinterMapping = esriPageToPrinterMapping.esriPageMappingScale;

                //pPage.PrinterChanged(pPrinter);

                //pMxApp.Printer = pPrinter;
                ////pMxDoc.PageLayout = (IPageLayout)pPage.;

                //pActiveView = (IActiveView)pMxDoc.ActiveView;
                //pActiveView.Refresh();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("Errors: CLandscapeLayout:doPrintSetup()\r\n" + ex.Message, "Errors occurred", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
            finally
            {
                pMxDoc   = null;
                pPrinter = null;
                pPaper   = null;
            }
        }
示例#24
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();
            }
        }
示例#25
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;
            }
        }
示例#26
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();
            }
        }
示例#27
0
        private void createDataFrame(string sMapName)
        {
            try
            {
                IMxDocument pMxDoc = (IMxDocument)ArcMap.Document;
                IMap        pMap   = new MapClass();
                pMap.Name = sMapName;

                //Dictionary<string, string> dctMapLayers =

                Dictionary <string, string> dctMapLayers = new Dictionary <string, string>();
                switch (sMapName.ToUpper())
                {
                case "ECONOMIC DEVELOPMENT":
                    dctMapLayers = SConst.EconDevLayers;
                    this.loadLayers(ref pMap, dctMapLayers, this.m_EconOnLayers);
                    break;

                case "FIRE":
                    dctMapLayers = SConst.FireLayers;
                    this.loadLayers(ref pMap, dctMapLayers, this.m_FireOnLayers);
                    break;

                case "PLANNING":
                    dctMapLayers = SConst.PlanningLayers;
                    this.loadLayers(ref pMap, dctMapLayers, this.m_PlanOnLayers);
                    break;

                case "POLICE":
                    dctMapLayers = SConst.PoliceLayers;
                    this.loadLayers(ref pMap, dctMapLayers, this.m_PoliceOnLayers);
                    break;

                case "PUBLIC WORKS":
                    dctMapLayers = SConst.PublicWorksLayers;
                    this.loadLayers(ref pMap, dctMapLayers, this.m_PWOnLayers);
                    break;

                default:
                    return;
                }

                //addMapLayers(ref pMap, sMapName);
                IEnvelope pEnv = new EnvelopeClass();
                pEnv.PutCoords(1, 1, 5, 4); // page units

                pMxDoc.Maps.Add(pMap);

                IMapFrame pMapFrame = this.MakeMapFrame(pEnv, pMap);
                pMapFrame.Map.MapUnits = esriUnits.esriFeet;

                IGraphicsContainer pGC = (IGraphicsContainer)pMxDoc.PageLayout;
                pGC.AddElement((IElement)pMapFrame, 0);
                pMxDoc.CurrentContentsView.Refresh(null);

                pMxDoc.UpdateContents();
                Application.DoEvents();

                // activate the frame and zoom to the extent of the UGB
                for (int i = 0; i < pMxDoc.Maps.Count; i++)
                {
                    IMap map = pMxDoc.Maps.get_Item(i);
                    if (map.Name == sMapName)
                    {
                        pMxDoc.ActiveView = (IActiveView)map;

                        //Set the query filter. use the arguements passed into the function
                        ESRI.ArcGIS.Geodatabase.IQueryFilter pQueryFilter = new ESRI.ArcGIS.Geodatabase.QueryFilterClass();
                        pQueryFilter.WhereClause = "CITY = 'Medford'";

                        using (CSpatialSubs oSpatialSubs = new CSpatialSubs())
                        {
                            oSpatialSubs.selectFeatures(pQueryFilter, this.App, (IFeatureLayer)oSpatialSubs.returnFeatureLayer(pMap, "MEDSDE.DBO.Urban_Growth_Boundary"), true);
                        }
                        pMxDoc.FocusMap.ClearSelection();
                    }
                }
                pMxDoc.UpdateContents();
                Application.DoEvents();
            }
            catch (Exception ex)
            {
                string s = ex.Message;
                s += ex.InnerException.Message;
                s += " ";
            }
        }
示例#28
0
        private void fmSearchResults_Shown(object sender, EventArgs e)
        {
            try
            {
                m_bShowHTE = false;
                this.setHTEVisibility();

                this.Cursor = Cursors.WaitCursor;

                //Application.DoEvents();

                ESRI.ArcGIS.ArcMapUI.IMxDocument pMxDoc = (ESRI.ArcGIS.ArcMapUI.IMxDocument) this.App.Document;
                IMap          pMap = (IMap)pMxDoc.FocusMap;
                IFeatureLayer pLayer;

                using (CSpatialSubs oSpatialSubs = new CSpatialSubs())
                {
                    pLayer = (IFeatureLayer)oSpatialSubs.returnFeatureLayer(pMap, SConst.Taxlots);
                }

                ICursor pCurs;

                IFeatureSelection pFSel = (IFeatureSelection)pLayer;
                pFSel.SelectionSet.Search(null, true, out pCurs);

                IFeatureCursor pFCurs = (IFeatureCursor)pCurs;
                IFeature       pFeat  = pFCurs.NextFeature();

                //Application.DoEvents();

                decimal dImpVal  = decimal.Parse(pFeat.get_Value(pFeat.Fields.FindField("IMPVALUE")).ToString());
                decimal dLandVal = decimal.Parse(pFeat.get_Value(pFeat.Fields.FindField("LANDVALUE")).ToString());

                lblAcctNumber.Text   = pFeat.get_Value(pFeat.Fields.FindField("ACCOUNT")).ToString();
                lblFeeOwner.Text     = pFeat.get_Value(pFeat.Fields.FindField("FEEOWNER")).ToString();
                lblImpValue.Text     = (dImpVal).ToString("C");
                lblLandValue.Text    = (dLandVal).ToString("C");
                lblMailingAddr.Text  = pFeat.get_Value(pFeat.Fields.FindField("ADDRESS1")).ToString();
                lblMailingAddr2.Text = pFeat.get_Value(pFeat.Fields.FindField("CITY")).ToString() + "," + pFeat.get_Value(pFeat.Fields.FindField("STATE")).ToString() + " " + pFeat.get_Value(pFeat.Fields.FindField("ZIPCODE")).ToString();
                lblMaplotNumber.Text = pFeat.get_Value(pFeat.Fields.FindField("MAPLOT")).ToString();
                //lblSitusAddr.Text = pFeat.get_Value(pFeat.Fields.FindField("ADDRESSNUM")).ToString() + " " + pFeat.get_Value(pFeat.Fields.FindField("STREETNAME")).ToString();
                lblLocID.Text = this.LocationID.ToString();

                lblPropClass.Text     = pFeat.get_Value(pFeat.Fields.FindField("PROPCLASS")).ToString();
                lblPropClassDesc.Text = CMedToolsSubs.returnPropClassDescription(pFeat.get_Value(pFeat.Fields.FindField("PROPCLASS")).ToString(), CMedToolsSubs.getPropClass());

                string sFormattedTaxCode = CMedToolsSubs.returnTaxCodeFormatted(pFeat.get_Value(pFeat.Fields.FindField("TAXCODE")).ToString());

                lblTaxcode.Text = sFormattedTaxCode;
                string[] aTaxCodeInfo = CMedToolsSubs.returnTaxCodeInfo(sFormattedTaxCode, CMedToolsSubs.getTaxCodes());

                if (aTaxCodeInfo != null)
                {
                    lblTaxCodeCity.Text       = aTaxCodeInfo[0].ToString();
                    lblTaxCodeSchool.Text     = aTaxCodeInfo[1].ToString();
                    lblTaxCodeWater.Text      = aTaxCodeInfo[2].ToString();
                    lblTaxCodeUrbanRenew.Text = aTaxCodeInfo[3].ToString();
                    lblTaxCodeFireDist.Text   = aTaxCodeInfo[4].ToString();
                }
                else
                {
                    lblTaxCodeCity.Text       = "";
                    lblTaxCodeSchool.Text     = "";
                    lblTaxCodeWater.Text      = "";
                    lblTaxCodeUrbanRenew.Text = "";
                    lblTaxCodeFireDist.Text   = "";
                }

                //getLXInfo(pFeat.get_Value(pFeat.Fields.FindField("ACCOUNT")).ToString(), pFeat.get_Value(pFeat.Fields.FindField("MAPNUM")).ToString(), pFeat.get_Value(pFeat.Fields.FindField("TAXLOT")).ToString());

                //Application.DoEvents();

                if (this.LocationID < 1)
                {
                    if (SConst.GotDBConn)
                    {
                        // this should be a Medford Address
                        using (CData oData = new CData(SConst.LXConnString.ToString()))
                        {
                            lblSitusAddr.Text = oData.returnSitusAddressByLocID(this.LocationID);
                        }
                    }
                    //else
                    //tabControl1.Enabled = false;
                }
                else
                {
                    // this should be a county address
                    lblSitusAddr.Text = pFeat.get_Value(pFeat.Fields.FindField("ADDRESSNUM")).ToString() + " " + pFeat.get_Value(pFeat.Fields.FindField("STREETNAME")).ToString();
                    //tabControl1.Enabled = false;
                }

                this.Cursor = Cursors.Default;
                //Application.DoEvents();
            }
            catch (Exception ex)
            {
                string s = ex.Message;
                s += "- --- that was it";
            }
        }