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

📄 surfacepolyline.java

📁 world wind java sdk 源码
💻 JAVA
字号:
/* Copyright (C) 2001, 2009 United States Government as represented bythe Administrator of the National Aeronautics and Space Administration.All Rights Reserved.*/package gov.nasa.worldwind.render;import gov.nasa.worldwind.geom.*;import gov.nasa.worldwind.globes.Globe;import gov.nasa.worldwind.util.Logging;import javax.media.opengl.GL;/** * @author dcollins * @version $Id: SurfacePolyline.java 10634 2009-04-29 03:52:29Z dcollins $ */public class SurfacePolyline extends AbstractSurfaceShape{    protected java.util.List<LatLon> locationList;    public SurfacePolyline(ShapeAttributes attributes, Iterable<? extends LatLon> locations)    {        super(attributes);        this.locationList = new java.util.ArrayList<LatLon>();        this.addLocations(locations);    }    public SurfacePolyline(ShapeAttributes attributes)    {        this(attributes, null);    }    public SurfacePolyline(Iterable<? extends LatLon> locations)    {        this(new BasicShapeAttributes(), locations);    }    public SurfacePolyline()    {        this(new BasicShapeAttributes());    }    public Iterable<? extends LatLon> getLocations()    {        return java.util.Collections.unmodifiableList(this.locationList);    }    public void setLocations(Iterable<? extends LatLon> locations)    {        this.locationList.clear();        this.addLocations(locations);        this.onShapeChanged();    }    protected void addLocations(Iterable<? extends LatLon> locations)    {        if (locations != null)        {            for (LatLon latLon : locations)            {                this.locationList.add(latLon);            }        }    }    public Position getReferencePosition()    {        if (this.locationList.isEmpty())            return null;        return new Position(this.locationList.get(0), 0);    }    protected void computeLocations(Globe globe, java.util.List<LatLon> locations)    {        if (globe == null)        {            String message = Logging.getMessage("nullValue.GlobeIsNull");            Logging.logger().severe(message);            throw new IllegalArgumentException(message);        }        if (locations == null)        {            String message = Logging.getMessage("nullValue.LocationsListIsNull");            Logging.logger().severe(message);            throw new IllegalArgumentException(message);        }        locations.addAll(this.locationList);    }    protected void computeDrawLocations(Globe globe, double edgeIntervalsPerDegree, java.util.List<LatLon> locations)    {        if (globe == null)        {            String message = Logging.getMessage("nullValue.GlobeIsNull");            Logging.logger().severe(message);            throw new IllegalArgumentException(message);        }        if (locations == null)        {            String message = Logging.getMessage("nullValue.LocationsListIsNull");            Logging.logger().severe(message);            throw new IllegalArgumentException(message);        }        getSurfaceShapeSupport().generateIntermediateLocations(this.locationList, this.pathType,            edgeIntervalsPerDegree, this.minEdgeIntervals, this.maxEdgeIntervals, false, locations);    }    protected void doMoveTo(Position oldReferencePosition, Position newReferencePosition)    {        int numLocations = this.locationList.size();        LatLon[] newLocations = new LatLon[numLocations];        for (int i = 0; i < numLocations; i++)        {            LatLon ll = this.locationList.get(i);            Angle heading = LatLon.greatCircleAzimuth(oldReferencePosition, ll);            Angle pathLength = LatLon.greatCircleDistance(oldReferencePosition, ll);            newLocations[i] = LatLon.greatCircleEndPosition(newReferencePosition, heading, pathLength);        }        this.setLocations(java.util.Arrays.asList(newLocations));    }    protected void doRenderInteriorToRegion(DrawContext dc, Sector sector, int x, int y, int width, int height)    {        // Polyline does not render an interior.    }    protected void doRenderOutlineToRegion(DrawContext dc, Sector sector, int x, int y, int width, int height)    {        ShapeAttributes attributes = this.getAttributes();        SurfaceShapeSupport shapeSupport = getSurfaceShapeSupport();        shapeSupport.applyOutlineState(dc, attributes);        shapeSupport.drawArrays(dc, GL.GL_LINE_STRIP, 0, vertices.size());    }}

⌨️ 快捷键说明

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