Package org.geotools.renderer.windbarbs.WindBarb

Examples of org.geotools.renderer.windbarbs.WindBarb.WindBarbDefinition


        }

        // get the barb
        if (windBarbName.equalsIgnoreCase(DEFAULT_NAME)) {

            WindBarbDefinition definition = parseWindBarbsDefinition(params);
            Map<Integer, Shape> windbarbs = null;
            synchronized (CACHE) {
                windbarbs = CACHE.get(definition);
                if (windbarbs == null) {
                    windbarbs = new HashMap<Integer, Shape>();
View Full Code Here


    /**
     * @param params
     * @return a {@link WindBarbDefinition} for the provided params
     */
    private WindBarbDefinition parseWindBarbsDefinition(Map<String, String> params) {
        final WindBarbDefinition retValue = WindBarb.DEFAULT_WINDBARB_DEFINITION;
        if (params == null || params.size() <= 0) {
            return retValue;
        }

        // parse
        String temp = null;

        // //
        //
        // vectorLength
        //
        // //
        int vectorLength = retValue.vectorLength;
        if (params.containsKey("vectorlength")) {
            // get value
            temp = params.get("vectorlength");

            // check and parse
            if (temp == null || temp.length() <= 0) {
                if (LOGGER.isLoggable(Level.INFO)) {
                    LOGGER.info("Wrong vectorLength provided: " + temp
                            + " resorting to default wind barb definition");
                }
                return retValue;// default
            }
            try {
                vectorLength = Integer.parseInt(temp);
            } catch (Exception e) {
                if (LOGGER.isLoggable(Level.INFO)) {
                    LOGGER.info("Wrong vectorLength provided: " + temp
                            + " resorting to default wind barb definition");
                }
                return retValue;// default
            }
            if (vectorLength <= 0) {
                if (LOGGER.isLoggable(Level.INFO)) {
                    LOGGER.info("Wrong vectorLength provided: " + temp
                            + " resorting to default wind barb definition");
                }
                return retValue;// default
            }
        }

        // //
        //
        // basePennantLength
        //
        // //
        int basePennantLength = retValue.basePennantLength;
        if (params.containsKey("basepennantlength")) {
            // get value
            temp = params.get("basepennantlength");

            // check and parse
            if (temp == null || temp.length() <= 0) {
                if (LOGGER.isLoggable(Level.INFO)) {
                    LOGGER.info("Wrong basePennantLength provided: " + temp
                            + " resorting to default wind barb definition");
                }
                return retValue;// default
            }
            try {
                basePennantLength = Integer.parseInt(temp);
            } catch (Exception e) {
                if (LOGGER.isLoggable(Level.INFO)) {
                    LOGGER.info("Wrong basePennantLength provided: " + temp
                            + " resorting to default wind barb definition");
                }
                return retValue;// default
            }
            if (basePennantLength <= 0 || basePennantLength >= vectorLength) {
                if (LOGGER.isLoggable(Level.INFO)) {
                    LOGGER.info("Wrong basePennantLength provided: " + temp
                            + " resorting to default wind barb definition");
                }
                return retValue;// default
            }
        }

        // //
        //
        // elementsSpacing
        //
        // //
        int elementsSpacing = retValue.elementsSpacing;
        if (params.containsKey("elementsspacing")) {
            // get value
            temp = params.get("elementsspacing");

            // check and parse
            if (temp == null || temp.length() <= 0) {
                if (LOGGER.isLoggable(Level.INFO)) {
                    LOGGER.info("Wrong elementsSpacing provided: " + temp
                            + " resorting to default wind barb definition");
                }
                return retValue;// default
            }
            try {
                elementsSpacing = Integer.parseInt(temp);
            } catch (Exception e) {
                if (LOGGER.isLoggable(Level.INFO)) {
                    LOGGER.info("Wrong elementsSpacing provided: " + temp
                            + " resorting to default wind barb definition");
                }
                return retValue;// default
            }
            if (elementsSpacing <= 0 || elementsSpacing >= vectorLength
                    || elementsSpacing + basePennantLength >= vectorLength) {
                if (LOGGER.isLoggable(Level.INFO)) {
                    LOGGER.info("Wrong elementsSpacing provided: " + temp
                            + " resorting to default wind barb definition");
                }
                return retValue;// default
            }
        }

        // //
        //
        // longBarbLength
        //
        // //
        int longBarbLength = retValue.longBarbLength;
        if (params.containsKey("longbarblength")) {
            // get value
            temp = params.get("longbarblength");

            // check and parse
            if (temp == null || temp.length() <= 0) {
                if (LOGGER.isLoggable(Level.INFO)) {
                    LOGGER.info("Wrong longBarbLength provided: " + temp
                            + " resorting to default wind barb definition");
                }
                return retValue;// default
            }
            try {
                longBarbLength = Integer.parseInt(temp);
            } catch (Exception e) {
                if (LOGGER.isLoggable(Level.INFO)) {
                    LOGGER.info("Wrong longBarbLength provided: " + temp
                            + " resorting to default wind barb definition");
                }
                return retValue;// default
            }
            if (longBarbLength <= 0) {
                if (LOGGER.isLoggable(Level.INFO)) {
                    LOGGER.info("Wrong longBarbLength provided: " + temp
                            + " resorting to default wind barb definition");
                }
                return retValue;// default
            }
        }

        // //
        //
        // zeroWindRadius
        //
        // //
        int zeroWindRadius = retValue.zeroWindRadius;
        if (params.containsKey("zerowindradius")) {
            // get value
            temp = params.get("zerowindradius");

            // check and parse
            if (temp == null || temp.length() <= 0) {
                if (LOGGER.isLoggable(Level.INFO)) {
                    LOGGER.info("Wrong zeroWindRadius provided: " + temp
                            + " resorting to default wind barb definition");
                }
                return retValue;// default
            }
            try {
                zeroWindRadius = Integer.parseInt(temp);
            } catch (Exception e) {
                if (LOGGER.isLoggable(Level.INFO)) {
                    LOGGER.info("Wrong zeroWindRadius provided: " + temp
                            + " resorting to default wind barb definition");
                }
                return retValue;// default
            }
            if (zeroWindRadius <= 0) {
                if (LOGGER.isLoggable(Level.INFO)) {
                    LOGGER.info("Wrong zeroWindRadius provided: " + temp
                            + " resorting to default wind barb definition");
                }
                return retValue;// default
            }
        }

        // new definition
        return new WindBarbDefinition(vectorLength, basePennantLength, elementsSpacing,
                longBarbLength, zeroWindRadius);
    }
View Full Code Here

TOP

Related Classes of org.geotools.renderer.windbarbs.WindBarb.WindBarbDefinition

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.