' '---------------------------- '--- Creation information --- '---------------------------- ' 'Name: balinfo.ave 'Version: 1.0 'Date: 01/11/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 viewing polygon the concentration. ' '--------------------------------------------- '--- Check if units configuration happened --- '--------------------------------------------- ' if (not _configu) then configure = msgbox.yesno("Units are not configured. Configure it now?","BALANCE",true) if (configure) then av.run("balconu", nil) else exit end end ' '---------------- '--- 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 ' lshapef = lftab.findfield("shape") if (lshapef = nil) then msgbox.error("Can't find 'shape' field in line theme","BALANCE") exit end ' qf = lftab.findfield("q") if (qf = nil) then msgbox.error("Can't find 'q' field in line theme","BALANCE") exit end ' fadf = lftab.findfield("fad") if (fadf = nil) then msgbox.error("Can't find 'fad' field in line theme","BALANCE") exit end ' fdif = lftab.findfield("fdi") if (fdif = nil) then msgbox.error("Can't find 'fdi' field in line theme","BALANCE") exit end ' end ' 'polygon theme ' if (pfound) then ' pftab = theptheme.getftab if (pftab = nil) then msgbox.error("Can't open polygon theme","BALANCE") exit end ' pshapef = pftab.findfield("shape") if (pshapef = nil) then msgbox.error("Can't find 'shape' field in polygon theme","BALANCE") exit end ' wnpf = pftab.findfield("wnp") if (wnpf = nil) then msgbox.error("Can't find 'wnp' field in polygon theme","BALANCE") exit end ' watf = pftab.findfield("wat") if (watf = nil) then msgbox.error("Can't find 'wat' field in polygon theme","BALANCE") exit end ' wotf = pftab.findfield("wot") if (wotf = nil) then msgbox.error("Can't find 'wot' field in polygon theme","BALANCE") exit end ' wsef = pftab.findfield("wse") if (wsef = nil) then msgbox.error("Can't find 'wse' field in polygon theme","BALANCE") exit end ' sf = pftab.findfield("s") if (sf = nil) then msgbox.error("Can't find 's' field in polygon theme","BALANCE") exit end ' wadf = pftab.findfield("wad") if (wadf = nil) then msgbox.error("Can't find 'wad' field in polygon theme","BALANCE") exit end ' wdif = pftab.findfield("wdi") if (wdif = nil) then msgbox.error("Can't find 'wdi' field in polygon theme","BALANCE") exit end ' wdf = pftab.findfield("wd") if (wdf = nil) then msgbox.error("Can't find 'wd' field in polygon theme","BALANCE") exit 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 attributes --- ' fad = lftab.returnvalue(fadf, lrec) fdi = lftab.returnvalue(fdif, lrec) ' '--- display line attributes --- ' message = "Line Information" + nl + nl message = message + "Advective Flux " + fad.asstring + " " + _wlab + nl message = message + "Diffusive Flux " + fdi.asstring + " " + _wlab + nl msgbox.report(message, "BALANCE") ' exit end ' '--------------- '--- Polygon --- '--------------- ' if (pfound) 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 attributes --- ' wnp = pftab.returnvalue(wnpf, prec) wat = pftab.returnvalue(watf, prec) wse = pftab.returnvalue(wsef, prec) wot = pftab.returnvalue(wotf, prec) wad = pftab.returnvalue(wadf, prec) wdi = pftab.returnvalue(wdif, prec) wd = pftab.returnvalue(wdf, prec) s = pftab.returnvalue(sf, prec) ' '--- display polygon attributes --- ' message = "Polygon Information" + nl + nl message = message + "Nonpoint Runoff Load " + wnp.asstring + " " + _wlab + nl message = message + "Atmospheric Load " + wat.asstring + " " + _wlab + nl message = message + "Sediment Load " + wse.asstring + " " + _wlab + nl message = message + "Other Load " + wot.asstring + " " + _wlab + nl message = message + "Advective Load " + wad.asstring + " " + _wlab + nl message = message + "Diffusive Load " + wdi.asstring + " " + _wlab + nl message = message + "Decay Load " + wd.asstring + " " + _wlab + nl + nl message = message + "Concentration " + s.asstring + " " + _slab + nl msgbox.report(message, "BALANCE") ' end ' '----------- '--- End --- '----------- '