Package com.bbn.openmap

Source Code of com.bbn.openmap.HintsMapBeanRepaintPolicy

// **********************************************************************
//
// <copyright>
//
//  BBN Technologies
//  10 Moulton Street
//  Cambridge, MA 02138
//  (617) 873-8000
//
//  Copyright (C) BBNT Solutions LLC. All rights reserved.
//
// </copyright>
// **********************************************************************
//
// $Source: /cvs/distapps/openmap/src/openmap/com/bbn/openmap/HintsMapBeanRepaintPolicy.java,v $
// $RCSfile: HintsMapBeanRepaintPolicy.java,v $
// $Revision: 1.2.2.1 $
// $Date: 2004/10/14 18:26:36 $
// $Author: dietrick $
//
// **********************************************************************

package com.bbn.openmap;

import java.awt.Graphics;
import java.util.Properties;

import com.bbn.openmap.layer.policy.RenderingHintsRenderPolicy;

/**
* The class lets you set RenderingHints on the MapBean, to set
* anti-aliasing, etc. This class can be added to the OpenMap
* application via the openmap.components property in the
* openmap.properties file.
*/
public class HintsMapBeanRepaintPolicy extends StandardMapBeanRepaintPolicy
        implements Cloneable {

    protected RenderingHintsRenderPolicy hints;

    public HintsMapBeanRepaintPolicy() {
        super();
        setHints(new RenderingHintsRenderPolicy());
    }

    public HintsMapBeanRepaintPolicy(MapBean mb) {
        super(mb);
        setHints(new RenderingHintsRenderPolicy());
    }

    public void setHints(RenderingHintsRenderPolicy rhrp) {
        hints = rhrp;
    }

    public RenderingHintsRenderPolicy getHints() {
        return hints;
    }

    /**
     * A hook for the RepaintPolicy to make any adjustments to the
     * java.awt.Graphics object before sending the Graphics object to
     * the layers for painting. Gives the policy a chance to make
     * rendering hint changes on Graphic2D objects, setting
     * anti-aliasing configurations, etc. No modifications are made.
     */
    public Graphics modifyGraphicsForPainting(Graphics graphics) {
        if (hints != null) {
            hints.setRenderingHints(graphics);
        }
        return graphics;
    }

    public void setProperties(String prefix, Properties props) {
        super.setProperties(prefix, props);
        if (hints != null) {
            hints.setProperties(prefix, props);
        }
    }

    public Properties getProperties(Properties props) {
        props = super.getProperties(props);
        if (hints != null) {
            props = hints.getProperties(props);
        }
        return props;
    }

    public Properties getPropertyInfo(Properties props) {
        props = super.getPropertyInfo(props);
        if (hints != null) {
            props = hints.getPropertyInfo(props);
        }
        return props;
    }

    public Object clone() {
        HintsMapBeanRepaintPolicy bmbrp = new HintsMapBeanRepaintPolicy();
        bmbrp.setHints(getHints());
        return bmbrp;
    }
}
TOP

Related Classes of com.bbn.openmap.HintsMapBeanRepaintPolicy

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.