- Timestamp:
- Mar 30, 2010, 9:53:43 PM (15 years ago)
- Location:
- trunk/src/inc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/inc/KMLFile.class.php
r7631 r7632 6 6 */ 7 7 8 define('PLACEMARK_GREEN', 'http://www.google.com/intl/en_us/mapfiles/ms/micons/green-dot.png'); 9 define('PLACEMARK_ORANGE', 'http://www.google.com/intl/en_us/mapfiles/ms/micons/orange-dot.png'); 10 define('PLACEMARK_RED', 'http://www.google.com/intl/en_us/mapfiles/ms/micons/red-dot.png'); 11 8 12 class KMLFile { 9 13 private $template = ' 10 14 <?xml version="1.0" encoding="UTF-8"?> 11 15 <kml xmlns="http://www.opengis.net/kml/2.2"> 12 %CONTENT% 16 <Document> 17 <name>Wireless Leiden Interactive Nodemap 2.0</name> 18 <open>1</open> 19 <description>Wireless Leiden Interactive Nodemap 2.0</description> 20 <Style id="greenArrowIcon"> 21 <IconStyle> 22 <Icon> 23 <href>%PLACEMARK_GREEN%</href> 24 </Icon> 25 </IconStyle> 26 </Style> 27 <Style id="orangeArrowIcon"> 28 <IconStyle> 29 <Icon> 30 <href>%PLACEMARK_ORANGE%</href> 31 </Icon> 32 </IconStyle> 33 </Style> 34 <Style id="redArrowIcon"> 35 <IconStyle> 36 <Icon> 37 <href>%PLACEMARK_RED%</href> 38 </Icon> 39 </IconStyle> 40 </Style> 41 <Folder> 42 <name>Nodes</name> 43 <description>Nodes from the Wireless Leiden network</description> 44 <LookAt> 45 <longitude>52.161087</longitude> 46 <latitude>4.490153</latitude> 47 <altitude>0</altitude> 48 <heading>0</heading> 49 <tilt>0</tilt> 50 <range>500</range> 51 </LookAt> 52 %CONTENT% 53 </Folder> 54 </Document> 13 55 </kml>'; 56 14 57 private $fileFirst = 'type,host_name,has_been_checked,check_execution_time,current_state,last_hard_state,last_check,problem_has_been_acknowledged'; 15 58 private $fileContent = array('string', 'string', 'integer', 'double', 'integer', 'integer', 'integer', 'integer'); … … 38 81 } 39 82 83 $toString = str_replace('%PLACEMARK_GREEN%', PLACEMARK_GREEN, $toString); 84 $toString = str_replace('%PLACEMARK_ORANGE%', PLACEMARK_ORANGE, $toString); 85 $toString = str_replace('%PLACEMARK_RED%', PLACEMARK_RED, $toString); 40 86 $toString = str_replace('%CONTENT%', $placemarkString, $toString); 41 87 -
trunk/src/inc/KMLPlacemark.class.php
r7631 r7632 8 8 class KMLPlacemark { 9 9 private $template = ' 10 < placemark>10 <Placemark> 11 11 <name>%NAME%</name> 12 <visibility>0</visibility> 12 13 <description>%DESCRIPTION%</description> 13 <point> 14 <coordinates>%XCOORDINATE%,%YCOORDINATE%,0</coordinates> 15 </point> 16 </placemark>'; 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>'; 17 28 18 29 private $name; 19 30 private $description; 20 private $xCoordinate; 21 private $yCoordinate; 31 private $longitude; 32 private $latitude; 33 private $style; 22 34 23 35 /* … … 37 49 } 38 50 39 function set XCoordinate($newXCoordinate) {40 $this-> xCoordinate = (double) $newXCoordinate;51 function setLONGITUDE($newLONGITUDE) { 52 $this->longitude = (double) $newLONGITUDE; 41 53 } 42 54 43 function setYCoordinate($newYCoordinate) { 44 $this->yCoordinate = (double) $newYCoordinate; 55 function setLATITUDE($newLATITUDE) { 56 $this->latitude = (double) $newLATITUDE; 57 } 58 59 function setStyle($newStyle) { 60 $this->style = (string) $newStyle; 45 61 } 46 62 … … 50 66 $toString = str_replace('%NAME%', $this->name, $toString); 51 67 $toString = str_replace('%DESCRIPTION%', $this->description, $toString); 52 $toString = str_replace('%XCOORDINATE%', $this->xCoordinate, $toString); 53 $toString = str_replace('%YCOORDINATE%', $this->yCoordinate, $toString); 54 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 55 72 return $toString; 56 73 }
Note:
See TracChangeset
for help on using the changeset viewer.