Problem Solving with ArcObjects - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

Problem Solving with ArcObjects

Description:

... new fields in attribute table ... the correct object model diagram (for creating a new field) ... Set thefeature = thefeaturecursor.NextFeature. Wend ... – PowerPoint PPT presentation

Number of Views:28
Avg rating:3.0/5.0
Slides: 14
Provided by: bhedq
Category:

less

Transcript and Presenter's Notes

Title: Problem Solving with ArcObjects


1
Problem Solving with ArcObjects
  • Brent Hedquist
  • GIS III
  • Lab 3 Part 2

2
Describe the problem in ArcObjects terms
  • Add x and y coordinates to attribute table of the
    selected point layer.

3
Identify Subtasks
  • Subtask 1 Define the document and layer in use
  • Subtask 2 Create a feature class and import
    selected layer
  • Subtask 3 Create new fields in attribute table
  • Subtask 4 Find the first feature, then the
    extent of each point.
  • Subtask 5 Add the position of each point and
    save, then repeat as necessary until ending loop.

4
Decide where to write code
  • VBA Macro in ArcGIS application using a
    UIButtonControl click option.

5
Find an existing sample or recommended methodology
Procedure on how to put X and Y coordinates in
context
6
Find an existing sample or recommended methodology
Question regarding X,Y coordinates answered On
ESRI Listserv
7
Part Two 1) Identify a Subtask
  • Create new fields in attribute table

Subtask 3 code Dim xfield As IFieldEdit Dim
yfield As IFieldEdit Set xfield New Field Set
yfield New Field With xfield .Type 3 .name
"XFIELD" End With With yfield .Type 3 .name
"YFIELD" End With   theFC.AddField
xfield theFC.AddField yfield
Keywords New Field, Add Field
8
3. Search for the correct object model diagram
(for creating a new field)
9
Search for the correct object model diagram (for
creating a new field)
10
Review the documentation
11
Part Three Navigate the Object Model Diagram
Review the structure of the object model diagram
12
Trace the flow between
classes
Dim xfield As IFieldEditDim yfield As
IFieldEditSet xfield New FieldSet yfield
New Field
Create new x and y fields in attribute table
Definitions
Addfield object.addfield adds field to this
object class
theFC.AddField xfield theFC.AddField yfield
13
Subtask 5 Add the position of each point and
save, then repeat as necessary until ending loop
Dim indexX As Long indexX theFC.FindField("XFIEL
D") Dim indexY As Long indexY
theFC.FindField("YFIELD") thefeature.Value(index
X) xcoor 'thefeature.Store thefeature.Value(inde
xY) ycoor thefeature.Store Set thefeature
thefeaturecursor.NextFeature Wend end
while loop
Definitions
Store object.store stores the row FindField
object.FindField the index of the field with
the specified name
Write a Comment
User Comments (0)
About PowerShow.com