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

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

Updated ErrorHandler to use our LogHandler. Updated LogHandler with an adjustable error level.

File size: 1.7 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 <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;
30 private $description;
31 private $longitude;
32 private $latitude;
33 private $style;
34
35 /*
36 * Function: __construct (constructor)
37 * Parameters: -
38 * Function: Creating a new KMLFile
39 */
40 function __construct() {
41 }
42
43 function setName($newName) {
44 $this->name = $newName;
45 }
46
47 function setDescription($newDescription) {
48 $this->description = (string) $newDescription;
49 }
50
51 function setLongitude($newLongitude) {
52 $this->longitude = (double) $newLongitude;
53 }
54
55 function setLatitude($newLatitude) {
56 $this->latitude = (double) $newLatitude;
57 }
58
59 function setStyle($newStyle) {
60 $this->style = (string) $newStyle;
61 }
62
63 function toString() {
64 $toString = $this->template;
65
66 $toString = str_replace('%NAME%', $this->name, $toString);
67 $toString = str_replace('%DESCRIPTION%', $this->description, $toString);
68 $toString = str_replace('%LONGITUDE%', $this->longitude, $toString);
69 $toString = str_replace('%LATITUDE%', $this->latitude, $toString);
70 $toString = str_replace('%STYLE%', $this->style, $toString);
71
72 return $toString;
73 }
74}
75?>
Note: See TracBrowser for help on using the repository browser.