📄 node.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/graphicLoader/netmap/Node.java,v $// $RCSfile: Node.java,v $// $Revision: 1.3.2.3 $// $Date: 2005/08/09 17:59:29 $// $Author: dietrick $// // **********************************************************************package com.bbn.openmap.graphicLoader.netmap;import java.awt.Color;import java.awt.event.*;import com.bbn.openmap.omGraphics.OMGraphic;import com.bbn.openmap.omGraphics.OMPoint;/** * Object that represents a NetMap node on the map. */public class Node extends OMPoint implements ActionListener, FocusListener { public static final int DEFAULT_LENGTH = 10; public static final int DEFAULT_WIDTH = 10; public static final int DEFAULT_RADIUS = 5; public static Color STATUS_UP = Color.green; public static Color STATUS_DOWN = Color.red; public static Color STATUS_UNKNOWN = Color.yellow; protected String label; protected int index; protected Color color = null; protected int posX = 0; protected int posY = 0; protected String posLat = null; protected String posLon = null; protected double gpsTime = 0; protected int length = 0; protected int width = 0; protected int menu = 0; protected int shape = 0; protected boolean localhost = false; public Node(String label, int index, int shape, int menu, int color) { super(); this.label = label; this.index = index; this.shape = shape; this.menu = menu; this.color = NodeColor.colorOf(color); initOM(); } private void initOM() { setOval(true); setRadius(DEFAULT_RADIUS); setRenderType(RENDERTYPE_LATLON); setFillPaint(this.color); } public String getLabel() { return this.label; } public String getName() { return getLabel(); } public void setIndex(int index) { this.index = index; } public int getIndex() { return this.index; } public Color getColor() { return this.color; } public void setStatus(int color) { this.color = NodeColor.colorOf(color); setFillPaint(this.color); } public int getStatus() { return NodeColor.valueOf(this.color); } public void setTime(double time) { this.gpsTime = time; } public double getTime() { return this.gpsTime; } public void setShape(int shape) { this.shape = shape; } public void moveTo(int newX, int newY) { if (getRenderType() == OMGraphic.RENDERTYPE_XY) { setX(newX); setY(newY); } } public void moveTo(float newLat, float newLon) { if (getRenderType() == OMGraphic.RENDERTYPE_LATLON) { setLat(newLat); setLon(newLon); } } /** * Set this node as the one reflecting the localhost. */ public void setLocalhost(boolean value) { localhost = value; } public boolean isLocalhost() { return localhost; } public void focusGained(FocusEvent e) {} public void focusLost(FocusEvent e) {} public void actionPerformed(ActionEvent ae) {}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -