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

Last change on this file since 7631 was 7631, checked in by Pieter Naber, 13 years ago

Fixed a lot of bugs, introduced KMLFile::parseFile for parsing the node status file

File size: 1.3 KB
Line 
1<?
2/*
3 * Project: NodeMap2.0
4 * File: KMLPlacemark.class.php
5 * Purpose: Placemark used in KMLFile
6 */
7
8class KMLPlacemark {
9 private $template = '
10 <placemark>
11 <name>%NAME%</name>
12 <description>%DESCRIPTION%</description>
13 <point>
14 <coordinates>%XCOORDINATE%,%YCOORDINATE%,0</coordinates>
15 </point>
16 </placemark>';
17
18 private $name;
19 private $description;
20 private $xCoordinate;
21 private $yCoordinate;
22
23 /*
24 * Function: __construct (constructor)
25 * Parameters: -
26 * Function: Creating a new KMLFile
27 */
28 function __construct() {
29 }
30
31 function setName($newName) {
32 $this->name = $newName;
33 }
34
35 function setDescription($newDescription) {
36 $this->description = (string) $newDescription;
37 }
38
39 function setXCoordinate($newXCoordinate) {
40 $this->xCoordinate = (double) $newXCoordinate;
41 }
42
43 function setYCoordinate($newYCoordinate) {
44 $this->yCoordinate = (double) $newYCoordinate;
45 }
46
47 function toString() {
48 $toString = $this->template;
49
50 $toString = str_replace('%NAME%', $this->name, $toString);
51 $toString = str_replace('%DESCRIPTION%', $this->description, $toString);
52 $toString = str_replace('%XCOORDINATE%', $this->xCoordinate, $toString);
53 $toString = str_replace('%YCOORDINATE%', $this->yCoordinate, $toString);
54
55 return $toString;
56 }
57}
58?>
Note: See TracBrowser for help on using the repository browser.