Package org.geotools.gce.grassraster.core.color

Examples of org.geotools.gce.grassraster.core.color.AttributeTable


        */
        BufferedReader rdr = new BufferedReader(new FileReader(readerGrassEnv.getCATS()));
        try {

            /* Instantiate attribute table */
            AttributeTable attTable = new AttributeTable();
            /* Ignore first 4 lines. */
            rdr.readLine();
            rdr.readLine();
            rdr.readLine();
            rdr.readLine();
            /* Read next n lines */
            String line;
            while( (line = rdr.readLine()) != null ) {
                /* All lines other than '0:no data' are processed */
                if (line.indexOf("0:no data") == -1) { //$NON-NLS-1$
                    JlsTokenizer tk = new JlsTokenizer(line, ":"); //$NON-NLS-1$
                    if (tk.countTokens() == 2) {
                        float f = Float.parseFloat(tk.nextToken());
                        String att = tk.nextToken().trim();
                        attTable.addAttribute(f, att);
                    } else if (tk.countTokens() == 3) {
                        float f0 = Float.parseFloat(tk.nextToken());
                        float f1 = Float.parseFloat(tk.nextToken());
                        String att = tk.nextToken().trim();
                        attTable.addAttribute(f0, f1, att);
                    }
                }
            }

            List<String> attrs = new ArrayList<String>();
            Enumeration<CellAttribute> categories = attTable.getCategories();
            while( categories.hasMoreElements() ) {
                AttributeTable.CellAttribute object = categories.nextElement();
                attrs.add(object.toString());
            }

View Full Code Here


         * the cats directory.
         */
        BufferedReader rdr = new BufferedReader(new FileReader(getCATS()));
        try {
            /* Instantiate attribute table */
            AttributeTable attTable = new AttributeTable();
            /* Ignore first 4 lines. */
            rdr.readLine();
            rdr.readLine();
            rdr.readLine();
            rdr.readLine();
            /* Read next n lines */
            String line;
            while( (line = rdr.readLine()) != null ) {
                /* All lines other than '0:no data' are processed */
                //            if (line.indexOf("0:no data") == -1) { //$NON-NLS-1$
                JlsTokenizer tk = new JlsTokenizer(line, ":"); //$NON-NLS-1$
                if (tk.countTokens() == 2) {
                    float f = Float.parseFloat(tk.nextToken());
                    String att = tk.nextToken().trim();
                    attTable.addAttribute(f, att);
                } else if (tk.countTokens() == 3) {
                    float f0 = Float.parseFloat(tk.nextToken());
                    float f1 = Float.parseFloat(tk.nextToken());
                    String att = tk.nextToken().trim();
                    attTable.addAttribute(f0, f1, att);
                }
                // }
            }

            Enumeration<CellAttribute> categories = attTable.getCategories();
            while( categories.hasMoreElements() ) {
                AttributeTable.CellAttribute object = categories.nextElement();
                categoriesList.add(object.toString());
            }
        } finally {
View Full Code Here

TOP

Related Classes of org.geotools.gce.grassraster.core.color.AttributeTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.