From: Ian T. <ian...@us...> - 2001-11-20 14:50:44
|
Update of /cvsroot/geotools/geotools/src/uk/ac/leeds/ccg/geotools In directory usw-pr-cvs1:/tmp/cvs-serv7682/uk/ac/leeds/ccg/geotools Modified Files: LODFilter.java Log Message: added a constructor that uses a viewer, when this is used the level of details are set from the percentageZoom as returned by viewer.getZoomAsPercentage. Index: LODFilter.java =================================================================== RCS file: /cvsroot/geotools/geotools/src/uk/ac/leeds/ccg/geotools/LODFilter.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** LODFilter.java 2001/09/05 07:44:20 1.3 --- LODFilter.java 2001/11/20 14:50:40 1.4 *************** *** 15,18 **** --- 15,19 ---- GeoData data; Scaler scale; + Viewer view; double lod,len,ratio; int den; *************** *** 24,34 **** scale=s; } public final boolean isVisible(int id){ lod = data.getValue(id); if(lod==0) return true; ! lod = (10-lod)*10; ! len = scale.toGraphics(lod); ! //System.out.println("lod "+lod+"-> "+len+" "+(len >= 1.0)); ! return (len >= 1.0); } --- 25,49 ---- scale=s; } + public LODFilter(GeoData g,Viewer v){ + data=g; + view=v; + } + static final double levels[] = {100,150,200,400,1000,2000,4000}; public final boolean isVisible(int id){ lod = data.getValue(id); if(lod==0) return true; ! if(scale!=null){ ! lod = (10-lod)*10; ! len = scale.toGraphics(lod); ! //System.out.println("lod "+lod+"-> "+len+" "+(len >= 1.0)); ! return (len >= 1.0); ! } ! if(view!=null){ ! double perc = view.getZoomAsPercent(); ! if(lod+1>levels.length) return perc>lod*1000.0; ! return perc > levels[(int)lod+1]; ! } ! return false; ! } |