Changes between Version 8 and Version 9 of oid/WorkLog/09-02-04


Ignore:
Timestamp:
Feb 4, 2009, 5:48:56 PM (15 years ago)
Author:
jazz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • oid/WorkLog/09-02-04

    v8 v9  
    246246    ### };
    247247
    248     ### 因此這一行的最後結果應該是
    249     ### Location.item=[{"成都",GLatLng(30.670992,104.067993)},{...}] 這樣一個二維陣列
     248    ### 因此這一行的最後結果應該是類似
     249    ### LOCATION.item["成都"].name="成都"
     250    ### LOCATION.item["成都"].point=GLatLng(30.670992,104.067993))
    250251
    251252        LOCATION.setItem(location.name, new Location(location));
     
    257258  };
    258259}}}
    259  * 從 Element 的 prototype 跟建構子看來,Element 類別包含 id, element, type, event 四個 field,getHiddenPolylineOverlay(points, weigth, id)、getArrowGroundOverlay(arrow_url, sw, ne)、getMarker(icon_url, point, id) 三個暫時的 inner function,drawOnMap()、removeFromMap()兩個 method (其他被註解掉了)
     260 * 從 Element 的 prototype 跟建構子看來,Element 類別包含 id, element, type, event 四個標準 field,如果 JSON 型態是 Point 會兒外多出 point 跟 marker 兩個 field,如果 JSON 的型態是 line 則會多出 hidden_polyline 跟 arrow 兩個 field,而 getHiddenPolylineOverlay(points, weigth, id)、getArrowGroundOverlay(arrow_url, sw, ne)、getMarker(icon_url, point, id) 三個暫時的 inner function 是用來產生 marker, hidden_polyline, arraw 的,drawOnMap()、removeFromMap()兩個 method (其他被註解掉了)
    260261{{{
    261262  function Element(raw_element) {
     
    344345  };
    345346}}}
     347{{{
     348  function LoadElement() {
     349
     350    ### 擷取 http://redcliff.googlecode.com/svn/trunk/data_tc/element.json?bpc=12191328
     351    ### element.json 的兩種型態
     352
     353    ### type="point"
     354
     355    ### {"id" : 0 , "type" : "point" , "event_ids" : [0 , 2] , "people" : ["劉備" , "諸葛亮"] ,
     356    ###  "pic" : "G" , "lat" : 32.009524 , "lng" : 111.939524 },
     357
     358    ### type="line"
     359
     360    ### {"id" : 3 , "type" : "line" , "event_ids" : [4] , "people" : ["曹操"] ,
     361    ###  "arrow" : "B_yx_xy" , "arrow_points" : [{"lat" : 36.115129 , "lng" : 114.326413} ,
     362    ###  {"lat" : 32.640746 , "lng" : 112.407843}] , "thickness" : 0.12 ,
     363    ###  "hot_points" : [{"lat" : 36.093 , "lng" : 114.304} , {"lat" : 35.219 , "lng" : 114.069} ,
     364    ###                  {"lat" : 34.113 , "lng" : 113.563} , {"lat" : 33.149 , "lng" : 112.932} ,
     365    ###                  {"lat" : 32.667 , "lng" : 112.431}] ,
     366    ###  "center" : {"lat" : 33.468 , "lng" : 113.167}},
     367
     368    _IG_FetchContent(URL.element_url, function(data) {
     369      var json = eval(data);
     370      $.each(json, function(index, element) {
     371
     372    ### 呼叫 setItem 產生二維陣列
     373    ### 結果應該是
     374    ### ELEMENT.item[0].id     = 0
     375    ### ELEMENT.item[0].type   = point
     376    ### ELEMENT.item[0].point  = GLatLng(32.009524,111.939524);
     377    ### ELEMENT.item[0].marker = GMarker( GLatLng(32.009524,111.939524),
     378    ###                                   GIcon(G_DEFAULT_ICON, http://www.google.cn/staticcn/chibi/icon/G.png)
     379    ### 這個 marker 還註冊了 Click 的事件處理函式是去呼叫 G_MAP.openInfoWindow("ELEMENT", 0, GLatLng(32.009524,111.939524));
     380
     381        ELEMENT.setItem(element.id, new Element(element));
     382      });
     383      ## 把 LOAD_STATES 加 1 - 此時 LOAD_STATES = 1
     384      LoadDone();
     385    })
     386  };
     387 
     388  function LoadEvent() {
     389
     390    ### event.json 的範例
     391    ### {"id" : 0 , "name" : "諸葛亮寓居隆中" , "people" : ["諸葛亮"] , "element_ids" : [0] ,
     392    ###  "search" : ["諸葛亮" , "梁父吟" , "隆中"] , "time" : "建安十二年" , "ad" : "207年" ,
     393    ###  "desc" : "諸葛亮早年與弟弟諸葛均在南陽隆中躬耕隴畝。...略..." ,
     394    ###  "popup" : {"lat" : 32.009524 , "lng" : 111.939524}},
     395
     396    _IG_FetchContent(URL.event_url, function(data) {
     397      var json = eval(data);
     398      $.each(json, function(index, event) {
     399
     400    ### 呼叫 setItem 產生二維陣列
     401    ### 結果應該是
     402    ### EVENT.item[0].id          = 0
     403    ### EVENT.item[0].name        = "諸葛亮寓居隆中"
     404    ### EVENT.item[0].element_ids = [0]
     405    ### EVENT.item[0].people      = ["諸葛亮"]
     406    ### EVENT.item[0].search      = ["諸葛亮" , "梁父吟" , "隆中"]
     407    ### EVENT.item[0].time        = "建安十二年"
     408    ### EVENT.item[0].time_ad     = "207年"
     409    ### EVENT.item[0].desc        = "諸葛亮早年與弟弟諸葛均在南陽隆中躬耕隴畝。...略..."
     410    ### EVENT.item[0].point       = GLatLng(32.009524,111.939524)
     411
     412        EVENT.setItem(event.id, new Event(event));
     413      });
     414      LoadBigEvent();
     415      LoadPeople();
     416    });   
     417  };
     418
     419  function LoadBigEvent() {
     420
     421    ### event.json 的範例
     422    ### {"id" : 0 , "name" : "三顧茅蘆" , "event_ids" : [0 , 1 , 2] , "element_ids" : [0 , 1] ,
     423    ###  "desc" : "諸葛亮在隆中躬耕,...略" , "time" : "建安十二年" , "ad" : "207年" ,
     424    ###  "center" : {"lat" : 32.010 , "lng" : 111.939} ,"pic" : "G" , "images" : [] },
     425
     426    _IG_FetchContent(URL.big_event_url, function(data) {
     427      var json = eval(data);
     428      $.each(json, function(index, big_event) {
     429
     430    ### 呼叫 setItem 產生二維陣列
     431    ### 結果應該是
     432    ### BIG_EVENT.item[0].id          = 0
     433    ### BIG_EVENT.item[0].name        = "三顧茅蘆"
     434    ### BIG_EVENT.item[0].element_ids = [0 , 1]
     435    ### BIG_EVENT.item[0].event_ids   = [0 , 1 , 2]
     436    ### BIG_EVENT.item[0].time        = "建安十二年"
     437    ### BIG_EVENT.item[0].time_ad     = "207年"
     438    ### BIG_EVENT.item[0].desc        = "諸葛亮在隆中躬耕,...略"
     439    ### BIG_EVENT.item[0].pic         = "G"
     440    ### BIG_EVENT.item[0].is_details_shown = false;
     441    ### BIG_EVENT.item[0].details     = null;
     442    ### BIG_EVENT.item[0].images      = []
     443    ### BIG_EVENT.item[0].center      = GLatLng(32.010, 111.939)
     444    ### BIG_EVENT.item[0].node        =
     445    ### BIG_EVENT.item[0].is_shown    = true;
     446
     447        BIG_EVENT.setItem(big_event.id, new BigEvent(big_event));
     448      });
     449      ## 把 LOAD_STATES 加 1
     450      LoadDone();
     451    });
     452  };
     453
     454  function LoadPeople() {
     455    _IG_FetchContent(URL.people_url, function(data) {
     456      var json = eval(data);
     457      $.each(json, function(index, raw_people) {
     458        var people = new People(raw_people)
     459        PEOPLE.setItem(people.name, people);
     460        PEOPLE_ARRAY.push(people);
     461      });
     462      ## 把 LOAD_STATES 加 1
     463      LoadDone();
     464    });
     465  };
     466}}}
     467