source: trunk/src/inc/KMLPlacemark.class.php@ 7692

Last change on this file since 7692 was 7692, checked in by Pieter Naber, 15 years ago

Fixed KML output, it's now valid. Added ID's to the placemarkers.

File size: 2.7 KB
RevLine 
[7661]1<?php
[7627]2/*
3 * Project: NodeMap2.0
4 * File: KMLPlacemark.class.php
5 * Purpose: Placemark used in KMLFile
6 */
7
8class KMLPlacemark {
[7631]9 private $template = '
[7692]10 <Placemark id="%ID%">
[7627]11 <name>%NAME%</name>
[7692]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>
[7632]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>';
[7627]32
[7692]33 private $id; // ID of the node
[7642]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
[7627]40
41 /*
42 * Function: __construct (constructor)
43 * Parameters: -
44 * Function: Creating a new KMLFile
45 */
46 function __construct() {
[7692]47 $this->id = '';
[7642]48 $this->name = '';
49 $this->descriptionLocation = '';
50 $this->descriptionStatus = '';
51 $this->longitude = 0;
52 $this->latitude = 0;
53 $this->style = 'orangeArrowIcon';
[7627]54 }
55
[7692]56 function setID($newID) {
57 $this->id = $newID;
58 }
59
[7631]60 function setName($newName) {
[7627]61 $this->name = $newName;
62 }
63
[7642]64 function getName() {
65 return $this->name;
[7627]66 }
67
[7642]68 function setDescriptionLocation($newDescriptionLocation) {
69 $this->descriptionLocation = (string) $newDescriptionLocation;
70 }
71
72 function setDescriptionStatus($newDescriptionStatus) {
73 $this->descriptionStatus = (string) $newDescriptionStatus;
74 }
75
[7637]76 function setLongitude($newLongitude) {
77 $this->longitude = (double) $newLongitude;
[7627]78 }
79
[7637]80 function setLatitude($newLatitude) {
81 $this->latitude = (double) $newLatitude;
[7627]82 }
83
[7632]84 function setStyle($newStyle) {
85 $this->style = (string) $newStyle;
86 }
87
[7627]88 function toString() {
[7631]89 $toString = $this->template;
[7627]90
[7692]91 $toString = str_replace('%ID%', $this->id, $toString);
[7631]92 $toString = str_replace('%NAME%', $this->name, $toString);
[7642]93 $toString = str_replace('%DESCRIPTION%', $this->descriptionLocation . $this->descriptionStatus, $toString);
[7632]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
[7627]98 return $toString;
99 }
100}
101?>
Note: See TracBrowser for help on using the repository browser.