source: trunk/src/class/KMLPlacemark.class.php@ 7628

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

Added some contraints, created a index file for a simple test.

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 final $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(string $newName) {
32 $this->name = $newName;
33 }
34
35 function setDescription(string $newDescription) {
36 $this->description = $newDescription;
37 }
38
39 function setXCoordinate(float $newXCoordinate) {
40 $this->xCoordinate = $newXCoordinate;
41 }
42
43 function setYCoordinate(float $newYCoordinate) {
44 $this->yCoordinate = $newYCoordinate;
45 }
46
47 function toString() {
48 $toString = $template;
49
50 $toString = preg_replace('%NAME%', $this->name, $toString);
51 $toString = preg_replace('%DESCRIPTION%', $this->description, $toString);
52 $toString = preg_replace('%XCOORDINATE%', $this->xCoordinate, $toString);
53 $toString = preg_replace('%YCOORDINATE%', $this->yCoordinate, $toString);
54
55 return $toString;
56 }
57}
58?>
Note: See TracBrowser for help on using the repository browser.