⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 roadline.java

📁 openmap java写的开源数字地图程序. 用applet实现,可以像google map 那样放大缩小地图.
💻 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/tools/roads/RoadLine.java,v// $// $RCSfile: RoadLine.java,v $// $Revision: 1.1.2.3 $// $Date: 2005/08/09 21:17:50 $// $Author: dietrick $// // **********************************************************************package com.bbn.openmap.tools.roads;import com.bbn.openmap.LatLonPoint;import com.bbn.openmap.proj.Projection;import com.bbn.openmap.omGraphics.OMLine;import com.bbn.openmap.omGraphics.OMGraphicList;import java.awt.Color;import java.awt.Graphics;import java.awt.Point;public class RoadLine extends Visual implements RoadObject {    private Road road;    private int index;    public RoadLine(Road road, int index) {        this.road = road;        this.index = index;    }    public static Class getGraphicClass() {        return Graphic.class;    }    public void moveTo(Point loc) {}    public RoadPoint addRoadPoint(int x, int y) {        RoadLayer layer = road.getRoadLayer();        Projection p = layer.getProjection();        RoadPoint rp = new RoadPoint(road, p.inverse(x, y), layer);        road.insertRoadPointAt(rp, index + 1);        return rp;    }    public Road getRoad() {        return road;    }    public synchronized void render(OMGraphicList gl, boolean forceNew) {        RoadGraphic visual = getVisual();        if (visual == null || forceNew) {            LatLonPoint p1 = road.getWaypoint(index).getLocation();            LatLonPoint p2 = road.getWaypoint(index + 1).getLocation();            visual = new Graphic(p1, p2);            setVisual(visual);        }        gl.addOMGraphic((Graphic) visual);    }    public class Graphic extends OMLine implements RoadGraphic {        Graphic(LatLonPoint p1, LatLonPoint p2) {            super(p1.getLatitude(),                  p1.getLongitude(),                  p2.getLatitude(),                  p2.getLongitude(),                  OMLine.LINETYPE_STRAIGHT);            if (road.isBlocked()) {                setLinePaint(Color.white);                //setLineWidth(road.getRoadClass().getWidth() * 2 +                // 2);            } else {                setLinePaint(road.getRoadClass().getColor());                /*                 * if (road.isRoute()) {                 * setLineWidth(road.getRoadClass().getWidth() * 2 +                 * 2); } else {                 * setLineWidth(road.getRoadClass().getWidth()); }                 */            }        }        public void blink(boolean newState) {            blinkState = newState;        }        public void render(Graphics g) {            if (blinkState)                return;            super.render(g);            /*             * if (false && lineWidth > 1) { g.setColor(Color.black);             * int[] x = null, y = null;             *              * int size = fatLines.size(); for (int i = 0; i < size;             * i+=2) { x = (int[])(fatLines.elementAt(i)); y =             * (int[])(fatLines.elementAt(i+1)); g.drawPolygon(x, y,             * x.length); } }             */        }        public RoadObject getRoadObject() {            return RoadLine.this;        }        public RoadLine getRoadLine() {            return RoadLine.this;        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -