Pixel Editor PX 1.0 Ajay Prasad.

Slides:



Advertisements
Similar presentations
WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
Advertisements

Using VB with MS Applications R. Juhl, Delta College.
JTX Overview Overview of Job Tracking for ArcGIS (JTX)
Introduction to GIS and ArcGIS How a GIS works Introduction to ArcGIS The ArcGIS Interface.
Unit One: GIS Concepts In this unit… ► What is GIS? ► Types of GIS data ► What can you do with GIS? ► ArcGIS 9 license levels ► Basics of the ArcGIS 9.
Macros Tutorial Week 20. Objectives By the end of this tutorial you should understand how to: Create macros Assign macros to events Associate macros with.
ArcView Documents Francisco Olivera, Ph.D., P.E. Department of Civil Engineering Texas A&M University.
ESRM 250/CFR 520 Winter 2010 Phil Hurvitz (with thanks to J. Lawler & P. Schiess) Introduction to GIS and ArcGIS 1 of 48.
GISC 6382 Applied GIS UT-Dallas Briggs 1 Customizing ArcGIS Spring 2008.
Rebecca Boger Earth and Environmental Sciences Brooklyn College.
Introduction To ArcMap ArcMa p. ArcMap is a Map-centric GUI tool used to perform map-based tasks Mapping –Create maps by working geographically and interactively.
Adv_GISArcObjects - 11 VBA and ArcObjects Fall 2003 Advanced GIS.
Introduction to Spatial Analysis and Spatial Modeling
A New Generation GIS for the Classroom ArcGIS 9.0 A New Generation GIS for the Classroom.
Adv_GISArcObjects - 11 VBA and ArcObjects Programming Week 1 Spring 2008 Advanced GIS.
9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor- intensive sequence of steps. Automating a GIS makes it possible.
Introduction to ArcView NPS Introduction to GIS: Lecture 2 Based on NINC, ESRI and Other Sources.
Automatic Turntable Calculation Tool Melissa J Rura CE 508 Dr. Shan 10/29/2004.
Attributes in ArcGIS. ArcGIS Attributes FID – ESRI’s internal identifier Shape – Actual spatial data.
ATN GIS Support ArcGIS: ArcMap Data View.
Data Visualization Francisco Olivera, Ph.D., P.E. Srikanth Koka Department of Civil Engineering Texas A&M University.
Chapter 12 Making Tools Week 7 Fall Tools (events) besides Click MouseDown, MouseUp, MouseMove CursorID defines mouse appearance Eabled to disable.
Project 5 : programming ArcObject with VBA Part I Vector data Sherry Fu CE 697V Nov. 30, 2006.
Slide 1 Using Menu Bar & Common Dialog Boxes. Slide 2 Setting Up the Main Items v First open the form on which you want the menu located v Then start.
Towards Unifying Vector and Raster Data Models for Hybrid Spatial Regions Philip Dougherty.
Scale is the relationship between the size of features on a map and the size of the corresponding objects in the real world. Scale is commonly expressed.
Sharing Maps and Layers to Portal for ArcGIS Melanie Summers, Tom Shippee, Ty Fitzpatrick.
Dive Into® Visual Basic 2010 Express
Component Object Model(COM)
Extending ArcGIS via programming
Chapter 2: The Visual Studio .NET Development Environment
Working in the Forms Developer Environment
Lecture 3 Interacting with Data.
“Under the hood”: Angry Birds Maze
DRAWING LINES To draw lines click View in the Main Menu Toolbar -> Toolbars and check the Editor option. The Editor toolbar will appear amongst the toobars.
Lab 1 Introduction to ArcGIS Feb 17, 2016
Geography 385 Introduction to ArcGIS Web Application Design
Chapter 8: Writing Graphical User Interfaces
PYTHON: AN INTRODUCTION
ArcGIS Topology Shapefiles, Coverages, Geodatabases
Introduction to GIS Review CGIS-NURIntroduction to ArcGIS I.
Development of Linear Measure Tool using Application Framework
1. Introduction to Visual Basic
Hazards Planning and Risk Management INTRODUCTION TO ARCGIS
Introduction to ArcGIS Add-Ins
COSC-4840 Software Engineering
Introduction to ArcGIS
Downloading and Preparing GIS Precipitation Data Layers
Design and Consume DataWindows in Visual Studio 2005
BIOL 347: Microbiology Exploring The Geographic Information Systems (GIS) Applications for Health Science Dr. Maruthi Sridhar B. Bhaskar Department of.
Writing Geoprocessing Scripts With ArcGIS
Writing Geoprocessing Scripts With ArcGIS
Chapter 2 – Introduction to the Visual Studio .NET IDE
Lecture 4 An example for changing a layer’s Name
Exploring Microsoft Excel
Using VB Active-X components to customize a new tool on ArcMap
CIS16 Application Development Programming with Visual Basic
Tutorial 6 Creating Dynamic Pages
Introduction To ArcMap
Automating and Validating Edits
Exploring the Power of EPDM Tasks Working with and Developing Tasks in SolidWorks Enterprise PDM (EPDM) By: Marc Young xLM Solutions
Exploring Microsoft® Office 2016 Series Editor Mary Anne Poatsy
8. ArcScan 8.1 Interactive vectorization 8.2 Automatic vectorization
Unit J: Creating a Database
Chapter 4 Enhancing the Graphical User Interface
Survey Results Respondents: 39 of 51 – 76%
ArcGIS Pro: An Introduction Overview
Presentation transcript:

Pixel Editor PX 1.0 Ajay Prasad

Agenda Utility Terminology Design Interface Future Reference PX 1.0

Terminology “The Component Object Model (COM) is a software architecture that allows applications to be built from binary software components. COM is the underlying architecture that forms the foundation for higher-level software services, like those provided by OLE (Object Linking and Embedding). OLE services span various aspects of commonly needed system functionality, including compound documents, custom controls, interapplication scripting, data transfer, and other software interactions. “ Client Process On the same machine Server Process Component COM Client PX 1.0

ArcObjects Terminology ArcObjects™ is the development platform for the ArcGIS™ family of applications such as ArcMap™, ArcCatalog™, and ArcScene™ ArcObjects is a framework that lets you create domain-specific components from other components. ArcObjects provides an infrastructure for application customization that lets you concentrate on serving the specific needs of your clients. ArcObjects is built using Microsoft’s Component Object Model (COM) technology. PX 1.0

Key ArcObjects Used….. ICommand ITool IMap IEnvelope IPoint Terminology ESRI Object Library as project reference 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. 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. IMap Provides access to members that control the map. To display data from various data sources. IEnvelope Provides access to methods and properties of envelopes. Envelope is defined by the XMin, XMax, YMin, and YMax of the object. IPoint Provides access to members that define two dimensional points.   Point represents a specific (X, Y) location in a the two-dimensional XY-Plane.  A Point may also have Z, M, and ID attributes associated with it.  PX 1.0

Key Sub Routines and Functions… Design Function setDocMap(mApp As IApplication) As IRaster Sets document’s focus map and finds Raster layers present Sub Map2Dataset(ByVal pMapPoint As IPoint) Converts pMapPoint.X and pMapPoint.Y to Column number and Row number Public Sub showPixelMap(pRaster As IRaster, pPoint As IPoint) Reads the Pixel values from the Raster layer and displays in 3 X 3 Table. Private Sub cmdSave_Click() Write the new pixel values to the Raster Layer. Private Sub updateSymbology() Updates the Symbology to stretched category with new pixel values (Optional) PX 1.0

The Tool Interface Raster Layers in the map Shows “Edit history” Zoom out to the Extent Get the Pixel values around specified Row and Column Zoom to the Column and Row Pixel Values Overwrite values with new one Reset with old values Change Symbology to Stretched Category PX 1.0

Significance Utility Attribute Table Unable to edit value of the pixel at a particular coordinate. PX 1.0 enables edit feature at desirable coordinates. PX 1.0

Rows and Columns of the Pixel Display Table can be modified Version “ PX 1.1 ” Future Rows and Columns of the Pixel Display Table can be modified Test with different data types and grids To be compatible with MapWindow 3.0 More utilities which helps users to do the edits more efficiently Suggestions and Feedback from users PX 1.0

Acknowledgment 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/ PX 1.0

PX 1.0

PX 1.0

Object Linking and Embedding Terminology An object system created by Microsoft. OLE lets the author invoke different editor components to create a compound document. Microsoft's comprehensive object strategy is built around the OLE object model and is designed to provide developers with a consistent and open standard for defining what an object is and how objects interact with one another. OLE technology is now an integral part of custom controls, creating a new open standard for component-based software development. PX 1.0

ICommand and ITool Terminology 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. When you are creating a new COM tool, you need to implement both the ICommand interface and the ITool interface in your class code. 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. PX 1.0

IEnvelope Terminology PX 1.0

IPoint Terminology PX 1.0

IMap Terminology The IMap interface is a starting point for many of the tasks one does with a Map. 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. PX 1.0

setDocMap Design Function setDocMap(mApp As IApplication) As IRaster 'no input raster Set pMxDoc = mApp.Document Set pActiveView = pMxDoc.FocusMap Set pMap = pMxDoc.FocusMap Set pEnumLayer = pMap.Layers Set pLayer = pEnumLayer.Next If isloaded = False Then If TypeOf pLayer Is IRasterLayer Then Set pRLayer = pLayer pathName = pRLayer.FilePath Set setDocMap = pRLayer.Raster End If Else Dim i As Integer cboItem = IIf(frmPixelMap.cboRasterLayers.ItemData(frmPixelMap.cboRasterLayers.ListIndex) < 0, 1, frmPixelMap.cboRasterLayers.ItemData(frmPixelMap.cboRasterLayers.ListIndex)) pEnumLayer.Reset For i = 0 To cboItem If TypeOf pLayer Is IRasterLayer Then Set pLayer = pEnumLayer.Next Next popCombo End Function End Sub PX 1.0

Map2Dataset Design Sub Map2Dataset(ByVal pMapPoint As IPoint) On Error GoTo myErr Dim pRasProp As IRasterProps Dim nx As Double, ny As Double Dim a1 As Double, b1 As Double, a2 As Double, b2 As Double If pMapPoint Is Nothing Then MsgBox "Map point object is null", vbCritical, "Raised Error" Exit Sub End If Set pRasProp = pRas g_Wid = pRasProp.Width g_Hgt = pRasProp.Height Dim pEnv As IEnvelope Set pEnv = pRasProp.Extent pEnv.QueryCoords g_ex1, g_ey1, g_ex2, g_ey2 nx = g_Wid ny = g_Hgt a1 = (nx) / (g_ex2 - g_ex1) ' # of pixels / map unit -- for x-axis b1 = -g_ex1 * a1 a2 = (ny) / (g_ey2 - g_ey1) ' # of pixels / map unit -- for y-axis b2 = -g_ey1 * a2 PX 1.0

……………………. Design '/////For zoom in purpose ac1 = a1 ac2 = a2 bc1 = b1 Dim pDataPoint As IPoint Set pDataPoint = New Point Dim v As Long pDataPoint.X = Int(pMapPoint.X * a1 + b1) 'the number of rows to the point v = Int(pMapPoint.Y * a2 + b2) pDataPoint.Y = g_Hgt - v - 1 'number of columns to the point Set pMapPoint = pDataPoint frmPixelMap.Show frmPixelMap.ZOrder (0) frmPixelMap.showPixelMap pRas, pMapPoint isloaded = True Set pDataPoint = Nothing myErr: If Err.Number <> 0 Then MsgBox "Map2Dataset:" & Err.Description End Sub PX 1.0

showPixelMap Design Public Sub showPixelMap(pRaster As IRaster, pPoint As IPoint) ' Dim pRaster As IRaster Dim vArr As Variant On Error GoTo er Screen.MousePointer = vbHourglass ' get current band index Dim pRD As IRasterDataset Dim pBC As IRasterBandCollection Set pRD = OpenRasterDataset(pathName) Set pBC = pRD Set g_pEditBand = pBC.Item(0) Set g_pTrans = g_pEditBand g_Edits = 0 g_pTrans.UndoLevels = 5 Set pRasterProp = pRaster ' create pixelblock the size of the input raster Set pSize = New DblPnt pSize.SetCoords 3, 3 Set pPixelBlock = pRaster.CreatePixelBlock(pSize) Set pRawPixel = g_pEditBand ' get vb supported pixel type ' pRasterProp.PixelType = GetVBSupportedPixelType(pRasterProp.PixelType) ' get pixeldata xCell = pPoint.X yCell = pPoint.Y 'showing Rows and columns txtColumn = xCell txtRow = yCell Set pOrigin = New DblPnt pOrigin.SetCoords pPoint.X - 1, pPoint.Y - 1 pRawPixel.Read pOrigin, pPixelBlock vArr = pPixelBlock.SafeArray(0) PX 1.0

………………….. Design ' show pixel data in the grid Dim inc As Integer For irow = 0 To 2 ' set cell size For icol = 0 To 2 txtEdit.Item(inc) = IIf(vArr(icol, irow) >= 0, FormatNumber(vArr(icol, irow), 6), "Nodata") resetValues(inc) = txtEdit.Item(inc) inc = inc + 1 Next icol Next irow ' cleanup Set pRaster = Nothing Set pRasterProp = Nothing Set pSize = Nothing Set pOrigin = Nothing Screen.MousePointer = vbDefault Exit Sub er: If Err.Number <> 0 Then MsgBox "Failed to get pixel data: " & Err.Description For inc = 0 To 8 txtEdit.Item(inc) = "" Next End If End Sub PX 1.0

cmdSave_Click() Design Private Sub cmdSave_Click() On Error GoTo catchError Dim pSafeArray As Variant, irow As Integer, icol As Integer Dim pBandCol As IRasterBandCollection Dim pBand As IRasterBand Dim X As Integer, Y As Integer, i As Integer For i = 0 To 8 If IsNumeric(txtEdit(i)) = False Then MsgBox "Invalid number.", vbExclamation + vbOKOnly Exit Sub End If Next i pSafeArray = pPixelBlock.SafeArray(0) ' set cell size X = xCell Y = yCell Dim inc As Integer inc = 0 For irow = 0 To 2 For icol = 0 To 2 pSafeArray(icol, irow) = FormatNumber(txtEdit.Item(inc), 6) inc = inc + 1 Next icol Next irow PX 1.0

………………… Design 'create a dblpnt Dim pPnt As IPnt Set pPnt = New DblPnt g_pTrans.Start pPnt.SetCoords xCell - 1, yCell - 1 pRawPixel.Write pPnt, pPixelBlock '///////////////////////////////////////////////////////// If chkUpdateSymbology.Value = 1 Then updateSymbology '/////////////////////////////////////////////////////// pActiveView.PartialRefresh esriViewGeography + esriViewGraphics, Nothing, Nothing If chkUpdateSymbology.Value = 1 Then pMxDoc.UpdateContents g_Edits = g_Edits + 1 g_pTrans.End Exit Sub catchError: helloError Err.Number, Err.Description End Sub PX 1.0

updateSymbology() Design Private Sub updateSymbology() Dim pRenLayer As IRasterLayer Set pRenLayer = pMap.Layer(IIf(cboRasterLayers.ListIndex > -1, cboRasterLayers.ItemData(cboRasterLayers.ListIndex), 0)) Dim pRaster As IRaster Set pRaster = pRenLayer.Raster ' Create renderer and QI RasterRenderer Dim pStretchRen As IRasterStretchColorRampRenderer Set pStretchRen = New RasterStretchColorRampRenderer Dim pRasRen As IRasterRenderer Set pRasRen = pStretchRen ' Set raster for the renderer and update Set pRasRen.Raster = pRaster pRasRen.Update ' Define two colors Dim pFromColor As IColor Dim pToColor As IColor Set pFromColor = New RgbColor pFromColor.RGB = RGB(255, 0, 0) Set pToColor = New RgbColor pToColor.RGB = RGB(0, 255, 0) Create color ramp Dim pRamp As IAlgorithmicColorRamp Set pRamp = New AlgorithmicColorRamp pRamp.Size = 255 pRamp.FromColor = pFromColor pRamp.ToColor = pToColor pRamp.CreateRamp True PX 1.0

……………………….. Design ' Plug this colorramp into renderer and select a band pStretchRen.BandIndex = 0 pStretchRen.ColorRamp = pRamp ' Update the renderer with new settings and plug into layer pRasRen.Update Set pRenLayer.Renderer = pStretchRen End Sub ' PX 1.0