/src/worldwind/kml/model/KMLMultiGeometry.java

http://wwj-kml.googlecode.com/ · Java · 48 lines · 31 code · 10 blank · 7 comment · 6 complexity · 211163a506af830872889e97ed02207e MD5 · raw file

  1. package worldwind.kml.model;
  2. import gov.nasa.worldwind.geom.Sector;
  3. import java.util.List;
  4. import java.util.ArrayList;
  5. /**
  6. * Created by IntelliJ IDEA.
  7. * User: tgleason
  8. * Date: Oct 18, 2008
  9. * Time: 8:03:34 PM
  10. * To change this template use File | Settings | File Templates.
  11. */
  12. public class KMLMultiGeometry extends KMLGraphic {
  13. List<KMLGraphic> geometries = new ArrayList<KMLGraphic>();
  14. public KMLMultiGeometry() {
  15. }
  16. public void addGeometry (KMLGraphic graphic) {
  17. geometries.add(graphic);
  18. }
  19. public List<KMLGraphic> getGraphics() {
  20. return geometries;
  21. }
  22. public List<KMLCoord> getCoords() {
  23. List<KMLCoord> coords = new ArrayList<KMLCoord>();
  24. for(KMLGraphic graphic : geometries) {
  25. if(graphic instanceof KMLPoint) {
  26. coords.add(((KMLPoint)graphic).getCoord());
  27. } else if(graphic instanceof KMLLineString) {
  28. coords.addAll(((KMLLineString)graphic).getCoords());
  29. } else if(graphic instanceof KMLPolygon) {
  30. coords.addAll(((KMLPolygon)graphic).getOuter());
  31. }
  32. }
  33. return coords;
  34. }
  35. public Sector getSector() {
  36. return null; //To change body of implemented methods use File | Settings | File Templates.
  37. }
  38. }