Path { public synchronized Sector getBoundingSector() { if (isEmpty(positions)) { return null; } Angle minLat = Angle.fromDegrees(360); Angle minLon = Angle.fromDegrees(360); Angle maxLat = Angle.fromDegrees(-360); Angle maxLon = Angle.fromDegrees(-360); for (LatLon pathPosition : positions.values()) { if (pathPosition.getLatitude().compareTo(minLat) < 0) { minLat = pathPosition.getLatitude(); } if (pathPosition.getLatitude().compareTo(maxLat) > 0) { maxLat = pathPosition.getLatitude(); } if (pathPosition.getLongitude().compareTo(minLon) < 0) { minLon = pathPosition.getLongitude(); } if (pathPosition.getLongitude().compareTo(maxLon) > 0) { maxLon = pathPosition.getLongitude(); } } return new Sector(minLat, maxLat, minLon, maxLon); } Path(List<LatLon> positions); synchronized Angle getLength(); long getUpdateFrequency(); void setUpdateFrequency(long updateFrequency); synchronized LatLon getPercentLatLon(double percent); synchronized Vec4 getSegmentCenterPoint(DrawContext dc, Segment segment, double top, double bottom,
			boolean followTerrain); synchronized SegmentGeometry getGeometry(DrawContext dc, CurtainTile tile, double top, double bottom,
			int subsegments, boolean followTerrain); synchronized Vec4[] getPointsInSegment(DrawContext dc, Segment segment, double top, double bottom,
			int subsegments, boolean followTerrain); synchronized Extent getSegmentExtent(DrawContext dc, Segment segment, double top, double bottom,
			int subsegments, boolean followTerrain); synchronized Angle getSegmentLength(Segment segment); synchronized double getSegmentLengthInRadians(Segment segment); synchronized Angle getPercentLength(double percent); synchronized double getPercentLengthInRadians(double percent); synchronized Sector getBoundingSector();  }
@Test public void testGetBoundingSectorStraightPath() { Path path = createPath(0d, -90d, 0d, 90d); Sector expected = new Sector(Angle.ZERO, Angle.ZERO, Angle.NEG90, Angle.POS90); Sector result = path.getBoundingSector(); assertEquals(expected, result); }
@Test public void testGetBoundingSectorBentPath() { Path path = createPath(0d, -90d, 0d, 90d, 90d, 90d); Sector expected = new Sector(Angle.ZERO, Angle.POS90, Angle.NEG90, Angle.POS90); Sector result = path.getBoundingSector(); assertEquals(expected, result); }