Examples of JlsTokenizer


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

        String r, g, b;

        if (line == null)
            return;
        try {
            JlsTokenizer tk = new JlsTokenizer(line, " ");
            if (lineNumber < 0) {
                if (tk.hasMoreTokens()) {
                    r = g = b = tk.nextToken();
                    if (tk.hasMoreTokens())
                        g = tk.nextToken();
                    if (tk.hasMoreTokens())
                        b = tk.nextToken();
                    if (r.indexOf('.') == -1)
                        setBackgroundColor(new Color(Integer.parseInt(r), Integer.parseInt(g), Integer.parseInt(b)));
                    else
                        setBackgroundColor(new Color(Float.parseFloat(r), Float.parseFloat(g), Float.parseFloat(b)));
                }
            } else {
                r = g = b = tk.nextToken();
                if (tk.hasMoreTokens())
                    g = tk.nextToken();
                if (tk.hasMoreTokens())
                    b = tk.nextToken();
                if (r.indexOf('.') == -1)
                    addColorRule(lineNumber, Integer.parseInt(r), Integer.parseInt(g), Integer.parseInt(b));
                else
                    addColorRule(lineNumber, (int) (Float.parseFloat(r) * 255f), (int) (Float.parseFloat(g) * 255f),
                            (int) (Float.parseFloat(b) * 255));
 
View Full Code Here

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

        if (line == null)
            return;
        // System.out.println(">>"+line);

        try {
            JlsTokenizer tk = new JlsTokenizer(line, " ");
            if (tk.hasMoreTokens()) {
                /* Some lines may have two colors seperated by a space. */
                JlsTokenizer tk1 = new JlsTokenizer(tk.nextToken(), ":");
                cat0 = Float.parseFloat(tk1.nextToken());
                /* The next value(s) describe the color as R:G:B */
                r0 = g0 = b0 = Integer.parseInt(tk1.nextToken());
                if (tk1.hasMoreTokens())
                    g0 = b0 = Integer.parseInt(tk1.nextToken());
                if (tk1.hasMoreTokens())
                    b0 = Integer.parseInt(tk1.nextToken());
                if (tk.hasMoreTokens()) {
                    /* Some lines may have two colors seperated by a space. */
                    tk1 = new JlsTokenizer(tk.nextToken(), ":");
                    cat1 = Float.parseFloat(tk1.nextToken());
                    /* The next value(s) describe the color as R:G:B */
                    r1 = g1 = b1 = Integer.parseInt(tk1.nextToken());
                    if (tk1.hasMoreTokens())
                        g1 = b1 = Integer.parseInt(tk1.nextToken());
                    if (tk1.hasMoreTokens())
                        b1 = Integer.parseInt(tk1.nextToken());
                }
                /* Add colour rule if specified for a range */
                if (r1 == -1) {
                    addColorRule((int) cat0, r0, g0, b0);
                } else {
View Full Code Here

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

            /* 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);
                    }
                }
            }

View Full Code Here

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

            /* 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);
                }
                // }
            }

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.