Updated to worldwind release 20070817
[worldwind-tracker.git] / gov / nasa / worldwind / render / SurfaceSector.java
blob8935453c88c8c62c169d60f3a8777888d5f8d3ed
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 2570 2007-08-16 22:31:33Z 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 private static Iterable<LatLon> makePositions(Sector sector)
43 if (sector == null)
45 String message = Logging.getMessage("nullValue.SectorIsNull");
46 Logging.logger().severe(message);
47 throw new IllegalArgumentException(message);
50 ArrayList<LatLon> positions = new ArrayList<LatLon>(5);
52 positions.add(new LatLon(sector.getMinLatitude(), sector.getMinLongitude()));
53 positions.add(new LatLon(sector.getMinLatitude(), sector.getMaxLongitude()));
54 positions.add(new LatLon(sector.getMaxLatitude(), sector.getMaxLongitude()));
55 positions.add(new LatLon(sector.getMaxLatitude(), sector.getMinLongitude()));
56 positions.add(new LatLon(sector.getMinLatitude(), sector.getMinLongitude()));
58 return positions;