📄 standardmapbeanrepaintpolicy.java
字号:
// **********************************************************************// // <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/StandardMapBeanRepaintPolicy.java,v $// $RCSfile: StandardMapBeanRepaintPolicy.java,v $// $Revision: 1.3.2.1 $// $Date: 2004/10/14 18:26:38 $// $Author: dietrick $// // **********************************************************************package com.bbn.openmap;import java.awt.Graphics;import com.bbn.openmap.util.Debug;/** * A MapBeanRepaintPolicy that just forwards layer repaint requests * normally, and does nothing for java.awt.Graphics before painting. * If this class or any subclass of it is added to the MapHandler, it * will find the MapBean and set itself on it. * * <P> * A StandardMapBeanRepaintPolicy is automatically set in the MapBean, * so you don't have to add one of these to the MapHandler. The * OMComponent inheritence is here to make it easier for subclasses to * be added and for properties to be set. */public class StandardMapBeanRepaintPolicy extends OMComponent implements MapBeanRepaintPolicy, SoloMapComponent, Cloneable { protected MapBean map; protected boolean DEBUG = false; public StandardMapBeanRepaintPolicy() { DEBUG = Debug.debugging("policy"); } public StandardMapBeanRepaintPolicy(MapBean mb) { super(); setMap(mb); } public void setMap(MapBean mb) { map = mb; } public MapBean getMap() { return map; } /** * Take some action based on a repaint request from this * particular layer. The StandardMapBeanRepaintPolicy just * forwards requests on. */ public void repaint(Layer layer) { // No decisions, just forward the repaint() request; if (map != null) { if (DEBUG) { Debug.output("SMBRP: forwarding repaint request for " + layer.getName()); } map.repaint(); } else { Debug.error("SMBRP: MapBean is null in repaint(" + layer.getName() + ")"); } } /** * 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) { return graphics; } /** * If a MapBean is passed to this StandardMapBeanRepaintPolicy, it * will set itself on it. */ public void findAndInit(Object someObj) { if (someObj instanceof MapBean) { ((MapBean) someObj).setMapBeanRepaintPolicy(this); setMap((MapBean) someObj); if (DEBUG) { Debug.output(getClass().getName() + " found MapBean"); } } } /** * If a MapBean is passed to this StandardMapBeanRepaintPolicy, it * will check if it is the repaint policy set on the MapBean and * if so, remove itself from it. */ public void findAndUndo(Object someObj) { if (someObj instanceof MapBean && ((MapBean) someObj).getMapBeanRepaintPolicy() == this) { ((MapBean) someObj).setMapBeanRepaintPolicy(null); setMap(null); } } public Object clone() { return new StandardMapBeanRepaintPolicy(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -