rave.js 1.4 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946
  1. (function() {
  2. var $ = {};
  3. // $source: com/ibm/rave/core/internal/nativeImpl/ModuleHeader
  4. /************************************************************************
  5. ** IBM Confidential
  6. **
  7. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8. **
  9. ** (C) Copyright IBM Corp. 2014
  10. **
  11. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13. ************************************************************************/
  14. // setup
  15. var rave_document = this.document;
  16. var rave_externs = {};
  17. function rave_documentElement(node) {
  18. if (node) {
  19. node = node._rave_isDOM ? node : node.rave_getOwner ? node.rave_getOwner() : node;
  20. }
  21. return node
  22. && (node.ownerDocument // node is a Node
  23. || node.document // node is a Window
  24. || node).documentElement; // node is a Document
  25. }
  26. function rave_window(node) {
  27. if (node) {
  28. node = node._rave_isDOM ? node : node.rave_getOwner ? node.rave_getOwner() : node;
  29. }
  30. return node
  31. && ((node.ownerDocument && node.ownerDocument.defaultView) // node is a Node
  32. || (node.document && node) // node is a Window
  33. || node.defaultView); // node is a Document
  34. }
  35. // $source: com/ibm/rave/core/internal/util/NamespaceUtil
  36. /************************************************************************
  37. ** IBM Confidential
  38. **
  39. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  40. **
  41. ** (C) Copyright IBM Corp. 2015
  42. **
  43. ** The source code for this program is not published or otherwise divested of its trade secrets,
  44. ** irrespective of what has been deposited with the U.S. Copyright Office.
  45. ************************************************************************/
  46. // GENERATED
  47. var com_ibm_rave_core_internal_util_NamespaceUtil = {
  48. };
  49. com_ibm_rave_core_internal_util_NamespaceUtil.initialize_NAMESPACES = function() {
  50. var NAMESPACES = {};
  51. NAMESPACES["svg"] = "http://www.w3.org/2000/svg";
  52. NAMESPACES["xhtml"] = "http://www.w3.org/1999/xhtml";
  53. NAMESPACES["xlink"] = "http://www.w3.org/1999/xlink";
  54. NAMESPACES["xml"] = "http://www.w3.org/XML/1998/namespace";
  55. NAMESPACES["xmlns"] = "http://www.w3.org/2000/xmlns/";
  56. return NAMESPACES;
  57. };
  58. com_ibm_rave_core_internal_util_NamespaceUtil.getQName = function(name) {
  59. var idx = name.indexOf(":");
  60. var prefix = name;
  61. if (idx >= 0) {
  62. prefix = name.substring(0, idx);
  63. name = name.substring(idx + 1);
  64. }
  65. var qname = {};
  66. qname["local"] = name;
  67. if (com_ibm_rave_core_internal_util_NamespaceUtil.NAMESPACES.hasOwnProperty(prefix)) {
  68. qname["space"] = com_ibm_rave_core_internal_util_NamespaceUtil.NAMESPACES[prefix];
  69. }
  70. return qname;
  71. };
  72. com_ibm_rave_core_internal_util_NamespaceUtil.NAMESPACES = com_ibm_rave_core_internal_util_NamespaceUtil.initialize_NAMESPACES();
  73. // $source: com/ibm/rave/core/internal/math/Trigonometry
  74. /************************************************************************
  75. ** IBM Confidential
  76. **
  77. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  78. **
  79. ** (C) Copyright IBM Corp. 2015
  80. **
  81. ** The source code for this program is not published or otherwise divested of its trade secrets,
  82. ** irrespective of what has been deposited with the U.S. Copyright Office.
  83. ************************************************************************/
  84. // GENERATED
  85. var com_ibm_rave_core_internal_math_Trigonometry = {
  86. //constructor : function() {}
  87. };
  88. com_ibm_rave_core_internal_math_Trigonometry.sgn = function(x) {
  89. return x > 0 ? 1 : x < 0 ? -1 : 0;
  90. };
  91. /**
  92. * returns the 2D cross product of AB and AC vectors, i.e., the z-component of the 3D cross product in a quadrant I Cartesian coordinate system (+x is right, +y is up). Returns a positive value if ABC is counter-clockwise, negative if clockwise, and zero if the points are collinear.
  93. * @param (Array) a the first point (A)
  94. * @param (Array) b the second point (B)
  95. * @param (Array) c the third point (C)
  96. * @return (double) a positive value if ABC is counter-clockwise, negative if clockwise, and zero if the points are collinear.
  97. */
  98. com_ibm_rave_core_internal_math_Trigonometry.cross2d = function(a, b, c) {
  99. return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);
  100. };
  101. com_ibm_rave_core_internal_math_Trigonometry.acos = function(x) {
  102. return x > 1 ? 0 : x < -1 ? 3.141592653589793 : Math.acos(x);
  103. };
  104. com_ibm_rave_core_internal_math_Trigonometry.asin = function(x) {
  105. return x > 1 ? 1.5707963267948966 : x < -1 ? -1.5707963267948966 : Math.asin(x);
  106. };
  107. com_ibm_rave_core_internal_math_Trigonometry.sinh = function(x) {
  108. return ((x = Math.exp(x)) - 1 / x) / 2;
  109. };
  110. com_ibm_rave_core_internal_math_Trigonometry.cosh = function(x) {
  111. return ((x = Math.exp(x)) + 1 / x) / 2;
  112. };
  113. com_ibm_rave_core_internal_math_Trigonometry.tanh = function(x) {
  114. return ((x = Math.exp(2 * x)) - 1) / (x + 1);
  115. };
  116. com_ibm_rave_core_internal_math_Trigonometry.haversin = function(x) {
  117. return (x = Math.sin(x / 2)) * x;
  118. };
  119. com_ibm_rave_core_internal_math_Trigonometry.sinci = function(x) {
  120. return (x != 0) ? x / Math.sin(x) : 1;
  121. };
  122. com_ibm_rave_core_internal_math_Trigonometry.ε = 1E-6;
  123. com_ibm_rave_core_internal_math_Trigonometry.π = Math.PI;
  124. com_ibm_rave_core_internal_math_Trigonometry.τ = 2 * 3.141592653589793;
  125. com_ibm_rave_core_internal_math_Trigonometry.halfπ = 3.141592653589793 / 2;
  126. com_ibm_rave_core_internal_math_Trigonometry.ε2 = 1.0E-6 * 1.0E-6;
  127. com_ibm_rave_core_internal_math_Trigonometry.radians = 3.141592653589793 / 180;
  128. com_ibm_rave_core_internal_math_Trigonometry.degrees = 180 / 3.141592653589793;
  129. com_ibm_rave_core_internal_math_Trigonometry.τε = 6.283185307179586 - 1.0E-6;
  130. // $source: com/ibm/rave/core/nativeImpl/Object
  131. /************************************************************************
  132. ** IBM Confidential
  133. **
  134. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  135. **
  136. ** (C) Copyright IBM Corp. 2013, 2014, 2015
  137. **
  138. ** The source code for this program is not published or otherwise divested of its trade secrets,
  139. ** irrespective of what has been deposited with the U.S. Copyright Office.
  140. ************************************************************************/
  141. var com_ibm_rave_core_nativeImpl_Object = (function() {
  142. // object for all translated classes.
  143. var Obj = function(){};
  144. /**
  145. * Checks if obj is an instanceof class cls.
  146. *
  147. * @param obj
  148. * the object to check
  149. * @param cls
  150. * the class type
  151. */
  152. /** @expose */
  153. Obj.isInstanceOf = function(obj, cls) {
  154. if (obj) {
  155. if (obj instanceof cls) {
  156. return true;
  157. }
  158. }
  159. return false;
  160. };
  161. var empty = {};
  162. Obj.mixin = function(dest, source) {
  163. for (var name in source) {
  164. var s = source[name];
  165. if (!(name in dest) || (dest[name] !== s && (!(name in empty) || empty[name] !== s))) {
  166. dest[name] = s;
  167. }
  168. }
  169. };
  170. return Obj;
  171. })();
  172. // $source: com/ibm/rave/core/internal/selector/SelectorHelper
  173. /************************************************************************
  174. ** IBM Confidential
  175. **
  176. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  177. **
  178. ** (C) Copyright IBM Corp. 2015
  179. **
  180. ** The source code for this program is not published or otherwise divested of its trade secrets,
  181. ** irrespective of what has been deposited with the U.S. Copyright Office.
  182. ************************************************************************/
  183. // GENERATED
  184. //@import com/ibm/rave/core/Configuration (runtime) // Configuration
  185. //@import com/ibm/rave/core/internal/util/QueryUtil (runtime) // getQueryEngine
  186. var com_ibm_rave_core_internal_selector_SelectorHelper = {
  187. };
  188. com_ibm_rave_core_internal_selector_SelectorHelper.each = function(selection, callback) {
  189. var node;
  190. for (var j = 0, m = selection.length; j < m; ++j) {
  191. var group = selection[j];
  192. for (var i = 0, n = group.length; i < n; ++i) {
  193. if ((node = group[i])) {
  194. callback.call(node, node.rave_getData(), i, j);
  195. }
  196. }
  197. }
  198. return selection;
  199. };
  200. com_ibm_rave_core_internal_selector_SelectorHelper.selector = function(selector) {
  201. return typeof selector === "function" ? selector : function(data, index, groupIndex) {
  202. return selector != null ? com_ibm_rave_core_Configuration.INSTANCE.filter(com_ibm_rave_core_internal_util_QueryUtil.getQueryEngine(this).querySelector(selector, this), selector) : null;
  203. };
  204. };
  205. com_ibm_rave_core_internal_selector_SelectorHelper.selectorAll = function(selector) {
  206. return typeof selector === "function" ? selector : function(data, index, groupIndex) {
  207. return selector != null ? com_ibm_rave_core_Configuration.INSTANCE.filterArray(com_ibm_rave_core_internal_util_QueryUtil.getQueryEngine(this).querySelectorAll(selector, this)) : null;
  208. };
  209. };
  210. // $source: com/ibm/rave/core/internal/util/QueryUtil
  211. /************************************************************************
  212. ** IBM Confidential
  213. **
  214. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  215. **
  216. ** (C) Copyright IBM Corp. 2015
  217. **
  218. ** The source code for this program is not published or otherwise divested of its trade secrets,
  219. ** irrespective of what has been deposited with the U.S. Copyright Office.
  220. ************************************************************************/
  221. // GENERATED
  222. //@import com/ibm/rave/core/Configuration (runtime) // Configuration
  223. var com_ibm_rave_core_internal_util_QueryUtil = {
  224. //constructor : function() {}
  225. };
  226. /**
  227. * Get a query engine for the given root node.
  228. * @param (com.ibm.rave.core.scene.SceneNode) root a scene node, may be <code>null</code>
  229. * @return (com.ibm.rave.core.internal.selector.SelectionQueryEngine) a query engine
  230. */
  231. com_ibm_rave_core_internal_util_QueryUtil.getQueryEngine = function(root) {
  232. var config = com_ibm_rave_core_Configuration.INSTANCE;
  233. if (root) {
  234. var result = config.getQueryEngine(root.rave_getQualifiedName());
  235. if (!result) {
  236. result = config.getQueryEngine(root.rave_getNamespaceURI());
  237. }
  238. return result;
  239. }
  240. return config.getQueryEngine(null);
  241. };
  242. // $source: com/ibm/rave/core/internal/nativeImpl/selector/EmptySceneNode
  243. /************************************************************************
  244. ** IBM Confidential
  245. **
  246. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  247. **
  248. ** (C) Copyright IBM Corp. 2014
  249. **
  250. ** The source code for this program is not published or otherwise divested of its trade secrets,
  251. ** irrespective of what has been deposited with the U.S. Copyright Office.
  252. ************************************************************************/
  253. var com_ibm_rave_core_internal_nativeImpl_selector_EmptySceneNode = function(data) {
  254. this["__data__"] = data;
  255. };
  256. com_ibm_rave_core_internal_nativeImpl_selector_EmptySceneNode.prototype.rave_getData = function() {
  257. return this["__data__"];
  258. };
  259. com_ibm_rave_core_internal_nativeImpl_selector_EmptySceneNode.prototype.rave_setData = function(d) {
  260. this["__data__"] = d;
  261. };
  262. com_ibm_rave_core_internal_nativeImpl_selector_EmptySceneNode.prototype.rave_hasData = function() {
  263. return "__data__" in this;
  264. };
  265. // $source: com/ibm/rave/core/internal/nativeImpl/transitions/InheritedTransition
  266. /************************************************************************
  267. ** IBM Confidential
  268. **
  269. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  270. **
  271. ** (C) Copyright IBM Corp. 2014
  272. **
  273. ** The source code for this program is not published or otherwise divested of its trade secrets,
  274. ** irrespective of what has been deposited with the U.S. Copyright Office.
  275. ************************************************************************/
  276. var com_ibm_rave_core_internal_nativeImpl_transitions_InheritedTransition = {
  277. get : function() {
  278. return this._inherited;
  279. },
  280. set : function(inherited) {
  281. this._inherited = inherited;
  282. }
  283. };
  284. // $source: com/ibm/rave/core/internal/nativeImpl/Vendor
  285. /************************************************************************
  286. ** IBM Confidential
  287. **
  288. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  289. **
  290. ** (C) Copyright IBM Corp. 2014
  291. **
  292. ** The source code for this program is not published or otherwise divested of its trade secrets,
  293. ** irrespective of what has been deposited with the U.S. Copyright Office.
  294. ************************************************************************/
  295. var vendorPrefixes = ["webkit", "ms", "moz", "Moz", "o", "O"];
  296. function vendorSymbol(object, name) {
  297. if (name in object) {
  298. return name;
  299. }
  300. name = name.charAt(0).toUpperCase() + name.substring(1);
  301. for (var i = 0, n = vendorPrefixes.length; i < n; ++i) {
  302. var prefixName = vendorPrefixes[i] + name;
  303. if (prefixName in object)
  304. return prefixName;
  305. }
  306. }
  307. // $source: com/ibm/rave/core/internal/nativeImpl/Lang
  308. /************************************************************************
  309. ** IBM Confidential
  310. **
  311. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  312. **
  313. ** (C) Copyright IBM Corp. 2014, 2015
  314. **
  315. ** The source code for this program is not published or otherwise divested of its trade secrets,
  316. ** irrespective of what has been deposited with the U.S. Copyright Office.
  317. ************************************************************************/
  318. var com_ibm_rave_core_internal_nativeImpl_Lang = {
  319. isNumber : function(object) {
  320. return (typeof object == 'number' || object instanceof Number);
  321. },
  322. isString : function(object) {
  323. return (typeof object == 'string' || object instanceof String);
  324. },
  325. isBoolean : function(object) {
  326. return (typeof object == 'boolean' || object instanceof Boolean);
  327. },
  328. isArray : function(object) {
  329. return (typeof object == 'Array' || object instanceof Array);
  330. },
  331. isObject : function(object) {
  332. return typeof object == 'object';
  333. },
  334. // Return the string as-is. If it's anything else, return an empty string.
  335. toString : function(object) {
  336. return (typeof object == 'string') ? object: "";
  337. }
  338. };
  339. // $source: com/ibm/rave/core/nativeImpl/interpolate/ObjectInterpolation
  340. /************************************************************************
  341. ** IBM Confidential
  342. **
  343. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  344. **
  345. ** (C) Copyright IBM Corp. 2014
  346. **
  347. ** The source code for this program is not published or otherwise divested of its trade secrets,
  348. ** irrespective of what has been deposited with the U.S. Copyright Office.
  349. ************************************************************************/
  350. /**
  351. * Returns an object interpolator between the two objects a and b.
  352. * Internally, an object template is created that has the same properties as b.
  353. * For each property in b, if there exists a corresponding property in a, a generic
  354. * interpolator is created for the two elements using interpolate. If there is no
  355. * such property, the static value from b is used in the template.
  356. * Then, for the given parameter t, the template's embedded interpolators are evaluated
  357. * and the updated object template is then returned.
  358. * For example, if a is the object {x: 0, y: 1} and b is the object {x: 1, y: 10, z: 100},
  359. * the result of the interpolator for t = .5 is the object {x: .5, y: 5.5, z: 100}.
  360. *
  361. * Object interpolation is particularly useful for dataspace interpolation, where data is
  362. * interpolated rather than attribute values. For example, you can interpolate an object which
  363. * describes an arc in a pie chart, and then use d3.svg.arc to compute the new SVG path data.
  364. *
  365. * Note: no defensive copy of the template object is created; modifications of the returned
  366. * object may adversely affect subsequent evaluation of the interpolator. No copy is made because
  367. * interpolators should be fast, as they are part of the inner loop of animation.
  368. * @param (Object) a the start Object
  369. * @param (Object) b the end Object
  370. * @return (com.ibm.rave.core.interpolate.Interpolator) q new interpolator
  371. */
  372. /** @expose */
  373. var com_ibm_rave_core_nativeImpl_interpolate_ObjectInterpolation = function(a, b) {
  374. var i = {}, c = {}, k;
  375. for (k in a) {
  376. if (k in b) {
  377. i[k] = com_ibm_rave_core_interpolate_Interpolators.INSTANCE.getInterpolator(a[k], b[k]);
  378. } else {
  379. c[k] = a[k];
  380. }
  381. }
  382. for (k in b) {
  383. if (!(k in a)) {
  384. c[k] = b[k];
  385. }
  386. }
  387. return function(t) {
  388. for (k in i)
  389. c[k] = i[k](t);
  390. return c;
  391. };
  392. };
  393. /** @expose */
  394. com_ibm_rave_core_nativeImpl_interpolate_ObjectInterpolation.INSTANCE = com_ibm_rave_core_nativeImpl_interpolate_ObjectInterpolation;
  395. // $source: com/ibm/rave/core/nativeImpl/format/Requote
  396. /************************************************************************
  397. ** IBM Confidential
  398. **
  399. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  400. **
  401. ** (C) Copyright IBM Corp. 2014
  402. **
  403. ** The source code for this program is not published or otherwise divested of its trade secrets,
  404. ** irrespective of what has been deposited with the U.S. Copyright Office.
  405. ************************************************************************/
  406. var _requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
  407. var com_ibm_rave_core_nativeImpl_format_Requote = {
  408. requote : function(s) {
  409. return s.replace(_requote_re, "\\$&");
  410. }
  411. };
  412. // $source: com/ibm/rave/core/scene/SceneNodeType
  413. /************************************************************************
  414. ** IBM Confidential
  415. **
  416. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  417. **
  418. ** (C) Copyright IBM Corp. 2015
  419. **
  420. ** The source code for this program is not published or otherwise divested of its trade secrets,
  421. ** irrespective of what has been deposited with the U.S. Copyright Office.
  422. ************************************************************************/
  423. // GENERATED
  424. var com_ibm_rave_core_scene_SceneNodeType = rave_externs["SceneNodeType"] = {
  425. };
  426. /** @expose */
  427. com_ibm_rave_core_scene_SceneNodeType.RECT = 1000;
  428. /** @expose */
  429. com_ibm_rave_core_scene_SceneNodeType.LINE = 1001;
  430. /** @expose */
  431. com_ibm_rave_core_scene_SceneNodeType.CIRCLE = 1002;
  432. /** @expose */
  433. com_ibm_rave_core_scene_SceneNodeType.TEXT = 1003;
  434. /** @expose */
  435. com_ibm_rave_core_scene_SceneNodeType.GROUP = 1004;
  436. /** @expose */
  437. com_ibm_rave_core_scene_SceneNodeType.TITLE = 1005;
  438. /** @expose */
  439. com_ibm_rave_core_scene_SceneNodeType.PATH = 1006;
  440. /** @expose */
  441. com_ibm_rave_core_scene_SceneNodeType.IMAGE = 1007;
  442. /** @expose */
  443. com_ibm_rave_core_scene_SceneNodeType.TEXT_CONTENT = 1008;
  444. /** @expose */
  445. com_ibm_rave_core_scene_SceneNodeType.POLYLINE = 1009;
  446. /** @expose */
  447. com_ibm_rave_core_scene_SceneNodeType.POLYGON = 1010;
  448. /** @expose */
  449. com_ibm_rave_core_scene_SceneNodeType.LINEARGRADIENT = 1011;
  450. /** @expose */
  451. com_ibm_rave_core_scene_SceneNodeType.RADIALGRADIENT = 1012;
  452. /** @expose */
  453. com_ibm_rave_core_scene_SceneNodeType.UNKNOWN = -1;
  454. // $source: com/ibm/rave/core/arrays/Sort
  455. /************************************************************************
  456. ** IBM Confidential
  457. **
  458. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  459. **
  460. ** (C) Copyright IBM Corp. 2015
  461. **
  462. ** The source code for this program is not published or otherwise divested of its trade secrets,
  463. ** irrespective of what has been deposited with the U.S. Copyright Office.
  464. ************************************************************************/
  465. // GENERATED
  466. /**
  467. * Utility for sorting numbers numerically and objects by their string representation.
  468. */
  469. var com_ibm_rave_core_arrays_Sort = rave_externs["Sort"] = {
  470. //constructor : function() {}
  471. };
  472. /**
  473. * Descending sort. Sorts numbers numerically and all other objects by their string representation.
  474. */
  475. /** @expose */
  476. com_ibm_rave_core_arrays_Sort.descending = function(a, b) {
  477. return b<a ? -1 : b>a ? 1 : 0;
  478. };
  479. /**
  480. * Ascending sort. Sorts numbers numerically and all other objects by their string representation.
  481. */
  482. /** @expose */
  483. com_ibm_rave_core_arrays_Sort.ascending = function(a, b) {
  484. return a<b ? -1 : a>b ? 1 : 0;
  485. };
  486. // $source: com/ibm/rave/core/internal/nativeImpl/scene/SceneNodeUtil
  487. /************************************************************************
  488. ** IBM Confidential
  489. **
  490. ** OCO Source Materials
  491. **
  492. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  493. **
  494. ** (C) Copyright IBM Corp. 2014
  495. **
  496. ** The source code for this program is not published or otherwise divested of its trade secrets,
  497. ** irrespective of what has been deposited with the U.S. Copyright Office.
  498. ************************************************************************/
  499. var com_ibm_rave_core_internal_nativeImpl_scene_SceneNodeUtil = {
  500. // static property that caches our only check for getOwnerBoundingClientRect
  501. // a bit hacky. If we need additional browser checks in the future, we
  502. // should move all browser detection outside
  503. // to another utility
  504. _isOldFirefox : null,
  505. getOwnerBoundingClientRect : function(node) {
  506. // Firefox < v33 will not correctly calculate the size of an svg node
  507. // using getBoundingClientRect().
  508. // The bounds returned may only include the size of the items inside the
  509. // node or may be zero. For now
  510. // use getCalculatedStyle().
  511. if (this._isOldFirefox === null) {
  512. var versionIndex = -1;
  513. var userAgent = navigator.userAgent.toString();
  514. // cache our browser result - only care about older versions of
  515. // firefox here. And also phantomjs for testing.
  516. // Useragent for Firefox is
  517. // Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Firefox/31.0
  518. // So, try to determine the version after Firefox/
  519. this._isOldFirefox = userAgent.indexOf("PhantomJS") > -1 || ((versionIndex = userAgent.indexOf("Firefox")) > -1 && userAgent.slice(versionIndex + 8) < 33);
  520. }
  521. if (this._isOldFirefox && rave_window(node)) {
  522. var computedStyle = rave_window(node).getComputedStyle(node);
  523. var width = 0;
  524. var height = 0;
  525. [ 'height', 'paddingTop', 'paddingBottom', 'borderTopWidth', 'borderBottomWidth' ].forEach(function(attribute) {
  526. height += parseFloat(computedStyle[attribute]);
  527. });
  528. [ 'width', 'paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth' ].forEach(function(attribute) {
  529. width += parseFloat(computedStyle[attribute]);
  530. });
  531. return {
  532. "width" : width,
  533. "height" : height
  534. };
  535. }
  536. // Default is to just call getClientBoundingRect
  537. return node.getBoundingClientRect();
  538. }
  539. };
  540. // $source: com/ibm/rave/core/arrays/Merge
  541. /************************************************************************
  542. ** IBM Confidential
  543. **
  544. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  545. **
  546. ** (C) Copyright IBM Corp. 2015
  547. **
  548. ** The source code for this program is not published or otherwise divested of its trade secrets,
  549. ** irrespective of what has been deposited with the U.S. Copyright Office.
  550. ************************************************************************/
  551. // GENERATED
  552. /**
  553. * Creates a flattened array
  554. */
  555. var com_ibm_rave_core_arrays_Merge = rave_externs["Merge"] = {
  556. //constructor : function() {}
  557. };
  558. /**
  559. * Create a merged array.
  560. * @param (Array) arrays an array of arrays of any type to be merged. In other words, the array will be flattened. Ex] [[1,2,3],[4],[5,6] => [1,2,3,4,5,6]
  561. * @return (Array) flattened array
  562. */
  563. /** @expose */
  564. com_ibm_rave_core_arrays_Merge.merge = function(arrays) {
  565. var n = arrays.length, m;
  566. var array;
  567. var newSize = 0;
  568. for (var __i_enFor0 = 0, __exp_enFor0 = arrays, __len_enFor0 = __exp_enFor0.length;
  569. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  570. var child = __exp_enFor0[__i_enFor0];
  571. newSize += child.length;
  572. }
  573. var merged = new Array(newSize);
  574. while (--n >= 0) {
  575. array = arrays[n];
  576. m = array.length;
  577. while (--m >= 0) {
  578. merged[--newSize] = array[m];
  579. }
  580. }
  581. return merged;
  582. };
  583. // $source: com/ibm/rave/core/arrays/MinMax
  584. /************************************************************************
  585. ** IBM Confidential
  586. **
  587. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  588. **
  589. ** (C) Copyright IBM Corp. 2015
  590. **
  591. ** The source code for this program is not published or otherwise divested of its trade secrets,
  592. ** irrespective of what has been deposited with the U.S. Copyright Office.
  593. ************************************************************************/
  594. // GENERATED
  595. var com_ibm_rave_core_arrays_MinMax = rave_externs["MinMax"] = {
  596. //constructor : function() {}
  597. };
  598. /**
  599. * Get the max value in the array.
  600. * @param (Array) numbers an array of numbers.
  601. * @return (Object) the max value in the array
  602. */
  603. com_ibm_rave_core_arrays_MinMax.max$0 = function(numbers) {
  604. var i = -1;
  605. var n = numbers.length;
  606. var a, b;
  607. while (++i < n) {
  608. if ((b = numbers[i]) != null && b<=b) {
  609. a = b;
  610. break;
  611. }
  612. }
  613. while (++i < n) {
  614. if ((b = numbers[i]) != null && b>a) {
  615. a = b;
  616. }
  617. }
  618. return a;
  619. };
  620. /**
  621. * Get the max value in the data array extracted from the value function.
  622. * @param (Array) data an array of data
  623. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction a function that returns a number for each item in the data array
  624. * @return (Object) the max value in the data
  625. */
  626. com_ibm_rave_core_arrays_MinMax.max$1 = function(data, valueFunction) {
  627. var i = -1;
  628. var n = data.length;
  629. var a, b;
  630. while (++i < n) {
  631. if ((b = valueFunction.call(data, data[i], i, -1)) != null && b<=b) {
  632. a = b;
  633. break;
  634. }
  635. }
  636. while (++i < n) {
  637. if ((b = valueFunction.call(data, data[i], i, -1)) != null && b>a) {
  638. a = b;
  639. }
  640. }
  641. return a;
  642. };
  643. /**
  644. * Get the min value in the array.
  645. * @param (Array) numbers an array of numbers
  646. * @return (Object) the min value in the array
  647. */
  648. com_ibm_rave_core_arrays_MinMax.min$0 = function(numbers) {
  649. var i = -1;
  650. var n = numbers.length;
  651. var a, b;
  652. while (++i < n) {
  653. if ((b = numbers[i]) != null && b<=b) {
  654. a = b;
  655. break;
  656. }
  657. }
  658. while (++i < n) {
  659. if ((b = numbers[i]) != null && b<a) {
  660. a = b;
  661. }
  662. }
  663. return a;
  664. };
  665. /**
  666. * Get the min value in the data array extracted from the value function.
  667. * @param (Array) data an array of data
  668. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction a function that returns a number for each item in the data array
  669. * @return (Object) the min value in the data
  670. */
  671. com_ibm_rave_core_arrays_MinMax.min$1 = function(data, valueFunction) {
  672. var i = -1;
  673. var n = data.length;
  674. var a, b;
  675. while (++i < n) {
  676. if ((b = valueFunction.call(data, data[i], i, -1)) != null && b<=b) {
  677. a = b;
  678. break;
  679. }
  680. }
  681. while (++i < n) {
  682. if ((b = valueFunction.call(data, data[i], i, -1)) != null && b<a) {
  683. a = b;
  684. }
  685. }
  686. return a;
  687. };
  688. /** @expose */
  689. com_ibm_rave_core_arrays_MinMax.max = function(a0, a1) {
  690. var args = arguments;
  691. if (args.length == 1) {
  692. return com_ibm_rave_core_arrays_MinMax.max$0(a0);
  693. }
  694. return com_ibm_rave_core_arrays_MinMax.max$1(a0, a1);
  695. };
  696. /** @expose */
  697. com_ibm_rave_core_arrays_MinMax.min = function(a0, a1) {
  698. var args = arguments;
  699. if (args.length == 1) {
  700. return com_ibm_rave_core_arrays_MinMax.min$0(a0);
  701. }
  702. return com_ibm_rave_core_arrays_MinMax.min$1(a0, a1);
  703. };
  704. // $source: com/ibm/rave/core/arrays/Quantile
  705. /************************************************************************
  706. ** IBM Confidential
  707. **
  708. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  709. **
  710. ** (C) Copyright IBM Corp. 2015
  711. **
  712. ** The source code for this program is not published or otherwise divested of its trade secrets,
  713. ** irrespective of what has been deposited with the U.S. Copyright Office.
  714. ************************************************************************/
  715. // GENERATED
  716. /**
  717. * Compute a quantile for a sorted array of numbers. Returns the p-quantile of the given sorted array of numbers, where p is a number in the range [0,1]. For example, the median can be computed using p = 0.5, the first quartile at p = 0.25, and the third quartile at p = 0.75. This particular implementation uses the R-7 algorithm, which is the default for the R programming language and Excel. This method requires that numbers contains numeric elements and is already sorted in ascending order.
  718. */
  719. var com_ibm_rave_core_arrays_Quantile = rave_externs["Quantile"] = {
  720. //constructor : function() {}
  721. };
  722. /**
  723. * Returns the p-quantile of the given sorted array of numbers
  724. * @param (Array) values Sorted array of values (in ascending order)
  725. * @param (double) p the p value, for median use p = 0.5
  726. * @return (Number) the p-quantile value
  727. */
  728. /** @expose */
  729. com_ibm_rave_core_arrays_Quantile.quantile = function(values, p) {
  730. var H = (values.length - 1) * p + 1;
  731. var iH = Math.floor(H);
  732. var v = + (values[iH - 1]);
  733. var e = H - iH;
  734. return (e != 0) ? v + e * (+ (values[iH]) - v) : v;
  735. };
  736. // $source: com/ibm/rave/core/arrays/Deviation
  737. /************************************************************************
  738. ** IBM Confidential
  739. **
  740. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  741. **
  742. ** (C) Copyright IBM Corp. 2015
  743. **
  744. ** The source code for this program is not published or otherwise divested of its trade secrets,
  745. ** irrespective of what has been deposited with the U.S. Copyright Office.
  746. ************************************************************************/
  747. // GENERATED
  748. //@import com/ibm/rave/core/arrays/Variance (runtime) // variance
  749. /**
  750. * Computes the Standard Deviation, as defined by the square root of the bias-corrected variance. If the array has fewer than two values, the result is *undefined* An accessor function may be provided to process the data. This method ignores invalid values such as NaN and undefined.
  751. */
  752. var com_ibm_rave_core_arrays_Deviation = rave_externs["Deviation"] = {
  753. //constructor : function() {}
  754. };
  755. /**
  756. * Calculates the standard deviation of an array of values.
  757. * @param (java.lang.Object[]) array the values used to calculate the deviation
  758. * @return (Number) the deviation value
  759. */
  760. com_ibm_rave_core_arrays_Deviation.deviation$0 = function(array) {
  761. var v = com_ibm_rave_core_arrays_Variance.variance(array);
  762. return (v) ? Math.sqrt(v) : v;
  763. };
  764. /**
  765. * Calculates the standard deviation of an array of values.
  766. * @param (java.lang.Object[]) array the values used to calculate the deviation
  767. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction the accessor function to use to get the value
  768. * @return (Number) the deviation value
  769. */
  770. com_ibm_rave_core_arrays_Deviation.deviation$1 = function(array, valueFunction) {
  771. var v = com_ibm_rave_core_arrays_Variance.variance(array, valueFunction);
  772. return (v) ? Math.sqrt(v) : v;
  773. };
  774. /** @expose */
  775. com_ibm_rave_core_arrays_Deviation.deviation = function(a0, a1) {
  776. var args = arguments;
  777. if (args.length == 1) {
  778. return com_ibm_rave_core_arrays_Deviation.deviation$0(a0);
  779. }
  780. return com_ibm_rave_core_arrays_Deviation.deviation$1(a0, a1);
  781. };
  782. // $source: com/ibm/rave/core/internal/math/NumberUtil
  783. /************************************************************************
  784. ** IBM Confidential
  785. **
  786. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  787. **
  788. ** (C) Copyright IBM Corp. 2015
  789. **
  790. ** The source code for this program is not published or otherwise divested of its trade secrets,
  791. ** irrespective of what has been deposited with the U.S. Copyright Office.
  792. ************************************************************************/
  793. // GENERATED
  794. /**
  795. * A collection of utility function for numbers.
  796. */
  797. var com_ibm_rave_core_internal_math_NumberUtil = {
  798. };
  799. /**
  800. * Similar to {@link this.ObjectConverter#this.toDouble(Object)} , but returns NaN if the object is null.
  801. * @param (Object) o the object to convert
  802. * @return (double) a number value, or NaN if the object is null
  803. */
  804. com_ibm_rave_core_internal_math_NumberUtil.toNumber = function(o) {
  805. return o == null ? NaN : + (o);
  806. };
  807. // $source: com/ibm/rave/core/arrays/Extent
  808. /************************************************************************
  809. ** IBM Confidential
  810. **
  811. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  812. **
  813. ** (C) Copyright IBM Corp. 2015
  814. **
  815. ** The source code for this program is not published or otherwise divested of its trade secrets,
  816. ** irrespective of what has been deposited with the U.S. Copyright Office.
  817. ************************************************************************/
  818. // GENERATED
  819. var com_ibm_rave_core_arrays_Extent = rave_externs["Extent"] = {
  820. //constructor : function() {}
  821. };
  822. /**
  823. * Returns the extent (min,max) of the given array.
  824. * @param (java.lang.Object[]) array the array to use to calculate the extent
  825. * @return (Array) the extent array.
  826. */
  827. com_ibm_rave_core_arrays_Extent.extent$0 = function(array) {
  828. var n = array.length;
  829. if (n <= 0) {
  830. return [undefined, undefined];
  831. }
  832. var a, b, c;
  833. var i = -1;
  834. while (++i < n) {
  835. if ((b = array[i]) != null && b>=b) {
  836. a = c = b;
  837. break;
  838. }
  839. }
  840. while (++i < n) {
  841. if ((b = array[i]) != null) {
  842. if (a>b) {
  843. a = b;
  844. }
  845. if (c<b) {
  846. c = b;
  847. }
  848. }
  849. }
  850. return [a, c];
  851. };
  852. /**
  853. * Returns the extent(min, max) of the values returned from the accessor function.
  854. * @param (java.lang.Object[]) array the data to iterator over.
  855. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction the accessor function to use to get the values.
  856. * @return (Array) the extent
  857. */
  858. com_ibm_rave_core_arrays_Extent.extent$1 = function(array, valueFunction) {
  859. var n = array.length;
  860. var a, b, c;
  861. var i = -1;
  862. if (n <= 0) {
  863. return [undefined, undefined];
  864. }
  865. while (++i < n) {
  866. if ((b = valueFunction.call(array, array[i], i, -1)) != null && b>=b) {
  867. a = c = b;
  868. break;
  869. }
  870. }
  871. while (++i < n) {
  872. b = valueFunction.call(array, array[i], i, -1);
  873. if (b != null) {
  874. if (a>b) {
  875. a = b;
  876. }
  877. if (c<b) {
  878. c = b;
  879. }
  880. }
  881. }
  882. return [a, c];
  883. };
  884. /** @expose */
  885. com_ibm_rave_core_arrays_Extent.extent = function(a0, a1) {
  886. var args = arguments;
  887. if (args.length == 1) {
  888. return com_ibm_rave_core_arrays_Extent.extent$0(a0);
  889. }
  890. return com_ibm_rave_core_arrays_Extent.extent$1(a0, a1);
  891. };
  892. // $source: com/ibm/rave/core/arrays/Sum
  893. /************************************************************************
  894. ** IBM Confidential
  895. **
  896. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  897. **
  898. ** (C) Copyright IBM Corp. 2015
  899. **
  900. ** The source code for this program is not published or otherwise divested of its trade secrets,
  901. ** irrespective of what has been deposited with the U.S. Copyright Office.
  902. ************************************************************************/
  903. // GENERATED
  904. var com_ibm_rave_core_arrays_Sum = rave_externs["Sum"] = {
  905. //constructor : function() {}
  906. };
  907. /**
  908. * Get the sum of the values in the array.
  909. * @param (Array) numbers an array of numbers
  910. * @return (Number) the sum of the values in the array
  911. */
  912. com_ibm_rave_core_arrays_Sum.sum$0 = function(numbers) {
  913. var s = 0;
  914. var n = numbers.length;
  915. var a;
  916. var i = -1;
  917. while (++i < n) {
  918. a = + (numbers[i]);
  919. if (!(isNaN(a))) {
  920. s += a;
  921. }
  922. }
  923. return s;
  924. };
  925. /**
  926. * Get the sum of the values in the data array extracted from the value function.
  927. * @param (Array) data an array of data
  928. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction a function that returns a number for each item in the data array
  929. * @return (Number) the sum of the values in the data
  930. */
  931. com_ibm_rave_core_arrays_Sum.sum$1 = function(data, valueFunction) {
  932. var s = 0;
  933. var n = data.length;
  934. var a;
  935. var i = -1;
  936. while (++i < n) {
  937. if ((a = valueFunction.call(data, data[i], i, -1)) != null && !(isNaN(a))) {
  938. s += a;
  939. }
  940. }
  941. return s;
  942. };
  943. /** @expose */
  944. com_ibm_rave_core_arrays_Sum.sum = function(a0, a1) {
  945. var args = arguments;
  946. if (args.length == 1) {
  947. return com_ibm_rave_core_arrays_Sum.sum$0(a0);
  948. }
  949. return com_ibm_rave_core_arrays_Sum.sum$1(a0, a1);
  950. };
  951. // $source: com/ibm/rave/core/arrays/Zip
  952. /************************************************************************
  953. ** IBM Confidential
  954. **
  955. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  956. **
  957. ** (C) Copyright IBM Corp. 2015
  958. **
  959. ** The source code for this program is not published or otherwise divested of its trade secrets,
  960. ** irrespective of what has been deposited with the U.S. Copyright Office.
  961. ************************************************************************/
  962. // GENERATED
  963. //@import com/ibm/rave/core/arrays/MinMax (runtime) // min
  964. /**
  965. * Returns an array of arrays, where the ith array contains the ith element from each of the argument arrays. The returned array is truncated in length to the shortest array in arrays. If arrays contains only a single array,\ the returned array contains one-element arrays. With no arguments, the returned array is empty. Rave.zip([1, 2], [3, 4]); returns [[1, 3], [2, 4]]
  966. */
  967. var com_ibm_rave_core_arrays_Zip = rave_externs["Zip"] = {
  968. //constructor : function() {}
  969. };
  970. /**
  971. * Returns an array of arrays, where the ith array contains the ith element from each of the argument arrays. The returned array is truncated in length to the shortest array in arrays. If arrays contains only a single array,\ the returned array contains one-element arrays. With no arguments, the returned array is empty. Rave.zip([1, 2], [3, 4]); returns [[1, 3], [2, 4]]
  972. * @param (java.util.List[]) objects the input arrays
  973. * @return (Array) and Array of Arrays zipped version of the arrays of objects provided
  974. */
  975. /** @expose */
  976. com_ibm_rave_core_arrays_Zip.zip = function(objects) {
  977. if (objects !== null || arguments.length > 1){
  978. objects = Array.prototype.slice.call(arguments);
  979. }
  980. {
  981. var n = objects.length;
  982. var zips = [];
  983. if (n == 0) {
  984. return zips;
  985. }
  986. var m = ~~+ (com_ibm_rave_core_arrays_MinMax.min(com_ibm_rave_core_arrays_Zip.toArrayEx(objects), com_ibm_rave_core_arrays_Zip.MIN_FN));
  987. for (var i = 0; i < m; ++i) {
  988. var zip = new Array(n);
  989. zips.push(zip);
  990. for (var j = 0; j < n; ++j) {
  991. zip[j] = objects[j][i];
  992. }
  993. }
  994. return zips;
  995. }
  996. };
  997. com_ibm_rave_core_arrays_Zip.toArrayEx = function(objects) {
  998. var retVal = [];
  999. for (var index = 0; index < objects.length; ++index) {
  1000. retVal.push(objects[index]);
  1001. }
  1002. return retVal;
  1003. };
  1004. com_ibm_rave_core_arrays_Zip.MIN_FN = function(data, index, groupIndex) {
  1005. return ((data).length);
  1006. };
  1007. // $source: com/ibm/rave/core/arrays/Permute
  1008. /************************************************************************
  1009. ** IBM Confidential
  1010. **
  1011. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1012. **
  1013. ** (C) Copyright IBM Corp. 2015
  1014. **
  1015. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1016. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1017. ************************************************************************/
  1018. // GENERATED
  1019. /**
  1020. * Returns a permutation of the specified array using the specified array of indexes. The returned array contains the corresponding element in array for each index in indexes, in order. For example, permute(["a", "b", "c"], [1, 2, 0]) returns ["b", "c", "a"]. It is acceptable for the array of indexes to be a different length from the array of elements, and for indexes to be duplicated or omitted. In the JS version only, This method can be used to extract the values from an object into an array with a stable order. (Array indexes in JavaScript are simply properties which have a special relationship to .length.) Extracting keyed values in order can be useful for generating data arrays in nested selections. For example, we could display some of the Minnesota barley yield data above in table form: <code> var cols = ["site", "variety", "yield"]; thead.selectAll('th').data(cols) .enter().append('th').text(function (d) { return d.toUpperCase(); }); tbody.selectAll('tr').data(yields) .enter().append('tr').selectAll('td').data(function (row) { return d3.permute(row, cols); }) .enter().append('td').text(function (d) { return d; }); </code>
  1021. */
  1022. var com_ibm_rave_core_arrays_Permute = rave_externs["Permute"] = {
  1023. //constructor : function() {}
  1024. };
  1025. /**
  1026. * Returns a permutation of the specified array using the specified array of indexes.
  1027. * @param (Array) inputArray the array to permute
  1028. * @param (Array) indexes the indexes to use to do the permute
  1029. * @return (Array) the permuted array
  1030. */
  1031. /** @expose */
  1032. com_ibm_rave_core_arrays_Permute.permute = function(inputArray, indexes) {
  1033. var i = indexes.length;
  1034. var permutes = new Array(i);
  1035. while (i-- > 0) {
  1036. if (0 <= indexes[i] && indexes[i] < inputArray.length) {
  1037. permutes[i] = inputArray[indexes[i]];
  1038. }
  1039. }
  1040. return permutes;
  1041. };
  1042. // $source: com/ibm/rave/core/arrays/Shuffle
  1043. /************************************************************************
  1044. ** IBM Confidential
  1045. **
  1046. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1047. **
  1048. ** (C) Copyright IBM Corp. 2015
  1049. **
  1050. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1051. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1052. ************************************************************************/
  1053. // GENERATED
  1054. /**
  1055. * Randomizes the order of the specified array using the Fisher–Yates shuffle.
  1056. */
  1057. var com_ibm_rave_core_arrays_Shuffle = rave_externs["Shuffle"] = {
  1058. //constructor : function() {}
  1059. };
  1060. /**
  1061. * Randomizes the order of the specified array using the Fisher–Yates shuffle.
  1062. * @param (Array) inputArray the array to randomize, change is done in-place.
  1063. * @return (Array) the randomized array
  1064. */
  1065. com_ibm_rave_core_arrays_Shuffle.shuffle$0 = function(inputArray) {
  1066. return com_ibm_rave_core_arrays_Shuffle.shuffle$2(inputArray, 0, inputArray.length);
  1067. };
  1068. /**
  1069. * Randomizes the order of the specified array using the Fisher–Yates shuffle, beginning the shuffle at a specific index.
  1070. * @param (Array) inputArray the array to randomize, change is done in-place
  1071. * @param (int) i0 starting index for the shuffle.
  1072. * @return (Array) the randomized array
  1073. */
  1074. com_ibm_rave_core_arrays_Shuffle.shuffle$1 = function(inputArray, i0) {
  1075. return com_ibm_rave_core_arrays_Shuffle.shuffle$2(inputArray, i0, inputArray.length);
  1076. };
  1077. /**
  1078. * Randomizes the order of the specified array using the Fisher–Yates shuffle, beginning and ending the shuffle at specific indices.
  1079. * @param (Array) inputArray the array to randomize, change is done in-place
  1080. * @param (int) i0 starting index for the shuffle.
  1081. * @param (int) i1 end index for the shuffle.
  1082. * @return (Array) the randomized array
  1083. */
  1084. com_ibm_rave_core_arrays_Shuffle.shuffle$2 = function(inputArray, i0, i1) {
  1085. var m = i1 - i0;
  1086. var i;
  1087. var t;
  1088. while (m != 0) {
  1089. i = ~~(Math["random"]() * m--) | 0;
  1090. t = inputArray[m + i0];
  1091. inputArray[m + i0] = inputArray[i + i0];
  1092. inputArray[i + i0] = t;
  1093. }
  1094. return inputArray;
  1095. };
  1096. /** @expose */
  1097. com_ibm_rave_core_arrays_Shuffle.shuffle = function(a0, a1, a2) {
  1098. var args = arguments;
  1099. if (args.length == 1) {
  1100. return com_ibm_rave_core_arrays_Shuffle.shuffle$0(a0);
  1101. }
  1102. if (args.length == 2) {
  1103. return com_ibm_rave_core_arrays_Shuffle.shuffle$1(a0, a1);
  1104. }
  1105. return com_ibm_rave_core_arrays_Shuffle.shuffle$2(a0, a1, a2);
  1106. };
  1107. // $source: com/ibm/rave/core/arrays/Range
  1108. /************************************************************************
  1109. ** IBM Confidential
  1110. **
  1111. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1112. **
  1113. ** (C) Copyright IBM Corp. 2015
  1114. **
  1115. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1116. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1117. ************************************************************************/
  1118. // GENERATED
  1119. /**
  1120. * Generates an array containing an arithmetic progression, similar to the Python built-in range. This method is often used to iterate over a sequence of numeric or integer values, such as the indexes into an array. Unlike the Python version, the arguments are not required to be integers, though the results are more predictable if they are due to floating point precision. If step is omitted, it defaults to 1. If start is omitted, it defaults to 0. The stop value is not included in the result. The full form returns an array of numbers [start, start + step, start + 2 * step, …]. If step is positive, the last element is the largest start + i * step less than stop; if step is negative, the last element is the smallest start + i * step greater than stop. If the returned array would contain an infinite number of values, an error is thrown rather than causing an infinite loop.
  1121. */
  1122. var com_ibm_rave_core_arrays_Range = rave_externs["Range"] = {
  1123. //constructor : function() {}
  1124. };
  1125. /**
  1126. * Generates an array containing an arithmetic progression between 'start' and 'stop incrementing by 'step'. <p> Start defaults to 0.<br> Step defaults to 1.
  1127. * @param (Object) stop the end range value
  1128. * @return (Array) an array containing an arithmetic progression
  1129. */
  1130. com_ibm_rave_core_arrays_Range.create$0 = function(stop) {
  1131. return com_ibm_rave_core_arrays_Range.createRange(0, + (stop), 1);
  1132. };
  1133. /**
  1134. * Generates an array containing an arithmetic progression between 'start' and 'stop incrementing by 'step'. <p> Step defaults to 1.
  1135. * @param (Object) start the starting range value
  1136. * @param (Object) stop the end range value
  1137. * @return (Array) an array containing an arithmetic progression
  1138. */
  1139. com_ibm_rave_core_arrays_Range.create$1 = function(start, stop) {
  1140. return com_ibm_rave_core_arrays_Range.createRange(+ (start), + (stop), 1);
  1141. };
  1142. /**
  1143. * Generates an array containing an arithmetic progression between 'start' and 'stop incrementing by 'step'.
  1144. * @param (Object) start the starting range value
  1145. * @param (Object) stop the end range value
  1146. * @param (Object) step the step
  1147. * @return (Array) an array containing an arithmetic progression
  1148. */
  1149. com_ibm_rave_core_arrays_Range.create$2 = function(start, stop, step) {
  1150. return com_ibm_rave_core_arrays_Range.createRange(+ (start), + (stop), + (step));
  1151. };
  1152. com_ibm_rave_core_arrays_Range.createRange = function(start, stop, step) {
  1153. var range = [];
  1154. if ((stop - start) / step == Infinity) {
  1155. throw new Error("infinite range");
  1156. }
  1157. var k = com_ibm_rave_core_arrays_Range.integerScale(Math.abs(step));
  1158. var i = -1;
  1159. var j;
  1160. start *= k;
  1161. stop *= k;
  1162. step *= k;
  1163. if (step < 0) {
  1164. while ((j = start + step * ++i) > stop) {
  1165. range.push(j / k);
  1166. }
  1167. } else {
  1168. while ((j = start + step * ++i) < stop) {
  1169. range.push(j / k);
  1170. }
  1171. }
  1172. return range;
  1173. };
  1174. com_ibm_rave_core_arrays_Range.integerScale = function(x) {
  1175. var k = 1;
  1176. while ((x * k % 1)) {
  1177. k *= 10;
  1178. }
  1179. return k;
  1180. };
  1181. /** @expose */
  1182. com_ibm_rave_core_arrays_Range.create = function(a0, a1, a2) {
  1183. var args = arguments;
  1184. if (args.length == 1) {
  1185. return com_ibm_rave_core_arrays_Range.create$0(a0);
  1186. }
  1187. if (args.length == 2) {
  1188. return com_ibm_rave_core_arrays_Range.create$1(a0, a1);
  1189. }
  1190. return com_ibm_rave_core_arrays_Range.create$2(a0, a1, a2);
  1191. };
  1192. // $source: com/ibm/rave/core/nativeImpl/event/EventTracker
  1193. /************************************************************************
  1194. ** IBM Confidential
  1195. **
  1196. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1197. **
  1198. ** (C) Copyright IBM Corp. 2014
  1199. **
  1200. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1201. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1202. ************************************************************************/
  1203. var com_ibm_rave_core_nativeImpl_event_EventTracker = {
  1204. eventSource : function() {
  1205. var e = rave.event, s;
  1206. while (s = e.sourceEvent) {
  1207. e = s;
  1208. }
  1209. return e;
  1210. }
  1211. };
  1212. // $source: com/ibm/rave/core/format/Round
  1213. /************************************************************************
  1214. ** IBM Confidential
  1215. **
  1216. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1217. **
  1218. ** (C) Copyright IBM Corp. 2015
  1219. **
  1220. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1221. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1222. ************************************************************************/
  1223. // GENERATED
  1224. var com_ibm_rave_core_format_Round = rave_externs["Round"] = {
  1225. };
  1226. /**
  1227. * Returns the value x rounded to n digits after the decimal point. If n is omitted, it defaults to zero. The result is a number. Values are rounded to the closest multiple of 10 to the power minus n; if two multiples are equally close, the value is rounded up in accordance with the built-in round function.
  1228. * @param (double) x the value to round
  1229. * @param (double) n if specified, rounds x to n digits
  1230. * @return (double) the value x rounded to n digits
  1231. */
  1232. /** @expose */
  1233. com_ibm_rave_core_format_Round.round = function(x, n) {
  1234. return (n) ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x);
  1235. };
  1236. // $source: com/ibm/rave/core/internal/format/Precision
  1237. /************************************************************************
  1238. ** IBM Confidential
  1239. **
  1240. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1241. **
  1242. ** (C) Copyright IBM Corp. 2015
  1243. **
  1244. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1245. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1246. ************************************************************************/
  1247. // GENERATED
  1248. var com_ibm_rave_core_internal_format_Precision = {
  1249. };
  1250. /**
  1251. * Calculates the position of the decimal point in the value x.<br> eg. With p = 0: 123.456 has a precision value of -3 while 0.000123 has a precision value of 3 <p> The p value will offset the result by its value.<br> eg. With p = 2: 123.456 has a precision value of -1 while 0.000123 has a precision value of 5
  1252. * @param (double) x the value to calculate precision for
  1253. * @param (int) p a value to offset the precision value by
  1254. * @return (double) the calculated precision
  1255. */
  1256. com_ibm_rave_core_internal_format_Precision.precision = function(x, p) {
  1257. return p - ((x) ? Math.ceil(Math.log(x) / Math["LN10"]) : 1);
  1258. };
  1259. // $source: com/ibm/rave/core/nativeImpl/arrays/AssociativeArrays
  1260. /************************************************************************
  1261. ** IBM Confidential
  1262. **
  1263. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1264. **
  1265. ** (C) Copyright IBM Corp. 2014
  1266. **
  1267. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1268. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1269. ************************************************************************/
  1270. /**
  1271. * Another common data type in JavaScript is the associative array, or more simply
  1272. * the object, which has a set of named properties. In Java this is referred to as a map,
  1273. * and in Python, a dictionary. JavaScript provides a standard mechanism for
  1274. * iterating over the keys (or property names) in an associative array: the for…in
  1275. * loop. However, note that the iteration order is undefined. D3 provides several
  1276. * operators for converting associative arrays to standard indexed arrays.
  1277. */
  1278. var com_ibm_rave_core_nativeImpl_arrays_AssociativeArrays = {
  1279. /**
  1280. * Returns an array containing the property names of the specified object (an
  1281. * associative array). The order of the returned array is undefined.
  1282. */
  1283. keys : function(map){
  1284. var keys=[];
  1285. for (var key in map) keys.push(key);
  1286. return keys;
  1287. },
  1288. /**
  1289. * Returns an array containing the property values of the specified object (an
  1290. * associative array). The order of the returned array is undefined.
  1291. */
  1292. values : function(map){
  1293. var values = [];
  1294. for(var key in map) values.push(map[key]);
  1295. return values;
  1296. },
  1297. /**
  1298. * Returns an array containing the property keys and values of the specified object
  1299. * (an associative array). Each entry is an object with a key and value attribute, such
  1300. * as {key: "foo", value: 42}. The order of the returned array is undefined
  1301. */
  1302. entries : function(map){
  1303. var entries=[];
  1304. for(var key in map) entries.push({key:key,value:map[key]});
  1305. return entries;
  1306. }
  1307. };
  1308. // $source: com/ibm/rave/core/arrays/Entry
  1309. /************************************************************************
  1310. ** IBM Confidential
  1311. **
  1312. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1313. **
  1314. ** (C) Copyright IBM Corp. 2015
  1315. **
  1316. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1317. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1318. ************************************************************************/
  1319. // GENERATED
  1320. /**
  1321. * Represents an entry in map
  1322. */
  1323. var com_ibm_rave_core_arrays_Entry = rave_externs["Entry"] = function(){};
  1324. // $source: com/ibm/rave/core/arrays/Pairs
  1325. /************************************************************************
  1326. ** IBM Confidential
  1327. **
  1328. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1329. **
  1330. ** (C) Copyright IBM Corp. 2015
  1331. **
  1332. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1333. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1334. ************************************************************************/
  1335. // GENERATED
  1336. /**
  1337. * Static class to call the pairs method
  1338. * @author Bryan
  1339. */
  1340. var com_ibm_rave_core_arrays_Pairs = rave_externs["Pairs"] = {
  1341. //constructor : function() {}
  1342. };
  1343. /**
  1344. * For each adjacent pair of elements in the specified array, returns a new array of tuples of element i and element i - 1. For example: Rave.pairs([1, 2, 3, 4]); // returns [[1, 2], [2, 3], [3, 4]] If the specified array has fewer than two elements, returns the empty array.
  1345. * @param (java.lang.Object[]) array
  1346. * @return (java.lang.Object[]) Object[]
  1347. */
  1348. /** @expose */
  1349. com_ibm_rave_core_arrays_Pairs.pairs = function(array) {
  1350. var i = 0, n = array.length - 1;
  1351. var pairs = [];
  1352. if (array.length > 0) {
  1353. var p0, p1 = array[0];
  1354. while (i < n) {
  1355. pairs[i] = [p0 = p1, p1 = array[++i]];
  1356. }
  1357. }
  1358. return pairs;
  1359. };
  1360. // $source: com/ibm/rave/core/nativeImpl/textMetrics/GraphicContextFactory
  1361. /************************************************************************
  1362. ** IBM Confidential
  1363. **
  1364. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1365. **
  1366. ** (C) Copyright IBM Corp. 2015
  1367. **
  1368. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1369. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1370. ************************************************************************/
  1371. /**
  1372. * utility to create emulation of HTML canvas element 2d context functionality for text measurement
  1373. */
  1374. /**
  1375. * @param (int) width canvas width
  1376. * @param (int) height canvas height
  1377. * @return canvas element
  1378. */
  1379. /** @expose */
  1380. var com_ibm_rave_core_nativeImpl_textMetrics_GraphicContextFactory = {
  1381. create : function(width, height) {
  1382. var canvas;
  1383. if (typeof document !== "undefined") {
  1384. canvas = document.createElement("canvas");
  1385. canvas.width = width;
  1386. canvas.height = height;
  1387. } else {
  1388. // Attempt to use node-canvas.
  1389. canvas = new Canvas(width, height);
  1390. }
  1391. return canvas;
  1392. }
  1393. };
  1394. // $source: com/ibm/rave/core/internal/geom/PolygonUtil
  1395. /************************************************************************
  1396. ** IBM Confidential
  1397. **
  1398. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1399. **
  1400. ** (C) Copyright IBM Corp. 2015
  1401. **
  1402. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1403. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1404. ************************************************************************/
  1405. // GENERATED
  1406. var com_ibm_rave_core_internal_geom_PolygonUtil = {
  1407. };
  1408. /**
  1409. * Intersect two infinite lines cd and ab.
  1410. * @param (Array) c starting point of the first line
  1411. * @param (Array) d end point of the second line
  1412. * @param (Array) a starting point of the first line
  1413. * @param (Array) b end point of the second line
  1414. * @return (Array) The intersection point of the two lines
  1415. */
  1416. com_ibm_rave_core_internal_geom_PolygonUtil.polygonIntersect = function(c, d, a, b) {
  1417. var x1 = c[0], x3 = a[0], x21 = d[0] - x1, x43 = b[0] - x3, y1 = c[1], y3 = a[1], y21 = d[1] - y1, y43 = b[1] - y3, ua = (x43 * (y1 - y3) - y43 * (x1 - x3)) / (y43 * x21 - x43 * y21);
  1418. return [x1 + ua * x21, y1 + ua * y21];
  1419. };
  1420. // $source: com/ibm/rave/core/internal/util/Identity
  1421. /************************************************************************
  1422. ** IBM Confidential
  1423. **
  1424. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1425. **
  1426. ** (C) Copyright IBM Corp. 2015
  1427. **
  1428. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1429. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1430. ************************************************************************/
  1431. // GENERATED
  1432. /**
  1433. * Function class used typically for where Identity projection is needed. It return the same data passed to it.
  1434. */
  1435. var com_ibm_rave_core_internal_util_Identity = {
  1436. };
  1437. com_ibm_rave_core_internal_util_Identity.create = function() {
  1438. return function(data, index, groupIndex) {
  1439. return data;
  1440. };
  1441. };
  1442. // $source: com/ibm/rave/core/internal/scales/Ranger
  1443. /************************************************************************
  1444. ** IBM Confidential
  1445. **
  1446. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1447. **
  1448. ** (C) Copyright IBM Corp. 2015
  1449. **
  1450. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1451. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1452. ************************************************************************/
  1453. // GENERATED
  1454. var com_ibm_rave_core_internal_scales_Ranger = function(t, a, padding, outerPadding) {
  1455. this.t = t;
  1456. this.a = a;
  1457. this.padding = padding;
  1458. this.outerPadding = outerPadding;
  1459. };
  1460. // $source: com/ibm/rave/core/time/TimeFormatter
  1461. /************************************************************************
  1462. ** IBM Confidential
  1463. **
  1464. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1465. **
  1466. ** (C) Copyright IBM Corp. 2015
  1467. **
  1468. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1469. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1470. ************************************************************************/
  1471. // GENERATED
  1472. // $source: com/ibm/rave/core/internal/globalization/BidiStringDirection
  1473. /************************************************************************
  1474. ** IBM Confidential
  1475. **
  1476. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1477. **
  1478. ** (C) Copyright IBM Corp. 2015
  1479. **
  1480. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1481. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1482. ************************************************************************/
  1483. // GENERATED
  1484. /**
  1485. * Enum describing valid bidi string directions.
  1486. * @author jim
  1487. */
  1488. var com_ibm_rave_core_internal_globalization_BidiStringDirection = {
  1489. //constructor : function() {}
  1490. };
  1491. com_ibm_rave_core_internal_globalization_BidiStringDirection.parse = function(textDirection) {
  1492. var dir = textDirection;
  1493. if (dir != null) {
  1494. dir = textDirection.toLowerCase();
  1495. }
  1496. if ("ltr" == dir) {
  1497. return 0;
  1498. } else if ("rtl" == dir) {
  1499. return 1;
  1500. } else if ("auto" == dir) {
  1501. return 3;
  1502. }
  1503. return 4;
  1504. };
  1505. com_ibm_rave_core_internal_globalization_BidiStringDirection.toString = function(dir) {
  1506. switch (dir) {
  1507. case 0:
  1508. return "ltr";
  1509. case 1:
  1510. return "rtl";
  1511. case 3:
  1512. return "auto";
  1513. default:
  1514. return "ltr";
  1515. }
  1516. };
  1517. com_ibm_rave_core_internal_globalization_BidiStringDirection.LTR = 0;
  1518. com_ibm_rave_core_internal_globalization_BidiStringDirection.RTL = 1;
  1519. com_ibm_rave_core_internal_globalization_BidiStringDirection.AUTO = 3;
  1520. com_ibm_rave_core_internal_globalization_BidiStringDirection.NONE = 4;
  1521. com_ibm_rave_core_internal_globalization_BidiStringDirection.LTR_STRING = "ltr";
  1522. com_ibm_rave_core_internal_globalization_BidiStringDirection.RTL_STRING = "rtl";
  1523. com_ibm_rave_core_internal_globalization_BidiStringDirection.AUTO_STRING = "auto";
  1524. com_ibm_rave_core_internal_globalization_BidiStringDirection.UNKNOWN = -1;
  1525. // $source: com/ibm/rave/core/internal/nativeImpl/globalization/BidiProcess
  1526. /************************************************************************
  1527. ** IBM Confidential
  1528. **
  1529. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1530. **
  1531. ** (C) Copyright IBM Corp. 2014, 2015
  1532. **
  1533. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1534. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1535. ************************************************************************/
  1536. //@import com/ibm/rave/core/internal/globalization/BidiStringDirection (runtime)
  1537. /**
  1538. * Platform specific bidi string processing. Used to determine the directionality of strings based on their first "strong" character direction.
  1539. * Uses the dbidi (dojo bidi) library.
  1540. *
  1541. * @author jim
  1542. */
  1543. var com_ibm_rave_core_internal_nativeImpl_globalization_BidiProcess = {};
  1544. /**
  1545. * Determine the direction of our string using the first "strong" character type found.
  1546. * Parts of this code are from the dojo bidi project. https://github.com/ibm-js/dbidi/blob/master/LICENSE
  1547. *
  1548. * @param (String) string String to check
  1549. * @return (Number) BidiStringDirection enum value.
  1550. */
  1551. /** @expose */
  1552. com_ibm_rave_core_internal_nativeImpl_globalization_BidiProcess.determineDirection = function(string) {
  1553. var UBAT_L = 0; /* left to right */
  1554. var UBAT_R = 1; /* right to left */
  1555. var UBAT_EN = 2; /* European digit */
  1556. var UBAT_AN = 3; /* Arabic-Indic digit */
  1557. var UBAT_ON = 4; /* neutral */
  1558. var UBAT_B = 5; /* block separator */
  1559. var UBAT_S = 6; /* segment separator */
  1560. var UBAT_AL = 7; /* Arabic Letter */
  1561. var UBAT_WS = 8; /* white space */
  1562. var UBAT_CS = 9; /* common digit separator */
  1563. var UBAT_ES = 10; /* European digit separator */
  1564. var UBAT_ET = 11; /* European digit terminator */
  1565. var UBAT_NSM = 12; /* Non Spacing Mark */
  1566. var UBAT_LRE = 13; /* LRE */
  1567. var UBAT_RLE = 14; /* RLE */
  1568. var UBAT_PDF = 15; /* PDF */
  1569. var UBAT_LRO = 16; /* LRO */
  1570. var UBAT_RLO = 17; /* RLO */
  1571. var UBAT_BN = 18; /* Boundary Neutral */
  1572. var TYPES_NAMES = [ "UBAT_L", "UBAT_R", "UBAT_EN", "UBAT_AN", "UBAT_ON", "UBAT_B", "UBAT_S", "UBAT_AL", "UBAT_WS",
  1573. "UBAT_CS", "UBAT_ES", "UBAT_ET", "UBAT_NSM", "UBAT_LRE", "UBAT_RLE", "UBAT_PDF", "UBAT_LRO",
  1574. "UBAT_RLO", "UBAT_BN" ];
  1575. var TBBASE = 100;
  1576. var TB00 = TBBASE + 0;
  1577. var TB05 = TBBASE + 1;
  1578. var TB06 = TBBASE + 2;
  1579. var TB07 = TBBASE + 3;
  1580. var TB20 = TBBASE + 4;
  1581. var TBFB = TBBASE + 5;
  1582. var TBFE = TBBASE + 6;
  1583. var TBFF = TBBASE + 7;
  1584. var L = UBAT_L;
  1585. var R = UBAT_R;
  1586. var EN = UBAT_EN;
  1587. var AN = UBAT_AN;
  1588. var ON = UBAT_ON;
  1589. var B = UBAT_B;
  1590. var S = UBAT_S;
  1591. var AL = UBAT_AL;
  1592. var WS = UBAT_WS;
  1593. var CS = UBAT_CS;
  1594. var ES = UBAT_ES;
  1595. var ET = UBAT_ET;
  1596. var NSM = UBAT_NSM;
  1597. var LRE = UBAT_LRE;
  1598. var RLE = UBAT_RLE;
  1599. var PDF = UBAT_PDF;
  1600. var LRO = UBAT_LRO;
  1601. var RLO = UBAT_RLO;
  1602. var BN = UBAT_BN;
  1603. var MasterTable = [
  1604. /*******************************************************************************************************/
  1605. /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
  1606. /*******************************************************************************************************/
  1607. /*0-*/ TB00, L, L, L, L, TB05, TB06, TB07, R, L, L, L, L, L, L, L,
  1608. /*1-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1609. /*2-*/ TB20, ON, ON, ON, L, ON, L, ON, L, ON, ON, ON, L, L, ON, ON,
  1610. /*3-*/ L, L, L, L, L, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1611. /*4-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, L, L, ON,
  1612. /*5-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1613. /*6-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1614. /*7-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1615. /*8-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1616. /*9-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, L,
  1617. /*A-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, ON, ON, ON,
  1618. /*B-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1619. /*C-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1620. /*D-*/ ON, ON, ON, ON, ON, ON, ON, L, L, ON, ON, L, L, ON, ON, L,
  1621. /*E-*/ L, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1622. /*F-*/ ON, ON, ON, ON, ON, ON, ON, ON, L, L, L, TBFB, AL, AL, TBFE, TBFF
  1623. ];
  1624. var UnicodeTable = [
  1625. [ /* Table 00: Unicode 00xx */
  1626. /****************************************************************************************/
  1627. /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
  1628. /****************************************************************************************/
  1629. /*0-*/ BN, BN, BN, BN, BN, BN, BN, BN, BN, S, B, S, WS, B, BN, BN,
  1630. /*1-*/ BN, BN, BN, BN, BN, BN, BN, BN, BN, BN, BN, BN, B, B, B, S,
  1631. /*2-*/ WS, ON, ON, ET, ET, ET, ON, ON, ON, ON, ON, ES, CS, ES, CS, CS,
  1632. /*3-*/ EN, EN, EN, EN, EN, EN, EN, EN, EN, EN, CS, ON, ON, ON, ON, ON,
  1633. /*4-*/ ON, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1634. /*5-*/ L, L, L, L, L, L, L, L, L, L, L, ON, ON, ON, ON, ON,
  1635. /*6-*/ ON, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1636. /*7-*/ L, L, L, L, L, L, L, L, L, L, L, ON, ON, ON, ON, BN,
  1637. /*8-*/ BN, BN, BN, BN, BN, B, BN, BN, BN, BN, BN, BN, BN, BN, BN, BN,
  1638. /*9-*/ BN, BN, BN, BN, BN, BN, BN, BN, BN, BN, BN, BN, BN, BN, BN, BN,
  1639. /*A-*/ CS, ON, ET, ET, ET, ET, ON, ON, ON, ON, L, ON, ON, BN, ON, ON,
  1640. /*B-*/ ET, ET, EN, EN, ON, L, ON, ON, ON, EN, L, ON, ON, ON, ON, ON,
  1641. /*C-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1642. /*D-*/ L, L, L, L, L, L, L, ON, L, L, L, L, L, L, L, L,
  1643. /*E-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1644. /*F-*/ L, L, L, L, L, L, L, ON, L, L, L, L, L, L, L, L
  1645. ],
  1646. [ /* Table 01: Unicode 05xx */
  1647. /****************************************************************************************/
  1648. /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
  1649. /****************************************************************************************/
  1650. /*0-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1651. /*1-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1652. /*2-*/ L, L, L, L, L, L, L, L, ON, ON, ON, ON, ON, ON, ON, ON,
  1653. /*3-*/ ON, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1654. /*4-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1655. /*5-*/ L, L, L, L, L, L, L, ON, ON, L, L, L, L, L, L, L,
  1656. /*6-*/ ON, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1657. /*7-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1658. /*8-*/ L, L, L, L, L, L, L, L, ON, L, ON, ON, ON, ON, ON, ON,
  1659. /*9-*/ ON, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM,
  1660. /*A-*/ NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM,
  1661. /*B-*/ NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, R, NSM,
  1662. /*C-*/ R, NSM, NSM, R, NSM, NSM, R, NSM, ON, ON, ON, ON, ON, ON, ON, ON,
  1663. /*D-*/ R, R, R, R, R, R, R, R, R, R, R, R, R, R, R, R,
  1664. /*E-*/ R, R, R, R, R, R, R, R, R, R, R, ON, ON, ON, ON, ON,
  1665. /*F-*/ R, R, R, R, R, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON
  1666. ],
  1667. [ /* Table 02: Unicode 06xx */
  1668. /****************************************************************************************/
  1669. /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
  1670. /****************************************************************************************/
  1671. /*0-*/ AN, AN, AN, AN, ON, ON, ON, ON, AL, ET, ET, AL, CS, AL, ON, ON,
  1672. /*1-*/ NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, AL, ON, ON, AL, AL,
  1673. /*2-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1674. /*3-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1675. /*4-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, NSM, NSM, NSM, NSM, NSM,
  1676. /*5-*/ NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM,
  1677. /*6-*/ AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, ET, AN, AN, AL, AL, AL,
  1678. /*7-*/ NSM, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1679. /*8-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1680. /*9-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1681. /*A-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1682. /*B-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1683. /*C-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1684. /*D-*/ AL, AL, AL, AL, AL, AL, NSM, NSM, NSM, NSM, NSM, NSM, NSM, AN, ON, NSM,
  1685. /*E-*/ NSM, NSM, NSM, NSM, NSM, AL, AL, NSM, NSM, ON, NSM, NSM, NSM, NSM, AL, AL,
  1686. /*F-*/ EN, EN, EN, EN, EN, EN, EN, EN, EN, EN, AL, AL, AL, AL, AL, AL
  1687. ],
  1688. [ /* Table 03: Unicode 07xx */
  1689. /****************************************************************************************/
  1690. /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
  1691. /****************************************************************************************/
  1692. /*0-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, ON, AL,
  1693. /*1-*/ AL, NSM, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1694. /*2-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1695. /*3-*/ NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM,
  1696. /*4-*/ NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, ON, ON, AL, AL, AL,
  1697. /*5-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1698. /*6-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1699. /*7-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1700. /*8-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1701. /*9-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1702. /*A-*/ AL, AL, AL, AL, AL, AL, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM,
  1703. /*B-*/ NSM, AL, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1704. /*C-*/ R, R, R, R, R, R, R, R, R, R, R, R, R, R, R, R,
  1705. /*D-*/ R, R, R, R, R, R, R, R, R, R, R, R, R, R, R, R,
  1706. /*E-*/ R, R, R, R, R, R, R, R, R, R, R, NSM, NSM, NSM, NSM, NSM,
  1707. /*F-*/ NSM, NSM, NSM, NSM, R, R, ON, ON, ON, ON, R, ON, ON, ON, ON, ON
  1708. ],
  1709. [ /* Table 04: Unicode 20xx */
  1710. /****************************************************************************************/
  1711. /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
  1712. /****************************************************************************************/
  1713. /*0-*/ WS, WS, WS, WS, WS, WS, WS, WS, WS, WS, WS, BN, BN, BN, L, R,
  1714. /*1-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1715. /*2-*/ ON, ON, ON, ON, ON, ON, ON, ON, WS, B, LRE, RLE, PDF, LRO, RLO, CS,
  1716. /*3-*/ ET, ET, ET, ET, ET, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1717. /*4-*/ ON, ON, ON, ON, CS, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1718. /*5-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, WS,
  1719. /*6-*/ BN, BN, BN, BN, BN, ON, ON, ON, ON, ON, BN, BN, BN, BN, BN, BN,
  1720. /*7-*/ EN, L, ON, ON, EN, EN, EN, EN, EN, EN, ES, ES, ON, ON, ON, L,
  1721. /*8-*/ EN, EN, EN, EN, EN, EN, EN, EN, EN, EN, ES, ES, ON, ON, ON, ON,
  1722. /*9-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, ON, ON, ON,
  1723. /*A-*/ ET, ET, ET, ET, ET, ET, ET, ET, ET, ET, ET, ET, ET, ET, ET, ET,
  1724. /*B-*/ ET, ET, ET, ET, ET, ET, ET, ET, ET, ET, ON, ON, ON, ON, ON, ON,
  1725. /*C-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1726. /*D-*/ NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM,
  1727. /*E-*/ NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM,
  1728. /*F-*/ NSM, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON
  1729. ],
  1730. [ /* Table 05: Unicode FBxx */
  1731. /****************************************************************************************/
  1732. /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
  1733. /****************************************************************************************/
  1734. /*0-*/ L, L, L, L, L, L, L, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1735. /*1-*/ ON, ON, ON, L, L, L, L, L, ON, ON, ON, ON, ON, R, NSM, R,
  1736. /*2-*/ R, R, R, R, R, R, R, R, R, ES, R, R, R, R, R, R,
  1737. /*3-*/ R, R, R, R, R, R, R, ON, R, R, R, R, R, ON, R, ON,
  1738. /*4-*/ R, R, ON, R, R, ON, R, R, R, R, R, R, R, R, R, R,
  1739. /*5-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1740. /*6-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1741. /*7-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1742. /*8-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1743. /*9-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1744. /*A-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1745. /*B-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1746. /*C-*/ AL, AL, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1747. /*D-*/ ON, ON, ON, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1748. /*E-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1749. /*F-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL
  1750. ],
  1751. [ /* Table 06: Unicode FExx */
  1752. /****************************************************************************************/
  1753. /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
  1754. /****************************************************************************************/
  1755. /*0-*/ NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM,
  1756. /*1-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1757. /*2-*/ NSM, NSM, NSM, NSM, NSM, NSM, NSM, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1758. /*3-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1759. /*4-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1760. /*5-*/ CS, ON, CS, ON, ON, CS, ON, ON, ON, ON, ON, ON, ON, ON, ON, ET,
  1761. /*6-*/ ON, ON, ES, ES, ON, ON, ON, ON, ON, ET, ET, ON, ON, ON, ON, ON,
  1762. /*7-*/ AL, AL, AL, AL, AL, ON, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1763. /*8-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1764. /*9-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1765. /*A-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1766. /*B-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1767. /*C-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1768. /*D-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1769. /*E-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1770. /*F-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, ON, ON, BN
  1771. ],
  1772. [ /* Table 07: Unicode FFxx */
  1773. /****************************************************************************************/
  1774. /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
  1775. /****************************************************************************************/
  1776. /*0-*/ ON, ON, ON, ET, ET, ET, ON, ON, ON, ON, ON, ES, CS, ES, CS, CS,
  1777. /*1-*/ EN, EN, EN, EN, EN, EN, EN, EN, EN, EN, CS, ON, ON, ON, ON, ON,
  1778. /*2-*/ ON, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1779. /*3-*/ L, L, L, L, L, L, L, L, L, L, L, ON, ON, ON, ON, ON,
  1780. /*4-*/ ON, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1781. /*5-*/ L, L, L, L, L, L, L, L, L, L, L, ON, ON, ON, ON, ON,
  1782. /*6-*/ ON, ON, ON, ON, ON, ON, L, L, L, L, L, L, L, L, L, L,
  1783. /*7-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1784. /*8-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1785. /*9-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1786. /*A-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1787. /*B-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, ON,
  1788. /*C-*/ ON, ON, L, L, L, L, L, L, ON, ON, L, L, L, L, L, L,
  1789. /*D-*/ ON, ON, L, L, L, L, L, L, ON, ON, L, L, L, ON, ON, ON,
  1790. /*E-*/ ET, ET, ON, ON, ON, ET, ET, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1791. /*F-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON
  1792. ]
  1793. ];
  1794. var directionality = checkContextual(string);
  1795. // if first STRONG character found
  1796. if (directionality == com_ibm_rave_core_internal_globalization_BidiStringDirection.LTR
  1797. || directionality == com_ibm_rave_core_internal_globalization_BidiStringDirection.RTL) {
  1798. return directionality;
  1799. }
  1800. return com_ibm_rave_core_internal_globalization_BidiStringDirection.UNKNOWN;
  1801. function checkContextual(text) {
  1802. // summary:
  1803. // Determine the base direction of a bidi text according
  1804. // to its first strong directional character.
  1805. // text:
  1806. // The text to check.
  1807. // returns: /*String*/
  1808. // "ltr" or "rtl" according to the first strong character.
  1809. // If there is no strong character, returns the value of the
  1810. // document dir property.
  1811. // tags:
  1812. // public
  1813. var dir = firstStrongDir(text);
  1814. if (!dir) {
  1815. dir = document.dir.toLowerCase();
  1816. if (dir !== "ltr" && dir !== "rtl") {
  1817. dir = "ltr";
  1818. }
  1819. }
  1820. var bidiDirection = com_ibm_rave_core_internal_globalization_BidiStringDirection.UNKNOWN;
  1821. switch (dir) {
  1822. case "ltr":
  1823. bidiDirection = com_ibm_rave_core_internal_globalization_BidiStringDirection.LTR;
  1824. break;
  1825. case "rtl":
  1826. bidiDirection = com_ibm_rave_core_internal_globalization_BidiStringDirection.RTL;
  1827. break;
  1828. default:
  1829. break;
  1830. }
  1831. return bidiDirection;
  1832. function firstStrongDir(/*String*/text) {
  1833. // summary:
  1834. // Return the first strong character direction
  1835. // text:
  1836. // The source string.
  1837. // description:
  1838. // Iterates over the text string, letter by letter starting from its beginning,
  1839. // searching for first "strong" character.
  1840. // Returns if strong character was found with the direction defined by this
  1841. // character, if no strong character was found returns an empty string.
  1842. // returns: String
  1843. // "ltr" - if the first strong character is Latin.
  1844. // "rtl" - if the first strong character is RTL directed character.
  1845. // "" - if the strong character wasn't found.
  1846. // tags:
  1847. // private
  1848. var type = null, uc = null, hi = null;
  1849. for (var i = 0; i < text.length; i++) {
  1850. uc = text.charAt(i).charCodeAt(0);
  1851. hi = MasterTable[uc >> 8];
  1852. type = hi < TBBASE ? hi : UnicodeTable[hi - TBBASE][uc & 0xFF];
  1853. if (type === UBAT_R || type === UBAT_AL) {
  1854. return "rtl";
  1855. }
  1856. if (type === UBAT_L) {
  1857. return "ltr";
  1858. }
  1859. if (type === UBAT_B) {
  1860. break;
  1861. }
  1862. }
  1863. return null;
  1864. }
  1865. };
  1866. };
  1867. // $source: com/ibm/rave/core/internal/nativeImpl/event/Event
  1868. /************************************************************************
  1869. ** IBM Confidential
  1870. **
  1871. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1872. **
  1873. ** (C) Copyright IBM Corp. 2014
  1874. **
  1875. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1876. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1877. ************************************************************************/
  1878. var com_ibm_rave_core_internal_nativeImpl_event_Event = rave_window(rave_document) ? typeof rave_window(rave_document).Event === "function"
  1879. ? function(type, canBubble, canCancel) {
  1880. return new Event(type, {
  1881. 'bubbles': canBubble || false,
  1882. 'cancelable': canCancel || false
  1883. });
  1884. }
  1885. //IE doesn't support Event constructor
  1886. : function(type, canBubble, canCancel) {
  1887. var e;
  1888. if (rave_document) {
  1889. e = rave_document.createEvent('Event');
  1890. e.initEvent(type, canBubble || false, canCancel || false);
  1891. }
  1892. return e;
  1893. }
  1894. // rave_window(rave_document) is undefined
  1895. : undefined;
  1896. // $source: com/ibm/rave/core/internal/svg/symbol/SymbolCreatorsConstants
  1897. /************************************************************************
  1898. ** IBM Confidential
  1899. **
  1900. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1901. **
  1902. ** (C) Copyright IBM Corp. 2015
  1903. **
  1904. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1905. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1906. ************************************************************************/
  1907. // GENERATED
  1908. /**
  1909. * constants needed by symbol creators
  1910. */
  1911. var com_ibm_rave_core_internal_svg_symbol_SymbolCreatorsConstants = {
  1912. };
  1913. com_ibm_rave_core_internal_svg_symbol_SymbolCreatorsConstants.r2_svg_symbolTan30 = Math.tan(30 * (3.141592653589793 / 180));
  1914. com_ibm_rave_core_internal_svg_symbol_SymbolCreatorsConstants.r2_svg_symbolSqrt3 = Math.sqrt(3);
  1915. // $source: com/ibm/rave/core/geo/InvertiblePointProjector
  1916. /************************************************************************
  1917. ** IBM Confidential
  1918. **
  1919. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1920. **
  1921. ** (C) Copyright IBM Corp. 2015
  1922. **
  1923. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1924. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1925. ************************************************************************/
  1926. // GENERATED
  1927. // $source: com/ibm/rave/core/internal/geo/ClipLineStreamListenerFactory
  1928. /************************************************************************
  1929. ** IBM Confidential
  1930. **
  1931. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1932. **
  1933. ** (C) Copyright IBM Corp. 2015
  1934. **
  1935. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1936. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1937. ************************************************************************/
  1938. // GENERATED
  1939. // $source: com/ibm/rave/core/nativeImpl/xhr/Xhr
  1940. /************************************************************************
  1941. ** IBM Confidential
  1942. **
  1943. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1944. **
  1945. ** (C) Copyright IBM Corp. 2014
  1946. **
  1947. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1948. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1949. ************************************************************************/
  1950. //@import com/ibm/rave/core/Rave (runtime)
  1951. var com_ibm_rave_core_nativeImpl_xhr_Xhr = (function() {
  1952. function rave_xhr(url, mimeType, response, callback) {
  1953. var rave = com_ibm_rave_core_Rave;
  1954. var xhr = {},
  1955. dispatch = rave.dispatch("beforesend", "progress", "load", "error"),
  1956. headers = {},
  1957. request = new XMLHttpRequest,
  1958. responseType = null;
  1959. // If IE does not support CORS, use XDomainRequest.
  1960. if (this.XDomainRequest && !("withCredentials" in request) && /^(http(s)?:)?\/\//.test(url))
  1961. request = new XDomainRequest;
  1962. "onload" in request ? request.onload = request.onerror = respond:
  1963. request.onreadystatechange = function() {
  1964. request.readyState > 3 && respond();
  1965. };
  1966. function respond() {
  1967. var status = request.status, result;
  1968. if (!status && hasResponse(request) || status >= 200 && status < 300 || status === 304) {
  1969. try {
  1970. result = response.call(xhr, request);
  1971. }
  1972. catch (e) {
  1973. dispatch["error"].call(xhr, e);
  1974. return;
  1975. }
  1976. dispatch["load"].call(xhr, result);
  1977. }
  1978. else {
  1979. dispatch["error"].call(xhr, request);
  1980. }
  1981. }
  1982. request.onprogress = function(event) {
  1983. var o = rave.event;
  1984. rave.event = event;
  1985. try {
  1986. dispatch["progress"].call(xhr, request);
  1987. }
  1988. finally {
  1989. rave.event = o;
  1990. }
  1991. };
  1992. /**@expose*/
  1993. xhr.header = function(name, value) {
  1994. name = (name + "").toLowerCase();
  1995. if (arguments.length < 2)
  1996. return headers[name];
  1997. if (value == null)
  1998. delete headers[name];
  1999. else
  2000. headers[name] = value + "";
  2001. return xhr;
  2002. };
  2003. // If mimeType is non-null and no Accept header is set, a default is used.
  2004. /**@expose*/
  2005. xhr.mimeType = function(value) {
  2006. if (!arguments.length)
  2007. return mimeType;
  2008. mimeType = value == null ? null : value + "";
  2009. return xhr;
  2010. };
  2011. // Specifies what type the response value should take;
  2012. // for instance, arraybuffer, blob, document, or text.
  2013. /**@expose*/
  2014. xhr.responseType = function(value) {
  2015. if (!arguments.length)
  2016. return responseType;
  2017. responseType = value;
  2018. return xhr;
  2019. };
  2020. // Specify how to convert the response content to a specific type;
  2021. // changes the callback value on "load" events.
  2022. /**@expose*/
  2023. xhr.response = function(value) {
  2024. response = value;
  2025. return xhr;
  2026. };
  2027. /**@expose*/
  2028. xhr.get = function() {
  2029. return xhr.send.apply(xhr, ["get"].concat([].slice.call(arguments)));
  2030. };
  2031. /**@expose*/
  2032. xhr.post = function() {
  2033. return xhr.send.apply(xhr, ["post"].concat([].slice.call(arguments)));
  2034. };
  2035. // If callback is non-null, it will be used for error and load events.
  2036. /**@expose*/
  2037. xhr.send = function(method, data, callback) {
  2038. if (arguments.length === 2 && typeof data === "function")
  2039. callback = data, data = null;
  2040. request.open(method, url, true);
  2041. if (mimeType != null && !("accept" in headers))
  2042. headers["accept"] = mimeType + ",*/*";
  2043. if (request.setRequestHeader) for (var name in headers)
  2044. request.setRequestHeader(name, headers[name]);
  2045. if (mimeType != null && request.overrideMimeType)
  2046. request.overrideMimeType(mimeType);
  2047. if (responseType != null)
  2048. request.responseType = responseType;
  2049. if (callback != null)
  2050. xhr.on("error", callback).on("load", function(request) {
  2051. callback(null, request);
  2052. });
  2053. dispatch["beforesend"].call(xhr, request);
  2054. request.send(data == null ? null : data);
  2055. return xhr;
  2056. };
  2057. /**@expose*/
  2058. xhr.abort = function() {
  2059. request.abort();
  2060. return xhr;
  2061. };
  2062. // rebind
  2063. /**@expose*/
  2064. xhr.on = function() {
  2065. dispatch.on.apply(dispatch, arguments);
  2066. return this;
  2067. };
  2068. return callback == null ? xhr : xhr.get(fixCallback(callback));
  2069. };
  2070. function fixCallback(callback) {
  2071. return callback.length === 1
  2072. ? function(error, request) {
  2073. callback(error == null ? request : null);
  2074. }
  2075. : callback;
  2076. }
  2077. function hasResponse(request) {
  2078. var type = request.responseType;
  2079. return type && type !== "text"
  2080. ? request.response // null on error
  2081. : request.responseText; // "" on error
  2082. }
  2083. var Xhr = function(response) {
  2084. return function(url, mimeType, callback) {
  2085. if (arguments.length === 2 && typeof mimeType === "function") callback = mimeType, mimeType = null;
  2086. return rave_xhr(url, mimeType, response, callback);
  2087. };
  2088. };
  2089. Xhr.create = rave_xhr;
  2090. return Xhr;
  2091. })();
  2092. // $source: com/ibm/rave/core/nativeImpl/math/Transform
  2093. /************************************************************************
  2094. ** IBM Confidential
  2095. **
  2096. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2097. **
  2098. ** (C) Copyright IBM Corp. 2014
  2099. **
  2100. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2101. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2102. ************************************************************************/
  2103. //@import com/ibm/rave/core/internal/util/NamespaceUtil
  2104. //@import com/ibm/rave/core/internal/math/Trigonometry
  2105. com_ibm_rave_core_nativeImpl_math_Transform= (function() {
  2106. var g = null;
  2107. if (rave_document) {
  2108. g = rave_document.createElementNS(com_ibm_rave_core_internal_util_NamespaceUtil.NAMESPACES.svg,"g");
  2109. }
  2110. function myfunc(string) {
  2111. if(string != null && g != null){
  2112. g.setAttribute("transform", string);
  2113. var t = g.transform.baseVal.consolidate();
  2114. }
  2115. return new rave_transform(t ? t.matrix : rave_transformIdentity);
  2116. };
  2117. /**
  2118. * // Compute x-scale and normalize the first row.
  2119. * Compute shear and make second row orthogonal to first.
  2120. * Compute y-scale and normalize the second row.
  2121. * Finally, compute the rotation.
  2122. */
  2123. function rave_transform(m){
  2124. var r0 = [m.a, m.b],
  2125. r1 = [m.c, m.d],
  2126. kx = rave_transformNormalize(r0),
  2127. kz = rave_transformDot(r0, r1),
  2128. ky = rave_transformNormalize(rave_transformCombine(r1, r0, -kz)) || 0;
  2129. if (r0[0] * r1[1] < r1[0] * r0[1]) {
  2130. r0[0] *= -1;
  2131. r0[1] *= -1;
  2132. kx *= -1;
  2133. kz *= -1;
  2134. }
  2135. /**
  2136. * Returns the rotation angle θ of this transform, in degrees.
  2137. */
  2138. /** @expose */
  2139. this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * com_ibm_rave_core_internal_math_Trigonometry.degrees;
  2140. /**
  2141. * Returns the [dx, dy] translation of this transform, as a two-element array in local coordinates (typically pixels).
  2142. */
  2143. /** @expose */
  2144. this.translate = [m.e, m.f];
  2145. /**
  2146. * Returns the [kx, ky] scale of this transform, as a two-element array.
  2147. */
  2148. /** @expose */
  2149. this.scale = [kx, ky];
  2150. /**
  2151. * Returns the x-skew φ of this transform, in degrees.
  2152. */
  2153. /** @expose */
  2154. this.skew = ky ? Math.atan2(kz, ky) * com_ibm_rave_core_internal_math_Trigonometry.degrees : 0;
  2155. };
  2156. /**
  2157. * Returns a string representation of this transform, in the form "translate(dx,dy)rotate(θ)skewX(φ)scale(kx,ky)".
  2158. */
  2159. /**@expose*/
  2160. rave_transform.prototype.toString = function() {
  2161. return "translate(" + this.translate
  2162. + ")rotate(" + this.rotate
  2163. + ")skewX(" + this.skew
  2164. + ")scale(" + this.scale
  2165. + ")";
  2166. };
  2167. function rave_transformDot(a, b) {
  2168. return a[0] * b[0] + a[1] * b[1];
  2169. };
  2170. function rave_transformNormalize(a) {
  2171. var k = Math.sqrt(rave_transformDot(a, a));
  2172. if (k) {
  2173. a[0] /= k;
  2174. a[1] /= k;
  2175. }
  2176. return k;
  2177. };
  2178. function rave_transformCombine(a, b, k) {
  2179. a[0] += k * b[0];
  2180. a[1] += k * b[1];
  2181. return a;
  2182. };
  2183. var rave_transformIdentity = {a: 1, b: 0, c: 0, d: 1, e: 0, f: 0};
  2184. return {create: myfunc};
  2185. })();
  2186. // $source: com/ibm/rave/core/nativeImpl/Declare
  2187. /************************************************************************
  2188. ** IBM Confidential
  2189. **
  2190. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2191. **
  2192. ** (C) Copyright IBM Corp. 2013, 2014, 2015
  2193. **
  2194. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2195. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2196. ************************************************************************/
  2197. // @import com/ibm/rave/core/nativeImpl/Object
  2198. var com_ibm_rave_core_nativeImpl_Declare = (function() {
  2199. // must implement methods:
  2200. // - extend(Object prop, Array classes)
  2201. // - impelment(Array classes)
  2202. // - create(Object cls, arguments args);
  2203. // - invokeSuper(Object obj, arguments args);
  2204. // - prototype.isInstanceOf(Object cls);
  2205. // use a faster more tailored version of declare
  2206. // utility constructor
  2207. var xConstructor = function(){};
  2208. var mixin = com_ibm_rave_core_nativeImpl_Object.mixin;
  2209. var subclass = {}.__proto__ ?
  2210. function(object, prototype) {
  2211. object.__proto__ = prototype;
  2212. } : mixin;
  2213. var bind;
  2214. if (Function.prototype.bind) {
  2215. bind = function(ctx, fnc) {
  2216. return fnc.bind(ctx);
  2217. };
  2218. } else {
  2219. bind = function(ctx, fnc) {
  2220. return function() {
  2221. return fnc.apply(ctx, arguments);
  2222. };
  2223. }
  2224. }
  2225. function createConstructor(prop, prototype, extend, fc, ctorReturnsValue, isArray) {
  2226. var cls;
  2227. // create the class constructor depending on whether delegation to
  2228. // a super and/or this constructor is necessary
  2229. var newConstructor = prop && prop.hasOwnProperty("constructor") ? prop.constructor : null;
  2230. var superConstructor = extend && extend !== com_ibm_rave_core_nativeImpl_Object ? prototype.constructor : null;
  2231. if (superConstructor && superConstructor._$defaultConstructor) {
  2232. // ignore calling an empty super constructor
  2233. superConstructor = null;
  2234. }
  2235. if (newConstructor) {
  2236. if (superConstructor) {
  2237. if (ctorReturnsValue) {
  2238. cls = function() {
  2239. var x = superConstructor.apply(this, arguments);
  2240. newConstructor.apply(x, arguments);
  2241. return x;
  2242. };
  2243. } else if (fc) {
  2244. cls = function() {
  2245. var x = fc.call();
  2246. mixin(x, this);
  2247. superConstructor.apply(x, arguments);
  2248. newConstructor.apply(x, arguments);
  2249. return x;
  2250. };
  2251. } else {
  2252. cls = function() {
  2253. superConstructor.apply(this, arguments);
  2254. newConstructor.apply(this, arguments);
  2255. };
  2256. }
  2257. } else {
  2258. if (fc) {
  2259. cls = function() {
  2260. var x = fc.call();
  2261. mixin(x, this);
  2262. newConstructor.apply(x, arguments);
  2263. return x;
  2264. };
  2265. } else if (isArray) {
  2266. cls = function() {
  2267. var x = [];
  2268. subclass(x, this);
  2269. newConstructor.apply(x, arguments);
  2270. return x;
  2271. };
  2272. } else {
  2273. cls = newConstructor;
  2274. }
  2275. }
  2276. } else {
  2277. if (superConstructor) {
  2278. if (ctorReturnsValue) {
  2279. cls = function() {
  2280. return superConstructor.apply(this, arguments);
  2281. };
  2282. } else if (fc) {
  2283. cls = function() {
  2284. var x = fc.call();
  2285. mixin(x, this);
  2286. superConstructor.apply(x, arguments);
  2287. return x;
  2288. };
  2289. } else {
  2290. cls = function() {
  2291. superConstructor.apply(this, arguments);
  2292. };
  2293. }
  2294. } else {
  2295. if (fc) {
  2296. cls = function() {
  2297. var x = fc.call();
  2298. mixin(x, this);
  2299. return x;
  2300. };
  2301. } else if (isArray) {
  2302. cls = function() {
  2303. var x = [];
  2304. subclass(x, this);
  2305. return x;
  2306. };
  2307. } else {
  2308. cls = function(){};
  2309. cls._$defaultConstructor = true;
  2310. }
  2311. }
  2312. }
  2313. return cls;
  2314. }
  2315. function initProperties(prop, prototype, realConstructor, ctorReturnsValue) {
  2316. var bindings, bindingsArray,
  2317. cls = realConstructor;
  2318. // copy properties
  2319. mixin(prototype, prop);
  2320. for (var i in prop) {
  2321. if (typeof prop[i] === "function") {
  2322. // bind functions
  2323. if (prop[i]._$bind) {
  2324. if (!bindings) {
  2325. bindings = {};
  2326. bindingsArray = [];
  2327. }
  2328. bindingsArray.push(i);
  2329. bindings[i] = prop[i];
  2330. }
  2331. // save function names
  2332. prototype[i].nom = i;
  2333. }
  2334. }
  2335. if (bindings) {
  2336. function initBindings(ctx) {
  2337. for (var i = 0, len = bindingsArray.length; i < len; i++) {
  2338. ctx[bindingsArray[i]] = bind(ctx, bindings[bindingsArray[i]]);
  2339. }
  2340. }
  2341. // add another indirection to the constructor in order to bind functions
  2342. if (cls._$defaultConstructor) {
  2343. cls = function() {
  2344. initBindings(this);
  2345. };
  2346. } else {
  2347. if (ctorReturnsValue) {
  2348. cls = function() {
  2349. var x = realConstructor.apply(this, arguments);
  2350. initBindings(x);
  2351. return x;
  2352. };
  2353. } else {
  2354. cls = function() {
  2355. realConstructor.apply(this, arguments);
  2356. initBindings(this);
  2357. }
  2358. }
  2359. }
  2360. }
  2361. return cls;
  2362. }
  2363. // assign the declare function directly to the return value
  2364. var ret = function(classes, prop) {
  2365. var cls, extend, interfaces, f, fc, extendsFunctionClass, prototype;
  2366. // crack parameters
  2367. if (arguments.length == 1) {
  2368. // must be properties
  2369. prop = classes;
  2370. classes = undefined;
  2371. }
  2372. if (classes) {
  2373. // force classes to be an array
  2374. if (typeof classes !== "array" && !(classes instanceof Array)) {
  2375. classes = [classes];
  2376. }
  2377. if (classes.length == 0) {
  2378. extend = com_ibm_rave_core_nativeImpl_Object;
  2379. } else if (!classes[0]._$isInterface) {
  2380. extend = classes[0];
  2381. if (classes.length > 1) {
  2382. classes.shift();
  2383. interfaces = classes;
  2384. }
  2385. extendsFunctionClass = extend._$type == 2;
  2386. } else {
  2387. extend = com_ibm_rave_core_nativeImpl_Object;
  2388. interfaces = classes;
  2389. }
  2390. } else {
  2391. extend = com_ibm_rave_core_nativeImpl_Object;
  2392. }
  2393. if (!extendsFunctionClass) {
  2394. fc = prop && prop._$functionClassMethod;
  2395. }
  2396. var type = extend == Array ? 1 : extendsFunctionClass || fc ? 2 : +extend._$type;
  2397. if (type == 1) {
  2398. prototype = [];
  2399. if (extend != Array) {
  2400. // we need to mixin the super prototype into this prototype
  2401. mixin(prototype, extend.prototype);
  2402. } else {
  2403. extend = null;
  2404. }
  2405. } else {
  2406. // construct the prototype from the class to extend
  2407. xConstructor.prototype = extend.prototype;
  2408. prototype = new xConstructor;
  2409. xConstructor.prototype = null;
  2410. }
  2411. cls = createConstructor(prop, prototype, extend, fc, !fc && !!type, type == 1);
  2412. if (prop) {
  2413. cls = initProperties(prop, prototype, cls, !!type);
  2414. }
  2415. // assign the class to be the constructor
  2416. prototype.constructor = cls;
  2417. // assign meta data
  2418. //cls._$functionClass = !!fc;
  2419. cls._$type = type;
  2420. cls["_$superClass"] = extend;
  2421. cls._$interfaces = interfaces && interfaces.length > 0 ? interfaces : null;
  2422. // assign the prototype
  2423. cls.prototype = prototype;
  2424. return cls;
  2425. };
  2426. /*
  2427. * Like declare, but declares an interface. Interfaces are used for instanceof checking
  2428. * and can have static properties but there's no point in including interfaces in the prototype
  2429. * chain of a class as it will add time to constructor chaining.
  2430. */
  2431. /** @expose */
  2432. ret.implement = function(classes) {
  2433. // crack parameters
  2434. if (arguments.length == 1) {
  2435. // must be properties
  2436. classes = undefined;
  2437. }
  2438. // force classes to be an array
  2439. if (classes && typeof classes !== "array" && !(classes instanceof Array)) {
  2440. classes = [classes];
  2441. }
  2442. // assumes all classes are interfaces
  2443. var cls = function(){};
  2444. cls._$isInterface = true;
  2445. cls._$interfaces = classes && classes.length > 0 ? classes : null;
  2446. return cls;
  2447. };
  2448. /*
  2449. * Create a new instance of the given class passing args to the constructor.
  2450. */
  2451. /** @expose */
  2452. ret.create = function(cls, args) {
  2453. xConstructor.prototype = cls.prototype;
  2454. var t = new xConstructor;
  2455. xConstructor.prototype = null;// clean up
  2456. cls.apply(t, args);
  2457. return t;
  2458. };
  2459. /*
  2460. * Invoke the super method of an object.
  2461. */
  2462. /** @expose */
  2463. ret.invokeSuper = function() {
  2464. var _invokeSuper = function(context, cls, fnName, args) {
  2465. var result, superClass = cls["_$superClass"];
  2466. if (superClass) {
  2467. var fn = superClass.prototype[fnName];
  2468. result = fn ? fn.apply(context, args) : _invokeSuper(context, superClass, fnName, args);
  2469. }
  2470. return result;
  2471. };
  2472. // invoke the super method of name args.nom on the given obj
  2473. return function(obj, args) {
  2474. return _invokeSuper(obj, obj.constructor, args.callee.nom, args);
  2475. };
  2476. }();
  2477. /*
  2478. * Flags this function to be bound during object construction.
  2479. */
  2480. /** @expose */
  2481. ret.bind = function(fnc) {
  2482. fnc._$bind = 1;
  2483. return fnc;
  2484. };
  2485. // this instanceof check iterates over the implemented interfaces
  2486. /** @expose */
  2487. com_ibm_rave_core_nativeImpl_Object.prototype.isInstanceOf = function() {
  2488. var checkInterfaces = function(obj, cls) {
  2489. var interfaces = obj._$interfaces;
  2490. if (interfaces) {
  2491. for (var i = 0, len = interfaces.length; i < len; i++) {
  2492. if (interfaces[i] === cls || checkInterfaces(interfaces[i], cls)) {
  2493. return true;
  2494. }
  2495. }
  2496. }
  2497. if (obj["_$superClass"]) {
  2498. return checkInterfaces(obj["_$superClass"], cls);
  2499. }
  2500. return false;
  2501. };
  2502. return function(cls) {
  2503. if (this instanceof cls) {
  2504. return true;
  2505. }
  2506. return checkInterfaces(this.constructor, cls);
  2507. };
  2508. }();
  2509. return ret;
  2510. })();
  2511. // $source: com/ibm/rave/core/selector/Selection
  2512. /************************************************************************
  2513. ** IBM Confidential
  2514. **
  2515. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2516. **
  2517. ** (C) Copyright IBM Corp. 2015
  2518. **
  2519. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2520. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2521. ************************************************************************/
  2522. // GENERATED
  2523. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2524. /**
  2525. * The common interface for selections and transitions. Selections have attributes and functions applied immediately, while transitions have attributes and functions applied over time. This interface is generic with a self-reference to support use of the {@link this.Selection#this.call(com_ibm_rave_core_selector_RunFunction, Object...)} method.
  2526. * @author chrislittle
  2527. * @param < (Object) T > The concrete selection implementation type, e.g. Selector.
  2528. */
  2529. var com_ibm_rave_core_selector_Selection = rave_externs["Selection"] = com_ibm_rave_core_nativeImpl_Declare(Array, {
  2530. attr$0 : function(value) {
  2531. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(value), __len_enFor0 = __exp_enFor0.length;
  2532. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2533. var key = __exp_enFor0[__i_enFor0];
  2534. var v = value[key];
  2535. if (typeof v === "function") {
  2536. this.attr$2(key, v);
  2537. } else {
  2538. this.attr$1(key, value[key]);
  2539. }
  2540. }
  2541. return this;
  2542. },
  2543. /**
  2544. * Invokes the specified function once with this selection as the context.
  2545. * @param (com.ibm.rave.core.selector.RunFunction) callback the function to callback, must be annotated as {@link (com.ibm.rave.codegenerator.annotations.FunctionClass) FunctionClass}
  2546. * @param (java.lang.Object[]) args optional arguments to pass to the call function
  2547. * @return (Object) this selection
  2548. */
  2549. /** @expose */
  2550. call : function(callback, args) {},
  2551. /**
  2552. * Execute the callback for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in the selection.
  2553. * @param (com.ibm.rave.core.selector.CallbackFunction) callback the callback to run
  2554. * @return (Object) this selection
  2555. */
  2556. /** @expose */
  2557. each : function(callback) {},
  2558. /**
  2559. * Is the current selection empty.
  2560. * @return (boolean) <code>true</code> if selection is empty, <code>false> otherwise
  2561. */
  2562. /** @expose */
  2563. empty : function() {
  2564. return !this.node();
  2565. },
  2566. /**
  2567. * Remove the selected matches from this selection. Returns the resulting selection.
  2568. * @return (Object) this selection
  2569. */
  2570. /** @expose */
  2571. remove : function() {},
  2572. /**
  2573. * Return the current number of matches in this selection.
  2574. * @return (int) Current number of matches.
  2575. */
  2576. /** @expose */
  2577. size : function() {
  2578. var count = 0;
  2579. for (var j = 0, m = this.length; j < m; ++j) {
  2580. var group = this[j];
  2581. for (var i = 0, n = group.length; i < n; ++i) {
  2582. if (group[i]) {
  2583. count++;
  2584. }
  2585. }
  2586. }
  2587. return count;
  2588. },
  2589. style$0 : function(value) {
  2590. return this.style$1(value, null);
  2591. },
  2592. style$1 : function(value, priority) {
  2593. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(value), __len_enFor0 = __exp_enFor0.length;
  2594. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2595. var key = __exp_enFor0[__i_enFor0];
  2596. this.style$4(key, value[key], priority);
  2597. var v = value[key];
  2598. if (typeof v === "function") {
  2599. this.style$5(key, v, priority);
  2600. } else {
  2601. this.style$4(key, v, priority);
  2602. }
  2603. }
  2604. return this;
  2605. },
  2606. /**
  2607. * Sets the text content for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this selection.
  2608. * @param (Object) value The text content.
  2609. * @return (Object) this selection
  2610. */
  2611. /** @expose */
  2612. text : function(value) {},
  2613. /**
  2614. * Return the first scene node contained in the current selection. May return null if there are matched selections.
  2615. */
  2616. /** @expose */
  2617. node : function() {
  2618. for (var j = 0, m = this.length; j < m; ++j) {
  2619. var group = this[j];
  2620. for (var i = 0, n = group.length; i < n; ++i) {
  2621. var node = group[i];
  2622. if (node) {
  2623. return node;
  2624. }
  2625. }
  2626. }
  2627. return null;
  2628. },
  2629. /** @expose */
  2630. attr : function(a0, a1) {
  2631. var args = arguments;
  2632. if (args.length == 1) {
  2633. return this.attr$0(a0);
  2634. }
  2635. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  2636. return this.attr$2(a0, a1);
  2637. }
  2638. return this.attr$1(a0, a1);
  2639. },
  2640. /** @expose */
  2641. style : function(a0, a1, a2) {
  2642. var args = arguments;
  2643. if (args.length == 1) {
  2644. return this.style$0(a0);
  2645. }
  2646. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  2647. return this.style$3(a0, a1);
  2648. }
  2649. if (args.length == 2 && (a0 == null || typeof a0 === "string") && (a1 == null || Object.prototype.toString.call(a1) !== "[object Array]")) {
  2650. return this.style$2(a0, a1);
  2651. }
  2652. if (args.length == 2) {
  2653. return this.style$1(a0, a1);
  2654. }
  2655. if (args.length == 3 && (a0 == null || typeof a0 === "string") && typeof a1 === "function" && (a2 == null || typeof a2 === "string")) {
  2656. return this.style$5(a0, a1, a2);
  2657. }
  2658. return this.style$4(a0, a1, a2);
  2659. },
  2660. /** @expose */
  2661. select : function(a0) {
  2662. var args = arguments;
  2663. if (args.length == 1 && typeof a0 === "function") {
  2664. return this.select$1(a0);
  2665. }
  2666. return this.select$0(a0);
  2667. },
  2668. /** @expose */
  2669. selectAll : function(a0) {
  2670. var args = arguments;
  2671. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  2672. return this.selectAll$0(a0);
  2673. }
  2674. return this.selectAll$1(a0);
  2675. },
  2676. /** @expose */
  2677. filter : function(a0) {
  2678. var args = arguments;
  2679. if (args.length == 1 && typeof a0 === "function") {
  2680. return this.filter$0(a0);
  2681. }
  2682. return this.filter$1(a0);
  2683. },
  2684. /** @expose */
  2685. transition : function(a0) {
  2686. var args = arguments;
  2687. if (args.length == 0) {
  2688. return this.transition$0();
  2689. }
  2690. return this.transition$1(a0);
  2691. }
  2692. /**
  2693. * Sets the value for the requested attribute for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this selection.
  2694. * @param (String) attribute String attribute name.
  2695. * @param (Object) value Value for attribute.
  2696. * @return (Object) this selection
  2697. */
  2698. //attr$1 : function(attribute, value) {},
  2699. /**
  2700. * Sets the passed attribute for each match in this selection based on value returned from the passed function . Passes in optional data associated with this selector.
  2701. * @param (String) attribute String attribute name to set.
  2702. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction "anonymous" function class to be executed for each attribute. In javascript, this will be translated into an actual anonymous function.
  2703. * @return (Object) this selection
  2704. */
  2705. //attr$2 : function(attribute, valueFunction) {},
  2706. /**
  2707. * Sets the value for the requested style for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this selection.
  2708. * @param (String) styleName String style name.
  2709. * @param (Object) value Value for attribute.
  2710. * @return (Object) this selection
  2711. */
  2712. //style$2 : function(styleName, value) {},
  2713. /**
  2714. * Sets the value for the requested style for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this selection.
  2715. * @param (String) styleName String style name.
  2716. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction "anonymous" function class to be executed for each attribute. In javascript, this will be translated into an actual anonymous function.
  2717. * @return (Object) this selection
  2718. */
  2719. //style$3 : function(styleName, valueFunction) {},
  2720. /**
  2721. * Sets the value for the requested style for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this selection.
  2722. * @param (String) styleName String style name.
  2723. * @param (Object) value Value for attribute.
  2724. * @param (String) priority the style priority (ie, "important")
  2725. * @return (Object) this selection
  2726. */
  2727. //style$4 : function(styleName, value, priority) {},
  2728. /**
  2729. * Sets the value for the requested style for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this selection.
  2730. * @param (String) styleName String style name.
  2731. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction "anonymous" function class to be executed for each attribute. In javascript, this will be translated into an actual anonymous function.
  2732. * @param (String) priority the style priority (ie, "important")
  2733. * @return (Object) this selection
  2734. */
  2735. //style$5 : function(styleName, valueFunction, priority) {},
  2736. /**
  2737. * Return a new selection based on 'query', only returning the first match. Also creates a new single data entry for the selection and sets the parent node for the next set of matches.
  2738. * @param (Object) query CSS3 Selection query syntax.
  2739. * @return (Object) a new selection.
  2740. */
  2741. //select$0 : function(query) {},
  2742. /**
  2743. * Return a new selection based on the nodes returned by the value function. Also creates a new single data entry for the selection and sets the parent node for the next set of matches.
  2744. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction
  2745. * @return (Object) a new selection.
  2746. */
  2747. //select$1 : function(valueFunction) {},
  2748. /**
  2749. * Return a single new selection based on 'query', returning all matches. Sets the parent node to the {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} returned by the previous call to select(). If there was no previous selection, then set parentNode to the root.
  2750. * @param (String) query CSS3 Selection query syntax.
  2751. * @return (Object) New selection containing new set of matches.
  2752. */
  2753. //selectAll$0 : function(query) {},
  2754. /**
  2755. * Return a single new selection based on the nodes returned by the value function, returning all matches. Sets the parent node to the {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} returned by the previous call to select(). If there was no previous selection, then set parentNode to the root.
  2756. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction
  2757. * @return (Object) New selection containing new set of matches.
  2758. */
  2759. //selectAll$1 : function(valueFunction) {},
  2760. /**
  2761. * Return a new selection based on the filter function. To decide if a node is a match the filter method will be called and it should return true for match false for no match.
  2762. * @param (com.ibm.rave.core.selector.ValueFunction) filterFunction
  2763. * @return (Object) the matched selection
  2764. */
  2765. //filter$0 : function(filterFunction) {},
  2766. /**
  2767. * Return a new selector based on the filter query selector string.
  2768. * @param (String) filter query selector string
  2769. * @return (Object) the matched selection
  2770. */
  2771. //filter$1 : function(filter) {},
  2772. /**
  2773. * Create a new transition on the current selection.
  2774. * @return (com.ibm.rave.core.transition.Transition) the transition
  2775. */
  2776. //transition$0 : function() {},
  2777. /**
  2778. * Create a new transition on the current selection with a given name.
  2779. * @param (String) name the transition name
  2780. * @return (com.ibm.rave.core.transition.Transition) the transition
  2781. */
  2782. //transition$1 : function(name) {}
  2783. });
  2784. // $source: com/ibm/rave/core/Configuration
  2785. /************************************************************************
  2786. ** IBM Confidential
  2787. **
  2788. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2789. **
  2790. ** (C) Copyright IBM Corp. 2015
  2791. **
  2792. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2793. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2794. ************************************************************************/
  2795. // GENERATED
  2796. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2797. var com_ibm_rave_core_Configuration = com_ibm_rave_core_nativeImpl_Declare({
  2798. //nodeFactories : null,
  2799. //queryEngines : null,
  2800. //nodeExtensions : null,
  2801. //filters : null,
  2802. extCounter : 1,
  2803. constructor : function() {
  2804. this.nodeFactories = {};
  2805. this.queryEngines = {};
  2806. },
  2807. /** @expose */
  2808. getSceneNodeFactory : function(nsuri) {
  2809. return this.nodeFactories[nsuri];
  2810. },
  2811. /** @expose */
  2812. setSceneNodeFactory : function(nsuri, factory) {
  2813. if (factory) {
  2814. this.nodeFactories[nsuri] = factory;
  2815. } else {
  2816. delete this.nodeFactories[nsuri];
  2817. }
  2818. },
  2819. /** @expose */
  2820. getQueryEngine : function(nsuri) {
  2821. return this.queryEngines[nsuri];
  2822. },
  2823. /** @expose */
  2824. setQueryEngine : function(nsuri, queryEngine) {
  2825. if (queryEngine) {
  2826. this.queryEngines[nsuri] = queryEngine;
  2827. } else {
  2828. delete this.queryEngines[nsuri];
  2829. }
  2830. },
  2831. /** @expose */
  2832. addSceneNodeExtensionFactory : function(namespaceUri, factory, priority) {
  2833. if (!this.nodeExtensions) {
  2834. this.nodeExtensions = {};
  2835. }
  2836. var list = this.nodeExtensions[namespaceUri];
  2837. if (list) {
  2838. if (priority <= 0) {
  2839. list.splice(0, 0, factory);
  2840. } else if (priority >= list.length) {
  2841. list.push(factory);
  2842. } else {
  2843. list.splice(priority, 0, factory);
  2844. }
  2845. } else {
  2846. list = [factory];
  2847. this.nodeExtensions[namespaceUri] = list;
  2848. }
  2849. this.extCounter++;
  2850. },
  2851. /** @expose */
  2852. removeSceneNodeExtensionFactory : function(namespaceUri, factory) {
  2853. var list = this.nodeExtensions[namespaceUri];
  2854. if (list) {
  2855. var i = list.indexOf(factory);
  2856. if (i >= 0) {
  2857. list.splice(i, 1);
  2858. this.extCounter++;
  2859. }
  2860. }
  2861. },
  2862. /**
  2863. * Extends the node if {@link (com.ibm.rave.core.scene.SceneNodeExtensionFactory) SceneNodeExtensionFactory} s have been registered. The incoming node is returned for convenience. If the node has already been extended, this method will not apply the extensions again.
  2864. * @param (com.ibm.rave.core.scene.SceneNode) node the node to extend
  2865. * @param (com.ibm.rave.core.scene.SceneNode) context an optional context, typically the parent
  2866. * @return (com.ibm.rave.core.scene.SceneNode) the scene node itself
  2867. */
  2868. /** @expose */
  2869. extend : function(node, context) {
  2870. if (this.nodeExtensions) {
  2871. var extId = node.rave_getProperty("__rave-node-ext__");
  2872. var extend = extId == null;
  2873. if (!extend && extId != this.extCounter) {
  2874. node.rave_initExtensions();
  2875. }
  2876. if (extend) {
  2877. node.rave_setProperty("__rave-node-ext__", this.extCounter);
  2878. var nodeExtFactories = this.nodeExtensions[node.rave_getNamespaceURI()];
  2879. if (nodeExtFactories) {
  2880. var c = context ? context : node.rave_getParentNode();
  2881. for (var __i_enFor0 = 0, __exp_enFor0 = nodeExtFactories, __len_enFor0 = __exp_enFor0.length;
  2882. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2883. var extFactory = __exp_enFor0[__i_enFor0];
  2884. extFactory(node, c);
  2885. }
  2886. }
  2887. }
  2888. }
  2889. return node;
  2890. },
  2891. /**
  2892. * Like {@link this.Configuration#this.extend(com_ibm_rave_core_scene_SceneNode, com_ibm_rave_core_scene_SceneNode)} but will recurse through the node's children.
  2893. * @param (com.ibm.rave.core.scene.SceneNode) node the node to extend
  2894. * @return (com.ibm.rave.core.scene.SceneNode) the scene node itself
  2895. */
  2896. /** @expose */
  2897. extendRecursive : function(node) {
  2898. this.extend(node, null);
  2899. if (node.rave_hasChildNodes()) {
  2900. for (var __i_enFor0 = 0, __exp_enFor0 = node.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  2901. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2902. var child = __exp_enFor0[__i_enFor0];
  2903. this.extendRecursive(child);
  2904. }
  2905. }
  2906. return node;
  2907. },
  2908. /**
  2909. * Registers a filter function that can filter selection results.
  2910. */
  2911. /** @expose */
  2912. registerFilter : function(filterKey, filterFunction) {
  2913. if (!this.filters) {
  2914. this.filters = {};
  2915. }
  2916. this.filters[filterKey] = filterFunction;
  2917. },
  2918. /**
  2919. * Registers a filter function that can filter selection results.
  2920. */
  2921. /** @expose */
  2922. unregisterFilter : function(filterKey) {
  2923. if (this.filters) {
  2924. delete this.filters[filterKey];
  2925. }
  2926. },
  2927. /**
  2928. * Filter a single scene node using any registered filters. Used by selectors to remove 'private' nodes from the results.
  2929. * @param (com.ibm.rave.core.scene.SceneNode) item SceneNode that's tested against our filter rules.
  2930. * @param (String) query The original selector query that got the item. Used for performing re-selections if required by the filter.
  2931. * @return (com.ibm.rave.core.scene.SceneNode) The same scene node or null if this node was filtered.
  2932. */
  2933. /** @expose */
  2934. filter : function(item, query) {
  2935. var result = item;
  2936. if (this.filters && result) {
  2937. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.filters), __len_enFor0 = __exp_enFor0.length;
  2938. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2939. var key = __exp_enFor0[__i_enFor0];
  2940. var filterFunction = this.filters[key];
  2941. result = filterFunction(item, query);
  2942. if (!result) {
  2943. break;
  2944. }
  2945. }
  2946. }
  2947. return result;
  2948. },
  2949. /**
  2950. * Filter an array of scene nodes using all registered filters. Used by selectors to remove 'private' nodes from the results.
  2951. * @param (Array) list SceneNode[] array who's elements are tested against our filter rules.
  2952. * @return (Array) New array of SceneNodes that contain only those elements not filtered.
  2953. */
  2954. /** @expose */
  2955. filterArray : function(list) {
  2956. if (this.filters && list) {
  2957. var results = [];
  2958. for (var __i_enFor0 = 0, __exp_enFor0 = list, __len_enFor0 = __exp_enFor0.length;
  2959. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2960. var item = __exp_enFor0[__i_enFor0];
  2961. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(this.filters), __len_enFor1 = __exp_enFor1.length;
  2962. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  2963. var key = __exp_enFor1[__i_enFor1];
  2964. var filterFunction = this.filters[key];
  2965. item = filterFunction(item, null);
  2966. }
  2967. if (item) {
  2968. results.push(item);
  2969. }
  2970. }
  2971. return results;
  2972. }
  2973. return list;
  2974. }
  2975. //constructor : function() {}
  2976. });
  2977. //com_ibm_rave_core_Configuration.EXTENSION_KEY = "__rave-node-ext__";
  2978. /** @expose */
  2979. com_ibm_rave_core_Configuration.INSTANCE = new com_ibm_rave_core_Configuration();
  2980. // $source: com/ibm/rave/core/nativeImpl/arrays/ES6Map
  2981. /************************************************************************
  2982. ** IBM Confidential
  2983. **
  2984. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2985. **
  2986. ** (C) Copyright IBM Corp. 2014, 2015
  2987. **
  2988. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2989. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2990. ************************************************************************/
  2991. // @import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2992. var com_ibm_rave_core_nativeImpl_arrays_ES6Map = rave_externs["ES6Map"] =(function() {
  2993. var map_proto = "__proto__",
  2994. map_zero = "\0";
  2995. function map_escape(key) {
  2996. return (key += "") === map_proto || key[0] === map_zero ? map_zero + key : key;
  2997. }
  2998. function map_unescape(key) {
  2999. return (key += "")[0] === map_zero ? key.slice(1) : key;
  3000. }
  3001. var Map = com_ibm_rave_core_nativeImpl_Declare({
  3002. constructor : function() {
  3003. this._ = Object.create(null);
  3004. },
  3005. /**
  3006. * Constructs a new map with the given comparator.
  3007. * @param (com.ibm.rave.core.internal.util.Comparator) comparator compares two data objects
  3008. */
  3009. /** @expose */
  3010. has: function(key) {
  3011. return map_escape(key) in this._;
  3012. },
  3013. /** @expose */
  3014. get: function(key) {
  3015. return this._[map_escape(key)];
  3016. },
  3017. /** @expose */
  3018. set: function(key, value) {
  3019. return this._[map_escape(key)] = value;
  3020. },
  3021. /** @expose */
  3022. remove: function(key) {
  3023. return (key = map_escape(key)) in this._ && delete this._[key];
  3024. },
  3025. /** @expose */
  3026. keys: function() {
  3027. var keys = [];
  3028. for (var key in this._) keys.push(map_unescape(key));
  3029. return keys;
  3030. },
  3031. /** @expose */
  3032. values: function() {
  3033. var values = [];
  3034. for (var key in this._) values.push(this._[key]);
  3035. return values;
  3036. },
  3037. /** @expose */
  3038. entries: function() {
  3039. var entries = [];
  3040. for (var key in this._) entries.push({key: map_unescape(key), value: this._[key]});
  3041. return entries;
  3042. },
  3043. /** @expose */
  3044. size: function() {
  3045. var size = 0;
  3046. for (var key in this._) ++size;
  3047. return size;
  3048. },
  3049. /** @expose */
  3050. empty: function() {
  3051. for (var key in this._) return false;
  3052. return true;
  3053. },
  3054. /** @expose */
  3055. forEach: function(f) {
  3056. for (var key in this._) f.call(this, map_unescape(key), this._[key]);
  3057. }
  3058. });
  3059. /**
  3060. * Creates a generic map
  3061. * @return (com.ibm.rave.core.arrays.Map) a new map
  3062. */
  3063. Map.create$0 = function() {
  3064. return new Map();
  3065. };
  3066. /**
  3067. * Creates a new Map from an existing Map
  3068. * @param (com.ibm.rave.core.arrays.Map) an existing map
  3069. * @return (com.ibm.rave.core.arrays.Map) a new map
  3070. */
  3071. Map.create$1 = function(object) {
  3072. var map = new Map();
  3073. object.forEach(function(key, value) { map.set(key, value); });
  3074. return map;
  3075. };
  3076. /**
  3077. * Creates a new Map from an array
  3078. * @param Object[] an array
  3079. * @return (com.ibm.rave.core.arrays.Map) a new map
  3080. */
  3081. Map.create$2 = function(object) {
  3082. var map = new Map();
  3083. for (var key in object) map.set(key, object[key]);
  3084. return map;
  3085. };
  3086. /** @expose */
  3087. Map.create = function(a0) {
  3088. if (arguments.length == 0) {
  3089. return Map.create$0();
  3090. } else if (arguments.length == 1 && (a0 instanceof Map)) {
  3091. return Map.create$1(a0);
  3092. }
  3093. return Map.create$2(a0);
  3094. };
  3095. return Map;
  3096. })();
  3097. // $source: com/ibm/rave/core/nativeImpl/timer/Timer
  3098. /************************************************************************
  3099. ** IBM Confidential
  3100. **
  3101. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3102. **
  3103. ** (C) Copyright IBM Corp. 2014
  3104. **
  3105. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3106. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3107. ************************************************************************/
  3108. // @import com/ibm/rave/core/internal/nativeImpl/Vendor
  3109. var com_ibm_rave_core_nativeImpl_timer_Timer = (function() {
  3110. // use requestAnimationFrame if available
  3111. // fallback to setTimeout
  3112. var raf = this[vendorSymbol(this, "requestAnimationFrame")] || function(callback) { setTimeout(callback, 17); },
  3113. active, qhead, qtail, sleepHandle, currentTime;
  3114. function executeCallbacks(now) {
  3115. currentTime = now;
  3116. var sleep = Infinity,
  3117. prev,
  3118. item = qhead;
  3119. while (item) {
  3120. if (now >= item.time && item.callback(now - item.time)) {
  3121. // remove item from the queue
  3122. if (prev) {
  3123. // set the previous next to the item next
  3124. prev.next = item.next;
  3125. } else {
  3126. // since we never had a previous item
  3127. // move the queue head pointer ahead
  3128. qhead = item.next;
  3129. }
  3130. } else {
  3131. // track previous item in queue
  3132. prev = item;
  3133. if (item.time < sleep) {
  3134. // track the smallest time for all callbacks
  3135. sleep = item.time;
  3136. }
  3137. }
  3138. // get next item in the queue
  3139. item = item.next;
  3140. }
  3141. // the previous item is always the new tail
  3142. qtail = prev;
  3143. return sleep;
  3144. }
  3145. function step() {
  3146. var now = Date.now(),
  3147. sleep = executeCallbacks(now) - now;
  3148. // check if there are any items in the queue
  3149. if (sleep > 24) {
  3150. if (isFinite(sleep)) {
  3151. // delay the loop as to not run the cpu needlessly
  3152. sleepHandle = setTimeout(step, sleep);
  3153. }
  3154. active = 0;
  3155. } else {
  3156. active = 1;
  3157. // continue the loop
  3158. raf(step);
  3159. }
  3160. }
  3161. var timer = function(callback, delay, start) {
  3162. var argsLen = arguments.length;
  3163. if (argsLen < 2) {
  3164. delay = 0;
  3165. }
  3166. if (argsLen < 3) {
  3167. start = Date.now();
  3168. }
  3169. var item = {
  3170. callback: callback,
  3171. // start time is based on real time
  3172. time: delay + start
  3173. //next: null // the next item in the queue
  3174. };
  3175. if (qtail) {
  3176. // add item to end of queue
  3177. qtail.next = item;
  3178. } else {
  3179. // set item as the head of the queue
  3180. qhead = item;
  3181. }
  3182. // item is the new tail
  3183. qtail = item;
  3184. if (!active) {
  3185. sleepHandle = clearTimeout(sleepHandle);
  3186. active = 1;
  3187. // begin the loop
  3188. raf(step);
  3189. }
  3190. };
  3191. /** @expose */
  3192. timer.flush = function(callback, delay, duration) {
  3193. executeCallbacks(Date.now());
  3194. };
  3195. /** @expose */
  3196. timer.currentTime = function() {
  3197. return currentTime;
  3198. }
  3199. return {
  3200. /** @expose */
  3201. INSTANCE : timer
  3202. };
  3203. })();
  3204. // $source: com/ibm/rave/core/internal/transitions/TransitionInfo
  3205. /************************************************************************
  3206. ** IBM Confidential
  3207. **
  3208. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3209. **
  3210. ** (C) Copyright IBM Corp. 2015
  3211. **
  3212. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3213. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3214. ************************************************************************/
  3215. // GENERATED
  3216. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  3217. //@import com/ibm/rave/core/ease/Easing (runtime) // Easing
  3218. //@import com/ibm/rave/core/event/Dispatcher (runtime) // create
  3219. var com_ibm_rave_core_internal_transitions_TransitionInfo = com_ibm_rave_core_nativeImpl_Declare({
  3220. /**
  3221. * @expose
  3222. */
  3223. ease : null,
  3224. /**
  3225. * @expose
  3226. */
  3227. tween : null,
  3228. /**
  3229. * @expose
  3230. */
  3231. event : null,
  3232. /**
  3233. * @expose
  3234. */
  3235. time : null,
  3236. //node : null,
  3237. //tracker : null,
  3238. /**
  3239. * @expose
  3240. */
  3241. delay : 0,
  3242. /**
  3243. * @expose
  3244. */
  3245. duration : 250,
  3246. transitionId : 0,
  3247. index : 0,
  3248. groupIndex : 0,
  3249. scheduled : false,
  3250. constructor : function(tracker, id, node) {
  3251. this.ease = com_ibm_rave_core_ease_Easing.DEFAULT;
  3252. this.tween = {};
  3253. {
  3254. this.tracker = tracker;
  3255. this.transitionId = id;
  3256. this.node = node;
  3257. }
  3258. },
  3259. getTransitionId : function() {
  3260. return this.transitionId;
  3261. },
  3262. getTracker : function() {
  3263. return this.tracker;
  3264. },
  3265. getSceneNode : function() {
  3266. return this.node;
  3267. },
  3268. getOrCreateDispatcher : function() {
  3269. if (!this.event) {
  3270. this.event = com_ibm_rave_core_event_Dispatcher.create("start", "end", "interrupt");
  3271. }
  3272. return this.event;
  3273. },
  3274. getDispatcher : function() {
  3275. return this.event;
  3276. },
  3277. setIndex : function(index) {
  3278. this.index = index;
  3279. },
  3280. getIndex : function() {
  3281. return this.index;
  3282. },
  3283. setGroupIndex : function(groupIndex) {
  3284. this.groupIndex = groupIndex;
  3285. },
  3286. getGroupIndex : function() {
  3287. return this.groupIndex;
  3288. },
  3289. setDelay : function(delay) {
  3290. this.delay = delay;
  3291. },
  3292. getDelay : function() {
  3293. return this.delay;
  3294. },
  3295. setDuration : function(duration) {
  3296. this.duration = duration;
  3297. },
  3298. getDuration : function() {
  3299. return this.duration;
  3300. },
  3301. setEase : function(ease) {
  3302. this.ease = ease;
  3303. },
  3304. getEase : function() {
  3305. return this.ease;
  3306. },
  3307. addTweenFactory : function(key, factory) {
  3308. this.tween[key] = factory;
  3309. },
  3310. removeTweenFactory : function(key) {
  3311. delete this.tween[key];
  3312. },
  3313. getTweenFactory : function(key) {
  3314. return this.tween[key];
  3315. },
  3316. getTweens : function() {
  3317. var sceneNode = this.node;
  3318. var data = sceneNode.rave_getData();
  3319. var i = this.index;
  3320. var gi = this.groupIndex;
  3321. var tweens = [];
  3322. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.tween), __len_enFor0 = __exp_enFor0.length;
  3323. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3324. var key = __exp_enFor0[__i_enFor0];
  3325. var tf = this.tween[key];
  3326. var t = tf.call(sceneNode, data, i, gi);
  3327. if (t) {
  3328. tweens.push(t);
  3329. }
  3330. }
  3331. return tweens;
  3332. },
  3333. getStartTime : function() {
  3334. return this.time;
  3335. },
  3336. setStartTime : function(startTime) {
  3337. this.time = startTime;
  3338. },
  3339. isScheduled : function() {
  3340. return this.scheduled;
  3341. },
  3342. setScheduled : function() {
  3343. this.scheduled = true;
  3344. }
  3345. });
  3346. // $source: com/ibm/rave/core/ease/Easing
  3347. /************************************************************************
  3348. ** IBM Confidential
  3349. **
  3350. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3351. **
  3352. ** (C) Copyright IBM Corp. 2015
  3353. **
  3354. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3355. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3356. ************************************************************************/
  3357. // GENERATED
  3358. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  3359. /**
  3360. * Collection of built-in easing functions. Provides a utility to retrieve an easing function by named type.
  3361. */
  3362. var com_ibm_rave_core_ease_Easing = com_ibm_rave_core_nativeImpl_Declare({
  3363. _$functionClassMethod : function() {
  3364. var _$self = /**
  3365. * Returns a built-in easing function of the specified type, with any optional arguments. An easing function takes the current parameterized time value t in the domain [0,1], and maps it to another value in a similar range; it is typically used to set transition easing. The following easing types are supported: <ul> <li>linear - the identity function, t.</li> <li>poly(k) - raises t to the specified power k (e.g., 3).</li> <li>quad - equivalent to poly(2).</li> <li>cubic - equivalent to poly(3).</li> <li>sin - applies the trigonometric function sin.</li> <li>exp - raises 2 to a power based on t.</li> <li>circle - the quarter circle.</li> <li>elastic(a, p) - simulates an elastic band; may extend slightly beyond 0 and 1.</li> <li>back(s) - simulates backing into a parking space.</li> <li>bounce - simulates a bouncy collision.</li> </ul> These built-in types may be extended using a variety of modes: <ul> <li>in - the identity function.</li> <li>out - reverses the easing direction to [1,0].</li> <li>in-out- copies and mirrors the easing function from [0,.5] and [.5,1].</li> <li>out-in - copies and mirrors the easing function from [1,.5] and [.5,0].</li> </ul>
  3366. * @param (String) type the type of {@link (com.ibm.rave.core.ease.EasingFunction) EasingFunction}
  3367. * @param (java.lang.Object[]) args the parameters that will be provided to the type of {@link (com.ibm.rave.core.ease.EasingFunction) EasingFunction} specified.
  3368. * @return (com.ibm.rave.core.ease.EasingFunction) an {@link (com.ibm.rave.core.ease.EasingFunction) EasingFunction} of the type Specified with the provided arguments applied
  3369. */
  3370. function(type, args) {
  3371. if (args !== null || arguments.length > 2){
  3372. args = Array.prototype.slice.call(arguments, 1);
  3373. }
  3374. {
  3375. var i = type.indexOf("-");
  3376. var t = i >= 0 ? type.substring(0, i) : type;
  3377. var m = i >= 0 ? type.substring(i + 1) : "in";
  3378. var e = com_ibm_rave_core_ease_Easing.identity;
  3379. if ("poly" == t) {
  3380. e = com_ibm_rave_core_ease_Easing.poly((args[0]));
  3381. } else if ("quad" == t) {
  3382. e = com_ibm_rave_core_ease_Easing.quad;
  3383. } else if ("cubic" == t) {
  3384. e = com_ibm_rave_core_ease_Easing.cubic;
  3385. } else if ("sin" == t) {
  3386. e = com_ibm_rave_core_ease_Easing.sin;
  3387. } else if ("exp" == t) {
  3388. e = com_ibm_rave_core_ease_Easing.exp;
  3389. } else if ("circle" == t) {
  3390. e = com_ibm_rave_core_ease_Easing.circle;
  3391. } else if ("elastic" == t) {
  3392. if (!args || args.length == 0) {
  3393. e = com_ibm_rave_core_ease_Easing.elastic$0();
  3394. } else if (args.length == 1) {
  3395. e = com_ibm_rave_core_ease_Easing.elastic$1((args[0]));
  3396. } else if (args.length == 2) {
  3397. e = com_ibm_rave_core_ease_Easing.elastic$2((args[0]), (args[1]));
  3398. }
  3399. } else if ("back" == t) {
  3400. if (!args || args.length == 0) {
  3401. e = com_ibm_rave_core_ease_Easing.back$0();
  3402. } else if (args.length == 1) {
  3403. e = com_ibm_rave_core_ease_Easing.back$1((args[0]));
  3404. }
  3405. } else if ("bounce" == t) {
  3406. e = com_ibm_rave_core_ease_Easing.bounce;
  3407. }
  3408. if ("out" == m) {
  3409. e = com_ibm_rave_core_ease_Easing.reverse(e);
  3410. } else if ("in-out" == m) {
  3411. e = com_ibm_rave_core_ease_Easing.reflect(e);
  3412. } else if ("out-in" == m) {
  3413. e = com_ibm_rave_core_ease_Easing.reflect(com_ibm_rave_core_ease_Easing.reverse(e));
  3414. }
  3415. return com_ibm_rave_core_ease_Easing.clamp(e);
  3416. }
  3417. };
  3418. return _$self;
  3419. }
  3420. //constructor : function() {}
  3421. });
  3422. com_ibm_rave_core_ease_Easing.clamp = function(f) {
  3423. return function(t) {
  3424. return t <= 0 ? 0 : t >= 1 ? 1 : f(t);
  3425. };
  3426. };
  3427. com_ibm_rave_core_ease_Easing.reverse = function(f) {
  3428. return function(t) {
  3429. return 1 - f(1 - t);
  3430. };
  3431. };
  3432. com_ibm_rave_core_ease_Easing.reflect = function(f) {
  3433. return function(t) {
  3434. return .5 * (t < .5 ? f(2 * t) : (2 - f(2 - 2 * t)));
  3435. };
  3436. };
  3437. com_ibm_rave_core_ease_Easing.poly = function(e) {
  3438. return function(t) {
  3439. return Math.pow(t, e);
  3440. };
  3441. };
  3442. com_ibm_rave_core_ease_Easing.elastic$0 = function() {
  3443. return com_ibm_rave_core_ease_Easing.elastic$3(1, 0.45, 0.45 / 4);
  3444. };
  3445. com_ibm_rave_core_ease_Easing.elastic$1 = function(a) {
  3446. return com_ibm_rave_core_ease_Easing.elastic$2(a, 0.45);
  3447. };
  3448. com_ibm_rave_core_ease_Easing.elastic$2 = function(a, p) {
  3449. return com_ibm_rave_core_ease_Easing.elastic$3(a, p, p / 6.283185307179586 * Math.asin(1 / a));
  3450. };
  3451. com_ibm_rave_core_ease_Easing.elastic$3 = function(a, p, s) {
  3452. return function(t) {
  3453. return 1 + a * Math.pow(2, -10 * t) * Math.sin((t - s) * 6.283185307179586 / p);
  3454. };
  3455. };
  3456. com_ibm_rave_core_ease_Easing.back$0 = function() {
  3457. return com_ibm_rave_core_ease_Easing.back$1(1.70158);
  3458. };
  3459. com_ibm_rave_core_ease_Easing.back$1 = function(s) {
  3460. return function(t) {
  3461. return t * t * ((s + 1) * t - s);
  3462. };
  3463. };
  3464. com_ibm_rave_core_ease_Easing.elastic = function(a0, a1, a2) {
  3465. var args = arguments;
  3466. if (args.length == 0) {
  3467. return com_ibm_rave_core_ease_Easing.elastic$0();
  3468. }
  3469. if (args.length == 1) {
  3470. return com_ibm_rave_core_ease_Easing.elastic$1(a0);
  3471. }
  3472. if (args.length == 2) {
  3473. return com_ibm_rave_core_ease_Easing.elastic$2(a0, a1);
  3474. }
  3475. return com_ibm_rave_core_ease_Easing.elastic$3(a0, a1, a2);
  3476. };
  3477. com_ibm_rave_core_ease_Easing.back = function(a0) {
  3478. var args = arguments;
  3479. if (args.length == 0) {
  3480. return com_ibm_rave_core_ease_Easing.back$0();
  3481. }
  3482. return com_ibm_rave_core_ease_Easing.back$1(a0);
  3483. };
  3484. /** @expose */
  3485. com_ibm_rave_core_ease_Easing.INSTANCE = new com_ibm_rave_core_ease_Easing();
  3486. com_ibm_rave_core_ease_Easing.HALF_PI = Math.PI / 2;
  3487. com_ibm_rave_core_ease_Easing.PI_2 = Math.PI * 2;
  3488. com_ibm_rave_core_ease_Easing.identity = function(t) {
  3489. return t;
  3490. };
  3491. com_ibm_rave_core_ease_Easing.quad = function(t) {
  3492. return t * t;
  3493. };
  3494. com_ibm_rave_core_ease_Easing.cubic = function(t) {
  3495. return t * t * t;
  3496. };
  3497. com_ibm_rave_core_ease_Easing.cubicInOut = function(t) {
  3498. if (t <= 0) {
  3499. return 0;
  3500. }
  3501. if (t >= 1) {
  3502. return 1;
  3503. }
  3504. var t2 = t * t, t3 = t2 * t;
  3505. return 4 * (t < .5 ? t3 : 3 * (t - t2) + t3 - .75);
  3506. };
  3507. com_ibm_rave_core_ease_Easing.sin = function(t) {
  3508. return 1 - Math.cos(t * 1.5707963267948966);
  3509. };
  3510. com_ibm_rave_core_ease_Easing.exp = function(t) {
  3511. return Math.pow(2, 10 * (t - 1));
  3512. };
  3513. com_ibm_rave_core_ease_Easing.circle = function(t) {
  3514. return 1 - Math.sqrt(1 - t * t);
  3515. };
  3516. com_ibm_rave_core_ease_Easing.bounce = function(t) {
  3517. return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;
  3518. };
  3519. /**
  3520. * The default easing function is "cubic-in-out" which provides suitable slow-in slow-out animations
  3521. */
  3522. /** @expose */
  3523. com_ibm_rave_core_ease_Easing.DEFAULT = com_ibm_rave_core_ease_Easing.cubicInOut;
  3524. // $source: com/ibm/rave/core/event/Dispatcher
  3525. /************************************************************************
  3526. ** IBM Confidential
  3527. **
  3528. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3529. **
  3530. ** (C) Copyright IBM Corp. 2015
  3531. **
  3532. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3533. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3534. ************************************************************************/
  3535. // GENERATED
  3536. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare anonymous, declare
  3537. /**
  3538. * Behaviors and higher level components, such as the brush, use dispatch to broadcast custom events. <p> For visualizations with coordinated views, dispatch provides a convenient lightweight mechanism for loosely-coupled components. Organizing your code with dispatch can assist with separation of concerns and make your code easier to maintain.
  3539. * @param < (java.lang.Object) C > the event listener context
  3540. */
  3541. var com_ibm_rave_core_event_Dispatcher = rave_externs["Dispatcher"] = com_ibm_rave_core_nativeImpl_Declare(Object, {
  3542. /** @expose */
  3543. init : function(types) {
  3544. if (types !== null || arguments.length > 1){
  3545. types = Array.prototype.slice.call(arguments);
  3546. }
  3547. {
  3548. var i = -1, n = types.length;
  3549. while (++i < n) {
  3550. this[types[i]] = com_ibm_rave_core_event_Dispatcher.createEvent(this);
  3551. }
  3552. }
  3553. },
  3554. /** @expose */
  3555. constructor : function() {},
  3556. /**
  3557. * Returns the currently-assigned listener for the specified type, if any.
  3558. * @param (String) type the event type
  3559. * @return (com.ibm.rave.core.selector.RunFunction) the currently-assigned listener for the specified type
  3560. */
  3561. on$0 : function(type) {
  3562. var t = type;
  3563. var i = t.indexOf(".");
  3564. var name = "";
  3565. if (i >= 0) {
  3566. name = t.substring(i + 1);
  3567. t = t.substring(0, i);
  3568. }
  3569. if (t.length > 0) {
  3570. return this[t].on$0(name);
  3571. }
  3572. return undefined;
  3573. },
  3574. /**
  3575. * Adds or removes an event listener for the specified type. The type is a string event type name, such as "start" or "end". The specified listener is invoked with the context and arguments determined by the caller. <p> If an event listener was already registered for the same type, the existing listener is removed before the new listener is added. To register multiple listeners for the same event type, the type may be followed by an optional namespace, such as "click.foo" and "click.bar". Likewise, you can remove all registered listeners for a given namespace by saying dispatch.on(".foo", null).
  3576. * @param (String) type the event type
  3577. * @param (com.ibm.rave.core.selector.RunFunction) listener the event listener to register, or <code>null</code> to remove the listener
  3578. * @return (com.ibm.rave.core.event.Dispatcher) this {@link (com.ibm.rave.core.event.Dispatcher) Dispatcher}
  3579. */
  3580. on$1 : function(type, listener) {
  3581. var t = type;
  3582. var i = t.indexOf(".");
  3583. var name = "";
  3584. if (i >= 0) {
  3585. name = t.substring(i + 1);
  3586. t = t.substring(0, i);
  3587. }
  3588. if (t.length > 0) {
  3589. return this[t].on$1(name, listener);
  3590. }
  3591. if (!listener) {
  3592. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this), __len_enFor0 = __exp_enFor0.length;
  3593. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3594. var key = __exp_enFor0[__i_enFor0];
  3595. if (this.hasOwnProperty(key)) {
  3596. this[key].on$1(name, null);
  3597. }
  3598. }
  3599. }
  3600. return this;
  3601. },
  3602. /** @expose */
  3603. on : function(a0, a1) {
  3604. var args = arguments;
  3605. if (args.length == 1) {
  3606. return this.on$0(a0);
  3607. }
  3608. return this.on$1(a0, a1);
  3609. }
  3610. });
  3611. /**
  3612. * Creates a new dispatcher object for the specified types. Each argument is a string representing the name of the event type, such as "zoom" or "change". The returned object is an associative array; each type name is associated with a {@link (com.ibm.rave.core.event.Dispatcher.DispatcherEvent) DispatcherEvent} .
  3613. * @param (java.lang.String[]) types event type names
  3614. * @return (com.ibm.rave.core.event.Dispatcher) a dispatcher for the given event types
  3615. */
  3616. /** @expose */
  3617. com_ibm_rave_core_event_Dispatcher.create = function(types) {
  3618. if (types !== null || arguments.length > 1){
  3619. types = Array.prototype.slice.call(arguments);
  3620. }
  3621. {
  3622. var dispatch = new com_ibm_rave_core_event_Dispatcher();
  3623. dispatch.init.apply(dispatch, types);
  3624. return dispatch;
  3625. }
  3626. };
  3627. com_ibm_rave_core_event_Dispatcher.createEvent = function(dispatch) {
  3628. var listeners = [];
  3629. listeners[0] = [];
  3630. var listenerByName = [];
  3631. listenerByName[0] = {};
  3632. return new (com_ibm_rave_core_nativeImpl_Declare({
  3633. _$functionClassMethod : function() {
  3634. var _$self = function(args) {
  3635. if (args !== null || arguments.length > 1){
  3636. args = Array.prototype.slice.call(arguments, 0);
  3637. }
  3638. {
  3639. var z = listeners[0];
  3640. var i = -1, n = z.length;
  3641. var l;
  3642. while (++i < n) {
  3643. if ((l = z[i]).on) {
  3644. l.on.apply(this, args);
  3645. }
  3646. }
  3647. return dispatch;
  3648. }
  3649. };
  3650. return _$self;
  3651. },
  3652. on$0 : function(name) {
  3653. var l = listenerByName[0][name];
  3654. return l && l.on ? l.on : null;
  3655. },
  3656. on$1 : function(name, listener) {
  3657. var l = listenerByName[0][name];
  3658. if (l) {
  3659. var i;
  3660. l.on = null;
  3661. listeners[0] = listeners[0].slice(0, i = listeners[0].indexOf(l)).concat(listeners[0].slice(i + 1));
  3662. delete listenerByName[0][name];
  3663. }
  3664. if (listener) {
  3665. l = new com_ibm_rave_core_event_Dispatcher.ListenerWrapper(listener);
  3666. listenerByName[0][name] = l;
  3667. listeners[0].push(l);
  3668. }
  3669. return dispatch;
  3670. },
  3671. on : function(a0, a1) {
  3672. var args = arguments;
  3673. if (args.length == 1) {
  3674. return this.on$0(a0);
  3675. }
  3676. return this.on$1(a0, a1);
  3677. }
  3678. }))();
  3679. };
  3680. com_ibm_rave_core_event_Dispatcher.ListenerWrapper = function(on) {
  3681. this.on = on;
  3682. };
  3683. // $source: com/ibm/rave/core/internal/transitions/TransitionTracker
  3684. /************************************************************************
  3685. ** IBM Confidential
  3686. **
  3687. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3688. **
  3689. ** (C) Copyright IBM Corp. 2015
  3690. **
  3691. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3692. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3693. ************************************************************************/
  3694. // GENERATED
  3695. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  3696. var com_ibm_rave_core_internal_transitions_TransitionTracker = com_ibm_rave_core_nativeImpl_Declare(Object, {
  3697. /**
  3698. * @expose
  3699. */
  3700. active : 0,
  3701. /**
  3702. * @expose
  3703. */
  3704. count : 0
  3705. });
  3706. // $source: com/ibm/rave/core/internal/transitions/TransitionUtil
  3707. /************************************************************************
  3708. ** IBM Confidential
  3709. **
  3710. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3711. **
  3712. ** (C) Copyright IBM Corp. 2015
  3713. **
  3714. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3715. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3716. ************************************************************************/
  3717. // GENERATED
  3718. //@import com/ibm/rave/core/internal/transitions/TransitionInfo (static) // new
  3719. //@import com/ibm/rave/core/internal/transitions/TransitionTracker (static) // new
  3720. var com_ibm_rave_core_internal_transitions_TransitionUtil = {
  3721. };
  3722. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo = function(node, namespace, id) {
  3723. var tracker = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionTracker(node, namespace);
  3724. var info = tracker[id];
  3725. if (!info) {
  3726. tracker.count++;
  3727. info = new com_ibm_rave_core_internal_transitions_TransitionInfo(tracker, id, node);
  3728. tracker[id] = info;
  3729. }
  3730. return info;
  3731. };
  3732. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionTracker = function(node, namespace) {
  3733. var tracker = node.rave_getProperty(namespace);
  3734. if (!tracker) {
  3735. tracker = new com_ibm_rave_core_internal_transitions_TransitionTracker();
  3736. node.rave_setProperty(namespace, tracker);
  3737. }
  3738. return tracker;
  3739. };
  3740. com_ibm_rave_core_internal_transitions_TransitionUtil.disposeTransition = function(node, namespace) {
  3741. node.rave_setProperty(namespace, null);
  3742. };
  3743. com_ibm_rave_core_internal_transitions_TransitionUtil.interrupt = function(node) {
  3744. com_ibm_rave_core_internal_transitions_TransitionUtil.interruptNS(node, com_ibm_rave_core_internal_transitions_TransitionUtil.transitionNamespace(null));
  3745. };
  3746. com_ibm_rave_core_internal_transitions_TransitionUtil.interruptNS = function(node, namespace) {
  3747. var tracker = node.rave_getProperty(namespace);
  3748. var active;
  3749. if (tracker && (active = tracker[tracker.active])) {
  3750. if (--tracker.count > 0) {
  3751. delete tracker[tracker.active];
  3752. } else {
  3753. com_ibm_rave_core_internal_transitions_TransitionUtil.disposeTransition(node, namespace);
  3754. }
  3755. tracker.active += 0.5;
  3756. if (active.event) {
  3757. active.event["interrupt"].call(node, node.rave_getData(), active.index);
  3758. }
  3759. }
  3760. };
  3761. /**
  3762. * @param (String) name the name of the transition
  3763. * @return (String) the transition namespace
  3764. */
  3765. com_ibm_rave_core_internal_transitions_TransitionUtil.transitionNamespace = function(name) {
  3766. return name == null ? "__transition_" + "_" : "__transition_" + name + "__";
  3767. };
  3768. //com_ibm_rave_core_internal_transitions_TransitionUtil.TRANSITION_PROPERTY = "__transition_";
  3769. // $source: com/ibm/rave/core/internal/transitions/Tweener
  3770. /************************************************************************
  3771. ** IBM Confidential
  3772. **
  3773. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3774. **
  3775. ** (C) Copyright IBM Corp. 2015
  3776. **
  3777. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3778. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3779. ************************************************************************/
  3780. // GENERATED
  3781. //@import com/ibm/rave/core/nativeImpl/timer/Timer (static) // Timer
  3782. //@import com/ibm/rave/core/internal/transitions/TransitionUtil (static) // disposeTransition, getTransitionInfo
  3783. var com_ibm_rave_core_internal_transitions_Tweener = {
  3784. };
  3785. /**
  3786. * Posts a timer event to perform the scheduling of the transitions if early scheduling is supported. This allows multiple transitions to be aligned on the same start time. <p> If early scheduling is not supported, adds the transition to a list of transitions to be scheduled by explicitly calling {@link #this.schedulePending()} .
  3787. * @param (com.ibm.rave.core.transition.Transition) transition the transitions to schedule
  3788. */
  3789. com_ibm_rave_core_internal_transitions_Tweener.schedule = function(transition) {
  3790. if (com_ibm_rave_core_internal_transitions_Tweener.earlyScheduleSupport) {
  3791. com_ibm_rave_core_nativeImpl_timer_Timer.INSTANCE(function(elapsed) {
  3792. com_ibm_rave_core_internal_transitions_Tweener.scheduleTransition(transition, com_ibm_rave_core_nativeImpl_timer_Timer.INSTANCE.currentTime(), elapsed);
  3793. return true;
  3794. }, 0, Date.now());
  3795. } else {
  3796. {
  3797. com_ibm_rave_core_internal_transitions_Tweener.pending.push(transition);
  3798. }
  3799. }
  3800. };
  3801. /**
  3802. * Schedules the transitions by creating timer events.
  3803. * @param (com.ibm.rave.core.transition.Transition) transition the transitions to schedule
  3804. * @param (double) startTime the time used as the start time of all transitions
  3805. * @param (double) elapsed the time elapsed, in milli-seconds, transition was scheduled
  3806. */
  3807. com_ibm_rave_core_internal_transitions_Tweener.scheduleTransition = function(transition, startTime, elapsed) {
  3808. var transitionId = transition.id;
  3809. var namespace = transition.namespace;
  3810. for (var j = 0, m = transition.length; j < m; ++j) {
  3811. var group = transition[j];
  3812. for (var i = 0, n = group.length; i < n; ++i) {
  3813. var node = group[i];
  3814. if (node) {
  3815. var info = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(node, namespace, transitionId);
  3816. if (!(info.scheduled)) {
  3817. info.setScheduled();
  3818. var tracker = info.tracker;
  3819. var infoStartTime = info.time;
  3820. if (infoStartTime == null) {
  3821. infoStartTime = startTime;
  3822. info.time = startTime;
  3823. }
  3824. com_ibm_rave_core_internal_transitions_Tweener.doSchedule(info, tracker, namespace, transitionId, infoStartTime, elapsed);
  3825. }
  3826. }
  3827. }
  3828. }
  3829. };
  3830. com_ibm_rave_core_internal_transitions_Tweener.doSchedule = function(info, tracker, namespace, id, startTime, elapsed) {
  3831. var node = info.node;
  3832. if (tracker.active > id) {
  3833. com_ibm_rave_core_internal_transitions_Tweener.stop(tracker, node, namespace, id);
  3834. } else {
  3835. var tick;
  3836. var start = function(startElapsed) {
  3837. if (!tick) {
  3838. tick = com_ibm_rave_core_internal_transitions_Tweener.startAndCreateTick(info, tracker, namespace, id, startTime, startElapsed);
  3839. return !tick;
  3840. }
  3841. return tick(startElapsed);
  3842. };
  3843. com_ibm_rave_core_nativeImpl_timer_Timer.INSTANCE(start, info.delay - elapsed, startTime);
  3844. }
  3845. };
  3846. com_ibm_rave_core_internal_transitions_Tweener.startAndCreateTick = function(info, tracker, namespace, id, startTime, startElapsed) {
  3847. var node = info.node;
  3848. var index = info.index;
  3849. var groupIndex = info.groupIndex;
  3850. if (tracker.active > id) {
  3851. com_ibm_rave_core_internal_transitions_Tweener.stop(tracker, node, namespace, id);
  3852. return null;
  3853. }
  3854. var active = tracker[tracker.active];
  3855. if (active) {
  3856. --tracker.count;
  3857. delete tracker[tracker.active];
  3858. if (active.event) {
  3859. active.event["interrupt"].call(node, node.rave_getData(), active.index);
  3860. }
  3861. }
  3862. tracker.active = id;
  3863. if (info.event) {
  3864. info.event["start"].call(node, node.rave_getData(), index, groupIndex);
  3865. }
  3866. var tweens = info.getTweens();
  3867. var ease = info.ease;
  3868. var duration = info.duration;
  3869. var tick = function(elapsed) {
  3870. if (tracker.active != id) {
  3871. return true;
  3872. }
  3873. var t = elapsed / duration;
  3874. var v = !ease ? t : ease(t);
  3875. for (var __i_enFor0 = 0, __exp_enFor0 = tweens, __len_enFor0 = __exp_enFor0.length;
  3876. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3877. var tween = __exp_enFor0[__i_enFor0];
  3878. tween.call(node, v);
  3879. }
  3880. if (t >= 1) {
  3881. if (info.event) {
  3882. info.event["end"].call(node, node.rave_getData(), index, groupIndex);
  3883. }
  3884. return com_ibm_rave_core_internal_transitions_Tweener.stop(tracker, node, namespace, id);
  3885. }
  3886. return false;
  3887. };
  3888. com_ibm_rave_core_nativeImpl_timer_Timer.INSTANCE(function(_) {
  3889. tick(startElapsed);
  3890. return true;
  3891. }, 0, startTime);
  3892. return startElapsed / duration < 1 ? tick : null;
  3893. };
  3894. com_ibm_rave_core_internal_transitions_Tweener.stop = function(tracker, node, namespace, id) {
  3895. if (--tracker.count > 0) {
  3896. delete tracker[id];
  3897. } else {
  3898. com_ibm_rave_core_internal_transitions_TransitionUtil.disposeTransition(node, namespace);
  3899. }
  3900. return true;
  3901. };
  3902. // $source: com/ibm/rave/core/internal/transitions/TweenFunctions
  3903. /************************************************************************
  3904. ** IBM Confidential
  3905. **
  3906. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3907. **
  3908. ** (C) Copyright IBM Corp. 2015
  3909. **
  3910. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3911. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3912. ************************************************************************/
  3913. // GENERATED
  3914. //@import com/ibm/rave/core/internal/nativeImpl/Lang (runtime) // isNumber
  3915. //@import com/ibm/rave/core/interpolate/Interpolators (runtime) // Interpolators
  3916. //@import com/ibm/rave/core/nativeImpl/interpolate/TransformInterpolation (runtime) // TransformInterpolation
  3917. //@import com/ibm/rave/core/internal/transitions/TransitionUtil (runtime) // getTransitionInfo
  3918. //@import com/ibm/rave/core/internal/selector/SelectorHelper (static) // each
  3919. var com_ibm_rave_core_internal_transitions_TweenFunctions = {
  3920. };
  3921. com_ibm_rave_core_internal_transitions_TweenFunctions.style = function(name, value, priority) {
  3922. return function(data, index, groupIndex) {
  3923. var startValue = this.rave_getComputedStyle(name);
  3924. var v = value;
  3925. if (typeof v === "function") {
  3926. v = (v).call(this, data, index, groupIndex);
  3927. }
  3928. if (v == null) {
  3929. this.rave_removeStyle(name);
  3930. return null;
  3931. }
  3932. if (!(com_ibm_rave_core_internal_nativeImpl_Lang.isNumber(v)) || !(com_ibm_rave_core_internal_nativeImpl_Lang.isNumber(startValue))) {
  3933. v = v + "";
  3934. }
  3935. if (startValue!==v) {
  3936. var interpolator = com_ibm_rave_core_interpolate_Interpolators.INSTANCE.getInterpolator(startValue, v);
  3937. return function(t) {
  3938. this.rave_setStyle(name, interpolator(t), priority);
  3939. };
  3940. }
  3941. return null;
  3942. };
  3943. };
  3944. com_ibm_rave_core_internal_transitions_TweenFunctions.styleTween = function(name, factory, priority) {
  3945. return function(data, index, groupIndex) {
  3946. var startValue = this.rave_getComputedStyle(name);
  3947. var interpolator = factory.call(this, data, index, startValue);
  3948. if (interpolator) {
  3949. return function(t) {
  3950. this.rave_setStyle(name, interpolator(t), priority);
  3951. };
  3952. }
  3953. return null;
  3954. };
  3955. };
  3956. com_ibm_rave_core_internal_transitions_TweenFunctions.attr = function(qname, value) {
  3957. return function(data, index, groupIndex) {
  3958. var startValue = qname["space"] == null ? this.getAttribute(qname["local"]) : this.getAttributeNS(qname["space"], qname["local"]);
  3959. var v = value;
  3960. if (typeof v === "function") {
  3961. v = (v).call(this, data, index, groupIndex);
  3962. }
  3963. if (v == null) {
  3964. if (qname["space"] == null) {
  3965. this.removeAttribute(qname["local"]);
  3966. } else {
  3967. this.removeAttributeNS(qname["space"], qname["local"]);
  3968. }
  3969. return null;
  3970. }
  3971. if (!(com_ibm_rave_core_internal_nativeImpl_Lang.isNumber(v)) || !(com_ibm_rave_core_internal_nativeImpl_Lang.isNumber(startValue))) {
  3972. v = v + "";
  3973. }
  3974. if (startValue!==v) {
  3975. var interpolator = "transform" == qname["local"] && qname["space"] == null ? com_ibm_rave_core_nativeImpl_interpolate_TransformInterpolation.INSTANCE(startValue, v) : com_ibm_rave_core_interpolate_Interpolators.INSTANCE.getInterpolator(startValue, v);
  3976. if (qname["space"] == null) {
  3977. return function(t) {
  3978. this.setAttribute(qname["local"], interpolator(t));
  3979. };
  3980. }
  3981. return function(t) {
  3982. this.setAttributeNS(qname["space"], qname["local"], interpolator(t));
  3983. };
  3984. }
  3985. return null;
  3986. };
  3987. };
  3988. com_ibm_rave_core_internal_transitions_TweenFunctions.attrTween = function(qname, factory) {
  3989. return function(data, index, groupIndex) {
  3990. var startValue = qname["space"] == null ? this.getAttribute(qname["local"]) : this.getAttributeNS(qname["space"], qname["local"]);
  3991. var interpolator = factory.call(this, data, index, startValue);
  3992. if (interpolator) {
  3993. if (qname["space"] == null) {
  3994. return function(t) {
  3995. this.setAttribute(qname["local"], interpolator(t));
  3996. };
  3997. }
  3998. return function(t) {
  3999. this.setAttributeNS(qname["space"], qname["local"], interpolator(t));
  4000. };
  4001. }
  4002. return null;
  4003. };
  4004. };
  4005. com_ibm_rave_core_internal_transitions_TweenFunctions.tween = function(groups, name, value, getTween) {
  4006. var id = groups.id;
  4007. var namespace = groups.namespace;
  4008. var callback;
  4009. if (typeof value === "function") {
  4010. callback = function(data, index, groupIndex) {
  4011. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(this, namespace, id).addTweenFactory(name, getTween((value).call(this, data, index, groupIndex)));
  4012. };
  4013. } else {
  4014. var tweenFactory = getTween(value);
  4015. callback = function(data, index, groupIndex) {
  4016. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(this, namespace, id).addTweenFactory(name, tweenFactory);
  4017. };
  4018. }
  4019. return com_ibm_rave_core_internal_selector_SelectorHelper.each(groups, callback);
  4020. };
  4021. // $source: com/ibm/rave/core/interpolate/Interpolators
  4022. /************************************************************************
  4023. ** IBM Confidential
  4024. **
  4025. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4026. **
  4027. ** (C) Copyright IBM Corp. 2015
  4028. **
  4029. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4030. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4031. ************************************************************************/
  4032. // GENERATED
  4033. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4034. //@import com/ibm/rave/core/internal/nativeImpl/Lang (runtime) // isObject, isString, isArray
  4035. //@import com/ibm/rave/core/color/Colors (runtime) // isRGBColorName
  4036. //@import com/ibm/rave/core/interpolate/ColorInterpolation (runtime) // ColorInterpolation
  4037. //@import com/ibm/rave/core/interpolate/StringInterpolation (runtime) // StringInterpolation
  4038. //@import com/ibm/rave/core/color/Color (runtime) // new
  4039. //@import com/ibm/rave/core/interpolate/ArrayInterpolation (runtime) // ArrayInterpolation
  4040. //@import com/ibm/rave/core/nativeImpl/interpolate/ObjectInterpolation (runtime) // ObjectInterpolation
  4041. //@import com/ibm/rave/core/interpolate/NumberInterpolation (runtime) // NumberInterpolation
  4042. var com_ibm_rave_core_interpolate_Interpolators = com_ibm_rave_core_nativeImpl_Declare(Array, {
  4043. constructor : function() {
  4044. this.push(function(a, b) {
  4045. if (com_ibm_rave_core_internal_nativeImpl_Lang.isString(b)) {
  4046. if (com_ibm_rave_core_color_Colors.isRGBColorName(b) || (b).match("#[a-z|A-Z|0-9]*|rgba?\\(.*|hsl\\(.*")) {
  4047. return com_ibm_rave_core_interpolate_ColorInterpolation.RGBINSTANCE(a, b);
  4048. }
  4049. return com_ibm_rave_core_interpolate_StringInterpolation.INSTANCE(a, b);
  4050. } else if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(b, com_ibm_rave_core_color_Color)) {
  4051. return com_ibm_rave_core_interpolate_ColorInterpolation.RGBINSTANCE(a, b);
  4052. } else if (com_ibm_rave_core_internal_nativeImpl_Lang.isArray(b)) {
  4053. return com_ibm_rave_core_interpolate_ArrayInterpolation.INSTANCE(a, b);
  4054. } else if (com_ibm_rave_core_internal_nativeImpl_Lang.isObject(b) && isNaN(b)) {
  4055. return com_ibm_rave_core_nativeImpl_interpolate_ObjectInterpolation.INSTANCE(a, b);
  4056. }
  4057. return com_ibm_rave_core_interpolate_NumberInterpolation.INSTANCE(a, b);
  4058. });
  4059. },
  4060. /**
  4061. * Get an interpolator for the given values.
  4062. * @param (Object) a the start value
  4063. * @param (Object) b the end value
  4064. * @return (com.ibm.rave.core.interpolate.Interpolator) an interpolator
  4065. */
  4066. /** @expose */
  4067. getInterpolator : function(a, b) {
  4068. var result;
  4069. for (var i = this.length - 1; !result && i >= 0; --i) {
  4070. result = this[i](a, b);
  4071. }
  4072. return result;
  4073. }
  4074. });
  4075. /** @expose */
  4076. com_ibm_rave_core_interpolate_Interpolators.INSTANCE = new com_ibm_rave_core_interpolate_Interpolators();
  4077. // $source: com/ibm/rave/core/color/Color
  4078. /************************************************************************
  4079. ** IBM Confidential
  4080. **
  4081. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4082. **
  4083. ** (C) Copyright IBM Corp. 2015
  4084. **
  4085. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4086. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4087. ************************************************************************/
  4088. // GENERATED
  4089. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4090. var com_ibm_rave_core_color_Color = rave_externs["Color"] = com_ibm_rave_core_nativeImpl_Declare({
  4091. /** @expose */
  4092. constructor : function() {},
  4093. /**
  4094. * Create a new RGB color object.
  4095. * @return (com.ibm.rave.core.color.RGB) RGB New RGB color
  4096. */
  4097. /** @expose */
  4098. rgb : function() {},
  4099. /**
  4100. * Return a color object that is one "level" brighter. The level of brightness is determined by the Color implementation.
  4101. * @return (com.ibm.rave.core.color.Color) Color New Color that is one level brighter than the calling Color.
  4102. */
  4103. brighter$0 : function() {
  4104. return this.brighter$1(1);
  4105. },
  4106. /**
  4107. * Return a color object that is one "level" darker. The level of darkness is determined by the Color implementation.
  4108. * @return (com.ibm.rave.core.color.Color) Color New Color that is one level darker than the calling Color.
  4109. */
  4110. darker$0 : function() {
  4111. return this.darker$1(1);
  4112. },
  4113. /**
  4114. * Return a string representation of this color. Typically returned as a string in the format "#rrggbb".
  4115. * @return (String) String representation in "#rrggbb" format.
  4116. */
  4117. /** @expose */
  4118. toString : function() {
  4119. return this.rgb().toString();
  4120. },
  4121. /** @expose */
  4122. brighter : function(a0) {
  4123. var args = arguments;
  4124. if (args.length == 0) {
  4125. return this.brighter$0();
  4126. }
  4127. return this.brighter$1(a0);
  4128. },
  4129. /** @expose */
  4130. darker : function(a0) {
  4131. var args = arguments;
  4132. if (args.length == 0) {
  4133. return this.darker$0();
  4134. }
  4135. return this.darker$1(a0);
  4136. },
  4137. /** @expose */
  4138. contrastShift : function(a0, a1) {
  4139. var args = arguments;
  4140. if (args.length == 0) {
  4141. return this.contrastShift$0();
  4142. }
  4143. if (args.length == 1 && (a0 == null || typeof a0 === "number")) {
  4144. return this.contrastShift$2(a0);
  4145. }
  4146. if (args.length == 1) {
  4147. return this.contrastShift$1(a0);
  4148. }
  4149. return this.contrastShift$3(a0, a1);
  4150. }
  4151. /**
  4152. * Return a color object that is "k" levels brighter than the current Color.
  4153. * @param (double) k Amount of brightness to apply to the current color.
  4154. * @return (com.ibm.rave.core.color.Color) New color that is "k" levels brighter than the current color.
  4155. */
  4156. //brighter$1 : function(k) {},
  4157. /**
  4158. * Return a color object that is "k" levels brighter than the current Color.
  4159. * @param (double) k Amount of brightness to apply to the current color.
  4160. * @return (com.ibm.rave.core.color.Color) New color that is "k" levels brighter than the current color.
  4161. */
  4162. //darker$1 : function(k) {},
  4163. /**
  4164. * Supplies a color that will contrast the color contained within the color object using the default ratio of 4.5
  4165. * @return (com.ibm.rave.core.color.Color) A contrasting color
  4166. */
  4167. //contrastShift$0 : function() {},
  4168. /**
  4169. * Supplies a color that will contrast the color passed into the api using the default ratio of 4.5 <p> The object could be one of the following: <ul> <li>LAB color</li> <li>RGB color</li> <li>HCL color</li> <li>A string which could be in one of the following formats: <ul> <li>RGB decimal - "rgb(255,255,255)"</li> <li>HSL decimal - "hsl(120,50%,20%)"</li> <li>RGB hexadecimal - "#ffeeaa"</li> <li>RGB shorthand hexadecimal - "#fea"</li> <li>named RGB- "red", "white", "blue"</li> </ul> </ul> If the object passed is none of the above,it will be coerced to a string (by calling toString() on it) and processed as such, and if the resulting string does not conform to any of the above formats, it will be considered as a string representation of RGB black color.
  4170. * @param (Object) color The color to be contrasted
  4171. * @return (com.ibm.rave.core.color.Color) A contrasting color
  4172. */
  4173. //contrastShift$1 : function(color) {},
  4174. /**
  4175. * Supplies a color that will contrast the color contained within the color object using the contrast ratio passed in
  4176. * @param (double) ratio The contrast ratio to obtain. May be a value from 1 - 21. If a value other outside of the range is passed in, the default ratio of 4.5 will be applied
  4177. * @return (com.ibm.rave.core.color.Color) A contrasting color
  4178. */
  4179. //contrastShift$2 : function(ratio) {},
  4180. /**
  4181. * Supplies a color that will contrast the color passed in against the color object using the contrast ratio passed in. <p> The object could be one of the following: <ul> <li>LAB color</li> <li>RGB color</li> <li>HCL color</li> <li>A string which could be in one of the following formats: <ul> <li>RGB decimal - "rgb(255,255,255)"</li> <li>HSL decimal - "hsl(120,50%,20%)"</li> <li>RGB hexadecimal - "#ffeeaa"</li> <li>RGB shorthand hexadecimal - "#fea"</li> <li>named RGB- "red", "white", "blue"</li> </ul> </ul> If the object passed is none of the above,it will be coerced to a string (by calling toString() on it) and processed as such, and if the resulting string does not conform to any of the above formats, it will be considered as a string representation of RGB black color.
  4182. * @param (Object) color The color to be contrasted
  4183. * @param (double) ratio The contrast ratio to obtain. May be a value from 1 - 21. If a value other outside of the range is passed in, the default ratio of 4.5 will be applied
  4184. * @return (com.ibm.rave.core.color.Color) A contrasting color
  4185. */
  4186. //contrastShift$3 : function(color, ratio) {}
  4187. });
  4188. // $source: com/ibm/rave/core/color/HSL
  4189. /************************************************************************
  4190. ** IBM Confidential
  4191. **
  4192. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4193. **
  4194. ** (C) Copyright IBM Corp. 2015
  4195. **
  4196. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4197. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4198. ************************************************************************/
  4199. // GENERATED
  4200. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4201. //@import com/ibm/rave/core/color/Color (loadtime) // superclass
  4202. //@import com/ibm/rave/core/color/Colors (runtime) // newRGB, hsl_rgb
  4203. //@import com/ibm/rave/core/internal/color/ContrastShift (runtime) // updateColor
  4204. /**
  4205. * An object representing HSL (hue-saturation-lightness) color which is basically a cylindrical-coordinate representations of points in an RGB color model. Hue is a degree on the color wheel; 0 (or 360) is red, 120 is green, 240 is blue. Numbers in between reflect different shades. Saturation is a percentage value; 100% is the full color. Lightness is also a percentage; 0% is dark (black), 100% is light (white), and 50% is the average.
  4206. */
  4207. var com_ibm_rave_core_color_HSL = rave_externs["HSL"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_color_Color, {
  4208. /**
  4209. * @expose
  4210. */
  4211. h : 0,
  4212. /**
  4213. * @expose
  4214. */
  4215. s : 0,
  4216. /**
  4217. * @expose
  4218. */
  4219. l : 0,
  4220. constructor : function(h, s, l) {
  4221. this.h = + (h);
  4222. this.s = + (s);
  4223. this.l = + (l);
  4224. },
  4225. /** @expose */
  4226. rgb : function() {
  4227. return com_ibm_rave_core_color_Colors.hsl_rgb(this.h, this.s, this.l);
  4228. },
  4229. /** @expose */
  4230. brighter$1 : function(k) {
  4231. k = Math.pow(0.7, k);
  4232. return new com_ibm_rave_core_color_HSL(this.h, this.s, this.l / k);
  4233. },
  4234. /** @expose */
  4235. darker$1 : function(k) {
  4236. k = Math.pow(0.7, k);
  4237. return new com_ibm_rave_core_color_HSL(this.h, this.s, k * this.l);
  4238. },
  4239. /**
  4240. * A getter for the hue value
  4241. * @return (double) the hue value
  4242. */
  4243. /** @expose */
  4244. getH : function() {
  4245. return this.h;
  4246. },
  4247. /**
  4248. * A getter for the saturation value
  4249. * @return (double) the saturation value
  4250. */
  4251. /** @expose */
  4252. getS : function() {
  4253. return this.s;
  4254. },
  4255. /**
  4256. * A getter for the lightness value
  4257. * @return (double) the lightness value
  4258. */
  4259. /** @expose */
  4260. getL : function() {
  4261. return this.l;
  4262. },
  4263. contrastShift$0 : function() {
  4264. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$0(this.rgb(), this.rgb()).hsl();
  4265. },
  4266. contrastShift$1 : function(color) {
  4267. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$0(this.rgb(), com_ibm_rave_core_color_Colors.newRGB(color)).hsl();
  4268. },
  4269. contrastShift$2 : function(ratio) {
  4270. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$1(this.rgb(), this.rgb(), ratio).hsl();
  4271. },
  4272. contrastShift$3 : function(color, ratio) {
  4273. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$1(this.rgb(), com_ibm_rave_core_color_Colors.newRGB(color), ratio).hsl();
  4274. },
  4275. /** @expose */
  4276. contrastShift : function(a0, a1) {
  4277. var args = arguments;
  4278. if (args.length == 0) {
  4279. return this.contrastShift$0();
  4280. }
  4281. if (args.length == 1 && (a0 == null || typeof a0 === "number")) {
  4282. return this.contrastShift$2(a0);
  4283. }
  4284. if (args.length == 1) {
  4285. return this.contrastShift$1(a0);
  4286. }
  4287. return this.contrastShift$3(a0, a1);
  4288. }
  4289. });
  4290. // $source: com/ibm/rave/core/color/RGB
  4291. /************************************************************************
  4292. ** IBM Confidential
  4293. **
  4294. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4295. **
  4296. ** (C) Copyright IBM Corp. 2015
  4297. **
  4298. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4299. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4300. ************************************************************************/
  4301. // GENERATED
  4302. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4303. //@import com/ibm/rave/core/color/Color (loadtime) // superclass
  4304. //@import com/ibm/rave/core/color/Colors (runtime) // rgb_hex, rgb_lab, newRGB, rgb_hsl
  4305. //@import com/ibm/rave/core/internal/color/ContrastShift (runtime) // updateColor
  4306. /**
  4307. * A class representing the RGB color model is an additive color model in which red, green, and blue light are added together in various ways to reproduce a broad array of colors. In addition, it supports a constant alpha value of 1.0
  4308. */
  4309. var com_ibm_rave_core_color_RGB = rave_externs["RGB"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_color_Color, {
  4310. /**
  4311. * @expose
  4312. */
  4313. r : 0,
  4314. /**
  4315. * @expose
  4316. */
  4317. g : 0,
  4318. /**
  4319. * @expose
  4320. */
  4321. b : 0,
  4322. /**
  4323. * @expose
  4324. */
  4325. a : 0,
  4326. constructor : function(r, g, b, a) {
  4327. this.r = ~~r;
  4328. this.g = ~~g;
  4329. this.b = ~~b;
  4330. this.a = a;
  4331. },
  4332. /** @expose */
  4333. rgb : function() {
  4334. return this;
  4335. },
  4336. /** @expose */
  4337. hsl : function() {
  4338. return com_ibm_rave_core_color_Colors.rgb_hsl(this.r, this.g, this.b);
  4339. },
  4340. lab : function() {
  4341. return com_ibm_rave_core_color_Colors.rgb_lab(this.r, this.g, this.b);
  4342. },
  4343. /** @expose */
  4344. brighter$1 : function(k) {
  4345. var r = this.r, g = this.g, b = this.b, i = 30;
  4346. if (r == 0 && g == 0 && b == 0) {
  4347. return new com_ibm_rave_core_color_RGB(i, i, i, this.a);
  4348. }
  4349. if (r != 0 && r < i) {
  4350. r = i;
  4351. }
  4352. if (g != 0 && g < i) {
  4353. g = i;
  4354. }
  4355. if (b != 0 && b < i) {
  4356. b = i;
  4357. }
  4358. k = Math.pow(0.7, k);
  4359. return new com_ibm_rave_core_color_RGB(~~Math.min(255, r / k), ~~Math.min(255, g / k), ~~Math.min(255, b / k), this.a);
  4360. },
  4361. /** @expose */
  4362. darker$1 : function(k) {
  4363. k = Math.pow(0.7, k);
  4364. return new com_ibm_rave_core_color_RGB(~~(k * this.r), ~~(k * this.g), ~~(k * this.b), this.a);
  4365. },
  4366. /** @expose */
  4367. toString : function() {
  4368. return "#" + com_ibm_rave_core_color_Colors.rgb_hex(this.r) + com_ibm_rave_core_color_Colors.rgb_hex(this.g) + com_ibm_rave_core_color_Colors.rgb_hex(this.b);
  4369. },
  4370. /**
  4371. * A getter for the R-channel (red)
  4372. * @return (int) the R-channel value
  4373. */
  4374. /** @expose */
  4375. getR : function() {
  4376. return this.r;
  4377. },
  4378. /**
  4379. * A getter for the G-channel (green) value
  4380. * @return (int) the G-channel value
  4381. */
  4382. /** @expose */
  4383. getG : function() {
  4384. return this.g;
  4385. },
  4386. /**
  4387. * A getter for the B-channel (blue) value
  4388. * @return (int) the B-channel value
  4389. */
  4390. /** @expose */
  4391. getB : function() {
  4392. return this.b;
  4393. },
  4394. /**
  4395. * A getter for the A-channel (alpha channel for opacity) value
  4396. * @return (double) the A-channel value
  4397. */
  4398. /** @expose */
  4399. getA : function() {
  4400. return this.a;
  4401. },
  4402. contrastShift$0 : function() {
  4403. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$0(this.rgb(), this.rgb());
  4404. },
  4405. contrastShift$1 : function(color) {
  4406. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$0(this.rgb(), com_ibm_rave_core_color_Colors.newRGB(color));
  4407. },
  4408. contrastShift$2 : function(ratio) {
  4409. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$1(this.rgb(), this.rgb(), ratio);
  4410. },
  4411. contrastShift$3 : function(color, ratio) {
  4412. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$1(this.rgb(), com_ibm_rave_core_color_Colors.newRGB(color), ratio);
  4413. },
  4414. /** @expose */
  4415. contrastShift : function(a0, a1) {
  4416. var args = arguments;
  4417. if (args.length == 0) {
  4418. return this.contrastShift$0();
  4419. }
  4420. if (args.length == 1 && (a0 == null || typeof a0 === "number")) {
  4421. return this.contrastShift$2(a0);
  4422. }
  4423. if (args.length == 1) {
  4424. return this.contrastShift$1(a0);
  4425. }
  4426. return this.contrastShift$3(a0, a1);
  4427. }
  4428. });
  4429. // $source: com/ibm/rave/core/color/RGBA
  4430. /************************************************************************
  4431. ** IBM Confidential
  4432. **
  4433. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4434. **
  4435. ** (C) Copyright IBM Corp. 2015
  4436. **
  4437. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4438. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4439. ************************************************************************/
  4440. // GENERATED
  4441. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4442. //@import com/ibm/rave/core/color/RGB (loadtime) // superclass
  4443. /**
  4444. * An RGB representation of a color with an alpha value from 0-1.
  4445. */
  4446. var com_ibm_rave_core_color_RGBA = rave_externs["RGBA"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_color_RGB, {
  4447. /** @expose */
  4448. toString : function() {
  4449. return "rgba(" + this.r + "," + this.g + "," + this.b + "," + this.a + ")";
  4450. }
  4451. //constructor : function(r, g, b, a) {}
  4452. });
  4453. // $source: com/ibm/rave/core/color/LAB
  4454. /************************************************************************
  4455. ** IBM Confidential
  4456. **
  4457. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4458. **
  4459. ** (C) Copyright IBM Corp. 2015
  4460. **
  4461. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4462. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4463. ************************************************************************/
  4464. // GENERATED
  4465. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4466. //@import com/ibm/rave/core/color/Color (loadtime) // superclass
  4467. //@import com/ibm/rave/core/color/Colors (runtime) // Colors, lab_rgb, newRGB, lab_hcl
  4468. //@import com/ibm/rave/core/internal/color/ContrastShift (runtime) // updateColor
  4469. /**
  4470. * The LAB color model is a three axis color system and LAB colors are absolute, meaning that the color is exact. It’s what’s known as device independent; meaning that the LAB color space is the only way to communicate different colors across different devices. LAB color is a three axis system. The first axis, the L-channel or Lightness, goes up and down the 3D color model and it consists of white to black – and all of your gray colors will be exactly right down the center. All neutral colors will be relatively in the center of this axis. The A axis, goes from cyan color across to magenta/red color. And the B axis goes from blue to yellow.
  4471. */
  4472. var com_ibm_rave_core_color_LAB = rave_externs["LAB"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_color_Color, {
  4473. /**
  4474. * @expose
  4475. */
  4476. l : 0,
  4477. /**
  4478. * @expose
  4479. */
  4480. a : 0,
  4481. /**
  4482. * @expose
  4483. */
  4484. b : 0,
  4485. constructor : function(l, a, b) {
  4486. this.l = + (l);
  4487. this.a = + (a);
  4488. this.b = + (b);
  4489. },
  4490. /** @expose */
  4491. rgb : function() {
  4492. return com_ibm_rave_core_color_Colors.lab_rgb(this.l, this.a, this.b);
  4493. },
  4494. /** @expose */
  4495. brighter$1 : function(k) {
  4496. return new com_ibm_rave_core_color_LAB(Math.min(100, this.l + com_ibm_rave_core_color_Colors.lab_K * (k)), this.a, this.b);
  4497. },
  4498. /** @expose */
  4499. darker$1 : function(k) {
  4500. return new com_ibm_rave_core_color_LAB(Math.max(0, this.l - com_ibm_rave_core_color_Colors.lab_K * (k)), this.a, this.b);
  4501. },
  4502. hcl : function() {
  4503. return com_ibm_rave_core_color_Colors.lab_hcl(this.l, this.a, this.b);
  4504. },
  4505. /**
  4506. * A getter for the L-channel/Lightness value
  4507. * @return (double) the L-channel value
  4508. */
  4509. /** @expose */
  4510. getL : function() {
  4511. return this.l;
  4512. },
  4513. /**
  4514. * A getter for the A-channel value
  4515. * @return (double) the A-channel value
  4516. */
  4517. /** @expose */
  4518. getA : function() {
  4519. return this.a;
  4520. },
  4521. /**
  4522. * A getter for the B-channel value
  4523. * @return (double) the B-channel value
  4524. */
  4525. /** @expose */
  4526. getB : function() {
  4527. return this.b;
  4528. },
  4529. contrastShift$0 : function() {
  4530. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$0(this.rgb(), this.rgb()).lab();
  4531. },
  4532. contrastShift$1 : function(color) {
  4533. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$0(this.rgb(), com_ibm_rave_core_color_Colors.newRGB(color)).lab();
  4534. },
  4535. contrastShift$2 : function(ratio) {
  4536. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$1(this.rgb(), this.rgb(), ratio).lab();
  4537. },
  4538. contrastShift$3 : function(color, ratio) {
  4539. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$1(this.rgb(), com_ibm_rave_core_color_Colors.newRGB(color), ratio).lab();
  4540. },
  4541. /** @expose */
  4542. contrastShift : function(a0, a1) {
  4543. var args = arguments;
  4544. if (args.length == 0) {
  4545. return this.contrastShift$0();
  4546. }
  4547. if (args.length == 1 && (a0 == null || typeof a0 === "number")) {
  4548. return this.contrastShift$2(a0);
  4549. }
  4550. if (args.length == 1) {
  4551. return this.contrastShift$1(a0);
  4552. }
  4553. return this.contrastShift$3(a0, a1);
  4554. }
  4555. });
  4556. // $source: com/ibm/rave/core/color/HCL
  4557. /************************************************************************
  4558. ** IBM Confidential
  4559. **
  4560. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4561. **
  4562. ** (C) Copyright IBM Corp. 2015
  4563. **
  4564. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4565. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4566. ************************************************************************/
  4567. // GENERATED
  4568. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4569. //@import com/ibm/rave/core/color/Color (loadtime) // superclass
  4570. //@import com/ibm/rave/core/color/Colors (runtime) // Colors, newRGB, hcl_lab
  4571. //@import com/ibm/rave/core/internal/color/ContrastShift (runtime) // updateColor
  4572. /**
  4573. * The Hue-Chroma-Luminance (HCL) color space is basically the cylindrical version of LUV color space. It is based on how the human eye perceives colors, where perceived difference between two colors is proportional to their Euclidean distance in color space. This special property, called perceptual uniformity, makes them ideal for accurate visual encoding of data.
  4574. */
  4575. var com_ibm_rave_core_color_HCL = rave_externs["HCL"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_color_Color, {
  4576. /**
  4577. * @expose
  4578. */
  4579. h : 0,
  4580. /**
  4581. * @expose
  4582. */
  4583. c : 0,
  4584. /**
  4585. * @expose
  4586. */
  4587. l : 0,
  4588. constructor : function(h, c, l) {
  4589. this.h = + (h);
  4590. this.c = + (c);
  4591. this.l = + (l);
  4592. },
  4593. /** @expose */
  4594. rgb : function() {
  4595. return this.lab().rgb();
  4596. },
  4597. /** @expose */
  4598. brighter$1 : function(k) {
  4599. return new com_ibm_rave_core_color_HCL(this.h, this.c, Math.min(100, this.l + com_ibm_rave_core_color_Colors.lab_K * (k)));
  4600. },
  4601. /** @expose */
  4602. darker$1 : function(k) {
  4603. return new com_ibm_rave_core_color_HCL(this.h, this.c, Math.max(0, this.l - com_ibm_rave_core_color_Colors.lab_K * (k)));
  4604. },
  4605. lab : function() {
  4606. return com_ibm_rave_core_color_Colors.hcl_lab(this.h, this.c, this.l);
  4607. },
  4608. /**
  4609. * A getter for the hue value
  4610. * @return (double) the hue value
  4611. */
  4612. /** @expose */
  4613. getH : function() {
  4614. return this.h;
  4615. },
  4616. /**
  4617. * A getter for the chroma value
  4618. * @return (double) the chroma value
  4619. */
  4620. /** @expose */
  4621. getC : function() {
  4622. return this.c;
  4623. },
  4624. /**
  4625. * A getter for the luminance value
  4626. * @return (double) the luminance value
  4627. */
  4628. /** @expose */
  4629. getL : function() {
  4630. return this.l;
  4631. },
  4632. contrastShift$0 : function() {
  4633. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$0(this.rgb(), this.rgb()).lab().hcl();
  4634. },
  4635. contrastShift$1 : function(color) {
  4636. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$0(this.rgb(), com_ibm_rave_core_color_Colors.newRGB(color)).lab().hcl();
  4637. },
  4638. contrastShift$2 : function(ratio) {
  4639. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$1(this.rgb(), this.rgb(), ratio).lab().hcl();
  4640. },
  4641. contrastShift$3 : function(color, ratio) {
  4642. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$1(this.rgb(), com_ibm_rave_core_color_Colors.newRGB(color), ratio).lab().hcl();
  4643. },
  4644. /** @expose */
  4645. contrastShift : function(a0, a1) {
  4646. var args = arguments;
  4647. if (args.length == 0) {
  4648. return this.contrastShift$0();
  4649. }
  4650. if (args.length == 1 && (a0 == null || typeof a0 === "number")) {
  4651. return this.contrastShift$2(a0);
  4652. }
  4653. if (args.length == 1) {
  4654. return this.contrastShift$1(a0);
  4655. }
  4656. return this.contrastShift$3(a0, a1);
  4657. }
  4658. });
  4659. // $source: com/ibm/rave/core/color/Colors
  4660. /************************************************************************
  4661. ** IBM Confidential
  4662. **
  4663. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4664. **
  4665. ** (C) Copyright IBM Corp. 2015
  4666. **
  4667. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4668. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4669. ************************************************************************/
  4670. // GENERATED
  4671. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4672. //@import com/ibm/rave/core/color/HSL (static) // new
  4673. //@import com/ibm/rave/core/color/RGB (static) // new
  4674. //@import com/ibm/rave/core/color/RGBA (static) // new
  4675. //@import com/ibm/rave/core/color/LAB (static) // new
  4676. //@import com/ibm/rave/core/color/HCL (static) // new
  4677. //@import com/ibm/rave/core/color/Color (static) // new
  4678. /**
  4679. * A utility class with methods needed to create and different Color objects in different color spaces
  4680. */
  4681. var com_ibm_rave_core_color_Colors = com_ibm_rave_core_nativeImpl_Declare({
  4682. //constructor : function() {}
  4683. });
  4684. com_ibm_rave_core_color_Colors.initialize_rgb_names = function() {
  4685. var rgb_names = {};
  4686. rgb_names["aliceblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0xf0f8ff);
  4687. rgb_names["antiquewhite"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfaebd7);
  4688. rgb_names["aqua"] = com_ibm_rave_core_color_Colors.rgbNumber(0x00ffff);
  4689. rgb_names["aquamarine"] = com_ibm_rave_core_color_Colors.rgbNumber(0x7fffd4);
  4690. rgb_names["azure"] = com_ibm_rave_core_color_Colors.rgbNumber(0xf0ffff);
  4691. rgb_names["beige"] = com_ibm_rave_core_color_Colors.rgbNumber(0xf5f5dc);
  4692. rgb_names["bisque"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffe4c4);
  4693. rgb_names["black"] = com_ibm_rave_core_color_Colors.rgbNumber(0x000000);
  4694. rgb_names["blanchedalmond"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffebcd);
  4695. rgb_names["blue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x0000ff);
  4696. rgb_names["blueviolet"] = com_ibm_rave_core_color_Colors.rgbNumber(0x8a2be2);
  4697. rgb_names["brown"] = com_ibm_rave_core_color_Colors.rgbNumber(0xa52a2a);
  4698. rgb_names["burlywood"] = com_ibm_rave_core_color_Colors.rgbNumber(0xdeb887);
  4699. rgb_names["cadetblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x5f9ea0);
  4700. rgb_names["chartreuse"] = com_ibm_rave_core_color_Colors.rgbNumber(0x7fff00);
  4701. rgb_names["chocolate"] = com_ibm_rave_core_color_Colors.rgbNumber(0xd2691e);
  4702. rgb_names["coral"] = com_ibm_rave_core_color_Colors.rgbNumber(0xff7f50);
  4703. rgb_names["cornflowerblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x6495ed);
  4704. rgb_names["cornsilk"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfff8dc);
  4705. rgb_names["crimson"] = com_ibm_rave_core_color_Colors.rgbNumber(0xdc143c);
  4706. rgb_names["cyan"] = com_ibm_rave_core_color_Colors.rgbNumber(0x00ffff);
  4707. rgb_names["darkblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x00008b);
  4708. rgb_names["darkcyan"] = com_ibm_rave_core_color_Colors.rgbNumber(0x008b8b);
  4709. rgb_names["darkgoldenrod"] = com_ibm_rave_core_color_Colors.rgbNumber(0xb8860b);
  4710. rgb_names["darkgray"] = com_ibm_rave_core_color_Colors.rgbNumber(0xa9a9a9);
  4711. rgb_names["darkgreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x006400);
  4712. rgb_names["darkgrey"] = com_ibm_rave_core_color_Colors.rgbNumber(0xa9a9a9);
  4713. rgb_names["darkkhaki"] = com_ibm_rave_core_color_Colors.rgbNumber(0xbdb76b);
  4714. rgb_names["darkolivegreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x556b2f);
  4715. rgb_names["darkorange"] = com_ibm_rave_core_color_Colors.rgbNumber(0xff8c00);
  4716. rgb_names["darkorchid"] = com_ibm_rave_core_color_Colors.rgbNumber(0x9932cc);
  4717. rgb_names["darkred"] = com_ibm_rave_core_color_Colors.rgbNumber(0x8b0000);
  4718. rgb_names["darksalmon"] = com_ibm_rave_core_color_Colors.rgbNumber(0xe9967a);
  4719. rgb_names["darkseagreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x8fbc8f);
  4720. rgb_names["darkslateblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x483d8b);
  4721. rgb_names["darkslategray"] = com_ibm_rave_core_color_Colors.rgbNumber(0x2f4f4f);
  4722. rgb_names["darkslategrey"] = com_ibm_rave_core_color_Colors.rgbNumber(0x2f4f4f);
  4723. rgb_names["darkturquoise"] = com_ibm_rave_core_color_Colors.rgbNumber(0x00ced1);
  4724. rgb_names["darkviolet"] = com_ibm_rave_core_color_Colors.rgbNumber(0x9400d3);
  4725. rgb_names["deeppink"] = com_ibm_rave_core_color_Colors.rgbNumber(0xff1493);
  4726. rgb_names["deepskyblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x00bfff);
  4727. rgb_names["dimgray"] = com_ibm_rave_core_color_Colors.rgbNumber(0x696969);
  4728. rgb_names["dimgrey"] = com_ibm_rave_core_color_Colors.rgbNumber(0x696969);
  4729. rgb_names["dodgerblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x1e90ff);
  4730. rgb_names["firebrick"] = com_ibm_rave_core_color_Colors.rgbNumber(0xb22222);
  4731. rgb_names["floralwhite"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfffaf0);
  4732. rgb_names["forestgreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x228b22);
  4733. rgb_names["fuchsia"] = com_ibm_rave_core_color_Colors.rgbNumber(0xff00ff);
  4734. rgb_names["gainsboro"] = com_ibm_rave_core_color_Colors.rgbNumber(0xdcdcdc);
  4735. rgb_names["ghostwhite"] = com_ibm_rave_core_color_Colors.rgbNumber(0xf8f8ff);
  4736. rgb_names["gold"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffd700);
  4737. rgb_names["goldenrod"] = com_ibm_rave_core_color_Colors.rgbNumber(0xdaa520);
  4738. rgb_names["gray"] = com_ibm_rave_core_color_Colors.rgbNumber(0x808080);
  4739. rgb_names["green"] = com_ibm_rave_core_color_Colors.rgbNumber(0x008000);
  4740. rgb_names["greenyellow"] = com_ibm_rave_core_color_Colors.rgbNumber(0xadff2f);
  4741. rgb_names["grey"] = com_ibm_rave_core_color_Colors.rgbNumber(0x808080);
  4742. rgb_names["honeydew"] = com_ibm_rave_core_color_Colors.rgbNumber(0xf0fff0);
  4743. rgb_names["hotpink"] = com_ibm_rave_core_color_Colors.rgbNumber(0xff69b4);
  4744. rgb_names["indianred"] = com_ibm_rave_core_color_Colors.rgbNumber(0xcd5c5c);
  4745. rgb_names["indigo"] = com_ibm_rave_core_color_Colors.rgbNumber(0x4b0082);
  4746. rgb_names["ivory"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfffff0);
  4747. rgb_names["khaki"] = com_ibm_rave_core_color_Colors.rgbNumber(0xf0e68c);
  4748. rgb_names["lavender"] = com_ibm_rave_core_color_Colors.rgbNumber(0xe6e6fa);
  4749. rgb_names["lavenderblush"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfff0f5);
  4750. rgb_names["lawngreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x7cfc00);
  4751. rgb_names["lemonchiffon"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfffacd);
  4752. rgb_names["lightblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0xadd8e6);
  4753. rgb_names["lightcoral"] = com_ibm_rave_core_color_Colors.rgbNumber(0xf08080);
  4754. rgb_names["lightcyan"] = com_ibm_rave_core_color_Colors.rgbNumber(0xe0ffff);
  4755. rgb_names["lightgoldenrodyellow"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfafad2);
  4756. rgb_names["lightgray"] = com_ibm_rave_core_color_Colors.rgbNumber(0xd3d3d3);
  4757. rgb_names["lightgreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x90ee90);
  4758. rgb_names["lightgrey"] = com_ibm_rave_core_color_Colors.rgbNumber(0xd3d3d3);
  4759. rgb_names["lightpink"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffb6c1);
  4760. rgb_names["lightsalmon"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffa07a);
  4761. rgb_names["lightseagreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x20b2aa);
  4762. rgb_names["lightskyblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x87cefa);
  4763. rgb_names["lightslategray"] = com_ibm_rave_core_color_Colors.rgbNumber(0x778899);
  4764. rgb_names["lightslategrey"] = com_ibm_rave_core_color_Colors.rgbNumber(0x778899);
  4765. rgb_names["lightsteelblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0xb0c4de);
  4766. rgb_names["lightyellow"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffffe0);
  4767. rgb_names["lime"] = com_ibm_rave_core_color_Colors.rgbNumber(0x00ff00);
  4768. rgb_names["limegreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x32cd32);
  4769. rgb_names["linen"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfaf0e6);
  4770. rgb_names["magenta"] = com_ibm_rave_core_color_Colors.rgbNumber(0xff00ff);
  4771. rgb_names["maroon"] = com_ibm_rave_core_color_Colors.rgbNumber(0x800000);
  4772. rgb_names["mediumaquamarine"] = com_ibm_rave_core_color_Colors.rgbNumber(0x66cdaa);
  4773. rgb_names["mediumblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x0000cd);
  4774. rgb_names["mediumorchid"] = com_ibm_rave_core_color_Colors.rgbNumber(0xba55d3);
  4775. rgb_names["mediumpurple"] = com_ibm_rave_core_color_Colors.rgbNumber(0x9370db);
  4776. rgb_names["mediumseagreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x3cb371);
  4777. rgb_names["mediumslateblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x7b68ee);
  4778. rgb_names["mediumspringgreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x00fa9a);
  4779. rgb_names["mediumturquoise"] = com_ibm_rave_core_color_Colors.rgbNumber(0x48d1cc);
  4780. rgb_names["mediumvioletred"] = com_ibm_rave_core_color_Colors.rgbNumber(0xc71585);
  4781. rgb_names["midnightblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x191970);
  4782. rgb_names["mintcream"] = com_ibm_rave_core_color_Colors.rgbNumber(0xf5fffa);
  4783. rgb_names["mistyrose"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffe4e1);
  4784. rgb_names["moccasin"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffe4b5);
  4785. rgb_names["navajowhite"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffdead);
  4786. rgb_names["navy"] = com_ibm_rave_core_color_Colors.rgbNumber(0x000080);
  4787. rgb_names["oldlace"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfdf5e6);
  4788. rgb_names["olive"] = com_ibm_rave_core_color_Colors.rgbNumber(0x808000);
  4789. rgb_names["olivedrab"] = com_ibm_rave_core_color_Colors.rgbNumber(0x6b8e23);
  4790. rgb_names["orange"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffa500);
  4791. rgb_names["orangered"] = com_ibm_rave_core_color_Colors.rgbNumber(0xff4500);
  4792. rgb_names["orchid"] = com_ibm_rave_core_color_Colors.rgbNumber(0xda70d6);
  4793. rgb_names["palegoldenrod"] = com_ibm_rave_core_color_Colors.rgbNumber(0xeee8aa);
  4794. rgb_names["palegreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x98fb98);
  4795. rgb_names["paleturquoise"] = com_ibm_rave_core_color_Colors.rgbNumber(0xafeeee);
  4796. rgb_names["palevioletred"] = com_ibm_rave_core_color_Colors.rgbNumber(0xdb7093);
  4797. rgb_names["papayawhip"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffefd5);
  4798. rgb_names["peachpuff"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffdab9);
  4799. rgb_names["peru"] = com_ibm_rave_core_color_Colors.rgbNumber(0xcd853f);
  4800. rgb_names["pink"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffc0cb);
  4801. rgb_names["plum"] = com_ibm_rave_core_color_Colors.rgbNumber(0xdda0dd);
  4802. rgb_names["powderblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0xb0e0e6);
  4803. rgb_names["purple"] = com_ibm_rave_core_color_Colors.rgbNumber(0x800080);
  4804. rgb_names["rebeccapurple"] = com_ibm_rave_core_color_Colors.rgbNumber(0x663399);
  4805. rgb_names["red"] = com_ibm_rave_core_color_Colors.rgbNumber(0xff0000);
  4806. rgb_names["rosybrown"] = com_ibm_rave_core_color_Colors.rgbNumber(0xbc8f8f);
  4807. rgb_names["royalblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x4169e1);
  4808. rgb_names["saddlebrown"] = com_ibm_rave_core_color_Colors.rgbNumber(0x8b4513);
  4809. rgb_names["salmon"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfa8072);
  4810. rgb_names["sandybrown"] = com_ibm_rave_core_color_Colors.rgbNumber(0xf4a460);
  4811. rgb_names["seagreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x2e8b57);
  4812. rgb_names["seashell"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfff5ee);
  4813. rgb_names["sienna"] = com_ibm_rave_core_color_Colors.rgbNumber(0xa0522d);
  4814. rgb_names["silver"] = com_ibm_rave_core_color_Colors.rgbNumber(0xc0c0c0);
  4815. rgb_names["skyblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x87ceeb);
  4816. rgb_names["slateblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x6a5acd);
  4817. rgb_names["slategray"] = com_ibm_rave_core_color_Colors.rgbNumber(0x708090);
  4818. rgb_names["slategrey"] = com_ibm_rave_core_color_Colors.rgbNumber(0x708090);
  4819. rgb_names["snow"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfffafa);
  4820. rgb_names["springgreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x00ff7f);
  4821. rgb_names["steelblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x4682b4);
  4822. rgb_names["tan"] = com_ibm_rave_core_color_Colors.rgbNumber(0xd2b48c);
  4823. rgb_names["teal"] = com_ibm_rave_core_color_Colors.rgbNumber(0x008080);
  4824. rgb_names["thistle"] = com_ibm_rave_core_color_Colors.rgbNumber(0xd8bfd8);
  4825. rgb_names["tomato"] = com_ibm_rave_core_color_Colors.rgbNumber(0xff6347);
  4826. rgb_names["turquoise"] = com_ibm_rave_core_color_Colors.rgbNumber(0x40e0d0);
  4827. rgb_names["violet"] = com_ibm_rave_core_color_Colors.rgbNumber(0xee82ee);
  4828. rgb_names["wheat"] = com_ibm_rave_core_color_Colors.rgbNumber(0xf5deb3);
  4829. rgb_names["white"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffffff);
  4830. rgb_names["whitesmoke"] = com_ibm_rave_core_color_Colors.rgbNumber(0xf5f5f5);
  4831. rgb_names["yellow"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffff00);
  4832. rgb_names["yellowgreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x9acd32);
  4833. return rgb_names;
  4834. };
  4835. com_ibm_rave_core_color_Colors.rgb_hsl = function(r, g, b) {
  4836. var min = Math.min(Math.min(r /= 255, g /= 255), b /= 255);
  4837. var max = Math.max(Math.max(r, g), b);
  4838. var d = max - min;
  4839. var h, s;
  4840. var l = (max + min) / 2;
  4841. if (d != 0) {
  4842. s = l < .5 ? d / (max + min) : d / (2 - max - min);
  4843. if (r == max) {
  4844. h = (g - b) / d + (g < b ? 6 : 0);
  4845. } else if (g == max) {
  4846. h = (b - r) / d + 2;
  4847. } else {
  4848. h = (r - g) / d + 4;
  4849. }
  4850. h *= 60;
  4851. } else {
  4852. h = NaN;
  4853. s = l > 0 && l < 1 ? 0 : h;
  4854. }
  4855. return new com_ibm_rave_core_color_HSL(h, s, l);
  4856. };
  4857. /**
  4858. * Returns a hexadecimal string representation of an integer representing an RGB color specific channel (either r, g or b)
  4859. * @param (int) v the RGB component (r,g, or b) to get the hex string for
  4860. * @return (String) the hex string for the RGB channel
  4861. */
  4862. /** @expose */
  4863. com_ibm_rave_core_color_Colors.rgb_hex = function(v) {
  4864. if (v < 0) {
  4865. v = 0;
  4866. } else if (v > 255) {
  4867. v = 255;
  4868. }
  4869. return com_ibm_rave_core_color_Colors.hexDigits[(v >> 4) & 0x0f] + com_ibm_rave_core_color_Colors.hexDigits[v & 0x0f];
  4870. };
  4871. /**
  4872. * Create an RGB color from HSL color values
  4873. * @param (double) h the hue value
  4874. * @param (double) s the saturation value
  4875. * @param (double) l the lightness value
  4876. * @return (com.ibm.rave.core.color.RGB) the newly constructed RGB color
  4877. */
  4878. /** @expose */
  4879. com_ibm_rave_core_color_Colors.hsl_rgb = function(h, s, l) {
  4880. var m1, m2;
  4881. h = isNaN(h) ? 0 : (h %= 360) < 0 ? h + 360 : h;
  4882. s = isNaN(s) ? 0 : s < 0 ? 0 : s > 1 ? 1 : s;
  4883. l = l < 0 ? 0 : l > 1 ? 1 : l;
  4884. m2 = l <= .5 ? l * (1 + s) : l + s - l * s;
  4885. m1 = 2 * l - m2;
  4886. return new com_ibm_rave_core_color_RGB(Math.round(com_ibm_rave_core_color_Colors.normalizeHue(h + 120, m1, m2) * 255), Math.round(com_ibm_rave_core_color_Colors.normalizeHue(h, m1, m2) * 255), Math.round(com_ibm_rave_core_color_Colors.normalizeHue(h - 120, m1, m2) * 255), 1.0);
  4887. };
  4888. com_ibm_rave_core_color_Colors.normalizeHue = function(h, m1, m2) {
  4889. if (h > 360) {
  4890. h -= 360;
  4891. } else if (h < 0) {
  4892. h += 360;
  4893. }
  4894. if (h < 60) {
  4895. return m1 + (m2 - m1) * h / 60;
  4896. }
  4897. if (h < 180) {
  4898. return m2;
  4899. }
  4900. if (h < 240) {
  4901. return m1 + (m2 - m1) * (240 - h) / 60;
  4902. }
  4903. return m1;
  4904. };
  4905. com_ibm_rave_core_color_Colors.rgbNumber = function(value) {
  4906. return new com_ibm_rave_core_color_RGB(value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff, 1.0);
  4907. };
  4908. com_ibm_rave_core_color_Colors.rgbString = function(value) {
  4909. return com_ibm_rave_core_color_Colors.rgbNumber(value).toString();
  4910. };
  4911. com_ibm_rave_core_color_Colors.rgb_parseNumber = function(c) {
  4912. var d = parseFloat(c);
  4913. return c.charCodeAt(c.length - 1) == 37 ? Math.round(d * 2.55) : d;
  4914. };
  4915. com_ibm_rave_core_color_Colors.rgb_parse = function(format) {
  4916. if (format == null || format.length == 0) {
  4917. return new com_ibm_rave_core_color_RGB(0, 0, 0, 1.0);
  4918. }
  4919. var r = 0, g = 0, b = 0;
  4920. var m1;
  4921. var m2;
  4922. var color;
  4923. m1 = com_ibm_rave_core_color_Colors.REG_EXP.exec(format);
  4924. if (m1 && m1.length > 0) {
  4925. m2 = m1[2].split(",");
  4926. if ("hsl" == m1[1]) {
  4927. return new com_ibm_rave_core_color_HSL(parseFloat(m2[0]), parseFloat(m2[1].replace("%", "")) / 100, parseFloat(m2[2].replace("%", "")) / 100);
  4928. }
  4929. if ("rgba" == m1[1]) {
  4930. return new com_ibm_rave_core_color_RGBA(~~com_ibm_rave_core_color_Colors.rgb_parseNumber(m2[0]), ~~com_ibm_rave_core_color_Colors.rgb_parseNumber(m2[1]), ~~com_ibm_rave_core_color_Colors.rgb_parseNumber(m2[2]), ~~com_ibm_rave_core_color_Colors.rgb_parseNumber(m2[3]));
  4931. }
  4932. if ("rgb" == m1[1]) {
  4933. return new com_ibm_rave_core_color_RGB(~~com_ibm_rave_core_color_Colors.rgb_parseNumber(m2[0]), ~~com_ibm_rave_core_color_Colors.rgb_parseNumber(m2[1]), ~~com_ibm_rave_core_color_Colors.rgb_parseNumber(m2[2]), 1.0);
  4934. }
  4935. }
  4936. if ((format.charCodeAt(0) != 35) && (color = com_ibm_rave_core_color_Colors.rgb_names[format.toLowerCase()])) {
  4937. return new com_ibm_rave_core_color_RGB(color.r, color.g, color.b, 1.0);
  4938. }
  4939. var colorValue = 0;
  4940. if (format.charCodeAt(0) == 35 && !(isNaN(colorValue = parseInt(format.substring(1), 16)))) {
  4941. if (format.length == 4) {
  4942. r = (colorValue & 0xf00) >> 4;
  4943. r = (r >> 4) | r;
  4944. g = (colorValue & 0xf0);
  4945. g = (g >> 4) | g;
  4946. b = (colorValue & 0xf);
  4947. b = (b << 4) | b;
  4948. } else if (format.length == 7) {
  4949. r = (colorValue & 0xff0000) >> 16;
  4950. g = (colorValue & 0xff00) >> 8;
  4951. b = (colorValue & 0xff);
  4952. }
  4953. }
  4954. return new com_ibm_rave_core_color_RGB(r, g, b, 1.0);
  4955. };
  4956. com_ibm_rave_core_color_Colors.rgb_lab = function(r, g, b) {
  4957. r = com_ibm_rave_core_color_Colors.rgb_xyz(r);
  4958. g = com_ibm_rave_core_color_Colors.rgb_xyz(g);
  4959. b = com_ibm_rave_core_color_Colors.rgb_xyz(b);
  4960. var x = com_ibm_rave_core_color_Colors.xyz_lab((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / com_ibm_rave_core_color_Colors.lab_X);
  4961. var y = com_ibm_rave_core_color_Colors.xyz_lab((0.2126729 * r + 0.7151522 * g + 0.0721750 * b) / com_ibm_rave_core_color_Colors.lab_Y);
  4962. var z = com_ibm_rave_core_color_Colors.xyz_lab((0.0193339 * r + 0.1191920 * g + 0.9503041 * b) / com_ibm_rave_core_color_Colors.lab_Z);
  4963. return new com_ibm_rave_core_color_LAB(116 * y - 16, 500 * (x - y), 200 * (y - z));
  4964. };
  4965. /**
  4966. * Create an LAB color from HCL color values
  4967. * @param (double) h the hue value
  4968. * @param (double) c the chroma value
  4969. * @param (double) l the luminance value
  4970. * @return (com.ibm.rave.core.color.LAB) the newly constructed LAB color
  4971. */
  4972. /** @expose */
  4973. com_ibm_rave_core_color_Colors.hcl_lab = function(h, c, l) {
  4974. if (isNaN(h)) {
  4975. h = 0;
  4976. }
  4977. if (isNaN(c)) {
  4978. c = 0;
  4979. }
  4980. return new com_ibm_rave_core_color_LAB(l, Math.cos(h *= 0.017453292519943295) * c, Math.sin(h) * c);
  4981. };
  4982. com_ibm_rave_core_color_Colors.xyz_lab = function(x) {
  4983. return x > 0.008856 ? Math.pow(x, 1.0 / 3.0) : 7.787037 * x + 4.0 / 29.0;
  4984. };
  4985. com_ibm_rave_core_color_Colors.xyz_rgb = function(r) {
  4986. return Math.round(255 * (r <= 0.00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - 0.055));
  4987. };
  4988. com_ibm_rave_core_color_Colors.rgb_xyz = function(r) {
  4989. return (r /= 255) <= 0.04045 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4);
  4990. };
  4991. com_ibm_rave_core_color_Colors.lab_hcl = function(l, a, b) {
  4992. return (l > 0) ? new com_ibm_rave_core_color_HCL(Math.atan2(b, a) * 57.29577951308232, Math.sqrt(a * a + b * b), l) : new com_ibm_rave_core_color_HCL(NaN, NaN, l);
  4993. };
  4994. /**
  4995. * Create an RGB color from LAB color values
  4996. * @param (double) l the L-channel (Lightness) value
  4997. * @param (double) a the A-channel value
  4998. * @param (double) b the B-channel value
  4999. * @return (com.ibm.rave.core.color.RGB) the newly constructed RGB color
  5000. */
  5001. /** @expose */
  5002. com_ibm_rave_core_color_Colors.lab_rgb = function(l, a, b) {
  5003. var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200;
  5004. x = com_ibm_rave_core_color_Colors.lab_xyz(x) * com_ibm_rave_core_color_Colors.lab_X;
  5005. y = com_ibm_rave_core_color_Colors.lab_xyz(y) * com_ibm_rave_core_color_Colors.lab_Y;
  5006. z = com_ibm_rave_core_color_Colors.lab_xyz(z) * com_ibm_rave_core_color_Colors.lab_Z;
  5007. return new com_ibm_rave_core_color_RGB(~~com_ibm_rave_core_color_Colors.xyz_rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z), ~~com_ibm_rave_core_color_Colors.xyz_rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z), ~~com_ibm_rave_core_color_Colors.xyz_rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z), 1.0);
  5008. };
  5009. com_ibm_rave_core_color_Colors.lab_xyz = function(x) {
  5010. return x > 0.206893034 ? x * x * x : (x - 4.0 / 29.0) / 7.787037;
  5011. };
  5012. /**
  5013. * Creates an LAB color object from its basic channel values
  5014. * @param (double) l the L-channel (Lightness) value
  5015. * @param (double) a the A-channe value
  5016. * @param (double) b the B-channel value
  5017. * @return (com.ibm.rave.core.color.LAB) the newly constructed LAB color
  5018. */
  5019. com_ibm_rave_core_color_Colors.newLAB$0 = function(l, a, b) {
  5020. return new com_ibm_rave_core_color_LAB(l, a, b);
  5021. };
  5022. /**
  5023. * Creates an LAB color object from the passed object This object could be one of the following: - LAB color, in which case a clone of it would be returned - RGB color - HCL color - A string which could be in one of the following formats: - RGB decimal - "rgb(255,255,255)" - HSL decimal - "hsl(120,50%,20%)" - RGB hexadecimal - "#ffeeaa" - RGB shorthand hexadecimal - "#fea" - named RGB- "red", "white", "blue" * If the object passed is none of the above,it will be coerced to a string (by calling toString() on it) and processed as such, and if the resulting string does not conform to any of the above formats, it will be considered as a string representation of RGB black color
  5024. * @param (Object) color the object to use to create the LAB color object
  5025. * @return (com.ibm.rave.core.color.LAB) the newly constructed LAB color
  5026. */
  5027. com_ibm_rave_core_color_Colors.newLAB$1 = function(color) {
  5028. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(color, com_ibm_rave_core_color_LAB)) {
  5029. var lab = color;
  5030. return new com_ibm_rave_core_color_LAB(lab.l, lab.a, lab.b);
  5031. } else if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(color, com_ibm_rave_core_color_RGB)) {
  5032. return (color).lab();
  5033. } else if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(color, com_ibm_rave_core_color_HCL)) {
  5034. return (color).lab();
  5035. } else {
  5036. return com_ibm_rave_core_color_Colors.rgb_parse((color == null) ? "" : color.toString()).rgb().lab();
  5037. }
  5038. };
  5039. /**
  5040. * Creates an HCL color object from its basic channel values
  5041. * @param (double) h the hue value
  5042. * @param (double) c the chroma value
  5043. * @param (double) l the luminance value
  5044. * @return (com.ibm.rave.core.color.HCL) the newly constructed HCL color
  5045. */
  5046. com_ibm_rave_core_color_Colors.newHCL$0 = function(h, c, l) {
  5047. return new com_ibm_rave_core_color_HCL(h, c, l);
  5048. };
  5049. /**
  5050. * Creates an HCL color object from the passed object This object could be one of the following: - HCL color, in which case a clone of it would be returned - LAB color - A string which could be in one of the following formats: - RGB decimal - "rgb(255,255,255)" - HSL decimal - "hsl(120,50%,20%)" - RGB hexadecimal - "#ffeeaa" - RGB shorthand hexadecimal - "#fea" - named RGB- "red", "white", "blue" * If the object passed is none of the above,it will be coerced to a string (by calling toString() on it) and processed as such, and if the resulting string does not conform to any of the above formats, it will be considered as a string representation of RGB black color
  5051. * @param (Object) color the object to use to create the HCL color object
  5052. * @return (com.ibm.rave.core.color.HCL) the newly constructed HCL color
  5053. */
  5054. com_ibm_rave_core_color_Colors.newHCL$1 = function(color) {
  5055. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(color, com_ibm_rave_core_color_HCL)) {
  5056. var hcl = color;
  5057. return new com_ibm_rave_core_color_HCL(hcl.h, hcl.c, hcl.l);
  5058. } else if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(color, com_ibm_rave_core_color_LAB)) {
  5059. return (color).hcl();
  5060. } else {
  5061. return com_ibm_rave_core_color_Colors.rgb_parse((color == null) ? "" : color.toString()).rgb().lab().hcl();
  5062. }
  5063. };
  5064. /**
  5065. * Creates an HSL color object from its basic channel values
  5066. * @param (double) h the hue value
  5067. * @param (double) s the saturation value
  5068. * @param (double) l the lightness value
  5069. * @return (com.ibm.rave.core.color.HSL) the newly constructed HSL color
  5070. */
  5071. com_ibm_rave_core_color_Colors.newHSL$0 = function(h, s, l) {
  5072. return new com_ibm_rave_core_color_HSL(h, s, l);
  5073. };
  5074. /**
  5075. * Creates an HSL color object from the passed object This object could be one of the following: - HSL color, in which case a clone of it would be returned - RGB color - A string which could be in one of the following formats: - RGB decimal - "rgb(255,255,255)" - HSL decimal - "hsl(120,50%,20%)" - RGB hexadecimal - "#ffeeaa" - RGB shorthand hexadecimal - "#fea" - named RGB- "red", "white", "blue" * If the object passed is none of the above,it will be coerced to a string (by calling toString() on it) and processed as such, and if the resulting string does not conform to any of the above formats, it will be considered as a string representation of RGB black color
  5076. * @param (Object) color the object to use to create the HSL color object
  5077. * @return (com.ibm.rave.core.color.HSL) the newly constructed HSL color
  5078. */
  5079. com_ibm_rave_core_color_Colors.newHSL$1 = function(color) {
  5080. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(color, com_ibm_rave_core_color_HSL)) {
  5081. var hsl = color;
  5082. return new com_ibm_rave_core_color_HSL(hsl.h, hsl.s, hsl.l);
  5083. } else if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(color, com_ibm_rave_core_color_RGB)) {
  5084. return (color).hsl();
  5085. } else {
  5086. var c = com_ibm_rave_core_color_Colors.rgb_parse((color == null) ? "" : color.toString());
  5087. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(c, com_ibm_rave_core_color_HSL)) {
  5088. return c;
  5089. }
  5090. return (c).hsl();
  5091. }
  5092. };
  5093. /**
  5094. * Creates an RGB color object from its basic channel values
  5095. * @param (int) r the red value
  5096. * @param (int) g the green value
  5097. * @param (int) b the blue value
  5098. * @return (com.ibm.rave.core.color.RGB) the newly constructed RGB color
  5099. */
  5100. com_ibm_rave_core_color_Colors.newRGB$0 = function(r, g, b) {
  5101. return new com_ibm_rave_core_color_RGB(r, g, b, 1.0);
  5102. };
  5103. /**
  5104. * Creates an RGB color object from the passed object This object could be one of the following: - Any color object: RGB, HCL, LAB or HSL - A string which could be in one of the following formats: - RGB decimal - "rgb(255,255,255)" - HSL decimal - "hsl(120,50%,20%)" - RGB hexadecimal - "#ffeeaa" - RGB shorthand hexadecimal - "#fea" - named RGB- "red", "white", "blue" * If the object passed is none of the above,it will be coerced to a string (by calling toString() on it) and processed as such, and if the resulting string does not conform to any of the above formats, it will be considered as a string representation of RGB black color
  5105. * @param (Object) color the object to use to create the RGB color object
  5106. * @return (com.ibm.rave.core.color.RGB) the newly constructed RGB color. Returns 'black' color if parsing fails.
  5107. */
  5108. com_ibm_rave_core_color_Colors.newRGB$1 = function(color) {
  5109. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(color, com_ibm_rave_core_color_Color)) {
  5110. var rgb = (color).rgb();
  5111. return new com_ibm_rave_core_color_RGB(rgb.r, rgb.g, rgb.b, rgb.a);
  5112. }
  5113. return com_ibm_rave_core_color_Colors.rgb_parse((color == null) ? "" : color.toString()).rgb();
  5114. };
  5115. /**
  5116. * Checks whether a string is one of HTML color names (RGB colors)
  5117. * @param (String) str the name of color to check
  5118. * @return (boolean) true if the name is an HTML color names, false otherwise
  5119. */
  5120. /** @expose */
  5121. com_ibm_rave_core_color_Colors.isRGBColorName = function(str) {
  5122. return com_ibm_rave_core_color_Colors.rgb_names.hasOwnProperty(str);
  5123. };
  5124. /** @expose */
  5125. com_ibm_rave_core_color_Colors.newLAB = function(a0, a1, a2) {
  5126. var args = arguments;
  5127. if (args.length == 1) {
  5128. return com_ibm_rave_core_color_Colors.newLAB$1(a0);
  5129. }
  5130. return com_ibm_rave_core_color_Colors.newLAB$0(a0, a1, a2);
  5131. };
  5132. /** @expose */
  5133. com_ibm_rave_core_color_Colors.newHCL = function(a0, a1, a2) {
  5134. var args = arguments;
  5135. if (args.length == 1) {
  5136. return com_ibm_rave_core_color_Colors.newHCL$1(a0);
  5137. }
  5138. return com_ibm_rave_core_color_Colors.newHCL$0(a0, a1, a2);
  5139. };
  5140. /** @expose */
  5141. com_ibm_rave_core_color_Colors.newHSL = function(a0, a1, a2) {
  5142. var args = arguments;
  5143. if (args.length == 1) {
  5144. return com_ibm_rave_core_color_Colors.newHSL$1(a0);
  5145. }
  5146. return com_ibm_rave_core_color_Colors.newHSL$0(a0, a1, a2);
  5147. };
  5148. /** @expose */
  5149. com_ibm_rave_core_color_Colors.newRGB = function(a0, a1, a2) {
  5150. var args = arguments;
  5151. if (args.length == 1) {
  5152. return com_ibm_rave_core_color_Colors.newRGB$1(a0);
  5153. }
  5154. return com_ibm_rave_core_color_Colors.newRGB$0(a0, a1, a2);
  5155. };
  5156. //com_ibm_rave_core_color_Colors.HSL_STR = "hsl";
  5157. //com_ibm_rave_core_color_Colors.RGB_STR = "rgb";
  5158. //com_ibm_rave_core_color_Colors.RGBA_STR = "rgba";
  5159. //com_ibm_rave_core_color_Colors.COMMA_STR = ",";
  5160. //com_ibm_rave_core_color_Colors.PERCENT_STR = "%";
  5161. //com_ibm_rave_core_color_Colors.EMPTY_STR = "";
  5162. com_ibm_rave_core_color_Colors.lab_X = 0.950470;
  5163. com_ibm_rave_core_color_Colors.lab_Y = 1;
  5164. com_ibm_rave_core_color_Colors.lab_Z = 1.088830;
  5165. com_ibm_rave_core_color_Colors.lab_K = 18;
  5166. com_ibm_rave_core_color_Colors.REG_EXP = new RegExp("([a-z]+)\\((.*)\\)", "i");
  5167. com_ibm_rave_core_color_Colors.hexDigits = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
  5168. com_ibm_rave_core_color_Colors.rgb_names = com_ibm_rave_core_color_Colors.initialize_rgb_names();
  5169. // $source: com/ibm/rave/core/internal/color/ContrastShift
  5170. /************************************************************************
  5171. ** IBM Confidential
  5172. **
  5173. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5174. **
  5175. ** (C) Copyright IBM Corp. 2015
  5176. **
  5177. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5178. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5179. ************************************************************************/
  5180. // GENERATED
  5181. //@import com/ibm/rave/core/color/Colors (static) // newRGB
  5182. /**
  5183. * The contrast API will either use the default contrast ratio or the ratio passed into the API. If the ratio passed into the API is not within the range of 1 - 21, the API will use the default contrast ratio of 4.5. This API will first check to ensure that the contrast ratio provided with the colors provided is actually attainable. This is done by checking the contrast ratio against both white and black. If the contrast ratio is attainable, the API will shift the color until the contrast is met. If the ratio is not attainable, then we will return a color which is at least greater than the default contrast ratio of 4.5.
  5184. */
  5185. var com_ibm_rave_core_internal_color_ContrastShift = {
  5186. /**
  5187. * Private constructor - cannot instantiate
  5188. */
  5189. //constructor : function() {}
  5190. };
  5191. /**
  5192. * Calls the updateColor method using the default ratio of 4.5
  5193. * @param (com.ibm.rave.core.color.RGB) staticColor Refers to the color that will not be adjusted
  5194. * @param (com.ibm.rave.core.color.RGB) nonStaticColor Refers to the color that will be adjusted to obtain the appropriate contrast ratio value
  5195. * @return (com.ibm.rave.core.color.RGB) A contrasting color
  5196. */
  5197. com_ibm_rave_core_internal_color_ContrastShift.updateColor$0 = function(staticColor, nonStaticColor) {
  5198. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$1(staticColor, nonStaticColor, 4.5);
  5199. };
  5200. /**
  5201. * Creates a new color which attains the contrast ratio specified by the user. If the contrast ratio is not attainable or does not fall within the contrast ratio range of 1 - 21, a color with at least the default contrast ratio will be returned
  5202. * @param (com.ibm.rave.core.color.RGB) staticColor Refers to the color that will not be adjusted
  5203. * @param (com.ibm.rave.core.color.RGB) nonStaticColor Refers to the color that will be adjusted to obtain the appropriate contrast ratio value
  5204. * @param (double) contrastRatio The contrast ratio to obtain. May be a value from 1 - 21. If a value other outside of the range is passed in, the default ratio of 4.5 will be applied
  5205. * @return (com.ibm.rave.core.color.RGB) A contrasting color
  5206. */
  5207. com_ibm_rave_core_internal_color_ContrastShift.updateColor$1 = function(staticColor, nonStaticColor, contrastRatio) {
  5208. var luminance1 = com_ibm_rave_core_internal_color_ContrastShift.getLuminance(nonStaticColor);
  5209. var luminance2 = com_ibm_rave_core_internal_color_ContrastShift.getLuminance(staticColor);
  5210. var ratio = com_ibm_rave_core_internal_color_ContrastShift.calculateRatio(luminance1, luminance2);
  5211. var cRatio = contrastRatio;
  5212. var color = nonStaticColor;
  5213. if (cRatio < 1 || cRatio > 21) {
  5214. cRatio = 4.5;
  5215. }
  5216. var contrastWhite = com_ibm_rave_core_internal_color_ContrastShift.calculateRatio(1.0, luminance2);
  5217. var contrastBlack = com_ibm_rave_core_internal_color_ContrastShift.calculateRatio(0.0, luminance2);
  5218. if (contrastWhite < cRatio && contrastBlack < cRatio) {
  5219. return contrastWhite > contrastBlack ? com_ibm_rave_core_internal_color_ContrastShift.WHITE : com_ibm_rave_core_internal_color_ContrastShift.BLACK;
  5220. }
  5221. var step = 25 * (com_ibm_rave_core_internal_color_ContrastShift.moveDarker(luminance1, luminance2) ? -1 : 1);
  5222. while (ratio < cRatio) {
  5223. color = com_ibm_rave_core_internal_color_ContrastShift.shiftColor(color, step);
  5224. luminance1 = com_ibm_rave_core_internal_color_ContrastShift.getLuminance(color);
  5225. ratio = com_ibm_rave_core_internal_color_ContrastShift.calculateRatio(luminance1, luminance2);
  5226. if ((luminance1 >= 1.0 || luminance1 <= 0.0) && ratio < cRatio) {
  5227. color = nonStaticColor;
  5228. step *= -1;
  5229. }
  5230. }
  5231. return color;
  5232. };
  5233. /**
  5234. * Determine if a color needs to be made darker.
  5235. * @param (double) shiftingLuminance The shifting color's luminance.
  5236. * @param (double) staticLuminance The static color's luminance.
  5237. * @return (boolean) true if the color needs to be darker, false otherwise.
  5238. */
  5239. com_ibm_rave_core_internal_color_ContrastShift.moveDarker = function(shiftingLuminance, staticLuminance) {
  5240. var darker = true;
  5241. if (shiftingLuminance == staticLuminance) {
  5242. darker = (shiftingLuminance - 0.5 >= 0) ? true : false;
  5243. } else if (shiftingLuminance > staticLuminance) {
  5244. darker = false;
  5245. }
  5246. return darker;
  5247. };
  5248. /**
  5249. * Calculates and returns the luminance of a specific color
  5250. * @param (com.ibm.rave.core.color.RGB) rgb The RGB color to attain the luminance of
  5251. * @return (double) the luminance value of the color passed in
  5252. */
  5253. com_ibm_rave_core_internal_color_ContrastShift.getLuminance = function(rgb) {
  5254. return (0.2126 * com_ibm_rave_core_internal_color_ContrastShift.adjustColor(rgb.r / 255.0)) + (0.7152 * com_ibm_rave_core_internal_color_ContrastShift.adjustColor(rgb.g / 255.0)) + (0.0722 * com_ibm_rave_core_internal_color_ContrastShift.adjustColor(rgb.b / 255.0));
  5255. };
  5256. /**
  5257. * Adjusts the color in order to calculate the relative luminance
  5258. * @param (double) color Color value to adjust
  5259. * @return (double) The adjusted color value
  5260. */
  5261. com_ibm_rave_core_internal_color_ContrastShift.adjustColor = function(color) {
  5262. var adjustedColor = 0;
  5263. if (color <= 0.03928) {
  5264. adjustedColor = color / 12.92;
  5265. } else {
  5266. adjustedColor = Math.pow(((color + 0.055) / 1.055), 2.4);
  5267. }
  5268. return adjustedColor;
  5269. };
  5270. /**
  5271. * Shifts the color by the specified amount and returns a new color object
  5272. * @param (com.ibm.rave.core.color.RGB) color The color we are shifting
  5273. * @param (int) amount The amount by which we are shifting the color
  5274. * @return (com.ibm.rave.core.color.RGB) A new Color Object containing the new color after the shift is complete
  5275. */
  5276. com_ibm_rave_core_internal_color_ContrastShift.shiftColor = function(color, amount) {
  5277. var r = Math.max(0, Math.min(color.r + amount, 255));
  5278. var g = Math.max(0, Math.min(color.g + amount, 255));
  5279. var b = Math.max(0, Math.min(color.b + amount, 255));
  5280. return com_ibm_rave_core_color_Colors.newRGB(r, g, b);
  5281. };
  5282. /**
  5283. * Calculates and returns the contrast ratio using the luminance of both the colors it is contrasting against
  5284. * @param (double) l1 The luminance of the first color
  5285. * @param (double) l2 The luminance of the second color
  5286. * @return (double) The contrast ratio calculated
  5287. */
  5288. com_ibm_rave_core_internal_color_ContrastShift.calculateRatio = function(l1, l2) {
  5289. if (l1 >= l2) {
  5290. return (l1 + .05) / (l2 + .05);
  5291. }
  5292. return (l2 + .05) / (l1 + .05);
  5293. };
  5294. com_ibm_rave_core_internal_color_ContrastShift.updateColor = function(a0, a1, a2) {
  5295. var args = arguments;
  5296. if (args.length == 2) {
  5297. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$0(a0, a1);
  5298. }
  5299. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$1(a0, a1, a2);
  5300. };
  5301. com_ibm_rave_core_internal_color_ContrastShift.DEFAULT_RATIO = 4.5;
  5302. com_ibm_rave_core_internal_color_ContrastShift.STEP = 25;
  5303. com_ibm_rave_core_internal_color_ContrastShift.MAX_RATIO = 21;
  5304. com_ibm_rave_core_internal_color_ContrastShift.MIN_RATIO = 1;
  5305. com_ibm_rave_core_internal_color_ContrastShift.BLACK_LUMINANCE = 0;
  5306. com_ibm_rave_core_internal_color_ContrastShift.WHITE_LUMINANCE = 1;
  5307. com_ibm_rave_core_internal_color_ContrastShift.BLACK = com_ibm_rave_core_color_Colors.newRGB(0, 0, 0);
  5308. com_ibm_rave_core_internal_color_ContrastShift.WHITE = com_ibm_rave_core_color_Colors.newRGB(255, 255, 255);
  5309. // $source: com/ibm/rave/core/interpolate/ColorInterpolation
  5310. /************************************************************************
  5311. ** IBM Confidential
  5312. **
  5313. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5314. **
  5315. ** (C) Copyright IBM Corp. 2015
  5316. **
  5317. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5318. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5319. ************************************************************************/
  5320. // GENERATED
  5321. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5322. //@import com/ibm/rave/core/Rave (runtime) // hcl, hsl, rgb, lab
  5323. //@import com/ibm/rave/core/color/Colors (runtime) // rgb_hex, lab_rgb, hcl_lab, hsl_rgb
  5324. /**
  5325. * A class that holds the various instances of color interpolator factories
  5326. */
  5327. var com_ibm_rave_core_interpolate_ColorInterpolation = rave_externs["ColorInterpolation"] = com_ibm_rave_core_nativeImpl_Declare({
  5328. });
  5329. com_ibm_rave_core_interpolate_ColorInterpolation.HSLInterpolation = com_ibm_rave_core_nativeImpl_Declare({
  5330. _$functionClassMethod : function() {
  5331. var _$self = function(a, b) {
  5332. var aColor = com_ibm_rave_core_Rave.hsl(a);
  5333. var bColor = com_ibm_rave_core_Rave.hsl(b);
  5334. var ah = aColor.h, as = aColor.s, al = aColor.l, bh = bColor.h - ah, bs = bColor.s - as, bl = bColor.l - al;
  5335. if (isNaN(bs)) {
  5336. bs = 0;
  5337. as = isNaN(as) ? bColor.s : as;
  5338. }
  5339. if (isNaN(bh)) {
  5340. bh = 0;
  5341. ah = isNaN(ah) ? bColor.h : ah;
  5342. } else if (bh > 180) {
  5343. bh -= 360;
  5344. } else if (bh < -180) {
  5345. bh += 360;
  5346. }
  5347. var ahf = ah, bhf = bh, asf = as, bsf = bs, alf = al, blf = bl;
  5348. return function(t) {
  5349. return com_ibm_rave_core_color_Colors.hsl_rgb(ahf + bhf * t, asf + bsf * t, alf + blf * t).toString();
  5350. };
  5351. };
  5352. return _$self;
  5353. }
  5354. });
  5355. com_ibm_rave_core_interpolate_ColorInterpolation.HCLInterpolation = com_ibm_rave_core_nativeImpl_Declare({
  5356. _$functionClassMethod : function() {
  5357. var _$self = function(a, b) {
  5358. var aColor = com_ibm_rave_core_Rave.hcl(a);
  5359. var bColor = com_ibm_rave_core_Rave.hcl(b);
  5360. var ah = aColor.h, ac = aColor.c, al = aColor.l, bh = bColor.h - ah, bc = bColor.c - ac, bl = bColor.l - al;
  5361. if (isNaN(bc)) {
  5362. bc = 0;
  5363. ac = isNaN(ac) ? bColor.c : ac;
  5364. }
  5365. if (isNaN(bh)) {
  5366. bh = 0;
  5367. ah = isNaN(ah) ? bColor.h : ah;
  5368. } else if (bh > 180) {
  5369. bh -= 360;
  5370. } else if (bh < -180) {
  5371. bh += 360;
  5372. }
  5373. var ahf = ah, bhf = bh, acf = ac, bcf = bc, alf = al, blf = bl;
  5374. return function(t) {
  5375. return com_ibm_rave_core_color_Colors.hcl_lab(ahf + bhf * t, acf + bcf * t, alf + blf * t).toString();
  5376. };
  5377. };
  5378. return _$self;
  5379. }
  5380. });
  5381. com_ibm_rave_core_interpolate_ColorInterpolation.LABInterpolation = com_ibm_rave_core_nativeImpl_Declare({
  5382. _$functionClassMethod : function() {
  5383. var _$self = function(a, b) {
  5384. var aColor = com_ibm_rave_core_Rave.lab(a);
  5385. var bColor = com_ibm_rave_core_Rave.lab(b);
  5386. var al = aColor.l, aa = aColor.a, ab = aColor.b, bl = bColor.l - al, ba = bColor.a - aa, bb = bColor.b - ab;
  5387. return function(t) {
  5388. return com_ibm_rave_core_color_Colors.lab_rgb(al + bl * t, aa + ba * t, ab + bb * t).toString();
  5389. };
  5390. };
  5391. return _$self;
  5392. }
  5393. });
  5394. com_ibm_rave_core_interpolate_ColorInterpolation.RGBInterpolation = com_ibm_rave_core_nativeImpl_Declare({
  5395. _$functionClassMethod : function() {
  5396. var _$self = function(a, b) {
  5397. var aColor = com_ibm_rave_core_Rave.rgb(a);
  5398. var bColor = com_ibm_rave_core_Rave.rgb(b);
  5399. var ar = aColor.r, ag = aColor.g, ab = aColor.b, br = bColor.r - ar, bg = bColor.g - ag, bb = bColor.b - ab;
  5400. return function(t) {
  5401. return "#" + com_ibm_rave_core_color_Colors.rgb_hex(Math.round(ar + br * t)) + com_ibm_rave_core_color_Colors.rgb_hex(Math.round(ag + bg * t)) + com_ibm_rave_core_color_Colors.rgb_hex(Math.round(ab + bb * t));
  5402. };
  5403. };
  5404. return _$self;
  5405. }
  5406. });
  5407. /**
  5408. * An HSL interpolator factory that returns an HSL color space interpolator between the two colors a and b. The colors a and b need not be in HSL, but they will be converted to HSL using Rave.hsl(Object). The hue, saturation and lightness are interpolated linearly in a manner equivalent to interpolateNumber.(The shortest path between the start and end hue is used.) The return value of the interpolator is a hexadecimal RGB string.
  5409. */
  5410. /** @expose */
  5411. com_ibm_rave_core_interpolate_ColorInterpolation.HSLINSTANCE = new com_ibm_rave_core_interpolate_ColorInterpolation.HSLInterpolation();
  5412. /**
  5413. * An HCL interpolator factory that returns an HCL color space interpolator between the two colors a and b. The colors a and b will be converted to HCL if necessary using Rave.hcl(Object). The color channels are then interpolated linearly in a manner equivalent to interpolateNumber. (The shortest path between the start and end hue is used.) The return value of the interpolator is a hexadecimal RGB string.
  5414. */
  5415. /** @expose */
  5416. com_ibm_rave_core_interpolate_ColorInterpolation.HCLINSTANCE = new com_ibm_rave_core_interpolate_ColorInterpolation.HCLInterpolation();
  5417. /**
  5418. * An LAB interpolator factory that returns a LAB color space interpolator between the two colors a and b. The colors a and b will be converted to LAB if necessary using Rave.lab(Object). The color channels are then interpolated linearly in a manner equivalent to interpolateNumber. The return value of the interpolator is a hexadecimal RGB string.
  5419. */
  5420. /** @expose */
  5421. com_ibm_rave_core_interpolate_ColorInterpolation.LABINSTANCE = new com_ibm_rave_core_interpolate_ColorInterpolation.LABInterpolation();
  5422. /**
  5423. * An RGB interpolator factory that returns an RGB color space interpolator between the two colors a and b. The colors a and b need not be in RGB, but they will be converted to RGB using Rave.rgb(Object) The red, green and blue channels are interpolated linearly in a manner equivalent to interpolateRound, as fractional channel values are not allowed. The return value of the interpolator is a hexadecimal RGB string.
  5424. */
  5425. /** @expose */
  5426. com_ibm_rave_core_interpolate_ColorInterpolation.RGBINSTANCE = new com_ibm_rave_core_interpolate_ColorInterpolation.RGBInterpolation();
  5427. // $source: com/ibm/rave/core/interpolate/StringInterpolation
  5428. /************************************************************************
  5429. ** IBM Confidential
  5430. **
  5431. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5432. **
  5433. ** (C) Copyright IBM Corp. 2015
  5434. **
  5435. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5436. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5437. ************************************************************************/
  5438. // GENERATED
  5439. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5440. //@import com/ibm/rave/core/interpolate/NumberInterpolation (runtime) // NumberInterpolation
  5441. var com_ibm_rave_core_interpolate_StringInterpolation = rave_externs["StringInterpolation"] = com_ibm_rave_core_nativeImpl_Declare({
  5442. _$functionClassMethod : function() {
  5443. var _$self = /**
  5444. * Creates an interpolator that will interpolate all numbers found within the start end values.
  5445. * @param (Object) a the start value
  5446. * @param (Object) b the end value
  5447. * @return (com.ibm.rave.core.interpolate.Interpolator) a new interpolator
  5448. */
  5449. function(a, b) {
  5450. var are = com_ibm_rave_core_interpolate_StringInterpolation.aRegExp, bre = com_ibm_rave_core_interpolate_StringInterpolation.bRegExp;
  5451. are["lastIndex"] = bre["lastIndex"] = 0;
  5452. var ax = a + "", bx = b + "";
  5453. var ls = [];
  5454. var lq = [];
  5455. var bs;
  5456. var bi = 0, i = -1, bsi;
  5457. var am;
  5458. var bm;
  5459. while ((am = are.exec(ax)) && (bm = bre.exec(bx))) {
  5460. if ((bsi = bm.index) > bi) {
  5461. bs = bx.substring(bi, bsi);
  5462. var tmp = i < ls.length ? ls[i] : null;
  5463. if (tmp != null) {
  5464. ls[i] = tmp + bs;
  5465. } else {
  5466. ls.push(bs);
  5467. i++;
  5468. }
  5469. }
  5470. if (am[0] == bm[0]) {
  5471. var tmp = i < ls.length ? ls[i] : null;
  5472. if (tmp != null) {
  5473. ls[i] = tmp + bm[0];
  5474. } else {
  5475. ls.push(bm[0]);
  5476. i++;
  5477. }
  5478. } else {
  5479. ls.push(null);
  5480. i++;
  5481. lq.push(new com_ibm_rave_core_interpolate_StringInterpolation.IndexInterpolator(i, com_ibm_rave_core_interpolate_NumberInterpolation.INSTANCE(am[0], bm[0])));
  5482. }
  5483. bi = bre["lastIndex"];
  5484. }
  5485. if (bi < bx.length) {
  5486. bs = bx.substring(bi);
  5487. var tmp = i < ls.length ? ls[i] : null;
  5488. if (tmp != null) {
  5489. ls[i] = tmp + bs;
  5490. } else {
  5491. ls.push(bs);
  5492. i++;
  5493. }
  5494. }
  5495. if (ls.length < 2) {
  5496. if (lq.length > 0) {
  5497. var lq0Interpolator = lq[0].x;
  5498. return function(t) {
  5499. return lq0Interpolator(t) + "";
  5500. };
  5501. }
  5502. var fb = bx;
  5503. return function(t) {
  5504. return fb;
  5505. };
  5506. }
  5507. var lqSize = lq.length;
  5508. return function(t) {
  5509. var o;
  5510. for (var i = 0; i < lqSize; ++i) {
  5511. ls[(o = lq[i]).i] = o.x(t);
  5512. }
  5513. return ls.join("");
  5514. };
  5515. };
  5516. return _$self;
  5517. }
  5518. });
  5519. com_ibm_rave_core_interpolate_StringInterpolation.IndexInterpolator = function(i, interpolator) {
  5520. this.i = i;
  5521. this.x = interpolator;
  5522. };
  5523. /** @expose */
  5524. com_ibm_rave_core_interpolate_StringInterpolation.INSTANCE = new com_ibm_rave_core_interpolate_StringInterpolation();
  5525. com_ibm_rave_core_interpolate_StringInterpolation.aRegExp = new RegExp("[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?", "g");
  5526. com_ibm_rave_core_interpolate_StringInterpolation.bRegExp = new RegExp(com_ibm_rave_core_interpolate_StringInterpolation.aRegExp["source"], "g");
  5527. // $source: com/ibm/rave/core/interpolate/NumberInterpolation
  5528. /************************************************************************
  5529. ** IBM Confidential
  5530. **
  5531. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5532. **
  5533. ** (C) Copyright IBM Corp. 2015
  5534. **
  5535. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5536. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5537. ************************************************************************/
  5538. // GENERATED
  5539. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5540. var com_ibm_rave_core_interpolate_NumberInterpolation = com_ibm_rave_core_nativeImpl_Declare({
  5541. _$functionClassMethod : function() {
  5542. var _$self = /**
  5543. * Creates an interpolator that can interpolate a number between the start and end value.
  5544. * @param (Object) a the start value
  5545. * @param (Object) b the end value
  5546. * @return (com.ibm.rave.core.interpolate.Interpolator) q new interpolator
  5547. */
  5548. function(a, b) {
  5549. var da = + (a);
  5550. var db = + (b) - da;
  5551. return function(t) {
  5552. return da + db * t;
  5553. };
  5554. };
  5555. return _$self;
  5556. }
  5557. //constructor : function() {}
  5558. });
  5559. /** @expose */
  5560. com_ibm_rave_core_interpolate_NumberInterpolation.INSTANCE = new com_ibm_rave_core_interpolate_NumberInterpolation();
  5561. // $source: com/ibm/rave/core/interpolate/ArrayInterpolation
  5562. /************************************************************************
  5563. ** IBM Confidential
  5564. **
  5565. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5566. **
  5567. ** (C) Copyright IBM Corp. 2015
  5568. **
  5569. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5570. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5571. ************************************************************************/
  5572. // GENERATED
  5573. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5574. //@import com/ibm/rave/core/interpolate/Interpolators (runtime) // Interpolators
  5575. var com_ibm_rave_core_interpolate_ArrayInterpolation = rave_externs["ArrayInterpolation"] = com_ibm_rave_core_nativeImpl_Declare({
  5576. _$functionClassMethod : function() {
  5577. var _$self = /**
  5578. * Returns an array interpolator between the two arrays a and b. Internally, an array template is created that is the same length in b. For each element in b, if there exists a corresponding element in a, a generic interpolator is created for the two elements using interpolate. If there is no such element, the static value from b is used in the template. Then, for the given parameter t, the template's embedded interpolators are evaluated. The updated array template is then returned. For example, if a is the array [0, 1] and b is the array [1, 10, 100], then the result of the interpolator for t = .5 is the array [.5, 5.5, 100]. Note: no defensive copy of the template array is created; modifications of the returned array may adversely affect subsequent evaluation of the interpolator. No copy is made because interpolators should be fast, as they are part of the inner loop of animation.
  5579. * @param (java.lang.Object[]) a the first array
  5580. * @param (java.lang.Object[]) b the second array
  5581. * @return (com.ibm.rave.core.interpolate.Interpolator) the new interpolator
  5582. */
  5583. function(a, b) {
  5584. var na = a.length;
  5585. var nb = b.length;
  5586. var n0 = Math.min(na, nb);
  5587. var i = 0;
  5588. var x = [];
  5589. var c = [];
  5590. for (i = 0; i < n0; ++i) {
  5591. x[i] = com_ibm_rave_core_interpolate_Interpolators.INSTANCE.getInterpolator(a[i], b[i]);
  5592. }
  5593. for (; i < na; ++i) {
  5594. c[i] = a[i];
  5595. }
  5596. for (; i < nb; ++i) {
  5597. c[i] = b[i];
  5598. }
  5599. return function(t) {
  5600. for (var index = 0; index < n0; ++index) {
  5601. c[index] = x[index](t);
  5602. }
  5603. return c;
  5604. };
  5605. };
  5606. return _$self;
  5607. }
  5608. });
  5609. /** @expose */
  5610. com_ibm_rave_core_interpolate_ArrayInterpolation.INSTANCE = new com_ibm_rave_core_interpolate_ArrayInterpolation();
  5611. // $source: com/ibm/rave/core/nativeImpl/interpolate/TransformInterpolation
  5612. /************************************************************************
  5613. ** IBM Confidential
  5614. **
  5615. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5616. **
  5617. ** (C) Copyright IBM Corp. 2014
  5618. **
  5619. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5620. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5621. ************************************************************************/
  5622. /**
  5623. * Returns an object interpolator between the two objects a and b.
  5624. * Internally, an object template is created that has the same properties as b.
  5625. * For each property in b, if there exists a corresponding property in a, a generic
  5626. * interpolator is created for the two elements using interpolate. If there is no
  5627. * such property, the static value from b is used in the template.
  5628. * Then, for the given parameter t, the template's embedded interpolators are evaluated
  5629. * and the updated object template is then returned.
  5630. * For example, if a is the object {x: 0, y: 1} and b is the object {x: 1, y: 10, z: 100},
  5631. * the result of the interpolator for t = .5 is the object {x: .5, y: 5.5, z: 100}.
  5632. *
  5633. * Object interpolation is particularly useful for dataspace interpolation, where data is
  5634. * interpolated rather than attribute values. For example, you can interpolate an object which
  5635. * describes an arc in a pie chart, and then use d3.svg.arc to compute the new SVG path data.
  5636. *
  5637. * Note: no defensive copy of the template object is created; modifications of the returned
  5638. * object may adversely affect subsequent evaluation of the interpolator. No copy is made because
  5639. * interpolators should be fast, as they are part of the inner loop of animation.
  5640. * @param (Object) a the start Object
  5641. * @param (Object) b the end Object
  5642. * @return (com.ibm.rave.core.interpolate.Interpolator) q new interpolator
  5643. */
  5644. //@import com/ibm/rave/core/nativeImpl/math/Transform
  5645. //@import com/ibm/rave/core/interpolate/NumberInterpolation
  5646. //@import com/ibm/rave/core/Rave (runtime)
  5647. /** @expose */
  5648. var com_ibm_rave_core_nativeImpl_interpolate_TransformInterpolation =function(a, b) {
  5649. var rave = com_ibm_rave_core_Rave;
  5650. var s = [], // string constants and placeholders
  5651. q = [], // number interpolators
  5652. n,
  5653. A =rave.transform(a),
  5654. B = rave.transform(b),
  5655. ta = A.translate,
  5656. tb = B.translate,
  5657. ra = A.rotate,
  5658. rb = B.rotate,
  5659. wa = A.skew,
  5660. wb = B.skew,
  5661. ka = A.scale,
  5662. kb = B.scale;
  5663. if (ta[0] != tb[0] || ta[1] != tb[1]) {
  5664. s.push("translate(", null, ",", null, ")");
  5665. q.push({i: 1, x: new com_ibm_rave_core_interpolate_NumberInterpolation()(ta[0], tb[0])}, {i: 3, x: new com_ibm_rave_core_interpolate_NumberInterpolation()(ta[1], tb[1])});
  5666. } else if (tb[0] || tb[1]) {
  5667. s.push("translate(" + tb + ")");
  5668. } else {
  5669. s.push("");
  5670. }
  5671. if (ra != rb) {
  5672. if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360; // shortest path
  5673. q.push({i: s.push(s.pop() + "rotate(", null, ")") - 2, x: new com_ibm_rave_core_interpolate_NumberInterpolation()(ra, rb)});
  5674. } else if (rb) {
  5675. s.push(s.pop() + "rotate(" + rb + ")");
  5676. }
  5677. if (wa != wb) {
  5678. q.push({i: s.push(s.pop() + "skewX(", null, ")") - 2, x: new com_ibm_rave_core_interpolate_NumberInterpolation()(wa, wb)});
  5679. } else if (wb) {
  5680. s.push(s.pop() + "skewX(" + wb + ")");
  5681. }
  5682. if (ka[0] != kb[0] || ka[1] != kb[1]) {
  5683. n = s.push(s.pop() + "scale(", null, ",", null, ")");
  5684. q.push({i: n - 4, x: new com_ibm_rave_core_interpolate_NumberInterpolation()(ka[0], kb[0])}, {i: n - 2, x: new com_ibm_rave_core_interpolate_NumberInterpolation()(ka[1], kb[1])});
  5685. } else if (kb[0] != 1 || kb[1] != 1) {
  5686. s.push(s.pop() + "scale(" + kb + ")");
  5687. }
  5688. n = q.length;
  5689. return function(t){
  5690. if (t == 1) {
  5691. return b;
  5692. }
  5693. var i = -1, o;
  5694. while (++i < n) s[(o = q[i]).i] = o.x(t);
  5695. return s.join("");
  5696. };
  5697. };
  5698. com_ibm_rave_core_nativeImpl_interpolate_TransformInterpolation.INSTANCE = com_ibm_rave_core_nativeImpl_interpolate_TransformInterpolation;
  5699. // $source: com/ibm/rave/core/geom/PointStruct
  5700. /************************************************************************
  5701. ** IBM Confidential
  5702. **
  5703. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5704. **
  5705. ** (C) Copyright IBM Corp. 2015
  5706. **
  5707. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5708. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5709. ************************************************************************/
  5710. // GENERATED
  5711. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5712. var com_ibm_rave_core_geom_PointStruct = rave_externs["PointStruct"] = com_ibm_rave_core_nativeImpl_Declare({
  5713. /** @expose */
  5714. x : 0,
  5715. /** @expose */
  5716. y : 0,
  5717. /** @expose */
  5718. constructor : function(x, y) {
  5719. this.x = x;
  5720. this.y = y;
  5721. }
  5722. });
  5723. // $source: com/ibm/rave/core/geom/RectStruct
  5724. /************************************************************************
  5725. ** IBM Confidential
  5726. **
  5727. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5728. **
  5729. ** (C) Copyright IBM Corp. 2015
  5730. **
  5731. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5732. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5733. ************************************************************************/
  5734. // GENERATED
  5735. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5736. var com_ibm_rave_core_geom_RectStruct = rave_externs["RectStruct"] = com_ibm_rave_core_nativeImpl_Declare({
  5737. /** @expose */
  5738. x : 0,
  5739. /** @expose */
  5740. y : 0,
  5741. /** @expose */
  5742. width : 0,
  5743. /** @expose */
  5744. height : 0,
  5745. /** @expose */
  5746. constructor : function(x, y, width, height) {
  5747. this.x = x;
  5748. this.y = y;
  5749. this.width = width;
  5750. this.height = height;
  5751. }
  5752. });
  5753. // $source: com/ibm/rave/core/transform/Matrix
  5754. /************************************************************************
  5755. ** IBM Confidential
  5756. **
  5757. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5758. **
  5759. ** (C) Copyright IBM Corp. 2015
  5760. **
  5761. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5762. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5763. ************************************************************************/
  5764. // GENERATED
  5765. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5766. /**
  5767. * A matrix transform representation. Mimics an SVGMatrix. [ a b tx ] [ x ] [ a * x + b * y + tx ] [ c d ty ] [ y ] = [ c * x + d * y + ty ] [ 0 0 1 ] [ 1 ] [ 1 ]
  5768. */
  5769. var com_ibm_rave_core_transform_Matrix = rave_externs["Matrix"] = com_ibm_rave_core_nativeImpl_Declare({
  5770. //rotateOrigin : null,
  5771. /** @expose */
  5772. a : 0,
  5773. /** @expose */
  5774. b : 0,
  5775. /** @expose */
  5776. c : 0,
  5777. /** @expose */
  5778. d : 0,
  5779. /** @expose */
  5780. e : 0,
  5781. /** @expose */
  5782. f : 0,
  5783. /** @expose */
  5784. constructor : function(a, b, c, d, e, f) {
  5785. this.a = a;
  5786. this.b = b;
  5787. this.c = c;
  5788. this.d = d;
  5789. this.e = e;
  5790. this.f = f;
  5791. },
  5792. /**
  5793. * Multiply this matrix with another matrix. Returns new instance.
  5794. * @param (com.ibm.rave.core.transform.Matrix) matrix Matrix to multiply this matrix with.
  5795. * @return (com.ibm.rave.core.transform.Matrix) New matrix that has been multiplied.
  5796. */
  5797. /** @expose */
  5798. multiply : function(matrix) {
  5799. var a1 = matrix.a * this.a + matrix.b * this.c;
  5800. var b1 = matrix.a * this.b + matrix.b * this.d;
  5801. var c1 = matrix.c * this.a + matrix.d * this.c;
  5802. var d1 = matrix.c * this.b + matrix.d * this.d;
  5803. var e1 = matrix.e * this.a + matrix.f * this.c + this.e;
  5804. var f1 = matrix.e * this.b + matrix.f * this.d + this.f;
  5805. return new com_ibm_rave_core_transform_Matrix(a1, b1, c1, d1, e1, f1);
  5806. },
  5807. /**
  5808. * Inverse this matrix. If this matrix is not invertible, returns the identity matrix.
  5809. * @return (com.ibm.rave.core.transform.Matrix) New matrix representing an inverted version of this one.
  5810. */
  5811. /** @expose */
  5812. inverse : function() {
  5813. var determinant = this.a * this.d - this.b * this.c;
  5814. if (determinant == 0) {
  5815. return com_ibm_rave_core_transform_Matrix.identity();
  5816. }
  5817. var a1 = this.d / determinant;
  5818. var b1 = -this.b / determinant;
  5819. var c1 = -this.c / determinant;
  5820. var d1 = this.a / determinant;
  5821. var e1 = (this.c * this.f - this.d * this.e) / determinant;
  5822. var f1 = (this.b * this.e - this.a * this.f) / determinant;
  5823. return new com_ibm_rave_core_transform_Matrix(a1, b1, c1, d1, e1, f1);
  5824. },
  5825. /**
  5826. * Translate this matrix by the points x and y.
  5827. * @param (double) x Horizontal point to translate (move) this matrix.
  5828. * @param (double) y Vertical point to translate (move) this matrix.
  5829. * @return (com.ibm.rave.core.transform.Matrix) New matrix with the translate transform applied.
  5830. */
  5831. /** @expose */
  5832. translate : function(x, y) {
  5833. var e1 = (x * this.a + y * this.c) + this.e;
  5834. var f1 = (x * this.b + y * this.d) + this.f;
  5835. return new com_ibm_rave_core_transform_Matrix(this.a, this.b, this.c, this.d, e1, f1);
  5836. },
  5837. /**
  5838. * Scale this transform by scaleFactor. Applies uniformly along x and y.
  5839. * @param (double) scaleFactor Scale factor to apply to both dimensions.
  5840. * @return (com.ibm.rave.core.transform.Matrix) New matrix with scale applied.
  5841. */
  5842. /** @expose */
  5843. scale : function(scaleFactor) {
  5844. return this.scaleNonUniform(scaleFactor, scaleFactor);
  5845. },
  5846. /**
  5847. * Scale this transform using two different scale factors - one for the x dimension and one for the y.
  5848. * @param (double) scaleFactorX X dimension transform scale factor.
  5849. * @param (double) scaleFactorY Y dimension transform scale factor.
  5850. * @return (com.ibm.rave.core.transform.Matrix) This matrix with non-uniform scales applied.
  5851. */
  5852. /** @expose */
  5853. scaleNonUniform : function(scaleFactorX, scaleFactorY) {
  5854. var a1 = this.a * scaleFactorX;
  5855. var b1 = this.b * scaleFactorX;
  5856. var c1 = this.c * scaleFactorY;
  5857. var d1 = this.d * scaleFactorY;
  5858. return new com_ibm_rave_core_transform_Matrix(a1, b1, c1, d1, this.e, this.f);
  5859. },
  5860. /**
  5861. * Apply a rotate transform to this matrix by a number of degrees.
  5862. * @param (double) angle The number of degrees to rotate this matrix by. May be negative.
  5863. * @return (com.ibm.rave.core.transform.Matrix) New matrix with a rotate transform applied.
  5864. */
  5865. rotate$0 : function(angle) {
  5866. var rads = com_ibm_rave_core_transform_Matrix.degreesToRadians(angle);
  5867. var sin = Math.sin(rads);
  5868. var cos = Math.cos(rads);
  5869. return this.multiply(new com_ibm_rave_core_transform_Matrix(cos, sin, -sin, cos, 0, 0));
  5870. },
  5871. rotate$1 : function(angle, originX, originY) {
  5872. return this.translate(originX, originY).rotate$0(angle).translate(-originX, -originY);
  5873. },
  5874. /**
  5875. * Performs a rotate based on a vector descibed as x,y. Effectively performs this calculation: 180 / Math.PI * Math.atan2(x,y); atan2(y, x) is the angle in radians between the x-axis of a plane and the point (x, y) on it
  5876. * @param (double) x The coordinate point x to get the angle from.
  5877. * @param (double) y The coordinate point x to get the angle from.
  5878. * @return (com.ibm.rave.core.transform.Matrix) New matrix rotated the number of degrees based on atan2(y,x)
  5879. */
  5880. /** @expose */
  5881. rotateFromVector : function(x, y) {
  5882. return this.rotate(com_ibm_rave_core_transform_Matrix.radiansToDegrees(Math.atan2(y, x)));
  5883. },
  5884. /**
  5885. * Apply a 'mirrored' horizontal flip on this transform matrix and return it.
  5886. * @return (com.ibm.rave.core.transform.Matrix) New matrix with a (-1,1) scale applied.
  5887. */
  5888. /** @expose */
  5889. flipX : function() {
  5890. return this.scaleNonUniform(-1, 1);
  5891. },
  5892. /**
  5893. * Apply a 'mirrored' vertical flip on this transform matrix and return it.
  5894. * @return (com.ibm.rave.core.transform.Matrix) New matrix with a (1,-1) scale applied.
  5895. */
  5896. /** @expose */
  5897. flipY : function() {
  5898. return this.scaleNonUniform(1, -1);
  5899. },
  5900. /**
  5901. * Skew this transform horizontally by an angle and return the resulting transform.
  5902. * @param (double) angle The angle by which to skew horizontally.
  5903. * @return (com.ibm.rave.core.transform.Matrix) New matrix with horizontal skew applied.
  5904. */
  5905. /** @expose */
  5906. skewX : function(angle) {
  5907. return this.skew(angle, 0);
  5908. },
  5909. /**
  5910. * Skew this transform vertically by an angle and return the resulting transform.
  5911. * @param (double) angle The angle by which to skew vertically.
  5912. * @return (com.ibm.rave.core.transform.Matrix) This matrix with vertical skew applied.
  5913. */
  5914. /** @expose */
  5915. skewY : function(angle) {
  5916. return this.skew(0, angle);
  5917. },
  5918. /**
  5919. * Skew this transform horizontally and vertically by two angles and return the resulting transform. Note that this is not public API. Must use skewX and skewY.
  5920. * @param (double) horizontalAngle The angle by which to skew horizontally.
  5921. * @param (double) verticalAngle The angle by which to skew vertically.
  5922. * @return (com.ibm.rave.core.transform.Matrix) This matrix with skew applied.
  5923. */
  5924. skew : function(horizontalAngle, verticalAngle) {
  5925. var newMatrix = com_ibm_rave_core_transform_Matrix.identity();
  5926. newMatrix.c = Math.tan(com_ibm_rave_core_transform_Matrix.degreesToRadians(horizontalAngle));
  5927. newMatrix.b = Math.tan(com_ibm_rave_core_transform_Matrix.degreesToRadians(verticalAngle));
  5928. return this.multiply(newMatrix);
  5929. },
  5930. /** @expose */
  5931. rotate : function(a0, a1, a2) {
  5932. var args = arguments;
  5933. if (args.length == 1) {
  5934. return this.rotate$0(a0);
  5935. }
  5936. return this.rotate$1(a0, a1, a2);
  5937. }
  5938. });
  5939. /**
  5940. * Return the identity matrix of (1,0,0,1,0,0);
  5941. * @return (com.ibm.rave.core.transform.Matrix) New instance of an identity matrix.
  5942. */
  5943. com_ibm_rave_core_transform_Matrix.identity = function() {
  5944. return new com_ibm_rave_core_transform_Matrix(1, 0, 0, 1, 0, 0);
  5945. };
  5946. com_ibm_rave_core_transform_Matrix.radiansToDegrees = function(rads) {
  5947. return rads * 180 / Math.PI;
  5948. };
  5949. com_ibm_rave_core_transform_Matrix.degreesToRadians = function(angle) {
  5950. return angle * Math.PI / 180;
  5951. };
  5952. // $source: com/ibm/rave/core/transform/MatrixUtil
  5953. /************************************************************************
  5954. ** IBM Confidential
  5955. **
  5956. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5957. **
  5958. ** (C) Copyright IBM Corp. 2015
  5959. **
  5960. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5961. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5962. ************************************************************************/
  5963. // GENERATED
  5964. //@import com/ibm/rave/core/geom/PointStruct (static) // new
  5965. //@import com/ibm/rave/core/geom/RectStruct (static) // new
  5966. //@import com/ibm/rave/core/transform/Matrix (static) // new
  5967. /**
  5968. * Helper utilities for matrix transforms. Anything not in the SVGMatrix interface should be made a helper here.
  5969. */
  5970. var com_ibm_rave_core_transform_MatrixUtil = rave_externs["MatrixUtil"] = {
  5971. //constructor : function() {}
  5972. };
  5973. /** @expose */
  5974. com_ibm_rave_core_transform_MatrixUtil.mapPoints = function(points, matrix) {
  5975. var x, y;
  5976. for (var i = 0, len = points.length; i < len; i += 2) {
  5977. x = points[i] * matrix.a + points[i + 1] * matrix.b + matrix.e;
  5978. y = points[i] * matrix.c + points[i + 1] * matrix.d + matrix.f;
  5979. points[i] = x;
  5980. points[i + 1] = y;
  5981. }
  5982. };
  5983. /**
  5984. * Internal method to create a new matrix object.
  5985. * @param (double) a
  5986. * @param (double) b
  5987. * @param (double) c
  5988. * @param (double) d
  5989. * @param (double) e
  5990. * @param (double) f
  5991. * @return (com.ibm.rave.core.transform.Matrix)
  5992. */
  5993. /** @expose */
  5994. com_ibm_rave_core_transform_MatrixUtil.create = function(a, b, c, d, e, f) {
  5995. var matrix = com_ibm_rave_core_transform_MatrixUtil.identity();
  5996. matrix.a = a;
  5997. matrix.b = b;
  5998. matrix.c = c;
  5999. matrix.d = d;
  6000. matrix.e = e;
  6001. matrix.f = f;
  6002. return matrix;
  6003. };
  6004. /**
  6005. * Transform a point by this transform.
  6006. * @param (com.ibm.rave.core.geom.PointStruct) point Point to transform
  6007. * @param (com.ibm.rave.core.transform.Matrix) matrix Matrix to combine this point with.
  6008. * @return (com.ibm.rave.core.geom.PointStruct) new instance of a point that has been transformed.
  6009. */
  6010. /** @expose */
  6011. com_ibm_rave_core_transform_MatrixUtil.transformPoint = function(point, matrix) {
  6012. var x = point.x * matrix.a + point.y * matrix.b + matrix.e;
  6013. var y = point.x * matrix.c + point.y * matrix.d + matrix.f;
  6014. return new com_ibm_rave_core_geom_PointStruct(x, y);
  6015. };
  6016. /**
  6017. * Transform the four corners of a rectangle and extend the original bounds so they encapsulate the transformed rect. Returns a new RectStruct.
  6018. * @param (com.ibm.rave.core.geom.RectStruct) rect Rectangle to transform.
  6019. * @param (com.ibm.rave.core.transform.Matrix) matrix Matrix to apply to rectangle transform.
  6020. * @return (com.ibm.rave.core.geom.RectStruct) New RectStruct with the new bounds encapsulating the transformed rect.
  6021. */
  6022. /** @expose */
  6023. com_ibm_rave_core_transform_MatrixUtil.transformBounds = function(rect, matrix) {
  6024. var minX = Infinity;
  6025. var minY = Infinity;
  6026. var maxX = -Infinity;
  6027. var maxY = -Infinity;
  6028. for (var __i_enFor0 = 0, __exp_enFor0 = com_ibm_rave_core_transform_MatrixUtil.transformCorners(rect, matrix), __len_enFor0 = __exp_enFor0.length;
  6029. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  6030. var point = __exp_enFor0[__i_enFor0];
  6031. if (point.x < minX) {
  6032. minX = point.x;
  6033. } else if (point.x >= maxX) {
  6034. maxX = point.x;
  6035. }
  6036. if (point.y < minY) {
  6037. minY = point.y;
  6038. } else if (point.y >= maxY) {
  6039. maxY = point.y;
  6040. }
  6041. }
  6042. return new com_ibm_rave_core_geom_RectStruct(minX, minY, maxX - minX, maxY - minY);
  6043. };
  6044. /**
  6045. * Transform the four corners of a RectStruct based on a transform matrix. Returns new RaveRect.
  6046. * @param (com.ibm.rave.core.geom.RectStruct) rect Rectangle to transform
  6047. * @param (com.ibm.rave.core.transform.Matrix) matrix Matrix to combine this rect with.
  6048. * @return (Array) List of 4 corner points that have been transformed.
  6049. */
  6050. com_ibm_rave_core_transform_MatrixUtil.transformCorners = function(rect, matrix) {
  6051. var corners = [];
  6052. corners.push(new com_ibm_rave_core_geom_PointStruct(rect.x, rect.y));
  6053. corners.push(new com_ibm_rave_core_geom_PointStruct(rect.x + rect.width, rect.y));
  6054. corners.push(new com_ibm_rave_core_geom_PointStruct(rect.x, rect.y + rect.height));
  6055. corners.push(new com_ibm_rave_core_geom_PointStruct(rect.x + rect.width, rect.y + rect.height));
  6056. return com_ibm_rave_core_transform_MatrixUtil.transformPoints(corners, matrix);
  6057. };
  6058. com_ibm_rave_core_transform_MatrixUtil.transformPoints = function(points, matrix) {
  6059. var transformedPoints = [];
  6060. for (var __i_enFor0 = 0, __exp_enFor0 = points, __len_enFor0 = __exp_enFor0.length;
  6061. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  6062. var point = __exp_enFor0[__i_enFor0];
  6063. transformedPoints.push(com_ibm_rave_core_transform_MatrixUtil.transformPoint(point, matrix));
  6064. }
  6065. return transformedPoints;
  6066. };
  6067. /**
  6068. * Create a an identity (initial) matrix.
  6069. * @return (com.ibm.rave.core.transform.Matrix) identity matrix
  6070. */
  6071. /** @expose */
  6072. com_ibm_rave_core_transform_MatrixUtil.identity = function() {
  6073. return new com_ibm_rave_core_transform_Matrix(1, 0, 0, 1, 0, 0);
  6074. };
  6075. // $source: com/ibm/rave/core/internal/nativeImpl/scene/DOMSceneNode
  6076. /************************************************************************
  6077. ** IBM Confidential
  6078. **
  6079. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6080. **
  6081. ** (C) Copyright IBM Corp. 2014, 2015
  6082. **
  6083. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6084. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6085. ************************************************************************/
  6086. // @import com/ibm/rave/core/nativeImpl/Declare
  6087. // @import com/ibm/rave/core/nativeImpl/format/Requote
  6088. // @import com/ibm/rave/core/nativeImpl/Object
  6089. // @import com/ibm/rave/core/scene/SceneNodeType
  6090. // @import com/ibm/rave/core/transform/MatrixUtil
  6091. /**
  6092. * Represents all DOM nodes.
  6093. */
  6094. (function() {
  6095. function classed(domNode, className, add) {
  6096. // split given className into an array
  6097. var classes = className.match(/\S+/g) || [];
  6098. if (classes.length) {
  6099. // mimic node.className which is always a string value
  6100. var domClassName = domNode.getAttribute("class") || "";
  6101. // create a string where each value is separated by a single space
  6102. // and contains spaces at the beginning and end to help with indexOf searches
  6103. var newClassName = (domClassName
  6104. ? (" " + domClassName + " ").replace( /[\t\r\n\f]/g, " ")
  6105. : " ");
  6106. for (var i = 0; i < classes.length; i++) {
  6107. var clazz = classes[i];
  6108. if (add) {
  6109. // add
  6110. if (newClassName.indexOf(" " + clazz + " ") < 0 ) {
  6111. // append to end
  6112. newClassName += clazz + " ";
  6113. }
  6114. } else {
  6115. // remove
  6116. if (newClassName.indexOf(" " + clazz + " ") >= 0 ) {
  6117. // replace with empty space
  6118. newClassName = newClassName.replace(" " + clazz + " ", " ");
  6119. }
  6120. }
  6121. }
  6122. // trim beginning and end spaces
  6123. // assumes string#trim exists
  6124. newClassName = newClassName ? newClassName.trim() : "";
  6125. if (domClassName !== newClassName) {
  6126. domNode.setAttribute("class", newClassName);
  6127. return true;
  6128. }
  6129. } else {
  6130. return true;
  6131. }
  6132. return false;
  6133. }
  6134. var protoExt = {
  6135. _rave_isDOM : true,
  6136. /** @expose */
  6137. rave_getOwner : function() {
  6138. // SVG node
  6139. if ("http://www.w3.org/2000/svg" == this.namespaceURI) {
  6140. var svgOwner = this.ownerSVGElement;
  6141. if (svgOwner) {
  6142. svgOwner = svgOwner["__owner__"] || svgOwner;
  6143. } else {
  6144. svgOwner = this["__owner__"];
  6145. }
  6146. // TODO do we need to extend the node here?
  6147. return svgOwner || this;
  6148. }
  6149. // DOM node
  6150. return this;
  6151. },
  6152. /** @expose */
  6153. rave_setOwner : function(owner) {
  6154. this["__owner__"] = owner;
  6155. },
  6156. /** @expose */
  6157. rave_getParentNode : function(owner) {
  6158. return this.parentNode;
  6159. },
  6160. /** @expose */
  6161. rave_appendChild : function(node) {
  6162. if (node._rave_isDOM) {
  6163. this.appendChild(node);
  6164. }
  6165. },
  6166. /** @expose */
  6167. rave_insertBefore : function(node, before) {
  6168. if (node._rave_isDOM) {
  6169. this.insertBefore(node, before);
  6170. }
  6171. },
  6172. /** @expose */
  6173. rave_setStyle : function(style, value, priority) {
  6174. this.style.setProperty(style, value, priority);
  6175. },
  6176. /** @expose */
  6177. rave_getStyle : function(style) {
  6178. return this.style.getPropertyValue(style);
  6179. },
  6180. /** @expose */
  6181. rave_removeStyle : function(style) {
  6182. this.style.removeProperty(style);
  6183. },
  6184. /** @expose */
  6185. rave_setText : function(text) {
  6186. this.textContent = text;
  6187. },
  6188. /** @expose */
  6189. rave_getText : function() {
  6190. return this.textContent;
  6191. },
  6192. /** @expose */
  6193. rave_setHtml : function(html) {
  6194. this.innerHTML = html;
  6195. },
  6196. /** @expose */
  6197. rave_getHtml : function() {
  6198. return this.innerHTML;
  6199. },
  6200. /** @expose */
  6201. rave_getComputedStyle : function(style) {
  6202. return rave_window(this).getComputedStyle(this).getPropertyValue(style);
  6203. },
  6204. /** @expose */
  6205. rave_containsClass : function(className) {
  6206. var check = className.match(/\S+/g);
  6207. if (check && check.length) {
  6208. var classList = this.classList;
  6209. if (classList && classList.length) {
  6210. for (var i = 0; i < check.length; ++i) {
  6211. if (!classList.contains(check[i])) {
  6212. return false;
  6213. }
  6214. }
  6215. return true;
  6216. } else {
  6217. classList = (this.getAttribute("class") || "").match(/\S+/g);
  6218. if (classList && classList.length) {
  6219. for ( var i = 0; i < check.length; ++i) {
  6220. if (classList.indexOf(check[i]) == -1) {
  6221. return false;
  6222. }
  6223. }
  6224. return true;
  6225. }
  6226. }
  6227. return false;
  6228. }
  6229. return true;
  6230. },
  6231. /** @expose */
  6232. rave_addClass : function(className) {
  6233. return classed(this, className, true);
  6234. },
  6235. /** @expose */
  6236. rave_removeClass : function(className) {
  6237. return classed(this, className, false);
  6238. },
  6239. /** @expose */
  6240. rave_getEventListener : function(eventType) {
  6241. return this["__on" + eventType];
  6242. },
  6243. /** @expose */
  6244. rave_addEventListener : function(eventType, listener, useCapture, group) {
  6245. var domNode = this,
  6246. name = "__on" + eventType + (group != null ? "." + group : ""),
  6247. existing = domNode[name];
  6248. if (existing) {
  6249. // remove existing listener
  6250. domNode.removeEventListener(eventType, existing, existing.__useCapture);
  6251. }
  6252. listener.__useCapture = useCapture;
  6253. // storing properties on the dom node is slower
  6254. domNode[name] = listener;
  6255. domNode.addEventListener(eventType, listener, useCapture);
  6256. },
  6257. /** @expose */
  6258. rave_removeEventListener : function(eventType, group) {
  6259. var domNode = this,
  6260. name = "__on" + eventType + (group != null ? "." + group : ""),
  6261. l = domNode[name];
  6262. if (l) {
  6263. domNode.removeEventListener(eventType, l, l.__useCapture);
  6264. delete domNode[name];
  6265. }
  6266. },
  6267. /** @expose */
  6268. rave_removeEventListeners : function(group) {
  6269. if (group != null) {
  6270. group = "\." + com_ibm_rave_core_nativeImpl_format_Requote.requote(group);
  6271. }
  6272. var domNode = this,
  6273. re = new RegExp("^__on([^.]+)" + group + "$"),
  6274. match;
  6275. for (var name in domNode) {
  6276. if (match = name.match(re)) {
  6277. var l = domNode[name];
  6278. domNode.removeEventListener(match[1], l, l.__useCapture);
  6279. delete domNode[name];
  6280. }
  6281. }
  6282. },
  6283. /** @expose */
  6284. rave_setData : function(newData) {
  6285. this["__data__"] = newData;
  6286. },
  6287. /** @expose */
  6288. rave_getData : function() {
  6289. return this["__data__"];
  6290. },
  6291. /** @expose */
  6292. rave_hasData : function() {
  6293. return "__data__" in this;
  6294. },
  6295. /** @expose */
  6296. rave_setProperty : function(key, value) {
  6297. if (value == null) {
  6298. delete this[key];
  6299. } else {
  6300. this[key] = value;
  6301. }
  6302. },
  6303. /** @expose */
  6304. rave_getProperty : function(key) {
  6305. return this[key];
  6306. },
  6307. /** @expose */
  6308. rave_hasProperty : function(propName) {
  6309. return propName in this;
  6310. },
  6311. /** @expose */
  6312. rave_getNextSibling : function() {
  6313. return this.nextElementSibling;
  6314. },
  6315. /** @expose */
  6316. rave_getPreviousSibling : function() {
  6317. return this.previousElementSibling;
  6318. },
  6319. /** @expose */
  6320. rave_getFirstChild : function() {
  6321. if (this.hasChildNodes()) {
  6322. var children = this.childNodes;
  6323. for (var i = 0; i < children.length; i++) {
  6324. if (children[i].nodeType == 1) {
  6325. return children[i];
  6326. }
  6327. }
  6328. }
  6329. return false;
  6330. },
  6331. /** @expose */
  6332. rave_hasChildNodes : function() {
  6333. if (this.hasChildNodes()) {
  6334. var children = this.childNodes;
  6335. for (var i = 0; i < children.length; i++) {
  6336. if (children[i].nodeType == 1) {
  6337. return true;
  6338. }
  6339. }
  6340. }
  6341. return false;
  6342. },
  6343. /** @expose */
  6344. rave_getChildNodes : function() {
  6345. if (this.hasChildNodes()) {
  6346. var result = [], children = this.childNodes;
  6347. for (var i = 0; i < children.length; i++) {
  6348. if (children[i].nodeType == 1) {
  6349. result.push(children[i]);
  6350. }
  6351. }
  6352. return result;
  6353. }
  6354. return this.childNodes;
  6355. },
  6356. /** @expose */
  6357. rave_getName : function() {
  6358. return this.nodeName;
  6359. },
  6360. /** @expose */
  6361. rave_getNamespaceURI : function() {
  6362. return this.namespaceURI;
  6363. },
  6364. /** @expose */
  6365. rave_getQualifiedName : function() {
  6366. return this.namespaceURI + ":" + this.nodeName;
  6367. },
  6368. /** @expose */
  6369. rave_getNodeType : function() {
  6370. return this.nodeType;
  6371. },
  6372. /** @expose */
  6373. rave_initExtensions : function() {
  6374. // no extensions by default
  6375. },
  6376. /** @expose */
  6377. rave_getDrawType: function() {
  6378. // This is a list of internally supported node types. Only SVG nodes are supported here, not DOM nodes of any kind.
  6379. // TODO - we cannot determine the difference between line, circle and other path shapes in SVG since they are all <path> nodes
  6380. // TODO - do we need to tell the difference between these?
  6381. // TODO - currently this is only used in Mirroring to determine if a node is a group node.
  6382. switch (this.nodeName) {
  6383. case "text":
  6384. return com_ibm_rave_core_scene_SceneNodeType.TEXT;
  6385. case "image":
  6386. return com_ibm_rave_core_scene_SceneNodeType.IMAGE;
  6387. case "#text":
  6388. return com_ibm_rave_core_scene_SceneNodeType.TEXT_CONTENT;
  6389. case "g":
  6390. return com_ibm_rave_core_scene_SceneNodeType.GROUP;
  6391. case "rect":
  6392. return com_ibm_rave_core_scene_SceneNodeType.RECT;
  6393. default:
  6394. return com_ibm_rave_core_scene_SceneNodeType.UNKNOWN;
  6395. }
  6396. },
  6397. // TODO Firefox does not support svg#checkIntersection or svg#getIntersectionList
  6398. /** @expose */
  6399. rave_intersects : function(x, y) {
  6400. var svgOwner = this.ownerSVGElement, rect = getSVGRect(svgOwner, this, x, y);
  6401. return rect ? svgOwner.checkIntersection(this, rect) : false;
  6402. },
  6403. /** @expose */
  6404. rave_intersectionList : function(x, y) {
  6405. var svgOwner = this.ownerSVGElement, rect = getSVGRect(svgOwner, this, x, y);
  6406. return rect ? svgOwner.getIntersectionList(rect, this) : [];
  6407. },
  6408. /** @expose */
  6409. rave_intersection : function(x, y) {
  6410. return this.rave_intersectionList(x, y)[0];
  6411. },
  6412. /** @expose */
  6413. rave_dispose : function() {
  6414. var canvasRoot = this.rave_getProperty("__rave_canvas_root__");
  6415. if (canvasRoot) {
  6416. canvasRoot.dispose();
  6417. }
  6418. }
  6419. };
  6420. // converts a point or rect to an svg rect
  6421. function getSVGRect(owner, node, x, y) {
  6422. var rect = x, ctm, x2, y2, tmp = x;
  6423. if (svgOwner && !(rect instanceof SVGRect)) {
  6424. if (arguments.length == 4) {
  6425. tmp = {};
  6426. tmp.width = tmp.height = 1;
  6427. tmp.x = x;
  6428. tmp.y = y;
  6429. }
  6430. if (ctm = node.getCTM()) {
  6431. tmp = com_ibm_rave_core_internal_transform_MatrixUtil.transformRect(tmp, ctm);
  6432. }
  6433. // create an SVG rect
  6434. rect = svgOwner.createSVGRect();
  6435. rect.x = tmp.x;
  6436. rect.y = tmp.y;
  6437. rect.width = tmp.width;
  6438. rect.height = tmp.height;
  6439. }
  6440. return rect;
  6441. }
  6442. var type;
  6443. // extend iframe prototype
  6444. if (rave_document && rave_window(this)) {
  6445. if (rave_window(this).frameElement) {
  6446. com_ibm_rave_core_nativeImpl_Object.mixin(Object.getPrototypeOf(rave_window(this).frameElement), protoExt);
  6447. }
  6448. // extend window prototype
  6449. com_ibm_rave_core_nativeImpl_Object.mixin(Object.getPrototypeOf(rave_window(this)), protoExt);
  6450. // extend document prototype
  6451. com_ibm_rave_core_nativeImpl_Object.mixin(((type = rave_window(this)["Document"]) ? type.prototype : type) || Object.getPrototypeOf(document), protoExt);
  6452. // extend DOM element and SVG prototypes
  6453. com_ibm_rave_core_nativeImpl_Object.mixin(((type = rave_window(this)["Node"]) ? type.prototype : type) ||
  6454. Object.getPrototypeOf(rave_document.body),
  6455. protoExt);
  6456. com_ibm_rave_core_nativeImpl_Object.mixin(((type = (rave_window(this)["SVGElement"] || rave_window(this)["SVGGraphicsElement"])) ? type.prototype : type) ||
  6457. Object.getPrototypeOf(rave_document.createElementNS("http://www.w3.org/2000/svg", "svg")),
  6458. protoExt);
  6459. }
  6460. })();
  6461. // $source: com/ibm/rave/core/internal/nativeImpl/selector/DOMSelectionQueryEngine
  6462. /************************************************************************
  6463. ** IBM Confidential
  6464. **
  6465. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6466. **
  6467. ** (C) Copyright IBM Corp. 2014, 2015
  6468. **
  6469. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6470. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6471. ************************************************************************/
  6472. // @import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6473. /**
  6474. * A CSS3 selection query engine for DOM nodes.
  6475. * @author sproulja
  6476. */
  6477. var com_ibm_rave_core_internal_nativeImpl_selector_DOMSelectionQueryEngine = com_ibm_rave_core_nativeImpl_Declare({
  6478. matches : (function() {
  6479. if (rave_document) {
  6480. var documentElement = rave_documentElement(rave_document);
  6481. var matches = documentElement.matches || documentElement[vendorSymbol(documentElement, "matchesSelector")]
  6482. return function(context, selectorString) {
  6483. return matches.call(context, selectorString);
  6484. };
  6485. }
  6486. })(),
  6487. querySelector : function(query, rootNode) {
  6488. return (rootNode || rave_document).querySelector(query);
  6489. },
  6490. querySelectorAll : function(query, rootNode) {
  6491. return (rootNode || rave_document).querySelectorAll(query);
  6492. }
  6493. });
  6494. // $source: com/ibm/rave/core/internal/selector/mirror/MirrorConstants
  6495. /************************************************************************
  6496. ** IBM Confidential
  6497. **
  6498. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6499. **
  6500. ** (C) Copyright IBM Corp. 2015
  6501. **
  6502. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6503. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6504. ************************************************************************/
  6505. // GENERATED
  6506. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6507. /**
  6508. * Simple class that holds property names for mirrored nodes.
  6509. * @author jim
  6510. */
  6511. var com_ibm_rave_core_internal_selector_mirror_MirrorConstants = com_ibm_rave_core_nativeImpl_Declare({
  6512. });
  6513. /**
  6514. * all mirrored items get this property to signify that they are mirrored for future selections
  6515. */
  6516. com_ibm_rave_core_internal_selector_mirror_MirrorConstants.MIRRORED_PROPERTY = "__rave-mirrored__";
  6517. /**
  6518. * grouping nodes for text and images get this property
  6519. */
  6520. com_ibm_rave_core_internal_selector_mirror_MirrorConstants.MIRRORED_GROUP_PROPERTY = "__rave-mirrored-group__";
  6521. /**
  6522. * This is a property flag used to determine if we want 'raw' access to a node Used when creating 'wrapping' mirroring groups around a node. When appending, we want the 'real' nodes, not the filtered ones.
  6523. */
  6524. com_ibm_rave_core_internal_selector_mirror_MirrorConstants.RAW_NODE_ACCESS_PROPERTY = "__rave-raw-node-access__";
  6525. /**
  6526. * Property used to hold the 'group' wrapping node reference. Used on 'owner' (svg) nodes.
  6527. */
  6528. com_ibm_rave_core_internal_selector_mirror_MirrorConstants.GROUP_NODE_PROPERTY = "__rave-group-node-property__";
  6529. /**
  6530. * Property used to hold the 'parent' wrapping node reference - used on Text and Image nodes.
  6531. */
  6532. com_ibm_rave_core_internal_selector_mirror_MirrorConstants.PARENT_WRAPPING_NODE_PROPERTY = "__rave-parent-wrapping-node-property__";
  6533. /**
  6534. * Property set on wrapping groups under owner nodes, or other group nodes. These nodes contain the main scale(-1,1) transform on them - they do the mirroring work.
  6535. */
  6536. com_ibm_rave_core_internal_selector_mirror_MirrorConstants.MIRRORED_OWNER_GROUP_NODE_PROPERTY = "__rave-owner-group-node-property__";
  6537. /**
  6538. * The original transform applied to a node by an external source.
  6539. */
  6540. com_ibm_rave_core_internal_selector_mirror_MirrorConstants.ORIGINAL_TRANSFORM = "__rave-original-transform__";
  6541. // $source: com/ibm/rave/core/internal/selector/mirror/MirrorUtil
  6542. /************************************************************************
  6543. ** IBM Confidential
  6544. **
  6545. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6546. **
  6547. ** (C) Copyright IBM Corp. 2015
  6548. **
  6549. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6550. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6551. ************************************************************************/
  6552. // GENERATED
  6553. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6554. //@import com/ibm/rave/core/internal/selector/mirror/MirrorConstants (static) // MirrorConstants
  6555. /**
  6556. * Helper methods to determine properties on scene nodes for mirroring.
  6557. * @author jim
  6558. */
  6559. var com_ibm_rave_core_internal_selector_mirror_MirrorUtil = com_ibm_rave_core_nativeImpl_Declare({
  6560. });
  6561. /**
  6562. * Is the passed node mirrored or not. Determines based on a special attribute set on the node.
  6563. * @return (boolean) is this node mirrored
  6564. */
  6565. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isMirrored = function(node) {
  6566. return (node.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.MIRRORED_PROPERTY));
  6567. };
  6568. /**
  6569. * Helper static utility to determine if the passed item is a wrapping group node. This means a wrapping
  6570. * @param (com.ibm.rave.core.scene.SceneNode) node SceneNode that may or may not be a wrapping group node.
  6571. * @return (boolean) <code>true</code> if item is a mirrored group node, <code>false</code> otherwise.
  6572. */
  6573. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isGroupNode = function(node) {
  6574. return node && ((node.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.MIRRORED_GROUP_PROPERTY)) || com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isOwnerGroupNode(node));
  6575. };
  6576. /**
  6577. * Helper static utility to determine if the passed node is a group underneath an owner node. This is the primary mirroring group node (with the Scale(-1,1) transform).
  6578. * @param (com.ibm.rave.core.scene.SceneNode) node Check if this node is a wrapping group node under an owner.
  6579. * @return (boolean) <code>true</code> if this node is an 'owner' grouping node. <code>false</code> otherwise.
  6580. */
  6581. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isOwnerGroupNode = function(node) {
  6582. return node && ((node.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.MIRRORED_OWNER_GROUP_NODE_PROPERTY)));
  6583. };
  6584. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isWrappableNode = function(node) {
  6585. var drawType = node.rave_getDrawType();
  6586. return drawType == 1003 || drawType == 1007;
  6587. };
  6588. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isGroupOrOwnerNode = function(node) {
  6589. return node == node.rave_getOwner() || node.rave_getDrawType() == 1004;
  6590. };
  6591. /**
  6592. * Set raw node on this node. Actually sets raw node for the entire tree starting at this node's owner node. Raw node is used to bypass additional logic in mirrored nodes that recognizes group nodes that are only used for mirroring - these are typically ignored.
  6593. * @param (com.ibm.rave.core.scene.SceneNode) node
  6594. * @param (boolean) value
  6595. */
  6596. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode = function(node, value) {
  6597. node.rave_getOwner().rave_setProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.RAW_NODE_ACCESS_PROPERTY, value ? value : null);
  6598. };
  6599. /**
  6600. * Determine if 'raw' node is enabled for this node's owner hierarchy. Raw node is used to bypass additional logic in mirrored nodes that recognizes group nodes that are only used for mirroring - these are typically ignored.
  6601. * @param (com.ibm.rave.core.scene.SceneNode) node Node to check
  6602. * @return (boolean)
  6603. */
  6604. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isRawMode = function(node) {
  6605. return ((node.rave_getOwner().rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.RAW_NODE_ACCESS_PROPERTY)));
  6606. };
  6607. // $source: com/ibm/rave/core/internal/selector/mirror/OwnerMirroredSceneNodeHelper
  6608. /************************************************************************
  6609. ** IBM Confidential
  6610. **
  6611. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6612. **
  6613. ** (C) Copyright IBM Corp. 2015
  6614. **
  6615. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6616. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6617. ************************************************************************/
  6618. // GENERATED
  6619. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6620. //@import com/ibm/rave/core/internal/selector/mirror/MirrorConstants (static) // MirrorConstants
  6621. //@import com/ibm/rave/core/internal/nativeImpl/scene/SceneNodeUtil (runtime) // getOwnerBoundingClientRect
  6622. //@import com/ibm/rave/core/internal/selector/mirror/MirrorUtil (static) // setRawNode
  6623. //@import com/ibm/rave/core/selector/Selector (runtime) // new
  6624. /**
  6625. * An "owner" scene node is one that contains a wrapping group node that performs the primary mirroring transform. These are typically created on 'svg' or 'canvas', etc nodes but may also be added to arbitrary group nodes. For instance, when mirroring a full svg node, the resulting tree looks like: &lt;svg>&lt;g "data-rave-mirror-owner"="true"&gt;{ children }&lt;/g&gt;&lt;/svg&gt;
  6626. * @author jim
  6627. */
  6628. var com_ibm_rave_core_internal_selector_mirror_OwnerMirroredSceneNodeHelper = com_ibm_rave_core_nativeImpl_Declare({
  6629. });
  6630. com_ibm_rave_core_internal_selector_mirror_OwnerMirroredSceneNodeHelper.mirror = function(node) {
  6631. if (!((node.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.GROUP_NODE_PROPERTY)))) {
  6632. var wrappingGroup = com_ibm_rave_core_internal_selector_mirror_OwnerMirroredSceneNodeHelper.createWrappingGroup(node);
  6633. node.rave_setProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.GROUP_NODE_PROPERTY, wrappingGroup);
  6634. com_ibm_rave_core_internal_selector_mirror_OwnerMirroredSceneNodeHelper.update(node);
  6635. }
  6636. };
  6637. /**
  6638. * Update the group node with new transform information.
  6639. * @param (com.ibm.rave.core.scene.SceneNode) node
  6640. */
  6641. com_ibm_rave_core_internal_selector_mirror_OwnerMirroredSceneNodeHelper.update = function(node) {
  6642. var group = node.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.GROUP_NODE_PROPERTY);
  6643. if (group != null) {
  6644. var translateWidth = com_ibm_rave_core_internal_nativeImpl_scene_SceneNodeUtil.getOwnerBoundingClientRect(node).width;
  6645. (group).setAttribute("transform", "translate(" + translateWidth + ",0)" + " scale(-1,1)");
  6646. }
  6647. };
  6648. com_ibm_rave_core_internal_selector_mirror_OwnerMirroredSceneNodeHelper.unmirror = function(node) {
  6649. var group = node.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.GROUP_NODE_PROPERTY);
  6650. if (group != null) {
  6651. var groupNode = group;
  6652. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(groupNode, true);
  6653. groupNode.rave_setProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.MIRRORED_GROUP_PROPERTY, null);
  6654. for (var __i_enFor0 = 0, __exp_enFor0 = groupNode.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  6655. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  6656. var child = __exp_enFor0[__i_enFor0];
  6657. node.rave_appendChild(child);
  6658. }
  6659. node.removeChild(groupNode);
  6660. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(groupNode, false);
  6661. }
  6662. node.rave_setProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.MIRRORED_PROPERTY, null);
  6663. node.rave_setProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.GROUP_NODE_PROPERTY, null);
  6664. };
  6665. /**
  6666. * Create our main wrapping group around this owner node. For a mirrored svg node, we'll create something like this: <svg><g transform="scale(-1,1)"/><child nodes></svg>
  6667. * @return (com.ibm.rave.core.scene.SceneNode) new wrapping group node
  6668. */
  6669. com_ibm_rave_core_internal_selector_mirror_OwnerMirroredSceneNodeHelper.createWrappingGroup = function(node) {
  6670. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(node, true);
  6671. var existingChildren = [];
  6672. for (var __i_enFor0 = 0, __exp_enFor0 = node.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  6673. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  6674. var child = __exp_enFor0[__i_enFor0];
  6675. existingChildren.push(child);
  6676. }
  6677. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(node, false);
  6678. var group = new com_ibm_rave_core_selector_Selector().init(node).append("g");
  6679. group.property(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.MIRRORED_GROUP_PROPERTY, true);
  6680. group.property(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.MIRRORED_OWNER_GROUP_NODE_PROPERTY, true);
  6681. group.property(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.MIRRORED_PROPERTY, true);
  6682. var groupNode = group.node();
  6683. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(groupNode, true);
  6684. for (var __i_enFor1 = 0, __exp_enFor1 = existingChildren, __len_enFor1 = __exp_enFor1.length;
  6685. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  6686. var child = __exp_enFor1[__i_enFor1];
  6687. groupNode.rave_appendChild(child);
  6688. }
  6689. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(groupNode, false);
  6690. return groupNode;
  6691. };
  6692. // $source: com/ibm/rave/core/internal/selector/mirror/WrappedMirroredSceneNodeHelper
  6693. /************************************************************************
  6694. ** IBM Confidential
  6695. **
  6696. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6697. **
  6698. ** (C) Copyright IBM Corp. 2015
  6699. **
  6700. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6701. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6702. ************************************************************************/
  6703. // GENERATED
  6704. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6705. //@import com/ibm/rave/core/internal/selector/mirror/MirrorConstants (static) // MirrorConstants
  6706. //@import com/ibm/rave/core/internal/selector/mirror/MirrorUtil (static) // setRawNode
  6707. //@import com/ibm/rave/core/selector/Selector (runtime) // new
  6708. /**
  6709. * Helper methods for working with 'wrapped' mirrored scene nodes. These are nodes like text and image nodes that when mirrored are wrapped inside a parent wrapping group.
  6710. * @author jim
  6711. */
  6712. var com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper = com_ibm_rave_core_nativeImpl_Declare({
  6713. });
  6714. com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.mirror = function(node) {
  6715. var wrappingGroup = com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.createWrappingGroup(node);
  6716. node.rave_setProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.PARENT_WRAPPING_NODE_PROPERTY, wrappingGroup);
  6717. };
  6718. /**
  6719. * Remove the wrapping parent node from this node, causing it to be 'un' mirrored.
  6720. */
  6721. com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.unmirror = function(node) {
  6722. var group = com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.findWrappingGroup(node);
  6723. if (group) {
  6724. group.rave_setProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.MIRRORED_GROUP_PROPERTY, null);
  6725. var parent = group.rave_getParentNode();
  6726. parent.rave_appendChild(node);
  6727. parent.removeChild(group);
  6728. node.rave_setProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.PARENT_WRAPPING_NODE_PROPERTY, null);
  6729. }
  6730. };
  6731. /**
  6732. * Create a wrapping group around this node. The wrapper will be something like this: &lt;g data-rave-mirrored="true" data-rave-mirrored-group="true" transform="translate(0,0) scale(-1,1)"> &lt;text y="18" dy=".71em" data-rave-mirrored="true" style="text-anchor: middle;"&gt;0&lt;/text&gt; &lt;/g&gt; This always returns a 'raw' node, not a MirroredSceneNode.
  6733. */
  6734. com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.createWrappingGroup = function(child) {
  6735. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(child, true);
  6736. var parent = child.rave_getParentNode();
  6737. var group = new com_ibm_rave_core_selector_Selector().init(parent).append("g");
  6738. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(child, false);
  6739. parent.rave_insertBefore(group.node(), child);
  6740. var groupNode = group.node();
  6741. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(groupNode, true);
  6742. group.property(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.MIRRORED_GROUP_PROPERTY, true);
  6743. groupNode.rave_appendChild(child);
  6744. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(groupNode, false);
  6745. return groupNode;
  6746. };
  6747. /**
  6748. * Return if this node has a wrapping group. These groups are currently applied to Text and Image nodes.
  6749. * @return (com.ibm.rave.core.scene.SceneNode) SceneNode containing this node's wrapping group. Null if it doesn't have one.
  6750. */
  6751. com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.findWrappingGroup = function(node) {
  6752. var parentNode = node.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.PARENT_WRAPPING_NODE_PROPERTY);
  6753. if (parentNode != null) {
  6754. return parentNode;
  6755. }
  6756. return null;
  6757. };
  6758. com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.update = function(node) {
  6759. var wrappingGroup = node.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.PARENT_WRAPPING_NODE_PROPERTY);
  6760. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(node, true);
  6761. if (wrappingGroup != null) {
  6762. var originalTransform = com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.determineOriginalTransform(node);
  6763. var rect = node.getBBox();
  6764. var translateAmount = rect.width + 2 * rect.x;
  6765. node.setAttribute("transform", originalTransform + " translate(" + translateAmount + ",0) scale(-1,1)");
  6766. } else {
  6767. var transform = com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.determineOriginalTransform(node);
  6768. if (transform.length > 0) {
  6769. node.setAttribute("transform", transform);
  6770. } else {
  6771. node.removeAttribute("transform");
  6772. }
  6773. }
  6774. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(node, false);
  6775. };
  6776. com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.determineOriginalTransform = function(node) {
  6777. var origTransform = node.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.ORIGINAL_TRANSFORM);
  6778. var transform = "";
  6779. if (origTransform != null) {
  6780. transform = origTransform;
  6781. } else {
  6782. var trans = node.getAttribute("transform");
  6783. transform = trans != null ? trans : "";
  6784. node.rave_setProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.ORIGINAL_TRANSFORM, transform);
  6785. }
  6786. return transform;
  6787. };
  6788. com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.TRANSFORM = "transform";
  6789. // $source: com/ibm/rave/core/internal/selector/mirror/MirroredSceneNodeHelper
  6790. /************************************************************************
  6791. ** IBM Confidential
  6792. **
  6793. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6794. **
  6795. ** (C) Copyright IBM Corp. 2015
  6796. **
  6797. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6798. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6799. ************************************************************************/
  6800. // GENERATED
  6801. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6802. //@import com/ibm/rave/core/internal/selector/mirror/MirrorConstants (static) // MirrorConstants
  6803. //@import com/ibm/rave/core/internal/selector/mirror/OwnerMirroredSceneNodeHelper (static) // unmirror, update, mirror
  6804. //@import com/ibm/rave/core/internal/selector/mirror/WrappedMirroredSceneNodeHelper (static) // unmirror, update, mirror
  6805. //@import com/ibm/rave/core/internal/selector/mirror/MirrorUtil (static) // isWrappableNode, isMirrored, isGroupOrOwnerNode
  6806. //@import com/ibm/rave/core/Configuration (static) // Configuration
  6807. /**
  6808. * A static helper class that handles mirroring operations on existing SceneNodes. Includes static methods to mirror and un-mirror nodes and methods to retrieve special mirroring group nodes.
  6809. * @author jim
  6810. */
  6811. var com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper = com_ibm_rave_core_nativeImpl_Declare({
  6812. });
  6813. /**
  6814. * Internal static method used to update mirroring positioning on a passed node. This only applies to those nodes that require special mirror wrapping.
  6815. * @param (com.ibm.rave.core.scene.SceneNode) node
  6816. */
  6817. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.update = function(node) {
  6818. if (!node) {
  6819. return;
  6820. }
  6821. if ((node.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.GROUP_NODE_PROPERTY))) {
  6822. com_ibm_rave_core_internal_selector_mirror_OwnerMirroredSceneNodeHelper.update(node);
  6823. } else {
  6824. switch (node.rave_getDrawType()) {
  6825. case 1003:
  6826. case 1007:
  6827. com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.update(node);
  6828. break;
  6829. default:
  6830. break;
  6831. }
  6832. }
  6833. };
  6834. /**
  6835. * Perform a mirroring operation on a passed in node.
  6836. * @param (com.ibm.rave.core.scene.SceneNode) node The node to be mirrored.
  6837. */
  6838. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.mirrorNode = function(node) {
  6839. if (!(com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isMirrored(node))) {
  6840. com_ibm_rave_core_Configuration.INSTANCE.extendRecursive(node);
  6841. if (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isWrappableNode(node)) {
  6842. com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.mirror(node);
  6843. }
  6844. node.rave_setProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.MIRRORED_PROPERTY, true);
  6845. }
  6846. for (var __i_enFor0 = 0, __exp_enFor0 = node.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  6847. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  6848. var child = __exp_enFor0[__i_enFor0];
  6849. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.mirrorNode(child);
  6850. }
  6851. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.update(node);
  6852. };
  6853. /**
  6854. * Perform a mirroring operation at a 'root' owner or group node. Recursively mirrors all children.
  6855. * @param (com.ibm.rave.core.scene.SceneNode) context The root node to start at.
  6856. */
  6857. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.mirrorRoot = function(context) {
  6858. if (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isGroupOrOwnerNode(context)) {
  6859. com_ibm_rave_core_Configuration.INSTANCE.extendRecursive(context);
  6860. if (!(com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isMirrored(context))) {
  6861. com_ibm_rave_core_internal_selector_mirror_OwnerMirroredSceneNodeHelper.mirror(context);
  6862. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.mirrorNode(context);
  6863. }
  6864. }
  6865. };
  6866. /**
  6867. * Perform an 'un' mirroring of the passed in node. Recursively removes all mirroring properties.
  6868. * @param (com.ibm.rave.core.scene.SceneNode) node Node to recursively 'un'-mirror.
  6869. */
  6870. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.unMirrorNode = function(node) {
  6871. if ((node.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.GROUP_NODE_PROPERTY))) {
  6872. com_ibm_rave_core_internal_selector_mirror_OwnerMirroredSceneNodeHelper.unmirror(node);
  6873. } else if (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isWrappableNode(node)) {
  6874. com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.unmirror(node);
  6875. }
  6876. node.rave_setProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.MIRRORED_PROPERTY, null);
  6877. for (var __i_enFor0 = 0, __exp_enFor0 = node.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  6878. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  6879. var child = __exp_enFor0[__i_enFor0];
  6880. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.unMirrorNode(child);
  6881. }
  6882. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.update(node);
  6883. };
  6884. // $source: com/ibm/rave/core/internal/selector/mirror/MirroredSceneNodeExtension
  6885. /************************************************************************
  6886. ** IBM Confidential
  6887. **
  6888. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6889. **
  6890. ** (C) Copyright IBM Corp. 2015
  6891. **
  6892. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6893. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6894. ************************************************************************/
  6895. // GENERATED
  6896. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6897. //@import com/ibm/rave/core/Rave (runtime) // Rave
  6898. //@import com/ibm/rave/core/internal/selector/mirror/MirrorUtil (runtime) // isRawMode, isGroupNode, isMirrored, isOwnerGroupNode
  6899. //@import com/ibm/rave/core/internal/selector/mirror/MirroredSceneNodeHelper (runtime) // mirrorNode, update
  6900. //@import com/ibm/rave/core/internal/selector/mirror/MirrorConstants (runtime) // MirrorConstants
  6901. /**
  6902. * Extensions for an 'owner' mirrored scene node. These are typically 'owner' nodes (SVG for example). Once mirrored, they contain a single group node with a mirroring transform.
  6903. * @author jim
  6904. */
  6905. var com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeExtension = com_ibm_rave_core_nativeImpl_Declare({
  6906. });
  6907. /**
  6908. * Extend this node to provide mirroring functionality.
  6909. * @param (com.ibm.rave.core.scene.SceneNode) node Scene node to extend with mirroring
  6910. */
  6911. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeExtension.extend = function(node) {
  6912. var origGetChildNodes = node.rave_getChildNodes;
  6913. var origHasChildNodes = node.rave_hasChildNodes;
  6914. var origRemoveChild = node.removeChild;
  6915. var origGetParent = node.rave_getParentNode;
  6916. var origAppendChild = node.appendChild;
  6917. var origInsertBefore = node.insertBefore;
  6918. var origGetNextSibling = node.rave_getNextSibling;
  6919. var origGetPreviousSibling = node.rave_getPreviousSibling;
  6920. var origGetFirstChild = node.rave_getFirstChild;
  6921. var origSetTextExt = node.rave_setText;
  6922. var origSetStyleExt = node.rave_setStyle;
  6923. var origSetAttributeExt = node.setAttribute;
  6924. var origGetScreenCTM = node.getScreenCTM;
  6925. var origGetCTM = node.getCTM;
  6926. node.appendChild = function(appendChild) {
  6927. com_ibm_rave_core_Rave.configuration.extendRecursive(appendChild);
  6928. if (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isRawMode(this)) {
  6929. origAppendChild.call(this, appendChild);
  6930. } else {
  6931. var appendNode = this;
  6932. var firstChild = origGetFirstChild.call(this);
  6933. if (firstChild && com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isOwnerGroupNode(firstChild)) {
  6934. appendNode = firstChild;
  6935. }
  6936. origAppendChild.call(appendNode, appendChild);
  6937. if (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isMirrored(this)) {
  6938. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.mirrorNode(appendChild);
  6939. }
  6940. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.update(appendChild);
  6941. }
  6942. };
  6943. node.insertBefore = function(insert, before) {
  6944. com_ibm_rave_core_Rave.configuration.extendRecursive(insert);
  6945. var parent = this;
  6946. var beforeNode = before;
  6947. if (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isRawMode(this)) {
  6948. origInsertBefore.call(parent, insert, beforeNode);
  6949. } else {
  6950. var firstChild = origGetFirstChild.call(this);
  6951. if (firstChild && com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isOwnerGroupNode(firstChild)) {
  6952. parent = firstChild;
  6953. }
  6954. if (beforeNode) {
  6955. var wrappedNode = beforeNode.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.PARENT_WRAPPING_NODE_PROPERTY);
  6956. if (wrappedNode != null) {
  6957. beforeNode = wrappedNode;
  6958. }
  6959. }
  6960. origInsertBefore.call(parent, insert, beforeNode);
  6961. if (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isMirrored(this)) {
  6962. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.mirrorNode(insert);
  6963. }
  6964. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.update(insert);
  6965. }
  6966. };
  6967. node.rave_getNextSibling = function() {
  6968. var sibling = this;
  6969. var wrappedNode = this.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.PARENT_WRAPPING_NODE_PROPERTY);
  6970. if (wrappedNode != null) {
  6971. sibling = wrappedNode;
  6972. }
  6973. sibling = origGetNextSibling.call(sibling);
  6974. return sibling;
  6975. };
  6976. node.rave_getPreviousSibling = function() {
  6977. var sibling = this;
  6978. var wrappedNode = this.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.PARENT_WRAPPING_NODE_PROPERTY);
  6979. if (wrappedNode != null) {
  6980. sibling = wrappedNode;
  6981. }
  6982. sibling = origGetPreviousSibling.call(sibling);
  6983. return sibling;
  6984. };
  6985. node.rave_getFirstChild = function() {
  6986. var child = origGetFirstChild.call(this);
  6987. if (child && com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isGroupNode(child)) {
  6988. child = child.rave_getFirstChild();
  6989. }
  6990. return child;
  6991. };
  6992. node.rave_hasChildNodes = function() {
  6993. var wrappedNode = this.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.GROUP_NODE_PROPERTY);
  6994. if (wrappedNode != null) {
  6995. return (wrappedNode).rave_hasChildNodes();
  6996. }
  6997. return origHasChildNodes.call(this);
  6998. };
  6999. node.rave_getChildNodes = function() {
  7000. if (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isRawMode(this)) {
  7001. return origGetChildNodes.call(this);
  7002. }
  7003. var nodes = origGetChildNodes.call(this);
  7004. var nonGroupNodes = [];
  7005. for (var __i_enFor0 = 0, __exp_enFor0 = nodes, __len_enFor0 = __exp_enFor0.length;
  7006. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7007. var child = __exp_enFor0[__i_enFor0];
  7008. if (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isGroupNode(child)) {
  7009. nonGroupNodes = nonGroupNodes.concat(child.rave_getChildNodes());
  7010. } else {
  7011. nonGroupNodes.push(child);
  7012. }
  7013. }
  7014. return nonGroupNodes;
  7015. };
  7016. node.removeChild = function(childNode) {
  7017. if (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isRawMode(this)) {
  7018. return origRemoveChild.call(this, childNode);
  7019. }
  7020. var wrappedNode = childNode.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.PARENT_WRAPPING_NODE_PROPERTY);
  7021. var realChild = childNode;
  7022. if (wrappedNode != null) {
  7023. realChild = wrappedNode;
  7024. }
  7025. var parent = this;
  7026. var group = this.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.GROUP_NODE_PROPERTY);
  7027. if (group != null && group != realChild) {
  7028. parent = group;
  7029. }
  7030. return origRemoveChild.call(parent, realChild);
  7031. };
  7032. node.rave_getParentNode = function() {
  7033. if (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isRawMode(this)) {
  7034. return origGetParent.call(this);
  7035. }
  7036. var origParent = origGetParent.call(this);
  7037. while (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isGroupNode(origParent)) {
  7038. origParent = origGetParent.call(origParent);
  7039. }
  7040. return origParent;
  7041. };
  7042. node.setAttribute = function(key, value) {
  7043. origSetAttributeExt.call(this, key, value);
  7044. if (!(com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isRawMode(this))) {
  7045. if (key == "transform") {
  7046. this.rave_setProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.ORIGINAL_TRANSFORM, value);
  7047. }
  7048. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.update(this);
  7049. }
  7050. };
  7051. node.rave_setText = function(text) {
  7052. origSetTextExt.call(this, text);
  7053. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.update(this);
  7054. };
  7055. node.rave_setStyle = function(styleName, value, priority) {
  7056. origSetStyleExt.call(this, styleName, value, priority);
  7057. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.update(this);
  7058. };
  7059. node.getScreenCTM = function() {
  7060. var wrappedNode = this.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.GROUP_NODE_PROPERTY);
  7061. if (wrappedNode != null) {
  7062. return (wrappedNode).getScreenCTM();
  7063. }
  7064. return origGetScreenCTM.call(this);
  7065. };
  7066. node.getCTM = function() {
  7067. var wrappedNode = this.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.GROUP_NODE_PROPERTY);
  7068. if (wrappedNode != null) {
  7069. return (wrappedNode).getCTM();
  7070. }
  7071. return origGetCTM.call(this);
  7072. };
  7073. };
  7074. // $source: com/ibm/rave/core/RegistryService
  7075. /************************************************************************
  7076. ** IBM Confidential
  7077. **
  7078. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7079. **
  7080. ** (C) Copyright IBM Corp. 2015
  7081. **
  7082. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7083. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7084. ************************************************************************/
  7085. // GENERATED
  7086. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7087. /**
  7088. * A registry service to provide mechanism of registering extensions above core functionality. Extension include, but not limited to - layouts, legends, geo objects, axis, etc. An object capable of producing extended objects is represented by: <p> In order to extend core with an additional capability, an extended objects factory must be registered with a respective registry service via: {@link RegistryService#this.extension(String, com_ibm_rave_core_ExtensionFactory)} <p> For example, to register a new layout an extension factory capable of producing new layout objects must be registered with layout registry service: <code>com.ibm.rave.core.Rave.layout#extension(String, ExtensionFactory)</code> * and use <code>com.ibm.rave.core.Rave.layout.extension(String id)</code> to obtain an extended layout object specified by the id.
  7089. * @see ExtensionFactory
  7090. */
  7091. var com_ibm_rave_core_RegistryService = rave_externs["RegistryService"] = com_ibm_rave_core_nativeImpl_Declare({
  7092. //registry : null,
  7093. getRegistry : function() {
  7094. if (!this.registry) {
  7095. this.registry = {};
  7096. }
  7097. return this.registry;
  7098. },
  7099. /**
  7100. * Returns an instance of extended object (e.g. layout, legend, etc) registered under id, <code>null</code> if nothing is registered under the given id.
  7101. * @param (String) id id used to register the extension
  7102. * @return (Object) an instance of extended object (e.g. layout, legend, etc), <code>null</code> if this extension is not registered
  7103. */
  7104. extension$0 : function(id) {
  7105. if (this.registry && this.registry[id]) {
  7106. return this.registry[id]();
  7107. }
  7108. return null;
  7109. },
  7110. /**
  7111. * Register an extended object factory using extension id. If the same id is already in use, registration will fail.
  7112. * @param (String) id extension id
  7113. * @param (com.ibm.rave.core.ExtensionFactory) factory extended factory to produce object instances of a type provided by id
  7114. * @return (boolean) true, if the registration was successful, false otherwise
  7115. */
  7116. extension$1 : function(id, factory) {
  7117. if (this.getRegistry()[id]) {
  7118. return false;
  7119. }
  7120. this.registry[id] = factory;
  7121. return true;
  7122. },
  7123. /** @expose */
  7124. extension : function(a0, a1) {
  7125. var args = arguments;
  7126. if (args.length == 1) {
  7127. return this.extension$0(a0);
  7128. }
  7129. return this.extension$1(a0, a1);
  7130. }
  7131. });
  7132. // $source: com/ibm/rave/core/selector/Selector
  7133. /************************************************************************
  7134. ** IBM Confidential
  7135. **
  7136. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7137. **
  7138. ** (C) Copyright IBM Corp. 2015
  7139. **
  7140. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7141. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7142. ************************************************************************/
  7143. // GENERATED
  7144. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // invokeSuper, declare
  7145. //@import com/ibm/rave/core/selector/Selection (loadtime) // superclass
  7146. //@import com/ibm/rave/core/internal/util/NamespaceUtil (runtime) // getQName
  7147. //@import com/ibm/rave/core/internal/selector/SelectorHelper (runtime) // each, selectorAll, selector
  7148. //@import com/ibm/rave/core/internal/util/QueryUtil (runtime) // getQueryEngine
  7149. //@import com/ibm/rave/core/selector/EnterSelector (runtime) // new
  7150. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (runtime) // create
  7151. //@import com/ibm/rave/core/internal/nativeImpl/selector/EmptySceneNode (runtime) // new
  7152. //@import com/ibm/rave/core/internal/nativeImpl/transitions/InheritedTransition (runtime) // get
  7153. //@import com/ibm/rave/core/transition/Transition (runtime) // create
  7154. //@import com/ibm/rave/core/internal/transitions/TransitionUtil (runtime) // transitionNamespace, interruptNS
  7155. //@import com/ibm/rave/core/internal/nativeImpl/PlatformInitialization (runtime) // getDocument, getDocumentElement
  7156. //@import com/ibm/rave/core/Configuration (runtime) // Configuration
  7157. //@import com/ibm/rave/core/arrays/Sort (runtime) // Sort
  7158. //@import com/ibm/rave/core/internal/selector/mirror/MirroredSelector (runtime) // new, register
  7159. //@import com/ibm/rave/core/RegistryService (static) // new
  7160. /**
  7161. * A selection is an array of elements. CSS3 queries are used to select elements. For example, you can select by tag ("rect"), class (".awesome"), unique identifier ("#foo"), attribute ("[color=red]"), or containment ("parent child"). Selectors can also be intersected (".this.that" for logical AND) or unioned (".this, .that" for logical OR). <p> After selecting elements, you apply operators to them to do stuff. These operators can get or set attributes, styles, properties, HTML and text content. Attribute values and such are specified as either constants or functions; the latter are evaluated for each element. You can also join selections to data; this data is available to operators for data-driven transformations. In addition, joining to data produces enter and exit subselections, so that you may add or remove elements in response to changes in data. <p> You won't generally need to use for loops or recursive functions. That's because you operate on entire selections at once, rather than looping over individual elements. However, you can still loop over elements manually if you wish: there's an each operator which invokes an arbitrary function, and selections are arrays, so elements can be accessed directly. RAVE supports method chaining for brevity when applying multiple operators: the operator return value is the selection.
  7162. */
  7163. var com_ibm_rave_core_selector_Selector = rave_externs["Selector"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_selector_Selection, {
  7164. //enterSelector : null, //exitSelector : null,
  7165. /**
  7166. * Does this selector type require that we extend nodes with custom node extensions. By default, our main Selector does not require extensions.
  7167. */
  7168. /** @expose */
  7169. needsNodeExtension : false,
  7170. /**
  7171. * @return (com.ibm.rave.core.ExtensionFactory) The factory to create an instance of a Selector
  7172. */
  7173. /** @expose */
  7174. getSelectorFactory : function() {
  7175. return com_ibm_rave_core_selector_Selector.factory;
  7176. },
  7177. /**
  7178. * Appends a new element with the specified name as the last child of each element in the current selection, returning a new selection containing the appended elements. Each new element inherits the data of the current elements, if any, in the same manner as select for subselections. <p> The name may have a namespace prefix of the form "namespace:tag". For example, "svg:text" will create a "text" element in the SVG namespace.If no namespace is specified, then the namespace will be inherited from the enclosing element; or, if the name is one of the known prefixes, the corresponding namespace will be used (for example, "svg" implies "svg:svg").
  7179. * @param (String) name the name of the new element
  7180. * @return (com.ibm.rave.core.selector.Selector) a new {@link (com.ibm.rave.core.selector.Selector) Selector} containing the appended elements
  7181. */
  7182. append$0 : function(name) {
  7183. var qname = com_ibm_rave_core_internal_util_NamespaceUtil.getQName(name);
  7184. return this.select(function(data, index, groupIndex) {
  7185. var newNode = com_ibm_rave_core_selector_Selector.createSceneNode(qname["space"], qname["local"], this);
  7186. if (newNode) {
  7187. this.rave_appendChild(newNode);
  7188. }
  7189. return newNode;
  7190. });
  7191. },
  7192. /**
  7193. * Appends a new element with the specified name as the last child of each element in the current selection, returning a new selection containing the appended elements. Each new element inherits the data of the current elements, if any, in the same manner as select for subselections.
  7194. * @param (com.ibm.rave.core.selector.ValueFunction) elementFunction a function that returns the element to append
  7195. * @return (com.ibm.rave.core.selector.Selector) a new {@link (com.ibm.rave.core.selector.Selector) Selector} containing the appended elements
  7196. */
  7197. append$1 : function(elementFunction) {
  7198. return this.select(function(data, index, groupIndex) {
  7199. var newNode = elementFunction.call(this, data, index, groupIndex);
  7200. this.rave_appendChild(newNode);
  7201. return newNode;
  7202. });
  7203. },
  7204. /**
  7205. * Inserts a new element with the specified name before the element matching the specified before selector, for each element in the current selection, returning a new selection containing the inserted elements. If the before selector does not match any elements, then the new element will be the last child as with append. Each new element inherits the data of the current elements (if any), in the same manner as select for subselections.
  7206. * @param (com.ibm.rave.core.selector.ValueFunction) elementFunction a function that returns the element to append
  7207. * @param (String) before a selector query string identifying the element to insert before
  7208. * @return (com.ibm.rave.core.selector.Selector) a new {@link (com.ibm.rave.core.selector.Selector) Selector} containing the inserted elements
  7209. */
  7210. insert$0 : function(elementFunction, before) {
  7211. return this.insert$1(elementFunction, com_ibm_rave_core_internal_selector_SelectorHelper.selector(before));
  7212. },
  7213. /**
  7214. * Inserts a new element with the specified name before the element matching the specified before selector, for each element in the current selection, returning a new selection containing the inserted elements. If the before selector does not match any elements, then the new element will be the last child as with append. Each new element inherits the data of the current elements (if any), in the same manner as select for subselections.
  7215. * @param (com.ibm.rave.core.selector.ValueFunction) nameFunction a function which returns the name of the new element to create
  7216. * @param (com.ibm.rave.core.selector.ValueFunction) beforeFunction a function which returns the element to insert before
  7217. * @return (com.ibm.rave.core.selector.Selector) a new {@link (com.ibm.rave.core.selector.Selector) Selector} containing the inserted elements
  7218. */
  7219. insert$1 : function(nameFunction, beforeFunction) {
  7220. return this.select(function(data, index, groupIndex) {
  7221. var qname = com_ibm_rave_core_internal_util_NamespaceUtil.getQName(nameFunction.call(this, data, index, groupIndex));
  7222. var newNode = com_ibm_rave_core_selector_Selector.createSceneNode(qname["space"], qname["local"], this);
  7223. if (newNode) {
  7224. this.rave_insertBefore(newNode, beforeFunction ? beforeFunction.call(this, data, index, groupIndex) : null);
  7225. }
  7226. return newNode;
  7227. });
  7228. },
  7229. /**
  7230. * Inserts a new element with the specified name before the element matching the specified before selector, for each element in the current selection, returning a new selection containing the inserted elements. If the before selector does not match any elements, then the new element will be the last child as with append. Each new element inherits the data of the current elements (if any), in the same manner as select for subselections. <p> The name may have a namespace prefix of the form "namespace:tag". For example, "svg:text" will create a "text" element in the SVG namespace.If no namespace is specified, then the namespace will be inherited from the enclosing element; or, if the name is one of the known prefixes, the corresponding namespace will be used (for example, "svg" implies "svg:svg").
  7231. * @param (String) name the name of the new element
  7232. * @param (String) before a selector query string identifying the element to insert before
  7233. * @return (com.ibm.rave.core.selector.Selector) a new {@link (com.ibm.rave.core.selector.Selector) Selector} containing the inserted elements
  7234. */
  7235. insert$2 : function(name, before) {
  7236. return this.insert$3(name, com_ibm_rave_core_internal_selector_SelectorHelper.selector(before));
  7237. },
  7238. /**
  7239. * Inserts a new element with the specified name before the element matching the specified before selector, for each element in the current selection, returning a new selection containing the inserted elements. If the before selector does not match any elements, then the new element will be the last child as with append. Each new element inherits the data of the current elements (if any), in the same manner as select for subselections. <p> The name may have a namespace prefix of the form "namespace:tag". For example, "svg:text" will create a "text" element in the SVG namespace.If no namespace is specified, then the namespace will be inherited from the enclosing element; or, if the name is one of the known prefixes, the corresponding namespace will be used (for example, "svg" implies "svg:svg").
  7240. * @param (String) type the name of the new element
  7241. * @param (com.ibm.rave.core.selector.ValueFunction) beforeFunction a function which returns the element to insert before
  7242. * @return (com.ibm.rave.core.selector.Selector) a new {@link (com.ibm.rave.core.selector.Selector) Selector} containing the inserted elements
  7243. */
  7244. insert$3 : function(type, beforeFunction) {
  7245. var qname = com_ibm_rave_core_internal_util_NamespaceUtil.getQName(type);
  7246. return this.select(function(data, index, groupIndex) {
  7247. var newNode = com_ibm_rave_core_selector_Selector.createSceneNode(qname["space"], qname["local"], this);
  7248. if (newNode) {
  7249. this.rave_insertBefore(newNode, beforeFunction ? beforeFunction.call(this, data, index, groupIndex) : null);
  7250. }
  7251. return newNode;
  7252. });
  7253. },
  7254. /**
  7255. * Removes the elements in the current selection from the current scene. Returns the current selection (the same elements that were removed) which are now “off-screen”, detached from the scene. Note that there is not currently a dedicated API to add removed elements back to the scene; however, you can pass a function to selection.append or selection.insert to re-add elements.
  7256. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  7257. */
  7258. /** @expose */
  7259. remove : function() {
  7260. var node;
  7261. for (var j = 0, m = this.length; j < m; ++j) {
  7262. var group = this[j];
  7263. for (var i = 0, n = group.length; i < n; ++i) {
  7264. if ((node = group[i])) {
  7265. var parent = node.rave_getParentNode();
  7266. if (parent) {
  7267. parent.removeChild(node);
  7268. }
  7269. }
  7270. }
  7271. }
  7272. return this;
  7273. },
  7274. on$0 : function(eventName) {
  7275. var node = this.node();
  7276. if (node) {
  7277. var eventListener = node.rave_getEventListener(eventName);
  7278. if (typeof eventListener === "function") {
  7279. return (eventListener)._listener;
  7280. }
  7281. }
  7282. return undefined;
  7283. },
  7284. on$1 : function(value) {
  7285. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(value), __len_enFor0 = __exp_enFor0.length;
  7286. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7287. var key = __exp_enFor0[__i_enFor0];
  7288. this.on$3(key, value[key], false);
  7289. }
  7290. return this;
  7291. },
  7292. /**
  7293. * Adds an event listener for the given event type if a listener is specified. If no listener is specified, removes the event listener for the given event name. The event name may be a simple type, eg 'click', or may be contain a qualified dot separated suffix, eg 'click.myapp'. If a suffix is supplied, the event type is extracted from the name up to the first dot.
  7294. * @param (String) eventName the event name
  7295. * @param (com.ibm.rave.core.selector.SelectorEventListener) listener the event listener
  7296. * @return (com.ibm.rave.core.selector.Selector) this selector
  7297. */
  7298. on$2 : function(eventName, listener) {
  7299. return this.on$3(eventName, listener, false);
  7300. },
  7301. /**
  7302. * Adds an event listener for the given event type if a listener is specified. If no listener is specified, removes the event listener for the given event name. The event name may be a simple type, eg 'click', or may be contain a qualified dot separated suffix, eg 'click.myapp'. If a suffix is supplied, the event type is extracted from the name up to the first dot.
  7303. * @param (String) eventName the event name
  7304. * @param (com.ibm.rave.core.selector.SelectorEventListener) listener the event listener
  7305. * @param (boolean) useCapture whether or not the listener is to be added to the capture phase; not supported by all clients
  7306. * @return (com.ibm.rave.core.selector.Selector) this selector
  7307. */
  7308. on$3 : function(eventName, listener, useCapture) {
  7309. var self = this;
  7310. var type, group;
  7311. var idx = eventName.indexOf(".");
  7312. if (idx >= 0) {
  7313. type = idx > 0 ? eventName.substring(0, idx) : null;
  7314. group = eventName.substring(idx + 1);
  7315. } else {
  7316. type = eventName;
  7317. group = null;
  7318. }
  7319. this.each(function(data, index, groupIndex) {
  7320. if (type != null && type.length > 0) {
  7321. if (listener) {
  7322. var fNode = this;
  7323. var eventListener = function(event) {
  7324. self.notifyEvent(listener, fNode, index, groupIndex, event);
  7325. };
  7326. eventListener._listener = listener;
  7327. if (group != null && group.length > 0) {
  7328. this.rave_removeEventListener(type, group);
  7329. this.rave_addEventListener(type, eventListener, useCapture, group);
  7330. } else {
  7331. this.rave_removeEventListener(type);
  7332. this.rave_addEventListener(type, eventListener, useCapture);
  7333. }
  7334. } else if (group != null && group.length > 0) {
  7335. this.rave_removeEventListener(type, group);
  7336. } else {
  7337. this.rave_removeEventListener(type);
  7338. }
  7339. } else {
  7340. this.rave_removeEventListeners(group);
  7341. }
  7342. });
  7343. return this;
  7344. },
  7345. /**
  7346. * Hook to allow JavaScript to wrap the listener.
  7347. * @param (com.ibm.rave.core.selector.SelectorEventListener) listener the listener to wrap
  7348. */
  7349. /** @expose */
  7350. notifyEvent : function(listener, node, index, groupIndex, event) {
  7351. var o = rave.event;
  7352. rave.event = event;
  7353. try {
  7354. listener.call(node, node.rave_getData(), index, groupIndex, event);
  7355. } finally {
  7356. rave.event = o;
  7357. }
  7358. },
  7359. /**
  7360. * Returns the owner of the first {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  7361. * @return (com.ibm.rave.core.scene.SceneNode) owner of this attribute for the first {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} .
  7362. */
  7363. owner$0 : function() {
  7364. var node = this.node();
  7365. return node ? node.rave_getOwner() : null;
  7366. },
  7367. /**
  7368. * Sets the owner for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector. {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  7369. * @param (com.ibm.rave.core.scene.SceneNode) owner the {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} to set as the owner
  7370. * @return (com.ibm.rave.core.selector.Selector) Selector
  7371. */
  7372. owner$1 : function(owner) {
  7373. return this.each(function(data, index, groupIndex) {
  7374. this.rave_setOwner(owner);
  7375. });
  7376. },
  7377. /**
  7378. * Sets the owner for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector. {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  7379. * @param (com.ibm.rave.core.selector.ValueFunction) owner the function which returns a {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} to set as the owner
  7380. * @return (com.ibm.rave.core.selector.Selector) Selector
  7381. */
  7382. owner$2 : function(owner) {
  7383. if (!owner) {
  7384. return this.owner$1(owner);
  7385. }
  7386. return this.each(function(data, index, groupIndex) {
  7387. this.rave_setOwner(owner.call(this, data, index, groupIndex));
  7388. });
  7389. },
  7390. /**
  7391. * Returns the value of the requested attribute for the first {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  7392. * @param (String) attribute String attribute name.
  7393. * @return (Object) value for this attribute for the first {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} .
  7394. */
  7395. attr$3 : function(attribute) {
  7396. var node = this.node();
  7397. if (node) {
  7398. var qname = com_ibm_rave_core_internal_util_NamespaceUtil.getQName(attribute);
  7399. if (qname["space"] == null) {
  7400. return node.getAttribute(qname["local"]);
  7401. }
  7402. return node.getAttributeNS(qname["space"], qname["local"]);
  7403. }
  7404. return null;
  7405. },
  7406. /**
  7407. * Sets the value for the requested attribute for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  7408. * @param (String) attribute String attribute name.
  7409. * @param (Object) value Value for attribute.
  7410. * @return (com.ibm.rave.core.selector.Selector) Selector
  7411. */
  7412. attr$1 : function(attribute, value) {
  7413. var qname = com_ibm_rave_core_internal_util_NamespaceUtil.getQName(attribute);
  7414. var node;
  7415. for (var j = 0, m = this.length; j < m; ++j) {
  7416. var group = this[j];
  7417. for (var i = 0, n = group.length; i < n; ++i) {
  7418. if ((node = group[i])) {
  7419. if (value == null) {
  7420. if (qname["space"] == null) {
  7421. node.removeAttribute(qname["local"]);
  7422. } else {
  7423. node.removeAttributeNS(qname["space"], qname["local"]);
  7424. }
  7425. } else {
  7426. if (qname["space"] == null) {
  7427. node.setAttribute(qname["local"], value);
  7428. } else {
  7429. node.setAttributeNS(qname["space"], qname["local"], value);
  7430. }
  7431. }
  7432. }
  7433. }
  7434. }
  7435. return this;
  7436. },
  7437. /**
  7438. * Sets the passed attribute for each match in this selector based on value returned from the passed function . Passes in optional data associated with this selector.
  7439. * @param (String) attribute String attribute name to set.
  7440. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction "anonymous" function class to be executed for each attribute. In javascript, this will be translated into an actual anonymous function.
  7441. * @return (com.ibm.rave.core.selector.Selector) Selector
  7442. */
  7443. attr$2 : function(attribute, valueFunction) {
  7444. if (!valueFunction) {
  7445. return this.attr$1(attribute, null);
  7446. }
  7447. var qname = com_ibm_rave_core_internal_util_NamespaceUtil.getQName(attribute);
  7448. var node;
  7449. for (var j = 0, m = this.length; j < m; ++j) {
  7450. var group = this[j];
  7451. for (var i = 0, n = group.length; i < n; ++i) {
  7452. if ((node = group[i])) {
  7453. var value = valueFunction.call(node, node.rave_getData(), i, j);
  7454. if (value == null) {
  7455. if (qname["space"] == null) {
  7456. node.removeAttribute(qname["local"]);
  7457. } else {
  7458. node.removeAttributeNS(qname["space"], qname["local"]);
  7459. }
  7460. } else {
  7461. if (qname["space"] == null) {
  7462. node.setAttribute(qname["local"], value);
  7463. } else {
  7464. node.setAttributeNS(qname["space"], qname["local"], value);
  7465. }
  7466. }
  7467. }
  7468. }
  7469. }
  7470. return this;
  7471. },
  7472. /**
  7473. * Returns the value of the requested style for the first {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  7474. * @param (String) styleName String style name.
  7475. * @return (Object) value for this style attribute for the first {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} .
  7476. */
  7477. style$6 : function(styleName) {
  7478. var node = this.node();
  7479. return node ? node.rave_getComputedStyle(styleName) : null;
  7480. },
  7481. style$2 : function(styleName, value) {
  7482. return this.style$4(styleName, value, null);
  7483. },
  7484. /**
  7485. * Sets the value for the requested style for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  7486. * @param (String) styleName String style name.
  7487. * @param (Object) value Value for attribute.
  7488. * @return (com.ibm.rave.core.selector.Selector) Selector
  7489. */
  7490. style$4 : function(styleName, value, priority) {
  7491. var newPriority = priority != null ? priority : "";
  7492. var node;
  7493. for (var j = 0, m = this.length; j < m; ++j) {
  7494. var group = this[j];
  7495. for (var i = 0, n = group.length; i < n; ++i) {
  7496. if ((node = group[i])) {
  7497. if (value == null) {
  7498. node.rave_removeStyle(styleName);
  7499. } else {
  7500. node.rave_setStyle(styleName, value, newPriority);
  7501. }
  7502. }
  7503. }
  7504. }
  7505. return this;
  7506. },
  7507. style$3 : function(styleName, valueFunction) {
  7508. return this.style$5(styleName, valueFunction, null);
  7509. },
  7510. /**
  7511. * Sets the passed style attribute for each match in this selector based on value returned from the passed function . Passes in optional data associated with this selector.
  7512. * @param (String) styleName String style name to set.
  7513. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction "anonymous" function class to be executed for each attribute. In javascript, this will be translated into an actual anonymous function.
  7514. * @return (com.ibm.rave.core.selector.Selector) Selector
  7515. */
  7516. style$5 : function(styleName, valueFunction, priority) {
  7517. if (!valueFunction) {
  7518. return this.style$2(styleName, null);
  7519. }
  7520. var node;
  7521. for (var j = 0, m = this.length; j < m; ++j) {
  7522. var group = this[j];
  7523. for (var i = 0, n = group.length; i < n; ++i) {
  7524. if ((node = group[i])) {
  7525. var value = valueFunction.call(node, node.rave_getData(), i, j);
  7526. if (value == null) {
  7527. node.rave_removeStyle(styleName);
  7528. } else {
  7529. node.rave_setStyle(styleName, value, priority);
  7530. }
  7531. }
  7532. }
  7533. }
  7534. return this;
  7535. },
  7536. /**
  7537. * Returns the value of the requested property for the first {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  7538. * @param (String) key the property string key
  7539. * @return (Object) value for this property for the first {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} .
  7540. */
  7541. property$0 : function(key) {
  7542. var node = this.node();
  7543. return node ? node.rave_getProperty(key) : null;
  7544. },
  7545. property$1 : function(value) {
  7546. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(value), __len_enFor0 = __exp_enFor0.length;
  7547. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7548. var key = __exp_enFor0[__i_enFor0];
  7549. var v = value[key];
  7550. if (typeof v === "function") {
  7551. this.property$3(key, v);
  7552. } else {
  7553. this.property$2(key, v);
  7554. }
  7555. }
  7556. return this;
  7557. },
  7558. /**
  7559. * Sets the property value for the given key for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  7560. * @param (String) key the property string key
  7561. * @param (Object) value the property value
  7562. * @return (com.ibm.rave.core.selector.Selector) Selector
  7563. */
  7564. property$2 : function(key, value) {
  7565. var node;
  7566. for (var j = 0, m = this.length; j < m; ++j) {
  7567. var group = this[j];
  7568. for (var i = 0, n = group.length; i < n; ++i) {
  7569. if ((node = group[i])) {
  7570. node.rave_setProperty(key, value);
  7571. }
  7572. }
  7573. }
  7574. return this;
  7575. },
  7576. /**
  7577. * Sets the passed property for each match in this selector based on value returned from the passed function.
  7578. * @param (String) key the property string key
  7579. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction "anonymous" function class to be executed for each property.
  7580. * @return (com.ibm.rave.core.selector.Selector) Selector
  7581. */
  7582. property$3 : function(key, valueFunction) {
  7583. if (!valueFunction) {
  7584. return this.property$2(key, null);
  7585. }
  7586. var node;
  7587. for (var j = 0, m = this.length; j < m; ++j) {
  7588. var group = this[j];
  7589. for (var i = 0, n = group.length; i < n; ++i) {
  7590. if ((node = group[i])) {
  7591. node.rave_setProperty(key, valueFunction.call(node, node.rave_getData(), i, j));
  7592. }
  7593. }
  7594. }
  7595. return this;
  7596. },
  7597. /**
  7598. * The text content for the first non-null element in the selection. This is generally useful only if you know the selection contains exactly one element.
  7599. * @return (String) text content for the first non-null element in the selection
  7600. */
  7601. text$0 : function() {
  7602. var node = this.node();
  7603. return node ? node.rave_getText() : null;
  7604. },
  7605. /**
  7606. * Sets the text content for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  7607. * @param (Object) value The text content.
  7608. * @return (com.ibm.rave.core.selector.Selector) Selector
  7609. */
  7610. text$1 : function(value) {
  7611. var text = value == null ? "" : value + "";
  7612. var node;
  7613. for (var j = 0, m = this.length; j < m; ++j) {
  7614. var group = this[j];
  7615. for (var i = 0, n = group.length; i < n; ++i) {
  7616. if ((node = group[i])) {
  7617. node.rave_setText(text);
  7618. }
  7619. }
  7620. }
  7621. return this;
  7622. },
  7623. /**
  7624. * Sets the text content for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  7625. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction "anonymous" function class to be executed for each attribute. In javascript, this will be translated into an actual anonymous function.
  7626. * @return (com.ibm.rave.core.selector.Selector) Selector
  7627. */
  7628. text$2 : function(valueFunction) {
  7629. var node;
  7630. for (var j = 0, m = this.length; j < m; ++j) {
  7631. var group = this[j];
  7632. for (var i = 0, n = group.length; i < n; ++i) {
  7633. if ((node = group[i])) {
  7634. var value = valueFunction.call(node, node.rave_getData(), i, j);
  7635. node.rave_setText(value == null ? "" : value + "");
  7636. }
  7637. }
  7638. }
  7639. return this;
  7640. },
  7641. /**
  7642. * Returns the html value for the first {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  7643. * @return (String) html value for the first {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} .
  7644. */
  7645. html$0 : function() {
  7646. var node = this.node();
  7647. return node ? node.rave_getHtml() : null;
  7648. },
  7649. /**
  7650. * Sets the html content for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  7651. * @param (Object) value The html content.
  7652. * @return (com.ibm.rave.core.selector.Selector) Selector
  7653. */
  7654. html$1 : function(value) {
  7655. var html = value == null ? "" : value + "";
  7656. var node;
  7657. for (var j = 0, m = this.length; j < m; ++j) {
  7658. var group = this[j];
  7659. for (var i = 0, n = group.length; i < n; ++i) {
  7660. if ((node = group[i])) {
  7661. node.rave_setHtml(html);
  7662. }
  7663. }
  7664. }
  7665. return this;
  7666. },
  7667. /**
  7668. * Sets the html content for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  7669. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction "anonymous" function class to be executed for each attribute. In javascript, this will be translated into an actual anonymous function.
  7670. * @return (com.ibm.rave.core.selector.Selector) Selector
  7671. */
  7672. html$2 : function(valueFunction) {
  7673. var node;
  7674. for (var j = 0, m = this.length; j < m; ++j) {
  7675. var group = this[j];
  7676. for (var i = 0, n = group.length; i < n; ++i) {
  7677. if ((node = group[i])) {
  7678. var value = valueFunction.call(node, node.rave_getData(), i, j);
  7679. node.rave_setHtml(value == null ? "" : value + "");
  7680. }
  7681. }
  7682. }
  7683. return this;
  7684. },
  7685. filter$0 : function(filterFunction) {
  7686. var subgroups = this.getSelectorFactory()();
  7687. var subgroup;
  7688. var group;
  7689. var node;
  7690. for (var j = 0, m = this.length; j < m; ++j) {
  7691. group = this[j];
  7692. subgroup = [];
  7693. subgroups.push(subgroup);
  7694. subgroup["parentNode"] = group["parentNode"];
  7695. for (var i = 0, n = group.length; i < n; ++i) {
  7696. if ((node = group[i]) && filterFunction.call(node, node.rave_getData(), i, j)) {
  7697. subgroup.push(node);
  7698. }
  7699. }
  7700. }
  7701. return subgroups;
  7702. },
  7703. filter$1 : function(filter) {
  7704. return this.filter$0(function(data, index, groupIndex) {
  7705. return com_ibm_rave_core_internal_util_QueryUtil.getQueryEngine(this).matches(this, filter);
  7706. });
  7707. },
  7708. /**
  7709. * Returns <code>true</code> only if the first node in the selection has the specified class or classes.
  7710. * @param (String) className the class name
  7711. * @return (boolean) <code>true</code> if the first node has the class set, <code>false</code> otherwise
  7712. */
  7713. classed$0 : function(className) {
  7714. var node = this.node();
  7715. return node && node.rave_containsClass(className);
  7716. },
  7717. classed$1 : function(value) {
  7718. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(value), __len_enFor0 = __exp_enFor0.length;
  7719. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7720. var key = __exp_enFor0[__i_enFor0];
  7721. var v = value[key];
  7722. if (typeof v === "function") {
  7723. this.classed$3(key, v);
  7724. } else {
  7725. this.classed$2(key, (v));
  7726. }
  7727. }
  7728. return this;
  7729. },
  7730. /**
  7731. * Sets the value for the specified class for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  7732. * @param (String) className the class name
  7733. * @param (boolean) add Whether to add the class or not.
  7734. * @return (com.ibm.rave.core.selector.Selector) Selector
  7735. */
  7736. classed$2 : function(className, add) {
  7737. var newClassName = className + "";
  7738. var node;
  7739. for (var j = 0, m = this.length; j < m; ++j) {
  7740. var group = this[j];
  7741. for (var i = 0, n = group.length; i < n; ++i) {
  7742. if ((node = group[i])) {
  7743. if (add) {
  7744. node.rave_addClass(newClassName);
  7745. } else {
  7746. node.rave_removeClass(newClassName);
  7747. }
  7748. }
  7749. }
  7750. }
  7751. return this;
  7752. },
  7753. /**
  7754. * Sets the passed class attribute for each match in this selector based on value returned from the passed function . Passes in optional data associated with this selector.
  7755. * @param (String) className String class name to set.
  7756. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction "anonymous" function class to be executed for each attribute. In javascript, this will be translated into an actual anonymous function.
  7757. * @return (com.ibm.rave.core.selector.Selector) Selector
  7758. */
  7759. classed$3 : function(className, valueFunction) {
  7760. var newClassName = className != null ? className + "" : "";
  7761. var node;
  7762. for (var j = 0, m = this.length; j < m; ++j) {
  7763. var group = this[j];
  7764. for (var i = 0, n = group.length; i < n; ++i) {
  7765. if ((node = group[i])) {
  7766. if (valueFunction.call(node, node.rave_getData(), i, j)) {
  7767. node.rave_addClass(newClassName);
  7768. } else {
  7769. node.rave_removeClass(newClassName);
  7770. }
  7771. }
  7772. }
  7773. }
  7774. return this;
  7775. },
  7776. /**
  7777. * Get the first data value in the selection.
  7778. * @return (java.lang.Object[]) the first data value in the selection
  7779. */
  7780. data$0 : function() {
  7781. if (this.length > 0) {
  7782. var group = this[0];
  7783. var node;
  7784. var n = group.length;
  7785. var value = [];
  7786. for (var i = 0; i < n; ++i) {
  7787. if ((node = group[i])) {
  7788. value[i] = node.rave_getData();
  7789. }
  7790. }
  7791. return value;
  7792. }
  7793. return null;
  7794. },
  7795. /**
  7796. * Gets the bound data for each selected element. Unlike the selection.data method, this method does not compute a join (and thus does not compute enter and exit selections)
  7797. * @return (Object) the data value in the selection
  7798. */
  7799. datum$0 : function() {
  7800. var node = this.node();
  7801. if (node) {
  7802. return node.rave_getData();
  7803. }
  7804. return null;
  7805. },
  7806. /**
  7807. * Sets the bound data for each selected element. Unlike the selection.data method, this method does not compute a join (and thus does not compute enter and exit selections)
  7808. * @param (com.ibm.rave.core.selector.ValueFunction) valueFn the function to call back to provide the value to set
  7809. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  7810. */
  7811. datum$1 : function(valueFn) {
  7812. var node;
  7813. for (var j = 0, m = this.length; j < m; ++j) {
  7814. var group = this[j];
  7815. for (var i = 0, n = group.length; i < n; ++i) {
  7816. if ((node = group[i])) {
  7817. node.rave_setProperty("__data__", valueFn.call(node, node.rave_getData(), i, j));
  7818. }
  7819. }
  7820. }
  7821. return this;
  7822. },
  7823. /**
  7824. * Sets the bound data for each selected element. Unlike the selection.data method, this method does not compute a join (and thus does not compute enter and exit selections)
  7825. * @param (Object) value the value to set
  7826. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  7827. */
  7828. datum$2 : function(value) {
  7829. return this.datum$1(function(data, index, groupIndex) {
  7830. return value;
  7831. });
  7832. },
  7833. /**
  7834. * Joins the array of data values from the value function with the current selection.
  7835. * @param (com.ibm.rave.core.selector.ValueFunction) value the data to join
  7836. * @return (com.ibm.rave.core.selector.Selector) the update selector with joined data
  7837. */
  7838. data$1 : function(value) {
  7839. return this.doData(value, null);
  7840. },
  7841. /**
  7842. * Joins the array of data values from the value function with the current selection.
  7843. * @param (com.ibm.rave.core.selector.ValueFunction) value the data to join
  7844. * @param (com.ibm.rave.core.selector.ValueFunction) key the function to extra data keys
  7845. * @return (com.ibm.rave.core.selector.Selector) the update selector with joined data
  7846. */
  7847. data$2 : function(value, key) {
  7848. return this.doData(value, key);
  7849. },
  7850. /**
  7851. * Joins the specified array of data with the current selection.
  7852. * @param (java.lang.Object[]) value the data to join
  7853. * @return (com.ibm.rave.core.selector.Selector) the update selector with joined data
  7854. */
  7855. data$3 : function(value) {
  7856. return this.doData(value, null);
  7857. },
  7858. /**
  7859. * Joins the specified array of data with the current selection.
  7860. * @param (java.lang.Object[]) value the data to join
  7861. * @param (com.ibm.rave.core.selector.ValueFunction) key the function to extra data keys
  7862. * @return (com.ibm.rave.core.selector.Selector) the update selector with joined data
  7863. */
  7864. data$4 : function(value, key) {
  7865. return this.doData(value, key);
  7866. },
  7867. /**
  7868. * Joins the specified array of data with the current selection.
  7869. * @param (Object) value the data to join (Object[] or ValueFunction)
  7870. * @param (com.ibm.rave.core.selector.ValueFunction) key the function to extra data keys, may be <code>null</code>
  7871. * @return (com.ibm.rave.core.selector.Selector) the update selector with joined data
  7872. */
  7873. doData : function(value, key) {
  7874. var i = -1;
  7875. var n = this.length;
  7876. var group;
  7877. var extFactory = this.getSelectorFactory();
  7878. var enter = new com_ibm_rave_core_selector_EnterSelector().setSelectorFactory(extFactory);
  7879. var exit = extFactory();
  7880. var update = extFactory();
  7881. update.enterSelector = enter;
  7882. update.exitSelector = exit;
  7883. var bind = function(group, groupData) {
  7884. var i, n = group.length, m = groupData.length, n0 = Math.min(n, m);
  7885. var updateNodes = new Array(m);
  7886. var enterNodes = new Array(m);
  7887. var exitNodes = new Array(n);
  7888. var node;
  7889. var nodeData;
  7890. if (key) {
  7891. var nodeByKeyValue = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  7892. var keyValues = new Array(n);
  7893. var keyValue;
  7894. for (i = 0; i < n; ++i) {
  7895. keyValue = key.call(node = group[i], (node).rave_getData(), i, -1);
  7896. if (nodeByKeyValue.has(keyValue)) {
  7897. exitNodes[i] = node;
  7898. } else {
  7899. nodeByKeyValue.set(keyValue, node);
  7900. }
  7901. keyValues[i] = keyValue;
  7902. }
  7903. for (i = 0; i < m; ++i) {
  7904. keyValue = key.call(groupData, nodeData = groupData[i], i, -1);
  7905. if (!((node = nodeByKeyValue.get(keyValue)))) {
  7906. enterNodes[i] = new com_ibm_rave_core_internal_nativeImpl_selector_EmptySceneNode(nodeData);
  7907. } else if (node != this) {
  7908. updateNodes[i] = node;
  7909. (node).rave_setData(nodeData);
  7910. }
  7911. nodeByKeyValue.set(keyValue, this);
  7912. }
  7913. for (i = 0; i < n; ++i) {
  7914. if (nodeByKeyValue.get(keyValues[i]) != this) {
  7915. exitNodes[i] = group[i];
  7916. }
  7917. }
  7918. } else {
  7919. for (i = 0; i < n0; ++i) {
  7920. node = group[i];
  7921. nodeData = groupData[i];
  7922. if ((node)) {
  7923. (node).rave_setData(nodeData);
  7924. updateNodes[i] = node;
  7925. } else {
  7926. enterNodes[i] = new com_ibm_rave_core_internal_nativeImpl_selector_EmptySceneNode(nodeData);
  7927. }
  7928. }
  7929. for (; i < m; ++i) {
  7930. enterNodes[i] = new com_ibm_rave_core_internal_nativeImpl_selector_EmptySceneNode(groupData[i]);
  7931. }
  7932. for (; i < n; ++i) {
  7933. exitNodes[i] = group[i];
  7934. }
  7935. }
  7936. enterNodes["update"] = updateNodes;
  7937. enterNodes["parentNode"] = updateNodes["parentNode"] = exitNodes["parentNode"] = group["parentNode"];
  7938. enter.push(enterNodes);
  7939. update.push(updateNodes);
  7940. exit.push(exitNodes);
  7941. };
  7942. if (typeof value === "function") {
  7943. while (++i < n) {
  7944. bind((group = this[i]), (value).call(group["parentNode"], group["parentNode"].rave_getData(), i, -1));
  7945. }
  7946. } else {
  7947. while (++i < n) {
  7948. bind(this[i], value);
  7949. }
  7950. }
  7951. return update;
  7952. },
  7953. /**
  7954. * Returns the enter selection: placeholder nodes for each data element for which no corresponding existing element was found in the current selection. This method is only defined on the update selection, which is returned by the data operator. In addition, the enter selection only defines the append, insert, select and call operators; you must use these operators to instantiate the entering elements before modifying any content. Enter selections also support empty and size.
  7955. * @return (com.ibm.rave.core.selector.Selector) the enter selection
  7956. */
  7957. /** @expose */
  7958. enter : function() {
  7959. return this.enterSelector;
  7960. },
  7961. /**
  7962. * Returns the exit selection: existing elements in the current selection for which no new data element was found. This method is only defined on the update selection, which is returned by the data operator. The exit selection defines all the normal operators, though typically the main one you'll want to use is remove; the other operators exist primarily so you can define an exiting transition as desired. Note that the exit operator merely returns a reference to the exit selection, and it is up to you to remove the new nodes.
  7963. * @return (com.ibm.rave.core.selector.Selector) the exit selection
  7964. */
  7965. /** @expose */
  7966. exit : function() {
  7967. return this.exitSelector;
  7968. },
  7969. /**
  7970. * Starts a transition for the current selection. Transitions behave much like selections, except operators animate smoothly over time rather than applying instantaneously. <p> Transitions of the same name are exclusive per-element. When the new transition starts on a given element, it will interrupt an active transition of the same name on the element, if any. If a name is not specified, the empty name ("") is used.
  7971. * @return (com.ibm.rave.core.transition.Transition) a new transition for the current selection
  7972. */
  7973. transition$0 : function() {
  7974. return this.transition$1(null);
  7975. },
  7976. /**
  7977. * Starts a transition for the current selection. Transitions behave much like selections, except operators animate smoothly over time rather than applying instantaneously. <p> Transitions of the same name are exclusive per-element. When the new transition starts on a given element, it will interrupt an active transition of the same name on the element, if any. If a name is not specified, the empty name ("") is used.
  7978. * @param (String) name the name of the transition
  7979. * @return (com.ibm.rave.core.transition.Transition) a new transition for the current selection
  7980. */
  7981. transition$1 : function(name) {
  7982. var inherit = com_ibm_rave_core_internal_nativeImpl_transitions_InheritedTransition.get();
  7983. if (inherit) {
  7984. return com_ibm_rave_core_transition_Transition.create(this, name, inherit);
  7985. }
  7986. return com_ibm_rave_core_transition_Transition.create(this, name);
  7987. },
  7988. /**
  7989. * Immediately interrupts the active transition of the specified name on the selected elements, if any. If a name is not specified, the empty name (“”) is used. Does not cancel any scheduled transitions that have not yet started. To cancel scheduled transitions as well, simply create a new zero-delay transition after interrupting the current transition: <pre> selection.interrupt() // cancel the current transition .transition(); // preempt any scheduled transitions </pre>
  7990. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  7991. */
  7992. interrupt$0 : function() {
  7993. return this.interrupt$1(null);
  7994. },
  7995. /**
  7996. * Immediately interrupts the active transition of the specified name on the selected elements, if any. If a name is not specified, the empty name (“”) is used. Does not cancel any scheduled transitions that have not yet started. To cancel scheduled transitions as well, simply create a new zero-delay transition after interrupting the current transition: <pre> selection.interrupt() // cancel the current transition .transition(); // preempt any scheduled transitions </pre>
  7997. * @param (String) name the name of the transition
  7998. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  7999. */
  8000. interrupt$1 : function(name) {
  8001. var node;
  8002. for (var j = 0, m = this.length; j < m; ++j) {
  8003. var group = this[j];
  8004. for (var i = 0, n = group.length; i < n; ++i) {
  8005. if ((node = group[i])) {
  8006. com_ibm_rave_core_internal_transitions_TransitionUtil.interruptNS(node, com_ibm_rave_core_internal_transitions_TransitionUtil.transitionNamespace(name));
  8007. }
  8008. }
  8009. }
  8010. return this;
  8011. },
  8012. /**
  8013. * Return a new selector based on 'query', only returning the first match. Also creates a new single data entry for the selection and sets the parent node for the next set of matches.
  8014. * @param (Object) query CSS3 Selection query syntax.
  8015. * @return (com.ibm.rave.core.selector.Selector) a new selector
  8016. */
  8017. select$0 : function(query) {
  8018. return this.select$1(com_ibm_rave_core_internal_selector_SelectorHelper.selector(query));
  8019. },
  8020. /**
  8021. * Return a new selector based on the nodes returned by the value function. Also creates a new single data entry for the selection and sets the parent node for the next set of matches.
  8022. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction
  8023. * @return (com.ibm.rave.core.selector.Selector) a new selector
  8024. */
  8025. select$1 : function(valueFunction) {
  8026. var subgroups = this.getSelectorFactory()();
  8027. var subgroup;
  8028. var subnode;
  8029. var group;
  8030. var node;
  8031. for (var j = 0, m = this.length; j < m; ++j) {
  8032. group = this[j];
  8033. subgroup = [];
  8034. subgroups.push(subgroup);
  8035. subgroup["parentNode"] = group["parentNode"];
  8036. for (var i = 0, n = group.length; i < n; ++i) {
  8037. if ((node = group[i]) && valueFunction) {
  8038. subgroup.push(subnode = valueFunction.call(node, node.rave_getData(), i, j));
  8039. if (subnode && node.rave_hasData()) {
  8040. subnode.rave_setData(node.rave_getData());
  8041. }
  8042. } else {
  8043. subgroup.push(null);
  8044. }
  8045. }
  8046. }
  8047. return subgroups;
  8048. },
  8049. selectAll$0 : function(query) {
  8050. return this.selectAll$1(com_ibm_rave_core_internal_selector_SelectorHelper.selectorAll(query));
  8051. },
  8052. selectAll$1 : function(selector) {
  8053. var subgroups = this.getSelectorFactory()();
  8054. var subgroup;
  8055. var group;
  8056. var node;
  8057. for (var j = 0, m = this.length; j < m; ++j) {
  8058. subgroup = [];
  8059. group = this[j];
  8060. for (var i = 0, n = group.length; i < n; ++i) {
  8061. if ((node = group[i])) {
  8062. subgroups.push(subgroup = com_ibm_rave_core_selector_Selector.createSelectorGroupFromNodes(selector ? selector.call(node, node.rave_getData(), i, j) : null));
  8063. subgroup["parentNode"] = node;
  8064. }
  8065. }
  8066. }
  8067. return subgroups;
  8068. },
  8069. /**
  8070. * Invokes the specified function for each element in the current selection, passing in the current datum and index, with the this context of the current element. This operator can be used to invoke arbitrary code for each selected element.
  8071. * @param (com.ibm.rave.core.selector.CallbackFunction) callback the callback to run for each element in the current selection
  8072. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  8073. */
  8074. /** @expose */
  8075. each : function(callback) {
  8076. return com_ibm_rave_core_internal_selector_SelectorHelper.each(this, callback);
  8077. },
  8078. /**
  8079. * Invokes the specified function once with this selector as the context. Selects the first element that matches the specified selector string, returning a single-element selection. If no elements in the current document match the specified selector, returns the empty selection. If multiple elements match the selector, only the first matching element (in document traversal order) will be selected.
  8080. * @param (com.ibm.rave.core.selector.RunFunction) callback the function to callback, must be annotated as {@link (com.ibm.rave.codegenerator.annotations.FunctionClass) FunctionClass}
  8081. * @param (java.lang.Object[]) args optional arguments to pass to the call function
  8082. * @return (com.ibm.rave.core.selector.Selector) this selector
  8083. */
  8084. /** @expose */
  8085. call : function(callback, args) {
  8086. if (args !== null || arguments.length > 2){
  8087. args = Array.prototype.slice.call(arguments, 1);
  8088. }
  8089. {
  8090. var list = (args);
  8091. list.splice(0, 0, this);
  8092. callback.apply(this, list);
  8093. return this;
  8094. }
  8095. },
  8096. /**
  8097. * Selects the specified node. This is useful if you already have a reference to a node.
  8098. * @param (com.ibm.rave.core.scene.SceneNode) node the node to select
  8099. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  8100. */
  8101. init$0 : function(node) {
  8102. var group = com_ibm_rave_core_selector_Selector.createSelectorGroupFromNode(node);
  8103. this.push(group);
  8104. group["parentNode"] = com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocumentElement(node);
  8105. return this;
  8106. },
  8107. /**
  8108. * Selects the specified array of elements. This is useful if you already have a reference to nodes.
  8109. * @param (Array) nodes the nodes to select
  8110. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  8111. */
  8112. initAll$0 : function(nodes) {
  8113. var group = com_ibm_rave_core_selector_Selector.createSelectorGroupFromNodes(nodes);
  8114. this.push(group);
  8115. group["parentNode"] = com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocumentElement(com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocument());
  8116. return this;
  8117. },
  8118. /**
  8119. * Selects the first element that matches the specified selector string, returning a single-element selection. If no elements match the specified selector, returns the empty selection. If multiple elements match the selector, only the first matching element (in traversal order) will be selected.
  8120. * @param (String) query CSS3 selector query syntax
  8121. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  8122. */
  8123. init$1 : function(query) {
  8124. var node = com_ibm_rave_core_Configuration.INSTANCE.filter(com_ibm_rave_core_internal_util_QueryUtil.getQueryEngine(null).querySelector(query), query);
  8125. var group = com_ibm_rave_core_selector_Selector.createSelectorGroupFromNode(node);
  8126. this.push(group);
  8127. group["parentNode"] = com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocumentElement(node);
  8128. return this;
  8129. },
  8130. /**
  8131. * Selects all elements that match the specified selector. The elements will be selected in traversal order (top-to-bottom). If no elements match the specified selector, returns the empty selection.
  8132. * @param (String) query CSS3 selector query syntax
  8133. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  8134. */
  8135. initAll$1 : function(query) {
  8136. var nodes = com_ibm_rave_core_Configuration.INSTANCE.filterArray(com_ibm_rave_core_internal_util_QueryUtil.getQueryEngine(null).querySelectorAll(query));
  8137. var group = com_ibm_rave_core_selector_Selector.createSelectorGroupFromNodes(nodes);
  8138. this.push(group);
  8139. group["parentNode"] = com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocumentElement(com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocument());
  8140. return this;
  8141. },
  8142. /**
  8143. * Re-inserts elements such that the document order matches the selection order. This is equivalent to calling sort() if the data is already sorted, but much faster.
  8144. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  8145. */
  8146. /** @expose */
  8147. order : function() {
  8148. for (var j = 0, m = this.length; j < m; ++j) {
  8149. var group = this[j];
  8150. var i = group.length - 1;
  8151. var next = group[i];
  8152. while (--i >= 0) {
  8153. var node;
  8154. if ((node = group[i])) {
  8155. if (next && !(next === node.rave_getNextSibling())) {
  8156. next.rave_getParentNode().rave_insertBefore(node, next);
  8157. }
  8158. next = node;
  8159. }
  8160. }
  8161. }
  8162. return this;
  8163. },
  8164. /**
  8165. * Sort the nodes in this selection. The order is determined by the provided comparator. The comparator must be able to compare the data values associate with these nodes (i.e. number comparator for numeric data).
  8166. * @param (com.ibm.rave.core.util.Comparator) c {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} data value comparator.
  8167. * @return (com.ibm.rave.core.selector.Selector) This selection with its nodes reordered. Note the nodes will be reinserted into the document to match the new sorted order (see {@link this.Selector#this.order()} ).
  8168. */
  8169. sort$1 : function(c) {
  8170. var comparator = function(a, b) {
  8171. if (a && b) {
  8172. return c(a.rave_getData(), b.rave_getData());
  8173. }
  8174. return +(!((a))) - +(!((b)));
  8175. };
  8176. var m = this.length;
  8177. for (var j = 0; j < m; ++j) {
  8178. this[j].sort(comparator);
  8179. }
  8180. return this.order();
  8181. },
  8182. /**
  8183. * Sorts the nodes in this selection in ascending order of their data values.
  8184. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  8185. */
  8186. sort$0 : function() {
  8187. return this.sort$1(com_ibm_rave_core_arrays_Sort.ascending);
  8188. },
  8189. /**
  8190. * Perform a recursive mirror on each node in the current selection. This is typically performed on an 'owner' node (an SVG node for example). Calling mirror(true) will perform a horizontal scale so that all nodes move from the left of the viewport to their equivalent position from the right of the viewport. Special logic is included to ensure that &lt;image&gt; and &lt;text&gt; nodes do not appear backwards - they are flipped within their mirrored bounds. These nodes can be restored to their unflipped state by performing a new selection on them and calling mirror(false).
  8191. * @param (boolean) mirror - if <code>true</code> each node in this selection will be mirrored (if not already). Likewise, if <code>false</code> then they are 'un' mirrored.
  8192. * @return (com.ibm.rave.core.selector.Selector) Selector containing the currently selected nodes.
  8193. */
  8194. /** @expose */
  8195. mirror : function(mirror) {
  8196. var mirroredSelector = new com_ibm_rave_core_internal_selector_mirror_MirroredSelector();
  8197. if (this.node()) {
  8198. com_ibm_rave_core_internal_selector_mirror_MirroredSelector.register(this.node().rave_getNamespaceURI());
  8199. mirroredSelector.initWithSelector(this);
  8200. mirroredSelector.mirror(mirror);
  8201. }
  8202. return (mirror) ? mirroredSelector : this;
  8203. },
  8204. /**
  8205. * Init this selector with an existing selector. Assumes 'this' selector is empty.
  8206. * @param (com.ibm.rave.core.selector.Selector) selector
  8207. */
  8208. /** @expose */
  8209. initWithSelector : function(selector) {
  8210. var group;
  8211. var newgroup;
  8212. var node;
  8213. for (var j = 0, m = selector.length; j < m; ++j) {
  8214. group = selector[j];
  8215. newgroup = [];
  8216. newgroup["parentNode"] = group["parentNode"];
  8217. this.push(newgroup);
  8218. for (var i = 0, n = group.length; i < n; ++i) {
  8219. node = group[i];
  8220. if (this.needsNodeExtension) {
  8221. node = com_ibm_rave_core_Configuration.INSTANCE.extendRecursive(node);
  8222. }
  8223. newgroup.push(node);
  8224. }
  8225. }
  8226. },
  8227. /**
  8228. * Get the extended selector for the given id.
  8229. * @param (String) id The id associated with the extended selector.
  8230. * @return (com.ibm.rave.core.selector.Selector) An instance of the extended selector, or null if none found.
  8231. */
  8232. extension$0 : function(id) {
  8233. var delegate = com_ibm_rave_core_selector_Selector.selectorDelegateRegistry.extension$0(id);
  8234. return delegate != null ? (delegate).setDelegate(this) : null;
  8235. },
  8236. /**
  8237. * Dispose this selection; allow any clean up to be performed. The node is removed, then disposed.
  8238. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  8239. */
  8240. /** @expose */
  8241. dispose : function() {
  8242. this.remove();
  8243. var node;
  8244. for (var j = 0, m = this.length; j < m; ++j) {
  8245. var group = this[j];
  8246. for (var i = 0, n = group.length; i < n; ++i) {
  8247. if ((node = group[i])) {
  8248. node.rave_dispose();
  8249. }
  8250. }
  8251. }
  8252. return this;
  8253. },
  8254. /** @expose */
  8255. append : function(a0) {
  8256. var args = arguments;
  8257. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  8258. return this.append$0(a0);
  8259. }
  8260. return this.append$1(a0);
  8261. },
  8262. /** @expose */
  8263. insert : function(a0, a1) {
  8264. var args = arguments;
  8265. if (args.length == 2 && typeof a0 === "function" && (a1 == null || typeof a1 === "string")) {
  8266. return this.insert$0(a0, a1);
  8267. }
  8268. if (args.length == 2 && typeof a0 === "function" && typeof a1 === "function") {
  8269. return this.insert$1(a0, a1);
  8270. }
  8271. if (args.length == 2 && (a0 == null || typeof a0 === "string") && (a1 == null || typeof a1 === "string")) {
  8272. return this.insert$2(a0, a1);
  8273. }
  8274. return this.insert$3(a0, a1);
  8275. },
  8276. /** @expose */
  8277. on : function(a0, a1, a2) {
  8278. var args = arguments;
  8279. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  8280. return this.on$0(a0);
  8281. }
  8282. if (args.length == 1) {
  8283. return this.on$1(a0);
  8284. }
  8285. if (args.length == 2) {
  8286. return this.on$2(a0, a1);
  8287. }
  8288. return this.on$3(a0, a1, a2);
  8289. },
  8290. /** @expose */
  8291. owner : function(a0) {
  8292. var args = arguments;
  8293. if (args.length == 0) {
  8294. return this.owner$0();
  8295. }
  8296. if (args.length == 1 && typeof a0 === "function") {
  8297. return this.owner$2(a0);
  8298. }
  8299. return this.owner$1(a0);
  8300. },
  8301. /** @expose */
  8302. attr : function(a0, a1) {
  8303. var args = arguments;
  8304. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  8305. return this.attr$3(a0);
  8306. }
  8307. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  8308. return this.attr$2(a0, a1);
  8309. }
  8310. if (args.length == 2 && (a0 == null || typeof a0 === "string") && (a1 == null || Object.prototype.toString.call(a1) !== "[object Array]")) {
  8311. return this.attr$1(a0, a1);
  8312. }
  8313. return com_ibm_rave_core_nativeImpl_Declare.invokeSuper(this, args);
  8314. },
  8315. /** @expose */
  8316. style : function(a0, a1, a2) {
  8317. var args = arguments;
  8318. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  8319. return this.style$6(a0);
  8320. }
  8321. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  8322. return this.style$3(a0, a1);
  8323. }
  8324. if (args.length == 2 && (a0 == null || typeof a0 === "string") && (a1 == null || Object.prototype.toString.call(a1) !== "[object Array]")) {
  8325. return this.style$2(a0, a1);
  8326. }
  8327. if (args.length == 3 && (a0 == null || typeof a0 === "string") && typeof a1 === "function" && (a2 == null || typeof a2 === "string")) {
  8328. return this.style$5(a0, a1, a2);
  8329. }
  8330. if (args.length == 3 && (a0 == null || typeof a0 === "string") && (a1 == null || Object.prototype.toString.call(a1) !== "[object Array]") && (a2 == null || typeof a2 === "string")) {
  8331. return this.style$4(a0, a1, a2);
  8332. }
  8333. return com_ibm_rave_core_nativeImpl_Declare.invokeSuper(this, args);
  8334. },
  8335. /** @expose */
  8336. property : function(a0, a1) {
  8337. var args = arguments;
  8338. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  8339. return this.property$0(a0);
  8340. }
  8341. if (args.length == 1) {
  8342. return this.property$1(a0);
  8343. }
  8344. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  8345. return this.property$3(a0, a1);
  8346. }
  8347. return this.property$2(a0, a1);
  8348. },
  8349. /** @expose */
  8350. text : function(a0) {
  8351. var args = arguments;
  8352. if (args.length == 0) {
  8353. return this.text$0();
  8354. }
  8355. if (args.length == 1 && typeof a0 === "function") {
  8356. return this.text$2(a0);
  8357. }
  8358. return this.text$1(a0);
  8359. },
  8360. /** @expose */
  8361. html : function(a0) {
  8362. var args = arguments;
  8363. if (args.length == 0) {
  8364. return this.html$0();
  8365. }
  8366. if (args.length == 1 && typeof a0 === "function") {
  8367. return this.html$2(a0);
  8368. }
  8369. return this.html$1(a0);
  8370. },
  8371. /** @expose */
  8372. filter : function(a0) {
  8373. var args = arguments;
  8374. if (args.length == 1 && typeof a0 === "function") {
  8375. return this.filter$0(a0);
  8376. }
  8377. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  8378. return this.filter$1(a0);
  8379. }
  8380. return com_ibm_rave_core_nativeImpl_Declare.invokeSuper(this, args);
  8381. },
  8382. /** @expose */
  8383. classed : function(a0, a1) {
  8384. var args = arguments;
  8385. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  8386. return this.classed$0(a0);
  8387. }
  8388. if (args.length == 1) {
  8389. return this.classed$1(a0);
  8390. }
  8391. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  8392. return this.classed$3(a0, a1);
  8393. }
  8394. return this.classed$2(a0, a1);
  8395. },
  8396. /** @expose */
  8397. data : function(a0, a1) {
  8398. var args = arguments;
  8399. if (args.length == 0) {
  8400. return this.data$0();
  8401. }
  8402. if (args.length == 1 && typeof a0 === "function") {
  8403. return this.data$1(a0);
  8404. }
  8405. if (args.length == 1) {
  8406. return this.data$3(a0);
  8407. }
  8408. if (args.length == 2 && typeof a0 === "function" && typeof a1 === "function") {
  8409. return this.data$2(a0, a1);
  8410. }
  8411. return this.data$4(a0, a1);
  8412. },
  8413. /** @expose */
  8414. datum : function(a0) {
  8415. var args = arguments;
  8416. if (args.length == 0) {
  8417. return this.datum$0();
  8418. }
  8419. if (args.length == 1 && typeof a0 === "function") {
  8420. return this.datum$1(a0);
  8421. }
  8422. return this.datum$2(a0);
  8423. },
  8424. /** @expose */
  8425. transition : function(a0) {
  8426. var args = arguments;
  8427. if (args.length == 0) {
  8428. return this.transition$0();
  8429. }
  8430. return this.transition$1(a0);
  8431. },
  8432. /** @expose */
  8433. interrupt : function(a0) {
  8434. var args = arguments;
  8435. if (args.length == 0) {
  8436. return this.interrupt$0();
  8437. }
  8438. return this.interrupt$1(a0);
  8439. },
  8440. /** @expose */
  8441. select : function(a0) {
  8442. var args = arguments;
  8443. if (args.length == 1 && typeof a0 === "function") {
  8444. return this.select$1(a0);
  8445. }
  8446. return this.select$0(a0);
  8447. },
  8448. /** @expose */
  8449. selectAll : function(a0) {
  8450. var args = arguments;
  8451. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  8452. return this.selectAll$0(a0);
  8453. }
  8454. return this.selectAll$1(a0);
  8455. },
  8456. /** @expose */
  8457. init : function(a0) {
  8458. var args = arguments;
  8459. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  8460. return this.init$1(a0);
  8461. }
  8462. return this.init$0(a0);
  8463. },
  8464. /** @expose */
  8465. initAll : function(a0) {
  8466. var args = arguments;
  8467. if (args.length == 1 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]")) {
  8468. return this.initAll$0(a0);
  8469. }
  8470. return this.initAll$1(a0);
  8471. },
  8472. /** @expose */
  8473. sort : function(a0) {
  8474. var args = arguments;
  8475. if (args.length == 0) {
  8476. return this.sort$0();
  8477. }
  8478. return this.sort$1(a0);
  8479. },
  8480. /** @expose */
  8481. extension : function(a0) {
  8482. var args = arguments;
  8483. return this.extension$0(a0);
  8484. }
  8485. });
  8486. com_ibm_rave_core_selector_Selector.createSelectorGroupFromNodes = function(nodes) {
  8487. var result = [];
  8488. if (nodes) {
  8489. for (var i = 0; i < nodes.length; ++i) {
  8490. result.push(nodes[i]);
  8491. }
  8492. }
  8493. return result;
  8494. };
  8495. com_ibm_rave_core_selector_Selector.createSelectorGroupFromNode = function(node) {
  8496. var result = [];
  8497. if (node) {
  8498. result.push(node);
  8499. }
  8500. return result;
  8501. };
  8502. /**
  8503. * Create a scene node for the given type.
  8504. * @param (String) nsuri the namespace URI for the name, may be <code>null</code>
  8505. * @param (String) name the scene node name
  8506. * @param (com.ibm.rave.core.scene.SceneNode) context optional context in which the node is to reside
  8507. * @return (com.ibm.rave.core.scene.SceneNode) a new scene node
  8508. */
  8509. com_ibm_rave_core_selector_Selector.createSceneNode = function(nsuri, name, context) {
  8510. var config = com_ibm_rave_core_Configuration.INSTANCE;
  8511. var nodeFactory;
  8512. nodeFactory = config.getSceneNodeFactory(context.rave_getQualifiedName());
  8513. if (nsuri == null) {
  8514. nsuri = context.rave_getNamespaceURI();
  8515. }
  8516. if (!nodeFactory) {
  8517. nodeFactory = config.getSceneNodeFactory(nsuri);
  8518. }
  8519. return nodeFactory(nsuri, name, context);
  8520. };
  8521. /**
  8522. * Register a selector extension factory.
  8523. * @param (String) id extension identifier
  8524. * @param (com.ibm.rave.core.ExtensionFactory) extensionFactory The selector extension factory
  8525. * @return (boolean) true, if the registration was successful, false otherwise
  8526. */
  8527. com_ibm_rave_core_selector_Selector.extension$1 = function(id, extensionFactory) {
  8528. return com_ibm_rave_core_selector_Selector.selectorDelegateRegistry.extension$1(id, extensionFactory);
  8529. };
  8530. /** @expose */
  8531. com_ibm_rave_core_selector_Selector.extension = function(a0, a1) {
  8532. var args = arguments;
  8533. return com_ibm_rave_core_selector_Selector.extension$1(a0, a1);
  8534. };
  8535. com_ibm_rave_core_selector_Selector.factory = function() {
  8536. return new com_ibm_rave_core_selector_Selector();
  8537. };
  8538. com_ibm_rave_core_selector_Selector.selectorDelegateRegistry = new com_ibm_rave_core_RegistryService();
  8539. // $source: com/ibm/rave/core/selector/EnterSelector
  8540. /************************************************************************
  8541. ** IBM Confidential
  8542. **
  8543. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8544. **
  8545. ** (C) Copyright IBM Corp. 2015
  8546. **
  8547. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8548. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8549. ************************************************************************/
  8550. // GENERATED
  8551. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // invokeSuper, declare
  8552. //@import com/ibm/rave/core/selector/Selector (loadtime) // superclass
  8553. var com_ibm_rave_core_selector_EnterSelector = rave_externs["EnterSelector"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_selector_Selector, {
  8554. //factory : null,
  8555. setSelectorFactory : function(factory) {
  8556. this.factory = factory;
  8557. return this;
  8558. },
  8559. insert$4 : function(type) {
  8560. return this.insert$3(type, com_ibm_rave_core_selector_EnterSelector.enterInsertBefore(this));
  8561. },
  8562. insert$5 : function(type) {
  8563. return this.insert$1(type, com_ibm_rave_core_selector_EnterSelector.enterInsertBefore(this));
  8564. },
  8565. /** @expose */
  8566. select$1 : function(valueFunction) {
  8567. var subgroups = this.factory();
  8568. var subgroup;
  8569. var subnode;
  8570. var group;
  8571. var upgroup;
  8572. var node;
  8573. for (var j = 0, m = this.length; j < m; ++j) {
  8574. group = this[j];
  8575. upgroup = group["update"];
  8576. subgroup = [];
  8577. subgroups.push(subgroup);
  8578. subgroup["parentNode"] = group["parentNode"];
  8579. for (var i = 0, n = group.length; i < n; ++i) {
  8580. if ((node = group[i])) {
  8581. subgroup.push(subnode = valueFunction.call(group["parentNode"], node.rave_getData(), i, j));
  8582. upgroup[i] = subnode;
  8583. subnode.rave_setData(node.rave_getData());
  8584. } else {
  8585. subgroup.push(null);
  8586. }
  8587. }
  8588. }
  8589. return subgroups;
  8590. },
  8591. /** @expose */
  8592. insert : function(a0) {
  8593. var args = arguments;
  8594. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  8595. return this.insert$4(a0);
  8596. }
  8597. if (args.length == 1 && typeof a0 === "function") {
  8598. return this.insert$5(a0);
  8599. }
  8600. return com_ibm_rave_core_nativeImpl_Declare.invokeSuper(this, args);
  8601. }
  8602. });
  8603. com_ibm_rave_core_selector_EnterSelector.enterInsertBefore = function(enter) {
  8604. var i0, j0;
  8605. return function(d, i, j) {
  8606. var group = enter[j]["update"];
  8607. var n = group.length;
  8608. var node;
  8609. if (j != j0) {
  8610. j0 = j;
  8611. i0 = 0;
  8612. }
  8613. if (i >= i0) {
  8614. i0 = i + 1;
  8615. }
  8616. while (!(node = group[i0]) && ++i0 < n) {
  8617. }
  8618. return node;
  8619. };
  8620. };
  8621. // $source: com/ibm/rave/core/internal/nativeImpl/PlatformInitialization
  8622. /************************************************************************
  8623. ** IBM Confidential
  8624. **
  8625. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8626. **
  8627. ** (C) Copyright IBM Corp. 2014
  8628. **
  8629. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8630. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8631. ************************************************************************/
  8632. // @import ./scene/DOMSceneNode (static)
  8633. // @import ./selector/DOMSelectionQueryEngine (static)
  8634. // @import com/ibm/rave/core/Configuration (static)
  8635. // @import com/ibm/rave/core/selector/Selector (static)
  8636. var com_ibm_rave_core_internal_nativeImpl_PlatformInitialization = function() {
  8637. var config = com_ibm_rave_core_Configuration.INSTANCE;
  8638. var domFactory = function(nsuri, name, context) {
  8639. var doc = context.ownerDocument || context.rave_getOwner().ownerDocument;
  8640. return nsuri ? doc.createElementNS(nsuri, name) : doc.createElement(name);
  8641. };
  8642. config.setSceneNodeFactory(null, domFactory);
  8643. config.setSceneNodeFactory("http://www.w3.org/1999/xhtml", domFactory);
  8644. config.setSceneNodeFactory("http://www.w3.org/2000/svg", domFactory);
  8645. // Query Engines
  8646. var domQueryEngine = new com_ibm_rave_core_internal_nativeImpl_selector_DOMSelectionQueryEngine();
  8647. config.setQueryEngine(null, domQueryEngine);
  8648. config.setQueryEngine("http://www.w3.org/1999/xhtml", domQueryEngine);
  8649. config.setQueryEngine("http://www.w3.org/2000/svg", domQueryEngine);
  8650. // This is an optimization to reduce skip factory lookup if only the domFactory is present.
  8651. var oriCreateSceneNode = com_ibm_rave_core_selector_Selector.createSceneNode;
  8652. com_ibm_rave_core_selector_Selector.createSceneNode = function(nsuri, name, context) {
  8653. var node = domFactory(nsuri == null ? context.namespaceURI : nsuri, name, context);
  8654. if (config.nodeExtensions) {
  8655. config.extend(node, context)
  8656. }
  8657. return node;
  8658. };
  8659. var oriSetSceneNodeFactory = com_ibm_rave_core_Configuration.prototype.setSceneNodeFactory;
  8660. com_ibm_rave_core_Configuration.prototype.setSceneNodeFactory = function(namespaceUri, factory) {
  8661. oriSetSceneNodeFactory.call(this, namespaceUri, factory);
  8662. if (factory != domFactory) {
  8663. com_ibm_rave_core_selector_Selector.createSceneNode = oriCreateSceneNode;
  8664. com_ibm_rave_core_Configuration.prototype.setSceneNodeFactory = oriSetSceneNodeFactory;
  8665. }
  8666. }
  8667. };
  8668. com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getWindow = rave_window;
  8669. com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocumentElement = rave_documentElement;
  8670. com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocument = function() {
  8671. return rave_document;
  8672. };
  8673. com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocumentBodyElement = function() {
  8674. return rave_document.body;
  8675. };
  8676. // $source: com/ibm/rave/core/transition/Transition
  8677. /************************************************************************
  8678. ** IBM Confidential
  8679. **
  8680. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8681. **
  8682. ** (C) Copyright IBM Corp. 2015
  8683. **
  8684. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8685. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8686. ************************************************************************/
  8687. // GENERATED
  8688. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // invokeSuper, declare
  8689. //@import com/ibm/rave/core/selector/Selection (loadtime) // superclass
  8690. //@import com/ibm/rave/core/internal/transitions/Tweener (runtime) // schedule
  8691. //@import com/ibm/rave/core/internal/transitions/TransitionUtil (static) // transitionNamespace, getTransitionInfo, getTransitionTracker
  8692. //@import com/ibm/rave/core/internal/selector/SelectorHelper (runtime) // each, selectorAll, selector
  8693. //@import com/ibm/rave/core/ease/Easing (runtime) // Easing
  8694. //@import com/ibm/rave/core/internal/util/NamespaceUtil (runtime) // getQName
  8695. //@import com/ibm/rave/core/internal/transitions/TweenFunctions (runtime) // style, attr, styleTween, attrTween, tween
  8696. //@import com/ibm/rave/core/internal/nativeImpl/transitions/InheritedTransition (static) // set, get
  8697. //@import com/ibm/rave/core/internal/util/QueryUtil (runtime) // getQueryEngine
  8698. //@import com/ibm/rave/core/selector/Selector (static) // new
  8699. //@import com/ibm/rave/core/internal/nativeImpl/PlatformInitialization (static) // getDocument, getDocumentElement
  8700. /**
  8701. * A transition is a special type of selection where the operators apply smoothly over time rather than instantaneously. You derive a transition from a selection using the transition operator. While transitions generally support the same operators as selections (such as attr and style), not all operators are supported; for example, you must append elements before a transition starts. A remove operator is provided for convenient removal of elements when the transition ends. <p> Transitions may have per-element delays and durations, computed using functions of data similar to other operators. This makes it easy to stagger a transition for different elements, either based on data or index. For example, you can sort elements and then stagger the transition for better perception of element reordering during the transition. <p> There are many built-in interpolators to simplify the transitioning of arbitrary values. For instance, you can transition from the font string "500 12px sans-serif" to "300 42px sans-serif", and the interpolator will find the numbers embedded within the string, interpolating both font size and weight automatically. You can even interpolate arbitrary nested objects and arrays or SVG path data. The addition of custom interpolators are supported should you find the built-in ones insufficient, using the attrTween and styleTween operators. <p> Only one transition may be active on a given element at a given time. However, multiple transitions may be scheduled on the same element; provided they are staggered in time, each transition will run in sequence. If a newer transition runs on a given element, it implicitly cancels any older transitions, including any that were scheduled but not yet run. This allows new transitions, such as those in response to a new user event, to supersede older transitions even if those older transitions are staged or have staggered delays. Multi-stage transitions (transitions that are created during the "end" event of an earlier transition) are considered the same "age" as the original transition; internally this is tracked by monotonically-increasing unique IDs which are inherited when multi-stage transitions are created. To interrupt an in-progress transition, use {@link this.Selector#this.interrupt()} .
  8702. */
  8703. var com_ibm_rave_core_transition_Transition = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_selector_Selection, {
  8704. /**
  8705. * @expose
  8706. */
  8707. //namespace : null,
  8708. /**
  8709. * @expose
  8710. */
  8711. id : 0,
  8712. /**
  8713. * Get the integer ID of this transition.
  8714. * @return (int) the transition ID
  8715. */
  8716. /** @expose */
  8717. getId : function() {
  8718. return this.id;
  8719. },
  8720. /**
  8721. * Get the String name of this transition.
  8722. * @return (String) the transition name
  8723. */
  8724. /** @expose */
  8725. getNamespace : function() {
  8726. return this.namespace;
  8727. },
  8728. /**
  8729. * Construct a new transition.
  8730. * @param (int) id the assigned transition ID
  8731. * @param (String) transitionNamespace the transition name
  8732. */
  8733. constructor : function(id, transitionNamespace) {
  8734. this.namespace = transitionNamespace;
  8735. this.id = id;
  8736. com_ibm_rave_core_internal_transitions_Tweener.schedule(this);
  8737. },
  8738. /**
  8739. * Returns the delay, in milliseconds, bound to the first non-null element in the transition. If no non-null element exists, returns the default delay 0.
  8740. * @return (double) the delay in milliseconds
  8741. */
  8742. delay$0 : function() {
  8743. var node = this.node();
  8744. return node ? com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(node, this.namespace, this.id).delay : 0;
  8745. },
  8746. /**
  8747. * Specifies the transition delay in milliseconds as a constant.
  8748. * @param (Object) delay the transition delay in milliseonds
  8749. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  8750. */
  8751. delay$1 : function(delay) {
  8752. var d = + (delay);
  8753. var transitionId = this.id;
  8754. var transitionNamespace = this.namespace;
  8755. return com_ibm_rave_core_internal_selector_SelectorHelper.each(this, function(data, index, groupIndex) {
  8756. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(this, transitionNamespace, transitionId).delay = d;
  8757. });
  8758. },
  8759. /**
  8760. * Specifies the transition duration in milliseconds as a function. The function is evaluated for each selected element (in order), being passed the current datum and the current index, with the context as the current scene node. The function's return value is then used to set each element's delay.
  8761. * @param (com.ibm.rave.core.selector.ValueFunction) delayFunction the delay function to evaluate for each selected element
  8762. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  8763. */
  8764. delay$2 : function(delayFunction) {
  8765. var transitionId = this.id;
  8766. var transitionNamespace = this.namespace;
  8767. return com_ibm_rave_core_internal_selector_SelectorHelper.each(this, function(data, index, groupIndex) {
  8768. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(this, transitionNamespace, transitionId).delay = + (delayFunction.call(this, this.rave_getData(), index, groupIndex));
  8769. });
  8770. },
  8771. /**
  8772. * Returns the duration, in milliseconds, bound to the first non-null element in the transition. If no non-null element exists, returns the default duration 250.
  8773. * @return (double) the delay in milliseconds
  8774. */
  8775. duration$0 : function() {
  8776. var node = this.node();
  8777. return node ? com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(node, this.namespace, this.id).duration : 250;
  8778. },
  8779. /**
  8780. * Specifies the transition duration in milliseconds as a constant.
  8781. * @param (Object) duration the transition duration in milliseonds
  8782. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  8783. */
  8784. duration$1 : function(duration) {
  8785. var transitionId = this.id;
  8786. var transitionNamespace = this.namespace;
  8787. var d = Math.max(1, + (duration));
  8788. return com_ibm_rave_core_internal_selector_SelectorHelper.each(this, function(data, index, groupIndex) {
  8789. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(this, transitionNamespace, transitionId).duration = d;
  8790. });
  8791. },
  8792. /**
  8793. * Specifies the transition duration in milliseconds as a function. The function is evaluated for each selected element (in order), being passed the current datum and the current index, with the context as the current scene node. The function's return value is then used to set each element's duration.
  8794. * @param (com.ibm.rave.core.selector.ValueFunction) durationFunction the duration function to evaluate for each selected element
  8795. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  8796. */
  8797. duration$2 : function(durationFunction) {
  8798. var transitionId = this.id;
  8799. var transitionNamespace = this.namespace;
  8800. return com_ibm_rave_core_internal_selector_SelectorHelper.each(this, function(data, index, groupIndex) {
  8801. var d = + (durationFunction.call(this, data, index, groupIndex));
  8802. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(this, transitionNamespace, transitionId).duration = Math.max(1, d);
  8803. });
  8804. },
  8805. /**
  8806. * Returns the easing bound to the first non-null element in the transition. If no non-null element exists, returns the default easing 'cubic-in-out'.
  8807. * @return (com.ibm.rave.core.ease.EasingFunction) an {@link (com.ibm.rave.core.ease.EasingFunction) EasingFunction}
  8808. */
  8809. ease$0 : function() {
  8810. var node = this.node();
  8811. return node ? com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(node, this.namespace, this.id).ease : com_ibm_rave_core_ease_Easing.DEFAULT;
  8812. },
  8813. /**
  8814. * Specifies the easing by name. Both name and arguments are passed to {@link this.Rave#com_ibm_rave_core_Rave.ease} to generate an {@link (com.ibm.rave.core.ease.EasingFunction) EasingFunction} .
  8815. * @param (String) name the easing function name
  8816. * @param (java.lang.Object[]) args the easing function arguments
  8817. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  8818. */
  8819. ease$1 : function(name, args) {
  8820. if (args !== null || arguments.length > 2){
  8821. args = Array.prototype.slice.call(arguments, 1);
  8822. }
  8823. {
  8824. return this.ease$2(com_ibm_rave_core_ease_Easing.INSTANCE.apply(com_ibm_rave_core_ease_Easing.INSTANCE, [name].concat(args)));
  8825. }
  8826. },
  8827. /**
  8828. * Specifies the easing function which is used to ease the current parametric timing value, which is typically in the range [0,1]. (At the end of a transition, timing value may be slightly greater than 1.) <p> The default easing function is "cubic-in-out". Note that it is not possible to customize the easing function per-element or per-attribute; however, if you use the "linear" easing function, you can apply custom easing inside your interpolator using attrTween or styleTween.
  8829. * @param (com.ibm.rave.core.ease.EasingFunction) easeFunction the easing function
  8830. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  8831. */
  8832. ease$2 : function(easeFunction) {
  8833. var transitionId = this.id;
  8834. var transitionNamespace = this.namespace;
  8835. return com_ibm_rave_core_internal_selector_SelectorHelper.each(this, function(data, index, groupIndex) {
  8836. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(this, transitionNamespace, transitionId).ease = easeFunction;
  8837. });
  8838. },
  8839. /**
  8840. * Transitions the value of the attribute with the specified name to the specified value. The starting value of the transition is the current attribute value (be sure to set an initial value beforehand if you don't want bad surprises), and the ending value is the specified value. If value is a constant, then all elements are transitioned to the same attribute value; otherwise, if value is a function, then the function is evaluated for each selected element (in order), being passed the current datum and the current index, with the context as the current element. The function's return value is then used to transition each element's attribute. Null values are not supported because the interpolator would be undefined; if you want to remove the attribute after the transition finishes, use {@link #this.remove()} . <p> An interpolator is selected automatically based on the ending value. If the ending value is a number, the starting value is coerced to a number and interpolateNumber is used. If the ending value is a string, a check is performed to see if the string represents a color of the form /^(#|rgb\(|hsl\()/, or one of the CSS named colors; if so, the starting value is coerced to an RGB color and interpolateRgb is used. Otherwise, interpolateString is used, which interpolates numbers embedded within strings.
  8841. * @param (String) attribute the named attribute to tween
  8842. * @param (Object) value the attribute value as a constant or {@link (com.ibm.rave.core.selector.ValueFunction) ValueFunction}
  8843. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  8844. */
  8845. attr$1 : function(attribute, value) {
  8846. var qname = com_ibm_rave_core_internal_util_NamespaceUtil.getQName(attribute);
  8847. return com_ibm_rave_core_internal_transitions_TweenFunctions.tween(this, "attr." + attribute, value, function(v) {
  8848. return com_ibm_rave_core_internal_transitions_TweenFunctions.attr(qname, v);
  8849. });
  8850. },
  8851. /**
  8852. * Convenience method for specifying an attr transition where the value is a function which is evaluated for each selected element.
  8853. * @param (String) attribute the named attribute to tween
  8854. * @param (com.ibm.rave.core.selector.ValueFunction) value the attribute value as a {@link (com.ibm.rave.core.selector.ValueFunction) ValueFunction}
  8855. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  8856. * @see #this.attr(String, Object)
  8857. */
  8858. attr$2 : function(attribute, value) {
  8859. return this.attr$1(attribute, value);
  8860. },
  8861. /**
  8862. * Transitions the value of the attribute with the specified name according to the specified tween function. The starting and ending value of the transition are determined by tween; the tween function is invoked when the transition starts on each element, being passed the current datum, the current index and the current attribute value, with the context as the current scene node. The return value of tween must be an interpolator: a function that maps a parametric value t in the domain [0,1] to a color, number or arbitrary value. <p> The attrTween operator is used when you need a custom interpolator, such as one that understands the semantics of SVG path data. One common technique is dataspace interpolation, where interpolateObject is used to interpolate two data values, and the result of this interpolation is then used (say, with a shape) to compute the new attribute value. Use the attr operator for the simpler common case where an interpolator can be automatically derived from the current attribute value to the desired end value.
  8863. * @param (String) attribute the named attribute to tween
  8864. * @param (com.ibm.rave.core.transition.TransitionInterpolatorFactory) factory a factory function which returns an interpolator
  8865. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  8866. */
  8867. /** @expose */
  8868. attrTween : function(attribute, factory) {
  8869. var qname = com_ibm_rave_core_internal_util_NamespaceUtil.getQName(attribute);
  8870. return this.tween("attr." + attribute, com_ibm_rave_core_internal_transitions_TweenFunctions.attrTween(qname, factory));
  8871. },
  8872. /**
  8873. * Set the text content to the specified value on all selected elements when the transition starts. If value is a constant, then all elements are given the same text content; otherwise, if value is a function, then the function is evaluated for each selected element (in order), being passed the current datum and the current index, with the context as the current scene node. The function's return value is then used to set each element's text content. A null value will clear the content.
  8874. * @param (Object) value the text content value as a constant or a {@link (com.ibm.rave.core.selector.ValueFunction) ValueFunction}
  8875. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  8876. */
  8877. text$0 : function(value) {
  8878. return com_ibm_rave_core_internal_transitions_TweenFunctions.tween(this, "text", value, function(v) {
  8879. var textValue = (v == null ? "" : v + "");
  8880. return function(data, index, groupIndex) {
  8881. this.rave_setText(textValue);
  8882. return null;
  8883. };
  8884. });
  8885. },
  8886. /**
  8887. * Convenience method for specifying a text transition where the value is a function which is evaluated for each selected element.
  8888. * @param (com.ibm.rave.core.selector.ValueFunction) value the text content value as a {@link (com.ibm.rave.core.selector.ValueFunction) ValueFunction}
  8889. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  8890. * @see #this.text(Object)
  8891. */
  8892. text$1 : function(value) {
  8893. return this.text$0(value);
  8894. },
  8895. /**
  8896. * Same as {@link #this.style(String, Object, String)} with a null priority.
  8897. * @param (String) styleName the named style to tween
  8898. * @param (Object) value the style value as a constant or {@link (com.ibm.rave.core.selector.ValueFunction) ValueFunction}
  8899. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  8900. */
  8901. style$2 : function(styleName, value) {
  8902. return this.style$4(styleName, value, null);
  8903. },
  8904. /**
  8905. * Transitions the value of the CSS style property with the specified name to the specified value. An optional priority may also be specified, either as null or the string "important" (without the exclamation point). The starting value of the transition is the current computed style property value, and the ending value is the specified value. If value is a constant, then all elements are transitioned to the same style property value; otherwise, if value is a function, then the function is evaluated for each selected element (in order), being passed the current datum and the current index, with the context as the current element. The function's return value is then used to transition each element's style property. Null values are not supported because the interpolator would be undefined; if you want to remove the style property after the transition finishes, listen to the end event. <p> An interpolator is selected automatically based on the ending value. If the ending value is a number, the starting value is coerced to a number and interpolateNumber is used. If the ending value is a string, a check is performed to see if the string represents a color of the form /^(#|rgb\(|hsl\()/, or one of the CSS named colors; if so, the starting value is coerced to an RGB color and interpolateRgb is used. Otherwise, interpolateString is used, which interpolates numbers embedded within strings. <p> Note that the computed starting value may be different than the value that was previously set, particularly if the style property was set using a shorthand property (such as the "font" style, which is shorthand for "font-size", "font-face", etc.). Moreover, computed dimensions such as "font-size" and "line-height" are always in pixels, so you should specify the ending value in pixels too if appropriate.
  8906. * @param (String) styleName the named style to tween
  8907. * @param (Object) value the style value as a constant or {@link (com.ibm.rave.core.selector.ValueFunction) ValueFunction}
  8908. * @param (String) priority either null or the string "important"
  8909. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  8910. */
  8911. style$4 : function(styleName, value, priority) {
  8912. var p = priority != null ? priority : "";
  8913. return com_ibm_rave_core_internal_transitions_TweenFunctions.tween(this, "style." + styleName, value, function(v) {
  8914. return com_ibm_rave_core_internal_transitions_TweenFunctions.style(styleName, v, p);
  8915. });
  8916. },
  8917. /**
  8918. * Convenience method for specifying a style transition where the value is a function which is evaluated for each selected element.
  8919. * @param styleName the named style to tween
  8920. * @param (com.ibm.rave.core.selector.ValueFunction) value the style value as a {@link (com.ibm.rave.core.selector.ValueFunction) ValueFunction}
  8921. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  8922. * @see #this.style(String, Object)
  8923. */
  8924. style$3 : function(attribute, value) {
  8925. return this.style$4(attribute, value, null);
  8926. },
  8927. /**
  8928. * Convenience method for specifying a style transition where the value is a function which is evaluated for each selected element.
  8929. * @param styleName the named style to tween
  8930. * @param (com.ibm.rave.core.selector.ValueFunction) value the style value as a {@link (com.ibm.rave.core.selector.ValueFunction) ValueFunction}
  8931. * @param (String) priority either null or the string "important"
  8932. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  8933. * @see #this.style(String, Object, String)
  8934. */
  8935. style$5 : function(attribute, value, priority) {
  8936. return this.style$4(attribute, value, priority);
  8937. },
  8938. /**
  8939. * Same as {@link #this.styleTween(String, com_ibm_rave_core_transition_TransitionInterpolatorFactory, String)} with a null priority.
  8940. * @param (String) styleName the named style to tween
  8941. * @param (com.ibm.rave.core.transition.TransitionInterpolatorFactory) factory a factory function which returns an interpolator
  8942. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  8943. */
  8944. styleTween$0 : function(styleName, factory) {
  8945. return this.styleTween$1(styleName, factory, null);
  8946. },
  8947. /**
  8948. * Transitions the value of the CSS style property with the specified name according to the specified tween function. An optional priority may also be specified, either as null or the string "important" (without the exclamation point). The starting and ending value of the transition are determined by tween; the tween function is invoked when the transition starts on each element, being passed the current datum, the current index and the current attribute value, with the this context as the current scene node. The return value of tween must be an interpolator: a function that maps a parametric value t in the domain [0,1] to a color, number or arbitrary value. <p> The styleTween operator is used when you need a custom interpolator, such as one that understands the semantics of CSS3 transforms. Use the style operator for the simpler common case where an interpolator can be automatically derived from the current computed style property value to the desired end value.
  8949. * @param (String) styleName the named style to tween
  8950. * @param (com.ibm.rave.core.transition.TransitionInterpolatorFactory) factory a factory function which returns an interpolator
  8951. * @param (String) priority either null or the string "important"
  8952. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  8953. */
  8954. styleTween$1 : function(styleName, factory, priority) {
  8955. return this.tween("style." + styleName, com_ibm_rave_core_internal_transitions_TweenFunctions.styleTween(styleName, factory, priority != null ? priority : ""));
  8956. },
  8957. /**
  8958. * Registers a custom tween for the specified name. When the transition starts, the specified factory function will be invoked for each selected element in the transition, being passed that element's datum and index as arguments, with the element as the context. The factory should return the tween function to be called over the course of the transition. The tween function is then called repeatedly, being passed the current normalized time in [0, 1]. If the factory returns null, then the tween is not run on the selected element. <p> The tween method is used internally to implement attr and style tweens, and can be used to interpolate other document content.
  8959. * @param (String) name the tween name
  8960. * @param (com.ibm.rave.core.selector.ValueFunction) factory the tween factory which returns a {@link (com.ibm.rave.core.transition.Tween) Tween} function, or <code>null</code> to remove the tween by name
  8961. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  8962. */
  8963. tween$0 : function(name, factory) {
  8964. var transitionId = this.id;
  8965. var transitionName = this.namespace;
  8966. return com_ibm_rave_core_internal_selector_SelectorHelper.each(this, !factory ? function(data, index, groupIndex) {
  8967. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(this, transitionName, transitionId).removeTweenFactory(name);
  8968. } : function(data, index, groupIndex) {
  8969. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(this, transitionName, transitionId).addTweenFactory(name, factory);
  8970. });
  8971. },
  8972. /**
  8973. * Returns the {@link (com.ibm.rave.core.transition.Tween) Tween} associated with the given name bound to the first non-null element in the transition.
  8974. * @param (String) tweenName the tween name
  8975. * @return (com.ibm.rave.core.selector.ValueFunction) the {@link (com.ibm.rave.core.transition.Tween) Tween} associated with the given name, may be <code> null</code>
  8976. */
  8977. tween$1 : function(tweenName) {
  8978. var node = this.node();
  8979. return node ? com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(node, this.namespace, this.id).getTweenFactory(tweenName) : null;
  8980. },
  8981. /**
  8982. * Behaves similarly to selection.each: immediately invokes the specified function for each element in the current transition, passing in the current datum and index, with the context of the current scene node. Any transitions created within the scope of transition.each will inherit transition parameters from the parent transition, including id, delay, duration and easing. Thus, transitions created within a transition.each will not interrupt the parent transition, similar to subtransitions. <p> The transition.each method can be used to chain transitions and apply shared timing across a set of transitions. By using d3.select(this) within transition.each, you can even inherit staggered delay across a set of selected elements. This technique is used by the Axis component to support automatic transitions.
  8983. * @param (com.ibm.rave.core.selector.CallbackFunction) callback the callback function
  8984. */
  8985. each$0 : function(callback) {
  8986. var transitionId = this.id;
  8987. var transitionNamespace = this.namespace;
  8988. var inherit = com_ibm_rave_core_internal_nativeImpl_transitions_InheritedTransition.get();
  8989. try {
  8990. return com_ibm_rave_core_internal_selector_SelectorHelper.each(this, function(data, index, groupIndex) {
  8991. var info = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(this, transitionNamespace, transitionId);
  8992. com_ibm_rave_core_internal_nativeImpl_transitions_InheritedTransition.set(info);
  8993. callback.call(this, data, index, groupIndex);
  8994. });
  8995. } finally {
  8996. com_ibm_rave_core_internal_nativeImpl_transitions_InheritedTransition.set(inherit);
  8997. }
  8998. },
  8999. /**
  9000. * Adds a listener for transition events, supporting "start", and "end" events. The listener will be invoked for each individual element in the transition. <p> The start event is invoked during the first asynchronous callback (tick) of the transition, before any tweens are invoked. For transitions with zero delay, this is typically about 17ms after the transition is scheduled. State events are useful for triggering instantaneous changes to each element, such as changing attributes that cannot be interpolated. <p> The end event is invoked during the last asynchronous callback (tick) after the transition duration and delay expires, after all tweens are invoked with t=1. Note that if the transition is superseded by a later-scheduled transition on a given element, no end event will be dispatched for that element; interrupted transitions do not trigger end events. For example, transition.remove schedules each element to be removed when the transition ends, but if the transition is interrupted, the element will not be removed. End events can be used as an alternative to transition.transition to create chained transitions by selecting the current element, this, and deriving a new transition; however, this can lead to clock drift over time and thus transition.transition should be preferred.
  9001. * @param (String) type the event type
  9002. * @param (com.ibm.rave.core.selector.RunFunction) listener the event listener
  9003. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  9004. */
  9005. each$1 : function(type, listener) {
  9006. var transitionId = this.id;
  9007. var transitionNamespace = this.namespace;
  9008. return com_ibm_rave_core_internal_selector_SelectorHelper.each(this, function(data, index, groupIndex) {
  9009. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(this, transitionNamespace, transitionId).getOrCreateDispatcher().on(type, listener);
  9010. });
  9011. },
  9012. /**
  9013. * Remove the selected nodes at the end of a transition. If a newer transition is scheduled on any of the selected nodes, these nodes will not be removed; however, the "end" event will still be dispatched.
  9014. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  9015. */
  9016. /** @expose */
  9017. remove : function() {
  9018. var transitionNamespace = this.namespace;
  9019. return this.each("end.transition", function(args) {
  9020. if (args !== null || arguments.length > 1){
  9021. args = Array.prototype.slice.call(arguments, 0);
  9022. }
  9023. {
  9024. var p = this.rave_getParentNode();
  9025. var t = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionTracker(this, transitionNamespace);
  9026. if (t.count < 2 && p) {
  9027. p.removeChild(this);
  9028. }
  9029. return null;
  9030. }
  9031. });
  9032. },
  9033. /**
  9034. * Invokes the specified function once, passing in the current transition along with any optional arguments. The call operator always returns the current transition, regardless of the return value of the specified function. The call operator is identical to invoking a function by hand; but it makes it easier to use method chaining. <p> The this context of the called function is also the current transition. This is slightly redundant with the first argument, which we might fix in the future.
  9035. * @param (com.ibm.rave.core.selector.RunFunction) callback the callback function
  9036. * @param (java.lang.Object[]) args the array of arguments
  9037. * @return (com.ibm.rave.core.transition.Transition) this instance of transition
  9038. */
  9039. /** @expose */
  9040. call : function(callback, args) {
  9041. if (args !== null || arguments.length > 2){
  9042. args = Array.prototype.slice.call(arguments, 1);
  9043. }
  9044. {
  9045. var list = (args);
  9046. list.splice(0, 0, this);
  9047. callback.apply(this, list);
  9048. return this;
  9049. }
  9050. },
  9051. /**
  9052. * Creates a new transition on the same selected elements that starts when this transition ends. The new transition inherits this transition’s duration and easing. This can be used to define chained transitions without needing to listen for "end" events.
  9053. * @return (com.ibm.rave.core.transition.Transition) a new {@link (com.ibm.rave.core.transition.Transition) Transition} .
  9054. */
  9055. transition$0 : function() {
  9056. var parentId = this.id;
  9057. var newId = ++com_ibm_rave_core_transition_Transition.idCount;
  9058. var ns = this.namespace;
  9059. var subgroups = new com_ibm_rave_core_transition_Transition(newId, ns);
  9060. var subgroup;
  9061. var group;
  9062. var node;
  9063. for (var j = 0, m = this.length; j < m; ++j) {
  9064. group = this[j];
  9065. subgroup = [];
  9066. subgroups.push(subgroup);
  9067. for (var i = 0, n = group.length; i < n; ++i) {
  9068. if ((node = group[i])) {
  9069. var info = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(node, ns, newId);
  9070. info.index = i;
  9071. info.groupIndex = j;
  9072. var pinfo = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(node, ns, parentId);
  9073. info.delay = pinfo.delay + pinfo.duration;
  9074. info.duration = pinfo.duration;
  9075. info.ease = pinfo.ease;
  9076. info.time = pinfo.time;
  9077. }
  9078. subgroup.push(node);
  9079. }
  9080. }
  9081. return subgroups;
  9082. },
  9083. /**
  9084. * Creates a new transition on the same selected elements that starts when this transition ends. The new transition inherits this transition’s duration and easing. This can be used to define chained transitions without needing to listen for "end" events.
  9085. * @param (String) transitionNamespace ignored
  9086. * @return (com.ibm.rave.core.transition.Transition) a new {@link (com.ibm.rave.core.transition.Transition) Transition} .
  9087. */
  9088. transition$1 : function(transitionNamespace) {
  9089. return this.transition$0();
  9090. },
  9091. /**
  9092. * Like {@link #this.select(com_ibm_rave_core_selector_ValueFunction)} using a string to specify a selector query.
  9093. */
  9094. select$0 : function(query) {
  9095. return this.select$1(com_ibm_rave_core_internal_selector_SelectorHelper.selector(query));
  9096. },
  9097. /**
  9098. * For each element in the current transition, selects the first descendant element that matches the specified selector. If no element matches the specified selector for the current element, the element at the current index will be null in the returned selection; operators (with the exception of data) automatically skip null elements, thereby preserving the index of the existing selection. If the current element has associated data, this data is inherited by the returned subselection, and automatically bound to the newly selected elements. If multiple elements match the selector, only the first matching element in document traversal order will be selected. <p> This method is approximately equivalent to: <pre> selection.select(selector).transition() </pre> where selection is the current transition's underlying selection. In addition, the returned new transition inherits easing, duration and delay from the current transition.
  9099. */
  9100. select$1 : function(valueFunction) {
  9101. var subgroups = new com_ibm_rave_core_transition_Transition(this.id, this.namespace);
  9102. var subgroup;
  9103. var subnode;
  9104. var group;
  9105. var node;
  9106. for (var j = 0, m = this.length; j < m; ++j) {
  9107. group = this[j];
  9108. subgroup = [];
  9109. subgroups.push(subgroup);
  9110. for (var i = 0, n = group.length; i < n; ++i) {
  9111. if ((node = group[i])) {
  9112. subgroup.push(subnode = valueFunction.call(node, node.rave_getData(), i, j));
  9113. if (subnode) {
  9114. if (node.rave_hasData()) {
  9115. subnode.rave_setData(node.rave_getData());
  9116. }
  9117. var inherit = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(node, this.namespace, this.id);
  9118. var info = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(subnode, this.namespace, this.id);
  9119. info.index = i;
  9120. info.groupIndex = j;
  9121. info.delay = inherit.delay;
  9122. info.duration = inherit.duration;
  9123. info.ease = inherit.ease;
  9124. }
  9125. } else {
  9126. subgroup.push(null);
  9127. }
  9128. }
  9129. }
  9130. return subgroups;
  9131. },
  9132. /**
  9133. * Like {@link #this.selectAll(com_ibm_rave_core_selector_ValueFunction)} using a string to specify a selector query.
  9134. */
  9135. selectAll$0 : function(query) {
  9136. return this.selectAll$1(com_ibm_rave_core_internal_selector_SelectorHelper.selectorAll(query));
  9137. },
  9138. /**
  9139. * For each element in the current transition, selects descendant elements that match the specified selector. The returned selection is grouped by the ancestor node in the current selection. If no element matches the specified selector for the current element, the group at the current index will be empty in the returned selection. The subselection does not inherit data from the current selection; however, if data was previously bound to the selected elements, that data will be available to operators. <p> This method is approximately equivalent to: <pre> selection.selectAll(selector).transition() </pre> where selection is the current transition's underlying selection. In addition, the returned new transition inherits easing, duration and delay from the current transition. The duration and delay for each subelement is inherited from the duration and delay of the parent element in the current transition.
  9140. * @return (com.ibm.rave.core.transition.Transition) a new {@link (com.ibm.rave.core.transition.Transition) Transition}
  9141. */
  9142. selectAll$1 : function(selector) {
  9143. var subgroups = new com_ibm_rave_core_transition_Transition(this.id, this.namespace);
  9144. var subgroup;
  9145. var group;
  9146. var node, subnode;
  9147. var subnodes;
  9148. for (var j = 0, m = this.length; j < m; ++j) {
  9149. group = this[j];
  9150. for (var i = 0, n = group.length; i < n; ++i) {
  9151. if ((node = group[i])) {
  9152. subgroup = [];
  9153. subnodes = selector.call(node, node.rave_getData(), i, j);
  9154. subgroups.push(subgroup);
  9155. var inherit = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(node, this.namespace, this.id);
  9156. for (var k = 0, o = subnodes.length; k < o; ++k) {
  9157. subnode = subnodes[k];
  9158. if (subnode) {
  9159. var info = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(subnode, this.namespace, this.id);
  9160. info.index = k;
  9161. info.groupIndex = i;
  9162. info.delay = inherit.delay;
  9163. info.duration = inherit.duration;
  9164. info.ease = inherit.ease;
  9165. }
  9166. subgroup.push(subnode);
  9167. }
  9168. }
  9169. }
  9170. }
  9171. return subgroups;
  9172. },
  9173. /**
  9174. * Like {@link #this.filter(com_ibm_rave_core_selector_ValueFunction)} using a string to specify a selector query.
  9175. */
  9176. filter$1 : function(filter) {
  9177. return this.filter$0(function(data, index, groupIndex) {
  9178. return com_ibm_rave_core_internal_util_QueryUtil.getQueryEngine(this).matches(this, filter);
  9179. });
  9180. },
  9181. /**
  9182. * Filters the transition, returning a new transition that contains only the elements for which the specified selector is true. As with other operators, the function is passed the current datum and index, with the context as the current scene node. The returned selection does not preserve the index of the original selection; it returns a copy with elements removed. If you want to preserve the index, use select instead. <p> For example, to select every other element: <pre> var odds = transition.select(function(d, i) { return i & 1 ? this : null; }); </pre> Equivalently, using a filter function: <pre> var odds = transition.filter(function(d, i) { return i & 1; }); </pre> Or a filter selector: <pre> var odds = transition.filter(&quot;:nth-child(odd)&quot;); </pre> Thus, you can use either select or filter to apply tweens to a subset of elements.
  9183. * @param (com.ibm.rave.core.selector.ValueFunction) filterFunction the filter function
  9184. * @return (com.ibm.rave.core.transition.Transition) a new {@link (com.ibm.rave.core.transition.Transition) Transition} subset of the current transition
  9185. */
  9186. filter$0 : function(filterFunction) {
  9187. var subgroups = new com_ibm_rave_core_transition_Transition(this.id, this.namespace);
  9188. var subgroup;
  9189. var group;
  9190. var node;
  9191. for (var j = 0, m = this.length; j < m; ++j) {
  9192. subgroup = [];
  9193. subgroups.push(subgroup);
  9194. group = this[j];
  9195. for (var i = 0, n = group.length; i < n; ++i) {
  9196. node = group[i];
  9197. if (node && filterFunction.call(node, node.rave_getData(), i, j)) {
  9198. subgroup.push(node);
  9199. }
  9200. }
  9201. }
  9202. return subgroups;
  9203. },
  9204. /** @expose */
  9205. delay : function(a0) {
  9206. var args = arguments;
  9207. if (args.length == 0) {
  9208. return this.delay$0();
  9209. }
  9210. if (args.length == 1 && typeof a0 === "function") {
  9211. return this.delay$2(a0);
  9212. }
  9213. return this.delay$1(a0);
  9214. },
  9215. /** @expose */
  9216. duration : function(a0) {
  9217. var args = arguments;
  9218. if (args.length == 0) {
  9219. return this.duration$0();
  9220. }
  9221. if (args.length == 1 && typeof a0 === "function") {
  9222. return this.duration$2(a0);
  9223. }
  9224. return this.duration$1(a0);
  9225. },
  9226. /** @expose */
  9227. ease : function(a0, a1) {
  9228. var args = arguments;
  9229. if (args.length == 0) {
  9230. return this.ease$0();
  9231. }
  9232. if (args.length == 1 && typeof a0 === "function") {
  9233. return this.ease$2(a0);
  9234. }
  9235. return this.ease$1.apply(this, args);
  9236. },
  9237. /** @expose */
  9238. attr : function(a0, a1) {
  9239. var args = arguments;
  9240. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  9241. return this.attr$2(a0, a1);
  9242. }
  9243. if (args.length == 2 && (a0 == null || typeof a0 === "string") && (a1 == null || Object.prototype.toString.call(a1) !== "[object Array]")) {
  9244. return this.attr$1(a0, a1);
  9245. }
  9246. return com_ibm_rave_core_nativeImpl_Declare.invokeSuper(this, args);
  9247. },
  9248. /** @expose */
  9249. text : function(a0) {
  9250. var args = arguments;
  9251. if (args.length == 1 && typeof a0 === "function") {
  9252. return this.text$1(a0);
  9253. }
  9254. return this.text$0(a0);
  9255. },
  9256. /** @expose */
  9257. style : function(a0, a1, a2) {
  9258. var args = arguments;
  9259. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  9260. return this.style$3(a0, a1);
  9261. }
  9262. if (args.length == 2 && (a0 == null || typeof a0 === "string") && (a1 == null || Object.prototype.toString.call(a1) !== "[object Array]")) {
  9263. return this.style$2(a0, a1);
  9264. }
  9265. if (args.length == 3 && (a0 == null || typeof a0 === "string") && typeof a1 === "function" && (a2 == null || typeof a2 === "string")) {
  9266. return this.style$5(a0, a1, a2);
  9267. }
  9268. if (args.length == 3 && (a0 == null || typeof a0 === "string") && (a1 == null || Object.prototype.toString.call(a1) !== "[object Array]") && (a2 == null || typeof a2 === "string")) {
  9269. return this.style$4(a0, a1, a2);
  9270. }
  9271. return com_ibm_rave_core_nativeImpl_Declare.invokeSuper(this, args);
  9272. },
  9273. /** @expose */
  9274. styleTween : function(a0, a1, a2) {
  9275. var args = arguments;
  9276. if (args.length == 2) {
  9277. return this.styleTween$0(a0, a1);
  9278. }
  9279. return this.styleTween$1(a0, a1, a2);
  9280. },
  9281. /** @expose */
  9282. tween : function(a0, a1) {
  9283. var args = arguments;
  9284. if (args.length == 1) {
  9285. return this.tween$1(a0);
  9286. }
  9287. return this.tween$0(a0, a1);
  9288. },
  9289. /** @expose */
  9290. each : function(a0, a1) {
  9291. var args = arguments;
  9292. if (args.length == 1) {
  9293. return this.each$0(a0);
  9294. }
  9295. return this.each$1(a0, a1);
  9296. },
  9297. /** @expose */
  9298. transition : function(a0) {
  9299. var args = arguments;
  9300. if (args.length == 0) {
  9301. return this.transition$0();
  9302. }
  9303. return this.transition$1(a0);
  9304. },
  9305. /** @expose */
  9306. select : function(a0) {
  9307. var args = arguments;
  9308. if (args.length == 1 && typeof a0 === "function") {
  9309. return this.select$1(a0);
  9310. }
  9311. return this.select$0(a0);
  9312. },
  9313. /** @expose */
  9314. selectAll : function(a0) {
  9315. var args = arguments;
  9316. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  9317. return this.selectAll$0(a0);
  9318. }
  9319. return this.selectAll$1(a0);
  9320. },
  9321. /** @expose */
  9322. filter : function(a0) {
  9323. var args = arguments;
  9324. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  9325. return this.filter$1(a0);
  9326. }
  9327. if (args.length == 1 && typeof a0 === "function") {
  9328. return this.filter$0(a0);
  9329. }
  9330. return com_ibm_rave_core_nativeImpl_Declare.invokeSuper(this, args);
  9331. }
  9332. });
  9333. /**
  9334. * Create a transition on the top-level (documentElement) scene node.
  9335. * @return (com.ibm.rave.core.transition.Transition) A new transition on documentElement.
  9336. */
  9337. com_ibm_rave_core_transition_Transition.newTransition$0 = function() {
  9338. return new com_ibm_rave_core_selector_Selector().init(com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocumentElement(com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocument())).transition(null);
  9339. };
  9340. /**
  9341. * Create a transition on the top-level (documentElement) scene node.
  9342. * @param (String) name the name for the transition
  9343. * @return (com.ibm.rave.core.transition.Transition) A new transition on documentElement.
  9344. */
  9345. com_ibm_rave_core_transition_Transition.newTransition$1 = function(name) {
  9346. return new com_ibm_rave_core_selector_Selector().init(com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocumentElement(com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocument())).transition(name);
  9347. };
  9348. /**
  9349. * This constructor will typically just return the provided selection. However, in the context of {@link this.Transition#this.each(com_ibm_rave_core_selector_CallbackFunction)} , this will return a new transition which inherits the parent transition's delay, duration, easing, etc.
  9350. * @param (com.ibm.rave.core.selector.Selection) selection a {@link (com.ibm.rave.core.selector.Selection) Selection} , may be a {@link (com.ibm.rave.core.transition.Transition) Transition}
  9351. * @return (com.ibm.rave.core.selector.Selection) the given {@link (com.ibm.rave.core.selector.Selection) Selection} (a no-op) if not a {@link (com.ibm.rave.core.transition.Transition) Transition} , otherwise a new {@link (com.ibm.rave.core.transition.Transition) Transition}
  9352. */
  9353. com_ibm_rave_core_transition_Transition.newTransition$2 = function(selection) {
  9354. return com_ibm_rave_core_transition_Transition.newTransition$3(selection, null);
  9355. };
  9356. /**
  9357. * This constructor will typically just return the provided selection. However, in the context of {@link this.Transition#this.each(com_ibm_rave_core_selector_CallbackFunction)} , this will return a new transition which inherits the parent transition's delay, duration, easing, etc.
  9358. * @param (com.ibm.rave.core.selector.Selection) selection a {@link (com.ibm.rave.core.selector.Selection) Selection} , may be a {@link (com.ibm.rave.core.transition.Transition) Transition}
  9359. * @param (String) name the name for the transition
  9360. * @return (com.ibm.rave.core.selector.Selection) the given {@link (com.ibm.rave.core.selector.Selection) Selection} (a no-op) if not a {@link (com.ibm.rave.core.transition.Transition) Transition} , otherwise a new {@link (com.ibm.rave.core.transition.Transition) Transition}
  9361. */
  9362. com_ibm_rave_core_transition_Transition.newTransition$3 = function(selection, name) {
  9363. if (selection && com_ibm_rave_core_internal_nativeImpl_transitions_InheritedTransition.get()) {
  9364. return selection.transition(com_ibm_rave_core_internal_transitions_TransitionUtil.transitionNamespace(null));
  9365. }
  9366. return selection;
  9367. };
  9368. /**
  9369. * Creates a {@link (com.ibm.rave.core.transition.Transition) Transition} for the given selector.
  9370. * @param (com.ibm.rave.core.selector.Selector) selector the selector to transition
  9371. * @return (com.ibm.rave.core.transition.Transition) a {@link (com.ibm.rave.core.transition.Transition) Transition} containing the same nodes as the given selector
  9372. */
  9373. com_ibm_rave_core_transition_Transition.create$0 = function(selector) {
  9374. var id = ++com_ibm_rave_core_transition_Transition.idCount;
  9375. var namespace = com_ibm_rave_core_internal_transitions_TransitionUtil.transitionNamespace(null);
  9376. var subgroups = new com_ibm_rave_core_transition_Transition(id, namespace);
  9377. var subgroup;
  9378. var group;
  9379. var node;
  9380. for (var j = 0, m = selector.length; j < m; ++j) {
  9381. group = selector[j];
  9382. subgroup = [];
  9383. subgroups.push(subgroup);
  9384. for (var i = 0, n = group.length; i < n; ++i) {
  9385. if ((node = group[i])) {
  9386. var info = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(node, namespace, id);
  9387. info.index = i;
  9388. info.groupIndex = j;
  9389. }
  9390. subgroup.push(node);
  9391. }
  9392. }
  9393. return subgroups;
  9394. };
  9395. /**
  9396. * Creates a {@link (com.ibm.rave.core.transition.Transition) Transition} for the given selector.
  9397. * @param (com.ibm.rave.core.selector.Selector) selector the selector to transition
  9398. * @param (String) name the name for the transition
  9399. * @return (com.ibm.rave.core.transition.Transition) a {@link (com.ibm.rave.core.transition.Transition) Transition} containing the same nodes as the given selector
  9400. */
  9401. com_ibm_rave_core_transition_Transition.create$1 = function(selector, name) {
  9402. var id = ++com_ibm_rave_core_transition_Transition.idCount;
  9403. var namespace = com_ibm_rave_core_internal_transitions_TransitionUtil.transitionNamespace(name);
  9404. var subgroups = new com_ibm_rave_core_transition_Transition(id, namespace);
  9405. var subgroup;
  9406. var group;
  9407. var node;
  9408. for (var j = 0, m = selector.length; j < m; ++j) {
  9409. group = selector[j];
  9410. subgroup = [];
  9411. subgroups.push(subgroup);
  9412. for (var i = 0, n = group.length; i < n; ++i) {
  9413. if ((node = group[i])) {
  9414. var info = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(node, namespace, id);
  9415. info.index = i;
  9416. info.groupIndex = j;
  9417. }
  9418. subgroup.push(node);
  9419. }
  9420. }
  9421. return subgroups;
  9422. };
  9423. /**
  9424. * Creates a {@link (com.ibm.rave.core.transition.Transition) Transition} for the given selector while inheriting an existing transition ID and transition delay, duration and easing.
  9425. * @param (com.ibm.rave.core.selector.Selector) selector the selector to transition
  9426. * @param (com.ibm.rave.core.internal.transitions.TransitionInfo) inherit transition properties to inherit
  9427. * @return (com.ibm.rave.core.transition.Transition) a {@link (com.ibm.rave.core.transition.Transition) Transition} containing the same nodes as the given selector
  9428. */
  9429. com_ibm_rave_core_transition_Transition.create$2 = function(selector, inherit) {
  9430. return com_ibm_rave_core_transition_Transition.create$3(selector, null, inherit);
  9431. };
  9432. /**
  9433. * Creates a {@link (com.ibm.rave.core.transition.Transition) Transition} for the given selector while inheriting an existing transition ID and transition delay, duration and easing.
  9434. * @param (com.ibm.rave.core.selector.Selector) selector the selector to transition
  9435. * @param (String) name the name for the transition
  9436. * @param (com.ibm.rave.core.internal.transitions.TransitionInfo) inherit transition properties to inherit
  9437. * @return (com.ibm.rave.core.transition.Transition) a {@link (com.ibm.rave.core.transition.Transition) Transition} containing the same nodes as the given selector
  9438. */
  9439. com_ibm_rave_core_transition_Transition.create$3 = function(selector, name, inherit) {
  9440. var namespace = com_ibm_rave_core_internal_transitions_TransitionUtil.transitionNamespace(name);
  9441. var subgroups = new com_ibm_rave_core_transition_Transition(inherit.transitionId, namespace);
  9442. var subgroup;
  9443. var group;
  9444. var node;
  9445. for (var j = 0, m = selector.length; j < m; ++j) {
  9446. group = selector[j];
  9447. subgroup = [];
  9448. subgroups.push(subgroup);
  9449. for (var i = 0, n = group.length; i < n; ++i) {
  9450. if ((node = group[i])) {
  9451. var info = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(node, namespace, inherit.transitionId);
  9452. info.index = i;
  9453. info.groupIndex = j;
  9454. info.delay = inherit.delay;
  9455. info.duration = inherit.duration;
  9456. info.ease = inherit.ease;
  9457. }
  9458. subgroup.push(node);
  9459. }
  9460. }
  9461. return subgroups;
  9462. };
  9463. /** @expose */
  9464. com_ibm_rave_core_transition_Transition.newTransition = function(a0, a1) {
  9465. var args = arguments;
  9466. if (args.length == 0) {
  9467. return com_ibm_rave_core_transition_Transition.newTransition$0();
  9468. }
  9469. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  9470. return com_ibm_rave_core_transition_Transition.newTransition$1(a0);
  9471. }
  9472. if (args.length == 1) {
  9473. return com_ibm_rave_core_transition_Transition.newTransition$2(a0);
  9474. }
  9475. return com_ibm_rave_core_transition_Transition.newTransition$3(a0, a1);
  9476. };
  9477. /** @expose */
  9478. com_ibm_rave_core_transition_Transition.create = function(a0, a1, a2) {
  9479. var args = arguments;
  9480. if (args.length == 1) {
  9481. return com_ibm_rave_core_transition_Transition.create$0(a0);
  9482. }
  9483. if (args.length == 2 && (a1 == null || typeof a1 === "string")) {
  9484. return com_ibm_rave_core_transition_Transition.create$1(a0, a1);
  9485. }
  9486. if (args.length == 2) {
  9487. return com_ibm_rave_core_transition_Transition.create$2(a0, a1);
  9488. }
  9489. return com_ibm_rave_core_transition_Transition.create$3(a0, a1, a2);
  9490. };
  9491. com_ibm_rave_core_transition_Transition.idCount = 0;
  9492. //com_ibm_rave_core_transition_Transition.TEXT_PREFIX = "text";
  9493. //com_ibm_rave_core_transition_Transition.ATTR_PREFIX = "attr.";
  9494. //com_ibm_rave_core_transition_Transition.STYLE_PREFIX = "style.";
  9495. // $source: com/ibm/rave/core/arrays/Variance
  9496. /************************************************************************
  9497. ** IBM Confidential
  9498. **
  9499. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9500. **
  9501. ** (C) Copyright IBM Corp. 2015
  9502. **
  9503. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9504. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9505. ************************************************************************/
  9506. // GENERATED
  9507. //@import com/ibm/rave/core/internal/math/NumberUtil (static) // toNumber
  9508. /**
  9509. * Returns an unbiased estimator of the population variance of a given array. If the array has fewer than two values the result is *undefined An accessor function may be provided to process the data. This method ignores invalid values such as NaN and undefined.
  9510. */
  9511. var com_ibm_rave_core_arrays_Variance = rave_externs["Variance"] = {
  9512. //constructor : function() {}
  9513. };
  9514. /**
  9515. * Returns the variance of the given array.
  9516. * @param (java.lang.Object[]) array the array to use to calculate the variance.
  9517. * @return (Number) the extent array
  9518. */
  9519. com_ibm_rave_core_arrays_Variance.variance$0 = function(array) {
  9520. var d, s = 0, m = 0, a;
  9521. var i = -1, j = 0;
  9522. while (++i < array.length) {
  9523. a = com_ibm_rave_core_internal_math_NumberUtil.toNumber(array[i]);
  9524. if (!(isNaN(a))) {
  9525. d = a - m;
  9526. m += d / ++j;
  9527. s += d * (a - m);
  9528. }
  9529. }
  9530. return (j > 1) ? s / (j - 1) : undefined;
  9531. };
  9532. /**
  9533. * Returns the variance of the values returned from the accessor function.
  9534. * @param (java.lang.Object[]) array the data to iterate over.
  9535. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction the accessor function to use to get the values.
  9536. * @return (Number) the variance
  9537. */
  9538. com_ibm_rave_core_arrays_Variance.variance$1 = function(array, valueFunction) {
  9539. var d, s = 0, m = 0, a;
  9540. var i = -1, j = 0;
  9541. while (++i < array.length) {
  9542. a = com_ibm_rave_core_internal_math_NumberUtil.toNumber(valueFunction.call(array, array[i], i, -1));
  9543. if (!(isNaN(a))) {
  9544. d = a - m;
  9545. m += d / ++j;
  9546. s += d * (a - m);
  9547. }
  9548. }
  9549. return (j != 0 && !(isNaN(j))) ? s / (j - 1) : undefined;
  9550. };
  9551. /** @expose */
  9552. com_ibm_rave_core_arrays_Variance.variance = function(a0, a1) {
  9553. var args = arguments;
  9554. if (args.length == 1) {
  9555. return com_ibm_rave_core_arrays_Variance.variance$0(a0);
  9556. }
  9557. return com_ibm_rave_core_arrays_Variance.variance$1(a0, a1);
  9558. };
  9559. // $source: com/ibm/rave/core/arrays/Mean
  9560. /************************************************************************
  9561. ** IBM Confidential
  9562. **
  9563. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9564. **
  9565. ** (C) Copyright IBM Corp. 2015
  9566. **
  9567. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9568. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9569. ************************************************************************/
  9570. // GENERATED
  9571. //@import com/ibm/rave/core/internal/math/NumberUtil (static) // toNumber
  9572. /**
  9573. * Compute the arithmetic mean of an array of numbers. Returns the mean of the given array. If the array is empty, returns null. An optional accessor function may be specified, which is equivalent to callingarray.map(accessor) before computing the mean. This method ignores invalid values such as NaN and undefined; this is useful for computing the mean of data while only considering the well-defined values.
  9574. */
  9575. var com_ibm_rave_core_arrays_Mean = rave_externs["Mean"] = {
  9576. //constructor : function() {}
  9577. };
  9578. /**
  9579. * Returns the mean of the given array
  9580. * @param (java.lang.Object[]) array the array to use to calculate the mean
  9581. * @return (Number) the mean value
  9582. */
  9583. com_ibm_rave_core_arrays_Mean.mean$0 = function(array) {
  9584. var s = 0;
  9585. var i = -1;
  9586. var n = array.length;
  9587. var j = n;
  9588. while (++i < n) {
  9589. var a = com_ibm_rave_core_internal_math_NumberUtil.toNumber(array[i]);
  9590. if (!(isNaN(a))) {
  9591. s += a;
  9592. } else {
  9593. j--;
  9594. }
  9595. }
  9596. return (j != 0 && !(isNaN(j))) ? s / j : undefined;
  9597. };
  9598. /**
  9599. * Returns the mean of the values returned from the accessor function
  9600. * @param (java.lang.Object[]) data the data to iterator over
  9601. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction the accessor function to use to get the value
  9602. * @return (Number) the mean value
  9603. */
  9604. com_ibm_rave_core_arrays_Mean.mean$1 = function(data, valueFunction) {
  9605. var s = 0;
  9606. var i = -1;
  9607. var n = data.length;
  9608. var j = n;
  9609. var a;
  9610. while (++i < n) {
  9611. var val = valueFunction.call(data, data[i], i, -1);
  9612. a = com_ibm_rave_core_internal_math_NumberUtil.toNumber(val);
  9613. if (!(isNaN(a))) {
  9614. s += a;
  9615. } else {
  9616. j--;
  9617. }
  9618. }
  9619. return (j != 0 && !(isNaN(j))) ? s / j : undefined;
  9620. };
  9621. /** @expose */
  9622. com_ibm_rave_core_arrays_Mean.mean = function(a0, a1) {
  9623. var args = arguments;
  9624. if (args.length == 1) {
  9625. return com_ibm_rave_core_arrays_Mean.mean$0(a0);
  9626. }
  9627. return com_ibm_rave_core_arrays_Mean.mean$1(a0, a1);
  9628. };
  9629. // $source: com/ibm/rave/core/arrays/Median
  9630. /************************************************************************
  9631. ** IBM Confidential
  9632. **
  9633. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9634. **
  9635. ** (C) Copyright IBM Corp. 2015
  9636. **
  9637. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9638. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9639. ************************************************************************/
  9640. // GENERATED
  9641. //@import com/ibm/rave/core/internal/math/NumberUtil (static) // toNumber
  9642. //@import com/ibm/rave/core/arrays/Quantile (static) // quantile
  9643. //@import com/ibm/rave/core/arrays/Sort (static) // Sort
  9644. var com_ibm_rave_core_arrays_Median = rave_externs["Median"] = {
  9645. //constructor : function() {}
  9646. };
  9647. /**
  9648. * Returns the median of the given array.
  9649. * @param (java.lang.Object[]) array the array to use to calculate the median
  9650. * @return (Number) the median value
  9651. */
  9652. com_ibm_rave_core_arrays_Median.median$0 = function(array) {
  9653. var numbers = [];
  9654. var n = array.length;
  9655. var a;
  9656. var i = -1;
  9657. while (++i < n) {
  9658. a = com_ibm_rave_core_internal_math_NumberUtil.toNumber(array[i]);
  9659. if (!(isNaN(a))) {
  9660. numbers.push(a);
  9661. }
  9662. }
  9663. return (numbers.length > 0 ? com_ibm_rave_core_arrays_Quantile.quantile(numbers.sort(com_ibm_rave_core_arrays_Sort.ascending), .5) : undefined);
  9664. };
  9665. /**
  9666. * Returns the median of the values returned from the accessor function.
  9667. * @param (java.lang.Object[]) data the data to iterator over.
  9668. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction the accessor function to use to get the value.
  9669. * @return (Number) the median value
  9670. */
  9671. com_ibm_rave_core_arrays_Median.median$1 = function(data, valueFunction) {
  9672. var numbers = [];
  9673. var i = -1;
  9674. var n = data.length;
  9675. var a;
  9676. while (++i < n) {
  9677. var val = valueFunction.call(data, data[i], i, -1);
  9678. a = com_ibm_rave_core_internal_math_NumberUtil.toNumber(val);
  9679. if (!(isNaN(a))) {
  9680. numbers.push(a);
  9681. }
  9682. }
  9683. return (numbers.length > 0 ? com_ibm_rave_core_arrays_Quantile.quantile(numbers.sort(com_ibm_rave_core_arrays_Sort.ascending), .5) : undefined);
  9684. };
  9685. /** @expose */
  9686. com_ibm_rave_core_arrays_Median.median = function(a0, a1) {
  9687. var args = arguments;
  9688. if (args.length == 1) {
  9689. return com_ibm_rave_core_arrays_Median.median$0(a0);
  9690. }
  9691. return com_ibm_rave_core_arrays_Median.median$1(a0, a1);
  9692. };
  9693. // $source: com/ibm/rave/core/arrays/Bisector
  9694. /************************************************************************
  9695. ** IBM Confidential
  9696. **
  9697. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9698. **
  9699. ** (C) Copyright IBM Corp. 2015
  9700. **
  9701. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9702. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9703. ************************************************************************/
  9704. // GENERATED
  9705. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare anonymous, declare
  9706. //@import com/ibm/rave/core/arrays/Sort (static) // Sort
  9707. /**
  9708. * A bisection search utility. Used to locate the insertion point in an array to maintain sorted order.
  9709. * @param < (java.lang.Object) T > the data type for compare against data objects in the array
  9710. */
  9711. var com_ibm_rave_core_arrays_Bisector = rave_externs["Bisector"] = com_ibm_rave_core_nativeImpl_Declare({
  9712. /**
  9713. * Locate the insertion point in an array to maintain sorted order.
  9714. */
  9715. /** @expose */
  9716. left : null,
  9717. /**
  9718. * Similar to {@link #this.left} , but returns an insertion point which comes after (to the right of) any existing entries of the number in the array.
  9719. */
  9720. /** @expose */
  9721. right : null,
  9722. /**
  9723. * Constructs a new bisector with the given comparator.
  9724. * @param (com.ibm.rave.core.util.Comparator) comparator compares two data objects
  9725. */
  9726. /** @expose */
  9727. constructor : function(comparator) {
  9728. this.left = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_arrays_Bisector.BisectorFunction], {
  9729. bisect$2 : function(a, x, lo, hi) {
  9730. var newLo = lo;
  9731. var newHi = hi;
  9732. while (newLo < newHi) {
  9733. var mid = (newLo + newHi) >>> 1;
  9734. if (comparator(a[mid], x) < 0) {
  9735. newLo = mid + 1;
  9736. } else {
  9737. newHi = mid;
  9738. }
  9739. }
  9740. return newLo;
  9741. }
  9742. }))();
  9743. this.right = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_arrays_Bisector.BisectorFunction], {
  9744. bisect$2 : function(a, x, lo, hi) {
  9745. var newLo = lo;
  9746. var newHi = hi;
  9747. while (newLo < newHi) {
  9748. var mid = (newLo + newHi) >>> 1;
  9749. if (comparator(a[mid], x) > 0) {
  9750. newHi = mid;
  9751. } else {
  9752. newLo = mid + 1;
  9753. }
  9754. }
  9755. return newLo;
  9756. }
  9757. }))();
  9758. }
  9759. });
  9760. /**
  9761. * Creates a generic bisector with the given comparator.
  9762. * @param (com.ibm.rave.core.util.Comparator) comparator compares two data objects
  9763. * @return (com.ibm.rave.core.arrays.Bisector) a new bisector
  9764. */
  9765. com_ibm_rave_core_arrays_Bisector.create$0 = function(comparator) {
  9766. return new com_ibm_rave_core_arrays_Bisector(comparator);
  9767. };
  9768. /**
  9769. * Creates a new bisector using {@link this.Sort#com_ibm_rave_core_arrays_Sort.ascending} as the comparator.
  9770. * @param (com.ibm.rave.core.functions.DoubleValueFunction) f a value function to extract a number from a data object
  9771. * @return (com.ibm.rave.core.arrays.Bisector) a new bisector
  9772. */
  9773. com_ibm_rave_core_arrays_Bisector.create$1 = function(f) {
  9774. return new com_ibm_rave_core_arrays_Bisector(function(a, b) {
  9775. return com_ibm_rave_core_arrays_Sort.ascending(f(a), b);
  9776. });
  9777. };
  9778. /** @expose */
  9779. com_ibm_rave_core_arrays_Bisector.create = function(a0) {
  9780. var args = arguments;
  9781. if (args.length == 1 && typeof a0 === "function" && a0.length == 2) {
  9782. return com_ibm_rave_core_arrays_Bisector.create$0(a0);
  9783. }
  9784. return com_ibm_rave_core_arrays_Bisector.create$1(a0);
  9785. };
  9786. /**
  9787. * Function to execute a bisection search.
  9788. * @param < (java.lang.Object) T > the data type to compare against data objects in the array
  9789. */
  9790. com_ibm_rave_core_arrays_Bisector.BisectorFunction = rave_externs["BisectorFunction"] = com_ibm_rave_core_nativeImpl_Declare({
  9791. _$functionClassMethod : function() {
  9792. var _$self = function(a0, a1, a2, a3) {
  9793. var args = arguments;
  9794. if (args.length == 2) {
  9795. return _$self.bisect$0(a0, a1);
  9796. }
  9797. if (args.length == 3) {
  9798. return _$self.bisect$1(a0, a1, a2);
  9799. }
  9800. return _$self.bisect$2(a0, a1, a2, a3);
  9801. };
  9802. return _$self;
  9803. },
  9804. /**
  9805. * Locate the insertion point in an array to maintain sorted order.
  9806. * @param (Array) a the array to insert into
  9807. * @param (java.lang.Object) x the value to insert
  9808. * @return (int) the insertion point index
  9809. */
  9810. bisect$0 : function(a, x) {
  9811. return this(a, x, 0, a.length);
  9812. },
  9813. /**
  9814. * Locate the insertion point in an array to maintain sorted order.
  9815. * @param (Array) a the array to insert into
  9816. * @param (java.lang.Object) x the value to insert
  9817. * @param (int) lo the low index in the array to begin at
  9818. * @return (int) the insertion point index
  9819. */
  9820. bisect$1 : function(a, x, lo) {
  9821. return this(a, x, lo, a.length);
  9822. }
  9823. /**
  9824. * Locate the insertion point in an array to maintain sorted order.
  9825. * @param (Array) a the array to insert into
  9826. * @param (java.lang.Object) x the value to insert
  9827. * @param (int) lo the low index in the array to begin at
  9828. * @param (int) hi the high index in the array to stop at
  9829. * @return (int) the insertion point index
  9830. */
  9831. //bisect$2 : function(a, x, lo, hi) {}
  9832. });
  9833. com_ibm_rave_core_arrays_Bisector.bisector = new com_ibm_rave_core_arrays_Bisector(com_ibm_rave_core_arrays_Sort.ascending);
  9834. /**
  9835. * Locate the insertion point in an array to maintain sorted order.
  9836. */
  9837. /** @expose */
  9838. com_ibm_rave_core_arrays_Bisector.bisectLeft = com_ibm_rave_core_arrays_Bisector.bisector.left;
  9839. /**
  9840. * Similar to {@link #com_ibm_rave_core_arrays_Bisector.bisectLeft} , but returns an insertion point which comes after (to the right of) any existing entries of the number in the array.
  9841. */
  9842. /** @expose */
  9843. com_ibm_rave_core_arrays_Bisector.bisectRight = com_ibm_rave_core_arrays_Bisector.bisector.right;
  9844. /**
  9845. * @see #com_ibm_rave_core_arrays_Bisector.bisect
  9846. */
  9847. /** @expose */
  9848. com_ibm_rave_core_arrays_Bisector.bisect = com_ibm_rave_core_arrays_Bisector.bisector.right;
  9849. // $source: com/ibm/rave/core/nativeImpl/event/Mouse
  9850. /************************************************************************
  9851. ** IBM Confidential
  9852. **
  9853. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9854. **
  9855. ** (C) Copyright IBM Corp. 2014
  9856. **
  9857. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9858. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9859. ************************************************************************/
  9860. // @import com/ibm/rave/core/nativeImpl/event/EventTracker
  9861. var com_ibm_rave_core_nativeImpl_event_Mouse = (function() {
  9862. // https://bugs.webkit.org/show_bug.cgi?id=44083
  9863. var mouse_bug44083 = this.navigator && /WebKit/.test(this.navigator.userAgent) ? -1 : 0;
  9864. return {
  9865. mousePoint : function(container, e) {
  9866. if (arguments.length == 1) {
  9867. e = com_ibm_rave_core_nativeImpl_event_EventTracker.eventSource();
  9868. }
  9869. if (e.changedTouches) e = e.changedTouches[0];
  9870. var svg = container["ownerSVGElement"] || container;
  9871. if (svg["createSVGPoint"]) {
  9872. var point = svg["createSVGPoint"]();
  9873. if (mouse_bug44083 < 0) {
  9874. var window = rave_window(container);
  9875. if (window.scrollX || window.scrollY) {
  9876. svg = rave.select("body").append("svg").style({
  9877. position: "absolute",
  9878. top: 0,
  9879. left: 0,
  9880. margin: 0,
  9881. padding: 0,
  9882. border: "none"
  9883. }, "important");
  9884. var ctm = svg[0][0]["getScreenCTM"]();
  9885. mouse_bug44083 = !(ctm["f"] || ctm["e"]);
  9886. svg.remove();
  9887. }
  9888. }
  9889. if (mouse_bug44083) point.x = e.pageX, point.y = e.pageY;
  9890. else point.x = e.clientX, point.y = e.clientY;
  9891. point = point["matrixTransform"](container["getScreenCTM"]()["inverse"]());
  9892. return [point.x, point.y];
  9893. }
  9894. var rect = container.getBoundingClientRect();
  9895. return [e.clientX - rect.left - (container.clientLeft || 0), e.clientY - rect.top - (container.clientTop || 0)];
  9896. }
  9897. };
  9898. })();
  9899. // $source: com/ibm/rave/core/event/TouchUtil
  9900. /************************************************************************
  9901. ** IBM Confidential
  9902. **
  9903. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9904. **
  9905. ** (C) Copyright IBM Corp. 2015
  9906. **
  9907. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9908. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9909. ************************************************************************/
  9910. // GENERATED
  9911. //@import com/ibm/rave/core/nativeImpl/event/Mouse (static) // mousePoint
  9912. /**
  9913. * Utilities for obtaining coordinates of touch events relative to a container.
  9914. */
  9915. var com_ibm_rave_core_event_TouchUtil = rave_externs["TouchUtil"] = {
  9916. //constructor : function() {}
  9917. };
  9918. /**
  9919. * Like {@link #this.touch(com_ibm_rave_core_scene_SceneNode, Array, String)} but since touches is not specified, defaults to the current event's changedTouches.
  9920. * @param (com.ibm.rave.core.scene.SceneNode) container the container to which the resulting coordinates are relative
  9921. * @param (String) identifier the touch identifier
  9922. * @return (Array) the coordinates of the touch
  9923. */
  9924. /** @expose */
  9925. com_ibm_rave_core_event_TouchUtil.touchFromSource = function(container, identifier) {
  9926. return com_ibm_rave_core_event_TouchUtil.touch(container, (rave.event).changedTouches, identifier);
  9927. };
  9928. /**
  9929. * Returns the x and y coordinates of the touch with the specified identifier associated with the current rave.event, relative to the specified container. The container may be any scene node, such as an svg:g or svg:svg. If there is no touch with the specified identifier in touches, returns null; this can be useful for ignoring touchmove events where the only some touches have moved.
  9930. * @param (com.ibm.rave.core.scene.SceneNode) container the container to which the resulting coordinates are relative
  9931. * @param (Array) touches a list of all of the points of contact with a touch surface
  9932. * @param (String) identifier the touch identifier
  9933. * @return (Array) the coordinates of the touch
  9934. */
  9935. /** @expose */
  9936. com_ibm_rave_core_event_TouchUtil.touch = function(container, touches, identifier) {
  9937. if (touches) {
  9938. for (var i = 0, n = touches.length; i < n; ++i) {
  9939. var touch = touches[i];
  9940. if (identifier == touch.identifier) {
  9941. return com_ibm_rave_core_nativeImpl_event_Mouse.mousePoint(container, touch);
  9942. }
  9943. }
  9944. }
  9945. return null;
  9946. };
  9947. // $source: com/ibm/rave/core/nativeImpl/event/Touches
  9948. /************************************************************************
  9949. ** IBM Confidential
  9950. **
  9951. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9952. **
  9953. ** (C) Copyright IBM Corp. 2014
  9954. **
  9955. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9956. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9957. ************************************************************************/
  9958. // @import com/ibm/rave/core/nativeImpl/event/EventTracker
  9959. // @import ./Mouse
  9960. var com_ibm_rave_core_nativeImpl_event_Touches = {
  9961. touches : function(container, touches) {
  9962. if (arguments.length < 2) {
  9963. touches = com_ibm_rave_core_nativeImpl_event_EventTracker.eventSource().touches;
  9964. }
  9965. return touches ? [].slice.call(touches).map(function(touch) {
  9966. var point = com_ibm_rave_core_nativeImpl_event_Mouse.mousePoint(container, touch);
  9967. point.identifier = touch.identifier;
  9968. return point;
  9969. }) : [];
  9970. }
  9971. };
  9972. // $source: com/ibm/rave/core/format/FormatPrefix
  9973. /************************************************************************
  9974. ** IBM Confidential
  9975. **
  9976. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9977. **
  9978. ** (C) Copyright IBM Corp. 2015
  9979. **
  9980. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9981. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9982. ************************************************************************/
  9983. // GENERATED
  9984. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  9985. //@import com/ibm/rave/core/format/Round (static) // round
  9986. //@import com/ibm/rave/core/internal/format/Precision (static) // precision
  9987. var com_ibm_rave_core_format_FormatPrefix = com_ibm_rave_core_nativeImpl_Declare({
  9988. /**
  9989. * The prefix symbol, such as "M" for millions.
  9990. */
  9991. /** @expose */
  9992. symbol : null,
  9993. /**
  9994. * The scale function, for converting numbers to the appropriate prefixed scale.
  9995. */
  9996. /** @expose */
  9997. scale : null,
  9998. constructor : function(symbol, i) {
  9999. var k = Math.pow(10, Math.abs(8 - i) * 3);
  10000. this.scale = i > 8 ? function(d) {
  10001. return d / k;
  10002. } : function(d) {
  10003. return d * k;
  10004. };
  10005. this.symbol = symbol;
  10006. }
  10007. });
  10008. /**
  10009. * Returns the SI prefix for the specified value.
  10010. * @param (double) value the specified value
  10011. * @param (Number) precision if an optional precision is specified, the value is rounded accordingly using {@link this.Round#this.round(, )} before computing the prefix
  10012. * @return (com.ibm.rave.core.format.FormatPrefix) SI prefix for the specified value
  10013. */
  10014. /** @expose */
  10015. com_ibm_rave_core_format_FormatPrefix.formatPrefix = function(value, precision) {
  10016. var i = 0;
  10017. if ((value)) {
  10018. if (value < 0) {
  10019. value *= -1;
  10020. }
  10021. if ((precision)) {
  10022. value = com_ibm_rave_core_format_Round.round(value, com_ibm_rave_core_internal_format_Precision.precision(value, precision));
  10023. }
  10024. i = 1 + Math.floor(1e-12 + Math.log(value) / Math["LN10"]);
  10025. i = Math.max(-24, Math.min(24, Math.floor((i - 1) / 3) * 3));
  10026. }
  10027. return com_ibm_rave_core_format_FormatPrefix.formatPrefixes[~~(8 + i / 3)];
  10028. };
  10029. com_ibm_rave_core_format_FormatPrefix.formatPrefixes = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"].map(function(currentValue, index, array) {
  10030. return new com_ibm_rave_core_format_FormatPrefix(currentValue, index);
  10031. });
  10032. // $source: com/ibm/rave/core/arrays/Nest
  10033. /************************************************************************
  10034. ** IBM Confidential
  10035. **
  10036. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  10037. **
  10038. ** (C) Copyright IBM Corp. 2015
  10039. **
  10040. ** The source code for this program is not published or otherwise divested of its trade secrets,
  10041. ** irrespective of what has been deposited with the U.S. Copyright Office.
  10042. ************************************************************************/
  10043. // GENERATED
  10044. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  10045. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (runtime) // create
  10046. //@import com/ibm/rave/core/arrays/Entry (runtime) // new
  10047. //@import com/ibm/rave/core/Rave (runtime) // Rave
  10048. /**
  10049. * nest operator. The set of keys is initially empty. If the map or entries operator is invoked before any key functions are registered, the nest operator simply returns the input array.
  10050. */
  10051. var com_ibm_rave_core_arrays_Nest = rave_externs["Nest"] = com_ibm_rave_core_nativeImpl_Declare({
  10052. //keyFunctions : null,
  10053. //sortKeysComparators : null,
  10054. //sortValuesFn : null,
  10055. //rollupFn : null,
  10056. constructor : function() {
  10057. this.keyFunctions = [];
  10058. this.sortKeysComparators = [];
  10059. },
  10060. internalMap : function(mapType, array, depth) {
  10061. if (depth >= this.keyFunctions.length) {
  10062. if (this.rollupFn) {
  10063. return this.rollupFn.call(this, array);
  10064. }
  10065. if (this.sortValuesFn) {
  10066. return array.sort(this.sortValuesFn);
  10067. }
  10068. return array;
  10069. }
  10070. var self = this;
  10071. var i = -1;
  10072. var n = array.length;
  10073. var keyFn = this.keyFunctions[depth++];
  10074. var keyValue;
  10075. var keyArray;
  10076. var valuesByKey = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  10077. var values;
  10078. while (++i < n) {
  10079. keyArray = array[i];
  10080. keyValue = keyFn(keyArray);
  10081. values = valuesByKey.get(keyValue);
  10082. if ((values)) {
  10083. values.push(keyArray);
  10084. } else {
  10085. valuesByKey.set(keyValue, [keyArray]);
  10086. }
  10087. }
  10088. var finalDepth = depth;
  10089. if (mapType) {
  10090. keyArray = mapType();
  10091. valuesByKey.forEach(function(b, c) {
  10092. (keyArray).set(b, self.internalMap(mapType, c, finalDepth));
  10093. return null;
  10094. });
  10095. } else {
  10096. keyArray = {};
  10097. valuesByKey.forEach(function(b, c) {
  10098. (keyArray)[b] = self.internalMap(mapType, c, finalDepth);
  10099. return null;
  10100. });
  10101. }
  10102. return keyArray;
  10103. },
  10104. internalEntries : function(map, depth) {
  10105. if (depth >= this.keyFunctions.length) {
  10106. return map;
  10107. }
  10108. var realMap = map;
  10109. var array = [];
  10110. var sortKey = this.sortKeysComparators.length > depth ? this.sortKeysComparators[depth] : null;
  10111. var finalDepth = depth + 1;
  10112. var self = this;
  10113. realMap.forEach(function(key, keyMap) {
  10114. var entry = new com_ibm_rave_core_arrays_Entry();
  10115. entry.key = key;
  10116. entry.values = self.internalEntries(keyMap, finalDepth);
  10117. array.push(entry);
  10118. return null;
  10119. });
  10120. return sortKey ? array.sort(function(obj1, obj2) {
  10121. return sortKey(obj1.key, obj2.key);
  10122. }) : array;
  10123. },
  10124. /**
  10125. * Applies the nest operator to the specified array, returning an array of key-values entries. Conceptually, this is similar to applying rave.entries to the associative array returned by map, but it applies to every level of the hierarchy rather than just the first (outermost) level. Each entry in the returned array corresponds to a distinct key value returned by the first key function. The entry value depends on the number of registered key functions: if there is an additional key, the value is another nested array of entries; otherwise, the value is the array of elements filtered from the input array that have the given key value.
  10126. * @param (Array) array the array to use
  10127. * @return (Array) key-values entries
  10128. */
  10129. /** @expose */
  10130. entries : function(array) {
  10131. return this.internalEntries(this.internalMap(com_ibm_rave_core_Rave.map, array, 0), 0);
  10132. },
  10133. /**
  10134. * Applies the nest operator to the specified array, returning an associative array. Each entry in the returned associative array corresponds to a distinct key value returned by the first key function. The entry value depends on the number of registered key functions: if there is an additional key, the value is another nested associative array; otherwise, the value is the array of elements filtered from the input array that have the given key value.
  10135. * @param (Array) array the array to use
  10136. * @param (com.ibm.rave.core.collections.MapFunctionClass) mapType the map creation function
  10137. * @return (Object) the associative array.
  10138. */
  10139. map$0 : function(array, mapType) {
  10140. return this.internalMap(mapType, array, 0);
  10141. },
  10142. /**
  10143. * Applies the nest operator to the specified array, returning an associative array. Each entry in the returned associative array corresponds to a distinct key value returned by the first key function. The entry value depends on the number of registered key functions: if there is an additional key, the value is another nested associative array; otherwise, the value is the array of elements filtered from the input array that have the given key value.
  10144. * @param (Array) array the array to use
  10145. * @return (Object) the associative array.
  10146. */
  10147. map$1 : function(array) {
  10148. return this.internalMap(null, array, 0);
  10149. },
  10150. /**
  10151. * Registers a new key function. The key function will be invoked for each element in the input array, and must return a string identifier that is used to assign the element to its group. Most often, the function is implemented as a simple accessor. Each time a key is registered, it is pushed onto the end of an internal keys array, and the resulting map or entries will have an additional hierarchy level.
  10152. * @param (com.ibm.rave.core.arrays.Nest.KeyFunction) d the key
  10153. * @return (com.ibm.rave.core.arrays.Nest) this nest operator
  10154. */
  10155. /** @expose */
  10156. key : function(d) {
  10157. this.keyFunctions.push(d);
  10158. return this;
  10159. },
  10160. /**
  10161. * Specifies a rollup function to be applied on each group of leaf elements. The return value of the rollup function will replace the array of leaf values in either the associative array returned by the map operator, or the values attribute of each entry returned by the entries operator.
  10162. * @param (com.ibm.rave.core.arrays.Nest.RollupFunction) rFunction the rollup function
  10163. * @return (com.ibm.rave.core.arrays.Nest) this nest
  10164. */
  10165. /** @expose */
  10166. rollup : function(rFunction) {
  10167. this.rollupFn = rFunction;
  10168. return this;
  10169. },
  10170. /**
  10171. * Specifies the order for the most-recently specified key. Note: only applies to entries. Map keys are unordered!
  10172. * @param (com.ibm.rave.core.util.Comparator) order the order function
  10173. * @return (com.ibm.rave.core.arrays.Nest) this nest
  10174. */
  10175. /** @expose */
  10176. sortKeys : function(order) {
  10177. this.sortKeysComparators[this.keyFunctions.length - 1] = order;
  10178. return this;
  10179. },
  10180. /**
  10181. * Specifies the order for leaf values. Applies to both maps and entries array.
  10182. * @param (com.ibm.rave.core.util.Comparator) order the order function
  10183. * @return (com.ibm.rave.core.arrays.Nest) this Nest
  10184. */
  10185. /** @expose */
  10186. sortValues : function(order) {
  10187. this.sortValuesFn = order;
  10188. return this;
  10189. },
  10190. /** @expose */
  10191. map : function(a0, a1) {
  10192. var args = arguments;
  10193. if (args.length == 1) {
  10194. return this.map$1(a0);
  10195. }
  10196. return this.map$0(a0, a1);
  10197. }
  10198. });
  10199. // $source: com/ibm/rave/core/arrays/RaveSet
  10200. /************************************************************************
  10201. ** IBM Confidential
  10202. **
  10203. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  10204. **
  10205. ** (C) Copyright IBM Corp. 2015
  10206. **
  10207. ** The source code for this program is not published or otherwise divested of its trade secrets,
  10208. ** irrespective of what has been deposited with the U.S. Copyright Office.
  10209. ************************************************************************/
  10210. // GENERATED
  10211. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  10212. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (runtime) // create
  10213. /**
  10214. * The Set collection
  10215. * @author Bryan
  10216. */
  10217. var com_ibm_rave_core_arrays_RaveSet = com_ibm_rave_core_nativeImpl_Declare({
  10218. //delegate : null,
  10219. /**
  10220. * private constructor
  10221. */
  10222. constructor : function(list) {
  10223. this.delegate = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  10224. if (list) {
  10225. for (var i = 0; i < list.length; ++i) {
  10226. this.delegate.set(""+(list[i]), true);
  10227. }
  10228. }
  10229. },
  10230. /**
  10231. * Returns true if and only if this set has an entry for the specified value string.
  10232. * @param (Object) value The value to check
  10233. * @return (boolean) whether the set has the value
  10234. */
  10235. /** @expose */
  10236. has : function(value) {
  10237. return this.delegate.has(""+(value));
  10238. },
  10239. /**
  10240. * Adds the specified value string to this set. Returns value.
  10241. * @param (Object) value The value to add
  10242. * @return (Object) the value added
  10243. */
  10244. /** @expose */
  10245. add : function(value) {
  10246. var stringvalue = ""+(value);
  10247. return this.delegate.set(stringvalue, true) ? stringvalue : null;
  10248. },
  10249. /**
  10250. * If the set contains the specified value string, removes it and returns true. Otherwise, this method does nothing and returns false.
  10251. * @param (Object) value The value to remove
  10252. * @return (boolean) whether the item was removed
  10253. */
  10254. /** @expose */
  10255. remove : function(value) {
  10256. return this.delegate.remove(""+(value));
  10257. },
  10258. /**
  10259. * Returns an array of the string values in this set. The order of the returned values is arbitrary. Can be used as a convenient way of computing the unique values for a set of strings.
  10260. * @return (Array) a list of the values
  10261. */
  10262. /** @expose */
  10263. values : function() {
  10264. return this.delegate.keys();
  10265. },
  10266. /**
  10267. * Returns the number of values in this set.
  10268. * @return (int) the number of values in this set
  10269. */
  10270. /** @expose */
  10271. size : function() {
  10272. return this.delegate.size();
  10273. },
  10274. /**
  10275. * Returns true if and only if this set has zero values.
  10276. * @return (boolean) whether this set is empty or not
  10277. */
  10278. /** @expose */
  10279. empty : function() {
  10280. return this.delegate.empty();
  10281. },
  10282. /**
  10283. * Calls the specified function for each value in this set, passing the value as an argument. The this context of the function is this set. Returns undefined. The iteration order is arbitrary.
  10284. * @param (com.ibm.rave.core.arrays.RaveSet.ForEachValueFunction) callback the function to call with each value in the set
  10285. */
  10286. /** @expose */
  10287. forEach : function(callback) {
  10288. var keys = this.delegate.keys();
  10289. for (var i = 0; i < keys.length; ++i) {
  10290. callback.call(this, keys[i], i);
  10291. }
  10292. }
  10293. });
  10294. /**
  10295. * Constructs a new set. If array is specified, adds the given array of string values to the returned set.
  10296. * @return (com.ibm.rave.core.arrays.RaveSet) the new Set
  10297. */
  10298. com_ibm_rave_core_arrays_RaveSet.create$0 = function() {
  10299. return new com_ibm_rave_core_arrays_RaveSet(null);
  10300. };
  10301. /**
  10302. * Constructs a new set. If array is specified, adds the given array of string values to the returned set.
  10303. * @param (Array) list the list of items to add to the set
  10304. * @return (com.ibm.rave.core.arrays.RaveSet) the new Set
  10305. */
  10306. com_ibm_rave_core_arrays_RaveSet.create$1 = function(list) {
  10307. return new com_ibm_rave_core_arrays_RaveSet(list);
  10308. };
  10309. /** @expose */
  10310. com_ibm_rave_core_arrays_RaveSet.create = function(a0) {
  10311. var args = arguments;
  10312. if (args.length == 0) {
  10313. return com_ibm_rave_core_arrays_RaveSet.create$0();
  10314. }
  10315. return com_ibm_rave_core_arrays_RaveSet.create$1(a0);
  10316. };
  10317. // $source: com/ibm/rave/core/textMetrics/CanvasUtil
  10318. /************************************************************************
  10319. ** IBM Confidential
  10320. **
  10321. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  10322. **
  10323. ** (C) Copyright IBM Corp. 2015
  10324. **
  10325. ** The source code for this program is not published or otherwise divested of its trade secrets,
  10326. ** irrespective of what has been deposited with the U.S. Copyright Office.
  10327. ************************************************************************/
  10328. // GENERATED
  10329. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  10330. //@import com/ibm/rave/core/nativeImpl/textMetrics/GraphicContextFactory (runtime) // create
  10331. /**
  10332. * A utility class for various canvas operations
  10333. */
  10334. var com_ibm_rave_core_textMetrics_CanvasUtil = com_ibm_rave_core_nativeImpl_Declare({
  10335. /**
  10336. * @param (double) width canvas width
  10337. * @param (double) height canvas height
  10338. * @return (com.ibm.rave.core.textMetrics.Canvas) canvas element
  10339. */
  10340. /** @expose */
  10341. create : function(width, height) {
  10342. return com_ibm_rave_core_nativeImpl_textMetrics_GraphicContextFactory.create(width, height);
  10343. }
  10344. //constructor : function() {}
  10345. });
  10346. /** @expose */
  10347. com_ibm_rave_core_textMetrics_CanvasUtil.INSTANCE = new com_ibm_rave_core_textMetrics_CanvasUtil();
  10348. // $source: com/ibm/rave/core/geom/QuadTree
  10349. /************************************************************************
  10350. ** IBM Confidential
  10351. **
  10352. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  10353. **
  10354. ** (C) Copyright IBM Corp. 2015
  10355. **
  10356. ** The source code for this program is not published or otherwise divested of its trade secrets,
  10357. ** irrespective of what has been deposited with the U.S. Copyright Office.
  10358. ************************************************************************/
  10359. // GENERATED
  10360. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  10361. /**
  10362. * A quadtree is a two-dimensional recursive spatial subdivision. This implementation uses square partitions, dividing each square into four equally-sized squares. Each point exists in a unique node; if multiple points are in the same position, some points may be stored on internal nodes rather than leaf nodes. Quadtrees can be used to accelerate various spatial operations, such as the Barnes-Hut approximation for computing n-body forces, or collision detection.
  10363. * @param < (java.lang.Object) T > type of quadtree node
  10364. */
  10365. var com_ibm_rave_core_geom_QuadTree = rave_externs["QuadTree"] = com_ibm_rave_core_nativeImpl_Declare({
  10366. //fx : null, //fy : null,
  10367. //xVal : null, //yVal : null,
  10368. x1 : NaN, y1 : 0, x2 : 0, y2 : 0,
  10369. _$functionClassMethod : function() {
  10370. var _$self = /**
  10371. * Constructs a new quadtree for the specified array of data points, returning the root node of a new quadtree. The x- and y-coordinates of each point are determined using the current x- and y- accessor functions. To build a quadtree by adding points incrementally, the specified points array can be empty, and then points can be later added to the returned root node; in this case, you must also specify the extent of the quadtree. Each node in the quadtree has several properties: nodes - a sparse array of the four child nodes in order: top-left, top-right, bottom-left, bottom-right leaf - a boolean indicating whether this is an internal node or a leaf node point - the point associated with this node, if any (may apply to either internal or leaf nodes) x - the x-coordinate of the associated point, if any y - the y-coordinate of the associated point, if any The returned root node also defines add and visit methods.
  10372. * @param (Array) data Array of data points specified for the new quadtree
  10373. * @return (com.ibm.rave.core.geom.QuadTree.RootQTNode) The root node of a new quadtree
  10374. */
  10375. function(data) {
  10376. var d;
  10377. var x1_, y1_, x2_, y2_;
  10378. var n = data.length;
  10379. var xs, ys;
  10380. if (!(isNaN(_$self.x1))) {
  10381. x1_ = _$self.x1;
  10382. y1_ = _$self.y1;
  10383. x2_ = _$self.x2;
  10384. y2_ = _$self.y2;
  10385. } else {
  10386. x2_ = y2_ = -(x1_ = y1_ = Infinity);
  10387. xs = [];
  10388. ys = [];
  10389. for (var i = 0; i < n; ++i) {
  10390. var x_ = +_$self.fx(d = data[i], i), y_ = +_$self.fy(d, i);
  10391. if (x_ < x1_) {
  10392. x1_ = x_;
  10393. }
  10394. if (y_ < y1_) {
  10395. y1_ = y_;
  10396. }
  10397. if (x_ > x2_) {
  10398. x2_ = x_;
  10399. }
  10400. if (y_ > y2_) {
  10401. y2_ = y_;
  10402. }
  10403. xs[i] = x_;
  10404. ys[i] = y_;
  10405. }
  10406. }
  10407. var dx = x2_ - x1_, dy = y2_ - y1_;
  10408. if (dx > dy) {
  10409. y2_ = y1_ + dx;
  10410. } else {
  10411. x2_ = x1_ + dy;
  10412. }
  10413. var root = new com_ibm_rave_core_geom_QuadTree.RootQTNode(x1_, y1_, x2_, y2_, _$self.fx, _$self.fy);
  10414. if (isNaN(_$self.x1)) {
  10415. var i = -1;
  10416. while (++i < n) {
  10417. com_ibm_rave_core_geom_QuadTree.insert(root, data[i], xs[i], ys[i], x1_, y1_, x2_, y2_);
  10418. }
  10419. --i;
  10420. root.i = i;
  10421. } else {
  10422. for (var i = 0; i < n; ++i) {
  10423. root.add(data[i]);
  10424. }
  10425. }
  10426. return root;
  10427. };
  10428. return _$self;
  10429. },
  10430. /**
  10431. * If x is not specified, returns the current x-coordinate accessor
  10432. * @return (Object) the current x-coordinate accessor
  10433. */
  10434. x$0 : function() {
  10435. return this.xVal;
  10436. },
  10437. /**
  10438. * If x is specified, sets the x-coordinate accessor and returns this quadtree factory For each point added to the quadtree, either during initial construction or lazily added, the x-accessor is invoked with the arguments {data, index}, where data is the current point and index is its index in the array of all points. The x-accessor must then return a numeric value indicating the x-coordinate of the given point. The x-accessor may also be defined as a constant number rather than a function, if desired.
  10439. * @param (double) x The x-coordinate to use
  10440. * @return (com.ibm.rave.core.geom.QuadTree) the quadtree factory
  10441. */
  10442. x$1 : function(x) {
  10443. this.fx = function(data, index) {
  10444. return x;
  10445. };
  10446. this.xVal = x;
  10447. return this;
  10448. },
  10449. /**
  10450. * If x is specified, sets the x-coordinate accessor and returns this quadtree factory For each point added to the quadtree, either during initial construction or lazily added, the x-accessor is invoked with the arguments {data, index}, where data is the current point and index is its index in the array of all points. The x-accessor must then return a numeric value indicating the x-coordinate of the given point. The x-accessor may also be defined as a constant number rather than a function, if desired.
  10451. * @param (com.ibm.rave.core.geom.QuadTree.ValueFunction) x A new x-accessor to be used
  10452. * @return (com.ibm.rave.core.geom.QuadTree) the quadtree factory
  10453. */
  10454. x$2 : function(x) {
  10455. this.fx = x;
  10456. this.xVal = x;
  10457. return this;
  10458. },
  10459. /**
  10460. * If y is not specified, returns the current y-coordinate accessor
  10461. * @return (Object) the current y-coordinate accessor
  10462. */
  10463. y$0 : function() {
  10464. return this.yVal;
  10465. },
  10466. /**
  10467. * If y is specified, sets the y-coordinate accessor and returns this quadtree factory For each point added to the quadtree, either during initial construction or lazily added, the y-accessor is invoked with the arguments {data, index}, where data is the current point and index is its index in the array of all points. The y-accessor must then return a numeric value indicating the y-coordinate of the given point. The y-accessor may also be defined as a constant number rather than a function, if desired.
  10468. * @param (double) y The y-coordinate to use
  10469. * @return (com.ibm.rave.core.geom.QuadTree) the quadtree factory
  10470. */
  10471. y$1 : function(y) {
  10472. this.fy = function(data, index) {
  10473. return y;
  10474. };
  10475. this.yVal = y;
  10476. return this;
  10477. },
  10478. /**
  10479. * If y is specified, sets the y-coordinate accessor and returns this quadtree factory For each point added to the quadtree, either during initial construction or lazily added, the y-accessor is invoked with the arguments {data, index}, where data is the current point and index is its index in the array of all points. The y-accessor must then return a numeric value indicating the y-coordinate of the given point. The y-accessor may also be defined as a constant number rather than a function, if desired.
  10480. * @param (com.ibm.rave.core.geom.QuadTree.ValueFunction) y A new y-accessor to be used
  10481. * @return (com.ibm.rave.core.geom.QuadTree) the quadtree factory
  10482. */
  10483. y$2 : function(y) {
  10484. this.fy = y;
  10485. this.yVal = y;
  10486. return this;
  10487. },
  10488. /**
  10489. * If extent is not specified, returns the current extent, which defaults to null. When the extent is null, an extent will be computed automatically by scanning the array of input points passed to the quadtree constructor. Setting an extent is required when constructing a quadtree lazily from an initially-empty set of nodes
  10490. * @return (com.ibm.rave.core.geom.Point[]) an array of points using the previously setup x1, y1, x2 and y2 bounds. If x1 is not specified, null is returned
  10491. */
  10492. extent$0 : function() {
  10493. return isNaN(this.x1) ? null : [[this.x1, this.y1], [this.x2, this.y2]];
  10494. },
  10495. /**
  10496. * If extent is specified, sets the current extent and returns this quadtree factory. The extent must be specified as a two-dimensional array [​[x0, y0], [​x1, y1]​], where x0 and y0 are the lower bounds of the extent, and x1 and y1 are the upper bounds of the extent. Setting an extent is required when constructing a quadtree lazily from an initially-empty set of nodes
  10497. * @param (com.ibm.rave.core.geom.Point[]) extent A two-dimensional array [​[x0, y0], [​x1, y1]​], where x0 and y0 are the lower bounds of the extent, and x1 and y1 are the upper bounds of the extent
  10498. * @return (com.ibm.rave.core.geom.QuadTree) quadtree factory with the current extent set
  10499. */
  10500. extent$1 : function(extent) {
  10501. if (!extent) {
  10502. this.x1 = this.y1 = this.x2 = this.y2 = NaN;
  10503. } else {
  10504. this.x1 = extent[0][0];
  10505. this.y1 = extent[0][1];
  10506. this.x2 = extent[1][0];
  10507. this.y2 = extent[1][1];
  10508. }
  10509. return this;
  10510. },
  10511. /**
  10512. * Creates a point indicating the size of the quadtree. If no size is available returns null
  10513. * @return (Array) a new point indicating the size of the quadtree
  10514. */
  10515. size$0 : function() {
  10516. return isNaN(this.x1) ? null : [this.x2 - this.x1, this.y2 - this.y1];
  10517. },
  10518. /**
  10519. * Uses the data passed in, in order to calculate the size of the quadtree. If no point is given, the size will be initialized to Double.NaN
  10520. * @param (Array) size the point used in order to setup the quadtree's size
  10521. * @return (com.ibm.rave.core.geom.QuadTree) the quadtree factory
  10522. */
  10523. size$1 : function(size) {
  10524. if (!size) {
  10525. this.x1 = this.y1 = this.x2 = this.y2 = NaN;
  10526. } else {
  10527. this.x1 = this.y2 = 0;
  10528. this.x2 = size[0];
  10529. this.y2 = size[1];
  10530. }
  10531. return this;
  10532. },
  10533. /** @expose */
  10534. x : function(a0) {
  10535. var args = arguments;
  10536. if (args.length == 0) {
  10537. return this.x$0();
  10538. }
  10539. if (args.length == 1 && typeof a0 === "function") {
  10540. return this.x$2(a0);
  10541. }
  10542. return this.x$1(a0);
  10543. },
  10544. /** @expose */
  10545. y : function(a0) {
  10546. var args = arguments;
  10547. if (args.length == 0) {
  10548. return this.y$0();
  10549. }
  10550. if (args.length == 1 && typeof a0 === "function") {
  10551. return this.y$2(a0);
  10552. }
  10553. return this.y$1(a0);
  10554. },
  10555. /** @expose */
  10556. extent : function(a0) {
  10557. var args = arguments;
  10558. if (args.length == 0) {
  10559. return this.extent$0();
  10560. }
  10561. return this.extent$1(a0);
  10562. },
  10563. /** @expose */
  10564. size : function(a0) {
  10565. var args = arguments;
  10566. if (args.length == 0) {
  10567. return this.size$0();
  10568. }
  10569. return this.size$1(a0);
  10570. }
  10571. });
  10572. /**
  10573. * Constructs a new quadtree for the specified array of data points, returning the root node of a new quadtree. Note: only for compatibility
  10574. * @param (Array) data data points specified in order to construct a new quadtree
  10575. * @param (double) x1 x1 coordinate
  10576. * @param (double) y1 y1 coordinate
  10577. * @param (double) x2 x2 coordinate
  10578. * @param (double) y2 y2 coordinate
  10579. * @return (com.ibm.rave.core.geom.QuadTree.RootQTNode) the root node of a new quadtree
  10580. */
  10581. com_ibm_rave_core_geom_QuadTree.createQuadTree$0 = function(data, x1, y1, x2, y2) {
  10582. var qTree = new com_ibm_rave_core_geom_QuadTree();
  10583. qTree.fx = com_ibm_rave_core_geom_QuadTree.FX_COMP_FN();
  10584. qTree.fy = com_ibm_rave_core_geom_QuadTree.FY_COMP_FN();
  10585. qTree.xVal = qTree.fx;
  10586. qTree.yVal = qTree.fy;
  10587. qTree.x1 = x1;
  10588. qTree.y1 = y1;
  10589. qTree.x2 = x2;
  10590. qTree.y2 = y2;
  10591. return qTree(data);
  10592. };
  10593. /**
  10594. * Constructs a new quadtree for the specified array of data points, returning the root node of a new quadtree. Note: only for compatibility
  10595. * @param (Array) data data points specified in order to construct a new quadtree
  10596. * @param (double) x1 x1 coordinate
  10597. * @param (double) y1 y1 coordinate
  10598. * @return (com.ibm.rave.core.geom.QuadTree.RootQTNode) the root node of a new quadtree
  10599. */
  10600. com_ibm_rave_core_geom_QuadTree.createQuadTree$1 = function(data, x1, y1) {
  10601. return com_ibm_rave_core_geom_QuadTree.createQuadTree$0(data, 0, 0, x1, y1);
  10602. };
  10603. /**
  10604. * Constructs a new quadtree for the specified array of data points When using this constructor for T type other than Point, setting x and y value functions for the new quad tree is mandatory
  10605. * @param (Array) data Array of data points specified for the new quadtree
  10606. * @return (com.ibm.rave.core.geom.QuadTree.RootQTNode) The root node of a new quadtree
  10607. */
  10608. com_ibm_rave_core_geom_QuadTree.createQuadTree$2 = function(data) {
  10609. var qTree = new com_ibm_rave_core_geom_QuadTree();
  10610. qTree.fx = com_ibm_rave_core_geom_QuadTree.FX_COMP_FN();
  10611. qTree.fy = com_ibm_rave_core_geom_QuadTree.FY_COMP_FN();
  10612. qTree.xVal = qTree.fx;
  10613. qTree.yVal = qTree.fy;
  10614. return qTree(data);
  10615. };
  10616. /**
  10617. * Creates a new quadtree factory with the default x-accessor, y-accessor and extent. The returned function can be used to create any number of quadtrees from data with the factory’s configuration.
  10618. * @return (com.ibm.rave.core.geom.QuadTree) a new quadtree with default x/y accessors and extent
  10619. */
  10620. com_ibm_rave_core_geom_QuadTree.createQuadTree$3 = function() {
  10621. var qTree = new com_ibm_rave_core_geom_QuadTree();
  10622. qTree.fx = com_ibm_rave_core_geom_QuadTree.FX_FN();
  10623. qTree.fy = com_ibm_rave_core_geom_QuadTree.FY_FN();
  10624. qTree.xVal = qTree.fx;
  10625. qTree.yVal = qTree.fy;
  10626. return qTree;
  10627. };
  10628. /** @expose */
  10629. com_ibm_rave_core_geom_QuadTree.quadtreeVisit = function(f, node, x1, y1, x2, y2) {
  10630. var children = node.nodes;
  10631. if (!(f(node, x1, y1, x2, y2)) && children) {
  10632. var sx = (x1 + x2) * .5;
  10633. var sy = (y1 + y2) * .5;
  10634. if (children[0]) {
  10635. com_ibm_rave_core_geom_QuadTree.quadtreeVisit(f, children[0], x1, y1, sx, sy);
  10636. }
  10637. if (children[1]) {
  10638. com_ibm_rave_core_geom_QuadTree.quadtreeVisit(f, children[1], sx, y1, x2, sy);
  10639. }
  10640. if (children[2]) {
  10641. com_ibm_rave_core_geom_QuadTree.quadtreeVisit(f, children[2], x1, sy, sx, y2);
  10642. }
  10643. if (children[3]) {
  10644. com_ibm_rave_core_geom_QuadTree.quadtreeVisit(f, children[3], sx, sy, x2, y2);
  10645. }
  10646. }
  10647. };
  10648. /** @expose */
  10649. com_ibm_rave_core_geom_QuadTree.insert = function(n, d, x, y, x1, y1, x2, y2) {
  10650. if (isNaN(x) || isNaN(y)) {
  10651. return;
  10652. }
  10653. if (n.leaf) {
  10654. var nx = n.x, ny = n.y;
  10655. if (!(isNaN(nx))) {
  10656. if ((Math.abs(nx - x) + Math.abs(ny - y)) < .01) {
  10657. com_ibm_rave_core_geom_QuadTree.insertChild(n, d, x, y, x1, y1, x2, y2);
  10658. } else {
  10659. var nPoint = n.point;
  10660. n.point = null;
  10661. n.x = n.y = NaN;
  10662. com_ibm_rave_core_geom_QuadTree.insertChild(n, nPoint, nx, ny, x1, y1, x2, y2);
  10663. com_ibm_rave_core_geom_QuadTree.insertChild(n, d, x, y, x1, y1, x2, y2);
  10664. }
  10665. } else {
  10666. n.x = x;
  10667. n.y = y;
  10668. n.point = d;
  10669. }
  10670. } else {
  10671. com_ibm_rave_core_geom_QuadTree.insertChild(n, d, x, y, x1, y1, x2, y2);
  10672. }
  10673. };
  10674. com_ibm_rave_core_geom_QuadTree.insertChild = function(n, d, x, y, x1, y1, x2, y2) {
  10675. var xm = (x1 + x2) * .5;
  10676. var ym = (y1 + y2) * .5;
  10677. var right = x >= xm;
  10678. var below = y >= ym;
  10679. var i = below ? (right ? 3 : 2) : (right ? 1 : 0);
  10680. n.leaf = false;
  10681. if (!n.nodes[i]) {
  10682. n.nodes[i] = new com_ibm_rave_core_geom_QuadTree.QTNode();
  10683. }
  10684. n = n.nodes[i];
  10685. if (right) {
  10686. x1 = xm;
  10687. } else {
  10688. x2 = xm;
  10689. }
  10690. if (below) {
  10691. y1 = ym;
  10692. } else {
  10693. y2 = ym;
  10694. }
  10695. com_ibm_rave_core_geom_QuadTree.insert(n, d, x, y, x1, y1, x2, y2);
  10696. };
  10697. com_ibm_rave_core_geom_QuadTree.FX_COMP_FN = function() {
  10698. return function(data, index) {
  10699. return data.x;
  10700. };
  10701. };
  10702. com_ibm_rave_core_geom_QuadTree.FY_COMP_FN = function() {
  10703. return function(data, index) {
  10704. return data.y;
  10705. };
  10706. };
  10707. com_ibm_rave_core_geom_QuadTree.FX_FN = function() {
  10708. return function(data, index) {
  10709. return (data)[0];
  10710. };
  10711. };
  10712. com_ibm_rave_core_geom_QuadTree.FY_FN = function() {
  10713. return function(data, index) {
  10714. return (data)[1];
  10715. };
  10716. };
  10717. /** @expose */
  10718. com_ibm_rave_core_geom_QuadTree.createQuadTree = function(a0, a1, a2, a3, a4) {
  10719. var args = arguments;
  10720. if (args.length == 0) {
  10721. return com_ibm_rave_core_geom_QuadTree.createQuadTree$3();
  10722. }
  10723. if (args.length == 1) {
  10724. return com_ibm_rave_core_geom_QuadTree.createQuadTree$2(a0);
  10725. }
  10726. if (args.length == 3) {
  10727. return com_ibm_rave_core_geom_QuadTree.createQuadTree$1(a0, a1, a2);
  10728. }
  10729. return com_ibm_rave_core_geom_QuadTree.createQuadTree$0(a0, a1, a2, a3, a4);
  10730. };
  10731. /**
  10732. * Sets up a new object containing the quadtree node
  10733. * @param < (java.lang.Object) T > the type of node to be used
  10734. */
  10735. com_ibm_rave_core_geom_QuadTree.QTNode = rave_externs["QTNode"] = com_ibm_rave_core_nativeImpl_Declare({
  10736. /**
  10737. * a sparse array of the four child nodes in order: top-left, top-right, bottom-left, bottom-right
  10738. */
  10739. /** @expose */
  10740. nodes : null,
  10741. /**
  10742. * the point associated with this node, if any (may apply to either internal or leaf nodes)
  10743. */
  10744. /** @expose */
  10745. point : null,
  10746. /** @expose */
  10747. data : null,
  10748. /**
  10749. * a boolean indicating whether this is an internal node or a leaf node
  10750. */
  10751. /** @expose */
  10752. leaf : true,
  10753. /**
  10754. * the x-coordinate of the associated point, if any
  10755. */
  10756. /** @expose */
  10757. x : NaN,
  10758. /**
  10759. * the y-coordinate of the associated point, if any
  10760. */
  10761. /** @expose */
  10762. y : NaN,
  10763. constructor : function() {
  10764. this.nodes = [];
  10765. }
  10766. });
  10767. /**
  10768. * Initial setup of a root quadtree node
  10769. * @param < (java.lang.Object) T > type of quadtree node
  10770. */
  10771. com_ibm_rave_core_geom_QuadTree.RootQTNode = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_geom_QuadTree.QTNode, {
  10772. //fx : null, //fy : null,
  10773. _x1 : 0, _y1 : 0, _x2 : 0, _y2 : 0,
  10774. i : -1,
  10775. constructor : function(x1, y1, x2, y2, fx, fy) {
  10776. this._x1 = x1;
  10777. this._y1 = y1;
  10778. this._x2 = x2;
  10779. this._y2 = y2;
  10780. this.fx = fx;
  10781. this.fy = fy;
  10782. },
  10783. /**
  10784. * Visits each node in the quadtree, invoking the specified callback with arguments {node, x1, y1, x2, y2} for each node. Nodes are traversed in pre-order. If the callback returns true for a the given node, then the children of that node are not visited; otherwise, all child nodes are visited.
  10785. * @param (com.ibm.rave.core.geom.QuadTree.Visitor) visitor specified callback
  10786. */
  10787. /** @expose */
  10788. visit : function(visitor) {
  10789. com_ibm_rave_core_geom_QuadTree.quadtreeVisit(visitor, this, this._x1, this._y1, this._x2, this._y2);
  10790. },
  10791. /**
  10792. * Find the closest point to the specified point.
  10793. * @param (Array) point1 the source point
  10794. * @return (java.lang.Object) the closest point
  10795. */
  10796. /** @expose */
  10797. find : function(point1) {
  10798. return new com_ibm_rave_core_geom_QuadTree.Finder(point1[0], point1[1], this._x1, this._y1, this._x2, this._y2).find(this, this._x1, this._y1, this._x2, this._y2).closestPoint;
  10799. },
  10800. /**
  10801. * Adds the specified new point to the quadtree
  10802. * @param (java.lang.Object) d the specified new point to be added to the quadtree
  10803. */
  10804. /** @expose */
  10805. add : function(d) {
  10806. com_ibm_rave_core_geom_QuadTree.insert(this, d, +this.fx(d, ++this.i), +this.fy(d, this.i), this._x1, this._y1, this._x2, this._y2);
  10807. }
  10808. });
  10809. com_ibm_rave_core_geom_QuadTree.Finder = com_ibm_rave_core_nativeImpl_Declare({
  10810. //closestPoint : null,
  10811. x : 0, y : 0,
  10812. x0 : 0, y0 : 0, x3 : 0, y3 : 0, minDistance2 : Infinity,
  10813. constructor : function(x, y, x0, y0, x3, y3) {
  10814. this.x = x;
  10815. this.y = y;
  10816. this.x0 = x0;
  10817. this.y0 = y0;
  10818. this.x3 = x3;
  10819. this.y3 = y3;
  10820. },
  10821. find : function(node, x1, y1, x2, y2) {
  10822. if (x1 > this.x3 || y1 > this.y3 || x2 < this.x0 || y2 < this.y0) {
  10823. return this;
  10824. }
  10825. var point = node.point;
  10826. if (point) {
  10827. var dx = this.x - node.x;
  10828. var dy = this.y - node.y;
  10829. var distance2 = dx * dx + dy * dy;
  10830. if (distance2 < this.minDistance2) {
  10831. var distance = Math.sqrt(this.minDistance2 = distance2);
  10832. this.x0 = this.x - distance;
  10833. this.y0 = this.y - distance;
  10834. this.x3 = this.x + distance;
  10835. this.y3 = this.y + distance;
  10836. this.closestPoint = point;
  10837. }
  10838. }
  10839. var children = node.nodes;
  10840. var xm = (x1 + x2) * .5;
  10841. var ym = (y1 + y2) * .5;
  10842. var right = +(this.x >= xm);
  10843. var below = +(this.y >= ym);
  10844. for (var i = below << 1 | right, j = i + 4; i < j; ++i) {
  10845. if ((node = children[i & 3])) {
  10846. switch (i & 3) {
  10847. case 0:
  10848. this.find(node, x1, y1, xm, ym);
  10849. break;
  10850. case 1:
  10851. this.find(node, xm, y1, x2, ym);
  10852. break;
  10853. case 2:
  10854. this.find(node, x1, ym, xm, y2);
  10855. break;
  10856. case 3:
  10857. this.find(node, xm, ym, x2, y2);
  10858. break;
  10859. }
  10860. }
  10861. }
  10862. return this;
  10863. }
  10864. });
  10865. // $source: com/ibm/rave/core/geom/Geom
  10866. /************************************************************************
  10867. ** IBM Confidential
  10868. **
  10869. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  10870. **
  10871. ** (C) Copyright IBM Corp. 2015
  10872. **
  10873. ** The source code for this program is not published or otherwise divested of its trade secrets,
  10874. ** irrespective of what has been deposited with the U.S. Copyright Office.
  10875. ************************************************************************/
  10876. // GENERATED
  10877. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, bind
  10878. //@import com/ibm/rave/core/geom/QuadTree (loadtime) // createQuadTree
  10879. //@import com/ibm/rave/core/geom/Polygon (runtime) // new
  10880. //@import com/ibm/rave/core/geom/Voronoi (runtime) // new
  10881. //@import com/ibm/rave/core/geom/Hull (runtime) // new
  10882. var com_ibm_rave_core_geom_Geom = com_ibm_rave_core_nativeImpl_Declare({
  10883. /**
  10884. * @see this.QuadTree#this.createQuadTree()
  10885. */
  10886. quadtree$0 : com_ibm_rave_core_geom_QuadTree.createQuadTree,
  10887. /**
  10888. * @see QuadTree#createQuadTree(List<PointStruct>)
  10889. */
  10890. quadtree$1 : com_ibm_rave_core_geom_QuadTree.createQuadTree,
  10891. /**
  10892. * @see QuadTree#createQuadTree(List<PointStruct>, double, double, double, double)
  10893. */
  10894. quadtree$2 : com_ibm_rave_core_geom_QuadTree.createQuadTree,
  10895. /**
  10896. * @see QuadTree#createQuadTree(List<PointStruct>, double, double)
  10897. */
  10898. quadtree$3 : com_ibm_rave_core_geom_QuadTree.createQuadTree,
  10899. /**
  10900. * Creates a polygon from the specified array of points.
  10901. * @param (Array) coordinates an array of points
  10902. * @return (com.ibm.rave.core.geom.Polygon) the polygon
  10903. */
  10904. /** @expose */
  10905. polygon : function(coordinates) {
  10906. return new com_ibm_rave_core_geom_Polygon(coordinates);
  10907. },
  10908. /**
  10909. * Create a Voronoi layout with default accessors.
  10910. * @return (com.ibm.rave.core.geom.Voronoi) the Voronoi layout object
  10911. */
  10912. voronoi$0 : function() {
  10913. return new com_ibm_rave_core_geom_Voronoi();
  10914. },
  10915. /**
  10916. * Create a Voronoi layout with default accessors, and run the layout.
  10917. * @param (Array) data
  10918. * @return (Array) an array of polygons
  10919. * @deprecated use {@link this.Geom#this.voronoi()} instead
  10920. */
  10921. voronoi$1 : function(data) {
  10922. return new com_ibm_rave_core_geom_Voronoi()(data);
  10923. },
  10924. /**
  10925. * Create a Hull layout with default accessors
  10926. * @return (com.ibm.rave.core.geom.Hull) a new Hull object
  10927. */
  10928. hull$0 : function() {
  10929. return new com_ibm_rave_core_geom_Hull();
  10930. },
  10931. /**
  10932. * Create a Hull layout with default accessors, and run the layout.
  10933. * @param (Array) data
  10934. * @return (Array) a new Hull object
  10935. */
  10936. hull$1 : function(data) {
  10937. return new com_ibm_rave_core_geom_Hull()(data);
  10938. },
  10939. /**
  10940. * Compute the Delaunay mesh as a triangular tessellation. <p> Returns the Delaunay triangulation of the specified data array as an array of triangles. Each triangle is a three-element array containing elements from data.
  10941. * @param (Array) vertices array of data
  10942. * @return (Array) array of triangles
  10943. * @deprecated use {@link #this.voronoi()} {@link this.Voronoi#this.triangles(Array)} instead
  10944. */
  10945. /** @expose */
  10946. delaunay : function(vertices) {
  10947. return new com_ibm_rave_core_geom_Voronoi().triangles((vertices));
  10948. },
  10949. /** @expose */
  10950. quadtree : com_ibm_rave_core_nativeImpl_Declare.bind(function(a0, a1, a2, a3, a4) {
  10951. var args = arguments;
  10952. if (args.length == 0) {
  10953. return this.quadtree$0();
  10954. }
  10955. if (args.length == 1) {
  10956. return this.quadtree$1(a0);
  10957. }
  10958. if (args.length == 3) {
  10959. return this.quadtree$3(a0, a1, a2);
  10960. }
  10961. return this.quadtree$2(a0, a1, a2, a3, a4);
  10962. }),
  10963. /** @expose */
  10964. voronoi : com_ibm_rave_core_nativeImpl_Declare.bind(function(a0) {
  10965. var args = arguments;
  10966. if (args.length == 0) {
  10967. return this.voronoi$0();
  10968. }
  10969. return this.voronoi$1(a0);
  10970. }),
  10971. /** @expose */
  10972. hull : com_ibm_rave_core_nativeImpl_Declare.bind(function(a0) {
  10973. var args = arguments;
  10974. if (args.length == 0) {
  10975. return this.hull$0();
  10976. }
  10977. return this.hull$1(a0);
  10978. })
  10979. //constructor : function() {}
  10980. });
  10981. /** @expose */
  10982. com_ibm_rave_core_geom_Geom.INSTANCE = new com_ibm_rave_core_geom_Geom();
  10983. // $source: com/ibm/rave/core/geom/Polygon
  10984. /************************************************************************
  10985. ** IBM Confidential
  10986. **
  10987. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  10988. **
  10989. ** (C) Copyright IBM Corp. 2015
  10990. **
  10991. ** The source code for this program is not published or otherwise divested of its trade secrets,
  10992. ** irrespective of what has been deposited with the U.S. Copyright Office.
  10993. ************************************************************************/
  10994. // GENERATED
  10995. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  10996. //@import com/ibm/rave/core/internal/geom/PolygonUtil (runtime) // polygonIntersect
  10997. var com_ibm_rave_core_geom_Polygon = rave_externs["Polygon"] = com_ibm_rave_core_nativeImpl_Declare(Array, {
  10998. //self : null,
  10999. constructor : function(coordinates) {
  11000. this.self = this;
  11001. {
  11002. com_ibm_rave_core_geom_Polygon.addCollection(this, coordinates);
  11003. }
  11004. },
  11005. /**
  11006. * Returns the signed area of this polygon. If the vertices are in counterclockwise order, the area is positive, otherwise it is negative.
  11007. * @return (double) the signed area
  11008. */
  11009. /** @expose */
  11010. area : function() {
  11011. var i = -1;
  11012. var n = this.self.length;
  11013. var a;
  11014. var b = this.self[n - 1];
  11015. var area = 0;
  11016. while (++i < n) {
  11017. a = b;
  11018. b = this.self[i];
  11019. area += a[1] * b[0] - a[0] * b[1];
  11020. }
  11021. return area * .5;
  11022. },
  11023. /**
  11024. * Returns a two-element array representing the centroid of this polygon.
  11025. * @return (Array) the centroid
  11026. */
  11027. centroid$0 : function() {
  11028. var i = -1;
  11029. var n = this.self.length;
  11030. var x = 0;
  11031. var y = 0;
  11032. var a;
  11033. var b = this.self[n - 1];
  11034. var c = 0;
  11035. var k = -1 / (6 * this.area());
  11036. while (++i < n) {
  11037. a = b;
  11038. b = this.self[i];
  11039. c = a[0] * b[1] - b[0] * a[1];
  11040. x += (a[0] + b[0]) * c;
  11041. y += (a[1] + b[1]) * c;
  11042. }
  11043. return [x * k, y * k];
  11044. },
  11045. /**
  11046. * Returns a two-element array representing the centroid of this polygon.
  11047. * @param (double) k centroid factor
  11048. * @return (Array) Array representing the centroid of this polygon
  11049. */
  11050. centroid$1 : function(k) {
  11051. var i = -1;
  11052. var n = this.self.length;
  11053. var x = 0;
  11054. var y = 0;
  11055. var a;
  11056. var b = this.self[n - 1];
  11057. var c = 0;
  11058. while (++i < n) {
  11059. a = b;
  11060. b = this.self[i];
  11061. c = a[0] * b[1] - b[0] * a[1];
  11062. x += (a[0] + b[0]) * c;
  11063. y += (a[1] + b[1]) * c;
  11064. }
  11065. return [x * k, y * k];
  11066. },
  11067. /**
  11068. * Clips the subject polygon against this polygon. In other words, returns a polygon representing the intersection of this polygon and the subject polygon. Assumes the clip polygon is counterclockwise and convex.
  11069. * @param (Array) subject the polygon to intersect with
  11070. * @return (Array) the intersection polygon
  11071. */
  11072. /** @expose */
  11073. clip : function(subject) {
  11074. var input = [];
  11075. var closed = com_ibm_rave_core_geom_Polygon.geom_polygonClosed(subject);
  11076. var i = -1;
  11077. var n = this.self.length;
  11078. if (com_ibm_rave_core_geom_Polygon.geom_polygonClosed(this)) {
  11079. n--;
  11080. }
  11081. var j = 0;
  11082. var m = 0;
  11083. var a = this.self[n - 1], b, c, d;
  11084. while (++i < n) {
  11085. input = subject.slice();
  11086. subject = [];
  11087. b = this.self[i];
  11088. m = input.length;
  11089. if (closed) {
  11090. m--;
  11091. }
  11092. c = input[m - 1];
  11093. j = -1;
  11094. while (++j < m) {
  11095. d = input[j];
  11096. if (com_ibm_rave_core_geom_Polygon.geom_polygonInside(d, a, b)) {
  11097. if (!(com_ibm_rave_core_geom_Polygon.geom_polygonInside(c, a, b))) {
  11098. subject.push(com_ibm_rave_core_internal_geom_PolygonUtil.polygonIntersect(c, d, a, b));
  11099. }
  11100. subject.push(d);
  11101. } else if (com_ibm_rave_core_geom_Polygon.geom_polygonInside(c, a, b)) {
  11102. subject.push(com_ibm_rave_core_internal_geom_PolygonUtil.polygonIntersect(c, d, a, b));
  11103. }
  11104. c = d;
  11105. }
  11106. if (closed) {
  11107. subject.push(subject[0]);
  11108. }
  11109. a = b;
  11110. }
  11111. return subject;
  11112. },
  11113. /** @expose */
  11114. centroid : function(a0) {
  11115. var args = arguments;
  11116. if (args.length == 0) {
  11117. return this.centroid$0();
  11118. }
  11119. return this.centroid$1(a0);
  11120. }
  11121. });
  11122. com_ibm_rave_core_geom_Polygon.addCollection = function(coordinates1, coordinates2) {
  11123. for (var index = 0; index < coordinates2.length; ++index) {
  11124. coordinates1.push(coordinates2[index]);
  11125. }
  11126. };
  11127. com_ibm_rave_core_geom_Polygon.geom_polygonInside = function(p, a, b) {
  11128. return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);
  11129. };
  11130. com_ibm_rave_core_geom_Polygon.geom_polygonClosed = function(coordinates) {
  11131. var a = coordinates[0], b = coordinates[coordinates.length - 1];
  11132. return !((a[0] - b[0]) || ((a[1] - b[1])));
  11133. };
  11134. // $source: com/ibm/rave/core/geom/Voronoi
  11135. /************************************************************************
  11136. ** IBM Confidential
  11137. **
  11138. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  11139. **
  11140. ** (C) Copyright IBM Corp. 2015
  11141. **
  11142. ** The source code for this program is not published or otherwise divested of its trade secrets,
  11143. ** irrespective of what has been deposited with the U.S. Copyright Office.
  11144. ************************************************************************/
  11145. // GENERATED
  11146. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  11147. //@import com/ibm/rave/core/svg/SVGLine (runtime) // SVGLine
  11148. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiContext (runtime) // new
  11149. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiEdge (runtime) // new
  11150. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiIndex (runtime) // voronoi
  11151. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiCell (runtime) // VoronoiCell
  11152. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiPolygon (runtime) // new
  11153. /**
  11154. * Voronoi layouts are particularly useful for invisible interactive regions, as demonstrated in Nate Vack’s Voronoi picking example. See Tovi Grossman’s paper on bubble cursors for a related concept.
  11155. */
  11156. var com_ibm_rave_core_geom_Voronoi = rave_externs["Voronoi"] = com_ibm_rave_core_nativeImpl_Declare({
  11157. //clipExtentVal : null,
  11158. //fx : null,
  11159. //fy : null,
  11160. //voronoieContext : null,
  11161. //xVal : null,
  11162. //yVal : null,
  11163. _$functionClassMethod : function() {
  11164. var _$self = /**
  11165. * Returns an array of polygons, one for each input vertex in the specified data array. If any vertices are coincident or have NaN positions, the behavior of this method is undefined: most likely, invalid polygons will be returned! You should filter invalid vertices, and consolidate coincident vertices, before computing the tessellation.
  11166. * @param (Array) data the data array
  11167. * @return (Array) an array of polygons
  11168. */
  11169. function(data) {
  11170. var polygons = new Array(data.length);
  11171. var x0 = _$self.clipExtentVal[0][0], y0 = _$self.clipExtentVal[0][1], x1 = _$self.clipExtentVal[1][0], y1 = _$self.clipExtentVal[1][1];
  11172. var cells = com_ibm_rave_core_internal_geom_voronoi_VoronoiIndex.voronoi(_$self.voronoieContext, _$self.sites(data), _$self.clipExtentVal).voronoiCells;
  11173. cells.forEach(function(cell, index, array) {
  11174. var edges = cell.edges;
  11175. var site = cell.site;
  11176. if (edges.length != 0) {
  11177. var len = edges.length;
  11178. var mappedArray = new com_ibm_rave_core_internal_geom_voronoi_VoronoiPolygon();
  11179. for (var i = 0; i < len; ++i) {
  11180. var currentValue = edges[i];
  11181. if (currentValue) {
  11182. var s = currentValue.start();
  11183. mappedArray.push([s.x, s.y]);
  11184. }
  11185. }
  11186. polygons[index] = mappedArray;
  11187. } else if (site.x >= x0 && site.x <= x1 && site.y >= y0 && site.y <= y1) {
  11188. var newPolygon = new com_ibm_rave_core_internal_geom_voronoi_VoronoiPolygon();
  11189. newPolygon.push([x0, y1], [x1, y1], [x1, y0], [x0, y0]);
  11190. polygons[index] = newPolygon;
  11191. } else {
  11192. polygons[index] = new com_ibm_rave_core_internal_geom_voronoi_VoronoiPolygon();
  11193. }
  11194. var polygon = polygons[index];
  11195. polygon.point = data[index];
  11196. return null;
  11197. });
  11198. return polygons;
  11199. };
  11200. return _$self;
  11201. },
  11202. constructor : function() {
  11203. this.clipExtentVal = com_ibm_rave_core_geom_Voronoi.DEFAULT_CLIPEXTENT;
  11204. this.fx = com_ibm_rave_core_svg_SVGLine.DEFAULT_X_FN;
  11205. this.fy = com_ibm_rave_core_svg_SVGLine.DEFAULT_Y_FN;
  11206. this.voronoieContext = new com_ibm_rave_core_internal_geom_voronoi_VoronoiContext();
  11207. this.xVal = this.fx;
  11208. this.yVal = this.fy;
  11209. },
  11210. sites : function(data) {
  11211. var self = this;
  11212. return data.map(function(d, i, array) {
  11213. var x = Math.round(+ (self.fx.call(this, d, i, -1)) / 1.0E-6) * 1.0E-6;
  11214. var y = Math.round(+ (self.fy.call(this, d, i, -1)) / 1.0E-6) * 1.0E-6;
  11215. var site = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(x, y);
  11216. site.i = i;
  11217. return site;
  11218. });
  11219. },
  11220. /**
  11221. * Returns the Delaunay triangulation of the specified data array as an array of links. Each link has the following attributes: <ul><li>source - the source node (an element in data).</li> <li>target - the target node (an element in data).</li></ul>
  11222. * @param (Array) data the data
  11223. * @return (Array) array of links
  11224. */
  11225. /** @expose */
  11226. links : function(data) {
  11227. var diagram = com_ibm_rave_core_internal_geom_voronoi_VoronoiIndex.voronoi(this.voronoieContext, this.sites(data), null);
  11228. var filtered = diagram.voronoiEdges.filter(function(edge, index, array) {
  11229. return edge.l && edge.r;
  11230. });
  11231. return filtered.map(function(currentValue, index, array) {
  11232. return new com_ibm_rave_core_geom_Voronoi.Edge(data[currentValue.l.i], data[currentValue.r.i]);
  11233. });
  11234. },
  11235. /**
  11236. * Returns the Delaunay triangulation of the specified data array as an array of triangles. Each triangle is a three-element array containing elements from data.
  11237. * @param (Array) data the data
  11238. * @return (Array) Array or Arrays of triangles
  11239. */
  11240. /** @expose */
  11241. triangles : function(data) {
  11242. var triangles = [];
  11243. var diagram = com_ibm_rave_core_internal_geom_voronoi_VoronoiIndex.voronoi(this.voronoieContext, this.sites(data), null);
  11244. var cells = diagram.voronoiCells;
  11245. cells.forEach(function(cell, i, array) {
  11246. var site = cell.site;
  11247. var edges = cell.edges.sort(com_ibm_rave_core_internal_geom_voronoi_VoronoiCell.voronoiHalfEdgeOrder);
  11248. var j = -1, m = edges.length;
  11249. var e0, e1 = edges[m - 1].edge;
  11250. var s0, s1 = e1.l == site ? e1.r : e1.l;
  11251. while (++j < m) {
  11252. e0 = e1;
  11253. s0 = s1;
  11254. e1 = edges[j].edge;
  11255. s1 = e1.l == site ? e1.r : e1.l;
  11256. if (i < s0.i && i < s1.i && com_ibm_rave_core_geom_Voronoi.voronoiTriangleArea(site, s0, s1) < 0) {
  11257. triangles.push([data[i], data[s0.i], data[s1.i]]);
  11258. }
  11259. }
  11260. return null;
  11261. });
  11262. return triangles;
  11263. },
  11264. /**
  11265. * Gets the current clip extent which defaults to null.
  11266. * @return (double[][]) the current clip extent
  11267. */
  11268. clipExtent$0 : function() {
  11269. if (this.clipExtentVal == com_ibm_rave_core_geom_Voronoi.DEFAULT_CLIPEXTENT) {
  11270. return null;
  11271. }
  11272. return this.clipExtentVal;
  11273. },
  11274. /**
  11275. * Sets the clip extent of the Voronoi layout to the specified bounds and returns the layout. The extent bounds are specified as an array [​[x0, y0], [x1, y1]​], where x0 is the left side of the extent, y0 is the top, x1 is the right and y1 is the bottom. If extent is null, no clipping is performed.
  11276. * @param (double[][]) extent the clip extent
  11277. * @return (com.ibm.rave.core.geom.Voronoi) this Voronoi instance
  11278. */
  11279. clipExtent$1 : function(extent) {
  11280. if (!extent) {
  11281. this.clipExtentVal = com_ibm_rave_core_geom_Voronoi.DEFAULT_CLIPEXTENT;
  11282. } else {
  11283. this.clipExtentVal = extent;
  11284. }
  11285. return this;
  11286. },
  11287. /**
  11288. * @deprecated use {@link this.Voronoi#this.clipExtent()} instead
  11289. * @return (double[]) the size
  11290. */
  11291. size$0 : function() {
  11292. if (this.clipExtentVal == com_ibm_rave_core_geom_Voronoi.DEFAULT_CLIPEXTENT) {
  11293. return null;
  11294. }
  11295. return this.clipExtentVal[1];
  11296. },
  11297. /**
  11298. * Sets the size
  11299. * @deprecated use {@link this.Voronoi#this.clipExtent()} instead
  11300. * @param (double[]) size
  11301. * @return (com.ibm.rave.core.geom.Voronoi) this Voronoi instance
  11302. */
  11303. size$1 : function(size) {
  11304. if ((size)) {
  11305. var newClipExtentVal = [[0, 0], size];
  11306. this.clipExtentVal = newClipExtentVal;
  11307. }
  11308. return this;
  11309. },
  11310. /**
  11311. * Returns the current x-coordinate accessor Can be a double value or a function
  11312. * @return (Object) the x-coordinate accessor
  11313. */
  11314. x$0 : function() {
  11315. return this.xVal;
  11316. },
  11317. /**
  11318. * Sets the x-coordinate accessor to the passed constant.
  11319. * @param (double) xVal the x constant
  11320. * @return (com.ibm.rave.core.geom.Voronoi) this Voronoi instance
  11321. */
  11322. x$1 : function(xVal) {
  11323. this.fx = function(data, index, groupIndex) {
  11324. return xVal;
  11325. };
  11326. this.xVal = xVal;
  11327. return this;
  11328. },
  11329. /**
  11330. * Sets the x-coordinate accessor to the passed function.
  11331. * @param (com.ibm.rave.core.selector.ValueFunction) xVal the x function
  11332. * @return (com.ibm.rave.core.geom.Voronoi) this Voronoi instance
  11333. */
  11334. x$2 : function(xVal) {
  11335. this.fx = xVal;
  11336. this.xVal = this.fx;
  11337. return this;
  11338. },
  11339. /**
  11340. * Returns the current y-coordinate accessor Can be a double value or a function
  11341. * @return (Object) the y-coordinate accessor
  11342. */
  11343. y$0 : function() {
  11344. return this.yVal;
  11345. },
  11346. /**
  11347. * Sets the y-coordinate accessor to the passed constant.
  11348. * @param (double) yVal the y constant
  11349. * @return (com.ibm.rave.core.geom.Voronoi) this Voronoi instance
  11350. */
  11351. y$1 : function(yVal) {
  11352. this.fy = function(data, index, groupIndex) {
  11353. return yVal;
  11354. };
  11355. this.yVal = yVal;
  11356. return this;
  11357. },
  11358. /**
  11359. * Sets the y-coordinate accessor to the passed function.
  11360. * @param (com.ibm.rave.core.selector.ValueFunction) yVal the y function
  11361. * @return (com.ibm.rave.core.geom.Voronoi) this Voronoi instance
  11362. */
  11363. y$2 : function(yVal) {
  11364. this.fy = yVal;
  11365. this.yVal = this.fy;
  11366. return this;
  11367. },
  11368. /** @expose */
  11369. clipExtent : function(a0) {
  11370. var args = arguments;
  11371. if (args.length == 0) {
  11372. return this.clipExtent$0();
  11373. }
  11374. return this.clipExtent$1(a0);
  11375. },
  11376. /** @expose */
  11377. size : function(a0) {
  11378. var args = arguments;
  11379. if (args.length == 0) {
  11380. return this.size$0();
  11381. }
  11382. return this.size$1(a0);
  11383. },
  11384. /** @expose */
  11385. x : function(a0) {
  11386. var args = arguments;
  11387. if (args.length == 0) {
  11388. return this.x$0();
  11389. }
  11390. if (args.length == 1 && typeof a0 === "function") {
  11391. return this.x$2(a0);
  11392. }
  11393. return this.x$1(a0);
  11394. },
  11395. /** @expose */
  11396. y : function(a0) {
  11397. var args = arguments;
  11398. if (args.length == 0) {
  11399. return this.y$0();
  11400. }
  11401. if (args.length == 1 && typeof a0 === "function") {
  11402. return this.y$2(a0);
  11403. }
  11404. return this.y$1(a0);
  11405. }
  11406. });
  11407. com_ibm_rave_core_geom_Voronoi.voronoiTriangleArea = function(a, b, c) {
  11408. return (a.x - c.x) * (b.y - a.y) - (a.x - b.x) * (c.y - a.y);
  11409. };
  11410. /**
  11411. * Class Represents a Link in the Voronoi geom link has the following attributes: <ul><li>source - the source node (an element in data).</li> <li>target - the target node (an element in data).</li></ul>
  11412. * @param < (java.lang.Object) T > the type of the source and target nodes
  11413. */
  11414. com_ibm_rave_core_geom_Voronoi.Edge = rave_externs["Edge"] = com_ibm_rave_core_nativeImpl_Declare({
  11415. /**
  11416. * the source
  11417. */
  11418. /** @expose */
  11419. source : null,
  11420. /**
  11421. * the target
  11422. */
  11423. /** @expose */
  11424. target : null,
  11425. /**
  11426. * Constructor
  11427. * @param (java.lang.Object) source the source
  11428. * @param (java.lang.Object) target the target
  11429. */
  11430. /** @expose */
  11431. constructor : function(source, target) {
  11432. this.source = source;
  11433. this.target = target;
  11434. }
  11435. });
  11436. com_ibm_rave_core_geom_Voronoi.DEFAULT_CLIPEXTENT = [[-1e6, -1e6], [1e6, 1e6]];
  11437. // $source: com/ibm/rave/core/svg/LinePathGenerator
  11438. /************************************************************************
  11439. ** IBM Confidential
  11440. **
  11441. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  11442. **
  11443. ** (C) Copyright IBM Corp. 2015
  11444. **
  11445. ** The source code for this program is not published or otherwise divested of its trade secrets,
  11446. ** irrespective of what has been deposited with the U.S. Copyright Office.
  11447. ************************************************************************/
  11448. // GENERATED
  11449. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  11450. //@import com/ibm/rave/core/svg/SVGLine (runtime) // SVGLine
  11451. /**
  11452. * SVG Line generator Line generator used to generate an SVG path representing the data passed to it, using different interpolation settings By changing the interpolation, you can also generate splines and step functions. Also, don't be afraid to tack on additional path commands at the end. For example, if you want to generate a closed path, append a closepath (Z)
  11453. */
  11454. var com_ibm_rave_core_svg_LinePathGenerator = rave_externs["LinePathGenerator"] = com_ibm_rave_core_nativeImpl_Declare({
  11455. //definedFn : null,
  11456. //interpolateFn : null,
  11457. //fx : null,
  11458. //fy : null,
  11459. //interpolateKey : null,
  11460. //projectionFn : null,
  11461. tensionVal : 0.7,
  11462. xVal : 0,
  11463. yVal : 0,
  11464. _$functionClassMethod : function() {
  11465. var _$self = /**
  11466. * Generates path data for an open piecewise linear curve, or polyline By changing the interpolation, you can also generate splines and step functions. Also, don't be afraid to tack on additional path commands at the end. For example, if you want to generate a closed path, append a closepath (Z) If the data param is empty, the returned string will be null
  11467. * @param (Object) this the context for this function
  11468. * @param (Array) data the data to use while building the path
  11469. * @return (String) string representing the SVG path
  11470. */
  11471. function(data) {
  11472. var segments = [];
  11473. var points = [];
  11474. var i = -1;
  11475. var n = 0;
  11476. var d;
  11477. n = data.length;
  11478. while (++i < n) {
  11479. d = data[i];
  11480. if (_$self.definedFn.call(_$self, d, i, -1)) {
  11481. points.push([+ (!_$self.fx ? _$self.xVal : _$self.fx.call(this, d, i, -1)), + (!_$self.fy ? _$self.yVal : _$self.fy.call(this, d, i, -1))]);
  11482. } else if (points.length != 0) {
  11483. segments.push("M", _$self.interpolateFn(_$self.projectionFn.call(this, points, -1, -1), _$self.tensionVal));
  11484. points = [];
  11485. }
  11486. }
  11487. if (points.length != 0) {
  11488. segments.push("M", _$self.interpolateFn(_$self.projectionFn.call(this, points, -1, -1), _$self.tensionVal));
  11489. }
  11490. return segments.length != 0 ? segments.join("") : null;
  11491. };
  11492. return _$self;
  11493. },
  11494. constructor : function(projection) {
  11495. this.definedFn = com_ibm_rave_core_svg_SVGLine.DEFAULT_DEFINED_FN;
  11496. this.interpolateFn = com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear;
  11497. this.fx = com_ibm_rave_core_svg_SVGLine.DEFAULT_X_FN;
  11498. this.fy = com_ibm_rave_core_svg_SVGLine.DEFAULT_Y_FN;
  11499. this.interpolateKey = this.interpolateFn.key;
  11500. /**
  11501. * Constructor, creates a line generator and sets the projection to use with it
  11502. * @param (com.ibm.rave.core.selector.ValueFunction) projection the projection to use for example {@link (com.ibm.rave.core.internal.util.Identity) Identity}
  11503. */
  11504. {
  11505. this.projectionFn = projection;
  11506. }
  11507. },
  11508. /**
  11509. * Gets the x-accessor, it can be a a function or constant.
  11510. * @return (Object) returns the x function or constant
  11511. */
  11512. x$0 : function() {
  11513. if (this.fx) {
  11514. return this.fx;
  11515. }
  11516. return this.xVal;
  11517. },
  11518. /**
  11519. * Sets the x-accessor to the specified function. This accessor is invoked for each element in the data array passed to the line generator. The default accessor assumes that each input element is a two-element array of numbers
  11520. * @param (com.ibm.rave.core.selector.ValueFunction) valFn the x-accessor
  11521. * @return (com.ibm.rave.core.svg.LinePathGenerator) the line path generator
  11522. */
  11523. x$1 : function(valFn) {
  11524. this.fx = valFn;
  11525. return this;
  11526. },
  11527. /**
  11528. * Sets the x-accessor to the constant.
  11529. * @param (double) xNewVal the constant value of x
  11530. * @return (com.ibm.rave.core.svg.LinePathGenerator) the line path generator
  11531. */
  11532. x$2 : function(xNewVal) {
  11533. this.fx = null;
  11534. this.xVal = xNewVal;
  11535. return this;
  11536. },
  11537. /**
  11538. * Gets the y-accessor, it can be a a function or constant.
  11539. * @return (Object) returns the yfunction or constant
  11540. */
  11541. y$0 : function() {
  11542. if (this.fy) {
  11543. return this.fy;
  11544. }
  11545. return this.yVal;
  11546. },
  11547. /**
  11548. * Sets the y-accessor to the specified function. This accessor is invoked for each element in the data array passed to the line generator. The default accessor assumes that each input element is a two-element array of numbers
  11549. * @param (com.ibm.rave.core.selector.ValueFunction) valFn the y-accessor
  11550. * @return (com.ibm.rave.core.svg.LinePathGenerator) the line path generator
  11551. */
  11552. y$1 : function(valFn) {
  11553. this.fy = valFn;
  11554. return this;
  11555. },
  11556. /**
  11557. * Sets the y-accessor to the constant.
  11558. * @param (double) yNewVal the constant value of y
  11559. * @return (com.ibm.rave.core.svg.LinePathGenerator) the line path generator
  11560. */
  11561. y$2 : function(yNewVal) {
  11562. this.fy = null;
  11563. this.yVal = yNewVal;
  11564. return this;
  11565. },
  11566. /**
  11567. * Gets the accessor function that controls where the line is defined. default defined is a function() { return true; }
  11568. * @return (com.ibm.rave.core.selector.ValueFunction) the defined function
  11569. */
  11570. defined$0 : function() {
  11571. return this.definedFn;
  11572. },
  11573. /**
  11574. * Sets the accessor function that controls where the line is defined. Sets the new accessor function and returns the line. The defined accessor can be used to define where the line is defined and undefined, which is typically useful in conjunction with missing data; the generated path data will automatically be broken into multiple distinct subpaths, skipping undefined data. For example, if you want to ignore y-values that are not a number (or undefined)
  11575. * @param (com.ibm.rave.core.selector.ValueFunction) valFn the function to use to decide if a point is defined
  11576. * @return (com.ibm.rave.core.svg.LinePathGenerator) this line path generator
  11577. */
  11578. defined$1 : function(valFn) {
  11579. this.definedFn = valFn;
  11580. return this;
  11581. },
  11582. /**
  11583. * Returns the current tension.
  11584. * @return (double) the tension
  11585. */
  11586. tension$0 : function() {
  11587. return this.tensionVal;
  11588. },
  11589. /**
  11590. * sets the Cardinal spline or bundle interpolation tension to the specified number in the range [0, 1]. The tension only affects the Cardinal interpolation modes: cardinal, cardinal-open and cardinal-closed and Bundle interpolation. The default tension is 0.7. In some sense, this can be interpreted as the length of the tangent; 1 will yield all zero tangents, and 0 yields a Catmull-Rom spline. Note that the tension must be specified as a constant, rather than a function, as it is constant for the entirety of the line. However, it is still possible to generate multiple lines with different tensions using the same generator.
  11591. * @return (com.ibm.rave.core.svg.LinePathGenerator) this line path generator
  11592. */
  11593. tension$1 : function(tensionNewVal) {
  11594. this.tensionVal = tensionNewVal;
  11595. return this;
  11596. },
  11597. /**
  11598. * Returns the current interpolation mode. This method will return a string if the current interpolator is not custom Supported Interpolation modes are: linear - piecewise linear segments, as in a polyline. linear-closed - close the linear segments to form a polygon. step - alternate between horizontal and vertical segments, as in a step function. step-before - alternate between vertical and horizontal segments, as in a step function. step-after - alternate between horizontal and vertical segments, as in a step function. basis - a B-spline, with control point duplication on the ends. basis-open - an open B-spline; may not intersect the start or end. basis-closed - a closed B-spline, as in a loop. bundle - equivalent to basis, except the tension parameter is used to straighten the spline. cardinal - a Cardinal spline, with control point duplication on the ends. cardinal-open - an open Cardinal spline; may not intersect the start or end, but will intersect other control points. cardinal-closed - a closed Cardinal spline, as in a loop. monotone - cubic interpolation that preserves monotonicity in y. The behavior of some of these interpolation modes may be further customized by specifying a tension.
  11599. * @return (Object) string represent the interpolation type or teh custominterpolation function
  11600. */
  11601. interpolate$0 : function() {
  11602. return this.interpolateKey;
  11603. },
  11604. /**
  11605. * Sets the interpolation mode to the specified string. The following named interpolation modes are supported: linear - piecewise linear segments, as in a polyline. linear-closed - close the linear segments to form a polygon. step - alternate between horizontal and vertical segments, as in a step function. step-before - alternate between vertical and horizontal segments, as in a step function. step-after - alternate between horizontal and vertical segments, as in a step function. basis - a B-spline, with control point duplication on the ends. basis-open - an open B-spline; may not intersect the start or end. basis-closed - a closed B-spline, as in a loop. bundle - equivalent to basis, except the tension parameter is used to straighten the spline. cardinal - a Cardinal spline, with control point duplication on the ends. cardinal-open - an open Cardinal spline; may not intersect the start or end, but will intersect other control points. cardinal-closed - a closed Cardinal spline, as in a loop. monotone - cubic interpolation that preserves monotonicity in y. The behavior of some of these interpolation modes may be further customized by specifying a tension.
  11606. * @param (String) key the interpolation mode to use
  11607. * @return (com.ibm.rave.core.svg.LinePathGenerator) the Line Path generator
  11608. */
  11609. interpolate$1 : function(key) {
  11610. this.interpolateKey = key;
  11611. this.interpolateFn = com_ibm_rave_core_svg_SVGLine.r2_svg_lineInterpolators.get(key);
  11612. if (!this.interpolateFn) {
  11613. this.interpolateFn = com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear;
  11614. this.interpolateKey = this.interpolateFn.key;
  11615. }
  11616. return this;
  11617. },
  11618. /**
  11619. * Sets the interpolation mode to the specified function. This function will be invoked to convert an array of points of the form [[x0, y0], [x1, y1]], returning an SVG path data string that will be used to display the line. The "M" at the start of the string is implied and should not be returned.
  11620. * @param (com.ibm.rave.core.svg.AbstractLineInterpolator) valFn the function to call to do the interpolation
  11621. * @return (com.ibm.rave.core.svg.LinePathGenerator) the Line Path generator
  11622. */
  11623. interpolate$2 : function(valFn) {
  11624. this.interpolateKey = this.interpolateFn = valFn;
  11625. return this;
  11626. },
  11627. /** @expose */
  11628. x : function(a0) {
  11629. var args = arguments;
  11630. if (args.length == 0) {
  11631. return this.x$0();
  11632. }
  11633. if (args.length == 1 && typeof a0 === "function") {
  11634. return this.x$1(a0);
  11635. }
  11636. return this.x$2(a0);
  11637. },
  11638. /** @expose */
  11639. y : function(a0) {
  11640. var args = arguments;
  11641. if (args.length == 0) {
  11642. return this.y$0();
  11643. }
  11644. if (args.length == 1 && typeof a0 === "function") {
  11645. return this.y$1(a0);
  11646. }
  11647. return this.y$2(a0);
  11648. },
  11649. /** @expose */
  11650. defined : function(a0) {
  11651. var args = arguments;
  11652. if (args.length == 0) {
  11653. return this.defined$0();
  11654. }
  11655. return this.defined$1(a0);
  11656. },
  11657. /** @expose */
  11658. tension : function(a0) {
  11659. var args = arguments;
  11660. if (args.length == 0) {
  11661. return this.tension$0();
  11662. }
  11663. return this.tension$1(a0);
  11664. },
  11665. /** @expose */
  11666. interpolate : function(a0) {
  11667. var args = arguments;
  11668. if (args.length == 0) {
  11669. return this.interpolate$0();
  11670. }
  11671. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  11672. return this.interpolate$1(a0);
  11673. }
  11674. return this.interpolate$2(a0);
  11675. }
  11676. });
  11677. // $source: com/ibm/rave/core/svg/AbstractLineInterpolator
  11678. /************************************************************************
  11679. ** IBM Confidential
  11680. **
  11681. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  11682. **
  11683. ** (C) Copyright IBM Corp. 2015
  11684. **
  11685. ** The source code for this program is not published or otherwise divested of its trade secrets,
  11686. ** irrespective of what has been deposited with the U.S. Copyright Office.
  11687. ************************************************************************/
  11688. // GENERATED
  11689. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  11690. /**
  11691. * Base class for all line interpolators
  11692. */
  11693. var com_ibm_rave_core_svg_AbstractLineInterpolator = rave_externs["AbstractLineInterpolator"] = com_ibm_rave_core_nativeImpl_Declare({
  11694. //reverse : null,
  11695. key : "",
  11696. closed : false,
  11697. /** @expose */
  11698. constructor : function(strKey, bClosed) {
  11699. this.key = strKey;
  11700. this.closed = bClosed;
  11701. },
  11702. /**
  11703. * The key of this interpolator
  11704. */
  11705. /** @expose */
  11706. getKey : function() {
  11707. return this.key;
  11708. },
  11709. /**
  11710. * Is this a closed interpolator or not
  11711. */
  11712. /** @expose */
  11713. isClosed : function() {
  11714. return this.closed;
  11715. },
  11716. /**
  11717. * Gets the reverse Interpolator for this Interpolator
  11718. * @return (com.ibm.rave.core.svg.AbstractLineInterpolator) the reverse interpolator, or NULL if none had been set
  11719. */
  11720. /** @expose */
  11721. getReverse : function() {
  11722. return this.reverse;
  11723. },
  11724. /**
  11725. * Sets the reverse Interpolator for this Interpolator
  11726. * @param (com.ibm.rave.core.svg.AbstractLineInterpolator) reverseIntepolator The reverse interpolator
  11727. */
  11728. /** @expose */
  11729. setReverse : function(reverseIntepolator) {
  11730. this.reverse = reverseIntepolator;
  11731. }
  11732. });
  11733. // $source: com/ibm/rave/core/internal/util/TrueFunction
  11734. /************************************************************************
  11735. ** IBM Confidential
  11736. **
  11737. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  11738. **
  11739. ** (C) Copyright IBM Corp. 2015
  11740. **
  11741. ** The source code for this program is not published or otherwise divested of its trade secrets,
  11742. ** irrespective of what has been deposited with the U.S. Copyright Office.
  11743. ************************************************************************/
  11744. // GENERATED
  11745. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  11746. /**
  11747. * Call back function that always return true
  11748. */
  11749. var com_ibm_rave_core_internal_util_TrueFunction = com_ibm_rave_core_nativeImpl_Declare({
  11750. _$functionClassMethod : function() {
  11751. var _$self = function(data, index, groupIndex) {
  11752. return true;
  11753. };
  11754. return _$self;
  11755. }
  11756. });
  11757. // $source: com/ibm/rave/core/svg/SVGLine
  11758. /************************************************************************
  11759. ** IBM Confidential
  11760. **
  11761. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  11762. **
  11763. ** (C) Copyright IBM Corp. 2015
  11764. **
  11765. ** The source code for this program is not published or otherwise divested of its trade secrets,
  11766. ** irrespective of what has been deposited with the U.S. Copyright Office.
  11767. ************************************************************************/
  11768. // GENERATED
  11769. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare anonymous, declare
  11770. //@import com/ibm/rave/core/svg/LinePathGenerator (static) // new
  11771. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (runtime) // create
  11772. //@import com/ibm/rave/core/internal/util/Identity (static) // create
  11773. //@import com/ibm/rave/core/svg/AbstractLineInterpolator (static)
  11774. //@import com/ibm/rave/core/internal/util/TrueFunction (static) // new
  11775. var com_ibm_rave_core_svg_SVGLine = rave_externs["SVGLine"] = com_ibm_rave_core_nativeImpl_Declare({
  11776. });
  11777. /**
  11778. * Factory method, that creates a Line path generator using the passed projection Constructs a new line generator with the default x- and y-accessor functions (that assume the input data is a two-element array of numbers), and linear interpolation. The returned function generates path data for an open piecewise linear curve, or polyline
  11779. * @param (com.ibm.rave.core.selector.ValueFunction) projection
  11780. * @return (com.ibm.rave.core.svg.LinePathGenerator) line path generator {@link (com.ibm.rave.core.svg.LinePathGenerator) LinePathGenerator}
  11781. */
  11782. com_ibm_rave_core_svg_SVGLine.createLine$0 = function(projection) {
  11783. return new com_ibm_rave_core_svg_LinePathGenerator(projection);
  11784. };
  11785. /**
  11786. * Factory method, that creates a Line path generator using default projection (identity) Constructs a new line generator with the default x- and y-accessor functions (that assume the input data is a two-element array of numbers), and linear interpolation. The returned function generates path data for an open piecewise linear curve, or polyline
  11787. * @return (com.ibm.rave.core.svg.LinePathGenerator) line path generator {@link (com.ibm.rave.core.svg.LinePathGenerator) LinePathGenerator}
  11788. */
  11789. com_ibm_rave_core_svg_SVGLine.createLine$1 = function() {
  11790. return new com_ibm_rave_core_svg_LinePathGenerator(com_ibm_rave_core_svg_SVGLine.DEFAULT_PROJECTION);
  11791. };
  11792. com_ibm_rave_core_svg_SVGLine.r2_svg_lineHermite = function(points, tangents) {
  11793. if (tangents.length < 1 || (points.length != tangents.length && points.length != tangents.length + 2)) {
  11794. return com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear(points, 0);
  11795. }
  11796. var quad = points.length != tangents.length;
  11797. var path = "";
  11798. var p0 = points[0], p = points[1], t0 = tangents[0], t = t0;
  11799. var pi = 1;
  11800. if (quad) {
  11801. path+=("Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1]);
  11802. p0 = points[1];
  11803. pi = 2;
  11804. }
  11805. if (tangents.length > 1) {
  11806. t = tangents[1];
  11807. p = points[pi];
  11808. pi++;
  11809. path+=("C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]);
  11810. for (var i = 2; i < tangents.length; i++, pi++) {
  11811. p = points[pi];
  11812. t = tangents[i];
  11813. path+=("S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]);
  11814. }
  11815. }
  11816. if (quad) {
  11817. var lp = points[pi];
  11818. path+=("Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1]);
  11819. }
  11820. return path;
  11821. };
  11822. com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinalTangents = function(points, tension) {
  11823. var tangents = [];
  11824. var a = (1 - tension) / 2;
  11825. var p0, p1 = points[0], p2 = points[1];
  11826. var i = 1;
  11827. var n = points.length;
  11828. while (++i < n) {
  11829. p0 = p1;
  11830. p1 = p2;
  11831. p2 = points[i];
  11832. tangents.push([a * (p2[0] - p0[0]), a * (p2[1] - p0[1])]);
  11833. }
  11834. return tangents;
  11835. };
  11836. com_ibm_rave_core_svg_SVGLine.r2_svg_lineDot4 = function(a, b) {
  11837. return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
  11838. };
  11839. com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier = function(path, x, y) {
  11840. path.push("C", com_ibm_rave_core_svg_SVGLine.r2_svg_lineDot4(com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier1, x), ",", com_ibm_rave_core_svg_SVGLine.r2_svg_lineDot4(com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier1, y), ",", com_ibm_rave_core_svg_SVGLine.r2_svg_lineDot4(com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier2, x), ",", com_ibm_rave_core_svg_SVGLine.r2_svg_lineDot4(com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier2, y), ",", com_ibm_rave_core_svg_SVGLine.r2_svg_lineDot4(com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier3, x), ",", com_ibm_rave_core_svg_SVGLine.r2_svg_lineDot4(com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier3, y));
  11841. };
  11842. com_ibm_rave_core_svg_SVGLine.r2_svg_lineSlope = function(p0, p1) {
  11843. return (p1[1] - p0[1]) / (p1[0] - p0[0]);
  11844. };
  11845. com_ibm_rave_core_svg_SVGLine.r2_svg_lineFiniteDifferences = function(points) {
  11846. var i = 0, j = points.length - 1;
  11847. var m = [];
  11848. var p0 = points[0], p1 = points[1];
  11849. var d = com_ibm_rave_core_svg_SVGLine.r2_svg_lineSlope(p0, p1);
  11850. m.push(d);
  11851. while (++i < j) {
  11852. m.push((d + (d = com_ibm_rave_core_svg_SVGLine.r2_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2);
  11853. }
  11854. m.push(d);
  11855. return m;
  11856. };
  11857. com_ibm_rave_core_svg_SVGLine.r2_svg_lineMonotoneTangents = function(points) {
  11858. var tangents = [];
  11859. var d, a, b, s;
  11860. var m = com_ibm_rave_core_svg_SVGLine.r2_svg_lineFiniteDifferences(points);
  11861. var i = -1, j = points.length - 1;
  11862. while (++i < j) {
  11863. d = com_ibm_rave_core_svg_SVGLine.r2_svg_lineSlope(points[i], points[i + 1]);
  11864. if (Math.abs(d) < 1.0E-6) {
  11865. m[i] = 0;
  11866. m[i + 1] = 0;
  11867. } else {
  11868. a = m[i] / d;
  11869. b = m[i + 1] / d;
  11870. s = a * a + b * b;
  11871. if (s > 9) {
  11872. s = d * 3 / Math.sqrt(s);
  11873. m[i] = s * a;
  11874. m[i + 1] = s * b;
  11875. }
  11876. }
  11877. }
  11878. i = -1;
  11879. while (++i <= j) {
  11880. s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i]));
  11881. if (s != s) {
  11882. s = 0;
  11883. }
  11884. tangents.push([s, m[i] * s]);
  11885. }
  11886. return tangents;
  11887. };
  11888. com_ibm_rave_core_svg_SVGLine.initialize_r2_svg_lineInterpolators = function() {
  11889. var r2_svg_lineInterpolators = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  11890. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear);
  11891. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinearClosed.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinearClosed);
  11892. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineStep.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineStep);
  11893. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineStepBefore.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineStepBefore);
  11894. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineStepAfter.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineStepAfter);
  11895. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasis.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasis);
  11896. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisOpen.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisOpen);
  11897. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisClosed.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisClosed);
  11898. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineBundle.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineBundle);
  11899. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinal.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinal);
  11900. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinalOpen.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinalOpen);
  11901. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinalClosed.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinalClosed);
  11902. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineMonotone.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineMonotone);
  11903. com_ibm_rave_core_svg_SVGLine.r2_svg_lineStepBefore.reverse = com_ibm_rave_core_svg_SVGLine.r2_svg_lineStepAfter;
  11904. com_ibm_rave_core_svg_SVGLine.r2_svg_lineStepAfter.reverse = com_ibm_rave_core_svg_SVGLine.r2_svg_lineStepBefore;
  11905. return r2_svg_lineInterpolators;
  11906. };
  11907. /** @expose */
  11908. com_ibm_rave_core_svg_SVGLine.createLine = function(a0) {
  11909. var args = arguments;
  11910. if (args.length == 0) {
  11911. return com_ibm_rave_core_svg_SVGLine.createLine$1();
  11912. }
  11913. return com_ibm_rave_core_svg_SVGLine.createLine$0(a0);
  11914. };
  11915. /** @expose */
  11916. com_ibm_rave_core_svg_SVGLine.DEFAULT_X_FN = function(data, index, groupIndex) {
  11917. return (data)[0];
  11918. };
  11919. /** @expose */
  11920. com_ibm_rave_core_svg_SVGLine.DEFAULT_Y_FN = function(data, index, groupIndex) {
  11921. return (data)[1];
  11922. };
  11923. com_ibm_rave_core_svg_SVGLine.DEFAULT_PROJECTION = com_ibm_rave_core_internal_util_Identity.create();
  11924. com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier1 = [0, 2 / 3, 1 / 3, 0];
  11925. com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier2 = [0, 1 / 3, 2 / 3, 0];
  11926. com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier3 = [0, 1 / 6, 2 / 3, 1 / 6];
  11927. com_ibm_rave_core_svg_SVGLine.r2_svg_lineStep = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  11928. _$functionClassMethod : function() {
  11929. var _$self = function(points, tension) {
  11930. var i = 0, n = points.length;
  11931. var p = points[0];
  11932. var path = [p[0], ",", p[1]];
  11933. while (++i < n) {
  11934. path.push("H", (p[0] + (p = points[i])[0]) / 2, "V", p[1]);
  11935. }
  11936. if (n > 1) {
  11937. path.push("H", p[0]);
  11938. }
  11939. return path.join("");
  11940. };
  11941. return _$self;
  11942. }
  11943. }))("step", false);
  11944. com_ibm_rave_core_svg_SVGLine.r2_svg_lineStepBefore = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  11945. _$functionClassMethod : function() {
  11946. var _$self = function(points, tension) {
  11947. var i = 0, n = points.length;
  11948. var p = points[0];
  11949. var path = [p[0], ",", p[1]];
  11950. while (++i < n) {
  11951. path.push("V", (p = points[i])[1], "H", p[0]);
  11952. }
  11953. return path.join("");
  11954. };
  11955. return _$self;
  11956. }
  11957. }))("step-before", false);
  11958. com_ibm_rave_core_svg_SVGLine.r2_svg_lineStepAfter = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  11959. _$functionClassMethod : function() {
  11960. var _$self = function(points, tension) {
  11961. var i = 0, n = points.length;
  11962. var p = points[0];
  11963. var path = [p[0], ",", p[1]];
  11964. while (++i < n) {
  11965. path.push("H", (p = points[i])[0], "V", p[1]);
  11966. }
  11967. return path.join("");
  11968. };
  11969. return _$self;
  11970. }
  11971. }))("step-after", false);
  11972. com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinalOpen = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  11973. _$functionClassMethod : function() {
  11974. var _$self = function(points, tension) {
  11975. return points.length < 4 ? com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear(points, tension) : points[1] + com_ibm_rave_core_svg_SVGLine.r2_svg_lineHermite(points.slice(1, -1), com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinalTangents(points, tension));
  11976. };
  11977. return _$self;
  11978. }
  11979. }))("cardinal-open", false);
  11980. com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinalClosed = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  11981. _$functionClassMethod : function() {
  11982. var _$self = function(points, tension) {
  11983. if (points.length < 3) {
  11984. return com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear(points, tension);
  11985. }
  11986. var p1 = points[0];
  11987. points.push(p1);
  11988. var p2 = [points[points.length - 2]];
  11989. p2 = p2.concat(points, [points[1]]);
  11990. var tangents = com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinalTangents(p2, tension);
  11991. return p1 + com_ibm_rave_core_svg_SVGLine.r2_svg_lineHermite(points, tangents);
  11992. };
  11993. return _$self;
  11994. }
  11995. }))("cardinal-closed", true);
  11996. com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinal = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  11997. _$functionClassMethod : function() {
  11998. var _$self = function(points, tension) {
  11999. return points.length < 3 ? com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear(points, tension) : points[0] + com_ibm_rave_core_svg_SVGLine.r2_svg_lineHermite(points, com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinalTangents(points, tension));
  12000. };
  12001. return _$self;
  12002. }
  12003. }))("cardinal", false);
  12004. com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasis = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  12005. _$functionClassMethod : function() {
  12006. var _$self = function(points, tension) {
  12007. if (points.length < 3) {
  12008. return com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear(points, tension);
  12009. }
  12010. var i = 1, n = points.length;
  12011. var pi = points[0];
  12012. var x0 = pi[0], y0 = pi[1];
  12013. var px = [x0, x0, x0, (pi = points[1])[0]];
  12014. var py = [y0, y0, y0, pi[1]];
  12015. var path = [x0, ",", y0, "L", com_ibm_rave_core_svg_SVGLine.r2_svg_lineDot4(com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier3, px), ",", com_ibm_rave_core_svg_SVGLine.r2_svg_lineDot4(com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier3, py)];
  12016. points.push(points[n - 1]);
  12017. while (++i <= n) {
  12018. pi = points[i];
  12019. px.shift();
  12020. px.push(pi[0]);
  12021. py.shift();
  12022. py.push(pi[1]);
  12023. com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier(path, px, py);
  12024. }
  12025. points.pop();
  12026. path.push("L", pi);
  12027. return path.join("");
  12028. };
  12029. return _$self;
  12030. }
  12031. }))("basis", false);
  12032. com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisOpen = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  12033. _$functionClassMethod : function() {
  12034. var _$self = function(points, tension) {
  12035. if (points.length < 4) {
  12036. return com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear(points, 0);
  12037. }
  12038. var path = [];
  12039. var i = -1, n = points.length;
  12040. var pi;
  12041. var px = [0], py = [0];
  12042. while (++i < 3) {
  12043. pi = points[i];
  12044. px.push(pi[0]);
  12045. py.push(pi[1]);
  12046. }
  12047. path.push(com_ibm_rave_core_svg_SVGLine.r2_svg_lineDot4(com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier3, px) + "," + com_ibm_rave_core_svg_SVGLine.r2_svg_lineDot4(com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier3, py));
  12048. --i;
  12049. while (++i < n) {
  12050. pi = points[i];
  12051. px.shift();
  12052. px.push(pi[0]);
  12053. py.shift();
  12054. py.push(pi[1]);
  12055. com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier(path, px, py);
  12056. }
  12057. return path.join("");
  12058. };
  12059. return _$self;
  12060. }
  12061. }))("basis-open", false);
  12062. com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisClosed = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  12063. _$functionClassMethod : function() {
  12064. var _$self = function(points, tension) {
  12065. if (points.length < 4) {
  12066. return com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear(points, 0);
  12067. }
  12068. var i = -1, n = points.length, m = n + 4;
  12069. var pi;
  12070. var px = [], py = [];
  12071. while (++i < 4) {
  12072. pi = points[i % n];
  12073. px.push(pi[0]);
  12074. py.push(pi[1]);
  12075. }
  12076. var path = [com_ibm_rave_core_svg_SVGLine.r2_svg_lineDot4(com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier3, px), ",", com_ibm_rave_core_svg_SVGLine.r2_svg_lineDot4(com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier3, py)];
  12077. --i;
  12078. while (++i < m) {
  12079. pi = points[i % n];
  12080. px.shift();
  12081. px.push(pi[0]);
  12082. py.shift();
  12083. py.push(pi[1]);
  12084. com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier(path, px, py);
  12085. }
  12086. return path.join("");
  12087. };
  12088. return _$self;
  12089. }
  12090. }))("basis-closed", true);
  12091. com_ibm_rave_core_svg_SVGLine.r2_svg_lineBundle = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  12092. _$functionClassMethod : function() {
  12093. var _$self = function(points, tension) {
  12094. var n = points.length - 1;
  12095. if (n != 0) {
  12096. var p = points[0];
  12097. var x0 = p[0], y0 = p[1];
  12098. p = points[n];
  12099. var dx = p[0] - x0, dy = p[1] - y0;
  12100. var i = -1;
  12101. var t;
  12102. while (++i <= n) {
  12103. p = points[i];
  12104. t = i / n;
  12105. p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);
  12106. p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);
  12107. }
  12108. }
  12109. return com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasis(points, 0);
  12110. };
  12111. return _$self;
  12112. }
  12113. }))("bundle", false);
  12114. /**
  12115. * Linear interpolation; generates "L" commands.
  12116. */
  12117. /** @expose */
  12118. com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  12119. _$functionClassMethod : function() {
  12120. var _$self = function(data, tension) {
  12121. return data.join("L");
  12122. };
  12123. return _$self;
  12124. }
  12125. }))("linear", false);
  12126. /**
  12127. * Closed Linear interpolation; generates "L" commands then close it with a "Z" command.
  12128. */
  12129. /** @expose */
  12130. com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinearClosed = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  12131. _$functionClassMethod : function() {
  12132. var _$self = function(data, tension) {
  12133. return com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear(data, tension) + "Z";
  12134. };
  12135. return _$self;
  12136. }
  12137. }))("linear-closed", true);
  12138. com_ibm_rave_core_svg_SVGLine.r2_svg_lineMonotone = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  12139. _$functionClassMethod : function() {
  12140. var _$self = function(points, tension) {
  12141. return points.length < 3 ? com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear(points, tension) : points[0] + com_ibm_rave_core_svg_SVGLine.r2_svg_lineHermite(points, com_ibm_rave_core_svg_SVGLine.r2_svg_lineMonotoneTangents(points));
  12142. };
  12143. return _$self;
  12144. }
  12145. }))("monotone", false);
  12146. com_ibm_rave_core_svg_SVGLine.r2_svg_lineInterpolators = com_ibm_rave_core_svg_SVGLine.initialize_r2_svg_lineInterpolators();
  12147. com_ibm_rave_core_svg_SVGLine.DEFAULT_DEFINED_FN = new com_ibm_rave_core_internal_util_TrueFunction();
  12148. // $source: com/ibm/rave/core/internal/geom/voronoi/VoronoiContext
  12149. /************************************************************************
  12150. ** IBM Confidential
  12151. **
  12152. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  12153. **
  12154. ** (C) Copyright IBM Corp. 2015
  12155. **
  12156. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12157. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12158. ************************************************************************/
  12159. // GENERATED
  12160. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  12161. var com_ibm_rave_core_internal_geom_voronoi_VoronoiContext = com_ibm_rave_core_nativeImpl_Declare({
  12162. //voronoiEdges : null,
  12163. //voronoiCells : null,
  12164. //voronoiBeaches : null,
  12165. //voronoiBeachPool : null,
  12166. //voronoiFirstCircle : null,
  12167. //voronoiCircles : null,
  12168. //voronoiCirclePool : null,
  12169. constructor : function() {
  12170. this.voronoiBeachPool = [];
  12171. this.voronoiCirclePool = [];
  12172. }
  12173. });
  12174. // $source: com/ibm/rave/core/geom/Line
  12175. /************************************************************************
  12176. ** IBM Confidential
  12177. **
  12178. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  12179. **
  12180. ** (C) Copyright IBM Corp. 2015
  12181. **
  12182. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12183. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12184. ************************************************************************/
  12185. // GENERATED
  12186. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  12187. /**
  12188. * A class representing a lint extending form point a to point b
  12189. */
  12190. var com_ibm_rave_core_geom_Line = rave_externs["Line"] = com_ibm_rave_core_nativeImpl_Declare({
  12191. //a : null,
  12192. //b : null,
  12193. /**
  12194. * @param (com.ibm.rave.core.geom.PointStruct) a point a
  12195. * @param (com.ibm.rave.core.geom.PointStruct) b point b
  12196. */
  12197. /** @expose */
  12198. constructor : function(a, b) {
  12199. this.a = a;
  12200. this.b = b;
  12201. },
  12202. /**
  12203. * A getter for point a
  12204. * @return (com.ibm.rave.core.geom.PointStruct) the a point
  12205. */
  12206. /** @expose */
  12207. getA : function() {
  12208. return this.a;
  12209. },
  12210. /**
  12211. * A setter for point a
  12212. * @param (com.ibm.rave.core.geom.PointStruct) a the a point to set
  12213. */
  12214. /** @expose */
  12215. setA : function(a) {
  12216. this.a = a;
  12217. },
  12218. /**
  12219. * A getter for point b
  12220. * @return (com.ibm.rave.core.geom.PointStruct) the b point
  12221. */
  12222. /** @expose */
  12223. getB : function() {
  12224. return this.b;
  12225. },
  12226. /**
  12227. * A setter for point b
  12228. * @param (com.ibm.rave.core.geom.PointStruct) b the b to set
  12229. */
  12230. /** @expose */
  12231. setB : function(b) {
  12232. this.b = b;
  12233. }
  12234. });
  12235. // $source: com/ibm/rave/core/internal/geom/voronoi/VoronoiEdge
  12236. /************************************************************************
  12237. ** IBM Confidential
  12238. **
  12239. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  12240. **
  12241. ** (C) Copyright IBM Corp. 2015
  12242. **
  12243. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12244. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12245. ************************************************************************/
  12246. // GENERATED
  12247. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  12248. //@import com/ibm/rave/core/geom/Line (loadtime) // superclass
  12249. //@import com/ibm/rave/core/geom/PointStruct (loadtime) // superclass
  12250. /**
  12251. * IBM Confidential OCO Source Materials IBM Business Analytics: Rapidly Adaptive Visualization Engine (C) Copyright IBM Corp. 2014, 2015 The source code for this program is not published or otherwise divested of its trade secrets, irrespective of what has been deposited with the U.S. Copyright Office.
  12252. */
  12253. var com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_geom_Line, {
  12254. //l : null,
  12255. //r : null,
  12256. constructor : function(lSite, rSite) {
  12257. this.l = lSite;
  12258. this.r = rSite;
  12259. this.a = null;
  12260. this.b = null;
  12261. }
  12262. });
  12263. com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiCreateEdge = function(context, lSite, rSite, va, vb) {
  12264. var edge = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge(lSite, rSite);
  12265. context.voronoiEdges.push(edge);
  12266. if ((va)) {
  12267. com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiSetEdgeEnd(edge, lSite, rSite, va);
  12268. }
  12269. if ((vb)) {
  12270. com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiSetEdgeEnd(edge, rSite, lSite, vb);
  12271. }
  12272. context.voronoiCells[lSite.i].edges.push(new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiHalfEdge(edge, lSite, rSite));
  12273. context.voronoiCells[rSite.i].edges.push(new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiHalfEdge(edge, rSite, lSite));
  12274. return edge;
  12275. };
  12276. com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiSetEdgeEnd = function(edge, lSite, rSite, vertex) {
  12277. if (!edge.a && !edge.b) {
  12278. edge.a = vertex;
  12279. edge.l = lSite;
  12280. edge.r = rSite;
  12281. } else if (edge.l == rSite) {
  12282. edge.b = vertex;
  12283. } else {
  12284. edge.a = vertex;
  12285. }
  12286. };
  12287. com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiCreateBorderEdge = function(context, lSite, va, vb) {
  12288. var edge = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge(lSite, null);
  12289. edge.a = va;
  12290. edge.b = vb;
  12291. context.voronoiEdges.push(edge);
  12292. return edge;
  12293. };
  12294. com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_geom_PointStruct, {
  12295. i : 0
  12296. //constructor : function(x, y) {}
  12297. });
  12298. com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiHalfEdge = com_ibm_rave_core_nativeImpl_Declare({
  12299. //edge : null,
  12300. //site : null,
  12301. angle : 0,
  12302. constructor : function(edge, lSite, rSite) {
  12303. var va = edge.a, vb = edge.b;
  12304. this.edge = edge;
  12305. this.site = lSite;
  12306. this.angle = rSite ? Math.atan2(rSite.y - lSite.y, rSite.x - lSite.x) : edge.l == lSite ? Math.atan2(vb.x - va.x, va.y - vb.y) : Math.atan2(va.x - vb.x, vb.y - va.y);
  12307. },
  12308. start : function() {
  12309. return this.edge.l == this.site ? this.edge.a : this.edge.b;
  12310. },
  12311. end : function() {
  12312. return this.edge.l == this.site ? this.edge.b : this.edge.a;
  12313. }
  12314. });
  12315. // $source: com/ibm/rave/core/internal/geom/voronoi/VoronoiRedBlackTree
  12316. /************************************************************************
  12317. ** IBM Confidential
  12318. **
  12319. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  12320. **
  12321. ** (C) Copyright IBM Corp. 2015
  12322. **
  12323. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12324. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12325. ************************************************************************/
  12326. // GENERATED
  12327. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  12328. var com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree = com_ibm_rave_core_nativeImpl_Declare({
  12329. //root : null,
  12330. insert : function(after, node) {
  12331. var parent, grandpa, uncle;
  12332. if (after) {
  12333. node.P = after;
  12334. node.N = after.N;
  12335. if (after.N) {
  12336. after.N.P = node;
  12337. }
  12338. after.N = node;
  12339. if (after.R) {
  12340. after = after.R;
  12341. while (after.L) {
  12342. after = after.L;
  12343. }
  12344. after.L = node;
  12345. } else {
  12346. after.R = node;
  12347. }
  12348. parent = after;
  12349. } else if (this.root) {
  12350. after = com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackFirst(this.root);
  12351. node.P = null;
  12352. node.N = after;
  12353. after.P = after.L = node;
  12354. parent = after;
  12355. } else {
  12356. node.P = node.N = null;
  12357. this.root = node;
  12358. parent = null;
  12359. }
  12360. node.L = node.R = null;
  12361. node.U = parent;
  12362. node.C = true;
  12363. after = node;
  12364. while (parent && parent.C) {
  12365. grandpa = parent.U;
  12366. if (parent == grandpa.L) {
  12367. uncle = grandpa.R;
  12368. if (uncle && uncle.C) {
  12369. parent.C = uncle.C = false;
  12370. grandpa.C = true;
  12371. after = grandpa;
  12372. } else {
  12373. if (after == parent.R) {
  12374. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateLeft(this, parent);
  12375. after = parent;
  12376. parent = after.U;
  12377. }
  12378. parent.C = false;
  12379. grandpa.C = true;
  12380. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateRight(this, grandpa);
  12381. }
  12382. } else {
  12383. uncle = grandpa.L;
  12384. if (uncle && uncle.C) {
  12385. parent.C = uncle.C = false;
  12386. grandpa.C = true;
  12387. after = grandpa;
  12388. } else {
  12389. if (after == parent.L) {
  12390. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateRight(this, parent);
  12391. after = parent;
  12392. parent = after.U;
  12393. }
  12394. parent.C = false;
  12395. grandpa.C = true;
  12396. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateLeft(this, grandpa);
  12397. }
  12398. }
  12399. parent = after.U;
  12400. }
  12401. this.root.C = false;
  12402. },
  12403. remove : function(node) {
  12404. if (node.N) {
  12405. node.N.P = node.P;
  12406. }
  12407. if (node.P) {
  12408. node.P.N = node.N;
  12409. }
  12410. node.N = node.P = null;
  12411. var parent = node.U, sibling, left = node.L, right = node.R, next;
  12412. var red;
  12413. if (!left) {
  12414. next = right;
  12415. } else if (!right) {
  12416. next = left;
  12417. } else {
  12418. next = com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackFirst(right);
  12419. }
  12420. if (parent) {
  12421. if (parent.L == node) {
  12422. parent.L = next;
  12423. } else {
  12424. parent.R = next;
  12425. }
  12426. } else {
  12427. this.root = next;
  12428. }
  12429. if (left && right) {
  12430. red = next.C;
  12431. next.C = node.C;
  12432. next.L = left;
  12433. left.U = next;
  12434. if (next != right) {
  12435. parent = next.U;
  12436. next.U = node.U;
  12437. node = next.R;
  12438. parent.L = node;
  12439. next.R = right;
  12440. right.U = next;
  12441. } else {
  12442. next.U = parent;
  12443. parent = next;
  12444. node = next.R;
  12445. }
  12446. } else {
  12447. red = node.C;
  12448. node = next;
  12449. }
  12450. if (node) {
  12451. node.U = parent;
  12452. }
  12453. if (red) {
  12454. return;
  12455. }
  12456. if (node && node.C) {
  12457. node.C = false;
  12458. return;
  12459. }
  12460. do {
  12461. if (node == this.root) {
  12462. break;
  12463. }
  12464. if (node == parent.L) {
  12465. sibling = parent.R;
  12466. if (sibling.C) {
  12467. sibling.C = false;
  12468. parent.C = true;
  12469. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateLeft(this, parent);
  12470. sibling = parent.R;
  12471. }
  12472. if ((sibling.L && sibling.L.C) || (sibling.R && sibling.R.C)) {
  12473. if (!sibling.R || !sibling.R.C) {
  12474. sibling.L.C = false;
  12475. sibling.C = true;
  12476. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateRight(this, sibling);
  12477. sibling = parent.R;
  12478. }
  12479. sibling.C = parent.C;
  12480. parent.C = sibling.R.C = false;
  12481. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateLeft(this, parent);
  12482. node = this.root;
  12483. break;
  12484. }
  12485. } else {
  12486. sibling = parent.L;
  12487. if (sibling.C) {
  12488. sibling.C = false;
  12489. parent.C = true;
  12490. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateRight(this, parent);
  12491. sibling = parent.L;
  12492. }
  12493. if ((sibling.L && sibling.L.C) || (sibling.R && sibling.R.C)) {
  12494. if (!sibling.L || !sibling.L.C) {
  12495. sibling.R.C = false;
  12496. sibling.C = true;
  12497. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateLeft(this, sibling);
  12498. sibling = parent.L;
  12499. }
  12500. sibling.C = parent.C;
  12501. parent.C = sibling.L.C = false;
  12502. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateRight(this, parent);
  12503. node = this.root;
  12504. break;
  12505. }
  12506. }
  12507. sibling.C = true;
  12508. node = parent;
  12509. parent = parent.U;
  12510. } while (!node.C);
  12511. if (node) {
  12512. node.C = false;
  12513. }
  12514. }
  12515. });
  12516. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackNode = function(node) {
  12517. node.U = null;
  12518. node.C = false;
  12519. node.L = null;
  12520. node.R = null;
  12521. node.P = null;
  12522. node.N = null;
  12523. };
  12524. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateLeft = function(tree, node) {
  12525. var p = node, q = node.R, parent = p.U;
  12526. if (parent) {
  12527. if (parent.L == p) {
  12528. parent.L = q;
  12529. } else {
  12530. parent.R = q;
  12531. }
  12532. } else {
  12533. tree.root = q;
  12534. }
  12535. q.U = parent;
  12536. p.U = q;
  12537. p.R = q.L;
  12538. if (p.R) {
  12539. p.R.U = p;
  12540. }
  12541. q.L = p;
  12542. };
  12543. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateRight = function(tree, node) {
  12544. var p = node, q = node.L, parent = p.U;
  12545. if (parent) {
  12546. if (parent.L == p) {
  12547. parent.L = q;
  12548. } else {
  12549. parent.R = q;
  12550. }
  12551. } else {
  12552. tree.root = q;
  12553. }
  12554. q.U = parent;
  12555. p.U = q;
  12556. p.L = q.R;
  12557. if (p.L) {
  12558. p.L.U = p;
  12559. }
  12560. q.R = p;
  12561. };
  12562. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackFirst = function(node) {
  12563. var retVal = node;
  12564. while (retVal.L) {
  12565. retVal = retVal.L;
  12566. }
  12567. return retVal;
  12568. };
  12569. // $source: com/ibm/rave/core/internal/geom/voronoi/VoronoiCell
  12570. /************************************************************************
  12571. ** IBM Confidential
  12572. **
  12573. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  12574. **
  12575. ** (C) Copyright IBM Corp. 2015
  12576. **
  12577. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12578. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12579. ************************************************************************/
  12580. // GENERATED
  12581. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  12582. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiEdge (static) // new, voronoiCreateBorderEdge
  12583. var com_ibm_rave_core_internal_geom_voronoi_VoronoiCell = com_ibm_rave_core_nativeImpl_Declare({
  12584. //site : null,
  12585. //edges : null,
  12586. constructor : function(site) {
  12587. this.site = site;
  12588. this.edges = [];
  12589. },
  12590. prepare : function() {
  12591. var halfEdges = this.edges;
  12592. var iHalfEdge = halfEdges.length;
  12593. var edge;
  12594. while (iHalfEdge-- > 0) {
  12595. edge = halfEdges[iHalfEdge].edge;
  12596. if (!edge.b || !edge.a) {
  12597. halfEdges.splice(iHalfEdge, 1);
  12598. }
  12599. }
  12600. halfEdges.sort(com_ibm_rave_core_internal_geom_voronoi_VoronoiCell.voronoiHalfEdgeOrder);
  12601. return halfEdges.length;
  12602. }
  12603. });
  12604. com_ibm_rave_core_internal_geom_voronoi_VoronoiCell.voronoiCloseCells = function(context, extent) {
  12605. var x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1], x2, y2, x3, y3;
  12606. var cells = context.voronoiCells;
  12607. var iCell = cells.length;
  12608. var cell;
  12609. var iHalfEdge;
  12610. var halfEdges;
  12611. var nHalfEdges;
  12612. var start;
  12613. var end;
  12614. while (iCell-- > 0) {
  12615. cell = cells[iCell];
  12616. if (!((cell)) || !((cell.prepare()))) {
  12617. continue;
  12618. }
  12619. halfEdges = cell.edges;
  12620. nHalfEdges = halfEdges.length;
  12621. iHalfEdge = 0;
  12622. while (iHalfEdge < nHalfEdges) {
  12623. end = halfEdges[iHalfEdge].end();
  12624. x3 = end.x;
  12625. y3 = end.y;
  12626. start = halfEdges[++iHalfEdge % nHalfEdges].start();
  12627. x2 = start.x;
  12628. y2 = start.y;
  12629. if (Math.abs(x3 - x2) > 1.0E-6 || Math.abs(y3 - y2) > 1.0E-6) {
  12630. halfEdges.splice(iHalfEdge, 0, new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiHalfEdge(com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiCreateBorderEdge(context, cell.site, end, Math.abs(x3 - x0) < 1.0E-6 && y1 - y3 > 1.0E-6 ? new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(x0, Math.abs(x2 - x0) < 1.0E-6 ? y2 : y1) : Math.abs(y3 - y1) < 1.0E-6 && x1 - x3 > 1.0E-6 ? new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(Math.abs(y2 - y1) < 1.0E-6 ? x2 : x1, y1) : Math.abs(x3 - x1) < 1.0E-6 && y3 - y0 > 1.0E-6 ? new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(x1, Math.abs(x2 - x1) < 1.0E-6 ? y2 : y0) : Math.abs(y3 - y0) < 1.0E-6 && x3 - x0 > 1.0E-6 ? new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(Math.abs(y2 - y0) < 1.0E-6 ? x2 : x0, y0) : null), cell.site, null));
  12631. ++nHalfEdges;
  12632. }
  12633. }
  12634. }
  12635. };
  12636. com_ibm_rave_core_internal_geom_voronoi_VoronoiCell.voronoiHalfEdgeOrder = function(a, b) {
  12637. if (b.angle > a.angle) {
  12638. return 1;
  12639. } else if (b.angle < a.angle) {
  12640. return -1;
  12641. }
  12642. return 0;
  12643. };
  12644. // $source: com/ibm/rave/core/internal/geom/voronoi/VoronoiCircle
  12645. /************************************************************************
  12646. ** IBM Confidential
  12647. **
  12648. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  12649. **
  12650. ** (C) Copyright IBM Corp. 2015
  12651. **
  12652. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12653. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12654. ************************************************************************/
  12655. // GENERATED
  12656. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  12657. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiRedBlackTree (static) // voronoiRedBlackNode
  12658. var com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle = com_ibm_rave_core_nativeImpl_Declare({
  12659. //x : null,
  12660. //y : null,
  12661. //arc : null,
  12662. //site : null,
  12663. //circle : null,
  12664. //cy : null,
  12665. //P : null,
  12666. //N : null,
  12667. //L : null,
  12668. //R : null,
  12669. //U : null,
  12670. //edge : null,
  12671. C : false,
  12672. constructor : function() {
  12673. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackNode(this);
  12674. }
  12675. });
  12676. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiDetachCircle = function(context, arc) {
  12677. var circle = arc.circle;
  12678. if ((circle)) {
  12679. if (!((circle.P))) {
  12680. context.voronoiFirstCircle = circle.N;
  12681. }
  12682. context.voronoiCircles.remove(circle);
  12683. context.voronoiCirclePool.push(circle);
  12684. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackNode(circle);
  12685. arc.circle = null;
  12686. }
  12687. };
  12688. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiAttachCircle = function(context, arc) {
  12689. var lArc = arc.P, rArc = arc.N;
  12690. if (!lArc || !rArc) {
  12691. return;
  12692. }
  12693. var lSite = lArc.site, cSite = arc.site, rSite = rArc.site;
  12694. if (lSite == rSite) {
  12695. return;
  12696. }
  12697. var bx = cSite.x, by = cSite.y, ax = lSite.x - bx, ay = lSite.y - by, cx = rSite.x - bx, cy = rSite.y - by;
  12698. var d = 2 * (ax * cy - ay * cx);
  12699. if (d >= -1.0E-12) {
  12700. return;
  12701. }
  12702. var ha = ax * ax + ay * ay, hc = cx * cx + cy * cy, x = (cy * ha - ay * hc) / d, y = (ax * hc - cx * ha) / d;
  12703. cy = y + by;
  12704. var circle = context.voronoiCirclePool.pop();
  12705. if (!((circle))) {
  12706. circle = new com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle();
  12707. }
  12708. circle.arc = arc;
  12709. circle.site = cSite;
  12710. circle.x = x + bx;
  12711. circle.y = cy + Math.sqrt(x * x + y * y);
  12712. circle.cy = cy;
  12713. arc.circle = circle;
  12714. var before, node = context.voronoiCircles.root;
  12715. while ((node)) {
  12716. if (circle.y < node.y || (circle.y == node.y && circle.x <= node.x)) {
  12717. if ((node.L)) {
  12718. node = node.L;
  12719. } else {
  12720. before = node.P;
  12721. break;
  12722. }
  12723. } else {
  12724. if ((node.R)) {
  12725. node = node.R;
  12726. } else {
  12727. before = node;
  12728. break;
  12729. }
  12730. }
  12731. }
  12732. context.voronoiCircles.insert(before, circle);
  12733. if (!((before))) {
  12734. context.voronoiFirstCircle = circle;
  12735. }
  12736. };
  12737. // $source: com/ibm/rave/core/internal/geom/voronoi/VoronoiBeach
  12738. /************************************************************************
  12739. ** IBM Confidential
  12740. **
  12741. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  12742. **
  12743. ** (C) Copyright IBM Corp. 2015
  12744. **
  12745. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12746. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12747. ************************************************************************/
  12748. // GENERATED
  12749. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  12750. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiCircle (loadtime) // voronoiDetachCircle, voronoiAttachCircle, superclass
  12751. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiRedBlackTree (static) // voronoiRedBlackNode
  12752. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiEdge (static) // new, voronoiCreateEdge, voronoiSetEdgeEnd
  12753. var com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle, {
  12754. constructor : function() {
  12755. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackNode(this);
  12756. }
  12757. });
  12758. com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiCreateBeach = function(context, site) {
  12759. var beach = context.voronoiBeachPool.pop();
  12760. if (!beach) {
  12761. beach = new com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach();
  12762. }
  12763. beach.site = site;
  12764. return beach;
  12765. };
  12766. com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiDetachBeach = function(context, beach) {
  12767. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiDetachCircle(context, beach);
  12768. context.voronoiBeaches.remove(beach);
  12769. context.voronoiBeachPool.push(beach);
  12770. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackNode(beach);
  12771. };
  12772. com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiRemoveBeach = function(context, beach) {
  12773. var circle = beach.circle;
  12774. var x = circle.x;
  12775. var y = circle.cy;
  12776. var vertex = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(x, y);
  12777. var previous = beach.P, next = beach.N;
  12778. var disappearing = [beach];
  12779. com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiDetachBeach(context, beach);
  12780. var lArc = previous;
  12781. while (lArc.circle && Math.abs(x - lArc.circle.x) < 1.0E-6 && Math.abs(y - lArc.circle.cy) < 1.0E-6) {
  12782. previous = lArc.P;
  12783. disappearing.unshift(lArc);
  12784. com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiDetachBeach(context, lArc);
  12785. lArc = previous;
  12786. }
  12787. disappearing.unshift(lArc);
  12788. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiDetachCircle(context, lArc);
  12789. var rArc = next;
  12790. while (rArc.circle && Math.abs(x - rArc.circle.x) < 1.0E-6 && Math.abs(y - rArc.circle.cy) < 1.0E-6) {
  12791. next = rArc.N;
  12792. disappearing.push(rArc);
  12793. com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiDetachBeach(context, rArc);
  12794. rArc = next;
  12795. }
  12796. disappearing.push(rArc);
  12797. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiDetachCircle(context, rArc);
  12798. var nArcs = disappearing.length;
  12799. var iArc;
  12800. for (iArc = 1; iArc < nArcs; ++iArc) {
  12801. rArc = disappearing[iArc];
  12802. lArc = disappearing[iArc - 1];
  12803. com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiSetEdgeEnd(rArc.edge, lArc.site, rArc.site, vertex);
  12804. }
  12805. lArc = disappearing[0];
  12806. rArc = disappearing[nArcs - 1];
  12807. rArc.edge = com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiCreateEdge(context, lArc.site, rArc.site, null, vertex);
  12808. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiAttachCircle(context, lArc);
  12809. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiAttachCircle(context, rArc);
  12810. };
  12811. com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiAddBeach = function(context, site) {
  12812. var x = site.x, directrix = site.y;
  12813. var lArc, rArc;
  12814. var dxl, dxr;
  12815. var node = context.voronoiBeaches.root;
  12816. while (node) {
  12817. dxl = com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiLeftBreakPoint(node, directrix) - x;
  12818. if (dxl > 1.0E-6) {
  12819. node = node.L;
  12820. } else {
  12821. dxr = x - com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiRightBreakPoint(node, directrix);
  12822. if (dxr > 1.0E-6) {
  12823. if (!node.R) {
  12824. lArc = node;
  12825. break;
  12826. }
  12827. node = node.R;
  12828. } else {
  12829. if (dxl > -1.0E-6) {
  12830. lArc = node.P;
  12831. rArc = node;
  12832. } else if (dxr > -1.0E-6) {
  12833. lArc = node;
  12834. rArc = node.N;
  12835. } else {
  12836. lArc = rArc = node;
  12837. }
  12838. break;
  12839. }
  12840. }
  12841. }
  12842. var newArc = com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiCreateBeach(context, site);
  12843. context.voronoiBeaches.insert(lArc, newArc);
  12844. if (!lArc && !rArc) {
  12845. return;
  12846. }
  12847. if (lArc == rArc) {
  12848. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiDetachCircle(context, lArc);
  12849. rArc = com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiCreateBeach(context, lArc.site);
  12850. context.voronoiBeaches.insert(newArc, rArc);
  12851. newArc.edge = rArc.edge = com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiCreateEdge(context, lArc.site, newArc.site, null, null);
  12852. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiAttachCircle(context, lArc);
  12853. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiAttachCircle(context, rArc);
  12854. return;
  12855. }
  12856. if (!rArc) {
  12857. newArc.edge = com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiCreateEdge(context, lArc.site, newArc.site, null, null);
  12858. return;
  12859. }
  12860. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiDetachCircle(context, lArc);
  12861. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiDetachCircle(context, rArc);
  12862. var lSite = lArc.site;
  12863. var ax = lSite.x, ay = lSite.y, bx = site.x - ax, by = site.y - ay;
  12864. var rSite = rArc.site;
  12865. var cx = rSite.x - ax, cy = rSite.y - ay, d = 2 * (bx * cy - by * cx), hb = bx * bx + by * by, hc = cx * cx + cy * cy;
  12866. var vertex = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite((cy * hb - by * hc) / d + ax, (bx * hc - cx * hb) / d + ay);
  12867. com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiSetEdgeEnd(rArc.edge, lSite, rSite, vertex);
  12868. newArc.edge = com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiCreateEdge(context, lSite, site, null, vertex);
  12869. rArc.edge = com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiCreateEdge(context, site, rSite, null, vertex);
  12870. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiAttachCircle(context, lArc);
  12871. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiAttachCircle(context, rArc);
  12872. };
  12873. com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiLeftBreakPoint = function(arc, directrix) {
  12874. var site = arc.site;
  12875. var rfocx = site.x, rfocy = site.y, pby2 = rfocy - directrix;
  12876. if (!((pby2))) {
  12877. return rfocx;
  12878. }
  12879. var lArc = arc.P;
  12880. if (!lArc) {
  12881. return -Infinity;
  12882. }
  12883. site = lArc.site;
  12884. var lfocx = site.x, lfocy = site.y, plby2 = lfocy - directrix;
  12885. if (!((plby2))) {
  12886. return lfocx;
  12887. }
  12888. var hl = lfocx - rfocx, aby2 = 1 / pby2 - 1 / plby2, b = hl / plby2;
  12889. if ((aby2)) {
  12890. var sqRoot = Math.sqrt(b * b - 2 * aby2 * (hl * hl / (-2 * plby2) - lfocy + plby2 / 2 + rfocy - pby2 / 2));
  12891. return (-b + sqRoot) / aby2 + rfocx;
  12892. }
  12893. return (rfocx + lfocx) / 2;
  12894. };
  12895. com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiRightBreakPoint = function(arc, directrix) {
  12896. var rArc = arc.N;
  12897. if (rArc) {
  12898. return com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiLeftBreakPoint(rArc, directrix);
  12899. }
  12900. var site = arc.site;
  12901. return site.y == directrix ? site.x : Infinity;
  12902. };
  12903. // $source: com/ibm/rave/core/internal/geom/voronoi/VoronoiClip
  12904. /************************************************************************
  12905. ** IBM Confidential
  12906. **
  12907. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  12908. **
  12909. ** (C) Copyright IBM Corp. 2015
  12910. **
  12911. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12912. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12913. ************************************************************************/
  12914. // GENERATED
  12915. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  12916. //@import com/ibm/rave/core/geom/ClipLine (runtime) // create
  12917. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiEdge (static) // new
  12918. var com_ibm_rave_core_internal_geom_voronoi_VoronoiClip = com_ibm_rave_core_nativeImpl_Declare({
  12919. });
  12920. com_ibm_rave_core_internal_geom_voronoi_VoronoiClip.voronoiClipEdges = function(context, extent) {
  12921. var edges = context.voronoiEdges;
  12922. var clip = com_ibm_rave_core_geom_ClipLine.create(extent[0][0], extent[0][1], extent[1][0], extent[1][1]);
  12923. var i = edges.length;
  12924. var e;
  12925. while (i-- > 0) {
  12926. e = edges[i];
  12927. if (!(com_ibm_rave_core_internal_geom_voronoi_VoronoiClip.voronoiConnectEdge(e, extent)) || !clip(e) || (Math.abs(e.a.x - e.b.x) < 1.0E-6 && Math.abs(e.a.y - e.b.y) < 1.0E-6)) {
  12928. e.a = null;
  12929. e.b = null;
  12930. edges.splice(i, 1);
  12931. }
  12932. }
  12933. };
  12934. com_ibm_rave_core_internal_geom_voronoi_VoronoiClip.voronoiConnectEdge = function(edge, extent) {
  12935. var vb = edge.b;
  12936. if (vb) {
  12937. return true;
  12938. }
  12939. var va = edge.a;
  12940. var x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1];
  12941. var lSite = edge.l, rSite = edge.r;
  12942. var lx = lSite.x, ly = lSite.y, rx = rSite.x, ry = rSite.y, fx = (lx + rx) / 2, fy = (ly + ry) / 2, fm, fb;
  12943. if (ry == ly) {
  12944. if (fx < x0 || fx >= x1) {
  12945. return false;
  12946. }
  12947. if (lx > rx) {
  12948. if (!va) {
  12949. va = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(fx, y0);
  12950. } else if (va.y >= y1) {
  12951. return false;
  12952. }
  12953. vb = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(fx, y1);
  12954. } else {
  12955. if (!va) {
  12956. va = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(fx, y1);
  12957. } else if (va.y < y0) {
  12958. return false;
  12959. }
  12960. vb = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(fx, y0);
  12961. }
  12962. } else {
  12963. fm = (lx - rx) / (ry - ly);
  12964. fb = fy - fm * fx;
  12965. if (fm < -1 || fm > 1) {
  12966. if (lx > rx) {
  12967. if (!va) {
  12968. va = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite((y0 - fb) / fm, y0);
  12969. } else if (va.y >= y1) {
  12970. return false;
  12971. }
  12972. vb = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite((y1 - fb) / fm, y1);
  12973. } else {
  12974. if (!va) {
  12975. va = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite((y1 - fb) / fm, y1);
  12976. } else if (va.y < y0) {
  12977. return false;
  12978. }
  12979. vb = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite((y0 - fb) / fm, y0);
  12980. }
  12981. } else {
  12982. if (ly < ry) {
  12983. if (!va) {
  12984. va = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(x0, fm * x0 + fb);
  12985. } else if (va.x >= x1) {
  12986. return false;
  12987. }
  12988. vb = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(x1, fm * x1 + fb);
  12989. } else {
  12990. if (!va) {
  12991. va = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(x1, fm * x1 + fb);
  12992. } else if (va.x < x0) {
  12993. return false;
  12994. }
  12995. vb = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(x0, fm * x0 + fb);
  12996. }
  12997. }
  12998. }
  12999. edge.a = va;
  13000. edge.b = vb;
  13001. return true;
  13002. };
  13003. // $source: com/ibm/rave/core/internal/geom/voronoi/VoronoiIndex
  13004. /************************************************************************
  13005. ** IBM Confidential
  13006. **
  13007. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13008. **
  13009. ** (C) Copyright IBM Corp. 2015
  13010. **
  13011. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13012. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13013. ************************************************************************/
  13014. // GENERATED
  13015. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  13016. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiRedBlackTree (static) // new
  13017. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiCell (static) // new, voronoiCloseCells
  13018. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiBeach (static) // voronoiAddBeach, voronoiRemoveBeach
  13019. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiClip (static) // voronoiClipEdges
  13020. var com_ibm_rave_core_internal_geom_voronoi_VoronoiIndex = com_ibm_rave_core_nativeImpl_Declare({
  13021. });
  13022. com_ibm_rave_core_internal_geom_voronoi_VoronoiIndex.voronoi = function(context, sites, bbox) {
  13023. var site = sites.sort(com_ibm_rave_core_internal_geom_voronoi_VoronoiIndex.voronoiVertexOrder).pop();
  13024. var x0 = -Infinity;
  13025. var y0 = -Infinity;
  13026. var circle;
  13027. context.voronoiEdges = [];
  13028. context.voronoiCells = new Array(sites.length);
  13029. context.voronoiBeaches = new com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree();
  13030. context.voronoiCircles = new com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree();
  13031. while (true) {
  13032. circle = context.voronoiFirstCircle;
  13033. if (site && (!circle || site.y < circle.y || (site.y == circle.y && site.x < circle.x))) {
  13034. if (site.x != x0 || site.y != y0) {
  13035. context.voronoiCells[site.i] = new com_ibm_rave_core_internal_geom_voronoi_VoronoiCell(site);
  13036. com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiAddBeach(context, site);
  13037. x0 = site.x;
  13038. y0 = site.y;
  13039. }
  13040. site = sites.pop();
  13041. } else if (circle) {
  13042. com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiRemoveBeach(context, circle.arc);
  13043. } else {
  13044. break;
  13045. }
  13046. }
  13047. if ((bbox)) {
  13048. com_ibm_rave_core_internal_geom_voronoi_VoronoiClip.voronoiClipEdges(context, bbox);
  13049. com_ibm_rave_core_internal_geom_voronoi_VoronoiCell.voronoiCloseCells(context, bbox);
  13050. }
  13051. var diagram = new com_ibm_rave_core_internal_geom_voronoi_VoronoiIndex.VoronoiDiagram(context.voronoiCells, context.voronoiEdges);
  13052. context.voronoiBeaches = null;
  13053. context.voronoiCircles = null;
  13054. context.voronoiEdges = null;
  13055. context.voronoiCells = null;
  13056. return diagram;
  13057. };
  13058. com_ibm_rave_core_internal_geom_voronoi_VoronoiIndex.VoronoiDiagram = com_ibm_rave_core_nativeImpl_Declare({
  13059. //voronoiEdges : null,
  13060. //voronoiCells : null,
  13061. constructor : function(cells, edges) {
  13062. this.voronoiEdges = edges;
  13063. this.voronoiCells = cells;
  13064. }
  13065. });
  13066. com_ibm_rave_core_internal_geom_voronoi_VoronoiIndex.voronoiVertexOrder = function(a, b) {
  13067. var dresult = (b.y - a.y);
  13068. if (dresult == 0) {
  13069. dresult = (b.x - a.x);
  13070. }
  13071. if (dresult > 0) {
  13072. return 1;
  13073. }
  13074. if (dresult < 0) {
  13075. return -1;
  13076. }
  13077. return 0;
  13078. };
  13079. // $source: com/ibm/rave/core/geom/ClipLine
  13080. /************************************************************************
  13081. ** IBM Confidential
  13082. **
  13083. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13084. **
  13085. ** (C) Copyright IBM Corp. 2015
  13086. **
  13087. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13088. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13089. ************************************************************************/
  13090. // GENERATED
  13091. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  13092. //@import com/ibm/rave/core/geom/PointStruct (runtime) // new
  13093. /**
  13094. * A class that creates a functor for line clipping using Liang–Barsky line clipping algorithm. In computer graphics, 'line clipping' is the process of removing lines or portions of lines outside of an area of interest. Typically, any line or part thereof which is outside of the viewing area is removed.
  13095. */
  13096. var com_ibm_rave_core_geom_ClipLine = rave_externs["ClipLine"] = com_ibm_rave_core_nativeImpl_Declare({
  13097. });
  13098. /**
  13099. * Creates the line clipper functor that could be used to clip a line if it is not within the boundaries of the specified box
  13100. * @param (double) x0 the x ccordinate of the upper corner clipping box
  13101. * @param (double) y0 the y ccordinate of the upper corner clipping box
  13102. * @param (double) x1 the y ccordinate of the lower corner clipping box
  13103. * @param (double) y1 the x ccordinate of the lower corner clipping box
  13104. * @return (com.ibm.rave.core.geom.ClipLine.LineClipper) return a new {@link (com.ibm.rave.core.geom.ClipLine.LineClipper) LineClipper} functor
  13105. */
  13106. /** @expose */
  13107. com_ibm_rave_core_geom_ClipLine.create = function(x0, y0, x1, y1) {
  13108. return function(line) {
  13109. var a = line.a, b = line.b;
  13110. var ax = a.x, ay = a.y, bx = b.x, by = b.y, t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r;
  13111. r = x0 - ax;
  13112. if (!((dx)) && r > 0) {
  13113. return null;
  13114. }
  13115. r /= dx;
  13116. if (dx < 0) {
  13117. if (r < t0) {
  13118. return null;
  13119. }
  13120. if (r < t1) {
  13121. t1 = r;
  13122. }
  13123. } else if (dx > 0) {
  13124. if (r > t1) {
  13125. return null;
  13126. }
  13127. if (r > t0) {
  13128. t0 = r;
  13129. }
  13130. }
  13131. r = x1 - ax;
  13132. if (!((dx)) && r < 0) {
  13133. return null;
  13134. }
  13135. r /= dx;
  13136. if (dx < 0) {
  13137. if (r > t1) {
  13138. return null;
  13139. }
  13140. if (r > t0) {
  13141. t0 = r;
  13142. }
  13143. } else if (dx > 0) {
  13144. if (r < t0) {
  13145. return null;
  13146. }
  13147. if (r < t1) {
  13148. t1 = r;
  13149. }
  13150. }
  13151. r = y0 - ay;
  13152. if (!((dy)) && r > 0) {
  13153. return null;
  13154. }
  13155. r /= dy;
  13156. if (dy < 0) {
  13157. if (r < t0) {
  13158. return null;
  13159. }
  13160. if (r < t1) {
  13161. t1 = r;
  13162. }
  13163. } else if (dy > 0) {
  13164. if (r > t1) {
  13165. return null;
  13166. }
  13167. if (r > t0) {
  13168. t0 = r;
  13169. }
  13170. }
  13171. r = y1 - ay;
  13172. if (!((dy)) && r < 0) {
  13173. return null;
  13174. }
  13175. r /= dy;
  13176. if (dy < 0) {
  13177. if (r > t1) {
  13178. return null;
  13179. }
  13180. if (r > t0) {
  13181. t0 = r;
  13182. }
  13183. } else if (dy > 0) {
  13184. if (r < t0) {
  13185. return null;
  13186. }
  13187. if (r < t1) {
  13188. t1 = r;
  13189. }
  13190. }
  13191. if (t0 > 0) {
  13192. line.a = new com_ibm_rave_core_geom_PointStruct(ax + t0 * dx, ay + t0 * dy);
  13193. }
  13194. if (t1 < 1) {
  13195. line.b = new com_ibm_rave_core_geom_PointStruct(ax + t1 * dx, ay + t1 * dy);
  13196. }
  13197. return line;
  13198. };
  13199. };
  13200. // $source: com/ibm/rave/core/internal/geom/voronoi/VoronoiPolygon
  13201. /************************************************************************
  13202. ** IBM Confidential
  13203. **
  13204. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13205. **
  13206. ** (C) Copyright IBM Corp. 2015
  13207. **
  13208. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13209. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13210. ************************************************************************/
  13211. // GENERATED
  13212. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  13213. var com_ibm_rave_core_internal_geom_voronoi_VoronoiPolygon = com_ibm_rave_core_nativeImpl_Declare(Array, {
  13214. //point : null
  13215. //constructor : function(elements) {}
  13216. });
  13217. // $source: com/ibm/rave/core/geom/Hull
  13218. /************************************************************************
  13219. ** IBM Confidential
  13220. **
  13221. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13222. **
  13223. ** (C) Copyright IBM Corp. 2015
  13224. **
  13225. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13226. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13227. ************************************************************************/
  13228. // GENERATED
  13229. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  13230. //@import com/ibm/rave/core/internal/math/Trigonometry (static) // cross2d
  13231. /**
  13232. * Create a new hull layout with the default x- and y-accessors
  13233. * @param < T >
  13234. */
  13235. var com_ibm_rave_core_geom_Hull = rave_externs["Hull"] = com_ibm_rave_core_nativeImpl_Declare({
  13236. //fx : null,
  13237. //fy : null,
  13238. //xVal : null,
  13239. //yVal : null,
  13240. _$functionClassMethod : function() {
  13241. var _$self = /**
  13242. * Returns the convex hull for the specified vertices array, using the current x- and y-coordinate accessors. The returned convex hull is represented as an array containing a subset of the input vertices, arranged in counterclockwise order (for consistency with polygon.clip). Assumes the vertices array is greater than three in length. If vertices is of length <= 3, returns [].
  13243. * @param (Array) vertices The specified vertices array
  13244. * @return (Array) the convex hull for the specified vertices array
  13245. */
  13246. function(vertices) {
  13247. if (!vertices || vertices.length < 3) {
  13248. return [];
  13249. }
  13250. var i = 0;
  13251. var n = vertices.length;
  13252. var points = [];
  13253. var flippedPoints = [];
  13254. for (i = 0; i < n; ++i) {
  13255. var p = new com_ibm_rave_core_geom_Hull.HullPoint();
  13256. p.x = + (_$self.fx(vertices[i], i));
  13257. p.y = + (_$self.fy(vertices[i], i));
  13258. p.index = i;
  13259. points.push(p);
  13260. }
  13261. points.sort(com_ibm_rave_core_geom_Hull.geom_hullOrder);
  13262. for (i = 0; i < n; ++i) {
  13263. var point = new com_ibm_rave_core_geom_Hull.HullPoint();
  13264. point.x = points[i].x;
  13265. point.y = -points[i].y;
  13266. flippedPoints.push(point);
  13267. }
  13268. var upper = com_ibm_rave_core_geom_Hull.geom_hullUpper(points);
  13269. var lower = com_ibm_rave_core_geom_Hull.geom_hullUpper(flippedPoints);
  13270. var skipLeft = 0;
  13271. var skipRight = 0;
  13272. if (lower[0] == upper[0]) {
  13273. skipLeft = 1;
  13274. }
  13275. if (lower[lower.length - 1] == upper[upper.length - 1]) {
  13276. skipRight = 1;
  13277. }
  13278. var polygon = [];
  13279. for (i = upper.length - 1; i >= 0; --i) {
  13280. var upperPoint = points[upper[i]];
  13281. polygon.push(vertices[upperPoint.index]);
  13282. }
  13283. for (i = skipLeft; i < lower.length - skipRight; ++i) {
  13284. var lowerPoint = points[lower[i]];
  13285. polygon.push(vertices[lowerPoint.index]);
  13286. }
  13287. return polygon;
  13288. };
  13289. return _$self;
  13290. },
  13291. constructor : function() {
  13292. this.fx = com_ibm_rave_core_geom_Hull.FX_COMP_FN;
  13293. this.fy = com_ibm_rave_core_geom_Hull.FY_COMP_FN;
  13294. this.xVal = this.fx;
  13295. this.yVal = this.fy;
  13296. },
  13297. /**
  13298. * Returns the current x-coordinate accessor function. Defaults to returning the first value in the data point.
  13299. * @return (Object) the current x-coordinate accessor
  13300. */
  13301. x$0 : function() {
  13302. return this.xVal;
  13303. },
  13304. /**
  13305. * If x is specified, sets the x-coordinate accessor and returns this hull For each point added to the hull, either during initial construction or lazily added, the x-accessor is invoked with the arguments {data, index}, where data is the current point and index is its index in the array of all points. The x-accessor must then return a numeric value indicating the x-coordinate of the given point. The x-accessor may also be defined as a constant number rather than a function, if desired.
  13306. * @param (double) x The x-coordinate to use
  13307. * @return (com.ibm.rave.core.geom.Hull) the quadtree factory
  13308. */
  13309. x$1 : function(x) {
  13310. this.fx = function(data, i) {
  13311. if (!data) {
  13312. return undefined;
  13313. }
  13314. return x;
  13315. };
  13316. this.xVal = x;
  13317. return this;
  13318. },
  13319. /**
  13320. * Sets the x-coordinate accessor and returns this hull For each point added to the hull, either during initial construction or lazily added, the x-accessor is invoked with the arguments {data, index}, where data is the current point and index is its index in the array of all points. The x-accessor must then return a numeric value indicating the x-coordinate of the given point. The x-accessor may also be defined as a constant number rather than a function, if desired.
  13321. * @param (com.ibm.rave.core.geom.Hull.HullFunction) x A new x-accessor to be used
  13322. * @return (com.ibm.rave.core.geom.Hull) the quadtree factory
  13323. */
  13324. x$2 : function(x) {
  13325. this.fx = x;
  13326. this.xVal = x;
  13327. return this;
  13328. },
  13329. /**
  13330. * Returns the current y-coordinate accessor. Defaults to returning the second value in the data point.
  13331. * @return (Object) the current y-coordinate accessor
  13332. */
  13333. y$0 : function() {
  13334. return this.yVal;
  13335. },
  13336. /**
  13337. * If y is specified, sets the y-coordinate accessor and returns this hull For each point added to the hull, either during initial construction or lazily added, the y-accessor is invoked with the arguments {data, index}, where data is the current point and index is its index in the array of all points. The y-accessor must then return a numeric value indicating the y-coordinate of the given point. The y-accessor may also be defined as a constant number rather than a function, if desired.
  13338. * @param (double) y The y-coordinate to use
  13339. * @return (com.ibm.rave.core.geom.Hull) the quadtree factory
  13340. */
  13341. y$1 : function(y) {
  13342. this.fy = function(data, i) {
  13343. if (!data) {
  13344. return undefined;
  13345. }
  13346. return y;
  13347. };
  13348. this.yVal = y;
  13349. return this;
  13350. },
  13351. /**
  13352. * If y is specified, sets the y-coordinate accessor and returns this hull For each point added to the hull, either during initial construction or lazily added, the y-accessor is invoked with the arguments {data, index}, where data is the current point and index is its index in the array of all points. The y-accessor must then return a numeric value indicating the y-coordinate of the given point. The y-accessor may also be defined as a constant number rather than a function, if desired.
  13353. * @param (com.ibm.rave.core.geom.Hull.HullFunction) y A new y-accessor to be used
  13354. * @return (com.ibm.rave.core.geom.Hull) the quadtree factory
  13355. */
  13356. y$2 : function(y) {
  13357. this.fy = y;
  13358. this.yVal = y;
  13359. return this;
  13360. },
  13361. /** @expose */
  13362. x : function(a0) {
  13363. var args = arguments;
  13364. if (args.length == 0) {
  13365. return this.x$0();
  13366. }
  13367. if (args.length == 1 && typeof a0 === "function") {
  13368. return this.x$2(a0);
  13369. }
  13370. return this.x$1(a0);
  13371. },
  13372. /** @expose */
  13373. y : function(a0) {
  13374. var args = arguments;
  13375. if (args.length == 0) {
  13376. return this.y$0();
  13377. }
  13378. if (args.length == 1 && typeof a0 === "function") {
  13379. return this.y$2(a0);
  13380. }
  13381. return this.y$1(a0);
  13382. }
  13383. });
  13384. com_ibm_rave_core_geom_Hull.geom_hullUpper = function(points) {
  13385. var n = points.length;
  13386. var hull = [0, 1];
  13387. var hs = 2;
  13388. for (var i = 2; i < n; ++i) {
  13389. while (hs > 1 && com_ibm_rave_core_internal_math_Trigonometry.cross2d(points[hull[hs - 2]].toDoubleArray(), points[hull[hs - 1]].toDoubleArray(), points[i].toDoubleArray()) <= 0) {
  13390. --hs;
  13391. }
  13392. hull[hs++] = i;
  13393. }
  13394. return hull.slice(0, hs);
  13395. };
  13396. com_ibm_rave_core_geom_Hull.HullPoint = com_ibm_rave_core_nativeImpl_Declare({
  13397. x : 0,
  13398. y : 0,
  13399. index : 0,
  13400. /** @expose */
  13401. toDoubleArray : function() {
  13402. return [this.x, this.y];
  13403. }
  13404. });
  13405. com_ibm_rave_core_geom_Hull.geom_hullOrder = function(a, b) {
  13406. var val = ~~(a.x - b.x);
  13407. if (val != 0) {
  13408. return val;
  13409. }
  13410. return ~~(a.y - b.y);
  13411. };
  13412. com_ibm_rave_core_geom_Hull.FX_COMP_FN = function(data, i) {
  13413. return data[0];
  13414. };
  13415. com_ibm_rave_core_geom_Hull.FY_COMP_FN = function(data, i) {
  13416. return data[1];
  13417. };
  13418. // $source: com/ibm/rave/core/scales/AbstractScale
  13419. /************************************************************************
  13420. ** IBM Confidential
  13421. **
  13422. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13423. **
  13424. ** (C) Copyright IBM Corp. 2015
  13425. **
  13426. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13427. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13428. ************************************************************************/
  13429. // GENERATED
  13430. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  13431. /**
  13432. * AbstractScale A scale is a function that maps input (domain) values to output (range) values. This is a generic, common interface for all scale types (e.g. {@link (com.ibm.rave.core.scales.LinearScale) LinearScale} , {@link (com.ibm.rave.core.scales.OrdinalScale) OrdinalScale} ). AbstractScale is generic to allow each concrete scale type to accept and return any value type. Each concrete scale type may expect different types and sizes of domain and range arrays. For example, {@link (com.ibm.rave.core.scales.LinearScale) LinearScale} expects an array of 2 numbers, [min, max], as it's domain and range; however, {@link (com.ibm.rave.core.scales.OrdinalScale) OrdinalScale} expects an arbitrary length array of any type (typically the domain will be an array of String, such as categories ["A", "B", "C", ...]).
  13433. * @param < (java.lang.Object) C > The context type.
  13434. * @param < (java.lang.Object) R > The return type (i.e. the value type the scale will return for a given domain value).
  13435. */
  13436. var com_ibm_rave_core_scales_AbstractScale = rave_externs["AbstractScale"] = com_ibm_rave_core_nativeImpl_Declare({
  13437. /**
  13438. * @expose
  13439. */
  13440. /** @expose */
  13441. invert : null,
  13442. /**
  13443. * @expose
  13444. */
  13445. /** @expose */
  13446. rangeExtent : null,
  13447. /**
  13448. * @expose
  13449. */
  13450. /** @expose */
  13451. rangeBand : null,
  13452. /**
  13453. * @expose
  13454. */
  13455. /** @expose */
  13456. ticks : null,
  13457. /**
  13458. * @expose
  13459. */
  13460. /** @expose */
  13461. tickFormat : null,
  13462. /**
  13463. * @expose
  13464. */
  13465. /** @expose */
  13466. zoomTransform : null,
  13467. /**
  13468. * @expose
  13469. */
  13470. /** @expose */
  13471. ticksInRange : null,
  13472. /**
  13473. * Create a new Scale that duplicates this Scale. Note this will typically do a shallow copy (the original and copied scale will reference the same range/domain arrays).
  13474. * @return (com.ibm.rave.core.scales.AbstractScale) A duplicate AbstractScale.
  13475. */
  13476. /** @expose */
  13477. copy : function() {},
  13478. /**
  13479. * Gets the tick format value function. if this scale does not support tick formatting then it will return null.
  13480. * @return (com.ibm.rave.core.scales.AbstractScale.TickFormatValueFunction) the tick format value function if it is supported or null if it isn't
  13481. */
  13482. /** @expose */
  13483. getTickFormat : function() {
  13484. return this.tickFormat;
  13485. },
  13486. /**
  13487. * Gets the range band value function. if this scale does not support this feature then it will return null.
  13488. * @return (com.ibm.rave.core.scales.AbstractScale.RangeBandValueFunction) the range band value function if it is supported or null if it isn't
  13489. */
  13490. /** @expose */
  13491. getRangeBand : function() {
  13492. return this.rangeBand;
  13493. },
  13494. /**
  13495. * Gets the range extent value function. if this scale does not support this feature then it will return null.
  13496. * @return (com.ibm.rave.core.scales.AbstractScale.RangeExtentValueFunction) the range extent value function if it is supported or null if it isn't
  13497. */
  13498. /** @expose */
  13499. getRangeExtent : function() {
  13500. return this.rangeExtent;
  13501. },
  13502. /**
  13503. * Gets the ticks value function. if this scale does not support this feature then it will return null.
  13504. * @return (com.ibm.rave.core.scales.AbstractScale.TicksValueFunction) the ticks value function if it is supported or null if it isn't
  13505. */
  13506. /** @expose */
  13507. getTicks : function() {
  13508. return this.ticks;
  13509. },
  13510. /**
  13511. * Gets the zoomTransform function. if this scale does not support this feature then it will return null.
  13512. * @return (com.ibm.rave.core.scales.AbstractScale.ZoomTransformFunction) the zoomTransform function if it is supported or null if it isn't
  13513. */
  13514. /** @expose */
  13515. getZoomTransform : function() {
  13516. return this.zoomTransform;
  13517. },
  13518. /**
  13519. * Gets the ticksInRange function. if this scale does not support this feature then it will return null.
  13520. * @return (com.ibm.rave.core.scales.AbstractScale.TicksInRangeFunction) the ticksInRange function if it is supported or null if it isn't
  13521. */
  13522. /** @expose */
  13523. getTicksInRange : function() {
  13524. return this.ticksInRange;
  13525. },
  13526. /**
  13527. * Gets the invert value function. if this scale does not support this feature then it will return null.
  13528. * @return (com.ibm.rave.core.scales.AbstractScale.InvertValueFunction) the invert value function if it is supported or null if it isn't
  13529. */
  13530. /** @expose */
  13531. getInvert : function() {
  13532. return this.invert;
  13533. },
  13534. /** @expose */
  13535. setInvert : function(invert) {
  13536. this.invert = invert;
  13537. },
  13538. /** @expose */
  13539. setRangeExtent : function(rangeExtent) {
  13540. this.rangeExtent = rangeExtent;
  13541. },
  13542. /** @expose */
  13543. setRangeBand : function(rangeBand) {
  13544. this.rangeBand = rangeBand;
  13545. },
  13546. /** @expose */
  13547. setTicks : function(ticks) {
  13548. this.ticks = ticks;
  13549. },
  13550. /** @expose */
  13551. setTickFormat : function(tickFormat) {
  13552. this.tickFormat = tickFormat;
  13553. },
  13554. /** @expose */
  13555. setZoomTransform : function(zoomTransform) {
  13556. this.zoomTransform = zoomTransform;
  13557. },
  13558. /** @expose */
  13559. setTicksInRange : function(ticksInRange) {
  13560. this.ticksInRange = ticksInRange;
  13561. },
  13562. /** @expose */
  13563. domain : function(a0) {
  13564. var args = arguments;
  13565. if (args.length == 0) {
  13566. return this.domain$1();
  13567. }
  13568. return this.domain$0(a0);
  13569. },
  13570. /** @expose */
  13571. range : function(a0) {
  13572. var args = arguments;
  13573. if (args.length == 0) {
  13574. return this.range$1();
  13575. }
  13576. return this.range$0(a0);
  13577. }
  13578. /**
  13579. * Set the scale's input domain.
  13580. * @param (Array) values Array of domain values.
  13581. * @return (com.ibm.rave.core.scales.AbstractScale) This scale instance.
  13582. */
  13583. //domain$0 : function(values) {},
  13584. /**
  13585. * Get the scale's domain.
  13586. * @return (Array) Array of domain values.
  13587. */
  13588. //domain$1 : function() {},
  13589. /**
  13590. * Set the scale's output range.
  13591. * @param (Array) values Array of range values.
  13592. * @return (com.ibm.rave.core.scales.AbstractScale) This scale instance.
  13593. */
  13594. //range$0 : function(values) {},
  13595. /**
  13596. * Get the scale's range.
  13597. * @return (Array) Array of range values.
  13598. */
  13599. //range$1 : function() {}
  13600. });
  13601. /**
  13602. * Returns a 2 element array containing the first and last values in the {@code range} parameter in ascending order.
  13603. * @param (Array) range An array of values, typically a Scale object's {@code range} .
  13604. * @return (Array) min and max extent of the range, stored in an array of length2.
  13605. */
  13606. /** @expose */
  13607. com_ibm_rave_core_scales_AbstractScale.scaleExtent = function(range) {
  13608. var start = range[0];
  13609. var stop = range[range.length - 1];
  13610. if ((typeof start === "number" || start instanceof Number) && (typeof stop === "number" || stop instanceof Number)) {
  13611. if ((start) > (stop)) {
  13612. return [stop, start];
  13613. }
  13614. }
  13615. return [start, stop];
  13616. };
  13617. /**
  13618. * A utility method that return the range extent of the passed scale. It will first check if the passed scale has a range extent value function, and if so, it will invoke it and return back the results, else, it will get the scale's range, pass it to scaleExtent method and return its results.
  13619. * @param (com.ibm.rave.core.scales.AbstractScale) scale the scale to get the range extent for
  13620. * @return (Array) the scale's range extent
  13621. */
  13622. /** @expose */
  13623. com_ibm_rave_core_scales_AbstractScale.scaleRange = function(scale) {
  13624. if (scale.rangeExtent) {
  13625. return scale.rangeExtent();
  13626. }
  13627. return com_ibm_rave_core_scales_AbstractScale.scaleExtent(scale.range());
  13628. };
  13629. // $source: com/ibm/rave/core/internal/scales/Polylinear
  13630. /************************************************************************
  13631. ** IBM Confidential
  13632. **
  13633. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13634. **
  13635. ** (C) Copyright IBM Corp. 2015
  13636. **
  13637. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13638. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13639. ************************************************************************/
  13640. // GENERATED
  13641. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  13642. //@import com/ibm/rave/core/Rave (runtime) // Rave
  13643. /**
  13644. * @author Bryan
  13645. */
  13646. var com_ibm_rave_core_internal_scales_Polylinear = com_ibm_rave_core_nativeImpl_Declare({
  13647. _$functionClassMethod : function() {
  13648. var _$self = function(domain, range, uninterpolate, interpolate) {
  13649. return new com_ibm_rave_core_internal_scales_Polylinear.PolylinearValuefunction(domain, range, uninterpolate, interpolate);
  13650. };
  13651. return _$self;
  13652. }
  13653. });
  13654. com_ibm_rave_core_internal_scales_Polylinear.PolylinearValuefunction = com_ibm_rave_core_nativeImpl_Declare({
  13655. //u : null,
  13656. //i : null,
  13657. //domain : null,
  13658. //range : null,
  13659. k : 0,
  13660. _$functionClassMethod : function() {
  13661. var _$self = function(x) {
  13662. var j = com_ibm_rave_core_Rave.bisect(_$self.domain, x, 1, _$self.k) - 1;
  13663. return _$self.i[j](+ (_$self.u[j](+ (x))));
  13664. };
  13665. return _$self;
  13666. },
  13667. constructor : function(inDomain, inRange, uninterpolate, interpolate) {
  13668. this.u = [];
  13669. this.i = [];
  13670. var j = 0;
  13671. this.domain = [];
  13672. for (var __i_enFor0 = 0, __exp_enFor0 = inDomain, __len_enFor0 = __exp_enFor0.length;
  13673. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  13674. var o = __exp_enFor0[__i_enFor0];
  13675. this.domain.push(o);
  13676. }
  13677. this.range = [];
  13678. for (var __i_enFor1 = 0, __exp_enFor1 = inRange, __len_enFor1 = __exp_enFor1.length;
  13679. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  13680. var o = __exp_enFor1[__i_enFor1];
  13681. this.range.push(o);
  13682. }
  13683. this.k = Math.min(this.domain.length, this.range.length) - 1;
  13684. if (+ (this.domain[this.k]) < + (this.domain[0])) {
  13685. this.domain = this.domain.slice().reverse();
  13686. this.range = this.range.slice().reverse();
  13687. }
  13688. while (++j <= this.k) {
  13689. this.u.push(uninterpolate(this.domain[j - 1], this.domain[j]));
  13690. this.i.push(interpolate(this.range[j - 1], this.range[j]));
  13691. }
  13692. }
  13693. });
  13694. // $source: com/ibm/rave/core/internal/scales/Bilinear
  13695. /************************************************************************
  13696. ** IBM Confidential
  13697. **
  13698. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13699. **
  13700. ** (C) Copyright IBM Corp. 2015
  13701. **
  13702. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13703. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13704. ************************************************************************/
  13705. // GENERATED
  13706. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  13707. /**
  13708. * @author Bryan
  13709. */
  13710. var com_ibm_rave_core_internal_scales_Bilinear = com_ibm_rave_core_nativeImpl_Declare({
  13711. _$functionClassMethod : function() {
  13712. var _$self = function(domain, range, uninterpolate, interpolate) {
  13713. return new com_ibm_rave_core_internal_scales_Bilinear.BilinearValuefunction(domain, range, uninterpolate, interpolate);
  13714. };
  13715. return _$self;
  13716. }
  13717. });
  13718. com_ibm_rave_core_internal_scales_Bilinear.BilinearValuefunction = com_ibm_rave_core_nativeImpl_Declare({
  13719. //u : null,
  13720. //i : null,
  13721. _$functionClassMethod : function() {
  13722. var _$self = function(x) {
  13723. return _$self.i(+ (_$self.u(+ (x))));
  13724. };
  13725. return _$self;
  13726. },
  13727. constructor : function(domain, range, uninterpolate, interpolate) {
  13728. this.u = uninterpolate(domain[0], domain[1]);
  13729. this.i = interpolate(range[0], range[1]);
  13730. }
  13731. });
  13732. // $source: com/ibm/rave/core/internal/interpolate/UninterpolateClamp
  13733. /************************************************************************
  13734. ** IBM Confidential
  13735. **
  13736. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13737. **
  13738. ** (C) Copyright IBM Corp. 2015
  13739. **
  13740. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13741. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13742. ************************************************************************/
  13743. // GENERATED
  13744. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  13745. /**
  13746. * Creates an uninterpolator that can uninterpolate a number
  13747. * @author Bryan
  13748. */
  13749. var com_ibm_rave_core_internal_interpolate_UninterpolateClamp = com_ibm_rave_core_nativeImpl_Declare({
  13750. _$functionClassMethod : function() {
  13751. var _$self = /**
  13752. * Creates an uninterpolator that can uninterpolate a number
  13753. * @param (Object) a the start value
  13754. * @param (Object) b the end value
  13755. * @return (com.ibm.rave.core.interpolate.Interpolator) new interpolator
  13756. */
  13757. function(a, b) {
  13758. var da = + (a);
  13759. var db = + (b);
  13760. var db2 = ((db - da) != 0) ? db - da : 1 / db;
  13761. return function(x) {
  13762. return Math.max(0, Math.min(1, (x - da) / db2));
  13763. };
  13764. };
  13765. return _$self;
  13766. }
  13767. });
  13768. // $source: com/ibm/rave/core/internal/interpolate/UninterpolateNumber
  13769. /************************************************************************
  13770. ** IBM Confidential
  13771. **
  13772. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13773. **
  13774. ** (C) Copyright IBM Corp. 2015
  13775. **
  13776. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13777. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13778. ************************************************************************/
  13779. // GENERATED
  13780. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  13781. /**
  13782. * Creates an uninterpolator that can uninterpolate a number
  13783. * @author Bryan
  13784. */
  13785. var com_ibm_rave_core_internal_interpolate_UninterpolateNumber = com_ibm_rave_core_nativeImpl_Declare({
  13786. _$functionClassMethod : function() {
  13787. var _$self = /**
  13788. * Creates an uninterpolator that can uninterpolate a number between the start and end value.
  13789. * @param (Object) a the start value
  13790. * @param (Object) b the end value
  13791. * @return (com.ibm.rave.core.interpolate.Interpolator) new interpolator
  13792. */
  13793. function(a, b) {
  13794. var da = + (a);
  13795. var db = + (b);
  13796. var db2 = ((db - da) != 0) ? db - da : 1 / db;
  13797. return function(x) {
  13798. return (x - da) / db2;
  13799. };
  13800. };
  13801. return _$self;
  13802. }
  13803. });
  13804. // $source: com/ibm/rave/core/interpolate/RoundInterpolation
  13805. /************************************************************************
  13806. ** IBM Confidential
  13807. **
  13808. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13809. **
  13810. ** (C) Copyright IBM Corp. 2015
  13811. **
  13812. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13813. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13814. ************************************************************************/
  13815. // GENERATED
  13816. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  13817. var com_ibm_rave_core_interpolate_RoundInterpolation = rave_externs["RoundInterpolation"] = com_ibm_rave_core_nativeImpl_Declare({
  13818. _$functionClassMethod : function() {
  13819. var _$self = /**
  13820. * Creates an interpolator that can interpolate between the two numbers a and b; the interpolator is similar to NumberInterpolator, except it will round the resulting value to the nearest integer.
  13821. * @param (Object) a the start value
  13822. * @param (Object) b the end value
  13823. * @return (com.ibm.rave.core.interpolate.Interpolator) the new interpolator
  13824. */
  13825. function(a, b) {
  13826. var da = + (a);
  13827. var db = + (b) - da;
  13828. return function(t) {
  13829. return Math.round(da + db * t);
  13830. };
  13831. };
  13832. return _$self;
  13833. }
  13834. });
  13835. /** @expose */
  13836. com_ibm_rave_core_interpolate_RoundInterpolation.INSTANCE = new com_ibm_rave_core_interpolate_RoundInterpolation();
  13837. // $source: com/ibm/rave/core/internal/scales/NiceIdentity
  13838. /************************************************************************
  13839. ** IBM Confidential
  13840. **
  13841. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13842. **
  13843. ** (C) Copyright IBM Corp. 2015
  13844. **
  13845. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13846. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13847. ************************************************************************/
  13848. // GENERATED
  13849. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  13850. /**
  13851. * A default nice range that simply returns the values as-is. May be overridden for more functionality (as in TimeScale).
  13852. * @author jim
  13853. */
  13854. var com_ibm_rave_core_internal_scales_NiceIdentity = com_ibm_rave_core_nativeImpl_Declare({
  13855. //floor : null,
  13856. //ceil : null,
  13857. constructor : function(inFloor, inCeil) {
  13858. this.floor = function(x) {
  13859. return x;
  13860. };
  13861. this.ceil = function(x) {
  13862. return x;
  13863. };
  13864. {
  13865. if (inFloor) {
  13866. this.floor = inFloor;
  13867. }
  13868. if (inCeil) {
  13869. this.ceil = inCeil;
  13870. }
  13871. }
  13872. }
  13873. //constructor : function() {}
  13874. });
  13875. // $source: com/ibm/rave/core/internal/scales/Nice
  13876. /************************************************************************
  13877. ** IBM Confidential
  13878. **
  13879. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13880. **
  13881. ** (C) Copyright IBM Corp. 2015
  13882. **
  13883. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13884. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13885. ************************************************************************/
  13886. // GENERATED
  13887. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  13888. //@import com/ibm/rave/core/internal/scales/NiceIdentity (static) // new
  13889. /**
  13890. * Nicely round numbers
  13891. * @author Bryan
  13892. */
  13893. var com_ibm_rave_core_internal_scales_Nice = com_ibm_rave_core_nativeImpl_Declare({
  13894. });
  13895. com_ibm_rave_core_internal_scales_Nice.scaleNice = function(domain, nice) {
  13896. var i0 = 0.0, i1 = domain.length - 1, x0 = + (domain[i0]), x1 = + (domain[i1]), dx;
  13897. if (x1 < x0) {
  13898. dx = i0;
  13899. i0 = i1;
  13900. i1 = dx;
  13901. dx = x0;
  13902. x0 = x1;
  13903. x1 = dx;
  13904. }
  13905. domain[i0] = nice.floor(x0);
  13906. domain[i1] = nice.ceil(x1);
  13907. return domain;
  13908. };
  13909. com_ibm_rave_core_internal_scales_Nice.niceStep = function(step) {
  13910. var doubleStep = + (step);
  13911. return doubleStep != 0.0 ? new com_ibm_rave_core_internal_scales_NiceIdentity(function(x) {
  13912. return Math.floor(x / doubleStep) * doubleStep;
  13913. }, function(x) {
  13914. return Math.ceil(x / doubleStep) * doubleStep;
  13915. }) : new com_ibm_rave_core_internal_scales_NiceIdentity();
  13916. };
  13917. // $source: com/ibm/rave/core/locale/NumberFormat
  13918. /************************************************************************
  13919. ** IBM Confidential
  13920. **
  13921. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13922. **
  13923. ** (C) Copyright IBM Corp. 2015
  13924. **
  13925. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13926. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13927. ************************************************************************/
  13928. // GENERATED
  13929. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  13930. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (runtime) // create
  13931. //@import com/ibm/rave/core/format/Round (runtime) // round
  13932. //@import com/ibm/rave/core/internal/format/Precision (runtime) // precision
  13933. //@import com/ibm/rave/core/format/FormatPrefix (runtime) // formatPrefix
  13934. var com_ibm_rave_core_locale_NumberFormat = rave_externs["NumberFormat"] = com_ibm_rave_core_nativeImpl_Declare({
  13935. //locale_grouping : null,
  13936. //locale_currency : null,
  13937. //locale_decimal : null,
  13938. //formatGroup : null,
  13939. _$functionClassMethod : function() {
  13940. var _$self = function(specifier) {
  13941. var match = new RegExp(com_ibm_rave_core_locale_NumberFormat.format_re, "i").exec(specifier);
  13942. var zcomma;
  13943. var newType;
  13944. var fill = match[1] != null ? match[1] : " ";
  13945. var align = match[2] != null ? match[2] : ">";
  13946. var sign = match[3] != null ? match[3] : "-";
  13947. var symbol = match[4] != null ? match[4] : "";
  13948. var zfill = match[5];
  13949. var width = match[6];
  13950. var comma = match[7];
  13951. var precisionMatch = match[8];
  13952. var type = match[9];
  13953. var scale = 1;
  13954. var prefix = "";
  13955. var suffix = "";
  13956. var integer = false;
  13957. var exponent = true;
  13958. var intwidth = 0;
  13959. var precision;
  13960. if (precisionMatch != null) {
  13961. precision = ~~ (precisionMatch.substring(1));
  13962. }
  13963. if (zfill != null || fill == "0" && align == "=") {
  13964. zfill = fill = "0";
  13965. align = "=";
  13966. if (comma != null) {
  13967. var w = ~~+ (width);
  13968. intwidth = w;
  13969. }
  13970. }
  13971. if (type != null) {
  13972. if (type == "n") {
  13973. comma = "true";
  13974. type = "g";
  13975. } else if (type == "%") {
  13976. scale = 100;
  13977. suffix = "%";
  13978. type = "f";
  13979. } else if (type == "p") {
  13980. scale = 100;
  13981. suffix = "%";
  13982. type = "r";
  13983. } else if (type == "b" || type == "o" || type == "x" || type == "X") {
  13984. if (symbol == "#") {
  13985. prefix = "0" + type.toLowerCase();
  13986. }
  13987. } else if (type == "c") {
  13988. exponent = false;
  13989. } else if (type == "d") {
  13990. integer = true;
  13991. precision = 0;
  13992. } else if (type == "s") {
  13993. scale = -1;
  13994. type = "r";
  13995. }
  13996. }
  13997. if (symbol == ("$")) {
  13998. prefix = _$self.locale_currency[0];
  13999. suffix = _$self.locale_currency[1];
  14000. }
  14001. if (type != null && type == "r" && precision == null) {
  14002. type = "g";
  14003. }
  14004. var value;
  14005. if (precision != null) {
  14006. value = precision;
  14007. if (type != null && type == "g") {
  14008. precision = Math.max(1, Math.min(21, value));
  14009. } else if (type != null && type == "e" || type != null && type == "f") {
  14010. precision = Math.max(0, Math.min(20, value));
  14011. }
  14012. }
  14013. newType = _$self.formatTypes().get(type);
  14014. if (!newType) {
  14015. newType = _$self.formatTypeDefault();
  14016. }
  14017. if (zfill != null) {
  14018. zcomma = comma;
  14019. } else if (comma != null) {
  14020. zcomma = zfill;
  14021. } else {
  14022. zcomma = comma;
  14023. }
  14024. var _suffix = suffix;
  14025. var _exponent = exponent;
  14026. var _integer = integer;
  14027. var _sign = sign;
  14028. var _prefix = prefix;
  14029. var _zfill = zfill;
  14030. var _comma = comma;
  14031. var _precision = precision;
  14032. var _scale = scale;
  14033. var _newType = newType;
  14034. var _zcomma = zcomma;
  14035. var _width = width;
  14036. var _align = align;
  14037. var _intwidth = intwidth;
  14038. var _fill = fill;
  14039. var self = _$self;
  14040. return function(data, index, groupIndex) {
  14041. var value = + (data);
  14042. var fullSuffix = _suffix;
  14043. var v = value % 1;
  14044. if (_integer && v > 0) {
  14045. return "";
  14046. }
  14047. var negative;
  14048. if (value < 0 || value == 0 && 1 / value < 0) {
  14049. value = -value;
  14050. negative = "-";
  14051. } else {
  14052. if (_sign == "-") {
  14053. negative = "";
  14054. } else {
  14055. negative = _sign;
  14056. }
  14057. }
  14058. if (_scale < 0) {
  14059. var unit = com_ibm_rave_core_format_FormatPrefix.formatPrefix(value, _precision);
  14060. value = unit.scale(value);
  14061. fullSuffix = unit.symbol + _suffix;
  14062. } else {
  14063. value *= _scale;
  14064. }
  14065. var typeValue = _newType(value, _precision);
  14066. var i = typeValue.lastIndexOf(".");
  14067. var before;
  14068. var after;
  14069. if (i < 0) {
  14070. var j = _exponent ? typeValue.lastIndexOf("e") : -1;
  14071. if (j < 0) {
  14072. before = typeValue;
  14073. after = "";
  14074. } else {
  14075. before = typeValue.substring(0, j);
  14076. after = typeValue.substring(j);
  14077. }
  14078. } else {
  14079. before = typeValue.substring(0, i);
  14080. after = self.locale_decimal + typeValue.substring(i + 1);
  14081. }
  14082. if (_zfill == null && _comma != null) {
  14083. before = self.formatGroup(before, Infinity);
  14084. }
  14085. var length = _prefix.length + before.length + after.length + (_zcomma != null && !(_zcomma == "0") ? 0 : negative.length);
  14086. var intwidth = _intwidth;
  14087. if (_width != null && !(_width == "") && _intwidth == 0) {
  14088. intwidth = parseInt(_width);
  14089. }
  14090. var padding;
  14091. if (length < intwidth) {
  14092. length = intwidth - length + 1;
  14093. padding = new Array(length).join(_fill);
  14094. } else {
  14095. padding = "";
  14096. }
  14097. if (_zcomma != null && !(_zcomma == "0")) {
  14098. before = self.formatGroup(padding + before, padding.length > 0 ? intwidth - after.length : Infinity);
  14099. }
  14100. negative += _prefix;
  14101. var myValue = before + after;
  14102. return (_align == "<" ? negative + myValue + padding : _align == ">" ? padding + negative + myValue : _align == "^" ? padding.substring(0, length >>= 1) + negative + myValue + padding.substring(length) : negative + (_zcomma != null && !(_zcomma == "0") ? myValue : padding + myValue)) + fullSuffix;
  14103. };
  14104. };
  14105. return _$self;
  14106. },
  14107. /**
  14108. * Returns a new format function with the given string specifier. A format function takes a number as the only argument, and returns a string representing the formatted number. The format specifier is modeled after Python 3.1's built-in format specification mini-language. The general form of a specifier is: [​[fill]align][sign][symbol][0][width][,][.precision][type] The fill can be any character other than "{" or "}". The presence of a fill character is signaled by the character following it, which must be one of the align options. The align can be: ("<") Forces the field to be left-aligned within the available space. (">") Forces the field to be right-aligned within the available space. (This is the default). ("^") Forces the field to be centered within the available space. The sign can be: plus ("+") - a sign should be used for both positive and negative numbers. minus ("-") - a sign should be used only for negative numbers. (This is the default.) space (" ") - a leading space should be used on positive numbers, and a minus sign on negative numbers. The symbol can be: currency ("$") - a currency symbol should be prefixed (or suffixed) per the locale. base ("#") - for binary, octal, or hexadecimal output, prefix by "0b", "0o", or "0x", respectively. The "0" option enables zero-padding. The width defines the minimum field width. If not specified, then the width will be determined by the content. The comma (",") option enables the use of a comma for a thousands separator. The precision indicates how many digits should be displayed after the decimal point for a value formatted with types "f" and "%", or before and after the decimal point for a value formatted with types "g", "r" and "p". The available type values are: exponent ("e") - use Number.toExponential. general ("g") - use Number.toPrecision. fixed ("f") - use Number.toFixed. integer ("d") - use Number.toString, but ignore any non-integer values. rounded ("r") - round to precision significant digits, padding with zeroes where necessary in similar fashion to fixed ("f"). If no precision is specified, falls back to general notation. percentage ("%") - like fixed, but multiply by 100 and suffix with "%". rounded percentage ("p") - like rounded, but multiply by 100 and suffix with "%". binary ("b") - outputs the number in base 2. octal ("o") - outputs the number in base 8. hexadecimal ("x") - outputs the number in base 16, using lower-case letters for the digits above 9. hexadecimal ("X") - outputs the number in base 16, using upper-case letters for the digits above 9. character ("c") - converts the integer to the corresponding unicode character before printing. SI-prefix ("s") - like rounded, but with a unit suffixed such as "9.5M" for mega, or "1.00µ" for micro. The type "n" is also supported as shorthand for ",g" This is the entry point for number formatting. This method will take in a locale and do some basic setup in order to format a user specified number using a user specified format.
  14109. * @param (com.ibm.rave.core.locale.LocaleObject) locale The locale to use. If the user calls Rave.Format the default locale will be used. The default locale that is used is en-US unless the user has specified a different locale to use via Locale.setDefault();
  14110. * @return (void) A value function which will allow the user to specify the type of format to use e.g] ",.2f"
  14111. */
  14112. /** @expose */
  14113. constructor : function(locale) {
  14114. var locale_thousands = locale.thousands;
  14115. this.locale_decimal = locale.decimal;
  14116. this.locale_grouping = !locale.grouping ? [] : locale.grouping;
  14117. this.locale_currency = locale.currency;
  14118. var self = this;
  14119. this.formatGroup = this.locale_grouping.length >= 0 ? /**
  14120. * an identity method which will manipulate the value coming in to be properly formatted by separating the string using locale_thousands
  14121. * @param (String) value the value which is to be formatted using locale_thousands as a separator
  14122. * @param (double) width is used to determine at which points the string should be split and a separator should be used
  14123. * @return (String) A string that is separated using the locale_thousands value
  14124. */
  14125. function(value, width) {
  14126. var i = value.length;
  14127. var t = [];
  14128. var j = 0;
  14129. var g = self.locale_grouping[0];
  14130. var length = 0;
  14131. while (i > 0 && g > 0) {
  14132. if (length + g + 1 > width) {
  14133. g = Math.max(1, width - length);
  14134. }
  14135. var zi = i;
  14136. var zg = g;
  14137. var z = zi -= zg;
  14138. if (z < 0) {
  14139. z = 0;
  14140. }
  14141. i -= g;
  14142. t.push(value.substring(z, (i + ~~g)));
  14143. if ((length += g + 1) > width) {
  14144. break;
  14145. }
  14146. g = self.locale_grouping[j = (j + 1) % self.locale_grouping.length];
  14147. }
  14148. return t.reverse().join(locale_thousands);
  14149. } : /**
  14150. * this method will return the value that is passed in
  14151. * @param (String) value the value which is to be formatted using locale_thousands as a separator
  14152. * @param (double) width is used to determine at which points the string should be split and a separator should be used
  14153. * @return (String) the value that was passed in
  14154. */
  14155. function(value, width) {
  14156. return value;
  14157. };
  14158. },
  14159. formatTypes : function() {
  14160. var map = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  14161. map.set("b", function(value, precision) {
  14162. var v = ~~value;
  14163. return v.toString(2);
  14164. });
  14165. map.set("c", function(value, precision) {
  14166. var c = value;
  14167. return String.fromCharCode(c);
  14168. });
  14169. map.set("o", function(value, precision) {
  14170. var v = ~~value;
  14171. return v.toString(8);
  14172. });
  14173. map.set("x", function(value, precision) {
  14174. return value.toString(16);
  14175. });
  14176. map.set("X", function(value, precision) {
  14177. return value.toString(16).toUpperCase();
  14178. });
  14179. map.set("g", function(value, precision) {
  14180. return value.toPrecision(precision);
  14181. });
  14182. map.set("e", function(value, precision) {
  14183. return precision != null ? value.toExponential(precision) : value.toExponential();
  14184. });
  14185. map.set("f", function(value, precision) {
  14186. var fixed = value.toFixed(~~ (precision));
  14187. var fixedDouble = + (fixed);
  14188. if (((fixedDouble == Math.floor(fixedDouble)) && !(! isFinite(fixedDouble))) && ~~ (precision) <= 0) {
  14189. var intfixed = Math.round(fixedDouble);
  14190. return intfixed.toString();
  14191. }
  14192. return fixed;
  14193. });
  14194. map.set("r", function(value, precision) {
  14195. var rounded = com_ibm_rave_core_format_Round.round(value, com_ibm_rave_core_internal_format_Precision.precision(value, precision));
  14196. return rounded.toFixed(~~Math.max(0, Math.min(20, com_ibm_rave_core_internal_format_Precision.precision(rounded * (1 + 1e-15), precision))));
  14197. });
  14198. return map;
  14199. },
  14200. formatTypeDefault : function() {
  14201. return function(xx, pp) {
  14202. return ""+(xx);
  14203. };
  14204. }
  14205. });
  14206. /** @expose */
  14207. com_ibm_rave_core_locale_NumberFormat.format_re = "(?:([^{])?([<>=^]))?([+\\- ])?([$#])?(0)?(\\d+)?(,)?(\\.-?\\d+)?([a-z%])?";
  14208. // $source: com/ibm/rave/core/scales/OrdinalScale
  14209. /************************************************************************
  14210. ** IBM Confidential
  14211. **
  14212. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  14213. **
  14214. ** (C) Copyright IBM Corp. 2015
  14215. **
  14216. ** The source code for this program is not published or otherwise divested of its trade secrets,
  14217. ** irrespective of what has been deposited with the U.S. Copyright Office.
  14218. ************************************************************************/
  14219. // GENERATED
  14220. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  14221. //@import com/ibm/rave/core/scales/AbstractScale (loadtime) // scaleExtent, superclass
  14222. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (runtime) // create
  14223. //@import com/ibm/rave/core/internal/scales/Ranger (static) // new
  14224. //@import com/ibm/rave/core/internal/nativeImpl/Lang (runtime) // isNumber
  14225. /**
  14226. * A scale with a discreet input domain. This means that by default calling scale(0) will return the value in the input range that maps from this domain key -> range value. If no domain exists, then the domain will be created dynamically, adding new keys as they are called. If a domain does exist, the domain values are used as keys into the range.
  14227. * @author jim.
  14228. */
  14229. var com_ibm_rave_core_scales_OrdinalScale = rave_externs["OrdinalScale"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scales_AbstractScale, {
  14230. //_domain : null,
  14231. //_range : null,
  14232. //ranger : null,
  14233. //index : null,
  14234. _rangeBand : 0,
  14235. _viewOffset : 0,
  14236. _viewZoom : 0,
  14237. _$functionClassMethod : function() {
  14238. var _$self = /**
  14239. * Go through the domain looking for 'key' index in range. If key doesn't exist in domain, return domain.length % range.lenth. ALSO, if the key doesn't exist, the key gets added to the domain implicitly. ie - domain([]).range(["hi","bye"])(0) == "hi" (0 % 2 == 0) domain(["test"]).range(["hi","bye"])(0) == "bye" (1 % 2 == 1) domain(["test"]).range(["hi","bye"])("test") == "hi" (key found) domain(["test", "test2"]).range(["hi","bye"])("test2") == "bye" (key found)
  14240. */
  14241. function(key, _index, groupIndex) {
  14242. return _$self.scale(key, _$self.ranger);
  14243. };
  14244. return _$self;
  14245. },
  14246. constructor : function(_domain, ranger, viewZoom, viewOffset) {
  14247. this._domain = [];
  14248. this._range = [];
  14249. this.ranger = com_ibm_rave_core_scales_OrdinalScale.DEFAULT_RANGER;
  14250. this.index = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  14251. {
  14252. this.ranger = ranger;
  14253. this.domain(_domain);
  14254. this._viewOffset = viewOffset;
  14255. this._viewZoom = viewZoom;
  14256. var self = this;
  14257. this.rangeBand = function() {
  14258. return self._rangeBand * self._viewZoom;
  14259. };
  14260. this.rangeExtent = function() {
  14261. return com_ibm_rave_core_scales_AbstractScale.scaleExtent(self.ranger.a);
  14262. };
  14263. this.ticksInRange = function() {
  14264. var ticks = [];
  14265. var domain = self._domain;
  14266. var extent = self.rangeExtent();
  14267. if (com_ibm_rave_core_internal_nativeImpl_Lang.isNumber(extent[0]) && com_ibm_rave_core_internal_nativeImpl_Lang.isNumber(extent[1])) {
  14268. var min = + (extent[0]);
  14269. var max = + (extent[1]);
  14270. for (var __i_enFor0 = 0, __exp_enFor0 = domain, __len_enFor0 = __exp_enFor0.length;
  14271. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  14272. var d = __exp_enFor0[__i_enFor0];
  14273. var r = + (self.call(null, d, 0, 0)) + self.rangeBand() / 2;
  14274. if (r >= min && r <= max) {
  14275. ticks.push(d);
  14276. }
  14277. }
  14278. }
  14279. return ticks;
  14280. };
  14281. this.zoomTransform = function(zoom, offset) {
  14282. self._viewOffset = offset;
  14283. self._viewZoom = Math.max(0, zoom);
  14284. };
  14285. }
  14286. },
  14287. scale : function(key, ranger) {
  14288. var keyString = ""+(key);
  14289. var myindex = this.index.get(keyString);
  14290. if (myindex == null) {
  14291. if (ranger.t == "range") {
  14292. this._domain.push(key);
  14293. myindex = this.index.set(keyString, this._domain.length);
  14294. } else {
  14295. }
  14296. }
  14297. if (this._range.length == 0 || myindex == null) {
  14298. return undefined;
  14299. }
  14300. myindex = (myindex - 1) % this._range.length;
  14301. return this.transformRangeValue(this._range[myindex]);
  14302. },
  14303. domain$0 : function(values) {
  14304. this._domain = [];
  14305. this.index = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  14306. var i = -1;
  14307. var n = values.length;
  14308. var xi;
  14309. while (++i < n) {
  14310. xi = ""+(values[i]);
  14311. if (!(this.index.has(xi))) {
  14312. this._domain.push(values[i]);
  14313. this.index.set(xi, this._domain.length);
  14314. }
  14315. }
  14316. if ("range" == this.ranger.t) {
  14317. return this.range(this.ranger.a);
  14318. }
  14319. if ("rangeBands" == this.ranger.t) {
  14320. return this.rangeBands(this.ranger.a, this.ranger.padding, this.ranger.outerPadding);
  14321. }
  14322. if ("rangePoints" == this.ranger.t) {
  14323. return this.rangePoints(this.ranger.a, this.ranger.padding);
  14324. }
  14325. if ("rangeRoundBands" == this.ranger.t) {
  14326. return this.rangeRoundBands(this.ranger.a, this.ranger.padding, this.ranger.outerPadding);
  14327. }
  14328. if ("rangeRoundPoints" == this.ranger.t) {
  14329. return this.rangeRoundPoints(this.ranger.a, this.ranger.padding);
  14330. }
  14331. return this;
  14332. },
  14333. domain$1 : function() {
  14334. return this._domain;
  14335. },
  14336. range$0 : function(values) {
  14337. this._range = values;
  14338. this.ranger = new com_ibm_rave_core_internal_scales_Ranger("range", values, 0, 0);
  14339. this._rangeBand = 0;
  14340. return this;
  14341. },
  14342. range$1 : function() {
  14343. return this._range;
  14344. },
  14345. /** @expose */
  14346. copy : function() {
  14347. return new com_ibm_rave_core_scales_OrdinalScale(this._domain, this.ranger, this._viewZoom, this._viewOffset);
  14348. },
  14349. /**
  14350. * Sets the output range values based on the specified continuous interval. The interval is subdivided into <i>n</i> evenly spaced points, where <i>n</i> is the number of unique values in the input domain. <pre> Example: {@code rave.scale.ordinal().domain([1, 2, 3, 4]).rangePoints([0, 100], 0).range(); // returns [0, 33.333333333333336, 66.66666666666667, 100]} </pre>
  14351. * @param (Array) interval 2 element array containing minimum and maximum numeric values.
  14352. * @param (Number) padding Offset from the edge of the interval, as a multiple of the distance between points.
  14353. * @return (com.ibm.rave.core.scales.OrdinalScale) This Scale.
  14354. */
  14355. /** @expose */
  14356. rangePoints : function(interval, padding) {
  14357. if (padding == null) {
  14358. padding = 0.0;
  14359. }
  14360. var start = + (interval[0]);
  14361. var stop = + (interval[1]);
  14362. var step = this._domain.length < 2 ? (start = (start + stop) / 2) : (stop - start) / (this._domain.length - 1 + padding);
  14363. this._range = this.steps(start + step * padding / 2, step);
  14364. this._rangeBand = 0.0;
  14365. this.ranger = new com_ibm_rave_core_internal_scales_Ranger("rangePoints", interval, padding, 0);
  14366. return this;
  14367. },
  14368. /**
  14369. * Like rangePoints, except guarantees that the range values are integers so as to avoid antialiasing artifacts.
  14370. * @param (Array) interval 2 element array containing minimum and maximum numeric values.
  14371. * @param (Number) padding Offset from the edge of the interval, as a multiple of the distance between points.
  14372. * @return (com.ibm.rave.core.scales.OrdinalScale) the scale
  14373. */
  14374. /** @expose */
  14375. rangeRoundPoints : function(interval, padding) {
  14376. if (padding == null) {
  14377. padding = 0.0;
  14378. }
  14379. var start = + (interval[0]);
  14380. var stop = + (interval[1]);
  14381. var step;
  14382. if (this._domain.length < 2) {
  14383. start = Math.round((start + stop) / 2);
  14384. stop = start;
  14385. step = start;
  14386. } else {
  14387. step = ~~((stop - start) / (this._domain.length - 1 + padding));
  14388. }
  14389. this._range = this.steps(start + Math.round(step * padding / 2 + (stop - start - (this._domain.length - 1 + padding) * step) / 2), step);
  14390. this._rangeBand = 0.0;
  14391. this.ranger = new com_ibm_rave_core_internal_scales_Ranger("rangeRoundPoints", interval, padding, 0);
  14392. return this;
  14393. },
  14394. /**
  14395. * Sets the output range values based on the specified continuous interval. The interval is subdivided into <i>n</i> evenly spaced <b>bands</b>, where <i>n</i> is the number of unique values in the input domain. <br/><br/> <pre> Example: {@code var o = d3.scale.ordinal().domain([1, 2, 3, 4]).rangeBands([0, 100]); o.rangeBand(); // returns 25 o.range(); // returns [0, 25, 50, 75] o.rangeExtent(); // returns [0, 100]} </pre>
  14396. * @param (Array) interval 2 element array containing minimum and maximum numeric values.
  14397. * @param (Number) padding Offset between bands, as a value in the range [0, 1] which is a multiple of the width of each band. If null, is set to 0.
  14398. * @param (Number) outerPadding Offset between the entire group of bands and the edge of the interval. A value 0 means there will only be padding between each band. If null, is set to padding.
  14399. * @return (com.ibm.rave.core.scales.OrdinalScale) This Scale.
  14400. */
  14401. /** @expose */
  14402. rangeBands : function(interval, padding, outerPadding) {
  14403. if (padding == null) {
  14404. padding = 0.0;
  14405. }
  14406. if (outerPadding == null) {
  14407. outerPadding = padding;
  14408. }
  14409. var interval0 = + (interval[0]);
  14410. var interval1 = + (interval[1]);
  14411. var reverse = interval1 < interval0;
  14412. var start = reverse ? interval1 : interval0;
  14413. var stop = reverse ? interval0 : interval1;
  14414. var step = (stop - start) / (this._domain.length - padding + 2 * outerPadding);
  14415. this._range = this.steps(start + step * outerPadding, step);
  14416. if (reverse) {
  14417. var temp;
  14418. for (var i = 0; i < this._range.length / 2; ++i) {
  14419. temp = this._range[i];
  14420. var value = this._range[this._range.length - 1 - i];
  14421. this._range[i] = value;
  14422. this._range[this._range.length - 1 - i] = temp;
  14423. }
  14424. }
  14425. this._rangeBand = step * (1 - padding);
  14426. this.ranger = new com_ibm_rave_core_internal_scales_Ranger("rangeBands", interval, padding, outerPadding);
  14427. return this;
  14428. },
  14429. /**
  14430. * Very similar to {@link #this.rangeBands(Array, Number, Number)} , but rounds band width and offsets to integer values.
  14431. * @param (Array) interval 2 element array containing minimum and maximum numeric values.
  14432. * @param (Number) padding Offset between bands, as a value in the range [0, 1] which is a multiple of the width of each band. If null, is set to 0.
  14433. * @param (Number) outerPadding Offset between the entire group of bands and the edge of the interval. A value 0 means there will only be padding between each band. If null, is set to padding.
  14434. * @return (com.ibm.rave.core.scales.OrdinalScale) This Scale.
  14435. */
  14436. /** @expose */
  14437. rangeRoundBands : function(interval, padding, outerPadding) {
  14438. if (padding == null) {
  14439. padding = 0.0;
  14440. }
  14441. if (outerPadding == null) {
  14442. outerPadding = padding;
  14443. }
  14444. var interval0 = + (interval[0]);
  14445. var interval1 = + (interval[1]);
  14446. var reverse = interval1 < interval0;
  14447. var start = reverse ? interval1 : interval0;
  14448. var stop = reverse ? interval0 : interval1;
  14449. var step = Math.floor((stop - start) / (this._domain.length - padding + 2 * outerPadding));
  14450. this._range = this.steps(start + Math.round((stop - start - (this._domain.length - padding) * step) / 2), step);
  14451. if (reverse) {
  14452. var temp;
  14453. for (var i = 0; i < this._range.length / 2; ++i) {
  14454. temp = this._range[i];
  14455. var value = this._range[this._range.length - 1 - i];
  14456. this._range[i] = value;
  14457. this._range[this._range.length - 1 - i] = temp;
  14458. }
  14459. }
  14460. this._rangeBand = Math.round(step * (1 - padding));
  14461. this.ranger = new com_ibm_rave_core_internal_scales_Ranger("rangeRoundBands", interval, padding, outerPadding);
  14462. return this;
  14463. },
  14464. /**
  14465. * Calculate discrete range values (steps) for each ordinal domain value.
  14466. * @param (double) start The starting range value, e.g. left-most pixel position.
  14467. * @param (double) step The distance between each range value, e.g. pixel distance.
  14468. * @return (Array) Array of range values.
  14469. */
  14470. steps : function(start, step) {
  14471. var rangeSteps = new Array(this._domain.length);
  14472. for (var i = 0; i < this._domain.length; ++i) {
  14473. rangeSteps[i] = start + step * i;
  14474. }
  14475. return rangeSteps;
  14476. },
  14477. /**
  14478. * Transform a range value by the current view transform. If the range value is not numeric, it is returned unchanged.
  14479. * @param (Object) r Ordinal range value.
  14480. * @return (Object) Range value transformed to current view space.
  14481. */
  14482. transformRangeValue : function(r) {
  14483. if (com_ibm_rave_core_internal_nativeImpl_Lang.isNumber(r) && this.zoomTransformIsModified()) {
  14484. return (+ (r) * this._viewZoom) + this._viewOffset;
  14485. }
  14486. return r;
  14487. },
  14488. /**
  14489. * Returns true if the zoom scale or offset is not the identity transform (1x zoom, 0 offset), false otherwise.
  14490. */
  14491. zoomTransformIsModified : function() {
  14492. return this._viewOffset != 0.0 || this._viewZoom != 1.0;
  14493. },
  14494. /** @expose */
  14495. domain : function(a0) {
  14496. var args = arguments;
  14497. if (args.length == 0) {
  14498. return this.domain$1();
  14499. }
  14500. return this.domain$0(a0);
  14501. },
  14502. /** @expose */
  14503. range : function(a0) {
  14504. var args = arguments;
  14505. if (args.length == 0) {
  14506. return this.range$1();
  14507. }
  14508. return this.range$0(a0);
  14509. }
  14510. });
  14511. /** @expose */
  14512. com_ibm_rave_core_scales_OrdinalScale.DEFAULT_RANGER = new com_ibm_rave_core_internal_scales_Ranger("range", [], 0, 0);
  14513. // $source: com/ibm/rave/core/scales/QuantizeScale
  14514. /************************************************************************
  14515. ** IBM Confidential
  14516. **
  14517. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  14518. **
  14519. ** (C) Copyright IBM Corp. 2015
  14520. **
  14521. ** The source code for this program is not published or otherwise divested of its trade secrets,
  14522. ** irrespective of what has been deposited with the U.S. Copyright Office.
  14523. ************************************************************************/
  14524. // GENERATED
  14525. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  14526. //@import com/ibm/rave/core/scales/AbstractScale (loadtime) // superclass
  14527. /**
  14528. * Quantize scales are a variant of linear scales with a discrete rather than continuous range. The input domain is still continuous, and divided into uniform segments based on the number of values in (the cardinality of) the output range. The mapping is linear in that the output range value y can be expressed as a linear function of the input domain value x: y = mx + b. The input domain is typically a dimension of the data that you want to visualize, such as the height of students (measured in meters) in a sample population. The output range is typically a dimension of the desired output visualization, such as the height of bars (measured in pixels) in a histogram.
  14529. */
  14530. var com_ibm_rave_core_scales_QuantizeScale = rave_externs["QuantizeScale"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scales_AbstractScale, {
  14531. //_range : null,
  14532. kx : 0,
  14533. i : 0,
  14534. x0 : 0,
  14535. x1 : 0,
  14536. _$functionClassMethod : function() {
  14537. var _$self = /**
  14538. * Given a value data in the input domain, returns the corresponding value in the output range
  14539. * @param (Object) this the context in which this method is invoked
  14540. * @param (Object) data a data value, may be <code>null</code>
  14541. * @param (int) index the index of the current scene node
  14542. * @param (int) groupIndex the group index of the current scene node
  14543. * @return (Object) the value in the output range for a given data
  14544. */
  14545. function(data, index, groupIndex) {
  14546. if (data===undefined || isNaN(data)) {
  14547. return undefined;
  14548. }
  14549. var x = + (data);
  14550. return _$self._range[~~Math.max(0.0, Math.min(_$self.i, Math.floor(_$self.kx * (x - _$self.x0))))];
  14551. };
  14552. return _$self;
  14553. },
  14554. /**
  14555. * Maintains kx and i up to date, after domain or range is set.
  14556. * @return (com.ibm.rave.core.scales.QuantizeScale) this scale
  14557. */
  14558. rescale : function() {
  14559. this.kx = this._range.length / (this.x1 - this.x0);
  14560. this.i = this._range.length - 1;
  14561. return this;
  14562. },
  14563. /**
  14564. * Set the scale's input domain
  14565. * @param (Array) values of domain values
  14566. * @return (com.ibm.rave.core.scales.AbstractScale) this scale
  14567. */
  14568. domain$0 : function(values) {
  14569. this.x0 = + (values[0]);
  14570. this.x1 = + (values[values.length - 1]);
  14571. return this.rescale();
  14572. },
  14573. /**
  14574. * Get the scale's domain.
  14575. * @return (Array) Array of domain values
  14576. */
  14577. domain$1 : function() {
  14578. var temp = [];
  14579. temp.push(this.x0);
  14580. temp.push(this.x1);
  14581. return temp;
  14582. },
  14583. /**
  14584. * Get the scale's range.
  14585. * @return (Array) Array of range values.
  14586. */
  14587. range$1 : function() {
  14588. return this._range;
  14589. },
  14590. /**
  14591. * Set the scale's output range.
  14592. * @param (Array) values List of scale output range
  14593. * @return (com.ibm.rave.core.scales.AbstractScale) this scale
  14594. */
  14595. range$0 : function(values) {
  14596. this._range = values;
  14597. return this.rescale();
  14598. },
  14599. /**
  14600. * Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa.
  14601. * @return (com.ibm.rave.core.scales.AbstractScale) a defensive copy of this scale
  14602. */
  14603. /** @expose */
  14604. copy : function() {
  14605. var scale = new com_ibm_rave_core_scales_QuantizeScale();
  14606. scale.range(this._range);
  14607. var tempList = [];
  14608. tempList.push(this.x0);
  14609. tempList.push(this.x1);
  14610. scale.domain(tempList);
  14611. return scale;
  14612. },
  14613. /**
  14614. * Returns the extent of values in the input domain [x0, x1] for the corresponding value in the output range y, representing the inverse mapping from range to domain. This method is useful for interaction, say to determine the value in the input domain that corresponds to the pixel location under the mouse.
  14615. * @param (Object) givenRange the range to which the method returns the corresponding input domain
  14616. * @return (Array) values in the input domain [x0,x1]
  14617. */
  14618. /** @expose */
  14619. invertExtent : function(givenRange) {
  14620. givenRange = this._range.indexOf(givenRange);
  14621. var idx = + (givenRange);
  14622. idx = idx < 0 ? NaN : idx / this.kx + this.x0;
  14623. var tempList = [];
  14624. tempList.push(idx);
  14625. tempList.push(idx + 1 / this.kx);
  14626. return tempList;
  14627. },
  14628. /** @expose */
  14629. domain : function(a0) {
  14630. var args = arguments;
  14631. if (args.length == 0) {
  14632. return this.domain$1();
  14633. }
  14634. return this.domain$0(a0);
  14635. },
  14636. /** @expose */
  14637. range : function(a0) {
  14638. var args = arguments;
  14639. if (args.length == 0) {
  14640. return this.range$1();
  14641. }
  14642. return this.range$0(a0);
  14643. }
  14644. });
  14645. // $source: com/ibm/rave/core/scales/QuantileScale
  14646. /************************************************************************
  14647. ** IBM Confidential
  14648. **
  14649. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  14650. **
  14651. ** (C) Copyright IBM Corp. 2015
  14652. **
  14653. ** The source code for this program is not published or otherwise divested of its trade secrets,
  14654. ** irrespective of what has been deposited with the U.S. Copyright Office.
  14655. ************************************************************************/
  14656. // GENERATED
  14657. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  14658. //@import com/ibm/rave/core/scales/AbstractScale (loadtime) // superclass
  14659. //@import com/ibm/rave/core/arrays/Quantile (runtime) // quantile
  14660. //@import com/ibm/rave/core/Rave (runtime) // Rave
  14661. /**
  14662. * Quantile scales map an input domain to a discrete range. Although the input domain is continuous and the scale will accept any reasonable input value, the input domain is specified as a discrete set of values. The number of values in (the cardinality of) the output range determines the number of quantiles that will be computed from the input domain. To compute the quantiles, the input domain is sorted, and treated as a population of discrete values. The input domain is typically a dimension of the data that you want to visualize, such as the daily change of the stock market. The output range is typically a dimension of the desired output visualization, such as a diverging color scale.
  14663. */
  14664. var com_ibm_rave_core_scales_QuantileScale = rave_externs["QuantileScale"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scales_AbstractScale, {
  14665. //thresholds : null,
  14666. //_domain : null,
  14667. //_range : null,
  14668. _$functionClassMethod : function() {
  14669. var _$self = /**
  14670. * Given a value x in the input domain, returns the corresponding value in the output range.
  14671. * @param (Object) this the context in which this method is invoked
  14672. * @param (Object) data a data value, may be <code>null</code>
  14673. * @param (int) index the index of the current scene node
  14674. * @param (int) groupIndex the group index of the current scene node
  14675. * @return (Object) the value in the range mapping to the value provided in the domain
  14676. */
  14677. function(data, index, groupIndex) {
  14678. if (!(isNaN(data))) {
  14679. return _$self.range()[com_ibm_rave_core_Rave.bisect(_$self.thresholds, data)];
  14680. }
  14681. return undefined;
  14682. };
  14683. return _$self;
  14684. },
  14685. constructor : function(domain, range) {
  14686. this.thresholds = [];
  14687. this._domain = [];
  14688. this._range = [];
  14689. /**
  14690. * Create a new {@link (com.ibm.rave.core.scales.QuantileScale) QuantileScale} with the provided domain and range
  14691. * @param (Array) domain
  14692. * @param (Array) range
  14693. */
  14694. {
  14695. this.domain(domain);
  14696. this.range(range);
  14697. }
  14698. },
  14699. /**
  14700. * Iterate using range size and override thresholds values with the result of p-quantile of the domain using p = i/rangeSize
  14701. * @return (com.ibm.rave.core.scales.QuantileScale) this
  14702. */
  14703. rescale : function() {
  14704. var i = 0;
  14705. var rangeSize = this.range().length;
  14706. this.thresholds = [];
  14707. while (++i < rangeSize) {
  14708. this.thresholds.splice(i - 1, 0, com_ibm_rave_core_arrays_Quantile.quantile(this._domain, + (i) / + (rangeSize)));
  14709. }
  14710. return this;
  14711. },
  14712. /**
  14713. * Sets the scales input domain
  14714. * @param (Array) values the list of values for the input domain
  14715. * @return (com.ibm.rave.core.scales.AbstractScale) this
  14716. */
  14717. domain$0 : function(values) {
  14718. var rave_number = function(currentValue, index, array) {
  14719. return currentValue == null ? NaN : + (currentValue);
  14720. };
  14721. var rave_numeric = function(currentValue, index, array) {
  14722. return !(isNaN(currentValue));
  14723. };
  14724. var ascending = function(obj1, obj2) {
  14725. return ~~(obj1 < obj2 ? -1 : obj1 > obj2 ? 1 : obj1 >= obj2 ? 0 : NaN);
  14726. };
  14727. this._domain = values.map(rave_number).filter(rave_numeric).sort(ascending);
  14728. return this.rescale();
  14729. },
  14730. /**
  14731. * Set the scale's output range.
  14732. * @param (Array) values List of range values
  14733. * @return (com.ibm.rave.core.scales.AbstractScale) this
  14734. */
  14735. range$0 : function(values) {
  14736. this._range = values;
  14737. return this.rescale();
  14738. },
  14739. /**
  14740. * Get the scale's domain
  14741. * @return (Array) List of domain values
  14742. */
  14743. domain$1 : function() {
  14744. return this._domain;
  14745. },
  14746. /**
  14747. * Get the scale's range
  14748. * @return (Array) List of range values
  14749. */
  14750. range$1 : function() {
  14751. return this._range;
  14752. },
  14753. /**
  14754. * Returns the quantile thresholds. If the output range contains n discrete values, the returned threshold array will contain n - 1 values. Values less than the first element in the thresholds array, quantiles()[0], are considered in the first quantile; greater values less than the second threshold are in the second quantile, and so on. Internally, the thresholds array is used with d3.bisect to find the output quantile associated with the given input value.
  14755. * @return (Array) The quantile thresholds
  14756. */
  14757. /** @expose */
  14758. quantiles : function() {
  14759. return this.thresholds;
  14760. },
  14761. /**
  14762. * Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa
  14763. * @return (com.ibm.rave.core.scales.AbstractScale) defensive copy of this scale
  14764. */
  14765. /** @expose */
  14766. copy : function() {
  14767. return new com_ibm_rave_core_scales_QuantileScale(this._domain, this._range);
  14768. },
  14769. /**
  14770. * Returns the extent of values in the input domain [x0, x1] for the corresponding value in the output range y, representing the inverse mapping from range to domain. This method is useful for interaction, say to determine the value in the input domain that corresponds to the pixel location under the mouse.
  14771. * @param (Object) y the value in output range
  14772. * @return (Array) the extent of values in the input domain corresponding to the provided output range y
  14773. */
  14774. /** @expose */
  14775. invertExtent : function(y) {
  14776. var index = this._range.indexOf(y);
  14777. var temp = [];
  14778. if (index < 0) {
  14779. temp.push(NaN);
  14780. temp.push(NaN);
  14781. return temp;
  14782. } else {
  14783. temp.push(index > 0 ? this.thresholds[index - 1] : this._domain[0]);
  14784. temp.push(index < this.thresholds.length ? this.thresholds[index] : this._domain[this._domain.length - 1]);
  14785. return temp;
  14786. }
  14787. },
  14788. /** @expose */
  14789. domain : function(a0) {
  14790. var args = arguments;
  14791. if (args.length == 0) {
  14792. return this.domain$1();
  14793. }
  14794. return this.domain$0(a0);
  14795. },
  14796. /** @expose */
  14797. range : function(a0) {
  14798. var args = arguments;
  14799. if (args.length == 0) {
  14800. return this.range$1();
  14801. }
  14802. return this.range$0(a0);
  14803. }
  14804. });
  14805. // $source: com/ibm/rave/core/scales/LogScale
  14806. /************************************************************************
  14807. ** IBM Confidential
  14808. **
  14809. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  14810. **
  14811. ** (C) Copyright IBM Corp. 2015
  14812. **
  14813. ** The source code for this program is not published or otherwise divested of its trade secrets,
  14814. ** irrespective of what has been deposited with the U.S. Copyright Office.
  14815. ************************************************************************/
  14816. // GENERATED
  14817. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  14818. //@import com/ibm/rave/core/scales/AbstractScale (loadtime) // scaleExtent, superclass
  14819. //@import com/ibm/rave/core/locale/NumberFormat (runtime) // new
  14820. //@import com/ibm/rave/core/locale/Locale (runtime) // Locale
  14821. //@import com/ibm/rave/core/internal/scales/Nice (runtime) // scaleNice
  14822. //@import com/ibm/rave/core/internal/scales/NiceIdentity (static) // new
  14823. /**
  14824. * Log scales are similar to Linear scales, but have a logarithmic transform applied to the input value. The log scale domain must be either exclusively positive or exclusively negative; behaviour is undefined when a negative value is applied to a log scale with a positive domain, and vice-versa.
  14825. */
  14826. var com_ibm_rave_core_scales_LogScale = rave_externs["LogScale"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scales_AbstractScale, {
  14827. //_linear : null,
  14828. //_base : null,
  14829. //_positive : null,
  14830. //_domain : null,
  14831. _$functionClassMethod : function() {
  14832. var _$self = function(data, index, groupIndex) {
  14833. return _$self._linear.call(this, _$self.log(+ (data)), index, groupIndex);
  14834. };
  14835. return _$self;
  14836. },
  14837. /** @expose */
  14838. constructor : function(linear, base, positive, domain) {
  14839. this._linear = linear;
  14840. this._base = base;
  14841. this._positive = positive;
  14842. this._domain = domain;
  14843. if (!com_ibm_rave_core_scales_LogScale.logFormat) {
  14844. {
  14845. if (!com_ibm_rave_core_scales_LogScale.logFormat) {
  14846. com_ibm_rave_core_scales_LogScale.logFormat = new com_ibm_rave_core_locale_NumberFormat(com_ibm_rave_core_locale_Locale.DEFAULT_LOCALE)(".0e");
  14847. }
  14848. }
  14849. }
  14850. var self = this;
  14851. this.ticks = function(tickArguments) {
  14852. if (tickArguments !== null || arguments.length > 1){
  14853. tickArguments = Array.prototype.slice.call(arguments);
  14854. }
  14855. {
  14856. return self.logTicks.apply(self, tickArguments);
  14857. }
  14858. };
  14859. this.tickFormat = function(tickArguments) {
  14860. if (tickArguments !== null || arguments.length > 1){
  14861. tickArguments = Array.prototype.slice.call(arguments);
  14862. }
  14863. {
  14864. var count = tickArguments.length > 0 ? + (tickArguments[0]) : null;
  14865. var format = tickArguments.length > 1 ? tickArguments[1] : null;
  14866. return self.logTickFormat(count, format);
  14867. }
  14868. };
  14869. this.invert = function(y) {
  14870. return self.pow(+ (self._linear.invert(y)));
  14871. };
  14872. },
  14873. domain$0 : function(values) {
  14874. this._positive = + (values[0]) >= 0;
  14875. this._domain = new Array(values.length);
  14876. for (var i = 0; i < values.length; ++i) {
  14877. this._domain[i] = + (values[i]);
  14878. }
  14879. var self = this;
  14880. this._linear.domain$0(this._domain.map(function(currentValue, index, array) {
  14881. return self.log(+ (currentValue));
  14882. }));
  14883. return this;
  14884. },
  14885. domain$1 : function() {
  14886. return this._domain;
  14887. },
  14888. range$0 : function(values) {
  14889. this._linear.range$0(values);
  14890. return this;
  14891. },
  14892. range$1 : function() {
  14893. return this._linear.range$1();
  14894. },
  14895. /** @expose */
  14896. copy : function() {
  14897. return new com_ibm_rave_core_scales_LogScale(this._linear.copy(), this._base, this._positive, this._domain);
  14898. },
  14899. /**
  14900. * Enable or disable clamping. With clamping enable for a quantitative scale, any scale input value outside the specified domain will produce a value that is clamped to the end of the specified range.
  14901. * @param (boolean) c True or False to Enable or Disable (respectively) clamping.
  14902. * @return (com.ibm.rave.core.scales.LogScale) This scale.
  14903. */
  14904. clamp$0 : function(c) {
  14905. this._linear.clamp$0(c);
  14906. return this;
  14907. },
  14908. /**
  14909. * Returns true if clamping is enabled, false otherwise.
  14910. * @return (boolean) Clamp state.
  14911. */
  14912. clamp$1 : function() {
  14913. return this._linear.clamp$1();
  14914. },
  14915. /**
  14916. * Convenience method that will round the scale output values to whole numbers.
  14917. * @param (Array) x Output range values.
  14918. * @return (com.ibm.rave.core.scales.LogScale) This scale.
  14919. */
  14920. /** @expose */
  14921. rangeRound : function(x) {
  14922. this._linear.rangeRound(x);
  14923. return this;
  14924. },
  14925. /**
  14926. * Set the interpolator.
  14927. * @param (com.ibm.rave.core.interpolate.InterpolatorFactory) interpolate The interpolator factory to assign to this scale
  14928. * @return (com.ibm.rave.core.scales.LogScale) This scale.
  14929. */
  14930. interpolate$0 : function(interpolate) {
  14931. this._linear.interpolate$0(interpolate);
  14932. return this;
  14933. },
  14934. /**
  14935. * @return (Object) The interpolator assigned to this scale.
  14936. */
  14937. interpolate$1 : function() {
  14938. return this._linear.interpolate$1();
  14939. },
  14940. /**
  14941. * Extends the domain start and end values to "nice" round values. These "nice" values are primarily determined by the base power, which defaults to 10. For example, given a domain [0.20147..., 0.99667...], the "niced" domain would be [0.1, 1].
  14942. * @return (com.ibm.rave.core.scales.LogScale) This scale.
  14943. */
  14944. /** @expose */
  14945. nice : function() {
  14946. var self = this;
  14947. var niced = com_ibm_rave_core_internal_scales_Nice.scaleNice(this._domain.map(function(currentValue, index, array) {
  14948. return self.log(+ (currentValue));
  14949. }), this._positive ? com_ibm_rave_core_scales_LogScale.logNice : com_ibm_rave_core_scales_LogScale.logNiceNegative);
  14950. this._linear.domain(niced);
  14951. this._domain = niced.map(function(currentValue, index, array) {
  14952. return self.pow(+ (currentValue));
  14953. });
  14954. return this;
  14955. },
  14956. /**
  14957. * Set the log base value.
  14958. * @param (Number) b New base value.
  14959. * @return (com.ibm.rave.core.scales.LogScale) This LogScale.
  14960. */
  14961. base$0 : function(b) {
  14962. this._base = b;
  14963. return this;
  14964. },
  14965. /**
  14966. * Get the current log base value.
  14967. */
  14968. base$1 : function() {
  14969. return this._base;
  14970. },
  14971. log : function(x) {
  14972. return (this._positive ? Math.log(x < 0 ? 0 : x) : -Math.log(x > 0 ? 0 : -x)) / Math.log(this._base);
  14973. },
  14974. pow : function(x) {
  14975. return this._positive ? Math.pow(this._base, x) : -Math.pow(this._base, -x);
  14976. },
  14977. /**
  14978. * Implementation of the LogScale#ticks method from D3.
  14979. * @param (java.lang.Object[]) tickArguments Arguments passed to the scale from Axis (in the case of log scales, no arguments are required).
  14980. * @return (Array) Array of tick values.
  14981. */
  14982. logTicks : function(tickArguments) {
  14983. if (tickArguments !== null || arguments.length > 1){
  14984. tickArguments = Array.prototype.slice.call(arguments);
  14985. }
  14986. {
  14987. var extent = com_ibm_rave_core_scales_AbstractScale.scaleExtent(this._domain);
  14988. var ticks = [];
  14989. var u = + (extent[0]);
  14990. var v = + (extent[1]);
  14991. var i = Math.floor(this.log(u));
  14992. var j = Math.ceil(this.log(v));
  14993. var n = this._base % 1 == 0 ? this._base : 2;
  14994. var delta = j - i;
  14995. if (isFinite(delta)) {
  14996. if (this._positive) {
  14997. for (; i < j; ++i) {
  14998. for (var k = 1.0; k < n; ++k) {
  14999. ticks.push(this.pow(i) * k);
  15000. }
  15001. }
  15002. ticks.push(this.pow(i));
  15003. } else {
  15004. ticks.push(this.pow(i));
  15005. for (; i++ < j;) {
  15006. for (var k = n - 1; k > 0; --k) {
  15007. ticks.push(this.pow(i) * k);
  15008. }
  15009. }
  15010. }
  15011. for (i = 0.0; ticks[~~i] < u; ++i) {
  15012. }
  15013. for (j = (ticks.length); ticks[~~j - 1] > v; --j) {
  15014. }
  15015. ticks = ticks.slice(~~i, ~~j);
  15016. }
  15017. return (ticks);
  15018. }
  15019. },
  15020. /**
  15021. * Implementation of the LogScale#tickFormat method from D3.
  15022. * @param (Number) count Number of ticks that should be displayed. Optional.
  15023. * @param (Object) formatter A String format specifier, or a function ( {@link NumberFormatValueFunction} ) which will override the default format function.
  15024. * @return (com.ibm.rave.core.selector.ValueFunction) A number formatter function.
  15025. */
  15026. logTickFormat : function(count, formatter) {
  15027. if (count == null && formatter == null) {
  15028. return com_ibm_rave_core_scales_LogScale.logFormat;
  15029. }
  15030. var format;
  15031. if (formatter == null) {
  15032. format = com_ibm_rave_core_scales_LogScale.logFormat;
  15033. } else if (typeof formatter === "function") {
  15034. format = formatter;
  15035. } else {
  15036. format = new com_ibm_rave_core_locale_NumberFormat(com_ibm_rave_core_locale_Locale.DEFAULT_LOCALE)(""+(formatter));
  15037. }
  15038. var n = + (count);
  15039. var k = Math.max(0.1, n / this.ticks().length);
  15040. var e = this._positive ? 1e-12 : -1e-12;
  15041. var f = this._positive ? com_ibm_rave_core_scales_LogScale.ceilRoundFunc : com_ibm_rave_core_scales_LogScale.floorRoundFunc;
  15042. var self = this;
  15043. return function(data, index, groupIndex) {
  15044. var value = + (data);
  15045. return value / self.pow(f(self.log(value) + e)) <= k ? format.call(this, value, index, groupIndex) : "";
  15046. };
  15047. },
  15048. /** @expose */
  15049. domain : function(a0) {
  15050. var args = arguments;
  15051. if (args.length == 0) {
  15052. return this.domain$1();
  15053. }
  15054. return this.domain$0(a0);
  15055. },
  15056. /** @expose */
  15057. range : function(a0) {
  15058. var args = arguments;
  15059. if (args.length == 0) {
  15060. return this.range$1();
  15061. }
  15062. return this.range$0(a0);
  15063. },
  15064. /** @expose */
  15065. clamp : function(a0) {
  15066. var args = arguments;
  15067. if (args.length == 0) {
  15068. return this.clamp$1();
  15069. }
  15070. return this.clamp$0(a0);
  15071. },
  15072. /** @expose */
  15073. interpolate : function(a0) {
  15074. var args = arguments;
  15075. if (args.length == 0) {
  15076. return this.interpolate$1();
  15077. }
  15078. return this.interpolate$0(a0);
  15079. },
  15080. /** @expose */
  15081. base : function(a0) {
  15082. var args = arguments;
  15083. if (args.length == 0) {
  15084. return this.base$1();
  15085. }
  15086. return this.base$0(a0);
  15087. }
  15088. });
  15089. /** @expose */
  15090. com_ibm_rave_core_scales_LogScale.DEFAULT_BASE = 10.0;
  15091. //com_ibm_rave_core_scales_LogScale.logFormat = null;
  15092. com_ibm_rave_core_scales_LogScale.logNice = new com_ibm_rave_core_internal_scales_NiceIdentity(function(x) {
  15093. return Math.floor(x);
  15094. }, function(x) {
  15095. return Math.ceil(x);
  15096. });
  15097. com_ibm_rave_core_scales_LogScale.logNiceNegative = new com_ibm_rave_core_internal_scales_NiceIdentity(function(x) {
  15098. return -Math.ceil(-x);
  15099. }, function(x) {
  15100. return -Math.floor(-x);
  15101. });
  15102. com_ibm_rave_core_scales_LogScale.ceilRoundFunc = function(v) {
  15103. return Math.ceil(v);
  15104. };
  15105. com_ibm_rave_core_scales_LogScale.floorRoundFunc = function(v) {
  15106. return Math.floor(v);
  15107. };
  15108. // $source: com/ibm/rave/core/locale/LocaleFormatter
  15109. /************************************************************************
  15110. ** IBM Confidential
  15111. **
  15112. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  15113. **
  15114. ** (C) Copyright IBM Corp. 2015
  15115. **
  15116. ** The source code for this program is not published or otherwise divested of its trade secrets,
  15117. ** irrespective of what has been deposited with the U.S. Copyright Office.
  15118. ************************************************************************/
  15119. // GENERATED
  15120. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  15121. //@import com/ibm/rave/core/locale/NumberFormat (runtime) // new
  15122. //@import com/ibm/rave/core/locale/TimeFormat (runtime) // new
  15123. //@import com/ibm/rave/core/globalization/BidiStringFormat (runtime) // new
  15124. var com_ibm_rave_core_locale_LocaleFormatter = rave_externs["LocaleFormatter"] = com_ibm_rave_core_nativeImpl_Declare({
  15125. /** @expose */
  15126. numberFormat : null,
  15127. /** @expose */
  15128. timeFormat : null,
  15129. /** @expose */
  15130. bidiStringFormat : null,
  15131. /**
  15132. * C'tor that sets the numberformat variable
  15133. * @param (com.ibm.rave.core.locale.LocaleObject) locale the locale that is meant to be used while formatting numbers
  15134. */
  15135. /** @expose */
  15136. constructor : function(locale) {
  15137. this.numberFormat = new com_ibm_rave_core_locale_NumberFormat(locale);
  15138. this.timeFormat = new com_ibm_rave_core_locale_TimeFormat(locale);
  15139. this.bidiStringFormat = new com_ibm_rave_core_globalization_BidiStringFormat(locale);
  15140. }
  15141. });
  15142. // $source: com/ibm/rave/core/locale/TimeFormatSpecifier
  15143. /************************************************************************
  15144. ** IBM Confidential
  15145. **
  15146. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  15147. **
  15148. ** (C) Copyright IBM Corp. 2015
  15149. **
  15150. ** The source code for this program is not published or otherwise divested of its trade secrets,
  15151. ** irrespective of what has been deposited with the U.S. Copyright Office.
  15152. ************************************************************************/
  15153. // GENERATED
  15154. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, bind
  15155. /**
  15156. * An abstract class which is extended by TimeFormat
  15157. */
  15158. var com_ibm_rave_core_locale_TimeFormatSpecifier = rave_externs["TimeFormatSpecifier"] = com_ibm_rave_core_nativeImpl_Declare({
  15159. /**
  15160. * Returns a new multi-resolution time format given the specified array of predicated formats. Each format is a two-element array consisting of a format specifier string (such as that passed to the rave.time.format constructor) and a predicate function. For any date that is passed to the returned time format, the first predicate function that returns true will determine how the specified date is formatted. For example, the default time format used by rave.time.scale is implemented as: var format = rave.time.format.multi([ [".%L", function(d) { return d.getMilliseconds(); }], [":%S", function(d) { return d.getSeconds(); }], ["%I:%M", function(d) { return d.getMinutes(); }], ["%I %p", function(d) { return d.getHours(); }], ["%a %d", function(d) { return d.getDay() && d.getDate() != 1; }], ["%b %d", function(d) { return d.getDate() != 1;}], ["%B", function(d) { return d.getMonth(); }], ["%Y", function() {return true; }] ]); Thus, if the specified date is not a round second, the milliseconds format (".%L") is used; otherwise, if the specified date is not a round minute, the seconds format (":%S") is used, and so on The multi method is available on any rave.time.format constructor. For example, rave.time.format.utc.multi returns a multi-resolution UTC time format, and locale.timeFormat.multi returns a multi-resolution time format for the specified locale.
  15161. * @param (java.lang.Object[][]) formats a 2D array containing the string format as well as a predicate ValueFunction.
  15162. * @return (com.ibm.rave.core.selector.ValueFunction) a new multi-resolution time format
  15163. */
  15164. /** @expose */
  15165. multi : com_ibm_rave_core_nativeImpl_Declare.bind(function(formats) {
  15166. var n = formats.length;
  15167. var i = -1;
  15168. while (++i < n) {
  15169. formats[i][0] = this(formats[i][0].toString());
  15170. }
  15171. return function(data, index, groupIndex) {
  15172. var z = 0;
  15173. var f = formats[z];
  15174. var formatter = f[1];
  15175. while (!((formatter.call(null, data, 0, 0)))) {
  15176. f = formats[++z];
  15177. formatter = f[1];
  15178. }
  15179. var firstFormatter = f[0];
  15180. return firstFormatter.call(null, data, 0, 0);
  15181. };
  15182. })
  15183. });
  15184. // $source: com/ibm/rave/core/time/FormatISO
  15185. /************************************************************************
  15186. ** IBM Confidential
  15187. **
  15188. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  15189. **
  15190. ** (C) Copyright IBM Corp. 2015
  15191. **
  15192. ** The source code for this program is not published or otherwise divested of its trade secrets,
  15193. ** irrespective of what has been deposited with the U.S. Copyright Office.
  15194. ************************************************************************/
  15195. // GENERATED
  15196. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  15197. //@import com/ibm/rave/core/time/Time (runtime) // getInstance
  15198. /**
  15199. * The full ISO 8601 UTC time format: "%Y-%m-%dT%H:%M:%S.%LZ". Where available, this method will use Date.toISOString to format and the Date constructor to parse strings. If you depend on strict validation of the input format according to ISO 8601, you should construct a time format explicitly instead: iso = rave.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");
  15200. */
  15201. var com_ibm_rave_core_time_FormatISO = rave_externs["FormatISO"] = com_ibm_rave_core_nativeImpl_Declare({
  15202. _$functionClassMethod : function() {
  15203. var _$self = /**
  15204. * Gets the result of toISOString
  15205. * @param (Object) date the date object to call toISOString()
  15206. * @return (String) the result of toISOString()
  15207. */
  15208. function(date, index, groupIndex) {
  15209. return (date).toISOString();
  15210. };
  15211. return _$self;
  15212. },
  15213. /**
  15214. * @return (String) the value of toString
  15215. */
  15216. /** @expose */
  15217. toString : function() {
  15218. return com_ibm_rave_core_time_Time.getInstance().format("%Y-%m-%dT%H:%M:%S.%LZ").toString();
  15219. },
  15220. /**
  15221. * Will return an ISO formatted date. If the String passed in was incorrect, this method will return null
  15222. * @param (String) str the iso date to be parsed
  15223. * @return (com.ibm.rave.core.time.IDate) An iso formatted date in the case that the string passed in was correct. Otherwise, returns null
  15224. */
  15225. /** @expose */
  15226. parse : function(str) {
  15227. if (str == null) {
  15228. return null;
  15229. }
  15230. var date = new Date(str);
  15231. return isNaN(date) ? null : date;
  15232. }
  15233. });
  15234. // $source: com/ibm/rave/core/time/Time
  15235. /************************************************************************
  15236. ** IBM Confidential
  15237. **
  15238. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  15239. **
  15240. ** (C) Copyright IBM Corp. 2015
  15241. **
  15242. ** The source code for this program is not published or otherwise divested of its trade secrets,
  15243. ** irrespective of what has been deposited with the U.S. Copyright Office.
  15244. ************************************************************************/
  15245. // GENERATED
  15246. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare anonymous, declare
  15247. //@import com/ibm/rave/core/time/DateTimeScale (runtime) // new, DateTimeScale
  15248. //@import com/ibm/rave/core/locale/TimeFormat (runtime) // new
  15249. //@import com/ibm/rave/core/locale/Locale (runtime) // Locale
  15250. //@import com/ibm/rave/core/time/Day (runtime) // Day
  15251. //@import com/ibm/rave/core/time/Hour (runtime) // Hour
  15252. //@import com/ibm/rave/core/time/Month (runtime) // Month
  15253. //@import com/ibm/rave/core/time/Year (runtime) // Year
  15254. //@import com/ibm/rave/core/time/Second (runtime) // Second
  15255. //@import com/ibm/rave/core/time/Minute (runtime) // Minute
  15256. //@import com/ibm/rave/core/time/Millisecond (runtime) // Millisecond
  15257. //@import com/ibm/rave/core/time/Week (runtime) // new
  15258. //@import com/ibm/rave/core/internal/time/TimeUtil (runtime) // dayOfYear
  15259. //@import com/ibm/rave/core/time/TimeIntervalUTC (runtime) // new
  15260. /**
  15261. * Time class from which time scales, time formats and time interval functionality may be accessed and used
  15262. */
  15263. var com_ibm_rave_core_time_Time = com_ibm_rave_core_nativeImpl_Declare({
  15264. /**
  15265. * Overrides the TimeScale methods utc() and scale()
  15266. */
  15267. /** @expose */
  15268. scale : null,
  15269. /**
  15270. * A helper module for parsing and formatting dates modeled after the venerable strptime and strftime C-library standards. These functions are also notably available in Python's time module.
  15271. */
  15272. /** @expose */
  15273. format : null,
  15274. /**
  15275. * A day interval. Most days are 24 hours long (864e5 milliseconds); however, with Daylight Savings Time, a day may be 23 or 25 hours long.
  15276. */
  15277. /** @expose */
  15278. day : null,
  15279. /**
  15280. * Hour time interval. 60 minutes long (36e5 milliseconds). Note that advancing time by one hour can return the same hour number, or skip an hour number, due to Daylight Savings Time.
  15281. */
  15282. /** @expose */
  15283. hour : null,
  15284. /**
  15285. * Months (e.g., February 1, 2012 at 12:00 AM). Ranges between 28 and 31 days.
  15286. */
  15287. /** @expose */
  15288. month : null,
  15289. /**
  15290. * Years (e.g., January 1, 2012 at 12:00 AM). Normal years are 365 days long; leap years are 366.
  15291. */
  15292. /** @expose */
  15293. year : null,
  15294. /**
  15295. * Seconds (e.g., 01:23:45.0000 AM). Always 1,000 milliseconds long.
  15296. */
  15297. /** @expose */
  15298. second : null,
  15299. /**
  15300. * Minutes (e.g., 01:02:00 AM). Most browsers do not support leap seconds, so minutes are almost always 60 seconds (6e4 milliseconds) long.
  15301. */
  15302. /** @expose */
  15303. minute : null,
  15304. /**
  15305. * Milliseconds (e.g., 01:02:00:001)
  15306. */
  15307. /** @expose */
  15308. millisecond : null,
  15309. /**
  15310. * Alias for rave.time.day.range. Returns the day boundaries (midnight) after or equal to start and before stop. If step is specified, then every step'th date will be returned, based on the day of the month. For example, a step of 2 will return the 1st, 3rd, 5th etc. of the month.
  15311. */
  15312. /** @expose */
  15313. days : null,
  15314. /**
  15315. * Alias for rave.time.year.range. Returns the year boundaries (midnight January 1st) after or equal to start and before stop. If step is specified, then every step'th year will be returned. For example, a step of 5 will return 2010, 2015, 2020, etc.
  15316. */
  15317. /** @expose */
  15318. years : null,
  15319. /**
  15320. * Alias for rave.time.month.range. Returns the month boundaries (e.g., January 01) after or equal to start and before stop. If step is specified, then every step'th month will be returned, based on the month of the year. For example, a step of 3 will return January, April, July, etc.
  15321. */
  15322. /** @expose */
  15323. months : null,
  15324. /**
  15325. * Alias for rave.time.hour.range. Returns the hour boundaries (e.g., 01 AM) after or equal to start and before stop. If step is specified, then every step'th hour will be returned, based on the hour of the day. For example, a step of 3 will return 9 PM, 12 AM, 3 AM, etc.
  15326. */
  15327. /** @expose */
  15328. hours : null,
  15329. /**
  15330. * Alias for rave.time.minute.range. Returns the minute boundaries (e.g., 01:23 AM) after or equal to start and before stop. If step is specified, then every step'th minute will be returned, based on the minute of the hour. For example, a step of 15 will return 9:45 PM, 10:00 PM, 10:15 PM, etc.
  15331. */
  15332. /** @expose */
  15333. minutes : null,
  15334. /**
  15335. * Alias for rave.time.second.range. Returns the second boundaries (e.g., 01:23:45 AM) after or equal to start and before stop. If step is specified, then every step'th second will be returned, based on the second of the minute. For example, a step of 15 will return 9:01:45 PM, 9:02:00 PM, 9:02:15 PM, etc.
  15336. */
  15337. /** @expose */
  15338. seconds : null,
  15339. /**
  15340. * Sunday-based weeks (e.g., February 5, 2012 at 12:00 AM)
  15341. */
  15342. /** @expose */
  15343. sunday : null,
  15344. /**
  15345. * Alias for rave.time.sunday. A week is always 7 days, but ranges between 167 and 169 hours depending on Daylight Savings Time.
  15346. */
  15347. /** @expose */
  15348. week : null,
  15349. /**
  15350. * Monday-based weeks (e.g., February 6, 2012 at 12:00 AM)
  15351. */
  15352. /** @expose */
  15353. monday : null,
  15354. /**
  15355. * Tuesday-based weeks (e.g., February 7, 2012 at 12:00 AM)
  15356. */
  15357. /** @expose */
  15358. tuesday : null,
  15359. /**
  15360. * Wednesday-based weeks (e.g., February 8, 2012 at 12:00 AM)
  15361. */
  15362. /** @expose */
  15363. wednesday : null,
  15364. /**
  15365. * Thursday-based weeks (e.g., February 9, 2012 at 12:00 AM)
  15366. */
  15367. /** @expose */
  15368. thursday : null,
  15369. /**
  15370. * Friday-based weeks (e.g., February 10, 2012 at 12:00 AM)
  15371. */
  15372. /** @expose */
  15373. friday : null,
  15374. /**
  15375. * Saturday-based weeks (e.g., February 11, 2012 at 12:00 AM)
  15376. */
  15377. /** @expose */
  15378. saturday : null,
  15379. /**
  15380. * Aliases for rave.time.<i>interval</i>.range etc. Returns the week boundaries (midnight Sunday) after or equal to start and before stop. If step is specified, then every step'th week will be returned, based on the week of the year. For example, a step of 4 will return January 2, January 30, February 27, etc.
  15381. */
  15382. /** @expose */
  15383. sundays : null,
  15384. /**
  15385. * Alias for sunday.range
  15386. */
  15387. /** @expose */
  15388. weeks : null,
  15389. /**
  15390. * Alias for monday.range
  15391. */
  15392. /** @expose */
  15393. mondays : null,
  15394. /**
  15395. * Alias for tuesday.range
  15396. */
  15397. /** @expose */
  15398. tuesdays : null,
  15399. /**
  15400. * Alias for wednesday.range
  15401. */
  15402. /** @expose */
  15403. wednesdays : null,
  15404. /**
  15405. * Alias for thursday.range
  15406. */
  15407. /** @expose */
  15408. thursdays : null,
  15409. /**
  15410. * Alias for friday.range
  15411. */
  15412. /** @expose */
  15413. fridays : null,
  15414. /**
  15415. * Alias for saturday.range
  15416. */
  15417. /** @expose */
  15418. saturdays : null,
  15419. /**
  15420. * Returns the week number for the given date, where weeks start with the given day. The first day of the year (January 1) is always the 0th week. weekOfYear is an alias for sundayOfYear, which is equivalent to rave.time.format's %U directive. mondayOfYear is equivalent to rave.time.format's %W directive. Computes the Sunday-based week number
  15421. */
  15422. /** @expose */
  15423. sundayOfYear : null,
  15424. /**
  15425. * Alias for sundayOfYear
  15426. */
  15427. /** @expose */
  15428. weekOfYear : null,
  15429. /**
  15430. * Computes the Monday-based week number
  15431. */
  15432. /** @expose */
  15433. mondayOfYear : null,
  15434. /**
  15435. * Computes the Tuesday-based week number
  15436. */
  15437. /** @expose */
  15438. tuesdayOfYear : null,
  15439. /**
  15440. * Computes the Wednesday-based week number
  15441. */
  15442. /** @expose */
  15443. wednesdayOfYear : null,
  15444. /**
  15445. * Computes the Thursday-based week number
  15446. */
  15447. /** @expose */
  15448. thursdayOfYear : null,
  15449. /**
  15450. * Computes the Friday-based week number
  15451. */
  15452. /** @expose */
  15453. fridayOfYear : null,
  15454. /**
  15455. * Computes the Saturday-based week number
  15456. */
  15457. /** @expose */
  15458. saturdayOfYear : null,
  15459. constructor : function() {
  15460. this.scale = new (com_ibm_rave_core_nativeImpl_Declare({
  15461. _$functionClassMethod : function() {
  15462. var _$self = function() {
  15463. return new com_ibm_rave_core_time_DateTimeScale(null, null, null, null, com_ibm_rave_core_time_DateTimeScale.localFormat, com_ibm_rave_core_time_DateTimeScale.localMethods, com_ibm_rave_core_time_DateTimeScale.localMethodsYear);
  15464. };
  15465. return _$self;
  15466. },
  15467. utc : function() {
  15468. return new com_ibm_rave_core_time_DateTimeScale(null, null, null, null, com_ibm_rave_core_time_DateTimeScale.utcFormat, com_ibm_rave_core_time_DateTimeScale.utcMethods, com_ibm_rave_core_time_DateTimeScale.utcMethodsYear);
  15469. }
  15470. }))();
  15471. this.format = new com_ibm_rave_core_locale_TimeFormat(com_ibm_rave_core_locale_Locale.DEFAULT_LOCALE);
  15472. this.day = com_ibm_rave_core_time_Day.INSTANCE;
  15473. this.hour = com_ibm_rave_core_time_Hour.INSTANCE;
  15474. this.month = com_ibm_rave_core_time_Month.INSTANCE;
  15475. this.year = com_ibm_rave_core_time_Year.INSTANCE;
  15476. this.second = com_ibm_rave_core_time_Second.INSTANCE;
  15477. this.minute = com_ibm_rave_core_time_Minute.INSTANCE;
  15478. this.millisecond = com_ibm_rave_core_time_Millisecond.INSTANCE;
  15479. this.days = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.day);
  15480. this.years = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.year);
  15481. this.months = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.month);
  15482. this.hours = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.hour);
  15483. this.minutes = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.minute);
  15484. this.seconds = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.second);
  15485. this.sunday = new com_ibm_rave_core_time_Week(0);
  15486. this.week = this.sunday;
  15487. this.monday = new com_ibm_rave_core_time_Week(1);
  15488. this.tuesday = new com_ibm_rave_core_time_Week(2);
  15489. this.wednesday = new com_ibm_rave_core_time_Week(3);
  15490. this.thursday = new com_ibm_rave_core_time_Week(4);
  15491. this.friday = new com_ibm_rave_core_time_Week(5);
  15492. this.saturday = new com_ibm_rave_core_time_Week(6);
  15493. this.sundays = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.sunday);
  15494. this.weeks = this.sundays;
  15495. this.mondays = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.monday);
  15496. this.tuesdays = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.tuesday);
  15497. this.wednesdays = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.wednesday);
  15498. this.thursdays = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.thursday);
  15499. this.fridays = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.friday);
  15500. this.saturdays = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.saturday);
  15501. this.sundayOfYear = new com_ibm_rave_core_time_Time.WeekOfYear(0);
  15502. this.weekOfYear = this.sundayOfYear;
  15503. this.mondayOfYear = new com_ibm_rave_core_time_Time.WeekOfYear(1);
  15504. this.tuesdayOfYear = new com_ibm_rave_core_time_Time.WeekOfYear(2);
  15505. this.wednesdayOfYear = new com_ibm_rave_core_time_Time.WeekOfYear(3);
  15506. this.thursdayOfYear = new com_ibm_rave_core_time_Time.WeekOfYear(4);
  15507. this.fridayOfYear = new com_ibm_rave_core_time_Time.WeekOfYear(5);
  15508. this.saturdayOfYear = new com_ibm_rave_core_time_Time.WeekOfYear(6);
  15509. },
  15510. /**
  15511. * Returns the day number for the given date. The first day of the year (January 1) is always the 0th day. Unlike the rave.time.format's %j directive, dayOfYear is 0-based rather than 1-based.
  15512. * @param (com.ibm.rave.core.time.IDate) date the date to get the day number from
  15513. * @return (int) The day of the year for a given date
  15514. */
  15515. /** @expose */
  15516. dayOfYear : function(date) {
  15517. return com_ibm_rave_core_internal_time_TimeUtil.dayOfYear(date);
  15518. }
  15519. //constructor : function() {}
  15520. });
  15521. /**
  15522. * Gets or creates and sets a new instance of Time
  15523. * @return (com.ibm.rave.core.time.Time) an instance of Time. If no instance exists, a new instance of time will be created, set and returned.
  15524. */
  15525. /** @expose */
  15526. com_ibm_rave_core_time_Time.getInstance = function() {
  15527. if (!com_ibm_rave_core_time_Time.INSTANCE) {
  15528. {
  15529. if (!com_ibm_rave_core_time_Time.INSTANCE) {
  15530. com_ibm_rave_core_time_Time.INSTANCE = new com_ibm_rave_core_time_Time();
  15531. }
  15532. }
  15533. }
  15534. return com_ibm_rave_core_time_Time.INSTANCE;
  15535. };
  15536. /**
  15537. * A helper class which overrides interval.range
  15538. */
  15539. com_ibm_rave_core_time_Time.TimeRange = rave_externs["TimeRange"] = com_ibm_rave_core_nativeImpl_Declare({
  15540. /** @expose */
  15541. interval : null,
  15542. /**
  15543. * By default utc is null. Only set in TimeRangeImpl
  15544. */
  15545. /** @expose */
  15546. utc : null,
  15547. _$functionClassMethod : function() {
  15548. var _$self = function(start, stop, step) {
  15549. return _$self.interval.range(start, stop, step);
  15550. };
  15551. return _$self;
  15552. },
  15553. /**
  15554. * C'tor which sets the interval
  15555. * @param (com.ibm.rave.core.internal.time.ITimeInterval) interval the time interval to be set
  15556. */
  15557. /** @expose */
  15558. constructor : function(interval) {
  15559. this.interval = interval;
  15560. },
  15561. /**
  15562. * @return (com.ibm.rave.core.internal.time.ITimeInterval) the interval
  15563. */
  15564. /** @expose */
  15565. getInterval : function() {
  15566. return this.interval;
  15567. },
  15568. /** @expose */
  15569. hasRangeMethod : function() {
  15570. return false;
  15571. }
  15572. });
  15573. com_ibm_rave_core_time_Time.TimeRangeImpl = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_time_Time.TimeRange, {
  15574. /** @expose */
  15575. constructor : function(interval) {
  15576. this.utc = new com_ibm_rave_core_time_Time.TimeRangeUTC(interval);
  15577. }
  15578. });
  15579. com_ibm_rave_core_time_Time.TimeRangeUTC = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_time_Time.TimeRange, {
  15580. /** @expose */
  15581. constructor : function(interval) {
  15582. this.interval = new com_ibm_rave_core_time_TimeIntervalUTC(interval);
  15583. }
  15584. });
  15585. /**
  15586. * Returns the week number for the given date, where weeks start with the given day. The first day of the year (January 1) is always the 0th week. weekOfYear is an alias for sundayOfYear, which is equivalent to time.format's %U directive. mondayOfYear is equivalent to time.format's %W directive.
  15587. */
  15588. com_ibm_rave_core_time_Time.WeekOfYear = com_ibm_rave_core_nativeImpl_Declare({
  15589. weekIndex : 0,
  15590. _$functionClassMethod : function() {
  15591. var _$self = function(date) {
  15592. var day = com_ibm_rave_core_time_Time.getInstance().year(date).getDay();
  15593. return Math.floor((com_ibm_rave_core_time_Time.getInstance().dayOfYear(date) + (day + (7 - _$self.weekIndex)) % 7) / 7);
  15594. };
  15595. return _$self;
  15596. },
  15597. constructor : function(index) {
  15598. this.weekIndex = index;
  15599. }
  15600. });
  15601. //com_ibm_rave_core_time_Time.INSTANCE = null;
  15602. // $source: com/ibm/rave/core/time/TimeIntervalUTC
  15603. /************************************************************************
  15604. ** IBM Confidential
  15605. **
  15606. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  15607. **
  15608. ** (C) Copyright IBM Corp. 2015
  15609. **
  15610. ** The source code for this program is not published or otherwise divested of its trade secrets,
  15611. ** irrespective of what has been deposited with the U.S. Copyright Office.
  15612. ************************************************************************/
  15613. // GENERATED
  15614. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, bind
  15615. //@import com/ibm/rave/core/time/DateUTC (runtime) // new
  15616. /**
  15617. * A UTC version of TimeInterval. Delegates to the passed in interval, and converts all dates into UTC time before using them.
  15618. */
  15619. var com_ibm_rave_core_time_TimeIntervalUTC = rave_externs["TimeIntervalUTC"] = com_ibm_rave_core_nativeImpl_Declare({
  15620. //delegate : null,
  15621. _$functionClassMethod : function() {
  15622. var _$self = function(start) {
  15623. return _$self.floor(start);
  15624. };
  15625. return _$self;
  15626. },
  15627. /**
  15628. * Constructor which sets interval
  15629. * @param (com.ibm.rave.core.time.TimeInterval) interval the time interval to set
  15630. */
  15631. /** @expose */
  15632. constructor : function(interval) {
  15633. this.delegate = interval;
  15634. },
  15635. /** @expose */
  15636. hasRangeMethod : function() {
  15637. return true;
  15638. },
  15639. /** @expose */
  15640. round : com_ibm_rave_core_nativeImpl_Declare.bind(function(date) {
  15641. return this.delegate.round(new com_ibm_rave_core_time_DateUTC(date.getTime())).getDateObject();
  15642. }),
  15643. /** @expose */
  15644. ceil : com_ibm_rave_core_nativeImpl_Declare.bind(function(date) {
  15645. return this.delegate.ceil(new com_ibm_rave_core_time_DateUTC(date.getTime())).getDateObject();
  15646. }),
  15647. /** @expose */
  15648. offset : com_ibm_rave_core_nativeImpl_Declare.bind(function(date, k) {
  15649. return this.delegate.offset(new com_ibm_rave_core_time_DateUTC(date.getTime()), k).getDateObject();
  15650. }),
  15651. /** @expose */
  15652. range : com_ibm_rave_core_nativeImpl_Declare.bind(function(t0, t1, dt) {
  15653. return this.delegate.range(new com_ibm_rave_core_time_DateUTC(t0.getTime()), new com_ibm_rave_core_time_DateUTC(t1.getTime()), dt);
  15654. }),
  15655. /** @expose */
  15656. floor : com_ibm_rave_core_nativeImpl_Declare.bind(function(date) {
  15657. return this.delegate.floor(new com_ibm_rave_core_time_DateUTC(date.getTime())).getDateObject();
  15658. }),
  15659. /** @expose */
  15660. step : com_ibm_rave_core_nativeImpl_Declare.bind(function(date, offset) {
  15661. this.delegate.step(new com_ibm_rave_core_time_DateUTC(date.getTime()), offset);
  15662. }),
  15663. /** @expose */
  15664. number : com_ibm_rave_core_nativeImpl_Declare.bind(function(date) {
  15665. return this.delegate.number(new com_ibm_rave_core_time_DateUTC(date.getTime()));
  15666. })
  15667. });
  15668. // $source: com/ibm/rave/core/time/TimeInterval
  15669. /************************************************************************
  15670. ** IBM Confidential
  15671. **
  15672. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  15673. **
  15674. ** (C) Copyright IBM Corp. 2015
  15675. **
  15676. ** The source code for this program is not published or otherwise divested of its trade secrets,
  15677. ** irrespective of what has been deposited with the U.S. Copyright Office.
  15678. ************************************************************************/
  15679. // GENERATED
  15680. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, bind
  15681. //@import com/ibm/rave/core/time/TimeIntervalUTC (static) // new
  15682. //@import com/ibm/rave/core/time/DateUTC (runtime) // new
  15683. /**
  15684. * Base class for functions related to Intervals of time. Returns the specified interval. The following intervals are supported: rave.time.second rave.time.minute rave.time.hour rave.time.day rave.time.week (alias for rave.time.sunday) rave.time.sunday rave.time.monday rave.time.tuesday rave.time.wednesday rave.time.thursday rave.time.friday rave.time.saturday rave.time.month rave.time.year
  15685. */
  15686. var com_ibm_rave_core_time_TimeInterval = rave_externs["TimeInterval"] = com_ibm_rave_core_nativeImpl_Declare({
  15687. /**
  15688. * Returns a corresponding time interval in UTC rather than local time. For example, day.range(start, stop) returns local time days between start and stop, while day.utc.range(start, stop) returns UTC days between start and stop.
  15689. */
  15690. /** @expose */
  15691. utc : null,
  15692. _$functionClassMethod : function() {
  15693. var _$self = /**
  15694. * Alias for interval.floor(date). For example, rave.time.day(new Date()) returns midnight (12:00 AM) on the current day, in local time.
  15695. * @param (com.ibm.rave.core.time.IDate) start the start date
  15696. * @return (com.ibm.rave.core.time.IDate) interval.floor(date)
  15697. */
  15698. function(start) {
  15699. return _$self.floor(start);
  15700. };
  15701. return _$self;
  15702. },
  15703. constructor : function() {
  15704. this.utc = new com_ibm_rave_core_time_TimeIntervalUTC(this);
  15705. },
  15706. /** @expose */
  15707. hasRangeMethod : function() {
  15708. return true;
  15709. },
  15710. /**
  15711. * Rounds up or down the specified date, returning the closest time interval to date. For example, rave.time.day.round(new Date()) returns midnight (12:00 AM) on the current day if it is on or before noon, and midnight of the following day if it is after noon.
  15712. * @param (com.ibm.rave.core.time.IDate) date the date to round
  15713. * @return (com.ibm.rave.core.time.IDate) the closest time interval to date
  15714. */
  15715. /** @expose */
  15716. round : com_ibm_rave_core_nativeImpl_Declare.bind(function(date) {
  15717. var d0 = this(date), d1 = this.offset(d0, 1);
  15718. return date.getTime() - d0.getTime() < d1.getTime() - date.getTime() ? d0 : d1;
  15719. }),
  15720. /**
  15721. * Rounds up the specified date, returning the earliest time interval after or equal to date. For example, rave.time.day.ceil(new Date()) returns midnight (12:00 AM) on the following day, in local time (unless you happen to run this code at exactly midnight, in which case it returns the current time).
  15722. * @param (com.ibm.rave.core.time.IDate) date the date to be rounded
  15723. * @return (com.ibm.rave.core.time.IDate) the earliest time interval after or equal to date
  15724. */
  15725. /** @expose */
  15726. ceil : com_ibm_rave_core_nativeImpl_Declare.bind(function(date) {
  15727. var localDate = this.createDate(date, date.getTime() - 1);
  15728. localDate = this(localDate);
  15729. this.step(localDate, 1);
  15730. return localDate;
  15731. }),
  15732. /**
  15733. * Creates a new date equal to date plus step intervals. If step is negative, then the returned date will be before the specified date; if step is zero, then a copy of the specified date is returned. This method does not round the specified date to the interval. For example, if it is currently 5:34 PM, then rave.time.day.offset(new Date(), 1) returns 5:34 PM tomorrow (even if Daylight Savings Time changes!).
  15734. * @param (com.ibm.rave.core.time.IDate) date the date to be manipulated
  15735. * @param (int) k the step interval
  15736. * @return (com.ibm.rave.core.time.IDate) a new date equal to the date plus the step interval
  15737. */
  15738. /** @expose */
  15739. offset : com_ibm_rave_core_nativeImpl_Declare.bind(function(date, k) {
  15740. var newDate = this.createDate(date, date.getTime());
  15741. this.step(newDate, k);
  15742. return newDate;
  15743. }),
  15744. /**
  15745. * Gets every time interval after or equal to start and before stop. If step is specified, then every step'th interval will be returned, based on the interval number (such as day of month for rave.time.day). For example, a step of 2 will return the 1st, 3rd, 5th etc. of the month with rave.time.day.
  15746. * @param (com.ibm.rave.core.time.IDate) start the start date
  15747. * @param (com.ibm.rave.core.time.IDate) stop the end date
  15748. * @param (int) step the step interval
  15749. * @return (Array) every time interval after or equal to the start and before the stop
  15750. */
  15751. /** @expose */
  15752. range : com_ibm_rave_core_nativeImpl_Declare.bind(function(start, stop, step) {
  15753. var time = this.ceil(start);
  15754. var times = [];
  15755. if (step > 1) {
  15756. while (time.getTime() < stop.getTime()) {
  15757. if (!((this.number(time) % step))) {
  15758. times.push(new Date(time.getTime()));
  15759. }
  15760. this.step(time, 1);
  15761. }
  15762. } else {
  15763. while (time.getTime() < stop.getTime()) {
  15764. times.push(new Date(time.getTime()));
  15765. this.step(time, 1);
  15766. }
  15767. }
  15768. return times;
  15769. }),
  15770. /**
  15771. * Rounds down the specified date, returning the latest time interval before or equal to date. For example, rave.time.day.floor(new Date()) returns midnight (12:00 AM) on the current day, in local time.
  15772. */
  15773. /** @expose */
  15774. floor : function(date) {},
  15775. /** @expose */
  15776. step : function(date, offset) {},
  15777. /** @expose */
  15778. number : function(date) {},
  15779. /**
  15780. * Create a new date object based on the passed in date's type, setting the new date to 'time'. This is a bit of hack to mimic d3 - it temporarily reassigns d3_date when using UTC dates.
  15781. * @param (com.ibm.rave.core.time.IDate) date the date to be set on the new Date object
  15782. * @param (long) time the time to be set on the new Date object
  15783. * @return (com.ibm.rave.core.time.IDate) A new {@link (Date) Date} object
  15784. */
  15785. /** @expose */
  15786. createDate : function(date, time) {
  15787. var newdate = (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(date, com_ibm_rave_core_time_DateUTC)) ? new com_ibm_rave_core_time_DateUTC(time) : new Date(time);
  15788. return newdate;
  15789. }
  15790. });
  15791. com_ibm_rave_core_time_TimeInterval.utc_load_flag_unused = new com_ibm_rave_core_time_TimeIntervalUTC(null);
  15792. // $source: com/ibm/rave/core/time/Day
  15793. /************************************************************************
  15794. ** IBM Confidential
  15795. **
  15796. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  15797. **
  15798. ** (C) Copyright IBM Corp. 2015
  15799. **
  15800. ** The source code for this program is not published or otherwise divested of its trade secrets,
  15801. ** irrespective of what has been deposited with the U.S. Copyright Office.
  15802. ************************************************************************/
  15803. // GENERATED
  15804. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  15805. //@import com/ibm/rave/core/time/TimeInterval (loadtime) // superclass
  15806. //@import com/ibm/rave/core/time/DateUTC (runtime) // new
  15807. /**
  15808. * A day interval. Most days are 24 hours long (864e5 milliseconds); however, with Daylight Savings Time, a day may be 23 or 25 hours long.
  15809. */
  15810. var com_ibm_rave_core_time_Day = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_time_TimeInterval, {
  15811. /** @expose */
  15812. floor : function(date) {
  15813. var day = (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(date, com_ibm_rave_core_time_DateUTC)) ? new com_ibm_rave_core_time_DateUTC(Date.UTC(2000, 0, 1, 0, 0, 0, 0)) : new Date(2000, 0, 1, 0, 0, 0, 0);
  15814. day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
  15815. return day;
  15816. },
  15817. /** @expose */
  15818. step : function(date, offset) {
  15819. date.setDate(date.getDate() + offset);
  15820. },
  15821. /** @expose */
  15822. number : function(date) {
  15823. return date.getDate() - 1;
  15824. }
  15825. //constructor : function() {}
  15826. });
  15827. /**
  15828. * Single instance of Day object.
  15829. */
  15830. /** @expose */
  15831. com_ibm_rave_core_time_Day.INSTANCE = new com_ibm_rave_core_time_Day();
  15832. // $source: com/ibm/rave/core/time/DateUTC
  15833. /************************************************************************
  15834. ** IBM Confidential
  15835. **
  15836. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  15837. **
  15838. ** (C) Copyright IBM Corp. 2015
  15839. **
  15840. ** The source code for this program is not published or otherwise divested of its trade secrets,
  15841. ** irrespective of what has been deposited with the U.S. Copyright Office.
  15842. ************************************************************************/
  15843. // GENERATED
  15844. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  15845. /**
  15846. * A Date class that always returns UTC values. Delegates all non-utc (local) methods to their UTC equivalent.
  15847. */
  15848. var com_ibm_rave_core_time_DateUTC = rave_externs["DateUTC"] = com_ibm_rave_core_nativeImpl_Declare({
  15849. //date : null,
  15850. /**
  15851. * A new UTC date
  15852. * @param (long) time integer value representing the number of milliseconds since 1 January 1970 00:00:00 UTC
  15853. */
  15854. /** @expose */
  15855. constructor : function(time) {
  15856. this.date = new Date(time);
  15857. },
  15858. /**
  15859. * Gets the day of the month in local time from 1-31
  15860. * @return (int) the day of the month
  15861. */
  15862. /** @expose */
  15863. getDate : function() {
  15864. return this.getUTCDate();
  15865. },
  15866. /**
  15867. * Gets the day of the week in local time from 0-6
  15868. * @return (int) day of the week
  15869. */
  15870. /** @expose */
  15871. getDay : function() {
  15872. return this.getUTCDay();
  15873. },
  15874. /**
  15875. * Gets the full year in numeric form (ie 1999, 2100)
  15876. * @return (int) the full year
  15877. */
  15878. /** @expose */
  15879. getFullYear : function() {
  15880. return this.getUTCFullYear();
  15881. },
  15882. /**
  15883. * Gets the hour between 0-23 in local time
  15884. * @return (int) the hour
  15885. */
  15886. /** @expose */
  15887. getHours : function() {
  15888. return this.getUTCHours();
  15889. },
  15890. /**
  15891. * Gets the milliseconds in the current minute of a date between 0-999 in local time
  15892. * @return (int) the milliseconds
  15893. */
  15894. /** @expose */
  15895. getMilliseconds : function() {
  15896. return this.getUTCMilliseconds();
  15897. },
  15898. /**
  15899. * Gets the minutes in the current hour of a date between 0-59 in local time
  15900. * @return (int) the minutes
  15901. */
  15902. /** @expose */
  15903. getMinutes : function() {
  15904. return this.getUTCMinutes();
  15905. },
  15906. /**
  15907. * Gets the current month from 0-11 in local time
  15908. * @return (int) the current month
  15909. */
  15910. /** @expose */
  15911. getMonth : function() {
  15912. return this.getUTCMonth();
  15913. },
  15914. /**
  15915. * Gets the number of seconds in the current minute from 0-59 in local time
  15916. * @return (int) the number of seconds
  15917. */
  15918. /** @expose */
  15919. getSeconds : function() {
  15920. return this.getUTCSeconds();
  15921. },
  15922. /**
  15923. * Gets the difference in minutes for the current locale. The offset is positive for negative time zones. For instance, -5 UTC returns 300.
  15924. * @return (int) the difference in minutes for the current locale
  15925. */
  15926. /** @expose */
  15927. getTimezoneOffset : function() {
  15928. return 0;
  15929. },
  15930. /**
  15931. * Set the day of month using offset from start of the current month. The first day of the month is '1' and so on. returns new time represented in milliseconds. Offsets are always relative to day 1 of the month. For instance, an offset of 0 means the last day of the previous month. -1 means the day before that, etc. Likewise, offsets greater than the number of days in the current month will continue into the next month.
  15932. * @param (int) day the day of the month to set for the UTC Date
  15933. * @return (long) number of seconds since 1970/1/1 in UTC time
  15934. */
  15935. /** @expose */
  15936. setDate : function(day) {
  15937. return this.setUTCDate(day);
  15938. },
  15939. /**
  15940. * Set the full year of the current date
  15941. * @param (int) year the year of the UTC Date to create
  15942. * @param (int) month the month of the UTC Date to create
  15943. * @param (int) day the day of the month of the UTC Date to create
  15944. * @return (long) the number of seconds since 1970/1/1 in local time
  15945. */
  15946. /** @expose */
  15947. setFullYear : function(year, month, day) {
  15948. return this.setUTCFullYear(year, month, day);
  15949. },
  15950. /**
  15951. * Set the hours of the current date from 0-23
  15952. * @param (int) hour the hour of the UTC Date
  15953. * @param (int) minutes the minutes of the UTC Date
  15954. * @param (int) seconds the seconds of the UTC Date
  15955. * @param (int) milliseconds the milliseconds of the UTC Date
  15956. * @return (long) the number of seconds since 1970/1/1 in local time
  15957. */
  15958. /** @expose */
  15959. setHours : function(hour, minutes, seconds, milliseconds) {
  15960. return this.setUTCHours(hour, minutes, seconds, milliseconds);
  15961. },
  15962. /**
  15963. * Set the milliseconds of the current date from 0-999
  15964. * @param (int) millis the number of milliseconds of the current date from 0-999
  15965. * @return (long) the number of seconds since 1970/1/1 in local time
  15966. */
  15967. /** @expose */
  15968. setMilliseconds : function(millis) {
  15969. return this.setUTCMilliseconds(millis);
  15970. },
  15971. /** @expose */
  15972. setMinutes : function(minutes) {
  15973. return this.setUTCMinutes(minutes);
  15974. },
  15975. /** @expose */
  15976. setSeconds : function(seconds) {
  15977. return this.setUTCSeconds(seconds);
  15978. },
  15979. /** @expose */
  15980. getTime : function() {
  15981. return this.date.getTime();
  15982. },
  15983. /** @expose */
  15984. getUTCDate : function() {
  15985. return this.date.getUTCDate();
  15986. },
  15987. /** @expose */
  15988. getUTCDay : function() {
  15989. return this.date.getUTCDay();
  15990. },
  15991. /** @expose */
  15992. getUTCFullYear : function() {
  15993. return this.date.getUTCFullYear();
  15994. },
  15995. /** @expose */
  15996. getUTCHours : function() {
  15997. return this.date.getUTCHours();
  15998. },
  15999. /** @expose */
  16000. getUTCMilliseconds : function() {
  16001. return this.date.getUTCMilliseconds();
  16002. },
  16003. /** @expose */
  16004. getUTCMinutes : function() {
  16005. return this.date.getUTCMinutes();
  16006. },
  16007. /** @expose */
  16008. getUTCMonth : function() {
  16009. return this.date.getUTCMonth();
  16010. },
  16011. /** @expose */
  16012. getUTCSeconds : function() {
  16013. return this.date.getUTCSeconds();
  16014. },
  16015. /** @expose */
  16016. setMonth : function(month, day) {
  16017. return this.setUTCMonth(month, day);
  16018. },
  16019. /** @expose */
  16020. setTime : function(time) {
  16021. return this.date.setTime(time);
  16022. },
  16023. /** @expose */
  16024. setUTCDate : function(month) {
  16025. return this.date.setUTCDate(month);
  16026. },
  16027. /** @expose */
  16028. setUTCFullYear : function(year, month, day) {
  16029. return this.date.setUTCFullYear(year, month, day);
  16030. },
  16031. /** @expose */
  16032. setUTCHours : function(hour, minutes, seconds, milliseconds) {
  16033. return this.date.setUTCHours(hour, minutes, seconds, milliseconds);
  16034. },
  16035. /** @expose */
  16036. setUTCMilliseconds : function(millis) {
  16037. return this.date.setUTCMilliseconds(millis);
  16038. },
  16039. /** @expose */
  16040. setUTCMinutes : function(minutes) {
  16041. return this.date.setUTCMinutes(minutes);
  16042. },
  16043. /** @expose */
  16044. setUTCMonth : function(month, day) {
  16045. return this.date.setUTCMonth(month, day);
  16046. },
  16047. /** @expose */
  16048. setUTCSeconds : function(seconds) {
  16049. return this.date.setUTCSeconds(seconds);
  16050. },
  16051. /** @expose */
  16052. getDateObject : function() {
  16053. return this.date;
  16054. },
  16055. /** @expose */
  16056. toISOString : function() {
  16057. return null;
  16058. }
  16059. });
  16060. // $source: com/ibm/rave/core/locale/TimeFormat
  16061. /************************************************************************
  16062. ** IBM Confidential
  16063. **
  16064. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  16065. **
  16066. ** (C) Copyright IBM Corp. 2015
  16067. **
  16068. ** The source code for this program is not published or otherwise divested of its trade secrets,
  16069. ** irrespective of what has been deposited with the U.S. Copyright Office.
  16070. ************************************************************************/
  16071. // GENERATED
  16072. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare anonymous, declare
  16073. //@import com/ibm/rave/core/locale/TimeFormatSpecifier (loadtime) // superclass
  16074. //@import com/ibm/rave/core/time/FormatISO (runtime) // new
  16075. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (runtime) // create
  16076. //@import com/ibm/rave/core/time/TimeFormatter (runtime)
  16077. //@import com/ibm/rave/core/time/DateUTC (static) // new
  16078. //@import com/ibm/rave/core/time/Time (runtime) // getInstance
  16079. //@import com/ibm/rave/core/nativeImpl/format/Requote (static) // requote
  16080. /**
  16081. * A helper module for parsing and formatting dates modeled after the venerable strptime and strftime C-library standards. These functions are also notably available in Python's time module.
  16082. */
  16083. var com_ibm_rave_core_locale_TimeFormat = rave_externs["TimeFormat"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_locale_TimeFormatSpecifier, {
  16084. /**
  16085. * Constructs a new UTC time formatter using the given specifier. (Equivalent to locale.timeFormat.utc for the default U.S. English locale.) The specifier may contain the same directives as the local time format. Internally, this time formatter is implemented using the UTC methods on the Date object, such as getUTCDate and setUTCDate in place of getDate and setDate. Return A formatted UTC time
  16086. */
  16087. /** @expose */
  16088. utc : null,
  16089. /** @expose */
  16090. iso : null,
  16091. //timeFormats : null,
  16092. //timeParsers : null,
  16093. //locale : null,
  16094. //time_periodLookup : null,
  16095. //time_numberRe : null,
  16096. //time_percentRe : null,
  16097. _$functionClassMethod : function() {
  16098. var _$self = /**
  16099. * Constructs a new local time formatter using the given specifier. (Equivalent to locale.timeFormat for the default U.S. English locale.) The specifier string may contain the following directives. %a - abbreviated weekday name. %A - full weekday name. %b - abbreviated month name. %B - full month name. %c - date and time, as "%a %b %e %H:%M:%S %Y". %d - zero-padded day of the month as a decimal number [01,31]. %e - space-padded day of the month as a decimal number [1,31]; equivalent to %_d. %H - hour (24-hour clock) as a decimal number [00,23]. %I - hour (12-hour clock) as a decimal number [01,12]. %j - day of the year as a decimal number [001,366]. %m - month as a decimal number [01,12]. %M - minute as a decimal number [00,59]. %L - milliseconds as a decimal number [000, 999]. %p - either AM or PM. %S - second as a decimal number [00,61]. %U - week number of the year (Sunday as the first day of the week) as a decimal number [00,53]. %w - weekday as a decimal number [0(Sunday),6]. %W - week number of the year (Monday as the first day of the week) as a decimal number [00,53]. %x - date, as "%m/%d/%Y". %X -time, as "%H:%M:%S". %y - year without century as a decimal number [00,99]. %Y - year with century as a decimal number. %Z - time zone offset, such as "-0700". %% - a literal "%" character. For %U, all days in a new year preceding the first Sunday are considered to be in week 0. For %W, all days in a new year preceding the first Monday are considered to be in week 0. In some implementations of strftime and strptime (as in Python), a directive may include an optional field width or precision; this feature is not yet implemented in Rave, but may be added in the future. For locale-specific date and time formatters, see locale.timeFormat. The % sign indicating a directive may be immediately followed by a padding modifier: 0 - zero-padding _ - space-padding - - disable padding If no padding modifier is specified, the default is 0 for all directives, except for %e which defaults to _).
  16100. */
  16101. function(template) {
  16102. var n = template.length;
  16103. var self = _$self;
  16104. return new (com_ibm_rave_core_nativeImpl_Declare({
  16105. _$functionClassMethod : function() {
  16106. var _$self = /**
  16107. * Formats the specified date, returning the corresponding string. The date must be a JavaScript Date object. Note that when dates are used in conjunction with quantitative scales, the dates are implicitly coerced to numbers representing the number of milliseconds since UNIX epoch. To convert between numbers and dates, you can use the following code:
  16108. * @param (Object) date The Date object to be formatted.
  16109. * @return (String) String representing the formatted Date
  16110. */
  16111. function(date, index, groupIndex) {
  16112. var dateObj = (date);
  16113. var string = [];
  16114. var i = -1;
  16115. var j = 0;
  16116. var c;
  16117. var p;
  16118. var f;
  16119. while (++i < n) {
  16120. if (template.charCodeAt(i) == 37) {
  16121. string.push(template.substring(j, i));
  16122. var stringC = String.fromCharCode(template.charCodeAt(++i));
  16123. p = com_ibm_rave_core_locale_TimeFormat.time_formatPads[c = stringC];
  16124. if (p != null) {
  16125. c = String.fromCharCode(template.charCodeAt(++i));
  16126. }
  16127. f = self.timeFormats[c];
  16128. if (f) {
  16129. c = f(dateObj, p == null ? (c == "e" ? " " : "0") : p);
  16130. }
  16131. string.push(c);
  16132. j = i + 1;
  16133. }
  16134. }
  16135. string.push(template.substring(j, i));
  16136. return string.join("");
  16137. };
  16138. return _$self;
  16139. },
  16140. /**
  16141. * Overrides the toString method in order to return the template value
  16142. * @return (String) : the template value
  16143. */
  16144. toString : function() {
  16145. return template;
  16146. },
  16147. /**
  16148. * Parses the specified string, returning the corresponding date object. If the parsing fails, returns null. Unlike "natural language" date parsers (including JavaScript's built-in parse), this method is strict: if the specified string does not exactly match the associated format specifier, this method returns null. For example, if the associated format is the full ISO 8601 string "%Y-%m-%dT%H:%M:%SZ", then the string "2011-07-01T19:15:28Z" will be parsed correctly, but "2011-07-01T19:15:28", "2011-07-01 19:15:28" and "2011-07-01" will return null, despite being valid 8601 dates. (Note that the hard-coded "Z" here is different from %Z, the time zone offset.) If desired, you can use multiple formats to try multiple format specifiers sequentially. The %d and %e format specifiers are considered equivalent for parsing.
  16149. * @param (String) dateString The string to parse
  16150. * @return (com.ibm.rave.core.time.IDate) A Date based on the dateString contents. If the parsing fails, null is returned.
  16151. */
  16152. parse : function(dateString) {
  16153. return com_ibm_rave_core_locale_TimeFormat.parseImpl(self, template, dateString, false);
  16154. }
  16155. }))();
  16156. };
  16157. return _$self;
  16158. },
  16159. constructor : function(locale) {
  16160. this.utc = this.createUTC();
  16161. this.iso = new com_ibm_rave_core_time_FormatISO();
  16162. this.timeFormats = this.buildTimeFormat();
  16163. this.timeParsers = this.buildTimeParser();
  16164. this.time_periodLookup = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  16165. this.time_numberRe = new RegExp("^\\s*\\d+", "");
  16166. this.time_percentRe = new RegExp("^%", "");
  16167. /**
  16168. * Constructs a new local time formatter using the given locale.
  16169. * @param (com.ibm.rave.core.locale.LocaleObject) locale the default is intended for U.S. English, you can change the behavior of the formatters by loading a new locale as needed
  16170. */
  16171. {
  16172. this.locale = locale;
  16173. }
  16174. },
  16175. /** @expose */
  16176. timeParse : function(d, template, str, j) {
  16177. var c;
  16178. var p;
  16179. var t;
  16180. var i = 0;
  16181. var n = template.length;
  16182. var m = str.length;
  16183. var pString;
  16184. while (i < n) {
  16185. if (j >= m) {
  16186. return -1;
  16187. }
  16188. c = template.charCodeAt(i++);
  16189. if (c == 37) {
  16190. var cc = template.charCodeAt(i++);
  16191. t = String.fromCharCode(cc);
  16192. if (com_ibm_rave_core_locale_TimeFormat.time_formatPads.hasOwnProperty(t)) {
  16193. pString = String.fromCharCode(template.charCodeAt(i++));
  16194. } else {
  16195. pString = t;
  16196. }
  16197. p = this.timeParsers[pString];
  16198. j = p(d, str, j);
  16199. if (!((pString)) || (j < 0)) {
  16200. return -1;
  16201. }
  16202. } else if (c != str.charCodeAt(j++)) {
  16203. return -1;
  16204. }
  16205. }
  16206. return j;
  16207. },
  16208. setTimePeriodLookup : function() {
  16209. var self = this;
  16210. for (var i = 0; i < self.locale.periods.length; ++i) {
  16211. self.time_periodLookup.set(self.locale.periods[i].toLowerCase(), i);
  16212. }
  16213. },
  16214. /**
  16215. * Build a UTC time format specifier. Delegates to "this" (the local, non-utc, format specifier).
  16216. * @return (com.ibm.rave.core.locale.TimeFormatSpecifier) TimeFormatSpecifier which creates UTC time formatter functions.
  16217. */
  16218. createUTC : function() {
  16219. var self = this;
  16220. return new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormatSpecifier], {
  16221. _$functionClassMethod : function() {
  16222. var _$self = function(template) {
  16223. var local = self(template);
  16224. return new (com_ibm_rave_core_nativeImpl_Declare({
  16225. _$functionClassMethod : function() {
  16226. var _$self = function(date, index, groupIndex) {
  16227. return local.call(this, new com_ibm_rave_core_time_DateUTC((date).getTime()), index, groupIndex);
  16228. };
  16229. return _$self;
  16230. },
  16231. parse : function(dateString) {
  16232. return com_ibm_rave_core_locale_TimeFormat.parseImpl(self, template, dateString, true);
  16233. },
  16234. toString : function() {
  16235. return template;
  16236. }
  16237. }))();
  16238. };
  16239. return _$self;
  16240. }
  16241. }))();
  16242. },
  16243. buildTimeFormat : function() {
  16244. var map = {};
  16245. var self = this;
  16246. map["a"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16247. _$functionClassMethod : function() {
  16248. var _$self = function(date, str) {
  16249. return self.locale.shortDays[date.getDay()];
  16250. };
  16251. return _$self;
  16252. }
  16253. }))();
  16254. map["A"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16255. _$functionClassMethod : function() {
  16256. var _$self = function(date, str) {
  16257. return self.locale.days[date.getDay()];
  16258. };
  16259. return _$self;
  16260. }
  16261. }))();
  16262. map["b"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16263. _$functionClassMethod : function() {
  16264. var _$self = function(date, str) {
  16265. return self.locale.shortMonths[date.getMonth()];
  16266. };
  16267. return _$self;
  16268. }
  16269. }))();
  16270. map["B"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16271. _$functionClassMethod : function() {
  16272. var _$self = function(date, str) {
  16273. return self.locale.months[date.getMonth()];
  16274. };
  16275. return _$self;
  16276. }
  16277. }))();
  16278. map["c"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16279. _$functionClassMethod : function() {
  16280. var _$self = function(date, str) {
  16281. return self(self.locale.dateTime).call(null, date, 0, 0);
  16282. };
  16283. return _$self;
  16284. },
  16285. toString : function() {
  16286. return self(self.locale.dateTime).toString();
  16287. }
  16288. }))();
  16289. map["d"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16290. _$functionClassMethod : function() {
  16291. var _$self = function(date, str) {
  16292. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(date.getDate(), str, 2);
  16293. };
  16294. return _$self;
  16295. }
  16296. }))();
  16297. map["e"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16298. _$functionClassMethod : function() {
  16299. var _$self = function(date, str) {
  16300. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(date.getDate(), str, 2);
  16301. };
  16302. return _$self;
  16303. }
  16304. }))();
  16305. map["H"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16306. _$functionClassMethod : function() {
  16307. var _$self = function(date, str) {
  16308. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(date.getHours(), str, 2);
  16309. };
  16310. return _$self;
  16311. }
  16312. }))();
  16313. map["I"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16314. _$functionClassMethod : function() {
  16315. var _$self = function(date, str) {
  16316. if (date.getHours() % 12 > 0) {
  16317. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(date.getHours() % 12, str, 2);
  16318. }
  16319. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(12, str, 2);
  16320. };
  16321. return _$self;
  16322. }
  16323. }))();
  16324. map["j"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16325. _$functionClassMethod : function() {
  16326. var _$self = function(date, str) {
  16327. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(1 + com_ibm_rave_core_time_Time.getInstance().dayOfYear(date), str, 3);
  16328. };
  16329. return _$self;
  16330. }
  16331. }))();
  16332. map["L"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16333. _$functionClassMethod : function() {
  16334. var _$self = function(date, str) {
  16335. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(date.getMilliseconds(), str, 3);
  16336. };
  16337. return _$self;
  16338. }
  16339. }))();
  16340. map["m"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16341. _$functionClassMethod : function() {
  16342. var _$self = function(date, str) {
  16343. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(date.getMonth() + 1, str, 2);
  16344. };
  16345. return _$self;
  16346. }
  16347. }))();
  16348. map["M"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16349. _$functionClassMethod : function() {
  16350. var _$self = function(date, str) {
  16351. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(date.getMinutes(), str, 2);
  16352. };
  16353. return _$self;
  16354. }
  16355. }))();
  16356. map["p"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16357. _$functionClassMethod : function() {
  16358. var _$self = function(date, str) {
  16359. var isPM = 0;
  16360. if (date.getHours() >= 12) {
  16361. isPM = 1;
  16362. }
  16363. return self.locale.periods[isPM];
  16364. };
  16365. return _$self;
  16366. }
  16367. }))();
  16368. map["S"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16369. _$functionClassMethod : function() {
  16370. var _$self = function(date, str) {
  16371. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(date.getSeconds(), str, 2);
  16372. };
  16373. return _$self;
  16374. }
  16375. }))();
  16376. map["U"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16377. _$functionClassMethod : function() {
  16378. var _$self = function(date, str) {
  16379. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(com_ibm_rave_core_time_Time.getInstance().sundayOfYear(date), str, 2);
  16380. };
  16381. return _$self;
  16382. }
  16383. }))();
  16384. map["w"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16385. _$functionClassMethod : function() {
  16386. var _$self = function(date, str) {
  16387. return ""+(date.getDay());
  16388. };
  16389. return _$self;
  16390. }
  16391. }))();
  16392. map["W"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16393. _$functionClassMethod : function() {
  16394. var _$self = function(date, str) {
  16395. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(com_ibm_rave_core_time_Time.getInstance().mondayOfYear(date), str, 2);
  16396. };
  16397. return _$self;
  16398. }
  16399. }))();
  16400. map["x"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16401. _$functionClassMethod : function() {
  16402. var _$self = function(date, str) {
  16403. return self(self.locale.date).call(null, date, 0, 0);
  16404. };
  16405. return _$self;
  16406. },
  16407. toString : function() {
  16408. return self(self.locale.date).toString();
  16409. }
  16410. }))();
  16411. map["X"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16412. _$functionClassMethod : function() {
  16413. var _$self = function(date, str) {
  16414. return self(self.locale.time).call(null, date, 0, 0);
  16415. };
  16416. return _$self;
  16417. },
  16418. toString : function() {
  16419. return self(self.locale.time).toString();
  16420. }
  16421. }))();
  16422. map["y"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16423. _$functionClassMethod : function() {
  16424. var _$self = function(date, str) {
  16425. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(date.getFullYear() % 100, str, 2);
  16426. };
  16427. return _$self;
  16428. }
  16429. }))();
  16430. map["Y"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16431. _$functionClassMethod : function() {
  16432. var _$self = function(date, str) {
  16433. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(date.getFullYear() % 10000, str, 4);
  16434. };
  16435. return _$self;
  16436. }
  16437. }))();
  16438. map["Z"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16439. _$functionClassMethod : function() {
  16440. var _$self = function(date, str) {
  16441. return com_ibm_rave_core_locale_TimeFormat.time_zone(date);
  16442. };
  16443. return _$self;
  16444. }
  16445. }))();
  16446. map["%"] = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter], {
  16447. _$functionClassMethod : function() {
  16448. var _$self = function(date, str) {
  16449. return "%";
  16450. };
  16451. return _$self;
  16452. }
  16453. }))();
  16454. return map;
  16455. },
  16456. /**
  16457. * Construct time parser map.
  16458. */
  16459. buildTimeParser : function() {
  16460. var self = this;
  16461. var map = {};
  16462. map["a"] = function(date, str, i) {
  16463. var time_dayAbbrevLookup = com_ibm_rave_core_locale_TimeFormat.time_formatLookup(self.locale.shortDays);
  16464. var time_dayAbbrevRe = com_ibm_rave_core_locale_TimeFormat.time_formatRe(self.locale.shortDays);
  16465. time_dayAbbrevRe["lastIndex"] = 0;
  16466. var n = time_dayAbbrevRe.exec(str.substring(i));
  16467. if (n) {
  16468. date["w"] = time_dayAbbrevLookup.get(n[0].toLowerCase());
  16469. return i + n[0].length;
  16470. }
  16471. return -1;
  16472. };
  16473. map["A"] = function(date, str, i) {
  16474. var time_dayRe = com_ibm_rave_core_locale_TimeFormat.time_formatRe(self.locale.days);
  16475. var time_dayLookup = com_ibm_rave_core_locale_TimeFormat.time_formatLookup(self.locale.days);
  16476. time_dayRe["lastIndex"] = 0;
  16477. var n = time_dayRe.exec(str.substring(i));
  16478. if ((n)) {
  16479. date["w"] = time_dayLookup.get(n[0].toLowerCase());
  16480. return i + n[0].length;
  16481. }
  16482. return -1;
  16483. };
  16484. map["b"] = function(date, str, i) {
  16485. var time_monthAbbrevLookup = com_ibm_rave_core_locale_TimeFormat.time_formatLookup(self.locale.shortMonths);
  16486. var time_monthAbbrevRe = com_ibm_rave_core_locale_TimeFormat.time_formatRe(self.locale.shortMonths);
  16487. time_monthAbbrevRe["lastIndex"] = 0;
  16488. var n = time_monthAbbrevRe.exec(str.substring(i));
  16489. if (n) {
  16490. date["m"] = time_monthAbbrevLookup.get(n[0].toLowerCase());
  16491. return i + n[0].length;
  16492. }
  16493. return -1;
  16494. };
  16495. map["B"] = function(date, str, i) {
  16496. var time_monthLookup = com_ibm_rave_core_locale_TimeFormat.time_formatLookup(self.locale.months);
  16497. var time_monthRe = com_ibm_rave_core_locale_TimeFormat.time_formatRe(self.locale.months);
  16498. time_monthRe["lastIndex"] = 0;
  16499. var n = time_monthRe.exec(str.substring(i));
  16500. if (n) {
  16501. date["m"] = time_monthLookup.get(n[0].toLowerCase());
  16502. return i + n[0].length;
  16503. }
  16504. return -1;
  16505. };
  16506. map["c"] = function(date, str, i) {
  16507. return self.timeParse(date, self.timeFormats["c"].toString(), str, i);
  16508. };
  16509. map["d"] = function(date, str, i) {
  16510. self.time_numberRe["lastIndex"] = 0;
  16511. var n = self.time_numberRe.exec(str.substring(i, i + 2));
  16512. if ((n)) {
  16513. date["d"] = ~~+ (n[0]);
  16514. return i + n[0].length;
  16515. }
  16516. return -1;
  16517. };
  16518. map["e"] = function(date, str, i) {
  16519. self.time_numberRe["lastIndex"] = 0;
  16520. var n = self.time_numberRe.exec(str.substring(i, i + 2));
  16521. if ((n)) {
  16522. date["d"] = ~~+ (n[0]);
  16523. return i + n[0].length;
  16524. }
  16525. return -1;
  16526. };
  16527. map["H"] = function(date, str, i) {
  16528. self.time_numberRe["lastIndex"] = 0;
  16529. var n = self.time_numberRe.exec(str.substring(i, i + 2));
  16530. if ((n)) {
  16531. date["H"] = ~~+ (n[0]);
  16532. return i + n[0].length;
  16533. }
  16534. return -1;
  16535. };
  16536. map["I"] = function(date, str, i) {
  16537. self.time_numberRe["lastIndex"] = 0;
  16538. var n = self.time_numberRe.exec(str.substring(i, i + 2));
  16539. if ((n)) {
  16540. date["H"] = ~~+ (n[0]);
  16541. return i + n[0].length;
  16542. }
  16543. return -1;
  16544. };
  16545. map["j"] = function(date, str, i) {
  16546. self.time_numberRe["lastIndex"] = 0;
  16547. var n = self.time_numberRe.exec(str.substring(i, i + 3));
  16548. if ((n)) {
  16549. date["j"] = ~~+ (n[0]);
  16550. return i + n[0].length;
  16551. }
  16552. return -1;
  16553. };
  16554. map["L"] = function(date, str, i) {
  16555. self.time_numberRe["lastIndex"] = 0;
  16556. var n = self.time_numberRe.exec(str.substring(i, i + 3));
  16557. if ((n)) {
  16558. date["L"] = ~~+ (n[0]);
  16559. return i + n[0].length;
  16560. }
  16561. return -1;
  16562. };
  16563. map["m"] = function(date, str, i) {
  16564. self.time_numberRe["lastIndex"] = 0;
  16565. var n = self.time_numberRe.exec(str.substring(i, i + 2));
  16566. if ((n)) {
  16567. date["m"] = ~~+ (n[0]) - 1;
  16568. return i + n[0].length;
  16569. }
  16570. return -1;
  16571. };
  16572. map["M"] = function(date, str, i) {
  16573. self.time_numberRe["lastIndex"] = 0;
  16574. var n = self.time_numberRe.exec(str.substring(i, i + 2));
  16575. if ((n)) {
  16576. date["M"] = ~~+ (n[0]);
  16577. return i + n[0].length;
  16578. }
  16579. return -1;
  16580. };
  16581. map["p"] = function(date, str, i) {
  16582. self.setTimePeriodLookup();
  16583. var n = self.time_periodLookup.get(str.substring(i, i += 2).toLowerCase());
  16584. if (n == null) {
  16585. return -1;
  16586. }
  16587. date["p"] = n;
  16588. return i;
  16589. };
  16590. map["S"] = function(date, str, i) {
  16591. self.time_numberRe["lastIndex"] = 0;
  16592. var n = self.time_numberRe.exec(str.substring(i, i + 2));
  16593. if ((n)) {
  16594. date["S"] = ~~+ (n[0]);
  16595. return i + n[0].length;
  16596. }
  16597. return -1;
  16598. };
  16599. map["U"] = function(date, str, i) {
  16600. self.time_numberRe["lastIndex"] = 0;
  16601. var n = self.time_numberRe.exec(str.substring(i));
  16602. if ((n)) {
  16603. date["U"] = ~~+ (n[0]);
  16604. return i + n[0].length;
  16605. }
  16606. return -1;
  16607. };
  16608. map["w"] = function(date, str, i) {
  16609. self.time_numberRe["lastIndex"] = 0;
  16610. var n = self.time_numberRe.exec(str.substring(i, i + 1));
  16611. if ((n)) {
  16612. date["w"] = ~~+ (n[0]);
  16613. return i + n[0].length;
  16614. }
  16615. return -1;
  16616. };
  16617. map["W"] = function(date, str, i) {
  16618. self.time_numberRe["lastIndex"] = 0;
  16619. var n = self.time_numberRe.exec(str.substring(i));
  16620. if ((n)) {
  16621. date["W"] = ~~+ (n[0]);
  16622. return i + n[0].length;
  16623. }
  16624. return -1;
  16625. };
  16626. map["x"] = function(date, str, i) {
  16627. return self.timeParse(date, self.timeFormats["x"].toString(), str, i);
  16628. };
  16629. map["X"] = function(date, str, i) {
  16630. return self.timeParse(date, self.timeFormats["X"].toString(), str, i);
  16631. };
  16632. map["y"] = function(date, str, i) {
  16633. self.time_numberRe["lastIndex"] = 0;
  16634. var n = self.time_numberRe.exec(str.substring(i, i + 2));
  16635. if ((n)) {
  16636. date["y"] = com_ibm_rave_core_locale_TimeFormat.time_expandYear(~~+ (n[0]));
  16637. return i + n[0].length;
  16638. }
  16639. return -1;
  16640. };
  16641. map["Y"] = function(date, str, i) {
  16642. self.time_numberRe["lastIndex"] = 0;
  16643. var n = self.time_numberRe.exec(str.substring(i, i + 4));
  16644. if ((n)) {
  16645. date["y"] = ~~+ (n[0]);
  16646. return i + n[0].length;
  16647. }
  16648. return -1;
  16649. };
  16650. map["Z"] = function(date, str, i) {
  16651. var regExpStr = new RegExp("^[+-]\\d{4}$", "");
  16652. if ((regExpStr.test(str = str.substring(i, i + 5)))) {
  16653. date["Z"] = -~~+ (str);
  16654. return i + 5;
  16655. }
  16656. return -1;
  16657. };
  16658. map["%"] = function(date, str, i) {
  16659. self.time_percentRe["lastIndex"] = 0;
  16660. var n = self.time_percentRe.exec(str.substring(i, i + 1));
  16661. if ((n)) {
  16662. return i + n[0].length;
  16663. }
  16664. return -1;
  16665. };
  16666. return map;
  16667. }
  16668. });
  16669. com_ibm_rave_core_locale_TimeFormat.parseImpl = function(owner, template, dateString, isUTC) {
  16670. var d = {};
  16671. d["y"] = 1900;
  16672. d["m"] = 0;
  16673. d["d"] = 1;
  16674. d["H"] = 0;
  16675. d["M"] = 0;
  16676. d["S"] = 0;
  16677. d["L"] = 0;
  16678. d["Z"] = null;
  16679. d["w"] = null;
  16680. var i = owner.timeParse(d, template, dateString, 0);
  16681. if (i != dateString.length) {
  16682. return null;
  16683. }
  16684. if (d.hasOwnProperty("p")) {
  16685. var dH = d["H"];
  16686. var dP = d["p"];
  16687. dH = dH % 12 + dP * 12;
  16688. delete d["H"];
  16689. d["H"] = dH;
  16690. }
  16691. var localZ = d["Z"] != null && !isUTC;
  16692. var date;
  16693. if ((localZ)) {
  16694. date = new com_ibm_rave_core_time_DateUTC(0);
  16695. } else {
  16696. if (isUTC) {
  16697. date = new com_ibm_rave_core_time_DateUTC(0);
  16698. } else {
  16699. date = new Date();
  16700. }
  16701. }
  16702. if (d.hasOwnProperty("j")) {
  16703. date.setFullYear(d["y"], 0, d["j"]);
  16704. } else if (d.hasOwnProperty("w") && (d.hasOwnProperty("W") || d.hasOwnProperty("U"))) {
  16705. date.setFullYear(d["y"], 0, 1);
  16706. var day;
  16707. if (d.hasOwnProperty("W")) {
  16708. day = (d["w"] + 6) % 7 + d["W"] * 7 - (date.getDay() + 5) % 7;
  16709. } else {
  16710. day = d["w"] + d["U"] * 7 - (date.getDay() + 6) % 7;
  16711. }
  16712. date.setFullYear(d["y"], 0, day);
  16713. } else {
  16714. date.setFullYear(d["y"], d["m"], d["d"]);
  16715. }
  16716. if (d["Z"] == null) {
  16717. date.setHours(d["H"] + (0 / 100 | 0), d["M"] + 0 % 100, d["S"], d["L"]);
  16718. } else {
  16719. date.setHours(d["H"] + (d["Z"] / 100 | 0), d["M"] + d["Z"] % 100, d["S"], d["L"]);
  16720. }
  16721. if ((localZ)) {
  16722. return new Date(date.getTime());
  16723. }
  16724. if (isUTC) {
  16725. return new Date(date.getTime());
  16726. }
  16727. return date;
  16728. };
  16729. com_ibm_rave_core_locale_TimeFormat.initialize_time_formatPads = function() {
  16730. var time_formatPads = {};
  16731. time_formatPads["-"] = "";
  16732. time_formatPads["_"] = " ";
  16733. time_formatPads["0"] = "0";
  16734. return time_formatPads;
  16735. };
  16736. com_ibm_rave_core_locale_TimeFormat.time_formatPad = function(value, fill, width) {
  16737. var sign = value < 0 ? "-" : "", string = (sign != null && !(sign.length === 0) && !(sign == "") ? -value : value) + "";
  16738. var length = string.length;
  16739. return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);
  16740. };
  16741. com_ibm_rave_core_locale_TimeFormat.time_zone = function(date) {
  16742. var z = date.getTimezoneOffset();
  16743. var zs = z > 0 ? "-" : "+";
  16744. var zh = Math.abs(z) / 60 | 0;
  16745. var zm = Math.abs(z) % 60;
  16746. return zs + com_ibm_rave_core_locale_TimeFormat.time_formatPad(zh, "0", 2) + com_ibm_rave_core_locale_TimeFormat.time_formatPad(zm, "0", 2);
  16747. };
  16748. com_ibm_rave_core_locale_TimeFormat.time_expandYear = function(d) {
  16749. return d + (d > 68 ? 1900 : 2000);
  16750. };
  16751. com_ibm_rave_core_locale_TimeFormat.time_formatRe = function(names) {
  16752. return new RegExp("^(?:" + com_ibm_rave_core_locale_TimeFormat.map(names) + ")", "i");
  16753. };
  16754. com_ibm_rave_core_locale_TimeFormat.map = function(names) {
  16755. var maps = [];
  16756. if ((names)) {
  16757. for (var i = 0; i < names.length; ++i) {
  16758. maps.push(com_ibm_rave_core_nativeImpl_format_Requote.requote(names[i]));
  16759. }
  16760. }
  16761. return maps.join("|");
  16762. };
  16763. com_ibm_rave_core_locale_TimeFormat.time_formatLookup = function(names) {
  16764. var map = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  16765. if ((names)) {
  16766. var i = -1;
  16767. var n = names.length;
  16768. while (++i < n) {
  16769. map.set(names[i].toLowerCase(), i);
  16770. }
  16771. }
  16772. return map;
  16773. };
  16774. com_ibm_rave_core_locale_TimeFormat.InternalTimeDateFormatter = rave_externs["InternalTimeDateFormatter"] = com_ibm_rave_core_nativeImpl_Declare({
  16775. /** @expose */
  16776. toString : function() {
  16777. return null;
  16778. }
  16779. });
  16780. com_ibm_rave_core_locale_TimeFormat.time_formatPads = com_ibm_rave_core_locale_TimeFormat.initialize_time_formatPads();
  16781. // $source: com/ibm/rave/core/time/Hour
  16782. /************************************************************************
  16783. ** IBM Confidential
  16784. **
  16785. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  16786. **
  16787. ** (C) Copyright IBM Corp. 2015
  16788. **
  16789. ** The source code for this program is not published or otherwise divested of its trade secrets,
  16790. ** irrespective of what has been deposited with the U.S. Copyright Office.
  16791. ************************************************************************/
  16792. // GENERATED
  16793. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, bind
  16794. //@import com/ibm/rave/core/time/TimeInterval (loadtime) // superclass
  16795. /**
  16796. * Hour time interval. 60 minutes long (36e5 milliseconds). Note that advancing time by one hour can return the same hour number, or skip an hour number, due to Daylight Savings Time.
  16797. */
  16798. var com_ibm_rave_core_time_Hour = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_time_TimeInterval, {
  16799. /** @expose */
  16800. floor : com_ibm_rave_core_nativeImpl_Declare.bind(function(date) {
  16801. var timezone = date.getTimezoneOffset() / 60;
  16802. return this.createDate(date, ((Math.floor(date.getTime() / 36e5 - timezone) + timezone) * 36e5));
  16803. }),
  16804. /** @expose */
  16805. step : function(date, offset) {
  16806. date.setTime((date.getTime() + Math.floor(offset) * 36e5));
  16807. },
  16808. /** @expose */
  16809. number : function(date) {
  16810. return date.getHours();
  16811. }
  16812. //constructor : function() {}
  16813. });
  16814. /**
  16815. * Constructor
  16816. */
  16817. /** @expose */
  16818. com_ibm_rave_core_time_Hour.INSTANCE = new com_ibm_rave_core_time_Hour();
  16819. // $source: com/ibm/rave/core/time/Month
  16820. /************************************************************************
  16821. ** IBM Confidential
  16822. **
  16823. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  16824. **
  16825. ** (C) Copyright IBM Corp. 2015
  16826. **
  16827. ** The source code for this program is not published or otherwise divested of its trade secrets,
  16828. ** irrespective of what has been deposited with the U.S. Copyright Office.
  16829. ************************************************************************/
  16830. // GENERATED
  16831. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  16832. //@import com/ibm/rave/core/time/TimeInterval (loadtime) // superclass
  16833. //@import com/ibm/rave/core/time/Day (runtime) // Day
  16834. /**
  16835. * Month time interval.
  16836. */
  16837. var com_ibm_rave_core_time_Month = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_time_TimeInterval, {
  16838. /** @expose */
  16839. floor : function(date) {
  16840. var newdate = com_ibm_rave_core_time_Day.INSTANCE(date);
  16841. newdate.setDate(1);
  16842. return newdate;
  16843. },
  16844. /** @expose */
  16845. step : function(date, offset) {
  16846. date.setMonth(date.getMonth() + offset, date.getDate());
  16847. },
  16848. /** @expose */
  16849. number : function(date) {
  16850. return date.getMonth();
  16851. }
  16852. //constructor : function() {}
  16853. });
  16854. /** @expose */
  16855. com_ibm_rave_core_time_Month.INSTANCE = new com_ibm_rave_core_time_Month();
  16856. // $source: com/ibm/rave/core/time/Year
  16857. /************************************************************************
  16858. ** IBM Confidential
  16859. **
  16860. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  16861. **
  16862. ** (C) Copyright IBM Corp. 2015
  16863. **
  16864. ** The source code for this program is not published or otherwise divested of its trade secrets,
  16865. ** irrespective of what has been deposited with the U.S. Copyright Office.
  16866. ************************************************************************/
  16867. // GENERATED
  16868. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  16869. //@import com/ibm/rave/core/time/TimeInterval (loadtime) // superclass
  16870. //@import com/ibm/rave/core/time/Day (runtime) // Day
  16871. /**
  16872. * Year time interval.
  16873. */
  16874. var com_ibm_rave_core_time_Year = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_time_TimeInterval, {
  16875. /** @expose */
  16876. floor : function(date) {
  16877. var newdate = com_ibm_rave_core_time_Day.INSTANCE(date);
  16878. newdate.setMonth(0, 1);
  16879. return newdate;
  16880. },
  16881. /** @expose */
  16882. step : function(date, offset) {
  16883. date.setFullYear(date.getFullYear() + offset, date.getMonth(), date.getDate());
  16884. },
  16885. /** @expose */
  16886. number : function(date) {
  16887. return date.getFullYear();
  16888. }
  16889. //constructor : function() {}
  16890. });
  16891. /**
  16892. * Constructor
  16893. */
  16894. /** @expose */
  16895. com_ibm_rave_core_time_Year.INSTANCE = new com_ibm_rave_core_time_Year();
  16896. // $source: com/ibm/rave/core/time/Second
  16897. /************************************************************************
  16898. ** IBM Confidential
  16899. **
  16900. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  16901. **
  16902. ** (C) Copyright IBM Corp. 2015
  16903. **
  16904. ** The source code for this program is not published or otherwise divested of its trade secrets,
  16905. ** irrespective of what has been deposited with the U.S. Copyright Office.
  16906. ************************************************************************/
  16907. // GENERATED
  16908. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, bind
  16909. //@import com/ibm/rave/core/time/TimeInterval (loadtime) // superclass
  16910. /**
  16911. * Seconds (e.g., 01:23:45.0000 AM). Always 1,000 milliseconds long.
  16912. */
  16913. var com_ibm_rave_core_time_Second = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_time_TimeInterval, {
  16914. /** @expose */
  16915. floor : com_ibm_rave_core_nativeImpl_Declare.bind(function(date) {
  16916. return this.createDate(date, (Math.floor(date.getTime() / 1e3) * 1e3));
  16917. }),
  16918. /** @expose */
  16919. step : function(date, offset) {
  16920. date.setTime((date.getTime() + Math.floor(offset) * 1e3));
  16921. },
  16922. /** @expose */
  16923. number : function(date) {
  16924. return date.getSeconds();
  16925. }
  16926. /**
  16927. * Private Constructor
  16928. */
  16929. //constructor : function() {}
  16930. });
  16931. /**
  16932. * Instance of Second()
  16933. */
  16934. /** @expose */
  16935. com_ibm_rave_core_time_Second.INSTANCE = new com_ibm_rave_core_time_Second();
  16936. // $source: com/ibm/rave/core/time/Minute
  16937. /************************************************************************
  16938. ** IBM Confidential
  16939. **
  16940. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  16941. **
  16942. ** (C) Copyright IBM Corp. 2015
  16943. **
  16944. ** The source code for this program is not published or otherwise divested of its trade secrets,
  16945. ** irrespective of what has been deposited with the U.S. Copyright Office.
  16946. ************************************************************************/
  16947. // GENERATED
  16948. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, bind
  16949. //@import com/ibm/rave/core/time/TimeInterval (loadtime) // superclass
  16950. /**
  16951. * Minute time interval. Most implementations do not support leap seconds, so minutes are almost always 60 seconds (6e4 milliseconds) long.
  16952. */
  16953. var com_ibm_rave_core_time_Minute = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_time_TimeInterval, {
  16954. /** @expose */
  16955. floor : com_ibm_rave_core_nativeImpl_Declare.bind(function(date) {
  16956. return this.createDate(date, (Math.floor(date.getTime() / 6e4) * 6e4));
  16957. }),
  16958. /** @expose */
  16959. step : function(date, offset) {
  16960. date.setTime((date.getTime() + Math.floor(offset) * 6e4));
  16961. },
  16962. /** @expose */
  16963. number : function(date) {
  16964. return date.getMinutes();
  16965. }
  16966. //constructor : function() {}
  16967. });
  16968. /**
  16969. * Constructor
  16970. */
  16971. /** @expose */
  16972. com_ibm_rave_core_time_Minute.INSTANCE = new com_ibm_rave_core_time_Minute();
  16973. // $source: com/ibm/rave/core/time/Millisecond
  16974. /************************************************************************
  16975. ** IBM Confidential
  16976. **
  16977. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  16978. **
  16979. ** (C) Copyright IBM Corp. 2015
  16980. **
  16981. ** The source code for this program is not published or otherwise divested of its trade secrets,
  16982. ** irrespective of what has been deposited with the U.S. Copyright Office.
  16983. ************************************************************************/
  16984. // GENERATED
  16985. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  16986. //@import com/ibm/rave/core/time/TimeInterval (loadtime) // superclass
  16987. //@import com/ibm/rave/core/arrays/Range (runtime) // create
  16988. /**
  16989. * A millisecond interval.
  16990. */
  16991. var com_ibm_rave_core_time_Millisecond = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_time_TimeInterval, {
  16992. /** @expose */
  16993. floor : function(date) {
  16994. return date;
  16995. },
  16996. /** @expose */
  16997. step : function(date, offset) {
  16998. date.setMilliseconds(date.getMilliseconds() + offset);
  16999. },
  17000. /** @expose */
  17001. number : function(date) {
  17002. return date.getMilliseconds();
  17003. },
  17004. /** @expose */
  17005. ceil : function(date) {
  17006. return date;
  17007. },
  17008. /** @expose */
  17009. range : function(start, stop, step) {
  17010. return (com_ibm_rave_core_arrays_Range.create(Math.ceil(start.getTime() / step) * step, + (stop), step));
  17011. }
  17012. //constructor : function() {}
  17013. });
  17014. /** @expose */
  17015. com_ibm_rave_core_time_Millisecond.INSTANCE = new com_ibm_rave_core_time_Millisecond();
  17016. // $source: com/ibm/rave/core/time/Week
  17017. /************************************************************************
  17018. ** IBM Confidential
  17019. **
  17020. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  17021. **
  17022. ** (C) Copyright IBM Corp. 2015
  17023. **
  17024. ** The source code for this program is not published or otherwise divested of its trade secrets,
  17025. ** irrespective of what has been deposited with the U.S. Copyright Office.
  17026. ************************************************************************/
  17027. // GENERATED
  17028. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, bind
  17029. //@import com/ibm/rave/core/time/TimeInterval (loadtime) // superclass
  17030. //@import com/ibm/rave/core/time/Day (runtime) // Day
  17031. //@import com/ibm/rave/core/time/Year (runtime) // Year
  17032. //@import com/ibm/rave/core/internal/time/TimeUtil (runtime) // dayOfYear
  17033. /**
  17034. * Week time interval. Implemented for each individual day of the week class (Monday, Tuesday..)
  17035. */
  17036. var com_ibm_rave_core_time_Week = rave_externs["Week"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_time_TimeInterval, {
  17037. dayIndex : 0,
  17038. /**
  17039. * Constructor which sets the day index
  17040. * @param (int) index the day index
  17041. */
  17042. /** @expose */
  17043. constructor : function(index) {
  17044. this.dayIndex = index;
  17045. },
  17046. /** @expose */
  17047. floor : com_ibm_rave_core_nativeImpl_Declare.bind(function(date) {
  17048. var newDate = com_ibm_rave_core_time_Day.INSTANCE(date);
  17049. newDate.setDate(newDate.getDate() - (newDate.getDay() + this.dayIndex) % 7);
  17050. return newDate;
  17051. }),
  17052. /** @expose */
  17053. step : function(date, offset) {
  17054. date.setDate(~~(date.getDate() + Math.floor(offset) * 7));
  17055. },
  17056. /** @expose */
  17057. number : com_ibm_rave_core_nativeImpl_Declare.bind(function(date) {
  17058. var day = com_ibm_rave_core_time_Year.INSTANCE(date).getDay();
  17059. return ~~(Math.floor((com_ibm_rave_core_internal_time_TimeUtil.dayOfYear(date) + (day + this.dayIndex) % 7) / 7) - +(day != this.dayIndex));
  17060. })
  17061. });
  17062. // $source: com/ibm/rave/core/internal/time/TimeUtil
  17063. /************************************************************************
  17064. ** IBM Confidential
  17065. **
  17066. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  17067. **
  17068. ** (C) Copyright IBM Corp. 2015
  17069. **
  17070. ** The source code for this program is not published or otherwise divested of its trade secrets,
  17071. ** irrespective of what has been deposited with the U.S. Copyright Office.
  17072. ************************************************************************/
  17073. // GENERATED
  17074. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  17075. //@import com/ibm/rave/core/time/Year (runtime) // Year
  17076. /**
  17077. * Contains a helper method to get the day of the year for a particular date
  17078. */
  17079. var com_ibm_rave_core_internal_time_TimeUtil = com_ibm_rave_core_nativeImpl_Declare({
  17080. });
  17081. /**
  17082. * Helper method to get the day of year for a particular date. It's in here to avoid a circular dependency between Week and Time.
  17083. * @param (com.ibm.rave.core.time.IDate) date the date to get the day of the year for
  17084. * @return (int) The day of the year for a given date
  17085. */
  17086. com_ibm_rave_core_internal_time_TimeUtil.dayOfYear = function(date) {
  17087. var year = com_ibm_rave_core_time_Year.INSTANCE(date);
  17088. return Math.floor((date.getTime() - year.getTime() - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5);
  17089. };
  17090. // $source: com/ibm/rave/core/globalization/BidiStringFormat
  17091. /************************************************************************
  17092. ** IBM Confidential
  17093. **
  17094. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  17095. **
  17096. ** (C) Copyright IBM Corp. 2015
  17097. **
  17098. ** The source code for this program is not published or otherwise divested of its trade secrets,
  17099. ** irrespective of what has been deposited with the U.S. Copyright Office.
  17100. ************************************************************************/
  17101. // GENERATED
  17102. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  17103. //@import com/ibm/rave/core/globalization/BidiStringFormatter (runtime) // new
  17104. /**
  17105. * A factory that creates a Bidi String formatter for a specific locale.
  17106. */
  17107. var com_ibm_rave_core_globalization_BidiStringFormat = rave_externs["BidiStringFormat"] = com_ibm_rave_core_nativeImpl_Declare({
  17108. //locale : null,
  17109. _$functionClassMethod : function() {
  17110. var _$self = function(a0) {
  17111. var args = arguments;
  17112. if (args.length == 0) {
  17113. return _$self.create$0();
  17114. }
  17115. return _$self.create$1(a0);
  17116. };
  17117. return _$self;
  17118. },
  17119. /** @expose */
  17120. constructor : function(locale) {
  17121. this.locale = locale;
  17122. },
  17123. create$0 : function() {
  17124. return new com_ibm_rave_core_globalization_BidiStringFormatter();
  17125. },
  17126. create$1 : function(template) {
  17127. return this();
  17128. }
  17129. });
  17130. // $source: com/ibm/rave/core/globalization/BidiStringFormatter
  17131. /************************************************************************
  17132. ** IBM Confidential
  17133. **
  17134. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  17135. **
  17136. ** (C) Copyright IBM Corp. 2015
  17137. **
  17138. ** The source code for this program is not published or otherwise divested of its trade secrets,
  17139. ** irrespective of what has been deposited with the U.S. Copyright Office.
  17140. ************************************************************************/
  17141. // GENERATED
  17142. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  17143. //@import com/ibm/rave/core/internal/globalization/BidiStringDirection (runtime) // parse, toString
  17144. //@import com/ibm/rave/core/internal/globalization/NumericShaperFactory (runtime) // create
  17145. //@import com/ibm/rave/core/internal/nativeImpl/globalization/BidiProcess (runtime) // determineDirection
  17146. /**
  17147. * Internal class responsible for formatting bidi strings.
  17148. * @author jim
  17149. */
  17150. var com_ibm_rave_core_globalization_BidiStringFormatter = rave_externs["BidiStringFormatter"] = com_ibm_rave_core_nativeImpl_Declare({
  17151. //digitMappingList : null,
  17152. dir : 4,
  17153. numericShapingValue : "",
  17154. defaultNumericContext : "",
  17155. _$functionClassMethod : function() {
  17156. var _$self = function(string, index, groupIndex) {
  17157. var bidiString = ""+(string);
  17158. if (_$self.numericShapingValue != null) {
  17159. var shaper = com_ibm_rave_core_internal_globalization_NumericShaperFactory.create(_$self);
  17160. bidiString = shaper.shape(bidiString);
  17161. }
  17162. var textDirection = _$self.dir;
  17163. if (textDirection == 3) {
  17164. textDirection = com_ibm_rave_core_internal_nativeImpl_globalization_BidiProcess.determineDirection(bidiString);
  17165. }
  17166. if (textDirection == 0) {
  17167. bidiString = String.fromCharCode(8234) + bidiString + String.fromCharCode(8236);
  17168. } else if (textDirection == 1) {
  17169. bidiString = String.fromCharCode(8235) + bidiString + String.fromCharCode(8236);
  17170. }
  17171. return bidiString;
  17172. };
  17173. return _$self;
  17174. },
  17175. constructor : function() {
  17176. this.digitMappingList = [];
  17177. /**
  17178. * Internal class responsible for formatting bidi strings.
  17179. */
  17180. {}
  17181. },
  17182. /**
  17183. * Sets the base text direction of this string. Base text direction refers to the order in which directional runs are laid out in a sentence. For left-to-right sentences, for example, in English, the proper base text direction is Left To Right (LTR), even if a sentence includes Arabic, Hebrew, Urdu, or Farsi words. For right-to-left sentences, for example, in Arabic or Hebrew, the proper base text direction is Right To Left (RTL), even if a sentence includes English words or numbers. Supported values are: “auto” - This implies contextual direction setting. “ltr” - Forced left to right base text direction. This is the default. “rtl” - Forced right to left base text direction. The “auto” option determines the direction contextually by using the first strong character to determine the direction. This option is useful when the text direction may not be know when setting the base text direction property. In general, if text contains letters from right to left scripts, but does not contain letters from a left to right script, the direction will be right to left, or vice versa. If the text contains characters of both types, then the first strong directional character in will determine the direction.
  17184. * @param (String) direction The base text direction of this string. Valid values are "auto", "ltr" or "rtl".
  17185. * @return (com.ibm.rave.core.globalization.BidiStringFormatter) If a parameter is supplied, returns "this" formatter for chaining. If no parameter is supplied, returns a valid set value or "ltr" if no valid value was set.
  17186. */
  17187. direction$0 : function(direction) {
  17188. this.dir = com_ibm_rave_core_internal_globalization_BidiStringDirection.parse(direction);
  17189. return this;
  17190. },
  17191. direction$1 : function() {
  17192. return com_ibm_rave_core_internal_globalization_BidiStringDirection.toString(this.dir);
  17193. },
  17194. /**
  17195. * Sets the type of "numeric shaping" to apply to this string. Numeric shaping allows digit shapes to be presented in other forms than European shapes (0123456789), such as Arabic-Indic (٠١٢٣٤٥٦٧٨٩) or Thai (๐ ๑ ๒ ๓ ๔ ๕ ๖ ๗ ๘ ๙ ). The shaping is done from European digits to non-European digits, but not the other way around. The two types of numeric shaping supported are “national” or “contextual”. When “national” is specified, digits are shaped to the national digit types set via the digits API. For example, if the national digits are specified as ARABIC, then all European digits are shaped to ARABIC. When “contextual” is specified, digit shapes are determined from adjoining characters in the value; if the most recent character before the numerical character is left-to-right, the number is displayed as a European number. For example, if ARABIC is specified as the contextual digits, then all the European digits that are preceded by ARABIC text are shaped to ARABIC digits.
  17196. * @param (String) numericShapingType The type of numeric shaping to apply to this string. Valid options are "national" or "contextual"
  17197. * @return (com.ibm.rave.core.globalization.BidiStringFormatter) If a parameter is supplied, returns "this" formatter for chaining. If no parameter is supplied, returns the set value.
  17198. */
  17199. numericShaping$0 : function(numericShapingType) {
  17200. this.numericShapingValue = (numericShapingType != null) ? numericShapingType.toLowerCase() : null;
  17201. return this;
  17202. },
  17203. numericShaping$1 : function() {
  17204. return this.numericShapingValue;
  17205. },
  17206. /**
  17207. * Set the default context for numerical shaping when "contextual" shaping is used. Ignored in "national" shaping. The default context is used to determine the context for numerical shaping when a string input starts with digits. This value defaults to EUROPEAN. If "national" shaping is used, this value is ignored. If defaultContext is not set, or is set to 'null' defaults to "EUROPEAN".
  17208. * @param (String) defaultContext A string representation of the language that will be the default for numeric contextual shaping. Valid values are: ARABIC BENGALI DEVANAGARI EASTERN_ARABIC ETHIOPIC EUROPEAN GUJARATI GURMUKHI KANNADA KHMER LAO MALAYALAM MONGOLIAN MYANMAR ORIYA TAMIL TELUGU THAI TIBETAN
  17209. * @return (com.ibm.rave.core.globalization.BidiStringFormatter) If a parameter is supplied, returns "this" formatter for chaining. If no parameter is supplied, returns the set value, or null if none set.
  17210. */
  17211. defaultContext$0 : function(defaultContext) {
  17212. this.defaultNumericContext = defaultContext;
  17213. return this;
  17214. },
  17215. defaultContext$1 : function() {
  17216. return this.defaultNumericContext;
  17217. },
  17218. /**
  17219. * Defines how European digits are mapped when numerical shaping is used. All the European digits are shaped as per the specified contextual digits, based on the preceding context. For example, if ARABIC and MALAYALAM are specifed as the contextual digits then all the European digits that are preceded by ARABIC text are shaped to ARABIC and all European digits that are preceded by MALAYALAM are shaped to MALAYALAM. If both ARABIC and EASTERN_ARABIC are specifed, the digits are shaped to EASTERN_ARABIC. The default value is set via defaultContext(). If no defaultContext is specified, EUROPEAN is used. The following are valid values for the digits numeric shaping properties. Values are case sensitive. ARABIC BENGALI DEVANAGARI EASTERN_ARABIC ETHIOPIC EUROPEAN GUJARATI GURMUKHI KANNADA KHMER LAO MALAYALAM MONGOLIAN MYANMAR ORIYA TAMIL TELUGU THAI TIBETAN
  17220. * @param (Array) digitTypes Either a single value, or a list of alternate digit types to use to map European digits to another language.
  17221. * @return (com.ibm.rave.core.globalization.BidiStringFormatter) If a parameter is supplied, returns "this" formatter for chaining. If no parameter is supplied, returns the set value.
  17222. */
  17223. digitMapping$0 : function(digitTypes) {
  17224. var array = digitTypes;
  17225. this.digitMappingList = (array);
  17226. return this;
  17227. },
  17228. digitMapping$1 : function(string) {
  17229. this.digitMappingList = [string];
  17230. return this;
  17231. },
  17232. digitMapping$2 : function() {
  17233. if (this.digitMappingList.length == 0 && this.defaultNumericContext != null) {
  17234. return [this.defaultNumericContext];
  17235. }
  17236. return this.digitMappingList;
  17237. },
  17238. /** @expose */
  17239. direction : function(a0) {
  17240. var args = arguments;
  17241. if (args.length == 0) {
  17242. return this.direction$1();
  17243. }
  17244. return this.direction$0(a0);
  17245. },
  17246. /** @expose */
  17247. numericShaping : function(a0) {
  17248. var args = arguments;
  17249. if (args.length == 0) {
  17250. return this.numericShaping$1();
  17251. }
  17252. return this.numericShaping$0(a0);
  17253. },
  17254. /** @expose */
  17255. defaultContext : function(a0) {
  17256. var args = arguments;
  17257. if (args.length == 0) {
  17258. return this.defaultContext$1();
  17259. }
  17260. return this.defaultContext$0(a0);
  17261. },
  17262. /** @expose */
  17263. digitMapping : function(a0) {
  17264. var args = arguments;
  17265. if (args.length == 0) {
  17266. return this.digitMapping$2();
  17267. }
  17268. if (args.length == 1 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]")) {
  17269. return this.digitMapping$0(a0);
  17270. }
  17271. return this.digitMapping$1(a0);
  17272. }
  17273. });
  17274. // $source: com/ibm/rave/core/internal/globalization/AbstractNumericShaper
  17275. /************************************************************************
  17276. ** IBM Confidential
  17277. **
  17278. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  17279. **
  17280. ** (C) Copyright IBM Corp. 2015
  17281. **
  17282. ** The source code for this program is not published or otherwise divested of its trade secrets,
  17283. ** irrespective of what has been deposited with the U.S. Copyright Office.
  17284. ************************************************************************/
  17285. // GENERATED
  17286. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  17287. var com_ibm_rave_core_internal_globalization_AbstractNumericShaper = com_ibm_rave_core_nativeImpl_Declare({
  17288. //constructor : function() {},
  17289. /**
  17290. * Return the a shaped version of a string where the numbers have been shaped based on the type of shaping.
  17291. * @param (String) string
  17292. * @return (String) The shaped version of the param string, based on the type of shaping.
  17293. */
  17294. //shape : function(string) {}
  17295. });
  17296. com_ibm_rave_core_internal_globalization_AbstractNumericShaper.offsets = [0, 1584, 1728, 2358, 2486, 2614, 2742, 2870, 2998, 3126, 3254, 3382, 3616, 3744, 3824, 4112, 4921, 6064, 6112];
  17297. // $source: com/ibm/rave/core/internal/globalization/NationalNumericShaper
  17298. /************************************************************************
  17299. ** IBM Confidential
  17300. **
  17301. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  17302. **
  17303. ** (C) Copyright IBM Corp. 2015
  17304. **
  17305. ** The source code for this program is not published or otherwise divested of its trade secrets,
  17306. ** irrespective of what has been deposited with the U.S. Copyright Office.
  17307. ************************************************************************/
  17308. // GENERATED
  17309. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  17310. //@import com/ibm/rave/core/internal/globalization/AbstractNumericShaper (loadtime) // offsets, superclass
  17311. var com_ibm_rave_core_internal_globalization_NationalNumericShaper = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_globalization_AbstractNumericShaper, {
  17312. nationalDigitCode : 0,
  17313. constructor : function(nationDigitCode) {
  17314. this.nationalDigitCode = nationDigitCode;
  17315. },
  17316. shape : function(text) {
  17317. var digitCode = this.nationalDigitCode;
  17318. if (text == null) {
  17319. return null;
  17320. }
  17321. if (digitCode > com_ibm_rave_core_internal_globalization_AbstractNumericShaper.offsets.length - 1) {
  17322. return text;
  17323. }
  17324. var offset = com_ibm_rave_core_internal_globalization_AbstractNumericShaper.offsets[digitCode];
  17325. var s = "";
  17326. var minDigit = 48;
  17327. var maxDigit = 57;
  17328. for (var i = 0; i < text.length; ++i) {
  17329. var c = text.charCodeAt(i);
  17330. if (c >= minDigit && c <= maxDigit) {
  17331. s+=(String.fromCharCode((c + offset)));
  17332. } else {
  17333. s+=(String.fromCharCode(c));
  17334. }
  17335. }
  17336. return s;
  17337. }
  17338. });
  17339. // $source: com/ibm/rave/core/internal/globalization/ContextualNumericShaper
  17340. /************************************************************************
  17341. ** IBM Confidential
  17342. **
  17343. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  17344. **
  17345. ** (C) Copyright IBM Corp. 2015
  17346. **
  17347. ** The source code for this program is not published or otherwise divested of its trade secrets,
  17348. ** irrespective of what has been deposited with the U.S. Copyright Office.
  17349. ************************************************************************/
  17350. // GENERATED
  17351. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  17352. //@import com/ibm/rave/core/internal/globalization/AbstractNumericShaper (loadtime) // offsets, superclass
  17353. var com_ibm_rave_core_internal_globalization_ContextualNumericShaper = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_globalization_AbstractNumericShaper, {
  17354. //contextualDigitCodes : null,
  17355. startingContextCode : 0,
  17356. constructor : function(contextualDigitCodes, startingContextCode) {
  17357. this.contextualDigitCodes = contextualDigitCodes;
  17358. this.startingContextCode = startingContextCode;
  17359. },
  17360. shape : function(text) {
  17361. if (text == null) {
  17362. return null;
  17363. }
  17364. var contextCodes = this.contextualDigitCodes;
  17365. var pStartingContextCode = (this.startingContextCode > com_ibm_rave_core_internal_globalization_AbstractNumericShaper.offsets.length - 1 || contextCodes.length == 0) ? 0 : this.startingContextCode;
  17366. var contexts = 0;
  17367. for (var i = 0; i < contextCodes.length; ++i) {
  17368. contexts |= 1 << contextCodes[i];
  17369. }
  17370. var s = "";
  17371. var offset = 0;
  17372. var range = 0;
  17373. if (((1 << this.startingContextCode) & contexts) != 0) {
  17374. offset = com_ibm_rave_core_internal_globalization_AbstractNumericShaper.offsets[this.startingContextCode];
  17375. range = this.startingContextCode;
  17376. }
  17377. for (var i = 0; i < text.length; ++i) {
  17378. var c = text.charCodeAt(i);
  17379. var minDigit = 48;
  17380. var maxDigit = 57;
  17381. if (c >= minDigit && c <= maxDigit) {
  17382. s+=(String.fromCharCode((c + offset)));
  17383. } else {
  17384. s+=(String.fromCharCode(c));
  17385. var newRange = com_ibm_rave_core_internal_globalization_ContextualNumericShaper.getRange(c);
  17386. if (newRange != range) {
  17387. if (com_ibm_rave_core_internal_globalization_ContextualNumericShaper.hasContext(c)) {
  17388. if ((1 << newRange & contexts) != 0) {
  17389. range = newRange;
  17390. if (range == 1 && ((contexts & 1 << 2) != 0)) {
  17391. range = 2;
  17392. }
  17393. offset = com_ibm_rave_core_internal_globalization_AbstractNumericShaper.offsets[range];
  17394. } else if (((1 << newRange) & contexts) == 0) {
  17395. if (newRange == 2) {
  17396. if ((1 << 1 & contexts) != 0) {
  17397. range = 1;
  17398. offset = com_ibm_rave_core_internal_globalization_AbstractNumericShaper.offsets[range];
  17399. }
  17400. } else if (newRange == 1) {
  17401. if ((1 << 2 & contexts) != 0) {
  17402. range = 2;
  17403. offset = com_ibm_rave_core_internal_globalization_AbstractNumericShaper.offsets[range];
  17404. }
  17405. } else {
  17406. range = 0;
  17407. offset = 0;
  17408. }
  17409. }
  17410. }
  17411. }
  17412. }
  17413. }
  17414. return s;
  17415. }
  17416. });
  17417. /**
  17418. * Determine if the said character has a context.
  17419. * @param (int) charValue - the char value
  17420. * @return (boolean) - true if the character has context.
  17421. */
  17422. com_ibm_rave_core_internal_globalization_ContextualNumericShaper.hasContext = function(charValue) {
  17423. var searchIndex = com_ibm_rave_core_internal_globalization_ContextualNumericShaper.search(com_ibm_rave_core_internal_globalization_ContextualNumericShaper.contextualCharRanges, charValue);
  17424. return (searchIndex != -1);
  17425. };
  17426. /**
  17427. * Get the unicode range index to which the character belongs.
  17428. * @param (int) charValue - character
  17429. * @return (int) - the index of the range.
  17430. */
  17431. com_ibm_rave_core_internal_globalization_ContextualNumericShaper.getRange = function(charValue) {
  17432. var index = com_ibm_rave_core_internal_globalization_ContextualNumericShaper.search(com_ibm_rave_core_internal_globalization_ContextualNumericShaper.ranges, charValue);
  17433. if (index == -1) {
  17434. return 0;
  17435. }
  17436. if (index == 19) {
  17437. return 1;
  17438. }
  17439. return index;
  17440. };
  17441. com_ibm_rave_core_internal_globalization_ContextualNumericShaper.search = function(pRanges, charValue) {
  17442. var start = 0;
  17443. var end = pRanges.length - 1;
  17444. while (start <= end) {
  17445. var mid = Math.floor((start + end) / 2);
  17446. if (pRanges[mid].start <= charValue && pRanges[mid].end > charValue) {
  17447. return mid;
  17448. } else if (pRanges[mid].start > charValue) {
  17449. end = mid - 1;
  17450. } else if (pRanges[mid].end <= charValue) {
  17451. start = mid + 1;
  17452. }
  17453. }
  17454. return -1;
  17455. };
  17456. com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange = function(s, e) {
  17457. this.start = s;
  17458. this.end = e;
  17459. };
  17460. com_ibm_rave_core_internal_globalization_ContextualNumericShaper.EUROPEAN = 0;
  17461. com_ibm_rave_core_internal_globalization_ContextualNumericShaper.ARABIC = 1;
  17462. com_ibm_rave_core_internal_globalization_ContextualNumericShaper.EASTERN_ARABIC = 2;
  17463. com_ibm_rave_core_internal_globalization_ContextualNumericShaper.EXTENDED_ARABIC = 19;
  17464. com_ibm_rave_core_internal_globalization_ContextualNumericShaper.contextualCharRanges = [new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x41, 0x5b), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x61, 0x7b), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xaa, 0xab), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xb5, 0xb6), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xba, 0xbb), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xc0, 0xd7), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xd8, 0xf7), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xf8, 0x2b9), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x2bb, 0x2c2), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x2d0, 0x2d2), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x2e0, 0x2e5), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x2ee, 0x2ef), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x608, 0x609), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x60b, 0x60c), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x60d, 0x60e), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x61b, 0x64b), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x66d, 0x670), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x671, 0x6d6), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x6e5, 0x6e7), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x6ee, 0x6f0), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x6fa, 0x701), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x750, 0x781), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x903, 0x93a), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x93b, 0x93c), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x93d, 0x941), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x949, 0x94d), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x94e, 0x951), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x958, 0x962), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x964, 0x981), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x982, 0x9bc), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x9bd, 0x9c1), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x9c7, 0x9cd), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x9ce, 0x9e2), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x9e6, 0x9f2), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x9f4, 0x9fb), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xa03, 0xa3c), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xa3e, 0xa41), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xa59, 0xa70), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xa72, 0xa75), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xa83, 0xabc), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xabd, 0xac1), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xac9, 0xacd), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xad0, 0xae2), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xae6, 0xaf1), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xb02, 0xb3c), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xb3d, 0xb3f), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xb40, 0xb41), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xb47, 0xb4d), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xb57, 0xb62), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xb66, 0xb82), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xb83, 0xbc0), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xbc1, 0xbcd), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xbd0, 0xbf3), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xc01, 0xc3e), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xc41, 0xc46), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xc58, 0xc62), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xc66, 0xc78), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xc7f, 0xcbc), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xcbd, 0xccc), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xcd5, 0xce2), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xce6, 0xd41), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xd46, 0xd4d), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xd4e, 0xd62), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xd66, 0xd81), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xe00, 0xe31), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xe32, 0xe34), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xe40, 0xe47), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xe4f, 0xeb1), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xeb2, 0xeb4), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xebd, 0xec8), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xed0, 0xf18), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xf1a, 0xf35), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xf36, 0xf37), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xf38, 0xf39), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xf3e, 0xf71), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xf7f, 0xf80), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xf85, 0xf86), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xf88, 0xf8d), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xfbe, 0xfc6), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0xfc7, 0x102d), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x1031, 0x1032), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x1038, 0x1039), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x103b, 0x103d), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x103f, 0x1058), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x105a, 0x105e), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x1061, 0x1071), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x1075, 0x1081), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x1200, 0x135d), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x1360, 0x1381), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x1780, 0x17b7), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x17be, 0x17c6), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x17c7, 0x17c9), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x17d4, 0x17db), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x17dc, 0x17dd), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x17e0, 0x17f0), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x1810, 0x18a9), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x18aa, 0x1901)];
  17465. com_ibm_rave_core_internal_globalization_ContextualNumericShaper.ranges = [new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x0000, 0x0300), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x0600, 0x0700), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x0600, 0x0700), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x0900, 0x0980), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x0980, 0x0a00), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x0a00, 0x0a80), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x0a80, 0x0b00), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x0b00, 0x0b80), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x0b80, 0x0c00), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x0c00, 0x0c80), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x0c80, 0x0d00), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x0d00, 0x0d80), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x0e00, 0x0e80), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x0e80, 0x0f00), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x0f00, 0x1000), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x1000, 0x10a0), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x1200, 0x13a0), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x1780, 0x1800), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x1800, 0x18b0), new com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange(0x0750, 0x0780)];
  17466. // $source: com/ibm/rave/core/internal/globalization/DefaultNumericShaper
  17467. /************************************************************************
  17468. ** IBM Confidential
  17469. **
  17470. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  17471. **
  17472. ** (C) Copyright IBM Corp. 2015
  17473. **
  17474. ** The source code for this program is not published or otherwise divested of its trade secrets,
  17475. ** irrespective of what has been deposited with the U.S. Copyright Office.
  17476. ************************************************************************/
  17477. // GENERATED
  17478. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  17479. //@import com/ibm/rave/core/internal/globalization/AbstractNumericShaper (loadtime) // superclass
  17480. var com_ibm_rave_core_internal_globalization_DefaultNumericShaper = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_globalization_AbstractNumericShaper, {
  17481. shape : function(string) {
  17482. return string;
  17483. }
  17484. });
  17485. // $source: com/ibm/rave/core/internal/globalization/NumericShaperFactory
  17486. /************************************************************************
  17487. ** IBM Confidential
  17488. **
  17489. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  17490. **
  17491. ** (C) Copyright IBM Corp. 2015
  17492. **
  17493. ** The source code for this program is not published or otherwise divested of its trade secrets,
  17494. ** irrespective of what has been deposited with the U.S. Copyright Office.
  17495. ************************************************************************/
  17496. // GENERATED
  17497. //@import com/ibm/rave/core/internal/globalization/NationalNumericShaper (static) // new
  17498. //@import com/ibm/rave/core/internal/globalization/ContextualNumericShaper (static) // new
  17499. //@import com/ibm/rave/core/internal/globalization/DefaultNumericShaper (static) // new
  17500. var com_ibm_rave_core_internal_globalization_NumericShaperFactory = {
  17501. };
  17502. com_ibm_rave_core_internal_globalization_NumericShaperFactory.initialize_digitMap = function() {
  17503. var digitMap = {};
  17504. digitMap["ARABIC"] = 1;
  17505. digitMap["BENGALI"] = 4;
  17506. digitMap["DEVANAGARI"] = 3;
  17507. digitMap["EASTERN_ARABIC"] = 2;
  17508. digitMap["ETHIOPIC"] = 16;
  17509. digitMap["EUROPEAN"] = 0;
  17510. digitMap["GUJARATI"] = 6;
  17511. digitMap["GURMUKHI"] = 5;
  17512. digitMap["KANNADA"] = 10;
  17513. digitMap["KHMER"] = 17;
  17514. digitMap["LAO"] = 13;
  17515. digitMap["MALAYALAM"] = 11;
  17516. digitMap["MONGOLIAN"] = 18;
  17517. digitMap["MYANMAR"] = 15;
  17518. digitMap["ORIYA"] = 7;
  17519. digitMap["TAMIL"] = 8;
  17520. digitMap["TELUGU"] = 9;
  17521. digitMap["THAI"] = 12;
  17522. digitMap["TIBETAN"] = 14;
  17523. return digitMap;
  17524. };
  17525. /**
  17526. * Factory method to create a Shaper object that can shape numbers for a StringFormatter.
  17527. * @param (com.ibm.rave.core.globalization.BidiStringFormatter) formatter - localization formatter to construct the object.
  17528. * @return (com.ibm.rave.core.internal.globalization.AbstractNumericShaper) - the NumericalShapingInfo object.
  17529. */
  17530. com_ibm_rave_core_internal_globalization_NumericShaperFactory.create = function(formatter) {
  17531. var digits = formatter.digitMapping();
  17532. var shaping = formatter.numericShaping();
  17533. if (digits.length > 0 && shaping != null) {
  17534. shaping = shaping.toLowerCase();
  17535. if (shaping.indexOf("nation") == 0) {
  17536. return new com_ibm_rave_core_internal_globalization_NationalNumericShaper(com_ibm_rave_core_internal_globalization_NumericShaperFactory.getDigitCode(digits[0]));
  17537. } else if (shaping.indexOf("context") == 0) {
  17538. return new com_ibm_rave_core_internal_globalization_ContextualNumericShaper(com_ibm_rave_core_internal_globalization_NumericShaperFactory.getDigitCodes(formatter.digitMapping()), com_ibm_rave_core_internal_globalization_NumericShaperFactory.getDigitCode(formatter.defaultContext()));
  17539. }
  17540. }
  17541. return new com_ibm_rave_core_internal_globalization_DefaultNumericShaper();
  17542. };
  17543. /**
  17544. * Gets the integer code for the specified national digit. For an invalid nation digit string, EUROPEAN is returned.
  17545. * @param (String) nationalDigits
  17546. * @return (int) - the digit code.
  17547. */
  17548. com_ibm_rave_core_internal_globalization_NumericShaperFactory.getDigitCode = function(nationalDigits) {
  17549. var digit = com_ibm_rave_core_internal_globalization_NumericShaperFactory.digitMap[nationalDigits.toUpperCase()];
  17550. if (digit == null) {
  17551. return com_ibm_rave_core_internal_globalization_NumericShaperFactory.digitMap["EUROPEAN"];
  17552. }
  17553. return digit;
  17554. };
  17555. /**
  17556. * Returns an array of integer codes for the specified digits.
  17557. * @param (Array) list
  17558. * @return (int[]) Array of integer codes
  17559. */
  17560. com_ibm_rave_core_internal_globalization_NumericShaperFactory.getDigitCodes = function(list) {
  17561. var digits = [];
  17562. var i = 0;
  17563. for (var __i_enFor0 = 0, __exp_enFor0 = list, __len_enFor0 = __exp_enFor0.length;
  17564. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  17565. var digitStr = __exp_enFor0[__i_enFor0];
  17566. digits[i++] = com_ibm_rave_core_internal_globalization_NumericShaperFactory.getDigitCode(digitStr);
  17567. }
  17568. return digits;
  17569. };
  17570. com_ibm_rave_core_internal_globalization_NumericShaperFactory.EUROPEAN = "EUROPEAN";
  17571. com_ibm_rave_core_internal_globalization_NumericShaperFactory.NATIONAL = "nation";
  17572. com_ibm_rave_core_internal_globalization_NumericShaperFactory.CONTEXTUAL = "context";
  17573. com_ibm_rave_core_internal_globalization_NumericShaperFactory.digitMap = com_ibm_rave_core_internal_globalization_NumericShaperFactory.initialize_digitMap();
  17574. // $source: com/ibm/rave/core/locale/LocaleObject
  17575. /************************************************************************
  17576. ** IBM Confidential
  17577. **
  17578. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  17579. **
  17580. ** (C) Copyright IBM Corp. 2015
  17581. **
  17582. ** The source code for this program is not published or otherwise divested of its trade secrets,
  17583. ** irrespective of what has been deposited with the U.S. Copyright Office.
  17584. ************************************************************************/
  17585. // GENERATED
  17586. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  17587. var com_ibm_rave_core_locale_LocaleObject = rave_externs["LocaleObject"] = com_ibm_rave_core_nativeImpl_Declare({
  17588. /** @expose */
  17589. decimal : null,
  17590. /** @expose */
  17591. thousands : null,
  17592. /** @expose */
  17593. grouping : null,
  17594. /** @expose */
  17595. currency : null,
  17596. /** @expose */
  17597. dateTime : null,
  17598. /** @expose */
  17599. date : null,
  17600. /** @expose */
  17601. time : null,
  17602. /** @expose */
  17603. periods : null,
  17604. /** @expose */
  17605. days : null,
  17606. /** @expose */
  17607. shortDays : null,
  17608. /** @expose */
  17609. months : null,
  17610. /** @expose */
  17611. shortMonths : null
  17612. });
  17613. // $source: com/ibm/rave/core/locale/enUS
  17614. /************************************************************************
  17615. ** IBM Confidential
  17616. **
  17617. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  17618. **
  17619. ** (C) Copyright IBM Corp. 2015
  17620. **
  17621. ** The source code for this program is not published or otherwise divested of its trade secrets,
  17622. ** irrespective of what has been deposited with the U.S. Copyright Office.
  17623. ************************************************************************/
  17624. // GENERATED
  17625. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  17626. //@import com/ibm/rave/core/locale/LocaleObject (loadtime) // superclass
  17627. var com_ibm_rave_core_locale_enUS = rave_externs["enUS"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_locale_LocaleObject, {
  17628. /**
  17629. * the en-US locale. This locale is used as a default, unless the default is otherwise specified to be a different/custome locale
  17630. */
  17631. /** @expose */
  17632. constructor : function() {
  17633. this.decimal = ".";
  17634. this.thousands = ",";
  17635. this.grouping = [3.0];
  17636. this.currency = ["$", ""];
  17637. this.dateTime = "%a %b %e %X %Y";
  17638. this.date = "%m/%d/%Y";
  17639. this.time = "%H:%M:%S";
  17640. this.periods = ["AM", "PM"];
  17641. this.days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
  17642. this.shortDays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
  17643. this.months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
  17644. this.shortMonths = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
  17645. }
  17646. });
  17647. // $source: com/ibm/rave/core/locale/Locale
  17648. /************************************************************************
  17649. ** IBM Confidential
  17650. **
  17651. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  17652. **
  17653. ** (C) Copyright IBM Corp. 2015
  17654. **
  17655. ** The source code for this program is not published or otherwise divested of its trade secrets,
  17656. ** irrespective of what has been deposited with the U.S. Copyright Office.
  17657. ************************************************************************/
  17658. // GENERATED
  17659. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  17660. //@import com/ibm/rave/core/locale/LocaleFormatter (static) // new
  17661. //@import com/ibm/rave/core/locale/enUS (static) // new
  17662. /**
  17663. * The formatting of numbers, dates and currencies varies by language and locale. While the default is intended for U.S. English, you can change the behavior of the formatters by loading a new locale as needed.
  17664. * @author tina
  17665. */
  17666. var com_ibm_rave_core_locale_Locale = com_ibm_rave_core_nativeImpl_Declare({
  17667. _$functionClassMethod : function() {
  17668. var _$self = /**
  17669. * Returns a new locale given the specified definition. The locale definition must include the following properties for number formatting: decimal - the decimal place string (e.g., "."). thousands - the group separator string (e.g., ","). grouping - the array of group sizes (e.g., [3]), cycled as needed. currency - the currency prefix and suffix strings (e.g., ["$", ""]). (Note that the thousands property is a slight misnomer, as the grouping definition allows groups other than thousands.) The locale definition must also include the following properties for time formatting: dateTime - the date and time (%c) format string (e.g., "%a %b %e %X %Y"). date - the date (%x) format string (e.g., "%m/%d/%Y"). time - the time (%X) format string (e.g., "%H:%M:%S"). periods - the locale’s A.M. and P.M. equivalents (e.g., ["AM", "PM"]). days - the full names of the weekdays, starting with Sunday. shortDays - the abbreviated names of the weekdays, starting with Sunday. months - the full names of the months (starting with January). shortMonths - the abbreviated names of the months (starting with January).
  17670. * @param (com.ibm.rave.core.locale.LocaleObject) localeObject the locale object to use
  17671. * @return (com.ibm.rave.core.locale.LocaleFormatter) the LocaleFormatter object containing the new numberformat
  17672. */
  17673. function(localeObject) {
  17674. return new com_ibm_rave_core_locale_LocaleFormatter(localeObject);
  17675. };
  17676. return _$self;
  17677. },
  17678. /**
  17679. * Gets the locale formatter that is used by default by Time, Number and Bidi String formatting. Currently this value is immutable and is always EN-US.
  17680. * @return (com.ibm.rave.core.locale.LocaleFormatter) the default locale formatter.
  17681. */
  17682. /** @expose */
  17683. getDefault : function() {
  17684. return com_ibm_rave_core_locale_Locale.formatter;
  17685. }
  17686. //constructor : function() {}
  17687. });
  17688. /** @expose */
  17689. com_ibm_rave_core_locale_Locale.getInstance = function() {
  17690. if (!com_ibm_rave_core_locale_Locale.INSTANCE) {
  17691. {
  17692. if (!com_ibm_rave_core_locale_Locale.INSTANCE) {
  17693. com_ibm_rave_core_locale_Locale.INSTANCE = new com_ibm_rave_core_locale_Locale();
  17694. }
  17695. }
  17696. }
  17697. return com_ibm_rave_core_locale_Locale.INSTANCE;
  17698. };
  17699. /**
  17700. * Default system locale (en-us).
  17701. */
  17702. /** @expose */
  17703. com_ibm_rave_core_locale_Locale.DEFAULT_LOCALE = new com_ibm_rave_core_locale_enUS();
  17704. com_ibm_rave_core_locale_Locale.formatter = new com_ibm_rave_core_locale_LocaleFormatter(com_ibm_rave_core_locale_Locale.DEFAULT_LOCALE);
  17705. //com_ibm_rave_core_locale_Locale.INSTANCE = null;
  17706. // $source: com/ibm/rave/core/scales/PowScale
  17707. /************************************************************************
  17708. ** IBM Confidential
  17709. **
  17710. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  17711. **
  17712. ** (C) Copyright IBM Corp. 2015
  17713. **
  17714. ** The source code for this program is not published or otherwise divested of its trade secrets,
  17715. ** irrespective of what has been deposited with the U.S. Copyright Office.
  17716. ************************************************************************/
  17717. // GENERATED
  17718. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  17719. //@import com/ibm/rave/core/scales/AbstractScale (loadtime) // superclass
  17720. //@import com/ibm/rave/core/scales/LinearScale (runtime) // linearTicks, linearNice, linearTickFormat
  17721. var com_ibm_rave_core_scales_PowScale = rave_externs["PowScale"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scales_AbstractScale, {
  17722. //_linear : null,
  17723. //_exponent : null,
  17724. //_domain : null,
  17725. //powp : null,
  17726. //powb : null,
  17727. _$functionClassMethod : function() {
  17728. var _$self = function(data, index, groupIndex) {
  17729. return _$self._linear.call(this, _$self.powp(+ (data)), index, groupIndex);
  17730. };
  17731. return _$self;
  17732. },
  17733. /** @expose */
  17734. constructor : function(linear, exponent, domain) {
  17735. this._linear = linear;
  17736. this._exponent = exponent;
  17737. this._domain = domain;
  17738. this.powp = com_ibm_rave_core_scales_PowScale.pow(this._exponent);
  17739. this.powb = com_ibm_rave_core_scales_PowScale.pow(1 / this._exponent);
  17740. var self = this;
  17741. this.ticks = function(tickArguments) {
  17742. if (tickArguments !== null || arguments.length > 1){
  17743. tickArguments = Array.prototype.slice.call(arguments);
  17744. }
  17745. {
  17746. return com_ibm_rave_core_scales_LinearScale.linearTicks.apply(com_ibm_rave_core_scales_LinearScale, [self._domain].concat(tickArguments));
  17747. }
  17748. };
  17749. this.tickFormat = function(tickArguments) {
  17750. if (tickArguments !== null || arguments.length > 1){
  17751. tickArguments = Array.prototype.slice.call(arguments);
  17752. }
  17753. {
  17754. var count = tickArguments.length > 0 ? + (tickArguments[0]) : null;
  17755. var format = tickArguments.length > 1 ? tickArguments[1] : null;
  17756. return com_ibm_rave_core_scales_LinearScale.linearTickFormat(self._domain, count, ((typeof format === "string" || format instanceof String)) ? format : null);
  17757. }
  17758. };
  17759. this.invert = function(y) {
  17760. return self.powb(+ (self._linear.invert(y)));
  17761. };
  17762. },
  17763. domain$0 : function(values) {
  17764. this._domain = new Array(values.length);
  17765. for (var i = 0; i < values.length; ++i) {
  17766. this._domain[i] = + (values[i]);
  17767. }
  17768. var self = this;
  17769. this._linear.domain$0(this._domain.map(function(currentValue, index, array) {
  17770. return self.powp(+ (currentValue));
  17771. }));
  17772. return this;
  17773. },
  17774. domain$1 : function() {
  17775. return this._domain;
  17776. },
  17777. range$0 : function(values) {
  17778. this._linear.range$0(values);
  17779. return this;
  17780. },
  17781. range$1 : function() {
  17782. return this._linear.range$1();
  17783. },
  17784. /** @expose */
  17785. copy : function() {
  17786. return new com_ibm_rave_core_scales_PowScale(this._linear.copy(), this._exponent, this._domain);
  17787. },
  17788. /**
  17789. * If boolean is specified, enables or disables clamping accordingly. By default, clamping is disabled, such that if a value outside the input domain is passed to the scale, the scale may return a value outside the output range through linear extrapolation. For example, with the default domain and range of [0,1], an input value of 2 will return an output value of 2. If clamping is enabled, the normalized domain parameter t is clamped to the range [0,1], such that the return value of the scale is always within the scale's output range. If boolean is not specified, returns whether or not the scale currently clamps values to within the output range.
  17790. * @param (boolean) c True or False to Enable or Disable (respectively) clamping.
  17791. * @return (com.ibm.rave.core.scales.PowScale) This scale.
  17792. */
  17793. clamp$0 : function(c) {
  17794. this._linear.clamp$0(c);
  17795. return this;
  17796. },
  17797. /**
  17798. * If boolean is specified, enables or disables clamping accordingly. By default, clamping is disabled, such that if a value outside the input domain is passed to the scale, the scale may return a value outside the output range through linear extrapolation. For example, with the default domain and range of [0,1], an input value of 2 will return an output value of 2. If clamping is enabled, the normalized domain parameter t is clamped to the range [0,1], such that the return value of the scale is always within the scale's output range. If boolean is not specified, returns whether or not the scale currently clamps values to within the output range.
  17799. * @return (boolean) True if clamping is enabled, false otherwise.
  17800. */
  17801. clamp$1 : function() {
  17802. return this._linear.clamp$1();
  17803. },
  17804. /**
  17805. * Sets the scale's output range to the specified array of values, while also setting the scale's interpolator to Rave.interpolateRound. This is a convenience routine for when the values output by the scale should be exact integers, such as to avoid antialiasing artifacts. It is also possible to round the output values manually after the scale is applied.
  17806. * @param (Array) x Output range values.
  17807. * @return (com.ibm.rave.core.scales.PowScale) This scale.
  17808. */
  17809. /** @expose */
  17810. rangeRound : function(x) {
  17811. this._linear.rangeRound(x);
  17812. return this;
  17813. },
  17814. /**
  17815. * If {@code interpolate} is specified, sets the scale's output interpolator using the specified interpolator factory. The interpolator factory defaults to {@link this.Rave#com_ibm_rave_core_Rave.interpolate} , and is used to map the normalized domain parameter t in [0,1] to the corresponding value in the output range. The interpolator factory will be used to construct interpolators for each adjacent pair of values from the output range. If factory is not specified, returns the scale's interpolator factory.
  17816. * @param (com.ibm.rave.core.interpolate.InterpolatorFactory) interpolate The interpolator factory to assign to this scale.
  17817. * @return (com.ibm.rave.core.scales.PowScale) This scale.
  17818. */
  17819. interpolate$0 : function(interpolate) {
  17820. this._linear.interpolate$0(interpolate);
  17821. return this;
  17822. },
  17823. /**
  17824. * If {@code interpolate} is specified, sets the scale's output interpolator using the specified interpolator factory. The interpolator factory defaults to {@link this.Rave#com_ibm_rave_core_Rave.interpolate} , and is used to map the normalized domain parameter t in [0,1] to the corresponding value in the output range. The interpolator factory will be used to construct interpolators for each adjacent pair of values from the output range. If factory is not specified, returns the scale's interpolator factory.
  17825. * @return (Object) The interpolator assigned to this scale.
  17826. */
  17827. interpolate$1 : function() {
  17828. return this._linear.interpolate$1();
  17829. },
  17830. /**
  17831. * Extends the domain so that it starts and ends on nice round values. This method typically modifies the scale's domain, and may only extend the bounds to the nearest round value. The precision of the round value is dependent on the extent of the domain dx according to the following formula: exp(round(log(dx)) - 1). Nicing is useful if the domain is computed from data and may be irregular. For example, for a domain of [0.20147987687960267, 0.996679553296417], the nice domain is [0.2, 1]. If the domain has more than two values, nicing the domain only affects the first and last value. The optional tick count argument allows greater control over the step size used to extend the bounds, guaranteeing that the returned ticks will exactly cover the domain.
  17832. * @return (com.ibm.rave.core.scales.PowScale) This scale.
  17833. */
  17834. nice$0 : function() {
  17835. return this.nice$1(10);
  17836. },
  17837. /**
  17838. * Extends the domain so that it starts and ends on nice round values. This method typically modifies the scale's domain, and may only extend the bounds to the nearest round value. The precision of the round value is dependent on the extent of the domain dx according to the following formula: exp(round(log(dx)) - 1). Nicing is useful if the domain is computed from data and may be irregular. For example, for a domain of [0.20147987687960267, 0.996679553296417], the nice domain is [0.2, 1]. If the domain has more than two values, nicing the domain only affects the first and last value. The optional tick count argument allows greater control over the step size used to extend the bounds, guaranteeing that the returned ticks will exactly cover the domain.
  17839. * @param (Number) m Desired number of ticks.
  17840. * @return (com.ibm.rave.core.scales.PowScale) This scale.
  17841. */
  17842. nice$1 : function(m) {
  17843. return this.domain(com_ibm_rave_core_scales_LinearScale.linearNice(this._domain, m));
  17844. },
  17845. /**
  17846. * If x is specified, sets the current exponent to the given numeric value. If x is not specified, returns the current exponent. The default value is 1.
  17847. * @return (Number) Exponent power assigned to this scale.
  17848. */
  17849. exponent$0 : function() {
  17850. return this._exponent;
  17851. },
  17852. /**
  17853. * If x is specified, sets the current exponent to the given numeric value. If x is not specified, returns the current exponent. The default value is 1.
  17854. * @param (Number) x Exponent value.
  17855. * @return (com.ibm.rave.core.scales.PowScale) This scale.
  17856. */
  17857. exponent$1 : function(x) {
  17858. this._exponent = x;
  17859. this.powp = com_ibm_rave_core_scales_PowScale.pow(this._exponent);
  17860. this.powb = com_ibm_rave_core_scales_PowScale.pow(1 / this._exponent);
  17861. var self = this;
  17862. this._linear.domain(this._domain.map(function(currentValue, index, array) {
  17863. return self.powp(+ (currentValue));
  17864. }));
  17865. return this;
  17866. },
  17867. /** @expose */
  17868. domain : function(a0) {
  17869. var args = arguments;
  17870. if (args.length == 0) {
  17871. return this.domain$1();
  17872. }
  17873. return this.domain$0(a0);
  17874. },
  17875. /** @expose */
  17876. range : function(a0) {
  17877. var args = arguments;
  17878. if (args.length == 0) {
  17879. return this.range$1();
  17880. }
  17881. return this.range$0(a0);
  17882. },
  17883. /** @expose */
  17884. clamp : function(a0) {
  17885. var args = arguments;
  17886. if (args.length == 0) {
  17887. return this.clamp$1();
  17888. }
  17889. return this.clamp$0(a0);
  17890. },
  17891. /** @expose */
  17892. interpolate : function(a0) {
  17893. var args = arguments;
  17894. if (args.length == 0) {
  17895. return this.interpolate$1();
  17896. }
  17897. return this.interpolate$0(a0);
  17898. },
  17899. /** @expose */
  17900. nice : function(a0) {
  17901. var args = arguments;
  17902. if (args.length == 0) {
  17903. return this.nice$0();
  17904. }
  17905. return this.nice$1(a0);
  17906. },
  17907. /** @expose */
  17908. exponent : function(a0) {
  17909. var args = arguments;
  17910. if (args.length == 0) {
  17911. return this.exponent$0();
  17912. }
  17913. return this.exponent$1(a0);
  17914. }
  17915. });
  17916. com_ibm_rave_core_scales_PowScale.pow = function(e) {
  17917. return function(x) {
  17918. return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);
  17919. };
  17920. };
  17921. // $source: com/ibm/rave/core/scales/ThresholdScale
  17922. /************************************************************************
  17923. ** IBM Confidential
  17924. **
  17925. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  17926. **
  17927. ** (C) Copyright IBM Corp. 2015
  17928. **
  17929. ** The source code for this program is not published or otherwise divested of its trade secrets,
  17930. ** irrespective of what has been deposited with the U.S. Copyright Office.
  17931. ************************************************************************/
  17932. // GENERATED
  17933. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  17934. //@import com/ibm/rave/core/scales/AbstractScale (loadtime) // superclass
  17935. //@import com/ibm/rave/core/Rave (runtime) // Rave
  17936. /**
  17937. * Threshold scales are similar to quantize scales, except they allow you to map arbitrary subsets of the domain to discrete values in the range. The input domain is still continuous, and divided into slices based on a set of threshold values. it is important to keep in mind that the input domain data types must be naturally ordered, for example numbers or strings, or the behavior of the scale is undefined. Also, if the number of values in the scale's domain is N, the number of values in the scale's range must be N + 1. If there are fewer than N+1 elements in the range, the scale may return null for some inputs. If there are more than N + 1 elements in the range, the additional values are ignored
  17938. */
  17939. var com_ibm_rave_core_scales_ThresholdScale = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scales_AbstractScale, {
  17940. //_domain : null,
  17941. //_range : null,
  17942. _$functionClassMethod : function() {
  17943. var _$self = function(data, index, groupIndex) {
  17944. return _$self.scale(data);
  17945. };
  17946. return _$self;
  17947. },
  17948. constructor : function(domain, range) {
  17949. this._domain = [];
  17950. this._range = [];
  17951. {
  17952. this._domain = domain;
  17953. this._range = range;
  17954. }
  17955. },
  17956. /**
  17957. * Maps a value from an input domain to an output range
  17958. * @param (Object) key the input domain value to map
  17959. * @return (Object) the corresponding value in range, or null if none found if range has fewer elements than domains element count + 1
  17960. */
  17961. /** @expose */
  17962. scale : function(key) {
  17963. if (key == null) {
  17964. key = + (key);
  17965. }
  17966. if (key<=key) {
  17967. var i = com_ibm_rave_core_Rave.bisect(this._domain, key);
  17968. if (i >= 0 && i < this._range.length) {
  17969. return this._range[i];
  17970. }
  17971. }
  17972. return undefined;
  17973. },
  17974. domain$0 : function(values) {
  17975. this._domain = values;
  17976. return this;
  17977. },
  17978. domain$1 : function() {
  17979. return this._domain;
  17980. },
  17981. range$0 : function(values) {
  17982. this._range = values;
  17983. return this;
  17984. },
  17985. range$1 : function() {
  17986. return this._range;
  17987. },
  17988. /** @expose */
  17989. copy : function() {
  17990. return new com_ibm_rave_core_scales_ThresholdScale(this._domain, this._range);
  17991. },
  17992. /**
  17993. * Returns the extent of values in the input domain [x0, x1] for the corresponding value in the output range y, representing the inverse mapping from range to domain. This method is useful for interaction, say to determine the value in the input domain that corresponds to the pixel location under the mouse.
  17994. * @param (Object) y the value in range to get the range extent for
  17995. * @return (Array) an array of two objects from the domain that represent. If the value does not exist in the range, or if its index in the range values exceeds that of the domain values length (which could happen if the range values exceed in number the domain values) then the array returned will have null entries in it.
  17996. */
  17997. /** @expose */
  17998. invertExtent : function(y) {
  17999. var i = this._range.indexOf(y);
  18000. var first = undefined;
  18001. var second = undefined;
  18002. if (i > 0 && i <= this._domain.length) {
  18003. first = this._domain[i - 1];
  18004. }
  18005. if (i >= 0 && i < this._domain.length) {
  18006. second = this._domain[i];
  18007. }
  18008. return [first, second];
  18009. },
  18010. /** @expose */
  18011. domain : function(a0) {
  18012. var args = arguments;
  18013. if (args.length == 0) {
  18014. return this.domain$1();
  18015. }
  18016. return this.domain$0(a0);
  18017. },
  18018. /** @expose */
  18019. range : function(a0) {
  18020. var args = arguments;
  18021. if (args.length == 0) {
  18022. return this.range$1();
  18023. }
  18024. return this.range$0(a0);
  18025. }
  18026. });
  18027. /**
  18028. * Factory method to create a new threshold scale with default domain of [0.5] and default range of [0,1]
  18029. * @return (com.ibm.rave.core.scales.ThresholdScale) the newly created threshold scale
  18030. */
  18031. /** @expose */
  18032. com_ibm_rave_core_scales_ThresholdScale.newThresholdScale = function() {
  18033. return new com_ibm_rave_core_scales_ThresholdScale([0.5], [0, 1]);
  18034. };
  18035. // $source: com/ibm/rave/core/scales/IdentityScale
  18036. /************************************************************************
  18037. ** IBM Confidential
  18038. **
  18039. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  18040. **
  18041. ** (C) Copyright IBM Corp. 2015
  18042. **
  18043. ** The source code for this program is not published or otherwise divested of its trade secrets,
  18044. ** irrespective of what has been deposited with the U.S. Copyright Office.
  18045. ************************************************************************/
  18046. // GENERATED
  18047. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  18048. //@import com/ibm/rave/core/scales/AbstractScale (loadtime) // superclass
  18049. //@import com/ibm/rave/core/scales/LinearScale (runtime) // linearTicks, linearTickFormat
  18050. /**
  18051. * Identity scales are a special case of linear scales where the domain and range are identical; the scale and its invert method are both the identity function. The identity scale accepts an array of numbers as domain or range values. The array must contain two or more numbers. If the elements in the given array are not numbers, they will be coerced to numbers; this coercion happens similarly when the scale is called.
  18052. */
  18053. var com_ibm_rave_core_scales_IdentityScale = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scales_AbstractScale, {
  18054. //_domain : null,
  18055. _$functionClassMethod : function() {
  18056. var _$self = function(data, index, groupIndex) {
  18057. return _$self.scale(data);
  18058. };
  18059. return _$self;
  18060. },
  18061. constructor : function(domain) {
  18062. this._domain = domain.map(function(currentValue, index, array) {
  18063. return + (currentValue);
  18064. });
  18065. var self = this;
  18066. this.invert = function(y) {
  18067. return self.scale(y);
  18068. };
  18069. this.ticks = function(tickArguments) {
  18070. if (tickArguments !== null || arguments.length > 1){
  18071. tickArguments = Array.prototype.slice.call(arguments);
  18072. }
  18073. {
  18074. return com_ibm_rave_core_scales_LinearScale.linearTicks.apply(com_ibm_rave_core_scales_LinearScale, [self._domain].concat(tickArguments));
  18075. }
  18076. };
  18077. this.tickFormat = function(tickArguments) {
  18078. if (tickArguments !== null || arguments.length > 1){
  18079. tickArguments = Array.prototype.slice.call(arguments);
  18080. }
  18081. {
  18082. var count = tickArguments.length > 0 ? + (tickArguments[0]) : null;
  18083. var format = tickArguments.length > 1 ? tickArguments[1] : null;
  18084. return com_ibm_rave_core_scales_LinearScale.linearTickFormat(self._domain, count, ((typeof format === "string" || format instanceof String)) ? format : null);
  18085. }
  18086. };
  18087. },
  18088. /**
  18089. * Returns the given value x
  18090. * @param (Object) key the value to apply scale to it
  18091. * @return (Object) the same value passed since it is an identity scale
  18092. */
  18093. /** @expose */
  18094. scale : function(key) {
  18095. return + (key);
  18096. },
  18097. domain$0 : function(values) {
  18098. this._domain = (values).map(function(currentValue, index, array) {
  18099. return + (currentValue);
  18100. });
  18101. return this;
  18102. },
  18103. domain$1 : function() {
  18104. return this._domain;
  18105. },
  18106. range$0 : function(values) {
  18107. return this.domain(values);
  18108. },
  18109. range$1 : function() {
  18110. return this._domain;
  18111. },
  18112. /** @expose */
  18113. copy : function() {
  18114. return new com_ibm_rave_core_scales_IdentityScale(this._domain);
  18115. },
  18116. /** @expose */
  18117. domain : function(a0) {
  18118. var args = arguments;
  18119. if (args.length == 0) {
  18120. return this.domain$1();
  18121. }
  18122. return this.domain$0(a0);
  18123. },
  18124. /** @expose */
  18125. range : function(a0) {
  18126. var args = arguments;
  18127. if (args.length == 0) {
  18128. return this.range$1();
  18129. }
  18130. return this.range$0(a0);
  18131. }
  18132. });
  18133. /**
  18134. * Constructs a new identity scale with the default domain [0, 1] and the default range [0, 1].
  18135. * @return (com.ibm.rave.core.scales.IdentityScale) the newly constructed identity scale
  18136. */
  18137. /** @expose */
  18138. com_ibm_rave_core_scales_IdentityScale.newIdentityScale = function() {
  18139. return new com_ibm_rave_core_scales_IdentityScale([0, 1]);
  18140. };
  18141. // $source: com/ibm/rave/core/scales/Scales
  18142. /************************************************************************
  18143. ** IBM Confidential
  18144. **
  18145. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  18146. **
  18147. ** (C) Copyright IBM Corp. 2015
  18148. **
  18149. ** The source code for this program is not published or otherwise divested of its trade secrets,
  18150. ** irrespective of what has been deposited with the U.S. Copyright Office.
  18151. ************************************************************************/
  18152. // GENERATED
  18153. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  18154. //@import com/ibm/rave/core/scales/LinearScale (runtime) // new
  18155. //@import com/ibm/rave/core/Rave (runtime) // Rave
  18156. //@import com/ibm/rave/core/scales/OrdinalScale (runtime) // new, OrdinalScale
  18157. //@import com/ibm/rave/core/scales/QuantizeScale (runtime) // new
  18158. //@import com/ibm/rave/core/scales/QuantileScale (runtime) // new
  18159. //@import com/ibm/rave/core/scales/LogScale (runtime) // new, LogScale
  18160. //@import com/ibm/rave/core/scales/PowScale (runtime) // new
  18161. //@import com/ibm/rave/core/scales/ThresholdScale (loadtime) // newThresholdScale
  18162. //@import com/ibm/rave/core/scales/IdentityScale (loadtime) // newIdentityScale
  18163. /**
  18164. * Collection of built-in scales.
  18165. */
  18166. var com_ibm_rave_core_scales_Scales = com_ibm_rave_core_nativeImpl_Declare({
  18167. /** @expose */
  18168. linear : function() {
  18169. return new com_ibm_rave_core_scales_LinearScale(null, null, null, null);
  18170. },
  18171. /**
  18172. * Constructs a new ordinal scale with a range of ten categorical colors
  18173. * @return (com.ibm.rave.core.scales.OrdinalScale) Ordinal scale
  18174. */
  18175. /** @expose */
  18176. category10 : function() {
  18177. return com_ibm_rave_core_Rave.scale.ordinal().range(com_ibm_rave_core_scales_Scales.RAVE_CAT10);
  18178. },
  18179. /**
  18180. * Constructs a new ordinal scale with a range of twenty categorical colors
  18181. * @return (com.ibm.rave.core.scales.OrdinalScale) Ordinal scale
  18182. */
  18183. /** @expose */
  18184. category20 : function() {
  18185. return com_ibm_rave_core_Rave.scale.ordinal().range(com_ibm_rave_core_scales_Scales.RAVE_CAT20);
  18186. },
  18187. /**
  18188. * Constructs a new ordinal scale with a range of twenty categorical colors
  18189. * @return (com.ibm.rave.core.scales.OrdinalScale) Ordinal scale
  18190. */
  18191. /** @expose */
  18192. category20b : function() {
  18193. return com_ibm_rave_core_Rave.scale.ordinal().range(com_ibm_rave_core_scales_Scales.RAVE_CAT20b);
  18194. },
  18195. /**
  18196. * Constructs a new ordinal scale with a range of twenty categorical colors
  18197. * @return (com.ibm.rave.core.scales.OrdinalScale) Ordinal scale
  18198. */
  18199. /** @expose */
  18200. category20c : function() {
  18201. return com_ibm_rave_core_Rave.scale.ordinal().range(com_ibm_rave_core_scales_Scales.RAVE_CAT20c);
  18202. },
  18203. /** @expose */
  18204. ordinal : function() {
  18205. return new com_ibm_rave_core_scales_OrdinalScale([], com_ibm_rave_core_scales_OrdinalScale.DEFAULT_RANGER, 1.0, 0.0);
  18206. },
  18207. /**
  18208. * Construct a new quantize scale with a default domain and range [0,0,1.0]
  18209. * @return (com.ibm.rave.core.scales.QuantizeScale) Quantize Scale
  18210. */
  18211. /** @expose */
  18212. quantize : function() {
  18213. var scale = new com_ibm_rave_core_scales_QuantizeScale();
  18214. var tempList = [];
  18215. tempList.push(0.0);
  18216. tempList.push(1.0);
  18217. scale.range(tempList);
  18218. scale.domain(tempList);
  18219. return scale;
  18220. },
  18221. /**
  18222. * Construct a new quantile scale with empty domain and range
  18223. * @return (com.ibm.rave.core.scales.QuantileScale) Quantile Scale
  18224. */
  18225. /** @expose */
  18226. quantile : function() {
  18227. return new com_ibm_rave_core_scales_QuantileScale([], []);
  18228. },
  18229. /** @expose */
  18230. log : function() {
  18231. return new com_ibm_rave_core_scales_LogScale(this.linear().domain([0.0, 1.0]), com_ibm_rave_core_scales_LogScale.DEFAULT_BASE, true, [1.0, 10.0]);
  18232. },
  18233. /** @expose */
  18234. pow : function() {
  18235. return new com_ibm_rave_core_scales_PowScale(this.linear(), 1, [0.0, 1.0]);
  18236. },
  18237. /**
  18238. * @return (com.ibm.rave.core.scales.PowScale) A Pow scale with a power (exponent) of 1/2.
  18239. */
  18240. /** @expose */
  18241. sqrt : function() {
  18242. return this.pow().exponent(0.5);
  18243. },
  18244. /**
  18245. * Constructs a new threshold scale with the default domain [.5] and the default range [0,1]. Thus, the default threshold scale is equivalent to the round function for numbers; for example threshold(0.49) returns 0, and threshold(0.51) returns 1.
  18246. * @return (com.ibm.rave.core.scales.ThresholdScale) the newly constructed threshold scale
  18247. */
  18248. /** @expose */
  18249. threshold : com_ibm_rave_core_scales_ThresholdScale.newThresholdScale,
  18250. /**
  18251. * Constructs a new identity scale with the default domain [0, 1] and the default range [0, 1].
  18252. * @return (com.ibm.rave.core.scales.IdentityScale) the newly constructed identity scale
  18253. */
  18254. /** @expose */
  18255. identity : com_ibm_rave_core_scales_IdentityScale.newIdentityScale
  18256. //constructor : function() {}
  18257. });
  18258. /** @expose */
  18259. com_ibm_rave_core_scales_Scales.INSTANCE = new com_ibm_rave_core_scales_Scales();
  18260. com_ibm_rave_core_scales_Scales.RAVE_CAT10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"];
  18261. com_ibm_rave_core_scales_Scales.RAVE_CAT20 = ["#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5"];
  18262. com_ibm_rave_core_scales_Scales.RAVE_CAT20b = ["#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", "#843c39", "#ad494a", "#d6616b", "#e7969c", "#7b4173", "#a55194", "#ce6dbd", "#de9ed6"];
  18263. com_ibm_rave_core_scales_Scales.RAVE_CAT20c = ["#3182bd", "#6baed6", "#9ecae1", "#c6dbef", "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", "#31a354", "#74c476", "#a1d99b", "#c7e9c0", "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", "#636363", "#969696", "#bdbdbd", "#d9d9d9"];
  18264. // $source: com/ibm/rave/core/layout/Layout
  18265. /************************************************************************
  18266. ** IBM Confidential
  18267. **
  18268. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  18269. **
  18270. ** (C) Copyright IBM Corp. 2015
  18271. **
  18272. ** The source code for this program is not published or otherwise divested of its trade secrets,
  18273. ** irrespective of what has been deposited with the U.S. Copyright Office.
  18274. ************************************************************************/
  18275. // GENERATED
  18276. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  18277. //@import com/ibm/rave/core/RegistryService (loadtime) // superclass
  18278. //@import com/ibm/rave/core/layout/force/Force (runtime) // new
  18279. //@import com/ibm/rave/core/layout/BundleLayout (runtime) // new
  18280. //@import com/ibm/rave/core/layout/PackLayout (runtime) // new
  18281. //@import com/ibm/rave/core/layout/chord/ChordLayout (runtime) // new
  18282. //@import com/ibm/rave/core/layout/cluster/Cluster (runtime) // new
  18283. //@import com/ibm/rave/core/layout/StackLayout (runtime) // new
  18284. //@import com/ibm/rave/core/layout/tree/Tree (runtime) // new
  18285. //@import com/ibm/rave/core/layout/treemap/Treemap (runtime) // new
  18286. //@import com/ibm/rave/core/layout/PieLayout (runtime) // new
  18287. //@import com/ibm/rave/core/layout/HistogramLayout (runtime) // new
  18288. //@import com/ibm/rave/core/layout/hierarchy/Hierarchy (runtime) // new
  18289. //@import com/ibm/rave/core/layout/PartitionLayout (runtime) // new
  18290. var com_ibm_rave_core_layout_Layout = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_RegistryService, {
  18291. /**
  18292. * creates a new instance of Force
  18293. * @return (com.ibm.rave.core.layout.force.Force) new instance of Force
  18294. */
  18295. /** @expose */
  18296. force : function() {
  18297. return new com_ibm_rave_core_layout_force_Force();
  18298. },
  18299. /**
  18300. * creates a new instance of BundleLayout
  18301. * @return (com.ibm.rave.core.layout.BundleLayout) new instance of BundleLayout
  18302. */
  18303. /** @expose */
  18304. bundle : function() {
  18305. return new com_ibm_rave_core_layout_BundleLayout();
  18306. },
  18307. /**
  18308. * Creates a new pack layout with the default settings, the default sort order is by ascending value; the default children accessor assumes each input data is an object with a children array; the default size is 1×1.
  18309. * @return (com.ibm.rave.core.layout.PackLayout) new instance of Pack
  18310. */
  18311. /** @expose */
  18312. pack : function() {
  18313. return new com_ibm_rave_core_layout_PackLayout();
  18314. },
  18315. /**
  18316. * creates a new instance of Chord
  18317. * @return (com.ibm.rave.core.layout.chord.ChordLayout) new instance of Chord
  18318. */
  18319. /** @expose */
  18320. chord : function() {
  18321. return new com_ibm_rave_core_layout_chord_ChordLayout();
  18322. },
  18323. /**
  18324. * creates a new instance of Cluster
  18325. * @return (com.ibm.rave.core.layout.cluster.Cluster) new instance of Cluster
  18326. */
  18327. /** @expose */
  18328. cluster : function() {
  18329. return new com_ibm_rave_core_layout_cluster_Cluster();
  18330. },
  18331. /**
  18332. * Constructs a new stack layout with the default offset (zero) and order (null). The returned layout object is both an object and a function. That is: you can call the layout like any other function, and the layout has additional methods that change its behavior. Like other classes in Rave, layouts follow the method chaining pattern where setter methods return the layout itself, allowing multiple setters to be invoked in a concise statement.
  18333. * @return (com.ibm.rave.core.layout.StackLayout) a new stack layout instance
  18334. */
  18335. /** @expose */
  18336. stack : function() {
  18337. return new com_ibm_rave_core_layout_StackLayout();
  18338. },
  18339. /**
  18340. * creates a new instance of Tree
  18341. * @return (com.ibm.rave.core.layout.tree.Tree) new instance of Tree
  18342. */
  18343. /** @expose */
  18344. tree : function() {
  18345. return new com_ibm_rave_core_layout_tree_Tree();
  18346. },
  18347. /**
  18348. * creates a new instance of Treemap
  18349. * @return (com.ibm.rave.core.layout.treemap.Treemap) new instance of Treemap
  18350. */
  18351. /** @expose */
  18352. treemap : function() {
  18353. return new com_ibm_rave_core_layout_treemap_Treemap();
  18354. },
  18355. /**
  18356. * creates a new instance of Pie
  18357. * @return (com.ibm.rave.core.layout.PieLayout) new instance of Pie
  18358. */
  18359. /** @expose */
  18360. pie : function() {
  18361. return new com_ibm_rave_core_layout_PieLayout();
  18362. },
  18363. /**
  18364. * creates a new instance of histogram
  18365. * @return (com.ibm.rave.core.layout.HistogramLayout) new instance of histogram
  18366. */
  18367. /** @expose */
  18368. histogram : function() {
  18369. return new com_ibm_rave_core_layout_HistogramLayout();
  18370. },
  18371. /**
  18372. * creates a new instance of Hierarchy
  18373. * @return (com.ibm.rave.core.layout.hierarchy.Hierarchy) new instance of Hierarchy
  18374. */
  18375. /** @expose */
  18376. hierarchy : function() {
  18377. return new com_ibm_rave_core_layout_hierarchy_Hierarchy();
  18378. },
  18379. /**
  18380. * Creates a new instance of PartitionLayout with the default settings, the default sort order is by descending value; the default value accessor assumes each input data is an object with a numeric value attribute; the default children accessor assumes each input data is an object with a children array; the default size is 1×1
  18381. * @return (com.ibm.rave.core.layout.PartitionLayout) new instance of PartitionLayout
  18382. */
  18383. /** @expose */
  18384. partition : function() {
  18385. return new com_ibm_rave_core_layout_PartitionLayout();
  18386. }
  18387. /**
  18388. * singleton
  18389. */
  18390. //constructor : function() {}
  18391. });
  18392. /** @expose */
  18393. com_ibm_rave_core_layout_Layout.INSTANCE = new com_ibm_rave_core_layout_Layout();
  18394. // $source: com/ibm/rave/core/layout/force/Force
  18395. /************************************************************************
  18396. ** IBM Confidential
  18397. **
  18398. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  18399. **
  18400. ** (C) Copyright IBM Corp. 2015
  18401. **
  18402. ** The source code for this program is not published or otherwise divested of its trade secrets,
  18403. ** irrespective of what has been deposited with the U.S. Copyright Office.
  18404. ************************************************************************/
  18405. // GENERATED
  18406. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare anonymous, declare
  18407. //@import com/ibm/rave/core/event/Dispatcher (runtime) // create
  18408. //@import com/ibm/rave/core/geom/QuadTree (runtime) // new
  18409. //@import com/ibm/rave/core/nativeImpl/timer/Timer (runtime) // Timer
  18410. //@import com/ibm/rave/core/internal/nativeImpl/Lang (runtime) // isNumber
  18411. //@import com/ibm/rave/core/behavior/Behavior (runtime) // Behavior
  18412. //@import com/ibm/rave/core/internal/util/Identity (static) // create
  18413. /**
  18414. * A flexible force-directed graph layout implementation which uses a quadtree to accelerate charge interaction using the Barnes–Hut approximation. In addition to the repulsive charge force, a pseudo-gravity force keeps nodes centered in the visible area and avoids expulsion of disconnected subgraphs, while links are fixed-distance geometric constraints (and not spring forces as is common in other force-directed layouts). This layout keeps a reference to the associated nodes and links internally; thus, a given force layout instance can only be used with a single dataset.
  18415. */
  18416. var com_ibm_rave_core_layout_force_Force = rave_externs["Force"] = com_ibm_rave_core_nativeImpl_Declare({
  18417. //msize : null,
  18418. //mcharge : null,
  18419. //mdrag : null,
  18420. //mnodes : null,
  18421. //mlinks : null,
  18422. //distances : null,
  18423. //strengths : null,
  18424. //charges : null,
  18425. //event : null,
  18426. //quadTree : null,
  18427. /**
  18428. * Bind a behavior to nodes to allow interactive dragging, either using the mouse or touch. Use this in conjunction with the call operator on the nodes; for example, say node.call(force.drag) on initialization. The drag event sets the fixed attribute of nodes on mouseover, such that as soon as the mouse is over a node, it stops moving. Fixing on mouseover, rather than on mousedown, makes it easier to catch moving nodes. When a mousedown event is received, and on each subsequent mousemove until mouseup, the node center is set to the current mouse position. In addition, each mousemove triggers a resume of the force layout, reheating the simulation. If you want dragged nodes to remain fixed after dragging, set the fixed attribute to true on dragstart. Implementation note: the mousemove and mouseup event listeners are registered on the current window, such that when the user starts dragging a node, they can continue to drag the node even if the mouse leaves the window. Each event listener uses the "force" namespace, so as to avoid collision with other event listeners you may wish to bind to nodes or to the window. If a node is moved by the drag behavior, the subsequent click event that would be triggered by the final mouseup is captured and the default behavior prevented. If you register a click event listener, you can ignore these clicks on drag by seeing if the default behavior was prevented.
  18429. */
  18430. /** @expose */
  18431. drag : null,
  18432. //dragmove : null,
  18433. malpha : 0,
  18434. mfriction : 0.9,
  18435. mlinkDistance : 20,
  18436. mlinkStrength : 1,
  18437. mgravity : 0.1,
  18438. chargeDistance2 : Infinity,
  18439. theta2 : 0.64,
  18440. constructor : function() {
  18441. this.msize = [1, 1];
  18442. this.mcharge = -30;
  18443. this.mnodes = [];
  18444. this.mlinks = [];
  18445. this.event = com_ibm_rave_core_event_Dispatcher.create("start", "tick", "end");
  18446. this.quadTree = new com_ibm_rave_core_geom_QuadTree().x(com_ibm_rave_core_layout_force_Force.fx).y(com_ibm_rave_core_layout_force_Force.fy);
  18447. {
  18448. var self = this;
  18449. this.drag = new (com_ibm_rave_core_nativeImpl_Declare({
  18450. _$functionClassMethod : function() {
  18451. var _$self = function(args) {
  18452. if (args !== null || arguments.length > 1){
  18453. args = Array.prototype.slice.call(arguments, 0);
  18454. }
  18455. {
  18456. if (!args || args.length == 0) {
  18457. return _$self.drag();
  18458. }
  18459. _$self.drag(args[0]);
  18460. return null;
  18461. }
  18462. };
  18463. return _$self;
  18464. },
  18465. drag$0 : function() {
  18466. self.createDrag();
  18467. return self.mdrag;
  18468. },
  18469. drag$1 : function(s) {
  18470. self.createDrag();
  18471. s.on("mouseover.force", com_ibm_rave_core_layout_force_Force.mouseover).on("mouseout.force", com_ibm_rave_core_layout_force_Force.mouseout).call(self.mdrag);
  18472. },
  18473. drag : function(a0) {
  18474. var args = arguments;
  18475. if (args.length == 0) {
  18476. return this.drag$0();
  18477. }
  18478. return this.drag$1(a0);
  18479. }
  18480. }))();
  18481. this.dragmove = function(args) {
  18482. if (args !== null || arguments.length > 1){
  18483. args = Array.prototype.slice.call(arguments, 0);
  18484. }
  18485. {
  18486. var d = args[0];
  18487. d["px"] = (rave.event).x;
  18488. d["py"] = (rave.event).y;
  18489. self.resume();
  18490. return null;
  18491. }
  18492. };
  18493. }
  18494. },
  18495. repulse : function(node) {
  18496. var self = this;
  18497. return function(quad, x1, y1, x2, y2) {
  18498. var n = node;
  18499. var fn = quad.data;
  18500. if (quad.point != n) {
  18501. var k, dx = fn.cx - n["x"], dy = fn.cy - n["y"], dw = x2 - x1, dn = dx * dx + dy * dy;
  18502. if (dw * dw / self.theta2 < dn) {
  18503. if (dn < self.chargeDistance2) {
  18504. k = fn.charge / dn;
  18505. n["px"] -= dx * k;
  18506. n["py"] -= dy * k;
  18507. }
  18508. return true;
  18509. }
  18510. if (quad.point && dn != 0 && dn < self.chargeDistance2) {
  18511. k = fn.pointCharge / dn;
  18512. n["px"] -= dx * k;
  18513. n["py"] -= dy * k;
  18514. }
  18515. }
  18516. return fn.charge == 0;
  18517. };
  18518. },
  18519. /**
  18520. * Runs the force layout simulation one step. This method can be used in conjunction with start and stop to compute a static layout. For example: <code> force.start(); for (int i = 0; i < n; ++i) force.tick(); force.stop(); </code> The number of iterations depends on the graph size and complexity. The choice of initial positions can also have a dramatic impact on how quickly the graph converges on a good solution. If you do not initialize the positions manually, the force layout will initialize them randomly, resulting in somewhat unpredictable behavior.
  18521. * @return (boolean) true if the simulation has ended, false otherwise. in other words, it will return true if the layout's cooling parameter decays below some threshold and the simulation will stop. This is useful if you're calling this function in a loop and wanted to know when it is no longer necessary to call it again and break out of the loop.
  18522. */
  18523. /** @expose */
  18524. tick : function() {
  18525. if ((this.malpha *= .99) < .005) {
  18526. this.malpha = 0;
  18527. var eo = new com_ibm_rave_core_layout_force_Force.EventObject("end", 0);
  18528. this.event[eo.type].call(eo, eo);
  18529. return true;
  18530. }
  18531. var n = this.mnodes.length, m = this.mlinks.length;
  18532. var q;
  18533. var i;
  18534. var ol;
  18535. var on;
  18536. var s;
  18537. var t;
  18538. var l;
  18539. var k;
  18540. var x;
  18541. var y;
  18542. for (i = 0; i < m; ++i) {
  18543. ol = this.mlinks[i];
  18544. s = ol["source"];
  18545. t = ol["target"];
  18546. x = t["x"] - s["x"];
  18547. y = t["y"] - s["y"];
  18548. if ((l = (x * x + y * y)) != 0) {
  18549. l = this.malpha * this.strengths[i] * ((l = Math.sqrt(l)) - this.distances[i]) / l;
  18550. x *= l;
  18551. y *= l;
  18552. t["x"] -= x * (k = s["weight"] / (t["weight"] + s["weight"]));
  18553. t["y"] -= y * k;
  18554. s["x"] += x * (k = 1 - k);
  18555. s["y"] += y * k;
  18556. }
  18557. }
  18558. if ((k = this.malpha * this.mgravity) != 0) {
  18559. x = this.msize[0] / 2;
  18560. y = this.msize[1] / 2;
  18561. i = -1;
  18562. if (k != 0) {
  18563. while (++i < n) {
  18564. on = this.mnodes[i];
  18565. on["x"] += (x - on["x"]) * k;
  18566. on["y"] += (y - on["y"]) * k;
  18567. }
  18568. }
  18569. }
  18570. if ((this.mcharge)) {
  18571. com_ibm_rave_core_layout_force_Force.forceAccumulate(q = this.quadTree.size(null)(this.mnodes), this.malpha, this.charges);
  18572. i = -1;
  18573. while (++i < n) {
  18574. if (!((on = this.mnodes[i])["fixed"] > 0)) {
  18575. q.visit(this.repulse(on));
  18576. }
  18577. }
  18578. }
  18579. i = -1;
  18580. while (++i < n) {
  18581. on = this.mnodes[i];
  18582. if (on["fixed"] > 0) {
  18583. on["x"] = on["px"];
  18584. on["y"] = on["py"];
  18585. } else {
  18586. on["x"] -= (on["px"] - (on["px"] = on["x"])) * this.mfriction;
  18587. on["y"] -= (on["py"] - (on["py"] = on["y"])) * this.mfriction;
  18588. }
  18589. }
  18590. var eo = new com_ibm_rave_core_layout_force_Force.EventObject("tick", this.malpha);
  18591. this.event[eo.type].call(eo, eo);
  18592. return false;
  18593. },
  18594. /**
  18595. * Returns the current array of nodes associated with this layout, which defaults to the empty array.
  18596. * @return (com.ibm.rave.core.layout.force.ForceNode[]) the current array of nodes
  18597. */
  18598. nodes$0 : function() {
  18599. return this.mnodes;
  18600. },
  18601. /**
  18602. * Sets the array of nodes associated with this layout
  18603. * @param (Array) nodes the array of nodes to set
  18604. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  18605. */
  18606. nodes$1 : function(nodes) {
  18607. this.mnodes = nodes;
  18608. return this;
  18609. },
  18610. /**
  18611. * Returns the current array of links associated with this layout, which defaults to the empty array.
  18612. * @return (com.ibm.rave.core.layout.force.ForceLink[]) the current array of links
  18613. */
  18614. links$0 : function() {
  18615. return this.mlinks;
  18616. },
  18617. /**
  18618. * Sets the array of links associated with this layout
  18619. * @param (com.ibm.rave.core.layout.force.ForceLink[]) l the array of links to set
  18620. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  18621. */
  18622. links$1 : function(l) {
  18623. this.mlinks = l;
  18624. return this;
  18625. },
  18626. /**
  18627. * Returns the current size dimension object, which defaults to 1×1
  18628. * @return (Array) the current size
  18629. */
  18630. size$0 : function() {
  18631. return this.msize;
  18632. },
  18633. /**
  18634. * Sets the available layout size to the specified dimension object representing width and height
  18635. * @param (Array) s the dimension object
  18636. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  18637. */
  18638. size$1 : function(s) {
  18639. this.msize = s;
  18640. return this;
  18641. },
  18642. /**
  18643. * Returns the layout's current link distance, which defaults to 20 This method behaves in the same way as linkDistance getter method
  18644. * @return (Object) current link distance
  18645. * @see #this.linkDistance()
  18646. */
  18647. distance$0 : function() {
  18648. return this.mlinkDistance;
  18649. },
  18650. /**
  18651. * Sets the target distance between linked nodes to the specified value. The value of link distance could be a number, in which case, all links are the of the same distance. Or, it could be a function which would be evaluated for each link (in order) whenever the layout starts, and the return value of this function would be used as the link distance. The function would be be passed the link and its index and the force layout as its context. This method behaves in the same way as linkDistance getter method
  18652. * @param (Object) d the link distance value/function to set
  18653. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  18654. * @see #this.linkDistance(Object)
  18655. */
  18656. distance$1 : function(d) {
  18657. return this.linkDistance(d);
  18658. },
  18659. /**
  18660. * Returns the layout's current link distance, which defaults to 20
  18661. * @return (Object) current link distance
  18662. */
  18663. linkDistance$0 : function() {
  18664. return this.mlinkDistance;
  18665. },
  18666. /**
  18667. * Sets the target distance between linked nodes to the specified value. The value of link distance could be a number, in which case, all links are the of the same distance. Or, it could be a function which would be evaluated for each link (in order) whenever the layout starts, and the return value of this function would be used as the link distance. The function would be be passed the link and its index and the force layout as its context.
  18668. * @param (Object) x the link distance value/function to set
  18669. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  18670. */
  18671. linkDistance$1 : function(x) {
  18672. this.mlinkDistance = typeof x === "function" ? x : + (x);
  18673. return this;
  18674. },
  18675. /**
  18676. * Returns the layout's current link strength (rigidity), which defaults to 1
  18677. * @return (Object) returns the layout's current link strength.
  18678. */
  18679. linkStrength$0 : function() {
  18680. return this.mlinkStrength;
  18681. },
  18682. /**
  18683. * Sets the strength (rigidity) of links to the specified value in the range [0,1] The value of link strength could be a number, in which case, all links are the of the same strength. Or, it could be a function which would be evaluated for each link (in order) whenever the layout starts, and the return value of this function would be used as the link strength. The function would be be passed the link and its index and the force layout as its context.
  18684. * @param (Object) x the link strength value/function to set
  18685. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  18686. */
  18687. linkStrength$1 : function(x) {
  18688. this.mlinkStrength = typeof x === "function" ? x : + (x);
  18689. return this;
  18690. },
  18691. /**
  18692. * Returns the current friction factor that is used to approximate velocity decay. The default value is 0.9
  18693. * @return (double) the current friction factor
  18694. */
  18695. friction$0 : function() {
  18696. return this.mfriction;
  18697. },
  18698. /**
  18699. * Sets the friction coefficient to the specified value which is used to approximate velocity decay. At each tick of the simulation, the particle velocity is scaled by the specified friction coefficient. Thus, a value of 1 corresponds to a frictionless environment, while a value of 0 freezes all particles in place. Values outside the range [0,1] are not recommended and may have destabilizing effects. This value could be either a number or a string that would be parsed to a number
  18700. * @param (Object) f the friction coefficient value to set
  18701. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  18702. */
  18703. friction$1 : function(f) {
  18704. this.mfriction = + (f);
  18705. return this;
  18706. },
  18707. /**
  18708. * Returns the layout's current node charge value (rigidity), which defaults to -30
  18709. * @return (Object) the current charge value
  18710. */
  18711. charge$0 : function() {
  18712. return this.mcharge;
  18713. },
  18714. /**
  18715. * Sets the charge value of nodes to the specified value. The value of node charge could be a number, in which case, all nodes are of the same charge. Or, it could be a function which would be evaluated for each node (in order) whenever the layout starts, and the return value of this function would be used as the node charge value. The function would be be passed the link and its index and the force layout as its context. A negative charge value results in node repulsion, while a positive value results in node attraction. For graph layout, negative values should be used; for n-body simulation, positive values can be used. All nodes are assumed to be infinitesimal points with equal charge and mass. Setting the charge force to zero disables some computation which can noticeably improve performance if you do not need n-body forces.
  18716. * @param (Object) x the node charge value/function to set
  18717. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  18718. */
  18719. charge$1 : function(x) {
  18720. this.mcharge = typeof x === "function" ? x : + (x);
  18721. return this;
  18722. },
  18723. /**
  18724. * Returns the current maximum charge distance over which charge forces are applied. The default value is infinity
  18725. * @return (double) the current maximum charge distance
  18726. */
  18727. chargeDistance$0 : function() {
  18728. return Math.sqrt(this.chargeDistance2);
  18729. },
  18730. /**
  18731. * Sets the maximum distance over which charge forces are applied. Specifying a finite charge distance improves the performance of the force layout and produces a more localized layout.
  18732. * @param (double) x the maximum charge distance
  18733. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  18734. */
  18735. chargeDistance$1 : function(x) {
  18736. this.chargeDistance2 = x * x;
  18737. return this;
  18738. },
  18739. /**
  18740. * Returns the current gravitational strength, which defaults to 0.1
  18741. * @return (double) the current gravitational strength
  18742. */
  18743. gravity$0 : function() {
  18744. return this.mgravity;
  18745. },
  18746. /**
  18747. * Sets the gravitational strength to the specified value. This value could be either a number or a string that would be parsed to a number. The name of this parameter is perhaps misleading; it does not corresponding to physical gravity (which can be simulated using a positive charge parameter). Instead, gravity is implemented as a weak geometric constraint similar to a virtual spring connecting each node to the center of the layout's size. This approach has nice properties: near the center of the layout, the gravitational strength is almost zero, avoiding any local distortion of the layout; as nodes get pushed farther away from the center, the gravitational strength becomes stronger in linear proportion to the distance. Thus, gravity will always overcome repulsive charge forces at some threshold, preventing disconnected nodes from escaping the layout. Gravity can be disabled by setting the gravitational strength to zero. If you disable gravity, it is recommended that you implement some other geometric constraint to prevent nodes from escaping the layout, such as constraining them within the layout's bounds.
  18748. * @param (Object) g the gravitational strength to set
  18749. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  18750. */
  18751. gravity$1 : function(g) {
  18752. this.mgravity = + (g);
  18753. return this;
  18754. },
  18755. /**
  18756. * Returns the value of Barnes–Hut approximation criterion, which defaults to 0.8
  18757. * @return (double) the current value of Barnes–Hut approximation criterion
  18758. */
  18759. theta$0 : function() {
  18760. return Math.sqrt(this.theta2);
  18761. },
  18762. /**
  18763. * Sets the value of Barnes–Hut approximation criterion. This value could be either a number or a string that would be parsed to a number. To avoid quadratic performance slowdown for large graphs, the force layout uses the Barnes–Hut approximation which takes O(n log n) per tick. For each tick, a quadtree is created to store the current node positions; then for each node, the sum charge force of all other nodes on the given node are computed. For clusters of nodes that are far away, the charge force is approximated by treating the distance cluster of nodes as a single, larger node. Theta determines the accuracy of the computation: if the ratio of the area of a quadrant in the quadtree to the distance between a node to the quadrant's center of mass is less than theta, all nodes in the given quadrant are treated as a single, larger node rather than computed individually.
  18764. * @param (Object) x the value of Barnes–Hut approximation criterion to set
  18765. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  18766. */
  18767. theta$1 : function(x) {
  18768. var xx = + (x);
  18769. this.theta2 = xx * xx;
  18770. return this;
  18771. },
  18772. /**
  18773. * Gets the force layout's cooling parameter value. When the layout is started, the internal alpha cooling parameter is set to 0.1
  18774. * @return (double) the current value of the layout's cooling parameter
  18775. */
  18776. alpha$0 : function() {
  18777. return this.malpha;
  18778. },
  18779. /**
  18780. * Sets the force layout's cooling parameter value. If value is greater than zero, this method also restarts the force layout if it is not already running, dispatching a "start" event and enabling the tick timer. If value is nonpositive, and the force layout is running, this method stops the force layout on the next tick and dispatches an "end" event.
  18781. * @param (double) x the cooling parameter value to set
  18782. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  18783. */
  18784. alpha$1 : function(x) {
  18785. if (this.malpha != 0) {
  18786. if (x > 0) {
  18787. this.malpha = x;
  18788. } else {
  18789. this.malpha = 0;
  18790. }
  18791. } else if (x > 0) {
  18792. this.malpha = x;
  18793. var eo = new com_ibm_rave_core_layout_force_Force.EventObject("start", x);
  18794. this.event[eo.type].call(eo, eo);
  18795. var force = this;
  18796. com_ibm_rave_core_nativeImpl_timer_Timer.INSTANCE(function(elapsed) {
  18797. return force.tick();
  18798. });
  18799. }
  18800. return this;
  18801. },
  18802. /**
  18803. * Starts the simulation; this method must be called when the layout is first created, after assigning the nodes and links. In addition, it should be called again whenever the nodes or links change. Internally, the layout uses a cooling parameter alpha which controls the layout temperature: as the physical simulation converges on a stable layout, the temperature drops, causing nodes to move more slowly. Eventually, alpha drops below a threshold and the simulation stops completely, freeing the CPU and avoiding battery drain. The layout can be reheated using resume or by restarting; this happens automatically when using the drag behavior. On start, the layout initializes various attributes on the associated nodes. The index of each node is computed by iterating over the array, starting at zero. The initial x and y coordinates, if not already set externally to a valid number, are computed by examining neighboring nodes: if a linked node already has an initial position in x or y, the corresponding coordinates are applied to the new node. This increases the stability of the graph layout when new nodes are added, rather than using the default which is to initialize the position randomly within the layout's size. The previous px and py position is set to the initial position, if not already set, giving new nodes an initial velocity of zero. Finally, the fixed boolean defaults to false. The link distances and strengths are also computed on start. In Javascript, the layout also initializes the source and target attributes on the associated links: for convenience, these attributes may be specified as a numeric index rather than a direct link, such that the nodes and links can be read-in from a JSON file or other static description that may not allow circular linking. The source and target attributes on incoming links are only replaced with the corresponding entries in nodes if these attributes are numbers; thus, these attributes on existing links are unaffected when the layout is restarted.
  18804. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  18805. */
  18806. /** @expose */
  18807. start : function() {
  18808. var i, n = this.mnodes.length, m = this.mlinks.length;
  18809. var w = this.msize[0], h = this.msize[1];
  18810. for (i = 0; i < n; ++i) {
  18811. var node = this.mnodes[i];
  18812. node["index"] = i;
  18813. node["weight"] = 0;
  18814. }
  18815. for (i = 0; i < m; ++i) {
  18816. var link = this.mlinks[i];
  18817. var source = link["source"];
  18818. var target = link["target"];
  18819. if (com_ibm_rave_core_internal_nativeImpl_Lang.isNumber(source)) {
  18820. link["source"] = this.mnodes[(source)];
  18821. }
  18822. if (com_ibm_rave_core_internal_nativeImpl_Lang.isNumber(target)) {
  18823. link["target"] = this.mnodes[(target)];
  18824. }
  18825. ++link["source"]["weight"];
  18826. ++link["target"]["weight"];
  18827. }
  18828. for (i = 0; i < n; ++i) {
  18829. var node = this.mnodes[i];
  18830. if (isNaN(node["x"])) {
  18831. node["x"] = this.position(true, w, i);
  18832. }
  18833. if (isNaN(node["y"])) {
  18834. node["y"] = this.position(false, h, i);
  18835. }
  18836. if (isNaN(node["px"])) {
  18837. node["px"] = node["x"];
  18838. }
  18839. if (isNaN(node["py"])) {
  18840. node["py"] = node["y"];
  18841. }
  18842. }
  18843. this.distances = [];
  18844. if (typeof this.mlinkDistance === "function") {
  18845. for (i = 0; i < m; ++i) {
  18846. this.distances[i] = + ((this.mlinkDistance).call(this, this.mlinks[i], i, -1));
  18847. }
  18848. } else {
  18849. for (i = 0; i < m; ++i) {
  18850. this.distances[i] = (this.mlinkDistance);
  18851. }
  18852. }
  18853. this.strengths = [];
  18854. if (typeof this.mlinkStrength === "function") {
  18855. for (i = 0; i < m; ++i) {
  18856. this.strengths[i] = + ((this.mlinkStrength).call(this, this.mlinks[i], i, -1));
  18857. }
  18858. } else {
  18859. for (i = 0; i < m; ++i) {
  18860. this.strengths[i] = (this.mlinkStrength);
  18861. }
  18862. }
  18863. this.charges = [];
  18864. if (typeof this.mcharge === "function") {
  18865. for (i = 0; i < n; ++i) {
  18866. this.charges[i] = + ((this.mcharge).call(this, this.mnodes[i], i, -1));
  18867. }
  18868. } else {
  18869. for (i = 0; i < n; ++i) {
  18870. this.charges[i] = (this.mcharge);
  18871. }
  18872. }
  18873. return this.resume();
  18874. },
  18875. position : function(xdim, size, i) {
  18876. return Math["random"]() * size;
  18877. },
  18878. /**
  18879. * Sets the internal alpha parameter to 0.1, and then restarts the timer. Typically, you don't need to call this method directly; it is called automatically by start. It is also called automatically by drag during a drag gesture.
  18880. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  18881. */
  18882. /** @expose */
  18883. resume : function() {
  18884. return this.alpha(0.1);
  18885. },
  18886. /**
  18887. * Terminates the simulation, setting the cooling parameter alpha to zero. This can be used to stop the simulation explicitly, for example, if you want to show animation or allow other interaction. If you do not stop the layout explicitly, it will still stop automatically after the layout's cooling parameter decays below some threshold.
  18888. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  18889. */
  18890. /** @expose */
  18891. stop : function() {
  18892. return this.alpha(0);
  18893. },
  18894. /**
  18895. * Gets the listener for the specified event type supported by force layout: "start", "tick", and "end"
  18896. * @param (String) type the type of event to get the listener for
  18897. * @return (com.ibm.rave.core.selector.RunFunction) the listener for the specified event or null if none was registered
  18898. */
  18899. on$0 : function(type) {
  18900. return this.event.on$0(type);
  18901. },
  18902. /**
  18903. * Registers the specified listener to receive events of the specified type from the force layout. Currently, only "start", "tick", and "end" events are supported. The "tick" events are dispatched for each tick of the simulation. Listen to tick events to update the displayed positions of nodes and links. The "end" event is dispatched when the simulations internal alpha cooling parameter reaches zero. The "start" is dispatched when the simulation starts
  18904. * @param (String) type the type of the force event to listen for
  18905. * @param (com.ibm.rave.core.selector.RunFunction) listener the listener
  18906. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  18907. */
  18908. on$1 : function(type, listener) {
  18909. this.event.on$1(type, listener);
  18910. return this;
  18911. },
  18912. createDrag : function() {
  18913. if (!this.mdrag) {
  18914. this.mdrag = com_ibm_rave_core_behavior_Behavior.INSTANCE.drag().origin(com_ibm_rave_core_layout_force_Force.identity).on("dragstart.force", com_ibm_rave_core_layout_force_Force.dragstart).on("drag.force", this.dragmove).on("dragend.force", com_ibm_rave_core_layout_force_Force.dragend);
  18915. }
  18916. },
  18917. /** @expose */
  18918. nodes : function(a0) {
  18919. var args = arguments;
  18920. if (args.length == 0) {
  18921. return this.nodes$0();
  18922. }
  18923. return this.nodes$1(a0);
  18924. },
  18925. /** @expose */
  18926. links : function(a0) {
  18927. var args = arguments;
  18928. if (args.length == 0) {
  18929. return this.links$0();
  18930. }
  18931. return this.links$1(a0);
  18932. },
  18933. /** @expose */
  18934. size : function(a0) {
  18935. var args = arguments;
  18936. if (args.length == 0) {
  18937. return this.size$0();
  18938. }
  18939. return this.size$1(a0);
  18940. },
  18941. /** @expose */
  18942. distance : function(a0) {
  18943. var args = arguments;
  18944. if (args.length == 0) {
  18945. return this.distance$0();
  18946. }
  18947. return this.distance$1(a0);
  18948. },
  18949. /** @expose */
  18950. linkDistance : function(a0) {
  18951. var args = arguments;
  18952. if (args.length == 0) {
  18953. return this.linkDistance$0();
  18954. }
  18955. return this.linkDistance$1(a0);
  18956. },
  18957. /** @expose */
  18958. linkStrength : function(a0) {
  18959. var args = arguments;
  18960. if (args.length == 0) {
  18961. return this.linkStrength$0();
  18962. }
  18963. return this.linkStrength$1(a0);
  18964. },
  18965. /** @expose */
  18966. friction : function(a0) {
  18967. var args = arguments;
  18968. if (args.length == 0) {
  18969. return this.friction$0();
  18970. }
  18971. return this.friction$1(a0);
  18972. },
  18973. /** @expose */
  18974. charge : function(a0) {
  18975. var args = arguments;
  18976. if (args.length == 0) {
  18977. return this.charge$0();
  18978. }
  18979. return this.charge$1(a0);
  18980. },
  18981. /** @expose */
  18982. chargeDistance : function(a0) {
  18983. var args = arguments;
  18984. if (args.length == 0) {
  18985. return this.chargeDistance$0();
  18986. }
  18987. return this.chargeDistance$1(a0);
  18988. },
  18989. /** @expose */
  18990. gravity : function(a0) {
  18991. var args = arguments;
  18992. if (args.length == 0) {
  18993. return this.gravity$0();
  18994. }
  18995. return this.gravity$1(a0);
  18996. },
  18997. /** @expose */
  18998. theta : function(a0) {
  18999. var args = arguments;
  19000. if (args.length == 0) {
  19001. return this.theta$0();
  19002. }
  19003. return this.theta$1(a0);
  19004. },
  19005. /** @expose */
  19006. alpha : function(a0) {
  19007. var args = arguments;
  19008. if (args.length == 0) {
  19009. return this.alpha$0();
  19010. }
  19011. return this.alpha$1(a0);
  19012. },
  19013. /** @expose */
  19014. on : function(a0, a1) {
  19015. var args = arguments;
  19016. if (args.length == 1) {
  19017. return this.on$0(a0);
  19018. }
  19019. return this.on$1(a0, a1);
  19020. }
  19021. });
  19022. com_ibm_rave_core_layout_force_Force.forceAccumulate = function(quad, alpha, charges) {
  19023. var cx = 0, cy = 0;
  19024. var fn = new com_ibm_rave_core_layout_force_Force.QuadNodeData();
  19025. quad.data = fn;
  19026. fn.charge = 0;
  19027. if (!quad.leaf) {
  19028. var nodes = quad.nodes;
  19029. var n = nodes.length;
  19030. var i = -1;
  19031. var c;
  19032. while (++i < n) {
  19033. c = nodes[i];
  19034. if (c) {
  19035. com_ibm_rave_core_layout_force_Force.forceAccumulate(c, alpha, charges);
  19036. var cfn = c.data;
  19037. fn.charge += cfn.charge;
  19038. cx += cfn.charge * cfn.cx;
  19039. cy += cfn.charge * cfn.cy;
  19040. }
  19041. }
  19042. }
  19043. if (quad.point) {
  19044. var n = quad.point;
  19045. if (!quad.leaf) {
  19046. n["x"] += Math["random"]() - .5;
  19047. n["y"] += Math["random"]() - .5;
  19048. }
  19049. var k = alpha * charges[n["index"]];
  19050. fn.charge += fn.pointCharge = k;
  19051. cx += k * n["x"];
  19052. cy += k * n["y"];
  19053. }
  19054. fn.cx = cx / fn.charge;
  19055. fn.cy = cy / fn.charge;
  19056. };
  19057. /**
  19058. * The event object fired by force layout
  19059. */
  19060. com_ibm_rave_core_layout_force_Force.EventObject = rave_externs["EventObject"] = com_ibm_rave_core_nativeImpl_Declare({
  19061. /**
  19062. * The type of the event being fired, could either: "start", "tick" or "end"
  19063. */
  19064. /** @expose */
  19065. type : null,
  19066. /**
  19067. * The current value of the cooling parameter alpha
  19068. */
  19069. /** @expose */
  19070. alpha : 0,
  19071. constructor : function(type, alpha) {
  19072. this.type = type;
  19073. this.alpha = alpha;
  19074. }
  19075. });
  19076. com_ibm_rave_core_layout_force_Force.QuadNodeData = com_ibm_rave_core_nativeImpl_Declare({
  19077. cx : 0,
  19078. cy : 0,
  19079. charge : 0,
  19080. pointCharge : 0
  19081. });
  19082. com_ibm_rave_core_layout_force_Force.identity = com_ibm_rave_core_internal_util_Identity.create();
  19083. com_ibm_rave_core_layout_force_Force.dragstart = function(args) {
  19084. if (args !== null || arguments.length > 1){
  19085. args = Array.prototype.slice.call(arguments, 0);
  19086. }
  19087. {
  19088. var d = args[0];
  19089. d["fixed"] |= 2;
  19090. return null;
  19091. }
  19092. };
  19093. com_ibm_rave_core_layout_force_Force.dragend = function(args) {
  19094. if (args !== null || arguments.length > 1){
  19095. args = Array.prototype.slice.call(arguments, 0);
  19096. }
  19097. {
  19098. var d = args[0];
  19099. d["fixed"] &= ~6;
  19100. return null;
  19101. }
  19102. };
  19103. com_ibm_rave_core_layout_force_Force.mouseover = function(data, index, groupIndex, event) {
  19104. var d = data;
  19105. d["fixed"] |= 4;
  19106. d["px"] = d["x"];
  19107. d["py"] = d["y"];
  19108. };
  19109. com_ibm_rave_core_layout_force_Force.mouseout = function(data, index, groupIndex, event) {
  19110. var d = data;
  19111. d["fixed"] &= ~4;
  19112. };
  19113. com_ibm_rave_core_layout_force_Force.fx = function(node, index) {
  19114. return node["x"];
  19115. };
  19116. com_ibm_rave_core_layout_force_Force.fy = function(node, index) {
  19117. return node["y"];
  19118. };
  19119. // $source: com/ibm/rave/core/behavior/Behavior
  19120. /************************************************************************
  19121. ** IBM Confidential
  19122. **
  19123. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  19124. **
  19125. ** (C) Copyright IBM Corp. 2015
  19126. **
  19127. ** The source code for this program is not published or otherwise divested of its trade secrets,
  19128. ** irrespective of what has been deposited with the U.S. Copyright Office.
  19129. ************************************************************************/
  19130. // GENERATED
  19131. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  19132. //@import com/ibm/rave/core/behavior/Drag (runtime) // new
  19133. //@import com/ibm/rave/core/behavior/Zoom (runtime) // new
  19134. //@import com/ibm/rave/core/behavior/SelectionEventHandler (runtime) // new
  19135. //@import com/ibm/rave/core/behavior/FocusEventHandler (runtime) // new
  19136. var com_ibm_rave_core_behavior_Behavior = com_ibm_rave_core_nativeImpl_Declare({
  19137. /**
  19138. * Constructs a new drag behavior.
  19139. * @return (com.ibm.rave.core.behavior.Drag) the newly constructed Drag behavior object.
  19140. */
  19141. /** @expose */
  19142. drag : function() {
  19143. return new com_ibm_rave_core_behavior_Drag();
  19144. },
  19145. /**
  19146. * Constructs a new zoom behavior.
  19147. * @return (com.ibm.rave.core.behavior.Zoom) the newly constructed Zoom behavior object.
  19148. */
  19149. /** @expose */
  19150. zoom : function() {
  19151. return new com_ibm_rave_core_behavior_Zoom();
  19152. },
  19153. /**
  19154. * Constructs a selection event tracker object which tracks and fires selection events.
  19155. * @return (com.ibm.rave.core.behavior.SelectionEventHandler) the newly constructed selection event tracker
  19156. */
  19157. /** @expose */
  19158. selectionEventHandler : function() {
  19159. return new com_ibm_rave_core_behavior_SelectionEventHandler();
  19160. },
  19161. /**
  19162. * Constructs a focus event tracker object which tracks and fires focus and blur events.
  19163. * @return (com.ibm.rave.core.behavior.FocusEventHandler) the newly constructed focus event tracker
  19164. */
  19165. /** @expose */
  19166. focusEventHandler : function() {
  19167. return new com_ibm_rave_core_behavior_FocusEventHandler();
  19168. }
  19169. //constructor : function() {}
  19170. });
  19171. /** @expose */
  19172. com_ibm_rave_core_behavior_Behavior.INSTANCE = new com_ibm_rave_core_behavior_Behavior();
  19173. // $source: com/ibm/rave/core/internal/event/CustomDispatcher
  19174. /************************************************************************
  19175. ** IBM Confidential
  19176. **
  19177. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  19178. **
  19179. ** (C) Copyright IBM Corp. 2015
  19180. **
  19181. ** The source code for this program is not published or otherwise divested of its trade secrets,
  19182. ** irrespective of what has been deposited with the U.S. Copyright Office.
  19183. ************************************************************************/
  19184. // GENERATED
  19185. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  19186. //@import com/ibm/rave/core/event/Dispatcher (loadtime) // superclass
  19187. /**
  19188. * Like {@link (com.ibm.rave.core.event.Dispatcher) Dispatcher} , but for custom events abstracting native UI events. These events have a target component (such as a brush), a target element (such as the svg:g element containing the brush) and the standard arguments 'd' (the target element's data) and 'i' (the selection index of the target element).
  19189. */
  19190. var com_ibm_rave_core_internal_event_CustomDispatcher = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_event_Dispatcher, {
  19191. //target : null,
  19192. of : function(context, args) {
  19193. if (args !== null || arguments.length > 2){
  19194. args = Array.prototype.slice.call(arguments, 1);
  19195. }
  19196. {
  19197. var self = this;
  19198. return function(e1) {
  19199. var list = (args).slice();
  19200. list.push(e1);
  19201. var e0 = e1.sourceEvent = rave.event;
  19202. e1.target = self.target;
  19203. rave.event = e1;
  19204. try {
  19205. self[e1.type].apply(context, list);
  19206. } finally {
  19207. rave.event = e0;
  19208. }
  19209. };
  19210. }
  19211. }
  19212. //constructor : function() {}
  19213. });
  19214. com_ibm_rave_core_internal_event_CustomDispatcher.create$0 = function(target, types) {
  19215. if (types !== null || arguments.length > 2){
  19216. types = Array.prototype.slice.call(arguments, 1);
  19217. }
  19218. {
  19219. var dispatch = new com_ibm_rave_core_internal_event_CustomDispatcher();
  19220. dispatch.init.apply(dispatch, types);
  19221. dispatch.target = target;
  19222. return dispatch;
  19223. }
  19224. };
  19225. com_ibm_rave_core_internal_event_CustomDispatcher.create = function(a0, a1) {
  19226. var args = arguments;
  19227. return com_ibm_rave_core_internal_event_CustomDispatcher.create$0.apply(this, args);
  19228. };
  19229. // $source: com/ibm/rave/core/internal/nativeImpl/event/DragSuppress
  19230. /************************************************************************
  19231. ** IBM Confidential
  19232. **
  19233. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  19234. **
  19235. ** (C) Copyright IBM Corp. 2014
  19236. **
  19237. ** The source code for this program is not published or otherwise divested of its trade secrets,
  19238. ** irrespective of what has been deposited with the U.S. Copyright Office.
  19239. ************************************************************************/
  19240. // @import com/ibm/rave/core/nativeImpl/event/EventTracker
  19241. // @import com/ibm/rave/core/internal/nativeImpl/Vendor
  19242. var com_ibm_rave_core_internal_nativeImpl_event_DragSuppress = (function() {
  19243. var dragSelect, dragId = 0;
  19244. function preventDefault() {
  19245. rave.event.preventDefault();
  19246. };
  19247. function dragSuppress(node) {
  19248. var name = ".dragsuppress-" + ++dragId,
  19249. click = "click" + name,
  19250. w = rave.select(com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getWindow(node))
  19251. .on("touchmove" + name, preventDefault)
  19252. .on("dragstart" + name, preventDefault)
  19253. .on("selectstart" + name, preventDefault);
  19254. if (dragSelect == null) {
  19255. var docElement = rave_documentElement(node);
  19256. dragSelect = "onselectstart" in docElement ? false : vendorSymbol(docElement.style, "userSelect");
  19257. }
  19258. if (dragSelect) {
  19259. var style = rave_documentElement(node).style,
  19260. select = style[dragSelect];
  19261. style[dragSelect] = "none";
  19262. }
  19263. return function(suppressClick) {
  19264. w.on(name, null);
  19265. if (dragSelect)
  19266. style[dragSelect] = select;
  19267. if (suppressClick) { // suppress the next click, but only if it’s immediate
  19268. function off() {
  19269. w.on(click, null);
  19270. }
  19271. w.on(click, function() {
  19272. preventDefault();
  19273. off();
  19274. }, true);
  19275. setTimeout(off, 0);
  19276. }
  19277. };
  19278. }
  19279. return {
  19280. dragSuppress : dragSuppress
  19281. };
  19282. })();
  19283. // $source: com/ibm/rave/core/event/BaseEvent
  19284. /************************************************************************
  19285. ** IBM Confidential
  19286. **
  19287. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  19288. **
  19289. ** (C) Copyright IBM Corp. 2015
  19290. **
  19291. ** The source code for this program is not published or otherwise divested of its trade secrets,
  19292. ** irrespective of what has been deposited with the U.S. Copyright Office.
  19293. ************************************************************************/
  19294. // GENERATED
  19295. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  19296. /**
  19297. * A base class for all events which have a type and a target.
  19298. * @param < (java.lang.Object) T > the target type
  19299. */
  19300. var com_ibm_rave_core_event_BaseEvent = rave_externs["BaseEvent"] = com_ibm_rave_core_nativeImpl_Declare({
  19301. /**
  19302. * The name of the event (case-insensitive).
  19303. */
  19304. /** @expose */
  19305. type : null,
  19306. /**
  19307. * A reference to the event that occurred prior to this event.
  19308. */
  19309. /** @expose */
  19310. sourceEvent : null,
  19311. /**
  19312. * A reference to the target to which the event was originally dispatched.
  19313. */
  19314. /** @expose */
  19315. target : null,
  19316. /**
  19317. * Create a new event.
  19318. * @param (String) type the event type
  19319. */
  19320. /** @expose */
  19321. constructor : function(type) {
  19322. this.type = type;
  19323. }
  19324. });
  19325. // $source: com/ibm/rave/core/behavior/Drag
  19326. /************************************************************************
  19327. ** IBM Confidential
  19328. **
  19329. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  19330. **
  19331. ** (C) Copyright IBM Corp. 2015
  19332. **
  19333. ** The source code for this program is not published or otherwise divested of its trade secrets,
  19334. ** irrespective of what has been deposited with the U.S. Copyright Office.
  19335. ************************************************************************/
  19336. // GENERATED
  19337. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  19338. //@import com/ibm/rave/core/internal/event/CustomDispatcher (runtime) // create
  19339. //@import com/ibm/rave/core/internal/nativeImpl/PlatformInitialization (runtime) // getWindow
  19340. //@import com/ibm/rave/core/internal/util/Identity (runtime) // create
  19341. //@import com/ibm/rave/core/nativeImpl/event/Mouse (runtime) // mousePoint
  19342. //@import com/ibm/rave/core/event/TouchUtil (runtime) // touchFromSource
  19343. //@import com/ibm/rave/core/Rave (runtime) // select
  19344. //@import com/ibm/rave/core/internal/nativeImpl/event/DragSuppress (runtime) // dragSuppress
  19345. //@import com/ibm/rave/core/event/BaseEvent (loadtime) // superclass
  19346. var com_ibm_rave_core_behavior_Drag = rave_externs["Drag"] = com_ibm_rave_core_nativeImpl_Declare({
  19347. //event : null,
  19348. //originFunc : null,
  19349. //rave_window : null,
  19350. //identity : null,
  19351. //dragTouchId : null,
  19352. //mousedowned : null,
  19353. //touchstart : null,
  19354. _$functionClassMethod : function() {
  19355. var _$self = /**
  19356. * @see RunFunction#_$self.run(Object, )
  19357. */
  19358. function(args) {
  19359. if (args !== null || arguments.length > 1){
  19360. args = Array.prototype.slice.call(arguments, 0);
  19361. }
  19362. {
  19363. if (!args || args.length == 0) {
  19364. return _$self;
  19365. }
  19366. _$self.drag(args[0]);
  19367. return null;
  19368. }
  19369. };
  19370. return _$self;
  19371. },
  19372. constructor : function() {
  19373. this.event = com_ibm_rave_core_internal_event_CustomDispatcher.create$0(this, "drag", "dragstart", "dragend");
  19374. this.rave_window = function(data, index, groupIndex) {
  19375. return com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getWindow(data);
  19376. };
  19377. this.identity = com_ibm_rave_core_internal_util_Identity.create();
  19378. this.dragTouchId = function() {
  19379. return (rave.event).changedTouches[0].identifier;
  19380. };
  19381. this.mousedowned = this.dragStart(null, function(node, id) {
  19382. return com_ibm_rave_core_nativeImpl_event_Mouse.mousePoint(node);
  19383. }, this.rave_window, "mousemove", "mouseup");
  19384. this.touchstart = this.dragStart(this.dragTouchId, function(node, id) {
  19385. return com_ibm_rave_core_event_TouchUtil.touchFromSource(node, id);
  19386. }, this.identity, "touchmove", "touchend");
  19387. },
  19388. /**
  19389. * Creates event listeners to handle drag gestures on an element. Both mouse events and touch events are supported.
  19390. * @param (com.ibm.rave.core.selector.Selector) g
  19391. */
  19392. /** @expose */
  19393. drag : function(g) {
  19394. g.on("mousedown.drag", this.mousedowned).on("touchstart.drag", this.touchstart);
  19395. },
  19396. dragStart : function(id, position, subject, move, end) {
  19397. var self = this;
  19398. return function(data, index, groupIndex, event) {
  19399. var target = rave.event.target;
  19400. var parent = this.rave_getParentNode();
  19401. var dispatch = self.event.of(this, data, index, groupIndex);
  19402. var dragged = [0];
  19403. var dragId = id ? id() : null;
  19404. var dragName = ".drag" + (dragId == null ? "" : "-" + dragId);
  19405. var dragOffset;
  19406. var dragSubject = com_ibm_rave_core_Rave.select(subject.call(this, target, index, groupIndex));
  19407. var dragRestore = com_ibm_rave_core_internal_nativeImpl_event_DragSuppress.dragSuppress(target);
  19408. var position0 = position(parent, dragId);
  19409. if (self.originFunc) {
  19410. var value = self.originFunc.call(this, data, index, groupIndex);
  19411. dragOffset = [value["x"] - position0[0], value["y"] - position0[1]];
  19412. } else {
  19413. dragOffset = [0, 0];
  19414. }
  19415. dispatch(new com_ibm_rave_core_behavior_Drag.EventObject("dragstart", 0, 0, 0, 0));
  19416. var moved = function(data, index, groupIndex, event) {
  19417. var position1 = position(parent, dragId);
  19418. if (!position1) {
  19419. return;
  19420. }
  19421. var dx = position1[0] - position0[0];
  19422. var dy = position1[1] - position0[1];
  19423. dragged |= ~~dx | ~~dy;
  19424. position0 = position1;
  19425. dispatch(new com_ibm_rave_core_behavior_Drag.EventObject("drag", position1[0] + dragOffset[0], position1[1] + dragOffset[1], dx, dy));
  19426. };
  19427. var ended = function(data, index, groupIndex, event) {
  19428. if (!position(parent, dragId)) {
  19429. return;
  19430. }
  19431. dragSubject.on(move + dragName, null).on(end + dragName, null);
  19432. dragRestore(dragged != 0 && rave.event.target == target);
  19433. dispatch(new com_ibm_rave_core_behavior_Drag.EventObject("dragend", 0, 0, 0, 0));
  19434. };
  19435. dragSubject.on(move + dragName, moved).on(end + dragName, ended);
  19436. };
  19437. },
  19438. /**
  19439. * If origin is specified, sets the origin accessor to the specified function. If origin is not specified, returns the current origin accessor which defaults to null. The origin accessor function is used to determine the starting position (the “origin”) of the element being dragged; this allows the drag behavior to preserve the offset between the mouse position and the starting element position during drag. If the origin accessor is null, then the element position is set to the mouse position on drag; this can cause a noticeable jump on large elements. If an origin accessor is specified, the function is called on mousedown. The function is invoked in the same manner as other operator functions, being passed the current datum d and index i, with the this context as the clicked-on DOM element. To access the current event, use the global d3.event. The origin accessor must return an object with x and y properties representing the starting coordinates of the element being dragged. Frequently the origin accessor is specified as the identity function: function(d) { return d; }. This is suitable when the datum bound to the dragged element is already an object with x and y attributes representing its current position.
  19440. * @return (com.ibm.rave.core.selector.ValueFunction) the origin function
  19441. */
  19442. origin$0 : function() {
  19443. return this.originFunc;
  19444. },
  19445. /**
  19446. * If origin is specified, sets the origin accessor to the specified function. If origin is not specified, returns the current origin accessor which defaults to null. The origin accessor function is used to determine the starting position (the “origin”) of the element being dragged; this allows the drag behavior to preserve the offset between the mouse position and the starting element position during drag. If the origin accessor is null, then the element position is set to the mouse position on drag; this can cause a noticeable jump on large elements. If an origin accessor is specified, the function is called on mousedown. The function is invoked in the same manner as other operator functions, being passed the current datum d and index i, with the this context as the clicked-on DOM element. To access the current event, use the global d3.event. The origin accessor must return an object with x and y properties representing the starting coordinates of the element being dragged. Frequently the origin accessor is specified as the identity function: function(d) { return d; }. This is suitable when the datum bound to the dragged element is already an object with x and y attributes representing its current position.
  19447. * @param (com.ibm.rave.core.selector.ValueFunction) x The origin function
  19448. * @return (com.ibm.rave.core.behavior.Drag) this isntance of Drag
  19449. */
  19450. origin$1 : function(x) {
  19451. this.originFunc = x;
  19452. return this;
  19453. },
  19454. /**
  19455. * Registers the specified listener to receive events of the specified type from the drag behavior. If no listener is specified, returns the currently-registered listener for the specified event type. (The type may include a namespace; see dispatch.on for additional details.) The following events are supported: dragstart - when a drag gesture starts. drag - when the drag gesture moves. dragend - when the drag gesture finishes. Drag events (but not dragstart and dragend events) expose "x" and "y" properties representing the current position of the drag gesture in local coordinates. By default, this position is simply the mouse (or touch) position; however, the position can be modified by specifying an origin. The drag event also exposes "dx" and "dy" properties representing the element’s coordinates relative to its position at the beginning of the gesture, which is occasionally more convenient than specifying an explicit origin. During a drag gesture, some browser default behaviors (such as text selection) are prevented. In addition, the default behavior for a click event immediately a non-empty drag gesture is prevented, so as to allow the dragging of links. When registering your own click listener on draggable elements, you can check whether the click event was suppressed as follows: selection.on("click", function() { if (d3.event.defaultPrevented) return; // click suppressed console.log("clicked!"); }); When combining drag behaviors with other event listeners for interaction events, you may also consider stopping propagation on the source event to prevent multiple actions: drag.on("dragstart", function() { d3.event.sourceEvent.stopPropagation(); // silence other listeners });
  19456. * @param (String) type the specified event type
  19457. * @return (com.ibm.rave.core.selector.RunFunction) the currently-registered listener for the specified event type
  19458. */
  19459. on$0 : function(type) {
  19460. return this.event.on$0(type);
  19461. },
  19462. /**
  19463. * Registers the specified listener to receive events of the specified type from the drag behavior. If no listener is specified, returns the currently-registered listener for the specified event type. (The type may include a namespace; see dispatch.on for additional details.) The following events are supported: dragstart - when a drag gesture starts. drag - when the drag gesture moves. dragend - when the drag gesture finishes. Drag events (but not dragstart and dragend events) expose "x" and "y" properties representing the current position of the drag gesture in local coordinates. By default, this position is simply the mouse (or touch) position; however, the position can be modified by specifying an origin. The drag event also exposes "dx" and "dy" properties representing the element’s coordinates relative to its position at the beginning of the gesture, which is occasionally more convenient than specifying an explicit origin. During a drag gesture, some browser default behaviors (such as text selection) are prevented. In addition, the default behavior for a click event immediately a non-empty drag gesture is prevented, so as to allow the dragging of links. When registering your own click listener on draggable elements, you can check whether the click event was suppressed as follows: selection.on("click", function() { if (d3.event.defaultPrevented) return; // click suppressed console.log("clicked!"); }); When combining drag behaviors with other event listeners for interaction events, you may also consider stopping propagation on the source event to prevent multiple actions: drag.on("dragstart", function() { d3.event.sourceEvent.stopPropagation(); // silence other listeners });
  19464. * @param (com.ibm.rave.core.selector.RunFunction) listener the listener to recieve events
  19465. * @return (com.ibm.rave.core.behavior.Drag) this instance of Drag
  19466. */
  19467. on$1 : function(type, listener) {
  19468. this.event.on$1(type, listener);
  19469. return this;
  19470. },
  19471. /** @expose */
  19472. origin : function(a0) {
  19473. var args = arguments;
  19474. if (args.length == 0) {
  19475. return this.origin$0();
  19476. }
  19477. return this.origin$1(a0);
  19478. },
  19479. /** @expose */
  19480. on : function(a0, a1) {
  19481. var args = arguments;
  19482. if (args.length == 1) {
  19483. return this.on$0(a0);
  19484. }
  19485. return this.on$1(a0, a1);
  19486. }
  19487. });
  19488. /**
  19489. * The drag event object class.
  19490. */
  19491. com_ibm_rave_core_behavior_Drag.EventObject = rave_externs["EventObject"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_event_BaseEvent, {
  19492. /** @expose */
  19493. x : 0,
  19494. /** @expose */
  19495. y : 0,
  19496. /** @expose */
  19497. dx : 0,
  19498. /** @expose */
  19499. dy : 0,
  19500. constructor : function(type, x, y, dx, dy) {
  19501. this.x = x;
  19502. this.y = y;
  19503. this.dx = dx;
  19504. this.dy = dy;
  19505. }
  19506. });
  19507. // $source: com/ibm/rave/core/behavior/Zoom
  19508. /************************************************************************
  19509. ** IBM Confidential
  19510. **
  19511. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  19512. **
  19513. ** (C) Copyright IBM Corp. 2015
  19514. **
  19515. ** The source code for this program is not published or otherwise divested of its trade secrets,
  19516. ** irrespective of what has been deposited with the U.S. Copyright Office.
  19517. ************************************************************************/
  19518. // GENERATED
  19519. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, bind
  19520. //@import com/ibm/rave/core/internal/event/CustomDispatcher (runtime) // create
  19521. //@import com/ibm/rave/core/nativeImpl/event/Mouse (runtime) // mousePoint
  19522. //@import com/ibm/rave/core/internal/nativeImpl/event/DragSuppress (runtime) // dragSuppress
  19523. //@import com/ibm/rave/core/Rave (runtime) // selectAll, select
  19524. //@import com/ibm/rave/core/internal/nativeImpl/PlatformInitialization (runtime) // getWindow
  19525. //@import com/ibm/rave/core/internal/transitions/TransitionUtil (runtime) // interrupt
  19526. //@import com/ibm/rave/core/nativeImpl/event/Touches (runtime) // touches
  19527. //@import com/ibm/rave/core/internal/nativeImpl/transitions/InheritedTransition (runtime) // get
  19528. //@import com/ibm/rave/core/interpolate/ZoomInterpolation (runtime) // ZoomInterpolation
  19529. //@import com/ibm/rave/core/event/BaseEvent (loadtime) // superclass
  19530. /**
  19531. * A class that implements the Zoom behavior which automatically creates event listeners to handle zooming and panning gestures on a container element. Both mouse and touch events are supported.
  19532. */
  19533. var com_ibm_rave_core_behavior_Zoom = rave_externs["Zoom"] = com_ibm_rave_core_nativeImpl_Declare({
  19534. //_event : null,
  19535. //mousewheelTimer : null,
  19536. //sx0 : null, //sx1 : null, //sy0 : null, //sy1 : null,
  19537. //view : null,
  19538. //translate0 : null,
  19539. //center0 : null,
  19540. //_center : null,
  19541. //_size : null,
  19542. //_scaleExtent : null,
  19543. //mousedowned : null,
  19544. //touchstarted : null,
  19545. //dblclicked : null,
  19546. //mousewheeled : null,
  19547. touchtime : NaN,
  19548. _duration : 250,
  19549. zooming : 0,
  19550. _$functionClassMethod : function() {
  19551. var _$self = /**
  19552. * @see RunFunction#_$self.run(Object, Object...)
  19553. */
  19554. function(args) {
  19555. if (args !== null || arguments.length > 1){
  19556. args = Array.prototype.slice.call(arguments, 0);
  19557. }
  19558. {
  19559. _$self.zoom(args[0]);
  19560. return null;
  19561. }
  19562. };
  19563. return _$self;
  19564. },
  19565. constructor : function() {
  19566. this._event = com_ibm_rave_core_internal_event_CustomDispatcher.create$0(this, "zoomstart", "zoom", "zoomend");
  19567. this.view = new com_ibm_rave_core_behavior_Zoom.View(0, 0, 1);
  19568. this._size = [960, 500];
  19569. this._scaleExtent = com_ibm_rave_core_behavior_Zoom.zoomInfinity;
  19570. {
  19571. var self = this;
  19572. this.mousedowned = function(data, index, groupIndex, e) {
  19573. var that = this;
  19574. var location0 = self.location(com_ibm_rave_core_nativeImpl_event_Mouse.mousePoint(that));
  19575. var dragRestore = com_ibm_rave_core_internal_nativeImpl_event_DragSuppress.dragSuppress(that);
  19576. var target = rave.event.target;
  19577. var dispatch = self._event.of(that, data, index, groupIndex);
  19578. var dragged;
  19579. var subject = com_ibm_rave_core_Rave.select(com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getWindow(that));
  19580. var moved = function(data1, index1, groupIndex1, event) {
  19581. dragged = true;
  19582. self.translateTo(com_ibm_rave_core_nativeImpl_event_Mouse.mousePoint(that), location0);
  19583. self.zoomed(dispatch);
  19584. };
  19585. var ended = function(data2, index2, groupIndex2, event) {
  19586. subject.on("mousemove.zoom", null).on("mouseup.zoom", null);
  19587. dragRestore(dragged && rave.event.target == target);
  19588. self.zoomended(dispatch);
  19589. };
  19590. subject.on("mousemove.zoom", moved).on("mouseup.zoom", ended);
  19591. com_ibm_rave_core_internal_transitions_TransitionUtil.interrupt(this);
  19592. self.zoomstarted(dispatch);
  19593. };
  19594. this.touchstarted = function(data, index, groupIndex, e) {
  19595. var that = this;
  19596. var dragRestore = com_ibm_rave_core_internal_nativeImpl_event_DragSuppress.dragSuppress(that);
  19597. var dispatch = self._event.of(that, data, index, groupIndex);
  19598. var subject = com_ibm_rave_core_Rave.select(that);
  19599. var zoomName = ".zoom-" + (rave.event).changedTouches[0].identifier;
  19600. var touchmove = "touchmove" + zoomName;
  19601. var touchend = "touchend" + zoomName;
  19602. var targets = [];
  19603. var locations0 = {};
  19604. var distance0 = 0, scale0;
  19605. var relocate = function() {
  19606. var touches = com_ibm_rave_core_nativeImpl_event_Touches.touches(that);
  19607. scale0 = self.view.k;
  19608. for (var __i_enFor0 = 0, __exp_enFor0 = touches, __len_enFor0 = __exp_enFor0.length;
  19609. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  19610. var t = __exp_enFor0[__i_enFor0];
  19611. if (locations0.hasOwnProperty(t["identifier"])) {
  19612. locations0[t["identifier"]] = self.location(t);
  19613. }
  19614. }
  19615. return touches;
  19616. };
  19617. var moved = function(data1, index1, groupIndex1, event) {
  19618. var touches = com_ibm_rave_core_nativeImpl_event_Touches.touches(that);
  19619. com_ibm_rave_core_internal_transitions_TransitionUtil.interrupt(this);
  19620. var p0 = null, p1 = null;
  19621. var l0 = null, l1 = null;
  19622. for (var i = 0, n = touches.length; i < n; ++i, l1 = null) {
  19623. p1 = touches[i];
  19624. if ((l1 = locations0[p1["identifier"]])) {
  19625. if (l0) {
  19626. break;
  19627. }
  19628. p0 = p1;
  19629. l0 = l1;
  19630. }
  19631. }
  19632. if (l1) {
  19633. var temp;
  19634. var distance1 = (temp = p1[0] - p0[0]) * temp + (temp = p1[1] - p0[1]) * temp;
  19635. var scale1 = 0;
  19636. if (distance0 != 0) {
  19637. scale1 = Math.sqrt(distance1 / distance0);
  19638. }
  19639. p0 = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];
  19640. l0 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
  19641. self.scaleTo(scale1 * scale0);
  19642. }
  19643. self.touchtime = NaN;
  19644. self.translateTo(p0, l0);
  19645. self.zoomed(dispatch);
  19646. };
  19647. var ended = function(data1, index1, groupIndex1, event) {
  19648. var toucheEvent = rave.event;
  19649. if (toucheEvent.touches.length != 0) {
  19650. var changed = toucheEvent.changedTouches;
  19651. for (var i = 0, n = changed.length; i < n; ++i) {
  19652. delete locations0[changed[i].identifier];
  19653. }
  19654. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(locations0), __len_enFor0 = __exp_enFor0.length;
  19655. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  19656. var identifier = __exp_enFor0[__i_enFor0];
  19657. relocate();
  19658. return;
  19659. }
  19660. }
  19661. com_ibm_rave_core_Rave.selectAll(targets).on(zoomName, null);
  19662. subject.on("mousedown.zoom", self.mousedowned).on("touchstart.zoom", self.touchstarted);
  19663. dragRestore(false);
  19664. self.zoomended(dispatch);
  19665. };
  19666. var started = function(data1, index1, groupIndex1, event) {
  19667. var touchEvent = rave.event;
  19668. var target = touchEvent.target;
  19669. com_ibm_rave_core_Rave.select(target).on(touchmove, moved).on(touchend, ended);
  19670. targets.push(target);
  19671. var changed = touchEvent.changedTouches;
  19672. for (var i = 0, n = changed.length; i < n; ++i) {
  19673. locations0[changed[i].identifier] = null;
  19674. }
  19675. var touches = relocate();
  19676. var now = Date.now();
  19677. if (touches.length == 1) {
  19678. if (now - self.touchtime < 500) {
  19679. var p = touches[0];
  19680. self.zoomTo(that, p, locations0[p["identifier"]], Math.floor(Math.log(self.view.k) / Math["LN2"]) + 1);
  19681. rave.event.preventDefault();
  19682. }
  19683. self.touchtime = now;
  19684. } else if (touches.length > 1) {
  19685. var p = touches[0];
  19686. var q = touches[1];
  19687. var dx = p[0] - q[0];
  19688. var dy = p[1] - q[1];
  19689. distance0 = dx * dx + dy * dy;
  19690. }
  19691. };
  19692. subject.on("mousedown.zoom", null).on("touchstart.zoom", started);
  19693. started.call(null, null, -1, -1, null);
  19694. self.zoomstarted(dispatch);
  19695. };
  19696. this.dblclicked = function(data, index, groupIndex, e) {
  19697. var p = com_ibm_rave_core_nativeImpl_event_Mouse.mousePoint(this);
  19698. var k = Math.log(self.view.k) / Math["LN2"];
  19699. self.zoomTo(this, p, self.location(p), (rave.event).shiftKey ? Math.ceil(k) - 1 : Math.floor(k) + 1);
  19700. };
  19701. this.mousewheeled = function(data, index, groupIndex, e) {
  19702. var dispatch = self._event.of(this, data, index, groupIndex);
  19703. if (self.mousewheelTimer != null) {
  19704. clearTimeout(self.mousewheelTimer);
  19705. } else {
  19706. self.center0 = self._center ? self._center : com_ibm_rave_core_nativeImpl_event_Mouse.mousePoint(this);
  19707. self.translate0 = self.location(self.center0);
  19708. com_ibm_rave_core_internal_transitions_TransitionUtil.interrupt(this);
  19709. self.zoomstarted(dispatch);
  19710. }
  19711. self.mousewheelTimer = setTimeout(function() {
  19712. self.mousewheelTimer = null;
  19713. self.zoomended(dispatch);
  19714. }, 50);
  19715. rave.event.preventDefault();
  19716. self.scaleTo(Math.pow(2, com_ibm_rave_core_behavior_Zoom.zoomDelta() * .002) * self.view.k);
  19717. self.translateTo(self.center0, self.translate0);
  19718. self.zoomed(dispatch);
  19719. };
  19720. }
  19721. },
  19722. /**
  19723. * Applies the zoom behavior to the specified selection, registering the necessary event listeners to support panning and zooming.
  19724. * @param (com.ibm.rave.core.selector.Selector) g the selector to apply zoom behavior on
  19725. */
  19726. /** @expose */
  19727. zoom : com_ibm_rave_core_nativeImpl_Declare.bind(function(g) {
  19728. g.on("mousedown.zoom", this.mousedowned).on("wheel" + ".zoom", this.mousewheeled).on("dblclick.zoom", this.dblclicked).on("touchstart.zoom", this.touchstarted);
  19729. }),
  19730. /**
  19731. * Triggers zoom events based on the type of the selection passed: If selection is a selection, immediately dispatches a zoom gesture to registered listeners, as the three event sequence zoomstart, zoom and zoomend. This can be useful in triggering listeners after setting the translate or scale programatically. If selection is a transition, registers the appropriate tweens so that the zoom behavior dispatches events over the course of the transition: a zoomstart event when the transition starts from the previously-set view, zoom events for each tick of the transition, and finally a zoomend event when the transition ends. Note that the transition will be interrupted if the user starts zooming before the transition ends.
  19732. * @param (com.ibm.rave.core.selector.Selection) g the selection to trigger events for
  19733. */
  19734. /** @expose */
  19735. event : com_ibm_rave_core_nativeImpl_Declare.bind(function(g) {
  19736. var self = this;
  19737. g.each(function(data, index, groupIndex) {
  19738. var dispatch = self._event.of(this, data, index, groupIndex);
  19739. var view1 = self.view;
  19740. if (com_ibm_rave_core_internal_nativeImpl_transitions_InheritedTransition.get()) {
  19741. com_ibm_rave_core_Rave.select(this).transition().each("start.zoom", function(args) {
  19742. if (args !== null || arguments.length > 1){
  19743. args = Array.prototype.slice.call(arguments, 0);
  19744. }
  19745. {
  19746. var temp = this.rave_getProperty("__chart__");
  19747. if (temp == null) {
  19748. self.view = new com_ibm_rave_core_behavior_Zoom.View(0, 0, 1);
  19749. } else {
  19750. self.view = temp;
  19751. }
  19752. self.zoomstarted(dispatch);
  19753. return null;
  19754. }
  19755. }).tween("zoom:zoom", function(data1, index1, groupIndex1) {
  19756. var dx = self._size[0], dy = self._size[1], cx = self.center0 ? self.center0[0] : dx / 2, cy = self.center0 ? self.center0[1] : dy / 2;
  19757. var p0 = [(cx - self.view.x) / self.view.k, (cy - self.view.y) / self.view.k, dx / self.view.k];
  19758. var p1 = [(cx - view1.x) / view1.k, (cy - view1.y) / view1.k, dx / view1.k];
  19759. var i = com_ibm_rave_core_interpolate_ZoomInterpolation.INSTANCE(p0, p1);
  19760. return function(t) {
  19761. var l = i(t);
  19762. var k = dx / l[2];
  19763. self.view = new com_ibm_rave_core_behavior_Zoom.View(cx - l[0] * k, cy - l[1] * k, k);
  19764. this.rave_setProperty("__chart__", self.view);
  19765. self.zoomed(dispatch);
  19766. };
  19767. }).each("interrupt.zoom", function(args) {
  19768. if (args !== null || arguments.length > 1){
  19769. args = Array.prototype.slice.call(arguments, 0);
  19770. }
  19771. {
  19772. self.zoomended(dispatch);
  19773. return null;
  19774. }
  19775. }).each("end.zoom", function(args) {
  19776. if (args !== null || arguments.length > 1){
  19777. args = Array.prototype.slice.call(arguments, 0);
  19778. }
  19779. {
  19780. self.zoomended(dispatch);
  19781. return null;
  19782. }
  19783. });
  19784. } else {
  19785. this.rave_setProperty("__chart__", self.view);
  19786. self.zoomstarted(dispatch);
  19787. self.zoomed(dispatch);
  19788. self.zoomended(dispatch);
  19789. }
  19790. });
  19791. }),
  19792. /**
  19793. * Returns the current translation vector, which defaults to a point of [0, 0].
  19794. * @return (Array) the current translation vector
  19795. */
  19796. translate$0 : function() {
  19797. return [this.view.x, this.view.y];
  19798. },
  19799. /**
  19800. * Specifies the current zoom translation vector.
  19801. * @param (Array) point the zoom translation vector to set
  19802. * @return (com.ibm.rave.core.behavior.Zoom) this zoom instance itself
  19803. */
  19804. translate$1 : function(point) {
  19805. this.view = new com_ibm_rave_core_behavior_Zoom.View(point[0], point[1], this.view.k);
  19806. this.rescale();
  19807. return this;
  19808. },
  19809. /**
  19810. * Returns the current zoom scale, which defaults to 1.
  19811. * @return (double) the current zoom scale factor
  19812. */
  19813. scale$0 : function() {
  19814. return this.view.k;
  19815. },
  19816. /**
  19817. * Specifies the current zoom scale.
  19818. * @param (double) s the zoom scale to set
  19819. * @return (com.ibm.rave.core.behavior.Zoom) this zoom instance itself
  19820. */
  19821. scale$1 : function(s) {
  19822. this.view = new com_ibm_rave_core_behavior_Zoom.View(this.view.x, this.view.y, s);
  19823. this.rescale();
  19824. return this;
  19825. },
  19826. /**
  19827. * Returns the current scale extent dimension object, which defaults to a minimum of 0 and maximum of Infinity.
  19828. * @return (Array) scale extent dimension object
  19829. */
  19830. scaleExtent$0 : function() {
  19831. return this._scaleExtent;
  19832. },
  19833. /**
  19834. * Specifies the zoom scale's allowed range as dimension object with minimum, maximum values.
  19835. * @param (Array) dim the dimension object where w represent the minimum value and h represent the maximum value
  19836. * @return (com.ibm.rave.core.behavior.Zoom) this zoom instance itself
  19837. */
  19838. scaleExtent$1 : function(dim) {
  19839. this._scaleExtent = !dim ? com_ibm_rave_core_behavior_Zoom.zoomInfinity : [dim[0], dim[1]];
  19840. return this;
  19841. },
  19842. /**
  19843. * Returns the current focal point, which defaults to null. A null center indicates that mousewheel zooming should zoom in and out around the current mouse location.
  19844. * @return (Array) the current focal point
  19845. */
  19846. center$0 : function() {
  19847. return this._center;
  19848. },
  19849. /**
  19850. * Sets the focal point [x, y] for mousewheel zooming.
  19851. * @param (Array) p the focal point to set
  19852. * @return (com.ibm.rave.core.behavior.Zoom) this zoom instance itself
  19853. */
  19854. center$1 : function(p) {
  19855. this._center = p ? [p[0], p[1]] : null;
  19856. return this;
  19857. },
  19858. /**
  19859. * The Duration of the zoom transition
  19860. * @return (double) zoom transition duration
  19861. */
  19862. duration$0 : function() {
  19863. return this._duration;
  19864. },
  19865. /**
  19866. * Sets the zoom transition duration
  19867. * @param (double) duration the zoom transition duration value
  19868. * @return (com.ibm.rave.core.behavior.Zoom) this zoom instance itself
  19869. */
  19870. duration$1 : function(duration) {
  19871. this._duration = duration;
  19872. return this;
  19873. },
  19874. /**
  19875. * Returns the current viewport size which defaults to [960, 500]. A size is needed to support smooth zooming during transitions.
  19876. * @return (Array) the current viewport size
  19877. */
  19878. size$0 : function() {
  19879. return this._size;
  19880. },
  19881. /**
  19882. * If size is specified, sets the viewport size to the specified dimensions [width, height] and returns this zoom behavior.
  19883. * @param (Array) p the zoom viewport size
  19884. * @return (com.ibm.rave.core.behavior.Zoom) this zoom instance itself
  19885. */
  19886. size$1 : function(p) {
  19887. this._size = p ? [p[0], p[1]] : null;
  19888. return this;
  19889. },
  19890. /**
  19891. * Returns the current x-scale, which defaults to null
  19892. * @return (com.ibm.rave.core.scales.AbstractScale) the current x-scale
  19893. */
  19894. x$0 : function() {
  19895. return this.sx1;
  19896. },
  19897. /**
  19898. * Specifies an x-scale whose domain should be automatically adjusted when zooming. If the scale's domain or range is modified programmatically, this function should be called again. Setting the x-scale also resets the scale to 1 and the translate to [0, 0].
  19899. * @param (com.ibm.rave.core.scales.AbstractScale) z the x-scale
  19900. * @return (com.ibm.rave.core.behavior.Zoom) this zoom instance itself
  19901. */
  19902. x$1 : function(z) {
  19903. this.sx1 = z;
  19904. this.sx0 = z.copy();
  19905. this.view = new com_ibm_rave_core_behavior_Zoom.View(0, 0, 1);
  19906. return this;
  19907. },
  19908. /**
  19909. * Returns the current y-scale, which defaults to null.
  19910. * @return (com.ibm.rave.core.scales.AbstractScale) the current y-scale
  19911. */
  19912. y$0 : function() {
  19913. return this.sy1;
  19914. },
  19915. /**
  19916. * Specifies an y-scale whose domain should be automatically adjusted when zooming. If the scale's domain or range is modified programmatically, this function should be called again. Setting the y-scale also resets the scale to 1 and the translate to [0, 0].
  19917. * @param (com.ibm.rave.core.scales.AbstractScale) z the y-scale
  19918. * @return (com.ibm.rave.core.behavior.Zoom) this zoom instance itself
  19919. */
  19920. y$1 : function(z) {
  19921. this.sy1 = z;
  19922. this.sy0 = z.copy();
  19923. this.view = new com_ibm_rave_core_behavior_Zoom.View(0, 0, 1);
  19924. return this;
  19925. },
  19926. location : function(p) {
  19927. return [(p[0] - this.view.x) / this.view.k, (p[1] - this.view.y) / this.view.k];
  19928. },
  19929. point : function(l) {
  19930. return [l[0] * this.view.k + this.view.x, l[1] * this.view.k + this.view.y];
  19931. },
  19932. scaleTo : function(s) {
  19933. this.view.k = Math.max(this._scaleExtent[0], Math.min(this._scaleExtent[1], s));
  19934. },
  19935. translateTo : function(p, l) {
  19936. l = this.point(l);
  19937. this.view.x += p[0] - l[0];
  19938. this.view.y += p[1] - l[1];
  19939. },
  19940. rescale : function() {
  19941. if (this.sx1) {
  19942. if (this.sx1.zoomTransform) {
  19943. this.sx1.zoomTransform(this.view.k, this.view.x);
  19944. } else {
  19945. var ro = this.sx0.range();
  19946. var r = new Array(ro.length);
  19947. for (var i = 0, len = ro.length; i < len; ++i) {
  19948. r[i] = this.sx0.invert(+ ((ro[i] - this.view.x) / this.view.k));
  19949. }
  19950. this.sx1.domain(r);
  19951. }
  19952. }
  19953. if (this.sy1) {
  19954. if (this.sy1.zoomTransform) {
  19955. this.sy1.zoomTransform(this.view.k, this.view.y);
  19956. } else {
  19957. var ro = this.sy0.range();
  19958. var r = new Array(ro.length);
  19959. for (var i = 0, len = ro.length; i < len; ++i) {
  19960. r[i] = this.sy0.invert(+ ((ro[i] - this.view.y) / this.view.k));
  19961. }
  19962. this.sy1.domain(r);
  19963. }
  19964. }
  19965. },
  19966. zoomstarted : function(dispatch) {
  19967. if (this.zooming++ != 0) {
  19968. dispatch(new com_ibm_rave_core_behavior_Zoom.EventObject("zoomstart", 0, null));
  19969. }
  19970. },
  19971. zoomed : function(dispatch) {
  19972. this.rescale();
  19973. dispatch(new com_ibm_rave_core_behavior_Zoom.EventObject("zoom", this.view.k, [this.view.x, this.view.y]));
  19974. },
  19975. zoomended : function(dispatch) {
  19976. if (--this.zooming == 0) {
  19977. dispatch(new com_ibm_rave_core_behavior_Zoom.EventObject("zoomend", 0, null));
  19978. }
  19979. this.center0 = null;
  19980. },
  19981. /**
  19982. * Gets the listener for the specified event type supported by brush: "zoomstart", "zoom" and "zoomend"
  19983. * @param (String) type the type of event to get the listener for
  19984. * @return (com.ibm.rave.core.selector.RunFunction) the listener for the specified event or null if none was registered
  19985. */
  19986. on$0 : function(type) {
  19987. return this._event.on$0(type);
  19988. },
  19989. /**
  19990. * Registers the specified listener to receive events of the specified type from the zoom behavior. The following types are supported: zoomstart - at the start of a zoom gesture (e.g., touchstart). zoom - when the view changes (e.g., touchmove). zoomend - at the end of the current zoom gesture (e.g., touchend). If an event listener was already registered for the same type, the existing listener is removed before the new listener is added. To register multiple listeners for the same event type, the type may be followed by an optional namespace, such as "zoom.foo" and "zoom.bar". To remove a listener, pass null as the listener. For mousewheel events, which happen discretely with no explicit start and end reported by the browser, events that occur within 50 milliseconds of each other are grouped into a single zoom gesture. When fired, the EventObject object will contain the following properties: scale - a number; the current scale. translate - a two-element array representing the current translation vector.
  19991. * @param (String) type the type of the brush event to listen for
  19992. * @param (com.ibm.rave.core.selector.RunFunction) listener the listener to register
  19993. * @return (com.ibm.rave.core.behavior.Zoom) this zoom instance itself
  19994. */
  19995. on$1 : function(type, listener) {
  19996. this._event.on$1(type, listener);
  19997. return this;
  19998. },
  19999. zoomTo : function(that, p, l, k) {
  20000. that.rave_setProperty("__chart__", new com_ibm_rave_core_behavior_Zoom.View(this.view.x, this.view.y, this.view.k));
  20001. this.scaleTo(Math.pow(2, k));
  20002. this.translateTo(this.center0 = p, l);
  20003. var context = com_ibm_rave_core_Rave.select(that);
  20004. if (this._duration > 0) {
  20005. context = context.transition().duration(this._duration);
  20006. }
  20007. this.event(context);
  20008. },
  20009. /** @expose */
  20010. translate : function(a0) {
  20011. var args = arguments;
  20012. if (args.length == 0) {
  20013. return this.translate$0();
  20014. }
  20015. return this.translate$1(a0);
  20016. },
  20017. /** @expose */
  20018. scale : function(a0) {
  20019. var args = arguments;
  20020. if (args.length == 0) {
  20021. return this.scale$0();
  20022. }
  20023. return this.scale$1(a0);
  20024. },
  20025. /** @expose */
  20026. scaleExtent : function(a0) {
  20027. var args = arguments;
  20028. if (args.length == 0) {
  20029. return this.scaleExtent$0();
  20030. }
  20031. return this.scaleExtent$1(a0);
  20032. },
  20033. /** @expose */
  20034. center : function(a0) {
  20035. var args = arguments;
  20036. if (args.length == 0) {
  20037. return this.center$0();
  20038. }
  20039. return this.center$1(a0);
  20040. },
  20041. /** @expose */
  20042. duration : function(a0) {
  20043. var args = arguments;
  20044. if (args.length == 0) {
  20045. return this.duration$0();
  20046. }
  20047. return this.duration$1(a0);
  20048. },
  20049. /** @expose */
  20050. size : function(a0) {
  20051. var args = arguments;
  20052. if (args.length == 0) {
  20053. return this.size$0();
  20054. }
  20055. return this.size$1(a0);
  20056. },
  20057. /** @expose */
  20058. x : function(a0) {
  20059. var args = arguments;
  20060. if (args.length == 0) {
  20061. return this.x$0();
  20062. }
  20063. return this.x$1(a0);
  20064. },
  20065. /** @expose */
  20066. y : function(a0) {
  20067. var args = arguments;
  20068. if (args.length == 0) {
  20069. return this.y$0();
  20070. }
  20071. return this.y$1(a0);
  20072. },
  20073. /** @expose */
  20074. on : function(a0, a1) {
  20075. var args = arguments;
  20076. if (args.length == 1) {
  20077. return this.on$0(a0);
  20078. }
  20079. return this.on$1(a0, a1);
  20080. }
  20081. });
  20082. com_ibm_rave_core_behavior_Zoom.View = function(x, y, k) {
  20083. this.x = x;
  20084. this.y = y;
  20085. this.k = k;
  20086. };
  20087. /**
  20088. * The event object fired for zoom events: "zoomstart", "zoom", "zoomend"
  20089. */
  20090. com_ibm_rave_core_behavior_Zoom.EventObject = rave_externs["EventObject"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_event_BaseEvent, {
  20091. /**
  20092. * A two-element array representing the current translation vector.
  20093. */
  20094. /** @expose */
  20095. translate : null,
  20096. /**
  20097. * The current zoom scale.
  20098. */
  20099. /** @expose */
  20100. scale : 0,
  20101. constructor : function(type, scale, translate) {
  20102. this.scale = scale;
  20103. this.translate = translate;
  20104. }
  20105. });
  20106. //com_ibm_rave_core_behavior_Zoom.CHART_PROP = "__chart__";
  20107. //com_ibm_rave_core_behavior_Zoom.zoomWheel = "wheel";
  20108. //com_ibm_rave_core_behavior_Zoom.mousedown = "mousedown.zoom";
  20109. //com_ibm_rave_core_behavior_Zoom.mouseup = "mouseup.zoom";
  20110. //com_ibm_rave_core_behavior_Zoom.mousemove = "mousemove.zoom";
  20111. //com_ibm_rave_core_behavior_Zoom.touchstart = "touchstart.zoom";
  20112. //com_ibm_rave_core_behavior_Zoom.dblclick = "dblclick.zoom";
  20113. com_ibm_rave_core_behavior_Zoom.zoomInfinity = [0, Infinity];
  20114. com_ibm_rave_core_behavior_Zoom.zoomDelta = function() {
  20115. var event = rave.event;
  20116. return -event.deltaY * (event.deltaMode != 0 ? 120 : 1);
  20117. };
  20118. // $source: com/ibm/rave/core/interpolate/ZoomInterpolation
  20119. /************************************************************************
  20120. ** IBM Confidential
  20121. **
  20122. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  20123. **
  20124. ** (C) Copyright IBM Corp. 2015
  20125. **
  20126. ** The source code for this program is not published or otherwise divested of its trade secrets,
  20127. ** irrespective of what has been deposited with the U.S. Copyright Office.
  20128. ************************************************************************/
  20129. // GENERATED
  20130. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  20131. //@import com/ibm/rave/core/internal/math/Trigonometry (runtime) // sinh, cosh, tanh
  20132. var com_ibm_rave_core_interpolate_ZoomInterpolation = rave_externs["ZoomInterpolation"] = com_ibm_rave_core_nativeImpl_Declare({
  20133. _$functionClassMethod : function() {
  20134. var _$self = /**
  20135. * Returns a smooth interpolator between the two views a and b of a two-dimensional plane, based on “Smooth and efficient zooming and panning” by Jarke J. van Wijk and Wim A.A. Nuij. Each view is defined as an array of three numbers: cx, cy and width. The first two coordinates cx, cy represent the center of the viewport; the last coordinate width represents the size of the viewport. The returned interpolator also has a duration property which encodes the recommended transition duration in milliseconds. This duration is based on the path length of the curved trajectory through x,y space. If you want to a slower or faster transition, multiply this by an arbitrary scale factor (V as described in the original paper).
  20136. * @param (Array) p0 the first view
  20137. * @param (Array) p1 the second view
  20138. * @return (com.ibm.rave.core.interpolate.ZoomInterpolation.ZoomInterpolator) a zoom interpolator
  20139. */
  20140. function(p0, p1) {
  20141. var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + 4.0 * d2) / (2 * w0 * 2.0 * d1), b1 = (w1 * w1 - w0 * w0 - 4.0 * d2) / (2 * w1 * 2.0 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1), dr = r1 - r0, S = ((dr) ? dr : Math.log(w1 / w0)) / com_ibm_rave_core_interpolate_ZoomInterpolation.p;
  20142. var interpolate = function(t) {
  20143. var point;
  20144. var s = t * S;
  20145. if ((dr)) {
  20146. var coshr0 = com_ibm_rave_core_internal_math_Trigonometry.cosh(r0), u = w0 / (2.0 * d1) * (coshr0 * com_ibm_rave_core_internal_math_Trigonometry.tanh(com_ibm_rave_core_interpolate_ZoomInterpolation.p * s + r0) - com_ibm_rave_core_internal_math_Trigonometry.sinh(r0));
  20147. point = [ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / com_ibm_rave_core_internal_math_Trigonometry.cosh(com_ibm_rave_core_interpolate_ZoomInterpolation.p * s + r0)];
  20148. } else {
  20149. point = [ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(com_ibm_rave_core_interpolate_ZoomInterpolation.p * s)];
  20150. }
  20151. return point;
  20152. };
  20153. interpolate.duration = S * 1000;
  20154. return interpolate;
  20155. };
  20156. return _$self;
  20157. }
  20158. });
  20159. /** @expose */
  20160. com_ibm_rave_core_interpolate_ZoomInterpolation.INSTANCE = new com_ibm_rave_core_interpolate_ZoomInterpolation();
  20161. com_ibm_rave_core_interpolate_ZoomInterpolation.p = Math["SQRT2"], com_ibm_rave_core_interpolate_ZoomInterpolation.p2 = 2, com_ibm_rave_core_interpolate_ZoomInterpolation.p4 = 4;
  20162. // $source: com/ibm/rave/core/behavior/SelectionEventHandler
  20163. /************************************************************************
  20164. ** IBM Confidential
  20165. **
  20166. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  20167. **
  20168. ** (C) Copyright IBM Corp. 2015
  20169. **
  20170. ** The source code for this program is not published or otherwise divested of its trade secrets,
  20171. ** irrespective of what has been deposited with the U.S. Copyright Office.
  20172. ************************************************************************/
  20173. // GENERATED
  20174. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  20175. //@import com/ibm/rave/core/internal/nativeImpl/event/Event (runtime) // new
  20176. /**
  20177. * Tracks and fires selection events.
  20178. */
  20179. var com_ibm_rave_core_behavior_SelectionEventHandler = rave_externs["SelectionEventHandler"] = com_ibm_rave_core_nativeImpl_Declare({
  20180. //selectedNodes : null,
  20181. constructor : function() {
  20182. this.selectedNodes = [];
  20183. },
  20184. /**
  20185. * Get the list of selected nodes.
  20186. * @return (Array) the list of selected nodes
  20187. */
  20188. selected$0 : function() {
  20189. return this.selectedNodes;
  20190. },
  20191. selected$1 : function(node) {
  20192. this.selectedNodes.push(node);
  20193. },
  20194. selected$2 : function(nodes) {
  20195. for (var __i_enFor0 = 0, __exp_enFor0 = nodes, __len_enFor0 = __exp_enFor0.length;
  20196. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  20197. var node = __exp_enFor0[__i_enFor0];
  20198. this.selectedNodes.push(node);
  20199. }
  20200. },
  20201. /**
  20202. * Get the last selected node.
  20203. * @return (com.ibm.rave.core.scene.SceneNode) the last selected node, or <code>null</code> if no selection
  20204. */
  20205. /** @expose */
  20206. lastSelected : function() {
  20207. return this.selectedNodes.length > 0 ? this.selectedNodes[this.selectedNodes.length - 1] : null;
  20208. },
  20209. /** @expose */
  20210. isSelected : function(node) {
  20211. return this.selectedNodes.indexOf(node) != -1;
  20212. },
  20213. fireSelected$0 : function(node) {
  20214. this.fireSelected$1(node, true);
  20215. },
  20216. fireSelected$1 : function(node, unselectPrevious) {
  20217. var events = [];
  20218. var idx = -1;
  20219. if (unselectPrevious) {
  20220. var selectednode;
  20221. while (this.selectedNodes.length > 0 && (selectednode = this.selectedNodes.shift())) {
  20222. if (selectednode == node) {
  20223. idx = 0;
  20224. } else {
  20225. events.push(com_ibm_rave_core_behavior_SelectionEventHandler.createEventContainer("raveunselected", selectednode, false, true));
  20226. }
  20227. }
  20228. } else {
  20229. idx = this.selectedNodes.indexOf(node);
  20230. if (idx >= 0) {
  20231. this.selectedNodes.splice(idx, 1);
  20232. }
  20233. }
  20234. this.selectedNodes.push(node);
  20235. events.push(com_ibm_rave_core_behavior_SelectionEventHandler.createEventContainer("raveselected", node, true, idx >= 0));
  20236. this.fireEvents(events);
  20237. },
  20238. /** @expose */
  20239. fireUnselectAll : function() {
  20240. var events = [];
  20241. for (var i = 0; i < this.selectedNodes.length; ++i) {
  20242. events.push(com_ibm_rave_core_behavior_SelectionEventHandler.createEventContainer("raveunselected", this.selectedNodes[i], false, true));
  20243. }
  20244. this.selectedNodes = [];
  20245. this.fireEvents(events);
  20246. },
  20247. fireSelected$2 : function(nodes) {
  20248. this.fireSelected$3(nodes, true);
  20249. },
  20250. fireSelected$3 : function(nodes, unselectPrevious) {
  20251. var events = [];
  20252. if (unselectPrevious) {
  20253. var selectedEvents = [];
  20254. for (var i = 0; i < nodes.length; ++i) {
  20255. var node = nodes[i];
  20256. selectedEvents.push(com_ibm_rave_core_behavior_SelectionEventHandler.createEventContainer("raveselected", node, true, this.selectedNodes.indexOf(node) >= 0));
  20257. }
  20258. for (var i = 0; i < this.selectedNodes.length; ++i) {
  20259. var selectednode = this.selectedNodes[i];
  20260. if (nodes.indexOf(selectednode) >= 0) {
  20261. this.selectedNodes.splice(i--, 1);
  20262. events.push(com_ibm_rave_core_behavior_SelectionEventHandler.createEventContainer("raveunselected", selectednode, false, true));
  20263. break;
  20264. }
  20265. }
  20266. events = events.concat(selectedEvents);
  20267. } else {
  20268. for (var i = 0; i < nodes.length; ++i) {
  20269. var node = nodes[i];
  20270. var idx = this.selectedNodes.indexOf(node);
  20271. events.push(com_ibm_rave_core_behavior_SelectionEventHandler.createEventContainer("raveselected", node, true, idx >= 0));
  20272. this.selectedNodes.splice(idx, 1);
  20273. }
  20274. this.selectedNodes = this.selectedNodes.concat(nodes);
  20275. }
  20276. this.fireEvents(events);
  20277. },
  20278. fireUnselected$0 : function(node) {
  20279. var idx = this.selectedNodes.indexOf(node);
  20280. if (idx >= 0) {
  20281. this.selectedNodes.splice(idx, 1);
  20282. node.dispatchEvent(com_ibm_rave_core_behavior_SelectionEventHandler.createEvent("raveunselected", false, true));
  20283. }
  20284. },
  20285. fireUnselected$1 : function(nodes) {
  20286. var events = [];
  20287. for (var i = 0; i < this.selectedNodes.length; ++i) {
  20288. for (var j = 0; j < nodes.length; ++j) {
  20289. var selectednode = this.selectedNodes[i];
  20290. if (nodes[j] == selectednode) {
  20291. this.selectedNodes.splice(i--, 1);
  20292. events.push(com_ibm_rave_core_behavior_SelectionEventHandler.createEventContainer("raveunselected", selectednode, false, true));
  20293. break;
  20294. }
  20295. }
  20296. }
  20297. this.fireEvents(events);
  20298. },
  20299. fireEvents : function(events) {
  20300. var clone = this.selectedNodes.slice();
  20301. for (var __i_enFor0 = 0, __exp_enFor0 = events, __len_enFor0 = __exp_enFor0.length;
  20302. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  20303. var e = __exp_enFor0[__i_enFor0];
  20304. e.event.selection = clone;
  20305. e.target.dispatchEvent(e.event);
  20306. }
  20307. },
  20308. /** @expose */
  20309. selected : function(a0) {
  20310. var args = arguments;
  20311. if (args.length == 0) {
  20312. return this.selected$0();
  20313. }
  20314. if (args.length == 1 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]")) {
  20315. return this.selected$2(a0);
  20316. }
  20317. return this.selected$1(a0);
  20318. },
  20319. /** @expose */
  20320. fireSelected : function(a0, a1) {
  20321. var args = arguments;
  20322. if (args.length == 1 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]")) {
  20323. return this.fireSelected$2(a0);
  20324. }
  20325. if (args.length == 1) {
  20326. return this.fireSelected$0(a0);
  20327. }
  20328. if (args.length == 2 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]") && (a1 == null || typeof a1 === "boolean")) {
  20329. return this.fireSelected$3(a0, a1);
  20330. }
  20331. return this.fireSelected$1(a0, a1);
  20332. },
  20333. /** @expose */
  20334. fireUnselected : function(a0) {
  20335. var args = arguments;
  20336. if (args.length == 1 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]")) {
  20337. return this.fireUnselected$1(a0);
  20338. }
  20339. return this.fireUnselected$0(a0);
  20340. }
  20341. });
  20342. com_ibm_rave_core_behavior_SelectionEventHandler.createEvent = function(type, selected, previouslySelected) {
  20343. var event = new com_ibm_rave_core_internal_nativeImpl_event_Event(type, true, false);
  20344. event.selected = selected;
  20345. event.previouslySelected = previouslySelected;
  20346. return event;
  20347. };
  20348. com_ibm_rave_core_behavior_SelectionEventHandler.createEventContainer = function(type, target, selected, previouslySelected) {
  20349. return new com_ibm_rave_core_behavior_SelectionEventHandler.EventContainer(com_ibm_rave_core_behavior_SelectionEventHandler.createEvent(type, selected, previouslySelected), target);
  20350. };
  20351. com_ibm_rave_core_behavior_SelectionEventHandler.EventContainer = function(event, target) {
  20352. this.event = event;
  20353. this.target = target;
  20354. };
  20355. /** @expose */
  20356. com_ibm_rave_core_behavior_SelectionEventHandler.SELECTED_EVENT_TYPE = "raveselected";
  20357. /** @expose */
  20358. com_ibm_rave_core_behavior_SelectionEventHandler.UNSELECTED_EVENT_TYPE = "raveunselected";
  20359. // $source: com/ibm/rave/core/behavior/FocusEventHandler
  20360. /************************************************************************
  20361. ** IBM Confidential
  20362. **
  20363. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  20364. **
  20365. ** (C) Copyright IBM Corp. 2015
  20366. **
  20367. ** The source code for this program is not published or otherwise divested of its trade secrets,
  20368. ** irrespective of what has been deposited with the U.S. Copyright Office.
  20369. ************************************************************************/
  20370. // GENERATED
  20371. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  20372. //@import com/ibm/rave/core/internal/nativeImpl/event/Event (static) // new
  20373. /**
  20374. * Tracks and fires focus and blur events.
  20375. */
  20376. var com_ibm_rave_core_behavior_FocusEventHandler = rave_externs["FocusEventHandler"] = com_ibm_rave_core_nativeImpl_Declare({
  20377. //focusedNode : null,
  20378. /**
  20379. * Get the focused node.
  20380. * @return (com.ibm.rave.core.scene.SceneNode) the focused node
  20381. */
  20382. focused$0 : function() {
  20383. return this.focusedNode;
  20384. },
  20385. /**
  20386. * Set the focused node.
  20387. * @param (com.ibm.rave.core.scene.SceneNode) node The node that has focus.
  20388. */
  20389. focused$1 : function(node) {
  20390. this.focusedNode = node;
  20391. },
  20392. /**
  20393. * Check if the node is the focused one.
  20394. * @param (com.ibm.rave.core.scene.SceneNode) node The SceneNode.
  20395. * @return (boolean) true if it is the focused node, false otherwise.
  20396. */
  20397. /** @expose */
  20398. isFocused : function(node) {
  20399. return this.focusedNode ? this.focusedNode == node : false;
  20400. },
  20401. /**
  20402. * Fire a focus event on the provided node. This will be preceded by a blur event on the previously focused node, if any.
  20403. * @param (com.ibm.rave.core.scene.SceneNode) node The node to receive focus.
  20404. */
  20405. /** @expose */
  20406. fireFocus : function(node) {
  20407. if (!(this.isFocused(node))) {
  20408. if (this.focusedNode) {
  20409. this.focusedNode.dispatchEvent(com_ibm_rave_core_behavior_FocusEventHandler.createEvent("raveblur"));
  20410. }
  20411. this.focusedNode = node;
  20412. node.dispatchEvent(com_ibm_rave_core_behavior_FocusEventHandler.createEvent("ravefocus"));
  20413. }
  20414. },
  20415. /**
  20416. * Fire a blur event on the provided node.
  20417. * @param (com.ibm.rave.core.scene.SceneNode) node The node to be blurred.
  20418. */
  20419. /** @expose */
  20420. fireBlur : function(node) {
  20421. if (this.isFocused(node)) {
  20422. this.focusedNode = null;
  20423. node.dispatchEvent(com_ibm_rave_core_behavior_FocusEventHandler.createEvent("raveblur"));
  20424. }
  20425. },
  20426. /** @expose */
  20427. focused : function(a0) {
  20428. var args = arguments;
  20429. if (args.length == 0) {
  20430. return this.focused$0();
  20431. }
  20432. return this.focused$1(a0);
  20433. }
  20434. });
  20435. com_ibm_rave_core_behavior_FocusEventHandler.createEvent = function(type) {
  20436. return new com_ibm_rave_core_internal_nativeImpl_event_Event(type, true, false);
  20437. };
  20438. /** @expose */
  20439. com_ibm_rave_core_behavior_FocusEventHandler.FOCUS_EVENT_TYPE = "ravefocus";
  20440. /** @expose */
  20441. com_ibm_rave_core_behavior_FocusEventHandler.BLUR_EVENT_TYPE = "raveblur";
  20442. // $source: com/ibm/rave/core/layout/BundleLayout
  20443. /************************************************************************
  20444. ** IBM Confidential
  20445. **
  20446. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  20447. **
  20448. ** (C) Copyright IBM Corp. 2015
  20449. **
  20450. ** The source code for this program is not published or otherwise divested of its trade secrets,
  20451. ** irrespective of what has been deposited with the U.S. Copyright Office.
  20452. ************************************************************************/
  20453. // GENERATED
  20454. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  20455. /**
  20456. * Bundle layout. Currently, the bundle layout is stateless and thus only has a default configuration. The returned layout object is both an object and a function. That is: you can call the layout like any other function, and the layout has additional methods that change its behavior.
  20457. */
  20458. var com_ibm_rave_core_layout_BundleLayout = rave_externs["BundleLayout"] = com_ibm_rave_core_nativeImpl_Declare({
  20459. _$functionClassMethod : function() {
  20460. var _$self = /**
  20461. * Evaluates the bundle layout on the specified array of links, returning the computed path from the source to the target, through the least common ancestor. Each input link must have two attributes: source - the source node. target - the target node. Furthermore, each node must have one attribute: parent - the parent node.
  20462. * @param (Array) links the links
  20463. * @return (Array) The return value of the layout is an array of paths, where each path is represented as an array of nodes. Thus, the bundle layout does not compute the basis splines directly; instead, it returns an array of nodes which implicitly represent the control points of the spline. You can use this array in conjunction with Rave.svg.line or Rave.svg.line.radial to generate the splines themselves.
  20464. */
  20465. function(links) {
  20466. var paths = [];
  20467. var i = -1;
  20468. var n = links.length;
  20469. while (++i < n) {
  20470. paths.push(_$self.layout_bundlePath(links[i]));
  20471. }
  20472. return paths;
  20473. };
  20474. return _$self;
  20475. },
  20476. layout_bundleAncestors : function(node) {
  20477. var ancestors = [];
  20478. var parent = node["parent"];
  20479. while (parent) {
  20480. ancestors.push(node);
  20481. node = parent;
  20482. parent = parent["parent"];
  20483. }
  20484. ancestors.push(node);
  20485. return ancestors;
  20486. },
  20487. layout_bundleLeastCommonAncestor : function(a, b) {
  20488. if (a == b) {
  20489. return a;
  20490. }
  20491. var aNodes = this.layout_bundleAncestors(a);
  20492. var bNodes = this.layout_bundleAncestors(b);
  20493. var aNode = aNodes.pop();
  20494. var bNode = bNodes.pop();
  20495. var sharedNode;
  20496. while (aNode == bNode) {
  20497. sharedNode = aNode;
  20498. aNode = aNodes.pop();
  20499. bNode = bNodes.pop();
  20500. }
  20501. return sharedNode;
  20502. },
  20503. layout_bundlePath : function(link) {
  20504. var start = link["source"];
  20505. var end = link["target"];
  20506. var lca = this.layout_bundleLeastCommonAncestor(start, end);
  20507. var points = [start];
  20508. while (start != lca) {
  20509. start = start["parent"];
  20510. points.push(start);
  20511. }
  20512. var k = points.length;
  20513. while (end != lca) {
  20514. points.splice(k, 0, end);
  20515. end = end["parent"];
  20516. }
  20517. return points;
  20518. }
  20519. });
  20520. // $source: com/ibm/rave/core/layout/hierarchy/HierarchyBase
  20521. /************************************************************************
  20522. ** IBM Confidential
  20523. **
  20524. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  20525. **
  20526. ** (C) Copyright IBM Corp. 2015
  20527. **
  20528. ** The source code for this program is not published or otherwise divested of its trade secrets,
  20529. ** irrespective of what has been deposited with the U.S. Copyright Office.
  20530. ************************************************************************/
  20531. // GENERATED
  20532. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare anonymous, declare
  20533. //@import com/ibm/rave/core/layout/hierarchy/HierarchyUtil (runtime) // visitAfter, links
  20534. /**
  20535. * Creates a new hierarchy layout with the default settings: the default sort order is by descending value; the default value accessor assumes each input data is an object with a numeric value attribute; and the default children accessor assumes each input data is an object with a children array.
  20536. * @param < (Object) T > the type of HierarchyBase
  20537. */
  20538. var com_ibm_rave_core_layout_hierarchy_HierarchyBase = rave_externs["HierarchyBase"] = com_ibm_rave_core_nativeImpl_Declare({
  20539. /**
  20540. * Gets the children of a specified node
  20541. */
  20542. //defaultChildrenFunction : null,
  20543. /**
  20544. * Gets the value of a specified node
  20545. */
  20546. //defaultNodeValueFunction : null,
  20547. /**
  20548. * Sorts two nodes based on the value of the node
  20549. */
  20550. //defaultSortFunction : null,
  20551. /** @expose */
  20552. nodeValueFunction : null,
  20553. /** @expose */
  20554. childrenFunction : null,
  20555. /** @expose */
  20556. sortFunction : null,
  20557. _$functionClassMethod : function() {
  20558. var _$self = /**
  20559. * Runs the hierarchy layout, returning the array of nodes associated with the specified root node. The input argument to the layout is the root node of the hierarchy, and the output return value is an array representing the computed positions of all nodes. Several attributes are populated on each node: parent - the parent node, or null for the root. children - the array of child nodes, or null for leaf nodes. value - the node value, as returned by the value accessor. depth - the depth of the node, starting at 0 for the root. In addition, most hierarchy layouts also compute x and y positions for nodes; see the implementing class for details.
  20560. * @param (Object) stackNode the root node to be processed
  20561. * @param (int) i the index (currently unused)
  20562. * @return (Array) all nodes to be drawn
  20563. */
  20564. function(stackNode, i) {
  20565. return _$self.doCreate(stackNode, i);
  20566. };
  20567. return _$self;
  20568. },
  20569. constructor : function() {
  20570. this.defaultChildrenFunction = /**
  20571. * Gets the children of the specified node
  20572. * @param (Object) node node to retrieve the children from
  20573. * @param (int) depth the depth of the node, starting at 0 for the root
  20574. * @return (Array) an array containing all the children
  20575. */
  20576. function(node, depth) {
  20577. return node["children"];
  20578. };
  20579. this.defaultNodeValueFunction = /**
  20580. * Gets the value of a specified node
  20581. * @param (Object) node node to retrieve the value from
  20582. * @param (int) depth the depth of the node, starting at 0 for the root
  20583. * @return (Object) the value of the node
  20584. */
  20585. function(node, depth) {
  20586. return node["value"];
  20587. };
  20588. this.defaultSortFunction = /**
  20589. * Sorts two nodes based on the value of the node
  20590. * @param (Object) a the first node to compare against
  20591. * @param (Object) b the second node to compare against
  20592. * @return (int) indicates whether node b is greater than, equal to or less than node a
  20593. */
  20594. function(a, b) {
  20595. return ~~(b["value"] - a["value"]);
  20596. };
  20597. this.nodeValueFunction = this.defaultNodeValueFunction;
  20598. this.childrenFunction = this.defaultChildrenFunction;
  20599. this.sortFunction = this.defaultSortFunction;
  20600. },
  20601. /** @expose */
  20602. doCreate : function(stackNode, i) {
  20603. var stack = [];
  20604. var nodes = [];
  20605. stackNode["depth"] = 0;
  20606. stack.push(stackNode);
  20607. var root;
  20608. var child;
  20609. var childs;
  20610. var n;
  20611. while ((root = stack.pop())) {
  20612. nodes.push(root);
  20613. if ((childs = this.childrenFunction.call(this, root, root["depth"])) && (n = childs.length) > 0) {
  20614. while (--n >= 0) {
  20615. stack.push(child = childs[n]);
  20616. child["parent"] = root;
  20617. child["depth"] = root["depth"] + 1;
  20618. }
  20619. if (this.nodeValueFunction) {
  20620. root["value"] = 0.0;
  20621. }
  20622. root["children"] = childs;
  20623. } else {
  20624. if (this.nodeValueFunction) {
  20625. var valueVal = + (this.nodeValueFunction.call(this, root, root["depth"]));
  20626. if (valueVal != valueVal) {
  20627. valueVal = 0;
  20628. }
  20629. root["value"] = valueVal;
  20630. }
  20631. root["children"] = undefined;
  20632. }
  20633. }
  20634. if (this.sortFunction || this.nodeValueFunction) {
  20635. var self = this;
  20636. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitAfter(stackNode, new (com_ibm_rave_core_nativeImpl_Declare({
  20637. visit : function(node) {
  20638. var childs;
  20639. var parent;
  20640. if (self.sortFunction && (childs = node["children"])) {
  20641. childs.sort(self.sortFunction);
  20642. }
  20643. if (self.nodeValueFunction && (parent = node["parent"])) {
  20644. parent["value"] += node["value"];
  20645. }
  20646. }
  20647. }))());
  20648. }
  20649. return nodes;
  20650. },
  20651. /**
  20652. * If comparator is specified, sets the sort order of sibling nodes for the layout using the specified comparator function
  20653. * @param (com.ibm.rave.core.util.Comparator) func the new default sort accessor to be used in place of the default
  20654. * @return (com.ibm.rave.core.layout.hierarchy.HierarchyBase) the current instance of HierarchyBase
  20655. */
  20656. sort$0 : function(func) {
  20657. this.sortFunction = func;
  20658. return this;
  20659. },
  20660. /**
  20661. * If comparator is not specified, returns the current group sort order, which defaults to descending order by the associated input data's numeric value attribute The comparator function is invoked for pairs of nodes, being passed the input data for each node. A null comparator disables sorting and uses tree traversal order. Comparator functions may also be implemented using rave.ascending or rave.descending
  20662. * @return (com.ibm.rave.core.util.Comparator) the default sort accessor
  20663. */
  20664. sort$1 : function() {
  20665. return this.sortFunction;
  20666. },
  20667. /**
  20668. * If accessor is specified, sets the specified children accessor function
  20669. * @param (com.ibm.rave.core.layout.hierarchy.HierarchyBase.GetNodeChildren) func the children accessor function to be used in place of the default
  20670. * @return (com.ibm.rave.core.layout.hierarchy.HierarchyBase) the current instance of HierarchyBase
  20671. */
  20672. children$0 : function(func) {
  20673. this.childrenFunction = func;
  20674. return this;
  20675. },
  20676. /**
  20677. * If accessor is not specified, returns the current children accessor function, which by default assumes that the input data is an object with a children array
  20678. * @return (com.ibm.rave.core.layout.hierarchy.HierarchyBase.GetNodeChildren) the default children accessor function
  20679. */
  20680. children$1 : function() {
  20681. return this.childrenFunction;
  20682. },
  20683. /**
  20684. * If value is specified, sets the value accessor to the specified function
  20685. * @param (com.ibm.rave.core.layout.hierarchy.HierarchyBase.GetNodeValue) func the value accessor to be used in place of the default value accessor
  20686. * @return (com.ibm.rave.core.layout.hierarchy.HierarchyBase) the current instance of HierarchyBase
  20687. */
  20688. value$0 : function(func) {
  20689. this.nodeValueFunction = func;
  20690. return this;
  20691. },
  20692. /**
  20693. * If value is not specified, returns the current value accessor. The default accessor assumes that the input data is an object with a numeric value attribute The value accessor is invoked for each input data element, and must return a number representing the numeric value of the node. For area-proportional layouts such as treemaps, this value is used to set the area of each node proportionally to the value; for other hierarchical layouts, the value has no effect on the layout.
  20694. * @return (com.ibm.rave.core.layout.hierarchy.HierarchyBase.GetNodeValue) the default value accessor function
  20695. */
  20696. value$1 : function() {
  20697. return this.nodeValueFunction;
  20698. },
  20699. /**
  20700. * Given the specified array of nodes returns an array of objects representing the links from parent to child for each node. Leaf nodes will not have any links. Each link is an object with two attributes: source - the parent node (as described above). target - the child node. This method is useful for retrieving a set of link descriptions suitable for display, often in conjunction with the diagonal shape generator
  20701. * @param (Array) nodes an array of nodes for which links should be provided
  20702. * @return (Array) an array of links from parent to children for each node
  20703. */
  20704. /** @expose */
  20705. links : function(nodes) {
  20706. return com_ibm_rave_core_layout_hierarchy_HierarchyUtil.links(nodes);
  20707. },
  20708. /** @expose */
  20709. sort : function(a0) {
  20710. var args = arguments;
  20711. if (args.length == 0) {
  20712. return this.sort$1();
  20713. }
  20714. return this.sort$0(a0);
  20715. },
  20716. /** @expose */
  20717. children : function(a0) {
  20718. var args = arguments;
  20719. if (args.length == 0) {
  20720. return this.children$1();
  20721. }
  20722. return this.children$0(a0);
  20723. },
  20724. /** @expose */
  20725. value : function(a0) {
  20726. var args = arguments;
  20727. if (args.length == 0) {
  20728. return this.value$1();
  20729. }
  20730. return this.value$0(a0);
  20731. }
  20732. });
  20733. // $source: com/ibm/rave/core/layout/AbstractPackLayout
  20734. /************************************************************************
  20735. ** IBM Confidential
  20736. **
  20737. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  20738. **
  20739. ** (C) Copyright IBM Corp. 2015
  20740. **
  20741. ** The source code for this program is not published or otherwise divested of its trade secrets,
  20742. ** irrespective of what has been deposited with the U.S. Copyright Office.
  20743. ************************************************************************/
  20744. // GENERATED
  20745. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  20746. //@import com/ibm/rave/core/layout/hierarchy/HierarchyBase (loadtime) // superclass
  20747. /**
  20748. * AbstractPackLayout - generalization for layouts, which pack circle shaped nodes into an area specified by size
  20749. */
  20750. var com_ibm_rave_core_layout_AbstractPackLayout = rave_externs["AbstractPackLayout"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_layout_hierarchy_HierarchyBase, {
  20751. /**
  20752. * area extent value (width and height)
  20753. */
  20754. /** @expose */
  20755. sizeVal : null,
  20756. /**
  20757. * radius value
  20758. */
  20759. /** @expose */
  20760. radiusVal : null,
  20761. /**
  20762. * radius function value
  20763. */
  20764. /** @expose */
  20765. radiusFn : null,
  20766. /**
  20767. * padding value
  20768. */
  20769. /** @expose */
  20770. paddingVal : 0,
  20771. constructor : function() {
  20772. this.sizeVal = [1, 1];
  20773. },
  20774. /**
  20775. * Returns the current size, which defaults to 1×1
  20776. * @return (double[]) return the current size
  20777. */
  20778. size$0 : function() {
  20779. return this.sizeVal;
  20780. },
  20781. /**
  20782. * Sets the available layout size to the specified two-element array of numbers representing x and y.
  20783. * @param (double[]) newSize the size of the layout
  20784. * @return (com.ibm.rave.core.layout.AbstractPackLayout) this Layout
  20785. */
  20786. size$1 : function(newSize) {
  20787. this.sizeVal = newSize;
  20788. return this;
  20789. },
  20790. /**
  20791. * The current padding, which defaults to zero.
  20792. * @return (double) current padding
  20793. */
  20794. padding$0 : function() {
  20795. return this.paddingVal;
  20796. },
  20797. /**
  20798. * Sets the approximate padding between adjacent circles, in pixels.
  20799. * @param (Object) newVal padding value
  20800. * @return (com.ibm.rave.core.layout.AbstractPackLayout) this layout
  20801. */
  20802. padding$1 : function(newVal) {
  20803. this.paddingVal = + (newVal);
  20804. return this;
  20805. },
  20806. /**
  20807. * Get the current radius function or value, which defaults to null.
  20808. * @return (Object) radius, can be a vlaue or a function
  20809. */
  20810. radius$0 : function() {
  20811. if (!this.radiusFn) {
  20812. return this.radiusVal;
  20813. }
  20814. return this.radiusFn;
  20815. },
  20816. /**
  20817. * Sets the radius function for computing the radius of each node. If radius is null, as it is by default, the radius is determined automatically from the node value, scaled to fit the layout size. The radius can also be specified as a constant number for uniform circle size.
  20818. * @param (Object) newVal the new radius value or function
  20819. * @return (com.ibm.rave.core.layout.AbstractPackLayout) this layout
  20820. */
  20821. radius$1 : function(newVal) {
  20822. if (typeof newVal === "function") {
  20823. this.radiusFn = newVal;
  20824. } else {
  20825. this.radiusFn = null;
  20826. this.radiusVal = newVal;
  20827. }
  20828. return this;
  20829. },
  20830. /** @expose */
  20831. size : function(a0) {
  20832. var args = arguments;
  20833. if (args.length == 0) {
  20834. return this.size$0();
  20835. }
  20836. return this.size$1(a0);
  20837. },
  20838. /** @expose */
  20839. padding : function(a0) {
  20840. var args = arguments;
  20841. if (args.length == 0) {
  20842. return this.padding$0();
  20843. }
  20844. return this.padding$1(a0);
  20845. },
  20846. /** @expose */
  20847. radius : function(a0) {
  20848. var args = arguments;
  20849. if (args.length == 0) {
  20850. return this.radius$0();
  20851. }
  20852. return this.radius$1(a0);
  20853. }
  20854. });
  20855. /**
  20856. * A default function for radius
  20857. */
  20858. com_ibm_rave_core_layout_AbstractPackLayout.ConstantSingleValueFunction = rave_externs["ConstantSingleValueFunction"] = com_ibm_rave_core_nativeImpl_Declare({
  20859. realdata : 0,
  20860. _$functionClassMethod : function() {
  20861. var _$self = function(data) {
  20862. return _$self.realdata;
  20863. };
  20864. return _$self;
  20865. },
  20866. /** @expose */
  20867. constructor : function(constantData) {
  20868. this.realdata = + (constantData);
  20869. }
  20870. });
  20871. // $source: com/ibm/rave/core/layout/hierarchy/HierarchyUtil
  20872. /************************************************************************
  20873. ** IBM Confidential
  20874. **
  20875. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  20876. **
  20877. ** (C) Copyright IBM Corp. 2015
  20878. **
  20879. ** The source code for this program is not published or otherwise divested of its trade secrets,
  20880. ** irrespective of what has been deposited with the U.S. Copyright Office.
  20881. ************************************************************************/
  20882. // GENERATED
  20883. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare anonymous, declare
  20884. /**
  20885. * A utility to help with hierarchical data traversal
  20886. */
  20887. var com_ibm_rave_core_layout_hierarchy_HierarchyUtil = rave_externs["HierarchyUtil"] = {
  20888. };
  20889. /**
  20890. * Re-evaluates the `value` property for the specified hierarchy.
  20891. * @param (Object) root the root node of type T
  20892. * @param (com.ibm.rave.core.layout.hierarchy.HierarchyBase) hierarchy hierarchical layout instance, which holds the value function
  20893. * @return (Object) the root node that was revalued
  20894. */
  20895. /** @expose */
  20896. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.revalue = function(root, hierarchy) {
  20897. if (hierarchy.value()) {
  20898. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitBefore(root, new (com_ibm_rave_core_nativeImpl_Declare({
  20899. visit : function(node) {
  20900. if (node["children"]) {
  20901. node["value"] = 0.0;
  20902. }
  20903. }
  20904. }))());
  20905. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitAfter(root, new (com_ibm_rave_core_nativeImpl_Declare({
  20906. visit : function(node) {
  20907. var parent;
  20908. if (!node["children"]) {
  20909. node["value"] = + (hierarchy.value().call(hierarchy, node, node["depth"]));
  20910. }
  20911. if ((parent = node["parent"])) {
  20912. parent["value"] += node["value"];
  20913. }
  20914. }
  20915. }))());
  20916. }
  20917. return root;
  20918. };
  20919. /**
  20920. * Pre-order traversal.
  20921. * @param (Object) node root of the hierarchy
  20922. * @param (com.ibm.rave.core.layout.hierarchy.HierarchyUtil.Visitor) callback a traversal handler function
  20923. */
  20924. /** @expose */
  20925. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitBefore = function(node, callback) {
  20926. var nodes = [];
  20927. nodes.push(node);
  20928. while ((node = nodes.pop())) {
  20929. callback.visit(node);
  20930. var children;
  20931. var n = 0;
  20932. if ((children = node["children"]) && ((n = children.length) > 0)) {
  20933. while (--n >= 0) {
  20934. nodes.push(children[n]);
  20935. }
  20936. }
  20937. }
  20938. };
  20939. /**
  20940. * Post-order traversal.
  20941. * @param (Object) node root of the hierarchy
  20942. * @param (com.ibm.rave.core.layout.hierarchy.HierarchyUtil.Visitor) callback a traversal handler function
  20943. */
  20944. /** @expose */
  20945. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitAfter = function(node, callback) {
  20946. var nodes = [];
  20947. var nodes2 = [];
  20948. nodes.push(node);
  20949. while ((node = nodes.pop())) {
  20950. nodes2.push(node);
  20951. var children;
  20952. var n = 0;
  20953. if ((children = node["children"]) && ((n = children.length) > 0)) {
  20954. var i = -1;
  20955. while (++i < n) {
  20956. nodes.push(children[i]);
  20957. }
  20958. }
  20959. }
  20960. while ((node = nodes2.pop())) {
  20961. callback.visit(node);
  20962. }
  20963. };
  20964. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.links = function(nodes) {
  20965. var num_children;
  20966. var node;
  20967. var links = [];
  20968. var link;
  20969. var num_nodes = nodes.length;
  20970. for (var z = 0; z < num_nodes; ++z) {
  20971. node = nodes[z];
  20972. if (node && node["children"]) {
  20973. num_children = node["children"].length;
  20974. while (--num_children >= 0) {
  20975. link = {};
  20976. link["source"] = node;
  20977. link["target"] = node["children"][num_children];
  20978. links.push(link);
  20979. }
  20980. }
  20981. }
  20982. return links;
  20983. };
  20984. /**
  20985. * Visitor which will help with traversal
  20986. * @param < (Object) T > hierarchy node type
  20987. */
  20988. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.Visitor = rave_externs["Visitor"] = com_ibm_rave_core_nativeImpl_Declare.implement(
  20989. //visit : function(node) {}
  20990. );
  20991. // $source: com/ibm/rave/core/layout/PackLayout
  20992. /************************************************************************
  20993. ** IBM Confidential
  20994. **
  20995. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  20996. **
  20997. ** (C) Copyright IBM Corp. 2015
  20998. **
  20999. ** The source code for this program is not published or otherwise divested of its trade secrets,
  21000. ** irrespective of what has been deposited with the U.S. Copyright Office.
  21001. ************************************************************************/
  21002. // GENERATED
  21003. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare anonymous, declare
  21004. //@import com/ibm/rave/core/layout/AbstractPackLayout (loadtime) // new, superclass
  21005. //@import com/ibm/rave/core/layout/hierarchy/HierarchyBase (runtime)
  21006. //@import com/ibm/rave/core/layout/hierarchy/HierarchyUtil (static) // visitAfter
  21007. //@import com/ibm/rave/core/layout/XYMin_Max (runtime) // new
  21008. /**
  21009. * PackLayout
  21010. */
  21011. var com_ibm_rave_core_layout_PackLayout = rave_externs["PackLayout"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_layout_AbstractPackLayout, {
  21012. /**
  21013. * An alias to this layout instance
  21014. */
  21015. /** @expose */
  21016. nodes : null,
  21017. /**
  21018. * constructor
  21019. */
  21020. /** @expose */
  21021. constructor : function() {
  21022. this.nodes = this;
  21023. this.sort(com_ibm_rave_core_layout_PackLayout.PACK_SORT_FN);
  21024. },
  21025. /**
  21026. * Runs the pack layout, returning the array of nodes associated with the specified root node. The pack layout is part of D3's family of hierarchical layouts. These layouts follow the same basic structure: the input argument to the layout is the root node of the hierarchy, and the output return value is an array representing the computed positions of all nodes. Several attributes are populated on each node: parent - the parent node, or null for the root. children - the array of child nodes, or null for leaf nodes. value - the node value, as returned by the value accessor. depth - the depth of the node, starting at 0 for the root. x - the computed x-coordinate of the node position. y - the computed y-coordinate of the node position. r - the computed node radius.
  21027. * @param (Object) d the root node
  21028. * @param (int) i index
  21029. * @return (Array) Array or positioned nodes
  21030. */
  21031. doCreate$0 : function(d, i) {
  21032. var nodes = com_ibm_rave_core_layout_hierarchy_HierarchyBase.prototype.doCreate.call(this, d, i);
  21033. var root = nodes[0];
  21034. var w = this.sizeVal[0];
  21035. var h = this.sizeVal[1];
  21036. var localR;
  21037. if (!this.radiusFn && this.radiusVal == null) {
  21038. localR = com_ibm_rave_core_layout_PackLayout.SQRT_FN;
  21039. } else if (!this.radiusFn) {
  21040. localR = new com_ibm_rave_core_layout_AbstractPackLayout.ConstantSingleValueFunction(this.radiusVal);
  21041. } else {
  21042. localR = this.radiusFn;
  21043. }
  21044. root["x"] = root["y"] = 0;
  21045. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitAfter(root, new (com_ibm_rave_core_nativeImpl_Declare({
  21046. visit : function(node) {
  21047. node["r"] = + (localR(node["value"]));
  21048. }
  21049. }))());
  21050. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitAfter(root, com_ibm_rave_core_layout_PackLayout.layout_packSiblings);
  21051. if ((this.paddingVal)) {
  21052. var dr = this.paddingVal * (this.radiusFn || (this.radiusVal) ? 1 : Math.max(2 * root["r"] / w, 2 * root["r"] / h)) / 2;
  21053. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitAfter(root, new (com_ibm_rave_core_nativeImpl_Declare({
  21054. visit : function(node) {
  21055. node["r"] += dr;
  21056. }
  21057. }))());
  21058. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitAfter(root, com_ibm_rave_core_layout_PackLayout.layout_packSiblings);
  21059. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitAfter(root, new (com_ibm_rave_core_nativeImpl_Declare({
  21060. visit : function(node) {
  21061. node["r"] -= dr;
  21062. }
  21063. }))());
  21064. }
  21065. this.layout_packTransform(root, w / 2, h / 2, (this.radiusFn || (this.radiusVal)) ? 1 : 1 / Math.max(2 * root["r"] / w, 2 * root["r"] / h));
  21066. return nodes;
  21067. },
  21068. /** @expose */
  21069. layout_packTransform : function(node, x, y, k) {
  21070. var children = node["children"];
  21071. node["x"] = x += k * node["x"];
  21072. node["y"] = y += k * node["y"];
  21073. node["r"] *= k;
  21074. if (children) {
  21075. var i = -1, n = children.length;
  21076. while (++i < n) {
  21077. this.layout_packTransform(children[i], x, y, k);
  21078. }
  21079. }
  21080. },
  21081. /** @expose */
  21082. doCreate : function(a0, a1) {
  21083. var args = arguments;
  21084. return this.doCreate$0(a0, a1);
  21085. }
  21086. });
  21087. com_ibm_rave_core_layout_PackLayout.d3_layout_packInsert = function(a, b) {
  21088. var c = a["_pack_next"];
  21089. a["_pack_next"] = b;
  21090. b["_pack_prev"] = a;
  21091. b["_pack_next"] = c;
  21092. c["_pack_prev"] = b;
  21093. };
  21094. com_ibm_rave_core_layout_PackLayout.d3_layout_packSplice = function(a, b) {
  21095. a["_pack_next"] = b;
  21096. b["_pack_prev"] = a;
  21097. };
  21098. com_ibm_rave_core_layout_PackLayout.d3_layout_packIntersects = function(a, b) {
  21099. var dx = b["x"] - a["x"], dy = b["y"] - a["y"], dr = a["r"] + b["r"];
  21100. return .999 * dr * dr > dx * dx + dy * dy;
  21101. };
  21102. com_ibm_rave_core_layout_PackLayout.layout_packPlace = function(a, b, c) {
  21103. var db = a["r"] + c["r"], dx = b["x"] - a["x"], dy = b["y"] - a["y"];
  21104. if (db != 0 && (dx != 0 || dy != 0)) {
  21105. var da = b["r"] + c["r"], dc = dx * dx + dy * dy;
  21106. da *= da;
  21107. db *= db;
  21108. var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc);
  21109. c["x"] = a["x"] + x * dx + y * dy;
  21110. c["y"] = a["y"] + x * dy - y * dx;
  21111. } else {
  21112. c["x"] = a["x"] + db;
  21113. c["y"] = a["y"];
  21114. }
  21115. };
  21116. com_ibm_rave_core_layout_PackLayout.SQRT_FN = function(data) {
  21117. return Math.sqrt(+ (data));
  21118. };
  21119. com_ibm_rave_core_layout_PackLayout.PACK_SORT_FN = function(a, b) {
  21120. var val = (a["value"] - b["value"]);
  21121. return val == 0 ? 0 : val > 0 ? 1 : -1;
  21122. };
  21123. com_ibm_rave_core_layout_PackLayout.layout_packLink = function(node, index, array) {
  21124. node["_pack_next"] = node["_pack_prev"] = node;
  21125. return node;
  21126. };
  21127. com_ibm_rave_core_layout_PackLayout.layout_packUnlink = function(node, index, array) {
  21128. node["_pack_next"] = null;
  21129. node["_pack_prev"] = null;
  21130. return node;
  21131. };
  21132. com_ibm_rave_core_layout_PackLayout.layout_packSiblings = new (com_ibm_rave_core_nativeImpl_Declare({
  21133. visit : function(node) {
  21134. var nodes = node["children"];
  21135. if (!nodes || nodes.length == 0) {
  21136. return;
  21137. }
  21138. var n = nodes.length;
  21139. var minMax = new com_ibm_rave_core_layout_XYMin_Max();
  21140. var a, b, c, j, k = null;
  21141. var i;
  21142. nodes.forEach(com_ibm_rave_core_layout_PackLayout.layout_packLink);
  21143. a = nodes[0];
  21144. a["x"] = -a["r"];
  21145. a["y"] = 0;
  21146. minMax.bound(a);
  21147. if (n > 1) {
  21148. b = nodes[1];
  21149. b["x"] = b["r"];
  21150. b["y"] = 0;
  21151. minMax.bound(b);
  21152. if (n > 2) {
  21153. c = nodes[2];
  21154. com_ibm_rave_core_layout_PackLayout.layout_packPlace(a, b, c);
  21155. minMax.bound(c);
  21156. com_ibm_rave_core_layout_PackLayout.d3_layout_packInsert(a, c);
  21157. a["_pack_prev"] = c;
  21158. com_ibm_rave_core_layout_PackLayout.d3_layout_packInsert(c, b);
  21159. b = a["_pack_next"];
  21160. for (i = 3; i < n; ++i) {
  21161. com_ibm_rave_core_layout_PackLayout.layout_packPlace(a, b, c = nodes[i]);
  21162. var isect = 0, s1 = 1, s2 = 1;
  21163. for (j = b["_pack_next"]; j != b; j = j["_pack_next"], s1++) {
  21164. if (com_ibm_rave_core_layout_PackLayout.d3_layout_packIntersects(j, c)) {
  21165. isect = 1;
  21166. break;
  21167. }
  21168. }
  21169. if (isect == 1) {
  21170. for (k = a["_pack_prev"]; k != j["_pack_prev"]; k = k["_pack_prev"], s2++) {
  21171. if (com_ibm_rave_core_layout_PackLayout.d3_layout_packIntersects(k, c)) {
  21172. break;
  21173. }
  21174. }
  21175. }
  21176. if ((isect)) {
  21177. if (s1 < s2 || (s1 == s2 && b["r"] < a["r"])) {
  21178. com_ibm_rave_core_layout_PackLayout.d3_layout_packSplice(a, b = j);
  21179. } else {
  21180. a = k;
  21181. com_ibm_rave_core_layout_PackLayout.d3_layout_packSplice(a, b);
  21182. }
  21183. i--;
  21184. } else {
  21185. com_ibm_rave_core_layout_PackLayout.d3_layout_packInsert(a, c);
  21186. b = c;
  21187. minMax.bound(c);
  21188. }
  21189. }
  21190. }
  21191. }
  21192. var cx = (minMax.xMin + minMax.xMax) / 2, cy = (minMax.yMin + minMax.yMax) / 2, cr = 0;
  21193. for (i = 0; i < n; ++i) {
  21194. c = nodes[i];
  21195. c["x"] -= cx;
  21196. c["y"] -= cy;
  21197. cr = Math.max(cr, c["r"] + Math.sqrt(c["x"] * c["x"] + c["y"] * c["y"]));
  21198. }
  21199. node["r"] = cr;
  21200. nodes.forEach(com_ibm_rave_core_layout_PackLayout.layout_packUnlink);
  21201. }
  21202. }))();
  21203. // $source: com/ibm/rave/core/layout/XYMin_Max
  21204. /************************************************************************
  21205. ** IBM Confidential
  21206. **
  21207. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  21208. **
  21209. ** (C) Copyright IBM Corp. 2015
  21210. **
  21211. ** The source code for this program is not published or otherwise divested of its trade secrets,
  21212. ** irrespective of what has been deposited with the U.S. Copyright Office.
  21213. ************************************************************************/
  21214. // GENERATED
  21215. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  21216. /**
  21217. * A utility class used to grope for extent bounds
  21218. */
  21219. var com_ibm_rave_core_layout_XYMin_Max = rave_externs["XYMin_Max"] = com_ibm_rave_core_nativeImpl_Declare({
  21220. /**
  21221. * minimal x value
  21222. */
  21223. /** @expose */
  21224. xMin : 1.7976931348623157E308,
  21225. /**
  21226. * maximum x value
  21227. */
  21228. /** @expose */
  21229. xMax : 4.9E-324,
  21230. /**
  21231. * minimal y value
  21232. */
  21233. /** @expose */
  21234. yMin : 1.7976931348623157E308,
  21235. /**
  21236. * maximum y value
  21237. */
  21238. /** @expose */
  21239. yMax : 4.9E-324,
  21240. /**
  21241. * Adjust bounding area rectangle - extend bounds, if node falls outside of the current bounds values
  21242. * @param (Object) node a node with x, y coordinates and a radius set.
  21243. */
  21244. /** @expose */
  21245. bound : function(node) {
  21246. this.xMin = Math.min(node["x"] - node["r"], this.xMin);
  21247. this.xMax = Math.max(node["x"] + node["r"], this.xMax);
  21248. this.yMin = Math.min(node["y"] - node["r"], this.yMin);
  21249. this.yMax = Math.max(node["y"] + node["r"], this.yMax);
  21250. }
  21251. });
  21252. // $source: com/ibm/rave/core/layout/chord/ChordLayout
  21253. /************************************************************************
  21254. ** IBM Confidential
  21255. **
  21256. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  21257. **
  21258. ** (C) Copyright IBM Corp. 2015
  21259. **
  21260. ** The source code for this program is not published or otherwise divested of its trade secrets,
  21261. ** irrespective of what has been deposited with the U.S. Copyright Office.
  21262. ************************************************************************/
  21263. // GENERATED
  21264. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  21265. //@import com/ibm/rave/core/Rave (runtime) // range
  21266. //@import com/ibm/rave/core/layout/chord/SubGroupData (runtime) // new
  21267. //@import com/ibm/rave/core/layout/chord/GroupData (runtime) // new
  21268. /**
  21269. * Standard Chord layout. The results from this class can be used with the Chord SVG path generator to create a chord chart.
  21270. */
  21271. var com_ibm_rave_core_layout_chord_ChordLayout = rave_externs["ChordLayout"] = com_ibm_rave_core_nativeImpl_Declare({
  21272. //_chords : null,
  21273. //_groups : null,
  21274. //_matrix : null,
  21275. //_sortGroups : null,
  21276. //_sortSubgroups : null,
  21277. //_sortChords : null,
  21278. /**
  21279. * Retrieve the computed group angles.
  21280. */
  21281. /** @expose */
  21282. groups : null,
  21283. /**
  21284. * Retrieve the computed chord angles
  21285. */
  21286. /** @expose */
  21287. chords : null,
  21288. n : 0,
  21289. _padding : 0,
  21290. constructor : function() {
  21291. {
  21292. var self = this;
  21293. this.chords = function() {
  21294. if (!self._chords) {
  21295. self.relayout();
  21296. }
  21297. return self._chords;
  21298. };
  21299. this.groups = function() {
  21300. if (!self._groups) {
  21301. self.relayout();
  21302. }
  21303. return self._groups;
  21304. };
  21305. }
  21306. },
  21307. relayout : function() {
  21308. var subgroups = {};
  21309. var groupSums = [];
  21310. var groupIndex = com_ibm_rave_core_Rave.range(this.n);
  21311. var subgroupIndex = [];
  21312. var k, x, x0;
  21313. var i, j;
  21314. this._chords = [];
  21315. this._groups = [];
  21316. k = 0;
  21317. i = -1;
  21318. while (++i < this.n) {
  21319. x = 0;
  21320. j = -1;
  21321. while (++j < this.n) {
  21322. x += this._matrix[i][j];
  21323. }
  21324. groupSums[i] = x;
  21325. subgroupIndex[i] = com_ibm_rave_core_Rave.range(this.n);
  21326. k += x;
  21327. }
  21328. if (this._sortGroups) {
  21329. groupIndex.sort(new com_ibm_rave_core_layout_chord_ChordLayout.GroupAndSubGroupComparator(this, groupSums, false));
  21330. }
  21331. if (this._sortSubgroups) {
  21332. for (var index = 0; index < subgroupIndex.length; ++index) {
  21333. var aToSOrt = subgroupIndex[index];
  21334. aToSOrt.sort(new com_ibm_rave_core_layout_chord_ChordLayout.GroupAndSubGroupComparator(this, this._matrix[index], true));
  21335. }
  21336. }
  21337. k = (6.283185307179586 - this._padding * this.n) / k;
  21338. x = 0;
  21339. i = -1;
  21340. while (++i < this.n) {
  21341. x0 = x;
  21342. j = -1;
  21343. var di = 0;
  21344. while (++j < this.n) {
  21345. di = groupIndex[i];
  21346. var dj = subgroupIndex[di][j];
  21347. var v = this._matrix[di][dj], a0 = x, a1 = x += v * k;
  21348. subgroups[di + "-" + dj] = new com_ibm_rave_core_layout_chord_SubGroupData(di, dj, a0, a1, v);
  21349. }
  21350. this._groups[di] = new com_ibm_rave_core_layout_chord_GroupData(di, x0, x, (x - x0) / k);
  21351. x += this._padding;
  21352. }
  21353. i = -1;
  21354. while (++i < this.n) {
  21355. j = i - 1;
  21356. while (++j < this.n) {
  21357. var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i];
  21358. if (source.value != 0 || target.value != 0) {
  21359. var cd = {};
  21360. if (source.value < target.value) {
  21361. cd["source"] = target;
  21362. cd["target"] = source;
  21363. } else {
  21364. cd["source"] = source;
  21365. cd["target"] = target;
  21366. }
  21367. this._chords.push(cd);
  21368. }
  21369. }
  21370. }
  21371. if (this._sortChords) {
  21372. this.resort();
  21373. }
  21374. },
  21375. /** @expose */
  21376. resort : function() {
  21377. this._chords.sort(new com_ibm_rave_core_layout_chord_ChordLayout.ChordsComparator(this._sortChords));
  21378. },
  21379. /**
  21380. * Set the matrix data backing the layout.
  21381. * @param (double[][]) x the data
  21382. * @return (com.ibm.rave.core.layout.chord.ChordLayout) this chord layout
  21383. */
  21384. matrix$0 : function(x) {
  21385. this._matrix = x;
  21386. this.n = x.length;
  21387. this._chords = null;
  21388. this._groups = null;
  21389. return this;
  21390. },
  21391. /**
  21392. * Gets the matrix data backing the layout.
  21393. * @return (double[][]) the data
  21394. */
  21395. matrix$1 : function() {
  21396. return this._matrix;
  21397. },
  21398. /**
  21399. * Set the angular padding between chord segments.
  21400. * @param (double) x the new padding value
  21401. * @return (com.ibm.rave.core.layout.chord.ChordLayout) this layout
  21402. */
  21403. padding$0 : function(x) {
  21404. this._padding = x;
  21405. this._chords = null;
  21406. this._groups = null;
  21407. return this;
  21408. },
  21409. /**
  21410. * Get the angular padding between chord segments.
  21411. * @return (double) the padding
  21412. */
  21413. padding$1 : function() {
  21414. return this._padding;
  21415. },
  21416. /**
  21417. * Get the comparator function for groups.
  21418. * @return (com.ibm.rave.core.functions.SimpleValueFunction) the comparator function
  21419. */
  21420. sortGroups$0 : function() {
  21421. return this._sortGroups;
  21422. },
  21423. /**
  21424. * Sets the comparator function for groups.
  21425. * @param (com.ibm.rave.core.functions.SimpleValueFunction) sortGroupFn the new comparator
  21426. * @return (com.ibm.rave.core.layout.chord.ChordLayout) this layout
  21427. */
  21428. sortGroups$1 : function(sortGroupFn) {
  21429. this._sortGroups = sortGroupFn;
  21430. this._chords = null;
  21431. this._groups = null;
  21432. return this;
  21433. },
  21434. /**
  21435. * Get the comparator function for subgroups.
  21436. * @return (com.ibm.rave.core.functions.SimpleValueFunction) the comparator function
  21437. */
  21438. sortSubgroups$0 : function() {
  21439. return this._sortSubgroups;
  21440. },
  21441. /**
  21442. * Sets the comparator function for subgroups.
  21443. * @param (com.ibm.rave.core.functions.SimpleValueFunction) sortSubGroupFn the new comparator
  21444. * @return (com.ibm.rave.core.layout.chord.ChordLayout) this layout
  21445. */
  21446. sortSubgroups$1 : function(sortSubGroupFn) {
  21447. this._sortSubgroups = sortSubGroupFn;
  21448. this._chords = null;
  21449. return this;
  21450. },
  21451. /**
  21452. * Get the comparator function for chords (z-order).
  21453. * @return (com.ibm.rave.core.functions.SimpleValueFunction) chords comparator
  21454. */
  21455. sortChords$0 : function() {
  21456. return this._sortChords;
  21457. },
  21458. /**
  21459. * Set the comparator function for chords (z-order).
  21460. * @param (com.ibm.rave.core.functions.SimpleValueFunction) sortChordsFn the new comparator functions
  21461. * @return (com.ibm.rave.core.layout.chord.ChordLayout) this layout
  21462. */
  21463. sortChords$1 : function(sortChordsFn) {
  21464. this._sortChords = sortChordsFn;
  21465. if (this._chords) {
  21466. this.resort();
  21467. }
  21468. return this;
  21469. },
  21470. /** @expose */
  21471. matrix : function(a0) {
  21472. var args = arguments;
  21473. if (args.length == 0) {
  21474. return this.matrix$1();
  21475. }
  21476. return this.matrix$0(a0);
  21477. },
  21478. /** @expose */
  21479. padding : function(a0) {
  21480. var args = arguments;
  21481. if (args.length == 0) {
  21482. return this.padding$1();
  21483. }
  21484. return this.padding$0(a0);
  21485. },
  21486. /** @expose */
  21487. sortGroups : function(a0) {
  21488. var args = arguments;
  21489. if (args.length == 0) {
  21490. return this.sortGroups$0();
  21491. }
  21492. return this.sortGroups$1(a0);
  21493. },
  21494. /** @expose */
  21495. sortSubgroups : function(a0) {
  21496. var args = arguments;
  21497. if (args.length == 0) {
  21498. return this.sortSubgroups$0();
  21499. }
  21500. return this.sortSubgroups$1(a0);
  21501. },
  21502. /** @expose */
  21503. sortChords : function(a0) {
  21504. var args = arguments;
  21505. if (args.length == 0) {
  21506. return this.sortChords$0();
  21507. }
  21508. return this.sortChords$1(a0);
  21509. }
  21510. });
  21511. com_ibm_rave_core_layout_chord_ChordLayout.GroupAndSubGroupComparator = com_ibm_rave_core_nativeImpl_Declare({
  21512. //dataToSort : null,
  21513. //chord : null,
  21514. subGroup : false,
  21515. _$functionClassMethod : function() {
  21516. var _$self = function(o1, o2) {
  21517. if (!_$self.subGroup) {
  21518. return _$self.chord._sortGroups(_$self.dataToSort[o1], _$self.dataToSort[o2]);
  21519. }
  21520. return _$self.chord._sortSubgroups(_$self.dataToSort[o1], _$self.dataToSort[o2]);
  21521. };
  21522. return _$self;
  21523. },
  21524. /** @expose */
  21525. constructor : function(_chord, _dataToSort, _subGroups) {
  21526. this.dataToSort = _dataToSort;
  21527. this.chord = _chord;
  21528. this.subGroup = _subGroups;
  21529. }
  21530. });
  21531. com_ibm_rave_core_layout_chord_ChordLayout.ChordsComparator = com_ibm_rave_core_nativeImpl_Declare({
  21532. //sortGroups : null,
  21533. _$functionClassMethod : function() {
  21534. var _$self = function(a, b) {
  21535. return _$self.sortGroups((a["source"].value + a["target"].value) / 2, (b["source"].value + b["target"].value) / 2);
  21536. };
  21537. return _$self;
  21538. },
  21539. /** @expose */
  21540. constructor : function(_sortGroups) {
  21541. this.sortGroups = _sortGroups;
  21542. }
  21543. });
  21544. // $source: com/ibm/rave/core/layout/chord/SubGroupData
  21545. /************************************************************************
  21546. ** IBM Confidential
  21547. **
  21548. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  21549. **
  21550. ** (C) Copyright IBM Corp. 2015
  21551. **
  21552. ** The source code for this program is not published or otherwise divested of its trade secrets,
  21553. ** irrespective of what has been deposited with the U.S. Copyright Office.
  21554. ************************************************************************/
  21555. // GENERATED
  21556. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  21557. var com_ibm_rave_core_layout_chord_SubGroupData = rave_externs["SubGroupData"] = com_ibm_rave_core_nativeImpl_Declare({
  21558. /** @expose */
  21559. index : 0,
  21560. /** @expose */
  21561. subindex : 0,
  21562. /** @expose */
  21563. startAngle : 0,
  21564. /** @expose */
  21565. endAngle : 0,
  21566. /** @expose */
  21567. value : 0,
  21568. /** @expose */
  21569. radius : 0,
  21570. /** @expose */
  21571. constructor : function(index, subindex, startAngle, endAngle, value) {
  21572. this.index = index;
  21573. this.subindex = subindex;
  21574. this.startAngle = startAngle;
  21575. this.endAngle = endAngle;
  21576. this.value = value;
  21577. }
  21578. });
  21579. // $source: com/ibm/rave/core/layout/chord/GroupData
  21580. /************************************************************************
  21581. ** IBM Confidential
  21582. **
  21583. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  21584. **
  21585. ** (C) Copyright IBM Corp. 2015
  21586. **
  21587. ** The source code for this program is not published or otherwise divested of its trade secrets,
  21588. ** irrespective of what has been deposited with the U.S. Copyright Office.
  21589. ************************************************************************/
  21590. // GENERATED
  21591. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  21592. var com_ibm_rave_core_layout_chord_GroupData = rave_externs["GroupData"] = com_ibm_rave_core_nativeImpl_Declare({
  21593. /** @expose */
  21594. index : 0,
  21595. /** @expose */
  21596. startAngle : 0,
  21597. /** @expose */
  21598. endAngle : 0,
  21599. /** @expose */
  21600. value : 0,
  21601. /** @expose */
  21602. constructor : function(index, startAngle, endAngle, value) {
  21603. this.index = index;
  21604. this.startAngle = startAngle;
  21605. this.endAngle = endAngle;
  21606. this.value = value;
  21607. }
  21608. });
  21609. // $source: com/ibm/rave/core/layout/cluster/Cluster
  21610. /************************************************************************
  21611. ** IBM Confidential
  21612. **
  21613. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  21614. **
  21615. ** (C) Copyright IBM Corp. 2015
  21616. **
  21617. ** The source code for this program is not published or otherwise divested of its trade secrets,
  21618. ** irrespective of what has been deposited with the U.S. Copyright Office.
  21619. ************************************************************************/
  21620. // GENERATED
  21621. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare anonymous, declare
  21622. //@import com/ibm/rave/core/layout/hierarchy/HierarchyBase (loadtime) // superclass
  21623. //@import com/ibm/rave/core/layout/tree/Tree (runtime) // treeSeparation
  21624. //@import com/ibm/rave/core/layout/hierarchy/HierarchyUtil (runtime) // visitAfter
  21625. //@import com/ibm/rave/core/Rave (runtime) // max
  21626. var com_ibm_rave_core_layout_cluster_Cluster = rave_externs["Cluster"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_layout_hierarchy_HierarchyBase, {
  21627. /**
  21628. * default separation method to be called
  21629. */
  21630. //defaultSeparationFunction : null,
  21631. /**
  21632. * An alias to this layout instance
  21633. */
  21634. /** @expose */
  21635. nodes : null,
  21636. //separationFunction : null,
  21637. //_size : null,
  21638. /**
  21639. * value function for max in order to get the y value for each child. this will allow us to reduce all the children's y values and return a final y value.
  21640. * @param ArrayList <Node> children children of a node
  21641. * @return y value of a child
  21642. */
  21643. //getChildY : null,
  21644. _nodeSize : false,
  21645. constructor : function() {
  21646. this.defaultSeparationFunction = function(a, b) {
  21647. return com_ibm_rave_core_layout_tree_Tree.treeSeparation(a, b);
  21648. };
  21649. this.separationFunction = this.defaultSeparationFunction;
  21650. this._size = [1.0, 1.0];
  21651. this.getChildY = function(child, index, groupIndex) {
  21652. return (child)["y"];
  21653. };
  21654. /**
  21655. * Implements a hierarchical layout using the cluster (or dendrogram) algorithm.
  21656. */
  21657. {
  21658. this.nodes = this;
  21659. this.sort(null);
  21660. this.value(null);
  21661. }
  21662. },
  21663. /**
  21664. * helps creates a cluster diagram by setting location attributes
  21665. * @param (Object) d the cluster nodes
  21666. * @param (int) i the index
  21667. * @return (Array) list of all the cluster nodes
  21668. */
  21669. doCreate$0 : function(d, i) {
  21670. var nodes = com_ibm_rave_core_layout_hierarchy_HierarchyBase.prototype.doCreate.call(this, d, i);
  21671. var root = nodes[0], previousNode;
  21672. var x = 0;
  21673. var self = this;
  21674. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitAfter(root, new (com_ibm_rave_core_nativeImpl_Declare({
  21675. visit : function(node) {
  21676. var children = node["children"];
  21677. if (children && children.length > 0) {
  21678. node["x"] = self.clusterX(children);
  21679. node["y"] = self.clusterY(children);
  21680. } else {
  21681. if (previousNode) {
  21682. x = x + self.separationFunction(node, previousNode);
  21683. node["x"] = x;
  21684. } else {
  21685. node["x"] = 0;
  21686. }
  21687. node["y"] = 0;
  21688. previousNode = node;
  21689. }
  21690. }
  21691. }))());
  21692. var left = this.clusterLeft(root);
  21693. var right = this.clusterRight(root);
  21694. var x0 = left["x"] - this.separationFunction(left, right) / 2.0;
  21695. var x1 = right["x"] + this.separationFunction(right, left) / 2.0;
  21696. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitAfter(root, new (com_ibm_rave_core_nativeImpl_Declare({
  21697. visit : function(node) {
  21698. if (self._nodeSize) {
  21699. node["x"] = (node["x"] - root["x"]) * self._size[0];
  21700. node["y"] = (root["y"] - node["y"]) * self._size[1];
  21701. } else {
  21702. node["x"] = (node["x"] - x0) / (x1 - x0) * self._size[0];
  21703. node["y"] = (1 - (root["y"] > 0 ? node["y"] / root["y"] : 1)) * self._size[1];
  21704. }
  21705. }
  21706. }))());
  21707. return nodes;
  21708. },
  21709. /**
  21710. * reduce children by using the Rave.max method in order to calculate the children's y value
  21711. * @param (Array) children children of a node
  21712. * @return (double) children's y value
  21713. */
  21714. clusterY : function(children) {
  21715. return 1.0 + (com_ibm_rave_core_Rave.max(children, this.getChildY));
  21716. },
  21717. /**
  21718. * gets the reduced value and divides it by the number of children in order to get the children's x value
  21719. * @param (Array) children children of a node
  21720. * @return (double) children's x value
  21721. */
  21722. clusterX : function(children) {
  21723. var reduction = 0.0;
  21724. reduction = this.reduce(children);
  21725. return reduction / children.length;
  21726. },
  21727. /**
  21728. * gets the reduced value
  21729. * @param (Array) children children of a node
  21730. * @return (double) children's reduction value
  21731. */
  21732. reduce : function(children) {
  21733. var reduction = 0.0;
  21734. var previousReduction = 0.0;
  21735. for (var __i_enFor0 = 0, __exp_enFor0 = children, __len_enFor0 = __exp_enFor0.length;
  21736. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  21737. var node = __exp_enFor0[__i_enFor0];
  21738. reduction = (previousReduction + node["x"]);
  21739. previousReduction = reduction;
  21740. }
  21741. return reduction;
  21742. },
  21743. /**
  21744. * Compute the left-most node for extents
  21745. * @param (Object) node node to compute left-most node for extents
  21746. * @return (Object) left-most node
  21747. */
  21748. clusterRight : function(node) {
  21749. var children = node["children"];
  21750. return children && children.length > 0 ? this.clusterRight(children[children.length - 1]) : node;
  21751. },
  21752. /**
  21753. * compute the right-most node for extents
  21754. * @param (Object) node node node to compute right-most node for extents
  21755. * @return (Object) right-most node
  21756. */
  21757. clusterLeft : function(node) {
  21758. var children = node["children"];
  21759. return children && children.length > 0 ? this.clusterLeft(children[0]) : node;
  21760. },
  21761. /**
  21762. * sets the treeSeparation method to the new method being passed in
  21763. * @param (com.ibm.rave.core.layout.tree.Tree.GetSeparation) func the new method to be involved when calling treeSeparation
  21764. * @return (com.ibm.rave.core.layout.cluster.Cluster) cluster instance
  21765. */
  21766. separation$0 : function(func) {
  21767. this.separationFunction = func;
  21768. return this;
  21769. },
  21770. /**
  21771. * gets the treeSeparation method
  21772. * @return (com.ibm.rave.core.layout.tree.Tree.GetSeparation) treeSeparation method
  21773. */
  21774. separation$1 : function() {
  21775. return this.separationFunction;
  21776. },
  21777. size$0 : function() {
  21778. return this._nodeSize ? null : this._size;
  21779. },
  21780. /**
  21781. * sets the size of the layout
  21782. * @param (double[]) sizes the desired height and width of the layout
  21783. * @return (com.ibm.rave.core.layout.cluster.Cluster) this the cluster object
  21784. */
  21785. size$1 : function(sizes) {
  21786. this._nodeSize = (!(this._size = sizes));
  21787. return this;
  21788. },
  21789. /**
  21790. * sets the node size
  21791. * @param (double[]) nodeSize the desired node size
  21792. * @return (com.ibm.rave.core.layout.cluster.Cluster) this the cluster object
  21793. */
  21794. nodeSize$0 : function(nodeSize) {
  21795. this._nodeSize = (this._size = nodeSize);
  21796. return this;
  21797. },
  21798. /**
  21799. * gets the node size
  21800. * @return (double[]) nodeSize
  21801. */
  21802. nodeSize$1 : function() {
  21803. return this._nodeSize ? this._size : null;
  21804. },
  21805. /** @expose */
  21806. doCreate : function(a0, a1) {
  21807. var args = arguments;
  21808. return this.doCreate$0(a0, a1);
  21809. },
  21810. /** @expose */
  21811. separation : function(a0) {
  21812. var args = arguments;
  21813. if (args.length == 0) {
  21814. return this.separation$1();
  21815. }
  21816. return this.separation$0(a0);
  21817. },
  21818. /** @expose */
  21819. size : function(a0) {
  21820. var args = arguments;
  21821. if (args.length == 0) {
  21822. return this.size$0();
  21823. }
  21824. return this.size$1(a0);
  21825. },
  21826. /** @expose */
  21827. nodeSize : function(a0) {
  21828. var args = arguments;
  21829. if (args.length == 0) {
  21830. return this.nodeSize$1();
  21831. }
  21832. return this.nodeSize$0(a0);
  21833. }
  21834. });
  21835. // $source: com/ibm/rave/core/layout/tree/Tree
  21836. /************************************************************************
  21837. ** IBM Confidential
  21838. **
  21839. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  21840. **
  21841. ** (C) Copyright IBM Corp. 2015
  21842. **
  21843. ** The source code for this program is not published or otherwise divested of its trade secrets,
  21844. ** irrespective of what has been deposited with the U.S. Copyright Office.
  21845. ************************************************************************/
  21846. // GENERATED
  21847. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare anonymous, declare
  21848. //@import com/ibm/rave/core/layout/hierarchy/HierarchyBase (loadtime) // superclass
  21849. //@import com/ibm/rave/core/layout/hierarchy/HierarchyUtil (runtime) // visitAfter, visitBefore
  21850. /**
  21851. * The tree layout produces tidy node-link diagrams of trees using the Reingold–Tilford “tidy” algorithm.
  21852. */
  21853. var com_ibm_rave_core_layout_tree_Tree = rave_externs["Tree"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_layout_hierarchy_HierarchyBase, {
  21854. /**
  21855. * default separation method to be called
  21856. */
  21857. //defaultSeparationFunction : null,
  21858. /**
  21859. * An alias to this layout instance
  21860. */
  21861. /** @expose */
  21862. nodes : null,
  21863. //sizeNode : null,
  21864. //firstWalk : null,
  21865. //secondWalk : null,
  21866. //_size : null,
  21867. //separationFunction : null,
  21868. _nodeSize : false,
  21869. constructor : function() {
  21870. this.defaultSeparationFunction = function(a, b) {
  21871. return com_ibm_rave_core_layout_tree_Tree.treeSeparation(a, b);
  21872. };
  21873. this._size = [1.0, 1.0];
  21874. this.separationFunction = this.defaultSeparationFunction;
  21875. /**
  21876. * c'tor
  21877. */
  21878. {
  21879. this.nodes = this;
  21880. var self = this;
  21881. this.sizeNode = new (com_ibm_rave_core_nativeImpl_Declare({
  21882. visit : function(node) {
  21883. node["x"] *= self._size[0];
  21884. node["y"] = node["depth"] * self._size[1];
  21885. }
  21886. }))();
  21887. this.firstWalk = new (com_ibm_rave_core_nativeImpl_Declare({
  21888. visit : function(v) {
  21889. var children = v["children"];
  21890. var siblings = v["parent"]["children"];
  21891. var w = v["i"] != 0 ? siblings[v["i"] - 1] : null;
  21892. if (children.length > 0) {
  21893. self.treeShift(v);
  21894. var midpoint = (children[0]["z"] + children[children.length - 1]["z"]) / 2;
  21895. if (w) {
  21896. v["z"] = w["z"] + self.separationFunction(v["wrappedNode"], w["wrappedNode"]);
  21897. v["m"] = v["z"] - midpoint;
  21898. } else {
  21899. v["z"] = midpoint;
  21900. }
  21901. } else if (w) {
  21902. v["z"] = w["z"] + self.separationFunction(v["wrappedNode"], w["wrappedNode"]);
  21903. }
  21904. v["parent"]["A"] = self.apportion(v, w, (v["parent"]["A"]) ? v["parent"]["A"] : siblings.length > 0 ? siblings[0] : null);
  21905. }
  21906. }))();
  21907. this.secondWalk = new (com_ibm_rave_core_nativeImpl_Declare({
  21908. visit : function(v) {
  21909. v["wrappedNode"]["x"] = v["z"] + v["parent"]["m"];
  21910. v["m"] += v["parent"]["m"];
  21911. }
  21912. }))();
  21913. this.sort(null);
  21914. this.value(null);
  21915. }
  21916. },
  21917. createTreeNodeWrapper : function(treeNode, parent, i) {
  21918. var node = {};
  21919. node["wrappedNode"] = treeNode;
  21920. node["parent"] = parent;
  21921. node["children"] = [];
  21922. node["A"] = null;
  21923. node["a"] = node;
  21924. node["z"] = 0;
  21925. node["m"] = 0;
  21926. node["c"] = 0;
  21927. node["s"] = 0;
  21928. node["t"] = null;
  21929. node["i"] = i;
  21930. return node;
  21931. },
  21932. buildChildren : function(node) {
  21933. if (node["wrappedNode"]["children"]) {
  21934. for (var j = 0, n = node["wrappedNode"]["children"].length; j < n; ++j) {
  21935. var childTreeNode = node["wrappedNode"]["children"][j];
  21936. var child = this.createTreeNodeWrapper(childTreeNode, node, j);
  21937. node["children"].push(child);
  21938. this.buildChildren(child);
  21939. }
  21940. }
  21941. },
  21942. wrapTree : function(root0) {
  21943. var wrappedRoot0 = this.createTreeNodeWrapper(root0, this.createTreeNodeWrapper(null, null, -1), 0);
  21944. this.buildChildren(wrappedRoot0);
  21945. return wrappedRoot0;
  21946. },
  21947. apportion : function(v, w, ancestor) {
  21948. if (w) {
  21949. var vip = v, vop = v, vim = w, vom = vip["parent"]["children"][0];
  21950. var sip = vip["m"], sop = vop["m"], sim = vim["m"], som = vom["m"], shift;
  21951. vim = this.treeRight(vim);
  21952. vip = this.treeLeft(vip);
  21953. while (vim && vip) {
  21954. vom = this.treeLeft(vom);
  21955. vop = this.treeRight(vop);
  21956. vop["a"] = v;
  21957. shift = vim["z"] + sim - vip["z"] - sip + this.separationFunction(vim["wrappedNode"], vip["wrappedNode"]);
  21958. if (shift > 0) {
  21959. this.treeMove(this.treeAncestor(vim, v, ancestor), v, shift);
  21960. sip += shift;
  21961. sop += shift;
  21962. }
  21963. sim += vim["m"];
  21964. sip += vip["m"];
  21965. som += vom["m"];
  21966. sop += vop["m"];
  21967. vim = this.treeRight(vim);
  21968. vip = this.treeLeft(vip);
  21969. }
  21970. if (vim && !this.treeRight(vop)) {
  21971. vop["t"] = vim;
  21972. vop["m"] += sim - sop;
  21973. }
  21974. if (vip && !this.treeLeft(vom)) {
  21975. vom["t"] = vip;
  21976. vom["m"] += sip - som;
  21977. ancestor = v;
  21978. }
  21979. }
  21980. return ancestor;
  21981. },
  21982. treeLeft : function(v) {
  21983. var children = v["children"];
  21984. return children.length > 0 ? children[0] : v["t"];
  21985. },
  21986. treeRight : function(v) {
  21987. var children = v["children"];
  21988. var n = children.length;
  21989. return (n > 0) ? children[n - 1] : v["t"];
  21990. },
  21991. treeMove : function(wm, wp, shift) {
  21992. var change = shift / (wp["i"] - wm["i"]);
  21993. wp["c"] -= change;
  21994. wp["s"] += shift;
  21995. wm["c"] += change;
  21996. wp["z"] += shift;
  21997. wp["m"] += shift;
  21998. },
  21999. treeShift : function(v) {
  22000. var shift = 0, change = 0;
  22001. var children = v["children"];
  22002. var i = children.length;
  22003. var w;
  22004. while (--i >= 0) {
  22005. w = children[i];
  22006. w["z"] += shift;
  22007. w["m"] += shift;
  22008. shift += w["s"] + (change += w["c"]);
  22009. }
  22010. },
  22011. treeAncestor : function(vim, v, ancestor) {
  22012. return vim["a"]["parent"] == (v["parent"]) ? vim["a"] : ancestor;
  22013. },
  22014. /**
  22015. * Creates a new tree layout with the default settings: the default sort order is null; the default children accessor assumes each input data is an object with a children array; the default separation function uses one node width for siblings, and two node widths for non-siblings; the default size is 1×1.
  22016. * @param (Object) d the root node containing all children
  22017. * @param (int) i the index
  22018. * @return (Array) the tree layout array representing the computed positions of all child nodes
  22019. */
  22020. doCreate$0 : function(d, i) {
  22021. var nodes = com_ibm_rave_core_layout_hierarchy_HierarchyBase.prototype.doCreate.call(this, d, i);
  22022. var root0 = nodes[0];
  22023. var root1 = this.wrapTree(root0);
  22024. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitAfter(root1, this.firstWalk);
  22025. root1["parent"]["m"] = -root1["z"];
  22026. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitBefore(root1, this.secondWalk);
  22027. if (this._nodeSize) {
  22028. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitBefore(root0, this.sizeNode);
  22029. } else {
  22030. var left = root0, right = root0, bottom = root0;
  22031. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitBefore(root0, new (com_ibm_rave_core_nativeImpl_Declare({
  22032. visit : function(node) {
  22033. if (node["x"] < left["x"]) {
  22034. left = node;
  22035. }
  22036. if (node["x"] > right["x"]) {
  22037. right = node;
  22038. }
  22039. if (node["depth"] > bottom["depth"]) {
  22040. bottom = node;
  22041. }
  22042. }
  22043. }))());
  22044. var tx = this.separationFunction(left, right) / 2.0 - left["x"];
  22045. var kx = this._size[0] / (right["x"] + this.separationFunction(right, left) / 2.0 + tx);
  22046. var ky = this._size[1] / ((bottom["depth"] > 0) ? bottom["depth"] : 1);
  22047. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitBefore(root0, new (com_ibm_rave_core_nativeImpl_Declare({
  22048. visit : function(node) {
  22049. node["x"] = (node["x"] + tx) * kx;
  22050. node["y"] = node["depth"] * ky;
  22051. }
  22052. }))());
  22053. }
  22054. return nodes;
  22055. },
  22056. /**
  22057. * sets the separation method to the new method being passed in it is used to compute separation between neighboring nodes
  22058. * @param (com.ibm.rave.core.layout.tree.Tree.GetSeparation) func the new method to be involved when calling treeSeparation
  22059. * @return (com.ibm.rave.core.layout.tree.Tree) tree instance
  22060. */
  22061. separation$0 : function(func) {
  22062. this.separationFunction = func;
  22063. return this;
  22064. },
  22065. /**
  22066. * gets the separation method
  22067. * @return (com.ibm.rave.core.layout.tree.Tree.GetSeparation) separation method
  22068. */
  22069. separation$1 : function() {
  22070. return this.separationFunction;
  22071. },
  22072. /**
  22073. * sets the size of the layout
  22074. * @param (Array) sizes the desired height and width of the layout
  22075. * @return (com.ibm.rave.core.layout.tree.Tree) this the tree object
  22076. */
  22077. size$0 : function(sizes) {
  22078. this._nodeSize = (!(this._size = sizes));
  22079. return this;
  22080. },
  22081. /**
  22082. * gets the size of the layout The default is 1x1
  22083. * @return (Array) an array representing the size of the layout
  22084. */
  22085. size$1 : function() {
  22086. return this._nodeSize ? null : this._size;
  22087. },
  22088. /**
  22089. * sets the node size
  22090. * @param (Array) sizes the desired node size
  22091. * @return (com.ibm.rave.core.layout.tree.Tree) this the tree object
  22092. */
  22093. nodeSize$0 : function(sizes) {
  22094. this._nodeSize = ((this._size = sizes));
  22095. return this;
  22096. },
  22097. /**
  22098. * gets the node size
  22099. * @return (Array) nodeSize
  22100. */
  22101. nodeSize$1 : function() {
  22102. return (this._nodeSize) ? this._size : null;
  22103. },
  22104. /** @expose */
  22105. doCreate : function(a0, a1) {
  22106. var args = arguments;
  22107. return this.doCreate$0(a0, a1);
  22108. },
  22109. /** @expose */
  22110. separation : function(a0) {
  22111. var args = arguments;
  22112. if (args.length == 0) {
  22113. return this.separation$1();
  22114. }
  22115. return this.separation$0(a0);
  22116. },
  22117. /** @expose */
  22118. size : function(a0) {
  22119. var args = arguments;
  22120. if (args.length == 0) {
  22121. return this.size$1();
  22122. }
  22123. return this.size$0(a0);
  22124. },
  22125. /** @expose */
  22126. nodeSize : function(a0) {
  22127. var args = arguments;
  22128. if (args.length == 0) {
  22129. return this.nodeSize$1();
  22130. }
  22131. return this.nodeSize$0(a0);
  22132. }
  22133. });
  22134. /**
  22135. * compares parent nodes
  22136. * @param (Object) a compares node a's parent with node b
  22137. * @param (Object) b compares node a's parent with node b
  22138. * @return (int) indicates whether a and b are the same or different
  22139. */
  22140. /** @expose */
  22141. com_ibm_rave_core_layout_tree_Tree.treeSeparation = function(a, b) {
  22142. return a["parent"] == b["parent"] ? 1 : 2;
  22143. };
  22144. // $source: com/ibm/rave/core/layout/StackLayout
  22145. /************************************************************************
  22146. ** IBM Confidential
  22147. **
  22148. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  22149. **
  22150. ** (C) Copyright IBM Corp. 2015
  22151. **
  22152. ** The source code for this program is not published or otherwise divested of its trade secrets,
  22153. ** irrespective of what has been deposited with the U.S. Copyright Office.
  22154. ************************************************************************/
  22155. // GENERATED
  22156. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  22157. //@import com/ibm/rave/core/Rave (runtime) // permute, range
  22158. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (runtime) // create
  22159. //@import com/ibm/rave/core/internal/util/Identity (static) // create
  22160. //@import com/ibm/rave/core/arrays/Range (runtime) // create
  22161. var com_ibm_rave_core_layout_StackLayout = rave_externs["StackLayout"] = com_ibm_rave_core_nativeImpl_Declare({
  22162. //valuesFn : null,
  22163. //orderFn : null,
  22164. //offsetFn : null,
  22165. //outFn : null,
  22166. //xFn : null,
  22167. //yFn : null,
  22168. _$functionClassMethod : function() {
  22169. var _$self = /**
  22170. * Constructs a new stack layout with the default offset (zero) and order (null). The returned layout object is both an object and a function. That is: you can call the layout like any other function, and the layout has additional methods that change its behavior. Like other classes in Rave, layouts follow the method chaining pattern where setter methods return the layout itself, allowing multiple setters to be invoked in a concise statement.
  22171. * @param (Object) this the context
  22172. * @param (Array) data the data
  22173. * @param (int) index the index
  22174. * @return (Array) modified data
  22175. */
  22176. function(data, index) {
  22177. var n = data.length;
  22178. if (!((Number.valueOf(n)))) {
  22179. return data;
  22180. }
  22181. var i = 0, j = 0;
  22182. var o = 0;
  22183. var self = _$self;
  22184. var series = data.map(function(currentValue, currentIndex, array) {
  22185. return self.valuesFn.call(this, currentValue, currentIndex, -1);
  22186. });
  22187. var points = series.map(function(currentValue, notUsedindex, notUsedarray) {
  22188. return currentValue.map(function(pointsCurrentValue, pointIndex, pointArray) {
  22189. var xVal = (+ (self.xFn.call(self, pointsCurrentValue, pointIndex, -1)));
  22190. var yVal = (+ (self.yFn.call(self, pointsCurrentValue, pointIndex, -1)));
  22191. return [xVal, yVal];
  22192. });
  22193. });
  22194. var orders = _$self.orderFn.call(_$self, points, index, -1);
  22195. series = com_ibm_rave_core_Rave.permute(series, orders);
  22196. points = com_ibm_rave_core_Rave.permute(points, orders);
  22197. var offsets = _$self.offsetFn.call(_$self, points, index, -1);
  22198. var m = series[0].length;
  22199. for (j = 0; j < m; ++j) {
  22200. o = offsets[j];
  22201. _$self.outFn.call(_$self, series[0][j], o, points[0][j][1]);
  22202. for (i = 1; i < n; ++i) {
  22203. o += points[i - 1][j][1];
  22204. _$self.outFn.call(_$self, series[i][j], o, points[i][j][1]);
  22205. }
  22206. }
  22207. return data;
  22208. };
  22209. return _$self;
  22210. },
  22211. constructor : function() {
  22212. this.valuesFn = com_ibm_rave_core_layout_StackLayout.DEFAULT_VALUES_FUNCTION;
  22213. this.orderFn = com_ibm_rave_core_layout_StackLayout.DEFAULT_STACKORDER_FUNCTION;
  22214. this.offsetFn = com_ibm_rave_core_layout_StackLayout.DEFAULT_STACKOFFSETZERO;
  22215. this.outFn = com_ibm_rave_core_layout_StackLayout.DEFAULT_OUT_FUNCTION;
  22216. this.xFn = com_ibm_rave_core_layout_StackLayout.DEFAULT_X_FUNCTION;
  22217. this.yFn = com_ibm_rave_core_layout_StackLayout.DEFAULT_Y_FUNCTION;
  22218. },
  22219. /**
  22220. * gets the x-coordinate function
  22221. * @return (com.ibm.rave.core.selector.ValueFunction) X function
  22222. */
  22223. x$0 : function() {
  22224. return this.xFn;
  22225. },
  22226. /**
  22227. * Specifies how to access the x-coordinate of each value's position.
  22228. * @param (com.ibm.rave.core.selector.ValueFunction) newXFn
  22229. * @return (com.ibm.rave.core.layout.StackLayout) this layout
  22230. */
  22231. x$1 : function(newXFn) {
  22232. this.xFn = newXFn;
  22233. return this;
  22234. },
  22235. /**
  22236. * Gets the Y-coordinate function
  22237. * @return (com.ibm.rave.core.selector.ValueFunction) Y function
  22238. */
  22239. y$0 : function() {
  22240. return this.yFn;
  22241. },
  22242. /**
  22243. * Specifies how to access the Y-coordinate of each value's position.
  22244. * @param (com.ibm.rave.core.selector.ValueFunction) newYFn
  22245. * @return (com.ibm.rave.core.layout.StackLayout) this layout
  22246. */
  22247. y$1 : function(newYFn) {
  22248. this.yFn = newYFn;
  22249. return this;
  22250. },
  22251. /**
  22252. * Gets the Out Function
  22253. * @return (com.ibm.rave.core.layout.StackLayout.StackOutFunction) the out function
  22254. */
  22255. out$0 : function() {
  22256. return this.outFn;
  22257. },
  22258. /**
  22259. * Sets the function that Specifies how to propagate the computed baseline to above layers.
  22260. * @param (com.ibm.rave.core.layout.StackLayout.StackOutFunction) newOutFn
  22261. * @return (com.ibm.rave.core.layout.StackLayout) this layout
  22262. */
  22263. out$1 : function(newOutFn) {
  22264. this.outFn = newOutFn;
  22265. return this;
  22266. },
  22267. /**
  22268. * Gets the values Function
  22269. * @return (com.ibm.rave.core.selector.ValueFunction) stack layout value function
  22270. */
  22271. values$0 : function() {
  22272. return this.valuesFn;
  22273. },
  22274. /**
  22275. * Sets the function that Specifies how to extract values from the associated element in layers
  22276. * @param (com.ibm.rave.core.selector.ValueFunction) newValuesFn
  22277. * @return (com.ibm.rave.core.layout.StackLayout) this layout
  22278. */
  22279. values$1 : function(newValuesFn) {
  22280. this.valuesFn = newValuesFn;
  22281. return this;
  22282. },
  22283. /**
  22284. * Gets The stack order function
  22285. * @return (com.ibm.rave.core.selector.ValueFunction) stack order function
  22286. */
  22287. order$0 : function() {
  22288. return this.orderFn;
  22289. },
  22290. /**
  22291. * Sets the function used to speficy the stack order
  22292. * @param (com.ibm.rave.core.selector.ValueFunction) newOrderFn
  22293. * @return (com.ibm.rave.core.layout.StackLayout) this layout
  22294. */
  22295. order$1 : function(newOrderFn) {
  22296. this.orderFn = newOrderFn;
  22297. return this;
  22298. },
  22299. /**
  22300. * Sets the stack order to use, supported types are "inside-out", "reverse" and "default"
  22301. * @param (String) orderType
  22302. * @return (com.ibm.rave.core.layout.StackLayout) this layout
  22303. */
  22304. order$2 : function(orderType) {
  22305. var requestedOrderFn = com_ibm_rave_core_layout_StackLayout.r2_layout_stackOrders.get(orderType);
  22306. if (!requestedOrderFn) {
  22307. requestedOrderFn = com_ibm_rave_core_layout_StackLayout.DEFAULT_STACKORDER_FUNCTION;
  22308. }
  22309. this.orderFn = requestedOrderFn;
  22310. return this;
  22311. },
  22312. /**
  22313. * Gets the stack offset algorithm
  22314. * @return (com.ibm.rave.core.selector.ValueFunction) stack offset algorithm
  22315. */
  22316. offset$0 : function() {
  22317. return this.offsetFn;
  22318. },
  22319. /**
  22320. * Sets the stack order algorithm
  22321. * @param (com.ibm.rave.core.selector.ValueFunction) newOffsetFn
  22322. * @return (com.ibm.rave.core.layout.StackLayout) this layout
  22323. */
  22324. offset$1 : function(newOffsetFn) {
  22325. this.offsetFn = newOffsetFn;
  22326. return this;
  22327. },
  22328. /**
  22329. * Sets the stack order algorithm type, supported types are : "silhouette", "wiggle", "expand"and "zero"
  22330. * @param (String) offsetType
  22331. * @return (com.ibm.rave.core.layout.StackLayout) this
  22332. */
  22333. offset$2 : function(offsetType) {
  22334. var requestedOffsetFn = com_ibm_rave_core_layout_StackLayout.r2_layout_stackOffsets.get(offsetType);
  22335. if (!requestedOffsetFn) {
  22336. requestedOffsetFn = com_ibm_rave_core_layout_StackLayout.DEFAULT_STACKOFFSETZERO;
  22337. }
  22338. this.offsetFn = requestedOffsetFn;
  22339. return this;
  22340. },
  22341. /** @expose */
  22342. x : function(a0) {
  22343. var args = arguments;
  22344. if (args.length == 0) {
  22345. return this.x$0();
  22346. }
  22347. return this.x$1(a0);
  22348. },
  22349. /** @expose */
  22350. y : function(a0) {
  22351. var args = arguments;
  22352. if (args.length == 0) {
  22353. return this.y$0();
  22354. }
  22355. return this.y$1(a0);
  22356. },
  22357. /** @expose */
  22358. out : function(a0) {
  22359. var args = arguments;
  22360. if (args.length == 0) {
  22361. return this.out$0();
  22362. }
  22363. return this.out$1(a0);
  22364. },
  22365. /** @expose */
  22366. values : function(a0) {
  22367. var args = arguments;
  22368. if (args.length == 0) {
  22369. return this.values$0();
  22370. }
  22371. return this.values$1(a0);
  22372. },
  22373. /** @expose */
  22374. order : function(a0) {
  22375. var args = arguments;
  22376. if (args.length == 0) {
  22377. return this.order$0();
  22378. }
  22379. if (args.length == 1 && typeof a0 === "function") {
  22380. return this.order$1(a0);
  22381. }
  22382. return this.order$2(a0);
  22383. },
  22384. /** @expose */
  22385. offset : function(a0) {
  22386. var args = arguments;
  22387. if (args.length == 0) {
  22388. return this.offset$0();
  22389. }
  22390. if (args.length == 1 && typeof a0 === "function") {
  22391. return this.offset$1(a0);
  22392. }
  22393. return this.offset$2(a0);
  22394. }
  22395. });
  22396. com_ibm_rave_core_layout_StackLayout.initialize_r2_layout_stackOrders = function() {
  22397. var r2_layout_stackOrders = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  22398. r2_layout_stackOrders.set("inside-out", com_ibm_rave_core_layout_StackLayout.STACKORDER_INSIDED_OUT);
  22399. r2_layout_stackOrders.set("reverse", com_ibm_rave_core_layout_StackLayout.STACKORDER_REVERSE);
  22400. r2_layout_stackOrders.set("default", com_ibm_rave_core_layout_StackLayout.DEFAULT_STACKORDER_FUNCTION);
  22401. return r2_layout_stackOrders;
  22402. };
  22403. com_ibm_rave_core_layout_StackLayout.initialize_r2_layout_stackOffsets = function() {
  22404. var r2_layout_stackOffsets = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  22405. r2_layout_stackOffsets.set("silhouette", com_ibm_rave_core_layout_StackLayout.STACKOFFSET_SILHOUETTE);
  22406. r2_layout_stackOffsets.set("wiggle", com_ibm_rave_core_layout_StackLayout.STACKOFFSET_WIGGLE);
  22407. r2_layout_stackOffsets.set("expand", com_ibm_rave_core_layout_StackLayout.STACKOFFSET_EXPAND);
  22408. r2_layout_stackOffsets.set("zero", com_ibm_rave_core_layout_StackLayout.DEFAULT_STACKOFFSETZERO);
  22409. return r2_layout_stackOffsets;
  22410. };
  22411. com_ibm_rave_core_layout_StackLayout.DEFAULT_VALUES_FUNCTION = com_ibm_rave_core_internal_util_Identity.create();
  22412. com_ibm_rave_core_layout_StackLayout.DEFAULT_STACKORDER_FUNCTION = function(data, index, groupIndex) {
  22413. var aData = data;
  22414. return (com_ibm_rave_core_arrays_Range.create(aData.length));
  22415. };
  22416. com_ibm_rave_core_layout_StackLayout.DEFAULT_STACKOFFSETZERO = function(data, index, groupIndex) {
  22417. var j = -1;
  22418. var child = ((data)[0]);
  22419. var m = child.length;
  22420. var y0 = [];
  22421. while (++j < m) {
  22422. y0[j] = 0;
  22423. }
  22424. return y0;
  22425. };
  22426. com_ibm_rave_core_layout_StackLayout.DEFAULT_OUT_FUNCTION = function(stackNode, y0, y) {
  22427. var node = stackNode;
  22428. node["y0"] = y0;
  22429. node["y"] = y;
  22430. };
  22431. com_ibm_rave_core_layout_StackLayout.DEFAULT_X_FUNCTION = function(data, index, groupIndex) {
  22432. return (data)["x"];
  22433. };
  22434. com_ibm_rave_core_layout_StackLayout.DEFAULT_Y_FUNCTION = function(data, index, groupIndex) {
  22435. return (data)["y"];
  22436. };
  22437. com_ibm_rave_core_layout_StackLayout.r2_layout_stackMaxIndex = function(currentValue, index, array) {
  22438. var i = 1;
  22439. var j = 0;
  22440. var parentArray = currentValue[0];
  22441. var v = parentArray[1];
  22442. var k = 0;
  22443. var n = array.length;
  22444. for (i = 0; i < n; ++i) {
  22445. parentArray = currentValue[i];
  22446. k = parentArray[1];
  22447. if (k > v) {
  22448. j = i;
  22449. v = k;
  22450. }
  22451. }
  22452. return j;
  22453. };
  22454. com_ibm_rave_core_layout_StackLayout.r2_layout_stackSum = function(previousValue, currentValue, index, array) {
  22455. return previousValue + currentValue[1];
  22456. };
  22457. com_ibm_rave_core_layout_StackLayout.r2_layout_stackReduceSum = function(currentValue, index, array) {
  22458. return currentValue.reduce(com_ibm_rave_core_layout_StackLayout.r2_layout_stackSum, 0);
  22459. };
  22460. com_ibm_rave_core_layout_StackLayout.STACKORDER_REVERSE = function(data, index, groupIndex) {
  22461. var aData = data;
  22462. return (com_ibm_rave_core_arrays_Range.create(aData.length)).reverse();
  22463. };
  22464. com_ibm_rave_core_layout_StackLayout.STACKORDER_INSIDED_OUT = function(data, index, groupIndex) {
  22465. var aData = data;
  22466. var n = aData.length;
  22467. var i = 0;
  22468. var j = 0;
  22469. var max = aData.map(com_ibm_rave_core_layout_StackLayout.r2_layout_stackMaxIndex);
  22470. var sums = aData.map(com_ibm_rave_core_layout_StackLayout.r2_layout_stackReduceSum);
  22471. var sortedIndex = com_ibm_rave_core_Rave.range(n).sort(function(obj1, obj2) {
  22472. return ~~(max[~~+ (obj1)] - max[~~+ (obj2)]);
  22473. });
  22474. var top = 0;
  22475. var bottom = 0;
  22476. var tops = [];
  22477. var bottoms = [];
  22478. for (i = 0; i < n; ++i) {
  22479. j = ~~+ (sortedIndex[i]);
  22480. if (top < bottom) {
  22481. top += sums[j];
  22482. tops.push((j));
  22483. } else {
  22484. bottom += sums[j];
  22485. bottoms.push(~~((j)));
  22486. }
  22487. }
  22488. return bottoms.reverse().concat(tops);
  22489. };
  22490. com_ibm_rave_core_layout_StackLayout.r2_layout_stackOrders = com_ibm_rave_core_layout_StackLayout.initialize_r2_layout_stackOrders();
  22491. com_ibm_rave_core_layout_StackLayout.STACKOFFSET_SILHOUETTE = function(data, index, groupIndex) {
  22492. var aData = data;
  22493. var n = aData.length;
  22494. var m = aData[0].length;
  22495. var sums = [];
  22496. var max = 0;
  22497. var i;
  22498. var j;
  22499. var o;
  22500. var y0 = [];
  22501. for (j = 0; j < m; ++j) {
  22502. for (i = 0, o = 0; i < n; ++i) {
  22503. o += aData[i][j][1];
  22504. }
  22505. if (o > max) {
  22506. max = o;
  22507. }
  22508. sums.push(o);
  22509. }
  22510. for (j = 0; j < m; ++j) {
  22511. y0[j] = max - sums[j] / 2;
  22512. }
  22513. return y0;
  22514. };
  22515. com_ibm_rave_core_layout_StackLayout.STACKOFFSET_WIGGLE = function(data, index, groupIndex) {
  22516. var aData = data;
  22517. var n = aData.length;
  22518. var x = aData[0];
  22519. var m = x.length;
  22520. var i = 0, j = 0, k = 0;
  22521. var s1 = 0, s2 = 0, s3 = 0, dx = 0;
  22522. var o = 0, o0 = 0;
  22523. var y0 = [];
  22524. y0[0] = 0;
  22525. for (j = 1; j < m; ++j) {
  22526. for (i = 0, s1 = 0; i < n; ++i) {
  22527. s1 += aData[i][j][1];
  22528. }
  22529. s2 = 0;
  22530. dx = x[j][0] - x[j - 1][0];
  22531. for (i = 0; i < n; ++i) {
  22532. var isElement = aData[i];
  22533. s3 = (isElement[j][1] - isElement[j - 1][1]) / (2 * dx);
  22534. for (k = 0; k < i; ++k) {
  22535. var ksElement = aData[k];
  22536. s3 += (ksElement[j][1] - ksElement[j - 1][1]) / dx;
  22537. }
  22538. s2 += s3 * isElement[j][1];
  22539. }
  22540. if (s1 != 0) {
  22541. o -= s2 / s1 * dx;
  22542. }
  22543. y0[j] = o;
  22544. if (o < o0) {
  22545. o0 = o;
  22546. }
  22547. }
  22548. for (j = 0; j < m; ++j) {
  22549. var val = y0[j];
  22550. y0[j] = val - o0;
  22551. }
  22552. return y0;
  22553. };
  22554. com_ibm_rave_core_layout_StackLayout.STACKOFFSET_EXPAND = function(data, index, groupIndex) {
  22555. var aData = data;
  22556. var n = aData.length;
  22557. var m = aData[0].length;
  22558. var k = 1 / n;
  22559. var i = 0;
  22560. var j = 0;
  22561. var o = 0;
  22562. var y0 = [];
  22563. for (j = 0; j < m; ++j) {
  22564. for (i = 0, o = 0; i < n; ++i) {
  22565. o += aData[i][j][1];
  22566. }
  22567. if (o != 0) {
  22568. for (i = 0; i < n; ++i) {
  22569. var ijElement = aData[i][j];
  22570. var val = ijElement[1];
  22571. ijElement[1] = val / o;
  22572. }
  22573. } else {
  22574. for (i = 0; i < n; ++i) {
  22575. var ijElement = aData[i][j];
  22576. ijElement[1] = k;
  22577. }
  22578. }
  22579. }
  22580. for (j = 0; j < m; ++j) {
  22581. y0[j] = 0;
  22582. }
  22583. return y0;
  22584. };
  22585. com_ibm_rave_core_layout_StackLayout.r2_layout_stackOffsets = com_ibm_rave_core_layout_StackLayout.initialize_r2_layout_stackOffsets();
  22586. // $source: com/ibm/rave/core/layout/treemap/Treemap
  22587. /************************************************************************
  22588. ** IBM Confidential
  22589. **
  22590. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  22591. **
  22592. ** (C) Copyright IBM Corp. 2015
  22593. **
  22594. ** The source code for this program is not published or otherwise divested of its trade secrets,
  22595. ** irrespective of what has been deposited with the U.S. Copyright Office.
  22596. ************************************************************************/
  22597. // GENERATED
  22598. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  22599. //@import com/ibm/rave/core/layout/hierarchy/HierarchyBase (loadtime) // superclass
  22600. //@import com/ibm/rave/core/internal/layout/treemap/TreemapRect (runtime) // new
  22601. //@import com/ibm/rave/core/layout/hierarchy/HierarchyUtil (runtime) // revalue
  22602. //@import com/ibm/rave/core/internal/layout/treemap/Row (runtime) // new
  22603. /**
  22604. * A Layout for the treemap
  22605. * @author Bryan
  22606. */
  22607. var com_ibm_rave_core_layout_treemap_Treemap = rave_externs["Treemap"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_layout_hierarchy_HierarchyBase, {
  22608. /**
  22609. * @param node
  22610. * @return a rect from the node with no padding
  22611. */
  22612. //treemapPadNull : null,
  22613. /**
  22614. * @param node
  22615. * @param padding
  22616. * @return the new rect with padding
  22617. */
  22618. //treemapPad : null,
  22619. /**
  22620. * An alias to this layout instance
  22621. */
  22622. /** @expose */
  22623. nodes : null,
  22624. //_size : null,
  22625. //_padding : null,
  22626. //_pad : null,
  22627. //_stickies : null,
  22628. //_mode : null,
  22629. //_ratio : null,
  22630. //squarify : null,
  22631. //stickify : null,
  22632. _round : false,
  22633. _sticky : false,
  22634. constructor : function() {
  22635. this.treemapPadNull = function(node) {
  22636. var rect = new com_ibm_rave_core_internal_layout_treemap_TreemapRect();
  22637. rect.x = node["x"];
  22638. rect.y = node["y"];
  22639. rect.dx = node["dx"];
  22640. rect.dy = node["dy"];
  22641. return rect;
  22642. };
  22643. this.treemapPad = function(node, padding) {
  22644. var rect = new com_ibm_rave_core_internal_layout_treemap_TreemapRect();
  22645. rect.x = node["x"] + + (padding[3]);
  22646. rect.y = node["y"] + + (padding[0]);
  22647. rect.dx = node["dx"] - + (padding[1]) - + (padding[3]);
  22648. rect.dy = node["dy"] - + (padding[0]) - + (padding[2]);
  22649. if (rect.dx < 0) {
  22650. rect.x += rect.dx / 2;
  22651. rect.dx = 0;
  22652. }
  22653. if (rect.dy < 0) {
  22654. rect.y += rect.dy / 2;
  22655. rect.dy = 0;
  22656. }
  22657. return rect;
  22658. };
  22659. /**
  22660. * Creates a new treemap layout with the default settings: the default sort order is by descending value; the default value accessor assumes each input data is an object with a numeric value attribute; the default children accessor assumes each input data is an object with a children array; the default size is 1×1.
  22661. */
  22662. {
  22663. this._round = true;
  22664. this._size = [1, 1];
  22665. this._padding = null;
  22666. this._pad = this.treemapPadNull;
  22667. this._sticky = false;
  22668. this._stickies = null;
  22669. this._mode = "squarify";
  22670. this._ratio = 0.5 * (1 + Math.sqrt(5));
  22671. this.nodes = this;
  22672. var self = this;
  22673. this.squarify = function(node, index, array) {
  22674. var children = node["children"];
  22675. if (children && children.length != 0) {
  22676. var rect = self._pad(node);
  22677. var row = new com_ibm_rave_core_internal_layout_treemap_Row();
  22678. var remaining = children.slice();
  22679. var child;
  22680. var best = Infinity;
  22681. var score = 0;
  22682. var u = self._mode == "slice" ? rect.dx : self._mode == "dice" ? rect.dy : self._mode == "slice-dice" ? (node["depth"] & 1) ? rect.dy : rect.dx : Math.min(rect.dx, rect.dy);
  22683. var n;
  22684. self.scale(remaining, rect.dx * rect.dy / node["value"]);
  22685. row.area = 0;
  22686. while ((n = remaining.length) > 0) {
  22687. row.push(child = remaining[n - 1]);
  22688. row.area += child["area"];
  22689. if (!(self._mode == "squarify") || (score = self.worst(row, u)) <= best) {
  22690. remaining.pop();
  22691. best = score;
  22692. } else {
  22693. row.area -= row.pop()["area"];
  22694. self.position(row, u, rect, false);
  22695. u = Math.min(rect.dx, rect.dy);
  22696. row = new com_ibm_rave_core_internal_layout_treemap_Row();
  22697. best = Infinity;
  22698. }
  22699. }
  22700. if (row.length != 0) {
  22701. self.position(row, u, rect, true);
  22702. row = new com_ibm_rave_core_internal_layout_treemap_Row();
  22703. }
  22704. children.forEach(self.squarify);
  22705. }
  22706. return null;
  22707. };
  22708. this.stickify = function(node, index, array) {
  22709. var children = node["children"];
  22710. if (children && children.length != 0) {
  22711. var rect = self._pad(node);
  22712. var remaining = children.slice();
  22713. var child;
  22714. var row = new com_ibm_rave_core_internal_layout_treemap_Row();
  22715. self.scale(remaining, rect.dx * rect.dy / node["value"]);
  22716. row.area = 0;
  22717. while ((child = remaining.pop())) {
  22718. row.push(child);
  22719. row.area += child["area"];
  22720. if (child["z"] != null) {
  22721. self.position(row, child["z"] ? rect.dx : rect.dy, rect, remaining.length == 0);
  22722. row = new com_ibm_rave_core_internal_layout_treemap_Row();
  22723. }
  22724. }
  22725. children.forEach(self.stickify);
  22726. }
  22727. return null;
  22728. };
  22729. }
  22730. },
  22731. /**
  22732. * Compute the area for each child based on value & scale
  22733. * @param (Array) children
  22734. * @param (double) k
  22735. */
  22736. scale : function(children, k) {
  22737. var i = -1;
  22738. var n = children.length;
  22739. var child;
  22740. var area;
  22741. while (++i < n) {
  22742. area = (child = children[i])["value"] * (k < 0 ? 0 : k);
  22743. child["area"] = isNaN(area) || area <= 0 ? 0 : area;
  22744. }
  22745. },
  22746. /**
  22747. * Computes the score for the specified row, as the worst aspect ratio
  22748. * @param (com.ibm.rave.core.internal.layout.treemap.Row) row
  22749. * @param (double) u
  22750. * @return (double) the score for the specified row
  22751. */
  22752. worst : function(row, u) {
  22753. var s = row.area;
  22754. var r;
  22755. var rmax = 0;
  22756. var rmin = Infinity;
  22757. var i = -1;
  22758. var n = row.length;
  22759. while (++i < n) {
  22760. if ((r = row[i]["area"]) == 0) {
  22761. continue;
  22762. }
  22763. if (r < rmin) {
  22764. rmin = r;
  22765. }
  22766. if (r > rmax) {
  22767. rmax = r;
  22768. }
  22769. }
  22770. s *= s;
  22771. u *= u;
  22772. return s != 0 ? Math.max((u * rmax * this._ratio) / s, s / (u * rmin * this._ratio)) : Infinity;
  22773. },
  22774. /**
  22775. * Positions the specified row of nodes. modifies "rect"
  22776. * @param (com.ibm.rave.core.internal.layout.treemap.Row) row
  22777. * @param (double) u
  22778. * @param (com.ibm.rave.core.internal.layout.treemap.TreemapRect) rect
  22779. * @param (boolean) flush
  22780. */
  22781. position : function(row, u, rect, flush) {
  22782. var i = -1;
  22783. var n = row.length;
  22784. var x = rect.x;
  22785. var y = rect.y;
  22786. var v = u != 0 ? this.roundFunction(row.area / u) : 0;
  22787. if (u == rect.dx) {
  22788. var o = null;
  22789. if (flush || v > rect.dy) {
  22790. v = rect.dy;
  22791. }
  22792. while (++i < n) {
  22793. o = row[i];
  22794. o["x"] = x;
  22795. o["y"] = y;
  22796. o["dy"] = v;
  22797. x += o["dx"] = Math.min(rect.x + rect.dx - x, v != 0 ? this.roundFunction(o["area"] / v) : 0);
  22798. }
  22799. if (o) {
  22800. o["z"] = true;
  22801. o["dx"] += rect.x + rect.dx - x;
  22802. rect.y += v;
  22803. rect.dy -= v;
  22804. }
  22805. } else {
  22806. var o = null;
  22807. if (flush || v > rect.dx) {
  22808. v = rect.dx;
  22809. }
  22810. while (++i < n) {
  22811. o = row[i];
  22812. o["x"] = x;
  22813. o["y"] = y;
  22814. o["dx"] = v;
  22815. y += o["dy"] = Math.min(rect.y + rect.dy - y, v != 0 ? this.roundFunction(o["area"] / v) : 0);
  22816. }
  22817. if (o) {
  22818. o["z"] = false;
  22819. o["dy"] += rect.y + rect.dy - y;
  22820. rect.x += v;
  22821. rect.dx -= v;
  22822. }
  22823. }
  22824. },
  22825. /**
  22826. * Runs the treemap layout, returning the array of nodes associated with the specified root node. The treemap layout is part of D3's family of hierarchical layouts. These layouts follow the same basic structure: the input argument to the layout is the root node of the hierarchy, and the output return value is an array representing the computed positions of all nodes. Several attributes are populated on each node: parent - the parent node, or null for the root. children - the array of child nodes, or null for leaf nodes. value - the node value, as returned by the value accessor. depth - the depth of the node, starting at 0 for the root. x - the minimum x-coordinate of the node position. y - the minimum y-coordinate of the node position. dx - the x-extent of the node position. dy - the y-extent of the node position. Note that this will modify the nodes that you pass in! Although the layout has a size in x and y, this represents an arbitrary coordinate system; for example, you can treat x as a radius and y as an angle to produce a radial rather than Cartesian layout. In Cartesian orientation, x, y, dx and dy correspond to the "x", "y", "width" and "height" attributes of the SVG rect element.
  22827. * @param rootNode The root node of the treemap * @param i the index (currently unused)
  22828. * @return (Array) an array of all the nodes in the treemap
  22829. */
  22830. doCreate$0 : function(d, i) {
  22831. var nodes = (this._stickies) ? this._stickies : com_ibm_rave_core_layout_hierarchy_HierarchyBase.prototype.doCreate.call(this, d, i);
  22832. var root = nodes[0];
  22833. root["x"] = 0;
  22834. root["y"] = 0;
  22835. root["dx"] = this._size[0];
  22836. root["dy"] = this._size[1];
  22837. if (this._stickies) {
  22838. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.revalue(root, this);
  22839. }
  22840. this.scale([root], root["dx"] * root["dy"] / root["value"]);
  22841. (this._stickies ? this.stickify : this.squarify)(root, 0, [root]);
  22842. if (this._sticky) {
  22843. this._stickies = nodes;
  22844. }
  22845. return nodes;
  22846. },
  22847. /**
  22848. * If size is specified, sets the available layout size to the specified two-element array of numbers representing x and y. If size is not specified, returns the current size, which defaults to 1×1.
  22849. * @return (Array) the size array as a list with two values
  22850. */
  22851. size$0 : function() {
  22852. return this._size;
  22853. },
  22854. /**
  22855. * If size is specified, sets the available layout size to the specified two-element array of numbers representing x and y. If size is not specified, returns the current size, which defaults to 1×1.
  22856. * @param (Array) size the size to set as a list with two values
  22857. * @return (com.ibm.rave.core.layout.treemap.Treemap) this instance of the treemap
  22858. */
  22859. size$1 : function(size) {
  22860. this._size = size;
  22861. return this;
  22862. },
  22863. /**
  22864. * Get or set the padding for each treemap cell, in pixels. The padding determines the amount of extra space to reserve between the parent and its children; this space can be used to indicate the hierarchy through enclosure, or to reserve space for parent labels. If no padding is used, then the leaves of the tree will completely fill the layout's size. If padding is specified, sets the new padding and returns the treemap layout; if padding is not specified, returns the current padding. The padding may be specified several ways: A null value disables padding; null is equivalent to zero. A number indicates uniform padding, in pixels, on all four sides. An array of numbers indicates the top, right, bottom and left padding values. The padding may also be specified as a function which returns one of the three above values. This function is evaluated for each internal (non-leaf) node, and can be used to compute padding dynamically.
  22865. * @return (Object) the padding
  22866. */
  22867. padding$0 : function() {
  22868. return this._padding;
  22869. },
  22870. /**
  22871. * Get or set the padding for each treemap cell, in pixels. The padding determines the amount of extra space to reserve between the parent and its children; this space can be used to indicate the hierarchy through enclosure, or to reserve space for parent labels. If no padding is used, then the leaves of the tree will completely fill the layout's size. If padding is specified, sets the new padding and returns the treemap layout; if padding is not specified, returns the current padding. The padding may be specified several ways: A null value disables padding; null is equivalent to zero. A number indicates uniform padding, in pixels, on all four sides. An array of numbers indicates the top, right, bottom and left padding values. The padding may also be specified as a function which returns one of the three above values. This function is evaluated for each internal (non-leaf) node, and can be used to compute padding dynamically.
  22872. * @param (double) padding a single value to be added to all four sides of the treemap
  22873. * @return (com.ibm.rave.core.layout.treemap.Treemap) this instance of the treemap
  22874. */
  22875. padding$1 : function(padding) {
  22876. return this.padding$2([padding]);
  22877. },
  22878. /**
  22879. * Get or set the padding for each treemap cell, in pixels. The padding determines the amount of extra space to reserve between the parent and its children; this space can be used to indicate the hierarchy through enclosure, or to reserve space for parent labels. If no padding is used, then the leaves of the tree will completely fill the layout's size. If padding is specified, sets the new padding and returns the treemap layout; if padding is not specified, returns the current padding. The padding may be specified several ways: A null value disables padding; null is equivalent to zero. A number indicates uniform padding, in pixels, on all four sides. An array of numbers indicates the top, right, bottom and left padding values. The padding may also be specified as a function which returns one of the three above values. This function is evaluated for each internal (non-leaf) node, and can be used to compute padding dynamically.
  22880. * @param (Array) padding a list of doubles which must contain four values, one for each side
  22881. * @return (com.ibm.rave.core.layout.treemap.Treemap) this instance of the treemap
  22882. */
  22883. padding$2 : function(padding) {
  22884. var self = this;
  22885. var padConstant = function(node) {
  22886. return self.treemapPad(node, padding.length == 1 ? [padding[0], padding[0], padding[0], padding[0]] : padding);
  22887. };
  22888. this._padding = padding;
  22889. this._pad = this._padding == null || padding.length == 0 ? this.treemapPadNull : padConstant;
  22890. return this;
  22891. },
  22892. /**
  22893. * Get or set the padding for each treemap cell, in pixels. The padding determines the amount of extra space to reserve between the parent and its children; this space can be used to indicate the hierarchy through enclosure, or to reserve space for parent labels. If no padding is used, then the leaves of the tree will completely fill the layout's size. If padding is specified, sets the new padding and returns the treemap layout; if padding is not specified, returns the current padding. The padding may be specified several ways: A null value disables padding; null is equivalent to zero. A number indicates uniform padding, in pixels, on all four sides. An array of numbers indicates the top, right, bottom and left padding values. The padding may also be specified as a function which returns one of the three above values. This function is evaluated for each internal (non-leaf) node, and can be used to compute padding dynamically.
  22894. * @param (com.ibm.rave.core.functions.TwoParamValueFunction) padding a function which must return a single value of a list of four values
  22895. * @return (com.ibm.rave.core.layout.treemap.Treemap) this instance of the treemap
  22896. */
  22897. padding$3 : function(padding) {
  22898. var self = this;
  22899. var padFunction = function(node) {
  22900. var pObject = padding(node, node["depth"]);
  22901. var p = null;
  22902. if ((typeof pObject === "number" || pObject instanceof Number)) {
  22903. p = [+ (pObject), + (pObject), + (pObject), + (pObject)];
  22904. } else if ((typeof pObject === "array" || pObject instanceof Array)) {
  22905. var pList = pObject;
  22906. p = [];
  22907. for (var __i_enFor0 = 0, __exp_enFor0 = pList, __len_enFor0 = __exp_enFor0.length;
  22908. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  22909. var o = __exp_enFor0[__i_enFor0];
  22910. p.push(o);
  22911. }
  22912. }
  22913. return !p ? self.treemapPadNull(node) : self.treemapPad(node, p);
  22914. };
  22915. this._padding = padding;
  22916. this._pad = this._padding == null ? this.treemapPadNull : padFunction;
  22917. return this;
  22918. },
  22919. /**
  22920. * If round is specified, sets whether or not the treemap layout will round to exact pixel boundaries. This can be nice to avoid antialiasing artifacts in SVG. If round is not specified, returns whether the treemap will be rounded.
  22921. * @return (boolean) round
  22922. */
  22923. round$0 : function() {
  22924. return this._round;
  22925. },
  22926. /**
  22927. * If round is specified, sets whether or not the treemap layout will round to exact pixel boundaries. This can be nice to avoid antialiasing artifacts in SVG. If round is not specified, returns whether the treemap will be rounded.
  22928. * @param (boolean) round boolean to indicate whether the treemap should round
  22929. * @return (com.ibm.rave.core.layout.treemap.Treemap) this instance of the treemap
  22930. */
  22931. round$1 : function(round) {
  22932. this._round = round;
  22933. return this;
  22934. },
  22935. /**
  22936. * The rounding function
  22937. * @param (Number) value the value to round
  22938. * @return (double) the rounded value
  22939. */
  22940. roundFunction : function(value) {
  22941. if (this._round) {
  22942. return Math.round(value);
  22943. }
  22944. return value;
  22945. },
  22946. /**
  22947. * If sticky is specified, sets whether or not the treemap layout is "sticky": a sticky treemap layout will preserve the relative arrangement of nodes across transitions. The allocation of nodes into squarified horizontal and vertical rows is persisted across updates by storing a z attribute on the last element in each row; this allows nodes to be resized smoothly, without shuffling or occlusion that would impede perception of changing values. Note, however, that this results in a suboptimal layout for one of the two states. If sticky is not specified, returns whether the treemap layout is sticky. Implementation note: sticky treemaps cache the array of nodes internally; therefore, it is not possible to reuse the same layout instance on multiple datasets. To reset the cached state when switching datasets with a sticky layout, call sticky(true) again. Since version 1.25.0, hierarchy layouts no longer copy the input data by default on each invocation, so it may be possible to eliminate caching and make the layout fully stateless.
  22948. * @return (boolean) sticky
  22949. */
  22950. sticky$0 : function() {
  22951. return this._sticky;
  22952. },
  22953. /**
  22954. * If sticky is specified, sets whether or not the treemap layout is "sticky": a sticky treemap layout will preserve the relative arrangement of nodes across transitions. The allocation of nodes into squarified horizontal and vertical rows is persisted across updates by storing a z attribute on the last element in each row; this allows nodes to be resized smoothly, without shuffling or occlusion that would impede perception of changing values. Note, however, that this results in a suboptimal layout for one of the two states. If sticky is not specified, returns whether the treemap layout is sticky. Implementation note: sticky treemaps cache the array of nodes internally; therefore, it is not possible to reuse the same layout instance on multiple datasets. To reset the cached state when switching datasets with a sticky layout, call sticky(true) again. Since version 1.25.0, hierarchy layouts no longer copy the input data by default on each invocation, so it may be possible to eliminate caching and make the layout fully stateless.
  22955. * @param (boolean) sticky a boolean to indicates whether to keep the nodes in this instance
  22956. * @return (com.ibm.rave.core.layout.treemap.Treemap) this instance of the treemap
  22957. */
  22958. sticky$1 : function(sticky) {
  22959. this._sticky = sticky;
  22960. this._stickies = null;
  22961. return this;
  22962. },
  22963. /**
  22964. * If ratio is specified, sets the layout ratio. If ratio is not specified, returns the current layout ratio, which defaults to .5 * (1 + Math.sqrt(5))
  22965. * @return (double) the ratio
  22966. */
  22967. ratio$0 : function() {
  22968. return this._ratio;
  22969. },
  22970. /**
  22971. * If ratio is specified, sets the layout ratio. If ratio is not specified, returns the current layout ratio, which defaults to .5 * (1 + Math.sqrt(5))
  22972. * @param (double) ratio the value used to compute the score for the specified row
  22973. * @return (com.ibm.rave.core.layout.treemap.Treemap) this instance of the treemap
  22974. */
  22975. ratio$1 : function(ratio) {
  22976. this._ratio = ratio;
  22977. return this;
  22978. },
  22979. /**
  22980. * If mode is specified, sets the layout algorithm. If mode is not specified, returns the current layout algorithm, which defaults to "squarify". The following modes are supported: squarify - rectangular subdivision; squareness controlled via the target ratio. slice - horizontal subdivision. dice - vertical subdivision. slice-dice - alternating between horizontal and vertical subdivision.
  22981. * @return (String) the mode
  22982. */
  22983. mode$0 : function() {
  22984. return this._mode;
  22985. },
  22986. /**
  22987. * If mode is specified, sets the layout algorithm. If mode is not specified, returns the current layout algorithm, which defaults to "squarify". The following modes are supported: squarify - rectangular subdivision; squareness controlled via the target ratio. slice - horizontal subdivision. dice - vertical subdivision. slice-dice - alternating between horizontal and vertical subdivision.
  22988. * @param (String) mode the mode to use to organize the treemap layout
  22989. * @return (com.ibm.rave.core.layout.treemap.Treemap) this instance of the treemap
  22990. */
  22991. mode$1 : function(mode) {
  22992. this._mode = mode + "";
  22993. return this;
  22994. },
  22995. /** @expose */
  22996. doCreate : function(a0, a1) {
  22997. var args = arguments;
  22998. return this.doCreate$0(a0, a1);
  22999. },
  23000. /** @expose */
  23001. size : function(a0) {
  23002. var args = arguments;
  23003. if (args.length == 0) {
  23004. return this.size$0();
  23005. }
  23006. return this.size$1(a0);
  23007. },
  23008. /** @expose */
  23009. padding : function(a0) {
  23010. var args = arguments;
  23011. if (args.length == 0) {
  23012. return this.padding$0();
  23013. }
  23014. if (args.length == 1 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]")) {
  23015. return this.padding$2(a0);
  23016. }
  23017. if (args.length == 1 && typeof a0 === "function") {
  23018. return this.padding$3(a0);
  23019. }
  23020. return this.padding$1(a0);
  23021. },
  23022. /** @expose */
  23023. round : function(a0) {
  23024. var args = arguments;
  23025. if (args.length == 0) {
  23026. return this.round$0();
  23027. }
  23028. return this.round$1(a0);
  23029. },
  23030. /** @expose */
  23031. sticky : function(a0) {
  23032. var args = arguments;
  23033. if (args.length == 0) {
  23034. return this.sticky$0();
  23035. }
  23036. return this.sticky$1(a0);
  23037. },
  23038. /** @expose */
  23039. ratio : function(a0) {
  23040. var args = arguments;
  23041. if (args.length == 0) {
  23042. return this.ratio$0();
  23043. }
  23044. return this.ratio$1(a0);
  23045. },
  23046. /** @expose */
  23047. mode : function(a0) {
  23048. var args = arguments;
  23049. if (args.length == 0) {
  23050. return this.mode$0();
  23051. }
  23052. return this.mode$1(a0);
  23053. }
  23054. });
  23055. // $source: com/ibm/rave/core/internal/layout/treemap/TreemapRect
  23056. /************************************************************************
  23057. ** IBM Confidential
  23058. **
  23059. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  23060. **
  23061. ** (C) Copyright IBM Corp. 2015
  23062. **
  23063. ** The source code for this program is not published or otherwise divested of its trade secrets,
  23064. ** irrespective of what has been deposited with the U.S. Copyright Office.
  23065. ************************************************************************/
  23066. // GENERATED
  23067. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  23068. var com_ibm_rave_core_internal_layout_treemap_TreemapRect = com_ibm_rave_core_nativeImpl_Declare({
  23069. x : 0, dx : 0, y : 0, dy : 0,
  23070. constructor : function() {
  23071. this.x = 0;
  23072. this.y = 0;
  23073. this.dx = 0;
  23074. this.dy = 0;
  23075. }
  23076. });
  23077. // $source: com/ibm/rave/core/internal/layout/treemap/Row
  23078. /************************************************************************
  23079. ** IBM Confidential
  23080. **
  23081. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  23082. **
  23083. ** (C) Copyright IBM Corp. 2015
  23084. **
  23085. ** The source code for this program is not published or otherwise divested of its trade secrets,
  23086. ** irrespective of what has been deposited with the U.S. Copyright Office.
  23087. ************************************************************************/
  23088. // GENERATED
  23089. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  23090. /**
  23091. * A treemap row... it's just an Array with an area... clearly
  23092. * @author Bryan
  23093. */
  23094. var com_ibm_rave_core_internal_layout_treemap_Row = com_ibm_rave_core_nativeImpl_Declare(Array, {
  23095. area : 0
  23096. });
  23097. // $source: com/ibm/rave/core/layout/PieLayout
  23098. /************************************************************************
  23099. ** IBM Confidential
  23100. **
  23101. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  23102. **
  23103. ** (C) Copyright IBM Corp. 2015
  23104. **
  23105. ** The source code for this program is not published or otherwise divested of its trade secrets,
  23106. ** irrespective of what has been deposited with the U.S. Copyright Office.
  23107. ************************************************************************/
  23108. // GENERATED
  23109. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  23110. //@import com/ibm/rave/core/Rave (runtime) // sum
  23111. //@import com/ibm/rave/core/arrays/Range (runtime) // create
  23112. var com_ibm_rave_core_layout_PieLayout = rave_externs["PieLayout"] = com_ibm_rave_core_nativeImpl_Declare({
  23113. //_value : null,
  23114. //_sort : null,
  23115. //_endAngle : null,
  23116. _startAngle : 0,
  23117. _padAngle : 0,
  23118. sortDefined : false,
  23119. _$functionClassMethod : function() {
  23120. var _$self = function(a0, a1) {
  23121. var args = arguments;
  23122. if (args.length == 1) {
  23123. return _$self.pie$0(a0);
  23124. }
  23125. return _$self.pie$1(a0, a1);
  23126. };
  23127. return _$self;
  23128. },
  23129. constructor : function() {
  23130. this._value = com_ibm_rave_core_layout_PieLayout.VALUE;
  23131. this._endAngle = 6.283185307179586;
  23132. },
  23133. /**
  23134. * Calculates the arc data on the specified array of values. An optional index may be specified, which is passed along to the start and end angle functions.
  23135. * @param (Array) info Data used to construct arc data
  23136. * @return (com.ibm.rave.core.layout.SliceData[]) sliceData Slice data used to construct the arcs
  23137. */
  23138. pie$0 : function(info) {
  23139. return this(info, -1);
  23140. },
  23141. /**
  23142. * Calculates the arc data on the specified array of values. An optional index may be specified, which is passed along to the start and end angle functions.
  23143. * @param (Array) data Data used to construct arc data
  23144. * @return (com.ibm.rave.core.layout.SliceData[]) sliceData Slice data used to construct the arcs
  23145. */
  23146. pie$1 : function(data, index) {
  23147. var values;
  23148. var self = this;
  23149. var n = data.length;
  23150. values = data.map(function(currentValue, i, array) {
  23151. return + (self._value.call(self, currentValue, i, -1));
  23152. });
  23153. var a = + ((typeof this._startAngle === "function") ? (this._startAngle).call(this, data, index, -1) : this._startAngle);
  23154. var da = + ((typeof this._endAngle === "function") ? (this._endAngle).call(this, data, index, -1) : this._endAngle) - a;
  23155. var p = Math.min(Math.abs(da) / n, + ((typeof this._padAngle === "function") ? (this._padAngle).call(this, data, index, -1) : this._padAngle));
  23156. var pa = p * (da < 0 ? -1 : 1);
  23157. var k = (da - n * pa) / (com_ibm_rave_core_Rave.sum(values));
  23158. var indexArr = com_ibm_rave_core_arrays_Range.create(data.length);
  23159. if (!this.sortDefined) {
  23160. indexArr.sort(function(i, j) {
  23161. return (values[~~ (j)] - values[~~ (i)]);
  23162. });
  23163. } else if (this.sortDefined && this._sort) {
  23164. indexArr.sort(function(i, j) {
  23165. return self._sort(data[~~ (i)], data[~~ (j)]);
  23166. });
  23167. }
  23168. var arcs = [];
  23169. for (var __i_enFor0 = 0, __exp_enFor0 = indexArr, __len_enFor0 = __exp_enFor0.length;
  23170. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  23171. var j = __exp_enFor0[__i_enFor0];
  23172. var sd = {};
  23173. var v = sd["value"] = values[~~ (j)];
  23174. sd["data"] = data[~~ (j)];
  23175. sd["startAngle"] = a;
  23176. sd["endAngle"] = a += v * k + pa;
  23177. sd["innerRadius"] = 0;
  23178. sd["outerRadius"] = 0;
  23179. sd["padAngle"] = p;
  23180. arcs[~~ (j)] = sd;
  23181. }
  23182. return arcs;
  23183. },
  23184. /**
  23185. * sets the start angle value function, function that will be called by the arc class to get the value on start angle
  23186. * @param (com.ibm.rave.core.selector.ValueFunction) startAngleFn the start angle function
  23187. * @return (com.ibm.rave.core.layout.PieLayout) this
  23188. */
  23189. startAngle$0 : function(startAngleFn) {
  23190. this._startAngle = startAngleFn;
  23191. return this;
  23192. },
  23193. /**
  23194. * sets the start angle value
  23195. * @param (Object) value the start angle value
  23196. * @return (com.ibm.rave.core.layout.PieLayout) this
  23197. */
  23198. startAngle$1 : function(value) {
  23199. this._startAngle = value;
  23200. return this;
  23201. },
  23202. /**
  23203. * gets the start angle value function
  23204. * @return (Object) the value function
  23205. */
  23206. startAngle$2 : function() {
  23207. return this._startAngle;
  23208. },
  23209. /**
  23210. * sets the end angle value function, function that will be called by the arc class to get the value on end angle
  23211. * @param (com.ibm.rave.core.selector.ValueFunction) endAngleFn the end angle function
  23212. * @return (com.ibm.rave.core.layout.PieLayout) this
  23213. */
  23214. endAngle$0 : function(endAngleFn) {
  23215. this._endAngle = endAngleFn;
  23216. return this;
  23217. },
  23218. /**
  23219. * sets the end angle value
  23220. * @param (Object) value the end angle value
  23221. * @return (com.ibm.rave.core.layout.PieLayout) this
  23222. */
  23223. endAngle$1 : function(value) {
  23224. this._endAngle = value;
  23225. return this;
  23226. },
  23227. /**
  23228. * gets the end angle value function
  23229. * @return (Object) the value function
  23230. */
  23231. endAngle$2 : function() {
  23232. return this._endAngle;
  23233. },
  23234. /**
  23235. * sets the function for computing data values, function that will be called by the PieLayout class to get the data values
  23236. * @param (com.ibm.rave.core.selector.ValueFunction) valueFn The function for computing data values
  23237. * @return (com.ibm.rave.core.layout.PieLayout) this
  23238. */
  23239. value$0 : function(valueFn) {
  23240. this._value = valueFn;
  23241. return this;
  23242. },
  23243. /**
  23244. * gets the data value function
  23245. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  23246. */
  23247. value$1 : function() {
  23248. return this._value;
  23249. },
  23250. /**
  23251. * sets the pad Angle value function, function that will be called by the arc class to get the value on pad Angle
  23252. * @param (com.ibm.rave.core.selector.ValueFunction) padAngleFn the padAngle function
  23253. * @return (com.ibm.rave.core.layout.PieLayout) this
  23254. */
  23255. padAngle$0 : function(padAngleFn) {
  23256. this._padAngle = padAngleFn;
  23257. return this;
  23258. },
  23259. /**
  23260. * sets the pad Angle value
  23261. * @param (Object) value the pad Angle value
  23262. * @return (com.ibm.rave.core.layout.PieLayout) this
  23263. */
  23264. padAngle$1 : function(value) {
  23265. this._padAngle = value;
  23266. return this;
  23267. },
  23268. /**
  23269. * gets the pad Angle value function
  23270. * @return (Object) the value function
  23271. */
  23272. padAngle$2 : function() {
  23273. return this._padAngle;
  23274. },
  23275. /**
  23276. * sets the comparator for sorting
  23277. * @param (com.ibm.rave.core.util.Comparator) sortFn the sort comparator
  23278. * @return (com.ibm.rave.core.layout.PieLayout) this
  23279. */
  23280. sort$0 : function(sortFn) {
  23281. this.sortDefined = true;
  23282. this._sort = sortFn;
  23283. return this;
  23284. },
  23285. /**
  23286. * gets the sort comparator
  23287. * @return (com.ibm.rave.core.util.Comparator) the value function
  23288. */
  23289. sort$1 : function() {
  23290. return this._sort;
  23291. },
  23292. /** @expose */
  23293. startAngle : function(a0) {
  23294. var args = arguments;
  23295. if (args.length == 0) {
  23296. return this.startAngle$2();
  23297. }
  23298. if (args.length == 1 && typeof a0 === "function") {
  23299. return this.startAngle$0(a0);
  23300. }
  23301. return this.startAngle$1(a0);
  23302. },
  23303. /** @expose */
  23304. endAngle : function(a0) {
  23305. var args = arguments;
  23306. if (args.length == 0) {
  23307. return this.endAngle$2();
  23308. }
  23309. if (args.length == 1 && typeof a0 === "function") {
  23310. return this.endAngle$0(a0);
  23311. }
  23312. return this.endAngle$1(a0);
  23313. },
  23314. /** @expose */
  23315. value : function(a0) {
  23316. var args = arguments;
  23317. if (args.length == 0) {
  23318. return this.value$1();
  23319. }
  23320. return this.value$0(a0);
  23321. },
  23322. /** @expose */
  23323. padAngle : function(a0) {
  23324. var args = arguments;
  23325. if (args.length == 0) {
  23326. return this.padAngle$2();
  23327. }
  23328. if (args.length == 1 && typeof a0 === "function") {
  23329. return this.padAngle$0(a0);
  23330. }
  23331. return this.padAngle$1(a0);
  23332. },
  23333. /** @expose */
  23334. sort : function(a0) {
  23335. var args = arguments;
  23336. if (args.length == 0) {
  23337. return this.sort$1();
  23338. }
  23339. return this.sort$0(a0);
  23340. }
  23341. });
  23342. /**
  23343. * Default value function for value calculation.
  23344. */
  23345. com_ibm_rave_core_layout_PieLayout.VALUE = function(data, index, groupIndex) {
  23346. return + (data);
  23347. };
  23348. // $source: com/ibm/rave/core/layout/HistogramLayout
  23349. /************************************************************************
  23350. ** IBM Confidential
  23351. **
  23352. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  23353. **
  23354. ** (C) Copyright IBM Corp. 2015
  23355. **
  23356. ** The source code for this program is not published or otherwise divested of its trade secrets,
  23357. ** irrespective of what has been deposited with the U.S. Copyright Office.
  23358. ************************************************************************/
  23359. // GENERATED
  23360. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  23361. //@import com/ibm/rave/core/arrays/Bisector (runtime) // Bisector
  23362. //@import com/ibm/rave/core/arrays/MinMax (runtime) // min, max
  23363. /**
  23364. * Histogram layout shows the distribution of data by grouping discrete data points into bins
  23365. */
  23366. var com_ibm_rave_core_layout_HistogramLayout = rave_externs["HistogramLayout"] = com_ibm_rave_core_nativeImpl_Declare({
  23367. //valuerFn : null,
  23368. //ranger : null,
  23369. //binner : null,
  23370. freqencyVal : true,
  23371. _$functionClassMethod : function() {
  23372. var _$self = function(a0, a1) {
  23373. var args = arguments;
  23374. if (args.length == 1) {
  23375. return _$self.histogram$0(a0);
  23376. }
  23377. return _$self.histogram$1(a0, a1);
  23378. };
  23379. return _$self;
  23380. },
  23381. constructor : function() {
  23382. this.valuerFn = com_ibm_rave_core_layout_HistogramLayout.DEFAULT_VALUER_FN;
  23383. this.ranger = com_ibm_rave_core_layout_HistogramLayout.RANGER_DEFAULT_FN;
  23384. this.binner = com_ibm_rave_core_layout_HistogramLayout.DEFAULT_BINNER_FN;
  23385. },
  23386. /**
  23387. * Evaluates the histogram function on the specified array of values. An optional index may be specified, which is passed along to the range and bin function.
  23388. * @param (Array) data The data to be processed
  23389. * @return (Array) An array of arrays, off the data split into it's proper bins, each element in the outer array represents a bin, each bin contains the associated elements from the input values
  23390. */
  23391. histogram$0 : function(data) {
  23392. return this(data, 0);
  23393. },
  23394. /**
  23395. * Evaluates the histogram function on the specified array of values. An optional index may be specified, which is passed along to the range and bin function.
  23396. * @param (Array) data The data to be processed
  23397. * @param (int) index The index that is passed along to the range and bin functions
  23398. * @return (Array) An array of arrays, off the data split into it's proper bins, each element in the outer array represents a bin, each bin contains the associated elements from the input values
  23399. */
  23400. histogram$1 : function(data, index) {
  23401. var bins = [];
  23402. var values = data.map(this.valuerFn);
  23403. var range = this.ranger.call(this, values, index, -1);
  23404. var thresholds = this.binner.call(this, range, values, index);
  23405. var bin;
  23406. var i = -1;
  23407. var n = values.length, m = thresholds.length - 1;
  23408. var k = this.freqencyVal ? 1 : 1 / n, x;
  23409. while (++i < m) {
  23410. bin = [];
  23411. bins[i] = bin;
  23412. bin["dx"] = + (thresholds[i + 1]) - (bin["x"] = + (thresholds[i]));
  23413. bin["y"] = 0;
  23414. }
  23415. if (m > 0) {
  23416. i = -1;
  23417. while (++i < n) {
  23418. x = values[i];
  23419. if (x >= + (range[0]) && x <= + (range[1])) {
  23420. bin = bins[com_ibm_rave_core_arrays_Bisector.bisect(thresholds, (x), 1, m) - 1];
  23421. bin["y"] += k;
  23422. bin.push(data[i]);
  23423. }
  23424. }
  23425. }
  23426. return bins;
  23427. },
  23428. layout_histogramRange : function(values) {
  23429. return [com_ibm_rave_core_arrays_MinMax.min(values), com_ibm_rave_core_arrays_MinMax.max(values)];
  23430. },
  23431. /**
  23432. * Determines if the histogram's `y` value is a count (frequency) or a probability (density). The default value is true.
  23433. * @return (boolean) Whether the calculation is using frequency or density
  23434. */
  23435. frequency$0 : function() {
  23436. return this.freqencyVal;
  23437. },
  23438. /**
  23439. * Specifies whether the histogram's `y` value is a count (frequency) or a probability (density). The default value is true.
  23440. * @param (java.lang.Boolean) x The value to set frequency to.
  23441. * @return (com.ibm.rave.core.layout.HistogramLayout) this
  23442. */
  23443. frequency$1 : function(x) {
  23444. this.freqencyVal = (x);
  23445. return this;
  23446. },
  23447. /**
  23448. * Specifies how to bin values in the histogram. The argument `x` may be specified as a number, in which case the range of values will be split uniformly into the given number of bins. Or, `x` may be an array of threshold values, defining the bins; the specified array must contain the rightmost (upper) value, thus specifying n + 1 values for n bins. Or, `x` may be a function which is evaluated, being passed the range, the array of values, and the current index `i`, returning an array of thresholds. The default bin function will divide the values into uniform bins using Sturges' formula.
  23449. * @return (com.ibm.rave.core.layout.HistogramLayout.HistogramBinSturges) binner
  23450. */
  23451. bins$0 : function() {
  23452. return this.binner;
  23453. },
  23454. /**
  23455. * Specifies how to bin values in the histogram. The argument `x` is a number, in which case the range of values will be split uniformly into the given number of bins.
  23456. * @param (Number) x the range of values will be split uniformly into the given number of bins
  23457. * @return (com.ibm.rave.core.layout.HistogramLayout) this layout
  23458. */
  23459. bins$1 : function(x) {
  23460. this.binner = function(range, values, index) {
  23461. return com_ibm_rave_core_layout_HistogramLayout.layout_histogramBinFixed(range, x);
  23462. };
  23463. return this;
  23464. },
  23465. /**
  23466. * Specifies how to bin values in the histogram. The argument `x` may be an array of threshold values, defining the bins; the specified array must contain the rightmost (upper) value, thus specifying n + 1 values for n bins. Or, `x` may be a function which is evaluated, being passed the range, the array of values, and the current index `i`, returning an array of thresholds. The default bin function will divide the values into uniform bins using Sturges' formula.
  23467. * @param (Object) x An array of threshold values, or a function to call back
  23468. * @return (com.ibm.rave.core.layout.HistogramLayout) this layout
  23469. */
  23470. bins$2 : function(x) {
  23471. if (typeof x === "function") {
  23472. this.binner = x;
  23473. } else {
  23474. this.binner = function(range, values, index) {
  23475. return x;
  23476. };
  23477. }
  23478. return this;
  23479. },
  23480. /**
  23481. * Gets the range of the histogram. The default range is the extent (minimum and maximum) of the values.
  23482. * @return (com.ibm.rave.core.selector.ValueFunction) the ranger function
  23483. */
  23484. range$0 : function() {
  23485. return this.ranger;
  23486. },
  23487. /**
  23488. * Specifies the range of the histogram. Values outside the specified range will be ignored. The argument `x` is a two-element array representing the minimum and maximum value of the range. The default range is the extent (minimum and maximum) of the values.
  23489. * @param (Array) range the range
  23490. * @return (com.ibm.rave.core.layout.HistogramLayout) this layout
  23491. */
  23492. range$1 : function(range) {
  23493. this.ranger = function(data, index, groupIndex) {
  23494. return range;
  23495. };
  23496. return this;
  23497. },
  23498. /**
  23499. * Specifies the range of the histogram. Values outside the specified range will be ignored. The argument `x` is a function that returns the range given the array of values and the current index `i`. The default range is the extent (minimum and maximum) of the values.
  23500. * @param (com.ibm.rave.core.selector.ValueFunction) fn the range function
  23501. * @return (com.ibm.rave.core.layout.HistogramLayout) this layout
  23502. */
  23503. range$2 : function(fn) {
  23504. this.ranger = fn;
  23505. return this;
  23506. },
  23507. /**
  23508. * Return the function used to extract a value from the associated data. The default value function is `Number`, which is equivalent to the identity function.
  23509. * @return (com.ibm.rave.core.collections.ArrayEx.ArrayValueFunction) teh vlaue function
  23510. */
  23511. value$0 : function() {
  23512. return this.valuerFn;
  23513. },
  23514. /**
  23515. * Specifies how to extract a value from the associated data. The default value function is `Number`, which is equivalent to the identity function.
  23516. * @param (com.ibm.rave.core.collections.ArrayEx.ArrayValueFunction) x the value function
  23517. * @return (com.ibm.rave.core.layout.HistogramLayout) this layout
  23518. */
  23519. value$1 : function(x) {
  23520. this.valuerFn = x;
  23521. return this;
  23522. },
  23523. /** @expose */
  23524. frequency : function(a0) {
  23525. var args = arguments;
  23526. if (args.length == 0) {
  23527. return this.frequency$0();
  23528. }
  23529. return this.frequency$1(a0);
  23530. },
  23531. /** @expose */
  23532. bins : function(a0) {
  23533. var args = arguments;
  23534. if (args.length == 0) {
  23535. return this.bins$0();
  23536. }
  23537. if (args.length == 1 && (a0 == null || typeof a0 === "number")) {
  23538. return this.bins$1(a0);
  23539. }
  23540. return this.bins$2(a0);
  23541. },
  23542. /** @expose */
  23543. range : function(a0) {
  23544. var args = arguments;
  23545. if (args.length == 0) {
  23546. return this.range$0();
  23547. }
  23548. if (args.length == 1 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]")) {
  23549. return this.range$1(a0);
  23550. }
  23551. return this.range$2(a0);
  23552. },
  23553. /** @expose */
  23554. value : function(a0) {
  23555. var args = arguments;
  23556. if (args.length == 0) {
  23557. return this.value$0();
  23558. }
  23559. return this.value$1(a0);
  23560. }
  23561. });
  23562. com_ibm_rave_core_layout_HistogramLayout.layout_histogramBinFixed = function(range, n) {
  23563. var x = -1;
  23564. var b = + (range[0]);
  23565. var m = (+ (range[1]) - b) / n;
  23566. var f = [];
  23567. while (++x <= n) {
  23568. f[x] = m * x + b;
  23569. }
  23570. return f;
  23571. };
  23572. com_ibm_rave_core_layout_HistogramLayout.LN2 = Math.log(2);
  23573. com_ibm_rave_core_layout_HistogramLayout.RANGER_DEFAULT_FN = function(values, index, groupIndex) {
  23574. return [com_ibm_rave_core_arrays_MinMax.min(values), com_ibm_rave_core_arrays_MinMax.max(values)];
  23575. };
  23576. com_ibm_rave_core_layout_HistogramLayout.DEFAULT_VALUER_FN = function(currentValue, index, array) {
  23577. return + (currentValue);
  23578. };
  23579. com_ibm_rave_core_layout_HistogramLayout.DEFAULT_BINNER_FN = function(range, values, index) {
  23580. return com_ibm_rave_core_layout_HistogramLayout.layout_histogramBinFixed(range, Math.ceil(Math.log(((values)).length) / com_ibm_rave_core_layout_HistogramLayout.LN2 + 1));
  23581. };
  23582. // $source: com/ibm/rave/core/layout/hierarchy/Hierarchy
  23583. /************************************************************************
  23584. ** IBM Confidential
  23585. **
  23586. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  23587. **
  23588. ** (C) Copyright IBM Corp. 2015
  23589. **
  23590. ** The source code for this program is not published or otherwise divested of its trade secrets,
  23591. ** irrespective of what has been deposited with the U.S. Copyright Office.
  23592. ************************************************************************/
  23593. // GENERATED
  23594. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  23595. //@import com/ibm/rave/core/layout/hierarchy/HierarchyBase (loadtime) // superclass
  23596. //@import com/ibm/rave/core/layout/hierarchy/HierarchyUtil (runtime) // revalue
  23597. /**
  23598. * The hierarchy layout is an abstract layout that is not used directly, but instead allows code sharing between multiple hierarchical layouts. For an implementation, see one of: Cluster - cluster entities into a dendrogram. Pack - produce a hierarchical layout using recursive circle-packing. Partition - recursively partition a node tree into a sunburst or icicle. Tree - position a tree of nodes tidily. Treemap - use recursive spatial subdivision to display a tree of nodes. Although not a hierarchy layout, the bundle layout is also designed to work in conjunction with hierarchies
  23599. * @param < (Object) T > the type of HierarchyBase
  23600. */
  23601. var com_ibm_rave_core_layout_hierarchy_Hierarchy = rave_externs["Hierarchy"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_layout_hierarchy_HierarchyBase, {
  23602. /**
  23603. * c'tor
  23604. */
  23605. /** @expose */
  23606. constructor : function() {},
  23607. /**
  23608. * Re-evaluates the `value` property for the specified hierarchy.
  23609. * @param (Object) root the root node of type T
  23610. * @return (Object) the root node that was revalued
  23611. */
  23612. /** @expose */
  23613. revalue : function(root) {
  23614. return com_ibm_rave_core_layout_hierarchy_HierarchyUtil.revalue(root, this);
  23615. }
  23616. });
  23617. // $source: com/ibm/rave/core/layout/PartitionLayout
  23618. /************************************************************************
  23619. ** IBM Confidential
  23620. **
  23621. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  23622. **
  23623. ** (C) Copyright IBM Corp. 2015
  23624. **
  23625. ** The source code for this program is not published or otherwise divested of its trade secrets,
  23626. ** irrespective of what has been deposited with the U.S. Copyright Office.
  23627. ************************************************************************/
  23628. // GENERATED
  23629. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  23630. //@import com/ibm/rave/core/layout/hierarchy/HierarchyBase (loadtime) // superclass
  23631. /**
  23632. * Produces adjacency diagrams: a space-filling variant of a node-link tree diagram. Rather than drawing a link between parent and child in the hierarchy, nodes are drawn as solid areas (either arcs or rectangles), and their placement relative to other nodes reveals their position in the hierarchy. The size of the nodes encodes a quantitative dimension that would be difficult to show in a node-link diagram
  23633. */
  23634. var com_ibm_rave_core_layout_PartitionLayout = rave_externs["PartitionLayout"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_layout_hierarchy_HierarchyBase, {
  23635. //sizeVal : null,
  23636. /**
  23637. * An alias to this layout instance
  23638. */
  23639. /** @expose */
  23640. nodes : null,
  23641. constructor : function() {
  23642. this.sizeVal = [1, 1];
  23643. {
  23644. this.nodes = this;
  23645. }
  23646. },
  23647. position : function(node, x, dx, dy) {
  23648. var children = node["children"];
  23649. node["x"] = x;
  23650. node["y"] = node["depth"] * dy;
  23651. node["dx"] = dx;
  23652. node["dy"] = dy;
  23653. var n = 0;
  23654. var localdx = dx;
  23655. var localx = x;
  23656. if (children && children.length > 0) {
  23657. n = children.length;
  23658. var i = -1;
  23659. var c;
  23660. var d = 0;
  23661. localdx = (node["value"]) ? localdx / node["value"] : 0;
  23662. while (++i < n) {
  23663. c = children[i];
  23664. d = c["value"] * localdx;
  23665. this.position(c, localx, d, dy);
  23666. localx += d;
  23667. }
  23668. }
  23669. },
  23670. depth : function(node) {
  23671. var children = node["children"];
  23672. var d = 0;
  23673. if (children && children.length > 0) {
  23674. var n = children.length;
  23675. var i = -1;
  23676. while (++i < n) {
  23677. d = Math.max(d, this.depth(children[i]));
  23678. }
  23679. }
  23680. return 1 + d;
  23681. },
  23682. /**
  23683. * Returns the current size, which defaults to 1×1
  23684. * @return (double[]) return the current size
  23685. */
  23686. size$0 : function() {
  23687. return this.sizeVal;
  23688. },
  23689. /**
  23690. * Sets the available layout size to the specified two-element array of numbers representing x and y.
  23691. * @param (double[]) newSize the size of the layout
  23692. * @return (com.ibm.rave.core.layout.PartitionLayout) this Layout
  23693. */
  23694. size$1 : function(newSize) {
  23695. this.sizeVal = newSize;
  23696. return this;
  23697. },
  23698. /**
  23699. * Runs the partition layout, returning the array of nodes associated with the specified root node. The partition layout is part of Rave's family of hierarchical layouts. These layouts follow the same basic structure: the input argument to the layout is the root node of the hierarchy, and the output return value is an array representing the computed positions of all nodes. Several attributes are populated on each node: parent - the parent node, or null for the root. children - the array of child nodes, or null for leaf nodes. value - the node value, as returned by the value accessor. depth - the depth of the node, starting at 0 for the root. x - the minimum x-coordinate of the node position. y - the minimum y-coordinate of the node position. dx - the x-extent of the node position. dy - the y-extent of the node position. Although the layout has a size in x and y, this represents an arbitrary coordinate system; for example, you can treat x as a radius and y as an angle to produce a radial rather than Cartesian layout. In Cartesian orientation, x, y, dx and dy correspond to the "x", "y", "width" and "height" attributes of the SVG rect element. In radial orientation, they can be used to compute the innerRadius, startAngle, outerRadius and endAngle of an arc generator. The Cartesian orientation may be called an icicle tree, while the radial orientation is called a sunburst.
  23700. * @param (Object) d the root node
  23701. * @param (int) i the node index
  23702. * @return (Array) list of all the cluster nodes
  23703. */
  23704. doCreate$0 : function(d, i) {
  23705. var nodes = com_ibm_rave_core_layout_hierarchy_HierarchyBase.prototype.doCreate.call(this, d, i);
  23706. this.position(nodes[0], 0, this.sizeVal[0], this.sizeVal[1] / this.depth(nodes[0]));
  23707. return nodes;
  23708. },
  23709. /** @expose */
  23710. size : function(a0) {
  23711. var args = arguments;
  23712. if (args.length == 0) {
  23713. return this.size$0();
  23714. }
  23715. return this.size$1(a0);
  23716. },
  23717. /** @expose */
  23718. doCreate : function(a0, a1) {
  23719. var args = arguments;
  23720. return this.doCreate$0(a0, a1);
  23721. }
  23722. });
  23723. // $source: com/ibm/rave/core/capabilities/Capabilities
  23724. /************************************************************************
  23725. ** IBM Confidential
  23726. **
  23727. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  23728. **
  23729. ** (C) Copyright IBM Corp. 2015
  23730. **
  23731. ** The source code for this program is not published or otherwise divested of its trade secrets,
  23732. ** irrespective of what has been deposited with the U.S. Copyright Office.
  23733. ************************************************************************/
  23734. // GENERATED
  23735. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  23736. //@import com/ibm/rave/core/RegistryService (loadtime) // superclass
  23737. /**
  23738. * The Capabilities class is used to register the services and factories attached to rave e.g. An example of a service would be something like layouts where the functionality is extensible and new layouts could be registered to the layouts object. An example of a factory would be something like statistics where the functionality is not extensible and it provides a a finite, discrete set of functionality that is optional to the core layer, and can be loaded on demand USAGE: Registration: Rave.capabilities.extension("id", instance); Fetching extension: Rave.capabilities.extension("id");
  23739. */
  23740. var com_ibm_rave_core_capabilities_Capabilities = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_RegistryService, {
  23741. /**
  23742. * singleton
  23743. */
  23744. //constructor : function() {}
  23745. });
  23746. /** @expose */
  23747. com_ibm_rave_core_capabilities_Capabilities.INSTANCE = new com_ibm_rave_core_capabilities_Capabilities();
  23748. // $source: com/ibm/rave/core/svg/SVG
  23749. /************************************************************************
  23750. ** IBM Confidential
  23751. **
  23752. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  23753. **
  23754. ** (C) Copyright IBM Corp. 2015
  23755. **
  23756. ** The source code for this program is not published or otherwise divested of its trade secrets,
  23757. ** irrespective of what has been deposited with the U.S. Copyright Office.
  23758. ************************************************************************/
  23759. // GENERATED
  23760. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  23761. //@import com/ibm/rave/core/svg/LinePathGeneratorFactory (runtime) // new
  23762. //@import com/ibm/rave/core/svg/AreaPathGeneratorFactory (runtime) // new
  23763. //@import com/ibm/rave/core/svg/DiagonalPathGeneratorFactory (runtime) // new
  23764. //@import com/ibm/rave/core/svg/Symbol (runtime) // new, Symbol
  23765. //@import com/ibm/rave/core/svg/Arc (runtime) // new
  23766. //@import com/ibm/rave/core/svg/Chord (runtime) // new
  23767. //@import com/ibm/rave/core/svg/Axis (runtime) // new
  23768. //@import com/ibm/rave/core/svg/Brush (runtime) // newBrush
  23769. /**
  23770. * A Factory class for the SVG path generators.
  23771. */
  23772. var com_ibm_rave_core_svg_SVG = com_ibm_rave_core_nativeImpl_Declare({
  23773. /**
  23774. * Factory method, that creates a Line path generator using the Identity projection Constructs a new line generator with the default x- and y-accessor functions (that assume the input data is a two-element array of numbers), and linear interpolation. The returned function generates path data for an open piecewise linear curve, or polyline By changing the interpolation, you can also generate splines and step functions. Also, don't be afraid to tack on additional path commands at the end. For example, if you want to generate a closed path, append a closepath (Z) Returns a line path generator factory method {@link (com.ibm.rave.core.svg.LinePathGeneratorFactory) LinePathGeneratorFactory}
  23775. */
  23776. /** @expose */
  23777. line : null,
  23778. /**
  23779. * Factory method, that creates an Area Path Generator using the Identity projection Constructs a new Area Path Generator with the default x- and y-accessors functions (that assume the input data is a two-element array of numbers), and linear interpolation. The returned function generates path data for a closed piecewise linear curve, or polygon. Returns a line path generator factory method {@link (com.ibm.rave.core.svg.AreaPathGenerator) AreaPathGenerator}
  23780. */
  23781. /** @expose */
  23782. area : null,
  23783. /**
  23784. * Factory method, Constructs a new diagonal generator with the default accessor functions (that assume the input data is an object with named attributes matching the accessors). The returned Generator generates the path data for a cubic Bézier connecting the source and target points; the tangents are specified to produce smooth fan-in and fan-out when connecting nodes Returns a Diagonal path generator factory method {@link (com.ibm.rave.core.svg.DiagonalPathGenerator) DiagonalPathGenerator}
  23785. */
  23786. /** @expose */
  23787. diagonal : null,
  23788. /**
  23789. * List of all supported Symbol Types
  23790. */
  23791. /** @expose */
  23792. symbolTypes : null,
  23793. constructor : function() {
  23794. this.line = new com_ibm_rave_core_svg_LinePathGeneratorFactory();
  23795. this.area = new com_ibm_rave_core_svg_AreaPathGeneratorFactory();
  23796. this.diagonal = new com_ibm_rave_core_svg_DiagonalPathGeneratorFactory();
  23797. this.symbolTypes = com_ibm_rave_core_svg_Symbol.r2_svg_symbolTypes;
  23798. },
  23799. /**
  23800. * Factory method, that creates an Arc path generator.
  23801. * @return (com.ibm.rave.core.svg.Arc) arc path generator {@link (com.ibm.rave.core.svg.Arc) Arc}
  23802. */
  23803. /** @expose */
  23804. arc : function() {
  23805. return new com_ibm_rave_core_svg_Arc();
  23806. },
  23807. /**
  23808. * Factory method, that creates a chord path generator.
  23809. * @return (com.ibm.rave.core.svg.Chord) chord path generator {@link (com.ibm.rave.core.svg.Chord) Chord}
  23810. */
  23811. /** @expose */
  23812. chord : function() {
  23813. return new com_ibm_rave_core_svg_Chord();
  23814. },
  23815. /**
  23816. * Factory method, that creates an axis shape generator.
  23817. * @return (com.ibm.rave.core.svg.Axis) axis shape generator {@link (com.ibm.rave.core.svg.Axis) Axis}
  23818. */
  23819. /** @expose */
  23820. axis : function() {
  23821. return new com_ibm_rave_core_svg_Axis();
  23822. },
  23823. /**
  23824. * Factory method, that creates a Symbol path generator.
  23825. * @return (com.ibm.rave.core.svg.Symbol) symbol path generator {@link (com.ibm.rave.core.svg.Symbol) Symbol}
  23826. */
  23827. /** @expose */
  23828. symbol : function() {
  23829. return new com_ibm_rave_core_svg_Symbol();
  23830. },
  23831. /**
  23832. * Constructs a new brush with no default x- and y-scale, and an empty extent
  23833. * @return (com.ibm.rave.core.svg.Brush) the newly constructed brush control
  23834. */
  23835. /** @expose */
  23836. brush : function() {
  23837. return com_ibm_rave_core_svg_Brush.newBrush();
  23838. }
  23839. //constructor : function() {}
  23840. });
  23841. /** @expose */
  23842. com_ibm_rave_core_svg_SVG.getInstance = function() {
  23843. if (!com_ibm_rave_core_svg_SVG.INSTANCE) {
  23844. {
  23845. if (!com_ibm_rave_core_svg_SVG.INSTANCE) {
  23846. com_ibm_rave_core_svg_SVG.INSTANCE = new com_ibm_rave_core_svg_SVG();
  23847. }
  23848. }
  23849. }
  23850. return com_ibm_rave_core_svg_SVG.INSTANCE;
  23851. };
  23852. //com_ibm_rave_core_svg_SVG.INSTANCE = null;
  23853. // $source: com/ibm/rave/core/svg/LinePathGeneratorFactory
  23854. /************************************************************************
  23855. ** IBM Confidential
  23856. **
  23857. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  23858. **
  23859. ** (C) Copyright IBM Corp. 2015
  23860. **
  23861. ** The source code for this program is not published or otherwise divested of its trade secrets,
  23862. ** irrespective of what has been deposited with the U.S. Copyright Office.
  23863. ************************************************************************/
  23864. // GENERATED
  23865. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  23866. //@import com/ibm/rave/core/svg/LineRadial (runtime) // createLine
  23867. //@import com/ibm/rave/core/internal/util/Identity (runtime) // create
  23868. //@import com/ibm/rave/core/svg/SVGLine (runtime) // createLine
  23869. /**
  23870. * Line Path Generator Factory
  23871. */
  23872. var com_ibm_rave_core_svg_LinePathGeneratorFactory = rave_externs["LinePathGeneratorFactory"] = com_ibm_rave_core_nativeImpl_Declare({
  23873. _$functionClassMethod : function() {
  23874. var _$self = /**
  23875. * Creates a Line Path generator using the Identity projection Constructs a new line generator with the default x- and y-accessor functions (that assume the input data is a two-element array of numbers), and linear interpolation. The returned function generates path data for an open piecewise linear curve, or polyline By changing the interpolation, you can also generate splines and step functions. Also, don't be afraid to tack on additional path commands at the end. For example, if you want to generate a closed path, append a closepath (Z)
  23876. * @return (com.ibm.rave.core.svg.LinePathGenerator) line path generator {@link (com.ibm.rave.core.svg.LinePathGenerator) LinePathGenerator}
  23877. */
  23878. function() {
  23879. var identity = com_ibm_rave_core_internal_util_Identity.create();
  23880. return com_ibm_rave_core_svg_SVGLine.createLine(identity);
  23881. };
  23882. return _$self;
  23883. },
  23884. /**
  23885. * Constructs a new radial line generator with the default radius- and angle-accessor functions (that assume the input data is a two-element array of numbers), and linear interpolation. The returned generator generates path data for an open piecewise linear curve, or polyline, as with the Cartesian line generator.
  23886. * @return (com.ibm.rave.core.svg.LineRadial.RadialLinePathGenerator) svg path generator
  23887. */
  23888. /** @expose */
  23889. radial : function() {
  23890. return com_ibm_rave_core_svg_LineRadial.createLine();
  23891. }
  23892. });
  23893. // $source: com/ibm/rave/core/svg/LineRadial
  23894. /************************************************************************
  23895. ** IBM Confidential
  23896. **
  23897. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  23898. **
  23899. ** (C) Copyright IBM Corp. 2015
  23900. **
  23901. ** The source code for this program is not published or otherwise divested of its trade secrets,
  23902. ** irrespective of what has been deposited with the U.S. Copyright Office.
  23903. ************************************************************************/
  23904. // GENERATED
  23905. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  23906. //@import com/ibm/rave/core/svg/LinePathGenerator (loadtime) // superclass
  23907. /**
  23908. * Constructs a new radial line generator with the default radius- and angle-accessor functions (that assume the input data is a two-element array of numbers), and linear interpolation. The returned function generates path data for an open piecewise linear curve, or polyline, as with the Cartesian line generator.
  23909. */
  23910. var com_ibm_rave_core_svg_LineRadial = rave_externs["LineRadial"] = com_ibm_rave_core_nativeImpl_Declare({
  23911. });
  23912. /**
  23913. * Constructs a new radial line generator with the default radius- and angle-accessor functions (that assume the input data is a two-element array of numbers), and linear interpolation. The returned generator generates path data for an open piecewise linear curve, or polyline, as with the Cartesian line generator.
  23914. * @return (com.ibm.rave.core.svg.LineRadial.RadialLinePathGenerator) a radial line path generator {@link (com.ibm.rave.core.svg.LinePathGenerator) LinePathGenerator}
  23915. */
  23916. /** @expose */
  23917. com_ibm_rave_core_svg_LineRadial.createLine = function() {
  23918. return new com_ibm_rave_core_svg_LineRadial.RadialLinePathGenerator(com_ibm_rave_core_svg_LineRadial.r2_svg_lineRadial);
  23919. };
  23920. /**
  23921. * Radial Line path generator
  23922. */
  23923. com_ibm_rave_core_svg_LineRadial.RadialLinePathGenerator = rave_externs["RadialLinePathGenerator"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_svg_LinePathGenerator, {
  23924. /**
  23925. * Constructor constructs a Radial Line path generator
  23926. * @param (com.ibm.rave.core.selector.ValueFunction) projection the projection to set on this line generator
  23927. */
  23928. /** @expose */
  23929. constructor : function(projection) {
  23930. },
  23931. /**
  23932. * Gets the radius-accessor, it can be a function or constant.
  23933. * @return (Object) the radius-accessor
  23934. */
  23935. radius$0 : com_ibm_rave_core_svg_LinePathGenerator.prototype.x$0,
  23936. /**
  23937. * Sets the radius-accessor to the specified function. This accessor is invoked for each element in the data array passed to the line generator. The default accessor assumes that each input element is a two-element array of numbers
  23938. * @param (com.ibm.rave.core.selector.ValueFunction) valFn the radius-accessor
  23939. * @return (com.ibm.rave.core.svg.LineRadial.RadialLinePathGenerator) the line path generator
  23940. */
  23941. radius$1 : com_ibm_rave_core_svg_LinePathGenerator.prototype.x$1,
  23942. /**
  23943. * Sets the radius-accessor to the constant.
  23944. * @param (double) xNewVal the constant value of radius
  23945. * @return (com.ibm.rave.core.svg.LineRadial.RadialLinePathGenerator) the line path generator
  23946. */
  23947. radius$2 : com_ibm_rave_core_svg_LinePathGenerator.prototype.x$2,
  23948. /**
  23949. * gets the angle-accessor, it can be a a function or constant.
  23950. * @return (Object) the angle-accessor
  23951. */
  23952. angle$0 : com_ibm_rave_core_svg_LinePathGenerator.prototype.y$0,
  23953. /**
  23954. * Sets the angle-accessor to the specified function. This accessor is invoked for each element in the data array passed to the line generator. The default accessor assumes that each input element is a two-element array of numbers
  23955. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The angle-accessor
  23956. * @return (com.ibm.rave.core.svg.LineRadial.RadialLinePathGenerator) the line path generator
  23957. */
  23958. angle$1 : com_ibm_rave_core_svg_LinePathGenerator.prototype.y$1,
  23959. /**
  23960. * Sets the anglr-accessor to the constant.
  23961. * @param (double) yNewVal The constant value of angle
  23962. * @return (com.ibm.rave.core.svg.LineRadial.RadialLinePathGenerator) the line path generator
  23963. */
  23964. angle$2 : com_ibm_rave_core_svg_LinePathGenerator.prototype.y$2,
  23965. /** @expose */
  23966. radius : function(a0) {
  23967. var args = arguments;
  23968. if (args.length == 0) {
  23969. return this.radius$0();
  23970. }
  23971. if (args.length == 1 && typeof a0 === "function") {
  23972. return this.radius$1(a0);
  23973. }
  23974. return this.radius$2(a0);
  23975. },
  23976. /** @expose */
  23977. angle : function(a0) {
  23978. var args = arguments;
  23979. if (args.length == 0) {
  23980. return this.angle$0();
  23981. }
  23982. if (args.length == 1 && typeof a0 === "function") {
  23983. return this.angle$1(a0);
  23984. }
  23985. return this.angle$2(a0);
  23986. }
  23987. });
  23988. delete com_ibm_rave_core_svg_LineRadial.RadialLinePathGenerator.prototype.x;
  23989. delete com_ibm_rave_core_svg_LineRadial.RadialLinePathGenerator.prototype.x$0;
  23990. delete com_ibm_rave_core_svg_LineRadial.RadialLinePathGenerator.prototype.x$1;
  23991. delete com_ibm_rave_core_svg_LineRadial.RadialLinePathGenerator.prototype.x$2;
  23992. delete com_ibm_rave_core_svg_LineRadial.RadialLinePathGenerator.prototype.y;
  23993. delete com_ibm_rave_core_svg_LineRadial.RadialLinePathGenerator.prototype.y$0;
  23994. delete com_ibm_rave_core_svg_LineRadial.RadialLinePathGenerator.prototype.y$1;
  23995. delete com_ibm_rave_core_svg_LineRadial.RadialLinePathGenerator.prototype.y$2;
  23996. /**
  23997. * Creates the projection to set on this generator
  23998. */
  23999. /** @expose */
  24000. com_ibm_rave_core_svg_LineRadial.r2_svg_lineRadial = function(data, index, groupIndex) {
  24001. var point;
  24002. var points = data;
  24003. var i = -1, n = points.length;
  24004. var r, a;
  24005. while (++i < n) {
  24006. point = points[i];
  24007. r = point[0];
  24008. a = point[1] - 1.5707963267948966;
  24009. point[0] = r * Math.cos(a);
  24010. point[1] = r * Math.sin(a);
  24011. }
  24012. return points;
  24013. };
  24014. // $source: com/ibm/rave/core/svg/AreaPathGeneratorFactory
  24015. /************************************************************************
  24016. ** IBM Confidential
  24017. **
  24018. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  24019. **
  24020. ** (C) Copyright IBM Corp. 2015
  24021. **
  24022. ** The source code for this program is not published or otherwise divested of its trade secrets,
  24023. ** irrespective of what has been deposited with the U.S. Copyright Office.
  24024. ************************************************************************/
  24025. // GENERATED
  24026. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  24027. //@import com/ibm/rave/core/svg/RadialAreaPathGenerator (runtime) // createRadialAreaGenerator
  24028. //@import com/ibm/rave/core/internal/util/Identity (runtime) // create
  24029. //@import com/ibm/rave/core/svg/AreaPathGenerator (runtime) // new
  24030. /**
  24031. * Area Path Generator Factory
  24032. */
  24033. var com_ibm_rave_core_svg_AreaPathGeneratorFactory = rave_externs["AreaPathGeneratorFactory"] = com_ibm_rave_core_nativeImpl_Declare({
  24034. _$functionClassMethod : function() {
  24035. var _$self = /**
  24036. * Constructs a new area generator with the default x-, y0- and y1-accessor functions (that assume the input data is a two-element array of numbers; see below for details), and linear interpolation. The returned function generates path data for a closed piecewise linear curve, or polygon.
  24037. * @return (com.ibm.rave.core.svg.AreaPathGenerator) area path generator {@link (com.ibm.rave.core.svg.AreaPathGenerator) AreaPathGenerator}
  24038. */
  24039. function() {
  24040. var identity = com_ibm_rave_core_internal_util_Identity.create();
  24041. return new com_ibm_rave_core_svg_AreaPathGenerator(identity);
  24042. };
  24043. return _$self;
  24044. },
  24045. /**
  24046. * Constructs a new radial area generator with the default radius- and angle-accessor functions (that assume the input data is a two-element array of numbers), and linear interpolation.
  24047. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) svg path generator
  24048. */
  24049. /** @expose */
  24050. radial : function() {
  24051. return com_ibm_rave_core_svg_RadialAreaPathGenerator.createRadialAreaGenerator();
  24052. }
  24053. });
  24054. // $source: com/ibm/rave/core/svg/AreaPathGenerator
  24055. /************************************************************************
  24056. ** IBM Confidential
  24057. **
  24058. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  24059. **
  24060. ** (C) Copyright IBM Corp. 2015
  24061. **
  24062. ** The source code for this program is not published or otherwise divested of its trade secrets,
  24063. ** irrespective of what has been deposited with the U.S. Copyright Office.
  24064. ************************************************************************/
  24065. // GENERATED
  24066. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  24067. //@import com/ibm/rave/core/svg/SVGLine (runtime) // SVGLine
  24068. /**
  24069. * Constructs a new area generator with the default x-, y0- and y1-accessor functions (that assume the input data is a two-element array of numbers; see below for details), and linear interpolation. ThisGenerator generates path data for a closed piecewise linear curve, or polygon. Conceptually, the polygon is formed using two lines: the top line is formed using the x- and y1-accessor functions, and proceeds from left-to-right; the bottom line is added to this line, using the x- and y0-accessor functions, and proceeds from right-to-left. By setting the transform attribute to rotate the path element by 90 degrees, you can also generate vertical areas. By changing the interpolation, you can also generate splines and step functions. The area generator is designed to work in conjunction with the {@link (com.ibm.rave.core.svg.LinePathGenerator) LinePathGenerator} . For example, when producing an area chart, you might use an area generator with a fill style, and a line generator with a stroke style to emphasize the top edge of the area. Since the area generator is only used to set the d attribute, you can control the appearance of the area using standard SVG styles and attributes, such as fill. To create streamgraphs (stacked area charts), use the stack layout. This layout sets the y0 attribute for each value in a series, which can be used from the y0- and y1-accessors. Note that each series must have the same number of values per series, and each value must have the same x-coordinate; if you have missing data or inconsistent x-coordinates per series, you must resample and interpolate your data before computing the stacked layout.
  24070. */
  24071. var com_ibm_rave_core_svg_AreaPathGenerator = rave_externs["AreaPathGenerator"] = com_ibm_rave_core_nativeImpl_Declare({
  24072. //fx0 : null,
  24073. //fx1 : null,
  24074. //fy0 : null,
  24075. //fy1 : null,
  24076. //definedFn : null,
  24077. //interpolateFn : null,
  24078. //interpolateKey : null,
  24079. //interpolateReverseFn : null,
  24080. //projectionFn : null,
  24081. x0Val : 0,
  24082. y0Val : 0,
  24083. x1Val : 0,
  24084. y1Val : 0,
  24085. tensionVal : 0.7,
  24086. L : "L",
  24087. _$functionClassMethod : function() {
  24088. var _$self = /**
  24089. * Returns the path data string for the specified array of data elements, or null if the path is empty.
  24090. * @param (Object) this The context for this function
  24091. * @param (Array) data The data to use while generating the area
  24092. * @return (String) the svg path string
  24093. */
  24094. function(data) {
  24095. var segments = [];
  24096. var points0 = [];
  24097. var points1 = [];
  24098. var i = -1;
  24099. var n = data.length;
  24100. var d;
  24101. n = data.length;
  24102. var xa, ya;
  24103. var localFx1;
  24104. if (_$self.fx0 && _$self.fx0 == _$self.fx1) {
  24105. localFx1 = function(data, index, groupIndex) {
  24106. return xa;
  24107. };
  24108. } else {
  24109. localFx1 = _$self.fx1;
  24110. }
  24111. var localFy1;
  24112. if (_$self.fy0 && _$self.fy0 == _$self.fy1) {
  24113. localFy1 = function(data, index, groupIndex) {
  24114. return ya;
  24115. };
  24116. } else {
  24117. localFy1 = _$self.fy1;
  24118. }
  24119. while (++i < n) {
  24120. d = data[i];
  24121. if (_$self.definedFn.call(this, d, i, -1)) {
  24122. xa = + (!_$self.fx0 ? _$self.x0Val : _$self.fx0.call(this, d, i, -1));
  24123. ya = + (!_$self.fy0 ? _$self.y0Val : _$self.fy0.call(this, d, i, -1));
  24124. points0.push([xa, ya]);
  24125. points1.push([+ (!localFx1 ? _$self.x1Val : localFx1.call(this, d, i, -1)), + (!localFy1 ? _$self.y1Val : localFy1.call(this, d, i, -1))]);
  24126. } else if (points0.length > 0) {
  24127. segments.push("M", _$self.interpolateFn(_$self.projectionFn.call(this, points1, -1, -1), _$self.tensionVal), _$self.L, _$self.interpolateReverseFn(_$self.projectionFn.call(this, points0.reverse(), -1, -1), _$self.tensionVal), "Z");
  24128. points0 = [];
  24129. points1 = [];
  24130. }
  24131. }
  24132. if (points0.length > 0) {
  24133. segments.push("M", _$self.interpolateFn(_$self.projectionFn.call(this, points1, -1, -1), _$self.tensionVal), _$self.L, _$self.interpolateReverseFn(_$self.projectionFn.call(this, points0.reverse(), -1, -1), _$self.tensionVal), "Z");
  24134. }
  24135. return segments.length > 0 ? segments.join("") : null;
  24136. };
  24137. return _$self;
  24138. },
  24139. constructor : function(projection) {
  24140. this.fx0 = com_ibm_rave_core_svg_SVGLine.DEFAULT_X_FN;
  24141. this.fx1 = com_ibm_rave_core_svg_SVGLine.DEFAULT_X_FN;
  24142. this.fy1 = com_ibm_rave_core_svg_SVGLine.DEFAULT_Y_FN;
  24143. this.definedFn = com_ibm_rave_core_svg_SVGLine.DEFAULT_DEFINED_FN;
  24144. this.interpolateFn = com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear;
  24145. this.interpolateKey = this.interpolateFn.key;
  24146. this.interpolateReverseFn = this.interpolateFn;
  24147. /**
  24148. * Constructor creates am AreaPathGenerator and sets the projection on it to be, the passed projection
  24149. * @param (com.ibm.rave.core.selector.ValueFunction) projection The projection to use while generating the area
  24150. */
  24151. {
  24152. this.projectionFn = projection;
  24153. }
  24154. },
  24155. /**
  24156. * Returns the current x1-accessor. this can be ValueFunction of a Number
  24157. * @return (Object) x1-accessor
  24158. */
  24159. x$0 : function() {
  24160. if (this.fx1) {
  24161. return this.fx1;
  24162. }
  24163. return this.x1Val;
  24164. },
  24165. /**
  24166. * Sets the x-accessor to the specified constant. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24167. * @param (double) xVal The constant to use
  24168. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  24169. */
  24170. x$1 : function(xVal) {
  24171. this.fx0 = this.fx1 = null;
  24172. this.x0Val = this.x1Val = xVal;
  24173. return this;
  24174. },
  24175. /**
  24176. * Sets the x-accessor to the specified function. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24177. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  24178. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  24179. */
  24180. x$2 : function(valFn) {
  24181. this.fx0 = this.fx1 = valFn;
  24182. return this;
  24183. },
  24184. /**
  24185. * Returns the current x0-accessor. this can be ValueFunction of a Number
  24186. * @return (Object) x0-accessor
  24187. */
  24188. x0$0 : function() {
  24189. if (this.fx0) {
  24190. return this.fx0;
  24191. }
  24192. return this.x0Val;
  24193. },
  24194. /**
  24195. * Sets the x0-accessor to the specified constant. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24196. * @param (double) xVal The constant to use
  24197. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  24198. */
  24199. x0$1 : function(xVal) {
  24200. this.fx0 = null;
  24201. this.x0Val = xVal;
  24202. return this;
  24203. },
  24204. /**
  24205. * Sets the x0-accessor to the specified function. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24206. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  24207. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  24208. */
  24209. x0$2 : function(valFn) {
  24210. this.fx0 = valFn;
  24211. return this;
  24212. },
  24213. /**
  24214. * Returns the current x1-accessor. this can be ValueFunction of a Number
  24215. * @return (Object) x1-accessor
  24216. */
  24217. x1$0 : function() {
  24218. if (this.fx1) {
  24219. return this.fx1;
  24220. }
  24221. return this.x1Val;
  24222. },
  24223. /**
  24224. * Sets the x1-accessor to the specified constant. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24225. * @param (double) xVal The constant to use
  24226. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  24227. */
  24228. x1$1 : function(xVal) {
  24229. this.fx1 = null;
  24230. this.x1Val = xVal;
  24231. return this;
  24232. },
  24233. /**
  24234. * Sets the x1-accessor to the specified function. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24235. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  24236. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  24237. */
  24238. x1$2 : function(valFn) {
  24239. this.fx1 = valFn;
  24240. return this;
  24241. },
  24242. /**
  24243. * Returns the current y1-accessor. this can be ValueFunction of a Number
  24244. * @return (Object) y1-accessor
  24245. */
  24246. y$0 : function() {
  24247. if (this.fy1) {
  24248. return this.fy1;
  24249. }
  24250. return this.y1Val;
  24251. },
  24252. /**
  24253. * Sets the y-accessor to the specified constant. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24254. * @param (double) yVal The constant to use
  24255. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  24256. */
  24257. y$1 : function(yVal) {
  24258. this.fy0 = this.fy1 = null;
  24259. this.y0Val = this.y1Val = yVal;
  24260. return this;
  24261. },
  24262. /**
  24263. * Sets the y-accessor to the specified function. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24264. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  24265. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  24266. */
  24267. y$2 : function(valFn) {
  24268. this.fy0 = this.fy1 = valFn;
  24269. return this;
  24270. },
  24271. /**
  24272. * Returns the current y0-accessor. this can be ValueFunction of a Number
  24273. * @return (Object) y0-accessor
  24274. */
  24275. y0$0 : function() {
  24276. if (this.fy0) {
  24277. return this.fy0;
  24278. }
  24279. return this.y0Val;
  24280. },
  24281. /**
  24282. * Sets the y0-accessor to the specified constant. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24283. * @param (double) yVal The constant to use
  24284. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  24285. */
  24286. y0$1 : function(yVal) {
  24287. this.fy0 = null;
  24288. this.y0Val = yVal;
  24289. return this;
  24290. },
  24291. /**
  24292. * Sets the y0-accessor to the specified function. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24293. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  24294. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  24295. */
  24296. y0$2 : function(valFn) {
  24297. this.fy0 = valFn;
  24298. return this;
  24299. },
  24300. /**
  24301. * Returns the current y1-accessor. this can be ValueFunction of a Number
  24302. * @return (Object) y1-accessor
  24303. */
  24304. y1$0 : function() {
  24305. if (this.fy1) {
  24306. return this.fy1;
  24307. }
  24308. return this.y1Val;
  24309. },
  24310. /**
  24311. * Sets the y1-accessor to the specified constant. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24312. * @param (double) yVal The constant to use
  24313. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  24314. */
  24315. y1$1 : function(yVal) {
  24316. this.fy1 = null;
  24317. this.y1Val = yVal;
  24318. return this;
  24319. },
  24320. /**
  24321. * Sets the y1-accessor to the specified function. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24322. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  24323. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  24324. */
  24325. y1$2 : function(valFn) {
  24326. this.fy1 = valFn;
  24327. return this;
  24328. },
  24329. /**
  24330. * Gets the accessor function that controls where the area is defined. default defined is a function() { return true; }
  24331. * @return (com.ibm.rave.core.selector.ValueFunction) the defined function
  24332. */
  24333. defined$0 : function() {
  24334. return this.definedFn;
  24335. },
  24336. /**
  24337. * Sets the accessor function that controls where the area is defined. Sets the new accessor function and returns the area generator. The defined accessor can be used to define where the area is defined and undefined, which is typically useful in conjunction with missing data; the generated path data will automatically be broken into multiple distinct subpaths, skipping undefined data. For example, if you want to ignore y-values that are not a number (or undefined)
  24338. * @param (com.ibm.rave.core.selector.ValueFunction) valFn the function to use to decide if a point is defined
  24339. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this Area path generator
  24340. */
  24341. defined$1 : function(valFn) {
  24342. this.definedFn = valFn;
  24343. return this;
  24344. },
  24345. /**
  24346. * Returns the current tension.
  24347. * @return (double) the tension
  24348. */
  24349. tension$0 : function() {
  24350. return this.tensionVal;
  24351. },
  24352. /**
  24353. * sets the Cardinal spline or bundle interpolation tension to the specified number in the range [0, 1]. The tension only affects the Cardinal interpolation modes: cardinal, cardinal-open and cardinal-closed and Bundle interpolation. The default tension is 0.7. In some sense, this can be interpreted as the length of the tangent; 1 will yield all zero tangents, and 0 yields a Catmull-Rom spline. Note that the tension must be specified as a constant, rather than a function, as it is constant for the entirety of the line. However, it is still possible to generate multiple lines with different tensions using the same generator.
  24354. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this Area path generator
  24355. */
  24356. tension$1 : function(tensionNewVal) {
  24357. this.tensionVal = tensionNewVal;
  24358. return this;
  24359. },
  24360. interpolate$0 : function() {
  24361. return this.interpolateKey;
  24362. },
  24363. /**
  24364. * Sets the interpolation mode to the specified string. The following named interpolation modes are supported: linear - piecewise linear segments, as in a polyline. linear-closed - close the linear segments to form a polygon. step - alternate between horizontal and vertical segments, as in a step function. step-before - alternate between vertical and horizontal segments, as in a step function. step-after - alternate between horizontal and vertical segments, as in a step function. basis - a B-spline, with control point duplication on the ends. basis-open - an open B-spline; may not intersect the start or end. basis-closed - a closed B-spline, as in a loop. bundle - equivalent to basis, except the tension parameter is used to straighten the spline. cardinal - a Cardinal spline, with control point duplication on the ends. cardinal-open - an open Cardinal spline; may not intersect the start or end, but will intersect other control points. cardinal-closed - a closed Cardinal spline, as in a loop. monotone - cubic interpolation that preserves monotonicity in y. The behavior of some of these interpolation modes may be further customized by specifying a tension.
  24365. * @param (String) key the interpolation mode to use
  24366. * @return (com.ibm.rave.core.svg.AreaPathGenerator) the Area Path generator
  24367. */
  24368. interpolate$1 : function(key) {
  24369. this.interpolateKey = key;
  24370. this.interpolateFn = com_ibm_rave_core_svg_SVGLine.r2_svg_lineInterpolators.get(key);
  24371. if (!this.interpolateFn) {
  24372. this.interpolateFn = com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear;
  24373. this.interpolateKey = this.interpolateFn.key;
  24374. }
  24375. this.interpolateReverseFn = this.interpolateFn.reverse ? this.interpolateFn.reverse : this.interpolateFn;
  24376. this.L = this.interpolateFn.closed ? "M" : "L";
  24377. return this;
  24378. },
  24379. /**
  24380. * Sets the interpolation mode to the specified function. This function will be invoked to convert an array of points of the form [​[x0, y0], [x1, y1], …], returning an SVG path data string that will be used to display the line. The "M" at the start of the string is implied and should not be returned.
  24381. * @param (com.ibm.rave.core.svg.AbstractLineInterpolator) valFn the function to call to do the interpolation
  24382. * @return (com.ibm.rave.core.svg.AreaPathGenerator) the Line Path generator
  24383. */
  24384. interpolate$2 : function(valFn) {
  24385. this.interpolateKey = this.interpolateFn = valFn;
  24386. this.interpolateReverseFn = this.interpolateFn.reverse ? this.interpolateFn.reverse : this.interpolateFn;
  24387. this.L = this.interpolateFn.closed ? "M" : "L";
  24388. return this;
  24389. },
  24390. /** @expose */
  24391. x : function(a0) {
  24392. var args = arguments;
  24393. if (args.length == 0) {
  24394. return this.x$0();
  24395. }
  24396. if (args.length == 1 && typeof a0 === "function") {
  24397. return this.x$2(a0);
  24398. }
  24399. return this.x$1(a0);
  24400. },
  24401. /** @expose */
  24402. x0 : function(a0) {
  24403. var args = arguments;
  24404. if (args.length == 0) {
  24405. return this.x0$0();
  24406. }
  24407. if (args.length == 1 && typeof a0 === "function") {
  24408. return this.x0$2(a0);
  24409. }
  24410. return this.x0$1(a0);
  24411. },
  24412. /** @expose */
  24413. x1 : function(a0) {
  24414. var args = arguments;
  24415. if (args.length == 0) {
  24416. return this.x1$0();
  24417. }
  24418. if (args.length == 1 && typeof a0 === "function") {
  24419. return this.x1$2(a0);
  24420. }
  24421. return this.x1$1(a0);
  24422. },
  24423. /** @expose */
  24424. y : function(a0) {
  24425. var args = arguments;
  24426. if (args.length == 0) {
  24427. return this.y$0();
  24428. }
  24429. if (args.length == 1 && typeof a0 === "function") {
  24430. return this.y$2(a0);
  24431. }
  24432. return this.y$1(a0);
  24433. },
  24434. /** @expose */
  24435. y0 : function(a0) {
  24436. var args = arguments;
  24437. if (args.length == 0) {
  24438. return this.y0$0();
  24439. }
  24440. if (args.length == 1 && typeof a0 === "function") {
  24441. return this.y0$2(a0);
  24442. }
  24443. return this.y0$1(a0);
  24444. },
  24445. /** @expose */
  24446. y1 : function(a0) {
  24447. var args = arguments;
  24448. if (args.length == 0) {
  24449. return this.y1$0();
  24450. }
  24451. if (args.length == 1 && typeof a0 === "function") {
  24452. return this.y1$2(a0);
  24453. }
  24454. return this.y1$1(a0);
  24455. },
  24456. /** @expose */
  24457. defined : function(a0) {
  24458. var args = arguments;
  24459. if (args.length == 0) {
  24460. return this.defined$0();
  24461. }
  24462. return this.defined$1(a0);
  24463. },
  24464. /** @expose */
  24465. tension : function(a0) {
  24466. var args = arguments;
  24467. if (args.length == 0) {
  24468. return this.tension$0();
  24469. }
  24470. return this.tension$1(a0);
  24471. },
  24472. /** @expose */
  24473. interpolate : function(a0) {
  24474. var args = arguments;
  24475. if (args.length == 0) {
  24476. return this.interpolate$0();
  24477. }
  24478. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  24479. return this.interpolate$1(a0);
  24480. }
  24481. return this.interpolate$2(a0);
  24482. }
  24483. });
  24484. // $source: com/ibm/rave/core/svg/RadialAreaPathGenerator
  24485. /************************************************************************
  24486. ** IBM Confidential
  24487. **
  24488. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  24489. **
  24490. ** (C) Copyright IBM Corp. 2015
  24491. **
  24492. ** The source code for this program is not published or otherwise divested of its trade secrets,
  24493. ** irrespective of what has been deposited with the U.S. Copyright Office.
  24494. ************************************************************************/
  24495. // GENERATED
  24496. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  24497. //@import com/ibm/rave/core/svg/AreaPathGenerator (loadtime) // superclass
  24498. //@import com/ibm/rave/core/svg/LineRadial (static) // LineRadial
  24499. /**
  24500. * A Radial Area path generator
  24501. */
  24502. var com_ibm_rave_core_svg_RadialAreaPathGenerator = rave_externs["RadialAreaPathGenerator"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_svg_AreaPathGenerator, {
  24503. /**
  24504. * Returns the current radius-accessor. this can be ValueFunction of a Number
  24505. * @return (Object) radius-accessor
  24506. */
  24507. radius$0 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.x$0,
  24508. /**
  24509. * Sets the radius-accessor to the specified constant. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24510. * @param (double) rVal The constant to use
  24511. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  24512. */
  24513. radius$1 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.x$1,
  24514. /**
  24515. * Sets the radius-accessor to the specified function. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24516. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  24517. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  24518. */
  24519. radius$2 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.x$2,
  24520. /**
  24521. * Returns the current innerRadius-accessor. this can be ValueFunction of a Number
  24522. * @return (Object) innerRadius-accessor
  24523. */
  24524. innerRadius$0 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.x0$0,
  24525. /**
  24526. * Sets the innerRadius-accessor to the specified constant. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24527. * @param (double) xVal The constant to use
  24528. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) this path generator
  24529. */
  24530. innerRadius$1 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.x0$1,
  24531. /**
  24532. * Sets the innerRadius-accessor to the specified function. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24533. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  24534. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) this path generator
  24535. */
  24536. innerRadius$2 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.x0$2,
  24537. /**
  24538. * Returns the current outerRadius-accessor. this can be ValueFunction of a Number
  24539. * @return (Object) outerRadius-accessor
  24540. */
  24541. outerRadius$0 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.x1$0,
  24542. /**
  24543. * Sets the outerRadius-accessor to the specified constant. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24544. * @param (double) xVal The constant to use
  24545. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) this path generator
  24546. */
  24547. outerRadius$1 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.x1$1,
  24548. /**
  24549. * Sets the outerRadius-accessor to the specified function. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24550. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  24551. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) this path generator
  24552. */
  24553. outerRadius$2 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.x1$2,
  24554. /**
  24555. * Returns the current angle-accessor. this can be ValueFunction of a Number
  24556. * @return (Object) angle-accessor
  24557. */
  24558. angle$0 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.y$0,
  24559. /**
  24560. * Sets the angle-accessor to the specified constant. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24561. * @param (double) yVal The constant to use
  24562. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) this path generator
  24563. */
  24564. angle$1 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.y$1,
  24565. /**
  24566. * Sets the angle-accessor to the specified function. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24567. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  24568. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) this path generator
  24569. */
  24570. angle$2 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.y$2,
  24571. /**
  24572. * Returns the current startAngle-accessor. this can be ValueFunction of a Number
  24573. * @return (Object) startAngle-accessor
  24574. */
  24575. startAngle$0 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.y0$0,
  24576. /**
  24577. * Sets the startAngle-accessor to the specified constant. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24578. * @param (double) yVal The constant to use
  24579. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) this path generator
  24580. */
  24581. startAngle$1 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.y0$1,
  24582. /**
  24583. * Sets the startAngle-accessor to the specified function. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24584. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  24585. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) this path generator
  24586. */
  24587. startAngle$2 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.y0$2,
  24588. /**
  24589. * Returns the current endAngle-accessor. this can be ValueFunction of a Number
  24590. * @return (Object) endAngle-accessor
  24591. */
  24592. endAngle$0 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.y1$0,
  24593. /**
  24594. * Sets the endAngle-accessor to the specified constant. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24595. * @param (double) yVal The constant to use
  24596. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) this path generator
  24597. */
  24598. endAngle$1 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.y1$1,
  24599. /**
  24600. * Sets the endAngle-accessor to the specified function. This accessor is invoked for each element in the data array passed to the area generator. The default accessor assumes that each input element is a two-element array of numbers:
  24601. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  24602. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) this path generator
  24603. */
  24604. endAngle$2 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.y1$2,
  24605. /**
  24606. * Constructor constructs a Radial Area path generator
  24607. * @param (com.ibm.rave.core.selector.ValueFunction) projection the projection to set on this area generator
  24608. */
  24609. /** @expose */
  24610. constructor : function(projection) {
  24611. },
  24612. /** @expose */
  24613. radius : function(a0) {
  24614. var args = arguments;
  24615. if (args.length == 0) {
  24616. return this.radius$0();
  24617. }
  24618. if (args.length == 1 && typeof a0 === "function") {
  24619. return this.radius$2(a0);
  24620. }
  24621. return this.radius$1(a0);
  24622. },
  24623. /** @expose */
  24624. innerRadius : function(a0) {
  24625. var args = arguments;
  24626. if (args.length == 0) {
  24627. return this.innerRadius$0();
  24628. }
  24629. if (args.length == 1 && typeof a0 === "function") {
  24630. return this.innerRadius$2(a0);
  24631. }
  24632. return this.innerRadius$1(a0);
  24633. },
  24634. /** @expose */
  24635. outerRadius : function(a0) {
  24636. var args = arguments;
  24637. if (args.length == 0) {
  24638. return this.outerRadius$0();
  24639. }
  24640. if (args.length == 1 && typeof a0 === "function") {
  24641. return this.outerRadius$2(a0);
  24642. }
  24643. return this.outerRadius$1(a0);
  24644. },
  24645. /** @expose */
  24646. angle : function(a0) {
  24647. var args = arguments;
  24648. if (args.length == 0) {
  24649. return this.angle$0();
  24650. }
  24651. if (args.length == 1 && typeof a0 === "function") {
  24652. return this.angle$2(a0);
  24653. }
  24654. return this.angle$1(a0);
  24655. },
  24656. /** @expose */
  24657. startAngle : function(a0) {
  24658. var args = arguments;
  24659. if (args.length == 0) {
  24660. return this.startAngle$0();
  24661. }
  24662. if (args.length == 1 && typeof a0 === "function") {
  24663. return this.startAngle$2(a0);
  24664. }
  24665. return this.startAngle$1(a0);
  24666. },
  24667. /** @expose */
  24668. endAngle : function(a0) {
  24669. var args = arguments;
  24670. if (args.length == 0) {
  24671. return this.endAngle$0();
  24672. }
  24673. if (args.length == 1 && typeof a0 === "function") {
  24674. return this.endAngle$2(a0);
  24675. }
  24676. return this.endAngle$1(a0);
  24677. }
  24678. });
  24679. /**
  24680. * Creates a Radial Area Path generator
  24681. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) a new RadialAreaPathGenerator
  24682. */
  24683. com_ibm_rave_core_svg_RadialAreaPathGenerator.createRadialAreaGenerator = function() {
  24684. return new com_ibm_rave_core_svg_RadialAreaPathGenerator(com_ibm_rave_core_svg_LineRadial.r2_svg_lineRadial);
  24685. };
  24686. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x;
  24687. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x$0;
  24688. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x$1;
  24689. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x$2;
  24690. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x0;
  24691. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x0$0;
  24692. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x0$1;
  24693. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x0$2;
  24694. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x1;
  24695. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x1$0;
  24696. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x1$1;
  24697. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x1$2;
  24698. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y;
  24699. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y$0;
  24700. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y$1;
  24701. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y$2;
  24702. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y0;
  24703. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y0$0;
  24704. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y0$1;
  24705. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y0$2;
  24706. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y1;
  24707. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y1$0;
  24708. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y1$1;
  24709. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y1$2;
  24710. // $source: com/ibm/rave/core/svg/DiagonalPathGeneratorFactory
  24711. /************************************************************************
  24712. ** IBM Confidential
  24713. **
  24714. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  24715. **
  24716. ** (C) Copyright IBM Corp. 2015
  24717. **
  24718. ** The source code for this program is not published or otherwise divested of its trade secrets,
  24719. ** irrespective of what has been deposited with the U.S. Copyright Office.
  24720. ************************************************************************/
  24721. // GENERATED
  24722. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  24723. //@import com/ibm/rave/core/svg/RadialDiagonalPathGenerator (runtime) // createRadialAreaGenerator
  24724. //@import com/ibm/rave/core/svg/DiagonalPathGenerator (runtime) // new, DiagonalPathGenerator
  24725. var com_ibm_rave_core_svg_DiagonalPathGeneratorFactory = rave_externs["DiagonalPathGeneratorFactory"] = com_ibm_rave_core_nativeImpl_Declare({
  24726. _$functionClassMethod : function() {
  24727. var _$self = /**
  24728. * Factory method, Constructs a new diagonal generator with the default accessor functions (that assume the input data is an object with named attributes matching the accessors). The returned Generator generates the path data for a cubic Bézier connecting the source and target points; the tangents are specified to produce smooth fan-in and fan-out when connecting nodes
  24729. * @return (com.ibm.rave.core.svg.DiagonalPathGenerator) area path generator {@link (com.ibm.rave.core.svg.DiagonalPathGenerator) DiagonalPathGenerator}
  24730. */
  24731. function() {
  24732. return new com_ibm_rave_core_svg_DiagonalPathGenerator(com_ibm_rave_core_svg_DiagonalPathGenerator.r2_svg_diagonalProjection);
  24733. };
  24734. return _$self;
  24735. },
  24736. /**
  24737. * Constructs a new Radial Diagonal generator with the default
  24738. * @return (com.ibm.rave.core.svg.RadialDiagonalPathGenerator) svg path generator
  24739. */
  24740. /** @expose */
  24741. radial : function() {
  24742. return com_ibm_rave_core_svg_RadialDiagonalPathGenerator.createRadialAreaGenerator();
  24743. }
  24744. });
  24745. // $source: com/ibm/rave/core/svg/DiagonalPathGenerator
  24746. /************************************************************************
  24747. ** IBM Confidential
  24748. **
  24749. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  24750. **
  24751. ** (C) Copyright IBM Corp. 2015
  24752. **
  24753. ** The source code for this program is not published or otherwise divested of its trade secrets,
  24754. ** irrespective of what has been deposited with the U.S. Copyright Office.
  24755. ************************************************************************/
  24756. // GENERATED
  24757. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  24758. /**
  24759. * Constructs a new diagonal generator with the default accessor functions (that assume the input data is an object with named attributes matching the accessors). The returned Generator generates the path data for a cubic Bézier connecting the source and target points; the tangents are specified to produce smooth fan-in and fan-out when connecting nodes
  24760. */
  24761. var com_ibm_rave_core_svg_DiagonalPathGenerator = rave_externs["DiagonalPathGenerator"] = com_ibm_rave_core_nativeImpl_Declare({
  24762. //projectionFn : null,
  24763. //sourceFn : null,
  24764. //targetFn : null,
  24765. //sourceVal : null,
  24766. //targetVal : null,
  24767. _$functionClassMethod : function() {
  24768. var _$self = /**
  24769. * Constructs a new diagonal generator with the default accessor functions (that assume the input data is an object with named attributes matching the accessors). The returned Generator generates the path data for a cubic Bézier connecting the source and target points; the tangents are specified to produce smooth fan-in and fan-out when connecting nodes
  24770. * @param (Object) this the context of this function
  24771. * @param (Object) data the data to use to get source and target, optional param
  24772. * @param (int) index the index of the data, optional param
  24773. * @return (String) SVG string representing the path
  24774. */
  24775. function(data, index) {
  24776. var p0 = _$self.sourceFn ? _$self.sourceFn.call(this, data, index, -1) : _$self.sourceVal;
  24777. var p3 = _$self.targetFn ? _$self.targetFn.call(this, data, index, -1) : _$self.targetVal;
  24778. var m = (p0["y"] + p3["y"]) / 2;
  24779. var ap1 = {};
  24780. ap1["x"] = p0["x"];
  24781. ap1["y"] = m;
  24782. var ap2 = {};
  24783. ap2["x"] = p3["x"];
  24784. ap2["y"] = m;
  24785. var array = [p0, ap1, ap2, p3];
  24786. var pointArray = array.map(_$self.projectionFn);
  24787. return "M" + pointArray[0] + "C" + pointArray[1] + " " + pointArray[2] + " " + pointArray[3];
  24788. };
  24789. return _$self;
  24790. },
  24791. constructor : function(projection) {
  24792. this.sourceFn = com_ibm_rave_core_svg_DiagonalPathGenerator.DEFAULT_SOURCE_FN;
  24793. this.targetFn = com_ibm_rave_core_svg_DiagonalPathGenerator.DEFAULT_TARGET_FN;
  24794. /**
  24795. * Constructor creates a DiagonalPathGenerator and sets the projection on it to be the passed projection
  24796. * @param (com.ibm.rave.core.collections.ArrayEx.ArrayValueFunction) projection The projection to use while generating the path
  24797. */
  24798. {
  24799. this.projectionFn = projection;
  24800. }
  24801. },
  24802. /**
  24803. * Gets the source function or constant
  24804. * @return (Object) the source function or constant
  24805. */
  24806. source$0 : function() {
  24807. if (this.sourceFn) {
  24808. return this.sourceFn;
  24809. }
  24810. return this.sourceVal;
  24811. },
  24812. /**
  24813. * Sets the source function
  24814. * @param (com.ibm.rave.core.selector.ValueFunction) valFn function to use to get the source form the data
  24815. * @return (com.ibm.rave.core.svg.DiagonalPathGenerator) this generator
  24816. */
  24817. source$1 : function(valFn) {
  24818. this.sourceFn = valFn;
  24819. return this;
  24820. },
  24821. /**
  24822. * Sets the Source value for this generator
  24823. * @param (Object) val the source value
  24824. * @return (com.ibm.rave.core.svg.DiagonalPathGenerator) this generator
  24825. */
  24826. source$2 : function(val) {
  24827. this.sourceFn = null;
  24828. this.sourceVal = val;
  24829. return this;
  24830. },
  24831. /**
  24832. * Gets the target functions of value
  24833. * @return (Object) the target function or value
  24834. */
  24835. target$0 : function() {
  24836. if (this.targetFn) {
  24837. return this.targetFn;
  24838. }
  24839. return this.targetVal;
  24840. },
  24841. /**
  24842. * Sets the function to use to get the target from the data
  24843. * @param (com.ibm.rave.core.selector.ValueFunction) valFn the target function
  24844. * @return (com.ibm.rave.core.svg.DiagonalPathGenerator) this generator
  24845. */
  24846. target$1 : function(valFn) {
  24847. this.targetFn = valFn;
  24848. return this;
  24849. },
  24850. /**
  24851. * Sets The target value
  24852. * @param (Object) val the target value
  24853. * @return (com.ibm.rave.core.svg.DiagonalPathGenerator) this generator
  24854. */
  24855. target$2 : function(val) {
  24856. this.targetFn = null;
  24857. this.targetVal = val;
  24858. return this;
  24859. },
  24860. /**
  24861. * Gets the current projection function on this Generator
  24862. * @return (com.ibm.rave.core.collections.ArrayEx.ArrayValueFunction) the projection function
  24863. */
  24864. projection$0 : function() {
  24865. return this.projectionFn;
  24866. },
  24867. /**
  24868. * Sets the projection to use by this generator
  24869. * @param (com.ibm.rave.core.collections.ArrayEx.ArrayValueFunction) projection the projection
  24870. * @return (com.ibm.rave.core.svg.DiagonalPathGenerator) this generator
  24871. */
  24872. projection$1 : function(projection) {
  24873. this.projectionFn = projection;
  24874. return this;
  24875. },
  24876. /** @expose */
  24877. source : function(a0) {
  24878. var args = arguments;
  24879. if (args.length == 0) {
  24880. return this.source$0();
  24881. }
  24882. if (args.length == 1 && typeof a0 === "function") {
  24883. return this.source$1(a0);
  24884. }
  24885. return this.source$2(a0);
  24886. },
  24887. /** @expose */
  24888. target : function(a0) {
  24889. var args = arguments;
  24890. if (args.length == 0) {
  24891. return this.target$0();
  24892. }
  24893. if (args.length == 1 && typeof a0 === "function") {
  24894. return this.target$1(a0);
  24895. }
  24896. return this.target$2(a0);
  24897. },
  24898. /** @expose */
  24899. projection : function(a0) {
  24900. var args = arguments;
  24901. if (args.length == 0) {
  24902. return this.projection$0();
  24903. }
  24904. return this.projection$1(a0);
  24905. }
  24906. });
  24907. com_ibm_rave_core_svg_DiagonalPathGenerator.DEFAULT_SOURCE_FN = function(data, index, groupIndex) {
  24908. return (data)["source"];
  24909. };
  24910. com_ibm_rave_core_svg_DiagonalPathGenerator.DEFAULT_TARGET_FN = function(data, index, groupIndex) {
  24911. return (data)["target"];
  24912. };
  24913. /**
  24914. * Creates the projection to set on this generator
  24915. */
  24916. /** @expose */
  24917. com_ibm_rave_core_svg_DiagonalPathGenerator.r2_svg_diagonalProjection = function(currentValue, index, array) {
  24918. var input = currentValue;
  24919. return [input["x"], input["y"]];
  24920. };
  24921. // $source: com/ibm/rave/core/svg/RadialDiagonalPathGenerator
  24922. /************************************************************************
  24923. ** IBM Confidential
  24924. **
  24925. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  24926. **
  24927. ** (C) Copyright IBM Corp. 2015
  24928. **
  24929. ** The source code for this program is not published or otherwise divested of its trade secrets,
  24930. ** irrespective of what has been deposited with the U.S. Copyright Office.
  24931. ************************************************************************/
  24932. // GENERATED
  24933. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  24934. //@import com/ibm/rave/core/svg/DiagonalPathGenerator (loadtime) // superclass
  24935. /**
  24936. * Constructor creates a RadialDiagonalPathGenerator
  24937. */
  24938. var com_ibm_rave_core_svg_RadialDiagonalPathGenerator = rave_externs["RadialDiagonalPathGenerator"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_svg_DiagonalPathGenerator, {
  24939. /**
  24940. * Constructor creates a RadialDiagonalPathGenerator and sets the projection on it to be r2_svg_diagonalProjection
  24941. */
  24942. /** @expose */
  24943. constructor : function() {
  24944. },
  24945. /** @expose */
  24946. projection$1 : function(projectionVal) {
  24947. com_ibm_rave_core_svg_DiagonalPathGenerator.prototype.projection$1.call(this, new com_ibm_rave_core_svg_RadialDiagonalPathGenerator.DiagonalRadialProjection(projectionVal));
  24948. return this;
  24949. }
  24950. });
  24951. /**
  24952. * Creates a Radial Diagonal Path generator
  24953. * @return (com.ibm.rave.core.svg.RadialDiagonalPathGenerator) a new RadialDiagonalPathGenerator
  24954. */
  24955. com_ibm_rave_core_svg_RadialDiagonalPathGenerator.createRadialAreaGenerator = function() {
  24956. return new com_ibm_rave_core_svg_RadialDiagonalPathGenerator();
  24957. };
  24958. com_ibm_rave_core_svg_RadialDiagonalPathGenerator.DiagonalRadialProjection = com_ibm_rave_core_nativeImpl_Declare({
  24959. //innerProjectionFn : null,
  24960. _$functionClassMethod : function() {
  24961. var _$self = function(currentValue, index, array) {
  24962. var p = _$self.innerProjectionFn(currentValue, index, array);
  24963. var r = p[0];
  24964. var a = p[1] - 1.5707963267948966;
  24965. return [r * Math.cos(a), r * Math.sin(a)];
  24966. };
  24967. return _$self;
  24968. },
  24969. constructor : function(projectionVal) {
  24970. this.innerProjectionFn = projectionVal;
  24971. }
  24972. });
  24973. // $source: com/ibm/rave/core/internal/svg/symbol/CrossSymbolCreator
  24974. /************************************************************************
  24975. ** IBM Confidential
  24976. **
  24977. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  24978. **
  24979. ** (C) Copyright IBM Corp. 2015
  24980. **
  24981. ** The source code for this program is not published or otherwise divested of its trade secrets,
  24982. ** irrespective of what has been deposited with the U.S. Copyright Office.
  24983. ************************************************************************/
  24984. // GENERATED
  24985. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  24986. /**
  24987. * Symbol creator for a Cross shape
  24988. */
  24989. var com_ibm_rave_core_internal_svg_symbol_CrossSymbolCreator = com_ibm_rave_core_nativeImpl_Declare({
  24990. _$functionClassMethod : function() {
  24991. var _$self = /**
  24992. * create a cross symbol using the passed size
  24993. * @param (double) size size of the shape in square pixels
  24994. * @return (String) SVG path string for the shape
  24995. */
  24996. function(size) {
  24997. var r = Math.sqrt(size / 5) / 2;
  24998. return "M" + -3 * r + "," + -r + "H" + -r + "V" + -3 * r + "H" + r + "V" + -r + "H" + 3 * r + "V" + r + "H" + r + "V" + 3 * r + "H" + -r + "V" + r + "H" + -3 * r + "Z";
  24999. };
  25000. return _$self;
  25001. }
  25002. });
  25003. // $source: com/ibm/rave/core/internal/svg/symbol/DiamondSymbolCreator
  25004. /************************************************************************
  25005. ** IBM Confidential
  25006. **
  25007. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  25008. **
  25009. ** (C) Copyright IBM Corp. 2015
  25010. **
  25011. ** The source code for this program is not published or otherwise divested of its trade secrets,
  25012. ** irrespective of what has been deposited with the U.S. Copyright Office.
  25013. ************************************************************************/
  25014. // GENERATED
  25015. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  25016. //@import com/ibm/rave/core/internal/svg/symbol/SymbolCreatorsConstants (runtime) // SymbolCreatorsConstants
  25017. /**
  25018. * Symbol creator for a Diamond shape
  25019. */
  25020. var com_ibm_rave_core_internal_svg_symbol_DiamondSymbolCreator = com_ibm_rave_core_nativeImpl_Declare({
  25021. _$functionClassMethod : function() {
  25022. var _$self = /**
  25023. * create a Diamond symbol using the passed size
  25024. * @param (double) size size of the shape in square pixels
  25025. * @return (String) SVG path string for the shape
  25026. */
  25027. function(size) {
  25028. var ry = Math.sqrt(size / (2 * com_ibm_rave_core_internal_svg_symbol_SymbolCreatorsConstants.r2_svg_symbolTan30)), rx = ry * com_ibm_rave_core_internal_svg_symbol_SymbolCreatorsConstants.r2_svg_symbolTan30;
  25029. return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z";
  25030. };
  25031. return _$self;
  25032. }
  25033. });
  25034. // $source: com/ibm/rave/core/internal/svg/symbol/SquareSymbolCreator
  25035. /************************************************************************
  25036. ** IBM Confidential
  25037. **
  25038. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  25039. **
  25040. ** (C) Copyright IBM Corp. 2015
  25041. **
  25042. ** The source code for this program is not published or otherwise divested of its trade secrets,
  25043. ** irrespective of what has been deposited with the U.S. Copyright Office.
  25044. ************************************************************************/
  25045. // GENERATED
  25046. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  25047. /**
  25048. * Symbol creator for a Square shape
  25049. */
  25050. var com_ibm_rave_core_internal_svg_symbol_SquareSymbolCreator = com_ibm_rave_core_nativeImpl_Declare({
  25051. _$functionClassMethod : function() {
  25052. var _$self = /**
  25053. * create a Square symbol using the passed size
  25054. * @param (double) size size of the shape in square pixels
  25055. * @return (String) SVG path string for the shape
  25056. */
  25057. function(size) {
  25058. var r = Math.sqrt(size) / 2;
  25059. return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z";
  25060. };
  25061. return _$self;
  25062. }
  25063. });
  25064. // $source: com/ibm/rave/core/internal/svg/symbol/TriangleDownSymbolCreator
  25065. /************************************************************************
  25066. ** IBM Confidential
  25067. **
  25068. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  25069. **
  25070. ** (C) Copyright IBM Corp. 2015
  25071. **
  25072. ** The source code for this program is not published or otherwise divested of its trade secrets,
  25073. ** irrespective of what has been deposited with the U.S. Copyright Office.
  25074. ************************************************************************/
  25075. // GENERATED
  25076. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  25077. //@import com/ibm/rave/core/internal/svg/symbol/SymbolCreatorsConstants (runtime) // SymbolCreatorsConstants
  25078. /**
  25079. * Symbol creator for a TriangleDown shape
  25080. */
  25081. var com_ibm_rave_core_internal_svg_symbol_TriangleDownSymbolCreator = com_ibm_rave_core_nativeImpl_Declare({
  25082. _$functionClassMethod : function() {
  25083. var _$self = /**
  25084. * create a TriangleDown symbol using the passed size
  25085. * @param (double) size size of the shape in square pixels
  25086. * @return (String) SVG path string for the shape
  25087. */
  25088. function(size) {
  25089. var rx = Math.sqrt(size / com_ibm_rave_core_internal_svg_symbol_SymbolCreatorsConstants.r2_svg_symbolSqrt3), ry = rx * com_ibm_rave_core_internal_svg_symbol_SymbolCreatorsConstants.r2_svg_symbolSqrt3 / 2;
  25090. return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z";
  25091. };
  25092. return _$self;
  25093. }
  25094. });
  25095. // $source: com/ibm/rave/core/internal/svg/symbol/TriangleUpSymbolCreator
  25096. /************************************************************************
  25097. ** IBM Confidential
  25098. **
  25099. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  25100. **
  25101. ** (C) Copyright IBM Corp. 2015
  25102. **
  25103. ** The source code for this program is not published or otherwise divested of its trade secrets,
  25104. ** irrespective of what has been deposited with the U.S. Copyright Office.
  25105. ************************************************************************/
  25106. // GENERATED
  25107. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  25108. //@import com/ibm/rave/core/internal/svg/symbol/SymbolCreatorsConstants (runtime) // SymbolCreatorsConstants
  25109. /**
  25110. * Symbol creator for a TriangleUp shape
  25111. */
  25112. var com_ibm_rave_core_internal_svg_symbol_TriangleUpSymbolCreator = com_ibm_rave_core_nativeImpl_Declare({
  25113. _$functionClassMethod : function() {
  25114. var _$self = /**
  25115. * create a TriangleUp symbol using the passed size
  25116. * @param (double) size size of the shape in square pixels
  25117. * @return (String) SVG path string for the shape
  25118. */
  25119. function(size) {
  25120. var rx = Math.sqrt(size / com_ibm_rave_core_internal_svg_symbol_SymbolCreatorsConstants.r2_svg_symbolSqrt3), ry = rx * com_ibm_rave_core_internal_svg_symbol_SymbolCreatorsConstants.r2_svg_symbolSqrt3 / 2;
  25121. return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z";
  25122. };
  25123. return _$self;
  25124. }
  25125. });
  25126. // $source: com/ibm/rave/core/internal/svg/symbol/CircleSymbolCreator
  25127. /************************************************************************
  25128. ** IBM Confidential
  25129. **
  25130. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  25131. **
  25132. ** (C) Copyright IBM Corp. 2015
  25133. **
  25134. ** The source code for this program is not published or otherwise divested of its trade secrets,
  25135. ** irrespective of what has been deposited with the U.S. Copyright Office.
  25136. ************************************************************************/
  25137. // GENERATED
  25138. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  25139. /**
  25140. * Symbol creator for a circle shape
  25141. */
  25142. var com_ibm_rave_core_internal_svg_symbol_CircleSymbolCreator = com_ibm_rave_core_nativeImpl_Declare({
  25143. _$functionClassMethod : function() {
  25144. var _$self = /**
  25145. * create a circle symbol using the passed size
  25146. * @param (double) size size of the shape in square pixels
  25147. * @return (String) SVG path string for the shape
  25148. */
  25149. function(size) {
  25150. var r = Math.sqrt(size / 3.141592653589793);
  25151. return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + (-r) + "A" + r + "," + r + " 0 1,1 0," + r + "Z";
  25152. };
  25153. return _$self;
  25154. }
  25155. });
  25156. // $source: com/ibm/rave/core/svg/Symbol
  25157. /************************************************************************
  25158. ** IBM Confidential
  25159. **
  25160. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  25161. **
  25162. ** (C) Copyright IBM Corp. 2015
  25163. **
  25164. ** The source code for this program is not published or otherwise divested of its trade secrets,
  25165. ** irrespective of what has been deposited with the U.S. Copyright Office.
  25166. ************************************************************************/
  25167. // GENERATED
  25168. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  25169. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (runtime) // create
  25170. //@import com/ibm/rave/core/internal/svg/symbol/CrossSymbolCreator (static) // new
  25171. //@import com/ibm/rave/core/internal/svg/symbol/DiamondSymbolCreator (static) // new
  25172. //@import com/ibm/rave/core/internal/svg/symbol/SquareSymbolCreator (static) // new
  25173. //@import com/ibm/rave/core/internal/svg/symbol/TriangleDownSymbolCreator (static) // new
  25174. //@import com/ibm/rave/core/internal/svg/symbol/TriangleUpSymbolCreator (static) // new
  25175. //@import com/ibm/rave/core/internal/svg/symbol/CircleSymbolCreator (static) // new
  25176. /**
  25177. * Constructs a new symbol generator with the default type- and size-accessor functions (that make no assumptions about input data, and produce a circle sized 64 square pixels; see below for details). While the default accessors generate static symbols, it is common to set one or more of the accessors using a function, such as setting the size proportional to a dimension of data for a scatterplot.
  25178. */
  25179. var com_ibm_rave_core_svg_Symbol = rave_externs["Symbol"] = com_ibm_rave_core_nativeImpl_Declare({
  25180. //type_fn : null,
  25181. //size_fn : null,
  25182. _$functionClassMethod : function() {
  25183. var _$self = function(data, index, groupIndex) {
  25184. var type = _$self.type_fn.call(this, data, index, groupIndex);
  25185. var creator = com_ibm_rave_core_svg_Symbol.r2_svg_symbols.get(type);
  25186. if (!creator) {
  25187. creator = com_ibm_rave_core_svg_Symbol.r2_svg_symbolCircle;
  25188. }
  25189. return creator(_$self.size_fn.call(this, data, index, groupIndex));
  25190. };
  25191. return _$self;
  25192. },
  25193. constructor : function() {
  25194. this.type_fn = com_ibm_rave_core_svg_Symbol.TYPE_FN;
  25195. this.size_fn = com_ibm_rave_core_svg_Symbol.SIZE_FN;
  25196. },
  25197. /**
  25198. * returns accessor for the symbol type
  25199. * @return (com.ibm.rave.core.selector.ValueFunction) the symbol type accessor
  25200. */
  25201. type$0 : function() {
  25202. return this.type_fn;
  25203. },
  25204. /**
  25205. * sets the accessor for the symbol type
  25206. * @param (com.ibm.rave.core.selector.ValueFunction) valueFn , symbol type accessor
  25207. * @return (com.ibm.rave.core.svg.Symbol) the Symbol
  25208. */
  25209. type$1 : function(valueFn) {
  25210. this.type_fn = valueFn;
  25211. return this;
  25212. },
  25213. /**
  25214. * sets the symbol type
  25215. * @param (String) value the symbol type
  25216. * @return (com.ibm.rave.core.svg.Symbol) the Symbol
  25217. */
  25218. type$2 : function(value) {
  25219. this.type_fn = function(data, index, groupIndex) {
  25220. return value;
  25221. };
  25222. return this;
  25223. },
  25224. /**
  25225. * returns accessor for the symbol size, size is in square pixels
  25226. * @return (com.ibm.rave.core.selector.ValueFunction) the symbol size accessor
  25227. */
  25228. size$0 : function() {
  25229. return this.size_fn;
  25230. },
  25231. /**
  25232. * sets the accessor for the symbol size, size is expected to provided in square pixels
  25233. * @param (com.ibm.rave.core.selector.ValueFunction) valueFn , symbol size accessor
  25234. * @return (com.ibm.rave.core.svg.Symbol) the symbol
  25235. */
  25236. size$1 : function(valueFn) {
  25237. this.size_fn = valueFn;
  25238. return this;
  25239. },
  25240. /**
  25241. * sets the symbol size, size is expected to provided in square pixels
  25242. * @param (double) value the symbol size
  25243. * @return (com.ibm.rave.core.svg.Symbol) the Symbol
  25244. */
  25245. size$2 : function(value) {
  25246. this.size_fn = function(data, index, groupIndex) {
  25247. return value;
  25248. };
  25249. return this;
  25250. },
  25251. /** @expose */
  25252. type : function(a0) {
  25253. var args = arguments;
  25254. if (args.length == 0) {
  25255. return this.type$0();
  25256. }
  25257. if (args.length == 1 && typeof a0 === "function") {
  25258. return this.type$1(a0);
  25259. }
  25260. return this.type$2(a0);
  25261. },
  25262. /** @expose */
  25263. size : function(a0) {
  25264. var args = arguments;
  25265. if (args.length == 0) {
  25266. return this.size$0();
  25267. }
  25268. if (args.length == 1 && typeof a0 === "function") {
  25269. return this.size$1(a0);
  25270. }
  25271. return this.size$2(a0);
  25272. }
  25273. });
  25274. com_ibm_rave_core_svg_Symbol.createSymbols = function() {
  25275. var map = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  25276. map.set("circle", com_ibm_rave_core_svg_Symbol.r2_svg_symbolCircle);
  25277. map.set("cross", new com_ibm_rave_core_internal_svg_symbol_CrossSymbolCreator());
  25278. map.set("diamond", new com_ibm_rave_core_internal_svg_symbol_DiamondSymbolCreator());
  25279. map.set("square", new com_ibm_rave_core_internal_svg_symbol_SquareSymbolCreator());
  25280. map.set("triangle-down", new com_ibm_rave_core_internal_svg_symbol_TriangleDownSymbolCreator());
  25281. map.set("triangle-up", new com_ibm_rave_core_internal_svg_symbol_TriangleUpSymbolCreator());
  25282. return map;
  25283. };
  25284. com_ibm_rave_core_svg_Symbol.DEFAULT_SIZE = 64;
  25285. com_ibm_rave_core_svg_Symbol.r2_svg_symbols = com_ibm_rave_core_svg_Symbol.createSymbols();
  25286. com_ibm_rave_core_svg_Symbol.r2_svg_symbolCircle = new com_ibm_rave_core_internal_svg_symbol_CircleSymbolCreator();
  25287. com_ibm_rave_core_svg_Symbol.r2_svg_symbolTypes = com_ibm_rave_core_svg_Symbol.r2_svg_symbols.keys();
  25288. com_ibm_rave_core_svg_Symbol.SIZE_FN = function(data, index, groupIndex) {
  25289. return com_ibm_rave_core_svg_Symbol.DEFAULT_SIZE;
  25290. };
  25291. com_ibm_rave_core_svg_Symbol.TYPE_FN = function(data, index, groupIndex) {
  25292. return "circle";
  25293. };
  25294. // $source: com/ibm/rave/core/svg/Arc
  25295. /************************************************************************
  25296. ** IBM Confidential
  25297. **
  25298. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  25299. **
  25300. ** (C) Copyright IBM Corp. 2015
  25301. **
  25302. ** The source code for this program is not published or otherwise divested of its trade secrets,
  25303. ** irrespective of what has been deposited with the U.S. Copyright Office.
  25304. ************************************************************************/
  25305. // GENERATED
  25306. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  25307. //@import com/ibm/rave/core/internal/math/Trigonometry (runtime) // asin
  25308. //@import com/ibm/rave/core/internal/geom/PolygonUtil (runtime) // polygonIntersect
  25309. /**
  25310. * Arc is an SVG path generator helper class it generates an SVG path string representing an ARC using the values set on the generator parameters to control the path generator are: Inner radius : the inner radius of the curve {@link #this.innerRadius()} Outer radius : the outer radius of the curve {@link #this.outerRadius()} Start angle : the starting angle of the curve {@link #this.startAngle()} End angle : the end angle of the curve {@link #this.endAngle()}
  25311. */
  25312. var com_ibm_rave_core_svg_Arc = rave_externs["Arc"] = com_ibm_rave_core_nativeImpl_Declare({
  25313. //_innerRadius : null,
  25314. //_cornerRadius : null,
  25315. //_outerRadius : null,
  25316. //_startAngle : null,
  25317. //_endAngle : null,
  25318. //_arcPadAngle : null,
  25319. //_padRadius : null,
  25320. _$functionClassMethod : function() {
  25321. var _$self = /**
  25322. * Get a computed value for the given data and index.
  25323. * @param (Object) this the context in which this method is invoked
  25324. * @param (Object) data a data value, may be <code>null</code>
  25325. * @param (int) index the index of the current scene node
  25326. * @param (int) groupIndex the group index of the current scene node
  25327. * @return (String) a computed value
  25328. */
  25329. function(data, index, groupIndex) {
  25330. var l0 = 0;
  25331. var l1 = 0;
  25332. var r0 = Math.max(0, + (_$self._innerRadius.call(this, data, index, groupIndex)));
  25333. var r1 = Math.max(0, + (_$self._outerRadius.call(this, data, index, groupIndex)));
  25334. var a0 = _$self._startAngle.call(this, data, index, groupIndex) - (1.5707963267948966);
  25335. var a1 = _$self._endAngle.call(this, data, index, groupIndex) - (1.5707963267948966);
  25336. var da = Math.abs(a1 - a0);
  25337. var cw = a0 > a1 ? 0 : 1;
  25338. if (r1 < r0) {
  25339. var rc = r1;
  25340. r1 = r0;
  25341. r0 = rc;
  25342. }
  25343. if (da >= 6.283184307179586) {
  25344. return com_ibm_rave_core_svg_Arc.circleSegment(r1, cw) + (r0 != 0 && r0 != 0 ? com_ibm_rave_core_svg_Arc.circleSegment(r0, 1 - cw) : "") + "Z";
  25345. }
  25346. var rc, cr, rp, p0 = 0, p1 = 0, ap, x0, y0, x2, y2, x1 = NaN, y1 = NaN, x3 = NaN, y3 = NaN;
  25347. var path = "";
  25348. ap = + (_$self._arcPadAngle.call(this, data, index, groupIndex));
  25349. if ((ap)) {
  25350. ap = ap / 2;
  25351. rp = + ((_$self._padRadius == com_ibm_rave_core_svg_Arc.PAD_RADIUS ? Math.sqrt(r0 * r0 + r1 * r1) : + (_$self._padRadius.call(this, data, index, groupIndex))));
  25352. if (r1 != 0) {
  25353. p1 = com_ibm_rave_core_internal_math_Trigonometry.asin(rp / r1 * Math.sin(ap));
  25354. }
  25355. if (r0 != 0) {
  25356. p0 = com_ibm_rave_core_internal_math_Trigonometry.asin(rp / r0 * Math.sin(ap));
  25357. }
  25358. } else {
  25359. ap = 0.0;
  25360. }
  25361. if ((r1)) {
  25362. x0 = r1 * Math.cos(a0 + p1);
  25363. y0 = r1 * Math.sin(a0 + p1);
  25364. x1 = r1 * Math.cos(a1 - p1);
  25365. y1 = r1 * Math.sin(a1 - p1);
  25366. l1 = Math.abs(a1 - a0 - 2 * p1) <= 3.141592653589793 ? 0 : 1;
  25367. if ((p1 != 0.0 && (com_ibm_rave_core_svg_Arc.arcSweep(x0, y0, x1, y1)) == (cw ^ l1))) {
  25368. var h1 = (a0 + a1) / 2;
  25369. x0 = r1 * Math.cos(h1);
  25370. y0 = r1 * Math.sin(h1);
  25371. x1 = y1 = NaN;
  25372. }
  25373. } else {
  25374. x0 = y0 = 0.0;
  25375. }
  25376. if ((r0)) {
  25377. x2 = r0 * Math.cos(a1 - p0);
  25378. y2 = r0 * Math.sin(a1 - p0);
  25379. x3 = r0 * Math.cos(a0 + p0);
  25380. y3 = r0 * Math.sin(a0 + p0);
  25381. l0 = Math.abs(a0 - a1 + 2 * p0) <= 3.141592653589793 ? 0 : 1;
  25382. if ((p0) && ((com_ibm_rave_core_svg_Arc.arcSweep(x2, y2, x3, y3)) == ((1 - cw) ^ l0))) {
  25383. var h0 = (a0 + a1) / 2;
  25384. x2 = r0 * Math.cos(h0);
  25385. y2 = r0 * Math.sin(h0);
  25386. x3 = y3 = NaN;
  25387. }
  25388. } else {
  25389. x2 = y2 = 0.0;
  25390. }
  25391. if ((rc = Math.min(Math.abs(r1 - r0) / 2, + (_$self._cornerRadius.call(this, data, index, groupIndex)))) > 1e-3) {
  25392. cr = (r0 < r1) ^ (cw) ? 0 : 1;
  25393. var oc = isNaN(x3) ? [x2, y2] : isNaN(x1) ? [x0, y0] : com_ibm_rave_core_internal_geom_PolygonUtil.polygonIntersect([x0, y0], [x3, y3], [x1, y1], [x2, y2]);
  25394. var ax = x0 - oc[0];
  25395. var ay = y0 - oc[1];
  25396. var bx = x1 - oc[0];
  25397. var by = y1 - oc[1];
  25398. var kc = 1 / Math.sin(Math.acos((ax * bx + ay * by) / (Math.sqrt(ax * ax + ay * ay) * Math.sqrt(bx * bx + by * by))) / 2);
  25399. var lc = Math.sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
  25400. var rc1 = Math.min(rc, (r1 - lc) / (kc + 1));
  25401. var t12 = com_ibm_rave_core_svg_Arc.svg_arcCornerTangents([x1, y1], [x2, y2], r1, rc1, cw);
  25402. var t30 = com_ibm_rave_core_svg_Arc.svg_arcCornerTangents(isNaN(x3) ? [x2, y2] : [x3, y3], [x0, y0], r1, rc1, cw);
  25403. if (rc == rc1) {
  25404. path = path + "M" + t30[0] + "A" + rc1 + "," + rc1 + " 0 0," + cr + " ";
  25405. path = path + t30[1] + "A" + r1 + "," + r1 + " 0 " + ((1 - cw) ^ com_ibm_rave_core_svg_Arc.arcSweep(t30[1][0], t30[1][1], t12[1][0], t12[1][1])) + "," + cw + " " + t12[1] + "A" + rc1 + "," + rc1 + " 0 0," + cr + " " + t12[0];
  25406. } else {
  25407. path = path + "M" + t30[0] + "A" + rc1 + "," + rc1 + " 0 1," + cr + " " + t12[0];
  25408. }
  25409. if (!(isNaN(x3))) {
  25410. var rc0 = Math.min(rc, (r0 - lc) / (kc - 1));
  25411. var t21 = com_ibm_rave_core_svg_Arc.svg_arcCornerTangents([x2, y2], isNaN(x1) ? [x0, y0] : [x1, y1], r0, -rc0, cw);
  25412. var t03 = com_ibm_rave_core_svg_Arc.svg_arcCornerTangents([x0, y0], [x3, y3], r0, -rc0, cw);
  25413. if (rc == rc0) {
  25414. path = path + "L" + t21[0] + "A" + rc0 + "," + rc0 + " 0 0," + cr + " ";
  25415. path = path + t21[1] + "A" + r0 + "," + r0 + " 0 " + (cw ^ com_ibm_rave_core_svg_Arc.arcSweep(t21[1][0], t21[1][1], t03[1][0], t03[1][1])) + "," + (1 - cw) + " " + t03[1] + "A" + rc0 + "," + rc0 + " 0 0," + cr + " " + t03[0];
  25416. } else {
  25417. path = path + "L" + t21[0] + "A" + rc0 + "," + rc0 + " 0 0," + cr + " " + t03[0];
  25418. }
  25419. } else {
  25420. path = path + "L" + x2 + "," + y2;
  25421. }
  25422. } else {
  25423. path = path + "M" + x0 + "," + y0;
  25424. if (!(isNaN(x1))) {
  25425. path = path + "A" + r1 + "," + r1 + " 0 " + l1 + "," + cw + " " + x1 + "," + y1;
  25426. }
  25427. path = path + "L" + x2 + "," + y2;
  25428. if (!(isNaN(x3))) {
  25429. path = path + "A" + r0 + "," + r0 + " 0 " + l0 + "," + (1 - cw) + " " + x3 + "," + y3;
  25430. }
  25431. }
  25432. path = path + "Z";
  25433. return path;
  25434. };
  25435. return _$self;
  25436. },
  25437. constructor : function() {
  25438. this._innerRadius = com_ibm_rave_core_svg_Arc.INNER_RADIUS;
  25439. this._cornerRadius = com_ibm_rave_core_svg_Arc.CORNER_RADIUS;
  25440. this._outerRadius = com_ibm_rave_core_svg_Arc.OUTER_RADIUS;
  25441. this._startAngle = com_ibm_rave_core_svg_Arc.START_ANGLE;
  25442. this._endAngle = com_ibm_rave_core_svg_Arc.END_ANGLE;
  25443. this._arcPadAngle = com_ibm_rave_core_svg_Arc.PAD_ANGLE;
  25444. this._padRadius = com_ibm_rave_core_svg_Arc.PAD_RADIUS;
  25445. },
  25446. /**
  25447. * sets the inner radius value function, function that will be called by the arc class to get the value on inner radius
  25448. * @param (com.ibm.rave.core.selector.ValueFunction) innerRadiusFn the inner radius function
  25449. * @return (com.ibm.rave.core.svg.Arc) this
  25450. */
  25451. innerRadius$0 : function(innerRadiusFn) {
  25452. this._innerRadius = innerRadiusFn;
  25453. return this;
  25454. },
  25455. /**
  25456. * sets the inner radius value
  25457. * @param (double) value the inner radius value
  25458. * @return (com.ibm.rave.core.svg.Arc) this
  25459. */
  25460. innerRadius$1 : function(value) {
  25461. this._innerRadius = function(data, index, groupIndex) {
  25462. return value;
  25463. };
  25464. return this;
  25465. },
  25466. /**
  25467. * gets the inner radius value function
  25468. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  25469. */
  25470. innerRadius$2 : function() {
  25471. return this._innerRadius;
  25472. },
  25473. /**
  25474. * sets the outer radius value function, function that will be called by the arc class to get the value on outer radius
  25475. * @param (com.ibm.rave.core.selector.ValueFunction) outerRadiusFn the outer radius function
  25476. * @return (com.ibm.rave.core.svg.Arc) this
  25477. */
  25478. outerRadius$0 : function(outerRadiusFn) {
  25479. this._outerRadius = outerRadiusFn;
  25480. return this;
  25481. },
  25482. /**
  25483. * sets the outer radius value
  25484. * @param (double) value the outer radius value
  25485. * @return (com.ibm.rave.core.svg.Arc) this
  25486. */
  25487. outerRadius$1 : function(value) {
  25488. this._outerRadius = function(data, index, groupIndex) {
  25489. return value;
  25490. };
  25491. return this;
  25492. },
  25493. /**
  25494. * gets the outer radius value function
  25495. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  25496. */
  25497. outerRadius$2 : function() {
  25498. return this._outerRadius;
  25499. },
  25500. /**
  25501. * sets the start angle value function, function that will be called by the arc class to get the value on start angle
  25502. * @param (com.ibm.rave.core.selector.ValueFunction) startAngleFn the start angle function
  25503. * @return (com.ibm.rave.core.svg.Arc) this
  25504. */
  25505. startAngle$0 : function(startAngleFn) {
  25506. this._startAngle = startAngleFn;
  25507. return this;
  25508. },
  25509. /**
  25510. * sets the start angle value
  25511. * @param (double) value the start angle value
  25512. * @return (com.ibm.rave.core.svg.Arc) this
  25513. */
  25514. startAngle$1 : function(value) {
  25515. this._startAngle = function(data, index, groupIndex) {
  25516. return value;
  25517. };
  25518. return this;
  25519. },
  25520. /**
  25521. * gets the start angle value function
  25522. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  25523. */
  25524. startAngle$2 : function() {
  25525. return this._startAngle;
  25526. },
  25527. /**
  25528. * sets the end angle value function, function that will be called by the arc class to get the value on end angle
  25529. * @param (com.ibm.rave.core.selector.ValueFunction) endAngleFn the end angle function
  25530. * @return (com.ibm.rave.core.svg.Arc) this
  25531. */
  25532. endAngle$0 : function(endAngleFn) {
  25533. this._endAngle = endAngleFn;
  25534. return this;
  25535. },
  25536. /**
  25537. * sets the end angle value
  25538. * @param (double) value the end angle value
  25539. * @return (com.ibm.rave.core.svg.Arc) this
  25540. */
  25541. endAngle$1 : function(value) {
  25542. this._endAngle = function(data, index, groupIndex) {
  25543. return value;
  25544. };
  25545. return this;
  25546. },
  25547. /**
  25548. * gets the end angle value function
  25549. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  25550. */
  25551. endAngle$2 : function() {
  25552. return this._endAngle;
  25553. },
  25554. /**
  25555. * sets the arc pad angle value function, function that will be called by the arc class to get the value on end angle
  25556. * @param (com.ibm.rave.core.selector.ValueFunction) padAngleFn the pad angle function
  25557. * @return (com.ibm.rave.core.svg.Arc) this
  25558. */
  25559. padAngle$0 : function(padAngleFn) {
  25560. this._arcPadAngle = padAngleFn;
  25561. return this;
  25562. },
  25563. /**
  25564. * sets the arc pad angle value
  25565. * @param (double) value the pad angle value
  25566. * @return (com.ibm.rave.core.svg.Arc) this
  25567. */
  25568. padAngle$1 : function(value) {
  25569. this._arcPadAngle = function(data, index, groupIndex) {
  25570. return value;
  25571. };
  25572. return this;
  25573. },
  25574. /**
  25575. * gets the arc pad angle value function
  25576. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  25577. */
  25578. padAngle$2 : function() {
  25579. return this._arcPadAngle;
  25580. },
  25581. /**
  25582. * sets the corner radius value function, function that will be called by the arc class to get the value on corner radius
  25583. * @param (com.ibm.rave.core.selector.ValueFunction) cornerRadiusFn the end angle function
  25584. * @return (com.ibm.rave.core.svg.Arc) this
  25585. */
  25586. cornerRadius$0 : function(cornerRadiusFn) {
  25587. this._cornerRadius = cornerRadiusFn;
  25588. return this;
  25589. },
  25590. /**
  25591. * sets the corner radius value
  25592. * @param (double) value the corner radius value
  25593. * @return (com.ibm.rave.core.svg.Arc) this
  25594. */
  25595. cornerRadius$1 : function(value) {
  25596. this._cornerRadius = function(data, index, groupIndex) {
  25597. return value;
  25598. };
  25599. return this;
  25600. },
  25601. /**
  25602. * gets the corner radius value function
  25603. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  25604. */
  25605. cornerRadius$2 : function() {
  25606. return this._cornerRadius;
  25607. },
  25608. /**
  25609. * sets the pad radius value function, function that will be called by the arc class to get the value on pad radius
  25610. * @param (com.ibm.rave.core.selector.ValueFunction) padRadiusFn the pad radius function
  25611. * @return (com.ibm.rave.core.svg.Arc) this
  25612. */
  25613. padRadius$0 : function(padRadiusFn) {
  25614. this._padRadius = padRadiusFn;
  25615. return this;
  25616. },
  25617. /**
  25618. * sets the pad radius value
  25619. * @param (double) value the pad radius value
  25620. * @return (com.ibm.rave.core.svg.Arc) this
  25621. */
  25622. padRadius$1 : function(value) {
  25623. this._padRadius = function(data, index, groupIndex) {
  25624. return value;
  25625. };
  25626. return this;
  25627. },
  25628. /**
  25629. * gets the pad radius value function
  25630. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  25631. */
  25632. padRadius$2 : function() {
  25633. return this._padRadius;
  25634. },
  25635. /**
  25636. * Calculates the centroid of the arc that would be generated from a specified input. The centroid is defined as the midpoint in polar coordinates of the inner and outer radius, and the start and end angle.
  25637. * @param (Object) data The input used to calculate the centroids
  25638. * @param (int) index The current index
  25639. * @param (int) groupIndex The current group index
  25640. * @return (double[]) The centroid of the arc
  25641. */
  25642. /** @expose */
  25643. centroid : function(data, index, groupIndex) {
  25644. var r = (this._innerRadius.call(this, data, index, groupIndex) + this._outerRadius.call(this, data, index, groupIndex)) / 2, a = (this._startAngle.call(this, data, index, groupIndex) + this._endAngle.call(this, data, index, groupIndex)) / 2 - (1.5707963267948966);
  25645. return [Math.cos(a) * r, Math.sin(a) * r];
  25646. },
  25647. /** @expose */
  25648. innerRadius : function(a0) {
  25649. var args = arguments;
  25650. if (args.length == 0) {
  25651. return this.innerRadius$2();
  25652. }
  25653. if (args.length == 1 && typeof a0 === "function") {
  25654. return this.innerRadius$0(a0);
  25655. }
  25656. return this.innerRadius$1(a0);
  25657. },
  25658. /** @expose */
  25659. outerRadius : function(a0) {
  25660. var args = arguments;
  25661. if (args.length == 0) {
  25662. return this.outerRadius$2();
  25663. }
  25664. if (args.length == 1 && typeof a0 === "function") {
  25665. return this.outerRadius$0(a0);
  25666. }
  25667. return this.outerRadius$1(a0);
  25668. },
  25669. /** @expose */
  25670. startAngle : function(a0) {
  25671. var args = arguments;
  25672. if (args.length == 0) {
  25673. return this.startAngle$2();
  25674. }
  25675. if (args.length == 1 && typeof a0 === "function") {
  25676. return this.startAngle$0(a0);
  25677. }
  25678. return this.startAngle$1(a0);
  25679. },
  25680. /** @expose */
  25681. endAngle : function(a0) {
  25682. var args = arguments;
  25683. if (args.length == 0) {
  25684. return this.endAngle$2();
  25685. }
  25686. if (args.length == 1 && typeof a0 === "function") {
  25687. return this.endAngle$0(a0);
  25688. }
  25689. return this.endAngle$1(a0);
  25690. },
  25691. /** @expose */
  25692. padAngle : function(a0) {
  25693. var args = arguments;
  25694. if (args.length == 0) {
  25695. return this.padAngle$2();
  25696. }
  25697. if (args.length == 1 && typeof a0 === "function") {
  25698. return this.padAngle$0(a0);
  25699. }
  25700. return this.padAngle$1(a0);
  25701. },
  25702. /** @expose */
  25703. cornerRadius : function(a0) {
  25704. var args = arguments;
  25705. if (args.length == 0) {
  25706. return this.cornerRadius$2();
  25707. }
  25708. if (args.length == 1 && typeof a0 === "function") {
  25709. return this.cornerRadius$0(a0);
  25710. }
  25711. return this.cornerRadius$1(a0);
  25712. },
  25713. /** @expose */
  25714. padRadius : function(a0) {
  25715. var args = arguments;
  25716. if (args.length == 0) {
  25717. return this.padRadius$2();
  25718. }
  25719. if (args.length == 1 && typeof a0 === "function") {
  25720. return this.padRadius$0(a0);
  25721. }
  25722. return this.padRadius$1(a0);
  25723. }
  25724. });
  25725. com_ibm_rave_core_svg_Arc.circleSegment = function(r1, cw) {
  25726. return "M0," + r1 + "A" + r1 + "," + r1 + " 0 1," + cw + " 0," + -r1 + "A" + r1 + "," + r1 + " 0 1," + cw + " 0," + r1;
  25727. };
  25728. com_ibm_rave_core_svg_Arc.arcSweep = function(x0, y0, x1, y1) {
  25729. return (x0 - x1) * y0 - (y0 - y1) * x0 > 0 ? 0 : 1;
  25730. };
  25731. com_ibm_rave_core_svg_Arc.svg_arcCornerTangents = function(p0, p1, r1, rc, cw) {
  25732. var x01 = p0[0] - p1[0], y01 = p0[1] - p1[1], lo = (cw != null ? rc : -rc) / Math.sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x1 = p0[0] + ox, y1 = p0[1] + oy, x2 = p1[0] + ox, y2 = p1[1] + oy, x3 = (x1 + x2) / 2, y3 = (y1 + y2) / 2, dx = x2 - x1, dy = y2 - y1, d2 = dx * dx + dy * dy, r = r1 - rc, D = x1 * y2 - x2 * y1, d = (dy < 0 ? -1 : 1) * Math.sqrt(r * r * d2 - D * D), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x3, dy0 = cy0 - y3, dx1 = cx1 - x3, dy1 = cy1 - y3;
  25733. if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) {
  25734. cx0 = cx1;
  25735. cy0 = cy1;
  25736. }
  25737. return [[cx0 - ox, cy0 - oy], [cx0 * r1 / r, cy0 * r1 / r]];
  25738. };
  25739. com_ibm_rave_core_svg_Arc.INNER_RADIUS = function(data, index, groupIndex) {
  25740. return (data)["innerRadius"];
  25741. };
  25742. com_ibm_rave_core_svg_Arc.OUTER_RADIUS = function(data, index, groupIndex) {
  25743. return (data)["outerRadius"];
  25744. };
  25745. com_ibm_rave_core_svg_Arc.START_ANGLE = function(data, index, groupIndex) {
  25746. return (data)["startAngle"];
  25747. };
  25748. com_ibm_rave_core_svg_Arc.END_ANGLE = function(data, index, groupIndex) {
  25749. return (data)["endAngle"];
  25750. };
  25751. com_ibm_rave_core_svg_Arc.CORNER_RADIUS = function(data, index, groupIndex) {
  25752. return 0.0;
  25753. };
  25754. com_ibm_rave_core_svg_Arc.PAD_ANGLE = function(data, index, groupIndex) {
  25755. if (data == null) {
  25756. return null;
  25757. }
  25758. return (data)["padAngle"];
  25759. };
  25760. com_ibm_rave_core_svg_Arc.PAD_RADIUS = function(data, index, groupIndex) {
  25761. return "auto";
  25762. };
  25763. com_ibm_rave_core_svg_Arc.svg_arcMax = 6.283185307179586 - 1.0E-6;
  25764. // $source: com/ibm/rave/core/svg/Chord
  25765. /************************************************************************
  25766. ** IBM Confidential
  25767. **
  25768. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  25769. **
  25770. ** (C) Copyright IBM Corp. 2015
  25771. **
  25772. ** The source code for this program is not published or otherwise divested of its trade secrets,
  25773. ** irrespective of what has been deposited with the U.S. Copyright Office.
  25774. ************************************************************************/
  25775. // GENERATED
  25776. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  25777. //@import com/ibm/rave/core/svg/Arc (runtime) // Arc
  25778. /**
  25779. * Chord svg path generator. This class generates a path representing a chord. It depends on results generated by {@link ChordLayout} and uses the {@link (com.ibm.rave.core.svg.Arc) Arc} svg path generator.
  25780. */
  25781. var com_ibm_rave_core_svg_Chord = rave_externs["Chord"] = com_ibm_rave_core_nativeImpl_Declare({
  25782. //_source : null,
  25783. //_target : null,
  25784. //_radius : null,
  25785. //_startAngle : null,
  25786. //_endAngle : null,
  25787. _$functionClassMethod : function() {
  25788. var _$self = function(data, index, groupIndex) {
  25789. var s = _$self.subgroup(this, _$self._source, data, index, groupIndex), t = _$self.subgroup(this, _$self._target, data, index, groupIndex);
  25790. return "M" + (s.p0) + _$self.arc(s.r, s.p1, s.a1 - s.a0) + (_$self.equals(s, t) ? _$self.curve(s.r, s.p1, s.r, s.p0) : _$self.curve(s.r, s.p1, t.r, t.p0) + _$self.arc(t.r, t.p1, t.a1 - t.a0) + _$self.curve(t.r, t.p1, s.r, s.p0)) + "Z";
  25791. };
  25792. return _$self;
  25793. },
  25794. constructor : function() {
  25795. this._source = com_ibm_rave_core_svg_Chord.SOURCE;
  25796. this._target = com_ibm_rave_core_svg_Chord.TARGET;
  25797. this._radius = com_ibm_rave_core_svg_Chord.RAIDUS;
  25798. this._startAngle = com_ibm_rave_core_svg_Arc.START_ANGLE;
  25799. this._endAngle = com_ibm_rave_core_svg_Arc.END_ANGLE;
  25800. },
  25801. subgroup : function(context, f, d, i, groupIndex) {
  25802. var subgroup = f.call(context, d, i, groupIndex);
  25803. var r = this._radius.call(context, subgroup, i, groupIndex);
  25804. var a0 = this._startAngle.call(context, subgroup, i, groupIndex) - 1.5707963267948966;
  25805. var a1 = this._endAngle.call(context, subgroup, i, groupIndex) - 1.5707963267948966;
  25806. return new com_ibm_rave_core_svg_Chord.SubGroup(r, a0, a1, [r * Math.cos(a0), r * Math.sin(a0)], [r * Math.cos(a1), r * Math.sin(a1)]);
  25807. },
  25808. equals : function(a, b) {
  25809. return a.a0 == b.a0 && a.a1 == b.a1;
  25810. },
  25811. arc : function(r, p, a) {
  25812. return "A" + r + "," + r + " 0 " + +(a > 3.141592653589793) + ",1 " + (p);
  25813. },
  25814. curve : function(r0, p0, r1, p1) {
  25815. return "Q 0,0 " + (p1);
  25816. },
  25817. /**
  25818. * sets the end angle value function, function that will be called by the chord class to get the value on end angle
  25819. * @param (com.ibm.rave.core.selector.ValueFunction) endAngleFn the end angle function
  25820. * @return (com.ibm.rave.core.svg.Chord) this
  25821. */
  25822. endAngle$0 : function(endAngleFn) {
  25823. this._endAngle = endAngleFn;
  25824. return this;
  25825. },
  25826. /**
  25827. * sets the end angle value
  25828. * @param (double) value the end angle value
  25829. * @return (com.ibm.rave.core.svg.Chord) this
  25830. */
  25831. endAngle$1 : function(value) {
  25832. this._endAngle = function(data, index, groupIndex) {
  25833. return value;
  25834. };
  25835. return this;
  25836. },
  25837. /**
  25838. * gets the end angle value function
  25839. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  25840. */
  25841. endAngle$2 : function() {
  25842. return this._endAngle;
  25843. },
  25844. /**
  25845. * sets the start angle value function, function that will be called by the chord class to get the value on start angle
  25846. * @param (com.ibm.rave.core.selector.ValueFunction) startAngleFn the start angle function
  25847. * @return (com.ibm.rave.core.svg.Chord) this
  25848. */
  25849. startAngle$0 : function(startAngleFn) {
  25850. this._startAngle = startAngleFn;
  25851. return this;
  25852. },
  25853. /**
  25854. * sets the start angle value
  25855. * @param (double) value the start angle value
  25856. * @return (com.ibm.rave.core.svg.Chord) this
  25857. */
  25858. startAngle$1 : function(value) {
  25859. this._startAngle = function(data, index, groupIndex) {
  25860. return value;
  25861. };
  25862. return this;
  25863. },
  25864. /**
  25865. * gets the start angle value function
  25866. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  25867. */
  25868. startAngle$2 : function() {
  25869. return this._startAngle;
  25870. },
  25871. /**
  25872. * sets the source value function, function that will be called by the chord class to get the value on source
  25873. * @param (com.ibm.rave.core.selector.ValueFunction) sourceFn the source angle function
  25874. * @return (com.ibm.rave.core.svg.Chord) this
  25875. */
  25876. source$0 : function(sourceFn) {
  25877. this._source = sourceFn;
  25878. return this;
  25879. },
  25880. /**
  25881. * sets the source value
  25882. * @param (com.ibm.rave.core.layout.chord.SubGroupData) sourceValue the source value
  25883. * @return (com.ibm.rave.core.svg.Chord) this
  25884. */
  25885. source$1 : function(sourceValue) {
  25886. this._source = function(data, index, groupIndex) {
  25887. return sourceValue;
  25888. };
  25889. return this;
  25890. },
  25891. /**
  25892. * gets the source value function
  25893. * @return (com.ibm.rave.core.selector.ValueFunction) the source function
  25894. */
  25895. source$2 : function() {
  25896. return this._source;
  25897. },
  25898. /**
  25899. * sets the target value function, function that will be called by the chord class to get the value on target
  25900. * @param (com.ibm.rave.core.selector.ValueFunction) targetFn the start angle function
  25901. * @return (com.ibm.rave.core.svg.Chord) this
  25902. */
  25903. target$0 : function(targetFn) {
  25904. this._target = targetFn;
  25905. return this;
  25906. },
  25907. /**
  25908. * sets the target value
  25909. * @param (com.ibm.rave.core.layout.chord.SubGroupData) value the target value
  25910. * @return (com.ibm.rave.core.svg.Chord) this
  25911. */
  25912. target$1 : function(value) {
  25913. this._target = function(data, index, groupIndex) {
  25914. return value;
  25915. };
  25916. return this;
  25917. },
  25918. /**
  25919. * gets the target value function
  25920. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  25921. */
  25922. target$2 : function() {
  25923. return this._target;
  25924. },
  25925. /**
  25926. * sets the radius value function, function that will be called by the chord class to get the value of radius
  25927. * @param (com.ibm.rave.core.selector.ValueFunction) radiusFn the radius function
  25928. * @return (com.ibm.rave.core.svg.Chord) this
  25929. */
  25930. radius$0 : function(radiusFn) {
  25931. this._radius = radiusFn;
  25932. return this;
  25933. },
  25934. /**
  25935. * sets the radius value
  25936. * @param (double) value the radius value
  25937. * @return (com.ibm.rave.core.svg.Chord) this
  25938. */
  25939. radius$1 : function(value) {
  25940. this._radius = function(data, index, groupIndex) {
  25941. return value;
  25942. };
  25943. return this;
  25944. },
  25945. /**
  25946. * gets the radius value function
  25947. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  25948. */
  25949. radius$2 : function() {
  25950. return this._radius;
  25951. },
  25952. /** @expose */
  25953. endAngle : function(a0) {
  25954. var args = arguments;
  25955. if (args.length == 0) {
  25956. return this.endAngle$2();
  25957. }
  25958. if (args.length == 1 && typeof a0 === "function") {
  25959. return this.endAngle$0(a0);
  25960. }
  25961. return this.endAngle$1(a0);
  25962. },
  25963. /** @expose */
  25964. startAngle : function(a0) {
  25965. var args = arguments;
  25966. if (args.length == 0) {
  25967. return this.startAngle$2();
  25968. }
  25969. if (args.length == 1 && typeof a0 === "function") {
  25970. return this.startAngle$0(a0);
  25971. }
  25972. return this.startAngle$1(a0);
  25973. },
  25974. /** @expose */
  25975. source : function(a0) {
  25976. var args = arguments;
  25977. if (args.length == 0) {
  25978. return this.source$2();
  25979. }
  25980. if (args.length == 1 && typeof a0 === "function") {
  25981. return this.source$0(a0);
  25982. }
  25983. return this.source$1(a0);
  25984. },
  25985. /** @expose */
  25986. target : function(a0) {
  25987. var args = arguments;
  25988. if (args.length == 0) {
  25989. return this.target$2();
  25990. }
  25991. if (args.length == 1 && typeof a0 === "function") {
  25992. return this.target$0(a0);
  25993. }
  25994. return this.target$1(a0);
  25995. },
  25996. /** @expose */
  25997. radius : function(a0) {
  25998. var args = arguments;
  25999. if (args.length == 0) {
  26000. return this.radius$2();
  26001. }
  26002. if (args.length == 1 && typeof a0 === "function") {
  26003. return this.radius$0(a0);
  26004. }
  26005. return this.radius$1(a0);
  26006. }
  26007. });
  26008. com_ibm_rave_core_svg_Chord.SubGroup = function(r, a0, a1, p0, p1) {
  26009. this.r = r;
  26010. this.a0 = a0;
  26011. this.a1 = a1;
  26012. this.p0 = p0;
  26013. this.p1 = p1;
  26014. };
  26015. com_ibm_rave_core_svg_Chord.SOURCE = function(data, index, groupIndex) {
  26016. return (data)["source"];
  26017. };
  26018. com_ibm_rave_core_svg_Chord.TARGET = function(data, index, groupIndex) {
  26019. return (data)["target"];
  26020. };
  26021. com_ibm_rave_core_svg_Chord.RAIDUS = function(data, index, groupIndex) {
  26022. return (data).radius;
  26023. };
  26024. // $source: com/ibm/rave/core/svg/Axis
  26025. /************************************************************************
  26026. ** IBM Confidential
  26027. **
  26028. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  26029. **
  26030. ** (C) Copyright IBM Corp. 2015
  26031. **
  26032. ** The source code for this program is not published or otherwise divested of its trade secrets,
  26033. ** irrespective of what has been deposited with the U.S. Copyright Office.
  26034. ************************************************************************/
  26035. // GENERATED
  26036. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  26037. //@import com/ibm/rave/core/scales/Scales (runtime) // Scales
  26038. //@import com/ibm/rave/core/selector/Selector (runtime) // new
  26039. //@import com/ibm/rave/core/transition/Transition (runtime) // newTransition
  26040. //@import com/ibm/rave/core/scales/AbstractScale (loadtime) // scaleRange, superclass
  26041. //@import com/ibm/rave/core/internal/util/Identity (static) // create
  26042. /**
  26043. * An axis is a visual representation of a scale. The Axis class will generate a reference line, ticks and labels automatically for a given scale (see {@link (com.ibm.rave.core.scales.AbstractScale) AbstractScale} ).
  26044. */
  26045. var com_ibm_rave_core_svg_Axis = rave_externs["Axis"] = com_ibm_rave_core_nativeImpl_Declare({
  26046. //_scale : null,
  26047. //_orient : null,
  26048. //_tickArguments : null,
  26049. _tickValues : null,
  26050. //_tickFormat : null,
  26051. //_tickHandler : null,
  26052. _innerTickSize : 6.0,
  26053. _outerTickSize : 6.0,
  26054. _tickPadding : 3.0,
  26055. _$functionClassMethod : function() {
  26056. var _$self = function(args) {
  26057. if (args !== null || arguments.length > 1){
  26058. args = Array.prototype.slice.call(arguments, 0);
  26059. }
  26060. {
  26061. _$self.axis(args[0]);
  26062. return null;
  26063. }
  26064. };
  26065. return _$self;
  26066. },
  26067. constructor : function() {
  26068. this._scale = com_ibm_rave_core_scales_Scales.INSTANCE.linear();
  26069. this._orient = "bottom";
  26070. this._tickArguments = [10.0];
  26071. },
  26072. /** @expose */
  26073. axis : function(g) {
  26074. var self = this;
  26075. g.each(function(data, index, groupIndex) {
  26076. var g = new com_ibm_rave_core_selector_Selector().init(this);
  26077. var __chart__ = this.rave_getProperty("__chart__");
  26078. var scale0 = __chart__ != null ? __chart__ : self._scale;
  26079. var scale1 = self._scale.copy();
  26080. this.rave_setProperty("__chart__", scale1);
  26081. var ticks = self._tickValues;
  26082. if (!ticks) {
  26083. if (scale1.ticksInRange) {
  26084. ticks = scale1.ticksInRange();
  26085. } else if (scale1.ticks) {
  26086. ticks = scale1.ticks.apply(scale1.ticks, self._tickArguments);
  26087. } else {
  26088. ticks = scale1.domain();
  26089. }
  26090. }
  26091. var tickFormat = self._tickFormat;
  26092. if (tickFormat == null) {
  26093. if (scale1.tickFormat) {
  26094. tickFormat = scale1.tickFormat.apply(scale1.tickFormat, self._tickArguments);
  26095. } else {
  26096. tickFormat = com_ibm_rave_core_svg_Axis._identity;
  26097. }
  26098. }
  26099. var tick = g.selectAll(".tick").data(ticks, scale1);
  26100. var tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick").style("opacity", 1.0E-6);
  26101. var tickExit = com_ibm_rave_core_transition_Transition.newTransition(tick.exit()).style("opacity", 1.0E-6).remove();
  26102. var tickUpdate = com_ibm_rave_core_transition_Transition.newTransition(tick.order()).style("opacity", 1);
  26103. var tickSpacing = Math.max(self._innerTickSize, 0) + self._tickPadding;
  26104. var tickTransformFunction;
  26105. var range = com_ibm_rave_core_scales_AbstractScale.scaleRange(scale1);
  26106. var path = g.selectAll(".domain").data([0.0]);
  26107. path.enter().append("path").attr("class", "domain");
  26108. var pathUpdate = com_ibm_rave_core_transition_Transition.newTransition(path);
  26109. tickEnter.append("line");
  26110. tickEnter.append("text");
  26111. var lineEnter = tickEnter.select("line");
  26112. var lineUpdate = tickUpdate.select("line");
  26113. var text = tick.select("text").text(typeof tickFormat === "function" ? tickFormat : tickFormat);
  26114. var textEnter = tickEnter.select("text");
  26115. var textUpdate = tickUpdate.select("text");
  26116. var sign = "top" == self._orient || "left" == self._orient ? -1 : 1;
  26117. var x1, x2, y1, y2;
  26118. if ("bottom" == self._orient || "top" == self._orient) {
  26119. tickTransformFunction = com_ibm_rave_core_svg_Axis.HORIZONTAL_TRANSFORM;
  26120. x1 = "x";
  26121. y1 = "y";
  26122. x2 = "x2";
  26123. y2 = "y2";
  26124. text.attr("dy", sign < 0 ? "0em" : ".71em").style("text-anchor", "middle");
  26125. pathUpdate.attr("d", "M" + range[0] + "," + (sign * self._outerTickSize) + "V" + "0" + "H" + range[1] + "V" + (sign * self._outerTickSize));
  26126. } else {
  26127. tickTransformFunction = com_ibm_rave_core_svg_Axis.VERTICAL_TRANSFORM;
  26128. x1 = "y";
  26129. y1 = "x";
  26130. x2 = "y2";
  26131. y2 = "x2";
  26132. text.attr("dy", ".32em").style("text-anchor", sign < 0 ? "end" : "start");
  26133. pathUpdate.attr("d", "M" + (sign * self._outerTickSize) + "," + range[0] + "H" + "0" + "V" + range[1] + "H" + (sign * self._outerTickSize));
  26134. }
  26135. lineEnter.attr(y2, sign * self._innerTickSize);
  26136. textEnter.attr(y1, sign * tickSpacing);
  26137. lineUpdate.attr(x2, 0).attr(y2, sign * self._innerTickSize);
  26138. textUpdate.attr(x1, 0).attr(y1, sign * tickSpacing);
  26139. if (scale1.rangeBand) {
  26140. var dx = scale1.rangeBand() / 2;
  26141. scale0 = scale1 = new com_ibm_rave_core_svg_Axis.DeltaScale(scale1, dx);
  26142. } else if (scale0.rangeBand) {
  26143. scale0 = scale1;
  26144. } else {
  26145. tickTransformFunction(tickExit, scale1, scale0);
  26146. }
  26147. tickTransformFunction(tickEnter, scale0, scale1);
  26148. tickTransformFunction(tickUpdate, scale1, scale1);
  26149. if (self._tickHandler) {
  26150. self._tickHandler.call(this, g, self._orient);
  26151. }
  26152. });
  26153. },
  26154. /**
  26155. * Set the scale this axis should represent.
  26156. * @param (com.ibm.rave.core.scales.AbstractScale) scale The scale object to assign to this axis (e.g. LinearScale, OrdinalScale).
  26157. * @return (com.ibm.rave.core.svg.Axis) this Axis instance.
  26158. */
  26159. scale$0 : function(scale) {
  26160. this._scale = scale;
  26161. return this;
  26162. },
  26163. /**
  26164. * Get the scale assigned to this axis.
  26165. * @return (com.ibm.rave.core.scales.AbstractScale) Scale ValueFunction.
  26166. */
  26167. scale$1 : function() {
  26168. return this._scale;
  26169. },
  26170. /**
  26171. * Set the axis orientation. Can be one of: <ul> <li>bottom</li> <li>top</li> <li>left</li> <li>right</li> </ul>
  26172. * @param (String) orientation The orientation to assign to this axis.
  26173. * @return (com.ibm.rave.core.svg.Axis) this Axis instance.
  26174. */
  26175. orient$0 : function(orientation) {
  26176. if ("bottom" == orientation || "top" == orientation || "left" == orientation || "right" == orientation) {
  26177. this._orient = orientation;
  26178. } else {
  26179. this._orient = "bottom";
  26180. }
  26181. return this;
  26182. },
  26183. /**
  26184. * Get the current orientation.
  26185. * @return (String) Orientation String.
  26186. */
  26187. orient$1 : function() {
  26188. return this._orient;
  26189. },
  26190. /**
  26191. * Set the tick generation arguments. These arguments will be passed along to the {@link #this.ticks()} method. For example, an axis with a linear scale can generate a given number of ticks (approximately) by: <pre> Axis axis = Rave.svg.axis(); axis.scale(Rave.scale.linear()); axis.ticks(20); // Generate &tilde;20 ticks. </pre>
  26192. * @param (java.lang.Object[]) tickArguments Argument list to control tick generation. See the {@code ticks} method of the respective scale assigned to this Axis (note the default scale is a {@link (com.ibm.rave.core.scales.LinearScale) LinearScale} ).
  26193. * @return (com.ibm.rave.core.svg.Axis) This Axis.
  26194. */
  26195. ticks$0 : function(tickArguments) {
  26196. if (tickArguments !== null || arguments.length > 1){
  26197. tickArguments = Array.prototype.slice.call(arguments);
  26198. }
  26199. {
  26200. this._tickArguments = tickArguments;
  26201. return this;
  26202. }
  26203. },
  26204. /**
  26205. * Get the currently assigned tick arguments. Default is [10].
  26206. * @return (java.lang.Object[]) Array of tick argument values.
  26207. */
  26208. ticks$1 : function() {
  26209. return this._tickArguments;
  26210. },
  26211. /**
  26212. * Manually specify array of tick values which will override the default tick generation behaviour. A new tick will be generated for each value in the array.
  26213. * @param (Array) values Array of tick values.
  26214. * @return (com.ibm.rave.core.svg.Axis) This Axis.
  26215. */
  26216. tickValues$0 : function(values) {
  26217. this._tickValues = values;
  26218. return this;
  26219. },
  26220. /**
  26221. * Get the currently assigned tick values.
  26222. * @return (Array) Array of tick values, or null if none have been assigned (see {@link #this.tickValues(Array)} ).
  26223. */
  26224. tickValues$1 : function() {
  26225. return this._tickValues;
  26226. },
  26227. /**
  26228. * Specify tick label formatting.
  26229. * @param (Object) format
  26230. * @return (com.ibm.rave.core.svg.Axis) this Axis instance.
  26231. */
  26232. tickFormat$0 : function(format) {
  26233. this._tickFormat = format;
  26234. return this;
  26235. },
  26236. /**
  26237. * Specify tick label formatting.
  26238. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction "anonymous" function class, when executed, returns the formatted tick value.
  26239. * @return (com.ibm.rave.core.svg.Axis) this Axis instance.
  26240. */
  26241. tickFormat$1 : function(valueFunction) {
  26242. this._tickFormat = valueFunction;
  26243. return this;
  26244. },
  26245. /**
  26246. * Get the currently assigned tick format.
  26247. * @return (Object) The tick format object, or null if a format has not been specified.
  26248. */
  26249. tickFormat$2 : function() {
  26250. return this._tickFormat;
  26251. },
  26252. /**
  26253. * Specify the size (length) of the inner and outer axis tick marks.
  26254. * @param (Object) size The size of the inner and outer tick marks.
  26255. * @return (com.ibm.rave.core.svg.Axis) this Axis instance.
  26256. */
  26257. tickSize$0 : function(size) {
  26258. return this.tickSize$1(size, size);
  26259. },
  26260. /**
  26261. * Specify the size (length) of the axis tick marks.
  26262. * @param (Object) inner The size of ticks that will appear inside the bounds of the axis.
  26263. * @param (Object) outer The size of ticks that will appear at the ends of the axis.
  26264. * @return (com.ibm.rave.core.svg.Axis) this Axis instance.
  26265. */
  26266. tickSize$1 : function(inner, outer) {
  26267. this.innerTickSize(inner);
  26268. this.outerTickSize(outer);
  26269. return this;
  26270. },
  26271. /**
  26272. * This method is included for backward compatibility. This is identical to calling {@link #this.tickSize(Object, Object)} (excluding the "extra" parameter).
  26273. * @param (Object) inner Inner tick size.
  26274. * @param (Object) extra Deprecated extra parameter.
  26275. * @param (Object) outer Outer tick size.
  26276. * @return (com.ibm.rave.core.svg.Axis) This Axis instance.
  26277. */
  26278. tickSize$2 : function(inner, extra, outer) {
  26279. return this.tickSize$1(inner, outer);
  26280. },
  26281. /**
  26282. * Get the currently assigned <em>inner</em> tick size (in pixels). Default is 6.
  26283. * @return (double) Tick size in pixels.
  26284. */
  26285. tickSize$3 : function() {
  26286. return this._innerTickSize;
  26287. },
  26288. /**
  26289. * Specify the size (length) of the inner axis tick marks.
  26290. * @param (Object) size The size of ticks that will appear inside the bounds of the axis.
  26291. * @return (com.ibm.rave.core.svg.Axis) this Axis instance.
  26292. */
  26293. innerTickSize$0 : function(size) {
  26294. this._innerTickSize = + (size);
  26295. return this;
  26296. },
  26297. /**
  26298. * Get the currently assigned inner tick size (in pixels). Default is 6.
  26299. * @return (double) Tick size in pixels.
  26300. */
  26301. innerTickSize$1 : function() {
  26302. return this._innerTickSize;
  26303. },
  26304. /**
  26305. * Specify the size (length) of the outer axis tick marks.
  26306. * @param (Object) size The size of ticks that will appear at the outer bounds of the axis.
  26307. * @return (com.ibm.rave.core.svg.Axis) this Axis instance.
  26308. */
  26309. outerTickSize$0 : function(size) {
  26310. this._outerTickSize = + (size);
  26311. return this;
  26312. },
  26313. /**
  26314. * Get the currently assigned outer tick size (in pixels). Default is 6.
  26315. * @return (double) Tick size in pixels.
  26316. */
  26317. outerTickSize$1 : function() {
  26318. return this._outerTickSize;
  26319. },
  26320. /**
  26321. * Specify the padding distance between tick marks and their labels.
  26322. * @param (Object) padding Padding value in pixels.
  26323. * @return (com.ibm.rave.core.svg.Axis) this Axis instance.
  26324. */
  26325. tickPadding$0 : function(padding) {
  26326. this._tickPadding = + (padding);
  26327. return this;
  26328. },
  26329. /**
  26330. * Get the currently assigned padding (in pixels). Default is 3.
  26331. * @return (double) Padding distance in pixels.
  26332. */
  26333. tickPadding$1 : function() {
  26334. return this._tickPadding;
  26335. },
  26336. /**
  26337. * This is present in the d3 API, but is listed as deprecated and has no functionality.
  26338. */
  26339. tickSubdivide$0 : function() {
  26340. return 0;
  26341. },
  26342. /**
  26343. * This is present in the d3 API, but is listed as deprecated and has no functionality.
  26344. */
  26345. tickSubdivide$1 : function(arg) {
  26346. return this;
  26347. },
  26348. /**
  26349. * Specify the callback that will be invoked on axis creation.
  26350. * @param (com.ibm.rave.core.selector.RunFunction) callback The function to callback.
  26351. * @return (com.ibm.rave.core.svg.Axis) this Axis instance.
  26352. */
  26353. ticksHandler$0 : function(callback) {
  26354. this._tickHandler = callback;
  26355. return this;
  26356. },
  26357. /**
  26358. * Get the currently assigned tick handler callback.
  26359. * @return (com.ibm.rave.core.selector.RunFunction) the label overlap callback.
  26360. */
  26361. ticksHandler$1 : function() {
  26362. return this._tickHandler;
  26363. },
  26364. /** @expose */
  26365. scale : function(a0) {
  26366. var args = arguments;
  26367. if (args.length == 0) {
  26368. return this.scale$1();
  26369. }
  26370. return this.scale$0(a0);
  26371. },
  26372. /** @expose */
  26373. orient : function(a0) {
  26374. var args = arguments;
  26375. if (args.length == 0) {
  26376. return this.orient$1();
  26377. }
  26378. return this.orient$0(a0);
  26379. },
  26380. /** @expose */
  26381. ticks : function(a0) {
  26382. var args = arguments;
  26383. if (args.length == 0) {
  26384. return this.ticks$1();
  26385. }
  26386. return this.ticks$0.apply(this, args);
  26387. },
  26388. /** @expose */
  26389. tickValues : function(a0) {
  26390. var args = arguments;
  26391. if (args.length == 0) {
  26392. return this.tickValues$1();
  26393. }
  26394. return this.tickValues$0(a0);
  26395. },
  26396. /** @expose */
  26397. tickFormat : function(a0) {
  26398. var args = arguments;
  26399. if (args.length == 0) {
  26400. return this.tickFormat$2();
  26401. }
  26402. if (args.length == 1 && typeof a0 === "function") {
  26403. return this.tickFormat$1(a0);
  26404. }
  26405. return this.tickFormat$0(a0);
  26406. },
  26407. /** @expose */
  26408. tickSize : function(a0, a1, a2) {
  26409. var args = arguments;
  26410. if (args.length == 0) {
  26411. return this.tickSize$3();
  26412. }
  26413. if (args.length == 1) {
  26414. return this.tickSize$0(a0);
  26415. }
  26416. if (args.length == 2) {
  26417. return this.tickSize$1(a0, a1);
  26418. }
  26419. return this.tickSize$2(a0, a1, a2);
  26420. },
  26421. /** @expose */
  26422. innerTickSize : function(a0) {
  26423. var args = arguments;
  26424. if (args.length == 0) {
  26425. return this.innerTickSize$1();
  26426. }
  26427. return this.innerTickSize$0(a0);
  26428. },
  26429. /** @expose */
  26430. outerTickSize : function(a0) {
  26431. var args = arguments;
  26432. if (args.length == 0) {
  26433. return this.outerTickSize$1();
  26434. }
  26435. return this.outerTickSize$0(a0);
  26436. },
  26437. /** @expose */
  26438. tickPadding : function(a0) {
  26439. var args = arguments;
  26440. if (args.length == 0) {
  26441. return this.tickPadding$1();
  26442. }
  26443. return this.tickPadding$0(a0);
  26444. },
  26445. /** @expose */
  26446. tickSubdivide : function(a0) {
  26447. var args = arguments;
  26448. if (args.length == 0) {
  26449. return this.tickSubdivide$0();
  26450. }
  26451. return this.tickSubdivide$1(a0);
  26452. },
  26453. /** @expose */
  26454. ticksHandler : function(a0) {
  26455. var args = arguments;
  26456. if (args.length == 0) {
  26457. return this.ticksHandler$1();
  26458. }
  26459. return this.ticksHandler$0(a0);
  26460. }
  26461. });
  26462. com_ibm_rave_core_svg_Axis.DeltaScale = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scales_AbstractScale, {
  26463. //wrappedScale : null,
  26464. delta : 0,
  26465. _$functionClassMethod : function() {
  26466. var _$self = function(data, index, groupIndex) {
  26467. return (_$self.wrappedScale.call(this, data, index, groupIndex)) + _$self.delta;
  26468. };
  26469. return _$self;
  26470. },
  26471. /** @expose */
  26472. constructor : function(referencedScale, delta) {
  26473. this.wrappedScale = referencedScale;
  26474. this.delta = delta;
  26475. },
  26476. domain$0 : function(values) {
  26477. return null;
  26478. },
  26479. domain$1 : function() {
  26480. return null;
  26481. },
  26482. range$0 : function(values) {
  26483. return null;
  26484. },
  26485. range$1 : function() {
  26486. return null;
  26487. },
  26488. /** @expose */
  26489. copy : function() {
  26490. return null;
  26491. },
  26492. /** @expose */
  26493. domain : function(a0) {
  26494. var args = arguments;
  26495. if (args.length == 0) {
  26496. return this.domain$1();
  26497. }
  26498. return this.domain$0(a0);
  26499. },
  26500. /** @expose */
  26501. range : function(a0) {
  26502. var args = arguments;
  26503. if (args.length == 0) {
  26504. return this.range$1();
  26505. }
  26506. return this.range$0(a0);
  26507. }
  26508. });
  26509. //com_ibm_rave_core_svg_Axis.BOTTOM_ORIENT = "bottom";
  26510. //com_ibm_rave_core_svg_Axis.TOP_ORIENT = "top";
  26511. //com_ibm_rave_core_svg_Axis.LEFT_ORIENT = "left";
  26512. //com_ibm_rave_core_svg_Axis.RIGHT_ORIENT = "right";
  26513. //com_ibm_rave_core_svg_Axis.PROPERTY_CHART = "__chart__";
  26514. //com_ibm_rave_core_svg_Axis.CLASS_DOMAIN = "domain";
  26515. //com_ibm_rave_core_svg_Axis.ATTR_TRANSFORM = "transform";
  26516. //com_ibm_rave_core_svg_Axis.ATTR_X = "x";
  26517. //com_ibm_rave_core_svg_Axis.ATTR_Y = "y";
  26518. //com_ibm_rave_core_svg_Axis.ATTR_X2 = "x2";
  26519. //com_ibm_rave_core_svg_Axis.ATTR_Y2 = "y2";
  26520. //com_ibm_rave_core_svg_Axis.ATTR_DY = "dy";
  26521. //com_ibm_rave_core_svg_Axis.ATTR_SVG_PATH_DATA = "d";
  26522. //com_ibm_rave_core_svg_Axis.CLASS_PROPERTY = "class";
  26523. //com_ibm_rave_core_svg_Axis.CLASS_TICK = "tick";
  26524. //com_ibm_rave_core_svg_Axis.STYLE_OPACITY = "opacity";
  26525. //com_ibm_rave_core_svg_Axis.STYLE_TEXT_ANCHOR = "text-anchor";
  26526. //com_ibm_rave_core_svg_Axis.ANCHOR_MIDDLE = "middle";
  26527. //com_ibm_rave_core_svg_Axis.ANCHOR_START = "start";
  26528. //com_ibm_rave_core_svg_Axis.ANCHOR_END = "end";
  26529. //com_ibm_rave_core_svg_Axis.DY_HORIZONTAL_TOP = "0em";
  26530. //com_ibm_rave_core_svg_Axis.DY_HORIZONTAL_BOTTOM = ".71em";
  26531. //com_ibm_rave_core_svg_Axis.DY_VERTICAL = ".32em";
  26532. //com_ibm_rave_core_svg_Axis.SVG_MOVETO = "M";
  26533. //com_ibm_rave_core_svg_Axis.SVG_VERTICAL_LINETO = "V";
  26534. //com_ibm_rave_core_svg_Axis.SVG_HORIZONTAL_LINETO = "H";
  26535. //com_ibm_rave_core_svg_Axis.SVG_PATH_SEPARATOR = ",";
  26536. //com_ibm_rave_core_svg_Axis.SVG_ZERO_COORD = "0";
  26537. //com_ibm_rave_core_svg_Axis.DEFAULT_ORIENT = "bottom";
  26538. //com_ibm_rave_core_svg_Axis.CLASS_DOMAIN_SELECTOR = "." + "domain";
  26539. //com_ibm_rave_core_svg_Axis.CLASS_TICK_SELECTOR = "." + "tick";
  26540. com_ibm_rave_core_svg_Axis._identity = com_ibm_rave_core_internal_util_Identity.create();
  26541. com_ibm_rave_core_svg_Axis.HORIZONTAL_TRANSFORM = function(ticks, scale, scale2) {
  26542. ticks.attr("transform", function(data, index, groupIndex) {
  26543. var value = (scale.call(this, data, index, groupIndex));
  26544. if (!(isFinite(value))) {
  26545. value = (scale2.call(this, data, index, groupIndex));
  26546. }
  26547. return "translate(" + value + ",0)";
  26548. });
  26549. };
  26550. com_ibm_rave_core_svg_Axis.VERTICAL_TRANSFORM = function(ticks, scale, scale2) {
  26551. ticks.attr("transform", function(data, index, groupIndex) {
  26552. var value = (scale.call(this, data, index, groupIndex));
  26553. if (!(isFinite(value))) {
  26554. value = (scale2.call(this, data, index, groupIndex));
  26555. }
  26556. return "translate(0," + value + ")";
  26557. });
  26558. };
  26559. // $source: com/ibm/rave/core/svg/Brush
  26560. /************************************************************************
  26561. ** IBM Confidential
  26562. **
  26563. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  26564. **
  26565. ** (C) Copyright IBM Corp. 2015
  26566. **
  26567. ** The source code for this program is not published or otherwise divested of its trade secrets,
  26568. ** irrespective of what has been deposited with the U.S. Copyright Office.
  26569. ************************************************************************/
  26570. // GENERATED
  26571. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, bind
  26572. //@import com/ibm/rave/core/internal/event/CustomDispatcher (runtime) // create
  26573. //@import com/ibm/rave/core/selector/Selector (runtime) // new
  26574. //@import com/ibm/rave/core/internal/nativeImpl/event/DragSuppress (runtime) // dragSuppress
  26575. //@import com/ibm/rave/core/nativeImpl/event/Mouse (runtime) // mousePoint
  26576. //@import com/ibm/rave/core/internal/nativeImpl/PlatformInitialization (runtime) // getWindow, getDocumentBodyElement
  26577. //@import com/ibm/rave/core/scales/AbstractScale (runtime) // scaleRange
  26578. //@import com/ibm/rave/core/transition/Transition (runtime) // newTransition
  26579. //@import com/ibm/rave/core/internal/nativeImpl/transitions/InheritedTransition (runtime) // get
  26580. //@import com/ibm/rave/core/interpolate/ArrayInterpolation (runtime) // ArrayInterpolation
  26581. //@import com/ibm/rave/core/event/BaseEvent (loadtime) // superclass
  26582. /**
  26583. * A brush is an SVG control whereby the user can click and drag to select one- or two-dimensional regions of a given chart. As the brush control is manipulated by the user,(dragged, resized etc), it fires events so that listeners can react and redraw their chart accordingly.
  26584. */
  26585. var com_ibm_rave_core_svg_Brush = com_ibm_rave_core_nativeImpl_Declare({
  26586. //brushResizes : null,
  26587. //brushCursor : null,
  26588. //eventDispatcher : null,
  26589. //origin : null,
  26590. //center : null,
  26591. //offset : null,
  26592. //xExtent : null,
  26593. //yExtent : null,
  26594. //xExtentDomain : null,
  26595. //yExtentDomain : null,
  26596. //resizes : null,
  26597. //xScale : null,
  26598. //yScale : null,
  26599. //brushstartMouseDown : null,
  26600. //brushstartTouchStart : null,
  26601. dragging : 0,
  26602. xClamp : false,
  26603. yClamp : false,
  26604. _$functionClassMethod : function() {
  26605. var _$self = /**
  26606. * Draws or redraws this brush into the specified selection of elements. The brush may be drawn into multiple elements simultaneously, but note that these brushes would share the same backing extent; typically, a brush is drawn into only one element at a time. The selection can also be a transition, in which case the brush will perform an automatic transition. Use brush.event to dispatch brush events during the transition for animated brushing.
  26607. */
  26608. function(args) {
  26609. if (args !== null || arguments.length > 1){
  26610. args = Array.prototype.slice.call(arguments, 0);
  26611. }
  26612. {
  26613. _$self.brush(args[0]);
  26614. return null;
  26615. }
  26616. };
  26617. return _$self;
  26618. },
  26619. constructor : function() {
  26620. this.eventDispatcher = com_ibm_rave_core_internal_event_CustomDispatcher.create$0(this, "brushstart", "brush", "brushend");
  26621. /**
  26622. */
  26623. {
  26624. this.brushResizes = [["n", "e", "s", "w", "nw", "ne", "se", "sw"], ["e", "w"], ["n", "s"], []];
  26625. this.brushCursor = {};
  26626. this.brushCursor["n"] = "ns-resize";
  26627. this.brushCursor["e"] = "ew-resize";
  26628. this.brushCursor["s"] = "ns-resize";
  26629. this.brushCursor["w"] = "ew-resize";
  26630. this.brushCursor["nw"] = "nwse-resize";
  26631. this.brushCursor["ne"] = "nesw-resize";
  26632. this.brushCursor["se"] = "nwse-resize";
  26633. this.brushCursor["sw"] = "nesw-resize";
  26634. this.xScale = null;
  26635. this.yScale = null;
  26636. this.xExtent = [0.0, 0.0];
  26637. this.yExtent = [0.0, 0.0];
  26638. this.xClamp = true;
  26639. this.yClamp = true;
  26640. this.resizes = this.brushResizes[0];
  26641. this.origin = [];
  26642. var self = this;
  26643. this.brushstartMouseDown = function(data, index, groupIndex, event) {
  26644. self.handleBrushStartEvent(this, data, index, groupIndex, event, false);
  26645. };
  26646. this.brushstartTouchStart = function(data, index, groupIndex, event) {
  26647. self.handleBrushStartEvent(this, data, index, groupIndex, event, true);
  26648. };
  26649. }
  26650. },
  26651. handleBrushStartEvent : function(context, data, index, groupIndex, event, touchEvent) {
  26652. var self = this;
  26653. var target = context;
  26654. var eventTarget = new com_ibm_rave_core_selector_Selector().init(rave.event.target);
  26655. var event_ = this.eventDispatcher.of(target, data, index, groupIndex);
  26656. var g = new com_ibm_rave_core_selector_Selector().init(target);
  26657. var resizing = "";
  26658. var eventTargetDatum = eventTarget.datum();
  26659. if ((eventTargetDatum)) {
  26660. resizing = eventTargetDatum.toString();
  26661. }
  26662. var resizingX = (!(new RegExp("^(n|s)$", "g").test(resizing)) && this.xScale);
  26663. var resizingY = (!(new RegExp("^(e|w)$", "g").test(resizing)) && this.yScale);
  26664. this.dragging = +(eventTarget.classed("extent"));
  26665. var dragRestore = com_ibm_rave_core_internal_nativeImpl_event_DragSuppress.dragSuppress(target);
  26666. var originPoint = com_ibm_rave_core_nativeImpl_event_Mouse.mousePoint(target);
  26667. this.origin[0] = originPoint[0];
  26668. this.origin[1] = originPoint[1];
  26669. this.offset = null;
  26670. this.center = null;
  26671. var keydown = function(data, index, groupIndex, event) {
  26672. if ((rave.event).keyCode == 32) {
  26673. if (!((self.dragging))) {
  26674. self.center = null;
  26675. self.origin[0] -= self.xExtent[1];
  26676. self.origin[1] -= self.yExtent[1];
  26677. self.dragging = 2;
  26678. }
  26679. rave.event.preventDefault();
  26680. }
  26681. };
  26682. var keyup = function(data, index, groupIndex, event) {
  26683. if ((rave.event).keyCode == 32 && self.dragging == 2) {
  26684. self.origin[0] += self.xExtent[1];
  26685. self.origin[1] += self.yExtent[1];
  26686. self.dragging = 0;
  26687. rave.event.preventDefault();
  26688. }
  26689. };
  26690. var w = new com_ibm_rave_core_selector_Selector().init(com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getWindow(target)).on("keydown.brush", keydown).on("keyup.brush", keyup);
  26691. var brushmove = function(data, index, groupIndex, event) {
  26692. var p = com_ibm_rave_core_nativeImpl_event_Mouse.mousePoint(target);
  26693. var point = [p[0], p[1]];
  26694. var moved = false;
  26695. if (self.offset) {
  26696. point[0] += self.offset[0];
  26697. point[1] += self.offset[1];
  26698. }
  26699. if (!((self.dragging))) {
  26700. if ((rave.event).altKey) {
  26701. if (!self.center) {
  26702. self.center = [(self.xExtent[0] + self.xExtent[1]) / 2, (self.yExtent[0] + self.yExtent[1]) / 2];
  26703. }
  26704. self.origin[0] = self.xExtent[+(point[0] < self.center[0])];
  26705. self.origin[1] = self.yExtent[+(point[1] < self.center[1])];
  26706. } else {
  26707. self.center = null;
  26708. }
  26709. }
  26710. if (resizingX && self.move1(point, self.xScale, 0)) {
  26711. self.redrawX(g);
  26712. moved = true;
  26713. }
  26714. if (resizingY && self.move1(point, self.yScale, 1)) {
  26715. self.redrawY(g);
  26716. moved = true;
  26717. }
  26718. if (moved) {
  26719. self.redraw(g);
  26720. event_(new com_ibm_rave_core_svg_Brush.EventObject("brush", !((self.dragging)) ? "move" : "resize"));
  26721. }
  26722. };
  26723. var brushend = function(data, index, groupIndex, event) {
  26724. brushmove.call(this, data, index, groupIndex, event);
  26725. g.style("pointer-events", "all").selectAll(".resize").style("display", self.empty() ? "none" : null);
  26726. new com_ibm_rave_core_selector_Selector().init(com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocumentBodyElement()).style("cursor", null);
  26727. w.on("mousemove.brush", null).on("mouseup.brush", null).on("touchmove.brush", null).on("touchend.brush", null).on("keydown.brush", null).on("keyup.brush", null);
  26728. dragRestore(false);
  26729. event_(new com_ibm_rave_core_svg_Brush.EventObject("brushend", null));
  26730. };
  26731. if (touchEvent && (rave.event).changedTouches) {
  26732. w.on("touchmove.brush", brushmove).on("touchend.brush", brushend);
  26733. } else {
  26734. w.on("mousemove.brush", brushmove).on("mouseup.brush", brushend);
  26735. }
  26736. g.interrupt().selectAll("*").interrupt();
  26737. if ((this.dragging)) {
  26738. this.origin[0] = this.xExtent[0] - this.origin[0];
  26739. this.origin[1] = this.yExtent[0] - this.origin[1];
  26740. } else if ((resizing)) {
  26741. var ex = +(new RegExp("w$", "g").test(resizing));
  26742. var ey = +(new RegExp("^n", "g").test(resizing));
  26743. this.offset = [this.xExtent[1 - ex] - this.origin[0], this.yExtent[1 - ey] - this.origin[1]];
  26744. this.origin[0] = this.xExtent[ex];
  26745. this.origin[1] = this.yExtent[ey];
  26746. }
  26747. if ((rave.event).altKey) {
  26748. this.center = [this.origin[0], this.origin[1]];
  26749. }
  26750. g.style("pointer-events", "none").selectAll(".resize").style("display", null);
  26751. new com_ibm_rave_core_selector_Selector().init(com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocumentBodyElement()).style("cursor", eventTarget.style("cursor"));
  26752. event_(new com_ibm_rave_core_svg_Brush.EventObject("brushstart", null));
  26753. brushmove.call(context, data, index, groupIndex, event);
  26754. },
  26755. move1 : function(point, scale, i) {
  26756. var range = com_ibm_rave_core_scales_AbstractScale.scaleRange(scale);
  26757. var r0 = range[0];
  26758. var r1 = range[1];
  26759. var position = this.origin[i];
  26760. var extent = (i) ? this.yExtent : this.xExtent;
  26761. var size = extent[1] - extent[0];
  26762. var min, max;
  26763. if ((this.dragging)) {
  26764. r0 -= position;
  26765. r1 -= size + position;
  26766. }
  26767. min = ((i) ? this.yClamp : this.xClamp) ? Math.max(r0, Math.min(r1, point[i])) : point[i];
  26768. if ((this.dragging)) {
  26769. max = (min += position) + size;
  26770. } else {
  26771. if (this.center) {
  26772. position = Math.max(r0, Math.min(r1, 2 * this.center[i] - min));
  26773. }
  26774. if (position < min) {
  26775. max = min;
  26776. min = position;
  26777. } else {
  26778. max = position;
  26779. }
  26780. }
  26781. if (extent[0] != min || extent[1] != max) {
  26782. if ((i)) {
  26783. this.yExtentDomain = null;
  26784. } else {
  26785. this.xExtentDomain = null;
  26786. }
  26787. extent[0] = min;
  26788. extent[1] = max;
  26789. return true;
  26790. }
  26791. return false;
  26792. },
  26793. /**
  26794. * Draws or redraws this brush into the specified selection of elements. The brush may be drawn into multiple elements simultaneously, but note that these brushes would share the same backing extent; typically, a brush is drawn into only one element at a time. The selection can also be a transition, in which case the brush will perform an automatic transition. Use brush.event to dispatch brush events during the transition for animated brushing.
  26795. */
  26796. /** @expose */
  26797. brush : function(context) {
  26798. var self = this;
  26799. context.each(function(data, index, groupIndex) {
  26800. var g = new com_ibm_rave_core_selector_Selector().init(this).style("pointer-events", "all").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)").on("mousedown.brush", self.brushstartMouseDown).on("touchstart.brush", self.brushstartTouchStart);
  26801. var background = g.selectAll(".background").data([0.0]);
  26802. background.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair");
  26803. g.selectAll(".extent").data([0.0]).enter().append("rect").attr("class", "extent").style("cursor", "move");
  26804. var resize = g.selectAll(".resize").data(self.resizes, function(data, index, groupIndex) {
  26805. return data;
  26806. });
  26807. resize.exit().remove();
  26808. resize.enter().append("g").attr("class", function(data, index, groupIndex) {
  26809. return "resize " + data;
  26810. }).style("cursor", function(data, index, groupIndex) {
  26811. return self.brushCursor[data];
  26812. }).append("rect").attr("x", function(data, index, groupIndex) {
  26813. return new RegExp("[ew]$", "g").test(data.toString()) ? -3 : null;
  26814. }).attr("y", function(data, index, groupIndex) {
  26815. return new RegExp("^[ns]", "g").test(data.toString()) ? -3 : null;
  26816. }).attr("width", 6).attr("height", 6).style("visibility", "hidden");
  26817. resize.style("display", self.empty() ? "none" : null);
  26818. var gUpdate = com_ibm_rave_core_transition_Transition.newTransition(g);
  26819. var backgroundUpdate = com_ibm_rave_core_transition_Transition.newTransition(background);
  26820. var range;
  26821. if (self.xScale) {
  26822. range = com_ibm_rave_core_scales_AbstractScale.scaleRange(self.xScale);
  26823. backgroundUpdate.attr("x", range[0]).attr("width", (range[1] - (range[0])));
  26824. self.redrawX(gUpdate);
  26825. }
  26826. if (self.yScale) {
  26827. range = com_ibm_rave_core_scales_AbstractScale.scaleRange(self.yScale);
  26828. backgroundUpdate.attr("y", range[0]).attr("height", (range[1]) - (range[0]));
  26829. self.redrawY(gUpdate);
  26830. }
  26831. self.redraw(gUpdate);
  26832. });
  26833. },
  26834. /**
  26835. * Returns true if and only if the brush extent is empty. When a brush is created, it is initially empty; the brush may also become empty with a single click on the background without moving, or if the extent is cleared. A brush is considered empty if it has zero-width or zero-height. When the brush is empty, its extent is not strictly defined.
  26836. * @return (boolean) true if the brush is empty, false otherwise
  26837. */
  26838. /** @expose */
  26839. empty : function() {
  26840. var xDim = false;
  26841. var yDim = false;
  26842. if (this.xScale) {
  26843. xDim = this.xExtent[0] == this.xExtent[1];
  26844. }
  26845. if (this.yScale) {
  26846. yDim = this.yExtent[0] == this.yExtent[1];
  26847. }
  26848. return xDim || yDim;
  26849. },
  26850. /**
  26851. * Clears the extent, making the brush extent empty.
  26852. * @return (com.ibm.rave.core.svg.Brush) this brush instance itself
  26853. */
  26854. /** @expose */
  26855. clear : function() {
  26856. if (!(this.empty())) {
  26857. this.xExtent = [0.0, 0.0];
  26858. this.yExtent = [0.0, 0.0];
  26859. this.xExtentDomain = this.yExtentDomain = null;
  26860. }
  26861. return this;
  26862. },
  26863. /**
  26864. * Gets the listener for the specified event type supported by brush: brushstart, brush,brushend
  26865. * @param (String) type the type of event to get the listener for
  26866. * @return (com.ibm.rave.core.selector.RunFunction) the listener for the specified event or null if none was registered
  26867. */
  26868. on$0 : function(type) {
  26869. return this.eventDispatcher.on$0(type);
  26870. },
  26871. /**
  26872. * Sets a listener for the specified event type supported by brush: brushstart, brush,brushend
  26873. * @param (String) type the type of the brush event to listener for
  26874. * @param (com.ibm.rave.core.selector.RunFunction) listener the listener
  26875. * @return (com.ibm.rave.core.svg.Brush) this brush instance itself
  26876. */
  26877. on$1 : function(type, listener) {
  26878. this.eventDispatcher.on$1(type, listener);
  26879. return this;
  26880. },
  26881. /**
  26882. * Triggers brush events based on the type of the selection passed: if the selection passed is a selector, it dispatches a brush gesture to registered listeners as a three event sequence: brushstart, brush and brushend. This can be useful in triggering listeners after setting the brush extent programatically. If selection passed is a transition, registers the appropriate tweens so that the brush dispatches events over the course of the transition: a brushstart event when the transition starts from the previously-set extent, brush events for each tick of the transition, and finally a brushend event when the transition ends. Note that the transition will be interrupted if the user starts brushing before the transition ends.
  26883. * @param (com.ibm.rave.core.selector.Selection) g the selection to trigger events for
  26884. */
  26885. /** @expose */
  26886. event : com_ibm_rave_core_nativeImpl_Declare.bind(function(g) {
  26887. var self = this;
  26888. g.each(function(data, index, groupIndex) {
  26889. var event_ = self.eventDispatcher.of(this, data, index, groupIndex);
  26890. var brushExtent = this.rave_getProperty("__chart__");
  26891. var extent1 = new com_ibm_rave_core_svg_Brush.BrushExtent(self.xExtent, self.yExtent, self.xExtentDomain, self.yExtentDomain);
  26892. var extent0 = (!brushExtent) ? extent1 : brushExtent;
  26893. this.rave_setProperty("__chart__", extent1);
  26894. if (com_ibm_rave_core_internal_nativeImpl_transitions_InheritedTransition.get()) {
  26895. new com_ibm_rave_core_selector_Selector().init(this).transition().each("start.brush", function(args) {
  26896. if (args !== null || arguments.length > 1){
  26897. args = Array.prototype.slice.call(arguments, 0);
  26898. }
  26899. {
  26900. self.xExtentDomain = extent0.i;
  26901. self.yExtentDomain = extent0.j;
  26902. self.xExtent = extent0.x;
  26903. self.yExtent = extent0.y;
  26904. event_(new com_ibm_rave_core_svg_Brush.EventObject("brushstart", null));
  26905. return null;
  26906. }
  26907. }).tween("brush:brush", function(data, index, groupIndex) {
  26908. var xi = com_ibm_rave_core_interpolate_ArrayInterpolation.INSTANCE(self.xExtent, extent1.x);
  26909. var yi = com_ibm_rave_core_interpolate_ArrayInterpolation.INSTANCE(self.yExtent, extent1.y);
  26910. self.xExtentDomain = self.yExtentDomain = null;
  26911. return function(t) {
  26912. self.xExtent = extent1.x = (xi(t));
  26913. self.yExtent = extent1.y = (yi(t));
  26914. event_(new com_ibm_rave_core_svg_Brush.EventObject("brush", "resize"));
  26915. };
  26916. }).each("end.brush", function(args) {
  26917. if (args !== null || arguments.length > 1){
  26918. args = Array.prototype.slice.call(arguments, 0);
  26919. }
  26920. {
  26921. self.xExtentDomain = extent1.i;
  26922. self.yExtentDomain = extent1.j;
  26923. event_(new com_ibm_rave_core_svg_Brush.EventObject("brush", "resize"));
  26924. event_(new com_ibm_rave_core_svg_Brush.EventObject("brushend", null));
  26925. return null;
  26926. }
  26927. });
  26928. } else {
  26929. event_(new com_ibm_rave_core_svg_Brush.EventObject("brushstart", null));
  26930. event_(new com_ibm_rave_core_svg_Brush.EventObject("brush", "resize"));
  26931. event_(new com_ibm_rave_core_svg_Brush.EventObject("brushend", null));
  26932. }
  26933. });
  26934. }),
  26935. redraw : function(g) {
  26936. var self = this;
  26937. g.selectAll(".resize").attr("transform", function(data, index, groupIndex) {
  26938. return "translate(" + self.xExtent[+(new RegExp("e$", "g").test(data.toString()))] + "," + self.yExtent[+(new RegExp("^s", "g").test(data.toString()))] + ")";
  26939. });
  26940. },
  26941. redrawX : function(g) {
  26942. g.select(".extent").attr("x", this.xExtent[0]);
  26943. g.selectAll(".extent,.n>rect,.s>rect").attr("width", this.xExtent[1] - this.xExtent[0]);
  26944. },
  26945. redrawY : function(g) {
  26946. g.select(".extent").attr("y", this.yExtent[0]);
  26947. g.selectAll(".extent,.e>rect,.w>rect").attr("height", this.yExtent[1] - this.yExtent[0]);
  26948. },
  26949. /**
  26950. * Gets the current x-scale associated with the brush. Default is null
  26951. * @return (com.ibm.rave.core.scales.AbstractScale) the current x-scale associated with the brush.
  26952. */
  26953. x$0 : function() {
  26954. return this.xScale;
  26955. },
  26956. /**
  26957. * Sets the x-scale for the brush. The scale is typically defined as a quantitative scale, in which case the extent is in data space from the scale's domain; however, it may instead be defined as an ordinal scale, where the extent is in pixel space from the scale's range extent.
  26958. * @param (com.ibm.rave.core.scales.AbstractScale) z the scale to set
  26959. * @return (com.ibm.rave.core.svg.Brush) this brush instance itself
  26960. */
  26961. x$1 : function(z) {
  26962. this.xScale = z;
  26963. this.resizes = this.brushResizes[+(!((this.xScale))) << 1 | +(!((this.yScale)))];
  26964. return this;
  26965. },
  26966. /**
  26967. * Gets the current y-scale associated with the brush. Default is null
  26968. * @return (com.ibm.rave.core.scales.AbstractScale) the current y-scale associated with the brush.
  26969. */
  26970. y$0 : function() {
  26971. return this.yScale;
  26972. },
  26973. /**
  26974. * Sets the y-scale for the brush. The scale is typically defined as a quantitative scale, in which case the extent is in data space from the scale's domain; however, it may instead be defined as an ordinal scale, where the extent is in pixel space from the scale's range extent.
  26975. * @param (com.ibm.rave.core.scales.AbstractScale) z the scale to set
  26976. * @return (com.ibm.rave.core.svg.Brush) this brush instance itself
  26977. */
  26978. y$1 : function(z) {
  26979. this.yScale = z;
  26980. this.resizes = this.brushResizes[+(!((this.xScale))) << 1 | +(!((this.yScale)))];
  26981. return this;
  26982. },
  26983. /**
  26984. * Gets the current clamping behavior of the brush. The clamping behavior definition depends on the associated scales. If both an x- and y-scale are available, then the clamping behavior is a list [ x, y ], where x and y are booleans that determine whether the each dimension of the two-dimensional extent should be clamped to its respective x- and y-scale. If only one of the x-scale and y-scale are available, then the clamping behavior is a Boolean referring to whether the one-dimensional extent should be clamped to that scale. If neither scale is available, then the clamping behavior is null.
  26985. * @return (Object) the current clamping behavior
  26986. */
  26987. clamp$0 : function() {
  26988. return (this.xScale) && (this.yScale) ? [this.xClamp, this.yClamp] : (this.xScale) ? this.xClamp : (this.yScale) ? this.yClamp : null;
  26989. },
  26990. /**
  26991. * Sets the current clamping behavior of the brush. The clamping behavior definition depends on the associated scales. If both an x- and y-scale are available, then passed the clamping value is expected to be a list [ x, y ], where x and y are booleans that determine whether the each dimension of the two-dimensional extent should be clamped to its respective x- and y-scale. If only one of the x-scale and y-scale are available, then the passed clamping value is a Boolean referring to whether the one-dimensional extent should be clamped to that scale.
  26992. * @return (com.ibm.rave.core.svg.Brush) this brush instance itself
  26993. */
  26994. clamp$1 : function(z) {
  26995. if ((this.xScale) && (this.yScale)) {
  26996. this.xClamp = (z)[0];
  26997. this.yClamp = (z)[1];
  26998. } else if ((this.xScale)) {
  26999. this.xClamp = (z);
  27000. } else if ((this.yScale)) {
  27001. this.yClamp = (z);
  27002. }
  27003. return this;
  27004. },
  27005. /**
  27006. * Gets the current brush extent. The definition of the extent depends on the associated scales. If both an x- and y-scale are available, then the extent is a list of two lists [‍​[x0, y0], [x1, y1]​], where x0 and y0 are the lower bounds of the extent, and x1 and y1 are the upper bounds of the extent. If only the x-scale is available, then the extent is defined as the list [x0, x1]; likewise, if only the y-scale is available, then the extent is [y0, y1]. If neither scale is available, then the extent is null.
  27007. * @return (Array) the current extent
  27008. */
  27009. extent$0 : function() {
  27010. var x0, x1, y0, y1, t;
  27011. x0 = x1 = y0 = y1 = t = 0;
  27012. if ((this.xScale)) {
  27013. if ((this.xExtentDomain)) {
  27014. x0 = this.xExtentDomain[0];
  27015. x1 = this.xExtentDomain[1];
  27016. } else {
  27017. x0 = this.xExtent[0];
  27018. x1 = this.xExtent[1];
  27019. if (this.xScale.invert) {
  27020. x0 = this.xScale.invert(x0);
  27021. x1 = this.xScale.invert(x1);
  27022. }
  27023. if (x1 < x0) {
  27024. t = x0;
  27025. x0 = x1;
  27026. x1 = t;
  27027. }
  27028. }
  27029. }
  27030. if ((this.yScale)) {
  27031. if ((this.yExtentDomain)) {
  27032. y0 = this.yExtentDomain[0];
  27033. y1 = this.yExtentDomain[1];
  27034. } else {
  27035. y0 = this.yExtent[0];
  27036. y1 = this.yExtent[1];
  27037. if (this.yScale.invert) {
  27038. y0 = this.yScale.invert(y0);
  27039. y1 = this.yScale.invert(y1);
  27040. }
  27041. if (y1 < y0) {
  27042. t = y0;
  27043. y0 = y1;
  27044. y1 = t;
  27045. }
  27046. }
  27047. }
  27048. return (this.xScale) && (this.yScale) ? [[x0, y0], [x1, y1]] : (this.xScale) ? [x0, x1] : (this.yScale) ? [y0, y1] : null;
  27049. },
  27050. /**
  27051. * Sets the current brush extent and returns the brush. The definition of the extent depends on the associated scales. If both an x- and y-scale are available, then the extent passed is expected to be a list of two lists [‍​[x0, y0], [x1, y1]​], where x0 and y0 are the lower bounds of the extent, and x1 and y1 are the upper bounds of the extent. If only the x-scale is available, then the extent passed is expected to be list [x0, x1]; likewise, if only the y-scale is available, then the extent is [y0, y1] When the extent is set to values, the resulting extent is preserved exactly. However, as soon as the brush is moved by the user (on mousemove following a mousedown), then the extent will be recomputed by calling scale.invert. Note that, in this case, the values may be slightly imprecise due to the limited precision of pixels. Note that setting the extent does not automatically redraw the brush or dispatch any events to listeners. To redraw the brush, call run on a selection or transition; to cause the brush to dispatch events to listeners, use brush.event.
  27052. * @param (Array) z the value of the extent to set
  27053. * @return (com.ibm.rave.core.svg.Brush) this brush instance itself
  27054. */
  27055. extent$1 : function(z) {
  27056. var x0, x1, y0, y1, t;
  27057. x0 = x1 = y0 = y1 = t = 0;
  27058. if ((this.xScale)) {
  27059. var xObj0 = z[0];
  27060. var xObj1 = z[1];
  27061. if ((this.yScale)) {
  27062. x0 = (xObj0)[0];
  27063. x1 = (xObj1)[0];
  27064. } else {
  27065. x0 = xObj0;
  27066. x1 = xObj1;
  27067. }
  27068. this.xExtentDomain = [x0, x1];
  27069. if (this.xScale.invert) {
  27070. x0 = this.xScale.call(this.xScale, x0, -1, -1);
  27071. x1 = this.xScale.call(this.xScale, x1, -1, -1);
  27072. }
  27073. if (x1 < x0) {
  27074. t = x0;
  27075. x0 = x1;
  27076. x1 = t;
  27077. }
  27078. if (x0 != this.xExtent[0] || x1 != this.xExtent[1]) {
  27079. this.xExtent = [x0, x1];
  27080. }
  27081. }
  27082. if ((this.yScale)) {
  27083. var yObj0 = z[0];
  27084. var yObj1 = z[1];
  27085. if ((this.xScale)) {
  27086. y0 = (yObj0)[1];
  27087. y1 = (yObj1)[1];
  27088. } else {
  27089. y0 = yObj0;
  27090. y1 = yObj1;
  27091. }
  27092. this.yExtentDomain = [y0, y1];
  27093. if (this.yScale.invert) {
  27094. y0 = this.yScale.call(this.yScale, y0, -1, -1);
  27095. y1 = this.yScale.call(this.yScale, y1, -1, -1);
  27096. }
  27097. if (y1 < y0) {
  27098. t = y0;
  27099. y0 = y1;
  27100. y1 = t;
  27101. }
  27102. if (y0 != this.yExtent[0] || y1 != this.yExtent[1]) {
  27103. this.yExtent = [y0, y1];
  27104. }
  27105. }
  27106. return this;
  27107. },
  27108. /** @expose */
  27109. on : function(a0, a1) {
  27110. var args = arguments;
  27111. if (args.length == 1) {
  27112. return this.on$0(a0);
  27113. }
  27114. return this.on$1(a0, a1);
  27115. },
  27116. /** @expose */
  27117. x : function(a0) {
  27118. var args = arguments;
  27119. if (args.length == 0) {
  27120. return this.x$0();
  27121. }
  27122. return this.x$1(a0);
  27123. },
  27124. /** @expose */
  27125. y : function(a0) {
  27126. var args = arguments;
  27127. if (args.length == 0) {
  27128. return this.y$0();
  27129. }
  27130. return this.y$1(a0);
  27131. },
  27132. /** @expose */
  27133. clamp : function(a0) {
  27134. var args = arguments;
  27135. if (args.length == 0) {
  27136. return this.clamp$0();
  27137. }
  27138. return this.clamp$1(a0);
  27139. },
  27140. /** @expose */
  27141. extent : function(a0) {
  27142. var args = arguments;
  27143. if (args.length == 0) {
  27144. return this.extent$0();
  27145. }
  27146. return this.extent$1(a0);
  27147. }
  27148. });
  27149. /**
  27150. * Creates a new brush with no default x- and y-scale, and an empty extent
  27151. * @return (com.ibm.rave.core.svg.Brush) the newly constructed brush
  27152. */
  27153. /** @expose */
  27154. com_ibm_rave_core_svg_Brush.newBrush = function() {
  27155. return new com_ibm_rave_core_svg_Brush();
  27156. };
  27157. /**
  27158. * The event object fired by the brush control. There are three types of events: brushstart - on mousedown brush - on mousemove, if the brush extent has changed brushend - on mouseup Furthermore, only event of type brush will have a mode, which could be one of two types: move, or resize, for other types, the mode would be null
  27159. */
  27160. com_ibm_rave_core_svg_Brush.EventObject = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_event_BaseEvent, {
  27161. //mode : null,
  27162. constructor : function(type, mode) {
  27163. this.mode = mode;
  27164. },
  27165. /**
  27166. * The mode value of the event in case the event was of type brush. brushstart and brushend have no mode and will return null
  27167. * @return (String) the value of mode of the event
  27168. */
  27169. /** @expose */
  27170. getMode : function() {
  27171. return this.mode;
  27172. }
  27173. });
  27174. com_ibm_rave_core_svg_Brush.BrushExtent = function(x, y, i, j) {
  27175. this.x = x;
  27176. this.y = y;
  27177. this.i = i;
  27178. this.j = j;
  27179. };
  27180. //com_ibm_rave_core_svg_Brush.CHART_PROP = "__chart__";
  27181. // $source: com/ibm/rave/core/internal/geo/MercatorPlaneProjectionFactory
  27182. /************************************************************************
  27183. ** IBM Confidential
  27184. **
  27185. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  27186. **
  27187. ** (C) Copyright IBM Corp. 2015
  27188. **
  27189. ** The source code for this program is not published or otherwise divested of its trade secrets,
  27190. ** irrespective of what has been deposited with the U.S. Copyright Office.
  27191. ************************************************************************/
  27192. // GENERATED
  27193. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare anonymous, declare
  27194. //@import com/ibm/rave/core/geo/InvertiblePointProjector (runtime)
  27195. //@import com/ibm/rave/core/internal/geo/MercatorProjection (runtime) // new
  27196. //@import com/ibm/rave/core/internal/geo/ProjectionMutatorImpl (runtime) // internalMutate
  27197. /**
  27198. */
  27199. var com_ibm_rave_core_internal_geo_MercatorPlaneProjectionFactory = com_ibm_rave_core_nativeImpl_Declare({
  27200. /**
  27201. * @expose
  27202. */
  27203. raw : null,
  27204. _$functionClassMethod : function() {
  27205. var _$self = function() {
  27206. var m = new com_ibm_rave_core_internal_geo_MercatorProjection();
  27207. com_ibm_rave_core_internal_geo_ProjectionMutatorImpl.internalMutate(m, _$self.raw);
  27208. m.init();
  27209. return m;
  27210. };
  27211. return _$self;
  27212. },
  27213. constructor : function() {
  27214. this.raw = new (com_ibm_rave_core_nativeImpl_Declare({
  27215. _$functionClassMethod : function() {
  27216. var _$self = function(λ, φ) {
  27217. return [λ, Math.log(Math.tan(3.141592653589793 / 4 + φ / 2))];
  27218. };
  27219. return _$self;
  27220. },
  27221. supportInversion : function() {
  27222. return true;
  27223. },
  27224. invert : function(x, y) {
  27225. return [x, 2 * Math.atan(Math.exp(y)) - 1.5707963267948966];
  27226. }
  27227. }))();
  27228. },
  27229. /** @expose */
  27230. getRaw : function() {
  27231. return this.raw;
  27232. }
  27233. /**
  27234. */
  27235. //constructor : function() {}
  27236. });
  27237. com_ibm_rave_core_internal_geo_MercatorPlaneProjectionFactory.INSTANCE = new com_ibm_rave_core_internal_geo_MercatorPlaneProjectionFactory();
  27238. // $source: com/ibm/rave/core/internal/geo/ResampleStreamListenerFactory
  27239. /************************************************************************
  27240. ** IBM Confidential
  27241. **
  27242. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  27243. **
  27244. ** (C) Copyright IBM Corp. 2015
  27245. **
  27246. ** The source code for this program is not published or otherwise divested of its trade secrets,
  27247. ** irrespective of what has been deposited with the U.S. Copyright Office.
  27248. ************************************************************************/
  27249. // GENERATED
  27250. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  27251. //@import com/ibm/rave/core/internal/geo/TransformStreamListenerImpl (runtime) // new
  27252. //@import com/ibm/rave/core/internal/geo/ResampleStreamListener (runtime) // new
  27253. /**
  27254. * A factory from creating resampling stream listeners.
  27255. */
  27256. var com_ibm_rave_core_internal_geo_ResampleStreamListenerFactory = com_ibm_rave_core_nativeImpl_Declare({
  27257. //pointProjector : null,
  27258. cosMinDistance : 0,
  27259. δ2 : 0,
  27260. maxDepth : 0,
  27261. _$functionClassMethod : function() {
  27262. var _$self = /**
  27263. * Wraps the specified stream listener with another that would apply resampling transform to any GeoJSON geometry before streaming it to the wrapped listener.
  27264. * @param (com.ibm.rave.core.geo.StreamListener) listener the listener to wrap
  27265. * @return (com.ibm.rave.core.geo.StreamListener) a wrapped stream listener that applies resampling transform to any input GeoJSON geometry
  27266. */
  27267. function(listener) {
  27268. var self = _$self;
  27269. if (_$self.maxDepth == 0) {
  27270. var delegates = {};
  27271. delegates["point"] = function(x, y, z) {
  27272. var res = self.pointProjector(x, y, z);
  27273. listener.point(res[0], res[1], NaN);
  27274. };
  27275. return new com_ibm_rave_core_internal_geo_TransformStreamListenerImpl(listener, delegates);
  27276. }
  27277. return new com_ibm_rave_core_internal_geo_ResampleStreamListener(_$self, listener);
  27278. };
  27279. return _$self;
  27280. },
  27281. constructor : function(projector) {
  27282. this.δ2 = 0.5;
  27283. this.pointProjector = projector;
  27284. this.maxDepth = 16;
  27285. this.cosMinDistance = Math.cos(30 * 0.017453292519943295);
  27286. },
  27287. /**
  27288. * Sets the value of the precision to use.
  27289. * @param (double) p the precision value to set
  27290. * @return (com.ibm.rave.core.internal.geo.ResampleStreamListenerFactory) this ResampleStreamListenerFactory object itself
  27291. */
  27292. precision$0 : function(p) {
  27293. this.δ2 = p * p;
  27294. if (this.δ2 > 0) {
  27295. this.maxDepth = 16;
  27296. } else {
  27297. this.maxDepth = 0;
  27298. }
  27299. return this;
  27300. },
  27301. /**
  27302. * Returns the current precision value. The default is the square root of 0.5, which is almost 0.7
  27303. * @return (double) the current precision value
  27304. */
  27305. precision$1 : function() {
  27306. return Math.sqrt(this.δ2);
  27307. },
  27308. getCosMinDistance : function() {
  27309. return this.cosMinDistance;
  27310. },
  27311. getPrecisionSquared : function() {
  27312. return this.δ2;
  27313. },
  27314. getMaxDepth : function() {
  27315. return this.maxDepth;
  27316. },
  27317. getPointProjector : function() {
  27318. return this.pointProjector;
  27319. },
  27320. precision : function(a0) {
  27321. var args = arguments;
  27322. if (args.length == 0) {
  27323. return this.precision$1();
  27324. }
  27325. return this.precision$0(a0);
  27326. }
  27327. });
  27328. // $source: com/ibm/rave/core/internal/geo/DelegatingStreamListener
  27329. /************************************************************************
  27330. ** IBM Confidential
  27331. **
  27332. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  27333. **
  27334. ** (C) Copyright IBM Corp. 2015
  27335. **
  27336. ** The source code for this program is not published or otherwise divested of its trade secrets,
  27337. ** irrespective of what has been deposited with the U.S. Copyright Office.
  27338. ************************************************************************/
  27339. // GENERATED
  27340. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  27341. /**
  27342. * A helper class that provides basic delegation support for stream listeners. Clients can supply their own handlers ( {@link (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamStateHandler) StreamStateHandler} or @link {@link (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamPointStateHandler) StreamPointStateHandler} ) for the various GeoJSOn streaming events/states and the DelegatingStreamListener listener will forward these events to the appropriate moreover, clients can change those handler based on the current stream state (e.g., in response to polygonStart event, they might elect to change the handler for point event up until polugonEnd event) If the client is not interested in handling some event, then they can simply set the corresponding delegate to null.
  27343. * @see (com.ibm.rave.core.geo.StreamListener) StreamListener
  27344. */
  27345. var com_ibm_rave_core_internal_geo_DelegatingStreamListener = com_ibm_rave_core_nativeImpl_Declare({
  27346. //pointDelegate : null,
  27347. //sphereDelegate : null,
  27348. //lineStartDelegate : null,
  27349. //lineEndDelegate : null,
  27350. //polygonStartDelegate : null,
  27351. //polygonEndDelegate : null,
  27352. /**
  27353. * @expose
  27354. */
  27355. valid : false,
  27356. /**
  27357. * @return (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamPointStateHandler) the pointDelegate
  27358. */
  27359. getPointDelegate : function() {
  27360. return this.pointDelegate;
  27361. },
  27362. /**
  27363. * @param (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamPointStateHandler) pointDelegate the pointDelegate to set
  27364. */
  27365. setPointDelegate : function(pointDelegate) {
  27366. this.pointDelegate = pointDelegate;
  27367. },
  27368. /**
  27369. * @return (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamStateHandler) the sphereDelegate
  27370. */
  27371. getSphereDelegate : function() {
  27372. return this.sphereDelegate;
  27373. },
  27374. /**
  27375. * @param (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamStateHandler) sphereDelegate the sphereDelegate to set
  27376. */
  27377. setSphereDelegate : function(sphereDelegate) {
  27378. this.sphereDelegate = sphereDelegate;
  27379. },
  27380. /**
  27381. * @return (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamStateHandler) the lineStartDelegate
  27382. */
  27383. getLineStartDelegate : function() {
  27384. return this.lineStartDelegate;
  27385. },
  27386. /**
  27387. * @param (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamStateHandler) lineStartDelegate the lineStartDelegate to set
  27388. */
  27389. setLineStartDelegate : function(lineStartDelegate) {
  27390. this.lineStartDelegate = lineStartDelegate;
  27391. },
  27392. /**
  27393. * @return (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamStateHandler) the lineEndDelegate
  27394. */
  27395. getLineEndDelegate : function() {
  27396. return this.lineEndDelegate;
  27397. },
  27398. /**
  27399. * @param (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamStateHandler) lineEndDelegate the lineEndDelegate to set
  27400. */
  27401. setLineEndDelegate : function(lineEndDelegate) {
  27402. this.lineEndDelegate = lineEndDelegate;
  27403. },
  27404. /**
  27405. * @return (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamStateHandler) the polygonStartDelegate
  27406. */
  27407. getPolygonStartDelegate : function() {
  27408. return this.polygonStartDelegate;
  27409. },
  27410. /**
  27411. * @param (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamStateHandler) polygonStartDelegate the polygonStartDelegate to set
  27412. */
  27413. setPolygonStartDelegate : function(polygonStartDelegate) {
  27414. this.polygonStartDelegate = polygonStartDelegate;
  27415. },
  27416. /**
  27417. * @return (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamStateHandler) the polygonEndDelegate
  27418. */
  27419. getPolygonEndDelegate : function() {
  27420. return this.polygonEndDelegate;
  27421. },
  27422. /**
  27423. * @param (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamStateHandler) polygonEndDelegate the polygonEndDelegate to set
  27424. */
  27425. setPolygonEndDelegate : function(polygonEndDelegate) {
  27426. this.polygonEndDelegate = polygonEndDelegate;
  27427. },
  27428. /** @expose */
  27429. sphere : function() {
  27430. if (this.sphereDelegate) {
  27431. this.sphereDelegate();
  27432. }
  27433. },
  27434. /** @expose */
  27435. point : function(x, y, z) {
  27436. if (this.pointDelegate) {
  27437. this.pointDelegate(x, y, z);
  27438. }
  27439. },
  27440. /** @expose */
  27441. lineStart : function() {
  27442. if (this.lineStartDelegate) {
  27443. this.lineStartDelegate();
  27444. }
  27445. },
  27446. /** @expose */
  27447. lineEnd : function() {
  27448. if (this.lineEndDelegate) {
  27449. this.lineEndDelegate();
  27450. }
  27451. },
  27452. /** @expose */
  27453. polygonStart : function() {
  27454. if (this.polygonStartDelegate) {
  27455. this.polygonStartDelegate();
  27456. }
  27457. },
  27458. /** @expose */
  27459. polygonEnd : function() {
  27460. if (this.polygonEndDelegate) {
  27461. this.polygonEndDelegate();
  27462. }
  27463. },
  27464. /**
  27465. * Set the value of validity of caching and reusing this listener. This could happen when one component creates and initializes the listener, but another uses it in which case the client must make sure that the listener is still cacheable and is still valid for reuse. This validity flag is should be checked only when listeners are cached and are about to be reused again. On creation, the listener is valid and this flag's value should not be used. However, if the user of this listener decides to keep the listener around, it should check if the listener is valid before using it again, else, the user should ask the creator component to make another up to date listener. In other words, this is a simplistic way to control caching of this listener.
  27466. * @param (boolean) valid the value of validity of this listener
  27467. */
  27468. setValid : function(valid) {
  27469. this.valid = valid;
  27470. },
  27471. /**
  27472. * A getter for the validity of the listener
  27473. * @return (boolean) boolean representing the validity of the listener
  27474. */
  27475. isValid : function() {
  27476. return this.valid;
  27477. }
  27478. });
  27479. /**
  27480. * A tagging interface that is the base of all state handlers
  27481. */
  27482. com_ibm_rave_core_internal_geo_DelegatingStreamListener.BaseStreamStateHandler = com_ibm_rave_core_nativeImpl_Declare.implement(
  27483. );
  27484. // $source: com/ibm/rave/core/geo/TransformStreamListener
  27485. /************************************************************************
  27486. ** IBM Confidential
  27487. **
  27488. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  27489. **
  27490. ** (C) Copyright IBM Corp. 2015
  27491. **
  27492. ** The source code for this program is not published or otherwise divested of its trade secrets,
  27493. ** irrespective of what has been deposited with the U.S. Copyright Office.
  27494. ************************************************************************/
  27495. // GENERATED
  27496. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  27497. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (loadtime) // superclass
  27498. /**
  27499. * An interface to be implemented by all transform stream listeners
  27500. */
  27501. var com_ibm_rave_core_geo_TransformStreamListener = rave_externs["TransformStreamListener"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_DelegatingStreamListener, {
  27502. /**
  27503. * A getter for the wrapped stream listener
  27504. * @return (com.ibm.rave.core.geo.StreamListener) the wrapped stream listener
  27505. */
  27506. /** @expose */
  27507. getStreamListener : function() {}
  27508. });
  27509. // $source: com/ibm/rave/core/internal/geo/TransformStreamListenerImpl
  27510. /************************************************************************
  27511. ** IBM Confidential
  27512. **
  27513. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  27514. **
  27515. ** (C) Copyright IBM Corp. 2015
  27516. **
  27517. ** The source code for this program is not published or otherwise divested of its trade secrets,
  27518. ** irrespective of what has been deposited with the U.S. Copyright Office.
  27519. ************************************************************************/
  27520. // GENERATED
  27521. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  27522. //@import com/ibm/rave/core/geo/TransformStreamListener (loadtime) // superclass
  27523. //@import com/ibm/rave/core/geo/StreamListener (runtime) // polygonStartHandler
  27524. /**
  27525. * A GeoJSOn stream listener that is used to wrap another listener, and also accept a group of state stream state handlers. If a state stream handler for a specific stream event is available, then it will be invoked in response to stream events, otherwise, the wrapped listener will be invoked instead. This allows the handlers to perform some transformation on geometry input (if required) and optionally forwarding it to the wrapped listener.
  27526. * @see this.Geo#this.transform(Object)
  27527. * @see (com.ibm.rave.core.geo.TransformStreamListenerFactory) TransformStreamListenerFactory
  27528. */
  27529. var com_ibm_rave_core_internal_geo_TransformStreamListenerImpl = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_geo_TransformStreamListener, {
  27530. //listener : null,
  27531. constructor : function(listener, delegates) {
  27532. this.listener = listener;
  27533. var self = this;
  27534. var handler = delegates["lineEnd"];
  27535. if (handler) {
  27536. this.lineEndDelegate = handler;
  27537. } else {
  27538. this.lineEndDelegate = function() {
  27539. self.listener.lineEnd();
  27540. };
  27541. }
  27542. handler = delegates["lineStart"];
  27543. if (handler) {
  27544. this.lineStartDelegate = handler;
  27545. } else {
  27546. this.lineStartDelegate = function() {
  27547. self.listener.lineStart();
  27548. };
  27549. }
  27550. handler = delegates["point"];
  27551. if (handler) {
  27552. this.pointDelegate = handler;
  27553. } else {
  27554. this.pointDelegate = function(x, y, z) {
  27555. self.listener.point(x, y, z);
  27556. };
  27557. }
  27558. handler = delegates["polygonEnd"];
  27559. if (handler) {
  27560. this.polygonEndDelegate = handler;
  27561. } else {
  27562. this.polygonEndDelegate = function() {
  27563. self.listener.polygonEnd();
  27564. };
  27565. }
  27566. handler = delegates[com_ibm_rave_core_geo_StreamListener.polygonStartHandler];
  27567. if (handler) {
  27568. this.polygonStartDelegate = handler;
  27569. } else {
  27570. this.polygonStartDelegate = function() {
  27571. self.listener.polygonStart();
  27572. };
  27573. }
  27574. handler = delegates["sphere"];
  27575. if (handler) {
  27576. this.sphereDelegate = handler;
  27577. } else {
  27578. this.sphereDelegate = function() {
  27579. self.listener.sphere();
  27580. };
  27581. }
  27582. },
  27583. /**
  27584. * A getter for the wrapped stream listener
  27585. * @return (com.ibm.rave.core.geo.StreamListener) the wrapped stream listener
  27586. */
  27587. /** @expose */
  27588. getStreamListener : function() {
  27589. return this.listener;
  27590. }
  27591. });
  27592. // $source: com/ibm/rave/core/geo/StreamListener
  27593. /************************************************************************
  27594. ** IBM Confidential
  27595. **
  27596. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  27597. **
  27598. ** (C) Copyright IBM Corp. 2015
  27599. **
  27600. ** The source code for this program is not published or otherwise divested of its trade secrets,
  27601. ** irrespective of what has been deposited with the U.S. Copyright Office.
  27602. ************************************************************************/
  27603. // GENERATED
  27604. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  27605. /**
  27606. * An interface to be implemented by clients wishing to stream GeoJSON objects. Listeners are inherently stateful; the meaning of a point depends on whether the point is inside of a line, and likewise a line is distinguished from a ring by a polygon
  27607. */
  27608. var com_ibm_rave_core_geo_StreamListener = rave_externs["StreamListener"] = com_ibm_rave_core_nativeImpl_Declare.implement(
  27609. /**
  27610. * Indicates the sphere (the globe; the unit sphere centered at {0,0,0}.
  27611. */
  27612. //sphere : function() {},
  27613. /**
  27614. * Indicates a point with the specified coordinates x and y and optionally z. The coordinate system is unspecified and implementation-dependent; for example, projection streams require spherical coordinates in degrees as input. Outside the context of a polygon or line, a point indicates a point geometry object (Point or MultiPoint). Within a line or polygon ring, the point indicates a control point.
  27615. * @param (double) x the value of x coordinate
  27616. * @param (double) y the value of y coordinate
  27617. * @param (double) z the value of the z coordinate; if there is no z value specified in the GeoJSON file, then NaN will be passed.
  27618. */
  27619. //point : function(x, y, z) {},
  27620. /**
  27621. * Indicates the start of a line or ring. Within a polygon, indicates the start of a ring. The first ring of a polygon is the exterior ring, and is typically clockwise. Any subsequent rings indicate holes in the polygon, and are typically counterclockwise.
  27622. */
  27623. //lineStart : function() {},
  27624. /**
  27625. * Indicates the end of a line or ring. Within a polygon, indicates the end of a ring. Unlike GeoJSON, the redundant closing coordinate of a ring is not indicated via point, and instead is implied via lineEnd within a polygon.
  27626. */
  27627. //lineEnd : function() {},
  27628. /**
  27629. * Indicates the start of a polygon. The first line of a polygon indicates the exterior ring, and any subsequent lines indicate interior holes.
  27630. */
  27631. //polygonStart : function() {},
  27632. /**
  27633. * Indicates the end of a polygon.
  27634. */
  27635. //polygonEnd : function() {}
  27636. );
  27637. /** @expose */
  27638. com_ibm_rave_core_geo_StreamListener.pointHandler = "point";
  27639. /** @expose */
  27640. com_ibm_rave_core_geo_StreamListener.sphereHandler = "sphere";
  27641. /** @expose */
  27642. com_ibm_rave_core_geo_StreamListener.lineStartHandler = "lineStart";
  27643. /** @expose */
  27644. com_ibm_rave_core_geo_StreamListener.lineEndHandler = "lineEnd";
  27645. /** @expose */
  27646. com_ibm_rave_core_geo_StreamListener.polygonStartHandler = "polygonStart";
  27647. /** @expose */
  27648. com_ibm_rave_core_geo_StreamListener.polygonEndHandler = "polygonEnd";
  27649. // $source: com/ibm/rave/core/internal/geo/ResampleStreamListener
  27650. /************************************************************************
  27651. ** IBM Confidential
  27652. **
  27653. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  27654. **
  27655. ** (C) Copyright IBM Corp. 2015
  27656. **
  27657. ** The source code for this program is not published or otherwise divested of its trade secrets,
  27658. ** irrespective of what has been deposited with the U.S. Copyright Office.
  27659. ************************************************************************/
  27660. // GENERATED
  27661. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  27662. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (loadtime) // superclass
  27663. //@import com/ibm/rave/core/internal/geo/CartesianUtil (runtime) // cartesian
  27664. /**
  27665. */
  27666. var com_ibm_rave_core_internal_geo_ResampleStreamListener = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_DelegatingStreamListener, {
  27667. //factory : null,
  27668. //listener : null,
  27669. λ00 : 0, φ00 : 0, x00 : 0, y00 : 0, a00 : 0, b00 : 0, c00 : 0, λ0 : 0, x0 : 0, y0 : 0, a0 : 0, b0 : 0, c0 : 0,
  27670. /**
  27671. */
  27672. constructor : function(factory, listener) {
  27673. this.factory = factory;
  27674. this.listener = listener;
  27675. var self = this;
  27676. var point = function(x, y, z) {
  27677. var res = self.factory.pointProjector(x, y, z);
  27678. self.listener.point(res[0], res[1], NaN);
  27679. };
  27680. var linePoint = function(λ, φ, z) {
  27681. var c = com_ibm_rave_core_internal_geo_CartesianUtil.cartesian([λ, φ]), p = self.factory.pointProjector(λ, φ, NaN);
  27682. self.resampleLineTo(self.x0, self.y0, self.λ0, self.a0, self.b0, self.c0, self.x0 = p[0], self.y0 = p[1], self.λ0 = λ, self.a0 = c[0], self.b0 = c[1], self.c0 = c[2], self.factory.maxDepth, self.listener);
  27683. self.listener.point(self.x0, self.y0, z);
  27684. };
  27685. var lineStart = function() {
  27686. self.x0 = NaN;
  27687. self.pointDelegate = linePoint;
  27688. self.listener.lineStart();
  27689. };
  27690. var lineEnd = function() {
  27691. self.pointDelegate = point;
  27692. self.listener.lineEnd();
  27693. };
  27694. var ringPoint = function(λ, φ, z) {
  27695. linePoint(self.λ00 = λ, self.φ00 = φ, z);
  27696. self.x00 = self.x0;
  27697. self.y00 = self.y0;
  27698. self.a00 = self.a0;
  27699. self.b00 = self.b0;
  27700. self.c00 = self.c0;
  27701. self.pointDelegate = linePoint;
  27702. };
  27703. var ringEnd = function() {
  27704. self.resampleLineTo(self.x0, self.y0, self.λ0, self.a0, self.b0, self.c0, self.x00, self.y00, self.λ00, self.a00, self.b00, self.c00, self.factory.maxDepth, self.listener);
  27705. self.lineEndDelegate = lineEnd;
  27706. lineEnd();
  27707. };
  27708. var ringStart = function() {
  27709. lineStart();
  27710. self.pointDelegate = ringPoint;
  27711. self.lineEndDelegate = ringEnd;
  27712. };
  27713. var polygonStart = function() {
  27714. self.listener.polygonStart();
  27715. self.lineStartDelegate = ringStart;
  27716. };
  27717. var polygonEnd = function() {
  27718. self.listener.polygonEnd();
  27719. self.lineStartDelegate = lineStart;
  27720. };
  27721. this.pointDelegate = point;
  27722. this.lineStartDelegate = lineStart;
  27723. this.lineEndDelegate = lineEnd;
  27724. this.polygonStartDelegate = polygonStart;
  27725. this.polygonEndDelegate = polygonEnd;
  27726. },
  27727. resampleLineTo : function(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, listener) {
  27728. var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy;
  27729. if (d2 > 4 * this.factory.δ2 && depth-- > 0) {
  27730. var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = Math.sqrt(a * a + b * b + c * c);
  27731. var φ2 = Math.asin(c /= m), λ2 = Math.abs(Math.abs(c) - 1) < 1.0E-6 || Math.abs(λ0 - λ1) < 1.0E-6 ? (λ0 + λ1) / 2 : Math.atan2(b, a);
  27732. var p = this.factory.pointProjector(λ2, φ2, NaN);
  27733. var x2 = p[0];
  27734. var y2 = p[1];
  27735. var dx2 = x2 - x0;
  27736. var dy2 = y2 - y0;
  27737. var dz = dy * dx2 - dx * dy2;
  27738. if (dz * dz / d2 > this.factory.δ2 || Math.abs((dx * dx2 + dy * dy2) / d2 - .5) > .3 || a0 * a1 + b0 * b1 + c0 * c1 < this.factory.cosMinDistance) {
  27739. this.resampleLineTo(x0, y0, λ0, a0, b0, c0, x2, y2, λ2, a /= m, b /= m, c, depth, listener);
  27740. listener.point(x2, y2, NaN);
  27741. this.resampleLineTo(x2, y2, λ2, a, b, c, x1, y1, λ1, a1, b1, c1, depth, listener);
  27742. }
  27743. }
  27744. }
  27745. });
  27746. // $source: com/ibm/rave/core/internal/geo/CartesianUtil
  27747. /************************************************************************
  27748. ** IBM Confidential
  27749. **
  27750. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  27751. **
  27752. ** (C) Copyright IBM Corp. 2015
  27753. **
  27754. ** The source code for this program is not published or otherwise divested of its trade secrets,
  27755. ** irrespective of what has been deposited with the U.S. Copyright Office.
  27756. ************************************************************************/
  27757. // GENERATED
  27758. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  27759. /**
  27760. * A collection of helper methods operating on point in Cartesian plane.
  27761. */
  27762. var com_ibm_rave_core_internal_geo_CartesianUtil = com_ibm_rave_core_nativeImpl_Declare({
  27763. //constructor : function() {}
  27764. });
  27765. /**
  27766. * Converts a point coordinates from spherical plane to Cartesian plane
  27767. * @param (double[]) spherical the location in spherical plane to convert
  27768. * @return (double[]) the x,y,z coordinates of the point in Cartesian plane
  27769. */
  27770. com_ibm_rave_core_internal_geo_CartesianUtil.cartesian = function(spherical) {
  27771. var λ = spherical[0], φ = spherical[1], cosφ = Math.cos(φ);
  27772. return [cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ)];
  27773. };
  27774. /**
  27775. * Calculates the dot product of two 3D points in Cartesian plane
  27776. * @param (double[]) a the first point x,y,z coordinates
  27777. * @param (double[]) b the second point x,y,z coordinates
  27778. * @return (double) the dot product (scalar value)
  27779. */
  27780. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianDot = function(a, b) {
  27781. return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  27782. };
  27783. /**
  27784. * Calculates the cross product of two 3D points in Cartesian plane
  27785. * @param (double[]) a the first point x,y,z coordinates
  27786. * @param (double[]) b the second point x,y,z coordinates
  27787. * @return (double[]) a new point (vector) holding whose coordinates are the cross product
  27788. */
  27789. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianCross = function(a, b) {
  27790. var x = a[1] * b[2] - a[2] * b[1];
  27791. var y = a[2] * b[0] - a[0] * b[2];
  27792. var z = a[0] * b[1] - a[1] * b[0];
  27793. return [x, y, z];
  27794. };
  27795. /**
  27796. * Adds one 3D point to another. This is done in place meaning the coordinates of the first point (a) will change
  27797. * @param (double[]) a the first point x,y,z coordinates. It will hold the result of the add operation
  27798. * @param (double[]) b the second point x,y,z coordinates
  27799. */
  27800. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianAdd = function(a, b) {
  27801. a[0] += b[0];
  27802. a[1] += b[1];
  27803. a[2] += b[2];
  27804. };
  27805. /**
  27806. * Scale the coordinates of a given point by a specific factor
  27807. * @param (double[]) vector the 3D point to scale
  27808. * @param (double) k scale factor to apply
  27809. * @return (double[]) a new point holding the scale result
  27810. */
  27811. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianScale = function(vector, k) {
  27812. return [vector[0] * k, vector[1] * k, vector[2] * k];
  27813. };
  27814. /**
  27815. * Normalizes a 3D point and modifies its coordinates accordingly
  27816. * @param (double[]) d the point whose coordinates to normalize
  27817. */
  27818. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianNormalize = function(d) {
  27819. var l = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
  27820. d[0] /= l;
  27821. d[1] /= l;
  27822. d[2] /= l;
  27823. };
  27824. // $source: com/ibm/rave/core/internal/geo/ClipExtentStreamListenerFactory
  27825. /************************************************************************
  27826. ** IBM Confidential
  27827. **
  27828. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  27829. **
  27830. ** (C) Copyright IBM Corp. 2015
  27831. **
  27832. ** The source code for this program is not published or otherwise divested of its trade secrets,
  27833. ** irrespective of what has been deposited with the U.S. Copyright Office.
  27834. ************************************************************************/
  27835. // GENERATED
  27836. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  27837. //@import com/ibm/rave/core/internal/geo/ClipExtentStreamListener (runtime) // new
  27838. /**
  27839. */
  27840. var com_ibm_rave_core_internal_geo_ClipExtentStreamListenerFactory = com_ibm_rave_core_nativeImpl_Declare({
  27841. x0 : 0, y0 : 0, x1 : 0, y1 : 0,
  27842. _$functionClassMethod : function() {
  27843. var _$self = function(listener) {
  27844. return new com_ibm_rave_core_internal_geo_ClipExtentStreamListener(_$self.x0, _$self.y0, _$self.x1, _$self.y1, listener);
  27845. };
  27846. return _$self;
  27847. },
  27848. /**
  27849. */
  27850. constructor : function(x0, y0, x1, y1) {
  27851. this.x0 = x0;
  27852. this.y0 = y0;
  27853. this.x1 = x1;
  27854. this.y1 = y1;
  27855. }
  27856. });
  27857. // $source: com/ibm/rave/core/internal/geo/ClipExtentStreamListener
  27858. /************************************************************************
  27859. ** IBM Confidential
  27860. **
  27861. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  27862. **
  27863. ** (C) Copyright IBM Corp. 2015
  27864. **
  27865. ** The source code for this program is not published or otherwise divested of its trade secrets,
  27866. ** irrespective of what has been deposited with the U.S. Copyright Office.
  27867. ************************************************************************/
  27868. // GENERATED
  27869. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  27870. //@import com/ibm/rave/core/geo/TransformStreamListener (loadtime) // superclass
  27871. //@import com/ibm/rave/core/geom/ClipLine (runtime) // create
  27872. //@import com/ibm/rave/core/internal/geo/ClipBufferStreamListener (runtime) // new
  27873. //@import com/ibm/rave/core/geom/Line (runtime) // new
  27874. //@import com/ibm/rave/core/geom/PointStruct (runtime) // new
  27875. //@import com/ibm/rave/core/arrays/Merge (runtime) // merge
  27876. //@import com/ibm/rave/core/internal/geo/ClipUtil (runtime) // clipPolygon
  27877. //@import com/ibm/rave/core/internal/math/Trigonometry (runtime) // cross2d
  27878. /**
  27879. */
  27880. var com_ibm_rave_core_internal_geo_ClipExtentStreamListener = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_geo_TransformStreamListener, {
  27881. //listener : null,
  27882. //clientListener : null,
  27883. //bufferListener : null,
  27884. //lineClipper : null,
  27885. //comparator : null,
  27886. //interpolator : null,
  27887. //segments : null,
  27888. //polygon : null,
  27889. //ring : null,
  27890. x0 : 0, y0 : 0, x1 : 0, y1 : 0,
  27891. x__ : 0, y__ : 0, x_ : 0, y_ : 0,
  27892. first : false, clean : false, v__ : false, v_ : false,
  27893. constructor : function(x0, y0, x1, y1, clientListener) {
  27894. var self = this;
  27895. this.clientListener = clientListener;
  27896. this.listener = clientListener;
  27897. this.x0 = x0;
  27898. this.y0 = y0;
  27899. this.x1 = x1;
  27900. this.y1 = y1;
  27901. this.lineClipper = com_ibm_rave_core_geom_ClipLine.create(x0, y0, x1, y1);
  27902. this.bufferListener = new com_ibm_rave_core_internal_geo_ClipBufferStreamListener();
  27903. this.comparator = function(a, b) {
  27904. var result = self.comparePoints(a.x, b.x);
  27905. return (result == 0) ? 0 : (result > 0) ? 1 : -1;
  27906. };
  27907. this.interpolator = function(from, to, direction, listener) {
  27908. var a = 0, a1 = 0;
  27909. if (!from || (a = self.corner(from, direction)) != (a1 = self.corner(to, direction)) || (self.comparePoints(from, to) < 0) ^ (direction > 0)) {
  27910. do {
  27911. listener.point(a == 0 || a == 3 ? self.x0 : self.x1, a > 1 ? self.y1 : self.y0, NaN);
  27912. } while ((a = (a + direction + 4) % 4) != a1);
  27913. } else {
  27914. listener.point(to[0], to[1], NaN);
  27915. }
  27916. };
  27917. var point = function(x, y, z) {
  27918. if (self.pointVisible(x, y)) {
  27919. self.listener.point(x, y, NaN);
  27920. }
  27921. };
  27922. var linePoint = function(x, y, z) {
  27923. x = Math.max(-1.0E9, Math.min(1.0E9, x));
  27924. y = Math.max(-1.0E9, Math.min(1.0E9, y));
  27925. var v = self.pointVisible(x, y);
  27926. if (self.polygon) {
  27927. self.ring.push([x, y]);
  27928. }
  27929. if (self.first) {
  27930. self.x__ = x;
  27931. self.y__ = y;
  27932. self.v__ = v;
  27933. self.first = false;
  27934. if (v) {
  27935. self.listener.lineStart();
  27936. self.listener.point(x, y, NaN);
  27937. }
  27938. } else {
  27939. if (v && self.v_) {
  27940. self.listener.point(x, y, NaN);
  27941. } else {
  27942. var l = new com_ibm_rave_core_geom_Line(new com_ibm_rave_core_geom_PointStruct(self.x_, self.y_), new com_ibm_rave_core_geom_PointStruct(x, y));
  27943. if (self.lineClipper(l)) {
  27944. if (!self.v_) {
  27945. self.listener.lineStart();
  27946. self.listener.point(l.a.x, l.a.y, NaN);
  27947. }
  27948. self.listener.point(l.b.x, l.b.y, NaN);
  27949. if (!v) {
  27950. self.listener.lineEnd();
  27951. }
  27952. self.clean = false;
  27953. } else if (v) {
  27954. self.listener.lineStart();
  27955. self.listener.point(x, y, NaN);
  27956. self.clean = false;
  27957. }
  27958. }
  27959. }
  27960. self.x_ = x;
  27961. self.y_ = y;
  27962. self.v_ = v;
  27963. };
  27964. var lineStart = function() {
  27965. self.pointDelegate = linePoint;
  27966. if (self.polygon) {
  27967. self.polygon.push(self.ring = []);
  27968. }
  27969. self.first = true;
  27970. self.v_ = false;
  27971. self.x_ = self.y_ = NaN;
  27972. };
  27973. var lineEnd = function() {
  27974. if (self.segments) {
  27975. linePoint(self.x__, self.y__, NaN);
  27976. if (self.v__ && self.v_) {
  27977. self.bufferListener.rejoin();
  27978. }
  27979. self.segments.push(self.bufferListener.buffer());
  27980. }
  27981. self.pointDelegate = point;
  27982. if (self.v_) {
  27983. self.listener.lineEnd();
  27984. }
  27985. };
  27986. var polygonStart = function() {
  27987. self.listener = self.bufferListener;
  27988. self.segments = [];
  27989. self.polygon = [];
  27990. self.clean = true;
  27991. };
  27992. var polygonEnd = function() {
  27993. self.listener = self.clientListener;
  27994. var mergedSegments = com_ibm_rave_core_arrays_Merge.merge(self.segments);
  27995. var clipStartInside = self.insidePolygon([self.x0, self.y1]), inside = self.clean && clipStartInside, visible = mergedSegments.length > 0;
  27996. if (inside || visible) {
  27997. self.listener.polygonStart();
  27998. if (inside) {
  27999. self.listener.lineStart();
  28000. self.interpolator(null, null, 1, self.listener);
  28001. self.listener.lineEnd();
  28002. }
  28003. if (visible) {
  28004. com_ibm_rave_core_internal_geo_ClipUtil.clipPolygon(mergedSegments, self.comparator, clipStartInside, self.interpolator, self.listener);
  28005. }
  28006. self.listener.polygonEnd();
  28007. }
  28008. self.segments = null;
  28009. self.polygon = null;
  28010. self.ring = null;
  28011. };
  28012. this.pointDelegate = point;
  28013. this.lineStartDelegate = lineStart;
  28014. this.lineEndDelegate = lineEnd;
  28015. this.polygonStartDelegate = polygonStart;
  28016. this.polygonEndDelegate = polygonEnd;
  28017. },
  28018. corner : function(p, direction) {
  28019. return Math.abs(p[0] - this.x0) < 1.0E-6 ? direction > 0 ? 0 : 3 : Math.abs(p[0] - this.x1) < 1.0E-6 ? direction > 0 ? 2 : 1 : Math.abs(p[1] - this.y0) < 1.0E-6 ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2;
  28020. },
  28021. comparePoints : function(a, b) {
  28022. var ca = this.corner(a, 1), cb = this.corner(b, 1);
  28023. var result = ca != cb ? ca - cb : ca == 0 ? b[1] - a[1] : ca == 1 ? a[0] - b[0] : ca == 2 ? a[1] - b[1] : b[0] - a[0];
  28024. return result;
  28025. },
  28026. pointVisible : function(x, y) {
  28027. return this.x0 <= x && x <= this.x1 && this.y0 <= y && y <= this.y1;
  28028. },
  28029. insidePolygon : function(p) {
  28030. var wn = 0;
  28031. var n = this.polygon.length;
  28032. var y = p[1];
  28033. for (var i = 0; i < n; ++i) {
  28034. var v = this.polygon[i];
  28035. var a = v[0];
  28036. for (var j = 1, m = v.length; j < m; ++j) {
  28037. var b = v[j];
  28038. if (a[1] <= y) {
  28039. if (b[1] > y && com_ibm_rave_core_internal_math_Trigonometry.cross2d(a, b, p) > 0) {
  28040. ++wn;
  28041. }
  28042. } else {
  28043. if (b[1] <= y && com_ibm_rave_core_internal_math_Trigonometry.cross2d(a, b, p) < 0) {
  28044. --wn;
  28045. }
  28046. }
  28047. a = b;
  28048. }
  28049. }
  28050. return wn != 0;
  28051. },
  28052. /**
  28053. * A getter for the wrapped stream listener
  28054. * @return (com.ibm.rave.core.geo.StreamListener) the wrapped stream listener
  28055. */
  28056. /** @expose */
  28057. getStreamListener : function() {
  28058. return this.clientListener;
  28059. }
  28060. });
  28061. com_ibm_rave_core_internal_geo_ClipExtentStreamListener.clipExtentMAX = 1e9;
  28062. // $source: com/ibm/rave/core/internal/geo/ClipBufferStreamListener
  28063. /************************************************************************
  28064. ** IBM Confidential
  28065. **
  28066. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  28067. **
  28068. ** (C) Copyright IBM Corp. 2015
  28069. **
  28070. ** The source code for this program is not published or otherwise divested of its trade secrets,
  28071. ** irrespective of what has been deposited with the U.S. Copyright Office.
  28072. ************************************************************************/
  28073. // GENERATED
  28074. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  28075. var com_ibm_rave_core_internal_geo_ClipBufferStreamListener = com_ibm_rave_core_nativeImpl_Declare({
  28076. //lines : null,
  28077. //line : null,
  28078. constructor : function() {
  28079. this.lines = [];
  28080. },
  28081. /** @expose */
  28082. sphere : function() {},
  28083. /** @expose */
  28084. point : function(x, y, z) {
  28085. this.line.push([x, y]);
  28086. },
  28087. /** @expose */
  28088. lineStart : function() {
  28089. this.lines.push(this.line = []);
  28090. },
  28091. /** @expose */
  28092. lineEnd : function() {},
  28093. /** @expose */
  28094. polygonStart : function() {},
  28095. /** @expose */
  28096. polygonEnd : function() {},
  28097. buffer : function() {
  28098. var buff = this.lines;
  28099. this.lines = [];
  28100. this.line = null;
  28101. return buff;
  28102. },
  28103. rejoin : function() {
  28104. if (this.lines.length > 1) {
  28105. this.lines.push(this.lines.pop().concat(this.lines.shift()));
  28106. }
  28107. }
  28108. });
  28109. // $source: com/ibm/rave/core/internal/geo/ClipStreamListenerFactory
  28110. /************************************************************************
  28111. ** IBM Confidential
  28112. **
  28113. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  28114. **
  28115. ** (C) Copyright IBM Corp. 2015
  28116. **
  28117. ** The source code for this program is not published or otherwise divested of its trade secrets,
  28118. ** irrespective of what has been deposited with the U.S. Copyright Office.
  28119. ************************************************************************/
  28120. // GENERATED
  28121. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  28122. //@import com/ibm/rave/core/internal/geo/ClipStreamListener (runtime) // new
  28123. /**
  28124. */
  28125. var com_ibm_rave_core_internal_geo_ClipStreamListenerFactory = com_ibm_rave_core_nativeImpl_Declare({
  28126. //pointVisible : null,
  28127. //clipLine : null,
  28128. //interpolate : null,
  28129. //clipStart : null,
  28130. _$functionClassMethod : function() {
  28131. var _$self = function(rotate, listener) {
  28132. return new com_ibm_rave_core_internal_geo_ClipStreamListener(_$self.pointVisible, _$self.clipLine, _$self.interpolate, _$self.clipStart, rotate, listener);
  28133. };
  28134. return _$self;
  28135. },
  28136. /**
  28137. */
  28138. constructor : function(pointVisible, clipLine, interpolate, clipStart) {
  28139. this.pointVisible = pointVisible;
  28140. this.clipLine = clipLine;
  28141. this.interpolate = interpolate;
  28142. this.clipStart = clipStart;
  28143. }
  28144. });
  28145. // $source: com/ibm/rave/core/internal/geo/ClipUtil
  28146. /************************************************************************
  28147. ** IBM Confidential
  28148. **
  28149. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  28150. **
  28151. ** (C) Copyright IBM Corp. 2015
  28152. **
  28153. ** The source code for this program is not published or otherwise divested of its trade secrets,
  28154. ** irrespective of what has been deposited with the U.S. Copyright Office.
  28155. ************************************************************************/
  28156. // GENERATED
  28157. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  28158. //@import com/ibm/rave/core/internal/geo/ClipExtentStreamListenerFactory (static) // new
  28159. //@import com/ibm/rave/core/internal/geo/ClipStreamListenerFactory (static) // new
  28160. //@import com/ibm/rave/core/internal/geo/CircleClipLineStreamListenerFactory (runtime) // new
  28161. //@import com/ibm/rave/core/internal/geo/GeoShapeGeneratorUtil (runtime) // newCircleInterpolator
  28162. //@import com/ibm/rave/core/internal/geo/AntimeridianClipLineStreamListenerFactory (runtime) // new
  28163. //@import com/ibm/rave/core/internal/geo/SphericalUtil (runtime) // sphericalEqual
  28164. //@import com/ibm/rave/core/internal/geo/ClipPolygonIntersection (runtime) // new
  28165. //@import com/ibm/rave/core/internal/math/Adder (runtime) // new
  28166. //@import com/ibm/rave/core/internal/geo/CartesianUtil (static) // cartesianNormalize, cartesian, cartesianCross
  28167. //@import com/ibm/rave/core/internal/math/Trigonometry (runtime) // asin
  28168. /**
  28169. */
  28170. var com_ibm_rave_core_internal_geo_ClipUtil = com_ibm_rave_core_nativeImpl_Declare({
  28171. });
  28172. com_ibm_rave_core_internal_geo_ClipUtil.newClipExtentStreamListenerFactory = function(x0, y0, x1, y1) {
  28173. return new com_ibm_rave_core_internal_geo_ClipExtentStreamListenerFactory(x0, y0, x1, y1);
  28174. };
  28175. com_ibm_rave_core_internal_geo_ClipUtil.newClipStreamListenerFactory = function(pointVisible, clipLine, interpolate, clipStart) {
  28176. return new com_ibm_rave_core_internal_geo_ClipStreamListenerFactory(pointVisible, clipLine, interpolate, clipStart);
  28177. };
  28178. com_ibm_rave_core_internal_geo_ClipUtil.newClipCircleStreamListenerFactory = function(radius) {
  28179. var circleClipLine = new com_ibm_rave_core_internal_geo_CircleClipLineStreamListenerFactory(radius);
  28180. var interpolator = com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.newCircleInterpolator(radius, 6 * 0.017453292519943295);
  28181. return new com_ibm_rave_core_internal_geo_ClipStreamListenerFactory(circleClipLine.visible, circleClipLine, interpolator, circleClipLine.smallRadius ? [0.0, -radius] : [-3.141592653589793, radius - 3.141592653589793]);
  28182. };
  28183. com_ibm_rave_core_internal_geo_ClipUtil.newAntimeridianClipLineStreamListenerFactory = function() {
  28184. var antimeridianClipLine = new com_ibm_rave_core_internal_geo_AntimeridianClipLineStreamListenerFactory();
  28185. return new com_ibm_rave_core_internal_geo_ClipStreamListenerFactory(com_ibm_rave_core_internal_geo_ClipUtil.allVisible, antimeridianClipLine, com_ibm_rave_core_internal_geo_ClipUtil.clipAntimeridianInterpolator, [-3.141592653589793, -3.141592653589793 / 2]);
  28186. };
  28187. com_ibm_rave_core_internal_geo_ClipUtil.clipPolygon = function(segments, comparator, clipStartInside, interpolator, listener) {
  28188. var subject = [];
  28189. var clip = [];
  28190. segments.forEach(function(segment, index, array) {
  28191. var n = segment.length - 1;
  28192. if (n <= 0) {
  28193. return null;
  28194. }
  28195. var p0 = segment[0];
  28196. var p1 = segment[n];
  28197. if (com_ibm_rave_core_internal_geo_SphericalUtil.sphericalEqual((p0), (p1))) {
  28198. listener.lineStart();
  28199. for (var i = 0; i < n; ++i) {
  28200. listener.point((p0 = segment[i])[0], p0[1], NaN);
  28201. }
  28202. listener.lineEnd();
  28203. return null;
  28204. }
  28205. var a = new com_ibm_rave_core_internal_geo_ClipPolygonIntersection(p0, segment, null, true);
  28206. var b = new com_ibm_rave_core_internal_geo_ClipPolygonIntersection(p0, null, a, false);
  28207. a.o = b;
  28208. subject.push(a);
  28209. clip.push(b);
  28210. a = new com_ibm_rave_core_internal_geo_ClipPolygonIntersection(p1, segment, null, false);
  28211. b = new com_ibm_rave_core_internal_geo_ClipPolygonIntersection(p1, null, a, true);
  28212. a.o = b;
  28213. subject.push(a);
  28214. clip.push(b);
  28215. return null;
  28216. });
  28217. clip.sort(comparator);
  28218. com_ibm_rave_core_internal_geo_ClipUtil.clipPolygonLinkCircular(subject);
  28219. com_ibm_rave_core_internal_geo_ClipUtil.clipPolygonLinkCircular(clip);
  28220. if (subject.length == 0) {
  28221. return;
  28222. }
  28223. var entry = clipStartInside;
  28224. for (var i = 0, n = clip.length; i < n; ++i) {
  28225. clip[i].e = entry = !entry;
  28226. }
  28227. var start = subject[0];
  28228. var points;
  28229. var point;
  28230. while (true) {
  28231. var current = start;
  28232. var isSubject = true;
  28233. while (current.v) {
  28234. if ((current = current.n) == start) {
  28235. return;
  28236. }
  28237. }
  28238. points = current.z;
  28239. listener.lineStart();
  28240. do {
  28241. current.v = true;
  28242. current.o.v = true;
  28243. if (current.e) {
  28244. if (isSubject) {
  28245. for (var i = 0, n = points.length; i < n; ++i) {
  28246. listener.point((point = points[i])[0], point[1], NaN);
  28247. }
  28248. } else {
  28249. interpolator(current.x, current.n.x, 1, listener);
  28250. }
  28251. current = current.n;
  28252. } else {
  28253. if (isSubject) {
  28254. points = current.p.z;
  28255. for (var i = points.length - 1; i >= 0; --i) {
  28256. listener.point((point = points[i])[0], point[1], NaN);
  28257. }
  28258. } else {
  28259. interpolator(current.x, current.p.x, -1, listener);
  28260. }
  28261. current = current.p;
  28262. }
  28263. current = current.o;
  28264. points = current.z;
  28265. isSubject = !isSubject;
  28266. } while (!(current.v));
  28267. listener.lineEnd();
  28268. }
  28269. };
  28270. com_ibm_rave_core_internal_geo_ClipUtil.clipPolygonLinkCircular = function(array) {
  28271. var n = array.length;
  28272. if (n == 0) {
  28273. return;
  28274. }
  28275. var i = 0;
  28276. var a = array[0];
  28277. var b;
  28278. while (++i < n) {
  28279. a.n = b = array[i];
  28280. b.p = a;
  28281. a = b;
  28282. }
  28283. a.n = b = array[0];
  28284. b.p = a;
  28285. };
  28286. com_ibm_rave_core_internal_geo_ClipUtil.pointInPolygon = function(point, polygon) {
  28287. var polarAngle = 0, meridian = point[0], parallel = point[1];
  28288. var winding = 0;
  28289. var meridianNormal = [Math.sin(meridian), -Math.cos(meridian), 0];
  28290. var areaRingSum = new com_ibm_rave_core_internal_math_Adder();
  28291. for (var i = 0, n = polygon.length; i < n; ++i) {
  28292. var ring = polygon[i];
  28293. var m = ring.length;
  28294. if (m == 0) {
  28295. continue;
  28296. }
  28297. var point0 = ring[0];
  28298. var λ0 = point0[0];
  28299. var φ0 = point0[1] / 2 + 3.141592653589793 / 4;
  28300. var sinφ0 = Math.sin(φ0);
  28301. var cosφ0 = Math.cos(φ0);
  28302. var j = 1;
  28303. while (true) {
  28304. if (j == m) {
  28305. j = 0;
  28306. }
  28307. point = ring[j];
  28308. var λ = point[0], φ = point[1] / 2 + 3.141592653589793 / 4, sinφ = Math.sin(φ), cosφ = Math.cos(φ), dλ = λ - λ0, sdλ = dλ >= 0 ? 1 : -1, adλ = sdλ * dλ, k = sinφ0 * sinφ;
  28309. var antimeridian = adλ > 3.141592653589793;
  28310. areaRingSum.add(Math.atan2(k * sdλ * Math.sin(adλ), cosφ0 * cosφ + k * Math.cos(adλ)));
  28311. polarAngle += antimeridian ? dλ + sdλ * 6.283185307179586 : dλ;
  28312. if (antimeridian ^ (λ0 >= meridian) ^ (λ >= meridian)) {
  28313. var arc = com_ibm_rave_core_internal_geo_CartesianUtil.cartesianCross(com_ibm_rave_core_internal_geo_CartesianUtil.cartesian((point0)), com_ibm_rave_core_internal_geo_CartesianUtil.cartesian((point)));
  28314. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianNormalize(arc);
  28315. var intersection = com_ibm_rave_core_internal_geo_CartesianUtil.cartesianCross(meridianNormal, arc);
  28316. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianNormalize(intersection);
  28317. var φarc = ((antimeridian ^ (dλ >= 0)) ? -1 : 1) * com_ibm_rave_core_internal_math_Trigonometry.asin(intersection[2]);
  28318. if (parallel > φarc || parallel == φarc && (arc[0] != 0 || arc[1] != 0)) {
  28319. winding += (antimeridian ^ (dλ >= 0)) ? 1 : -1;
  28320. }
  28321. }
  28322. if (j++ == 0) {
  28323. break;
  28324. }
  28325. λ0 = λ;
  28326. sinφ0 = sinφ;
  28327. cosφ0 = cosφ;
  28328. point0 = point;
  28329. }
  28330. }
  28331. return (polarAngle < -1.0E-6 || polarAngle < 1.0E-6 && areaRingSum.valueOf() < 0) ^ ((winding & 1) != 0);
  28332. };
  28333. com_ibm_rave_core_internal_geo_ClipUtil.allVisible = function(x, y, z) {
  28334. return true;
  28335. };
  28336. com_ibm_rave_core_internal_geo_ClipUtil.clipAntimeridianInterpolator = function(from, to, direction, listener) {
  28337. var φ;
  28338. if (!from) {
  28339. φ = direction * 1.5707963267948966;
  28340. listener.point(-3.141592653589793, φ, NaN);
  28341. listener.point(0, φ, NaN);
  28342. listener.point(3.141592653589793, φ, NaN);
  28343. listener.point(3.141592653589793, 0, NaN);
  28344. listener.point(3.141592653589793, -φ, NaN);
  28345. listener.point(0, -φ, NaN);
  28346. listener.point(-3.141592653589793, -φ, NaN);
  28347. listener.point(-3.141592653589793, 0, NaN);
  28348. listener.point(-3.141592653589793, φ, NaN);
  28349. } else if (Math.abs(from[0] - to[0]) > 1.0E-6) {
  28350. var s = from[0] < to[0] ? 3.141592653589793 : -3.141592653589793;
  28351. φ = direction * s / 2;
  28352. listener.point(-s, φ, NaN);
  28353. listener.point(0, φ, NaN);
  28354. listener.point(s, φ, NaN);
  28355. } else {
  28356. listener.point(to[0], to[1], NaN);
  28357. }
  28358. };
  28359. // $source: com/ibm/rave/core/internal/geo/ClipStreamListener
  28360. /************************************************************************
  28361. ** IBM Confidential
  28362. **
  28363. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  28364. **
  28365. ** (C) Copyright IBM Corp. 2015
  28366. **
  28367. ** The source code for this program is not published or otherwise divested of its trade secrets,
  28368. ** irrespective of what has been deposited with the U.S. Copyright Office.
  28369. ************************************************************************/
  28370. // GENERATED
  28371. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  28372. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (loadtime) // superclass
  28373. //@import com/ibm/rave/core/internal/geo/ClipBufferStreamListener (runtime) // new
  28374. //@import com/ibm/rave/core/arrays/Merge (runtime) // merge
  28375. //@import com/ibm/rave/core/internal/geo/ClipUtil (runtime) // pointInPolygon, clipPolygon
  28376. /**
  28377. */
  28378. var com_ibm_rave_core_internal_geo_ClipStreamListener = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_DelegatingStreamListener, {
  28379. //pointVisible : null,
  28380. //clipLine : null,
  28381. //interpolate : null,
  28382. //clipStart : null,
  28383. //rotate : null,
  28384. //listener : null,
  28385. //comparator : null,
  28386. //segments : null,
  28387. //line : null,
  28388. //bufferListener : null,
  28389. //ringListener : null,
  28390. //rotatedClipStart : null,
  28391. //polygon : null,
  28392. //ring : null,
  28393. //clipSegmentLength1 : null,
  28394. polygonStarted : false,
  28395. constructor : function(pointVisible, clipLine, interpolate, clipStart, rotate, listener) {
  28396. var self = this;
  28397. this.pointVisible = pointVisible;
  28398. this.clipLine = clipLine;
  28399. this.interpolate = interpolate;
  28400. this.clipStart = clipStart;
  28401. this.rotate = rotate;
  28402. this.listener = listener;
  28403. this.line = clipLine(listener);
  28404. this.bufferListener = new com_ibm_rave_core_internal_geo_ClipBufferStreamListener();
  28405. this.ringListener = clipLine(this.bufferListener);
  28406. this.rotatedClipStart = ((rotate.invert(clipStart[0], clipStart[1])));
  28407. this.comparator = function(aa, bb) {
  28408. var a = aa.x;
  28409. var b = bb.x;
  28410. var result = ((a[0] < 0 ? a[1] - 1.5707963267948966 - 1.0E-6 : 1.5707963267948966 - a[1]) - (b[0] < 0 ? b[1] - 1.5707963267948966 - 1.0E-6 : 1.5707963267948966 - b[1]));
  28411. return (result == 0) ? 0 : (result > 0) ? 1 : -1;
  28412. };
  28413. this.clipSegmentLength1 = function(segment, index, array) {
  28414. return segment.length > 1;
  28415. };
  28416. var point = function(λ, φ, z) {
  28417. var point = self.rotate(λ, φ);
  28418. if (self.pointVisible(λ = point[0], φ = point[1], NaN)) {
  28419. self.listener.point(λ, φ, NaN);
  28420. }
  28421. };
  28422. var pointLine = function(λ, φ, z) {
  28423. var point = self.rotate(λ, φ);
  28424. self.line.point(point[0], point[1], NaN);
  28425. };
  28426. var pointRing = function(λ, φ, z) {
  28427. self.ring.push([λ, φ]);
  28428. var point = self.rotate(λ, φ);
  28429. self.ringListener.point(point[0], point[1], NaN);
  28430. };
  28431. var lineStart = function() {
  28432. self.pointDelegate = pointLine;
  28433. self.line.lineStart();
  28434. };
  28435. var lineEnd = function() {
  28436. self.pointDelegate = point;
  28437. self.line.lineEnd();
  28438. };
  28439. var ringStart = function() {
  28440. self.ringListener.lineStart();
  28441. self.ring = [];
  28442. };
  28443. var ringEnd = function() {
  28444. pointRing(self.ring[0][0], self.ring[0][1], NaN);
  28445. self.ringListener.lineEnd();
  28446. var clean = self.ringListener.clean();
  28447. var ringSegments = self.bufferListener.buffer();
  28448. var segment;
  28449. var n = ringSegments.length;
  28450. self.ring.pop();
  28451. self.polygon.push(self.ring);
  28452. self.ring = null;
  28453. if (n == 0) {
  28454. return;
  28455. }
  28456. if ((clean & 1) != 0) {
  28457. segment = ringSegments[0];
  28458. n = segment.length - 1;
  28459. var i = -1;
  28460. var point;
  28461. if (n > 0) {
  28462. if (!self.polygonStarted) {
  28463. self.listener.polygonStart();
  28464. self.polygonStarted = true;
  28465. }
  28466. self.listener.lineStart();
  28467. while (++i < n) {
  28468. self.listener.point((point = segment[i])[0], point[1], NaN);
  28469. }
  28470. self.listener.lineEnd();
  28471. }
  28472. return;
  28473. }
  28474. if (n > 1 && ((clean & 2) != 0)) {
  28475. ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
  28476. }
  28477. self.segments.push(ringSegments.filter(self.clipSegmentLength1));
  28478. };
  28479. var polygonStart = function() {
  28480. self.pointDelegate = pointRing;
  28481. self.lineStartDelegate = ringStart;
  28482. self.lineEndDelegate = ringEnd;
  28483. self.segments = [];
  28484. self.polygon = [];
  28485. };
  28486. var polygonEnd = function() {
  28487. self.pointDelegate = point;
  28488. self.lineStartDelegate = lineStart;
  28489. self.lineEndDelegate = lineEnd;
  28490. var mergedSegments = com_ibm_rave_core_arrays_Merge.merge(self.segments);
  28491. var clipStartInside = com_ibm_rave_core_internal_geo_ClipUtil.pointInPolygon(self.rotatedClipStart, self.polygon);
  28492. if (mergedSegments.length > 0) {
  28493. if (!self.polygonStarted) {
  28494. self.listener.polygonStart();
  28495. self.polygonStarted = true;
  28496. }
  28497. com_ibm_rave_core_internal_geo_ClipUtil.clipPolygon(mergedSegments, self.comparator, clipStartInside, self.interpolate, self.listener);
  28498. } else if (clipStartInside) {
  28499. if (!self.polygonStarted) {
  28500. self.listener.polygonStart();
  28501. self.polygonStarted = true;
  28502. }
  28503. self.listener.lineStart();
  28504. self.interpolate(null, null, 1, self.listener);
  28505. self.listener.lineEnd();
  28506. }
  28507. if (self.polygonStarted) {
  28508. self.listener.polygonEnd();
  28509. self.polygonStarted = false;
  28510. }
  28511. mergedSegments = self.polygon = null;
  28512. };
  28513. var sphere = function() {
  28514. self.listener.polygonStart();
  28515. self.listener.lineStart();
  28516. self.interpolate(null, null, 1, self.listener);
  28517. self.listener.lineEnd();
  28518. self.listener.polygonEnd();
  28519. };
  28520. this.pointDelegate = point;
  28521. this.lineStartDelegate = lineStart;
  28522. this.lineEndDelegate = lineEnd;
  28523. this.polygonStartDelegate = polygonStart;
  28524. this.polygonEndDelegate = polygonEnd;
  28525. this.sphereDelegate = sphere;
  28526. }
  28527. });
  28528. // $source: com/ibm/rave/core/internal/geo/CircleClipLineStreamListenerFactory
  28529. /************************************************************************
  28530. ** IBM Confidential
  28531. **
  28532. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  28533. **
  28534. ** (C) Copyright IBM Corp. 2015
  28535. **
  28536. ** The source code for this program is not published or otherwise divested of its trade secrets,
  28537. ** irrespective of what has been deposited with the U.S. Copyright Office.
  28538. ************************************************************************/
  28539. // GENERATED
  28540. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare anonymous, declare
  28541. //@import com/ibm/rave/core/internal/geo/CartesianUtil (runtime) // cartesianDot, cartesianScale, cartesianCross, cartesian, cartesianAdd
  28542. //@import com/ibm/rave/core/internal/geo/SphericalUtil (runtime) // sphericalEqual, spherical
  28543. //@import com/ibm/rave/core/internal/geo/ClipLineStreamListenerFactory (runtime)
  28544. /**
  28545. */
  28546. var com_ibm_rave_core_internal_geo_CircleClipLineStreamListenerFactory = com_ibm_rave_core_nativeImpl_Declare({
  28547. //visible : null,
  28548. //point0 : null,
  28549. radius : 0,
  28550. cr : 0,
  28551. smallRadius : false,
  28552. notHemisphere : false,
  28553. c0 : 0,
  28554. v0 : false,
  28555. v00 : false,
  28556. clean : 0,
  28557. round : 1e+6,
  28558. _$functionClassMethod : function() {
  28559. var _$self = function(listener) {
  28560. var self = _$self;
  28561. return new (com_ibm_rave_core_nativeImpl_Declare({
  28562. sphere : function() {},
  28563. point : function(λ, φ, z) {
  28564. var point1 = [λ, φ], point2;
  28565. var v = self.visible(λ, φ, NaN);
  28566. var c = self.smallRadius ? v ? 0 : self.code(λ, φ) : v ? self.code(λ + (λ < 0 ? 3.141592653589793 : -3.141592653589793), φ) : 0;
  28567. if ((!self.point0) && (self.v00 = self.v0 = v)) {
  28568. listener.lineStart();
  28569. }
  28570. if (v != self.v0) {
  28571. point2 = self.intersect(self.point0, point1, false);
  28572. if (com_ibm_rave_core_internal_geo_SphericalUtil.sphericalEqual((self.point0), (point2)) || com_ibm_rave_core_internal_geo_SphericalUtil.sphericalEqual((point1), (point2))) {
  28573. point1[0] = point1[0] + 1.0E-6;
  28574. point1[1] = point1[1] + 1.0E-6;
  28575. v = self.visible(point1[0], point1[1], NaN);
  28576. }
  28577. }
  28578. if (v != self.v0) {
  28579. self.clean = 0;
  28580. if (v) {
  28581. listener.lineStart();
  28582. point2 = self.intersect(point1, self.point0, false);
  28583. listener.point(point2[0], point2[1], NaN);
  28584. } else {
  28585. point2 = self.intersect(self.point0, point1, false);
  28586. listener.point(point2[0], point2[1], NaN);
  28587. listener.lineEnd();
  28588. }
  28589. self.point0 = point2;
  28590. } else if (self.notHemisphere && (self.point0) && self.smallRadius ^ v) {
  28591. var t;
  28592. if (((c & self.c0) == 0) && ((t = self.intersect(point1, self.point0, true)))) {
  28593. self.clean = 0;
  28594. if (self.smallRadius) {
  28595. listener.lineStart();
  28596. listener.point(t[0][0], t[0][1], NaN);
  28597. listener.point(t[1][0], t[1][1], NaN);
  28598. listener.lineEnd();
  28599. } else {
  28600. listener.point(t[1][0], t[1][1], NaN);
  28601. listener.lineEnd();
  28602. listener.lineStart();
  28603. listener.point(t[0][0], t[0][1], NaN);
  28604. }
  28605. }
  28606. }
  28607. if (v && ((!self.point0) || !(com_ibm_rave_core_internal_geo_SphericalUtil.sphericalEqual((self.point0), (point1))))) {
  28608. listener.point(point1[0], point1[1], NaN);
  28609. }
  28610. self.point0 = point1;
  28611. self.v0 = v;
  28612. self.c0 = c;
  28613. },
  28614. lineStart : function() {
  28615. self.v00 = self.v0 = false;
  28616. self.clean = 1;
  28617. },
  28618. lineEnd : function() {
  28619. if (self.v0) {
  28620. listener.lineEnd();
  28621. }
  28622. self.point0 = null;
  28623. },
  28624. polygonStart : function() {},
  28625. polygonEnd : function() {},
  28626. clean : function() {
  28627. return self.clean | ((self.v00 && self.v0) ? 1 << 1 : 0);
  28628. }
  28629. }))();
  28630. };
  28631. return _$self;
  28632. },
  28633. constructor : function(radius) {
  28634. var self = this;
  28635. this.radius = radius;
  28636. this.cr = Math.cos(radius);
  28637. this.smallRadius = (this.cr > 0);
  28638. this.notHemisphere = Math.abs(this.cr) > 1.0E-6;
  28639. this.visible = function(λ, φ, z) {
  28640. return Math.round(Math.cos(λ) * Math.cos(φ) * self.round) / self.round > Math.round(self.cr * self.round) / self.round;
  28641. };
  28642. },
  28643. /**
  28644. * @return (com.ibm.rave.core.internal.geo.ClipUtil.PointVisiblity) the visible
  28645. */
  28646. getPointVisiblilty : function() {
  28647. return this.visible;
  28648. },
  28649. /**
  28650. * @return (boolean) the smallRadius
  28651. */
  28652. isSmallRadius : function() {
  28653. return this.smallRadius;
  28654. },
  28655. intersect : function(a, b, two) {
  28656. var pa = com_ibm_rave_core_internal_geo_CartesianUtil.cartesian((a)), pb = com_ibm_rave_core_internal_geo_CartesianUtil.cartesian((b));
  28657. var n1 = [1, 0, 0];
  28658. var n2 = com_ibm_rave_core_internal_geo_CartesianUtil.cartesianCross(pa, pb);
  28659. var n2n2 = com_ibm_rave_core_internal_geo_CartesianUtil.cartesianDot(n2, n2);
  28660. var n1n2 = n2[0];
  28661. var determinant = n2n2 - n1n2 * n1n2;
  28662. if (!((determinant))) {
  28663. if (!two) {
  28664. return a;
  28665. } else {
  28666. return null;
  28667. }
  28668. }
  28669. var c1 = this.cr * n2n2 / determinant, c2 = -this.cr * n1n2 / determinant;
  28670. var n1xn2 = com_ibm_rave_core_internal_geo_CartesianUtil.cartesianCross(n1, n2), A = com_ibm_rave_core_internal_geo_CartesianUtil.cartesianScale(n1, c1), B = com_ibm_rave_core_internal_geo_CartesianUtil.cartesianScale(n2, c2);
  28671. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianAdd(A, B);
  28672. var u = n1xn2;
  28673. var w = com_ibm_rave_core_internal_geo_CartesianUtil.cartesianDot(A, u), uu = com_ibm_rave_core_internal_geo_CartesianUtil.cartesianDot(u, u), t2 = w * w - uu * (com_ibm_rave_core_internal_geo_CartesianUtil.cartesianDot(A, A) - 1);
  28674. if (t2 < 0) {
  28675. return null;
  28676. }
  28677. var t = Math.sqrt(t2);
  28678. var q = com_ibm_rave_core_internal_geo_CartesianUtil.cartesianScale(u, (-w - t) / uu);
  28679. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianAdd(q, A);
  28680. q = com_ibm_rave_core_internal_geo_SphericalUtil.spherical(q);
  28681. if (!two) {
  28682. return ((q));
  28683. }
  28684. var λ0 = a[0];
  28685. var λ1 = b[0];
  28686. var φ0 = a[1];
  28687. var φ1 = b[1];
  28688. var z;
  28689. if (λ1 < λ0) {
  28690. z = λ0;
  28691. λ0 = λ1;
  28692. λ1 = z;
  28693. }
  28694. var δλ = λ1 - λ0;
  28695. var polar = Math.abs(δλ - 3.141592653589793) < 1.0E-6;
  28696. var meridian = polar || δλ < 1.0E-6;
  28697. if (!polar && φ1 < φ0) {
  28698. z = φ0;
  28699. φ0 = φ1;
  28700. φ1 = z;
  28701. }
  28702. if (meridian ? polar ? (φ0 + φ1 > 0) ^ (q[1] < (Math.abs(q[0] - λ0) < 1.0E-6 ? φ0 : φ1)) : φ0 <= q[1] && q[1] <= φ1 : (δλ > 3.141592653589793) ^ (λ0 <= q[0] && q[0] <= λ1)) {
  28703. var q1 = com_ibm_rave_core_internal_geo_CartesianUtil.cartesianScale(u, (-w + t) / uu);
  28704. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianAdd(q1, A);
  28705. return [((q)), ((com_ibm_rave_core_internal_geo_SphericalUtil.spherical(q1)))];
  28706. }
  28707. return null;
  28708. },
  28709. code : function(λ, φ) {
  28710. var r = this.smallRadius ? this.radius : 3.141592653589793 - this.radius;
  28711. var code = 0;
  28712. if (λ < -r) {
  28713. code |= 1;
  28714. } else if (λ > r) {
  28715. code |= 2;
  28716. }
  28717. if (φ < -r) {
  28718. code |= 4;
  28719. } else if (φ > r) {
  28720. code |= 8;
  28721. }
  28722. return code;
  28723. }
  28724. });
  28725. // $source: com/ibm/rave/core/internal/geo/SphericalUtil
  28726. /************************************************************************
  28727. ** IBM Confidential
  28728. **
  28729. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  28730. **
  28731. ** (C) Copyright IBM Corp. 2015
  28732. **
  28733. ** The source code for this program is not published or otherwise divested of its trade secrets,
  28734. ** irrespective of what has been deposited with the U.S. Copyright Office.
  28735. ************************************************************************/
  28736. // GENERATED
  28737. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  28738. //@import com/ibm/rave/core/internal/math/Trigonometry (static) // asin
  28739. /**
  28740. * A collection of helper methods operating on point in a spherical plane.
  28741. */
  28742. var com_ibm_rave_core_internal_geo_SphericalUtil = com_ibm_rave_core_nativeImpl_Declare({
  28743. /**
  28744. */
  28745. //constructor : function() {}
  28746. });
  28747. /**
  28748. * Converts a point coordinates from Cartesian plane to spherical plane
  28749. * @param (double[]) cartesian the location in Cartesian plane to convert
  28750. * @return (double[]) the x,y coordinates of the point in spherical plane
  28751. */
  28752. com_ibm_rave_core_internal_geo_SphericalUtil.spherical = function(cartesian) {
  28753. return [Math.atan2(cartesian[1], cartesian[0]), com_ibm_rave_core_internal_math_Trigonometry.asin(cartesian[2])];
  28754. };
  28755. /**
  28756. * Checks if two points in spherical plane are equal. Two points are considered equal as long as the difference between their corresponding x, and y coordinates falls within Trigonometry.ε = 1E-6
  28757. * @param (double[]) a the first point to compare
  28758. * @param (double[]) b the second point to compare
  28759. * @return (boolean) true if they are equal, false otherwise
  28760. */
  28761. com_ibm_rave_core_internal_geo_SphericalUtil.sphericalEqual = function(a, b) {
  28762. return Math.abs(a[0] - b[0]) < 1.0E-6 && Math.abs(a[1] - b[1]) < 1.0E-6;
  28763. };
  28764. /**
  28765. * Calculates the great-arc distance between two points in spherical plane
  28766. * @param (double[]) a the first point
  28767. * @param (double[]) b the second point
  28768. * @return (double) the calculated distance
  28769. */
  28770. com_ibm_rave_core_internal_geo_SphericalUtil.calculateDistance = function(a, b) {
  28771. var Δλ = (b[0] - a[0]) * 0.017453292519943295, φ0 = a[1] * 0.017453292519943295, φ1 = b[1] * 0.017453292519943295, sinΔλ = Math.sin(Δλ), cosΔλ = Math.cos(Δλ), sinφ0 = Math.sin(φ0), cosφ0 = Math.cos(φ0), sinφ1 = Math.sin(φ1), cosφ1 = Math.cos(φ1), t;
  28772. return Math.atan2(Math.sqrt((t = cosφ1 * sinΔλ) * t + (t = cosφ0 * sinφ1 - sinφ0 * cosφ1 * cosΔλ) * t), sinφ0 * sinφ1 + cosφ0 * cosφ1 * cosΔλ);
  28773. };
  28774. // $source: com/ibm/rave/core/internal/geo/GeoShapeGeneratorUtil
  28775. /************************************************************************
  28776. ** IBM Confidential
  28777. **
  28778. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  28779. **
  28780. ** (C) Copyright IBM Corp. 2015
  28781. **
  28782. ** The source code for this program is not published or otherwise divested of its trade secrets,
  28783. ** irrespective of what has been deposited with the U.S. Copyright Office.
  28784. ************************************************************************/
  28785. // GENERATED
  28786. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  28787. //@import com/ibm/rave/core/internal/geo/SphericalUtil (runtime) // spherical
  28788. //@import com/ibm/rave/core/internal/geo/CartesianUtil (static) // cartesianNormalize, cartesian
  28789. //@import com/ibm/rave/core/internal/math/Trigonometry (runtime) // acos
  28790. //@import com/ibm/rave/core/Rave (runtime) // range
  28791. /**
  28792. */
  28793. var com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil = com_ibm_rave_core_nativeImpl_Declare({
  28794. });
  28795. com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.newCircleInterpolator = function(radius, precision) {
  28796. var cr = Math.cos(radius), sr = Math.sin(radius);
  28797. return function(from, to, direction, listener) {
  28798. var fromAngle, toAngle;
  28799. var step = direction * precision;
  28800. if (from) {
  28801. fromAngle = com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.circleAngle(cr, from);
  28802. toAngle = com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.circleAngle(cr, to);
  28803. if ((direction > 0) ? fromAngle < toAngle : fromAngle > toAngle) {
  28804. fromAngle += direction * 6.283185307179586;
  28805. }
  28806. } else {
  28807. fromAngle = radius + direction * 6.283185307179586;
  28808. toAngle = radius - .5 * step;
  28809. }
  28810. var point;
  28811. for (var t = fromAngle; (direction > 0) ? t > toAngle : t < toAngle; t -= step) {
  28812. listener.point((point = com_ibm_rave_core_internal_geo_SphericalUtil.spherical([cr, -sr * Math.cos(t), -sr * Math.sin(t)]))[0], point[1], NaN);
  28813. }
  28814. };
  28815. };
  28816. com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.circleAngle = function(cr, sphericalPoint) {
  28817. var a = com_ibm_rave_core_internal_geo_CartesianUtil.cartesian((sphericalPoint));
  28818. a[0] -= cr;
  28819. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianNormalize(a);
  28820. var angle = com_ibm_rave_core_internal_math_Trigonometry.acos(-a[1]);
  28821. return ((-a[2] < 0 ? -angle : angle) + 2 * 3.141592653589793 - 1.0E-6) % (2 * 3.141592653589793);
  28822. };
  28823. com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.graticuleX = function(y0, y1, dy) {
  28824. var array = com_ibm_rave_core_Rave.range(y0, y1 - 1.0E-6, dy).concat(y1);
  28825. return function(x) {
  28826. return array.map(function(currentValue, index, arr) {
  28827. return [x, + (currentValue)];
  28828. });
  28829. };
  28830. };
  28831. com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.graticuleY = function(x0, x1, dx) {
  28832. var array = com_ibm_rave_core_Rave.range(x0, x1 - 1.0E-6, dx).concat(x1);
  28833. return function(y) {
  28834. return array.map(function(currentValue, index, arr) {
  28835. return [+ (currentValue), y];
  28836. });
  28837. };
  28838. };
  28839. // $source: com/ibm/rave/core/internal/geo/AntimeridianClipLineStreamListenerFactory
  28840. /************************************************************************
  28841. ** IBM Confidential
  28842. **
  28843. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  28844. **
  28845. ** (C) Copyright IBM Corp. 2015
  28846. **
  28847. ** The source code for this program is not published or otherwise divested of its trade secrets,
  28848. ** irrespective of what has been deposited with the U.S. Copyright Office.
  28849. ************************************************************************/
  28850. // GENERATED
  28851. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  28852. /**
  28853. */
  28854. var com_ibm_rave_core_internal_geo_AntimeridianClipLineStreamListenerFactory = com_ibm_rave_core_nativeImpl_Declare({
  28855. λ0 : 0, φ0 : 0, sλ0 : 0,
  28856. clean : 0,
  28857. _$functionClassMethod : function() {
  28858. var _$self = function(listener) {
  28859. _$self.λ0 = _$self.φ0 = _$self.sλ0 = NaN;
  28860. _$self.clean = 0;
  28861. return new com_ibm_rave_core_internal_geo_AntimeridianClipLineStreamListenerFactory.AntimeridianClipLineStreamListener(_$self, listener);
  28862. };
  28863. return _$self;
  28864. }
  28865. });
  28866. com_ibm_rave_core_internal_geo_AntimeridianClipLineStreamListenerFactory.clipAntimeridianIntersect = function(λ0, φ0, λ1, φ1) {
  28867. var cosφ0, cosφ1, sinλ0_λ1 = Math.sin(λ0 - λ1);
  28868. return Math.abs(sinλ0_λ1) > 1.0E-6 ? Math.atan((Math.sin(φ0) * (cosφ1 = Math.cos(φ1)) * Math.sin(λ1) - Math.sin(φ1) * (cosφ0 = Math.cos(φ0)) * Math.sin(λ0)) / (cosφ0 * cosφ1 * sinλ0_λ1)) : (φ0 + φ1) / 2;
  28869. };
  28870. com_ibm_rave_core_internal_geo_AntimeridianClipLineStreamListenerFactory.AntimeridianClipLineStreamListener = com_ibm_rave_core_nativeImpl_Declare({
  28871. //listener : null,
  28872. //self : null,
  28873. constructor : function(_self, _listener) {
  28874. this.self = _self;
  28875. this.listener = _listener;
  28876. },
  28877. /** @expose */
  28878. sphere : function() {},
  28879. /** @expose */
  28880. point : function(λ1, φ1, z) {
  28881. var sλ1 = λ1 > 0 ? 3.141592653589793 : -3.141592653589793, dλ = Math.abs(λ1 - this.self.λ0);
  28882. if (Math.abs(dλ - 3.141592653589793) < 1.0E-6) {
  28883. this.listener.point(this.self.λ0, this.self.φ0 = (this.self.φ0 + φ1) / 2 > 0 ? 1.5707963267948966 : -1.5707963267948966, NaN);
  28884. this.listener.point(this.self.sλ0, this.self.φ0, NaN);
  28885. this.listener.lineEnd();
  28886. this.listener.lineStart();
  28887. this.listener.point(sλ1, this.self.φ0, NaN);
  28888. this.listener.point(λ1, this.self.φ0, NaN);
  28889. this.self.clean = 0;
  28890. } else if (this.self.sλ0 != sλ1 && dλ >= 3.141592653589793) {
  28891. if (Math.abs(this.self.λ0 - this.self.sλ0) < 1.0E-6) {
  28892. this.self.λ0 -= this.self.sλ0 * 1.0E-6;
  28893. }
  28894. if (Math.abs(λ1 - sλ1) < 1.0E-6) {
  28895. λ1 -= sλ1 * 1.0E-6;
  28896. }
  28897. this.self.φ0 = com_ibm_rave_core_internal_geo_AntimeridianClipLineStreamListenerFactory.clipAntimeridianIntersect(this.self.λ0, this.self.φ0, λ1, φ1);
  28898. this.listener.point(this.self.sλ0, this.self.φ0, NaN);
  28899. this.listener.lineEnd();
  28900. this.listener.lineStart();
  28901. this.listener.point(sλ1, this.self.φ0, NaN);
  28902. this.self.clean = 0;
  28903. }
  28904. this.listener.point(this.self.λ0 = λ1, this.self.φ0 = φ1, NaN);
  28905. this.self.sλ0 = sλ1;
  28906. },
  28907. /** @expose */
  28908. lineStart : function() {
  28909. this.listener.lineStart();
  28910. this.self.clean = 1;
  28911. },
  28912. /** @expose */
  28913. lineEnd : function() {
  28914. this.listener.lineEnd();
  28915. this.self.λ0 = this.self.φ0 = NaN;
  28916. },
  28917. /** @expose */
  28918. polygonStart : function() {},
  28919. /** @expose */
  28920. polygonEnd : function() {},
  28921. clean : function() {
  28922. return 2 - this.self.clean;
  28923. }
  28924. });
  28925. // $source: com/ibm/rave/core/internal/geo/ClipPolygonIntersection
  28926. /************************************************************************
  28927. ** IBM Confidential
  28928. **
  28929. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  28930. **
  28931. ** (C) Copyright IBM Corp. 2015
  28932. **
  28933. ** The source code for this program is not published or otherwise divested of its trade secrets,
  28934. ** irrespective of what has been deposited with the U.S. Copyright Office.
  28935. ************************************************************************/
  28936. // GENERATED
  28937. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  28938. /**
  28939. */
  28940. var com_ibm_rave_core_internal_geo_ClipPolygonIntersection = com_ibm_rave_core_nativeImpl_Declare({
  28941. //x : null,
  28942. //z : null,
  28943. //o : null,
  28944. //n : null,
  28945. //p : null,
  28946. v : false,
  28947. e : false,
  28948. constructor : function(point, points, other, entry) {
  28949. this.x = point;
  28950. this.z = points;
  28951. this.o = other;
  28952. this.e = entry;
  28953. this.v = false;
  28954. },
  28955. /**
  28956. * @return (boolean) the v
  28957. */
  28958. isVisited : function() {
  28959. return this.v;
  28960. },
  28961. /**
  28962. * @param (boolean) v the v to set
  28963. */
  28964. setVisited : function(v) {
  28965. this.v = v;
  28966. },
  28967. /**
  28968. * @return (Array) the x
  28969. */
  28970. getPoint : function() {
  28971. return this.x;
  28972. },
  28973. /**
  28974. * @param (Array) x the x to set
  28975. */
  28976. setPoint : function(x) {
  28977. this.x = x;
  28978. },
  28979. /**
  28980. * @return (Array) the z
  28981. */
  28982. getPoints : function() {
  28983. return this.z;
  28984. },
  28985. /**
  28986. * @param (Array) z the z to set
  28987. */
  28988. setPoints : function(z) {
  28989. this.z = z;
  28990. },
  28991. /**
  28992. * @return (com.ibm.rave.core.internal.geo.ClipPolygonIntersection) the o
  28993. */
  28994. getOtherIntersection : function() {
  28995. return this.o;
  28996. },
  28997. /**
  28998. * @param (com.ibm.rave.core.internal.geo.ClipPolygonIntersection) o the o to set
  28999. */
  29000. setOtherIntersection : function(o) {
  29001. this.o = o;
  29002. },
  29003. /**
  29004. * @return (boolean) the e
  29005. */
  29006. isEntry : function() {
  29007. return this.e;
  29008. },
  29009. /**
  29010. * @param (boolean) e the e to set
  29011. */
  29012. setEntry : function(e) {
  29013. this.e = e;
  29014. },
  29015. /**
  29016. * @return (com.ibm.rave.core.internal.geo.ClipPolygonIntersection) the n
  29017. */
  29018. getNext : function() {
  29019. return this.n;
  29020. },
  29021. /**
  29022. * @param (com.ibm.rave.core.internal.geo.ClipPolygonIntersection) n the n to set
  29023. */
  29024. setNext : function(n) {
  29025. this.n = n;
  29026. },
  29027. /**
  29028. * @return (com.ibm.rave.core.internal.geo.ClipPolygonIntersection) the p
  29029. */
  29030. getPrevious : function() {
  29031. return this.p;
  29032. },
  29033. /**
  29034. * @param (com.ibm.rave.core.internal.geo.ClipPolygonIntersection) p the p to set
  29035. */
  29036. setPrevious : function(p) {
  29037. this.p = p;
  29038. }
  29039. });
  29040. // $source: com/ibm/rave/core/internal/math/Adder
  29041. /************************************************************************
  29042. ** IBM Confidential
  29043. **
  29044. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  29045. **
  29046. ** (C) Copyright IBM Corp. 2015
  29047. **
  29048. ** The source code for this program is not published or otherwise divested of its trade secrets,
  29049. ** irrespective of what has been deposited with the U.S. Copyright Office.
  29050. ************************************************************************/
  29051. // GENERATED
  29052. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  29053. /**
  29054. * Adds floating point numbers with twice the normal precision. Reference: J. R. Shewchuk, Adaptive Precision Floating-Point Arithmetic and Fast Robust Geometric Predicates, Discrete & Computational Geometry 18(3) 305–363 (1997). Code adapted from GeographicLib by Charles F. F. Karney, http://geographiclib.sourceforge.net/ See lib/geographiclib/LICENSE for details.
  29055. */
  29056. var com_ibm_rave_core_internal_math_Adder = com_ibm_rave_core_nativeImpl_Declare({
  29057. s : 0,
  29058. t : 0,
  29059. /**
  29060. * Adds the passed value to the exisiting value of this adder.
  29061. * @param (double) y the double value to add
  29062. */
  29063. add : function(y) {
  29064. var s_temp, t_temp;
  29065. var x = s_temp = y + this.t;
  29066. var bv = x - y, av = x - bv;
  29067. t_temp = y - av + (this.t - bv);
  29068. var s_temp2 = this.s;
  29069. x = this.s = s_temp + s_temp2;
  29070. bv = x - s_temp;
  29071. av = x - bv;
  29072. this.t = s_temp - av + (s_temp2 - bv);
  29073. if (this.s != 0) {
  29074. this.t += t_temp;
  29075. } else {
  29076. this.s = t_temp;
  29077. }
  29078. },
  29079. /**
  29080. * Resets the value of this Adder to zero so that it could be reused to sum up a different group of numbers
  29081. */
  29082. reset : function() {
  29083. this.s = this.t = 0;
  29084. },
  29085. /**
  29086. * Returns the final sum of all double values passed to this adder
  29087. * @return (double) The final sum
  29088. */
  29089. valueOf : function() {
  29090. return this.s;
  29091. }
  29092. });
  29093. // $source: com/ibm/rave/core/internal/geo/SphericalRotation
  29094. /************************************************************************
  29095. ** IBM Confidential
  29096. **
  29097. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  29098. **
  29099. ** (C) Copyright IBM Corp. 2015
  29100. **
  29101. ** The source code for this program is not published or otherwise divested of its trade secrets,
  29102. ** irrespective of what has been deposited with the U.S. Copyright Office.
  29103. ************************************************************************/
  29104. // GENERATED
  29105. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  29106. //@import com/ibm/rave/core/internal/math/Trigonometry (runtime) // asin
  29107. /**
  29108. */
  29109. var com_ibm_rave_core_internal_geo_SphericalRotation = com_ibm_rave_core_nativeImpl_Declare({
  29110. /**
  29111. */
  29112. //constructor : function() {}
  29113. });
  29114. /**
  29115. * Specifies a rotation in the form of an array, [λ, φ, γ]. The elements of the array are angles in degrees, and specify a rotation in the following order: longitudinal, latitudinal and about the origin. If the last element of the array, γ, is omitted, this defaults to 0. Returns a rotator function object, which rotates a given location in the same otr reverse order.
  29116. * @param (double[]) location the location to rotate
  29117. * @return (com.ibm.rave.core.geo.SphericalRotator) the rotator
  29118. * @see (com.ibm.rave.core.geo.SphericalRotator) SphericalRotator
  29119. */
  29120. com_ibm_rave_core_internal_geo_SphericalRotation.newRotator = function(location) {
  29121. var rfo = com_ibm_rave_core_internal_geo_SphericalRotation.rotation(location[0] % 360 * 0.017453292519943295, location[1] * 0.017453292519943295, location.length > 2 ? location[2] * 0.017453292519943295 : 0);
  29122. var rotation = new com_ibm_rave_core_internal_geo_SphericalRotation.SphericalRotatorImpl();
  29123. rotation.pointProjection = rfo;
  29124. return rotation;
  29125. };
  29126. com_ibm_rave_core_internal_geo_SphericalRotation.compose = function(a, b) {
  29127. var obj;
  29128. if (a.invert && b.invert) {
  29129. obj = new com_ibm_rave_core_internal_geo_SphericalRotation.ComposedInvertiblePointProjector();
  29130. } else {
  29131. obj = new com_ibm_rave_core_internal_geo_SphericalRotation.ComposedPointProjection();
  29132. }
  29133. obj.init(a, b);
  29134. return obj;
  29135. };
  29136. com_ibm_rave_core_internal_geo_SphericalRotation.rotation = function(δλ, δφ, δγ) {
  29137. return ((δλ)) ? (((δφ) || (δγ)) ? com_ibm_rave_core_internal_geo_SphericalRotation.compose(com_ibm_rave_core_internal_geo_SphericalRotation.rotationλ(δλ), com_ibm_rave_core_internal_geo_SphericalRotation.rotationφγ(δφ, δγ)) : com_ibm_rave_core_internal_geo_SphericalRotation.rotationλ(δλ)) : (((δφ) || (δγ)) ? com_ibm_rave_core_internal_geo_SphericalRotation.rotationφγ(δφ, δγ) : com_ibm_rave_core_internal_geo_SphericalRotation.identityRotation);
  29138. };
  29139. com_ibm_rave_core_internal_geo_SphericalRotation.rotationλ = function(δλ) {
  29140. var obj = new com_ibm_rave_core_internal_geo_SphericalRotation.PointProjectionλ();
  29141. obj.δλ = δλ;
  29142. return obj;
  29143. };
  29144. com_ibm_rave_core_internal_geo_SphericalRotation.rotationφγ = function(δφ, δγ) {
  29145. var cosδφ = Math.cos(δφ), sinδφ = Math.sin(δφ), cosδγ = Math.cos(δγ), sinδγ = Math.sin(δγ);
  29146. var obj = new com_ibm_rave_core_internal_geo_SphericalRotation.PointProjectionφγ();
  29147. obj.init(cosδφ, sinδφ, cosδγ, sinδγ);
  29148. return obj;
  29149. };
  29150. com_ibm_rave_core_internal_geo_SphericalRotation.SphericalRotatorImpl = com_ibm_rave_core_nativeImpl_Declare({
  29151. //pointProjection : null,
  29152. _$functionClassMethod : function() {
  29153. var _$self = function(coordinates) {
  29154. coordinates = _$self.pointProjection(coordinates[0] * 0.017453292519943295, coordinates[1] * 0.017453292519943295);
  29155. coordinates[0] *= 57.29577951308232;
  29156. coordinates[1] *= 57.29577951308232;
  29157. return coordinates;
  29158. };
  29159. return _$self;
  29160. },
  29161. init : function(pointProjection) {
  29162. this.pointProjection = pointProjection;
  29163. },
  29164. /** @expose */
  29165. invert : function(coordinates) {
  29166. coordinates = this.pointProjection.invert(coordinates[0] * 0.017453292519943295, coordinates[1] * 0.017453292519943295);
  29167. coordinates[0] *= 57.29577951308232;
  29168. coordinates[1] *= 57.29577951308232;
  29169. return coordinates;
  29170. }
  29171. });
  29172. com_ibm_rave_core_internal_geo_SphericalRotation.IdentityPointProjection = com_ibm_rave_core_nativeImpl_Declare({
  29173. _$functionClassMethod : function() {
  29174. var _$self = function(λ, φ) {
  29175. return [λ > 3.141592653589793 ? λ - 6.283185307179586 : λ < -3.141592653589793 ? λ + 6.283185307179586 : λ, φ];
  29176. };
  29177. return _$self;
  29178. },
  29179. /** @expose */
  29180. invert : function(λ, φ) {
  29181. return [λ, φ];
  29182. },
  29183. /** @expose */
  29184. supportInversion : function() {
  29185. return true;
  29186. }
  29187. });
  29188. com_ibm_rave_core_internal_geo_SphericalRotation.ComposedPointProjection = com_ibm_rave_core_nativeImpl_Declare({
  29189. //a : null,
  29190. //b : null,
  29191. _$functionClassMethod : function() {
  29192. var _$self = function(λ, φ) {
  29193. var x = _$self.a(λ, φ);
  29194. return _$self.b(x[0], x[1]);
  29195. };
  29196. return _$self;
  29197. },
  29198. /**
  29199. * @param (com.ibm.rave.core.geo.PointProjector) a
  29200. * @param (com.ibm.rave.core.geo.PointProjector) b
  29201. */
  29202. init : function(a, b) {
  29203. this.a = a;
  29204. this.b = b;
  29205. },
  29206. /** @expose */
  29207. supportInversion : function() {
  29208. return false;
  29209. }
  29210. });
  29211. com_ibm_rave_core_internal_geo_SphericalRotation.ComposedInvertiblePointProjector = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_SphericalRotation.ComposedPointProjection, {
  29212. /** @expose */
  29213. invert : function(λ, φ) {
  29214. var x = (this.b).invert(λ, φ);
  29215. if (x) {
  29216. return (this.a).invert(x[0], x[1]);
  29217. }
  29218. return null;
  29219. },
  29220. /** @expose */
  29221. supportInversion : function() {
  29222. return true;
  29223. }
  29224. });
  29225. com_ibm_rave_core_internal_geo_SphericalRotation.PointProjectionλ = com_ibm_rave_core_nativeImpl_Declare({
  29226. δλ : 0,
  29227. _$functionClassMethod : function() {
  29228. var _$self = function(λ, φ) {
  29229. λ += _$self.δλ;
  29230. return [λ > 3.141592653589793 ? λ - 6.283185307179586 : λ < -3.141592653589793 ? λ + 6.283185307179586 : λ, φ];
  29231. };
  29232. return _$self;
  29233. },
  29234. init : function(δλ) {
  29235. this.δλ = δλ;
  29236. },
  29237. /** @expose */
  29238. invert : function(λ, φ) {
  29239. λ -= this.δλ;
  29240. return [λ > 3.141592653589793 ? λ - 6.283185307179586 : λ < -3.141592653589793 ? λ + 6.283185307179586 : λ, φ];
  29241. },
  29242. /** @expose */
  29243. supportInversion : function() {
  29244. return true;
  29245. }
  29246. });
  29247. com_ibm_rave_core_internal_geo_SphericalRotation.PointProjectionφγ = com_ibm_rave_core_nativeImpl_Declare({
  29248. cosδφ : 0, sinδφ : 0, cosδγ : 0, sinδγ : 0,
  29249. _$functionClassMethod : function() {
  29250. var _$self = function(λ, φ) {
  29251. var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * _$self.cosδφ + x * _$self.sinδφ;
  29252. return [Math.atan2(y * _$self.cosδγ - k * _$self.sinδγ, x * _$self.cosδφ - z * _$self.sinδφ), com_ibm_rave_core_internal_math_Trigonometry.asin(k * _$self.cosδγ + y * _$self.sinδγ)];
  29253. };
  29254. return _$self;
  29255. },
  29256. init : function(cosδφ, sinδφ, cosδγ, sinδγ) {
  29257. this.cosδφ = cosδφ;
  29258. this.sinδφ = sinδφ;
  29259. this.cosδγ = cosδγ;
  29260. this.sinδγ = sinδγ;
  29261. },
  29262. /** @expose */
  29263. invert : function(λ, φ) {
  29264. var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * this.cosδγ - y * this.sinδγ;
  29265. return [Math.atan2(y * this.cosδγ + z * this.sinδγ, x * this.cosδφ + k * this.sinδφ), com_ibm_rave_core_internal_math_Trigonometry.asin(k * this.cosδφ - x * this.sinδφ)];
  29266. },
  29267. /** @expose */
  29268. supportInversion : function() {
  29269. return true;
  29270. }
  29271. });
  29272. com_ibm_rave_core_internal_geo_SphericalRotation.identityRotation = new com_ibm_rave_core_internal_geo_SphericalRotation.IdentityPointProjection();
  29273. // $source: com/ibm/rave/core/geo/TransformStreamListenerFactory
  29274. /************************************************************************
  29275. ** IBM Confidential
  29276. **
  29277. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  29278. **
  29279. ** (C) Copyright IBM Corp. 2015
  29280. **
  29281. ** The source code for this program is not published or otherwise divested of its trade secrets,
  29282. ** irrespective of what has been deposited with the U.S. Copyright Office.
  29283. ************************************************************************/
  29284. // GENERATED
  29285. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  29286. //@import com/ibm/rave/core/internal/geo/TransformStreamListenerImpl (static) // new
  29287. /**
  29288. * A factory used to create TransformStreamListeners
  29289. */
  29290. var com_ibm_rave_core_geo_TransformStreamListenerFactory = com_ibm_rave_core_nativeImpl_Declare({
  29291. //delegates : null,
  29292. constructor : function(delegates) {
  29293. this.delegates = delegates;
  29294. },
  29295. /**
  29296. * Creates a new TransformStreamListener that wraps the passed listener. The factory uses the stream state handlers map passed to it when it got constructed and passes them to each TransformStreamListener it creates
  29297. * @param (com.ibm.rave.core.geo.StreamListener) listener the listener to wrap
  29298. * @return (com.ibm.rave.core.geo.TransformStreamListener) the newly created TransformStreamListener
  29299. */
  29300. /** @expose */
  29301. stream : function(listener) {
  29302. return new com_ibm_rave_core_internal_geo_TransformStreamListenerImpl(listener, this.delegates);
  29303. }
  29304. });
  29305. /**
  29306. * Factory method to create a TransformStreamListenerFactory. It creates a new stream transform factory using the specified map of stream state delegate handlers. The map may contain implementations of any of the standard stream listener delegate function classes: StreamStateHandler for sphere, lineStart, lineEnd, polygonStart and polygonEnd, and StreamPointStateHandler for point. Each entry in the map should use a specific key as that represent the event to be handled, these keys are declared as constants on TransformStreamListener class. For example, a sphere handler's entry should be keyed with TransformStreamListener.sphereHandler value and so on. Any method that is not present in the specified map will be implemented as a pass-through directly to the wrapped stream listener.
  29307. * @param (Object) delegates a map of standard stream state handlers to delegate to
  29308. * @return (com.ibm.rave.core.geo.TransformStreamListenerFactory) the newly created TransformStreamListenerFactory object
  29309. */
  29310. /** @expose */
  29311. com_ibm_rave_core_geo_TransformStreamListenerFactory.create = function(delegates) {
  29312. return new com_ibm_rave_core_geo_TransformStreamListenerFactory(delegates);
  29313. };
  29314. /**
  29315. * A convenience method to create a TransformStreamListeners that is only interested in transforming point geometry events.
  29316. * @param (com.ibm.rave.core.geo.StreamListener) listener the listener to wrap
  29317. * @param (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamPointStateHandler) handler the point state handler
  29318. * @return (com.ibm.rave.core.geo.TransformStreamListener) the newly created TransformStreamListener
  29319. */
  29320. /** @expose */
  29321. com_ibm_rave_core_geo_TransformStreamListenerFactory.transformPoint = function(listener, handler) {
  29322. var delegates = {};
  29323. delegates["point"] = handler;
  29324. return new com_ibm_rave_core_internal_geo_TransformStreamListenerImpl(listener, delegates);
  29325. };
  29326. // $source: com/ibm/rave/core/internal/geo/ProjectionMutatorImpl
  29327. /************************************************************************
  29328. ** IBM Confidential
  29329. **
  29330. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  29331. **
  29332. ** (C) Copyright IBM Corp. 2015
  29333. **
  29334. ** The source code for this program is not published or otherwise divested of its trade secrets,
  29335. ** irrespective of what has been deposited with the U.S. Copyright Office.
  29336. ************************************************************************/
  29337. // GENERATED
  29338. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  29339. //@import com/ibm/rave/core/internal/geo/InvertibleProjectionImpl (runtime) // new
  29340. //@import com/ibm/rave/core/internal/geo/ProjectionImpl (runtime) // new
  29341. /**
  29342. */
  29343. var com_ibm_rave_core_internal_geo_ProjectionMutatorImpl = com_ibm_rave_core_nativeImpl_Declare({
  29344. //factory : null,
  29345. //projection : null,
  29346. _$functionClassMethod : function() {
  29347. var _$self = function(args) {
  29348. if (args !== null || arguments.length > 1){
  29349. args = Array.prototype.slice.call(arguments);
  29350. }
  29351. {
  29352. var projector = _$self.factory.apply(_$self.factory, args);
  29353. if (!_$self.projection) {
  29354. if (projector.invert) {
  29355. _$self.projection = new com_ibm_rave_core_internal_geo_InvertibleProjectionImpl();
  29356. } else {
  29357. _$self.projection = new com_ibm_rave_core_internal_geo_ProjectionImpl();
  29358. }
  29359. }
  29360. return com_ibm_rave_core_internal_geo_ProjectionMutatorImpl.internalMutate(_$self.projection, projector);
  29361. }
  29362. };
  29363. return _$self;
  29364. },
  29365. constructor : function(factory) {
  29366. this.factory = factory;
  29367. }
  29368. });
  29369. com_ibm_rave_core_internal_geo_ProjectionMutatorImpl.internalMutate = function(projection, projector) {
  29370. projection.pointProjector = projector;
  29371. return projection.reset();
  29372. };
  29373. com_ibm_rave_core_internal_geo_ProjectionMutatorImpl.newProjectionMutator = function(factory) {
  29374. return new com_ibm_rave_core_internal_geo_ProjectionMutatorImpl(factory);
  29375. };
  29376. // $source: com/ibm/rave/core/internal/geo/ProjectionImpl
  29377. /************************************************************************
  29378. ** IBM Confidential
  29379. **
  29380. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  29381. **
  29382. ** (C) Copyright IBM Corp. 2015
  29383. **
  29384. ** The source code for this program is not published or otherwise divested of its trade secrets,
  29385. ** irrespective of what has been deposited with the U.S. Copyright Office.
  29386. ************************************************************************/
  29387. // GENERATED
  29388. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, bind
  29389. //@import com/ibm/rave/core/internal/geo/ResampleStreamListenerFactory (runtime) // new
  29390. //@import com/ibm/rave/core/internal/geo/ClipUtil (runtime) // newClipCircleStreamListenerFactory, newClipExtentStreamListenerFactory, newAntimeridianClipLineStreamListenerFactory
  29391. //@import com/ibm/rave/core/internal/geo/SphericalRotation (runtime) // compose, rotation
  29392. //@import com/ibm/rave/core/geo/TransformStreamListenerFactory (static) // transformPoint
  29393. //@import com/ibm/rave/core/internal/geo/ProjectionMutatorImpl (static) // newProjectionMutator
  29394. /**
  29395. */
  29396. var com_ibm_rave_core_internal_geo_ProjectionImpl = com_ibm_rave_core_nativeImpl_Declare({
  29397. //clipAngleValue : null,
  29398. //clipExtentValue : null,
  29399. //pointProjector : null,
  29400. //rotator : null,
  29401. //projectResample : null,
  29402. //preclip : null,
  29403. //postclip : null,
  29404. //streamListener : null,
  29405. //projectRotate : null,
  29406. x : 480, y : 250, λ : 0, φ : 0, δλ : 0, δφ : 0, δγ : 0,
  29407. k : 150, δx : 0, δy : 0,
  29408. _$functionClassMethod : function() {
  29409. var _$self = function(point) {
  29410. var p = _$self.projectRotate(point[0] * 0.017453292519943295, point[1] * 0.017453292519943295);
  29411. return [p[0] * _$self.k + _$self.δx, _$self.δy - p[1] * _$self.k];
  29412. };
  29413. return _$self;
  29414. },
  29415. constructor : function() {
  29416. var self = this;
  29417. this.projectResample = new com_ibm_rave_core_internal_geo_ResampleStreamListenerFactory(function(x, y, z) {
  29418. var result = self.pointProjector(x, y);
  29419. return [result[0] * self.k + self.δx, self.δy - result[1] * self.k];
  29420. });
  29421. this.preclip = com_ibm_rave_core_internal_geo_ClipUtil.newAntimeridianClipLineStreamListenerFactory();
  29422. },
  29423. /** @expose */
  29424. supportInversion : function() {
  29425. return false;
  29426. },
  29427. /** @expose */
  29428. supportStreaming : function() {
  29429. return true;
  29430. },
  29431. rotate$0 : function() {
  29432. return [this.δλ * 57.29577951308232, this.δφ * 57.29577951308232, this.δγ * 57.29577951308232];
  29433. },
  29434. rotate$1 : function(rotation) {
  29435. this.δλ = rotation[0] % 360 * 0.017453292519943295;
  29436. this.δφ = rotation[1] % 360 * 0.017453292519943295;
  29437. this.δγ = rotation.length > 2 ? rotation[2] % 360 * 0.017453292519943295 : 0;
  29438. return this.reset();
  29439. },
  29440. center$0 : function() {
  29441. return [this.λ * 57.29577951308232, this.φ * 57.29577951308232];
  29442. },
  29443. center$1 : function(c) {
  29444. this.λ = c[0] % 360 * 0.017453292519943295;
  29445. this.φ = c[1] % 360 * 0.017453292519943295;
  29446. return this.reset();
  29447. },
  29448. translate$0 : function() {
  29449. return [this.x, this.y];
  29450. },
  29451. translate$1 : function(t) {
  29452. this.x = + (t[0]);
  29453. this.y = + (t[1]);
  29454. return this.reset();
  29455. },
  29456. scale$0 : function() {
  29457. return this.k;
  29458. },
  29459. scale$1 : function(s) {
  29460. this.k = + (s);
  29461. return this.reset();
  29462. },
  29463. clipAngle$0 : function() {
  29464. return this.clipAngleValue;
  29465. },
  29466. clipAngle$1 : function(a) {
  29467. if (a == null) {
  29468. this.clipAngleValue = null;
  29469. this.preclip = com_ibm_rave_core_internal_geo_ClipUtil.newAntimeridianClipLineStreamListenerFactory();
  29470. } else {
  29471. this.preclip = com_ibm_rave_core_internal_geo_ClipUtil.newClipCircleStreamListenerFactory((this.clipAngleValue = + (a)) * 0.017453292519943295);
  29472. }
  29473. return this.invalidate();
  29474. },
  29475. clipExtent$0 : function() {
  29476. return this.clipExtentValue;
  29477. },
  29478. clipExtent$1 : function(e) {
  29479. this.clipExtentValue = e;
  29480. if (e) {
  29481. this.postclip = com_ibm_rave_core_internal_geo_ClipUtil.newClipExtentStreamListenerFactory(e[0][0], e[0][1], e[1][0], e[1][1]);
  29482. } else {
  29483. this.postclip = null;
  29484. }
  29485. return this.invalidate();
  29486. },
  29487. precision$0 : function() {
  29488. return this.projectResample.precision$1();
  29489. },
  29490. precision$1 : function(p) {
  29491. this.projectResample.precision$0(p);
  29492. return this;
  29493. },
  29494. /** @expose */
  29495. stream : com_ibm_rave_core_nativeImpl_Declare.bind(function(listener) {
  29496. if (this.streamListener) {
  29497. this.streamListener.valid = false;
  29498. }
  29499. this.streamListener = com_ibm_rave_core_internal_geo_ProjectionImpl.projectionRadians(this.preclip(this.rotator, this.projectResample(this.postclip ? this.postclip(listener) : listener)));
  29500. this.streamListener.valid = true;
  29501. return this.streamListener;
  29502. }),
  29503. /**
  29504. * @return (com.ibm.rave.core.geo.PointProjector) the project
  29505. */
  29506. getPointProjector : function() {
  29507. return this.pointProjector;
  29508. },
  29509. /**
  29510. * @param (com.ibm.rave.core.geo.PointProjector) project the project to set
  29511. */
  29512. setPointProjector : function(project) {
  29513. this.pointProjector = project;
  29514. },
  29515. reset : function() {
  29516. this.projectRotate = com_ibm_rave_core_internal_geo_SphericalRotation.compose(this.rotator = com_ibm_rave_core_internal_geo_SphericalRotation.rotation(this.δλ, this.δφ, this.δγ), this.pointProjector);
  29517. var center = this.pointProjector(this.λ, this.φ);
  29518. this.δx = this.x - center[0] * this.k;
  29519. this.δy = this.y + center[1] * this.k;
  29520. return this.invalidate();
  29521. },
  29522. invalidate : function() {
  29523. if (this.streamListener) {
  29524. this.streamListener.valid = false;
  29525. this.streamListener = null;
  29526. }
  29527. return this;
  29528. },
  29529. /** @expose */
  29530. rotate : function(a0) {
  29531. var args = arguments;
  29532. if (args.length == 0) {
  29533. return this.rotate$0();
  29534. }
  29535. return this.rotate$1(a0);
  29536. },
  29537. /** @expose */
  29538. center : function(a0) {
  29539. var args = arguments;
  29540. if (args.length == 0) {
  29541. return this.center$0();
  29542. }
  29543. return this.center$1(a0);
  29544. },
  29545. /** @expose */
  29546. translate : function(a0) {
  29547. var args = arguments;
  29548. if (args.length == 0) {
  29549. return this.translate$0();
  29550. }
  29551. return this.translate$1(a0);
  29552. },
  29553. /** @expose */
  29554. scale : function(a0) {
  29555. var args = arguments;
  29556. if (args.length == 0) {
  29557. return this.scale$0();
  29558. }
  29559. return this.scale$1(a0);
  29560. },
  29561. /** @expose */
  29562. clipAngle : function(a0) {
  29563. var args = arguments;
  29564. if (args.length == 0) {
  29565. return this.clipAngle$0();
  29566. }
  29567. return this.clipAngle$1(a0);
  29568. },
  29569. /** @expose */
  29570. clipExtent : function(a0) {
  29571. var args = arguments;
  29572. if (args.length == 0) {
  29573. return this.clipExtent$0();
  29574. }
  29575. return this.clipExtent$1(a0);
  29576. },
  29577. /** @expose */
  29578. precision : function(a0) {
  29579. var args = arguments;
  29580. if (args.length == 0) {
  29581. return this.precision$0();
  29582. }
  29583. return this.precision$1(a0);
  29584. }
  29585. });
  29586. com_ibm_rave_core_internal_geo_ProjectionImpl.projectionRadians = function(stream) {
  29587. return com_ibm_rave_core_geo_TransformStreamListenerFactory.transformPoint(stream, function(x, y, z) {
  29588. stream.point(x * 0.017453292519943295, y * 0.017453292519943295, NaN);
  29589. });
  29590. };
  29591. com_ibm_rave_core_internal_geo_ProjectionImpl.newProjection = function(projetor) {
  29592. return com_ibm_rave_core_internal_geo_ProjectionMutatorImpl.newProjectionMutator(function(args) {
  29593. if (args !== null || arguments.length > 1){
  29594. args = Array.prototype.slice.call(arguments);
  29595. }
  29596. {
  29597. return projetor;
  29598. }
  29599. })();
  29600. };
  29601. // $source: com/ibm/rave/core/internal/geo/InvertibleProjectionImpl
  29602. /************************************************************************
  29603. ** IBM Confidential
  29604. **
  29605. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  29606. **
  29607. ** (C) Copyright IBM Corp. 2015
  29608. **
  29609. ** The source code for this program is not published or otherwise divested of its trade secrets,
  29610. ** irrespective of what has been deposited with the U.S. Copyright Office.
  29611. ************************************************************************/
  29612. // GENERATED
  29613. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  29614. //@import com/ibm/rave/core/internal/geo/ProjectionImpl (loadtime) // superclass
  29615. /**
  29616. */
  29617. var com_ibm_rave_core_internal_geo_InvertibleProjectionImpl = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_ProjectionImpl, {
  29618. /** @expose */
  29619. invert : function(point) {
  29620. var p = (this.projectRotate).invert((point[0] - this.δx) / this.k, (this.δy - point[1]) / this.k);
  29621. if (p) {
  29622. return [p[0] * 57.29577951308232, p[1] * 57.29577951308232];
  29623. }
  29624. return undefined;
  29625. },
  29626. /** @expose */
  29627. supportInversion : function() {
  29628. return true;
  29629. }
  29630. });
  29631. // $source: com/ibm/rave/core/internal/geo/MercatorProjection
  29632. /************************************************************************
  29633. ** IBM Confidential
  29634. **
  29635. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  29636. **
  29637. ** (C) Copyright IBM Corp. 2015
  29638. **
  29639. ** The source code for this program is not published or otherwise divested of its trade secrets,
  29640. ** irrespective of what has been deposited with the U.S. Copyright Office.
  29641. ************************************************************************/
  29642. // GENERATED
  29643. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  29644. //@import com/ibm/rave/core/internal/geo/InvertibleProjectionImpl (loadtime) // superclass
  29645. //@import com/ibm/rave/core/internal/geo/ProjectionImpl (runtime)
  29646. /**
  29647. */
  29648. var com_ibm_rave_core_internal_geo_MercatorProjection = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_InvertibleProjectionImpl, {
  29649. clipAuto : false,
  29650. init : function() {
  29651. this.clipExtent$1(null);
  29652. },
  29653. /** @expose */
  29654. scale$1 : function(scale) {
  29655. com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.scale$1.call(this, scale);
  29656. if (this.clipAuto) {
  29657. return this.clipExtent$1(null);
  29658. }
  29659. return this;
  29660. },
  29661. translate$1 : function(translate) {
  29662. com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.translate$1.call(this, translate);
  29663. if (this.clipAuto) {
  29664. return this.clipExtent$1(null);
  29665. }
  29666. return this;
  29667. },
  29668. clipExtent$1 : function(clipExtent) {
  29669. com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.clipExtent$1.call(this, clipExtent);
  29670. if (this.clipAuto = !clipExtent) {
  29671. var k = 3.141592653589793 * com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.scale$0.call(this);
  29672. var t = com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.translate$0.call(this);
  29673. com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.clipExtent$1.call(this, [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]]);
  29674. }
  29675. return this;
  29676. },
  29677. clipExtent$0 : function() {
  29678. if (this.clipAuto) {
  29679. return null;
  29680. }
  29681. return com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.clipExtent$0.call(this);
  29682. },
  29683. /** @expose */
  29684. clipExtent : function(a0) {
  29685. var args = arguments;
  29686. if (args.length == 0) {
  29687. return this.clipExtent$0();
  29688. }
  29689. return this.clipExtent$1(a0);
  29690. }
  29691. /**
  29692. * @param pointProjector
  29693. * @param projection
  29694. */
  29695. //constructor : function() {}
  29696. });
  29697. // $source: com/ibm/rave/core/internal/geo/TransverseMercatorProjectionFactory
  29698. /************************************************************************
  29699. ** IBM Confidential
  29700. **
  29701. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  29702. **
  29703. ** (C) Copyright IBM Corp. 2015
  29704. **
  29705. ** The source code for this program is not published or otherwise divested of its trade secrets,
  29706. ** irrespective of what has been deposited with the U.S. Copyright Office.
  29707. ************************************************************************/
  29708. // GENERATED
  29709. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare anonymous, declare
  29710. //@import com/ibm/rave/core/geo/InvertiblePointProjector (runtime)
  29711. //@import com/ibm/rave/core/internal/geo/TransverseMercatorProjection (runtime) // new
  29712. //@import com/ibm/rave/core/internal/geo/ProjectionMutatorImpl (runtime) // internalMutate
  29713. /**
  29714. */
  29715. var com_ibm_rave_core_internal_geo_TransverseMercatorProjectionFactory = com_ibm_rave_core_nativeImpl_Declare({
  29716. /**
  29717. * @expose
  29718. */
  29719. raw : null,
  29720. _$functionClassMethod : function() {
  29721. var _$self = function() {
  29722. var m = new com_ibm_rave_core_internal_geo_TransverseMercatorProjection();
  29723. com_ibm_rave_core_internal_geo_ProjectionMutatorImpl.internalMutate(m, _$self.raw);
  29724. m.init();
  29725. return m;
  29726. };
  29727. return _$self;
  29728. },
  29729. constructor : function() {
  29730. this.raw = new (com_ibm_rave_core_nativeImpl_Declare({
  29731. _$functionClassMethod : function() {
  29732. var _$self = function(λ, φ) {
  29733. return [Math.log(Math.tan(3.141592653589793 / 4 + φ / 2)), -λ];
  29734. };
  29735. return _$self;
  29736. },
  29737. supportInversion : function() {
  29738. return true;
  29739. },
  29740. invert : function(x, y) {
  29741. return [-y, 2 * Math.atan(Math.exp(x)) - 1.5707963267948966];
  29742. }
  29743. }))();
  29744. },
  29745. /** @expose */
  29746. getRaw : function() {
  29747. return this.raw;
  29748. }
  29749. /**
  29750. */
  29751. //constructor : function() {}
  29752. });
  29753. com_ibm_rave_core_internal_geo_TransverseMercatorProjectionFactory.INSTANCE = new com_ibm_rave_core_internal_geo_TransverseMercatorProjectionFactory();
  29754. // $source: com/ibm/rave/core/internal/geo/TransverseMercatorProjection
  29755. /************************************************************************
  29756. ** IBM Confidential
  29757. **
  29758. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  29759. **
  29760. ** (C) Copyright IBM Corp. 2015
  29761. **
  29762. ** The source code for this program is not published or otherwise divested of its trade secrets,
  29763. ** irrespective of what has been deposited with the U.S. Copyright Office.
  29764. ************************************************************************/
  29765. // GENERATED
  29766. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  29767. //@import com/ibm/rave/core/internal/geo/MercatorProjection (loadtime) // superclass
  29768. //@import com/ibm/rave/core/internal/geo/ProjectionImpl (runtime)
  29769. /**
  29770. */
  29771. var com_ibm_rave_core_internal_geo_TransverseMercatorProjection = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_MercatorProjection, {
  29772. init : function() {
  29773. com_ibm_rave_core_internal_geo_MercatorProjection.prototype.init.call(this);
  29774. com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.rotate$1.call(this, [0.0, 0.0, 90.0]);
  29775. },
  29776. rotate$0 : function() {
  29777. var r = com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.rotate$0.call(this);
  29778. return [r[0], r[1], r[2] - 90];
  29779. },
  29780. rotate$1 : function(r) {
  29781. return com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.rotate$1.call(this, [r[0], r[1], r.length > 2 ? r[2] + 90 : 90]);
  29782. },
  29783. center$0 : function() {
  29784. var c = com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.center$0.call(this);
  29785. return [c[1], -c[0]];
  29786. },
  29787. center$1 : function(c) {
  29788. return com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.center$1.call(this, [-c[1], c[0]]);
  29789. },
  29790. /** @expose */
  29791. rotate : function(a0) {
  29792. var args = arguments;
  29793. if (args.length == 0) {
  29794. return this.rotate$0();
  29795. }
  29796. return this.rotate$1(a0);
  29797. },
  29798. /** @expose */
  29799. center : function(a0) {
  29800. var args = arguments;
  29801. if (args.length == 0) {
  29802. return this.center$0();
  29803. }
  29804. return this.center$1(a0);
  29805. }
  29806. /**
  29807. * @param rawPointProjector
  29808. */
  29809. //constructor : function() {}
  29810. });
  29811. // $source: com/ibm/rave/core/internal/geo/PlaneProjectionFactoryImpl
  29812. /************************************************************************
  29813. ** IBM Confidential
  29814. **
  29815. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  29816. **
  29817. ** (C) Copyright IBM Corp. 2015
  29818. **
  29819. ** The source code for this program is not published or otherwise divested of its trade secrets,
  29820. ** irrespective of what has been deposited with the U.S. Copyright Office.
  29821. ************************************************************************/
  29822. // GENERATED
  29823. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare anonymous, declare
  29824. //@import com/ibm/rave/core/internal/geo/InvertibleProjectionImpl (runtime) // new
  29825. //@import com/ibm/rave/core/internal/geo/ProjectionMutatorImpl (runtime) // internalMutate
  29826. //@import com/ibm/rave/core/internal/geo/AzimuthalPointProjectorFactory (runtime) // AzimuthalPointProjectorFactory
  29827. //@import com/ibm/rave/core/geo/InvertiblePointProjector (runtime)
  29828. //@import com/ibm/rave/core/internal/math/Trigonometry (runtime) // acos, sinci
  29829. /**
  29830. */
  29831. var com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl = com_ibm_rave_core_nativeImpl_Declare({
  29832. /**
  29833. * @expose
  29834. */
  29835. raw : null,
  29836. _$functionClassMethod : function() {
  29837. var _$self = function() {
  29838. var projection = new com_ibm_rave_core_internal_geo_InvertibleProjectionImpl();
  29839. com_ibm_rave_core_internal_geo_ProjectionMutatorImpl.internalMutate(projection, _$self.raw);
  29840. return projection;
  29841. };
  29842. return _$self;
  29843. },
  29844. /**
  29845. */
  29846. constructor : function(projector) {
  29847. this.raw = projector;
  29848. },
  29849. /** @expose */
  29850. getRaw : function() {
  29851. return this.raw;
  29852. }
  29853. });
  29854. com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newAzimuthalEqualAreaProjectionFactory = function() {
  29855. var projector = com_ibm_rave_core_internal_geo_AzimuthalPointProjectorFactory.INSTANCE(function(x) {
  29856. return Math.sqrt(2 / (1 + x));
  29857. }, function(x) {
  29858. return 2 * Math.asin(x / 2);
  29859. });
  29860. return new com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl(projector);
  29861. };
  29862. com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newAzimuthalEquidistantProjectionFactory = function() {
  29863. var projector = com_ibm_rave_core_internal_geo_AzimuthalPointProjectorFactory.INSTANCE(function(x) {
  29864. var c = Math.acos(x);
  29865. return (c) ? c / Math.sin(c) : c;
  29866. }, function(x) {
  29867. return x;
  29868. });
  29869. return new com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl(projector);
  29870. };
  29871. com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newEquirectangularProjectionFactory = function() {
  29872. var projector = new (com_ibm_rave_core_nativeImpl_Declare({
  29873. _$functionClassMethod : function() {
  29874. var _$self = function(λ, φ) {
  29875. return [λ, φ];
  29876. };
  29877. return _$self;
  29878. },
  29879. supportInversion : function() {
  29880. return true;
  29881. },
  29882. invert : function(x, y) {
  29883. return [x, y];
  29884. }
  29885. }))();
  29886. return new com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl(projector);
  29887. };
  29888. com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newGnomonicProjectionFactory = function() {
  29889. var projector = com_ibm_rave_core_internal_geo_AzimuthalPointProjectorFactory.INSTANCE(function(x) {
  29890. return 1 / x;
  29891. }, function(x) {
  29892. return Math.atan(x);
  29893. });
  29894. return new com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl(projector);
  29895. };
  29896. com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newOrthographicProjectionFactory = function() {
  29897. var projector = com_ibm_rave_core_internal_geo_AzimuthalPointProjectorFactory.INSTANCE(function(x) {
  29898. return 1;
  29899. }, function(x) {
  29900. return Math.asin(x);
  29901. });
  29902. return new com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl(projector);
  29903. };
  29904. com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newStereographicProjectionFactory = function() {
  29905. var projector = com_ibm_rave_core_internal_geo_AzimuthalPointProjectorFactory.INSTANCE(function(x) {
  29906. return 1 / (1 + x);
  29907. }, function(x) {
  29908. return 2 * Math.atan(x);
  29909. });
  29910. return new com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl(projector);
  29911. };
  29912. com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newWinkelTripelProjectionFactory = function() {
  29913. var projector = new (com_ibm_rave_core_nativeImpl_Declare({
  29914. _$functionClassMethod : function() {
  29915. var _$self = function(λ, φ) {
  29916. var λ2 = λ / 2;
  29917. var cosφ = Math.cos(φ), sincia = com_ibm_rave_core_internal_math_Trigonometry.sinci(com_ibm_rave_core_internal_math_Trigonometry.acos(cosφ * Math.cos(λ2)));
  29918. var a = 2 * cosφ * Math.sin(λ2) * sincia;
  29919. var b = Math.sin(φ) * sincia;
  29920. return [(a + λ / 1.5707963267948966) / 2, (b + φ) / 2];
  29921. };
  29922. return _$self;
  29923. },
  29924. supportInversion : function() {
  29925. return true;
  29926. },
  29927. invert : function(x, y) {
  29928. var λ = x, φ = y, i = 25, δλ, δφ;
  29929. do {
  29930. δλ = δφ = 0;
  29931. var cosφ = Math.cos(φ), sinφ = Math.sin(φ), sin_2φ = Math.sin(2 * φ), sin2φ = sinφ * sinφ, cos2φ = cosφ * cosφ, sinλ = Math.sin(λ), cosλ_2 = Math.cos(λ / 2), sinλ_2 = Math.sin(λ / 2), sin2λ_2 = sinλ_2 * sinλ_2, C = 1 - cos2φ * cosλ_2 * cosλ_2, F, E = (C != 0) ? com_ibm_rave_core_internal_math_Trigonometry.acos(cosφ * cosλ_2) * Math.sqrt(F = 1 / C) : (F = 0);
  29932. var fx = .5 * (2 * E * cosφ * sinλ_2 + λ / 1.5707963267948966) - x, fy = .5 * (E * sinφ + φ) - y, δxδλ = .5 * F * (cos2φ * sin2λ_2 + E * cosφ * cosλ_2 * sin2φ) + .5 / 1.5707963267948966, δxδφ = F * (sinλ * sin_2φ / 4 - E * sinφ * sinλ_2), δyδλ = .125 * F * (sin_2φ * sinλ_2 - E * sinφ * cos2φ * sinλ), δyδφ = .5 * F * (sin2φ * cosλ_2 + E * sin2λ_2 * cosφ) + .5, denominator = δxδφ * δyδλ - δyδφ * δxδλ;
  29933. δλ = (fy * δxδφ - fx * δyδφ) / denominator;
  29934. δφ = (fx * δyδλ - fy * δxδλ) / denominator;
  29935. λ -= δλ;
  29936. φ -= δφ;
  29937. } while ((Math.abs(δλ) > 1.0E-6 || Math.abs(δφ) > 1.0E-6) && --i > 0);
  29938. return [λ, φ];
  29939. }
  29940. }))();
  29941. return new com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl(projector);
  29942. };
  29943. // $source: com/ibm/rave/core/internal/geo/AzimuthalPointProjectorFactory
  29944. /************************************************************************
  29945. ** IBM Confidential
  29946. **
  29947. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  29948. **
  29949. ** (C) Copyright IBM Corp. 2015
  29950. **
  29951. ** The source code for this program is not published or otherwise divested of its trade secrets,
  29952. ** irrespective of what has been deposited with the U.S. Copyright Office.
  29953. ************************************************************************/
  29954. // GENERATED
  29955. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare anonymous, declare
  29956. //@import com/ibm/rave/core/geo/InvertiblePointProjector (runtime)
  29957. /**
  29958. */
  29959. var com_ibm_rave_core_internal_geo_AzimuthalPointProjectorFactory = com_ibm_rave_core_nativeImpl_Declare({
  29960. _$functionClassMethod : function() {
  29961. var _$self = function(args) {
  29962. if (args !== null || arguments.length > 1){
  29963. args = Array.prototype.slice.call(arguments);
  29964. }
  29965. {
  29966. var scale = args[0];
  29967. var angle = args[1];
  29968. return new (com_ibm_rave_core_nativeImpl_Declare({
  29969. _$functionClassMethod : function() {
  29970. var _$self = function(λ, φ) {
  29971. var cosλ = Math.cos(λ), cosφ = Math.cos(φ), k = scale(cosλ * cosφ);
  29972. return [k * cosφ * Math.sin(λ), k * Math.sin(φ)];
  29973. };
  29974. return _$self;
  29975. },
  29976. supportInversion : function() {
  29977. return true;
  29978. },
  29979. invert : function(x, y) {
  29980. var ρ = Math.sqrt(x * x + y * y), c = angle(ρ), sinc = Math.sin(c), cosc = Math.cos(c);
  29981. return [Math.atan2(x * sinc, ρ * cosc), Math.asin((ρ) ? y * sinc / ρ : ρ)];
  29982. }
  29983. }))();
  29984. }
  29985. };
  29986. return _$self;
  29987. }
  29988. //constructor : function() {}
  29989. });
  29990. com_ibm_rave_core_internal_geo_AzimuthalPointProjectorFactory.INSTANCE = new com_ibm_rave_core_internal_geo_AzimuthalPointProjectorFactory();
  29991. // $source: com/ibm/rave/core/internal/geo/ConicProjectionFactoryImpl
  29992. /************************************************************************
  29993. ** IBM Confidential
  29994. **
  29995. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  29996. **
  29997. ** (C) Copyright IBM Corp. 2015
  29998. **
  29999. ** The source code for this program is not published or otherwise divested of its trade secrets,
  30000. ** irrespective of what has been deposited with the U.S. Copyright Office.
  30001. ************************************************************************/
  30002. // GENERATED
  30003. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare anonymous, declare
  30004. //@import com/ibm/rave/core/internal/geo/ConicProjectionImpl (runtime) // new
  30005. //@import com/ibm/rave/core/geo/InvertiblePointProjector (runtime)
  30006. //@import com/ibm/rave/core/internal/math/Trigonometry (runtime) // asin, sgn
  30007. //@import com/ibm/rave/core/internal/geo/MercatorPlaneProjectionFactory (runtime) // MercatorPlaneProjectionFactory
  30008. /**
  30009. */
  30010. var com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl = com_ibm_rave_core_nativeImpl_Declare({
  30011. /**
  30012. * @expose
  30013. */
  30014. raw : null,
  30015. _$functionClassMethod : function() {
  30016. var _$self = function() {
  30017. return new com_ibm_rave_core_internal_geo_ConicProjectionImpl(_$self.raw);
  30018. };
  30019. return _$self;
  30020. },
  30021. /**
  30022. */
  30023. constructor : function(factory) {
  30024. this.raw = factory;
  30025. },
  30026. /** @expose */
  30027. getRaw : function() {
  30028. return this.raw;
  30029. }
  30030. });
  30031. com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl.newConicEqualAreaProjectionFactory = function() {
  30032. var factory = function(args) {
  30033. if (args !== null || arguments.length > 1){
  30034. args = Array.prototype.slice.call(arguments);
  30035. }
  30036. {
  30037. var φ0 = args[0];
  30038. var φ1 = args[1];
  30039. var sinφ0 = Math.sin(φ0), n = (sinφ0 + Math.sin(φ1)) / 2, C = 1 + sinφ0 * (2 * n - sinφ0), ρ0 = Math.sqrt(C) / n;
  30040. return new (com_ibm_rave_core_nativeImpl_Declare({
  30041. _$functionClassMethod : function() {
  30042. var _$self = function(λ, φ) {
  30043. var ρ = Math.sqrt(C - 2 * n * Math.sin(φ)) / n;
  30044. return [ρ * Math.sin(λ *= n), ρ0 - ρ * Math.cos(λ)];
  30045. };
  30046. return _$self;
  30047. },
  30048. supportInversion : function() {
  30049. return true;
  30050. },
  30051. invert : function(x, y) {
  30052. var ρ0_y = ρ0 - y;
  30053. return [Math.atan2(x, ρ0_y) / n, com_ibm_rave_core_internal_math_Trigonometry.asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n))];
  30054. }
  30055. }))();
  30056. }
  30057. };
  30058. return new com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl(factory);
  30059. };
  30060. com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl.newConicEquidistantProjectionFactory = function() {
  30061. var factory = function(args) {
  30062. if (args !== null || arguments.length > 1){
  30063. args = Array.prototype.slice.call(arguments);
  30064. }
  30065. {
  30066. var φ0 = args[0];
  30067. var φ1 = args[1];
  30068. var cosφ0 = Math.cos(φ0), n = φ0 == φ1 ? Math.sin(φ0) : (cosφ0 - Math.cos(φ1)) / (φ1 - φ0), G = cosφ0 / n + φ0;
  30069. if (Math.abs(n) < 1.0E-6) {
  30070. return new (com_ibm_rave_core_nativeImpl_Declare({
  30071. _$functionClassMethod : function() {
  30072. var _$self = function(λ, φ) {
  30073. return [λ, φ];
  30074. };
  30075. return _$self;
  30076. },
  30077. supportInversion : function() {
  30078. return true;
  30079. },
  30080. invert : function(x, y) {
  30081. return [x, y];
  30082. }
  30083. }))();
  30084. }
  30085. return new (com_ibm_rave_core_nativeImpl_Declare({
  30086. _$functionClassMethod : function() {
  30087. var _$self = function(λ, φ) {
  30088. var ρ = G - φ;
  30089. return [ρ * Math.sin(n * λ), G - ρ * Math.cos(n * λ)];
  30090. };
  30091. return _$self;
  30092. },
  30093. supportInversion : function() {
  30094. return true;
  30095. },
  30096. invert : function(x, y) {
  30097. var ρ0_y = G - y;
  30098. return [Math.atan2(x, ρ0_y) / n, G - com_ibm_rave_core_internal_math_Trigonometry.sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y)];
  30099. }
  30100. }))();
  30101. }
  30102. };
  30103. return new com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl(factory);
  30104. };
  30105. com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl.newConicConformalProjectionFactory = function() {
  30106. var factory = function(args) {
  30107. if (args !== null || arguments.length > 1){
  30108. args = Array.prototype.slice.call(arguments);
  30109. }
  30110. {
  30111. var φ0 = args[0];
  30112. var φ1 = args[1];
  30113. var cosφ0 = Math.cos(φ0), n = φ0 == φ1 ? Math.sin(φ0) : Math.log(cosφ0 / Math.cos(φ1)) / Math.log(Math.tan(3.141592653589793 / 4 + φ1 / 2) / Math.tan(3.141592653589793 / 4 + φ0 / 2)), F = cosφ0 * Math.pow(Math.tan(3.141592653589793 / 4 + φ0 / 2), n) / n;
  30114. if (!((n))) {
  30115. return com_ibm_rave_core_internal_geo_MercatorPlaneProjectionFactory.INSTANCE.raw;
  30116. }
  30117. return new (com_ibm_rave_core_nativeImpl_Declare({
  30118. _$functionClassMethod : function() {
  30119. var _$self = function(λ, φ) {
  30120. if (F > 0) {
  30121. if (φ < -1.5707963267948966 + 1.0E-6) {
  30122. φ = -1.5707963267948966 + 1.0E-6;
  30123. }
  30124. } else {
  30125. if (φ > 1.5707963267948966 - 1.0E-6) {
  30126. φ = 1.5707963267948966 - 1.0E-6;
  30127. }
  30128. }
  30129. var ρ = F / Math.pow(Math.tan(3.141592653589793 / 4 + φ / 2), n);
  30130. return [ρ * Math.sin(n * λ), F - ρ * Math.cos(n * λ)];
  30131. };
  30132. return _$self;
  30133. },
  30134. supportInversion : function() {
  30135. return true;
  30136. },
  30137. invert : function(x, y) {
  30138. var ρ0_y = F - y, ρ = com_ibm_rave_core_internal_math_Trigonometry.sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y);
  30139. return [Math.atan2(x, ρ0_y) / n, 2 * Math.atan(Math.pow(F / ρ, 1 / n)) - 1.5707963267948966];
  30140. }
  30141. }))();
  30142. }
  30143. };
  30144. return new com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl(factory);
  30145. };
  30146. // $source: com/ibm/rave/core/internal/geo/ConicProjectionImpl
  30147. /************************************************************************
  30148. ** IBM Confidential
  30149. **
  30150. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  30151. **
  30152. ** (C) Copyright IBM Corp. 2015
  30153. **
  30154. ** The source code for this program is not published or otherwise divested of its trade secrets,
  30155. ** irrespective of what has been deposited with the U.S. Copyright Office.
  30156. ************************************************************************/
  30157. // GENERATED
  30158. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  30159. //@import com/ibm/rave/core/internal/geo/InvertibleProjectionImpl (loadtime) // superclass
  30160. //@import com/ibm/rave/core/internal/geo/ProjectionMutatorImpl (runtime) // internalMutate
  30161. /**
  30162. */
  30163. var com_ibm_rave_core_internal_geo_ConicProjectionImpl = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_InvertibleProjectionImpl, {
  30164. //rawPointProjectorFactory : null,
  30165. φ0 : 0, φ1 : 0,
  30166. /**
  30167. */
  30168. constructor : function(rawPointProjectorFactory) {
  30169. this.φ0 = 0;
  30170. this.φ1 = 3.141592653589793 / 3;
  30171. this.rawPointProjectorFactory = rawPointProjectorFactory;
  30172. var projector = rawPointProjectorFactory(this.φ0, this.φ1);
  30173. com_ibm_rave_core_internal_geo_ProjectionMutatorImpl.internalMutate(this, projector);
  30174. },
  30175. parallels$0 : function() {
  30176. return [this.φ0 / 3.141592653589793 * 180, this.φ1 / 3.141592653589793 * 180];
  30177. },
  30178. parallels$1 : function(p) {
  30179. var projector = this.rawPointProjectorFactory(this.φ0 = p[0] * 3.141592653589793 / 180, this.φ1 = p[1] * 3.141592653589793 / 180);
  30180. com_ibm_rave_core_internal_geo_ProjectionMutatorImpl.internalMutate(this, projector);
  30181. return this;
  30182. },
  30183. /** @expose */
  30184. parallels : function(a0) {
  30185. var args = arguments;
  30186. if (args.length == 0) {
  30187. return this.parallels$0();
  30188. }
  30189. return this.parallels$1(a0);
  30190. }
  30191. });
  30192. // $source: com/ibm/rave/core/internal/geo/Stream
  30193. /************************************************************************
  30194. ** IBM Confidential
  30195. **
  30196. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  30197. **
  30198. ** (C) Copyright IBM Corp. 2015
  30199. **
  30200. ** The source code for this program is not published or otherwise divested of its trade secrets,
  30201. ** irrespective of what has been deposited with the U.S. Copyright Office.
  30202. ************************************************************************/
  30203. // GENERATED
  30204. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  30205. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (runtime) // create
  30206. /**
  30207. * An object that converts a GeoJSON input object to a stream: a series of method calls on a stream listener. Basically it reads the passed GeoJSON object and invokes the relevant callback on the listener informing it of its current "state" (i.e., which portion of the GeoJSON it is currently reading and the relevant values if any) While both features and geometry objects are supported as input, the stream interface only describes the geometry, and thus additional feature properties are not visible to listeners.
  30208. */
  30209. var com_ibm_rave_core_internal_geo_Stream = com_ibm_rave_core_nativeImpl_Declare({
  30210. /**
  30211. * Starts the streaming process by reading the passed GeoJSON object and invoking the pertinent listener method as it traverses GeoJSON object's features, geometry and sub objects, e.g., point, sphere etc.
  30212. * @param (Object) json the JSON object to read and stream. If null, then no streaming will occur
  30213. * @param (com.ibm.rave.core.geo.StreamListener) listener the listener to inform of what's being read from the JSON object. If null,then no streaming will occur
  30214. * @see (com.ibm.rave.core.geo.StreamListener) StreamListener
  30215. */
  30216. stream : function(json, listener) {
  30217. if (json && listener) {
  30218. var handler = com_ibm_rave_core_internal_geo_Stream.handlers.get(json["type"]);
  30219. if (handler) {
  30220. handler(json, listener);
  30221. }
  30222. }
  30223. }
  30224. //constructor : function() {}
  30225. });
  30226. com_ibm_rave_core_internal_geo_Stream.createAndInit = function() {
  30227. var _handlers = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  30228. _handlers.set("FeatureCollection", function(featureCollection, listener) {
  30229. var features = featureCollection["features"];
  30230. if (features) {
  30231. for (var i = 0, n = features.length; i < n; ++i) {
  30232. var feature = features[i];
  30233. if (feature) {
  30234. var geometry = feature["geometry"];
  30235. if (geometry) {
  30236. var handler = com_ibm_rave_core_internal_geo_Stream.handlers.get(geometry["type"]);
  30237. if (handler) {
  30238. handler(geometry, listener);
  30239. }
  30240. }
  30241. }
  30242. }
  30243. }
  30244. });
  30245. _handlers.set("Feature", function(feature, listener) {
  30246. var geometry = feature["geometry"];
  30247. if (geometry) {
  30248. var handler = com_ibm_rave_core_internal_geo_Stream.handlers.get(geometry["type"]);
  30249. if (handler) {
  30250. handler(geometry, listener);
  30251. }
  30252. }
  30253. });
  30254. _handlers.set("Sphere", function(json, listener) {
  30255. listener.sphere();
  30256. });
  30257. _handlers.set("Point", function(json, listener) {
  30258. var coordinates = json["coordinates"];
  30259. if (coordinates) {
  30260. if (coordinates.length == 2) {
  30261. listener.point(+ (coordinates[0]), + (coordinates[1]), NaN);
  30262. } else if (coordinates.length == 3) {
  30263. listener.point(+ (coordinates[0]), + (coordinates[1]), + (coordinates[2]));
  30264. }
  30265. }
  30266. });
  30267. _handlers.set("MultiPoint", function(json, listener) {
  30268. var coordinatesList = json["coordinates"];
  30269. if (coordinatesList) {
  30270. var n = coordinatesList.length;
  30271. var i = -1;
  30272. while (++i < n) {
  30273. var coordinates = coordinatesList[i];
  30274. if (coordinates) {
  30275. if (coordinates.length == 2) {
  30276. listener.point(+ (coordinates[0]), + (coordinates[1]), NaN);
  30277. } else if (coordinates.length == 3) {
  30278. listener.point(+ (coordinates[0]), + (coordinates[1]), + (coordinates[2]));
  30279. }
  30280. }
  30281. }
  30282. }
  30283. });
  30284. _handlers.set("LineString", function(json, listener) {
  30285. var coordinatesList = json["coordinates"];
  30286. if (coordinatesList) {
  30287. com_ibm_rave_core_internal_geo_Stream.streamLine(coordinatesList, listener, 0);
  30288. }
  30289. });
  30290. _handlers.set("MultiLineString", function(json, listener) {
  30291. var coordinatesList = json["coordinates"];
  30292. if (coordinatesList) {
  30293. var n = coordinatesList.length;
  30294. var i = -1;
  30295. while (++i < n) {
  30296. var coordinates = coordinatesList[i];
  30297. if (coordinates) {
  30298. com_ibm_rave_core_internal_geo_Stream.streamLine(coordinates, listener, 0);
  30299. }
  30300. }
  30301. }
  30302. });
  30303. _handlers.set("Polygon", function(json, listener) {
  30304. var coordinatesList = json["coordinates"];
  30305. if (coordinatesList) {
  30306. com_ibm_rave_core_internal_geo_Stream.streamPolygon(coordinatesList, listener);
  30307. }
  30308. });
  30309. _handlers.set("MultiPolygon", function(json, listener) {
  30310. var coordinatesList = json["coordinates"];
  30311. if (coordinatesList) {
  30312. var n = coordinatesList.length;
  30313. var i = -1;
  30314. while (++i < n) {
  30315. var coordinates = coordinatesList[i];
  30316. if (coordinates) {
  30317. com_ibm_rave_core_internal_geo_Stream.streamPolygon(coordinates, listener);
  30318. }
  30319. }
  30320. }
  30321. });
  30322. _handlers.set("GeometryCollection", function(json, listener) {
  30323. var geometries = json["geometries"];
  30324. if (geometries) {
  30325. var i = -1, n = geometries.length;
  30326. while (++i < n) {
  30327. var geometry = geometries[i];
  30328. if (geometry) {
  30329. var handler = com_ibm_rave_core_internal_geo_Stream.handlers.get(geometry["type"]);
  30330. if (handler) {
  30331. handler(geometry, listener);
  30332. }
  30333. }
  30334. }
  30335. }
  30336. });
  30337. return _handlers;
  30338. };
  30339. com_ibm_rave_core_internal_geo_Stream.streamLine = function(coordinatesList, listener, closed) {
  30340. var i = -1;
  30341. var n = coordinatesList.length - closed;
  30342. listener.lineStart();
  30343. while (++i < n) {
  30344. var coordinates = coordinatesList[i];
  30345. if (coordinates) {
  30346. if (coordinates.length == 2) {
  30347. listener.point(+ (coordinates[0]), + (coordinates[1]), NaN);
  30348. } else if (coordinates.length == 3) {
  30349. listener.point(+ (coordinates[0]), + (coordinates[1]), + (coordinates[2]));
  30350. }
  30351. }
  30352. }
  30353. listener.lineEnd();
  30354. };
  30355. com_ibm_rave_core_internal_geo_Stream.streamPolygon = function(coordinatesList, listener) {
  30356. var i = -1;
  30357. var n = coordinatesList.length;
  30358. listener.polygonStart();
  30359. while (++i < n) {
  30360. var coordList = coordinatesList[i];
  30361. if (coordList) {
  30362. com_ibm_rave_core_internal_geo_Stream.streamLine(coordList, listener, 1);
  30363. }
  30364. }
  30365. listener.polygonEnd();
  30366. };
  30367. /**
  30368. * The singleton instance
  30369. */
  30370. com_ibm_rave_core_internal_geo_Stream.INSTANCE = new com_ibm_rave_core_internal_geo_Stream();
  30371. com_ibm_rave_core_internal_geo_Stream.handlers = com_ibm_rave_core_internal_geo_Stream.createAndInit();
  30372. // $source: com/ibm/rave/core/internal/geo/SphericalArea
  30373. /************************************************************************
  30374. ** IBM Confidential
  30375. **
  30376. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  30377. **
  30378. ** (C) Copyright IBM Corp. 2015
  30379. **
  30380. ** The source code for this program is not published or otherwise divested of its trade secrets,
  30381. ** irrespective of what has been deposited with the U.S. Copyright Office.
  30382. ************************************************************************/
  30383. // GENERATED
  30384. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  30385. //@import com/ibm/rave/core/internal/math/Adder (runtime) // new
  30386. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (runtime) // new
  30387. //@import com/ibm/rave/core/geo/Geo (runtime) // Geo
  30388. /**
  30389. */
  30390. var com_ibm_rave_core_internal_geo_SphericalArea = com_ibm_rave_core_nativeImpl_Declare({
  30391. //areaRingSum : null,
  30392. //areaStreamListener : null,
  30393. //sphere : null,
  30394. //polygonStart : null,
  30395. //polygonEnd : null,
  30396. //point : null,
  30397. //nextPoint : null,
  30398. //lineEnd : null,
  30399. //areaRingStart : null,
  30400. λ00 : 0, φ00 : 0, λ0 : 0, cosφ0 : 0, sinφ0 : 0,
  30401. areaSum : 0,
  30402. constructor : function() {
  30403. this.areaRingSum = new com_ibm_rave_core_internal_math_Adder();
  30404. this.areaStreamListener = new com_ibm_rave_core_internal_geo_DelegatingStreamListener();
  30405. /**
  30406. */
  30407. {
  30408. var self = this;
  30409. this.sphere = function() {
  30410. self.areaSum += 4 * 3.141592653589793;
  30411. };
  30412. this.polygonStart = function() {
  30413. self.areaRingSum.reset();
  30414. self.areaStreamListener.lineStartDelegate = self.areaRingStart;
  30415. };
  30416. this.polygonEnd = function() {
  30417. var area = 2 * self.areaRingSum.valueOf();
  30418. self.areaSum += (area < 0) ? 4 * 3.141592653589793 + area : area;
  30419. self.areaStreamListener.lineStartDelegate = null;
  30420. self.areaStreamListener.lineEndDelegate = null;
  30421. self.areaStreamListener.pointDelegate = null;
  30422. };
  30423. this.point = function(λ, φ, z) {
  30424. self.λ0 = (self.λ00 = λ) * 0.017453292519943295;
  30425. self.cosφ0 = Math.cos(φ = (self.φ00 = φ) * 0.017453292519943295 / 2 + 3.141592653589793 / 4);
  30426. self.sinφ0 = Math.sin(φ);
  30427. self.areaStreamListener.pointDelegate = self.nextPoint;
  30428. };
  30429. this.nextPoint = function(λ, φ, z) {
  30430. λ *= 0.017453292519943295;
  30431. φ = φ * 0.017453292519943295 / 2 + 3.141592653589793 / 4;
  30432. var dλ = λ - self.λ0;
  30433. var sdλ = (dλ >= 0) ? 1 : -1;
  30434. var adλ = sdλ * dλ;
  30435. var cosφ = Math.cos(φ);
  30436. var sinφ = Math.sin(φ);
  30437. var k = self.sinφ0 * sinφ;
  30438. var u = self.cosφ0 * cosφ + k * Math.cos(adλ);
  30439. var v = k * sdλ * Math.sin(adλ);
  30440. self.areaRingSum.add(Math.atan2(v, u));
  30441. self.λ0 = λ;
  30442. self.cosφ0 = cosφ;
  30443. self.sinφ0 = sinφ;
  30444. };
  30445. this.lineEnd = function() {
  30446. self.nextPoint(self.λ00, self.φ00, NaN);
  30447. };
  30448. this.areaRingStart = function() {
  30449. self.λ00 = self.φ00 = self.λ0 = self.cosφ0 = self.sinφ0 = 0;
  30450. self.areaStreamListener.pointDelegate = self.point;
  30451. self.areaStreamListener.lineEndDelegate = self.lineEnd;
  30452. };
  30453. this.areaStreamListener.sphereDelegate = this.sphere;
  30454. this.areaStreamListener.polygonStartDelegate = this.polygonStart;
  30455. this.areaStreamListener.polygonEndDelegate = this.polygonEnd;
  30456. }
  30457. },
  30458. /**
  30459. * Getter method for the Adder object used by this SphericalArea object
  30460. * @return (com.ibm.rave.core.internal.math.Adder) the Adder
  30461. */
  30462. getAreaRingSum : function() {
  30463. return this.areaRingSum;
  30464. },
  30465. /**
  30466. * Getter method for the stream listener object used by this SphericalArea object
  30467. * @return (com.ibm.rave.core.geo.StreamListener) the stream listener
  30468. */
  30469. getAreaStreamListener : function() {
  30470. return this.areaStreamListener;
  30471. },
  30472. /**
  30473. * Returns the spherical area of the specified feature in steradians. See also path.area, which computes the projected area on the Cartesian plane
  30474. * @param (Object) json the JSON object containing the feature whose area is computed
  30475. * @return (double) the area is steradians (The unit of solid angle)
  30476. */
  30477. calculateArea : function(json) {
  30478. this.areaSum = 0;
  30479. com_ibm_rave_core_geo_Geo.INSTANCE.stream(json, this.areaStreamListener);
  30480. return this.areaSum;
  30481. }
  30482. });
  30483. // $source: com/ibm/rave/core/internal/geo/SphericalBounds
  30484. /************************************************************************
  30485. ** IBM Confidential
  30486. **
  30487. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  30488. **
  30489. ** (C) Copyright IBM Corp. 2015
  30490. **
  30491. ** The source code for this program is not published or otherwise divested of its trade secrets,
  30492. ** irrespective of what has been deposited with the U.S. Copyright Office.
  30493. ************************************************************************/
  30494. // GENERATED
  30495. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  30496. //@import com/ibm/rave/core/internal/geo/SphericalArea (runtime) // new
  30497. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (runtime) // new
  30498. //@import com/ibm/rave/core/geo/Geo (runtime) // Geo
  30499. //@import com/ibm/rave/core/internal/geo/CartesianUtil (runtime) // cartesianNormalize, cartesianCross, cartesian
  30500. //@import com/ibm/rave/core/internal/geo/SphericalUtil (runtime) // spherical
  30501. /**
  30502. */
  30503. var com_ibm_rave_core_internal_geo_SphericalBounds = com_ibm_rave_core_nativeImpl_Declare({
  30504. //p0 : null,
  30505. //range : null,
  30506. //ranges : null,
  30507. //sphericalArea : null,
  30508. //areaStreamListener : null,
  30509. //boundsStreamListener : null,
  30510. //rangeComparator : null,
  30511. //point : null,
  30512. //linePoint : null,
  30513. //lineStart : null,
  30514. //lineEnd : null,
  30515. //ringPoint : null,
  30516. //ringStart : null,
  30517. //ringEnd : null,
  30518. //polygonStart : null,
  30519. //polygonEnd : null,
  30520. λ0 : 0, φ0 : 0, λ1 : 0, φ1 : 0, λ_ : 0, λ__ : 0, φ__ : 0, dλSum : 0,
  30521. constructor : function() {
  30522. this.sphericalArea = new com_ibm_rave_core_internal_geo_SphericalArea();
  30523. this.areaStreamListener = this.sphericalArea.areaStreamListener;
  30524. this.boundsStreamListener = new com_ibm_rave_core_internal_geo_DelegatingStreamListener();
  30525. this.rangeComparator = function(a, b) {
  30526. var diff = a[0] - b[0];
  30527. if (diff > 0) {
  30528. return 1;
  30529. }
  30530. if (diff < 0) {
  30531. return -1;
  30532. }
  30533. return 0;
  30534. };
  30535. {
  30536. var self = this;
  30537. this.point = function(λ, φ, z) {
  30538. self.range = [self.λ0 = λ, self.λ1 = λ];
  30539. self.ranges.push(self.range);
  30540. if (φ < self.φ0) {
  30541. self.φ0 = φ;
  30542. }
  30543. if (φ > self.φ1) {
  30544. self.φ1 = φ;
  30545. }
  30546. };
  30547. this.linePoint = function(λ, φ, z) {
  30548. var p = com_ibm_rave_core_internal_geo_CartesianUtil.cartesian([λ * 0.017453292519943295, φ * 0.017453292519943295]);
  30549. if (self.p0) {
  30550. var normal = com_ibm_rave_core_internal_geo_CartesianUtil.cartesianCross(self.p0, p);
  30551. var equatorial = [normal[1], -normal[0], 0];
  30552. var inflection = com_ibm_rave_core_internal_geo_CartesianUtil.cartesianCross(equatorial, normal);
  30553. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianNormalize(inflection);
  30554. inflection = com_ibm_rave_core_internal_geo_SphericalUtil.spherical(inflection);
  30555. var dλ = λ - self.λ_;
  30556. var s = dλ > 0 ? 1 : -1;
  30557. var λi = inflection[0] * 57.29577951308232 * s;
  30558. var antimeridian = Math.abs(dλ) > 180;
  30559. if (antimeridian ^ (s * self.λ_ < λi && λi < s * λ)) {
  30560. var φi = inflection[1] * 57.29577951308232;
  30561. if (φi > self.φ1) {
  30562. self.φ1 = φi;
  30563. }
  30564. } else {
  30565. λi = (λi + 360) % 360 - 180;
  30566. if (antimeridian ^ (s * self.λ_ < λi && λi < s * λ)) {
  30567. var φi = -inflection[1] * 57.29577951308232;
  30568. if (φi < self.φ0) {
  30569. self.φ0 = φi;
  30570. }
  30571. } else {
  30572. if (φ < self.φ0) {
  30573. self.φ0 = φ;
  30574. }
  30575. if (φ > self.φ1) {
  30576. self.φ1 = φ;
  30577. }
  30578. }
  30579. }
  30580. if (antimeridian) {
  30581. if (λ < self.λ_) {
  30582. if (self.angle(self.λ0, λ) > self.angle(self.λ0, self.λ1)) {
  30583. self.λ1 = λ;
  30584. }
  30585. } else {
  30586. if (self.angle(λ, self.λ1) > self.angle(self.λ0, self.λ1)) {
  30587. self.λ0 = λ;
  30588. }
  30589. }
  30590. } else {
  30591. if (self.λ1 >= self.λ0) {
  30592. if (λ < self.λ0) {
  30593. self.λ0 = λ;
  30594. }
  30595. if (λ > self.λ1) {
  30596. self.λ1 = λ;
  30597. }
  30598. } else {
  30599. if (λ > self.λ_) {
  30600. if (self.angle(self.λ0, λ) > self.angle(self.λ0, self.λ1)) {
  30601. self.λ1 = λ;
  30602. }
  30603. } else {
  30604. if (self.angle(λ, self.λ1) > self.angle(self.λ0, self.λ1)) {
  30605. self.λ0 = λ;
  30606. }
  30607. }
  30608. }
  30609. }
  30610. } else {
  30611. self.point(λ, φ, NaN);
  30612. }
  30613. self.p0 = p;
  30614. self.λ_ = λ;
  30615. };
  30616. this.lineStart = function() {
  30617. self.boundsStreamListener.pointDelegate = self.linePoint;
  30618. };
  30619. this.lineEnd = function() {
  30620. self.range[0] = self.λ0;
  30621. self.range[1] = self.λ1;
  30622. self.boundsStreamListener.pointDelegate = self.point;
  30623. self.p0 = null;
  30624. };
  30625. this.ringPoint = function(λ, φ, z) {
  30626. if (self.p0) {
  30627. var dλ = λ - self.λ_;
  30628. self.dλSum += (Math.abs(dλ) > 180) ? dλ + (dλ > 0 ? 360 : -360) : dλ;
  30629. } else {
  30630. self.λ__ = λ;
  30631. self.φ__ = φ;
  30632. }
  30633. self.areaStreamListener.point(λ, φ, NaN);
  30634. self.linePoint(λ, φ, NaN);
  30635. };
  30636. this.ringStart = function() {
  30637. self.areaStreamListener.lineStart();
  30638. };
  30639. this.ringEnd = function() {
  30640. self.ringPoint(self.λ__, self.φ__, NaN);
  30641. self.areaStreamListener.lineEnd();
  30642. if (Math.abs(self.dλSum) > 1.0E-6) {
  30643. self.λ0 = -(self.λ1 = 180);
  30644. }
  30645. self.range[0] = self.λ0;
  30646. self.range[1] = self.λ1;
  30647. self.p0 = null;
  30648. };
  30649. this.polygonStart = function() {
  30650. self.boundsStreamListener.pointDelegate = self.ringPoint;
  30651. self.boundsStreamListener.lineStartDelegate = self.ringStart;
  30652. self.boundsStreamListener.lineEndDelegate = self.ringEnd;
  30653. self.dλSum = 0;
  30654. self.areaStreamListener.polygonStart();
  30655. };
  30656. this.polygonEnd = function() {
  30657. self.areaStreamListener.polygonEnd();
  30658. self.boundsStreamListener.pointDelegate = self.point;
  30659. self.boundsStreamListener.lineStartDelegate = self.lineStart;
  30660. self.boundsStreamListener.lineEndDelegate = self.lineEnd;
  30661. if (self.sphericalArea.areaRingSum.valueOf() < 0) {
  30662. self.λ0 = -(self.λ1 = 180);
  30663. self.φ0 = -(self.φ1 = 90);
  30664. } else if (self.dλSum > 1.0E-6) {
  30665. self.φ1 = 90;
  30666. } else if (self.dλSum < -1.0E-6) {
  30667. self.φ0 = -90;
  30668. }
  30669. self.range[0] = self.λ0;
  30670. self.range[1] = self.λ1;
  30671. };
  30672. this.boundsStreamListener.pointDelegate = this.point;
  30673. this.boundsStreamListener.lineStartDelegate = this.lineStart;
  30674. this.boundsStreamListener.lineEndDelegate = this.lineEnd;
  30675. this.boundsStreamListener.polygonStartDelegate = this.polygonStart;
  30676. this.boundsStreamListener.polygonEndDelegate = this.polygonEnd;
  30677. }
  30678. },
  30679. withinRange : function(x, range) {
  30680. return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x;
  30681. },
  30682. angle : function(λ0, λ1) {
  30683. return (λ1 -= λ0) < 0 ? λ1 + 360 : λ1;
  30684. },
  30685. /**
  30686. * Returns the spherical bounding box for the specified feature. The bounding box is represented by a two-dimensional array: [​[left, bottom], [right, top]​], where left is the minimum longitude, bottom is the minimum latitude, right is maximum longitude, and top is the maximum latitude. See also path.bounds, which computes the projected bounding box on the Cartesian plane.
  30687. * @param (Object) feature the GeoJSON object containing the feature whose bounds are computed
  30688. * @return (double[][]) the spherical bounding box
  30689. */
  30690. calculateBounds : function(feature) {
  30691. this.φ1 = this.λ1 = -(this.λ0 = this.φ0 = Infinity);
  30692. this.ranges = [];
  30693. com_ibm_rave_core_geo_Geo.INSTANCE.stream(feature, this.boundsStreamListener);
  30694. var n = this.ranges.length;
  30695. if (n > 0) {
  30696. this.ranges.sort(this.rangeComparator);
  30697. var b;
  30698. var a = this.ranges[0];
  30699. var merged = [];
  30700. merged.push(a);
  30701. for (var i = 1; i < n; ++i) {
  30702. b = this.ranges[i];
  30703. if (this.withinRange(b[0], a) || this.withinRange(b[1], a)) {
  30704. if (this.angle(a[0], b[1]) > this.angle(a[0], a[1])) {
  30705. a[1] = b[1];
  30706. }
  30707. if (this.angle(b[0], a[1]) > this.angle(a[0], a[1])) {
  30708. a[0] = b[0];
  30709. }
  30710. } else {
  30711. merged.push(a = b);
  30712. }
  30713. }
  30714. var best = -Infinity, dλ;
  30715. n = merged.length - 1;
  30716. a = merged[n];
  30717. for (var i = 0; i <= n; a = b, ++i) {
  30718. b = merged[i];
  30719. if ((dλ = this.angle(a[1], b[0])) > best) {
  30720. best = dλ;
  30721. this.λ0 = b[0];
  30722. this.λ1 = a[1];
  30723. }
  30724. }
  30725. }
  30726. this.ranges = null;
  30727. this.range = null;
  30728. return (this.λ0 == Infinity || this.φ0 == Infinity) ? com_ibm_rave_core_internal_geo_SphericalBounds.NULL_BOUNDS : [[this.λ0, this.φ0], [this.λ1, this.φ1]];
  30729. }
  30730. });
  30731. com_ibm_rave_core_internal_geo_SphericalBounds.NULL_BOUNDS = [[NaN, NaN], [NaN, NaN]];
  30732. // $source: com/ibm/rave/core/internal/geo/SphericalCentroid
  30733. /************************************************************************
  30734. ** IBM Confidential
  30735. **
  30736. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  30737. **
  30738. ** (C) Copyright IBM Corp. 2015
  30739. **
  30740. ** The source code for this program is not published or otherwise divested of its trade secrets,
  30741. ** irrespective of what has been deposited with the U.S. Copyright Office.
  30742. ************************************************************************/
  30743. // GENERATED
  30744. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  30745. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (runtime) // new
  30746. //@import com/ibm/rave/core/geo/Geo (runtime) // Geo
  30747. //@import com/ibm/rave/core/internal/math/Trigonometry (runtime) // acos, asin
  30748. /**
  30749. */
  30750. var com_ibm_rave_core_internal_geo_SphericalCentroid = com_ibm_rave_core_nativeImpl_Declare({
  30751. //centroidStreamListener : null,
  30752. //centroidPoint : null,
  30753. //centroidLineStart : null,
  30754. //centroidLineStart_point : null,
  30755. //centroidLineStart_nextPoint : null,
  30756. //centroidLineEnd : null,
  30757. //polygonStart : null,
  30758. //polygonEnd : null,
  30759. //centroidRingStart : null,
  30760. //centroidRingStart_point : null,
  30761. //centroidRingStart_nextPoint : null,
  30762. //centroidRingStart_lineEnd : null,
  30763. centroidW0 : 0, centroidW1 : 0, centroidX0 : 0, centroidY0 : 0, centroidZ0 : 0, centroidX1 : 0, centroidY1 : 0, centroidZ1 : 0, centroidX2 : 0, centroidY2 : 0, centroidZ2 : 0,
  30764. ringStart_λ00 : 0, ringStart_φ00 : 0, ringStart_x0 : 0, ringStart_y0 : 0, ringStart_z0 : 0,
  30765. lineStart_x0 : 0, lineStart_y0 : 0, lineStart_z0 : 0,
  30766. constructor : function() {
  30767. this.centroidStreamListener = new com_ibm_rave_core_internal_geo_DelegatingStreamListener();
  30768. /**
  30769. */
  30770. {
  30771. var self = this;
  30772. this.centroidPoint = function(λ, φ, z) {
  30773. λ *= 0.017453292519943295;
  30774. var cosφ = Math.cos(φ *= 0.017453292519943295);
  30775. self.centroidPointXYZ(cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ));
  30776. };
  30777. this.centroidLineStart = function() {
  30778. self.lineStart_x0 = self.lineStart_y0 = self.lineStart_z0 = 0;
  30779. self.centroidStreamListener.pointDelegate = self.centroidLineStart_point;
  30780. };
  30781. this.centroidLineStart_point = function(λ, φ, z) {
  30782. λ *= 0.017453292519943295;
  30783. var cosφ = Math.cos(φ *= 0.017453292519943295);
  30784. self.lineStart_x0 = cosφ * Math.cos(λ);
  30785. self.lineStart_y0 = cosφ * Math.sin(λ);
  30786. self.lineStart_z0 = Math.sin(φ);
  30787. self.centroidStreamListener.pointDelegate = self.centroidLineStart_nextPoint;
  30788. self.centroidPointXYZ(self.lineStart_x0, self.lineStart_y0, self.lineStart_z0);
  30789. };
  30790. this.centroidLineStart_nextPoint = function(λ, φ, zz) {
  30791. λ *= 0.017453292519943295;
  30792. var cosφ = Math.cos(φ *= 0.017453292519943295);
  30793. var x = cosφ * Math.cos(λ);
  30794. var y = cosφ * Math.sin(λ);
  30795. var z = Math.sin(φ);
  30796. var temp;
  30797. var w = Math.atan2(Math.sqrt((temp = self.lineStart_y0 * z - self.lineStart_z0 * y) * temp + (temp = self.lineStart_z0 * x - self.lineStart_x0 * z) * temp + (temp = self.lineStart_x0 * y - self.lineStart_y0 * x) * temp), self.lineStart_x0 * x + self.lineStart_y0 * y + self.lineStart_z0 * z);
  30798. self.centroidW1 += w;
  30799. self.centroidX1 += w * (self.lineStart_x0 + (self.lineStart_x0 = x));
  30800. self.centroidY1 += w * (self.lineStart_y0 + (self.lineStart_y0 = y));
  30801. self.centroidZ1 += w * (self.lineStart_z0 + (self.lineStart_z0 = z));
  30802. self.centroidPointXYZ(self.lineStart_x0, self.lineStart_y0, self.lineStart_z0);
  30803. };
  30804. this.centroidLineEnd = function() {
  30805. self.centroidStreamListener.pointDelegate = self.centroidPoint;
  30806. };
  30807. this.polygonStart = function() {
  30808. self.centroidStreamListener.lineStartDelegate = self.centroidRingStart;
  30809. };
  30810. this.polygonEnd = function() {
  30811. self.centroidStreamListener.lineStartDelegate = self.centroidLineStart;
  30812. };
  30813. this.centroidRingStart = function() {
  30814. self.ringStart_λ00 = self.ringStart_φ00 = self.ringStart_x0 = self.ringStart_y0 = self.ringStart_z0 = 0;
  30815. self.centroidStreamListener.pointDelegate = self.centroidRingStart_point;
  30816. self.centroidStreamListener.lineEndDelegate = self.centroidRingStart_lineEnd;
  30817. };
  30818. this.centroidRingStart_point = function(λ, φ, z) {
  30819. self.ringStart_λ00 = λ;
  30820. self.ringStart_φ00 = φ;
  30821. self.centroidStreamListener.pointDelegate = self.centroidRingStart_nextPoint;
  30822. λ *= 0.017453292519943295;
  30823. var cosφ = Math.cos(φ *= 0.017453292519943295);
  30824. self.ringStart_x0 = cosφ * Math.cos(λ);
  30825. self.ringStart_y0 = cosφ * Math.sin(λ);
  30826. self.ringStart_z0 = Math.sin(φ);
  30827. self.centroidPointXYZ(self.ringStart_x0, self.ringStart_y0, self.ringStart_z0);
  30828. };
  30829. this.centroidRingStart_nextPoint = function(λ, φ, zz) {
  30830. λ *= 0.017453292519943295;
  30831. var cosφ = Math.cos(φ *= 0.017453292519943295), x = cosφ * Math.cos(λ), y = cosφ * Math.sin(λ), z = Math.sin(φ), cx = self.ringStart_y0 * z - self.ringStart_z0 * y, cy = self.ringStart_z0 * x - self.ringStart_x0 * z, cz = self.ringStart_x0 * y - self.ringStart_y0 * x, m = Math.sqrt(cx * cx + cy * cy + cz * cz), u = self.ringStart_x0 * x + self.ringStart_y0 * y + self.ringStart_z0 * z;
  30832. var v = (m == 0 || isNaN(m)) ? m : -com_ibm_rave_core_internal_math_Trigonometry.acos(u) / m;
  30833. var w = Math.atan2(m, u);
  30834. self.centroidX2 += v * cx;
  30835. self.centroidY2 += v * cy;
  30836. self.centroidZ2 += v * cz;
  30837. self.centroidW1 += w;
  30838. self.centroidX1 += w * (self.ringStart_x0 + (self.ringStart_x0 = x));
  30839. self.centroidY1 += w * (self.ringStart_y0 + (self.ringStart_y0 = y));
  30840. self.centroidZ1 += w * (self.ringStart_z0 + (self.ringStart_z0 = z));
  30841. self.centroidPointXYZ(self.ringStart_x0, self.ringStart_y0, self.ringStart_z0);
  30842. };
  30843. this.centroidRingStart_lineEnd = function() {
  30844. self.centroidRingStart_nextPoint(self.ringStart_λ00, self.ringStart_φ00, NaN);
  30845. self.centroidStreamListener.lineEndDelegate = self.centroidLineEnd;
  30846. self.centroidStreamListener.pointDelegate = self.centroidPoint;
  30847. };
  30848. this.centroidStreamListener.pointDelegate = this.centroidPoint;
  30849. this.centroidStreamListener.lineStartDelegate = this.centroidLineStart;
  30850. this.centroidStreamListener.lineEndDelegate = this.centroidLineEnd;
  30851. this.centroidStreamListener.polygonStartDelegate = this.polygonStart;
  30852. this.centroidStreamListener.polygonEndDelegate = this.polygonEnd;
  30853. }
  30854. },
  30855. centroidPointXYZ : function(x, y, z) {
  30856. ++this.centroidW0;
  30857. this.centroidX0 += (x - this.centroidX0) / this.centroidW0;
  30858. this.centroidY0 += (y - this.centroidY0) / this.centroidW0;
  30859. this.centroidZ0 += (z - this.centroidZ0) / this.centroidW0;
  30860. },
  30861. /**
  30862. * Returns the spherical centroid of the specified feature. See also path.centroid, which computes the projected centroid on the Cartesian plane.
  30863. * @param (Object) feature the GeoJSON object containing the feature whose area is computed
  30864. * @return (double[]) the point representing the centroid
  30865. */
  30866. calculateCentroid : function(feature) {
  30867. this.centroidW0 = this.centroidW1 = this.centroidX0 = this.centroidY0 = this.centroidZ0 = this.centroidX1 = this.centroidY1 = this.centroidZ1 = this.centroidX2 = this.centroidY2 = this.centroidZ2 = 0;
  30868. this.ringStart_λ00 = this.ringStart_φ00 = this.ringStart_x0 = this.ringStart_y0 = this.ringStart_z0 = 0;
  30869. this.lineStart_x0 = this.lineStart_y0 = this.lineStart_z0 = 0;
  30870. com_ibm_rave_core_geo_Geo.INSTANCE.stream(feature, this.centroidStreamListener);
  30871. var x = this.centroidX2;
  30872. var y = this.centroidY2;
  30873. var z = this.centroidZ2;
  30874. var m = x * x + y * y + z * z;
  30875. if (m < 1.0E-12) {
  30876. x = this.centroidX1;
  30877. y = this.centroidY1;
  30878. z = this.centroidZ1;
  30879. if (this.centroidW1 < 1.0E-6) {
  30880. x = this.centroidX0;
  30881. y = this.centroidY0;
  30882. z = this.centroidZ0;
  30883. }
  30884. m = x * x + y * y + z * z;
  30885. if (m < 1.0E-12) {
  30886. return com_ibm_rave_core_internal_geo_SphericalCentroid.NULL_CENTROID;
  30887. }
  30888. }
  30889. return [Math.atan2(y, x) * 57.29577951308232, com_ibm_rave_core_internal_math_Trigonometry.asin(z / Math.sqrt(m)) * 57.29577951308232];
  30890. }
  30891. });
  30892. com_ibm_rave_core_internal_geo_SphericalCentroid.NULL_CENTROID = [NaN, NaN];
  30893. // $source: com/ibm/rave/core/internal/geo/SphericalLength
  30894. /************************************************************************
  30895. ** IBM Confidential
  30896. **
  30897. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  30898. **
  30899. ** (C) Copyright IBM Corp. 2015
  30900. **
  30901. ** The source code for this program is not published or otherwise divested of its trade secrets,
  30902. ** irrespective of what has been deposited with the U.S. Copyright Office.
  30903. ************************************************************************/
  30904. // GENERATED
  30905. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  30906. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (runtime) // new
  30907. //@import com/ibm/rave/core/geo/Geo (runtime) // Geo
  30908. /**
  30909. */
  30910. var com_ibm_rave_core_internal_geo_SphericalLength = com_ibm_rave_core_nativeImpl_Declare({
  30911. //lengthStreamListener : null,
  30912. //lineStart : null,
  30913. //lineEnd : null,
  30914. //point : null,
  30915. //nextPoint : null,
  30916. λ0 : 0, sinφ0 : 0, cosφ0 : 0,
  30917. lengthSum : 0,
  30918. constructor : function() {
  30919. this.lengthStreamListener = new com_ibm_rave_core_internal_geo_DelegatingStreamListener();
  30920. /**
  30921. */
  30922. {
  30923. var self = this;
  30924. this.lineStart = function() {
  30925. self.λ0 = self.sinφ0 = self.cosφ0 = 0;
  30926. self.lengthStreamListener.pointDelegate = self.point;
  30927. self.lengthStreamListener.lineEndDelegate = self.lineEnd;
  30928. };
  30929. this.lineEnd = function() {
  30930. self.lengthStreamListener.pointDelegate = null;
  30931. self.lengthStreamListener.lineEndDelegate = null;
  30932. };
  30933. this.point = function(λ, φ, z) {
  30934. self.λ0 = λ * 0.017453292519943295;
  30935. self.sinφ0 = Math.sin(φ *= 0.017453292519943295);
  30936. self.cosφ0 = Math.cos(φ);
  30937. self.lengthStreamListener.pointDelegate = self.nextPoint;
  30938. };
  30939. this.nextPoint = function(λ, φ, z) {
  30940. var sinφ = Math.sin(φ *= 0.017453292519943295), cosφ = Math.cos(φ), t = Math.abs((λ *= 0.017453292519943295) - self.λ0), cosΔλ = Math.cos(t);
  30941. self.lengthSum += Math.atan2(Math.sqrt((t = cosφ * Math.sin(t)) * t + (t = self.cosφ0 * sinφ - self.sinφ0 * cosφ * cosΔλ) * t), self.sinφ0 * sinφ + self.cosφ0 * cosφ * cosΔλ);
  30942. self.λ0 = λ;
  30943. self.sinφ0 = sinφ;
  30944. self.cosφ0 = cosφ;
  30945. };
  30946. this.lengthStreamListener.lineStartDelegate = this.lineStart;
  30947. }
  30948. },
  30949. /**
  30950. * Returns the great-arc length of the specified feature in radians. For polygons, returns the perimeter of the exterior ring plus that of any interior rings.
  30951. * @param (Object) feature the GeoJSON object containing the feature whose length is computed
  30952. * @return (double) the great-arc length
  30953. */
  30954. calculateLength : function(feature) {
  30955. this.lengthSum = 0;
  30956. com_ibm_rave_core_geo_Geo.INSTANCE.stream(feature, this.lengthStreamListener);
  30957. return this.lengthSum;
  30958. }
  30959. });
  30960. // $source: com/ibm/rave/core/internal/geo/SphericalInterpolation
  30961. /************************************************************************
  30962. ** IBM Confidential
  30963. **
  30964. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  30965. **
  30966. ** (C) Copyright IBM Corp. 2015
  30967. **
  30968. ** The source code for this program is not published or otherwise divested of its trade secrets,
  30969. ** irrespective of what has been deposited with the U.S. Copyright Office.
  30970. ************************************************************************/
  30971. // GENERATED
  30972. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  30973. //@import com/ibm/rave/core/internal/math/Trigonometry (runtime) // haversin
  30974. var com_ibm_rave_core_internal_geo_SphericalInterpolation = com_ibm_rave_core_nativeImpl_Declare({
  30975. });
  30976. /**
  30977. * Returns an interpolator given the two locations a and b. Each location must be represented as a two-element array of [longitude, latitude]. The returned interpolator is a function which takes a single parameter t as input, where t ranges from 0 to 1. A value of 0 returns the location a, while a value of 1 returns the location b. Intermediate values interpolate from a to b along the spanning great arc.
  30978. * @param (double[]) source the first location
  30979. * @param (double[]) target the second location
  30980. * @return (com.ibm.rave.core.interpolate.Interpolator) the interpolator
  30981. */
  30982. com_ibm_rave_core_internal_geo_SphericalInterpolation.newInterpolator = function(source, target) {
  30983. var x0 = source[0] * 0.017453292519943295;
  30984. var y0 = source[1] * 0.017453292519943295;
  30985. var x1 = target[0] * 0.017453292519943295;
  30986. var y1 = target[1] * 0.017453292519943295;
  30987. var cy0 = Math.cos(y0), sy0 = Math.sin(y0), cy1 = Math.cos(y1), sy1 = Math.sin(y1), kx0 = cy0 * Math.cos(x0), ky0 = cy0 * Math.sin(x0), kx1 = cy1 * Math.cos(x1), ky1 = cy1 * Math.sin(x1), d = 2 * Math.asin(Math.sqrt(com_ibm_rave_core_internal_math_Trigonometry.haversin(y1 - y0) + cy0 * cy1 * com_ibm_rave_core_internal_math_Trigonometry.haversin(x1 - x0))), k = 1 / Math.sin(d);
  30988. if ((d)) {
  30989. return function(t) {
  30990. var B = Math.sin(t *= d) * k, A = Math.sin(d - t) * k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1;
  30991. return [Math.atan2(y, x) * 57.29577951308232, Math.atan2(z, Math.sqrt(x * x + y * y)) * 57.29577951308232];
  30992. };
  30993. }
  30994. return function(t) {
  30995. return [x0 * 57.29577951308232, y0 * 57.29577951308232];
  30996. };
  30997. };
  30998. // $source: com/ibm/rave/core/geo/CircleShapeGenerator
  30999. /************************************************************************
  31000. ** IBM Confidential
  31001. **
  31002. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  31003. **
  31004. ** (C) Copyright IBM Corp. 2015
  31005. **
  31006. ** The source code for this program is not published or otherwise divested of its trade secrets,
  31007. ** irrespective of what has been deposited with the U.S. Copyright Office.
  31008. ************************************************************************/
  31009. // GENERATED
  31010. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  31011. //@import com/ibm/rave/core/internal/geo/GeoShapeGeneratorUtil (runtime) // newCircleInterpolator
  31012. //@import com/ibm/rave/core/internal/geo/SphericalRotation (runtime) // rotation
  31013. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (runtime) // new
  31014. /**
  31015. * A class that is used to build a GeoJSON Polygon geometry object approximating a circle.
  31016. */
  31017. var com_ibm_rave_core_geo_CircleShapeGenerator = com_ibm_rave_core_nativeImpl_Declare({
  31018. //originObject : null,
  31019. //interpolator : null,
  31020. precisionValue : 0,
  31021. angleValue : 0,
  31022. _$functionClassMethod : function() {
  31023. var _$self = /**
  31024. * Builds a GeoJSON Polygon approximating a circle.
  31025. * @param (java.lang.Object[]) originArgs arguments passed by the caller that will be passed to the originValueFunction
  31026. * @return (Object) the GeoJson geometry object
  31027. */
  31028. function(originArgs) {
  31029. if (originArgs !== null || arguments.length > 1){
  31030. originArgs = Array.prototype.slice.call(arguments);
  31031. }
  31032. {
  31033. var center = (typeof _$self.originObject === "function") ? (_$self.originObject).apply((_$self.originObject), originArgs) : _$self.originObject;
  31034. var rotate = com_ibm_rave_core_internal_geo_SphericalRotation.rotation(-center[0] * 0.017453292519943295, -center[1] * 0.017453292519943295, 0);
  31035. var ring = [];
  31036. var coordinates = [];
  31037. coordinates.push(ring);
  31038. var listener = new com_ibm_rave_core_internal_geo_DelegatingStreamListener();
  31039. listener.pointDelegate = function(x, y, z) {
  31040. var invertedPoint = rotate.invert(x, y);
  31041. invertedPoint[0] *= 57.29577951308232;
  31042. invertedPoint[1] *= 57.29577951308232;
  31043. ring.push((((invertedPoint))));
  31044. };
  31045. if (_$self.interpolator) {
  31046. _$self.interpolator(null, null, 1, listener);
  31047. }
  31048. var json = {};
  31049. json["type"] = "Polygon";
  31050. json["coordinates"] = coordinates;
  31051. return json;
  31052. }
  31053. };
  31054. return _$self;
  31055. },
  31056. /**
  31057. * Return the current value of circle origin. Depending on how the client initialized this valuae, it could be either a simple x,y coordinates, or,a ValueFunction The default is a point whose coordinates are [0,0]
  31058. * @return (Object) the current value of the circle origin
  31059. */
  31060. origin$0 : function() {
  31061. return this.originObject;
  31062. },
  31063. /**
  31064. * Sets the coordinates of the circle origin
  31065. * @param (double[]) originPoint the x and y coordinates to use for the circle origin value
  31066. * @return (com.ibm.rave.core.geo.CircleShapeGenerator) this CircleShapeGenerator object itself
  31067. */
  31068. origin$1 : function(originPoint) {
  31069. this.originObject = originPoint;
  31070. return this;
  31071. },
  31072. /**
  31073. * Sets a value function to be used to figure out the origin of this circle
  31074. * @param (com.ibm.rave.core.geo.CircleShapeGenerator.ValueFunction) originFn the value function used to get circle origin
  31075. * @return (com.ibm.rave.core.geo.CircleShapeGenerator) this CircleShapeGenerator object itself
  31076. */
  31077. origin$2 : function(originFn) {
  31078. this.originObject = originFn;
  31079. return this;
  31080. },
  31081. /**
  31082. * Returns the current angular radius of the circle in degrees The default value is 90°
  31083. * @return (double) the angular radius of the circle in degrees
  31084. */
  31085. angle$0 : function() {
  31086. return this.angleValue;
  31087. },
  31088. /**
  31089. * Sets the angular radius of the circle in degrees
  31090. * @param (Object) x the value to set. The object could be either a Double or a string that parses to a Double number
  31091. * @return (com.ibm.rave.core.geo.CircleShapeGenerator) the angular radius of the circle in degrees
  31092. */
  31093. angle$1 : function(x) {
  31094. this.interpolator = com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.newCircleInterpolator((this.angleValue = + (x)) * 0.017453292519943295, this.precisionValue * 0.017453292519943295);
  31095. return this;
  31096. },
  31097. /**
  31098. * Returns the current precision value in degrees, which defaults to 6° Precision value is used when interpolating circle segments. These interpolated segments are inserted when a feature is clipped by the circle.
  31099. * @return (double) the precision value
  31100. */
  31101. precision$0 : function() {
  31102. return this.precisionValue;
  31103. },
  31104. /**
  31105. * Sets the current precision value in degrees. Precision value is used when interpolating circle segments. These interpolated segments are inserted when a feature is clipped by the circle.
  31106. * @return (com.ibm.rave.core.geo.CircleShapeGenerator) this CircleShapeGenerator object itself
  31107. */
  31108. precision$1 : function(x) {
  31109. this.interpolator = com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.newCircleInterpolator(this.angleValue * 0.017453292519943295, (this.precisionValue = + (x)) * 0.017453292519943295);
  31110. return this;
  31111. },
  31112. /** @expose */
  31113. origin : function(a0) {
  31114. var args = arguments;
  31115. if (args.length == 0) {
  31116. return this.origin$0();
  31117. }
  31118. if (args.length == 1 && typeof a0 === "function") {
  31119. return this.origin$2(a0);
  31120. }
  31121. return this.origin$1(a0);
  31122. },
  31123. /** @expose */
  31124. angle : function(a0) {
  31125. var args = arguments;
  31126. if (args.length == 0) {
  31127. return this.angle$0();
  31128. }
  31129. return this.angle$1(a0);
  31130. },
  31131. /** @expose */
  31132. precision : function(a0) {
  31133. var args = arguments;
  31134. if (args.length == 0) {
  31135. return this.precision$0();
  31136. }
  31137. return this.precision$1(a0);
  31138. }
  31139. //constructor : function() {}
  31140. });
  31141. /**
  31142. * Constructs and initialize the CircleShapeGenerator to default values
  31143. * @return (com.ibm.rave.core.geo.CircleShapeGenerator) the newly constructed CircleShapeGenerator object
  31144. */
  31145. com_ibm_rave_core_geo_CircleShapeGenerator.newCircleShapeGenerator = function() {
  31146. var circle = new com_ibm_rave_core_geo_CircleShapeGenerator();
  31147. circle.precisionValue = 6;
  31148. circle.originObject = com_ibm_rave_core_geo_CircleShapeGenerator.DEFAULT_ORIGIN;
  31149. circle.angle(90);
  31150. return circle;
  31151. };
  31152. com_ibm_rave_core_geo_CircleShapeGenerator.DEFAULT_ORIGIN = [0, 0];
  31153. // $source: com/ibm/rave/core/geo/GreatArcShapeGenerator
  31154. /************************************************************************
  31155. ** IBM Confidential
  31156. **
  31157. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  31158. **
  31159. ** (C) Copyright IBM Corp. 2015
  31160. **
  31161. ** The source code for this program is not published or otherwise divested of its trade secrets,
  31162. ** irrespective of what has been deposited with the U.S. Copyright Office.
  31163. ************************************************************************/
  31164. // GENERATED
  31165. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  31166. //@import com/ibm/rave/core/internal/geo/SphericalUtil (runtime) // calculateDistance
  31167. /**
  31168. * @deprecated use {type: "LineString"} or Rave.geo.distance instead.
  31169. */
  31170. var com_ibm_rave_core_geo_GreatArcShapeGenerator = com_ibm_rave_core_nativeImpl_Declare({
  31171. //sourceObject : null,
  31172. //targetObject : null,
  31173. _$functionClassMethod : function() {
  31174. var _$self = /**
  31175. * Builds a GeoJSON LineString approximating a great arc.
  31176. * @param (java.lang.Object[]) pointsArgs The value of pointArgs depends on the type of source and target objects. By default, GreatArcShapeGenerator initializes the source and target object to a ValueFunction that expects a GreatArcPointsStruct as a parameter, therefore, if the client never changed the source and target objects then the pointsArgs must be of type GreatArcPointsStruct. If, however, the client changed the source and target objects, then the pointsArgs could be unnecessary iff the source and target points are arrays of doubles or, it would be whatever arguments the client's ValueFunction expects.
  31177. * @return (Object) the GeoJson geometry object
  31178. */
  31179. function(pointsArgs) {
  31180. if (pointsArgs !== null || arguments.length > 1){
  31181. pointsArgs = Array.prototype.slice.call(arguments);
  31182. }
  31183. {
  31184. var source = (typeof _$self.sourceObject === "function") ? (_$self.sourceObject).apply((_$self.sourceObject), pointsArgs) : _$self.sourceObject;
  31185. var target = (typeof _$self.targetObject === "function") ? (_$self.targetObject).apply((_$self.targetObject), pointsArgs) : _$self.targetObject;
  31186. var coordinates = [];
  31187. coordinates.push((((source))));
  31188. coordinates.push((((target))));
  31189. var json = {};
  31190. json["type"] = "LineString";
  31191. json["coordinates"] = coordinates;
  31192. return json;
  31193. }
  31194. };
  31195. return _$self;
  31196. },
  31197. /**
  31198. */
  31199. constructor : function() {
  31200. this.sourceObject = function(pointsArgs) {
  31201. if (pointsArgs !== null || arguments.length > 1){
  31202. pointsArgs = Array.prototype.slice.call(arguments);
  31203. }
  31204. {
  31205. return (pointsArgs[0]).source;
  31206. }
  31207. };
  31208. this.targetObject = function(pointsArgs) {
  31209. if (pointsArgs !== null || arguments.length > 1){
  31210. pointsArgs = Array.prototype.slice.call(arguments);
  31211. }
  31212. {
  31213. return (pointsArgs[0]).target;
  31214. }
  31215. };
  31216. },
  31217. /**
  31218. * Calculates the distance between the source and target points
  31219. * @param (java.lang.Object[]) pointsArgs The value of pointArgs depends on the type of source and target objects. By default, GreatArcShapeGenerator initializes the source and target object to a ValueFunction that expects a GreatArcPointsStruct as a parameter, therefore, if the client never changed the source and target objects then the pointsArgs must be of type GreatArcPointsStruct. If, however, the client changed the source and target objects, then the pointsArgs could be unnecessary iff the source and target points are arrays of doubles or, it would be whatever arguments the client's ValueFunction expects.
  31220. * @return (double) the distance between the source and target point
  31221. */
  31222. /** @expose */
  31223. distance : function(pointsArgs) {
  31224. if (pointsArgs !== null || arguments.length > 1){
  31225. pointsArgs = Array.prototype.slice.call(arguments);
  31226. }
  31227. {
  31228. var source = (typeof this.sourceObject === "function") ? (this.sourceObject).apply((this.sourceObject), pointsArgs) : this.sourceObject;
  31229. var target = (typeof this.targetObject === "function") ? (this.targetObject).apply((this.targetObject), pointsArgs) : this.targetObject;
  31230. return com_ibm_rave_core_internal_geo_SphericalUtil.calculateDistance(source, target);
  31231. }
  31232. },
  31233. /**
  31234. * Return the current value of source point. Depending on how the client initialized this value, it could be either a simple array with x,y coordinates, or,a ValueFunction The default is ValueFunction that expects a GreatArcPointsStruct as a parameter
  31235. * @return (Object) the current value of the source point
  31236. */
  31237. source$0 : function() {
  31238. return this.sourceObject;
  31239. },
  31240. /**
  31241. * Sets the coordinates of the source point
  31242. * @param (double[]) sourcePoint the x and y coordinates to use for the source point value
  31243. * @return (com.ibm.rave.core.geo.GreatArcShapeGenerator) this GreatArcShapeGenerator object itself
  31244. */
  31245. source$1 : function(sourcePoint) {
  31246. this.sourceObject = sourcePoint;
  31247. return this;
  31248. },
  31249. /**
  31250. * Sets a value function to be used to figure out the source point value of this great arc
  31251. * @param (com.ibm.rave.core.geo.GreatArcShapeGenerator.ValueFunction) sourceFn the value function used to get source point
  31252. * @return (com.ibm.rave.core.geo.GreatArcShapeGenerator) this GreatArcShapeGenerator object itself
  31253. */
  31254. source$2 : function(sourceFn) {
  31255. this.sourceObject = sourceFn;
  31256. return this;
  31257. },
  31258. /**
  31259. * Return the current value of target point. Depending on how the client initialized this value, it could be either a simple array with x,y coordinates, or,a ValueFunction The default is ValueFunction that expects a GreatArcPointsStruct as a parameter
  31260. * @return (Object) the current value of the target point
  31261. */
  31262. target$0 : function() {
  31263. return this.targetObject;
  31264. },
  31265. /**
  31266. * Sets the coordinates of the target point
  31267. * @param (double[]) targetPoint the x and y coordinates to use for the source point value
  31268. * @return (com.ibm.rave.core.geo.GreatArcShapeGenerator) this GreatArcShapeGenerator object itself
  31269. */
  31270. target$1 : function(targetPoint) {
  31271. this.targetObject = targetPoint;
  31272. return this;
  31273. },
  31274. /**
  31275. * Sets a value function to be used to figure out the target point value of this great arc
  31276. * @param (com.ibm.rave.core.geo.GreatArcShapeGenerator.ValueFunction) targetFn the value function used to get target point
  31277. * @return (com.ibm.rave.core.geo.GreatArcShapeGenerator) this GreatArcShapeGenerator object itself
  31278. */
  31279. target$2 : function(targetFn) {
  31280. this.targetObject = targetFn;
  31281. return this;
  31282. },
  31283. /**
  31284. * This function is deprecated and has no impact. The precision value is always zero
  31285. * @return (com.ibm.rave.core.geo.GreatArcShapeGenerator) this GreatArcShapeGenerator object itself
  31286. * @deprecated
  31287. */
  31288. precision$0 : function(x) {
  31289. return this;
  31290. },
  31291. /**
  31292. * This function is deprecated. The precision value returned is always zero
  31293. * @return (double) the precision value always zero
  31294. * @deprecated
  31295. */
  31296. precision$1 : function() {
  31297. return 0;
  31298. },
  31299. /** @expose */
  31300. source : function(a0) {
  31301. var args = arguments;
  31302. if (args.length == 0) {
  31303. return this.source$0();
  31304. }
  31305. if (args.length == 1 && typeof a0 === "function") {
  31306. return this.source$2(a0);
  31307. }
  31308. return this.source$1(a0);
  31309. },
  31310. /** @expose */
  31311. target : function(a0) {
  31312. var args = arguments;
  31313. if (args.length == 0) {
  31314. return this.target$0();
  31315. }
  31316. if (args.length == 1 && typeof a0 === "function") {
  31317. return this.target$2(a0);
  31318. }
  31319. return this.target$1(a0);
  31320. },
  31321. /** @expose */
  31322. precision : function(a0) {
  31323. var args = arguments;
  31324. if (args.length == 0) {
  31325. return this.precision$1();
  31326. }
  31327. return this.precision$0(a0);
  31328. }
  31329. });
  31330. /**
  31331. * Constructs a GreatArcShapeGenerator
  31332. * @return (com.ibm.rave.core.geo.GreatArcShapeGenerator) the newly constructed GreatArcShapeGenerator object
  31333. */
  31334. com_ibm_rave_core_geo_GreatArcShapeGenerator.newGreatArcShapeGenerator = function() {
  31335. return new com_ibm_rave_core_geo_GreatArcShapeGenerator();
  31336. };
  31337. com_ibm_rave_core_geo_GreatArcShapeGenerator.GreatArcPointsStruct = rave_externs["GreatArcPointsStruct"] = com_ibm_rave_core_nativeImpl_Declare({
  31338. /** @expose */
  31339. source : null,
  31340. /** @expose */
  31341. target : null
  31342. });
  31343. // $source: com/ibm/rave/core/geo/GraticuleShapeGenerator
  31344. /************************************************************************
  31345. ** IBM Confidential
  31346. **
  31347. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  31348. **
  31349. ** (C) Copyright IBM Corp. 2015
  31350. **
  31351. ** The source code for this program is not published or otherwise divested of its trade secrets,
  31352. ** irrespective of what has been deposited with the U.S. Copyright Office.
  31353. ************************************************************************/
  31354. // GENERATED
  31355. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, bind
  31356. //@import com/ibm/rave/core/Rave (runtime) // range
  31357. //@import com/ibm/rave/core/internal/geo/GeoShapeGeneratorUtil (runtime) // graticuleX, graticuleY
  31358. /**
  31359. * A class that is used to build and MultiLineString geometry object representing all meridians and parallels for this graticule.
  31360. */
  31361. var com_ibm_rave_core_geo_GraticuleShapeGenerator = com_ibm_rave_core_nativeImpl_Declare({
  31362. //x : null, //y : null, //X : null, //Y : null,
  31363. x1 : 0, x0 : 0, X1 : 0, X0 : 0, y1 : 0, y0 : 0, Y1 : 0, Y0 : 0, dx : 0, dy : 0, DX : 0, DY : 0, precisionValue : 0,
  31364. _$functionClassMethod : function() {
  31365. var _$self = /**
  31366. * Builds a MultiLineString geometry object representing all meridians and parallels for this graticule.
  31367. * @return (Object) the GeoJson geometry object
  31368. */
  31369. function() {
  31370. var coordinates = (_$self.generateLines());
  31371. var json = {};
  31372. json["type"] = "MultiLineString";
  31373. json["coordinates"] = coordinates;
  31374. return json;
  31375. };
  31376. return _$self;
  31377. },
  31378. generateLines : function() {
  31379. var self = this;
  31380. var array_X = com_ibm_rave_core_Rave.range(Math.ceil(this.X0 / this.DX) * this.DX, this.X1, this.DX).map(function(currentValue, index, array) {
  31381. return self.X(+ (currentValue));
  31382. });
  31383. var array_Y = com_ibm_rave_core_Rave.range(Math.ceil(this.Y0 / this.DY) * this.DY, this.Y1, this.DY).map(function(currentValue, index, array) {
  31384. return self.Y(+ (currentValue));
  31385. });
  31386. var array_x = com_ibm_rave_core_Rave.range(Math.ceil(this.x0 / this.dx) * this.dx, this.x1, this.dx).filter(function(currentValue, index, array) {
  31387. return Math.abs(+ (currentValue) % self.DX) > 1.0E-6;
  31388. }).map(function(currentValue, index, array) {
  31389. return self.x(+ (currentValue));
  31390. });
  31391. var array_y = com_ibm_rave_core_Rave.range(Math.ceil(this.y0 / this.dy) * this.dy, this.y1, this.dy).filter(function(currentValue, index, array) {
  31392. return Math.abs(+ (currentValue) % self.DY) > 1.0E-6;
  31393. }).map(function(currentValue, index, array) {
  31394. return self.y(+ (currentValue));
  31395. });
  31396. return array_X.concat(array_Y, array_x, array_y);
  31397. },
  31398. /**
  31399. * Returns an array of LineString geometry objects, one for each meridian or parallel for this graticule.
  31400. * @return (Array) the array of LineString geometry objects
  31401. */
  31402. /** @expose */
  31403. lines : com_ibm_rave_core_nativeImpl_Declare.bind(function() {
  31404. return this.generateLines().map(function(currentValue, index, array) {
  31405. var coordinates = (currentValue);
  31406. var json = {};
  31407. json["type"] = "LineString";
  31408. json["coordinates"] = coordinates;
  31409. return json;
  31410. });
  31411. }),
  31412. /**
  31413. * Returns a Polygon geometry object representing the outline of this graticule, i.e. along the meridians and parallels defining its extent.
  31414. * @return (Object) the Polygon geometry object
  31415. */
  31416. /** @expose */
  31417. outline : com_ibm_rave_core_nativeImpl_Declare.bind(function() {
  31418. var coords = this.X(this.X0).concat(this.Y(this.Y1).slice(1), this.X(this.X1).reverse().slice(1), this.Y(this.Y0).reverse().slice(1));
  31419. var coordinates = [];
  31420. coordinates.push((coords));
  31421. var json = {};
  31422. json["type"] = "Polygon";
  31423. json["coordinates"] = coordinates;
  31424. return json;
  31425. }),
  31426. /**
  31427. * Returns the current minor extent
  31428. * @return (Array) the current minor extent
  31429. */
  31430. extent$0 : function() {
  31431. return this.minorExtent();
  31432. },
  31433. /**
  31434. * Sets the major and minor extents of this graticule.
  31435. * @param (Array) ext the extent value to set
  31436. * @return (com.ibm.rave.core.geo.GraticuleShapeGenerator) this GraticuleShapeGenerator object itself
  31437. */
  31438. extent$1 : function(ext) {
  31439. return this.majorExtent(ext).minorExtent(ext);
  31440. },
  31441. /**
  31442. * Returns the current major extent The default value of major extent is from [-180°, -90° + Trigonometry.ε] to [180°, 90° - Trigonometry.ε]
  31443. * @return (Array) the current major extent
  31444. */
  31445. majorExtent$0 : function() {
  31446. return [[this.X0, this.Y0], [this.X1, this.Y1]];
  31447. },
  31448. /**
  31449. * Sets the major extent of this graticule
  31450. * @param (Array) ext the extent value to set
  31451. * @return (com.ibm.rave.core.geo.GraticuleShapeGenerator) this GraticuleShapeGenerator object itself
  31452. */
  31453. majorExtent$1 : function(ext) {
  31454. this.X0 = + (ext[0][0]);
  31455. this.X1 = + (ext[1][0]);
  31456. this.Y0 = + (ext[0][1]);
  31457. this.Y1 = + (ext[1][1]);
  31458. if (this.X0 > this.X1) {
  31459. var temp = this.X0;
  31460. this.X0 = this.X1;
  31461. this.X1 = temp;
  31462. }
  31463. if (this.Y0 > this.Y1) {
  31464. var temp = this.Y0;
  31465. this.Y0 = this.Y1;
  31466. this.Y1 = temp;
  31467. }
  31468. return this.precision(this.precisionValue);
  31469. },
  31470. /**
  31471. * Returns the current minor extent The default value of minor extent is from [-180°, -80° - Trigonometry.ε] to [180°, 80° + Trigonometry.ε]
  31472. * @return (Array) the current minor extent
  31473. */
  31474. minorExtent$0 : function() {
  31475. return [[this.x0, this.y0], [this.x1, this.y1]];
  31476. },
  31477. /**
  31478. * Sets the minor extent of this graticule
  31479. * @param (Array) ext the extent value to set
  31480. * @return (com.ibm.rave.core.geo.GraticuleShapeGenerator) this GraticuleShapeGenerator object itself
  31481. */
  31482. minorExtent$1 : function(ext) {
  31483. this.x0 = + (ext[0][0]);
  31484. this.x1 = + (ext[1][0]);
  31485. this.y0 = + (ext[0][1]);
  31486. this.y1 = + (ext[1][1]);
  31487. if (this.x0 > this.x1) {
  31488. var temp = this.x0;
  31489. this.x0 = this.x1;
  31490. this.x1 = temp;
  31491. }
  31492. if (this.y0 > this.y1) {
  31493. var temp = this.y0;
  31494. this.y0 = this.y1;
  31495. this.y1 = temp;
  31496. }
  31497. return this.precision(this.precisionValue);
  31498. },
  31499. /**
  31500. * Returns the current minor step
  31501. * @return (Array) the current minor step
  31502. */
  31503. step$0 : function() {
  31504. return this.minorStep();
  31505. },
  31506. /**
  31507. * Sets the major and minor step point (DX,DY) for this graticule
  31508. * @param (Array) s the step value to use
  31509. * @return (com.ibm.rave.core.geo.GraticuleShapeGenerator) this GraticuleShapeGenerator object itself
  31510. */
  31511. step$1 : function(s) {
  31512. return this.majorStep(s).minorStep(s);
  31513. },
  31514. /**
  31515. * Returns the current major step The default value is [90°, 360°]
  31516. * @return (Array) the current major step
  31517. */
  31518. majorStep$0 : function() {
  31519. return [this.DX, this.DY];
  31520. },
  31521. /**
  31522. * Sets the major step for this graticule
  31523. * @param (Array) s the step value to set
  31524. * @return (com.ibm.rave.core.geo.GraticuleShapeGenerator) this GraticuleShapeGenerator object itself
  31525. */
  31526. majorStep$1 : function(s) {
  31527. this.DX = + (s[0]);
  31528. this.DY = + (s[1]);
  31529. return this;
  31530. },
  31531. /**
  31532. * Returns the current minor step The default value is [10°, 10°]
  31533. * @return (Array) the current minor step
  31534. */
  31535. minorStep$0 : function() {
  31536. return [this.dx, this.dy];
  31537. },
  31538. /**
  31539. * Sets the minor step for this graticule
  31540. * @param (Array) s the step value to set
  31541. * @return (com.ibm.rave.core.geo.GraticuleShapeGenerator) this GraticuleShapeGenerator object itself
  31542. */
  31543. minorStep$1 : function(s) {
  31544. this.dx = + (s[0]);
  31545. this.dy = + (s[1]);
  31546. return this;
  31547. },
  31548. /**
  31549. * Returns the current precision, which defaults to 2.5°
  31550. * @return (double) the current precision
  31551. */
  31552. precision$0 : function() {
  31553. return this.precisionValue;
  31554. },
  31555. /**
  31556. * Sets the precision for this graticule, in degrees
  31557. * @param (double) p the precision value to set
  31558. * @return (com.ibm.rave.core.geo.GraticuleShapeGenerator) this GraticuleShapeGenerator object itself
  31559. */
  31560. precision$1 : function(p) {
  31561. this.precisionValue = + (p);
  31562. this.x = com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.graticuleX(this.y0, this.y1, 90);
  31563. this.y = com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.graticuleY(this.x0, this.x1, this.precisionValue);
  31564. this.X = com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.graticuleX(this.Y0, this.Y1, 90);
  31565. this.Y = com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.graticuleY(this.X0, this.X1, this.precisionValue);
  31566. return this;
  31567. },
  31568. /** @expose */
  31569. extent : function(a0) {
  31570. var args = arguments;
  31571. if (args.length == 0) {
  31572. return this.extent$0();
  31573. }
  31574. return this.extent$1(a0);
  31575. },
  31576. /** @expose */
  31577. majorExtent : function(a0) {
  31578. var args = arguments;
  31579. if (args.length == 0) {
  31580. return this.majorExtent$0();
  31581. }
  31582. return this.majorExtent$1(a0);
  31583. },
  31584. /** @expose */
  31585. minorExtent : function(a0) {
  31586. var args = arguments;
  31587. if (args.length == 0) {
  31588. return this.minorExtent$0();
  31589. }
  31590. return this.minorExtent$1(a0);
  31591. },
  31592. /** @expose */
  31593. step : function(a0) {
  31594. var args = arguments;
  31595. if (args.length == 0) {
  31596. return this.step$0();
  31597. }
  31598. return this.step$1(a0);
  31599. },
  31600. /** @expose */
  31601. majorStep : function(a0) {
  31602. var args = arguments;
  31603. if (args.length == 0) {
  31604. return this.majorStep$0();
  31605. }
  31606. return this.majorStep$1(a0);
  31607. },
  31608. /** @expose */
  31609. minorStep : function(a0) {
  31610. var args = arguments;
  31611. if (args.length == 0) {
  31612. return this.minorStep$0();
  31613. }
  31614. return this.minorStep$1(a0);
  31615. },
  31616. /** @expose */
  31617. precision : function(a0) {
  31618. var args = arguments;
  31619. if (args.length == 0) {
  31620. return this.precision$0();
  31621. }
  31622. return this.precision$1(a0);
  31623. }
  31624. //constructor : function() {}
  31625. });
  31626. /**
  31627. * Constructs and initialize the GraticuleShapeGenerator to default values
  31628. * @return (com.ibm.rave.core.geo.GraticuleShapeGenerator) the newly constructed GraticuleShapeGenerator object
  31629. */
  31630. com_ibm_rave_core_geo_GraticuleShapeGenerator.newGraticuleShapeGenerator = function() {
  31631. var graticule = new com_ibm_rave_core_geo_GraticuleShapeGenerator();
  31632. graticule.dx = 10;
  31633. graticule.dy = 10;
  31634. graticule.DX = 90;
  31635. graticule.DY = 360;
  31636. graticule.precisionValue = 2.5;
  31637. graticule.majorExtent([[-180.0, -90.0 + 1.0E-6], [180.0, 90.0 - 1.0E-6]]);
  31638. return graticule.minorExtent([[-180.0, -80.0 - 1.0E-6], [180.0, 80.0 + 1.0E-6]]);
  31639. };
  31640. // $source: com/ibm/rave/core/geo/ClipExtentStreamListenerTransform
  31641. /************************************************************************
  31642. ** IBM Confidential
  31643. **
  31644. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  31645. **
  31646. ** (C) Copyright IBM Corp. 2015
  31647. **
  31648. ** The source code for this program is not published or otherwise divested of its trade secrets,
  31649. ** irrespective of what has been deposited with the U.S. Copyright Office.
  31650. ************************************************************************/
  31651. // GENERATED
  31652. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  31653. //@import com/ibm/rave/core/internal/geo/ClipUtil (runtime) // newClipExtentStreamListenerFactory
  31654. /**
  31655. * A class representing a stream transform that implements axis-aligned rectangle clipping. This is typically used to clip geometry to the viewport after projecting.
  31656. */
  31657. var com_ibm_rave_core_geo_ClipExtentStreamListenerTransform = com_ibm_rave_core_nativeImpl_Declare({
  31658. //transformListener : null,
  31659. //clip : null,
  31660. x0 : 0, y0 : 0, x1 : 0, y1 : 0,
  31661. /**
  31662. * create the transformListener given a streamListener
  31663. * @param (com.ibm.rave.core.geo.StreamListener) listener
  31664. * @return (com.ibm.rave.core.geo.TransformStreamListener) transformListener
  31665. */
  31666. /** @expose */
  31667. stream : function(listener) {
  31668. if (this.transformListener) {
  31669. this.transformListener.valid = false;
  31670. }
  31671. this.transformListener = this.clip(listener);
  31672. this.transformListener.valid = true;
  31673. return this.transformListener;
  31674. },
  31675. /**
  31676. * Sets the clip extent to the specified rectangle [​[x0, y0], [x1, y1]​]
  31677. * @param (Array) ext the upper and lower corners of the clipping rectangle to use
  31678. * @return (com.ibm.rave.core.geo.ClipExtentStreamListenerTransform) the this clip extent transform object itself
  31679. */
  31680. extent$0 : function(ext) {
  31681. this.clip = com_ibm_rave_core_internal_geo_ClipUtil.newClipExtentStreamListenerFactory(this.x0 = + (ext[0][0]), this.y0 = + (ext[0][1]), this.x1 = + (ext[1][0]), this.y1 = + (ext[1][1]));
  31682. if (this.transformListener) {
  31683. this.transformListener.valid = false;
  31684. this.transformListener = null;
  31685. }
  31686. return this;
  31687. },
  31688. /**
  31689. * Returns the current clip extent, which defaults to [​[0, 0], [960, 500]​].
  31690. * @return (Array) current clip extent
  31691. */
  31692. extent$1 : function() {
  31693. return [[this.x0, this.y0], [this.x1, this.y1]];
  31694. },
  31695. /** @expose */
  31696. extent : function(a0) {
  31697. var args = arguments;
  31698. if (args.length == 0) {
  31699. return this.extent$1();
  31700. }
  31701. return this.extent$0(a0);
  31702. }
  31703. /**
  31704. */
  31705. //constructor : function() {}
  31706. });
  31707. /**
  31708. * Create a new stream transform that implements axis-aligned rectangle clipping. This is typically used to clip geometry to the viewport after projecting.
  31709. * @return (com.ibm.rave.core.geo.ClipExtentStreamListenerTransform) the newly created clip extent
  31710. */
  31711. /** @expose */
  31712. com_ibm_rave_core_geo_ClipExtentStreamListenerTransform.newClipExtent = function() {
  31713. var clipExtent = new com_ibm_rave_core_geo_ClipExtentStreamListenerTransform();
  31714. return clipExtent.extent([[0.0, 0.0], [960.0, 500.0]]);
  31715. };
  31716. // $source: com/ibm/rave/core/internal/geo/AlbersUsaProjection
  31717. /************************************************************************
  31718. ** IBM Confidential
  31719. **
  31720. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  31721. **
  31722. ** (C) Copyright IBM Corp. 2015
  31723. **
  31724. ** The source code for this program is not published or otherwise divested of its trade secrets,
  31725. ** irrespective of what has been deposited with the U.S. Copyright Office.
  31726. ************************************************************************/
  31727. // GENERATED
  31728. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  31729. //@import com/ibm/rave/core/internal/geo/ConicProjectionFactoryImpl (runtime) // newConicEqualAreaProjectionFactory
  31730. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (runtime) // new
  31731. //@import com/ibm/rave/core/geo/StreamListener (runtime) // StreamListener
  31732. //@import com/ibm/rave/core/internal/geo/TransformStreamListenerImpl (runtime) // new
  31733. /**
  31734. */
  31735. var com_ibm_rave_core_internal_geo_AlbersUsaProjection = com_ibm_rave_core_nativeImpl_Declare({
  31736. //point : null,
  31737. //lower48 : null, //alaska : null, //hawaii : null,
  31738. //pointStream : null,
  31739. //lower48Point : null, //alaskaPoint : null, //hawaiiPoint : null,
  31740. _$functionClassMethod : function() {
  31741. var _$self = function(coordinates) {
  31742. var x = coordinates[0], y = coordinates[1];
  31743. _$self.point = null;
  31744. _$self.lower48Point(x, y, NaN);
  31745. if (_$self.point) {
  31746. return _$self.point;
  31747. }
  31748. _$self.alaskaPoint(x, y, NaN);
  31749. if (_$self.point) {
  31750. return _$self.point;
  31751. }
  31752. _$self.hawaiiPoint(x, y, NaN);
  31753. return _$self.point;
  31754. };
  31755. return _$self;
  31756. },
  31757. /**
  31758. */
  31759. constructor : function() {
  31760. var self = this;
  31761. this.lower48 = com_ibm_rave_core_internal_geo_AlbersUsaProjection.newAlbersProjection();
  31762. var cea = com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl.newConicEqualAreaProjectionFactory()();
  31763. cea.rotate([154.0, 0.0]).center([-2.0, 58.5]);
  31764. cea.parallels([55.0, 65.0]);
  31765. this.alaska = cea;
  31766. cea = com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl.newConicEqualAreaProjectionFactory()();
  31767. cea.rotate([157.0, 0.0]).center([-3.0, 19.9]);
  31768. cea.parallels([8.0, 18.0]);
  31769. this.hawaii = cea;
  31770. this.pointStream = new com_ibm_rave_core_internal_geo_DelegatingStreamListener();
  31771. this.pointStream.pointDelegate = function(x, y, z) {
  31772. self.point = [x, y];
  31773. };
  31774. },
  31775. rotate$0 : function() {
  31776. throw new Error();
  31777. },
  31778. rotate$1 : function(rotation) {
  31779. throw new Error();
  31780. },
  31781. center$0 : function() {
  31782. throw new Error();
  31783. },
  31784. center$1 : function(c) {
  31785. throw new Error();
  31786. },
  31787. clipAngle$0 : function() {
  31788. throw new Error();
  31789. },
  31790. clipAngle$1 : function(a) {
  31791. throw new Error();
  31792. },
  31793. clipExtent$0 : function() {
  31794. throw new Error();
  31795. },
  31796. clipExtent$1 : function(e) {
  31797. throw new Error();
  31798. },
  31799. /** @expose */
  31800. invert : function(coordinates) {
  31801. var k = this.lower48.scale();
  31802. var t = this.lower48.translate();
  31803. var x = (coordinates[0] - t[0]) / k;
  31804. var y = (coordinates[1] - t[1]) / k;
  31805. return (y >= .120 && y < .234 && x >= -.425 && x < -.214 ? this.alaska : y >= .166 && y < .234 && x >= -.214 && x < -.115 ? this.hawaii : this.lower48).invert(coordinates);
  31806. },
  31807. translate$0 : function() {
  31808. return this.lower48.translate();
  31809. },
  31810. translate$1 : function(t) {
  31811. var k = this.lower48.scale();
  31812. var x = + (t[0]);
  31813. var y = + (t[1]);
  31814. this.lower48Point = this.lower48.translate(t).clipExtent([[x - .455 * k, y - .238 * k], [x + .455 * k, y + .238 * k]]).stream(this.pointStream).pointDelegate;
  31815. this.alaskaPoint = this.alaska.translate([x - .307 * k, y + .201 * k]).clipExtent([[x - .425 * k + 1.0E-6, y + .120 * k + 1.0E-6], [x - .214 * k - 1.0E-6, y + .234 * k - 1.0E-6]]).stream(this.pointStream).pointDelegate;
  31816. this.hawaiiPoint = this.hawaii.translate([x - .205 * k, y + .212 * k]).clipExtent([[x - .214 * k + 1.0E-6, y + .166 * k + 1.0E-6], [x - .115 * k - 1.0E-6, y + .234 * k - 1.0E-6]]).stream(this.pointStream).pointDelegate;
  31817. return this;
  31818. },
  31819. scale$0 : function() {
  31820. return this.lower48.scale();
  31821. },
  31822. scale$1 : function(s) {
  31823. this.lower48.scale(s);
  31824. this.alaska.scale(+ (s) * .35);
  31825. this.hawaii.scale(s);
  31826. return this.translate$1(this.lower48.translate());
  31827. },
  31828. precision$0 : function() {
  31829. return this.lower48.precision();
  31830. },
  31831. precision$1 : function(p) {
  31832. this.lower48.precision(p);
  31833. this.alaska.precision(p);
  31834. this.hawaii.precision(p);
  31835. return this;
  31836. },
  31837. /** @expose */
  31838. stream : function(listener) {
  31839. var lower48Stream = this.lower48.stream(listener), alaskaStream = this.alaska.stream(listener), hawaiiStream = this.hawaii.stream(listener);
  31840. var delegates = {};
  31841. delegates["point"] = function(x, y, z) {
  31842. lower48Stream.point(x, y, z);
  31843. alaskaStream.point(x, y, z);
  31844. hawaiiStream.point(x, y, z);
  31845. };
  31846. delegates["sphere"] = function() {
  31847. lower48Stream.sphere();
  31848. alaskaStream.sphere();
  31849. hawaiiStream.sphere();
  31850. };
  31851. delegates["lineStart"] = function() {
  31852. lower48Stream.lineStart();
  31853. alaskaStream.lineStart();
  31854. hawaiiStream.lineStart();
  31855. };
  31856. delegates["lineEnd"] = function() {
  31857. lower48Stream.lineEnd();
  31858. alaskaStream.lineEnd();
  31859. hawaiiStream.lineEnd();
  31860. };
  31861. delegates[com_ibm_rave_core_geo_StreamListener.polygonStartHandler] = function() {
  31862. lower48Stream.polygonStart();
  31863. alaskaStream.polygonStart();
  31864. hawaiiStream.polygonStart();
  31865. };
  31866. delegates["polygonEnd"] = function() {
  31867. lower48Stream.polygonEnd();
  31868. alaskaStream.polygonEnd();
  31869. hawaiiStream.polygonEnd();
  31870. };
  31871. return new com_ibm_rave_core_internal_geo_TransformStreamListenerImpl(listener, delegates);
  31872. },
  31873. /** @expose */
  31874. supportInversion : function() {
  31875. return true;
  31876. },
  31877. /** @expose */
  31878. supportStreaming : function() {
  31879. return true;
  31880. },
  31881. /** @expose */
  31882. rotate : function(a0) {
  31883. var args = arguments;
  31884. if (args.length == 0) {
  31885. return this.rotate$0();
  31886. }
  31887. return this.rotate$1(a0);
  31888. },
  31889. /** @expose */
  31890. center : function(a0) {
  31891. var args = arguments;
  31892. if (args.length == 0) {
  31893. return this.center$0();
  31894. }
  31895. return this.center$1(a0);
  31896. },
  31897. /** @expose */
  31898. clipAngle : function(a0) {
  31899. var args = arguments;
  31900. if (args.length == 0) {
  31901. return this.clipAngle$0();
  31902. }
  31903. return this.clipAngle$1(a0);
  31904. },
  31905. /** @expose */
  31906. clipExtent : function(a0) {
  31907. var args = arguments;
  31908. if (args.length == 0) {
  31909. return this.clipExtent$0();
  31910. }
  31911. return this.clipExtent$1(a0);
  31912. },
  31913. /** @expose */
  31914. translate : function(a0) {
  31915. var args = arguments;
  31916. if (args.length == 0) {
  31917. return this.translate$0();
  31918. }
  31919. return this.translate$1(a0);
  31920. },
  31921. /** @expose */
  31922. scale : function(a0) {
  31923. var args = arguments;
  31924. if (args.length == 0) {
  31925. return this.scale$0();
  31926. }
  31927. return this.scale$1(a0);
  31928. },
  31929. /** @expose */
  31930. precision : function(a0) {
  31931. var args = arguments;
  31932. if (args.length == 0) {
  31933. return this.precision$0();
  31934. }
  31935. return this.precision$1(a0);
  31936. }
  31937. });
  31938. com_ibm_rave_core_internal_geo_AlbersUsaProjection.newAlbersUsaProjection = function() {
  31939. var a = new com_ibm_rave_core_internal_geo_AlbersUsaProjection();
  31940. a.scale$1(1070);
  31941. return a;
  31942. };
  31943. com_ibm_rave_core_internal_geo_AlbersUsaProjection.newAlbersProjection = function() {
  31944. var cea = com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl.newConicEqualAreaProjectionFactory()();
  31945. cea.rotate([96.0, 0.0]).center([-.6, 38.7]);
  31946. cea.parallels([29.5, 45.5]).scale(1070);
  31947. return cea;
  31948. };
  31949. // $source: com/ibm/rave/core/geo/Geo
  31950. /************************************************************************
  31951. ** IBM Confidential
  31952. **
  31953. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  31954. **
  31955. ** (C) Copyright IBM Corp. 2015
  31956. **
  31957. ** The source code for this program is not published or otherwise divested of its trade secrets,
  31958. ** irrespective of what has been deposited with the U.S. Copyright Office.
  31959. ************************************************************************/
  31960. // GENERATED
  31961. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  31962. //@import com/ibm/rave/core/RegistryService (loadtime) // superclass
  31963. //@import com/ibm/rave/core/internal/geo/MercatorPlaneProjectionFactory (runtime) // MercatorPlaneProjectionFactory
  31964. //@import com/ibm/rave/core/internal/geo/TransverseMercatorProjectionFactory (runtime) // TransverseMercatorProjectionFactory
  31965. //@import com/ibm/rave/core/internal/geo/PlaneProjectionFactoryImpl (runtime) // newAzimuthalEquidistantProjectionFactory, newAzimuthalEqualAreaProjectionFactory, newWinkelTripelProjectionFactory, newOrthographicProjectionFactory, newStereographicProjectionFactory, newGnomonicProjectionFactory, newEquirectangularProjectionFactory
  31966. //@import com/ibm/rave/core/internal/geo/ConicProjectionFactoryImpl (runtime) // newConicEqualAreaProjectionFactory, newConicConformalProjectionFactory, newConicEquidistantProjectionFactory
  31967. //@import com/ibm/rave/core/internal/geo/Stream (runtime) // Stream
  31968. //@import com/ibm/rave/core/internal/geo/SphericalArea (runtime) // new
  31969. //@import com/ibm/rave/core/internal/geo/SphericalBounds (runtime) // new
  31970. //@import com/ibm/rave/core/internal/geo/SphericalCentroid (runtime) // new
  31971. //@import com/ibm/rave/core/internal/geo/SphericalUtil (loadtime) // calculateDistance
  31972. //@import com/ibm/rave/core/internal/geo/SphericalLength (runtime) // new
  31973. //@import com/ibm/rave/core/internal/geo/SphericalInterpolation (loadtime) // newInterpolator
  31974. //@import com/ibm/rave/core/internal/geo/SphericalRotation (loadtime) // newRotator
  31975. //@import com/ibm/rave/core/geo/CircleShapeGenerator (loadtime) // newCircleShapeGenerator
  31976. //@import com/ibm/rave/core/geo/GreatArcShapeGenerator (loadtime) // newGreatArcShapeGenerator
  31977. //@import com/ibm/rave/core/geo/GraticuleShapeGenerator (loadtime) // newGraticuleShapeGenerator
  31978. //@import com/ibm/rave/core/geo/TransformStreamListenerFactory (loadtime) // create
  31979. //@import com/ibm/rave/core/geo/ClipExtentStreamListenerTransform (loadtime) // newClipExtent
  31980. //@import com/ibm/rave/core/internal/geo/ProjectionImpl (loadtime) // newProjection
  31981. //@import com/ibm/rave/core/internal/geo/ProjectionMutatorImpl (loadtime) // newProjectionMutator
  31982. //@import com/ibm/rave/core/internal/geo/AlbersUsaProjection (loadtime) // newAlbersUsaProjection, newAlbersProjection
  31983. //@import com/ibm/rave/core/internal/geo/GeoPathGeneratorImpl (runtime) // newGeoPathGenerator
  31984. /**
  31985. * The Geography component. A collection of various functions used to project spherical coordinates, latitude & longitude math Used primarily to generate paths to draw maps as specified in GeoJSON objects.
  31986. */
  31987. var com_ibm_rave_core_geo_Geo = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_RegistryService, {
  31988. /**
  31989. * A projection factory that constructs Mercator projection The spherical Mercator projection is commonly used by tiled mapping libraries. It is conformal; however, it introduces severe area distortion at world scale and thus is not recommended for choropleths.
  31990. */
  31991. /** @expose */
  31992. mercator : null,
  31993. /**
  31994. * A projection factory that constructs a transverse Mercator projection
  31995. */
  31996. /** @expose */
  31997. transverseMercator : null,
  31998. /**
  31999. * A projection factory that constructs an azimuthal equal-area projection which is suitable for choropleths
  32000. */
  32001. /** @expose */
  32002. azimuthalEqualArea : null,
  32003. /**
  32004. * A projection factory that constructs azimuthal equidistant projection which preserves distances from the projection’s center: the distance from any projected point to the projection’s center is proportional to the great arc distance. Thus, circles around the projection’s center are projected to circles on the Cartesian plane. This can be useful for visualizing distances relative to a point of reference, such as commute distances.
  32005. */
  32006. /** @expose */
  32007. azimuthalEquidistant : null,
  32008. /**
  32009. * A projection factory that constructs an equal-distance (from some standard point or line) conic projection.
  32010. */
  32011. /** @expose */
  32012. conicEquidistant : null,
  32013. /**
  32014. * A projection factory that constrcuts Lambert’s conformal conic projection which projects the globe conformally onto a cone. Conformal, or orthomorphic, map projections preserve angles locally, implying that they map infinitesimal circles of constant size anywhere on the Earth to infinitesimal circles of varying sizes on the map
  32015. */
  32016. /** @expose */
  32017. conicConformal : null,
  32018. /**
  32019. * A projection factory that constructs an equal-area conic projection. This kind of projection is recommended for choropleths as it preserves the relative areas of geographic features.
  32020. */
  32021. /** @expose */
  32022. conicEqualArea : null,
  32023. /**
  32024. * A projection factory that constructs an equirectangular projection. The equirectangular, or plate carrée projection, is the simplest possible geographic projection: the identity function. It is neither equal-area nor conformal, but is sometimes used for raster data.
  32025. */
  32026. /** @expose */
  32027. equirectangular : null,
  32028. /**
  32029. * A projection factory that constructs a stereographic projection. The stereographic projection is another perspective (azimuthal) projection. The point of perspective is on the surface of the sphere, looking in; it is thus commonly used for celestial charts
  32030. */
  32031. /** @expose */
  32032. stereographic : null,
  32033. /**
  32034. * A projection factory that constructs an orthographic projection. The orthographic projection is an azimuthal projection suitable for displaying a single hemisphere; the point of perspective is at infinity
  32035. */
  32036. /** @expose */
  32037. orthographic : null,
  32038. /**
  32039. * A projection factory that constructs a gnomonic projection. The gnomonic projection is an azimuthal projection that projects great circles as straight lines
  32040. */
  32041. /** @expose */
  32042. gnomonic : null,
  32043. /**
  32044. * A projection factory that constructs Winkel Tripel projection.
  32045. */
  32046. /** @expose */
  32047. winkel3 : null,
  32048. constructor : function() {
  32049. this.mercator = com_ibm_rave_core_internal_geo_MercatorPlaneProjectionFactory.INSTANCE;
  32050. this.transverseMercator = com_ibm_rave_core_internal_geo_TransverseMercatorProjectionFactory.INSTANCE;
  32051. this.azimuthalEqualArea = com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newAzimuthalEqualAreaProjectionFactory();
  32052. this.azimuthalEquidistant = com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newAzimuthalEquidistantProjectionFactory();
  32053. this.conicEquidistant = com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl.newConicEquidistantProjectionFactory();
  32054. this.conicConformal = com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl.newConicConformalProjectionFactory();
  32055. this.conicEqualArea = com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl.newConicEqualAreaProjectionFactory();
  32056. this.equirectangular = com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newEquirectangularProjectionFactory();
  32057. this.stereographic = com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newStereographicProjectionFactory();
  32058. this.orthographic = com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newOrthographicProjectionFactory();
  32059. this.gnomonic = com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newGnomonicProjectionFactory();
  32060. this.winkel3 = com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newWinkelTripelProjectionFactory();
  32061. },
  32062. /**
  32063. * Starts the streaming process by reading the passed GeoJSON object and invoking the pertinent listener method as it traverses GeoJSON object's features, geometry and sub objects, e.g., point, sphere etc.
  32064. * @param (Object) json The GeoJSON object to stream. (A feature or geometry JSON object could be passed as well)
  32065. * @param (com.ibm.rave.core.geo.StreamListener) listener The listener to be whose methods are to be invoked as the GeoJSON object is processed
  32066. * @see (com.ibm.rave.core.internal.geo.Stream) Stream
  32067. * @see (com.ibm.rave.core.geo.StreamListener) StreamListener
  32068. */
  32069. /** @expose */
  32070. stream : function(json, listener) {
  32071. com_ibm_rave_core_internal_geo_Stream.INSTANCE.stream(json, listener);
  32072. },
  32073. /**
  32074. * Returns the spherical area of the specified feature in steradians. See also path.area, which computes the projected area on the Cartesian plane
  32075. * @param (Object) json the GeoJSON object containing the feature whose area is computed
  32076. * @return (double) the area in steradians (The unit of solid angle)
  32077. */
  32078. /** @expose */
  32079. area : function(json) {
  32080. var sphericalArea = new com_ibm_rave_core_internal_geo_SphericalArea();
  32081. return sphericalArea.calculateArea(json);
  32082. },
  32083. /**
  32084. * Returns the spherical bounding box for the specified feature. The bounding box is represented by a two-dimensional array: [​[left, bottom], [right, top]​], where left is the minimum longitude, bottom is the minimum latitude, right is maximum longitude, and top is the maximum latitude. See also path.bounds, which computes the projected bounding box on the Cartesian plane.
  32085. * @param (Object) feature the GeoJSON object containing the feature whose bounds are computed
  32086. * @return (double[][]) the spherical bounding box
  32087. */
  32088. /** @expose */
  32089. bounds : function(feature) {
  32090. var sphericalBounds = new com_ibm_rave_core_internal_geo_SphericalBounds();
  32091. return sphericalBounds.calculateBounds(feature);
  32092. },
  32093. /**
  32094. * Returns the spherical centroid of the specified feature. See also path.centroid, which computes the projected centroid on the Cartesian plane.
  32095. * @param (Object) feature the GeoJSON object containing the feature whose centroid is computed
  32096. * @return (double[]) the point representing the centroid
  32097. */
  32098. /** @expose */
  32099. centroid : function(feature) {
  32100. var sphericalCentroid = new com_ibm_rave_core_internal_geo_SphericalCentroid();
  32101. return sphericalCentroid.calculateCentroid(feature);
  32102. },
  32103. /**
  32104. * Returns the great-arc distance in radians between the two points a and b. Each point is specified as an array [longitude, latitude], with coordinates expressed in decimal degrees.
  32105. * @param (double[]) a the first point
  32106. * @param (double[]) b the second point
  32107. * @return (double) the great-arc distance
  32108. */
  32109. /** @expose */
  32110. distance : com_ibm_rave_core_internal_geo_SphericalUtil.calculateDistance,
  32111. /**
  32112. * Returns the great-arc length of the specified feature in radians. For polygons, returns the perimeter of the exterior ring plus that of any interior rings.
  32113. * @param (Object) feature the GeoJSON object containing the feature whose length is computed
  32114. * @return (double) the great-arc length
  32115. */
  32116. /** @expose */
  32117. length : function(feature) {
  32118. var sphericalLength = new com_ibm_rave_core_internal_geo_SphericalLength();
  32119. return sphericalLength.calculateLength(feature);
  32120. },
  32121. /**
  32122. * Returns an interpolator given the two locations a and b. Each location must be represented as a two-element array of [longitude, latitude]. The returned interpolator is a functor which takes a single parameter t as input, where t ranges from 0 to 1. A value of 0 returns the location a, while a value of 1 returns the location b. Intermediate values interpolate from a to b along the spanning great arc.
  32123. * @param (double[]) source the first location
  32124. * @param (double[]) target the second location
  32125. * @return (com.ibm.rave.core.interpolate.Interpolator) the interpolator
  32126. * @see (com.ibm.rave.core.interpolate.Interpolator) Interpolator
  32127. */
  32128. /** @expose */
  32129. interpolate : com_ibm_rave_core_internal_geo_SphericalInterpolation.newInterpolator,
  32130. /**
  32131. * Specifies a rotation in the form of an array, [λ, φ, γ]. The elements of the array are angles in degrees, and specify a rotation in the following order: longitudinal, latitudinal and about the origin. If the last element of the array, γ, is omitted, this defaults to 0. Returns a rotator function object, which rotates a given location in the same or reverse order.
  32132. * @param (double[]) location the location to rotate
  32133. * @return (com.ibm.rave.core.geo.SphericalRotator) the rotator
  32134. * @see (com.ibm.rave.core.geo.SphericalRotator) SphericalRotator
  32135. */
  32136. /** @expose */
  32137. rotation : com_ibm_rave_core_internal_geo_SphericalRotation.newRotator,
  32138. /**
  32139. * Constructs a GeoJSON feature generator for creating circles centered at a given geographic location with a given radius in degrees.
  32140. * @return (com.ibm.rave.core.geo.CircleShapeGenerator) circle shape generator
  32141. * @see (com.ibm.rave.core.geo.CircleShapeGenerator) CircleShapeGenerator
  32142. */
  32143. /** @expose */
  32144. circle : com_ibm_rave_core_geo_CircleShapeGenerator.newCircleShapeGenerator,
  32145. /**
  32146. * Constructs a GeoJSON feature of type LineString generator for creating a great arc from a source point to a target point
  32147. * @return (com.ibm.rave.core.geo.GreatArcShapeGenerator) great arc shape generator
  32148. * @see (com.ibm.rave.core.geo.GreatArcShapeGenerator) GreatArcShapeGenerator
  32149. * @deprecated use {type: "LineString"} or Rave.geo.distance instead.
  32150. */
  32151. /** @expose */
  32152. greatArc : com_ibm_rave_core_geo_GreatArcShapeGenerator.newGreatArcShapeGenerator,
  32153. /**
  32154. * Constructs a GeoJSON feature generator for creating graticules.
  32155. * @return (com.ibm.rave.core.geo.GraticuleShapeGenerator) graticule shape generator
  32156. * @see (com.ibm.rave.core.geo.GraticuleShapeGenerator) GraticuleShapeGenerator
  32157. */
  32158. /** @expose */
  32159. graticule : com_ibm_rave_core_geo_GraticuleShapeGenerator.newGraticuleShapeGenerator,
  32160. /**
  32161. * Creates a new stream transform factory using the specified map of stream state delegate handlers. The map may contain implementations of any of the standard stream listener delegate function classes: StreamStateHandler for sphere, lineStart, lineEnd, polygonStart and polygonEnd, and StreamPointStateHandler for point. Each entry in the map should use a specific key as that represent the event to be handled, these keys are declared as constants on StreamListener interface. For example, a sphere handler's entry should be keyed with StreamListener.sphereHandler value and so on. Any method that is not present in the specified map will be implemented as a pass-through directly to the wrapped stream listener.
  32162. * @param (Object) delegates the map containing the state handlers to be used when creating the transform stream listener
  32163. * @return (com.ibm.rave.core.geo.TransformStreamListenerFactory) an instance of TransformStreamListenerFactory that could be used to wrap a stream listener in order to create a transform stream listener
  32164. */
  32165. /** @expose */
  32166. transform : com_ibm_rave_core_geo_TransformStreamListenerFactory.create,
  32167. /**
  32168. * Create a new stream transform that implements axis-aligned rectangle clipping. This is typically used to clip geometry to the viewport after projecting.
  32169. * @return (com.ibm.rave.core.geo.ClipExtentStreamListenerTransform) the clip extent stream listener transform
  32170. */
  32171. /** @expose */
  32172. clipExtent : com_ibm_rave_core_geo_ClipExtentStreamListenerTransform.newClipExtent,
  32173. /**
  32174. * Constructs a new base projection from the specified raw point projector
  32175. * @param (com.ibm.rave.core.geo.PointProjector) projetor the point projector to use when constructing the base projection
  32176. * @return (com.ibm.rave.core.geo.Projection) the newly created base projection
  32177. */
  32178. /** @expose */
  32179. projection : com_ibm_rave_core_internal_geo_ProjectionImpl.newProjection,
  32180. /**
  32181. * Constructs a new base projection mutator from the specified raw point projector factory A project mutator can be used to construct a new base projection by calling the mutator's mutate function
  32182. * @param (com.ibm.rave.core.geo.PointProjectorFactory) projectorFactory the point projector factory to use
  32183. * @return (com.ibm.rave.core.geo.ProjectionMutator) the project mutator
  32184. */
  32185. /** @expose */
  32186. projectionMutator : com_ibm_rave_core_internal_geo_ProjectionMutatorImpl.newProjectionMutator,
  32187. /**
  32188. * An alias for conicEqualArea, with USA-centric defaults: scale 1000, translate [480, 250], rotation [96°, 0°], center -0.6°, 38.7° and parallels [29.5°, 45.5°], making it suitable for displaying the United States, centered around Hutchinson, Kansas in a 960×500 area. The central meridian and parallels are specified by the USGS in the 1970 National Atlas.
  32189. * @return (com.ibm.rave.core.geo.ConicProjection) the newly constructed albers projection
  32190. */
  32191. /** @expose */
  32192. albers : com_ibm_rave_core_internal_geo_AlbersUsaProjection.newAlbersProjection,
  32193. /**
  32194. * Constructs Albers USA projection which is a composite projection of four Albers projections designed to display the forty-eight lower United States alongside Alaska and Hawaii. Although intended for choropleths (Heat Map), it scales the area of Alaska by a factor of 0.35x (a lie factor of 3); Hawaii is shown at the same scale as the lower forty-eight. This projection does not support the following projection methods: rotate, center, clipAngle and clipExtent. This projection does not provide a raw point projector.
  32195. * @return (com.ibm.rave.core.geo.InvertibleProjection) the newly constructed albers-USA projection
  32196. */
  32197. /** @expose */
  32198. albersUsa : com_ibm_rave_core_internal_geo_AlbersUsaProjection.newAlbersUsaProjection,
  32199. /**
  32200. * Creates a new geographic path generator with the default settings: the albersUsa projection and a point radius of 4.5 pixels. This geographic path generator is basically an SVG shape generators: given a geometry or feature GeoJSON object, it generates the path data string suitable for the "d" attribute of an SVG path element.
  32201. * @return (com.ibm.rave.core.geo.GeoPathGenerator) the newly created geographic path generator
  32202. */
  32203. /** @expose */
  32204. path : function() {
  32205. return com_ibm_rave_core_internal_geo_GeoPathGeneratorImpl.newGeoPathGenerator();
  32206. }
  32207. //constructor : function() {}
  32208. });
  32209. /**
  32210. * The global singleton of the Geo component
  32211. */
  32212. /** @expose */
  32213. com_ibm_rave_core_geo_Geo.INSTANCE = new com_ibm_rave_core_geo_Geo();
  32214. // $source: com/ibm/rave/core/internal/geo/GeoPathGeneratorImpl
  32215. /************************************************************************
  32216. ** IBM Confidential
  32217. **
  32218. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  32219. **
  32220. ** (C) Copyright IBM Corp. 2015
  32221. **
  32222. ** The source code for this program is not published or otherwise divested of its trade secrets,
  32223. ** irrespective of what has been deposited with the U.S. Copyright Office.
  32224. ************************************************************************/
  32225. // GENERATED
  32226. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, bind
  32227. //@import com/ibm/rave/core/internal/geo/BufferPathContextStreamListener (runtime) // new
  32228. //@import com/ibm/rave/core/internal/geo/DrawingPathContextStreamListener (runtime) // new
  32229. //@import com/ibm/rave/core/internal/geo/PathAreaStreamListener (runtime) // new
  32230. //@import com/ibm/rave/core/internal/geo/Stream (runtime) // Stream
  32231. //@import com/ibm/rave/core/internal/geo/PathCentroidStreamListener (runtime) // new
  32232. //@import com/ibm/rave/core/internal/geo/PathBoundsStreamListener (runtime) // new
  32233. //@import com/ibm/rave/core/internal/geo/TransformStreamListenerImpl (runtime) // new
  32234. //@import com/ibm/rave/core/internal/geo/ResampleStreamListenerFactory (runtime) // new
  32235. //@import com/ibm/rave/core/internal/geo/ProjectionImpl (runtime) // projectionRadians
  32236. //@import com/ibm/rave/core/internal/geo/AlbersUsaProjection (static) // newAlbersUsaProjection
  32237. /**
  32238. */
  32239. var com_ibm_rave_core_internal_geo_GeoPathGeneratorImpl = com_ibm_rave_core_nativeImpl_Declare({
  32240. //pointRadiusValue : null,
  32241. //basicProjection : null,
  32242. //drawingContext : null,
  32243. //projectStream : null,
  32244. //contextStream : null,
  32245. //cacheStream : null,
  32246. //pathCentroid : null,
  32247. //pathArea : null,
  32248. //pathBounds : null,
  32249. _$functionClassMethod : function() {
  32250. var _$self = function(data, index, groupIndex) {
  32251. var object = data;
  32252. if (object) {
  32253. if (typeof _$self.pointRadiusValue === "function") {
  32254. _$self.contextStream.pointRadius(+ ((_$self.pointRadiusValue)(object, index)));
  32255. }
  32256. if (!_$self.cacheStream || !(_$self.cacheStream.valid)) {
  32257. _$self.cacheStream = _$self.projectStream(_$self.contextStream);
  32258. }
  32259. com_ibm_rave_core_internal_geo_Stream.INSTANCE.stream(object, _$self.cacheStream);
  32260. }
  32261. return _$self.contextStream.result();
  32262. };
  32263. return _$self;
  32264. },
  32265. constructor : function() {
  32266. this.pointRadiusValue = (4.5);
  32267. },
  32268. /**
  32269. * @return (com.ibm.rave.core.geo.DrawingContext) the context
  32270. */
  32271. context$0 : function() {
  32272. return this.drawingContext;
  32273. },
  32274. /**
  32275. * @param (com.ibm.rave.core.geo.DrawingContext) context the context to set
  32276. */
  32277. context$1 : function(context) {
  32278. this.drawingContext = context;
  32279. if (!this.drawingContext) {
  32280. this.contextStream = new com_ibm_rave_core_internal_geo_BufferPathContextStreamListener();
  32281. } else {
  32282. this.contextStream = new com_ibm_rave_core_internal_geo_DrawingPathContextStreamListener(this.drawingContext);
  32283. }
  32284. if (!(typeof this.pointRadiusValue === "function")) {
  32285. this.contextStream.pointRadius(+ (this.pointRadiusValue));
  32286. }
  32287. return this.reset();
  32288. },
  32289. /** @expose */
  32290. area : com_ibm_rave_core_nativeImpl_Declare.bind(function(object) {
  32291. this.pathArea = new com_ibm_rave_core_internal_geo_PathAreaStreamListener();
  32292. com_ibm_rave_core_internal_geo_Stream.INSTANCE.stream(object, this.projectStream(this.pathArea));
  32293. return this.pathArea.pathAreaSum;
  32294. }),
  32295. /** @expose */
  32296. centroid : com_ibm_rave_core_nativeImpl_Declare.bind(function(object) {
  32297. this.pathCentroid = new com_ibm_rave_core_internal_geo_PathCentroidStreamListener();
  32298. com_ibm_rave_core_internal_geo_Stream.INSTANCE.stream(object, this.projectStream(this.pathCentroid));
  32299. return (this.pathCentroid.centroidZ2) ? [this.pathCentroid.centroidX2 / this.pathCentroid.centroidZ2, this.pathCentroid.centroidY2 / this.pathCentroid.centroidZ2] : (this.pathCentroid.centroidZ1) ? [this.pathCentroid.centroidX1 / this.pathCentroid.centroidZ1, this.pathCentroid.centroidY1 / this.pathCentroid.centroidZ1] : (this.pathCentroid.centroidZ0) ? [this.pathCentroid.centroidX0 / this.pathCentroid.centroidZ0, this.pathCentroid.centroidY0 / this.pathCentroid.centroidZ0] : [NaN, NaN];
  32300. }),
  32301. /** @expose */
  32302. bounds : function(object) {
  32303. this.pathBounds = new com_ibm_rave_core_internal_geo_PathBoundsStreamListener();
  32304. com_ibm_rave_core_internal_geo_Stream.INSTANCE.stream(object, this.projectStream(this.pathBounds));
  32305. return [[this.pathBounds.pathBoundsX0, this.pathBounds.pathBoundsY0], [this.pathBounds.pathBoundsX1, this.pathBounds.pathBoundsY1]];
  32306. },
  32307. /**
  32308. * @return (com.ibm.rave.core.geo.BasicProjection) the projection
  32309. */
  32310. projection$0 : function() {
  32311. return this.basicProjection;
  32312. },
  32313. /**
  32314. * @param (com.ibm.rave.core.geo.BasicProjection) projection the projection to set
  32315. */
  32316. projection$1 : function(projection) {
  32317. var self = this;
  32318. this.basicProjection = projection;
  32319. if (this.basicProjection) {
  32320. if (this.basicProjection.stream) {
  32321. this.projectStream = function(listener) {
  32322. return (self.basicProjection).stream(listener);
  32323. };
  32324. } else {
  32325. this.projectStream = this.pathProjectStream(projection);
  32326. }
  32327. } else {
  32328. this.projectStream = function(listener) {
  32329. return new com_ibm_rave_core_internal_geo_TransformStreamListenerImpl(listener, {});
  32330. };
  32331. }
  32332. return this.reset();
  32333. },
  32334. /**
  32335. * @return (Object) the pointRadius
  32336. */
  32337. pointRadius$0 : function() {
  32338. return this.pointRadiusValue;
  32339. },
  32340. /**
  32341. * @param (Object) value the pointRadius to set
  32342. */
  32343. pointRadius$1 : function(value) {
  32344. if (typeof value === "function") {
  32345. this.pointRadiusValue = value;
  32346. } else {
  32347. this.pointRadiusValue = + (value);
  32348. this.contextStream.pointRadius(+ (value));
  32349. }
  32350. return this;
  32351. },
  32352. reset : function() {
  32353. this.cacheStream = null;
  32354. return this;
  32355. },
  32356. pathProjectStream : function(projection) {
  32357. var resampleFactory = new com_ibm_rave_core_internal_geo_ResampleStreamListenerFactory(function(x, y, z) {
  32358. return (projection([x * 57.29577951308232, y * 57.29577951308232]));
  32359. });
  32360. return function(listener) {
  32361. return com_ibm_rave_core_internal_geo_ProjectionImpl.projectionRadians(resampleFactory(listener));
  32362. };
  32363. },
  32364. /** @expose */
  32365. context : function(a0) {
  32366. var args = arguments;
  32367. if (args.length == 0) {
  32368. return this.context$0();
  32369. }
  32370. return this.context$1(a0);
  32371. },
  32372. /** @expose */
  32373. projection : function(a0) {
  32374. var args = arguments;
  32375. if (args.length == 0) {
  32376. return this.projection$0();
  32377. }
  32378. return this.projection$1(a0);
  32379. },
  32380. /** @expose */
  32381. pointRadius : function(a0) {
  32382. var args = arguments;
  32383. if (args.length == 0) {
  32384. return this.pointRadius$0();
  32385. }
  32386. return this.pointRadius$1(a0);
  32387. }
  32388. /**
  32389. */
  32390. //constructor : function() {}
  32391. });
  32392. com_ibm_rave_core_internal_geo_GeoPathGeneratorImpl.newGeoPathGenerator = function() {
  32393. var path = new com_ibm_rave_core_internal_geo_GeoPathGeneratorImpl();
  32394. return path.projection$1(com_ibm_rave_core_internal_geo_AlbersUsaProjection.newAlbersUsaProjection()).context(null);
  32395. };
  32396. // $source: com/ibm/rave/core/internal/geo/BufferPathContextStreamListener
  32397. /************************************************************************
  32398. ** IBM Confidential
  32399. **
  32400. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  32401. **
  32402. ** (C) Copyright IBM Corp. 2015
  32403. **
  32404. ** The source code for this program is not published or otherwise divested of its trade secrets,
  32405. ** irrespective of what has been deposited with the U.S. Copyright Office.
  32406. ************************************************************************/
  32407. // GENERATED
  32408. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  32409. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (loadtime) // superclass
  32410. /**
  32411. */
  32412. var com_ibm_rave_core_internal_geo_BufferPathContextStreamListener = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_DelegatingStreamListener, {
  32413. //pointCircle : null,
  32414. //buffer : null,
  32415. constructor : function() {
  32416. this.buffer = [];
  32417. /**
  32418. */
  32419. {
  32420. this.pointCircle = this.pathBufferCircle(4.5);
  32421. var self = this;
  32422. var point = function(x, y, z) {
  32423. self.buffer.push("M", (x), ",", (y), self.pointCircle);
  32424. };
  32425. var pointLine = function(x, y, z) {
  32426. self.buffer.push("L", (x), ",", (y));
  32427. };
  32428. var pointLineStart = function(x, y, z) {
  32429. self.buffer.push("M", (x), ",", (y));
  32430. self.pointDelegate = pointLine;
  32431. };
  32432. var lineStart = function() {
  32433. self.pointDelegate = pointLineStart;
  32434. };
  32435. var lineEnd = function() {
  32436. self.pointDelegate = point;
  32437. };
  32438. var lineEndPolygon = function() {
  32439. self.buffer.push("Z");
  32440. };
  32441. var polygonStart = function() {
  32442. self.lineEndDelegate = lineEndPolygon;
  32443. };
  32444. var polygonEnd = function() {
  32445. self.lineEndDelegate = lineEnd;
  32446. self.pointDelegate = point;
  32447. };
  32448. this.pointDelegate = point;
  32449. this.lineStartDelegate = lineStart;
  32450. this.lineEndDelegate = lineEnd;
  32451. this.polygonStartDelegate = polygonStart;
  32452. this.polygonEndDelegate = polygonEnd;
  32453. }
  32454. },
  32455. pointRadius : function(r) {
  32456. this.pointCircle = this.pathBufferCircle(r);
  32457. return this;
  32458. },
  32459. result : function() {
  32460. if (this.buffer.length > 0) {
  32461. var result = this.buffer.join("");
  32462. this.buffer = [];
  32463. return result;
  32464. }
  32465. return null;
  32466. },
  32467. pathBufferCircle : function(radius) {
  32468. return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z";
  32469. }
  32470. });
  32471. // $source: com/ibm/rave/core/internal/geo/DrawingPathContextStreamListener
  32472. /************************************************************************
  32473. ** IBM Confidential
  32474. **
  32475. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  32476. **
  32477. ** (C) Copyright IBM Corp. 2015
  32478. **
  32479. ** The source code for this program is not published or otherwise divested of its trade secrets,
  32480. ** irrespective of what has been deposited with the U.S. Copyright Office.
  32481. ************************************************************************/
  32482. // GENERATED
  32483. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  32484. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (loadtime) // superclass
  32485. /**
  32486. */
  32487. var com_ibm_rave_core_internal_geo_DrawingPathContextStreamListener = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_DelegatingStreamListener, {
  32488. //context : null,
  32489. pointRadiusValue : 0,
  32490. /**
  32491. */
  32492. constructor : function(context) {
  32493. this.pointRadiusValue = (4.5);
  32494. this.context = context;
  32495. var self = this;
  32496. var point = function(x, y, z) {
  32497. self.context.moveTo(x + self.pointRadiusValue, y);
  32498. self.context.arc(x, y, self.pointRadiusValue, 0, 6.283185307179586);
  32499. };
  32500. var pointLine = function(x, y, z) {
  32501. self.context.lineTo(x, y);
  32502. };
  32503. var pointLineStart = function(x, y, z) {
  32504. self.context.moveTo(x, y);
  32505. self.pointDelegate = pointLine;
  32506. };
  32507. var lineStart = function() {
  32508. self.pointDelegate = pointLineStart;
  32509. };
  32510. var lineEndPolygon = function() {
  32511. self.context.closePath();
  32512. };
  32513. var polygonStart = function() {
  32514. self.lineEndDelegate = lineEndPolygon;
  32515. };
  32516. var lineEnd = function() {
  32517. self.pointDelegate = point;
  32518. };
  32519. var polygonEnd = function() {
  32520. self.lineEndDelegate = lineEnd;
  32521. self.pointDelegate = point;
  32522. };
  32523. this.pointDelegate = point;
  32524. this.lineStartDelegate = lineStart;
  32525. this.lineEndDelegate = lineEnd;
  32526. this.polygonStartDelegate = polygonStart;
  32527. this.polygonEndDelegate = polygonEnd;
  32528. },
  32529. pointRadius : function(r) {
  32530. this.pointRadiusValue = r;
  32531. return this;
  32532. },
  32533. result : function() {
  32534. return null;
  32535. }
  32536. });
  32537. // $source: com/ibm/rave/core/internal/geo/PathAreaStreamListener
  32538. /************************************************************************
  32539. ** IBM Confidential
  32540. **
  32541. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  32542. **
  32543. ** (C) Copyright IBM Corp. 2015
  32544. **
  32545. ** The source code for this program is not published or otherwise divested of its trade secrets,
  32546. ** irrespective of what has been deposited with the U.S. Copyright Office.
  32547. ************************************************************************/
  32548. // GENERATED
  32549. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  32550. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (loadtime) // superclass
  32551. /**
  32552. */
  32553. var com_ibm_rave_core_internal_geo_PathAreaStreamListener = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_DelegatingStreamListener, {
  32554. pathAreaSum : 0, pathAreaPolygon : 0,
  32555. ringStart_x00 : 0, ringStart_y00 : 0, ringStart_x0 : 0, ringStart_y0 : 0,
  32556. /**
  32557. * @return (double) the pathAreaSum
  32558. */
  32559. getPathAreaSum : function() {
  32560. return this.pathAreaSum;
  32561. },
  32562. /**
  32563. */
  32564. constructor : function() {
  32565. var self = this;
  32566. var pathAreaRingStart_nextPoint = function(x, y, zz) {
  32567. self.pathAreaPolygon += self.ringStart_y0 * x - self.ringStart_x0 * y;
  32568. self.ringStart_x0 = x;
  32569. self.ringStart_y0 = y;
  32570. };
  32571. var pathAreaRingStart_point = function(x, y, z) {
  32572. self.pointDelegate = pathAreaRingStart_nextPoint;
  32573. self.ringStart_x00 = self.ringStart_x0 = x;
  32574. self.ringStart_y00 = self.ringStart_y0 = y;
  32575. };
  32576. var pathAreaRingStart_lineEnd = function() {
  32577. pathAreaRingStart_nextPoint(self.ringStart_x00, self.ringStart_y00, NaN);
  32578. };
  32579. var pathAreaRingStart = function() {
  32580. self.ringStart_x00 = self.ringStart_y00 = self.ringStart_x0 = self.ringStart_y0 = 0;
  32581. self.pointDelegate = pathAreaRingStart_point;
  32582. self.lineEndDelegate = pathAreaRingStart_lineEnd;
  32583. };
  32584. var polygonStart = function() {
  32585. self.pathAreaPolygon = 0;
  32586. self.lineStartDelegate = pathAreaRingStart;
  32587. };
  32588. var polygonEnd = function() {
  32589. self.pointDelegate = null;
  32590. self.lineStartDelegate = null;
  32591. self.lineEndDelegate = null;
  32592. self.pathAreaSum += Math.abs(self.pathAreaPolygon / 2);
  32593. };
  32594. this.polygonStartDelegate = polygonStart;
  32595. this.polygonEndDelegate = polygonEnd;
  32596. }
  32597. });
  32598. // $source: com/ibm/rave/core/internal/geo/PathCentroidStreamListener
  32599. /************************************************************************
  32600. ** IBM Confidential
  32601. **
  32602. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  32603. **
  32604. ** (C) Copyright IBM Corp. 2015
  32605. **
  32606. ** The source code for this program is not published or otherwise divested of its trade secrets,
  32607. ** irrespective of what has been deposited with the U.S. Copyright Office.
  32608. ************************************************************************/
  32609. // GENERATED
  32610. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  32611. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (loadtime) // superclass
  32612. /**
  32613. */
  32614. var com_ibm_rave_core_internal_geo_PathCentroidStreamListener = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_DelegatingStreamListener, {
  32615. centroidX0 : 0, centroidY0 : 0, centroidZ0 : 0, centroidX1 : 0, centroidY1 : 0, centroidZ1 : 0, centroidX2 : 0, centroidY2 : 0, centroidZ2 : 0,
  32616. lineStart_x0 : 0, lineStart_y0 : 0,
  32617. ringStart_x00 : 0, ringStart_y00 : 0, ringStart_x0 : 0, ringStart_y0 : 0,
  32618. /**
  32619. */
  32620. constructor : function() {
  32621. var self = this;
  32622. var centroidPoint = function(x, y, z) {
  32623. self.centroidX0 += x;
  32624. self.centroidY0 += y;
  32625. ++self.centroidZ0;
  32626. };
  32627. var centroidLineStart_nextPoint = function(x, y, zz) {
  32628. var dx = x - self.lineStart_x0, dy = y - self.lineStart_y0, z = Math.sqrt(dx * dx + dy * dy);
  32629. self.centroidX1 += z * (self.lineStart_x0 + x) / 2;
  32630. self.centroidY1 += z * (self.lineStart_y0 + y) / 2;
  32631. self.centroidZ1 += z;
  32632. centroidPoint(self.lineStart_x0 = x, self.lineStart_y0 = y, NaN);
  32633. };
  32634. var centroidLineStart_point = function(x, y, z) {
  32635. self.pointDelegate = centroidLineStart_nextPoint;
  32636. centroidPoint(self.lineStart_x0 = x, self.lineStart_y0 = y, NaN);
  32637. };
  32638. var centroidLineStart = function() {
  32639. self.lineStart_x0 = self.lineStart_y0 = 0;
  32640. self.pointDelegate = centroidLineStart_point;
  32641. };
  32642. var centroidLineEnd = function() {
  32643. self.pointDelegate = centroidPoint;
  32644. };
  32645. var centroidRingStart_nextPoint = function(x, y, zz) {
  32646. var dx = x - self.ringStart_x0, dy = y - self.ringStart_y0, z = Math.sqrt(dx * dx + dy * dy);
  32647. self.centroidX1 += z * (self.ringStart_x0 + x) / 2;
  32648. self.centroidY1 += z * (self.ringStart_y0 + y) / 2;
  32649. self.centroidZ1 += z;
  32650. z = self.ringStart_y0 * x - self.ringStart_x0 * y;
  32651. self.centroidX2 += z * (self.ringStart_x0 + x);
  32652. self.centroidY2 += z * (self.ringStart_y0 + y);
  32653. self.centroidZ2 += z * 3;
  32654. centroidPoint(self.ringStart_x0 = x, self.ringStart_y0 = y, NaN);
  32655. };
  32656. var centroidRingStart_point = function(x, y, z) {
  32657. self.pointDelegate = centroidRingStart_nextPoint;
  32658. centroidPoint(self.ringStart_x00 = self.ringStart_x0 = x, self.ringStart_y00 = self.ringStart_y0 = y, NaN);
  32659. };
  32660. var centroidRingStart_lineEnd = function() {
  32661. centroidRingStart_nextPoint(self.ringStart_x00, self.ringStart_y00, NaN);
  32662. };
  32663. var centroidRingStart = function() {
  32664. self.ringStart_x00 = self.ringStart_y00 = self.ringStart_x0 = self.ringStart_y0 = 0;
  32665. self.pointDelegate = centroidRingStart_point;
  32666. self.lineEndDelegate = centroidRingStart_lineEnd;
  32667. };
  32668. var polygonStart = function() {
  32669. self.lineStartDelegate = centroidRingStart;
  32670. };
  32671. var polygonEnd = function() {
  32672. self.pointDelegate = centroidPoint;
  32673. self.lineStartDelegate = centroidLineStart;
  32674. self.lineEndDelegate = centroidLineEnd;
  32675. };
  32676. this.pointDelegate = centroidPoint;
  32677. this.lineStartDelegate = centroidLineStart;
  32678. this.lineEndDelegate = centroidLineEnd;
  32679. this.polygonStartDelegate = polygonStart;
  32680. this.polygonEndDelegate = polygonEnd;
  32681. },
  32682. /**
  32683. * @return (double) the centroidX0
  32684. */
  32685. getCentroidX0 : function() {
  32686. return this.centroidX0;
  32687. },
  32688. /**
  32689. * @return (double) the centroidY0
  32690. */
  32691. getCentroidY0 : function() {
  32692. return this.centroidY0;
  32693. },
  32694. /**
  32695. * @return (double) the centroidZ0
  32696. */
  32697. getCentroidZ0 : function() {
  32698. return this.centroidZ0;
  32699. },
  32700. /**
  32701. * @return (double) the centroidX1
  32702. */
  32703. getCentroidX1 : function() {
  32704. return this.centroidX1;
  32705. },
  32706. /**
  32707. * @return (double) the centroidY1
  32708. */
  32709. getCentroidY1 : function() {
  32710. return this.centroidY1;
  32711. },
  32712. /**
  32713. * @return (double) the centroidZ1
  32714. */
  32715. getCentroidZ1 : function() {
  32716. return this.centroidZ1;
  32717. },
  32718. /**
  32719. * @return (double) the centroidX2
  32720. */
  32721. getCentroidX2 : function() {
  32722. return this.centroidX2;
  32723. },
  32724. /**
  32725. * @return (double) the centroidY2
  32726. */
  32727. getCentroidY2 : function() {
  32728. return this.centroidY2;
  32729. },
  32730. /**
  32731. * @return (double) the centroidZ2
  32732. */
  32733. getCentroidZ2 : function() {
  32734. return this.centroidZ2;
  32735. }
  32736. });
  32737. // $source: com/ibm/rave/core/internal/geo/PathBoundsStreamListener
  32738. /************************************************************************
  32739. ** IBM Confidential
  32740. **
  32741. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  32742. **
  32743. ** (C) Copyright IBM Corp. 2015
  32744. **
  32745. ** The source code for this program is not published or otherwise divested of its trade secrets,
  32746. ** irrespective of what has been deposited with the U.S. Copyright Office.
  32747. ************************************************************************/
  32748. // GENERATED
  32749. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  32750. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (loadtime) // superclass
  32751. /**
  32752. */
  32753. var com_ibm_rave_core_internal_geo_PathBoundsStreamListener = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_DelegatingStreamListener, {
  32754. pathBoundsX1 : 0, pathBoundsY1 : 0, pathBoundsX0 : 0, pathBoundsY0 : 0,
  32755. /**
  32756. */
  32757. constructor : function() {
  32758. this.pathBoundsX1 = this.pathBoundsY1 = -(this.pathBoundsX0 = this.pathBoundsY0 = Infinity);
  32759. var self = this;
  32760. var point = function(x, y, z) {
  32761. if (x < self.pathBoundsX0) {
  32762. self.pathBoundsX0 = x;
  32763. }
  32764. if (x > self.pathBoundsX1) {
  32765. self.pathBoundsX1 = x;
  32766. }
  32767. if (y < self.pathBoundsY0) {
  32768. self.pathBoundsY0 = y;
  32769. }
  32770. if (y > self.pathBoundsY1) {
  32771. self.pathBoundsY1 = y;
  32772. }
  32773. };
  32774. this.pointDelegate = point;
  32775. },
  32776. /**
  32777. * @return (double) the pathBoundsX1
  32778. */
  32779. getPathBoundsX1 : function() {
  32780. return this.pathBoundsX1;
  32781. },
  32782. /**
  32783. * @return (double) the pathBoundsY1
  32784. */
  32785. getPathBoundsY1 : function() {
  32786. return this.pathBoundsY1;
  32787. },
  32788. /**
  32789. * @return (double) the pathBoundsX0
  32790. */
  32791. getPathBoundsX0 : function() {
  32792. return this.pathBoundsX0;
  32793. },
  32794. /**
  32795. * @return (double) the pathBoundsY0
  32796. */
  32797. getPathBoundsY0 : function() {
  32798. return this.pathBoundsY0;
  32799. }
  32800. });
  32801. // $source: com/ibm/rave/core/globalization/Bidi
  32802. /************************************************************************
  32803. ** IBM Confidential
  32804. **
  32805. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  32806. **
  32807. ** (C) Copyright IBM Corp. 2015
  32808. **
  32809. ** The source code for this program is not published or otherwise divested of its trade secrets,
  32810. ** irrespective of what has been deposited with the U.S. Copyright Office.
  32811. ************************************************************************/
  32812. // GENERATED
  32813. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  32814. //@import com/ibm/rave/core/locale/Locale (runtime) // getInstance
  32815. /**
  32816. * Class that handles bidi string formatting. Uses the default Locale (en_US) object but can still format LTR, RTL and AUTO formatted strings.
  32817. * @author jim
  32818. */
  32819. var com_ibm_rave_core_globalization_Bidi = com_ibm_rave_core_nativeImpl_Declare({
  32820. /** @expose */
  32821. format : null,
  32822. constructor : function() {
  32823. this.format = com_ibm_rave_core_locale_Locale.getInstance().getDefault().bidiStringFormat;
  32824. }
  32825. //constructor : function() {}
  32826. });
  32827. /** @expose */
  32828. com_ibm_rave_core_globalization_Bidi.INSTANCE = new com_ibm_rave_core_globalization_Bidi();
  32829. // $source: com/ibm/rave/core/util/Namespace
  32830. /************************************************************************
  32831. ** IBM Confidential
  32832. **
  32833. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  32834. **
  32835. ** (C) Copyright IBM Corp. 2015
  32836. **
  32837. ** The source code for this program is not published or otherwise divested of its trade secrets,
  32838. ** irrespective of what has been deposited with the U.S. Copyright Office.
  32839. ************************************************************************/
  32840. // GENERATED
  32841. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  32842. //@import com/ibm/rave/core/internal/util/NamespaceUtil (runtime) // getQName, NamespaceUtil
  32843. /**
  32844. * SVG has a different namespace from HTML, so Rave provides a few tools to simplify dealing with namespaces.
  32845. */
  32846. var com_ibm_rave_core_util_Namespace = com_ibm_rave_core_nativeImpl_Declare({
  32847. /**
  32848. * The map of registered namespace prefixes. Additional prefixes may be assigned as needed to create elements or attributes in other namespaces.
  32849. */
  32850. /** @expose */
  32851. prefix : null,
  32852. constructor : function() {
  32853. this.prefix = com_ibm_rave_core_internal_util_NamespaceUtil.NAMESPACES;
  32854. },
  32855. /**
  32856. * Qualifies the specified name, which may have a namespace prefix. If the name contains a colon (":"), the substring before the colon is interpreted as the namespace prefix, which must be registered in rave.ns.prefix. The return value is an object with space and local attributes containing the full namespace URL and the local name. For example, the result of qualify("svg:text") is: <pre> {space: "http://www.w3.org/2000/svg", local: "text"} </pre> If the name does not contain a colon, this function merely returns the input name.
  32857. * @param (String) name The name to qualify.
  32858. * @return (Object) A qualified name object, or if the name does not contain a colon, the input name.
  32859. */
  32860. /** @expose */
  32861. qualify : function(name) {
  32862. var qname = com_ibm_rave_core_internal_util_NamespaceUtil.getQName(name);
  32863. if (qname["space"] != null) {
  32864. return qname;
  32865. }
  32866. return qname["local"];
  32867. }
  32868. //constructor : function() {}
  32869. });
  32870. /**
  32871. * The singleton of the Namespace component
  32872. */
  32873. /** @expose */
  32874. com_ibm_rave_core_util_Namespace.INSTANCE = new com_ibm_rave_core_util_Namespace();
  32875. // $source: com/ibm/rave/core/math/Random
  32876. /************************************************************************
  32877. ** IBM Confidential
  32878. **
  32879. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  32880. **
  32881. ** (C) Copyright IBM Corp. 2015
  32882. **
  32883. ** The source code for this program is not published or otherwise divested of its trade secrets,
  32884. ** irrespective of what has been deposited with the U.S. Copyright Office.
  32885. ************************************************************************/
  32886. // GENERATED
  32887. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  32888. var com_ibm_rave_core_math_Random = com_ibm_rave_core_nativeImpl_Declare({
  32889. /**
  32890. * Returns a function for generating random numbers with a <a href="http://en.wikipedia.org/wiki/Normal_distribution">normal (Gaussian) distribution</a>. Uses a default deviation of 1 and a mean of 0.
  32891. * @return (com.ibm.rave.core.math.Random.Randomizer) a function for generating random numbers
  32892. * @see #this.normal(, )
  32893. */
  32894. normal$0 : function() {
  32895. return this.normal$2(0, 1);
  32896. },
  32897. /**
  32898. * Returns a function for generating random numbers with a <a href="http://en.wikipedia.org/wiki/Normal_distribution">normal (Gaussian) distribution</a>. Uses a default deviation of 1.
  32899. * @param (double) mean expected value of the generated pseudorandom number
  32900. * @return (com.ibm.rave.core.math.Random.Randomizer) a function for generating random numbers
  32901. * @see #this.normal(, )
  32902. */
  32903. normal$1 : function(mean) {
  32904. return this.normal$2(mean, 1);
  32905. },
  32906. /**
  32907. * Returns a function for generating random numbers with a <a href="http://en.wikipedia.org/wiki/Normal_distribution">normal (Gaussian) distribution</a>. The expected value of the generated pseudorandom numbers is mean, with the given standard deviation.
  32908. * @param (double) mean expected value of the generated pseudorandom number
  32909. * @param (double) deviation a standard deviation
  32910. * @return (com.ibm.rave.core.math.Random.Randomizer) a function for generating random numbers
  32911. */
  32912. normal$2 : function(mean, deviation) {
  32913. return function() {
  32914. var x, y, r;
  32915. do {
  32916. x = Math["random"]() * 2 - 1;
  32917. y = Math["random"]() * 2 - 1;
  32918. r = x * x + y * y;
  32919. } while (r == 0 || r > 1);
  32920. return mean + deviation * x * Math.sqrt(-2 * Math.log(r) / r);
  32921. };
  32922. },
  32923. /**
  32924. * Returns a function for generating random numbers with a <a href="http://en.wikipedia.org/wiki/Log-normal_distribution">log-normal distribution</a>. Uses a default deviation of 1 and a mean of 0.
  32925. * @return (com.ibm.rave.core.math.Random.Randomizer) a function for generating random numbers
  32926. * @see #this.logNormal(, )
  32927. */
  32928. logNormal$0 : function() {
  32929. return this.logNormal$2(0, 1);
  32930. },
  32931. /**
  32932. * Returns a function for generating random numbers with a <a href="http://en.wikipedia.org/wiki/Log-normal_distribution">log-normal distribution</a>. Uses a default deviation of 1.
  32933. * @param (double) mean expected value of the random variable’s natural logrithm
  32934. * @return (com.ibm.rave.core.math.Random.Randomizer) a function for generating random numbers
  32935. * @see #this.logNormal(, )
  32936. */
  32937. logNormal$1 : function(mean) {
  32938. return this.logNormal$2(mean, 1);
  32939. },
  32940. /**
  32941. * Returns a function for generating random numbers with a <a href="http://en.wikipedia.org/wiki/Log-normal_distribution">log-normal distribution</a>. The expected value of the generated pseudorandom numbers is mean, with the given standard deviation.
  32942. * @param (double) mean expected value of the random variable’s natural logrithm
  32943. * @param (double) deviation a standard deviation
  32944. * @return (com.ibm.rave.core.math.Random.Randomizer) a function for generating random numbers
  32945. */
  32946. logNormal$2 : function(mean, deviation) {
  32947. var random = this.normal(mean, deviation);
  32948. return function() {
  32949. return Math.exp(random());
  32950. };
  32951. },
  32952. /**
  32953. * Returns a function for generating random numbers with a <a href="http://en.wikipedia.org/wiki/Bates_distribution">Bates distribution</a>.
  32954. * @param (int) count number of independent variables
  32955. * @return (com.ibm.rave.core.math.Random.Randomizer) a function for generating random numbers
  32956. */
  32957. /** @expose */
  32958. bates : function(count) {
  32959. var random = this.irwinHall(count);
  32960. return function() {
  32961. return random() / count;
  32962. };
  32963. },
  32964. /**
  32965. * Returns a function for generating random numbers with an <a href="http://en.wikipedia.org/wiki/Irwin%E2%80%93Hall_distribution" >Irwin–Hall distribution</a>.
  32966. * @param (int) count number of independent variables
  32967. * @return (com.ibm.rave.core.math.Random.Randomizer) a function for generating random numbers
  32968. */
  32969. /** @expose */
  32970. irwinHall : function(count) {
  32971. return function() {
  32972. var s = 0;
  32973. for (var j = 0; j < count; ++j) {
  32974. s += Math["random"]();
  32975. }
  32976. return s;
  32977. };
  32978. },
  32979. /** @expose */
  32980. normal : function(a0, a1) {
  32981. var args = arguments;
  32982. if (args.length == 0) {
  32983. return this.normal$0();
  32984. }
  32985. if (args.length == 1) {
  32986. return this.normal$1(a0);
  32987. }
  32988. return this.normal$2(a0, a1);
  32989. },
  32990. /** @expose */
  32991. logNormal : function(a0, a1) {
  32992. var args = arguments;
  32993. if (args.length == 0) {
  32994. return this.logNormal$0();
  32995. }
  32996. if (args.length == 1) {
  32997. return this.logNormal$1(a0);
  32998. }
  32999. return this.logNormal$2(a0, a1);
  33000. }
  33001. //constructor : function() {}
  33002. });
  33003. /** @expose */
  33004. com_ibm_rave_core_math_Random.INSTANCE = new com_ibm_rave_core_math_Random();
  33005. // $source: com/ibm/rave/core/interpolate/Interpolate
  33006. /************************************************************************
  33007. ** IBM Confidential
  33008. **
  33009. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  33010. **
  33011. ** (C) Copyright IBM Corp. 2015
  33012. **
  33013. ** The source code for this program is not published or otherwise divested of its trade secrets,
  33014. ** irrespective of what has been deposited with the U.S. Copyright Office.
  33015. ************************************************************************/
  33016. // GENERATED
  33017. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  33018. //@import com/ibm/rave/core/interpolate/Interpolators (runtime) // Interpolators
  33019. /**
  33020. * Rave has many built-in interpolators to simplify the transitioning of arbitrary values; an interpolator is a function that maps a parametric value t in the domain [0,1] to a color, number or arbitrary value.
  33021. */
  33022. var com_ibm_rave_core_interpolate_Interpolate = com_ibm_rave_core_nativeImpl_Declare({
  33023. _$functionClassMethod : function() {
  33024. var _$self = /**
  33025. * Returns the default interpolator between the two values a and b. The type of interpolator is based on the type of the end value b, using the following algorithm: If b is a color, interpolateRgb is used. If b is a string, interpolateString is used. If b is an array, interpolateArray is used. If b is an object and not coercible to a number, interpolateObject is used. Otherwise, interpolateNumber is used. Based on the chosen interpolator, a is coerced to a suitable corresponding type. The color check applies to both instances of rave.rgb and other color spaces as well as color strings of the form /^(#|rgb\(|hsl\()/ or a CSS named colors. The behavior of this default interpolator may be extended to support additional types by pushing custom interpolators onto the rave.interpolators array.
  33026. */
  33027. function(a, b) {
  33028. return com_ibm_rave_core_interpolate_Interpolators.INSTANCE.getInterpolator(a, b);
  33029. };
  33030. return _$self;
  33031. }
  33032. //constructor : function() {}
  33033. });
  33034. /** @expose */
  33035. com_ibm_rave_core_interpolate_Interpolate.INSTANCE = new com_ibm_rave_core_interpolate_Interpolate();
  33036. // $source: com/ibm/rave/core/nativeImpl/xhr/XhrIdentity
  33037. /************************************************************************
  33038. ** IBM Confidential
  33039. **
  33040. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  33041. **
  33042. ** (C) Copyright IBM Corp. 2014
  33043. **
  33044. ** The source code for this program is not published or otherwise divested of its trade secrets,
  33045. ** irrespective of what has been deposited with the U.S. Copyright Office.
  33046. ************************************************************************/
  33047. //@import com/ibm/rave/core/nativeImpl/xhr/Xhr
  33048. var com_ibm_rave_core_nativeImpl_xhr_XhrIdentity = {
  33049. INSTANCE : com_ibm_rave_core_nativeImpl_xhr_Xhr(function(request) {
  33050. return request;
  33051. })
  33052. };
  33053. // $source: com/ibm/rave/core/nativeImpl/xhr/XhrText
  33054. /************************************************************************
  33055. ** IBM Confidential
  33056. **
  33057. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  33058. **
  33059. ** (C) Copyright IBM Corp. 2014
  33060. **
  33061. ** The source code for this program is not published or otherwise divested of its trade secrets,
  33062. ** irrespective of what has been deposited with the U.S. Copyright Office.
  33063. ************************************************************************/
  33064. //@import com/ibm/rave/core/nativeImpl/xhr/Xhr
  33065. var com_ibm_rave_core_nativeImpl_xhr_XhrText = {
  33066. INSTANCE : com_ibm_rave_core_nativeImpl_xhr_Xhr(function(request) {
  33067. return request.responseText;
  33068. })
  33069. };
  33070. // $source: com/ibm/rave/core/nativeImpl/xhr/XhrJson
  33071. /************************************************************************
  33072. ** IBM Confidential
  33073. **
  33074. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  33075. **
  33076. ** (C) Copyright IBM Corp. 2014
  33077. **
  33078. ** The source code for this program is not published or otherwise divested of its trade secrets,
  33079. ** irrespective of what has been deposited with the U.S. Copyright Office.
  33080. ************************************************************************/
  33081. //@import com/ibm/rave/core/nativeImpl/xhr/Xhr
  33082. var com_ibm_rave_core_nativeImpl_xhr_XhrJson = (function() {
  33083. function rave_json(request) {
  33084. return JSON.parse(request.responseText);
  33085. };
  33086. return {
  33087. INSTANCE : function(url, callback) {
  33088. return com_ibm_rave_core_nativeImpl_xhr_Xhr.create(url, "application/json", rave_json, callback);
  33089. }
  33090. }
  33091. })();
  33092. // $source: com/ibm/rave/core/nativeImpl/xhr/XhrHtml
  33093. /************************************************************************
  33094. ** IBM Confidential
  33095. **
  33096. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  33097. **
  33098. ** (C) Copyright IBM Corp. 2014
  33099. **
  33100. ** The source code for this program is not published or otherwise divested of its trade secrets,
  33101. ** irrespective of what has been deposited with the U.S. Copyright Office.
  33102. ************************************************************************/
  33103. //@import com/ibm/rave/core/nativeImpl/xhr/Xhr
  33104. var com_ibm_rave_core_nativeImpl_xhr_XhrHtml = (function() {
  33105. function rave_html(request) {
  33106. var range = rave_document.createRange();
  33107. range.selectNode(rave_document.body);
  33108. return range.createContextualFragment(request.responseText);
  33109. };
  33110. return {
  33111. INSTANCE : function(url, callback) {
  33112. return com_ibm_rave_core_nativeImpl_xhr_Xhr.create(url, "text/html", rave_html, callback);
  33113. }
  33114. }
  33115. })();
  33116. // $source: com/ibm/rave/core/nativeImpl/xhr/XhrXml
  33117. /************************************************************************
  33118. ** IBM Confidential
  33119. **
  33120. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  33121. **
  33122. ** (C) Copyright IBM Corp. 2014
  33123. **
  33124. ** The source code for this program is not published or otherwise divested of its trade secrets,
  33125. ** irrespective of what has been deposited with the U.S. Copyright Office.
  33126. ************************************************************************/
  33127. //@import com/ibm/rave/core/nativeImpl/xhr/Xhr
  33128. var com_ibm_rave_core_nativeImpl_xhr_XhrXml = {
  33129. INSTANCE : com_ibm_rave_core_nativeImpl_xhr_Xhr(function(request) {
  33130. return request.responseXML;
  33131. })
  33132. };
  33133. // $source: com/ibm/rave/core/nativeImpl/dsv/Dsv
  33134. /************************************************************************
  33135. ** IBM Confidential
  33136. **
  33137. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  33138. **
  33139. ** (C) Copyright IBM Corp. 2014
  33140. **
  33141. ** The source code for this program is not published or otherwise divested of its trade secrets,
  33142. ** irrespective of what has been deposited with the U.S. Copyright Office.
  33143. ************************************************************************/
  33144. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map
  33145. //@import com/ibm/rave/core/nativeImpl/xhr/Xhr
  33146. var com_ibm_rave_core_nativeImpl_dsv_Dsv = function(delimiter, mimeType) {
  33147. var reFormat = new RegExp("[\"" + delimiter + "\n]"),
  33148. delimiterCode = delimiter.charCodeAt(0);
  33149. function dsv(url, row, callback) {
  33150. if (arguments.length < 3) callback = row, row = null;
  33151. var xhr = com_ibm_rave_core_nativeImpl_xhr_Xhr.create(url, mimeType, row == null ? response : typedResponse(row), callback);
  33152. /**@expose*/
  33153. xhr.row = function(_) {
  33154. return arguments.length
  33155. ? xhr.response((row = _) == null ? response : typedResponse(_))
  33156. : row;
  33157. };
  33158. return xhr;
  33159. }
  33160. function response(request) {
  33161. return dsv.parse(request.responseText);
  33162. }
  33163. function typedResponse(f) {
  33164. return function(request) {
  33165. return dsv.parse(request.responseText, f);
  33166. };
  33167. }
  33168. /**@expose*/
  33169. dsv.parse = function(text, f) {
  33170. var o;
  33171. return dsv.parseRows(text, function(row, i) {
  33172. if (o) return o(row, i - 1);
  33173. var a = new Function("d", "return {" + row.map(function(name, i) {
  33174. return JSON.stringify(name) + ": d[" + i + "]";
  33175. }).join(",") + "}");
  33176. o = f ? function(row, i) { return f(a(row), i); } : a;
  33177. });
  33178. };
  33179. /**@expose*/
  33180. dsv.parseRows = function(text, f) {
  33181. var EOL = {}, // sentinel value for end-of-line
  33182. EOF = {}, // sentinel value for end-of-file
  33183. rows = [], // output rows
  33184. N = text.length,
  33185. I = 0, // current character index
  33186. n = 0, // the current line number
  33187. t, // the current token
  33188. eol; // is the current token followed by EOL?
  33189. function token() {
  33190. if (I >= N) return EOF; // special case: end of file
  33191. if (eol) return eol = false, EOL; // special case: end of line
  33192. // special case: quotes
  33193. var j = I;
  33194. if (text.charCodeAt(j) === 34) {
  33195. var i = j;
  33196. while (i++ < N) {
  33197. if (text.charCodeAt(i) === 34) {
  33198. if (text.charCodeAt(i + 1) !== 34) break;
  33199. ++i;
  33200. }
  33201. }
  33202. I = i + 2;
  33203. var c = text.charCodeAt(i + 1);
  33204. if (c === 13) {
  33205. eol = true;
  33206. if (text.charCodeAt(i + 2) === 10) ++I;
  33207. } else if (c === 10) {
  33208. eol = true;
  33209. }
  33210. return text.slice(j + 1, i).replace(/""/g, "\"");
  33211. }
  33212. // common case: find next delimiter or newline
  33213. while (I < N) {
  33214. var c = text.charCodeAt(I++), k = 1;
  33215. if (c === 10) eol = true; // \n
  33216. else if (c === 13) { eol = true; if (text.charCodeAt(I) === 10) ++I, ++k; } // \r|\r\n
  33217. else if (c !== delimiterCode) continue;
  33218. return text.slice(j, I - k);
  33219. }
  33220. // special case: last token before EOF
  33221. return text.slice(j);
  33222. }
  33223. while ((t = token()) !== EOF) {
  33224. var a = [];
  33225. while (t !== EOL && t !== EOF) {
  33226. a.push(t);
  33227. t = token();
  33228. }
  33229. if (f && (a = f(a, n++)) == null) continue;
  33230. rows.push(a);
  33231. }
  33232. return rows;
  33233. };
  33234. /**@expose*/
  33235. dsv.format = function(rows) {
  33236. if (Array.isArray(rows[0])) return dsv.formatRows(rows); // deprecated; use formatRows
  33237. var fieldSet = new com_ibm_rave_core_nativeImpl_arrays_ES6Map, fields = [];
  33238. // Compute unique fields in order of discovery.
  33239. rows.forEach(function(row) {
  33240. for (var field in row) {
  33241. if (!fieldSet.has(field)) {
  33242. fieldSet.set(field,1)
  33243. fields.push(field);
  33244. }
  33245. }
  33246. });
  33247. return [fields.map(formatValue).join(delimiter)].concat(rows.map(function(row) {
  33248. return fields.map(function(field) {
  33249. return formatValue(row[field]);
  33250. }).join(delimiter);
  33251. })).join("\n");
  33252. };
  33253. /**@expose*/
  33254. dsv.formatRows = function(rows) {
  33255. return rows.map(formatRow).join("\n");
  33256. };
  33257. function formatRow(row) {
  33258. return row.map(formatValue).join(delimiter);
  33259. }
  33260. function formatValue(text) {
  33261. return reFormat.test(text) ? "\"" + text.replace(/\"/g, "\"\"") + "\"" : text;
  33262. }
  33263. return dsv;
  33264. };
  33265. com_ibm_rave_core_nativeImpl_dsv_Dsv.INSTANCE = com_ibm_rave_core_nativeImpl_dsv_Dsv;
  33266. // $source: com/ibm/rave/core/nativeImpl/dsv/Csv
  33267. /************************************************************************
  33268. ** IBM Confidential
  33269. **
  33270. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  33271. **
  33272. ** (C) Copyright IBM Corp. 2014
  33273. **
  33274. ** The source code for this program is not published or otherwise divested of its trade secrets,
  33275. ** irrespective of what has been deposited with the U.S. Copyright Office.
  33276. ************************************************************************/
  33277. //@import com/ibm/rave/core/nativeImpl/dsv/Dsv
  33278. var com_ibm_rave_core_nativeImpl_dsv_Csv = {
  33279. INSTANCE : com_ibm_rave_core_nativeImpl_dsv_Dsv(",", "text/csv")
  33280. };
  33281. // $source: com/ibm/rave/core/nativeImpl/dsv/Tsv
  33282. /************************************************************************
  33283. ** IBM Confidential
  33284. **
  33285. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  33286. **
  33287. ** (C) Copyright IBM Corp. 2014
  33288. **
  33289. ** The source code for this program is not published or otherwise divested of its trade secrets,
  33290. ** irrespective of what has been deposited with the U.S. Copyright Office.
  33291. ************************************************************************/
  33292. //@import com/ibm/rave/core/nativeImpl/dsv/Dsv
  33293. var com_ibm_rave_core_nativeImpl_dsv_Tsv = {
  33294. INSTANCE : com_ibm_rave_core_nativeImpl_dsv_Dsv("\t", "text/tab-separated-values")
  33295. };
  33296. // $source: com/ibm/rave/core/collections/MapFunctionClass
  33297. /************************************************************************
  33298. ** IBM Confidential
  33299. **
  33300. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  33301. **
  33302. ** (C) Copyright IBM Corp. 2015
  33303. **
  33304. ** The source code for this program is not published or otherwise divested of its trade secrets,
  33305. ** irrespective of what has been deposited with the U.S. Copyright Office.
  33306. ************************************************************************/
  33307. // GENERATED
  33308. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  33309. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (loadtime) // new, create
  33310. var com_ibm_rave_core_collections_MapFunctionClass = rave_externs["MapFunctionClass"] = com_ibm_rave_core_nativeImpl_Declare({
  33311. _$functionClassMethod : function() {
  33312. var _$self = function(a0, a1) {
  33313. var args = arguments;
  33314. if (args.length == 0) {
  33315. return _$self.createMap$0();
  33316. }
  33317. if (args.length == 1 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]")) {
  33318. return _$self.createMap$3(a0);
  33319. }
  33320. if (args.length == 1 && (a0 == null || com_ibm_rave_core_nativeImpl_Object.isInstanceOf(a0, com_ibm_rave_core_nativeImpl_arrays_ES6Map))) {
  33321. return _$self.createMap$2(a0);
  33322. }
  33323. if (args.length == 1) {
  33324. return _$self.createMap$1(a0);
  33325. }
  33326. return _$self.createMap$4(a0, a1);
  33327. };
  33328. return _$self;
  33329. },
  33330. /**
  33331. * @return (com.ibm.rave.core.nativeImpl.arrays.ES6Map) ES6Map.
  33332. * @see this.ES6Map#this.create()
  33333. */
  33334. createMap$0 : com_ibm_rave_core_nativeImpl_arrays_ES6Map.create,
  33335. /**
  33336. * @param (Object) map
  33337. * @return (com.ibm.rave.core.nativeImpl.arrays.ES6Map) ES6Map
  33338. * @see this.ES6Map#this.create(java_util_Map)
  33339. */
  33340. createMap$1 : com_ibm_rave_core_nativeImpl_arrays_ES6Map.create,
  33341. /**
  33342. * @param (com.ibm.rave.core.nativeImpl.arrays.ES6Map) map
  33343. * @return (com.ibm.rave.core.nativeImpl.arrays.ES6Map) ES6Map
  33344. * @see this.ES6Map#this.create(com_ibm_rave_core_nativeImpl_arrays_ES6Map)
  33345. */
  33346. createMap$2 : function(map) {
  33347. return com_ibm_rave_core_nativeImpl_arrays_ES6Map.create(map);
  33348. },
  33349. /**
  33350. * @param (Array) input value array
  33351. * @return (com.ibm.rave.core.nativeImpl.arrays.ES6Map) ES6Map
  33352. * @see this.ES6Map#this.create(com_ibm_rave_core_nativeImpl_arrays_ES6Map)
  33353. */
  33354. createMap$3 : function(input) {
  33355. var map = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  33356. if (input) {
  33357. for (var i = 0; i < input.length; i = i + 1) {
  33358. map.set(i, input[i]);
  33359. }
  33360. }
  33361. return com_ibm_rave_core_nativeImpl_arrays_ES6Map.create(map);
  33362. },
  33363. /**
  33364. * @param (Array) input value array
  33365. * @param (com.ibm.rave.core.selector.ValueFunction) callback the accessor function to use to get the value
  33366. * @return (com.ibm.rave.core.nativeImpl.arrays.ES6Map) ES6Map
  33367. * @see this.ES6Map#this.create(com_ibm_rave_core_nativeImpl_arrays_ES6Map)
  33368. */
  33369. createMap$4 : function(input, callback) {
  33370. var len = input.length;
  33371. var map = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  33372. for (var i = 0; i < len; i = i + 1) {
  33373. var currentValue = input[i];
  33374. if (currentValue) {
  33375. map.set(callback.call(input, currentValue, i, -1), currentValue);
  33376. }
  33377. }
  33378. return com_ibm_rave_core_nativeImpl_arrays_ES6Map.create(map);
  33379. }
  33380. });
  33381. // $source: com/ibm/rave/core/Rave
  33382. /************************************************************************
  33383. ** IBM Confidential
  33384. **
  33385. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  33386. **
  33387. ** (C) Copyright IBM Corp. 2015
  33388. **
  33389. ** The source code for this program is not published or otherwise divested of its trade secrets,
  33390. ** irrespective of what has been deposited with the U.S. Copyright Office.
  33391. ************************************************************************/
  33392. // GENERATED
  33393. //@import com/ibm/rave/core/nativeImpl/math/Transform (loadtime) // create
  33394. //@import com/ibm/rave/core/selector/Selector (static) // new
  33395. //@import com/ibm/rave/core/transition/Transition (loadtime) // newTransition
  33396. //@import com/ibm/rave/core/arrays/Merge (loadtime) // merge
  33397. //@import com/ibm/rave/core/arrays/MinMax (loadtime) // min, max
  33398. //@import com/ibm/rave/core/arrays/Quantile (loadtime) // quantile
  33399. //@import com/ibm/rave/core/arrays/Deviation (loadtime) // deviation
  33400. //@import com/ibm/rave/core/arrays/Variance (loadtime) // variance
  33401. //@import com/ibm/rave/core/arrays/Mean (loadtime) // mean
  33402. //@import com/ibm/rave/core/arrays/Median (loadtime) // median
  33403. //@import com/ibm/rave/core/arrays/Extent (loadtime) // extent
  33404. //@import com/ibm/rave/core/arrays/Sum (loadtime) // sum
  33405. //@import com/ibm/rave/core/arrays/Zip (loadtime) // zip
  33406. //@import com/ibm/rave/core/arrays/Permute (loadtime) // permute
  33407. //@import com/ibm/rave/core/arrays/Shuffle (loadtime) // shuffle
  33408. //@import com/ibm/rave/core/arrays/Range (loadtime) // create
  33409. //@import com/ibm/rave/core/arrays/Bisector (loadtime) // create, Bisector
  33410. //@import com/ibm/rave/core/event/Dispatcher (static) // create
  33411. //@import com/ibm/rave/core/nativeImpl/event/Mouse (loadtime) // mousePoint
  33412. //@import com/ibm/rave/core/event/TouchUtil (loadtime) // touchFromSource, touch
  33413. //@import com/ibm/rave/core/nativeImpl/event/Touches (loadtime) // touches
  33414. //@import com/ibm/rave/core/color/Colors (loadtime) // newHSL, newHCL, newRGB, newLAB
  33415. //@import com/ibm/rave/core/format/Round (loadtime) // round
  33416. //@import com/ibm/rave/core/nativeImpl/format/Requote (loadtime) // requote
  33417. //@import com/ibm/rave/core/format/FormatPrefix (loadtime) // formatPrefix
  33418. //@import com/ibm/rave/core/nativeImpl/arrays/AssociativeArrays (loadtime) // entries, values, keys
  33419. //@import com/ibm/rave/core/arrays/Nest (static) // new
  33420. //@import com/ibm/rave/core/internal/nativeImpl/PlatformInitialization (static) // init, getDocument, getDocumentElement
  33421. //@import com/ibm/rave/core/arrays/Pairs (loadtime) // pairs
  33422. //@import com/ibm/rave/core/arrays/RaveSet (loadtime) // create
  33423. //@import com/ibm/rave/core/textMetrics/CanvasUtil (static) // CanvasUtil
  33424. //@import com/ibm/rave/core/nativeImpl/event/EventTracker (static) // EventTracker
  33425. //@import com/ibm/rave/core/Configuration (static) // Configuration
  33426. //@import com/ibm/rave/core/nativeImpl/timer/Timer (static) // Timer
  33427. //@import com/ibm/rave/core/geom/Geom (static) // Geom
  33428. //@import com/ibm/rave/core/scales/Scales (static) // Scales
  33429. //@import com/ibm/rave/core/layout/Layout (static) // Layout
  33430. //@import com/ibm/rave/core/capabilities/Capabilities (static) // Capabilities
  33431. //@import com/ibm/rave/core/svg/SVG (static) // getInstance
  33432. //@import com/ibm/rave/core/geo/Geo (static) // Geo
  33433. //@import com/ibm/rave/core/behavior/Behavior (static) // Behavior
  33434. //@import com/ibm/rave/core/time/Time (static) // getInstance
  33435. //@import com/ibm/rave/core/globalization/Bidi (static) // Bidi
  33436. //@import com/ibm/rave/core/util/Namespace (static) // Namespace
  33437. //@import com/ibm/rave/core/math/Random (static) // Random
  33438. //@import com/ibm/rave/core/locale/NumberFormat (static) // new
  33439. //@import com/ibm/rave/core/locale/Locale (static) // Locale, getInstance
  33440. //@import com/ibm/rave/core/arrays/Sort (static) // Sort
  33441. //@import com/ibm/rave/core/ease/Easing (static) // Easing
  33442. //@import com/ibm/rave/core/color/Color (static) // new
  33443. //@import com/ibm/rave/core/interpolate/Interpolators (static) // Interpolators
  33444. //@import com/ibm/rave/core/interpolate/Interpolate (static) // Interpolate
  33445. //@import com/ibm/rave/core/interpolate/ColorInterpolation (static) // ColorInterpolation
  33446. //@import com/ibm/rave/core/interpolate/StringInterpolation (static) // StringInterpolation
  33447. //@import com/ibm/rave/core/interpolate/NumberInterpolation (static) // NumberInterpolation
  33448. //@import com/ibm/rave/core/interpolate/RoundInterpolation (static) // RoundInterpolation
  33449. //@import com/ibm/rave/core/interpolate/ArrayInterpolation (static) // ArrayInterpolation
  33450. //@import com/ibm/rave/core/nativeImpl/interpolate/ObjectInterpolation (static) // ObjectInterpolation
  33451. //@import com/ibm/rave/core/nativeImpl/interpolate/TransformInterpolation (static) // TransformInterpolation
  33452. //@import com/ibm/rave/core/interpolate/ZoomInterpolation (static) // ZoomInterpolation
  33453. //@import com/ibm/rave/core/nativeImpl/xhr/XhrIdentity (static) // XhrIdentity
  33454. //@import com/ibm/rave/core/nativeImpl/xhr/XhrText (static) // XhrText
  33455. //@import com/ibm/rave/core/nativeImpl/xhr/XhrJson (static) // XhrJson
  33456. //@import com/ibm/rave/core/nativeImpl/xhr/XhrHtml (static) // XhrHtml
  33457. //@import com/ibm/rave/core/nativeImpl/xhr/XhrXml (static) // XhrXml
  33458. //@import com/ibm/rave/core/nativeImpl/dsv/Dsv (static) // Dsv
  33459. //@import com/ibm/rave/core/nativeImpl/dsv/Csv (static) // Csv
  33460. //@import com/ibm/rave/core/nativeImpl/dsv/Tsv (static) // Tsv
  33461. //@import com/ibm/rave/core/collections/MapFunctionClass (static) // new
  33462. var com_ibm_rave_core_Rave = rave_externs["Rave"] = {
  33463. //constructor : function() {}
  33464. };
  33465. /**
  33466. * @see (com.ibm.rave.core.nativeImpl.math.Transform) Transform
  33467. */
  33468. /** @expose */
  33469. com_ibm_rave_core_Rave.transform = com_ibm_rave_core_nativeImpl_math_Transform.create;
  33470. /**
  33471. * @see this.Selector#this.init(com_ibm_rave_core_scene_SceneNode)
  33472. */
  33473. com_ibm_rave_core_Rave.select$0 = function(node) {
  33474. return new com_ibm_rave_core_selector_Selector().init(node);
  33475. };
  33476. /**
  33477. * @see this.Selector#this.init(String)
  33478. */
  33479. com_ibm_rave_core_Rave.select$1 = function(query) {
  33480. return new com_ibm_rave_core_selector_Selector().init(query);
  33481. };
  33482. /**
  33483. * @see this.Selector#this.initAll()
  33484. */
  33485. com_ibm_rave_core_Rave.selectAll$0 = function(nodes) {
  33486. return new com_ibm_rave_core_selector_Selector().initAll(nodes);
  33487. };
  33488. /**
  33489. * @see this.Selector#this.initAll(String)
  33490. */
  33491. com_ibm_rave_core_Rave.selectAll$1 = function(query) {
  33492. return new com_ibm_rave_core_selector_Selector().initAll(query);
  33493. };
  33494. /**
  33495. * @see this.Transition#this.newTransition()
  33496. */
  33497. com_ibm_rave_core_Rave.transition$0 = com_ibm_rave_core_transition_Transition.newTransition;
  33498. /**
  33499. * @see this.Transition#this.newTransition(com_ibm_rave_core_selector_Selection)
  33500. */
  33501. com_ibm_rave_core_Rave.transition$1 = com_ibm_rave_core_transition_Transition.newTransition;
  33502. /**
  33503. * @see this.Transition#this.newTransition()
  33504. */
  33505. com_ibm_rave_core_Rave.transition$2 = com_ibm_rave_core_transition_Transition.newTransition;
  33506. /**
  33507. * @see this.Transition#this.newTransition(, )
  33508. */
  33509. com_ibm_rave_core_Rave.transition$3 = com_ibm_rave_core_transition_Transition.newTransition;
  33510. /**
  33511. * @see this.Merge#this.merge(Array)
  33512. */
  33513. /** @expose */
  33514. com_ibm_rave_core_Rave.merge = com_ibm_rave_core_arrays_Merge.merge;
  33515. /**
  33516. * @see this.MinMax#this.max(Array)
  33517. */
  33518. com_ibm_rave_core_Rave.max$0 = com_ibm_rave_core_arrays_MinMax.max$0;
  33519. /**
  33520. * @see this.MinMax#this.max(Array, com_ibm_rave_core_selector_ValueFunction)
  33521. */
  33522. com_ibm_rave_core_Rave.max$1 = com_ibm_rave_core_arrays_MinMax.max$1;
  33523. /**
  33524. * @see this.MinMax#this.min(Array)
  33525. */
  33526. com_ibm_rave_core_Rave.min$0 = com_ibm_rave_core_arrays_MinMax.min$0;
  33527. /**
  33528. * @see this.MinMax#this.min(Array, com_ibm_rave_core_selector_ValueFunction)
  33529. */
  33530. com_ibm_rave_core_Rave.min$1 = com_ibm_rave_core_arrays_MinMax.min$1;
  33531. /**
  33532. * @see this.Quantile#this.quantile(Array, )
  33533. */
  33534. /** @expose */
  33535. com_ibm_rave_core_Rave.quantile = com_ibm_rave_core_arrays_Quantile.quantile;
  33536. /**
  33537. * @see this.Deviation#this.deviation()
  33538. */
  33539. com_ibm_rave_core_Rave.deviation$0 = com_ibm_rave_core_arrays_Deviation.deviation$0;
  33540. /**
  33541. * @see Deviation#deviation(Object[], ValueFunction).
  33542. */
  33543. com_ibm_rave_core_Rave.deviation$1 = com_ibm_rave_core_arrays_Deviation.deviation$1;
  33544. /**
  33545. * @see this.Variance#this.variance()
  33546. */
  33547. com_ibm_rave_core_Rave.variance$0 = com_ibm_rave_core_arrays_Variance.variance$0;
  33548. /**
  33549. * @see this.Variance#this.variance(, com_ibm_rave_core_selector_ValueFunction)
  33550. */
  33551. com_ibm_rave_core_Rave.variance$1 = com_ibm_rave_core_arrays_Variance.variance$1;
  33552. /**
  33553. * @see this.Mean#this.mean()
  33554. */
  33555. com_ibm_rave_core_Rave.mean$0 = com_ibm_rave_core_arrays_Mean.mean$0;
  33556. /**
  33557. * @see this.Mean#this.mean(, com_ibm_rave_core_selector_ValueFunction)
  33558. */
  33559. com_ibm_rave_core_Rave.mean$1 = com_ibm_rave_core_arrays_Mean.mean$1;
  33560. /**
  33561. * @see this.Median#this.median()
  33562. */
  33563. com_ibm_rave_core_Rave.median$0 = com_ibm_rave_core_arrays_Median.median$0;
  33564. /**
  33565. * @see this.Median#this.median(, com_ibm_rave_core_selector_ValueFunction)
  33566. */
  33567. com_ibm_rave_core_Rave.median$1 = com_ibm_rave_core_arrays_Median.median$1;
  33568. /**
  33569. * @see this.Extent#this.extent()
  33570. */
  33571. com_ibm_rave_core_Rave.extent$0 = com_ibm_rave_core_arrays_Extent.extent$0;
  33572. /**
  33573. * @see this.Extent#this.extent(, com_ibm_rave_core_selector_ValueFunction)
  33574. */
  33575. com_ibm_rave_core_Rave.extent$1 = com_ibm_rave_core_arrays_Extent.extent$1;
  33576. /**
  33577. * @see this.Sum#this.sum(Array)
  33578. */
  33579. com_ibm_rave_core_Rave.sum$0 = com_ibm_rave_core_arrays_Sum.sum$0;
  33580. /**
  33581. * @see this.Sum#this.sum(Array, com_ibm_rave_core_selector_ValueFunction)
  33582. */
  33583. com_ibm_rave_core_Rave.sum$1 = com_ibm_rave_core_arrays_Sum.sum$1;
  33584. /**
  33585. * @see this.Zip#this.zip(Array...)
  33586. */
  33587. /** @expose */
  33588. com_ibm_rave_core_Rave.zip = com_ibm_rave_core_arrays_Zip.zip;
  33589. /**
  33590. * Uses the zip operator as a two-dimensional matrix transpose.
  33591. * @see this.Zip#this.zip(Array...)
  33592. */
  33593. /** @expose */
  33594. com_ibm_rave_core_Rave.transpose = function(objects) {
  33595. return com_ibm_rave_core_arrays_Zip.zip.apply(com_ibm_rave_core_arrays_Zip, objects);
  33596. };
  33597. /**
  33598. * @see this.Permute#this.permute(Array, Array)
  33599. */
  33600. /** @expose */
  33601. com_ibm_rave_core_Rave.permute = com_ibm_rave_core_arrays_Permute.permute;
  33602. /**
  33603. * @see this.Shuffle#this.shuffle(Array)
  33604. */
  33605. com_ibm_rave_core_Rave.shuffle$0 = com_ibm_rave_core_arrays_Shuffle.shuffle$0;
  33606. /**
  33607. * @see this.Shuffle#this.shuffle(Array)
  33608. */
  33609. com_ibm_rave_core_Rave.shuffle$1 = com_ibm_rave_core_arrays_Shuffle.shuffle$1;
  33610. /**
  33611. * @see this.Shuffle#this.shuffle(Array)
  33612. */
  33613. com_ibm_rave_core_Rave.shuffle$2 = com_ibm_rave_core_arrays_Shuffle.shuffle$2;
  33614. /**
  33615. * @see this.Range#this.create(Object)
  33616. */
  33617. com_ibm_rave_core_Rave.range$0 = com_ibm_rave_core_arrays_Range.create;
  33618. /**
  33619. * @see this.Range#this.create(Object, Object)
  33620. */
  33621. com_ibm_rave_core_Rave.range$1 = com_ibm_rave_core_arrays_Range.create;
  33622. /**
  33623. * @see this.Range#this.create(Object, Object, Object)
  33624. */
  33625. com_ibm_rave_core_Rave.range$2 = com_ibm_rave_core_arrays_Range.create;
  33626. /**
  33627. * @see this.Bisector#this.create(com_ibm_rave_core_util_Comparator)
  33628. */
  33629. com_ibm_rave_core_Rave.bisector$0 = com_ibm_rave_core_arrays_Bisector.create;
  33630. /**
  33631. * @see this.Bisector#this.create(com_ibm_rave_core_functions_DoubleValueFunction)
  33632. */
  33633. com_ibm_rave_core_Rave.bisector$1 = com_ibm_rave_core_arrays_Bisector.create;
  33634. /**
  33635. * @see this.Dispatcher#this.create(String...)
  33636. */
  33637. /** @expose */
  33638. com_ibm_rave_core_Rave.dispatch = function(types) {
  33639. if (types !== null || arguments.length > 1){
  33640. types = Array.prototype.slice.call(arguments);
  33641. }
  33642. {
  33643. return com_ibm_rave_core_event_Dispatcher.create.apply(com_ibm_rave_core_event_Dispatcher, types);
  33644. }
  33645. };
  33646. /**
  33647. * @see this.Mouse#this.mousePoint(com_ibm_rave_core_scene_SceneNode)
  33648. */
  33649. /** @expose */
  33650. com_ibm_rave_core_Rave.mouse = com_ibm_rave_core_nativeImpl_event_Mouse.mousePoint;
  33651. /**
  33652. * @see this.TouchUtil#this.touch(, , )
  33653. */
  33654. com_ibm_rave_core_Rave.touch$0 = com_ibm_rave_core_event_TouchUtil.touch;
  33655. /**
  33656. * @see this.TouchUtil#this.touchFromSource(com_ibm_rave_core_scene_SceneNode, String)
  33657. */
  33658. com_ibm_rave_core_Rave.touch$1 = com_ibm_rave_core_event_TouchUtil.touchFromSource;
  33659. /**
  33660. * @see this.Touches#this.touches(com_ibm_rave_core_scene_SceneNode)
  33661. */
  33662. com_ibm_rave_core_Rave.touches$0 = com_ibm_rave_core_nativeImpl_event_Touches.touches;
  33663. /**
  33664. * @see this.Touches#this.touches(, )
  33665. */
  33666. com_ibm_rave_core_Rave.touches$1 = com_ibm_rave_core_nativeImpl_event_Touches.touches;
  33667. /**
  33668. * @see this.Colors#this.newLAB(, , )
  33669. */
  33670. com_ibm_rave_core_Rave.lab$0 = com_ibm_rave_core_color_Colors.newLAB;
  33671. /**
  33672. * @see this.Colors#this.newLAB(Object)
  33673. */
  33674. com_ibm_rave_core_Rave.lab$1 = com_ibm_rave_core_color_Colors.newLAB;
  33675. /**
  33676. * @see this.Colors#this.newHCL(, , )
  33677. */
  33678. com_ibm_rave_core_Rave.hcl$0 = com_ibm_rave_core_color_Colors.newHCL;
  33679. /**
  33680. * @see this.Colors#this.newHCL(Object)
  33681. */
  33682. com_ibm_rave_core_Rave.hcl$1 = com_ibm_rave_core_color_Colors.newHCL;
  33683. /**
  33684. * @see this.Colors#this.newHSL(, , )
  33685. */
  33686. com_ibm_rave_core_Rave.hsl$0 = com_ibm_rave_core_color_Colors.newHSL;
  33687. /**
  33688. * @see this.Colors#this.newHSL(Object)
  33689. */
  33690. com_ibm_rave_core_Rave.hsl$1 = com_ibm_rave_core_color_Colors.newHSL;
  33691. /**
  33692. * @see this.Colors#this.newRGB(, , )
  33693. */
  33694. com_ibm_rave_core_Rave.rgb$0 = com_ibm_rave_core_color_Colors.newRGB;
  33695. /**
  33696. * @see this.Colors#this.newRGB(Object)
  33697. */
  33698. com_ibm_rave_core_Rave.rgb$1 = com_ibm_rave_core_color_Colors.newRGB;
  33699. /**
  33700. * @see this.Round#this.round(, )
  33701. */
  33702. /** @expose */
  33703. com_ibm_rave_core_Rave.round = com_ibm_rave_core_format_Round.round;
  33704. /**
  33705. * @see this.Requote#this.requote(String)
  33706. */
  33707. /** @expose */
  33708. com_ibm_rave_core_Rave.requote = com_ibm_rave_core_nativeImpl_format_Requote.requote;
  33709. /**
  33710. * @see this.FormatPrefix#this.formatPrefix(, Number)
  33711. */
  33712. /** @expose */
  33713. com_ibm_rave_core_Rave.formatPrefix = com_ibm_rave_core_format_FormatPrefix.formatPrefix;
  33714. /**
  33715. * @see this.AssociativeArrays#this.keys(java_util_Map)
  33716. * @return (Array) list of keys for a given map
  33717. */
  33718. /** @expose */
  33719. com_ibm_rave_core_Rave.keys = com_ibm_rave_core_nativeImpl_arrays_AssociativeArrays.keys;
  33720. /**
  33721. * @see this.AssociativeArrays#this.values(java_util_Map)
  33722. * @return (Array) list of values for a given map
  33723. */
  33724. /** @expose */
  33725. com_ibm_rave_core_Rave.values = com_ibm_rave_core_nativeImpl_arrays_AssociativeArrays.values;
  33726. /**
  33727. * @see this.AssociativeArrays#this.entries(java_util_Map)
  33728. * @return (Array) list of key and value pair for a given map
  33729. */
  33730. /** @expose */
  33731. com_ibm_rave_core_Rave.entries = com_ibm_rave_core_nativeImpl_arrays_AssociativeArrays.entries;
  33732. /**
  33733. * Creates a new nest operator. The set of keys is initially empty. If the map or entries operator is invoked before any key functions are registered, the nest operator simply returns the input array.
  33734. * @return (com.ibm.rave.core.arrays.Nest) the nest operator
  33735. */
  33736. /** @expose */
  33737. com_ibm_rave_core_Rave.nest = function() {
  33738. return new com_ibm_rave_core_arrays_Nest();
  33739. };
  33740. /** @expose */
  33741. com_ibm_rave_core_Rave.selection = function() {
  33742. return new com_ibm_rave_core_selector_Selector().init(com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocumentElement(com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocument()));
  33743. };
  33744. /**
  33745. * @param (java.lang.Object[]) array
  33746. * @return (java.lang.Object[]) Object[]
  33747. * @see this.Pairs#this.pairs()
  33748. */
  33749. /** @expose */
  33750. com_ibm_rave_core_Rave.pairs = com_ibm_rave_core_arrays_Pairs.pairs;
  33751. /**
  33752. * Constructs a new set. If array is specified, adds the given array of string values to the returned set.
  33753. * @return (com.ibm.rave.core.arrays.RaveSet) a new Set
  33754. * @see this.RaveSet#this.create()
  33755. */
  33756. com_ibm_rave_core_Rave.set$0 = com_ibm_rave_core_arrays_RaveSet.create;
  33757. /**
  33758. * Constructs a new set. If array is specified, adds the given array of string values to the returned set.
  33759. * @return (com.ibm.rave.core.arrays.RaveSet) a new Set
  33760. * @see this.RaveSet#this.create()
  33761. */
  33762. com_ibm_rave_core_Rave.set$1 = com_ibm_rave_core_arrays_RaveSet.create;
  33763. /** @expose */
  33764. com_ibm_rave_core_Rave.select = function(a0) {
  33765. var args = arguments;
  33766. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  33767. return com_ibm_rave_core_Rave.select$1(a0);
  33768. }
  33769. return com_ibm_rave_core_Rave.select$0(a0);
  33770. };
  33771. /** @expose */
  33772. com_ibm_rave_core_Rave.selectAll = function(a0) {
  33773. var args = arguments;
  33774. if (args.length == 1 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]")) {
  33775. return com_ibm_rave_core_Rave.selectAll$0(a0);
  33776. }
  33777. return com_ibm_rave_core_Rave.selectAll$1(a0);
  33778. };
  33779. /** @expose */
  33780. com_ibm_rave_core_Rave.transition = function(a0, a1) {
  33781. var args = arguments;
  33782. if (args.length == 0) {
  33783. return com_ibm_rave_core_Rave.transition$0();
  33784. }
  33785. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  33786. return com_ibm_rave_core_Rave.transition$2(a0);
  33787. }
  33788. if (args.length == 1) {
  33789. return com_ibm_rave_core_Rave.transition$1(a0);
  33790. }
  33791. return com_ibm_rave_core_Rave.transition$3(a0, a1);
  33792. };
  33793. /** @expose */
  33794. com_ibm_rave_core_Rave.max = function(a0, a1) {
  33795. var args = arguments;
  33796. if (args.length == 1) {
  33797. return com_ibm_rave_core_Rave.max$0(a0);
  33798. }
  33799. return com_ibm_rave_core_Rave.max$1(a0, a1);
  33800. };
  33801. /** @expose */
  33802. com_ibm_rave_core_Rave.min = function(a0, a1) {
  33803. var args = arguments;
  33804. if (args.length == 1) {
  33805. return com_ibm_rave_core_Rave.min$0(a0);
  33806. }
  33807. return com_ibm_rave_core_Rave.min$1(a0, a1);
  33808. };
  33809. /** @expose */
  33810. com_ibm_rave_core_Rave.deviation = function(a0, a1) {
  33811. var args = arguments;
  33812. if (args.length == 1) {
  33813. return com_ibm_rave_core_Rave.deviation$0(a0);
  33814. }
  33815. return com_ibm_rave_core_Rave.deviation$1(a0, a1);
  33816. };
  33817. /** @expose */
  33818. com_ibm_rave_core_Rave.variance = function(a0, a1) {
  33819. var args = arguments;
  33820. if (args.length == 1) {
  33821. return com_ibm_rave_core_Rave.variance$0(a0);
  33822. }
  33823. return com_ibm_rave_core_Rave.variance$1(a0, a1);
  33824. };
  33825. /** @expose */
  33826. com_ibm_rave_core_Rave.mean = function(a0, a1) {
  33827. var args = arguments;
  33828. if (args.length == 1) {
  33829. return com_ibm_rave_core_Rave.mean$0(a0);
  33830. }
  33831. return com_ibm_rave_core_Rave.mean$1(a0, a1);
  33832. };
  33833. /** @expose */
  33834. com_ibm_rave_core_Rave.median = function(a0, a1) {
  33835. var args = arguments;
  33836. if (args.length == 1) {
  33837. return com_ibm_rave_core_Rave.median$0(a0);
  33838. }
  33839. return com_ibm_rave_core_Rave.median$1(a0, a1);
  33840. };
  33841. /** @expose */
  33842. com_ibm_rave_core_Rave.extent = function(a0, a1) {
  33843. var args = arguments;
  33844. if (args.length == 1) {
  33845. return com_ibm_rave_core_Rave.extent$0(a0);
  33846. }
  33847. return com_ibm_rave_core_Rave.extent$1(a0, a1);
  33848. };
  33849. /** @expose */
  33850. com_ibm_rave_core_Rave.sum = function(a0, a1) {
  33851. var args = arguments;
  33852. if (args.length == 1) {
  33853. return com_ibm_rave_core_Rave.sum$0(a0);
  33854. }
  33855. return com_ibm_rave_core_Rave.sum$1(a0, a1);
  33856. };
  33857. /** @expose */
  33858. com_ibm_rave_core_Rave.shuffle = function(a0, a1, a2) {
  33859. var args = arguments;
  33860. if (args.length == 1) {
  33861. return com_ibm_rave_core_Rave.shuffle$0(a0);
  33862. }
  33863. if (args.length == 2) {
  33864. return com_ibm_rave_core_Rave.shuffle$1(a0, a1);
  33865. }
  33866. return com_ibm_rave_core_Rave.shuffle$2(a0, a1, a2);
  33867. };
  33868. /** @expose */
  33869. com_ibm_rave_core_Rave.range = function(a0, a1, a2) {
  33870. var args = arguments;
  33871. if (args.length == 1) {
  33872. return com_ibm_rave_core_Rave.range$0(a0);
  33873. }
  33874. if (args.length == 2) {
  33875. return com_ibm_rave_core_Rave.range$1(a0, a1);
  33876. }
  33877. return com_ibm_rave_core_Rave.range$2(a0, a1, a2);
  33878. };
  33879. /** @expose */
  33880. com_ibm_rave_core_Rave.bisector = function(a0) {
  33881. var args = arguments;
  33882. if (args.length == 1 && typeof a0 === "function" && a0.length == 2) {
  33883. return com_ibm_rave_core_Rave.bisector$0(a0);
  33884. }
  33885. return com_ibm_rave_core_Rave.bisector$1(a0);
  33886. };
  33887. /** @expose */
  33888. com_ibm_rave_core_Rave.touch = function(a0, a1, a2) {
  33889. var args = arguments;
  33890. if (args.length == 2) {
  33891. return com_ibm_rave_core_Rave.touch$1(a0, a1);
  33892. }
  33893. return com_ibm_rave_core_Rave.touch$0(a0, a1, a2);
  33894. };
  33895. /** @expose */
  33896. com_ibm_rave_core_Rave.touches = function(a0, a1) {
  33897. var args = arguments;
  33898. if (args.length == 1) {
  33899. return com_ibm_rave_core_Rave.touches$0(a0);
  33900. }
  33901. return com_ibm_rave_core_Rave.touches$1(a0, a1);
  33902. };
  33903. /** @expose */
  33904. com_ibm_rave_core_Rave.lab = function(a0, a1, a2) {
  33905. var args = arguments;
  33906. if (args.length == 1) {
  33907. return com_ibm_rave_core_Rave.lab$1(a0);
  33908. }
  33909. return com_ibm_rave_core_Rave.lab$0(a0, a1, a2);
  33910. };
  33911. /** @expose */
  33912. com_ibm_rave_core_Rave.hcl = function(a0, a1, a2) {
  33913. var args = arguments;
  33914. if (args.length == 1) {
  33915. return com_ibm_rave_core_Rave.hcl$1(a0);
  33916. }
  33917. return com_ibm_rave_core_Rave.hcl$0(a0, a1, a2);
  33918. };
  33919. /** @expose */
  33920. com_ibm_rave_core_Rave.hsl = function(a0, a1, a2) {
  33921. var args = arguments;
  33922. if (args.length == 1) {
  33923. return com_ibm_rave_core_Rave.hsl$1(a0);
  33924. }
  33925. return com_ibm_rave_core_Rave.hsl$0(a0, a1, a2);
  33926. };
  33927. /** @expose */
  33928. com_ibm_rave_core_Rave.rgb = function(a0, a1, a2) {
  33929. var args = arguments;
  33930. if (args.length == 1) {
  33931. return com_ibm_rave_core_Rave.rgb$1(a0);
  33932. }
  33933. return com_ibm_rave_core_Rave.rgb$0(a0, a1, a2);
  33934. };
  33935. /** @expose */
  33936. com_ibm_rave_core_Rave.set = function(a0) {
  33937. var args = arguments;
  33938. if (args.length == 0) {
  33939. return com_ibm_rave_core_Rave.set$0();
  33940. }
  33941. return com_ibm_rave_core_Rave.set$1(a0);
  33942. };
  33943. {
  33944. com_ibm_rave_core_internal_nativeImpl_PlatformInitialization();
  33945. }
  33946. /**
  33947. * @see (com.ibm.rave.core.textMetrics.CanvasUtil) CanvasUtil
  33948. */
  33949. /** @expose */
  33950. com_ibm_rave_core_Rave.canvas = com_ibm_rave_core_textMetrics_CanvasUtil.INSTANCE;
  33951. /**
  33952. * @see (com.ibm.rave.core.nativeImpl.event.EventTracker) EventTracker
  33953. */
  33954. /** @expose */
  33955. com_ibm_rave_core_Rave.event = com_ibm_rave_core_nativeImpl_event_EventTracker.INSTANCE;
  33956. /**
  33957. * @see (com.ibm.rave.core.Configuration) Configuration
  33958. */
  33959. /** @expose */
  33960. com_ibm_rave_core_Rave.configuration = com_ibm_rave_core_Configuration.INSTANCE;
  33961. /**
  33962. * @see (com.ibm.rave.core.nativeImpl.timer.Timer) Timer
  33963. */
  33964. /** @expose */
  33965. com_ibm_rave_core_Rave.timer = com_ibm_rave_core_nativeImpl_timer_Timer.INSTANCE;
  33966. /**
  33967. * @see (com.ibm.rave.core.geom.Geom) Geom
  33968. */
  33969. /** @expose */
  33970. com_ibm_rave_core_Rave.geom = com_ibm_rave_core_geom_Geom.INSTANCE;
  33971. /**
  33972. * @see (com.ibm.rave.core.scales.Scales) Scales
  33973. */
  33974. /** @expose */
  33975. com_ibm_rave_core_Rave.scale = com_ibm_rave_core_scales_Scales.INSTANCE;
  33976. /**
  33977. * @see (com.ibm.rave.core.layout.Layout) Layout
  33978. */
  33979. /** @expose */
  33980. com_ibm_rave_core_Rave.layout = com_ibm_rave_core_layout_Layout.INSTANCE;
  33981. /**
  33982. * @see (com.ibm.rave.core.capabilities.Capabilities) Capabilities
  33983. */
  33984. /** @expose */
  33985. com_ibm_rave_core_Rave.capabilities = com_ibm_rave_core_capabilities_Capabilities.INSTANCE;
  33986. /**
  33987. * @see (com.ibm.rave.core.svg.SVG) SVG
  33988. */
  33989. /** @expose */
  33990. com_ibm_rave_core_Rave.svg = com_ibm_rave_core_svg_SVG.getInstance();
  33991. /**
  33992. * @see (com.ibm.rave.core.geo.Geo) Geo
  33993. */
  33994. /** @expose */
  33995. com_ibm_rave_core_Rave.geo = com_ibm_rave_core_geo_Geo.INSTANCE;
  33996. /**
  33997. * @see (com.ibm.rave.core.behavior.Behavior) Behavior
  33998. */
  33999. /** @expose */
  34000. com_ibm_rave_core_Rave.behavior = com_ibm_rave_core_behavior_Behavior.INSTANCE;
  34001. /**
  34002. * @see (com.ibm.rave.core.time.Time) Time
  34003. */
  34004. /** @expose */
  34005. com_ibm_rave_core_Rave.time = com_ibm_rave_core_time_Time.getInstance();
  34006. /**
  34007. * @see (com.ibm.rave.core.globalization.Bidi) Bidi
  34008. */
  34009. /** @expose */
  34010. com_ibm_rave_core_Rave.bidi = com_ibm_rave_core_globalization_Bidi.INSTANCE;
  34011. /**
  34012. * @see (com.ibm.rave.core.util.Namespace) Namespace
  34013. */
  34014. /** @expose */
  34015. com_ibm_rave_core_Rave.ns = com_ibm_rave_core_util_Namespace.INSTANCE;
  34016. /**
  34017. * @see (com.ibm.rave.core.math.Random) Random
  34018. */
  34019. /** @expose */
  34020. com_ibm_rave_core_Rave.random = com_ibm_rave_core_math_Random.INSTANCE;
  34021. /**
  34022. * @see this.NumberFormat#this.INSTANCE
  34023. */
  34024. /** @expose */
  34025. com_ibm_rave_core_Rave.format = new com_ibm_rave_core_locale_NumberFormat(com_ibm_rave_core_locale_Locale.DEFAULT_LOCALE);
  34026. /**
  34027. * @see this.Locale#this.locale
  34028. */
  34029. /** @expose */
  34030. com_ibm_rave_core_Rave.locale = com_ibm_rave_core_locale_Locale.getInstance();
  34031. /**
  34032. * @see this.Bisector#com_ibm_rave_core_arrays_Bisector.bisectLeft
  34033. */
  34034. /** @expose */
  34035. com_ibm_rave_core_Rave.bisectLeft = com_ibm_rave_core_arrays_Bisector.bisectLeft;
  34036. /**
  34037. * @see this.Bisector#com_ibm_rave_core_arrays_Bisector.bisectRight
  34038. */
  34039. /** @expose */
  34040. com_ibm_rave_core_Rave.bisectRight = com_ibm_rave_core_arrays_Bisector.bisectRight;
  34041. /**
  34042. * @see this.Bisector#com_ibm_rave_core_arrays_Bisector.bisect
  34043. */
  34044. /** @expose */
  34045. com_ibm_rave_core_Rave.bisect = com_ibm_rave_core_arrays_Bisector.bisect;
  34046. /**
  34047. * @see this.Sort#com_ibm_rave_core_arrays_Sort.descending
  34048. */
  34049. /** @expose */
  34050. com_ibm_rave_core_Rave.descending = com_ibm_rave_core_arrays_Sort.descending;
  34051. /**
  34052. * @see this.Sort#com_ibm_rave_core_arrays_Sort.descending
  34053. */
  34054. /** @expose */
  34055. com_ibm_rave_core_Rave.ascending = com_ibm_rave_core_arrays_Sort.ascending;
  34056. /**
  34057. * @see (com.ibm.rave.core.ease.Easing) Easing
  34058. */
  34059. /** @expose */
  34060. com_ibm_rave_core_Rave.ease = com_ibm_rave_core_ease_Easing.INSTANCE;
  34061. /**
  34062. * A base type is provided if you want to extend the core with additional color spaces. This type enables automatic RGB interpolation is detected via instanceof.
  34063. */
  34064. /** @expose */
  34065. com_ibm_rave_core_Rave.color = com_ibm_rave_core_color_Color;
  34066. /**
  34067. * @see (com.ibm.rave.core.interpolate.Interpolators) Interpolators
  34068. */
  34069. /** @expose */
  34070. com_ibm_rave_core_Rave.interpolators = com_ibm_rave_core_interpolate_Interpolators.INSTANCE;
  34071. /**
  34072. * @see this.Interpolate#com_ibm_rave_core_interpolate_Interpolate.INSTANCE
  34073. */
  34074. /** @expose */
  34075. com_ibm_rave_core_Rave.interpolate = com_ibm_rave_core_interpolate_Interpolate.INSTANCE;
  34076. /**
  34077. * @see this.ColorInterpolation#com_ibm_rave_core_interpolate_ColorInterpolation.HCLINSTANCE
  34078. */
  34079. /** @expose */
  34080. com_ibm_rave_core_Rave.interpolateHcl = com_ibm_rave_core_interpolate_ColorInterpolation.HCLINSTANCE;
  34081. /**
  34082. * @see this.ColorInterpolation#com_ibm_rave_core_interpolate_ColorInterpolation.HSLINSTANCE
  34083. */
  34084. /** @expose */
  34085. com_ibm_rave_core_Rave.interpolateHsl = com_ibm_rave_core_interpolate_ColorInterpolation.HSLINSTANCE;
  34086. /**
  34087. * @see this.ColorInterpolation#com_ibm_rave_core_interpolate_ColorInterpolation.LABINSTANCE
  34088. */
  34089. /** @expose */
  34090. com_ibm_rave_core_Rave.interpolateLab = com_ibm_rave_core_interpolate_ColorInterpolation.LABINSTANCE;
  34091. /**
  34092. * @see this.ColorInterpolation#com_ibm_rave_core_interpolate_ColorInterpolation.RGBINSTANCE
  34093. */
  34094. /** @expose */
  34095. com_ibm_rave_core_Rave.interpolateRgb = com_ibm_rave_core_interpolate_ColorInterpolation.RGBINSTANCE;
  34096. /**
  34097. * @see this.StringInterpolation#com_ibm_rave_core_interpolate_StringInterpolation.INSTANCE
  34098. */
  34099. /** @expose */
  34100. com_ibm_rave_core_Rave.interpolateString = com_ibm_rave_core_interpolate_StringInterpolation.INSTANCE;
  34101. /**
  34102. * @see this.NumberInterpolation#com_ibm_rave_core_interpolate_NumberInterpolation.INSTANCE
  34103. */
  34104. /** @expose */
  34105. com_ibm_rave_core_Rave.interpolateNumber = com_ibm_rave_core_interpolate_NumberInterpolation.INSTANCE;
  34106. /**
  34107. * @see this.RoundInterpolation#com_ibm_rave_core_interpolate_RoundInterpolation.INSTANCE
  34108. */
  34109. /** @expose */
  34110. com_ibm_rave_core_Rave.interpolateRound = com_ibm_rave_core_interpolate_RoundInterpolation.INSTANCE;
  34111. /**
  34112. * @see this.ArrayInterpolation#com_ibm_rave_core_interpolate_ArrayInterpolation.INSTANCE
  34113. */
  34114. /** @expose */
  34115. com_ibm_rave_core_Rave.interpolateArray = com_ibm_rave_core_interpolate_ArrayInterpolation.INSTANCE;
  34116. /**
  34117. * @see this.ObjectInterpolation#com_ibm_rave_core_nativeImpl_interpolate_ObjectInterpolation.INSTANCE
  34118. */
  34119. /** @expose */
  34120. com_ibm_rave_core_Rave.interpolateObject = com_ibm_rave_core_nativeImpl_interpolate_ObjectInterpolation.INSTANCE;
  34121. /**
  34122. * @see this.TransformInterpolation#com_ibm_rave_core_nativeImpl_interpolate_TransformInterpolation.INSTANCE
  34123. */
  34124. /** @expose */
  34125. com_ibm_rave_core_Rave.interpolateTransform = com_ibm_rave_core_nativeImpl_interpolate_TransformInterpolation.INSTANCE;
  34126. /**
  34127. * @see this.ZoomInterpolation#com_ibm_rave_core_interpolate_ZoomInterpolation.INSTANCE
  34128. */
  34129. /** @expose */
  34130. com_ibm_rave_core_Rave.interpolateZoom = com_ibm_rave_core_interpolate_ZoomInterpolation.INSTANCE;
  34131. /** @expose */
  34132. com_ibm_rave_core_Rave.xhr = com_ibm_rave_core_nativeImpl_xhr_XhrIdentity.INSTANCE;
  34133. /** @expose */
  34134. com_ibm_rave_core_Rave.text = com_ibm_rave_core_nativeImpl_xhr_XhrText.INSTANCE;
  34135. /** @expose */
  34136. com_ibm_rave_core_Rave.json = com_ibm_rave_core_nativeImpl_xhr_XhrJson.INSTANCE;
  34137. /** @expose */
  34138. com_ibm_rave_core_Rave.html = com_ibm_rave_core_nativeImpl_xhr_XhrHtml.INSTANCE;
  34139. /** @expose */
  34140. com_ibm_rave_core_Rave.xml = com_ibm_rave_core_nativeImpl_xhr_XhrXml.INSTANCE;
  34141. /** @expose */
  34142. com_ibm_rave_core_Rave.dsv = com_ibm_rave_core_nativeImpl_dsv_Dsv.INSTANCE;
  34143. /** @expose */
  34144. com_ibm_rave_core_Rave.csv = com_ibm_rave_core_nativeImpl_dsv_Csv.INSTANCE;
  34145. /** @expose */
  34146. com_ibm_rave_core_Rave.tsv = com_ibm_rave_core_nativeImpl_dsv_Tsv.INSTANCE;
  34147. /**
  34148. * Map function
  34149. */
  34150. /** @expose */
  34151. com_ibm_rave_core_Rave.map = new com_ibm_rave_core_collections_MapFunctionClass();
  34152. // $source: com/ibm/rave/core/internal/selector/mirror/MirroredSelector
  34153. /************************************************************************
  34154. ** IBM Confidential
  34155. **
  34156. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  34157. **
  34158. ** (C) Copyright IBM Corp. 2015
  34159. **
  34160. ** The source code for this program is not published or otherwise divested of its trade secrets,
  34161. ** irrespective of what has been deposited with the U.S. Copyright Office.
  34162. ************************************************************************/
  34163. // GENERATED
  34164. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  34165. //@import com/ibm/rave/core/selector/Selector (loadtime) // superclass
  34166. //@import com/ibm/rave/core/internal/selector/mirror/MirroredSceneNodeHelper (runtime) // mirrorRoot, unMirrorNode
  34167. //@import com/ibm/rave/core/Rave (static) // Rave
  34168. //@import com/ibm/rave/core/internal/selector/mirror/MirroredSceneNodeExtension (runtime) // extend
  34169. //@import com/ibm/rave/core/Configuration (static) // Configuration
  34170. //@import com/ibm/rave/core/internal/selector/mirror/MirrorUtil (runtime) // isGroupNode
  34171. //@import com/ibm/rave/core/internal/util/QueryUtil (runtime) // getQueryEngine
  34172. /**
  34173. * Selector returned by a call to Selector.mirror(). Handles additional mirroring functionality.
  34174. */
  34175. var com_ibm_rave_core_internal_selector_mirror_MirroredSelector = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_selector_Selector, {
  34176. /** @expose */
  34177. getSelectorFactory : function() {
  34178. return com_ibm_rave_core_internal_selector_mirror_MirroredSelector.factory;
  34179. },
  34180. /**
  34181. * Internal constructor for a selector containing mirrored objects.
  34182. */
  34183. constructor : function() {
  34184. this.needsNodeExtension = true;
  34185. },
  34186. /**
  34187. * Mirror a selector consisting of nodes (i.e. svg, "g", etc).
  34188. */
  34189. /** @expose */
  34190. mirror : function(mirror) {
  34191. this.each(function(data, index, groupIndex) {
  34192. if (mirror) {
  34193. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.mirrorRoot(this);
  34194. } else {
  34195. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.unMirrorNode(this);
  34196. }
  34197. });
  34198. return this;
  34199. }
  34200. });
  34201. /**
  34202. * Register the mirror extension for scene nodes.
  34203. * @param (String) URI
  34204. */
  34205. com_ibm_rave_core_internal_selector_mirror_MirroredSelector.register = function(URI) {
  34206. com_ibm_rave_core_Rave.configuration.addSceneNodeExtensionFactory(URI, function(node, context) {
  34207. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeExtension.extend(node);
  34208. }, 0);
  34209. com_ibm_rave_core_Configuration.INSTANCE.registerFilter(com_ibm_rave_core_internal_selector_mirror_MirroredSelector.MIRROR_FILTER, com_ibm_rave_core_internal_selector_mirror_MirroredSelector.filterFunction);
  34210. };
  34211. com_ibm_rave_core_internal_selector_mirror_MirroredSelector.MIRROR_FILTER = "rave-mirror-filter";
  34212. com_ibm_rave_core_internal_selector_mirror_MirroredSelector.factory = function() {
  34213. return new com_ibm_rave_core_internal_selector_mirror_MirroredSelector();
  34214. };
  34215. com_ibm_rave_core_internal_selector_mirror_MirroredSelector.filterFunction = function(item, query) {
  34216. if (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isGroupNode(item)) {
  34217. if (query != null) {
  34218. return com_ibm_rave_core_internal_util_QueryUtil.getQueryEngine(item).querySelector(query, item);
  34219. }
  34220. return null;
  34221. }
  34222. return item;
  34223. };
  34224. // $source: com/ibm/rave/core/scales/LinearScale
  34225. /************************************************************************
  34226. ** IBM Confidential
  34227. **
  34228. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  34229. **
  34230. ** (C) Copyright IBM Corp. 2015
  34231. **
  34232. ** The source code for this program is not published or otherwise divested of its trade secrets,
  34233. ** irrespective of what has been deposited with the U.S. Copyright Office.
  34234. ************************************************************************/
  34235. // GENERATED
  34236. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, bind
  34237. //@import com/ibm/rave/core/scales/AbstractScale (loadtime) // scaleExtent, superclass
  34238. //@import com/ibm/rave/core/Rave (static) // formatPrefix, range, Rave
  34239. //@import com/ibm/rave/core/internal/scales/Polylinear (runtime) // new
  34240. //@import com/ibm/rave/core/internal/scales/Bilinear (runtime) // new
  34241. //@import com/ibm/rave/core/internal/interpolate/UninterpolateClamp (runtime) // new
  34242. //@import com/ibm/rave/core/internal/interpolate/UninterpolateNumber (runtime) // new
  34243. //@import com/ibm/rave/core/interpolate/RoundInterpolation (runtime) // new
  34244. //@import com/ibm/rave/core/internal/scales/Nice (static) // scaleNice, niceStep
  34245. //@import com/ibm/rave/core/locale/NumberFormat (runtime) // NumberFormat
  34246. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (runtime) // create
  34247. /**
  34248. * LinearScale maps a numerical input domain (a set [min, max]) to a numerical output range (another set [min, max]). The domain and range parameters for this scale are expected to be arrays of length 2 containing [min, max].
  34249. */
  34250. var com_ibm_rave_core_scales_LinearScale = rave_externs["LinearScale"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scales_AbstractScale, {
  34251. //_domain : null,
  34252. //_range : null,
  34253. /** @expose */
  34254. _interpolate : null,
  34255. //output : null,
  34256. /** @expose */
  34257. input : null,
  34258. /** @expose */
  34259. _clamp : false,
  34260. _$functionClassMethod : function() {
  34261. var _$self = function(data, index, groupIndex) {
  34262. return _$self.output(data);
  34263. };
  34264. return _$self;
  34265. },
  34266. constructor : function(domain, range, interpolate, clamp) {
  34267. this._domain = [0, 1];
  34268. this._range = [0, 1];
  34269. this._interpolate = com_ibm_rave_core_Rave.interpolate;
  34270. /**
  34271. * @param (Array) domain
  34272. * @param (Array) range
  34273. * @param (com.ibm.rave.core.interpolate.InterpolatorFactory) interpolate
  34274. * @param (java.lang.Boolean) clamp
  34275. */
  34276. {
  34277. if (domain) {
  34278. this.domain(domain);
  34279. }
  34280. if (range) {
  34281. this.range(range);
  34282. }
  34283. if (interpolate) {
  34284. this._interpolate = interpolate;
  34285. }
  34286. if (clamp != null) {
  34287. this._clamp = clamp;
  34288. }
  34289. var self = this;
  34290. this.invert = function(y) {
  34291. return self.input(y);
  34292. };
  34293. this.ticks = function(tickArguments) {
  34294. if (tickArguments !== null || arguments.length > 1){
  34295. tickArguments = Array.prototype.slice.call(arguments);
  34296. }
  34297. {
  34298. return com_ibm_rave_core_scales_LinearScale.linearTicks.apply(this, [self._domain].concat(tickArguments));
  34299. }
  34300. };
  34301. this.tickFormat = function(tickArguments) {
  34302. if (tickArguments !== null || arguments.length > 1){
  34303. tickArguments = Array.prototype.slice.call(arguments);
  34304. }
  34305. {
  34306. var count = tickArguments.length > 0 ? + (tickArguments[0]) : null;
  34307. var format = tickArguments.length > 1 ? tickArguments[1] : null;
  34308. return com_ibm_rave_core_scales_LinearScale.linearTickFormat(self._domain, count, ((typeof format === "string" || format instanceof String)) ? format : null);
  34309. }
  34310. };
  34311. this.rescale();
  34312. }
  34313. },
  34314. rescale : function() {
  34315. var linear = Math.min(this._domain.length, this._range.length) > 2 ? new com_ibm_rave_core_internal_scales_Polylinear() : new com_ibm_rave_core_internal_scales_Bilinear();
  34316. var uninterpolator = this._clamp ? new com_ibm_rave_core_internal_interpolate_UninterpolateClamp() : new com_ibm_rave_core_internal_interpolate_UninterpolateNumber();
  34317. this.output = linear(this._domain, this._range, uninterpolator, this._interpolate);
  34318. this.input = linear(this._range, this._domain, uninterpolator, com_ibm_rave_core_Rave.interpolate);
  34319. return this;
  34320. },
  34321. domain$0 : function(values) {
  34322. this._domain = [];
  34323. for (var __i_enFor0 = 0, __exp_enFor0 = values, __len_enFor0 = __exp_enFor0.length;
  34324. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  34325. var o = __exp_enFor0[__i_enFor0];
  34326. this._domain.push(+ (o));
  34327. }
  34328. return this.rescale();
  34329. },
  34330. domain$1 : function() {
  34331. return this._domain;
  34332. },
  34333. range$0 : function(values) {
  34334. this._range = [];
  34335. for (var __i_enFor0 = 0, __exp_enFor0 = values, __len_enFor0 = __exp_enFor0.length;
  34336. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  34337. var o = __exp_enFor0[__i_enFor0];
  34338. this._range.push(o);
  34339. }
  34340. return this.rescale();
  34341. },
  34342. range$1 : function() {
  34343. return this._range;
  34344. },
  34345. /**
  34346. * Sets the scale's output range to the specified array of values, while also setting the scale's interpolator to Rave.interpolateRound. This is a convenience routine for when the values output by the scale should be exact integers, such as to avoid antialiasing artifacts. It is also possible to round the output values manually after the scale is applied.
  34347. * @param (Array) x Output range values.
  34348. * @return (com.ibm.rave.core.scales.LinearScale) This scale.
  34349. */
  34350. /** @expose */
  34351. rangeRound : function(x) {
  34352. return this.range(x).interpolate(new com_ibm_rave_core_interpolate_RoundInterpolation());
  34353. },
  34354. /**
  34355. * If boolean is specified, enables or disables clamping accordingly. By default, clamping is disabled, such that if a value outside the input domain is passed to the scale, the scale may return a value outside the output range through linear extrapolation. For example, with the default domain and range of [0,1], an input value of 2 will return an output value of 2. If clamping is enabled, the normalized domain parameter t is clamped to the range [0,1], such that the return value of the scale is always within the scale's output range. If boolean is not specified, returns whether or not the scale currently clamps values to within the output range.
  34356. * @param (boolean) c True or False to Enable or Disable (respectively) clamping.
  34357. * @return (com.ibm.rave.core.scales.LinearScale) This scale.
  34358. */
  34359. clamp$0 : function(c) {
  34360. this._clamp = c;
  34361. return this.rescale();
  34362. },
  34363. /**
  34364. * If boolean is specified, enables or disables clamping accordingly. By default, clamping is disabled, such that if a value outside the input domain is passed to the scale, the scale may return a value outside the output range through linear extrapolation. For example, with the default domain and range of [0,1], an input value of 2 will return an output value of 2. If clamping is enabled, the normalized domain parameter t is clamped to the range [0,1], such that the return value of the scale is always within the scale's output range. If boolean is not specified, returns whether or not the scale currently clamps values to within the output range.
  34365. * @return (boolean) True if clamping is enabled, false otherwise.
  34366. */
  34367. clamp$1 : function() {
  34368. return this._clamp;
  34369. },
  34370. /**
  34371. * If factory is specified, sets the scale's output interpolator using the specified factory. The interpolator factory defaults to {@link this.Rave#com_ibm_rave_core_Rave.interpolate} , and is used to map the normalized domain parameter t in [0,1] to the corresponding value in the output range. The interpolator factory will be used to construct interpolators for each adjacent pair of values from the output range. If factory is not specified, returns the scale's interpolator factory.
  34372. * @param (com.ibm.rave.core.interpolate.InterpolatorFactory) interpolate The interpolator factory to assign to this scale.
  34373. * @return (com.ibm.rave.core.scales.LinearScale) this
  34374. */
  34375. interpolate$0 : function(interpolate) {
  34376. this._interpolate = interpolate;
  34377. return this.rescale();
  34378. },
  34379. /**
  34380. * If factory is specified, sets the scale's output interpolator using the specified factory. The interpolator factory defaults to {@link this.Rave#com_ibm_rave_core_Rave.interpolate} , and is used to map the normalized domain parameter t in [0,1] to the corresponding value in the output range. The interpolator factory will be used to construct interpolators for each adjacent pair of values from the output range. If factory is not specified, returns the scale's interpolator factory.
  34381. * @return (Object) The interpolator factory assigned to this scale.
  34382. */
  34383. interpolate$1 : function() {
  34384. return this._interpolate;
  34385. },
  34386. /**
  34387. * Extends the domain so that it starts and ends on nice round values. This method typically modifies the scale's domain, and may only extend the bounds to the nearest round value. The precision of the round value is dependent on the extent of the domain dx according to the following formula: exp(round(log(dx)) - 1). Nicing is useful if the domain is computed from data and may be irregular. For example, for a domain of [0.20147987687960267, 0.996679553296417], the nice domain is [0.2, 1]. If the domain has more than two values, nicing the domain only affects the first and last value. The optional tick count argument allows greater control over the step size used to extend the bounds, guaranteeing that the returned ticks will exactly cover the domain.
  34388. * @return (com.ibm.rave.core.scales.LinearScale) this
  34389. */
  34390. nice$0 : function() {
  34391. com_ibm_rave_core_scales_LinearScale.linearNice(this._domain, 10);
  34392. return this.rescale();
  34393. },
  34394. /**
  34395. * Extends the domain so that it starts and ends on nice round values. This method typically modifies the scale's domain, and may only extend the bounds to the nearest round value. The precision of the round value is dependent on the extent of the domain dx according to the following formula: exp(round(log(dx)) - 1). Nicing is useful if the domain is computed from data and may be irregular. For example, for a domain of [0.20147987687960267, 0.996679553296417], the nice domain is [0.2, 1]. If the domain has more than two values, nicing the domain only affects the first and last value. The optional tick count argument allows greater control over the step size used to extend the bounds, guaranteeing that the returned ticks will exactly cover the domain.
  34396. * @param (Number) tickCount
  34397. * @return (com.ibm.rave.core.scales.LinearScale) this
  34398. */
  34399. nice$1 : function(tickCount) {
  34400. com_ibm_rave_core_scales_LinearScale.linearNice(this._domain, tickCount);
  34401. return this.rescale();
  34402. },
  34403. /**
  34404. * Extends the domain so that it starts and ends on nice round values. This method typically modifies the scale's domain, and may only extend the bounds to the nearest round value. The precision of the round value is dependent on the extent of the domain dx according to the following formula: exp(round(log(dx)) - 1). Nicing is useful if the domain is computed from data and may be irregular. For example, for a domain of [0.20147987687960267, 0.996679553296417], the nice domain is [0.2, 1]. If the domain has more than two values, nicing the domain only affects the first and last value. The optional tick count argument allows greater control over the step size used to extend the bounds, guaranteeing that the returned ticks will exactly cover the domain. Only a Time-based scale supports the usage of Time Intervals.
  34405. * @param (Number) tickCount
  34406. * @return (com.ibm.rave.core.scales.LinearScale) this
  34407. */
  34408. nice$2 : function(interval, tickCount) {
  34409. return null;
  34410. },
  34411. nice$3 : function(interval) {
  34412. return null;
  34413. },
  34414. /** @expose */
  34415. copy : com_ibm_rave_core_nativeImpl_Declare.bind(function() {
  34416. return new com_ibm_rave_core_scales_LinearScale(this.domain(), this.range(), this._interpolate, this._clamp);
  34417. }),
  34418. /** @expose */
  34419. domain : function(a0) {
  34420. var args = arguments;
  34421. if (args.length == 0) {
  34422. return this.domain$1();
  34423. }
  34424. return this.domain$0(a0);
  34425. },
  34426. /** @expose */
  34427. range : function(a0) {
  34428. var args = arguments;
  34429. if (args.length == 0) {
  34430. return this.range$1();
  34431. }
  34432. return this.range$0(a0);
  34433. },
  34434. /** @expose */
  34435. clamp : function(a0) {
  34436. var args = arguments;
  34437. if (args.length == 0) {
  34438. return this.clamp$1();
  34439. }
  34440. return this.clamp$0(a0);
  34441. },
  34442. /** @expose */
  34443. interpolate : function(a0) {
  34444. var args = arguments;
  34445. if (args.length == 0) {
  34446. return this.interpolate$1();
  34447. }
  34448. return this.interpolate$0(a0);
  34449. },
  34450. /** @expose */
  34451. nice : function(a0, a1) {
  34452. var args = arguments;
  34453. if (args.length == 0) {
  34454. return this.nice$0();
  34455. }
  34456. if (args.length == 1 && (a0 == null || typeof a0 === "number")) {
  34457. return this.nice$1(a0);
  34458. }
  34459. if (args.length == 1) {
  34460. return this.nice$3(a0);
  34461. }
  34462. return this.nice$2(a0, a1);
  34463. }
  34464. });
  34465. /**
  34466. * @param (Array) domain
  34467. * @param (Number) tickArguments
  34468. * @return (Array) List of "nice"ed domain values
  34469. */
  34470. com_ibm_rave_core_scales_LinearScale.linearNice = function(domain, tickArguments) {
  34471. return com_ibm_rave_core_internal_scales_Nice.scaleNice(domain, com_ibm_rave_core_internal_scales_Nice.niceStep(com_ibm_rave_core_scales_LinearScale.linearTickRange(domain, tickArguments)[2]));
  34472. };
  34473. /**
  34474. * @param (Array) domain
  34475. * @param (Number) tickCount
  34476. * @return (Array) an array of the start, stop and step values
  34477. */
  34478. /** @expose */
  34479. com_ibm_rave_core_scales_LinearScale.linearTickRange = function(domain, tickCount) {
  34480. var m = tickCount != null ? tickCount : 10;
  34481. var extent = com_ibm_rave_core_scales_AbstractScale.scaleExtent(domain);
  34482. var span = + (extent[1]) - + (extent[0]);
  34483. var step = Math.pow(10, Math.floor(Math.log(span / m) / Math.log(10)));
  34484. var err = m / span * step;
  34485. if (err <= 0.15) {
  34486. step *= 10;
  34487. } else if (err <= 0.35) {
  34488. step *= 5;
  34489. } else if (err <= 0.75) {
  34490. step *= 2;
  34491. }
  34492. extent[0] = Math.ceil(+ (extent[0]) / step) * step;
  34493. extent[1] = Math.floor(+ (extent[1]) / step) * step + step * .5;
  34494. extent.splice(2, 0, step);
  34495. return extent;
  34496. };
  34497. /**
  34498. * @param _domain2
  34499. * @param (java.lang.Object[]) tickArguments
  34500. * @return (Array) The ticks
  34501. */
  34502. com_ibm_rave_core_scales_LinearScale.linearTicks = function(domain, tickArguments) {
  34503. if (tickArguments !== null || arguments.length > 2){
  34504. tickArguments = Array.prototype.slice.call(arguments, 1);
  34505. }
  34506. {
  34507. var tickCount = tickArguments && tickArguments.length > 0 ? + (tickArguments[0]) : null;
  34508. var extents = com_ibm_rave_core_scales_LinearScale.linearTickRange(domain, tickCount);
  34509. return (com_ibm_rave_core_Rave.range(+ (extents[0]), + (extents[1]), + (extents[2])));
  34510. }
  34511. };
  34512. /**
  34513. * @param (Array) domain
  34514. * @param tickArguments
  34515. * @param (String) format
  34516. * @return (com.ibm.rave.core.selector.ValueFunction) Formatted tick labels
  34517. */
  34518. com_ibm_rave_core_scales_LinearScale.linearTickFormat = function(domain, m, format) {
  34519. var range = com_ibm_rave_core_scales_LinearScale.linearTickRange(domain, m);
  34520. if ((format)) {
  34521. var match = new RegExp(com_ibm_rave_core_locale_NumberFormat.format_re, "i").exec(format);
  34522. match.shift();
  34523. if (match.length >= 8 && match[8] == "s") {
  34524. var d = Math.max(Math.abs(+ (range[0])), Math.abs(+ (range[1])));
  34525. var prefix = com_ibm_rave_core_Rave.formatPrefix(d, null);
  34526. if (!((match[7]))) {
  34527. match[7] = "." + com_ibm_rave_core_scales_LinearScale.linearPrecision(prefix.scale(+ (range[2])));
  34528. }
  34529. match[8] = "f";
  34530. var numFormat = com_ibm_rave_core_Rave.format(match.join(""));
  34531. return function(data, index, groupIndex) {
  34532. return numFormat.call(this, prefix.scale(+ (data)), index, groupIndex) + prefix.symbol;
  34533. };
  34534. }
  34535. if (!((match[7]))) {
  34536. match[7] = "." + com_ibm_rave_core_scales_LinearScale.linearFormatPrecision(match[8], range);
  34537. }
  34538. format = match.join("");
  34539. } else {
  34540. var value = + (range[2]);
  34541. format = ",." + com_ibm_rave_core_scales_LinearScale.linearPrecision(value) + "f";
  34542. }
  34543. return com_ibm_rave_core_Rave.format(format);
  34544. };
  34545. com_ibm_rave_core_scales_LinearScale.initialize_linearFormatSignificant = function() {
  34546. var linearFormatSignificant = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  34547. linearFormatSignificant.set("s", 1);
  34548. linearFormatSignificant.set("g", 1);
  34549. linearFormatSignificant.set("p", 1);
  34550. linearFormatSignificant.set("r", 1);
  34551. linearFormatSignificant.set("e", 1);
  34552. return linearFormatSignificant;
  34553. };
  34554. /**
  34555. * @param (double) value
  34556. * @return (int) int
  34557. */
  34558. com_ibm_rave_core_scales_LinearScale.linearPrecision = function(value) {
  34559. return ~~-Math.floor(Math.log(value) / Math.log(10) + 0.01);
  34560. };
  34561. /**
  34562. * @param (String) type
  34563. * @param (Array) range
  34564. * @return (Number) Number
  34565. */
  34566. com_ibm_rave_core_scales_LinearScale.linearFormatPrecision = function(type, range) {
  34567. var d = + (range[2]);
  34568. var p = com_ibm_rave_core_scales_LinearScale.linearPrecision(d);
  34569. if (com_ibm_rave_core_scales_LinearScale.linearFormatSignificant.get(type) != null) {
  34570. var precision = com_ibm_rave_core_scales_LinearScale.linearPrecision(Math.max(Math.abs(+ (range[0])), Math.abs(+ (range[1]))));
  34571. var typeValue = 0;
  34572. if (!(0 <= type.indexOf("e"))) {
  34573. typeValue = 1;
  34574. }
  34575. return Math.abs(p - precision + typeValue);
  34576. } else {
  34577. var typeValue = 0;
  34578. if (type == "%") {
  34579. typeValue = 1;
  34580. }
  34581. return p - typeValue * 2;
  34582. }
  34583. };
  34584. /** @expose */
  34585. com_ibm_rave_core_scales_LinearScale.DEFAULT_TICKS = 10;
  34586. com_ibm_rave_core_scales_LinearScale.linearFormatSignificant = com_ibm_rave_core_scales_LinearScale.initialize_linearFormatSignificant();
  34587. // $source: com/ibm/rave/core/time/DateTimeScale
  34588. /************************************************************************
  34589. ** IBM Confidential
  34590. **
  34591. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  34592. **
  34593. ** (C) Copyright IBM Corp. 2015
  34594. **
  34595. ** The source code for this program is not published or otherwise divested of its trade secrets,
  34596. ** irrespective of what has been deposited with the U.S. Copyright Office.
  34597. ************************************************************************/
  34598. // GENERATED
  34599. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, bind
  34600. //@import com/ibm/rave/core/scales/LinearScale (loadtime) // linearTickRange, superclass
  34601. //@import com/ibm/rave/core/arrays/Bisector (runtime) // Bisector
  34602. //@import com/ibm/rave/core/time/Time (static) // getInstance
  34603. //@import com/ibm/rave/core/scales/AbstractScale (runtime) // scaleExtent
  34604. //@import com/ibm/rave/core/internal/scales/Nice (runtime) // scaleNice
  34605. //@import com/ibm/rave/core/internal/scales/NiceIdentity (loadtime) // new, superclass
  34606. //@import com/ibm/rave/core/internal/nativeImpl/Lang (runtime) // isNumber
  34607. /**
  34608. * Rave's time scale is an extension of rave.scale.linear that uses JavaScript Date objects as the domain representation. Thus, unlike the normal linear scale, domain values are coerced to dates rather than numbers; similarly, the invert function returns a date. Most conveniently, the time scale also provides suitable ticks based on time intervals, taking the pain out of generating axes for nearly any time-based domain. A scale object, such as that returned by rave.time.scale, is both an object and a function. That is: you can call the scale like any other function, and the scale has additional methods that change its behavior. Like other classes in Rave, scales follow the method chaining pattern where setter methods return the scale itself, allowing multiple setters to be invoked in a concise statement.
  34609. */
  34610. var com_ibm_rave_core_time_DateTimeScale = rave_externs["DateTimeScale"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scales_LinearScale, {
  34611. //_format : null,
  34612. //_methods : null,
  34613. //_methodsYear : null,
  34614. /**
  34615. * If dates is specified, sets the scale's input domain to the specified array of dates. The array must contain two or more dates. If the elements in the given array are not dates, they will be coerced to dates; this coercion happens similarly when the scale is called. If dates is not specified, returns the scale's current input domain. Although time scales typically have just two dates in their domain, you can specify more than two dates for a polylinear scale. In this case, there must be an equivalent number of values in the output range.
  34616. * @return (Array) Array of Date objects.
  34617. */
  34618. /** @expose */
  34619. domain$1 : com_ibm_rave_core_nativeImpl_Declare.bind(function() {
  34620. return com_ibm_rave_core_scales_LinearScale.prototype.domain$1.call(this).map(com_ibm_rave_core_time_DateTimeScale.scaleDate);
  34621. }),
  34622. /**
  34623. * Returns an exact copy of this time scale. Changes to this scale will not affect the returned scale, and vice versa.
  34624. * @return (com.ibm.rave.core.time.DateTimeScale) copy TimeScale
  34625. */
  34626. /** @expose */
  34627. copy : com_ibm_rave_core_nativeImpl_Declare.bind(function() {
  34628. return new com_ibm_rave_core_time_DateTimeScale(this.domain$1(), this.range(), this._interpolate, this._clamp, this._format, this._methods, this._methodsYear);
  34629. }),
  34630. constructor : function(domain, range, interpolate, clamp, format, methods, methodsYear) {
  34631. this._format = format;
  34632. this._methods = methods;
  34633. this._methodsYear = methodsYear;
  34634. var self = this;
  34635. this.invert = function(y) {
  34636. return self.invertDate(y);
  34637. };
  34638. this.ticks = function(tickArguments) {
  34639. if (tickArguments !== null || arguments.length > 1){
  34640. tickArguments = Array.prototype.slice.call(arguments);
  34641. }
  34642. {
  34643. return self.timeTicks.apply(self, tickArguments);
  34644. }
  34645. };
  34646. this.tickFormat = function(tickArguments) {
  34647. if (tickArguments !== null || arguments.length > 1){
  34648. tickArguments = Array.prototype.slice.call(arguments);
  34649. }
  34650. {
  34651. return self.timeTickFormat.apply(self, tickArguments);
  34652. }
  34653. };
  34654. },
  34655. tickMethod : com_ibm_rave_core_nativeImpl_Declare.bind(function(extent, tickCount) {
  34656. var span = + (extent[1]) - + (extent[0]);
  34657. var target = span / tickCount;
  34658. var i = com_ibm_rave_core_arrays_Bisector.bisect(com_ibm_rave_core_time_DateTimeScale.scaleSteps, target);
  34659. if (i == com_ibm_rave_core_time_DateTimeScale.scaleSteps.length) {
  34660. var list = extent.map(function(currentValue, index, array) {
  34661. return currentValue / 31536e6;
  34662. });
  34663. return [this._methodsYear, com_ibm_rave_core_scales_LinearScale.linearTickRange(list, tickCount)[2]];
  34664. } else if (i == 0) {
  34665. return [com_ibm_rave_core_time_Time.getInstance().millisecond, com_ibm_rave_core_scales_LinearScale.linearTickRange(extent, tickCount)[2]];
  34666. }
  34667. var index = target / com_ibm_rave_core_time_DateTimeScale.scaleSteps[i - 1] < com_ibm_rave_core_time_DateTimeScale.scaleSteps[i] / target ? i - 1 : i;
  34668. return this._methods[index];
  34669. }),
  34670. nice$0 : function() {
  34671. return this.nice$1(10);
  34672. },
  34673. nice$1 : function(tickCount) {
  34674. var domain = this.domain$1();
  34675. var extent = com_ibm_rave_core_scales_AbstractScale.scaleExtent(domain);
  34676. var method = this.tickMethod(extent, tickCount);
  34677. return this.nice$2(method[0], method[1]);
  34678. },
  34679. nice$3 : function(interval) {
  34680. return this.nice$2(interval, 0);
  34681. },
  34682. nice$2 : function(interval, tickCount) {
  34683. var skip = tickCount;
  34684. return this.domain(com_ibm_rave_core_internal_scales_Nice.scaleNice(this.domain$1(), skip > 1 ? new com_ibm_rave_core_time_DateTimeScale.TimeNiceIdentity(interval, skip) : new com_ibm_rave_core_internal_scales_NiceIdentity(function(x) {
  34685. return interval.floor(new Date(x)).getTime();
  34686. }, function(x) {
  34687. return interval.ceil(new Date(x)).getTime();
  34688. })));
  34689. },
  34690. /**
  34691. * Returns representative dates from the scale's input domain. The returned tick dates are uniformly spaced (modulo irregular time intervals, such as months and leap years), have human-readable values (such as midnights), and are guaranteed to be within the extent of the input domain. Ticks are often used to display reference lines, or tick marks, in conjunction with the visualized data. If count is a number, then approximately count ticks will be returned. If count is not specified, it defaults to 10. The specified count is only a hint; the scale may return more or fewer values depending on the input domain. If a time interval is specified, then the time interval’s range function will be used to generate ticks, being passed the optional step argument, if any. For example, to create ten default ticks, say: scale.ticks(10); While to create ticks at 15-minute intervals, say: scale.ticks(rave.time.minute, 15); Note: for UTC scales, be sure to use the appropriate UTC range method (such as rave.time.minute.utc). The following time intervals are considered for automatic ticks: 1-, 5-, 15- and 30-second. 1-, 5-, 15- and 30-minute. 1-, 3-, 6- and 12-hour. 1- and 2-day. 1-week. 1- and 3-month. 1-year. This set of time intervals is somewhat arbitrary and additional values may be added in the future. RAVE NOTE: Rave Supports TimeRanges to be used instead of TimeIntervals (delegating to the range's interval) Rave does not support this deprecated feature.
  34692. * @param TimeInterval | tickCount
  34693. * @param tickCount
  34694. */
  34695. timeTicks : function(tickArguments) {
  34696. if (tickArguments !== null || arguments.length > 1){
  34697. tickArguments = Array.prototype.slice.call(arguments);
  34698. }
  34699. {
  34700. var domain = this.domain$1();
  34701. var extent = com_ibm_rave_core_scales_AbstractScale.scaleExtent(domain);
  34702. var interval;
  34703. var count = 0;
  34704. if (tickArguments.length > 0) {
  34705. if (com_ibm_rave_core_internal_nativeImpl_Lang.isNumber(tickArguments[0])) {
  34706. count = tickArguments[0];
  34707. } else {
  34708. interval = tickArguments[0];
  34709. }
  34710. }
  34711. if (interval && tickArguments.length > 1) {
  34712. if (com_ibm_rave_core_internal_nativeImpl_Lang.isNumber(tickArguments[1])) {
  34713. count = tickArguments[1];
  34714. }
  34715. }
  34716. var method;
  34717. if (!interval) {
  34718. if (tickArguments.length > 1) {
  34719. count = tickArguments[1];
  34720. }
  34721. method = this.tickMethod(extent, count != 0 ? count : 10);
  34722. interval = method[0];
  34723. count = method[1];
  34724. }
  34725. var skip = count;
  34726. var date1 = extent[0];
  34727. var date2 = extent[1];
  34728. if (interval.range) {
  34729. return (interval).range(date1, new Date(date2.getTime() + 1), skip < 1 ? 1 : skip);
  34730. }
  34731. return (interval)(date1, new Date(date2.getTime() + 1), skip < 1 ? 1 : skip);
  34732. }
  34733. },
  34734. /**
  34735. * Returns a time format function suitable for displaying a tick value. The scale's built-in tick format automatically computes the appropriate display based on the input date. The following time formats are considered: <ul> <li>%Y - for year boundaries, such as "2011".</li> <li>%B - for month boundaries, such as "February".</li> <li>%b %d - for week boundaries, such as "Feb 06".</li> <li>%a %d - for day boundaries, such as "Mon 07".</li> <li>%I %p - for hour boundaries, such as "01 AM".</li> <li>%I:%M - for minute boundaries, such as "01:23".</li> <li>:%S - for second boundaries, such as ":45".</li> <li>.%L - milliseconds for all other times, such as ".012".</li> </ul>
  34736. * @param (java.lang.Object[]) tickArguments Optional arguments (typically passed in by Axis) which are not used by TimeScale
  34737. * @return (com.ibm.rave.core.selector.ValueFunction) Time format function
  34738. */
  34739. timeTickFormat : function(tickArguments) {
  34740. if (tickArguments !== null || arguments.length > 1){
  34741. tickArguments = Array.prototype.slice.call(arguments);
  34742. }
  34743. {
  34744. return this._format;
  34745. }
  34746. },
  34747. invertDate : function(x) {
  34748. return com_ibm_rave_core_time_DateTimeScale.scaleDate(this.input(x), 0, null);
  34749. },
  34750. /** @expose */
  34751. nice : com_ibm_rave_core_nativeImpl_Declare.bind(function(a0, a1) {
  34752. var args = arguments;
  34753. if (args.length == 0) {
  34754. return this.nice$0();
  34755. }
  34756. if (args.length == 1 && (a0 == null || typeof a0 === "number")) {
  34757. return this.nice$1(a0);
  34758. }
  34759. if (args.length == 1) {
  34760. return this.nice$3(a0);
  34761. }
  34762. return this.nice$2(a0, a1);
  34763. })
  34764. });
  34765. com_ibm_rave_core_time_DateTimeScale.ScaleDate = com_ibm_rave_core_nativeImpl_Declare({
  34766. _$functionClassMethod : function() {
  34767. var _$self = function(currentValue, index, array) {
  34768. return new Date(+ (currentValue));
  34769. };
  34770. return _$self;
  34771. }
  34772. });
  34773. /**
  34774. * Overrides NiceIdentity for more functionality
  34775. */
  34776. com_ibm_rave_core_time_DateTimeScale.TimeNiceIdentity = rave_externs["TimeNiceIdentity"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_scales_NiceIdentity, {
  34777. //interval : null,
  34778. skip : 0,
  34779. constructor : function(interval, skip) {
  34780. this.interval = interval;
  34781. this.skip = skip;
  34782. var self = this;
  34783. this.floor = function(dateNumber) {
  34784. var newDate = new Date(dateNumber);
  34785. while (self.skipped(newDate = interval.floor(newDate))) {
  34786. newDate = new Date(newDate.getTime() - 1);
  34787. }
  34788. return newDate.getTime();
  34789. };
  34790. this.ceil = function(dateNumber) {
  34791. var newDate = new Date(dateNumber);
  34792. while (self.skipped(newDate = interval.ceil(newDate))) {
  34793. newDate = new Date(newDate.getTime() + 1);
  34794. }
  34795. return newDate.getTime();
  34796. };
  34797. },
  34798. skipped : function(date) {
  34799. return this.interval.range(date, new Date(date.getTime() + 1), this.skip).length == 0;
  34800. }
  34801. });
  34802. com_ibm_rave_core_time_DateTimeScale.scaleDate = new com_ibm_rave_core_time_DateTimeScale.ScaleDate();
  34803. com_ibm_rave_core_time_DateTimeScale.scaleSteps = [1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6];
  34804. /**
  34805. * local methods map: for UTC scales, be sure to use the appropriate UTC range method (such as rave.time.minute.utc). The following time intervals are considered for automatic ticks: 1-, 5-, 15- and 30-second. 1-, 5-, 15- and 30-minute. 1-, 3-, 6- and 12-hour. 1- and 2-day. 1-week. 1- and 3-month. 1-year. This set of time intervals is somewhat arbitrary and additional values may be added in the future.
  34806. */
  34807. /** @expose */
  34808. com_ibm_rave_core_time_DateTimeScale.localMethods = [[com_ibm_rave_core_time_Time.getInstance().second, 1], [com_ibm_rave_core_time_Time.getInstance().second, 5], [com_ibm_rave_core_time_Time.getInstance().second, 15], [com_ibm_rave_core_time_Time.getInstance().second, 30], [com_ibm_rave_core_time_Time.getInstance().minute, 1], [com_ibm_rave_core_time_Time.getInstance().minute, 5], [com_ibm_rave_core_time_Time.getInstance().minute, 15], [com_ibm_rave_core_time_Time.getInstance().minute, 30], [com_ibm_rave_core_time_Time.getInstance().hour, 1], [com_ibm_rave_core_time_Time.getInstance().hour, 3], [com_ibm_rave_core_time_Time.getInstance().hour, 6], [com_ibm_rave_core_time_Time.getInstance().hour, 12], [com_ibm_rave_core_time_Time.getInstance().day, 1], [com_ibm_rave_core_time_Time.getInstance().day, 2], [com_ibm_rave_core_time_Time.getInstance().week, 1], [com_ibm_rave_core_time_Time.getInstance().month, 1], [com_ibm_rave_core_time_Time.getInstance().month, 3], [com_ibm_rave_core_time_Time.getInstance().year, 1]];
  34809. /**
  34810. * Map the localMethods local time interval to utc time interval
  34811. */
  34812. /** @expose */
  34813. com_ibm_rave_core_time_DateTimeScale.utcMethods = com_ibm_rave_core_time_DateTimeScale.localMethods.map(function(currentValue, index, array) {
  34814. return [(currentValue[0]).utc, currentValue[1]];
  34815. });
  34816. /**
  34817. * Returns the appropriate ValueFunction depending on the format used
  34818. */
  34819. /** @expose */
  34820. com_ibm_rave_core_time_DateTimeScale.localFormat = com_ibm_rave_core_time_Time.getInstance().format.multi([[".%L", function(data, index, groupIndex) {
  34821. return (data).getMilliseconds();
  34822. }], [":%S", function(data, index, groupIndex) {
  34823. return (data).getSeconds();
  34824. }], ["%I:%M", function(data, index, groupIndex) {
  34825. return (data).getMinutes();
  34826. }], ["%I %p", function(data, index, groupIndex) {
  34827. return (data).getHours();
  34828. }], ["%a %d", function(data, index, groupIndex) {
  34829. var date = data;
  34830. return (date.getDay()) && date.getDate() != 1 ? 1 : 0;
  34831. }], ["%b %d", function(data, index, groupIndex) {
  34832. return (data).getDate() != 1 ? 1 : 0;
  34833. }], ["%B", function(data, index, groupIndex) {
  34834. return (data).getMonth();
  34835. }], ["%Y", function(data, index, groupIndex) {
  34836. return 1;
  34837. }]]);
  34838. /**
  34839. * Configure formatting for UTC time
  34840. */
  34841. /** @expose */
  34842. com_ibm_rave_core_time_DateTimeScale.utcFormat = com_ibm_rave_core_time_Time.getInstance().format.utc.multi([[".%L", function(data, index, groupIndex) {
  34843. return (data).getUTCMilliseconds();
  34844. }], [":%S", function(data, index, groupIndex) {
  34845. return (data).getUTCSeconds();
  34846. }], ["%I:%M", function(data, index, groupIndex) {
  34847. return (data).getUTCMinutes();
  34848. }], ["%I %p", function(data, index, groupIndex) {
  34849. return (data).getUTCHours();
  34850. }], ["%a %d", function(data, index, groupIndex) {
  34851. var date = data;
  34852. return (date.getUTCDay()) && date.getUTCDate() != 1 ? 1 : 0;
  34853. }], ["%b %d", function(data, index, groupIndex) {
  34854. return (data).getUTCDate() != 1 ? 1 : 0;
  34855. }], ["%B", function(data, index, groupIndex) {
  34856. return (data).getUTCMonth();
  34857. }], ["%Y", function(data, index, groupIndex) {
  34858. return 1;
  34859. }]]);
  34860. /**
  34861. * rave_time_scaleLocalMethods.year = rave_time.year;
  34862. */
  34863. /** @expose */
  34864. com_ibm_rave_core_time_DateTimeScale.localMethodsYear = com_ibm_rave_core_time_Time.getInstance().year;
  34865. /**
  34866. * rave_time_scaleUtcMethods.year = rave_time.year.utc
  34867. */
  34868. /** @expose */
  34869. com_ibm_rave_core_time_DateTimeScale.utcMethodsYear = com_ibm_rave_core_time_Time.getInstance().year.utc;
  34870. // $source: com/ibm/rave/core/internal/nativeImpl/Functor
  34871. /************************************************************************
  34872. ** IBM Confidential
  34873. **
  34874. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  34875. **
  34876. ** (C) Copyright IBM Corp. 2014
  34877. **
  34878. ** The source code for this program is not published or otherwise divested of its trade secrets,
  34879. ** irrespective of what has been deposited with the U.S. Copyright Office.
  34880. ************************************************************************/
  34881. // @import com/ibm/rave/core/Rave
  34882. /**
  34883. * Takes an object and always returns a function. If the object is a
  34884. * function, return it. Otherwise return a function that returns the object.
  34885. *
  34886. * Mapped to rave.functor().
  34887. *
  34888. * Only available in Javascript.
  34889. */
  34890. com_ibm_rave_core_Rave["functor"] = function(v) {
  34891. return typeof v === "function" ? v : function() {
  34892. return v;
  34893. };
  34894. };
  34895. // $source: com/ibm/rave/core/internal/nativeImpl/Rebind
  34896. /************************************************************************
  34897. ** IBM Confidential
  34898. **
  34899. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  34900. **
  34901. ** (C) Copyright IBM Corp. 2014
  34902. **
  34903. ** The source code for this program is not published or otherwise divested of its trade secrets,
  34904. ** irrespective of what has been deposited with the U.S. Copyright Office.
  34905. ************************************************************************/
  34906. // @import com/ibm/rave/core/Rave
  34907. /**
  34908. * Copies the methods with the specified names from source to target, and returns target.
  34909. * Calling one of the named methods on the target object invokes the same-named method
  34910. * on the source object, passing any arguments passed to the target method, and using the
  34911. * source object as the this context. If the source method returns the source object, the
  34912. * target method returns the target object (“setter” method); otherwise, the target method
  34913. * returns the return value of the source method (“getter” mode). The rebind operator allows
  34914. * inherited methods (mix-ins) to be rebound to a subclass on a different object.
  34915. *
  34916. * Mapped to rave.rebind().
  34917. *
  34918. * Only available in Javascript.
  34919. */
  34920. com_ibm_rave_core_Rave["rebind"] = function(target, source) {
  34921. var i = 1, n = arguments.length, method;
  34922. while (++i < n) target[method = arguments[i]] = rave_rebind(target, source, source[method]);
  34923. /**
  34924. * Method is assumed to be a standard Rave getter-setter:
  34925. * If passed with no arguments, gets the value.
  34926. * If passed with arguments, sets the value and returns the target.
  34927. */
  34928. function rave_rebind(target, source, method) {
  34929. return function() {
  34930. var value = method.apply(source, arguments);
  34931. return value === source ? target : value;
  34932. };
  34933. }
  34934. return target;
  34935. };
  34936. // $source: com/ibm/rave/core/internal/nativeImpl/version/Version
  34937. // @import com/ibm/rave/core/Rave
  34938. com_ibm_rave_core_Rave["version"] = new String("2.0.0");
  34939. com_ibm_rave_core_Rave["version"]["build"] = "2.0.0.20150610-2007";
  34940. com_ibm_rave_core_Rave["version"]["vendor"] = "IBM Rapidly Adaptive Visualization Engine";
  34941. // $source: com/ibm/rave/core/internal/nativeImpl/Module
  34942. /************************************************************************
  34943. ** IBM Confidential
  34944. **
  34945. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  34946. **
  34947. ** (C) Copyright IBM Corp. 2014, 2015
  34948. **
  34949. ** The source code for this program is not published or otherwise divested of its trade secrets,
  34950. ** irrespective of what has been deposited with the U.S. Copyright Office.
  34951. ************************************************************************/
  34952. // Must be the first import
  34953. // @import ./ModuleHeader
  34954. // @import com/ibm/rave/core/Rave
  34955. // @import com/ibm/rave/core/behavior/Zoom
  34956. // @import com/ibm/rave/core/internal/transitions/Tweener
  34957. // @import com/ibm/rave/core/selector/Selector
  34958. // @import com/ibm/rave/core/selector/EnterSelector
  34959. // @import com/ibm/rave/core/transition/Transition
  34960. // @import com/ibm/rave/core/nativeImpl/Declare
  34961. // @import com/ibm/rave/core/internal/nativeImpl/Functor
  34962. // @import com/ibm/rave/core/internal/nativeImpl/Rebind
  34963. // @import com/ibm/rave/core/internal/nativeImpl/version/Version
  34964. var rave = com_ibm_rave_core_Rave;
  34965. // rave#event should be undefined to start
  34966. delete rave.event;
  34967. // satisfy prototype extension mechanism of selectors and transitions
  34968. rave["selection"].prototype = com_ibm_rave_core_selector_Selector.prototype;
  34969. rave["transition"].prototype = com_ibm_rave_core_transition_Transition.prototype;
  34970. // version info
  34971. rave["version"] = com_ibm_rave_core_Rave["version"];
  34972. // patch wheel event in zoom
  34973. // https://developer.mozilla.org/en-US/docs/Mozilla_event_reference/wheel
  34974. if (rave_document) {
  34975. if (!("onwheel" in rave_document.createElement("div"))) {
  34976. if ("onmousewheel" in rave_document) {
  34977. com_ibm_rave_core_behavior_Zoom.zoomDelta = function() {
  34978. if (typeof rave.event["wheelDelta"] !== "undefined") {
  34979. return rave.event["wheelDelta"];
  34980. }
  34981. return -rave.event["deltaY"] * (rave.event["deltaMode"] != 0 ? 120 : 1);
  34982. };
  34983. com_ibm_rave_core_behavior_Zoom.zoomWheel = "mousewheel";
  34984. } else {
  34985. com_ibm_rave_core_behavior_Zoom.zoomDelta = function() { return -rave.event["detail"]; };
  34986. com_ibm_rave_core_behavior_Zoom.zoomWheel = "MozMousePixelScroll";
  34987. }
  34988. }
  34989. }
  34990. // end patching the translated code
  34991. com_ibm_rave_core_internal_transitions_Tweener.earlyScheduleSupport = true;
  34992. if (typeof define === "function" && define.amd) {
  34993. define(rave);
  34994. } else if (typeof module === "object" && module.exports) {
  34995. module.exports = rave;
  34996. }
  34997. // expose Rave class to the global variable rave
  34998. this["rave"] = rave;
  34999. this["rave"]["selection"]["enter"] = com_ibm_rave_core_selector_EnterSelector;
  35000. this["rave"]["_"] = {
  35001. "com_ibm_rave_core_nativeImpl_Declare" : com_ibm_rave_core_nativeImpl_Declare,
  35002. "com_ibm_rave_core_nativeImpl_Object" : com_ibm_rave_core_nativeImpl_Object,
  35003. "rave_document" : rave_document,
  35004. "rave_documentElement" : rave_documentElement,
  35005. "rave_window" : rave_window
  35006. };
  35007. this["rave"]["internal"] = rave_externs;
  35008. // $source: com/ibm/rave/core/selector/SelectorDelegate
  35009. /************************************************************************
  35010. ** IBM Confidential
  35011. **
  35012. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  35013. **
  35014. ** (C) Copyright IBM Corp. 2015
  35015. **
  35016. ** The source code for this program is not published or otherwise divested of its trade secrets,
  35017. ** irrespective of what has been deposited with the U.S. Copyright Office.
  35018. ************************************************************************/
  35019. // GENERATED
  35020. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // invokeSuper, declare anonymous, declare
  35021. //@import com/ibm/rave/core/selector/Selector (loadtime) // superclass
  35022. /**
  35023. * The delegate mechanism for a selector.
  35024. */
  35025. var com_ibm_rave_core_selector_SelectorDelegate = rave_externs["SelectorDelegate"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_selector_Selector, {
  35026. //selector : null,
  35027. /**
  35028. * Create a delegate selector.
  35029. */
  35030. /** @expose */
  35031. constructor : function() {},
  35032. /**
  35033. * Set the delegate selector.
  35034. * @param (com.ibm.rave.core.selector.Selector) selector The selector to delegate to.
  35035. * @return (com.ibm.rave.core.selector.Selector) The extended selector.
  35036. */
  35037. /** @expose */
  35038. setDelegate : function(selector) {
  35039. this.selector = selector;
  35040. return this;
  35041. },
  35042. /**
  35043. * Create the extension to the selector. Concrete classes will implement this method and return an instance of themselves.
  35044. * @param (com.ibm.rave.core.selector.Selector) s The core selector.
  35045. * @return (com.ibm.rave.core.selector.Selector) The extended selector.
  35046. */
  35047. /** @expose */
  35048. create : function(s) {},
  35049. /**
  35050. * @see Selector#this.append(String)
  35051. */
  35052. append$0 : function(name) {
  35053. return this.create(this.selector.append$0(name));
  35054. },
  35055. /**
  35056. * @see Selector#this.append(com_ibm_rave_core_selector_ValueFunction)
  35057. */
  35058. append$1 : function(elementFunction) {
  35059. return this.create(this.selector.append$1(elementFunction));
  35060. },
  35061. /**
  35062. * @see Selection#this.attr(Object)
  35063. */
  35064. attr$0 : function(value) {
  35065. this.selector.attr$0(value);
  35066. return this;
  35067. },
  35068. /**
  35069. * @see Selector#this.attr(String)
  35070. */
  35071. attr$3 : function(attribute) {
  35072. return this.selector.attr$3(attribute);
  35073. },
  35074. /**
  35075. * @see Selector#this.attr(String, Object)
  35076. */
  35077. attr$1 : function(attribute, value) {
  35078. this.selector.attr$1(attribute, value);
  35079. return this;
  35080. },
  35081. /**
  35082. * @see Selector#this.attr(String, com_ibm_rave_core_selector_ValueFunction)
  35083. */
  35084. attr$2 : function(attribute, valueFunction) {
  35085. this.selector.attr$2(attribute, valueFunction);
  35086. return this;
  35087. },
  35088. /**
  35089. * @see Selector#this.classed(String)
  35090. */
  35091. classed$0 : function(className) {
  35092. return this.selector.classed$0(className);
  35093. },
  35094. /**
  35095. * @see Selector#this.classed(Object)
  35096. */
  35097. classed$1 : function(value) {
  35098. this.selector.classed$1(value);
  35099. return this;
  35100. },
  35101. /**
  35102. * @see Selector#this.classed(String, )
  35103. */
  35104. classed$2 : function(className, add) {
  35105. this.selector.classed$2(className, add);
  35106. return this;
  35107. },
  35108. /**
  35109. * @see Selector#this.classed(String, com_ibm_rave_core_selector_ValueFunction)
  35110. */
  35111. classed$3 : function(className, valueFunction) {
  35112. this.selector.classed$3(className, valueFunction);
  35113. return this;
  35114. },
  35115. /**
  35116. * @see Selector#this.call(com_ibm_rave_core_selector_RunFunction, )
  35117. */
  35118. call$0 : function(callback, args) {
  35119. if (args !== null || arguments.length > 2){
  35120. args = Array.prototype.slice.call(arguments, 1);
  35121. }
  35122. {
  35123. this.selector.call.apply(this.selector, [callback].concat(args));
  35124. return this;
  35125. }
  35126. },
  35127. /**
  35128. * @see Selector#this.data()
  35129. */
  35130. data$0 : function() {
  35131. return this.selector.data$0();
  35132. },
  35133. /**
  35134. * @see Selector#this.datum()
  35135. */
  35136. datum$0 : function() {
  35137. return this.selector.datum$0();
  35138. },
  35139. /**
  35140. * @see Selector#this.datum(com_ibm_rave_core_selector_ValueFunction)
  35141. */
  35142. datum$1 : function(valueFn) {
  35143. this.selector.datum$1(valueFn);
  35144. return this;
  35145. },
  35146. /**
  35147. * @see Selector#this.datum(Object)
  35148. */
  35149. datum$2 : function(value) {
  35150. this.selector.datum$2(value);
  35151. return this;
  35152. },
  35153. /**
  35154. * @see Selector#this.data(com_ibm_rave_core_selector_ValueFunction)
  35155. */
  35156. data$1 : function(value) {
  35157. return this.create(this.selector.data$1(value));
  35158. },
  35159. /**
  35160. * @see Selector#this.data(com_ibm_rave_core_selector_ValueFunction, com_ibm_rave_core_selector_ValueFunction)
  35161. */
  35162. data$2 : function(value, key) {
  35163. return this.create(this.selector.data$2(value, key));
  35164. },
  35165. /**
  35166. * @see Selector#this.data()
  35167. */
  35168. data$3 : function(value) {
  35169. return this.create(this.selector.data$3(value));
  35170. },
  35171. /**
  35172. * @see Selector#this.data(, com_ibm_rave_core_selector_ValueFunction)
  35173. */
  35174. data$4 : function(value, key) {
  35175. return this.create(this.selector.data$4(value, key));
  35176. },
  35177. /**
  35178. * @see Selection#this.empty()
  35179. */
  35180. /** @expose */
  35181. empty : function() {
  35182. return this.selector.empty();
  35183. },
  35184. /**
  35185. * @see Selector#this.enter()
  35186. */
  35187. /** @expose */
  35188. enter : function() {
  35189. var self = this;
  35190. var d = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_selector_SelectorDelegate], {
  35191. create : function(s) {
  35192. return self.create(s);
  35193. }
  35194. }))();
  35195. return d.setDelegate(this.selector.enter());
  35196. },
  35197. /**
  35198. * @see Selector#this.exit()
  35199. */
  35200. /** @expose */
  35201. exit : function() {
  35202. return this.create(this.selector.exit());
  35203. },
  35204. /**
  35205. * @see Selector#this.each(com_ibm_rave_core_selector_CallbackFunction)
  35206. */
  35207. each$0 : function(callback) {
  35208. this.selector.each(callback);
  35209. return this;
  35210. },
  35211. /**
  35212. * @see Selector#this.filter(com_ibm_rave_core_selector_ValueFunction)
  35213. */
  35214. filter$0 : function(filterFunction) {
  35215. return this.create(this.selector.filter$0(filterFunction));
  35216. },
  35217. /**
  35218. * @see Selector#this.filter(String)
  35219. */
  35220. filter$1 : function(filter) {
  35221. return this.create(this.selector.filter$1(filter));
  35222. },
  35223. /**
  35224. * @see Selector#this.html()
  35225. */
  35226. html$0 : function() {
  35227. return this.selector.html$0();
  35228. },
  35229. /**
  35230. * @see Selector#this.html(Object)
  35231. */
  35232. html$1 : function(value) {
  35233. this.selector.html$1(value);
  35234. return this;
  35235. },
  35236. /**
  35237. * @see Selector#this.html(com_ibm_rave_core_selector_ValueFunction)
  35238. */
  35239. html$2 : function(valueFunction) {
  35240. this.selector.html$2(valueFunction);
  35241. return this;
  35242. },
  35243. /**
  35244. * @see Selector#this.insert(com_ibm_rave_core_selector_ValueFunction, String)
  35245. */
  35246. insert$0 : function(elementFunction, before) {
  35247. return this.create(this.selector.insert$0(elementFunction, before));
  35248. },
  35249. /**
  35250. * @see Selector#this.insert(com_ibm_rave_core_selector_ValueFunction, com_ibm_rave_core_selector_ValueFunction)
  35251. */
  35252. insert$1 : function(nameFunction, beforeFunction) {
  35253. return this.create(this.selector.insert$1(nameFunction, beforeFunction));
  35254. },
  35255. /**
  35256. * @see Selector#this.insert(String, String)
  35257. */
  35258. insert$2 : function(name, before) {
  35259. return this.create(this.selector.insert$2(name, before));
  35260. },
  35261. /**
  35262. * @see Selector#this.insert(String, com_ibm_rave_core_selector_ValueFunction)
  35263. */
  35264. insert$3 : function(type, beforeFunction) {
  35265. return this.create(this.selector.insert$3(type, beforeFunction));
  35266. },
  35267. /**
  35268. * @see Selector#this.interrupt()
  35269. */
  35270. interrupt$0 : function() {
  35271. this.selector.interrupt$0();
  35272. return this;
  35273. },
  35274. /**
  35275. * @see Selector#this.interrupt(String)
  35276. */
  35277. interrupt$1 : function(name) {
  35278. this.selector.interrupt$1(name);
  35279. return this;
  35280. },
  35281. /**
  35282. * @see Selector#this.init(com_ibm_rave_core_scene_SceneNode)
  35283. */
  35284. init$0 : function(node) {
  35285. this.selector.init$0(node);
  35286. return this;
  35287. },
  35288. /**
  35289. * @see Selector#this.initAll()
  35290. */
  35291. initAll$0 : function(nodes) {
  35292. this.selector.initAll$0(nodes);
  35293. return this;
  35294. },
  35295. /**
  35296. * @see Selector#this.init(String)
  35297. */
  35298. init$1 : function(query) {
  35299. this.selector.init$1(query);
  35300. return this;
  35301. },
  35302. /**
  35303. * @see Selector#this.initAll(String)
  35304. */
  35305. initAll$1 : function(query) {
  35306. this.selector.initAll$1(query);
  35307. return this;
  35308. },
  35309. /**
  35310. * @see Selection#this.node()
  35311. */
  35312. /** @expose */
  35313. node : function() {
  35314. return this.selector.node();
  35315. },
  35316. /**
  35317. * @see Selector#this.on(String)
  35318. */
  35319. on$0 : function(eventName) {
  35320. return this.selector.on$0(eventName);
  35321. },
  35322. /**
  35323. * @see Selector#this.on(Object)
  35324. */
  35325. on$1 : function(value) {
  35326. this.selector.on$1(value);
  35327. return this;
  35328. },
  35329. /**
  35330. * @see Selector#this.on(String, com_ibm_rave_core_selector_SelectorEventListener)
  35331. */
  35332. on$2 : function(eventName, listener) {
  35333. this.selector.on$2(eventName, listener);
  35334. return this;
  35335. },
  35336. /**
  35337. * @see Selector#this.on(String, com_ibm_rave_core_selector_SelectorEventListener, )
  35338. */
  35339. on$3 : function(eventName, listener, useCapture) {
  35340. this.selector.on$3(eventName, listener, useCapture);
  35341. return this;
  35342. },
  35343. /**
  35344. * @see Selector#this.owner()
  35345. */
  35346. owner$0 : function() {
  35347. return this.selector.owner$0();
  35348. },
  35349. /**
  35350. * @see Selector#this.owner(com_ibm_rave_core_scene_SceneNode)
  35351. */
  35352. owner$1 : function(owner) {
  35353. this.selector.owner$1(owner);
  35354. return this;
  35355. },
  35356. /**
  35357. * @see Selector#this.owner(com_ibm_rave_core_selector_ValueFunction)
  35358. */
  35359. owner$2 : function(owner) {
  35360. this.selector.owner$2(owner);
  35361. return this;
  35362. },
  35363. /**
  35364. * @see Selector#this.order()
  35365. */
  35366. /** @expose */
  35367. order : function() {
  35368. this.selector.order();
  35369. return this;
  35370. },
  35371. /**
  35372. * @see Selector#this.mirror()
  35373. */
  35374. /** @expose */
  35375. mirror : function(mirror) {
  35376. return this.create(this.selector.mirror(mirror));
  35377. },
  35378. /**
  35379. * @see Selector#this.property(String)
  35380. */
  35381. property$0 : function(key) {
  35382. return this.selector.property$0(key);
  35383. },
  35384. /**
  35385. * @see Selector#this.property(Object)
  35386. */
  35387. property$1 : function(value) {
  35388. this.selector.property$1(value);
  35389. return this;
  35390. },
  35391. /**
  35392. * @see Selector#this.property(String, Object)
  35393. */
  35394. property$2 : function(key, value) {
  35395. this.selector.property$2(key, value);
  35396. return this;
  35397. },
  35398. /**
  35399. * @see Selector#this.property(String, com_ibm_rave_core_selector_ValueFunction)
  35400. */
  35401. property$3 : function(key, valueFunction) {
  35402. this.selector.property$3(key, valueFunction);
  35403. return this;
  35404. },
  35405. /**
  35406. * @see Selector#this.remove()
  35407. */
  35408. /** @expose */
  35409. remove : function() {
  35410. this.selector.remove();
  35411. return this;
  35412. },
  35413. /**
  35414. * @see Selection#this.size()
  35415. */
  35416. /** @expose */
  35417. size : function() {
  35418. return this.selector.size();
  35419. },
  35420. /**
  35421. * @see Selector#this.select(Object)
  35422. */
  35423. select$0 : function(query) {
  35424. return this.create(this.selector.select$0(query));
  35425. },
  35426. /**
  35427. * @see Selector#this.select(com_ibm_rave_core_selector_ValueFunction)
  35428. */
  35429. select$1 : function(valueFunction) {
  35430. return this.create(this.selector.select$1(valueFunction));
  35431. },
  35432. /**
  35433. * @see Selector#this.selectAll(String)
  35434. */
  35435. selectAll$0 : function(query) {
  35436. return this.create(this.selector.selectAll$0(query));
  35437. },
  35438. /**
  35439. * @see Selector#this.selectAll(com_ibm_rave_core_selector_ValueFunction)
  35440. */
  35441. selectAll$1 : function(sel) {
  35442. return this.create(this.selector.selectAll$1(sel));
  35443. },
  35444. /**
  35445. * @see Selector#this.extension(String)
  35446. */
  35447. /** @expose */
  35448. extension$0 : function(key) {
  35449. return this.selector.extension(key);
  35450. },
  35451. /**
  35452. * @see Selection#this.style(Object)
  35453. */
  35454. style$0 : function(value) {
  35455. this.selector.style$0(value);
  35456. return this;
  35457. },
  35458. /**
  35459. * @see Selection#this.style(Object, String)
  35460. */
  35461. style$1 : function(value, priority) {
  35462. this.selector.style$1(value, priority);
  35463. return this;
  35464. },
  35465. /**
  35466. * @see Selector#this.style(String)
  35467. */
  35468. style$6 : function(styleName) {
  35469. return this.selector.style$6(styleName);
  35470. },
  35471. /**
  35472. * @see Selector#this.style(String, Object)
  35473. */
  35474. style$2 : function(styleName, value) {
  35475. this.selector.style$2(styleName, value);
  35476. return this;
  35477. },
  35478. /**
  35479. * @see Selector#this.style(String, Object, String)
  35480. */
  35481. style$4 : function(styleName, value, priority) {
  35482. this.selector.style$4(styleName, value, priority);
  35483. return this;
  35484. },
  35485. /**
  35486. * @see Selector#this.style(String, com_ibm_rave_core_selector_ValueFunction)
  35487. */
  35488. style$3 : function(styleName, valueFunction) {
  35489. this.selector.style$3(styleName, valueFunction);
  35490. return this;
  35491. },
  35492. /**
  35493. * @see Selector#this.style(String, com_ibm_rave_core_selector_ValueFunction, String)
  35494. */
  35495. style$5 : function(styleName, valueFunction, priority) {
  35496. this.selector.style$5(styleName, valueFunction, priority);
  35497. return this;
  35498. },
  35499. /**
  35500. * @see Selector#this.sort(com_ibm_rave_core_util_Comparator)
  35501. */
  35502. sort$1 : function(c) {
  35503. this.selector.sort$1(c);
  35504. return this;
  35505. },
  35506. /**
  35507. * @see Selector#this.sort()
  35508. */
  35509. sort$0 : function() {
  35510. this.selector.sort();
  35511. return this;
  35512. },
  35513. /**
  35514. * @see Selector#this.text()
  35515. */
  35516. text$0 : function() {
  35517. return this.selector.text$0();
  35518. },
  35519. /**
  35520. * @see Selector#this.text(Object)
  35521. */
  35522. text$1 : function(value) {
  35523. this.selector.text$1(value);
  35524. return this;
  35525. },
  35526. /**
  35527. * @see Selector#this.text(com_ibm_rave_core_selector_ValueFunction)
  35528. */
  35529. text$2 : function(valueFunction) {
  35530. this.selector.text$2(valueFunction);
  35531. return this;
  35532. },
  35533. /**
  35534. * @see Selector#this.transition()
  35535. */
  35536. transition$0 : function() {
  35537. return this.selector.transition$0();
  35538. },
  35539. /**
  35540. * @see Selector#this.transition(String)
  35541. */
  35542. transition$1 : function(name) {
  35543. return this.selector.transition$1(name);
  35544. },
  35545. /**
  35546. * @see Selector#this.dispose()
  35547. */
  35548. /** @expose */
  35549. dispose : function() {
  35550. this.selector.dispose();
  35551. return this;
  35552. },
  35553. /** @expose */
  35554. append : function(a0) {
  35555. var args = arguments;
  35556. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  35557. return this.append$0(a0);
  35558. }
  35559. return this.append$1(a0);
  35560. },
  35561. /** @expose */
  35562. attr : function(a0, a1) {
  35563. var args = arguments;
  35564. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  35565. return this.attr$3(a0);
  35566. }
  35567. if (args.length == 1) {
  35568. return this.attr$0(a0);
  35569. }
  35570. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  35571. return this.attr$2(a0, a1);
  35572. }
  35573. return this.attr$1(a0, a1);
  35574. },
  35575. /** @expose */
  35576. classed : function(a0, a1) {
  35577. var args = arguments;
  35578. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  35579. return this.classed$0(a0);
  35580. }
  35581. if (args.length == 1) {
  35582. return this.classed$1(a0);
  35583. }
  35584. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  35585. return this.classed$3(a0, a1);
  35586. }
  35587. return this.classed$2(a0, a1);
  35588. },
  35589. /** @expose */
  35590. call : function(a0, a1) {
  35591. var args = arguments;
  35592. return this.call$0.apply(this, args);
  35593. },
  35594. /** @expose */
  35595. data : function(a0, a1) {
  35596. var args = arguments;
  35597. if (args.length == 0) {
  35598. return this.data$0();
  35599. }
  35600. if (args.length == 1 && typeof a0 === "function") {
  35601. return this.data$1(a0);
  35602. }
  35603. if (args.length == 1) {
  35604. return this.data$3(a0);
  35605. }
  35606. if (args.length == 2 && typeof a0 === "function" && typeof a1 === "function") {
  35607. return this.data$2(a0, a1);
  35608. }
  35609. return this.data$4(a0, a1);
  35610. },
  35611. /** @expose */
  35612. datum : function(a0) {
  35613. var args = arguments;
  35614. if (args.length == 0) {
  35615. return this.datum$0();
  35616. }
  35617. if (args.length == 1 && typeof a0 === "function") {
  35618. return this.datum$1(a0);
  35619. }
  35620. return this.datum$2(a0);
  35621. },
  35622. /** @expose */
  35623. each : function(a0) {
  35624. var args = arguments;
  35625. return this.each$0(a0);
  35626. },
  35627. /** @expose */
  35628. filter : function(a0) {
  35629. var args = arguments;
  35630. if (args.length == 1 && typeof a0 === "function") {
  35631. return this.filter$0(a0);
  35632. }
  35633. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  35634. return this.filter$1(a0);
  35635. }
  35636. return com_ibm_rave_core_nativeImpl_Declare.invokeSuper(this, args);
  35637. },
  35638. /** @expose */
  35639. html : function(a0) {
  35640. var args = arguments;
  35641. if (args.length == 0) {
  35642. return this.html$0();
  35643. }
  35644. if (args.length == 1 && typeof a0 === "function") {
  35645. return this.html$2(a0);
  35646. }
  35647. return this.html$1(a0);
  35648. },
  35649. /** @expose */
  35650. insert : function(a0, a1) {
  35651. var args = arguments;
  35652. if (args.length == 2 && typeof a0 === "function" && (a1 == null || typeof a1 === "string")) {
  35653. return this.insert$0(a0, a1);
  35654. }
  35655. if (args.length == 2 && typeof a0 === "function" && typeof a1 === "function") {
  35656. return this.insert$1(a0, a1);
  35657. }
  35658. if (args.length == 2 && (a0 == null || typeof a0 === "string") && (a1 == null || typeof a1 === "string")) {
  35659. return this.insert$2(a0, a1);
  35660. }
  35661. return this.insert$3(a0, a1);
  35662. },
  35663. /** @expose */
  35664. interrupt : function(a0) {
  35665. var args = arguments;
  35666. if (args.length == 0) {
  35667. return this.interrupt$0();
  35668. }
  35669. return this.interrupt$1(a0);
  35670. },
  35671. /** @expose */
  35672. init : function(a0) {
  35673. var args = arguments;
  35674. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  35675. return this.init$1(a0);
  35676. }
  35677. return this.init$0(a0);
  35678. },
  35679. /** @expose */
  35680. initAll : function(a0) {
  35681. var args = arguments;
  35682. if (args.length == 1 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]")) {
  35683. return this.initAll$0(a0);
  35684. }
  35685. return this.initAll$1(a0);
  35686. },
  35687. /** @expose */
  35688. on : function(a0, a1, a2) {
  35689. var args = arguments;
  35690. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  35691. return this.on$0(a0);
  35692. }
  35693. if (args.length == 1) {
  35694. return this.on$1(a0);
  35695. }
  35696. if (args.length == 2) {
  35697. return this.on$2(a0, a1);
  35698. }
  35699. return this.on$3(a0, a1, a2);
  35700. },
  35701. /** @expose */
  35702. owner : function(a0) {
  35703. var args = arguments;
  35704. if (args.length == 0) {
  35705. return this.owner$0();
  35706. }
  35707. if (args.length == 1 && typeof a0 === "function") {
  35708. return this.owner$2(a0);
  35709. }
  35710. return this.owner$1(a0);
  35711. },
  35712. /** @expose */
  35713. property : function(a0, a1) {
  35714. var args = arguments;
  35715. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  35716. return this.property$0(a0);
  35717. }
  35718. if (args.length == 1) {
  35719. return this.property$1(a0);
  35720. }
  35721. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  35722. return this.property$3(a0, a1);
  35723. }
  35724. return this.property$2(a0, a1);
  35725. },
  35726. /** @expose */
  35727. select : function(a0) {
  35728. var args = arguments;
  35729. if (args.length == 1 && typeof a0 === "function") {
  35730. return this.select$1(a0);
  35731. }
  35732. return this.select$0(a0);
  35733. },
  35734. /** @expose */
  35735. selectAll : function(a0) {
  35736. var args = arguments;
  35737. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  35738. return this.selectAll$0(a0);
  35739. }
  35740. return this.selectAll$1(a0);
  35741. },
  35742. /** @expose */
  35743. style : function(a0, a1, a2) {
  35744. var args = arguments;
  35745. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  35746. return this.style$6(a0);
  35747. }
  35748. if (args.length == 1) {
  35749. return this.style$0(a0);
  35750. }
  35751. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  35752. return this.style$3(a0, a1);
  35753. }
  35754. if (args.length == 2 && (a0 == null || typeof a0 === "string") && (a1 == null || Object.prototype.toString.call(a1) !== "[object Array]")) {
  35755. return this.style$2(a0, a1);
  35756. }
  35757. if (args.length == 2) {
  35758. return this.style$1(a0, a1);
  35759. }
  35760. if (args.length == 3 && (a0 == null || typeof a0 === "string") && typeof a1 === "function" && (a2 == null || typeof a2 === "string")) {
  35761. return this.style$5(a0, a1, a2);
  35762. }
  35763. return this.style$4(a0, a1, a2);
  35764. },
  35765. /** @expose */
  35766. sort : function(a0) {
  35767. var args = arguments;
  35768. if (args.length == 0) {
  35769. return this.sort$0();
  35770. }
  35771. return this.sort$1(a0);
  35772. },
  35773. /** @expose */
  35774. text : function(a0) {
  35775. var args = arguments;
  35776. if (args.length == 0) {
  35777. return this.text$0();
  35778. }
  35779. if (args.length == 1 && typeof a0 === "function") {
  35780. return this.text$2(a0);
  35781. }
  35782. return this.text$1(a0);
  35783. },
  35784. /** @expose */
  35785. transition : function(a0) {
  35786. var args = arguments;
  35787. if (args.length == 0) {
  35788. return this.transition$0();
  35789. }
  35790. return this.transition$1(a0);
  35791. }
  35792. });
  35793. })();