In actual business needs, you may need to store all the nodes of the spatial element to the attribute field according to certain rules, then, use the following business logic to process the coordinate information of these nodes. Finally, the graphic information is changed through the node information changes in these data fields. I used python to conduct a preliminary study on this business method.
1. Write the node information to the attribute field first.
Import string, OS, sys, locale, arcgisscripting
Gp = arcgisscripting. Create ()
GP. overwriteoutput = 1
Msgnotenoughparams = "incorrect number of input parameters ."
Msgusevaliddecimalpointsep = "Please use one of the valid decimal point separators ."
Try:
If Len (SYS. argv) <2: Raise exception, msgnotenoughparams
Inputfc = SYS. argv [1]
Cf = SYS. argv [2]
TMP = STR (CF)
Indesc = GP. Describe (inputfc)
Inrows = GP. updatecursor (inputfc)
Inrow = inrows. Next ()
Outline =''
Flag = false
Partflag = true
While inrow:
Feat = inrow. getvalue (indesc. shapefieldname)
If indesc. shapetype. Lower () = "point ":
PNT = feat. getpart ()
Outline = "{" + STR (PNT. x) + "," + STR (PNT. y) + "," + STR (PNT. z) + "," + STR (PNT. m) + ";"
Elif indesc. shapetype. Lower () = "multipoint ":
Partnum = 0
Partcount = feat. partcount
Outline = outline + "{"
While partnum <partcount:
PNT = feat. getpart (partnum)
Outline = outline + STR (PNT. x) + "," + STR (PNT. y) + "," + STR (PNT. z) + "," + STR (PNT. m) + ";"
Partnum + = 1
Else:
Partnum = 0
Partcount = feat. partcount
While partnum <partcount:
Part = feat. getpart (partnum)
If partflag:
Outline = "{" + outline
Else:
Outline = outline + "{"
PNT = part. Next ()
If flag:
Tmp1 = outline [:-1]
Outline = tmp1 + "];"
Flag = false
While PNT:
Outline = outline + STR (PNT. x) + "," + STR (PNT. y) + "," + STR (PNT. z) + "," + STR (PNT. m) + ";"
PNT = part. Next ()
If not PNT:
PNT = part. Next ()
If PNT:
If flag:
Tmp3 = outline [:-1]
Outline = tmp3 + "];"
Flag = true
Outline = outline + "[" + STR (PNT. x) + "," + STR (PNT. y) + "," + STR (PNT. z) + "," + STR (PNT. m) + ";"
PNT = part. Next ()
If flag:
Flag = false
Tmp2 = outline [:-1]
Outline = tmp2 + "];"
Else:
Tmp5 = outline [:-1]
Outline = tmp5 + "}"
If partflag:
Tmp4 = outline [:-1]
Outline = tmp4 + "}"
Partflag = false
Partnum + = 1
Outline = outline [:-1] + "}"
Inrow. setvalue (TMP, outline)
Inrows. updaterow (inrow)
Outline =''
Inrow = inrows. Next ()
Del inrow
Del inrows
Except t exception, errordesc:
GP. adderror (errordesc [0])
GP. adderror (GP. getmessages (2 ))
2. Modify the coordinate point information through the change operation, and then update the image
Import arcgisscripting
Import fileinput
Import OS
Import string
Gp = arcgisscripting. Create (9.3)
Infile = SYS. argv [1]
TMP = SYS. argv [2]
# Create update cursor for feature class
Indesc = GP. Describe (infile)
Rows = GP. updatecursor (infile)
Row = rows. Next ()
GP. addmessage (indesc. shapetype. Lower ())
Flag = false
While row:
Linearray = GP. Createobject ("array ")
Partarray = GP. Createobject ("array ")
Featurevertexarray = GP. Createobject ("array ")
If indesc. shapetype. Lower () = "polygon ":
TXT = STR (row. getvalue (TMP ))
Strlist = string. Split (txt ,'}')
Temstr =''
For value in strlist:
Arr = string. Split (value ,';')
For pntstr in arr:
If Len (pntstr)> 1:
If pntstr [0: 1] = '{':
Temstr = pntstr [1:]
Elif pntstr [0: 1] = '[':
Temstr = pntstr [1:]
Elif pntstr [-1] = ']':
Temstr = pntstr [:-1]
Flag = true
Else:
Temstr = pntstr
A = string. Split (temstr ,',')
PNT = GP. Createobject ("point ")
If Len (A) = 4:
PNT. x = string. atof (A [0])
PNT. Y = string. atof (A [1])
PNT. z = string. atof (A [2])
PNT. M = string. atof (A [3])
Linearray. Add (PNT)
GP. addmessage (PNT. X)
GP. addmessage (PNT. Y)
If flag = true:
Flag = false
Featurevertexarray. Add (linearray)
Linearray. removeall ()
GP. addmessage ("newpart ")
Featurevertexarray. Add (linearray)
Linearray. removeall ()
Polygeom = GP. Createobject ("Geometry", "polygon", featurevertexarray)
Row. Shape = polygeom
Rows. updaterow (ROW)
Row = rows. Next ()
Elif indesc. shapetype. Lower () = "point ":
PNT = GP. Createobject ("point ")
TXT = STR (row. getvalue (TMP ))
ARRP = string. Split (txt ,",")
X = ARRP [0]
M = ARRP [3]
PNT. x = string. atof (X [1:])
PNT. Y = string. atof (ARRP [1])
PNT. z = string. atof (ARRP [2])
PNT. M = string. atof (M [:-1])
Row. Shape = pnt
Rows. updaterow (ROW)
Row = rows. Next ()
Elif indesc. shapetype. Lower () = "multipoint ":
TXT = STR (row. getvalue (TMP ))
Strlist = string. Split (txt ,'}')
Temstr =''
For value in strlist:
Arr = string. Split (value ,';')
For pntstr in arr:
If pntstr [0: 1] = '{':
Temstr = pntstr [1:]
Else:
Temstr = pntstr
A = string. Split (temstr ,',')
PNT = GP. Createobject ("point ")
If Len (A) = 4:
PNT. x = string. atof (A [0])
PNT. Y = string. atof (A [1])
PNT. z = string. atof (A [2])
PNT. M = string. atof (A [3])
Linearray. Add (PNT)
GP. addmessage (PNT. X)
GP. addmessage (PNT. Y)
GP. addmessage ("newpart ")
Row. Shape = linearray
Rows. updaterow (ROW)
Row = rows. Next ()
Elif indesc. shapetype. Lower () = "polyline ":
TXT = STR (row. getvalue (TMP ))
Strlist = string. Split (txt ,'}')
Temstr =''
For value in strlist:
Arr = string. Split (value ,';')
For pntstr in arr:
If pntstr [0: 1] = '{':
Temstr = pntstr [1:]
Else:
Temstr = pntstr
A = string. Split (temstr ,',')
PNT = GP. Createobject ("point ")
If Len (A) = 4:
PNT. x = string. atof (A [0])
PNT. Y = string. atof (A [1])
PNT. z = string. atof (A [2])
PNT. M = string. atof (A [3])
Linearray. Add (PNT)
GP. addmessage (PNT. X)
GP. addmessage (PNT. Y)
GP. addmessage ("newpart ")
Featurevertexarray. Add (linearray)
Linearray. removeall ()
Polygeomline = GP. Createobject ("Geometry", "polyline", featurevertexarray)
Row. Shape = polygeomline
Rows. updaterow (ROW)
Row = rows. Next ()
# Delete cursor and row objects to remove locks on the data
Del row
Del rows
In the test, I used the graphic editing method to modify the node coordinate information and then changed the image back to the original element through the code above (for the first step, I have stored the node information of the element to the attribute table)
After the tool is changed
The above script is used to final the Data Change preliminary test. The most responsible aspects include three situations: 1. Only one part; 2. Multiple parts; 3. environment, the above scripts are still being tested. I hope you can correct them more.