[7627] | 1 | <?
|
---|
| 2 | /*
|
---|
| 3 | * Project: NodeMap2.0
|
---|
| 4 | * File: KMLPlacemark.class.php
|
---|
| 5 | * Purpose: Placemark used in KMLFile
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | class KMLPlacemark {
|
---|
[7631] | 9 | private $template = '
|
---|
[7632] | 10 | <Placemark>
|
---|
[7627] | 11 | <name>%NAME%</name>
|
---|
[7632] | 12 | <visibility>0</visibility>
|
---|
[7627] | 13 | <description>%DESCRIPTION%</description>
|
---|
[7632] | 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>';
|
---|
[7627] | 28 |
|
---|
| 29 | private $name;
|
---|
| 30 | private $description;
|
---|
[7632] | 31 | private $longitude;
|
---|
| 32 | private $latitude;
|
---|
| 33 | private $style;
|
---|
[7627] | 34 |
|
---|
| 35 | /*
|
---|
| 36 | * Function: __construct (constructor)
|
---|
| 37 | * Parameters: -
|
---|
| 38 | * Function: Creating a new KMLFile
|
---|
| 39 | */
|
---|
| 40 | function __construct() {
|
---|
| 41 | }
|
---|
| 42 |
|
---|
[7631] | 43 | function setName($newName) {
|
---|
[7627] | 44 | $this->name = $newName;
|
---|
| 45 | }
|
---|
| 46 |
|
---|
[7631] | 47 | function setDescription($newDescription) {
|
---|
| 48 | $this->description = (string) $newDescription;
|
---|
[7627] | 49 | }
|
---|
| 50 |
|
---|
[7637] | 51 | function setLongitude($newLongitude) {
|
---|
| 52 | $this->longitude = (double) $newLongitude;
|
---|
[7627] | 53 | }
|
---|
| 54 |
|
---|
[7637] | 55 | function setLatitude($newLatitude) {
|
---|
| 56 | $this->latitude = (double) $newLatitude;
|
---|
[7627] | 57 | }
|
---|
| 58 |
|
---|
[7632] | 59 | function setStyle($newStyle) {
|
---|
| 60 | $this->style = (string) $newStyle;
|
---|
| 61 | }
|
---|
| 62 |
|
---|
[7627] | 63 | function toString() {
|
---|
[7631] | 64 | $toString = $this->template;
|
---|
[7627] | 65 |
|
---|
[7631] | 66 | $toString = str_replace('%NAME%', $this->name, $toString);
|
---|
| 67 | $toString = str_replace('%DESCRIPTION%', $this->description, $toString);
|
---|
[7632] | 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 |
|
---|
[7627] | 72 | return $toString;
|
---|
| 73 | }
|
---|
| 74 | }
|
---|
| 75 | ?>
|
---|