[7661] | 1 | <?php
|
---|
[7622] | 2 | /*
|
---|
| 3 | * Project: NodeMap2.0
|
---|
| 4 | * File: index.php
|
---|
| 5 | * Purpose: Main index file of application
|
---|
| 6 | */
|
---|
| 7 |
|
---|
[7629] | 8 | require_once('config.php');
|
---|
| 9 | require_once($config['file_init']);
|
---|
[7622] | 10 |
|
---|
[7629] | 11 | // Creating a placemark using our class
|
---|
[7637] | 12 | $kmlPlacemark1 = new KMLPlacemark();
|
---|
| 13 | $kmlPlacemark1->setName('Test name');
|
---|
[7642] | 14 | $kmlPlacemark1->setDescriptionLocation('Test location description');
|
---|
| 15 | $kmlPlacemark1->setDescriptionStatus('Test status description');
|
---|
[7637] | 16 | $kmlPlacemark1->setLatitude(52.138476);
|
---|
| 17 | $kmlPlacemark1->setLongitude(4.463046);
|
---|
| 18 | $kmlPlacemark1->setStyle(PLACEMARK_GREEN);
|
---|
[7628] | 19 |
|
---|
[7637] | 20 | // Creating a second placemark using our class
|
---|
| 21 | $kmlPlacemark2 = new KMLPlacemark();
|
---|
| 22 | $kmlPlacemark2->setName('Placemark 2 name');
|
---|
[7642] | 23 | $kmlPlacemark2->setDescriptionLocation('This is the second placemark location description');
|
---|
| 24 | $kmlPlacemark2->setDescriptionStatus('This is the second placemark status description');
|
---|
[7637] | 25 | $kmlPlacemark2->setLatitude(52.638476);
|
---|
| 26 | $kmlPlacemark2->setLongitude(4.063046);
|
---|
| 27 | $kmlPlacemark2->setStyle(PLACEMARK_ORANGE);
|
---|
| 28 |
|
---|
| 29 | // Creating a KMLFile using our class, add our placemarks and echo
|
---|
[7627] | 30 | $kml = new KMLFile();
|
---|
[7637] | 31 | $kml->addPlacemark($kmlPlacemark1);
|
---|
| 32 | $kml->addPlacemark($kmlPlacemark2);
|
---|
[7628] | 33 | echo $kml->toString();
|
---|
[7629] | 34 |
|
---|
[7642] | 35 | echo "\r\n\r\n\r\n\r\n\r\n -------------------------------------------------- \r\n\r\n\r\n\r\n\r\n";
|
---|
| 36 |
|
---|
[7640] | 37 | // Now let's try reading from files and parsing the data in the files.
|
---|
| 38 | // First off, we create a new KMLFile object
|
---|
| 39 | $kmlFile = new KMLFile();
|
---|
| 40 |
|
---|
[7639] | 41 | // Let's try to read the node location file
|
---|
| 42 | $nodeLocation = new FileHandler($config['node_location_file']);
|
---|
[7640] | 43 | $kmlFile->parseLocationFile($nodeLocation->getFile());
|
---|
| 44 | echo $kmlFile->toString();
|
---|
[7639] | 45 |
|
---|
[7642] | 46 | echo "\r\n\r\n\r\n\r\n\r\n -------------------------------------------------- \r\n\r\n\r\n\r\n\r\n";
|
---|
| 47 |
|
---|
[7629] | 48 | // Let's try to read the node status file
|
---|
| 49 | $nodeStatus = new FileHandler($config['node_status_file']);
|
---|
[7640] | 50 | $kmlFile->parseStatusFile($nodeStatus->getFile());
|
---|
[7642] | 51 | echo $kmlFile->toString();
|
---|
[7639] | 52 | /*
|
---|
| 53 | * TODO: Needs better parsing of the file now we have two seperate
|
---|
| 54 | * files for the location and the status of the nodes
|
---|
| 55 | */
|
---|
[7622] | 56 | ?>
|
---|