1 | <?
|
---|
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>
|
---|
11 | <name>%NAME%</name>
|
---|
12 | <visibility>0</visibility>
|
---|
13 | <description>%DESCRIPTION%</description>
|
---|
14 | <LookAt>
|
---|
15 | <longitude>%LONGITUDE%</longitude>
|
---|
16 | <latitude>%LATITUDE%</latitude>
|
---|
17 | <altitude>0</altitude>
|
---|
18 | <heading>0</heading>
|
---|
19 | <tilt>0</tilt>
|
---|
20 | <range>500</range>
|
---|
21 | </LookAt>
|
---|
22 | <styleUrl>%STYLE%</styleUrl>
|
---|
23 | <Point>
|
---|
24 | <altitudeMode>relativeToGround</altitudeMode>
|
---|
25 | <coordinates>%LONGITUDE%,%LATITUDE%</coordinates>
|
---|
26 | </Point>
|
---|
27 | </Placemark>';
|
---|
28 |
|
---|
29 | private $name; // Name of the node
|
---|
30 | private $descriptionLocation; // Location information of the node
|
---|
31 | private $descriptionStatus; // Status information of the node
|
---|
32 | private $longitude; // Longitude of the node
|
---|
33 | private $latitude; // Latitude of the node
|
---|
34 | private $style; // Style of the placemark
|
---|
35 |
|
---|
36 | /*
|
---|
37 | * Function: __construct (constructor)
|
---|
38 | * Parameters: -
|
---|
39 | * Function: Creating a new KMLFile
|
---|
40 | */
|
---|
41 | function __construct() {
|
---|
42 | $this->name = '';
|
---|
43 | $this->descriptionLocation = '';
|
---|
44 | $this->descriptionStatus = '';
|
---|
45 | $this->longitude = 0;
|
---|
46 | $this->latitude = 0;
|
---|
47 | $this->style = 'orangeArrowIcon';
|
---|
48 | }
|
---|
49 |
|
---|
50 | function setName($newName) {
|
---|
51 | $this->name = $newName;
|
---|
52 | }
|
---|
53 |
|
---|
54 | function getName() {
|
---|
55 | return $this->name;
|
---|
56 | }
|
---|
57 |
|
---|
58 | function setDescriptionLocation($newDescriptionLocation) {
|
---|
59 | $this->descriptionLocation = (string) $newDescriptionLocation;
|
---|
60 | }
|
---|
61 |
|
---|
62 | function setDescriptionStatus($newDescriptionStatus) {
|
---|
63 | $this->descriptionStatus = (string) $newDescriptionStatus;
|
---|
64 | }
|
---|
65 |
|
---|
66 | function setLongitude($newLongitude) {
|
---|
67 | $this->longitude = (double) $newLongitude;
|
---|
68 | }
|
---|
69 |
|
---|
70 | function setLatitude($newLatitude) {
|
---|
71 | $this->latitude = (double) $newLatitude;
|
---|
72 | }
|
---|
73 |
|
---|
74 | function setStyle($newStyle) {
|
---|
75 | $this->style = (string) $newStyle;
|
---|
76 | }
|
---|
77 |
|
---|
78 | function toString() {
|
---|
79 | $toString = $this->template;
|
---|
80 |
|
---|
81 | $toString = str_replace('%NAME%', $this->name, $toString);
|
---|
82 | $toString = str_replace('%DESCRIPTION%', $this->descriptionLocation . $this->descriptionStatus, $toString);
|
---|
83 | $toString = str_replace('%LONGITUDE%', $this->longitude, $toString);
|
---|
84 | $toString = str_replace('%LATITUDE%', $this->latitude, $toString);
|
---|
85 | $toString = str_replace('%STYLE%', $this->style, $toString);
|
---|
86 |
|
---|
87 | return $toString;
|
---|
88 | }
|
---|
89 | }
|
---|
90 | ?>
|
---|