/**
  * This tests whether a string is KML.
  *
  * @return void
  * @author Eric Rochester
  **/
 public function testIsKml()
 {
     $this->assertTrue(NeatlineFeatures_Functions::isKml("<?xml version='1.0'?>\n" . "<kml xmlns='http://earth.google.com/kml/2.0'>\n" . "<Placemark>" . "<Point>" . "<coordinates>0, 0</coordinates>" . "</Point>" . "</Placemark>" . "</kml>"));
     $this->assertTrue(NeatlineFeatures_Functions::isKml("<?xml version='1.0'?>\n" . "<kml xmlns='http://earth.google.com/kml/2.0'>\n" . "<Placemark>" . "<LineString>" . "<coordinates>0, 0</coordinates>" . "</LineString>" . "</Placemark>" . "</kml>"));
     $this->assertTrue(NeatlineFeatures_Functions::isKml("<?xml version='1.0'?>\n" . "<kml xmlns='http://earth.google.com/kml/2.0'>\n" . "<Placemark>" . "<Polygon>" . "<coordinates>0, 0</coordinates>" . "</Polygon>" . "</Placemark>" . "</kml>"));
     $this->assertTrue(NeatlineFeatures_Functions::isKml("<kml:kml xmlns:kml='http://earth.google.com/kml/2.0'>\n" . "<kml:Placemark>" . "<kml:Polygon>" . "<kml:coordinates>0, 0</kml:coordinates>" . "</kml:Polygon>" . "</kml:Placemark>" . "</kml:kml>"));
     $this->assertFalse(NeatlineFeatures_Functions::isKml("<kml:kml xmlns:kml='http://earth.google.com/kml/2.0'>\n" . "</kml:kml>"));
     $this->assertFalse(NeatlineFeatures_Functions::isKml("<kml>\n" . "</kml>"));
     $this->assertFalse(NeatlineFeatures_Functions::isKml("<?xml version='1.0'?>\n" . "<html>\n" . "</html>"));
     $this->assertFalse(NeatlineFeatures_Functions::isKml("<?xml version='1.0'?>\n" . "<html>\n" . "</html>"));
     $this->assertFalse(NeatlineFeatures_Functions::isKml("MULTIPOLYGON (1 2,3 4,5 6)|END"));
 }
 public static function cdump($obj)
 {
     NeatlineFeatures_Functions::clog(is_null($obj) ? "NULL" : print_r($obj, true));
 }
 /**
  * This tests that we can iterate over mixed coverages.
  *
  * This is a work-around for this spec no longer working, due to O2's 
  * popping up a new window when you click "View Public Page." Technically, 
  * this test should have been a unittest all along, but having it as a 
  * feature keep the planning cleaner.
  *
  *  @kml
  *  @file_fixture @javascript
  *  Scenario: Mixed Feature Coverages
  *    Given I am logged into the admin console
  *    And I replace "themes/default/items/show.php" with "plugins/NeatlineFeatures/features/data/show-display-coverage-test.php"
  *    And I click "Add a new item"
  *    And I enter "Cucumber: Test Iterate Mixed Feature Coverages" for the "Elements-50-0-text"      # Title
  *    And I enter "Iterate Mixed Feature Coverages" for the "Elements-49-0-text"      # Subject
  *    And I click "Use Map" checkbox in "#Elements-38-0-widget"
  *    And I draw a line on "div#Elements-38-0-map.olMap"
  *    And I click "add_element_38"
  *    And I wait 15 seconds
  *    And I enter "UVa" into "Elements-38-1-free"
  *    And I click on "Add Item"
  *    And I click "Test Iterate Mixed Feature Coverages"
  *    When I click "View Public Page"
  *    Then I should see the following output in unordered list "#item-coverage":
  *      | true  |
  *      | false |
  *
  * @return void
  * @author Eric Rochester
  **/
 public function testTestMixedFeatureCoverage()
 {
     $table = $this->db->getTable('NeatlineFeature');
     $utils = new NeatlineFeatures_Utils_View();
     $utils->setCoverageElement();
     $item = new Item();
     $item->save();
     $this->toDelete($item);
     $this->_addElementTextDelete($item, $this->_title, "Unittest: Display All Feature Coverages", 1);
     $this->_addFeature($utils, $table, $item, "<kml xmlns=\"http://earth.google.com/kml/2.0\"><Folder><name>OpenLayers export</name><description>Exported on Thu Mar 07 2013 11:18:43 GMT-0500 (EST)</description><Placemark><name>OpenLayers.Feature.Vector_158</name><description>No description available</description><Polygon><outerBoundaryIs><LinearRing><coordinates>-10194865.083145,4313188.6314755 -9803507.4983789,3295658.9110849 -9744803.8606641,5017632.2840536 -10194865.083145,4313188.6314755</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>OpenLayers.Feature.Vector_182</name><description>No description available</description><LineString><coordinates>-8003262.6084573,5487261.3857724 -10097025.686953,6269976.5553037 -10958012.373438,4724114.0954794</coordinates></LineString></Placemark><Placemark><name>OpenLayers.Feature.Vector_194</name><description>No description available</description><LineString><coordinates>-10958012.373438,4724114.0954794 -10488383.271719,3119547.9979404</coordinates></LineString></Placemark></Folder></kml>|3|-9490421.4305667|3972279.4853711|osm\ncoverage a", 0);
     $this->_addElementTextDelete($item, $this->_coverage, "Charlottesville, VA", 1);
     $this->dispatch('/');
     set_current_record('item', $item);
     $covs = metadata('item', array('Dublin Core', 'Coverage'), array('all' => true, 'no_filter' => true, 'no_escape' => true));
     $this->assertCount(2, $covs);
     $this->assertTrue(NeatlineFeatures_Functions::isKmlCoverage($covs[0]));
     $this->assertFalse(NeatlineFeatures_Functions::isKmlCoverage($covs[1]));
 }
 /**
  * This displays the coverage data as a map, if applicable.
  *
  * @param string  $text  The original text for the element.
  * @param array   $args  The record and element text triggering this.
  *
  * @return The HTML to generate the map.
  * @author Eric Rochester <*****@*****.**>
  **/
 public function filterDisplayItemDublinCoreCoverage($text, $args)
 {
     $record = $args['record'];
     $elementText = $args['element_text'];
     return NeatlineFeatures_Functions::displayCoverage($text, $record, $elementText);
 }