Text Box: Pixel Editor PX1.0                                                                                   

Ajay Prasad

ajayprasad@cc.usu.edu

 

*       Technology

*       Why Pixel Editor?

*       Design

*       Interface

*       Getting Started

*       Acknowledgement and Reference

 

Technology

 

 “The Component Object Model (COM) is a software architecture that allows the components made by different software vendors to be combined into a variety of applications. COM defines a standard for component interoperability, is not dependent on any particular programming language, is available on multiple platforms, and is extensible.”

The Microsoft Component Object Model (COM) is a platform-independent, distributed, object-oriented system for creating binary software components that can interact.

To understand COM (and therefore all COM-based technologies), it is crucial to understand that it is not an object-oriented language but a standard. Nor does COM specify how an application should be structured; language, structure, and implementation details are left to the application programmer. Rather, COM specifies an object model and programming requirements that enable COM objects (also called COM components, or sometimes simply objects) to interact with other objects. These objects can be within a single process, in other processes, and can even be on remote machines. They can have been written in other languages, and they may be structurally quite dissimilar, which is why COM is referred to as a binary standard—a standard that applies after a program has been translated to binary machine code.

 

Introduction to ArcObjects

ArcObjects™ is the development platform for the ArcGIS™ family of applications such as ArcMap™, ArcCatalog™, and ArcScene™. The ArcObjects software components expose the full range of functionality available in ArcInfo™ and ArcView ® to software developers.

ArcObjects is a framework that lets you create domain-specific components from other components. The ArcObjects components collaborate to serve every data management and map presentation function common to most GIS applications. ArcObjects provides an infrastructure for application customization that lets you concentrate on serving the specific needs of your clients.

The ArcObjects Framework

ArcObjects is built using Microsoft’s Component Object Model (COM) technology. Therefore, it is possible to extend ArcObjects by writing COM components using any COM-compliant development language. You can extend every part of the ArcObjects architecture in exactly the same way as ESRI developers do.

 

Top

Why Pixel Editor?

 

In ArcMap Pixel values of a Raster Layer were unable to edit at a desired coordinate. The attribute table gives the Object id, Value and the count of the pixel which makes the user impossible to find and edit the pixels at a point.

PX 1.0

Ø        Enables display and editing Pixel value at desired point in a raster layer on mouse click

Ø        Update the symbology to stretched category with new pixel values.

Ø        Track the edit history.

Top

 

Design

 

ArcObjects Used

ESRI Object Library as Visual Basic reference

1.     ICommand                     

Ø        Provides access to members that define a COM command.

Ø        To query the properties of a COM command or to create your own COM command.

Ø        ICommand interface sets command properties such as caption, name, category, bitmap, status bar message, tool tip, help context id and help file, enabled state, and checked state. It also defines what action happens when the command is clicked.

 

2.     ITool

Ø        Provides access to members that define a tool.

Ø        To query the properties of a built-in tool or to create your own COM tool.

Ø        With the ITool interface you can define what occurs on events such as mouse move, mouse button press/release, keyboard key press/release, double-click, and right click.

 

3.     IMap

Ø        Provides access to members that control the map.

Ø        To display data from various data sources.

Ø        Use IMap to add, delete, and access map layers containing data from various sources including feature layers and graphics layers; associate map surround objects (legends, scale bars, etc) with the Map; access the various properties of a Map including the area of interest, the current map units, and the spatial reference; select features and access the Map's current selection.

 

4.     IEnvelope

Ø        Provides access to methods and properties of envelopes.

Ø        Envelope is defined by the XMin, XMax, YMin, and YMax of the object.

 

5.     IPoint

Ø        Provides access to members that define two dimensional points.  

Ø        Point represents a specific (X, Y) location in a two-dimensional XY-Plane.  A Point may also have Z, M, and ID attributes associated with it.  

 

Key Visual Basic Functions and Methods Used in the program.

  1. setDocMap

Ø        Sets document’s focus map.

Ø        Finds all the raster layers in the map and populates them into a dropdown list.

 

  1.  Map2Dataset

Ø        Converts X and Y coordinate in the Map to Column number and Row number of the Pixel Block of the Raster Layer.

 

  1. showPixelMap

Ø        Reads the Pixel values from the Raster layer starting from the top left of the

     3 x 3 Pixel block.

Ø        Displays the read Pixel values in a 3 x 3 table with the central cell pointing the pixel you clicked.

 

  1. cmdSave_Click

Ø        Write the new pixel values to the Raster Layer starting from the Top left of the 3 x 3 pixel block.

Ø        Writes Edit information to History.

Ø        Refreshes the Map to show the new Pixel values.

 

  1. updateSymbology

Ø        Updates the Symbology to stretched category with new pixel values (Optional)

 

  1. cmdZoomin_Click

Ø        Converts Column and Row using the function “DataSet2Map” to Data points(X, Y) in the map.

Ø        Zooms in to that particular X-Y Coordinate.

 

  1. DataSet2Map

Ø        Converts Column and Row displayed to X-Y coordinates in the Map.

 

Source code available on request

Top

 

Interface

Pixel Table

 

Ø                                            Pixel Table: Displays the pixel values at the point of mouse click. Center cell holds the mouse click pixel and other 8 cells the surrounding pixels. Values in the cells can be replaced with desired values.

 

Ø                                            Write: Write button click will overwrite the present pixel values in the Raster Layer with new Pixel values.

 

Ø                                            Reset: Reset Button resets the values with old one. This helps you to undo edit

 

Ø                                            Layer list: Choose the raster layer from the drop down list you want to edit. The entire Raster layers in the map will be populated in the drop down list.

 

Ø                                            Column: Column filed displays the number of columns of pixels from left to the selected or clicked pixel.

 

Ø                                            Row: Row field displays the number of Rows of pixels from top to the selected or clicked pixel.

 

Ø                                            Go: Go button enables you to find a pixel on a particular column and row. You can change the Column number and Row number and click go button to find the pixel on the map.

 

Ø                                            Zoom in: Zoom in button helps you to zoom in to the pixel you have selected in the Column and Row field.

 

Ø                                            Zoom out: Zooms out to the map extent.

 

Ø                                            History: Shows the edit history done using the PX 1.0 tool which enables to track the pixel values.

 

Ø                                            Update: Updates Symbology to Stretched Category when you write the new pixel values

Top

 

Getting Started

 

1.      Adding the tool

Ø              Download PX1.dll and save it in a folder in C drive.

Ø              Open ArcMap.

Ø              Click “Tools” menu and click “Customize”

Ø              Navigate to the DLL file containing the custom command, toolbar, or menu (PX1.dll).

Ø              Click the file and click Open.
The Added Objects dialog box appears, reporting which new objects have been registered with ArcMap.

Ø              Click OK.
The DLL has been registered on your computer and the command, toolbar, and menu components contained in the DLL have been added to the proper component categories.

Ø              Click and drag the command or menu from the Commands list and drop it on the toolbar.

Ø              Click Close.

 

1.                              Open an ArcMap document with raster layers or add raster layers

You wish to edit.

2.                              Click pixel editor icon  and the mouse cursor will change to cross

 

3.                              Click on the point or the coordinate of the map where you want to edit pixel values.

Black spot indicates the point where you clicked

 

 

4.                              Change the values and click write to write down the new values.

 

5.                              Click Zoom button to Zoom in to the point you clicked(Black spot)

 

6.                              On closing the tool you are asked if you want to save all the changes you have made. Click “Yes” to save all edits.

 

7.                              Click “History” menu and “Show History”. History window pops up. Click “Clear History” menu to clear all.

 

Top

Acknowledgement and Reference

 

Ø        Dr David G Tarboton

§         Professor, Civil and Environmental Engineering

§         Utah State University

 

Ø        Exploring ArcObjects Vol. I and II

§         Geographic Data Management – Edited by Michael Zeiler

§         GIS by ESRI TM

 

Ø        http://arcobjectsonline.esri.com/

 

Ø        MSDN Library Visual Studio 6.0

 

Ø        www.msdn.com

 

 

Top