Ignore:
Timestamp:
Dec 8, 2009, 4:34:19 PM (15 years ago)
Author:
rider
Message:

KML file loaded & Timeline revised

File:
1 edited

Legend:

Unmodified
Added
Removed
  • oceandb/jQuery_Prototype/script/oceandb.js

    r114 r122  
    11var map;  // Google Map2 物件
    22var ge;   // Google Earth Plugin 物件
    3 var icon;
     3var icon; // Google Map2 icon creator
    44var tm;   // Google Map2 Timeline
    55
     
    104104  // 設定地圖高度
    105105  var map_height=document.documentElement.clientHeight - 68;
     106
    106107  $('#mapcontainer').css( { height: map_height } );
    107108  $('#main').css( { height: map_height } );
     
    123124// 註冊 window 物件的 onResize Event
    124125// 參考: http://docs.jquery.com/Events
    125 $(window).resize(function() {
     126  $(window).resize(function() {
    126127  // 當改變瀏覽器大小時,重新設定地圖高度
    127128  var map_height=document.documentElement.clientHeight - 68;
     
    135136  mapId: "map",               // Id of map div element (required)
    136137  timelineId: "timeline",     // Id of timeline div element (required)
    137   datasets: [
     138  datasets: [                 
    138139      {
    139                 id: "artists",
    140     title: "Artists",
    141     theme: TimeMapDataset.orangeTheme({eventIconPath: "./image"}),
    142     // note that the lines below are now the preferred syntax
    143     type: "basic",
     140    title: "海研三號 OR3-1412",
     141    theme: "red",
     142    type: "kml",        // KML
    144143    options: {
    145         items: [
    146       {
    147         "start" : "1981",
    148                           "end" : "2009-01-11",
    149         "point" : {
    150             "lat" : 23.8123,
    151                   "lon" : 121.123
    152          },
    153         "title" : "中央氣象局",
    154         "options" : {
    155           // set the full HTML for the info window
    156           "infoHtml": "<div class='custominfostyle'><b>中央氣象局.</div>"
    157         }
    158       },
    159       {
    160         "start" : "1991",
    161         "end" : "2010",
    162         "point" : {
    163             "lat" : 22.5234,
    164             "lon" : 120.534
    165          },
    166        "title" : "海洋科技研究中心",
    167        "options" : {
    168          // load HTML from another file via AJAX
    169          // Note that this may break in IE if you're running it with
    170          // a local file, due to cross-site scripting restrictions
    171          "infoUrl": "http://www.nchc.org.tw",
    172          "theme": TimeMapDataset.redTheme({eventIconPath: "./image"})
    173         }
    174             }, 
    175                         {
    176        "start" : "2001",
    177        "end" : "2020",
    178        "point" : {
    179            "lat" : 24.8345,
    180            "lon" : 122.845
    181         },
    182        "title" : "經濟部水利署",
    183        "options" : {
    184          // use the default title/description info window
    185          "description": "Renaissance Man",
    186          "theme": TimeMapDataset.yellowTheme({eventIconPath: "image/"})
    187         }
    188       }
    189                       ]
     144    url: "data/kml/OR3-1412.kml" // Load KML file
     145          }
     146      }
     147      /*
     148      {
     149    title: "海研三號 OR3-1412",
     150    theme: "green",
     151    type: "progressive",
     152    options: {
     153        // Data to be loaded in JSON from a remote URL
     154        type: "json",  // JSON
     155        // url with start/end placeholders
     156        // url: "http://s2home.nchc.org.tw/oid/data/test.json",
     157        // TestCase
     158        // url: "http://www.nickrabinowitz.com/projects/timemap/progsvc.php?start=[start]&end=[end]&callback=",
     159        start: "1989-01-01",
     160        // lower cutoff date for data
     161        dataMinDate: "2009-12-31",
     162        // four months in milliseconds
     163        interval: 10368000000,
     164        // function to turn date into string appropriate for service
     165        formatDate: function(d) {
     166      return TimeMap.util.formatDate(d, 1);
    190167        }
    191     }   
    192       ],
    193       bandIntervals: [     
     168    }
     169      }
     170      */
     171        ],
     172  bandInfo: [ //上軸時間間隔與大小設定   
     173      {
     174         width:          "70%",
     175         intervalUnit:   Timeline.DateTime.MONTH,
     176         intervalPixels: 210
     177      },
     178      {       //下軸時間間隔與大小設定
     179         width:          "30%",                               intervalUnit:   Timeline.DateTime.YEAR,
     180         intervalPixels: 150,
     181         showEventText:  false,
     182         trackHeight:    0.2,
     183         trackGap:       0.2
     184      }
     185  ],
     186  /*
     187  bandIntervals: [     
    194188    Timeline.DateTime.DECADE,
    195189    Timeline.DateTime.CENTURY
    196       ] 
    197   });
    198         // manipulate the timemap further here if you like
     190 
     191        ] */ 
     192    });
    199193 
    200194      if (GBrowserIsCompatible()) {
Note: See TracChangeset for help on using the changeset viewer.