Example #1
0
        private void btnFind_Click(object sender, EventArgs e)
        {
            if (txtThomasBrothersPage.Text == " " || txtThomasBrothersColumn.Text == " " || txtThomasBrothersRow.Text == " ")
            {
                MessageBox.Show("Invalid Thomas Brothers Page, Row, or Column Entered.", "Error On Search");
            }
            else
            {
                this.Cursor = Cursors.WaitCursor;
                IFeatureLayer pFL;
                commonsubs    comSub = new commonsubs();
                IMxDocument   pMxDoc = ArcMap.Document;
                IMap          pMap   = pMxDoc.FocusMap;
                ILayer        player = null;
                string        swhere = "";
                string        ermsg  = "";

                //Determine if it is the page or the tile
                if (txtThomasBrothersColumn.Text == "" && txtThomasBrothersRow.Text == "")
                {
                    player = comSub.LoopThroughLayersOfSpecificUID(pMap, "{40A9E885-5533-11D0-98BE-00805F7CED21}", "SANGIS.GRID_PAGE_TB");
                    swhere = "PAGE = '" + txtThomasBrothersPage.Text + "'";
                    ermsg  = "The Page entered was now found";
                }
                else
                {
                    player = comSub.LoopThroughLayersOfSpecificUID(pMap, "{40A9E885-5533-11D0-98BE-00805F7CED21}", "SANGIS.GRID_TILE_TB");
                    swhere = "PAGE = '" + txtThomasBrothersPage.Text + "' AND ROW_ = '" + txtThomasBrothersRow.Text + "' AND COLUMN_ = '" + txtThomasBrothersColumn.Text.ToUpper() + "'";
                    ermsg  = "The Page, Column, and Row combination entered was now found";
                }

                //Run the search
                int       selcount  = 0;
                IEnvelope pEnvelope = new EnvelopeClass();
                pEnvelope.SetEmpty();
                if (player != null)
                {
                    pFL      = player as IFeatureLayer;
                    selcount = comSub.SelectMapFeaturesByAttributeQuery(pMxDoc.ActiveView, pFL, swhere);
                    if (selcount > 0)
                    {
                        player.Visible = true;
                        comSub.zoomtoselected(player, pEnvelope);
                        System.Diagnostics.Debug.WriteLine(player.Name);
                    }
                    else
                    {
                        MessageBox.Show(ermsg, "Please try another selection");
                    }
                }
                ResetTBForm();
                this.Cursor = Cursors.Default;
            }
        }
Example #2
0
        private void btnFind_Click(object sender, EventArgs e)
        {
            commonsubs    comSub = new commonsubs();
            IMxDocument   pMxDoc = ArcMap.Document;
            IMap          pMap   = pMxDoc.FocusMap;
            IFeatureLayer pFL;
            int           selcount  = 0;
            IEnvelope     pEnvelope = new EnvelopeClass();

            pEnvelope.SetEmpty();
            ILayer player = comSub.LoopThroughLayersOfSpecificUID(pMap, "{40A9E885-5533-11D0-98BE-00805F7CED21}", "SANGIS.GRID_SANGIS");

            if (player != null)
            {
                pFL      = player as IFeatureLayer;
                selcount = comSub.SelectMapFeaturesByAttributeQuery(pMxDoc.ActiveView, pFL, "FLD_BK_PG = '" + txtFBP.Text.ToUpper() + "'");
                if (selcount > 0)
                {
                    comSub.zoomtoselected(player, pEnvelope, cboQuardrant.Text);
                    System.Diagnostics.Debug.WriteLine(player.Name);
                }
            }
        }