Beispiel #1
0
        /// <summary>
        /// Check the
        /// </summary>
        /// <returns></returns>
        private bool CheckRowColValue()
        {
            ILayer layer = ArcMapApp.GetRasterLayer();

            if (layer == null)
            {
                return(false);
            }

            int row = 0;
            int col = 0;

            if (!int.TryParse(rowIndexTextBox.Text, out row) ||
                !int.TryParse(colIndexTextBox.Text, out col))
            {
                return(false);
            }

            IRasterLayer rasterLayer = (IRasterLayer)layer;
            IRasterProps rasterProps = (IRasterProps)rasterLayer.Raster;

            if (row < 1 || row > rasterProps.Height || col < 1 || col > rasterProps.Width)
            {
                return(false);
            }

            return(true);
        }
Beispiel #2
0
 private void flashingToolStripButton_Click(object sender, EventArgs e)
 {
     try
     {
         int row = int.Parse(rowIndexTextBox.Text) - 1;
         int col = int.Parse(colIndexTextBox.Text) - 1;
         Display.FlashSelection(new Position(col, row), 500, ArcMapApp.GetRasterLayer());
     }
     catch (Exception ex)
     {
         MessageBox.Show(string.Format("Unfortunately, the application meets an error.\n\nSource: {0}\nSite: {1}\nMessage: {2}", ex.Source, ex.TargetSite, ex.Message), "Error");
     }
 }
Beispiel #3
0
        void rowIndexTextBox_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar != (char)Keys.Enter)
            {
                return;
            }

            if (CheckRowColValue())
            {
                try
                {
                    int row = int.Parse(rowIndexTextBox.Text) - 1;
                    int col = int.Parse(colIndexTextBox.Text) - 1;
                    Display.FlashSelection(new Position(col, row), 500, ArcMapApp.GetRasterLayer());
                }
                catch (Exception ex)
                {
                    MessageBox.Show(string.Format("Unfortunately, the application meets an error.\n\nSource: {0}\nSite: {1}\nMessage: {2}", ex.Source, ex.TargetSite, ex.Message), "Error");
                }
            }
        }
Beispiel #4
0
        private void addSelectionToolStripButton_Click(object sender, EventArgs e)
        {
            try
            {
                int row = int.Parse(rowIndexTextBox.Text) - 1;
                int col = int.Parse(colIndexTextBox.Text) - 1;

                if (!Editor.Selections.Exists(col, row))
                {
                    Pixel pixel = new Pixel(new Position(col, row));
                    pixel.GraphicElement = Display.DrawBox(pixel.Position, Editor.GetSelectionSymbol(), ArcMapApp.GetRasterLayer(), true);
                    Editor.Selections.Add(pixel);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("Unfortunately, the application meets an error.\n\nSource: {0}\nSite: {1}\nMessage: {2}", ex.Source, ex.TargetSite, ex.Message), "Error");
            }
        }
Beispiel #5
0
 /// <summary>
 /// Inidcate the input file have already loaded into the ArcMap.
 /// </summary>
 private void inputRasterComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     editLayer = (IRasterLayer)ArcMapApp.GetLayer(inputRasterComboBox.Text);
     ShowExtent(editLayer);
 }
Beispiel #6
0
        /// <summary>
        /// Select the reference file loaded in the ArcMap.
        /// </summary>
        private void outputExtentComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            IRasterLayer rasterLayer = (IRasterLayer)ArcMapApp.GetLayer(outputExtentComboBox.Text);

            ShowExtent(rasterLayer);
        }