'brings rgb values of a av-legend to an ascii txt file 'brings classification also to an ascii file 'needed it to use it with gridpaint 'comments and bugs to hreuter@zalf.de 'need a selected theme in an active view '09/04/2000 'Hannes I. Reuter - ZALF Muencheberg - GERMANY ' improvement: add error checking ... ' reclass file for only one value needs to be added ' add 04/10/2000 original coding ' add 04/01/2001 routine to write reclass file ' ' get view and active theme theView = av.GetactiveDoc theTheme = theView.GetActiveThemes.Get(0) theLegend = theTheme.GetLegend count = theLegend.GetNumClasses theClassification = theLegend.Getclassifications 'make a clr file to store the red,green blue values MADefault = fileName.make("$HOME").makeTmp("RGB_","clr") MAOutput = fileDialog.put( MADefault,"*.clr","Output file of RGB-values." ) if (MAOutput = nil) then msgBox.info("No name entered, procedure cancelled","Exiting Procedure") return nil end theFile = (MAOutput) lf = LineFile.Make(theFile,#File_PERM_APPEND) ' make a rec file to store the reclassification MADefault = fileName.make("$HOME").makeTmp("REC_","rec") MAOutput = fileDialog.put( MADefault,"*.rec","Output file of Reclass-values." ) if (MAOutput = nil) then msgBox.info("No name entered, procedure cancelled","Exiting Procedure") return nil end theFile = (MAOutput) lfr = LineFile.Make(theFile,#File_PERM_APPEND) 'add the color data for each x in 0..count mySymbol = theLegend.GetSymbols.Get(x) myColor = mySymbol.GetColor myRGBlist = myColor.getRGBlist mRED = myrgblist.get(0) mGREEN = myrgblist.get(1) mBLUE = myrgblist.get(2) ' rec= theVtab.addRecord ' theVtab.setValue(fNum, rec, x) ' theVtab.setValue(fRED, rec, mRED) ' theVtab.setValue(fGREEN, rec, mGREEN) ' theVtab.setValue(fBLUE, rec, mBLUE) 'Build the string which will be written to the clr file y = x + 1 filestring = y.AsString+" "+mRED.AsString+" "+mGREEN.AsString+" "+mBLUE.AsString ' build the string which will be written to the rec file ' Write the string to the file, lf.WriteElt(filestring) ' end of loop end ' close the file lf.close ' add the classification data ' need some dummy values, because there is a 0 and -1 value at the end of the list y = count - 1 f = 1 'Build the string which will be written to the rec file for each x in 0..y maxi = theClassification.get(x).ReturnMaximum mini = theClassification.get(x).ReturnMinimum liststring = mini.asstring+" "+maxi.asstring+" : "+f.asstring f = f + 1 ' Write the string to the file, lfr.WriteElt(liststring) ' end of loop end ' close the file lfr.close ' end ' thats it !!!! ' HIR - 04/Januar/2001