/// <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); }
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"); } }
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"); } } }
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"); } }
/// <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); }
/// <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); }