PageRenderTime 33ms CodeModel.GetById 29ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

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