1 | <?php
|
---|
2 | /*
|
---|
3 | * Project: NodeMap2.0
|
---|
4 | * File: KMLPlacemark.class.php
|
---|
5 | * Purpose: Placemark used in KMLFile
|
---|
6 | */
|
---|
7 |
|
---|
8 | class KMLPlacemark {
|
---|
9 | private $template = '
|
---|
10 | <Placemark id="%ID%">
|
---|
11 | <name>%NAME%</name>
|
---|
12 | <description>
|
---|
13 | <![CDATA[
|
---|
14 | <img src="http://www.wirelessleiden.nl/sites/wirelessleiden.nl/files/garland-wl_logo.png" alt="Wireless Leiden" title="Wireless Leiden" style="float: right;"/>
|
---|
15 | %DESCRIPTION%
|
---|
16 | ]]>
|
---|
17 | </description>
|
---|
18 | <LookAt>
|
---|
19 | <longitude>%LONGITUDE%</longitude>
|
---|
20 | <latitude>%LATITUDE%</latitude>
|
---|
21 | <altitude>0</altitude>
|
---|
22 | <heading>0</heading>
|
---|
23 | <tilt>0</tilt>
|
---|
24 | <range>500</range>
|
---|
25 | </LookAt>
|
---|
26 | <styleUrl>%STYLE%</styleUrl>
|
---|
27 | <Point>
|
---|
28 | <altitudeMode>relativeToGround</altitudeMode>
|
---|
29 | <coordinates>%LONGITUDE%,%LATITUDE%</coordinates>
|
---|
30 | </Point>
|
---|
31 | </Placemark>';
|
---|
32 |
|
---|
33 | private $id; // ID of the node
|
---|
34 | private $name; // Name of the node
|
---|
35 | private $descriptionLocation; // Location information of the node
|
---|
36 | private $descriptionStatus; // Status information of the node
|
---|
37 | private $longitude; // Longitude of the node
|
---|
38 | private $latitude; // Latitude of the node
|
---|
39 | private $style; // Style of the placemark
|
---|
40 |
|
---|
41 | /*
|
---|
42 | * Function: __construct (constructor)
|
---|
43 | * Parameters: -
|
---|
44 | * Function: Creating a new KMLFile
|
---|
45 | */
|
---|
46 | function __construct() {
|
---|
47 | $this->id = '';
|
---|
48 | $this->name = '';
|
---|
49 | $this->descriptionLocation = '';
|
---|
50 | $this->descriptionStatus = '';
|
---|
51 | $this->longitude = 0;
|
---|
52 | $this->latitude = 0;
|
---|
53 | $this->style = 'orangeArrowIcon';
|
---|
54 | }
|
---|
55 |
|
---|
56 | function setID($newID) {
|
---|
57 | $this->id = $newID;
|
---|
58 | }
|
---|
59 |
|
---|
60 | function setName($newName) {
|
---|
61 | $this->name = $newName;
|
---|
62 | }
|
---|
63 |
|
---|
64 | function getName() {
|
---|
65 | return $this->name;
|
---|
66 | }
|
---|
67 |
|
---|
68 | function setDescriptionLocation($newDescriptionLocation) {
|
---|
69 | $this->descriptionLocation = (string) $newDescriptionLocation;
|
---|
70 | }
|
---|
71 |
|
---|
72 | function setDescriptionStatus($newDescriptionStatus) {
|
---|
73 | $this->descriptionStatus = (string) $newDescriptionStatus;
|
---|
74 | }
|
---|
75 |
|
---|
76 | function setLongitude($newLongitude) {
|
---|
77 | $this->longitude = (double) $newLongitude;
|
---|
78 | }
|
---|
79 |
|
---|
80 | function setLatitude($newLatitude) {
|
---|
81 | $this->latitude = (double) $newLatitude;
|
---|
82 | }
|
---|
83 |
|
---|
84 | function setStyle($newStyle) {
|
---|
85 | $this->style = (string) $newStyle;
|
---|
86 | }
|
---|
87 |
|
---|
88 | function toString() {
|
---|
89 | $toString = $this->template;
|
---|
90 |
|
---|
91 | $toString = str_replace('%ID%', $this->id, $toString);
|
---|
92 | $toString = str_replace('%NAME%', $this->name, $toString);
|
---|
93 | $toString = str_replace('%DESCRIPTION%', $this->descriptionLocation . $this->descriptionStatus, $toString);
|
---|
94 | $toString = str_replace('%LONGITUDE%', $this->longitude, $toString);
|
---|
95 | $toString = str_replace('%LATITUDE%', $this->latitude, $toString);
|
---|
96 | $toString = str_replace('%STYLE%', $this->style, $toString);
|
---|
97 |
|
---|
98 | return $toString;
|
---|
99 | }
|
---|
100 | }
|
---|
101 | ?>
|
---|