示例#1
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);
            }
        }
示例#2
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));
            }
        }
示例#3
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 += " ";
            }
        }
示例#4
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";
            }
        }