' '---------------------------- '--- Creation information --- '---------------------------- ' 'Name: editatt.ave 'Version: 1.0 'Date: 02/07/97 'Author: Ferdi Hellweger ' Center for Research in Water Resources ' The University of Texas at Austin ' ferdi@crwr.utexas.edu ' '--------------------------- '--- Purpose/Description --- '--------------------------- ' 'This program is a utility for modifying feature attributes. ' 'This should be tied to a tool button for the view. ' '--------------------------- '--- Set field name here --- '--------------------------- ' myfieldname = "e" ' '---------------- '--- Get view --- '---------------- ' theview = av.getactivedoc ' '------------------ '--- Get themes --- '------------------ ' theactivethemes = theview.getactivethemes if (theactivethemes.count = 0) then msgbox.error("No active themes found", "BALANCE") exit end if (theactivethemes.count > 0) then lfound = false pfound = false for each activetheme in theactivethemes theftab = activetheme.getftab theshapef = theftab.findfield("shape") theshape = theftab.returnvalue(theshapef,0) if (theshape.getclass.getclassname = "polyline") then theltheme = activetheme lfound = true end if (theshape.getclass.getclassname = "polygon") then theptheme = activetheme pfound = true end end end if ((not lfound) and (not pfound)) then system.beep exit end ' '--------------------- '--- Set up themes --- '--------------------- ' 'line theme ' if (lfound) then ' lftab = theltheme.getftab if (lftab = nil) then msgbox.error("Can't open line theme","BALANCE") exit end ' myfield = lftab.findfield(myfieldname) if (myfield = nil) then addfield = msgbox.yesno("Can't find " + myfieldname + " field in line theme. Add it?","BALANCE", true) if (addfield) then lftab.seteditable(true) myfield = field.make(myfieldname, #FIELD_DECIMAL, 16, 4) lftab.addfields({myfield}) lftab.seteditable(false) else exit end end ' end ' 'polygon theme ' if (pfound) then ' pftab = theptheme.getftab if (pftab = nil) then msgbox.error("Can't open polygon theme","BALANCE") exit end ' myfield = pftab.findfield(myfieldname) if (myfield = nil) then addfield = msgbox.yesno("Can't find " + myfieldname + " field in polygon theme. Add it?","BALANCE", true) if (addfield) then pftab.seteditable(true) myfield = field.make(myfieldname, #FIELD_DECIMAL, 16, 4) pftab.addfields({myfield}) pftab.seteditable(false) else exit end end ' end ' '----------------------------- '--- get point from cursor --- '----------------------------- ' thepoint = theview.getdisplay.returnuserpoint ' '------------ '--- Line --- '------------ ' if (lfound) then ' '--- find line --- ' lrecs = theltheme.findbypoint(thepoint) ' '--- check that a line was found --- ' if ( lrecs.count = 0 ) then system.beep exit end ' '--- get line record --- ' lrec = lrecs.get(0) ' '--- get line attribute --- ' oldvalue = lftab.returnvalue(myfield, lrec) ' '--- get new line attributes from user --- ' newvalue = msgbox.input(myfieldname + " :", "BALANCE", oldvalue.asstring) if (newvalue = nil) then exit end ' '--- assign new line attribute ' lftab.seteditable(true) ' lftab.setvalue(myfield, lrec, newvalue.asnumber) ' lftab.seteditable(false) ' exit end ' '--------------- '--- Polygon --- '--------------- ' if (pfound and not lfound) then ' if (theptheme.isactive) then ' '--- find polygon --- ' precs = theptheme.findbypoint(thepoint) ' '--- check that a polygon was found --- ' if ( precs.count = 0 ) then system.beep exit end ' '--- get polygon record --- ' prec = precs.get(0) ' '--- get polygon attribute --- ' oldvalue = pftab.returnvalue(myfield, prec) ' '--- get new line attributes from user --- ' newvalue = msgbox.input(myfieldname + " :", "BALANCE", oldvalue.asstring) if (newvalue = nil) then exit end ' '--- assign new polygon attribute --- ' pftab.seteditable(true) ' pftab.setvalue(myfield, prec, newvalue.asnumber) ' pftab.seteditable(false) ' end ' end ' '----------- '--- End --- '----------- '