📄 containergraphic.java
字号:
/* ********************************************************************** * * Use, duplication, or disclosure by the Government is subject to * restricted rights as set forth in the DFARS. * * BBNT Solutions LLC * A Part of * Verizon * 10 Moulton Street * Cambridge, MA 02138 * (617) 873-3000 * * Copyright (C) 2002 by BBNT Solutions, LLC * All Rights Reserved. * ********************************************************************** */package com.bbn.openmap.examples.beanbox;import com.bbn.openmap.omGraphics.OMGraphic;import com.bbn.openmap.omGraphics.OMRect;import com.bbn.openmap.omGraphics.OMGraphicConstants;/** * A custom graphic class for representing objects of type * {@link com.bbn.openmap.examples.beanbox.SimpleBeanContainer}as a * rectangular box. */public class ContainerGraphic extends CustomGraphic { public ContainerGraphic(SimpleBeanObject object) { super(object); this.setRenderType(OMGraphicConstants.RENDERTYPE_LATLON); } /** * Returns an OMRect object with dimensions equal to the width and * height of the SimpleBeanContainer and position equal to the * center lat/lon position of the SimpleBeanContainer object. */ public OMGraphic createGraphic(SimpleBeanObject object) { if (!(object instanceof SimpleBeanContainer)) { throw new IllegalArgumentException(object + " not instance of SimpleBeanContainer"); } SimpleBeanContainer bc = (SimpleBeanContainer) object; return new OMRect(bc.getTopLatitude(), bc.getLeftLongitude(), bc.getBottomLatitude(), bc.getRightLongitude(), OMGraphicConstants.LINETYPE_RHUMB); } /** * Updates the width, height and position of OMRect object used to * represent the SimpleBeanContainer object with the corresponding * values in the SimpleBeanContainer object. */ public void updateGraphic(SimpleBeanObject object) { if (!(object instanceof SimpleBeanContainer)) { throw new IllegalArgumentException(object + " not instance of SimpleBeanContainer"); } SimpleBeanContainer bc = (SimpleBeanContainer) object; OMGraphic graphic = super.getOMGraphicAt(0); if (graphic instanceof OMRect) { OMRect rect = (OMRect) graphic; rect.setLocation(bc.getTopLatitude(), bc.getLeftLongitude(), bc.getBottomLatitude(), bc.getRightLongitude(), OMGraphicConstants.LINETYPE_RHUMB); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -