Skip to content

Commit 3be2dfb

Browse files
author
xavier
committed
Fix ListStyle issues
1 parent 2a8b96c commit 3be2dfb

5 files changed

Lines changed: 38 additions & 12 deletions

File tree

libKML/KMLBuilder.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,22 @@ function buildScreenOverlay($screenOverlayXMLObject) {
145145

146146
processOverlay($screenOverlay, $screenOverlayXMLObject);
147147

148+
$screenOverlayContent = $screenOverlayXMLObject->children();
149+
150+
foreach($screenOverlayContent as $key => $value) {
151+
if ($key == 'rotation') {
152+
$screenOverlay->setRotation((string)$value);
153+
} elseif ($key == 'overlayXY') {
154+
$screenOverlay->setOverlayXY(buildVec2Type($value));
155+
} elseif ($key == 'screenXY') {
156+
$screenOverlay->setScreenXY(buildVec2Type($value));
157+
} elseif ($key == 'rotationXY') {
158+
$screenOverlay->setRotationXY(buildVec2Type($value));
159+
} elseif ($key == 'size') {
160+
$screenOverlay->setSize(buildVec2Type($value));
161+
}
162+
}
163+
148164
return $screenOverlay;
149165
}
150166

libKML/features/Feature.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function __toString() {
6969
$output = array();
7070

7171
if (isset($this->name)) {
72-
$output[] = sprintf("\t<name>%s</name>", $this->name);
72+
$output[] = sprintf("\t<name>%s</name>", htmlentities($this->name));
7373
}
7474

7575
if (isset($this->visibility)) {
@@ -105,7 +105,7 @@ public function __toString() {
105105
}
106106

107107
if (isset($this->description)) {
108-
$output[] = sprintf("\t<description>%s</description>", $this->description);
108+
$output[] = sprintf("\t<description><![CDATA[\n%s\n]]></description>", $this->description);
109109
}
110110

111111
if (isset($this->abstractView)) {

libKML/features/overlays/ScreenOverlay.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,23 @@ public function __toString() {
2323
$output[] = $parent_string;
2424

2525
if (isset($this->rotation)) {
26-
$output[] = sprintf("\t<rotation>%f</rotation>", $this->rotation);
27-
26+
$output[] = sprintf("\t<rotation>%s</rotation>", $this->rotation);
27+
}
28+
29+
if (isset($this->overlayXY)) {
30+
$output[] = sprintf("\t<overlayXY %s />", $this->overlayXY);
31+
}
32+
33+
if (isset($this->screenXY)) {
34+
$output[] = sprintf("\t<screenXY %s />", $this->screenXY);
35+
}
36+
37+
if (isset($this->rotationXY)) {
38+
$output[] = sprintf("\t<rotationXY %s />", $this->rotationXY);
39+
}
40+
41+
if (isset($this->size)) {
42+
$output[] = sprintf("\t<size %s />", $this->size);
2843
}
2944

3045
$output[] = "</ScreenOverlay>";

libkml.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
/*
4444
* Objects
4545
*/
46-
include_once('libKML/KMLBuilder.php');
46+
4747
include_once('libKML/KMLObject.php');
4848
include_once('libKML/Icon.php');
4949
include_once('libKML/features/AltitudeMode.php');
@@ -58,6 +58,7 @@
5858
include_once('libKML/features/overlays/GroundOverlay.php');
5959
include_once('libKML/features/overlays/ScreenOverlay.php');
6060
include_once('libKML/field_types/Coordinates.php');
61+
include_once('libKML/field_types/ItemIconState.php');
6162
include_once('libKML/field_types/RefreshMode.php');
6263
include_once('libKML/field_types/ColorMode.php');
6364
include_once('libKML/field_types/ListItemType.php');
@@ -84,6 +85,7 @@
8485
include_once('libKML/views/AbstractView.php');
8586
include_once('libKML/views/Camera.php');
8687
include_once('libKML/views/LookAt.php');
88+
include_once('libKML/KMLBuilder.php');
8789

8890

8991
function parseKML($data) {

test/parse.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -345,13 +345,6 @@ function init_original_kml() {
345345
</div>
346346
</div>
347347

348-
<div id="generatedJSON" class="block">
349-
<h2>All features</h2>
350-
<div class="content">
351-
<pre><?php print_r($kml->getAllFeatures()); ?></pre>
352-
</div>
353-
</div>
354-
355348
<?php endif; ?>
356349

357350
</body>

0 commit comments

Comments
 (0)