Skip to content

Commit fafca83

Browse files
committed
GeoRSS fixes
1 parent bded4d0 commit fafca83

File tree

3 files changed

+178
-170
lines changed

3 files changed

+178
-170
lines changed

src/gov/nasa/worldwind/formats/georss/GeoRSSParser.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,9 @@ private static Renderable makePolygonShape(Node node, Iterable<Node> attrs) {
283283
if (elevation != 0) {
284284
Path path = new Path(positions, elevation);
285285
path.setAttributes(new BasicShapeAttributes());
286+
path.getAttributes().setOutlineMaterial(Material.WHITE);
287+
path.setFollowTerrain(true);
286288
path.setPathType(AVKey.GREAT_CIRCLE);
287-
288289
return path;
289290
} else {
290291
return new SurfacePolygon(positions);
@@ -382,13 +383,17 @@ private static Renderable makeLineShape(Node node, Iterable<Node> attrs) {
382383
}
383384

384385
double elevation = attrs != null ? getElevation(node, attrs) : 0d;
386+
Path path;
385387
if (elevation != 0) {
386-
Path path = new Path(positions, elevation);
387-
path.setPathType(AVKey.GREAT_CIRCLE);
388-
return path;
388+
path = new Path(positions, elevation);
389389
} else {
390-
return new Path(positions, 0);
390+
path = new Path(positions, 0);
391391
}
392+
path.setAttributes(new BasicShapeAttributes());
393+
path.getAttributes().setOutlineMaterial(Material.WHITE);
394+
path.setFollowTerrain(true);
395+
path.setPathType(AVKey.GREAT_CIRCLE);
396+
return path;
392397
}
393398

394399
@SuppressWarnings({"UnusedDeclaration"})

src/gov/nasa/worldwindx/examples/GeoRSS.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ private RenderableLayer buildGeoRSSLayer() {
4242
addRenderables(layer, shapes);
4343
}
4444

45+
shapes = GeoRSSParser.parseShapes(GeoRSS_DOCSTRING_C);
46+
if (shapes != null) {
47+
addRenderables(layer, shapes);
48+
}
49+
4550
return layer;
4651
}
4752

@@ -111,6 +116,32 @@ private void addRenderables(RenderableLayer layer, Iterable<Renderable> renderab
111116
+ "</entry>"
112117
+ "</feed>";
113118

119+
private static final String GeoRSS_DOCSTRING_C
120+
= "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
121+
+ "<feed xmlns=\"http://www.w3.org/2005/Atom\""
122+
+ " xmlns:georss=\"http://www.georss.org/georss\""
123+
+ " xmlns:gml=\"http://www.opengis.net/gml\">"
124+
+ " <title>An X</title>"
125+
+ " <subtitle>Line test</subtitle>"
126+
+ " <link href=\"http://example.org/\"/>"
127+
+ " <updated>2005-12-13T18:30:02Z</updated>"
128+
+ " <author>"
129+
+ " <name>NASA</name>"
130+
+ " <email>nasa@nasa.gov</email>"
131+
+ " </author>"
132+
+ " <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>"
133+
+ " <entry>"
134+
+ " <title>An X</title>"
135+
+ " <link href=\"http://example.org/2005/09/09/atom01\"/>"
136+
+ " <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>"
137+
+ " <updated>2005-08-17T07:02:32Z</updated>"
138+
+ " <summary>Test</summary>"
139+
+ " <georss:line>45 -95 44 -94</georss:line>"
140+
+ " <georss:line>45 -94 44 -95</georss:line>"
141+
+ " <georss:elev>1000</georss:elev>"
142+
+ " </entry>"
143+
+ "</feed>";
144+
114145
public static void main(String[] args) {
115146
ApplicationTemplate.start("WorldWind GeoRSS", AppFrame.class);
116147
}

0 commit comments

Comments
 (0)