'**** View.LoadGIS '**** loads an ERDAS .GIS image and associated palette (.PAL) file theView = av.GetActiveDoc theIFN = FileDialog.Show("*.gis","GIS Files","Pick ERDAS Image to open") if (theIFN = nil) then return nil end theISrc = ISrc.Make(theIFN.AsString.AsSrcName) theITheme = ITheme.Make(theISrc) temp = theISrc.GetSrcName.GetFileName.AsString thePFN = FileName.Make(temp) thePFN.SetExtension("pal") if (File.Exists(thePFN).Not) then theMsg = thePFN.AsString++"not found." MsgBox.Error(theMsg,"Load .GIS") return nil end pal = LineFile.Make(thePFN,#FILE_PERM_READ) numlin = pal.GetSize IL = IdentityLookup.Make CM = ColorMap.MakeNominal(numlin) theLine = pal.ReadELT while (theLine <> nil) tl = theLine.AsTokens(" ") i = tl.Get(0).AsNumber r63 = tl.Get(1).AsNumber g63 = tl.Get(2).AsNumber b63 = tl.Get(3).AsNumber r255 = ( r63 / 63 * 255 ).Round g255 = ( g63 / 63 * 255 ).Round b255 = ( b63 / 63 * 255 ).Round rgb = {r255,g255,b255} theColor = CM.Get(i) theColor.SetRgbList(rgb) theLine = pal.ReadELT end pal.Close SBL = SingleBandLegend.Make(0,IL,CM) theITheme.SetLegend(SBL) theView.AddTheme(theITheme)