Update to Worldwind release 0.4.0
[worldwind-tracker.git] / gov / nasa / worldwind / render / SurfaceSector.java
blobc7561ddaddc574fc6f409937f4853a16b898a434
1 /*
2 Copyright (C) 2001, 2006 United States Government
3 as represented by the Administrator of the
4 National Aeronautics and Space Administration.
5 All Rights Reserved.
6 */
7 package gov.nasa.worldwind.render;
9 import gov.nasa.worldwind.geom.*;
10 import gov.nasa.worldwind.util.Logging;
12 import java.awt.*;
13 import java.util.ArrayList;
15 /**
16 * @author tag
17 * @version $Id: SurfaceSector.java 3408 2007-10-28 08:54:22Z tgaskins $
19 public class SurfaceSector extends SurfacePolygon
21 public SurfaceSector(Sector sector, Color color, Color borderColor)
23 super(makePositions(sector), color, borderColor);
26 public SurfaceSector(Sector sector)
28 super(makePositions(sector), null, null);
31 public SurfaceSector(Sector sector, Color color, Color borderColor, Dimension textureSize)
33 super(makePositions(sector), color, borderColor, textureSize);
36 public void setSector(Sector sector)
38 this.setPositions(makePositions(sector));
41 public Sector getSector()
43 return this.getSectors().get(0); // TODO: coallesce split sectors into one?
46 private static Iterable<LatLon> makePositions(Sector sector)
48 if (sector == null)
50 String message = Logging.getMessage("nullValue.SectorIsNull");
51 Logging.logger().severe(message);
52 throw new IllegalArgumentException(message);
55 ArrayList<LatLon> positions = new ArrayList<LatLon>(5);
57 positions.add(new LatLon(sector.getMinLatitude(), sector.getMinLongitude()));
58 positions.add(new LatLon(sector.getMinLatitude(), sector.getMaxLongitude()));
59 positions.add(new LatLon(sector.getMaxLatitude(), sector.getMaxLongitude()));
60 positions.add(new LatLon(sector.getMaxLatitude(), sector.getMinLongitude()));
61 positions.add(new LatLon(sector.getMinLatitude(), sector.getMinLongitude()));
63 return positions;