Changeset 202
- Timestamp:
- 06/04/08 11:13:00
- Files:
-
- obskml/trunk/General/obsKMLSubRoutines.pm (modified) (6 diffs)
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 1 15 package obsKMLSubRoutines; 2 16 … … 496 510 my $rObsForPlatformDate = $hObsList->{PlatformID}{$strPlatformID}{TimeStamp}{$Date}; 497 511 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"); 499 518 500 519 $Placemark->appendChild( $Metadata ); … … 505 524 KMLAddLatLong( $Doc, $Placemark, $Latitude, $Longitude ); 506 525 KMLAddTimeStamp( $Doc, $Placemark, $Date ); 526 #DWR v1.1.0.0 527 KMLAddDescription( $Doc, $Placemark, $strDesc ); 528 AddChild( $Doc, $Placemark, 'name', $strPlatformID ); 507 529 508 530 $Parent->appendChild( $Placemark ); … … 537 559 $Parent->appendChild( $TimeStamp ); 538 560 561 } 562 ######################################################################################################## 563 # KMLAddDescription 564 # Adds the timestamp into the placemark tag. 565 ######################################################################################################## 566 sub 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 ); 539 574 } 540 575 … … 550 585 # $hObsList{elev}{obsType}{value} 551 586 # $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 591 sub KMLAddObsList #( $Doc, $Parent, $strPlatformURL, $hObsList, \$strDescription ) 592 { 593 my( $Doc, $Parent, $strPlatformURL, $hObsList, $strDescription ) = @_; #DWR v1.1.0.0 Add description reference. 557 594 558 595 #Create the obsList parent tag to place the obs under. 559 596 my $ObsList = $Doc->createElement( 'obsList'); 560 597 AddChild( $Doc, $ObsList, 'platformURL', $strPlatformURL ); 598 599 #DWR v1.1.0.0 600 #Create the data for the descrition tag. 601 $$strDescription = '<table>'; 561 602 foreach my $Elev ( reverse sort { $a <=> $b } keys %{$hObsList->{elev}} ) 562 603 { … … 582 623 #Add the child tag to the parent, ObsList. 583 624 $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>"; 584 628 } 585 629 } 630 $$strDescription = $$strDescription.'</table>'; 631 #print( "KMLAddObsList::Desc: $$strDescription\n"); 632 586 633 # Add the ObsList tag with all attached obs to the parent. 587 634 $Parent->appendChild( $ObsList );
