Changeset 202

Show
Ignore:
Timestamp:
06/04/08 11:13:00
Author:
dan
Message:

Sub: KMLAddPlacemarkSimple
Changes: Added call to KMLAddDescription to add in the observation HTML table into a

description tag.
Also added the creation of the <name> tag to properly name our placemark.
Sub: KMLAddObsList
Changes: Added building the observation HTML table string while building the metadata.
Sub: KMLAddDescription
Changes: Added subroutine.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • obskml/trunk/General/obsKMLSubRoutines.pm

    r181 r202  
     1####################################################################################################### 
     2#Revisions 
     3#Rev: 1.1.0.0 
     4#Author: DWR 
     5#Date: 6/4/2008 
     6#Sub: KMLAddPlacemarkSimple 
     7#Changes: Added call to KMLAddDescription to add in the observation HTML table into a description tag. 
     8#         Also added the creation of the <name> tag to properly name our placemark. 
     9#Sub: KMLAddObsList 
     10#Changes: Added building the observation HTML table string while building the metadata. 
     11#Sub: KMLAddDescription 
     12#Changes: Added subroutine. 
     13####################################################################################################### 
     14 
    115package obsKMLSubRoutines;  
    216 
     
    496510  my $rObsForPlatformDate = $hObsList->{PlatformID}{$strPlatformID}{TimeStamp}{$Date}; 
    497511  my $strPlatformURL = $hObsList->{PlatformID}{$strPlatformID}{PlatformURL}; 
    498   KMLAddObsList( $Doc, $Metadata, $strPlatformURL, $rObsForPlatformDate ); 
     512  #DWR v1.1.0.0 
     513  #Added the string strDesc to be populated while building the obs list. This will contain an html table that Google Earth 
     514  #can display of the obs/values when we click on a point. 
     515  my $strDesc; 
     516  KMLAddObsList( $Doc, $Metadata, $strPlatformURL, $rObsForPlatformDate, \$strDesc ); 
     517  #print( "KMLAddPlacemarkSimple::Desc: $strDesc\n"); 
    499518 
    500519  $Placemark->appendChild( $Metadata );  
     
    505524  KMLAddLatLong( $Doc, $Placemark, $Latitude, $Longitude ); 
    506525  KMLAddTimeStamp( $Doc, $Placemark, $Date ); 
     526  #DWR v1.1.0.0 
     527  KMLAddDescription( $Doc, $Placemark, $strDesc ); 
     528  AddChild( $Doc, $Placemark, 'name', $strPlatformID ); 
    507529   
    508530  $Parent->appendChild( $Placemark ); 
     
    537559  $Parent->appendChild( $TimeStamp ); 
    538560 
     561} 
     562######################################################################################################## 
     563# KMLAddDescription 
     564# Adds the timestamp into the placemark tag. 
     565######################################################################################################## 
     566sub KMLAddDescription#( $Doc, $Parent, $strDesc ) 
     567{ 
     568  my ( $Doc, $Parent, $strDesc ) = @_; 
     569   
     570  my $Desc = $Doc->createElement( 'description');  
     571  my $CDATADesc = $Doc->createCDATASection( $strDesc ); 
     572  $Desc->appendChild( $CDATADesc ); 
     573  $Parent->appendChild( $Desc ); 
    539574} 
    540575 
     
    550585#     $hObsList{elev}{obsType}{value} 
    551586#     $hObsList{elev}{obsType}{uomType} 
    552 ######################################################################################################## 
    553  
    554 sub KMLAddObsList #( $Doc, $Parent, $strPlatformURL, $hObsList ) 
    555 
    556   my( $Doc, $Parent, $strPlatformURL, $hObsList ) = @_; 
     587# 5) $strDescription a reference to a string that will get populated with an HTML table displaying  
     588#     the observations. 
     589######################################################################################################## 
     590 
     591sub KMLAddObsList #( $Doc, $Parent, $strPlatformURL, $hObsList, \$strDescription ) 
     592
     593  my( $Doc, $Parent, $strPlatformURL, $hObsList, $strDescription ) = @_;  #DWR v1.1.0.0 Add description reference. 
    557594   
    558595  #Create the obsList parent tag to place the obs under. 
    559596  my $ObsList = $Doc->createElement( 'obsList'); 
    560597  AddChild( $Doc, $ObsList, 'platformURL', $strPlatformURL ); 
     598   
     599  #DWR v1.1.0.0 
     600  #Create the data for the descrition tag. 
     601  $$strDescription = '<table>'; 
    561602  foreach my $Elev ( reverse sort { $a <=> $b } keys %{$hObsList->{elev}} )   
    562603  { 
     
    582623      #Add the child tag to the parent, ObsList. 
    583624      $ObsList->appendChild( $Obs ); 
     625      #DWR v1.1.0.0 
     626      #Each obs has its own row with the observation type, value, and units of measurement. 
     627      $$strDescription = $$strDescription."<tr><td>$ObsType</td><td>$hObsList->{elev}{$Elev}{obsType}{$ObsType}{value}</td><td>$hObsList->{elev}{$Elev}{obsType}{$ObsType}{uomType}</td></tr>"; 
    584628    } 
    585629  } 
     630  $$strDescription = $$strDescription.'</table>'; 
     631  #print( "KMLAddObsList::Desc: $$strDescription\n"); 
     632   
    586633  # Add the ObsList tag with all attached obs to the parent. 
    587634  $Parent->appendChild( $ObsList );