rave.js 1.5 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217
  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, 2015
  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 global object for strict mode (window and non-window environments)
  15. // indirect eval call evaluates in global scope and sets 'this' to a global object
  16. var global = (1,eval)('this');
  17. // setup
  18. var rave_document = global.document;
  19. var rave_externs = {};
  20. function rave_documentElement(node) {
  21. if (node) {
  22. node = node._rave_isDOM ? node : node.rave_getOwner ? node.rave_getOwner() : node;
  23. }
  24. return node
  25. && (node.ownerDocument // node is a Node
  26. || node.document // node is a Window
  27. || node).documentElement; // node is a Document
  28. }
  29. function rave_window(node) {
  30. if (node) {
  31. node = node._rave_isDOM ? node : node.rave_getOwner ? node.rave_getOwner() : node;
  32. }
  33. return node
  34. && ((node.ownerDocument && node.ownerDocument.defaultView) // node is a Node
  35. || (node.document && node) // node is a Window
  36. || node.defaultView); // node is a Document
  37. }
  38. // $source: com/ibm/rave/core/nativeImpl/Object
  39. /************************************************************************
  40. ** IBM Confidential
  41. **
  42. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  43. **
  44. ** (C) Copyright IBM Corp. 2015
  45. **
  46. ** The source code for this program is not published or otherwise divested of its trade secrets,
  47. ** irrespective of what has been deposited with the U.S. Copyright Office.
  48. ************************************************************************/
  49. var com_ibm_rave_core_nativeImpl_Object = (function() {
  50. // object for all translated classes.
  51. var Obj = function(){};
  52. /**
  53. * Checks if obj is an instanceof class cls.
  54. *
  55. * @param obj
  56. * the object to check
  57. * @param cls
  58. * the class type
  59. */
  60. /** @expose */
  61. Obj.isInstanceOf = function(obj, cls) {
  62. if (obj) {
  63. if (obj instanceof cls) {
  64. return true;
  65. }
  66. }
  67. return false;
  68. };
  69. var empty = {};
  70. Obj.mixin = function(dest, source) {
  71. for (var name in source) {
  72. _mixin(dest, source, name);
  73. }
  74. };
  75. // split off this piece from Obj.mixin to allow for optimization
  76. function _mixin(dest, source, name) {
  77. var s = source[name];
  78. if ((dest[name] === undefined) || (dest[name] !== s && ((empty[name] === undefined) || empty[name] !== s))) {
  79. dest[name] = s;
  80. }
  81. }
  82. return Obj;
  83. })();
  84. // $source: com/ibm/rave/core/internal/selector/SelectorHelper
  85. /************************************************************************
  86. ** IBM Confidential
  87. **
  88. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  89. **
  90. ** (C) Copyright IBM Corp. 2017
  91. **
  92. ** The source code for this program is not published or otherwise divested of its trade secrets,
  93. ** irrespective of what has been deposited with the U.S. Copyright Office.
  94. ************************************************************************/
  95. // GENERATED
  96. //@import com/ibm/rave/core/Configuration (runtime) // Configuration
  97. //@import com/ibm/rave/core/internal/util/QueryUtil (runtime) // getQueryEngine
  98. var com_ibm_rave_core_internal_selector_SelectorHelper = {
  99. };
  100. com_ibm_rave_core_internal_selector_SelectorHelper.each = function(selection, callback) {
  101. var node;
  102. for (var j = 0, m = selection.length; j < m; ++j) {
  103. var group = selection[j];
  104. for (var i = 0, n = group.length; i < n; ++i) {
  105. if ((node = group[i])) {
  106. callback.call(node, node.rave_getData(), i, j);
  107. }
  108. }
  109. }
  110. return selection;
  111. };
  112. com_ibm_rave_core_internal_selector_SelectorHelper.selector = function(selector) {
  113. return typeof selector === "function" ? selector : function(data, index, groupIndex) {
  114. return selector != null ? com_ibm_rave_core_Configuration.INSTANCE.filter(com_ibm_rave_core_internal_util_QueryUtil.getQueryEngine(this).querySelector(selector, this), selector) : null;
  115. };
  116. };
  117. com_ibm_rave_core_internal_selector_SelectorHelper.selectorAll = function(selector) {
  118. return typeof selector === "function" ? selector : function(data, index, groupIndex) {
  119. return selector != null ? com_ibm_rave_core_Configuration.INSTANCE.filterArray(com_ibm_rave_core_internal_util_QueryUtil.getQueryEngine(this).querySelectorAll(selector, this)) : null;
  120. };
  121. };
  122. // $source: com/ibm/rave/core/internal/util/QueryUtil
  123. /************************************************************************
  124. ** IBM Confidential
  125. **
  126. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  127. **
  128. ** (C) Copyright IBM Corp. 2017
  129. **
  130. ** The source code for this program is not published or otherwise divested of its trade secrets,
  131. ** irrespective of what has been deposited with the U.S. Copyright Office.
  132. ************************************************************************/
  133. // GENERATED
  134. //@import com/ibm/rave/core/Configuration (runtime) // Configuration
  135. var com_ibm_rave_core_internal_util_QueryUtil = {
  136. //constructor : function() {}
  137. };
  138. /**
  139. * Get a query engine for the given root node.
  140. * @param (com.ibm.rave.core.scene.SceneNode) root a scene node, may be <code>null</code>
  141. * @return (com.ibm.rave.core.internal.selector.SelectionQueryEngine) a query engine
  142. */
  143. com_ibm_rave_core_internal_util_QueryUtil.getQueryEngine = function(root) {
  144. var config = com_ibm_rave_core_Configuration.INSTANCE;
  145. if (root) {
  146. var result = config.getQueryEngine(root.rave_getQualifiedName());
  147. if (!result) {
  148. result = config.getQueryEngine(root.rave_getNamespaceURI());
  149. }
  150. return result;
  151. }
  152. return config.getQueryEngine(null);
  153. };
  154. // $source: com/ibm/rave/core/internal/nativeImpl/selector/EmptySceneNode
  155. /************************************************************************
  156. ** IBM Confidential
  157. **
  158. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  159. **
  160. ** (C) Copyright IBM Corp. 2014
  161. **
  162. ** The source code for this program is not published or otherwise divested of its trade secrets,
  163. ** irrespective of what has been deposited with the U.S. Copyright Office.
  164. ************************************************************************/
  165. var com_ibm_rave_core_internal_nativeImpl_selector_EmptySceneNode = function(data) {
  166. this["__data__"] = data;
  167. };
  168. com_ibm_rave_core_internal_nativeImpl_selector_EmptySceneNode.prototype.rave_getData = function() {
  169. return this["__data__"];
  170. };
  171. com_ibm_rave_core_internal_nativeImpl_selector_EmptySceneNode.prototype.rave_setData = function(d) {
  172. this["__data__"] = d;
  173. };
  174. com_ibm_rave_core_internal_nativeImpl_selector_EmptySceneNode.prototype.rave_hasData = function() {
  175. return "__data__" in this;
  176. };
  177. // $source: com/ibm/rave/core/internal/nativeImpl/transitions/InheritedTransition
  178. /************************************************************************
  179. ** IBM Confidential
  180. **
  181. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  182. **
  183. ** (C) Copyright IBM Corp. 2014
  184. **
  185. ** The source code for this program is not published or otherwise divested of its trade secrets,
  186. ** irrespective of what has been deposited with the U.S. Copyright Office.
  187. ************************************************************************/
  188. var com_ibm_rave_core_internal_nativeImpl_transitions_InheritedTransition = {
  189. get : function() {
  190. return this._inherited;
  191. },
  192. set : function(inherited) {
  193. this._inherited = inherited;
  194. }
  195. };
  196. // $source: com/ibm/rave/core/internal/nativeImpl/Vendor
  197. /************************************************************************
  198. ** IBM Confidential
  199. **
  200. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  201. **
  202. ** (C) Copyright IBM Corp. 2014
  203. **
  204. ** The source code for this program is not published or otherwise divested of its trade secrets,
  205. ** irrespective of what has been deposited with the U.S. Copyright Office.
  206. ************************************************************************/
  207. var vendorPrefixes = ["webkit", "ms", "moz", "Moz", "o", "O"];
  208. function vendorSymbol(object, name) {
  209. if (name in object) {
  210. return name;
  211. }
  212. name = name.charAt(0).toUpperCase() + name.substring(1);
  213. for (var i = 0, n = vendorPrefixes.length; i < n; ++i) {
  214. var prefixName = vendorPrefixes[i] + name;
  215. if (prefixName in object)
  216. return prefixName;
  217. }
  218. }
  219. // $source: com/ibm/rave/core/context/RaveOperationalMode
  220. /************************************************************************
  221. ** IBM Confidential
  222. **
  223. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  224. **
  225. ** (C) Copyright IBM Corp. 2017
  226. **
  227. ** The source code for this program is not published or otherwise divested of its trade secrets,
  228. ** irrespective of what has been deposited with the U.S. Copyright Office.
  229. ************************************************************************/
  230. // GENERATED
  231. /**
  232. * A class that indicates the mode under which Rave as a whole is currently operating. It is primarily used to check if Rave library is currently operating in image service (server) mode or not. The default mode is (obviously) the default. The image service mode has to be set explicitly before using Rave library. It is important to note that once Rave's mode of operation is set to image service, it cannot be re-set back to the default mode
  233. */
  234. var com_ibm_rave_core_context_RaveOperationalMode = rave_externs["RaveOperationalMode"] = {
  235. //constructor : function() {}
  236. };
  237. /**
  238. * The default mode of operation
  239. */
  240. /** @expose */
  241. com_ibm_rave_core_context_RaveOperationalMode.DEFAULT = 0;
  242. /**
  243. * The image service (server) mode of operation
  244. */
  245. /** @expose */
  246. com_ibm_rave_core_context_RaveOperationalMode.IMAGE_SERVICE = 1;
  247. /**
  248. * The current mode of operation. Client who use Rave to generate server images must explicitly set this mode to IMAGE_SERVICE before using Rave. It is important to note that once Rave's mode of operation is set to image service, it cannot be re-set back to the default mode
  249. */
  250. /** @expose */
  251. com_ibm_rave_core_context_RaveOperationalMode.MODE = 0;
  252. // $source: com/ibm/rave/core/internal/nativeImpl/Lang
  253. /************************************************************************
  254. ** IBM Confidential
  255. **
  256. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  257. **
  258. ** (C) Copyright IBM Corp. 2014, 2015
  259. **
  260. ** The source code for this program is not published or otherwise divested of its trade secrets,
  261. ** irrespective of what has been deposited with the U.S. Copyright Office.
  262. ************************************************************************/
  263. var com_ibm_rave_core_internal_nativeImpl_Lang = {
  264. /** @expose **/
  265. isNumber: function (object) {
  266. return (typeof object == 'number' || object instanceof Number);
  267. },
  268. /** @expose **/
  269. isString: function (object) {
  270. return (typeof object == 'string' || object instanceof String);
  271. },
  272. /** @expose **/
  273. isBoolean: function (object) {
  274. return (typeof object == 'boolean' || object instanceof Boolean);
  275. },
  276. /** @expose **/
  277. isList: function (object) {
  278. // in JS for now we do nto really have lists , they all get translated to Array
  279. return false;
  280. },
  281. /** @expose **/
  282. isArray: function (object) {
  283. return (typeof object == 'Array' || object instanceof Array);
  284. },
  285. /** @expose **/
  286. isObject: function (object) {
  287. return typeof object == 'object';
  288. },
  289. /** @expose **/
  290. // Return the string as-is. If it's anything else, return an empty string.
  291. toString: function (object) {
  292. return (typeof object == 'string') ? object : "";
  293. }
  294. };
  295. // $source: com/ibm/rave/core/nativeImpl/interpolate/ObjectInterpolation
  296. /************************************************************************
  297. ** IBM Confidential
  298. **
  299. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  300. **
  301. ** (C) Copyright IBM Corp. 2014
  302. **
  303. ** The source code for this program is not published or otherwise divested of its trade secrets,
  304. ** irrespective of what has been deposited with the U.S. Copyright Office.
  305. ************************************************************************/
  306. /**
  307. * Returns an object interpolator between the two objects a and b.
  308. * Internally, an object template is created that has the same properties as b.
  309. * For each property in b, if there exists a corresponding property in a, a generic
  310. * interpolator is created for the two elements using interpolate. If there is no
  311. * such property, the static value from b is used in the template.
  312. * Then, for the given parameter t, the template's embedded interpolators are evaluated
  313. * and the updated object template is then returned.
  314. * For example, if a is the object {x: 0, y: 1} and b is the object {x: 1, y: 10, z: 100},
  315. * the result of the interpolator for t = .5 is the object {x: .5, y: 5.5, z: 100}.
  316. *
  317. * Object interpolation is particularly useful for dataspace interpolation, where data is
  318. * interpolated rather than attribute values. For example, you can interpolate an object which
  319. * describes an arc in a pie chart, and then use d3.svg.arc to compute the new SVG path data.
  320. *
  321. * Note: no defensive copy of the template object is created; modifications of the returned
  322. * object may adversely affect subsequent evaluation of the interpolator. No copy is made because
  323. * interpolators should be fast, as they are part of the inner loop of animation.
  324. * @param (Object) a the start Object
  325. * @param (Object) b the end Object
  326. * @return (com.ibm.rave.core.interpolate.Interpolator) q new interpolator
  327. */
  328. /** @expose */
  329. var com_ibm_rave_core_nativeImpl_interpolate_ObjectInterpolation = function(a, b) {
  330. var i = {}, c = {}, k;
  331. for (k in a) {
  332. if (k in b) {
  333. i[k] = com_ibm_rave_core_interpolate_Interpolators.INSTANCE.getInterpolator(a[k], b[k]);
  334. } else {
  335. c[k] = a[k];
  336. }
  337. }
  338. for (k in b) {
  339. if (!(k in a)) {
  340. c[k] = b[k];
  341. }
  342. }
  343. return function(t) {
  344. for (k in i)
  345. c[k] = i[k](t);
  346. return c;
  347. };
  348. };
  349. /** @expose */
  350. com_ibm_rave_core_nativeImpl_interpolate_ObjectInterpolation.INSTANCE = com_ibm_rave_core_nativeImpl_interpolate_ObjectInterpolation;
  351. // $source: com/ibm/rave/core/nativeImpl/format/Requote
  352. /************************************************************************
  353. ** IBM Confidential
  354. **
  355. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  356. **
  357. ** (C) Copyright IBM Corp. 2014
  358. **
  359. ** The source code for this program is not published or otherwise divested of its trade secrets,
  360. ** irrespective of what has been deposited with the U.S. Copyright Office.
  361. ************************************************************************/
  362. var _requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
  363. var com_ibm_rave_core_nativeImpl_format_Requote = {
  364. requote : function(s) {
  365. return s.replace(_requote_re, "\\$&");
  366. }
  367. };
  368. // $source: com/ibm/rave/core/scene/SceneNodeType
  369. /************************************************************************
  370. ** IBM Confidential
  371. **
  372. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  373. **
  374. ** (C) Copyright IBM Corp. 2017
  375. **
  376. ** The source code for this program is not published or otherwise divested of its trade secrets,
  377. ** irrespective of what has been deposited with the U.S. Copyright Office.
  378. ************************************************************************/
  379. // GENERATED
  380. var com_ibm_rave_core_scene_SceneNodeType = rave_externs["SceneNodeType"] = {
  381. };
  382. /** @expose */
  383. com_ibm_rave_core_scene_SceneNodeType.RECT = 1000;
  384. /** @expose */
  385. com_ibm_rave_core_scene_SceneNodeType.LINE = 1001;
  386. /** @expose */
  387. com_ibm_rave_core_scene_SceneNodeType.CIRCLE = 1002;
  388. /** @expose */
  389. com_ibm_rave_core_scene_SceneNodeType.TEXT = 1003;
  390. /** @expose */
  391. com_ibm_rave_core_scene_SceneNodeType.GROUP = 1004;
  392. /** @expose */
  393. com_ibm_rave_core_scene_SceneNodeType.TITLE = 1005;
  394. /** @expose */
  395. com_ibm_rave_core_scene_SceneNodeType.PATH = 1006;
  396. /** @expose */
  397. com_ibm_rave_core_scene_SceneNodeType.IMAGE = 1007;
  398. /** @expose */
  399. com_ibm_rave_core_scene_SceneNodeType.TEXT_CONTENT = 1008;
  400. /** @expose */
  401. com_ibm_rave_core_scene_SceneNodeType.POLYLINE = 1009;
  402. /** @expose */
  403. com_ibm_rave_core_scene_SceneNodeType.POLYGON = 1010;
  404. /** @expose */
  405. com_ibm_rave_core_scene_SceneNodeType.LINEARGRADIENT = 1011;
  406. /** @expose */
  407. com_ibm_rave_core_scene_SceneNodeType.RADIALGRADIENT = 1012;
  408. /** @expose */
  409. com_ibm_rave_core_scene_SceneNodeType.ELLIPSE = 1013;
  410. /** @expose */
  411. com_ibm_rave_core_scene_SceneNodeType.CLIP_PATH = 1014;
  412. /** @expose */
  413. com_ibm_rave_core_scene_SceneNodeType.DEFS = 1015;
  414. /** @expose */
  415. com_ibm_rave_core_scene_SceneNodeType.STOP = 1016;
  416. /** @expose */
  417. com_ibm_rave_core_scene_SceneNodeType.TEXTPATH = 1017;
  418. /** @expose */
  419. com_ibm_rave_core_scene_SceneNodeType.UNKNOWN = -1;
  420. // $source: com/ibm/rave/core/arrays/Sort
  421. /************************************************************************
  422. ** IBM Confidential
  423. **
  424. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  425. **
  426. ** (C) Copyright IBM Corp. 2017
  427. **
  428. ** The source code for this program is not published or otherwise divested of its trade secrets,
  429. ** irrespective of what has been deposited with the U.S. Copyright Office.
  430. ************************************************************************/
  431. // GENERATED
  432. /**
  433. * Utility for sorting numbers numerically and objects by their string representation.
  434. */
  435. var com_ibm_rave_core_arrays_Sort = rave_externs["Sort"] = {
  436. //constructor : function() {}
  437. };
  438. /**
  439. * Descending sort. Sorts numbers numerically and all other objects by their string representation.
  440. */
  441. /** @expose */
  442. com_ibm_rave_core_arrays_Sort.descending = function(a, b) {
  443. return b<a ? -1 : b>a ? 1 : 0;
  444. };
  445. /**
  446. * Ascending sort. Sorts numbers numerically and all other objects by their string representation.
  447. */
  448. /** @expose */
  449. com_ibm_rave_core_arrays_Sort.ascending = function(a, b) {
  450. return a<b ? -1 : a>b ? 1 : 0;
  451. };
  452. // $source: com/ibm/rave/core/internal/nativeImpl/scene/SceneNodeUtil
  453. /************************************************************************
  454. ** IBM Confidential
  455. **
  456. ** OCO Source Materials
  457. **
  458. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  459. **
  460. ** (C) Copyright IBM Corp. 2014
  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. var com_ibm_rave_core_internal_nativeImpl_scene_SceneNodeUtil = {
  466. // static property that caches our only check for getOwnerBoundingClientRect
  467. // a bit hacky. If we need additional browser checks in the future, we
  468. // should move all browser detection outside
  469. // to another utility
  470. _isOldFirefox : null,
  471. getOwnerBoundingClientRect : function(node) {
  472. // Firefox < v33 will not correctly calculate the size of an svg node
  473. // using getBoundingClientRect().
  474. // The bounds returned may only include the size of the items inside the
  475. // node or may be zero. For now
  476. // use getCalculatedStyle().
  477. if (this._isOldFirefox === null) {
  478. var versionIndex = -1;
  479. var userAgent = navigator.userAgent.toString();
  480. // cache our browser result - only care about older versions of
  481. // firefox here. And also phantomjs for testing.
  482. // Useragent for Firefox is
  483. // Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Firefox/31.0
  484. // So, try to determine the version after Firefox/
  485. this._isOldFirefox = userAgent.indexOf("PhantomJS") > -1 || ((versionIndex = userAgent.indexOf("Firefox")) > -1 && userAgent.slice(versionIndex + 8) < 33);
  486. }
  487. if (this._isOldFirefox && rave_window(node)) {
  488. var computedStyle = rave_window(node).getComputedStyle(node);
  489. var width = 0;
  490. var height = 0;
  491. [ 'height', 'paddingTop', 'paddingBottom', 'borderTopWidth', 'borderBottomWidth' ].forEach(function(attribute) {
  492. height += parseFloat(computedStyle[attribute]);
  493. });
  494. [ 'width', 'paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth' ].forEach(function(attribute) {
  495. width += parseFloat(computedStyle[attribute]);
  496. });
  497. return {
  498. "width" : width,
  499. "height" : height
  500. };
  501. }
  502. // Default is to just call getClientBoundingRect
  503. return node.getBoundingClientRect();
  504. }
  505. };
  506. // $source: com/ibm/rave/core/arrays/Merge
  507. /************************************************************************
  508. ** IBM Confidential
  509. **
  510. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  511. **
  512. ** (C) Copyright IBM Corp. 2017
  513. **
  514. ** The source code for this program is not published or otherwise divested of its trade secrets,
  515. ** irrespective of what has been deposited with the U.S. Copyright Office.
  516. ************************************************************************/
  517. // GENERATED
  518. /**
  519. * Creates a flattened array
  520. */
  521. var com_ibm_rave_core_arrays_Merge = rave_externs["Merge"] = {
  522. //constructor : function() {}
  523. };
  524. /**
  525. * Create a merged array.
  526. * @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]
  527. * @return (Array) flattened array
  528. */
  529. /** @expose */
  530. com_ibm_rave_core_arrays_Merge.merge = function(arrays) {
  531. var n = arrays.length, m;
  532. var array;
  533. var newSize = 0;
  534. for (var __i_enFor0 = 0, __exp_enFor0 = arrays, __len_enFor0 = __exp_enFor0.length;
  535. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  536. var child = __exp_enFor0[__i_enFor0];
  537. newSize += child.length;
  538. }
  539. var merged = new Array(newSize);
  540. while (--n >= 0) {
  541. array = arrays[n];
  542. m = array.length;
  543. while (--m >= 0) {
  544. merged[--newSize] = array[m];
  545. }
  546. }
  547. return merged;
  548. };
  549. // $source: com/ibm/rave/core/arrays/MinMax
  550. /************************************************************************
  551. ** IBM Confidential
  552. **
  553. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  554. **
  555. ** (C) Copyright IBM Corp. 2017
  556. **
  557. ** The source code for this program is not published or otherwise divested of its trade secrets,
  558. ** irrespective of what has been deposited with the U.S. Copyright Office.
  559. ************************************************************************/
  560. // GENERATED
  561. var com_ibm_rave_core_arrays_MinMax = rave_externs["MinMax"] = {
  562. //constructor : function() {}
  563. };
  564. /**
  565. * Get the max value in the array.
  566. * @param (Array) numbers an array of numbers.
  567. * @return (Object) the max value in the array
  568. */
  569. com_ibm_rave_core_arrays_MinMax.max$0 = function(numbers) {
  570. var i = -1;
  571. var n = numbers.length;
  572. var a, b;
  573. while (++i < n) {
  574. if ((b = numbers[i]) != null && b<=b) {
  575. a = b;
  576. break;
  577. }
  578. }
  579. while (++i < n) {
  580. if ((b = numbers[i]) != null && b>a) {
  581. a = b;
  582. }
  583. }
  584. return a;
  585. };
  586. /**
  587. * Get the max value in the data array extracted from the value function.
  588. * @param (Array) data an array of data
  589. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction a function that returns a number for each item in the data array
  590. * @return (Object) the max value in the data
  591. */
  592. com_ibm_rave_core_arrays_MinMax.max$1 = function(data, valueFunction) {
  593. var i = -1;
  594. var n = data.length;
  595. var a, b;
  596. while (++i < n) {
  597. if ((b = valueFunction.call(data, data[i], i, -1)) != null && b<=b) {
  598. a = b;
  599. break;
  600. }
  601. }
  602. while (++i < n) {
  603. if ((b = valueFunction.call(data, data[i], i, -1)) != null && b>a) {
  604. a = b;
  605. }
  606. }
  607. return a;
  608. };
  609. /**
  610. * Get the min value in the array.
  611. * @param (Array) numbers an array of numbers
  612. * @return (Object) the min value in the array
  613. */
  614. com_ibm_rave_core_arrays_MinMax.min$0 = function(numbers) {
  615. var i = -1;
  616. var n = numbers.length;
  617. var a, b;
  618. while (++i < n) {
  619. if ((b = numbers[i]) != null && b<=b) {
  620. a = b;
  621. break;
  622. }
  623. }
  624. while (++i < n) {
  625. if ((b = numbers[i]) != null && b<a) {
  626. a = b;
  627. }
  628. }
  629. return a;
  630. };
  631. /**
  632. * Get the min value in the data array extracted from the value function.
  633. * @param (Array) data an array of data
  634. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction a function that returns a number for each item in the data array
  635. * @return (Object) the min value in the data
  636. */
  637. com_ibm_rave_core_arrays_MinMax.min$1 = function(data, valueFunction) {
  638. var i = -1;
  639. var n = data.length;
  640. var a, b;
  641. while (++i < n) {
  642. if ((b = valueFunction.call(data, data[i], i, -1)) != null && b<=b) {
  643. a = b;
  644. break;
  645. }
  646. }
  647. while (++i < n) {
  648. if ((b = valueFunction.call(data, data[i], i, -1)) != null && b<a) {
  649. a = b;
  650. }
  651. }
  652. return a;
  653. };
  654. /** @expose */
  655. com_ibm_rave_core_arrays_MinMax.max = function(a0, a1) {
  656. var args = arguments;
  657. if (args.length == 1) {
  658. return com_ibm_rave_core_arrays_MinMax.max$0(a0);
  659. }
  660. return com_ibm_rave_core_arrays_MinMax.max$1(a0, a1);
  661. };
  662. /** @expose */
  663. com_ibm_rave_core_arrays_MinMax.min = function(a0, a1) {
  664. var args = arguments;
  665. if (args.length == 1) {
  666. return com_ibm_rave_core_arrays_MinMax.min$0(a0);
  667. }
  668. return com_ibm_rave_core_arrays_MinMax.min$1(a0, a1);
  669. };
  670. // $source: com/ibm/rave/core/arrays/Quantile
  671. /************************************************************************
  672. ** IBM Confidential
  673. **
  674. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  675. **
  676. ** (C) Copyright IBM Corp. 2017
  677. **
  678. ** The source code for this program is not published or otherwise divested of its trade secrets,
  679. ** irrespective of what has been deposited with the U.S. Copyright Office.
  680. ************************************************************************/
  681. // GENERATED
  682. /**
  683. * 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.
  684. */
  685. var com_ibm_rave_core_arrays_Quantile = rave_externs["Quantile"] = {
  686. //constructor : function() {}
  687. };
  688. /**
  689. * Returns the p-quantile of the given sorted array of numbers
  690. * @param (Array) values Sorted array of values (in ascending order)
  691. * @param (double) p the p value, for median use p = 0.5
  692. * @return (Number) the p-quantile value
  693. */
  694. /** @expose */
  695. com_ibm_rave_core_arrays_Quantile.quantile = function(values, p) {
  696. var H = (values.length - 1) * p + 1;
  697. var iH = Math.floor(H);
  698. var v = + (values[iH - 1]);
  699. var e = H - iH;
  700. return (e != 0) ? v + e * (+ (values[iH]) - v) : v;
  701. };
  702. // $source: com/ibm/rave/core/arrays/Deviation
  703. /************************************************************************
  704. ** IBM Confidential
  705. **
  706. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  707. **
  708. ** (C) Copyright IBM Corp. 2017
  709. **
  710. ** The source code for this program is not published or otherwise divested of its trade secrets,
  711. ** irrespective of what has been deposited with the U.S. Copyright Office.
  712. ************************************************************************/
  713. // GENERATED
  714. //@import com/ibm/rave/core/arrays/Variance (runtime) // variance
  715. /**
  716. * 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.
  717. */
  718. var com_ibm_rave_core_arrays_Deviation = rave_externs["Deviation"] = {
  719. //constructor : function() {}
  720. };
  721. /**
  722. * Calculates the standard deviation of an array of values.
  723. * @param (java.lang.Object[]) array the values used to calculate the deviation
  724. * @return (Number) the deviation value
  725. */
  726. com_ibm_rave_core_arrays_Deviation.deviation$0 = function(array) {
  727. var v = com_ibm_rave_core_arrays_Variance.variance(array);
  728. return (v) ? Math.sqrt((v)) : v;
  729. };
  730. /**
  731. * Calculates the standard deviation of an array of values.
  732. * @param (java.lang.Object[]) array the values used to calculate the deviation
  733. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction the accessor function to use to get the value
  734. * @return (Number) the deviation value
  735. */
  736. com_ibm_rave_core_arrays_Deviation.deviation$1 = function(array, valueFunction) {
  737. var v = com_ibm_rave_core_arrays_Variance.variance(array, valueFunction);
  738. return (v) ? Math.sqrt((v)) : v;
  739. };
  740. /** @expose */
  741. com_ibm_rave_core_arrays_Deviation.deviation = function(a0, a1) {
  742. var args = arguments;
  743. if (args.length == 1) {
  744. return com_ibm_rave_core_arrays_Deviation.deviation$0(a0);
  745. }
  746. return com_ibm_rave_core_arrays_Deviation.deviation$1(a0, a1);
  747. };
  748. // $source: com/ibm/rave/core/internal/math/NumberUtil
  749. /************************************************************************
  750. ** IBM Confidential
  751. **
  752. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  753. **
  754. ** (C) Copyright IBM Corp. 2017
  755. **
  756. ** The source code for this program is not published or otherwise divested of its trade secrets,
  757. ** irrespective of what has been deposited with the U.S. Copyright Office.
  758. ************************************************************************/
  759. // GENERATED
  760. /**
  761. * A collection of utility function for numbers.
  762. */
  763. var com_ibm_rave_core_internal_math_NumberUtil = {
  764. };
  765. /**
  766. * Similar to {@link this.ObjectConverter#this.toDouble(Object)} , but returns NaN if the object is null.
  767. * @param (Object) o the object to convert
  768. * @return (double) a number value, or NaN if the object is null
  769. */
  770. com_ibm_rave_core_internal_math_NumberUtil.toNumber = function(o) {
  771. return o == null ? NaN : + (o);
  772. };
  773. // $source: com/ibm/rave/core/arrays/Extent
  774. /************************************************************************
  775. ** IBM Confidential
  776. **
  777. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  778. **
  779. ** (C) Copyright IBM Corp. 2017
  780. **
  781. ** The source code for this program is not published or otherwise divested of its trade secrets,
  782. ** irrespective of what has been deposited with the U.S. Copyright Office.
  783. ************************************************************************/
  784. // GENERATED
  785. var com_ibm_rave_core_arrays_Extent = rave_externs["Extent"] = {
  786. //constructor : function() {}
  787. };
  788. /**
  789. * Returns the extent (min,max) of the given array.
  790. * @param (java.lang.Object[]) array the array to use to calculate the extent
  791. * @return (Array) the extent array.
  792. */
  793. com_ibm_rave_core_arrays_Extent.extent$0 = function(array) {
  794. var n = array.length;
  795. if (n <= 0) {
  796. return [undefined, undefined];
  797. }
  798. var a, b, c;
  799. var i = -1;
  800. while (++i < n) {
  801. if ((b = array[i]) != null && b>=b) {
  802. a = c = b;
  803. break;
  804. }
  805. }
  806. while (++i < n) {
  807. if ((b = array[i]) != null) {
  808. if (a>b) {
  809. a = b;
  810. }
  811. if (c<b) {
  812. c = b;
  813. }
  814. }
  815. }
  816. return [a, c];
  817. };
  818. /**
  819. * Returns the extent(min, max) of the values returned from the accessor function.
  820. * @param (java.lang.Object[]) array the data to iterator over.
  821. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction the accessor function to use to get the values.
  822. * @return (Array) the extent
  823. */
  824. com_ibm_rave_core_arrays_Extent.extent$1 = function(array, valueFunction) {
  825. var n = array.length;
  826. var a, b, c;
  827. var i = -1;
  828. if (n <= 0) {
  829. return [undefined, undefined];
  830. }
  831. while (++i < n) {
  832. if ((b = valueFunction.call(array, array[i], i, -1)) != null && b>=b) {
  833. a = c = b;
  834. break;
  835. }
  836. }
  837. while (++i < n) {
  838. b = valueFunction.call(array, array[i], i, -1);
  839. if (b != null) {
  840. if (a>b) {
  841. a = b;
  842. }
  843. if (c<b) {
  844. c = b;
  845. }
  846. }
  847. }
  848. return [a, c];
  849. };
  850. /** @expose */
  851. com_ibm_rave_core_arrays_Extent.extent = function(a0, a1) {
  852. var args = arguments;
  853. if (args.length == 1) {
  854. return com_ibm_rave_core_arrays_Extent.extent$0(a0);
  855. }
  856. return com_ibm_rave_core_arrays_Extent.extent$1(a0, a1);
  857. };
  858. // $source: com/ibm/rave/core/arrays/Sum
  859. /************************************************************************
  860. ** IBM Confidential
  861. **
  862. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  863. **
  864. ** (C) Copyright IBM Corp. 2017
  865. **
  866. ** The source code for this program is not published or otherwise divested of its trade secrets,
  867. ** irrespective of what has been deposited with the U.S. Copyright Office.
  868. ************************************************************************/
  869. // GENERATED
  870. var com_ibm_rave_core_arrays_Sum = rave_externs["Sum"] = {
  871. //constructor : function() {}
  872. };
  873. /**
  874. * Get the sum of the values in the array.
  875. * @param (Array) numbers an array of numbers
  876. * @return (Number) the sum of the values in the array
  877. */
  878. com_ibm_rave_core_arrays_Sum.sum$0 = function(numbers) {
  879. var s = 0;
  880. var n = numbers.length;
  881. var a;
  882. var i = -1;
  883. while (++i < n) {
  884. a = + (numbers[i]);
  885. if (!(isNaN(a))) {
  886. s += a;
  887. }
  888. }
  889. return s;
  890. };
  891. /**
  892. * Get the sum of the values in the data array extracted from the value function.
  893. * @param (Array) data an array of data
  894. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction a function that returns a number for each item in the data array
  895. * @return (Number) the sum of the values in the data
  896. */
  897. com_ibm_rave_core_arrays_Sum.sum$1 = function(data, valueFunction) {
  898. var s = 0;
  899. var n = data.length;
  900. var a;
  901. var i = -1;
  902. while (++i < n) {
  903. if ((a = valueFunction.call(data, data[i], i, -1)) != null && !(isNaN((a)))) {
  904. s += (a);
  905. }
  906. }
  907. return s;
  908. };
  909. /** @expose */
  910. com_ibm_rave_core_arrays_Sum.sum = function(a0, a1) {
  911. var args = arguments;
  912. if (args.length == 1) {
  913. return com_ibm_rave_core_arrays_Sum.sum$0(a0);
  914. }
  915. return com_ibm_rave_core_arrays_Sum.sum$1(a0, a1);
  916. };
  917. // $source: com/ibm/rave/core/arrays/Zip
  918. /************************************************************************
  919. ** IBM Confidential
  920. **
  921. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  922. **
  923. ** (C) Copyright IBM Corp. 2017
  924. **
  925. ** The source code for this program is not published or otherwise divested of its trade secrets,
  926. ** irrespective of what has been deposited with the U.S. Copyright Office.
  927. ************************************************************************/
  928. // GENERATED
  929. //@import com/ibm/rave/core/arrays/MinMax (runtime) // min
  930. /**
  931. * 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]]
  932. */
  933. var com_ibm_rave_core_arrays_Zip = rave_externs["Zip"] = {
  934. //constructor : function() {}
  935. };
  936. /**
  937. * 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]]
  938. * @param (java.util.List[]) objects the input arrays
  939. * @return (Array) and Array of Arrays zipped version of the arrays of objects provided
  940. */
  941. /** @expose */
  942. com_ibm_rave_core_arrays_Zip.zip = function(objects) {
  943. if (objects !== null || arguments.length > 1){
  944. objects = Array.prototype.slice.call(arguments);
  945. }
  946. {
  947. var n = objects.length;
  948. var zips = [];
  949. if (n == 0) {
  950. return zips;
  951. }
  952. 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));
  953. for (var i = 0; i < m; ++i) {
  954. var zip = new Array(n);
  955. zips.push(zip);
  956. for (var j = 0; j < n; ++j) {
  957. zip[j] = objects[j][i];
  958. }
  959. }
  960. return zips;
  961. }
  962. };
  963. com_ibm_rave_core_arrays_Zip.toArrayEx = function(objects) {
  964. var retVal = [];
  965. for (var index = 0; index < objects.length; ++index) {
  966. retVal.push(objects[index]);
  967. }
  968. return retVal;
  969. };
  970. com_ibm_rave_core_arrays_Zip.MIN_FN = function(data, index, groupIndex) {
  971. return ((data).length);
  972. };
  973. // $source: com/ibm/rave/core/arrays/Permute
  974. /************************************************************************
  975. ** IBM Confidential
  976. **
  977. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  978. **
  979. ** (C) Copyright IBM Corp. 2017
  980. **
  981. ** The source code for this program is not published or otherwise divested of its trade secrets,
  982. ** irrespective of what has been deposited with the U.S. Copyright Office.
  983. ************************************************************************/
  984. // GENERATED
  985. /**
  986. * 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>
  987. */
  988. var com_ibm_rave_core_arrays_Permute = rave_externs["Permute"] = {
  989. //constructor : function() {}
  990. };
  991. /**
  992. * Returns a permutation of the specified array using the specified array of indexes.
  993. * @param (Array) inputArray the array to permute
  994. * @param (Array) indexes the indexes to use to do the permute
  995. * @return (Array) the permuted array
  996. */
  997. /** @expose */
  998. com_ibm_rave_core_arrays_Permute.permute = function(inputArray, indexes) {
  999. var i = indexes.length;
  1000. var permutes = new Array(i);
  1001. while (i-- > 0) {
  1002. if (0 <= indexes[i] && indexes[i] < inputArray.length) {
  1003. permutes[i] = inputArray[indexes[i]];
  1004. }
  1005. }
  1006. return permutes;
  1007. };
  1008. // $source: com/ibm/rave/core/arrays/Range
  1009. /************************************************************************
  1010. ** IBM Confidential
  1011. **
  1012. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1013. **
  1014. ** (C) Copyright IBM Corp. 2017
  1015. **
  1016. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1017. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1018. ************************************************************************/
  1019. // GENERATED
  1020. /**
  1021. * 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.
  1022. */
  1023. var com_ibm_rave_core_arrays_Range = rave_externs["Range"] = {
  1024. //constructor : function() {}
  1025. };
  1026. /**
  1027. * Generates an array containing an arithmetic progression between 'start' and 'stop incrementing by 'step'. <p> Start defaults to 0.<br> Step defaults to 1.
  1028. * @param (Object) stop the end range value
  1029. * @return (Array) an array containing an arithmetic progression
  1030. */
  1031. com_ibm_rave_core_arrays_Range.create$0 = function(stop) {
  1032. return com_ibm_rave_core_arrays_Range.createRange(0, + (stop), 1);
  1033. };
  1034. /**
  1035. * Generates an array containing an arithmetic progression between 'start' and 'stop incrementing by 'step'. <p> Step defaults to 1.
  1036. * @param (Object) start the starting range value
  1037. * @param (Object) stop the end range value
  1038. * @return (Array) an array containing an arithmetic progression
  1039. */
  1040. com_ibm_rave_core_arrays_Range.create$1 = function(start, stop) {
  1041. return com_ibm_rave_core_arrays_Range.createRange(+ (start), + (stop), 1);
  1042. };
  1043. /**
  1044. * Generates an array containing an arithmetic progression between 'start' and 'stop incrementing by 'step'.
  1045. * @param (Object) start the starting range value
  1046. * @param (Object) stop the end range value
  1047. * @param (Object) step the step
  1048. * @return (Array) an array containing an arithmetic progression
  1049. */
  1050. com_ibm_rave_core_arrays_Range.create$2 = function(start, stop, step) {
  1051. return com_ibm_rave_core_arrays_Range.createRange(+ (start), + (stop), + (step));
  1052. };
  1053. com_ibm_rave_core_arrays_Range.createRange = function(start, stop, step) {
  1054. var _start = start;
  1055. var _stop = stop;
  1056. var _step = step;
  1057. var range = [];
  1058. if ((_stop - _start) / _step == Infinity) {
  1059. throw new Error("infinite range");
  1060. }
  1061. var k = com_ibm_rave_core_arrays_Range.integerScale(Math.abs(_step));
  1062. var i = -1;
  1063. var j;
  1064. _start *= k;
  1065. _stop *= k;
  1066. _step *= k;
  1067. if (_step < 0) {
  1068. while ((j = _start + _step * ++i) > _stop) {
  1069. range.push(j / k);
  1070. }
  1071. } else {
  1072. while ((j = _start + _step * ++i) < _stop) {
  1073. range.push(j / k);
  1074. }
  1075. }
  1076. return range;
  1077. };
  1078. com_ibm_rave_core_arrays_Range.integerScale = function(x) {
  1079. var k = 1;
  1080. while ((x * k % 1)) {
  1081. k *= 10;
  1082. }
  1083. return k;
  1084. };
  1085. /** @expose */
  1086. com_ibm_rave_core_arrays_Range.create = function(a0, a1, a2) {
  1087. var args = arguments;
  1088. if (args.length == 1) {
  1089. return com_ibm_rave_core_arrays_Range.create$0(a0);
  1090. }
  1091. if (args.length == 2) {
  1092. return com_ibm_rave_core_arrays_Range.create$1(a0, a1);
  1093. }
  1094. return com_ibm_rave_core_arrays_Range.create$2(a0, a1, a2);
  1095. };
  1096. // $source: com/ibm/rave/core/nativeImpl/event/EventTracker
  1097. /************************************************************************
  1098. ** IBM Confidential
  1099. **
  1100. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1101. **
  1102. ** (C) Copyright IBM Corp. 2014
  1103. **
  1104. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1105. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1106. ************************************************************************/
  1107. var com_ibm_rave_core_nativeImpl_event_EventTracker = {
  1108. eventSource : function() {
  1109. var e = rave.event, s;
  1110. while (s = e.sourceEvent) {
  1111. e = s;
  1112. }
  1113. return e;
  1114. }
  1115. };
  1116. // $source: com/ibm/rave/core/event/Touches
  1117. /************************************************************************
  1118. ** IBM Confidential
  1119. **
  1120. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1121. **
  1122. ** (C) Copyright IBM Corp. 2017
  1123. **
  1124. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1125. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1126. ************************************************************************/
  1127. // GENERATED
  1128. //@import com/ibm/rave/core/nativeImpl/event/Mouse (runtime) // mousePoint
  1129. var com_ibm_rave_core_event_Touches = rave_externs["Touches"] = {
  1130. //constructor : function() {}
  1131. };
  1132. com_ibm_rave_core_event_Touches.touches$0 = function(container) {
  1133. return com_ibm_rave_core_event_Touches.touches$1(container, (rave.event).touches);
  1134. };
  1135. com_ibm_rave_core_event_Touches.touches$1 = function(container, touches) {
  1136. var touchList = [];
  1137. for (var __i_enFor0 = 0, __exp_enFor0 = touches, __len_enFor0 = __exp_enFor0.length;
  1138. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1139. var touch = __exp_enFor0[__i_enFor0];
  1140. var mousePoint = com_ibm_rave_core_nativeImpl_event_Mouse.mousePoint(container, touch);
  1141. var point = [mousePoint[0], mousePoint[1]];
  1142. point["identifier"] = touch.identifier;
  1143. touchList.push(point);
  1144. }
  1145. return touchList;
  1146. };
  1147. /** @expose */
  1148. com_ibm_rave_core_event_Touches.touches = function(a0, a1) {
  1149. var args = arguments;
  1150. if (args.length == 1) {
  1151. return com_ibm_rave_core_event_Touches.touches$0(a0);
  1152. }
  1153. return com_ibm_rave_core_event_Touches.touches$1(a0, a1);
  1154. };
  1155. // $source: com/ibm/rave/core/format/Round
  1156. /************************************************************************
  1157. ** IBM Confidential
  1158. **
  1159. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1160. **
  1161. ** (C) Copyright IBM Corp. 2017
  1162. **
  1163. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1164. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1165. ************************************************************************/
  1166. // GENERATED
  1167. var com_ibm_rave_core_format_Round = rave_externs["Round"] = {
  1168. };
  1169. /**
  1170. * 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.
  1171. * @param (double) x the value to round
  1172. * @param (double) n if specified, rounds x to n digits
  1173. * @return (double) the value x rounded to n digits
  1174. */
  1175. /** @expose */
  1176. com_ibm_rave_core_format_Round.round = function(x, n) {
  1177. var _n = n;
  1178. return (_n) ? Math.round(x * (_n = Math.pow(10, _n))) / _n : Math.round(x);
  1179. };
  1180. // $source: com/ibm/rave/core/internal/format/Precision
  1181. /************************************************************************
  1182. ** IBM Confidential
  1183. **
  1184. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1185. **
  1186. ** (C) Copyright IBM Corp. 2017
  1187. **
  1188. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1189. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1190. ************************************************************************/
  1191. // GENERATED
  1192. var com_ibm_rave_core_internal_format_Precision = {
  1193. };
  1194. /**
  1195. * 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
  1196. * @param (double) x the value to calculate precision for
  1197. * @param (int) p a value to offset the precision value by
  1198. * @return (double) the calculated precision
  1199. */
  1200. com_ibm_rave_core_internal_format_Precision.precision = function(x, p) {
  1201. return p - ((x) ? Math.ceil(Math.log(x) / Math["LN10"]) : 1);
  1202. };
  1203. // $source: com/ibm/rave/core/nativeImpl/arrays/AssociativeArrays
  1204. /************************************************************************
  1205. ** IBM Confidential
  1206. **
  1207. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1208. **
  1209. ** (C) Copyright IBM Corp. 2014
  1210. **
  1211. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1212. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1213. ************************************************************************/
  1214. /**
  1215. * Another common data type in JavaScript is the associative array, or more simply
  1216. * the object, which has a set of named properties. In Java this is referred to as a map,
  1217. * and in Python, a dictionary. JavaScript provides a standard mechanism for
  1218. * iterating over the keys (or property names) in an associative array: the for…in
  1219. * loop. However, note that the iteration order is undefined. D3 provides several
  1220. * operators for converting associative arrays to standard indexed arrays.
  1221. */
  1222. var com_ibm_rave_core_nativeImpl_arrays_AssociativeArrays = {
  1223. /**
  1224. * Returns an array containing the property names of the specified object (an
  1225. * associative array). The order of the returned array is undefined.
  1226. */
  1227. keys : function(map){
  1228. var keys=[];
  1229. for (var key in map) keys.push(key);
  1230. return keys;
  1231. },
  1232. /**
  1233. * Returns an array containing the property values of the specified object (an
  1234. * associative array). The order of the returned array is undefined.
  1235. */
  1236. values : function(map){
  1237. var values = [];
  1238. for(var key in map) values.push(map[key]);
  1239. return values;
  1240. },
  1241. /**
  1242. * Returns an array containing the property keys and values of the specified object
  1243. * (an associative array). Each entry is an object with a key and value attribute, such
  1244. * as {key: "foo", value: 42}. The order of the returned array is undefined
  1245. */
  1246. entries : function(map){
  1247. var entries=[];
  1248. for(var key in map) entries.push({key:key,value:map[key]});
  1249. return entries;
  1250. }
  1251. };
  1252. // $source: com/ibm/rave/core/arrays/Entry
  1253. /************************************************************************
  1254. ** IBM Confidential
  1255. **
  1256. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1257. **
  1258. ** (C) Copyright IBM Corp. 2017
  1259. **
  1260. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1261. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1262. ************************************************************************/
  1263. // GENERATED
  1264. /**
  1265. * Represents an entry in map
  1266. */
  1267. var com_ibm_rave_core_arrays_Entry = rave_externs["Entry"] = function(){};
  1268. // $source: com/ibm/rave/core/arrays/Pairs
  1269. /************************************************************************
  1270. ** IBM Confidential
  1271. **
  1272. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1273. **
  1274. ** (C) Copyright IBM Corp. 2017
  1275. **
  1276. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1277. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1278. ************************************************************************/
  1279. // GENERATED
  1280. /**
  1281. * Static class to call the pairs method
  1282. * @author Bryan
  1283. */
  1284. var com_ibm_rave_core_arrays_Pairs = rave_externs["Pairs"] = {
  1285. //constructor : function() {}
  1286. };
  1287. /**
  1288. * 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.
  1289. * @param (java.lang.Object[]) array
  1290. * @return (java.lang.Object[]) Object[]
  1291. */
  1292. /** @expose */
  1293. com_ibm_rave_core_arrays_Pairs.pairs = function(array) {
  1294. var i = 0, n = array.length - 1;
  1295. var pairs = [];
  1296. if (array.length > 0) {
  1297. var p0, p1 = array[0];
  1298. while (i < n) {
  1299. pairs[i] = [p0 = p1, p1 = array[++i]];
  1300. }
  1301. }
  1302. return pairs;
  1303. };
  1304. // $source: com/ibm/rave/core/nativeImpl/graphicUtils/GraphicContextFactory
  1305. /************************************************************************
  1306. ** IBM Confidential
  1307. **
  1308. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1309. **
  1310. ** (C) Copyright IBM Corp. 2015
  1311. **
  1312. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1313. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1314. ************************************************************************/
  1315. /**
  1316. * utility to create emulation of HTML canvas element 2d context functionality for text measurement
  1317. */
  1318. /**
  1319. * @param (int) width canvas width
  1320. * @param (int) height canvas height
  1321. * @return canvas element
  1322. */
  1323. /** @expose */
  1324. var com_ibm_rave_core_nativeImpl_graphicUtils_GraphicContextFactory = {
  1325. create : function(width, height) {
  1326. var canvas;
  1327. if (typeof document !== "undefined") {
  1328. canvas = document.createElement("canvas");
  1329. canvas.width = width;
  1330. canvas.height = height;
  1331. } else {
  1332. // Attempt to use node-canvas.
  1333. canvas = new Canvas(width, height);
  1334. }
  1335. return canvas;
  1336. },
  1337. dispose : function(context){
  1338. }
  1339. };
  1340. // $source: com/ibm/rave/core/internal/geom/PolygonUtil
  1341. /************************************************************************
  1342. ** IBM Confidential
  1343. **
  1344. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1345. **
  1346. ** (C) Copyright IBM Corp. 2017
  1347. **
  1348. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1349. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1350. ************************************************************************/
  1351. // GENERATED
  1352. var com_ibm_rave_core_internal_geom_PolygonUtil = {
  1353. };
  1354. /**
  1355. * Intersect two infinite lines cd and ab.
  1356. * @param (Array) c starting point of the first line
  1357. * @param (Array) d end point of the first line
  1358. * @param (Array) a starting point of the second line
  1359. * @param (Array) b end point of the second line
  1360. * @return (Array) The intersection point of the two lines
  1361. */
  1362. com_ibm_rave_core_internal_geom_PolygonUtil.polygonIntersect = function(c, d, a, b) {
  1363. 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);
  1364. return [x1 + ua * x21, y1 + ua * y21];
  1365. };
  1366. // $source: com/ibm/rave/core/internal/util/Identity
  1367. /************************************************************************
  1368. ** IBM Confidential
  1369. **
  1370. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1371. **
  1372. ** (C) Copyright IBM Corp. 2017
  1373. **
  1374. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1375. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1376. ************************************************************************/
  1377. // GENERATED
  1378. /**
  1379. * Function class used typically for where Identity projection is needed. It return the same data passed to it.
  1380. */
  1381. var com_ibm_rave_core_internal_util_Identity = {
  1382. };
  1383. com_ibm_rave_core_internal_util_Identity.create = function() {
  1384. return function(data, index, groupIndex) {
  1385. return data;
  1386. };
  1387. };
  1388. // $source: com/ibm/rave/core/internal/math/Trigonometry
  1389. /************************************************************************
  1390. ** IBM Confidential
  1391. **
  1392. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1393. **
  1394. ** (C) Copyright IBM Corp. 2017
  1395. **
  1396. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1397. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1398. ************************************************************************/
  1399. // GENERATED
  1400. var com_ibm_rave_core_internal_math_Trigonometry = {
  1401. //constructor : function() {}
  1402. };
  1403. com_ibm_rave_core_internal_math_Trigonometry.sgn = function(x) {
  1404. return x > 0 ? 1 : x < 0 ? -1 : 0;
  1405. };
  1406. /**
  1407. * 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.
  1408. * @param (Array) a the first point (A)
  1409. * @param (Array) b the second point (B)
  1410. * @param (Array) c the third point (C)
  1411. * @return (double) a positive value if ABC is counter-clockwise, negative if clockwise, and zero if the points are collinear.
  1412. */
  1413. com_ibm_rave_core_internal_math_Trigonometry.cross2d = function(a, b, c) {
  1414. return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);
  1415. };
  1416. com_ibm_rave_core_internal_math_Trigonometry.acos = function(x) {
  1417. return x > 1 ? 0 : x < -1 ? 3.141592653589793 : Math.acos(x);
  1418. };
  1419. com_ibm_rave_core_internal_math_Trigonometry.asin = function(x) {
  1420. return x > 1 ? 1.5707963267948966 : x < -1 ? -1.5707963267948966 : Math.asin(x);
  1421. };
  1422. com_ibm_rave_core_internal_math_Trigonometry.sinh = function(x) {
  1423. var _x = x;
  1424. return ((_x = Math.exp(_x)) - 1 / _x) / 2;
  1425. };
  1426. com_ibm_rave_core_internal_math_Trigonometry.cosh = function(x) {
  1427. var _x = x;
  1428. return ((_x = Math.exp(_x)) + 1 / _x) / 2;
  1429. };
  1430. com_ibm_rave_core_internal_math_Trigonometry.tanh = function(x) {
  1431. var _x = x;
  1432. return ((_x = Math.exp(2 * _x)) - 1) / (_x + 1);
  1433. };
  1434. com_ibm_rave_core_internal_math_Trigonometry.haversin = function(x) {
  1435. var _x = x;
  1436. return (_x = Math.sin(_x / 2)) * _x;
  1437. };
  1438. com_ibm_rave_core_internal_math_Trigonometry.sinci = function(x) {
  1439. return (x != 0) ? x / Math.sin(x) : 1;
  1440. };
  1441. com_ibm_rave_core_internal_math_Trigonometry.ε = 1E-6;
  1442. com_ibm_rave_core_internal_math_Trigonometry.π = Math.PI;
  1443. com_ibm_rave_core_internal_math_Trigonometry.τ = 2 * 3.141592653589793;
  1444. com_ibm_rave_core_internal_math_Trigonometry.halfπ = 3.141592653589793 / 2;
  1445. com_ibm_rave_core_internal_math_Trigonometry.ε2 = 1.0E-6 * 1.0E-6;
  1446. com_ibm_rave_core_internal_math_Trigonometry.radians = 3.141592653589793 / 180;
  1447. com_ibm_rave_core_internal_math_Trigonometry.degrees = 180 / 3.141592653589793;
  1448. com_ibm_rave_core_internal_math_Trigonometry.τε = 6.283185307179586 - 1.0E-6;
  1449. // $source: com/ibm/rave/core/internal/scales/Ranger
  1450. /************************************************************************
  1451. ** IBM Confidential
  1452. **
  1453. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1454. **
  1455. ** (C) Copyright IBM Corp. 2017
  1456. **
  1457. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1458. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1459. ************************************************************************/
  1460. // GENERATED
  1461. var com_ibm_rave_core_internal_scales_Ranger = function(t, a, padding, outerPadding) {
  1462. this.t = t;
  1463. this.a = a;
  1464. this.padding = padding;
  1465. this.outerPadding = outerPadding;
  1466. };
  1467. // $source: com/ibm/rave/core/time/TimeFormatter
  1468. /************************************************************************
  1469. ** IBM Confidential
  1470. **
  1471. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1472. **
  1473. ** (C) Copyright IBM Corp. 2017
  1474. **
  1475. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1476. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1477. ************************************************************************/
  1478. // GENERATED
  1479. // $source: com/ibm/rave/core/internal/globalization/BidiStringDirection
  1480. /************************************************************************
  1481. ** IBM Confidential
  1482. **
  1483. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1484. **
  1485. ** (C) Copyright IBM Corp. 2017
  1486. **
  1487. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1488. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1489. ************************************************************************/
  1490. // GENERATED
  1491. /**
  1492. * Enum describing valid bidi string directions.
  1493. * @author jim
  1494. */
  1495. var com_ibm_rave_core_internal_globalization_BidiStringDirection = {
  1496. //constructor : function() {}
  1497. };
  1498. com_ibm_rave_core_internal_globalization_BidiStringDirection.parse = function(textDirection) {
  1499. var dir = textDirection;
  1500. if (dir != null) {
  1501. dir = textDirection.toLowerCase();
  1502. }
  1503. if ("ltr" == dir) {
  1504. return 0;
  1505. } else if ("rtl" == dir) {
  1506. return 1;
  1507. } else if ("auto" == dir) {
  1508. return 3;
  1509. }
  1510. return 4;
  1511. };
  1512. com_ibm_rave_core_internal_globalization_BidiStringDirection.toString = function(dir) {
  1513. switch (dir) {
  1514. case 0:
  1515. return "ltr";
  1516. case 1:
  1517. return "rtl";
  1518. case 3:
  1519. return "auto";
  1520. default:
  1521. return "ltr";
  1522. }
  1523. };
  1524. com_ibm_rave_core_internal_globalization_BidiStringDirection.LTR = 0;
  1525. com_ibm_rave_core_internal_globalization_BidiStringDirection.RTL = 1;
  1526. com_ibm_rave_core_internal_globalization_BidiStringDirection.AUTO = 3;
  1527. com_ibm_rave_core_internal_globalization_BidiStringDirection.NONE = 4;
  1528. com_ibm_rave_core_internal_globalization_BidiStringDirection.LTR_STRING = "ltr";
  1529. com_ibm_rave_core_internal_globalization_BidiStringDirection.RTL_STRING = "rtl";
  1530. com_ibm_rave_core_internal_globalization_BidiStringDirection.AUTO_STRING = "auto";
  1531. com_ibm_rave_core_internal_globalization_BidiStringDirection.UNKNOWN = -1;
  1532. // $source: com/ibm/rave/core/internal/nativeImpl/globalization/BidiProcess
  1533. /************************************************************************
  1534. ** IBM Confidential
  1535. **
  1536. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1537. **
  1538. ** (C) Copyright IBM Corp. 2014, 2015
  1539. **
  1540. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1541. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1542. ************************************************************************/
  1543. //@import com/ibm/rave/core/internal/globalization/BidiStringDirection (runtime)
  1544. /**
  1545. * Platform specific bidi string processing. Used to determine the directionality of strings based on their first "strong" character direction.
  1546. * Uses the dbidi (dojo bidi) library.
  1547. *
  1548. * @author jim
  1549. */
  1550. var com_ibm_rave_core_internal_nativeImpl_globalization_BidiProcess = {};
  1551. /**
  1552. * Determine the direction of our string using the first "strong" character type found.
  1553. * Parts of this code are from the dojo bidi project. https://github.com/ibm-js/dbidi/blob/master/LICENSE
  1554. *
  1555. * @param (String) string String to check
  1556. * @return (Number) BidiStringDirection enum value.
  1557. */
  1558. /** @expose */
  1559. com_ibm_rave_core_internal_nativeImpl_globalization_BidiProcess.determineDirection = function(string) {
  1560. var UBAT_L = 0; /* left to right */
  1561. var UBAT_R = 1; /* right to left */
  1562. var UBAT_EN = 2; /* European digit */
  1563. var UBAT_AN = 3; /* Arabic-Indic digit */
  1564. var UBAT_ON = 4; /* neutral */
  1565. var UBAT_B = 5; /* block separator */
  1566. var UBAT_S = 6; /* segment separator */
  1567. var UBAT_AL = 7; /* Arabic Letter */
  1568. var UBAT_WS = 8; /* white space */
  1569. var UBAT_CS = 9; /* common digit separator */
  1570. var UBAT_ES = 10; /* European digit separator */
  1571. var UBAT_ET = 11; /* European digit terminator */
  1572. var UBAT_NSM = 12; /* Non Spacing Mark */
  1573. var UBAT_LRE = 13; /* LRE */
  1574. var UBAT_RLE = 14; /* RLE */
  1575. var UBAT_PDF = 15; /* PDF */
  1576. var UBAT_LRO = 16; /* LRO */
  1577. var UBAT_RLO = 17; /* RLO */
  1578. var UBAT_BN = 18; /* Boundary Neutral */
  1579. var TYPES_NAMES = [ "UBAT_L", "UBAT_R", "UBAT_EN", "UBAT_AN", "UBAT_ON", "UBAT_B", "UBAT_S", "UBAT_AL", "UBAT_WS",
  1580. "UBAT_CS", "UBAT_ES", "UBAT_ET", "UBAT_NSM", "UBAT_LRE", "UBAT_RLE", "UBAT_PDF", "UBAT_LRO",
  1581. "UBAT_RLO", "UBAT_BN" ];
  1582. var TBBASE = 100;
  1583. var TB00 = TBBASE + 0;
  1584. var TB05 = TBBASE + 1;
  1585. var TB06 = TBBASE + 2;
  1586. var TB07 = TBBASE + 3;
  1587. var TB20 = TBBASE + 4;
  1588. var TBFB = TBBASE + 5;
  1589. var TBFE = TBBASE + 6;
  1590. var TBFF = TBBASE + 7;
  1591. var L = UBAT_L;
  1592. var R = UBAT_R;
  1593. var EN = UBAT_EN;
  1594. var AN = UBAT_AN;
  1595. var ON = UBAT_ON;
  1596. var B = UBAT_B;
  1597. var S = UBAT_S;
  1598. var AL = UBAT_AL;
  1599. var WS = UBAT_WS;
  1600. var CS = UBAT_CS;
  1601. var ES = UBAT_ES;
  1602. var ET = UBAT_ET;
  1603. var NSM = UBAT_NSM;
  1604. var LRE = UBAT_LRE;
  1605. var RLE = UBAT_RLE;
  1606. var PDF = UBAT_PDF;
  1607. var LRO = UBAT_LRO;
  1608. var RLO = UBAT_RLO;
  1609. var BN = UBAT_BN;
  1610. var MasterTable = [
  1611. /*******************************************************************************************************/
  1612. /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
  1613. /*******************************************************************************************************/
  1614. /*0-*/ TB00, L, L, L, L, TB05, TB06, TB07, R, L, L, L, L, L, L, L,
  1615. /*1-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1616. /*2-*/ TB20, ON, ON, ON, L, ON, L, ON, L, ON, ON, ON, L, L, ON, ON,
  1617. /*3-*/ L, L, L, L, L, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1618. /*4-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, L, L, ON,
  1619. /*5-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1620. /*6-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1621. /*7-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1622. /*8-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1623. /*9-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, L,
  1624. /*A-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, ON, ON, ON,
  1625. /*B-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1626. /*C-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1627. /*D-*/ ON, ON, ON, ON, ON, ON, ON, L, L, ON, ON, L, L, ON, ON, L,
  1628. /*E-*/ L, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1629. /*F-*/ ON, ON, ON, ON, ON, ON, ON, ON, L, L, L, TBFB, AL, AL, TBFE, TBFF
  1630. ];
  1631. var UnicodeTable = [
  1632. [ /* Table 00: Unicode 00xx */
  1633. /****************************************************************************************/
  1634. /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
  1635. /****************************************************************************************/
  1636. /*0-*/ BN, BN, BN, BN, BN, BN, BN, BN, BN, S, B, S, WS, B, BN, BN,
  1637. /*1-*/ BN, BN, BN, BN, BN, BN, BN, BN, BN, BN, BN, BN, B, B, B, S,
  1638. /*2-*/ WS, ON, ON, ET, ET, ET, ON, ON, ON, ON, ON, ES, CS, ES, CS, CS,
  1639. /*3-*/ EN, EN, EN, EN, EN, EN, EN, EN, EN, EN, CS, ON, ON, ON, ON, ON,
  1640. /*4-*/ ON, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1641. /*5-*/ L, L, L, L, L, L, L, L, L, L, L, ON, ON, ON, ON, ON,
  1642. /*6-*/ ON, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1643. /*7-*/ L, L, L, L, L, L, L, L, L, L, L, ON, ON, ON, ON, BN,
  1644. /*8-*/ BN, BN, BN, BN, BN, B, BN, BN, BN, BN, BN, BN, BN, BN, BN, BN,
  1645. /*9-*/ BN, BN, BN, BN, BN, BN, BN, BN, BN, BN, BN, BN, BN, BN, BN, BN,
  1646. /*A-*/ CS, ON, ET, ET, ET, ET, ON, ON, ON, ON, L, ON, ON, BN, ON, ON,
  1647. /*B-*/ ET, ET, EN, EN, ON, L, ON, ON, ON, EN, L, ON, ON, ON, ON, ON,
  1648. /*C-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1649. /*D-*/ L, L, L, L, L, L, L, ON, L, L, L, L, L, L, L, L,
  1650. /*E-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1651. /*F-*/ L, L, L, L, L, L, L, ON, L, L, L, L, L, L, L, L
  1652. ],
  1653. [ /* Table 01: Unicode 05xx */
  1654. /****************************************************************************************/
  1655. /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
  1656. /****************************************************************************************/
  1657. /*0-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1658. /*1-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1659. /*2-*/ L, L, L, L, L, L, L, L, ON, ON, ON, ON, ON, ON, ON, ON,
  1660. /*3-*/ ON, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1661. /*4-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1662. /*5-*/ L, L, L, L, L, L, L, ON, ON, L, L, L, L, L, L, L,
  1663. /*6-*/ ON, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1664. /*7-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1665. /*8-*/ L, L, L, L, L, L, L, L, ON, L, ON, ON, ON, ON, ON, ON,
  1666. /*9-*/ ON, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM,
  1667. /*A-*/ NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM,
  1668. /*B-*/ NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, R, NSM,
  1669. /*C-*/ R, NSM, NSM, R, NSM, NSM, R, NSM, ON, ON, ON, ON, ON, ON, ON, ON,
  1670. /*D-*/ R, R, R, R, R, R, R, R, R, R, R, R, R, R, R, R,
  1671. /*E-*/ R, R, R, R, R, R, R, R, R, R, R, ON, ON, ON, ON, ON,
  1672. /*F-*/ R, R, R, R, R, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON
  1673. ],
  1674. [ /* Table 02: Unicode 06xx */
  1675. /****************************************************************************************/
  1676. /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
  1677. /****************************************************************************************/
  1678. /*0-*/ AN, AN, AN, AN, ON, ON, ON, ON, AL, ET, ET, AL, CS, AL, ON, ON,
  1679. /*1-*/ NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, AL, ON, ON, AL, AL,
  1680. /*2-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1681. /*3-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1682. /*4-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, NSM, NSM, NSM, NSM, NSM,
  1683. /*5-*/ NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM,
  1684. /*6-*/ AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, ET, AN, AN, AL, AL, AL,
  1685. /*7-*/ NSM, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1686. /*8-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1687. /*9-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1688. /*A-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1689. /*B-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1690. /*C-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1691. /*D-*/ AL, AL, AL, AL, AL, AL, NSM, NSM, NSM, NSM, NSM, NSM, NSM, AN, ON, NSM,
  1692. /*E-*/ NSM, NSM, NSM, NSM, NSM, AL, AL, NSM, NSM, ON, NSM, NSM, NSM, NSM, AL, AL,
  1693. /*F-*/ EN, EN, EN, EN, EN, EN, EN, EN, EN, EN, AL, AL, AL, AL, AL, AL
  1694. ],
  1695. [ /* Table 03: Unicode 07xx */
  1696. /****************************************************************************************/
  1697. /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
  1698. /****************************************************************************************/
  1699. /*0-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, ON, AL,
  1700. /*1-*/ AL, NSM, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1701. /*2-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1702. /*3-*/ NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM,
  1703. /*4-*/ NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, ON, ON, AL, AL, AL,
  1704. /*5-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1705. /*6-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1706. /*7-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1707. /*8-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1708. /*9-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1709. /*A-*/ AL, AL, AL, AL, AL, AL, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM,
  1710. /*B-*/ NSM, AL, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1711. /*C-*/ R, R, R, R, R, R, R, R, R, R, R, R, R, R, R, R,
  1712. /*D-*/ R, R, R, R, R, R, R, R, R, R, R, R, R, R, R, R,
  1713. /*E-*/ R, R, R, R, R, R, R, R, R, R, R, NSM, NSM, NSM, NSM, NSM,
  1714. /*F-*/ NSM, NSM, NSM, NSM, R, R, ON, ON, ON, ON, R, ON, ON, ON, ON, ON
  1715. ],
  1716. [ /* Table 04: Unicode 20xx */
  1717. /****************************************************************************************/
  1718. /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
  1719. /****************************************************************************************/
  1720. /*0-*/ WS, WS, WS, WS, WS, WS, WS, WS, WS, WS, WS, BN, BN, BN, L, R,
  1721. /*1-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1722. /*2-*/ ON, ON, ON, ON, ON, ON, ON, ON, WS, B, LRE, RLE, PDF, LRO, RLO, CS,
  1723. /*3-*/ ET, ET, ET, ET, ET, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1724. /*4-*/ ON, ON, ON, ON, CS, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1725. /*5-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, WS,
  1726. /*6-*/ BN, BN, BN, BN, BN, ON, ON, ON, ON, ON, BN, BN, BN, BN, BN, BN,
  1727. /*7-*/ EN, L, ON, ON, EN, EN, EN, EN, EN, EN, ES, ES, ON, ON, ON, L,
  1728. /*8-*/ EN, EN, EN, EN, EN, EN, EN, EN, EN, EN, ES, ES, ON, ON, ON, ON,
  1729. /*9-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, ON, ON, ON,
  1730. /*A-*/ ET, ET, ET, ET, ET, ET, ET, ET, ET, ET, ET, ET, ET, ET, ET, ET,
  1731. /*B-*/ ET, ET, ET, ET, ET, ET, ET, ET, ET, ET, ON, ON, ON, ON, ON, ON,
  1732. /*C-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1733. /*D-*/ NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM,
  1734. /*E-*/ NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM,
  1735. /*F-*/ NSM, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON
  1736. ],
  1737. [ /* Table 05: Unicode FBxx */
  1738. /****************************************************************************************/
  1739. /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
  1740. /****************************************************************************************/
  1741. /*0-*/ L, L, L, L, L, L, L, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1742. /*1-*/ ON, ON, ON, L, L, L, L, L, ON, ON, ON, ON, ON, R, NSM, R,
  1743. /*2-*/ R, R, R, R, R, R, R, R, R, ES, R, R, R, R, R, R,
  1744. /*3-*/ R, R, R, R, R, R, R, ON, R, R, R, R, R, ON, R, ON,
  1745. /*4-*/ R, R, ON, R, R, ON, R, R, R, R, R, R, R, R, R, R,
  1746. /*5-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1747. /*6-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1748. /*7-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1749. /*8-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1750. /*9-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1751. /*A-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1752. /*B-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1753. /*C-*/ AL, AL, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1754. /*D-*/ ON, ON, ON, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1755. /*E-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1756. /*F-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL
  1757. ],
  1758. [ /* Table 06: Unicode FExx */
  1759. /****************************************************************************************/
  1760. /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
  1761. /****************************************************************************************/
  1762. /*0-*/ NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM, NSM,
  1763. /*1-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1764. /*2-*/ NSM, NSM, NSM, NSM, NSM, NSM, NSM, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1765. /*3-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1766. /*4-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1767. /*5-*/ CS, ON, CS, ON, ON, CS, ON, ON, ON, ON, ON, ON, ON, ON, ON, ET,
  1768. /*6-*/ ON, ON, ES, ES, ON, ON, ON, ON, ON, ET, ET, ON, ON, ON, ON, ON,
  1769. /*7-*/ AL, AL, AL, AL, AL, ON, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1770. /*8-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1771. /*9-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1772. /*A-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1773. /*B-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1774. /*C-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1775. /*D-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1776. /*E-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL,
  1777. /*F-*/ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, ON, ON, BN
  1778. ],
  1779. [ /* Table 07: Unicode FFxx */
  1780. /****************************************************************************************/
  1781. /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
  1782. /****************************************************************************************/
  1783. /*0-*/ ON, ON, ON, ET, ET, ET, ON, ON, ON, ON, ON, ES, CS, ES, CS, CS,
  1784. /*1-*/ EN, EN, EN, EN, EN, EN, EN, EN, EN, EN, CS, ON, ON, ON, ON, ON,
  1785. /*2-*/ ON, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1786. /*3-*/ L, L, L, L, L, L, L, L, L, L, L, ON, ON, ON, ON, ON,
  1787. /*4-*/ ON, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1788. /*5-*/ L, L, L, L, L, L, L, L, L, L, L, ON, ON, ON, ON, ON,
  1789. /*6-*/ ON, ON, ON, ON, ON, ON, L, L, L, L, L, L, L, L, L, L,
  1790. /*7-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1791. /*8-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1792. /*9-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1793. /*A-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
  1794. /*B-*/ L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, ON,
  1795. /*C-*/ ON, ON, L, L, L, L, L, L, ON, ON, L, L, L, L, L, L,
  1796. /*D-*/ ON, ON, L, L, L, L, L, L, ON, ON, L, L, L, ON, ON, ON,
  1797. /*E-*/ ET, ET, ON, ON, ON, ET, ET, ON, ON, ON, ON, ON, ON, ON, ON, ON,
  1798. /*F-*/ ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON
  1799. ]
  1800. ];
  1801. var directionality = checkContextual(string);
  1802. // if first STRONG character found
  1803. if (directionality == com_ibm_rave_core_internal_globalization_BidiStringDirection.LTR
  1804. || directionality == com_ibm_rave_core_internal_globalization_BidiStringDirection.RTL) {
  1805. return directionality;
  1806. }
  1807. return com_ibm_rave_core_internal_globalization_BidiStringDirection.UNKNOWN;
  1808. function checkContextual(text) {
  1809. // summary:
  1810. // Determine the base direction of a bidi text according
  1811. // to its first strong directional character.
  1812. // text:
  1813. // The text to check.
  1814. // returns: /*String*/
  1815. // "ltr" or "rtl" according to the first strong character.
  1816. // If there is no strong character, returns the value of the
  1817. // document dir property.
  1818. // tags:
  1819. // public
  1820. var dir = firstStrongDir(text);
  1821. if (!dir) {
  1822. dir = document.dir.toLowerCase();
  1823. if (dir !== "ltr" && dir !== "rtl") {
  1824. dir = "ltr";
  1825. }
  1826. }
  1827. var bidiDirection = com_ibm_rave_core_internal_globalization_BidiStringDirection.UNKNOWN;
  1828. switch (dir) {
  1829. case "ltr":
  1830. bidiDirection = com_ibm_rave_core_internal_globalization_BidiStringDirection.LTR;
  1831. break;
  1832. case "rtl":
  1833. bidiDirection = com_ibm_rave_core_internal_globalization_BidiStringDirection.RTL;
  1834. break;
  1835. default:
  1836. break;
  1837. }
  1838. return bidiDirection;
  1839. function firstStrongDir(/*String*/text) {
  1840. // summary:
  1841. // Return the first strong character direction
  1842. // text:
  1843. // The source string.
  1844. // description:
  1845. // Iterates over the text string, letter by letter starting from its beginning,
  1846. // searching for first "strong" character.
  1847. // Returns if strong character was found with the direction defined by this
  1848. // character, if no strong character was found returns an empty string.
  1849. // returns: String
  1850. // "ltr" - if the first strong character is Latin.
  1851. // "rtl" - if the first strong character is RTL directed character.
  1852. // "" - if the strong character wasn't found.
  1853. // tags:
  1854. // private
  1855. var type = null, uc = null, hi = null;
  1856. for (var i = 0; i < text.length; i++) {
  1857. uc = text.charAt(i).charCodeAt(0);
  1858. hi = MasterTable[uc >> 8];
  1859. type = hi < TBBASE ? hi : UnicodeTable[hi - TBBASE][uc & 0xFF];
  1860. if (type === UBAT_R || type === UBAT_AL) {
  1861. return "rtl";
  1862. }
  1863. if (type === UBAT_L) {
  1864. return "ltr";
  1865. }
  1866. if (type === UBAT_B) {
  1867. break;
  1868. }
  1869. }
  1870. return null;
  1871. }
  1872. };
  1873. };
  1874. // $source: com/ibm/rave/core/internal/nativeImpl/event/Event
  1875. /************************************************************************
  1876. ** IBM Confidential
  1877. **
  1878. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1879. **
  1880. ** (C) Copyright IBM Corp. 2014
  1881. **
  1882. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1883. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1884. ************************************************************************/
  1885. var com_ibm_rave_core_internal_nativeImpl_event_Event = rave_window(rave_document) ? typeof rave_window(rave_document).Event === "function"
  1886. ? function(type, canBubble, canCancel) {
  1887. return new Event(type, {
  1888. 'bubbles': canBubble || false,
  1889. 'cancelable': canCancel || false
  1890. });
  1891. }
  1892. //IE doesn't support Event constructor
  1893. : function(type, canBubble, canCancel) {
  1894. var e;
  1895. if (rave_document) {
  1896. e = rave_document.createEvent('Event');
  1897. e.initEvent(type, canBubble || false, canCancel || false);
  1898. }
  1899. return e;
  1900. }
  1901. // rave_window(rave_document) is undefined
  1902. : undefined;
  1903. // $source: com/ibm/rave/core/internal/svg/symbol/SymbolCreatorsConstants
  1904. /************************************************************************
  1905. ** IBM Confidential
  1906. **
  1907. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1908. **
  1909. ** (C) Copyright IBM Corp. 2017
  1910. **
  1911. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1912. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1913. ************************************************************************/
  1914. // GENERATED
  1915. /**
  1916. * constants needed by symbol creators
  1917. */
  1918. var com_ibm_rave_core_internal_svg_symbol_SymbolCreatorsConstants = {
  1919. };
  1920. com_ibm_rave_core_internal_svg_symbol_SymbolCreatorsConstants.r2_svg_symbolTan30 = Math.tan(30 * (3.141592653589793 / 180));
  1921. com_ibm_rave_core_internal_svg_symbol_SymbolCreatorsConstants.r2_svg_symbolSqrt3 = Math.sqrt(3);
  1922. // $source: com/ibm/rave/core/geo/InvertiblePointProjector
  1923. /************************************************************************
  1924. ** IBM Confidential
  1925. **
  1926. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1927. **
  1928. ** (C) Copyright IBM Corp. 2017
  1929. **
  1930. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1931. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1932. ************************************************************************/
  1933. // GENERATED
  1934. // $source: com/ibm/rave/core/internal/geo/ClipLineStreamListenerFactory
  1935. /************************************************************************
  1936. ** IBM Confidential
  1937. **
  1938. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1939. **
  1940. ** (C) Copyright IBM Corp. 2017
  1941. **
  1942. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1943. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1944. ************************************************************************/
  1945. // GENERATED
  1946. // $source: com/ibm/rave/core/nativeImpl/xhr/Xhr
  1947. /************************************************************************
  1948. ** IBM Confidential
  1949. **
  1950. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1951. **
  1952. ** (C) Copyright IBM Corp. 2014, 2015
  1953. **
  1954. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1955. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1956. ************************************************************************/
  1957. //@import com/ibm/rave/core/Rave (runtime)
  1958. var com_ibm_rave_core_nativeImpl_xhr_Xhr = (function() {
  1959. function rave_xhr(url, mimeType, response, callback) {
  1960. var rave = com_ibm_rave_core_Rave;
  1961. var xhr = {},
  1962. dispatch = rave.dispatch("beforesend", "progress", "load", "error"),
  1963. headers = {},
  1964. request = new XMLHttpRequest,
  1965. responseType = null;
  1966. // If IE does not support CORS, use XDomainRequest.
  1967. if (global.XDomainRequest && !("withCredentials" in request) && /^(http(s)?:)?\/\//.test(url)) {
  1968. request = new XDomainRequest;
  1969. }
  1970. "onload" in request ? request.onload = request.onerror = respond:
  1971. request.onreadystatechange = function() {
  1972. request.readyState > 3 && respond();
  1973. };
  1974. function respond() {
  1975. var status = request.status, result;
  1976. if (!status && hasResponse(request) || status >= 200 && status < 300 || status === 304) {
  1977. try {
  1978. result = response.call(xhr, request);
  1979. }
  1980. catch (e) {
  1981. dispatch["error"].call(xhr, e);
  1982. return;
  1983. }
  1984. dispatch["load"].call(xhr, result);
  1985. }
  1986. else {
  1987. dispatch["error"].call(xhr, request);
  1988. }
  1989. }
  1990. request.onprogress = function(event) {
  1991. var o = rave.event;
  1992. rave.event = event;
  1993. try {
  1994. dispatch["progress"].call(xhr, request);
  1995. }
  1996. finally {
  1997. rave.event = o;
  1998. }
  1999. };
  2000. /** @expose */
  2001. xhr.header = function(name, value) {
  2002. name = (name + "").toLowerCase();
  2003. if (arguments.length < 2) {
  2004. return headers[name];
  2005. }
  2006. if (value == null){
  2007. delete headers[name];
  2008. }
  2009. else {
  2010. headers[name] = value + "";
  2011. }
  2012. return xhr;
  2013. };
  2014. // If mimeType is non-null and no Accept header is set, a default is used.
  2015. /** @expose */
  2016. xhr.mimeType = function(value) {
  2017. if (!arguments.length) {
  2018. return mimeType;
  2019. }
  2020. mimeType = value == null ? null : value + "";
  2021. return xhr;
  2022. };
  2023. // Specifies what type the response value should take;
  2024. // for instance, arraybuffer, blob, document, or text.
  2025. /** @expose */
  2026. xhr.responseType = function(value) {
  2027. if (!arguments.length) {
  2028. return responseType;
  2029. }
  2030. responseType = value;
  2031. return xhr;
  2032. };
  2033. // Specify how to convert the response content to a specific type;
  2034. // changes the callback value on "load" events.
  2035. /** @expose */
  2036. xhr.response = function(value) {
  2037. response = value;
  2038. return xhr;
  2039. };
  2040. /** @expose */
  2041. xhr.get = function() {
  2042. return xhr.send.apply(xhr, ["get"].concat([].slice.call(arguments)));
  2043. };
  2044. /** @expose */
  2045. xhr.post = function() {
  2046. return xhr.send.apply(xhr, ["post"].concat([].slice.call(arguments)));
  2047. };
  2048. // If callback is non-null, it will be used for error and load events.
  2049. /** @expose */
  2050. xhr.send = function(method, data, callback) {
  2051. if (arguments.length === 2 && typeof data === "function") {
  2052. callback = data, data = null;
  2053. }
  2054. request.open(method, url, true);
  2055. if (mimeType != null && !("accept" in headers)) {
  2056. headers["accept"] = mimeType + ",*/*";
  2057. }
  2058. if (request.setRequestHeader) {
  2059. for (var name in headers) {
  2060. request.setRequestHeader(name, headers[name]);
  2061. }
  2062. }
  2063. if (mimeType != null && request.overrideMimeType) {
  2064. request.overrideMimeType(mimeType);
  2065. }
  2066. if (responseType != null) {
  2067. request.responseType = responseType;
  2068. }
  2069. if (callback != null) {
  2070. xhr.on("error", callback)
  2071. .on("load", function(request) {
  2072. callback(null, request);
  2073. });
  2074. }
  2075. dispatch["beforesend"].call(xhr, request);
  2076. request.send(data == null ? null : data);
  2077. return xhr;
  2078. };
  2079. /** @expose */
  2080. xhr.abort = function() {
  2081. request.abort();
  2082. return xhr;
  2083. };
  2084. // rebind
  2085. /** @expose */
  2086. xhr.on = function() {
  2087. dispatch.on.apply(dispatch, arguments);
  2088. return this;
  2089. };
  2090. return callback == null ? xhr : xhr.get(fixCallback(callback));
  2091. };
  2092. function fixCallback(callback) {
  2093. return callback.length === 1
  2094. ? function(error, request) {
  2095. callback(error == null ? request : null);
  2096. }
  2097. : callback;
  2098. }
  2099. function hasResponse(request) {
  2100. var type = request.responseType;
  2101. return type && type !== "text"
  2102. ? request.response // null on error
  2103. : request.responseText; // "" on error
  2104. }
  2105. var Xhr = function(response) {
  2106. return function(url, mimeType, callback) {
  2107. if (arguments.length === 2 && typeof mimeType === "function") {
  2108. callback = mimeType, mimeType = null;
  2109. }
  2110. return rave_xhr(url, mimeType, response, callback);
  2111. };
  2112. };
  2113. Xhr.create = rave_xhr;
  2114. return Xhr;
  2115. })();
  2116. // $source: com/ibm/rave/core/nativeImpl/Declare
  2117. /************************************************************************
  2118. ** IBM Confidential
  2119. **
  2120. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2121. **
  2122. ** (C) Copyright IBM Corp. 2013, 2015
  2123. **
  2124. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2125. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2126. ************************************************************************/
  2127. // @import com/ibm/rave/core/nativeImpl/Object
  2128. var com_ibm_rave_core_nativeImpl_Declare = (function() {
  2129. // must implement methods:
  2130. // - extend(Object prop, Array classes)
  2131. // - impelment(Array classes)
  2132. // - prototype.isInstanceOf(Object cls);
  2133. // use a faster more tailored version of declare
  2134. // utility constructor
  2135. var xConstructor = function(){};
  2136. var mixin = com_ibm_rave_core_nativeImpl_Object.mixin;
  2137. var subclass = {}.__proto__ ?
  2138. function(object, prototype) {
  2139. object.__proto__ = prototype;
  2140. } : mixin;
  2141. var bind;
  2142. if (Function.prototype.bind) {
  2143. bind = function(ctx, fnc) {
  2144. return fnc.bind(ctx);
  2145. };
  2146. } else {
  2147. bind = function(ctx, fnc) {
  2148. return function() {
  2149. return fnc.apply(ctx, arguments);
  2150. };
  2151. }
  2152. }
  2153. function createConstructor(prop, prototype, extend, fc, ctorReturnsValue, isArray) {
  2154. var cls;
  2155. // create the class constructor depending on whether delegation to
  2156. // a super and/or this constructor is necessary
  2157. var newConstructor = prop && prop.hasOwnProperty("constructor") ? prop.constructor : null;
  2158. var superConstructor = extend && extend !== com_ibm_rave_core_nativeImpl_Object ? prototype.constructor : null;
  2159. if (superConstructor && superConstructor._$defaultConstructor) {
  2160. // ignore calling an empty super constructor
  2161. superConstructor = null;
  2162. }
  2163. if (newConstructor) {
  2164. if (superConstructor) {
  2165. if (ctorReturnsValue) {
  2166. cls = function() {
  2167. var x = superConstructor.apply(this, arguments);
  2168. newConstructor.apply(x, arguments);
  2169. return x;
  2170. };
  2171. } else if (fc) {
  2172. cls = function() {
  2173. var x = fc.call();
  2174. mixin(x, this);
  2175. superConstructor.apply(x, arguments);
  2176. newConstructor.apply(x, arguments);
  2177. return x;
  2178. };
  2179. } else {
  2180. cls = function() {
  2181. superConstructor.apply(this, arguments);
  2182. newConstructor.apply(this, arguments);
  2183. };
  2184. }
  2185. } else {
  2186. if (fc) {
  2187. cls = function() {
  2188. var x = fc.call();
  2189. mixin(x, this);
  2190. newConstructor.apply(x, arguments);
  2191. return x;
  2192. };
  2193. } else if (isArray) {
  2194. cls = function() {
  2195. var x = [];
  2196. subclass(x, this);
  2197. newConstructor.apply(x, arguments);
  2198. return x;
  2199. };
  2200. } else {
  2201. cls = newConstructor;
  2202. }
  2203. }
  2204. } else {
  2205. if (superConstructor) {
  2206. if (ctorReturnsValue) {
  2207. cls = function() {
  2208. return superConstructor.apply(this, arguments);
  2209. };
  2210. } else if (fc) {
  2211. cls = function() {
  2212. var x = fc.call();
  2213. mixin(x, this);
  2214. superConstructor.apply(x, arguments);
  2215. return x;
  2216. };
  2217. } else {
  2218. cls = function() {
  2219. superConstructor.apply(this, arguments);
  2220. };
  2221. }
  2222. } else {
  2223. if (fc) {
  2224. cls = function() {
  2225. var x = fc.call();
  2226. mixin(x, this);
  2227. return x;
  2228. };
  2229. } else if (isArray) {
  2230. cls = function() {
  2231. var x = [];
  2232. subclass(x, this);
  2233. return x;
  2234. };
  2235. } else {
  2236. cls = function(){};
  2237. cls._$defaultConstructor = true;
  2238. }
  2239. }
  2240. }
  2241. return cls;
  2242. }
  2243. function initProperties(prop, prototype, realConstructor, ctorReturnsValue) {
  2244. function initBindings(ctx) {
  2245. for (var i = 0, len = bindingsArray.length; i < len; i++) {
  2246. ctx[bindingsArray[i]] = bind(ctx, bindings[bindingsArray[i]]);
  2247. }
  2248. }
  2249. var bindings, bindingsArray,
  2250. cls = realConstructor;
  2251. // copy properties
  2252. mixin(prototype, prop);
  2253. for (var i in prop) {
  2254. if (typeof prop[i] === "function") {
  2255. // bind functions
  2256. if (prop[i]._$bind) {
  2257. if (!bindings) {
  2258. bindings = {};
  2259. bindingsArray = [];
  2260. }
  2261. bindingsArray.push(i);
  2262. bindings[i] = prop[i];
  2263. }
  2264. }
  2265. }
  2266. if (bindings) {
  2267. // add another indirection to the constructor in order to bind functions
  2268. if (cls._$defaultConstructor) {
  2269. cls = function() {
  2270. initBindings(this);
  2271. };
  2272. } else {
  2273. if (ctorReturnsValue) {
  2274. cls = function() {
  2275. var x = realConstructor.apply(this, arguments);
  2276. initBindings(x);
  2277. return x;
  2278. };
  2279. } else {
  2280. cls = function() {
  2281. realConstructor.apply(this, arguments);
  2282. initBindings(this);
  2283. }
  2284. }
  2285. }
  2286. }
  2287. return cls;
  2288. }
  2289. // assign the declare function directly to the return value
  2290. var ret = function(_classes, _prop) {
  2291. var classes = _classes, prop = _prop;
  2292. var cls, extend, interfaces, f, fc, extendsFunctionClass, prototype;
  2293. // crack parameters
  2294. if (arguments.length == 1) {
  2295. // must be properties
  2296. prop = classes;
  2297. classes = undefined;
  2298. }
  2299. if (classes) {
  2300. // force classes to be an array
  2301. if (typeof classes !== "array" && !(classes instanceof Array)) {
  2302. classes = [classes];
  2303. }
  2304. if (classes.length == 0) {
  2305. extend = com_ibm_rave_core_nativeImpl_Object;
  2306. } else if (!classes[0]._$isInterface) {
  2307. extend = classes[0];
  2308. if (classes.length > 1) {
  2309. classes.shift();
  2310. interfaces = classes;
  2311. }
  2312. extendsFunctionClass = extend._$type == 2;
  2313. } else {
  2314. extend = com_ibm_rave_core_nativeImpl_Object;
  2315. interfaces = classes;
  2316. }
  2317. } else {
  2318. extend = com_ibm_rave_core_nativeImpl_Object;
  2319. }
  2320. if (!extendsFunctionClass) {
  2321. fc = prop && prop._$functionClassMethod;
  2322. }
  2323. var type = extend == Array ? 1 : extendsFunctionClass || fc ? 2 : +extend._$type;
  2324. if (type == 1) {
  2325. prototype = [];
  2326. if (extend != Array) {
  2327. // we need to mixin the super prototype into this prototype
  2328. mixin(prototype, extend.prototype);
  2329. } else {
  2330. extend = null;
  2331. }
  2332. } else {
  2333. // construct the prototype from the class to extend
  2334. xConstructor.prototype = extend.prototype;
  2335. prototype = new xConstructor;
  2336. xConstructor.prototype = null;
  2337. }
  2338. cls = createConstructor(prop, prototype, extend, fc, !fc && !!type, type == 1);
  2339. if (prop) {
  2340. cls = initProperties(prop, prototype, cls, !!type);
  2341. }
  2342. // assign the class to be the constructor
  2343. prototype.constructor = cls;
  2344. // assign meta data
  2345. //cls._$functionClass = !!fc;
  2346. cls._$type = type;
  2347. cls["_$superClass"] = extend;
  2348. cls._$interfaces = interfaces && interfaces.length > 0 ? interfaces : null;
  2349. // assign the prototype
  2350. cls.prototype = prototype;
  2351. return cls;
  2352. };
  2353. /*
  2354. * Like declare, but declares an interface. Interfaces are used for instanceof checking
  2355. * and can have static properties but there's no point in including interfaces in the prototype
  2356. * chain of a class as it will add time to constructor chaining.
  2357. */
  2358. /** @expose */
  2359. ret.implement = function(classes) {
  2360. // crack parameters
  2361. if (arguments.length == 1) {
  2362. // must be properties
  2363. classes = undefined;
  2364. }
  2365. // force classes to be an array
  2366. if (classes && typeof classes !== "array" && !(classes instanceof Array)) {
  2367. classes = [classes];
  2368. }
  2369. // assumes all classes are interfaces
  2370. var cls = function(){};
  2371. cls._$isInterface = true;
  2372. cls._$interfaces = classes && classes.length > 0 ? classes : null;
  2373. return cls;
  2374. };
  2375. /*
  2376. * Flags this function to be bound during object construction.
  2377. */
  2378. /** @expose */
  2379. ret.bind = function(fnc) {
  2380. fnc._$bind = 1;
  2381. return fnc;
  2382. };
  2383. // this instanceof check iterates over the implemented interfaces
  2384. /** @expose */
  2385. com_ibm_rave_core_nativeImpl_Object.prototype.isInstanceOf = function() {
  2386. var checkInterfaces = function(obj, cls) {
  2387. var interfaces = obj._$interfaces;
  2388. if (interfaces) {
  2389. for (var i = 0, len = interfaces.length; i < len; i++) {
  2390. if (interfaces[i] === cls || checkInterfaces(interfaces[i], cls)) {
  2391. return true;
  2392. }
  2393. }
  2394. }
  2395. if (obj["_$superClass"]) {
  2396. return checkInterfaces(obj["_$superClass"], cls);
  2397. }
  2398. return false;
  2399. };
  2400. return function(cls) {
  2401. if (this instanceof cls) {
  2402. return true;
  2403. }
  2404. return checkInterfaces(this.constructor, cls);
  2405. };
  2406. }();
  2407. return ret;
  2408. })();
  2409. // $source: com/ibm/rave/core/transform/Transform
  2410. /************************************************************************
  2411. ** IBM Confidential
  2412. **
  2413. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2414. **
  2415. ** (C) Copyright IBM Corp. 2017
  2416. **
  2417. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2418. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2419. ************************************************************************/
  2420. // GENERATED
  2421. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2422. //@import com/ibm/rave/core/transform/Matrix (runtime) // new
  2423. //@import com/ibm/rave/core/transform/MatrixUtil (runtime) // identity
  2424. /**
  2425. * Parses the given 2D affine transform string, as defined by SVG's transform attribute. The transform is then decomposed to a standard representation of translate, rotate, x-skew and scale. This behavior is standardized by CSS: see matrix decomposition for animation.
  2426. */
  2427. var com_ibm_rave_core_transform_Transform = rave_externs["Transform"] = com_ibm_rave_core_nativeImpl_Declare({
  2428. //m : null,
  2429. /** @expose */
  2430. translate : null,
  2431. /** @expose */
  2432. scale : null,
  2433. kx : 0,
  2434. ky : 0,
  2435. kz : 0,
  2436. /** @expose */
  2437. rotate : 0,
  2438. /** @expose */
  2439. skew : 0,
  2440. /** @expose */
  2441. constructor : function(m0) {
  2442. if (m0) {
  2443. this.m = new com_ibm_rave_core_transform_Matrix(m0.a, m0.b, m0.c, m0.d, m0.e, m0.f);
  2444. } else {
  2445. this.m = com_ibm_rave_core_transform_MatrixUtil.identity();
  2446. }
  2447. var r0 = [];
  2448. r0[0] = this.m.a;
  2449. r0[1] = this.m.b;
  2450. var r1 = [];
  2451. r1[0] = this.m.c;
  2452. r1[1] = this.m.d;
  2453. this.kx = this.transformNormalize(r0);
  2454. this.kz = this.transformDot(r0, r1);
  2455. this.ky = this.transformNormalize(this.transformCombine(r1, r0, -this.kz));
  2456. if (this.m.a * this.m.d < this.m.c * this.m.b) {
  2457. this.m.a *= -1;
  2458. this.m.b *= -1;
  2459. this.kx *= -1;
  2460. this.kz *= -1;
  2461. }
  2462. this.translate = this.getTranslation();
  2463. this.rotate = this.getRotation();
  2464. this.skew = this.getSkew();
  2465. this.scale = this.getScale();
  2466. },
  2467. /**
  2468. * Returns the rotation angle θ of this transform, in degrees.
  2469. */
  2470. getRotation : function() {
  2471. var rotateResult;
  2472. if (this.kx != 0) {
  2473. rotateResult = Math.atan2(this.m.b, this.m.a);
  2474. } else {
  2475. rotateResult = Math.atan2(-this.m.c, this.m.d);
  2476. }
  2477. return rotateResult * 57.29577951308232;
  2478. },
  2479. /**
  2480. * Returns the [dx, dy] translation of this transform, as a two-element array in local coordinates (typically pixels).
  2481. */
  2482. getTranslation : function() {
  2483. return [this.m.e, this.m.f];
  2484. },
  2485. /**
  2486. * Returns the [kx, ky] scale of this transform, as a two-element array.
  2487. */
  2488. getScale : function() {
  2489. var list = [];
  2490. list[0] = this.kx;
  2491. list[1] = this.ky;
  2492. return list;
  2493. },
  2494. /**
  2495. * Returns the x-skew φ of this transform, in degrees.
  2496. */
  2497. getSkew : function() {
  2498. var skewResult;
  2499. if (this.ky != 0) {
  2500. skewResult = Math.atan2(this.kz, this.ky) * 57.29577951308232;
  2501. } else {
  2502. skewResult = 0.0;
  2503. }
  2504. return skewResult;
  2505. },
  2506. /**
  2507. * Returns a string representation of this transform, in the form "translate(dx,dy)rotate(θ)skewX(φ)scale(kx,ky)".
  2508. */
  2509. /** @expose */
  2510. toString : function() {
  2511. return "translate(" + this.translate[0] + "," + this.translate[1] + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale[0] + "," + this.scale[1] + ")";
  2512. },
  2513. /**
  2514. * Dot product of the passed in arrays
  2515. * @param (double[]) a
  2516. * @param (double[]) b
  2517. * @return (double)
  2518. */
  2519. transformDot : function(a, b) {
  2520. return a[0] * b[0] + a[1] * b[1];
  2521. },
  2522. /**
  2523. * Normalize the passed in array
  2524. * @param (double[]) r
  2525. * @return (double)
  2526. */
  2527. transformNormalize : function(r) {
  2528. var k = Math.sqrt(this.transformDot(r, r));
  2529. if (k != 0) {
  2530. r[0] /= k;
  2531. r[1] /= k;
  2532. }
  2533. return k;
  2534. },
  2535. /**
  2536. * @param (double[]) a Contains the 'a' and 'b' values from the passed in Matrix
  2537. * @param (double[]) b Contains the 'c' and 'd' values from the passed in Matrix
  2538. * @param (double) k Negative kz value (result from transformDot of a[] and b[] params)
  2539. * @return (double[])
  2540. */
  2541. transformCombine : function(a, b, k) {
  2542. a[0] += k * b[0];
  2543. a[1] += k * b[1];
  2544. return a;
  2545. }
  2546. });
  2547. // $source: com/ibm/rave/core/transform/Matrix
  2548. /************************************************************************
  2549. ** IBM Confidential
  2550. **
  2551. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2552. **
  2553. ** (C) Copyright IBM Corp. 2017
  2554. **
  2555. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2556. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2557. ************************************************************************/
  2558. // GENERATED
  2559. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2560. /**
  2561. * A matrix transform representation. Mimics an SVGMatrix and must only implement public methods in that interface. <pre> [ a b e ] [ x ] [ a * x + b * y + e ] [ c d f ] [ y ] = [ c * x + d * y + f ] [ 0 0 1 ] [ 1 ] [ 1 ] </pre>
  2562. */
  2563. var com_ibm_rave_core_transform_Matrix = rave_externs["Matrix"] = com_ibm_rave_core_nativeImpl_Declare({
  2564. /** @expose */
  2565. a : 0,
  2566. /** @expose */
  2567. b : 0,
  2568. /** @expose */
  2569. c : 0,
  2570. /** @expose */
  2571. d : 0,
  2572. /** @expose */
  2573. e : 0,
  2574. /** @expose */
  2575. f : 0,
  2576. /** @expose */
  2577. constructor : function(a, b, c, d, e, f) {
  2578. this.a = a;
  2579. this.b = b;
  2580. this.c = c;
  2581. this.d = d;
  2582. this.e = e;
  2583. this.f = f;
  2584. },
  2585. /**
  2586. * Multiply this matrix with another matrix. Returns new instance.
  2587. * @param (com.ibm.rave.core.transform.Matrix) matrix Matrix to multiply this matrix with.
  2588. * @return (com.ibm.rave.core.transform.Matrix) New matrix that has been multiplied.
  2589. */
  2590. /** @expose */
  2591. multiply : function(matrix) {
  2592. var a1 = matrix.a * this.a + matrix.b * this.c;
  2593. var b1 = matrix.a * this.b + matrix.b * this.d;
  2594. var c1 = matrix.c * this.a + matrix.d * this.c;
  2595. var d1 = matrix.c * this.b + matrix.d * this.d;
  2596. var e1 = matrix.e * this.a + matrix.f * this.c + this.e;
  2597. var f1 = matrix.e * this.b + matrix.f * this.d + this.f;
  2598. return new com_ibm_rave_core_transform_Matrix(a1, b1, c1, d1, e1, f1);
  2599. },
  2600. /**
  2601. * Inverse this matrix. If this matrix is not invertible, returns the identity matrix.
  2602. * @return (com.ibm.rave.core.transform.Matrix) New matrix representing an inverted version of this one.
  2603. */
  2604. /** @expose */
  2605. inverse : function() {
  2606. var determinant = this.a * this.d - this.b * this.c;
  2607. if (determinant == 0) {
  2608. return com_ibm_rave_core_transform_Matrix.identity();
  2609. }
  2610. var a1 = this.d / determinant;
  2611. var b1 = -this.b / determinant;
  2612. var c1 = -this.c / determinant;
  2613. var d1 = this.a / determinant;
  2614. var e1 = (this.c * this.f - this.d * this.e) / determinant;
  2615. var f1 = (this.b * this.e - this.a * this.f) / determinant;
  2616. return new com_ibm_rave_core_transform_Matrix(a1, b1, c1, d1, e1, f1);
  2617. },
  2618. /**
  2619. * Translate this matrix by the points x and y.
  2620. * @param (double) x Horizontal point to translate (move) this matrix.
  2621. * @param (double) y Vertical point to translate (move) this matrix.
  2622. * @return (com.ibm.rave.core.transform.Matrix) New matrix with the translate transform applied.
  2623. */
  2624. /** @expose */
  2625. translate : function(x, y) {
  2626. var e1 = (x * this.a + y * this.c) + this.e;
  2627. var f1 = (x * this.b + y * this.d) + this.f;
  2628. return new com_ibm_rave_core_transform_Matrix(this.a, this.b, this.c, this.d, e1, f1);
  2629. },
  2630. /**
  2631. * Scale this transform by scaleFactor. Applies uniformly along x and y.
  2632. * @param (double) scaleFactor Scale factor to apply to both dimensions.
  2633. * @return (com.ibm.rave.core.transform.Matrix) New matrix with scale applied.
  2634. */
  2635. /** @expose */
  2636. scale : function(scaleFactor) {
  2637. return this.scaleNonUniform(scaleFactor, scaleFactor);
  2638. },
  2639. /**
  2640. * Scale this transform using two different scale factors - one for the x dimension and one for the y.
  2641. * @param (double) scaleFactorX X dimension transform scale factor.
  2642. * @param (double) scaleFactorY Y dimension transform scale factor.
  2643. * @return (com.ibm.rave.core.transform.Matrix) This matrix with non-uniform scales applied.
  2644. */
  2645. /** @expose */
  2646. scaleNonUniform : function(scaleFactorX, scaleFactorY) {
  2647. var a1 = this.a * scaleFactorX;
  2648. var b1 = this.b * scaleFactorX;
  2649. var c1 = this.c * scaleFactorY;
  2650. var d1 = this.d * scaleFactorY;
  2651. return new com_ibm_rave_core_transform_Matrix(a1, b1, c1, d1, this.e, this.f);
  2652. },
  2653. /**
  2654. * Apply a rotate transform to this matrix by a number of degrees.
  2655. * @param (double) angle The number of degrees to rotate this matrix by. May be negative.
  2656. * @return (com.ibm.rave.core.transform.Matrix) New matrix with a rotate transform applied.
  2657. */
  2658. rotate$0 : function(angle) {
  2659. var rads = com_ibm_rave_core_transform_Matrix.degreesToRadians(angle);
  2660. var sin = Math.sin(rads);
  2661. var cos = Math.cos(rads);
  2662. return this.multiply(new com_ibm_rave_core_transform_Matrix(cos, sin, -sin, cos, 0, 0));
  2663. },
  2664. rotate$1 : function(angle, originX, originY) {
  2665. return this.translate(originX, originY).rotate$0(angle).translate(-originX, -originY);
  2666. },
  2667. /**
  2668. * 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
  2669. * @param (double) x The coordinate point x to get the angle from.
  2670. * @param (double) y The coordinate point x to get the angle from.
  2671. * @return (com.ibm.rave.core.transform.Matrix) New matrix rotated the number of degrees based on atan2(y,x)
  2672. */
  2673. /** @expose */
  2674. rotateFromVector : function(x, y) {
  2675. return this.rotate(com_ibm_rave_core_transform_Matrix.radiansToDegrees(Math.atan2(y, x)));
  2676. },
  2677. /**
  2678. * Apply a 'mirrored' horizontal flip on this transform matrix and return it.
  2679. * @return (com.ibm.rave.core.transform.Matrix) New matrix with a (-1,1) scale applied.
  2680. */
  2681. /** @expose */
  2682. flipX : function() {
  2683. return this.scaleNonUniform(-1, 1);
  2684. },
  2685. /**
  2686. * Apply a 'mirrored' vertical flip on this transform matrix and return it.
  2687. * @return (com.ibm.rave.core.transform.Matrix) New matrix with a (1,-1) scale applied.
  2688. */
  2689. /** @expose */
  2690. flipY : function() {
  2691. return this.scaleNonUniform(1, -1);
  2692. },
  2693. /**
  2694. * Skew this transform horizontally by an angle and return the resulting transform.
  2695. * @param (double) angle The angle by which to skew horizontally.
  2696. * @return (com.ibm.rave.core.transform.Matrix) New matrix with horizontal skew applied.
  2697. */
  2698. /** @expose */
  2699. skewX : function(angle) {
  2700. return this.skew(angle, 0);
  2701. },
  2702. /**
  2703. * Skew this transform vertically by an angle and return the resulting transform.
  2704. * @param (double) angle The angle by which to skew vertically.
  2705. * @return (com.ibm.rave.core.transform.Matrix) This matrix with vertical skew applied.
  2706. */
  2707. /** @expose */
  2708. skewY : function(angle) {
  2709. return this.skew(0, angle);
  2710. },
  2711. /**
  2712. * 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.
  2713. * @param (double) horizontalAngle The angle by which to skew horizontally.
  2714. * @param (double) verticalAngle The angle by which to skew vertically.
  2715. * @return (com.ibm.rave.core.transform.Matrix) This matrix with skew applied.
  2716. */
  2717. skew : function(horizontalAngle, verticalAngle) {
  2718. var newMatrix = com_ibm_rave_core_transform_Matrix.identity();
  2719. newMatrix.c = Math.tan(com_ibm_rave_core_transform_Matrix.degreesToRadians(horizontalAngle));
  2720. newMatrix.b = Math.tan(com_ibm_rave_core_transform_Matrix.degreesToRadians(verticalAngle));
  2721. return this.multiply(newMatrix);
  2722. },
  2723. /** @expose */
  2724. toString : function() {
  2725. return "matrix(" + this.a + ',' + this.b + ',' + this.c + ',' + this.d + ',' + this.e + ',' + this.f + ')';
  2726. },
  2727. /** @expose */
  2728. rotate : function(a0, a1, a2) {
  2729. var args = arguments;
  2730. if (args.length == 1) {
  2731. return this.rotate$0(a0);
  2732. }
  2733. return this.rotate$1(a0, a1, a2);
  2734. }
  2735. });
  2736. /**
  2737. * Return the identity matrix of (1,0,0,1,0,0);
  2738. * @return (com.ibm.rave.core.transform.Matrix) New instance of an identity matrix.
  2739. */
  2740. com_ibm_rave_core_transform_Matrix.identity = function() {
  2741. return new com_ibm_rave_core_transform_Matrix(1, 0, 0, 1, 0, 0);
  2742. };
  2743. com_ibm_rave_core_transform_Matrix.radiansToDegrees = function(rads) {
  2744. return rads * 180 / Math.PI;
  2745. };
  2746. com_ibm_rave_core_transform_Matrix.degreesToRadians = function(angle) {
  2747. return angle * Math.PI / 180;
  2748. };
  2749. // $source: com/ibm/rave/core/geom/PointStruct
  2750. /************************************************************************
  2751. ** IBM Confidential
  2752. **
  2753. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2754. **
  2755. ** (C) Copyright IBM Corp. 2017
  2756. **
  2757. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2758. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2759. ************************************************************************/
  2760. // GENERATED
  2761. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2762. var com_ibm_rave_core_geom_PointStruct = rave_externs["PointStruct"] = com_ibm_rave_core_nativeImpl_Declare({
  2763. /** @expose */
  2764. x : 0,
  2765. /** @expose */
  2766. y : 0,
  2767. /** @expose */
  2768. constructor : function(x, y) {
  2769. this.x = x;
  2770. this.y = y;
  2771. }
  2772. });
  2773. // $source: com/ibm/rave/core/geom/RectStruct
  2774. /************************************************************************
  2775. ** IBM Confidential
  2776. **
  2777. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2778. **
  2779. ** (C) Copyright IBM Corp. 2017
  2780. **
  2781. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2782. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2783. ************************************************************************/
  2784. // GENERATED
  2785. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2786. var com_ibm_rave_core_geom_RectStruct = rave_externs["RectStruct"] = com_ibm_rave_core_nativeImpl_Declare({
  2787. /** @expose */
  2788. x : 0,
  2789. /** @expose */
  2790. y : 0,
  2791. /** @expose */
  2792. width : 0,
  2793. /** @expose */
  2794. height : 0,
  2795. /** @expose */
  2796. constructor : function(x, y, width, height) {
  2797. this.x = x;
  2798. this.y = y;
  2799. this.width = width;
  2800. this.height = height;
  2801. }
  2802. });
  2803. // $source: com/ibm/rave/core/transform/MatrixUtil
  2804. /************************************************************************
  2805. ** IBM Confidential
  2806. **
  2807. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2808. **
  2809. ** (C) Copyright IBM Corp. 2017
  2810. **
  2811. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2812. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2813. ************************************************************************/
  2814. // GENERATED
  2815. //@import com/ibm/rave/core/geom/PointStruct (static) // new
  2816. //@import com/ibm/rave/core/geom/RectStruct (static) // new
  2817. //@import com/ibm/rave/core/transform/Matrix (static) // new
  2818. /**
  2819. * Helper utilities for matrix transforms. Anything not in the SVGMatrix interface should be made a helper here.
  2820. */
  2821. var com_ibm_rave_core_transform_MatrixUtil = rave_externs["MatrixUtil"] = {
  2822. //constructor : function() {}
  2823. };
  2824. /**
  2825. * Perform matrix multiplication on a set of points where odd values map to X coordinates and even values map to Y coordinates. Modifies points in place.
  2826. * @param (double[]) points The array of points to multiply.
  2827. * @param (com.ibm.rave.core.transform.Matrix) matrix The matrix to apply.
  2828. */
  2829. /** @expose */
  2830. com_ibm_rave_core_transform_MatrixUtil.mapPoints = function(points, matrix) {
  2831. var x, y;
  2832. for (var i = 0, len = points.length; i < len; i += 2) {
  2833. x = com_ibm_rave_core_transform_MatrixUtil.multiplyX(matrix, points[i], points[i + 1]);
  2834. y = com_ibm_rave_core_transform_MatrixUtil.multiplyY(matrix, points[i], points[i + 1]);
  2835. points[i] = x;
  2836. points[i + 1] = y;
  2837. }
  2838. };
  2839. /**
  2840. * Internal method to create a new matrix object.
  2841. * @param (double) a
  2842. * @param (double) b
  2843. * @param (double) c
  2844. * @param (double) d
  2845. * @param (double) e
  2846. * @param (double) f
  2847. * @return (com.ibm.rave.core.transform.Matrix) a new Matrix
  2848. */
  2849. /** @expose */
  2850. com_ibm_rave_core_transform_MatrixUtil.create = function(a, b, c, d, e, f) {
  2851. var matrix = com_ibm_rave_core_transform_MatrixUtil.identity();
  2852. matrix.a = a;
  2853. matrix.b = b;
  2854. matrix.c = c;
  2855. matrix.d = d;
  2856. matrix.e = e;
  2857. matrix.f = f;
  2858. return matrix;
  2859. };
  2860. /**
  2861. * Transform a point by this transform.
  2862. * @param (com.ibm.rave.core.geom.PointStruct) point Point to transform
  2863. * @param (com.ibm.rave.core.transform.Matrix) matrix Matrix to combine this point with.
  2864. * @return (com.ibm.rave.core.geom.PointStruct) new instance of a point that has been transformed.
  2865. */
  2866. com_ibm_rave_core_transform_MatrixUtil.transformPoint = function(point, matrix) {
  2867. var x = com_ibm_rave_core_transform_MatrixUtil.multiplyX(matrix, point.x, point.y);
  2868. var y = com_ibm_rave_core_transform_MatrixUtil.multiplyY(matrix, point.x, point.y);
  2869. return new com_ibm_rave_core_geom_PointStruct(x, y);
  2870. };
  2871. com_ibm_rave_core_transform_MatrixUtil.multiplyX = function(matrix, x, y) {
  2872. return x * matrix.a + y * matrix.c + matrix.e;
  2873. };
  2874. com_ibm_rave_core_transform_MatrixUtil.multiplyY = function(matrix, x, y) {
  2875. return x * matrix.b + y * matrix.d + matrix.f;
  2876. };
  2877. /**
  2878. * Transform the four corners of a rectangle and extend the original bounds so they encapsulate the transformed rect. Returns a new RectStruct.
  2879. * @param (com.ibm.rave.core.geom.RectStruct) rect Rectangle to transform.
  2880. * @param (com.ibm.rave.core.transform.Matrix) matrix Matrix to apply to rectangle transform.
  2881. * @return (com.ibm.rave.core.geom.RectStruct) New RectStruct with the new bounds encapsulating the transformed rect.
  2882. */
  2883. /** @expose */
  2884. com_ibm_rave_core_transform_MatrixUtil.transformBounds = function(rect, matrix) {
  2885. var minX = Infinity;
  2886. var minY = Infinity;
  2887. var maxX = -Infinity;
  2888. var maxY = -Infinity;
  2889. for (var __i_enFor0 = 0, __exp_enFor0 = com_ibm_rave_core_transform_MatrixUtil.transformCorners(rect, matrix), __len_enFor0 = __exp_enFor0.length;
  2890. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2891. var point = __exp_enFor0[__i_enFor0];
  2892. minX = Math.min(minX, point.x);
  2893. maxX = Math.max(maxX, point.x);
  2894. minY = Math.min(minY, point.y);
  2895. maxY = Math.max(maxY, point.y);
  2896. }
  2897. return new com_ibm_rave_core_geom_RectStruct(minX, minY, maxX - minX, maxY - minY);
  2898. };
  2899. /**
  2900. * Transform the four corners of a RectStruct based on a transform matrix. Returns new RaveRect.
  2901. * @param (com.ibm.rave.core.geom.RectStruct) rect Rectangle to transform
  2902. * @param (com.ibm.rave.core.transform.Matrix) matrix Matrix to combine this rect with.
  2903. * @return (Array) List of 4 corner points that have been transformed.
  2904. */
  2905. com_ibm_rave_core_transform_MatrixUtil.transformCorners = function(rect, matrix) {
  2906. var corners = [];
  2907. corners.push(new com_ibm_rave_core_geom_PointStruct(rect.x, rect.y));
  2908. corners.push(new com_ibm_rave_core_geom_PointStruct(rect.x + rect.width, rect.y));
  2909. corners.push(new com_ibm_rave_core_geom_PointStruct(rect.x, rect.y + rect.height));
  2910. corners.push(new com_ibm_rave_core_geom_PointStruct(rect.x + rect.width, rect.y + rect.height));
  2911. return com_ibm_rave_core_transform_MatrixUtil.transformPoints(corners, matrix);
  2912. };
  2913. com_ibm_rave_core_transform_MatrixUtil.transformPoints = function(points, matrix) {
  2914. var transformedPoints = [];
  2915. for (var __i_enFor0 = 0, __exp_enFor0 = points, __len_enFor0 = __exp_enFor0.length;
  2916. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2917. var point = __exp_enFor0[__i_enFor0];
  2918. transformedPoints.push(com_ibm_rave_core_transform_MatrixUtil.transformPoint(point, matrix));
  2919. }
  2920. return transformedPoints;
  2921. };
  2922. /**
  2923. * Create a an identity (initial) matrix.
  2924. * @return (com.ibm.rave.core.transform.Matrix) identity matrix
  2925. */
  2926. /** @expose */
  2927. com_ibm_rave_core_transform_MatrixUtil.identity = function() {
  2928. return new com_ibm_rave_core_transform_Matrix(1, 0, 0, 1, 0, 0);
  2929. };
  2930. /**
  2931. * Return a matrix as a 6 part string suitable for adding to a transform attribute or style.
  2932. * @param (com.ibm.rave.core.transform.Matrix) matrix
  2933. * @return (String) String representation of this matrix as a CSS matrix. ie the identity matrix would return <code>"matrix(1,0,0,1,0,0)"</code>.
  2934. */
  2935. /** @expose */
  2936. com_ibm_rave_core_transform_MatrixUtil.matrixToString = function(matrix) {
  2937. return "matrix(" + matrix.a + ',' + matrix.b + ',' + matrix.c + ',' + matrix.d + ',' + matrix.e + ',' + matrix.f + ')';
  2938. };
  2939. /**
  2940. * Checks if the given matrix is an identity matrix.
  2941. * @param (com.ibm.rave.core.transform.Matrix) m the matrix to check
  2942. * @return (boolean) <code>true</code> if the given matrix is an identity matrix, <code>false</code> otherwise
  2943. */
  2944. /** @expose */
  2945. com_ibm_rave_core_transform_MatrixUtil.isIdentityMatrix = function(m) {
  2946. return m.a == 1 && m.b == 0 && m.c == 0 && m.d == 1 && m.e == 0 && m.f == 0;
  2947. };
  2948. // $source: com/ibm/rave/core/context/RaveContext
  2949. /************************************************************************
  2950. ** IBM Confidential
  2951. **
  2952. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2953. **
  2954. ** (C) Copyright IBM Corp. 2017
  2955. **
  2956. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2957. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2958. ************************************************************************/
  2959. // GENERATED
  2960. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2961. /**
  2962. * A class that acts as a (static) data holder for any rave object. Added to support rave image service
  2963. */
  2964. var com_ibm_rave_core_context_RaveContext = rave_externs["RaveContext"] = com_ibm_rave_core_nativeImpl_Declare({
  2965. //dataMap : null,
  2966. constructor : function() {
  2967. this.dataMap = {};
  2968. },
  2969. /**
  2970. * Gets a data object
  2971. * @param (String) key the key associated with the data to retrieve
  2972. * @return (Object) the data object
  2973. */
  2974. /** @expose */
  2975. getData : function(key) {
  2976. return this.dataMap[key];
  2977. },
  2978. /**
  2979. * Adds a data object to this Rave context
  2980. * @param (String) key the key to associate with the stored data
  2981. * @param (Object) data the data object to store
  2982. */
  2983. /** @expose */
  2984. putData : function(key, data) {
  2985. this.dataMap[key] = data;
  2986. },
  2987. /**
  2988. * Remove a stored data object
  2989. * @param (String) key the key associated with the to-be-removed data object
  2990. */
  2991. /** @expose */
  2992. removeData : function(key) {
  2993. delete this.dataMap[key];
  2994. },
  2995. /**
  2996. * Returns whether or not this key is associated with a stored data object
  2997. * @param (String) key the key to use to check
  2998. * @return (boolean) true if this key is associated with a stored data object, false otherwise
  2999. */
  3000. /** @expose */
  3001. containsData : function(key) {
  3002. return this.dataMap.hasOwnProperty(key);
  3003. }
  3004. });
  3005. // $source: com/ibm/rave/core/context/RaveContextManager
  3006. /************************************************************************
  3007. ** IBM Confidential
  3008. **
  3009. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3010. **
  3011. ** (C) Copyright IBM Corp. 2017
  3012. **
  3013. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3014. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3015. ************************************************************************/
  3016. // GENERATED
  3017. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  3018. //@import com/ibm/rave/core/context/RaveContext (static) // new
  3019. /**
  3020. * A class that manages RaveContext: it creates and provides access to it
  3021. */
  3022. var com_ibm_rave_core_context_RaveContextManager = rave_externs["RaveContextManager"] = com_ibm_rave_core_nativeImpl_Declare({
  3023. /**
  3024. */
  3025. /** @expose */
  3026. constructor : function() {},
  3027. /**
  3028. * Gets the current Rave context object
  3029. * @return (com.ibm.rave.core.context.RaveContext) the relevant RaveContext object
  3030. */
  3031. /** @expose */
  3032. getRaveContext : function() {
  3033. return com_ibm_rave_core_context_RaveContextManager.context;
  3034. }
  3035. });
  3036. /** @expose */
  3037. com_ibm_rave_core_context_RaveContextManager.INSTANCE = new com_ibm_rave_core_context_RaveContextManager();
  3038. com_ibm_rave_core_context_RaveContextManager.context = new com_ibm_rave_core_context_RaveContext();
  3039. // $source: com/ibm/rave/core/internal/util/NamespaceUtil
  3040. /************************************************************************
  3041. ** IBM Confidential
  3042. **
  3043. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3044. **
  3045. ** (C) Copyright IBM Corp. 2017
  3046. **
  3047. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3048. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3049. ************************************************************************/
  3050. // GENERATED
  3051. //@import com/ibm/rave/core/context/RaveContextManager (static) // RaveContextManager
  3052. var com_ibm_rave_core_internal_util_NamespaceUtil = {
  3053. };
  3054. com_ibm_rave_core_internal_util_NamespaceUtil.getNamespaces = function() {
  3055. var namespaces = com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData(com_ibm_rave_core_internal_util_NamespaceUtil.NAMESPACES_KEY);
  3056. if (!namespaces) {
  3057. namespaces = com_ibm_rave_core_internal_util_NamespaceUtil.initialize_NAMESPACES();
  3058. com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().putData(com_ibm_rave_core_internal_util_NamespaceUtil.NAMESPACES_KEY, namespaces);
  3059. }
  3060. return namespaces;
  3061. };
  3062. com_ibm_rave_core_internal_util_NamespaceUtil.initialize_NAMESPACES = function() {
  3063. var namespaces = {};
  3064. namespaces["svg"] = "http://www.w3.org/2000/svg";
  3065. namespaces["xhtml"] = "http://www.w3.org/1999/xhtml";
  3066. namespaces["xlink"] = "http://www.w3.org/1999/xlink";
  3067. namespaces["xml"] = "http://www.w3.org/XML/1998/namespace";
  3068. namespaces["xmlns"] = "http://www.w3.org/2000/xmlns/";
  3069. return namespaces;
  3070. };
  3071. com_ibm_rave_core_internal_util_NamespaceUtil.getQName = function(name) {
  3072. var _name = name;
  3073. var idx = _name.indexOf(":");
  3074. var prefix = _name;
  3075. if (idx >= 0) {
  3076. prefix = _name.substring(0, idx);
  3077. _name = _name.substring(idx + 1);
  3078. }
  3079. var qname = {};
  3080. qname["local"] = _name;
  3081. var namespaces = com_ibm_rave_core_internal_util_NamespaceUtil.getNamespaces();
  3082. if (namespaces.hasOwnProperty(prefix)) {
  3083. qname["space"] = namespaces[prefix];
  3084. }
  3085. return qname;
  3086. };
  3087. com_ibm_rave_core_internal_util_NamespaceUtil.NAMESPACES_KEY = "NAMESPACES_KEY";
  3088. // $source: com/ibm/rave/core/util/Namespace
  3089. /************************************************************************
  3090. ** IBM Confidential
  3091. **
  3092. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3093. **
  3094. ** (C) Copyright IBM Corp. 2017
  3095. **
  3096. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3097. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3098. ************************************************************************/
  3099. // GENERATED
  3100. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  3101. //@import com/ibm/rave/core/internal/util/NamespaceUtil (static) // getNamespaces, getQName
  3102. /**
  3103. * SVG has a different namespace from HTML, so Rave provides a few tools to simplify dealing with namespaces.
  3104. */
  3105. var com_ibm_rave_core_util_Namespace = com_ibm_rave_core_nativeImpl_Declare({
  3106. /**
  3107. * The map of registered namespace prefixes. Additional prefixes may be assigned as needed to create elements or attributes in other namespaces.
  3108. */
  3109. /** @expose */
  3110. prefix : null,
  3111. constructor : function() {
  3112. this.prefix = com_ibm_rave_core_internal_util_NamespaceUtil.getNamespaces();
  3113. },
  3114. /**
  3115. * 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.
  3116. * @param (String) name The name to qualify.
  3117. * @return (Object) A qualified name object, or if the name does not contain a colon, the input name.
  3118. */
  3119. /** @expose */
  3120. qualify : function(name) {
  3121. var qname = com_ibm_rave_core_internal_util_NamespaceUtil.getQName(name);
  3122. if (qname["space"] != null) {
  3123. return qname;
  3124. }
  3125. return qname["local"];
  3126. }
  3127. //constructor : function() {}
  3128. });
  3129. com_ibm_rave_core_util_Namespace.dummy_prefix = com_ibm_rave_core_internal_util_NamespaceUtil.getNamespaces();
  3130. /**
  3131. * The singleton of the Namespace component
  3132. */
  3133. /** @expose */
  3134. com_ibm_rave_core_util_Namespace.INSTANCE = new com_ibm_rave_core_util_Namespace();
  3135. // $source: com/ibm/rave/core/nativeImpl/math/TransformParser
  3136. /************************************************************************
  3137. ** IBM Confidential
  3138. **
  3139. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3140. **
  3141. ** (C) Copyright IBM Corp. 2014, 2015
  3142. **
  3143. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3144. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3145. ************************************************************************/
  3146. //@import com/ibm/rave/core/transform/Transform
  3147. //@import com/ibm/rave/core/util/Namespace
  3148. var com_ibm_rave_core_nativeImpl_math_TransformParser= (function() {
  3149. var g = null;
  3150. if (rave_document) {
  3151. g = rave_document.createElementNS(com_ibm_rave_core_util_Namespace.INSTANCE.prefix.svg,"g");
  3152. }
  3153. function myfunc(string) {
  3154. if(string != null && g != null){
  3155. g.setAttribute("transform", string);
  3156. var t = g.transform.baseVal.consolidate();
  3157. }
  3158. return new com_ibm_rave_core_transform_Transform(t ? t.matrix : null);
  3159. };
  3160. return {create: myfunc};
  3161. })();
  3162. // $source: com/ibm/rave/core/selector/Selection
  3163. /************************************************************************
  3164. ** IBM Confidential
  3165. **
  3166. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3167. **
  3168. ** (C) Copyright IBM Corp. 2017
  3169. **
  3170. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3171. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3172. ************************************************************************/
  3173. // GENERATED
  3174. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  3175. /**
  3176. * 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.
  3177. * @param < (Object) T > The concrete selection implementation type, e.g. Selector.
  3178. */
  3179. var com_ibm_rave_core_selector_Selection = rave_externs["Selection"] = com_ibm_rave_core_nativeImpl_Declare(Array, {
  3180. attr$0 : function(value) {
  3181. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(value), __len_enFor0 = __exp_enFor0.length;
  3182. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3183. var key = __exp_enFor0[__i_enFor0];
  3184. var v = value[key];
  3185. if (typeof v === "function") {
  3186. this.attr$2(key, v);
  3187. } else {
  3188. this.attr$1(key, value[key]);
  3189. }
  3190. }
  3191. return this;
  3192. },
  3193. /**
  3194. * Invokes the specified function once with this selection as the context.
  3195. * @param (com.ibm.rave.core.selector.RunFunction) callback the function to callback, must be annotated as {@link (com.ibm.rave.codegenerator.annotations.FunctionClass) FunctionClass}
  3196. * @param (java.lang.Object[]) args optional arguments to pass to the call function
  3197. * @return (Object) this selection
  3198. */
  3199. /** @expose */
  3200. call : function(callback, args) {},
  3201. /**
  3202. * Is the current selection empty.
  3203. * @return (boolean) <code>true</code> if selection is empty, <code>false> otherwise
  3204. */
  3205. /** @expose */
  3206. empty : function() {
  3207. return !this.node();
  3208. },
  3209. /**
  3210. * Remove the selected matches from this selection. Returns the resulting selection.
  3211. * @return (Object) this selection
  3212. */
  3213. /** @expose */
  3214. remove : function() {},
  3215. /**
  3216. * Return the current number of matches in this selection.
  3217. * @return (int) Current number of matches.
  3218. */
  3219. /** @expose */
  3220. size : function() {
  3221. var count = 0;
  3222. for (var j = 0, m = this.length; j < m; ++j) {
  3223. var group = this[j];
  3224. for (var i = 0, n = group.length; i < n; ++i) {
  3225. if (group[i]) {
  3226. count++;
  3227. }
  3228. }
  3229. }
  3230. return count;
  3231. },
  3232. style$0 : function(value) {
  3233. return this.style$1(value, null);
  3234. },
  3235. style$1 : function(value, priority) {
  3236. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(value), __len_enFor0 = __exp_enFor0.length;
  3237. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3238. var key = __exp_enFor0[__i_enFor0];
  3239. this.style$4(key, value[key], priority);
  3240. var v = value[key];
  3241. if (typeof v === "function") {
  3242. this.style$5(key, v, priority);
  3243. } else {
  3244. this.style$4(key, v, priority);
  3245. }
  3246. }
  3247. return this;
  3248. },
  3249. /**
  3250. * @return (boolean) true if this selector is a transition, false otherwise
  3251. */
  3252. /** @expose */
  3253. isTransition : function() {},
  3254. /**
  3255. * Return the first scene node contained in the current selection. May return null if there are matched selections.
  3256. */
  3257. /** @expose */
  3258. node : function() {
  3259. for (var j = 0, m = this.length; j < m; ++j) {
  3260. var group = this[j];
  3261. for (var i = 0, n = group.length; i < n; ++i) {
  3262. var node = group[i];
  3263. if (node) {
  3264. return node;
  3265. }
  3266. }
  3267. }
  3268. return null;
  3269. },
  3270. /** @expose */
  3271. attr : function(a0, a1) {
  3272. var args = arguments;
  3273. if (args.length == 1) {
  3274. return this.attr$0(a0);
  3275. }
  3276. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  3277. return this.attr$2(a0, a1);
  3278. }
  3279. return this.attr$1(a0, a1);
  3280. },
  3281. /** @expose */
  3282. each : function(a0, a1) {
  3283. var args = arguments;
  3284. if (args.length == 1) {
  3285. return this.each$0(a0);
  3286. }
  3287. return this.each$1(a0, a1);
  3288. },
  3289. /** @expose */
  3290. style : function(a0, a1, a2) {
  3291. var args = arguments;
  3292. if (args.length == 1) {
  3293. return this.style$0(a0);
  3294. }
  3295. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  3296. return this.style$3(a0, a1);
  3297. }
  3298. if (args.length == 2 && (a0 == null || typeof a0 === "string") && (a1 == null || Object.prototype.toString.call(a1) !== "[object Array]")) {
  3299. return this.style$2(a0, a1);
  3300. }
  3301. if (args.length == 2) {
  3302. return this.style$1(a0, a1);
  3303. }
  3304. if (args.length == 3 && (a0 == null || typeof a0 === "string") && typeof a1 === "function" && (a2 == null || typeof a2 === "string")) {
  3305. return this.style$5(a0, a1, a2);
  3306. }
  3307. return this.style$4(a0, a1, a2);
  3308. },
  3309. /** @expose */
  3310. text : function(a0) {
  3311. var args = arguments;
  3312. if (args.length == 1 && typeof a0 === "function") {
  3313. return this.text$1(a0);
  3314. }
  3315. return this.text$0(a0);
  3316. },
  3317. /** @expose */
  3318. select : function(a0) {
  3319. var args = arguments;
  3320. if (args.length == 1 && typeof a0 === "function") {
  3321. return this.select$1(a0);
  3322. }
  3323. return this.select$0(a0);
  3324. },
  3325. /** @expose */
  3326. selectAll : function(a0) {
  3327. var args = arguments;
  3328. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  3329. return this.selectAll$0(a0);
  3330. }
  3331. return this.selectAll$1(a0);
  3332. },
  3333. /** @expose */
  3334. filter : function(a0) {
  3335. var args = arguments;
  3336. if (args.length == 1 && typeof a0 === "function") {
  3337. return this.filter$0(a0);
  3338. }
  3339. return this.filter$1(a0);
  3340. },
  3341. /** @expose */
  3342. transition : function(a0) {
  3343. var args = arguments;
  3344. if (args.length == 0) {
  3345. return this.transition$0();
  3346. }
  3347. return this.transition$1(a0);
  3348. }
  3349. /**
  3350. * Sets the value for the requested attribute for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this selection.
  3351. * @param (String) attribute String attribute name.
  3352. * @param (Object) value Value for attribute.
  3353. * @return (Object) this selection
  3354. */
  3355. //attr$1 : function(attribute, value) {},
  3356. /**
  3357. * 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.
  3358. * @param (String) attribute String attribute name to set.
  3359. * @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.
  3360. * @return (Object) this selection
  3361. */
  3362. //attr$2 : function(attribute, valueFunction) {},
  3363. /**
  3364. * Execute the callback for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in the selection.
  3365. * @param (com.ibm.rave.core.selector.CallbackFunction) callback the callback to run
  3366. * @return (Object) this selection
  3367. */
  3368. //each$0 : function(callback) {},
  3369. /**
  3370. * <p> Execute the function for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in the selection. In a selection this runs immediately, calling the function on each node using the node, datum, index, and groupIndex as arguments. In a transition this runs when the transition event indicated by type occurs </p> <p> Note: When used with a selector, this method is <b>not</b> part of the D3 API. Code using the method will not run against the D3 library. </p>
  3371. * @see this.Transition#this.each(String, com_ibm_rave_core_selector_RunFunction)
  3372. * @see this.Selector#this.each(String, com_ibm_rave_core_selector_RunFunction)
  3373. * @param (String) type Type of event, only used with transitions
  3374. * @param (com.ibm.rave.core.selector.RunFunction) listener Run function called on each node in selection
  3375. * @return (Object) This selection
  3376. */
  3377. //each$1 : function(type, listener) {},
  3378. /**
  3379. * Sets the value for the requested style for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this selection.
  3380. * @param (String) styleName String style name.
  3381. * @param (Object) value Value for attribute.
  3382. * @return (Object) this selection
  3383. */
  3384. //style$2 : function(styleName, value) {},
  3385. /**
  3386. * Sets the value for the requested style for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this selection.
  3387. * @param (String) styleName String style name.
  3388. * @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.
  3389. * @return (Object) this selection
  3390. */
  3391. //style$3 : function(styleName, valueFunction) {},
  3392. /**
  3393. * Sets the value for the requested style for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this selection.
  3394. * @param (String) styleName String style name.
  3395. * @param (Object) value Value for attribute.
  3396. * @param (String) priority the style priority (i.e., "important")
  3397. * @return (Object) this selection
  3398. */
  3399. //style$4 : function(styleName, value, priority) {},
  3400. /**
  3401. * Sets the value for the requested style for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this selection.
  3402. * @param (String) styleName String style name.
  3403. * @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.
  3404. * @param (String) priority the style priority (i.e., "important")
  3405. * @return (Object) this selection
  3406. */
  3407. //style$5 : function(styleName, valueFunction, priority) {},
  3408. /**
  3409. * Sets the text content for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this selection.
  3410. * @param (Object) value The text content.
  3411. * @return (Object) this selection
  3412. */
  3413. //text$0 : function(value) {},
  3414. /**
  3415. * Sets the text content for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  3416. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction "anonymous" function class to be executed for each text. In JavaScript, this will be translated into an actual anonymous function.
  3417. * @return (Object) this selection
  3418. */
  3419. //text$1 : function(valueFunction) {},
  3420. /**
  3421. * 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.
  3422. * @param (Object) query CSS3 Selection query syntax.
  3423. * @return (Object) a new selection.
  3424. */
  3425. //select$0 : function(query) {},
  3426. /**
  3427. * 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.
  3428. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction
  3429. * @return (Object) a new selection.
  3430. */
  3431. //select$1 : function(valueFunction) {},
  3432. /**
  3433. * 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.
  3434. * @param (String) query CSS3 Selection query syntax.
  3435. * @return (Object) New selection containing new set of matches.
  3436. */
  3437. //selectAll$0 : function(query) {},
  3438. /**
  3439. * 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.
  3440. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction
  3441. * @return (Object) New selection containing new set of matches.
  3442. */
  3443. //selectAll$1 : function(valueFunction) {},
  3444. /**
  3445. * 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.
  3446. * @param (com.ibm.rave.core.selector.ValueFunction) filterFunction
  3447. * @return (Object) the matched selection
  3448. */
  3449. //filter$0 : function(filterFunction) {},
  3450. /**
  3451. * Return a new selector based on the filter query selector string.
  3452. * @param (String) filter query selector string
  3453. * @return (Object) the matched selection
  3454. */
  3455. //filter$1 : function(filter) {},
  3456. /**
  3457. * Create a new transition on the current selection.
  3458. * @return (com.ibm.rave.core.transition.Transition) the transition
  3459. */
  3460. //transition$0 : function() {},
  3461. /**
  3462. * Create a new transition on the current selection with a given name.
  3463. * @param (String) name the transition name
  3464. * @return (com.ibm.rave.core.transition.Transition) the transition
  3465. */
  3466. //transition$1 : function(name) {}
  3467. });
  3468. // $source: com/ibm/rave/core/Configuration
  3469. /************************************************************************
  3470. ** IBM Confidential
  3471. **
  3472. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3473. **
  3474. ** (C) Copyright IBM Corp. 2017
  3475. **
  3476. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3477. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3478. ************************************************************************/
  3479. // GENERATED
  3480. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  3481. var com_ibm_rave_core_Configuration = rave_externs["Configuration"] = com_ibm_rave_core_nativeImpl_Declare({
  3482. //nodeFactories : null,
  3483. //imageSnapshotFactories : null,
  3484. //queryEngines : null,
  3485. //nodeExtensions : null,
  3486. //filters : null,
  3487. extCounter : 1,
  3488. constructor : function() {
  3489. this.nodeFactories = {};
  3490. this.imageSnapshotFactories = {};
  3491. this.queryEngines = {};
  3492. {}
  3493. },
  3494. /** @expose */
  3495. getSceneNodeFactory : function(nsuri) {
  3496. return this.nodeFactories[nsuri];
  3497. },
  3498. /**
  3499. * Return an image factory associated with the given namespace
  3500. * @param (String) nsuri namespace associated with the image factory
  3501. * @return (com.ibm.rave.core.scene.ImageFactory) a image factory registered for the given namespace
  3502. */
  3503. /** @expose */
  3504. getImageFactory : function(nsuri) {
  3505. return this.imageSnapshotFactories[nsuri];
  3506. },
  3507. /** @expose */
  3508. setSceneNodeFactory : function(nsuri, factory) {
  3509. if (factory) {
  3510. this.nodeFactories[nsuri] = factory;
  3511. } else {
  3512. delete this.nodeFactories[nsuri];
  3513. }
  3514. },
  3515. /**
  3516. * Register image snapshot factory for the given namespace
  3517. * @param (String) nsuri namespace to associate with the new factory
  3518. * @param (com.ibm.rave.core.scene.ImageFactory) factory image factory
  3519. * @see (com.ibm.rave.core.scene.ImageFactory) ImageFactory
  3520. */
  3521. /** @expose */
  3522. setImageFactory : function(nsuri, factory) {
  3523. if (factory) {
  3524. this.imageSnapshotFactories[nsuri] = factory;
  3525. } else {
  3526. delete this.imageSnapshotFactories[nsuri];
  3527. }
  3528. },
  3529. /** @expose */
  3530. getQueryEngine : function(nsuri) {
  3531. return this.queryEngines[nsuri];
  3532. },
  3533. /** @expose */
  3534. setQueryEngine : function(nsuri, queryEngine) {
  3535. if (queryEngine) {
  3536. this.queryEngines[nsuri] = queryEngine;
  3537. } else {
  3538. delete this.queryEngines[nsuri];
  3539. }
  3540. },
  3541. /**
  3542. * Adds an extension factory against a namespace URI. NODE: this method will add the same factory over and over again, if called multiple times with the same namespace URI. It is a responsibility of the client code to ensure that it does not register the same factory more than once, for any given namesoace
  3543. * @param (String) namespaceUri namespace of a scene node to be extended
  3544. * @param (com.ibm.rave.core.scene.SceneNodeExtensionFactory) factory factory which will extend a scene node
  3545. * @param (int) priority extension priority to be applied when extending a scene node
  3546. */
  3547. /** @expose */
  3548. addSceneNodeExtensionFactory : function(namespaceUri, factory, priority) {
  3549. if (!this.nodeExtensions) {
  3550. this.nodeExtensions = {};
  3551. }
  3552. var list = this.nodeExtensions[namespaceUri];
  3553. if (list) {
  3554. if (priority <= 0) {
  3555. list.splice(0, 0, factory);
  3556. } else if (priority >= list.length) {
  3557. list.push(factory);
  3558. } else {
  3559. list.splice(priority, 0, factory);
  3560. }
  3561. } else {
  3562. list = [factory];
  3563. this.nodeExtensions[namespaceUri] = list;
  3564. }
  3565. this.extCounter++;
  3566. },
  3567. /** @expose */
  3568. removeSceneNodeExtensionFactory : function(namespaceUri, factory) {
  3569. var list = this.nodeExtensions[namespaceUri];
  3570. if (list) {
  3571. var i = list.indexOf(factory);
  3572. if (i >= 0) {
  3573. list.splice(i, 1);
  3574. this.extCounter++;
  3575. }
  3576. }
  3577. },
  3578. /**
  3579. * 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.
  3580. * @param (com.ibm.rave.core.scene.SceneNode) node the node to extend
  3581. * @param (com.ibm.rave.core.scene.SceneNode) context an optional context, typically the parent
  3582. * @return (com.ibm.rave.core.scene.SceneNode) the scene node itself
  3583. */
  3584. /** @expose */
  3585. extend : function(node, context) {
  3586. if (this.nodeExtensions) {
  3587. var extId = node.rave_getProperty("__rave-node-ext__");
  3588. var extend = extId == null;
  3589. if (!extend && extId != this.extCounter) {
  3590. node.rave_initExtensions();
  3591. }
  3592. if (extend) {
  3593. node.rave_setProperty("__rave-node-ext__", this.extCounter);
  3594. var nodeExtFactories = this.nodeExtensions[node.rave_getNamespaceURI()];
  3595. if (nodeExtFactories) {
  3596. var c = context ? context : node.rave_getParentNode();
  3597. for (var __i_enFor0 = 0, __exp_enFor0 = nodeExtFactories, __len_enFor0 = __exp_enFor0.length;
  3598. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3599. var extFactory = __exp_enFor0[__i_enFor0];
  3600. extFactory(node, c);
  3601. }
  3602. }
  3603. }
  3604. }
  3605. return node;
  3606. },
  3607. /**
  3608. * 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.
  3609. * @param (com.ibm.rave.core.scene.SceneNode) node the node to extend
  3610. * @return (com.ibm.rave.core.scene.SceneNode) the scene node itself
  3611. */
  3612. /** @expose */
  3613. extendRecursive : function(node) {
  3614. this.extend(node, null);
  3615. if (node.rave_hasChildNodes()) {
  3616. for (var __i_enFor0 = 0, __exp_enFor0 = node.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  3617. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3618. var child = __exp_enFor0[__i_enFor0];
  3619. this.extendRecursive(child);
  3620. }
  3621. }
  3622. return node;
  3623. },
  3624. /**
  3625. * Registers a filter function that can filter selection results.
  3626. */
  3627. /** @expose */
  3628. registerFilter : function(filterKey, filterFunction) {
  3629. if (!this.filters) {
  3630. this.filters = {};
  3631. }
  3632. this.filters[filterKey] = filterFunction;
  3633. },
  3634. /**
  3635. * Registers a filter function that can filter selection results.
  3636. */
  3637. /** @expose */
  3638. unregisterFilter : function(filterKey) {
  3639. if (this.filters) {
  3640. delete this.filters[filterKey];
  3641. }
  3642. },
  3643. /**
  3644. * Filter a single scene node using any registered filters. Used by selectors to remove 'private' nodes from the results.
  3645. * @param (com.ibm.rave.core.scene.SceneNode) item SceneNode that's tested against our filter rules.
  3646. * @param (String) query The original selector query that got the item. Used for performing re-selections if required by the filter.
  3647. * @return (com.ibm.rave.core.scene.SceneNode) The same scene node or null if this node was filtered.
  3648. */
  3649. /** @expose */
  3650. filter : function(item, query) {
  3651. var result = item;
  3652. if (this.filters && result) {
  3653. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.filters), __len_enFor0 = __exp_enFor0.length;
  3654. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3655. var key = __exp_enFor0[__i_enFor0];
  3656. var filterFunction = this.filters[key];
  3657. result = filterFunction(item, query);
  3658. if (!result) {
  3659. break;
  3660. }
  3661. }
  3662. }
  3663. return result;
  3664. },
  3665. /**
  3666. * Filter an array of scene nodes using all registered filters. Used by selectors to remove 'private' nodes from the results.
  3667. * @param (Array) list SceneNode[] array who's elements are tested against our filter rules.
  3668. * @return (Array) New array of SceneNodes that contain only those elements not filtered.
  3669. */
  3670. /** @expose */
  3671. filterArray : function(list) {
  3672. if (this.filters && list) {
  3673. var results = [];
  3674. for (var __i_enFor0 = 0, __exp_enFor0 = list, __len_enFor0 = __exp_enFor0.length;
  3675. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3676. var item = __exp_enFor0[__i_enFor0];
  3677. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(this.filters), __len_enFor1 = __exp_enFor1.length;
  3678. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  3679. var key = __exp_enFor1[__i_enFor1];
  3680. var filterFunction = this.filters[key];
  3681. item = filterFunction(item, null);
  3682. }
  3683. if (item) {
  3684. results.push(item);
  3685. }
  3686. }
  3687. return results;
  3688. }
  3689. return list;
  3690. }
  3691. });
  3692. //com_ibm_rave_core_Configuration.EXTENSION_KEY = "__rave-node-ext__";
  3693. /** @expose */
  3694. com_ibm_rave_core_Configuration.INSTANCE = new com_ibm_rave_core_Configuration();
  3695. // $source: com/ibm/rave/core/nativeImpl/arrays/ES6Map
  3696. /************************************************************************
  3697. ** IBM Confidential
  3698. **
  3699. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3700. **
  3701. ** (C) Copyright IBM Corp. 2014, 2015
  3702. **
  3703. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3704. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3705. ************************************************************************/
  3706. // @import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  3707. var com_ibm_rave_core_nativeImpl_arrays_ES6Map = rave_externs["ES6Map"] =(function() {
  3708. var map_proto = "__proto__",
  3709. map_zero = "\0";
  3710. function map_escape(key) {
  3711. return (key += "") === map_proto || key[0] === map_zero ? map_zero + key : key;
  3712. }
  3713. function map_unescape(key) {
  3714. return (key += "")[0] === map_zero ? key.slice(1) : key;
  3715. }
  3716. var Map = com_ibm_rave_core_nativeImpl_Declare({
  3717. constructor : function() {
  3718. this._ = Object.create(null);
  3719. },
  3720. /**
  3721. * Constructs a new map with the given comparator.
  3722. * @param (com.ibm.rave.core.internal.util.Comparator) comparator compares two data objects
  3723. */
  3724. /** @expose */
  3725. has: function(key) {
  3726. return map_escape(key) in this._;
  3727. },
  3728. /** @expose */
  3729. get: function(key) {
  3730. return this._[map_escape(key)];
  3731. },
  3732. /** @expose */
  3733. set: function(key, value) {
  3734. return this._[map_escape(key)] = value;
  3735. },
  3736. /** @expose */
  3737. remove: function(key) {
  3738. return (key = map_escape(key)) in this._ && delete this._[key];
  3739. },
  3740. /** @expose */
  3741. keys: function() {
  3742. var keys = [];
  3743. for (var key in this._) keys.push(map_unescape(key));
  3744. return keys;
  3745. },
  3746. /** @expose */
  3747. values: function() {
  3748. var values = [];
  3749. for (var key in this._) values.push(this._[key]);
  3750. return values;
  3751. },
  3752. /** @expose */
  3753. entries: function() {
  3754. var entries = [];
  3755. for (var key in this._) entries.push({key: map_unescape(key), value: this._[key]});
  3756. return entries;
  3757. },
  3758. /** @expose */
  3759. size: function() {
  3760. var size = 0;
  3761. for (var key in this._) ++size;
  3762. return size;
  3763. },
  3764. /** @expose */
  3765. empty: function() {
  3766. for (var key in this._) return false;
  3767. return true;
  3768. },
  3769. /** @expose */
  3770. forEach: function(f) {
  3771. for (var key in this._) f.call(this, map_unescape(key), this._[key]);
  3772. }
  3773. });
  3774. /**
  3775. * Creates a generic map
  3776. * @return (com.ibm.rave.core.arrays.Map) a new map
  3777. */
  3778. Map.create$0 = function() {
  3779. return new Map();
  3780. };
  3781. /**
  3782. * Creates a new Map from an existing Map
  3783. * @param (com.ibm.rave.core.arrays.Map) an existing map
  3784. * @return (com.ibm.rave.core.arrays.Map) a new map
  3785. */
  3786. Map.create$1 = function(object) {
  3787. var map = new Map();
  3788. object.forEach(function(key, value) { map.set(key, value); });
  3789. return map;
  3790. };
  3791. /**
  3792. * Creates a new Map from an array
  3793. * @param Object[] an array
  3794. * @return (com.ibm.rave.core.arrays.Map) a new map
  3795. */
  3796. Map.create$2 = function(object) {
  3797. var map = new Map();
  3798. for (var key in object) map.set(key, object[key]);
  3799. return map;
  3800. };
  3801. /** @expose */
  3802. Map.create = function(a0) {
  3803. if (arguments.length == 0) {
  3804. return Map.create$0();
  3805. } else if (arguments.length == 1 && (a0 instanceof Map)) {
  3806. return Map.create$1(a0);
  3807. }
  3808. return Map.create$2(a0);
  3809. };
  3810. return Map;
  3811. })();
  3812. // $source: com/ibm/rave/core/transition/TransitionCollector
  3813. /************************************************************************
  3814. ** IBM Confidential
  3815. **
  3816. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3817. **
  3818. ** (C) Copyright IBM Corp. 2017
  3819. **
  3820. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3821. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3822. ************************************************************************/
  3823. // GENERATED
  3824. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  3825. //@import com/ibm/rave/core/context/RaveContextManager (static) // RaveContextManager
  3826. /**
  3827. * A transition manager which allows us to schedule, track, and delay transitions. The implementation of tracking the end of transitions will be up to the bundle author or the library level.
  3828. */
  3829. var com_ibm_rave_core_transition_TransitionCollector = rave_externs["TransitionCollector"] = com_ibm_rave_core_nativeImpl_Declare({
  3830. });
  3831. /**
  3832. * Returns true if transitions are being collected.
  3833. * @return (boolean) true if transitions are being collected, false otherwise
  3834. */
  3835. /** @expose */
  3836. com_ibm_rave_core_transition_TransitionCollector.isCollectingTransitions = function() {
  3837. return (com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData("TRANSITIONS_LIST_KEY") != null);
  3838. };
  3839. /**
  3840. * Create the transition list and start collecting transitions. Every time this method is called a new list to collect transitions is created and existing list (if any) will be discarded, which means if the user didn't call startCollectingTransitions Calling this method twice without calling stopCollectingTransitions method in between will cause the overwrite the existing list (if any) of collected transitions
  3841. */
  3842. /** @expose */
  3843. com_ibm_rave_core_transition_TransitionCollector.startCollectingTransitions = function() {
  3844. com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().putData("TRANSITIONS_LIST_KEY", []);
  3845. };
  3846. /**
  3847. * Stop collection transitions and return the list of collected ones (if any) and stop collecting any new transitions
  3848. * @return (Array) the list of collected transitions, could empty if no transitions were collected at all or could be null if the startCollectingTransitions method was not called before
  3849. */
  3850. /** @expose */
  3851. com_ibm_rave_core_transition_TransitionCollector.stopCollectingTransitions = function() {
  3852. var list = com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData("TRANSITIONS_LIST_KEY");
  3853. com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().removeData("TRANSITIONS_LIST_KEY");
  3854. return list;
  3855. };
  3856. /**
  3857. * Add a transition to the internal list if transition collection were started, else this method will ignore the passed transition
  3858. * @param (com.ibm.rave.core.transition.Transition) trans a new Transition
  3859. * @return (boolean) true transition collection was started, false otherwise
  3860. */
  3861. com_ibm_rave_core_transition_TransitionCollector.addTransition = function(trans) {
  3862. var transitionList = com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData("TRANSITIONS_LIST_KEY");
  3863. if (transitionList) {
  3864. transitionList.push(trans);
  3865. return true;
  3866. }
  3867. return false;
  3868. };
  3869. /**
  3870. * Remove the transition with the given id from the transition list if the list exists and includes the transition.
  3871. * @param (com.ibm.rave.core.transition.Transition) transition the transition
  3872. */
  3873. /** @expose */
  3874. com_ibm_rave_core_transition_TransitionCollector.removeTransition = function(transition) {
  3875. var transitionList = com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData("TRANSITIONS_LIST_KEY");
  3876. if (transitionList) {
  3877. for (var i = 0; i < transitionList.length; ++i) {
  3878. var trans = transitionList[i];
  3879. if (trans == transition) {
  3880. transitionList.splice(i, 1);
  3881. i = transitionList.length;
  3882. }
  3883. }
  3884. }
  3885. };
  3886. //com_ibm_rave_core_transition_TransitionCollector.TRANSITIONS_LIST_KEY = "TRANSITIONS_LIST_KEY";
  3887. // $source: com/ibm/rave/core/nativeImpl/timer/Timer
  3888. /************************************************************************
  3889. ** IBM Confidential
  3890. **
  3891. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3892. **
  3893. ** (C) Copyright IBM Corp. 2014, 2015
  3894. **
  3895. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3896. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3897. ************************************************************************/
  3898. // @import com/ibm/rave/core/internal/nativeImpl/Vendor
  3899. var com_ibm_rave_core_nativeImpl_timer_Timer = (function() {
  3900. // use requestAnimationFrame if available
  3901. // fallback to setTimeout
  3902. var raf = global[vendorSymbol(global, "requestAnimationFrame")] || function(callback) { setTimeout(callback, 17); },
  3903. active, qhead, qtail, sleepHandle, currentTime;
  3904. function executeCallbacks(now) {
  3905. currentTime = now;
  3906. var sleep = Infinity,
  3907. prev,
  3908. item = qhead;
  3909. while (item) {
  3910. if (now >= item.time && item.callback(now - item.time)) {
  3911. // remove item from the queue
  3912. if (prev) {
  3913. // set the previous next to the item next
  3914. prev.next = item.next;
  3915. } else {
  3916. // since we never had a previous item
  3917. // move the queue head pointer ahead
  3918. qhead = item.next;
  3919. }
  3920. } else {
  3921. // track previous item in queue
  3922. prev = item;
  3923. if (item.time < sleep) {
  3924. // track the smallest time for all callbacks
  3925. sleep = item.time;
  3926. }
  3927. }
  3928. // get next item in the queue
  3929. item = item.next;
  3930. }
  3931. // the previous item is always the new tail
  3932. qtail = prev;
  3933. return sleep;
  3934. }
  3935. function step() {
  3936. var now = Date.now(),
  3937. sleep = executeCallbacks(now) - now;
  3938. // check if there are any items in the queue
  3939. if (sleep > 24) {
  3940. if (isFinite(sleep)) {
  3941. // delay the loop as to not run the cpu needlessly
  3942. sleepHandle = setTimeout(step, sleep);
  3943. }
  3944. active = 0;
  3945. } else {
  3946. active = 1;
  3947. // continue the loop
  3948. raf(step);
  3949. }
  3950. }
  3951. var timer = function(callback, delay, start) {
  3952. var argsLen = arguments.length;
  3953. if (argsLen < 2) {
  3954. delay = 0;
  3955. }
  3956. if (argsLen < 3) {
  3957. start = Date.now();
  3958. }
  3959. var item = {
  3960. callback: callback,
  3961. // start time is based on real time
  3962. time: delay + start
  3963. //next: null // the next item in the queue
  3964. };
  3965. if (qtail) {
  3966. // add item to end of queue
  3967. qtail.next = item;
  3968. } else {
  3969. // set item as the head of the queue
  3970. qhead = item;
  3971. }
  3972. // item is the new tail
  3973. qtail = item;
  3974. if (!active) {
  3975. sleepHandle = clearTimeout(sleepHandle);
  3976. active = 1;
  3977. // begin the loop
  3978. raf(step);
  3979. }
  3980. };
  3981. /** @expose */
  3982. timer.flush = function(callback, delay, duration) {
  3983. executeCallbacks(Date.now());
  3984. };
  3985. /** @expose */
  3986. timer.currentTime = function() {
  3987. return currentTime;
  3988. }
  3989. return {
  3990. /** @expose */
  3991. INSTANCE : timer
  3992. };
  3993. })();
  3994. // $source: com/ibm/rave/core/internal/transitions/TransitionInfo
  3995. /************************************************************************
  3996. ** IBM Confidential
  3997. **
  3998. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3999. **
  4000. ** (C) Copyright IBM Corp. 2017
  4001. **
  4002. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4003. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4004. ************************************************************************/
  4005. // GENERATED
  4006. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4007. //@import com/ibm/rave/core/ease/Easing (runtime) // Easing
  4008. //@import com/ibm/rave/core/event/Dispatcher (runtime) // create
  4009. var com_ibm_rave_core_internal_transitions_TransitionInfo = com_ibm_rave_core_nativeImpl_Declare({
  4010. /**
  4011. * @expose
  4012. */
  4013. ease : null,
  4014. /**
  4015. * @expose
  4016. */
  4017. tween : null,
  4018. /**
  4019. * @expose
  4020. */
  4021. event : null,
  4022. //node : null,
  4023. //_transition : null,
  4024. //tracker : null,
  4025. /**
  4026. * @expose
  4027. */
  4028. delay : 0,
  4029. /**
  4030. * @expose
  4031. */
  4032. duration : 250,
  4033. /**
  4034. * @expose
  4035. */
  4036. time : -1.0,
  4037. transitionId : 0,
  4038. index : 0,
  4039. groupIndex : 0,
  4040. scheduled : false,
  4041. constructor : function(tracker, id, node) {
  4042. this.ease = com_ibm_rave_core_ease_Easing.DEFAULT;
  4043. this.tween = {};
  4044. {
  4045. this.tracker = tracker;
  4046. this.transitionId = id;
  4047. this.node = node;
  4048. }
  4049. },
  4050. getTransitionId : function() {
  4051. return this.transitionId;
  4052. },
  4053. setTransition : function(trans) {
  4054. this._transition = trans;
  4055. },
  4056. getTransition : function() {
  4057. return this._transition;
  4058. },
  4059. getTracker : function() {
  4060. return this.tracker;
  4061. },
  4062. getSceneNode : function() {
  4063. return this.node;
  4064. },
  4065. getOrCreateDispatcher : function() {
  4066. if (!this.event) {
  4067. this.event = com_ibm_rave_core_event_Dispatcher.create("start", "end", "interrupt");
  4068. }
  4069. return this.event;
  4070. },
  4071. getDispatcher : function() {
  4072. return this.event;
  4073. },
  4074. setIndex : function(index) {
  4075. this.index = index;
  4076. },
  4077. getIndex : function() {
  4078. return this.index;
  4079. },
  4080. setGroupIndex : function(groupIndex) {
  4081. this.groupIndex = groupIndex;
  4082. },
  4083. getGroupIndex : function() {
  4084. return this.groupIndex;
  4085. },
  4086. setDelay : function(delay) {
  4087. this.delay = delay;
  4088. },
  4089. getDelay : function() {
  4090. return this.delay;
  4091. },
  4092. setDuration : function(duration) {
  4093. this.duration = duration;
  4094. },
  4095. getDuration : function() {
  4096. return this.duration;
  4097. },
  4098. setEase : function(ease) {
  4099. this.ease = ease;
  4100. },
  4101. getEase : function() {
  4102. return this.ease;
  4103. },
  4104. addTweenFactory : function(key, factory) {
  4105. this.tween[key] = factory;
  4106. },
  4107. removeTweenFactory : function(key) {
  4108. delete this.tween[key];
  4109. },
  4110. getTweenFactory : function(key) {
  4111. return this.tween[key];
  4112. },
  4113. getTweens : function() {
  4114. var sceneNode = this.node;
  4115. var data = sceneNode.rave_getData();
  4116. var i = this.index;
  4117. var gi = this.groupIndex;
  4118. var tweens = [];
  4119. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.tween), __len_enFor0 = __exp_enFor0.length;
  4120. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4121. var key = __exp_enFor0[__i_enFor0];
  4122. var tf = this.tween[key];
  4123. var t = tf.call(sceneNode, data, i, gi);
  4124. if (t) {
  4125. tweens.push(t);
  4126. }
  4127. }
  4128. return tweens;
  4129. },
  4130. getStartTime : function() {
  4131. return this.time;
  4132. },
  4133. setStartTime : function(startTime) {
  4134. this.time = startTime;
  4135. },
  4136. isScheduled : function() {
  4137. return this.scheduled;
  4138. },
  4139. setScheduled : function() {
  4140. this.scheduled = true;
  4141. }
  4142. });
  4143. // $source: com/ibm/rave/core/ease/Easing
  4144. /************************************************************************
  4145. ** IBM Confidential
  4146. **
  4147. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4148. **
  4149. ** (C) Copyright IBM Corp. 2017
  4150. **
  4151. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4152. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4153. ************************************************************************/
  4154. // GENERATED
  4155. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4156. /**
  4157. * Collection of built-in easing functions. Provides a utility to retrieve an easing function by named type.
  4158. */
  4159. var com_ibm_rave_core_ease_Easing = com_ibm_rave_core_nativeImpl_Declare({
  4160. _$functionClassMethod : function() {
  4161. var _$self = /**
  4162. * 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>
  4163. * @param (String) type the type of {@link (com.ibm.rave.core.ease.EasingFunction) EasingFunction}
  4164. * @param (java.lang.Object[]) args the parameters that will be provided to the type of {@link (com.ibm.rave.core.ease.EasingFunction) EasingFunction} specified.
  4165. * @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
  4166. */
  4167. function(type, args) {
  4168. if (args !== null || arguments.length > 2){
  4169. args = Array.prototype.slice.call(arguments, 1);
  4170. }
  4171. {
  4172. var i = type.indexOf("-");
  4173. var t = i >= 0 ? type.substring(0, i) : type;
  4174. var m = i >= 0 ? type.substring(i + 1) : "in";
  4175. var e = com_ibm_rave_core_ease_Easing.identity;
  4176. if ("poly" == t) {
  4177. e = com_ibm_rave_core_ease_Easing.poly((args[0]));
  4178. } else if ("quad" == t) {
  4179. e = com_ibm_rave_core_ease_Easing.quad;
  4180. } else if ("cubic" == t) {
  4181. e = com_ibm_rave_core_ease_Easing.cubic;
  4182. } else if ("sin" == t) {
  4183. e = com_ibm_rave_core_ease_Easing.sin;
  4184. } else if ("exp" == t) {
  4185. e = com_ibm_rave_core_ease_Easing.exp;
  4186. } else if ("circle" == t) {
  4187. e = com_ibm_rave_core_ease_Easing.circle;
  4188. } else if ("elastic" == t) {
  4189. if (!args || args.length == 0) {
  4190. e = com_ibm_rave_core_ease_Easing.elastic$0();
  4191. } else if (args.length == 1) {
  4192. e = com_ibm_rave_core_ease_Easing.elastic$1((args[0]));
  4193. } else if (args.length == 2) {
  4194. e = com_ibm_rave_core_ease_Easing.elastic$2((args[0]), (args[1]));
  4195. }
  4196. } else if ("back" == t) {
  4197. if (!args || args.length == 0) {
  4198. e = com_ibm_rave_core_ease_Easing.back$0();
  4199. } else if (args.length == 1) {
  4200. e = com_ibm_rave_core_ease_Easing.back$1((args[0]));
  4201. }
  4202. } else if ("bounce" == t) {
  4203. e = com_ibm_rave_core_ease_Easing.bounce;
  4204. }
  4205. if ("out" == m) {
  4206. e = com_ibm_rave_core_ease_Easing.reverse(e);
  4207. } else if ("in-out" == m) {
  4208. e = com_ibm_rave_core_ease_Easing.reflect(e);
  4209. } else if ("out-in" == m) {
  4210. e = com_ibm_rave_core_ease_Easing.reflect(com_ibm_rave_core_ease_Easing.reverse(e));
  4211. }
  4212. return com_ibm_rave_core_ease_Easing.clamp(e);
  4213. }
  4214. };
  4215. return _$self;
  4216. }
  4217. //constructor : function() {}
  4218. });
  4219. com_ibm_rave_core_ease_Easing.clamp = function(f) {
  4220. return function(t) {
  4221. return t <= 0 ? 0 : t >= 1 ? 1 : f(t);
  4222. };
  4223. };
  4224. com_ibm_rave_core_ease_Easing.reverse = function(f) {
  4225. return function(t) {
  4226. return 1 - f(1 - t);
  4227. };
  4228. };
  4229. com_ibm_rave_core_ease_Easing.reflect = function(f) {
  4230. return function(t) {
  4231. return .5 * (t < .5 ? f(2 * t) : (2 - f(2 - 2 * t)));
  4232. };
  4233. };
  4234. com_ibm_rave_core_ease_Easing.poly = function(e) {
  4235. return function(t) {
  4236. return Math.pow(t, e);
  4237. };
  4238. };
  4239. com_ibm_rave_core_ease_Easing.elastic$0 = function() {
  4240. return com_ibm_rave_core_ease_Easing.elastic$3(1, 0.45, 0.45 / 4);
  4241. };
  4242. com_ibm_rave_core_ease_Easing.elastic$1 = function(a) {
  4243. return com_ibm_rave_core_ease_Easing.elastic$2(a, 0.45);
  4244. };
  4245. com_ibm_rave_core_ease_Easing.elastic$2 = function(a, p) {
  4246. return com_ibm_rave_core_ease_Easing.elastic$3(a, p, p / 6.283185307179586 * Math.asin(1 / a));
  4247. };
  4248. com_ibm_rave_core_ease_Easing.elastic$3 = function(a, p, s) {
  4249. return function(t) {
  4250. return 1 + a * Math.pow(2, -10 * t) * Math.sin((t - s) * 6.283185307179586 / p);
  4251. };
  4252. };
  4253. com_ibm_rave_core_ease_Easing.back$0 = function() {
  4254. return com_ibm_rave_core_ease_Easing.back$1(1.70158);
  4255. };
  4256. com_ibm_rave_core_ease_Easing.back$1 = function(s) {
  4257. return function(t) {
  4258. return t * t * ((s + 1) * t - s);
  4259. };
  4260. };
  4261. com_ibm_rave_core_ease_Easing.elastic = function(a0, a1, a2) {
  4262. var args = arguments;
  4263. if (args.length == 0) {
  4264. return com_ibm_rave_core_ease_Easing.elastic$0();
  4265. }
  4266. if (args.length == 1) {
  4267. return com_ibm_rave_core_ease_Easing.elastic$1(a0);
  4268. }
  4269. if (args.length == 2) {
  4270. return com_ibm_rave_core_ease_Easing.elastic$2(a0, a1);
  4271. }
  4272. return com_ibm_rave_core_ease_Easing.elastic$3(a0, a1, a2);
  4273. };
  4274. com_ibm_rave_core_ease_Easing.back = function(a0) {
  4275. var args = arguments;
  4276. if (args.length == 0) {
  4277. return com_ibm_rave_core_ease_Easing.back$0();
  4278. }
  4279. return com_ibm_rave_core_ease_Easing.back$1(a0);
  4280. };
  4281. /** @expose */
  4282. com_ibm_rave_core_ease_Easing.INSTANCE = new com_ibm_rave_core_ease_Easing();
  4283. com_ibm_rave_core_ease_Easing.HALF_PI = Math.PI / 2;
  4284. com_ibm_rave_core_ease_Easing.PI_2 = Math.PI * 2;
  4285. com_ibm_rave_core_ease_Easing.identity = function(t) {
  4286. return t;
  4287. };
  4288. com_ibm_rave_core_ease_Easing.quad = function(t) {
  4289. return t * t;
  4290. };
  4291. com_ibm_rave_core_ease_Easing.cubic = function(t) {
  4292. return t * t * t;
  4293. };
  4294. com_ibm_rave_core_ease_Easing.cubicInOut = function(t) {
  4295. if (t <= 0) {
  4296. return 0;
  4297. }
  4298. if (t >= 1) {
  4299. return 1;
  4300. }
  4301. var t2 = t * t, t3 = t2 * t;
  4302. return 4 * (t < .5 ? t3 : 3 * (t - t2) + t3 - .75);
  4303. };
  4304. com_ibm_rave_core_ease_Easing.sin = function(t) {
  4305. return 1 - Math.cos(t * 1.5707963267948966);
  4306. };
  4307. com_ibm_rave_core_ease_Easing.exp = function(t) {
  4308. return Math.pow(2, 10 * (t - 1));
  4309. };
  4310. com_ibm_rave_core_ease_Easing.circle = function(t) {
  4311. return 1 - Math.sqrt(1 - t * t);
  4312. };
  4313. com_ibm_rave_core_ease_Easing.bounce = function(t) {
  4314. var _t = t;
  4315. 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;
  4316. };
  4317. /**
  4318. * The default easing function is "cubic-in-out" which provides suitable slow-in slow-out animations
  4319. */
  4320. /** @expose */
  4321. com_ibm_rave_core_ease_Easing.DEFAULT = com_ibm_rave_core_ease_Easing.cubicInOut;
  4322. // $source: com/ibm/rave/core/event/Dispatcher
  4323. /************************************************************************
  4324. ** IBM Confidential
  4325. **
  4326. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4327. **
  4328. ** (C) Copyright IBM Corp. 2017
  4329. **
  4330. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4331. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4332. ************************************************************************/
  4333. // GENERATED
  4334. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, declare anonymous
  4335. /**
  4336. * 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.
  4337. * @param < (java.lang.Object) C > the event listener context
  4338. */
  4339. var com_ibm_rave_core_event_Dispatcher = rave_externs["Dispatcher"] = com_ibm_rave_core_nativeImpl_Declare(Object, {
  4340. /** @expose */
  4341. init : function(types) {
  4342. if (types !== null || arguments.length > 1){
  4343. types = Array.prototype.slice.call(arguments);
  4344. }
  4345. {
  4346. var i = -1, n = types.length;
  4347. while (++i < n) {
  4348. this[types[i]] = com_ibm_rave_core_event_Dispatcher.createEvent(this);
  4349. }
  4350. }
  4351. },
  4352. /** @expose */
  4353. constructor : function() {},
  4354. /**
  4355. * Returns the currently-assigned listener for the specified type, if any.
  4356. * @param (String) type the event type
  4357. * @return (com.ibm.rave.core.selector.RunFunction) the currently-assigned listener for the specified type
  4358. */
  4359. on$0 : function(type) {
  4360. var t = type;
  4361. var i = t.indexOf(".");
  4362. var name = "";
  4363. if (i >= 0) {
  4364. name = t.substring(i + 1);
  4365. t = t.substring(0, i);
  4366. }
  4367. if (t.length > 0) {
  4368. return this[t].on$0(name);
  4369. }
  4370. return undefined;
  4371. },
  4372. /**
  4373. * 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).
  4374. * @param (String) type the event type
  4375. * @param (com.ibm.rave.core.selector.RunFunction) listener the event listener to register, or <code>null</code> to remove the listener
  4376. * @return (com.ibm.rave.core.event.Dispatcher) this {@link (com.ibm.rave.core.event.Dispatcher) Dispatcher}
  4377. */
  4378. on$1 : function(type, listener) {
  4379. var t = type;
  4380. var i = t.indexOf(".");
  4381. var name = "";
  4382. if (i >= 0) {
  4383. name = t.substring(i + 1);
  4384. t = t.substring(0, i);
  4385. }
  4386. if (t.length > 0) {
  4387. return this[t].on$1(name, listener);
  4388. }
  4389. if (!listener) {
  4390. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this), __len_enFor0 = __exp_enFor0.length;
  4391. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4392. var key = __exp_enFor0[__i_enFor0];
  4393. if (this.hasOwnProperty(key)) {
  4394. this[key].on$1(name, null);
  4395. }
  4396. }
  4397. }
  4398. return this;
  4399. },
  4400. /** @expose */
  4401. on : function(a0, a1) {
  4402. var args = arguments;
  4403. if (args.length == 1) {
  4404. return this.on$0(a0);
  4405. }
  4406. return this.on$1(a0, a1);
  4407. }
  4408. });
  4409. /**
  4410. * 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} .
  4411. * @param (java.lang.String[]) types event type names
  4412. * @return (com.ibm.rave.core.event.Dispatcher) a dispatcher for the given event types
  4413. */
  4414. /** @expose */
  4415. com_ibm_rave_core_event_Dispatcher.create = function(types) {
  4416. if (types !== null || arguments.length > 1){
  4417. types = Array.prototype.slice.call(arguments);
  4418. }
  4419. {
  4420. var dispatch = new com_ibm_rave_core_event_Dispatcher();
  4421. dispatch.init.apply(dispatch, types);
  4422. return dispatch;
  4423. }
  4424. };
  4425. com_ibm_rave_core_event_Dispatcher.createEvent = function(dispatch) {
  4426. var listeners = [];
  4427. listeners[0] = [];
  4428. var listenerByName = [];
  4429. listenerByName[0] = {};
  4430. return new (com_ibm_rave_core_nativeImpl_Declare({
  4431. _$functionClassMethod : function() {
  4432. var _$self = function(args) {
  4433. if (args !== null || arguments.length > 1){
  4434. args = Array.prototype.slice.call(arguments, 0);
  4435. }
  4436. {
  4437. var z = listeners[0];
  4438. var i = -1, n = z.length;
  4439. var l;
  4440. while (++i < n) {
  4441. if ((l = z[i]).on) {
  4442. l.on.apply(this, args);
  4443. }
  4444. }
  4445. return dispatch;
  4446. }
  4447. };
  4448. return _$self;
  4449. },
  4450. on$0 : function(name) {
  4451. var l = listenerByName[0][name];
  4452. return l && l.on ? l.on : null;
  4453. },
  4454. on$1 : function(name, listener) {
  4455. var l = listenerByName[0][name];
  4456. if (l) {
  4457. var i;
  4458. l.on = null;
  4459. listeners[0] = listeners[0].slice(0, i = listeners[0].indexOf(l)).concat(listeners[0].slice(i + 1));
  4460. delete listenerByName[0][name];
  4461. }
  4462. if (listener) {
  4463. l = new com_ibm_rave_core_event_Dispatcher.ListenerWrapper(listener);
  4464. listenerByName[0][name] = l;
  4465. listeners[0].push(l);
  4466. }
  4467. return dispatch;
  4468. },
  4469. on : function(a0, a1) {
  4470. var args = arguments;
  4471. if (args.length == 1) {
  4472. return this.on$0(a0);
  4473. }
  4474. return this.on$1(a0, a1);
  4475. }
  4476. }))();
  4477. };
  4478. com_ibm_rave_core_event_Dispatcher.ListenerWrapper = function(on) {
  4479. this.on = on;
  4480. };
  4481. // $source: com/ibm/rave/core/internal/transitions/TransitionTracker
  4482. /************************************************************************
  4483. ** IBM Confidential
  4484. **
  4485. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4486. **
  4487. ** (C) Copyright IBM Corp. 2017
  4488. **
  4489. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4490. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4491. ************************************************************************/
  4492. // GENERATED
  4493. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4494. var com_ibm_rave_core_internal_transitions_TransitionTracker = com_ibm_rave_core_nativeImpl_Declare(Object, {
  4495. /**
  4496. * @expose
  4497. */
  4498. active : 0,
  4499. /**
  4500. * @expose
  4501. */
  4502. count : 0
  4503. });
  4504. // $source: com/ibm/rave/core/internal/transitions/TransitionUtil
  4505. /************************************************************************
  4506. ** IBM Confidential
  4507. **
  4508. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4509. **
  4510. ** (C) Copyright IBM Corp. 2017
  4511. **
  4512. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4513. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4514. ************************************************************************/
  4515. // GENERATED
  4516. //@import com/ibm/rave/core/internal/transitions/TransitionInfo (static) // new
  4517. //@import com/ibm/rave/core/internal/transitions/TransitionTracker (static) // new
  4518. var com_ibm_rave_core_internal_transitions_TransitionUtil = {
  4519. };
  4520. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo = function(node, namespace, id) {
  4521. var tracker = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionTracker(node, namespace);
  4522. var info = tracker[id];
  4523. if (!info) {
  4524. tracker.count++;
  4525. info = new com_ibm_rave_core_internal_transitions_TransitionInfo(tracker, id, node);
  4526. tracker[id] = info;
  4527. }
  4528. return info;
  4529. };
  4530. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionTracker = function(node, namespace) {
  4531. var tracker = node.rave_getProperty(namespace);
  4532. if (!tracker) {
  4533. tracker = new com_ibm_rave_core_internal_transitions_TransitionTracker();
  4534. node.rave_setProperty(namespace, tracker);
  4535. }
  4536. return tracker;
  4537. };
  4538. com_ibm_rave_core_internal_transitions_TransitionUtil.disposeTransition = function(node, namespace) {
  4539. node.rave_removeProperty(namespace);
  4540. };
  4541. com_ibm_rave_core_internal_transitions_TransitionUtil.interrupt = function(node) {
  4542. com_ibm_rave_core_internal_transitions_TransitionUtil.interruptNS(node, com_ibm_rave_core_internal_transitions_TransitionUtil.transitionNamespace(null));
  4543. };
  4544. com_ibm_rave_core_internal_transitions_TransitionUtil.interruptNS = function(node, namespace) {
  4545. var tracker = node.rave_getProperty(namespace);
  4546. var active;
  4547. if (tracker && (active = tracker[~~tracker.active])) {
  4548. if (--tracker.count > 0) {
  4549. delete tracker[~~tracker.active];
  4550. } else {
  4551. com_ibm_rave_core_internal_transitions_TransitionUtil.disposeTransition(node, namespace);
  4552. }
  4553. tracker.active += 0.5;
  4554. if (active.event) {
  4555. active.event["interrupt"].call(node, node.rave_getData(), active.index);
  4556. }
  4557. }
  4558. };
  4559. /**
  4560. * @param (String) name the name of the transition
  4561. * @return (String) the transition namespace
  4562. */
  4563. com_ibm_rave_core_internal_transitions_TransitionUtil.transitionNamespace = function(name) {
  4564. return name == null ? "__transition_" + "_" : "__transition_" + name + "__";
  4565. };
  4566. //com_ibm_rave_core_internal_transitions_TransitionUtil.TRANSITION_PROPERTY = "__transition_";
  4567. // $source: com/ibm/rave/core/internal/transitions/Tweener
  4568. /************************************************************************
  4569. ** IBM Confidential
  4570. **
  4571. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4572. **
  4573. ** (C) Copyright IBM Corp. 2017
  4574. **
  4575. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4576. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4577. ************************************************************************/
  4578. // GENERATED
  4579. //@import com/ibm/rave/core/nativeImpl/timer/Timer (static) // Timer
  4580. //@import com/ibm/rave/core/internal/transitions/TransitionUtil (static) // disposeTransition, getTransitionInfo
  4581. //@import com/ibm/rave/core/context/RaveOperationalMode (static) // RaveOperationalMode
  4582. var com_ibm_rave_core_internal_transitions_Tweener = {
  4583. };
  4584. /**
  4585. * Posts a timer event to perform the scheduling of the transitions. This allows multiple transitions to be aligned on the same start time.
  4586. * @param (com.ibm.rave.core.transition.Transition) transition the transitions to schedule
  4587. */
  4588. com_ibm_rave_core_internal_transitions_Tweener.schedule = function(transition) {
  4589. com_ibm_rave_core_nativeImpl_timer_Timer.INSTANCE(function(elapsed) {
  4590. com_ibm_rave_core_internal_transitions_Tweener.scheduleTransition(transition);
  4591. return true;
  4592. }, 0, Date.now());
  4593. };
  4594. /**
  4595. * Schedules the transitions by creating timer events.
  4596. * @param (com.ibm.rave.core.transition.Transition) transition the transitions to schedule
  4597. * @param startTime the time used as the start time of all transitions
  4598. * @param elapsed the time elapsed, in milli-seconds, transition was scheduled
  4599. */
  4600. com_ibm_rave_core_internal_transitions_Tweener.scheduleTransition = function(transition) {
  4601. var transitionId = transition.id;
  4602. var namespace = transition.namespace;
  4603. for (var j = 0, m = transition.length; j < m; ++j) {
  4604. var group = transition[j];
  4605. for (var i = 0, n = group.length; i < n; ++i) {
  4606. var node = group[i];
  4607. if (node) {
  4608. var info = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(node, namespace, transitionId);
  4609. if (!(info.scheduled)) {
  4610. info.setScheduled();
  4611. var tracker = info.tracker;
  4612. var infoStartTime = info.time;
  4613. com_ibm_rave_core_internal_transitions_Tweener.doSchedule(info, tracker, namespace, transitionId, infoStartTime);
  4614. }
  4615. }
  4616. }
  4617. }
  4618. };
  4619. com_ibm_rave_core_internal_transitions_Tweener.doSchedule = function(info, tracker, namespace, id, infoStartTime) {
  4620. var node = info.node;
  4621. var startTime = infoStartTime > 0.0 ? infoStartTime : com_ibm_rave_core_nativeImpl_timer_Timer.INSTANCE.currentTime();
  4622. if (infoStartTime <= 0.0) {
  4623. info.time = startTime;
  4624. }
  4625. if (tracker.active > id) {
  4626. var deadTransition = tracker[id];
  4627. com_ibm_rave_core_internal_transitions_Tweener.stop(tracker, node, namespace, id);
  4628. if (deadTransition) {
  4629. var trans = deadTransition._transition;
  4630. if (trans) {
  4631. trans.nodeTransitionComplete();
  4632. }
  4633. }
  4634. } else {
  4635. var tick;
  4636. var start = function(startElapsed) {
  4637. if (!tick) {
  4638. tick = com_ibm_rave_core_internal_transitions_Tweener.startAndCreateTick(info, tracker, namespace, id, startTime, startElapsed);
  4639. return !tick;
  4640. }
  4641. return tick(startElapsed);
  4642. };
  4643. com_ibm_rave_core_nativeImpl_timer_Timer.INSTANCE(start, 0, startTime + info.delay);
  4644. }
  4645. };
  4646. com_ibm_rave_core_internal_transitions_Tweener.startAndCreateTick = function(info, tracker, namespace, id, startTime, startElapsed) {
  4647. var node = info.node;
  4648. var index = info.index;
  4649. var groupIndex = info.groupIndex;
  4650. if (tracker.active > id) {
  4651. var deadTransition = tracker[id];
  4652. com_ibm_rave_core_internal_transitions_Tweener.stop(tracker, node, namespace, id);
  4653. if (deadTransition) {
  4654. var trans = deadTransition._transition;
  4655. if (trans) {
  4656. trans.nodeTransitionComplete();
  4657. }
  4658. }
  4659. return null;
  4660. }
  4661. var active = tracker[~~tracker.active];
  4662. if (active) {
  4663. --tracker.count;
  4664. delete tracker[~~tracker.active];
  4665. if (active.event) {
  4666. active.event["interrupt"].call(node, node.rave_getData(), active.index);
  4667. }
  4668. var trans = active._transition;
  4669. if (trans) {
  4670. trans.nodeTransitionComplete();
  4671. }
  4672. }
  4673. tracker.active = id;
  4674. if (info.event) {
  4675. info.event["start"].call(node, node.rave_getData(), index, groupIndex);
  4676. }
  4677. var tweens = info.getTweens();
  4678. var ease = info.ease;
  4679. var duration = info.duration;
  4680. var tick = function(elapsed) {
  4681. if (tracker.active != id) {
  4682. return true;
  4683. }
  4684. var t = (com_ibm_rave_core_context_RaveOperationalMode.MODE == 1) ? 1 : (elapsed / duration);
  4685. var v = !ease ? t : ease(t);
  4686. for (var __i_enFor0 = 0, __exp_enFor0 = tweens, __len_enFor0 = __exp_enFor0.length;
  4687. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4688. var tween = __exp_enFor0[__i_enFor0];
  4689. tween.call(node, v);
  4690. }
  4691. if (t >= 1) {
  4692. if (info.event) {
  4693. info.event["end"].call(node, node.rave_getData(), index, groupIndex);
  4694. }
  4695. var trans = info._transition;
  4696. if (trans) {
  4697. trans.nodeTransitionComplete();
  4698. }
  4699. return com_ibm_rave_core_internal_transitions_Tweener.stop(tracker, node, namespace, id);
  4700. }
  4701. return false;
  4702. };
  4703. com_ibm_rave_core_nativeImpl_timer_Timer.INSTANCE(function(elapsed) {
  4704. tick(startElapsed);
  4705. return true;
  4706. }, 0, startTime);
  4707. if (com_ibm_rave_core_context_RaveOperationalMode.MODE == 1) {
  4708. return null;
  4709. }
  4710. return startElapsed / duration < 1 ? tick : null;
  4711. };
  4712. com_ibm_rave_core_internal_transitions_Tweener.stop = function(tracker, node, namespace, id) {
  4713. if (--tracker.count > 0) {
  4714. delete tracker[id];
  4715. } else {
  4716. com_ibm_rave_core_internal_transitions_TransitionUtil.disposeTransition(node, namespace);
  4717. }
  4718. return true;
  4719. };
  4720. // $source: com/ibm/rave/core/internal/transitions/TweenFunctions
  4721. /************************************************************************
  4722. ** IBM Confidential
  4723. **
  4724. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4725. **
  4726. ** (C) Copyright IBM Corp. 2017
  4727. **
  4728. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4729. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4730. ************************************************************************/
  4731. // GENERATED
  4732. //@import com/ibm/rave/core/internal/nativeImpl/Lang (runtime) // isNumber
  4733. //@import com/ibm/rave/core/interpolate/Interpolators (runtime) // Interpolators
  4734. //@import com/ibm/rave/core/interpolate/TransformInterpolation (runtime) // TransformInterpolation
  4735. //@import com/ibm/rave/core/internal/transitions/TransitionUtil (runtime) // getTransitionInfo
  4736. //@import com/ibm/rave/core/internal/selector/SelectorHelper (static) // each
  4737. var com_ibm_rave_core_internal_transitions_TweenFunctions = {
  4738. };
  4739. com_ibm_rave_core_internal_transitions_TweenFunctions.style = function(name, value, priority) {
  4740. return function(data, index, groupIndex) {
  4741. var startValue = this.rave_getComputedStyle(name);
  4742. var v = value;
  4743. if (typeof v === "function") {
  4744. v = (v).call(this, data, index, groupIndex);
  4745. }
  4746. if (v == null) {
  4747. this.rave_removeStyle(name);
  4748. return null;
  4749. }
  4750. if (!(com_ibm_rave_core_internal_nativeImpl_Lang.isNumber(v)) || !(com_ibm_rave_core_internal_nativeImpl_Lang.isNumber(startValue))) {
  4751. v = v + "";
  4752. }
  4753. if (startValue!==v) {
  4754. var interpolator = com_ibm_rave_core_interpolate_Interpolators.INSTANCE.getInterpolator(startValue, v);
  4755. return function(t) {
  4756. this.rave_setStyle(name, interpolator(t), priority);
  4757. };
  4758. }
  4759. return null;
  4760. };
  4761. };
  4762. com_ibm_rave_core_internal_transitions_TweenFunctions.styleTween = function(name, factory, priority) {
  4763. return function(data, index, groupIndex) {
  4764. var startValue = this.rave_getComputedStyle(name);
  4765. var interpolator = factory.call(this, data, index, startValue);
  4766. if (interpolator) {
  4767. return function(t) {
  4768. this.rave_setStyle(name, interpolator(t), priority);
  4769. };
  4770. }
  4771. return null;
  4772. };
  4773. };
  4774. com_ibm_rave_core_internal_transitions_TweenFunctions.attr = function(qname, value) {
  4775. return function(data, index, groupIndex) {
  4776. var startValue = qname["space"] == null ? this.getAttribute(qname["local"]) : this.getAttributeNS(qname["space"], qname["local"]);
  4777. var v = value;
  4778. if (typeof v === "function") {
  4779. v = (v).call(this, data, index, groupIndex);
  4780. }
  4781. if (v == null) {
  4782. if (qname["space"] == null) {
  4783. this.removeAttribute(qname["local"]);
  4784. } else {
  4785. this.removeAttributeNS(qname["space"], qname["local"]);
  4786. }
  4787. return null;
  4788. }
  4789. if (!(com_ibm_rave_core_internal_nativeImpl_Lang.isNumber(v)) || !(com_ibm_rave_core_internal_nativeImpl_Lang.isNumber(startValue))) {
  4790. v = v + "";
  4791. }
  4792. if (startValue!==v) {
  4793. var interpolator = "transform" == qname["local"] && qname["space"] == null ? com_ibm_rave_core_interpolate_TransformInterpolation.INSTANCE(startValue == null ? null : ""+(startValue), v == null ? null : ""+(v)) : com_ibm_rave_core_interpolate_Interpolators.INSTANCE.getInterpolator(startValue, v);
  4794. if (qname["space"] == null) {
  4795. return function(t) {
  4796. this.setAttribute(qname["local"], interpolator(t));
  4797. };
  4798. }
  4799. return function(t) {
  4800. this.setAttributeNS(qname["space"], qname["local"], interpolator(t));
  4801. };
  4802. }
  4803. return null;
  4804. };
  4805. };
  4806. com_ibm_rave_core_internal_transitions_TweenFunctions.attrTween = function(qname, factory) {
  4807. return function(data, index, groupIndex) {
  4808. var startValue = qname["space"] == null ? this.getAttribute(qname["local"]) : this.getAttributeNS(qname["space"], qname["local"]);
  4809. var interpolator = factory.call(this, data, index, startValue);
  4810. if (interpolator) {
  4811. if (qname["space"] == null) {
  4812. return function(t) {
  4813. this.setAttribute(qname["local"], interpolator(t));
  4814. };
  4815. }
  4816. return function(t) {
  4817. this.setAttributeNS(qname["space"], qname["local"], interpolator(t));
  4818. };
  4819. }
  4820. return null;
  4821. };
  4822. };
  4823. com_ibm_rave_core_internal_transitions_TweenFunctions.tween = function(groups, name, value, getTween) {
  4824. var id = groups.id;
  4825. var namespace = groups.namespace;
  4826. var callback;
  4827. if (typeof value === "function") {
  4828. callback = function(data, index, groupIndex) {
  4829. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(this, namespace, id).addTweenFactory(name, getTween((value).call(this, data, index, groupIndex)));
  4830. };
  4831. } else {
  4832. var tweenFactory = getTween(value);
  4833. callback = function(data, index, groupIndex) {
  4834. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(this, namespace, id).addTweenFactory(name, tweenFactory);
  4835. };
  4836. }
  4837. return com_ibm_rave_core_internal_selector_SelectorHelper.each(groups, callback);
  4838. };
  4839. // $source: com/ibm/rave/core/interpolate/Interpolators
  4840. /************************************************************************
  4841. ** IBM Confidential
  4842. **
  4843. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4844. **
  4845. ** (C) Copyright IBM Corp. 2017
  4846. **
  4847. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4848. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4849. ************************************************************************/
  4850. // GENERATED
  4851. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4852. //@import com/ibm/rave/core/internal/nativeImpl/Lang (runtime) // isObject, isString, isArray, isList
  4853. //@import com/ibm/rave/core/color/Colors (runtime) // isRGBColorName
  4854. //@import com/ibm/rave/core/interpolate/ColorInterpolation (runtime) // ColorInterpolation
  4855. //@import com/ibm/rave/core/interpolate/StringInterpolation (runtime) // StringInterpolation
  4856. //@import com/ibm/rave/core/color/Color (runtime) // new
  4857. //@import com/ibm/rave/core/interpolate/ArrayInterpolation (runtime) // ArrayInterpolation
  4858. //@import com/ibm/rave/core/nativeImpl/interpolate/ObjectInterpolation (runtime) // ObjectInterpolation
  4859. //@import com/ibm/rave/core/interpolate/NumberInterpolation (runtime) // NumberInterpolation
  4860. var com_ibm_rave_core_interpolate_Interpolators = rave_externs["Interpolators"] = com_ibm_rave_core_nativeImpl_Declare(Array, {
  4861. /** @expose */
  4862. constructor : function() {},
  4863. /** @expose */
  4864. initialize : function() {
  4865. this.push(function(a, b) {
  4866. if (com_ibm_rave_core_internal_nativeImpl_Lang.isString(b)) {
  4867. if (com_ibm_rave_core_color_Colors.isRGBColorName(b) || (b).match("#[a-z|A-Z|0-9]*|rgba?\\(.*|hsla?\\(.*")) {
  4868. return com_ibm_rave_core_interpolate_ColorInterpolation.RGBINSTANCE(a, b);
  4869. }
  4870. return com_ibm_rave_core_interpolate_StringInterpolation.INSTANCE(a, b);
  4871. } else if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(b, com_ibm_rave_core_color_Color)) {
  4872. return com_ibm_rave_core_interpolate_ColorInterpolation.RGBINSTANCE(a, b);
  4873. } else if (com_ibm_rave_core_internal_nativeImpl_Lang.isArray(b)) {
  4874. return com_ibm_rave_core_interpolate_ArrayInterpolation.INSTANCE(a, b);
  4875. } else if (com_ibm_rave_core_internal_nativeImpl_Lang.isList(b) || (com_ibm_rave_core_internal_nativeImpl_Lang.isObject(b) && isNaN(b))) {
  4876. return com_ibm_rave_core_nativeImpl_interpolate_ObjectInterpolation.INSTANCE(a, b);
  4877. }
  4878. return com_ibm_rave_core_interpolate_NumberInterpolation.INSTANCE(a, b);
  4879. });
  4880. return this;
  4881. },
  4882. /**
  4883. * Get an interpolator for the given values.
  4884. * @param (Object) a the start value
  4885. * @param (Object) b the end value
  4886. * @return (com.ibm.rave.core.interpolate.Interpolator) an interpolator
  4887. */
  4888. /** @expose */
  4889. getInterpolator : function(a, b) {
  4890. var result;
  4891. for (var i = this.length - 1; !result && i >= 0; --i) {
  4892. result = this[i](a, b);
  4893. }
  4894. return result;
  4895. }
  4896. });
  4897. /** @expose */
  4898. com_ibm_rave_core_interpolate_Interpolators.INSTANCE = new com_ibm_rave_core_interpolate_Interpolators().initialize();
  4899. // $source: com/ibm/rave/core/color/Color
  4900. /************************************************************************
  4901. ** IBM Confidential
  4902. **
  4903. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4904. **
  4905. ** (C) Copyright IBM Corp. 2017
  4906. **
  4907. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4908. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4909. ************************************************************************/
  4910. // GENERATED
  4911. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4912. var com_ibm_rave_core_color_Color = rave_externs["Color"] = com_ibm_rave_core_nativeImpl_Declare({
  4913. /** @expose */
  4914. constructor : function() {},
  4915. /**
  4916. * Create a new RGB color object.
  4917. * @return (com.ibm.rave.core.color.RGB) RGB New RGB color
  4918. */
  4919. /** @expose */
  4920. rgb : function() {},
  4921. /**
  4922. * Return a color object that is one "level" brighter. The level of brightness is determined by the Color implementation.
  4923. * @return (com.ibm.rave.core.color.Color) Color New Color that is one level brighter than the calling Color.
  4924. */
  4925. brighter$0 : function() {
  4926. return this.brighter$1(1);
  4927. },
  4928. /**
  4929. * Return a color object that is one "level" darker. The level of darkness is determined by the Color implementation.
  4930. * @return (com.ibm.rave.core.color.Color) Color New Color that is one level darker than the calling Color.
  4931. */
  4932. darker$0 : function() {
  4933. return this.darker$1(1);
  4934. },
  4935. /**
  4936. * Return a string representation of this color. Typically returned as a string in the format "#rrggbb".
  4937. * @return (String) String representation in "#rrggbb" format.
  4938. */
  4939. /** @expose */
  4940. toString : function() {
  4941. return this.rgb().toString();
  4942. },
  4943. /** @expose */
  4944. getLuminance : function() {},
  4945. /** @expose */
  4946. brighter : function(a0) {
  4947. var args = arguments;
  4948. if (args.length == 0) {
  4949. return this.brighter$0();
  4950. }
  4951. return this.brighter$1(a0);
  4952. },
  4953. /** @expose */
  4954. darker : function(a0) {
  4955. var args = arguments;
  4956. if (args.length == 0) {
  4957. return this.darker$0();
  4958. }
  4959. return this.darker$1(a0);
  4960. },
  4961. /** @expose */
  4962. contrastShift : function(a0, a1) {
  4963. var args = arguments;
  4964. if (args.length == 0) {
  4965. return this.contrastShift$0();
  4966. }
  4967. if (args.length == 1 && (a0 == null || typeof a0 === "number")) {
  4968. return this.contrastShift$2(a0);
  4969. }
  4970. if (args.length == 1) {
  4971. return this.contrastShift$1(a0);
  4972. }
  4973. return this.contrastShift$3(a0, a1);
  4974. }
  4975. /**
  4976. * Return a color object that is "k" levels brighter than the current Color.
  4977. * @param (double) k Amount of brightness to apply to the current color.
  4978. * @return (com.ibm.rave.core.color.Color) New color that is "k" levels brighter than the current color.
  4979. */
  4980. //brighter$1 : function(k) {},
  4981. /**
  4982. * Return a color object that is "k" levels brighter than the current Color.
  4983. * @param (double) k Amount of brightness to apply to the current color.
  4984. * @return (com.ibm.rave.core.color.Color) New color that is "k" levels brighter than the current color.
  4985. */
  4986. //darker$1 : function(k) {},
  4987. /**
  4988. * Supplies a color that will contrast the color contained within the color object using the default ratio of 4.5
  4989. * @return (com.ibm.rave.core.color.Color) A contrasting color
  4990. */
  4991. //contrastShift$0 : function() {},
  4992. /**
  4993. * 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.
  4994. * @param (Object) color The color to be contrasted
  4995. * @return (com.ibm.rave.core.color.Color) A contrasting color
  4996. */
  4997. //contrastShift$1 : function(color) {},
  4998. /**
  4999. * Supplies a color that will contrast the color contained within the color object using the contrast ratio passed in
  5000. * @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
  5001. * @return (com.ibm.rave.core.color.Color) A contrasting color
  5002. */
  5003. //contrastShift$2 : function(ratio) {},
  5004. /**
  5005. * 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.
  5006. * @param (Object) color The color to be contrasted
  5007. * @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
  5008. * @return (com.ibm.rave.core.color.Color) A contrasting color
  5009. */
  5010. //contrastShift$3 : function(color, ratio) {}
  5011. });
  5012. // $source: com/ibm/rave/core/color/HSL
  5013. /************************************************************************
  5014. ** IBM Confidential
  5015. **
  5016. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5017. **
  5018. ** (C) Copyright IBM Corp. 2017
  5019. **
  5020. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5021. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5022. ************************************************************************/
  5023. // GENERATED
  5024. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5025. //@import com/ibm/rave/core/color/Color (loadtime) // superclass
  5026. //@import com/ibm/rave/core/color/Colors (runtime) // newRGB, hsl_rgb
  5027. //@import com/ibm/rave/core/internal/color/ContrastShift (runtime) // getLuminance, updateColor
  5028. /**
  5029. * 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.
  5030. */
  5031. var com_ibm_rave_core_color_HSL = rave_externs["HSL"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_color_Color, {
  5032. /**
  5033. * @expose
  5034. */
  5035. h : 0,
  5036. /**
  5037. * @expose
  5038. */
  5039. s : 0,
  5040. /**
  5041. * @expose
  5042. */
  5043. l : 0,
  5044. /**
  5045. * @expose
  5046. */
  5047. a : 0,
  5048. constructor : function(h, s, l, a) {
  5049. this.h = + (h);
  5050. this.s = + (s);
  5051. this.l = + (l);
  5052. this.a = + (a);
  5053. },
  5054. /** @expose */
  5055. rgb : function() {
  5056. return com_ibm_rave_core_color_Colors.hsl_rgb(this.h, this.s, this.l, this.a);
  5057. },
  5058. /** @expose */
  5059. brighter$1 : function(k) {
  5060. var _k = Math.pow(0.7, k);
  5061. return new com_ibm_rave_core_color_HSL(this.h, this.s, this.l / _k, this.a);
  5062. },
  5063. /** @expose */
  5064. darker$1 : function(k) {
  5065. var _k = Math.pow(0.7, k);
  5066. return new com_ibm_rave_core_color_HSL(this.h, this.s, _k * this.l, this.a);
  5067. },
  5068. /**
  5069. * A getter for the hue value
  5070. * @return (double) the hue value
  5071. */
  5072. /** @expose */
  5073. getH : function() {
  5074. return this.h;
  5075. },
  5076. /**
  5077. * A getter for the saturation value
  5078. * @return (double) the saturation value
  5079. */
  5080. /** @expose */
  5081. getS : function() {
  5082. return this.s;
  5083. },
  5084. /**
  5085. * A getter for the lightness value
  5086. * @return (double) the lightness value
  5087. */
  5088. /** @expose */
  5089. getL : function() {
  5090. return this.l;
  5091. },
  5092. /**
  5093. * Return the alpha value
  5094. * @return (double) the alpha value
  5095. */
  5096. /** @expose */
  5097. getA : function() {
  5098. return this.a;
  5099. },
  5100. contrastShift$0 : function() {
  5101. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$0(this.rgb(), this.rgb()).hsl();
  5102. },
  5103. contrastShift$1 : function(color) {
  5104. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$0(this.rgb(), com_ibm_rave_core_color_Colors.newRGB(color)).hsl();
  5105. },
  5106. contrastShift$2 : function(ratio) {
  5107. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$1(this.rgb(), this.rgb(), ratio).hsl();
  5108. },
  5109. contrastShift$3 : function(color, ratio) {
  5110. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$1(this.rgb(), com_ibm_rave_core_color_Colors.newRGB(color), ratio).hsl();
  5111. },
  5112. /** @expose */
  5113. getLuminance : function() {
  5114. return com_ibm_rave_core_internal_color_ContrastShift.getLuminance(this.rgb());
  5115. },
  5116. /** @expose */
  5117. contrastShift : function(a0, a1) {
  5118. var args = arguments;
  5119. if (args.length == 0) {
  5120. return this.contrastShift$0();
  5121. }
  5122. if (args.length == 1 && (a0 == null || typeof a0 === "number")) {
  5123. return this.contrastShift$2(a0);
  5124. }
  5125. if (args.length == 1) {
  5126. return this.contrastShift$1(a0);
  5127. }
  5128. return this.contrastShift$3(a0, a1);
  5129. }
  5130. });
  5131. // $source: com/ibm/rave/core/color/RGB
  5132. /************************************************************************
  5133. ** IBM Confidential
  5134. **
  5135. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5136. **
  5137. ** (C) Copyright IBM Corp. 2017
  5138. **
  5139. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5140. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5141. ************************************************************************/
  5142. // GENERATED
  5143. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5144. //@import com/ibm/rave/core/color/Color (loadtime) // superclass
  5145. //@import com/ibm/rave/core/color/Colors (runtime) // rgb_lab, rgb_hex, rgb_hsl, newRGB
  5146. //@import com/ibm/rave/core/internal/color/ContrastShift (runtime) // getLuminance, updateColor
  5147. /**
  5148. * 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
  5149. */
  5150. var com_ibm_rave_core_color_RGB = rave_externs["RGB"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_color_Color, {
  5151. /**
  5152. * @expose
  5153. */
  5154. r : 0,
  5155. /**
  5156. * @expose
  5157. */
  5158. g : 0,
  5159. /**
  5160. * @expose
  5161. */
  5162. b : 0,
  5163. /**
  5164. * @expose
  5165. */
  5166. a : 0,
  5167. constructor : function(r, g, b, a) {
  5168. this.r = ~~r;
  5169. this.g = ~~g;
  5170. this.b = ~~b;
  5171. this.a = a;
  5172. },
  5173. /** @expose */
  5174. rgb : function() {
  5175. return this;
  5176. },
  5177. /** @expose */
  5178. hsl : function() {
  5179. return com_ibm_rave_core_color_Colors.rgb_hsl(this.r, this.g, this.b, this.a);
  5180. },
  5181. lab : function() {
  5182. return com_ibm_rave_core_color_Colors.rgb_lab(this.r, this.g, this.b);
  5183. },
  5184. /** @expose */
  5185. brighter$1 : function(k) {
  5186. var r = this.r, g = this.g, b = this.b, i = 30;
  5187. if (r == 0 && g == 0 && b == 0) {
  5188. return new com_ibm_rave_core_color_RGB(i, i, i, this.a);
  5189. }
  5190. if (r != 0 && r < i) {
  5191. r = i;
  5192. }
  5193. if (g != 0 && g < i) {
  5194. g = i;
  5195. }
  5196. if (b != 0 && b < i) {
  5197. b = i;
  5198. }
  5199. var _k = Math.pow(0.7, k);
  5200. 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);
  5201. },
  5202. /** @expose */
  5203. darker$1 : function(k) {
  5204. var _k = Math.pow(0.7, k);
  5205. return new com_ibm_rave_core_color_RGB(~~(_k * this.r), ~~(_k * this.g), ~~(_k * this.b), this.a);
  5206. },
  5207. /** @expose */
  5208. toString : function() {
  5209. if (this.a != 1) {
  5210. return "rgba(" + this.r + "," + this.g + "," + this.b + "," + this.a + ")";
  5211. }
  5212. 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);
  5213. },
  5214. /**
  5215. * A getter for the R-channel (red)
  5216. * @return (int) the R-channel value
  5217. */
  5218. /** @expose */
  5219. getR : function() {
  5220. return this.r;
  5221. },
  5222. /**
  5223. * A getter for the G-channel (green) value
  5224. * @return (int) the G-channel value
  5225. */
  5226. /** @expose */
  5227. getG : function() {
  5228. return this.g;
  5229. },
  5230. /**
  5231. * A getter for the B-channel (blue) value
  5232. * @return (int) the B-channel value
  5233. */
  5234. /** @expose */
  5235. getB : function() {
  5236. return this.b;
  5237. },
  5238. /**
  5239. * A getter for the A-channel (alpha channel for opacity) value
  5240. * @return (double) the A-channel value
  5241. */
  5242. /** @expose */
  5243. getA : function() {
  5244. return this.a;
  5245. },
  5246. contrastShift$0 : function() {
  5247. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$0(this.rgb(), this.rgb());
  5248. },
  5249. contrastShift$1 : function(color) {
  5250. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$0(this.rgb(), com_ibm_rave_core_color_Colors.newRGB(color));
  5251. },
  5252. contrastShift$2 : function(ratio) {
  5253. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$1(this.rgb(), this.rgb(), ratio);
  5254. },
  5255. contrastShift$3 : function(color, ratio) {
  5256. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$1(this.rgb(), com_ibm_rave_core_color_Colors.newRGB(color), ratio);
  5257. },
  5258. /** @expose */
  5259. getLuminance : function() {
  5260. return com_ibm_rave_core_internal_color_ContrastShift.getLuminance(this.rgb());
  5261. },
  5262. /** @expose */
  5263. contrastShift : function(a0, a1) {
  5264. var args = arguments;
  5265. if (args.length == 0) {
  5266. return this.contrastShift$0();
  5267. }
  5268. if (args.length == 1 && (a0 == null || typeof a0 === "number")) {
  5269. return this.contrastShift$2(a0);
  5270. }
  5271. if (args.length == 1) {
  5272. return this.contrastShift$1(a0);
  5273. }
  5274. return this.contrastShift$3(a0, a1);
  5275. }
  5276. });
  5277. // $source: com/ibm/rave/core/color/LAB
  5278. /************************************************************************
  5279. ** IBM Confidential
  5280. **
  5281. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5282. **
  5283. ** (C) Copyright IBM Corp. 2017
  5284. **
  5285. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5286. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5287. ************************************************************************/
  5288. // GENERATED
  5289. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5290. //@import com/ibm/rave/core/color/Color (loadtime) // superclass
  5291. //@import com/ibm/rave/core/color/Colors (runtime) // lab_rgb, Colors, newRGB, lab_hcl
  5292. //@import com/ibm/rave/core/internal/color/ContrastShift (runtime) // getLuminance, updateColor
  5293. /**
  5294. * 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.
  5295. */
  5296. var com_ibm_rave_core_color_LAB = rave_externs["LAB"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_color_Color, {
  5297. /**
  5298. * @expose
  5299. */
  5300. l : 0,
  5301. /**
  5302. * @expose
  5303. */
  5304. a : 0,
  5305. /**
  5306. * @expose
  5307. */
  5308. b : 0,
  5309. constructor : function(l, a, b) {
  5310. this.l = + (l);
  5311. this.a = + (a);
  5312. this.b = + (b);
  5313. },
  5314. /** @expose */
  5315. rgb : function() {
  5316. return com_ibm_rave_core_color_Colors.lab_rgb(this.l, this.a, this.b);
  5317. },
  5318. /** @expose */
  5319. brighter$1 : function(k) {
  5320. 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);
  5321. },
  5322. /** @expose */
  5323. darker$1 : function(k) {
  5324. 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);
  5325. },
  5326. hcl : function() {
  5327. return com_ibm_rave_core_color_Colors.lab_hcl(this.l, this.a, this.b);
  5328. },
  5329. /**
  5330. * A getter for the L-channel/Lightness value
  5331. * @return (double) the L-channel value
  5332. */
  5333. /** @expose */
  5334. getL : function() {
  5335. return this.l;
  5336. },
  5337. /**
  5338. * A getter for the A-channel value
  5339. * @return (double) the A-channel value
  5340. */
  5341. /** @expose */
  5342. getA : function() {
  5343. return this.a;
  5344. },
  5345. /**
  5346. * A getter for the B-channel value
  5347. * @return (double) the B-channel value
  5348. */
  5349. /** @expose */
  5350. getB : function() {
  5351. return this.b;
  5352. },
  5353. contrastShift$0 : function() {
  5354. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$0(this.rgb(), this.rgb()).lab();
  5355. },
  5356. contrastShift$1 : function(color) {
  5357. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$0(this.rgb(), com_ibm_rave_core_color_Colors.newRGB(color)).lab();
  5358. },
  5359. contrastShift$2 : function(ratio) {
  5360. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$1(this.rgb(), this.rgb(), ratio).lab();
  5361. },
  5362. contrastShift$3 : function(color, ratio) {
  5363. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$1(this.rgb(), com_ibm_rave_core_color_Colors.newRGB(color), ratio).lab();
  5364. },
  5365. /** @expose */
  5366. getLuminance : function() {
  5367. return com_ibm_rave_core_internal_color_ContrastShift.getLuminance(this.rgb());
  5368. },
  5369. /** @expose */
  5370. contrastShift : function(a0, a1) {
  5371. var args = arguments;
  5372. if (args.length == 0) {
  5373. return this.contrastShift$0();
  5374. }
  5375. if (args.length == 1 && (a0 == null || typeof a0 === "number")) {
  5376. return this.contrastShift$2(a0);
  5377. }
  5378. if (args.length == 1) {
  5379. return this.contrastShift$1(a0);
  5380. }
  5381. return this.contrastShift$3(a0, a1);
  5382. }
  5383. });
  5384. // $source: com/ibm/rave/core/color/HCL
  5385. /************************************************************************
  5386. ** IBM Confidential
  5387. **
  5388. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5389. **
  5390. ** (C) Copyright IBM Corp. 2017
  5391. **
  5392. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5393. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5394. ************************************************************************/
  5395. // GENERATED
  5396. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5397. //@import com/ibm/rave/core/color/Color (loadtime) // superclass
  5398. //@import com/ibm/rave/core/color/Colors (runtime) // Colors, newRGB, hcl_lab
  5399. //@import com/ibm/rave/core/internal/color/ContrastShift (runtime) // getLuminance, updateColor
  5400. /**
  5401. * 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.
  5402. */
  5403. var com_ibm_rave_core_color_HCL = rave_externs["HCL"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_color_Color, {
  5404. /**
  5405. * @expose
  5406. */
  5407. h : 0,
  5408. /**
  5409. * @expose
  5410. */
  5411. c : 0,
  5412. /**
  5413. * @expose
  5414. */
  5415. l : 0,
  5416. constructor : function(h, c, l) {
  5417. this.h = + (h);
  5418. this.c = + (c);
  5419. this.l = + (l);
  5420. },
  5421. /** @expose */
  5422. rgb : function() {
  5423. return this.lab().rgb();
  5424. },
  5425. /** @expose */
  5426. brighter$1 : function(k) {
  5427. 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)));
  5428. },
  5429. /** @expose */
  5430. darker$1 : function(k) {
  5431. 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)));
  5432. },
  5433. lab : function() {
  5434. return com_ibm_rave_core_color_Colors.hcl_lab(this.h, this.c, this.l);
  5435. },
  5436. /**
  5437. * A getter for the hue value
  5438. * @return (double) the hue value
  5439. */
  5440. /** @expose */
  5441. getH : function() {
  5442. return this.h;
  5443. },
  5444. /**
  5445. * A getter for the chroma value
  5446. * @return (double) the chroma value
  5447. */
  5448. /** @expose */
  5449. getC : function() {
  5450. return this.c;
  5451. },
  5452. /**
  5453. * A getter for the luminance value
  5454. * @return (double) the luminance value
  5455. */
  5456. /** @expose */
  5457. getL : function() {
  5458. return this.l;
  5459. },
  5460. contrastShift$0 : function() {
  5461. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$0(this.rgb(), this.rgb()).lab().hcl();
  5462. },
  5463. contrastShift$1 : function(color) {
  5464. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$0(this.rgb(), com_ibm_rave_core_color_Colors.newRGB(color)).lab().hcl();
  5465. },
  5466. contrastShift$2 : function(ratio) {
  5467. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$1(this.rgb(), this.rgb(), ratio).lab().hcl();
  5468. },
  5469. contrastShift$3 : function(color, ratio) {
  5470. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$1(this.rgb(), com_ibm_rave_core_color_Colors.newRGB(color), ratio).lab().hcl();
  5471. },
  5472. /** @expose */
  5473. getLuminance : function() {
  5474. return com_ibm_rave_core_internal_color_ContrastShift.getLuminance(this.rgb());
  5475. },
  5476. /** @expose */
  5477. contrastShift : function(a0, a1) {
  5478. var args = arguments;
  5479. if (args.length == 0) {
  5480. return this.contrastShift$0();
  5481. }
  5482. if (args.length == 1 && (a0 == null || typeof a0 === "number")) {
  5483. return this.contrastShift$2(a0);
  5484. }
  5485. if (args.length == 1) {
  5486. return this.contrastShift$1(a0);
  5487. }
  5488. return this.contrastShift$3(a0, a1);
  5489. }
  5490. });
  5491. // $source: com/ibm/rave/core/color/Colors
  5492. /************************************************************************
  5493. ** IBM Confidential
  5494. **
  5495. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5496. **
  5497. ** (C) Copyright IBM Corp. 2017
  5498. **
  5499. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5500. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5501. ************************************************************************/
  5502. // GENERATED
  5503. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5504. //@import com/ibm/rave/core/context/RaveContextManager (static) // RaveContextManager
  5505. //@import com/ibm/rave/core/color/HSL (static) // new
  5506. //@import com/ibm/rave/core/color/RGB (static) // new
  5507. //@import com/ibm/rave/core/color/LAB (static) // new
  5508. //@import com/ibm/rave/core/color/HCL (static) // new
  5509. //@import com/ibm/rave/core/color/Color (static) // new
  5510. /**
  5511. * A utility class with methods needed to create and different Color objects in different color spaces
  5512. */
  5513. var com_ibm_rave_core_color_Colors = com_ibm_rave_core_nativeImpl_Declare({
  5514. //constructor : function() {}
  5515. });
  5516. com_ibm_rave_core_color_Colors.getColorsRegExp = function() {
  5517. var regexp = com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData("COLORS_REG_EXP_KEY");
  5518. if (!regexp) {
  5519. regexp = new RegExp("([a-z]+)\\((.*)\\)", "i");
  5520. com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().putData("COLORS_REG_EXP_KEY", regexp);
  5521. }
  5522. return regexp;
  5523. };
  5524. com_ibm_rave_core_color_Colors.initialize_rgb_names = function() {
  5525. var rgb_names = {};
  5526. rgb_names["aliceblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0xf0f8ff);
  5527. rgb_names["antiquewhite"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfaebd7);
  5528. rgb_names["aqua"] = com_ibm_rave_core_color_Colors.rgbNumber(0x00ffff);
  5529. rgb_names["aquamarine"] = com_ibm_rave_core_color_Colors.rgbNumber(0x7fffd4);
  5530. rgb_names["azure"] = com_ibm_rave_core_color_Colors.rgbNumber(0xf0ffff);
  5531. rgb_names["beige"] = com_ibm_rave_core_color_Colors.rgbNumber(0xf5f5dc);
  5532. rgb_names["bisque"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffe4c4);
  5533. rgb_names["black"] = com_ibm_rave_core_color_Colors.rgbNumber(0x000000);
  5534. rgb_names["blanchedalmond"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffebcd);
  5535. rgb_names["blue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x0000ff);
  5536. rgb_names["blueviolet"] = com_ibm_rave_core_color_Colors.rgbNumber(0x8a2be2);
  5537. rgb_names["brown"] = com_ibm_rave_core_color_Colors.rgbNumber(0xa52a2a);
  5538. rgb_names["burlywood"] = com_ibm_rave_core_color_Colors.rgbNumber(0xdeb887);
  5539. rgb_names["cadetblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x5f9ea0);
  5540. rgb_names["chartreuse"] = com_ibm_rave_core_color_Colors.rgbNumber(0x7fff00);
  5541. rgb_names["chocolate"] = com_ibm_rave_core_color_Colors.rgbNumber(0xd2691e);
  5542. rgb_names["coral"] = com_ibm_rave_core_color_Colors.rgbNumber(0xff7f50);
  5543. rgb_names["cornflowerblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x6495ed);
  5544. rgb_names["cornsilk"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfff8dc);
  5545. rgb_names["crimson"] = com_ibm_rave_core_color_Colors.rgbNumber(0xdc143c);
  5546. rgb_names["cyan"] = com_ibm_rave_core_color_Colors.rgbNumber(0x00ffff);
  5547. rgb_names["darkblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x00008b);
  5548. rgb_names["darkcyan"] = com_ibm_rave_core_color_Colors.rgbNumber(0x008b8b);
  5549. rgb_names["darkgoldenrod"] = com_ibm_rave_core_color_Colors.rgbNumber(0xb8860b);
  5550. rgb_names["darkgray"] = com_ibm_rave_core_color_Colors.rgbNumber(0xa9a9a9);
  5551. rgb_names["darkgreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x006400);
  5552. rgb_names["darkgrey"] = com_ibm_rave_core_color_Colors.rgbNumber(0xa9a9a9);
  5553. rgb_names["darkkhaki"] = com_ibm_rave_core_color_Colors.rgbNumber(0xbdb76b);
  5554. rgb_names["darkolivegreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x556b2f);
  5555. rgb_names["darkorange"] = com_ibm_rave_core_color_Colors.rgbNumber(0xff8c00);
  5556. rgb_names["darkorchid"] = com_ibm_rave_core_color_Colors.rgbNumber(0x9932cc);
  5557. rgb_names["darkred"] = com_ibm_rave_core_color_Colors.rgbNumber(0x8b0000);
  5558. rgb_names["darksalmon"] = com_ibm_rave_core_color_Colors.rgbNumber(0xe9967a);
  5559. rgb_names["darkseagreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x8fbc8f);
  5560. rgb_names["darkslateblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x483d8b);
  5561. rgb_names["darkslategray"] = com_ibm_rave_core_color_Colors.rgbNumber(0x2f4f4f);
  5562. rgb_names["darkslategrey"] = com_ibm_rave_core_color_Colors.rgbNumber(0x2f4f4f);
  5563. rgb_names["darkturquoise"] = com_ibm_rave_core_color_Colors.rgbNumber(0x00ced1);
  5564. rgb_names["darkviolet"] = com_ibm_rave_core_color_Colors.rgbNumber(0x9400d3);
  5565. rgb_names["deeppink"] = com_ibm_rave_core_color_Colors.rgbNumber(0xff1493);
  5566. rgb_names["deepskyblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x00bfff);
  5567. rgb_names["dimgray"] = com_ibm_rave_core_color_Colors.rgbNumber(0x696969);
  5568. rgb_names["dimgrey"] = com_ibm_rave_core_color_Colors.rgbNumber(0x696969);
  5569. rgb_names["dodgerblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x1e90ff);
  5570. rgb_names["firebrick"] = com_ibm_rave_core_color_Colors.rgbNumber(0xb22222);
  5571. rgb_names["floralwhite"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfffaf0);
  5572. rgb_names["forestgreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x228b22);
  5573. rgb_names["fuchsia"] = com_ibm_rave_core_color_Colors.rgbNumber(0xff00ff);
  5574. rgb_names["gainsboro"] = com_ibm_rave_core_color_Colors.rgbNumber(0xdcdcdc);
  5575. rgb_names["ghostwhite"] = com_ibm_rave_core_color_Colors.rgbNumber(0xf8f8ff);
  5576. rgb_names["gold"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffd700);
  5577. rgb_names["goldenrod"] = com_ibm_rave_core_color_Colors.rgbNumber(0xdaa520);
  5578. rgb_names["gray"] = com_ibm_rave_core_color_Colors.rgbNumber(0x808080);
  5579. rgb_names["green"] = com_ibm_rave_core_color_Colors.rgbNumber(0x008000);
  5580. rgb_names["greenyellow"] = com_ibm_rave_core_color_Colors.rgbNumber(0xadff2f);
  5581. rgb_names["grey"] = com_ibm_rave_core_color_Colors.rgbNumber(0x808080);
  5582. rgb_names["honeydew"] = com_ibm_rave_core_color_Colors.rgbNumber(0xf0fff0);
  5583. rgb_names["hotpink"] = com_ibm_rave_core_color_Colors.rgbNumber(0xff69b4);
  5584. rgb_names["indianred"] = com_ibm_rave_core_color_Colors.rgbNumber(0xcd5c5c);
  5585. rgb_names["indigo"] = com_ibm_rave_core_color_Colors.rgbNumber(0x4b0082);
  5586. rgb_names["ivory"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfffff0);
  5587. rgb_names["khaki"] = com_ibm_rave_core_color_Colors.rgbNumber(0xf0e68c);
  5588. rgb_names["lavender"] = com_ibm_rave_core_color_Colors.rgbNumber(0xe6e6fa);
  5589. rgb_names["lavenderblush"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfff0f5);
  5590. rgb_names["lawngreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x7cfc00);
  5591. rgb_names["lemonchiffon"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfffacd);
  5592. rgb_names["lightblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0xadd8e6);
  5593. rgb_names["lightcoral"] = com_ibm_rave_core_color_Colors.rgbNumber(0xf08080);
  5594. rgb_names["lightcyan"] = com_ibm_rave_core_color_Colors.rgbNumber(0xe0ffff);
  5595. rgb_names["lightgoldenrodyellow"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfafad2);
  5596. rgb_names["lightgray"] = com_ibm_rave_core_color_Colors.rgbNumber(0xd3d3d3);
  5597. rgb_names["lightgreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x90ee90);
  5598. rgb_names["lightgrey"] = com_ibm_rave_core_color_Colors.rgbNumber(0xd3d3d3);
  5599. rgb_names["lightpink"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffb6c1);
  5600. rgb_names["lightsalmon"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffa07a);
  5601. rgb_names["lightseagreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x20b2aa);
  5602. rgb_names["lightskyblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x87cefa);
  5603. rgb_names["lightslategray"] = com_ibm_rave_core_color_Colors.rgbNumber(0x778899);
  5604. rgb_names["lightslategrey"] = com_ibm_rave_core_color_Colors.rgbNumber(0x778899);
  5605. rgb_names["lightsteelblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0xb0c4de);
  5606. rgb_names["lightyellow"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffffe0);
  5607. rgb_names["lime"] = com_ibm_rave_core_color_Colors.rgbNumber(0x00ff00);
  5608. rgb_names["limegreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x32cd32);
  5609. rgb_names["linen"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfaf0e6);
  5610. rgb_names["magenta"] = com_ibm_rave_core_color_Colors.rgbNumber(0xff00ff);
  5611. rgb_names["maroon"] = com_ibm_rave_core_color_Colors.rgbNumber(0x800000);
  5612. rgb_names["mediumaquamarine"] = com_ibm_rave_core_color_Colors.rgbNumber(0x66cdaa);
  5613. rgb_names["mediumblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x0000cd);
  5614. rgb_names["mediumorchid"] = com_ibm_rave_core_color_Colors.rgbNumber(0xba55d3);
  5615. rgb_names["mediumpurple"] = com_ibm_rave_core_color_Colors.rgbNumber(0x9370db);
  5616. rgb_names["mediumseagreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x3cb371);
  5617. rgb_names["mediumslateblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x7b68ee);
  5618. rgb_names["mediumspringgreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x00fa9a);
  5619. rgb_names["mediumturquoise"] = com_ibm_rave_core_color_Colors.rgbNumber(0x48d1cc);
  5620. rgb_names["mediumvioletred"] = com_ibm_rave_core_color_Colors.rgbNumber(0xc71585);
  5621. rgb_names["midnightblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x191970);
  5622. rgb_names["mintcream"] = com_ibm_rave_core_color_Colors.rgbNumber(0xf5fffa);
  5623. rgb_names["mistyrose"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffe4e1);
  5624. rgb_names["moccasin"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffe4b5);
  5625. rgb_names["navajowhite"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffdead);
  5626. rgb_names["navy"] = com_ibm_rave_core_color_Colors.rgbNumber(0x000080);
  5627. rgb_names["oldlace"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfdf5e6);
  5628. rgb_names["olive"] = com_ibm_rave_core_color_Colors.rgbNumber(0x808000);
  5629. rgb_names["olivedrab"] = com_ibm_rave_core_color_Colors.rgbNumber(0x6b8e23);
  5630. rgb_names["orange"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffa500);
  5631. rgb_names["orangered"] = com_ibm_rave_core_color_Colors.rgbNumber(0xff4500);
  5632. rgb_names["orchid"] = com_ibm_rave_core_color_Colors.rgbNumber(0xda70d6);
  5633. rgb_names["palegoldenrod"] = com_ibm_rave_core_color_Colors.rgbNumber(0xeee8aa);
  5634. rgb_names["palegreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x98fb98);
  5635. rgb_names["paleturquoise"] = com_ibm_rave_core_color_Colors.rgbNumber(0xafeeee);
  5636. rgb_names["palevioletred"] = com_ibm_rave_core_color_Colors.rgbNumber(0xdb7093);
  5637. rgb_names["papayawhip"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffefd5);
  5638. rgb_names["peachpuff"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffdab9);
  5639. rgb_names["peru"] = com_ibm_rave_core_color_Colors.rgbNumber(0xcd853f);
  5640. rgb_names["pink"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffc0cb);
  5641. rgb_names["plum"] = com_ibm_rave_core_color_Colors.rgbNumber(0xdda0dd);
  5642. rgb_names["powderblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0xb0e0e6);
  5643. rgb_names["purple"] = com_ibm_rave_core_color_Colors.rgbNumber(0x800080);
  5644. rgb_names["rebeccapurple"] = com_ibm_rave_core_color_Colors.rgbNumber(0x663399);
  5645. rgb_names["red"] = com_ibm_rave_core_color_Colors.rgbNumber(0xff0000);
  5646. rgb_names["rosybrown"] = com_ibm_rave_core_color_Colors.rgbNumber(0xbc8f8f);
  5647. rgb_names["royalblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x4169e1);
  5648. rgb_names["saddlebrown"] = com_ibm_rave_core_color_Colors.rgbNumber(0x8b4513);
  5649. rgb_names["salmon"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfa8072);
  5650. rgb_names["sandybrown"] = com_ibm_rave_core_color_Colors.rgbNumber(0xf4a460);
  5651. rgb_names["seagreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x2e8b57);
  5652. rgb_names["seashell"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfff5ee);
  5653. rgb_names["sienna"] = com_ibm_rave_core_color_Colors.rgbNumber(0xa0522d);
  5654. rgb_names["silver"] = com_ibm_rave_core_color_Colors.rgbNumber(0xc0c0c0);
  5655. rgb_names["skyblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x87ceeb);
  5656. rgb_names["slateblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x6a5acd);
  5657. rgb_names["slategray"] = com_ibm_rave_core_color_Colors.rgbNumber(0x708090);
  5658. rgb_names["slategrey"] = com_ibm_rave_core_color_Colors.rgbNumber(0x708090);
  5659. rgb_names["snow"] = com_ibm_rave_core_color_Colors.rgbNumber(0xfffafa);
  5660. rgb_names["springgreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x00ff7f);
  5661. rgb_names["steelblue"] = com_ibm_rave_core_color_Colors.rgbNumber(0x4682b4);
  5662. rgb_names["tan"] = com_ibm_rave_core_color_Colors.rgbNumber(0xd2b48c);
  5663. rgb_names["teal"] = com_ibm_rave_core_color_Colors.rgbNumber(0x008080);
  5664. rgb_names["thistle"] = com_ibm_rave_core_color_Colors.rgbNumber(0xd8bfd8);
  5665. rgb_names["tomato"] = com_ibm_rave_core_color_Colors.rgbNumber(0xff6347);
  5666. rgb_names["turquoise"] = com_ibm_rave_core_color_Colors.rgbNumber(0x40e0d0);
  5667. rgb_names["violet"] = com_ibm_rave_core_color_Colors.rgbNumber(0xee82ee);
  5668. rgb_names["wheat"] = com_ibm_rave_core_color_Colors.rgbNumber(0xf5deb3);
  5669. rgb_names["white"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffffff);
  5670. rgb_names["whitesmoke"] = com_ibm_rave_core_color_Colors.rgbNumber(0xf5f5f5);
  5671. rgb_names["yellow"] = com_ibm_rave_core_color_Colors.rgbNumber(0xffff00);
  5672. rgb_names["yellowgreen"] = com_ibm_rave_core_color_Colors.rgbNumber(0x9acd32);
  5673. return rgb_names;
  5674. };
  5675. /**
  5676. * Create HSL for an RGB. The HSL has the given alpha.
  5677. * @param (double) r Red (0-255)
  5678. * @param (double) g Green (0-255)
  5679. * @param (double) b Blue (0-255)
  5680. * @param (double) a Alpha (0.0-1.0)
  5681. * @return (com.ibm.rave.core.color.HSL) HSL HSL color
  5682. */
  5683. com_ibm_rave_core_color_Colors.rgb_hsl = function(r, g, b, a) {
  5684. var _r = r;
  5685. var _g = g;
  5686. var _b = b;
  5687. var min = Math.min(Math.min(_r /= 255, _g /= 255), _b /= 255);
  5688. var max = Math.max(Math.max(_r, _g), _b);
  5689. var d = max - min;
  5690. var h, s;
  5691. var l = (max + min) / 2;
  5692. if (d != 0) {
  5693. s = l < .5 ? d / (max + min) : d / (2 - max - min);
  5694. if (_r == max) {
  5695. h = (_g - _b) / d + (_g < _b ? 6 : 0);
  5696. } else if (_g == max) {
  5697. h = (_b - _r) / d + 2;
  5698. } else {
  5699. h = (_r - _g) / d + 4;
  5700. }
  5701. h *= 60;
  5702. } else {
  5703. h = NaN;
  5704. s = l > 0 && l < 1 ? 0 : h;
  5705. }
  5706. return new com_ibm_rave_core_color_HSL(h, s, l, a);
  5707. };
  5708. /**
  5709. * Returns a hexadecimal string representation of an integer representing an RGB color specific channel (either r, g or b)
  5710. * @param (int) v the RGB component (r,g, or b) to get the hex string for
  5711. * @return (String) the hex string for the RGB channel
  5712. */
  5713. /** @expose */
  5714. com_ibm_rave_core_color_Colors.rgb_hex = function(v) {
  5715. var _v = v;
  5716. if (_v < 0) {
  5717. _v = 0;
  5718. } else if (_v > 255) {
  5719. _v = 255;
  5720. }
  5721. return com_ibm_rave_core_color_Colors.hexDigits[(_v >> 4) & 0x0f] + com_ibm_rave_core_color_Colors.hexDigits[_v & 0x0f];
  5722. };
  5723. /**
  5724. * Create an RGB color from HSL color values
  5725. * @param (double) h the hue value
  5726. * @param (double) s the saturation value
  5727. * @param (double) l the lightness value
  5728. * @param (double) a the alpha value
  5729. * @return (com.ibm.rave.core.color.RGB) the newly constructed RGB color
  5730. */
  5731. /** @expose */
  5732. com_ibm_rave_core_color_Colors.hsl_rgb = function(h, s, l, a) {
  5733. var _h = h;
  5734. var _s = s;
  5735. var _l = l;
  5736. var m1, m2;
  5737. _h = isNaN(_h) ? 0 : (_h %= 360) < 0 ? _h + 360 : _h;
  5738. _s = isNaN(_s) ? 0 : _s < 0 ? 0 : _s > 1 ? 1 : _s;
  5739. _l = _l < 0 ? 0 : _l > 1 ? 1 : _l;
  5740. m2 = _l <= .5 ? _l * (1 + _s) : _l + _s - _l * _s;
  5741. m1 = 2 * _l - m2;
  5742. 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), a);
  5743. };
  5744. com_ibm_rave_core_color_Colors.normalizeHue = function(h, m1, m2) {
  5745. var _h = h;
  5746. if (_h > 360) {
  5747. _h -= 360;
  5748. } else if (_h < 0) {
  5749. _h += 360;
  5750. }
  5751. if (_h < 60) {
  5752. return m1 + (m2 - m1) * _h / 60;
  5753. }
  5754. if (_h < 180) {
  5755. return m2;
  5756. }
  5757. if (_h < 240) {
  5758. return m1 + (m2 - m1) * (240 - _h) / 60;
  5759. }
  5760. return m1;
  5761. };
  5762. com_ibm_rave_core_color_Colors.rgbNumber = function(value) {
  5763. return new com_ibm_rave_core_color_RGB(value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff, 1.0);
  5764. };
  5765. com_ibm_rave_core_color_Colors.rgbString = function(value) {
  5766. return com_ibm_rave_core_color_Colors.rgbNumber(value).toString();
  5767. };
  5768. com_ibm_rave_core_color_Colors.rgb_parseNumber = function(c) {
  5769. var d = parseFloat(c);
  5770. return c.charCodeAt(c.length - 1) == 37 ? Math.round(d * 2.55) : d;
  5771. };
  5772. com_ibm_rave_core_color_Colors.rgb_parse = function(format) {
  5773. if (format == null || format.length == 0) {
  5774. return new com_ibm_rave_core_color_RGB(0, 0, 0, 1.0);
  5775. }
  5776. if ("transparent" == format) {
  5777. return new com_ibm_rave_core_color_RGB(0, 0, 0, 0.0);
  5778. }
  5779. var r = 0, g = 0, b = 0;
  5780. var m1;
  5781. var m2;
  5782. var color;
  5783. m1 = com_ibm_rave_core_color_Colors.getColorsRegExp().exec(format);
  5784. if (m1 && m1.length > 0) {
  5785. m2 = m1[2].split(new RegExp(","));
  5786. if ("hsl" == m1[1]) {
  5787. return new com_ibm_rave_core_color_HSL(parseFloat(m2[0]), parseFloat(m2[1].replace("%", "")) / 100, parseFloat(m2[2].replace("%", "")) / 100, 1.0);
  5788. }
  5789. if ("hsla" == m1[1]) {
  5790. return new com_ibm_rave_core_color_HSL(parseFloat(m2[0]), parseFloat(m2[1].replace("%", "")) / 100, parseFloat(m2[2].replace("%", "")) / 100, parseFloat(m2[3]));
  5791. }
  5792. if ("rgba" == m1[1]) {
  5793. 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]), com_ibm_rave_core_color_Colors.rgb_parseNumber(m2[3]));
  5794. }
  5795. if ("rgb" == m1[1]) {
  5796. 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);
  5797. }
  5798. }
  5799. if ((format.charCodeAt(0) != 35) && (color = com_ibm_rave_core_color_Colors.rgb_names[format.toLowerCase()])) {
  5800. return new com_ibm_rave_core_color_RGB(color.r, color.g, color.b, 1.0);
  5801. }
  5802. var colorValue = 0;
  5803. if (format.charCodeAt(0) == 35 && !(isNaN(colorValue = parseInt(format.substring(1), 16)))) {
  5804. if (format.length == 4) {
  5805. r = (colorValue & 0xf00) >> 4;
  5806. r = (r >> 4) | r;
  5807. g = (colorValue & 0xf0);
  5808. g = (g >> 4) | g;
  5809. b = (colorValue & 0xf);
  5810. b = (b << 4) | b;
  5811. } else if (format.length == 7) {
  5812. r = (colorValue & 0xff0000) >> 16;
  5813. g = (colorValue & 0xff00) >> 8;
  5814. b = (colorValue & 0xff);
  5815. }
  5816. }
  5817. return new com_ibm_rave_core_color_RGB(r, g, b, 1.0);
  5818. };
  5819. com_ibm_rave_core_color_Colors.rgb_lab = function(r, g, b) {
  5820. var _r = r;
  5821. var _g = g;
  5822. var _b = b;
  5823. _r = com_ibm_rave_core_color_Colors.rgb_xyz(_r);
  5824. _g = com_ibm_rave_core_color_Colors.rgb_xyz(_g);
  5825. _b = com_ibm_rave_core_color_Colors.rgb_xyz(_b);
  5826. 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);
  5827. 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);
  5828. 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);
  5829. return new com_ibm_rave_core_color_LAB(116 * y - 16, 500 * (x - y), 200 * (y - z));
  5830. };
  5831. /**
  5832. * Create an LAB color from HCL color values
  5833. * @param (double) h the hue value
  5834. * @param (double) c the chroma value
  5835. * @param (double) l the luminance value
  5836. * @return (com.ibm.rave.core.color.LAB) the newly constructed LAB color
  5837. */
  5838. /** @expose */
  5839. com_ibm_rave_core_color_Colors.hcl_lab = function(h, c, l) {
  5840. var _h = h;
  5841. var _c = c;
  5842. if (isNaN(_h)) {
  5843. _h = 0;
  5844. }
  5845. if (isNaN(_c)) {
  5846. _c = 0;
  5847. }
  5848. return new com_ibm_rave_core_color_LAB(l, Math.cos(_h *= 0.017453292519943295) * _c, Math.sin(_h) * _c);
  5849. };
  5850. com_ibm_rave_core_color_Colors.xyz_lab = function(x) {
  5851. return x > 0.008856 ? Math.pow(x, 1.0 / 3.0) : 7.787037 * x + 4.0 / 29.0;
  5852. };
  5853. com_ibm_rave_core_color_Colors.xyz_rgb = function(r) {
  5854. return Math.round(255 * (r <= 0.00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - 0.055));
  5855. };
  5856. com_ibm_rave_core_color_Colors.rgb_xyz = function(r) {
  5857. var _r = r;
  5858. return (_r /= 255) <= 0.04045 ? _r / 12.92 : Math.pow((_r + 0.055) / 1.055, 2.4);
  5859. };
  5860. com_ibm_rave_core_color_Colors.lab_hcl = function(l, a, b) {
  5861. 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);
  5862. };
  5863. /**
  5864. * Create an RGB color from LAB color values
  5865. * @param (double) l the L-channel (Lightness) value
  5866. * @param (double) a the A-channel value
  5867. * @param (double) b the B-channel value
  5868. * @return (com.ibm.rave.core.color.RGB) the newly constructed RGB color
  5869. */
  5870. /** @expose */
  5871. com_ibm_rave_core_color_Colors.lab_rgb = function(l, a, b) {
  5872. var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200;
  5873. x = com_ibm_rave_core_color_Colors.lab_xyz(x) * com_ibm_rave_core_color_Colors.lab_X;
  5874. y = com_ibm_rave_core_color_Colors.lab_xyz(y) * com_ibm_rave_core_color_Colors.lab_Y;
  5875. z = com_ibm_rave_core_color_Colors.lab_xyz(z) * com_ibm_rave_core_color_Colors.lab_Z;
  5876. 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);
  5877. };
  5878. com_ibm_rave_core_color_Colors.lab_xyz = function(x) {
  5879. return x > 0.206893034 ? x * x * x : (x - 4.0 / 29.0) / 7.787037;
  5880. };
  5881. /**
  5882. * Creates an LAB color object from its basic channel values
  5883. * @param (double) l the L-channel (Lightness) value
  5884. * @param (double) a the A-channe value
  5885. * @param (double) b the B-channel value
  5886. * @return (com.ibm.rave.core.color.LAB) the newly constructed LAB color
  5887. */
  5888. com_ibm_rave_core_color_Colors.newLAB$0 = function(l, a, b) {
  5889. return new com_ibm_rave_core_color_LAB(l, a, b);
  5890. };
  5891. /**
  5892. * 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
  5893. * @param (Object) color the object to use to create the LAB color object
  5894. * @return (com.ibm.rave.core.color.LAB) the newly constructed LAB color
  5895. */
  5896. com_ibm_rave_core_color_Colors.newLAB$1 = function(color) {
  5897. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(color, com_ibm_rave_core_color_LAB)) {
  5898. var lab = color;
  5899. return new com_ibm_rave_core_color_LAB(lab.l, lab.a, lab.b);
  5900. } else if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(color, com_ibm_rave_core_color_RGB)) {
  5901. return (color).lab();
  5902. } else if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(color, com_ibm_rave_core_color_HCL)) {
  5903. return (color).lab();
  5904. } else {
  5905. return com_ibm_rave_core_color_Colors.rgb_parse((color == null) ? "" : color.toString()).rgb().lab();
  5906. }
  5907. };
  5908. /**
  5909. * Creates an HCL color object from its basic channel values
  5910. * @param (double) h the hue value
  5911. * @param (double) c the chroma value
  5912. * @param (double) l the luminance value
  5913. * @return (com.ibm.rave.core.color.HCL) the newly constructed HCL color
  5914. */
  5915. com_ibm_rave_core_color_Colors.newHCL$0 = function(h, c, l) {
  5916. return new com_ibm_rave_core_color_HCL(h, c, l);
  5917. };
  5918. /**
  5919. * Creates an HCL color object from the passed object This object could be one of the following: <ul> <li>HCL color, in which case a clone of it would be returned</li> <li>LAB color</li> <li>A string which could be in one of the following formats:</li> <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.
  5920. * @param (Object) color the object to use to create the HCL color object
  5921. * @return (com.ibm.rave.core.color.HCL) the newly constructed HCL color
  5922. */
  5923. com_ibm_rave_core_color_Colors.newHCL$1 = function(color) {
  5924. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(color, com_ibm_rave_core_color_HCL)) {
  5925. var hcl = color;
  5926. return new com_ibm_rave_core_color_HCL(hcl.h, hcl.c, hcl.l);
  5927. } else if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(color, com_ibm_rave_core_color_LAB)) {
  5928. return (color).hcl();
  5929. } else {
  5930. return com_ibm_rave_core_color_Colors.rgb_parse((color == null) ? "" : color.toString()).rgb().lab().hcl();
  5931. }
  5932. };
  5933. /**
  5934. * Creates an HSL color object from its basic channel values
  5935. * @param (double) h the hue value
  5936. * @param (double) s the saturation value
  5937. * @param (double) l the lightness value
  5938. * @return (com.ibm.rave.core.color.HSL) the newly constructed HSL color
  5939. */
  5940. com_ibm_rave_core_color_Colors.newHSL$0 = function(h, s, l) {
  5941. return new com_ibm_rave_core_color_HSL(h, s, l, 1.0);
  5942. };
  5943. /**
  5944. * Creates an HSL color object from its basic channel values including alpha.
  5945. * @param (double) h the hue value
  5946. * @param (double) s the saturation value
  5947. * @param (double) l the lightness value
  5948. * @param (double) a the alpha value
  5949. * @return (com.ibm.rave.core.color.HSL) the newly constructed HSL color
  5950. */
  5951. /** @expose */
  5952. com_ibm_rave_core_color_Colors.newHSLA = function(h, s, l, a) {
  5953. return new com_ibm_rave_core_color_HSL(h, s, l, a);
  5954. };
  5955. /**
  5956. * Creates an HSL color object from the passed object This object could be one of the following: <ul> <li>HSL color, in which case a clone of it would be returned</li> <li>RGB color</li> <li>A string which could be in one of the following formats:</li> <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.
  5957. * @param (Object) color the object to use to create the HSL color object
  5958. * @return (com.ibm.rave.core.color.HSL) the newly constructed HSL color
  5959. */
  5960. com_ibm_rave_core_color_Colors.newHSL$1 = function(color) {
  5961. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(color, com_ibm_rave_core_color_HSL)) {
  5962. var hsl = color;
  5963. return new com_ibm_rave_core_color_HSL(hsl.h, hsl.s, hsl.l, hsl.a);
  5964. } else if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(color, com_ibm_rave_core_color_RGB)) {
  5965. return (color).hsl();
  5966. } else {
  5967. var c = com_ibm_rave_core_color_Colors.rgb_parse((color == null) ? "" : color.toString());
  5968. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(c, com_ibm_rave_core_color_HSL)) {
  5969. return c;
  5970. }
  5971. return (c).hsl();
  5972. }
  5973. };
  5974. /**
  5975. * Creates an RGB color object from its basic channel values
  5976. * @param (int) r the red value
  5977. * @param (int) g the green value
  5978. * @param (int) b the blue value
  5979. * @return (com.ibm.rave.core.color.RGB) the newly constructed RGB color
  5980. */
  5981. com_ibm_rave_core_color_Colors.newRGB$0 = function(r, g, b) {
  5982. return new com_ibm_rave_core_color_RGB(r, g, b, 1.0);
  5983. };
  5984. /**
  5985. * Creates an RGBA color object from its basic channel values
  5986. * @param (int) r the red value
  5987. * @param (int) g the green value
  5988. * @param (int) b the blue value
  5989. * @param (double) a the alpha value
  5990. * @return (com.ibm.rave.core.color.RGB) the newly constructed RGB color
  5991. */
  5992. /** @expose */
  5993. com_ibm_rave_core_color_Colors.newRGBA = function(r, g, b, a) {
  5994. return new com_ibm_rave_core_color_RGB(r, g, b, a);
  5995. };
  5996. /**
  5997. * Creates an RGB color object from the passed object. This object could be one of the following: <ul> <li>Any color object: RGB, HCL, LAB or HSL</li> <li>A string which could be in one of the following formats:</li> <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> <li>special string value - "transparent"</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.
  5998. * @param (Object) color the object to use to create the RGB color object
  5999. * @return (com.ibm.rave.core.color.RGB) the newly constructed RGB color. Returns 'black' color if parsing fails.
  6000. */
  6001. com_ibm_rave_core_color_Colors.newRGB$1 = function(color) {
  6002. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(color, com_ibm_rave_core_color_Color)) {
  6003. var rgb = (color).rgb();
  6004. return new com_ibm_rave_core_color_RGB(rgb.r, rgb.g, rgb.b, rgb.a);
  6005. }
  6006. return com_ibm_rave_core_color_Colors.rgb_parse((color == null) ? "" : color.toString()).rgb();
  6007. };
  6008. /**
  6009. * Checks whether a string is one of HTML color names (RGB colors)
  6010. * @param (String) str the name of color to check
  6011. * @return (boolean) true if the name is an HTML color names, false otherwise
  6012. */
  6013. /** @expose */
  6014. com_ibm_rave_core_color_Colors.isRGBColorName = function(str) {
  6015. return com_ibm_rave_core_color_Colors.rgb_names.hasOwnProperty(str);
  6016. };
  6017. /** @expose */
  6018. com_ibm_rave_core_color_Colors.newLAB = function(a0, a1, a2) {
  6019. var args = arguments;
  6020. if (args.length == 1) {
  6021. return com_ibm_rave_core_color_Colors.newLAB$1(a0);
  6022. }
  6023. return com_ibm_rave_core_color_Colors.newLAB$0(a0, a1, a2);
  6024. };
  6025. /** @expose */
  6026. com_ibm_rave_core_color_Colors.newHCL = function(a0, a1, a2) {
  6027. var args = arguments;
  6028. if (args.length == 1) {
  6029. return com_ibm_rave_core_color_Colors.newHCL$1(a0);
  6030. }
  6031. return com_ibm_rave_core_color_Colors.newHCL$0(a0, a1, a2);
  6032. };
  6033. /** @expose */
  6034. com_ibm_rave_core_color_Colors.newHSL = function(a0, a1, a2) {
  6035. var args = arguments;
  6036. if (args.length == 1) {
  6037. return com_ibm_rave_core_color_Colors.newHSL$1(a0);
  6038. }
  6039. return com_ibm_rave_core_color_Colors.newHSL$0(a0, a1, a2);
  6040. };
  6041. /** @expose */
  6042. com_ibm_rave_core_color_Colors.newRGB = function(a0, a1, a2) {
  6043. var args = arguments;
  6044. if (args.length == 1) {
  6045. return com_ibm_rave_core_color_Colors.newRGB$1(a0);
  6046. }
  6047. return com_ibm_rave_core_color_Colors.newRGB$0(a0, a1, a2);
  6048. };
  6049. //com_ibm_rave_core_color_Colors.HSL_STR = "hsl";
  6050. //com_ibm_rave_core_color_Colors.HSLA_STR = "hsla";
  6051. //com_ibm_rave_core_color_Colors.RGB_STR = "rgb";
  6052. //com_ibm_rave_core_color_Colors.RGBA_STR = "rgba";
  6053. //com_ibm_rave_core_color_Colors.COMMA_STR = ",";
  6054. //com_ibm_rave_core_color_Colors.PERCENT_STR = "%";
  6055. //com_ibm_rave_core_color_Colors.EMPTY_STR = "";
  6056. //com_ibm_rave_core_color_Colors.TRANSPARENT = "transparent";
  6057. com_ibm_rave_core_color_Colors.lab_X = 0.950470;
  6058. com_ibm_rave_core_color_Colors.lab_Y = 1;
  6059. com_ibm_rave_core_color_Colors.lab_Z = 1.088830;
  6060. com_ibm_rave_core_color_Colors.lab_K = 18;
  6061. //com_ibm_rave_core_color_Colors.COLORS_REG_EXP_KEY = "COLORS_REG_EXP_KEY";
  6062. com_ibm_rave_core_color_Colors.hexDigits = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
  6063. com_ibm_rave_core_color_Colors.rgb_names = com_ibm_rave_core_color_Colors.initialize_rgb_names();
  6064. // $source: com/ibm/rave/core/internal/color/ContrastShift
  6065. /************************************************************************
  6066. ** IBM Confidential
  6067. **
  6068. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6069. **
  6070. ** (C) Copyright IBM Corp. 2017
  6071. **
  6072. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6073. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6074. ************************************************************************/
  6075. // GENERATED
  6076. //@import com/ibm/rave/core/color/Colors (static) // newRGB
  6077. /**
  6078. * 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.
  6079. */
  6080. var com_ibm_rave_core_internal_color_ContrastShift = {
  6081. /**
  6082. * Private constructor - cannot instantiate
  6083. */
  6084. //constructor : function() {}
  6085. };
  6086. /**
  6087. * Calls the updateColor method using the default ratio of 4.5
  6088. * @param (com.ibm.rave.core.color.RGB) staticColor Refers to the color that will not be adjusted
  6089. * @param (com.ibm.rave.core.color.RGB) nonStaticColor Refers to the color that will be adjusted to obtain the appropriate contrast ratio value
  6090. * @return (com.ibm.rave.core.color.RGB) A contrasting color
  6091. */
  6092. com_ibm_rave_core_internal_color_ContrastShift.updateColor$0 = function(staticColor, nonStaticColor) {
  6093. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$1(staticColor, nonStaticColor, 4.5);
  6094. };
  6095. /**
  6096. * 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
  6097. * @param (com.ibm.rave.core.color.RGB) staticColor Refers to the color that will not be adjusted
  6098. * @param (com.ibm.rave.core.color.RGB) nonStaticColor Refers to the color that will be adjusted to obtain the appropriate contrast ratio value
  6099. * @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
  6100. * @return (com.ibm.rave.core.color.RGB) A contrasting color
  6101. */
  6102. com_ibm_rave_core_internal_color_ContrastShift.updateColor$1 = function(staticColor, nonStaticColor, contrastRatio) {
  6103. var luminance1 = com_ibm_rave_core_internal_color_ContrastShift.getLuminance(nonStaticColor);
  6104. var luminance2 = com_ibm_rave_core_internal_color_ContrastShift.getLuminance(staticColor);
  6105. var ratio = com_ibm_rave_core_internal_color_ContrastShift.calculateRatio(luminance1, luminance2);
  6106. var cRatio = contrastRatio;
  6107. var color = nonStaticColor;
  6108. if (cRatio < 1 || cRatio > 21) {
  6109. cRatio = 4.5;
  6110. }
  6111. var contrastWhite = com_ibm_rave_core_internal_color_ContrastShift.calculateRatio(1.0, luminance2);
  6112. var contrastBlack = com_ibm_rave_core_internal_color_ContrastShift.calculateRatio(0.0, luminance2);
  6113. if (contrastWhite < cRatio && contrastBlack < cRatio) {
  6114. return contrastWhite > contrastBlack ? com_ibm_rave_core_internal_color_ContrastShift.WHITE : com_ibm_rave_core_internal_color_ContrastShift.BLACK;
  6115. }
  6116. var step = 25 * (com_ibm_rave_core_internal_color_ContrastShift.moveDarker(luminance1, luminance2) ? -1 : 1);
  6117. while (ratio < cRatio) {
  6118. color = com_ibm_rave_core_internal_color_ContrastShift.shiftColor(color, step);
  6119. luminance1 = com_ibm_rave_core_internal_color_ContrastShift.getLuminance(color);
  6120. ratio = com_ibm_rave_core_internal_color_ContrastShift.calculateRatio(luminance1, luminance2);
  6121. if ((luminance1 >= 1.0 || luminance1 <= 0.0) && ratio < cRatio) {
  6122. color = nonStaticColor;
  6123. step *= -1;
  6124. }
  6125. }
  6126. return color;
  6127. };
  6128. /**
  6129. * Determine if a color needs to be made darker.
  6130. * @param (double) shiftingLuminance The shifting color's luminance.
  6131. * @param (double) staticLuminance The static color's luminance.
  6132. * @return (boolean) true if the color needs to be darker, false otherwise.
  6133. */
  6134. com_ibm_rave_core_internal_color_ContrastShift.moveDarker = function(shiftingLuminance, staticLuminance) {
  6135. var darker = true;
  6136. if (shiftingLuminance == staticLuminance) {
  6137. darker = (shiftingLuminance - 0.5 >= 0) ? true : false;
  6138. } else if (shiftingLuminance > staticLuminance) {
  6139. darker = false;
  6140. }
  6141. return darker;
  6142. };
  6143. /**
  6144. * Calculates and returns the luminance of a specific color
  6145. * @param (com.ibm.rave.core.color.RGB) rgb The RGB color to attain the luminance of
  6146. * @return (double) the luminance value of the color passed in
  6147. */
  6148. com_ibm_rave_core_internal_color_ContrastShift.getLuminance = function(rgb) {
  6149. 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));
  6150. };
  6151. /**
  6152. * Adjusts the color in order to calculate the relative luminance
  6153. * @param (double) color Color value to adjust
  6154. * @return (double) The adjusted color value
  6155. */
  6156. com_ibm_rave_core_internal_color_ContrastShift.adjustColor = function(color) {
  6157. var adjustedColor = 0;
  6158. if (color <= 0.03928) {
  6159. adjustedColor = color / 12.92;
  6160. } else {
  6161. adjustedColor = Math.pow(((color + 0.055) / 1.055), 2.4);
  6162. }
  6163. return adjustedColor;
  6164. };
  6165. /**
  6166. * Shifts the color by the specified amount and returns a new color object
  6167. * @param (com.ibm.rave.core.color.RGB) color The color we are shifting
  6168. * @param (int) amount The amount by which we are shifting the color
  6169. * @return (com.ibm.rave.core.color.RGB) A new Color Object containing the new color after the shift is complete
  6170. */
  6171. com_ibm_rave_core_internal_color_ContrastShift.shiftColor = function(color, amount) {
  6172. var r = Math.max(0, Math.min(color.r + amount, 255));
  6173. var g = Math.max(0, Math.min(color.g + amount, 255));
  6174. var b = Math.max(0, Math.min(color.b + amount, 255));
  6175. return com_ibm_rave_core_color_Colors.newRGB(r, g, b);
  6176. };
  6177. /**
  6178. * Calculates and returns the contrast ratio using the luminance of both the colors it is contrasting against
  6179. * @param (double) l1 The luminance of the first color
  6180. * @param (double) l2 The luminance of the second color
  6181. * @return (double) The contrast ratio calculated
  6182. */
  6183. com_ibm_rave_core_internal_color_ContrastShift.calculateRatio = function(l1, l2) {
  6184. if (l1 >= l2) {
  6185. return (l1 + .05) / (l2 + .05);
  6186. }
  6187. return (l2 + .05) / (l1 + .05);
  6188. };
  6189. com_ibm_rave_core_internal_color_ContrastShift.updateColor = function(a0, a1, a2) {
  6190. var args = arguments;
  6191. if (args.length == 2) {
  6192. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$0(a0, a1);
  6193. }
  6194. return com_ibm_rave_core_internal_color_ContrastShift.updateColor$1(a0, a1, a2);
  6195. };
  6196. com_ibm_rave_core_internal_color_ContrastShift.DEFAULT_RATIO = 4.5;
  6197. com_ibm_rave_core_internal_color_ContrastShift.STEP = 25;
  6198. com_ibm_rave_core_internal_color_ContrastShift.MAX_RATIO = 21;
  6199. com_ibm_rave_core_internal_color_ContrastShift.MIN_RATIO = 1;
  6200. com_ibm_rave_core_internal_color_ContrastShift.BLACK_LUMINANCE = 0;
  6201. com_ibm_rave_core_internal_color_ContrastShift.WHITE_LUMINANCE = 1;
  6202. com_ibm_rave_core_internal_color_ContrastShift.BLACK = com_ibm_rave_core_color_Colors.newRGB(0, 0, 0);
  6203. com_ibm_rave_core_internal_color_ContrastShift.WHITE = com_ibm_rave_core_color_Colors.newRGB(255, 255, 255);
  6204. // $source: com/ibm/rave/core/interpolate/ColorInterpolation
  6205. /************************************************************************
  6206. ** IBM Confidential
  6207. **
  6208. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6209. **
  6210. ** (C) Copyright IBM Corp. 2017
  6211. **
  6212. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6213. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6214. ************************************************************************/
  6215. // GENERATED
  6216. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6217. //@import com/ibm/rave/core/Rave (runtime) // hsl, hcl, lab, rgb
  6218. //@import com/ibm/rave/core/color/Colors (runtime) // lab_rgb, hcl_lab, hsl_rgb, newRGBA
  6219. /**
  6220. * A class that holds the various instances of color interpolator factories
  6221. */
  6222. var com_ibm_rave_core_interpolate_ColorInterpolation = rave_externs["ColorInterpolation"] = com_ibm_rave_core_nativeImpl_Declare({
  6223. });
  6224. com_ibm_rave_core_interpolate_ColorInterpolation.HSLInterpolation = com_ibm_rave_core_nativeImpl_Declare({
  6225. _$functionClassMethod : function() {
  6226. var _$self = function(a, b) {
  6227. var aColor = com_ibm_rave_core_Rave.hsl(a);
  6228. var bColor = com_ibm_rave_core_Rave.hsl(b);
  6229. var ah = aColor.h, as = aColor.s, al = aColor.l, bh = bColor.h - ah, bs = bColor.s - as, bl = bColor.l - al;
  6230. if (isNaN(bs)) {
  6231. bs = 0;
  6232. as = isNaN(as) ? bColor.s : as;
  6233. }
  6234. if (isNaN(bh)) {
  6235. bh = 0;
  6236. ah = isNaN(ah) ? bColor.h : ah;
  6237. } else if (bh > 180) {
  6238. bh -= 360;
  6239. } else if (bh < -180) {
  6240. bh += 360;
  6241. }
  6242. var ahf = ah, bhf = bh, asf = as, bsf = bs, alf = al, blf = bl;
  6243. var a_alpha = aColor.a;
  6244. var b_alpha = bColor.a;
  6245. return function(t) {
  6246. var a = (a_alpha + ((b_alpha - a_alpha) * t));
  6247. return com_ibm_rave_core_color_Colors.hsl_rgb(ahf + bhf * t, asf + bsf * t, alf + blf * t, a).toString();
  6248. };
  6249. };
  6250. return _$self;
  6251. }
  6252. });
  6253. com_ibm_rave_core_interpolate_ColorInterpolation.HCLInterpolation = com_ibm_rave_core_nativeImpl_Declare({
  6254. _$functionClassMethod : function() {
  6255. var _$self = function(a, b) {
  6256. var aColor = com_ibm_rave_core_Rave.hcl(a);
  6257. var bColor = com_ibm_rave_core_Rave.hcl(b);
  6258. var ah = aColor.h, ac = aColor.c, al = aColor.l, bh = bColor.h - ah, bc = bColor.c - ac, bl = bColor.l - al;
  6259. if (isNaN(bc)) {
  6260. bc = 0;
  6261. ac = isNaN(ac) ? bColor.c : ac;
  6262. }
  6263. if (isNaN(bh)) {
  6264. bh = 0;
  6265. ah = isNaN(ah) ? bColor.h : ah;
  6266. } else if (bh > 180) {
  6267. bh -= 360;
  6268. } else if (bh < -180) {
  6269. bh += 360;
  6270. }
  6271. var ahf = ah, bhf = bh, acf = ac, bcf = bc, alf = al, blf = bl;
  6272. return function(t) {
  6273. return com_ibm_rave_core_color_Colors.hcl_lab(ahf + bhf * t, acf + bcf * t, alf + blf * t).toString();
  6274. };
  6275. };
  6276. return _$self;
  6277. }
  6278. });
  6279. com_ibm_rave_core_interpolate_ColorInterpolation.LABInterpolation = com_ibm_rave_core_nativeImpl_Declare({
  6280. _$functionClassMethod : function() {
  6281. var _$self = function(a, b) {
  6282. var aColor = com_ibm_rave_core_Rave.lab(a);
  6283. var bColor = com_ibm_rave_core_Rave.lab(b);
  6284. var al = aColor.l, aa = aColor.a, ab = aColor.b, bl = bColor.l - al, ba = bColor.a - aa, bb = bColor.b - ab;
  6285. return function(t) {
  6286. return com_ibm_rave_core_color_Colors.lab_rgb(al + bl * t, aa + ba * t, ab + bb * t).toString();
  6287. };
  6288. };
  6289. return _$self;
  6290. }
  6291. });
  6292. com_ibm_rave_core_interpolate_ColorInterpolation.RGBInterpolation = com_ibm_rave_core_nativeImpl_Declare({
  6293. _$functionClassMethod : function() {
  6294. var _$self = function(a, b) {
  6295. var aColor = com_ibm_rave_core_Rave.rgb(a);
  6296. var bColor = com_ibm_rave_core_Rave.rgb(b);
  6297. var ar = aColor.r, ag = aColor.g, ab = aColor.b, br = bColor.r - ar, bg = bColor.g - ag, bb = bColor.b - ab;
  6298. var a_alpha = aColor.a;
  6299. var b_alpha = bColor.a;
  6300. return function(t) {
  6301. var r = Math.round(ar + br * t);
  6302. var g = Math.round(ag + bg * t);
  6303. var b = Math.round(ab + bb * t);
  6304. var a = (a_alpha + ((b_alpha - a_alpha) * t));
  6305. return com_ibm_rave_core_color_Colors.newRGBA(r, g, b, a).toString();
  6306. };
  6307. };
  6308. return _$self;
  6309. }
  6310. });
  6311. /**
  6312. * 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.
  6313. */
  6314. /** @expose */
  6315. com_ibm_rave_core_interpolate_ColorInterpolation.HSLINSTANCE = new com_ibm_rave_core_interpolate_ColorInterpolation.HSLInterpolation();
  6316. /**
  6317. * 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.
  6318. */
  6319. /** @expose */
  6320. com_ibm_rave_core_interpolate_ColorInterpolation.HCLINSTANCE = new com_ibm_rave_core_interpolate_ColorInterpolation.HCLInterpolation();
  6321. /**
  6322. * 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.
  6323. */
  6324. /** @expose */
  6325. com_ibm_rave_core_interpolate_ColorInterpolation.LABINSTANCE = new com_ibm_rave_core_interpolate_ColorInterpolation.LABInterpolation();
  6326. /**
  6327. * 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. If alpha is not equal to 1, then an rgba(r,g,b,a) string is returned instead.
  6328. */
  6329. /** @expose */
  6330. com_ibm_rave_core_interpolate_ColorInterpolation.RGBINSTANCE = new com_ibm_rave_core_interpolate_ColorInterpolation.RGBInterpolation();
  6331. // $source: com/ibm/rave/core/interpolate/StringInterpolation
  6332. /************************************************************************
  6333. ** IBM Confidential
  6334. **
  6335. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6336. **
  6337. ** (C) Copyright IBM Corp. 2017
  6338. **
  6339. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6340. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6341. ************************************************************************/
  6342. // GENERATED
  6343. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6344. //@import com/ibm/rave/core/interpolate/NumberInterpolation (runtime) // NumberInterpolation
  6345. //@import com/ibm/rave/core/context/RaveContextManager (static) // RaveContextManager
  6346. var com_ibm_rave_core_interpolate_StringInterpolation = rave_externs["StringInterpolation"] = com_ibm_rave_core_nativeImpl_Declare({
  6347. _$functionClassMethod : function() {
  6348. var _$self = /**
  6349. * Creates an interpolator that will interpolate all numbers found within the start end values.
  6350. * @param (Object) a the start value
  6351. * @param (Object) b the end value
  6352. * @return (com.ibm.rave.core.interpolate.Interpolator) a new interpolator
  6353. */
  6354. function(a, b) {
  6355. var stringInterpolationRegExps = com_ibm_rave_core_interpolate_StringInterpolation.getStringInterpolationRegExps();
  6356. var are = stringInterpolationRegExps.aRegExp, bre = stringInterpolationRegExps.bRegExp;
  6357. are["lastIndex"] = bre["lastIndex"] = 0;
  6358. var ax = a + "", bx = b + "";
  6359. var ls = [];
  6360. var lq = [];
  6361. var bs;
  6362. var bi = 0, i = -1, bsi;
  6363. var am;
  6364. var bm;
  6365. while ((am = are.exec(ax)) && (bm = bre.exec(bx))) {
  6366. if ((bsi = bm.index) > bi) {
  6367. bs = bx.substring(bi, bsi);
  6368. var tmp = (i >= 0 && i < ls.length) ? ls[i] : null;
  6369. if (tmp != null) {
  6370. ls[i] = tmp + bs;
  6371. } else {
  6372. ls.push(bs);
  6373. i++;
  6374. }
  6375. }
  6376. if (am[0] == bm[0]) {
  6377. var tmp = (i > 0 && i < ls.length) ? ls[i] : null;
  6378. if (tmp != null) {
  6379. ls[i] = tmp + bm[0];
  6380. } else {
  6381. ls.push(bm[0]);
  6382. i++;
  6383. }
  6384. } else {
  6385. ls.push(null);
  6386. i++;
  6387. lq.push(new com_ibm_rave_core_interpolate_StringInterpolation.IndexInterpolator(i, com_ibm_rave_core_interpolate_NumberInterpolation.INSTANCE(am[0], bm[0])));
  6388. }
  6389. bi = bre["lastIndex"];
  6390. }
  6391. if (bi < bx.length) {
  6392. bs = bx.substring(bi);
  6393. var tmp = (i > 0 && i < ls.length) ? ls[i] : null;
  6394. if (tmp != null) {
  6395. ls[i] = tmp + bs;
  6396. } else {
  6397. ls.push(bs);
  6398. i++;
  6399. }
  6400. }
  6401. if (ls.length < 2) {
  6402. if (lq.length > 0) {
  6403. var lq0Interpolator = lq[0].x;
  6404. return function(t) {
  6405. return lq0Interpolator(t) + "";
  6406. };
  6407. }
  6408. var fb = bx;
  6409. return function(t) {
  6410. return fb;
  6411. };
  6412. }
  6413. var lqSize = lq.length;
  6414. return function(t) {
  6415. var o;
  6416. for (var i = 0; i < lqSize; ++i) {
  6417. ls[(o = lq[i]).i] = o.x(t);
  6418. }
  6419. return ls.join("");
  6420. };
  6421. };
  6422. return _$self;
  6423. }
  6424. });
  6425. com_ibm_rave_core_interpolate_StringInterpolation.getStringInterpolationRegExps = function() {
  6426. var stringInterpolationRegExps = com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData("STRING_INTERPOLATION_REG_EXP_KEY");
  6427. if (!stringInterpolationRegExps) {
  6428. stringInterpolationRegExps = new com_ibm_rave_core_interpolate_StringInterpolation.StringInterpolationRegExps();
  6429. com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().putData("STRING_INTERPOLATION_REG_EXP_KEY", stringInterpolationRegExps);
  6430. }
  6431. return stringInterpolationRegExps;
  6432. };
  6433. com_ibm_rave_core_interpolate_StringInterpolation.StringInterpolationRegExps = com_ibm_rave_core_nativeImpl_Declare({
  6434. //aRegExp : null,
  6435. //bRegExp : null,
  6436. constructor : function() {
  6437. this.aRegExp = new RegExp("[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?", "g");
  6438. this.bRegExp = new RegExp(this.aRegExp["source"], "g");
  6439. }
  6440. });
  6441. com_ibm_rave_core_interpolate_StringInterpolation.IndexInterpolator = function(i, interpolator) {
  6442. this.i = i;
  6443. this.x = interpolator;
  6444. };
  6445. //com_ibm_rave_core_interpolate_StringInterpolation.STRING_INTERPOLATION_REG_EXP_KEY = "STRING_INTERPOLATION_REG_EXP_KEY";
  6446. /** @expose */
  6447. com_ibm_rave_core_interpolate_StringInterpolation.INSTANCE = new com_ibm_rave_core_interpolate_StringInterpolation();
  6448. // $source: com/ibm/rave/core/interpolate/NumberInterpolation
  6449. /************************************************************************
  6450. ** IBM Confidential
  6451. **
  6452. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6453. **
  6454. ** (C) Copyright IBM Corp. 2017
  6455. **
  6456. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6457. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6458. ************************************************************************/
  6459. // GENERATED
  6460. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6461. var com_ibm_rave_core_interpolate_NumberInterpolation = com_ibm_rave_core_nativeImpl_Declare({
  6462. _$functionClassMethod : function() {
  6463. var _$self = /**
  6464. * Creates an interpolator that can interpolate a number between the start and end value.
  6465. * @param (Object) a the start value
  6466. * @param (Object) b the end value
  6467. * @return (com.ibm.rave.core.interpolate.Interpolator) q new interpolator
  6468. */
  6469. function(a, b) {
  6470. var da = + (a);
  6471. var db = + (b);
  6472. return function(t) {
  6473. return da * (1 - t) + db * t;
  6474. };
  6475. };
  6476. return _$self;
  6477. }
  6478. //constructor : function() {}
  6479. });
  6480. /** @expose */
  6481. com_ibm_rave_core_interpolate_NumberInterpolation.INSTANCE = new com_ibm_rave_core_interpolate_NumberInterpolation();
  6482. // $source: com/ibm/rave/core/interpolate/ArrayInterpolation
  6483. /************************************************************************
  6484. ** IBM Confidential
  6485. **
  6486. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6487. **
  6488. ** (C) Copyright IBM Corp. 2017
  6489. **
  6490. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6491. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6492. ************************************************************************/
  6493. // GENERATED
  6494. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6495. //@import com/ibm/rave/core/interpolate/Interpolators (runtime) // Interpolators
  6496. var com_ibm_rave_core_interpolate_ArrayInterpolation = rave_externs["ArrayInterpolation"] = com_ibm_rave_core_nativeImpl_Declare({
  6497. _$functionClassMethod : function() {
  6498. var _$self = /**
  6499. * 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.
  6500. * @param (java.lang.Object[]) a the first array
  6501. * @param (java.lang.Object[]) b the second array
  6502. * @return (com.ibm.rave.core.interpolate.Interpolator) the new interpolator
  6503. */
  6504. function(a, b) {
  6505. var na = a.length;
  6506. var nb = b.length;
  6507. var n0 = Math.min(na, nb);
  6508. var i = 0;
  6509. var x = [];
  6510. var c = [];
  6511. for (i = 0; i < n0; ++i) {
  6512. x[i] = com_ibm_rave_core_interpolate_Interpolators.INSTANCE.getInterpolator(a[i], b[i]);
  6513. }
  6514. for (; i < na; ++i) {
  6515. c[i] = a[i];
  6516. }
  6517. for (; i < nb; ++i) {
  6518. c[i] = b[i];
  6519. }
  6520. return function(t) {
  6521. for (var index = 0; index < n0; ++index) {
  6522. c[index] = x[index](t);
  6523. }
  6524. return c;
  6525. };
  6526. };
  6527. return _$self;
  6528. }
  6529. });
  6530. /** @expose */
  6531. com_ibm_rave_core_interpolate_ArrayInterpolation.INSTANCE = new com_ibm_rave_core_interpolate_ArrayInterpolation();
  6532. // $source: com/ibm/rave/core/interpolate/TransformInterpolation
  6533. /************************************************************************
  6534. ** IBM Confidential
  6535. **
  6536. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6537. **
  6538. ** (C) Copyright IBM Corp. 2017
  6539. **
  6540. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6541. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6542. ************************************************************************/
  6543. // GENERATED
  6544. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6545. //@import com/ibm/rave/core/nativeImpl/math/TransformParser (runtime) // create
  6546. //@import com/ibm/rave/core/interpolate/NumberInterpolation (runtime) // NumberInterpolation
  6547. var com_ibm_rave_core_interpolate_TransformInterpolation = com_ibm_rave_core_nativeImpl_Declare({
  6548. _$functionClassMethod : function() {
  6549. var _$self = /**
  6550. * Returns an interpolator between the two 2D affine transforms represented by a and b. Each transform is decomposed to a standard representation of translate, rotate, x-skew and scale; these component transformations are then interpolated. This behavior is standardized by CSS
  6551. * @param (String) a a String object
  6552. * @param (String) b a String object
  6553. */
  6554. function(a, b) {
  6555. var s = [];
  6556. var q = [];
  6557. var aTransform = com_ibm_rave_core_nativeImpl_math_TransformParser.create(a);
  6558. var bTransform = com_ibm_rave_core_nativeImpl_math_TransformParser.create(b);
  6559. var ta = aTransform.translate;
  6560. var tb = bTransform.translate;
  6561. var ra = aTransform.rotate;
  6562. var rb = bTransform.rotate;
  6563. var wa = aTransform.skew;
  6564. var wb = bTransform.skew;
  6565. var ka = aTransform.scale;
  6566. var kb = bTransform.scale;
  6567. var n;
  6568. if (ta[0] != tb[0] || ta[1] != tb[1]) {
  6569. s.push("translate(");
  6570. s.push(null);
  6571. s.push(",");
  6572. s.push(null);
  6573. s.push(")");
  6574. var x0 = com_ibm_rave_core_interpolate_NumberInterpolation.INSTANCE(ta[0], tb[0]);
  6575. var InterpolatedValue0 = new com_ibm_rave_core_interpolate_TransformInterpolation.InterpolatedValue(1, x0);
  6576. q.push(InterpolatedValue0);
  6577. var x1 = com_ibm_rave_core_interpolate_NumberInterpolation.INSTANCE(ta[1], tb[1]);
  6578. var InterpolatedValue1 = new com_ibm_rave_core_interpolate_TransformInterpolation.InterpolatedValue(3, x1);
  6579. q.push(InterpolatedValue1);
  6580. } else if (tb[0] != 0 || tb[1] != 0) {
  6581. s.push("translate(" + tb[0] + "," + tb[1] + ")");
  6582. } else {
  6583. s.push("");
  6584. }
  6585. if (ra != rb) {
  6586. if (ra - rb > 180) {
  6587. rb += 360;
  6588. } else if (rb - ra > 180) {
  6589. ra += 360;
  6590. }
  6591. s.push("rotate(");
  6592. s.push(null);
  6593. s.push(")");
  6594. var i = s.length - 2;
  6595. var x = com_ibm_rave_core_interpolate_NumberInterpolation.INSTANCE(ra, rb);
  6596. var InterpolatedValue = new com_ibm_rave_core_interpolate_TransformInterpolation.InterpolatedValue(i, x);
  6597. q.push(InterpolatedValue);
  6598. } else if (rb != 0) {
  6599. s.push("rotate(" + rb + ")");
  6600. }
  6601. if (wa != wb) {
  6602. s.push("skewX(");
  6603. s.push(null);
  6604. s.push(")");
  6605. var i = s.length - 2;
  6606. var x = com_ibm_rave_core_interpolate_NumberInterpolation.INSTANCE(wa, wb);
  6607. var InterpolatedValue = new com_ibm_rave_core_interpolate_TransformInterpolation.InterpolatedValue(i, x);
  6608. q.push(InterpolatedValue);
  6609. } else if (wb != 0) {
  6610. s.push("skewX(" + wb + ")");
  6611. }
  6612. if (ka[0] != kb[0] || ka[1] != kb[1]) {
  6613. s.push("scale(");
  6614. s.push(null);
  6615. s.push(",");
  6616. s.push(null);
  6617. s.push(")");
  6618. n = s.length;
  6619. var x0 = com_ibm_rave_core_interpolate_NumberInterpolation.INSTANCE(ka[0], kb[0]);
  6620. var InterpolatedValue0 = new com_ibm_rave_core_interpolate_TransformInterpolation.InterpolatedValue(n - 4, x0);
  6621. q.push(InterpolatedValue0);
  6622. var x1 = com_ibm_rave_core_interpolate_NumberInterpolation.INSTANCE(ka[1], kb[1]);
  6623. var InterpolatedValue1 = new com_ibm_rave_core_interpolate_TransformInterpolation.InterpolatedValue(n - 2, x1);
  6624. q.push(InterpolatedValue1);
  6625. } else if (kb[0] != 1 || kb[1] != 1) {
  6626. s.push("scale(" + kb[0] + "," + kb[1] + ")");
  6627. }
  6628. n = q.length;
  6629. var nFinal = n;
  6630. var sFinal = s;
  6631. var qFinal = q;
  6632. return function(t) {
  6633. if (t == 1) {
  6634. return bTransform.toString();
  6635. }
  6636. var i = 0;
  6637. var o;
  6638. while (i < nFinal) {
  6639. o = qFinal[i];
  6640. sFinal[o.i] = o.x(t).toString();
  6641. i++;
  6642. }
  6643. var transformString = "";
  6644. for (var __i_enFor0 = 0, __exp_enFor0 = sFinal, __len_enFor0 = __exp_enFor0.length;
  6645. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  6646. var tS = __exp_enFor0[__i_enFor0];
  6647. transformString += tS;
  6648. }
  6649. return transformString;
  6650. };
  6651. };
  6652. return _$self;
  6653. }
  6654. //constructor : function() {}
  6655. });
  6656. com_ibm_rave_core_interpolate_TransformInterpolation.InterpolatedValue = com_ibm_rave_core_nativeImpl_Declare({
  6657. //x : null,
  6658. i : 0,
  6659. constructor : function(i, x) {
  6660. this.i = i;
  6661. this.x = x;
  6662. }
  6663. });
  6664. /** @expose */
  6665. com_ibm_rave_core_interpolate_TransformInterpolation.INSTANCE = new com_ibm_rave_core_interpolate_TransformInterpolation();
  6666. // $source: com/ibm/rave/core/internal/nativeImpl/scene/DOMSceneNode
  6667. /************************************************************************
  6668. ** IBM Confidential
  6669. **
  6670. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6671. **
  6672. ** (C) Copyright IBM Corp. 2014, 2016
  6673. **
  6674. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6675. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6676. ************************************************************************/
  6677. // @import com/ibm/rave/core/nativeImpl/Declare
  6678. // @import com/ibm/rave/core/nativeImpl/format/Requote
  6679. // @import com/ibm/rave/core/nativeImpl/Object
  6680. // @import com/ibm/rave/core/scene/SceneNodeType
  6681. // @import com/ibm/rave/core/transform/MatrixUtil
  6682. /**
  6683. * Represents all DOM nodes.
  6684. */
  6685. (function () {
  6686. function classed(domNode, className, add) {
  6687. // split given className into an array
  6688. var classes = className.match(/\S+/g) || [];
  6689. if (classes.length) {
  6690. // mimic node.className which is always a string value
  6691. var domClassName = domNode.getAttribute("class") || "";
  6692. // create a string where each value is separated by a single space
  6693. // and contains spaces at the beginning and end to help with indexOf searches
  6694. var newClassName = (domClassName ? (" " + domClassName + " ").replace(/[\t\r\n\f]/g, " ") : " ");
  6695. for (var i = 0; i < classes.length; i++) {
  6696. var clazz = classes[i];
  6697. if (add) {
  6698. // add
  6699. if (newClassName.indexOf(" " + clazz + " ") < 0) {
  6700. // append to end
  6701. newClassName += clazz + " ";
  6702. }
  6703. } else {
  6704. // remove
  6705. if (newClassName.indexOf(" " + clazz + " ") >= 0) {
  6706. // replace with empty space
  6707. newClassName = newClassName.replace(" " + clazz + " ", " ");
  6708. }
  6709. }
  6710. }
  6711. // trim beginning and end spaces
  6712. // assumes string#trim exists
  6713. newClassName = newClassName ? newClassName.trim() : "";
  6714. if (domClassName !== newClassName) {
  6715. domNode.setAttribute("class", newClassName);
  6716. return true;
  6717. }
  6718. } else {
  6719. return true;
  6720. }
  6721. return false;
  6722. }
  6723. var protoExt = {
  6724. _rave_isDOM: true,
  6725. /** @expose */
  6726. rave_getOwner: function () {
  6727. // SVG node
  6728. if ("http://www.w3.org/2000/svg" == this.namespaceURI) {
  6729. var svgOwner = this.ownerSVGElement;
  6730. if (svgOwner) {
  6731. svgOwner = svgOwner["__owner__"] || svgOwner;
  6732. } else {
  6733. svgOwner = this["__owner__"];
  6734. }
  6735. // TODO do we need to extend the node here?
  6736. return svgOwner || this;
  6737. }
  6738. // DOM node
  6739. return this;
  6740. },
  6741. /** @expose */
  6742. rave_setOwner: function (owner) {
  6743. this["__owner__"] = owner;
  6744. },
  6745. /** @expose */
  6746. rave_getParentNode: function (owner) {
  6747. return this.parentNode;
  6748. },
  6749. /** @expose */
  6750. rave_appendChild: function (node) {
  6751. if (node._rave_isDOM) {
  6752. this.appendChild(node);
  6753. } else {
  6754. // Calling append on a canvas DOM node. need to get the virtual dom
  6755. var root = this.rave_getProperty("__rave_canvas_root__");
  6756. if (root) {
  6757. root.appendChild(node);
  6758. }
  6759. }
  6760. },
  6761. /** @expose */
  6762. rave_insertBefore: function (node, before) {
  6763. if (node._rave_isDOM) {
  6764. this.insertBefore(node, before);
  6765. } else {
  6766. // Calling insert on a canvas DOM node. need to get the virtual dom
  6767. var root = this.rave_getProperty("__rave_canvas_root__");
  6768. if (root) {
  6769. root.insertBefore(node, before);
  6770. }
  6771. }
  6772. },
  6773. /** @expose */
  6774. rave_setStyle: function (style, value, priority) {
  6775. this.style.setProperty(style, value, priority);
  6776. },
  6777. /** @expose */
  6778. rave_getStyle: function (style) {
  6779. return this.style.getPropertyValue(style);
  6780. },
  6781. /** @expose */
  6782. rave_removeStyle: function (style) {
  6783. this.style.removeProperty(style);
  6784. },
  6785. /** @expose */
  6786. rave_setText: function (text) {
  6787. this.textContent = text;
  6788. },
  6789. /** @expose */
  6790. rave_getText: function () {
  6791. return this.textContent;
  6792. },
  6793. /** @expose */
  6794. rave_setHtml: function (html) {
  6795. this.innerHTML = html;
  6796. },
  6797. /** @expose */
  6798. rave_getHtml: function () {
  6799. return this.innerHTML;
  6800. },
  6801. /** @expose */
  6802. rave_getComputedStyle: function (style) {
  6803. return rave_window(this).getComputedStyle(this).getPropertyValue(style);
  6804. },
  6805. /** @expose */
  6806. rave_getSizePx : function(size) {
  6807. var root = this.rave_getProperty("__rave_canvas_root__");
  6808. if(root){
  6809. return root.rave_getSizePx(size);
  6810. }
  6811. var value = 0;
  6812. if (size) {
  6813. value = size.value;
  6814. switch (size.unit.type) {
  6815. case 1: //em
  6816. if(this.rave_getDrawType() == com_ibm_rave_core_scene_SceneNodeType.TEXT){ // TextSceneItem
  6817. value = +this.rave_getComputedStyle("font-size").replace("px", "") * value;
  6818. }
  6819. break;
  6820. case 2: // percent
  6821. if(this.rave_getDrawType() == com_ibm_rave_core_scene_SceneNodeType.LINEARGRADIENT || // Gradient scene item types
  6822. this.rave_getDrawType() == com_ibm_rave_core_scene_SceneNodeType.RADIALGRADIENT ||
  6823. this.rave_getDrawType() == com_ibm_rave_core_scene_SceneNodeType.STOP){
  6824. value = value / 100;
  6825. }
  6826. break;
  6827. case 4: //cm
  6828. value = 96.0 * 0.3937007874 * value;
  6829. break;
  6830. case 3: // in
  6831. value = 96.0 * value;
  6832. break;
  6833. case 6: //pt
  6834. value = 96.0 * 0.0138888889 * value;
  6835. break;
  6836. case 7: //pc
  6837. value = 96.0 * 0.1666666667 * value;
  6838. break;
  6839. case 5: //mm
  6840. value = 96.0 * 0.0393700787 * value;
  6841. break;
  6842. }
  6843. }
  6844. return value;
  6845. },
  6846. /** @expose */
  6847. rave_getComputedStyles: function () {
  6848. return rave_window(this).getComputedStyle(this);
  6849. },
  6850. /** @expose */
  6851. rave_containsClass: function (className) {
  6852. var check = className.match(/\S+/g);
  6853. if (check && check.length) {
  6854. var classList = this.classList;
  6855. if (classList && classList.length) {
  6856. for (var i = 0; i < check.length; ++i) {
  6857. if (!classList.contains(check[i])) {
  6858. return false;
  6859. }
  6860. }
  6861. return true;
  6862. } else {
  6863. classList = (this.getAttribute("class") || "").match(/\S+/g);
  6864. if (classList && classList.length) {
  6865. for (var i = 0; i < check.length; ++i) {
  6866. if (classList.indexOf(check[i]) == -1) {
  6867. return false;
  6868. }
  6869. }
  6870. return true;
  6871. }
  6872. }
  6873. return false;
  6874. }
  6875. return true;
  6876. },
  6877. /** @expose */
  6878. rave_addClass: function (className) {
  6879. return classed(this, className, true);
  6880. },
  6881. /** @expose */
  6882. rave_removeClass: function (className) {
  6883. return classed(this, className, false);
  6884. },
  6885. /** @expose */
  6886. rave_getEventListener: function (eventType) {
  6887. return this["__on" + eventType];
  6888. },
  6889. /** @expose */
  6890. rave_addEventListener: function (eventType, listener, useCapture, group) {
  6891. var domNode = this,
  6892. name = "__on" + eventType + (group != null ? "." + group : ""),
  6893. existing = domNode[name];
  6894. if (existing) {
  6895. // remove existing listener
  6896. domNode.removeEventListener(eventType, existing, existing.__useCapture);
  6897. }
  6898. listener.__useCapture = useCapture;
  6899. // storing properties on the dom node is slower
  6900. domNode[name] = listener;
  6901. domNode.addEventListener(eventType, listener, useCapture);
  6902. },
  6903. /** @expose */
  6904. rave_removeEventListener: function (eventType, group) {
  6905. var domNode = this,
  6906. name = "__on" + eventType + (group != null ? "." + group : ""),
  6907. l = domNode[name];
  6908. if (l) {
  6909. domNode.removeEventListener(eventType, l, l.__useCapture);
  6910. delete domNode[name];
  6911. }
  6912. },
  6913. /** @expose */
  6914. rave_removeEventListeners: function (group) {
  6915. if (group != null) {
  6916. group = com_ibm_rave_core_nativeImpl_format_Requote.requote("\." + group);
  6917. }
  6918. var domNode = this,
  6919. re = new RegExp("^__on([^.]+)" + group + "$"),
  6920. match;
  6921. for (var name in domNode) {
  6922. if (match = name.match(re)) {
  6923. var l = domNode[name];
  6924. domNode.removeEventListener(match[1], l, l.__useCapture);
  6925. delete domNode[name];
  6926. }
  6927. }
  6928. },
  6929. /** @expose */
  6930. rave_setData: function (newData) {
  6931. this["__data__"] = newData;
  6932. },
  6933. /** @expose */
  6934. rave_getData: function () {
  6935. return this["__data__"];
  6936. },
  6937. /** @expose */
  6938. rave_hasData: function () {
  6939. return "__data__" in this;
  6940. },
  6941. /** @expose */
  6942. rave_setProperty: function (key, value) {
  6943. this[key] = value;
  6944. },
  6945. /** @expose */
  6946. rave_getProperty: function (key) {
  6947. return this[key];
  6948. },
  6949. /** @expose */
  6950. rave_hasProperty: function (propName) {
  6951. return propName in this;
  6952. },
  6953. /** @expose */
  6954. rave_removeProperty: function (key) {
  6955. delete this[key];
  6956. },
  6957. /** @expose */
  6958. rave_getNextSibling: function () {
  6959. return this.nextElementSibling;
  6960. },
  6961. /** @expose */
  6962. rave_getPreviousSibling: function () {
  6963. return this.previousElementSibling;
  6964. },
  6965. /** @expose */
  6966. rave_getFirstChild: function () {
  6967. if (this.hasChildNodes()) {
  6968. var children = this.childNodes;
  6969. for (var i = 0; i < children.length; i++) {
  6970. if (children[i].nodeType == 1) {
  6971. return children[i];
  6972. }
  6973. }
  6974. }
  6975. },
  6976. /** @expose */
  6977. rave_hasChildNodes: function () {
  6978. if (this.hasChildNodes()) {
  6979. var children = this.childNodes;
  6980. for (var i = 0; i < children.length; i++) {
  6981. if (children[i].nodeType == 1) {
  6982. return true;
  6983. }
  6984. }
  6985. }
  6986. return false;
  6987. },
  6988. /** @expose */
  6989. rave_getChildNodes: function () {
  6990. if (this['__rave_canvas_root__']) {// for canvas root node
  6991. return (this['__rave_canvas_root__'].rave_getChildNodes());
  6992. }
  6993. if (this.hasChildNodes()) {
  6994. var result = [],
  6995. children = this.childNodes;
  6996. for (var i = 0; i < children.length; i++) {
  6997. if (children[i].nodeType == 1) {
  6998. result.push(children[i]);
  6999. }
  7000. }
  7001. return result;
  7002. }
  7003. return this.childNodes;
  7004. },
  7005. /** @expose */
  7006. rave_getName: function () {
  7007. return this.nodeName;
  7008. },
  7009. /** @expose */
  7010. rave_getNamespaceURI: function () {
  7011. return this.namespaceURI;
  7012. },
  7013. /** @expose */
  7014. rave_getQualifiedName: function () {
  7015. return this.namespaceURI + ":" + this.nodeName;
  7016. },
  7017. /** @expose */
  7018. rave_getNodeType: function () {
  7019. return this.nodeType;
  7020. },
  7021. /** @expose */
  7022. rave_initExtensions: function () {
  7023. // no extensions by default
  7024. },
  7025. /** @expose */
  7026. rave_getDrawType: function () {
  7027. // This is a list of internally supported node types. Only SVG nodes are supported here, not DOM nodes of any kind.
  7028. // TODO - we cannot determine the difference between line, circle and other path shapes in SVG since they are all <path> nodes
  7029. // TODO - do we need to tell the difference between these?
  7030. // TODO - currently this is only used in Mirroring to determine if a node is a group node.
  7031. switch (this.nodeName) {
  7032. case "text":
  7033. return com_ibm_rave_core_scene_SceneNodeType.TEXT;
  7034. case "image":
  7035. return com_ibm_rave_core_scene_SceneNodeType.IMAGE;
  7036. case "#text":
  7037. return com_ibm_rave_core_scene_SceneNodeType.TEXT_CONTENT;
  7038. case "g":
  7039. return com_ibm_rave_core_scene_SceneNodeType.GROUP;
  7040. case "rect":
  7041. return com_ibm_rave_core_scene_SceneNodeType.RECT;
  7042. default:
  7043. return com_ibm_rave_core_scene_SceneNodeType.UNKNOWN;
  7044. }
  7045. },
  7046. // TODO Firefox does not support svg#checkIntersection or svg#getIntersectionList
  7047. /** @expose */
  7048. rave_intersects: function (x, y) {
  7049. // This API can be called in two ways (rect) or (x,y)
  7050. var rect = y ? null : x;
  7051. var root = this.rave_getProperty("__rave_canvas_root__");
  7052. if (root) {
  7053. // If we don't have a y, just pass in x which will be a rect.
  7054. return rect ? root.rave_intersects(rect) : root.rave_intersects(x, y);
  7055. }
  7056. var owner = this.rave_getOwner();
  7057. if (rect) {
  7058. // assume x is a rect object
  7059. rect = getSVGRect(owner, this, x.x, x.y, x.width, x.height);
  7060. } else {
  7061. rect = getSVGRect(owner, this, x, y, 1, 1);
  7062. }
  7063. return rect ? owner.checkIntersection(this, rect) : false;
  7064. },
  7065. /** @expose */
  7066. rave_intersectionList: function (x, y) {
  7067. // This API can be called in two ways (rect) or (x,y)
  7068. var rect = y ? null : x;
  7069. var root = this.rave_getProperty("__rave_canvas_root__");
  7070. if (root) {
  7071. // If we don't have a y, just pass in x which will be a rect.
  7072. return !y ? root.rave_intersectionList(x) : root.rave_intersectionList(x, y);
  7073. }
  7074. var owner = this.rave_getOwner();
  7075. if (rect) {
  7076. // assume x is a rect object
  7077. rect = getSVGRect(owner, this, x.x, x.y, x.width, x.height);
  7078. } else {
  7079. rect = getSVGRect(owner, this, x, y, 1, 1);
  7080. }
  7081. return rect ? owner.getIntersectionList(rect, this) : [];
  7082. },
  7083. /** @expose */
  7084. rave_intersection: function (x, y) {
  7085. return this.rave_intersectionList(x, y)[0];
  7086. },
  7087. /** @expose */
  7088. rave_dispose: function () {
  7089. var canvasRoot = this.rave_getProperty("__rave_canvas_root__");
  7090. if (canvasRoot) {
  7091. canvasRoot.rave_dispose();
  7092. }
  7093. }
  7094. };
  7095. // converts a point or rect to an svg rect, applying the transform of the node's computed matrix
  7096. function getSVGRect(owner, node, x, y, width, height) {
  7097. var rect = x,
  7098. ctm, x2, y2, tmp = x;
  7099. if (owner && !(rect instanceof SVGRect)) {
  7100. if (arguments.length == 6) {
  7101. tmp = {};
  7102. tmp.width = width;
  7103. tmp.height = height;
  7104. tmp.x = x;
  7105. tmp.y = y;
  7106. }
  7107. if (ctm = node.getCTM()) {
  7108. tmp = com_ibm_rave_core_transform_MatrixUtil.transformBounds(tmp, ctm);
  7109. }
  7110. // create an SVG rect
  7111. rect = owner.createSVGRect();
  7112. rect.x = tmp.x;
  7113. rect.y = tmp.y;
  7114. rect.width = tmp.width;
  7115. rect.height = tmp.height;
  7116. }
  7117. return rect;
  7118. }
  7119. var type;
  7120. var raveWindow = rave_window(global);
  7121. if (rave_document && raveWindow) {
  7122. // extend iframe prototype
  7123. try {
  7124. // If the parent window has another origin, then accessing frameElement
  7125. // throws an Error in IE
  7126. if (raveWindow.frameElement) {
  7127. com_ibm_rave_core_nativeImpl_Object.mixin(Object.getPrototypeOf(raveWindow.frameElement), protoExt);
  7128. }
  7129. } catch (e) {
  7130. //Keep going
  7131. }
  7132. // extend window prototype
  7133. com_ibm_rave_core_nativeImpl_Object.mixin(Object.getPrototypeOf(raveWindow), protoExt);
  7134. // extend document prototype
  7135. com_ibm_rave_core_nativeImpl_Object.mixin(((type = raveWindow["Document"]) ? type.prototype : type) || Object.getPrototypeOf(document), protoExt);
  7136. // extend DOM element and SVG prototypes
  7137. com_ibm_rave_core_nativeImpl_Object.mixin(((type = raveWindow["Node"]) ? type.prototype : type) ||
  7138. Object.getPrototypeOf(rave_document.body),
  7139. protoExt);
  7140. com_ibm_rave_core_nativeImpl_Object.mixin(((type = (raveWindow["SVGElement"] || raveWindow["SVGGraphicsElement"])) ? type.prototype : type) ||
  7141. Object.getPrototypeOf(rave_document.createElementNS("http://www.w3.org/2000/svg", "svg")),
  7142. protoExt);
  7143. }
  7144. })();
  7145. // $source: com/ibm/rave/core/internal/nativeImpl/selector/DOMSelectionQueryEngine
  7146. /************************************************************************
  7147. ** IBM Confidential
  7148. **
  7149. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7150. **
  7151. ** (C) Copyright IBM Corp. 2014, 2015
  7152. **
  7153. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7154. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7155. ************************************************************************/
  7156. // @import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7157. /**
  7158. * A CSS3 selection query engine for DOM nodes.
  7159. * @author sproulja
  7160. */
  7161. var com_ibm_rave_core_internal_nativeImpl_selector_DOMSelectionQueryEngine = com_ibm_rave_core_nativeImpl_Declare({
  7162. matches : (function() {
  7163. if (rave_document) {
  7164. var documentElement = rave_documentElement(rave_document);
  7165. var matches = documentElement.matches || documentElement[vendorSymbol(documentElement, "matchesSelector")]
  7166. return function(context, selectorString) {
  7167. if (! context.nodeType) {
  7168. return false; // This is not a DOM node. Could be a Rave internal scene node.
  7169. }
  7170. return matches.call(context, selectorString);
  7171. };
  7172. }
  7173. })(),
  7174. querySelector : function(query, rootNode) {
  7175. return (rootNode || rave_document).querySelector(query);
  7176. },
  7177. querySelectorAll : function(query, rootNode) {
  7178. return (rootNode || rave_document).querySelectorAll(query);
  7179. }
  7180. });
  7181. // $source: com/ibm/rave/core/internal/selector/mirror/MirrorConstants
  7182. /************************************************************************
  7183. ** IBM Confidential
  7184. **
  7185. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7186. **
  7187. ** (C) Copyright IBM Corp. 2017
  7188. **
  7189. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7190. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7191. ************************************************************************/
  7192. // GENERATED
  7193. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7194. /**
  7195. * Simple class that holds property names for mirrored nodes.
  7196. * @author jim
  7197. */
  7198. var com_ibm_rave_core_internal_selector_mirror_MirrorConstants = com_ibm_rave_core_nativeImpl_Declare({
  7199. });
  7200. /**
  7201. * all mirrored items get this property to signify that they are mirrored for future selections
  7202. */
  7203. //com_ibm_rave_core_internal_selector_mirror_MirrorConstants.MIRRORED_PROPERTY = "__rave-mirrored__";
  7204. /**
  7205. * grouping nodes for text and images get this property
  7206. */
  7207. com_ibm_rave_core_internal_selector_mirror_MirrorConstants.MIRRORED_GROUP_PROPERTY = "__rave-mirrored-group__";
  7208. /**
  7209. * 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.
  7210. */
  7211. com_ibm_rave_core_internal_selector_mirror_MirrorConstants.RAW_NODE_ACCESS_PROPERTY = "__rave-raw-node-access__";
  7212. /**
  7213. * Property used to hold the 'group' wrapping node reference. Used on 'owner' (svg) nodes.
  7214. */
  7215. com_ibm_rave_core_internal_selector_mirror_MirrorConstants.GROUP_NODE_PROPERTY = "__rave-group-node-property__";
  7216. /**
  7217. * 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.
  7218. */
  7219. com_ibm_rave_core_internal_selector_mirror_MirrorConstants.MIRRORED_OWNER_GROUP_NODE_PROPERTY = "__rave-owner-group-node-property__";
  7220. /**
  7221. * The original transform applied to a node by an external source.
  7222. */
  7223. com_ibm_rave_core_internal_selector_mirror_MirrorConstants.ORIGINAL_STYLE_ATTRIBUTE = "__rave-original-style__";
  7224. /**
  7225. * The original transform applied to a node by an external source.
  7226. */
  7227. com_ibm_rave_core_internal_selector_mirror_MirrorConstants.ORIGINAL_TRANSFORM_ATTRIBUTE = "__rave-original-transform__";
  7228. // $source: com/ibm/rave/core/internal/selector/mirror/MirrorUtil
  7229. /************************************************************************
  7230. ** IBM Confidential
  7231. **
  7232. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7233. **
  7234. ** (C) Copyright IBM Corp. 2017
  7235. **
  7236. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7237. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7238. ************************************************************************/
  7239. // GENERATED
  7240. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7241. //@import com/ibm/rave/core/internal/selector/mirror/MirrorConstants (static) // MirrorConstants
  7242. //@import com/ibm/rave/core/selector/Selector (runtime) // new
  7243. /**
  7244. * Helper methods to determine properties on scene nodes for mirroring.
  7245. */
  7246. var com_ibm_rave_core_internal_selector_mirror_MirrorUtil = com_ibm_rave_core_nativeImpl_Declare({
  7247. });
  7248. /**
  7249. * Is the passed node mirrored or not. Determines based on a special attribute set on the node.
  7250. * @return (boolean) is this node mirrored
  7251. */
  7252. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isMirrored = function(node) {
  7253. return (node.rave_getProperty("__rave-mirrored__"));
  7254. };
  7255. /**
  7256. * Helper static utility to determine if the passed item is a wrapping group node. This means a wrapping
  7257. * @param (com.ibm.rave.core.scene.SceneNode) node SceneNode that may or may not be a wrapping group node.
  7258. * @return (boolean) <code>true</code> if item is a mirrored group node, <code>false</code> otherwise.
  7259. */
  7260. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isGroupNode = function(node) {
  7261. 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));
  7262. };
  7263. /**
  7264. * 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).
  7265. * @param (com.ibm.rave.core.scene.SceneNode) node Check if this node is a wrapping group node under an owner.
  7266. * @return (boolean) <code>true</code> if this node is an 'owner' grouping node. <code>false</code> otherwise.
  7267. */
  7268. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isOwnerGroupNode = function(node) {
  7269. return node && ((node.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.MIRRORED_OWNER_GROUP_NODE_PROPERTY)));
  7270. };
  7271. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isWrappableNode = function(node) {
  7272. var drawType = node.rave_getDrawType();
  7273. return drawType == 1003 || drawType == 1007;
  7274. };
  7275. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isGroupOrOwnerNode = function(node) {
  7276. return node == node.rave_getOwner() || node.rave_getDrawType() == 1004;
  7277. };
  7278. /**
  7279. * 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.
  7280. * @param (com.ibm.rave.core.scene.SceneNode) node
  7281. * @param (boolean) value
  7282. * @return (boolean) The original raw node value.
  7283. */
  7284. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode = function(node, value) {
  7285. var owner = node.rave_getOwner();
  7286. if (!owner) {
  7287. return true;
  7288. }
  7289. var originalRawNode = owner.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.RAW_NODE_ACCESS_PROPERTY);
  7290. owner.rave_setProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.RAW_NODE_ACCESS_PROPERTY, value ? value : null);
  7291. return (originalRawNode);
  7292. };
  7293. /**
  7294. * 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.
  7295. * @param (com.ibm.rave.core.scene.SceneNode) node Node to check
  7296. * @return (boolean) <code>true</code if this node is in raw mode, <code>false</code> otherwise.
  7297. */
  7298. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isRawMode = function(node) {
  7299. var owner = node.rave_getOwner();
  7300. return !owner ? true : ((owner.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.RAW_NODE_ACCESS_PROPERTY)));
  7301. };
  7302. /**
  7303. * 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>
  7304. * @return (com.ibm.rave.core.scene.SceneNode) new wrapping group node
  7305. */
  7306. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.createWrappingGroup = function(context) {
  7307. var existingChildren = [];
  7308. for (var __i_enFor0 = 0, __exp_enFor0 = context.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  7309. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7310. var child = __exp_enFor0[__i_enFor0];
  7311. existingChildren.push(child);
  7312. }
  7313. var group = new com_ibm_rave_core_selector_Selector().init(context).append("g");
  7314. group.property(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.MIRRORED_GROUP_PROPERTY, true);
  7315. group.property(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.MIRRORED_OWNER_GROUP_NODE_PROPERTY, true);
  7316. group.property("__rave-mirrored__", true);
  7317. var groupNode = group.node();
  7318. for (var __i_enFor1 = 0, __exp_enFor1 = existingChildren, __len_enFor1 = __exp_enFor1.length;
  7319. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  7320. var child = __exp_enFor1[__i_enFor1];
  7321. groupNode.rave_appendChild(child);
  7322. }
  7323. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.getExtendableNode(context).rave_setProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.GROUP_NODE_PROPERTY, groupNode);
  7324. return groupNode;
  7325. };
  7326. /**
  7327. * @param (com.ibm.rave.core.scene.SceneNode) context
  7328. * @return (boolean) true if the context node has wrapping group used for mirroring, false otherwise
  7329. */
  7330. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.hasWrappingGroup = function(context) {
  7331. return (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.getWrappingGroup(context));
  7332. };
  7333. /**
  7334. * @param (com.ibm.rave.core.scene.SceneNode) context
  7335. * @return (com.ibm.rave.core.scene.SceneNode) wrapping group used for mirroring if exists, null otherwise
  7336. */
  7337. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.getWrappingGroup = function(context) {
  7338. return com_ibm_rave_core_internal_selector_mirror_MirrorUtil.getExtendableNode(context).rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.GROUP_NODE_PROPERTY);
  7339. };
  7340. /**
  7341. * Return a scene node , which can be extended, by removing wrapper or delegates, if any.If there are no wrappers or delegates, return node itself. E.g. for canvas DOM node will return secondary root node
  7342. * @param (com.ibm.rave.core.scene.SceneNode) node a scene node
  7343. * @return (com.ibm.rave.core.scene.SceneNode) a scene node , which can be extended, by removing wrapper or delegates, if any. If there are no wrappers or delegates, return node itself
  7344. */
  7345. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.getExtendableNode = function(node) {
  7346. var canvas_root = node.rave_getProperty("__rave_canvas_root__");
  7347. if (canvas_root) {
  7348. return canvas_root;
  7349. }
  7350. return node;
  7351. };
  7352. // $source: com/ibm/rave/core/internal/nativeImpl/selector/mirror/MirroredSceneNodeUtils
  7353. /************************************************************************
  7354. ** IBM Confidential
  7355. **
  7356. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7357. **
  7358. ** (C) Copyright IBM Corp. 2015
  7359. **
  7360. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7361. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7362. ************************************************************************/
  7363. //@import com/ibm/rave/core/nativeImpl/timer/Timer (static) // Timer
  7364. var com_ibm_rave_core_internal_nativeImpl_selector_mirror_MirroredSceneNodeUtils = {
  7365. wrapTimer : function(timerEvent) {
  7366. // Wrap our timer event in a Rave timer so getBBox() returns correct value after it gets laid out.
  7367. com_ibm_rave_core_nativeImpl_timer_Timer.INSTANCE(timerEvent, 0, 0);
  7368. }
  7369. };
  7370. // $source: com/ibm/rave/core/internal/selector/mirror/WrappedMirroredSceneNodeHelper
  7371. /************************************************************************
  7372. ** IBM Confidential
  7373. **
  7374. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7375. **
  7376. ** (C) Copyright IBM Corp. 2017
  7377. **
  7378. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7379. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7380. ************************************************************************/
  7381. // GENERATED
  7382. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7383. //@import com/ibm/rave/core/internal/nativeImpl/selector/mirror/MirroredSceneNodeUtils (static) // wrapTimer
  7384. //@import com/ibm/rave/core/internal/selector/mirror/MirrorUtil (runtime) // isMirrored, setRawNode, isWrappableNode
  7385. //@import com/ibm/rave/core/geom/RectStruct (runtime) // new
  7386. //@import com/ibm/rave/core/internal/css/CSSTransformParser (runtime) // parse
  7387. //@import com/ibm/rave/core/transform/MatrixUtil (runtime) // matrixToString
  7388. //@import com/ibm/rave/core/internal/selector/mirror/MirrorConstants (static) // MirrorConstants
  7389. /**
  7390. * 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.
  7391. * @author jim
  7392. */
  7393. var com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper = com_ibm_rave_core_nativeImpl_Declare({
  7394. });
  7395. /**
  7396. * Update the passed node to horizontally scale in the opposite direction. This will flip text and image nodes back so they are the in the correct orientation. This method does a few things: 1) stores existing transform style so we can put it back if we un-mirror later. 2) determines any existing transforms applied directly on this node (the difference in computed transform matrix from its parent) 3) takes any additional horizontal positioning (via 'x' attribute) into account using the BBox of the node. 4) calculates a new transform matrix and overwrites the in-lined 'transform' style. 5) when un-mirroring, simply puts the old transform style back.
  7397. * @param (com.ibm.rave.core.scene.SceneNode) node Node to update
  7398. */
  7399. com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.update = function(node) {
  7400. com_ibm_rave_core_internal_nativeImpl_selector_mirror_MirroredSceneNodeUtils.wrapTimer(function(elapsed) {
  7401. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(node, true);
  7402. var originalTransformAttribute = com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.getOriginalTransformAttribute(node);
  7403. if (originalTransformAttribute == null) {
  7404. originalTransformAttribute = com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.storeOriginalTransformAttr(node);
  7405. }
  7406. if (originalTransformAttribute == "") {
  7407. node.removeAttribute("transform");
  7408. } else {
  7409. node.setAttribute("transform", originalTransformAttribute);
  7410. }
  7411. var originalStyleTransform = com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.getOriginalStyleTransform(node);
  7412. if (originalStyleTransform == null) {
  7413. originalStyleTransform = com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.storeOriginalStyleTransform(node);
  7414. }
  7415. if (originalStyleTransform == "") {
  7416. node.rave_removeStyle("transform");
  7417. } else {
  7418. node.rave_setStyle("transform", originalStyleTransform, "");
  7419. }
  7420. if (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isWrappableNode(node) && com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isMirrored(node)) {
  7421. try {
  7422. var rect = node.getBBox();
  7423. var struct = new com_ibm_rave_core_geom_RectStruct(rect.x, rect.y, rect.width, rect.height);
  7424. var translateAmount = struct.width + 2 * struct.x;
  7425. var ctm = com_ibm_rave_core_internal_css_CSSTransformParser.parse("matrix(1,0,0,1,0,0)");
  7426. var transformStyle = null;
  7427. var transformAttr = null;
  7428. var computedStyleMatrix = com_ibm_rave_core_internal_css_CSSTransformParser.parse(node.rave_getComputedStyle("transform"));
  7429. if (computedStyleMatrix) {
  7430. transformStyle = computedStyleMatrix;
  7431. node.rave_removeStyle("transform");
  7432. }
  7433. var transform = node.getAttribute("transform");
  7434. if (transform != null) {
  7435. var transformMatrix = com_ibm_rave_core_internal_css_CSSTransformParser.parse(transform);
  7436. if (transformMatrix) {
  7437. transformAttr = transformMatrix;
  7438. node.removeAttribute("transform");
  7439. }
  7440. }
  7441. if (transformStyle) {
  7442. ctm = transformStyle;
  7443. } else if (transformAttr) {
  7444. ctm = transformAttr;
  7445. }
  7446. var newCTM = ctm.translate(translateAmount, 0);
  7447. newCTM = newCTM.scaleNonUniform(-1, 1);
  7448. var newStyleAttr = com_ibm_rave_core_transform_MatrixUtil.matrixToString(newCTM);
  7449. node.setAttribute("transform", newStyleAttr);
  7450. } catch (e) {
  7451. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(e, Object)) {
  7452. } else {
  7453. throw e;
  7454. }
  7455. }
  7456. } else {
  7457. var transformAttr = com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.getOriginalTransformAttribute(node);
  7458. if (transformAttr != null && transformAttr.length > 0) {
  7459. node.setAttribute("transform", transformAttr);
  7460. } else {
  7461. node.removeAttribute("transform");
  7462. }
  7463. var transformStyle = com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.getOriginalStyleTransform(node);
  7464. if (transformStyle != null && transformStyle.length > 0) {
  7465. node.rave_setStyle("transform", transformStyle);
  7466. }
  7467. }
  7468. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(node, false);
  7469. return true;
  7470. });
  7471. };
  7472. /**
  7473. * Store the original style transform on a property on this mirrored node. Note that when a style is set again on a mirrored node (via setStyle) this property is updated then.
  7474. * @see (com.ibm.rave.core.internal.selector.mirror.MirroredSceneNodeExtension) MirroredSceneNodeExtension
  7475. */
  7476. com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.storeOriginalStyleTransform = function(node) {
  7477. var style = node.rave_getStyle("transform");
  7478. var styleStr = style != null ? style : "";
  7479. node.rave_setProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.ORIGINAL_STYLE_ATTRIBUTE, styleStr);
  7480. return styleStr;
  7481. };
  7482. com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.getOriginalStyleTransform = function(node) {
  7483. return node.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.ORIGINAL_STYLE_ATTRIBUTE);
  7484. };
  7485. /**
  7486. * Store the original style attribute on a property on this mirrored node. Note that when a style is set again on a mirrored node (via setStyle) this property is updated then.
  7487. * @see (com.ibm.rave.core.internal.selector.mirror.MirroredSceneNodeExtension) MirroredSceneNodeExtension
  7488. */
  7489. com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.storeOriginalTransformAttr = function(node) {
  7490. var style = node.getAttribute("transform");
  7491. var styleStr = style != null ? style : "";
  7492. node.rave_setProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.ORIGINAL_TRANSFORM_ATTRIBUTE, styleStr);
  7493. return styleStr;
  7494. };
  7495. com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.getOriginalTransformAttribute = function(node) {
  7496. return node.rave_getProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.ORIGINAL_TRANSFORM_ATTRIBUTE);
  7497. };
  7498. //com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.TRANSFORM = "transform";
  7499. // $source: com/ibm/rave/core/internal/css/CSSTransformParser
  7500. /************************************************************************
  7501. ** IBM Confidential
  7502. **
  7503. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7504. **
  7505. ** (C) Copyright IBM Corp. 2017
  7506. **
  7507. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7508. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7509. ************************************************************************/
  7510. // GENERATED
  7511. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7512. //@import com/ibm/rave/core/internal/css/CSSParser (runtime) // parseStyle
  7513. //@import com/ibm/rave/core/transform/MatrixUtil (static) // identity, create
  7514. //@import com/ibm/rave/core/internal/css/om/CSSTransformValue (runtime) // determineType
  7515. //@import com/ibm/rave/core/internal/css/CSSUtil (runtime) // parseSize
  7516. /**
  7517. * Responsible for taking a list of CSS transform declarations and converting them into a single multiplied matrix.
  7518. */
  7519. var com_ibm_rave_core_internal_css_CSSTransformParser = com_ibm_rave_core_nativeImpl_Declare({
  7520. });
  7521. /**
  7522. * Parse a transform string and return a multiplied matrix containing all values. Note - Do not use this API from the core engine, use the TransformParser instead!
  7523. * @see (com.ibm.rave.core.nativeImpl.math.TransformParser) TransformParser
  7524. * @param (String) style CSS transform style string.
  7525. * @return (com.ibm.rave.core.transform.Matrix) Matrix combining all styles. Will return null if parsing returns no transforms.
  7526. */
  7527. com_ibm_rave_core_internal_css_CSSTransformParser.parse = function(style) {
  7528. var matrix;
  7529. var declaration = com_ibm_rave_core_internal_css_CSSParser.parseStyle("transform", style);
  7530. if (declaration) {
  7531. declaration.each(function(name, value, i) {
  7532. var valueList = value;
  7533. if (valueList) {
  7534. valueList.each(function(_name, _value, index) {
  7535. var transformValue = _value;
  7536. var newMatrix = com_ibm_rave_core_internal_css_CSSTransformParser.create(_name, transformValue);
  7537. if (matrix) {
  7538. newMatrix = matrix.multiply(newMatrix);
  7539. }
  7540. matrix = newMatrix;
  7541. });
  7542. }
  7543. });
  7544. }
  7545. return matrix;
  7546. };
  7547. com_ibm_rave_core_internal_css_CSSTransformParser.create = function(operator, transformValue) {
  7548. var result = com_ibm_rave_core_transform_MatrixUtil.identity();
  7549. var values = [];
  7550. transformValue.each(function(name, value, index) {
  7551. values.push(value);
  7552. });
  7553. if (values.length > 0) {
  7554. var firstValue = com_ibm_rave_core_internal_css_CSSTransformParser.convert(values, 0);
  7555. var type = com_ibm_rave_core_internal_css_om_CSSTransformValue.determineType(operator);
  7556. switch (type) {
  7557. case 5:
  7558. if (values.length == 1) {
  7559. result = result.scale(firstValue);
  7560. } else if (values.length == 2) {
  7561. result = result.scaleNonUniform(firstValue, com_ibm_rave_core_internal_css_CSSTransformParser.convert(values, 1));
  7562. }
  7563. break;
  7564. case 6:
  7565. result = result.scaleNonUniform(firstValue, 1);
  7566. break;
  7567. case 7:
  7568. result = result.scaleNonUniform(1, firstValue);
  7569. break;
  7570. case 4:
  7571. if (values.length > 2) {
  7572. result = result.rotate(firstValue, com_ibm_rave_core_internal_css_CSSTransformParser.convert(values, 1), com_ibm_rave_core_internal_css_CSSTransformParser.convert(values, 2));
  7573. } else if (values.length == 1) {
  7574. result = result.rotate(firstValue);
  7575. }
  7576. break;
  7577. case 8:
  7578. if (values.length > 1) {
  7579. result = result.skewX(firstValue).skewY(com_ibm_rave_core_internal_css_CSSTransformParser.convert(values, 1));
  7580. }
  7581. break;
  7582. case 9:
  7583. result = result.skewX(firstValue);
  7584. break;
  7585. case 10:
  7586. result = result.skewY(firstValue);
  7587. break;
  7588. case 1:
  7589. if (values.length > 1) {
  7590. result = result.translate(firstValue, com_ibm_rave_core_internal_css_CSSTransformParser.convert(values, 1));
  7591. break;
  7592. }
  7593. case 2:
  7594. result = result.translate(firstValue, 0);
  7595. break;
  7596. case 3:
  7597. result = result.translate(0, firstValue);
  7598. break;
  7599. case 11:
  7600. if (values.length == 6) {
  7601. result = com_ibm_rave_core_transform_MatrixUtil.create(firstValue, com_ibm_rave_core_internal_css_CSSTransformParser.convert(values, 1), com_ibm_rave_core_internal_css_CSSTransformParser.convert(values, 2), com_ibm_rave_core_internal_css_CSSTransformParser.convert(values, 3), com_ibm_rave_core_internal_css_CSSTransformParser.convert(values, 4), com_ibm_rave_core_internal_css_CSSTransformParser.convert(values, 5));
  7602. }
  7603. break;
  7604. default:
  7605. break;
  7606. }
  7607. }
  7608. return result;
  7609. };
  7610. com_ibm_rave_core_internal_css_CSSTransformParser.convert = function(values, index) {
  7611. var size = com_ibm_rave_core_internal_css_CSSUtil.parseSize(values[index].value);
  7612. return + (size.value);
  7613. };
  7614. // $source: com/ibm/rave/core/css/CSSStyleSheet
  7615. /************************************************************************
  7616. ** IBM Confidential
  7617. **
  7618. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7619. **
  7620. ** (C) Copyright IBM Corp. 2017
  7621. **
  7622. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7623. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7624. ************************************************************************/
  7625. // GENERATED
  7626. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7627. /**
  7628. * Public interface mimicking a w3 CSSStyleSheet. Used to describe imported styles.
  7629. */
  7630. var com_ibm_rave_core_css_CSSStyleSheet = rave_externs["CSSStyleSheet"] = com_ibm_rave_core_nativeImpl_Declare({
  7631. /**
  7632. * The list of CSSRule objects associated with this style sheet.
  7633. */
  7634. /** @expose */
  7635. cssRules : null,
  7636. /**
  7637. * Return the type of rule.
  7638. * @return (int) Type of CSS rule.
  7639. */
  7640. /** @expose */
  7641. getType : function() {},
  7642. /**
  7643. * Return the list of {@link (com.ibm.rave.core.css.CSSStyleRule) CSSStyleRule} rules.
  7644. * @return (Array) The list of cssRules.
  7645. */
  7646. /** @expose */
  7647. getCssRules : function() {
  7648. return this.cssRules;
  7649. }
  7650. });
  7651. // $source: com/ibm/rave/core/internal/css/om/CSSStyleSheetImpl
  7652. /************************************************************************
  7653. ** IBM Confidential
  7654. **
  7655. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7656. **
  7657. ** (C) Copyright IBM Corp. 2017
  7658. **
  7659. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7660. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7661. ************************************************************************/
  7662. // GENERATED
  7663. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7664. //@import com/ibm/rave/core/css/CSSStyleSheet (loadtime) // superclass
  7665. /**
  7666. * A model representing a CSS style sheet.
  7667. */
  7668. var com_ibm_rave_core_internal_css_om_CSSStyleSheetImpl = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_css_CSSStyleSheet, {
  7669. /**
  7670. * Construct a CSSStyleSheet.
  7671. */
  7672. constructor : function() {
  7673. this.cssRules = [];
  7674. },
  7675. /** @expose */
  7676. getType : function() {
  7677. return 21;
  7678. }
  7679. });
  7680. // $source: com/ibm/rave/core/css/CSSRule
  7681. /************************************************************************
  7682. ** IBM Confidential
  7683. **
  7684. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7685. **
  7686. ** (C) Copyright IBM Corp. 2017
  7687. **
  7688. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7689. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7690. ************************************************************************/
  7691. // GENERATED
  7692. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7693. /**
  7694. * Class mimicking the public properties of the CSSRule interface defined by the W3. Instead of calling rule.getCSSText(), one would use <code>rule.cssText;</code>
  7695. */
  7696. var com_ibm_rave_core_css_CSSRule = rave_externs["CSSRule"] = com_ibm_rave_core_nativeImpl_Declare({
  7697. /**
  7698. * The full cssText property of this rule.
  7699. */
  7700. //cssText : null,
  7701. /**
  7702. * Return the type of this CSS rule.
  7703. * @return (int) An integer representing this type of rule.
  7704. */
  7705. /** @expose */
  7706. getType : function() {},
  7707. /**
  7708. * This property mimics the CSS object model property of the same name. Returns the full text representation of this rule's CSS. <pre class="javascript"> In javascript, this API can be accessed using the 'cssText' property directly. </pre>
  7709. * @return (String) The cssText property.
  7710. */
  7711. /** @expose */
  7712. getCssText : function() {
  7713. return this.cssText;
  7714. }
  7715. });
  7716. // $source: com/ibm/rave/core/css/CSSStyleRule
  7717. /************************************************************************
  7718. ** IBM Confidential
  7719. **
  7720. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7721. **
  7722. ** (C) Copyright IBM Corp. 2017
  7723. **
  7724. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7725. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7726. ************************************************************************/
  7727. // GENERATED
  7728. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7729. //@import com/ibm/rave/core/css/CSSRule (loadtime) // superclass
  7730. /**
  7731. * A CSS rule describing a style. Contains properties that contain the selector, style object, etc.
  7732. */
  7733. var com_ibm_rave_core_css_CSSStyleRule = rave_externs["CSSStyleRule"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_css_CSSRule, {
  7734. /**
  7735. * A string representing the selector text of this rule. i.e. "div .className"
  7736. */
  7737. /** @expose */
  7738. selectorText : null,
  7739. /**
  7740. * A property containing the style declaration.
  7741. */
  7742. /** @expose */
  7743. style : null,
  7744. /**
  7745. * Any parent style sheet associated with this rule. May be null.
  7746. */
  7747. /** @expose */
  7748. parentStyleSheet : null,
  7749. /**
  7750. * Any parent rule associated with this style rule.
  7751. */
  7752. /** @expose */
  7753. parentRule : null,
  7754. /**
  7755. * Mimics the CSS object model's selectorText property. <pre class="javascript"> In JavaScript, this API can be accessed using the 'selectorText' property directly. </pre>
  7756. * @return (String) The selectorText property.
  7757. */
  7758. /** @expose */
  7759. getSelectorText : function() {
  7760. return this.selectorText;
  7761. },
  7762. /**
  7763. * Mimics the CSS object model's style property. <pre class="javascript"> In JavaScript, this API can be accessed using the 'style' property directly. </pre>
  7764. * @return (com.ibm.rave.core.css.CSSStyleDeclaration) The style property.
  7765. */
  7766. /** @expose */
  7767. getStyle : function() {
  7768. return this.style;
  7769. },
  7770. /**
  7771. * Mimics the CSS object model's parentStyleSheet property. <pre class="javascript"> In JavaScript, this API can be accessed using the 'parentStyleSheet' property directly. </pre>
  7772. * @return (com.ibm.rave.core.css.CSSStyleSheet) The parentStyleSheet property.
  7773. */
  7774. /** @expose */
  7775. getParentStyleSheet : function() {
  7776. return this.parentStyleSheet;
  7777. },
  7778. /**
  7779. * Mimics the CSS object model's parentRule property. <pre class="javascript"> In JavaScript, this API can be accessed using the 'parentRule' property directly. </pre>
  7780. * @return (com.ibm.rave.core.css.CSSStyleSheet) The parentRule property.
  7781. */
  7782. /** @expose */
  7783. getParentRule : function() {
  7784. return this.parentRule;
  7785. }
  7786. });
  7787. // $source: com/ibm/rave/core/internal/css/om/CSSStyleRuleImpl
  7788. /************************************************************************
  7789. ** IBM Confidential
  7790. **
  7791. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7792. **
  7793. ** (C) Copyright IBM Corp. 2017
  7794. **
  7795. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7796. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7797. ************************************************************************/
  7798. // GENERATED
  7799. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7800. //@import com/ibm/rave/core/css/CSSStyleRule (loadtime) // superclass
  7801. /**
  7802. * Mimics the CSSStyleRule from CSSOM. Contains a string containing the full CSS selector and a CSSStyleDeclaration pointing to the style properties.
  7803. */
  7804. var com_ibm_rave_core_internal_css_om_CSSStyleRuleImpl = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_css_CSSStyleRule, {
  7805. /**
  7806. * Internal specificity calculation for this style declaration.
  7807. */
  7808. _specificity : 0,
  7809. /** @expose */
  7810. getType : function() {
  7811. return 1;
  7812. },
  7813. /**
  7814. * @param (String) selectorText the selectorText to set
  7815. */
  7816. setSelectorText : function(selectorText) {
  7817. this.selectorText = selectorText;
  7818. },
  7819. /**
  7820. * @param (com.ibm.rave.core.css.CSSStyleDeclaration) style the style to set
  7821. */
  7822. setStyle : function(style) {
  7823. this.style = style;
  7824. },
  7825. /**
  7826. * @param (com.ibm.rave.core.css.CSSStyleSheet) parentStyleSheet the parentStyleSheet to set
  7827. */
  7828. setParentStyleSheet : function(parentStyleSheet) {
  7829. this.parentStyleSheet = parentStyleSheet;
  7830. },
  7831. /**
  7832. * @param (com.ibm.rave.core.css.CSSStyleSheet) parentRule the parentRule to set
  7833. */
  7834. setParentRule : function(parentRule) {
  7835. this.parentRule = parentRule;
  7836. }
  7837. });
  7838. // $source: com/ibm/rave/core/css/CSSStyleDeclaration
  7839. /************************************************************************
  7840. ** IBM Confidential
  7841. **
  7842. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7843. **
  7844. ** (C) Copyright IBM Corp. 2017
  7845. **
  7846. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7847. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7848. ************************************************************************/
  7849. // GENERATED
  7850. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7851. /**
  7852. * Mimics the W3 CSSStyleDeclaration from the CSSOM specification.
  7853. */
  7854. var com_ibm_rave_core_css_CSSStyleDeclaration = rave_externs["CSSStyleDeclaration"] = com_ibm_rave_core_nativeImpl_Declare({
  7855. /**
  7856. * Get the value of a property based on its name. Names are case insensitive.
  7857. * @param (String) propertyName Name of the property for which to retrieve a value.
  7858. * @return (String) The property value.
  7859. */
  7860. /** @expose */
  7861. getPropertyValue : function(propertyName) {},
  7862. /**
  7863. * Set a property value and optional priority based on the property name.
  7864. * @param (String) propertyName The name to set the value for.
  7865. * @param (String) value The value to set the property to.
  7866. * @param (String) priority A priority value to give the property. Only supported values are "" and "important".
  7867. */
  7868. /** @expose */
  7869. setProperty : function(propertyName, value, priority) {},
  7870. /**
  7871. * Get the property priority value for a property by name. Will return whatever was set on the property via <code>setProperty()</code>.
  7872. * @param (String) propertyName Retrieve the priority for this property.
  7873. * @return (String) The priority for this property.
  7874. */
  7875. /** @expose */
  7876. getPropertyPriority : function(propertyName) {},
  7877. /**
  7878. * Return the style property at 'index'.
  7879. * @param (int) index Index in the property name list to retrieve from.
  7880. * @return (String) The property name at the provided index.
  7881. */
  7882. /** @expose */
  7883. item : function(index) {},
  7884. /**
  7885. * Return the number of properties in this style.
  7886. * @return (int) Number of properties in this style.
  7887. */
  7888. /** @expose */
  7889. length : function() {}
  7890. });
  7891. // $source: com/ibm/rave/core/internal/css/om/CSSStyleDeclarationImpl
  7892. /************************************************************************
  7893. ** IBM Confidential
  7894. **
  7895. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7896. **
  7897. ** (C) Copyright IBM Corp. 2017
  7898. **
  7899. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7900. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7901. ************************************************************************/
  7902. // GENERATED
  7903. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7904. //@import com/ibm/rave/core/css/CSSStyleDeclaration (loadtime) // superclass
  7905. /**
  7906. * Mimics the CSSStyleDeclaration interface from CSSOM. Contains properties their corresponding values in the CSS. For instance a property name might be "fill" and its value would be "blue".
  7907. */
  7908. var com_ibm_rave_core_internal_css_om_CSSStyleDeclarationImpl = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_css_CSSStyleDeclaration, {
  7909. //propNames : null,
  7910. //cssValues : null,
  7911. //propValues : null,
  7912. constructor : function() {
  7913. this.propNames = [];
  7914. this.cssValues = {};
  7915. this.propValues = [];
  7916. },
  7917. /**
  7918. * Return the property as a string - as it was set in the CSS originally.
  7919. * @param (String) propertyName The name to retrieve value for.
  7920. * @return (String) The property value as a string. Returns an empty string if this property was not found.
  7921. */
  7922. /** @expose */
  7923. getPropertyValue : function(propertyName) {
  7924. var index = this.propNames.indexOf(propertyName);
  7925. return (index >= 0) ? this.propValues[index].value : "";
  7926. },
  7927. /**
  7928. * Set the internal CSSValue for a property to 'value'.
  7929. * @param (String) propertyName Name of property to set.
  7930. * @param (com.ibm.rave.core.internal.css.om.CSSValue) value CSSValue to assign to property.
  7931. */
  7932. setPropertyCSSValue : function(propertyName, value) {
  7933. this.cssValues[propertyName] = value;
  7934. },
  7935. /**
  7936. * Return a CSSValue object containing value for the requested CSS property. This may be a CSSPrimitiveValue or CSSValueList or a custom CSSValue (CSSTransformValue for example).
  7937. * @param (String) propertyName The property value to receive.
  7938. * @return (com.ibm.rave.core.internal.css.om.CSSValue) CSSValue object describing CSS property.
  7939. */
  7940. getPropertyCSSValue : function(propertyName) {
  7941. return this.cssValues[propertyName];
  7942. },
  7943. /**
  7944. * Returns literal string "important" if this property has been flagged as important. Empty string otherwise.
  7945. * @param (String) propertyName Name of the style to look up.
  7946. * @return (String) Returns literal string "important" if this property has been flagged as important. Empty string otherwise.
  7947. */
  7948. /** @expose */
  7949. getPropertyPriority : function(propertyName) {
  7950. var index = this.propNames.indexOf(propertyName);
  7951. if (index == -1) {
  7952. return null;
  7953. }
  7954. return (this.propValues[index].priority) ? "important" : "";
  7955. },
  7956. /** @expose */
  7957. setProperty : function(propertyName, value, priority) {
  7958. var property = this.findOrCreateProperty(propertyName);
  7959. property.value = value;
  7960. property.priority = "important" == priority;
  7961. },
  7962. findOrCreateProperty : function(propertyName) {
  7963. var index = this.propNames.indexOf(propertyName);
  7964. var property;
  7965. if (index >= 0) {
  7966. property = this.propValues[index];
  7967. } else {
  7968. this.propNames.push(propertyName);
  7969. property = new com_ibm_rave_core_internal_css_om_CSSStyleDeclarationImpl.PropertyValueStruct();
  7970. this.propValues.push(property);
  7971. }
  7972. return property;
  7973. },
  7974. /**
  7975. * Return the 1-index size of the list of properties.
  7976. * @return (int) Size of the list of properties. 1 indexed.
  7977. */
  7978. /** @expose */
  7979. length : function() {
  7980. return this.propNames.length;
  7981. },
  7982. /**
  7983. * Return the property name at a certain index. Returns null if the index doesn't exist.
  7984. * @param (int) index Index to retreive property name for.
  7985. * @return (String) Property name at this index. Null if index doesn't exist.
  7986. */
  7987. /** @expose */
  7988. item : function(index) {
  7989. return this.propNames[index];
  7990. },
  7991. /**
  7992. * Helper method to go through each style in this declaration and return the CSSValue of it.
  7993. * @param (com.ibm.rave.core.internal.css.om.CSSValue.CSSValueHandler) cssValueHandler Handler that gets called for each property value.
  7994. */
  7995. each : function(cssValueHandler) {
  7996. var i = 0;
  7997. for (var __i_enFor0 = 0, __exp_enFor0 = this.propNames, __len_enFor0 = __exp_enFor0.length;
  7998. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7999. var name = __exp_enFor0[__i_enFor0];
  8000. cssValueHandler(name, this.getPropertyCSSValue(name), i++);
  8001. }
  8002. }
  8003. });
  8004. com_ibm_rave_core_internal_css_om_CSSStyleDeclarationImpl.PropertyValueStruct = function(){};
  8005. // $source: com/ibm/rave/core/internal/css/rules/CSSKeyframeRule
  8006. /************************************************************************
  8007. ** IBM Confidential
  8008. **
  8009. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8010. **
  8011. ** (C) Copyright IBM Corp. 2017
  8012. **
  8013. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8014. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8015. ************************************************************************/
  8016. // GENERATED
  8017. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  8018. //@import com/ibm/rave/core/internal/css/om/CSSStyleRuleImpl (loadtime) // superclass
  8019. var com_ibm_rave_core_internal_css_rules_CSSKeyframeRule = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_css_om_CSSStyleRuleImpl, {
  8020. //keyText : null,
  8021. /** @expose */
  8022. getType : function() {
  8023. return 8;
  8024. }
  8025. });
  8026. // $source: com/ibm/rave/core/internal/css/om/CSSValue
  8027. /************************************************************************
  8028. ** IBM Confidential
  8029. **
  8030. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8031. **
  8032. ** (C) Copyright IBM Corp. 2017
  8033. **
  8034. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8035. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8036. ************************************************************************/
  8037. // GENERATED
  8038. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  8039. var com_ibm_rave_core_internal_css_om_CSSValue = com_ibm_rave_core_nativeImpl_Declare({
  8040. //getType : function() {},
  8041. //cssText : function() {},
  8042. //getName : function() {}
  8043. });
  8044. com_ibm_rave_core_internal_css_om_CSSValue.CSS_INHERIT = 0;
  8045. com_ibm_rave_core_internal_css_om_CSSValue.CSS_PRIMITIVE_VALUE = 1;
  8046. com_ibm_rave_core_internal_css_om_CSSValue.CSS_VALUE_LIST = 2;
  8047. com_ibm_rave_core_internal_css_om_CSSValue.CSS_CUSTOM = 3;
  8048. // $source: com/ibm/rave/core/internal/css/om/CSSValueList
  8049. /************************************************************************
  8050. ** IBM Confidential
  8051. **
  8052. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8053. **
  8054. ** (C) Copyright IBM Corp. 2017
  8055. **
  8056. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8057. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8058. ************************************************************************/
  8059. // GENERATED
  8060. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  8061. //@import com/ibm/rave/core/internal/css/om/CSSValue (loadtime) // superclass
  8062. /**
  8063. * A list of values parsed from a CSS value declaration. IE - the declaration "scale(10,20)" has two values - 10 and 20.
  8064. */
  8065. var com_ibm_rave_core_internal_css_om_CSSValueList = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_css_om_CSSValue, {
  8066. //objects : null,
  8067. constructor : function() {
  8068. this.objects = [];
  8069. },
  8070. /**
  8071. * Append a single value to this list.
  8072. * @param (com.ibm.rave.core.internal.css.om.CSSValue) value Value to append to value list.
  8073. */
  8074. append : function(value) {
  8075. this.objects.push(value);
  8076. },
  8077. /**
  8078. * Remove all values from this list.
  8079. */
  8080. removeAll : function() {
  8081. this.objects.length = 0;
  8082. },
  8083. /**
  8084. * Return CSSValue at index.
  8085. * @param (int) index
  8086. * @return (com.ibm.rave.core.internal.css.om.CSSValue) CSSValue
  8087. */
  8088. item : function(index) {
  8089. if (this.objects.length > index) {
  8090. return this.objects[index];
  8091. }
  8092. return null;
  8093. },
  8094. cssText : function() {
  8095. var results = "";
  8096. for (var i = 0; i < this.objects.length; ++i) {
  8097. results += this.objects[i].cssText();
  8098. if (i < this.objects.length - 1) {
  8099. results += ",";
  8100. }
  8101. }
  8102. return results;
  8103. },
  8104. /**
  8105. * @return (int) Number of values in this list.
  8106. */
  8107. length : function() {
  8108. return this.objects.length;
  8109. },
  8110. getType : function() {
  8111. return 2;
  8112. },
  8113. /**
  8114. * Helper method to go through each style in this valueList and return the CSSValue of it.
  8115. * @param (com.ibm.rave.core.internal.css.om.CSSValue.CSSValueHandler) cssValueHandler Handler that gets called for each property value.
  8116. */
  8117. each : function(cssValueHandler) {
  8118. var i = 0;
  8119. for (var __i_enFor0 = 0, __exp_enFor0 = this.objects, __len_enFor0 = __exp_enFor0.length;
  8120. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  8121. var object = __exp_enFor0[__i_enFor0];
  8122. cssValueHandler(object.getName(), object, i++);
  8123. }
  8124. },
  8125. getName : function() {
  8126. return null;
  8127. }
  8128. /**
  8129. * Create a new list of CSSValues.
  8130. */
  8131. //constructor : function() {}
  8132. });
  8133. // $source: com/ibm/rave/core/internal/css/CSSParser
  8134. /************************************************************************
  8135. ** IBM Confidential
  8136. **
  8137. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8138. **
  8139. ** (C) Copyright IBM Corp. 2017
  8140. **
  8141. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8142. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8143. ************************************************************************/
  8144. // GENERATED
  8145. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  8146. //@import com/ibm/rave/core/context/RaveContextManager (static) // RaveContextManager
  8147. //@import com/ibm/rave/core/internal/css/om/CSSStyleSheetImpl (runtime) // new
  8148. //@import com/ibm/rave/core/internal/css/om/CSSStyleRuleImpl (static) // new
  8149. //@import com/ibm/rave/core/internal/css/om/CSSStyleDeclarationImpl (static) // new
  8150. //@import com/ibm/rave/core/internal/css/rules/CSSKeyframeRule (static) // new
  8151. //@import com/ibm/rave/core/internal/css/om/CSSValueList (static) // new
  8152. //@import com/ibm/rave/core/internal/css/CSSValueParser (runtime) // new
  8153. /**
  8154. * A java port of CSSOM. Contains custom modifications to support more value types (transforms, etc). Also calculates specificity while parsing to avoid an extra step when adding new styles. From http://www.w3.org/TR/REC-CSS2/cascade.html#specificity A selector's specificity is calculated as follows: <ul> <li>count the number of ID attributes in the selector (= a)</li> <li> count the number of other attributes and pseudo-classes in the selector (= b) </li> <li>count the number of element names in the selector (= c)</li> <li>ignore pseudo-elements.</li> </ul>
  8155. */
  8156. var com_ibm_rave_core_internal_css_CSSParser = com_ibm_rave_core_nativeImpl_Declare({
  8157. });
  8158. com_ibm_rave_core_internal_css_CSSParser.getAtKeyframesRegExp = function() {
  8159. var atKeyframesRegExp = com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData("AT_KEYFRAMES_REG_EXP_KEY");
  8160. if (!atKeyframesRegExp) {
  8161. atKeyframesRegExp = new RegExp("@(-(?:\\w+-)+)?keyframes", "g");
  8162. com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().putData("AT_KEYFRAMES_REG_EXP_KEY", atKeyframesRegExp);
  8163. }
  8164. return atKeyframesRegExp;
  8165. };
  8166. /**
  8167. * Parse the contents of a style block of CSS. This can be used for parsing a single style attribute. Wraps 'token' inside a wildcard block and parses the resulting token.
  8168. * @param (String) styleName The name of the style.
  8169. * @param (String) token The CSS block contents.
  8170. * @return (com.ibm.rave.core.css.CSSStyleDeclaration) CSSStyleSheet with the model. Returns null if a parsing error occured.
  8171. */
  8172. com_ibm_rave_core_internal_css_CSSParser.parseStyle = function(styleName, token) {
  8173. var sheet = com_ibm_rave_core_internal_css_CSSParser.parse("*{" + styleName + ":" + token + "}");
  8174. if (sheet && sheet.cssRules) {
  8175. if (sheet.cssRules.length > 0) {
  8176. return sheet.cssRules[0].style;
  8177. }
  8178. }
  8179. return null;
  8180. };
  8181. com_ibm_rave_core_internal_css_CSSParser.generateWhitespaceMap = function() {
  8182. var whitespaceMap = {};
  8183. whitespaceMap[1003] = 1;
  8184. whitespaceMap[1006] = 1;
  8185. whitespaceMap[1013] = 1;
  8186. whitespaceMap[1007] = 1;
  8187. whitespaceMap[1008] = 1;
  8188. whitespaceMap[1010] = 1;
  8189. whitespaceMap[1009] = 1;
  8190. return whitespaceMap;
  8191. };
  8192. /**
  8193. * Parse a CSS stylesheet string into a CSSStyleSheet object. If the cssText is null or "", returns an empty style sheet.
  8194. * @param (String) cssText The css stylesheet string.
  8195. * @return (com.ibm.rave.core.css.CSSStyleSheet) CSSStyleSheet. Will return null on a parsing error.
  8196. */
  8197. com_ibm_rave_core_internal_css_CSSParser.parse = function(cssText) {
  8198. var styleSheet = new com_ibm_rave_core_internal_css_om_CSSStyleSheetImpl();
  8199. if (cssText == null || cssText.length == 0) {
  8200. return styleSheet;
  8201. }
  8202. var state = 1001;
  8203. var index;
  8204. var buffer = "";
  8205. var currentScope = styleSheet;
  8206. var parentRule;
  8207. var name;
  8208. var priority = "";
  8209. var styleRule = new com_ibm_rave_core_internal_css_om_CSSStyleRuleImpl();
  8210. var character;
  8211. var cssValue;
  8212. var currentOperation = "";
  8213. var inWhitespace = true;
  8214. var specificityChange = false;
  8215. for (var i = 0; i < cssText.length; ++i) {
  8216. character = cssText.charCodeAt(i);
  8217. if (com_ibm_rave_core_internal_css_CSSParser.isWhitespace(character)) {
  8218. if (!inWhitespace && com_ibm_rave_core_internal_css_CSSParser.SIGNIFICANT_WHITESPACE.hasOwnProperty(state)) {
  8219. buffer += " ";
  8220. }
  8221. inWhitespace = true;
  8222. specificityChange = true;
  8223. } else {
  8224. var currentSpecificity = 1;
  8225. if (state == 1001 || state == 1003) {
  8226. switch (character) {
  8227. case 46:
  8228. case 91:
  8229. currentSpecificity = 0x10;
  8230. specificityChange = true;
  8231. break;
  8232. case 35:
  8233. currentSpecificity = 0x100;
  8234. specificityChange = true;
  8235. break;
  8236. }
  8237. }
  8238. switch (character) {
  8239. case 34:
  8240. index = i + 1;
  8241. do {
  8242. index = cssText.indexOf("\"", index) + 1;
  8243. if (index == 0) {
  8244. return null;
  8245. }
  8246. } while (cssText.charCodeAt(index - 2) == 92);
  8247. buffer += cssText.substring(i, index);
  8248. i = index - 1;
  8249. if (state == 1002) {
  8250. state = 1006;
  8251. } else if (state == 1007) {
  8252. state = 1008;
  8253. } else if (state == 1014) {
  8254. state = 1015;
  8255. }
  8256. break;
  8257. case 39:
  8258. index = i + 1;
  8259. do {
  8260. index = cssText.indexOf("'", index) + 1;
  8261. if (index == 0) {
  8262. return null;
  8263. }
  8264. } while (cssText.charCodeAt(index - 2) == 92);
  8265. buffer += cssText.substring(i, index);
  8266. i = index - 1;
  8267. switch (state) {
  8268. case 1002:
  8269. {
  8270. state = 1006;
  8271. break;
  8272. } case 1007:
  8273. state = 1008;
  8274. break;
  8275. case 1014:
  8276. state = 1015;
  8277. break;
  8278. default:
  8279. break;
  8280. }
  8281. break;
  8282. case 47:
  8283. if (cssText.charCodeAt(i + 1) == 42) {
  8284. i += 2;
  8285. index = cssText.indexOf("*/", i);
  8286. if (index == -1) {
  8287. return null;
  8288. }
  8289. i = index + 1;
  8290. } else {
  8291. buffer += String.fromCharCode(character);
  8292. }
  8293. if (state == 1007) {
  8294. buffer += " ";
  8295. state = 1008;
  8296. } else if (state == 1014) {
  8297. buffer += " ";
  8298. state = 1015;
  8299. }
  8300. break;
  8301. case 64:
  8302. if (cssText.indexOf("@-moz-document", i) == i) {
  8303. state = 1009;
  8304. i += "-moz-document".length;
  8305. buffer = "";
  8306. break;
  8307. } else if (cssText.indexOf("@media", i) == i) {
  8308. state = 1010;
  8309. i += 5;
  8310. buffer = "";
  8311. break;
  8312. } else if (cssText.indexOf("@import", i) == i) {
  8313. state = 1007;
  8314. i += 6;
  8315. buffer += "@import";
  8316. break;
  8317. } else if (cssText.indexOf("@charset", i) == i) {
  8318. state = 1014;
  8319. i += 7;
  8320. buffer += "@import";
  8321. break;
  8322. } else if (cssText.indexOf("@font-face", i) == i) {
  8323. state = 1011;
  8324. i += 9;
  8325. buffer = "";
  8326. break;
  8327. } else {
  8328. var atKeyframesRegExp = com_ibm_rave_core_internal_css_CSSParser.getAtKeyframesRegExp();
  8329. atKeyframesRegExp["lastIndex"] = i;
  8330. var matchKeyframes = atKeyframesRegExp.exec(cssText);
  8331. if (matchKeyframes && matchKeyframes.index == i) {
  8332. state = 1012;
  8333. i += matchKeyframes[0].length - 1;
  8334. buffer = "";
  8335. break;
  8336. } else if (state == 1003) {
  8337. state = 1013;
  8338. }
  8339. }
  8340. buffer += String.fromCharCode(character);
  8341. break;
  8342. case 123:
  8343. if (state == 1003 || state == 1013) {
  8344. styleRule.setSelectorText(buffer.trim());
  8345. styleRule.setStyle((!styleRule.style) ? new com_ibm_rave_core_internal_css_om_CSSStyleDeclarationImpl() : styleRule.style);
  8346. buffer = "";
  8347. state = 1000;
  8348. } else if (state == 1010) {
  8349. buffer = "";
  8350. state = 1001;
  8351. } else if (state == 1011) {
  8352. buffer = "";
  8353. state = 1000;
  8354. } else if (state == 1012) {
  8355. buffer = "";
  8356. state = 1004;
  8357. } else if (state == 1004) {
  8358. styleRule = new com_ibm_rave_core_internal_css_rules_CSSKeyframeRule();
  8359. (styleRule).keyText = buffer.trim();
  8360. buffer = "";
  8361. state = 1000;
  8362. } else if (state == 1009) {
  8363. buffer = "";
  8364. state = 1001;
  8365. }
  8366. break;
  8367. case 58:
  8368. if (state == 1005) {
  8369. name = buffer.trim();
  8370. buffer = "";
  8371. state = 1002;
  8372. } else if (state == 1003) {
  8373. specificityChange = true;
  8374. styleRule._specificity += 0x10;
  8375. buffer += String.fromCharCode(character);
  8376. } else {
  8377. buffer += String.fromCharCode(character);
  8378. }
  8379. break;
  8380. case 40:
  8381. if (state == 1006) {
  8382. var propertyType = com_ibm_rave_core_internal_css_CSSParser.determinePropertyType(name);
  8383. if (!cssValue) {
  8384. cssValue = com_ibm_rave_core_internal_css_CSSParser.createValueContainer(propertyType);
  8385. }
  8386. var info = com_ibm_rave_core_internal_css_CSSParser.parseValues(propertyType, currentOperation, cssText, i);
  8387. i = info.idx;
  8388. if (info.error == 0) {
  8389. buffer += info.expression;
  8390. if (cssValue && cssValue.getType() == 2) {
  8391. (cssValue).append(info.cssValue);
  8392. } else {
  8393. cssValue = info.cssValue;
  8394. }
  8395. } else {
  8396. buffer = "";
  8397. }
  8398. currentOperation = "";
  8399. } else {
  8400. buffer += String.fromCharCode(character);
  8401. }
  8402. break;
  8403. case 33:
  8404. if (state == 1006 && cssText.indexOf("!" + "important", i) == i) {
  8405. priority = "important";
  8406. i += "important".length;
  8407. } else {
  8408. buffer += String.fromCharCode(character);
  8409. }
  8410. break;
  8411. case 59:
  8412. switch (state) {
  8413. case 1006:
  8414. styleRule.setStyle((!styleRule.style) ? new com_ibm_rave_core_internal_css_om_CSSStyleDeclarationImpl() : styleRule.style);
  8415. styleRule.style.setProperty(name, buffer.trim(), priority);
  8416. (styleRule.style).setPropertyCSSValue(name, cssValue);
  8417. priority = "";
  8418. buffer = "";
  8419. state = 1000;
  8420. cssValue = null;
  8421. break;
  8422. case 1013:
  8423. buffer = "";
  8424. state = 1001;
  8425. break;
  8426. case 1015:
  8427. case 1008:
  8428. buffer = "";
  8429. state = 1001;
  8430. break;
  8431. default:
  8432. buffer += String.fromCharCode(character);
  8433. }
  8434. break;
  8435. case 125:
  8436. switch (state) {
  8437. case 1006:
  8438. styleRule.setStyle((!styleRule.style) ? new com_ibm_rave_core_internal_css_om_CSSStyleDeclarationImpl() : styleRule.style);
  8439. styleRule.style.setProperty(name, buffer.trim(), priority);
  8440. (styleRule.style).setPropertyCSSValue(name, cssValue);
  8441. priority = "";
  8442. cssValue = null;
  8443. case 1000:
  8444. case 1005:
  8445. if (parentRule) {
  8446. styleRule.setParentRule(parentRule);
  8447. }
  8448. styleRule.setParentStyleSheet(styleSheet);
  8449. currentScope.cssRules.push(styleRule);
  8450. buffer = "";
  8451. if (currentScope.getType() == 7) {
  8452. state = 1004;
  8453. } else {
  8454. state = 1001;
  8455. }
  8456. break;
  8457. case 1004:
  8458. case 1001:
  8459. case 1003:
  8460. if (parentRule) {
  8461. }
  8462. currentScope = styleSheet;
  8463. parentRule = null;
  8464. buffer = "";
  8465. state = 1001;
  8466. break;
  8467. }
  8468. break;
  8469. default:
  8470. switch (state) {
  8471. case 1001:
  8472. state = 1003;
  8473. styleRule = new com_ibm_rave_core_internal_css_om_CSSStyleRuleImpl();
  8474. styleRule._specificity = currentSpecificity;
  8475. break;
  8476. case 1003:
  8477. if (specificityChange) {
  8478. styleRule._specificity += currentSpecificity;
  8479. }
  8480. break;
  8481. case 1000:
  8482. state = 1005;
  8483. break;
  8484. case 1002:
  8485. state = 1006;
  8486. case 1006:
  8487. currentOperation += String.fromCharCode(character);
  8488. break;
  8489. case 1014:
  8490. state = 1015;
  8491. break;
  8492. case 1007:
  8493. state = 1008;
  8494. break;
  8495. }
  8496. buffer += String.fromCharCode(character);
  8497. break;
  8498. }
  8499. inWhitespace = false;
  8500. specificityChange = false;
  8501. }
  8502. }
  8503. return styleSheet;
  8504. };
  8505. com_ibm_rave_core_internal_css_CSSParser.isWhitespace = function(character) {
  8506. switch (character) {
  8507. case 32:
  8508. case 9:
  8509. case 13:
  8510. case 10:
  8511. case 12:
  8512. return true;
  8513. default:
  8514. return false;
  8515. }
  8516. };
  8517. /**
  8518. * Create a CSSValue that holds values for propertyType. For instance, a TransformValue requires a CSSValueList.
  8519. * @param (int) propertyType
  8520. * @return (com.ibm.rave.core.internal.css.om.CSSValue)
  8521. */
  8522. com_ibm_rave_core_internal_css_CSSParser.createValueContainer = function(propertyType) {
  8523. var cssValue;
  8524. if (propertyType == 0) {
  8525. cssValue = new com_ibm_rave_core_internal_css_om_CSSValueList();
  8526. }
  8527. return cssValue;
  8528. };
  8529. com_ibm_rave_core_internal_css_CSSParser.parseValues = function(propertyType, buffer, token, i) {
  8530. var valueExpression = new com_ibm_rave_core_internal_css_CSSValueParser(propertyType, buffer, token, i);
  8531. return valueExpression.parse();
  8532. };
  8533. com_ibm_rave_core_internal_css_CSSParser.determinePropertyType = function(type) {
  8534. if (type == "transform") {
  8535. return 0;
  8536. }
  8537. return -1;
  8538. };
  8539. /**
  8540. * Deconstruct a full selector string ("g g rect+rect.class#withID:nthchild(2n+1)") into its individual pieces. Splits on whitespace and other hierarchy selectors ("+", ">", "~", etc) Assumes no leading or trailing whitespace.
  8541. * @param (String) selectorText Full selector text to deconstruct up.
  8542. * @return (Array) Array of selector pieces that represent a single node.
  8543. */
  8544. com_ibm_rave_core_internal_css_CSSParser.deconstructSelectorText = function(selectorText) {
  8545. var _selectorText = selectorText;
  8546. var character;
  8547. var state = 1000;
  8548. var results = [];
  8549. _selectorText = _selectorText.trim();
  8550. var currentBuffer = "";
  8551. for (var i = 0; i < _selectorText.length; ++i) {
  8552. character = _selectorText.charCodeAt(i);
  8553. if (com_ibm_rave_core_internal_css_CSSParser.isWhitespace(character)) {
  8554. if (state == 1000) {
  8555. state = 1001;
  8556. } else if (state == 1002) {
  8557. currentBuffer += String.fromCharCode(character);
  8558. }
  8559. } else {
  8560. switch (character) {
  8561. case 91:
  8562. case 40:
  8563. if (state == 1001) {
  8564. state = 1000;
  8565. results.push(currentBuffer);
  8566. currentBuffer = "";
  8567. }
  8568. state = 1002;
  8569. currentBuffer += String.fromCharCode(character);
  8570. break;
  8571. case 41:
  8572. case 93:
  8573. if (state != 1002) {
  8574. state = 1001;
  8575. }
  8576. currentBuffer += String.fromCharCode(character);
  8577. break;
  8578. case 43:
  8579. case 62:
  8580. case 126:
  8581. if (state == 1000) {
  8582. state = 1001;
  8583. } else if (state == 1002) {
  8584. currentBuffer += String.fromCharCode(character);
  8585. }
  8586. break;
  8587. default:
  8588. if (state == 1001) {
  8589. state = 1000;
  8590. results.push(currentBuffer);
  8591. currentBuffer = "";
  8592. }
  8593. currentBuffer += String.fromCharCode(character);
  8594. }
  8595. }
  8596. }
  8597. results.push(currentBuffer);
  8598. return results;
  8599. };
  8600. /**
  8601. * Split multiple selectors which are comma separated. eg ".axis .ticks, .axis .labels" => [".axis .ticks", ".axis .labels"]
  8602. * @param (String) selectorText Full selector text to split up.
  8603. * @return (Array) Array of selectors.
  8604. */
  8605. com_ibm_rave_core_internal_css_CSSParser.splitSelectorText = function(selectorText) {
  8606. var character;
  8607. var innerState = 0;
  8608. var results = [];
  8609. var currentBuffer = "";
  8610. for (var i = 0; i < selectorText.length; ++i) {
  8611. character = selectorText.charCodeAt(i);
  8612. switch (character) {
  8613. case 91:
  8614. case 40:
  8615. innerState++;
  8616. currentBuffer += String.fromCharCode(character);
  8617. break;
  8618. case 41:
  8619. case 93:
  8620. innerState--;
  8621. currentBuffer += String.fromCharCode(character);
  8622. break;
  8623. case 44:
  8624. if (innerState == 0) {
  8625. results.push(currentBuffer.trim());
  8626. currentBuffer = "";
  8627. }
  8628. break;
  8629. default:
  8630. currentBuffer += String.fromCharCode(character);
  8631. }
  8632. }
  8633. results.push(currentBuffer.trim());
  8634. return results;
  8635. };
  8636. com_ibm_rave_core_internal_css_CSSParser.BEFORE_NAME = 1000;
  8637. com_ibm_rave_core_internal_css_CSSParser.BEFORE_SELECTOR = 1001;
  8638. com_ibm_rave_core_internal_css_CSSParser.BEFORE_VALUE = 1002;
  8639. com_ibm_rave_core_internal_css_CSSParser.SELECTOR = 1003;
  8640. com_ibm_rave_core_internal_css_CSSParser.KEYFRAMERULE_BEGIN = 1004;
  8641. com_ibm_rave_core_internal_css_CSSParser.NAME = 1005;
  8642. com_ibm_rave_core_internal_css_CSSParser.VALUE = 1006;
  8643. com_ibm_rave_core_internal_css_CSSParser.IMPORTRULE_BEGIN = 1007;
  8644. com_ibm_rave_core_internal_css_CSSParser.IMPORTRULE = 1008;
  8645. com_ibm_rave_core_internal_css_CSSParser.DOCUMENTRULE_BEGIN = 1009;
  8646. com_ibm_rave_core_internal_css_CSSParser.ATBLOCK = 1010;
  8647. com_ibm_rave_core_internal_css_CSSParser.FONTFACERULE_BEGIN = 1011;
  8648. com_ibm_rave_core_internal_css_CSSParser.KEYFRAMESRULE_BEGIN = 1012;
  8649. com_ibm_rave_core_internal_css_CSSParser.ATRULE = 1013;
  8650. com_ibm_rave_core_internal_css_CSSParser.CHARSETRULE_BEGIN = 1014;
  8651. com_ibm_rave_core_internal_css_CSSParser.CHARSETRULE = 1015;
  8652. //com_ibm_rave_core_internal_css_CSSParser.AT_KEYFRAMES_REG_EXP_KEY = "AT_KEYFRAMES_REG_EXP_KEY";
  8653. com_ibm_rave_core_internal_css_CSSParser.INSIDE_SELECTOR_PIECE = 1000;
  8654. com_ibm_rave_core_internal_css_CSSParser.OUTSIDE_SELECTOR_PIECE = 1001;
  8655. com_ibm_rave_core_internal_css_CSSParser.INSIDE_BRACKETS = 1002;
  8656. com_ibm_rave_core_internal_css_CSSParser.INSIDE_OR = 1003;
  8657. com_ibm_rave_core_internal_css_CSSParser.SIGNIFICANT_WHITESPACE = com_ibm_rave_core_internal_css_CSSParser.generateWhitespaceMap();
  8658. // $source: com/ibm/rave/core/internal/css/CSSValueParser
  8659. /************************************************************************
  8660. ** IBM Confidential
  8661. **
  8662. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8663. **
  8664. ** (C) Copyright IBM Corp. 2017
  8665. **
  8666. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8667. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8668. ************************************************************************/
  8669. // GENERATED
  8670. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  8671. //@import com/ibm/rave/core/internal/css/om/CSSTransformValue (runtime) // new
  8672. //@import com/ibm/rave/core/internal/css/om/CSSValueList (runtime) // new
  8673. //@import com/ibm/rave/core/internal/css/om/CSSPrimitiveValue (runtime) // new
  8674. /**
  8675. * Parses a 'value' inside a CSS style declaration. For instance, 'scale(20,20)' would be a value inside a transform and would be parsed through here.
  8676. */
  8677. var com_ibm_rave_core_internal_css_CSSValueParser = com_ibm_rave_core_nativeImpl_Declare({
  8678. //_token : null,
  8679. //name : null,
  8680. //valueList : null,
  8681. type : 0,
  8682. _idx : 0,
  8683. UNDEF : 0,
  8684. INSIDE_FUNCTION : 1,
  8685. constructor : function(type, name, token, index) {
  8686. this.type = type;
  8687. this._token = token;
  8688. this._idx = index;
  8689. this.name = name;
  8690. this.valueList = this.createArgumentContainer();
  8691. },
  8692. parse : function() {
  8693. var token = this._token;
  8694. var idx = this._idx;
  8695. var character;
  8696. var expression = "";
  8697. var error = 0;
  8698. var info;
  8699. var paren = [];
  8700. var state = this.UNDEF;
  8701. var currentArg = "";
  8702. for (;; ++idx) {
  8703. if (idx == token.length) {
  8704. error = -1;
  8705. break;
  8706. }
  8707. character = token.charCodeAt(idx);
  8708. switch (character) {
  8709. case 40:
  8710. state = this.INSIDE_FUNCTION;
  8711. paren.push(character);
  8712. expression += String.fromCharCode(character);
  8713. break;
  8714. case 41:
  8715. if (state == this.INSIDE_FUNCTION) {
  8716. this.valueList.append(this.createValue(currentArg));
  8717. currentArg = "";
  8718. }
  8719. state = this.UNDEF;
  8720. paren.pop();
  8721. expression += String.fromCharCode(character);
  8722. break;
  8723. case 44:
  8724. if (state == this.INSIDE_FUNCTION) {
  8725. this.valueList.append(this.createValue(currentArg));
  8726. currentArg = "";
  8727. }
  8728. expression += String.fromCharCode(character);
  8729. break;
  8730. case 47:
  8731. if ((info = this._parseJSComment(token, idx))) {
  8732. if (info.error != 0) {
  8733. error = -2;
  8734. } else {
  8735. idx = info.idx;
  8736. }
  8737. } else {
  8738. expression += String.fromCharCode(character);
  8739. }
  8740. break;
  8741. case 39:
  8742. case 34:
  8743. info = this._parseJSString(token, idx, String.fromCharCode(character) + "");
  8744. if (info) {
  8745. idx = info.idx;
  8746. expression += info.text;
  8747. } else {
  8748. expression += String.fromCharCode(character);
  8749. }
  8750. break;
  8751. case 32:
  8752. case 9:
  8753. case 13:
  8754. case 10:
  8755. case 12:
  8756. break;
  8757. default:
  8758. switch (state) {
  8759. case this.UNDEF:
  8760. break;
  8761. case this.INSIDE_FUNCTION:
  8762. currentArg += String.fromCharCode(character);
  8763. }
  8764. expression += String.fromCharCode(character);
  8765. break;
  8766. }
  8767. if (error != 0) {
  8768. break;
  8769. }
  8770. if (paren.length == 0) {
  8771. break;
  8772. }
  8773. }
  8774. var ret = new com_ibm_rave_core_internal_css_CSSValueParser.CSSValueExpressionInfo();
  8775. ret.error = error;
  8776. ret.idx = idx;
  8777. ret.expression = expression;
  8778. ret.cssValue = this.valueList;
  8779. return ret;
  8780. },
  8781. _parseJSComment : function(token, idx) {
  8782. var nextChar = token.charCodeAt(idx + 1);
  8783. if (nextChar == 47 || nextChar == 42) {
  8784. var commentEndChar = null;
  8785. if (nextChar == 47) {
  8786. commentEndChar = "\n";
  8787. } else if (nextChar == 42) {
  8788. commentEndChar = "*/";
  8789. }
  8790. var struct = new com_ibm_rave_core_internal_css_CSSValueParser.JSCommentStruct();
  8791. if (commentEndChar != null) {
  8792. var startIdx = idx;
  8793. var endIdx = token.indexOf(commentEndChar, startIdx + 1 + 1);
  8794. if (endIdx != -1) {
  8795. endIdx = endIdx + commentEndChar.length - 1;
  8796. var text = token.substring(idx, endIdx + 1);
  8797. struct.idx = endIdx;
  8798. struct.text = text;
  8799. } else {
  8800. struct.error = -1;
  8801. }
  8802. } else {
  8803. struct.error = -1;
  8804. }
  8805. return struct;
  8806. }
  8807. return null;
  8808. },
  8809. /**
  8810. * @return (com.ibm.rave.core.internal.css.CSSValueParser.JSCommentStruct) {Object|false} - idx: - text: or false
  8811. */
  8812. _parseJSString : function(token, idx, sep) {
  8813. var endIdx = com_ibm_rave_core_internal_css_CSSValueParser._findMatchedIdx(token, idx, sep);
  8814. var text;
  8815. if (endIdx == -1) {
  8816. return null;
  8817. }
  8818. text = token.substring(idx, endIdx + sep.length);
  8819. var struct = new com_ibm_rave_core_internal_css_CSSValueParser.JSCommentStruct();
  8820. struct.idx = endIdx;
  8821. struct.text = text;
  8822. return struct;
  8823. },
  8824. /**
  8825. * Create a new CSS Value "container" for the current type of css operation. This will contain the argument CSS Values inside it.
  8826. * @param value
  8827. * @return (com.ibm.rave.core.internal.css.om.CSSValueList)
  8828. */
  8829. createArgumentContainer : function() {
  8830. switch (this.type) {
  8831. case (0):
  8832. return new com_ibm_rave_core_internal_css_om_CSSTransformValue(this.name);
  8833. default:
  8834. return new com_ibm_rave_core_internal_css_om_CSSValueList();
  8835. }
  8836. },
  8837. /**
  8838. * Create a CSS Value from the current type of operation.
  8839. * @param argumentContainer
  8840. * @param (String) value
  8841. * @return (com.ibm.rave.core.internal.css.om.CSSValue)
  8842. */
  8843. createValue : function(value) {
  8844. var val;
  8845. switch (this.type) {
  8846. case (0):
  8847. default:
  8848. val = new com_ibm_rave_core_internal_css_om_CSSPrimitiveValue(value);
  8849. break;
  8850. }
  8851. return val;
  8852. }
  8853. });
  8854. /**
  8855. * find next sep(same line) index in `token`
  8856. * @return (int) {Number}
  8857. */
  8858. com_ibm_rave_core_internal_css_CSSValueParser._findMatchedIdx = function(token, idx, sep) {
  8859. var startIdx = idx;
  8860. var endIdx;
  8861. var NOT_FOUND = -1;
  8862. var result = new RegExp("\\+$", "");
  8863. while (true) {
  8864. endIdx = token.indexOf(sep, startIdx + 1);
  8865. if (endIdx == -1) {
  8866. endIdx = NOT_FOUND;
  8867. break;
  8868. }
  8869. var text = token.substring(idx + 1, endIdx);
  8870. var matched = result.exec(text);
  8871. if (!matched || matched.length == 1) {
  8872. break;
  8873. }
  8874. startIdx = endIdx;
  8875. }
  8876. var nextNewLineIdx = token.indexOf("\n", idx + 1);
  8877. if (nextNewLineIdx < endIdx) {
  8878. endIdx = NOT_FOUND;
  8879. }
  8880. return endIdx;
  8881. };
  8882. com_ibm_rave_core_internal_css_CSSValueParser.CSSValueExpressionInfo = function(){};
  8883. /**
  8884. * @return {Object|false} - idx: - text: or - error: or false
  8885. */
  8886. com_ibm_rave_core_internal_css_CSSValueParser.JSCommentStruct = function(){};
  8887. // $source: com/ibm/rave/core/internal/css/om/CSSTransformValue
  8888. /************************************************************************
  8889. ** IBM Confidential
  8890. **
  8891. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8892. **
  8893. ** (C) Copyright IBM Corp. 2017
  8894. **
  8895. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8896. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8897. ************************************************************************/
  8898. // GENERATED
  8899. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  8900. //@import com/ibm/rave/core/internal/css/om/CSSValueList (loadtime) // superclass
  8901. var com_ibm_rave_core_internal_css_om_CSSTransformValue = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_css_om_CSSValueList, {
  8902. //operationType : null,
  8903. constructor : function(operationType) {
  8904. this.operationType = operationType;
  8905. },
  8906. cssText : function() {
  8907. return this.operationType + "(" + com_ibm_rave_core_internal_css_om_CSSValueList.prototype.cssText.call(this) + ")";
  8908. },
  8909. getName : function() {
  8910. return this.operationType;
  8911. }
  8912. });
  8913. /**
  8914. * Returns a transform operation type based on the string representation.
  8915. * @param (String) type String representation of the type.
  8916. * @return (int) One of the transform operation types. -1 if undefined.
  8917. */
  8918. com_ibm_rave_core_internal_css_om_CSSTransformValue.determineType = function(type) {
  8919. if (type.indexOf("translate") == 0) {
  8920. if (type.length == 10) {
  8921. if (type.charCodeAt(9) == 88) {
  8922. return 2;
  8923. }
  8924. return 3;
  8925. }
  8926. return 1;
  8927. }
  8928. if (type.indexOf("rotate") == 0) {
  8929. return 4;
  8930. }
  8931. if (type.indexOf("scale") == 0) {
  8932. if (type.length == 6) {
  8933. if (type.charCodeAt(5) == 88) {
  8934. return 6;
  8935. }
  8936. return 7;
  8937. }
  8938. return 5;
  8939. }
  8940. if (type.indexOf("skew") == 0) {
  8941. if (type.length == 5) {
  8942. if (type.charCodeAt(4) == 88) {
  8943. return 9;
  8944. }
  8945. return 10;
  8946. }
  8947. return 8;
  8948. }
  8949. if (type.indexOf("matrix") == 0) {
  8950. return 11;
  8951. }
  8952. return -1;
  8953. };
  8954. com_ibm_rave_core_internal_css_om_CSSTransformValue.CSS_TRANSLATE = 1;
  8955. com_ibm_rave_core_internal_css_om_CSSTransformValue.CSS_TRANSLATEX = 2;
  8956. com_ibm_rave_core_internal_css_om_CSSTransformValue.CSS_TRANSLATEY = 3;
  8957. com_ibm_rave_core_internal_css_om_CSSTransformValue.CSS_ROTATE = 4;
  8958. com_ibm_rave_core_internal_css_om_CSSTransformValue.CSS_SCALE = 5;
  8959. com_ibm_rave_core_internal_css_om_CSSTransformValue.CSS_SCALEX = 6;
  8960. com_ibm_rave_core_internal_css_om_CSSTransformValue.CSS_SCALEY = 7;
  8961. com_ibm_rave_core_internal_css_om_CSSTransformValue.CSS_SKEW = 8;
  8962. com_ibm_rave_core_internal_css_om_CSSTransformValue.CSS_SKEWX = 9;
  8963. com_ibm_rave_core_internal_css_om_CSSTransformValue.CSS_SKEWY = 10;
  8964. com_ibm_rave_core_internal_css_om_CSSTransformValue.CSS_MATRIX = 11;
  8965. com_ibm_rave_core_internal_css_om_CSSTransformValue.transformNames = ["translate", "translateX", "translateY", "rotate", "rotateX", "rotateY", "scale", "scaleX", "scaleY", "skew", "skewX", "skewY", "matrix"];
  8966. // $source: com/ibm/rave/core/internal/css/om/CSSPrimitiveValue
  8967. /************************************************************************
  8968. ** IBM Confidential
  8969. **
  8970. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8971. **
  8972. ** (C) Copyright IBM Corp. 2017
  8973. **
  8974. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8975. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8976. ************************************************************************/
  8977. // GENERATED
  8978. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  8979. //@import com/ibm/rave/core/internal/css/om/CSSValue (loadtime) // superclass
  8980. var com_ibm_rave_core_internal_css_om_CSSPrimitiveValue = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_css_om_CSSValue, {
  8981. //value : null,
  8982. constructor : function(value) {
  8983. this.value = value;
  8984. },
  8985. cssText : function() {
  8986. return ""+(this.value);
  8987. },
  8988. getType : function() {
  8989. return 1;
  8990. },
  8991. getName : function() {
  8992. return null;
  8993. }
  8994. });
  8995. // $source: com/ibm/rave/core/css/CSSUnit
  8996. /************************************************************************
  8997. ** IBM Confidential
  8998. **
  8999. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9000. **
  9001. ** (C) Copyright IBM Corp. 2017
  9002. **
  9003. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9004. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9005. ************************************************************************/
  9006. // GENERATED
  9007. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  9008. /**
  9009. * Object that represents a a CSS unit, including the name and the type.
  9010. */
  9011. var com_ibm_rave_core_css_CSSUnit = com_ibm_rave_core_nativeImpl_Declare({
  9012. /**
  9013. * The name of the this unit.
  9014. */
  9015. /** @expose */
  9016. name : null,
  9017. /**
  9018. * The type of this unit.
  9019. */
  9020. /** @expose */
  9021. type : 0,
  9022. constructor : function(name, type) {
  9023. this.name = name;
  9024. this.type = type;
  9025. },
  9026. /**
  9027. * Return the name of this object.
  9028. * @return (String) The name of this object.
  9029. */
  9030. /** @expose */
  9031. toString : function() {
  9032. return this.name;
  9033. }
  9034. });
  9035. /**
  9036. * Type for CSS pixels.
  9037. */
  9038. /** @expose */
  9039. com_ibm_rave_core_css_CSSUnit.PX = 0;
  9040. /**
  9041. * Type for CSS em.
  9042. */
  9043. /** @expose */
  9044. com_ibm_rave_core_css_CSSUnit.EM = 1;
  9045. /**
  9046. * Type for CSS percent.
  9047. */
  9048. /** @expose */
  9049. com_ibm_rave_core_css_CSSUnit.PERCENT = 2;
  9050. /**
  9051. * Type for CSS inches.
  9052. */
  9053. /** @expose */
  9054. com_ibm_rave_core_css_CSSUnit.IN = 3;
  9055. /**
  9056. * Type for CSS centimeter.
  9057. */
  9058. /** @expose */
  9059. com_ibm_rave_core_css_CSSUnit.CM = 4;
  9060. /**
  9061. * Type for CSS millimeter.
  9062. */
  9063. /** @expose */
  9064. com_ibm_rave_core_css_CSSUnit.MM = 5;
  9065. /**
  9066. * Type for CSS point.
  9067. */
  9068. /** @expose */
  9069. com_ibm_rave_core_css_CSSUnit.PT = 6;
  9070. /**
  9071. * Type for CSS pica.
  9072. */
  9073. /** @expose */
  9074. com_ibm_rave_core_css_CSSUnit.PC = 7;
  9075. /**
  9076. * Type for CSS none.
  9077. */
  9078. /** @expose */
  9079. com_ibm_rave_core_css_CSSUnit.NONE = 8;
  9080. /**
  9081. * {@link (com.ibm.rave.core.css.CSSUnit) CSSUnit} for pixel type.
  9082. */
  9083. /** @expose */
  9084. com_ibm_rave_core_css_CSSUnit.UNIT_PX = new com_ibm_rave_core_css_CSSUnit("px", 0);
  9085. /**
  9086. * {@link (com.ibm.rave.core.css.CSSUnit) CSSUnit} for em type.
  9087. */
  9088. /** @expose */
  9089. com_ibm_rave_core_css_CSSUnit.UNIT_EM = new com_ibm_rave_core_css_CSSUnit("em", 1);
  9090. /**
  9091. * {@link (com.ibm.rave.core.css.CSSUnit) CSSUnit} for percent type.
  9092. */
  9093. /** @expose */
  9094. com_ibm_rave_core_css_CSSUnit.UNIT_PERCENT = new com_ibm_rave_core_css_CSSUnit("%", 2);
  9095. /**
  9096. * {@link (com.ibm.rave.core.css.CSSUnit) CSSUnit} for inches type.
  9097. */
  9098. /** @expose */
  9099. com_ibm_rave_core_css_CSSUnit.UNIT_IN = new com_ibm_rave_core_css_CSSUnit("in", 3);
  9100. /**
  9101. * {@link (com.ibm.rave.core.css.CSSUnit) CSSUnit} for centimeter type.
  9102. */
  9103. /** @expose */
  9104. com_ibm_rave_core_css_CSSUnit.UNIT_CM = new com_ibm_rave_core_css_CSSUnit("cm", 4);
  9105. /**
  9106. * {@link (com.ibm.rave.core.css.CSSUnit) CSSUnit} for millimeter type.
  9107. */
  9108. /** @expose */
  9109. com_ibm_rave_core_css_CSSUnit.UNIT_MM = new com_ibm_rave_core_css_CSSUnit("mm", 5);
  9110. /**
  9111. * {@link (com.ibm.rave.core.css.CSSUnit) CSSUnit} for point type.
  9112. */
  9113. /** @expose */
  9114. com_ibm_rave_core_css_CSSUnit.UNIT_PT = new com_ibm_rave_core_css_CSSUnit("pt", 6);
  9115. /**
  9116. * {@link (com.ibm.rave.core.css.CSSUnit) CSSUnit} for pica type.
  9117. */
  9118. /** @expose */
  9119. com_ibm_rave_core_css_CSSUnit.UNIT_PC = new com_ibm_rave_core_css_CSSUnit("pc", 7);
  9120. /**
  9121. * {@link (com.ibm.rave.core.css.CSSUnit) CSSUnit} for none type.
  9122. */
  9123. /** @expose */
  9124. com_ibm_rave_core_css_CSSUnit.UNIT_LESS = new com_ibm_rave_core_css_CSSUnit("", 8);
  9125. // $source: com/ibm/rave/core/css/CSSSize
  9126. /************************************************************************
  9127. ** IBM Confidential
  9128. **
  9129. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9130. **
  9131. ** (C) Copyright IBM Corp. 2017
  9132. **
  9133. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9134. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9135. ************************************************************************/
  9136. // GENERATED
  9137. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  9138. /**
  9139. * A CSS size consists of a numeric value and a {@link (com.ibm.rave.core.css.CSSUnit) CSSUnit} .
  9140. */
  9141. var com_ibm_rave_core_css_CSSSize = rave_externs["CSSSize"] = com_ibm_rave_core_nativeImpl_Declare({
  9142. /**
  9143. * The {@link (com.ibm.rave.core.css.CSSUnit) CSSUnit} unit.
  9144. */
  9145. /** @expose */
  9146. unit : null,
  9147. /**
  9148. * The numeric value.
  9149. */
  9150. /** @expose */
  9151. value : 0,
  9152. /**
  9153. * Create a CSSSize given the numeric value and the {@link (com.ibm.rave.core.css.CSSUnit) CSSUnit} unit.
  9154. * @param (double) value The numeric value.
  9155. * @param (com.ibm.rave.core.css.CSSUnit) unit The {@link (com.ibm.rave.core.css.CSSUnit) CSSUnit} unit.
  9156. */
  9157. /** @expose */
  9158. constructor : function(value, unit) {
  9159. this.value = value;
  9160. this.unit = unit;
  9161. },
  9162. /**
  9163. * Return the string representation of this object.
  9164. * @return (String) the string representation of this object.
  9165. */
  9166. /** @expose */
  9167. toString : function() {
  9168. return this.value + this.unit.name;
  9169. }
  9170. });
  9171. // $source: com/ibm/rave/core/internal/css/CSSUtil
  9172. /************************************************************************
  9173. ** IBM Confidential
  9174. **
  9175. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9176. **
  9177. ** (C) Copyright IBM Corp. 2017
  9178. **
  9179. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9180. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9181. ************************************************************************/
  9182. // GENERATED
  9183. //@import com/ibm/rave/core/context/RaveContextManager (static) // RaveContextManager
  9184. //@import com/ibm/rave/core/internal/nativeImpl/Lang (static) // isNumber, isString
  9185. //@import com/ibm/rave/core/css/CSSUnit (static) // CSSUnit
  9186. //@import com/ibm/rave/core/css/CSSSize (static) // new
  9187. //@import com/ibm/rave/core/Rave (runtime) // rgb
  9188. var com_ibm_rave_core_internal_css_CSSUtil = {
  9189. };
  9190. com_ibm_rave_core_internal_css_CSSUtil.getLinkRegExp = function() {
  9191. var linkRegex = com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData("LINK_REGEX_KEY");
  9192. if (!linkRegex) {
  9193. linkRegex = new RegExp("url\\s*?\\(['\"]?#([^\\)'\"]+)['\"]?\\)", "i");
  9194. com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().putData("LINK_REGEX_KEY", linkRegex);
  9195. }
  9196. return linkRegex;
  9197. };
  9198. /**
  9199. * Parse a dash array value from the given string.
  9200. * @param (String) value the dash array to parse
  9201. * @return (float[]) an array of numbers representing the dash pattern
  9202. */
  9203. com_ibm_rave_core_internal_css_CSSUtil.parseDashArray = function(value) {
  9204. var dashArray;
  9205. if (value != null && !("none" == value.toLowerCase()) && value.length > 0) {
  9206. var parts = value.split(new RegExp(","));
  9207. var odd = (parts.length % 2) == 1;
  9208. dashArray = [];
  9209. var i = 0;
  9210. for (var __i_enFor0 = 0, __len_enFor0 = parts.length;
  9211. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  9212. var part = parts[__i_enFor0];
  9213. part = part.trim();
  9214. var parsed = com_ibm_rave_core_internal_css_CSSUtil.parseSize(part);
  9215. if (!parsed) {
  9216. return null;
  9217. }
  9218. dashArray[i++] = parsed.value;
  9219. }
  9220. if (odd) {
  9221. for (var j = 0; j < parts.length; ++j) {
  9222. dashArray[i++] = dashArray[j];
  9223. }
  9224. }
  9225. }
  9226. return dashArray;
  9227. };
  9228. /**
  9229. * @expose
  9230. */
  9231. com_ibm_rave_core_internal_css_CSSUtil.parseSize = function(value) {
  9232. if (value == null) {
  9233. return null;
  9234. }
  9235. var size;
  9236. var unit;
  9237. if (com_ibm_rave_core_internal_nativeImpl_Lang.isNumber(value)) {
  9238. size = + (value);
  9239. } else {
  9240. var str = value.toString();
  9241. var length = str.length;
  9242. if (length > 1) {
  9243. var unitLength = 2;
  9244. if (length > 2) {
  9245. var unitStr = str.substring(length - 2).toLowerCase();
  9246. if (com_ibm_rave_core_css_CSSUnit.UNIT_PX.name == unitStr) {
  9247. unit = com_ibm_rave_core_css_CSSUnit.UNIT_PX;
  9248. } else if (com_ibm_rave_core_css_CSSUnit.UNIT_PT.name == unitStr) {
  9249. unit = com_ibm_rave_core_css_CSSUnit.UNIT_PT;
  9250. } else if (com_ibm_rave_core_css_CSSUnit.UNIT_EM.name == unitStr) {
  9251. unit = com_ibm_rave_core_css_CSSUnit.UNIT_EM;
  9252. } else if (com_ibm_rave_core_css_CSSUnit.UNIT_CM.name == unitStr) {
  9253. unit = com_ibm_rave_core_css_CSSUnit.UNIT_CM;
  9254. } else if (com_ibm_rave_core_css_CSSUnit.UNIT_IN.name == unitStr) {
  9255. unit = com_ibm_rave_core_css_CSSUnit.UNIT_IN;
  9256. } else if (com_ibm_rave_core_css_CSSUnit.UNIT_MM.name == unitStr) {
  9257. unit = com_ibm_rave_core_css_CSSUnit.UNIT_MM;
  9258. } else if (com_ibm_rave_core_css_CSSUnit.UNIT_PC.name == unitStr) {
  9259. unit = com_ibm_rave_core_css_CSSUnit.UNIT_PC;
  9260. }
  9261. }
  9262. if (!unit) {
  9263. if (com_ibm_rave_core_css_CSSUnit.UNIT_PERCENT.name == str.substring(length - 1).toLowerCase()) {
  9264. unitLength = 1;
  9265. unit = com_ibm_rave_core_css_CSSUnit.UNIT_PERCENT;
  9266. } else {
  9267. unitLength = 0;
  9268. for (var i = length - 1; i >= 0; --i) {
  9269. var c = str.charCodeAt(i);
  9270. if (c >= 48 || c <= 57) {
  9271. break;
  9272. }
  9273. unitLength++;
  9274. }
  9275. }
  9276. }
  9277. size = + (str.substring(0, length - unitLength));
  9278. } else {
  9279. size = + (value);
  9280. }
  9281. }
  9282. return isNaN(size) ? null : new com_ibm_rave_core_css_CSSSize(size, unit ? unit : com_ibm_rave_core_css_CSSUnit.UNIT_PX);
  9283. };
  9284. /**
  9285. * Parse the font weight value from the given object.
  9286. * @param (Object) weight the font weight to parse
  9287. * @return (String) String representing the font weight. Will return null if an invalid weight is passed.
  9288. */
  9289. com_ibm_rave_core_internal_css_CSSUtil.parseWeight = function(weight) {
  9290. if (weight == null) {
  9291. return "normal";
  9292. }
  9293. if (com_ibm_rave_core_internal_nativeImpl_Lang.isString(weight)) {
  9294. var sWeight = (weight).toLowerCase();
  9295. if ("normal" == sWeight || "bold" == sWeight || "bolder" == sWeight || "lighter" == sWeight) {
  9296. return sWeight;
  9297. }
  9298. }
  9299. var value = + (weight);
  9300. if (value < 1000 && value > 0 && (value % 100) == 0) {
  9301. return ""+(weight);
  9302. }
  9303. return null;
  9304. };
  9305. /**
  9306. * Parse the ID from from a URL link value. <p> eg. url(#myName)
  9307. * @param (Object) value the url link
  9308. * @return (String) the ID, or <code>null</code> if parsing fails
  9309. */
  9310. com_ibm_rave_core_internal_css_CSSUtil.parseIdUrlLink = function(value) {
  9311. if (com_ibm_rave_core_internal_nativeImpl_Lang.isString(value)) {
  9312. var result = com_ibm_rave_core_internal_css_CSSUtil.getLinkRegExp().exec(""+(value));
  9313. return result && result.length == 2 ? result[1] : null;
  9314. }
  9315. return null;
  9316. };
  9317. /**
  9318. * <p> Parse a CSS font shorthand string, e.g. <code>"italic 10px 'Arial','sans-serif'"</code>. Return an array of six strings [style,variant,weight,size,lineheight,font-family] in that order. </p> <p> The supported (recognized) styles are "italic" and "oblique". The supported variants are "small-caps". The supported weights are "lighter", "bold", "bolder", and any number greater than 0. </p> <p> To be recognized as a size, a string must parse to non-null with {@link #this.parseSize(Object)} . Anything after the "/" in the size string is taken as the line height. </p> <p> The font-family strings must be last. </p> <p> All strings are as they appear in the shorthand string, except that multiple spaces in the font-family list are replaced with a single space, and whitespace is trimmed. </p> <p> The returned array is never null and always has six entries. The style (index 0), variant (1), and weight (2) default to "normal". The size (3), lineheight (4), and font-family (5) are null if they are not in the CSS shorthand. </p>
  9319. * @param (Object) value The CSS shorthand string
  9320. * @return (java.lang.String[]) Array [style,variant,weight,size,lineheight,font-family]
  9321. */
  9322. com_ibm_rave_core_internal_css_CSSUtil.parseFont = function(value) {
  9323. var result = ["normal", "normal", "normal", null, null, null];
  9324. if (value == null) {
  9325. return result;
  9326. }
  9327. var str = ""+(value);
  9328. var splits = str.split(new RegExp("\\s+"));
  9329. var len = splits.length;
  9330. for (var i = 0; i < len; ++i) {
  9331. var val = splits[i];
  9332. if (val.length > 0 && !("normal" == val)) {
  9333. if ("oblique" == val || "italic" == val) {
  9334. result[0] = val;
  9335. continue;
  9336. }
  9337. if ("small-caps" == val) {
  9338. result[1] = val;
  9339. continue;
  9340. }
  9341. if ("bold" == val || "bolder" == val || "lighter" == val || + (val) > 0) {
  9342. result[2] = val;
  9343. continue;
  9344. }
  9345. if (result[3] == null) {
  9346. var size = val;
  9347. var lineheight = null;
  9348. var slash = size.indexOf("/");
  9349. if (slash > 0) {
  9350. lineheight = size.substring(slash + 1, size.length);
  9351. size = size.substring(0, slash);
  9352. }
  9353. if (com_ibm_rave_core_internal_css_CSSUtil.parseSize(size)) {
  9354. result[3] = size;
  9355. result[4] = lineheight;
  9356. continue;
  9357. }
  9358. }
  9359. var family = splits[i];
  9360. for (var j = i + 1; j < len; ++j) {
  9361. if (splits[j].length > 0) {
  9362. family += " " + splits[j];
  9363. }
  9364. }
  9365. result[5] = family;
  9366. break;
  9367. }
  9368. }
  9369. return result;
  9370. };
  9371. /**
  9372. * Parse a comma-separated list of font-family names. Trim whitespace and recombine into a comma-separated list, with all names double-quoted. If the list is null or has no valid names, null is returned. This assumes that no font-family name can contain a comma or quote character.
  9373. * @param (Object) value The font-family value
  9374. * @return (String) String with the comma-separated list.
  9375. */
  9376. com_ibm_rave_core_internal_css_CSSUtil.parseFontFamily = function(value) {
  9377. if (value == null) {
  9378. return null;
  9379. }
  9380. var str = ""+(value);
  9381. var splits = str.split(new RegExp(","));
  9382. var first = true;
  9383. var result = "";
  9384. for (var __i_enFor0 = 0, __len_enFor0 = splits.length;
  9385. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  9386. var s = splits[__i_enFor0];
  9387. s = s.trim().replace(new RegExp("\"","g"), "").replace(new RegExp("'","g"), "");
  9388. if (s.length > 0) {
  9389. if (first) {
  9390. first = false;
  9391. } else {
  9392. result += ",";
  9393. }
  9394. result += "\"" + s + "\"";
  9395. }
  9396. }
  9397. return (result.length == 0) ? null : result;
  9398. };
  9399. /**
  9400. * @expose
  9401. */
  9402. com_ibm_rave_core_internal_css_CSSUtil.parseShadowStyle = function(value) {
  9403. if (value == null) {
  9404. return null;
  9405. }
  9406. var _value = ""+(value);
  9407. var parsed = com_ibm_rave_core_internal_css_CSSUtil._parse(_value);
  9408. if (parsed.length == 1) {
  9409. return null;
  9410. }
  9411. var offset_x = com_ibm_rave_core_internal_css_CSSUtil.parseSize(parsed[0]);
  9412. if (!offset_x) {
  9413. return null;
  9414. }
  9415. var offset_y = com_ibm_rave_core_internal_css_CSSUtil.parseSize(parsed[1]);
  9416. if (!offset_y) {
  9417. return null;
  9418. }
  9419. var blur_radius = parsed[2] == null ? null : com_ibm_rave_core_internal_css_CSSUtil.parseSize(parsed[2]);
  9420. var _color = parsed[3] == null ? null : com_ibm_rave_core_Rave.rgb(parsed[3]);
  9421. return [offset_x, offset_y, blur_radius, _color];
  9422. };
  9423. com_ibm_rave_core_internal_css_CSSUtil._parse = function(value) {
  9424. var str = ""+(value).trim();
  9425. var splits = str.split(new RegExp("\\s+"));
  9426. var len = splits.length;
  9427. if (len == 1) {
  9428. return [splits[0]];
  9429. }
  9430. var result = [null, null, null, null];
  9431. if (len == 2) {
  9432. result[0] = splits[0];
  9433. result[1] = splits[1];
  9434. return result;
  9435. }
  9436. if (len == 4) {
  9437. if (com_ibm_rave_core_internal_css_CSSUtil.parseSize(splits[0]) || !com_ibm_rave_core_internal_css_CSSUtil.parseSize(splits[3])) {
  9438. result[0] = splits[0];
  9439. result[1] = splits[1];
  9440. result[2] = splits[2];
  9441. result[3] = splits[3];
  9442. } else {
  9443. result[0] = splits[1];
  9444. result[1] = splits[2];
  9445. result[2] = splits[3];
  9446. result[3] = splits[0];
  9447. }
  9448. return result;
  9449. }
  9450. if (len == 3) {
  9451. if (com_ibm_rave_core_internal_css_CSSUtil.parseSize(splits[0]) || !com_ibm_rave_core_internal_css_CSSUtil.parseSize(splits[2])) {
  9452. result[0] = splits[0];
  9453. result[1] = splits[1];
  9454. if (com_ibm_rave_core_internal_css_CSSUtil.parseSize(splits[2])) {
  9455. result[2] = splits[2];
  9456. } else {
  9457. result[3] = splits[2];
  9458. }
  9459. } else {
  9460. result[0] = splits[1];
  9461. result[1] = splits[2];
  9462. result[3] = splits[0];
  9463. }
  9464. return result;
  9465. }
  9466. return result;
  9467. };
  9468. //com_ibm_rave_core_internal_css_CSSUtil.LINK_REGEX_KEY = "LINK_REGEX_KEY";
  9469. // $source: com/ibm/rave/core/internal/selector/mirror/MirroredSceneNodeExtension
  9470. /************************************************************************
  9471. ** IBM Confidential
  9472. **
  9473. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9474. **
  9475. ** (C) Copyright IBM Corp. 2017
  9476. **
  9477. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9478. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9479. ************************************************************************/
  9480. // GENERATED
  9481. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  9482. //@import com/ibm/rave/core/Rave (runtime) // Rave
  9483. //@import com/ibm/rave/core/internal/selector/mirror/MirrorUtil (runtime) // isMirrored, isGroupNode, isOwnerGroupNode, setRawNode, getWrappingGroup, isRawMode
  9484. //@import com/ibm/rave/core/internal/selector/mirror/MirroredSceneNodeHelper (runtime) // mirrorNode, update
  9485. //@import com/ibm/rave/core/internal/selector/mirror/MirrorConstants (runtime) // MirrorConstants
  9486. /**
  9487. * 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.
  9488. * @author jim
  9489. */
  9490. var com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeExtension = com_ibm_rave_core_nativeImpl_Declare({
  9491. });
  9492. /**
  9493. * Extend this node to provide mirroring functionality.
  9494. * @param (com.ibm.rave.core.scene.SceneNode) node Scene node to extend with mirroring
  9495. */
  9496. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeExtension.extend = function(node) {
  9497. var origGetChildNodes = node.rave_getChildNodes;
  9498. var origHasChildNodes = node.rave_hasChildNodes;
  9499. var origRemoveChild = node.removeChild;
  9500. var origGetParent = node.rave_getParentNode;
  9501. var origAppendChild = node.appendChild;
  9502. var origInsertBefore = node.insertBefore;
  9503. var origGetNextSibling = node.rave_getNextSibling;
  9504. var origGetPreviousSibling = node.rave_getPreviousSibling;
  9505. var origGetFirstChild = node.rave_getFirstChild;
  9506. var origSetTextExt = node.rave_setText;
  9507. var origSetStyleExt = node.rave_setStyle;
  9508. var origSetAttributeExt = node.setAttribute;
  9509. var origGetScreenCTM = node.getScreenCTM;
  9510. var origGetCTM = node.getCTM;
  9511. node.appendChild = function(appendChild) {
  9512. com_ibm_rave_core_Rave.configuration.extendRecursive(appendChild);
  9513. if (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isRawMode(this)) {
  9514. origAppendChild.call(this, appendChild);
  9515. } else {
  9516. var appendNode = this;
  9517. var firstChild = origGetFirstChild.call(this);
  9518. if (firstChild && com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isOwnerGroupNode(firstChild)) {
  9519. appendNode = firstChild;
  9520. }
  9521. origAppendChild.call(appendNode, appendChild);
  9522. if (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isMirrored(this)) {
  9523. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.mirrorNode$0(appendChild);
  9524. } else {
  9525. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.update(appendChild);
  9526. }
  9527. }
  9528. };
  9529. node.insertBefore = function(insert, before) {
  9530. com_ibm_rave_core_Rave.configuration.extendRecursive(insert);
  9531. var parent = this;
  9532. var beforeNode = before;
  9533. if (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isRawMode(this)) {
  9534. origInsertBefore.call(parent, insert, beforeNode);
  9535. } else {
  9536. var firstChild = origGetFirstChild.call(this);
  9537. if (firstChild && com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isOwnerGroupNode(firstChild)) {
  9538. parent = firstChild;
  9539. }
  9540. origInsertBefore.call(parent, insert, beforeNode);
  9541. if (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isMirrored(this)) {
  9542. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.mirrorNode$0(insert);
  9543. } else {
  9544. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.update(insert);
  9545. }
  9546. }
  9547. };
  9548. node.rave_getNextSibling = function() {
  9549. return origGetNextSibling.call(this);
  9550. };
  9551. node.rave_getPreviousSibling = function() {
  9552. return origGetPreviousSibling.call(this);
  9553. };
  9554. node.rave_getFirstChild = function() {
  9555. var child = origGetFirstChild.call(this);
  9556. if (child && com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isGroupNode(child)) {
  9557. child = child.rave_getFirstChild();
  9558. }
  9559. return child;
  9560. };
  9561. node.rave_hasChildNodes = function() {
  9562. var wrappedNode = com_ibm_rave_core_internal_selector_mirror_MirrorUtil.getWrappingGroup(this);
  9563. if (wrappedNode != null) {
  9564. return (wrappedNode).rave_hasChildNodes();
  9565. }
  9566. return origHasChildNodes.call(this);
  9567. };
  9568. node.rave_getChildNodes = function() {
  9569. if (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isRawMode(this)) {
  9570. return origGetChildNodes.call(this);
  9571. }
  9572. var nodes = origGetChildNodes.call(this);
  9573. var nonGroupNodes = [];
  9574. for (var __i_enFor0 = 0, __exp_enFor0 = nodes, __len_enFor0 = __exp_enFor0.length;
  9575. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  9576. var child = __exp_enFor0[__i_enFor0];
  9577. if (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isGroupNode(child)) {
  9578. nonGroupNodes = nonGroupNodes.concat(child.rave_getChildNodes());
  9579. } else {
  9580. nonGroupNodes.push(child);
  9581. }
  9582. }
  9583. return nonGroupNodes;
  9584. };
  9585. node.removeChild = function(childNode) {
  9586. if (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isRawMode(this)) {
  9587. return origRemoveChild.call(this, childNode);
  9588. }
  9589. var realChild = childNode;
  9590. var parent = this;
  9591. var group = com_ibm_rave_core_internal_selector_mirror_MirrorUtil.getWrappingGroup(this);
  9592. if (group != null && group != realChild) {
  9593. parent = group;
  9594. }
  9595. return origRemoveChild.call(parent, realChild);
  9596. };
  9597. node.rave_getParentNode = function() {
  9598. var origParent = origGetParent.call(this);
  9599. if (origParent && com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isRawMode(origParent)) {
  9600. return origParent;
  9601. }
  9602. while (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isGroupNode(origParent)) {
  9603. origParent = origGetParent.call(origParent);
  9604. }
  9605. return origParent;
  9606. };
  9607. node.setAttribute = function(key, value) {
  9608. origSetAttributeExt.call(this, key, value);
  9609. if (!(com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isRawMode(this))) {
  9610. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.update(this);
  9611. }
  9612. };
  9613. node.rave_setText = function(text) {
  9614. origSetTextExt.call(this, text);
  9615. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.update(this);
  9616. };
  9617. node.rave_setStyle = function(styleName, value, priority) {
  9618. origSetStyleExt.call(this, styleName, value, priority);
  9619. if (!(com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isRawMode(this)) && styleName == "transform") {
  9620. this.rave_setProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.ORIGINAL_STYLE_ATTRIBUTE, value);
  9621. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.update(this);
  9622. }
  9623. };
  9624. node.getScreenCTM = function() {
  9625. var origRawNode = com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(this, true);
  9626. var ctm = origGetScreenCTM.call(this);
  9627. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(this, origRawNode);
  9628. return ctm;
  9629. };
  9630. node.getCTM = function() {
  9631. var origRawNode = com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(this, true);
  9632. var ctm = origGetCTM.call(this);
  9633. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(this, origRawNode);
  9634. return ctm;
  9635. };
  9636. };
  9637. // $source: com/ibm/rave/core/RegistryService
  9638. /************************************************************************
  9639. ** IBM Confidential
  9640. **
  9641. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9642. **
  9643. ** (C) Copyright IBM Corp. 2017
  9644. **
  9645. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9646. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9647. ************************************************************************/
  9648. // GENERATED
  9649. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  9650. //@import com/ibm/rave/core/context/RaveContextManager (runtime) // RaveContextManager
  9651. /**
  9652. * 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.
  9653. * @see ExtensionFactory
  9654. */
  9655. var com_ibm_rave_core_RegistryService = rave_externs["RegistryService"] = com_ibm_rave_core_nativeImpl_Declare({
  9656. //registryMapKey : null,
  9657. /**
  9658. * Gets the id of this service
  9659. * @return (String) a unique registry service id
  9660. */
  9661. /** @expose */
  9662. getServiceId : function() {
  9663. return "RegistryService";
  9664. },
  9665. /**
  9666. */
  9667. /** @expose */
  9668. constructor : function() {
  9669. this.registryMapKey = this.getServiceId() + "_REGISTRY_MAP_KEY";
  9670. },
  9671. getRegistryMap : function() {
  9672. var registry = com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData(this.registryMapKey);
  9673. if (!registry) {
  9674. registry = {};
  9675. com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().putData(this.registryMapKey, registry);
  9676. }
  9677. return registry;
  9678. },
  9679. /**
  9680. * 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.
  9681. * @param (String) id id used to register the extension
  9682. * @return (Object) an instance of extended object (e.g. layout, legend, etc), <code>null</code> if this extension is not registered
  9683. */
  9684. extension$0 : function(id) {
  9685. var registry = this.getRegistryMap();
  9686. if (registry[id]) {
  9687. return registry[id]();
  9688. }
  9689. return null;
  9690. },
  9691. /**
  9692. * Register an extended object factory using extension id. If the same id is already in use, registration will fail.
  9693. * @param (String) id extension id
  9694. * @param (com.ibm.rave.core.ExtensionFactory) factory extended factory to produce object instances of a type provided by id
  9695. * @return (boolean) true, if the registration was successful, false otherwise
  9696. */
  9697. extension$1 : function(id, factory) {
  9698. var registry = this.getRegistryMap();
  9699. if (registry[id]) {
  9700. return false;
  9701. }
  9702. registry[id] = factory;
  9703. return true;
  9704. },
  9705. /**
  9706. * Answers whether or not a given id is used to register an extension factory
  9707. * @param (String) id the extension id to check
  9708. * @return (boolean) true, if this id is used already, false otherwise
  9709. */
  9710. /** @expose */
  9711. isRegistered : function(id) {
  9712. return this.getRegistryMap().hasOwnProperty(id);
  9713. },
  9714. /** @expose */
  9715. extension : function(a0, a1) {
  9716. var args = arguments;
  9717. if (args.length == 1) {
  9718. return this.extension$0(a0);
  9719. }
  9720. return this.extension$1(a0, a1);
  9721. }
  9722. });
  9723. //com_ibm_rave_core_RegistryService.REGISTRY_MAP_KEY_SUFFIX = "_REGISTRY_MAP_KEY";
  9724. // $source: com/ibm/rave/core/selector/Selector
  9725. /************************************************************************
  9726. ** IBM Confidential
  9727. **
  9728. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9729. **
  9730. ** (C) Copyright IBM Corp. 2017
  9731. **
  9732. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9733. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9734. ************************************************************************/
  9735. // GENERATED
  9736. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  9737. //@import com/ibm/rave/core/selector/Selection (loadtime) // superclass
  9738. //@import com/ibm/rave/core/internal/util/NamespaceUtil (runtime) // getQName
  9739. //@import com/ibm/rave/core/internal/selector/SelectorHelper (runtime) // selectorAll, selector, each
  9740. //@import com/ibm/rave/core/internal/util/QueryUtil (runtime) // getQueryEngine
  9741. //@import com/ibm/rave/core/selector/EnterSelector (runtime) // new
  9742. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (runtime) // create
  9743. //@import com/ibm/rave/core/internal/nativeImpl/selector/EmptySceneNode (runtime) // new
  9744. //@import com/ibm/rave/core/internal/nativeImpl/transitions/InheritedTransition (runtime) // get
  9745. //@import com/ibm/rave/core/transition/Transition (runtime) // create
  9746. //@import com/ibm/rave/core/internal/transitions/TransitionUtil (runtime) // interruptNS, transitionNamespace
  9747. //@import com/ibm/rave/core/internal/nativeImpl/PlatformInitialization (runtime) // getDocument, getDocumentElement
  9748. //@import com/ibm/rave/core/Configuration (runtime) // Configuration
  9749. //@import com/ibm/rave/core/arrays/Sort (runtime) // Sort
  9750. //@import com/ibm/rave/core/internal/selector/mirror/MirroredSelector (runtime) // new
  9751. //@import com/ibm/rave/core/context/RaveContextManager (static) // RaveContextManager
  9752. //@import com/ibm/rave/core/RegistryService (loadtime) // superclass
  9753. /**
  9754. * 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.
  9755. */
  9756. var com_ibm_rave_core_selector_Selector = rave_externs["Selector"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_selector_Selection, {
  9757. //enterSelector : null, //exitSelector : null,
  9758. /**
  9759. * Does this selector type require that we extend nodes with custom node extensions. By default, our main Selector does not require extensions.
  9760. */
  9761. /** @expose */
  9762. needsNodeExtension : false,
  9763. /**
  9764. * @return (com.ibm.rave.core.ExtensionFactory) The factory to create an instance of a Selector
  9765. */
  9766. /** @expose */
  9767. getSelectorFactory : function() {
  9768. return com_ibm_rave_core_selector_Selector.factory;
  9769. },
  9770. /**
  9771. * 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").
  9772. * @param (String) name the name of the new element
  9773. * @return (com.ibm.rave.core.selector.Selector) a new {@link (com.ibm.rave.core.selector.Selector) Selector} containing the appended elements
  9774. */
  9775. append$0 : function(name) {
  9776. var qname = com_ibm_rave_core_internal_util_NamespaceUtil.getQName(name);
  9777. return this.select(function(data, index, groupIndex) {
  9778. var newNode = com_ibm_rave_core_selector_Selector.createSceneNode(qname["space"], qname["local"], this);
  9779. if (newNode) {
  9780. this.rave_appendChild(newNode);
  9781. }
  9782. return newNode;
  9783. });
  9784. },
  9785. /**
  9786. * 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. If the appended node already has a parent, the node is first removed from its current parent and moved to the new parent.
  9787. * @param (com.ibm.rave.core.selector.ValueFunction) elementFunction a function that returns the element to append
  9788. * @return (com.ibm.rave.core.selector.Selector) a new {@link (com.ibm.rave.core.selector.Selector) Selector} containing the appended elements
  9789. */
  9790. append$1 : function(elementFunction) {
  9791. return this.select(function(data, index, groupIndex) {
  9792. var newNode = elementFunction.call(this, data, index, groupIndex);
  9793. var existingParent = newNode.rave_getParentNode();
  9794. if (existingParent) {
  9795. existingParent.removeChild(newNode);
  9796. }
  9797. this.rave_appendChild(newNode);
  9798. return newNode;
  9799. });
  9800. },
  9801. /**
  9802. * Inserts a new element with the specified name as the last child of each element in the current selection, returning a new selection containing the inserted elements.
  9803. * @param (String) name the name of the new element
  9804. * @return (com.ibm.rave.core.selector.Selector) a new {@link (com.ibm.rave.core.selector.Selector) Selector} containing the inserted element(s)
  9805. */
  9806. insert$0 : function(name) {
  9807. return this.insert$4(name, null);
  9808. },
  9809. /**
  9810. * Inserts a new element with the specified name as the last child of each element in the current selection, returning a new selection containing the inserted elements.
  9811. * @param (com.ibm.rave.core.selector.ValueFunction) elementFunction a function that returns the element to append
  9812. * @return (com.ibm.rave.core.selector.Selector) a new {@link (com.ibm.rave.core.selector.Selector) Selector} containing the inserted element(s)
  9813. */
  9814. insert$1 : function(elementFunction) {
  9815. return this.insert$2(elementFunction, null);
  9816. },
  9817. /**
  9818. * 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.
  9819. * @param (com.ibm.rave.core.selector.ValueFunction) elementFunction a function that returns the element to append
  9820. * @param (String) before a selector query string identifying the element to insert before
  9821. * @return (com.ibm.rave.core.selector.Selector) a new {@link (com.ibm.rave.core.selector.Selector) Selector} containing the inserted elements
  9822. */
  9823. insert$2 : function(elementFunction, before) {
  9824. return this.insert$3(elementFunction, com_ibm_rave_core_internal_selector_SelectorHelper.selector(before));
  9825. },
  9826. /**
  9827. * 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.
  9828. * @param (com.ibm.rave.core.selector.ValueFunction) nameFunction a function which returns the name of the new element to create
  9829. * @param (com.ibm.rave.core.selector.ValueFunction) beforeFunction a function which returns the element to insert before
  9830. * @return (com.ibm.rave.core.selector.Selector) a new {@link (com.ibm.rave.core.selector.Selector) Selector} containing the inserted elements
  9831. */
  9832. insert$3 : function(nameFunction, beforeFunction) {
  9833. return this.select(function(data, index, groupIndex) {
  9834. var newNode = nameFunction.call(this, data, index, groupIndex);
  9835. if (newNode) {
  9836. var existingParent = newNode.rave_getParentNode();
  9837. if (existingParent) {
  9838. existingParent.removeChild(newNode);
  9839. }
  9840. this.rave_insertBefore(newNode, beforeFunction ? beforeFunction.call(this, data, index, groupIndex) : null);
  9841. }
  9842. return newNode;
  9843. });
  9844. },
  9845. /**
  9846. * 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").
  9847. * @param (String) name the name of the new element
  9848. * @param (String) before a selector query string identifying the element to insert before
  9849. * @return (com.ibm.rave.core.selector.Selector) a new {@link (com.ibm.rave.core.selector.Selector) Selector} containing the inserted elements
  9850. */
  9851. insert$4 : function(name, before) {
  9852. return this.insert$5(name, com_ibm_rave_core_internal_selector_SelectorHelper.selector(before));
  9853. },
  9854. /**
  9855. * 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").
  9856. * @param (String) type the name of the new element
  9857. * @param (com.ibm.rave.core.selector.ValueFunction) beforeFunction a function which returns the element to insert before
  9858. * @return (com.ibm.rave.core.selector.Selector) a new {@link (com.ibm.rave.core.selector.Selector) Selector} containing the inserted elements
  9859. */
  9860. insert$5 : function(type, beforeFunction) {
  9861. var qname = com_ibm_rave_core_internal_util_NamespaceUtil.getQName(type);
  9862. return this.select(function(data, index, groupIndex) {
  9863. var newNode = com_ibm_rave_core_selector_Selector.createSceneNode(qname["space"], qname["local"], this);
  9864. if (newNode) {
  9865. this.rave_insertBefore(newNode, beforeFunction ? beforeFunction.call(this, data, index, groupIndex) : null);
  9866. }
  9867. return newNode;
  9868. });
  9869. },
  9870. /**
  9871. * 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.
  9872. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  9873. */
  9874. /** @expose */
  9875. remove : function() {
  9876. var node;
  9877. for (var j = 0, m = this.length; j < m; ++j) {
  9878. var group = this[j];
  9879. for (var i = 0, n = group.length; i < n; ++i) {
  9880. if ((node = group[i])) {
  9881. var parent = node.rave_getParentNode();
  9882. if (parent) {
  9883. parent.removeChild(node);
  9884. }
  9885. }
  9886. }
  9887. }
  9888. return this;
  9889. },
  9890. on$0 : function(eventName) {
  9891. var node = this.node();
  9892. if (node) {
  9893. var eventListener = node.rave_getEventListener(eventName);
  9894. if (typeof eventListener === "function") {
  9895. return (eventListener)._listener;
  9896. }
  9897. }
  9898. return undefined;
  9899. },
  9900. on$1 : function(value) {
  9901. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(value), __len_enFor0 = __exp_enFor0.length;
  9902. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  9903. var key = __exp_enFor0[__i_enFor0];
  9904. this.on$3(key, value[key], false);
  9905. }
  9906. return this;
  9907. },
  9908. /**
  9909. * 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.
  9910. * @param (String) eventName the event name
  9911. * @param (com.ibm.rave.core.selector.SelectorEventListener) listener the event listener
  9912. * @return (com.ibm.rave.core.selector.Selector) this selector
  9913. */
  9914. on$2 : function(eventName, listener) {
  9915. return this.on$3(eventName, listener, false);
  9916. },
  9917. /**
  9918. * 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.
  9919. * @param (String) eventName the event name
  9920. * @param (com.ibm.rave.core.selector.SelectorEventListener) listener the event listener
  9921. * @param (boolean) useCapture whether or not the listener is to be added to the capture phase; not supported by all clients
  9922. * @return (com.ibm.rave.core.selector.Selector) this selector
  9923. */
  9924. on$3 : function(eventName, listener, useCapture) {
  9925. var self = this;
  9926. var type, group;
  9927. var idx = eventName.indexOf(".");
  9928. if (idx >= 0) {
  9929. type = eventName.substring(0, idx);
  9930. group = eventName.substring(idx + 1);
  9931. } else {
  9932. type = eventName;
  9933. group = null;
  9934. }
  9935. this.each(function(data, index, groupIndex) {
  9936. if (type != null && (group == null || type.length > 0)) {
  9937. if (listener) {
  9938. var fNode = this;
  9939. var eventListener = function(event) {
  9940. self.notifyEvent(listener, fNode, index, groupIndex, event);
  9941. };
  9942. eventListener._listener = listener;
  9943. if (group != null) {
  9944. this.rave_removeEventListener(type, group);
  9945. this.rave_addEventListener(type, eventListener, useCapture, group);
  9946. } else {
  9947. this.rave_removeEventListener(type);
  9948. this.rave_addEventListener(type, eventListener, useCapture);
  9949. }
  9950. } else if (group != null) {
  9951. this.rave_removeEventListener(type, group);
  9952. } else {
  9953. this.rave_removeEventListener(type);
  9954. }
  9955. } else if (group != null && !listener) {
  9956. this.rave_removeEventListeners(group);
  9957. }
  9958. });
  9959. return this;
  9960. },
  9961. /**
  9962. * Hook to allow JavaScript to wrap the listener.
  9963. * @param (com.ibm.rave.core.selector.SelectorEventListener) listener the listener to wrap
  9964. */
  9965. /** @expose */
  9966. notifyEvent : function(listener, node, index, groupIndex, event) {
  9967. var o = rave.event;
  9968. rave.event = event;
  9969. try {
  9970. listener.call(node, node.rave_getData(), index, groupIndex, event);
  9971. } finally {
  9972. rave.event = o;
  9973. }
  9974. },
  9975. /**
  9976. * Returns the owner of the first {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  9977. * @return (com.ibm.rave.core.scene.SceneNode) owner of this attribute for the first {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} .
  9978. */
  9979. owner$0 : function() {
  9980. var node = this.node();
  9981. return node ? node.rave_getOwner() : null;
  9982. },
  9983. /**
  9984. * 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.
  9985. * @param (com.ibm.rave.core.scene.SceneNode) owner the {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} to set as the owner
  9986. * @return (com.ibm.rave.core.selector.Selector) Selector
  9987. */
  9988. owner$1 : function(owner) {
  9989. return this.each(function(data, index, groupIndex) {
  9990. this.rave_setOwner(owner);
  9991. });
  9992. },
  9993. /**
  9994. * 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.
  9995. * @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
  9996. * @return (com.ibm.rave.core.selector.Selector) Selector
  9997. */
  9998. owner$2 : function(owner) {
  9999. if (!owner) {
  10000. return this.owner$1(owner);
  10001. }
  10002. return this.each(function(data, index, groupIndex) {
  10003. this.rave_setOwner(owner.call(this, data, index, groupIndex));
  10004. });
  10005. },
  10006. /**
  10007. * Returns the value of the requested attribute for the first {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  10008. * @param (String) attribute String attribute name.
  10009. * @return (Object) value for this attribute for the first {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} .
  10010. */
  10011. attr$3 : function(attribute) {
  10012. var node = this.node();
  10013. if (node) {
  10014. var qname = com_ibm_rave_core_internal_util_NamespaceUtil.getQName(attribute);
  10015. if (qname["space"] == null) {
  10016. return node.getAttribute(qname["local"]);
  10017. }
  10018. return node.getAttributeNS(qname["space"], qname["local"]);
  10019. }
  10020. return null;
  10021. },
  10022. /**
  10023. * Sets the value for the requested attribute for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  10024. * @param (String) attribute String attribute name.
  10025. * @param (Object) value Value for attribute.
  10026. * @return (com.ibm.rave.core.selector.Selector) Selector
  10027. */
  10028. attr$1 : function(attribute, value) {
  10029. if (typeof value === "function") {
  10030. return this.attr$2(attribute, value);
  10031. }
  10032. var qname = com_ibm_rave_core_internal_util_NamespaceUtil.getQName(attribute);
  10033. var node;
  10034. for (var j = 0, m = this.length; j < m; ++j) {
  10035. var group = this[j];
  10036. for (var i = 0, n = group.length; i < n; ++i) {
  10037. if ((node = group[i])) {
  10038. if (value == null) {
  10039. if (qname["space"] == null) {
  10040. node.removeAttribute(qname["local"]);
  10041. } else {
  10042. node.removeAttributeNS(qname["space"], qname["local"]);
  10043. }
  10044. } else {
  10045. if (qname["space"] == null) {
  10046. node.setAttribute(qname["local"], value);
  10047. } else {
  10048. node.setAttributeNS(qname["space"], qname["local"], value);
  10049. }
  10050. }
  10051. }
  10052. }
  10053. }
  10054. return this;
  10055. },
  10056. /**
  10057. * 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.
  10058. * @param (String) attribute String attribute name to set.
  10059. * @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.
  10060. * @return (com.ibm.rave.core.selector.Selector) Selector
  10061. */
  10062. attr$2 : function(attribute, valueFunction) {
  10063. if (!valueFunction) {
  10064. return this.attr$1(attribute, null);
  10065. }
  10066. var qname = com_ibm_rave_core_internal_util_NamespaceUtil.getQName(attribute);
  10067. var node;
  10068. for (var j = 0, m = this.length; j < m; ++j) {
  10069. var group = this[j];
  10070. for (var i = 0, n = group.length; i < n; ++i) {
  10071. if ((node = group[i])) {
  10072. var value = valueFunction.call(node, node.rave_getData(), i, j);
  10073. if (value == null) {
  10074. if (qname["space"] == null) {
  10075. node.removeAttribute(qname["local"]);
  10076. } else {
  10077. node.removeAttributeNS(qname["space"], qname["local"]);
  10078. }
  10079. } else {
  10080. if (qname["space"] == null) {
  10081. node.setAttribute(qname["local"], value);
  10082. } else {
  10083. node.setAttributeNS(qname["space"], qname["local"], value);
  10084. }
  10085. }
  10086. }
  10087. }
  10088. }
  10089. return this;
  10090. },
  10091. /**
  10092. * Returns the value of the requested style for the first {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  10093. * @param (String) styleName String style name.
  10094. * @return (Object) value for this style attribute for the first {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} .
  10095. */
  10096. style$6 : function(styleName) {
  10097. var node = this.node();
  10098. return node ? node.rave_getComputedStyle(styleName) : null;
  10099. },
  10100. /**
  10101. * Sets the passed style attribute for each match in this selector based on value returned from the passed function.
  10102. * @param (String) styleName String style name to set.
  10103. * @param (Object) value value for the attribute. This can be a ValueFunction or something that can be coerced to a String.
  10104. * @return (com.ibm.rave.core.selector.Selector) Selector
  10105. */
  10106. style$2 : function(styleName, value) {
  10107. return (typeof value === "function") ? this.style$5(styleName, value, null) : this.style$4(styleName, value, null);
  10108. },
  10109. /**
  10110. * Sets the value for the requested style for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  10111. * @param (String) styleName String style name.
  10112. * @param (Object) value Value for attribute.
  10113. * @return (com.ibm.rave.core.selector.Selector) Selector
  10114. */
  10115. style$4 : function(styleName, value, priority) {
  10116. if (typeof value === "function") {
  10117. return this.style$5(styleName, value, priority);
  10118. }
  10119. var newPriority = priority != null ? priority : "";
  10120. var node;
  10121. for (var j = 0, m = this.length; j < m; ++j) {
  10122. var group = this[j];
  10123. for (var i = 0, n = group.length; i < n; ++i) {
  10124. if ((node = group[i])) {
  10125. if (value == null) {
  10126. node.rave_removeStyle(styleName);
  10127. } else {
  10128. node.rave_setStyle(styleName, value, newPriority);
  10129. }
  10130. }
  10131. }
  10132. }
  10133. return this;
  10134. },
  10135. style$3 : function(styleName, valueFunction) {
  10136. return this.style$5(styleName, valueFunction, null);
  10137. },
  10138. /**
  10139. * 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.
  10140. * @param (String) styleName String style name to set.
  10141. * @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.
  10142. * @return (com.ibm.rave.core.selector.Selector) Selector
  10143. */
  10144. style$5 : function(styleName, valueFunction, priority) {
  10145. if (!valueFunction) {
  10146. return this.style$2(styleName, null);
  10147. }
  10148. var node;
  10149. for (var j = 0, m = this.length; j < m; ++j) {
  10150. var group = this[j];
  10151. for (var i = 0, n = group.length; i < n; ++i) {
  10152. if ((node = group[i])) {
  10153. var value = valueFunction.call(node, node.rave_getData(), i, j);
  10154. if (value == null) {
  10155. node.rave_removeStyle(styleName);
  10156. } else {
  10157. node.rave_setStyle(styleName, value, priority);
  10158. }
  10159. }
  10160. }
  10161. }
  10162. return this;
  10163. },
  10164. /**
  10165. * Returns the value of the requested property for the first {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  10166. * @param (String) key the property string key
  10167. * @return (Object) value for this property for the first {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} .
  10168. */
  10169. property$0 : function(key) {
  10170. var node = this.node();
  10171. return node ? node.rave_getProperty(key) : null;
  10172. },
  10173. property$1 : function(value) {
  10174. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(value), __len_enFor0 = __exp_enFor0.length;
  10175. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  10176. var key = __exp_enFor0[__i_enFor0];
  10177. var v = value[key];
  10178. if (typeof v === "function") {
  10179. this.property$3(key, v);
  10180. } else {
  10181. this.property$2(key, v);
  10182. }
  10183. }
  10184. return this;
  10185. },
  10186. /**
  10187. * Sets the property value for the given key for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  10188. * @param (String) key the property string key
  10189. * @param (Object) value the property value
  10190. * @return (com.ibm.rave.core.selector.Selector) Selector
  10191. */
  10192. property$2 : function(key, value) {
  10193. if (typeof value === "function") {
  10194. return this.property$3(key, value);
  10195. }
  10196. var node;
  10197. for (var j = 0, m = this.length; j < m; ++j) {
  10198. var group = this[j];
  10199. for (var i = 0, n = group.length; i < n; ++i) {
  10200. if ((node = group[i])) {
  10201. this.selectorSetProperty(node, key, value);
  10202. }
  10203. }
  10204. }
  10205. return this;
  10206. },
  10207. selectorSetProperty : function(node, key, value) {
  10208. if (value == null) {
  10209. node.rave_removeProperty(key);
  10210. } else {
  10211. node.rave_setProperty(key, value);
  10212. }
  10213. },
  10214. /**
  10215. * Sets the passed property for each match in this selector based on value returned from the passed function.
  10216. * @param (String) key the property string key
  10217. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction "anonymous" function class to be executed for each property.
  10218. * @return (com.ibm.rave.core.selector.Selector) Selector
  10219. */
  10220. property$3 : function(key, valueFunction) {
  10221. if (!valueFunction) {
  10222. return this.property$2(key, null);
  10223. }
  10224. var node;
  10225. for (var j = 0, m = this.length; j < m; ++j) {
  10226. var group = this[j];
  10227. for (var i = 0, n = group.length; i < n; ++i) {
  10228. if ((node = group[i])) {
  10229. this.selectorSetProperty(node, key, valueFunction.call(node, node.rave_getData(), i, j));
  10230. }
  10231. }
  10232. }
  10233. return this;
  10234. },
  10235. /**
  10236. * 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.
  10237. * @return (String) text content for the first non-null element in the selection
  10238. */
  10239. text$2 : function() {
  10240. var node = this.node();
  10241. return node ? node.rave_getText() : null;
  10242. },
  10243. /**
  10244. * Sets the text content for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  10245. * @param (Object) value The text content.
  10246. * @return (com.ibm.rave.core.selector.Selector) Selector
  10247. */
  10248. text$0 : function(value) {
  10249. if (typeof value === "function") {
  10250. return this.text$1(value);
  10251. }
  10252. var text = value == null ? "" : value + "";
  10253. var node;
  10254. for (var j = 0, m = this.length; j < m; ++j) {
  10255. var group = this[j];
  10256. for (var i = 0, n = group.length; i < n; ++i) {
  10257. if ((node = group[i])) {
  10258. node.rave_setText(text);
  10259. }
  10260. }
  10261. }
  10262. return this;
  10263. },
  10264. /**
  10265. * Sets the text content for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  10266. * @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.
  10267. * @return (com.ibm.rave.core.selector.Selector) Selector
  10268. */
  10269. text$1 : function(valueFunction) {
  10270. var node;
  10271. for (var j = 0, m = this.length; j < m; ++j) {
  10272. var group = this[j];
  10273. for (var i = 0, n = group.length; i < n; ++i) {
  10274. if ((node = group[i])) {
  10275. var value = !valueFunction ? null : valueFunction.call(node, node.rave_getData(), i, j);
  10276. node.rave_setText(value == null ? "" : value + "");
  10277. }
  10278. }
  10279. }
  10280. return this;
  10281. },
  10282. /**
  10283. * Returns the html value for the first {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  10284. * @return (String) html value for the first {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} .
  10285. */
  10286. html$0 : function() {
  10287. var node = this.node();
  10288. return node ? node.rave_getHtml() : null;
  10289. },
  10290. /**
  10291. * Sets the html content for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  10292. * @param (Object) value The html content.
  10293. * @return (com.ibm.rave.core.selector.Selector) Selector
  10294. */
  10295. html$1 : function(value) {
  10296. var html = value == null ? "" : value + "";
  10297. var node;
  10298. for (var j = 0, m = this.length; j < m; ++j) {
  10299. var group = this[j];
  10300. for (var i = 0, n = group.length; i < n; ++i) {
  10301. if ((node = group[i])) {
  10302. node.rave_setHtml(html);
  10303. }
  10304. }
  10305. }
  10306. return this;
  10307. },
  10308. /**
  10309. * Sets the html content for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  10310. * @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.
  10311. * @return (com.ibm.rave.core.selector.Selector) Selector
  10312. */
  10313. html$2 : function(valueFunction) {
  10314. var node;
  10315. for (var j = 0, m = this.length; j < m; ++j) {
  10316. var group = this[j];
  10317. for (var i = 0, n = group.length; i < n; ++i) {
  10318. if ((node = group[i])) {
  10319. var value = !valueFunction ? null : valueFunction.call(node, node.rave_getData(), i, j);
  10320. node.rave_setHtml(value == null ? "" : value + "");
  10321. }
  10322. }
  10323. }
  10324. return this;
  10325. },
  10326. filter$0 : function(filterFunction) {
  10327. var subgroups = this.getSelectorFactory()();
  10328. var subgroup;
  10329. var group;
  10330. var node;
  10331. for (var j = 0, m = this.length; j < m; ++j) {
  10332. group = this[j];
  10333. subgroup = [];
  10334. subgroups.push(subgroup);
  10335. subgroup["parentNode"] = group["parentNode"];
  10336. for (var i = 0, n = group.length; i < n; ++i) {
  10337. if ((node = group[i]) && filterFunction.call(node, node.rave_getData(), i, j)) {
  10338. subgroup.push(node);
  10339. }
  10340. }
  10341. }
  10342. return subgroups;
  10343. },
  10344. filter$1 : function(filter) {
  10345. return this.filter$0(function(data, index, groupIndex) {
  10346. return com_ibm_rave_core_internal_util_QueryUtil.getQueryEngine(this).matches(this, filter);
  10347. });
  10348. },
  10349. /** @expose */
  10350. isTransition : function() {
  10351. return false;
  10352. },
  10353. /**
  10354. * Returns <code>true</code> only if the first node in the selection has the specified class or classes.
  10355. * @param (String) className the class name
  10356. * @return (boolean) <code>true</code> if the first node has the class set, <code>false</code> otherwise
  10357. */
  10358. classed$0 : function(className) {
  10359. var node = this.node();
  10360. return node && node.rave_containsClass(className);
  10361. },
  10362. classed$1 : function(value) {
  10363. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(value), __len_enFor0 = __exp_enFor0.length;
  10364. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  10365. var key = __exp_enFor0[__i_enFor0];
  10366. var v = value[key];
  10367. if (typeof v === "function") {
  10368. this.classed$3(key, v);
  10369. } else {
  10370. this.classed$2(key, (v));
  10371. }
  10372. }
  10373. return this;
  10374. },
  10375. /**
  10376. * Sets the value for the specified class for each {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} in this Selector.
  10377. * @param (String) className the class name
  10378. * @param (boolean) add Whether to add the class or not.
  10379. * @return (com.ibm.rave.core.selector.Selector) Selector
  10380. */
  10381. classed$2 : function(className, add) {
  10382. var newClassName = className + "";
  10383. var node;
  10384. for (var j = 0, m = this.length; j < m; ++j) {
  10385. var group = this[j];
  10386. for (var i = 0, n = group.length; i < n; ++i) {
  10387. if ((node = group[i])) {
  10388. if (add) {
  10389. node.rave_addClass(newClassName);
  10390. } else {
  10391. node.rave_removeClass(newClassName);
  10392. }
  10393. }
  10394. }
  10395. }
  10396. return this;
  10397. },
  10398. /**
  10399. * 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.
  10400. * @param (String) className String class name to set.
  10401. * @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.
  10402. * @return (com.ibm.rave.core.selector.Selector) Selector
  10403. */
  10404. classed$3 : function(className, valueFunction) {
  10405. if (!valueFunction) {
  10406. return this.classed$2(className, false);
  10407. }
  10408. var newClassName = className != null ? className + "" : "";
  10409. var node;
  10410. for (var j = 0, m = this.length; j < m; ++j) {
  10411. var group = this[j];
  10412. for (var i = 0, n = group.length; i < n; ++i) {
  10413. if ((node = group[i])) {
  10414. if (valueFunction.call(node, node.rave_getData(), i, j)) {
  10415. node.rave_addClass(newClassName);
  10416. } else {
  10417. node.rave_removeClass(newClassName);
  10418. }
  10419. }
  10420. }
  10421. }
  10422. return this;
  10423. },
  10424. /**
  10425. * Get the first data value in the selection.
  10426. * @return (Array) the first data value in the selection
  10427. */
  10428. data$0 : function() {
  10429. if (this.length > 0) {
  10430. var group = this[0];
  10431. var node;
  10432. var n = group.length;
  10433. var value = new Array(n);
  10434. for (var i = 0; i < n; ++i) {
  10435. if ((node = group[i])) {
  10436. value[i] = node.rave_getData();
  10437. }
  10438. }
  10439. return value;
  10440. }
  10441. return null;
  10442. },
  10443. /**
  10444. * 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)
  10445. * @return (Object) the data value in the selection
  10446. */
  10447. datum$0 : function() {
  10448. var node = this.node();
  10449. if (node) {
  10450. return node.rave_getData();
  10451. }
  10452. return null;
  10453. },
  10454. /**
  10455. * 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)
  10456. * @param (com.ibm.rave.core.selector.ValueFunction) valueFn the function to call back to provide the value to set
  10457. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  10458. */
  10459. datum$1 : function(valueFn) {
  10460. var node;
  10461. for (var j = 0, m = this.length; j < m; ++j) {
  10462. var group = this[j];
  10463. for (var i = 0, n = group.length; i < n; ++i) {
  10464. if ((node = group[i])) {
  10465. this.selectorSetProperty(node, "__data__", valueFn.call(node, node.rave_getData(), i, j));
  10466. }
  10467. }
  10468. }
  10469. return this;
  10470. },
  10471. /**
  10472. * 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)
  10473. * @param (Object) value the value to set
  10474. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  10475. */
  10476. datum$2 : function(value) {
  10477. return this.datum$1(function(data, index, groupIndex) {
  10478. return value;
  10479. });
  10480. },
  10481. /**
  10482. * Joins the array of data values from the value function with the current selection.
  10483. * @param (com.ibm.rave.core.selector.ValueFunction) value the data to join
  10484. * @return (com.ibm.rave.core.selector.Selector) the update selector with joined data
  10485. */
  10486. data$1 : function(value) {
  10487. return this.doData(value, null);
  10488. },
  10489. /**
  10490. * Joins the array of data values from the value function with the current selection.
  10491. * @param (com.ibm.rave.core.selector.ValueFunction) value the data to join
  10492. * @param (com.ibm.rave.core.selector.ValueFunction) key the function to extra data keys
  10493. * @return (com.ibm.rave.core.selector.Selector) the update selector with joined data
  10494. */
  10495. data$2 : function(value, key) {
  10496. return this.doData(value, key);
  10497. },
  10498. /**
  10499. * Joins the specified array of data with the current selection.
  10500. * @param (java.lang.Object[]) value the data to join
  10501. * @return (com.ibm.rave.core.selector.Selector) the update selector with joined data
  10502. */
  10503. data$3 : function(value) {
  10504. return this.doData(value, null);
  10505. },
  10506. /**
  10507. * Joins the specified array of data with the current selection.
  10508. * @param (java.lang.Object[]) value the data to join
  10509. * @param (com.ibm.rave.core.selector.ValueFunction) key the function to extra data keys
  10510. * @return (com.ibm.rave.core.selector.Selector) the update selector with joined data
  10511. */
  10512. data$4 : function(value, key) {
  10513. return this.doData(value, key);
  10514. },
  10515. /**
  10516. * Joins the specified array of data with the current selection.
  10517. * @param (Object) value the data to join (Object[] or ValueFunction)
  10518. * @param (com.ibm.rave.core.selector.ValueFunction) key the function to extra data keys, may be <code>null</code>
  10519. * @return (com.ibm.rave.core.selector.Selector) the update selector with joined data
  10520. */
  10521. doData : function(value, key) {
  10522. var i = -1;
  10523. var n = this.length;
  10524. var group;
  10525. var extFactory = this.getSelectorFactory();
  10526. var enter = new com_ibm_rave_core_selector_EnterSelector().setSelectorFactory(extFactory);
  10527. var exit = extFactory();
  10528. var update = extFactory();
  10529. update.enterSelector = enter;
  10530. update.exitSelector = exit;
  10531. var self = this;
  10532. var bind = function(group, groupData) {
  10533. var i, n = group.length, m = groupData.length, n0 = Math.min(n, m);
  10534. var updateNodes = new Array(m);
  10535. var enterNodes = new Array(m);
  10536. var exitNodes = new Array(n);
  10537. var node;
  10538. var snode;
  10539. var nodeData;
  10540. if (key) {
  10541. var nodeByKeyValue = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  10542. var keyValues = new Array(n);
  10543. var keyValue;
  10544. for (i = 0; i < n; ++i) {
  10545. keyValue = key.call(node = group[i], (node).rave_getData(), i, -1);
  10546. if (nodeByKeyValue.has(keyValue)) {
  10547. snode = node;
  10548. snode.rave_setProperty("isExit", true);
  10549. exitNodes[i] = snode;
  10550. } else {
  10551. nodeByKeyValue.set(keyValue, node);
  10552. }
  10553. keyValues[i] = keyValue;
  10554. }
  10555. for (i = 0; i < m; ++i) {
  10556. keyValue = key.call(groupData, nodeData = groupData[i], i, -1);
  10557. if (!((node = nodeByKeyValue.get(keyValue)))) {
  10558. enterNodes[i] = new com_ibm_rave_core_internal_nativeImpl_selector_EmptySceneNode(nodeData);
  10559. } else if (node != self) {
  10560. updateNodes[i] = node;
  10561. (node).rave_setData(nodeData);
  10562. }
  10563. nodeByKeyValue.set(keyValue, self);
  10564. }
  10565. for (i = 0; i < n; ++i) {
  10566. if (nodeByKeyValue.get(keyValues[i]) != self) {
  10567. snode = group[i];
  10568. snode.rave_setProperty("isExit", true);
  10569. exitNodes[i] = snode;
  10570. }
  10571. }
  10572. } else {
  10573. for (i = 0; i < n0; ++i) {
  10574. node = group[i];
  10575. nodeData = groupData[i];
  10576. if ((node)) {
  10577. (node).rave_setData(nodeData);
  10578. updateNodes[i] = node;
  10579. } else {
  10580. enterNodes[i] = new com_ibm_rave_core_internal_nativeImpl_selector_EmptySceneNode(nodeData);
  10581. }
  10582. }
  10583. for (; i < m; ++i) {
  10584. enterNodes[i] = new com_ibm_rave_core_internal_nativeImpl_selector_EmptySceneNode(groupData[i]);
  10585. }
  10586. for (; i < n; ++i) {
  10587. snode = group[i];
  10588. snode.rave_setProperty("isExit", true);
  10589. exitNodes[i] = snode;
  10590. }
  10591. }
  10592. enterNodes["update"] = updateNodes;
  10593. enterNodes["parentNode"] = updateNodes["parentNode"] = exitNodes["parentNode"] = group["parentNode"];
  10594. enter.push(enterNodes);
  10595. update.push(updateNodes);
  10596. exit.push(exitNodes);
  10597. };
  10598. if (typeof value === "function") {
  10599. while (++i < n) {
  10600. bind((group = this[i]), (value).call(group, group["parentNode"].rave_getData(), i, -1));
  10601. }
  10602. } else {
  10603. var array = ((typeof value === "array" || value instanceof Array)) ? (value) : value;
  10604. while (++i < n) {
  10605. bind(this[i], array);
  10606. }
  10607. }
  10608. return update;
  10609. },
  10610. /**
  10611. * 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.
  10612. * @return (com.ibm.rave.core.selector.Selector) the enter selection
  10613. */
  10614. /** @expose */
  10615. enter : function() {
  10616. return this.enterSelector;
  10617. },
  10618. /**
  10619. * 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.
  10620. * @return (com.ibm.rave.core.selector.Selector) the exit selection
  10621. */
  10622. /** @expose */
  10623. exit : function() {
  10624. return this.exitSelector;
  10625. },
  10626. /**
  10627. * 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.
  10628. * @return (com.ibm.rave.core.transition.Transition) a new transition for the current selection
  10629. */
  10630. transition$0 : function() {
  10631. return this.transition$1(null);
  10632. },
  10633. /**
  10634. * 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.
  10635. * @param (String) name the name of the transition
  10636. * @return (com.ibm.rave.core.transition.Transition) a new transition for the current selection
  10637. */
  10638. transition$1 : function(name) {
  10639. var inherit = com_ibm_rave_core_internal_nativeImpl_transitions_InheritedTransition.get();
  10640. if (inherit) {
  10641. return com_ibm_rave_core_transition_Transition.create(this, name, inherit);
  10642. }
  10643. return com_ibm_rave_core_transition_Transition.create(this, name);
  10644. },
  10645. /**
  10646. * 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>
  10647. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  10648. */
  10649. interrupt$0 : function() {
  10650. return this.interrupt$1(null);
  10651. },
  10652. /**
  10653. * 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>
  10654. * @param (String) name the name of the transition
  10655. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  10656. */
  10657. interrupt$1 : function(name) {
  10658. var node;
  10659. for (var j = 0, m = this.length; j < m; ++j) {
  10660. var group = this[j];
  10661. for (var i = 0, n = group.length; i < n; ++i) {
  10662. if ((node = group[i])) {
  10663. com_ibm_rave_core_internal_transitions_TransitionUtil.interruptNS(node, com_ibm_rave_core_internal_transitions_TransitionUtil.transitionNamespace(name));
  10664. }
  10665. }
  10666. }
  10667. return this;
  10668. },
  10669. /**
  10670. * 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.
  10671. * @param (Object) query CSS3 Selection query syntax.
  10672. * @return (com.ibm.rave.core.selector.Selector) a new selector
  10673. */
  10674. select$0 : function(query) {
  10675. return this.select$1(com_ibm_rave_core_internal_selector_SelectorHelper.selector(query));
  10676. },
  10677. /**
  10678. * 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.
  10679. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction
  10680. * @return (com.ibm.rave.core.selector.Selector) a new selector
  10681. */
  10682. select$1 : function(valueFunction) {
  10683. var subgroups = this.getSelectorFactory()();
  10684. var subgroup;
  10685. var subnode;
  10686. var group;
  10687. var node;
  10688. for (var j = 0, m = this.length; j < m; ++j) {
  10689. group = this[j];
  10690. subgroup = [];
  10691. subgroups.push(subgroup);
  10692. subgroup["parentNode"] = group["parentNode"];
  10693. for (var i = 0, n = group.length; i < n; ++i) {
  10694. if ((node = group[i]) && valueFunction) {
  10695. subgroup.push(subnode = valueFunction.call(node, node.rave_getData(), i, j));
  10696. if (subnode && node.rave_hasData()) {
  10697. subnode.rave_setData(node.rave_getData());
  10698. }
  10699. } else {
  10700. subgroup.push(null);
  10701. }
  10702. }
  10703. }
  10704. return subgroups;
  10705. },
  10706. selectAll$0 : function(query) {
  10707. return this.selectAll$1(com_ibm_rave_core_internal_selector_SelectorHelper.selectorAll(query));
  10708. },
  10709. selectAll$1 : function(selector) {
  10710. var subgroups = this.getSelectorFactory()();
  10711. var subgroup;
  10712. var group;
  10713. var node;
  10714. for (var j = 0, m = this.length; j < m; ++j) {
  10715. subgroup = [];
  10716. group = this[j];
  10717. for (var i = 0, n = group.length; i < n; ++i) {
  10718. if ((node = group[i])) {
  10719. subgroups.push(subgroup = com_ibm_rave_core_selector_Selector.createSelectorGroupFromNodes(selector ? selector.call(node, node.rave_getData(), i, j) : null));
  10720. subgroup["parentNode"] = node;
  10721. }
  10722. }
  10723. }
  10724. return subgroups;
  10725. },
  10726. /**
  10727. * 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.
  10728. * @param (com.ibm.rave.core.selector.CallbackFunction) callback the callback to run for each element in the current selection
  10729. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  10730. */
  10731. each$0 : function(callback) {
  10732. return com_ibm_rave_core_internal_selector_SelectorHelper.each(this, callback);
  10733. },
  10734. /**
  10735. * Invokes the specified function for each element in the current selection, passing the current datum, index, and group index, with the this context of the current element. <p> Note: This method is <b>not</b> part of the D3 API. Code using the method will not run against the D3 library. </p>
  10736. * @param (String) type Ignored
  10737. * @param (com.ibm.rave.core.selector.RunFunction) listener Function to invoke for each element in the selection
  10738. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  10739. */
  10740. each$1 : function(type, listener) {
  10741. return com_ibm_rave_core_internal_selector_SelectorHelper.each(this, function(data, index, groupIndex) {
  10742. listener.call(this, data, index, groupIndex);
  10743. });
  10744. },
  10745. /**
  10746. * 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.
  10747. * @param (com.ibm.rave.core.selector.RunFunction) callback the function to callback, must be annotated as {@link (com.ibm.rave.codegenerator.annotations.FunctionClass) FunctionClass}
  10748. * @param (java.lang.Object[]) args optional arguments to pass to the call function
  10749. * @return (com.ibm.rave.core.selector.Selector) this selector
  10750. */
  10751. /** @expose */
  10752. call : function(callback, args) {
  10753. if (args !== null || arguments.length > 2){
  10754. args = Array.prototype.slice.call(arguments, 1);
  10755. }
  10756. {
  10757. var list = (args);
  10758. list.splice(0, 0, this);
  10759. callback.apply(this, list);
  10760. return this;
  10761. }
  10762. },
  10763. /**
  10764. * Selects the specified node. This is useful if you already have a reference to a node.
  10765. * @param (com.ibm.rave.core.scene.SceneNode) node the node to select
  10766. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  10767. */
  10768. init$0 : function(node) {
  10769. var group = com_ibm_rave_core_selector_Selector.createSelectorGroupFromNode(node);
  10770. this.push(group);
  10771. group["parentNode"] = com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocumentElement(node);
  10772. return this;
  10773. },
  10774. /**
  10775. * Selects the specified array of elements. This is useful if you already have a reference to nodes.
  10776. * @param (Array) nodes the nodes to select
  10777. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  10778. */
  10779. initAll$0 : function(nodes) {
  10780. var group = com_ibm_rave_core_selector_Selector.createSelectorGroupFromNodes(nodes);
  10781. this.push(group);
  10782. group["parentNode"] = com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocumentElement(com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocument());
  10783. return this;
  10784. },
  10785. /**
  10786. * 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.
  10787. * @param (String) query CSS3 selector query syntax
  10788. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  10789. */
  10790. init$1 : function(query) {
  10791. var node = com_ibm_rave_core_Configuration.INSTANCE.filter(com_ibm_rave_core_internal_util_QueryUtil.getQueryEngine(null).querySelector(query), query);
  10792. var group = com_ibm_rave_core_selector_Selector.createSelectorGroupFromNode(node);
  10793. this.push(group);
  10794. group["parentNode"] = com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocumentElement(node);
  10795. return this;
  10796. },
  10797. /**
  10798. * 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.
  10799. * @param (String) query CSS3 selector query syntax
  10800. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  10801. */
  10802. initAll$1 : function(query) {
  10803. var nodes = com_ibm_rave_core_Configuration.INSTANCE.filterArray(com_ibm_rave_core_internal_util_QueryUtil.getQueryEngine(null).querySelectorAll(query));
  10804. var group = com_ibm_rave_core_selector_Selector.createSelectorGroupFromNodes(nodes);
  10805. this.push(group);
  10806. group["parentNode"] = com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocumentElement(com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocument());
  10807. return this;
  10808. },
  10809. /**
  10810. * 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.
  10811. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  10812. */
  10813. /** @expose */
  10814. order : function() {
  10815. for (var j = 0, m = this.length; j < m; ++j) {
  10816. var group = this[j];
  10817. var i = group.length - 1;
  10818. if (i > 0) {
  10819. var next = group[i];
  10820. while (--i >= 0) {
  10821. var node;
  10822. if ((node = group[i])) {
  10823. if (next && !(next === node.rave_getNextSibling())) {
  10824. next.rave_getParentNode().rave_insertBefore(node, next);
  10825. }
  10826. next = node;
  10827. }
  10828. }
  10829. }
  10830. }
  10831. return this;
  10832. },
  10833. /**
  10834. * 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).
  10835. * @param (com.ibm.rave.core.util.Comparator) c {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} data value comparator.
  10836. * @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()} ).
  10837. */
  10838. sort2$0 : function(c) {
  10839. var comparator = function(a, b) {
  10840. if (a && b) {
  10841. return c(a.rave_getData(), b.rave_getData());
  10842. }
  10843. return +(!((a))) - +(!((b)));
  10844. };
  10845. var m = this.length;
  10846. for (var j = 0; j < m; ++j) {
  10847. this[j].sort(comparator);
  10848. }
  10849. return this.order();
  10850. },
  10851. /**
  10852. * Sorts the nodes in this selection in ascending order of their data values.
  10853. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  10854. */
  10855. sort$0 : function() {
  10856. return this.sort2$0(com_ibm_rave_core_arrays_Sort.ascending);
  10857. },
  10858. /**
  10859. * 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).
  10860. * @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.
  10861. * @return (com.ibm.rave.core.selector.Selector) Selector containing the currently selected nodes.
  10862. */
  10863. /** @expose */
  10864. mirror : function(mirror) {
  10865. var mirroredSelector = new com_ibm_rave_core_internal_selector_mirror_MirroredSelector();
  10866. if (this.node()) {
  10867. mirroredSelector.register(this.node()).initWithSelector(this);
  10868. mirroredSelector.mirror(mirror);
  10869. }
  10870. return (mirror) ? mirroredSelector : this;
  10871. },
  10872. /**
  10873. * Init this selector with an existing selector. Assumes 'this' selector is empty.
  10874. * @param (com.ibm.rave.core.selector.Selector) selector
  10875. */
  10876. /** @expose */
  10877. initWithSelector : function(selector) {
  10878. var group;
  10879. var newgroup;
  10880. var node;
  10881. for (var j = 0, m = selector.length; j < m; ++j) {
  10882. group = selector[j];
  10883. newgroup = [];
  10884. newgroup["parentNode"] = group["parentNode"];
  10885. this.push(newgroup);
  10886. for (var i = 0, n = group.length; i < n; ++i) {
  10887. node = group[i];
  10888. if (this.needsNodeExtension) {
  10889. node = com_ibm_rave_core_Configuration.INSTANCE.extendRecursive(node);
  10890. }
  10891. newgroup.push(node);
  10892. }
  10893. }
  10894. },
  10895. /**
  10896. * Get the extended selector for the given id.
  10897. * @param (String) id The id associated with the extended selector.
  10898. * @return (com.ibm.rave.core.selector.Selector) An instance of the extended selector, or null if none found.
  10899. */
  10900. extension$0 : function(id) {
  10901. var delegate = com_ibm_rave_core_selector_Selector.getSelectorDelegateRegistry().extension$0(id);
  10902. return delegate != null ? (delegate).setDelegate(this) : null;
  10903. },
  10904. /**
  10905. * Dispose this selection; allow any clean up to be performed. The node is removed, then disposed.
  10906. * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.core.selector.Selector) Selector}
  10907. */
  10908. /** @expose */
  10909. dispose : function() {
  10910. this.remove();
  10911. var node;
  10912. for (var j = 0, m = this.length; j < m; ++j) {
  10913. var group = this[j];
  10914. for (var i = 0, n = group.length; i < n; ++i) {
  10915. if ((node = group[i])) {
  10916. node.rave_dispose();
  10917. }
  10918. }
  10919. }
  10920. return this;
  10921. },
  10922. /** @expose */
  10923. append : function(a0) {
  10924. var args = arguments;
  10925. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  10926. return this.append$0(a0);
  10927. }
  10928. return this.append$1(a0);
  10929. },
  10930. /** @expose */
  10931. insert : function(a0, a1) {
  10932. var args = arguments;
  10933. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  10934. return this.insert$0(a0);
  10935. }
  10936. if (args.length == 1) {
  10937. return this.insert$1(a0);
  10938. }
  10939. if (args.length == 2 && typeof a0 === "function" && (a1 == null || typeof a1 === "string")) {
  10940. return this.insert$2(a0, a1);
  10941. }
  10942. if (args.length == 2 && typeof a0 === "function" && typeof a1 === "function") {
  10943. return this.insert$3(a0, a1);
  10944. }
  10945. if (args.length == 2 && (a0 == null || typeof a0 === "string") && (a1 == null || typeof a1 === "string")) {
  10946. return this.insert$4(a0, a1);
  10947. }
  10948. return this.insert$5(a0, a1);
  10949. },
  10950. /** @expose */
  10951. on : function(a0, a1, a2) {
  10952. var args = arguments;
  10953. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  10954. return this.on$0(a0);
  10955. }
  10956. if (args.length == 1) {
  10957. return this.on$1(a0);
  10958. }
  10959. if (args.length == 2) {
  10960. return this.on$2(a0, a1);
  10961. }
  10962. return this.on$3(a0, a1, a2);
  10963. },
  10964. /** @expose */
  10965. owner : function(a0) {
  10966. var args = arguments;
  10967. if (args.length == 0) {
  10968. return this.owner$0();
  10969. }
  10970. if (args.length == 1 && typeof a0 === "function") {
  10971. return this.owner$2(a0);
  10972. }
  10973. return this.owner$1(a0);
  10974. },
  10975. /** @expose */
  10976. attr : function(a0, a1) {
  10977. var args = arguments;
  10978. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  10979. return this.attr$3(a0);
  10980. }
  10981. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  10982. return this.attr$2(a0, a1);
  10983. }
  10984. if (args.length == 2 && (a0 == null || typeof a0 === "string") && (a1 == null || Object.prototype.toString.call(a1) !== "[object Array]")) {
  10985. return this.attr$1(a0, a1);
  10986. }
  10987. return com_ibm_rave_core_selector_Selection.prototype.attr.apply(this, args);
  10988. },
  10989. /** @expose */
  10990. style : function(a0, a1, a2) {
  10991. var args = arguments;
  10992. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  10993. return this.style$6(a0);
  10994. }
  10995. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  10996. return this.style$3(a0, a1);
  10997. }
  10998. if (args.length == 2 && (a0 == null || typeof a0 === "string") && (a1 == null || Object.prototype.toString.call(a1) !== "[object Array]")) {
  10999. return this.style$2(a0, a1);
  11000. }
  11001. if (args.length == 3 && (a0 == null || typeof a0 === "string") && typeof a1 === "function" && (a2 == null || typeof a2 === "string")) {
  11002. return this.style$5(a0, a1, a2);
  11003. }
  11004. if (args.length == 3 && (a0 == null || typeof a0 === "string") && (a1 == null || Object.prototype.toString.call(a1) !== "[object Array]") && (a2 == null || typeof a2 === "string")) {
  11005. return this.style$4(a0, a1, a2);
  11006. }
  11007. return com_ibm_rave_core_selector_Selection.prototype.style.apply(this, args);
  11008. },
  11009. /** @expose */
  11010. property : function(a0, a1) {
  11011. var args = arguments;
  11012. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  11013. return this.property$0(a0);
  11014. }
  11015. if (args.length == 1) {
  11016. return this.property$1(a0);
  11017. }
  11018. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  11019. return this.property$3(a0, a1);
  11020. }
  11021. return this.property$2(a0, a1);
  11022. },
  11023. /** @expose */
  11024. text : function(a0) {
  11025. var args = arguments;
  11026. if (args.length == 0) {
  11027. return this.text$2();
  11028. }
  11029. if (args.length == 1 && typeof a0 === "function") {
  11030. return this.text$1(a0);
  11031. }
  11032. return this.text$0(a0);
  11033. },
  11034. /** @expose */
  11035. html : function(a0) {
  11036. var args = arguments;
  11037. if (args.length == 0) {
  11038. return this.html$0();
  11039. }
  11040. if (args.length == 1 && typeof a0 === "function") {
  11041. return this.html$2(a0);
  11042. }
  11043. return this.html$1(a0);
  11044. },
  11045. /** @expose */
  11046. filter : function(a0) {
  11047. var args = arguments;
  11048. if (args.length == 1 && typeof a0 === "function") {
  11049. return this.filter$0(a0);
  11050. }
  11051. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  11052. return this.filter$1(a0);
  11053. }
  11054. return Array.prototype.filter.apply(this, args);
  11055. },
  11056. /** @expose */
  11057. classed : function(a0, a1) {
  11058. var args = arguments;
  11059. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  11060. return this.classed$0(a0);
  11061. }
  11062. if (args.length == 1) {
  11063. return this.classed$1(a0);
  11064. }
  11065. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  11066. return this.classed$3(a0, a1);
  11067. }
  11068. return this.classed$2(a0, a1);
  11069. },
  11070. /** @expose */
  11071. data : function(a0, a1) {
  11072. var args = arguments;
  11073. if (args.length == 0) {
  11074. return this.data$0();
  11075. }
  11076. if (args.length == 1 && typeof a0 === "function") {
  11077. return this.data$1(a0);
  11078. }
  11079. if (args.length == 1) {
  11080. return this.data$3(a0);
  11081. }
  11082. if (args.length == 2 && typeof a0 === "function" && typeof a1 === "function") {
  11083. return this.data$2(a0, a1);
  11084. }
  11085. return this.data$4(a0, a1);
  11086. },
  11087. /** @expose */
  11088. datum : function(a0) {
  11089. var args = arguments;
  11090. if (args.length == 0) {
  11091. return this.datum$0();
  11092. }
  11093. if (args.length == 1 && typeof a0 === "function") {
  11094. return this.datum$1(a0);
  11095. }
  11096. return this.datum$2(a0);
  11097. },
  11098. /** @expose */
  11099. transition : function(a0) {
  11100. var args = arguments;
  11101. if (args.length == 0) {
  11102. return this.transition$0();
  11103. }
  11104. return this.transition$1(a0);
  11105. },
  11106. /** @expose */
  11107. interrupt : function(a0) {
  11108. var args = arguments;
  11109. if (args.length == 0) {
  11110. return this.interrupt$0();
  11111. }
  11112. return this.interrupt$1(a0);
  11113. },
  11114. /** @expose */
  11115. select : function(a0) {
  11116. var args = arguments;
  11117. if (args.length == 1 && typeof a0 === "function") {
  11118. return this.select$1(a0);
  11119. }
  11120. return this.select$0(a0);
  11121. },
  11122. /** @expose */
  11123. selectAll : function(a0) {
  11124. var args = arguments;
  11125. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  11126. return this.selectAll$0(a0);
  11127. }
  11128. return this.selectAll$1(a0);
  11129. },
  11130. /** @expose */
  11131. each : function(a0, a1) {
  11132. var args = arguments;
  11133. if (args.length == 1) {
  11134. return this.each$0(a0);
  11135. }
  11136. return this.each$1(a0, a1);
  11137. },
  11138. /** @expose */
  11139. init : function(a0) {
  11140. var args = arguments;
  11141. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  11142. return this.init$1(a0);
  11143. }
  11144. return this.init$0(a0);
  11145. },
  11146. /** @expose */
  11147. initAll : function(a0) {
  11148. var args = arguments;
  11149. if (args.length == 1 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]")) {
  11150. return this.initAll$0(a0);
  11151. }
  11152. return this.initAll$1(a0);
  11153. },
  11154. /** @expose */
  11155. sort : function(a0) {
  11156. var args = arguments;
  11157. if (args.length == 0) {
  11158. return this.sort$0();
  11159. }
  11160. if (args.length == 1 && typeof a0 === "function") {
  11161. return this.sort2$0(a0);
  11162. }
  11163. return Array.prototype.sort.apply(this, args);
  11164. },
  11165. /** @expose */
  11166. extension : function(a0) {
  11167. var args = arguments;
  11168. return this.extension$0(a0);
  11169. }
  11170. });
  11171. com_ibm_rave_core_selector_Selector.getSelectorDelegateRegistry = function() {
  11172. var selectorDelegateRegistry = com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData(com_ibm_rave_core_selector_Selector.SELECTOR_DELEGATE_REGISTRY_KEY);
  11173. if (!selectorDelegateRegistry) {
  11174. selectorDelegateRegistry = new com_ibm_rave_core_selector_Selector.SelectorRegistryService();
  11175. com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().putData(com_ibm_rave_core_selector_Selector.SELECTOR_DELEGATE_REGISTRY_KEY, selectorDelegateRegistry);
  11176. }
  11177. return selectorDelegateRegistry;
  11178. };
  11179. com_ibm_rave_core_selector_Selector.createSelectorGroupFromNodes = function(nodes) {
  11180. var result = [];
  11181. if (nodes) {
  11182. for (var i = 0; i < nodes.length; ++i) {
  11183. result.push(nodes[i]);
  11184. }
  11185. }
  11186. return result;
  11187. };
  11188. com_ibm_rave_core_selector_Selector.createSelectorGroupFromNode = function(node) {
  11189. var result = [];
  11190. if (node) {
  11191. result.push(node);
  11192. }
  11193. return result;
  11194. };
  11195. /**
  11196. * Create a scene node for the given type.
  11197. * @param (String) nsuri the namespace URI for the name, may be <code>null</code>
  11198. * @param (String) name the scene node name
  11199. * @param (com.ibm.rave.core.scene.SceneNode) context optional context in which the node is to reside
  11200. * @return (com.ibm.rave.core.scene.SceneNode) a new scene node
  11201. */
  11202. com_ibm_rave_core_selector_Selector.createSceneNode = function(nsuri, name, context) {
  11203. var _nsuri = nsuri;
  11204. var config = com_ibm_rave_core_Configuration.INSTANCE;
  11205. var nodeFactory;
  11206. nodeFactory = config.getSceneNodeFactory(context.rave_getQualifiedName());
  11207. if (_nsuri == null) {
  11208. _nsuri = context.rave_getNamespaceURI();
  11209. }
  11210. if (!nodeFactory) {
  11211. nodeFactory = config.getSceneNodeFactory(_nsuri);
  11212. }
  11213. return nodeFactory(_nsuri, name, context);
  11214. };
  11215. /**
  11216. * Register a selector extension factory.
  11217. * @param (String) id extension identifier
  11218. * @param (com.ibm.rave.core.ExtensionFactory) extensionFactory The selector extension factory
  11219. * @return (boolean) true, if the registration was successful, false otherwise
  11220. */
  11221. com_ibm_rave_core_selector_Selector.extension$1 = function(id, extensionFactory) {
  11222. return com_ibm_rave_core_selector_Selector.getSelectorDelegateRegistry().extension$1(id, extensionFactory);
  11223. };
  11224. /** @expose */
  11225. com_ibm_rave_core_selector_Selector.extension = function(a0, a1) {
  11226. var args = arguments;
  11227. return com_ibm_rave_core_selector_Selector.extension$1(a0, a1);
  11228. };
  11229. com_ibm_rave_core_selector_Selector.SelectorRegistryService = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_RegistryService, {
  11230. /** @expose */
  11231. getServiceId : function() {
  11232. return "Selector";
  11233. }
  11234. });
  11235. com_ibm_rave_core_selector_Selector.SELECTOR_DELEGATE_REGISTRY_KEY = "SELECTOR_DELEGATE_REGISTRY_KEY";
  11236. com_ibm_rave_core_selector_Selector.factory = function() {
  11237. return new com_ibm_rave_core_selector_Selector();
  11238. };
  11239. // $source: com/ibm/rave/core/selector/EnterSelector
  11240. /************************************************************************
  11241. ** IBM Confidential
  11242. **
  11243. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  11244. **
  11245. ** (C) Copyright IBM Corp. 2017
  11246. **
  11247. ** The source code for this program is not published or otherwise divested of its trade secrets,
  11248. ** irrespective of what has been deposited with the U.S. Copyright Office.
  11249. ************************************************************************/
  11250. // GENERATED
  11251. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  11252. //@import com/ibm/rave/core/selector/Selector (loadtime) // superclass
  11253. var com_ibm_rave_core_selector_EnterSelector = rave_externs["EnterSelector"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_selector_Selector, {
  11254. //factory : null,
  11255. setSelectorFactory : function(factory) {
  11256. this.factory = factory;
  11257. return this;
  11258. },
  11259. insert$0 : function(type) {
  11260. return this.insert$5(type, com_ibm_rave_core_selector_EnterSelector.enterInsertBefore(this));
  11261. },
  11262. insert$1 : function(type) {
  11263. return this.insert$3(type, com_ibm_rave_core_selector_EnterSelector.enterInsertBefore(this));
  11264. },
  11265. /** @expose */
  11266. select$1 : function(valueFunction) {
  11267. var subgroups = this.factory();
  11268. var subgroup;
  11269. var subnode;
  11270. var group;
  11271. var upgroup;
  11272. var node;
  11273. for (var j = 0, m = this.length; j < m; ++j) {
  11274. group = this[j];
  11275. upgroup = group["update"];
  11276. subgroup = [];
  11277. subgroups.push(subgroup);
  11278. subgroup["parentNode"] = group["parentNode"];
  11279. for (var i = 0, n = group.length; i < n; ++i) {
  11280. if ((node = group[i])) {
  11281. subgroup.push(subnode = valueFunction.call(group["parentNode"], node.rave_getData(), i, j));
  11282. upgroup[i] = subnode;
  11283. subnode.rave_setData(node.rave_getData());
  11284. } else {
  11285. subgroup.push(null);
  11286. }
  11287. }
  11288. }
  11289. return subgroups;
  11290. },
  11291. /** @expose */
  11292. insert : function(a0) {
  11293. var args = arguments;
  11294. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  11295. return this.insert$0(a0);
  11296. }
  11297. if (args.length == 1 && typeof a0 === "function") {
  11298. return this.insert$1(a0);
  11299. }
  11300. return com_ibm_rave_core_selector_Selector.prototype.insert.apply(this, args);
  11301. }
  11302. });
  11303. com_ibm_rave_core_selector_EnterSelector.enterInsertBefore = function(enter) {
  11304. var i0, j0;
  11305. return function(d, i, j) {
  11306. var group = enter[j]["update"];
  11307. var n = group.length;
  11308. var node = null;
  11309. if (j != j0) {
  11310. j0 = j;
  11311. i0 = 0;
  11312. }
  11313. if (i >= i0) {
  11314. i0 = i + 1;
  11315. }
  11316. for (var k = i0; k < n; ++k) {
  11317. if ((node = group[k])) {
  11318. break;
  11319. }
  11320. }
  11321. return node;
  11322. };
  11323. };
  11324. // $source: com/ibm/rave/core/internal/nativeImpl/PlatformInitialization
  11325. /************************************************************************
  11326. ** IBM Confidential
  11327. **
  11328. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  11329. **
  11330. ** (C) Copyright IBM Corp. 2014
  11331. **
  11332. ** The source code for this program is not published or otherwise divested of its trade secrets,
  11333. ** irrespective of what has been deposited with the U.S. Copyright Office.
  11334. ************************************************************************/
  11335. // @import ./scene/DOMSceneNode (static)
  11336. // @import ./selector/DOMSelectionQueryEngine (static)
  11337. // @import com/ibm/rave/core/Configuration (static)
  11338. // @import com/ibm/rave/core/selector/Selector (static)
  11339. var com_ibm_rave_core_internal_nativeImpl_PlatformInitialization = function() {
  11340. var config = com_ibm_rave_core_Configuration.INSTANCE;
  11341. var domFactory = function(nsuri, name, context) {
  11342. var doc = context.ownerDocument || context.rave_getOwner().ownerDocument;
  11343. return nsuri ? doc.createElementNS(nsuri, name) : doc.createElement(name);
  11344. };
  11345. config.setSceneNodeFactory(null, domFactory);
  11346. config.setSceneNodeFactory("http://www.w3.org/1999/xhtml", domFactory);
  11347. config.setSceneNodeFactory("http://www.w3.org/2000/svg", domFactory);
  11348. // Query Engines
  11349. var domQueryEngine = new com_ibm_rave_core_internal_nativeImpl_selector_DOMSelectionQueryEngine();
  11350. config.setQueryEngine(null, domQueryEngine);
  11351. config.setQueryEngine("http://www.w3.org/1999/xhtml", domQueryEngine);
  11352. config.setQueryEngine("http://www.w3.org/2000/svg", domQueryEngine);
  11353. // This is an optimization to reduce skip factory lookup if only the domFactory is present.
  11354. var oriCreateSceneNode = com_ibm_rave_core_selector_Selector.createSceneNode;
  11355. com_ibm_rave_core_selector_Selector.createSceneNode = function(nsuri, name, context) {
  11356. var node = domFactory(nsuri == null ? context.namespaceURI : nsuri, name, context);
  11357. if (config.nodeExtensions) {
  11358. config.extend(node, context)
  11359. }
  11360. return node;
  11361. };
  11362. var oriSetSceneNodeFactory = com_ibm_rave_core_Configuration.prototype.setSceneNodeFactory;
  11363. com_ibm_rave_core_Configuration.prototype.setSceneNodeFactory = function(namespaceUri, factory) {
  11364. oriSetSceneNodeFactory.call(this, namespaceUri, factory);
  11365. if (factory != domFactory) {
  11366. com_ibm_rave_core_selector_Selector.createSceneNode = oriCreateSceneNode;
  11367. com_ibm_rave_core_Configuration.prototype.setSceneNodeFactory = oriSetSceneNodeFactory;
  11368. }
  11369. }
  11370. };
  11371. com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getWindow = rave_window;
  11372. com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocumentElement = rave_documentElement;
  11373. com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocument = function() {
  11374. return rave_document;
  11375. };
  11376. com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocumentBodyElement = function() {
  11377. return rave_document.body;
  11378. };
  11379. // $source: com/ibm/rave/core/transition/Transition
  11380. /************************************************************************
  11381. ** IBM Confidential
  11382. **
  11383. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  11384. **
  11385. ** (C) Copyright IBM Corp. 2017
  11386. **
  11387. ** The source code for this program is not published or otherwise divested of its trade secrets,
  11388. ** irrespective of what has been deposited with the U.S. Copyright Office.
  11389. ************************************************************************/
  11390. // GENERATED
  11391. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  11392. //@import com/ibm/rave/core/selector/Selection (loadtime) // superclass
  11393. //@import com/ibm/rave/core/transition/TransitionCollector (static) // removeTransition, addTransition
  11394. //@import com/ibm/rave/core/internal/transitions/Tweener (runtime) // schedule
  11395. //@import com/ibm/rave/core/internal/transitions/TransitionUtil (runtime) // transitionNamespace, getTransitionInfo, getTransitionTracker
  11396. //@import com/ibm/rave/core/internal/selector/SelectorHelper (runtime) // selectorAll, selector, each
  11397. //@import com/ibm/rave/core/ease/Easing (runtime) // Easing
  11398. //@import com/ibm/rave/core/internal/util/NamespaceUtil (runtime) // getQName
  11399. //@import com/ibm/rave/core/internal/transitions/TweenFunctions (runtime) // tween, attrTween, style, styleTween, attr
  11400. //@import com/ibm/rave/core/internal/nativeImpl/transitions/InheritedTransition (static) // set, get
  11401. //@import com/ibm/rave/core/internal/util/QueryUtil (runtime) // getQueryEngine
  11402. //@import com/ibm/rave/core/context/RaveContextManager (static) // RaveContextManager
  11403. //@import com/ibm/rave/core/selector/Selector (static) // new
  11404. //@import com/ibm/rave/core/internal/nativeImpl/PlatformInitialization (static) // getDocument, getDocumentElement
  11405. /**
  11406. * 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()} .
  11407. */
  11408. var com_ibm_rave_core_transition_Transition = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_selector_Selection, {
  11409. //_endedCallback : null,
  11410. /**
  11411. * @expose
  11412. */
  11413. //namespace : null,
  11414. /**
  11415. * @expose
  11416. */
  11417. id : 0,
  11418. /**
  11419. * Get the integer ID of this transition.
  11420. * @return (int) the transition ID
  11421. */
  11422. /** @expose */
  11423. getId : function() {
  11424. return this.id;
  11425. },
  11426. /**
  11427. * Get the String name of this transition.
  11428. * @return (String) the transition name
  11429. */
  11430. /** @expose */
  11431. getNamespace : function() {
  11432. return this.namespace;
  11433. },
  11434. /**
  11435. * Construct a new transition.
  11436. * @param (int) id the assigned transition ID
  11437. * @param (String) transitionNamespace the transition name
  11438. */
  11439. constructor : function(id, transitionNamespace) {
  11440. this.namespace = transitionNamespace;
  11441. this.id = id;
  11442. com_ibm_rave_core_transition_TransitionCollector.addTransition(this);
  11443. com_ibm_rave_core_internal_transitions_Tweener.schedule(this);
  11444. },
  11445. /**
  11446. * 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.
  11447. * @return (double) the delay in milliseconds
  11448. */
  11449. delay$0 : function() {
  11450. var node = this.node();
  11451. return node ? com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(node, this.namespace, this.id).delay : 0;
  11452. },
  11453. /**
  11454. * Specifies the transition delay in milliseconds as a constant.
  11455. * @param (Object) delay the transition delay in milliseconds
  11456. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  11457. */
  11458. delay$1 : function(delay) {
  11459. var d = + (delay);
  11460. var transitionId = this.id;
  11461. var transitionNamespace = this.namespace;
  11462. return com_ibm_rave_core_internal_selector_SelectorHelper.each(this, function(data, index, groupIndex) {
  11463. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(this, transitionNamespace, transitionId).delay = d;
  11464. });
  11465. },
  11466. /**
  11467. * 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.
  11468. * @param (com.ibm.rave.core.selector.ValueFunction) delayFunction the delay function to evaluate for each selected element
  11469. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  11470. */
  11471. delay$2 : function(delayFunction) {
  11472. var transitionId = this.id;
  11473. var transitionNamespace = this.namespace;
  11474. return com_ibm_rave_core_internal_selector_SelectorHelper.each(this, function(data, index, groupIndex) {
  11475. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(this, transitionNamespace, transitionId).delay = + (delayFunction.call(this, this.rave_getData(), index, groupIndex));
  11476. });
  11477. },
  11478. /**
  11479. * 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.
  11480. * @return (double) the delay in milliseconds
  11481. */
  11482. duration$0 : function() {
  11483. var node = this.node();
  11484. return node ? com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(node, this.namespace, this.id).duration : 250;
  11485. },
  11486. /**
  11487. * Specifies the transition duration in milliseconds as a constant.
  11488. * @param (Object) duration the transition duration in milliseconds
  11489. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  11490. */
  11491. duration$1 : function(duration) {
  11492. var transitionId = this.id;
  11493. var transitionNamespace = this.namespace;
  11494. var d = Math.max(1, + (duration));
  11495. return com_ibm_rave_core_internal_selector_SelectorHelper.each(this, function(data, index, groupIndex) {
  11496. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(this, transitionNamespace, transitionId).duration = d;
  11497. });
  11498. },
  11499. /**
  11500. * 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.
  11501. * @param (com.ibm.rave.core.selector.ValueFunction) durationFunction the duration function to evaluate for each selected element
  11502. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  11503. */
  11504. duration$2 : function(durationFunction) {
  11505. var transitionId = this.id;
  11506. var transitionNamespace = this.namespace;
  11507. return com_ibm_rave_core_internal_selector_SelectorHelper.each(this, function(data, index, groupIndex) {
  11508. var d = + (durationFunction.call(this, data, index, groupIndex));
  11509. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(this, transitionNamespace, transitionId).duration = Math.max(1, d);
  11510. });
  11511. },
  11512. /**
  11513. * 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'.
  11514. * @return (com.ibm.rave.core.ease.EasingFunction) an {@link (com.ibm.rave.core.ease.EasingFunction) EasingFunction}
  11515. */
  11516. ease$0 : function() {
  11517. var node = this.node();
  11518. return node ? com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(node, this.namespace, this.id).ease : com_ibm_rave_core_ease_Easing.DEFAULT;
  11519. },
  11520. /**
  11521. * 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} .
  11522. * @param (String) name the easing function name
  11523. * @param (java.lang.Object[]) args the easing function arguments
  11524. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  11525. */
  11526. ease$1 : function(name, args) {
  11527. if (args !== null || arguments.length > 2){
  11528. args = Array.prototype.slice.call(arguments, 1);
  11529. }
  11530. {
  11531. return this.ease$2(com_ibm_rave_core_ease_Easing.INSTANCE.apply(com_ibm_rave_core_ease_Easing.INSTANCE, [name].concat(args)));
  11532. }
  11533. },
  11534. /**
  11535. * 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.
  11536. * @param (com.ibm.rave.core.ease.EasingFunction) easeFunction the easing function
  11537. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  11538. */
  11539. ease$2 : function(easeFunction) {
  11540. var transitionId = this.id;
  11541. var transitionNamespace = this.namespace;
  11542. return com_ibm_rave_core_internal_selector_SelectorHelper.each(this, function(data, index, groupIndex) {
  11543. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(this, transitionNamespace, transitionId).ease = easeFunction;
  11544. });
  11545. },
  11546. /**
  11547. * 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.
  11548. * @param (String) attribute the named attribute to tween
  11549. * @param (Object) value the attribute value as a constant or {@link (com.ibm.rave.core.selector.ValueFunction) ValueFunction}
  11550. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  11551. */
  11552. attr$1 : function(attribute, value) {
  11553. var qname = com_ibm_rave_core_internal_util_NamespaceUtil.getQName(attribute);
  11554. return com_ibm_rave_core_internal_transitions_TweenFunctions.tween(this, "attr." + attribute, value, function(v) {
  11555. return com_ibm_rave_core_internal_transitions_TweenFunctions.attr(qname, v);
  11556. });
  11557. },
  11558. /**
  11559. * Convenience method for specifying an attr transition where the value is a function which is evaluated for each selected element.
  11560. * @param (String) attribute the named attribute to tween
  11561. * @param (com.ibm.rave.core.selector.ValueFunction) value the attribute value as a {@link (com.ibm.rave.core.selector.ValueFunction) ValueFunction}
  11562. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  11563. * @see #this.attr(String, Object)
  11564. */
  11565. attr$2 : function(attribute, value) {
  11566. return this.attr$1(attribute, value);
  11567. },
  11568. /**
  11569. * 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.
  11570. * @param (String) attribute the named attribute to tween
  11571. * @param (com.ibm.rave.core.transition.TransitionInterpolatorFactory) factory a factory function which returns an interpolator
  11572. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  11573. */
  11574. /** @expose */
  11575. attrTween : function(attribute, factory) {
  11576. var qname = com_ibm_rave_core_internal_util_NamespaceUtil.getQName(attribute);
  11577. return this.tween("attr." + attribute, com_ibm_rave_core_internal_transitions_TweenFunctions.attrTween(qname, factory));
  11578. },
  11579. /**
  11580. * 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.
  11581. * @param (Object) value the text content value as a constant or a {@link (com.ibm.rave.core.selector.ValueFunction) ValueFunction}
  11582. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  11583. */
  11584. text$0 : function(value) {
  11585. return com_ibm_rave_core_internal_transitions_TweenFunctions.tween(this, "text", value, function(v) {
  11586. var textValue = (v == null ? "" : v + "");
  11587. return function(data, index, groupIndex) {
  11588. this.rave_setText(textValue);
  11589. return null;
  11590. };
  11591. });
  11592. },
  11593. /**
  11594. * Convenience method for specifying a text transition where the value is a function which is evaluated for each selected element.
  11595. * @param (com.ibm.rave.core.selector.ValueFunction) value the text content value as a {@link (com.ibm.rave.core.selector.ValueFunction) ValueFunction}
  11596. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  11597. * @see #this.text(Object)
  11598. */
  11599. text$1 : function(value) {
  11600. return this.text$0(value);
  11601. },
  11602. /**
  11603. * Same as {@link #this.style(String, Object, String)} with a null priority.
  11604. * @param (String) styleName the named style to tween
  11605. * @param (Object) value the style value as a constant or {@link (com.ibm.rave.core.selector.ValueFunction) ValueFunction}
  11606. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  11607. */
  11608. style$2 : function(styleName, value) {
  11609. return this.style$4(styleName, value, null);
  11610. },
  11611. /**
  11612. * 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.
  11613. * @param (String) styleName the named style to tween
  11614. * @param (Object) value the style value as a constant or {@link (com.ibm.rave.core.selector.ValueFunction) ValueFunction}
  11615. * @param (String) priority either null or the string "important"
  11616. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  11617. */
  11618. style$4 : function(styleName, value, priority) {
  11619. var p = priority != null ? priority : "";
  11620. return com_ibm_rave_core_internal_transitions_TweenFunctions.tween(this, "style." + styleName, value, function(v) {
  11621. return com_ibm_rave_core_internal_transitions_TweenFunctions.style(styleName, v, p);
  11622. });
  11623. },
  11624. /**
  11625. * Convenience method for specifying a style transition where the value is a function which is evaluated for each selected element.
  11626. * @param (String) attribute the named style to tween
  11627. * @param (com.ibm.rave.core.selector.ValueFunction) value the style value as a {@link (com.ibm.rave.core.selector.ValueFunction) ValueFunction}
  11628. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  11629. * @see #this.style(String, Object)
  11630. */
  11631. style$3 : function(attribute, value) {
  11632. return this.style$4(attribute, value, null);
  11633. },
  11634. /**
  11635. * Convenience method for specifying a style transition where the value is a function which is evaluated for each selected element.
  11636. * @param (String) attribute the named style to tween
  11637. * @param (com.ibm.rave.core.selector.ValueFunction) value the style value as a {@link (com.ibm.rave.core.selector.ValueFunction) ValueFunction}
  11638. * @param (String) priority either null or the string "important"
  11639. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  11640. * @see #this.style(String, Object, String)
  11641. */
  11642. style$5 : function(attribute, value, priority) {
  11643. return this.style$4(attribute, value, priority);
  11644. },
  11645. /**
  11646. * Same as {@link #this.styleTween(String, com_ibm_rave_core_transition_TransitionInterpolatorFactory, String)} with a null priority.
  11647. * @param (String) styleName the named style to tween
  11648. * @param (com.ibm.rave.core.transition.TransitionInterpolatorFactory) factory a factory function which returns an interpolator
  11649. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  11650. */
  11651. styleTween$0 : function(styleName, factory) {
  11652. return this.styleTween$1(styleName, factory, null);
  11653. },
  11654. /**
  11655. * 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.
  11656. * @param (String) styleName the named style to tween
  11657. * @param (com.ibm.rave.core.transition.TransitionInterpolatorFactory) factory a factory function which returns an interpolator
  11658. * @param (String) priority either null or the string "important"
  11659. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  11660. */
  11661. styleTween$1 : function(styleName, factory, priority) {
  11662. return this.tween("style." + styleName, com_ibm_rave_core_internal_transitions_TweenFunctions.styleTween(styleName, factory, priority != null ? priority : ""));
  11663. },
  11664. /**
  11665. * 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.
  11666. * @param (String) name the tween name
  11667. * @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
  11668. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  11669. */
  11670. tween$0 : function(name, factory) {
  11671. var transitionId = this.id;
  11672. var transitionName = this.namespace;
  11673. return com_ibm_rave_core_internal_selector_SelectorHelper.each(this, !factory ? function(data, index, groupIndex) {
  11674. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(this, transitionName, transitionId).removeTweenFactory(name);
  11675. } : function(data, index, groupIndex) {
  11676. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(this, transitionName, transitionId).addTweenFactory(name, factory);
  11677. });
  11678. },
  11679. /**
  11680. * 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.
  11681. * @param (String) tweenName the tween name
  11682. * @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>
  11683. */
  11684. tween$1 : function(tweenName) {
  11685. var node = this.node();
  11686. return node ? com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(node, this.namespace, this.id).getTweenFactory(tweenName) : null;
  11687. },
  11688. /**
  11689. * 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.
  11690. * @param (com.ibm.rave.core.selector.CallbackFunction) callback the callback function
  11691. */
  11692. each$0 : function(callback) {
  11693. var transitionId = this.id;
  11694. var transitionNamespace = this.namespace;
  11695. var inherit = com_ibm_rave_core_internal_nativeImpl_transitions_InheritedTransition.get();
  11696. try {
  11697. return com_ibm_rave_core_internal_selector_SelectorHelper.each(this, function(data, index, groupIndex) {
  11698. var info = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(this, transitionNamespace, transitionId);
  11699. com_ibm_rave_core_internal_nativeImpl_transitions_InheritedTransition.set(info);
  11700. callback.call(this, data, index, groupIndex);
  11701. });
  11702. } finally {
  11703. com_ibm_rave_core_internal_nativeImpl_transitions_InheritedTransition.set(inherit);
  11704. }
  11705. },
  11706. /**
  11707. * 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.
  11708. * @param (String) type the event type
  11709. * @param (com.ibm.rave.core.selector.RunFunction) listener the event listener
  11710. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  11711. */
  11712. each$1 : function(type, listener) {
  11713. var transitionId = this.id;
  11714. var transitionNamespace = this.namespace;
  11715. return com_ibm_rave_core_internal_selector_SelectorHelper.each(this, function(data, index, groupIndex) {
  11716. com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(this, transitionNamespace, transitionId).getOrCreateDispatcher().on(type, listener);
  11717. });
  11718. },
  11719. /**
  11720. * 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.
  11721. * @return (com.ibm.rave.core.transition.Transition) this {@link (com.ibm.rave.core.transition.Transition) Transition}
  11722. */
  11723. /** @expose */
  11724. remove : function() {
  11725. var transitionNamespace = this.namespace;
  11726. return this.each("end.transition", function(args) {
  11727. if (args !== null || arguments.length > 1){
  11728. args = Array.prototype.slice.call(arguments, 0);
  11729. }
  11730. {
  11731. var p = this.rave_getParentNode();
  11732. var t = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionTracker(this, transitionNamespace);
  11733. if (t.count < 2 && p) {
  11734. p.removeChild(this);
  11735. }
  11736. return null;
  11737. }
  11738. });
  11739. },
  11740. /**
  11741. * 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.
  11742. * @param (com.ibm.rave.core.selector.RunFunction) callback the callback function
  11743. * @param (java.lang.Object[]) args the array of arguments
  11744. * @return (com.ibm.rave.core.transition.Transition) this instance of transition
  11745. */
  11746. /** @expose */
  11747. call : function(callback, args) {
  11748. if (args !== null || arguments.length > 2){
  11749. args = Array.prototype.slice.call(arguments, 1);
  11750. }
  11751. {
  11752. var list = (args);
  11753. list.splice(0, 0, this);
  11754. callback.apply(this, list);
  11755. return this;
  11756. }
  11757. },
  11758. /**
  11759. * 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.
  11760. * @return (com.ibm.rave.core.transition.Transition) a new {@link (com.ibm.rave.core.transition.Transition) Transition} .
  11761. */
  11762. transition$0 : function() {
  11763. var parentId = this.id;
  11764. var transitionIdCount = com_ibm_rave_core_transition_Transition.getTransitionIdCount();
  11765. var newId = ++transitionIdCount.idCount;
  11766. var ns = this.namespace;
  11767. var subgroups = new com_ibm_rave_core_transition_Transition(newId, ns);
  11768. var subgroup;
  11769. var group;
  11770. var node;
  11771. for (var j = 0, m = this.length; j < m; ++j) {
  11772. group = this[j];
  11773. subgroup = [];
  11774. subgroups.push(subgroup);
  11775. for (var i = 0, n = group.length; i < n; ++i) {
  11776. if ((node = group[i])) {
  11777. var info = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(node, ns, newId);
  11778. var trans = info._transition;
  11779. if (trans && trans != subgroups) {
  11780. com_ibm_rave_core_transition_TransitionCollector.removeTransition(trans);
  11781. }
  11782. info._transition = subgroups;
  11783. info.index = i;
  11784. info.groupIndex = j;
  11785. var pinfo = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(node, ns, parentId);
  11786. info.delay = pinfo.delay + pinfo.duration;
  11787. info.duration = pinfo.duration;
  11788. info.ease = pinfo.ease;
  11789. info.time = pinfo.time;
  11790. }
  11791. subgroup.push(node);
  11792. }
  11793. }
  11794. return subgroups;
  11795. },
  11796. /**
  11797. * 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.
  11798. * @param (String) transitionNamespace ignored
  11799. * @return (com.ibm.rave.core.transition.Transition) a new {@link (com.ibm.rave.core.transition.Transition) Transition} .
  11800. */
  11801. transition$1 : function(transitionNamespace) {
  11802. return this.transition$0();
  11803. },
  11804. /** @expose */
  11805. isTransition : function() {
  11806. return true;
  11807. },
  11808. /**
  11809. * Like {@link #this.select(com_ibm_rave_core_selector_ValueFunction)} using a string to specify a selector query.
  11810. */
  11811. select$0 : function(query) {
  11812. return this.select$1(com_ibm_rave_core_internal_selector_SelectorHelper.selector(query));
  11813. },
  11814. /**
  11815. * 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.
  11816. */
  11817. select$1 : function(valueFunction) {
  11818. var subgroups = new com_ibm_rave_core_transition_Transition(this.id, this.namespace);
  11819. var subgroup;
  11820. var subnode;
  11821. var group;
  11822. var node;
  11823. for (var j = 0, m = this.length; j < m; ++j) {
  11824. group = this[j];
  11825. subgroup = [];
  11826. subgroups.push(subgroup);
  11827. for (var i = 0, n = group.length; i < n; ++i) {
  11828. if ((node = group[i])) {
  11829. subgroup.push(subnode = valueFunction.call(node, node.rave_getData(), i, j));
  11830. if (subnode) {
  11831. if (node.rave_hasData()) {
  11832. subnode.rave_setData(node.rave_getData());
  11833. }
  11834. var inherit = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(node, this.namespace, this.id);
  11835. var info = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(subnode, this.namespace, this.id);
  11836. var trans = info._transition;
  11837. if (trans && trans != subgroups) {
  11838. com_ibm_rave_core_transition_TransitionCollector.removeTransition(trans);
  11839. }
  11840. info._transition = subgroups;
  11841. info.index = i;
  11842. info.groupIndex = j;
  11843. info.delay = inherit.delay;
  11844. info.duration = inherit.duration;
  11845. info.ease = inherit.ease;
  11846. }
  11847. } else {
  11848. subgroup.push(null);
  11849. }
  11850. }
  11851. }
  11852. return subgroups;
  11853. },
  11854. /**
  11855. * Like {@link #this.selectAll(com_ibm_rave_core_selector_ValueFunction)} using a string to specify a selector query.
  11856. */
  11857. selectAll$0 : function(query) {
  11858. return this.selectAll$1(com_ibm_rave_core_internal_selector_SelectorHelper.selectorAll(query));
  11859. },
  11860. /**
  11861. * 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.
  11862. * @return (com.ibm.rave.core.transition.Transition) a new {@link (com.ibm.rave.core.transition.Transition) Transition}
  11863. */
  11864. selectAll$1 : function(selector) {
  11865. var subgroups = new com_ibm_rave_core_transition_Transition(this.id, this.namespace);
  11866. var subgroup;
  11867. var group;
  11868. var node, subnode;
  11869. var subnodes;
  11870. for (var j = 0, m = this.length; j < m; ++j) {
  11871. group = this[j];
  11872. for (var i = 0, n = group.length; i < n; ++i) {
  11873. if ((node = group[i])) {
  11874. subgroup = [];
  11875. subnodes = selector.call(node, node.rave_getData(), i, j);
  11876. subgroups.push(subgroup);
  11877. var inherit = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(node, this.namespace, this.id);
  11878. for (var k = 0, o = subnodes.length; k < o; ++k) {
  11879. subnode = subnodes[k];
  11880. if (subnode) {
  11881. var info = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(subnode, this.namespace, this.id);
  11882. var trans = info._transition;
  11883. if (trans && trans != subgroups) {
  11884. com_ibm_rave_core_transition_TransitionCollector.removeTransition(trans);
  11885. }
  11886. info._transition = subgroups;
  11887. info.index = k;
  11888. info.groupIndex = i;
  11889. info.delay = inherit.delay;
  11890. info.duration = inherit.duration;
  11891. info.ease = inherit.ease;
  11892. }
  11893. subgroup.push(subnode);
  11894. }
  11895. }
  11896. }
  11897. }
  11898. return subgroups;
  11899. },
  11900. /**
  11901. * Like {@link #this.filter(com_ibm_rave_core_selector_ValueFunction)} using a string to specify a selector query.
  11902. */
  11903. filter$1 : function(filter) {
  11904. return this.filter$0(function(data, index, groupIndex) {
  11905. return com_ibm_rave_core_internal_util_QueryUtil.getQueryEngine(this).matches(this, filter);
  11906. });
  11907. },
  11908. /**
  11909. * 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.
  11910. * @param (com.ibm.rave.core.selector.ValueFunction) filterFunction the filter function
  11911. * @return (com.ibm.rave.core.transition.Transition) a new {@link (com.ibm.rave.core.transition.Transition) Transition} subset of the current transition
  11912. */
  11913. filter$0 : function(filterFunction) {
  11914. var subgroups = new com_ibm_rave_core_transition_Transition(this.id, this.namespace);
  11915. var subgroup;
  11916. var group;
  11917. var node;
  11918. for (var j = 0, m = this.length; j < m; ++j) {
  11919. subgroup = [];
  11920. subgroups.push(subgroup);
  11921. group = this[j];
  11922. for (var i = 0, n = group.length; i < n; ++i) {
  11923. node = group[i];
  11924. if (node && filterFunction.call(node, node.rave_getData(), i, j)) {
  11925. subgroup.push(node);
  11926. }
  11927. }
  11928. }
  11929. return subgroups;
  11930. },
  11931. /**
  11932. * Checks each element in the transition to see if all contained elements are empty.
  11933. * @return (boolean) A boolean - true if Transition is empty
  11934. */
  11935. /** @expose */
  11936. isEmpty : function() {
  11937. var empty = true;
  11938. for (var i = 0; i < length; ++i) {
  11939. if ([i] && !([i].isEmpty())) {
  11940. empty = false;
  11941. break;
  11942. }
  11943. }
  11944. return empty;
  11945. },
  11946. /**
  11947. * Supplies the callback for the transition end, which allows us to track when all transitions are done.
  11948. * @param (com.ibm.rave.core.selector.RunFunction) callback a runfunction to be called when the transition is done.
  11949. */
  11950. /** @expose */
  11951. transitionEndedCallback : function(callback) {
  11952. this._endedCallback = callback;
  11953. },
  11954. /**
  11955. * Called each time a node completes a transition, or is interrupted. When the last node has finished the transition, this calls the end callback for the transition and removes the transition from the master list in the {@link (com.ibm.rave.core.transition.TransitionCollector) TransitionCollector} .
  11956. */
  11957. /** @expose */
  11958. nodeTransitionComplete : function() {
  11959. if (this._endedCallback) {
  11960. this._endedCallback.call(this);
  11961. }
  11962. },
  11963. /** @expose */
  11964. delay : function(a0) {
  11965. var args = arguments;
  11966. if (args.length == 0) {
  11967. return this.delay$0();
  11968. }
  11969. if (args.length == 1 && typeof a0 === "function") {
  11970. return this.delay$2(a0);
  11971. }
  11972. return this.delay$1(a0);
  11973. },
  11974. /** @expose */
  11975. duration : function(a0) {
  11976. var args = arguments;
  11977. if (args.length == 0) {
  11978. return this.duration$0();
  11979. }
  11980. if (args.length == 1 && typeof a0 === "function") {
  11981. return this.duration$2(a0);
  11982. }
  11983. return this.duration$1(a0);
  11984. },
  11985. /** @expose */
  11986. ease : function(a0, a1) {
  11987. var args = arguments;
  11988. if (args.length == 0) {
  11989. return this.ease$0();
  11990. }
  11991. if (args.length == 1 && typeof a0 === "function") {
  11992. return this.ease$2(a0);
  11993. }
  11994. return this.ease$1.apply(this, args);
  11995. },
  11996. /** @expose */
  11997. attr : function(a0, a1) {
  11998. var args = arguments;
  11999. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  12000. return this.attr$2(a0, a1);
  12001. }
  12002. if (args.length == 2 && (a0 == null || typeof a0 === "string") && (a1 == null || Object.prototype.toString.call(a1) !== "[object Array]")) {
  12003. return this.attr$1(a0, a1);
  12004. }
  12005. return com_ibm_rave_core_selector_Selection.prototype.attr.apply(this, args);
  12006. },
  12007. /** @expose */
  12008. text : function(a0) {
  12009. var args = arguments;
  12010. if (args.length == 1 && typeof a0 === "function") {
  12011. return this.text$1(a0);
  12012. }
  12013. return this.text$0(a0);
  12014. },
  12015. /** @expose */
  12016. style : function(a0, a1, a2) {
  12017. var args = arguments;
  12018. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  12019. return this.style$3(a0, a1);
  12020. }
  12021. if (args.length == 2 && (a0 == null || typeof a0 === "string") && (a1 == null || Object.prototype.toString.call(a1) !== "[object Array]")) {
  12022. return this.style$2(a0, a1);
  12023. }
  12024. if (args.length == 3 && (a0 == null || typeof a0 === "string") && typeof a1 === "function" && (a2 == null || typeof a2 === "string")) {
  12025. return this.style$5(a0, a1, a2);
  12026. }
  12027. if (args.length == 3 && (a0 == null || typeof a0 === "string") && (a1 == null || Object.prototype.toString.call(a1) !== "[object Array]") && (a2 == null || typeof a2 === "string")) {
  12028. return this.style$4(a0, a1, a2);
  12029. }
  12030. return com_ibm_rave_core_selector_Selection.prototype.style.apply(this, args);
  12031. },
  12032. /** @expose */
  12033. styleTween : function(a0, a1, a2) {
  12034. var args = arguments;
  12035. if (args.length == 2) {
  12036. return this.styleTween$0(a0, a1);
  12037. }
  12038. return this.styleTween$1(a0, a1, a2);
  12039. },
  12040. /** @expose */
  12041. tween : function(a0, a1) {
  12042. var args = arguments;
  12043. if (args.length == 1) {
  12044. return this.tween$1(a0);
  12045. }
  12046. return this.tween$0(a0, a1);
  12047. },
  12048. /** @expose */
  12049. each : function(a0, a1) {
  12050. var args = arguments;
  12051. if (args.length == 1) {
  12052. return this.each$0(a0);
  12053. }
  12054. return this.each$1(a0, a1);
  12055. },
  12056. /** @expose */
  12057. transition : function(a0) {
  12058. var args = arguments;
  12059. if (args.length == 0) {
  12060. return this.transition$0();
  12061. }
  12062. return this.transition$1(a0);
  12063. },
  12064. /** @expose */
  12065. select : function(a0) {
  12066. var args = arguments;
  12067. if (args.length == 1 && typeof a0 === "function") {
  12068. return this.select$1(a0);
  12069. }
  12070. return this.select$0(a0);
  12071. },
  12072. /** @expose */
  12073. selectAll : function(a0) {
  12074. var args = arguments;
  12075. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  12076. return this.selectAll$0(a0);
  12077. }
  12078. return this.selectAll$1(a0);
  12079. },
  12080. /** @expose */
  12081. filter : function(a0) {
  12082. var args = arguments;
  12083. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  12084. return this.filter$1(a0);
  12085. }
  12086. if (args.length == 1 && typeof a0 === "function") {
  12087. return this.filter$0(a0);
  12088. }
  12089. return Array.prototype.filter.apply(this, args);
  12090. }
  12091. });
  12092. com_ibm_rave_core_transition_Transition.getTransitionIdCount = function() {
  12093. var transitionIdCount = com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData("TRANSITION_ID_COUNT_KEY");
  12094. if (!transitionIdCount) {
  12095. transitionIdCount = new com_ibm_rave_core_transition_Transition.TransitionIdCount();
  12096. com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().putData("TRANSITION_ID_COUNT_KEY", transitionIdCount);
  12097. }
  12098. return transitionIdCount;
  12099. };
  12100. /**
  12101. * Create a transition on the top-level (documentElement) scene node.
  12102. * @return (com.ibm.rave.core.transition.Transition) A new transition on documentElement.
  12103. */
  12104. com_ibm_rave_core_transition_Transition.newTransition$0 = function() {
  12105. 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);
  12106. };
  12107. /**
  12108. * Create a transition on the top-level (documentElement) scene node.
  12109. * @param (String) name the name for the transition
  12110. * @return (com.ibm.rave.core.transition.Transition) A new transition on documentElement.
  12111. */
  12112. com_ibm_rave_core_transition_Transition.newTransition$1 = function(name) {
  12113. 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);
  12114. };
  12115. /**
  12116. * 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.
  12117. * @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}
  12118. * @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}
  12119. */
  12120. com_ibm_rave_core_transition_Transition.newTransition$2 = function(selection) {
  12121. return com_ibm_rave_core_transition_Transition.newTransition$3(selection, null);
  12122. };
  12123. /**
  12124. * 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.
  12125. * @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}
  12126. * @param (String) name the name for the transition
  12127. * @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}
  12128. */
  12129. com_ibm_rave_core_transition_Transition.newTransition$3 = function(selection, name) {
  12130. if (selection && com_ibm_rave_core_internal_nativeImpl_transitions_InheritedTransition.get()) {
  12131. return selection.transition(name);
  12132. }
  12133. return selection;
  12134. };
  12135. /**
  12136. * Creates a {@link (com.ibm.rave.core.transition.Transition) Transition} for the given selector.
  12137. * @param (com.ibm.rave.core.selector.Selector) selector the selector to transition
  12138. * @param (String) name the name for the transition
  12139. * @return (com.ibm.rave.core.transition.Transition) a {@link (com.ibm.rave.core.transition.Transition) Transition} containing the same nodes as the given selector
  12140. */
  12141. com_ibm_rave_core_transition_Transition.create$0 = function(selector, name) {
  12142. var transitionIdCount = com_ibm_rave_core_transition_Transition.getTransitionIdCount();
  12143. var id = ++transitionIdCount.idCount;
  12144. var namespace = com_ibm_rave_core_internal_transitions_TransitionUtil.transitionNamespace(name);
  12145. var subgroups = new com_ibm_rave_core_transition_Transition(id, namespace);
  12146. var subgroup;
  12147. var group;
  12148. var node;
  12149. for (var j = 0, m = selector.length; j < m; ++j) {
  12150. group = selector[j];
  12151. subgroup = [];
  12152. subgroups.push(subgroup);
  12153. for (var i = 0, n = group.length; i < n; ++i) {
  12154. if ((node = group[i])) {
  12155. var info = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(node, namespace, id);
  12156. var trans = info._transition;
  12157. if (trans && trans != subgroups) {
  12158. com_ibm_rave_core_transition_TransitionCollector.removeTransition(trans);
  12159. }
  12160. info._transition = subgroups;
  12161. info.index = i;
  12162. info.groupIndex = j;
  12163. }
  12164. subgroup.push(node);
  12165. }
  12166. }
  12167. return subgroups;
  12168. };
  12169. /**
  12170. * 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.
  12171. * @param (com.ibm.rave.core.selector.Selector) selector the selector to transition
  12172. * @param (com.ibm.rave.core.internal.transitions.TransitionInfo) inherit transition properties to inherit
  12173. * @return (com.ibm.rave.core.transition.Transition) a {@link (com.ibm.rave.core.transition.Transition) Transition} containing the same nodes as the given selector
  12174. */
  12175. com_ibm_rave_core_transition_Transition.create$1 = function(selector, inherit) {
  12176. return com_ibm_rave_core_transition_Transition.create$2(selector, null, inherit);
  12177. };
  12178. /**
  12179. * 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.
  12180. * @param (com.ibm.rave.core.selector.Selector) selector the selector to transition
  12181. * @param (String) name the name for the transition
  12182. * @param (com.ibm.rave.core.internal.transitions.TransitionInfo) inherit transition properties to inherit
  12183. * @return (com.ibm.rave.core.transition.Transition) a {@link (com.ibm.rave.core.transition.Transition) Transition} containing the same nodes as the given selector
  12184. */
  12185. com_ibm_rave_core_transition_Transition.create$2 = function(selector, name, inherit) {
  12186. var namespace = com_ibm_rave_core_internal_transitions_TransitionUtil.transitionNamespace(name);
  12187. var subgroups = new com_ibm_rave_core_transition_Transition(inherit.transitionId, namespace);
  12188. var subgroup;
  12189. var group;
  12190. var node;
  12191. for (var j = 0, m = selector.length; j < m; ++j) {
  12192. group = selector[j];
  12193. subgroup = [];
  12194. subgroups.push(subgroup);
  12195. for (var i = 0, n = group.length; i < n; ++i) {
  12196. if ((node = group[i])) {
  12197. var info = com_ibm_rave_core_internal_transitions_TransitionUtil.getTransitionInfo(node, namespace, inherit.transitionId);
  12198. info.index = i;
  12199. var trans = info._transition;
  12200. if (trans && trans != subgroups) {
  12201. com_ibm_rave_core_transition_TransitionCollector.removeTransition(trans);
  12202. }
  12203. info._transition = subgroups;
  12204. info.groupIndex = j;
  12205. info.delay = inherit.delay;
  12206. info.duration = inherit.duration;
  12207. info.ease = inherit.ease;
  12208. }
  12209. subgroup.push(node);
  12210. }
  12211. }
  12212. return subgroups;
  12213. };
  12214. /** @expose */
  12215. com_ibm_rave_core_transition_Transition.newTransition = function(a0, a1) {
  12216. var args = arguments;
  12217. if (args.length == 0) {
  12218. return com_ibm_rave_core_transition_Transition.newTransition$0();
  12219. }
  12220. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  12221. return com_ibm_rave_core_transition_Transition.newTransition$1(a0);
  12222. }
  12223. if (args.length == 1) {
  12224. return com_ibm_rave_core_transition_Transition.newTransition$2(a0);
  12225. }
  12226. return com_ibm_rave_core_transition_Transition.newTransition$3(a0, a1);
  12227. };
  12228. /** @expose */
  12229. com_ibm_rave_core_transition_Transition.create = function(a0, a1, a2) {
  12230. var args = arguments;
  12231. if (args.length == 2 && (a1 == null || typeof a1 === "string")) {
  12232. return com_ibm_rave_core_transition_Transition.create$0(a0, a1);
  12233. }
  12234. if (args.length == 2) {
  12235. return com_ibm_rave_core_transition_Transition.create$1(a0, a1);
  12236. }
  12237. return com_ibm_rave_core_transition_Transition.create$2(a0, a1, a2);
  12238. };
  12239. com_ibm_rave_core_transition_Transition.TransitionIdCount = com_ibm_rave_core_nativeImpl_Declare({
  12240. idCount : 0
  12241. });
  12242. //com_ibm_rave_core_transition_Transition.TRANSITION_ID_COUNT_KEY = "TRANSITION_ID_COUNT_KEY";
  12243. //com_ibm_rave_core_transition_Transition.TEXT_PREFIX = "text";
  12244. //com_ibm_rave_core_transition_Transition.ATTR_PREFIX = "attr.";
  12245. //com_ibm_rave_core_transition_Transition.STYLE_PREFIX = "style.";
  12246. // $source: com/ibm/rave/core/internal/selector/mirror/MirroredSelector
  12247. /************************************************************************
  12248. ** IBM Confidential
  12249. **
  12250. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  12251. **
  12252. ** (C) Copyright IBM Corp. 2017
  12253. **
  12254. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12255. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12256. ************************************************************************/
  12257. // GENERATED
  12258. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  12259. //@import com/ibm/rave/core/selector/Selector (loadtime) // superclass
  12260. //@import com/ibm/rave/core/internal/selector/mirror/MirroredSceneNodeHelper (runtime) // mirrorNode
  12261. //@import com/ibm/rave/core/Rave (runtime) // Rave
  12262. //@import com/ibm/rave/core/Configuration (runtime) // Configuration
  12263. //@import com/ibm/rave/core/context/RaveContextManager (static) // RaveContextManager
  12264. //@import com/ibm/rave/core/internal/selector/mirror/MirroredSceneNodeExtension (runtime) // extend
  12265. //@import com/ibm/rave/core/internal/selector/mirror/MirrorUtil (runtime) // isGroupNode
  12266. //@import com/ibm/rave/core/internal/util/QueryUtil (runtime) // getQueryEngine
  12267. /**
  12268. * Selector returned by a call to Selector.mirror(). Handles additional mirroring functionality.
  12269. */
  12270. var com_ibm_rave_core_internal_selector_mirror_MirroredSelector = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_selector_Selector, {
  12271. /** @expose */
  12272. getSelectorFactory : function() {
  12273. return com_ibm_rave_core_internal_selector_mirror_MirroredSelector.factory;
  12274. },
  12275. /**
  12276. * Internal constructor for a selector containing mirrored objects.
  12277. */
  12278. constructor : function() {
  12279. this.needsNodeExtension = true;
  12280. },
  12281. /**
  12282. * Mirror a selector consisting of nodes (i.e. svg, "g", etc).
  12283. */
  12284. /** @expose */
  12285. mirror : function(mirror) {
  12286. this.each(function(data, index, groupIndex) {
  12287. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.mirrorNode$1(this, mirror);
  12288. });
  12289. return this;
  12290. },
  12291. /**
  12292. * Register the mirror extension for scene nodes.
  12293. * @param (com.ibm.rave.core.scene.SceneNode) node
  12294. */
  12295. register : function(node) {
  12296. var uri = node.rave_getNamespaceURI();
  12297. if ("canvas" == node.rave_getName().toLowerCase()) {
  12298. uri = "canvas";
  12299. }
  12300. var extendedNamespaces = com_ibm_rave_core_internal_selector_mirror_MirroredSelector.getExtendedNamespaces();
  12301. if (!(extendedNamespaces.hasOwnProperty(uri))) {
  12302. com_ibm_rave_core_Rave.configuration.addSceneNodeExtensionFactory(uri, com_ibm_rave_core_internal_selector_mirror_MirroredSelector.mirroringExtensionsFactory, 0);
  12303. 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);
  12304. extendedNamespaces[uri] = true;
  12305. }
  12306. return this;
  12307. }
  12308. });
  12309. com_ibm_rave_core_internal_selector_mirror_MirroredSelector.getExtendedNamespaces = function() {
  12310. var namespaces = com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData(com_ibm_rave_core_internal_selector_mirror_MirroredSelector.EXTENDED_NAMESPACES_KEY);
  12311. if (!namespaces) {
  12312. namespaces = {};
  12313. com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().putData(com_ibm_rave_core_internal_selector_mirror_MirroredSelector.EXTENDED_NAMESPACES_KEY, namespaces);
  12314. }
  12315. return namespaces;
  12316. };
  12317. com_ibm_rave_core_internal_selector_mirror_MirroredSelector.MIRROR_FILTER = "rave-mirror-filter";
  12318. com_ibm_rave_core_internal_selector_mirror_MirroredSelector.EXTENDED_NAMESPACES_KEY = "EXTENDED_NAMESPACES_KEY";
  12319. com_ibm_rave_core_internal_selector_mirror_MirroredSelector.factory = function() {
  12320. return new com_ibm_rave_core_internal_selector_mirror_MirroredSelector();
  12321. };
  12322. com_ibm_rave_core_internal_selector_mirror_MirroredSelector.mirroringExtensionsFactory = function(node, context) {
  12323. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeExtension.extend(node);
  12324. };
  12325. com_ibm_rave_core_internal_selector_mirror_MirroredSelector.filterFunction = function(item, query) {
  12326. if (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isGroupNode(item)) {
  12327. if (query != null) {
  12328. return com_ibm_rave_core_internal_util_QueryUtil.getQueryEngine(item).querySelector(query, item);
  12329. }
  12330. return null;
  12331. }
  12332. return item;
  12333. };
  12334. // $source: com/ibm/rave/core/arrays/Variance
  12335. /************************************************************************
  12336. ** IBM Confidential
  12337. **
  12338. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  12339. **
  12340. ** (C) Copyright IBM Corp. 2017
  12341. **
  12342. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12343. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12344. ************************************************************************/
  12345. // GENERATED
  12346. //@import com/ibm/rave/core/internal/math/NumberUtil (static) // toNumber
  12347. /**
  12348. * 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.
  12349. */
  12350. var com_ibm_rave_core_arrays_Variance = rave_externs["Variance"] = {
  12351. //constructor : function() {}
  12352. };
  12353. /**
  12354. * Returns the variance of the given array.
  12355. * @param (java.lang.Object[]) array the array to use to calculate the variance.
  12356. * @return (Number) the extent array
  12357. */
  12358. com_ibm_rave_core_arrays_Variance.variance$0 = function(array) {
  12359. var d, s = 0, m = 0, a;
  12360. var i = -1, j = 0;
  12361. while (++i < array.length) {
  12362. a = com_ibm_rave_core_internal_math_NumberUtil.toNumber(array[i]);
  12363. if (!(isNaN(a))) {
  12364. d = a - m;
  12365. m += d / ++j;
  12366. s += d * (a - m);
  12367. }
  12368. }
  12369. return (j > 1) ? s / (j - 1) : undefined;
  12370. };
  12371. /**
  12372. * Returns the variance of the values returned from the accessor function.
  12373. * @param (java.lang.Object[]) array the data to iterate over.
  12374. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction the accessor function to use to get the values.
  12375. * @return (Number) the variance
  12376. */
  12377. com_ibm_rave_core_arrays_Variance.variance$1 = function(array, valueFunction) {
  12378. var d, s = 0, m = 0, a;
  12379. var i = -1, j = 0;
  12380. while (++i < array.length) {
  12381. a = com_ibm_rave_core_internal_math_NumberUtil.toNumber(valueFunction.call(array, array[i], i, -1));
  12382. if (!(isNaN(a))) {
  12383. d = a - m;
  12384. m += d / ++j;
  12385. s += d * (a - m);
  12386. }
  12387. }
  12388. return (j != 0 && !(isNaN(j))) ? s / (j - 1) : undefined;
  12389. };
  12390. /** @expose */
  12391. com_ibm_rave_core_arrays_Variance.variance = function(a0, a1) {
  12392. var args = arguments;
  12393. if (args.length == 1) {
  12394. return com_ibm_rave_core_arrays_Variance.variance$0(a0);
  12395. }
  12396. return com_ibm_rave_core_arrays_Variance.variance$1(a0, a1);
  12397. };
  12398. // $source: com/ibm/rave/core/arrays/Mean
  12399. /************************************************************************
  12400. ** IBM Confidential
  12401. **
  12402. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  12403. **
  12404. ** (C) Copyright IBM Corp. 2017
  12405. **
  12406. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12407. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12408. ************************************************************************/
  12409. // GENERATED
  12410. //@import com/ibm/rave/core/internal/math/NumberUtil (static) // toNumber
  12411. /**
  12412. * 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.
  12413. */
  12414. var com_ibm_rave_core_arrays_Mean = rave_externs["Mean"] = {
  12415. //constructor : function() {}
  12416. };
  12417. /**
  12418. * Returns the mean of the given array
  12419. * @param (java.lang.Object[]) array the array to use to calculate the mean
  12420. * @return (Number) the mean value
  12421. */
  12422. com_ibm_rave_core_arrays_Mean.mean$0 = function(array) {
  12423. var s = 0;
  12424. var i = -1;
  12425. var n = array.length;
  12426. var j = n;
  12427. while (++i < n) {
  12428. var a = com_ibm_rave_core_internal_math_NumberUtil.toNumber(array[i]);
  12429. if (!(isNaN(a))) {
  12430. s += a;
  12431. } else {
  12432. j--;
  12433. }
  12434. }
  12435. return (j != 0 && !(isNaN(j))) ? s / j : undefined;
  12436. };
  12437. /**
  12438. * Returns the mean of the values returned from the accessor function
  12439. * @param (java.lang.Object[]) data the data to iterator over
  12440. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction the accessor function to use to get the value
  12441. * @return (Number) the mean value
  12442. */
  12443. com_ibm_rave_core_arrays_Mean.mean$1 = function(data, valueFunction) {
  12444. var s = 0;
  12445. var i = -1;
  12446. var n = data.length;
  12447. var j = n;
  12448. var a;
  12449. while (++i < n) {
  12450. var val = valueFunction.call(data, data[i], i, -1);
  12451. a = com_ibm_rave_core_internal_math_NumberUtil.toNumber(val);
  12452. if (!(isNaN(a))) {
  12453. s += a;
  12454. } else {
  12455. j--;
  12456. }
  12457. }
  12458. return (j != 0 && !(isNaN(j))) ? s / j : undefined;
  12459. };
  12460. /** @expose */
  12461. com_ibm_rave_core_arrays_Mean.mean = function(a0, a1) {
  12462. var args = arguments;
  12463. if (args.length == 1) {
  12464. return com_ibm_rave_core_arrays_Mean.mean$0(a0);
  12465. }
  12466. return com_ibm_rave_core_arrays_Mean.mean$1(a0, a1);
  12467. };
  12468. // $source: com/ibm/rave/core/arrays/Median
  12469. /************************************************************************
  12470. ** IBM Confidential
  12471. **
  12472. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  12473. **
  12474. ** (C) Copyright IBM Corp. 2017
  12475. **
  12476. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12477. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12478. ************************************************************************/
  12479. // GENERATED
  12480. //@import com/ibm/rave/core/internal/math/NumberUtil (static) // toNumber
  12481. //@import com/ibm/rave/core/arrays/Quantile (static) // quantile
  12482. //@import com/ibm/rave/core/arrays/Sort (static) // Sort
  12483. var com_ibm_rave_core_arrays_Median = rave_externs["Median"] = {
  12484. //constructor : function() {}
  12485. };
  12486. /**
  12487. * Returns the median of the given array.
  12488. * @param (java.lang.Object[]) array the array to use to calculate the median
  12489. * @return (Number) the median value
  12490. */
  12491. com_ibm_rave_core_arrays_Median.median$0 = function(array) {
  12492. var numbers = [];
  12493. var n = array.length;
  12494. var a;
  12495. var i = -1;
  12496. while (++i < n) {
  12497. a = com_ibm_rave_core_internal_math_NumberUtil.toNumber(array[i]);
  12498. if (!(isNaN(a))) {
  12499. numbers.push(a);
  12500. }
  12501. }
  12502. return (numbers.length > 0 ? com_ibm_rave_core_arrays_Quantile.quantile(numbers.sort(com_ibm_rave_core_arrays_Sort.ascending), .5) : undefined);
  12503. };
  12504. /**
  12505. * Returns the median of the values returned from the accessor function.
  12506. * @param (java.lang.Object[]) data the data to iterator over.
  12507. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction the accessor function to use to get the value.
  12508. * @return (Number) the median value
  12509. */
  12510. com_ibm_rave_core_arrays_Median.median$1 = function(data, valueFunction) {
  12511. var numbers = [];
  12512. var i = -1;
  12513. var n = data.length;
  12514. var a;
  12515. while (++i < n) {
  12516. var val = valueFunction.call(data, data[i], i, -1);
  12517. a = com_ibm_rave_core_internal_math_NumberUtil.toNumber(val);
  12518. if (!(isNaN(a))) {
  12519. numbers.push(a);
  12520. }
  12521. }
  12522. return (numbers.length > 0 ? com_ibm_rave_core_arrays_Quantile.quantile(numbers.sort(com_ibm_rave_core_arrays_Sort.ascending), .5) : undefined);
  12523. };
  12524. /** @expose */
  12525. com_ibm_rave_core_arrays_Median.median = function(a0, a1) {
  12526. var args = arguments;
  12527. if (args.length == 1) {
  12528. return com_ibm_rave_core_arrays_Median.median$0(a0);
  12529. }
  12530. return com_ibm_rave_core_arrays_Median.median$1(a0, a1);
  12531. };
  12532. // $source: com/ibm/rave/core/math/Random
  12533. /************************************************************************
  12534. ** IBM Confidential
  12535. **
  12536. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  12537. **
  12538. ** (C) Copyright IBM Corp. 2017
  12539. **
  12540. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12541. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12542. ************************************************************************/
  12543. // GENERATED
  12544. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  12545. //@import com/ibm/rave/core/context/RaveContextManager (runtime) // RaveContextManager
  12546. var com_ibm_rave_core_math_Random = com_ibm_rave_core_nativeImpl_Declare({
  12547. /**
  12548. * Default random() function.
  12549. */
  12550. //defaultRandomizerFunc : null,
  12551. constructor : function() {
  12552. this.defaultRandomizerFunc = function() {
  12553. return Math.random();
  12554. };
  12555. },
  12556. setRandomizerFunc : function(randomizer) {
  12557. com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().putData("RANDOMIZER_KEY", randomizer);
  12558. },
  12559. getRandomizerFunc : function() {
  12560. if (!com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext()) {
  12561. return this.defaultRandomizerFunc;
  12562. }
  12563. var randomizer = com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData("RANDOMIZER_KEY");
  12564. if (!randomizer) {
  12565. randomizer = this.defaultRandomizerFunc;
  12566. com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().putData("RANDOMIZER_KEY", randomizer);
  12567. }
  12568. return randomizer;
  12569. },
  12570. /**
  12571. * Returns a function for generating a random number between 0-1 by using the default random number generator for the running platform. For both Java and Javascript, this defaults to Math.random(). <p> May be overridden using the setter.
  12572. * @return (com.ibm.rave.core.math.Random.Randomizer) Randomizer function that will return a platform specific random number.
  12573. */
  12574. randomizer$0 : function() {
  12575. return this.getRandomizerFunc();
  12576. },
  12577. /**
  12578. * Sets the function for generating random numbers system wide. This function is used by some layouts (cloud, force) to "randomly" position shapes. Overriding this function would allow consistent positioning for these layouts. Note that this does not affect the other random generation APIs (irwinHall, Bates, etc).
  12579. * @param (com.ibm.rave.core.math.Random.Randomizer) randomizer Function to generate "random" numbers.
  12580. * @return (com.ibm.rave.core.math.Random.Randomizer) The set randomizer
  12581. */
  12582. randomizer$1 : function(randomizer) {
  12583. this.setRandomizerFunc(randomizer);
  12584. return randomizer;
  12585. },
  12586. /**
  12587. * 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.
  12588. * @return (com.ibm.rave.core.math.Random.Randomizer) a function for generating random numbers
  12589. * @see #this.normal(, )
  12590. */
  12591. normal$0 : function() {
  12592. return this.normal$2(0, 1);
  12593. },
  12594. /**
  12595. * 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.
  12596. * @param (double) mean expected value of the generated pseudorandom number
  12597. * @return (com.ibm.rave.core.math.Random.Randomizer) a function for generating random numbers
  12598. * @see #this.normal(, )
  12599. */
  12600. normal$1 : function(mean) {
  12601. return this.normal$2(mean, 1);
  12602. },
  12603. /**
  12604. * 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.
  12605. * @param (double) mean expected value of the generated pseudorandom number
  12606. * @param (double) deviation a standard deviation
  12607. * @return (com.ibm.rave.core.math.Random.Randomizer) a function for generating random numbers
  12608. */
  12609. normal$2 : function(mean, deviation) {
  12610. return function() {
  12611. var x, y, r;
  12612. do {
  12613. x = com_ibm_rave_core_math_Random.INSTANCE.getRandomizerFunc()() * 2 - 1;
  12614. y = com_ibm_rave_core_math_Random.INSTANCE.getRandomizerFunc()() * 2 - 1;
  12615. r = x * x + y * y;
  12616. } while (r == 0 || r > 1);
  12617. return mean + deviation * y * Math.sqrt(-2 * Math.log(r) / r);
  12618. };
  12619. },
  12620. /**
  12621. * 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.
  12622. * @return (com.ibm.rave.core.math.Random.Randomizer) a function for generating random numbers
  12623. * @see #this.logNormal(, )
  12624. */
  12625. logNormal$0 : function() {
  12626. return this.logNormal$2(0, 1);
  12627. },
  12628. /**
  12629. * 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.
  12630. * @param (double) mean expected value of the random variable’s natural logrithm
  12631. * @return (com.ibm.rave.core.math.Random.Randomizer) a function for generating random numbers
  12632. * @see #this.logNormal(, )
  12633. */
  12634. logNormal$1 : function(mean) {
  12635. return this.logNormal$2(mean, 1);
  12636. },
  12637. /**
  12638. * 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.
  12639. * @param (double) mean expected value of the random variable’s natural logrithm
  12640. * @param (double) deviation a standard deviation
  12641. * @return (com.ibm.rave.core.math.Random.Randomizer) a function for generating random numbers
  12642. */
  12643. logNormal$2 : function(mean, deviation) {
  12644. var random = this.normal(mean, deviation);
  12645. return function() {
  12646. return Math.exp(random());
  12647. };
  12648. },
  12649. /**
  12650. * Returns a function for generating random numbers with a <a href="http://en.wikipedia.org/wiki/Bates_distribution">Bates distribution</a>.
  12651. * @param (int) count number of independent variables
  12652. * @return (com.ibm.rave.core.math.Random.Randomizer) a function for generating random numbers
  12653. */
  12654. /** @expose */
  12655. bates : function(count) {
  12656. var random = this.irwinHall(count);
  12657. return function() {
  12658. return random() / count;
  12659. };
  12660. },
  12661. /**
  12662. * 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>.
  12663. * @param (int) count number of independent variables
  12664. * @return (com.ibm.rave.core.math.Random.Randomizer) a function for generating random numbers
  12665. */
  12666. /** @expose */
  12667. irwinHall : function(count) {
  12668. return function() {
  12669. var s = 0;
  12670. for (var j = 0; j < count; ++j) {
  12671. s += com_ibm_rave_core_math_Random.INSTANCE.getRandomizerFunc()();
  12672. }
  12673. return s;
  12674. };
  12675. },
  12676. /** @expose */
  12677. randomizer : function(a0) {
  12678. var args = arguments;
  12679. if (args.length == 0) {
  12680. return this.randomizer$0();
  12681. }
  12682. return this.randomizer$1(a0);
  12683. },
  12684. /** @expose */
  12685. normal : function(a0, a1) {
  12686. var args = arguments;
  12687. if (args.length == 0) {
  12688. return this.normal$0();
  12689. }
  12690. if (args.length == 1) {
  12691. return this.normal$1(a0);
  12692. }
  12693. return this.normal$2(a0, a1);
  12694. },
  12695. /** @expose */
  12696. logNormal : function(a0, a1) {
  12697. var args = arguments;
  12698. if (args.length == 0) {
  12699. return this.logNormal$0();
  12700. }
  12701. if (args.length == 1) {
  12702. return this.logNormal$1(a0);
  12703. }
  12704. return this.logNormal$2(a0, a1);
  12705. }
  12706. //constructor : function() {}
  12707. });
  12708. //com_ibm_rave_core_math_Random.RANDOMIZER_KEY = "RANDOMIZER_KEY";
  12709. /** @expose */
  12710. com_ibm_rave_core_math_Random.INSTANCE = new com_ibm_rave_core_math_Random();
  12711. // $source: com/ibm/rave/core/arrays/Shuffle
  12712. /************************************************************************
  12713. ** IBM Confidential
  12714. **
  12715. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  12716. **
  12717. ** (C) Copyright IBM Corp. 2017
  12718. **
  12719. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12720. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12721. ************************************************************************/
  12722. // GENERATED
  12723. //@import com/ibm/rave/core/math/Random (static) // Random
  12724. /**
  12725. * Randomizes the order of the specified array using the Fisher–Yates shuffle.
  12726. */
  12727. var com_ibm_rave_core_arrays_Shuffle = rave_externs["Shuffle"] = {
  12728. //constructor : function() {}
  12729. };
  12730. /**
  12731. * Randomizes the order of the specified array using the Fisher–Yates shuffle.
  12732. * @param (Array) inputArray the array to randomize, change is done in-place.
  12733. * @return (Array) the randomized array
  12734. */
  12735. com_ibm_rave_core_arrays_Shuffle.shuffle$0 = function(inputArray) {
  12736. return com_ibm_rave_core_arrays_Shuffle.shuffle$2(inputArray, 0, inputArray.length);
  12737. };
  12738. /**
  12739. * Randomizes the order of the specified array using the Fisher–Yates shuffle, beginning the shuffle at a specific index.
  12740. * @param (Array) inputArray the array to randomize, change is done in-place
  12741. * @param (int) i0 starting index for the shuffle.
  12742. * @return (Array) the randomized array
  12743. */
  12744. com_ibm_rave_core_arrays_Shuffle.shuffle$1 = function(inputArray, i0) {
  12745. return com_ibm_rave_core_arrays_Shuffle.shuffle$2(inputArray, i0, inputArray.length);
  12746. };
  12747. /**
  12748. * Randomizes the order of the specified array using the Fisher–Yates shuffle, beginning and ending the shuffle at specific indices.
  12749. * @param (Array) inputArray the array to randomize, change is done in-place
  12750. * @param (int) i0 starting index for the shuffle.
  12751. * @param (int) i1 end index for the shuffle.
  12752. * @return (Array) the randomized array
  12753. */
  12754. com_ibm_rave_core_arrays_Shuffle.shuffle$2 = function(inputArray, i0, i1) {
  12755. var m = i1 - i0;
  12756. var i;
  12757. var t;
  12758. while (m != 0) {
  12759. i = ~~(com_ibm_rave_core_math_Random.INSTANCE.randomizer()() * m--) | 0;
  12760. t = inputArray[m + i0];
  12761. inputArray[m + i0] = inputArray[i + i0];
  12762. inputArray[i + i0] = t;
  12763. }
  12764. return inputArray;
  12765. };
  12766. /** @expose */
  12767. com_ibm_rave_core_arrays_Shuffle.shuffle = function(a0, a1, a2) {
  12768. var args = arguments;
  12769. if (args.length == 1) {
  12770. return com_ibm_rave_core_arrays_Shuffle.shuffle$0(a0);
  12771. }
  12772. if (args.length == 2) {
  12773. return com_ibm_rave_core_arrays_Shuffle.shuffle$1(a0, a1);
  12774. }
  12775. return com_ibm_rave_core_arrays_Shuffle.shuffle$2(a0, a1, a2);
  12776. };
  12777. // $source: com/ibm/rave/core/arrays/Bisector
  12778. /************************************************************************
  12779. ** IBM Confidential
  12780. **
  12781. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  12782. **
  12783. ** (C) Copyright IBM Corp. 2017
  12784. **
  12785. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12786. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12787. ************************************************************************/
  12788. // GENERATED
  12789. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, declare anonymous
  12790. //@import com/ibm/rave/core/arrays/Sort (static) // Sort
  12791. /**
  12792. * A bisection search utility. Used to locate the insertion point in an array to maintain sorted order.
  12793. * @param < (java.lang.Object) T > the data type for compare against data objects in the array
  12794. */
  12795. var com_ibm_rave_core_arrays_Bisector = rave_externs["Bisector"] = com_ibm_rave_core_nativeImpl_Declare({
  12796. /**
  12797. * Locate the insertion point in an array to maintain sorted order.
  12798. */
  12799. /** @expose */
  12800. left : null,
  12801. /**
  12802. * 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.
  12803. */
  12804. /** @expose */
  12805. right : null,
  12806. /**
  12807. * Constructs a new bisector with the given comparator.
  12808. * @param (com.ibm.rave.core.util.Comparator) comparator compares two data objects
  12809. */
  12810. /** @expose */
  12811. constructor : function(comparator) {
  12812. this.left = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_arrays_Bisector.BisectorFunction], {
  12813. bisect$2 : function(a, x, lo, hi) {
  12814. var newLo = lo;
  12815. var newHi = hi;
  12816. while (newLo < newHi) {
  12817. var mid = (newLo + newHi) >>> 1;
  12818. if (comparator(a[mid], x) < 0) {
  12819. newLo = mid + 1;
  12820. } else {
  12821. newHi = mid;
  12822. }
  12823. }
  12824. return newLo;
  12825. }
  12826. }))();
  12827. this.right = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_arrays_Bisector.BisectorFunction], {
  12828. bisect$2 : function(a, x, lo, hi) {
  12829. var newLo = lo;
  12830. var newHi = hi;
  12831. while (newLo < newHi) {
  12832. var mid = (newLo + newHi) >>> 1;
  12833. if (comparator(a[mid], x) > 0) {
  12834. newHi = mid;
  12835. } else {
  12836. newLo = mid + 1;
  12837. }
  12838. }
  12839. return newLo;
  12840. }
  12841. }))();
  12842. }
  12843. });
  12844. /**
  12845. * Creates a generic bisector with the given comparator.
  12846. * @param (com.ibm.rave.core.util.Comparator) comparator compares two data objects
  12847. * @return (com.ibm.rave.core.arrays.Bisector) a new bisector
  12848. */
  12849. com_ibm_rave_core_arrays_Bisector.create$0 = function(comparator) {
  12850. return new com_ibm_rave_core_arrays_Bisector(comparator);
  12851. };
  12852. /**
  12853. * Creates a new bisector using {@link this.Sort#com_ibm_rave_core_arrays_Sort.ascending} as the comparator.
  12854. * @param (com.ibm.rave.core.functions.DoubleValueFunction) f a value function to extract a number from a data object
  12855. * @return (com.ibm.rave.core.arrays.Bisector) a new bisector
  12856. */
  12857. com_ibm_rave_core_arrays_Bisector.create$1 = function(f) {
  12858. return new com_ibm_rave_core_arrays_Bisector(function(a, b) {
  12859. return com_ibm_rave_core_arrays_Sort.ascending(f(a), b);
  12860. });
  12861. };
  12862. /** @expose */
  12863. com_ibm_rave_core_arrays_Bisector.create = function(a0) {
  12864. var args = arguments;
  12865. if (args.length == 1 && typeof a0 === "function" && a0.length == 2) {
  12866. return com_ibm_rave_core_arrays_Bisector.create$0(a0);
  12867. }
  12868. return com_ibm_rave_core_arrays_Bisector.create$1(a0);
  12869. };
  12870. /**
  12871. * Function to execute a bisection search.
  12872. * @param < (java.lang.Object) T > the data type to compare against data objects in the array
  12873. */
  12874. com_ibm_rave_core_arrays_Bisector.BisectorFunction = rave_externs["BisectorFunction"] = com_ibm_rave_core_nativeImpl_Declare({
  12875. _$functionClassMethod : function() {
  12876. var _$self = function(a0, a1, a2, a3) {
  12877. var args = arguments;
  12878. if (args.length == 2) {
  12879. return _$self.bisect$0(a0, a1);
  12880. }
  12881. if (args.length == 3) {
  12882. return _$self.bisect$1(a0, a1, a2);
  12883. }
  12884. return _$self.bisect$2(a0, a1, a2, a3);
  12885. };
  12886. return _$self;
  12887. },
  12888. /**
  12889. * Locate the insertion point in an array to maintain sorted order.
  12890. * @param (Array) a the array to insert into
  12891. * @param (java.lang.Object) x the value to insert
  12892. * @return (int) the insertion point index
  12893. */
  12894. bisect$0 : function(a, x) {
  12895. return this(a, x, 0, a.length);
  12896. },
  12897. /**
  12898. * Locate the insertion point in an array to maintain sorted order.
  12899. * @param (Array) a the array to insert into
  12900. * @param (java.lang.Object) x the value to insert
  12901. * @param (int) lo the low index in the array to begin at
  12902. * @return (int) the insertion point index
  12903. */
  12904. bisect$1 : function(a, x, lo) {
  12905. return this(a, x, lo, a.length);
  12906. }
  12907. /**
  12908. * Locate the insertion point in an array to maintain sorted order.
  12909. * @param (Array) a the array to insert into
  12910. * @param (java.lang.Object) x the value to insert
  12911. * @param (int) lo the low index in the array to begin at
  12912. * @param (int) hi the high index in the array to stop at
  12913. * @return (int) the insertion point index
  12914. */
  12915. //bisect$2 : function(a, x, lo, hi) {}
  12916. });
  12917. com_ibm_rave_core_arrays_Bisector.bisector = new com_ibm_rave_core_arrays_Bisector(com_ibm_rave_core_arrays_Sort.ascending);
  12918. /**
  12919. * Locate the insertion point in an array to maintain sorted order.
  12920. */
  12921. /** @expose */
  12922. com_ibm_rave_core_arrays_Bisector.bisectLeft = com_ibm_rave_core_arrays_Bisector.bisector.left;
  12923. /**
  12924. * 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.
  12925. */
  12926. /** @expose */
  12927. com_ibm_rave_core_arrays_Bisector.bisectRight = com_ibm_rave_core_arrays_Bisector.bisector.right;
  12928. /**
  12929. * @see #com_ibm_rave_core_arrays_Bisector.bisect
  12930. */
  12931. /** @expose */
  12932. com_ibm_rave_core_arrays_Bisector.bisect = com_ibm_rave_core_arrays_Bisector.bisector.right;
  12933. // $source: com/ibm/rave/core/nativeImpl/event/Mouse
  12934. /************************************************************************
  12935. ** IBM Confidential
  12936. **
  12937. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  12938. **
  12939. ** (C) Copyright IBM Corp. 2014, 2015
  12940. **
  12941. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12942. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12943. ************************************************************************/
  12944. // @import com/ibm/rave/core/nativeImpl/event/EventTracker
  12945. var com_ibm_rave_core_nativeImpl_event_Mouse = (function() {
  12946. // https://bugs.webkit.org/show_bug.cgi?id=44083
  12947. var mouse_bug44083 = global.navigator && /WebKit/.test(global.navigator.userAgent) ? -1 : 0;
  12948. return {
  12949. mousePoint : function(container, e) {
  12950. if (arguments.length == 1) {
  12951. e = com_ibm_rave_core_nativeImpl_event_EventTracker.eventSource();
  12952. }
  12953. if (e.changedTouches) e = e.changedTouches[0];
  12954. var svg = container["ownerSVGElement"];
  12955. if (!svg && container["rave_getOwner"]) {
  12956. // Use the "owner" node if available - typically the canvas dom node
  12957. svg = container["rave_getOwner"]();
  12958. } else {
  12959. svg = container;
  12960. }
  12961. if (svg["createSVGPoint"]) {
  12962. var point = svg["createSVGPoint"]();
  12963. if (mouse_bug44083 < 0) {
  12964. var window = rave_window(container);
  12965. if (window.scrollX || window.scrollY) {
  12966. svg = rave.select("body").append("svg").style({
  12967. position: "absolute",
  12968. top: 0,
  12969. left: 0,
  12970. margin: 0,
  12971. padding: 0,
  12972. border: "none"
  12973. }, "important");
  12974. var ctm = svg[0][0]["getScreenCTM"]();
  12975. mouse_bug44083 = !(ctm["f"] || ctm["e"]);
  12976. svg.remove();
  12977. }
  12978. }
  12979. if (mouse_bug44083) point.x = e.pageX, point.y = e.pageY;
  12980. else point.x = e.clientX, point.y = e.clientY;
  12981. point = point["matrixTransform"](container["getScreenCTM"]()["inverse"]());
  12982. return [point.x, point.y];
  12983. } else if (container["getScreenCTM"]) {
  12984. // For canvas, need to take our screen ctm into account
  12985. // Use 'container' which is our internal node which will have a valid screen ctm
  12986. var point = [e.clientX, e.clientY];
  12987. com_ibm_rave_core_transform_MatrixUtil.mapPoints(point, container.getScreenCTM().inverse())
  12988. return point;
  12989. }
  12990. var rect = svg.getBoundingClientRect();
  12991. return [e.clientX - rect.left - (svg.clientLeft || 0), e.clientY - rect.top - (svg.clientTop || 0)];
  12992. }
  12993. };
  12994. })();
  12995. // $source: com/ibm/rave/core/event/TouchUtil
  12996. /************************************************************************
  12997. ** IBM Confidential
  12998. **
  12999. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13000. **
  13001. ** (C) Copyright IBM Corp. 2017
  13002. **
  13003. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13004. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13005. ************************************************************************/
  13006. // GENERATED
  13007. //@import com/ibm/rave/core/nativeImpl/event/Mouse (static) // mousePoint
  13008. /**
  13009. * Utilities for obtaining coordinates of touch events relative to a container.
  13010. */
  13011. var com_ibm_rave_core_event_TouchUtil = rave_externs["TouchUtil"] = {
  13012. //constructor : function() {}
  13013. };
  13014. /**
  13015. * 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.
  13016. * @param (com.ibm.rave.core.scene.SceneNode) container the container to which the resulting coordinates are relative
  13017. * @param (String) identifier the touch identifier
  13018. * @return (Array) the coordinates of the touch
  13019. */
  13020. /** @expose */
  13021. com_ibm_rave_core_event_TouchUtil.touchFromSource = function(container, identifier) {
  13022. return com_ibm_rave_core_event_TouchUtil.touch(container, (rave.event).changedTouches, identifier);
  13023. };
  13024. /**
  13025. * 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.
  13026. * @param (com.ibm.rave.core.scene.SceneNode) container the container to which the resulting coordinates are relative
  13027. * @param (Array) touches a list of all of the points of contact with a touch surface
  13028. * @param (String) identifier the touch identifier
  13029. * @return (Array) the coordinates of the touch
  13030. */
  13031. /** @expose */
  13032. com_ibm_rave_core_event_TouchUtil.touch = function(container, touches, identifier) {
  13033. if (touches) {
  13034. for (var i = 0, n = touches.length; i < n; ++i) {
  13035. var touch = touches[i];
  13036. if (identifier == touch.identifier) {
  13037. return com_ibm_rave_core_nativeImpl_event_Mouse.mousePoint(container, touch);
  13038. }
  13039. }
  13040. }
  13041. return null;
  13042. };
  13043. // $source: com/ibm/rave/core/format/FormatPrefix
  13044. /************************************************************************
  13045. ** IBM Confidential
  13046. **
  13047. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13048. **
  13049. ** (C) Copyright IBM Corp. 2017
  13050. **
  13051. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13052. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13053. ************************************************************************/
  13054. // GENERATED
  13055. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  13056. //@import com/ibm/rave/core/format/Round (static) // round
  13057. //@import com/ibm/rave/core/internal/format/Precision (static) // precision
  13058. var com_ibm_rave_core_format_FormatPrefix = com_ibm_rave_core_nativeImpl_Declare({
  13059. /**
  13060. * The prefix symbol, such as "M" for millions.
  13061. */
  13062. /** @expose */
  13063. symbol : null,
  13064. /**
  13065. * The scale function, for converting numbers to the appropriate prefixed scale.
  13066. */
  13067. /** @expose */
  13068. scale : null,
  13069. constructor : function(symbol, i) {
  13070. var k = Math.pow(10, Math.abs(8 - i) * 3);
  13071. this.scale = i > 8 ? function(d) {
  13072. return d / k;
  13073. } : function(d) {
  13074. return d * k;
  13075. };
  13076. this.symbol = symbol;
  13077. }
  13078. });
  13079. /**
  13080. * Returns the SI prefix for the specified value.
  13081. * @param (double) value the specified value
  13082. * @param (Number) precision if an optional precision is specified, the value is rounded accordingly using {@link this.Round#this.round(, )} before computing the prefix
  13083. * @return (com.ibm.rave.core.format.FormatPrefix) SI prefix for the specified value
  13084. */
  13085. /** @expose */
  13086. com_ibm_rave_core_format_FormatPrefix.formatPrefix = function(value, precision) {
  13087. var _value = value;
  13088. var i = 0;
  13089. if ((_value)) {
  13090. if (_value < 0) {
  13091. _value *= -1;
  13092. }
  13093. if ((precision)) {
  13094. _value = com_ibm_rave_core_format_Round.round(_value, com_ibm_rave_core_internal_format_Precision.precision(_value, precision));
  13095. }
  13096. i = 1 + Math.floor(1e-12 + Math.log(_value) / Math["LN10"]);
  13097. i = Math.max(-24, Math.min(24, Math.floor((i - 1) / 3) * 3));
  13098. }
  13099. return com_ibm_rave_core_format_FormatPrefix.formatPrefixes[~~(8 + i / 3)];
  13100. };
  13101. 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) {
  13102. return new com_ibm_rave_core_format_FormatPrefix(currentValue, index);
  13103. });
  13104. // $source: com/ibm/rave/core/arrays/Nest
  13105. /************************************************************************
  13106. ** IBM Confidential
  13107. **
  13108. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13109. **
  13110. ** (C) Copyright IBM Corp. 2017
  13111. **
  13112. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13113. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13114. ************************************************************************/
  13115. // GENERATED
  13116. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  13117. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (runtime) // create
  13118. //@import com/ibm/rave/core/arrays/Entry (runtime) // new
  13119. //@import com/ibm/rave/core/Rave (runtime) // Rave
  13120. /**
  13121. * 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.
  13122. */
  13123. var com_ibm_rave_core_arrays_Nest = rave_externs["Nest"] = com_ibm_rave_core_nativeImpl_Declare({
  13124. //keyFunctions : null,
  13125. //sortKeysComparators : null,
  13126. //sortValuesFn : null,
  13127. //rollupFn : null,
  13128. constructor : function() {
  13129. this.keyFunctions = [];
  13130. this.sortKeysComparators = [];
  13131. },
  13132. internalMap : function(mapType, array, depth) {
  13133. var _depth = depth;
  13134. if (_depth >= this.keyFunctions.length) {
  13135. if (this.rollupFn) {
  13136. return this.rollupFn.call(this, array);
  13137. }
  13138. if (this.sortValuesFn) {
  13139. return array.sort(this.sortValuesFn);
  13140. }
  13141. return array;
  13142. }
  13143. var self = this;
  13144. var i = -1;
  13145. var n = array.length;
  13146. var keyFn = this.keyFunctions[_depth++];
  13147. var keyValue;
  13148. var keyArray;
  13149. var valuesByKey = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  13150. var values;
  13151. while (++i < n) {
  13152. keyArray = array[i];
  13153. keyValue = keyFn(keyArray);
  13154. values = valuesByKey.get(keyValue);
  13155. if ((values)) {
  13156. values.push(keyArray);
  13157. } else {
  13158. var valueArray = [];
  13159. valueArray.push(keyArray);
  13160. valuesByKey.set(keyValue, valueArray);
  13161. }
  13162. }
  13163. var finalDepth = _depth;
  13164. if (mapType) {
  13165. keyArray = mapType();
  13166. valuesByKey.forEach(function(b, c) {
  13167. (keyArray).set(b, self.internalMap(mapType, c, finalDepth));
  13168. return null;
  13169. });
  13170. } else {
  13171. keyArray = {};
  13172. valuesByKey.forEach(function(b, c) {
  13173. (keyArray)[b] = self.internalMap(mapType, c, finalDepth);
  13174. return null;
  13175. });
  13176. }
  13177. return keyArray;
  13178. },
  13179. internalEntries : function(map, depth) {
  13180. if (depth >= this.keyFunctions.length) {
  13181. return map;
  13182. }
  13183. var realMap = map;
  13184. var array = [];
  13185. var sortKey = this.sortKeysComparators.length > depth ? this.sortKeysComparators[depth] : null;
  13186. var finalDepth = depth + 1;
  13187. var self = this;
  13188. realMap.forEach(function(key, keyMap) {
  13189. var entry = new com_ibm_rave_core_arrays_Entry();
  13190. entry.key = key;
  13191. entry.values = self.internalEntries(keyMap, finalDepth);
  13192. array.push(entry);
  13193. return null;
  13194. });
  13195. return sortKey ? array.sort(function(obj1, obj2) {
  13196. return sortKey(obj1.key, obj2.key);
  13197. }) : array;
  13198. },
  13199. /**
  13200. * 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.
  13201. * @param (Array) array the array to use
  13202. * @return (Array) key-values entries
  13203. */
  13204. /** @expose */
  13205. entries : function(array) {
  13206. return this.internalEntries(this.internalMap(com_ibm_rave_core_Rave.map, array, 0), 0);
  13207. },
  13208. /**
  13209. * 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.
  13210. * @param (Array) array the array to use
  13211. * @param (com.ibm.rave.core.collections.MapFunctionClass) mapType the map creation function
  13212. * @return (Object) the associative array.
  13213. */
  13214. map$0 : function(array, mapType) {
  13215. return this.internalMap(mapType, array, 0);
  13216. },
  13217. /**
  13218. * 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.
  13219. * @param (Array) array the array to use
  13220. * @return (Object) the associative array.
  13221. */
  13222. map$1 : function(array) {
  13223. return this.internalMap(null, array, 0);
  13224. },
  13225. /**
  13226. * 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.
  13227. * @param (com.ibm.rave.core.arrays.Nest.KeyFunction) d the key
  13228. * @return (com.ibm.rave.core.arrays.Nest) this nest operator
  13229. */
  13230. /** @expose */
  13231. key : function(d) {
  13232. this.keyFunctions.push(d);
  13233. return this;
  13234. },
  13235. /**
  13236. * 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.
  13237. * @param (com.ibm.rave.core.arrays.Nest.RollupFunction) rFunction the rollup function
  13238. * @return (com.ibm.rave.core.arrays.Nest) this nest
  13239. */
  13240. /** @expose */
  13241. rollup : function(rFunction) {
  13242. this.rollupFn = rFunction;
  13243. return this;
  13244. },
  13245. /**
  13246. * Specifies the order for the most-recently specified key. Note: only applies to entries. Map keys are unordered!
  13247. * @param (com.ibm.rave.core.util.Comparator) order the order function
  13248. * @return (com.ibm.rave.core.arrays.Nest) this nest
  13249. */
  13250. /** @expose */
  13251. sortKeys : function(order) {
  13252. this.sortKeysComparators[this.keyFunctions.length - 1] = order;
  13253. return this;
  13254. },
  13255. /**
  13256. * Specifies the order for leaf values. Applies to both maps and entries array.
  13257. * @param (com.ibm.rave.core.util.Comparator) order the order function
  13258. * @return (com.ibm.rave.core.arrays.Nest) this Nest
  13259. */
  13260. /** @expose */
  13261. sortValues : function(order) {
  13262. this.sortValuesFn = order;
  13263. return this;
  13264. },
  13265. /** @expose */
  13266. map : function(a0, a1) {
  13267. var args = arguments;
  13268. if (args.length == 1) {
  13269. return this.map$1(a0);
  13270. }
  13271. return this.map$0(a0, a1);
  13272. }
  13273. });
  13274. // $source: com/ibm/rave/core/arrays/RaveSet
  13275. /************************************************************************
  13276. ** IBM Confidential
  13277. **
  13278. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13279. **
  13280. ** (C) Copyright IBM Corp. 2017
  13281. **
  13282. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13283. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13284. ************************************************************************/
  13285. // GENERATED
  13286. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  13287. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (runtime) // create
  13288. /**
  13289. * The Set collection
  13290. * @author Bryan
  13291. */
  13292. var com_ibm_rave_core_arrays_RaveSet = com_ibm_rave_core_nativeImpl_Declare({
  13293. //delegate : null,
  13294. /**
  13295. * private constructor
  13296. */
  13297. constructor : function(list) {
  13298. this.delegate = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  13299. if (list) {
  13300. for (var i = 0; i < list.length; ++i) {
  13301. this.delegate.set(""+(list[i]), true);
  13302. }
  13303. }
  13304. },
  13305. /**
  13306. * Returns true if and only if this set has an entry for the specified value string.
  13307. * @param (Object) value The value to check
  13308. * @return (boolean) whether the set has the value
  13309. */
  13310. /** @expose */
  13311. has : function(value) {
  13312. return this.delegate.has(""+(value));
  13313. },
  13314. /**
  13315. * Adds the specified value string to this set. Returns value.
  13316. * @param (Object) value The value to add
  13317. * @return (Object) the value added
  13318. */
  13319. /** @expose */
  13320. add : function(value) {
  13321. var stringvalue = ""+(value);
  13322. return this.delegate.set(stringvalue, true) ? stringvalue : null;
  13323. },
  13324. /**
  13325. * If the set contains the specified value string, removes it and returns true. Otherwise, this method does nothing and returns false.
  13326. * @param (Object) value The value to remove
  13327. * @return (boolean) whether the item was removed
  13328. */
  13329. /** @expose */
  13330. remove : function(value) {
  13331. return this.delegate.remove(""+(value));
  13332. },
  13333. /**
  13334. * 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.
  13335. * @return (Array) a list of the values
  13336. */
  13337. /** @expose */
  13338. values : function() {
  13339. return this.delegate.keys();
  13340. },
  13341. /**
  13342. * Returns the number of values in this set.
  13343. * @return (int) the number of values in this set
  13344. */
  13345. /** @expose */
  13346. size : function() {
  13347. return this.delegate.size();
  13348. },
  13349. /**
  13350. * Returns true if and only if this set has zero values.
  13351. * @return (boolean) whether this set is empty or not
  13352. */
  13353. /** @expose */
  13354. empty : function() {
  13355. return this.delegate.empty();
  13356. },
  13357. /**
  13358. * 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.
  13359. * @param (com.ibm.rave.core.arrays.RaveSet.ForEachValueFunction) callback the function to call with each value in the set
  13360. */
  13361. /** @expose */
  13362. forEach : function(callback) {
  13363. var keys = this.delegate.keys();
  13364. for (var i = 0; i < keys.length; ++i) {
  13365. callback.call(this, keys[i], i);
  13366. }
  13367. }
  13368. });
  13369. /**
  13370. * Constructs a new set. If array is specified, adds the given array of string values to the returned set.
  13371. * @return (com.ibm.rave.core.arrays.RaveSet) the new Set
  13372. */
  13373. com_ibm_rave_core_arrays_RaveSet.create$0 = function() {
  13374. return new com_ibm_rave_core_arrays_RaveSet(null);
  13375. };
  13376. /**
  13377. * Constructs a new set. If array is specified, adds the given array of string values to the returned set.
  13378. * @param (Array) list the list of items to add to the set
  13379. * @return (com.ibm.rave.core.arrays.RaveSet) the new Set
  13380. */
  13381. com_ibm_rave_core_arrays_RaveSet.create$1 = function(list) {
  13382. return new com_ibm_rave_core_arrays_RaveSet(list);
  13383. };
  13384. /** @expose */
  13385. com_ibm_rave_core_arrays_RaveSet.create = function(a0) {
  13386. var args = arguments;
  13387. if (args.length == 0) {
  13388. return com_ibm_rave_core_arrays_RaveSet.create$0();
  13389. }
  13390. return com_ibm_rave_core_arrays_RaveSet.create$1(a0);
  13391. };
  13392. // $source: com/ibm/rave/core/util/RaveUtil
  13393. /************************************************************************
  13394. ** IBM Confidential
  13395. **
  13396. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13397. **
  13398. ** (C) Copyright IBM Corp. 2017
  13399. **
  13400. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13401. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13402. ************************************************************************/
  13403. // GENERATED
  13404. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  13405. //@import com/ibm/rave/core/internal/css/CSSUtil (runtime) // parseSize
  13406. /**
  13407. * Generic utility class
  13408. */
  13409. var com_ibm_rave_core_util_RaveUtil = com_ibm_rave_core_nativeImpl_Declare({
  13410. /**
  13411. * Parse a css size value from the given object. A size contains a numeric value followed by a unit. If no unit is specified, the unit is assumed to be 'px'.
  13412. * @param (Object) raw_value the size value to parse or null if the raw value is null or invalid
  13413. * @return (com.ibm.rave.core.css.CSSSize) the parsed {@link (com.ibm.rave.core.css.CSSSize) CSSSize}
  13414. */
  13415. /** @expose */
  13416. parseCSSSize : function(raw_value) {
  13417. return com_ibm_rave_core_internal_css_CSSUtil.parseSize(raw_value);
  13418. }
  13419. /**
  13420. * Private constructor - singleton
  13421. */
  13422. //constructor : function() {}
  13423. });
  13424. /**
  13425. * @return (com.ibm.rave.core.util.RaveUtil) singleton instance
  13426. */
  13427. /** @expose */
  13428. com_ibm_rave_core_util_RaveUtil.getInstance = function() {
  13429. return com_ibm_rave_core_util_RaveUtil.INSTANCE;
  13430. };
  13431. com_ibm_rave_core_util_RaveUtil.INSTANCE = new com_ibm_rave_core_util_RaveUtil();
  13432. // $source: com/ibm/rave/core/graphicUtils/CanvasUtil
  13433. /************************************************************************
  13434. ** IBM Confidential
  13435. **
  13436. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13437. **
  13438. ** (C) Copyright IBM Corp. 2017
  13439. **
  13440. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13441. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13442. ************************************************************************/
  13443. // GENERATED
  13444. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  13445. //@import com/ibm/rave/core/nativeImpl/graphicUtils/GraphicContextFactory (runtime) // create, dispose
  13446. /**
  13447. * A utility class for various canvas operations
  13448. */
  13449. var com_ibm_rave_core_graphicUtils_CanvasUtil = com_ibm_rave_core_nativeImpl_Declare({
  13450. /**
  13451. * @param (double) width canvas width
  13452. * @param (double) height canvas height
  13453. * @return (Object) canvas element
  13454. */
  13455. /** @expose */
  13456. create : function(width, height) {
  13457. return com_ibm_rave_core_nativeImpl_graphicUtils_GraphicContextFactory.create(width, height);
  13458. },
  13459. /**
  13460. * Disposes the RenderingContext to free system resources
  13461. * @param (com.ibm.rave.core.nativeImpl.graphicUtils.RenderingContext) context the context to dispose
  13462. */
  13463. /** @expose */
  13464. disposeContext : function(context) {
  13465. com_ibm_rave_core_nativeImpl_graphicUtils_GraphicContextFactory.dispose(context);
  13466. }
  13467. //constructor : function() {}
  13468. });
  13469. /** @expose */
  13470. com_ibm_rave_core_graphicUtils_CanvasUtil.INSTANCE = new com_ibm_rave_core_graphicUtils_CanvasUtil();
  13471. // $source: com/ibm/rave/core/geom/QuadTree
  13472. /************************************************************************
  13473. ** IBM Confidential
  13474. **
  13475. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13476. **
  13477. ** (C) Copyright IBM Corp. 2017
  13478. **
  13479. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13480. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13481. ************************************************************************/
  13482. // GENERATED
  13483. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  13484. /**
  13485. * 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.
  13486. * @param < (java.lang.Object) T > type of quadtree node
  13487. */
  13488. var com_ibm_rave_core_geom_QuadTree = rave_externs["QuadTree"] = com_ibm_rave_core_nativeImpl_Declare({
  13489. //fx : null, //fy : null,
  13490. //xVal : null, //yVal : null,
  13491. x1 : NaN, y1 : 0, x2 : 0, y2 : 0,
  13492. _$functionClassMethod : function() {
  13493. var _$self = /**
  13494. * 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.
  13495. * @param (Array) data Array of data points specified for the new quadtree
  13496. * @return (com.ibm.rave.core.geom.QuadTree.RootQTNode) The root node of a new quadtree
  13497. */
  13498. function(data) {
  13499. var d;
  13500. var x1_, y1_, x2_, y2_;
  13501. var n = data.length;
  13502. var xs, ys;
  13503. if (!(isNaN(_$self.x1))) {
  13504. x1_ = _$self.x1;
  13505. y1_ = _$self.y1;
  13506. x2_ = _$self.x2;
  13507. y2_ = _$self.y2;
  13508. } else {
  13509. x2_ = y2_ = -(x1_ = y1_ = Infinity);
  13510. xs = [];
  13511. ys = [];
  13512. for (var i = 0; i < n; ++i) {
  13513. var x_ = +_$self.fx(d = data[i], i), y_ = +_$self.fy(d, i);
  13514. if (x_ < x1_) {
  13515. x1_ = x_;
  13516. }
  13517. if (y_ < y1_) {
  13518. y1_ = y_;
  13519. }
  13520. if (x_ > x2_) {
  13521. x2_ = x_;
  13522. }
  13523. if (y_ > y2_) {
  13524. y2_ = y_;
  13525. }
  13526. xs[i] = x_;
  13527. ys[i] = y_;
  13528. }
  13529. }
  13530. var dx = x2_ - x1_, dy = y2_ - y1_;
  13531. if (dx > dy) {
  13532. y2_ = y1_ + dx;
  13533. } else {
  13534. x2_ = x1_ + dy;
  13535. }
  13536. var root = new com_ibm_rave_core_geom_QuadTree.RootQTNode(x1_, y1_, x2_, y2_, _$self.fx, _$self.fy);
  13537. if (isNaN(_$self.x1)) {
  13538. var i = -1;
  13539. while (++i < n) {
  13540. com_ibm_rave_core_geom_QuadTree.insert(root, data[i], xs[i], ys[i], x1_, y1_, x2_, y2_);
  13541. }
  13542. --i;
  13543. root.i = i;
  13544. } else {
  13545. for (var i = 0; i < n; ++i) {
  13546. root.add(data[i]);
  13547. }
  13548. }
  13549. return root;
  13550. };
  13551. return _$self;
  13552. },
  13553. /**
  13554. * If x is not specified, returns the current x-coordinate accessor
  13555. * @return (Object) the current x-coordinate accessor
  13556. */
  13557. x$0 : function() {
  13558. return this.xVal;
  13559. },
  13560. /**
  13561. * 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.
  13562. * @param (double) x The x-coordinate to use
  13563. * @return (com.ibm.rave.core.geom.QuadTree) the quadtree factory
  13564. */
  13565. x$1 : function(x) {
  13566. this.fx = function(data, index) {
  13567. return x;
  13568. };
  13569. this.xVal = x;
  13570. return this;
  13571. },
  13572. /**
  13573. * 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.
  13574. * @param (com.ibm.rave.core.geom.QuadTree.ValueFunction) x A new x-accessor to be used
  13575. * @return (com.ibm.rave.core.geom.QuadTree) the quadtree factory
  13576. */
  13577. x$2 : function(x) {
  13578. this.fx = x;
  13579. this.xVal = x;
  13580. return this;
  13581. },
  13582. /**
  13583. * If y is not specified, returns the current y-coordinate accessor
  13584. * @return (Object) the current y-coordinate accessor
  13585. */
  13586. y$0 : function() {
  13587. return this.yVal;
  13588. },
  13589. /**
  13590. * 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.
  13591. * @param (double) y The y-coordinate to use
  13592. * @return (com.ibm.rave.core.geom.QuadTree) the quadtree factory
  13593. */
  13594. y$1 : function(y) {
  13595. this.fy = function(data, index) {
  13596. return y;
  13597. };
  13598. this.yVal = y;
  13599. return this;
  13600. },
  13601. /**
  13602. * 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.
  13603. * @param (com.ibm.rave.core.geom.QuadTree.ValueFunction) y A new y-accessor to be used
  13604. * @return (com.ibm.rave.core.geom.QuadTree) the quadtree factory
  13605. */
  13606. y$2 : function(y) {
  13607. this.fy = y;
  13608. this.yVal = y;
  13609. return this;
  13610. },
  13611. /**
  13612. * 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
  13613. * @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
  13614. */
  13615. extent$0 : function() {
  13616. return isNaN(this.x1) ? null : [[this.x1, this.y1], [this.x2, this.y2]];
  13617. },
  13618. /**
  13619. * 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
  13620. * @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
  13621. * @return (com.ibm.rave.core.geom.QuadTree) quadtree factory with the current extent set
  13622. */
  13623. extent$1 : function(extent) {
  13624. if (!extent) {
  13625. this.x1 = this.y1 = this.x2 = this.y2 = NaN;
  13626. } else {
  13627. this.x1 = extent[0][0];
  13628. this.y1 = extent[0][1];
  13629. this.x2 = extent[1][0];
  13630. this.y2 = extent[1][1];
  13631. }
  13632. return this;
  13633. },
  13634. /**
  13635. * Creates a point indicating the size of the quadtree. If no size is available returns null
  13636. * @return (Array) a new point indicating the size of the quadtree
  13637. */
  13638. size$0 : function() {
  13639. return isNaN(this.x1) ? null : [this.x2 - this.x1, this.y2 - this.y1];
  13640. },
  13641. /**
  13642. * 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
  13643. * @param (Array) size the point used in order to setup the quadtree's size
  13644. * @return (com.ibm.rave.core.geom.QuadTree) the quadtree factory
  13645. */
  13646. size$1 : function(size) {
  13647. if (!size) {
  13648. this.x1 = this.y1 = this.x2 = this.y2 = NaN;
  13649. } else {
  13650. this.x1 = this.y2 = 0;
  13651. this.x2 = size[0];
  13652. this.y2 = size[1];
  13653. }
  13654. return this;
  13655. },
  13656. /** @expose */
  13657. x : function(a0) {
  13658. var args = arguments;
  13659. if (args.length == 0) {
  13660. return this.x$0();
  13661. }
  13662. if (args.length == 1 && typeof a0 === "function") {
  13663. return this.x$2(a0);
  13664. }
  13665. return this.x$1(a0);
  13666. },
  13667. /** @expose */
  13668. y : function(a0) {
  13669. var args = arguments;
  13670. if (args.length == 0) {
  13671. return this.y$0();
  13672. }
  13673. if (args.length == 1 && typeof a0 === "function") {
  13674. return this.y$2(a0);
  13675. }
  13676. return this.y$1(a0);
  13677. },
  13678. /** @expose */
  13679. extent : function(a0) {
  13680. var args = arguments;
  13681. if (args.length == 0) {
  13682. return this.extent$0();
  13683. }
  13684. return this.extent$1(a0);
  13685. },
  13686. /** @expose */
  13687. size : function(a0) {
  13688. var args = arguments;
  13689. if (args.length == 0) {
  13690. return this.size$0();
  13691. }
  13692. return this.size$1(a0);
  13693. }
  13694. });
  13695. /**
  13696. * Constructs a new quadtree for the specified array of data points, returning the root node of a new quadtree. Note: only for compatibility
  13697. * @param (Array) data data points specified in order to construct a new quadtree
  13698. * @param (double) x1 x1 coordinate
  13699. * @param (double) y1 y1 coordinate
  13700. * @param (double) x2 x2 coordinate
  13701. * @param (double) y2 y2 coordinate
  13702. * @return (com.ibm.rave.core.geom.QuadTree.RootQTNode) the root node of a new quadtree
  13703. */
  13704. com_ibm_rave_core_geom_QuadTree.createQuadTree$0 = function(data, x1, y1, x2, y2) {
  13705. var qTree = new com_ibm_rave_core_geom_QuadTree();
  13706. qTree.fx = com_ibm_rave_core_geom_QuadTree.FX_COMP_FN();
  13707. qTree.fy = com_ibm_rave_core_geom_QuadTree.FY_COMP_FN();
  13708. qTree.xVal = qTree.fx;
  13709. qTree.yVal = qTree.fy;
  13710. qTree.x1 = x1;
  13711. qTree.y1 = y1;
  13712. qTree.x2 = x2;
  13713. qTree.y2 = y2;
  13714. return qTree(data);
  13715. };
  13716. /**
  13717. * Constructs a new quadtree for the specified array of data points, returning the root node of a new quadtree. Note: only for compatibility
  13718. * @param (Array) data data points specified in order to construct a new quadtree
  13719. * @param (double) x1 x1 coordinate
  13720. * @param (double) y1 y1 coordinate
  13721. * @return (com.ibm.rave.core.geom.QuadTree.RootQTNode) the root node of a new quadtree
  13722. */
  13723. com_ibm_rave_core_geom_QuadTree.createQuadTree$1 = function(data, x1, y1) {
  13724. return com_ibm_rave_core_geom_QuadTree.createQuadTree$0(data, 0, 0, x1, y1);
  13725. };
  13726. /**
  13727. * 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
  13728. * @param (Array) data Array of data points specified for the new quadtree
  13729. * @return (com.ibm.rave.core.geom.QuadTree.RootQTNode) The root node of a new quadtree
  13730. */
  13731. com_ibm_rave_core_geom_QuadTree.createQuadTree$2 = function(data) {
  13732. var qTree = new com_ibm_rave_core_geom_QuadTree();
  13733. qTree.fx = com_ibm_rave_core_geom_QuadTree.FX_COMP_FN();
  13734. qTree.fy = com_ibm_rave_core_geom_QuadTree.FY_COMP_FN();
  13735. qTree.xVal = qTree.fx;
  13736. qTree.yVal = qTree.fy;
  13737. return qTree(data);
  13738. };
  13739. /**
  13740. * 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.
  13741. * @return (com.ibm.rave.core.geom.QuadTree) a new quadtree with default x/y accessors and extent
  13742. */
  13743. com_ibm_rave_core_geom_QuadTree.createQuadTree$3 = function() {
  13744. var qTree = new com_ibm_rave_core_geom_QuadTree();
  13745. qTree.fx = com_ibm_rave_core_geom_QuadTree.FX_FN();
  13746. qTree.fy = com_ibm_rave_core_geom_QuadTree.FY_FN();
  13747. qTree.xVal = qTree.fx;
  13748. qTree.yVal = qTree.fy;
  13749. return qTree;
  13750. };
  13751. /** @expose */
  13752. com_ibm_rave_core_geom_QuadTree.quadtreeVisit = function(f, node, x1, y1, x2, y2) {
  13753. var children = node.nodes;
  13754. if (!(f(node, x1, y1, x2, y2)) && children) {
  13755. var sx = (x1 + x2) * .5;
  13756. var sy = (y1 + y2) * .5;
  13757. if (children[0]) {
  13758. com_ibm_rave_core_geom_QuadTree.quadtreeVisit(f, children[0], x1, y1, sx, sy);
  13759. }
  13760. if (children[1]) {
  13761. com_ibm_rave_core_geom_QuadTree.quadtreeVisit(f, children[1], sx, y1, x2, sy);
  13762. }
  13763. if (children[2]) {
  13764. com_ibm_rave_core_geom_QuadTree.quadtreeVisit(f, children[2], x1, sy, sx, y2);
  13765. }
  13766. if (children[3]) {
  13767. com_ibm_rave_core_geom_QuadTree.quadtreeVisit(f, children[3], sx, sy, x2, y2);
  13768. }
  13769. }
  13770. };
  13771. /** @expose */
  13772. com_ibm_rave_core_geom_QuadTree.insert = function(n, d, x, y, x1, y1, x2, y2) {
  13773. if (isNaN(x) || isNaN(y)) {
  13774. return;
  13775. }
  13776. if (n.leaf) {
  13777. var nx = n.x, ny = n.y;
  13778. if (!(isNaN(nx))) {
  13779. if ((Math.abs(nx - x) + Math.abs(ny - y)) < .01) {
  13780. com_ibm_rave_core_geom_QuadTree.insertChild(n, d, x, y, x1, y1, x2, y2);
  13781. } else {
  13782. var nPoint = n.point;
  13783. n.point = null;
  13784. n.x = n.y = NaN;
  13785. com_ibm_rave_core_geom_QuadTree.insertChild(n, nPoint, nx, ny, x1, y1, x2, y2);
  13786. com_ibm_rave_core_geom_QuadTree.insertChild(n, d, x, y, x1, y1, x2, y2);
  13787. }
  13788. } else {
  13789. n.x = x;
  13790. n.y = y;
  13791. n.point = d;
  13792. }
  13793. } else {
  13794. com_ibm_rave_core_geom_QuadTree.insertChild(n, d, x, y, x1, y1, x2, y2);
  13795. }
  13796. };
  13797. com_ibm_rave_core_geom_QuadTree.insertChild = function(n, d, x, y, x1, y1, x2, y2) {
  13798. var _n = n;
  13799. var _x1 = x1;
  13800. var _y1 = y1;
  13801. var _x2 = x2;
  13802. var _y2 = y2;
  13803. var xm = (_x1 + _x2) * .5;
  13804. var ym = (_y1 + _y2) * .5;
  13805. var right = x >= xm;
  13806. var below = y >= ym;
  13807. var i = below ? (right ? 3 : 2) : (right ? 1 : 0);
  13808. _n.leaf = false;
  13809. if (!_n.nodes[i]) {
  13810. _n.nodes[i] = new com_ibm_rave_core_geom_QuadTree.QTNode();
  13811. }
  13812. _n = _n.nodes[i];
  13813. if (right) {
  13814. _x1 = xm;
  13815. } else {
  13816. _x2 = xm;
  13817. }
  13818. if (below) {
  13819. _y1 = ym;
  13820. } else {
  13821. _y2 = ym;
  13822. }
  13823. com_ibm_rave_core_geom_QuadTree.insert(_n, d, x, y, _x1, _y1, _x2, _y2);
  13824. };
  13825. com_ibm_rave_core_geom_QuadTree.FX_COMP_FN = function() {
  13826. return function(data, index) {
  13827. return data.x;
  13828. };
  13829. };
  13830. com_ibm_rave_core_geom_QuadTree.FY_COMP_FN = function() {
  13831. return function(data, index) {
  13832. return data.y;
  13833. };
  13834. };
  13835. com_ibm_rave_core_geom_QuadTree.FX_FN = function() {
  13836. return function(data, index) {
  13837. return (data)[0];
  13838. };
  13839. };
  13840. com_ibm_rave_core_geom_QuadTree.FY_FN = function() {
  13841. return function(data, index) {
  13842. return (data)[1];
  13843. };
  13844. };
  13845. /** @expose */
  13846. com_ibm_rave_core_geom_QuadTree.createQuadTree = function(a0, a1, a2, a3, a4) {
  13847. var args = arguments;
  13848. if (args.length == 0) {
  13849. return com_ibm_rave_core_geom_QuadTree.createQuadTree$3();
  13850. }
  13851. if (args.length == 1) {
  13852. return com_ibm_rave_core_geom_QuadTree.createQuadTree$2(a0);
  13853. }
  13854. if (args.length == 3) {
  13855. return com_ibm_rave_core_geom_QuadTree.createQuadTree$1(a0, a1, a2);
  13856. }
  13857. return com_ibm_rave_core_geom_QuadTree.createQuadTree$0(a0, a1, a2, a3, a4);
  13858. };
  13859. /**
  13860. * Sets up a new object containing the quadtree node
  13861. * @param < (java.lang.Object) T > the type of node to be used
  13862. */
  13863. com_ibm_rave_core_geom_QuadTree.QTNode = rave_externs["QTNode"] = com_ibm_rave_core_nativeImpl_Declare({
  13864. /**
  13865. * a sparse array of the four child nodes in order: top-left, top-right, bottom-left, bottom-right
  13866. */
  13867. /** @expose */
  13868. nodes : null,
  13869. /**
  13870. * the point associated with this node, if any (may apply to either internal or leaf nodes)
  13871. */
  13872. /** @expose */
  13873. point : null,
  13874. /** @expose */
  13875. data : null,
  13876. /**
  13877. * a boolean indicating whether this is an internal node or a leaf node
  13878. */
  13879. /** @expose */
  13880. leaf : true,
  13881. /**
  13882. * the x-coordinate of the associated point, if any
  13883. */
  13884. /** @expose */
  13885. x : NaN,
  13886. /**
  13887. * the y-coordinate of the associated point, if any
  13888. */
  13889. /** @expose */
  13890. y : NaN,
  13891. constructor : function() {
  13892. this.nodes = [];
  13893. }
  13894. });
  13895. /**
  13896. * Initial setup of a root quadtree node
  13897. * @param < (java.lang.Object) T > type of quadtree node
  13898. */
  13899. com_ibm_rave_core_geom_QuadTree.RootQTNode = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_geom_QuadTree.QTNode, {
  13900. //fx : null, //fy : null,
  13901. _x1 : 0, _y1 : 0, _x2 : 0, _y2 : 0,
  13902. i : -1,
  13903. constructor : function(x1, y1, x2, y2, fx, fy) {
  13904. this._x1 = x1;
  13905. this._y1 = y1;
  13906. this._x2 = x2;
  13907. this._y2 = y2;
  13908. this.fx = fx;
  13909. this.fy = fy;
  13910. },
  13911. /**
  13912. * 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.
  13913. * @param (com.ibm.rave.core.geom.QuadTree.Visitor) visitor specified callback
  13914. */
  13915. /** @expose */
  13916. visit : function(visitor) {
  13917. com_ibm_rave_core_geom_QuadTree.quadtreeVisit(visitor, this, this._x1, this._y1, this._x2, this._y2);
  13918. },
  13919. /**
  13920. * Find the closest point to the specified point.
  13921. * @param (Array) point1 the source point
  13922. * @return (java.lang.Object) the closest point
  13923. */
  13924. /** @expose */
  13925. find : function(point1) {
  13926. 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;
  13927. },
  13928. /**
  13929. * Adds the specified new point to the quadtree
  13930. * @param (java.lang.Object) d the specified new point to be added to the quadtree
  13931. */
  13932. /** @expose */
  13933. add : function(d) {
  13934. 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);
  13935. }
  13936. });
  13937. com_ibm_rave_core_geom_QuadTree.Finder = com_ibm_rave_core_nativeImpl_Declare({
  13938. //closestPoint : null,
  13939. x : 0, y : 0,
  13940. x0 : 0, y0 : 0, x3 : 0, y3 : 0, minDistance2 : Infinity,
  13941. constructor : function(x, y, x0, y0, x3, y3) {
  13942. this.x = x;
  13943. this.y = y;
  13944. this.x0 = x0;
  13945. this.y0 = y0;
  13946. this.x3 = x3;
  13947. this.y3 = y3;
  13948. },
  13949. find : function(node, x1, y1, x2, y2) {
  13950. var _node = node;
  13951. if (x1 > this.x3 || y1 > this.y3 || x2 < this.x0 || y2 < this.y0) {
  13952. return this;
  13953. }
  13954. var point = _node.point;
  13955. if (point) {
  13956. var dx = this.x - _node.x;
  13957. var dy = this.y - _node.y;
  13958. var distance2 = dx * dx + dy * dy;
  13959. if (distance2 < this.minDistance2) {
  13960. var distance = Math.sqrt(this.minDistance2 = distance2);
  13961. this.x0 = this.x - distance;
  13962. this.y0 = this.y - distance;
  13963. this.x3 = this.x + distance;
  13964. this.y3 = this.y + distance;
  13965. this.closestPoint = point;
  13966. }
  13967. }
  13968. var children = _node.nodes;
  13969. var xm = (x1 + x2) * .5;
  13970. var ym = (y1 + y2) * .5;
  13971. var right = +(this.x >= xm);
  13972. var below = +(this.y >= ym);
  13973. for (var i = below << 1 | right, j = i + 4; i < j; ++i) {
  13974. if ((_node = children[i & 3])) {
  13975. switch (i & 3) {
  13976. case 0:
  13977. this.find(_node, x1, y1, xm, ym);
  13978. break;
  13979. case 1:
  13980. this.find(_node, xm, y1, x2, ym);
  13981. break;
  13982. case 2:
  13983. this.find(_node, x1, ym, xm, y2);
  13984. break;
  13985. case 3:
  13986. this.find(_node, xm, ym, x2, y2);
  13987. break;
  13988. }
  13989. }
  13990. }
  13991. return this;
  13992. }
  13993. });
  13994. // $source: com/ibm/rave/core/geom/Geom
  13995. /************************************************************************
  13996. ** IBM Confidential
  13997. **
  13998. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13999. **
  14000. ** (C) Copyright IBM Corp. 2017
  14001. **
  14002. ** The source code for this program is not published or otherwise divested of its trade secrets,
  14003. ** irrespective of what has been deposited with the U.S. Copyright Office.
  14004. ************************************************************************/
  14005. // GENERATED
  14006. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // bind, declare
  14007. //@import com/ibm/rave/core/geom/QuadTree (loadtime) // createQuadTree
  14008. //@import com/ibm/rave/core/geom/Polygon (runtime) // new
  14009. //@import com/ibm/rave/core/geom/Voronoi (runtime) // new
  14010. //@import com/ibm/rave/core/geom/Hull (runtime) // new
  14011. var com_ibm_rave_core_geom_Geom = com_ibm_rave_core_nativeImpl_Declare({
  14012. /**
  14013. * @see this.QuadTree#this.createQuadTree()
  14014. */
  14015. quadtree$0 : com_ibm_rave_core_geom_QuadTree.createQuadTree,
  14016. /**
  14017. * @see this.QuadTree#this.createQuadTree(Array)
  14018. */
  14019. quadtree$1 : com_ibm_rave_core_geom_QuadTree.createQuadTree,
  14020. /**
  14021. * @see this.QuadTree#this.createQuadTree(Array, , , , )
  14022. */
  14023. quadtree$2 : com_ibm_rave_core_geom_QuadTree.createQuadTree,
  14024. /**
  14025. * @see this.QuadTree#this.createQuadTree(Array, , )
  14026. */
  14027. quadtree$3 : com_ibm_rave_core_geom_QuadTree.createQuadTree,
  14028. /**
  14029. * Creates a polygon from the specified array of points.
  14030. * @param (Array) coordinates an array of points
  14031. * @return (com.ibm.rave.core.geom.Polygon) the polygon
  14032. */
  14033. /** @expose */
  14034. polygon : function(coordinates) {
  14035. return new com_ibm_rave_core_geom_Polygon(coordinates);
  14036. },
  14037. /**
  14038. * Create a Voronoi layout with default accessors.
  14039. * @return (com.ibm.rave.core.geom.Voronoi) the Voronoi layout object
  14040. */
  14041. voronoi$0 : function() {
  14042. return new com_ibm_rave_core_geom_Voronoi();
  14043. },
  14044. /**
  14045. * Create a Voronoi layout with default accessors, and run the layout.
  14046. * @param (Array) data
  14047. * @return (Array) an array of polygons
  14048. * @deprecated use {@link this.Geom#this.voronoi()} instead
  14049. */
  14050. voronoi$1 : function(data) {
  14051. return new com_ibm_rave_core_geom_Voronoi()(data);
  14052. },
  14053. /**
  14054. * Create a Hull layout with default accessors
  14055. * @return (com.ibm.rave.core.geom.Hull) a new Hull object
  14056. */
  14057. hull$0 : function() {
  14058. return new com_ibm_rave_core_geom_Hull();
  14059. },
  14060. /**
  14061. * Create a Hull layout with default accessors, and run the layout.
  14062. * @param (Array) data
  14063. * @return (Array) a new Hull object
  14064. */
  14065. hull$1 : function(data) {
  14066. return new com_ibm_rave_core_geom_Hull()(data);
  14067. },
  14068. /**
  14069. * 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.
  14070. * @param (Array) vertices array of data
  14071. * @return (Array) array of triangles
  14072. * @deprecated use {@link #this.voronoi()} {@link this.Voronoi#this.triangles(Array)} instead
  14073. */
  14074. /** @expose */
  14075. delaunay : function(vertices) {
  14076. return new com_ibm_rave_core_geom_Voronoi().triangles((vertices));
  14077. },
  14078. /** @expose */
  14079. quadtree : com_ibm_rave_core_nativeImpl_Declare.bind(function(a0, a1, a2, a3, a4) {
  14080. var args = arguments;
  14081. if (args.length == 0) {
  14082. return this.quadtree$0();
  14083. }
  14084. if (args.length == 1) {
  14085. return this.quadtree$1(a0);
  14086. }
  14087. if (args.length == 3) {
  14088. return this.quadtree$3(a0, a1, a2);
  14089. }
  14090. return this.quadtree$2(a0, a1, a2, a3, a4);
  14091. }),
  14092. /** @expose */
  14093. voronoi : com_ibm_rave_core_nativeImpl_Declare.bind(function(a0) {
  14094. var args = arguments;
  14095. if (args.length == 0) {
  14096. return this.voronoi$0();
  14097. }
  14098. return this.voronoi$1(a0);
  14099. }),
  14100. /** @expose */
  14101. hull : com_ibm_rave_core_nativeImpl_Declare.bind(function(a0) {
  14102. var args = arguments;
  14103. if (args.length == 0) {
  14104. return this.hull$0();
  14105. }
  14106. return this.hull$1(a0);
  14107. })
  14108. //constructor : function() {}
  14109. });
  14110. /** @expose */
  14111. com_ibm_rave_core_geom_Geom.INSTANCE = new com_ibm_rave_core_geom_Geom();
  14112. // $source: com/ibm/rave/core/geom/Polygon
  14113. /************************************************************************
  14114. ** IBM Confidential
  14115. **
  14116. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  14117. **
  14118. ** (C) Copyright IBM Corp. 2017
  14119. **
  14120. ** The source code for this program is not published or otherwise divested of its trade secrets,
  14121. ** irrespective of what has been deposited with the U.S. Copyright Office.
  14122. ************************************************************************/
  14123. // GENERATED
  14124. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  14125. //@import com/ibm/rave/core/internal/geom/PolygonUtil (runtime) // polygonIntersect
  14126. var com_ibm_rave_core_geom_Polygon = rave_externs["Polygon"] = com_ibm_rave_core_nativeImpl_Declare(Array, {
  14127. /** @expose */
  14128. constructor : function(coordinates) {
  14129. com_ibm_rave_core_geom_Polygon.addCollection(this, coordinates);
  14130. },
  14131. /**
  14132. * Returns the signed area of this polygon. If the vertices are in counterclockwise order, the area is positive, otherwise it is negative.
  14133. * @return (double) the signed area
  14134. */
  14135. /** @expose */
  14136. area : function() {
  14137. var i = -1;
  14138. var n = this.length;
  14139. var a;
  14140. var b = this[n - 1];
  14141. var area = 0;
  14142. while (++i < n) {
  14143. a = b;
  14144. b = this[i];
  14145. area += a[1] * b[0] - a[0] * b[1];
  14146. }
  14147. return area * .5;
  14148. },
  14149. /**
  14150. * Returns a two-element array representing the centroid of this polygon.
  14151. * @return (Array) the centroid
  14152. */
  14153. centroid$0 : function() {
  14154. var i = -1;
  14155. var n = this.length;
  14156. var x = 0;
  14157. var y = 0;
  14158. var a;
  14159. var b = this[n - 1];
  14160. var c = 0;
  14161. var k = -1 / (6 * this.area());
  14162. while (++i < n) {
  14163. a = b;
  14164. b = this[i];
  14165. c = a[0] * b[1] - b[0] * a[1];
  14166. x += (a[0] + b[0]) * c;
  14167. y += (a[1] + b[1]) * c;
  14168. }
  14169. return [x * k, y * k];
  14170. },
  14171. /**
  14172. * Returns a two-element array representing the centroid of this polygon.
  14173. * @param (double) k centroid factor
  14174. * @return (Array) Array representing the centroid of this polygon
  14175. */
  14176. centroid$1 : function(k) {
  14177. var i = -1;
  14178. var n = this.length;
  14179. var x = 0;
  14180. var y = 0;
  14181. var a;
  14182. var b = this[n - 1];
  14183. var c = 0;
  14184. while (++i < n) {
  14185. a = b;
  14186. b = this[i];
  14187. c = a[0] * b[1] - b[0] * a[1];
  14188. x += (a[0] + b[0]) * c;
  14189. y += (a[1] + b[1]) * c;
  14190. }
  14191. return [x * k, y * k];
  14192. },
  14193. /**
  14194. * 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.
  14195. * @param (Array) subject the polygon to intersect with
  14196. * @return (Array) the intersection polygon
  14197. */
  14198. /** @expose */
  14199. clip : function(subject) {
  14200. var closed = com_ibm_rave_core_geom_Polygon.geom_polygonClosed(subject);
  14201. var i = -1;
  14202. var n = this.length;
  14203. if (com_ibm_rave_core_geom_Polygon.geom_polygonClosed(this)) {
  14204. n--;
  14205. }
  14206. var j = 0;
  14207. var m = 0;
  14208. var a = this[n - 1], b, c, d;
  14209. var _subject = subject;
  14210. while (++i < n) {
  14211. var input = [];
  14212. for (var __i_enFor0 = 0, __exp_enFor0 = _subject, __len_enFor0 = __exp_enFor0.length;
  14213. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  14214. var val = __exp_enFor0[__i_enFor0];
  14215. input.push(val);
  14216. }
  14217. _subject = [];
  14218. b = this[i];
  14219. m = input.length;
  14220. if (closed) {
  14221. m--;
  14222. }
  14223. c = input[m - 1];
  14224. j = -1;
  14225. while (++j < m) {
  14226. d = input[j];
  14227. if (com_ibm_rave_core_geom_Polygon.geom_polygonInside(d, a, b)) {
  14228. if (!(com_ibm_rave_core_geom_Polygon.geom_polygonInside(c, a, b))) {
  14229. _subject.push(com_ibm_rave_core_internal_geom_PolygonUtil.polygonIntersect(c, d, a, b));
  14230. }
  14231. _subject.push(d);
  14232. } else if (com_ibm_rave_core_geom_Polygon.geom_polygonInside(c, a, b)) {
  14233. _subject.push(com_ibm_rave_core_internal_geom_PolygonUtil.polygonIntersect(c, d, a, b));
  14234. }
  14235. c = d;
  14236. }
  14237. if (closed) {
  14238. _subject.push(_subject[0]);
  14239. }
  14240. a = b;
  14241. }
  14242. return _subject;
  14243. },
  14244. /** @expose */
  14245. centroid : function(a0) {
  14246. var args = arguments;
  14247. if (args.length == 0) {
  14248. return this.centroid$0();
  14249. }
  14250. return this.centroid$1(a0);
  14251. }
  14252. });
  14253. com_ibm_rave_core_geom_Polygon.addCollection = function(coordinates1, coordinates2) {
  14254. for (var index = 0; index < coordinates2.length; ++index) {
  14255. coordinates1.push(coordinates2[index]);
  14256. }
  14257. };
  14258. com_ibm_rave_core_geom_Polygon.geom_polygonInside = function(p, a, b) {
  14259. return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);
  14260. };
  14261. com_ibm_rave_core_geom_Polygon.geom_polygonClosed = function(subject) {
  14262. var a = subject[0];
  14263. var b = subject[subject.length - 1];
  14264. return !((a[0] - b[0]) || ((a[1] - b[1])));
  14265. };
  14266. // $source: com/ibm/rave/core/geom/Voronoi
  14267. /************************************************************************
  14268. ** IBM Confidential
  14269. **
  14270. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  14271. **
  14272. ** (C) Copyright IBM Corp. 2017
  14273. **
  14274. ** The source code for this program is not published or otherwise divested of its trade secrets,
  14275. ** irrespective of what has been deposited with the U.S. Copyright Office.
  14276. ************************************************************************/
  14277. // GENERATED
  14278. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  14279. //@import com/ibm/rave/core/svg/SVGLine (runtime) // SVGLine
  14280. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiContext (runtime) // new
  14281. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiEdge (runtime) // new
  14282. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiIndex (runtime) // voronoi
  14283. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiCell (runtime) // VoronoiCell
  14284. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiPolygon (runtime) // new
  14285. /**
  14286. * 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.
  14287. */
  14288. var com_ibm_rave_core_geom_Voronoi = rave_externs["Voronoi"] = com_ibm_rave_core_nativeImpl_Declare({
  14289. //clipExtentVal : null,
  14290. //fx : null,
  14291. //fy : null,
  14292. //voronoieContext : null,
  14293. //xVal : null,
  14294. //yVal : null,
  14295. _$functionClassMethod : function() {
  14296. var _$self = /**
  14297. * 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.
  14298. * @param (Array) data the data array
  14299. * @return (Array) an array of polygons
  14300. */
  14301. function(data) {
  14302. var polygons = new Array(data.length);
  14303. var x0 = _$self.clipExtentVal[0][0], y0 = _$self.clipExtentVal[0][1], x1 = _$self.clipExtentVal[1][0], y1 = _$self.clipExtentVal[1][1];
  14304. var cells = com_ibm_rave_core_internal_geom_voronoi_VoronoiIndex.voronoi(_$self.voronoieContext, _$self.sites(data), _$self.clipExtentVal).voronoiCells;
  14305. cells.forEach(function(cell, index, array) {
  14306. var edges = cell.edges;
  14307. var site = cell.site;
  14308. if (edges.length != 0) {
  14309. var len = edges.length;
  14310. var mappedArray = new com_ibm_rave_core_internal_geom_voronoi_VoronoiPolygon();
  14311. for (var i = 0; i < len; ++i) {
  14312. var currentValue = edges[i];
  14313. if (currentValue) {
  14314. var s = currentValue.start();
  14315. mappedArray.push([s.x, s.y]);
  14316. }
  14317. }
  14318. polygons[index] = mappedArray;
  14319. } else if (site.x >= x0 && site.x <= x1 && site.y >= y0 && site.y <= y1) {
  14320. var newPolygon = new com_ibm_rave_core_internal_geom_voronoi_VoronoiPolygon();
  14321. newPolygon.push([x0, y1], [x1, y1], [x1, y0], [x0, y0]);
  14322. polygons[index] = newPolygon;
  14323. } else {
  14324. polygons[index] = new com_ibm_rave_core_internal_geom_voronoi_VoronoiPolygon();
  14325. }
  14326. var polygon = polygons[index];
  14327. polygon.point = data[index];
  14328. return null;
  14329. });
  14330. return polygons;
  14331. };
  14332. return _$self;
  14333. },
  14334. constructor : function() {
  14335. this.clipExtentVal = com_ibm_rave_core_geom_Voronoi.DEFAULT_CLIPEXTENT;
  14336. this.fx = com_ibm_rave_core_svg_SVGLine.DEFAULT_X_FN;
  14337. this.fy = com_ibm_rave_core_svg_SVGLine.DEFAULT_Y_FN;
  14338. this.voronoieContext = new com_ibm_rave_core_internal_geom_voronoi_VoronoiContext();
  14339. this.xVal = this.fx;
  14340. this.yVal = this.fy;
  14341. },
  14342. sites : function(data) {
  14343. var self = this;
  14344. return data.map(function(d, i, array) {
  14345. var x = Math.round(+ (self.fx.call(this, d, i, -1)) / 1.0E-6) * 1.0E-6;
  14346. var y = Math.round(+ (self.fy.call(this, d, i, -1)) / 1.0E-6) * 1.0E-6;
  14347. var site = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(x, y);
  14348. site.i = i;
  14349. return site;
  14350. });
  14351. },
  14352. /**
  14353. * 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>
  14354. * @param (Array) data the data
  14355. * @return (Array) array of links
  14356. */
  14357. /** @expose */
  14358. links : function(data) {
  14359. var diagram = com_ibm_rave_core_internal_geom_voronoi_VoronoiIndex.voronoi(this.voronoieContext, this.sites(data), null);
  14360. var filtered = diagram.voronoiEdges.filter(function(edge, index, array) {
  14361. return edge.l && edge.r;
  14362. });
  14363. return filtered.map(function(currentValue, index, array) {
  14364. return new com_ibm_rave_core_geom_Voronoi.Edge(data[currentValue.l.i], data[currentValue.r.i]);
  14365. });
  14366. },
  14367. /**
  14368. * 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.
  14369. * @param (Array) data the data
  14370. * @return (Array) Array or Arrays of triangles
  14371. */
  14372. /** @expose */
  14373. triangles : function(data) {
  14374. var triangles = [];
  14375. var diagram = com_ibm_rave_core_internal_geom_voronoi_VoronoiIndex.voronoi(this.voronoieContext, this.sites(data), null);
  14376. var cells = diagram.voronoiCells;
  14377. cells.forEach(function(cell, i, array) {
  14378. var site = cell.site;
  14379. var edges = cell.edges.sort(com_ibm_rave_core_internal_geom_voronoi_VoronoiCell.voronoiHalfEdgeOrder);
  14380. var j = -1, m = edges.length;
  14381. var e1 = edges[m - 1].edge;
  14382. var s0, s1 = e1.l == site ? e1.r : e1.l;
  14383. while (++j < m) {
  14384. s0 = s1;
  14385. e1 = edges[j].edge;
  14386. s1 = e1.l == site ? e1.r : e1.l;
  14387. if (i < s0.i && i < s1.i && com_ibm_rave_core_geom_Voronoi.voronoiTriangleArea(site, s0, s1) < 0) {
  14388. triangles.push([data[i], data[s0.i], data[s1.i]]);
  14389. }
  14390. }
  14391. return null;
  14392. });
  14393. return triangles;
  14394. },
  14395. /**
  14396. * Gets the current clip extent which defaults to null.
  14397. * @return (double[][]) the current clip extent
  14398. */
  14399. clipExtent$0 : function() {
  14400. if (this.clipExtentVal == com_ibm_rave_core_geom_Voronoi.DEFAULT_CLIPEXTENT) {
  14401. return null;
  14402. }
  14403. return this.clipExtentVal;
  14404. },
  14405. /**
  14406. * 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.
  14407. * @param (double[][]) extent the clip extent
  14408. * @return (com.ibm.rave.core.geom.Voronoi) this Voronoi instance
  14409. */
  14410. clipExtent$1 : function(extent) {
  14411. if (!extent) {
  14412. this.clipExtentVal = com_ibm_rave_core_geom_Voronoi.DEFAULT_CLIPEXTENT;
  14413. } else {
  14414. this.clipExtentVal = extent;
  14415. }
  14416. return this;
  14417. },
  14418. /**
  14419. * @deprecated use {@link this.Voronoi#this.clipExtent()} instead
  14420. * @return (double[]) the size
  14421. */
  14422. size$0 : function() {
  14423. if (this.clipExtentVal == com_ibm_rave_core_geom_Voronoi.DEFAULT_CLIPEXTENT) {
  14424. return null;
  14425. }
  14426. return this.clipExtentVal[1];
  14427. },
  14428. /**
  14429. * Sets the size
  14430. * @deprecated use {@link this.Voronoi#this.clipExtent()} instead
  14431. * @param (double[]) size
  14432. * @return (com.ibm.rave.core.geom.Voronoi) this Voronoi instance
  14433. */
  14434. size$1 : function(size) {
  14435. if ((size)) {
  14436. var newClipExtentVal = [[0, 0], size];
  14437. this.clipExtentVal = newClipExtentVal;
  14438. }
  14439. return this;
  14440. },
  14441. /**
  14442. * Returns the current x-coordinate accessor Can be a double value or a function
  14443. * @return (Object) the x-coordinate accessor
  14444. */
  14445. x$0 : function() {
  14446. return this.xVal;
  14447. },
  14448. /**
  14449. * Sets the x-coordinate accessor to the passed constant.
  14450. * @param (double) _xVal the x constant
  14451. * @return (com.ibm.rave.core.geom.Voronoi) this Voronoi instance
  14452. */
  14453. x$1 : function(_xVal) {
  14454. this.fx = function(data, index, groupIndex) {
  14455. return _xVal;
  14456. };
  14457. this.xVal = _xVal;
  14458. return this;
  14459. },
  14460. /**
  14461. * Sets the x-coordinate accessor to the passed function.
  14462. * @param (com.ibm.rave.core.selector.ValueFunction) xFn the x function
  14463. * @return (com.ibm.rave.core.geom.Voronoi) this Voronoi instance
  14464. */
  14465. x$2 : function(xFn) {
  14466. this.fx = xFn;
  14467. this.xVal = this.fx;
  14468. return this;
  14469. },
  14470. /**
  14471. * Returns the current y-coordinate accessor Can be a double value or a function
  14472. * @return (Object) the y-coordinate accessor
  14473. */
  14474. y$0 : function() {
  14475. return this.yVal;
  14476. },
  14477. /**
  14478. * Sets the y-coordinate accessor to the passed constant.
  14479. * @param (double) _yVal the y constant
  14480. * @return (com.ibm.rave.core.geom.Voronoi) this Voronoi instance
  14481. */
  14482. y$1 : function(_yVal) {
  14483. this.fy = function(data, index, groupIndex) {
  14484. return _yVal;
  14485. };
  14486. this.yVal = _yVal;
  14487. return this;
  14488. },
  14489. /**
  14490. * Sets the y-coordinate accessor to the passed function.
  14491. * @param (com.ibm.rave.core.selector.ValueFunction) yFn the y function
  14492. * @return (com.ibm.rave.core.geom.Voronoi) this Voronoi instance
  14493. */
  14494. y$2 : function(yFn) {
  14495. this.fy = yFn;
  14496. this.yVal = this.fy;
  14497. return this;
  14498. },
  14499. /** @expose */
  14500. clipExtent : function(a0) {
  14501. var args = arguments;
  14502. if (args.length == 0) {
  14503. return this.clipExtent$0();
  14504. }
  14505. return this.clipExtent$1(a0);
  14506. },
  14507. /** @expose */
  14508. size : function(a0) {
  14509. var args = arguments;
  14510. if (args.length == 0) {
  14511. return this.size$0();
  14512. }
  14513. return this.size$1(a0);
  14514. },
  14515. /** @expose */
  14516. x : function(a0) {
  14517. var args = arguments;
  14518. if (args.length == 0) {
  14519. return this.x$0();
  14520. }
  14521. if (args.length == 1 && typeof a0 === "function") {
  14522. return this.x$2(a0);
  14523. }
  14524. return this.x$1(a0);
  14525. },
  14526. /** @expose */
  14527. y : function(a0) {
  14528. var args = arguments;
  14529. if (args.length == 0) {
  14530. return this.y$0();
  14531. }
  14532. if (args.length == 1 && typeof a0 === "function") {
  14533. return this.y$2(a0);
  14534. }
  14535. return this.y$1(a0);
  14536. }
  14537. });
  14538. com_ibm_rave_core_geom_Voronoi.voronoiTriangleArea = function(a, b, c) {
  14539. return (a.x - c.x) * (b.y - a.y) - (a.x - b.x) * (c.y - a.y);
  14540. };
  14541. /**
  14542. * 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>
  14543. * @param < (java.lang.Object) T > the type of the source and target nodes
  14544. */
  14545. com_ibm_rave_core_geom_Voronoi.Edge = rave_externs["Edge"] = com_ibm_rave_core_nativeImpl_Declare({
  14546. /**
  14547. * the source
  14548. */
  14549. /** @expose */
  14550. source : null,
  14551. /**
  14552. * the target
  14553. */
  14554. /** @expose */
  14555. target : null,
  14556. /**
  14557. * Constructor
  14558. * @param (java.lang.Object) source the source
  14559. * @param (java.lang.Object) target the target
  14560. */
  14561. /** @expose */
  14562. constructor : function(source, target) {
  14563. this.source = source;
  14564. this.target = target;
  14565. }
  14566. });
  14567. com_ibm_rave_core_geom_Voronoi.DEFAULT_CLIPEXTENT = [[-1e6, -1e6], [1e6, 1e6]];
  14568. // $source: com/ibm/rave/core/svg/LinePathGenerator
  14569. /************************************************************************
  14570. ** IBM Confidential
  14571. **
  14572. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  14573. **
  14574. ** (C) Copyright IBM Corp. 2017
  14575. **
  14576. ** The source code for this program is not published or otherwise divested of its trade secrets,
  14577. ** irrespective of what has been deposited with the U.S. Copyright Office.
  14578. ************************************************************************/
  14579. // GENERATED
  14580. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  14581. //@import com/ibm/rave/core/svg/SVGLine (runtime) // SVGLine
  14582. /**
  14583. * 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)
  14584. */
  14585. var com_ibm_rave_core_svg_LinePathGenerator = rave_externs["LinePathGenerator"] = com_ibm_rave_core_nativeImpl_Declare({
  14586. //definedFn : null,
  14587. //interpolateFn : null,
  14588. //fx : null,
  14589. //fy : null,
  14590. //interpolateKey : null,
  14591. //projectionFn : null,
  14592. tensionVal : 0.7,
  14593. xVal : 0,
  14594. yVal : 0,
  14595. _showMissingAsGap : true,
  14596. _$functionClassMethod : function() {
  14597. var _$self = /**
  14598. * 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 Example usage: <code> LinePathGenerator line = Rave.svg.line.create().x(xPointFunction).y(yPointFunction); svg.append("path") .datum(dataArray) .attr("d", line); </code>
  14599. * @param (Object) this the context for this function
  14600. * @param (Object) datum the data to use while building the path. Datum expected is java.util.List<?> consisting of Point objects or objects containing x,y coordinates accessible via fx and fy accessor functions respectively.
  14601. * @see ValueFunction#_$self.getValue(Object, Object, , )
  14602. */
  14603. function(datum, index, groupIndex) {
  14604. var segments = [];
  14605. var points = [];
  14606. var data = datum;
  14607. var i = -1;
  14608. var n = 0;
  14609. var d;
  14610. n = data.length;
  14611. while (++i < n) {
  14612. d = data[i];
  14613. if (_$self.definedFn.call(_$self, d, i, -1)) {
  14614. points.push([+ (!_$self.fx ? _$self.xVal : _$self.fx.call(this, d, i, -1)), + (!_$self.fy ? _$self.yVal : _$self.fy.call(this, d, i, -1))]);
  14615. } else if (_$self._showMissingAsGap && points.length != 0) {
  14616. segments.push("M", _$self.interpolateFn(_$self.projectionFn.call(this, points, -1, -1), _$self.tensionVal));
  14617. points = [];
  14618. }
  14619. }
  14620. if (points.length != 0) {
  14621. segments.push("M", _$self.interpolateFn(_$self.projectionFn.call(this, points, -1, -1), _$self.tensionVal));
  14622. }
  14623. return segments.length != 0 ? segments.join("") : null;
  14624. };
  14625. return _$self;
  14626. },
  14627. constructor : function(projection) {
  14628. this.definedFn = com_ibm_rave_core_svg_SVGLine.DEFAULT_DEFINED_FN;
  14629. this.interpolateFn = com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear;
  14630. this.fx = com_ibm_rave_core_svg_SVGLine.DEFAULT_X_FN;
  14631. this.fy = com_ibm_rave_core_svg_SVGLine.DEFAULT_Y_FN;
  14632. this.interpolateKey = this.interpolateFn.key;
  14633. /**
  14634. * Constructor, creates a line generator and sets the projection to use with it
  14635. * @param (com.ibm.rave.core.selector.ValueFunction) projection the projection to use for example {@link (com.ibm.rave.core.internal.util.Identity) Identity}
  14636. */
  14637. {
  14638. this.projectionFn = projection;
  14639. }
  14640. },
  14641. /**
  14642. * Gets the x-accessor, it can be a a function or constant.
  14643. * @return (Object) returns the x function or constant
  14644. */
  14645. x$0 : function() {
  14646. if (this.fx) {
  14647. return this.fx;
  14648. }
  14649. return this.xVal;
  14650. },
  14651. /**
  14652. * 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
  14653. * @param (com.ibm.rave.core.selector.ValueFunction) valFn the x-accessor
  14654. * @return (com.ibm.rave.core.svg.LinePathGenerator) the line path generator
  14655. */
  14656. x$1 : function(valFn) {
  14657. this.fx = valFn;
  14658. return this;
  14659. },
  14660. /**
  14661. * Sets the x-accessor to the constant.
  14662. * @param (double) xNewVal the constant value of x
  14663. * @return (com.ibm.rave.core.svg.LinePathGenerator) the line path generator
  14664. */
  14665. x$2 : function(xNewVal) {
  14666. this.fx = null;
  14667. this.xVal = xNewVal;
  14668. return this;
  14669. },
  14670. /**
  14671. * Gets the y-accessor, it can be a a function or constant.
  14672. * @return (Object) returns the yfunction or constant
  14673. */
  14674. y$0 : function() {
  14675. if (this.fy) {
  14676. return this.fy;
  14677. }
  14678. return this.yVal;
  14679. },
  14680. /**
  14681. * 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
  14682. * @param (com.ibm.rave.core.selector.ValueFunction) valFn the y-accessor
  14683. * @return (com.ibm.rave.core.svg.LinePathGenerator) the line path generator
  14684. */
  14685. y$1 : function(valFn) {
  14686. this.fy = valFn;
  14687. return this;
  14688. },
  14689. /**
  14690. * Sets the y-accessor to the constant.
  14691. * @param (double) yNewVal the constant value of y
  14692. * @return (com.ibm.rave.core.svg.LinePathGenerator) the line path generator
  14693. */
  14694. y$2 : function(yNewVal) {
  14695. this.fy = null;
  14696. this.yVal = yNewVal;
  14697. return this;
  14698. },
  14699. /**
  14700. * Gets the accessor function that controls where the line is defined. default defined is a function() { return true; }
  14701. * @return (com.ibm.rave.core.selector.ValueFunction) the defined function
  14702. */
  14703. defined$0 : function() {
  14704. return this.definedFn;
  14705. },
  14706. /**
  14707. * 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)
  14708. * @param (com.ibm.rave.core.selector.ValueFunction) valFn the function to use to decide if a point is defined
  14709. * @return (com.ibm.rave.core.svg.LinePathGenerator) this line path generator
  14710. */
  14711. defined$1 : function(valFn) {
  14712. this.definedFn = valFn;
  14713. return this;
  14714. },
  14715. /**
  14716. * Returns the current tension.
  14717. * @return (double) the tension
  14718. */
  14719. tension$0 : function() {
  14720. return this.tensionVal;
  14721. },
  14722. /**
  14723. * 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.
  14724. * @return (com.ibm.rave.core.svg.LinePathGenerator) this line path generator
  14725. */
  14726. tension$1 : function(tensionNewVal) {
  14727. this.tensionVal = tensionNewVal;
  14728. return this;
  14729. },
  14730. /**
  14731. * 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.
  14732. * @return (Object) string represent the interpolation type or teh custominterpolation function
  14733. */
  14734. interpolate$0 : function() {
  14735. return this.interpolateKey;
  14736. },
  14737. /**
  14738. * 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.
  14739. * @param (String) key the interpolation mode to use
  14740. * @return (com.ibm.rave.core.svg.LinePathGenerator) the Line Path generator
  14741. */
  14742. interpolate$1 : function(key) {
  14743. this.interpolateKey = key;
  14744. this.interpolateFn = com_ibm_rave_core_svg_SVGLine.r2_svg_lineInterpolators.get(key);
  14745. if (!this.interpolateFn) {
  14746. this.interpolateFn = com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear;
  14747. this.interpolateKey = this.interpolateFn.key;
  14748. }
  14749. return this;
  14750. },
  14751. /**
  14752. * 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.
  14753. * @param (com.ibm.rave.core.svg.AbstractLineInterpolator) valFn the function to call to do the interpolation
  14754. * @return (com.ibm.rave.core.svg.LinePathGenerator) the Line Path generator
  14755. */
  14756. interpolate$2 : function(valFn) {
  14757. this.interpolateKey = this.interpolateFn = valFn;
  14758. return this;
  14759. },
  14760. /**
  14761. * Configure whether lines generated should show a gap (line break) if a value is missing
  14762. * @param (boolean) state true (default) for a gap, false for a line across missing values
  14763. * @return (com.ibm.rave.core.svg.LinePathGenerator) the Line Path generator
  14764. */
  14765. /** @expose */
  14766. showMissingAsGap : function(state) {
  14767. this._showMissingAsGap = state;
  14768. return this;
  14769. },
  14770. /** @expose */
  14771. x : function(a0) {
  14772. var args = arguments;
  14773. if (args.length == 0) {
  14774. return this.x$0();
  14775. }
  14776. if (args.length == 1 && typeof a0 === "function") {
  14777. return this.x$1(a0);
  14778. }
  14779. return this.x$2(a0);
  14780. },
  14781. /** @expose */
  14782. y : function(a0) {
  14783. var args = arguments;
  14784. if (args.length == 0) {
  14785. return this.y$0();
  14786. }
  14787. if (args.length == 1 && typeof a0 === "function") {
  14788. return this.y$1(a0);
  14789. }
  14790. return this.y$2(a0);
  14791. },
  14792. /** @expose */
  14793. defined : function(a0) {
  14794. var args = arguments;
  14795. if (args.length == 0) {
  14796. return this.defined$0();
  14797. }
  14798. return this.defined$1(a0);
  14799. },
  14800. /** @expose */
  14801. tension : function(a0) {
  14802. var args = arguments;
  14803. if (args.length == 0) {
  14804. return this.tension$0();
  14805. }
  14806. return this.tension$1(a0);
  14807. },
  14808. /** @expose */
  14809. interpolate : function(a0) {
  14810. var args = arguments;
  14811. if (args.length == 0) {
  14812. return this.interpolate$0();
  14813. }
  14814. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  14815. return this.interpolate$1(a0);
  14816. }
  14817. return this.interpolate$2(a0);
  14818. }
  14819. });
  14820. // $source: com/ibm/rave/core/svg/AbstractLineInterpolator
  14821. /************************************************************************
  14822. ** IBM Confidential
  14823. **
  14824. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  14825. **
  14826. ** (C) Copyright IBM Corp. 2017
  14827. **
  14828. ** The source code for this program is not published or otherwise divested of its trade secrets,
  14829. ** irrespective of what has been deposited with the U.S. Copyright Office.
  14830. ************************************************************************/
  14831. // GENERATED
  14832. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  14833. /**
  14834. * Base class for all line interpolators
  14835. */
  14836. var com_ibm_rave_core_svg_AbstractLineInterpolator = rave_externs["AbstractLineInterpolator"] = com_ibm_rave_core_nativeImpl_Declare({
  14837. //reverse : null,
  14838. key : "",
  14839. closed : false,
  14840. /** @expose */
  14841. constructor : function(strKey, bClosed) {
  14842. this.key = strKey;
  14843. this.closed = bClosed;
  14844. },
  14845. /**
  14846. * The key of this interpolator
  14847. */
  14848. /** @expose */
  14849. getKey : function() {
  14850. return this.key;
  14851. },
  14852. /**
  14853. * Is this a closed interpolator or not
  14854. */
  14855. /** @expose */
  14856. isClosed : function() {
  14857. return this.closed;
  14858. },
  14859. /**
  14860. * Gets the reverse Interpolator for this Interpolator
  14861. * @return (com.ibm.rave.core.svg.AbstractLineInterpolator) the reverse interpolator, or NULL if none had been set
  14862. */
  14863. /** @expose */
  14864. getReverse : function() {
  14865. return this.reverse;
  14866. },
  14867. /**
  14868. * Sets the reverse Interpolator for this Interpolator
  14869. * @param (com.ibm.rave.core.svg.AbstractLineInterpolator) reverseIntepolator The reverse interpolator
  14870. */
  14871. /** @expose */
  14872. setReverse : function(reverseIntepolator) {
  14873. this.reverse = reverseIntepolator;
  14874. }
  14875. });
  14876. // $source: com/ibm/rave/core/internal/util/TrueFunction
  14877. /************************************************************************
  14878. ** IBM Confidential
  14879. **
  14880. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  14881. **
  14882. ** (C) Copyright IBM Corp. 2017
  14883. **
  14884. ** The source code for this program is not published or otherwise divested of its trade secrets,
  14885. ** irrespective of what has been deposited with the U.S. Copyright Office.
  14886. ************************************************************************/
  14887. // GENERATED
  14888. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  14889. /**
  14890. * Call back function that always return true
  14891. */
  14892. var com_ibm_rave_core_internal_util_TrueFunction = com_ibm_rave_core_nativeImpl_Declare({
  14893. _$functionClassMethod : function() {
  14894. var _$self = function(data, index, groupIndex) {
  14895. return true;
  14896. };
  14897. return _$self;
  14898. }
  14899. });
  14900. // $source: com/ibm/rave/core/svg/SVGLine
  14901. /************************************************************************
  14902. ** IBM Confidential
  14903. **
  14904. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  14905. **
  14906. ** (C) Copyright IBM Corp. 2017
  14907. **
  14908. ** The source code for this program is not published or otherwise divested of its trade secrets,
  14909. ** irrespective of what has been deposited with the U.S. Copyright Office.
  14910. ************************************************************************/
  14911. // GENERATED
  14912. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, declare anonymous
  14913. //@import com/ibm/rave/core/svg/LinePathGenerator (static) // new
  14914. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (runtime) // create
  14915. //@import com/ibm/rave/core/internal/util/Identity (static) // create
  14916. //@import com/ibm/rave/core/svg/AbstractLineInterpolator (static)
  14917. //@import com/ibm/rave/core/internal/util/TrueFunction (static) // new
  14918. var com_ibm_rave_core_svg_SVGLine = rave_externs["SVGLine"] = com_ibm_rave_core_nativeImpl_Declare({
  14919. });
  14920. /**
  14921. * 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
  14922. * @param (com.ibm.rave.core.selector.ValueFunction) projection
  14923. * @return (com.ibm.rave.core.svg.LinePathGenerator) line path generator {@link (com.ibm.rave.core.svg.LinePathGenerator) LinePathGenerator}
  14924. */
  14925. com_ibm_rave_core_svg_SVGLine.createLine$0 = function(projection) {
  14926. return new com_ibm_rave_core_svg_LinePathGenerator(projection);
  14927. };
  14928. /**
  14929. * 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
  14930. * @return (com.ibm.rave.core.svg.LinePathGenerator) line path generator {@link (com.ibm.rave.core.svg.LinePathGenerator) LinePathGenerator}
  14931. */
  14932. com_ibm_rave_core_svg_SVGLine.createLine$1 = function() {
  14933. return new com_ibm_rave_core_svg_LinePathGenerator(com_ibm_rave_core_svg_SVGLine.DEFAULT_PROJECTION);
  14934. };
  14935. com_ibm_rave_core_svg_SVGLine.r2_svg_lineHermite = function(points, tangents) {
  14936. if (tangents.length < 1 || (points.length != tangents.length && points.length != tangents.length + 2)) {
  14937. return com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear(points, 0);
  14938. }
  14939. var quad = points.length != tangents.length;
  14940. var path = "";
  14941. var p0 = points[0], p = points[1], t0 = tangents[0], t = t0;
  14942. var pi = 1;
  14943. if (quad) {
  14944. var x = (p[0] - t0[0] * 2 / 3);
  14945. var y = (p[1] - t0[1] * 2 / 3);
  14946. path+=("Q" + x + "," + y + "," + p[0] + "," + p[1]);
  14947. p0 = points[1];
  14948. pi = 2;
  14949. }
  14950. if (tangents.length > 1) {
  14951. t = tangents[1];
  14952. p = points[pi];
  14953. pi++;
  14954. path+=("C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]);
  14955. for (var i = 2; i < tangents.length; i++, pi++) {
  14956. p = points[pi];
  14957. t = tangents[i];
  14958. path+=("S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]);
  14959. }
  14960. }
  14961. if (quad) {
  14962. var lp = points[pi];
  14963. var x = (p[0] + t[0] * 2 / 3);
  14964. var y = (p[1] + t[1] * 2 / 3);
  14965. path+=("Q" + x + "," + y + "," + lp[0] + "," + lp[1]);
  14966. }
  14967. return path;
  14968. };
  14969. com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinalTangents = function(points, tension) {
  14970. var tangents = [];
  14971. var a = (1 - tension) / 2;
  14972. var p0, p1 = points[0], p2 = points[1];
  14973. var i = 1;
  14974. var n = points.length;
  14975. while (++i < n) {
  14976. p0 = p1;
  14977. p1 = p2;
  14978. p2 = points[i];
  14979. tangents.push([a * (p2[0] - p0[0]), a * (p2[1] - p0[1])]);
  14980. }
  14981. return tangents;
  14982. };
  14983. com_ibm_rave_core_svg_SVGLine.r2_svg_lineDot4 = function(a, b) {
  14984. return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
  14985. };
  14986. com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier = function(path, x, y) {
  14987. 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));
  14988. };
  14989. com_ibm_rave_core_svg_SVGLine.r2_svg_lineSlope = function(p0, p1) {
  14990. return (p1[1] - p0[1]) / (p1[0] - p0[0]);
  14991. };
  14992. com_ibm_rave_core_svg_SVGLine.r2_svg_lineFiniteDifferences = function(points) {
  14993. var i = 0, j = points.length - 1;
  14994. var m = [];
  14995. var p0 = points[0], p1 = points[1];
  14996. var d = com_ibm_rave_core_svg_SVGLine.r2_svg_lineSlope(p0, p1);
  14997. m.push(d);
  14998. while (++i < j) {
  14999. m.push((d + (d = com_ibm_rave_core_svg_SVGLine.r2_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2);
  15000. }
  15001. m.push(d);
  15002. return m;
  15003. };
  15004. com_ibm_rave_core_svg_SVGLine.r2_svg_lineMonotoneTangents = function(points) {
  15005. var tangents = [];
  15006. var d, a, b, s;
  15007. var m = com_ibm_rave_core_svg_SVGLine.r2_svg_lineFiniteDifferences(points);
  15008. var i = -1, j = points.length - 1;
  15009. while (++i < j) {
  15010. d = com_ibm_rave_core_svg_SVGLine.r2_svg_lineSlope(points[i], points[i + 1]);
  15011. if (Math.abs(d) < 1.0E-6) {
  15012. m[i] = 0;
  15013. m[i + 1] = 0;
  15014. } else {
  15015. a = m[i] / d;
  15016. b = m[i + 1] / d;
  15017. s = a * a + b * b;
  15018. if (s > 9) {
  15019. s = d * 3 / Math.sqrt(s);
  15020. m[i] = s * a;
  15021. m[i + 1] = s * b;
  15022. }
  15023. }
  15024. }
  15025. i = -1;
  15026. while (++i <= j) {
  15027. s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i]));
  15028. if (s != s) {
  15029. s = 0;
  15030. }
  15031. var difference = m[i] * s;
  15032. var s1 = ((s) ? s : 0);
  15033. var s2 = ((difference) ? difference : 0);
  15034. tangents.push([s1, s2]);
  15035. }
  15036. return tangents;
  15037. };
  15038. com_ibm_rave_core_svg_SVGLine.initialize_r2_svg_lineInterpolators = function() {
  15039. var r2_svg_lineInterpolators = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  15040. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear);
  15041. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinearClosed.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinearClosed);
  15042. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineStep.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineStep);
  15043. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineStepBefore.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineStepBefore);
  15044. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineStepAfter.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineStepAfter);
  15045. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasis.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasis);
  15046. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisOpen.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisOpen);
  15047. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisClosed.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisClosed);
  15048. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineBundle.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineBundle);
  15049. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinal.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinal);
  15050. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinalOpen.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinalOpen);
  15051. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinalClosed.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinalClosed);
  15052. r2_svg_lineInterpolators.set(com_ibm_rave_core_svg_SVGLine.r2_svg_lineMonotone.key, com_ibm_rave_core_svg_SVGLine.r2_svg_lineMonotone);
  15053. com_ibm_rave_core_svg_SVGLine.r2_svg_lineStepBefore.reverse = com_ibm_rave_core_svg_SVGLine.r2_svg_lineStepAfter;
  15054. com_ibm_rave_core_svg_SVGLine.r2_svg_lineStepAfter.reverse = com_ibm_rave_core_svg_SVGLine.r2_svg_lineStepBefore;
  15055. return r2_svg_lineInterpolators;
  15056. };
  15057. /** @expose */
  15058. com_ibm_rave_core_svg_SVGLine.createLine = function(a0) {
  15059. var args = arguments;
  15060. if (args.length == 0) {
  15061. return com_ibm_rave_core_svg_SVGLine.createLine$1();
  15062. }
  15063. return com_ibm_rave_core_svg_SVGLine.createLine$0(a0);
  15064. };
  15065. /** @expose */
  15066. com_ibm_rave_core_svg_SVGLine.DEFAULT_X_FN = function(data, index, groupIndex) {
  15067. return (data)[0];
  15068. };
  15069. /** @expose */
  15070. com_ibm_rave_core_svg_SVGLine.DEFAULT_Y_FN = function(data, index, groupIndex) {
  15071. return (data)[1];
  15072. };
  15073. com_ibm_rave_core_svg_SVGLine.DEFAULT_PROJECTION = com_ibm_rave_core_internal_util_Identity.create();
  15074. com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier1 = [0, 2 / 3, 1 / 3, 0];
  15075. com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier2 = [0, 1 / 3, 2 / 3, 0];
  15076. com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier3 = [0, 1 / 6, 2 / 3, 1 / 6];
  15077. com_ibm_rave_core_svg_SVGLine.r2_svg_lineStep = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  15078. _$functionClassMethod : function() {
  15079. var _$self = function(points, tension) {
  15080. var i = 0, n = points.length;
  15081. var p = points[0];
  15082. var path = [p[0], ",", p[1]];
  15083. while (++i < n) {
  15084. path.push("H", (p[0] + (p = points[i])[0]) / 2, "V", p[1]);
  15085. }
  15086. if (n > 1) {
  15087. path.push("H", p[0]);
  15088. }
  15089. return path.join("");
  15090. };
  15091. return _$self;
  15092. }
  15093. }))("step", false);
  15094. com_ibm_rave_core_svg_SVGLine.r2_svg_lineStepBefore = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  15095. _$functionClassMethod : function() {
  15096. var _$self = function(points, tension) {
  15097. var i = 0, n = points.length;
  15098. var p = points[0];
  15099. var path = [p[0], ",", p[1]];
  15100. while (++i < n) {
  15101. path.push("V", (p = points[i])[1], "H", p[0]);
  15102. }
  15103. return path.join("");
  15104. };
  15105. return _$self;
  15106. }
  15107. }))("step-before", false);
  15108. com_ibm_rave_core_svg_SVGLine.r2_svg_lineStepAfter = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  15109. _$functionClassMethod : function() {
  15110. var _$self = function(points, tension) {
  15111. var i = 0, n = points.length;
  15112. var p = points[0];
  15113. var path = [p[0], ",", p[1]];
  15114. while (++i < n) {
  15115. path.push("H", (p = points[i])[0], "V", p[1]);
  15116. }
  15117. return path.join("");
  15118. };
  15119. return _$self;
  15120. }
  15121. }))("step-after", false);
  15122. com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinalOpen = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  15123. _$functionClassMethod : function() {
  15124. var _$self = function(points, tension) {
  15125. 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));
  15126. };
  15127. return _$self;
  15128. }
  15129. }))("cardinal-open", false);
  15130. com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinalClosed = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  15131. _$functionClassMethod : function() {
  15132. var _$self = function(points, tension) {
  15133. if (points.length < 3) {
  15134. return com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear(points, tension);
  15135. }
  15136. var p1 = points[0];
  15137. points.push(p1);
  15138. var p2 = [];
  15139. p2.push(points[points.length - 2]);
  15140. var array = [];
  15141. array.push(points[1]);
  15142. p2 = p2.concat(points, array);
  15143. var tangents = com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinalTangents(p2, tension);
  15144. return p1 + com_ibm_rave_core_svg_SVGLine.r2_svg_lineHermite(points, tangents);
  15145. };
  15146. return _$self;
  15147. }
  15148. }))("cardinal-closed", true);
  15149. com_ibm_rave_core_svg_SVGLine.r2_svg_lineCardinal = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  15150. _$functionClassMethod : function() {
  15151. var _$self = function(points, tension) {
  15152. 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));
  15153. };
  15154. return _$self;
  15155. }
  15156. }))("cardinal", false);
  15157. com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasis = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  15158. _$functionClassMethod : function() {
  15159. var _$self = function(points, tension) {
  15160. if (points.length < 3) {
  15161. return com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear(points, tension);
  15162. }
  15163. var i = 1, n = points.length;
  15164. var pi = points[0];
  15165. var x0 = pi[0], y0 = pi[1];
  15166. var px = [x0, x0, x0, (pi = points[1])[0]];
  15167. var py = [y0, y0, y0, pi[1]];
  15168. 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)];
  15169. points.push(points[n - 1]);
  15170. while (++i <= n) {
  15171. pi = points[i];
  15172. px.shift();
  15173. px.push(pi[0]);
  15174. py.shift();
  15175. py.push(pi[1]);
  15176. com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier(path, px, py);
  15177. }
  15178. points.pop();
  15179. path.push("L", pi);
  15180. return path.join("");
  15181. };
  15182. return _$self;
  15183. }
  15184. }))("basis", false);
  15185. com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisOpen = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  15186. _$functionClassMethod : function() {
  15187. var _$self = function(points, tension) {
  15188. if (points.length < 4) {
  15189. return com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear(points, 0);
  15190. }
  15191. var path = [];
  15192. var i = -1, n = points.length;
  15193. var pi;
  15194. var px = [], py = [];
  15195. px.push(0);
  15196. py.push(0);
  15197. while (++i < 3) {
  15198. pi = points[i];
  15199. px.push(pi[0]);
  15200. py.push(pi[1]);
  15201. }
  15202. 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));
  15203. --i;
  15204. while (++i < n) {
  15205. pi = points[i];
  15206. px.shift();
  15207. px.push(pi[0]);
  15208. py.shift();
  15209. py.push(pi[1]);
  15210. com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier(path, px, py);
  15211. }
  15212. return path.join("");
  15213. };
  15214. return _$self;
  15215. }
  15216. }))("basis-open", false);
  15217. com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisClosed = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  15218. _$functionClassMethod : function() {
  15219. var _$self = function(points, tension) {
  15220. if (points.length < 4) {
  15221. return com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear(points, 0);
  15222. }
  15223. var i = -1, n = points.length, m = n + 4;
  15224. var pi;
  15225. var px = [], py = [];
  15226. while (++i < 4) {
  15227. pi = points[i % n];
  15228. px.push(pi[0]);
  15229. py.push(pi[1]);
  15230. }
  15231. 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)];
  15232. --i;
  15233. while (++i < m) {
  15234. pi = points[i % n];
  15235. px.shift();
  15236. px.push(pi[0]);
  15237. py.shift();
  15238. py.push(pi[1]);
  15239. com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasisBezier(path, px, py);
  15240. }
  15241. return path.join("");
  15242. };
  15243. return _$self;
  15244. }
  15245. }))("basis-closed", true);
  15246. com_ibm_rave_core_svg_SVGLine.r2_svg_lineBundle = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  15247. _$functionClassMethod : function() {
  15248. var _$self = function(points, tension) {
  15249. var n = points.length - 1;
  15250. if (n != 0) {
  15251. var p = points[0];
  15252. var x0 = p[0], y0 = p[1];
  15253. p = points[n];
  15254. var dx = p[0] - x0, dy = p[1] - y0;
  15255. var i = -1;
  15256. var t;
  15257. while (++i <= n) {
  15258. p = points[i];
  15259. t = i / n;
  15260. p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);
  15261. p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);
  15262. }
  15263. }
  15264. return com_ibm_rave_core_svg_SVGLine.r2_svg_lineBasis(points, 0);
  15265. };
  15266. return _$self;
  15267. }
  15268. }))("bundle", false);
  15269. /**
  15270. * Linear interpolation; generates "L" commands.
  15271. */
  15272. /** @expose */
  15273. com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  15274. _$functionClassMethod : function() {
  15275. var _$self = function(data, tension) {
  15276. return data.join("L");
  15277. };
  15278. return _$self;
  15279. }
  15280. }))("linear", false);
  15281. /**
  15282. * Closed Linear interpolation; generates "L" commands then close it with a "Z" command.
  15283. */
  15284. /** @expose */
  15285. com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinearClosed = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  15286. _$functionClassMethod : function() {
  15287. var _$self = function(data, tension) {
  15288. return com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear(data, tension) + "Z";
  15289. };
  15290. return _$self;
  15291. }
  15292. }))("linear-closed", true);
  15293. com_ibm_rave_core_svg_SVGLine.r2_svg_lineMonotone = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_svg_AbstractLineInterpolator], {
  15294. _$functionClassMethod : function() {
  15295. var _$self = function(points, tension) {
  15296. 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));
  15297. };
  15298. return _$self;
  15299. }
  15300. }))("monotone", false);
  15301. com_ibm_rave_core_svg_SVGLine.r2_svg_lineInterpolators = com_ibm_rave_core_svg_SVGLine.initialize_r2_svg_lineInterpolators();
  15302. com_ibm_rave_core_svg_SVGLine.DEFAULT_DEFINED_FN = new com_ibm_rave_core_internal_util_TrueFunction();
  15303. // $source: com/ibm/rave/core/internal/geom/voronoi/VoronoiContext
  15304. /************************************************************************
  15305. ** IBM Confidential
  15306. **
  15307. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  15308. **
  15309. ** (C) Copyright IBM Corp. 2017
  15310. **
  15311. ** The source code for this program is not published or otherwise divested of its trade secrets,
  15312. ** irrespective of what has been deposited with the U.S. Copyright Office.
  15313. ************************************************************************/
  15314. // GENERATED
  15315. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  15316. var com_ibm_rave_core_internal_geom_voronoi_VoronoiContext = com_ibm_rave_core_nativeImpl_Declare({
  15317. //voronoiEdges : null,
  15318. //voronoiCells : null,
  15319. //voronoiBeaches : null,
  15320. //voronoiBeachPool : null,
  15321. //voronoiFirstCircle : null,
  15322. //voronoiCircles : null,
  15323. //voronoiCirclePool : null,
  15324. constructor : function() {
  15325. this.voronoiBeachPool = [];
  15326. this.voronoiCirclePool = [];
  15327. }
  15328. });
  15329. // $source: com/ibm/rave/core/geom/Line
  15330. /************************************************************************
  15331. ** IBM Confidential
  15332. **
  15333. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  15334. **
  15335. ** (C) Copyright IBM Corp. 2017
  15336. **
  15337. ** The source code for this program is not published or otherwise divested of its trade secrets,
  15338. ** irrespective of what has been deposited with the U.S. Copyright Office.
  15339. ************************************************************************/
  15340. // GENERATED
  15341. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  15342. /**
  15343. * A class representing a lint extending form point a to point b
  15344. */
  15345. var com_ibm_rave_core_geom_Line = rave_externs["Line"] = com_ibm_rave_core_nativeImpl_Declare({
  15346. //a : null,
  15347. //b : null,
  15348. /**
  15349. * @param (com.ibm.rave.core.geom.PointStruct) a point a
  15350. * @param (com.ibm.rave.core.geom.PointStruct) b point b
  15351. */
  15352. /** @expose */
  15353. constructor : function(a, b) {
  15354. this.a = a;
  15355. this.b = b;
  15356. },
  15357. /**
  15358. * A getter for point a
  15359. * @return (com.ibm.rave.core.geom.PointStruct) the a point
  15360. */
  15361. /** @expose */
  15362. getA : function() {
  15363. return this.a;
  15364. },
  15365. /**
  15366. * A setter for point a
  15367. * @param (com.ibm.rave.core.geom.PointStruct) a the a point to set
  15368. */
  15369. /** @expose */
  15370. setA : function(a) {
  15371. this.a = a;
  15372. },
  15373. /**
  15374. * A getter for point b
  15375. * @return (com.ibm.rave.core.geom.PointStruct) the b point
  15376. */
  15377. /** @expose */
  15378. getB : function() {
  15379. return this.b;
  15380. },
  15381. /**
  15382. * A setter for point b
  15383. * @param (com.ibm.rave.core.geom.PointStruct) b the b to set
  15384. */
  15385. /** @expose */
  15386. setB : function(b) {
  15387. this.b = b;
  15388. }
  15389. });
  15390. // $source: com/ibm/rave/core/internal/geom/voronoi/VoronoiEdge
  15391. /************************************************************************
  15392. ** IBM Confidential
  15393. **
  15394. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  15395. **
  15396. ** (C) Copyright IBM Corp. 2017
  15397. **
  15398. ** The source code for this program is not published or otherwise divested of its trade secrets,
  15399. ** irrespective of what has been deposited with the U.S. Copyright Office.
  15400. ************************************************************************/
  15401. // GENERATED
  15402. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  15403. //@import com/ibm/rave/core/geom/Line (loadtime) // superclass
  15404. //@import com/ibm/rave/core/geom/PointStruct (loadtime) // superclass
  15405. /**
  15406. * 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.
  15407. */
  15408. var com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_geom_Line, {
  15409. //l : null,
  15410. //r : null,
  15411. constructor : function(lSite, rSite) {
  15412. this.l = lSite;
  15413. this.r = rSite;
  15414. this.a = null;
  15415. this.b = null;
  15416. }
  15417. });
  15418. com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiCreateEdge = function(context, lSite, rSite, va, vb) {
  15419. var edge = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge(lSite, rSite);
  15420. context.voronoiEdges.push(edge);
  15421. if ((va)) {
  15422. com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiSetEdgeEnd(edge, lSite, rSite, va);
  15423. }
  15424. if ((vb)) {
  15425. com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiSetEdgeEnd(edge, rSite, lSite, vb);
  15426. }
  15427. context.voronoiCells[lSite.i].edges.push(new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiHalfEdge(edge, lSite, rSite));
  15428. context.voronoiCells[rSite.i].edges.push(new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiHalfEdge(edge, rSite, lSite));
  15429. return edge;
  15430. };
  15431. com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiSetEdgeEnd = function(edge, lSite, rSite, vertex) {
  15432. if (!edge.a && !edge.b) {
  15433. edge.a = vertex;
  15434. edge.l = lSite;
  15435. edge.r = rSite;
  15436. } else if (edge.l == rSite) {
  15437. edge.b = vertex;
  15438. } else {
  15439. edge.a = vertex;
  15440. }
  15441. };
  15442. com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiCreateBorderEdge = function(context, lSite, va, vb) {
  15443. var edge = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge(lSite, null);
  15444. edge.a = va;
  15445. edge.b = vb;
  15446. context.voronoiEdges.push(edge);
  15447. return edge;
  15448. };
  15449. com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_geom_PointStruct, {
  15450. i : 0
  15451. //constructor : function(x, y) {}
  15452. });
  15453. com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiHalfEdge = com_ibm_rave_core_nativeImpl_Declare({
  15454. //edge : null,
  15455. //site : null,
  15456. angle : 0,
  15457. constructor : function(edge, lSite, rSite) {
  15458. var va = edge.a, vb = edge.b;
  15459. this.edge = edge;
  15460. this.site = lSite;
  15461. 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);
  15462. },
  15463. start : function() {
  15464. return this.edge.l == this.site ? this.edge.a : this.edge.b;
  15465. },
  15466. end : function() {
  15467. return this.edge.l == this.site ? this.edge.b : this.edge.a;
  15468. }
  15469. });
  15470. // $source: com/ibm/rave/core/internal/geom/voronoi/VoronoiRedBlackTree
  15471. /************************************************************************
  15472. ** IBM Confidential
  15473. **
  15474. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  15475. **
  15476. ** (C) Copyright IBM Corp. 2017
  15477. **
  15478. ** The source code for this program is not published or otherwise divested of its trade secrets,
  15479. ** irrespective of what has been deposited with the U.S. Copyright Office.
  15480. ************************************************************************/
  15481. // GENERATED
  15482. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  15483. var com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree = com_ibm_rave_core_nativeImpl_Declare({
  15484. //root : null,
  15485. insert : function(after, node) {
  15486. var _after = after;
  15487. var parent, grandpa, uncle;
  15488. if (_after) {
  15489. node.P = _after;
  15490. node.N = _after.N;
  15491. if (_after.N) {
  15492. _after.N.P = node;
  15493. }
  15494. _after.N = node;
  15495. if (_after.R) {
  15496. _after = _after.R;
  15497. while (_after.L) {
  15498. _after = _after.L;
  15499. }
  15500. _after.L = node;
  15501. } else {
  15502. _after.R = node;
  15503. }
  15504. parent = _after;
  15505. } else if (this.root) {
  15506. _after = com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackFirst(this.root);
  15507. node.P = null;
  15508. node.N = _after;
  15509. _after.P = _after.L = node;
  15510. parent = _after;
  15511. } else {
  15512. node.P = node.N = null;
  15513. this.root = node;
  15514. parent = null;
  15515. }
  15516. node.L = node.R = null;
  15517. node.U = parent;
  15518. node.C = true;
  15519. _after = node;
  15520. while (parent && parent.C) {
  15521. grandpa = parent.U;
  15522. if (parent == grandpa.L) {
  15523. uncle = grandpa.R;
  15524. if (uncle && uncle.C) {
  15525. parent.C = uncle.C = false;
  15526. grandpa.C = true;
  15527. _after = grandpa;
  15528. } else {
  15529. if (_after == parent.R) {
  15530. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateLeft(this, parent);
  15531. _after = parent;
  15532. parent = _after.U;
  15533. }
  15534. parent.C = false;
  15535. grandpa.C = true;
  15536. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateRight(this, grandpa);
  15537. }
  15538. } else {
  15539. uncle = grandpa.L;
  15540. if (uncle && uncle.C) {
  15541. parent.C = uncle.C = false;
  15542. grandpa.C = true;
  15543. _after = grandpa;
  15544. } else {
  15545. if (_after == parent.L) {
  15546. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateRight(this, parent);
  15547. _after = parent;
  15548. parent = _after.U;
  15549. }
  15550. parent.C = false;
  15551. grandpa.C = true;
  15552. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateLeft(this, grandpa);
  15553. }
  15554. }
  15555. parent = _after.U;
  15556. }
  15557. this.root.C = false;
  15558. },
  15559. remove : function(node) {
  15560. var _node = node;
  15561. if (_node.N) {
  15562. _node.N.P = _node.P;
  15563. }
  15564. if (_node.P) {
  15565. _node.P.N = _node.N;
  15566. }
  15567. _node.N = _node.P = null;
  15568. var parent = _node.U, sibling, left = _node.L, right = _node.R, next;
  15569. var red;
  15570. if (!left) {
  15571. next = right;
  15572. } else if (!right) {
  15573. next = left;
  15574. } else {
  15575. next = com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackFirst(right);
  15576. }
  15577. if (parent) {
  15578. if (parent.L == _node) {
  15579. parent.L = next;
  15580. } else {
  15581. parent.R = next;
  15582. }
  15583. } else {
  15584. this.root = next;
  15585. }
  15586. if (left && right) {
  15587. red = next.C;
  15588. next.C = _node.C;
  15589. next.L = left;
  15590. left.U = next;
  15591. if (next != right) {
  15592. parent = next.U;
  15593. next.U = _node.U;
  15594. _node = next.R;
  15595. parent.L = _node;
  15596. next.R = right;
  15597. right.U = next;
  15598. } else {
  15599. next.U = parent;
  15600. parent = next;
  15601. _node = next.R;
  15602. }
  15603. } else {
  15604. red = _node.C;
  15605. _node = next;
  15606. }
  15607. if (_node) {
  15608. _node.U = parent;
  15609. }
  15610. if (red) {
  15611. return;
  15612. }
  15613. if (_node && _node.C) {
  15614. _node.C = false;
  15615. return;
  15616. }
  15617. do {
  15618. if (_node == this.root) {
  15619. break;
  15620. }
  15621. if (_node == parent.L) {
  15622. sibling = parent.R;
  15623. if (sibling.C) {
  15624. sibling.C = false;
  15625. parent.C = true;
  15626. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateLeft(this, parent);
  15627. sibling = parent.R;
  15628. }
  15629. if ((sibling.L && sibling.L.C) || (sibling.R && sibling.R.C)) {
  15630. if (!sibling.R || !sibling.R.C) {
  15631. sibling.L.C = false;
  15632. sibling.C = true;
  15633. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateRight(this, sibling);
  15634. sibling = parent.R;
  15635. }
  15636. sibling.C = parent.C;
  15637. parent.C = sibling.R.C = false;
  15638. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateLeft(this, parent);
  15639. _node = this.root;
  15640. break;
  15641. }
  15642. } else {
  15643. sibling = parent.L;
  15644. if (sibling.C) {
  15645. sibling.C = false;
  15646. parent.C = true;
  15647. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateRight(this, parent);
  15648. sibling = parent.L;
  15649. }
  15650. if ((sibling.L && sibling.L.C) || (sibling.R && sibling.R.C)) {
  15651. if (!sibling.L || !sibling.L.C) {
  15652. sibling.R.C = false;
  15653. sibling.C = true;
  15654. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateLeft(this, sibling);
  15655. sibling = parent.L;
  15656. }
  15657. sibling.C = parent.C;
  15658. parent.C = sibling.L.C = false;
  15659. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateRight(this, parent);
  15660. _node = this.root;
  15661. break;
  15662. }
  15663. }
  15664. sibling.C = true;
  15665. _node = parent;
  15666. parent = parent.U;
  15667. } while (!_node.C);
  15668. if (_node) {
  15669. _node.C = false;
  15670. }
  15671. }
  15672. });
  15673. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackNode = function(node) {
  15674. node.U = null;
  15675. node.C = false;
  15676. node.L = null;
  15677. node.R = null;
  15678. node.P = null;
  15679. node.N = null;
  15680. };
  15681. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateLeft = function(tree, node) {
  15682. var p = node, q = node.R, parent = p.U;
  15683. if (parent) {
  15684. if (parent.L == p) {
  15685. parent.L = q;
  15686. } else {
  15687. parent.R = q;
  15688. }
  15689. } else {
  15690. tree.root = q;
  15691. }
  15692. q.U = parent;
  15693. p.U = q;
  15694. p.R = q.L;
  15695. if (p.R) {
  15696. p.R.U = p;
  15697. }
  15698. q.L = p;
  15699. };
  15700. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackRotateRight = function(tree, node) {
  15701. var p = node, q = node.L, parent = p.U;
  15702. if (parent) {
  15703. if (parent.L == p) {
  15704. parent.L = q;
  15705. } else {
  15706. parent.R = q;
  15707. }
  15708. } else {
  15709. tree.root = q;
  15710. }
  15711. q.U = parent;
  15712. p.U = q;
  15713. p.L = q.R;
  15714. if (p.L) {
  15715. p.L.U = p;
  15716. }
  15717. q.R = p;
  15718. };
  15719. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackFirst = function(node) {
  15720. var retVal = node;
  15721. while (retVal.L) {
  15722. retVal = retVal.L;
  15723. }
  15724. return retVal;
  15725. };
  15726. // $source: com/ibm/rave/core/internal/geom/voronoi/VoronoiCell
  15727. /************************************************************************
  15728. ** IBM Confidential
  15729. **
  15730. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  15731. **
  15732. ** (C) Copyright IBM Corp. 2017
  15733. **
  15734. ** The source code for this program is not published or otherwise divested of its trade secrets,
  15735. ** irrespective of what has been deposited with the U.S. Copyright Office.
  15736. ************************************************************************/
  15737. // GENERATED
  15738. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  15739. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiEdge (static) // new, voronoiCreateBorderEdge
  15740. var com_ibm_rave_core_internal_geom_voronoi_VoronoiCell = com_ibm_rave_core_nativeImpl_Declare({
  15741. //site : null,
  15742. //edges : null,
  15743. constructor : function(site) {
  15744. this.site = site;
  15745. this.edges = [];
  15746. },
  15747. prepare : function() {
  15748. var halfEdges = this.edges;
  15749. var iHalfEdge = halfEdges.length;
  15750. var edge;
  15751. while (iHalfEdge-- > 0) {
  15752. edge = halfEdges[iHalfEdge].edge;
  15753. if (!edge.b || !edge.a) {
  15754. halfEdges.splice(iHalfEdge, 1);
  15755. }
  15756. }
  15757. halfEdges.sort(com_ibm_rave_core_internal_geom_voronoi_VoronoiCell.voronoiHalfEdgeOrder);
  15758. return halfEdges.length;
  15759. }
  15760. });
  15761. com_ibm_rave_core_internal_geom_voronoi_VoronoiCell.voronoiCloseCells = function(context, extent) {
  15762. var x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1], x2, y2, x3, y3;
  15763. var cells = context.voronoiCells;
  15764. var iCell = cells.length;
  15765. var cell;
  15766. var iHalfEdge;
  15767. var halfEdges;
  15768. var nHalfEdges;
  15769. var start;
  15770. var end;
  15771. while (iCell-- > 0) {
  15772. cell = cells[iCell];
  15773. if (!((cell)) || !((cell.prepare()))) {
  15774. continue;
  15775. }
  15776. halfEdges = cell.edges;
  15777. nHalfEdges = halfEdges.length;
  15778. iHalfEdge = 0;
  15779. while (iHalfEdge < nHalfEdges) {
  15780. end = halfEdges[iHalfEdge].end();
  15781. x3 = end.x;
  15782. y3 = end.y;
  15783. start = halfEdges[++iHalfEdge % nHalfEdges].start();
  15784. x2 = start.x;
  15785. y2 = start.y;
  15786. if (Math.abs(x3 - x2) > 1.0E-6 || Math.abs(y3 - y2) > 1.0E-6) {
  15787. 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));
  15788. ++nHalfEdges;
  15789. }
  15790. }
  15791. }
  15792. };
  15793. com_ibm_rave_core_internal_geom_voronoi_VoronoiCell.voronoiHalfEdgeOrder = function(a, b) {
  15794. if (b.angle > a.angle) {
  15795. return 1;
  15796. } else if (b.angle < a.angle) {
  15797. return -1;
  15798. }
  15799. return 0;
  15800. };
  15801. // $source: com/ibm/rave/core/internal/geom/voronoi/VoronoiCircle
  15802. /************************************************************************
  15803. ** IBM Confidential
  15804. **
  15805. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  15806. **
  15807. ** (C) Copyright IBM Corp. 2017
  15808. **
  15809. ** The source code for this program is not published or otherwise divested of its trade secrets,
  15810. ** irrespective of what has been deposited with the U.S. Copyright Office.
  15811. ************************************************************************/
  15812. // GENERATED
  15813. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  15814. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiRedBlackTree (static) // voronoiRedBlackNode
  15815. var com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle = com_ibm_rave_core_nativeImpl_Declare({
  15816. //x : null,
  15817. //y : null,
  15818. //arc : null,
  15819. //site : null,
  15820. //circle : null,
  15821. //cy : null,
  15822. //P : null,
  15823. //N : null,
  15824. //L : null,
  15825. //R : null,
  15826. //U : null,
  15827. //edge : null,
  15828. C : false,
  15829. constructor : function() {
  15830. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackNode(this);
  15831. }
  15832. });
  15833. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiDetachCircle = function(context, arc) {
  15834. var circle = arc.circle;
  15835. if ((circle)) {
  15836. if (!((circle.P))) {
  15837. context.voronoiFirstCircle = circle.N;
  15838. }
  15839. context.voronoiCircles.remove(circle);
  15840. context.voronoiCirclePool.push(circle);
  15841. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackNode(circle);
  15842. arc.circle = null;
  15843. }
  15844. };
  15845. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiAttachCircle = function(context, arc) {
  15846. var lArc = arc.P, rArc = arc.N;
  15847. if (!lArc || !rArc) {
  15848. return;
  15849. }
  15850. var lSite = lArc.site, cSite = arc.site, rSite = rArc.site;
  15851. if (lSite == rSite) {
  15852. return;
  15853. }
  15854. var bx = cSite.x, by = cSite.y, ax = lSite.x - bx, ay = lSite.y - by, cx = rSite.x - bx, cy = rSite.y - by;
  15855. var d = 2 * (ax * cy - ay * cx);
  15856. if (d >= -1.0E-12) {
  15857. return;
  15858. }
  15859. var ha = ax * ax + ay * ay, hc = cx * cx + cy * cy, x = (cy * ha - ay * hc) / d, y = (ax * hc - cx * ha) / d;
  15860. cy = y + by;
  15861. var circle = context.voronoiCirclePool.pop();
  15862. if (!((circle))) {
  15863. circle = new com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle();
  15864. }
  15865. circle.arc = arc;
  15866. circle.site = cSite;
  15867. circle.x = x + bx;
  15868. circle.y = cy + Math.sqrt(x * x + y * y);
  15869. circle.cy = cy;
  15870. arc.circle = circle;
  15871. var before, node = context.voronoiCircles.root;
  15872. while ((node)) {
  15873. if (circle.y < node.y || (circle.y == node.y && circle.x <= node.x)) {
  15874. if ((node.L)) {
  15875. node = node.L;
  15876. } else {
  15877. before = node.P;
  15878. break;
  15879. }
  15880. } else {
  15881. if ((node.R)) {
  15882. node = node.R;
  15883. } else {
  15884. before = node;
  15885. break;
  15886. }
  15887. }
  15888. }
  15889. context.voronoiCircles.insert(before, circle);
  15890. if (!((before))) {
  15891. context.voronoiFirstCircle = circle;
  15892. }
  15893. };
  15894. // $source: com/ibm/rave/core/internal/geom/voronoi/VoronoiBeach
  15895. /************************************************************************
  15896. ** IBM Confidential
  15897. **
  15898. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  15899. **
  15900. ** (C) Copyright IBM Corp. 2017
  15901. **
  15902. ** The source code for this program is not published or otherwise divested of its trade secrets,
  15903. ** irrespective of what has been deposited with the U.S. Copyright Office.
  15904. ************************************************************************/
  15905. // GENERATED
  15906. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  15907. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiCircle (loadtime) // superclass, voronoiAttachCircle, voronoiDetachCircle
  15908. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiRedBlackTree (static) // voronoiRedBlackNode
  15909. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiEdge (static) // new, voronoiCreateEdge, voronoiSetEdgeEnd
  15910. var com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle, {
  15911. constructor : function() {
  15912. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackNode(this);
  15913. }
  15914. });
  15915. com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiCreateBeach = function(context, site) {
  15916. var beach = context.voronoiBeachPool.pop();
  15917. if (!beach) {
  15918. beach = new com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach();
  15919. }
  15920. beach.site = site;
  15921. return beach;
  15922. };
  15923. com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiDetachBeach = function(context, beach) {
  15924. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiDetachCircle(context, beach);
  15925. context.voronoiBeaches.remove(beach);
  15926. context.voronoiBeachPool.push(beach);
  15927. com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree.voronoiRedBlackNode(beach);
  15928. };
  15929. com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiRemoveBeach = function(context, beach) {
  15930. var circle = beach.circle;
  15931. var x = circle.x;
  15932. var y = circle.cy;
  15933. var vertex = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(x, y);
  15934. var previous = beach.P, next = beach.N;
  15935. var disappearing = [beach];
  15936. com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiDetachBeach(context, beach);
  15937. var lArc = previous;
  15938. while (lArc.circle && Math.abs(x - lArc.circle.x) < 1.0E-6 && Math.abs(y - lArc.circle.cy) < 1.0E-6) {
  15939. previous = lArc.P;
  15940. disappearing.unshift(lArc);
  15941. com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiDetachBeach(context, lArc);
  15942. lArc = previous;
  15943. }
  15944. disappearing.unshift(lArc);
  15945. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiDetachCircle(context, lArc);
  15946. var rArc = next;
  15947. while (rArc.circle && Math.abs(x - rArc.circle.x) < 1.0E-6 && Math.abs(y - rArc.circle.cy) < 1.0E-6) {
  15948. next = rArc.N;
  15949. disappearing.push(rArc);
  15950. com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiDetachBeach(context, rArc);
  15951. rArc = next;
  15952. }
  15953. disappearing.push(rArc);
  15954. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiDetachCircle(context, rArc);
  15955. var nArcs = disappearing.length;
  15956. for (var iArc = 1; iArc < nArcs; ++iArc) {
  15957. rArc = disappearing[iArc];
  15958. lArc = disappearing[iArc - 1];
  15959. com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiSetEdgeEnd(rArc.edge, lArc.site, rArc.site, vertex);
  15960. }
  15961. lArc = disappearing[0];
  15962. rArc = disappearing[nArcs - 1];
  15963. rArc.edge = com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiCreateEdge(context, lArc.site, rArc.site, null, vertex);
  15964. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiAttachCircle(context, lArc);
  15965. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiAttachCircle(context, rArc);
  15966. };
  15967. com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiAddBeach = function(context, site) {
  15968. var x = site.x, directrix = site.y;
  15969. var lArc, rArc;
  15970. var dxl, dxr;
  15971. var node = context.voronoiBeaches.root;
  15972. while (node) {
  15973. dxl = com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiLeftBreakPoint(node, directrix) - x;
  15974. if (dxl > 1.0E-6) {
  15975. node = node.L;
  15976. } else {
  15977. dxr = x - com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiRightBreakPoint(node, directrix);
  15978. if (dxr > 1.0E-6) {
  15979. if (!node.R) {
  15980. lArc = node;
  15981. break;
  15982. }
  15983. node = node.R;
  15984. } else {
  15985. if (dxl > -1.0E-6) {
  15986. lArc = node.P;
  15987. rArc = node;
  15988. } else if (dxr > -1.0E-6) {
  15989. lArc = node;
  15990. rArc = node.N;
  15991. } else {
  15992. lArc = rArc = node;
  15993. }
  15994. break;
  15995. }
  15996. }
  15997. }
  15998. var newArc = com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiCreateBeach(context, site);
  15999. context.voronoiBeaches.insert(lArc, newArc);
  16000. if (!lArc && !rArc) {
  16001. return;
  16002. }
  16003. if (lArc == rArc) {
  16004. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiDetachCircle(context, lArc);
  16005. rArc = com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiCreateBeach(context, lArc.site);
  16006. context.voronoiBeaches.insert(newArc, rArc);
  16007. newArc.edge = rArc.edge = com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiCreateEdge(context, lArc.site, newArc.site, null, null);
  16008. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiAttachCircle(context, lArc);
  16009. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiAttachCircle(context, rArc);
  16010. return;
  16011. }
  16012. if (!rArc) {
  16013. newArc.edge = com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiCreateEdge(context, lArc.site, newArc.site, null, null);
  16014. return;
  16015. }
  16016. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiDetachCircle(context, lArc);
  16017. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiDetachCircle(context, rArc);
  16018. var lSite = lArc.site;
  16019. var ax = lSite.x, ay = lSite.y, bx = site.x - ax, by = site.y - ay;
  16020. var rSite = rArc.site;
  16021. 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;
  16022. var vertex = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite((cy * hb - by * hc) / d + ax, (bx * hc - cx * hb) / d + ay);
  16023. com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiSetEdgeEnd(rArc.edge, lSite, rSite, vertex);
  16024. newArc.edge = com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiCreateEdge(context, lSite, site, null, vertex);
  16025. rArc.edge = com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.voronoiCreateEdge(context, site, rSite, null, vertex);
  16026. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiAttachCircle(context, lArc);
  16027. com_ibm_rave_core_internal_geom_voronoi_VoronoiCircle.voronoiAttachCircle(context, rArc);
  16028. };
  16029. com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiLeftBreakPoint = function(arc, directrix) {
  16030. var site = arc.site;
  16031. var rfocx = site.x, rfocy = site.y, pby2 = rfocy - directrix;
  16032. if (!((pby2))) {
  16033. return rfocx;
  16034. }
  16035. var lArc = arc.P;
  16036. if (!lArc) {
  16037. return -Infinity;
  16038. }
  16039. site = lArc.site;
  16040. var lfocx = site.x, lfocy = site.y, plby2 = lfocy - directrix;
  16041. if (!((plby2))) {
  16042. return lfocx;
  16043. }
  16044. var hl = lfocx - rfocx, aby2 = 1 / pby2 - 1 / plby2, b = hl / plby2;
  16045. if ((aby2)) {
  16046. var sqRoot = Math.sqrt(b * b - 2 * aby2 * (hl * hl / (-2 * plby2) - lfocy + plby2 / 2 + rfocy - pby2 / 2));
  16047. return (-b + sqRoot) / aby2 + rfocx;
  16048. }
  16049. return (rfocx + lfocx) / 2;
  16050. };
  16051. com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiRightBreakPoint = function(arc, directrix) {
  16052. var rArc = arc.N;
  16053. if (rArc) {
  16054. return com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiLeftBreakPoint(rArc, directrix);
  16055. }
  16056. var site = arc.site;
  16057. return site.y == directrix ? site.x : Infinity;
  16058. };
  16059. // $source: com/ibm/rave/core/internal/geom/voronoi/VoronoiClip
  16060. /************************************************************************
  16061. ** IBM Confidential
  16062. **
  16063. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  16064. **
  16065. ** (C) Copyright IBM Corp. 2017
  16066. **
  16067. ** The source code for this program is not published or otherwise divested of its trade secrets,
  16068. ** irrespective of what has been deposited with the U.S. Copyright Office.
  16069. ************************************************************************/
  16070. // GENERATED
  16071. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  16072. //@import com/ibm/rave/core/geom/ClipLine (runtime) // create
  16073. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiEdge (static) // new
  16074. var com_ibm_rave_core_internal_geom_voronoi_VoronoiClip = com_ibm_rave_core_nativeImpl_Declare({
  16075. });
  16076. com_ibm_rave_core_internal_geom_voronoi_VoronoiClip.voronoiClipEdges = function(context, extent) {
  16077. var edges = context.voronoiEdges;
  16078. var clip = com_ibm_rave_core_geom_ClipLine.create(extent[0][0], extent[0][1], extent[1][0], extent[1][1], com_ibm_rave_core_internal_geom_voronoi_VoronoiClip.voronoiPointCreator);
  16079. var i = edges.length;
  16080. var e;
  16081. while (i-- > 0) {
  16082. e = edges[i];
  16083. 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)) {
  16084. e.a = null;
  16085. e.b = null;
  16086. edges.splice(i, 1);
  16087. }
  16088. }
  16089. };
  16090. com_ibm_rave_core_internal_geom_voronoi_VoronoiClip.voronoiConnectEdge = function(edge, extent) {
  16091. var vb = edge.b;
  16092. if (vb) {
  16093. return true;
  16094. }
  16095. var va = edge.a;
  16096. var x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1];
  16097. var lSite = edge.l, rSite = edge.r;
  16098. var lx = lSite.x, ly = lSite.y, rx = rSite.x, ry = rSite.y, fx = (lx + rx) / 2, fy = (ly + ry) / 2, fm, fb;
  16099. if (ry == ly) {
  16100. if (fx < x0 || fx >= x1) {
  16101. return false;
  16102. }
  16103. if (lx > rx) {
  16104. if (!va) {
  16105. va = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(fx, y0);
  16106. } else if (va.y >= y1) {
  16107. return false;
  16108. }
  16109. vb = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(fx, y1);
  16110. } else {
  16111. if (!va) {
  16112. va = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(fx, y1);
  16113. } else if (va.y < y0) {
  16114. return false;
  16115. }
  16116. vb = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(fx, y0);
  16117. }
  16118. } else {
  16119. fm = (lx - rx) / (ry - ly);
  16120. fb = fy - fm * fx;
  16121. if (fm < -1 || fm > 1) {
  16122. if (lx > rx) {
  16123. if (!va) {
  16124. va = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite((y0 - fb) / fm, y0);
  16125. } else if (va.y >= y1) {
  16126. return false;
  16127. }
  16128. vb = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite((y1 - fb) / fm, y1);
  16129. } else {
  16130. if (!va) {
  16131. va = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite((y1 - fb) / fm, y1);
  16132. } else if (va.y < y0) {
  16133. return false;
  16134. }
  16135. vb = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite((y0 - fb) / fm, y0);
  16136. }
  16137. } else {
  16138. if (ly < ry) {
  16139. if (!va) {
  16140. va = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(x0, fm * x0 + fb);
  16141. } else if (va.x >= x1) {
  16142. return false;
  16143. }
  16144. vb = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(x1, fm * x1 + fb);
  16145. } else {
  16146. if (!va) {
  16147. va = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(x1, fm * x1 + fb);
  16148. } else if (va.x < x0) {
  16149. return false;
  16150. }
  16151. vb = new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(x0, fm * x0 + fb);
  16152. }
  16153. }
  16154. }
  16155. edge.a = va;
  16156. edge.b = vb;
  16157. return true;
  16158. };
  16159. com_ibm_rave_core_internal_geom_voronoi_VoronoiClip.voronoiPointCreator = function(x, y) {
  16160. return new com_ibm_rave_core_internal_geom_voronoi_VoronoiEdge.VoronoiSite(x, y);
  16161. };
  16162. // $source: com/ibm/rave/core/internal/geom/voronoi/VoronoiIndex
  16163. /************************************************************************
  16164. ** IBM Confidential
  16165. **
  16166. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  16167. **
  16168. ** (C) Copyright IBM Corp. 2017
  16169. **
  16170. ** The source code for this program is not published or otherwise divested of its trade secrets,
  16171. ** irrespective of what has been deposited with the U.S. Copyright Office.
  16172. ************************************************************************/
  16173. // GENERATED
  16174. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  16175. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiRedBlackTree (static) // new
  16176. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiCell (static) // voronoiCloseCells, new
  16177. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiBeach (static) // voronoiAddBeach, voronoiRemoveBeach
  16178. //@import com/ibm/rave/core/internal/geom/voronoi/VoronoiClip (static) // voronoiClipEdges
  16179. var com_ibm_rave_core_internal_geom_voronoi_VoronoiIndex = com_ibm_rave_core_nativeImpl_Declare({
  16180. });
  16181. com_ibm_rave_core_internal_geom_voronoi_VoronoiIndex.voronoi = function(context, sites, bbox) {
  16182. var site = sites.sort(com_ibm_rave_core_internal_geom_voronoi_VoronoiIndex.voronoiVertexOrder).pop();
  16183. var x0 = -Infinity;
  16184. var y0 = -Infinity;
  16185. var circle;
  16186. context.voronoiEdges = [];
  16187. context.voronoiCells = new Array(sites.length);
  16188. context.voronoiBeaches = new com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree();
  16189. context.voronoiCircles = new com_ibm_rave_core_internal_geom_voronoi_VoronoiRedBlackTree();
  16190. while (true) {
  16191. circle = context.voronoiFirstCircle;
  16192. if (site && (!circle || site.y < circle.y || (site.y == circle.y && site.x < circle.x))) {
  16193. if (site.x != x0 || site.y != y0) {
  16194. context.voronoiCells[site.i] = new com_ibm_rave_core_internal_geom_voronoi_VoronoiCell(site);
  16195. com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiAddBeach(context, site);
  16196. x0 = site.x;
  16197. y0 = site.y;
  16198. }
  16199. site = sites.pop();
  16200. } else if (circle) {
  16201. com_ibm_rave_core_internal_geom_voronoi_VoronoiBeach.voronoiRemoveBeach(context, circle.arc);
  16202. } else {
  16203. break;
  16204. }
  16205. }
  16206. if ((bbox)) {
  16207. com_ibm_rave_core_internal_geom_voronoi_VoronoiClip.voronoiClipEdges(context, bbox);
  16208. com_ibm_rave_core_internal_geom_voronoi_VoronoiCell.voronoiCloseCells(context, bbox);
  16209. }
  16210. var diagram = new com_ibm_rave_core_internal_geom_voronoi_VoronoiIndex.VoronoiDiagram(context.voronoiCells, context.voronoiEdges);
  16211. context.voronoiBeaches = null;
  16212. context.voronoiCircles = null;
  16213. context.voronoiEdges = null;
  16214. context.voronoiCells = null;
  16215. return diagram;
  16216. };
  16217. com_ibm_rave_core_internal_geom_voronoi_VoronoiIndex.VoronoiDiagram = com_ibm_rave_core_nativeImpl_Declare({
  16218. //voronoiEdges : null,
  16219. //voronoiCells : null,
  16220. constructor : function(cells, edges) {
  16221. this.voronoiEdges = edges;
  16222. this.voronoiCells = cells;
  16223. }
  16224. });
  16225. com_ibm_rave_core_internal_geom_voronoi_VoronoiIndex.voronoiVertexOrder = function(a, b) {
  16226. var dresult = (b.y - a.y);
  16227. if (dresult == 0) {
  16228. dresult = (b.x - a.x);
  16229. }
  16230. if (dresult > 0) {
  16231. return 1;
  16232. }
  16233. if (dresult < 0) {
  16234. return -1;
  16235. }
  16236. return 0;
  16237. };
  16238. // $source: com/ibm/rave/core/geom/ClipLine
  16239. /************************************************************************
  16240. ** IBM Confidential
  16241. **
  16242. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  16243. **
  16244. ** (C) Copyright IBM Corp. 2017
  16245. **
  16246. ** The source code for this program is not published or otherwise divested of its trade secrets,
  16247. ** irrespective of what has been deposited with the U.S. Copyright Office.
  16248. ************************************************************************/
  16249. // GENERATED
  16250. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  16251. //@import com/ibm/rave/core/geom/PointStruct (runtime) // new
  16252. /**
  16253. * 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.
  16254. */
  16255. var com_ibm_rave_core_geom_ClipLine = rave_externs["ClipLine"] = com_ibm_rave_core_nativeImpl_Declare({
  16256. });
  16257. /**
  16258. * Creates the line clipper functor that could be used to clip a line if it is not within the boundaries of the specified box
  16259. * @param (double) x0 the x ccordinate of the upper corner clipping box
  16260. * @param (double) y0 the y ccordinate of the upper corner clipping box
  16261. * @param (double) x1 the y ccordinate of the lower corner clipping box
  16262. * @param (double) y1 the x ccordinate of the lower corner clipping box
  16263. * @return (com.ibm.rave.core.geom.ClipLine.LineClipper) return a new {@link (com.ibm.rave.core.geom.ClipLine.LineClipper) LineClipper} functor
  16264. */
  16265. com_ibm_rave_core_geom_ClipLine.create$0 = function(x0, y0, x1, y1) {
  16266. return new com_ibm_rave_core_geom_ClipLine.InnerClipper(x0, y0, x1, y1);
  16267. };
  16268. /**
  16269. * Creates the line clipper functor that could be used to clip a line if it is not within the boundaries of the specified box, and Allow passing a Point creator function
  16270. * @param (double) x0 the x ccordinate of the upper corner clipping box
  16271. * @param (double) y0 the y ccordinate of the upper corner clipping box
  16272. * @param (double) x1 the y ccordinate of the lower corner clipping box
  16273. * @param (double) y1 the x ccordinate of the lower corner clipping box
  16274. * @param (com.ibm.rave.core.geom.ClipLine.PointCreator) creator the function to call to create the point struct, this will come handy if you want to add extra members to the point struct used on the line.
  16275. * @return (com.ibm.rave.core.geom.ClipLine.LineClipper) return a new {@link (com.ibm.rave.core.geom.ClipLine.LineClipper) LineClipper} functor
  16276. */
  16277. com_ibm_rave_core_geom_ClipLine.create$1 = function(x0, y0, x1, y1, creator) {
  16278. var clipper = new com_ibm_rave_core_geom_ClipLine.InnerClipper(x0, y0, x1, y1);
  16279. clipper.pointCreator = creator;
  16280. return clipper;
  16281. };
  16282. /** @expose */
  16283. com_ibm_rave_core_geom_ClipLine.create = function(a0, a1, a2, a3, a4) {
  16284. var args = arguments;
  16285. if (args.length == 4) {
  16286. return com_ibm_rave_core_geom_ClipLine.create$0(a0, a1, a2, a3);
  16287. }
  16288. return com_ibm_rave_core_geom_ClipLine.create$1(a0, a1, a2, a3, a4);
  16289. };
  16290. com_ibm_rave_core_geom_ClipLine.InnerClipper = com_ibm_rave_core_nativeImpl_Declare({
  16291. //pointCreator : null,
  16292. x0 : 0,
  16293. y0 : 0,
  16294. x1 : 0,
  16295. y1 : 0,
  16296. _$functionClassMethod : function() {
  16297. var _$self = function(line) {
  16298. var a = line.a, b = line.b;
  16299. var ax = a.x, ay = a.y, bx = b.x, by = b.y, t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r;
  16300. r = _$self.x0 - ax;
  16301. if (!((dx)) && r > 0) {
  16302. return null;
  16303. }
  16304. r /= dx;
  16305. if (dx < 0) {
  16306. if (r < t0) {
  16307. return null;
  16308. }
  16309. if (r < t1) {
  16310. t1 = r;
  16311. }
  16312. } else if (dx > 0) {
  16313. if (r > t1) {
  16314. return null;
  16315. }
  16316. if (r > t0) {
  16317. t0 = r;
  16318. }
  16319. }
  16320. r = _$self.x1 - ax;
  16321. if (!((dx)) && r < 0) {
  16322. return null;
  16323. }
  16324. r /= dx;
  16325. if (dx < 0) {
  16326. if (r > t1) {
  16327. return null;
  16328. }
  16329. if (r > t0) {
  16330. t0 = r;
  16331. }
  16332. } else if (dx > 0) {
  16333. if (r < t0) {
  16334. return null;
  16335. }
  16336. if (r < t1) {
  16337. t1 = r;
  16338. }
  16339. }
  16340. r = _$self.y0 - ay;
  16341. if (!((dy)) && r > 0) {
  16342. return null;
  16343. }
  16344. r /= dy;
  16345. if (dy < 0) {
  16346. if (r < t0) {
  16347. return null;
  16348. }
  16349. if (r < t1) {
  16350. t1 = r;
  16351. }
  16352. } else if (dy > 0) {
  16353. if (r > t1) {
  16354. return null;
  16355. }
  16356. if (r > t0) {
  16357. t0 = r;
  16358. }
  16359. }
  16360. r = _$self.y1 - ay;
  16361. if (!((dy)) && r < 0) {
  16362. return null;
  16363. }
  16364. r /= dy;
  16365. if (dy < 0) {
  16366. if (r > t1) {
  16367. return null;
  16368. }
  16369. if (r > t0) {
  16370. t0 = r;
  16371. }
  16372. } else if (dy > 0) {
  16373. if (r < t0) {
  16374. return null;
  16375. }
  16376. if (r < t1) {
  16377. t1 = r;
  16378. }
  16379. }
  16380. if (t0 > 0) {
  16381. line.a = _$self.pointCreator(ax + t0 * dx, ay + t0 * dy);
  16382. }
  16383. if (t1 < 1) {
  16384. line.b = _$self.pointCreator(ax + t1 * dx, ay + t1 * dy);
  16385. }
  16386. return line;
  16387. };
  16388. return _$self;
  16389. },
  16390. constructor : function(x0, y0, x1, y1) {
  16391. this.pointCreator = com_ibm_rave_core_geom_ClipLine.DEFAULT_POINT_CREATOR;
  16392. {
  16393. this.x0 = x0;
  16394. this.y0 = y0;
  16395. this.x1 = x1;
  16396. this.y1 = y1;
  16397. }
  16398. }
  16399. });
  16400. com_ibm_rave_core_geom_ClipLine.DEFAULT_POINT_CREATOR = function(x, y) {
  16401. return new com_ibm_rave_core_geom_PointStruct(x, y);
  16402. };
  16403. // $source: com/ibm/rave/core/internal/geom/voronoi/VoronoiPolygon
  16404. /************************************************************************
  16405. ** IBM Confidential
  16406. **
  16407. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  16408. **
  16409. ** (C) Copyright IBM Corp. 2017
  16410. **
  16411. ** The source code for this program is not published or otherwise divested of its trade secrets,
  16412. ** irrespective of what has been deposited with the U.S. Copyright Office.
  16413. ************************************************************************/
  16414. // GENERATED
  16415. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  16416. var com_ibm_rave_core_internal_geom_voronoi_VoronoiPolygon = com_ibm_rave_core_nativeImpl_Declare(Array, {
  16417. //point : null
  16418. //constructor : function(elements) {}
  16419. });
  16420. // $source: com/ibm/rave/core/geom/Hull
  16421. /************************************************************************
  16422. ** IBM Confidential
  16423. **
  16424. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  16425. **
  16426. ** (C) Copyright IBM Corp. 2017
  16427. **
  16428. ** The source code for this program is not published or otherwise divested of its trade secrets,
  16429. ** irrespective of what has been deposited with the U.S. Copyright Office.
  16430. ************************************************************************/
  16431. // GENERATED
  16432. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  16433. //@import com/ibm/rave/core/internal/math/Trigonometry (static) // cross2d
  16434. /**
  16435. * Create a new hull layout with the default x- and y-accessors
  16436. */
  16437. var com_ibm_rave_core_geom_Hull = rave_externs["Hull"] = com_ibm_rave_core_nativeImpl_Declare({
  16438. //fx : null,
  16439. //fy : null,
  16440. //xVal : null,
  16441. //yVal : null,
  16442. _$functionClassMethod : function() {
  16443. var _$self = /**
  16444. * 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 [].
  16445. * @param (Array) vertices The specified vertices array
  16446. * @return (Array) the convex hull for the specified vertices array
  16447. */
  16448. function(vertices) {
  16449. if (!vertices || vertices.length < 3) {
  16450. return [];
  16451. }
  16452. var n = vertices.length;
  16453. var points = [];
  16454. var flippedPoints = [];
  16455. for (var i = 0; i < n; ++i) {
  16456. var p = new com_ibm_rave_core_geom_Hull.HullPoint();
  16457. p.x = + (_$self.fx(vertices[i], i));
  16458. p.y = + (_$self.fy(vertices[i], i));
  16459. p.index = i;
  16460. points.push(p);
  16461. }
  16462. points.sort(com_ibm_rave_core_geom_Hull.geom_hullOrder);
  16463. for (var i = 0; i < n; ++i) {
  16464. var point = new com_ibm_rave_core_geom_Hull.HullPoint();
  16465. point.x = points[i].x;
  16466. point.y = -points[i].y;
  16467. flippedPoints.push(point);
  16468. }
  16469. var upper = com_ibm_rave_core_geom_Hull.geom_hullUpper(points);
  16470. var lower = com_ibm_rave_core_geom_Hull.geom_hullUpper(flippedPoints);
  16471. var skipLeft = 0;
  16472. var skipRight = 0;
  16473. if ((lower[0] == null && upper[0] == null) || (~~ (lower[0]) == ~~ (upper[0]))) {
  16474. skipLeft = 1;
  16475. }
  16476. if ((lower[lower.length - 1] == null && upper[upper.length - 1] == null) || (~~ (lower[lower.length - 1]) == ~~ (upper[upper.length - 1]))) {
  16477. skipRight = 1;
  16478. }
  16479. var polygon = [];
  16480. for (var i = upper.length - 1; i >= 0; --i) {
  16481. var upperPoint = points[upper[i]];
  16482. polygon.push(vertices[upperPoint.index]);
  16483. }
  16484. for (var i = skipLeft; i < lower.length - skipRight; ++i) {
  16485. var lowerPoint = points[lower[i]];
  16486. polygon.push(vertices[lowerPoint.index]);
  16487. }
  16488. return polygon;
  16489. };
  16490. return _$self;
  16491. },
  16492. constructor : function() {
  16493. this.fx = com_ibm_rave_core_geom_Hull.FX_COMP_FN;
  16494. this.fy = com_ibm_rave_core_geom_Hull.FY_COMP_FN;
  16495. this.xVal = this.fx;
  16496. this.yVal = this.fy;
  16497. },
  16498. /**
  16499. * Returns the current x-coordinate accessor function. Defaults to returning the first value in the data point.
  16500. * @return (Object) the current x-coordinate accessor
  16501. */
  16502. x$0 : function() {
  16503. return this.xVal;
  16504. },
  16505. /**
  16506. * 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.
  16507. * @param (double) x The x-coordinate to use
  16508. * @return (com.ibm.rave.core.geom.Hull) the quadtree factory
  16509. */
  16510. x$1 : function(x) {
  16511. this.fx = function(data, i) {
  16512. if (!data) {
  16513. return undefined;
  16514. }
  16515. return x;
  16516. };
  16517. this.xVal = x;
  16518. return this;
  16519. },
  16520. /**
  16521. * 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.
  16522. * @param (com.ibm.rave.core.geom.Hull.HullFunction) x A new x-accessor to be used
  16523. * @return (com.ibm.rave.core.geom.Hull) the quadtree factory
  16524. */
  16525. x$2 : function(x) {
  16526. this.fx = x;
  16527. this.xVal = x;
  16528. return this;
  16529. },
  16530. /**
  16531. * Returns the current y-coordinate accessor. Defaults to returning the second value in the data point.
  16532. * @return (Object) the current y-coordinate accessor
  16533. */
  16534. y$0 : function() {
  16535. return this.yVal;
  16536. },
  16537. /**
  16538. * 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.
  16539. * @param (double) y The y-coordinate to use
  16540. * @return (com.ibm.rave.core.geom.Hull) the quadtree factory
  16541. */
  16542. y$1 : function(y) {
  16543. this.fy = function(data, i) {
  16544. if (!data) {
  16545. return undefined;
  16546. }
  16547. return y;
  16548. };
  16549. this.yVal = y;
  16550. return this;
  16551. },
  16552. /**
  16553. * 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.
  16554. * @param (com.ibm.rave.core.geom.Hull.HullFunction) y A new y-accessor to be used
  16555. * @return (com.ibm.rave.core.geom.Hull) the quadtree factory
  16556. */
  16557. y$2 : function(y) {
  16558. this.fy = y;
  16559. this.yVal = y;
  16560. return this;
  16561. },
  16562. /** @expose */
  16563. x : function(a0) {
  16564. var args = arguments;
  16565. if (args.length == 0) {
  16566. return this.x$0();
  16567. }
  16568. if (args.length == 1 && typeof a0 === "function") {
  16569. return this.x$2(a0);
  16570. }
  16571. return this.x$1(a0);
  16572. },
  16573. /** @expose */
  16574. y : function(a0) {
  16575. var args = arguments;
  16576. if (args.length == 0) {
  16577. return this.y$0();
  16578. }
  16579. if (args.length == 1 && typeof a0 === "function") {
  16580. return this.y$2(a0);
  16581. }
  16582. return this.y$1(a0);
  16583. }
  16584. });
  16585. com_ibm_rave_core_geom_Hull.geom_hullUpper = function(points) {
  16586. var n = points.length;
  16587. var hull = [0, 1];
  16588. var hs = 2;
  16589. for (var i = 2; i < n; ++i) {
  16590. 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) {
  16591. --hs;
  16592. }
  16593. hull[hs++] = i;
  16594. }
  16595. return hull.slice(0, hs);
  16596. };
  16597. com_ibm_rave_core_geom_Hull.HullPoint = com_ibm_rave_core_nativeImpl_Declare({
  16598. x : 0,
  16599. y : 0,
  16600. index : 0,
  16601. /** @expose */
  16602. toDoubleArray : function() {
  16603. return [this.x, this.y];
  16604. }
  16605. });
  16606. com_ibm_rave_core_geom_Hull.geom_hullOrder = function(a, b) {
  16607. var val = ~~(a.x - b.x);
  16608. if (val != 0) {
  16609. return val;
  16610. }
  16611. return ~~(a.y - b.y);
  16612. };
  16613. com_ibm_rave_core_geom_Hull.FX_COMP_FN = function(data, i) {
  16614. return data[0];
  16615. };
  16616. com_ibm_rave_core_geom_Hull.FY_COMP_FN = function(data, i) {
  16617. return data[1];
  16618. };
  16619. // $source: com/ibm/rave/core/scales/AbstractScale
  16620. /************************************************************************
  16621. ** IBM Confidential
  16622. **
  16623. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  16624. **
  16625. ** (C) Copyright IBM Corp. 2017
  16626. **
  16627. ** The source code for this program is not published or otherwise divested of its trade secrets,
  16628. ** irrespective of what has been deposited with the U.S. Copyright Office.
  16629. ************************************************************************/
  16630. // GENERATED
  16631. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  16632. /**
  16633. * 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", ...]).
  16634. * @param < (java.lang.Object) C > The context type.
  16635. * @param < (java.lang.Object) R > The return type (i.e. the value type the scale will return for a given domain value).
  16636. */
  16637. var com_ibm_rave_core_scales_AbstractScale = rave_externs["AbstractScale"] = com_ibm_rave_core_nativeImpl_Declare({
  16638. /**
  16639. * @expose
  16640. */
  16641. /** @expose */
  16642. invert : null,
  16643. /**
  16644. * @expose
  16645. */
  16646. /** @expose */
  16647. rangeExtent : null,
  16648. /**
  16649. * @expose
  16650. */
  16651. /** @expose */
  16652. rangeBand : null,
  16653. /**
  16654. * @expose
  16655. */
  16656. /** @expose */
  16657. ticks : null,
  16658. /**
  16659. * @expose
  16660. */
  16661. /** @expose */
  16662. tickFormat : null,
  16663. /**
  16664. * @expose
  16665. */
  16666. /** @expose */
  16667. zoomTransform : null,
  16668. /**
  16669. * @expose
  16670. */
  16671. /** @expose */
  16672. ticksInRange : null,
  16673. /**
  16674. * 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).
  16675. * @return (com.ibm.rave.core.scales.AbstractScale) A duplicate AbstractScale.
  16676. */
  16677. /** @expose */
  16678. copy : function() {},
  16679. /**
  16680. * Gets the tick format value function. if this scale does not support tick formatting then it will return null.
  16681. * @return (com.ibm.rave.core.scales.AbstractScale.TickFormatValueFunction) the tick format value function if it is supported or null if it isn't
  16682. */
  16683. /** @expose */
  16684. getTickFormat : function() {
  16685. return this.tickFormat;
  16686. },
  16687. /**
  16688. * Gets the range band value function. if this scale does not support this feature then it will return null.
  16689. * @return (com.ibm.rave.core.scales.AbstractScale.RangeBandValueFunction) the range band value function if it is supported or null if it isn't
  16690. */
  16691. /** @expose */
  16692. getRangeBand : function() {
  16693. return this.rangeBand;
  16694. },
  16695. /**
  16696. * Gets the range extent value function. if this scale does not support this feature then it will return null.
  16697. * @return (com.ibm.rave.core.scales.AbstractScale.RangeExtentValueFunction) the range extent value function if it is supported or null if it isn't
  16698. */
  16699. /** @expose */
  16700. getRangeExtent : function() {
  16701. return this.rangeExtent;
  16702. },
  16703. /**
  16704. * Gets the ticks value function. if this scale does not support this feature then it will return null.
  16705. * @return (com.ibm.rave.core.scales.AbstractScale.TicksValueFunction) the ticks value function if it is supported or null if it isn't
  16706. */
  16707. /** @expose */
  16708. getTicks : function() {
  16709. return this.ticks;
  16710. },
  16711. /**
  16712. * Gets the zoomTransform function. if this scale does not support this feature then it will return null.
  16713. * @return (com.ibm.rave.core.scales.AbstractScale.ZoomTransformFunction) the zoomTransform function if it is supported or null if it isn't
  16714. */
  16715. /** @expose */
  16716. getZoomTransform : function() {
  16717. return this.zoomTransform;
  16718. },
  16719. /**
  16720. * Gets the ticksInRange function. if this scale does not support this feature then it will return null.
  16721. * @return (com.ibm.rave.core.scales.AbstractScale.TicksInRangeFunction) the ticksInRange function if it is supported or null if it isn't
  16722. */
  16723. /** @expose */
  16724. getTicksInRange : function() {
  16725. return this.ticksInRange;
  16726. },
  16727. /**
  16728. * Gets the invert value function. if this scale does not support this feature then it will return null.
  16729. * @return (com.ibm.rave.core.scales.AbstractScale.InvertValueFunction) the invert value function if it is supported or null if it isn't
  16730. */
  16731. /** @expose */
  16732. getInvert : function() {
  16733. return this.invert;
  16734. },
  16735. /** @expose */
  16736. setInvert : function(invert) {
  16737. this.invert = invert;
  16738. },
  16739. /** @expose */
  16740. setRangeExtent : function(rangeExtent) {
  16741. this.rangeExtent = rangeExtent;
  16742. },
  16743. /** @expose */
  16744. setRangeBand : function(rangeBand) {
  16745. this.rangeBand = rangeBand;
  16746. },
  16747. /** @expose */
  16748. setTicks : function(ticks) {
  16749. this.ticks = ticks;
  16750. },
  16751. /** @expose */
  16752. setTickFormat : function(tickFormat) {
  16753. this.tickFormat = tickFormat;
  16754. },
  16755. /** @expose */
  16756. setZoomTransform : function(zoomTransform) {
  16757. this.zoomTransform = zoomTransform;
  16758. },
  16759. /** @expose */
  16760. setTicksInRange : function(ticksInRange) {
  16761. this.ticksInRange = ticksInRange;
  16762. },
  16763. /** @expose */
  16764. domain : function(a0) {
  16765. var args = arguments;
  16766. if (args.length == 0) {
  16767. return this.domain$1();
  16768. }
  16769. return this.domain$0(a0);
  16770. },
  16771. /** @expose */
  16772. range : function(a0) {
  16773. var args = arguments;
  16774. if (args.length == 0) {
  16775. return this.range$1();
  16776. }
  16777. return this.range$0(a0);
  16778. }
  16779. /**
  16780. * Set the scale's input domain.
  16781. * @param (Array) values Array of domain values.
  16782. * @return (com.ibm.rave.core.scales.AbstractScale) This scale instance.
  16783. */
  16784. //domain$0 : function(values) {},
  16785. /**
  16786. * Get the scale's domain.
  16787. * @return (Array) Array of domain values.
  16788. */
  16789. //domain$1 : function() {},
  16790. /**
  16791. * Set the scale's output range.
  16792. * @param (Array) values Array of range values.
  16793. * @return (com.ibm.rave.core.scales.AbstractScale) This scale instance.
  16794. */
  16795. //range$0 : function(values) {},
  16796. /**
  16797. * Get the scale's range.
  16798. * @return (Array) Array of range values.
  16799. */
  16800. //range$1 : function() {}
  16801. });
  16802. /**
  16803. * Returns a 2 element array containing the first and last values in the {@code range} parameter in ascending order.
  16804. * @param (Array) range An array of values, typically a Scale object's {@code range} .
  16805. * @return (Array) min and max extent of the range, stored in an array of length2.
  16806. */
  16807. /** @expose */
  16808. com_ibm_rave_core_scales_AbstractScale.scaleExtent = function(range) {
  16809. var start = range[0];
  16810. var stop = range[range.length - 1];
  16811. if ((typeof start === "number" || start instanceof Number) && (typeof stop === "number" || stop instanceof Number)) {
  16812. if ((start) > (stop)) {
  16813. return [stop, start];
  16814. }
  16815. }
  16816. return [start, stop];
  16817. };
  16818. /**
  16819. * 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.
  16820. * @param (com.ibm.rave.core.scales.AbstractScale) scale the scale to get the range extent for
  16821. * @return (Array) the scale's range extent
  16822. */
  16823. /** @expose */
  16824. com_ibm_rave_core_scales_AbstractScale.scaleRange = function(scale) {
  16825. if (scale.rangeExtent) {
  16826. return scale.rangeExtent();
  16827. }
  16828. return com_ibm_rave_core_scales_AbstractScale.scaleExtent(scale.range());
  16829. };
  16830. // $source: com/ibm/rave/core/internal/scales/Polylinear
  16831. /************************************************************************
  16832. ** IBM Confidential
  16833. **
  16834. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  16835. **
  16836. ** (C) Copyright IBM Corp. 2017
  16837. **
  16838. ** The source code for this program is not published or otherwise divested of its trade secrets,
  16839. ** irrespective of what has been deposited with the U.S. Copyright Office.
  16840. ************************************************************************/
  16841. // GENERATED
  16842. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  16843. //@import com/ibm/rave/core/Rave (runtime) // Rave
  16844. /**
  16845. * @author Bryan
  16846. */
  16847. var com_ibm_rave_core_internal_scales_Polylinear = com_ibm_rave_core_nativeImpl_Declare({
  16848. _$functionClassMethod : function() {
  16849. var _$self = function(domain, range, uninterpolate, interpolate) {
  16850. return new com_ibm_rave_core_internal_scales_Polylinear.PolylinearValuefunction(domain, range, uninterpolate, interpolate);
  16851. };
  16852. return _$self;
  16853. }
  16854. });
  16855. com_ibm_rave_core_internal_scales_Polylinear.PolylinearValuefunction = com_ibm_rave_core_nativeImpl_Declare({
  16856. //u : null,
  16857. //i : null,
  16858. //domain : null,
  16859. //range : null,
  16860. k : 0,
  16861. _$functionClassMethod : function() {
  16862. var _$self = function(x) {
  16863. var j = com_ibm_rave_core_Rave.bisect(_$self.domain, x, 1, _$self.k) - 1;
  16864. return _$self.i[j](+ (_$self.u[j](+ (x))));
  16865. };
  16866. return _$self;
  16867. },
  16868. constructor : function(inDomain, inRange, uninterpolate, interpolate) {
  16869. this.u = [];
  16870. this.i = [];
  16871. var j = 0;
  16872. this.domain = [];
  16873. for (var __i_enFor0 = 0, __exp_enFor0 = inDomain, __len_enFor0 = __exp_enFor0.length;
  16874. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  16875. var o = __exp_enFor0[__i_enFor0];
  16876. this.domain.push(o);
  16877. }
  16878. this.range = [];
  16879. for (var __i_enFor1 = 0, __exp_enFor1 = inRange, __len_enFor1 = __exp_enFor1.length;
  16880. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  16881. var o = __exp_enFor1[__i_enFor1];
  16882. this.range.push(o);
  16883. }
  16884. this.k = Math.min(this.domain.length, this.range.length) - 1;
  16885. if (+ (this.domain[this.k]) < + (this.domain[0])) {
  16886. this.domain = this.domain.slice().reverse();
  16887. this.range = this.range.slice().reverse();
  16888. }
  16889. while (++j <= this.k) {
  16890. this.u.push(uninterpolate(this.domain[j - 1], this.domain[j]));
  16891. this.i.push(interpolate(this.range[j - 1], this.range[j]));
  16892. }
  16893. }
  16894. });
  16895. // $source: com/ibm/rave/core/internal/scales/Bilinear
  16896. /************************************************************************
  16897. ** IBM Confidential
  16898. **
  16899. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  16900. **
  16901. ** (C) Copyright IBM Corp. 2017
  16902. **
  16903. ** The source code for this program is not published or otherwise divested of its trade secrets,
  16904. ** irrespective of what has been deposited with the U.S. Copyright Office.
  16905. ************************************************************************/
  16906. // GENERATED
  16907. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  16908. /**
  16909. * @author Bryan
  16910. */
  16911. var com_ibm_rave_core_internal_scales_Bilinear = com_ibm_rave_core_nativeImpl_Declare({
  16912. _$functionClassMethod : function() {
  16913. var _$self = function(domain, range, uninterpolate, interpolate) {
  16914. return new com_ibm_rave_core_internal_scales_Bilinear.BilinearValuefunction(domain, range, uninterpolate, interpolate);
  16915. };
  16916. return _$self;
  16917. }
  16918. });
  16919. com_ibm_rave_core_internal_scales_Bilinear.BilinearValuefunction = com_ibm_rave_core_nativeImpl_Declare({
  16920. //u : null,
  16921. //i : null,
  16922. _$functionClassMethod : function() {
  16923. var _$self = function(x) {
  16924. return _$self.i(+ (_$self.u(+ (x))));
  16925. };
  16926. return _$self;
  16927. },
  16928. constructor : function(domain, range, uninterpolate, interpolate) {
  16929. this.u = uninterpolate(domain[0], domain[1]);
  16930. this.i = interpolate(range[0], range[1]);
  16931. }
  16932. });
  16933. // $source: com/ibm/rave/core/internal/interpolate/UninterpolateClamp
  16934. /************************************************************************
  16935. ** IBM Confidential
  16936. **
  16937. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  16938. **
  16939. ** (C) Copyright IBM Corp. 2017
  16940. **
  16941. ** The source code for this program is not published or otherwise divested of its trade secrets,
  16942. ** irrespective of what has been deposited with the U.S. Copyright Office.
  16943. ************************************************************************/
  16944. // GENERATED
  16945. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  16946. /**
  16947. * Creates an uninterpolator that can uninterpolate a number
  16948. * @author Bryan
  16949. */
  16950. var com_ibm_rave_core_internal_interpolate_UninterpolateClamp = com_ibm_rave_core_nativeImpl_Declare({
  16951. _$functionClassMethod : function() {
  16952. var _$self = /**
  16953. * Creates an uninterpolator that can uninterpolate a number
  16954. * @param (Object) a the start value
  16955. * @param (Object) b the end value
  16956. * @return (com.ibm.rave.core.interpolate.Interpolator) new interpolator
  16957. */
  16958. function(a, b) {
  16959. var da = + (a);
  16960. var db = + (b);
  16961. var db2 = ((db - da) != 0) ? db - da : 1 / db;
  16962. return function(x) {
  16963. return Math.max(0, Math.min(1, (x - da) / db2));
  16964. };
  16965. };
  16966. return _$self;
  16967. }
  16968. });
  16969. // $source: com/ibm/rave/core/internal/interpolate/UninterpolateNumber
  16970. /************************************************************************
  16971. ** IBM Confidential
  16972. **
  16973. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  16974. **
  16975. ** (C) Copyright IBM Corp. 2017
  16976. **
  16977. ** The source code for this program is not published or otherwise divested of its trade secrets,
  16978. ** irrespective of what has been deposited with the U.S. Copyright Office.
  16979. ************************************************************************/
  16980. // GENERATED
  16981. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  16982. /**
  16983. * Creates an uninterpolator that can uninterpolate a number
  16984. * @author Bryan
  16985. */
  16986. var com_ibm_rave_core_internal_interpolate_UninterpolateNumber = com_ibm_rave_core_nativeImpl_Declare({
  16987. _$functionClassMethod : function() {
  16988. var _$self = /**
  16989. * Creates an uninterpolator that can uninterpolate a number between the start and end value.
  16990. * @param (Object) a the start value
  16991. * @param (Object) b the end value
  16992. * @return (com.ibm.rave.core.interpolate.Interpolator) new interpolator
  16993. */
  16994. function(a, b) {
  16995. var da = + (a);
  16996. var db = + (b);
  16997. var db2 = ((db - da) != 0) ? db - da : 1 / db;
  16998. return function(x) {
  16999. return (x - da) / db2;
  17000. };
  17001. };
  17002. return _$self;
  17003. }
  17004. });
  17005. // $source: com/ibm/rave/core/interpolate/RoundInterpolation
  17006. /************************************************************************
  17007. ** IBM Confidential
  17008. **
  17009. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  17010. **
  17011. ** (C) Copyright IBM Corp. 2017
  17012. **
  17013. ** The source code for this program is not published or otherwise divested of its trade secrets,
  17014. ** irrespective of what has been deposited with the U.S. Copyright Office.
  17015. ************************************************************************/
  17016. // GENERATED
  17017. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  17018. var com_ibm_rave_core_interpolate_RoundInterpolation = rave_externs["RoundInterpolation"] = com_ibm_rave_core_nativeImpl_Declare({
  17019. _$functionClassMethod : function() {
  17020. var _$self = /**
  17021. * 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.
  17022. * @param (Object) a the start value
  17023. * @param (Object) b the end value
  17024. * @return (com.ibm.rave.core.interpolate.Interpolator) the new interpolator
  17025. */
  17026. function(a, b) {
  17027. var da = + (a);
  17028. var db = + (b) - da;
  17029. return function(t) {
  17030. return Math.round(da + db * t);
  17031. };
  17032. };
  17033. return _$self;
  17034. }
  17035. });
  17036. /** @expose */
  17037. com_ibm_rave_core_interpolate_RoundInterpolation.INSTANCE = new com_ibm_rave_core_interpolate_RoundInterpolation();
  17038. // $source: com/ibm/rave/core/internal/scales/NiceIdentity
  17039. /************************************************************************
  17040. ** IBM Confidential
  17041. **
  17042. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  17043. **
  17044. ** (C) Copyright IBM Corp. 2017
  17045. **
  17046. ** The source code for this program is not published or otherwise divested of its trade secrets,
  17047. ** irrespective of what has been deposited with the U.S. Copyright Office.
  17048. ************************************************************************/
  17049. // GENERATED
  17050. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  17051. /**
  17052. * A default nice range that simply returns the values as-is. May be overridden for more functionality (as in TimeScale).
  17053. * @author jim
  17054. */
  17055. var com_ibm_rave_core_internal_scales_NiceIdentity = com_ibm_rave_core_nativeImpl_Declare({
  17056. //floor : null,
  17057. //ceil : null,
  17058. constructor : function(inFloor, inCeil) {
  17059. this.floor = function(x) {
  17060. return x;
  17061. };
  17062. this.ceil = function(x) {
  17063. return x;
  17064. };
  17065. {
  17066. if (inFloor) {
  17067. this.floor = inFloor;
  17068. }
  17069. if (inCeil) {
  17070. this.ceil = inCeil;
  17071. }
  17072. }
  17073. }
  17074. //constructor : function() {}
  17075. });
  17076. // $source: com/ibm/rave/core/internal/scales/Nice
  17077. /************************************************************************
  17078. ** IBM Confidential
  17079. **
  17080. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  17081. **
  17082. ** (C) Copyright IBM Corp. 2017
  17083. **
  17084. ** The source code for this program is not published or otherwise divested of its trade secrets,
  17085. ** irrespective of what has been deposited with the U.S. Copyright Office.
  17086. ************************************************************************/
  17087. // GENERATED
  17088. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  17089. //@import com/ibm/rave/core/internal/scales/NiceIdentity (static) // new
  17090. /**
  17091. * Nicely round numbers
  17092. * @author Bryan
  17093. */
  17094. var com_ibm_rave_core_internal_scales_Nice = com_ibm_rave_core_nativeImpl_Declare({
  17095. });
  17096. com_ibm_rave_core_internal_scales_Nice.scaleNice = function(domain, nice) {
  17097. var i0 = 0.0, i1 = domain.length - 1, x0 = + (domain[i0]), x1 = + (domain[i1]), dx;
  17098. if (x1 < x0) {
  17099. dx = i0;
  17100. i0 = i1;
  17101. i1 = dx;
  17102. dx = x0;
  17103. x0 = x1;
  17104. x1 = dx;
  17105. }
  17106. domain[i0] = nice.floor(x0);
  17107. domain[i1] = nice.ceil(x1);
  17108. return domain;
  17109. };
  17110. com_ibm_rave_core_internal_scales_Nice.niceStep = function(step) {
  17111. var doubleStep = + (step);
  17112. return doubleStep != 0.0 ? new com_ibm_rave_core_internal_scales_NiceIdentity(function(x) {
  17113. return Math.floor(+ (x) / doubleStep) * doubleStep;
  17114. }, function(x) {
  17115. return Math.ceil(+ (x) / doubleStep) * doubleStep;
  17116. }) : new com_ibm_rave_core_internal_scales_NiceIdentity();
  17117. };
  17118. // $source: com/ibm/rave/core/locale/NumberFormat
  17119. /************************************************************************
  17120. ** IBM Confidential
  17121. **
  17122. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  17123. **
  17124. ** (C) Copyright IBM Corp. 2017
  17125. **
  17126. ** The source code for this program is not published or otherwise divested of its trade secrets,
  17127. ** irrespective of what has been deposited with the U.S. Copyright Office.
  17128. ************************************************************************/
  17129. // GENERATED
  17130. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  17131. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (runtime) // create
  17132. //@import com/ibm/rave/core/format/Round (runtime) // round
  17133. //@import com/ibm/rave/core/internal/format/Precision (runtime) // precision
  17134. //@import com/ibm/rave/core/format/FormatPrefix (runtime) // formatPrefix
  17135. var com_ibm_rave_core_locale_NumberFormat = rave_externs["NumberFormat"] = com_ibm_rave_core_nativeImpl_Declare({
  17136. //locale_currency : null,
  17137. //locale_decimal : null,
  17138. //formatGroup : null,
  17139. _$functionClassMethod : function() {
  17140. var _$self = function(specifier) {
  17141. var match = new RegExp(com_ibm_rave_core_locale_NumberFormat.format_re, "i").exec(specifier);
  17142. var zcomma;
  17143. var newType;
  17144. var fill = match[1] != null ? match[1] : " ";
  17145. var align = match[2] != null ? match[2] : ">";
  17146. var sign = match[3] != null ? match[3] : "-";
  17147. var symbol = match[4] != null ? match[4] : "";
  17148. var zfill = match[5];
  17149. var width = match[6];
  17150. var comma = match[7];
  17151. var precisionMatch = match[8];
  17152. var type = match[9];
  17153. var scale = 1;
  17154. var prefix = "";
  17155. var suffix = "";
  17156. var integer = false;
  17157. var exponent = true;
  17158. var intwidth = 0;
  17159. var precision;
  17160. if (precisionMatch != null) {
  17161. precision = ~~ (precisionMatch.substring(1));
  17162. }
  17163. if (zfill != null || fill == "0" && align == "=") {
  17164. zfill = fill = "0";
  17165. align = "=";
  17166. if (comma != null) {
  17167. var w = ~~+ (width);
  17168. intwidth = w;
  17169. }
  17170. }
  17171. if (type != null) {
  17172. if (type == "n") {
  17173. comma = "true";
  17174. type = "g";
  17175. } else if (type == "%") {
  17176. scale = 100;
  17177. suffix = "%";
  17178. type = "f";
  17179. } else if (type == "p") {
  17180. scale = 100;
  17181. suffix = "%";
  17182. type = "r";
  17183. } else if (type == "b" || type == "o" || type == "x" || type == "X") {
  17184. if (symbol == "#") {
  17185. prefix = "0" + type.toLowerCase();
  17186. }
  17187. } else if (type == "c") {
  17188. exponent = false;
  17189. } else if (type == "d") {
  17190. integer = true;
  17191. precision = 0;
  17192. } else if (type == "s") {
  17193. scale = -1;
  17194. type = "r";
  17195. }
  17196. }
  17197. if (symbol == ("$")) {
  17198. prefix = _$self.locale_currency[0];
  17199. suffix = _$self.locale_currency[1];
  17200. }
  17201. if (type != null && type == "r" && precision == null) {
  17202. type = "g";
  17203. }
  17204. var value;
  17205. if (precision != null) {
  17206. value = precision;
  17207. if (type != null && type == "g") {
  17208. precision = Math.max(1, Math.min(21, value));
  17209. } else if (type != null && type == "e" || type != null && type == "f") {
  17210. precision = Math.max(0, Math.min(20, value));
  17211. }
  17212. }
  17213. newType = _$self.formatTypes().get(type);
  17214. if (!newType) {
  17215. newType = _$self.formatTypeDefault();
  17216. }
  17217. if (zfill != null) {
  17218. zcomma = comma;
  17219. } else if (comma != null) {
  17220. zcomma = zfill;
  17221. } else {
  17222. zcomma = comma;
  17223. }
  17224. var _suffix = suffix;
  17225. var _exponent = exponent;
  17226. var _integer = integer;
  17227. var _sign = sign;
  17228. var _prefix = prefix;
  17229. var _zfill = zfill;
  17230. var _comma = comma;
  17231. var _precision = precision;
  17232. var _scale = scale;
  17233. var _newType = newType;
  17234. var _zcomma = zcomma;
  17235. var _width = width;
  17236. var _align = align;
  17237. var _intwidth = intwidth;
  17238. var _fill = fill;
  17239. var self = _$self;
  17240. return function(data, index, groupIndex) {
  17241. var value = + (data);
  17242. var fullSuffix = _suffix;
  17243. var v = value % 1;
  17244. if (_integer && v != 0) {
  17245. return "";
  17246. }
  17247. var negative;
  17248. if (value < 0 || value == 0 && 1 / value < 0) {
  17249. value = -value;
  17250. negative = "-";
  17251. } else {
  17252. if (_sign == "-") {
  17253. negative = "";
  17254. } else {
  17255. negative = _sign;
  17256. }
  17257. }
  17258. if (_scale < 0) {
  17259. var unit = com_ibm_rave_core_format_FormatPrefix.formatPrefix(value, _precision);
  17260. value = unit.scale(value);
  17261. fullSuffix = unit.symbol + _suffix;
  17262. } else {
  17263. value *= _scale;
  17264. }
  17265. var typeValue = _newType(value, _precision);
  17266. var i = typeValue.lastIndexOf(".");
  17267. var before;
  17268. var after;
  17269. if (i < 0) {
  17270. var j = _exponent ? typeValue.lastIndexOf("e") : -1;
  17271. if (j < 0) {
  17272. before = typeValue;
  17273. after = "";
  17274. } else {
  17275. before = typeValue.substring(0, j);
  17276. after = typeValue.substring(j);
  17277. }
  17278. } else {
  17279. before = typeValue.substring(0, i);
  17280. after = self.locale_decimal + typeValue.substring(i + 1);
  17281. }
  17282. if (_zfill == null && _comma != null) {
  17283. before = self.formatGroup(before, Infinity);
  17284. }
  17285. var length = _prefix.length + before.length + after.length + (_zcomma != null && !(_zcomma == "0") ? 0 : negative.length);
  17286. var intwidth = _intwidth;
  17287. if (_width != null && !(_width == "") && _intwidth == 0) {
  17288. intwidth = parseInt(_width);
  17289. }
  17290. var padding;
  17291. if (length < intwidth) {
  17292. length = intwidth - length + 1;
  17293. padding = new Array(length).join(_fill);
  17294. } else {
  17295. padding = "";
  17296. }
  17297. if (_zcomma != null && !(_zcomma == "0")) {
  17298. before = self.formatGroup(padding + before, padding.length > 0 ? intwidth - after.length : Infinity);
  17299. }
  17300. negative += _prefix;
  17301. var myValue = before + after;
  17302. 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;
  17303. };
  17304. };
  17305. return _$self;
  17306. },
  17307. /**
  17308. * 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.
  17309. * @param (Object) 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();
  17310. */
  17311. /** @expose */
  17312. constructor : function(locale) {
  17313. var locale_thousands = locale["thousands"];
  17314. this.locale_decimal = locale["decimal"];
  17315. var locale_grouping = !locale["grouping"] ? [] : locale["grouping"];
  17316. this.locale_currency = locale["currency"];
  17317. var self = this;
  17318. this.formatGroup = ((locale_thousands) && locale_grouping.length > 0) ? /**
  17319. * an identity method which will manipulate the value coming in to be properly formatted by separating the string using locale_thousands
  17320. * @param (String) value the value which is to be formatted using locale_thousands as a separator
  17321. * @param (double) width is used to determine at which points the string should be split and a separator should be used
  17322. * @return (String) A string that is separated using the locale_thousands value
  17323. */
  17324. function(value, width) {
  17325. var i = value.length;
  17326. var t = [];
  17327. var j = 0;
  17328. var g = locale_grouping[0];
  17329. var length = 0;
  17330. while (i > 0 && g > 0) {
  17331. if (length + g + 1 > width) {
  17332. g = Math.max(1, width - length);
  17333. }
  17334. var zi = i;
  17335. var zg = g;
  17336. var z = zi -= zg;
  17337. if (z < 0) {
  17338. z = 0;
  17339. }
  17340. i -= g;
  17341. t.push(value.substring(z, (i + ~~g)));
  17342. if ((length += g + 1) > width) {
  17343. break;
  17344. }
  17345. g = locale_grouping[j = (j + 1) % locale_grouping.length];
  17346. }
  17347. return t.reverse().join(locale_thousands);
  17348. } : /**
  17349. * this method will return the value that is passed in
  17350. * @param (String) value the value which is to be formatted using locale_thousands as a separator
  17351. * @param (double) width is used to determine at which points the string should be split and a separator should be used
  17352. * @return (String) the value that was passed in
  17353. */
  17354. function(value, width) {
  17355. return value;
  17356. };
  17357. },
  17358. formatTypes : function() {
  17359. var map = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  17360. map.set("b", function(value, precision) {
  17361. var v = ~~value;
  17362. return v.toString(2);
  17363. });
  17364. map.set("c", function(value, precision) {
  17365. var c = value;
  17366. return String.fromCharCode(c);
  17367. });
  17368. map.set("o", function(value, precision) {
  17369. var v = ~~value;
  17370. return v.toString(8);
  17371. });
  17372. map.set("x", function(value, precision) {
  17373. return value.toString(16);
  17374. });
  17375. map.set("X", function(value, precision) {
  17376. return value.toString(16).toUpperCase();
  17377. });
  17378. map.set("g", function(value, precision) {
  17379. return value.toPrecision(precision);
  17380. });
  17381. map.set("e", function(value, precision) {
  17382. return precision != null ? value.toExponential(precision) : value.toExponential();
  17383. });
  17384. map.set("f", function(value, precision) {
  17385. var fixed = value.toFixed(~~ (precision));
  17386. var fixedDouble = + (fixed);
  17387. if (((fixedDouble == Math.floor(fixedDouble)) && !(! isFinite(fixedDouble))) && ~~ (precision) <= 0) {
  17388. var intfixed = Math.round(fixedDouble);
  17389. return intfixed.toString();
  17390. }
  17391. return fixed;
  17392. });
  17393. map.set("r", function(value, precision) {
  17394. var rounded = com_ibm_rave_core_format_Round.round(value, com_ibm_rave_core_internal_format_Precision.precision(value, precision));
  17395. return rounded.toFixed(~~Math.max(0, Math.min(20, com_ibm_rave_core_internal_format_Precision.precision(rounded * (1 + 1e-15), precision))));
  17396. });
  17397. return map;
  17398. },
  17399. formatTypeDefault : function() {
  17400. return function(xx, pp) {
  17401. return ""+(xx);
  17402. };
  17403. }
  17404. });
  17405. /** @expose */
  17406. com_ibm_rave_core_locale_NumberFormat.format_re = "(?:([^{])?([<>=^]))?([+\\- ])?([$#])?(0)?(\\d+)?(,)?(\\.-?\\d+)?([a-z%])?";
  17407. // $source: com/ibm/rave/core/scales/OrdinalScale
  17408. /************************************************************************
  17409. ** IBM Confidential
  17410. **
  17411. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  17412. **
  17413. ** (C) Copyright IBM Corp. 2017
  17414. **
  17415. ** The source code for this program is not published or otherwise divested of its trade secrets,
  17416. ** irrespective of what has been deposited with the U.S. Copyright Office.
  17417. ************************************************************************/
  17418. // GENERATED
  17419. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  17420. //@import com/ibm/rave/core/scales/AbstractScale (loadtime) // scaleExtent, superclass
  17421. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (runtime) // create
  17422. //@import com/ibm/rave/core/internal/scales/Ranger (static) // new
  17423. //@import com/ibm/rave/core/internal/nativeImpl/Lang (runtime) // isNumber
  17424. /**
  17425. * 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.
  17426. * @author jim.
  17427. */
  17428. var com_ibm_rave_core_scales_OrdinalScale = rave_externs["OrdinalScale"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scales_AbstractScale, {
  17429. //_domain : null,
  17430. //_range : null,
  17431. //ranger : null,
  17432. //index : null,
  17433. _rangeBand : 0,
  17434. _viewOffset : 0,
  17435. _viewZoom : 0,
  17436. _$functionClassMethod : function() {
  17437. var _$self = /**
  17438. * 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)
  17439. */
  17440. function(key, _index, groupIndex) {
  17441. return _$self.scale(key, _$self.ranger);
  17442. };
  17443. return _$self;
  17444. },
  17445. constructor : function(_domain, ranger, viewZoom, viewOffset) {
  17446. this._domain = [];
  17447. this._range = [];
  17448. this.ranger = com_ibm_rave_core_scales_OrdinalScale.DEFAULT_RANGER;
  17449. this.index = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  17450. {
  17451. this.ranger = ranger;
  17452. this.domain(_domain);
  17453. this._viewOffset = (viewOffset);
  17454. this._viewZoom = (viewZoom);
  17455. var self = this;
  17456. this.rangeBand = function() {
  17457. return self._rangeBand * self._viewZoom;
  17458. };
  17459. this.rangeExtent = function() {
  17460. return com_ibm_rave_core_scales_AbstractScale.scaleExtent(self.ranger.a);
  17461. };
  17462. this.ticksInRange = function(tickArguments) {
  17463. if (tickArguments !== null || arguments.length > 1){
  17464. tickArguments = Array.prototype.slice.call(arguments);
  17465. }
  17466. {
  17467. var ticksResult = [];
  17468. if (tickArguments.length > 0 && ~~ (tickArguments[0]) <= 0) {
  17469. return ticksResult;
  17470. }
  17471. var domain = self._domain;
  17472. var rangeExtent = self.rangeExtent();
  17473. if (com_ibm_rave_core_internal_nativeImpl_Lang.isNumber(rangeExtent[0]) && com_ibm_rave_core_internal_nativeImpl_Lang.isNumber(rangeExtent[1])) {
  17474. var min = + (rangeExtent[0]);
  17475. var max = + (rangeExtent[1]);
  17476. var bandWidth = + (self.rangeBand());
  17477. var bandDelta = bandWidth / 2;
  17478. var increment;
  17479. if (tickArguments.length > 0) {
  17480. var nPreferredTicks = ~~ (tickArguments[0]);
  17481. var maxTicksInRange = (max - min) / bandWidth;
  17482. increment = ~~ (Math.max(1, Math.pow(2, Math.floor(Math.log(maxTicksInRange / nPreferredTicks) / Math.log(2)))));
  17483. } else {
  17484. increment = 1;
  17485. }
  17486. for (var i = 0; i < domain.length; i = i + increment) {
  17487. var d = domain[i];
  17488. var r = + (self.call(null, d, 0, 0)) + bandDelta;
  17489. if (r >= min && r <= max) {
  17490. ticksResult.push(d);
  17491. }
  17492. }
  17493. }
  17494. return ticksResult;
  17495. }
  17496. };
  17497. this.zoomTransform = function(zoom, offset) {
  17498. self._viewOffset = + (offset);
  17499. self._viewZoom = Math.max(0, + (zoom));
  17500. };
  17501. }
  17502. },
  17503. scale : function(key, ranger) {
  17504. var keyString = ""+(key);
  17505. var myindex = this.index.get(keyString);
  17506. if (myindex == null) {
  17507. if (ranger.t == "range") {
  17508. this._domain.push(key);
  17509. myindex = this.index.set(keyString, this._domain.length);
  17510. } else {
  17511. }
  17512. }
  17513. if (this._range.length == 0 || myindex == null) {
  17514. return undefined;
  17515. }
  17516. myindex = (myindex - 1) % this._range.length;
  17517. return this.transformRangeValue(this._range[myindex]);
  17518. },
  17519. domain$0 : function(values) {
  17520. this._domain = [];
  17521. this.index = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  17522. var i = -1;
  17523. var n = values.length;
  17524. var xi;
  17525. while (++i < n) {
  17526. xi = ""+(values[i]);
  17527. if (!(this.index.has(xi))) {
  17528. this._domain.push(values[i]);
  17529. this.index.set(xi, this._domain.length);
  17530. }
  17531. }
  17532. if ("range" == this.ranger.t) {
  17533. return this.range(this.ranger.a);
  17534. }
  17535. if ("rangeBands" == this.ranger.t) {
  17536. return this.rangeBands(this.ranger.a, this.ranger.padding, this.ranger.outerPadding);
  17537. }
  17538. if ("rangePoints" == this.ranger.t) {
  17539. return this.rangePoints(this.ranger.a, this.ranger.padding);
  17540. }
  17541. if ("rangeRoundBands" == this.ranger.t) {
  17542. return this.rangeRoundBands(this.ranger.a, this.ranger.padding, this.ranger.outerPadding);
  17543. }
  17544. if ("rangeRoundPoints" == this.ranger.t) {
  17545. return this.rangeRoundPoints(this.ranger.a, this.ranger.padding);
  17546. }
  17547. return this;
  17548. },
  17549. domain$1 : function() {
  17550. return this._domain;
  17551. },
  17552. range$0 : function(values) {
  17553. this._range = values;
  17554. this.ranger = new com_ibm_rave_core_internal_scales_Ranger("range", values, 0, 0);
  17555. this._rangeBand = 0;
  17556. return this;
  17557. },
  17558. range$1 : function() {
  17559. return this._range;
  17560. },
  17561. /** @expose */
  17562. copy : function() {
  17563. return new com_ibm_rave_core_scales_OrdinalScale(this._domain, this.ranger, this._viewZoom, this._viewOffset);
  17564. },
  17565. /**
  17566. * 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>
  17567. * @param (Array) interval 2 element array containing minimum and maximum numeric values.
  17568. * @param (Number) padding Offset from the edge of the interval, as a multiple of the distance between points.
  17569. * @return (com.ibm.rave.core.scales.OrdinalScale) This Scale.
  17570. */
  17571. /** @expose */
  17572. rangePoints : function(interval, padding) {
  17573. var _padding = padding;
  17574. if (_padding == null) {
  17575. _padding = 0.0;
  17576. }
  17577. var start = + (interval[0]);
  17578. var stop = + (interval[1]);
  17579. var step = this._domain.length < 2 ? (start = (start + stop) / 2) : (stop - start) / (this._domain.length - 1 + _padding);
  17580. this._range = this.steps(start + step * _padding / 2, step);
  17581. this._rangeBand = 0.0;
  17582. this.ranger = new com_ibm_rave_core_internal_scales_Ranger("rangePoints", interval, _padding, 0);
  17583. return this;
  17584. },
  17585. /**
  17586. * Like rangePoints, except guarantees that the range values are integers so as to avoid antialiasing artifacts.
  17587. * @param (Array) interval 2 element array containing minimum and maximum numeric values.
  17588. * @param (Number) padding Offset from the edge of the interval, as a multiple of the distance between points.
  17589. * @return (com.ibm.rave.core.scales.OrdinalScale) the scale
  17590. */
  17591. /** @expose */
  17592. rangeRoundPoints : function(interval, padding) {
  17593. var _padding = padding;
  17594. if (_padding == null) {
  17595. _padding = 0.0;
  17596. }
  17597. var start = + (interval[0]);
  17598. var stop = + (interval[1]);
  17599. var step;
  17600. if (this._domain.length < 2) {
  17601. start = Math.round((start + stop) / 2);
  17602. stop = start;
  17603. step = start;
  17604. } else {
  17605. step = ~~((stop - start) / (this._domain.length - 1 + _padding));
  17606. }
  17607. this._range = this.steps(start + Math.round(step * _padding / 2 + (stop - start - (this._domain.length - 1 + _padding) * step) / 2), step);
  17608. this._rangeBand = 0.0;
  17609. this.ranger = new com_ibm_rave_core_internal_scales_Ranger("rangeRoundPoints", interval, _padding, 0);
  17610. return this;
  17611. },
  17612. /**
  17613. * 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>
  17614. * @param (Array) interval 2 element array containing minimum and maximum numeric values.
  17615. * @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.
  17616. * @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.
  17617. * @return (com.ibm.rave.core.scales.OrdinalScale) This Scale.
  17618. */
  17619. /** @expose */
  17620. rangeBands : function(interval, padding, outerPadding) {
  17621. var _padding = padding;
  17622. var _outerPadding = outerPadding;
  17623. if (_padding == null) {
  17624. _padding = 0.0;
  17625. }
  17626. if (_outerPadding == null) {
  17627. _outerPadding = _padding;
  17628. }
  17629. var interval0 = + (interval[0]);
  17630. var interval1 = + (interval[1]);
  17631. var reverse = interval1 < interval0;
  17632. var start = reverse ? interval1 : interval0;
  17633. var stop = reverse ? interval0 : interval1;
  17634. var step = (stop - start) / (this._domain.length - _padding + 2 * _outerPadding);
  17635. this._range = this.steps(start + step * _outerPadding, step);
  17636. if (reverse) {
  17637. var temp;
  17638. for (var i = 0; i < this._range.length / 2; ++i) {
  17639. temp = this._range[i];
  17640. var value = this._range[this._range.length - 1 - i];
  17641. this._range[i] = value;
  17642. this._range[this._range.length - 1 - i] = temp;
  17643. }
  17644. }
  17645. this._rangeBand = step * (1 - _padding);
  17646. this.ranger = new com_ibm_rave_core_internal_scales_Ranger("rangeBands", interval, _padding, _outerPadding);
  17647. return this;
  17648. },
  17649. /**
  17650. * Very similar to {@link #this.rangeBands(Array, Number, Number)} , but rounds band width and offsets to integer values.
  17651. * @param (Array) interval 2 element array containing minimum and maximum numeric values.
  17652. * @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.
  17653. * @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.
  17654. * @return (com.ibm.rave.core.scales.OrdinalScale) This Scale.
  17655. */
  17656. /** @expose */
  17657. rangeRoundBands : function(interval, padding, outerPadding) {
  17658. var _padding = padding;
  17659. var _outerPadding = outerPadding;
  17660. if (_padding == null) {
  17661. _padding = 0.0;
  17662. }
  17663. if (_outerPadding == null) {
  17664. _outerPadding = _padding;
  17665. }
  17666. var interval0 = + (interval[0]);
  17667. var interval1 = + (interval[1]);
  17668. var reverse = interval1 < interval0;
  17669. var start = reverse ? interval1 : interval0;
  17670. var stop = reverse ? interval0 : interval1;
  17671. var step = Math.floor((stop - start) / (this._domain.length - _padding + 2 * _outerPadding));
  17672. this._range = this.steps(start + Math.round((stop - start - (this._domain.length - _padding) * step) / 2), step);
  17673. if (reverse) {
  17674. var temp;
  17675. for (var i = 0; i < this._range.length / 2; ++i) {
  17676. temp = this._range[i];
  17677. var value = this._range[this._range.length - 1 - i];
  17678. this._range[i] = value;
  17679. this._range[this._range.length - 1 - i] = temp;
  17680. }
  17681. }
  17682. this._rangeBand = Math.round(step * (1 - _padding));
  17683. this.ranger = new com_ibm_rave_core_internal_scales_Ranger("rangeRoundBands", interval, _padding, _outerPadding);
  17684. return this;
  17685. },
  17686. /**
  17687. * Calculate discrete range values (steps) for each ordinal domain value.
  17688. * @param (double) start The starting range value, e.g. left-most pixel position.
  17689. * @param (double) step The distance between each range value, e.g. pixel distance.
  17690. * @return (Array) Array of range values.
  17691. */
  17692. steps : function(start, step) {
  17693. var rangeSteps = new Array(this._domain.length);
  17694. for (var i = 0; i < this._domain.length; ++i) {
  17695. rangeSteps[i] = start + step * i;
  17696. }
  17697. return rangeSteps;
  17698. },
  17699. /**
  17700. * Transform a range value by the current view transform. If the range value is not numeric, it is returned unchanged.
  17701. * @param (Object) r Ordinal range value.
  17702. * @return (Object) Range value transformed to current view space.
  17703. */
  17704. transformRangeValue : function(r) {
  17705. if (com_ibm_rave_core_internal_nativeImpl_Lang.isNumber(r) && this.zoomTransformIsModified()) {
  17706. return (+ (r) * this._viewZoom) + this._viewOffset;
  17707. }
  17708. return r;
  17709. },
  17710. /**
  17711. * Returns true if the zoom scale or offset is not the identity transform (1x zoom, 0 offset), false otherwise.
  17712. */
  17713. zoomTransformIsModified : function() {
  17714. return this._viewOffset != 0.0 || this._viewZoom != 1.0;
  17715. },
  17716. /** @expose */
  17717. domain : function(a0) {
  17718. var args = arguments;
  17719. if (args.length == 0) {
  17720. return this.domain$1();
  17721. }
  17722. return this.domain$0(a0);
  17723. },
  17724. /** @expose */
  17725. range : function(a0) {
  17726. var args = arguments;
  17727. if (args.length == 0) {
  17728. return this.range$1();
  17729. }
  17730. return this.range$0(a0);
  17731. }
  17732. });
  17733. /** @expose */
  17734. com_ibm_rave_core_scales_OrdinalScale.DEFAULT_RANGER = new com_ibm_rave_core_internal_scales_Ranger("range", [], 0, 0);
  17735. // $source: com/ibm/rave/core/scales/QuantizeScale
  17736. /************************************************************************
  17737. ** IBM Confidential
  17738. **
  17739. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  17740. **
  17741. ** (C) Copyright IBM Corp. 2017
  17742. **
  17743. ** The source code for this program is not published or otherwise divested of its trade secrets,
  17744. ** irrespective of what has been deposited with the U.S. Copyright Office.
  17745. ************************************************************************/
  17746. // GENERATED
  17747. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  17748. //@import com/ibm/rave/core/scales/AbstractScale (loadtime) // superclass
  17749. /**
  17750. * 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.
  17751. */
  17752. var com_ibm_rave_core_scales_QuantizeScale = rave_externs["QuantizeScale"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scales_AbstractScale, {
  17753. //_range : null,
  17754. kx : 0,
  17755. i : 0,
  17756. x0 : 0,
  17757. x1 : 0,
  17758. _$functionClassMethod : function() {
  17759. var _$self = /**
  17760. * Given a value data in the input domain, returns the corresponding value in the output range
  17761. * @param (Object) this the context in which this method is invoked
  17762. * @param (Object) data a data value, may be <code>null</code>
  17763. * @param (int) index the index of the current scene node
  17764. * @param (int) groupIndex the group index of the current scene node
  17765. * @return (Object) the value in the output range for a given data
  17766. */
  17767. function(data, index, groupIndex) {
  17768. if (data===undefined || isNaN(data)) {
  17769. return undefined;
  17770. }
  17771. var x = + (data);
  17772. return _$self._range[~~Math.max(0.0, Math.min(_$self.i, Math.floor(_$self.kx * (x - _$self.x0))))];
  17773. };
  17774. return _$self;
  17775. },
  17776. /**
  17777. * Maintains kx and i up to date, after domain or range is set.
  17778. * @return (com.ibm.rave.core.scales.QuantizeScale) this scale
  17779. */
  17780. rescale : function() {
  17781. this.kx = this._range.length / (this.x1 - this.x0);
  17782. this.i = this._range.length - 1;
  17783. return this;
  17784. },
  17785. /**
  17786. * Set the scale's input domain
  17787. * @param (Array) values of domain values
  17788. * @return (com.ibm.rave.core.scales.AbstractScale) this scale
  17789. */
  17790. domain$0 : function(values) {
  17791. this.x0 = + (values[0]);
  17792. this.x1 = + (values[values.length - 1]);
  17793. return this.rescale();
  17794. },
  17795. /**
  17796. * Get the scale's domain.
  17797. * @return (Array) Array of domain values
  17798. */
  17799. domain$1 : function() {
  17800. var temp = [];
  17801. temp.push(this.x0);
  17802. temp.push(this.x1);
  17803. return temp;
  17804. },
  17805. /**
  17806. * Get the scale's range.
  17807. * @return (Array) Array of range values.
  17808. */
  17809. range$1 : function() {
  17810. return this._range;
  17811. },
  17812. /**
  17813. * Set the scale's output range.
  17814. * @param (Array) values List of scale output range
  17815. * @return (com.ibm.rave.core.scales.AbstractScale) this scale
  17816. */
  17817. range$0 : function(values) {
  17818. this._range = values;
  17819. return this.rescale();
  17820. },
  17821. /**
  17822. * Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa.
  17823. * @return (com.ibm.rave.core.scales.AbstractScale) a defensive copy of this scale
  17824. */
  17825. /** @expose */
  17826. copy : function() {
  17827. var scale = new com_ibm_rave_core_scales_QuantizeScale();
  17828. scale.range(this._range);
  17829. var tempList = [];
  17830. tempList.push(this.x0);
  17831. tempList.push(this.x1);
  17832. scale.domain(tempList);
  17833. return scale;
  17834. },
  17835. /**
  17836. * 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.
  17837. * @param (Object) givenRange the range to which the method returns the corresponding input domain
  17838. * @return (Array) values in the input domain [x0,x1]
  17839. */
  17840. /** @expose */
  17841. invertExtent : function(givenRange) {
  17842. var _givenRange = this._range.indexOf(givenRange);
  17843. var idx = + (_givenRange);
  17844. idx = idx < 0 ? NaN : idx / this.kx + this.x0;
  17845. var tempList = [];
  17846. tempList.push(idx);
  17847. tempList.push(idx + 1 / this.kx);
  17848. return tempList;
  17849. },
  17850. /** @expose */
  17851. domain : function(a0) {
  17852. var args = arguments;
  17853. if (args.length == 0) {
  17854. return this.domain$1();
  17855. }
  17856. return this.domain$0(a0);
  17857. },
  17858. /** @expose */
  17859. range : function(a0) {
  17860. var args = arguments;
  17861. if (args.length == 0) {
  17862. return this.range$1();
  17863. }
  17864. return this.range$0(a0);
  17865. }
  17866. });
  17867. // $source: com/ibm/rave/core/scales/QuantileScale
  17868. /************************************************************************
  17869. ** IBM Confidential
  17870. **
  17871. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  17872. **
  17873. ** (C) Copyright IBM Corp. 2017
  17874. **
  17875. ** The source code for this program is not published or otherwise divested of its trade secrets,
  17876. ** irrespective of what has been deposited with the U.S. Copyright Office.
  17877. ************************************************************************/
  17878. // GENERATED
  17879. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  17880. //@import com/ibm/rave/core/scales/AbstractScale (loadtime) // superclass
  17881. //@import com/ibm/rave/core/arrays/Quantile (runtime) // quantile
  17882. //@import com/ibm/rave/core/Rave (runtime) // Rave
  17883. /**
  17884. * 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.
  17885. */
  17886. var com_ibm_rave_core_scales_QuantileScale = rave_externs["QuantileScale"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scales_AbstractScale, {
  17887. //thresholds : null,
  17888. //_domain : null,
  17889. //_range : null,
  17890. _$functionClassMethod : function() {
  17891. var _$self = /**
  17892. * Given a value x in the input domain, returns the corresponding value in the output range.
  17893. * @param (Object) this the context in which this method is invoked
  17894. * @param (Object) data a data value, may be <code>null</code>
  17895. * @param (int) index the index of the current scene node
  17896. * @param (int) groupIndex the group index of the current scene node
  17897. * @return (Object) the value in the range mapping to the value provided in the domain
  17898. */
  17899. function(data, index, groupIndex) {
  17900. if (!(isNaN((data)))) {
  17901. return _$self.range()[com_ibm_rave_core_Rave.bisect(_$self.thresholds, data)];
  17902. }
  17903. return undefined;
  17904. };
  17905. return _$self;
  17906. },
  17907. constructor : function(domain, range) {
  17908. this.thresholds = [];
  17909. this._domain = [];
  17910. this._range = [];
  17911. /**
  17912. * Create a new {@link (com.ibm.rave.core.scales.QuantileScale) QuantileScale} with the provided domain and range
  17913. * @param (Array) domain
  17914. * @param (Array) range
  17915. */
  17916. {
  17917. this.domain(domain);
  17918. this.range(range);
  17919. }
  17920. },
  17921. /**
  17922. * Iterate using range size and override thresholds values with the result of p-quantile of the domain using p = i/rangeSize
  17923. * @return (com.ibm.rave.core.scales.QuantileScale) this
  17924. */
  17925. rescale : function() {
  17926. var i = 0;
  17927. var rangeSize = this.range().length;
  17928. this.thresholds = [];
  17929. while (++i < rangeSize) {
  17930. this.thresholds.splice(i - 1, 0, com_ibm_rave_core_arrays_Quantile.quantile(this._domain, + (i) / + (rangeSize)));
  17931. }
  17932. return this;
  17933. },
  17934. /**
  17935. * Sets the scales input domain
  17936. * @param (Array) values the list of values for the input domain
  17937. * @return (com.ibm.rave.core.scales.AbstractScale) this
  17938. */
  17939. domain$0 : function(values) {
  17940. var rave_number = function(currentValue, index, array) {
  17941. return currentValue == null ? NaN : + (currentValue);
  17942. };
  17943. var rave_numeric = function(currentValue, index, array) {
  17944. return !(isNaN(currentValue));
  17945. };
  17946. var ascending = function(obj1, obj2) {
  17947. return ~~(obj1 < obj2 ? -1 : obj1 > obj2 ? 1 : obj1 >= obj2 ? 0 : NaN);
  17948. };
  17949. this._domain = values.map(rave_number).filter(rave_numeric).sort(ascending);
  17950. return this.rescale();
  17951. },
  17952. /**
  17953. * Set the scale's output range.
  17954. * @param (Array) values List of range values
  17955. * @return (com.ibm.rave.core.scales.AbstractScale) this
  17956. */
  17957. range$0 : function(values) {
  17958. this._range = values;
  17959. return this.rescale();
  17960. },
  17961. /**
  17962. * Get the scale's domain
  17963. * @return (Array) List of domain values
  17964. */
  17965. domain$1 : function() {
  17966. return this._domain;
  17967. },
  17968. /**
  17969. * Get the scale's range
  17970. * @return (Array) List of range values
  17971. */
  17972. range$1 : function() {
  17973. return this._range;
  17974. },
  17975. /**
  17976. * 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.
  17977. * @return (Array) The quantile thresholds
  17978. */
  17979. /** @expose */
  17980. quantiles : function() {
  17981. return this.thresholds;
  17982. },
  17983. /**
  17984. * Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa
  17985. * @return (com.ibm.rave.core.scales.AbstractScale) defensive copy of this scale
  17986. */
  17987. /** @expose */
  17988. copy : function() {
  17989. return new com_ibm_rave_core_scales_QuantileScale(this._domain, this._range);
  17990. },
  17991. /**
  17992. * 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.
  17993. * @param (Object) y the value in output range
  17994. * @return (Array) the extent of values in the input domain corresponding to the provided output range y
  17995. */
  17996. /** @expose */
  17997. invertExtent : function(y) {
  17998. var index = this._range.indexOf(y);
  17999. var temp = [];
  18000. if (index < 0) {
  18001. temp.push(NaN);
  18002. temp.push(NaN);
  18003. return temp;
  18004. } else {
  18005. temp.push(index > 0 ? this.thresholds[index - 1] : this._domain[0]);
  18006. temp.push(index < this.thresholds.length ? this.thresholds[index] : this._domain[this._domain.length - 1]);
  18007. return temp;
  18008. }
  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. // $source: com/ibm/rave/core/scales/LogScale
  18028. /************************************************************************
  18029. ** IBM Confidential
  18030. **
  18031. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  18032. **
  18033. ** (C) Copyright IBM Corp. 2017
  18034. **
  18035. ** The source code for this program is not published or otherwise divested of its trade secrets,
  18036. ** irrespective of what has been deposited with the U.S. Copyright Office.
  18037. ************************************************************************/
  18038. // GENERATED
  18039. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  18040. //@import com/ibm/rave/core/scales/AbstractScale (loadtime) // scaleExtent, superclass
  18041. //@import com/ibm/rave/core/locale/NumberFormat (runtime) // new
  18042. //@import com/ibm/rave/core/locale/Locale (runtime) // Locale
  18043. //@import com/ibm/rave/core/internal/scales/Nice (runtime) // scaleNice
  18044. //@import com/ibm/rave/core/internal/scales/NiceIdentity (static) // new
  18045. /**
  18046. * 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.
  18047. */
  18048. var com_ibm_rave_core_scales_LogScale = rave_externs["LogScale"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scales_AbstractScale, {
  18049. //_linear : null,
  18050. //_base : null,
  18051. //_positive : null,
  18052. //_domain : null,
  18053. _$functionClassMethod : function() {
  18054. var _$self = function(data, index, groupIndex) {
  18055. return _$self._linear.call(this, _$self.log(+ (data)), index, groupIndex);
  18056. };
  18057. return _$self;
  18058. },
  18059. /** @expose */
  18060. constructor : function(linear, base, positive, domain) {
  18061. this._linear = linear;
  18062. this._base = (base);
  18063. this._positive = positive;
  18064. this._domain = domain;
  18065. if (!com_ibm_rave_core_scales_LogScale.logFormat) {
  18066. {
  18067. if (!com_ibm_rave_core_scales_LogScale.logFormat) {
  18068. com_ibm_rave_core_scales_LogScale.logFormat = new com_ibm_rave_core_locale_NumberFormat(com_ibm_rave_core_locale_Locale.DEFAULT_LOCALE)(".0e");
  18069. }
  18070. }
  18071. }
  18072. var self = this;
  18073. this.ticks = function(tickArguments) {
  18074. if (tickArguments !== null || arguments.length > 1){
  18075. tickArguments = Array.prototype.slice.call(arguments);
  18076. }
  18077. {
  18078. return self.logTicks.apply(self, tickArguments);
  18079. }
  18080. };
  18081. this.tickFormat = function(tickArguments) {
  18082. if (tickArguments !== null || arguments.length > 1){
  18083. tickArguments = Array.prototype.slice.call(arguments);
  18084. }
  18085. {
  18086. var count = tickArguments.length > 0 ? + (tickArguments[0]) : null;
  18087. var format = tickArguments.length > 1 ? tickArguments[1] : null;
  18088. return self.logTickFormat(count, format);
  18089. }
  18090. };
  18091. this.invert = function(y) {
  18092. return self.pow(+ (self._linear.invert(y)));
  18093. };
  18094. },
  18095. domain$0 : function(values) {
  18096. this._positive = + (values[0]) >= 0;
  18097. this._domain = new Array(values.length);
  18098. for (var i = 0; i < values.length; ++i) {
  18099. this._domain[i] = + (values[i]);
  18100. }
  18101. var self = this;
  18102. this._linear.domain$0(this._domain.map(function(currentValue, index, array) {
  18103. return self.log(+ (currentValue));
  18104. }));
  18105. return this;
  18106. },
  18107. domain$1 : function() {
  18108. return this._domain;
  18109. },
  18110. range$0 : function(values) {
  18111. this._linear.range$0(values);
  18112. return this;
  18113. },
  18114. range$1 : function() {
  18115. return this._linear.range$1();
  18116. },
  18117. /** @expose */
  18118. copy : function() {
  18119. return new com_ibm_rave_core_scales_LogScale(this._linear.copy(), this._base, this._positive, this._domain);
  18120. },
  18121. /**
  18122. * 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.
  18123. * @param (boolean) c True or False to Enable or Disable (respectively) clamping.
  18124. * @return (com.ibm.rave.core.scales.LogScale) This scale.
  18125. */
  18126. clamp$0 : function(c) {
  18127. this._linear.clamp$0(c);
  18128. return this;
  18129. },
  18130. /**
  18131. * Returns true if clamping is enabled, false otherwise.
  18132. * @return (boolean) Clamp state.
  18133. */
  18134. clamp$1 : function() {
  18135. return this._linear.clamp$1();
  18136. },
  18137. /**
  18138. * Convenience method that will round the scale output values to whole numbers.
  18139. * @param (Array) x Output range values.
  18140. * @return (com.ibm.rave.core.scales.LogScale) This scale.
  18141. */
  18142. /** @expose */
  18143. rangeRound : function(x) {
  18144. this._linear.rangeRound(x);
  18145. return this;
  18146. },
  18147. /**
  18148. * Set the interpolator.
  18149. * @param (com.ibm.rave.core.interpolate.InterpolatorFactory) interpolate The interpolator factory to assign to this scale
  18150. * @return (com.ibm.rave.core.scales.LogScale) This scale.
  18151. */
  18152. interpolate$0 : function(interpolate) {
  18153. this._linear.interpolate$0(interpolate);
  18154. return this;
  18155. },
  18156. /**
  18157. * @return (Object) The interpolator assigned to this scale.
  18158. */
  18159. interpolate$1 : function() {
  18160. return this._linear.interpolate$1();
  18161. },
  18162. /**
  18163. * 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].
  18164. * @return (com.ibm.rave.core.scales.LogScale) This scale.
  18165. */
  18166. /** @expose */
  18167. nice : function() {
  18168. var self = this;
  18169. var niced = com_ibm_rave_core_internal_scales_Nice.scaleNice(this._domain.map(function(currentValue, index, array) {
  18170. return self.log(+ (currentValue));
  18171. }), this._positive ? com_ibm_rave_core_scales_LogScale.logNice : com_ibm_rave_core_scales_LogScale.logNiceNegative);
  18172. this._linear.domain(niced);
  18173. this._domain = niced.map(function(currentValue, index, array) {
  18174. return self.pow(+ (currentValue));
  18175. });
  18176. return this;
  18177. },
  18178. /**
  18179. * Set the log base value.
  18180. * @param (Number) b New base value.
  18181. * @return (com.ibm.rave.core.scales.LogScale) This LogScale.
  18182. */
  18183. base$0 : function(b) {
  18184. this._base = (b);
  18185. return this;
  18186. },
  18187. /**
  18188. * Get the current log base value.
  18189. */
  18190. base$1 : function() {
  18191. return this._base;
  18192. },
  18193. log : function(x) {
  18194. return (this._positive ? Math.log(x < 0 ? 0 : x) : -Math.log(x > 0 ? 0 : -x)) / Math.log(this._base);
  18195. },
  18196. pow : function(x) {
  18197. return this._positive ? Math.pow(this._base, x) : -Math.pow(this._base, -x);
  18198. },
  18199. /**
  18200. * Implementation of the LogScale#ticks method from D3.
  18201. * @param (java.lang.Object[]) tickArguments Arguments passed to the scale from Axis (in the case of log scales, no arguments are required).
  18202. * @return (Array) Array of tick values.
  18203. */
  18204. logTicks : function(tickArguments) {
  18205. if (tickArguments !== null || arguments.length > 1){
  18206. tickArguments = Array.prototype.slice.call(arguments);
  18207. }
  18208. {
  18209. var extent = com_ibm_rave_core_scales_AbstractScale.scaleExtent(this._domain);
  18210. var ticks = [];
  18211. var u = + (extent[0]);
  18212. var v = + (extent[1]);
  18213. var i = Math.floor(this.log(u));
  18214. var j = Math.ceil(this.log(v));
  18215. var n = this._base % 1 == 0 ? this._base : 2;
  18216. var delta = j - i;
  18217. if (isFinite(delta)) {
  18218. if (this._positive) {
  18219. for (; i < j; ++i) {
  18220. for (var k = 1.0; k < n; ++k) {
  18221. ticks.push(this.pow(i) * k);
  18222. }
  18223. }
  18224. ticks.push(this.pow(i));
  18225. } else {
  18226. ticks.push(this.pow(i));
  18227. for (; i++ < j;) {
  18228. for (var k = n - 1; k > 0; --k) {
  18229. ticks.push(this.pow(i) * k);
  18230. }
  18231. }
  18232. }
  18233. for (i = 0.0; ticks[~~i] < u; ++i) {
  18234. }
  18235. for (j = (ticks.length); ticks[~~j - 1] > v; --j) {
  18236. }
  18237. ticks = ticks.slice(~~i, ~~j);
  18238. }
  18239. return (ticks);
  18240. }
  18241. },
  18242. /**
  18243. * Implementation of the LogScale#tickFormat method from D3.
  18244. * @param (Number) count Number of ticks that should be displayed. Optional.
  18245. * @param (Object) formatter A String format specifier, or a function ( {@link NumberFormatValueFunction} ) which will override the default format function.
  18246. * @return (com.ibm.rave.core.selector.ValueFunction) A number formatter function.
  18247. */
  18248. logTickFormat : function(count, formatter) {
  18249. if (count == null && formatter == null) {
  18250. return com_ibm_rave_core_scales_LogScale.logFormat;
  18251. }
  18252. var format;
  18253. if (formatter == null) {
  18254. format = com_ibm_rave_core_scales_LogScale.logFormat;
  18255. } else if (typeof formatter === "function") {
  18256. format = formatter;
  18257. } else {
  18258. format = new com_ibm_rave_core_locale_NumberFormat(com_ibm_rave_core_locale_Locale.DEFAULT_LOCALE)(""+(formatter));
  18259. }
  18260. var n = + (count);
  18261. var k = Math.max(0.1, n / this.ticks().length);
  18262. var e = this._positive ? 1e-12 : -1e-12;
  18263. var f = this._positive ? com_ibm_rave_core_scales_LogScale.ceilRoundFunc : com_ibm_rave_core_scales_LogScale.floorRoundFunc;
  18264. var self = this;
  18265. return function(data, index, groupIndex) {
  18266. var value = + (data);
  18267. return value / self.pow(f(self.log(value) + e)) <= k ? format.call(this, value, index, groupIndex) : "";
  18268. };
  18269. },
  18270. /** @expose */
  18271. domain : function(a0) {
  18272. var args = arguments;
  18273. if (args.length == 0) {
  18274. return this.domain$1();
  18275. }
  18276. return this.domain$0(a0);
  18277. },
  18278. /** @expose */
  18279. range : function(a0) {
  18280. var args = arguments;
  18281. if (args.length == 0) {
  18282. return this.range$1();
  18283. }
  18284. return this.range$0(a0);
  18285. },
  18286. /** @expose */
  18287. clamp : function(a0) {
  18288. var args = arguments;
  18289. if (args.length == 0) {
  18290. return this.clamp$1();
  18291. }
  18292. return this.clamp$0(a0);
  18293. },
  18294. /** @expose */
  18295. interpolate : function(a0) {
  18296. var args = arguments;
  18297. if (args.length == 0) {
  18298. return this.interpolate$1();
  18299. }
  18300. return this.interpolate$0(a0);
  18301. },
  18302. /** @expose */
  18303. base : function(a0) {
  18304. var args = arguments;
  18305. if (args.length == 0) {
  18306. return this.base$1();
  18307. }
  18308. return this.base$0(a0);
  18309. }
  18310. });
  18311. /** @expose */
  18312. com_ibm_rave_core_scales_LogScale.DEFAULT_BASE = 10.0;
  18313. //com_ibm_rave_core_scales_LogScale.logFormat = null;
  18314. com_ibm_rave_core_scales_LogScale.logNice = new com_ibm_rave_core_internal_scales_NiceIdentity(function(x) {
  18315. return Math.floor((x));
  18316. }, function(x) {
  18317. return Math.ceil((x));
  18318. });
  18319. com_ibm_rave_core_scales_LogScale.logNiceNegative = new com_ibm_rave_core_internal_scales_NiceIdentity(function(x) {
  18320. return -Math.ceil(-(x));
  18321. }, function(x) {
  18322. return -Math.floor(-(x));
  18323. });
  18324. com_ibm_rave_core_scales_LogScale.ceilRoundFunc = function(v) {
  18325. return Math.ceil(v);
  18326. };
  18327. com_ibm_rave_core_scales_LogScale.floorRoundFunc = function(v) {
  18328. return Math.floor(v);
  18329. };
  18330. // $source: com/ibm/rave/core/locale/Locale
  18331. /************************************************************************
  18332. ** IBM Confidential
  18333. **
  18334. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  18335. **
  18336. ** (C) Copyright IBM Corp. 2017
  18337. **
  18338. ** The source code for this program is not published or otherwise divested of its trade secrets,
  18339. ** irrespective of what has been deposited with the U.S. Copyright Office.
  18340. ************************************************************************/
  18341. // GENERATED
  18342. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  18343. //@import com/ibm/rave/core/locale/LocaleFormatter (runtime) // new
  18344. /**
  18345. * 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.
  18346. */
  18347. var com_ibm_rave_core_locale_Locale = com_ibm_rave_core_nativeImpl_Declare({
  18348. //formatter : null,
  18349. _$functionClassMethod : function() {
  18350. var _$self = /**
  18351. * 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).
  18352. * @param (Object) localeObject the locale object to use
  18353. * @return (com.ibm.rave.core.locale.LocaleFormatter) the LocaleFormatter object containing the new numberformat
  18354. */
  18355. function(localeObject) {
  18356. return new com_ibm_rave_core_locale_LocaleFormatter(localeObject);
  18357. };
  18358. return _$self;
  18359. },
  18360. constructor : function() {
  18361. this.formatter = new com_ibm_rave_core_locale_LocaleFormatter(com_ibm_rave_core_locale_Locale.DEFAULT_LOCALE);
  18362. },
  18363. /**
  18364. * 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.
  18365. * @return (com.ibm.rave.core.locale.LocaleFormatter) the default locale formatter.
  18366. */
  18367. /** @expose */
  18368. getDefault : function() {
  18369. return this.formatter;
  18370. }
  18371. //constructor : function() {}
  18372. });
  18373. com_ibm_rave_core_locale_Locale.makeDefaultLocaleObject = function() {
  18374. var enUs = {};
  18375. enUs["decimal"] = ".";
  18376. enUs["thousands"] = ",";
  18377. enUs["grouping"] = [3.0];
  18378. enUs["currency"] = ["$", ""];
  18379. enUs["dateTime"] = "%a %b %e %X %Y";
  18380. enUs["date"] = "%m/%d/%Y";
  18381. enUs["time"] = "%H:%M:%S";
  18382. enUs["periods"] = ["AM", "PM"];
  18383. enUs["days"] = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
  18384. enUs["shortDays"] = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
  18385. enUs["months"] = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
  18386. enUs["shortMonths"] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
  18387. return enUs;
  18388. };
  18389. /** @expose */
  18390. com_ibm_rave_core_locale_Locale.getInstance = function() {
  18391. if (!com_ibm_rave_core_locale_Locale.INSTANCE) {
  18392. {
  18393. if (!com_ibm_rave_core_locale_Locale.INSTANCE) {
  18394. com_ibm_rave_core_locale_Locale.INSTANCE = new com_ibm_rave_core_locale_Locale();
  18395. }
  18396. }
  18397. }
  18398. return com_ibm_rave_core_locale_Locale.INSTANCE;
  18399. };
  18400. /**
  18401. * Default system locale (en-us).
  18402. */
  18403. /** @expose */
  18404. com_ibm_rave_core_locale_Locale.DEFAULT_LOCALE = com_ibm_rave_core_locale_Locale.makeDefaultLocaleObject();
  18405. //com_ibm_rave_core_locale_Locale.INSTANCE = null;
  18406. // $source: com/ibm/rave/core/locale/LocaleFormatter
  18407. /************************************************************************
  18408. ** IBM Confidential
  18409. **
  18410. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  18411. **
  18412. ** (C) Copyright IBM Corp. 2017
  18413. **
  18414. ** The source code for this program is not published or otherwise divested of its trade secrets,
  18415. ** irrespective of what has been deposited with the U.S. Copyright Office.
  18416. ************************************************************************/
  18417. // GENERATED
  18418. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  18419. //@import com/ibm/rave/core/locale/NumberFormat (runtime) // new
  18420. //@import com/ibm/rave/core/locale/TimeFormat (runtime) // new
  18421. //@import com/ibm/rave/core/globalization/BidiStringFormat (runtime) // new
  18422. var com_ibm_rave_core_locale_LocaleFormatter = rave_externs["LocaleFormatter"] = com_ibm_rave_core_nativeImpl_Declare({
  18423. /** @expose */
  18424. numberFormat : null,
  18425. /** @expose */
  18426. timeFormat : null,
  18427. /** @expose */
  18428. bidiStringFormat : null,
  18429. /**
  18430. * C'tor that sets the numberformat variable
  18431. * @param (Object) locale the locale that is meant to be used while formatting numbers
  18432. */
  18433. /** @expose */
  18434. constructor : function(locale) {
  18435. this.numberFormat = new com_ibm_rave_core_locale_NumberFormat(locale);
  18436. this.timeFormat = new com_ibm_rave_core_locale_TimeFormat(locale);
  18437. this.bidiStringFormat = new com_ibm_rave_core_globalization_BidiStringFormat(locale);
  18438. }
  18439. });
  18440. // $source: com/ibm/rave/core/locale/TimeFormatSpecifier
  18441. /************************************************************************
  18442. ** IBM Confidential
  18443. **
  18444. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  18445. **
  18446. ** (C) Copyright IBM Corp. 2017
  18447. **
  18448. ** The source code for this program is not published or otherwise divested of its trade secrets,
  18449. ** irrespective of what has been deposited with the U.S. Copyright Office.
  18450. ************************************************************************/
  18451. // GENERATED
  18452. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // bind, declare
  18453. /**
  18454. * An abstract class which is extended by TimeFormat
  18455. */
  18456. var com_ibm_rave_core_locale_TimeFormatSpecifier = rave_externs["TimeFormatSpecifier"] = com_ibm_rave_core_nativeImpl_Declare({
  18457. /**
  18458. * 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.
  18459. * @param (java.lang.Object[][]) formats a 2D array containing the string format as well as a predicate ValueFunction.
  18460. * @return (com.ibm.rave.core.selector.ValueFunction) a new multi-resolution time format
  18461. */
  18462. /** @expose */
  18463. multi : com_ibm_rave_core_nativeImpl_Declare.bind(function(formats) {
  18464. var n = formats.length;
  18465. var i = -1;
  18466. while (++i < n) {
  18467. formats[i][0] = this(formats[i][0].toString());
  18468. }
  18469. return function(data, index, groupIndex) {
  18470. var z = 0;
  18471. var f = formats[z];
  18472. var formatter = f[1];
  18473. while (!((formatter.call(null, data, 0, 0)))) {
  18474. f = formats[++z];
  18475. formatter = f[1];
  18476. }
  18477. var firstFormatter = f[0];
  18478. return ""+(firstFormatter.call(null, data, 0, 0));
  18479. };
  18480. })
  18481. });
  18482. // $source: com/ibm/rave/core/time/FormatISO
  18483. /************************************************************************
  18484. ** IBM Confidential
  18485. **
  18486. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  18487. **
  18488. ** (C) Copyright IBM Corp. 2017
  18489. **
  18490. ** The source code for this program is not published or otherwise divested of its trade secrets,
  18491. ** irrespective of what has been deposited with the U.S. Copyright Office.
  18492. ************************************************************************/
  18493. // GENERATED
  18494. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  18495. //@import com/ibm/rave/core/time/Time (runtime) // getInstance
  18496. /**
  18497. * 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");
  18498. */
  18499. var com_ibm_rave_core_time_FormatISO = rave_externs["FormatISO"] = com_ibm_rave_core_nativeImpl_Declare({
  18500. _$functionClassMethod : function() {
  18501. var _$self = /**
  18502. * Gets the result of toISOString
  18503. * @param (Object) date the date object to call toISOString()
  18504. * @return (String) the result of toISOString()
  18505. */
  18506. function(date, index, groupIndex) {
  18507. return (date).toISOString();
  18508. };
  18509. return _$self;
  18510. },
  18511. /**
  18512. * @return (String) the value of toString
  18513. */
  18514. /** @expose */
  18515. toString : function() {
  18516. return com_ibm_rave_core_time_Time.getInstance().format("%Y-%m-%dT%H:%M:%S.%LZ").toString();
  18517. },
  18518. /**
  18519. * Will return an ISO formatted date. If the String passed in was incorrect, this method will return null
  18520. * @param (String) str the iso date to be parsed
  18521. * @return (com.ibm.rave.core.time.IDate) An iso formatted date in the case that the string passed in was correct. Otherwise, returns null
  18522. */
  18523. /** @expose */
  18524. parse : function(str) {
  18525. if (str == null) {
  18526. return null;
  18527. }
  18528. var date = new Date(str);
  18529. return isNaN(date) ? null : date;
  18530. }
  18531. });
  18532. // $source: com/ibm/rave/core/time/Time
  18533. /************************************************************************
  18534. ** IBM Confidential
  18535. **
  18536. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  18537. **
  18538. ** (C) Copyright IBM Corp. 2017
  18539. **
  18540. ** The source code for this program is not published or otherwise divested of its trade secrets,
  18541. ** irrespective of what has been deposited with the U.S. Copyright Office.
  18542. ************************************************************************/
  18543. // GENERATED
  18544. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, declare anonymous
  18545. //@import com/ibm/rave/core/time/DateTimeScale (runtime) // new, DateTimeScale
  18546. //@import com/ibm/rave/core/locale/TimeFormat (runtime) // new
  18547. //@import com/ibm/rave/core/locale/Locale (runtime) // Locale
  18548. //@import com/ibm/rave/core/time/Day (runtime) // Day
  18549. //@import com/ibm/rave/core/time/Hour (runtime) // Hour
  18550. //@import com/ibm/rave/core/time/Month (runtime) // Month
  18551. //@import com/ibm/rave/core/time/Year (runtime) // Year
  18552. //@import com/ibm/rave/core/time/Second (runtime) // Second
  18553. //@import com/ibm/rave/core/time/Minute (runtime) // Minute
  18554. //@import com/ibm/rave/core/time/Millisecond (runtime) // Millisecond
  18555. //@import com/ibm/rave/core/time/Week (runtime) // new
  18556. //@import com/ibm/rave/core/internal/time/TimeUtil (runtime) // dayOfYear
  18557. //@import com/ibm/rave/core/time/TimeIntervalUTC (runtime) // new
  18558. /**
  18559. * Time class from which time scales, time formats and time interval functionality may be accessed and used
  18560. */
  18561. var com_ibm_rave_core_time_Time = com_ibm_rave_core_nativeImpl_Declare({
  18562. /**
  18563. * Overrides the TimeScale methods utc() and scale()
  18564. */
  18565. /** @expose */
  18566. scale : null,
  18567. /**
  18568. * 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.
  18569. */
  18570. /** @expose */
  18571. format : null,
  18572. /**
  18573. * 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.
  18574. */
  18575. /** @expose */
  18576. day : null,
  18577. /**
  18578. * 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.
  18579. */
  18580. /** @expose */
  18581. hour : null,
  18582. /**
  18583. * Months (e.g., February 1, 2012 at 12:00 AM). Ranges between 28 and 31 days.
  18584. */
  18585. /** @expose */
  18586. month : null,
  18587. /**
  18588. * Years (e.g., January 1, 2012 at 12:00 AM). Normal years are 365 days long; leap years are 366.
  18589. */
  18590. /** @expose */
  18591. year : null,
  18592. /**
  18593. * Seconds (e.g., 01:23:45.0000 AM). Always 1,000 milliseconds long.
  18594. */
  18595. /** @expose */
  18596. second : null,
  18597. /**
  18598. * Minutes (e.g., 01:02:00 AM). Most browsers do not support leap seconds, so minutes are almost always 60 seconds (6e4 milliseconds) long.
  18599. */
  18600. /** @expose */
  18601. minute : null,
  18602. /**
  18603. * Milliseconds (e.g., 01:02:00:001)
  18604. */
  18605. /** @expose */
  18606. millisecond : null,
  18607. /**
  18608. * 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.
  18609. */
  18610. /** @expose */
  18611. days : null,
  18612. /**
  18613. * 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.
  18614. */
  18615. /** @expose */
  18616. years : null,
  18617. /**
  18618. * 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.
  18619. */
  18620. /** @expose */
  18621. months : null,
  18622. /**
  18623. * 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.
  18624. */
  18625. /** @expose */
  18626. hours : null,
  18627. /**
  18628. * 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.
  18629. */
  18630. /** @expose */
  18631. minutes : null,
  18632. /**
  18633. * 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.
  18634. */
  18635. /** @expose */
  18636. seconds : null,
  18637. /**
  18638. * Sunday-based weeks (e.g., February 5, 2012 at 12:00 AM)
  18639. */
  18640. /** @expose */
  18641. sunday : null,
  18642. /**
  18643. * Alias for rave.time.sunday. A week is always 7 days, but ranges between 167 and 169 hours depending on Daylight Savings Time.
  18644. */
  18645. /** @expose */
  18646. week : null,
  18647. /**
  18648. * Monday-based weeks (e.g., February 6, 2012 at 12:00 AM)
  18649. */
  18650. /** @expose */
  18651. monday : null,
  18652. /**
  18653. * Tuesday-based weeks (e.g., February 7, 2012 at 12:00 AM)
  18654. */
  18655. /** @expose */
  18656. tuesday : null,
  18657. /**
  18658. * Wednesday-based weeks (e.g., February 8, 2012 at 12:00 AM)
  18659. */
  18660. /** @expose */
  18661. wednesday : null,
  18662. /**
  18663. * Thursday-based weeks (e.g., February 9, 2012 at 12:00 AM)
  18664. */
  18665. /** @expose */
  18666. thursday : null,
  18667. /**
  18668. * Friday-based weeks (e.g., February 10, 2012 at 12:00 AM)
  18669. */
  18670. /** @expose */
  18671. friday : null,
  18672. /**
  18673. * Saturday-based weeks (e.g., February 11, 2012 at 12:00 AM)
  18674. */
  18675. /** @expose */
  18676. saturday : null,
  18677. /**
  18678. * 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.
  18679. */
  18680. /** @expose */
  18681. sundays : null,
  18682. /**
  18683. * Alias for sunday.range
  18684. */
  18685. /** @expose */
  18686. weeks : null,
  18687. /**
  18688. * Alias for monday.range
  18689. */
  18690. /** @expose */
  18691. mondays : null,
  18692. /**
  18693. * Alias for tuesday.range
  18694. */
  18695. /** @expose */
  18696. tuesdays : null,
  18697. /**
  18698. * Alias for wednesday.range
  18699. */
  18700. /** @expose */
  18701. wednesdays : null,
  18702. /**
  18703. * Alias for thursday.range
  18704. */
  18705. /** @expose */
  18706. thursdays : null,
  18707. /**
  18708. * Alias for friday.range
  18709. */
  18710. /** @expose */
  18711. fridays : null,
  18712. /**
  18713. * Alias for saturday.range
  18714. */
  18715. /** @expose */
  18716. saturdays : null,
  18717. /**
  18718. * 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
  18719. */
  18720. /** @expose */
  18721. sundayOfYear : null,
  18722. /**
  18723. * Alias for sundayOfYear
  18724. */
  18725. /** @expose */
  18726. weekOfYear : null,
  18727. /**
  18728. * Computes the Monday-based week number
  18729. */
  18730. /** @expose */
  18731. mondayOfYear : null,
  18732. /**
  18733. * Computes the Tuesday-based week number
  18734. */
  18735. /** @expose */
  18736. tuesdayOfYear : null,
  18737. /**
  18738. * Computes the Wednesday-based week number
  18739. */
  18740. /** @expose */
  18741. wednesdayOfYear : null,
  18742. /**
  18743. * Computes the Thursday-based week number
  18744. */
  18745. /** @expose */
  18746. thursdayOfYear : null,
  18747. /**
  18748. * Computes the Friday-based week number
  18749. */
  18750. /** @expose */
  18751. fridayOfYear : null,
  18752. /**
  18753. * Computes the Saturday-based week number
  18754. */
  18755. /** @expose */
  18756. saturdayOfYear : null,
  18757. constructor : function() {
  18758. this.scale = new (com_ibm_rave_core_nativeImpl_Declare({
  18759. _$functionClassMethod : function() {
  18760. var _$self = function() {
  18761. 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);
  18762. };
  18763. return _$self;
  18764. },
  18765. utc : function() {
  18766. 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);
  18767. }
  18768. }))();
  18769. this.format = new com_ibm_rave_core_locale_TimeFormat(com_ibm_rave_core_locale_Locale.DEFAULT_LOCALE);
  18770. this.day = com_ibm_rave_core_time_Day.INSTANCE;
  18771. this.hour = com_ibm_rave_core_time_Hour.INSTANCE;
  18772. this.month = com_ibm_rave_core_time_Month.INSTANCE;
  18773. this.year = com_ibm_rave_core_time_Year.INSTANCE;
  18774. this.second = com_ibm_rave_core_time_Second.INSTANCE;
  18775. this.minute = com_ibm_rave_core_time_Minute.INSTANCE;
  18776. this.millisecond = com_ibm_rave_core_time_Millisecond.INSTANCE;
  18777. this.days = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.day);
  18778. this.years = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.year);
  18779. this.months = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.month);
  18780. this.hours = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.hour);
  18781. this.minutes = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.minute);
  18782. this.seconds = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.second);
  18783. this.sunday = new com_ibm_rave_core_time_Week(0);
  18784. this.week = this.sunday;
  18785. this.monday = new com_ibm_rave_core_time_Week(1);
  18786. this.tuesday = new com_ibm_rave_core_time_Week(2);
  18787. this.wednesday = new com_ibm_rave_core_time_Week(3);
  18788. this.thursday = new com_ibm_rave_core_time_Week(4);
  18789. this.friday = new com_ibm_rave_core_time_Week(5);
  18790. this.saturday = new com_ibm_rave_core_time_Week(6);
  18791. this.sundays = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.sunday);
  18792. this.weeks = this.sundays;
  18793. this.mondays = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.monday);
  18794. this.tuesdays = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.tuesday);
  18795. this.wednesdays = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.wednesday);
  18796. this.thursdays = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.thursday);
  18797. this.fridays = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.friday);
  18798. this.saturdays = new com_ibm_rave_core_time_Time.TimeRangeImpl(this.saturday);
  18799. this.sundayOfYear = new com_ibm_rave_core_time_Time.WeekOfYear(0);
  18800. this.weekOfYear = this.sundayOfYear;
  18801. this.mondayOfYear = new com_ibm_rave_core_time_Time.WeekOfYear(1);
  18802. this.tuesdayOfYear = new com_ibm_rave_core_time_Time.WeekOfYear(2);
  18803. this.wednesdayOfYear = new com_ibm_rave_core_time_Time.WeekOfYear(3);
  18804. this.thursdayOfYear = new com_ibm_rave_core_time_Time.WeekOfYear(4);
  18805. this.fridayOfYear = new com_ibm_rave_core_time_Time.WeekOfYear(5);
  18806. this.saturdayOfYear = new com_ibm_rave_core_time_Time.WeekOfYear(6);
  18807. },
  18808. /**
  18809. * 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.
  18810. * @param (com.ibm.rave.core.time.IDate) date the date to get the day number from
  18811. * @return (int) The day of the year for a given date
  18812. */
  18813. /** @expose */
  18814. dayOfYear : function(date) {
  18815. return com_ibm_rave_core_internal_time_TimeUtil.dayOfYear(date);
  18816. }
  18817. //constructor : function() {}
  18818. });
  18819. /**
  18820. * Gets or creates and sets a new instance of Time
  18821. * @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.
  18822. */
  18823. /** @expose */
  18824. com_ibm_rave_core_time_Time.getInstance = function() {
  18825. if (!com_ibm_rave_core_time_Time.INSTANCE) {
  18826. {
  18827. if (!com_ibm_rave_core_time_Time.INSTANCE) {
  18828. com_ibm_rave_core_time_Time.INSTANCE = new com_ibm_rave_core_time_Time();
  18829. }
  18830. }
  18831. }
  18832. return com_ibm_rave_core_time_Time.INSTANCE;
  18833. };
  18834. /**
  18835. * A helper class which overrides interval.range
  18836. */
  18837. com_ibm_rave_core_time_Time.TimeRange = rave_externs["TimeRange"] = com_ibm_rave_core_nativeImpl_Declare({
  18838. /** @expose */
  18839. interval : null,
  18840. /**
  18841. * By default utc is null. Only set in TimeRangeImpl
  18842. */
  18843. /** @expose */
  18844. utc : null,
  18845. _$functionClassMethod : function() {
  18846. var _$self = function(start, stop, step) {
  18847. return _$self.interval.range(start, stop, step);
  18848. };
  18849. return _$self;
  18850. },
  18851. /**
  18852. * C'tor which sets the interval
  18853. * @param (com.ibm.rave.core.time.ITimeInterval) interval the time interval to be set
  18854. */
  18855. /** @expose */
  18856. constructor : function(interval) {
  18857. this.interval = interval;
  18858. },
  18859. /**
  18860. * @return (com.ibm.rave.core.time.ITimeInterval) the interval
  18861. */
  18862. /** @expose */
  18863. getInterval : function() {
  18864. return this.interval;
  18865. },
  18866. /** @expose */
  18867. hasRangeMethod : function() {
  18868. return false;
  18869. }
  18870. });
  18871. com_ibm_rave_core_time_Time.TimeRangeImpl = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_time_Time.TimeRange, {
  18872. /** @expose */
  18873. constructor : function(interval) {
  18874. this.utc = new com_ibm_rave_core_time_Time.TimeRangeUTC(interval);
  18875. }
  18876. });
  18877. com_ibm_rave_core_time_Time.TimeRangeUTC = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_time_Time.TimeRange, {
  18878. /** @expose */
  18879. constructor : function(interval) {
  18880. this.interval = new com_ibm_rave_core_time_TimeIntervalUTC(interval);
  18881. }
  18882. });
  18883. /**
  18884. * 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.
  18885. */
  18886. com_ibm_rave_core_time_Time.WeekOfYear = com_ibm_rave_core_nativeImpl_Declare({
  18887. weekIndex : 0,
  18888. _$functionClassMethod : function() {
  18889. var _$self = function(date) {
  18890. var day = com_ibm_rave_core_time_Time.getInstance().year(date).getDay();
  18891. return Math.floor((com_ibm_rave_core_time_Time.getInstance().dayOfYear(date) + (day + (7 - _$self.weekIndex)) % 7) / 7);
  18892. };
  18893. return _$self;
  18894. },
  18895. constructor : function(index) {
  18896. this.weekIndex = index;
  18897. }
  18898. });
  18899. //com_ibm_rave_core_time_Time.INSTANCE = null;
  18900. // $source: com/ibm/rave/core/time/TimeIntervalUTC
  18901. /************************************************************************
  18902. ** IBM Confidential
  18903. **
  18904. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  18905. **
  18906. ** (C) Copyright IBM Corp. 2017
  18907. **
  18908. ** The source code for this program is not published or otherwise divested of its trade secrets,
  18909. ** irrespective of what has been deposited with the U.S. Copyright Office.
  18910. ************************************************************************/
  18911. // GENERATED
  18912. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // bind, declare
  18913. //@import com/ibm/rave/core/time/DateUTC (runtime) // new
  18914. /**
  18915. * A UTC version of TimeInterval. Delegates to the passed in interval, and converts all dates into UTC time before using them.
  18916. */
  18917. var com_ibm_rave_core_time_TimeIntervalUTC = rave_externs["TimeIntervalUTC"] = com_ibm_rave_core_nativeImpl_Declare({
  18918. //delegate : null,
  18919. _$functionClassMethod : function() {
  18920. var _$self = function(start) {
  18921. return _$self.floor(start);
  18922. };
  18923. return _$self;
  18924. },
  18925. /**
  18926. * Constructor which sets interval
  18927. * @param (com.ibm.rave.core.time.TimeInterval) interval the time interval to set
  18928. */
  18929. /** @expose */
  18930. constructor : function(interval) {
  18931. this.delegate = interval;
  18932. },
  18933. /** @expose */
  18934. hasRangeMethod : function() {
  18935. return true;
  18936. },
  18937. /** @expose */
  18938. round : com_ibm_rave_core_nativeImpl_Declare.bind(function(date) {
  18939. return this.delegate.round(new com_ibm_rave_core_time_DateUTC(date.getTime())).getDateObject();
  18940. }),
  18941. /** @expose */
  18942. ceil : com_ibm_rave_core_nativeImpl_Declare.bind(function(date) {
  18943. return this.delegate.ceil(new com_ibm_rave_core_time_DateUTC(date.getTime())).getDateObject();
  18944. }),
  18945. /** @expose */
  18946. offset : com_ibm_rave_core_nativeImpl_Declare.bind(function(date, k) {
  18947. return this.delegate.offset(new com_ibm_rave_core_time_DateUTC(date.getTime()), k).getDateObject();
  18948. }),
  18949. /** @expose */
  18950. range : com_ibm_rave_core_nativeImpl_Declare.bind(function(t0, t1, dt) {
  18951. return this.delegate.range(new com_ibm_rave_core_time_DateUTC(t0.getTime()), new com_ibm_rave_core_time_DateUTC(t1.getTime()), dt);
  18952. }),
  18953. /** @expose */
  18954. floor : com_ibm_rave_core_nativeImpl_Declare.bind(function(date) {
  18955. return this.delegate.floor(new com_ibm_rave_core_time_DateUTC(date.getTime())).getDateObject();
  18956. }),
  18957. /** @expose */
  18958. step : com_ibm_rave_core_nativeImpl_Declare.bind(function(date, offset) {
  18959. this.delegate.step(new com_ibm_rave_core_time_DateUTC(date.getTime()), offset);
  18960. }),
  18961. /** @expose */
  18962. number : com_ibm_rave_core_nativeImpl_Declare.bind(function(date) {
  18963. return this.delegate.number(new com_ibm_rave_core_time_DateUTC(date.getTime()));
  18964. })
  18965. });
  18966. // $source: com/ibm/rave/core/time/TimeInterval
  18967. /************************************************************************
  18968. ** IBM Confidential
  18969. **
  18970. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  18971. **
  18972. ** (C) Copyright IBM Corp. 2017
  18973. **
  18974. ** The source code for this program is not published or otherwise divested of its trade secrets,
  18975. ** irrespective of what has been deposited with the U.S. Copyright Office.
  18976. ************************************************************************/
  18977. // GENERATED
  18978. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // bind, declare
  18979. //@import com/ibm/rave/core/time/TimeIntervalUTC (static) // new
  18980. //@import com/ibm/rave/core/time/DateUTC (runtime) // new
  18981. /**
  18982. * 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
  18983. */
  18984. var com_ibm_rave_core_time_TimeInterval = rave_externs["TimeInterval"] = com_ibm_rave_core_nativeImpl_Declare({
  18985. /**
  18986. * 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.
  18987. */
  18988. /** @expose */
  18989. utc : null,
  18990. _$functionClassMethod : function() {
  18991. var _$self = /**
  18992. * Alias for interval.floor(date). For example, rave.time.day(new Date()) returns midnight (12:00 AM) on the current day, in local time.
  18993. * @param (com.ibm.rave.core.time.IDate) start the start date
  18994. * @return (com.ibm.rave.core.time.IDate) interval.floor(date)
  18995. */
  18996. function(start) {
  18997. return _$self.floor(start);
  18998. };
  18999. return _$self;
  19000. },
  19001. constructor : function() {
  19002. this.utc = new com_ibm_rave_core_time_TimeIntervalUTC(this);
  19003. },
  19004. /** @expose */
  19005. hasRangeMethod : function() {
  19006. return true;
  19007. },
  19008. /** @expose */
  19009. round : com_ibm_rave_core_nativeImpl_Declare.bind(function(date) {
  19010. var d0 = this(date), d1 = this.offset(d0, 1);
  19011. return date.getTime() - d0.getTime() < d1.getTime() - date.getTime() ? d0 : d1;
  19012. }),
  19013. /** @expose */
  19014. ceil : com_ibm_rave_core_nativeImpl_Declare.bind(function(date) {
  19015. var localDate = this.createDate(date, date.getTime() - 1);
  19016. localDate = this(localDate);
  19017. this.step(localDate, 1);
  19018. return localDate;
  19019. }),
  19020. /** @expose */
  19021. offset : com_ibm_rave_core_nativeImpl_Declare.bind(function(date, k) {
  19022. var newDate = this.createDate(date, date.getTime());
  19023. this.step(newDate, k);
  19024. return newDate;
  19025. }),
  19026. /** @expose */
  19027. range : com_ibm_rave_core_nativeImpl_Declare.bind(function(start, stop, step) {
  19028. var time = this.ceil(start);
  19029. var times = [];
  19030. if (step > 1) {
  19031. while (time.getTime() < stop.getTime()) {
  19032. if (!((this.number(time) % step))) {
  19033. times.push(new Date(time.getTime()));
  19034. }
  19035. this.step(time, 1);
  19036. }
  19037. } else {
  19038. while (time.getTime() < stop.getTime()) {
  19039. times.push(new Date(time.getTime()));
  19040. this.step(time, 1);
  19041. }
  19042. }
  19043. return times;
  19044. }),
  19045. /**
  19046. * 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.
  19047. * @param (com.ibm.rave.core.time.IDate) date the date to be set on the new Date object
  19048. * @param (long) time the time to be set on the new Date object
  19049. * @return (com.ibm.rave.core.time.IDate) A new {@link (Date) Date} object
  19050. */
  19051. /** @expose */
  19052. createDate : function(date, time) {
  19053. 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);
  19054. return newdate;
  19055. },
  19056. /** @expose */
  19057. floor : function(date) {},
  19058. /** @expose */
  19059. step : function(date, offset) {},
  19060. /** @expose */
  19061. number : function(date) {}
  19062. });
  19063. com_ibm_rave_core_time_TimeInterval.utc_load_flag_unused = new com_ibm_rave_core_time_TimeIntervalUTC(null);
  19064. // $source: com/ibm/rave/core/time/Day
  19065. /************************************************************************
  19066. ** IBM Confidential
  19067. **
  19068. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  19069. **
  19070. ** (C) Copyright IBM Corp. 2017
  19071. **
  19072. ** The source code for this program is not published or otherwise divested of its trade secrets,
  19073. ** irrespective of what has been deposited with the U.S. Copyright Office.
  19074. ************************************************************************/
  19075. // GENERATED
  19076. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  19077. //@import com/ibm/rave/core/time/TimeInterval (loadtime) // superclass
  19078. //@import com/ibm/rave/core/time/DateUTC (runtime) // new
  19079. /**
  19080. * 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.
  19081. */
  19082. var com_ibm_rave_core_time_Day = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_time_TimeInterval, {
  19083. /** @expose */
  19084. floor : function(date) {
  19085. 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);
  19086. day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
  19087. return day;
  19088. },
  19089. /** @expose */
  19090. step : function(date, offset) {
  19091. date.setDate(date.getDate() + offset);
  19092. },
  19093. /** @expose */
  19094. number : function(date) {
  19095. return date.getDate() - 1;
  19096. }
  19097. //constructor : function() {}
  19098. });
  19099. /**
  19100. * Single instance of Day object.
  19101. */
  19102. /** @expose */
  19103. com_ibm_rave_core_time_Day.INSTANCE = new com_ibm_rave_core_time_Day();
  19104. // $source: com/ibm/rave/core/time/DateUTC
  19105. /************************************************************************
  19106. ** IBM Confidential
  19107. **
  19108. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  19109. **
  19110. ** (C) Copyright IBM Corp. 2017
  19111. **
  19112. ** The source code for this program is not published or otherwise divested of its trade secrets,
  19113. ** irrespective of what has been deposited with the U.S. Copyright Office.
  19114. ************************************************************************/
  19115. // GENERATED
  19116. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  19117. /**
  19118. * A Date class that always returns UTC values. Delegates all non-utc (local) methods to their UTC equivalent.
  19119. */
  19120. var com_ibm_rave_core_time_DateUTC = rave_externs["DateUTC"] = com_ibm_rave_core_nativeImpl_Declare({
  19121. //date : null,
  19122. /**
  19123. * A new UTC date
  19124. * @param (long) time integer value representing the number of milliseconds since 1 January 1970 00:00:00 UTC
  19125. */
  19126. /** @expose */
  19127. constructor : function(time) {
  19128. this.date = new Date(time);
  19129. },
  19130. /**
  19131. * Gets the day of the month in local time from 1-31
  19132. * @return (int) the day of the month
  19133. */
  19134. /** @expose */
  19135. getDate : function() {
  19136. return this.getUTCDate();
  19137. },
  19138. /**
  19139. * Gets the day of the week in local time from 0-6
  19140. * @return (int) day of the week
  19141. */
  19142. /** @expose */
  19143. getDay : function() {
  19144. return this.getUTCDay();
  19145. },
  19146. /**
  19147. * Gets the full year in numeric form (ie 1999, 2100)
  19148. * @return (int) the full year
  19149. */
  19150. /** @expose */
  19151. getFullYear : function() {
  19152. return this.getUTCFullYear();
  19153. },
  19154. /**
  19155. * Gets the hour between 0-23 in local time
  19156. * @return (int) the hour
  19157. */
  19158. /** @expose */
  19159. getHours : function() {
  19160. return this.getUTCHours();
  19161. },
  19162. /**
  19163. * Gets the milliseconds in the current minute of a date between 0-999 in local time
  19164. * @return (int) the milliseconds
  19165. */
  19166. /** @expose */
  19167. getMilliseconds : function() {
  19168. return this.getUTCMilliseconds();
  19169. },
  19170. /**
  19171. * Gets the minutes in the current hour of a date between 0-59 in local time
  19172. * @return (int) the minutes
  19173. */
  19174. /** @expose */
  19175. getMinutes : function() {
  19176. return this.getUTCMinutes();
  19177. },
  19178. /**
  19179. * Gets the current month from 0-11 in local time
  19180. * @return (int) the current month
  19181. */
  19182. /** @expose */
  19183. getMonth : function() {
  19184. return this.getUTCMonth();
  19185. },
  19186. /**
  19187. * Gets the number of seconds in the current minute from 0-59 in local time
  19188. * @return (int) the number of seconds
  19189. */
  19190. /** @expose */
  19191. getSeconds : function() {
  19192. return this.getUTCSeconds();
  19193. },
  19194. /**
  19195. * Gets the difference in minutes for the current locale. The offset is positive for negative time zones. For instance, -5 UTC returns 300.
  19196. * @return (int) the difference in minutes for the current locale
  19197. */
  19198. /** @expose */
  19199. getTimezoneOffset : function() {
  19200. return 0;
  19201. },
  19202. /**
  19203. * 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.
  19204. * @param (int) day the day of the month to set for the UTC Date
  19205. * @return (long) number of seconds since 1970/1/1 in UTC time
  19206. */
  19207. /** @expose */
  19208. setDate : function(day) {
  19209. return this.setUTCDate(day);
  19210. },
  19211. /**
  19212. * Set the full year of the current date
  19213. * @param (int) year the year of the UTC Date to create
  19214. * @param (int) month the month of the UTC Date to create
  19215. * @param (int) day the day of the month of the UTC Date to create
  19216. * @return (long) the number of seconds since 1970/1/1 in local time
  19217. */
  19218. /** @expose */
  19219. setFullYear : function(year, month, day) {
  19220. return this.setUTCFullYear(year, month, day);
  19221. },
  19222. /**
  19223. * Set the hours of the current date from 0-23
  19224. * @param (int) hour the hour of the UTC Date
  19225. * @param (int) minutes the minutes of the UTC Date
  19226. * @param (int) seconds the seconds of the UTC Date
  19227. * @param (int) milliseconds the milliseconds of the UTC Date
  19228. * @return (long) the number of seconds since 1970/1/1 in local time
  19229. */
  19230. /** @expose */
  19231. setHours : function(hour, minutes, seconds, milliseconds) {
  19232. return this.setUTCHours(hour, minutes, seconds, milliseconds);
  19233. },
  19234. /**
  19235. * Set the milliseconds of the current date from 0-999
  19236. * @param (int) millis the number of milliseconds of the current date from 0-999
  19237. * @return (long) the number of seconds since 1970/1/1 in local time
  19238. */
  19239. /** @expose */
  19240. setMilliseconds : function(millis) {
  19241. return this.setUTCMilliseconds(millis);
  19242. },
  19243. /** @expose */
  19244. setMinutes : function(minutes) {
  19245. return this.setUTCMinutes(minutes);
  19246. },
  19247. /** @expose */
  19248. setSeconds : function(seconds) {
  19249. return this.setUTCSeconds(seconds);
  19250. },
  19251. /** @expose */
  19252. getTime : function() {
  19253. return this.date.getTime();
  19254. },
  19255. /** @expose */
  19256. getUTCDate : function() {
  19257. return this.date.getUTCDate();
  19258. },
  19259. /** @expose */
  19260. getUTCDay : function() {
  19261. return this.date.getUTCDay();
  19262. },
  19263. /** @expose */
  19264. getUTCFullYear : function() {
  19265. return this.date.getUTCFullYear();
  19266. },
  19267. /** @expose */
  19268. getUTCHours : function() {
  19269. return this.date.getUTCHours();
  19270. },
  19271. /** @expose */
  19272. getUTCMilliseconds : function() {
  19273. return this.date.getUTCMilliseconds();
  19274. },
  19275. /** @expose */
  19276. getUTCMinutes : function() {
  19277. return this.date.getUTCMinutes();
  19278. },
  19279. /** @expose */
  19280. getUTCMonth : function() {
  19281. return this.date.getUTCMonth();
  19282. },
  19283. /** @expose */
  19284. getUTCSeconds : function() {
  19285. return this.date.getUTCSeconds();
  19286. },
  19287. /** @expose */
  19288. setMonth : function(month, day) {
  19289. return this.setUTCMonth(month, day);
  19290. },
  19291. /** @expose */
  19292. setTime : function(time) {
  19293. return this.date.setTime(time);
  19294. },
  19295. /** @expose */
  19296. setUTCDate : function(month) {
  19297. return this.date.setUTCDate(month);
  19298. },
  19299. /** @expose */
  19300. setUTCFullYear : function(year, month, day) {
  19301. return this.date.setUTCFullYear(year, month, day);
  19302. },
  19303. /** @expose */
  19304. setUTCHours : function(hour, minutes, seconds, milliseconds) {
  19305. return this.date.setUTCHours(hour, minutes, seconds, milliseconds);
  19306. },
  19307. /** @expose */
  19308. setUTCMilliseconds : function(millis) {
  19309. return this.date.setUTCMilliseconds(millis);
  19310. },
  19311. /** @expose */
  19312. setUTCMinutes : function(minutes) {
  19313. return this.date.setUTCMinutes(minutes);
  19314. },
  19315. /** @expose */
  19316. setUTCMonth : function(month, day) {
  19317. return this.date.setUTCMonth(month, day);
  19318. },
  19319. /** @expose */
  19320. setUTCSeconds : function(seconds) {
  19321. return this.date.setUTCSeconds(seconds);
  19322. },
  19323. /** @expose */
  19324. getDateObject : function() {
  19325. return this.date;
  19326. },
  19327. /** @expose */
  19328. toISOString : function() {
  19329. return this.date.toISOString();
  19330. },
  19331. /** @expose */
  19332. toString : function() {
  19333. return this.date.toString();
  19334. }
  19335. });
  19336. // $source: com/ibm/rave/core/locale/TimeFormat
  19337. /************************************************************************
  19338. ** IBM Confidential
  19339. **
  19340. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  19341. **
  19342. ** (C) Copyright IBM Corp. 2017
  19343. **
  19344. ** The source code for this program is not published or otherwise divested of its trade secrets,
  19345. ** irrespective of what has been deposited with the U.S. Copyright Office.
  19346. ************************************************************************/
  19347. // GENERATED
  19348. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, declare anonymous
  19349. //@import com/ibm/rave/core/locale/TimeFormatSpecifier (loadtime) // superclass
  19350. //@import com/ibm/rave/core/time/FormatISO (runtime) // new
  19351. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (runtime) // create
  19352. //@import com/ibm/rave/core/context/RaveContextManager (runtime) // RaveContextManager
  19353. //@import com/ibm/rave/core/time/TimeFormatter (runtime)
  19354. //@import com/ibm/rave/core/time/DateUTC (static) // new
  19355. //@import com/ibm/rave/core/time/Time (runtime) // getInstance
  19356. //@import com/ibm/rave/core/nativeImpl/format/Requote (static) // requote
  19357. /**
  19358. * 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.
  19359. */
  19360. var com_ibm_rave_core_locale_TimeFormat = rave_externs["TimeFormat"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_locale_TimeFormatSpecifier, {
  19361. /**
  19362. * 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
  19363. */
  19364. /** @expose */
  19365. utc : null,
  19366. /** @expose */
  19367. iso : null,
  19368. //timeFormats : null,
  19369. //locale : null,
  19370. //time_periodLookup : null,
  19371. _$functionClassMethod : function() {
  19372. var _$self = /**
  19373. * 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 _).
  19374. */
  19375. function(template) {
  19376. var n = template.length;
  19377. var self = _$self;
  19378. return new (com_ibm_rave_core_nativeImpl_Declare({
  19379. _$functionClassMethod : function() {
  19380. var _$self = /**
  19381. * Formats the specified date, returning the corresponding string. The date must be a 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.
  19382. * @param (Object) date The Date object to be formatted.
  19383. * @return (String) String representing the formatted Date
  19384. */
  19385. function(date, index, groupIndex) {
  19386. var dateObj = date;
  19387. var string = [];
  19388. var i = -1;
  19389. var j = 0;
  19390. var c;
  19391. var p;
  19392. var f;
  19393. while (++i < n) {
  19394. if (template.charCodeAt(i) == 37) {
  19395. string.push(template.substring(j, i));
  19396. var stringC = String.fromCharCode(template.charCodeAt(++i));
  19397. p = com_ibm_rave_core_locale_TimeFormat.time_formatPads[c = stringC];
  19398. if (p != null) {
  19399. c = String.fromCharCode(template.charCodeAt(++i));
  19400. }
  19401. f = self.timeFormats[c];
  19402. if (f) {
  19403. c = f(dateObj, p == null ? (c == "e" ? " " : "0") : p);
  19404. }
  19405. string.push(c);
  19406. j = i + 1;
  19407. }
  19408. }
  19409. string.push(template.substring(j, i));
  19410. return string.join("");
  19411. };
  19412. return _$self;
  19413. },
  19414. /**
  19415. * Overrides the toString method in order to return the template value
  19416. * @return (String) : the template value
  19417. */
  19418. toString : function() {
  19419. return template;
  19420. },
  19421. /**
  19422. * 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.
  19423. * @param (String) dateString The string to parse
  19424. * @return (com.ibm.rave.core.time.IDate) A Date based on the dateString contents. If the parsing fails, null is returned.
  19425. */
  19426. parse : function(dateString) {
  19427. return com_ibm_rave_core_locale_TimeFormat.parseImpl(self, template, dateString, false);
  19428. }
  19429. }))();
  19430. };
  19431. return _$self;
  19432. },
  19433. constructor : function(locale) {
  19434. this.utc = this.createUTC();
  19435. this.iso = new com_ibm_rave_core_time_FormatISO();
  19436. this.timeFormats = this.buildTimeFormat();
  19437. this.time_periodLookup = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  19438. /**
  19439. * Constructs a new local time formatter using the given locale.
  19440. * @param (Object) locale the default is intended for U.S. English, you can change the behavior of the formatters by loading a new locale as needed
  19441. */
  19442. {
  19443. this.locale = locale;
  19444. this.setTimePeriodLookup();
  19445. }
  19446. },
  19447. getTimeParsers : function() {
  19448. var timeFormatParsersList = com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData("TIME_PARSERS_LIST_KEY");
  19449. if (!timeFormatParsersList) {
  19450. timeFormatParsersList = [];
  19451. var timeFormatParsers = new com_ibm_rave_core_locale_TimeFormat.TimeFormatParsers(this);
  19452. timeFormatParsersList.push(timeFormatParsers);
  19453. com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().putData("TIME_PARSERS_LIST_KEY", timeFormatParsersList);
  19454. return timeFormatParsers.timeParsers;
  19455. }
  19456. for (var i = 0; i < timeFormatParsersList.length; ++i) {
  19457. var timeFormatParsers = timeFormatParsersList[i];
  19458. if (timeFormatParsers.timeFormat == this) {
  19459. return timeFormatParsers.timeParsers;
  19460. }
  19461. }
  19462. var timeFormatParsers = new com_ibm_rave_core_locale_TimeFormat.TimeFormatParsers(this);
  19463. timeFormatParsersList.push(timeFormatParsers);
  19464. return timeFormatParsers.timeParsers;
  19465. },
  19466. /** @expose */
  19467. timeParse : function(d, template, str, j) {
  19468. var _j = j;
  19469. var c;
  19470. var p;
  19471. var t;
  19472. var i = 0;
  19473. var n = template.length;
  19474. var m = str.length;
  19475. var pString;
  19476. while (i < n) {
  19477. if (_j >= m) {
  19478. return -1;
  19479. }
  19480. c = template.charCodeAt(i++);
  19481. if (c == 37) {
  19482. var cc = template.charCodeAt(i++);
  19483. t = String.fromCharCode(cc);
  19484. if (com_ibm_rave_core_locale_TimeFormat.time_formatPads.hasOwnProperty(t)) {
  19485. pString = String.fromCharCode(template.charCodeAt(i++));
  19486. } else {
  19487. pString = t;
  19488. }
  19489. p = this.getTimeParsers()[pString];
  19490. _j = p(d, str, _j);
  19491. if (!((pString)) || (_j < 0)) {
  19492. return -1;
  19493. }
  19494. } else if (c != str.charCodeAt(_j++)) {
  19495. return -1;
  19496. }
  19497. }
  19498. return _j;
  19499. },
  19500. setTimePeriodLookup : function() {
  19501. if (this.locale["periods"]) {
  19502. for (var i = 0; i < this.locale["periods"].length; ++i) {
  19503. this.time_periodLookup.set(this.locale["periods"][i].toLowerCase(), i);
  19504. }
  19505. }
  19506. },
  19507. /**
  19508. * Build a UTC time format specifier. Delegates to "this" (the local, non-utc, format specifier).
  19509. * @return (com.ibm.rave.core.locale.TimeFormatSpecifier) TimeFormatSpecifier which creates UTC time formatter functions.
  19510. */
  19511. createUTC : function() {
  19512. var self = this;
  19513. return new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_locale_TimeFormatSpecifier], {
  19514. _$functionClassMethod : function() {
  19515. var _$self = function(template) {
  19516. var local = self(template);
  19517. return new (com_ibm_rave_core_nativeImpl_Declare({
  19518. _$functionClassMethod : function() {
  19519. var _$self = /**
  19520. * Constructs a new local time formatter using the given specifier. (Equivalent to locale.timeFormat for the default U.S. English locale.) {@link _$self.TimeFormat#_$self.specifier}
  19521. * @param (Object) date Date object to format.
  19522. * @return (String) Formatted string representation based on specifier and date.
  19523. */
  19524. function(date, index, groupIndex) {
  19525. return local.call(this, new com_ibm_rave_core_time_DateUTC(new Date(date).getTime()), index, groupIndex);
  19526. };
  19527. return _$self;
  19528. },
  19529. parse : function(dateString) {
  19530. return com_ibm_rave_core_locale_TimeFormat.parseImpl(self, template, dateString, true);
  19531. },
  19532. toString : function() {
  19533. return template;
  19534. }
  19535. }))();
  19536. };
  19537. return _$self;
  19538. }
  19539. }))();
  19540. },
  19541. buildTimeFormat : function() {
  19542. var map = {};
  19543. var self = this;
  19544. map["a"] = function(date, str) {
  19545. return self.locale["shortDays"][date.getDay()];
  19546. };
  19547. map["A"] = function(date, str) {
  19548. return self.locale["days"][date.getDay()];
  19549. };
  19550. map["b"] = function(date, str) {
  19551. return self.locale["shortMonths"][date.getMonth()];
  19552. };
  19553. map["B"] = function(date, str) {
  19554. return self.locale["months"][date.getMonth()];
  19555. };
  19556. map["c"] = new (com_ibm_rave_core_nativeImpl_Declare({
  19557. _$functionClassMethod : function() {
  19558. var _$self = function(date, str) {
  19559. return self(self.locale["dateTime"]).call(null, date, 0, 0);
  19560. };
  19561. return _$self;
  19562. },
  19563. toString : function() {
  19564. return self(self.locale["dateTime"]).toString();
  19565. }
  19566. }))();
  19567. map["d"] = function(date, str) {
  19568. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(date.getDate(), str, 2);
  19569. };
  19570. map["e"] = function(date, str) {
  19571. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(date.getDate(), str, 2);
  19572. };
  19573. map["H"] = function(date, str) {
  19574. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(date.getHours(), str, 2);
  19575. };
  19576. map["I"] = function(date, str) {
  19577. if (date.getHours() % 12 > 0) {
  19578. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(date.getHours() % 12, str, 2);
  19579. }
  19580. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(12, str, 2);
  19581. };
  19582. map["j"] = function(date, str) {
  19583. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(1 + com_ibm_rave_core_time_Time.getInstance().dayOfYear(date), str, 3);
  19584. };
  19585. map["L"] = function(date, str) {
  19586. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(date.getMilliseconds(), str, 3);
  19587. };
  19588. map["m"] = function(date, str) {
  19589. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(date.getMonth() + 1, str, 2);
  19590. };
  19591. map["M"] = function(date, str) {
  19592. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(date.getMinutes(), str, 2);
  19593. };
  19594. map["p"] = function(date, str) {
  19595. var isPM = 0;
  19596. if (date.getHours() >= 12) {
  19597. isPM = 1;
  19598. }
  19599. return self.locale["periods"][isPM];
  19600. };
  19601. map["S"] = function(date, str) {
  19602. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(date.getSeconds(), str, 2);
  19603. };
  19604. map["U"] = function(date, str) {
  19605. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(com_ibm_rave_core_time_Time.getInstance().sundayOfYear(date), str, 2);
  19606. };
  19607. map["w"] = function(date, str) {
  19608. return ""+(date.getDay());
  19609. };
  19610. map["W"] = function(date, str) {
  19611. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(com_ibm_rave_core_time_Time.getInstance().mondayOfYear(date), str, 2);
  19612. };
  19613. map["x"] = new (com_ibm_rave_core_nativeImpl_Declare({
  19614. _$functionClassMethod : function() {
  19615. var _$self = function(date, str) {
  19616. return self(self.locale["date"]).call(null, date, 0, 0);
  19617. };
  19618. return _$self;
  19619. },
  19620. toString : function() {
  19621. return self(self.locale["date"]).toString();
  19622. }
  19623. }))();
  19624. map["X"] = new (com_ibm_rave_core_nativeImpl_Declare({
  19625. _$functionClassMethod : function() {
  19626. var _$self = function(date, str) {
  19627. return self(self.locale["time"]).call(null, date, 0, 0);
  19628. };
  19629. return _$self;
  19630. },
  19631. toString : function() {
  19632. return self(self.locale["time"]).toString();
  19633. }
  19634. }))();
  19635. map["y"] = function(date, str) {
  19636. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(date.getFullYear() % 100, str, 2);
  19637. };
  19638. map["Y"] = function(date, str) {
  19639. return com_ibm_rave_core_locale_TimeFormat.time_formatPad(date.getFullYear() % 10000, str, 4);
  19640. };
  19641. map["Z"] = function(date, str) {
  19642. return com_ibm_rave_core_locale_TimeFormat.time_zone(date);
  19643. };
  19644. map["%"] = function(date, str) {
  19645. return "%";
  19646. };
  19647. return map;
  19648. },
  19649. /**
  19650. * Construct time parser map.
  19651. */
  19652. buildTimeParser : function() {
  19653. var self = this;
  19654. var time_numberRe = new RegExp("^\\s*\\d+", "");
  19655. var time_percentRe = new RegExp("^%", "");
  19656. var map = {};
  19657. map["a"] = function(date, str, i) {
  19658. var time_dayAbbrevLookup = com_ibm_rave_core_locale_TimeFormat.time_formatLookup(self.locale["shortDays"]);
  19659. var time_dayAbbrevRe = com_ibm_rave_core_locale_TimeFormat.time_formatRe(self.locale["shortDays"]);
  19660. time_dayAbbrevRe["lastIndex"] = 0;
  19661. var n = time_dayAbbrevRe.exec(str.substring(i));
  19662. if (n) {
  19663. date["w"] = time_dayAbbrevLookup.get(n[0].toLowerCase());
  19664. return i + n[0].length;
  19665. }
  19666. return -1;
  19667. };
  19668. map["A"] = function(date, str, i) {
  19669. var time_dayRe = com_ibm_rave_core_locale_TimeFormat.time_formatRe(self.locale["days"]);
  19670. var time_dayLookup = com_ibm_rave_core_locale_TimeFormat.time_formatLookup(self.locale["days"]);
  19671. time_dayRe["lastIndex"] = 0;
  19672. var n = time_dayRe.exec(str.substring(i));
  19673. if ((n)) {
  19674. date["w"] = time_dayLookup.get(n[0].toLowerCase());
  19675. return i + n[0].length;
  19676. }
  19677. return -1;
  19678. };
  19679. map["b"] = function(date, str, i) {
  19680. var time_monthAbbrevLookup = com_ibm_rave_core_locale_TimeFormat.time_formatLookup(self.locale["shortMonths"]);
  19681. var time_monthAbbrevRe = com_ibm_rave_core_locale_TimeFormat.time_formatRe(self.locale["shortMonths"]);
  19682. time_monthAbbrevRe["lastIndex"] = 0;
  19683. var n = time_monthAbbrevRe.exec(str.substring(i));
  19684. if (n) {
  19685. date["m"] = time_monthAbbrevLookup.get(n[0].toLowerCase());
  19686. return i + n[0].length;
  19687. }
  19688. return -1;
  19689. };
  19690. map["B"] = function(date, str, i) {
  19691. var time_monthLookup = com_ibm_rave_core_locale_TimeFormat.time_formatLookup(self.locale["months"]);
  19692. var time_monthRe = com_ibm_rave_core_locale_TimeFormat.time_formatRe(self.locale["months"]);
  19693. time_monthRe["lastIndex"] = 0;
  19694. var n = time_monthRe.exec(str.substring(i));
  19695. if (n) {
  19696. date["m"] = time_monthLookup.get(n[0].toLowerCase());
  19697. return i + n[0].length;
  19698. }
  19699. return -1;
  19700. };
  19701. map["c"] = function(date, str, i) {
  19702. return self.timeParse(date, self.timeFormats["c"].toString(), str, i);
  19703. };
  19704. map["d"] = function(date, str, i) {
  19705. time_numberRe["lastIndex"] = 0;
  19706. var n = time_numberRe.exec(str.substring(i, i + 2));
  19707. if ((n)) {
  19708. date["d"] = ~~+ (n[0]);
  19709. return i + n[0].length;
  19710. }
  19711. return -1;
  19712. };
  19713. map["e"] = function(date, str, i) {
  19714. time_numberRe["lastIndex"] = 0;
  19715. var n = time_numberRe.exec(str.substring(i, i + 2));
  19716. if ((n)) {
  19717. date["d"] = ~~+ (n[0]);
  19718. return i + n[0].length;
  19719. }
  19720. return -1;
  19721. };
  19722. map["H"] = function(date, str, i) {
  19723. time_numberRe["lastIndex"] = 0;
  19724. var n = time_numberRe.exec(str.substring(i, i + 2));
  19725. if ((n)) {
  19726. date["H"] = ~~+ (n[0]);
  19727. return i + n[0].length;
  19728. }
  19729. return -1;
  19730. };
  19731. map["I"] = function(date, str, i) {
  19732. time_numberRe["lastIndex"] = 0;
  19733. var n = time_numberRe.exec(str.substring(i, i + 2));
  19734. if ((n)) {
  19735. date["H"] = ~~+ (n[0]);
  19736. return i + n[0].length;
  19737. }
  19738. return -1;
  19739. };
  19740. map["j"] = function(date, str, i) {
  19741. time_numberRe["lastIndex"] = 0;
  19742. var n = time_numberRe.exec(str.substring(i, i + 3));
  19743. if ((n)) {
  19744. date["j"] = ~~+ (n[0]);
  19745. return i + n[0].length;
  19746. }
  19747. return -1;
  19748. };
  19749. map["L"] = function(date, str, i) {
  19750. time_numberRe["lastIndex"] = 0;
  19751. var n = time_numberRe.exec(str.substring(i, i + 3));
  19752. if ((n)) {
  19753. date["L"] = ~~+ (n[0]);
  19754. return i + n[0].length;
  19755. }
  19756. return -1;
  19757. };
  19758. map["m"] = function(date, str, i) {
  19759. time_numberRe["lastIndex"] = 0;
  19760. var n = time_numberRe.exec(str.substring(i, i + 2));
  19761. if ((n)) {
  19762. date["m"] = ~~+ (n[0]) - 1;
  19763. return i + n[0].length;
  19764. }
  19765. return -1;
  19766. };
  19767. map["M"] = function(date, str, i) {
  19768. time_numberRe["lastIndex"] = 0;
  19769. var n = time_numberRe.exec(str.substring(i, i + 2));
  19770. if ((n)) {
  19771. date["M"] = ~~+ (n[0]);
  19772. return i + n[0].length;
  19773. }
  19774. return -1;
  19775. };
  19776. map["p"] = function(date, str, i) {
  19777. var _i = i;
  19778. var n = self.time_periodLookup.get(str.substring(_i, _i += 2).toLowerCase());
  19779. if (n == null) {
  19780. return -1;
  19781. }
  19782. date["p"] = n;
  19783. return _i;
  19784. };
  19785. map["S"] = function(date, str, i) {
  19786. time_numberRe["lastIndex"] = 0;
  19787. var n = time_numberRe.exec(str.substring(i, i + 2));
  19788. if ((n)) {
  19789. date["S"] = ~~+ (n[0]);
  19790. return i + n[0].length;
  19791. }
  19792. return -1;
  19793. };
  19794. map["U"] = function(date, str, i) {
  19795. time_numberRe["lastIndex"] = 0;
  19796. var n = time_numberRe.exec(str.substring(i));
  19797. if ((n)) {
  19798. date["U"] = ~~+ (n[0]);
  19799. return i + n[0].length;
  19800. }
  19801. return -1;
  19802. };
  19803. map["w"] = function(date, str, i) {
  19804. time_numberRe["lastIndex"] = 0;
  19805. var n = time_numberRe.exec(str.substring(i, i + 1));
  19806. if ((n)) {
  19807. date["w"] = ~~+ (n[0]);
  19808. return i + n[0].length;
  19809. }
  19810. return -1;
  19811. };
  19812. map["W"] = function(date, str, i) {
  19813. time_numberRe["lastIndex"] = 0;
  19814. var n = time_numberRe.exec(str.substring(i));
  19815. if ((n)) {
  19816. date["W"] = ~~+ (n[0]);
  19817. return i + n[0].length;
  19818. }
  19819. return -1;
  19820. };
  19821. map["x"] = function(date, str, i) {
  19822. return self.timeParse(date, self.timeFormats["x"].toString(), str, i);
  19823. };
  19824. map["X"] = function(date, str, i) {
  19825. return self.timeParse(date, self.timeFormats["X"].toString(), str, i);
  19826. };
  19827. map["y"] = function(date, str, i) {
  19828. time_numberRe["lastIndex"] = 0;
  19829. var n = time_numberRe.exec(str.substring(i, i + 2));
  19830. if ((n)) {
  19831. date["y"] = com_ibm_rave_core_locale_TimeFormat.time_expandYear(~~+ (n[0]));
  19832. return i + n[0].length;
  19833. }
  19834. return -1;
  19835. };
  19836. map["Y"] = function(date, str, i) {
  19837. time_numberRe["lastIndex"] = 0;
  19838. var n = time_numberRe.exec(str.substring(i, i + 4));
  19839. if ((n)) {
  19840. date["y"] = ~~+ (n[0]);
  19841. return i + n[0].length;
  19842. }
  19843. return -1;
  19844. };
  19845. map["Z"] = function(date, str, i) {
  19846. var _str = str;
  19847. var regExpStr = new RegExp("^[+-]\\d{4}$", "");
  19848. if ((regExpStr.test(_str = _str.substring(i, i + 5)))) {
  19849. date["Z"] = -~~+ (_str);
  19850. return i + 5;
  19851. }
  19852. return -1;
  19853. };
  19854. map["%"] = function(date, str, i) {
  19855. time_percentRe["lastIndex"] = 0;
  19856. var n = time_percentRe.exec(str.substring(i, i + 1));
  19857. if ((n)) {
  19858. return i + n[0].length;
  19859. }
  19860. return -1;
  19861. };
  19862. return map;
  19863. }
  19864. });
  19865. com_ibm_rave_core_locale_TimeFormat.parseImpl = function(owner, template, dateString, isUTC) {
  19866. var d = {};
  19867. d["y"] = 1900;
  19868. d["m"] = 0;
  19869. d["d"] = 1;
  19870. d["H"] = 0;
  19871. d["M"] = 0;
  19872. d["S"] = 0;
  19873. d["L"] = 0;
  19874. d["Z"] = null;
  19875. var i = owner.timeParse(d, template, dateString, 0);
  19876. if (i != dateString.length) {
  19877. return null;
  19878. }
  19879. if (d.hasOwnProperty("p")) {
  19880. var dH = d["H"];
  19881. var dP = d["p"];
  19882. dH = dH % 12 + dP * 12;
  19883. delete d["H"];
  19884. d["H"] = dH;
  19885. }
  19886. var localZ = d["Z"] != null && !isUTC;
  19887. var date;
  19888. if ((localZ)) {
  19889. date = new com_ibm_rave_core_time_DateUTC(0);
  19890. } else {
  19891. if (isUTC) {
  19892. date = new com_ibm_rave_core_time_DateUTC(0);
  19893. } else {
  19894. date = new Date();
  19895. }
  19896. }
  19897. if (d.hasOwnProperty("j")) {
  19898. date.setFullYear(d["y"], 0, d["j"]);
  19899. } else if (d.hasOwnProperty("w") && (d.hasOwnProperty("W") || d.hasOwnProperty("U"))) {
  19900. date.setFullYear(d["y"], 0, 1);
  19901. var day;
  19902. if (d.hasOwnProperty("W")) {
  19903. day = (d["w"] + 6) % 7 + d["W"] * 7 - (date.getDay() + 5) % 7;
  19904. } else {
  19905. day = d["w"] + d["U"] * 7 - (date.getDay() + 6) % 7;
  19906. }
  19907. date.setFullYear(d["y"], 0, day);
  19908. } else {
  19909. date.setFullYear(d["y"], d["m"], d["d"]);
  19910. }
  19911. if (d["Z"] == null) {
  19912. date.setHours(d["H"] + (0 / 100 | 0), d["M"] + 0 % 100, d["S"], d["L"]);
  19913. } else {
  19914. date.setHours(d["H"] + (d["Z"] / 100 | 0), d["M"] + d["Z"] % 100, d["S"], d["L"]);
  19915. }
  19916. if ((localZ)) {
  19917. return new Date(date.getTime());
  19918. }
  19919. if (isUTC) {
  19920. return new Date(date.getTime());
  19921. }
  19922. return date;
  19923. };
  19924. com_ibm_rave_core_locale_TimeFormat.initialize_time_formatPads = function() {
  19925. var time_formatPads = {};
  19926. time_formatPads["-"] = "";
  19927. time_formatPads["_"] = " ";
  19928. time_formatPads["0"] = "0";
  19929. return time_formatPads;
  19930. };
  19931. com_ibm_rave_core_locale_TimeFormat.time_formatPad = function(value, fill, width) {
  19932. var sign = value < 0 ? "-" : "";
  19933. var string = (!(sign.length === 0) && !(sign == "") ? -value : value) + "";
  19934. var length = string.length;
  19935. return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);
  19936. };
  19937. com_ibm_rave_core_locale_TimeFormat.time_zone = function(date) {
  19938. var z = date.getTimezoneOffset();
  19939. var zs = z > 0 ? "-" : "+";
  19940. var zh = Math.abs(z) / 60 | 0;
  19941. var zm = Math.abs(z) % 60;
  19942. return zs + com_ibm_rave_core_locale_TimeFormat.time_formatPad(zh, "0", 2) + com_ibm_rave_core_locale_TimeFormat.time_formatPad(zm, "0", 2);
  19943. };
  19944. com_ibm_rave_core_locale_TimeFormat.time_expandYear = function(d) {
  19945. return d + (d > 68 ? 1900 : 2000);
  19946. };
  19947. com_ibm_rave_core_locale_TimeFormat.time_formatRe = function(names) {
  19948. return new RegExp("^(?:" + com_ibm_rave_core_locale_TimeFormat.map(names) + ")", "i");
  19949. };
  19950. com_ibm_rave_core_locale_TimeFormat.map = function(names) {
  19951. var maps = [];
  19952. if ((names)) {
  19953. for (var i = 0; i < names.length; ++i) {
  19954. maps.push(com_ibm_rave_core_nativeImpl_format_Requote.requote(names[i]));
  19955. }
  19956. }
  19957. return maps.join("|");
  19958. };
  19959. com_ibm_rave_core_locale_TimeFormat.time_formatLookup = function(names) {
  19960. var map = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  19961. if ((names)) {
  19962. var i = -1;
  19963. var n = names.length;
  19964. while (++i < n) {
  19965. map.set(names[i].toLowerCase(), i);
  19966. }
  19967. }
  19968. return map;
  19969. };
  19970. com_ibm_rave_core_locale_TimeFormat.TimeFormatParsers = com_ibm_rave_core_nativeImpl_Declare({
  19971. //timeFormat : null,
  19972. //timeParsers : null,
  19973. constructor : function(timeFormat) {
  19974. this.timeFormat = timeFormat;
  19975. this.timeParsers = timeFormat.buildTimeParser();
  19976. }
  19977. });
  19978. //com_ibm_rave_core_locale_TimeFormat.TIME_PARSERS_LIST_KEY = "TIME_PARSERS_LIST_KEY";
  19979. com_ibm_rave_core_locale_TimeFormat.time_formatPads = com_ibm_rave_core_locale_TimeFormat.initialize_time_formatPads();
  19980. // $source: com/ibm/rave/core/time/Hour
  19981. /************************************************************************
  19982. ** IBM Confidential
  19983. **
  19984. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  19985. **
  19986. ** (C) Copyright IBM Corp. 2017
  19987. **
  19988. ** The source code for this program is not published or otherwise divested of its trade secrets,
  19989. ** irrespective of what has been deposited with the U.S. Copyright Office.
  19990. ************************************************************************/
  19991. // GENERATED
  19992. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // bind, declare
  19993. //@import com/ibm/rave/core/time/TimeInterval (loadtime) // superclass
  19994. /**
  19995. * 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.
  19996. */
  19997. var com_ibm_rave_core_time_Hour = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_time_TimeInterval, {
  19998. /** @expose */
  19999. floor : com_ibm_rave_core_nativeImpl_Declare.bind(function(date) {
  20000. var timezone = date.getTimezoneOffset() / 60;
  20001. return this.createDate(date, ((Math.floor(date.getTime() / 36e5 - timezone) + timezone) * 36e5));
  20002. }),
  20003. /** @expose */
  20004. step : function(date, offset) {
  20005. date.setTime((date.getTime() + Math.floor(offset) * 36e5));
  20006. },
  20007. /** @expose */
  20008. number : function(date) {
  20009. return date.getHours();
  20010. }
  20011. //constructor : function() {}
  20012. });
  20013. /**
  20014. * Constructor
  20015. */
  20016. /** @expose */
  20017. com_ibm_rave_core_time_Hour.INSTANCE = new com_ibm_rave_core_time_Hour();
  20018. // $source: com/ibm/rave/core/time/Month
  20019. /************************************************************************
  20020. ** IBM Confidential
  20021. **
  20022. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  20023. **
  20024. ** (C) Copyright IBM Corp. 2017
  20025. **
  20026. ** The source code for this program is not published or otherwise divested of its trade secrets,
  20027. ** irrespective of what has been deposited with the U.S. Copyright Office.
  20028. ************************************************************************/
  20029. // GENERATED
  20030. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  20031. //@import com/ibm/rave/core/time/TimeInterval (loadtime) // superclass
  20032. //@import com/ibm/rave/core/time/Day (runtime) // Day
  20033. /**
  20034. * Month time interval.
  20035. */
  20036. var com_ibm_rave_core_time_Month = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_time_TimeInterval, {
  20037. /** @expose */
  20038. floor : function(date) {
  20039. var newdate = com_ibm_rave_core_time_Day.INSTANCE(date);
  20040. newdate.setDate(1);
  20041. return newdate;
  20042. },
  20043. /** @expose */
  20044. step : function(date, offset) {
  20045. date.setMonth(date.getMonth() + offset, date.getDate());
  20046. },
  20047. /** @expose */
  20048. number : function(date) {
  20049. return date.getMonth();
  20050. }
  20051. //constructor : function() {}
  20052. });
  20053. /** @expose */
  20054. com_ibm_rave_core_time_Month.INSTANCE = new com_ibm_rave_core_time_Month();
  20055. // $source: com/ibm/rave/core/time/Year
  20056. /************************************************************************
  20057. ** IBM Confidential
  20058. **
  20059. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  20060. **
  20061. ** (C) Copyright IBM Corp. 2017
  20062. **
  20063. ** The source code for this program is not published or otherwise divested of its trade secrets,
  20064. ** irrespective of what has been deposited with the U.S. Copyright Office.
  20065. ************************************************************************/
  20066. // GENERATED
  20067. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  20068. //@import com/ibm/rave/core/time/TimeInterval (loadtime) // superclass
  20069. //@import com/ibm/rave/core/time/Day (runtime) // Day
  20070. /**
  20071. * Year time interval.
  20072. */
  20073. var com_ibm_rave_core_time_Year = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_time_TimeInterval, {
  20074. /** @expose */
  20075. floor : function(date) {
  20076. var newdate = com_ibm_rave_core_time_Day.INSTANCE(date);
  20077. newdate.setMonth(0, 1);
  20078. return newdate;
  20079. },
  20080. /** @expose */
  20081. step : function(date, offset) {
  20082. date.setFullYear(date.getFullYear() + offset, date.getMonth(), date.getDate());
  20083. },
  20084. /** @expose */
  20085. number : function(date) {
  20086. return date.getFullYear();
  20087. }
  20088. //constructor : function() {}
  20089. });
  20090. /**
  20091. * Constructor
  20092. */
  20093. /** @expose */
  20094. com_ibm_rave_core_time_Year.INSTANCE = new com_ibm_rave_core_time_Year();
  20095. // $source: com/ibm/rave/core/time/Second
  20096. /************************************************************************
  20097. ** IBM Confidential
  20098. **
  20099. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  20100. **
  20101. ** (C) Copyright IBM Corp. 2017
  20102. **
  20103. ** The source code for this program is not published or otherwise divested of its trade secrets,
  20104. ** irrespective of what has been deposited with the U.S. Copyright Office.
  20105. ************************************************************************/
  20106. // GENERATED
  20107. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // bind, declare
  20108. //@import com/ibm/rave/core/time/TimeInterval (loadtime) // superclass
  20109. /**
  20110. * Seconds (e.g., 01:23:45.0000 AM). Always 1,000 milliseconds long.
  20111. */
  20112. var com_ibm_rave_core_time_Second = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_time_TimeInterval, {
  20113. /** @expose */
  20114. floor : com_ibm_rave_core_nativeImpl_Declare.bind(function(date) {
  20115. return this.createDate(date, (Math.floor(date.getTime() / 1e3) * 1e3));
  20116. }),
  20117. /** @expose */
  20118. step : function(date, offset) {
  20119. date.setTime((date.getTime() + Math.floor(offset) * 1e3));
  20120. },
  20121. /** @expose */
  20122. number : function(date) {
  20123. return date.getSeconds();
  20124. }
  20125. /**
  20126. * Private Constructor
  20127. */
  20128. //constructor : function() {}
  20129. });
  20130. /**
  20131. * Instance of Second()
  20132. */
  20133. /** @expose */
  20134. com_ibm_rave_core_time_Second.INSTANCE = new com_ibm_rave_core_time_Second();
  20135. // $source: com/ibm/rave/core/time/Minute
  20136. /************************************************************************
  20137. ** IBM Confidential
  20138. **
  20139. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  20140. **
  20141. ** (C) Copyright IBM Corp. 2017
  20142. **
  20143. ** The source code for this program is not published or otherwise divested of its trade secrets,
  20144. ** irrespective of what has been deposited with the U.S. Copyright Office.
  20145. ************************************************************************/
  20146. // GENERATED
  20147. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // bind, declare
  20148. //@import com/ibm/rave/core/time/TimeInterval (loadtime) // superclass
  20149. /**
  20150. * Minute time interval. Most implementations do not support leap seconds, so minutes are almost always 60 seconds (6e4 milliseconds) long.
  20151. */
  20152. var com_ibm_rave_core_time_Minute = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_time_TimeInterval, {
  20153. /** @expose */
  20154. floor : com_ibm_rave_core_nativeImpl_Declare.bind(function(date) {
  20155. return this.createDate(date, (Math.floor(date.getTime() / 6e4) * 6e4));
  20156. }),
  20157. /** @expose */
  20158. step : function(date, offset) {
  20159. date.setTime((date.getTime() + Math.floor(offset) * 6e4));
  20160. },
  20161. /** @expose */
  20162. number : function(date) {
  20163. return date.getMinutes();
  20164. }
  20165. //constructor : function() {}
  20166. });
  20167. /**
  20168. * Constructor
  20169. */
  20170. /** @expose */
  20171. com_ibm_rave_core_time_Minute.INSTANCE = new com_ibm_rave_core_time_Minute();
  20172. // $source: com/ibm/rave/core/time/Millisecond
  20173. /************************************************************************
  20174. ** IBM Confidential
  20175. **
  20176. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  20177. **
  20178. ** (C) Copyright IBM Corp. 2017
  20179. **
  20180. ** The source code for this program is not published or otherwise divested of its trade secrets,
  20181. ** irrespective of what has been deposited with the U.S. Copyright Office.
  20182. ************************************************************************/
  20183. // GENERATED
  20184. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  20185. //@import com/ibm/rave/core/time/TimeInterval (loadtime) // superclass
  20186. //@import com/ibm/rave/core/arrays/Range (runtime) // create
  20187. /**
  20188. * A millisecond interval.
  20189. */
  20190. var com_ibm_rave_core_time_Millisecond = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_time_TimeInterval, {
  20191. /** @expose */
  20192. floor : function(date) {
  20193. return date;
  20194. },
  20195. /** @expose */
  20196. step : function(date, offset) {
  20197. date.setMilliseconds(date.getMilliseconds() + offset);
  20198. },
  20199. /** @expose */
  20200. number : function(date) {
  20201. return date.getMilliseconds();
  20202. },
  20203. /** @expose */
  20204. ceil : function(date) {
  20205. return date;
  20206. },
  20207. /** @expose */
  20208. range : function(start, stop, step) {
  20209. var result = [];
  20210. for (var __i_enFor0 = 0, __exp_enFor0 = com_ibm_rave_core_arrays_Range.create(Math.ceil(start.getTime() / step) * step, + (stop), step), __len_enFor0 = __exp_enFor0.length;
  20211. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  20212. var n = __exp_enFor0[__i_enFor0];
  20213. result.push(new Date(n));
  20214. }
  20215. return result;
  20216. }
  20217. //constructor : function() {}
  20218. });
  20219. /** @expose */
  20220. com_ibm_rave_core_time_Millisecond.INSTANCE = new com_ibm_rave_core_time_Millisecond();
  20221. // $source: com/ibm/rave/core/time/Week
  20222. /************************************************************************
  20223. ** IBM Confidential
  20224. **
  20225. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  20226. **
  20227. ** (C) Copyright IBM Corp. 2017
  20228. **
  20229. ** The source code for this program is not published or otherwise divested of its trade secrets,
  20230. ** irrespective of what has been deposited with the U.S. Copyright Office.
  20231. ************************************************************************/
  20232. // GENERATED
  20233. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // bind, declare
  20234. //@import com/ibm/rave/core/time/TimeInterval (loadtime) // superclass
  20235. //@import com/ibm/rave/core/time/Day (runtime) // Day
  20236. //@import com/ibm/rave/core/time/Year (runtime) // Year
  20237. //@import com/ibm/rave/core/internal/time/TimeUtil (runtime) // dayOfYear
  20238. /**
  20239. * Week time interval. Implemented for each individual day of the week class (Monday, Tuesday..)
  20240. */
  20241. var com_ibm_rave_core_time_Week = rave_externs["Week"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_time_TimeInterval, {
  20242. dayIndex : 0,
  20243. /**
  20244. * Constructor which sets the day index
  20245. * @param (int) index the day index
  20246. */
  20247. /** @expose */
  20248. constructor : function(index) {
  20249. this.dayIndex = index;
  20250. },
  20251. /** @expose */
  20252. floor : com_ibm_rave_core_nativeImpl_Declare.bind(function(date) {
  20253. var newDate = com_ibm_rave_core_time_Day.INSTANCE(date);
  20254. newDate.setDate(newDate.getDate() - (newDate.getDay() + this.dayIndex) % 7);
  20255. return newDate;
  20256. }),
  20257. /** @expose */
  20258. step : function(date, offset) {
  20259. date.setDate(~~(date.getDate() + Math.floor(offset) * 7));
  20260. },
  20261. /** @expose */
  20262. number : com_ibm_rave_core_nativeImpl_Declare.bind(function(date) {
  20263. var day = com_ibm_rave_core_time_Year.INSTANCE(date).getDay();
  20264. return ~~(Math.floor((com_ibm_rave_core_internal_time_TimeUtil.dayOfYear(date) + (day + this.dayIndex) % 7) / 7) - +(day != this.dayIndex));
  20265. })
  20266. });
  20267. // $source: com/ibm/rave/core/internal/time/TimeUtil
  20268. /************************************************************************
  20269. ** IBM Confidential
  20270. **
  20271. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  20272. **
  20273. ** (C) Copyright IBM Corp. 2017
  20274. **
  20275. ** The source code for this program is not published or otherwise divested of its trade secrets,
  20276. ** irrespective of what has been deposited with the U.S. Copyright Office.
  20277. ************************************************************************/
  20278. // GENERATED
  20279. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  20280. //@import com/ibm/rave/core/time/Year (runtime) // Year
  20281. /**
  20282. * Contains a helper method to get the day of the year for a particular date
  20283. */
  20284. var com_ibm_rave_core_internal_time_TimeUtil = com_ibm_rave_core_nativeImpl_Declare({
  20285. });
  20286. /**
  20287. * 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.
  20288. * @param (com.ibm.rave.core.time.IDate) date the date to get the day of the year for
  20289. * @return (int) The day of the year for a given date
  20290. */
  20291. com_ibm_rave_core_internal_time_TimeUtil.dayOfYear = function(date) {
  20292. var year = com_ibm_rave_core_time_Year.INSTANCE(date);
  20293. return Math.floor((date.getTime() - year.getTime() - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5);
  20294. };
  20295. // $source: com/ibm/rave/core/globalization/BidiStringFormat
  20296. /************************************************************************
  20297. ** IBM Confidential
  20298. **
  20299. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  20300. **
  20301. ** (C) Copyright IBM Corp. 2017
  20302. **
  20303. ** The source code for this program is not published or otherwise divested of its trade secrets,
  20304. ** irrespective of what has been deposited with the U.S. Copyright Office.
  20305. ************************************************************************/
  20306. // GENERATED
  20307. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  20308. //@import com/ibm/rave/core/globalization/BidiStringFormatter (runtime) // new
  20309. //@import com/ibm/rave/core/internal/nativeImpl/globalization/BidiProcess (runtime) // determineDirection
  20310. /**
  20311. * A factory that creates a Bidi String formatter for a specific locale.
  20312. */
  20313. var com_ibm_rave_core_globalization_BidiStringFormat = rave_externs["BidiStringFormat"] = com_ibm_rave_core_nativeImpl_Declare({
  20314. //locale : null,
  20315. /** @expose */
  20316. RTL : 1,
  20317. /** @expose */
  20318. LTR : 0,
  20319. /** @expose */
  20320. UNKNOWN : -1,
  20321. _$functionClassMethod : function() {
  20322. var _$self = function(a0) {
  20323. var args = arguments;
  20324. if (args.length == 0) {
  20325. return _$self.create$0();
  20326. }
  20327. return _$self.create$1(a0);
  20328. };
  20329. return _$self;
  20330. },
  20331. /** @expose */
  20332. constructor : function(locale) {
  20333. this.locale = locale;
  20334. },
  20335. create$0 : function() {
  20336. return new com_ibm_rave_core_globalization_BidiStringFormatter();
  20337. },
  20338. create$1 : function(template) {
  20339. return this();
  20340. },
  20341. /**
  20342. * Returns integer representing direction - 0 for LTR, 1 for RTL, -1 for unknown
  20343. * @param (String) text a string to which to determine directionality
  20344. * @return (int) integer representing direction - 0 for LTR, 1 for RTL, -1 for unknown
  20345. * @see (com.ibm.rave.core.internal.globalization.BidiStringDirection) BidiStringDirection
  20346. */
  20347. /** @expose */
  20348. determineDirection : function(text) {
  20349. return com_ibm_rave_core_internal_nativeImpl_globalization_BidiProcess.determineDirection(text);
  20350. }
  20351. });
  20352. // $source: com/ibm/rave/core/globalization/BidiStringFormatter
  20353. /************************************************************************
  20354. ** IBM Confidential
  20355. **
  20356. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  20357. **
  20358. ** (C) Copyright IBM Corp. 2017
  20359. **
  20360. ** The source code for this program is not published or otherwise divested of its trade secrets,
  20361. ** irrespective of what has been deposited with the U.S. Copyright Office.
  20362. ************************************************************************/
  20363. // GENERATED
  20364. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  20365. //@import com/ibm/rave/core/internal/globalization/BidiStringDirection (runtime) // toString, parse
  20366. //@import com/ibm/rave/core/internal/globalization/NumericShaperFactory (runtime) // create
  20367. //@import com/ibm/rave/core/internal/nativeImpl/globalization/BidiProcess (runtime) // determineDirection
  20368. /**
  20369. * Internal class responsible for formatting bidi strings.
  20370. * @author jim
  20371. */
  20372. var com_ibm_rave_core_globalization_BidiStringFormatter = rave_externs["BidiStringFormatter"] = com_ibm_rave_core_nativeImpl_Declare({
  20373. //digitMappingList : null,
  20374. dir : 4,
  20375. numericShapingValue : "",
  20376. defaultNumericContext : "",
  20377. _$functionClassMethod : function() {
  20378. var _$self = /**
  20379. * Return a bidi-formatted string that has been modified with Unicode control characters based on the text direction requested. Uses 'direction' value to modify the formatting. If no 'direction' has been specified (via the direction() API or "textDirection" locale option, then no formatting is performed. If numeric shaping has been requested, this is applied before the bidi formatting.
  20380. * @param (Object) string The string to apply bidi formatting to.
  20381. * @return (String) Platform-specific bidi formatted string.
  20382. */
  20383. function(string, index, groupIndex) {
  20384. var bidiString = ""+(string);
  20385. if (_$self.numericShapingValue != null) {
  20386. var shaper = com_ibm_rave_core_internal_globalization_NumericShaperFactory.create(_$self);
  20387. bidiString = shaper.shape(bidiString);
  20388. }
  20389. var textDirection = _$self.dir;
  20390. if (textDirection == 3) {
  20391. textDirection = com_ibm_rave_core_internal_nativeImpl_globalization_BidiProcess.determineDirection(bidiString);
  20392. }
  20393. if (textDirection == 0) {
  20394. bidiString = String.fromCharCode(8234) + bidiString + String.fromCharCode(8236);
  20395. } else if (textDirection == 1) {
  20396. bidiString = String.fromCharCode(8235) + bidiString + String.fromCharCode(8236);
  20397. }
  20398. return bidiString;
  20399. };
  20400. return _$self;
  20401. },
  20402. constructor : function() {
  20403. this.digitMappingList = [];
  20404. /**
  20405. * Internal class responsible for formatting bidi strings.
  20406. */
  20407. {}
  20408. },
  20409. /**
  20410. * 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.
  20411. * @param (String) direction The base text direction of this string. Valid values are "auto", "ltr" or "rtl".
  20412. * @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.
  20413. */
  20414. direction$0 : function(direction) {
  20415. this.dir = com_ibm_rave_core_internal_globalization_BidiStringDirection.parse(direction);
  20416. return this;
  20417. },
  20418. direction$1 : function() {
  20419. return com_ibm_rave_core_internal_globalization_BidiStringDirection.toString(this.dir);
  20420. },
  20421. /**
  20422. * 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.
  20423. * @param (String) numericShapingType The type of numeric shaping to apply to this string. Valid options are "national" or "contextual"
  20424. * @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.
  20425. */
  20426. numericShaping$0 : function(numericShapingType) {
  20427. this.numericShapingValue = (numericShapingType != null) ? numericShapingType.toLowerCase() : null;
  20428. return this;
  20429. },
  20430. numericShaping$1 : function() {
  20431. return this.numericShapingValue;
  20432. },
  20433. /**
  20434. * 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".
  20435. * @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
  20436. * @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.
  20437. */
  20438. defaultContext$0 : function(defaultContext) {
  20439. this.defaultNumericContext = defaultContext;
  20440. return this;
  20441. },
  20442. defaultContext$1 : function() {
  20443. return this.defaultNumericContext;
  20444. },
  20445. /**
  20446. * 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
  20447. * @param (Array) digitTypes Either a single value, or a list of alternate digit types to use to map European digits to another language.
  20448. * @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.
  20449. */
  20450. digitMapping$0 : function(digitTypes) {
  20451. var array = digitTypes;
  20452. this.digitMappingList = (array);
  20453. return this;
  20454. },
  20455. digitMapping$1 : function(string) {
  20456. this.digitMappingList = [string];
  20457. return this;
  20458. },
  20459. digitMapping$2 : function() {
  20460. if (this.digitMappingList.length == 0 && this.defaultNumericContext != null) {
  20461. return [this.defaultNumericContext];
  20462. }
  20463. return this.digitMappingList;
  20464. },
  20465. /** @expose */
  20466. direction : function(a0) {
  20467. var args = arguments;
  20468. if (args.length == 0) {
  20469. return this.direction$1();
  20470. }
  20471. return this.direction$0(a0);
  20472. },
  20473. /** @expose */
  20474. numericShaping : function(a0) {
  20475. var args = arguments;
  20476. if (args.length == 0) {
  20477. return this.numericShaping$1();
  20478. }
  20479. return this.numericShaping$0(a0);
  20480. },
  20481. /** @expose */
  20482. defaultContext : function(a0) {
  20483. var args = arguments;
  20484. if (args.length == 0) {
  20485. return this.defaultContext$1();
  20486. }
  20487. return this.defaultContext$0(a0);
  20488. },
  20489. /** @expose */
  20490. digitMapping : function(a0) {
  20491. var args = arguments;
  20492. if (args.length == 0) {
  20493. return this.digitMapping$2();
  20494. }
  20495. if (args.length == 1 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]")) {
  20496. return this.digitMapping$0(a0);
  20497. }
  20498. return this.digitMapping$1(a0);
  20499. }
  20500. });
  20501. // $source: com/ibm/rave/core/internal/globalization/AbstractNumericShaper
  20502. /************************************************************************
  20503. ** IBM Confidential
  20504. **
  20505. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  20506. **
  20507. ** (C) Copyright IBM Corp. 2017
  20508. **
  20509. ** The source code for this program is not published or otherwise divested of its trade secrets,
  20510. ** irrespective of what has been deposited with the U.S. Copyright Office.
  20511. ************************************************************************/
  20512. // GENERATED
  20513. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  20514. var com_ibm_rave_core_internal_globalization_AbstractNumericShaper = com_ibm_rave_core_nativeImpl_Declare({
  20515. //constructor : function() {},
  20516. /**
  20517. * Return the a shaped version of a string where the numbers have been shaped based on the type of shaping.
  20518. * @param (String) string
  20519. * @return (String) The shaped version of the param string, based on the type of shaping.
  20520. */
  20521. //shape : function(string) {}
  20522. });
  20523. 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];
  20524. // $source: com/ibm/rave/core/internal/globalization/NationalNumericShaper
  20525. /************************************************************************
  20526. ** IBM Confidential
  20527. **
  20528. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  20529. **
  20530. ** (C) Copyright IBM Corp. 2017
  20531. **
  20532. ** The source code for this program is not published or otherwise divested of its trade secrets,
  20533. ** irrespective of what has been deposited with the U.S. Copyright Office.
  20534. ************************************************************************/
  20535. // GENERATED
  20536. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  20537. //@import com/ibm/rave/core/internal/globalization/AbstractNumericShaper (loadtime) // offsets, superclass
  20538. var com_ibm_rave_core_internal_globalization_NationalNumericShaper = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_globalization_AbstractNumericShaper, {
  20539. nationalDigitCode : 0,
  20540. constructor : function(nationDigitCode) {
  20541. this.nationalDigitCode = nationDigitCode;
  20542. },
  20543. shape : function(text) {
  20544. var digitCode = this.nationalDigitCode;
  20545. if (text == null) {
  20546. return null;
  20547. }
  20548. if (digitCode > com_ibm_rave_core_internal_globalization_AbstractNumericShaper.offsets.length - 1) {
  20549. return text;
  20550. }
  20551. var offset = com_ibm_rave_core_internal_globalization_AbstractNumericShaper.offsets[digitCode];
  20552. var s = "";
  20553. var minDigit = 48;
  20554. var maxDigit = 57;
  20555. for (var i = 0; i < text.length; ++i) {
  20556. var c = text.charCodeAt(i);
  20557. if (c >= minDigit && c <= maxDigit) {
  20558. s+=(String.fromCharCode((c + offset)));
  20559. } else {
  20560. s+=(String.fromCharCode(c));
  20561. }
  20562. }
  20563. return s;
  20564. }
  20565. });
  20566. // $source: com/ibm/rave/core/internal/globalization/ContextualNumericShaper
  20567. /************************************************************************
  20568. ** IBM Confidential
  20569. **
  20570. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  20571. **
  20572. ** (C) Copyright IBM Corp. 2017
  20573. **
  20574. ** The source code for this program is not published or otherwise divested of its trade secrets,
  20575. ** irrespective of what has been deposited with the U.S. Copyright Office.
  20576. ************************************************************************/
  20577. // GENERATED
  20578. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  20579. //@import com/ibm/rave/core/internal/globalization/AbstractNumericShaper (loadtime) // offsets, superclass
  20580. var com_ibm_rave_core_internal_globalization_ContextualNumericShaper = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_globalization_AbstractNumericShaper, {
  20581. //contextualDigitCodes : null,
  20582. startingContextCode : 0,
  20583. constructor : function(contextualDigitCodes, startingContextCode) {
  20584. this.contextualDigitCodes = contextualDigitCodes;
  20585. this.startingContextCode = startingContextCode;
  20586. },
  20587. shape : function(text) {
  20588. if (text == null) {
  20589. return null;
  20590. }
  20591. var contextCodes = this.contextualDigitCodes;
  20592. var contexts = 0;
  20593. for (var i = 0; i < contextCodes.length; ++i) {
  20594. contexts |= 1 << contextCodes[i];
  20595. }
  20596. var s = "";
  20597. var offset = 0;
  20598. var range = 0;
  20599. if (((1 << this.startingContextCode) & contexts) != 0) {
  20600. offset = com_ibm_rave_core_internal_globalization_AbstractNumericShaper.offsets[this.startingContextCode];
  20601. range = this.startingContextCode;
  20602. }
  20603. for (var i = 0; i < text.length; ++i) {
  20604. var c = text.charCodeAt(i);
  20605. var minDigit = 48;
  20606. var maxDigit = 57;
  20607. if (c >= minDigit && c <= maxDigit) {
  20608. s+=(String.fromCharCode((c + offset)));
  20609. } else {
  20610. s+=(String.fromCharCode(c));
  20611. var newRange = com_ibm_rave_core_internal_globalization_ContextualNumericShaper.getRange(c);
  20612. if (newRange != range) {
  20613. if (com_ibm_rave_core_internal_globalization_ContextualNumericShaper.hasContext(c)) {
  20614. if ((1 << newRange & contexts) != 0) {
  20615. range = newRange;
  20616. if (range == 1 && ((contexts & 1 << 2) != 0)) {
  20617. range = 2;
  20618. }
  20619. offset = com_ibm_rave_core_internal_globalization_AbstractNumericShaper.offsets[range];
  20620. } else if (((1 << newRange) & contexts) == 0) {
  20621. if (newRange == 2) {
  20622. if ((1 << 1 & contexts) != 0) {
  20623. range = 1;
  20624. offset = com_ibm_rave_core_internal_globalization_AbstractNumericShaper.offsets[range];
  20625. }
  20626. } else if (newRange == 1) {
  20627. if ((1 << 2 & contexts) != 0) {
  20628. range = 2;
  20629. offset = com_ibm_rave_core_internal_globalization_AbstractNumericShaper.offsets[range];
  20630. }
  20631. } else {
  20632. range = 0;
  20633. offset = 0;
  20634. }
  20635. }
  20636. }
  20637. }
  20638. }
  20639. }
  20640. return s;
  20641. }
  20642. });
  20643. /**
  20644. * Determine if the said character has a context.
  20645. * @param (int) charValue - the char value
  20646. * @return (boolean) - true if the character has context.
  20647. */
  20648. com_ibm_rave_core_internal_globalization_ContextualNumericShaper.hasContext = function(charValue) {
  20649. var searchIndex = com_ibm_rave_core_internal_globalization_ContextualNumericShaper.search(com_ibm_rave_core_internal_globalization_ContextualNumericShaper.contextualCharRanges, charValue);
  20650. return (searchIndex != -1);
  20651. };
  20652. /**
  20653. * Get the unicode range index to which the character belongs.
  20654. * @param (int) charValue - character
  20655. * @return (int) - the index of the range.
  20656. */
  20657. com_ibm_rave_core_internal_globalization_ContextualNumericShaper.getRange = function(charValue) {
  20658. var index = com_ibm_rave_core_internal_globalization_ContextualNumericShaper.search(com_ibm_rave_core_internal_globalization_ContextualNumericShaper.ranges, charValue);
  20659. if (index == -1) {
  20660. return 0;
  20661. }
  20662. if (index == 19) {
  20663. return 1;
  20664. }
  20665. return index;
  20666. };
  20667. com_ibm_rave_core_internal_globalization_ContextualNumericShaper.search = function(pRanges, charValue) {
  20668. var start = 0;
  20669. var end = pRanges.length - 1;
  20670. while (start <= end) {
  20671. var mid = Math.floor((start + end) / 2);
  20672. if (pRanges[mid].start <= charValue && pRanges[mid].end > charValue) {
  20673. return mid;
  20674. } else if (pRanges[mid].start > charValue) {
  20675. end = mid - 1;
  20676. } else if (pRanges[mid].end <= charValue) {
  20677. start = mid + 1;
  20678. }
  20679. }
  20680. return -1;
  20681. };
  20682. com_ibm_rave_core_internal_globalization_ContextualNumericShaper.CodePointRange = function(s, e) {
  20683. this.start = s;
  20684. this.end = e;
  20685. };
  20686. com_ibm_rave_core_internal_globalization_ContextualNumericShaper.EUROPEAN = 0;
  20687. com_ibm_rave_core_internal_globalization_ContextualNumericShaper.ARABIC = 1;
  20688. com_ibm_rave_core_internal_globalization_ContextualNumericShaper.EASTERN_ARABIC = 2;
  20689. com_ibm_rave_core_internal_globalization_ContextualNumericShaper.EXTENDED_ARABIC = 19;
  20690. 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)];
  20691. 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)];
  20692. // $source: com/ibm/rave/core/internal/globalization/DefaultNumericShaper
  20693. /************************************************************************
  20694. ** IBM Confidential
  20695. **
  20696. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  20697. **
  20698. ** (C) Copyright IBM Corp. 2017
  20699. **
  20700. ** The source code for this program is not published or otherwise divested of its trade secrets,
  20701. ** irrespective of what has been deposited with the U.S. Copyright Office.
  20702. ************************************************************************/
  20703. // GENERATED
  20704. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  20705. //@import com/ibm/rave/core/internal/globalization/AbstractNumericShaper (loadtime) // superclass
  20706. var com_ibm_rave_core_internal_globalization_DefaultNumericShaper = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_globalization_AbstractNumericShaper, {
  20707. shape : function(string) {
  20708. return string;
  20709. }
  20710. });
  20711. // $source: com/ibm/rave/core/internal/globalization/NumericShaperFactory
  20712. /************************************************************************
  20713. ** IBM Confidential
  20714. **
  20715. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  20716. **
  20717. ** (C) Copyright IBM Corp. 2017
  20718. **
  20719. ** The source code for this program is not published or otherwise divested of its trade secrets,
  20720. ** irrespective of what has been deposited with the U.S. Copyright Office.
  20721. ************************************************************************/
  20722. // GENERATED
  20723. //@import com/ibm/rave/core/internal/globalization/NationalNumericShaper (static) // new
  20724. //@import com/ibm/rave/core/internal/globalization/ContextualNumericShaper (static) // new
  20725. //@import com/ibm/rave/core/internal/globalization/DefaultNumericShaper (static) // new
  20726. var com_ibm_rave_core_internal_globalization_NumericShaperFactory = {
  20727. };
  20728. com_ibm_rave_core_internal_globalization_NumericShaperFactory.initialize_digitMap = function() {
  20729. var digitMap = {};
  20730. digitMap["ARABIC"] = 1;
  20731. digitMap["BENGALI"] = 4;
  20732. digitMap["DEVANAGARI"] = 3;
  20733. digitMap["EASTERN_ARABIC"] = 2;
  20734. digitMap["ETHIOPIC"] = 16;
  20735. digitMap["EUROPEAN"] = 0;
  20736. digitMap["GUJARATI"] = 6;
  20737. digitMap["GURMUKHI"] = 5;
  20738. digitMap["KANNADA"] = 10;
  20739. digitMap["KHMER"] = 17;
  20740. digitMap["LAO"] = 13;
  20741. digitMap["MALAYALAM"] = 11;
  20742. digitMap["MONGOLIAN"] = 18;
  20743. digitMap["MYANMAR"] = 15;
  20744. digitMap["ORIYA"] = 7;
  20745. digitMap["TAMIL"] = 8;
  20746. digitMap["TELUGU"] = 9;
  20747. digitMap["THAI"] = 12;
  20748. digitMap["TIBETAN"] = 14;
  20749. return digitMap;
  20750. };
  20751. /**
  20752. * Factory method to create a Shaper object that can shape numbers for a StringFormatter.
  20753. * @param (com.ibm.rave.core.globalization.BidiStringFormatter) formatter - localization formatter to construct the object.
  20754. * @return (com.ibm.rave.core.internal.globalization.AbstractNumericShaper) - the NumericalShapingInfo object.
  20755. */
  20756. com_ibm_rave_core_internal_globalization_NumericShaperFactory.create = function(formatter) {
  20757. var digits = formatter.digitMapping();
  20758. var shaping = formatter.numericShaping();
  20759. if (digits.length > 0 && shaping != null) {
  20760. shaping = shaping.toLowerCase();
  20761. if (shaping.indexOf("nation") == 0) {
  20762. return new com_ibm_rave_core_internal_globalization_NationalNumericShaper(com_ibm_rave_core_internal_globalization_NumericShaperFactory.getDigitCode(digits[0]));
  20763. } else if (shaping.indexOf("context") == 0) {
  20764. 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()));
  20765. }
  20766. }
  20767. return new com_ibm_rave_core_internal_globalization_DefaultNumericShaper();
  20768. };
  20769. /**
  20770. * Gets the integer code for the specified national digit. For an invalid nation digit string, EUROPEAN is returned.
  20771. * @param (String) nationalDigits
  20772. * @return (int) - the digit code.
  20773. */
  20774. com_ibm_rave_core_internal_globalization_NumericShaperFactory.getDigitCode = function(nationalDigits) {
  20775. var digit = com_ibm_rave_core_internal_globalization_NumericShaperFactory.digitMap[nationalDigits.toUpperCase()];
  20776. if (digit == null) {
  20777. return com_ibm_rave_core_internal_globalization_NumericShaperFactory.digitMap["EUROPEAN"];
  20778. }
  20779. return digit;
  20780. };
  20781. /**
  20782. * Returns an array of integer codes for the specified digits.
  20783. * @param (Array) list
  20784. * @return (int[]) Array of integer codes
  20785. */
  20786. com_ibm_rave_core_internal_globalization_NumericShaperFactory.getDigitCodes = function(list) {
  20787. var digits = [];
  20788. var i = 0;
  20789. for (var __i_enFor0 = 0, __exp_enFor0 = list, __len_enFor0 = __exp_enFor0.length;
  20790. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  20791. var digitStr = __exp_enFor0[__i_enFor0];
  20792. digits[i++] = com_ibm_rave_core_internal_globalization_NumericShaperFactory.getDigitCode(digitStr);
  20793. }
  20794. return digits;
  20795. };
  20796. com_ibm_rave_core_internal_globalization_NumericShaperFactory.EUROPEAN = "EUROPEAN";
  20797. com_ibm_rave_core_internal_globalization_NumericShaperFactory.NATIONAL = "nation";
  20798. com_ibm_rave_core_internal_globalization_NumericShaperFactory.CONTEXTUAL = "context";
  20799. com_ibm_rave_core_internal_globalization_NumericShaperFactory.digitMap = com_ibm_rave_core_internal_globalization_NumericShaperFactory.initialize_digitMap();
  20800. // $source: com/ibm/rave/core/scales/PowScale
  20801. /************************************************************************
  20802. ** IBM Confidential
  20803. **
  20804. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  20805. **
  20806. ** (C) Copyright IBM Corp. 2017
  20807. **
  20808. ** The source code for this program is not published or otherwise divested of its trade secrets,
  20809. ** irrespective of what has been deposited with the U.S. Copyright Office.
  20810. ************************************************************************/
  20811. // GENERATED
  20812. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  20813. //@import com/ibm/rave/core/scales/AbstractScale (loadtime) // superclass
  20814. //@import com/ibm/rave/core/scales/LinearScale (runtime) // linearTickFormat, linearNice, linearTicks
  20815. var com_ibm_rave_core_scales_PowScale = rave_externs["PowScale"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scales_AbstractScale, {
  20816. //_linear : null,
  20817. //_exponent : null,
  20818. //_domain : null,
  20819. //powp : null,
  20820. //powb : null,
  20821. _$functionClassMethod : function() {
  20822. var _$self = function(data, index, groupIndex) {
  20823. return _$self._linear.call(this, _$self.powp(+ (data)), index, groupIndex);
  20824. };
  20825. return _$self;
  20826. },
  20827. /** @expose */
  20828. constructor : function(linear, exponent, domain) {
  20829. this._linear = linear;
  20830. this._exponent = (exponent);
  20831. this._domain = domain;
  20832. this.powp = com_ibm_rave_core_scales_PowScale.pow(this._exponent);
  20833. this.powb = com_ibm_rave_core_scales_PowScale.pow(1 / this._exponent);
  20834. var self = this;
  20835. this.ticks = function(tickArguments) {
  20836. if (tickArguments !== null || arguments.length > 1){
  20837. tickArguments = Array.prototype.slice.call(arguments);
  20838. }
  20839. {
  20840. return com_ibm_rave_core_scales_LinearScale.linearTicks.apply(com_ibm_rave_core_scales_LinearScale, [self._domain].concat(tickArguments));
  20841. }
  20842. };
  20843. this.tickFormat = function(tickArguments) {
  20844. if (tickArguments !== null || arguments.length > 1){
  20845. tickArguments = Array.prototype.slice.call(arguments);
  20846. }
  20847. {
  20848. var count = tickArguments.length > 0 ? + (tickArguments[0]) : null;
  20849. var format = tickArguments.length > 1 ? tickArguments[1] : null;
  20850. return com_ibm_rave_core_scales_LinearScale.linearTickFormat(self._domain, count, ((typeof format === "string" || format instanceof String)) ? format : null);
  20851. }
  20852. };
  20853. this.invert = function(y) {
  20854. return self.powb(+ (self._linear.invert(y)));
  20855. };
  20856. },
  20857. domain$0 : function(values) {
  20858. this._domain = new Array(values.length);
  20859. for (var i = 0; i < values.length; ++i) {
  20860. this._domain[i] = + (values[i]);
  20861. }
  20862. var self = this;
  20863. this._linear.domain$0(this._domain.map(function(currentValue, index, array) {
  20864. return self.powp(+ (currentValue));
  20865. }));
  20866. return this;
  20867. },
  20868. domain$1 : function() {
  20869. return this._domain;
  20870. },
  20871. range$0 : function(values) {
  20872. this._linear.range$0(values);
  20873. return this;
  20874. },
  20875. range$1 : function() {
  20876. return this._linear.range$1();
  20877. },
  20878. /** @expose */
  20879. copy : function() {
  20880. return new com_ibm_rave_core_scales_PowScale(this._linear.copy(), this._exponent, this._domain);
  20881. },
  20882. /**
  20883. * 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.
  20884. * @param (boolean) c True or False to Enable or Disable (respectively) clamping.
  20885. * @return (com.ibm.rave.core.scales.PowScale) This scale.
  20886. */
  20887. clamp$0 : function(c) {
  20888. this._linear.clamp$0(c);
  20889. return this;
  20890. },
  20891. /**
  20892. * 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.
  20893. * @return (boolean) True if clamping is enabled, false otherwise.
  20894. */
  20895. clamp$1 : function() {
  20896. return this._linear.clamp$1();
  20897. },
  20898. /**
  20899. * 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.
  20900. * @param (Array) x Output range values.
  20901. * @return (com.ibm.rave.core.scales.PowScale) This scale.
  20902. */
  20903. /** @expose */
  20904. rangeRound : function(x) {
  20905. this._linear.rangeRound(x);
  20906. return this;
  20907. },
  20908. /**
  20909. * 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.
  20910. * @param (com.ibm.rave.core.interpolate.InterpolatorFactory) interpolate The interpolator factory to assign to this scale.
  20911. * @return (com.ibm.rave.core.scales.PowScale) This scale.
  20912. */
  20913. interpolate$0 : function(interpolate) {
  20914. this._linear.interpolate$0(interpolate);
  20915. return this;
  20916. },
  20917. /**
  20918. * 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.
  20919. * @return (Object) The interpolator assigned to this scale.
  20920. */
  20921. interpolate$1 : function() {
  20922. return this._linear.interpolate$1();
  20923. },
  20924. /**
  20925. * 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.
  20926. * @return (com.ibm.rave.core.scales.PowScale) This scale.
  20927. */
  20928. nice$0 : function() {
  20929. return this.nice$1(10);
  20930. },
  20931. /**
  20932. * 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.
  20933. * @param (Number) m Desired number of ticks.
  20934. * @return (com.ibm.rave.core.scales.PowScale) This scale.
  20935. */
  20936. nice$1 : function(m) {
  20937. return this.domain(com_ibm_rave_core_scales_LinearScale.linearNice(this._domain, m));
  20938. },
  20939. /**
  20940. * 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.
  20941. * @return (Number) Exponent power assigned to this scale.
  20942. */
  20943. exponent$0 : function() {
  20944. return this._exponent;
  20945. },
  20946. /**
  20947. * 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.
  20948. * @param (Number) x Exponent value.
  20949. * @return (com.ibm.rave.core.scales.PowScale) This scale.
  20950. */
  20951. exponent$1 : function(x) {
  20952. this._exponent = (x);
  20953. this.powp = com_ibm_rave_core_scales_PowScale.pow(this._exponent);
  20954. this.powb = com_ibm_rave_core_scales_PowScale.pow(1 / this._exponent);
  20955. var self = this;
  20956. this._linear.domain(this._domain.map(function(currentValue, index, array) {
  20957. return self.powp(+ (currentValue));
  20958. }));
  20959. return this;
  20960. },
  20961. /** @expose */
  20962. domain : function(a0) {
  20963. var args = arguments;
  20964. if (args.length == 0) {
  20965. return this.domain$1();
  20966. }
  20967. return this.domain$0(a0);
  20968. },
  20969. /** @expose */
  20970. range : function(a0) {
  20971. var args = arguments;
  20972. if (args.length == 0) {
  20973. return this.range$1();
  20974. }
  20975. return this.range$0(a0);
  20976. },
  20977. /** @expose */
  20978. clamp : function(a0) {
  20979. var args = arguments;
  20980. if (args.length == 0) {
  20981. return this.clamp$1();
  20982. }
  20983. return this.clamp$0(a0);
  20984. },
  20985. /** @expose */
  20986. interpolate : function(a0) {
  20987. var args = arguments;
  20988. if (args.length == 0) {
  20989. return this.interpolate$1();
  20990. }
  20991. return this.interpolate$0(a0);
  20992. },
  20993. /** @expose */
  20994. nice : function(a0) {
  20995. var args = arguments;
  20996. if (args.length == 0) {
  20997. return this.nice$0();
  20998. }
  20999. return this.nice$1(a0);
  21000. },
  21001. /** @expose */
  21002. exponent : function(a0) {
  21003. var args = arguments;
  21004. if (args.length == 0) {
  21005. return this.exponent$0();
  21006. }
  21007. return this.exponent$1(a0);
  21008. }
  21009. });
  21010. com_ibm_rave_core_scales_PowScale.pow = function(e) {
  21011. return function(x) {
  21012. return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);
  21013. };
  21014. };
  21015. // $source: com/ibm/rave/core/scales/ThresholdScale
  21016. /************************************************************************
  21017. ** IBM Confidential
  21018. **
  21019. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  21020. **
  21021. ** (C) Copyright IBM Corp. 2017
  21022. **
  21023. ** The source code for this program is not published or otherwise divested of its trade secrets,
  21024. ** irrespective of what has been deposited with the U.S. Copyright Office.
  21025. ************************************************************************/
  21026. // GENERATED
  21027. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  21028. //@import com/ibm/rave/core/scales/AbstractScale (loadtime) // superclass
  21029. //@import com/ibm/rave/core/Rave (runtime) // Rave
  21030. /**
  21031. * 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
  21032. */
  21033. var com_ibm_rave_core_scales_ThresholdScale = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scales_AbstractScale, {
  21034. //_domain : null,
  21035. //_range : null,
  21036. _$functionClassMethod : function() {
  21037. var _$self = function(data, index, groupIndex) {
  21038. return _$self.scale(data);
  21039. };
  21040. return _$self;
  21041. },
  21042. constructor : function(domain, range) {
  21043. this._domain = [];
  21044. this._range = [];
  21045. {
  21046. this._domain = domain;
  21047. this._range = range;
  21048. }
  21049. },
  21050. /**
  21051. * Maps a value from an input domain to an output range
  21052. * @param (Object) key the input domain value to map
  21053. * @return (Object) the corresponding value in range, or null if none found if range has fewer elements than domains element count + 1
  21054. */
  21055. /** @expose */
  21056. scale : function(key) {
  21057. var _key = key;
  21058. if (_key == null) {
  21059. _key = + (_key);
  21060. }
  21061. if (_key<=_key) {
  21062. var i = com_ibm_rave_core_Rave.bisect(this._domain, _key);
  21063. if (i >= 0 && i < this._range.length) {
  21064. return this._range[i];
  21065. }
  21066. }
  21067. return undefined;
  21068. },
  21069. domain$0 : function(values) {
  21070. this._domain = values;
  21071. return this;
  21072. },
  21073. domain$1 : function() {
  21074. return this._domain;
  21075. },
  21076. range$0 : function(values) {
  21077. this._range = values;
  21078. return this;
  21079. },
  21080. range$1 : function() {
  21081. return this._range;
  21082. },
  21083. /** @expose */
  21084. copy : function() {
  21085. return new com_ibm_rave_core_scales_ThresholdScale(this._domain, this._range);
  21086. },
  21087. /**
  21088. * 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.
  21089. * @param (Object) y the value in range to get the range extent for
  21090. * @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.
  21091. */
  21092. /** @expose */
  21093. invertExtent : function(y) {
  21094. var i = this._range.indexOf(y);
  21095. var first = undefined;
  21096. var second = undefined;
  21097. if (i > 0 && i <= this._domain.length) {
  21098. first = this._domain[i - 1];
  21099. }
  21100. if (i >= 0 && i < this._domain.length) {
  21101. second = this._domain[i];
  21102. }
  21103. return [first, second];
  21104. },
  21105. /** @expose */
  21106. domain : function(a0) {
  21107. var args = arguments;
  21108. if (args.length == 0) {
  21109. return this.domain$1();
  21110. }
  21111. return this.domain$0(a0);
  21112. },
  21113. /** @expose */
  21114. range : function(a0) {
  21115. var args = arguments;
  21116. if (args.length == 0) {
  21117. return this.range$1();
  21118. }
  21119. return this.range$0(a0);
  21120. }
  21121. });
  21122. /**
  21123. * Factory method to create a new threshold scale with default domain of [0.5] and default range of [0,1]
  21124. * @return (com.ibm.rave.core.scales.ThresholdScale) the newly created threshold scale
  21125. */
  21126. /** @expose */
  21127. com_ibm_rave_core_scales_ThresholdScale.newThresholdScale = function() {
  21128. var domain = [];
  21129. domain.push(0.5);
  21130. return new com_ibm_rave_core_scales_ThresholdScale(domain, [0, 1]);
  21131. };
  21132. // $source: com/ibm/rave/core/scales/IdentityScale
  21133. /************************************************************************
  21134. ** IBM Confidential
  21135. **
  21136. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  21137. **
  21138. ** (C) Copyright IBM Corp. 2017
  21139. **
  21140. ** The source code for this program is not published or otherwise divested of its trade secrets,
  21141. ** irrespective of what has been deposited with the U.S. Copyright Office.
  21142. ************************************************************************/
  21143. // GENERATED
  21144. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  21145. //@import com/ibm/rave/core/scales/AbstractScale (loadtime) // superclass
  21146. //@import com/ibm/rave/core/scales/LinearScale (runtime) // linearTickFormat, linearTicks
  21147. /**
  21148. * 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.
  21149. */
  21150. var com_ibm_rave_core_scales_IdentityScale = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scales_AbstractScale, {
  21151. //_domain : null,
  21152. _$functionClassMethod : function() {
  21153. var _$self = function(data, index, groupIndex) {
  21154. return _$self.scale(data);
  21155. };
  21156. return _$self;
  21157. },
  21158. constructor : function(domain) {
  21159. this._domain = domain.map(function(currentValue, index, array) {
  21160. return + (currentValue);
  21161. });
  21162. var self = this;
  21163. this.invert = function(y) {
  21164. return self.scale(y);
  21165. };
  21166. this.ticks = function(tickArguments) {
  21167. if (tickArguments !== null || arguments.length > 1){
  21168. tickArguments = Array.prototype.slice.call(arguments);
  21169. }
  21170. {
  21171. return com_ibm_rave_core_scales_LinearScale.linearTicks.apply(com_ibm_rave_core_scales_LinearScale, [self._domain].concat(tickArguments));
  21172. }
  21173. };
  21174. this.tickFormat = function(tickArguments) {
  21175. if (tickArguments !== null || arguments.length > 1){
  21176. tickArguments = Array.prototype.slice.call(arguments);
  21177. }
  21178. {
  21179. var count = tickArguments.length > 0 ? + (tickArguments[0]) : null;
  21180. var format = tickArguments.length > 1 ? tickArguments[1] : null;
  21181. return com_ibm_rave_core_scales_LinearScale.linearTickFormat(self._domain, count, ((typeof format === "string" || format instanceof String)) ? format : null);
  21182. }
  21183. };
  21184. },
  21185. /**
  21186. * Returns the given value x
  21187. * @param (Object) key the value to apply scale to it
  21188. * @return (Object) the same value passed since it is an identity scale
  21189. */
  21190. /** @expose */
  21191. scale : function(key) {
  21192. return + (key);
  21193. },
  21194. domain$0 : function(values) {
  21195. this._domain = (values).map(function(currentValue, index, array) {
  21196. return + (currentValue);
  21197. });
  21198. return this;
  21199. },
  21200. domain$1 : function() {
  21201. return this._domain;
  21202. },
  21203. range$0 : function(values) {
  21204. return this.domain(values);
  21205. },
  21206. range$1 : function() {
  21207. return this._domain;
  21208. },
  21209. /** @expose */
  21210. copy : function() {
  21211. return new com_ibm_rave_core_scales_IdentityScale(this._domain);
  21212. },
  21213. /** @expose */
  21214. domain : function(a0) {
  21215. var args = arguments;
  21216. if (args.length == 0) {
  21217. return this.domain$1();
  21218. }
  21219. return this.domain$0(a0);
  21220. },
  21221. /** @expose */
  21222. range : function(a0) {
  21223. var args = arguments;
  21224. if (args.length == 0) {
  21225. return this.range$1();
  21226. }
  21227. return this.range$0(a0);
  21228. }
  21229. });
  21230. /**
  21231. * Constructs a new identity scale with the default domain [0, 1] and the default range [0, 1].
  21232. * @return (com.ibm.rave.core.scales.IdentityScale) the newly constructed identity scale
  21233. */
  21234. /** @expose */
  21235. com_ibm_rave_core_scales_IdentityScale.newIdentityScale = function() {
  21236. return new com_ibm_rave_core_scales_IdentityScale([0, 1]);
  21237. };
  21238. // $source: com/ibm/rave/core/scales/Scales
  21239. /************************************************************************
  21240. ** IBM Confidential
  21241. **
  21242. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  21243. **
  21244. ** (C) Copyright IBM Corp. 2017
  21245. **
  21246. ** The source code for this program is not published or otherwise divested of its trade secrets,
  21247. ** irrespective of what has been deposited with the U.S. Copyright Office.
  21248. ************************************************************************/
  21249. // GENERATED
  21250. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  21251. //@import com/ibm/rave/core/scales/LinearScale (runtime) // new
  21252. //@import com/ibm/rave/core/Rave (runtime) // Rave
  21253. //@import com/ibm/rave/core/scales/OrdinalScale (runtime) // new, OrdinalScale
  21254. //@import com/ibm/rave/core/scales/QuantizeScale (runtime) // new
  21255. //@import com/ibm/rave/core/scales/QuantileScale (runtime) // new
  21256. //@import com/ibm/rave/core/scales/LogScale (runtime) // new, LogScale
  21257. //@import com/ibm/rave/core/scales/PowScale (runtime) // new
  21258. //@import com/ibm/rave/core/scales/ThresholdScale (loadtime) // newThresholdScale
  21259. //@import com/ibm/rave/core/scales/IdentityScale (loadtime) // newIdentityScale
  21260. /**
  21261. * Collection of built-in scales.
  21262. */
  21263. var com_ibm_rave_core_scales_Scales = com_ibm_rave_core_nativeImpl_Declare({
  21264. /** @expose */
  21265. linear : function() {
  21266. return new com_ibm_rave_core_scales_LinearScale(null, null, null, null);
  21267. },
  21268. /**
  21269. * Constructs a new ordinal scale with a range of ten categorical colors
  21270. * @return (com.ibm.rave.core.scales.OrdinalScale) Ordinal scale
  21271. */
  21272. /** @expose */
  21273. category10 : function() {
  21274. return com_ibm_rave_core_Rave.scale.ordinal().range(com_ibm_rave_core_scales_Scales.RAVE_CAT10);
  21275. },
  21276. /**
  21277. * Constructs a new ordinal scale with a range of twenty categorical colors
  21278. * @return (com.ibm.rave.core.scales.OrdinalScale) Ordinal scale
  21279. */
  21280. /** @expose */
  21281. category20 : function() {
  21282. return com_ibm_rave_core_Rave.scale.ordinal().range(com_ibm_rave_core_scales_Scales.RAVE_CAT20);
  21283. },
  21284. /**
  21285. * Constructs a new ordinal scale with a range of twenty categorical colors
  21286. * @return (com.ibm.rave.core.scales.OrdinalScale) Ordinal scale
  21287. */
  21288. /** @expose */
  21289. category20b : function() {
  21290. return com_ibm_rave_core_Rave.scale.ordinal().range(com_ibm_rave_core_scales_Scales.RAVE_CAT20b);
  21291. },
  21292. /**
  21293. * Constructs a new ordinal scale with a range of twenty categorical colors
  21294. * @return (com.ibm.rave.core.scales.OrdinalScale) Ordinal scale
  21295. */
  21296. /** @expose */
  21297. category20c : function() {
  21298. return com_ibm_rave_core_Rave.scale.ordinal().range(com_ibm_rave_core_scales_Scales.RAVE_CAT20c);
  21299. },
  21300. /** @expose */
  21301. ordinal : function() {
  21302. return new com_ibm_rave_core_scales_OrdinalScale([], com_ibm_rave_core_scales_OrdinalScale.DEFAULT_RANGER, 1.0, 0.0);
  21303. },
  21304. /**
  21305. * Construct a new quantize scale with a default domain and range [0,0,1.0]
  21306. * @return (com.ibm.rave.core.scales.QuantizeScale) Quantize Scale
  21307. */
  21308. /** @expose */
  21309. quantize : function() {
  21310. var scale = new com_ibm_rave_core_scales_QuantizeScale();
  21311. var tempList = [];
  21312. tempList.push(0.0);
  21313. tempList.push(1.0);
  21314. scale.range(tempList);
  21315. scale.domain(tempList);
  21316. return scale;
  21317. },
  21318. /**
  21319. * Construct a new quantile scale with empty domain and range
  21320. * @return (com.ibm.rave.core.scales.QuantileScale) Quantile Scale
  21321. */
  21322. /** @expose */
  21323. quantile : function() {
  21324. return new com_ibm_rave_core_scales_QuantileScale([], []);
  21325. },
  21326. /** @expose */
  21327. log : function() {
  21328. 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]);
  21329. },
  21330. /** @expose */
  21331. pow : function() {
  21332. return new com_ibm_rave_core_scales_PowScale(this.linear(), 1, [0.0, 1.0]);
  21333. },
  21334. /**
  21335. * @return (com.ibm.rave.core.scales.PowScale) A Pow scale with a power (exponent) of 1/2.
  21336. */
  21337. /** @expose */
  21338. sqrt : function() {
  21339. return this.pow().exponent(0.5);
  21340. },
  21341. /**
  21342. * 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.
  21343. * @return (com.ibm.rave.core.scales.ThresholdScale) the newly constructed threshold scale
  21344. */
  21345. /** @expose */
  21346. threshold : com_ibm_rave_core_scales_ThresholdScale.newThresholdScale,
  21347. /**
  21348. * Constructs a new identity scale with the default domain [0, 1] and the default range [0, 1].
  21349. * @return (com.ibm.rave.core.scales.IdentityScale) the newly constructed identity scale
  21350. */
  21351. /** @expose */
  21352. identity : com_ibm_rave_core_scales_IdentityScale.newIdentityScale
  21353. //constructor : function() {}
  21354. });
  21355. /** @expose */
  21356. com_ibm_rave_core_scales_Scales.INSTANCE = new com_ibm_rave_core_scales_Scales();
  21357. com_ibm_rave_core_scales_Scales.RAVE_CAT10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"];
  21358. 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"];
  21359. 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"];
  21360. 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"];
  21361. // $source: com/ibm/rave/core/layout/Layout
  21362. /************************************************************************
  21363. ** IBM Confidential
  21364. **
  21365. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  21366. **
  21367. ** (C) Copyright IBM Corp. 2017
  21368. **
  21369. ** The source code for this program is not published or otherwise divested of its trade secrets,
  21370. ** irrespective of what has been deposited with the U.S. Copyright Office.
  21371. ************************************************************************/
  21372. // GENERATED
  21373. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  21374. //@import com/ibm/rave/core/RegistryService (loadtime) // superclass
  21375. //@import com/ibm/rave/core/layout/force/Force (runtime) // new
  21376. //@import com/ibm/rave/core/layout/BundleLayout (runtime) // new
  21377. //@import com/ibm/rave/core/layout/PackLayout (runtime) // new
  21378. //@import com/ibm/rave/core/layout/chord/ChordLayout (runtime) // new
  21379. //@import com/ibm/rave/core/layout/cluster/Cluster (runtime) // new
  21380. //@import com/ibm/rave/core/layout/StackLayout (runtime) // new
  21381. //@import com/ibm/rave/core/layout/tree/Tree (runtime) // new
  21382. //@import com/ibm/rave/core/layout/treemap/Treemap (runtime) // new
  21383. //@import com/ibm/rave/core/layout/PieLayout (runtime) // new
  21384. //@import com/ibm/rave/core/layout/HistogramLayout (runtime) // new
  21385. //@import com/ibm/rave/core/layout/hierarchy/Hierarchy (runtime) // new
  21386. //@import com/ibm/rave/core/layout/PartitionLayout (runtime) // new
  21387. var com_ibm_rave_core_layout_Layout = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_RegistryService, {
  21388. /** @expose */
  21389. getServiceId : function() {
  21390. return "Layout";
  21391. },
  21392. /**
  21393. * creates a new instance of Force
  21394. * @return (com.ibm.rave.core.layout.force.Force) new instance of Force
  21395. */
  21396. /** @expose */
  21397. force : function() {
  21398. return new com_ibm_rave_core_layout_force_Force();
  21399. },
  21400. /**
  21401. * creates a new instance of BundleLayout
  21402. * @return (com.ibm.rave.core.layout.BundleLayout) new instance of BundleLayout
  21403. */
  21404. /** @expose */
  21405. bundle : function() {
  21406. return new com_ibm_rave_core_layout_BundleLayout();
  21407. },
  21408. /**
  21409. * 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.
  21410. * @return (com.ibm.rave.core.layout.PackLayout) new instance of Pack
  21411. */
  21412. /** @expose */
  21413. pack : function() {
  21414. return new com_ibm_rave_core_layout_PackLayout();
  21415. },
  21416. /**
  21417. * creates a new instance of Chord
  21418. * @return (com.ibm.rave.core.layout.chord.ChordLayout) new instance of Chord
  21419. */
  21420. /** @expose */
  21421. chord : function() {
  21422. return new com_ibm_rave_core_layout_chord_ChordLayout();
  21423. },
  21424. /**
  21425. * creates a new instance of Cluster
  21426. * @return (com.ibm.rave.core.layout.cluster.Cluster) new instance of Cluster
  21427. */
  21428. /** @expose */
  21429. cluster : function() {
  21430. return new com_ibm_rave_core_layout_cluster_Cluster();
  21431. },
  21432. /**
  21433. * 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.
  21434. * @return (com.ibm.rave.core.layout.StackLayout) a new stack layout instance
  21435. */
  21436. /** @expose */
  21437. stack : function() {
  21438. return new com_ibm_rave_core_layout_StackLayout();
  21439. },
  21440. /**
  21441. * creates a new instance of Tree
  21442. * @return (com.ibm.rave.core.layout.tree.Tree) new instance of Tree
  21443. */
  21444. /** @expose */
  21445. tree : function() {
  21446. return new com_ibm_rave_core_layout_tree_Tree();
  21447. },
  21448. /**
  21449. * creates a new instance of Treemap
  21450. * @return (com.ibm.rave.core.layout.treemap.Treemap) new instance of Treemap
  21451. */
  21452. /** @expose */
  21453. treemap : function() {
  21454. return new com_ibm_rave_core_layout_treemap_Treemap();
  21455. },
  21456. /**
  21457. * creates a new instance of Pie
  21458. * @return (com.ibm.rave.core.layout.PieLayout) new instance of Pie
  21459. */
  21460. /** @expose */
  21461. pie : function() {
  21462. return new com_ibm_rave_core_layout_PieLayout();
  21463. },
  21464. /**
  21465. * creates a new instance of histogram
  21466. * @return (com.ibm.rave.core.layout.HistogramLayout) new instance of histogram
  21467. */
  21468. /** @expose */
  21469. histogram : function() {
  21470. return new com_ibm_rave_core_layout_HistogramLayout();
  21471. },
  21472. /**
  21473. * creates a new instance of Hierarchy
  21474. * @return (com.ibm.rave.core.layout.hierarchy.Hierarchy) new instance of Hierarchy
  21475. */
  21476. /** @expose */
  21477. hierarchy : function() {
  21478. return new com_ibm_rave_core_layout_hierarchy_Hierarchy();
  21479. },
  21480. /**
  21481. * 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
  21482. * @return (com.ibm.rave.core.layout.PartitionLayout) new instance of PartitionLayout
  21483. */
  21484. /** @expose */
  21485. partition : function() {
  21486. return new com_ibm_rave_core_layout_PartitionLayout();
  21487. }
  21488. /**
  21489. * singleton
  21490. */
  21491. //constructor : function() {}
  21492. });
  21493. /** @expose */
  21494. com_ibm_rave_core_layout_Layout.INSTANCE = new com_ibm_rave_core_layout_Layout();
  21495. // $source: com/ibm/rave/core/layout/force/Force
  21496. /************************************************************************
  21497. ** IBM Confidential
  21498. **
  21499. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  21500. **
  21501. ** (C) Copyright IBM Corp. 2017
  21502. **
  21503. ** The source code for this program is not published or otherwise divested of its trade secrets,
  21504. ** irrespective of what has been deposited with the U.S. Copyright Office.
  21505. ************************************************************************/
  21506. // GENERATED
  21507. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, declare anonymous
  21508. //@import com/ibm/rave/core/event/Dispatcher (runtime) // create
  21509. //@import com/ibm/rave/core/geom/QuadTree (runtime) // new
  21510. //@import com/ibm/rave/core/nativeImpl/timer/Timer (runtime) // Timer
  21511. //@import com/ibm/rave/core/internal/nativeImpl/Lang (runtime) // isNumber
  21512. //@import com/ibm/rave/core/math/Random (static) // Random
  21513. //@import com/ibm/rave/core/behavior/Behavior (runtime) // Behavior
  21514. /**
  21515. * 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.
  21516. */
  21517. var com_ibm_rave_core_layout_force_Force = rave_externs["Force"] = com_ibm_rave_core_nativeImpl_Declare({
  21518. //msize : null,
  21519. //mcharge : null,
  21520. //mdrag : null,
  21521. //mnodes : null,
  21522. //mlinks : null,
  21523. //distances : null,
  21524. //strengths : null,
  21525. //charges : null,
  21526. //event : null,
  21527. //quadTree : null,
  21528. /**
  21529. * 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.
  21530. */
  21531. /** @expose */
  21532. drag : null,
  21533. //dragmove : null,
  21534. malpha : 0,
  21535. mfriction : 0.9,
  21536. mlinkDistance : 20,
  21537. mlinkStrength : 1,
  21538. mgravity : 0.1,
  21539. chargeDistance2 : Infinity,
  21540. theta2 : 0.64,
  21541. constructor : function() {
  21542. this.msize = [1, 1];
  21543. this.mcharge = -30;
  21544. this.mnodes = [];
  21545. this.mlinks = [];
  21546. this.event = com_ibm_rave_core_event_Dispatcher.create("start", "tick", "end");
  21547. 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);
  21548. {
  21549. var self = this;
  21550. this.drag = new (com_ibm_rave_core_nativeImpl_Declare({
  21551. _$functionClassMethod : function() {
  21552. var _$self = function(args) {
  21553. if (args !== null || arguments.length > 1){
  21554. args = Array.prototype.slice.call(arguments, 0);
  21555. }
  21556. {
  21557. if (!args || args.length == 0) {
  21558. return _$self.drag();
  21559. }
  21560. _$self.drag(args[0]);
  21561. return null;
  21562. }
  21563. };
  21564. return _$self;
  21565. },
  21566. drag$0 : function() {
  21567. self.createDrag();
  21568. return self.mdrag;
  21569. },
  21570. drag$1 : function(s) {
  21571. self.createDrag();
  21572. 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);
  21573. },
  21574. drag : function(a0) {
  21575. var args = arguments;
  21576. if (args.length == 0) {
  21577. return this.drag$0();
  21578. }
  21579. return this.drag$1(a0);
  21580. }
  21581. }))();
  21582. this.dragmove = function(args) {
  21583. if (args !== null || arguments.length > 1){
  21584. args = Array.prototype.slice.call(arguments, 0);
  21585. }
  21586. {
  21587. var d = args[0];
  21588. d["px"] = (rave.event).x;
  21589. d["py"] = (rave.event).y;
  21590. self.resume();
  21591. return null;
  21592. }
  21593. };
  21594. }
  21595. },
  21596. repulse : function(node) {
  21597. var self = this;
  21598. return function(quad, x1, y1, x2, y2) {
  21599. var n = node;
  21600. var fn = quad.data;
  21601. if (quad.point != n) {
  21602. var k, dx = fn.cx - n["x"], dy = fn.cy - n["y"], dw = x2 - x1, dn = dx * dx + dy * dy;
  21603. if (dw * dw / self.theta2 < dn) {
  21604. if (dn < self.chargeDistance2) {
  21605. k = fn.charge / dn;
  21606. n["px"] -= dx * k;
  21607. n["py"] -= dy * k;
  21608. }
  21609. return true;
  21610. }
  21611. if (quad.point && dn != 0 && dn < self.chargeDistance2) {
  21612. k = fn.pointCharge / dn;
  21613. n["px"] -= dx * k;
  21614. n["py"] -= dy * k;
  21615. }
  21616. }
  21617. return fn.charge == 0;
  21618. };
  21619. },
  21620. /**
  21621. * 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.
  21622. * @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.
  21623. */
  21624. /** @expose */
  21625. tick : function() {
  21626. if ((this.malpha *= .99) < .005) {
  21627. this.malpha = 0;
  21628. var eo = new com_ibm_rave_core_layout_force_Force.EventObject("end", 0);
  21629. this.event[eo.type].call(eo, eo);
  21630. return true;
  21631. }
  21632. var n = this.mnodes.length, m = this.mlinks.length;
  21633. var q;
  21634. var i;
  21635. var ol;
  21636. var on;
  21637. var s;
  21638. var t;
  21639. var l;
  21640. var k;
  21641. var x;
  21642. var y;
  21643. for (i = 0; i < m; ++i) {
  21644. ol = this.mlinks[i];
  21645. s = ol["source"];
  21646. t = ol["target"];
  21647. x = t["x"] - s["x"];
  21648. y = t["y"] - s["y"];
  21649. if ((l = (x * x + y * y)) != 0) {
  21650. l = this.malpha * this.strengths[i] * ((l = Math.sqrt(l)) - this.distances[i]) / l;
  21651. x *= l;
  21652. y *= l;
  21653. t["x"] -= x * (k = s["weight"] / (t["weight"] + s["weight"]));
  21654. t["y"] -= y * k;
  21655. s["x"] += x * (k = 1 - k);
  21656. s["y"] += y * k;
  21657. }
  21658. }
  21659. if ((k = this.malpha * this.mgravity) != 0) {
  21660. x = this.msize[0] / 2;
  21661. y = this.msize[1] / 2;
  21662. i = -1;
  21663. if (k != 0) {
  21664. while (++i < n) {
  21665. on = this.mnodes[i];
  21666. on["x"] += (x - on["x"]) * k;
  21667. on["y"] += (y - on["y"]) * k;
  21668. }
  21669. }
  21670. }
  21671. if ((this.mcharge)) {
  21672. com_ibm_rave_core_layout_force_Force.forceAccumulate(q = this.quadTree.size(null)(this.mnodes), this.malpha, this.charges);
  21673. i = -1;
  21674. while (++i < n) {
  21675. if (!((on = this.mnodes[i])["fixed"] > 0)) {
  21676. q.visit(this.repulse(on));
  21677. }
  21678. }
  21679. }
  21680. i = -1;
  21681. while (++i < n) {
  21682. on = this.mnodes[i];
  21683. if (on["fixed"] > 0) {
  21684. on["x"] = on["px"];
  21685. on["y"] = on["py"];
  21686. } else {
  21687. on["x"] -= (on["px"] - (on["px"] = on["x"])) * this.mfriction;
  21688. on["y"] -= (on["py"] - (on["py"] = on["y"])) * this.mfriction;
  21689. }
  21690. }
  21691. var eo = new com_ibm_rave_core_layout_force_Force.EventObject("tick", this.malpha);
  21692. this.event[eo.type].call(eo, eo);
  21693. return false;
  21694. },
  21695. /**
  21696. * Returns the current array of nodes associated with this layout, which defaults to the empty array.
  21697. * @return (com.ibm.rave.core.layout.force.ForceNode[]) the current array of nodes
  21698. */
  21699. nodes$0 : function() {
  21700. return this.mnodes;
  21701. },
  21702. /**
  21703. * Sets the array of nodes associated with this layout
  21704. * @param (Array) nodes the array of nodes to set
  21705. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  21706. */
  21707. nodes$1 : function(nodes) {
  21708. this.mnodes = nodes;
  21709. return this;
  21710. },
  21711. /**
  21712. * Returns the current array of links associated with this layout, which defaults to the empty array.
  21713. * @return (com.ibm.rave.core.layout.force.ForceLink[]) the current array of links
  21714. */
  21715. links$0 : function() {
  21716. return this.mlinks;
  21717. },
  21718. /**
  21719. * Sets the array of links associated with this layout
  21720. * @param (com.ibm.rave.core.layout.force.ForceLink[]) l the array of links to set
  21721. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  21722. */
  21723. links$1 : function(l) {
  21724. this.mlinks = l;
  21725. return this;
  21726. },
  21727. /**
  21728. * Returns the current size dimension object, which defaults to 1×1
  21729. * @return (Array) the current size
  21730. */
  21731. size$0 : function() {
  21732. return this.msize;
  21733. },
  21734. /**
  21735. * Sets the available layout size to the specified dimension object representing width and height
  21736. * @param (Array) s the dimension object
  21737. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  21738. */
  21739. size$1 : function(s) {
  21740. this.msize = s;
  21741. return this;
  21742. },
  21743. /**
  21744. * Returns the layout's current link distance, which defaults to 20 This method behaves in the same way as linkDistance getter method
  21745. * @return (Object) current link distance
  21746. * @see #this.linkDistance()
  21747. */
  21748. distance$0 : function() {
  21749. return this.mlinkDistance;
  21750. },
  21751. /**
  21752. * 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
  21753. * @param (Object) d the link distance value/function to set
  21754. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  21755. * @see #this.linkDistance(Object)
  21756. */
  21757. distance$1 : function(d) {
  21758. return this.linkDistance(d);
  21759. },
  21760. /**
  21761. * Returns the layout's current link distance, which defaults to 20
  21762. * @return (Object) current link distance
  21763. */
  21764. linkDistance$0 : function() {
  21765. return this.mlinkDistance;
  21766. },
  21767. /**
  21768. * 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.
  21769. * @param (Object) x the link distance value/function to set
  21770. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  21771. */
  21772. linkDistance$1 : function(x) {
  21773. this.mlinkDistance = typeof x === "function" ? x : + (x);
  21774. return this;
  21775. },
  21776. /**
  21777. * Returns the layout's current link strength (rigidity), which defaults to 1
  21778. * @return (Object) returns the layout's current link strength.
  21779. */
  21780. linkStrength$0 : function() {
  21781. return this.mlinkStrength;
  21782. },
  21783. /**
  21784. * 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.
  21785. * @param (Object) x the link strength value/function to set
  21786. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  21787. */
  21788. linkStrength$1 : function(x) {
  21789. this.mlinkStrength = typeof x === "function" ? x : + (x);
  21790. return this;
  21791. },
  21792. /**
  21793. * Returns the current friction factor that is used to approximate velocity decay. The default value is 0.9
  21794. * @return (double) the current friction factor
  21795. */
  21796. friction$0 : function() {
  21797. return this.mfriction;
  21798. },
  21799. /**
  21800. * 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
  21801. * @param (Object) f the friction coefficient value to set
  21802. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  21803. */
  21804. friction$1 : function(f) {
  21805. this.mfriction = + (f);
  21806. return this;
  21807. },
  21808. /**
  21809. * Returns the layout's current node charge value (rigidity), which defaults to -30
  21810. * @return (Object) the current charge value
  21811. */
  21812. charge$0 : function() {
  21813. return this.mcharge;
  21814. },
  21815. /**
  21816. * 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.
  21817. * @param (Object) x the node charge value/function to set
  21818. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  21819. */
  21820. charge$1 : function(x) {
  21821. this.mcharge = typeof x === "function" ? x : + (x);
  21822. return this;
  21823. },
  21824. /**
  21825. * Returns the current maximum charge distance over which charge forces are applied. The default value is infinity
  21826. * @return (double) the current maximum charge distance
  21827. */
  21828. chargeDistance$0 : function() {
  21829. return Math.sqrt(this.chargeDistance2);
  21830. },
  21831. /**
  21832. * 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.
  21833. * @param (double) x the maximum charge distance
  21834. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  21835. */
  21836. chargeDistance$1 : function(x) {
  21837. this.chargeDistance2 = x * x;
  21838. return this;
  21839. },
  21840. /**
  21841. * Returns the current gravitational strength, which defaults to 0.1
  21842. * @return (double) the current gravitational strength
  21843. */
  21844. gravity$0 : function() {
  21845. return this.mgravity;
  21846. },
  21847. /**
  21848. * 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.
  21849. * @param (Object) g the gravitational strength to set
  21850. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  21851. */
  21852. gravity$1 : function(g) {
  21853. this.mgravity = + (g);
  21854. return this;
  21855. },
  21856. /**
  21857. * Returns the value of Barnes–Hut approximation criterion, which defaults to 0.8
  21858. * @return (double) the current value of Barnes–Hut approximation criterion
  21859. */
  21860. theta$0 : function() {
  21861. return Math.sqrt(this.theta2);
  21862. },
  21863. /**
  21864. * 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.
  21865. * @param (Object) x the value of Barnes–Hut approximation criterion to set
  21866. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  21867. */
  21868. theta$1 : function(x) {
  21869. var xx = + (x);
  21870. this.theta2 = xx * xx;
  21871. return this;
  21872. },
  21873. /**
  21874. * Gets the force layout's cooling parameter value. When the layout is started, the internal alpha cooling parameter is set to 0.1
  21875. * @return (double) the current value of the layout's cooling parameter
  21876. */
  21877. alpha$0 : function() {
  21878. return this.malpha;
  21879. },
  21880. /**
  21881. * 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.
  21882. * @param (double) x the cooling parameter value to set
  21883. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  21884. */
  21885. alpha$1 : function(x) {
  21886. if (this.malpha != 0) {
  21887. if (x > 0) {
  21888. this.malpha = x;
  21889. } else {
  21890. this.malpha = 0;
  21891. }
  21892. } else if (x > 0) {
  21893. this.malpha = x;
  21894. var eo = new com_ibm_rave_core_layout_force_Force.EventObject("start", x);
  21895. this.event[eo.type].call(eo, eo);
  21896. var force = this;
  21897. com_ibm_rave_core_nativeImpl_timer_Timer.INSTANCE(function(elapsed) {
  21898. return force.tick();
  21899. });
  21900. }
  21901. return this;
  21902. },
  21903. /**
  21904. * 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.
  21905. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  21906. */
  21907. /** @expose */
  21908. start : function() {
  21909. var n = this.mnodes.length, m = this.mlinks.length;
  21910. var w = this.msize[0], h = this.msize[1];
  21911. for (var i = 0; i < n; ++i) {
  21912. var node = this.mnodes[i];
  21913. node["index"] = i;
  21914. node["weight"] = 0;
  21915. }
  21916. for (var i = 0; i < m; ++i) {
  21917. var link = this.mlinks[i];
  21918. var source = link["source"];
  21919. var target = link["target"];
  21920. if (com_ibm_rave_core_internal_nativeImpl_Lang.isNumber(source)) {
  21921. link["source"] = this.mnodes[~~ (source)];
  21922. }
  21923. if (com_ibm_rave_core_internal_nativeImpl_Lang.isNumber(target)) {
  21924. link["target"] = this.mnodes[~~ (target)];
  21925. }
  21926. ++link["source"]["weight"];
  21927. ++link["target"]["weight"];
  21928. }
  21929. for (var i = 0; i < n; ++i) {
  21930. var node = this.mnodes[i];
  21931. if (isNaN(node["x"])) {
  21932. node["x"] = this.position(true, w, i);
  21933. }
  21934. if (isNaN(node["y"])) {
  21935. node["y"] = this.position(false, h, i);
  21936. }
  21937. if (isNaN(node["px"])) {
  21938. node["px"] = node["x"];
  21939. }
  21940. if (isNaN(node["py"])) {
  21941. node["py"] = node["y"];
  21942. }
  21943. }
  21944. this.distances = [];
  21945. if (typeof this.mlinkDistance === "function") {
  21946. for (var i = 0; i < m; ++i) {
  21947. this.distances[i] = + ((this.mlinkDistance).call(this, this.mlinks[i], i, -1));
  21948. }
  21949. } else {
  21950. for (var i = 0; i < m; ++i) {
  21951. this.distances[i] = (this.mlinkDistance);
  21952. }
  21953. }
  21954. this.strengths = [];
  21955. if (typeof this.mlinkStrength === "function") {
  21956. for (var i = 0; i < m; ++i) {
  21957. this.strengths[i] = + ((this.mlinkStrength).call(this, this.mlinks[i], i, -1));
  21958. }
  21959. } else {
  21960. for (var i = 0; i < m; ++i) {
  21961. this.strengths[i] = (this.mlinkStrength);
  21962. }
  21963. }
  21964. this.charges = [];
  21965. if (typeof this.mcharge === "function") {
  21966. for (var i = 0; i < n; ++i) {
  21967. this.charges[i] = + ((this.mcharge).call(this, this.mnodes[i], i, -1));
  21968. }
  21969. } else {
  21970. for (var i = 0; i < n; ++i) {
  21971. this.charges[i] = (this.mcharge);
  21972. }
  21973. }
  21974. return this.resume();
  21975. },
  21976. position : function(xdim, size, i) {
  21977. return com_ibm_rave_core_math_Random.INSTANCE.randomizer()() * size;
  21978. },
  21979. /**
  21980. * 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.
  21981. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  21982. */
  21983. /** @expose */
  21984. resume : function() {
  21985. return this.alpha(0.1);
  21986. },
  21987. /**
  21988. * 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.
  21989. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  21990. */
  21991. /** @expose */
  21992. stop : function() {
  21993. return this.alpha(0);
  21994. },
  21995. /**
  21996. * Gets the listener for the specified event type supported by force layout: "start", "tick", and "end"
  21997. * @param (String) type the type of event to get the listener for
  21998. * @return (com.ibm.rave.core.selector.RunFunction) the listener for the specified event or null if none was registered
  21999. */
  22000. on$0 : function(type) {
  22001. return this.event.on$0(type);
  22002. },
  22003. /**
  22004. * 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
  22005. * @param (String) type the type of the force event to listen for
  22006. * @param (com.ibm.rave.core.selector.RunFunction) listener the listener
  22007. * @return (com.ibm.rave.core.layout.force.Force) this layout instance itself
  22008. */
  22009. on$1 : function(type, listener) {
  22010. this.event.on$1(type, listener);
  22011. return this;
  22012. },
  22013. createDrag : function() {
  22014. if (!this.mdrag) {
  22015. 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);
  22016. }
  22017. },
  22018. /** @expose */
  22019. nodes : function(a0) {
  22020. var args = arguments;
  22021. if (args.length == 0) {
  22022. return this.nodes$0();
  22023. }
  22024. return this.nodes$1(a0);
  22025. },
  22026. /** @expose */
  22027. links : function(a0) {
  22028. var args = arguments;
  22029. if (args.length == 0) {
  22030. return this.links$0();
  22031. }
  22032. return this.links$1(a0);
  22033. },
  22034. /** @expose */
  22035. size : function(a0) {
  22036. var args = arguments;
  22037. if (args.length == 0) {
  22038. return this.size$0();
  22039. }
  22040. return this.size$1(a0);
  22041. },
  22042. /** @expose */
  22043. distance : function(a0) {
  22044. var args = arguments;
  22045. if (args.length == 0) {
  22046. return this.distance$0();
  22047. }
  22048. return this.distance$1(a0);
  22049. },
  22050. /** @expose */
  22051. linkDistance : function(a0) {
  22052. var args = arguments;
  22053. if (args.length == 0) {
  22054. return this.linkDistance$0();
  22055. }
  22056. return this.linkDistance$1(a0);
  22057. },
  22058. /** @expose */
  22059. linkStrength : function(a0) {
  22060. var args = arguments;
  22061. if (args.length == 0) {
  22062. return this.linkStrength$0();
  22063. }
  22064. return this.linkStrength$1(a0);
  22065. },
  22066. /** @expose */
  22067. friction : function(a0) {
  22068. var args = arguments;
  22069. if (args.length == 0) {
  22070. return this.friction$0();
  22071. }
  22072. return this.friction$1(a0);
  22073. },
  22074. /** @expose */
  22075. charge : function(a0) {
  22076. var args = arguments;
  22077. if (args.length == 0) {
  22078. return this.charge$0();
  22079. }
  22080. return this.charge$1(a0);
  22081. },
  22082. /** @expose */
  22083. chargeDistance : function(a0) {
  22084. var args = arguments;
  22085. if (args.length == 0) {
  22086. return this.chargeDistance$0();
  22087. }
  22088. return this.chargeDistance$1(a0);
  22089. },
  22090. /** @expose */
  22091. gravity : function(a0) {
  22092. var args = arguments;
  22093. if (args.length == 0) {
  22094. return this.gravity$0();
  22095. }
  22096. return this.gravity$1(a0);
  22097. },
  22098. /** @expose */
  22099. theta : function(a0) {
  22100. var args = arguments;
  22101. if (args.length == 0) {
  22102. return this.theta$0();
  22103. }
  22104. return this.theta$1(a0);
  22105. },
  22106. /** @expose */
  22107. alpha : function(a0) {
  22108. var args = arguments;
  22109. if (args.length == 0) {
  22110. return this.alpha$0();
  22111. }
  22112. return this.alpha$1(a0);
  22113. },
  22114. /** @expose */
  22115. on : function(a0, a1) {
  22116. var args = arguments;
  22117. if (args.length == 1) {
  22118. return this.on$0(a0);
  22119. }
  22120. return this.on$1(a0, a1);
  22121. }
  22122. });
  22123. com_ibm_rave_core_layout_force_Force.forceAccumulate = function(quad, alpha, charges) {
  22124. var cx = 0, cy = 0;
  22125. var fn = new com_ibm_rave_core_layout_force_Force.QuadNodeData();
  22126. quad.data = fn;
  22127. fn.charge = 0;
  22128. if (!quad.leaf) {
  22129. var nodes = quad.nodes;
  22130. var n = nodes.length;
  22131. var i = -1;
  22132. var c;
  22133. while (++i < n) {
  22134. c = nodes[i];
  22135. if (c) {
  22136. com_ibm_rave_core_layout_force_Force.forceAccumulate(c, alpha, charges);
  22137. var cfn = c.data;
  22138. fn.charge += cfn.charge;
  22139. cx += cfn.charge * cfn.cx;
  22140. cy += cfn.charge * cfn.cy;
  22141. }
  22142. }
  22143. }
  22144. if (quad.point) {
  22145. var n = quad.point;
  22146. if (!quad.leaf) {
  22147. n["x"] += com_ibm_rave_core_math_Random.INSTANCE.randomizer()() - .5;
  22148. n["y"] += com_ibm_rave_core_math_Random.INSTANCE.randomizer()() - .5;
  22149. }
  22150. var k = alpha * charges[n["index"]];
  22151. fn.charge += fn.pointCharge = k;
  22152. cx += k * n["x"];
  22153. cy += k * n["y"];
  22154. }
  22155. fn.cx = cx / fn.charge;
  22156. fn.cy = cy / fn.charge;
  22157. };
  22158. /**
  22159. * The event object fired by force layout
  22160. */
  22161. com_ibm_rave_core_layout_force_Force.EventObject = rave_externs["EventObject"] = com_ibm_rave_core_nativeImpl_Declare({
  22162. /**
  22163. * The type of the event being fired, could either: "start", "tick" or "end"
  22164. */
  22165. /** @expose */
  22166. type : null,
  22167. /**
  22168. * The current value of the cooling parameter alpha
  22169. */
  22170. /** @expose */
  22171. alpha : 0,
  22172. constructor : function(type, alpha) {
  22173. this.type = type;
  22174. this.alpha = alpha;
  22175. }
  22176. });
  22177. com_ibm_rave_core_layout_force_Force.QuadNodeData = com_ibm_rave_core_nativeImpl_Declare({
  22178. cx : 0,
  22179. cy : 0,
  22180. charge : 0,
  22181. pointCharge : 0
  22182. });
  22183. com_ibm_rave_core_layout_force_Force.identity = function(data, index, groupIndex) {
  22184. var o = {};
  22185. o["x"] = (data)["x"];
  22186. o["y"] = (data)["y"];
  22187. return o;
  22188. };
  22189. com_ibm_rave_core_layout_force_Force.dragstart = function(args) {
  22190. if (args !== null || arguments.length > 1){
  22191. args = Array.prototype.slice.call(arguments, 0);
  22192. }
  22193. {
  22194. var d = args[0];
  22195. d["fixed"] |= 2;
  22196. return null;
  22197. }
  22198. };
  22199. com_ibm_rave_core_layout_force_Force.dragend = function(args) {
  22200. if (args !== null || arguments.length > 1){
  22201. args = Array.prototype.slice.call(arguments, 0);
  22202. }
  22203. {
  22204. var d = args[0];
  22205. d["fixed"] &= ~6;
  22206. return null;
  22207. }
  22208. };
  22209. com_ibm_rave_core_layout_force_Force.mouseover = function(data, index, groupIndex, event) {
  22210. var d = data;
  22211. d["fixed"] |= 4;
  22212. d["px"] = d["x"];
  22213. d["py"] = d["y"];
  22214. };
  22215. com_ibm_rave_core_layout_force_Force.mouseout = function(data, index, groupIndex, event) {
  22216. var d = data;
  22217. d["fixed"] &= ~4;
  22218. };
  22219. com_ibm_rave_core_layout_force_Force.fx = function(node, index) {
  22220. return node["x"];
  22221. };
  22222. com_ibm_rave_core_layout_force_Force.fy = function(node, index) {
  22223. return node["y"];
  22224. };
  22225. // $source: com/ibm/rave/core/behavior/Behavior
  22226. /************************************************************************
  22227. ** IBM Confidential
  22228. **
  22229. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  22230. **
  22231. ** (C) Copyright IBM Corp. 2017
  22232. **
  22233. ** The source code for this program is not published or otherwise divested of its trade secrets,
  22234. ** irrespective of what has been deposited with the U.S. Copyright Office.
  22235. ************************************************************************/
  22236. // GENERATED
  22237. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  22238. //@import com/ibm/rave/core/behavior/Drag (runtime) // new
  22239. //@import com/ibm/rave/core/behavior/Zoom (runtime) // new
  22240. //@import com/ibm/rave/core/behavior/SelectionEventHandler (runtime) // new
  22241. //@import com/ibm/rave/core/behavior/FocusEventHandler (runtime) // new
  22242. var com_ibm_rave_core_behavior_Behavior = com_ibm_rave_core_nativeImpl_Declare({
  22243. /**
  22244. * Constructs a new drag behavior.
  22245. * @return (com.ibm.rave.core.behavior.Drag) the newly constructed Drag behavior object.
  22246. */
  22247. /** @expose */
  22248. drag : function() {
  22249. return new com_ibm_rave_core_behavior_Drag();
  22250. },
  22251. /**
  22252. * Constructs a new zoom behavior.
  22253. * @return (com.ibm.rave.core.behavior.Zoom) the newly constructed Zoom behavior object.
  22254. */
  22255. /** @expose */
  22256. zoom : function() {
  22257. return new com_ibm_rave_core_behavior_Zoom();
  22258. },
  22259. /**
  22260. * Constructs a selection event tracker object which tracks and fires selection events.
  22261. * @return (com.ibm.rave.core.behavior.SelectionEventHandler) the newly constructed selection event tracker
  22262. */
  22263. /** @expose */
  22264. selectionEventHandler : function() {
  22265. return new com_ibm_rave_core_behavior_SelectionEventHandler();
  22266. },
  22267. /**
  22268. * Constructs a focus event tracker object which tracks and fires focus and blur events.
  22269. * @return (com.ibm.rave.core.behavior.FocusEventHandler) the newly constructed focus event tracker
  22270. */
  22271. /** @expose */
  22272. focusEventHandler : function() {
  22273. return new com_ibm_rave_core_behavior_FocusEventHandler();
  22274. }
  22275. //constructor : function() {}
  22276. });
  22277. /** @expose */
  22278. com_ibm_rave_core_behavior_Behavior.INSTANCE = new com_ibm_rave_core_behavior_Behavior();
  22279. // $source: com/ibm/rave/core/internal/event/CustomDispatcher
  22280. /************************************************************************
  22281. ** IBM Confidential
  22282. **
  22283. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  22284. **
  22285. ** (C) Copyright IBM Corp. 2017
  22286. **
  22287. ** The source code for this program is not published or otherwise divested of its trade secrets,
  22288. ** irrespective of what has been deposited with the U.S. Copyright Office.
  22289. ************************************************************************/
  22290. // GENERATED
  22291. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  22292. //@import com/ibm/rave/core/event/Dispatcher (loadtime) // superclass
  22293. /**
  22294. * 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).
  22295. */
  22296. var com_ibm_rave_core_internal_event_CustomDispatcher = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_event_Dispatcher, {
  22297. //target : null,
  22298. of : function(context, args) {
  22299. if (args !== null || arguments.length > 2){
  22300. args = Array.prototype.slice.call(arguments, 1);
  22301. }
  22302. {
  22303. var self = this;
  22304. return function(e1) {
  22305. var list = (args).slice();
  22306. list.push(e1);
  22307. var e0 = e1.sourceEvent = rave.event;
  22308. e1.target = self.target;
  22309. rave.event = e1;
  22310. try {
  22311. self[e1.type].apply(context, list);
  22312. } finally {
  22313. rave.event = e0;
  22314. }
  22315. };
  22316. }
  22317. }
  22318. //constructor : function() {}
  22319. });
  22320. com_ibm_rave_core_internal_event_CustomDispatcher.create$0 = function(target, types) {
  22321. if (types !== null || arguments.length > 2){
  22322. types = Array.prototype.slice.call(arguments, 1);
  22323. }
  22324. {
  22325. var dispatch = new com_ibm_rave_core_internal_event_CustomDispatcher();
  22326. dispatch.init.apply(dispatch, types);
  22327. dispatch.target = target;
  22328. return dispatch;
  22329. }
  22330. };
  22331. com_ibm_rave_core_internal_event_CustomDispatcher.create = function(a0, a1) {
  22332. var args = arguments;
  22333. return com_ibm_rave_core_internal_event_CustomDispatcher.create$0.apply(this, args);
  22334. };
  22335. // $source: com/ibm/rave/core/internal/nativeImpl/event/DragSuppress
  22336. /************************************************************************
  22337. ** IBM Confidential
  22338. **
  22339. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  22340. **
  22341. ** (C) Copyright IBM Corp. 2014, 2015
  22342. **
  22343. ** The source code for this program is not published or otherwise divested of its trade secrets,
  22344. ** irrespective of what has been deposited with the U.S. Copyright Office.
  22345. ************************************************************************/
  22346. // @import com/ibm/rave/core/nativeImpl/event/EventTracker
  22347. // @import com/ibm/rave/core/internal/nativeImpl/Vendor
  22348. var com_ibm_rave_core_internal_nativeImpl_event_DragSuppress = (function() {
  22349. var dragSelect, dragId = 0;
  22350. function preventDefault() {
  22351. rave.event.preventDefault();
  22352. };
  22353. function dragSuppress(node) {
  22354. var name = ".dragsuppress-" + ++dragId,
  22355. click = "click" + name,
  22356. w = rave.select(com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getWindow(node))
  22357. .on("touchmove" + name, preventDefault)
  22358. .on("dragstart" + name, preventDefault)
  22359. .on("selectstart" + name, preventDefault);
  22360. if (dragSelect == null) {
  22361. var docElement = rave_documentElement(node);
  22362. dragSelect = "onselectstart" in docElement ? false : vendorSymbol(docElement.style, "userSelect");
  22363. }
  22364. if (dragSelect) {
  22365. var style = rave_documentElement(node).style,
  22366. select = style[dragSelect];
  22367. style[dragSelect] = "none";
  22368. }
  22369. return function(suppressClick) {
  22370. function off() {
  22371. w.on(click, null);
  22372. }
  22373. w.on(name, null);
  22374. if (dragSelect)
  22375. style[dragSelect] = select;
  22376. if (suppressClick) { // suppress the next click, but only if it’s immediate
  22377. w.on(click, function() {
  22378. preventDefault();
  22379. off();
  22380. }, true);
  22381. setTimeout(off, 0);
  22382. }
  22383. };
  22384. }
  22385. return {
  22386. dragSuppress : dragSuppress
  22387. };
  22388. })();
  22389. // $source: com/ibm/rave/core/event/BaseEvent
  22390. /************************************************************************
  22391. ** IBM Confidential
  22392. **
  22393. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  22394. **
  22395. ** (C) Copyright IBM Corp. 2017
  22396. **
  22397. ** The source code for this program is not published or otherwise divested of its trade secrets,
  22398. ** irrespective of what has been deposited with the U.S. Copyright Office.
  22399. ************************************************************************/
  22400. // GENERATED
  22401. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  22402. /**
  22403. * A base class for all events which have a type and a target.
  22404. * @param < (java.lang.Object) T > the target type
  22405. */
  22406. var com_ibm_rave_core_event_BaseEvent = rave_externs["BaseEvent"] = com_ibm_rave_core_nativeImpl_Declare({
  22407. /**
  22408. * The name of the event (case-insensitive).
  22409. */
  22410. /** @expose */
  22411. type : null,
  22412. /**
  22413. * A reference to the event that occurred prior to this event.
  22414. */
  22415. /** @expose */
  22416. sourceEvent : null,
  22417. /**
  22418. * A reference to the target to which the event was originally dispatched.
  22419. */
  22420. /** @expose */
  22421. target : null,
  22422. /**
  22423. * Create a new event.
  22424. * @param (String) type the event type
  22425. */
  22426. /** @expose */
  22427. constructor : function(type) {
  22428. this.type = type;
  22429. }
  22430. });
  22431. // $source: com/ibm/rave/core/behavior/Drag
  22432. /************************************************************************
  22433. ** IBM Confidential
  22434. **
  22435. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  22436. **
  22437. ** (C) Copyright IBM Corp. 2017
  22438. **
  22439. ** The source code for this program is not published or otherwise divested of its trade secrets,
  22440. ** irrespective of what has been deposited with the U.S. Copyright Office.
  22441. ************************************************************************/
  22442. // GENERATED
  22443. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  22444. //@import com/ibm/rave/core/internal/event/CustomDispatcher (runtime) // create
  22445. //@import com/ibm/rave/core/internal/nativeImpl/PlatformInitialization (runtime) // getWindow
  22446. //@import com/ibm/rave/core/internal/util/Identity (runtime) // create
  22447. //@import com/ibm/rave/core/nativeImpl/event/Mouse (runtime) // mousePoint
  22448. //@import com/ibm/rave/core/event/TouchUtil (runtime) // touchFromSource
  22449. //@import com/ibm/rave/core/Rave (runtime) // select
  22450. //@import com/ibm/rave/core/internal/nativeImpl/event/DragSuppress (runtime) // dragSuppress
  22451. //@import com/ibm/rave/core/event/BaseEvent (loadtime) // superclass
  22452. var com_ibm_rave_core_behavior_Drag = rave_externs["Drag"] = com_ibm_rave_core_nativeImpl_Declare({
  22453. //event : null,
  22454. //originFunc : null,
  22455. //rave_window : null,
  22456. //identity : null,
  22457. //dragTouchId : null,
  22458. //mousedowned : null,
  22459. //touchstart : null,
  22460. _$functionClassMethod : function() {
  22461. var _$self = /**
  22462. * @see RunFunction#_$self.run(Object, )
  22463. */
  22464. function(args) {
  22465. if (args !== null || arguments.length > 1){
  22466. args = Array.prototype.slice.call(arguments, 0);
  22467. }
  22468. {
  22469. if (!args || args.length == 0) {
  22470. return _$self;
  22471. }
  22472. _$self.drag(args[0]);
  22473. return null;
  22474. }
  22475. };
  22476. return _$self;
  22477. },
  22478. constructor : function() {
  22479. this.event = com_ibm_rave_core_internal_event_CustomDispatcher.create$0(this, "drag", "dragstart", "dragend");
  22480. this.rave_window = function(data, index, groupIndex) {
  22481. return com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getWindow(data);
  22482. };
  22483. this.identity = com_ibm_rave_core_internal_util_Identity.create();
  22484. this.dragTouchId = function() {
  22485. return (rave.event).changedTouches[0].identifier;
  22486. };
  22487. this.mousedowned = this.dragStart(null, function(node, id) {
  22488. return com_ibm_rave_core_nativeImpl_event_Mouse.mousePoint(node);
  22489. }, this.rave_window, "mousemove", "mouseup");
  22490. this.touchstart = this.dragStart(this.dragTouchId, function(node, id) {
  22491. return com_ibm_rave_core_event_TouchUtil.touchFromSource(node, id);
  22492. }, this.identity, "touchmove", "touchend");
  22493. },
  22494. /**
  22495. * Creates event listeners to handle drag gestures on an element. Both mouse events and touch events are supported.
  22496. * @param (com.ibm.rave.core.selector.Selector) g
  22497. */
  22498. /** @expose */
  22499. drag : function(g) {
  22500. g.on("mousedown.drag", this.mousedowned).on("touchstart.drag", this.touchstart);
  22501. },
  22502. dragStart : function(id, position, subject, move, end) {
  22503. var self = this;
  22504. return function(data, index, groupIndex, event) {
  22505. var target = rave.event.target;
  22506. var parent = this.rave_getParentNode();
  22507. var dispatch = self.event.of(this, data, index, groupIndex);
  22508. var dragged = [0];
  22509. var dragId = id ? id() : null;
  22510. var dragName = ".drag" + (dragId == null ? "" : "-" + dragId);
  22511. var dragOffset;
  22512. var dragSubject = com_ibm_rave_core_Rave.select(subject.call(this, target, index, groupIndex));
  22513. var dragRestore = com_ibm_rave_core_internal_nativeImpl_event_DragSuppress.dragSuppress(target);
  22514. var position0 = position(parent, dragId);
  22515. if (self.originFunc) {
  22516. var value = self.originFunc.call(this, data, index, groupIndex);
  22517. dragOffset = [value["x"] - position0[0], value["y"] - position0[1]];
  22518. } else {
  22519. dragOffset = [0, 0];
  22520. }
  22521. dispatch(new com_ibm_rave_core_behavior_Drag.EventObject("dragstart", 0, 0, 0, 0));
  22522. var moved = function(data, index, groupIndex, event) {
  22523. var position1 = position(parent, dragId);
  22524. if (!position1) {
  22525. return;
  22526. }
  22527. var dx = position1[0] - position0[0];
  22528. var dy = position1[1] - position0[1];
  22529. dragged |= ~~dx | ~~dy;
  22530. position0 = position1;
  22531. dispatch(new com_ibm_rave_core_behavior_Drag.EventObject("drag", position1[0] + dragOffset[0], position1[1] + dragOffset[1], dx, dy));
  22532. };
  22533. var ended = function(data, index, groupIndex, event) {
  22534. if (!position(parent, dragId)) {
  22535. return;
  22536. }
  22537. dragSubject.on(move + dragName, null).on(end + dragName, null);
  22538. dragRestore(dragged != 0 && rave.event.target == target);
  22539. dispatch(new com_ibm_rave_core_behavior_Drag.EventObject("dragend", 0, 0, 0, 0));
  22540. };
  22541. dragSubject.on(move + dragName, moved).on(end + dragName, ended);
  22542. };
  22543. },
  22544. /**
  22545. * 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.
  22546. * @return (com.ibm.rave.core.selector.ValueFunction) the origin function
  22547. */
  22548. origin$0 : function() {
  22549. return this.originFunc;
  22550. },
  22551. /**
  22552. * 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.
  22553. * @param (com.ibm.rave.core.selector.ValueFunction) x The origin function
  22554. * @return (com.ibm.rave.core.behavior.Drag) this isntance of Drag
  22555. */
  22556. origin$1 : function(x) {
  22557. this.originFunc = x;
  22558. return this;
  22559. },
  22560. /**
  22561. * 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 });
  22562. * @param (String) type the specified event type
  22563. * @return (com.ibm.rave.core.selector.RunFunction) the currently-registered listener for the specified event type
  22564. */
  22565. on$0 : function(type) {
  22566. return this.event.on$0(type);
  22567. },
  22568. /**
  22569. * 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 });
  22570. * @param (com.ibm.rave.core.selector.RunFunction) listener the listener to recieve events
  22571. * @return (com.ibm.rave.core.behavior.Drag) this instance of Drag
  22572. */
  22573. on$1 : function(type, listener) {
  22574. this.event.on$1(type, listener);
  22575. return this;
  22576. },
  22577. /** @expose */
  22578. origin : function(a0) {
  22579. var args = arguments;
  22580. if (args.length == 0) {
  22581. return this.origin$0();
  22582. }
  22583. return this.origin$1(a0);
  22584. },
  22585. /** @expose */
  22586. on : function(a0, a1) {
  22587. var args = arguments;
  22588. if (args.length == 1) {
  22589. return this.on$0(a0);
  22590. }
  22591. return this.on$1(a0, a1);
  22592. }
  22593. });
  22594. /**
  22595. * The drag event object class.
  22596. */
  22597. com_ibm_rave_core_behavior_Drag.EventObject = rave_externs["EventObject"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_event_BaseEvent, {
  22598. /** @expose */
  22599. x : 0,
  22600. /** @expose */
  22601. y : 0,
  22602. /** @expose */
  22603. dx : 0,
  22604. /** @expose */
  22605. dy : 0,
  22606. constructor : function(type, x, y, dx, dy) {
  22607. this.x = x;
  22608. this.y = y;
  22609. this.dx = dx;
  22610. this.dy = dy;
  22611. }
  22612. });
  22613. // $source: com/ibm/rave/core/behavior/Zoom
  22614. /************************************************************************
  22615. ** IBM Confidential
  22616. **
  22617. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  22618. **
  22619. ** (C) Copyright IBM Corp. 2017
  22620. **
  22621. ** The source code for this program is not published or otherwise divested of its trade secrets,
  22622. ** irrespective of what has been deposited with the U.S. Copyright Office.
  22623. ************************************************************************/
  22624. // GENERATED
  22625. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // bind, declare
  22626. //@import com/ibm/rave/core/internal/event/CustomDispatcher (runtime) // create
  22627. //@import com/ibm/rave/core/nativeImpl/event/Mouse (runtime) // mousePoint
  22628. //@import com/ibm/rave/core/internal/nativeImpl/event/DragSuppress (runtime) // dragSuppress
  22629. //@import com/ibm/rave/core/Rave (runtime) // selectAll, select
  22630. //@import com/ibm/rave/core/internal/nativeImpl/PlatformInitialization (runtime) // getWindow
  22631. //@import com/ibm/rave/core/internal/transitions/TransitionUtil (runtime) // interrupt
  22632. //@import com/ibm/rave/core/event/Touches (runtime) // touches
  22633. //@import com/ibm/rave/core/internal/nativeImpl/transitions/InheritedTransition (runtime) // get
  22634. //@import com/ibm/rave/core/interpolate/ZoomInterpolation (runtime) // ZoomInterpolation
  22635. //@import com/ibm/rave/core/event/BaseEvent (loadtime) // superclass
  22636. /**
  22637. * 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.
  22638. */
  22639. var com_ibm_rave_core_behavior_Zoom = rave_externs["Zoom"] = com_ibm_rave_core_nativeImpl_Declare({
  22640. //_event : null,
  22641. //mousewheelTimer : null,
  22642. //sx0 : null, //sx1 : null, //sy0 : null, //sy1 : null,
  22643. //view : null,
  22644. //translate0 : null,
  22645. //center0 : null,
  22646. //_center : null,
  22647. //_size : null,
  22648. //_scaleExtent : null,
  22649. //mousedowned : null,
  22650. //touchstarted : null,
  22651. //dblclicked : null,
  22652. //mousewheeled : null,
  22653. /** @expose */
  22654. event : null,
  22655. touchtime : NaN,
  22656. _duration : 250,
  22657. zooming : 0,
  22658. _$functionClassMethod : function() {
  22659. var _$self = /**
  22660. * @see RunFunction#_$self.run(Object, Object...)
  22661. */
  22662. function(args) {
  22663. if (args !== null || arguments.length > 1){
  22664. args = Array.prototype.slice.call(arguments, 0);
  22665. }
  22666. {
  22667. _$self.zoom(args[0]);
  22668. return null;
  22669. }
  22670. };
  22671. return _$self;
  22672. },
  22673. constructor : function() {
  22674. this._event = com_ibm_rave_core_internal_event_CustomDispatcher.create$0(this, "zoomstart", "zoom", "zoomend");
  22675. this.view = new com_ibm_rave_core_behavior_Zoom.View(0, 0, 1);
  22676. this._size = [960, 500];
  22677. this._scaleExtent = com_ibm_rave_core_behavior_Zoom.zoomInfinity;
  22678. this.event = new com_ibm_rave_core_behavior_Zoom.ZoomEvent(this);
  22679. {
  22680. var self = this;
  22681. this.mousedowned = function(data, index, groupIndex, e) {
  22682. var that = this;
  22683. var location0 = self.location(com_ibm_rave_core_nativeImpl_event_Mouse.mousePoint(that));
  22684. var dragRestore = com_ibm_rave_core_internal_nativeImpl_event_DragSuppress.dragSuppress(that);
  22685. var target = rave.event.target;
  22686. var dispatch = self._event.of(that, data, index, groupIndex);
  22687. var dragged;
  22688. var subject = com_ibm_rave_core_Rave.select(com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getWindow(that));
  22689. var moved = function(data1, index1, groupIndex1, event) {
  22690. dragged = true;
  22691. self.translateTo(com_ibm_rave_core_nativeImpl_event_Mouse.mousePoint(that), location0);
  22692. self.zoomed(dispatch);
  22693. };
  22694. var ended = function(data2, index2, groupIndex2, event) {
  22695. subject.on("mousemove.zoom", null).on("mouseup.zoom", null);
  22696. dragRestore(dragged && rave.event.target == target);
  22697. self.zoomended(dispatch);
  22698. };
  22699. subject.on("mousemove.zoom", moved).on("mouseup.zoom", ended);
  22700. com_ibm_rave_core_internal_transitions_TransitionUtil.interrupt(this);
  22701. self.zoomstarted(dispatch);
  22702. };
  22703. this.touchstarted = function(data, index, groupIndex, e) {
  22704. var that = this;
  22705. var dragRestore = com_ibm_rave_core_internal_nativeImpl_event_DragSuppress.dragSuppress(that);
  22706. var dispatch = self._event.of(that, data, index, groupIndex);
  22707. var subject = com_ibm_rave_core_Rave.select(that);
  22708. var zoomName = ".zoom-" + (rave.event).changedTouches[0].identifier;
  22709. var touchmove = "touchmove" + zoomName;
  22710. var touchend = "touchend" + zoomName;
  22711. var targets = [];
  22712. var locations0 = {};
  22713. var distance0 = 0, scale0;
  22714. var relocate = function() {
  22715. var touches = com_ibm_rave_core_event_Touches.touches(that);
  22716. scale0 = self.view.k;
  22717. for (var __i_enFor0 = 0, __exp_enFor0 = touches, __len_enFor0 = __exp_enFor0.length;
  22718. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  22719. var t = __exp_enFor0[__i_enFor0];
  22720. if (locations0.hasOwnProperty(t["identifier"])) {
  22721. locations0[t["identifier"]] = self.location(t);
  22722. }
  22723. }
  22724. return touches;
  22725. };
  22726. var moved = function(data1, index1, groupIndex1, event) {
  22727. var touches = com_ibm_rave_core_event_Touches.touches(that);
  22728. com_ibm_rave_core_internal_transitions_TransitionUtil.interrupt(this);
  22729. var p0 = null, p1 = null;
  22730. var l0 = null, l1 = null;
  22731. for (var i = 0, n = touches.length; i < n; ++i, l1 = null) {
  22732. p1 = touches[i];
  22733. if ((l1 = locations0[p1["identifier"]])) {
  22734. if (l0) {
  22735. break;
  22736. }
  22737. p0 = p1;
  22738. l0 = l1;
  22739. }
  22740. }
  22741. if (l1) {
  22742. var temp;
  22743. var distance1 = (temp = p1[0] - p0[0]) * temp + (temp = p1[1] - p0[1]) * temp;
  22744. var scale1 = 0;
  22745. if (distance0 != 0) {
  22746. scale1 = Math.sqrt(distance1 / distance0);
  22747. }
  22748. p0 = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];
  22749. l0 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
  22750. self.scaleTo(scale1 * scale0);
  22751. }
  22752. self.touchtime = NaN;
  22753. self.translateTo(p0, l0);
  22754. self.zoomed(dispatch);
  22755. };
  22756. var ended = function(data1, index1, groupIndex1, event) {
  22757. var toucheEvent = rave.event;
  22758. if (toucheEvent.touches.length != 0) {
  22759. var changed = toucheEvent.changedTouches;
  22760. for (var i = 0, n = changed.length; i < n; ++i) {
  22761. delete locations0[changed[i].identifier];
  22762. }
  22763. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(locations0), __len_enFor0 = __exp_enFor0.length;
  22764. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  22765. var identifier = __exp_enFor0[__i_enFor0];
  22766. relocate();
  22767. return;
  22768. }
  22769. }
  22770. com_ibm_rave_core_Rave.selectAll(targets).on(zoomName, null);
  22771. subject.on("mousedown.zoom", self.mousedowned).on("touchstart.zoom", self.touchstarted);
  22772. dragRestore(false);
  22773. self.zoomended(dispatch);
  22774. };
  22775. var started = function(data1, index1, groupIndex1, event) {
  22776. var touchEvent = rave.event;
  22777. var target = touchEvent.target;
  22778. com_ibm_rave_core_Rave.select(target).on(touchmove, moved).on(touchend, ended);
  22779. targets.push(target);
  22780. var changed = touchEvent.changedTouches;
  22781. for (var i = 0, n = changed.length; i < n; ++i) {
  22782. locations0[changed[i].identifier] = null;
  22783. }
  22784. var touches = relocate();
  22785. var now = Date.now();
  22786. if (touches.length == 1) {
  22787. if (now - self.touchtime < 500) {
  22788. var p = touches[0];
  22789. self.zoomTo(that, p, locations0[p["identifier"]], Math.floor(Math.log(self.view.k) / Math["LN2"]) + 1);
  22790. rave.event.preventDefault();
  22791. }
  22792. self.touchtime = now;
  22793. } else if (touches.length > 1) {
  22794. var p = touches[0];
  22795. var q = touches[1];
  22796. var dx = p[0] - q[0];
  22797. var dy = p[1] - q[1];
  22798. distance0 = dx * dx + dy * dy;
  22799. }
  22800. };
  22801. subject.on("mousedown.zoom", null).on("touchstart.zoom", started);
  22802. started.call(null, null, -1, -1, null);
  22803. self.zoomstarted(dispatch);
  22804. };
  22805. this.dblclicked = function(data, index, groupIndex, e) {
  22806. var p = com_ibm_rave_core_nativeImpl_event_Mouse.mousePoint(this);
  22807. var k = Math.log(self.view.k) / Math["LN2"];
  22808. self.zoomTo(this, p, self.location(p), (rave.event).shiftKey ? Math.ceil(k) - 1 : Math.floor(k) + 1);
  22809. };
  22810. this.mousewheeled = function(data, index, groupIndex, e) {
  22811. var dispatch = self._event.of(this, data, index, groupIndex);
  22812. if (self.mousewheelTimer != null) {
  22813. clearTimeout(self.mousewheelTimer);
  22814. } else {
  22815. self.center0 = self._center ? self._center : com_ibm_rave_core_nativeImpl_event_Mouse.mousePoint(this);
  22816. self.translate0 = self.location(self.center0);
  22817. com_ibm_rave_core_internal_transitions_TransitionUtil.interrupt(this);
  22818. self.zoomstarted(dispatch);
  22819. }
  22820. self.mousewheelTimer = setTimeout(function() {
  22821. self.mousewheelTimer = null;
  22822. self.zoomended(dispatch);
  22823. }, 50);
  22824. rave.event.preventDefault();
  22825. self.scaleTo(Math.pow(2, com_ibm_rave_core_behavior_Zoom.zoomDelta() * .002) * self.view.k);
  22826. self.translateTo(self.center0, self.translate0);
  22827. self.zoomed(dispatch);
  22828. };
  22829. }
  22830. },
  22831. /**
  22832. * Applies the zoom behavior to the specified selection, registering the necessary event listeners to support panning and zooming.
  22833. * @param (com.ibm.rave.core.selector.Selector) g the selector to apply zoom behavior on
  22834. */
  22835. /** @expose */
  22836. zoom : com_ibm_rave_core_nativeImpl_Declare.bind(function(g) {
  22837. g.on("mousedown.zoom", this.mousedowned).on("wheel.zoom", this.mousewheeled).on("dblclick.zoom", this.dblclicked).on("touchstart.zoom", this.touchstarted);
  22838. }),
  22839. /**
  22840. * Returns the current translation vector, which defaults to a point of [0, 0].
  22841. * @return (Array) the current translation vector
  22842. */
  22843. translate$0 : function() {
  22844. return [this.view.x, this.view.y];
  22845. },
  22846. /**
  22847. * Specifies the current zoom translation vector.
  22848. * @param (Array) point the zoom translation vector to set
  22849. * @return (com.ibm.rave.core.behavior.Zoom) this zoom instance itself
  22850. */
  22851. translate$1 : function(point) {
  22852. this.view = new com_ibm_rave_core_behavior_Zoom.View(point[0], point[1], this.view.k);
  22853. this.rescale();
  22854. return this;
  22855. },
  22856. /**
  22857. * Returns the current zoom scale, which defaults to 1.
  22858. * @return (double) the current zoom scale factor
  22859. */
  22860. scale$0 : function() {
  22861. return this.view.k;
  22862. },
  22863. /**
  22864. * Specifies the current zoom scale.
  22865. * @param (double) s the zoom scale to set
  22866. * @return (com.ibm.rave.core.behavior.Zoom) this zoom instance itself
  22867. */
  22868. scale$1 : function(s) {
  22869. this.view = new com_ibm_rave_core_behavior_Zoom.View(this.view.x, this.view.y, s);
  22870. this.rescale();
  22871. return this;
  22872. },
  22873. /**
  22874. * Returns the current scale extent dimension object, which defaults to a minimum of 0 and maximum of Infinity.
  22875. * @return (Array) scale extent dimension object
  22876. */
  22877. scaleExtent$0 : function() {
  22878. return this._scaleExtent;
  22879. },
  22880. /**
  22881. * Specifies the zoom scale's allowed range as dimension object with minimum, maximum values.
  22882. * @param (Array) dim the dimension object where w represent the minimum value and h represent the maximum value
  22883. * @return (com.ibm.rave.core.behavior.Zoom) this zoom instance itself
  22884. */
  22885. scaleExtent$1 : function(dim) {
  22886. this._scaleExtent = !dim ? com_ibm_rave_core_behavior_Zoom.zoomInfinity : [dim[0], dim[1]];
  22887. return this;
  22888. },
  22889. /**
  22890. * 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.
  22891. * @return (Array) the current focal point
  22892. */
  22893. center$0 : function() {
  22894. return this._center;
  22895. },
  22896. /**
  22897. * Sets the focal point [x, y] for mousewheel zooming.
  22898. * @param (Array) p the focal point to set
  22899. * @return (com.ibm.rave.core.behavior.Zoom) this zoom instance itself
  22900. */
  22901. center$1 : function(p) {
  22902. this._center = p ? [p[0], p[1]] : null;
  22903. return this;
  22904. },
  22905. /**
  22906. * The Duration of the zoom transition
  22907. * @return (double) zoom transition duration
  22908. */
  22909. duration$0 : function() {
  22910. return this._duration;
  22911. },
  22912. /**
  22913. * Sets the zoom transition duration
  22914. * @param (double) duration the zoom transition duration value
  22915. * @return (com.ibm.rave.core.behavior.Zoom) this zoom instance itself
  22916. */
  22917. duration$1 : function(duration) {
  22918. this._duration = duration;
  22919. return this;
  22920. },
  22921. /**
  22922. * Returns the current viewport size which defaults to [960, 500]. A size is needed to support smooth zooming during transitions.
  22923. * @return (Array) the current viewport size
  22924. */
  22925. size$0 : function() {
  22926. return this._size;
  22927. },
  22928. /**
  22929. * If size is specified, sets the viewport size to the specified dimensions [width, height] and returns this zoom behavior.
  22930. * @param (Array) p the zoom viewport size
  22931. * @return (com.ibm.rave.core.behavior.Zoom) this zoom instance itself
  22932. */
  22933. size$1 : function(p) {
  22934. this._size = p ? [p[0], p[1]] : null;
  22935. return this;
  22936. },
  22937. /**
  22938. * Returns the current x-scale, which defaults to null
  22939. * @return (com.ibm.rave.core.scales.AbstractScale) the current x-scale
  22940. */
  22941. x$0 : function() {
  22942. return this.sx1;
  22943. },
  22944. /**
  22945. * 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].
  22946. * @param (com.ibm.rave.core.scales.AbstractScale) z the x-scale
  22947. * @return (com.ibm.rave.core.behavior.Zoom) this zoom instance itself
  22948. */
  22949. x$1 : function(z) {
  22950. this.sx1 = z;
  22951. this.sx0 = z.copy();
  22952. this.view = new com_ibm_rave_core_behavior_Zoom.View(0, 0, 1);
  22953. return this;
  22954. },
  22955. /**
  22956. * Returns the current y-scale, which defaults to null.
  22957. * @return (com.ibm.rave.core.scales.AbstractScale) the current y-scale
  22958. */
  22959. y$0 : function() {
  22960. return this.sy1;
  22961. },
  22962. /**
  22963. * 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].
  22964. * @param (com.ibm.rave.core.scales.AbstractScale) z the y-scale
  22965. * @return (com.ibm.rave.core.behavior.Zoom) this zoom instance itself
  22966. */
  22967. y$1 : function(z) {
  22968. this.sy1 = z;
  22969. this.sy0 = z.copy();
  22970. this.view = new com_ibm_rave_core_behavior_Zoom.View(0, 0, 1);
  22971. return this;
  22972. },
  22973. location : function(p) {
  22974. return [(p[0] - this.view.x) / this.view.k, (p[1] - this.view.y) / this.view.k];
  22975. },
  22976. point : function(l) {
  22977. return [l[0] * this.view.k + this.view.x, l[1] * this.view.k + this.view.y];
  22978. },
  22979. scaleTo : function(s) {
  22980. this.view.k = Math.max(this._scaleExtent[0], Math.min(this._scaleExtent[1], s));
  22981. },
  22982. translateTo : function(p, l) {
  22983. var _l = this.point(l);
  22984. this.view.x += p[0] - _l[0];
  22985. this.view.y += p[1] - _l[1];
  22986. },
  22987. rescale : function() {
  22988. if (this.sx1) {
  22989. if (this.sx1.zoomTransform) {
  22990. this.sx1.zoomTransform(this.view.k, this.view.x);
  22991. } else {
  22992. var ro = this.sx0.range();
  22993. var r = [];
  22994. for (var i = 0, len = ro.length; i < len; ++i) {
  22995. var value = this.sx0.invert((+ (ro[i]) - this.view.x) / this.view.k);
  22996. r.push(+ (value));
  22997. }
  22998. this.sx1.domain(r);
  22999. }
  23000. }
  23001. if (this.sy1) {
  23002. if (this.sy1.zoomTransform) {
  23003. this.sy1.zoomTransform(this.view.k, this.view.y);
  23004. } else {
  23005. var ro = this.sy0.range();
  23006. var r = [];
  23007. for (var i = 0, len = ro.length; i < len; ++i) {
  23008. var value = this.sy0.invert((+ (ro[i]) - this.view.y) / this.view.k);
  23009. r.push(+ (value));
  23010. }
  23011. this.sy1.domain(r);
  23012. }
  23013. }
  23014. },
  23015. zoomstarted : function(dispatch) {
  23016. if (this.zooming++ == 0) {
  23017. dispatch(new com_ibm_rave_core_behavior_Zoom.EventObject("zoomstart", 0, null));
  23018. }
  23019. },
  23020. zoomed : function(dispatch) {
  23021. this.rescale();
  23022. dispatch(new com_ibm_rave_core_behavior_Zoom.EventObject("zoom", this.view.k, [this.view.x, this.view.y]));
  23023. },
  23024. zoomended : function(dispatch) {
  23025. if (--this.zooming == 0) {
  23026. dispatch(new com_ibm_rave_core_behavior_Zoom.EventObject("zoomend", 0, null));
  23027. }
  23028. this.center0 = null;
  23029. },
  23030. /**
  23031. * Gets the listener for the specified event type supported by brush: "zoomstart", "zoom" and "zoomend"
  23032. * @param (String) type the type of event to get the listener for
  23033. * @return (com.ibm.rave.core.selector.RunFunction) the listener for the specified event or null if none was registered
  23034. */
  23035. on$0 : function(type) {
  23036. return this._event.on$0(type);
  23037. },
  23038. /**
  23039. * 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.
  23040. * @param (String) type the type of the brush event to listen for
  23041. * @param (com.ibm.rave.core.selector.RunFunction) listener the listener to register
  23042. * @return (com.ibm.rave.core.behavior.Zoom) this zoom instance itself
  23043. */
  23044. on$1 : function(type, listener) {
  23045. this._event.on$1(type, listener);
  23046. return this;
  23047. },
  23048. zoomTo : function(that, p, l, k) {
  23049. that.rave_setProperty("__chart__", new com_ibm_rave_core_behavior_Zoom.View(this.view.x, this.view.y, this.view.k));
  23050. this.scaleTo(Math.pow(2, k));
  23051. this.translateTo(this.center0 = p, l);
  23052. var context = com_ibm_rave_core_Rave.select(that);
  23053. if (this._duration > 0) {
  23054. context = context.transition().duration(this._duration);
  23055. }
  23056. context.call(this.event);
  23057. },
  23058. /** @expose */
  23059. translate : function(a0) {
  23060. var args = arguments;
  23061. if (args.length == 0) {
  23062. return this.translate$0();
  23063. }
  23064. return this.translate$1(a0);
  23065. },
  23066. /** @expose */
  23067. scale : function(a0) {
  23068. var args = arguments;
  23069. if (args.length == 0) {
  23070. return this.scale$0();
  23071. }
  23072. return this.scale$1(a0);
  23073. },
  23074. /** @expose */
  23075. scaleExtent : function(a0) {
  23076. var args = arguments;
  23077. if (args.length == 0) {
  23078. return this.scaleExtent$0();
  23079. }
  23080. return this.scaleExtent$1(a0);
  23081. },
  23082. /** @expose */
  23083. center : function(a0) {
  23084. var args = arguments;
  23085. if (args.length == 0) {
  23086. return this.center$0();
  23087. }
  23088. return this.center$1(a0);
  23089. },
  23090. /** @expose */
  23091. duration : function(a0) {
  23092. var args = arguments;
  23093. if (args.length == 0) {
  23094. return this.duration$0();
  23095. }
  23096. return this.duration$1(a0);
  23097. },
  23098. /** @expose */
  23099. size : function(a0) {
  23100. var args = arguments;
  23101. if (args.length == 0) {
  23102. return this.size$0();
  23103. }
  23104. return this.size$1(a0);
  23105. },
  23106. /** @expose */
  23107. x : function(a0) {
  23108. var args = arguments;
  23109. if (args.length == 0) {
  23110. return this.x$0();
  23111. }
  23112. return this.x$1(a0);
  23113. },
  23114. /** @expose */
  23115. y : function(a0) {
  23116. var args = arguments;
  23117. if (args.length == 0) {
  23118. return this.y$0();
  23119. }
  23120. return this.y$1(a0);
  23121. },
  23122. /** @expose */
  23123. on : function(a0, a1) {
  23124. var args = arguments;
  23125. if (args.length == 1) {
  23126. return this.on$0(a0);
  23127. }
  23128. return this.on$1(a0, a1);
  23129. }
  23130. });
  23131. com_ibm_rave_core_behavior_Zoom.ZoomEvent = com_ibm_rave_core_nativeImpl_Declare({
  23132. //_zoom : null,
  23133. _$functionClassMethod : function() {
  23134. var _$self = function(args) {
  23135. if (args !== null || arguments.length > 1){
  23136. args = Array.prototype.slice.call(arguments, 0);
  23137. }
  23138. {
  23139. _$self.doRun.apply(this, [args[0], _$self._zoom].concat(args));
  23140. return null;
  23141. }
  23142. };
  23143. return _$self;
  23144. },
  23145. constructor : function(zoom) {
  23146. this._zoom = zoom;
  23147. },
  23148. /**
  23149. * 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.
  23150. * @param (com.ibm.rave.core.selector.Selection) g the selection to trigger events for
  23151. */
  23152. /** @expose */
  23153. doRun : function(g, zoom, args) {
  23154. if (args !== null || arguments.length > 3){
  23155. args = Array.prototype.slice.call(arguments, 2);
  23156. }
  23157. {
  23158. g.each(function(data, index, groupIndex) {
  23159. var dispatch = zoom._event.of(this, data, index, groupIndex);
  23160. var view1 = zoom.view;
  23161. if (com_ibm_rave_core_internal_nativeImpl_transitions_InheritedTransition.get()) {
  23162. com_ibm_rave_core_Rave.select(this).transition().each("start.zoom", function(args) {
  23163. if (args !== null || arguments.length > 1){
  23164. args = Array.prototype.slice.call(arguments, 0);
  23165. }
  23166. {
  23167. var temp = this.rave_getProperty("__chart__");
  23168. if (temp == null) {
  23169. zoom.view = new com_ibm_rave_core_behavior_Zoom.View(0, 0, 1);
  23170. } else {
  23171. zoom.view = temp;
  23172. }
  23173. zoom.zoomstarted(dispatch);
  23174. return null;
  23175. }
  23176. }).tween("zoom:zoom", function(data1, index1, groupIndex1) {
  23177. var dx = zoom._size[0], dy = zoom._size[1], cx = zoom.center0 ? zoom.center0[0] : dx / 2, cy = zoom.center0 ? zoom.center0[1] : dy / 2;
  23178. var p0 = [(cx - zoom.view.x) / zoom.view.k, (cy - zoom.view.y) / zoom.view.k, dx / zoom.view.k];
  23179. var p1 = [(cx - view1.x) / view1.k, (cy - view1.y) / view1.k, dx / view1.k];
  23180. var i = com_ibm_rave_core_interpolate_ZoomInterpolation.INSTANCE(p0, p1);
  23181. return function(t) {
  23182. var l = i(t);
  23183. var k = dx / l[2];
  23184. zoom.view = new com_ibm_rave_core_behavior_Zoom.View(cx - l[0] * k, cy - l[1] * k, k);
  23185. this.rave_setProperty("__chart__", zoom.view);
  23186. zoom.zoomed(dispatch);
  23187. };
  23188. }).each("interrupt.zoom", function(args) {
  23189. if (args !== null || arguments.length > 1){
  23190. args = Array.prototype.slice.call(arguments, 0);
  23191. }
  23192. {
  23193. zoom.zoomended(dispatch);
  23194. return null;
  23195. }
  23196. }).each("end.zoom", function(args) {
  23197. if (args !== null || arguments.length > 1){
  23198. args = Array.prototype.slice.call(arguments, 0);
  23199. }
  23200. {
  23201. zoom.zoomended(dispatch);
  23202. return null;
  23203. }
  23204. });
  23205. } else {
  23206. this.rave_setProperty("__chart__", zoom.view);
  23207. zoom.zoomstarted(dispatch);
  23208. zoom.zoomed(dispatch);
  23209. zoom.zoomended(dispatch);
  23210. }
  23211. });
  23212. }
  23213. }
  23214. });
  23215. com_ibm_rave_core_behavior_Zoom.View = function(x, y, k) {
  23216. this.x = x;
  23217. this.y = y;
  23218. this.k = k;
  23219. };
  23220. /**
  23221. * The event object fired for zoom events: "zoomstart", "zoom", "zoomend"
  23222. */
  23223. com_ibm_rave_core_behavior_Zoom.EventObject = rave_externs["EventObject"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_event_BaseEvent, {
  23224. /**
  23225. * A two-element array representing the current translation vector.
  23226. */
  23227. /** @expose */
  23228. translate : null,
  23229. /**
  23230. * The current zoom scale.
  23231. */
  23232. /** @expose */
  23233. scale : 0,
  23234. constructor : function(type, scale, translate) {
  23235. this.scale = scale;
  23236. this.translate = translate;
  23237. }
  23238. });
  23239. //com_ibm_rave_core_behavior_Zoom.CHART_PROP = "__chart__";
  23240. //com_ibm_rave_core_behavior_Zoom.zoomWheel = "wheel.zoom";
  23241. //com_ibm_rave_core_behavior_Zoom.mousedown = "mousedown.zoom";
  23242. //com_ibm_rave_core_behavior_Zoom.mouseup = "mouseup.zoom";
  23243. //com_ibm_rave_core_behavior_Zoom.mousemove = "mousemove.zoom";
  23244. //com_ibm_rave_core_behavior_Zoom.touchstart = "touchstart.zoom";
  23245. //com_ibm_rave_core_behavior_Zoom.dblclick = "dblclick.zoom";
  23246. com_ibm_rave_core_behavior_Zoom.zoomInfinity = [0, Infinity];
  23247. com_ibm_rave_core_behavior_Zoom.zoomDelta = function() {
  23248. var event = rave.event;
  23249. return -event.deltaY * (event.deltaMode != 0 ? 120 : 1);
  23250. };
  23251. // $source: com/ibm/rave/core/interpolate/ZoomInterpolation
  23252. /************************************************************************
  23253. ** IBM Confidential
  23254. **
  23255. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  23256. **
  23257. ** (C) Copyright IBM Corp. 2017
  23258. **
  23259. ** The source code for this program is not published or otherwise divested of its trade secrets,
  23260. ** irrespective of what has been deposited with the U.S. Copyright Office.
  23261. ************************************************************************/
  23262. // GENERATED
  23263. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  23264. //@import com/ibm/rave/core/internal/math/Trigonometry (runtime) // tanh, sinh, cosh
  23265. var com_ibm_rave_core_interpolate_ZoomInterpolation = rave_externs["ZoomInterpolation"] = com_ibm_rave_core_nativeImpl_Declare({
  23266. _$functionClassMethod : function() {
  23267. var _$self = /**
  23268. * 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).
  23269. * @param (Array) p0 the first view
  23270. * @param (Array) p1 the second view
  23271. * @return (com.ibm.rave.core.interpolate.ZoomInterpolation.ZoomInterpolator) a zoom interpolator
  23272. */
  23273. function(p0, p1) {
  23274. 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;
  23275. var interpolate = function(t) {
  23276. var point;
  23277. var s = t * S;
  23278. if ((dr)) {
  23279. 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));
  23280. 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)];
  23281. } else {
  23282. point = [ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(com_ibm_rave_core_interpolate_ZoomInterpolation.p * s)];
  23283. }
  23284. return point;
  23285. };
  23286. interpolate.duration = S * 1000;
  23287. return interpolate;
  23288. };
  23289. return _$self;
  23290. }
  23291. });
  23292. /** @expose */
  23293. com_ibm_rave_core_interpolate_ZoomInterpolation.INSTANCE = new com_ibm_rave_core_interpolate_ZoomInterpolation();
  23294. 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;
  23295. // $source: com/ibm/rave/core/behavior/SelectionEventHandler
  23296. /************************************************************************
  23297. ** IBM Confidential
  23298. **
  23299. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  23300. **
  23301. ** (C) Copyright IBM Corp. 2017
  23302. **
  23303. ** The source code for this program is not published or otherwise divested of its trade secrets,
  23304. ** irrespective of what has been deposited with the U.S. Copyright Office.
  23305. ************************************************************************/
  23306. // GENERATED
  23307. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  23308. //@import com/ibm/rave/core/internal/nativeImpl/event/Event (runtime) // new
  23309. /**
  23310. * Tracks and fires selection events.
  23311. */
  23312. var com_ibm_rave_core_behavior_SelectionEventHandler = rave_externs["SelectionEventHandler"] = com_ibm_rave_core_nativeImpl_Declare({
  23313. //selectedNodes : null,
  23314. constructor : function() {
  23315. this.selectedNodes = [];
  23316. },
  23317. /**
  23318. * Get the list of selected nodes.
  23319. * @return (Array) the list of selected nodes
  23320. */
  23321. selected$0 : function() {
  23322. return this.selectedNodes;
  23323. },
  23324. selected$1 : function(node) {
  23325. this.selectedNodes.push(node);
  23326. },
  23327. selected$2 : function(nodes) {
  23328. for (var __i_enFor0 = 0, __exp_enFor0 = nodes, __len_enFor0 = __exp_enFor0.length;
  23329. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  23330. var node = __exp_enFor0[__i_enFor0];
  23331. this.selectedNodes.push(node);
  23332. }
  23333. },
  23334. /**
  23335. * Get the last selected node.
  23336. * @return (com.ibm.rave.core.scene.SceneNode) the last selected node, or <code>null</code> if no selection
  23337. */
  23338. /** @expose */
  23339. lastSelected : function() {
  23340. return this.selectedNodes.length > 0 ? this.selectedNodes[this.selectedNodes.length - 1] : null;
  23341. },
  23342. /** @expose */
  23343. isSelected : function(node) {
  23344. return this.selectedNodes.indexOf(node) != -1;
  23345. },
  23346. fireSelected$0 : function(node) {
  23347. this.fireSelected$1(node, true);
  23348. },
  23349. fireSelected$1 : function(node, unselectPrevious) {
  23350. var events = [];
  23351. var idx = -1;
  23352. if (unselectPrevious) {
  23353. var selectednode;
  23354. while (this.selectedNodes.length > 0 && (selectednode = this.selectedNodes.shift())) {
  23355. if (selectednode == node) {
  23356. idx = 0;
  23357. } else {
  23358. events.push(com_ibm_rave_core_behavior_SelectionEventHandler.createEventContainer("raveunselected", selectednode, false, true));
  23359. }
  23360. }
  23361. } else {
  23362. idx = this.selectedNodes.indexOf(node);
  23363. if (idx >= 0) {
  23364. this.selectedNodes.splice(idx, 1);
  23365. }
  23366. }
  23367. this.selectedNodes.push(node);
  23368. events.push(com_ibm_rave_core_behavior_SelectionEventHandler.createEventContainer("raveselected", node, true, idx >= 0));
  23369. this.fireEvents(events);
  23370. },
  23371. /** @expose */
  23372. fireUnselectAll : function() {
  23373. var events = [];
  23374. for (var i = 0; i < this.selectedNodes.length; ++i) {
  23375. events.push(com_ibm_rave_core_behavior_SelectionEventHandler.createEventContainer("raveunselected", this.selectedNodes[i], false, true));
  23376. }
  23377. this.selectedNodes = [];
  23378. this.fireEvents(events);
  23379. },
  23380. fireSelected$2 : function(nodes) {
  23381. this.fireSelected$3(nodes, true);
  23382. },
  23383. fireSelected$3 : function(nodes, unselectPrevious) {
  23384. var events = [];
  23385. if (unselectPrevious) {
  23386. var selectedEvents = [];
  23387. for (var i = 0; i < nodes.length; ++i) {
  23388. var node = nodes[i];
  23389. selectedEvents.push(com_ibm_rave_core_behavior_SelectionEventHandler.createEventContainer("raveselected", node, true, this.selectedNodes.indexOf(node) >= 0));
  23390. }
  23391. for (var i = 0; i < this.selectedNodes.length; ++i) {
  23392. var selectednode = this.selectedNodes[i];
  23393. if (nodes.indexOf(selectednode) >= 0) {
  23394. this.selectedNodes.splice(i--, 1);
  23395. events.push(com_ibm_rave_core_behavior_SelectionEventHandler.createEventContainer("raveunselected", selectednode, false, true));
  23396. break;
  23397. }
  23398. }
  23399. events = events.concat(selectedEvents);
  23400. } else {
  23401. for (var i = 0; i < nodes.length; ++i) {
  23402. var node = nodes[i];
  23403. var idx = this.selectedNodes.indexOf(node);
  23404. events.push(com_ibm_rave_core_behavior_SelectionEventHandler.createEventContainer("raveselected", node, true, idx >= 0));
  23405. this.selectedNodes.splice(idx, 1);
  23406. }
  23407. this.selectedNodes = this.selectedNodes.concat(nodes);
  23408. }
  23409. this.fireEvents(events);
  23410. },
  23411. fireUnselected$0 : function(node) {
  23412. var idx = this.selectedNodes.indexOf(node);
  23413. if (idx >= 0) {
  23414. this.selectedNodes.splice(idx, 1);
  23415. node.dispatchEvent(com_ibm_rave_core_behavior_SelectionEventHandler.createEvent("raveunselected", false, true));
  23416. }
  23417. },
  23418. fireUnselected$1 : function(nodes) {
  23419. var events = [];
  23420. for (var i = 0; i < this.selectedNodes.length; ++i) {
  23421. for (var j = 0; j < nodes.length; ++j) {
  23422. var selectednode = this.selectedNodes[i];
  23423. if (nodes[j] == selectednode) {
  23424. this.selectedNodes.splice(i--, 1);
  23425. events.push(com_ibm_rave_core_behavior_SelectionEventHandler.createEventContainer("raveunselected", selectednode, false, true));
  23426. break;
  23427. }
  23428. }
  23429. }
  23430. this.fireEvents(events);
  23431. },
  23432. fireEvents : function(events) {
  23433. var clone = this.selectedNodes.slice();
  23434. for (var __i_enFor0 = 0, __exp_enFor0 = events, __len_enFor0 = __exp_enFor0.length;
  23435. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  23436. var e = __exp_enFor0[__i_enFor0];
  23437. e.event.selection = clone;
  23438. e.target.dispatchEvent(e.event);
  23439. }
  23440. },
  23441. /** @expose */
  23442. selected : function(a0) {
  23443. var args = arguments;
  23444. if (args.length == 0) {
  23445. return this.selected$0();
  23446. }
  23447. if (args.length == 1 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]")) {
  23448. return this.selected$2(a0);
  23449. }
  23450. return this.selected$1(a0);
  23451. },
  23452. /** @expose */
  23453. fireSelected : function(a0, a1) {
  23454. var args = arguments;
  23455. if (args.length == 1 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]")) {
  23456. return this.fireSelected$2(a0);
  23457. }
  23458. if (args.length == 1) {
  23459. return this.fireSelected$0(a0);
  23460. }
  23461. if (args.length == 2 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]") && (a1 == null || typeof a1 === "boolean")) {
  23462. return this.fireSelected$3(a0, a1);
  23463. }
  23464. return this.fireSelected$1(a0, a1);
  23465. },
  23466. /** @expose */
  23467. fireUnselected : function(a0) {
  23468. var args = arguments;
  23469. if (args.length == 1 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]")) {
  23470. return this.fireUnselected$1(a0);
  23471. }
  23472. return this.fireUnselected$0(a0);
  23473. }
  23474. });
  23475. com_ibm_rave_core_behavior_SelectionEventHandler.createEvent = function(type, selected, previouslySelected) {
  23476. var event = new com_ibm_rave_core_internal_nativeImpl_event_Event(type, true, false);
  23477. event.selected = selected;
  23478. event.previouslySelected = previouslySelected;
  23479. return event;
  23480. };
  23481. com_ibm_rave_core_behavior_SelectionEventHandler.createEventContainer = function(type, target, selected, previouslySelected) {
  23482. return new com_ibm_rave_core_behavior_SelectionEventHandler.EventContainer(com_ibm_rave_core_behavior_SelectionEventHandler.createEvent(type, selected, previouslySelected), target);
  23483. };
  23484. com_ibm_rave_core_behavior_SelectionEventHandler.EventContainer = function(event, target) {
  23485. this.event = event;
  23486. this.target = target;
  23487. };
  23488. /** @expose */
  23489. com_ibm_rave_core_behavior_SelectionEventHandler.SELECTED_EVENT_TYPE = "raveselected";
  23490. /** @expose */
  23491. com_ibm_rave_core_behavior_SelectionEventHandler.UNSELECTED_EVENT_TYPE = "raveunselected";
  23492. // $source: com/ibm/rave/core/behavior/FocusEventHandler
  23493. /************************************************************************
  23494. ** IBM Confidential
  23495. **
  23496. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  23497. **
  23498. ** (C) Copyright IBM Corp. 2017
  23499. **
  23500. ** The source code for this program is not published or otherwise divested of its trade secrets,
  23501. ** irrespective of what has been deposited with the U.S. Copyright Office.
  23502. ************************************************************************/
  23503. // GENERATED
  23504. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  23505. //@import com/ibm/rave/core/internal/nativeImpl/event/Event (static) // new
  23506. /**
  23507. * Tracks and fires focus and blur events.
  23508. */
  23509. var com_ibm_rave_core_behavior_FocusEventHandler = rave_externs["FocusEventHandler"] = com_ibm_rave_core_nativeImpl_Declare({
  23510. //focusedNode : null,
  23511. /**
  23512. * Get the focused node.
  23513. * @return (com.ibm.rave.core.scene.SceneNode) the focused node
  23514. */
  23515. focused$0 : function() {
  23516. return this.focusedNode;
  23517. },
  23518. /**
  23519. * Set the focused node.
  23520. * @param (com.ibm.rave.core.scene.SceneNode) node The node that has focus.
  23521. */
  23522. focused$1 : function(node) {
  23523. this.focusedNode = node;
  23524. },
  23525. /**
  23526. * Check if the node is the focused one.
  23527. * @param (com.ibm.rave.core.scene.SceneNode) node The SceneNode.
  23528. * @return (boolean) true if it is the focused node, false otherwise.
  23529. */
  23530. /** @expose */
  23531. isFocused : function(node) {
  23532. return this.focusedNode ? this.focusedNode == node : false;
  23533. },
  23534. /**
  23535. * Fire a focus event on the provided node. This will be preceded by a blur event on the previously focused node, if any.
  23536. * @param (com.ibm.rave.core.scene.SceneNode) node The node to receive focus.
  23537. */
  23538. /** @expose */
  23539. fireFocus : function(node) {
  23540. if (!(this.isFocused(node))) {
  23541. if (this.focusedNode) {
  23542. this.focusedNode.dispatchEvent(com_ibm_rave_core_behavior_FocusEventHandler.createEvent("raveblur"));
  23543. }
  23544. this.focusedNode = node;
  23545. node.dispatchEvent(com_ibm_rave_core_behavior_FocusEventHandler.createEvent("ravefocus"));
  23546. }
  23547. },
  23548. /**
  23549. * Fire a blur event on the provided node.
  23550. * @param (com.ibm.rave.core.scene.SceneNode) node The node to be blurred.
  23551. */
  23552. /** @expose */
  23553. fireBlur : function(node) {
  23554. if (this.isFocused(node)) {
  23555. this.focusedNode = null;
  23556. node.dispatchEvent(com_ibm_rave_core_behavior_FocusEventHandler.createEvent("raveblur"));
  23557. }
  23558. },
  23559. /** @expose */
  23560. focused : function(a0) {
  23561. var args = arguments;
  23562. if (args.length == 0) {
  23563. return this.focused$0();
  23564. }
  23565. return this.focused$1(a0);
  23566. }
  23567. });
  23568. com_ibm_rave_core_behavior_FocusEventHandler.createEvent = function(type) {
  23569. return new com_ibm_rave_core_internal_nativeImpl_event_Event(type, true, false);
  23570. };
  23571. /** @expose */
  23572. com_ibm_rave_core_behavior_FocusEventHandler.FOCUS_EVENT_TYPE = "ravefocus";
  23573. /** @expose */
  23574. com_ibm_rave_core_behavior_FocusEventHandler.BLUR_EVENT_TYPE = "raveblur";
  23575. // $source: com/ibm/rave/core/layout/BundleLayout
  23576. /************************************************************************
  23577. ** IBM Confidential
  23578. **
  23579. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  23580. **
  23581. ** (C) Copyright IBM Corp. 2017
  23582. **
  23583. ** The source code for this program is not published or otherwise divested of its trade secrets,
  23584. ** irrespective of what has been deposited with the U.S. Copyright Office.
  23585. ************************************************************************/
  23586. // GENERATED
  23587. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  23588. /**
  23589. * 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.
  23590. */
  23591. var com_ibm_rave_core_layout_BundleLayout = rave_externs["BundleLayout"] = com_ibm_rave_core_nativeImpl_Declare({
  23592. _$functionClassMethod : function() {
  23593. var _$self = function(data, index, groupIndex) {
  23594. return _$self.bundle(data);
  23595. };
  23596. return _$self;
  23597. },
  23598. /**
  23599. * 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.
  23600. * @param (Array) links the links
  23601. * @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.
  23602. */
  23603. /** @expose */
  23604. bundle : function(links) {
  23605. var paths = [];
  23606. var i = -1;
  23607. var n = links.length;
  23608. while (++i < n) {
  23609. paths.push(this.layout_bundlePath(links[i]));
  23610. }
  23611. return paths;
  23612. },
  23613. layout_bundleAncestors : function(node) {
  23614. var _node = node;
  23615. var ancestors = [];
  23616. var parent = _node["parent"];
  23617. while (parent) {
  23618. ancestors.push(_node);
  23619. _node = parent;
  23620. parent = parent["parent"];
  23621. }
  23622. ancestors.push(_node);
  23623. return ancestors;
  23624. },
  23625. layout_bundleLeastCommonAncestor : function(a, b) {
  23626. if (a == b) {
  23627. return a;
  23628. }
  23629. var aNodes = this.layout_bundleAncestors(a);
  23630. var bNodes = this.layout_bundleAncestors(b);
  23631. var aNode = aNodes.pop();
  23632. var bNode = bNodes.pop();
  23633. var sharedNode;
  23634. while (aNode == bNode) {
  23635. sharedNode = aNode;
  23636. aNode = aNodes.pop();
  23637. bNode = bNodes.pop();
  23638. }
  23639. return sharedNode;
  23640. },
  23641. layout_bundlePath : function(link) {
  23642. var start = link["source"];
  23643. var end = link["target"];
  23644. var lca = this.layout_bundleLeastCommonAncestor(start, end);
  23645. var points = [start];
  23646. while (start != lca) {
  23647. start = start["parent"];
  23648. points.push(start);
  23649. }
  23650. var k = points.length;
  23651. while (end != lca) {
  23652. points.splice(k, 0, end);
  23653. end = end["parent"];
  23654. }
  23655. return points;
  23656. }
  23657. });
  23658. // $source: com/ibm/rave/core/layout/hierarchy/HierarchyBase
  23659. /************************************************************************
  23660. ** IBM Confidential
  23661. **
  23662. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  23663. **
  23664. ** (C) Copyright IBM Corp. 2017
  23665. **
  23666. ** The source code for this program is not published or otherwise divested of its trade secrets,
  23667. ** irrespective of what has been deposited with the U.S. Copyright Office.
  23668. ************************************************************************/
  23669. // GENERATED
  23670. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, declare anonymous
  23671. //@import com/ibm/rave/core/layout/hierarchy/HierarchyUtil (runtime) // visitAfter, links
  23672. /**
  23673. * 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.
  23674. * @param < (Object) T > the sub type of the HierarchyNode used
  23675. * @param < (com.ibm.rave.core.layout.hierarchy.HierarchyBase) S > the sub type of the HierarchyBase used
  23676. */
  23677. var com_ibm_rave_core_layout_hierarchy_HierarchyBase = rave_externs["HierarchyBase"] = com_ibm_rave_core_nativeImpl_Declare({
  23678. /**
  23679. * Gets the children of a specified node
  23680. */
  23681. //defaultChildrenFunction : null,
  23682. /**
  23683. * Gets the value of a specified node
  23684. */
  23685. //defaultNodeValueFunction : null,
  23686. /**
  23687. * Sorts two nodes based on the value of the node
  23688. */
  23689. //defaultSortFunction : null,
  23690. /** @expose */
  23691. nodeValueFunction : null,
  23692. /** @expose */
  23693. childrenFunction : null,
  23694. /** @expose */
  23695. sortFunction : null,
  23696. /**
  23697. * An alias to this layout instance
  23698. */
  23699. /** @expose */
  23700. nodes : null,
  23701. _$functionClassMethod : function() {
  23702. var _$self = function(data, index, groupIndex) {
  23703. return _$self.create(data);
  23704. };
  23705. return _$self;
  23706. },
  23707. constructor : function() {
  23708. this.defaultChildrenFunction = /**
  23709. * Gets the children of the specified node
  23710. * @param (Object) node node to retrieve the children from
  23711. * @param (int) depth the depth of the node, starting at 0 for the root
  23712. * @return (Array) an array containing all the children
  23713. */
  23714. function(node, depth) {
  23715. return node["children"];
  23716. };
  23717. this.defaultNodeValueFunction = /**
  23718. * Gets the value of a specified node
  23719. * @param (Object) node node to retrieve the value from
  23720. * @param (int) depth the depth of the node, starting at 0 for the root
  23721. * @return (Object) the value of the node
  23722. */
  23723. function(node, depth) {
  23724. return node["value"];
  23725. };
  23726. this.defaultSortFunction = /**
  23727. * Sorts two nodes based on the value of the node
  23728. * @param (Object) a the first node to compare against
  23729. * @param (Object) b the second node to compare against
  23730. * @return (int) indicates whether node b is greater than, equal to or less than node a
  23731. */
  23732. function(a, b) {
  23733. return ~~(b["value"] - a["value"]);
  23734. };
  23735. this.nodeValueFunction = this.defaultNodeValueFunction;
  23736. this.childrenFunction = this.defaultChildrenFunction;
  23737. this.sortFunction = this.defaultSortFunction;
  23738. /**
  23739. */
  23740. {
  23741. this.nodes = this;
  23742. }
  23743. },
  23744. /**
  23745. * 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.
  23746. * @param (Object) stackNode the root node to be processed
  23747. * @return (Array) all nodes to be drawn
  23748. */
  23749. /** @expose */
  23750. create : function(stackNode) {
  23751. var stack = [];
  23752. var nodes = [];
  23753. stackNode["depth"] = 0;
  23754. stack.push(stackNode);
  23755. var root;
  23756. var child;
  23757. var childs;
  23758. var n;
  23759. while ((root = stack.pop())) {
  23760. nodes.push(root);
  23761. if ((childs = this.childrenFunction.call(this, root, root["depth"])) && (n = childs.length) > 0) {
  23762. while (--n >= 0) {
  23763. stack.push(child = childs[n]);
  23764. child["parent"] = root;
  23765. child["depth"] = root["depth"] + 1;
  23766. }
  23767. if (this.nodeValueFunction) {
  23768. root["value"] = 0.0;
  23769. }
  23770. root["children"] = childs;
  23771. } else {
  23772. if (this.nodeValueFunction) {
  23773. var valueVal = + (this.nodeValueFunction.call(this, root, root["depth"]));
  23774. if (valueVal != valueVal) {
  23775. valueVal = 0;
  23776. }
  23777. root["value"] = valueVal;
  23778. }
  23779. root["children"] = undefined;
  23780. }
  23781. }
  23782. if (this.sortFunction || this.nodeValueFunction) {
  23783. var self = this;
  23784. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitAfter(stackNode, new (com_ibm_rave_core_nativeImpl_Declare({
  23785. visit : function(node) {
  23786. var childs;
  23787. var parent;
  23788. if (self.sortFunction && (childs = node["children"])) {
  23789. childs.sort(self.sortFunction);
  23790. }
  23791. if (self.nodeValueFunction && (parent = node["parent"])) {
  23792. parent["value"] += node["value"];
  23793. }
  23794. }
  23795. }))());
  23796. }
  23797. return nodes;
  23798. },
  23799. /**
  23800. * If comparator is specified, sets the sort order of sibling nodes for the layout using the specified comparator function
  23801. * @param (com.ibm.rave.core.util.Comparator) func the new default sort accessor to be used in place of the default
  23802. * @return (com.ibm.rave.core.layout.hierarchy.HierarchyBase) the current instance of HierarchyBase
  23803. */
  23804. sort$0 : function(func) {
  23805. this.sortFunction = func;
  23806. return this;
  23807. },
  23808. /**
  23809. * 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
  23810. * @return (com.ibm.rave.core.util.Comparator) the default sort accessor
  23811. */
  23812. sort$1 : function() {
  23813. return this.sortFunction;
  23814. },
  23815. /**
  23816. * If accessor is specified, sets the specified children accessor function
  23817. * @param (com.ibm.rave.core.layout.hierarchy.HierarchyBase.GetNodeChildren) func the children accessor function to be used in place of the default
  23818. * @return (com.ibm.rave.core.layout.hierarchy.HierarchyBase) the current instance of HierarchyBase
  23819. */
  23820. children$0 : function(func) {
  23821. this.childrenFunction = func;
  23822. return this;
  23823. },
  23824. /**
  23825. * 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
  23826. * @return (com.ibm.rave.core.layout.hierarchy.HierarchyBase.GetNodeChildren) the default children accessor function
  23827. */
  23828. children$1 : function() {
  23829. return this.childrenFunction;
  23830. },
  23831. /**
  23832. * If value is specified, sets the value accessor to the specified function
  23833. * @param (com.ibm.rave.core.layout.hierarchy.HierarchyBase.GetNodeValue) func the value accessor to be used in place of the default value accessor
  23834. * @return (com.ibm.rave.core.layout.hierarchy.HierarchyBase) the current instance of HierarchyBase
  23835. */
  23836. value$0 : function(func) {
  23837. this.nodeValueFunction = func;
  23838. return this;
  23839. },
  23840. /**
  23841. * 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.
  23842. * @return (com.ibm.rave.core.layout.hierarchy.HierarchyBase.GetNodeValue) the default value accessor function
  23843. */
  23844. value$1 : function() {
  23845. return this.nodeValueFunction;
  23846. },
  23847. /**
  23848. * 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
  23849. * @param (Array) nodes an array of nodes for which links should be provided
  23850. * @return (Array) an array of links from parent to children for each node
  23851. */
  23852. /** @expose */
  23853. links : function(nodes) {
  23854. return com_ibm_rave_core_layout_hierarchy_HierarchyUtil.links(nodes);
  23855. },
  23856. /** @expose */
  23857. sort : function(a0) {
  23858. var args = arguments;
  23859. if (args.length == 0) {
  23860. return this.sort$1();
  23861. }
  23862. return this.sort$0(a0);
  23863. },
  23864. /** @expose */
  23865. children : function(a0) {
  23866. var args = arguments;
  23867. if (args.length == 0) {
  23868. return this.children$1();
  23869. }
  23870. return this.children$0(a0);
  23871. },
  23872. /** @expose */
  23873. value : function(a0) {
  23874. var args = arguments;
  23875. if (args.length == 0) {
  23876. return this.value$1();
  23877. }
  23878. return this.value$0(a0);
  23879. }
  23880. });
  23881. // $source: com/ibm/rave/core/layout/AbstractPackLayout
  23882. /************************************************************************
  23883. ** IBM Confidential
  23884. **
  23885. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  23886. **
  23887. ** (C) Copyright IBM Corp. 2017
  23888. **
  23889. ** The source code for this program is not published or otherwise divested of its trade secrets,
  23890. ** irrespective of what has been deposited with the U.S. Copyright Office.
  23891. ************************************************************************/
  23892. // GENERATED
  23893. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  23894. //@import com/ibm/rave/core/layout/hierarchy/HierarchyBase (loadtime) // superclass
  23895. /**
  23896. * <p> AbstractPackLayout is a generalization for hierarchical layouts which pack circle shaped nodes into an area specified by size. The layout properties are: </p> <dl> <dt>size</dt> <dd>The dimensions of the area, as an array of [width,height]. The default is 1x1.</dd> <dt>padding</dt> <dd>The padding between circles. This is an arbitrary Object which subclasses will usually coerce to a double. The default is 0. </dd> <dt>radius</dt> <dd>The radius of the nodes. This may be null, a ValueFunction, or a constant Object. If it is null, the radius is determined automatically from the node value, scaled to fit the layout size. If it is a ValueFunction, the function is applied to each node to get the node's radius. If it is a constant Object, subclasses will usually coerce it to a double, giving a constant circle size. The default is null. </dd> </dl>
  23897. */
  23898. var com_ibm_rave_core_layout_AbstractPackLayout = rave_externs["AbstractPackLayout"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_layout_hierarchy_HierarchyBase, {
  23899. /**
  23900. * area extent value (width and height)
  23901. */
  23902. /** @expose */
  23903. sizeVal : null,
  23904. /**
  23905. * radius value
  23906. */
  23907. /** @expose */
  23908. radiusVal : null,
  23909. /**
  23910. * radius function value
  23911. */
  23912. /** @expose */
  23913. radiusFn : null,
  23914. /**
  23915. * padding value
  23916. */
  23917. /** @expose */
  23918. paddingVal : 0,
  23919. constructor : function() {
  23920. this.sizeVal = [1, 1];
  23921. },
  23922. /**
  23923. * Returns the current size, which defaults to 1×1
  23924. * @return (double[]) return the current size
  23925. */
  23926. size$0 : function() {
  23927. return this.sizeVal;
  23928. },
  23929. /**
  23930. * Sets the available layout size to the specified two-element array of numbers representing x and y.
  23931. * @param (double[]) newSize the size of the layout
  23932. * @return (com.ibm.rave.core.layout.AbstractPackLayout) this Layout
  23933. */
  23934. size$1 : function(newSize) {
  23935. this.sizeVal = newSize;
  23936. return this;
  23937. },
  23938. /**
  23939. * The current padding, which defaults to zero.
  23940. * @return (double) current padding
  23941. */
  23942. padding$0 : function() {
  23943. return this.paddingVal;
  23944. },
  23945. /**
  23946. * Sets the approximate padding between adjacent circles, in pixels.
  23947. * @param (Object) newVal padding value
  23948. * @return (com.ibm.rave.core.layout.AbstractPackLayout) this layout
  23949. */
  23950. padding$1 : function(newVal) {
  23951. this.paddingVal = + (newVal);
  23952. return this;
  23953. },
  23954. /**
  23955. * Get the current radius function or value, which defaults to null.
  23956. * @return (Object) radius, can be a vlaue or a function
  23957. */
  23958. radius$0 : function() {
  23959. if (!this.radiusFn) {
  23960. return this.radiusVal;
  23961. }
  23962. return this.radiusFn;
  23963. },
  23964. /**
  23965. * <p> Sets a value function for computing the radius of each node. If the argument is null, the radius is set to null and the default scaling is used. </p>
  23966. * @param (com.ibm.rave.core.functions.SingleValueFunction) newVal the new value function
  23967. * @return (com.ibm.rave.core.layout.AbstractPackLayout) this layout
  23968. */
  23969. radius$1 : function(newVal) {
  23970. this.radiusFn = newVal;
  23971. this.radiusVal = null;
  23972. return this;
  23973. },
  23974. /**
  23975. * </p> Sets the radius for the nodes. The a ValueFunction (in which case this is equivalent to calling {@link #this.radius(com_ibm_rave_core_functions_SingleValueFunction)} or an arbitrary Object which will be coerced to a double. If the argument is null, the radius is set to null and the default scaling is used. </p>
  23976. * @param (Object) newVal the new radius value or function
  23977. * @return (com.ibm.rave.core.layout.AbstractPackLayout) this layout
  23978. */
  23979. radius$2 : function(newVal) {
  23980. if (typeof newVal === "function") {
  23981. this.radiusFn = newVal;
  23982. this.radiusVal = null;
  23983. } else {
  23984. this.radiusFn = null;
  23985. this.radiusVal = newVal;
  23986. }
  23987. return this;
  23988. },
  23989. /** @expose */
  23990. size : function(a0) {
  23991. var args = arguments;
  23992. if (args.length == 0) {
  23993. return this.size$0();
  23994. }
  23995. return this.size$1(a0);
  23996. },
  23997. /** @expose */
  23998. padding : function(a0) {
  23999. var args = arguments;
  24000. if (args.length == 0) {
  24001. return this.padding$0();
  24002. }
  24003. return this.padding$1(a0);
  24004. },
  24005. /** @expose */
  24006. radius : function(a0) {
  24007. var args = arguments;
  24008. if (args.length == 0) {
  24009. return this.radius$0();
  24010. }
  24011. if (args.length == 1 && typeof a0 === "function") {
  24012. return this.radius$1(a0);
  24013. }
  24014. return this.radius$2(a0);
  24015. }
  24016. });
  24017. /**
  24018. * A default function for radius
  24019. */
  24020. com_ibm_rave_core_layout_AbstractPackLayout.ConstantSingleValueFunction = rave_externs["ConstantSingleValueFunction"] = com_ibm_rave_core_nativeImpl_Declare({
  24021. realdata : 0,
  24022. _$functionClassMethod : function() {
  24023. var _$self = function(data) {
  24024. return _$self.realdata;
  24025. };
  24026. return _$self;
  24027. },
  24028. /** @expose */
  24029. constructor : function(constantData) {
  24030. this.realdata = + (constantData);
  24031. }
  24032. });
  24033. // $source: com/ibm/rave/core/layout/hierarchy/HierarchyUtil
  24034. /************************************************************************
  24035. ** IBM Confidential
  24036. **
  24037. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  24038. **
  24039. ** (C) Copyright IBM Corp. 2017
  24040. **
  24041. ** The source code for this program is not published or otherwise divested of its trade secrets,
  24042. ** irrespective of what has been deposited with the U.S. Copyright Office.
  24043. ************************************************************************/
  24044. // GENERATED
  24045. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, declare anonymous
  24046. /**
  24047. * A utility to help with hierarchical data traversal
  24048. */
  24049. var com_ibm_rave_core_layout_hierarchy_HierarchyUtil = rave_externs["HierarchyUtil"] = {
  24050. };
  24051. /**
  24052. * This will use the default keys in order to retrieve children and value information from the root node provided ("value", "children").
  24053. * @param (Object) root the root node to process
  24054. * @return (Object) a HierarchyNode representing the JSONObject
  24055. */
  24056. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.fromJSON$0 = function(root, factory) {
  24057. return com_ibm_rave_core_layout_hierarchy_HierarchyUtil.fromJSON$1(root, "value", "children", factory);
  24058. };
  24059. /**
  24060. * the stack passed in only contains a single node - the root. this method will begin the process of breaking down the root node into Node objects which contain children, a parent and node depth
  24061. * @param (Object) root contains only the root node
  24062. * @param (String) valueKey the value key of the node
  24063. * @param (String) childrenKey the children key of the node
  24064. * @return (Object) the node in the correct format
  24065. */
  24066. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.fromJSON$1 = function(root, valueKey, childrenKey, factory) {
  24067. var node = factory();
  24068. node["data"] = root;
  24069. node["value"] = + (root[valueKey]);
  24070. var childrenObj = root[childrenKey];
  24071. if ((typeof childrenObj === "array" || childrenObj instanceof Array)) {
  24072. var children = childrenObj;
  24073. var childNodes = [];
  24074. for (var __i_enFor0 = 0, __exp_enFor0 = children, __len_enFor0 = __exp_enFor0.length;
  24075. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  24076. var child = __exp_enFor0[__i_enFor0];
  24077. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(child, Object)) {
  24078. childNodes.push(com_ibm_rave_core_layout_hierarchy_HierarchyUtil.fromJSON$1(child, valueKey, childrenKey, factory));
  24079. }
  24080. }
  24081. node["children"] = childNodes;
  24082. }
  24083. return node;
  24084. };
  24085. /**
  24086. * Re-evaluates the `value` property for the specified hierarchy.
  24087. * @param (Object) root the root node of type T
  24088. * @param (com.ibm.rave.core.layout.hierarchy.HierarchyBase) hierarchy hierarchical layout instance, which holds the value function
  24089. * @return (Object) the root node that was revalued
  24090. */
  24091. /** @expose */
  24092. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.revalue = function(root, hierarchy) {
  24093. if (hierarchy.value()) {
  24094. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitBefore(root, new (com_ibm_rave_core_nativeImpl_Declare({
  24095. visit : function(node) {
  24096. if (node["children"]) {
  24097. node["value"] = 0.0;
  24098. }
  24099. }
  24100. }))());
  24101. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitAfter(root, new (com_ibm_rave_core_nativeImpl_Declare({
  24102. visit : function(node) {
  24103. var parent;
  24104. if (!node["children"]) {
  24105. node["value"] = + (hierarchy.value().call(hierarchy, node, node["depth"]));
  24106. }
  24107. if ((parent = node["parent"])) {
  24108. parent["value"] += node["value"];
  24109. }
  24110. }
  24111. }))());
  24112. }
  24113. return root;
  24114. };
  24115. /**
  24116. * Pre-order traversal.
  24117. * @param (Object) node root of the hierarchy
  24118. * @param (com.ibm.rave.core.layout.hierarchy.HierarchyUtil.Visitor) callback a traversal handler function
  24119. */
  24120. /** @expose */
  24121. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitBefore = function(node, callback) {
  24122. var _node = node;
  24123. var nodes = [];
  24124. nodes.push(_node);
  24125. while ((_node = nodes.pop())) {
  24126. callback.visit(_node);
  24127. var children;
  24128. var n = 0;
  24129. if ((children = _node["children"]) && ((n = children.length) > 0)) {
  24130. while (--n >= 0) {
  24131. nodes.push(children[n]);
  24132. }
  24133. }
  24134. }
  24135. };
  24136. /**
  24137. * Post-order traversal.
  24138. * @param (Object) node root of the hierarchy
  24139. * @param (com.ibm.rave.core.layout.hierarchy.HierarchyUtil.Visitor) callback a traversal handler function
  24140. */
  24141. /** @expose */
  24142. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitAfter = function(node, callback) {
  24143. var _node = node;
  24144. var nodes = [];
  24145. var nodes2 = [];
  24146. nodes.push(_node);
  24147. while ((_node = nodes.pop())) {
  24148. nodes2.push(_node);
  24149. var children;
  24150. var n = 0;
  24151. if ((children = _node["children"]) && ((n = children.length) > 0)) {
  24152. var i = -1;
  24153. while (++i < n) {
  24154. nodes.push(children[i]);
  24155. }
  24156. }
  24157. }
  24158. while ((_node = nodes2.pop())) {
  24159. callback.visit(_node);
  24160. }
  24161. };
  24162. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.links = function(nodes) {
  24163. var num_children;
  24164. var node;
  24165. var links = [];
  24166. var link;
  24167. var num_nodes = nodes.length;
  24168. for (var z = 0; z < num_nodes; ++z) {
  24169. node = nodes[z];
  24170. if (node && node["children"]) {
  24171. num_children = node["children"].length;
  24172. while (--num_children >= 0) {
  24173. link = {};
  24174. link["source"] = node;
  24175. link["target"] = node["children"][num_children];
  24176. links.push(link);
  24177. }
  24178. }
  24179. }
  24180. return links;
  24181. };
  24182. /** @expose */
  24183. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.fromJSON = function(a0, a1, a2, a3) {
  24184. var args = arguments;
  24185. if (args.length == 2) {
  24186. return com_ibm_rave_core_layout_hierarchy_HierarchyUtil.fromJSON$0(a0, a1);
  24187. }
  24188. return com_ibm_rave_core_layout_hierarchy_HierarchyUtil.fromJSON$1(a0, a1, a2, a3);
  24189. };
  24190. /**
  24191. * Visitor which will help with traversal
  24192. * @param < (Object) T > hierarchy node type
  24193. */
  24194. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.Visitor = rave_externs["Visitor"] = com_ibm_rave_core_nativeImpl_Declare.implement(
  24195. //visit : function(node) {}
  24196. );
  24197. // $source: com/ibm/rave/core/layout/PackLayout
  24198. /************************************************************************
  24199. ** IBM Confidential
  24200. **
  24201. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  24202. **
  24203. ** (C) Copyright IBM Corp. 2017
  24204. **
  24205. ** The source code for this program is not published or otherwise divested of its trade secrets,
  24206. ** irrespective of what has been deposited with the U.S. Copyright Office.
  24207. ************************************************************************/
  24208. // GENERATED
  24209. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, declare anonymous
  24210. //@import com/ibm/rave/core/layout/AbstractPackLayout (loadtime) // new, superclass
  24211. //@import com/ibm/rave/core/layout/hierarchy/HierarchyBase (runtime)
  24212. //@import com/ibm/rave/core/layout/hierarchy/HierarchyUtil (static) // visitAfter
  24213. //@import com/ibm/rave/core/layout/XYMin_Max (runtime) // new
  24214. /**
  24215. * PackLayout
  24216. */
  24217. var com_ibm_rave_core_layout_PackLayout = rave_externs["PackLayout"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_layout_AbstractPackLayout, {
  24218. /**
  24219. * constructor
  24220. */
  24221. /** @expose */
  24222. constructor : function() {
  24223. this.sort(com_ibm_rave_core_layout_PackLayout.PACK_SORT_FN);
  24224. },
  24225. /**
  24226. * 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.
  24227. * @param (Object) d the root node
  24228. * @return (Array) Array of positioned nodes
  24229. */
  24230. create$0 : function(d) {
  24231. var nodes = com_ibm_rave_core_layout_hierarchy_HierarchyBase.prototype.create.call(this, d);
  24232. var root = nodes[0];
  24233. var w = this.sizeVal[0];
  24234. var h = this.sizeVal[1];
  24235. var localR;
  24236. if (!this.radiusFn && this.radiusVal == null) {
  24237. localR = com_ibm_rave_core_layout_PackLayout.SQRT_FN;
  24238. } else if (!this.radiusFn) {
  24239. localR = new com_ibm_rave_core_layout_AbstractPackLayout.ConstantSingleValueFunction(this.radiusVal);
  24240. } else {
  24241. localR = this.radiusFn;
  24242. }
  24243. root["x"] = root["y"] = 0;
  24244. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitAfter(root, new (com_ibm_rave_core_nativeImpl_Declare({
  24245. visit : function(node) {
  24246. node["r"] = + (localR(node["value"]));
  24247. }
  24248. }))());
  24249. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitAfter(root, com_ibm_rave_core_layout_PackLayout.layout_packSiblings);
  24250. if ((this.paddingVal)) {
  24251. var dr = this.paddingVal * (this.radiusFn || (this.radiusVal) ? 1 : Math.max(2 * root["r"] / w, 2 * root["r"] / h)) / 2;
  24252. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitAfter(root, new (com_ibm_rave_core_nativeImpl_Declare({
  24253. visit : function(node) {
  24254. node["r"] += dr;
  24255. }
  24256. }))());
  24257. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitAfter(root, com_ibm_rave_core_layout_PackLayout.layout_packSiblings);
  24258. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitAfter(root, new (com_ibm_rave_core_nativeImpl_Declare({
  24259. visit : function(node) {
  24260. node["r"] -= dr;
  24261. }
  24262. }))());
  24263. }
  24264. this.layout_packTransform(root, w / 2, h / 2, (this.radiusFn || (this.radiusVal)) ? 1 : 1 / Math.max(2 * root["r"] / w, 2 * root["r"] / h));
  24265. return nodes;
  24266. },
  24267. /** @expose */
  24268. layout_packTransform : function(node, x, y, k) {
  24269. var _x = x;
  24270. var _y = y;
  24271. var children = node["children"];
  24272. node["x"] = _x += k * node["x"];
  24273. node["y"] = _y += k * node["y"];
  24274. node["r"] *= k;
  24275. if (children) {
  24276. var i = -1, n = children.length;
  24277. while (++i < n) {
  24278. this.layout_packTransform(children[i], _x, _y, k);
  24279. }
  24280. }
  24281. },
  24282. /** @expose */
  24283. create : function(a0) {
  24284. var args = arguments;
  24285. return this.create$0(a0);
  24286. }
  24287. });
  24288. com_ibm_rave_core_layout_PackLayout.d3_layout_packInsert = function(a, b) {
  24289. var c = a["_pack_next"];
  24290. a["_pack_next"] = b;
  24291. b["_pack_prev"] = a;
  24292. b["_pack_next"] = c;
  24293. c["_pack_prev"] = b;
  24294. };
  24295. com_ibm_rave_core_layout_PackLayout.d3_layout_packSplice = function(a, b) {
  24296. a["_pack_next"] = b;
  24297. b["_pack_prev"] = a;
  24298. };
  24299. com_ibm_rave_core_layout_PackLayout.d3_layout_packIntersects = function(a, b) {
  24300. var dx = b["x"] - a["x"], dy = b["y"] - a["y"], dr = a["r"] + b["r"];
  24301. return .999 * dr * dr > dx * dx + dy * dy;
  24302. };
  24303. com_ibm_rave_core_layout_PackLayout.layout_packPlace = function(a, b, c) {
  24304. var db = a["r"] + c["r"], dx = b["x"] - a["x"], dy = b["y"] - a["y"];
  24305. if (db != 0 && (dx != 0 || dy != 0)) {
  24306. var da = b["r"] + c["r"], dc = dx * dx + dy * dy;
  24307. da *= da;
  24308. db *= db;
  24309. var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc);
  24310. c["x"] = a["x"] + x * dx + y * dy;
  24311. c["y"] = a["y"] + x * dy - y * dx;
  24312. } else {
  24313. c["x"] = a["x"] + db;
  24314. c["y"] = a["y"];
  24315. }
  24316. };
  24317. com_ibm_rave_core_layout_PackLayout.SQRT_FN = function(data) {
  24318. return Math.sqrt(+ (data));
  24319. };
  24320. com_ibm_rave_core_layout_PackLayout.PACK_SORT_FN = function(a, b) {
  24321. var val = (a["value"] - b["value"]);
  24322. return val == 0 ? 0 : val > 0 ? 1 : -1;
  24323. };
  24324. com_ibm_rave_core_layout_PackLayout.layout_packLink = function(node, index, array) {
  24325. node["_pack_next"] = node["_pack_prev"] = node;
  24326. return node;
  24327. };
  24328. com_ibm_rave_core_layout_PackLayout.layout_packUnlink = function(node, index, array) {
  24329. node["_pack_next"] = null;
  24330. node["_pack_prev"] = null;
  24331. return node;
  24332. };
  24333. com_ibm_rave_core_layout_PackLayout.layout_packSiblings = new (com_ibm_rave_core_nativeImpl_Declare({
  24334. visit : function(node) {
  24335. var nodes = node["children"];
  24336. if (!nodes || nodes.length == 0) {
  24337. return;
  24338. }
  24339. var n = nodes.length;
  24340. var minMax = new com_ibm_rave_core_layout_XYMin_Max();
  24341. var a, b, c, j, k = null;
  24342. nodes.forEach(com_ibm_rave_core_layout_PackLayout.layout_packLink);
  24343. a = nodes[0];
  24344. a["x"] = -a["r"];
  24345. a["y"] = 0;
  24346. minMax.bound(a);
  24347. if (n > 1) {
  24348. b = nodes[1];
  24349. b["x"] = b["r"];
  24350. b["y"] = 0;
  24351. minMax.bound(b);
  24352. if (n > 2) {
  24353. c = nodes[2];
  24354. com_ibm_rave_core_layout_PackLayout.layout_packPlace(a, b, c);
  24355. minMax.bound(c);
  24356. com_ibm_rave_core_layout_PackLayout.d3_layout_packInsert(a, c);
  24357. a["_pack_prev"] = c;
  24358. com_ibm_rave_core_layout_PackLayout.d3_layout_packInsert(c, b);
  24359. b = a["_pack_next"];
  24360. for (var i = 3; i < n; ++i) {
  24361. com_ibm_rave_core_layout_PackLayout.layout_packPlace(a, b, c = nodes[i]);
  24362. var isect = 0, s1 = 1, s2 = 1;
  24363. for (j = b["_pack_next"]; j != b; j = j["_pack_next"], s1++) {
  24364. if (com_ibm_rave_core_layout_PackLayout.d3_layout_packIntersects(j, c)) {
  24365. isect = 1;
  24366. break;
  24367. }
  24368. }
  24369. if (isect == 1) {
  24370. for (k = a["_pack_prev"]; k != j["_pack_prev"]; k = k["_pack_prev"], s2++) {
  24371. if (com_ibm_rave_core_layout_PackLayout.d3_layout_packIntersects(k, c)) {
  24372. break;
  24373. }
  24374. }
  24375. }
  24376. if ((isect)) {
  24377. if (s1 < s2 || (s1 == s2 && b["r"] < a["r"])) {
  24378. com_ibm_rave_core_layout_PackLayout.d3_layout_packSplice(a, b = j);
  24379. } else {
  24380. a = k;
  24381. com_ibm_rave_core_layout_PackLayout.d3_layout_packSplice(a, b);
  24382. }
  24383. i--;
  24384. } else {
  24385. com_ibm_rave_core_layout_PackLayout.d3_layout_packInsert(a, c);
  24386. b = c;
  24387. minMax.bound(c);
  24388. }
  24389. }
  24390. }
  24391. }
  24392. var cx = (minMax.xMin + minMax.xMax) / 2, cy = (minMax.yMin + minMax.yMax) / 2, cr = 0;
  24393. for (var i = 0; i < n; ++i) {
  24394. c = nodes[i];
  24395. c["x"] -= cx;
  24396. c["y"] -= cy;
  24397. cr = Math.max(cr, c["r"] + Math.sqrt(c["x"] * c["x"] + c["y"] * c["y"]));
  24398. }
  24399. node["r"] = cr;
  24400. nodes.forEach(com_ibm_rave_core_layout_PackLayout.layout_packUnlink);
  24401. }
  24402. }))();
  24403. // $source: com/ibm/rave/core/layout/XYMin_Max
  24404. /************************************************************************
  24405. ** IBM Confidential
  24406. **
  24407. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  24408. **
  24409. ** (C) Copyright IBM Corp. 2017
  24410. **
  24411. ** The source code for this program is not published or otherwise divested of its trade secrets,
  24412. ** irrespective of what has been deposited with the U.S. Copyright Office.
  24413. ************************************************************************/
  24414. // GENERATED
  24415. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  24416. /**
  24417. * A utility class used to grope for extent bounds
  24418. */
  24419. var com_ibm_rave_core_layout_XYMin_Max = rave_externs["XYMin_Max"] = com_ibm_rave_core_nativeImpl_Declare({
  24420. /**
  24421. * minimal x value
  24422. */
  24423. /** @expose */
  24424. xMin : 1.7976931348623157E308,
  24425. /**
  24426. * maximum x value
  24427. */
  24428. /** @expose */
  24429. xMax : 4.9E-324,
  24430. /**
  24431. * minimal y value
  24432. */
  24433. /** @expose */
  24434. yMin : 1.7976931348623157E308,
  24435. /**
  24436. * maximum y value
  24437. */
  24438. /** @expose */
  24439. yMax : 4.9E-324,
  24440. /**
  24441. * Adjust bounding area rectangle - extend bounds, if node falls outside of the current bounds values
  24442. * @param (Object) node a node with x, y coordinates and a radius set.
  24443. */
  24444. /** @expose */
  24445. bound : function(node) {
  24446. this.xMin = Math.min(node["x"] - node["r"], this.xMin);
  24447. this.xMax = Math.max(node["x"] + node["r"], this.xMax);
  24448. this.yMin = Math.min(node["y"] - node["r"], this.yMin);
  24449. this.yMax = Math.max(node["y"] + node["r"], this.yMax);
  24450. }
  24451. });
  24452. // $source: com/ibm/rave/core/layout/chord/ChordLayout
  24453. /************************************************************************
  24454. ** IBM Confidential
  24455. **
  24456. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  24457. **
  24458. ** (C) Copyright IBM Corp. 2017
  24459. **
  24460. ** The source code for this program is not published or otherwise divested of its trade secrets,
  24461. ** irrespective of what has been deposited with the U.S. Copyright Office.
  24462. ************************************************************************/
  24463. // GENERATED
  24464. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  24465. //@import com/ibm/rave/core/Rave (runtime) // range
  24466. //@import com/ibm/rave/core/layout/chord/SubGroupData (runtime) // new
  24467. //@import com/ibm/rave/core/layout/chord/GroupData (runtime) // new
  24468. //@import com/ibm/rave/core/layout/chord/MatrixDataStruct (runtime) // new
  24469. //@import com/ibm/rave/core/layout/chord/ChordData (runtime) // new
  24470. /**
  24471. * Standard Chord layout. The results from this class can be used with the Chord SVG path generator to create a chord chart.
  24472. */
  24473. var com_ibm_rave_core_layout_chord_ChordLayout = rave_externs["ChordLayout"] = com_ibm_rave_core_nativeImpl_Declare({
  24474. //_chords : null,
  24475. //_groups : null,
  24476. //_matrix : null,
  24477. //valueAccessor : null,
  24478. //_sortGroups : null,
  24479. //_sortSubgroups : null,
  24480. //_sortChords : null,
  24481. /**
  24482. * Retrieve the computed group angles.
  24483. */
  24484. /** @expose */
  24485. groups : null,
  24486. /**
  24487. * Retrieve the computed chord angles
  24488. */
  24489. /** @expose */
  24490. chords : null,
  24491. n : 0,
  24492. _padding : 0,
  24493. constructor : function() {
  24494. this.valueAccessor = com_ibm_rave_core_layout_chord_ChordLayout.DEFAULT_ACCESSOR_FN;
  24495. {
  24496. var self = this;
  24497. this.groups = function() {
  24498. if (!self._groups) {
  24499. self.relayout();
  24500. }
  24501. return self._groups;
  24502. };
  24503. this.chords = function() {
  24504. if (!self._chords) {
  24505. self.relayout();
  24506. }
  24507. return self._chords;
  24508. };
  24509. }
  24510. },
  24511. relayout : function() {
  24512. var subgroups = {};
  24513. var groupSums = [];
  24514. var groupIndex = com_ibm_rave_core_Rave.range(this.n);
  24515. var subgroupIndex = [];
  24516. var k, x, x0;
  24517. var i, j;
  24518. this._chords = [];
  24519. this._groups = [];
  24520. k = 0;
  24521. i = -1;
  24522. while (++i < this.n) {
  24523. x = 0;
  24524. j = -1;
  24525. while (++j < this.n) {
  24526. x += this.valueAccessor(this._matrix[i][j]);
  24527. }
  24528. groupSums[i] = x;
  24529. subgroupIndex[i] = com_ibm_rave_core_Rave.range(this.n);
  24530. k += x;
  24531. }
  24532. if (this._sortGroups) {
  24533. groupIndex.sort(new com_ibm_rave_core_layout_chord_ChordLayout.GroupAndSubGroupComparator(this, groupSums, false, this.valueAccessor));
  24534. }
  24535. if (this._sortSubgroups) {
  24536. for (var index = 0; index < subgroupIndex.length; ++index) {
  24537. var aToSOrt = subgroupIndex[index];
  24538. aToSOrt.sort(new com_ibm_rave_core_layout_chord_ChordLayout.GroupAndSubGroupComparator(this, this._matrix[index], true, this.valueAccessor));
  24539. }
  24540. }
  24541. k = (6.283185307179586 - this._padding * this.n) / k;
  24542. x = 0;
  24543. i = -1;
  24544. while (++i < this.n) {
  24545. x0 = x;
  24546. j = -1;
  24547. var di = 0;
  24548. while (++j < this.n) {
  24549. di = ~~ (groupIndex[i]);
  24550. var dj = ~~ (subgroupIndex[di][j]);
  24551. var numericV = this.valueAccessor(this._matrix[di][dj]), a0 = x, a1 = x += numericV * k;
  24552. subgroups[di + "-" + dj] = new com_ibm_rave_core_layout_chord_SubGroupData(di, dj, a0, a1, numericV, this._matrix[di][dj]);
  24553. }
  24554. this._groups[di] = new com_ibm_rave_core_layout_chord_GroupData(di, x0, x, (x - x0) / k, com_ibm_rave_core_nativeImpl_Object.isInstanceOf(this._matrix[di][0], com_ibm_rave_core_layout_chord_MatrixDataStruct) ? (this._matrix[di][0]).sourceGroupInfo : null);
  24555. x += this._padding;
  24556. }
  24557. i = -1;
  24558. while (++i < this.n) {
  24559. j = i - 1;
  24560. while (++j < this.n) {
  24561. var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i];
  24562. if (source.value != 0 || target.value != 0) {
  24563. var cd = new com_ibm_rave_core_layout_chord_ChordData();
  24564. if (source.value < target.value) {
  24565. cd.source = target;
  24566. cd.target = source;
  24567. } else {
  24568. cd.source = source;
  24569. cd.target = target;
  24570. }
  24571. cd.originalData = com_ibm_rave_core_nativeImpl_Object.isInstanceOf(this._matrix[i][j], com_ibm_rave_core_layout_chord_MatrixDataStruct) ? (this._matrix[i][j]).originalData : null;
  24572. this._chords.push(cd);
  24573. }
  24574. }
  24575. }
  24576. if (this._sortChords) {
  24577. this.resort();
  24578. }
  24579. },
  24580. /**
  24581. * Re-Runs the chrod sort function
  24582. */
  24583. /** @expose */
  24584. resort : function() {
  24585. this._chords.sort(new com_ibm_rave_core_layout_chord_ChordLayout.ChordsComparator(this._sortChords));
  24586. },
  24587. /**
  24588. * Set the matrix data backing the layout.
  24589. * @param (Array) x the data
  24590. * @return (com.ibm.rave.core.layout.chord.ChordLayout) this chord layout
  24591. */
  24592. matrix$0 : function(x) {
  24593. this._matrix = x;
  24594. this.n = x.length;
  24595. this._chords = null;
  24596. this._groups = null;
  24597. return this;
  24598. },
  24599. /**
  24600. * Gets the matrix data backing the layout.
  24601. * @return (Array) the data
  24602. */
  24603. matrix$1 : function() {
  24604. return this._matrix;
  24605. },
  24606. /**
  24607. * Accessor to get get the current value function
  24608. * @return (com.ibm.rave.core.functions.SingleValueFunction) the current value function
  24609. */
  24610. value$0 : function() {
  24611. return this.valueAccessor;
  24612. },
  24613. /**
  24614. * Sets the current value function, this is the function that will be called to get the value of each cell
  24615. * @param (com.ibm.rave.core.functions.SingleValueFunction) valueFn the function
  24616. * @return (com.ibm.rave.core.layout.chord.ChordLayout) this chord layout
  24617. */
  24618. value$1 : function(valueFn) {
  24619. this.valueAccessor = valueFn;
  24620. return this;
  24621. },
  24622. /**
  24623. * Set the angular padding between chord segments.
  24624. * @param (double) x the new padding value
  24625. * @return (com.ibm.rave.core.layout.chord.ChordLayout) this layout
  24626. */
  24627. padding$0 : function(x) {
  24628. this._padding = x;
  24629. this._chords = null;
  24630. this._groups = null;
  24631. return this;
  24632. },
  24633. /**
  24634. * Get the angular padding between chord segments.
  24635. * @return (double) the padding
  24636. */
  24637. padding$1 : function() {
  24638. return this._padding;
  24639. },
  24640. /**
  24641. * Get the comparator function for groups.
  24642. * @return (com.ibm.rave.core.util.Comparator) the comparator function
  24643. */
  24644. sortGroups$0 : function() {
  24645. return this._sortGroups;
  24646. },
  24647. /**
  24648. * Sets the comparator function for groups.
  24649. * @param (com.ibm.rave.core.util.Comparator) sortGroupFn the new comparator
  24650. * @return (com.ibm.rave.core.layout.chord.ChordLayout) this layout
  24651. */
  24652. sortGroups$1 : function(sortGroupFn) {
  24653. this._sortGroups = sortGroupFn;
  24654. this._chords = null;
  24655. this._groups = null;
  24656. return this;
  24657. },
  24658. /**
  24659. * Get the comparator function for subgroups.
  24660. * @return (com.ibm.rave.core.util.Comparator) the comparator function
  24661. */
  24662. sortSubgroups$0 : function() {
  24663. return this._sortSubgroups;
  24664. },
  24665. /**
  24666. * Sets the comparator function for subgroups.
  24667. * @param (com.ibm.rave.core.util.Comparator) sortSubGroupFn the new comparator
  24668. * @return (com.ibm.rave.core.layout.chord.ChordLayout) this layout
  24669. */
  24670. sortSubgroups$1 : function(sortSubGroupFn) {
  24671. this._sortSubgroups = sortSubGroupFn;
  24672. this._chords = null;
  24673. return this;
  24674. },
  24675. /**
  24676. * Get the comparator function for chords (z-order).
  24677. * @return (com.ibm.rave.core.util.Comparator) chords comparator
  24678. */
  24679. sortChords$0 : function() {
  24680. return this._sortChords;
  24681. },
  24682. /**
  24683. * Set the comparator function for chords (z-order).
  24684. * @param (com.ibm.rave.core.util.Comparator) sortChordsFn the new comparator functions
  24685. * @return (com.ibm.rave.core.layout.chord.ChordLayout) this layout
  24686. */
  24687. sortChords$1 : function(sortChordsFn) {
  24688. this._sortChords = sortChordsFn;
  24689. if (this._chords) {
  24690. this.resort();
  24691. }
  24692. return this;
  24693. },
  24694. /** @expose */
  24695. matrix : function(a0) {
  24696. var args = arguments;
  24697. if (args.length == 0) {
  24698. return this.matrix$1();
  24699. }
  24700. return this.matrix$0(a0);
  24701. },
  24702. /** @expose */
  24703. value : function(a0) {
  24704. var args = arguments;
  24705. if (args.length == 0) {
  24706. return this.value$0();
  24707. }
  24708. return this.value$1(a0);
  24709. },
  24710. /** @expose */
  24711. padding : function(a0) {
  24712. var args = arguments;
  24713. if (args.length == 0) {
  24714. return this.padding$1();
  24715. }
  24716. return this.padding$0(a0);
  24717. },
  24718. /** @expose */
  24719. sortGroups : function(a0) {
  24720. var args = arguments;
  24721. if (args.length == 0) {
  24722. return this.sortGroups$0();
  24723. }
  24724. return this.sortGroups$1(a0);
  24725. },
  24726. /** @expose */
  24727. sortSubgroups : function(a0) {
  24728. var args = arguments;
  24729. if (args.length == 0) {
  24730. return this.sortSubgroups$0();
  24731. }
  24732. return this.sortSubgroups$1(a0);
  24733. },
  24734. /** @expose */
  24735. sortChords : function(a0) {
  24736. var args = arguments;
  24737. if (args.length == 0) {
  24738. return this.sortChords$0();
  24739. }
  24740. return this.sortChords$1(a0);
  24741. }
  24742. });
  24743. com_ibm_rave_core_layout_chord_ChordLayout.GroupAndSubGroupComparator = com_ibm_rave_core_nativeImpl_Declare({
  24744. //dataToSort : null,
  24745. //chord : null,
  24746. //valGetFn : null,
  24747. subGroup : false,
  24748. _$functionClassMethod : function() {
  24749. var _$self = function(o1, o2) {
  24750. if (!_$self.subGroup) {
  24751. return _$self.chord._sortGroups(_$self.dataToSort[o1], _$self.dataToSort[o2]);
  24752. }
  24753. return _$self.chord._sortSubgroups(_$self.valGetFn(_$self.dataToSort[o1]), _$self.valGetFn(_$self.dataToSort[o2]));
  24754. };
  24755. return _$self;
  24756. },
  24757. /** @expose */
  24758. constructor : function(_chord, _dataToSort, _subGroups, theValGetFn) {
  24759. this.dataToSort = _dataToSort;
  24760. this.chord = _chord;
  24761. this.subGroup = _subGroups;
  24762. this.valGetFn = theValGetFn;
  24763. }
  24764. });
  24765. com_ibm_rave_core_layout_chord_ChordLayout.ChordsComparator = com_ibm_rave_core_nativeImpl_Declare({
  24766. //sortGroups : null,
  24767. _$functionClassMethod : function() {
  24768. var _$self = function(a, b) {
  24769. return _$self.sortGroups((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2);
  24770. };
  24771. return _$self;
  24772. },
  24773. /** @expose */
  24774. constructor : function(_sortGroups) {
  24775. this.sortGroups = _sortGroups;
  24776. }
  24777. });
  24778. com_ibm_rave_core_layout_chord_ChordLayout.DEFAULT_ACCESSOR_FN = function(data) {
  24779. return + (data);
  24780. };
  24781. // $source: com/ibm/rave/core/svg/ArcData
  24782. /************************************************************************
  24783. ** IBM Confidential
  24784. **
  24785. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  24786. **
  24787. ** (C) Copyright IBM Corp. 2017
  24788. **
  24789. ** The source code for this program is not published or otherwise divested of its trade secrets,
  24790. ** irrespective of what has been deposited with the U.S. Copyright Office.
  24791. ************************************************************************/
  24792. // GENERATED
  24793. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  24794. /**
  24795. * Default data structure for arc data, arc data is used by the ARC path generator to build an SVG path from arc information
  24796. */
  24797. var com_ibm_rave_core_svg_ArcData = rave_externs["ArcData"] = com_ibm_rave_core_nativeImpl_Declare({
  24798. /** @expose */
  24799. innerRadius : 0,
  24800. /** @expose */
  24801. outerRadius : 0,
  24802. /** @expose */
  24803. startAngle : 0,
  24804. /** @expose */
  24805. endAngle : 0,
  24806. /** @expose */
  24807. padAngle : 0
  24808. });
  24809. // $source: com/ibm/rave/core/layout/chord/SubGroupData
  24810. /************************************************************************
  24811. ** IBM Confidential
  24812. **
  24813. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  24814. **
  24815. ** (C) Copyright IBM Corp. 2017
  24816. **
  24817. ** The source code for this program is not published or otherwise divested of its trade secrets,
  24818. ** irrespective of what has been deposited with the U.S. Copyright Office.
  24819. ************************************************************************/
  24820. // GENERATED
  24821. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  24822. //@import com/ibm/rave/core/svg/ArcData (loadtime) // superclass
  24823. var com_ibm_rave_core_layout_chord_SubGroupData = rave_externs["SubGroupData"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_svg_ArcData, {
  24824. /** @expose */
  24825. datum : null,
  24826. /** @expose */
  24827. index : 0,
  24828. /** @expose */
  24829. subindex : 0,
  24830. /** @expose */
  24831. radius : 0,
  24832. /** @expose */
  24833. value : 0,
  24834. /** @expose */
  24835. constructor : function(index, subindex, startAngle, endAngle, value, datum) {
  24836. this.index = index;
  24837. this.subindex = subindex;
  24838. this.startAngle = startAngle;
  24839. this.endAngle = endAngle;
  24840. this.datum = datum;
  24841. this.value = value;
  24842. }
  24843. });
  24844. // $source: com/ibm/rave/core/layout/chord/GroupData
  24845. /************************************************************************
  24846. ** IBM Confidential
  24847. **
  24848. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  24849. **
  24850. ** (C) Copyright IBM Corp. 2017
  24851. **
  24852. ** The source code for this program is not published or otherwise divested of its trade secrets,
  24853. ** irrespective of what has been deposited with the U.S. Copyright Office.
  24854. ************************************************************************/
  24855. // GENERATED
  24856. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  24857. //@import com/ibm/rave/core/svg/ArcData (loadtime) // superclass
  24858. var com_ibm_rave_core_layout_chord_GroupData = rave_externs["GroupData"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_svg_ArcData, {
  24859. /** @expose */
  24860. datum : null,
  24861. /** @expose */
  24862. index : 0,
  24863. /** @expose */
  24864. value : 0,
  24865. /** @expose */
  24866. constructor : function(index, startAngle, endAngle, value, datum) {
  24867. this.index = index;
  24868. this.startAngle = startAngle;
  24869. this.endAngle = endAngle;
  24870. this.value = value;
  24871. this.datum = datum;
  24872. }
  24873. });
  24874. // $source: com/ibm/rave/core/layout/chord/MatrixDataStruct
  24875. /************************************************************************
  24876. ** IBM Confidential
  24877. **
  24878. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  24879. **
  24880. ** (C) Copyright IBM Corp. 2017
  24881. **
  24882. ** The source code for this program is not published or otherwise divested of its trade secrets,
  24883. ** irrespective of what has been deposited with the U.S. Copyright Office.
  24884. ************************************************************************/
  24885. // GENERATED
  24886. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  24887. //@import com/ibm/rave/core/layout/chord/GroupDataStruct (runtime) // new
  24888. var com_ibm_rave_core_layout_chord_MatrixDataStruct = rave_externs["MatrixDataStruct"] = com_ibm_rave_core_nativeImpl_Declare({
  24889. /** @expose */
  24890. sourceID : null,
  24891. /** @expose */
  24892. sourceGroupInfo : null,
  24893. /** @expose */
  24894. targetID : null,
  24895. /** @expose */
  24896. targetGroupInfo : null,
  24897. /** @expose */
  24898. value : null,
  24899. /** @expose */
  24900. color : null,
  24901. /** @expose */
  24902. originalData : null,
  24903. /** @expose */
  24904. constructor : function() {
  24905. this.sourceGroupInfo = new com_ibm_rave_core_layout_chord_GroupDataStruct();
  24906. this.targetGroupInfo = new com_ibm_rave_core_layout_chord_GroupDataStruct();
  24907. }
  24908. });
  24909. // $source: com/ibm/rave/core/layout/chord/GroupDataStruct
  24910. /************************************************************************
  24911. ** IBM Confidential
  24912. **
  24913. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  24914. **
  24915. ** (C) Copyright IBM Corp. 2017
  24916. **
  24917. ** The source code for this program is not published or otherwise divested of its trade secrets,
  24918. ** irrespective of what has been deposited with the U.S. Copyright Office.
  24919. ************************************************************************/
  24920. // GENERATED
  24921. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  24922. var com_ibm_rave_core_layout_chord_GroupDataStruct = rave_externs["GroupDataStruct"] = com_ibm_rave_core_nativeImpl_Declare({
  24923. /** @expose */
  24924. label : null,
  24925. /** @expose */
  24926. color : null,
  24927. /** @expose */
  24928. groupOriginalData : null
  24929. });
  24930. // $source: com/ibm/rave/core/layout/chord/ChordData
  24931. /************************************************************************
  24932. ** IBM Confidential
  24933. **
  24934. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  24935. **
  24936. ** (C) Copyright IBM Corp. 2017
  24937. **
  24938. ** The source code for this program is not published or otherwise divested of its trade secrets,
  24939. ** irrespective of what has been deposited with the U.S. Copyright Office.
  24940. ************************************************************************/
  24941. // GENERATED
  24942. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  24943. //@import com/ibm/rave/core/svg/ArcData (loadtime) // superclass
  24944. var com_ibm_rave_core_layout_chord_ChordData = rave_externs["ChordData"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_svg_ArcData, {
  24945. /** @expose */
  24946. source : null,
  24947. /** @expose */
  24948. target : null,
  24949. /** @expose */
  24950. originalData : null
  24951. });
  24952. // $source: com/ibm/rave/core/layout/cluster/Cluster
  24953. /************************************************************************
  24954. ** IBM Confidential
  24955. **
  24956. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  24957. **
  24958. ** (C) Copyright IBM Corp. 2017
  24959. **
  24960. ** The source code for this program is not published or otherwise divested of its trade secrets,
  24961. ** irrespective of what has been deposited with the U.S. Copyright Office.
  24962. ************************************************************************/
  24963. // GENERATED
  24964. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, declare anonymous
  24965. //@import com/ibm/rave/core/layout/hierarchy/HierarchyBase (loadtime) // superclass
  24966. //@import com/ibm/rave/core/layout/tree/Tree (runtime) // treeSeparation
  24967. //@import com/ibm/rave/core/layout/hierarchy/HierarchyUtil (runtime) // visitAfter
  24968. //@import com/ibm/rave/core/Rave (runtime) // max
  24969. var com_ibm_rave_core_layout_cluster_Cluster = rave_externs["Cluster"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_layout_hierarchy_HierarchyBase, {
  24970. /**
  24971. * default separation method to be called
  24972. */
  24973. //defaultSeparationFunction : null,
  24974. //separationFunction : null,
  24975. //_size : null,
  24976. /**
  24977. * 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.
  24978. * @param ArrayList <Node> children children of a node
  24979. * @return y value of a child
  24980. */
  24981. //getChildY : null,
  24982. _nodeSize : false,
  24983. constructor : function() {
  24984. this.defaultSeparationFunction = function(a, b) {
  24985. return com_ibm_rave_core_layout_tree_Tree.treeSeparation(a, b);
  24986. };
  24987. this.separationFunction = this.defaultSeparationFunction;
  24988. this._size = [1.0, 1.0];
  24989. this.getChildY = function(child, index, groupIndex) {
  24990. return (child)["y"];
  24991. };
  24992. /**
  24993. * Implements a hierarchical layout using the cluster (or dendrogram) algorithm.
  24994. */
  24995. {
  24996. this.sort(null);
  24997. this.value(null);
  24998. }
  24999. },
  25000. /**
  25001. * helps creates a cluster diagram by setting location attributes
  25002. * @param (Object) d the cluster nodes
  25003. * @return (Array) list of all the cluster nodes
  25004. */
  25005. create$0 : function(d) {
  25006. var nodes = com_ibm_rave_core_layout_hierarchy_HierarchyBase.prototype.create.call(this, d);
  25007. var root = nodes[0], previousNode;
  25008. var x = 0;
  25009. var self = this;
  25010. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitAfter(root, new (com_ibm_rave_core_nativeImpl_Declare({
  25011. visit : function(node) {
  25012. var children = node["children"];
  25013. if (children && children.length > 0) {
  25014. node["x"] = self.clusterX(children);
  25015. node["y"] = self.clusterY(children);
  25016. } else {
  25017. if (previousNode) {
  25018. x = x + self.separationFunction(node, previousNode);
  25019. node["x"] = x;
  25020. } else {
  25021. node["x"] = 0;
  25022. }
  25023. node["y"] = 0;
  25024. previousNode = node;
  25025. }
  25026. }
  25027. }))());
  25028. var left = this.clusterLeft(root);
  25029. var right = this.clusterRight(root);
  25030. var x0 = left["x"] - this.separationFunction(left, right) / 2.0;
  25031. var x1 = right["x"] + this.separationFunction(right, left) / 2.0;
  25032. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitAfter(root, new (com_ibm_rave_core_nativeImpl_Declare({
  25033. visit : function(node) {
  25034. if (self._nodeSize) {
  25035. node["x"] = (node["x"] - root["x"]) * self._size[0];
  25036. node["y"] = (root["y"] - node["y"]) * self._size[1];
  25037. } else {
  25038. node["x"] = (node["x"] - x0) / (x1 - x0) * self._size[0];
  25039. node["y"] = (1 - (root["y"] > 0 ? node["y"] / root["y"] : 1)) * self._size[1];
  25040. }
  25041. }
  25042. }))());
  25043. return nodes;
  25044. },
  25045. /**
  25046. * reduce children by using the Rave.max method in order to calculate the children's y value
  25047. * @param (Array) children children of a node
  25048. * @return (double) children's y value
  25049. */
  25050. clusterY : function(children) {
  25051. return 1.0 + ((com_ibm_rave_core_Rave.max(children, this.getChildY)));
  25052. },
  25053. /**
  25054. * gets the reduced value and divides it by the number of children in order to get the children's x value
  25055. * @param (Array) children children of a node
  25056. * @return (double) children's x value
  25057. */
  25058. clusterX : function(children) {
  25059. var reduction = 0.0;
  25060. reduction = this.reduce(children);
  25061. return reduction / children.length;
  25062. },
  25063. /**
  25064. * gets the reduced value
  25065. * @param (Array) children children of a node
  25066. * @return (double) children's reduction value
  25067. */
  25068. reduce : function(children) {
  25069. var reduction = 0.0;
  25070. var previousReduction = 0.0;
  25071. for (var __i_enFor0 = 0, __exp_enFor0 = children, __len_enFor0 = __exp_enFor0.length;
  25072. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  25073. var node = __exp_enFor0[__i_enFor0];
  25074. reduction = (previousReduction + node["x"]);
  25075. previousReduction = reduction;
  25076. }
  25077. return reduction;
  25078. },
  25079. /**
  25080. * Compute the left-most node for extents
  25081. * @param (Object) node node to compute left-most node for extents
  25082. * @return (Object) left-most node
  25083. */
  25084. clusterRight : function(node) {
  25085. var children = node["children"];
  25086. return children && children.length > 0 ? this.clusterRight(children[children.length - 1]) : node;
  25087. },
  25088. /**
  25089. * compute the right-most node for extents
  25090. * @param (Object) node node node to compute right-most node for extents
  25091. * @return (Object) right-most node
  25092. */
  25093. clusterLeft : function(node) {
  25094. var children = node["children"];
  25095. return children && children.length > 0 ? this.clusterLeft(children[0]) : node;
  25096. },
  25097. /**
  25098. * sets the treeSeparation method to the new method being passed in
  25099. * @param (com.ibm.rave.core.layout.tree.Tree.GetSeparation) func the new method to be involved when calling treeSeparation
  25100. * @return (com.ibm.rave.core.layout.cluster.Cluster) cluster instance
  25101. */
  25102. separation$0 : function(func) {
  25103. this.separationFunction = func;
  25104. return this;
  25105. },
  25106. /**
  25107. * gets the treeSeparation method
  25108. * @return (com.ibm.rave.core.layout.tree.Tree.GetSeparation) treeSeparation method
  25109. */
  25110. separation$1 : function() {
  25111. return this.separationFunction;
  25112. },
  25113. size$0 : function() {
  25114. return this._nodeSize ? null : this._size;
  25115. },
  25116. /**
  25117. * sets the size of the layout
  25118. * @param (double[]) sizes the desired height and width of the layout
  25119. * @return (com.ibm.rave.core.layout.cluster.Cluster) this the cluster object
  25120. */
  25121. size$1 : function(sizes) {
  25122. this._nodeSize = (!(this._size = sizes));
  25123. return this;
  25124. },
  25125. /**
  25126. * sets the node size
  25127. * @param (double[]) nodeSize the desired node size
  25128. * @return (com.ibm.rave.core.layout.cluster.Cluster) this the cluster object
  25129. */
  25130. nodeSize$0 : function(nodeSize) {
  25131. this._nodeSize = (this._size = nodeSize);
  25132. return this;
  25133. },
  25134. /**
  25135. * gets the node size
  25136. * @return (double[]) nodeSize
  25137. */
  25138. nodeSize$1 : function() {
  25139. return this._nodeSize ? this._size : null;
  25140. },
  25141. /** @expose */
  25142. create : function(a0) {
  25143. var args = arguments;
  25144. return this.create$0(a0);
  25145. },
  25146. /** @expose */
  25147. separation : function(a0) {
  25148. var args = arguments;
  25149. if (args.length == 0) {
  25150. return this.separation$1();
  25151. }
  25152. return this.separation$0(a0);
  25153. },
  25154. /** @expose */
  25155. size : function(a0) {
  25156. var args = arguments;
  25157. if (args.length == 0) {
  25158. return this.size$0();
  25159. }
  25160. return this.size$1(a0);
  25161. },
  25162. /** @expose */
  25163. nodeSize : function(a0) {
  25164. var args = arguments;
  25165. if (args.length == 0) {
  25166. return this.nodeSize$1();
  25167. }
  25168. return this.nodeSize$0(a0);
  25169. }
  25170. });
  25171. // $source: com/ibm/rave/core/layout/tree/Tree
  25172. /************************************************************************
  25173. ** IBM Confidential
  25174. **
  25175. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  25176. **
  25177. ** (C) Copyright IBM Corp. 2017
  25178. **
  25179. ** The source code for this program is not published or otherwise divested of its trade secrets,
  25180. ** irrespective of what has been deposited with the U.S. Copyright Office.
  25181. ************************************************************************/
  25182. // GENERATED
  25183. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, declare anonymous
  25184. //@import com/ibm/rave/core/layout/hierarchy/HierarchyBase (loadtime) // superclass
  25185. //@import com/ibm/rave/core/layout/hierarchy/HierarchyUtil (runtime) // visitAfter, visitBefore
  25186. /**
  25187. * The tree layout produces tidy node-link diagrams of trees using the Reingold–Tilford “tidy” algorithm.
  25188. */
  25189. var com_ibm_rave_core_layout_tree_Tree = rave_externs["Tree"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_layout_hierarchy_HierarchyBase, {
  25190. /**
  25191. * default separation method to be called
  25192. */
  25193. //defaultSeparationFunction : null,
  25194. //sizeNode : null,
  25195. //firstWalk : null,
  25196. //secondWalk : null,
  25197. //_size : null,
  25198. //separationFunction : null,
  25199. _nodeSize : false,
  25200. constructor : function() {
  25201. this.defaultSeparationFunction = function(a, b) {
  25202. return com_ibm_rave_core_layout_tree_Tree.treeSeparation(a, b);
  25203. };
  25204. this._size = [1.0, 1.0];
  25205. this.separationFunction = this.defaultSeparationFunction;
  25206. /**
  25207. * c'tor
  25208. */
  25209. {
  25210. var self = this;
  25211. this.sizeNode = new (com_ibm_rave_core_nativeImpl_Declare({
  25212. visit : function(node) {
  25213. node["x"] *= self._size[0];
  25214. node["y"] = node["depth"] * self._size[1];
  25215. }
  25216. }))();
  25217. this.firstWalk = new (com_ibm_rave_core_nativeImpl_Declare({
  25218. visit : function(v) {
  25219. var children = v["children"];
  25220. var siblings = v["parent"]["children"];
  25221. var w = v["i"] != 0 ? siblings[v["i"] - 1] : null;
  25222. if (children.length > 0) {
  25223. self.treeShift(v);
  25224. var midpoint = (children[0]["z"] + children[children.length - 1]["z"]) / 2;
  25225. if (w) {
  25226. v["z"] = w["z"] + self.separationFunction(v["wrappedNode"], w["wrappedNode"]);
  25227. v["m"] = v["z"] - midpoint;
  25228. } else {
  25229. v["z"] = midpoint;
  25230. }
  25231. } else if (w) {
  25232. v["z"] = w["z"] + self.separationFunction(v["wrappedNode"], w["wrappedNode"]);
  25233. }
  25234. v["parent"]["A"] = self.apportion(v, w, (v["parent"]["A"]) ? v["parent"]["A"] : siblings.length > 0 ? siblings[0] : null);
  25235. }
  25236. }))();
  25237. this.secondWalk = new (com_ibm_rave_core_nativeImpl_Declare({
  25238. visit : function(v) {
  25239. v["wrappedNode"]["x"] = v["z"] + v["parent"]["m"];
  25240. v["m"] += v["parent"]["m"];
  25241. }
  25242. }))();
  25243. this.sort(null);
  25244. this.value(null);
  25245. }
  25246. },
  25247. createTreeNodeWrapper : function(treeNode, parent, i) {
  25248. var node = {};
  25249. node["wrappedNode"] = treeNode;
  25250. node["parent"] = parent;
  25251. node["children"] = [];
  25252. node["A"] = null;
  25253. node["a"] = node;
  25254. node["z"] = 0;
  25255. node["m"] = 0;
  25256. node["c"] = 0;
  25257. node["s"] = 0;
  25258. node["t"] = null;
  25259. node["i"] = i;
  25260. return node;
  25261. },
  25262. buildChildren : function(node) {
  25263. if (node["wrappedNode"]["children"]) {
  25264. for (var j = 0, n = node["wrappedNode"]["children"].length; j < n; ++j) {
  25265. var childTreeNode = node["wrappedNode"]["children"][j];
  25266. var child = this.createTreeNodeWrapper(childTreeNode, node, j);
  25267. node["children"].push(child);
  25268. this.buildChildren(child);
  25269. }
  25270. }
  25271. },
  25272. wrapTree : function(root0) {
  25273. var rootParent = this.createTreeNodeWrapper(null, null, -1);
  25274. var wrappedRoot0 = this.createTreeNodeWrapper(root0, rootParent, 0);
  25275. wrappedRoot0["rootParent"] = rootParent;
  25276. this.buildChildren(wrappedRoot0);
  25277. return wrappedRoot0;
  25278. },
  25279. apportion : function(v, w, ancestor) {
  25280. var _ancestor = ancestor;
  25281. if (w) {
  25282. var vip = v, vop = v, vim = w, vom = vip["parent"]["children"][0];
  25283. var sip = vip["m"], sop = vop["m"], sim = vim["m"], som = vom["m"], shift;
  25284. vim = this.treeRight(vim);
  25285. vip = this.treeLeft(vip);
  25286. while (vim && vip) {
  25287. vom = this.treeLeft(vom);
  25288. vop = this.treeRight(vop);
  25289. vop["a"] = v;
  25290. shift = vim["z"] + sim - vip["z"] - sip + this.separationFunction(vim["wrappedNode"], vip["wrappedNode"]);
  25291. if (shift > 0) {
  25292. this.treeMove(this.treeAncestor(vim, v, _ancestor), v, shift);
  25293. sip += shift;
  25294. sop += shift;
  25295. }
  25296. sim += vim["m"];
  25297. sip += vip["m"];
  25298. som += vom["m"];
  25299. sop += vop["m"];
  25300. vim = this.treeRight(vim);
  25301. vip = this.treeLeft(vip);
  25302. }
  25303. if (vim && !this.treeRight(vop)) {
  25304. vop["t"] = vim;
  25305. vop["m"] += sim - sop;
  25306. }
  25307. if (vip && !this.treeLeft(vom)) {
  25308. vom["t"] = vip;
  25309. vom["m"] += sip - som;
  25310. _ancestor = v;
  25311. }
  25312. }
  25313. return _ancestor;
  25314. },
  25315. treeLeft : function(v) {
  25316. var children = v["children"];
  25317. return children.length > 0 ? children[0] : v["t"];
  25318. },
  25319. treeRight : function(v) {
  25320. var children = v["children"];
  25321. var n = children.length;
  25322. return (n > 0) ? children[n - 1] : v["t"];
  25323. },
  25324. treeMove : function(wm, wp, shift) {
  25325. var change = shift / (wp["i"] - wm["i"]);
  25326. wp["c"] -= change;
  25327. wp["s"] += shift;
  25328. wm["c"] += change;
  25329. wp["z"] += shift;
  25330. wp["m"] += shift;
  25331. },
  25332. treeShift : function(v) {
  25333. var shift = 0, change = 0;
  25334. var children = v["children"];
  25335. var i = children.length;
  25336. var w;
  25337. while (--i >= 0) {
  25338. w = children[i];
  25339. w["z"] += shift;
  25340. w["m"] += shift;
  25341. shift += w["s"] + (change += w["c"]);
  25342. }
  25343. },
  25344. treeAncestor : function(vim, v, ancestor) {
  25345. return vim["a"]["parent"] == (v["parent"]) ? vim["a"] : ancestor;
  25346. },
  25347. /**
  25348. * 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.
  25349. * @param (Object) d the root node containing all children
  25350. * @return (Array) the tree layout array representing the computed positions of all child nodes
  25351. */
  25352. create$0 : function(d) {
  25353. var nodes = com_ibm_rave_core_layout_hierarchy_HierarchyBase.prototype.create.call(this, d);
  25354. var root0 = nodes[0];
  25355. var root1 = this.wrapTree(root0);
  25356. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitAfter(root1, this.firstWalk);
  25357. root1["parent"]["m"] = -root1["z"];
  25358. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitBefore(root1, this.secondWalk);
  25359. if (this._nodeSize) {
  25360. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitBefore(root0, this.sizeNode);
  25361. } else {
  25362. var left = root0, right = root0, bottom = root0;
  25363. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitBefore(root0, new (com_ibm_rave_core_nativeImpl_Declare({
  25364. visit : function(node) {
  25365. if (node["x"] < left["x"]) {
  25366. left = node;
  25367. }
  25368. if (node["x"] > right["x"]) {
  25369. right = node;
  25370. }
  25371. if (node["depth"] > bottom["depth"]) {
  25372. bottom = node;
  25373. }
  25374. }
  25375. }))());
  25376. var tx = this.separationFunction(left, right) / 2.0 - left["x"];
  25377. var kx = this._size[0] / (right["x"] + this.separationFunction(right, left) / 2.0 + tx);
  25378. var ky = this._size[1] / ((bottom["depth"] > 0) ? bottom["depth"] : 1);
  25379. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.visitBefore(root0, new (com_ibm_rave_core_nativeImpl_Declare({
  25380. visit : function(node) {
  25381. node["x"] = (node["x"] + tx) * kx;
  25382. node["y"] = node["depth"] * ky;
  25383. }
  25384. }))());
  25385. }
  25386. return nodes;
  25387. },
  25388. /**
  25389. * sets the separation method to the new method being passed in it is used to compute separation between neighboring nodes
  25390. * @param (com.ibm.rave.core.layout.tree.Tree.GetSeparation) func the new method to be involved when calling treeSeparation
  25391. * @return (com.ibm.rave.core.layout.tree.Tree) tree instance
  25392. */
  25393. separation$0 : function(func) {
  25394. this.separationFunction = func;
  25395. return this;
  25396. },
  25397. /**
  25398. * gets the separation method
  25399. * @return (com.ibm.rave.core.layout.tree.Tree.GetSeparation) separation method
  25400. */
  25401. separation$1 : function() {
  25402. return this.separationFunction;
  25403. },
  25404. /**
  25405. * sets the size of the layout
  25406. * @param (Array) sizes the desired height and width of the layout
  25407. * @return (com.ibm.rave.core.layout.tree.Tree) this the tree object
  25408. */
  25409. size$0 : function(sizes) {
  25410. this._nodeSize = (!(this._size = sizes));
  25411. return this;
  25412. },
  25413. /**
  25414. * gets the size of the layout The default is 1x1
  25415. * @return (Array) an array representing the size of the layout
  25416. */
  25417. size$1 : function() {
  25418. return this._nodeSize ? null : this._size;
  25419. },
  25420. /**
  25421. * sets the node size
  25422. * @param (Array) sizes the desired node size
  25423. * @return (com.ibm.rave.core.layout.tree.Tree) this the tree object
  25424. */
  25425. nodeSize$0 : function(sizes) {
  25426. this._nodeSize = ((this._size = sizes));
  25427. return this;
  25428. },
  25429. /**
  25430. * gets the node size
  25431. * @return (Array) nodeSize
  25432. */
  25433. nodeSize$1 : function() {
  25434. return (this._nodeSize) ? this._size : null;
  25435. },
  25436. /** @expose */
  25437. create : function(a0) {
  25438. var args = arguments;
  25439. return this.create$0(a0);
  25440. },
  25441. /** @expose */
  25442. separation : function(a0) {
  25443. var args = arguments;
  25444. if (args.length == 0) {
  25445. return this.separation$1();
  25446. }
  25447. return this.separation$0(a0);
  25448. },
  25449. /** @expose */
  25450. size : function(a0) {
  25451. var args = arguments;
  25452. if (args.length == 0) {
  25453. return this.size$1();
  25454. }
  25455. return this.size$0(a0);
  25456. },
  25457. /** @expose */
  25458. nodeSize : function(a0) {
  25459. var args = arguments;
  25460. if (args.length == 0) {
  25461. return this.nodeSize$1();
  25462. }
  25463. return this.nodeSize$0(a0);
  25464. }
  25465. });
  25466. /**
  25467. * compares parent nodes
  25468. * @param (Object) a compares node a's parent with node b
  25469. * @param (Object) b compares node a's parent with node b
  25470. * @return (int) indicates whether a and b are the same or different
  25471. */
  25472. /** @expose */
  25473. com_ibm_rave_core_layout_tree_Tree.treeSeparation = function(a, b) {
  25474. return a["parent"] == b["parent"] ? 1 : 2;
  25475. };
  25476. // $source: com/ibm/rave/core/layout/StackLayout
  25477. /************************************************************************
  25478. ** IBM Confidential
  25479. **
  25480. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  25481. **
  25482. ** (C) Copyright IBM Corp. 2017
  25483. **
  25484. ** The source code for this program is not published or otherwise divested of its trade secrets,
  25485. ** irrespective of what has been deposited with the U.S. Copyright Office.
  25486. ************************************************************************/
  25487. // GENERATED
  25488. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, declare anonymous
  25489. //@import com/ibm/rave/core/Rave (runtime) // range, permute
  25490. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (runtime) // create
  25491. //@import com/ibm/rave/core/internal/util/Identity (static) // create
  25492. //@import com/ibm/rave/core/arrays/Range (runtime) // create
  25493. var com_ibm_rave_core_layout_StackLayout = rave_externs["StackLayout"] = com_ibm_rave_core_nativeImpl_Declare({
  25494. //valuesFn : null,
  25495. //orderFn : null,
  25496. //offsetFn : null,
  25497. //outFn : null,
  25498. //accumulatorFn : null,
  25499. //POSITIVES_NEGATIVES_ACCUMULATOR_FUNCTION : null,
  25500. //r2_layout_stackAccumulators : null,
  25501. //xFn : null,
  25502. //yFn : null,
  25503. _$functionClassMethod : function() {
  25504. var _$self = function(data, index, groupIndex) {
  25505. return _$self.stack(data, index);
  25506. };
  25507. return _$self;
  25508. },
  25509. constructor : function() {
  25510. this.valuesFn = com_ibm_rave_core_layout_StackLayout.DEFAULT_VALUES_FUNCTION;
  25511. this.orderFn = com_ibm_rave_core_layout_StackLayout.DEFAULT_STACKORDER_FUNCTION;
  25512. this.offsetFn = com_ibm_rave_core_layout_StackLayout.DEFAULT_STACKOFFSETZERO;
  25513. this.outFn = com_ibm_rave_core_layout_StackLayout.DEFAULT_OUT_FUNCTION;
  25514. this.accumulatorFn = com_ibm_rave_core_layout_StackLayout.DEFAULT_ACCUMULATOR_FUNCTION;
  25515. this.POSITIVES_NEGATIVES_ACCUMULATOR_FUNCTION = new (com_ibm_rave_core_nativeImpl_Declare({
  25516. accumulatedPos : 0,
  25517. accumulatedNeg : 0,
  25518. _$functionClassMethod : function() {
  25519. var _$self = function(offsetValue, lastValue, currentValue, accumulatedVal, seriesIndex, dataIndex) {
  25520. if (dataIndex == 0) {
  25521. if (accumulatedVal >= 0) {
  25522. _$self.accumulatedPos = accumulatedVal;
  25523. _$self.accumulatedNeg = 0;
  25524. } else {
  25525. _$self.accumulatedPos = 0;
  25526. _$self.accumulatedNeg = accumulatedVal;
  25527. }
  25528. }
  25529. if (lastValue >= 0) {
  25530. _$self.accumulatedPos += lastValue;
  25531. } else {
  25532. _$self.accumulatedNeg += lastValue;
  25533. }
  25534. if (currentValue >= 0) {
  25535. return _$self.accumulatedPos;
  25536. }
  25537. return _$self.accumulatedNeg;
  25538. };
  25539. return _$self;
  25540. }
  25541. }))();
  25542. this.r2_layout_stackAccumulators = this.initialize_r2_layout_stackAccumulators();
  25543. this.xFn = com_ibm_rave_core_layout_StackLayout.DEFAULT_X_FUNCTION;
  25544. this.yFn = com_ibm_rave_core_layout_StackLayout.DEFAULT_Y_FUNCTION;
  25545. {}
  25546. },
  25547. /**
  25548. * 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.
  25549. * @param (Array) data the data
  25550. * @param (int) index the index
  25551. * @return (Array) modified data
  25552. */
  25553. stack$0 : function(data, index) {
  25554. var objData = data;
  25555. var n = data.length;
  25556. if (n == 0) {
  25557. return data;
  25558. }
  25559. var self = this;
  25560. var series = objData.map(function(currentValue, currentIndex, array) {
  25561. return self.valuesFn.call(self, currentValue, currentIndex, -1);
  25562. });
  25563. var points = series.map(function(currentValue, notUsedindex, notUsedarray) {
  25564. return currentValue.map(function(pointsCurrentValue, pointIndex, pointArray) {
  25565. var xVal = (+ (self.xFn.call(self, pointsCurrentValue, pointIndex, -1)));
  25566. var yVal = (+ (self.yFn.call(self, pointsCurrentValue, pointIndex, -1)));
  25567. return [xVal, yVal];
  25568. });
  25569. });
  25570. var orders = this.orderFn.call(this, points, index, -1);
  25571. series = com_ibm_rave_core_Rave.permute(series, orders);
  25572. points = com_ibm_rave_core_Rave.permute(points, orders);
  25573. var offsets = this.offsetFn.call(this, points, index, -1);
  25574. var m = series[0].length;
  25575. var accumulatedVal;
  25576. for (var j = 0; j < m; ++j) {
  25577. var o = (offsets[j]);
  25578. accumulatedVal = o;
  25579. this.outFn.call(this, series[0][j], o, points[0][j][1]);
  25580. for (var i = 1; i < n; ++i) {
  25581. var lastVal = points[i - 1][j][1];
  25582. var currentVal = points[i][j][1];
  25583. accumulatedVal = this.accumulatorFn.call(this, o, lastVal, currentVal, accumulatedVal, j, i - 1);
  25584. this.outFn.call(this, series[i][j], accumulatedVal, currentVal);
  25585. }
  25586. }
  25587. return data;
  25588. },
  25589. /**
  25590. * Same as stack(data,-1). This is included because the index argument is optional in the D3 API.
  25591. * @param (Array) data The data
  25592. * @return (Array) Modified data
  25593. */
  25594. stack$1 : function(data) {
  25595. return this.stack$0(data, -1);
  25596. },
  25597. /**
  25598. * gets the x-coordinate function
  25599. * @return (com.ibm.rave.core.selector.ValueFunction) X function
  25600. */
  25601. x$0 : function() {
  25602. return this.xFn;
  25603. },
  25604. /**
  25605. * Specifies how to access the x-coordinate of each value's position.
  25606. * @param (com.ibm.rave.core.selector.ValueFunction) newXFn
  25607. * @return (com.ibm.rave.core.layout.StackLayout) this layout
  25608. */
  25609. x$1 : function(newXFn) {
  25610. this.xFn = newXFn;
  25611. return this;
  25612. },
  25613. /**
  25614. * Gets the Y-coordinate function
  25615. * @return (com.ibm.rave.core.selector.ValueFunction) Y function
  25616. */
  25617. y$0 : function() {
  25618. return this.yFn;
  25619. },
  25620. /**
  25621. * Specifies how to access the Y-coordinate of each value's position.
  25622. * @param (com.ibm.rave.core.selector.ValueFunction) newYFn
  25623. * @return (com.ibm.rave.core.layout.StackLayout) this layout
  25624. */
  25625. y$1 : function(newYFn) {
  25626. this.yFn = newYFn;
  25627. return this;
  25628. },
  25629. /**
  25630. * Gets the Out Function
  25631. * @return (com.ibm.rave.core.layout.StackLayout.StackOutFunction) the out function
  25632. */
  25633. out$0 : function() {
  25634. return this.outFn;
  25635. },
  25636. /**
  25637. * Sets the function that Specifies how to propagate the computed baseline to above layers.
  25638. * @param (com.ibm.rave.core.layout.StackLayout.StackOutFunction) newOutFn
  25639. * @return (com.ibm.rave.core.layout.StackLayout) this layout
  25640. */
  25641. out$1 : function(newOutFn) {
  25642. this.outFn = newOutFn;
  25643. return this;
  25644. },
  25645. /**
  25646. * Gets the values Function
  25647. * @return (com.ibm.rave.core.selector.ValueFunction) stack layout value function
  25648. */
  25649. values$0 : function() {
  25650. return this.valuesFn;
  25651. },
  25652. /**
  25653. * Sets the function that Specifies how to extract values from the associated element in layers
  25654. * @param (com.ibm.rave.core.selector.ValueFunction) newValuesFn
  25655. * @return (com.ibm.rave.core.layout.StackLayout) this layout
  25656. */
  25657. values$1 : function(newValuesFn) {
  25658. this.valuesFn = newValuesFn;
  25659. return this;
  25660. },
  25661. /**
  25662. * Gets The stack order function
  25663. * @return (com.ibm.rave.core.selector.ValueFunction) stack order function
  25664. */
  25665. order$0 : function() {
  25666. return this.orderFn;
  25667. },
  25668. /**
  25669. * Sets the function used to specify the stack order. If null the default order function is used.
  25670. * @param (com.ibm.rave.core.selector.ValueFunction) newOrderFn New function
  25671. * @return (com.ibm.rave.core.layout.StackLayout) this layout
  25672. */
  25673. order$1 : function(newOrderFn) {
  25674. this.orderFn = newOrderFn ? newOrderFn : com_ibm_rave_core_layout_StackLayout.DEFAULT_STACKORDER_FUNCTION;
  25675. return this;
  25676. },
  25677. /**
  25678. * Sets the stack order to use, supported types are "inside-out", "reverse" and "default"
  25679. * @param (String) orderType
  25680. * @return (com.ibm.rave.core.layout.StackLayout) this layout
  25681. */
  25682. order$2 : function(orderType) {
  25683. var requestedOrderFn = com_ibm_rave_core_layout_StackLayout.r2_layout_stackOrders.get(orderType);
  25684. if (!requestedOrderFn) {
  25685. requestedOrderFn = com_ibm_rave_core_layout_StackLayout.DEFAULT_STACKORDER_FUNCTION;
  25686. }
  25687. this.orderFn = requestedOrderFn;
  25688. return this;
  25689. },
  25690. /**
  25691. * Sets the stack accumulator function. An accumulator function is an algorithm that determines how cumulative values are calculated for the stack layout.
  25692. * @param (com.ibm.rave.core.layout.StackLayout.AccumulatorFunction) newAccumulatorFn The new accumulator function
  25693. * @return (com.ibm.rave.core.layout.StackLayout) this layout
  25694. */
  25695. accumulator$0 : function(newAccumulatorFn) {
  25696. this.accumulatorFn = newAccumulatorFn ? newAccumulatorFn : com_ibm_rave_core_layout_StackLayout.DEFAULT_ACCUMULATOR_FUNCTION;
  25697. return this;
  25698. },
  25699. /**
  25700. * Sets the function that serves as accumulator (the algorithm used to calculate the cumulative values) for the stack layout using the provided string. Currently the only supported accumulator function is : "separate-positives-negatives". The accumulator for "separate-positives-negatives" sums up and stores positive values and negative values separately.
  25701. * @param (String) accumulator The accumulator
  25702. * @return (com.ibm.rave.core.layout.StackLayout) this layout
  25703. */
  25704. accumulator$1 : function(accumulator) {
  25705. var requestedAccumulatorFn = this.r2_layout_stackAccumulators.get(accumulator);
  25706. if (!requestedAccumulatorFn) {
  25707. requestedAccumulatorFn = com_ibm_rave_core_layout_StackLayout.DEFAULT_ACCUMULATOR_FUNCTION;
  25708. }
  25709. this.accumulatorFn = requestedAccumulatorFn;
  25710. return this;
  25711. },
  25712. /**
  25713. * Returns the accumulator function used for the stack layout.
  25714. * @return (com.ibm.rave.core.layout.StackLayout.AccumulatorFunction) The accumulator function
  25715. */
  25716. accumulator$2 : function() {
  25717. return this.accumulatorFn;
  25718. },
  25719. /**
  25720. * Gets the stack offset algorithm
  25721. * @return (com.ibm.rave.core.selector.ValueFunction) stack offset algorithm
  25722. */
  25723. offset$0 : function() {
  25724. return this.offsetFn;
  25725. },
  25726. /**
  25727. * Sets the stack offset algorithm. If the argument is null, the zero algorithm is used.
  25728. * @param (com.ibm.rave.core.selector.ValueFunction) newOffsetFn
  25729. * @return (com.ibm.rave.core.layout.StackLayout) this layout
  25730. */
  25731. offset$1 : function(newOffsetFn) {
  25732. this.offsetFn = (newOffsetFn) ? newOffsetFn : com_ibm_rave_core_layout_StackLayout.DEFAULT_STACKOFFSETZERO;
  25733. return this;
  25734. },
  25735. /**
  25736. * Sets the stack offset algorithm type, supported types are : "silhouette", "wiggle", "expand" and "zero". If unknown zero is used.
  25737. * @param (String) offsetType
  25738. * @return (com.ibm.rave.core.layout.StackLayout) this
  25739. */
  25740. offset$2 : function(offsetType) {
  25741. var requestedOffsetFn = com_ibm_rave_core_layout_StackLayout.r2_layout_stackOffsets.get(offsetType);
  25742. if (!requestedOffsetFn) {
  25743. requestedOffsetFn = com_ibm_rave_core_layout_StackLayout.DEFAULT_STACKOFFSETZERO;
  25744. }
  25745. this.offsetFn = requestedOffsetFn;
  25746. return this;
  25747. },
  25748. initialize_r2_layout_stackAccumulators : function() {
  25749. var _r2_layout_stackAccumulators = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  25750. _r2_layout_stackAccumulators.set("default", com_ibm_rave_core_layout_StackLayout.DEFAULT_ACCUMULATOR_FUNCTION);
  25751. _r2_layout_stackAccumulators.set("separate-positives-negatives", this.POSITIVES_NEGATIVES_ACCUMULATOR_FUNCTION);
  25752. return _r2_layout_stackAccumulators;
  25753. },
  25754. /** @expose */
  25755. stack : function(a0, a1) {
  25756. var args = arguments;
  25757. if (args.length == 1) {
  25758. return this.stack$1(a0);
  25759. }
  25760. return this.stack$0(a0, a1);
  25761. },
  25762. /** @expose */
  25763. x : function(a0) {
  25764. var args = arguments;
  25765. if (args.length == 0) {
  25766. return this.x$0();
  25767. }
  25768. return this.x$1(a0);
  25769. },
  25770. /** @expose */
  25771. y : function(a0) {
  25772. var args = arguments;
  25773. if (args.length == 0) {
  25774. return this.y$0();
  25775. }
  25776. return this.y$1(a0);
  25777. },
  25778. /** @expose */
  25779. out : function(a0) {
  25780. var args = arguments;
  25781. if (args.length == 0) {
  25782. return this.out$0();
  25783. }
  25784. return this.out$1(a0);
  25785. },
  25786. /** @expose */
  25787. values : function(a0) {
  25788. var args = arguments;
  25789. if (args.length == 0) {
  25790. return this.values$0();
  25791. }
  25792. return this.values$1(a0);
  25793. },
  25794. /** @expose */
  25795. order : function(a0) {
  25796. var args = arguments;
  25797. if (args.length == 0) {
  25798. return this.order$0();
  25799. }
  25800. if (args.length == 1 && typeof a0 === "function") {
  25801. return this.order$1(a0);
  25802. }
  25803. return this.order$2(a0);
  25804. },
  25805. /** @expose */
  25806. accumulator : function(a0) {
  25807. var args = arguments;
  25808. if (args.length == 0) {
  25809. return this.accumulator$2();
  25810. }
  25811. if (args.length == 1 && typeof a0 === "function") {
  25812. return this.accumulator$0(a0);
  25813. }
  25814. return this.accumulator$1(a0);
  25815. },
  25816. /** @expose */
  25817. offset : function(a0) {
  25818. var args = arguments;
  25819. if (args.length == 0) {
  25820. return this.offset$0();
  25821. }
  25822. if (args.length == 1 && typeof a0 === "function") {
  25823. return this.offset$1(a0);
  25824. }
  25825. return this.offset$2(a0);
  25826. }
  25827. });
  25828. com_ibm_rave_core_layout_StackLayout.initialize_r2_layout_stackOrders = function() {
  25829. var r2_layout_stackOrders = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  25830. r2_layout_stackOrders.set("inside-out", com_ibm_rave_core_layout_StackLayout.STACKORDER_INSIDE_OUT);
  25831. r2_layout_stackOrders.set("reverse", com_ibm_rave_core_layout_StackLayout.STACKORDER_REVERSE);
  25832. r2_layout_stackOrders.set("default", com_ibm_rave_core_layout_StackLayout.DEFAULT_STACKORDER_FUNCTION);
  25833. return r2_layout_stackOrders;
  25834. };
  25835. com_ibm_rave_core_layout_StackLayout.initialize_r2_layout_stackOffsets = function() {
  25836. var r2_layout_stackOffsets = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  25837. r2_layout_stackOffsets.set("silhouette", com_ibm_rave_core_layout_StackLayout.STACKOFFSET_SILHOUETTE);
  25838. r2_layout_stackOffsets.set("wiggle", com_ibm_rave_core_layout_StackLayout.STACKOFFSET_WIGGLE);
  25839. r2_layout_stackOffsets.set("expand", com_ibm_rave_core_layout_StackLayout.STACKOFFSET_EXPAND);
  25840. r2_layout_stackOffsets.set("zero", com_ibm_rave_core_layout_StackLayout.DEFAULT_STACKOFFSETZERO);
  25841. return r2_layout_stackOffsets;
  25842. };
  25843. com_ibm_rave_core_layout_StackLayout.DEFAULT_ACCUMULATOR_FUNCTION = function(offsetValue, lastValue, currentValue, accumulatedVal, seriesIndex, dataIndex) {
  25844. return accumulatedVal + lastValue;
  25845. };
  25846. com_ibm_rave_core_layout_StackLayout.DEFAULT_VALUES_FUNCTION = com_ibm_rave_core_internal_util_Identity.create();
  25847. com_ibm_rave_core_layout_StackLayout.DEFAULT_STACKORDER_FUNCTION = function(data, index, groupIndex) {
  25848. var aData = data;
  25849. return (com_ibm_rave_core_arrays_Range.create(aData.length));
  25850. };
  25851. com_ibm_rave_core_layout_StackLayout.DEFAULT_STACKOFFSETZERO = function(data, index, groupIndex) {
  25852. var j = -1;
  25853. var child = ((data)[0]);
  25854. var m = child.length;
  25855. var y0 = [];
  25856. while (++j < m) {
  25857. y0[j] = 0;
  25858. }
  25859. return y0;
  25860. };
  25861. com_ibm_rave_core_layout_StackLayout.DEFAULT_OUT_FUNCTION = function(stackNode, y0, y) {
  25862. var node = stackNode;
  25863. node["y0"] = y0;
  25864. node["y"] = y;
  25865. };
  25866. com_ibm_rave_core_layout_StackLayout.DEFAULT_X_FUNCTION = function(data, index, groupIndex) {
  25867. return (data)["x"];
  25868. };
  25869. com_ibm_rave_core_layout_StackLayout.DEFAULT_Y_FUNCTION = function(data, index, groupIndex) {
  25870. return (data)["y"];
  25871. };
  25872. com_ibm_rave_core_layout_StackLayout.r2_layout_stackMaxIndex = function(currentValue, index, array) {
  25873. var j = 0;
  25874. var parentArray = currentValue[0];
  25875. var v = parentArray[1];
  25876. var k = 0;
  25877. var n = array.length;
  25878. for (var i = 0; i < n; ++i) {
  25879. parentArray = currentValue[i];
  25880. k = parentArray[1];
  25881. if (k > v) {
  25882. j = i;
  25883. v = k;
  25884. }
  25885. }
  25886. return j;
  25887. };
  25888. com_ibm_rave_core_layout_StackLayout.r2_layout_stackSum = function(previousValue, currentValue, index, array) {
  25889. return previousValue + currentValue[1];
  25890. };
  25891. com_ibm_rave_core_layout_StackLayout.r2_layout_stackReduceSum = function(currentValue, index, array) {
  25892. return currentValue.reduce(com_ibm_rave_core_layout_StackLayout.r2_layout_stackSum, 0);
  25893. };
  25894. com_ibm_rave_core_layout_StackLayout.STACKORDER_REVERSE = function(data, index, groupIndex) {
  25895. var aData = data;
  25896. return (com_ibm_rave_core_arrays_Range.create(aData.length)).reverse();
  25897. };
  25898. com_ibm_rave_core_layout_StackLayout.STACKORDER_INSIDE_OUT = function(data, index, groupIndex) {
  25899. var aData = data;
  25900. var n = aData.length;
  25901. var j = 0;
  25902. var max = aData.map(com_ibm_rave_core_layout_StackLayout.r2_layout_stackMaxIndex);
  25903. var sums = aData.map(com_ibm_rave_core_layout_StackLayout.r2_layout_stackReduceSum);
  25904. var sortedIndex = com_ibm_rave_core_Rave.range(n).sort(function(obj1, obj2) {
  25905. return ~~(max[~~ (obj1)] - max[~~ (obj2)]);
  25906. });
  25907. var top = 0;
  25908. var bottom = 0;
  25909. var tops = [];
  25910. var bottoms = [];
  25911. for (var i = 0; i < n; ++i) {
  25912. j = ~~ (sortedIndex[i]);
  25913. if (top < bottom) {
  25914. top += (sums[j]);
  25915. tops.push(j);
  25916. } else {
  25917. bottom += sums[j];
  25918. bottoms.push(j);
  25919. }
  25920. }
  25921. return bottoms.reverse().concat(tops);
  25922. };
  25923. com_ibm_rave_core_layout_StackLayout.r2_layout_stackOrders = com_ibm_rave_core_layout_StackLayout.initialize_r2_layout_stackOrders();
  25924. com_ibm_rave_core_layout_StackLayout.STACKOFFSET_SILHOUETTE = function(data, index, groupIndex) {
  25925. var aData = data;
  25926. var n = aData.length;
  25927. var m = aData[0].length;
  25928. var sums = [];
  25929. var max = 0;
  25930. var o;
  25931. var y0 = [];
  25932. for (var j = 0; j < m; ++j) {
  25933. o = 0;
  25934. for (var i = 0; i < n; ++i) {
  25935. o += aData[i][j][1];
  25936. }
  25937. if (o > max) {
  25938. max = o;
  25939. }
  25940. sums.push(o);
  25941. }
  25942. for (var j = 0; j < m; ++j) {
  25943. y0[j] = max - sums[j] / 2;
  25944. }
  25945. return y0;
  25946. };
  25947. com_ibm_rave_core_layout_StackLayout.STACKOFFSET_WIGGLE = function(data, index, groupIndex) {
  25948. var aData = data;
  25949. var n = aData.length;
  25950. var x = aData[0];
  25951. var m = x.length;
  25952. var s1 = 0, s2 = 0, s3 = 0, dx = 0;
  25953. var o = 0, o0 = 0;
  25954. var y0 = [];
  25955. y0[0] = 0;
  25956. for (var j = 1; j < m; ++j) {
  25957. s1 = 0;
  25958. for (var i = 0; i < n; ++i) {
  25959. s1 += (aData[i][j][1]);
  25960. }
  25961. s2 = 0;
  25962. dx = (x[j][0]) - (x[j - 1][0]);
  25963. for (var i = 0; i < n; ++i) {
  25964. var isElement = aData[i];
  25965. s3 = ((isElement[j][1]) - (isElement[j - 1][1])) / (2 * dx);
  25966. for (var k = 0; k < i; ++k) {
  25967. var ksElement = aData[k];
  25968. s3 += ((ksElement[j][1]) - (ksElement[j - 1][1])) / dx;
  25969. }
  25970. s2 += s3 * (isElement[j][1]);
  25971. }
  25972. if (s1 != 0) {
  25973. o -= s2 / s1 * dx;
  25974. }
  25975. y0[j] = o;
  25976. if (o < o0) {
  25977. o0 = o;
  25978. }
  25979. }
  25980. for (var j = 0; j < m; ++j) {
  25981. var val = y0[j];
  25982. y0[j] = val - o0;
  25983. }
  25984. return y0;
  25985. };
  25986. com_ibm_rave_core_layout_StackLayout.STACKOFFSET_EXPAND = function(data, index, groupIndex) {
  25987. var aData = data;
  25988. var n = aData.length;
  25989. var m = aData[0].length;
  25990. var k = 1 / n;
  25991. var o = 0;
  25992. var y0 = [];
  25993. for (var j = 0; j < m; ++j) {
  25994. o = 0;
  25995. for (var i = 0; i < n; ++i) {
  25996. o += aData[i][j][1];
  25997. }
  25998. if (o != 0) {
  25999. for (var i = 0; i < n; ++i) {
  26000. var ijElement = aData[i][j];
  26001. var val = ijElement[1];
  26002. ijElement[1] = val / o;
  26003. }
  26004. } else {
  26005. for (var i = 0; i < n; ++i) {
  26006. var ijElement = aData[i][j];
  26007. ijElement[1] = k;
  26008. }
  26009. }
  26010. }
  26011. for (var j = 0; j < m; ++j) {
  26012. y0[j] = 0;
  26013. }
  26014. return y0;
  26015. };
  26016. com_ibm_rave_core_layout_StackLayout.r2_layout_stackOffsets = com_ibm_rave_core_layout_StackLayout.initialize_r2_layout_stackOffsets();
  26017. // $source: com/ibm/rave/core/layout/treemap/Treemap
  26018. /************************************************************************
  26019. ** IBM Confidential
  26020. **
  26021. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  26022. **
  26023. ** (C) Copyright IBM Corp. 2017
  26024. **
  26025. ** The source code for this program is not published or otherwise divested of its trade secrets,
  26026. ** irrespective of what has been deposited with the U.S. Copyright Office.
  26027. ************************************************************************/
  26028. // GENERATED
  26029. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  26030. //@import com/ibm/rave/core/layout/hierarchy/HierarchyBase (loadtime) // superclass
  26031. //@import com/ibm/rave/core/internal/layout/treemap/TreemapRect (runtime) // new
  26032. //@import com/ibm/rave/core/layout/hierarchy/HierarchyUtil (runtime) // revalue
  26033. //@import com/ibm/rave/core/internal/layout/treemap/Row (runtime) // new
  26034. /**
  26035. * A Layout for the treemap
  26036. * @author Bryan
  26037. */
  26038. var com_ibm_rave_core_layout_treemap_Treemap = rave_externs["Treemap"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_layout_hierarchy_HierarchyBase, {
  26039. /**
  26040. * @param node
  26041. * @return a rect from the node with no padding
  26042. */
  26043. //treemapPadNull : null,
  26044. /**
  26045. * @param node
  26046. * @param padding
  26047. * @return the new rect with padding
  26048. */
  26049. //treemapPad : null,
  26050. //_size : null,
  26051. //_padding : null,
  26052. //_pad : null,
  26053. //_stickies : null,
  26054. //_mode : null,
  26055. //_ratio : null,
  26056. //squarify : null,
  26057. //stickify : null,
  26058. _round : false,
  26059. _sticky : false,
  26060. constructor : function() {
  26061. this.treemapPadNull = function(node) {
  26062. var rect = new com_ibm_rave_core_internal_layout_treemap_TreemapRect();
  26063. rect.x = node["x"];
  26064. rect.y = node["y"];
  26065. rect.dx = node["dx"];
  26066. rect.dy = node["dy"];
  26067. return rect;
  26068. };
  26069. this.treemapPad = function(node, padding) {
  26070. var rect = new com_ibm_rave_core_internal_layout_treemap_TreemapRect();
  26071. rect.x = node["x"] + + (padding[3]);
  26072. rect.y = node["y"] + + (padding[0]);
  26073. rect.dx = node["dx"] - + (padding[1]) - + (padding[3]);
  26074. rect.dy = node["dy"] - + (padding[0]) - + (padding[2]);
  26075. if (rect.dx < 0) {
  26076. rect.x += rect.dx / 2;
  26077. rect.dx = 0;
  26078. }
  26079. if (rect.dy < 0) {
  26080. rect.y += rect.dy / 2;
  26081. rect.dy = 0;
  26082. }
  26083. return rect;
  26084. };
  26085. /**
  26086. * 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.
  26087. */
  26088. {
  26089. this._round = true;
  26090. this._size = [1, 1];
  26091. this._padding = null;
  26092. this._pad = this.treemapPadNull;
  26093. this._sticky = false;
  26094. this._stickies = null;
  26095. this._mode = "squarify";
  26096. this._ratio = 0.5 * (1 + Math.sqrt(5));
  26097. var self = this;
  26098. this.squarify = function(node, index, array) {
  26099. var children = node["children"];
  26100. if (children && children.length != 0) {
  26101. var rect = self._pad(node);
  26102. var row = new com_ibm_rave_core_internal_layout_treemap_Row();
  26103. var remaining = children.slice();
  26104. var child;
  26105. var best = Infinity;
  26106. var score = 0;
  26107. 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);
  26108. var n;
  26109. self.scale(remaining, rect.dx * rect.dy / node["value"]);
  26110. row.area = 0;
  26111. while ((n = remaining.length) > 0) {
  26112. row.push(child = remaining[n - 1]);
  26113. row.area += child["area"];
  26114. if (!(self._mode == "squarify") || (score = self.worst(row, u)) <= best) {
  26115. remaining.pop();
  26116. best = score;
  26117. } else {
  26118. row.area -= row.pop()["area"];
  26119. self.position(row, u, rect, false);
  26120. u = Math.min(rect.dx, rect.dy);
  26121. row = new com_ibm_rave_core_internal_layout_treemap_Row();
  26122. best = Infinity;
  26123. }
  26124. }
  26125. if (row.length != 0) {
  26126. self.position(row, u, rect, true);
  26127. row = new com_ibm_rave_core_internal_layout_treemap_Row();
  26128. }
  26129. children.forEach(self.squarify);
  26130. }
  26131. return null;
  26132. };
  26133. this.stickify = function(node, index, array) {
  26134. var children = node["children"];
  26135. if (children && children.length != 0) {
  26136. var rect = self._pad(node);
  26137. var remaining = children.slice();
  26138. var child;
  26139. var row = new com_ibm_rave_core_internal_layout_treemap_Row();
  26140. self.scale(remaining, rect.dx * rect.dy / node["value"]);
  26141. row.area = 0;
  26142. while ((child = remaining.pop())) {
  26143. row.push(child);
  26144. row.area += child["area"];
  26145. if (child["z"] != null) {
  26146. self.position(row, child["z"] ? rect.dx : rect.dy, rect, remaining.length == 0);
  26147. row = new com_ibm_rave_core_internal_layout_treemap_Row();
  26148. }
  26149. }
  26150. children.forEach(self.stickify);
  26151. }
  26152. return null;
  26153. };
  26154. }
  26155. },
  26156. /**
  26157. * Compute the area for each child based on value & scale
  26158. * @param (Array) children
  26159. * @param (double) k
  26160. */
  26161. scale : function(children, k) {
  26162. var i = -1;
  26163. var n = children.length;
  26164. var child;
  26165. var area;
  26166. while (++i < n) {
  26167. area = (child = children[i])["value"] * (k < 0 ? 0 : k);
  26168. child["area"] = isNaN(area) || area <= 0 ? 0 : area;
  26169. }
  26170. },
  26171. /**
  26172. * Computes the score for the specified row, as the worst aspect ratio
  26173. * @param (com.ibm.rave.core.internal.layout.treemap.Row) row
  26174. * @param (double) u
  26175. * @return (double) the score for the specified row
  26176. */
  26177. worst : function(row, u) {
  26178. var _u = u;
  26179. var s = row.area;
  26180. var r;
  26181. var rmax = 0;
  26182. var rmin = Infinity;
  26183. var i = -1;
  26184. var n = row.length;
  26185. while (++i < n) {
  26186. if ((r = row[i]["area"]) == 0) {
  26187. continue;
  26188. }
  26189. if (r < rmin) {
  26190. rmin = r;
  26191. }
  26192. if (r > rmax) {
  26193. rmax = r;
  26194. }
  26195. }
  26196. s *= s;
  26197. _u *= _u;
  26198. return s != 0 ? Math.max((_u * rmax * this._ratio) / s, s / (_u * rmin * this._ratio)) : Infinity;
  26199. },
  26200. /**
  26201. * Positions the specified row of nodes. modifies "rect"
  26202. * @param (com.ibm.rave.core.internal.layout.treemap.Row) row
  26203. * @param (double) u
  26204. * @param (com.ibm.rave.core.internal.layout.treemap.TreemapRect) rect
  26205. * @param (boolean) flush
  26206. */
  26207. position : function(row, u, rect, flush) {
  26208. var i = -1;
  26209. var n = row.length;
  26210. var x = rect.x;
  26211. var y = rect.y;
  26212. var v = u != 0 ? this.roundFunction(row.area / u) : 0;
  26213. if (u == rect.dx) {
  26214. var o = null;
  26215. if (flush || v > rect.dy) {
  26216. v = rect.dy;
  26217. }
  26218. while (++i < n) {
  26219. o = row[i];
  26220. o["x"] = x;
  26221. o["y"] = y;
  26222. o["dy"] = v;
  26223. x += o["dx"] = Math.min(rect.x + rect.dx - x, v != 0 ? this.roundFunction(o["area"] / v) : 0);
  26224. }
  26225. if (o) {
  26226. o["z"] = true;
  26227. o["dx"] += rect.x + rect.dx - x;
  26228. rect.y += v;
  26229. rect.dy -= v;
  26230. }
  26231. } else {
  26232. var o = null;
  26233. if (flush || v > rect.dx) {
  26234. v = rect.dx;
  26235. }
  26236. while (++i < n) {
  26237. o = row[i];
  26238. o["x"] = x;
  26239. o["y"] = y;
  26240. o["dx"] = v;
  26241. y += o["dy"] = Math.min(rect.y + rect.dy - y, v != 0 ? this.roundFunction(o["area"] / v) : 0);
  26242. }
  26243. if (o) {
  26244. o["z"] = false;
  26245. o["dy"] += rect.y + rect.dy - y;
  26246. rect.x += v;
  26247. rect.dx -= v;
  26248. }
  26249. }
  26250. },
  26251. /**
  26252. * 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.
  26253. * @param (Object) d The root node of the treemap.
  26254. * @return (Array) an array of all the nodes in the treemap.
  26255. */
  26256. create$0 : function(d) {
  26257. var nodes = (this._stickies) ? this._stickies : com_ibm_rave_core_layout_hierarchy_HierarchyBase.prototype.create.call(this, d);
  26258. var root = nodes[0];
  26259. root["x"] = 0;
  26260. root["y"] = 0;
  26261. root["dx"] = this._size[0];
  26262. root["dy"] = this._size[1];
  26263. if (this._stickies) {
  26264. com_ibm_rave_core_layout_hierarchy_HierarchyUtil.revalue(root, this);
  26265. }
  26266. this.scale([root], root["dx"] * root["dy"] / root["value"]);
  26267. (this._stickies ? this.stickify : this.squarify)(root, 0, [root]);
  26268. if (this._sticky) {
  26269. this._stickies = nodes;
  26270. }
  26271. return nodes;
  26272. },
  26273. /**
  26274. * 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.
  26275. * @return (Array) the size array as a list with two values
  26276. */
  26277. size$0 : function() {
  26278. return this._size;
  26279. },
  26280. /**
  26281. * 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.
  26282. * @param (Array) size the size to set as a list with two values
  26283. * @return (com.ibm.rave.core.layout.treemap.Treemap) this instance of the treemap
  26284. */
  26285. size$1 : function(size) {
  26286. this._size = size;
  26287. return this;
  26288. },
  26289. /**
  26290. * 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.
  26291. * @return (Object) the padding
  26292. */
  26293. padding$0 : function() {
  26294. return this._padding;
  26295. },
  26296. /**
  26297. * 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.
  26298. * @param (double) padding a single value to be added to all four sides of the treemap
  26299. * @return (com.ibm.rave.core.layout.treemap.Treemap) this instance of the treemap
  26300. */
  26301. padding$1 : function(padding) {
  26302. var paddingArray = [];
  26303. paddingArray.push(padding);
  26304. return this.padding$2(paddingArray);
  26305. },
  26306. /**
  26307. * 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.
  26308. * @param (Array) padding a list of doubles which must contain four values, one for each side
  26309. * @return (com.ibm.rave.core.layout.treemap.Treemap) this instance of the treemap
  26310. */
  26311. padding$2 : function(padding) {
  26312. var self = this;
  26313. var padConstant = function(node) {
  26314. return self.treemapPad(node, padding.length == 1 ? [padding[0], padding[0], padding[0], padding[0]] : padding);
  26315. };
  26316. this._padding = padding;
  26317. this._pad = this._padding == null || padding.length == 0 ? this.treemapPadNull : padConstant;
  26318. return this;
  26319. },
  26320. /**
  26321. * 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.
  26322. * @param (com.ibm.rave.core.functions.TwoParamValueFunction) padding a function which must return a single value of a list of four values
  26323. * @return (com.ibm.rave.core.layout.treemap.Treemap) this instance of the treemap
  26324. */
  26325. padding$3 : function(padding) {
  26326. var self = this;
  26327. var padFunction = function(node) {
  26328. var pObject = padding(node, node["depth"]);
  26329. var p = null;
  26330. if ((typeof pObject === "number" || pObject instanceof Number)) {
  26331. p = [+ (pObject), + (pObject), + (pObject), + (pObject)];
  26332. } else if ((typeof pObject === "array" || pObject instanceof Array)) {
  26333. var pList = pObject;
  26334. p = [];
  26335. for (var __i_enFor0 = 0, __exp_enFor0 = pList, __len_enFor0 = __exp_enFor0.length;
  26336. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  26337. var o = __exp_enFor0[__i_enFor0];
  26338. p.push(o);
  26339. }
  26340. }
  26341. return !p ? self.treemapPadNull(node) : self.treemapPad(node, p);
  26342. };
  26343. this._padding = padding;
  26344. this._pad = this._padding == null ? this.treemapPadNull : padFunction;
  26345. return this;
  26346. },
  26347. /**
  26348. * 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.
  26349. * @return (boolean) round
  26350. */
  26351. round$0 : function() {
  26352. return this._round;
  26353. },
  26354. /**
  26355. * 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.
  26356. * @param (boolean) round boolean to indicate whether the treemap should round
  26357. * @return (com.ibm.rave.core.layout.treemap.Treemap) this instance of the treemap
  26358. */
  26359. round$1 : function(round) {
  26360. this._round = round;
  26361. return this;
  26362. },
  26363. /**
  26364. * The rounding function
  26365. * @param (Number) value the value to round
  26366. * @return (double) the rounded value
  26367. */
  26368. roundFunction : function(value) {
  26369. if (this._round) {
  26370. return Math.round(value);
  26371. }
  26372. return value;
  26373. },
  26374. /**
  26375. * 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.
  26376. * @return (boolean) sticky
  26377. */
  26378. sticky$0 : function() {
  26379. return this._sticky;
  26380. },
  26381. /**
  26382. * 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.
  26383. * @param (boolean) sticky a boolean to indicates whether to keep the nodes in this instance
  26384. * @return (com.ibm.rave.core.layout.treemap.Treemap) this instance of the treemap
  26385. */
  26386. sticky$1 : function(sticky) {
  26387. this._sticky = sticky;
  26388. this._stickies = null;
  26389. return this;
  26390. },
  26391. /**
  26392. * 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))
  26393. * @return (double) the ratio
  26394. */
  26395. ratio$0 : function() {
  26396. return this._ratio;
  26397. },
  26398. /**
  26399. * 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))
  26400. * @param (double) ratio the value used to compute the score for the specified row
  26401. * @return (com.ibm.rave.core.layout.treemap.Treemap) this instance of the treemap
  26402. */
  26403. ratio$1 : function(ratio) {
  26404. this._ratio = ratio;
  26405. return this;
  26406. },
  26407. /**
  26408. * 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.
  26409. * @return (String) the mode
  26410. */
  26411. mode$0 : function() {
  26412. return this._mode;
  26413. },
  26414. /**
  26415. * 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.
  26416. * @param (String) mode the mode to use to organize the treemap layout
  26417. * @return (com.ibm.rave.core.layout.treemap.Treemap) this instance of the treemap
  26418. */
  26419. mode$1 : function(mode) {
  26420. this._mode = mode + "";
  26421. return this;
  26422. },
  26423. /** @expose */
  26424. create : function(a0) {
  26425. var args = arguments;
  26426. return this.create$0(a0);
  26427. },
  26428. /** @expose */
  26429. size : function(a0) {
  26430. var args = arguments;
  26431. if (args.length == 0) {
  26432. return this.size$0();
  26433. }
  26434. return this.size$1(a0);
  26435. },
  26436. /** @expose */
  26437. padding : function(a0) {
  26438. var args = arguments;
  26439. if (args.length == 0) {
  26440. return this.padding$0();
  26441. }
  26442. if (args.length == 1 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]")) {
  26443. return this.padding$2(a0);
  26444. }
  26445. if (args.length == 1 && typeof a0 === "function") {
  26446. return this.padding$3(a0);
  26447. }
  26448. return this.padding$1(a0);
  26449. },
  26450. /** @expose */
  26451. round : function(a0) {
  26452. var args = arguments;
  26453. if (args.length == 0) {
  26454. return this.round$0();
  26455. }
  26456. return this.round$1(a0);
  26457. },
  26458. /** @expose */
  26459. sticky : function(a0) {
  26460. var args = arguments;
  26461. if (args.length == 0) {
  26462. return this.sticky$0();
  26463. }
  26464. return this.sticky$1(a0);
  26465. },
  26466. /** @expose */
  26467. ratio : function(a0) {
  26468. var args = arguments;
  26469. if (args.length == 0) {
  26470. return this.ratio$0();
  26471. }
  26472. return this.ratio$1(a0);
  26473. },
  26474. /** @expose */
  26475. mode : function(a0) {
  26476. var args = arguments;
  26477. if (args.length == 0) {
  26478. return this.mode$0();
  26479. }
  26480. return this.mode$1(a0);
  26481. }
  26482. });
  26483. // $source: com/ibm/rave/core/internal/layout/treemap/TreemapRect
  26484. /************************************************************************
  26485. ** IBM Confidential
  26486. **
  26487. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  26488. **
  26489. ** (C) Copyright IBM Corp. 2017
  26490. **
  26491. ** The source code for this program is not published or otherwise divested of its trade secrets,
  26492. ** irrespective of what has been deposited with the U.S. Copyright Office.
  26493. ************************************************************************/
  26494. // GENERATED
  26495. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  26496. var com_ibm_rave_core_internal_layout_treemap_TreemapRect = com_ibm_rave_core_nativeImpl_Declare({
  26497. x : 0, dx : 0, y : 0, dy : 0,
  26498. constructor : function() {
  26499. this.x = 0;
  26500. this.y = 0;
  26501. this.dx = 0;
  26502. this.dy = 0;
  26503. }
  26504. });
  26505. // $source: com/ibm/rave/core/internal/layout/treemap/Row
  26506. /************************************************************************
  26507. ** IBM Confidential
  26508. **
  26509. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  26510. **
  26511. ** (C) Copyright IBM Corp. 2017
  26512. **
  26513. ** The source code for this program is not published or otherwise divested of its trade secrets,
  26514. ** irrespective of what has been deposited with the U.S. Copyright Office.
  26515. ************************************************************************/
  26516. // GENERATED
  26517. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  26518. /**
  26519. * A treemap row... it's just an Array with an area... clearly
  26520. * @author Bryan
  26521. */
  26522. var com_ibm_rave_core_internal_layout_treemap_Row = com_ibm_rave_core_nativeImpl_Declare(Array, {
  26523. area : 0
  26524. });
  26525. // $source: com/ibm/rave/core/layout/PieLayout
  26526. /************************************************************************
  26527. ** IBM Confidential
  26528. **
  26529. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  26530. **
  26531. ** (C) Copyright IBM Corp. 2017
  26532. **
  26533. ** The source code for this program is not published or otherwise divested of its trade secrets,
  26534. ** irrespective of what has been deposited with the U.S. Copyright Office.
  26535. ************************************************************************/
  26536. // GENERATED
  26537. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  26538. //@import com/ibm/rave/core/Rave (runtime) // sum
  26539. //@import com/ibm/rave/core/arrays/Range (runtime) // create
  26540. //@import com/ibm/rave/core/layout/SliceData (runtime) // new
  26541. var com_ibm_rave_core_layout_PieLayout = rave_externs["PieLayout"] = com_ibm_rave_core_nativeImpl_Declare({
  26542. //_value : null,
  26543. //_sort : null,
  26544. //_endAngle : null,
  26545. _startAngle : 0,
  26546. _padAngle : 0,
  26547. sortDefined : false,
  26548. _$functionClassMethod : function() {
  26549. var _$self = function(data, index, groupIndex) {
  26550. return _$self.pie(data, index);
  26551. };
  26552. return _$self;
  26553. },
  26554. constructor : function() {
  26555. this._value = com_ibm_rave_core_layout_PieLayout.VALUE;
  26556. this._endAngle = 6.283185307179586;
  26557. },
  26558. /**
  26559. * 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.
  26560. * @param (Array) info Data used to construct arc data
  26561. * @return (com.ibm.rave.core.layout.SliceData[]) sliceData Slice data used to construct the arcs
  26562. */
  26563. pie$0 : function(info) {
  26564. return this.pie$1(info, -1);
  26565. },
  26566. /**
  26567. * 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.
  26568. * @param (Array) data Data used to construct arc data
  26569. * @return (com.ibm.rave.core.layout.SliceData[]) sliceData Slice data used to construct the arcs
  26570. */
  26571. pie$1 : function(data, index) {
  26572. var values;
  26573. var self = this;
  26574. var n = data.length;
  26575. values = data.map(function(currentValue, i, array) {
  26576. return Math.abs(+ (self._value.call(self, currentValue, i, -1)));
  26577. });
  26578. var a = + ((typeof this._startAngle === "function") ? (this._startAngle).call(this, data, index, -1) : this._startAngle);
  26579. var da = + ((typeof this._endAngle === "function") ? (this._endAngle).call(this, data, index, -1) : this._endAngle) - a;
  26580. var p = Math.min(Math.abs(da) / n, + ((typeof this._padAngle === "function") ? (this._padAngle).call(this, data, index, -1) : this._padAngle));
  26581. var pa = p * (da < 0 ? -1 : 1);
  26582. var k = ((com_ibm_rave_core_Rave.sum(values))) == 0.0 ? 0.0 : (da - n * pa) / ((com_ibm_rave_core_Rave.sum(values)));
  26583. var indexArr = com_ibm_rave_core_arrays_Range.create(data.length);
  26584. if (!this.sortDefined) {
  26585. indexArr.sort(function(i, j) {
  26586. return (~~ (values[~~ (j)]) - values[~~ (i)]);
  26587. });
  26588. } else if (this.sortDefined && this._sort) {
  26589. indexArr.sort(function(i, j) {
  26590. return self._sort(data[~~ (i)], data[~~ (j)]);
  26591. });
  26592. }
  26593. var arcs = [];
  26594. for (var __i_enFor0 = 0, __exp_enFor0 = indexArr, __len_enFor0 = __exp_enFor0.length;
  26595. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  26596. var j = __exp_enFor0[__i_enFor0];
  26597. var sd = new com_ibm_rave_core_layout_SliceData();
  26598. var v = sd.value = values[~~ (j)];
  26599. sd.data = data[~~ (j)];
  26600. sd.startAngle = a;
  26601. sd.endAngle = a += + (v) * k + pa;
  26602. sd.innerRadius = 0;
  26603. sd.outerRadius = 0;
  26604. sd.padAngle = p;
  26605. arcs[~~ (j)] = sd;
  26606. }
  26607. return arcs;
  26608. },
  26609. /**
  26610. * sets the start angle value function, function that will be called by the arc class to get the value on start angle
  26611. * @param (com.ibm.rave.core.selector.ValueFunction) startAngleFn the start angle function
  26612. * @return (com.ibm.rave.core.layout.PieLayout) this
  26613. */
  26614. startAngle$0 : function(startAngleFn) {
  26615. this._startAngle = startAngleFn;
  26616. return this;
  26617. },
  26618. /**
  26619. * sets the start angle value
  26620. * @param (Object) value the start angle value
  26621. * @return (com.ibm.rave.core.layout.PieLayout) this
  26622. */
  26623. startAngle$1 : function(value) {
  26624. this._startAngle = value;
  26625. return this;
  26626. },
  26627. /**
  26628. * gets the start angle value function
  26629. * @return (Object) the value function
  26630. */
  26631. startAngle$2 : function() {
  26632. return this._startAngle;
  26633. },
  26634. /**
  26635. * sets the end angle value function, function that will be called by the arc class to get the value on end angle
  26636. * @param (com.ibm.rave.core.selector.ValueFunction) endAngleFn the end angle function
  26637. * @return (com.ibm.rave.core.layout.PieLayout) this
  26638. */
  26639. endAngle$0 : function(endAngleFn) {
  26640. this._endAngle = endAngleFn;
  26641. return this;
  26642. },
  26643. /**
  26644. * sets the end angle value
  26645. * @param (Object) value the end angle value
  26646. * @return (com.ibm.rave.core.layout.PieLayout) this
  26647. */
  26648. endAngle$1 : function(value) {
  26649. this._endAngle = value;
  26650. return this;
  26651. },
  26652. /**
  26653. * gets the end angle value function
  26654. * @return (Object) the value function
  26655. */
  26656. endAngle$2 : function() {
  26657. return this._endAngle;
  26658. },
  26659. /**
  26660. * sets the function for computing data values, function that will be called by the PieLayout class to get the data values
  26661. * @param (com.ibm.rave.core.selector.ValueFunction) valueFn The function for computing data values
  26662. * @return (com.ibm.rave.core.layout.PieLayout) this
  26663. */
  26664. value$0 : function(valueFn) {
  26665. this._value = valueFn;
  26666. return this;
  26667. },
  26668. /**
  26669. * gets the data value function
  26670. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  26671. */
  26672. value$1 : function() {
  26673. return this._value;
  26674. },
  26675. /**
  26676. * sets the pad Angle value function, function that will be called by the arc class to get the value on pad Angle
  26677. * @param (com.ibm.rave.core.selector.ValueFunction) padAngleFn the padAngle function
  26678. * @return (com.ibm.rave.core.layout.PieLayout) this
  26679. */
  26680. padAngle$0 : function(padAngleFn) {
  26681. this._padAngle = padAngleFn;
  26682. return this;
  26683. },
  26684. /**
  26685. * sets the pad Angle value
  26686. * @param (Object) value the pad Angle value
  26687. * @return (com.ibm.rave.core.layout.PieLayout) this
  26688. */
  26689. padAngle$1 : function(value) {
  26690. this._padAngle = value;
  26691. return this;
  26692. },
  26693. /**
  26694. * gets the pad Angle value function
  26695. * @return (Object) the value function
  26696. */
  26697. padAngle$2 : function() {
  26698. return this._padAngle;
  26699. },
  26700. /**
  26701. * sets the comparator for sorting
  26702. * @param (com.ibm.rave.core.util.Comparator) sortFn the sort comparator
  26703. * @return (com.ibm.rave.core.layout.PieLayout) this
  26704. */
  26705. sort$0 : function(sortFn) {
  26706. this.sortDefined = true;
  26707. this._sort = sortFn;
  26708. return this;
  26709. },
  26710. /**
  26711. * gets the sort comparator
  26712. * @return (com.ibm.rave.core.util.Comparator) the value function
  26713. */
  26714. sort$1 : function() {
  26715. return this._sort;
  26716. },
  26717. /** @expose */
  26718. pie : function(a0, a1) {
  26719. var args = arguments;
  26720. if (args.length == 1) {
  26721. return this.pie$0(a0);
  26722. }
  26723. return this.pie$1(a0, a1);
  26724. },
  26725. /** @expose */
  26726. startAngle : function(a0) {
  26727. var args = arguments;
  26728. if (args.length == 0) {
  26729. return this.startAngle$2();
  26730. }
  26731. if (args.length == 1 && typeof a0 === "function") {
  26732. return this.startAngle$0(a0);
  26733. }
  26734. return this.startAngle$1(a0);
  26735. },
  26736. /** @expose */
  26737. endAngle : function(a0) {
  26738. var args = arguments;
  26739. if (args.length == 0) {
  26740. return this.endAngle$2();
  26741. }
  26742. if (args.length == 1 && typeof a0 === "function") {
  26743. return this.endAngle$0(a0);
  26744. }
  26745. return this.endAngle$1(a0);
  26746. },
  26747. /** @expose */
  26748. value : function(a0) {
  26749. var args = arguments;
  26750. if (args.length == 0) {
  26751. return this.value$1();
  26752. }
  26753. return this.value$0(a0);
  26754. },
  26755. /** @expose */
  26756. padAngle : function(a0) {
  26757. var args = arguments;
  26758. if (args.length == 0) {
  26759. return this.padAngle$2();
  26760. }
  26761. if (args.length == 1 && typeof a0 === "function") {
  26762. return this.padAngle$0(a0);
  26763. }
  26764. return this.padAngle$1(a0);
  26765. },
  26766. /** @expose */
  26767. sort : function(a0) {
  26768. var args = arguments;
  26769. if (args.length == 0) {
  26770. return this.sort$1();
  26771. }
  26772. return this.sort$0(a0);
  26773. }
  26774. });
  26775. /**
  26776. * Default value function for value calculation.
  26777. */
  26778. com_ibm_rave_core_layout_PieLayout.VALUE = function(data, index, groupIndex) {
  26779. return Math.abs(+ (data));
  26780. };
  26781. // $source: com/ibm/rave/core/layout/SliceData
  26782. /************************************************************************
  26783. ** IBM Confidential
  26784. **
  26785. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  26786. **
  26787. ** (C) Copyright IBM Corp. 2017
  26788. **
  26789. ** The source code for this program is not published or otherwise divested of its trade secrets,
  26790. ** irrespective of what has been deposited with the U.S. Copyright Office.
  26791. ************************************************************************/
  26792. // GENERATED
  26793. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  26794. //@import com/ibm/rave/core/svg/ArcData (loadtime) // superclass
  26795. var com_ibm_rave_core_layout_SliceData = rave_externs["SliceData"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_svg_ArcData, {
  26796. /** @expose */
  26797. value : null,
  26798. /** @expose */
  26799. data : null
  26800. });
  26801. // $source: com/ibm/rave/core/layout/HistogramLayout
  26802. /************************************************************************
  26803. ** IBM Confidential
  26804. **
  26805. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  26806. **
  26807. ** (C) Copyright IBM Corp. 2017
  26808. **
  26809. ** The source code for this program is not published or otherwise divested of its trade secrets,
  26810. ** irrespective of what has been deposited with the U.S. Copyright Office.
  26811. ************************************************************************/
  26812. // GENERATED
  26813. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  26814. //@import com/ibm/rave/core/arrays/Bisector (runtime) // Bisector
  26815. //@import com/ibm/rave/core/arrays/MinMax (runtime) // min, max
  26816. /**
  26817. * Histogram layout shows the distribution of data by grouping discrete data points into bins
  26818. */
  26819. var com_ibm_rave_core_layout_HistogramLayout = rave_externs["HistogramLayout"] = com_ibm_rave_core_nativeImpl_Declare({
  26820. //valuerFn : null,
  26821. //ranger : null,
  26822. //binner : null,
  26823. freqencyVal : true,
  26824. _$functionClassMethod : function() {
  26825. var _$self = function(data, index, groupIndex) {
  26826. return _$self.histogram(data, index);
  26827. };
  26828. return _$self;
  26829. },
  26830. constructor : function() {
  26831. this.valuerFn = com_ibm_rave_core_layout_HistogramLayout.DEFAULT_VALUER_FN;
  26832. this.ranger = com_ibm_rave_core_layout_HistogramLayout.RANGER_DEFAULT_FN;
  26833. this.binner = com_ibm_rave_core_layout_HistogramLayout.DEFAULT_BINNER_FN;
  26834. },
  26835. /**
  26836. * 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.
  26837. * @param (Array) data The data to be processed
  26838. * @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
  26839. */
  26840. histogram$0 : function(data) {
  26841. return this.histogram$1(data, 0);
  26842. },
  26843. /**
  26844. * 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.
  26845. * @param (Array) data The data to be processed
  26846. * @param (int) index The index that is passed along to the range and bin functions
  26847. * @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
  26848. */
  26849. histogram$1 : function(data, index) {
  26850. var bins = [];
  26851. var values = data.map(this.valuerFn);
  26852. var range = this.ranger.call(this, values, index, -1);
  26853. var thresholds = this.binner.call(this, range, values, index);
  26854. var bin;
  26855. var i = -1;
  26856. var n = values.length, m = thresholds.length - 1;
  26857. var k = this.freqencyVal ? 1 : 1 / n, x;
  26858. while (++i < m) {
  26859. bin = [];
  26860. bins[i] = bin;
  26861. bin["dx"] = + (thresholds[i + 1]) - (bin["x"] = + (thresholds[i]));
  26862. bin["y"] = 0;
  26863. }
  26864. if (m > 0) {
  26865. i = -1;
  26866. while (++i < n) {
  26867. x = + (values[i]);
  26868. if (x >= + (range[0]) && x <= + (range[1])) {
  26869. bin = bins[com_ibm_rave_core_arrays_Bisector.bisect(thresholds, (x), 1, m) - 1];
  26870. bin["y"] += k;
  26871. bin.push(data[i]);
  26872. }
  26873. }
  26874. }
  26875. return bins;
  26876. },
  26877. layout_histogramRange : function(values) {
  26878. return [com_ibm_rave_core_arrays_MinMax.min(values), com_ibm_rave_core_arrays_MinMax.max(values)];
  26879. },
  26880. /**
  26881. * Determines if the histogram's `y` value is a count (frequency) or a probability (density). The default value is true.
  26882. * @return (boolean) Whether the calculation is using frequency or density
  26883. */
  26884. frequency$0 : function() {
  26885. return this.freqencyVal;
  26886. },
  26887. /**
  26888. * Specifies whether the histogram's `y` value is a count (frequency) or a probability (density). The default value is true.
  26889. * @param (java.lang.Boolean) x The value to set frequency to.
  26890. * @return (com.ibm.rave.core.layout.HistogramLayout) this
  26891. */
  26892. frequency$1 : function(x) {
  26893. this.freqencyVal = (x);
  26894. return this;
  26895. },
  26896. /**
  26897. * 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.
  26898. * @return (com.ibm.rave.core.layout.HistogramLayout.HistogramBinSturges) binner
  26899. */
  26900. bins$0 : function() {
  26901. return this.binner;
  26902. },
  26903. /**
  26904. * 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.
  26905. * @param (Number) x the range of values will be split uniformly into the given number of bins
  26906. * @return (com.ibm.rave.core.layout.HistogramLayout) this layout
  26907. */
  26908. bins$1 : function(x) {
  26909. this.binner = function(range, values, index) {
  26910. return com_ibm_rave_core_layout_HistogramLayout.layout_histogramBinFixed(range, (x));
  26911. };
  26912. return this;
  26913. },
  26914. /**
  26915. * 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.
  26916. * @param (Object) x An array of threshold values, or a function to call back
  26917. * @return (com.ibm.rave.core.layout.HistogramLayout) this layout
  26918. */
  26919. bins$2 : function(x) {
  26920. if (typeof x === "function") {
  26921. this.binner = x;
  26922. } else {
  26923. this.binner = function(range, values, index) {
  26924. return x;
  26925. };
  26926. }
  26927. return this;
  26928. },
  26929. /**
  26930. * Gets the range of the histogram. The default range is the extent (minimum and maximum) of the values.
  26931. * @return (com.ibm.rave.core.selector.ValueFunction) the ranger function
  26932. */
  26933. range$0 : function() {
  26934. return this.ranger;
  26935. },
  26936. /**
  26937. * 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.
  26938. * @param (Array) range the range
  26939. * @return (com.ibm.rave.core.layout.HistogramLayout) this layout
  26940. */
  26941. range$1 : function(range) {
  26942. this.ranger = function(data, index, groupIndex) {
  26943. return range;
  26944. };
  26945. return this;
  26946. },
  26947. /**
  26948. * 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.
  26949. * @param (com.ibm.rave.core.selector.ValueFunction) fn the range function
  26950. * @return (com.ibm.rave.core.layout.HistogramLayout) this layout
  26951. */
  26952. range$2 : function(fn) {
  26953. this.ranger = fn;
  26954. return this;
  26955. },
  26956. /**
  26957. * 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.
  26958. * @return (com.ibm.rave.core.collections.ArrayEx.ArrayValueFunction) teh vlaue function
  26959. */
  26960. value$0 : function() {
  26961. return this.valuerFn;
  26962. },
  26963. /**
  26964. * Specifies how to extract a value from the associated data. The default value function is `Number`, which is equivalent to the identity function.
  26965. * @param (com.ibm.rave.core.collections.ArrayEx.ArrayValueFunction) x the value function
  26966. * @return (com.ibm.rave.core.layout.HistogramLayout) this layout
  26967. */
  26968. value$1 : function(x) {
  26969. this.valuerFn = x;
  26970. return this;
  26971. },
  26972. /** @expose */
  26973. histogram : function(a0, a1) {
  26974. var args = arguments;
  26975. if (args.length == 1) {
  26976. return this.histogram$0(a0);
  26977. }
  26978. return this.histogram$1(a0, a1);
  26979. },
  26980. /** @expose */
  26981. frequency : function(a0) {
  26982. var args = arguments;
  26983. if (args.length == 0) {
  26984. return this.frequency$0();
  26985. }
  26986. return this.frequency$1(a0);
  26987. },
  26988. /** @expose */
  26989. bins : function(a0) {
  26990. var args = arguments;
  26991. if (args.length == 0) {
  26992. return this.bins$0();
  26993. }
  26994. if (args.length == 1 && (a0 == null || typeof a0 === "number")) {
  26995. return this.bins$1(a0);
  26996. }
  26997. return this.bins$2(a0);
  26998. },
  26999. /** @expose */
  27000. range : function(a0) {
  27001. var args = arguments;
  27002. if (args.length == 0) {
  27003. return this.range$0();
  27004. }
  27005. if (args.length == 1 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]")) {
  27006. return this.range$1(a0);
  27007. }
  27008. return this.range$2(a0);
  27009. },
  27010. /** @expose */
  27011. value : function(a0) {
  27012. var args = arguments;
  27013. if (args.length == 0) {
  27014. return this.value$0();
  27015. }
  27016. return this.value$1(a0);
  27017. }
  27018. });
  27019. com_ibm_rave_core_layout_HistogramLayout.layout_histogramBinFixed = function(range, n) {
  27020. var x = -1;
  27021. var b = + (range[0]);
  27022. var m = (+ (range[1]) - b) / n;
  27023. var f = [];
  27024. while (++x <= n) {
  27025. f[x] = m * x + b;
  27026. }
  27027. return f;
  27028. };
  27029. com_ibm_rave_core_layout_HistogramLayout.LN2 = Math.log(2);
  27030. com_ibm_rave_core_layout_HistogramLayout.RANGER_DEFAULT_FN = function(values, index, groupIndex) {
  27031. return [com_ibm_rave_core_arrays_MinMax.min(values), com_ibm_rave_core_arrays_MinMax.max(values)];
  27032. };
  27033. com_ibm_rave_core_layout_HistogramLayout.DEFAULT_VALUER_FN = function(currentValue, index, array) {
  27034. return + (currentValue);
  27035. };
  27036. com_ibm_rave_core_layout_HistogramLayout.DEFAULT_BINNER_FN = function(range, values, index) {
  27037. return com_ibm_rave_core_layout_HistogramLayout.layout_histogramBinFixed(range, Math.ceil(Math.log(((values)).length) / com_ibm_rave_core_layout_HistogramLayout.LN2 + 1));
  27038. };
  27039. // $source: com/ibm/rave/core/layout/hierarchy/Hierarchy
  27040. /************************************************************************
  27041. ** IBM Confidential
  27042. **
  27043. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  27044. **
  27045. ** (C) Copyright IBM Corp. 2017
  27046. **
  27047. ** The source code for this program is not published or otherwise divested of its trade secrets,
  27048. ** irrespective of what has been deposited with the U.S. Copyright Office.
  27049. ************************************************************************/
  27050. // GENERATED
  27051. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  27052. //@import com/ibm/rave/core/layout/hierarchy/HierarchyBase (loadtime) // superclass
  27053. //@import com/ibm/rave/core/layout/hierarchy/HierarchyUtil (runtime) // revalue
  27054. /**
  27055. * 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
  27056. * @param < (Object) T > the type of HierarchyBase
  27057. */
  27058. var com_ibm_rave_core_layout_hierarchy_Hierarchy = rave_externs["Hierarchy"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_layout_hierarchy_HierarchyBase, {
  27059. /**
  27060. * c'tor
  27061. */
  27062. /** @expose */
  27063. constructor : function() {},
  27064. /**
  27065. * Re-evaluates the `value` property for the specified hierarchy.
  27066. * @param (Object) root the root node of type T
  27067. * @return (Object) the root node that was revalued
  27068. */
  27069. /** @expose */
  27070. revalue : function(root) {
  27071. return com_ibm_rave_core_layout_hierarchy_HierarchyUtil.revalue(root, this);
  27072. }
  27073. });
  27074. // $source: com/ibm/rave/core/layout/PartitionLayout
  27075. /************************************************************************
  27076. ** IBM Confidential
  27077. **
  27078. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  27079. **
  27080. ** (C) Copyright IBM Corp. 2017
  27081. **
  27082. ** The source code for this program is not published or otherwise divested of its trade secrets,
  27083. ** irrespective of what has been deposited with the U.S. Copyright Office.
  27084. ************************************************************************/
  27085. // GENERATED
  27086. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  27087. //@import com/ibm/rave/core/layout/hierarchy/HierarchyBase (loadtime) // superclass
  27088. /**
  27089. * 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
  27090. */
  27091. var com_ibm_rave_core_layout_PartitionLayout = rave_externs["PartitionLayout"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_layout_hierarchy_HierarchyBase, {
  27092. //sizeVal : null,
  27093. constructor : function() {
  27094. this.sizeVal = [1, 1];
  27095. {}
  27096. },
  27097. position : function(node, x, dx, dy) {
  27098. var children = node["children"];
  27099. node["x"] = x;
  27100. node["y"] = node["depth"] * dy;
  27101. node["dx"] = dx;
  27102. node["dy"] = dy;
  27103. var n = 0;
  27104. var localdx = dx;
  27105. var localx = x;
  27106. if (children && children.length > 0) {
  27107. n = children.length;
  27108. var i = -1;
  27109. var c;
  27110. var d = 0;
  27111. localdx = (node["value"]) ? localdx / node["value"] : 0;
  27112. while (++i < n) {
  27113. c = children[i];
  27114. d = c["value"] * localdx;
  27115. this.position(c, localx, d, dy);
  27116. localx += d;
  27117. }
  27118. }
  27119. },
  27120. depth : function(node) {
  27121. var children = node["children"];
  27122. var d = 0;
  27123. if (children && children.length > 0) {
  27124. var n = children.length;
  27125. var i = -1;
  27126. while (++i < n) {
  27127. d = Math.max(d, this.depth(children[i]));
  27128. }
  27129. }
  27130. return 1 + d;
  27131. },
  27132. /**
  27133. * Returns the current size, which defaults to 1×1
  27134. * @return (double[]) return the current size
  27135. */
  27136. size$0 : function() {
  27137. return this.sizeVal;
  27138. },
  27139. /**
  27140. * Sets the available layout size to the specified two-element array of numbers representing x and y.
  27141. * @param (double[]) newSize the size of the layout
  27142. * @return (com.ibm.rave.core.layout.PartitionLayout) this Layout
  27143. */
  27144. size$1 : function(newSize) {
  27145. this.sizeVal = newSize;
  27146. return this;
  27147. },
  27148. /**
  27149. * 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.
  27150. * @param (Object) d the root node
  27151. * @return (Array) list of all the cluster nodes
  27152. */
  27153. create$0 : function(d) {
  27154. var nodes = com_ibm_rave_core_layout_hierarchy_HierarchyBase.prototype.create.call(this, d);
  27155. this.position(nodes[0], 0, this.sizeVal[0], this.sizeVal[1] / this.depth(nodes[0]));
  27156. return nodes;
  27157. },
  27158. /** @expose */
  27159. size : function(a0) {
  27160. var args = arguments;
  27161. if (args.length == 0) {
  27162. return this.size$0();
  27163. }
  27164. return this.size$1(a0);
  27165. },
  27166. /** @expose */
  27167. create : function(a0) {
  27168. var args = arguments;
  27169. return this.create$0(a0);
  27170. }
  27171. });
  27172. // $source: com/ibm/rave/core/capabilities/Capabilities
  27173. /************************************************************************
  27174. ** IBM Confidential
  27175. **
  27176. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  27177. **
  27178. ** (C) Copyright IBM Corp. 2017
  27179. **
  27180. ** The source code for this program is not published or otherwise divested of its trade secrets,
  27181. ** irrespective of what has been deposited with the U.S. Copyright Office.
  27182. ************************************************************************/
  27183. // GENERATED
  27184. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  27185. //@import com/ibm/rave/core/RegistryService (loadtime) // superclass
  27186. /**
  27187. * 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");
  27188. */
  27189. var com_ibm_rave_core_capabilities_Capabilities = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_RegistryService, {
  27190. /** @expose */
  27191. getServiceId : function() {
  27192. return "Capabilities";
  27193. }
  27194. /**
  27195. * singleton
  27196. */
  27197. //constructor : function() {}
  27198. });
  27199. /** @expose */
  27200. com_ibm_rave_core_capabilities_Capabilities.INSTANCE = new com_ibm_rave_core_capabilities_Capabilities();
  27201. // $source: com/ibm/rave/core/svg/LinePathGeneratorFactory
  27202. /************************************************************************
  27203. ** IBM Confidential
  27204. **
  27205. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  27206. **
  27207. ** (C) Copyright IBM Corp. 2017
  27208. **
  27209. ** The source code for this program is not published or otherwise divested of its trade secrets,
  27210. ** irrespective of what has been deposited with the U.S. Copyright Office.
  27211. ************************************************************************/
  27212. // GENERATED
  27213. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  27214. //@import com/ibm/rave/core/svg/LineRadial (runtime) // createLine
  27215. //@import com/ibm/rave/core/internal/util/Identity (runtime) // create
  27216. //@import com/ibm/rave/core/svg/SVGLine (runtime) // createLine
  27217. /**
  27218. * Line Path Generator Factory
  27219. */
  27220. var com_ibm_rave_core_svg_LinePathGeneratorFactory = rave_externs["LinePathGeneratorFactory"] = com_ibm_rave_core_nativeImpl_Declare({
  27221. _$functionClassMethod : function() {
  27222. var _$self = /**
  27223. * 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)
  27224. * @return (com.ibm.rave.core.svg.LinePathGenerator) line path generator {@link (com.ibm.rave.core.svg.LinePathGenerator) LinePathGenerator}
  27225. */
  27226. function() {
  27227. var identity = com_ibm_rave_core_internal_util_Identity.create();
  27228. return com_ibm_rave_core_svg_SVGLine.createLine(identity);
  27229. };
  27230. return _$self;
  27231. },
  27232. /**
  27233. * 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.
  27234. * @return (com.ibm.rave.core.svg.LineRadial.RadialLinePathGenerator) svg path generator
  27235. */
  27236. /** @expose */
  27237. radial : function() {
  27238. return com_ibm_rave_core_svg_LineRadial.createLine();
  27239. }
  27240. });
  27241. // $source: com/ibm/rave/core/svg/LineRadial
  27242. /************************************************************************
  27243. ** IBM Confidential
  27244. **
  27245. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  27246. **
  27247. ** (C) Copyright IBM Corp. 2017
  27248. **
  27249. ** The source code for this program is not published or otherwise divested of its trade secrets,
  27250. ** irrespective of what has been deposited with the U.S. Copyright Office.
  27251. ************************************************************************/
  27252. // GENERATED
  27253. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  27254. //@import com/ibm/rave/core/svg/LinePathGenerator (loadtime) // superclass
  27255. /**
  27256. * 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.
  27257. */
  27258. var com_ibm_rave_core_svg_LineRadial = rave_externs["LineRadial"] = com_ibm_rave_core_nativeImpl_Declare({
  27259. });
  27260. /**
  27261. * 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.
  27262. * @return (com.ibm.rave.core.svg.LineRadial.RadialLinePathGenerator) a radial line path generator {@link (com.ibm.rave.core.svg.LinePathGenerator) LinePathGenerator}
  27263. */
  27264. /** @expose */
  27265. com_ibm_rave_core_svg_LineRadial.createLine = function() {
  27266. return new com_ibm_rave_core_svg_LineRadial.RadialLinePathGenerator(com_ibm_rave_core_svg_LineRadial.r2_svg_lineRadial);
  27267. };
  27268. /**
  27269. * Radial Line path generator
  27270. */
  27271. com_ibm_rave_core_svg_LineRadial.RadialLinePathGenerator = rave_externs["RadialLinePathGenerator"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_svg_LinePathGenerator, {
  27272. /**
  27273. * Constructor constructs a Radial Line path generator
  27274. * @param (com.ibm.rave.core.selector.ValueFunction) projection the projection to set on this line generator
  27275. */
  27276. /** @expose */
  27277. constructor : function(projection) {
  27278. },
  27279. /**
  27280. * Gets the radius-accessor, it can be a function or constant.
  27281. * @return (Object) the radius-accessor
  27282. */
  27283. radius$0 : com_ibm_rave_core_svg_LinePathGenerator.prototype.x$0,
  27284. /**
  27285. * 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
  27286. * @param (com.ibm.rave.core.selector.ValueFunction) valFn the radius-accessor
  27287. * @return (com.ibm.rave.core.svg.LineRadial.RadialLinePathGenerator) the line path generator
  27288. */
  27289. radius$1 : com_ibm_rave_core_svg_LinePathGenerator.prototype.x$1,
  27290. /**
  27291. * Sets the radius-accessor to the constant.
  27292. * @param (double) xNewVal the constant value of radius
  27293. * @return (com.ibm.rave.core.svg.LineRadial.RadialLinePathGenerator) the line path generator
  27294. */
  27295. radius$2 : com_ibm_rave_core_svg_LinePathGenerator.prototype.x$2,
  27296. /**
  27297. * gets the angle-accessor, it can be a a function or constant.
  27298. * @return (Object) the angle-accessor
  27299. */
  27300. angle$0 : com_ibm_rave_core_svg_LinePathGenerator.prototype.y$0,
  27301. /**
  27302. * 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
  27303. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The angle-accessor
  27304. * @return (com.ibm.rave.core.svg.LineRadial.RadialLinePathGenerator) the line path generator
  27305. */
  27306. angle$1 : com_ibm_rave_core_svg_LinePathGenerator.prototype.y$1,
  27307. /**
  27308. * Sets the anglr-accessor to the constant.
  27309. * @param (double) yNewVal The constant value of angle
  27310. * @return (com.ibm.rave.core.svg.LineRadial.RadialLinePathGenerator) the line path generator
  27311. */
  27312. angle$2 : com_ibm_rave_core_svg_LinePathGenerator.prototype.y$2,
  27313. /** @expose */
  27314. radius : function(a0) {
  27315. var args = arguments;
  27316. if (args.length == 0) {
  27317. return this.radius$0();
  27318. }
  27319. if (args.length == 1 && typeof a0 === "function") {
  27320. return this.radius$1(a0);
  27321. }
  27322. return this.radius$2(a0);
  27323. },
  27324. /** @expose */
  27325. angle : function(a0) {
  27326. var args = arguments;
  27327. if (args.length == 0) {
  27328. return this.angle$0();
  27329. }
  27330. if (args.length == 1 && typeof a0 === "function") {
  27331. return this.angle$1(a0);
  27332. }
  27333. return this.angle$2(a0);
  27334. }
  27335. });
  27336. delete com_ibm_rave_core_svg_LineRadial.RadialLinePathGenerator.prototype.x;
  27337. delete com_ibm_rave_core_svg_LineRadial.RadialLinePathGenerator.prototype.x$0;
  27338. delete com_ibm_rave_core_svg_LineRadial.RadialLinePathGenerator.prototype.x$1;
  27339. delete com_ibm_rave_core_svg_LineRadial.RadialLinePathGenerator.prototype.x$2;
  27340. delete com_ibm_rave_core_svg_LineRadial.RadialLinePathGenerator.prototype.y;
  27341. delete com_ibm_rave_core_svg_LineRadial.RadialLinePathGenerator.prototype.y$0;
  27342. delete com_ibm_rave_core_svg_LineRadial.RadialLinePathGenerator.prototype.y$1;
  27343. delete com_ibm_rave_core_svg_LineRadial.RadialLinePathGenerator.prototype.y$2;
  27344. /**
  27345. * Creates the projection to set on this generator
  27346. */
  27347. /** @expose */
  27348. com_ibm_rave_core_svg_LineRadial.r2_svg_lineRadial = function(data, index, groupIndex) {
  27349. var point;
  27350. var points = data;
  27351. var i = -1, n = points.length;
  27352. var r, a;
  27353. while (++i < n) {
  27354. point = points[i];
  27355. r = point[0];
  27356. a = point[1] - 1.5707963267948966;
  27357. point[0] = r * Math.cos(a);
  27358. point[1] = r * Math.sin(a);
  27359. }
  27360. return points;
  27361. };
  27362. // $source: com/ibm/rave/core/svg/AreaPathGeneratorFactory
  27363. /************************************************************************
  27364. ** IBM Confidential
  27365. **
  27366. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  27367. **
  27368. ** (C) Copyright IBM Corp. 2017
  27369. **
  27370. ** The source code for this program is not published or otherwise divested of its trade secrets,
  27371. ** irrespective of what has been deposited with the U.S. Copyright Office.
  27372. ************************************************************************/
  27373. // GENERATED
  27374. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  27375. //@import com/ibm/rave/core/svg/RadialAreaPathGenerator (runtime) // createRadialAreaGenerator
  27376. //@import com/ibm/rave/core/internal/util/Identity (runtime) // create
  27377. //@import com/ibm/rave/core/svg/AreaPathGenerator (runtime) // new
  27378. /**
  27379. * Area Path Generator Factory
  27380. */
  27381. var com_ibm_rave_core_svg_AreaPathGeneratorFactory = rave_externs["AreaPathGeneratorFactory"] = com_ibm_rave_core_nativeImpl_Declare({
  27382. _$functionClassMethod : function() {
  27383. var _$self = /**
  27384. * 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.
  27385. * @return (com.ibm.rave.core.svg.AreaPathGenerator) area path generator {@link (com.ibm.rave.core.svg.AreaPathGenerator) AreaPathGenerator}
  27386. */
  27387. function() {
  27388. var identity = com_ibm_rave_core_internal_util_Identity.create();
  27389. return new com_ibm_rave_core_svg_AreaPathGenerator(identity);
  27390. };
  27391. return _$self;
  27392. },
  27393. /**
  27394. * 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.
  27395. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) svg path generator
  27396. */
  27397. /** @expose */
  27398. radial : function() {
  27399. return com_ibm_rave_core_svg_RadialAreaPathGenerator.createRadialAreaGenerator();
  27400. }
  27401. });
  27402. // $source: com/ibm/rave/core/svg/AreaPathGenerator
  27403. /************************************************************************
  27404. ** IBM Confidential
  27405. **
  27406. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  27407. **
  27408. ** (C) Copyright IBM Corp. 2017
  27409. **
  27410. ** The source code for this program is not published or otherwise divested of its trade secrets,
  27411. ** irrespective of what has been deposited with the U.S. Copyright Office.
  27412. ************************************************************************/
  27413. // GENERATED
  27414. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  27415. //@import com/ibm/rave/core/svg/SVGLine (runtime) // SVGLine
  27416. /**
  27417. * 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.
  27418. */
  27419. var com_ibm_rave_core_svg_AreaPathGenerator = rave_externs["AreaPathGenerator"] = com_ibm_rave_core_nativeImpl_Declare({
  27420. //fx0 : null,
  27421. //fx1 : null,
  27422. //fy0 : null,
  27423. //fy1 : null,
  27424. //definedFn : null,
  27425. //interpolateFn : null,
  27426. //interpolateKey : null,
  27427. //interpolateReverseFn : null,
  27428. //L : null,
  27429. //projectionFn : null,
  27430. x0Val : 0,
  27431. y0Val : 0,
  27432. x1Val : 0,
  27433. y1Val : 0,
  27434. tensionVal : 0.7,
  27435. _$functionClassMethod : function() {
  27436. var _$self = /**
  27437. * Returns the path data string for the specified array of data elements, or null if the path is empty.
  27438. * @param (Object) this The context for this function
  27439. * @param (Array) data The data to use while generating the area
  27440. * @return (String) the svg path string
  27441. */
  27442. function(data) {
  27443. var segments = [];
  27444. var points0 = [];
  27445. var points1 = [];
  27446. var i = -1;
  27447. var n = data.length;
  27448. var d;
  27449. n = data.length;
  27450. var xa, ya;
  27451. var localFx1;
  27452. if (_$self.fx0 && _$self.fx0 == _$self.fx1) {
  27453. localFx1 = function(data, index, groupIndex) {
  27454. return xa;
  27455. };
  27456. } else {
  27457. localFx1 = _$self.fx1;
  27458. }
  27459. var localFy1;
  27460. if (_$self.fy0 && _$self.fy0 == _$self.fy1) {
  27461. localFy1 = function(data, index, groupIndex) {
  27462. return ya;
  27463. };
  27464. } else {
  27465. localFy1 = _$self.fy1;
  27466. }
  27467. while (++i < n) {
  27468. d = data[i];
  27469. if (_$self.definedFn.call(this, d, i, -1)) {
  27470. xa = + (!_$self.fx0 ? _$self.x0Val : _$self.fx0.call(this, d, i, -1));
  27471. ya = + (!_$self.fy0 ? _$self.y0Val : _$self.fy0.call(this, d, i, -1));
  27472. points0.push([xa, ya]);
  27473. points1.push([+ (!localFx1 ? _$self.x1Val : localFx1.call(this, d, i, -1)), + (!localFy1 ? _$self.y1Val : localFy1.call(this, d, i, -1))]);
  27474. } else if (points0.length > 0) {
  27475. 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");
  27476. points0 = [];
  27477. points1 = [];
  27478. }
  27479. }
  27480. if (points0.length > 0) {
  27481. 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");
  27482. }
  27483. return segments.length > 0 ? segments.join("") : null;
  27484. };
  27485. return _$self;
  27486. },
  27487. constructor : function(projection) {
  27488. this.fx0 = com_ibm_rave_core_svg_SVGLine.DEFAULT_X_FN;
  27489. this.fx1 = com_ibm_rave_core_svg_SVGLine.DEFAULT_X_FN;
  27490. this.fy1 = com_ibm_rave_core_svg_SVGLine.DEFAULT_Y_FN;
  27491. this.definedFn = com_ibm_rave_core_svg_SVGLine.DEFAULT_DEFINED_FN;
  27492. this.interpolateFn = com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear;
  27493. this.interpolateKey = this.interpolateFn.key;
  27494. this.interpolateReverseFn = this.interpolateFn;
  27495. this.L = "L";
  27496. /**
  27497. * Constructor creates am AreaPathGenerator and sets the projection on it to be, the passed projection
  27498. * @param (com.ibm.rave.core.selector.ValueFunction) projection The projection to use while generating the area
  27499. */
  27500. {
  27501. this.projectionFn = projection;
  27502. }
  27503. },
  27504. /**
  27505. * Returns the current x1-accessor. this can be ValueFunction of a Number
  27506. * @return (Object) x1-accessor
  27507. */
  27508. x$0 : function() {
  27509. if (this.fx1) {
  27510. return this.fx1;
  27511. }
  27512. return this.x1Val;
  27513. },
  27514. /**
  27515. * 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:
  27516. * @param (double) xVal The constant to use
  27517. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  27518. */
  27519. x$1 : function(xVal) {
  27520. this.fx0 = this.fx1 = null;
  27521. this.x0Val = this.x1Val = xVal;
  27522. return this;
  27523. },
  27524. /**
  27525. * 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:
  27526. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  27527. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  27528. */
  27529. x$2 : function(valFn) {
  27530. this.fx0 = this.fx1 = valFn;
  27531. return this;
  27532. },
  27533. /**
  27534. * Returns the current x0-accessor. this can be ValueFunction of a Number
  27535. * @return (Object) x0-accessor
  27536. */
  27537. x0$0 : function() {
  27538. if (this.fx0) {
  27539. return this.fx0;
  27540. }
  27541. return this.x0Val;
  27542. },
  27543. /**
  27544. * 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:
  27545. * @param (double) xVal The constant to use
  27546. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  27547. */
  27548. x0$1 : function(xVal) {
  27549. this.fx0 = null;
  27550. this.x0Val = xVal;
  27551. return this;
  27552. },
  27553. /**
  27554. * 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:
  27555. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  27556. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  27557. */
  27558. x0$2 : function(valFn) {
  27559. this.fx0 = valFn;
  27560. return this;
  27561. },
  27562. /**
  27563. * Returns the current x1-accessor. this can be ValueFunction of a Number
  27564. * @return (Object) x1-accessor
  27565. */
  27566. x1$0 : function() {
  27567. if (this.fx1) {
  27568. return this.fx1;
  27569. }
  27570. return this.x1Val;
  27571. },
  27572. /**
  27573. * 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:
  27574. * @param (double) xVal The constant to use
  27575. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  27576. */
  27577. x1$1 : function(xVal) {
  27578. this.fx1 = null;
  27579. this.x1Val = xVal;
  27580. return this;
  27581. },
  27582. /**
  27583. * 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:
  27584. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  27585. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  27586. */
  27587. x1$2 : function(valFn) {
  27588. this.fx1 = valFn;
  27589. return this;
  27590. },
  27591. /**
  27592. * Returns the current y1-accessor. this can be ValueFunction of a Number
  27593. * @return (Object) y1-accessor
  27594. */
  27595. y$0 : function() {
  27596. if (this.fy1) {
  27597. return this.fy1;
  27598. }
  27599. return this.y1Val;
  27600. },
  27601. /**
  27602. * 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:
  27603. * @param (double) yVal The constant to use
  27604. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  27605. */
  27606. y$1 : function(yVal) {
  27607. this.fy0 = this.fy1 = null;
  27608. this.y0Val = this.y1Val = yVal;
  27609. return this;
  27610. },
  27611. /**
  27612. * 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:
  27613. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  27614. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  27615. */
  27616. y$2 : function(valFn) {
  27617. this.fy0 = this.fy1 = valFn;
  27618. return this;
  27619. },
  27620. /**
  27621. * Returns the current y0-accessor. this can be ValueFunction of a Number
  27622. * @return (Object) y0-accessor
  27623. */
  27624. y0$0 : function() {
  27625. if (this.fy0) {
  27626. return this.fy0;
  27627. }
  27628. return this.y0Val;
  27629. },
  27630. /**
  27631. * 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:
  27632. * @param (double) yVal The constant to use
  27633. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  27634. */
  27635. y0$1 : function(yVal) {
  27636. this.fy0 = null;
  27637. this.y0Val = yVal;
  27638. return this;
  27639. },
  27640. /**
  27641. * 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:
  27642. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  27643. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  27644. */
  27645. y0$2 : function(valFn) {
  27646. this.fy0 = valFn;
  27647. return this;
  27648. },
  27649. /**
  27650. * Returns the current y1-accessor. this can be ValueFunction of a Number
  27651. * @return (Object) y1-accessor
  27652. */
  27653. y1$0 : function() {
  27654. if (this.fy1) {
  27655. return this.fy1;
  27656. }
  27657. return this.y1Val;
  27658. },
  27659. /**
  27660. * 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:
  27661. * @param (double) yVal The constant to use
  27662. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  27663. */
  27664. y1$1 : function(yVal) {
  27665. this.fy1 = null;
  27666. this.y1Val = yVal;
  27667. return this;
  27668. },
  27669. /**
  27670. * 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:
  27671. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  27672. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  27673. */
  27674. y1$2 : function(valFn) {
  27675. this.fy1 = valFn;
  27676. return this;
  27677. },
  27678. /**
  27679. * Gets the accessor function that controls where the area is defined. default defined is a function() { return true; }
  27680. * @return (com.ibm.rave.core.selector.ValueFunction) the defined function
  27681. */
  27682. defined$0 : function() {
  27683. return this.definedFn;
  27684. },
  27685. /**
  27686. * 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)
  27687. * @param (com.ibm.rave.core.selector.ValueFunction) valFn the function to use to decide if a point is defined
  27688. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this Area path generator
  27689. */
  27690. defined$1 : function(valFn) {
  27691. this.definedFn = valFn;
  27692. return this;
  27693. },
  27694. /**
  27695. * Returns the current tension.
  27696. * @return (double) the tension
  27697. */
  27698. tension$0 : function() {
  27699. return this.tensionVal;
  27700. },
  27701. /**
  27702. * 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.
  27703. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this Area path generator
  27704. */
  27705. tension$1 : function(tensionNewVal) {
  27706. this.tensionVal = tensionNewVal;
  27707. return this;
  27708. },
  27709. interpolate$0 : function() {
  27710. return this.interpolateKey;
  27711. },
  27712. /**
  27713. * 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.
  27714. * @param (String) key the interpolation mode to use
  27715. * @return (com.ibm.rave.core.svg.AreaPathGenerator) the Area Path generator
  27716. */
  27717. interpolate$1 : function(key) {
  27718. this.interpolateKey = key;
  27719. this.interpolateFn = com_ibm_rave_core_svg_SVGLine.r2_svg_lineInterpolators.get(key);
  27720. if (!this.interpolateFn) {
  27721. this.interpolateFn = com_ibm_rave_core_svg_SVGLine.r2_svg_lineLinear;
  27722. this.interpolateKey = this.interpolateFn.key;
  27723. }
  27724. this.interpolateReverseFn = this.interpolateFn.reverse ? this.interpolateFn.reverse : this.interpolateFn;
  27725. this.L = this.interpolateFn.closed ? "M" : "L";
  27726. return this;
  27727. },
  27728. /**
  27729. * 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 SVGConstants.MOVETO at the start of the string is implied and should not be returned.
  27730. * @param (com.ibm.rave.core.svg.AbstractLineInterpolator) valFn the function to call to do the interpolation
  27731. * @return (com.ibm.rave.core.svg.AreaPathGenerator) the Line Path generator
  27732. */
  27733. interpolate$2 : function(valFn) {
  27734. this.interpolateKey = this.interpolateFn = valFn;
  27735. this.interpolateReverseFn = this.interpolateFn.reverse ? this.interpolateFn.reverse : this.interpolateFn;
  27736. this.L = this.interpolateFn.closed ? "M" : "L";
  27737. return this;
  27738. },
  27739. /** @expose */
  27740. x : function(a0) {
  27741. var args = arguments;
  27742. if (args.length == 0) {
  27743. return this.x$0();
  27744. }
  27745. if (args.length == 1 && typeof a0 === "function") {
  27746. return this.x$2(a0);
  27747. }
  27748. return this.x$1(a0);
  27749. },
  27750. /** @expose */
  27751. x0 : function(a0) {
  27752. var args = arguments;
  27753. if (args.length == 0) {
  27754. return this.x0$0();
  27755. }
  27756. if (args.length == 1 && typeof a0 === "function") {
  27757. return this.x0$2(a0);
  27758. }
  27759. return this.x0$1(a0);
  27760. },
  27761. /** @expose */
  27762. x1 : function(a0) {
  27763. var args = arguments;
  27764. if (args.length == 0) {
  27765. return this.x1$0();
  27766. }
  27767. if (args.length == 1 && typeof a0 === "function") {
  27768. return this.x1$2(a0);
  27769. }
  27770. return this.x1$1(a0);
  27771. },
  27772. /** @expose */
  27773. y : function(a0) {
  27774. var args = arguments;
  27775. if (args.length == 0) {
  27776. return this.y$0();
  27777. }
  27778. if (args.length == 1 && typeof a0 === "function") {
  27779. return this.y$2(a0);
  27780. }
  27781. return this.y$1(a0);
  27782. },
  27783. /** @expose */
  27784. y0 : function(a0) {
  27785. var args = arguments;
  27786. if (args.length == 0) {
  27787. return this.y0$0();
  27788. }
  27789. if (args.length == 1 && typeof a0 === "function") {
  27790. return this.y0$2(a0);
  27791. }
  27792. return this.y0$1(a0);
  27793. },
  27794. /** @expose */
  27795. y1 : function(a0) {
  27796. var args = arguments;
  27797. if (args.length == 0) {
  27798. return this.y1$0();
  27799. }
  27800. if (args.length == 1 && typeof a0 === "function") {
  27801. return this.y1$2(a0);
  27802. }
  27803. return this.y1$1(a0);
  27804. },
  27805. /** @expose */
  27806. defined : function(a0) {
  27807. var args = arguments;
  27808. if (args.length == 0) {
  27809. return this.defined$0();
  27810. }
  27811. return this.defined$1(a0);
  27812. },
  27813. /** @expose */
  27814. tension : function(a0) {
  27815. var args = arguments;
  27816. if (args.length == 0) {
  27817. return this.tension$0();
  27818. }
  27819. return this.tension$1(a0);
  27820. },
  27821. /** @expose */
  27822. interpolate : function(a0) {
  27823. var args = arguments;
  27824. if (args.length == 0) {
  27825. return this.interpolate$0();
  27826. }
  27827. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  27828. return this.interpolate$1(a0);
  27829. }
  27830. return this.interpolate$2(a0);
  27831. }
  27832. });
  27833. // $source: com/ibm/rave/core/svg/RadialAreaPathGenerator
  27834. /************************************************************************
  27835. ** IBM Confidential
  27836. **
  27837. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  27838. **
  27839. ** (C) Copyright IBM Corp. 2017
  27840. **
  27841. ** The source code for this program is not published or otherwise divested of its trade secrets,
  27842. ** irrespective of what has been deposited with the U.S. Copyright Office.
  27843. ************************************************************************/
  27844. // GENERATED
  27845. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  27846. //@import com/ibm/rave/core/svg/AreaPathGenerator (loadtime) // superclass
  27847. //@import com/ibm/rave/core/svg/LineRadial (static) // LineRadial
  27848. /**
  27849. * A Radial Area path generator
  27850. */
  27851. var com_ibm_rave_core_svg_RadialAreaPathGenerator = rave_externs["RadialAreaPathGenerator"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_svg_AreaPathGenerator, {
  27852. /**
  27853. * Returns the current radius-accessor. this can be ValueFunction of a Number
  27854. * @return (Object) radius-accessor
  27855. */
  27856. radius$0 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.x$0,
  27857. /**
  27858. * 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:
  27859. * @param (double) rVal The constant to use
  27860. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  27861. */
  27862. radius$1 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.x$1,
  27863. /**
  27864. * 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:
  27865. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  27866. * @return (com.ibm.rave.core.svg.AreaPathGenerator) this path generator
  27867. */
  27868. radius$2 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.x$2,
  27869. /**
  27870. * Returns the current innerRadius-accessor. this can be ValueFunction of a Number
  27871. * @return (Object) innerRadius-accessor
  27872. */
  27873. innerRadius$0 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.x0$0,
  27874. /**
  27875. * 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:
  27876. * @param (double) xVal The constant to use
  27877. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) this path generator
  27878. */
  27879. innerRadius$1 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.x0$1,
  27880. /**
  27881. * 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:
  27882. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  27883. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) this path generator
  27884. */
  27885. innerRadius$2 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.x0$2,
  27886. /**
  27887. * Returns the current outerRadius-accessor. this can be ValueFunction of a Number
  27888. * @return (Object) outerRadius-accessor
  27889. */
  27890. outerRadius$0 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.x1$0,
  27891. /**
  27892. * 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:
  27893. * @param (double) xVal The constant to use
  27894. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) this path generator
  27895. */
  27896. outerRadius$1 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.x1$1,
  27897. /**
  27898. * 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:
  27899. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  27900. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) this path generator
  27901. */
  27902. outerRadius$2 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.x1$2,
  27903. /**
  27904. * Returns the current angle-accessor. this can be ValueFunction of a Number
  27905. * @return (Object) angle-accessor
  27906. */
  27907. angle$0 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.y$0,
  27908. /**
  27909. * 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:
  27910. * @param (double) yVal The constant to use
  27911. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) this path generator
  27912. */
  27913. angle$1 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.y$1,
  27914. /**
  27915. * 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:
  27916. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  27917. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) this path generator
  27918. */
  27919. angle$2 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.y$2,
  27920. /**
  27921. * Returns the current startAngle-accessor. this can be ValueFunction of a Number
  27922. * @return (Object) startAngle-accessor
  27923. */
  27924. startAngle$0 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.y0$0,
  27925. /**
  27926. * 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:
  27927. * @param (double) yVal The constant to use
  27928. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) this path generator
  27929. */
  27930. startAngle$1 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.y0$1,
  27931. /**
  27932. * 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:
  27933. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  27934. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) this path generator
  27935. */
  27936. startAngle$2 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.y0$2,
  27937. /**
  27938. * Returns the current endAngle-accessor. this can be ValueFunction of a Number
  27939. * @return (Object) endAngle-accessor
  27940. */
  27941. endAngle$0 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.y1$0,
  27942. /**
  27943. * 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:
  27944. * @param (double) yVal The constant to use
  27945. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) this path generator
  27946. */
  27947. endAngle$1 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.y1$1,
  27948. /**
  27949. * 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:
  27950. * @param (com.ibm.rave.core.selector.ValueFunction) valFn The constant to use
  27951. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) this path generator
  27952. */
  27953. endAngle$2 : com_ibm_rave_core_svg_AreaPathGenerator.prototype.y1$2,
  27954. /**
  27955. * Constructor constructs a Radial Area path generator
  27956. * @param (com.ibm.rave.core.selector.ValueFunction) projection the projection to set on this area generator
  27957. */
  27958. /** @expose */
  27959. constructor : function(projection) {
  27960. },
  27961. /** @expose */
  27962. radius : function(a0) {
  27963. var args = arguments;
  27964. if (args.length == 0) {
  27965. return this.radius$0();
  27966. }
  27967. if (args.length == 1 && typeof a0 === "function") {
  27968. return this.radius$2(a0);
  27969. }
  27970. return this.radius$1(a0);
  27971. },
  27972. /** @expose */
  27973. innerRadius : function(a0) {
  27974. var args = arguments;
  27975. if (args.length == 0) {
  27976. return this.innerRadius$0();
  27977. }
  27978. if (args.length == 1 && typeof a0 === "function") {
  27979. return this.innerRadius$2(a0);
  27980. }
  27981. return this.innerRadius$1(a0);
  27982. },
  27983. /** @expose */
  27984. outerRadius : function(a0) {
  27985. var args = arguments;
  27986. if (args.length == 0) {
  27987. return this.outerRadius$0();
  27988. }
  27989. if (args.length == 1 && typeof a0 === "function") {
  27990. return this.outerRadius$2(a0);
  27991. }
  27992. return this.outerRadius$1(a0);
  27993. },
  27994. /** @expose */
  27995. angle : function(a0) {
  27996. var args = arguments;
  27997. if (args.length == 0) {
  27998. return this.angle$0();
  27999. }
  28000. if (args.length == 1 && typeof a0 === "function") {
  28001. return this.angle$2(a0);
  28002. }
  28003. return this.angle$1(a0);
  28004. },
  28005. /** @expose */
  28006. startAngle : function(a0) {
  28007. var args = arguments;
  28008. if (args.length == 0) {
  28009. return this.startAngle$0();
  28010. }
  28011. if (args.length == 1 && typeof a0 === "function") {
  28012. return this.startAngle$2(a0);
  28013. }
  28014. return this.startAngle$1(a0);
  28015. },
  28016. /** @expose */
  28017. endAngle : function(a0) {
  28018. var args = arguments;
  28019. if (args.length == 0) {
  28020. return this.endAngle$0();
  28021. }
  28022. if (args.length == 1 && typeof a0 === "function") {
  28023. return this.endAngle$2(a0);
  28024. }
  28025. return this.endAngle$1(a0);
  28026. }
  28027. });
  28028. /**
  28029. * Creates a Radial Area Path generator
  28030. * @return (com.ibm.rave.core.svg.RadialAreaPathGenerator) a new RadialAreaPathGenerator
  28031. */
  28032. com_ibm_rave_core_svg_RadialAreaPathGenerator.createRadialAreaGenerator = function() {
  28033. return new com_ibm_rave_core_svg_RadialAreaPathGenerator(com_ibm_rave_core_svg_LineRadial.r2_svg_lineRadial);
  28034. };
  28035. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x;
  28036. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x$0;
  28037. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x$1;
  28038. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x$2;
  28039. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x0;
  28040. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x0$0;
  28041. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x0$1;
  28042. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x0$2;
  28043. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x1;
  28044. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x1$0;
  28045. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x1$1;
  28046. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.x1$2;
  28047. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y;
  28048. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y$0;
  28049. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y$1;
  28050. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y$2;
  28051. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y0;
  28052. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y0$0;
  28053. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y0$1;
  28054. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y0$2;
  28055. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y1;
  28056. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y1$0;
  28057. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y1$1;
  28058. delete com_ibm_rave_core_svg_RadialAreaPathGenerator.prototype.y1$2;
  28059. // $source: com/ibm/rave/core/svg/DiagonalPathGeneratorFactory
  28060. /************************************************************************
  28061. ** IBM Confidential
  28062. **
  28063. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  28064. **
  28065. ** (C) Copyright IBM Corp. 2017
  28066. **
  28067. ** The source code for this program is not published or otherwise divested of its trade secrets,
  28068. ** irrespective of what has been deposited with the U.S. Copyright Office.
  28069. ************************************************************************/
  28070. // GENERATED
  28071. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  28072. //@import com/ibm/rave/core/svg/RadialDiagonalPathGenerator (runtime) // createRadialAreaGenerator
  28073. //@import com/ibm/rave/core/svg/DiagonalPathGenerator (runtime) // new, DiagonalPathGenerator
  28074. var com_ibm_rave_core_svg_DiagonalPathGeneratorFactory = rave_externs["DiagonalPathGeneratorFactory"] = com_ibm_rave_core_nativeImpl_Declare({
  28075. _$functionClassMethod : function() {
  28076. var _$self = /**
  28077. * 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
  28078. * @return (com.ibm.rave.core.svg.DiagonalPathGenerator) area path generator {@link (com.ibm.rave.core.svg.DiagonalPathGenerator) DiagonalPathGenerator}
  28079. */
  28080. function() {
  28081. return new com_ibm_rave_core_svg_DiagonalPathGenerator(com_ibm_rave_core_svg_DiagonalPathGenerator.r2_svg_diagonalProjection);
  28082. };
  28083. return _$self;
  28084. },
  28085. /**
  28086. * Constructs a new Radial Diagonal generator with the default
  28087. * @return (com.ibm.rave.core.svg.RadialDiagonalPathGenerator) svg path generator
  28088. */
  28089. /** @expose */
  28090. radial : function() {
  28091. return com_ibm_rave_core_svg_RadialDiagonalPathGenerator.createRadialAreaGenerator();
  28092. }
  28093. });
  28094. // $source: com/ibm/rave/core/svg/DiagonalPathGenerator
  28095. /************************************************************************
  28096. ** IBM Confidential
  28097. **
  28098. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  28099. **
  28100. ** (C) Copyright IBM Corp. 2017
  28101. **
  28102. ** The source code for this program is not published or otherwise divested of its trade secrets,
  28103. ** irrespective of what has been deposited with the U.S. Copyright Office.
  28104. ************************************************************************/
  28105. // GENERATED
  28106. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  28107. /**
  28108. * 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
  28109. */
  28110. var com_ibm_rave_core_svg_DiagonalPathGenerator = rave_externs["DiagonalPathGenerator"] = com_ibm_rave_core_nativeImpl_Declare({
  28111. //projectionFn : null,
  28112. //sourceFn : null,
  28113. //targetFn : null,
  28114. //sourceVal : null,
  28115. //targetVal : null,
  28116. _$functionClassMethod : function() {
  28117. var _$self = /**
  28118. * 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
  28119. * @param (Object) this the context of this function
  28120. * @param (Object) data the data to use to get source and target, optional param
  28121. * @param (int) index the index of the data, optional param
  28122. * @return (String) SVG string representing the path
  28123. */
  28124. function(data, index) {
  28125. var p0 = _$self.sourceFn ? _$self.sourceFn.call(this, data, index, -1) : _$self.sourceVal;
  28126. var p3 = _$self.targetFn ? _$self.targetFn.call(this, data, index, -1) : _$self.targetVal;
  28127. var m = (p0["y"] + p3["y"]) / 2;
  28128. var ap1 = {};
  28129. ap1["x"] = p0["x"];
  28130. ap1["y"] = m;
  28131. var ap2 = {};
  28132. ap2["x"] = p3["x"];
  28133. ap2["y"] = m;
  28134. var array = [p0, ap1, ap2, p3];
  28135. var pointArray = array.map(_$self.projectionFn);
  28136. return "M" + pointArray[0] + "C" + pointArray[1] + " " + pointArray[2] + " " + pointArray[3];
  28137. };
  28138. return _$self;
  28139. },
  28140. constructor : function(projection) {
  28141. this.sourceFn = com_ibm_rave_core_svg_DiagonalPathGenerator.DEFAULT_SOURCE_FN;
  28142. this.targetFn = com_ibm_rave_core_svg_DiagonalPathGenerator.DEFAULT_TARGET_FN;
  28143. /**
  28144. * Constructor creates a DiagonalPathGenerator and sets the projection on it to be the passed projection
  28145. * @param (com.ibm.rave.core.collections.ArrayEx.ArrayValueFunction) projection The projection to use while generating the path
  28146. */
  28147. {
  28148. this.projectionFn = projection;
  28149. }
  28150. },
  28151. /**
  28152. * Gets the source function or constant
  28153. * @return (Object) the source function or constant
  28154. */
  28155. source$0 : function() {
  28156. if (this.sourceFn) {
  28157. return this.sourceFn;
  28158. }
  28159. return this.sourceVal;
  28160. },
  28161. /**
  28162. * Sets the source function
  28163. * @param (com.ibm.rave.core.selector.ValueFunction) valFn function to use to get the source form the data
  28164. * @return (com.ibm.rave.core.svg.DiagonalPathGenerator) this generator
  28165. */
  28166. source$1 : function(valFn) {
  28167. this.sourceFn = valFn;
  28168. return this;
  28169. },
  28170. /**
  28171. * Sets the Source value for this generator
  28172. * @param (Object) val the source value
  28173. * @return (com.ibm.rave.core.svg.DiagonalPathGenerator) this generator
  28174. */
  28175. source$2 : function(val) {
  28176. this.sourceFn = null;
  28177. this.sourceVal = val;
  28178. return this;
  28179. },
  28180. /**
  28181. * Gets the target functions of value
  28182. * @return (Object) the target function or value
  28183. */
  28184. target$0 : function() {
  28185. if (this.targetFn) {
  28186. return this.targetFn;
  28187. }
  28188. return this.targetVal;
  28189. },
  28190. /**
  28191. * Sets the function to use to get the target from the data
  28192. * @param (com.ibm.rave.core.selector.ValueFunction) valFn the target function
  28193. * @return (com.ibm.rave.core.svg.DiagonalPathGenerator) this generator
  28194. */
  28195. target$1 : function(valFn) {
  28196. this.targetFn = valFn;
  28197. return this;
  28198. },
  28199. /**
  28200. * Sets The target value
  28201. * @param (Object) val the target value
  28202. * @return (com.ibm.rave.core.svg.DiagonalPathGenerator) this generator
  28203. */
  28204. target$2 : function(val) {
  28205. this.targetFn = null;
  28206. this.targetVal = val;
  28207. return this;
  28208. },
  28209. /**
  28210. * Gets the current projection function on this Generator
  28211. * @return (com.ibm.rave.core.collections.ArrayEx.ArrayValueFunction) the projection function
  28212. */
  28213. projection$0 : function() {
  28214. return this.projectionFn;
  28215. },
  28216. /**
  28217. * Sets the projection to use by this generator
  28218. * @param (com.ibm.rave.core.collections.ArrayEx.ArrayValueFunction) projection the projection
  28219. * @return (com.ibm.rave.core.svg.DiagonalPathGenerator) this generator
  28220. */
  28221. projection$1 : function(projection) {
  28222. this.projectionFn = projection;
  28223. return this;
  28224. },
  28225. /** @expose */
  28226. source : function(a0) {
  28227. var args = arguments;
  28228. if (args.length == 0) {
  28229. return this.source$0();
  28230. }
  28231. if (args.length == 1 && typeof a0 === "function") {
  28232. return this.source$1(a0);
  28233. }
  28234. return this.source$2(a0);
  28235. },
  28236. /** @expose */
  28237. target : function(a0) {
  28238. var args = arguments;
  28239. if (args.length == 0) {
  28240. return this.target$0();
  28241. }
  28242. if (args.length == 1 && typeof a0 === "function") {
  28243. return this.target$1(a0);
  28244. }
  28245. return this.target$2(a0);
  28246. },
  28247. /** @expose */
  28248. projection : function(a0) {
  28249. var args = arguments;
  28250. if (args.length == 0) {
  28251. return this.projection$0();
  28252. }
  28253. return this.projection$1(a0);
  28254. }
  28255. });
  28256. com_ibm_rave_core_svg_DiagonalPathGenerator.DEFAULT_SOURCE_FN = function(data, index, groupIndex) {
  28257. return (data)["source"];
  28258. };
  28259. com_ibm_rave_core_svg_DiagonalPathGenerator.DEFAULT_TARGET_FN = function(data, index, groupIndex) {
  28260. return (data)["target"];
  28261. };
  28262. /**
  28263. * Creates the projection to set on this generator
  28264. */
  28265. /** @expose */
  28266. com_ibm_rave_core_svg_DiagonalPathGenerator.r2_svg_diagonalProjection = function(currentValue, index, array) {
  28267. var input = currentValue;
  28268. return [input["x"], input["y"]];
  28269. };
  28270. // $source: com/ibm/rave/core/svg/RadialDiagonalPathGenerator
  28271. /************************************************************************
  28272. ** IBM Confidential
  28273. **
  28274. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  28275. **
  28276. ** (C) Copyright IBM Corp. 2017
  28277. **
  28278. ** The source code for this program is not published or otherwise divested of its trade secrets,
  28279. ** irrespective of what has been deposited with the U.S. Copyright Office.
  28280. ************************************************************************/
  28281. // GENERATED
  28282. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  28283. //@import com/ibm/rave/core/svg/DiagonalPathGenerator (loadtime) // superclass
  28284. /**
  28285. * Constructor creates a RadialDiagonalPathGenerator
  28286. */
  28287. var com_ibm_rave_core_svg_RadialDiagonalPathGenerator = rave_externs["RadialDiagonalPathGenerator"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_svg_DiagonalPathGenerator, {
  28288. /**
  28289. * Constructor creates a RadialDiagonalPathGenerator and sets the projection on it to be r2_svg_diagonalProjection
  28290. */
  28291. /** @expose */
  28292. constructor : function() {
  28293. },
  28294. /** @expose */
  28295. projection$1 : function(projectionVal) {
  28296. com_ibm_rave_core_svg_DiagonalPathGenerator.prototype.projection$1.call(this, new com_ibm_rave_core_svg_RadialDiagonalPathGenerator.DiagonalRadialProjection(projectionVal));
  28297. return this;
  28298. }
  28299. });
  28300. /**
  28301. * Creates a Radial Diagonal Path generator
  28302. * @return (com.ibm.rave.core.svg.RadialDiagonalPathGenerator) a new RadialDiagonalPathGenerator
  28303. */
  28304. com_ibm_rave_core_svg_RadialDiagonalPathGenerator.createRadialAreaGenerator = function() {
  28305. return new com_ibm_rave_core_svg_RadialDiagonalPathGenerator();
  28306. };
  28307. com_ibm_rave_core_svg_RadialDiagonalPathGenerator.DiagonalRadialProjection = com_ibm_rave_core_nativeImpl_Declare({
  28308. //innerProjectionFn : null,
  28309. _$functionClassMethod : function() {
  28310. var _$self = function(currentValue, index, array) {
  28311. var p = _$self.innerProjectionFn(currentValue, index, array);
  28312. var r = p[0];
  28313. var a = p[1] - 1.5707963267948966;
  28314. return [r * Math.cos(a), r * Math.sin(a)];
  28315. };
  28316. return _$self;
  28317. },
  28318. constructor : function(projectionVal) {
  28319. this.innerProjectionFn = projectionVal;
  28320. }
  28321. });
  28322. // $source: com/ibm/rave/core/internal/svg/symbol/CrossSymbolCreator
  28323. /************************************************************************
  28324. ** IBM Confidential
  28325. **
  28326. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  28327. **
  28328. ** (C) Copyright IBM Corp. 2017
  28329. **
  28330. ** The source code for this program is not published or otherwise divested of its trade secrets,
  28331. ** irrespective of what has been deposited with the U.S. Copyright Office.
  28332. ************************************************************************/
  28333. // GENERATED
  28334. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  28335. /**
  28336. * Symbol creator for a Cross shape
  28337. */
  28338. var com_ibm_rave_core_internal_svg_symbol_CrossSymbolCreator = com_ibm_rave_core_nativeImpl_Declare({
  28339. _$functionClassMethod : function() {
  28340. var _$self = /**
  28341. * create a cross symbol using the passed size
  28342. * @param (double) size size of the shape in square pixels
  28343. * @return (String) SVG path string for the shape
  28344. */
  28345. function(size) {
  28346. var r = Math.sqrt(size / 5) / 2;
  28347. var r3 = r * 3;
  28348. var s1 = "M" + -r3 + "," + -r + "H" + -r + "V" + -r3 + "H" + r + "V" + -r;
  28349. var s2 = "H" + r3 + "V" + r + "H" + r + "V" + r3 + "H" + -r + "V" + r + "H" + -r3 + "Z";
  28350. return s1 + s2;
  28351. };
  28352. return _$self;
  28353. }
  28354. });
  28355. // $source: com/ibm/rave/core/internal/svg/symbol/DiamondSymbolCreator
  28356. /************************************************************************
  28357. ** IBM Confidential
  28358. **
  28359. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  28360. **
  28361. ** (C) Copyright IBM Corp. 2017
  28362. **
  28363. ** The source code for this program is not published or otherwise divested of its trade secrets,
  28364. ** irrespective of what has been deposited with the U.S. Copyright Office.
  28365. ************************************************************************/
  28366. // GENERATED
  28367. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  28368. //@import com/ibm/rave/core/internal/svg/symbol/SymbolCreatorsConstants (runtime) // SymbolCreatorsConstants
  28369. /**
  28370. * Symbol creator for a Diamond shape
  28371. */
  28372. var com_ibm_rave_core_internal_svg_symbol_DiamondSymbolCreator = com_ibm_rave_core_nativeImpl_Declare({
  28373. _$functionClassMethod : function() {
  28374. var _$self = /**
  28375. * create a Diamond symbol using the passed size
  28376. * @param (double) size size of the shape in square pixels
  28377. * @return (String) SVG path string for the shape
  28378. */
  28379. function(size) {
  28380. 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;
  28381. return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z";
  28382. };
  28383. return _$self;
  28384. }
  28385. });
  28386. // $source: com/ibm/rave/core/internal/svg/symbol/SquareSymbolCreator
  28387. /************************************************************************
  28388. ** IBM Confidential
  28389. **
  28390. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  28391. **
  28392. ** (C) Copyright IBM Corp. 2017
  28393. **
  28394. ** The source code for this program is not published or otherwise divested of its trade secrets,
  28395. ** irrespective of what has been deposited with the U.S. Copyright Office.
  28396. ************************************************************************/
  28397. // GENERATED
  28398. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  28399. /**
  28400. * Symbol creator for a Square shape
  28401. */
  28402. var com_ibm_rave_core_internal_svg_symbol_SquareSymbolCreator = com_ibm_rave_core_nativeImpl_Declare({
  28403. _$functionClassMethod : function() {
  28404. var _$self = /**
  28405. * create a Square symbol using the passed size
  28406. * @param (double) size size of the shape in square pixels
  28407. * @return (String) SVG path string for the shape
  28408. */
  28409. function(size) {
  28410. var r = Math.sqrt(size) / 2;
  28411. return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z";
  28412. };
  28413. return _$self;
  28414. }
  28415. });
  28416. // $source: com/ibm/rave/core/internal/svg/symbol/TriangleDownSymbolCreator
  28417. /************************************************************************
  28418. ** IBM Confidential
  28419. **
  28420. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  28421. **
  28422. ** (C) Copyright IBM Corp. 2017
  28423. **
  28424. ** The source code for this program is not published or otherwise divested of its trade secrets,
  28425. ** irrespective of what has been deposited with the U.S. Copyright Office.
  28426. ************************************************************************/
  28427. // GENERATED
  28428. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  28429. //@import com/ibm/rave/core/internal/svg/symbol/SymbolCreatorsConstants (runtime) // SymbolCreatorsConstants
  28430. /**
  28431. * Symbol creator for a TriangleDown shape
  28432. */
  28433. var com_ibm_rave_core_internal_svg_symbol_TriangleDownSymbolCreator = com_ibm_rave_core_nativeImpl_Declare({
  28434. _$functionClassMethod : function() {
  28435. var _$self = /**
  28436. * create a TriangleDown symbol using the passed size
  28437. * @param (double) size size of the shape in square pixels
  28438. * @return (String) SVG path string for the shape
  28439. */
  28440. function(size) {
  28441. 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;
  28442. return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z";
  28443. };
  28444. return _$self;
  28445. }
  28446. });
  28447. // $source: com/ibm/rave/core/internal/svg/symbol/TriangleUpSymbolCreator
  28448. /************************************************************************
  28449. ** IBM Confidential
  28450. **
  28451. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  28452. **
  28453. ** (C) Copyright IBM Corp. 2017
  28454. **
  28455. ** The source code for this program is not published or otherwise divested of its trade secrets,
  28456. ** irrespective of what has been deposited with the U.S. Copyright Office.
  28457. ************************************************************************/
  28458. // GENERATED
  28459. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  28460. //@import com/ibm/rave/core/internal/svg/symbol/SymbolCreatorsConstants (runtime) // SymbolCreatorsConstants
  28461. /**
  28462. * Symbol creator for a TriangleUp shape
  28463. */
  28464. var com_ibm_rave_core_internal_svg_symbol_TriangleUpSymbolCreator = com_ibm_rave_core_nativeImpl_Declare({
  28465. _$functionClassMethod : function() {
  28466. var _$self = /**
  28467. * create a TriangleUp symbol using the passed size
  28468. * @param (double) size size of the shape in square pixels
  28469. * @return (String) SVG path string for the shape
  28470. */
  28471. function(size) {
  28472. 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;
  28473. return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z";
  28474. };
  28475. return _$self;
  28476. }
  28477. });
  28478. // $source: com/ibm/rave/core/internal/svg/symbol/CircleSymbolCreator
  28479. /************************************************************************
  28480. ** IBM Confidential
  28481. **
  28482. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  28483. **
  28484. ** (C) Copyright IBM Corp. 2017
  28485. **
  28486. ** The source code for this program is not published or otherwise divested of its trade secrets,
  28487. ** irrespective of what has been deposited with the U.S. Copyright Office.
  28488. ************************************************************************/
  28489. // GENERATED
  28490. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  28491. /**
  28492. * Symbol creator for a circle shape
  28493. */
  28494. var com_ibm_rave_core_internal_svg_symbol_CircleSymbolCreator = com_ibm_rave_core_nativeImpl_Declare({
  28495. _$functionClassMethod : function() {
  28496. var _$self = /**
  28497. * create a circle symbol using the passed size
  28498. * @param (double) size size of the shape in square pixels
  28499. * @return (String) SVG path string for the shape
  28500. */
  28501. function(size) {
  28502. var r = Math.sqrt(size / 3.141592653589793);
  28503. return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + (-r) + "A" + r + "," + r + " 0 1,1 0," + r + "Z";
  28504. };
  28505. return _$self;
  28506. }
  28507. });
  28508. // $source: com/ibm/rave/core/svg/Symbol
  28509. /************************************************************************
  28510. ** IBM Confidential
  28511. **
  28512. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  28513. **
  28514. ** (C) Copyright IBM Corp. 2017
  28515. **
  28516. ** The source code for this program is not published or otherwise divested of its trade secrets,
  28517. ** irrespective of what has been deposited with the U.S. Copyright Office.
  28518. ************************************************************************/
  28519. // GENERATED
  28520. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  28521. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (runtime) // create
  28522. //@import com/ibm/rave/core/internal/svg/symbol/CrossSymbolCreator (static) // new
  28523. //@import com/ibm/rave/core/internal/svg/symbol/DiamondSymbolCreator (static) // new
  28524. //@import com/ibm/rave/core/internal/svg/symbol/SquareSymbolCreator (static) // new
  28525. //@import com/ibm/rave/core/internal/svg/symbol/TriangleDownSymbolCreator (static) // new
  28526. //@import com/ibm/rave/core/internal/svg/symbol/TriangleUpSymbolCreator (static) // new
  28527. //@import com/ibm/rave/core/context/RaveContextManager (static) // RaveContextManager
  28528. //@import com/ibm/rave/core/internal/svg/symbol/CircleSymbolCreator (static) // new
  28529. /**
  28530. * 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.
  28531. */
  28532. var com_ibm_rave_core_svg_Symbol = rave_externs["Symbol"] = com_ibm_rave_core_nativeImpl_Declare({
  28533. //type_fn : null,
  28534. //size_fn : null,
  28535. _$functionClassMethod : function() {
  28536. var _$self = function(data, index, groupIndex) {
  28537. var type = _$self.type_fn.call(this, data, index, groupIndex);
  28538. var creator = com_ibm_rave_core_svg_Symbol.getSymbols().r2_svg_symbols.get(type);
  28539. if (!creator) {
  28540. creator = com_ibm_rave_core_svg_Symbol.r2_svg_symbolCircle;
  28541. }
  28542. return creator(+ (_$self.size_fn.call(this, data, index, groupIndex)));
  28543. };
  28544. return _$self;
  28545. },
  28546. constructor : function() {
  28547. this.type_fn = com_ibm_rave_core_svg_Symbol.TYPE_FN;
  28548. this.size_fn = com_ibm_rave_core_svg_Symbol.SIZE_FN;
  28549. },
  28550. /**
  28551. * returns accessor for the symbol type
  28552. * @return (com.ibm.rave.core.selector.ValueFunction) the symbol type accessor
  28553. */
  28554. type$0 : function() {
  28555. return this.type_fn;
  28556. },
  28557. /**
  28558. * sets the accessor for the symbol type
  28559. * @param (com.ibm.rave.core.selector.ValueFunction) valueFn , symbol type accessor
  28560. * @return (com.ibm.rave.core.svg.Symbol) the Symbol
  28561. */
  28562. type$1 : function(valueFn) {
  28563. if (valueFn) {
  28564. this.type_fn = valueFn;
  28565. } else {
  28566. this.type$2(null);
  28567. }
  28568. return this;
  28569. },
  28570. /**
  28571. * sets the symbol type
  28572. * @param (String) value the symbol type
  28573. * @return (com.ibm.rave.core.svg.Symbol) the Symbol
  28574. */
  28575. type$2 : function(value) {
  28576. this.type_fn = function(data, index, groupIndex) {
  28577. return value;
  28578. };
  28579. return this;
  28580. },
  28581. /**
  28582. * returns accessor for the symbol size, size is in square pixels
  28583. * @return (com.ibm.rave.core.selector.ValueFunction) the symbol size accessor
  28584. */
  28585. size$0 : function() {
  28586. return this.size_fn;
  28587. },
  28588. /**
  28589. * sets the accessor for the symbol size, size is expected to provided in square pixels
  28590. * @param (com.ibm.rave.core.selector.ValueFunction) valueFn , symbol size accessor
  28591. * @return (com.ibm.rave.core.svg.Symbol) the symbol
  28592. */
  28593. size$1 : function(valueFn) {
  28594. if (valueFn) {
  28595. this.size_fn = valueFn;
  28596. } else {
  28597. this.size$2(0.);
  28598. }
  28599. return this;
  28600. },
  28601. /**
  28602. * sets the symbol size, size is expected to provided in square pixels
  28603. * @param (double) value the symbol size
  28604. * @return (com.ibm.rave.core.svg.Symbol) the Symbol
  28605. */
  28606. size$2 : function(value) {
  28607. this.size_fn = function(data, index, groupIndex) {
  28608. return value;
  28609. };
  28610. return this;
  28611. },
  28612. /** @expose */
  28613. type : function(a0) {
  28614. var args = arguments;
  28615. if (args.length == 0) {
  28616. return this.type$0();
  28617. }
  28618. if (args.length == 1 && typeof a0 === "function") {
  28619. return this.type$1(a0);
  28620. }
  28621. return this.type$2(a0);
  28622. },
  28623. /** @expose */
  28624. size : function(a0) {
  28625. var args = arguments;
  28626. if (args.length == 0) {
  28627. return this.size$0();
  28628. }
  28629. if (args.length == 1 && typeof a0 === "function") {
  28630. return this.size$1(a0);
  28631. }
  28632. return this.size$2(a0);
  28633. }
  28634. });
  28635. com_ibm_rave_core_svg_Symbol.createSymbols = function() {
  28636. var map = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  28637. map.set("circle", com_ibm_rave_core_svg_Symbol.r2_svg_symbolCircle);
  28638. map.set("cross", new com_ibm_rave_core_internal_svg_symbol_CrossSymbolCreator());
  28639. map.set("diamond", new com_ibm_rave_core_internal_svg_symbol_DiamondSymbolCreator());
  28640. map.set("square", new com_ibm_rave_core_internal_svg_symbol_SquareSymbolCreator());
  28641. map.set("triangle-down", new com_ibm_rave_core_internal_svg_symbol_TriangleDownSymbolCreator());
  28642. map.set("triangle-up", new com_ibm_rave_core_internal_svg_symbol_TriangleUpSymbolCreator());
  28643. return map;
  28644. };
  28645. com_ibm_rave_core_svg_Symbol.getSymbols = function() {
  28646. var symbolsMap = com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData("SYMBOLS_KEY");
  28647. if (!symbolsMap) {
  28648. symbolsMap = new com_ibm_rave_core_svg_Symbol.SymbolsMap();
  28649. com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().putData("SYMBOLS_KEY", symbolsMap);
  28650. }
  28651. return symbolsMap;
  28652. };
  28653. /** @expose */
  28654. com_ibm_rave_core_svg_Symbol.getSymbolTypes = function() {
  28655. return com_ibm_rave_core_svg_Symbol.getSymbols().types;
  28656. };
  28657. /**
  28658. * Register a symbol creator using an id. If the same id is already in use, registration will fail. Once you register as symbol creator it will be available for all other symbols created afterwards and not only this instance
  28659. * @param (String) id extension id
  28660. * @param (com.ibm.rave.core.svg.SymbolCreator) symbolCreator extended symbolCreator which is an svg path generator provided by id
  28661. * @return (boolean) true, if the registration was successful, false otherwise
  28662. */
  28663. com_ibm_rave_core_svg_Symbol.register = function(id, symbolCreator) {
  28664. return com_ibm_rave_core_svg_Symbol.getSymbols().register(id, symbolCreator);
  28665. };
  28666. com_ibm_rave_core_svg_Symbol.SymbolsMap = com_ibm_rave_core_nativeImpl_Declare({
  28667. //r2_svg_symbols : null,
  28668. //types : null,
  28669. constructor : function() {
  28670. this.r2_svg_symbols = com_ibm_rave_core_svg_Symbol.createSymbols();
  28671. this.types = [];
  28672. var keys = this.r2_svg_symbols.keys();
  28673. for (var i = 0; i < keys.length; ++i) {
  28674. this.types.push(keys[i]);
  28675. }
  28676. },
  28677. register : function(id, symbolCreator) {
  28678. if (this.r2_svg_symbols.get(id)) {
  28679. return false;
  28680. }
  28681. this.r2_svg_symbols.set(id, symbolCreator);
  28682. this.types.push(id);
  28683. return true;
  28684. }
  28685. });
  28686. com_ibm_rave_core_svg_Symbol.DEFAULT_SIZE = 64;
  28687. //com_ibm_rave_core_svg_Symbol.SYMBOLS_KEY = "SYMBOLS_KEY";
  28688. com_ibm_rave_core_svg_Symbol.r2_svg_symbolCircle = new com_ibm_rave_core_internal_svg_symbol_CircleSymbolCreator();
  28689. com_ibm_rave_core_svg_Symbol.SIZE_FN = function(data, index, groupIndex) {
  28690. return com_ibm_rave_core_svg_Symbol.DEFAULT_SIZE;
  28691. };
  28692. com_ibm_rave_core_svg_Symbol.TYPE_FN = function(data, index, groupIndex) {
  28693. return "circle";
  28694. };
  28695. // $source: com/ibm/rave/core/svg/SVG
  28696. /************************************************************************
  28697. ** IBM Confidential
  28698. **
  28699. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  28700. **
  28701. ** (C) Copyright IBM Corp. 2017
  28702. **
  28703. ** The source code for this program is not published or otherwise divested of its trade secrets,
  28704. ** irrespective of what has been deposited with the U.S. Copyright Office.
  28705. ************************************************************************/
  28706. // GENERATED
  28707. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  28708. //@import com/ibm/rave/core/svg/LinePathGeneratorFactory (runtime) // new
  28709. //@import com/ibm/rave/core/svg/AreaPathGeneratorFactory (runtime) // new
  28710. //@import com/ibm/rave/core/svg/DiagonalPathGeneratorFactory (runtime) // new
  28711. //@import com/ibm/rave/core/svg/Symbol (loadtime) // new, getSymbolTypes, register
  28712. //@import com/ibm/rave/core/svg/Arc (runtime) // new
  28713. //@import com/ibm/rave/core/svg/Chord (runtime) // new
  28714. //@import com/ibm/rave/core/svg/Axis (runtime) // new
  28715. //@import com/ibm/rave/core/svg/Brush (runtime) // newBrush
  28716. /**
  28717. * A Factory class for the SVG path generators.
  28718. */
  28719. var com_ibm_rave_core_svg_SVG = com_ibm_rave_core_nativeImpl_Declare({
  28720. /**
  28721. * 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}
  28722. */
  28723. /** @expose */
  28724. line : null,
  28725. /**
  28726. * 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}
  28727. */
  28728. /** @expose */
  28729. area : null,
  28730. /**
  28731. * 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}
  28732. */
  28733. /** @expose */
  28734. diagonal : null,
  28735. /**
  28736. * List of all supported Symbol Types. This is a read only list
  28737. */
  28738. /** @expose */
  28739. symbolTypes : null,
  28740. constructor : function() {
  28741. this.line = new com_ibm_rave_core_svg_LinePathGeneratorFactory();
  28742. this.area = new com_ibm_rave_core_svg_AreaPathGeneratorFactory();
  28743. this.diagonal = new com_ibm_rave_core_svg_DiagonalPathGeneratorFactory();
  28744. this.symbolTypes = com_ibm_rave_core_svg_Symbol.getSymbolTypes();
  28745. },
  28746. /**
  28747. * Factory method, that creates an Arc path generator.
  28748. * @return (com.ibm.rave.core.svg.Arc) arc path generator {@link (com.ibm.rave.core.svg.Arc) Arc}
  28749. */
  28750. /** @expose */
  28751. arc : function() {
  28752. return new com_ibm_rave_core_svg_Arc();
  28753. },
  28754. /**
  28755. * Factory method, that creates a chord path generator.
  28756. * @return (com.ibm.rave.core.svg.Chord) chord path generator {@link (com.ibm.rave.core.svg.Chord) Chord}
  28757. */
  28758. /** @expose */
  28759. chord : function() {
  28760. return new com_ibm_rave_core_svg_Chord();
  28761. },
  28762. /**
  28763. * Factory method, that creates an axis shape generator.
  28764. * @return (com.ibm.rave.core.svg.Axis) axis shape generator {@link (com.ibm.rave.core.svg.Axis) Axis}
  28765. */
  28766. /** @expose */
  28767. axis : function() {
  28768. return new com_ibm_rave_core_svg_Axis();
  28769. },
  28770. /**
  28771. * Factory method, that creates a Symbol path generator.
  28772. * @return (com.ibm.rave.core.svg.Symbol) symbol path generator {@link (com.ibm.rave.core.svg.Symbol) Symbol}
  28773. */
  28774. /** @expose */
  28775. symbol : function() {
  28776. return new com_ibm_rave_core_svg_Symbol();
  28777. },
  28778. /**
  28779. * Constructs a new brush with no default x- and y-scale, and an empty extent
  28780. * @return (com.ibm.rave.core.svg.Brush) the newly constructed brush control
  28781. */
  28782. /** @expose */
  28783. brush : function() {
  28784. return com_ibm_rave_core_svg_Brush.newBrush();
  28785. },
  28786. /**
  28787. * Register a symbol creator using an id. If the same id is already in use, registration will fail. Once you register as symbol creator it will be available to use via Symbol. In Javascript for example, registering a symbol creator would look like the following: <pre class="javascript"> rave.svg.symbolCreator("circle-line", function(area){ //A symbol creator for a circle with a horizontal line across it //First, create a circle svg path var circleStr = lib.svg.symbol().type("circle").size(area *.6)(); //Now, calculate width and height of a horizontal rectangle representing a line var w = Math.sqrt(area / 2.0); var h = w / 6.0; //Then, build the line's svg path string var hRectStr = "M" + -w + "," + -h + "H" + w + "V" + h + "H" + -w + "Z"; //Finally, concatenate both to create the path of the composite shape and return it return circleStr.substring(0, circleStr.length - 1) + hRectStr; }); </pre>
  28788. * @param (String) id extension id
  28789. * @param (com.ibm.rave.core.svg.SymbolCreator) symbolCreator extended symbolCreator which is an svg path generator provided by id
  28790. * @return (boolean) true, if the registration was successful, false otherwise
  28791. * @see SymbolCreator
  28792. * @see Symbol
  28793. */
  28794. /** @expose */
  28795. symbolCreator : com_ibm_rave_core_svg_Symbol.register
  28796. //constructor : function() {}
  28797. });
  28798. /** @expose */
  28799. com_ibm_rave_core_svg_SVG.getInstance = function() {
  28800. if (!com_ibm_rave_core_svg_SVG.INSTANCE) {
  28801. {
  28802. if (!com_ibm_rave_core_svg_SVG.INSTANCE) {
  28803. com_ibm_rave_core_svg_SVG.INSTANCE = new com_ibm_rave_core_svg_SVG();
  28804. }
  28805. }
  28806. }
  28807. return com_ibm_rave_core_svg_SVG.INSTANCE;
  28808. };
  28809. //com_ibm_rave_core_svg_SVG.INSTANCE = null;
  28810. // $source: com/ibm/rave/core/svg/Arc
  28811. /************************************************************************
  28812. ** IBM Confidential
  28813. **
  28814. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  28815. **
  28816. ** (C) Copyright IBM Corp. 2017
  28817. **
  28818. ** The source code for this program is not published or otherwise divested of its trade secrets,
  28819. ** irrespective of what has been deposited with the U.S. Copyright Office.
  28820. ************************************************************************/
  28821. // GENERATED
  28822. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  28823. //@import com/ibm/rave/core/internal/math/Trigonometry (runtime) // asin
  28824. //@import com/ibm/rave/core/internal/geom/PolygonUtil (runtime) // polygonIntersect
  28825. /**
  28826. * 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()}
  28827. */
  28828. var com_ibm_rave_core_svg_Arc = rave_externs["Arc"] = com_ibm_rave_core_nativeImpl_Declare({
  28829. //_innerRadius : null,
  28830. //_cornerRadius : null,
  28831. //_outerRadius : null,
  28832. //_startAngle : null,
  28833. //_endAngle : null,
  28834. //_arcPadAngle : null,
  28835. //_padRadius : null,
  28836. _$functionClassMethod : function() {
  28837. var _$self = /**
  28838. * Get a computed value for the given data and index.
  28839. * @param (Object) this the context in which this method is invoked
  28840. * @param (Object) data a data value, may be <code>null</code>
  28841. * @param (int) index the index of the current scene node
  28842. * @param (int) groupIndex the group index of the current scene node
  28843. * @return (String) a computed value
  28844. */
  28845. function(data, index, groupIndex) {
  28846. var l0 = 0;
  28847. var l1 = 0;
  28848. var r0 = Math.max(0, + (_$self._innerRadius.call(this, data, index, groupIndex)));
  28849. var r1 = Math.max(0, + (_$self._outerRadius.call(this, data, index, groupIndex)));
  28850. var a0 = (_$self._startAngle.call(this, data, index, groupIndex)) - (1.5707963267948966);
  28851. var a1 = (_$self._endAngle.call(this, data, index, groupIndex)) - (1.5707963267948966);
  28852. var da = Math.abs(a1 - a0);
  28853. var cw = a0 > a1 ? 0 : 1;
  28854. if (r1 < r0) {
  28855. var rc = r1;
  28856. r1 = r0;
  28857. r0 = rc;
  28858. }
  28859. if (da >= 6.283184307179586) {
  28860. 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";
  28861. }
  28862. var rc, rp, p0 = 0, p1 = 0, ap, x0, y0, x2, y2, x1 = NaN, y1 = NaN, x3 = NaN, y3 = NaN;
  28863. var cr;
  28864. var path = "";
  28865. ap = + (_$self._arcPadAngle.call(this, data, index, groupIndex));
  28866. if ((ap)) {
  28867. ap = ap / 2;
  28868. rp = + ((_$self._padRadius == com_ibm_rave_core_svg_Arc.PAD_RADIUS ? Math.sqrt(r0 * r0 + r1 * r1) : + (_$self._padRadius.call(this, data, index, groupIndex))));
  28869. if (cw == 0) {
  28870. p1 *= -1;
  28871. }
  28872. if (r1 != 0) {
  28873. p1 = com_ibm_rave_core_internal_math_Trigonometry.asin(rp / r1 * Math.sin(ap));
  28874. }
  28875. if (r0 != 0) {
  28876. p0 = com_ibm_rave_core_internal_math_Trigonometry.asin(rp / r0 * Math.sin(ap));
  28877. }
  28878. } else {
  28879. ap = 0.0;
  28880. }
  28881. if ((r1)) {
  28882. x0 = r1 * Math.cos(a0 + p1);
  28883. y0 = r1 * Math.sin(a0 + p1);
  28884. x1 = r1 * Math.cos(a1 - p1);
  28885. y1 = r1 * Math.sin(a1 - p1);
  28886. l1 = Math.abs(a1 - a0 - 2 * p1) <= 3.141592653589793 ? 0 : 1;
  28887. if ((p1 != 0.0 && (com_ibm_rave_core_svg_Arc.arcSweep(x0, y0, x1, y1)) == (cw ^ l1))) {
  28888. var h1 = (a0 + a1) / 2;
  28889. x0 = r1 * Math.cos(h1);
  28890. y0 = r1 * Math.sin(h1);
  28891. x1 = y1 = NaN;
  28892. }
  28893. } else {
  28894. x0 = y0 = 0.0;
  28895. }
  28896. if ((r0)) {
  28897. x2 = r0 * Math.cos(a1 - p0);
  28898. y2 = r0 * Math.sin(a1 - p0);
  28899. x3 = r0 * Math.cos(a0 + p0);
  28900. y3 = r0 * Math.sin(a0 + p0);
  28901. l0 = Math.abs(a0 - a1 + 2 * p0) <= 3.141592653589793 ? 0 : 1;
  28902. if ((p0) && ((com_ibm_rave_core_svg_Arc.arcSweep(x2, y2, x3, y3)) == ((1 - cw) ^ l0))) {
  28903. var h0 = (a0 + a1) / 2;
  28904. x2 = r0 * Math.cos(h0);
  28905. y2 = r0 * Math.sin(h0);
  28906. x3 = y3 = NaN;
  28907. }
  28908. } else {
  28909. x2 = y2 = 0.0;
  28910. }
  28911. if (da > 1.0E-6 && (rc = Math.min(Math.abs(r1 - r0) / 2, + (_$self._cornerRadius.call(this, data, index, groupIndex)))) > 1e-3) {
  28912. cr = (r0 < r1) ^ (cw) ? 0 : 1;
  28913. var rc1 = rc;
  28914. var rc0 = rc;
  28915. if (da + 1.0E-6 < 3.141592653589793) {
  28916. 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]);
  28917. var ax = x0 - oc[0];
  28918. var ay = y0 - oc[1];
  28919. if (Math.abs(ax) < 1.0E-6 && Math.abs(ay) < 1.0E-6) {
  28920. ax = x0 * 0.5;
  28921. ay = y0 * 0.5;
  28922. }
  28923. var bx = x1 - oc[0];
  28924. var by = y1 - oc[1];
  28925. var cosVal = (ax * bx + ay * by) / (Math.sqrt(ax * ax + ay * ay) * Math.sqrt(bx * bx + by * by));
  28926. cosVal = Math.min(1.0, Math.max(-1.0, cosVal));
  28927. var kc = 1 / Math.sin(Math.acos(cosVal) / 2);
  28928. var lc = Math.sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
  28929. rc0 = Math.min(rc, (r0 - lc) / (kc - 1));
  28930. rc1 = Math.min(rc, (r1 - lc) / (kc + 1));
  28931. }
  28932. if (!(isNaN(x1))) {
  28933. var t12 = com_ibm_rave_core_svg_Arc.svg_arcCornerTangents([x1, y1], [x2, y2], r1, rc1, cw);
  28934. var t30 = com_ibm_rave_core_svg_Arc.svg_arcCornerTangents(isNaN(x3) ? [x2, y2] : [x3, y3], [x0, y0], r1, rc1, cw);
  28935. if (rc == rc1) {
  28936. path = path + "M" + t30[0][0] + "," + t30[0][1] + "A" + rc1 + "," + rc1 + " 0 0," + cr + " ";
  28937. path = path + t30[1][0] + "," + t30[1][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][0] + "," + t12[1][1] + "A" + rc1 + "," + rc1 + " 0 0," + cr + " " + t12[0][0] + "," + t12[0][1];
  28938. } else {
  28939. path = path + "M" + t30[0][0] + "," + t30[0][1] + "A" + rc1 + "," + rc1 + " 0 1," + cr + " " + t12[0][0] + "," + t12[0][1];
  28940. }
  28941. } else {
  28942. path = path + "M" + x0 + "," + y0;
  28943. }
  28944. if (!(isNaN(x3))) {
  28945. var t21 = com_ibm_rave_core_svg_Arc.svg_arcCornerTangents([x2, y2], isNaN(x1) ? [x0, y0] : [x1, y1], r0, -rc0, cw);
  28946. var t03 = com_ibm_rave_core_svg_Arc.svg_arcCornerTangents([x0, y0], [x3, y3], r0, -rc0, cw);
  28947. if (isNaN(t21[0][0]) || isNaN(t21[0][1])) {
  28948. a1 = 0;
  28949. }
  28950. if (rc == rc0) {
  28951. path = path + "L" + t21[0][0] + "," + t21[0][1] + "A" + rc0 + "," + rc0 + " 0 0," + cr + " ";
  28952. path = path + t21[1][0] + "," + t21[1][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][0] + "," + t03[1][1] + "A" + rc0 + "," + rc0 + " 0 0," + cr + " " + t03[0][0] + "," + t03[0][1];
  28953. } else {
  28954. path = path + "L" + t21[0][0] + "," + t21[0][1] + "A" + rc0 + "," + rc0 + " 0 0," + cr + " " + t03[0][0] + "," + t03[0][1];
  28955. }
  28956. } else {
  28957. path = path + "L" + x2 + "," + y2;
  28958. }
  28959. } else {
  28960. path = path + "M" + x0 + "," + y0;
  28961. if (!(isNaN(x1))) {
  28962. path = path + "A" + r1 + "," + r1 + " 0 " + l1 + "," + cw + " " + x1 + "," + y1;
  28963. }
  28964. path = path + "L" + x2 + "," + y2;
  28965. if (!(isNaN(x3))) {
  28966. path = path + "A" + r0 + "," + r0 + " 0 " + l0 + "," + (1 - cw) + " " + x3 + "," + y3;
  28967. }
  28968. }
  28969. path = path + "Z";
  28970. return path;
  28971. };
  28972. return _$self;
  28973. },
  28974. constructor : function() {
  28975. this._innerRadius = com_ibm_rave_core_svg_Arc.INNER_RADIUS;
  28976. this._cornerRadius = com_ibm_rave_core_svg_Arc.CORNER_RADIUS;
  28977. this._outerRadius = com_ibm_rave_core_svg_Arc.OUTER_RADIUS;
  28978. this._startAngle = com_ibm_rave_core_svg_Arc.START_ANGLE;
  28979. this._endAngle = com_ibm_rave_core_svg_Arc.END_ANGLE;
  28980. this._arcPadAngle = com_ibm_rave_core_svg_Arc.PAD_ANGLE;
  28981. this._padRadius = com_ibm_rave_core_svg_Arc.PAD_RADIUS;
  28982. },
  28983. /**
  28984. * sets the inner radius value function, function that will be called by the arc class to get the value on inner radius
  28985. * @param (com.ibm.rave.core.selector.ValueFunction) innerRadiusFn the inner radius function
  28986. * @return (com.ibm.rave.core.svg.Arc) this
  28987. */
  28988. innerRadius$0 : function(innerRadiusFn) {
  28989. this._innerRadius = innerRadiusFn;
  28990. return this;
  28991. },
  28992. /**
  28993. * sets the inner radius value
  28994. * @param (double) value the inner radius value
  28995. * @return (com.ibm.rave.core.svg.Arc) this
  28996. */
  28997. innerRadius$1 : function(value) {
  28998. this._innerRadius = function(data, index, groupIndex) {
  28999. return value;
  29000. };
  29001. return this;
  29002. },
  29003. /**
  29004. * gets the inner radius value function
  29005. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  29006. */
  29007. innerRadius$2 : function() {
  29008. return this._innerRadius;
  29009. },
  29010. /**
  29011. * sets the outer radius value function, function that will be called by the arc class to get the value on outer radius
  29012. * @param (com.ibm.rave.core.selector.ValueFunction) outerRadiusFn the outer radius function
  29013. * @return (com.ibm.rave.core.svg.Arc) this
  29014. */
  29015. outerRadius$0 : function(outerRadiusFn) {
  29016. this._outerRadius = outerRadiusFn;
  29017. return this;
  29018. },
  29019. /**
  29020. * sets the outer radius value
  29021. * @param (double) value the outer radius value
  29022. * @return (com.ibm.rave.core.svg.Arc) this
  29023. */
  29024. outerRadius$1 : function(value) {
  29025. this._outerRadius = function(data, index, groupIndex) {
  29026. return value;
  29027. };
  29028. return this;
  29029. },
  29030. /**
  29031. * gets the outer radius value function
  29032. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  29033. */
  29034. outerRadius$2 : function() {
  29035. return this._outerRadius;
  29036. },
  29037. /**
  29038. * sets the start angle value function, function that will be called by the arc class to get the value on start angle
  29039. * @param (com.ibm.rave.core.selector.ValueFunction) startAngleFn the start angle function
  29040. * @return (com.ibm.rave.core.svg.Arc) this
  29041. */
  29042. startAngle$0 : function(startAngleFn) {
  29043. this._startAngle = startAngleFn;
  29044. return this;
  29045. },
  29046. /**
  29047. * sets the start angle value
  29048. * @param (double) value the start angle value
  29049. * @return (com.ibm.rave.core.svg.Arc) this
  29050. */
  29051. startAngle$1 : function(value) {
  29052. this._startAngle = function(data, index, groupIndex) {
  29053. return value;
  29054. };
  29055. return this;
  29056. },
  29057. /**
  29058. * gets the start angle value function
  29059. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  29060. */
  29061. startAngle$2 : function() {
  29062. return this._startAngle;
  29063. },
  29064. /**
  29065. * sets the end angle value function, function that will be called by the arc class to get the value on end angle
  29066. * @param (com.ibm.rave.core.selector.ValueFunction) endAngleFn the end angle function
  29067. * @return (com.ibm.rave.core.svg.Arc) this
  29068. */
  29069. endAngle$0 : function(endAngleFn) {
  29070. this._endAngle = endAngleFn;
  29071. return this;
  29072. },
  29073. /**
  29074. * sets the end angle value
  29075. * @param (double) value the end angle value
  29076. * @return (com.ibm.rave.core.svg.Arc) this
  29077. */
  29078. endAngle$1 : function(value) {
  29079. this._endAngle = function(data, index, groupIndex) {
  29080. return value;
  29081. };
  29082. return this;
  29083. },
  29084. /**
  29085. * gets the end angle value function
  29086. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  29087. */
  29088. endAngle$2 : function() {
  29089. return this._endAngle;
  29090. },
  29091. /**
  29092. * sets the arc pad angle value function, function that will be called by the arc class to get the value on end angle
  29093. * @param (com.ibm.rave.core.selector.ValueFunction) padAngleFn the pad angle function
  29094. * @return (com.ibm.rave.core.svg.Arc) this
  29095. */
  29096. padAngle$0 : function(padAngleFn) {
  29097. this._arcPadAngle = padAngleFn;
  29098. return this;
  29099. },
  29100. /**
  29101. * sets the arc pad angle value
  29102. * @param (double) value the pad angle value
  29103. * @return (com.ibm.rave.core.svg.Arc) this
  29104. */
  29105. padAngle$1 : function(value) {
  29106. this._arcPadAngle = function(data, index, groupIndex) {
  29107. return value;
  29108. };
  29109. return this;
  29110. },
  29111. /**
  29112. * gets the arc pad angle value function
  29113. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  29114. */
  29115. padAngle$2 : function() {
  29116. return this._arcPadAngle;
  29117. },
  29118. /**
  29119. * sets the corner radius value function, function that will be called by the arc class to get the value on corner radius
  29120. * @param (com.ibm.rave.core.selector.ValueFunction) cornerRadiusFn the end angle function
  29121. * @return (com.ibm.rave.core.svg.Arc) this
  29122. */
  29123. cornerRadius$0 : function(cornerRadiusFn) {
  29124. this._cornerRadius = cornerRadiusFn;
  29125. return this;
  29126. },
  29127. /**
  29128. * sets the corner radius value
  29129. * @param (double) value the corner radius value
  29130. * @return (com.ibm.rave.core.svg.Arc) this
  29131. */
  29132. cornerRadius$1 : function(value) {
  29133. this._cornerRadius = function(data, index, groupIndex) {
  29134. return value;
  29135. };
  29136. return this;
  29137. },
  29138. /**
  29139. * gets the corner radius value function
  29140. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  29141. */
  29142. cornerRadius$2 : function() {
  29143. return this._cornerRadius;
  29144. },
  29145. /**
  29146. * sets the pad radius value function, function that will be called by the arc class to get the value on pad radius
  29147. * @param (com.ibm.rave.core.selector.ValueFunction) padRadiusFn the pad radius function
  29148. * @return (com.ibm.rave.core.svg.Arc) this
  29149. */
  29150. padRadius$0 : function(padRadiusFn) {
  29151. this._padRadius = padRadiusFn;
  29152. return this;
  29153. },
  29154. /**
  29155. * sets the pad radius value
  29156. * @param (double) value the pad radius value
  29157. * @return (com.ibm.rave.core.svg.Arc) this
  29158. */
  29159. padRadius$1 : function(value) {
  29160. this._padRadius = function(data, index, groupIndex) {
  29161. return value;
  29162. };
  29163. return this;
  29164. },
  29165. /**
  29166. * gets the pad radius value function
  29167. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  29168. */
  29169. padRadius$2 : function() {
  29170. return this._padRadius;
  29171. },
  29172. /**
  29173. * 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.
  29174. * @param (Object) data The input used to calculate the centroids
  29175. * @param (int) index The current index
  29176. * @param (int) groupIndex The current group index
  29177. * @return (double[]) The centroid of the arc
  29178. */
  29179. /** @expose */
  29180. centroid : function(data, index, groupIndex) {
  29181. 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);
  29182. return [Math.cos(a) * r, Math.sin(a) * r];
  29183. },
  29184. /** @expose */
  29185. innerRadius : function(a0) {
  29186. var args = arguments;
  29187. if (args.length == 0) {
  29188. return this.innerRadius$2();
  29189. }
  29190. if (args.length == 1 && typeof a0 === "function") {
  29191. return this.innerRadius$0(a0);
  29192. }
  29193. return this.innerRadius$1(a0);
  29194. },
  29195. /** @expose */
  29196. outerRadius : function(a0) {
  29197. var args = arguments;
  29198. if (args.length == 0) {
  29199. return this.outerRadius$2();
  29200. }
  29201. if (args.length == 1 && typeof a0 === "function") {
  29202. return this.outerRadius$0(a0);
  29203. }
  29204. return this.outerRadius$1(a0);
  29205. },
  29206. /** @expose */
  29207. startAngle : function(a0) {
  29208. var args = arguments;
  29209. if (args.length == 0) {
  29210. return this.startAngle$2();
  29211. }
  29212. if (args.length == 1 && typeof a0 === "function") {
  29213. return this.startAngle$0(a0);
  29214. }
  29215. return this.startAngle$1(a0);
  29216. },
  29217. /** @expose */
  29218. endAngle : function(a0) {
  29219. var args = arguments;
  29220. if (args.length == 0) {
  29221. return this.endAngle$2();
  29222. }
  29223. if (args.length == 1 && typeof a0 === "function") {
  29224. return this.endAngle$0(a0);
  29225. }
  29226. return this.endAngle$1(a0);
  29227. },
  29228. /** @expose */
  29229. padAngle : function(a0) {
  29230. var args = arguments;
  29231. if (args.length == 0) {
  29232. return this.padAngle$2();
  29233. }
  29234. if (args.length == 1 && typeof a0 === "function") {
  29235. return this.padAngle$0(a0);
  29236. }
  29237. return this.padAngle$1(a0);
  29238. },
  29239. /** @expose */
  29240. cornerRadius : function(a0) {
  29241. var args = arguments;
  29242. if (args.length == 0) {
  29243. return this.cornerRadius$2();
  29244. }
  29245. if (args.length == 1 && typeof a0 === "function") {
  29246. return this.cornerRadius$0(a0);
  29247. }
  29248. return this.cornerRadius$1(a0);
  29249. },
  29250. /** @expose */
  29251. padRadius : function(a0) {
  29252. var args = arguments;
  29253. if (args.length == 0) {
  29254. return this.padRadius$2();
  29255. }
  29256. if (args.length == 1 && typeof a0 === "function") {
  29257. return this.padRadius$0(a0);
  29258. }
  29259. return this.padRadius$1(a0);
  29260. }
  29261. });
  29262. com_ibm_rave_core_svg_Arc.circleSegment = function(r1, cw) {
  29263. return "M0," + r1 + "A" + r1 + "," + r1 + " 0 1," + cw + " 0," + -r1 + "A" + r1 + "," + r1 + " 0 1," + cw + " 0," + r1;
  29264. };
  29265. com_ibm_rave_core_svg_Arc.arcSweep = function(x0, y0, x1, y1) {
  29266. return (x0 - x1) * y0 - (y0 - y1) * x0 > 0 ? 0 : 1;
  29267. };
  29268. com_ibm_rave_core_svg_Arc.svg_arcCornerTangents = function(p0, p1, r1, rc, cw) {
  29269. 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(Math.max(0, 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;
  29270. if (isNaN(d) || d2 < 1.0E-6) {
  29271. d2 = 1;
  29272. }
  29273. if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) {
  29274. cx0 = cx1;
  29275. cy0 = cy1;
  29276. }
  29277. return [[cx0 - ox, cy0 - oy], [cx0 * r1 / r, cy0 * r1 / r]];
  29278. };
  29279. com_ibm_rave_core_svg_Arc.INNER_RADIUS = function(data, index, groupIndex) {
  29280. return (data).innerRadius;
  29281. };
  29282. com_ibm_rave_core_svg_Arc.OUTER_RADIUS = function(data, index, groupIndex) {
  29283. return (data).outerRadius;
  29284. };
  29285. com_ibm_rave_core_svg_Arc.START_ANGLE = function(data, index, groupIndex) {
  29286. return (data).startAngle;
  29287. };
  29288. com_ibm_rave_core_svg_Arc.END_ANGLE = function(data, index, groupIndex) {
  29289. return (data).endAngle;
  29290. };
  29291. com_ibm_rave_core_svg_Arc.CORNER_RADIUS = function(data, index, groupIndex) {
  29292. return 0.0;
  29293. };
  29294. com_ibm_rave_core_svg_Arc.PAD_ANGLE = function(data, index, groupIndex) {
  29295. if (data == null) {
  29296. return null;
  29297. }
  29298. return (data).padAngle;
  29299. };
  29300. com_ibm_rave_core_svg_Arc.PAD_RADIUS = function(data, index, groupIndex) {
  29301. return "auto";
  29302. };
  29303. com_ibm_rave_core_svg_Arc.svg_arcMax = 6.283185307179586 - 1.0E-6;
  29304. // $source: com/ibm/rave/core/svg/Chord
  29305. /************************************************************************
  29306. ** IBM Confidential
  29307. **
  29308. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  29309. **
  29310. ** (C) Copyright IBM Corp. 2017
  29311. **
  29312. ** The source code for this program is not published or otherwise divested of its trade secrets,
  29313. ** irrespective of what has been deposited with the U.S. Copyright Office.
  29314. ************************************************************************/
  29315. // GENERATED
  29316. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  29317. //@import com/ibm/rave/core/svg/Arc (runtime) // Arc
  29318. /**
  29319. * 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.
  29320. */
  29321. var com_ibm_rave_core_svg_Chord = rave_externs["Chord"] = com_ibm_rave_core_nativeImpl_Declare({
  29322. //_source : null,
  29323. //_target : null,
  29324. //_radius : null,
  29325. //_startAngle : null,
  29326. //_endAngle : null,
  29327. //dataAccessor : null,
  29328. _$functionClassMethod : function() {
  29329. var _$self = function(data, index, groupIndex) {
  29330. var chordData = _$self.dataAccessor(data);
  29331. var s = _$self.subgroup(this, _$self._source, chordData, index, groupIndex), t = _$self.subgroup(this, _$self._target, chordData, index, groupIndex);
  29332. 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";
  29333. };
  29334. return _$self;
  29335. },
  29336. constructor : function() {
  29337. this._source = com_ibm_rave_core_svg_Chord.SOURCE;
  29338. this._target = com_ibm_rave_core_svg_Chord.TARGET;
  29339. this._radius = com_ibm_rave_core_svg_Chord.RAIDUS;
  29340. this._startAngle = com_ibm_rave_core_svg_Arc.START_ANGLE;
  29341. this._endAngle = com_ibm_rave_core_svg_Arc.END_ANGLE;
  29342. this.dataAccessor = com_ibm_rave_core_svg_Chord.DEFAULT_ACCESSOR_FN;
  29343. },
  29344. subgroup : function(context, f, d, i, groupIndex) {
  29345. var subgroup = f.call(context, d, i, groupIndex);
  29346. var r = + (this._radius.call(context, subgroup, i, groupIndex));
  29347. var a0 = + (this._startAngle.call(context, subgroup, i, groupIndex)) - 1.5707963267948966;
  29348. var a1 = + (this._endAngle.call(context, subgroup, i, groupIndex)) - 1.5707963267948966;
  29349. 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)]);
  29350. },
  29351. equals : function(a, b) {
  29352. return a.a0 == b.a0 && a.a1 == b.a1;
  29353. },
  29354. arc : function(r, p, a) {
  29355. return "A" + r + "," + r + " 0 " + +(a > 3.141592653589793) + ",1 " + (p);
  29356. },
  29357. curve : function(r0, p0, r1, p1) {
  29358. return "Q 0,0 " + (p1);
  29359. },
  29360. /**
  29361. * sets the end angle value function, function that will be called by the chord class to get the value on end angle
  29362. * @param (com.ibm.rave.core.selector.ValueFunction) endAngleFn the end angle function
  29363. * @return (com.ibm.rave.core.svg.Chord) this
  29364. */
  29365. endAngle$0 : function(endAngleFn) {
  29366. this._endAngle = endAngleFn;
  29367. return this;
  29368. },
  29369. /**
  29370. * Sets the current value function, this is the function that will be called to get the value of each cell
  29371. * @param (com.ibm.rave.core.functions.SingleValueFunction) valueFn the function
  29372. * @return (com.ibm.rave.core.svg.Chord) this chord layout
  29373. */
  29374. /** @expose */
  29375. setDataAccessor : function(valueFn) {
  29376. this.dataAccessor = valueFn;
  29377. return this;
  29378. },
  29379. /**
  29380. * sets the end angle value
  29381. * @param (double) value the end angle value
  29382. * @return (com.ibm.rave.core.svg.Chord) this
  29383. */
  29384. endAngle$1 : function(value) {
  29385. this._endAngle = function(data, index, groupIndex) {
  29386. return value;
  29387. };
  29388. return this;
  29389. },
  29390. /**
  29391. * gets the end angle value function
  29392. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  29393. */
  29394. endAngle$2 : function() {
  29395. return this._endAngle;
  29396. },
  29397. /**
  29398. * sets the start angle value function, function that will be called by the chord class to get the value on start angle
  29399. * @param (com.ibm.rave.core.selector.ValueFunction) startAngleFn the start angle function
  29400. * @return (com.ibm.rave.core.svg.Chord) this
  29401. */
  29402. startAngle$0 : function(startAngleFn) {
  29403. this._startAngle = startAngleFn;
  29404. return this;
  29405. },
  29406. /**
  29407. * sets the start angle value
  29408. * @param (double) value the start angle value
  29409. * @return (com.ibm.rave.core.svg.Chord) this
  29410. */
  29411. startAngle$1 : function(value) {
  29412. this._startAngle = function(data, index, groupIndex) {
  29413. return value;
  29414. };
  29415. return this;
  29416. },
  29417. /**
  29418. * gets the start angle value function
  29419. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  29420. */
  29421. startAngle$2 : function() {
  29422. return this._startAngle;
  29423. },
  29424. /**
  29425. * sets the source value function, function that will be called by the chord class to get the value on source
  29426. * @param (com.ibm.rave.core.selector.ValueFunction) sourceFn the source angle function
  29427. * @return (com.ibm.rave.core.svg.Chord) this
  29428. */
  29429. source$0 : function(sourceFn) {
  29430. this._source = sourceFn;
  29431. return this;
  29432. },
  29433. /**
  29434. * sets the source value
  29435. * @param (com.ibm.rave.core.layout.chord.SubGroupData) sourceValue the source value
  29436. * @return (com.ibm.rave.core.svg.Chord) this
  29437. */
  29438. source$1 : function(sourceValue) {
  29439. this._source = function(data, index, groupIndex) {
  29440. return sourceValue;
  29441. };
  29442. return this;
  29443. },
  29444. /**
  29445. * gets the source value function
  29446. * @return (com.ibm.rave.core.selector.ValueFunction) the source function
  29447. */
  29448. source$2 : function() {
  29449. return this._source;
  29450. },
  29451. /**
  29452. * sets the target value function, function that will be called by the chord class to get the value on target
  29453. * @param (com.ibm.rave.core.selector.ValueFunction) targetFn the start angle function
  29454. * @return (com.ibm.rave.core.svg.Chord) this
  29455. */
  29456. target$0 : function(targetFn) {
  29457. this._target = targetFn;
  29458. return this;
  29459. },
  29460. /**
  29461. * sets the target value
  29462. * @param (com.ibm.rave.core.layout.chord.SubGroupData) value the target value
  29463. * @return (com.ibm.rave.core.svg.Chord) this
  29464. */
  29465. target$1 : function(value) {
  29466. this._target = function(data, index, groupIndex) {
  29467. return value;
  29468. };
  29469. return this;
  29470. },
  29471. /**
  29472. * gets the target value function
  29473. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  29474. */
  29475. target$2 : function() {
  29476. return this._target;
  29477. },
  29478. /**
  29479. * sets the radius value function, function that will be called by the chord class to get the value of radius
  29480. * @param (com.ibm.rave.core.selector.ValueFunction) radiusFn the radius function
  29481. * @return (com.ibm.rave.core.svg.Chord) this
  29482. */
  29483. radius$0 : function(radiusFn) {
  29484. this._radius = radiusFn;
  29485. return this;
  29486. },
  29487. /**
  29488. * sets the radius value
  29489. * @param (double) value the radius value
  29490. * @return (com.ibm.rave.core.svg.Chord) this
  29491. */
  29492. radius$1 : function(value) {
  29493. this._radius = function(data, index, groupIndex) {
  29494. return value;
  29495. };
  29496. return this;
  29497. },
  29498. /**
  29499. * gets the radius value function
  29500. * @return (com.ibm.rave.core.selector.ValueFunction) the value function
  29501. */
  29502. radius$2 : function() {
  29503. return this._radius;
  29504. },
  29505. /** @expose */
  29506. endAngle : function(a0) {
  29507. var args = arguments;
  29508. if (args.length == 0) {
  29509. return this.endAngle$2();
  29510. }
  29511. if (args.length == 1 && typeof a0 === "function") {
  29512. return this.endAngle$0(a0);
  29513. }
  29514. return this.endAngle$1(a0);
  29515. },
  29516. /** @expose */
  29517. startAngle : function(a0) {
  29518. var args = arguments;
  29519. if (args.length == 0) {
  29520. return this.startAngle$2();
  29521. }
  29522. if (args.length == 1 && typeof a0 === "function") {
  29523. return this.startAngle$0(a0);
  29524. }
  29525. return this.startAngle$1(a0);
  29526. },
  29527. /** @expose */
  29528. source : function(a0) {
  29529. var args = arguments;
  29530. if (args.length == 0) {
  29531. return this.source$2();
  29532. }
  29533. if (args.length == 1 && typeof a0 === "function") {
  29534. return this.source$0(a0);
  29535. }
  29536. return this.source$1(a0);
  29537. },
  29538. /** @expose */
  29539. target : function(a0) {
  29540. var args = arguments;
  29541. if (args.length == 0) {
  29542. return this.target$2();
  29543. }
  29544. if (args.length == 1 && typeof a0 === "function") {
  29545. return this.target$0(a0);
  29546. }
  29547. return this.target$1(a0);
  29548. },
  29549. /** @expose */
  29550. radius : function(a0) {
  29551. var args = arguments;
  29552. if (args.length == 0) {
  29553. return this.radius$2();
  29554. }
  29555. if (args.length == 1 && typeof a0 === "function") {
  29556. return this.radius$0(a0);
  29557. }
  29558. return this.radius$1(a0);
  29559. }
  29560. });
  29561. com_ibm_rave_core_svg_Chord.SubGroup = function(r, a0, a1, p0, p1) {
  29562. this.r = r;
  29563. this.a0 = a0;
  29564. this.a1 = a1;
  29565. this.p0 = p0;
  29566. this.p1 = p1;
  29567. };
  29568. com_ibm_rave_core_svg_Chord.SOURCE = function(data, index, groupIndex) {
  29569. return (data).source;
  29570. };
  29571. com_ibm_rave_core_svg_Chord.TARGET = function(data, index, groupIndex) {
  29572. return (data).target;
  29573. };
  29574. com_ibm_rave_core_svg_Chord.RAIDUS = function(data, index, groupIndex) {
  29575. return (data).radius;
  29576. };
  29577. com_ibm_rave_core_svg_Chord.DEFAULT_ACCESSOR_FN = function(data) {
  29578. return data;
  29579. };
  29580. // $source: com/ibm/rave/core/svg/Axis
  29581. /************************************************************************
  29582. ** IBM Confidential
  29583. **
  29584. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  29585. **
  29586. ** (C) Copyright IBM Corp. 2017
  29587. **
  29588. ** The source code for this program is not published or otherwise divested of its trade secrets,
  29589. ** irrespective of what has been deposited with the U.S. Copyright Office.
  29590. ************************************************************************/
  29591. // GENERATED
  29592. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  29593. //@import com/ibm/rave/core/scales/Scales (runtime) // Scales
  29594. //@import com/ibm/rave/core/selector/Selector (runtime) // new
  29595. //@import com/ibm/rave/core/transition/Transition (runtime) // newTransition
  29596. //@import com/ibm/rave/core/scales/AbstractScale (loadtime) // scaleRange, superclass
  29597. //@import com/ibm/rave/core/internal/util/Identity (static) // create
  29598. /**
  29599. * 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} ).
  29600. */
  29601. var com_ibm_rave_core_svg_Axis = rave_externs["Axis"] = com_ibm_rave_core_nativeImpl_Declare({
  29602. //_scale : null,
  29603. //_orient : null,
  29604. //_tickArguments : null,
  29605. _tickValues : null,
  29606. //_tickFormat : null,
  29607. //_tickHandler : null,
  29608. _innerTickSize : 6.0,
  29609. _outerTickSize : 6.0,
  29610. _tickPadding : 3.0,
  29611. _$functionClassMethod : function() {
  29612. var _$self = function(args) {
  29613. if (args !== null || arguments.length > 1){
  29614. args = Array.prototype.slice.call(arguments, 0);
  29615. }
  29616. {
  29617. _$self.axis(args[0]);
  29618. return null;
  29619. }
  29620. };
  29621. return _$self;
  29622. },
  29623. constructor : function() {
  29624. this._scale = com_ibm_rave_core_scales_Scales.INSTANCE.linear();
  29625. this._orient = "bottom";
  29626. this._tickArguments = [];
  29627. },
  29628. /** @expose */
  29629. axis : function(g) {
  29630. var self = this;
  29631. g.each(function(data, index, groupIndex) {
  29632. var groupSelector = new com_ibm_rave_core_selector_Selector().init(this);
  29633. var __chart__ = this.rave_getProperty("__chart__");
  29634. var scale0 = __chart__ != null ? __chart__ : self._scale;
  29635. var scale1 = self._scale.copy();
  29636. this.rave_setProperty("__chart__", scale1);
  29637. var ticks = self._tickValues;
  29638. if (!ticks) {
  29639. if (scale1.ticksInRange) {
  29640. ticks = scale1.ticksInRange.apply(scale1.ticksInRange, self._tickArguments);
  29641. } else if (scale1.ticks) {
  29642. ticks = scale1.ticks.apply(scale1.ticks, self._tickArguments);
  29643. } else {
  29644. ticks = scale1.domain();
  29645. }
  29646. }
  29647. var tickFormat = self._tickFormat;
  29648. if (tickFormat == null) {
  29649. if (scale1.tickFormat) {
  29650. tickFormat = scale1.tickFormat.apply(scale1.tickFormat, self._tickArguments);
  29651. } else {
  29652. tickFormat = com_ibm_rave_core_svg_Axis._identity;
  29653. }
  29654. }
  29655. var tick = groupSelector.selectAll(".tick").data(ticks, scale1);
  29656. var tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick").style("opacity", 1.0E-6);
  29657. var tickExit = com_ibm_rave_core_transition_Transition.newTransition(tick.exit()).style("opacity", 1.0E-6).remove();
  29658. var tickUpdate = com_ibm_rave_core_transition_Transition.newTransition(tick.order()).style("opacity", 1);
  29659. var tickSpacing = Math.max(self._innerTickSize, 0) + self._tickPadding;
  29660. var tickTransformFunction;
  29661. var range = com_ibm_rave_core_scales_AbstractScale.scaleRange(scale1);
  29662. var path = groupSelector.selectAll(".domain").data([0.0]);
  29663. path.enter().append("path").attr("class", "domain");
  29664. var pathUpdate = com_ibm_rave_core_transition_Transition.newTransition(path);
  29665. tickEnter.append("line");
  29666. tickEnter.append("text");
  29667. var lineEnter = tickEnter.select("line");
  29668. var lineUpdate = tickUpdate.select("line");
  29669. var text = tick.select("text");
  29670. if (typeof tickFormat === "function") {
  29671. text.text(tickFormat);
  29672. } else {
  29673. text.text(tickFormat);
  29674. }
  29675. var textEnter = tickEnter.select("text");
  29676. var textUpdate = tickUpdate.select("text");
  29677. var sign = "top" == self._orient || "left" == self._orient ? -1 : 1;
  29678. var x1, x2, y1, y2;
  29679. if ("bottom" == self._orient || "top" == self._orient) {
  29680. tickTransformFunction = com_ibm_rave_core_svg_Axis.HORIZONTAL_TRANSFORM;
  29681. x1 = "x";
  29682. y1 = "y";
  29683. x2 = "x2";
  29684. y2 = "y2";
  29685. text.attr("dy", sign < 0 ? "0em" : ".71em").style("text-anchor", "middle");
  29686. pathUpdate.attr("d", "M" + range[0] + "," + (sign * self._outerTickSize) + "V" + "0" + "H" + range[1] + "V" + (sign * self._outerTickSize));
  29687. } else {
  29688. tickTransformFunction = com_ibm_rave_core_svg_Axis.VERTICAL_TRANSFORM;
  29689. x1 = "y";
  29690. y1 = "x";
  29691. x2 = "y2";
  29692. y2 = "x2";
  29693. text.attr("dy", ".32em").style("text-anchor", sign < 0 ? "end" : "start");
  29694. pathUpdate.attr("d", "M" + (sign * self._outerTickSize) + "," + range[0] + "H" + "0" + "V" + range[1] + "H" + (sign * self._outerTickSize));
  29695. }
  29696. lineEnter.attr(y2, sign * self._innerTickSize);
  29697. textEnter.attr(y1, sign * tickSpacing);
  29698. lineUpdate.attr(x2, 0).attr(y2, sign * self._innerTickSize);
  29699. textUpdate.attr(x1, 0).attr(y1, sign * tickSpacing);
  29700. if (scale1.rangeBand) {
  29701. var dx = (scale1.rangeBand()) / 2;
  29702. scale0 = scale1 = new com_ibm_rave_core_svg_Axis.DeltaScale(scale1, dx);
  29703. } else if (scale0.rangeBand) {
  29704. scale0 = scale1;
  29705. } else {
  29706. tickTransformFunction(tickExit, scale1, scale0);
  29707. }
  29708. tickTransformFunction(tickEnter, scale0, scale1);
  29709. tickTransformFunction(tickUpdate, scale1, scale1);
  29710. var __tickHandler__ = this.rave_getProperty("__tickHandler__");
  29711. this.rave_setProperty("__tickHandler__", self._tickHandler);
  29712. if (__tickHandler__ != null && typeof __tickHandler__ === "function") {
  29713. var tickHandler = __tickHandler__;
  29714. tickHandler.reset(tick);
  29715. }
  29716. if (self._tickHandler) {
  29717. if (tickUpdate.isTransition()) {
  29718. (tickUpdate).tween("__axisLabelDrop__", function(data, index, groupIndex) {
  29719. return function(t) {
  29720. if (self._tickHandler) {
  29721. self._tickHandler.call(this, com_ibm_rave_core_transition_Transition.newTransition(tick), self._orient);
  29722. }
  29723. };
  29724. });
  29725. } else {
  29726. self._tickHandler.call(this, tick, self._orient);
  29727. }
  29728. }
  29729. });
  29730. },
  29731. /**
  29732. * Set the scale this axis should represent.
  29733. * @param (com.ibm.rave.core.scales.AbstractScale) scale The scale object to assign to this axis (e.g. LinearScale, OrdinalScale).
  29734. * @return (com.ibm.rave.core.svg.Axis) this Axis instance.
  29735. */
  29736. scale$0 : function(scale) {
  29737. this._scale = scale;
  29738. return this;
  29739. },
  29740. /**
  29741. * Get the scale assigned to this axis.
  29742. * @return (com.ibm.rave.core.scales.AbstractScale) Scale ValueFunction.
  29743. */
  29744. scale$1 : function() {
  29745. return this._scale;
  29746. },
  29747. /**
  29748. * Set the axis orientation. Can be one of: <ul> <li>bottom</li> <li>top</li> <li>left</li> <li>right</li> </ul>
  29749. * @param (String) orientation The orientation to assign to this axis.
  29750. * @return (com.ibm.rave.core.svg.Axis) this Axis instance.
  29751. */
  29752. orient$0 : function(orientation) {
  29753. if ("bottom" == orientation || "top" == orientation || "left" == orientation || "right" == orientation) {
  29754. this._orient = orientation;
  29755. } else {
  29756. this._orient = "bottom";
  29757. }
  29758. return this;
  29759. },
  29760. /**
  29761. * Get the current orientation.
  29762. * @return (String) Orientation String.
  29763. */
  29764. orient$1 : function() {
  29765. return this._orient;
  29766. },
  29767. /**
  29768. * 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>
  29769. * @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} ).
  29770. * @return (com.ibm.rave.core.svg.Axis) This Axis.
  29771. */
  29772. ticks$0 : function(tickArguments) {
  29773. if (tickArguments !== null || arguments.length > 1){
  29774. tickArguments = Array.prototype.slice.call(arguments);
  29775. }
  29776. {
  29777. this._tickArguments = tickArguments;
  29778. return this;
  29779. }
  29780. },
  29781. /**
  29782. * Get the currently assigned tick arguments. Default is [10].
  29783. * @return (java.lang.Object[]) Array of tick argument values.
  29784. */
  29785. ticks$1 : function() {
  29786. return this._tickArguments;
  29787. },
  29788. /**
  29789. * 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.
  29790. * @param (Array) values Array of tick values.
  29791. * @return (com.ibm.rave.core.svg.Axis) This Axis.
  29792. */
  29793. tickValues$0 : function(values) {
  29794. this._tickValues = values;
  29795. return this;
  29796. },
  29797. /**
  29798. * Get the currently assigned tick values.
  29799. * @return (Array) Array of tick values, or null if none have been assigned (see {@link #this.tickValues(Array)} ).
  29800. */
  29801. tickValues$1 : function() {
  29802. return this._tickValues;
  29803. },
  29804. /**
  29805. * Specify tick label formatting.
  29806. * @param (Object) format
  29807. * @return (com.ibm.rave.core.svg.Axis) this Axis instance.
  29808. */
  29809. tickFormat$0 : function(format) {
  29810. this._tickFormat = format;
  29811. return this;
  29812. },
  29813. /**
  29814. * Specify tick label formatting.
  29815. * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction "anonymous" function class, when executed, returns the formatted tick value.
  29816. * @return (com.ibm.rave.core.svg.Axis) this Axis instance.
  29817. */
  29818. tickFormat$1 : function(valueFunction) {
  29819. this._tickFormat = valueFunction;
  29820. return this;
  29821. },
  29822. /**
  29823. * Get the currently assigned tick format.
  29824. * @return (Object) The tick format object, or null if a format has not been specified.
  29825. */
  29826. tickFormat$2 : function() {
  29827. return this._tickFormat;
  29828. },
  29829. /**
  29830. * Specify the size (length) of the inner and outer axis tick marks.
  29831. * @param (Object) size The size of the inner and outer tick marks.
  29832. * @return (com.ibm.rave.core.svg.Axis) this Axis instance.
  29833. */
  29834. tickSize$0 : function(size) {
  29835. return this.tickSize$1(size, size);
  29836. },
  29837. /**
  29838. * Specify the size (length) of the axis tick marks.
  29839. * @param (Object) inner The size of ticks that will appear inside the bounds of the axis.
  29840. * @param (Object) outer The size of ticks that will appear at the ends of the axis.
  29841. * @return (com.ibm.rave.core.svg.Axis) this Axis instance.
  29842. */
  29843. tickSize$1 : function(inner, outer) {
  29844. this.innerTickSize(inner);
  29845. this.outerTickSize(outer);
  29846. return this;
  29847. },
  29848. /**
  29849. * This method is included for backward compatibility. This is identical to calling {@link #this.tickSize(Object, Object)} (excluding the "extra" parameter).
  29850. * @param (Object) inner Inner tick size.
  29851. * @param (Object) extra Deprecated extra parameter.
  29852. * @param (Object) outer Outer tick size.
  29853. * @return (com.ibm.rave.core.svg.Axis) This Axis instance.
  29854. */
  29855. tickSize$2 : function(inner, extra, outer) {
  29856. return this.tickSize$1(inner, outer);
  29857. },
  29858. /**
  29859. * Get the currently assigned <em>inner</em> tick size (in pixels). Default is 6.
  29860. * @return (double) Tick size in pixels.
  29861. */
  29862. tickSize$3 : function() {
  29863. return this._innerTickSize;
  29864. },
  29865. /**
  29866. * Specify the size (length) of the inner axis tick marks.
  29867. * @param (Object) size The size of ticks that will appear inside the bounds of the axis.
  29868. * @return (com.ibm.rave.core.svg.Axis) this Axis instance.
  29869. */
  29870. innerTickSize$0 : function(size) {
  29871. this._innerTickSize = + (size);
  29872. return this;
  29873. },
  29874. /**
  29875. * Get the currently assigned inner tick size (in pixels). Default is 6.
  29876. * @return (double) Tick size in pixels.
  29877. */
  29878. innerTickSize$1 : function() {
  29879. return this._innerTickSize;
  29880. },
  29881. /**
  29882. * Specify the size (length) of the outer axis tick marks.
  29883. * @param (Object) size The size of ticks that will appear at the outer bounds of the axis.
  29884. * @return (com.ibm.rave.core.svg.Axis) this Axis instance.
  29885. */
  29886. outerTickSize$0 : function(size) {
  29887. this._outerTickSize = + (size);
  29888. return this;
  29889. },
  29890. /**
  29891. * Get the currently assigned outer tick size (in pixels). Default is 6.
  29892. * @return (double) Tick size in pixels.
  29893. */
  29894. outerTickSize$1 : function() {
  29895. return this._outerTickSize;
  29896. },
  29897. /**
  29898. * Specify the padding distance between tick marks and their labels.
  29899. * @param (Object) padding Padding value in pixels.
  29900. * @return (com.ibm.rave.core.svg.Axis) this Axis instance.
  29901. */
  29902. tickPadding$0 : function(padding) {
  29903. this._tickPadding = + (padding);
  29904. return this;
  29905. },
  29906. /**
  29907. * Get the currently assigned padding (in pixels). Default is 3.
  29908. * @return (double) Padding distance in pixels.
  29909. */
  29910. tickPadding$1 : function() {
  29911. return this._tickPadding;
  29912. },
  29913. /**
  29914. * This is present in the d3 API, but is listed as deprecated and has no functionality.
  29915. */
  29916. tickSubdivide$0 : function() {
  29917. return 0;
  29918. },
  29919. /**
  29920. * This is present in the d3 API, but is listed as deprecated and has no functionality.
  29921. */
  29922. tickSubdivide$1 : function(arg) {
  29923. return this;
  29924. },
  29925. /**
  29926. * Specify a callback that will be invoked on Axis creation. On Java, this callback will receive two arguments - the axis group node and a selector containing a set of tick nodes. <p> On JavaScript, the callback will receive one argument - the selector of tick nodes. <p> Each tick node contains a line representing the tick and a text node representing the tick text. The tick nodes will be sorted in data order. <p> If the axis is currently part of a transition, the tick handler will be called for each frame of the animation.
  29927. * @param (com.ibm.rave.core.svg.AbstractTickHandler) callback The function to callback. Will receive two arguments - the axis group scene node and a selector containing the ticks.
  29928. * @return (com.ibm.rave.core.svg.Axis) this Axis instance.
  29929. */
  29930. ticksHandler$0 : function(callback) {
  29931. this._tickHandler = callback;
  29932. return this;
  29933. },
  29934. /**
  29935. * Specify a callback that will be invoked on Axis creation. On Java, this callback will receive two arguments - the axis group node and a selector containing a set of tick nodes. <p> On JavaScript, the callback will receive one argument - the selector of tick nodes. <p> Each tick node contains a line representing the tick and a text node representing the tick text. The tick nodes will be sorted in data order. <p> If the axis is currently part of a transition, the tick handler will be called for each frame of the animation.
  29936. * @param (com.ibm.rave.core.selector.RunFunction) callback The function to callback. Will receive two arguments - the axis group scene node and a selector containing the ticks.
  29937. * @return (com.ibm.rave.core.svg.Axis) this Axis instance.
  29938. */
  29939. ticksHandler$1 : function(callback) {
  29940. this._tickHandler = callback;
  29941. return this;
  29942. },
  29943. /**
  29944. * Get the currently assigned tick handler callback.
  29945. * @return (com.ibm.rave.core.selector.RunFunction) the label overlap callback.
  29946. */
  29947. ticksHandler$2 : function() {
  29948. return this._tickHandler;
  29949. },
  29950. /** @expose */
  29951. scale : function(a0) {
  29952. var args = arguments;
  29953. if (args.length == 0) {
  29954. return this.scale$1();
  29955. }
  29956. return this.scale$0(a0);
  29957. },
  29958. /** @expose */
  29959. orient : function(a0) {
  29960. var args = arguments;
  29961. if (args.length == 0) {
  29962. return this.orient$1();
  29963. }
  29964. return this.orient$0(a0);
  29965. },
  29966. /** @expose */
  29967. ticks : function(a0) {
  29968. var args = arguments;
  29969. if (args.length == 0) {
  29970. return this.ticks$1();
  29971. }
  29972. return this.ticks$0.apply(this, args);
  29973. },
  29974. /** @expose */
  29975. tickValues : function(a0) {
  29976. var args = arguments;
  29977. if (args.length == 0) {
  29978. return this.tickValues$1();
  29979. }
  29980. return this.tickValues$0(a0);
  29981. },
  29982. /** @expose */
  29983. tickFormat : function(a0) {
  29984. var args = arguments;
  29985. if (args.length == 0) {
  29986. return this.tickFormat$2();
  29987. }
  29988. if (args.length == 1 && typeof a0 === "function") {
  29989. return this.tickFormat$1(a0);
  29990. }
  29991. return this.tickFormat$0(a0);
  29992. },
  29993. /** @expose */
  29994. tickSize : function(a0, a1, a2) {
  29995. var args = arguments;
  29996. if (args.length == 0) {
  29997. return this.tickSize$3();
  29998. }
  29999. if (args.length == 1) {
  30000. return this.tickSize$0(a0);
  30001. }
  30002. if (args.length == 2) {
  30003. return this.tickSize$1(a0, a1);
  30004. }
  30005. return this.tickSize$2(a0, a1, a2);
  30006. },
  30007. /** @expose */
  30008. innerTickSize : function(a0) {
  30009. var args = arguments;
  30010. if (args.length == 0) {
  30011. return this.innerTickSize$1();
  30012. }
  30013. return this.innerTickSize$0(a0);
  30014. },
  30015. /** @expose */
  30016. outerTickSize : function(a0) {
  30017. var args = arguments;
  30018. if (args.length == 0) {
  30019. return this.outerTickSize$1();
  30020. }
  30021. return this.outerTickSize$0(a0);
  30022. },
  30023. /** @expose */
  30024. tickPadding : function(a0) {
  30025. var args = arguments;
  30026. if (args.length == 0) {
  30027. return this.tickPadding$1();
  30028. }
  30029. return this.tickPadding$0(a0);
  30030. },
  30031. /** @expose */
  30032. tickSubdivide : function(a0) {
  30033. var args = arguments;
  30034. if (args.length == 0) {
  30035. return this.tickSubdivide$0();
  30036. }
  30037. return this.tickSubdivide$1(a0);
  30038. },
  30039. /** @expose */
  30040. ticksHandler : function(a0) {
  30041. var args = arguments;
  30042. if (args.length == 0) {
  30043. return this.ticksHandler$2();
  30044. }
  30045. if (args.length == 1 && typeof a0 === "function" && a0.length == 1) {
  30046. return this.ticksHandler$1(a0);
  30047. }
  30048. return this.ticksHandler$0(a0);
  30049. }
  30050. });
  30051. com_ibm_rave_core_svg_Axis.DeltaScale = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scales_AbstractScale, {
  30052. //wrappedScale : null,
  30053. delta : 0,
  30054. _$functionClassMethod : function() {
  30055. var _$self = function(data, index, groupIndex) {
  30056. return + (_$self.wrappedScale.call(this, data, index, groupIndex)) + _$self.delta;
  30057. };
  30058. return _$self;
  30059. },
  30060. /** @expose */
  30061. constructor : function(referencedScale, delta) {
  30062. this.wrappedScale = referencedScale;
  30063. this.delta = delta;
  30064. },
  30065. domain$0 : function(values) {
  30066. return null;
  30067. },
  30068. domain$1 : function() {
  30069. return null;
  30070. },
  30071. range$0 : function(values) {
  30072. return null;
  30073. },
  30074. range$1 : function() {
  30075. return null;
  30076. },
  30077. /** @expose */
  30078. copy : function() {
  30079. return null;
  30080. },
  30081. /** @expose */
  30082. domain : function(a0) {
  30083. var args = arguments;
  30084. if (args.length == 0) {
  30085. return this.domain$1();
  30086. }
  30087. return this.domain$0(a0);
  30088. },
  30089. /** @expose */
  30090. range : function(a0) {
  30091. var args = arguments;
  30092. if (args.length == 0) {
  30093. return this.range$1();
  30094. }
  30095. return this.range$0(a0);
  30096. }
  30097. });
  30098. //com_ibm_rave_core_svg_Axis.BOTTOM_ORIENT = "bottom";
  30099. //com_ibm_rave_core_svg_Axis.TOP_ORIENT = "top";
  30100. //com_ibm_rave_core_svg_Axis.LEFT_ORIENT = "left";
  30101. //com_ibm_rave_core_svg_Axis.RIGHT_ORIENT = "right";
  30102. //com_ibm_rave_core_svg_Axis.PROPERTY_CHART = "__chart__";
  30103. //com_ibm_rave_core_svg_Axis.CLASS_DOMAIN = "domain";
  30104. //com_ibm_rave_core_svg_Axis.ATTR_TRANSFORM = "transform";
  30105. //com_ibm_rave_core_svg_Axis.ATTR_X = "x";
  30106. //com_ibm_rave_core_svg_Axis.ATTR_Y = "y";
  30107. //com_ibm_rave_core_svg_Axis.ATTR_X2 = "x2";
  30108. //com_ibm_rave_core_svg_Axis.ATTR_Y2 = "y2";
  30109. //com_ibm_rave_core_svg_Axis.ATTR_DY = "dy";
  30110. //com_ibm_rave_core_svg_Axis.ATTR_SVG_PATH_DATA = "d";
  30111. //com_ibm_rave_core_svg_Axis.CLASS_PROPERTY = "class";
  30112. //com_ibm_rave_core_svg_Axis.CLASS_TICK = "tick";
  30113. //com_ibm_rave_core_svg_Axis.STYLE_OPACITY = "opacity";
  30114. //com_ibm_rave_core_svg_Axis.STYLE_TEXT_ANCHOR = "text-anchor";
  30115. //com_ibm_rave_core_svg_Axis.ANCHOR_MIDDLE = "middle";
  30116. //com_ibm_rave_core_svg_Axis.ANCHOR_START = "start";
  30117. //com_ibm_rave_core_svg_Axis.ANCHOR_END = "end";
  30118. //com_ibm_rave_core_svg_Axis.DY_HORIZONTAL_TOP = "0em";
  30119. //com_ibm_rave_core_svg_Axis.DY_HORIZONTAL_BOTTOM = ".71em";
  30120. //com_ibm_rave_core_svg_Axis.DY_VERTICAL = ".32em";
  30121. //com_ibm_rave_core_svg_Axis.SVG_VERTICAL_LINETO = "V";
  30122. //com_ibm_rave_core_svg_Axis.SVG_HORIZONTAL_LINETO = "H";
  30123. //com_ibm_rave_core_svg_Axis.SVG_ZERO_COORD = "0";
  30124. //com_ibm_rave_core_svg_Axis.PROPERTY_TICK_HANDLER = "__tickHandler__";
  30125. //com_ibm_rave_core_svg_Axis.DEFAULT_ORIENT = "bottom";
  30126. //com_ibm_rave_core_svg_Axis.CLASS_DOMAIN_SELECTOR = "." + "domain";
  30127. //com_ibm_rave_core_svg_Axis.CLASS_TICK_SELECTOR = "." + "tick";
  30128. com_ibm_rave_core_svg_Axis._identity = com_ibm_rave_core_internal_util_Identity.create();
  30129. com_ibm_rave_core_svg_Axis.HORIZONTAL_TRANSFORM = function(ticks, scale, scale2) {
  30130. ticks.attr("transform", function(data, index, groupIndex) {
  30131. var value = + (scale.call(this, data, index, groupIndex));
  30132. if (!(isFinite(value))) {
  30133. value = + (scale2.call(this, data, index, groupIndex));
  30134. }
  30135. return "translate(" + value + ",0)";
  30136. });
  30137. };
  30138. com_ibm_rave_core_svg_Axis.VERTICAL_TRANSFORM = function(ticks, scale, scale2) {
  30139. ticks.attr("transform", function(data, index, groupIndex) {
  30140. var value = + (scale.call(this, data, index, groupIndex));
  30141. if (!(isFinite(value))) {
  30142. value = + (scale2.call(this, data, index, groupIndex));
  30143. }
  30144. return "translate(0," + value + ")";
  30145. });
  30146. };
  30147. // $source: com/ibm/rave/core/svg/Brush
  30148. /************************************************************************
  30149. ** IBM Confidential
  30150. **
  30151. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  30152. **
  30153. ** (C) Copyright IBM Corp. 2017
  30154. **
  30155. ** The source code for this program is not published or otherwise divested of its trade secrets,
  30156. ** irrespective of what has been deposited with the U.S. Copyright Office.
  30157. ************************************************************************/
  30158. // GENERATED
  30159. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // bind, declare
  30160. //@import com/ibm/rave/core/internal/event/CustomDispatcher (runtime) // create
  30161. //@import com/ibm/rave/core/selector/Selector (runtime) // new
  30162. //@import com/ibm/rave/core/internal/nativeImpl/event/DragSuppress (runtime) // dragSuppress
  30163. //@import com/ibm/rave/core/nativeImpl/event/Mouse (runtime) // mousePoint
  30164. //@import com/ibm/rave/core/internal/nativeImpl/PlatformInitialization (runtime) // getWindow, getDocumentBodyElement
  30165. //@import com/ibm/rave/core/scales/AbstractScale (runtime) // scaleRange
  30166. //@import com/ibm/rave/core/transition/Transition (runtime) // newTransition
  30167. //@import com/ibm/rave/core/internal/nativeImpl/transitions/InheritedTransition (runtime) // get
  30168. //@import com/ibm/rave/core/interpolate/ArrayInterpolation (runtime) // ArrayInterpolation
  30169. //@import com/ibm/rave/core/event/BaseEvent (loadtime) // superclass
  30170. /**
  30171. * 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.
  30172. */
  30173. var com_ibm_rave_core_svg_Brush = com_ibm_rave_core_nativeImpl_Declare({
  30174. //brushResizes : null,
  30175. //brushCursor : null,
  30176. //eventDispatcher : null,
  30177. //origin : null,
  30178. //center : null,
  30179. //offset : null,
  30180. //xExtent : null,
  30181. //yExtent : null,
  30182. //xExtentDomain : null,
  30183. //yExtentDomain : null,
  30184. //resizes : null,
  30185. //xScale : null,
  30186. //yScale : null,
  30187. //brushstartMouseDown : null,
  30188. //brushstartTouchStart : null,
  30189. dragging : 0,
  30190. xClamp : false,
  30191. yClamp : false,
  30192. _$functionClassMethod : function() {
  30193. var _$self = /**
  30194. * 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.
  30195. */
  30196. function(args) {
  30197. if (args !== null || arguments.length > 1){
  30198. args = Array.prototype.slice.call(arguments, 0);
  30199. }
  30200. {
  30201. _$self.brush(args[0]);
  30202. return null;
  30203. }
  30204. };
  30205. return _$self;
  30206. },
  30207. constructor : function() {
  30208. this.eventDispatcher = com_ibm_rave_core_internal_event_CustomDispatcher.create$0(this, "brushstart", "brush", "brushend");
  30209. /**
  30210. */
  30211. {
  30212. this.brushResizes = [["n", "e", "s", "w", "nw", "ne", "se", "sw"], ["e", "w"], ["n", "s"], []];
  30213. this.brushCursor = {};
  30214. this.brushCursor["n"] = "ns-resize";
  30215. this.brushCursor["e"] = "ew-resize";
  30216. this.brushCursor["s"] = "ns-resize";
  30217. this.brushCursor["w"] = "ew-resize";
  30218. this.brushCursor["nw"] = "nwse-resize";
  30219. this.brushCursor["ne"] = "nesw-resize";
  30220. this.brushCursor["se"] = "nwse-resize";
  30221. this.brushCursor["sw"] = "nesw-resize";
  30222. this.xScale = null;
  30223. this.yScale = null;
  30224. this.xExtent = [0.0, 0.0];
  30225. this.yExtent = [0.0, 0.0];
  30226. this.xClamp = true;
  30227. this.yClamp = true;
  30228. this.resizes = this.brushResizes[0];
  30229. this.origin = [];
  30230. var self = this;
  30231. this.brushstartMouseDown = function(data, index, groupIndex, event) {
  30232. self.handleBrushStartEvent(this, data, index, groupIndex, event, false);
  30233. };
  30234. this.brushstartTouchStart = function(data, index, groupIndex, event) {
  30235. self.handleBrushStartEvent(this, data, index, groupIndex, event, true);
  30236. };
  30237. }
  30238. },
  30239. handleBrushStartEvent : function(context, data, index, groupIndex, event, touchEvent) {
  30240. var self = this;
  30241. var target = context;
  30242. var eventTarget = new com_ibm_rave_core_selector_Selector().init(rave.event.target);
  30243. var event_ = this.eventDispatcher.of(target, data, index, groupIndex);
  30244. var g = new com_ibm_rave_core_selector_Selector().init(target);
  30245. var resizing = "";
  30246. var eventTargetDatum = eventTarget.datum();
  30247. if ((eventTargetDatum)) {
  30248. resizing = eventTargetDatum.toString();
  30249. }
  30250. var resizingX = (!(new RegExp("^(n|s)$", "g").test(resizing)) && this.xScale);
  30251. var resizingY = (!(new RegExp("^(e|w)$", "g").test(resizing)) && this.yScale);
  30252. this.dragging = +(eventTarget.classed("extent"));
  30253. var dragRestore = com_ibm_rave_core_internal_nativeImpl_event_DragSuppress.dragSuppress(target);
  30254. var originPoint = com_ibm_rave_core_nativeImpl_event_Mouse.mousePoint(target);
  30255. this.origin[0] = originPoint[0];
  30256. this.origin[1] = originPoint[1];
  30257. this.offset = null;
  30258. this.center = null;
  30259. var keydown = function(data, index, groupIndex, event) {
  30260. if ((rave.event).keyCode == 32) {
  30261. if (!((self.dragging))) {
  30262. self.center = null;
  30263. self.origin[0] -= self.xExtent[1];
  30264. self.origin[1] -= self.yExtent[1];
  30265. self.dragging = 2;
  30266. }
  30267. rave.event.preventDefault();
  30268. }
  30269. };
  30270. var keyup = function(data, index, groupIndex, event) {
  30271. if ((rave.event).keyCode == 32 && self.dragging == 2) {
  30272. self.origin[0] += self.xExtent[1];
  30273. self.origin[1] += self.yExtent[1];
  30274. self.dragging = 0;
  30275. rave.event.preventDefault();
  30276. }
  30277. };
  30278. 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);
  30279. var brushmove = function(data, index, groupIndex, event) {
  30280. var p = com_ibm_rave_core_nativeImpl_event_Mouse.mousePoint(target);
  30281. var point = [p[0], p[1]];
  30282. var moved = false;
  30283. if (self.offset) {
  30284. point[0] += self.offset[0];
  30285. point[1] += self.offset[1];
  30286. }
  30287. if (!((self.dragging))) {
  30288. if ((rave.event).altKey) {
  30289. if (!self.center) {
  30290. self.center = [(self.xExtent[0] + self.xExtent[1]) / 2, (self.yExtent[0] + self.yExtent[1]) / 2];
  30291. }
  30292. self.origin[0] = self.xExtent[+(point[0] < self.center[0])];
  30293. self.origin[1] = self.yExtent[+(point[1] < self.center[1])];
  30294. } else {
  30295. self.center = null;
  30296. }
  30297. }
  30298. if (resizingX && self.move1(point, self.xScale, 0)) {
  30299. self.redrawX(g);
  30300. moved = true;
  30301. }
  30302. if (resizingY && self.move1(point, self.yScale, 1)) {
  30303. self.redrawY(g);
  30304. moved = true;
  30305. }
  30306. if (moved) {
  30307. self.redraw(g);
  30308. event_(new com_ibm_rave_core_svg_Brush.EventObject("brush", !((self.dragging)) ? "move" : "resize"));
  30309. }
  30310. };
  30311. var brushend = function(data, index, groupIndex, event) {
  30312. brushmove.call(this, data, index, groupIndex, event);
  30313. g.style("pointer-events", "all").selectAll(".resize").style("display", self.empty() ? "none" : null);
  30314. new com_ibm_rave_core_selector_Selector().init(com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocumentBodyElement()).style("cursor", null);
  30315. 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);
  30316. dragRestore(false);
  30317. event_(new com_ibm_rave_core_svg_Brush.EventObject("brushend", null));
  30318. };
  30319. if (touchEvent && (rave.event).changedTouches) {
  30320. w.on("touchmove.brush", brushmove).on("touchend.brush", brushend);
  30321. } else {
  30322. w.on("mousemove.brush", brushmove).on("mouseup.brush", brushend);
  30323. }
  30324. g.interrupt().selectAll("*").interrupt();
  30325. if ((this.dragging)) {
  30326. this.origin[0] = this.xExtent[0] - this.origin[0];
  30327. this.origin[1] = this.yExtent[0] - this.origin[1];
  30328. } else if ((resizing)) {
  30329. var ex = +(new RegExp("w$", "g").test(resizing));
  30330. var ey = +(new RegExp("^n", "g").test(resizing));
  30331. this.offset = [this.xExtent[1 - ex] - this.origin[0], this.yExtent[1 - ey] - this.origin[1]];
  30332. this.origin[0] = this.xExtent[ex];
  30333. this.origin[1] = this.yExtent[ey];
  30334. }
  30335. if ((rave.event).altKey) {
  30336. this.center = [this.origin[0], this.origin[1]];
  30337. }
  30338. g.style("pointer-events", "none").selectAll(".resize").style("display", null);
  30339. new com_ibm_rave_core_selector_Selector().init(com_ibm_rave_core_internal_nativeImpl_PlatformInitialization.getDocumentBodyElement()).style("cursor", eventTarget.style("cursor"));
  30340. event_(new com_ibm_rave_core_svg_Brush.EventObject("brushstart", null));
  30341. brushmove.call(context, data, index, groupIndex, event);
  30342. },
  30343. move1 : function(point, scale, i) {
  30344. var range = com_ibm_rave_core_scales_AbstractScale.scaleRange(scale);
  30345. var r0 = (range[0]);
  30346. var r1 = (range[1]);
  30347. var position = this.origin[i];
  30348. var extent = (i) ? this.yExtent : this.xExtent;
  30349. var size = extent[1] - extent[0];
  30350. var min, max;
  30351. if ((this.dragging)) {
  30352. r0 -= position;
  30353. r1 -= size + position;
  30354. }
  30355. min = ((i) ? this.yClamp : this.xClamp) ? Math.max(r0, Math.min(r1, point[i])) : point[i];
  30356. if ((this.dragging)) {
  30357. max = (min += position) + size;
  30358. } else {
  30359. if (this.center) {
  30360. position = Math.max(r0, Math.min(r1, 2 * this.center[i] - min));
  30361. }
  30362. if (position < min) {
  30363. max = min;
  30364. min = position;
  30365. } else {
  30366. max = position;
  30367. }
  30368. }
  30369. if (extent[0] != min || extent[1] != max) {
  30370. if ((i)) {
  30371. this.yExtentDomain = null;
  30372. } else {
  30373. this.xExtentDomain = null;
  30374. }
  30375. extent[0] = min;
  30376. extent[1] = max;
  30377. return true;
  30378. }
  30379. return false;
  30380. },
  30381. /**
  30382. * 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.
  30383. */
  30384. /** @expose */
  30385. brush : function(context) {
  30386. var self = this;
  30387. context.each(function(data, index, groupIndex) {
  30388. 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);
  30389. var background = g.selectAll(".background").data([0.0]);
  30390. background.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair");
  30391. g.selectAll(".extent").data([0.0]).enter().append("rect").attr("class", "extent").style("cursor", "move");
  30392. var resize = g.selectAll(".resize").data(self.resizes, function(data, index, groupIndex) {
  30393. return data;
  30394. });
  30395. resize.exit().remove();
  30396. resize.enter().append("g").attr("class", function(data, index, groupIndex) {
  30397. return "resize " + data;
  30398. }).style("cursor", function(data, index, groupIndex) {
  30399. return self.brushCursor[data];
  30400. }).append("rect").attr("x", function(data, index, groupIndex) {
  30401. return new RegExp("[ew]$", "g").test(data.toString()) ? -3 : null;
  30402. }).attr("y", function(data, index, groupIndex) {
  30403. return new RegExp("^[ns]", "g").test(data.toString()) ? -3 : null;
  30404. }).attr("width", 6).attr("height", 6).style("visibility", "hidden");
  30405. resize.style("display", self.empty() ? "none" : null);
  30406. var gUpdate = com_ibm_rave_core_transition_Transition.newTransition(g);
  30407. var backgroundUpdate = com_ibm_rave_core_transition_Transition.newTransition(background);
  30408. var range;
  30409. if (self.xScale) {
  30410. range = com_ibm_rave_core_scales_AbstractScale.scaleRange(self.xScale);
  30411. backgroundUpdate.attr("x", range[0]).attr("width", ((range[1]) - ((range[0]))));
  30412. self.redrawX(gUpdate);
  30413. }
  30414. if (self.yScale) {
  30415. range = com_ibm_rave_core_scales_AbstractScale.scaleRange(self.yScale);
  30416. backgroundUpdate.attr("y", range[0]).attr("height", ((range[1])) - ((range[0])));
  30417. self.redrawY(gUpdate);
  30418. }
  30419. self.redraw(gUpdate);
  30420. });
  30421. },
  30422. /**
  30423. * 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.
  30424. * @return (boolean) true if the brush is empty, false otherwise
  30425. */
  30426. /** @expose */
  30427. empty : function() {
  30428. var xDim = false;
  30429. var yDim = false;
  30430. if (this.xScale) {
  30431. xDim = this.xExtent[0] == this.xExtent[1];
  30432. }
  30433. if (this.yScale) {
  30434. yDim = this.yExtent[0] == this.yExtent[1];
  30435. }
  30436. return xDim || yDim;
  30437. },
  30438. /**
  30439. * Clears the extent, making the brush extent empty.
  30440. * @return (com.ibm.rave.core.svg.Brush) this brush instance itself
  30441. */
  30442. /** @expose */
  30443. clear : function() {
  30444. if (!(this.empty())) {
  30445. this.xExtent = [0.0, 0.0];
  30446. this.yExtent = [0.0, 0.0];
  30447. this.xExtentDomain = this.yExtentDomain = null;
  30448. }
  30449. return this;
  30450. },
  30451. /**
  30452. * Gets the listener for the specified event type supported by brush: brushstart, brush,brushend
  30453. * @param (String) type the type of event to get the listener for
  30454. * @return (com.ibm.rave.core.selector.RunFunction) the listener for the specified event or null if none was registered
  30455. */
  30456. on$0 : function(type) {
  30457. return this.eventDispatcher.on$0(type);
  30458. },
  30459. /**
  30460. * Sets a listener for the specified event type supported by brush: brushstart, brush,brushend
  30461. * @param (String) type the type of the brush event to listener for
  30462. * @param (com.ibm.rave.core.selector.RunFunction) listener the listener
  30463. * @return (com.ibm.rave.core.svg.Brush) this brush instance itself
  30464. */
  30465. on$1 : function(type, listener) {
  30466. this.eventDispatcher.on$1(type, listener);
  30467. return this;
  30468. },
  30469. /**
  30470. * 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.
  30471. * @param (com.ibm.rave.core.selector.Selection) g the selection to trigger events for
  30472. */
  30473. /** @expose */
  30474. event : com_ibm_rave_core_nativeImpl_Declare.bind(function(g) {
  30475. var self = this;
  30476. g.each(function(data, index, groupIndex) {
  30477. var event_ = self.eventDispatcher.of(this, data, index, groupIndex);
  30478. var brushExtent = this.rave_getProperty("__chart__");
  30479. var extent1 = new com_ibm_rave_core_svg_Brush.BrushExtent(self.xExtent, self.yExtent, self.xExtentDomain, self.yExtentDomain);
  30480. var extent0 = (!brushExtent) ? extent1 : brushExtent;
  30481. this.rave_setProperty("__chart__", extent1);
  30482. if (com_ibm_rave_core_internal_nativeImpl_transitions_InheritedTransition.get()) {
  30483. new com_ibm_rave_core_selector_Selector().init(this).transition().each("start.brush", function(args) {
  30484. if (args !== null || arguments.length > 1){
  30485. args = Array.prototype.slice.call(arguments, 0);
  30486. }
  30487. {
  30488. self.xExtentDomain = extent0.i;
  30489. self.yExtentDomain = extent0.j;
  30490. self.xExtent = extent0.x;
  30491. self.yExtent = extent0.y;
  30492. event_(new com_ibm_rave_core_svg_Brush.EventObject("brushstart", null));
  30493. return null;
  30494. }
  30495. }).tween("brush:brush", function(data, index, groupIndex) {
  30496. var xi = com_ibm_rave_core_interpolate_ArrayInterpolation.INSTANCE(self.xExtent, extent1.x);
  30497. var yi = com_ibm_rave_core_interpolate_ArrayInterpolation.INSTANCE(self.yExtent, extent1.y);
  30498. self.xExtentDomain = self.yExtentDomain = null;
  30499. return function(t) {
  30500. self.xExtent = extent1.x = (xi(t));
  30501. self.yExtent = extent1.y = (yi(t));
  30502. event_(new com_ibm_rave_core_svg_Brush.EventObject("brush", "resize"));
  30503. };
  30504. }).each("end.brush", function(args) {
  30505. if (args !== null || arguments.length > 1){
  30506. args = Array.prototype.slice.call(arguments, 0);
  30507. }
  30508. {
  30509. self.xExtentDomain = extent1.i;
  30510. self.yExtentDomain = extent1.j;
  30511. event_(new com_ibm_rave_core_svg_Brush.EventObject("brush", "resize"));
  30512. event_(new com_ibm_rave_core_svg_Brush.EventObject("brushend", null));
  30513. return null;
  30514. }
  30515. });
  30516. } else {
  30517. event_(new com_ibm_rave_core_svg_Brush.EventObject("brushstart", null));
  30518. event_(new com_ibm_rave_core_svg_Brush.EventObject("brush", "resize"));
  30519. event_(new com_ibm_rave_core_svg_Brush.EventObject("brushend", null));
  30520. }
  30521. });
  30522. }),
  30523. redraw : function(g) {
  30524. var self = this;
  30525. g.selectAll(".resize").attr("transform", function(data, index, groupIndex) {
  30526. return "translate(" + self.xExtent[+(new RegExp("e$", "g").test(data.toString()))] + "," + self.yExtent[+(new RegExp("^s", "g").test(data.toString()))] + ")";
  30527. });
  30528. },
  30529. redrawX : function(g) {
  30530. g.select(".extent").attr("x", this.xExtent[0]);
  30531. g.selectAll(".extent,.n>rect,.s>rect").attr("width", this.xExtent[1] - this.xExtent[0]);
  30532. },
  30533. redrawY : function(g) {
  30534. g.select(".extent").attr("y", this.yExtent[0]);
  30535. g.selectAll(".extent,.e>rect,.w>rect").attr("height", this.yExtent[1] - this.yExtent[0]);
  30536. },
  30537. /**
  30538. * Gets the current x-scale associated with the brush. Default is null
  30539. * @return (com.ibm.rave.core.scales.AbstractScale) the current x-scale associated with the brush.
  30540. */
  30541. x$0 : function() {
  30542. return this.xScale;
  30543. },
  30544. /**
  30545. * 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.
  30546. * @param (com.ibm.rave.core.scales.AbstractScale) z the scale to set
  30547. * @return (com.ibm.rave.core.svg.Brush) this brush instance itself
  30548. */
  30549. x$1 : function(z) {
  30550. this.xScale = z;
  30551. this.resizes = this.brushResizes[+(!((this.xScale))) << 1 | +(!((this.yScale)))];
  30552. return this;
  30553. },
  30554. /**
  30555. * Gets the current y-scale associated with the brush. Default is null
  30556. * @return (com.ibm.rave.core.scales.AbstractScale) the current y-scale associated with the brush.
  30557. */
  30558. y$0 : function() {
  30559. return this.yScale;
  30560. },
  30561. /**
  30562. * 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.
  30563. * @param (com.ibm.rave.core.scales.AbstractScale) z the scale to set
  30564. * @return (com.ibm.rave.core.svg.Brush) this brush instance itself
  30565. */
  30566. y$1 : function(z) {
  30567. this.yScale = z;
  30568. this.resizes = this.brushResizes[+(!((this.xScale))) << 1 | +(!((this.yScale)))];
  30569. return this;
  30570. },
  30571. /**
  30572. * 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.
  30573. * @return (Object) the current clamping behavior
  30574. */
  30575. clamp$0 : function() {
  30576. return (this.xScale) && (this.yScale) ? [this.xClamp, this.yClamp] : (this.xScale) ? this.xClamp : (this.yScale) ? this.yClamp : null;
  30577. },
  30578. /**
  30579. * 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.
  30580. * @return (com.ibm.rave.core.svg.Brush) this brush instance itself
  30581. */
  30582. clamp$1 : function(z) {
  30583. if ((this.xScale) && (this.yScale)) {
  30584. this.xClamp = (z)[0];
  30585. this.yClamp = (z)[1];
  30586. } else if ((this.xScale)) {
  30587. this.xClamp = (z);
  30588. } else if ((this.yScale)) {
  30589. this.yClamp = (z);
  30590. }
  30591. return this;
  30592. },
  30593. /**
  30594. * 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.
  30595. * @return (Array) the current extent
  30596. */
  30597. extent$0 : function() {
  30598. var x0, x1, y0, y1, t;
  30599. x0 = x1 = y0 = y1 = t = 0;
  30600. if ((this.xScale)) {
  30601. if ((this.xExtentDomain)) {
  30602. x0 = this.xExtentDomain[0];
  30603. x1 = this.xExtentDomain[1];
  30604. } else {
  30605. x0 = this.xExtent[0];
  30606. x1 = this.xExtent[1];
  30607. if (this.xScale.invert) {
  30608. x0 = (this.xScale.invert(x0));
  30609. x1 = (this.xScale.invert(x1));
  30610. }
  30611. if (x1 < x0) {
  30612. t = x0;
  30613. x0 = x1;
  30614. x1 = t;
  30615. }
  30616. }
  30617. }
  30618. if ((this.yScale)) {
  30619. if ((this.yExtentDomain)) {
  30620. y0 = this.yExtentDomain[0];
  30621. y1 = this.yExtentDomain[1];
  30622. } else {
  30623. y0 = this.yExtent[0];
  30624. y1 = this.yExtent[1];
  30625. if (this.yScale.invert) {
  30626. y0 = (this.yScale.invert(y0));
  30627. y1 = (this.yScale.invert(y1));
  30628. }
  30629. if (y1 < y0) {
  30630. t = y0;
  30631. y0 = y1;
  30632. y1 = t;
  30633. }
  30634. }
  30635. }
  30636. return (this.xScale) && (this.yScale) ? [[x0, y0], [x1, y1]] : (this.xScale) ? [x0, x1] : (this.yScale) ? [y0, y1] : null;
  30637. },
  30638. /**
  30639. * 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.
  30640. * @param (Array) z the value of the extent to set
  30641. * @return (com.ibm.rave.core.svg.Brush) this brush instance itself
  30642. */
  30643. extent$1 : function(z) {
  30644. var x0, x1, y0, y1, t;
  30645. x0 = x1 = y0 = y1 = t = 0;
  30646. if ((this.xScale)) {
  30647. var xObj0 = z[0];
  30648. var xObj1 = z[1];
  30649. if ((this.yScale)) {
  30650. x0 = (xObj0)[0];
  30651. x1 = (xObj1)[0];
  30652. } else {
  30653. x0 = (xObj0);
  30654. x1 = (xObj1);
  30655. }
  30656. this.xExtentDomain = [x0, x1];
  30657. if (this.xScale.invert) {
  30658. x0 = (this.xScale.call(this.xScale, x0, -1, -1));
  30659. x1 = (this.xScale.call(this.xScale, x1, -1, -1));
  30660. }
  30661. if (x1 < x0) {
  30662. t = x0;
  30663. x0 = x1;
  30664. x1 = t;
  30665. }
  30666. if (x0 != this.xExtent[0] || x1 != this.xExtent[1]) {
  30667. this.xExtent = [x0, x1];
  30668. }
  30669. }
  30670. if ((this.yScale)) {
  30671. var yObj0 = z[0];
  30672. var yObj1 = z[1];
  30673. if ((this.xScale)) {
  30674. y0 = (yObj0)[1];
  30675. y1 = (yObj1)[1];
  30676. } else {
  30677. y0 = (yObj0);
  30678. y1 = (yObj1);
  30679. }
  30680. this.yExtentDomain = [y0, y1];
  30681. if (this.yScale.invert) {
  30682. y0 = (this.yScale.call(this.yScale, y0, -1, -1));
  30683. y1 = (this.yScale.call(this.yScale, y1, -1, -1));
  30684. }
  30685. if (y1 < y0) {
  30686. t = y0;
  30687. y0 = y1;
  30688. y1 = t;
  30689. }
  30690. if (y0 != this.yExtent[0] || y1 != this.yExtent[1]) {
  30691. this.yExtent = [y0, y1];
  30692. }
  30693. }
  30694. return this;
  30695. },
  30696. /** @expose */
  30697. on : function(a0, a1) {
  30698. var args = arguments;
  30699. if (args.length == 1) {
  30700. return this.on$0(a0);
  30701. }
  30702. return this.on$1(a0, a1);
  30703. },
  30704. /** @expose */
  30705. x : function(a0) {
  30706. var args = arguments;
  30707. if (args.length == 0) {
  30708. return this.x$0();
  30709. }
  30710. return this.x$1(a0);
  30711. },
  30712. /** @expose */
  30713. y : function(a0) {
  30714. var args = arguments;
  30715. if (args.length == 0) {
  30716. return this.y$0();
  30717. }
  30718. return this.y$1(a0);
  30719. },
  30720. /** @expose */
  30721. clamp : function(a0) {
  30722. var args = arguments;
  30723. if (args.length == 0) {
  30724. return this.clamp$0();
  30725. }
  30726. return this.clamp$1(a0);
  30727. },
  30728. /** @expose */
  30729. extent : function(a0) {
  30730. var args = arguments;
  30731. if (args.length == 0) {
  30732. return this.extent$0();
  30733. }
  30734. return this.extent$1(a0);
  30735. }
  30736. });
  30737. /**
  30738. * Creates a new brush with no default x- and y-scale, and an empty extent
  30739. * @return (com.ibm.rave.core.svg.Brush) the newly constructed brush
  30740. */
  30741. /** @expose */
  30742. com_ibm_rave_core_svg_Brush.newBrush = function() {
  30743. return new com_ibm_rave_core_svg_Brush();
  30744. };
  30745. /**
  30746. * 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
  30747. */
  30748. com_ibm_rave_core_svg_Brush.EventObject = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_event_BaseEvent, {
  30749. //mode : null,
  30750. constructor : function(type, mode) {
  30751. this.mode = mode;
  30752. },
  30753. /**
  30754. * The mode value of the event in case the event was of type brush. brushstart and brushend have no mode and will return null
  30755. * @return (String) the value of mode of the event
  30756. */
  30757. /** @expose */
  30758. getMode : function() {
  30759. return this.mode;
  30760. }
  30761. });
  30762. com_ibm_rave_core_svg_Brush.BrushExtent = function(x, y, i, j) {
  30763. this.x = x;
  30764. this.y = y;
  30765. this.i = i;
  30766. this.j = j;
  30767. };
  30768. //com_ibm_rave_core_svg_Brush.CHART_PROP = "__chart__";
  30769. // $source: com/ibm/rave/core/internal/geo/MercatorPlaneProjectionFactory
  30770. /************************************************************************
  30771. ** IBM Confidential
  30772. **
  30773. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  30774. **
  30775. ** (C) Copyright IBM Corp. 2017
  30776. **
  30777. ** The source code for this program is not published or otherwise divested of its trade secrets,
  30778. ** irrespective of what has been deposited with the U.S. Copyright Office.
  30779. ************************************************************************/
  30780. // GENERATED
  30781. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, declare anonymous
  30782. //@import com/ibm/rave/core/geo/InvertiblePointProjector (runtime)
  30783. //@import com/ibm/rave/core/internal/geo/MercatorProjection (runtime) // new
  30784. //@import com/ibm/rave/core/internal/geo/ProjectionMutatorImpl (runtime) // internalMutate
  30785. /**
  30786. */
  30787. var com_ibm_rave_core_internal_geo_MercatorPlaneProjectionFactory = com_ibm_rave_core_nativeImpl_Declare({
  30788. /**
  30789. * @expose
  30790. */
  30791. raw : null,
  30792. _$functionClassMethod : function() {
  30793. var _$self = function() {
  30794. var m = new com_ibm_rave_core_internal_geo_MercatorProjection();
  30795. com_ibm_rave_core_internal_geo_ProjectionMutatorImpl.internalMutate(m, _$self.raw);
  30796. m.init();
  30797. return m;
  30798. };
  30799. return _$self;
  30800. },
  30801. constructor : function() {
  30802. this.raw = new (com_ibm_rave_core_nativeImpl_Declare({
  30803. _$functionClassMethod : function() {
  30804. var _$self = function(λ, φ) {
  30805. return [λ, Math.log(Math.tan(3.141592653589793 / 4 + φ / 2))];
  30806. };
  30807. return _$self;
  30808. },
  30809. supportInversion : function() {
  30810. return true;
  30811. },
  30812. invert : function(x, y) {
  30813. return [x, 2 * Math.atan(Math.exp(y)) - 1.5707963267948966];
  30814. }
  30815. }))();
  30816. },
  30817. /** @expose */
  30818. getRaw : function() {
  30819. return this.raw;
  30820. }
  30821. /**
  30822. */
  30823. //constructor : function() {}
  30824. });
  30825. com_ibm_rave_core_internal_geo_MercatorPlaneProjectionFactory.INSTANCE = new com_ibm_rave_core_internal_geo_MercatorPlaneProjectionFactory();
  30826. // $source: com/ibm/rave/core/internal/geo/ResampleStreamListenerFactory
  30827. /************************************************************************
  30828. ** IBM Confidential
  30829. **
  30830. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  30831. **
  30832. ** (C) Copyright IBM Corp. 2017
  30833. **
  30834. ** The source code for this program is not published or otherwise divested of its trade secrets,
  30835. ** irrespective of what has been deposited with the U.S. Copyright Office.
  30836. ************************************************************************/
  30837. // GENERATED
  30838. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  30839. //@import com/ibm/rave/core/internal/geo/TransformStreamListenerImpl (runtime) // new
  30840. //@import com/ibm/rave/core/internal/geo/ResampleStreamListener (runtime) // new
  30841. /**
  30842. * A factory from creating resampling stream listeners.
  30843. */
  30844. var com_ibm_rave_core_internal_geo_ResampleStreamListenerFactory = com_ibm_rave_core_nativeImpl_Declare({
  30845. //pointProjector : null,
  30846. cosMinDistance : 0,
  30847. δ2 : 0,
  30848. maxDepth : 0,
  30849. _$functionClassMethod : function() {
  30850. var _$self = /**
  30851. * Wraps the specified stream listener with another that would apply resampling transform to any GeoJSON geometry before streaming it to the wrapped listener.
  30852. * @param (com.ibm.rave.core.geo.StreamListener) listener the listener to wrap
  30853. * @return (com.ibm.rave.core.geo.StreamListener) a wrapped stream listener that applies resampling transform to any input GeoJSON geometry
  30854. */
  30855. function(listener) {
  30856. var self = _$self;
  30857. if (_$self.maxDepth == 0) {
  30858. var delegates = {};
  30859. delegates["point"] = function(x, y, z) {
  30860. var res = self.pointProjector(x, y, z);
  30861. listener.point(res[0], res[1], NaN);
  30862. };
  30863. return new com_ibm_rave_core_internal_geo_TransformStreamListenerImpl(listener, delegates);
  30864. }
  30865. return new com_ibm_rave_core_internal_geo_ResampleStreamListener(_$self, listener);
  30866. };
  30867. return _$self;
  30868. },
  30869. constructor : function(projector) {
  30870. this.δ2 = 0.5;
  30871. this.pointProjector = projector;
  30872. this.maxDepth = 16;
  30873. this.cosMinDistance = Math.cos(30 * 0.017453292519943295);
  30874. },
  30875. /**
  30876. * Sets the value of the precision to use.
  30877. * @param (double) p the precision value to set
  30878. * @return (com.ibm.rave.core.internal.geo.ResampleStreamListenerFactory) this ResampleStreamListenerFactory object itself
  30879. */
  30880. precision$0 : function(p) {
  30881. this.δ2 = p * p;
  30882. if (this.δ2 > 0) {
  30883. this.maxDepth = 16;
  30884. } else {
  30885. this.maxDepth = 0;
  30886. }
  30887. return this;
  30888. },
  30889. /**
  30890. * Returns the current precision value. The default is the square root of 0.5, which is almost 0.7
  30891. * @return (double) the current precision value
  30892. */
  30893. precision$1 : function() {
  30894. return Math.sqrt(this.δ2);
  30895. },
  30896. getCosMinDistance : function() {
  30897. return this.cosMinDistance;
  30898. },
  30899. getPrecisionSquared : function() {
  30900. return this.δ2;
  30901. },
  30902. getMaxDepth : function() {
  30903. return this.maxDepth;
  30904. },
  30905. getPointProjector : function() {
  30906. return this.pointProjector;
  30907. },
  30908. precision : function(a0) {
  30909. var args = arguments;
  30910. if (args.length == 0) {
  30911. return this.precision$1();
  30912. }
  30913. return this.precision$0(a0);
  30914. }
  30915. });
  30916. // $source: com/ibm/rave/core/internal/geo/DelegatingStreamListener
  30917. /************************************************************************
  30918. ** IBM Confidential
  30919. **
  30920. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  30921. **
  30922. ** (C) Copyright IBM Corp. 2017
  30923. **
  30924. ** The source code for this program is not published or otherwise divested of its trade secrets,
  30925. ** irrespective of what has been deposited with the U.S. Copyright Office.
  30926. ************************************************************************/
  30927. // GENERATED
  30928. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  30929. /**
  30930. * 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.
  30931. * @see (com.ibm.rave.core.geo.StreamListener) StreamListener
  30932. */
  30933. var com_ibm_rave_core_internal_geo_DelegatingStreamListener = com_ibm_rave_core_nativeImpl_Declare({
  30934. //pointDelegate : null,
  30935. //sphereDelegate : null,
  30936. //lineStartDelegate : null,
  30937. //lineEndDelegate : null,
  30938. //polygonStartDelegate : null,
  30939. //polygonEndDelegate : null,
  30940. /**
  30941. * @expose
  30942. */
  30943. valid : false,
  30944. /**
  30945. * @return (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamPointStateHandler) the pointDelegate
  30946. */
  30947. getPointDelegate : function() {
  30948. return this.pointDelegate;
  30949. },
  30950. /**
  30951. * @param (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamPointStateHandler) pointDelegate the pointDelegate to set
  30952. */
  30953. setPointDelegate : function(pointDelegate) {
  30954. this.pointDelegate = pointDelegate;
  30955. },
  30956. /**
  30957. * @return (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamStateHandler) the sphereDelegate
  30958. */
  30959. getSphereDelegate : function() {
  30960. return this.sphereDelegate;
  30961. },
  30962. /**
  30963. * @param (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamStateHandler) sphereDelegate the sphereDelegate to set
  30964. */
  30965. setSphereDelegate : function(sphereDelegate) {
  30966. this.sphereDelegate = sphereDelegate;
  30967. },
  30968. /**
  30969. * @return (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamStateHandler) the lineStartDelegate
  30970. */
  30971. getLineStartDelegate : function() {
  30972. return this.lineStartDelegate;
  30973. },
  30974. /**
  30975. * @param (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamStateHandler) lineStartDelegate the lineStartDelegate to set
  30976. */
  30977. setLineStartDelegate : function(lineStartDelegate) {
  30978. this.lineStartDelegate = lineStartDelegate;
  30979. },
  30980. /**
  30981. * @return (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamStateHandler) the lineEndDelegate
  30982. */
  30983. getLineEndDelegate : function() {
  30984. return this.lineEndDelegate;
  30985. },
  30986. /**
  30987. * @param (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamStateHandler) lineEndDelegate the lineEndDelegate to set
  30988. */
  30989. setLineEndDelegate : function(lineEndDelegate) {
  30990. this.lineEndDelegate = lineEndDelegate;
  30991. },
  30992. /**
  30993. * @return (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamStateHandler) the polygonStartDelegate
  30994. */
  30995. getPolygonStartDelegate : function() {
  30996. return this.polygonStartDelegate;
  30997. },
  30998. /**
  30999. * @param (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamStateHandler) polygonStartDelegate the polygonStartDelegate to set
  31000. */
  31001. setPolygonStartDelegate : function(polygonStartDelegate) {
  31002. this.polygonStartDelegate = polygonStartDelegate;
  31003. },
  31004. /**
  31005. * @return (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamStateHandler) the polygonEndDelegate
  31006. */
  31007. getPolygonEndDelegate : function() {
  31008. return this.polygonEndDelegate;
  31009. },
  31010. /**
  31011. * @param (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamStateHandler) polygonEndDelegate the polygonEndDelegate to set
  31012. */
  31013. setPolygonEndDelegate : function(polygonEndDelegate) {
  31014. this.polygonEndDelegate = polygonEndDelegate;
  31015. },
  31016. /** @expose */
  31017. sphere : function() {
  31018. if (this.sphereDelegate) {
  31019. this.sphereDelegate();
  31020. }
  31021. },
  31022. /** @expose */
  31023. point : function(x, y, z) {
  31024. if (this.pointDelegate) {
  31025. this.pointDelegate(x, y, z);
  31026. }
  31027. },
  31028. /** @expose */
  31029. lineStart : function() {
  31030. if (this.lineStartDelegate) {
  31031. this.lineStartDelegate();
  31032. }
  31033. },
  31034. /** @expose */
  31035. lineEnd : function() {
  31036. if (this.lineEndDelegate) {
  31037. this.lineEndDelegate();
  31038. }
  31039. },
  31040. /** @expose */
  31041. polygonStart : function() {
  31042. if (this.polygonStartDelegate) {
  31043. this.polygonStartDelegate();
  31044. }
  31045. },
  31046. /** @expose */
  31047. polygonEnd : function() {
  31048. if (this.polygonEndDelegate) {
  31049. this.polygonEndDelegate();
  31050. }
  31051. },
  31052. /**
  31053. * 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.
  31054. * @param (boolean) valid the value of validity of this listener
  31055. */
  31056. setValid : function(valid) {
  31057. this.valid = valid;
  31058. },
  31059. /**
  31060. * A getter for the validity of the listener
  31061. * @return (boolean) boolean representing the validity of the listener
  31062. */
  31063. isValid : function() {
  31064. return this.valid;
  31065. }
  31066. });
  31067. /**
  31068. * A tagging interface that is the base of all state handlers
  31069. */
  31070. com_ibm_rave_core_internal_geo_DelegatingStreamListener.BaseStreamStateHandler = com_ibm_rave_core_nativeImpl_Declare.implement(
  31071. );
  31072. // $source: com/ibm/rave/core/geo/TransformStreamListener
  31073. /************************************************************************
  31074. ** IBM Confidential
  31075. **
  31076. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  31077. **
  31078. ** (C) Copyright IBM Corp. 2017
  31079. **
  31080. ** The source code for this program is not published or otherwise divested of its trade secrets,
  31081. ** irrespective of what has been deposited with the U.S. Copyright Office.
  31082. ************************************************************************/
  31083. // GENERATED
  31084. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  31085. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (loadtime) // superclass
  31086. /**
  31087. * An interface to be implemented by all transform stream listeners
  31088. */
  31089. var com_ibm_rave_core_geo_TransformStreamListener = rave_externs["TransformStreamListener"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_DelegatingStreamListener, {
  31090. /**
  31091. * A getter for the wrapped stream listener
  31092. * @return (com.ibm.rave.core.geo.StreamListener) the wrapped stream listener
  31093. */
  31094. /** @expose */
  31095. getStreamListener : function() {}
  31096. });
  31097. // $source: com/ibm/rave/core/internal/geo/TransformStreamListenerImpl
  31098. /************************************************************************
  31099. ** IBM Confidential
  31100. **
  31101. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  31102. **
  31103. ** (C) Copyright IBM Corp. 2017
  31104. **
  31105. ** The source code for this program is not published or otherwise divested of its trade secrets,
  31106. ** irrespective of what has been deposited with the U.S. Copyright Office.
  31107. ************************************************************************/
  31108. // GENERATED
  31109. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  31110. //@import com/ibm/rave/core/geo/TransformStreamListener (loadtime) // superclass
  31111. //@import com/ibm/rave/core/geo/StreamListener (runtime) // polygonStartHandler
  31112. /**
  31113. * 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.
  31114. * @see this.Geo#this.transform(Object)
  31115. * @see (com.ibm.rave.core.geo.TransformStreamListenerFactory) TransformStreamListenerFactory
  31116. */
  31117. var com_ibm_rave_core_internal_geo_TransformStreamListenerImpl = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_geo_TransformStreamListener, {
  31118. /**
  31119. * @expose
  31120. */
  31121. stream : null,
  31122. constructor : function(listener, delegates) {
  31123. this.stream = listener;
  31124. var self = this;
  31125. var handler = delegates["lineEnd"];
  31126. if (handler) {
  31127. this.lineEndDelegate = handler;
  31128. } else {
  31129. this.lineEndDelegate = function() {
  31130. self.stream.lineEnd();
  31131. };
  31132. }
  31133. handler = delegates["lineStart"];
  31134. if (handler) {
  31135. this.lineStartDelegate = handler;
  31136. } else {
  31137. this.lineStartDelegate = function() {
  31138. self.stream.lineStart();
  31139. };
  31140. }
  31141. handler = delegates["point"];
  31142. if (handler) {
  31143. this.pointDelegate = handler;
  31144. } else {
  31145. this.pointDelegate = function(x, y, z) {
  31146. self.stream.point(x, y, z);
  31147. };
  31148. }
  31149. handler = delegates["polygonEnd"];
  31150. if (handler) {
  31151. this.polygonEndDelegate = handler;
  31152. } else {
  31153. this.polygonEndDelegate = function() {
  31154. self.stream.polygonEnd();
  31155. };
  31156. }
  31157. handler = delegates[com_ibm_rave_core_geo_StreamListener.polygonStartHandler];
  31158. if (handler) {
  31159. this.polygonStartDelegate = handler;
  31160. } else {
  31161. this.polygonStartDelegate = function() {
  31162. self.stream.polygonStart();
  31163. };
  31164. }
  31165. handler = delegates["sphere"];
  31166. if (handler) {
  31167. this.sphereDelegate = handler;
  31168. } else {
  31169. this.sphereDelegate = function() {
  31170. self.stream.sphere();
  31171. };
  31172. }
  31173. },
  31174. /**
  31175. * A getter for the wrapped stream listener
  31176. * @return (com.ibm.rave.core.geo.StreamListener) the wrapped stream listener
  31177. */
  31178. /** @expose */
  31179. getStreamListener : function() {
  31180. return this.stream;
  31181. }
  31182. });
  31183. // $source: com/ibm/rave/core/geo/StreamListener
  31184. /************************************************************************
  31185. ** IBM Confidential
  31186. **
  31187. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  31188. **
  31189. ** (C) Copyright IBM Corp. 2017
  31190. **
  31191. ** The source code for this program is not published or otherwise divested of its trade secrets,
  31192. ** irrespective of what has been deposited with the U.S. Copyright Office.
  31193. ************************************************************************/
  31194. // GENERATED
  31195. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  31196. /**
  31197. * 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
  31198. */
  31199. var com_ibm_rave_core_geo_StreamListener = rave_externs["StreamListener"] = com_ibm_rave_core_nativeImpl_Declare.implement(
  31200. /**
  31201. * Indicates the sphere (the globe; the unit sphere centered at {0,0,0}.
  31202. */
  31203. //sphere : function() {},
  31204. /**
  31205. * 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.
  31206. * @param (double) x the value of x coordinate
  31207. * @param (double) y the value of y coordinate
  31208. * @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.
  31209. */
  31210. //point : function(x, y, z) {},
  31211. /**
  31212. * 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.
  31213. */
  31214. //lineStart : function() {},
  31215. /**
  31216. * 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.
  31217. */
  31218. //lineEnd : function() {},
  31219. /**
  31220. * Indicates the start of a polygon. The first line of a polygon indicates the exterior ring, and any subsequent lines indicate interior holes.
  31221. */
  31222. //polygonStart : function() {},
  31223. /**
  31224. * Indicates the end of a polygon.
  31225. */
  31226. //polygonEnd : function() {}
  31227. );
  31228. /** @expose */
  31229. com_ibm_rave_core_geo_StreamListener.pointHandler = "point";
  31230. /** @expose */
  31231. com_ibm_rave_core_geo_StreamListener.sphereHandler = "sphere";
  31232. /** @expose */
  31233. com_ibm_rave_core_geo_StreamListener.lineStartHandler = "lineStart";
  31234. /** @expose */
  31235. com_ibm_rave_core_geo_StreamListener.lineEndHandler = "lineEnd";
  31236. /** @expose */
  31237. com_ibm_rave_core_geo_StreamListener.polygonStartHandler = "polygonStart";
  31238. /** @expose */
  31239. com_ibm_rave_core_geo_StreamListener.polygonEndHandler = "polygonEnd";
  31240. // $source: com/ibm/rave/core/internal/geo/ResampleStreamListener
  31241. /************************************************************************
  31242. ** IBM Confidential
  31243. **
  31244. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  31245. **
  31246. ** (C) Copyright IBM Corp. 2017
  31247. **
  31248. ** The source code for this program is not published or otherwise divested of its trade secrets,
  31249. ** irrespective of what has been deposited with the U.S. Copyright Office.
  31250. ************************************************************************/
  31251. // GENERATED
  31252. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  31253. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (loadtime) // superclass
  31254. //@import com/ibm/rave/core/internal/geo/CartesianUtil (runtime) // cartesian
  31255. /**
  31256. */
  31257. var com_ibm_rave_core_internal_geo_ResampleStreamListener = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_DelegatingStreamListener, {
  31258. //factory : null,
  31259. //listener : null,
  31260. λ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,
  31261. /**
  31262. */
  31263. constructor : function(factory, listener) {
  31264. this.factory = factory;
  31265. this.listener = listener;
  31266. var self = this;
  31267. var point = function(x, y, z) {
  31268. var res = self.factory.pointProjector(x, y, z);
  31269. self.listener.point(res[0], res[1], NaN);
  31270. };
  31271. var linePoint = function(λ, φ, z) {
  31272. var c = com_ibm_rave_core_internal_geo_CartesianUtil.cartesian([λ, φ]), p = self.factory.pointProjector(λ, φ, NaN);
  31273. 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);
  31274. self.listener.point(self.x0, self.y0, z);
  31275. };
  31276. var lineStart = function() {
  31277. self.x0 = NaN;
  31278. self.pointDelegate = linePoint;
  31279. self.listener.lineStart();
  31280. };
  31281. var lineEnd = function() {
  31282. self.pointDelegate = point;
  31283. self.listener.lineEnd();
  31284. };
  31285. var ringPoint = function(λ, φ, z) {
  31286. linePoint(self.λ00 = λ, self.φ00 = φ, z);
  31287. self.x00 = self.x0;
  31288. self.y00 = self.y0;
  31289. self.a00 = self.a0;
  31290. self.b00 = self.b0;
  31291. self.c00 = self.c0;
  31292. self.pointDelegate = linePoint;
  31293. };
  31294. var ringEnd = function() {
  31295. 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);
  31296. self.lineEndDelegate = lineEnd;
  31297. lineEnd();
  31298. };
  31299. var ringStart = function() {
  31300. lineStart();
  31301. self.pointDelegate = ringPoint;
  31302. self.lineEndDelegate = ringEnd;
  31303. };
  31304. var polygonStart = function() {
  31305. self.listener.polygonStart();
  31306. self.lineStartDelegate = ringStart;
  31307. };
  31308. var polygonEnd = function() {
  31309. self.listener.polygonEnd();
  31310. self.lineStartDelegate = lineStart;
  31311. };
  31312. this.pointDelegate = point;
  31313. this.lineStartDelegate = lineStart;
  31314. this.lineEndDelegate = lineEnd;
  31315. this.polygonStartDelegate = polygonStart;
  31316. this.polygonEndDelegate = polygonEnd;
  31317. },
  31318. resampleLineTo : function(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, listener) {
  31319. var _depth = depth;
  31320. var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy;
  31321. if (d2 > 4 * this.factory.δ2 && _depth-- > 0) {
  31322. var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = Math.sqrt(a * a + b * b + c * c);
  31323. 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);
  31324. var p = this.factory.pointProjector(λ2, φ2, NaN);
  31325. var x2 = p[0];
  31326. var y2 = p[1];
  31327. var dx2 = x2 - x0;
  31328. var dy2 = y2 - y0;
  31329. var dz = dy * dx2 - dx * dy2;
  31330. var test1 = dz * dz / d2 > this.factory.δ2;
  31331. var test2 = Math.abs((dx * dx2 + dy * dy2) / d2 - .5) > .3;
  31332. var test3 = a0 * a1 + b0 * b1 + c0 * c1 < this.factory.cosMinDistance;
  31333. if (test1 || test2 || test3) {
  31334. this.resampleLineTo(x0, y0, λ0, a0, b0, c0, x2, y2, λ2, a /= m, b /= m, c, _depth, listener);
  31335. listener.point(x2, y2, NaN);
  31336. this.resampleLineTo(x2, y2, λ2, a, b, c, x1, y1, λ1, a1, b1, c1, _depth, listener);
  31337. }
  31338. }
  31339. }
  31340. });
  31341. // $source: com/ibm/rave/core/internal/geo/CartesianUtil
  31342. /************************************************************************
  31343. ** IBM Confidential
  31344. **
  31345. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  31346. **
  31347. ** (C) Copyright IBM Corp. 2017
  31348. **
  31349. ** The source code for this program is not published or otherwise divested of its trade secrets,
  31350. ** irrespective of what has been deposited with the U.S. Copyright Office.
  31351. ************************************************************************/
  31352. // GENERATED
  31353. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  31354. /**
  31355. * A collection of helper methods operating on point in Cartesian plane.
  31356. */
  31357. var com_ibm_rave_core_internal_geo_CartesianUtil = com_ibm_rave_core_nativeImpl_Declare({
  31358. //constructor : function() {}
  31359. });
  31360. /**
  31361. * Converts a point coordinates from spherical plane to Cartesian plane
  31362. * @param (double[]) spherical the location in spherical plane to convert
  31363. * @return (double[]) the x,y,z coordinates of the point in Cartesian plane
  31364. */
  31365. com_ibm_rave_core_internal_geo_CartesianUtil.cartesian = function(spherical) {
  31366. var λ = spherical[0], φ = spherical[1], cosφ = Math.cos(φ);
  31367. return [cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ)];
  31368. };
  31369. /**
  31370. * Calculates the dot product of two 3D points in Cartesian plane
  31371. * @param (double[]) a the first point x,y,z coordinates
  31372. * @param (double[]) b the second point x,y,z coordinates
  31373. * @return (double) the dot product (scalar value)
  31374. */
  31375. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianDot = function(a, b) {
  31376. return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  31377. };
  31378. /**
  31379. * Calculates the cross product of two 3D points in Cartesian plane
  31380. * @param (double[]) a the first point x,y,z coordinates
  31381. * @param (double[]) b the second point x,y,z coordinates
  31382. * @return (double[]) a new point (vector) holding whose coordinates are the cross product
  31383. */
  31384. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianCross = function(a, b) {
  31385. var x = a[1] * b[2] - a[2] * b[1];
  31386. var y = a[2] * b[0] - a[0] * b[2];
  31387. var z = a[0] * b[1] - a[1] * b[0];
  31388. return [x, y, z];
  31389. };
  31390. /**
  31391. * Adds one 3D point to another. This is done in place meaning the coordinates of the first point (a) will change
  31392. * @param (double[]) a the first point x,y,z coordinates. It will hold the result of the add operation
  31393. * @param (double[]) b the second point x,y,z coordinates
  31394. */
  31395. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianAdd = function(a, b) {
  31396. a[0] += b[0];
  31397. a[1] += b[1];
  31398. a[2] += b[2];
  31399. };
  31400. /**
  31401. * Scale the coordinates of a given point by a specific factor
  31402. * @param (double[]) vector the 3D point to scale
  31403. * @param (double) k scale factor to apply
  31404. * @return (double[]) a new point holding the scale result
  31405. */
  31406. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianScale = function(vector, k) {
  31407. return [vector[0] * k, vector[1] * k, vector[2] * k];
  31408. };
  31409. /**
  31410. * Normalizes a 3D point and modifies its coordinates accordingly
  31411. * @param (double[]) d the point whose coordinates to normalize
  31412. */
  31413. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianNormalize = function(d) {
  31414. var l = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
  31415. d[0] /= l;
  31416. d[1] /= l;
  31417. d[2] /= l;
  31418. };
  31419. // $source: com/ibm/rave/core/internal/geo/ClipExtentStreamListenerFactory
  31420. /************************************************************************
  31421. ** IBM Confidential
  31422. **
  31423. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  31424. **
  31425. ** (C) Copyright IBM Corp. 2017
  31426. **
  31427. ** The source code for this program is not published or otherwise divested of its trade secrets,
  31428. ** irrespective of what has been deposited with the U.S. Copyright Office.
  31429. ************************************************************************/
  31430. // GENERATED
  31431. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  31432. //@import com/ibm/rave/core/internal/geo/ClipExtentStreamListener (runtime) // new
  31433. /**
  31434. */
  31435. var com_ibm_rave_core_internal_geo_ClipExtentStreamListenerFactory = com_ibm_rave_core_nativeImpl_Declare({
  31436. x0 : 0, y0 : 0, x1 : 0, y1 : 0,
  31437. _$functionClassMethod : function() {
  31438. var _$self = function(listener) {
  31439. return new com_ibm_rave_core_internal_geo_ClipExtentStreamListener(_$self.x0, _$self.y0, _$self.x1, _$self.y1, listener);
  31440. };
  31441. return _$self;
  31442. },
  31443. /**
  31444. */
  31445. constructor : function(x0, y0, x1, y1) {
  31446. this.x0 = x0;
  31447. this.y0 = y0;
  31448. this.x1 = x1;
  31449. this.y1 = y1;
  31450. }
  31451. });
  31452. // $source: com/ibm/rave/core/internal/geo/ClipExtentStreamListener
  31453. /************************************************************************
  31454. ** IBM Confidential
  31455. **
  31456. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  31457. **
  31458. ** (C) Copyright IBM Corp. 2017
  31459. **
  31460. ** The source code for this program is not published or otherwise divested of its trade secrets,
  31461. ** irrespective of what has been deposited with the U.S. Copyright Office.
  31462. ************************************************************************/
  31463. // GENERATED
  31464. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  31465. //@import com/ibm/rave/core/geo/TransformStreamListener (loadtime) // superclass
  31466. //@import com/ibm/rave/core/geom/ClipLine (runtime) // create
  31467. //@import com/ibm/rave/core/internal/geo/ClipBufferStreamListener (runtime) // new
  31468. //@import com/ibm/rave/core/geom/Line (runtime) // new
  31469. //@import com/ibm/rave/core/geom/PointStruct (runtime) // new
  31470. //@import com/ibm/rave/core/arrays/Merge (runtime) // merge
  31471. //@import com/ibm/rave/core/internal/geo/ClipUtil (runtime) // clipPolygon
  31472. //@import com/ibm/rave/core/internal/math/Trigonometry (runtime) // cross2d
  31473. /**
  31474. */
  31475. var com_ibm_rave_core_internal_geo_ClipExtentStreamListener = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_geo_TransformStreamListener, {
  31476. //listener : null,
  31477. //clientListener : null,
  31478. //bufferListener : null,
  31479. //lineClipper : null,
  31480. //comparator : null,
  31481. //interpolator : null,
  31482. //segments : null,
  31483. //polygon : null,
  31484. //ring : null,
  31485. x0 : 0, y0 : 0, x1 : 0, y1 : 0,
  31486. x__ : 0, y__ : 0, x_ : 0, y_ : 0,
  31487. first : false, clean : false, v__ : false, v_ : false,
  31488. constructor : function(x0, y0, x1, y1, clientListener) {
  31489. var self = this;
  31490. this.clientListener = clientListener;
  31491. this.listener = clientListener;
  31492. this.x0 = x0;
  31493. this.y0 = y0;
  31494. this.x1 = x1;
  31495. this.y1 = y1;
  31496. this.lineClipper = com_ibm_rave_core_geom_ClipLine.create(x0, y0, x1, y1);
  31497. this.bufferListener = new com_ibm_rave_core_internal_geo_ClipBufferStreamListener();
  31498. this.comparator = function(a, b) {
  31499. var result = self.comparePoints(a.x, b.x);
  31500. return (result == 0) ? 0 : (result > 0) ? 1 : -1;
  31501. };
  31502. this.interpolator = function(from, to, direction, listener) {
  31503. var a = 0, a1 = 0;
  31504. if (!from || (a = self.corner(from, direction)) != (a1 = self.corner(to, direction)) || (self.comparePoints(from, to) < 0) ^ (direction > 0)) {
  31505. do {
  31506. listener.point(a == 0 || a == 3 ? self.x0 : self.x1, a > 1 ? self.y1 : self.y0, NaN);
  31507. } while ((a = (a + direction + 4) % 4) != a1);
  31508. } else {
  31509. listener.point(to[0], to[1], NaN);
  31510. }
  31511. };
  31512. var point = function(x, y, z) {
  31513. if (self.pointVisible(x, y)) {
  31514. self.listener.point(x, y, NaN);
  31515. }
  31516. };
  31517. var linePoint = function(x, y, z) {
  31518. var _x = x;
  31519. var _y = y;
  31520. _x = Math.max(-1.0E9, Math.min(1.0E9, _x));
  31521. _y = Math.max(-1.0E9, Math.min(1.0E9, _y));
  31522. var v = self.pointVisible(_x, _y);
  31523. if (self.polygon) {
  31524. self.ring.push([_x, _y]);
  31525. }
  31526. if (self.first) {
  31527. self.x__ = _x;
  31528. self.y__ = _y;
  31529. self.v__ = v;
  31530. self.first = false;
  31531. if (v) {
  31532. self.listener.lineStart();
  31533. self.listener.point(_x, _y, NaN);
  31534. }
  31535. } else {
  31536. if (v && self.v_) {
  31537. self.listener.point(_x, _y, NaN);
  31538. } else {
  31539. 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));
  31540. if (self.lineClipper(l)) {
  31541. if (!self.v_) {
  31542. self.listener.lineStart();
  31543. self.listener.point(l.a.x, l.a.y, NaN);
  31544. }
  31545. self.listener.point(l.b.x, l.b.y, NaN);
  31546. if (!v) {
  31547. self.listener.lineEnd();
  31548. }
  31549. self.clean = false;
  31550. } else if (v) {
  31551. self.listener.lineStart();
  31552. self.listener.point(_x, _y, NaN);
  31553. self.clean = false;
  31554. }
  31555. }
  31556. }
  31557. self.x_ = _x;
  31558. self.y_ = _y;
  31559. self.v_ = v;
  31560. };
  31561. var lineStart = function() {
  31562. self.pointDelegate = linePoint;
  31563. if (self.polygon) {
  31564. self.polygon.push(self.ring = []);
  31565. }
  31566. self.first = true;
  31567. self.v_ = false;
  31568. self.x_ = self.y_ = NaN;
  31569. };
  31570. var lineEnd = function() {
  31571. if (self.segments) {
  31572. linePoint(self.x__, self.y__, NaN);
  31573. if (self.v__ && self.v_) {
  31574. self.bufferListener.rejoin();
  31575. }
  31576. self.segments.push(self.bufferListener.buffer());
  31577. }
  31578. self.pointDelegate = point;
  31579. if (self.v_) {
  31580. self.listener.lineEnd();
  31581. }
  31582. };
  31583. var polygonStart = function() {
  31584. self.listener = self.bufferListener;
  31585. self.segments = [];
  31586. self.polygon = [];
  31587. self.clean = true;
  31588. };
  31589. var polygonEnd = function() {
  31590. self.listener = self.clientListener;
  31591. var mergedSegments = com_ibm_rave_core_arrays_Merge.merge(self.segments);
  31592. var clipStartInside = self.insidePolygon([self.x0, self.y1]), inside = self.clean && clipStartInside, visible = mergedSegments.length > 0;
  31593. if (inside || visible) {
  31594. self.listener.polygonStart();
  31595. if (inside) {
  31596. self.listener.lineStart();
  31597. self.interpolator(null, null, 1, self.listener);
  31598. self.listener.lineEnd();
  31599. }
  31600. if (visible) {
  31601. com_ibm_rave_core_internal_geo_ClipUtil.clipPolygon(mergedSegments, self.comparator, clipStartInside, self.interpolator, self.listener);
  31602. }
  31603. self.listener.polygonEnd();
  31604. }
  31605. self.segments = null;
  31606. self.polygon = null;
  31607. self.ring = null;
  31608. };
  31609. this.pointDelegate = point;
  31610. this.lineStartDelegate = lineStart;
  31611. this.lineEndDelegate = lineEnd;
  31612. this.polygonStartDelegate = polygonStart;
  31613. this.polygonEndDelegate = polygonEnd;
  31614. },
  31615. corner : function(p, direction) {
  31616. 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;
  31617. },
  31618. comparePoints : function(a, b) {
  31619. var ca = this.corner(a, 1), cb = this.corner(b, 1);
  31620. 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];
  31621. return result;
  31622. },
  31623. pointVisible : function(x, y) {
  31624. return this.x0 <= x && x <= this.x1 && this.y0 <= y && y <= this.y1;
  31625. },
  31626. insidePolygon : function(p) {
  31627. var wn = 0;
  31628. var n = this.polygon.length;
  31629. var y = p[1];
  31630. for (var i = 0; i < n; ++i) {
  31631. var v = this.polygon[i];
  31632. var a = v[0];
  31633. for (var j = 1, m = v.length; j < m; ++j) {
  31634. var b = v[j];
  31635. if (a[1] <= y) {
  31636. if (b[1] > y && com_ibm_rave_core_internal_math_Trigonometry.cross2d(a, b, p) > 0) {
  31637. ++wn;
  31638. }
  31639. } else {
  31640. if (b[1] <= y && com_ibm_rave_core_internal_math_Trigonometry.cross2d(a, b, p) < 0) {
  31641. --wn;
  31642. }
  31643. }
  31644. a = b;
  31645. }
  31646. }
  31647. return wn != 0;
  31648. },
  31649. /**
  31650. * A getter for the wrapped stream listener
  31651. * @return (com.ibm.rave.core.geo.StreamListener) the wrapped stream listener
  31652. */
  31653. /** @expose */
  31654. getStreamListener : function() {
  31655. return this.clientListener;
  31656. }
  31657. });
  31658. com_ibm_rave_core_internal_geo_ClipExtentStreamListener.clipExtentMAX = 1e9;
  31659. // $source: com/ibm/rave/core/internal/geo/ClipBufferStreamListener
  31660. /************************************************************************
  31661. ** IBM Confidential
  31662. **
  31663. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  31664. **
  31665. ** (C) Copyright IBM Corp. 2017
  31666. **
  31667. ** The source code for this program is not published or otherwise divested of its trade secrets,
  31668. ** irrespective of what has been deposited with the U.S. Copyright Office.
  31669. ************************************************************************/
  31670. // GENERATED
  31671. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  31672. var com_ibm_rave_core_internal_geo_ClipBufferStreamListener = com_ibm_rave_core_nativeImpl_Declare({
  31673. //lines : null,
  31674. //line : null,
  31675. constructor : function() {
  31676. this.lines = [];
  31677. },
  31678. /** @expose */
  31679. sphere : function() {},
  31680. /** @expose */
  31681. point : function(x, y, z) {
  31682. this.line.push([x, y]);
  31683. },
  31684. /** @expose */
  31685. lineStart : function() {
  31686. this.lines.push(this.line = []);
  31687. },
  31688. /** @expose */
  31689. lineEnd : function() {},
  31690. /** @expose */
  31691. polygonStart : function() {},
  31692. /** @expose */
  31693. polygonEnd : function() {},
  31694. buffer : function() {
  31695. var buff = this.lines;
  31696. this.lines = [];
  31697. this.line = null;
  31698. return buff;
  31699. },
  31700. rejoin : function() {
  31701. if (this.lines.length > 1) {
  31702. this.lines.push(this.lines.pop().concat(this.lines.shift()));
  31703. }
  31704. }
  31705. });
  31706. // $source: com/ibm/rave/core/internal/geo/ClipStreamListenerFactory
  31707. /************************************************************************
  31708. ** IBM Confidential
  31709. **
  31710. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  31711. **
  31712. ** (C) Copyright IBM Corp. 2017
  31713. **
  31714. ** The source code for this program is not published or otherwise divested of its trade secrets,
  31715. ** irrespective of what has been deposited with the U.S. Copyright Office.
  31716. ************************************************************************/
  31717. // GENERATED
  31718. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  31719. //@import com/ibm/rave/core/internal/geo/ClipStreamListener (runtime) // new
  31720. /**
  31721. */
  31722. var com_ibm_rave_core_internal_geo_ClipStreamListenerFactory = com_ibm_rave_core_nativeImpl_Declare({
  31723. //pointVisible : null,
  31724. //clipLine : null,
  31725. //interpolate : null,
  31726. //clipStart : null,
  31727. _$functionClassMethod : function() {
  31728. var _$self = function(rotate, listener) {
  31729. return new com_ibm_rave_core_internal_geo_ClipStreamListener(_$self.pointVisible, _$self.clipLine, _$self.interpolate, _$self.clipStart, rotate, listener);
  31730. };
  31731. return _$self;
  31732. },
  31733. /**
  31734. */
  31735. constructor : function(pointVisible, clipLine, interpolate, clipStart) {
  31736. this.pointVisible = pointVisible;
  31737. this.clipLine = clipLine;
  31738. this.interpolate = interpolate;
  31739. this.clipStart = clipStart;
  31740. }
  31741. });
  31742. // $source: com/ibm/rave/core/internal/geo/ClipUtil
  31743. /************************************************************************
  31744. ** IBM Confidential
  31745. **
  31746. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  31747. **
  31748. ** (C) Copyright IBM Corp. 2017
  31749. **
  31750. ** The source code for this program is not published or otherwise divested of its trade secrets,
  31751. ** irrespective of what has been deposited with the U.S. Copyright Office.
  31752. ************************************************************************/
  31753. // GENERATED
  31754. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  31755. //@import com/ibm/rave/core/internal/geo/ClipExtentStreamListenerFactory (static) // new
  31756. //@import com/ibm/rave/core/internal/geo/ClipStreamListenerFactory (static) // new
  31757. //@import com/ibm/rave/core/internal/geo/CircleClipLineStreamListenerFactory (runtime) // new
  31758. //@import com/ibm/rave/core/internal/geo/GeoShapeGeneratorUtil (runtime) // newCircleInterpolator
  31759. //@import com/ibm/rave/core/internal/geo/AntimeridianClipLineStreamListenerFactory (runtime) // new
  31760. //@import com/ibm/rave/core/internal/geo/SphericalUtil (runtime) // sphericalEqual
  31761. //@import com/ibm/rave/core/internal/geo/ClipPolygonIntersection (runtime) // new
  31762. //@import com/ibm/rave/core/internal/math/Adder (runtime) // new
  31763. //@import com/ibm/rave/core/internal/geo/CartesianUtil (static) // cartesianNormalize, cartesianCross, cartesian
  31764. //@import com/ibm/rave/core/internal/math/Trigonometry (runtime) // asin
  31765. /**
  31766. */
  31767. var com_ibm_rave_core_internal_geo_ClipUtil = com_ibm_rave_core_nativeImpl_Declare({
  31768. });
  31769. com_ibm_rave_core_internal_geo_ClipUtil.newClipExtentStreamListenerFactory = function(x0, y0, x1, y1) {
  31770. return new com_ibm_rave_core_internal_geo_ClipExtentStreamListenerFactory(x0, y0, x1, y1);
  31771. };
  31772. com_ibm_rave_core_internal_geo_ClipUtil.newClipStreamListenerFactory = function(pointVisible, clipLine, interpolate, clipStart) {
  31773. return new com_ibm_rave_core_internal_geo_ClipStreamListenerFactory(pointVisible, clipLine, interpolate, clipStart);
  31774. };
  31775. com_ibm_rave_core_internal_geo_ClipUtil.newClipCircleStreamListenerFactory = function(radius) {
  31776. var circleClipLine = new com_ibm_rave_core_internal_geo_CircleClipLineStreamListenerFactory(radius);
  31777. var interpolator = com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.newCircleInterpolator(radius, 6 * 0.017453292519943295);
  31778. return new com_ibm_rave_core_internal_geo_ClipStreamListenerFactory(circleClipLine.visible, circleClipLine, interpolator, circleClipLine.smallRadius ? [0.0, -radius] : [-3.141592653589793, radius - 3.141592653589793]);
  31779. };
  31780. com_ibm_rave_core_internal_geo_ClipUtil.newAntimeridianClipLineStreamListenerFactory = function() {
  31781. var antimeridianClipLine = new com_ibm_rave_core_internal_geo_AntimeridianClipLineStreamListenerFactory();
  31782. 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]);
  31783. };
  31784. com_ibm_rave_core_internal_geo_ClipUtil.clipPolygon = function(segments, comparator, clipStartInside, interpolator, listener) {
  31785. var subject = [];
  31786. var clip = [];
  31787. segments.forEach(function(segment, index, array) {
  31788. var n = segment.length - 1;
  31789. if (n <= 0) {
  31790. return null;
  31791. }
  31792. var p0 = segment[0];
  31793. var p1 = segment[n];
  31794. if (com_ibm_rave_core_internal_geo_SphericalUtil.sphericalEqual((p0), (p1))) {
  31795. listener.lineStart();
  31796. for (var i = 0; i < n; ++i) {
  31797. listener.point((p0 = segment[i])[0], p0[1], NaN);
  31798. }
  31799. listener.lineEnd();
  31800. return null;
  31801. }
  31802. var a = new com_ibm_rave_core_internal_geo_ClipPolygonIntersection(p0, segment, null, true);
  31803. var b = new com_ibm_rave_core_internal_geo_ClipPolygonIntersection(p0, null, a, false);
  31804. a.o = b;
  31805. subject.push(a);
  31806. clip.push(b);
  31807. a = new com_ibm_rave_core_internal_geo_ClipPolygonIntersection(p1, segment, null, false);
  31808. b = new com_ibm_rave_core_internal_geo_ClipPolygonIntersection(p1, null, a, true);
  31809. a.o = b;
  31810. subject.push(a);
  31811. clip.push(b);
  31812. return null;
  31813. });
  31814. clip.sort(comparator);
  31815. com_ibm_rave_core_internal_geo_ClipUtil.clipPolygonLinkCircular(subject);
  31816. com_ibm_rave_core_internal_geo_ClipUtil.clipPolygonLinkCircular(clip);
  31817. if (subject.length == 0) {
  31818. return;
  31819. }
  31820. var entry = clipStartInside;
  31821. for (var i = 0, n = clip.length; i < n; ++i) {
  31822. clip[i].e = entry = !entry;
  31823. }
  31824. var start = subject[0];
  31825. var points;
  31826. var point;
  31827. while (true) {
  31828. var current = start;
  31829. var isSubject = true;
  31830. while (current.v) {
  31831. if ((current = current.n) == start) {
  31832. return;
  31833. }
  31834. }
  31835. points = current.z;
  31836. listener.lineStart();
  31837. do {
  31838. current.v = true;
  31839. current.o.v = true;
  31840. if (current.e) {
  31841. if (isSubject) {
  31842. for (var i = 0, n = points.length; i < n; ++i) {
  31843. listener.point((point = points[i])[0], point[1], NaN);
  31844. }
  31845. } else {
  31846. interpolator(current.x, current.n.x, 1, listener);
  31847. }
  31848. current = current.n;
  31849. } else {
  31850. if (isSubject) {
  31851. points = current.p.z;
  31852. for (var i = points.length - 1; i >= 0; --i) {
  31853. listener.point((point = points[i])[0], point[1], NaN);
  31854. }
  31855. } else {
  31856. interpolator(current.x, current.p.x, -1, listener);
  31857. }
  31858. current = current.p;
  31859. }
  31860. current = current.o;
  31861. points = current.z;
  31862. isSubject = !isSubject;
  31863. } while (!(current.v));
  31864. listener.lineEnd();
  31865. }
  31866. };
  31867. com_ibm_rave_core_internal_geo_ClipUtil.clipPolygonLinkCircular = function(array) {
  31868. var n = array.length;
  31869. if (n == 0) {
  31870. return;
  31871. }
  31872. var i = 0;
  31873. var a = array[0];
  31874. var b;
  31875. while (++i < n) {
  31876. a.n = b = array[i];
  31877. b.p = a;
  31878. a = b;
  31879. }
  31880. a.n = b = array[0];
  31881. b.p = a;
  31882. };
  31883. com_ibm_rave_core_internal_geo_ClipUtil.pointInPolygon = function(point, polygon) {
  31884. var _point = point;
  31885. var polarAngle = 0, meridian = _point[0], parallel = _point[1];
  31886. var winding = 0;
  31887. var meridianNormal = [Math.sin(meridian), -Math.cos(meridian), 0];
  31888. var areaRingSum = new com_ibm_rave_core_internal_math_Adder();
  31889. for (var i = 0, n = polygon.length; i < n; ++i) {
  31890. var ring = polygon[i];
  31891. var m = ring.length;
  31892. if (m == 0) {
  31893. continue;
  31894. }
  31895. var point0 = ring[0];
  31896. var λ0 = point0[0];
  31897. var φ0 = point0[1] / 2 + 3.141592653589793 / 4;
  31898. var sinφ0 = Math.sin(φ0);
  31899. var cosφ0 = Math.cos(φ0);
  31900. var j = 1;
  31901. while (true) {
  31902. if (j == m) {
  31903. j = 0;
  31904. }
  31905. _point = ring[j];
  31906. 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φ;
  31907. var antimeridian = adλ > 3.141592653589793;
  31908. areaRingSum.add(Math.atan2(k * sdλ * Math.sin(adλ), cosφ0 * cosφ + k * Math.cos(adλ)));
  31909. polarAngle += antimeridian ? dλ + sdλ * 6.283185307179586 : dλ;
  31910. if (antimeridian ^ (λ0 >= meridian) ^ (λ >= meridian)) {
  31911. 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)));
  31912. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianNormalize(arc);
  31913. var intersection = com_ibm_rave_core_internal_geo_CartesianUtil.cartesianCross(meridianNormal, arc);
  31914. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianNormalize(intersection);
  31915. var φarc = ((antimeridian ^ (dλ >= 0)) ? -1 : 1) * com_ibm_rave_core_internal_math_Trigonometry.asin(intersection[2]);
  31916. if (parallel > φarc || parallel == φarc && (arc[0] != 0 || arc[1] != 0)) {
  31917. winding += (antimeridian ^ (dλ >= 0)) ? 1 : -1;
  31918. }
  31919. }
  31920. if (j++ == 0) {
  31921. break;
  31922. }
  31923. λ0 = λ;
  31924. sinφ0 = sinφ;
  31925. cosφ0 = cosφ;
  31926. point0 = _point;
  31927. }
  31928. }
  31929. return (polarAngle < -1.0E-6 || polarAngle < 1.0E-6 && areaRingSum.valueOf() < 0) ^ ((winding & 1) != 0);
  31930. };
  31931. com_ibm_rave_core_internal_geo_ClipUtil.allVisible = function(x, y, z) {
  31932. return true;
  31933. };
  31934. com_ibm_rave_core_internal_geo_ClipUtil.clipAntimeridianInterpolator = function(from, to, direction, listener) {
  31935. var φ;
  31936. if (!from) {
  31937. φ = direction * 1.5707963267948966;
  31938. listener.point(-3.141592653589793, φ, NaN);
  31939. listener.point(0, φ, NaN);
  31940. listener.point(3.141592653589793, φ, NaN);
  31941. listener.point(3.141592653589793, 0, NaN);
  31942. listener.point(3.141592653589793, -φ, NaN);
  31943. listener.point(0, -φ, NaN);
  31944. listener.point(-3.141592653589793, -φ, NaN);
  31945. listener.point(-3.141592653589793, 0, NaN);
  31946. listener.point(-3.141592653589793, φ, NaN);
  31947. } else if (Math.abs(from[0] - to[0]) > 1.0E-6) {
  31948. var s = from[0] < to[0] ? 3.141592653589793 : -3.141592653589793;
  31949. φ = direction * s / 2;
  31950. listener.point(-s, φ, NaN);
  31951. listener.point(0, φ, NaN);
  31952. listener.point(s, φ, NaN);
  31953. } else {
  31954. listener.point(to[0], to[1], NaN);
  31955. }
  31956. };
  31957. // $source: com/ibm/rave/core/internal/geo/ClipStreamListener
  31958. /************************************************************************
  31959. ** IBM Confidential
  31960. **
  31961. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  31962. **
  31963. ** (C) Copyright IBM Corp. 2017
  31964. **
  31965. ** The source code for this program is not published or otherwise divested of its trade secrets,
  31966. ** irrespective of what has been deposited with the U.S. Copyright Office.
  31967. ************************************************************************/
  31968. // GENERATED
  31969. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  31970. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (loadtime) // superclass
  31971. //@import com/ibm/rave/core/internal/geo/ClipBufferStreamListener (runtime) // new
  31972. //@import com/ibm/rave/core/arrays/Merge (runtime) // merge
  31973. //@import com/ibm/rave/core/internal/geo/ClipUtil (runtime) // clipPolygon, pointInPolygon
  31974. /**
  31975. */
  31976. var com_ibm_rave_core_internal_geo_ClipStreamListener = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_DelegatingStreamListener, {
  31977. //pointVisible : null,
  31978. //clipLine : null,
  31979. //interpolate : null,
  31980. //clipStart : null,
  31981. //rotate : null,
  31982. //listener : null,
  31983. //comparator : null,
  31984. //segments : null,
  31985. //line : null,
  31986. //bufferListener : null,
  31987. //ringListener : null,
  31988. //rotatedClipStart : null,
  31989. //polygon : null,
  31990. //ring : null,
  31991. //clipSegmentLength1 : null,
  31992. polygonStarted : false,
  31993. constructor : function(pointVisible, clipLine, interpolate, clipStart, rotate, listener) {
  31994. var self = this;
  31995. this.pointVisible = pointVisible;
  31996. this.clipLine = clipLine;
  31997. this.interpolate = interpolate;
  31998. this.clipStart = clipStart;
  31999. this.rotate = rotate;
  32000. this.listener = listener;
  32001. this.line = clipLine(listener);
  32002. this.bufferListener = new com_ibm_rave_core_internal_geo_ClipBufferStreamListener();
  32003. this.ringListener = clipLine(this.bufferListener);
  32004. this.rotatedClipStart = ((rotate.invert(clipStart[0], clipStart[1])));
  32005. this.comparator = function(aa, bb) {
  32006. var a = aa.x;
  32007. var b = bb.x;
  32008. 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]));
  32009. return (result == 0) ? 0 : (result > 0) ? 1 : -1;
  32010. };
  32011. this.clipSegmentLength1 = function(segment, index, array) {
  32012. return segment.length > 1;
  32013. };
  32014. var point = function(λ, φ, z) {
  32015. var _λ = λ;
  32016. var _φ = φ;
  32017. var point = self.rotate(_λ, _φ);
  32018. if (self.pointVisible(_λ = point[0], _φ = point[1], NaN)) {
  32019. self.listener.point(_λ, _φ, NaN);
  32020. }
  32021. };
  32022. var pointLine = function(λ, φ, z) {
  32023. var point = self.rotate(λ, φ);
  32024. self.line.point(point[0], point[1], NaN);
  32025. };
  32026. var pointRing = function(λ, φ, z) {
  32027. self.ring.push([λ, φ]);
  32028. var point = self.rotate(λ, φ);
  32029. self.ringListener.point(point[0], point[1], NaN);
  32030. };
  32031. var lineStart = function() {
  32032. self.pointDelegate = pointLine;
  32033. self.line.lineStart();
  32034. };
  32035. var lineEnd = function() {
  32036. self.pointDelegate = point;
  32037. self.line.lineEnd();
  32038. };
  32039. var ringStart = function() {
  32040. self.ringListener.lineStart();
  32041. self.ring = [];
  32042. };
  32043. var ringEnd = function() {
  32044. pointRing(self.ring[0][0], self.ring[0][1], NaN);
  32045. self.ringListener.lineEnd();
  32046. var clean = self.ringListener.clean();
  32047. var ringSegments = self.bufferListener.buffer();
  32048. var segment;
  32049. var n = ringSegments.length;
  32050. self.ring.pop();
  32051. self.polygon.push(self.ring);
  32052. self.ring = null;
  32053. if (n == 0) {
  32054. return;
  32055. }
  32056. if ((clean & 1) != 0) {
  32057. segment = ringSegments[0];
  32058. n = segment.length - 1;
  32059. var i = -1;
  32060. var point;
  32061. if (n > 0) {
  32062. if (!self.polygonStarted) {
  32063. self.listener.polygonStart();
  32064. self.polygonStarted = true;
  32065. }
  32066. self.listener.lineStart();
  32067. while (++i < n) {
  32068. self.listener.point((point = segment[i])[0], point[1], NaN);
  32069. }
  32070. self.listener.lineEnd();
  32071. }
  32072. return;
  32073. }
  32074. if (n > 1 && ((clean & 2) != 0)) {
  32075. ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
  32076. }
  32077. self.segments.push(ringSegments.filter(self.clipSegmentLength1));
  32078. };
  32079. var polygonStart = function() {
  32080. self.pointDelegate = pointRing;
  32081. self.lineStartDelegate = ringStart;
  32082. self.lineEndDelegate = ringEnd;
  32083. self.segments = [];
  32084. self.polygon = [];
  32085. };
  32086. var polygonEnd = function() {
  32087. self.pointDelegate = point;
  32088. self.lineStartDelegate = lineStart;
  32089. self.lineEndDelegate = lineEnd;
  32090. var mergedSegments = com_ibm_rave_core_arrays_Merge.merge(self.segments);
  32091. var clipStartInside = com_ibm_rave_core_internal_geo_ClipUtil.pointInPolygon(self.rotatedClipStart, self.polygon);
  32092. if (mergedSegments.length > 0) {
  32093. if (!self.polygonStarted) {
  32094. self.listener.polygonStart();
  32095. self.polygonStarted = true;
  32096. }
  32097. com_ibm_rave_core_internal_geo_ClipUtil.clipPolygon(mergedSegments, self.comparator, clipStartInside, self.interpolate, self.listener);
  32098. } else if (clipStartInside) {
  32099. if (!self.polygonStarted) {
  32100. self.listener.polygonStart();
  32101. self.polygonStarted = true;
  32102. }
  32103. self.listener.lineStart();
  32104. self.interpolate(null, null, 1, self.listener);
  32105. self.listener.lineEnd();
  32106. }
  32107. if (self.polygonStarted) {
  32108. self.listener.polygonEnd();
  32109. self.polygonStarted = false;
  32110. }
  32111. mergedSegments = self.polygon = null;
  32112. };
  32113. var sphere = function() {
  32114. self.listener.polygonStart();
  32115. self.listener.lineStart();
  32116. self.interpolate(null, null, 1, self.listener);
  32117. self.listener.lineEnd();
  32118. self.listener.polygonEnd();
  32119. };
  32120. this.pointDelegate = point;
  32121. this.lineStartDelegate = lineStart;
  32122. this.lineEndDelegate = lineEnd;
  32123. this.polygonStartDelegate = polygonStart;
  32124. this.polygonEndDelegate = polygonEnd;
  32125. this.sphereDelegate = sphere;
  32126. }
  32127. });
  32128. // $source: com/ibm/rave/core/internal/geo/CircleClipLineStreamListenerFactory
  32129. /************************************************************************
  32130. ** IBM Confidential
  32131. **
  32132. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  32133. **
  32134. ** (C) Copyright IBM Corp. 2017
  32135. **
  32136. ** The source code for this program is not published or otherwise divested of its trade secrets,
  32137. ** irrespective of what has been deposited with the U.S. Copyright Office.
  32138. ************************************************************************/
  32139. // GENERATED
  32140. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, declare anonymous
  32141. //@import com/ibm/rave/core/internal/geo/CartesianUtil (runtime) // cartesianAdd, cartesianCross, cartesianScale, cartesianDot, cartesian
  32142. //@import com/ibm/rave/core/internal/geo/SphericalUtil (runtime) // spherical, sphericalEqual
  32143. //@import com/ibm/rave/core/internal/geo/ClipLineStreamListenerFactory (runtime)
  32144. /**
  32145. */
  32146. var com_ibm_rave_core_internal_geo_CircleClipLineStreamListenerFactory = com_ibm_rave_core_nativeImpl_Declare({
  32147. //visible : null,
  32148. //point0 : null,
  32149. radius : 0,
  32150. cr : 0,
  32151. smallRadius : false,
  32152. notHemisphere : false,
  32153. c0 : 0,
  32154. v0 : false,
  32155. v00 : false,
  32156. clean : 0,
  32157. _$functionClassMethod : function() {
  32158. var _$self = function(listener) {
  32159. var self = _$self;
  32160. return new (com_ibm_rave_core_nativeImpl_Declare({
  32161. sphere : function() {},
  32162. point : function(λ, φ, z) {
  32163. var point1 = [λ, φ], point2;
  32164. var v = self.visible(λ, φ, NaN);
  32165. var c = self.smallRadius ? v ? 0 : self.code(λ, φ) : v ? self.code(λ + (λ < 0 ? 3.141592653589793 : -3.141592653589793), φ) : 0;
  32166. if ((!self.point0) && (self.v00 = self.v0 = v)) {
  32167. listener.lineStart();
  32168. }
  32169. if (v != self.v0) {
  32170. point2 = self.intersect(self.point0, point1, false);
  32171. if (com_ibm_rave_core_internal_geo_SphericalUtil.sphericalEqual((self.point0), (point2)) || com_ibm_rave_core_internal_geo_SphericalUtil.sphericalEqual((point1), (point2))) {
  32172. point1[0] = point1[0] + 1.0E-6;
  32173. point1[1] = point1[1] + 1.0E-6;
  32174. v = self.visible(point1[0], point1[1], NaN);
  32175. }
  32176. }
  32177. if (v != self.v0) {
  32178. self.clean = 0;
  32179. if (v) {
  32180. listener.lineStart();
  32181. point2 = self.intersect(point1, self.point0, false);
  32182. listener.point(point2[0], point2[1], NaN);
  32183. } else {
  32184. point2 = self.intersect(self.point0, point1, false);
  32185. listener.point(point2[0], point2[1], NaN);
  32186. listener.lineEnd();
  32187. }
  32188. self.point0 = point2;
  32189. } else if (self.notHemisphere && (self.point0) && self.smallRadius ^ v) {
  32190. var t;
  32191. if (((c & self.c0) == 0) && ((t = self.intersect(point1, self.point0, true)))) {
  32192. self.clean = 0;
  32193. if (self.smallRadius) {
  32194. listener.lineStart();
  32195. listener.point(t[0][0], t[0][1], NaN);
  32196. listener.point(t[1][0], t[1][1], NaN);
  32197. listener.lineEnd();
  32198. } else {
  32199. listener.point(t[1][0], t[1][1], NaN);
  32200. listener.lineEnd();
  32201. listener.lineStart();
  32202. listener.point(t[0][0], t[0][1], NaN);
  32203. }
  32204. }
  32205. }
  32206. if (v && ((!self.point0) || !(com_ibm_rave_core_internal_geo_SphericalUtil.sphericalEqual((self.point0), (point1))))) {
  32207. listener.point(point1[0], point1[1], NaN);
  32208. }
  32209. self.point0 = point1;
  32210. self.v0 = v;
  32211. self.c0 = c;
  32212. },
  32213. lineStart : function() {
  32214. self.v00 = self.v0 = false;
  32215. self.clean = 1;
  32216. },
  32217. lineEnd : function() {
  32218. if (self.v0) {
  32219. listener.lineEnd();
  32220. }
  32221. self.point0 = null;
  32222. },
  32223. polygonStart : function() {},
  32224. polygonEnd : function() {},
  32225. clean : function() {
  32226. return self.clean | ((self.v00 && self.v0) ? 1 << 1 : 0);
  32227. }
  32228. }))();
  32229. };
  32230. return _$self;
  32231. },
  32232. constructor : function(radius) {
  32233. var self = this;
  32234. this.radius = radius;
  32235. this.cr = Math.cos(radius);
  32236. this.smallRadius = (this.cr > 0);
  32237. this.notHemisphere = Math.abs(this.cr) > 1.0E-6;
  32238. this.visible = function(λ, φ, z) {
  32239. return Math.cos(λ) * Math.cos(φ) > self.cr;
  32240. };
  32241. },
  32242. /**
  32243. * @return (com.ibm.rave.core.internal.geo.ClipUtil.PointVisiblity) the visible
  32244. */
  32245. getPointVisiblilty : function() {
  32246. return this.visible;
  32247. },
  32248. /**
  32249. * @return (boolean) the smallRadius
  32250. */
  32251. isSmallRadius : function() {
  32252. return this.smallRadius;
  32253. },
  32254. intersect : function(a, b, two) {
  32255. var pa = com_ibm_rave_core_internal_geo_CartesianUtil.cartesian((a)), pb = com_ibm_rave_core_internal_geo_CartesianUtil.cartesian((b));
  32256. var n1 = [1, 0, 0];
  32257. var n2 = com_ibm_rave_core_internal_geo_CartesianUtil.cartesianCross(pa, pb);
  32258. var n2n2 = com_ibm_rave_core_internal_geo_CartesianUtil.cartesianDot(n2, n2);
  32259. var n1n2 = n2[0];
  32260. var determinant = n2n2 - n1n2 * n1n2;
  32261. if (!((determinant))) {
  32262. if (!two) {
  32263. return a;
  32264. } else {
  32265. return null;
  32266. }
  32267. }
  32268. var c1 = this.cr * n2n2 / determinant, c2 = -this.cr * n1n2 / determinant;
  32269. 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);
  32270. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianAdd(A, B);
  32271. var u = n1xn2;
  32272. 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);
  32273. if (t2 < 0) {
  32274. return null;
  32275. }
  32276. var t = Math.sqrt(t2);
  32277. var q = com_ibm_rave_core_internal_geo_CartesianUtil.cartesianScale(u, (-w - t) / uu);
  32278. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianAdd(q, A);
  32279. q = com_ibm_rave_core_internal_geo_SphericalUtil.spherical(q);
  32280. if (!two) {
  32281. return ((q));
  32282. }
  32283. var λ0 = a[0];
  32284. var λ1 = b[0];
  32285. var φ0 = a[1];
  32286. var φ1 = b[1];
  32287. var z;
  32288. if (λ1 < λ0) {
  32289. z = λ0;
  32290. λ0 = λ1;
  32291. λ1 = z;
  32292. }
  32293. var δλ = λ1 - λ0;
  32294. var polar = Math.abs(δλ - 3.141592653589793) < 1.0E-6;
  32295. var meridian = polar || δλ < 1.0E-6;
  32296. if (!polar && φ1 < φ0) {
  32297. z = φ0;
  32298. φ0 = φ1;
  32299. φ1 = z;
  32300. }
  32301. var pointIsBetween = false;
  32302. if (meridian) {
  32303. if (polar) {
  32304. pointIsBetween = (φ0 + φ1 > 0) ^ (q[1] < (Math.abs(q[0] - λ0) < 1.0E-6 ? φ0 : φ1));
  32305. } else {
  32306. pointIsBetween = φ0 <= q[1] && q[1] <= φ1;
  32307. }
  32308. } else {
  32309. pointIsBetween = (δλ > 3.141592653589793) ^ (λ0 <= q[0] && q[0] <= λ1);
  32310. }
  32311. if (pointIsBetween) {
  32312. var q1 = com_ibm_rave_core_internal_geo_CartesianUtil.cartesianScale(u, (-w + t) / uu);
  32313. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianAdd(q1, A);
  32314. return [((q)), ((com_ibm_rave_core_internal_geo_SphericalUtil.spherical(q1)))];
  32315. }
  32316. return null;
  32317. },
  32318. code : function(λ, φ) {
  32319. var r = this.smallRadius ? this.radius : 3.141592653589793 - this.radius;
  32320. var code = 0;
  32321. if (λ < -r) {
  32322. code |= 1;
  32323. } else if (λ > r) {
  32324. code |= 2;
  32325. }
  32326. if (φ < -r) {
  32327. code |= 4;
  32328. } else if (φ > r) {
  32329. code |= 8;
  32330. }
  32331. return code;
  32332. }
  32333. });
  32334. // $source: com/ibm/rave/core/internal/geo/SphericalUtil
  32335. /************************************************************************
  32336. ** IBM Confidential
  32337. **
  32338. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  32339. **
  32340. ** (C) Copyright IBM Corp. 2017
  32341. **
  32342. ** The source code for this program is not published or otherwise divested of its trade secrets,
  32343. ** irrespective of what has been deposited with the U.S. Copyright Office.
  32344. ************************************************************************/
  32345. // GENERATED
  32346. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  32347. //@import com/ibm/rave/core/internal/math/Trigonometry (static) // asin
  32348. /**
  32349. * A collection of helper methods operating on point in a spherical plane.
  32350. */
  32351. var com_ibm_rave_core_internal_geo_SphericalUtil = com_ibm_rave_core_nativeImpl_Declare({
  32352. /**
  32353. */
  32354. //constructor : function() {}
  32355. });
  32356. /**
  32357. * Converts a point coordinates from Cartesian plane to spherical plane
  32358. * @param (double[]) cartesian the location in Cartesian plane to convert
  32359. * @return (double[]) the x,y coordinates of the point in spherical plane
  32360. */
  32361. com_ibm_rave_core_internal_geo_SphericalUtil.spherical = function(cartesian) {
  32362. return [Math.atan2(cartesian[1], cartesian[0]), com_ibm_rave_core_internal_math_Trigonometry.asin(cartesian[2])];
  32363. };
  32364. /**
  32365. * 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
  32366. * @param (double[]) a the first point to compare
  32367. * @param (double[]) b the second point to compare
  32368. * @return (boolean) true if they are equal, false otherwise
  32369. */
  32370. com_ibm_rave_core_internal_geo_SphericalUtil.sphericalEqual = function(a, b) {
  32371. return Math.abs(a[0] - b[0]) < 1.0E-6 && Math.abs(a[1] - b[1]) < 1.0E-6;
  32372. };
  32373. /**
  32374. * Calculates the great-arc distance between two points in spherical plane
  32375. * @param (double[]) a the first point
  32376. * @param (double[]) b the second point
  32377. * @return (double) the calculated distance
  32378. */
  32379. com_ibm_rave_core_internal_geo_SphericalUtil.calculateDistance = function(a, b) {
  32380. 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;
  32381. 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Δλ);
  32382. };
  32383. // $source: com/ibm/rave/core/internal/geo/GeoShapeGeneratorUtil
  32384. /************************************************************************
  32385. ** IBM Confidential
  32386. **
  32387. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  32388. **
  32389. ** (C) Copyright IBM Corp. 2017
  32390. **
  32391. ** The source code for this program is not published or otherwise divested of its trade secrets,
  32392. ** irrespective of what has been deposited with the U.S. Copyright Office.
  32393. ************************************************************************/
  32394. // GENERATED
  32395. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  32396. //@import com/ibm/rave/core/internal/geo/SphericalUtil (runtime) // spherical
  32397. //@import com/ibm/rave/core/internal/geo/CartesianUtil (static) // cartesianNormalize, cartesian
  32398. //@import com/ibm/rave/core/internal/math/Trigonometry (runtime) // acos
  32399. //@import com/ibm/rave/core/Rave (runtime) // range
  32400. /**
  32401. */
  32402. var com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil = com_ibm_rave_core_nativeImpl_Declare({
  32403. });
  32404. com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.newCircleInterpolator = function(radius, precision) {
  32405. var cr = Math.cos(radius), sr = Math.sin(radius);
  32406. return function(from, to, direction, listener) {
  32407. var fromAngle, toAngle;
  32408. var step = direction * precision;
  32409. if (from) {
  32410. fromAngle = com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.circleAngle(cr, from);
  32411. toAngle = com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.circleAngle(cr, to);
  32412. if ((direction > 0) ? fromAngle < toAngle : fromAngle > toAngle) {
  32413. fromAngle += direction * 6.283185307179586;
  32414. }
  32415. } else {
  32416. fromAngle = radius + direction * 6.283185307179586;
  32417. toAngle = radius - .5 * step;
  32418. }
  32419. var point;
  32420. for (var t = fromAngle; (direction > 0) ? t > toAngle : t < toAngle; t -= step) {
  32421. listener.point((point = com_ibm_rave_core_internal_geo_SphericalUtil.spherical([cr, -sr * Math.cos(t), -sr * Math.sin(t)]))[0], point[1], NaN);
  32422. }
  32423. };
  32424. };
  32425. com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.circleAngle = function(cr, sphericalPoint) {
  32426. var a = com_ibm_rave_core_internal_geo_CartesianUtil.cartesian((sphericalPoint));
  32427. a[0] -= cr;
  32428. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianNormalize(a);
  32429. var angle = com_ibm_rave_core_internal_math_Trigonometry.acos(-a[1]);
  32430. return ((-a[2] < 0 ? -angle : angle) + 2 * 3.141592653589793 - 1.0E-6) % (2 * 3.141592653589793);
  32431. };
  32432. com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.graticuleX = function(y0, y1, dy) {
  32433. var array = com_ibm_rave_core_Rave.range(y0, y1 - 1.0E-6, dy).concat(y1);
  32434. return function(x) {
  32435. return array.map(function(currentValue, index, arr) {
  32436. return [x, + (currentValue)];
  32437. });
  32438. };
  32439. };
  32440. com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.graticuleY = function(x0, x1, dx) {
  32441. var array = com_ibm_rave_core_Rave.range(x0, x1 - 1.0E-6, dx).concat(x1);
  32442. return function(y) {
  32443. return array.map(function(currentValue, index, arr) {
  32444. return [+ (currentValue), y];
  32445. });
  32446. };
  32447. };
  32448. // $source: com/ibm/rave/core/internal/geo/AntimeridianClipLineStreamListenerFactory
  32449. /************************************************************************
  32450. ** IBM Confidential
  32451. **
  32452. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  32453. **
  32454. ** (C) Copyright IBM Corp. 2017
  32455. **
  32456. ** The source code for this program is not published or otherwise divested of its trade secrets,
  32457. ** irrespective of what has been deposited with the U.S. Copyright Office.
  32458. ************************************************************************/
  32459. // GENERATED
  32460. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  32461. /**
  32462. */
  32463. var com_ibm_rave_core_internal_geo_AntimeridianClipLineStreamListenerFactory = com_ibm_rave_core_nativeImpl_Declare({
  32464. λ0 : 0, φ0 : 0, sλ0 : 0,
  32465. clean : 0,
  32466. _$functionClassMethod : function() {
  32467. var _$self = function(listener) {
  32468. _$self.λ0 = _$self.φ0 = _$self.sλ0 = NaN;
  32469. _$self.clean = 0;
  32470. return new com_ibm_rave_core_internal_geo_AntimeridianClipLineStreamListenerFactory.AntimeridianClipLineStreamListener(_$self, listener);
  32471. };
  32472. return _$self;
  32473. }
  32474. });
  32475. com_ibm_rave_core_internal_geo_AntimeridianClipLineStreamListenerFactory.clipAntimeridianIntersect = function(λ0, φ0, λ1, φ1) {
  32476. var cosφ0, cosφ1, sinλ0_λ1 = Math.sin(λ0 - λ1);
  32477. 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;
  32478. };
  32479. com_ibm_rave_core_internal_geo_AntimeridianClipLineStreamListenerFactory.AntimeridianClipLineStreamListener = com_ibm_rave_core_nativeImpl_Declare({
  32480. //listener : null,
  32481. //self : null,
  32482. constructor : function(_self, _listener) {
  32483. this.self = _self;
  32484. this.listener = _listener;
  32485. },
  32486. /** @expose */
  32487. sphere : function() {},
  32488. /** @expose */
  32489. point : function(λ1, φ1, z) {
  32490. var _λ1 = λ1;
  32491. var sλ1 = _λ1 > 0 ? 3.141592653589793 : -3.141592653589793, dλ = Math.abs(_λ1 - this.self.λ0);
  32492. if (Math.abs(dλ - 3.141592653589793) < 1.0E-6) {
  32493. this.listener.point(this.self.λ0, this.self.φ0 = (this.self.φ0 + φ1) / 2 > 0 ? 1.5707963267948966 : -1.5707963267948966, NaN);
  32494. this.listener.point(this.self.sλ0, this.self.φ0, NaN);
  32495. this.listener.lineEnd();
  32496. this.listener.lineStart();
  32497. this.listener.point(sλ1, this.self.φ0, NaN);
  32498. this.listener.point(_λ1, this.self.φ0, NaN);
  32499. this.self.clean = 0;
  32500. } else if (this.self.sλ0 != sλ1 && dλ >= 3.141592653589793) {
  32501. if (Math.abs(this.self.λ0 - this.self.sλ0) < 1.0E-6) {
  32502. this.self.λ0 -= this.self.sλ0 * 1.0E-6;
  32503. }
  32504. if (Math.abs(_λ1 - sλ1) < 1.0E-6) {
  32505. _λ1 -= sλ1 * 1.0E-6;
  32506. }
  32507. this.self.φ0 = com_ibm_rave_core_internal_geo_AntimeridianClipLineStreamListenerFactory.clipAntimeridianIntersect(this.self.λ0, this.self.φ0, _λ1, φ1);
  32508. this.listener.point(this.self.sλ0, this.self.φ0, NaN);
  32509. this.listener.lineEnd();
  32510. this.listener.lineStart();
  32511. this.listener.point(sλ1, this.self.φ0, NaN);
  32512. this.self.clean = 0;
  32513. }
  32514. this.listener.point(this.self.λ0 = _λ1, this.self.φ0 = φ1, NaN);
  32515. this.self.sλ0 = sλ1;
  32516. },
  32517. /** @expose */
  32518. lineStart : function() {
  32519. this.listener.lineStart();
  32520. this.self.clean = 1;
  32521. },
  32522. /** @expose */
  32523. lineEnd : function() {
  32524. this.listener.lineEnd();
  32525. this.self.λ0 = this.self.φ0 = NaN;
  32526. },
  32527. /** @expose */
  32528. polygonStart : function() {},
  32529. /** @expose */
  32530. polygonEnd : function() {},
  32531. clean : function() {
  32532. return 2 - this.self.clean;
  32533. }
  32534. });
  32535. // $source: com/ibm/rave/core/internal/geo/ClipPolygonIntersection
  32536. /************************************************************************
  32537. ** IBM Confidential
  32538. **
  32539. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  32540. **
  32541. ** (C) Copyright IBM Corp. 2017
  32542. **
  32543. ** The source code for this program is not published or otherwise divested of its trade secrets,
  32544. ** irrespective of what has been deposited with the U.S. Copyright Office.
  32545. ************************************************************************/
  32546. // GENERATED
  32547. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  32548. /**
  32549. */
  32550. var com_ibm_rave_core_internal_geo_ClipPolygonIntersection = com_ibm_rave_core_nativeImpl_Declare({
  32551. //x : null,
  32552. //z : null,
  32553. //o : null,
  32554. //n : null,
  32555. //p : null,
  32556. v : false,
  32557. e : false,
  32558. constructor : function(point, points, other, entry) {
  32559. this.x = point;
  32560. this.z = points;
  32561. this.o = other;
  32562. this.e = entry;
  32563. this.v = false;
  32564. },
  32565. /**
  32566. * @return (boolean) the v
  32567. */
  32568. isVisited : function() {
  32569. return this.v;
  32570. },
  32571. /**
  32572. * @param (boolean) v the v to set
  32573. */
  32574. setVisited : function(v) {
  32575. this.v = v;
  32576. },
  32577. /**
  32578. * @return (Array) the x
  32579. */
  32580. getPoint : function() {
  32581. return this.x;
  32582. },
  32583. /**
  32584. * @param (Array) x the x to set
  32585. */
  32586. setPoint : function(x) {
  32587. this.x = x;
  32588. },
  32589. /**
  32590. * @return (Array) the z
  32591. */
  32592. getPoints : function() {
  32593. return this.z;
  32594. },
  32595. /**
  32596. * @param (Array) z the z to set
  32597. */
  32598. setPoints : function(z) {
  32599. this.z = z;
  32600. },
  32601. /**
  32602. * @return (com.ibm.rave.core.internal.geo.ClipPolygonIntersection) the o
  32603. */
  32604. getOtherIntersection : function() {
  32605. return this.o;
  32606. },
  32607. /**
  32608. * @param (com.ibm.rave.core.internal.geo.ClipPolygonIntersection) o the o to set
  32609. */
  32610. setOtherIntersection : function(o) {
  32611. this.o = o;
  32612. },
  32613. /**
  32614. * @return (boolean) the e
  32615. */
  32616. isEntry : function() {
  32617. return this.e;
  32618. },
  32619. /**
  32620. * @param (boolean) e the e to set
  32621. */
  32622. setEntry : function(e) {
  32623. this.e = e;
  32624. },
  32625. /**
  32626. * @return (com.ibm.rave.core.internal.geo.ClipPolygonIntersection) the n
  32627. */
  32628. getNext : function() {
  32629. return this.n;
  32630. },
  32631. /**
  32632. * @param (com.ibm.rave.core.internal.geo.ClipPolygonIntersection) n the n to set
  32633. */
  32634. setNext : function(n) {
  32635. this.n = n;
  32636. },
  32637. /**
  32638. * @return (com.ibm.rave.core.internal.geo.ClipPolygonIntersection) the p
  32639. */
  32640. getPrevious : function() {
  32641. return this.p;
  32642. },
  32643. /**
  32644. * @param (com.ibm.rave.core.internal.geo.ClipPolygonIntersection) p the p to set
  32645. */
  32646. setPrevious : function(p) {
  32647. this.p = p;
  32648. }
  32649. });
  32650. // $source: com/ibm/rave/core/internal/math/Adder
  32651. /************************************************************************
  32652. ** IBM Confidential
  32653. **
  32654. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  32655. **
  32656. ** (C) Copyright IBM Corp. 2017
  32657. **
  32658. ** The source code for this program is not published or otherwise divested of its trade secrets,
  32659. ** irrespective of what has been deposited with the U.S. Copyright Office.
  32660. ************************************************************************/
  32661. // GENERATED
  32662. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  32663. /**
  32664. * 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.
  32665. */
  32666. var com_ibm_rave_core_internal_math_Adder = com_ibm_rave_core_nativeImpl_Declare({
  32667. s : 0,
  32668. t : 0,
  32669. /**
  32670. * Adds the passed value to the exisiting value of this adder.
  32671. * @param (double) y the double value to add
  32672. */
  32673. add : function(y) {
  32674. var s_temp, t_temp;
  32675. var x = s_temp = y + this.t;
  32676. var bv = x - y, av = x - bv;
  32677. t_temp = y - av + (this.t - bv);
  32678. var s_temp2 = this.s;
  32679. x = this.s = s_temp + s_temp2;
  32680. bv = x - s_temp;
  32681. av = x - bv;
  32682. this.t = s_temp - av + (s_temp2 - bv);
  32683. if (this.s != 0) {
  32684. this.t += t_temp;
  32685. } else {
  32686. this.s = t_temp;
  32687. }
  32688. },
  32689. /**
  32690. * Resets the value of this Adder to zero so that it could be reused to sum up a different group of numbers
  32691. */
  32692. reset : function() {
  32693. this.s = this.t = 0;
  32694. },
  32695. /**
  32696. * Returns the final sum of all double values passed to this adder
  32697. * @return (double) The final sum
  32698. */
  32699. valueOf : function() {
  32700. return this.s;
  32701. }
  32702. });
  32703. // $source: com/ibm/rave/core/internal/geo/SphericalRotation
  32704. /************************************************************************
  32705. ** IBM Confidential
  32706. **
  32707. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  32708. **
  32709. ** (C) Copyright IBM Corp. 2017
  32710. **
  32711. ** The source code for this program is not published or otherwise divested of its trade secrets,
  32712. ** irrespective of what has been deposited with the U.S. Copyright Office.
  32713. ************************************************************************/
  32714. // GENERATED
  32715. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  32716. //@import com/ibm/rave/core/internal/math/Trigonometry (runtime) // asin
  32717. /**
  32718. */
  32719. var com_ibm_rave_core_internal_geo_SphericalRotation = com_ibm_rave_core_nativeImpl_Declare({
  32720. /**
  32721. */
  32722. //constructor : function() {}
  32723. });
  32724. /**
  32725. * 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.
  32726. * @param (double[]) location the location to rotate
  32727. * @return (com.ibm.rave.core.geo.SphericalRotator) the rotator
  32728. * @see (com.ibm.rave.core.geo.SphericalRotator) SphericalRotator
  32729. */
  32730. com_ibm_rave_core_internal_geo_SphericalRotation.newRotator = function(location) {
  32731. 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);
  32732. var rotation = new com_ibm_rave_core_internal_geo_SphericalRotation.SphericalRotatorImpl();
  32733. rotation.pointProjection = rfo;
  32734. return rotation;
  32735. };
  32736. com_ibm_rave_core_internal_geo_SphericalRotation.compose = function(a, b) {
  32737. var obj;
  32738. if (a.invert && b.invert) {
  32739. obj = new com_ibm_rave_core_internal_geo_SphericalRotation.ComposedInvertiblePointProjector();
  32740. } else {
  32741. obj = new com_ibm_rave_core_internal_geo_SphericalRotation.ComposedPointProjection();
  32742. }
  32743. obj.init(a, b);
  32744. return obj;
  32745. };
  32746. com_ibm_rave_core_internal_geo_SphericalRotation.rotation = function(δλ, δφ, δγ) {
  32747. 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);
  32748. };
  32749. com_ibm_rave_core_internal_geo_SphericalRotation.rotationλ = function(δλ) {
  32750. var obj = new com_ibm_rave_core_internal_geo_SphericalRotation.PointProjectionλ();
  32751. obj.δλ = δλ;
  32752. return obj;
  32753. };
  32754. com_ibm_rave_core_internal_geo_SphericalRotation.rotationφγ = function(δφ, δγ) {
  32755. var cosδφ = Math.cos(δφ), sinδφ = Math.sin(δφ), cosδγ = Math.cos(δγ), sinδγ = Math.sin(δγ);
  32756. var obj = new com_ibm_rave_core_internal_geo_SphericalRotation.PointProjectionφγ();
  32757. obj.init(cosδφ, sinδφ, cosδγ, sinδγ);
  32758. return obj;
  32759. };
  32760. com_ibm_rave_core_internal_geo_SphericalRotation.SphericalRotatorImpl = com_ibm_rave_core_nativeImpl_Declare({
  32761. //pointProjection : null,
  32762. _$functionClassMethod : function() {
  32763. var _$self = function(coordinates) {
  32764. var _coordinates = coordinates;
  32765. _coordinates = _$self.pointProjection(_coordinates[0] * 0.017453292519943295, _coordinates[1] * 0.017453292519943295);
  32766. _coordinates[0] *= 57.29577951308232;
  32767. _coordinates[1] *= 57.29577951308232;
  32768. return _coordinates;
  32769. };
  32770. return _$self;
  32771. },
  32772. init : function(pointProjection) {
  32773. this.pointProjection = pointProjection;
  32774. },
  32775. /** @expose */
  32776. invert : function(coordinates) {
  32777. var _coordinates = coordinates;
  32778. _coordinates = this.pointProjection.invert(_coordinates[0] * 0.017453292519943295, _coordinates[1] * 0.017453292519943295);
  32779. _coordinates[0] *= 57.29577951308232;
  32780. _coordinates[1] *= 57.29577951308232;
  32781. return _coordinates;
  32782. }
  32783. });
  32784. com_ibm_rave_core_internal_geo_SphericalRotation.IdentityPointProjection = com_ibm_rave_core_nativeImpl_Declare({
  32785. _$functionClassMethod : function() {
  32786. var _$self = function(λ, φ) {
  32787. return [λ > 3.141592653589793 ? λ - 6.283185307179586 : λ < -3.141592653589793 ? λ + 6.283185307179586 : λ, φ];
  32788. };
  32789. return _$self;
  32790. },
  32791. /** @expose */
  32792. invert : function(λ, φ) {
  32793. return [λ, φ];
  32794. },
  32795. /** @expose */
  32796. supportInversion : function() {
  32797. return true;
  32798. }
  32799. });
  32800. com_ibm_rave_core_internal_geo_SphericalRotation.ComposedPointProjection = com_ibm_rave_core_nativeImpl_Declare({
  32801. //a : null,
  32802. //b : null,
  32803. _$functionClassMethod : function() {
  32804. var _$self = function(λ, φ) {
  32805. var x = _$self.a(λ, φ);
  32806. return _$self.b(x[0], x[1]);
  32807. };
  32808. return _$self;
  32809. },
  32810. /**
  32811. * @param (com.ibm.rave.core.geo.PointProjector) a
  32812. * @param (com.ibm.rave.core.geo.PointProjector) b
  32813. */
  32814. init : function(a, b) {
  32815. this.a = a;
  32816. this.b = b;
  32817. },
  32818. /** @expose */
  32819. supportInversion : function() {
  32820. return false;
  32821. }
  32822. });
  32823. com_ibm_rave_core_internal_geo_SphericalRotation.ComposedInvertiblePointProjector = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_SphericalRotation.ComposedPointProjection, {
  32824. /** @expose */
  32825. invert : function(λ, φ) {
  32826. var x = (this.b).invert(λ, φ);
  32827. if (x) {
  32828. return (this.a).invert(x[0], x[1]);
  32829. }
  32830. return null;
  32831. },
  32832. /** @expose */
  32833. supportInversion : function() {
  32834. return true;
  32835. }
  32836. });
  32837. com_ibm_rave_core_internal_geo_SphericalRotation.PointProjectionλ = com_ibm_rave_core_nativeImpl_Declare({
  32838. δλ : 0,
  32839. _$functionClassMethod : function() {
  32840. var _$self = function(λ, φ) {
  32841. var _λ = λ;
  32842. _λ += _$self.δλ;
  32843. return [_λ > 3.141592653589793 ? _λ - 6.283185307179586 : _λ < -3.141592653589793 ? _λ + 6.283185307179586 : _λ, φ];
  32844. };
  32845. return _$self;
  32846. },
  32847. init : function(δλ) {
  32848. this.δλ = δλ;
  32849. },
  32850. /** @expose */
  32851. invert : function(λ, φ) {
  32852. var _λ = λ;
  32853. _λ -= this.δλ;
  32854. return [_λ > 3.141592653589793 ? _λ - 6.283185307179586 : _λ < -3.141592653589793 ? _λ + 6.283185307179586 : _λ, φ];
  32855. },
  32856. /** @expose */
  32857. supportInversion : function() {
  32858. return true;
  32859. }
  32860. });
  32861. com_ibm_rave_core_internal_geo_SphericalRotation.PointProjectionφγ = com_ibm_rave_core_nativeImpl_Declare({
  32862. cosδφ : 0, sinδφ : 0, cosδγ : 0, sinδγ : 0,
  32863. _$functionClassMethod : function() {
  32864. var _$self = function(λ, φ) {
  32865. var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * _$self.cosδφ + x * _$self.sinδφ;
  32866. 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δγ)];
  32867. };
  32868. return _$self;
  32869. },
  32870. init : function(cosδφ, sinδφ, cosδγ, sinδγ) {
  32871. this.cosδφ = cosδφ;
  32872. this.sinδφ = sinδφ;
  32873. this.cosδγ = cosδγ;
  32874. this.sinδγ = sinδγ;
  32875. },
  32876. /** @expose */
  32877. invert : function(λ, φ) {
  32878. var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * this.cosδγ - y * this.sinδγ;
  32879. 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δφ)];
  32880. },
  32881. /** @expose */
  32882. supportInversion : function() {
  32883. return true;
  32884. }
  32885. });
  32886. com_ibm_rave_core_internal_geo_SphericalRotation.identityRotation = new com_ibm_rave_core_internal_geo_SphericalRotation.IdentityPointProjection();
  32887. // $source: com/ibm/rave/core/geo/TransformStreamListenerFactory
  32888. /************************************************************************
  32889. ** IBM Confidential
  32890. **
  32891. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  32892. **
  32893. ** (C) Copyright IBM Corp. 2017
  32894. **
  32895. ** The source code for this program is not published or otherwise divested of its trade secrets,
  32896. ** irrespective of what has been deposited with the U.S. Copyright Office.
  32897. ************************************************************************/
  32898. // GENERATED
  32899. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  32900. //@import com/ibm/rave/core/internal/geo/TransformStreamListenerImpl (static) // new
  32901. /**
  32902. * A factory used to create TransformStreamListeners
  32903. */
  32904. var com_ibm_rave_core_geo_TransformStreamListenerFactory = com_ibm_rave_core_nativeImpl_Declare({
  32905. //delegates : null,
  32906. constructor : function(delegates) {
  32907. this.delegates = delegates;
  32908. },
  32909. /**
  32910. * 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
  32911. * @param (com.ibm.rave.core.geo.StreamListener) listener the listener to wrap
  32912. * @return (com.ibm.rave.core.geo.TransformStreamListener) the newly created TransformStreamListener
  32913. */
  32914. /** @expose */
  32915. stream : function(listener) {
  32916. return new com_ibm_rave_core_internal_geo_TransformStreamListenerImpl(listener, this.delegates);
  32917. }
  32918. });
  32919. /**
  32920. * 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.
  32921. * @param (Object) delegates a map of standard stream state handlers to delegate to
  32922. * @return (com.ibm.rave.core.geo.TransformStreamListenerFactory) the newly created TransformStreamListenerFactory object
  32923. */
  32924. /** @expose */
  32925. com_ibm_rave_core_geo_TransformStreamListenerFactory.create = function(delegates) {
  32926. return new com_ibm_rave_core_geo_TransformStreamListenerFactory(delegates);
  32927. };
  32928. /**
  32929. * A convenience method to create a TransformStreamListeners that is only interested in transforming point geometry events.
  32930. * @param (com.ibm.rave.core.geo.StreamListener) listener the listener to wrap
  32931. * @param (com.ibm.rave.core.internal.geo.DelegatingStreamListener.StreamPointStateHandler) handler the point state handler
  32932. * @return (com.ibm.rave.core.geo.TransformStreamListener) the newly created TransformStreamListener
  32933. */
  32934. /** @expose */
  32935. com_ibm_rave_core_geo_TransformStreamListenerFactory.transformPoint = function(listener, handler) {
  32936. var delegates = {};
  32937. delegates["point"] = handler;
  32938. return new com_ibm_rave_core_internal_geo_TransformStreamListenerImpl(listener, delegates);
  32939. };
  32940. // $source: com/ibm/rave/core/internal/geo/ProjectionMutatorImpl
  32941. /************************************************************************
  32942. ** IBM Confidential
  32943. **
  32944. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  32945. **
  32946. ** (C) Copyright IBM Corp. 2017
  32947. **
  32948. ** The source code for this program is not published or otherwise divested of its trade secrets,
  32949. ** irrespective of what has been deposited with the U.S. Copyright Office.
  32950. ************************************************************************/
  32951. // GENERATED
  32952. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  32953. //@import com/ibm/rave/core/internal/geo/InvertibleProjectionImpl (runtime) // new
  32954. //@import com/ibm/rave/core/internal/geo/ProjectionImpl (runtime) // new
  32955. /**
  32956. */
  32957. var com_ibm_rave_core_internal_geo_ProjectionMutatorImpl = com_ibm_rave_core_nativeImpl_Declare({
  32958. //factory : null,
  32959. //projection : null,
  32960. _$functionClassMethod : function() {
  32961. var _$self = function(args) {
  32962. if (args !== null || arguments.length > 1){
  32963. args = Array.prototype.slice.call(arguments);
  32964. }
  32965. {
  32966. var projector = _$self.factory.apply(_$self.factory, args);
  32967. if (!_$self.projection) {
  32968. if (projector.invert) {
  32969. _$self.projection = new com_ibm_rave_core_internal_geo_InvertibleProjectionImpl();
  32970. } else {
  32971. _$self.projection = new com_ibm_rave_core_internal_geo_ProjectionImpl();
  32972. }
  32973. }
  32974. return com_ibm_rave_core_internal_geo_ProjectionMutatorImpl.internalMutate(_$self.projection, projector);
  32975. }
  32976. };
  32977. return _$self;
  32978. },
  32979. constructor : function(factory) {
  32980. this.factory = factory;
  32981. }
  32982. });
  32983. com_ibm_rave_core_internal_geo_ProjectionMutatorImpl.internalMutate = function(projection, projector) {
  32984. projection.pointProjector = projector;
  32985. return projection.reset();
  32986. };
  32987. com_ibm_rave_core_internal_geo_ProjectionMutatorImpl.newProjectionMutator = function(factory) {
  32988. return new com_ibm_rave_core_internal_geo_ProjectionMutatorImpl(factory);
  32989. };
  32990. // $source: com/ibm/rave/core/internal/geo/ProjectionImpl
  32991. /************************************************************************
  32992. ** IBM Confidential
  32993. **
  32994. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  32995. **
  32996. ** (C) Copyright IBM Corp. 2017
  32997. **
  32998. ** The source code for this program is not published or otherwise divested of its trade secrets,
  32999. ** irrespective of what has been deposited with the U.S. Copyright Office.
  33000. ************************************************************************/
  33001. // GENERATED
  33002. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // bind, declare
  33003. //@import com/ibm/rave/core/internal/geo/ResampleStreamListenerFactory (runtime) // new
  33004. //@import com/ibm/rave/core/internal/geo/ClipUtil (runtime) // newAntimeridianClipLineStreamListenerFactory, newClipCircleStreamListenerFactory, newClipExtentStreamListenerFactory
  33005. //@import com/ibm/rave/core/internal/geo/SphericalRotation (runtime) // compose, rotation
  33006. //@import com/ibm/rave/core/geo/TransformStreamListenerFactory (static) // transformPoint
  33007. //@import com/ibm/rave/core/internal/geo/ProjectionMutatorImpl (static) // newProjectionMutator
  33008. /**
  33009. */
  33010. var com_ibm_rave_core_internal_geo_ProjectionImpl = com_ibm_rave_core_nativeImpl_Declare({
  33011. //clipAngleValue : null,
  33012. //clipExtentValue : null,
  33013. //pointProjector : null,
  33014. //rotator : null,
  33015. //projectResample : null,
  33016. //preclip : null,
  33017. //postclip : null,
  33018. //streamListener : null,
  33019. //projectRotate : null,
  33020. x : 480, y : 250, λ : 0, φ : 0, δλ : 0, δφ : 0, δγ : 0,
  33021. k : 150, δx : 0, δy : 0,
  33022. _$functionClassMethod : function() {
  33023. var _$self = function(point) {
  33024. var p = _$self.projectRotate(point[0] * 0.017453292519943295, point[1] * 0.017453292519943295);
  33025. return [p[0] * _$self.k + _$self.δx, _$self.δy - p[1] * _$self.k];
  33026. };
  33027. return _$self;
  33028. },
  33029. constructor : function() {
  33030. var self = this;
  33031. this.projectResample = new com_ibm_rave_core_internal_geo_ResampleStreamListenerFactory(function(x, y, z) {
  33032. var result = self.pointProjector(x, y);
  33033. return [result[0] * self.k + self.δx, self.δy - result[1] * self.k];
  33034. });
  33035. this.preclip = com_ibm_rave_core_internal_geo_ClipUtil.newAntimeridianClipLineStreamListenerFactory();
  33036. },
  33037. /** @expose */
  33038. supportInversion : function() {
  33039. return false;
  33040. },
  33041. /** @expose */
  33042. supportStreaming : function() {
  33043. return true;
  33044. },
  33045. rotate$0 : function() {
  33046. return [this.δλ * 57.29577951308232, this.δφ * 57.29577951308232, this.δγ * 57.29577951308232];
  33047. },
  33048. rotate$1 : function(rotation) {
  33049. this.δλ = rotation[0] % 360 * 0.017453292519943295;
  33050. this.δφ = rotation[1] % 360 * 0.017453292519943295;
  33051. this.δγ = rotation.length > 2 ? rotation[2] % 360 * 0.017453292519943295 : 0;
  33052. return this.reset();
  33053. },
  33054. center$0 : function() {
  33055. return [this.λ * 57.29577951308232, this.φ * 57.29577951308232];
  33056. },
  33057. center$1 : function(c) {
  33058. this.λ = c[0] % 360 * 0.017453292519943295;
  33059. this.φ = c[1] % 360 * 0.017453292519943295;
  33060. return this.reset();
  33061. },
  33062. translate$0 : function() {
  33063. return [this.x, this.y];
  33064. },
  33065. translate$1 : function(t) {
  33066. this.x = + (t[0]);
  33067. this.y = + (t[1]);
  33068. return this.reset();
  33069. },
  33070. scale$0 : function() {
  33071. return this.k;
  33072. },
  33073. scale$1 : function(s) {
  33074. this.k = + (s);
  33075. return this.reset();
  33076. },
  33077. clipAngle$0 : function() {
  33078. return this.clipAngleValue;
  33079. },
  33080. clipAngle$1 : function(a) {
  33081. if (a == null) {
  33082. this.clipAngleValue = null;
  33083. this.preclip = com_ibm_rave_core_internal_geo_ClipUtil.newAntimeridianClipLineStreamListenerFactory();
  33084. } else {
  33085. this.preclip = com_ibm_rave_core_internal_geo_ClipUtil.newClipCircleStreamListenerFactory((this.clipAngleValue = + (a)) * 0.017453292519943295);
  33086. }
  33087. return this.invalidate();
  33088. },
  33089. clipExtent$0 : function() {
  33090. return this.clipExtentValue;
  33091. },
  33092. clipExtent$1 : function(e) {
  33093. this.clipExtentValue = e;
  33094. if (e) {
  33095. this.postclip = com_ibm_rave_core_internal_geo_ClipUtil.newClipExtentStreamListenerFactory(e[0][0], e[0][1], e[1][0], e[1][1]);
  33096. } else {
  33097. this.postclip = null;
  33098. }
  33099. return this.invalidate();
  33100. },
  33101. precision$0 : function() {
  33102. return this.projectResample.precision$1();
  33103. },
  33104. precision$1 : function(p) {
  33105. this.projectResample.precision$0(p);
  33106. return this;
  33107. },
  33108. /** @expose */
  33109. stream : com_ibm_rave_core_nativeImpl_Declare.bind(function(listener) {
  33110. if (this.streamListener) {
  33111. this.streamListener.valid = false;
  33112. }
  33113. this.streamListener = com_ibm_rave_core_internal_geo_ProjectionImpl.projectionRadians(this.preclip(this.rotator, this.projectResample(this.postclip ? this.postclip(listener) : listener)));
  33114. this.streamListener.valid = true;
  33115. return this.streamListener;
  33116. }),
  33117. /**
  33118. * @return (com.ibm.rave.core.geo.PointProjector) the project
  33119. */
  33120. getPointProjector : function() {
  33121. return this.pointProjector;
  33122. },
  33123. /**
  33124. * @param (com.ibm.rave.core.geo.PointProjector) project the project to set
  33125. */
  33126. setPointProjector : function(project) {
  33127. this.pointProjector = project;
  33128. },
  33129. reset : function() {
  33130. 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);
  33131. var center = this.pointProjector(this.λ, this.φ);
  33132. this.δx = this.x - center[0] * this.k;
  33133. this.δy = this.y + center[1] * this.k;
  33134. return this.invalidate();
  33135. },
  33136. invalidate : function() {
  33137. if (this.streamListener) {
  33138. this.streamListener.valid = false;
  33139. this.streamListener = null;
  33140. }
  33141. return this;
  33142. },
  33143. /** @expose */
  33144. rotate : function(a0) {
  33145. var args = arguments;
  33146. if (args.length == 0) {
  33147. return this.rotate$0();
  33148. }
  33149. return this.rotate$1(a0);
  33150. },
  33151. /** @expose */
  33152. center : function(a0) {
  33153. var args = arguments;
  33154. if (args.length == 0) {
  33155. return this.center$0();
  33156. }
  33157. return this.center$1(a0);
  33158. },
  33159. /** @expose */
  33160. translate : function(a0) {
  33161. var args = arguments;
  33162. if (args.length == 0) {
  33163. return this.translate$0();
  33164. }
  33165. return this.translate$1(a0);
  33166. },
  33167. /** @expose */
  33168. scale : function(a0) {
  33169. var args = arguments;
  33170. if (args.length == 0) {
  33171. return this.scale$0();
  33172. }
  33173. return this.scale$1(a0);
  33174. },
  33175. /** @expose */
  33176. clipAngle : function(a0) {
  33177. var args = arguments;
  33178. if (args.length == 0) {
  33179. return this.clipAngle$0();
  33180. }
  33181. return this.clipAngle$1(a0);
  33182. },
  33183. /** @expose */
  33184. clipExtent : function(a0) {
  33185. var args = arguments;
  33186. if (args.length == 0) {
  33187. return this.clipExtent$0();
  33188. }
  33189. return this.clipExtent$1(a0);
  33190. },
  33191. /** @expose */
  33192. precision : function(a0) {
  33193. var args = arguments;
  33194. if (args.length == 0) {
  33195. return this.precision$0();
  33196. }
  33197. return this.precision$1(a0);
  33198. }
  33199. });
  33200. com_ibm_rave_core_internal_geo_ProjectionImpl.projectionRadians = function(stream) {
  33201. return com_ibm_rave_core_geo_TransformStreamListenerFactory.transformPoint(stream, function(x, y, z) {
  33202. stream.point(x * 0.017453292519943295, y * 0.017453292519943295, NaN);
  33203. });
  33204. };
  33205. com_ibm_rave_core_internal_geo_ProjectionImpl.newProjection = function(projetor) {
  33206. return com_ibm_rave_core_internal_geo_ProjectionMutatorImpl.newProjectionMutator(function(args) {
  33207. if (args !== null || arguments.length > 1){
  33208. args = Array.prototype.slice.call(arguments);
  33209. }
  33210. {
  33211. return projetor;
  33212. }
  33213. })();
  33214. };
  33215. // $source: com/ibm/rave/core/internal/geo/InvertibleProjectionImpl
  33216. /************************************************************************
  33217. ** IBM Confidential
  33218. **
  33219. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  33220. **
  33221. ** (C) Copyright IBM Corp. 2017
  33222. **
  33223. ** The source code for this program is not published or otherwise divested of its trade secrets,
  33224. ** irrespective of what has been deposited with the U.S. Copyright Office.
  33225. ************************************************************************/
  33226. // GENERATED
  33227. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  33228. //@import com/ibm/rave/core/internal/geo/ProjectionImpl (loadtime) // superclass
  33229. /**
  33230. */
  33231. var com_ibm_rave_core_internal_geo_InvertibleProjectionImpl = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_ProjectionImpl, {
  33232. /** @expose */
  33233. invert : function(point) {
  33234. var p = (this.projectRotate).invert((point[0] - this.δx) / this.k, (this.δy - point[1]) / this.k);
  33235. if (p) {
  33236. return [p[0] * 57.29577951308232, p[1] * 57.29577951308232];
  33237. }
  33238. return undefined;
  33239. },
  33240. /** @expose */
  33241. supportInversion : function() {
  33242. return true;
  33243. }
  33244. });
  33245. // $source: com/ibm/rave/core/internal/geo/MercatorProjection
  33246. /************************************************************************
  33247. ** IBM Confidential
  33248. **
  33249. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  33250. **
  33251. ** (C) Copyright IBM Corp. 2017
  33252. **
  33253. ** The source code for this program is not published or otherwise divested of its trade secrets,
  33254. ** irrespective of what has been deposited with the U.S. Copyright Office.
  33255. ************************************************************************/
  33256. // GENERATED
  33257. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  33258. //@import com/ibm/rave/core/internal/geo/InvertibleProjectionImpl (loadtime) // superclass
  33259. //@import com/ibm/rave/core/internal/geo/ProjectionImpl (runtime)
  33260. /**
  33261. */
  33262. var com_ibm_rave_core_internal_geo_MercatorProjection = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_InvertibleProjectionImpl, {
  33263. clipAuto : false,
  33264. init : function() {
  33265. this.clipExtent$1(null);
  33266. },
  33267. /** @expose */
  33268. scale$1 : function(scale) {
  33269. com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.scale$1.call(this, scale);
  33270. if (this.clipAuto) {
  33271. return this.clipExtent$1(null);
  33272. }
  33273. return this;
  33274. },
  33275. translate$1 : function(translate) {
  33276. com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.translate$1.call(this, translate);
  33277. if (this.clipAuto) {
  33278. return this.clipExtent$1(null);
  33279. }
  33280. return this;
  33281. },
  33282. clipExtent$1 : function(clipExtent) {
  33283. com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.clipExtent$1.call(this, clipExtent);
  33284. if (this.clipAuto = !clipExtent) {
  33285. var k = 3.141592653589793 * com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.scale$0.call(this);
  33286. var t = com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.translate$0.call(this);
  33287. com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.clipExtent$1.call(this, [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]]);
  33288. }
  33289. return this;
  33290. },
  33291. clipExtent$0 : function() {
  33292. if (this.clipAuto) {
  33293. return null;
  33294. }
  33295. return com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.clipExtent$0.call(this);
  33296. },
  33297. /** @expose */
  33298. clipExtent : function(a0) {
  33299. var args = arguments;
  33300. if (args.length == 0) {
  33301. return this.clipExtent$0();
  33302. }
  33303. return this.clipExtent$1(a0);
  33304. }
  33305. /**
  33306. * @param pointProjector
  33307. * @param projection
  33308. */
  33309. //constructor : function() {}
  33310. });
  33311. // $source: com/ibm/rave/core/internal/geo/TransverseMercatorProjectionFactory
  33312. /************************************************************************
  33313. ** IBM Confidential
  33314. **
  33315. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  33316. **
  33317. ** (C) Copyright IBM Corp. 2017
  33318. **
  33319. ** The source code for this program is not published or otherwise divested of its trade secrets,
  33320. ** irrespective of what has been deposited with the U.S. Copyright Office.
  33321. ************************************************************************/
  33322. // GENERATED
  33323. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, declare anonymous
  33324. //@import com/ibm/rave/core/geo/InvertiblePointProjector (runtime)
  33325. //@import com/ibm/rave/core/internal/geo/TransverseMercatorProjection (runtime) // new
  33326. //@import com/ibm/rave/core/internal/geo/ProjectionMutatorImpl (runtime) // internalMutate
  33327. /**
  33328. */
  33329. var com_ibm_rave_core_internal_geo_TransverseMercatorProjectionFactory = com_ibm_rave_core_nativeImpl_Declare({
  33330. /**
  33331. * @expose
  33332. */
  33333. raw : null,
  33334. _$functionClassMethod : function() {
  33335. var _$self = function() {
  33336. var m = new com_ibm_rave_core_internal_geo_TransverseMercatorProjection();
  33337. com_ibm_rave_core_internal_geo_ProjectionMutatorImpl.internalMutate(m, _$self.raw);
  33338. m.init();
  33339. return m;
  33340. };
  33341. return _$self;
  33342. },
  33343. constructor : function() {
  33344. this.raw = new (com_ibm_rave_core_nativeImpl_Declare({
  33345. _$functionClassMethod : function() {
  33346. var _$self = function(λ, φ) {
  33347. return [Math.log(Math.tan(3.141592653589793 / 4 + φ / 2)), -λ];
  33348. };
  33349. return _$self;
  33350. },
  33351. supportInversion : function() {
  33352. return true;
  33353. },
  33354. invert : function(x, y) {
  33355. return [-y, 2 * Math.atan(Math.exp(x)) - 1.5707963267948966];
  33356. }
  33357. }))();
  33358. },
  33359. /** @expose */
  33360. getRaw : function() {
  33361. return this.raw;
  33362. }
  33363. /**
  33364. */
  33365. //constructor : function() {}
  33366. });
  33367. com_ibm_rave_core_internal_geo_TransverseMercatorProjectionFactory.INSTANCE = new com_ibm_rave_core_internal_geo_TransverseMercatorProjectionFactory();
  33368. // $source: com/ibm/rave/core/internal/geo/TransverseMercatorProjection
  33369. /************************************************************************
  33370. ** IBM Confidential
  33371. **
  33372. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  33373. **
  33374. ** (C) Copyright IBM Corp. 2017
  33375. **
  33376. ** The source code for this program is not published or otherwise divested of its trade secrets,
  33377. ** irrespective of what has been deposited with the U.S. Copyright Office.
  33378. ************************************************************************/
  33379. // GENERATED
  33380. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  33381. //@import com/ibm/rave/core/internal/geo/MercatorProjection (loadtime) // superclass
  33382. //@import com/ibm/rave/core/internal/geo/ProjectionImpl (runtime)
  33383. /**
  33384. */
  33385. var com_ibm_rave_core_internal_geo_TransverseMercatorProjection = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_MercatorProjection, {
  33386. init : function() {
  33387. com_ibm_rave_core_internal_geo_MercatorProjection.prototype.init.call(this);
  33388. com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.rotate$1.call(this, [0.0, 0.0, 90.0]);
  33389. },
  33390. rotate$0 : function() {
  33391. var r = com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.rotate$0.call(this);
  33392. return [r[0], r[1], r[2] - 90];
  33393. },
  33394. rotate$1 : function(r) {
  33395. return com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.rotate$1.call(this, [r[0], r[1], r.length > 2 ? r[2] + 90 : 90]);
  33396. },
  33397. center$0 : function() {
  33398. var c = com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.center$0.call(this);
  33399. return [c[1], -c[0]];
  33400. },
  33401. center$1 : function(c) {
  33402. return com_ibm_rave_core_internal_geo_ProjectionImpl.prototype.center$1.call(this, [-c[1], c[0]]);
  33403. },
  33404. /** @expose */
  33405. rotate : function(a0) {
  33406. var args = arguments;
  33407. if (args.length == 0) {
  33408. return this.rotate$0();
  33409. }
  33410. return this.rotate$1(a0);
  33411. },
  33412. /** @expose */
  33413. center : function(a0) {
  33414. var args = arguments;
  33415. if (args.length == 0) {
  33416. return this.center$0();
  33417. }
  33418. return this.center$1(a0);
  33419. }
  33420. /**
  33421. * @param rawPointProjector
  33422. */
  33423. //constructor : function() {}
  33424. });
  33425. // $source: com/ibm/rave/core/internal/geo/PlaneProjectionFactoryImpl
  33426. /************************************************************************
  33427. ** IBM Confidential
  33428. **
  33429. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  33430. **
  33431. ** (C) Copyright IBM Corp. 2017
  33432. **
  33433. ** The source code for this program is not published or otherwise divested of its trade secrets,
  33434. ** irrespective of what has been deposited with the U.S. Copyright Office.
  33435. ************************************************************************/
  33436. // GENERATED
  33437. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, declare anonymous
  33438. //@import com/ibm/rave/core/internal/geo/InvertibleProjectionImpl (runtime) // new
  33439. //@import com/ibm/rave/core/internal/geo/ProjectionMutatorImpl (runtime) // internalMutate
  33440. //@import com/ibm/rave/core/internal/geo/AzimuthalPointProjectorFactory (runtime) // AzimuthalPointProjectorFactory
  33441. //@import com/ibm/rave/core/geo/InvertiblePointProjector (runtime)
  33442. //@import com/ibm/rave/core/internal/math/Trigonometry (runtime) // acos, sinci
  33443. /**
  33444. */
  33445. var com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl = com_ibm_rave_core_nativeImpl_Declare({
  33446. /**
  33447. * @expose
  33448. */
  33449. raw : null,
  33450. _$functionClassMethod : function() {
  33451. var _$self = function() {
  33452. var projection = new com_ibm_rave_core_internal_geo_InvertibleProjectionImpl();
  33453. com_ibm_rave_core_internal_geo_ProjectionMutatorImpl.internalMutate(projection, _$self.raw);
  33454. return projection;
  33455. };
  33456. return _$self;
  33457. },
  33458. /**
  33459. */
  33460. constructor : function(projector) {
  33461. this.raw = projector;
  33462. },
  33463. /** @expose */
  33464. getRaw : function() {
  33465. return this.raw;
  33466. }
  33467. });
  33468. com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newAzimuthalEqualAreaProjectionFactory = function() {
  33469. var projector = com_ibm_rave_core_internal_geo_AzimuthalPointProjectorFactory.INSTANCE(function(x) {
  33470. return Math.sqrt(2 / (1 + x));
  33471. }, function(x) {
  33472. return 2 * Math.asin(x / 2);
  33473. });
  33474. return new com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl(projector);
  33475. };
  33476. com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newAzimuthalEquidistantProjectionFactory = function() {
  33477. var projector = com_ibm_rave_core_internal_geo_AzimuthalPointProjectorFactory.INSTANCE(function(x) {
  33478. var c = Math.acos(x);
  33479. return (c) ? c / Math.sin(c) : c;
  33480. }, function(x) {
  33481. return x;
  33482. });
  33483. return new com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl(projector);
  33484. };
  33485. com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newEquirectangularProjectionFactory = function() {
  33486. var projector = new (com_ibm_rave_core_nativeImpl_Declare({
  33487. _$functionClassMethod : function() {
  33488. var _$self = function(λ, φ) {
  33489. return [λ, φ];
  33490. };
  33491. return _$self;
  33492. },
  33493. supportInversion : function() {
  33494. return true;
  33495. },
  33496. invert : function(x, y) {
  33497. return [x, y];
  33498. }
  33499. }))();
  33500. return new com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl(projector);
  33501. };
  33502. com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newGnomonicProjectionFactory = function() {
  33503. var projector = com_ibm_rave_core_internal_geo_AzimuthalPointProjectorFactory.INSTANCE(function(x) {
  33504. return 1 / x;
  33505. }, function(x) {
  33506. return Math.atan(x);
  33507. });
  33508. return new com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl(projector);
  33509. };
  33510. com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newOrthographicProjectionFactory = function() {
  33511. var projector = com_ibm_rave_core_internal_geo_AzimuthalPointProjectorFactory.INSTANCE(function(x) {
  33512. return 1;
  33513. }, function(x) {
  33514. return Math.asin(x);
  33515. });
  33516. return new com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl(projector);
  33517. };
  33518. com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newStereographicProjectionFactory = function() {
  33519. var projector = com_ibm_rave_core_internal_geo_AzimuthalPointProjectorFactory.INSTANCE(function(x) {
  33520. return 1 / (1 + x);
  33521. }, function(x) {
  33522. return 2 * Math.atan(x);
  33523. });
  33524. return new com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl(projector);
  33525. };
  33526. com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newWinkelTripelProjectionFactory = function() {
  33527. var projector = new (com_ibm_rave_core_nativeImpl_Declare({
  33528. _$functionClassMethod : function() {
  33529. var _$self = function(λ, φ) {
  33530. var λ2 = λ / 2;
  33531. 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)));
  33532. var a = 2 * cosφ * Math.sin(λ2) * sincia;
  33533. var b = Math.sin(φ) * sincia;
  33534. return [(a + λ / 1.5707963267948966) / 2, (b + φ) / 2];
  33535. };
  33536. return _$self;
  33537. },
  33538. supportInversion : function() {
  33539. return true;
  33540. },
  33541. invert : function(x, y) {
  33542. var i = 25;
  33543. var λ = x, φ = y, δλ, δφ;
  33544. do {
  33545. δλ = δφ = 0;
  33546. 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);
  33547. 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δλ;
  33548. δλ = (fy * δxδφ - fx * δyδφ) / denominator;
  33549. δφ = (fx * δyδλ - fy * δxδλ) / denominator;
  33550. λ -= δλ;
  33551. φ -= δφ;
  33552. } while ((Math.abs(δλ) > 1.0E-6 || Math.abs(δφ) > 1.0E-6) && --i > 0);
  33553. return [λ, φ];
  33554. }
  33555. }))();
  33556. return new com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl(projector);
  33557. };
  33558. // $source: com/ibm/rave/core/internal/geo/AzimuthalPointProjectorFactory
  33559. /************************************************************************
  33560. ** IBM Confidential
  33561. **
  33562. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  33563. **
  33564. ** (C) Copyright IBM Corp. 2017
  33565. **
  33566. ** The source code for this program is not published or otherwise divested of its trade secrets,
  33567. ** irrespective of what has been deposited with the U.S. Copyright Office.
  33568. ************************************************************************/
  33569. // GENERATED
  33570. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, declare anonymous
  33571. //@import com/ibm/rave/core/geo/InvertiblePointProjector (runtime)
  33572. /**
  33573. */
  33574. var com_ibm_rave_core_internal_geo_AzimuthalPointProjectorFactory = com_ibm_rave_core_nativeImpl_Declare({
  33575. _$functionClassMethod : function() {
  33576. var _$self = function(args) {
  33577. if (args !== null || arguments.length > 1){
  33578. args = Array.prototype.slice.call(arguments);
  33579. }
  33580. {
  33581. var scale = args[0];
  33582. var angle = args[1];
  33583. return new (com_ibm_rave_core_nativeImpl_Declare({
  33584. _$functionClassMethod : function() {
  33585. var _$self = function(λ, φ) {
  33586. var cosλ = Math.cos(λ), cosφ = Math.cos(φ), k = scale(cosλ * cosφ);
  33587. return [k * cosφ * Math.sin(λ), k * Math.sin(φ)];
  33588. };
  33589. return _$self;
  33590. },
  33591. supportInversion : function() {
  33592. return true;
  33593. },
  33594. invert : function(x, y) {
  33595. var ρ = Math.sqrt(x * x + y * y), c = angle(ρ), sinc = Math.sin(c), cosc = Math.cos(c);
  33596. return [Math.atan2(x * sinc, ρ * cosc), Math.asin((ρ) ? y * sinc / ρ : ρ)];
  33597. }
  33598. }))();
  33599. }
  33600. };
  33601. return _$self;
  33602. }
  33603. //constructor : function() {}
  33604. });
  33605. com_ibm_rave_core_internal_geo_AzimuthalPointProjectorFactory.INSTANCE = new com_ibm_rave_core_internal_geo_AzimuthalPointProjectorFactory();
  33606. // $source: com/ibm/rave/core/internal/geo/ConicProjectionFactoryImpl
  33607. /************************************************************************
  33608. ** IBM Confidential
  33609. **
  33610. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  33611. **
  33612. ** (C) Copyright IBM Corp. 2017
  33613. **
  33614. ** The source code for this program is not published or otherwise divested of its trade secrets,
  33615. ** irrespective of what has been deposited with the U.S. Copyright Office.
  33616. ************************************************************************/
  33617. // GENERATED
  33618. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, declare anonymous
  33619. //@import com/ibm/rave/core/internal/geo/ConicProjectionImpl (runtime) // new
  33620. //@import com/ibm/rave/core/geo/InvertiblePointProjector (runtime)
  33621. //@import com/ibm/rave/core/internal/math/Trigonometry (runtime) // asin, sgn
  33622. //@import com/ibm/rave/core/internal/geo/MercatorPlaneProjectionFactory (runtime) // MercatorPlaneProjectionFactory
  33623. /**
  33624. */
  33625. var com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl = com_ibm_rave_core_nativeImpl_Declare({
  33626. /**
  33627. * @expose
  33628. */
  33629. raw : null,
  33630. _$functionClassMethod : function() {
  33631. var _$self = function() {
  33632. return new com_ibm_rave_core_internal_geo_ConicProjectionImpl(_$self.raw);
  33633. };
  33634. return _$self;
  33635. },
  33636. /**
  33637. */
  33638. constructor : function(factory) {
  33639. this.raw = factory;
  33640. },
  33641. /** @expose */
  33642. getRaw : function() {
  33643. return this.raw;
  33644. }
  33645. });
  33646. com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl.newConicEqualAreaProjectionFactory = function() {
  33647. var factory = function(args) {
  33648. if (args !== null || arguments.length > 1){
  33649. args = Array.prototype.slice.call(arguments);
  33650. }
  33651. {
  33652. var φ0 = (args[0]);
  33653. var φ1 = (args[1]);
  33654. 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;
  33655. return new (com_ibm_rave_core_nativeImpl_Declare({
  33656. _$functionClassMethod : function() {
  33657. var _$self = function(λ, φ) {
  33658. var _λ = λ;
  33659. var ρ = Math.sqrt(C - 2 * n * Math.sin(φ)) / n;
  33660. return [ρ * Math.sin(_λ *= n), ρ0 - ρ * Math.cos(_λ)];
  33661. };
  33662. return _$self;
  33663. },
  33664. supportInversion : function() {
  33665. return true;
  33666. },
  33667. invert : function(x, y) {
  33668. var ρ0_y = ρ0 - y;
  33669. 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))];
  33670. }
  33671. }))();
  33672. }
  33673. };
  33674. return new com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl(factory);
  33675. };
  33676. com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl.newConicEquidistantProjectionFactory = function() {
  33677. var factory = function(args) {
  33678. if (args !== null || arguments.length > 1){
  33679. args = Array.prototype.slice.call(arguments);
  33680. }
  33681. {
  33682. var φ0 = + (args[0]);
  33683. var φ1 = + (args[1]);
  33684. var cosφ0 = Math.cos(φ0), n = φ0 == φ1 ? Math.sin(φ0) : (cosφ0 - Math.cos(φ1)) / (φ1 - φ0), G = cosφ0 / n + φ0;
  33685. if (Math.abs(n) < 1.0E-6) {
  33686. return new (com_ibm_rave_core_nativeImpl_Declare({
  33687. _$functionClassMethod : function() {
  33688. var _$self = function(λ, φ) {
  33689. return [λ, φ];
  33690. };
  33691. return _$self;
  33692. },
  33693. supportInversion : function() {
  33694. return true;
  33695. },
  33696. invert : function(x, y) {
  33697. return [x, y];
  33698. }
  33699. }))();
  33700. }
  33701. return new (com_ibm_rave_core_nativeImpl_Declare({
  33702. _$functionClassMethod : function() {
  33703. var _$self = function(λ, φ) {
  33704. var ρ = G - φ;
  33705. return [ρ * Math.sin(n * λ), G - ρ * Math.cos(n * λ)];
  33706. };
  33707. return _$self;
  33708. },
  33709. supportInversion : function() {
  33710. return true;
  33711. },
  33712. invert : function(x, y) {
  33713. var ρ0_y = G - y;
  33714. 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)];
  33715. }
  33716. }))();
  33717. }
  33718. };
  33719. return new com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl(factory);
  33720. };
  33721. com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl.newConicConformalProjectionFactory = function() {
  33722. var factory = function(args) {
  33723. if (args !== null || arguments.length > 1){
  33724. args = Array.prototype.slice.call(arguments);
  33725. }
  33726. {
  33727. var φ0 = + (args[0]);
  33728. var φ1 = + (args[1]);
  33729. 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;
  33730. if (!((n))) {
  33731. return com_ibm_rave_core_internal_geo_MercatorPlaneProjectionFactory.INSTANCE.raw;
  33732. }
  33733. return new (com_ibm_rave_core_nativeImpl_Declare({
  33734. _$functionClassMethod : function() {
  33735. var _$self = function(λ, φ) {
  33736. var _φ = φ;
  33737. if (F > 0) {
  33738. if (_φ < -1.5707963267948966 + 1.0E-6) {
  33739. _φ = -1.5707963267948966 + 1.0E-6;
  33740. }
  33741. } else {
  33742. if (_φ > 1.5707963267948966 - 1.0E-6) {
  33743. _φ = 1.5707963267948966 - 1.0E-6;
  33744. }
  33745. }
  33746. var ρ = F / Math.pow(Math.tan(3.141592653589793 / 4 + _φ / 2), n);
  33747. return [ρ * Math.sin(n * λ), F - ρ * Math.cos(n * λ)];
  33748. };
  33749. return _$self;
  33750. },
  33751. supportInversion : function() {
  33752. return true;
  33753. },
  33754. invert : function(x, y) {
  33755. var ρ0_y = F - y, ρ = com_ibm_rave_core_internal_math_Trigonometry.sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y);
  33756. return [Math.atan2(x, ρ0_y) / n, 2 * Math.atan(Math.pow(F / ρ, 1 / n)) - 1.5707963267948966];
  33757. }
  33758. }))();
  33759. }
  33760. };
  33761. return new com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl(factory);
  33762. };
  33763. // $source: com/ibm/rave/core/internal/geo/ConicProjectionImpl
  33764. /************************************************************************
  33765. ** IBM Confidential
  33766. **
  33767. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  33768. **
  33769. ** (C) Copyright IBM Corp. 2017
  33770. **
  33771. ** The source code for this program is not published or otherwise divested of its trade secrets,
  33772. ** irrespective of what has been deposited with the U.S. Copyright Office.
  33773. ************************************************************************/
  33774. // GENERATED
  33775. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  33776. //@import com/ibm/rave/core/internal/geo/InvertibleProjectionImpl (loadtime) // superclass
  33777. //@import com/ibm/rave/core/internal/geo/ProjectionMutatorImpl (runtime) // internalMutate
  33778. /**
  33779. */
  33780. var com_ibm_rave_core_internal_geo_ConicProjectionImpl = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_InvertibleProjectionImpl, {
  33781. //rawPointProjectorFactory : null,
  33782. φ0 : 0, φ1 : 0,
  33783. /**
  33784. */
  33785. constructor : function(rawPointProjectorFactory) {
  33786. this.φ0 = 0;
  33787. this.φ1 = 3.141592653589793 / 3;
  33788. this.rawPointProjectorFactory = rawPointProjectorFactory;
  33789. var projector = rawPointProjectorFactory(this.φ0, this.φ1);
  33790. com_ibm_rave_core_internal_geo_ProjectionMutatorImpl.internalMutate(this, projector);
  33791. },
  33792. parallels$0 : function() {
  33793. return [this.φ0 / 3.141592653589793 * 180, this.φ1 / 3.141592653589793 * 180];
  33794. },
  33795. parallels$1 : function(p) {
  33796. var projector = this.rawPointProjectorFactory(this.φ0 = p[0] * 3.141592653589793 / 180, this.φ1 = p[1] * 3.141592653589793 / 180);
  33797. com_ibm_rave_core_internal_geo_ProjectionMutatorImpl.internalMutate(this, projector);
  33798. return this;
  33799. },
  33800. /** @expose */
  33801. parallels : function(a0) {
  33802. var args = arguments;
  33803. if (args.length == 0) {
  33804. return this.parallels$0();
  33805. }
  33806. return this.parallels$1(a0);
  33807. }
  33808. });
  33809. // $source: com/ibm/rave/core/internal/geo/Stream
  33810. /************************************************************************
  33811. ** IBM Confidential
  33812. **
  33813. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  33814. **
  33815. ** (C) Copyright IBM Corp. 2017
  33816. **
  33817. ** The source code for this program is not published or otherwise divested of its trade secrets,
  33818. ** irrespective of what has been deposited with the U.S. Copyright Office.
  33819. ************************************************************************/
  33820. // GENERATED
  33821. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  33822. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (runtime) // create
  33823. /**
  33824. * 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.
  33825. */
  33826. var com_ibm_rave_core_internal_geo_Stream = com_ibm_rave_core_nativeImpl_Declare({
  33827. /**
  33828. * 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.
  33829. * @param (Object) json the JSON object to read and stream. If null, then no streaming will occur
  33830. * @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
  33831. * @see (com.ibm.rave.core.geo.StreamListener) StreamListener
  33832. */
  33833. stream : function(json, listener) {
  33834. if (json && listener) {
  33835. var handler = com_ibm_rave_core_internal_geo_Stream.handlers.get(json["type"]);
  33836. if (handler) {
  33837. handler(json, listener);
  33838. }
  33839. }
  33840. }
  33841. //constructor : function() {}
  33842. });
  33843. com_ibm_rave_core_internal_geo_Stream.createAndInit = function() {
  33844. var _handlers = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  33845. _handlers.set("FeatureCollection", function(featureCollection, listener) {
  33846. var features = featureCollection["features"];
  33847. if (features) {
  33848. for (var i = 0, n = features.length; i < n; ++i) {
  33849. var feature = features[i];
  33850. if (feature) {
  33851. var geometry = feature["geometry"];
  33852. if (geometry) {
  33853. var handler = com_ibm_rave_core_internal_geo_Stream.handlers.get(geometry["type"]);
  33854. if (handler) {
  33855. handler(geometry, listener);
  33856. }
  33857. }
  33858. }
  33859. }
  33860. }
  33861. });
  33862. _handlers.set("Feature", function(feature, listener) {
  33863. var geometry = feature["geometry"];
  33864. if (geometry) {
  33865. var handler = com_ibm_rave_core_internal_geo_Stream.handlers.get(geometry["type"]);
  33866. if (handler) {
  33867. handler(geometry, listener);
  33868. }
  33869. }
  33870. });
  33871. _handlers.set("Sphere", function(json, listener) {
  33872. listener.sphere();
  33873. });
  33874. _handlers.set("Point", function(json, listener) {
  33875. var coordinates = json["coordinates"];
  33876. if (coordinates) {
  33877. if (coordinates.length == 2) {
  33878. listener.point(+ (coordinates[0]), + (coordinates[1]), NaN);
  33879. } else if (coordinates.length == 3) {
  33880. listener.point(+ (coordinates[0]), + (coordinates[1]), + (coordinates[2]));
  33881. }
  33882. }
  33883. });
  33884. _handlers.set("MultiPoint", function(json, listener) {
  33885. var coordinatesList = json["coordinates"];
  33886. if (coordinatesList) {
  33887. var n = coordinatesList.length;
  33888. var i = -1;
  33889. while (++i < n) {
  33890. var coordinates = coordinatesList[i];
  33891. if (coordinates) {
  33892. if (coordinates.length == 2) {
  33893. listener.point(+ (coordinates[0]), + (coordinates[1]), NaN);
  33894. } else if (coordinates.length == 3) {
  33895. listener.point(+ (coordinates[0]), + (coordinates[1]), + (coordinates[2]));
  33896. }
  33897. }
  33898. }
  33899. }
  33900. });
  33901. _handlers.set("LineString", function(json, listener) {
  33902. var coordinatesList = json["coordinates"];
  33903. if (coordinatesList) {
  33904. com_ibm_rave_core_internal_geo_Stream.streamLine(coordinatesList, listener, 0);
  33905. }
  33906. });
  33907. _handlers.set("MultiLineString", function(json, listener) {
  33908. var coordinatesList = json["coordinates"];
  33909. if (coordinatesList) {
  33910. var n = coordinatesList.length;
  33911. var i = -1;
  33912. while (++i < n) {
  33913. var coordinates = coordinatesList[i];
  33914. if (coordinates) {
  33915. com_ibm_rave_core_internal_geo_Stream.streamLine(coordinates, listener, 0);
  33916. }
  33917. }
  33918. }
  33919. });
  33920. _handlers.set("Polygon", function(json, listener) {
  33921. var coordinatesList = json["coordinates"];
  33922. if (coordinatesList) {
  33923. com_ibm_rave_core_internal_geo_Stream.streamPolygon(coordinatesList, listener);
  33924. }
  33925. });
  33926. _handlers.set("MultiPolygon", function(json, listener) {
  33927. var coordinatesList = json["coordinates"];
  33928. if (coordinatesList) {
  33929. var n = coordinatesList.length;
  33930. var i = -1;
  33931. while (++i < n) {
  33932. var coordinates = coordinatesList[i];
  33933. if (coordinates) {
  33934. com_ibm_rave_core_internal_geo_Stream.streamPolygon(coordinates, listener);
  33935. }
  33936. }
  33937. }
  33938. });
  33939. _handlers.set("GeometryCollection", function(json, listener) {
  33940. var geometries = json["geometries"];
  33941. if (geometries) {
  33942. var i = -1, n = geometries.length;
  33943. while (++i < n) {
  33944. var geometry = geometries[i];
  33945. if (geometry) {
  33946. var handler = com_ibm_rave_core_internal_geo_Stream.handlers.get(geometry["type"]);
  33947. if (handler) {
  33948. handler(geometry, listener);
  33949. }
  33950. }
  33951. }
  33952. }
  33953. });
  33954. return _handlers;
  33955. };
  33956. com_ibm_rave_core_internal_geo_Stream.streamLine = function(coordinatesList, listener, closed) {
  33957. var i = -1;
  33958. var n = coordinatesList.length - closed;
  33959. listener.lineStart();
  33960. while (++i < n) {
  33961. var coordinates = coordinatesList[i];
  33962. if (coordinates) {
  33963. if (coordinates.length == 2) {
  33964. listener.point(+ (coordinates[0]), + (coordinates[1]), NaN);
  33965. } else if (coordinates.length == 3) {
  33966. listener.point(+ (coordinates[0]), + (coordinates[1]), + (coordinates[2]));
  33967. }
  33968. }
  33969. }
  33970. listener.lineEnd();
  33971. };
  33972. com_ibm_rave_core_internal_geo_Stream.streamPolygon = function(coordinatesList, listener) {
  33973. var i = -1;
  33974. var n = coordinatesList.length;
  33975. listener.polygonStart();
  33976. while (++i < n) {
  33977. var coordList = coordinatesList[i];
  33978. if (coordList) {
  33979. com_ibm_rave_core_internal_geo_Stream.streamLine(coordList, listener, 1);
  33980. }
  33981. }
  33982. listener.polygonEnd();
  33983. };
  33984. /**
  33985. * The singleton instance
  33986. */
  33987. com_ibm_rave_core_internal_geo_Stream.INSTANCE = new com_ibm_rave_core_internal_geo_Stream();
  33988. com_ibm_rave_core_internal_geo_Stream.handlers = com_ibm_rave_core_internal_geo_Stream.createAndInit();
  33989. // $source: com/ibm/rave/core/internal/geo/SphericalArea
  33990. /************************************************************************
  33991. ** IBM Confidential
  33992. **
  33993. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  33994. **
  33995. ** (C) Copyright IBM Corp. 2017
  33996. **
  33997. ** The source code for this program is not published or otherwise divested of its trade secrets,
  33998. ** irrespective of what has been deposited with the U.S. Copyright Office.
  33999. ************************************************************************/
  34000. // GENERATED
  34001. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  34002. //@import com/ibm/rave/core/internal/math/Adder (runtime) // new
  34003. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (runtime) // new
  34004. //@import com/ibm/rave/core/geo/Geo (runtime) // Geo
  34005. /**
  34006. */
  34007. var com_ibm_rave_core_internal_geo_SphericalArea = com_ibm_rave_core_nativeImpl_Declare({
  34008. //areaRingSum : null,
  34009. //areaStreamListener : null,
  34010. //sphere : null,
  34011. //polygonStart : null,
  34012. //polygonEnd : null,
  34013. //point : null,
  34014. //nextPoint : null,
  34015. //lineEnd : null,
  34016. //areaRingStart : null,
  34017. λ00 : 0, φ00 : 0, λ0 : 0, cosφ0 : 0, sinφ0 : 0,
  34018. areaSum : 0,
  34019. constructor : function() {
  34020. this.areaRingSum = new com_ibm_rave_core_internal_math_Adder();
  34021. this.areaStreamListener = new com_ibm_rave_core_internal_geo_DelegatingStreamListener();
  34022. /**
  34023. */
  34024. {
  34025. var self = this;
  34026. this.sphere = function() {
  34027. self.areaSum += 4 * 3.141592653589793;
  34028. };
  34029. this.polygonStart = function() {
  34030. self.areaRingSum.reset();
  34031. self.areaStreamListener.lineStartDelegate = self.areaRingStart;
  34032. };
  34033. this.polygonEnd = function() {
  34034. var area = 2 * self.areaRingSum.valueOf();
  34035. self.areaSum += (area < 0) ? 4 * 3.141592653589793 + area : area;
  34036. self.areaStreamListener.lineStartDelegate = null;
  34037. self.areaStreamListener.lineEndDelegate = null;
  34038. self.areaStreamListener.pointDelegate = null;
  34039. };
  34040. this.point = function(λ, φ, z) {
  34041. var _φ = φ;
  34042. self.λ0 = (self.λ00 = λ) * 0.017453292519943295;
  34043. self.cosφ0 = Math.cos(_φ = (self.φ00 = _φ) * 0.017453292519943295 / 2 + 3.141592653589793 / 4);
  34044. self.sinφ0 = Math.sin(_φ);
  34045. self.areaStreamListener.pointDelegate = self.nextPoint;
  34046. };
  34047. this.nextPoint = function(λ, φ, z) {
  34048. var _λ = λ * 0.017453292519943295;
  34049. var _φ = φ * 0.017453292519943295 / 2 + 3.141592653589793 / 4;
  34050. var dλ = _λ - self.λ0;
  34051. var sdλ = (dλ >= 0) ? 1 : -1;
  34052. var adλ = sdλ * dλ;
  34053. var cosφ = Math.cos(_φ);
  34054. var sinφ = Math.sin(_φ);
  34055. var k = self.sinφ0 * sinφ;
  34056. var u = self.cosφ0 * cosφ + k * Math.cos(adλ);
  34057. var v = k * sdλ * Math.sin(adλ);
  34058. self.areaRingSum.add(Math.atan2(v, u));
  34059. self.λ0 = _λ;
  34060. self.cosφ0 = cosφ;
  34061. self.sinφ0 = sinφ;
  34062. };
  34063. this.lineEnd = function() {
  34064. self.nextPoint(self.λ00, self.φ00, NaN);
  34065. };
  34066. this.areaRingStart = function() {
  34067. self.λ00 = self.φ00 = self.λ0 = self.cosφ0 = self.sinφ0 = 0;
  34068. self.areaStreamListener.pointDelegate = self.point;
  34069. self.areaStreamListener.lineEndDelegate = self.lineEnd;
  34070. };
  34071. this.areaStreamListener.sphereDelegate = this.sphere;
  34072. this.areaStreamListener.polygonStartDelegate = this.polygonStart;
  34073. this.areaStreamListener.polygonEndDelegate = this.polygonEnd;
  34074. }
  34075. },
  34076. /**
  34077. * Getter method for the Adder object used by this SphericalArea object
  34078. * @return (com.ibm.rave.core.internal.math.Adder) the Adder
  34079. */
  34080. getAreaRingSum : function() {
  34081. return this.areaRingSum;
  34082. },
  34083. /**
  34084. * Getter method for the stream listener object used by this SphericalArea object
  34085. * @return (com.ibm.rave.core.geo.StreamListener) the stream listener
  34086. */
  34087. getAreaStreamListener : function() {
  34088. return this.areaStreamListener;
  34089. },
  34090. /**
  34091. * Returns the spherical area of the specified feature in steradians. See also path.area, which computes the projected area on the Cartesian plane
  34092. * @param (Object) json the JSON object containing the feature whose area is computed
  34093. * @return (double) the area is steradians (The unit of solid angle)
  34094. */
  34095. calculateArea : function(json) {
  34096. this.areaSum = 0;
  34097. com_ibm_rave_core_geo_Geo.INSTANCE.stream(json, this.areaStreamListener);
  34098. return this.areaSum;
  34099. }
  34100. });
  34101. // $source: com/ibm/rave/core/internal/geo/SphericalBounds
  34102. /************************************************************************
  34103. ** IBM Confidential
  34104. **
  34105. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  34106. **
  34107. ** (C) Copyright IBM Corp. 2017
  34108. **
  34109. ** The source code for this program is not published or otherwise divested of its trade secrets,
  34110. ** irrespective of what has been deposited with the U.S. Copyright Office.
  34111. ************************************************************************/
  34112. // GENERATED
  34113. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  34114. //@import com/ibm/rave/core/internal/geo/SphericalArea (runtime) // new
  34115. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (runtime) // new
  34116. //@import com/ibm/rave/core/geo/Geo (runtime) // Geo
  34117. //@import com/ibm/rave/core/internal/geo/CartesianUtil (runtime) // cartesianNormalize, cartesianCross, cartesian
  34118. //@import com/ibm/rave/core/internal/geo/SphericalUtil (runtime) // spherical
  34119. /**
  34120. */
  34121. var com_ibm_rave_core_internal_geo_SphericalBounds = com_ibm_rave_core_nativeImpl_Declare({
  34122. //p0 : null,
  34123. //range : null,
  34124. //ranges : null,
  34125. //sphericalArea : null,
  34126. //areaStreamListener : null,
  34127. //boundsStreamListener : null,
  34128. //rangeComparator : null,
  34129. //point : null,
  34130. //linePoint : null,
  34131. //lineStart : null,
  34132. //lineEnd : null,
  34133. //ringPoint : null,
  34134. //ringStart : null,
  34135. //ringEnd : null,
  34136. //polygonStart : null,
  34137. //polygonEnd : null,
  34138. λ0 : 0, φ0 : 0, λ1 : 0, φ1 : 0, λ_ : 0, λ__ : 0, φ__ : 0, dλSum : 0,
  34139. constructor : function() {
  34140. this.sphericalArea = new com_ibm_rave_core_internal_geo_SphericalArea();
  34141. this.areaStreamListener = this.sphericalArea.areaStreamListener;
  34142. this.boundsStreamListener = new com_ibm_rave_core_internal_geo_DelegatingStreamListener();
  34143. this.rangeComparator = function(a, b) {
  34144. var diff = a[0] - b[0];
  34145. if (diff > 0) {
  34146. return 1;
  34147. }
  34148. if (diff < 0) {
  34149. return -1;
  34150. }
  34151. return 0;
  34152. };
  34153. {
  34154. var self = this;
  34155. this.point = function(λ, φ, z) {
  34156. self.range = [self.λ0 = λ, self.λ1 = λ];
  34157. self.ranges.push(self.range);
  34158. if (φ < self.φ0) {
  34159. self.φ0 = φ;
  34160. }
  34161. if (φ > self.φ1) {
  34162. self.φ1 = φ;
  34163. }
  34164. };
  34165. this.linePoint = function(λ, φ, z) {
  34166. var p = com_ibm_rave_core_internal_geo_CartesianUtil.cartesian([λ * 0.017453292519943295, φ * 0.017453292519943295]);
  34167. if (self.p0) {
  34168. var normal = com_ibm_rave_core_internal_geo_CartesianUtil.cartesianCross(self.p0, p);
  34169. var equatorial = [normal[1], -normal[0], 0];
  34170. var inflection = com_ibm_rave_core_internal_geo_CartesianUtil.cartesianCross(equatorial, normal);
  34171. com_ibm_rave_core_internal_geo_CartesianUtil.cartesianNormalize(inflection);
  34172. inflection = com_ibm_rave_core_internal_geo_SphericalUtil.spherical(inflection);
  34173. var dλ = λ - self.λ_;
  34174. var s = dλ > 0 ? 1 : -1;
  34175. var λi = inflection[0] * 57.29577951308232 * s;
  34176. var antimeridian = Math.abs(dλ) > 180;
  34177. if (antimeridian ^ (s * self.λ_ < λi && λi < s * λ)) {
  34178. var φi = inflection[1] * 57.29577951308232;
  34179. if (φi > self.φ1) {
  34180. self.φ1 = φi;
  34181. }
  34182. } else {
  34183. λi = (λi + 360) % 360 - 180;
  34184. if (antimeridian ^ (s * self.λ_ < λi && λi < s * λ)) {
  34185. var φi = -inflection[1] * 57.29577951308232;
  34186. if (φi < self.φ0) {
  34187. self.φ0 = φi;
  34188. }
  34189. } else {
  34190. if (φ < self.φ0) {
  34191. self.φ0 = φ;
  34192. }
  34193. if (φ > self.φ1) {
  34194. self.φ1 = φ;
  34195. }
  34196. }
  34197. }
  34198. if (antimeridian) {
  34199. if (λ < self.λ_) {
  34200. if (self.angle(self.λ0, λ) > self.angle(self.λ0, self.λ1)) {
  34201. self.λ1 = λ;
  34202. }
  34203. } else {
  34204. if (self.angle(λ, self.λ1) > self.angle(self.λ0, self.λ1)) {
  34205. self.λ0 = λ;
  34206. }
  34207. }
  34208. } else {
  34209. if (self.λ1 >= self.λ0) {
  34210. if (λ < self.λ0) {
  34211. self.λ0 = λ;
  34212. }
  34213. if (λ > self.λ1) {
  34214. self.λ1 = λ;
  34215. }
  34216. } else {
  34217. if (λ > self.λ_) {
  34218. if (self.angle(self.λ0, λ) > self.angle(self.λ0, self.λ1)) {
  34219. self.λ1 = λ;
  34220. }
  34221. } else {
  34222. if (self.angle(λ, self.λ1) > self.angle(self.λ0, self.λ1)) {
  34223. self.λ0 = λ;
  34224. }
  34225. }
  34226. }
  34227. }
  34228. } else {
  34229. self.point(λ, φ, NaN);
  34230. }
  34231. self.p0 = p;
  34232. self.λ_ = λ;
  34233. };
  34234. this.lineStart = function() {
  34235. self.boundsStreamListener.pointDelegate = self.linePoint;
  34236. };
  34237. this.lineEnd = function() {
  34238. self.range[0] = self.λ0;
  34239. self.range[1] = self.λ1;
  34240. self.boundsStreamListener.pointDelegate = self.point;
  34241. self.p0 = null;
  34242. };
  34243. this.ringPoint = function(λ, φ, z) {
  34244. if (self.p0) {
  34245. var dλ = λ - self.λ_;
  34246. self.dλSum += (Math.abs(dλ) > 180) ? dλ + (dλ > 0 ? 360 : -360) : dλ;
  34247. } else {
  34248. self.λ__ = λ;
  34249. self.φ__ = φ;
  34250. }
  34251. self.areaStreamListener.point(λ, φ, NaN);
  34252. self.linePoint(λ, φ, NaN);
  34253. };
  34254. this.ringStart = function() {
  34255. self.areaStreamListener.lineStart();
  34256. };
  34257. this.ringEnd = function() {
  34258. self.ringPoint(self.λ__, self.φ__, NaN);
  34259. self.areaStreamListener.lineEnd();
  34260. if (Math.abs(self.dλSum) > 1.0E-6) {
  34261. self.λ0 = -(self.λ1 = 180);
  34262. }
  34263. self.range[0] = self.λ0;
  34264. self.range[1] = self.λ1;
  34265. self.p0 = null;
  34266. };
  34267. this.polygonStart = function() {
  34268. self.boundsStreamListener.pointDelegate = self.ringPoint;
  34269. self.boundsStreamListener.lineStartDelegate = self.ringStart;
  34270. self.boundsStreamListener.lineEndDelegate = self.ringEnd;
  34271. self.dλSum = 0;
  34272. self.areaStreamListener.polygonStart();
  34273. };
  34274. this.polygonEnd = function() {
  34275. self.areaStreamListener.polygonEnd();
  34276. self.boundsStreamListener.pointDelegate = self.point;
  34277. self.boundsStreamListener.lineStartDelegate = self.lineStart;
  34278. self.boundsStreamListener.lineEndDelegate = self.lineEnd;
  34279. if (self.sphericalArea.areaRingSum.valueOf() < 0) {
  34280. self.λ0 = -(self.λ1 = 180);
  34281. self.φ0 = -(self.φ1 = 90);
  34282. } else if (self.dλSum > 1.0E-6) {
  34283. self.φ1 = 90;
  34284. } else if (self.dλSum < -1.0E-6) {
  34285. self.φ0 = -90;
  34286. }
  34287. self.range[0] = self.λ0;
  34288. self.range[1] = self.λ1;
  34289. };
  34290. this.boundsStreamListener.pointDelegate = this.point;
  34291. this.boundsStreamListener.lineStartDelegate = this.lineStart;
  34292. this.boundsStreamListener.lineEndDelegate = this.lineEnd;
  34293. this.boundsStreamListener.polygonStartDelegate = this.polygonStart;
  34294. this.boundsStreamListener.polygonEndDelegate = this.polygonEnd;
  34295. }
  34296. },
  34297. withinRange : function(x, range) {
  34298. return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x;
  34299. },
  34300. angle : function(λ0, λ1) {
  34301. var _λ1 = λ1;
  34302. return (_λ1 -= λ0) < 0 ? _λ1 + 360 : _λ1;
  34303. },
  34304. /**
  34305. * 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.
  34306. * @param (Object) feature the GeoJSON object containing the feature whose bounds are computed
  34307. * @return (double[][]) the spherical bounding box
  34308. */
  34309. calculateBounds : function(feature) {
  34310. this.φ1 = this.λ1 = -(this.λ0 = this.φ0 = Infinity);
  34311. this.ranges = [];
  34312. com_ibm_rave_core_geo_Geo.INSTANCE.stream(feature, this.boundsStreamListener);
  34313. var n = this.ranges.length;
  34314. if (n > 0) {
  34315. this.ranges.sort(this.rangeComparator);
  34316. var b;
  34317. var a = this.ranges[0];
  34318. var merged = [];
  34319. merged.push(a);
  34320. for (var i = 1; i < n; ++i) {
  34321. b = this.ranges[i];
  34322. if (this.withinRange(b[0], a) || this.withinRange(b[1], a)) {
  34323. if (this.angle(a[0], b[1]) > this.angle(a[0], a[1])) {
  34324. a[1] = b[1];
  34325. }
  34326. if (this.angle(b[0], a[1]) > this.angle(a[0], a[1])) {
  34327. a[0] = b[0];
  34328. }
  34329. } else {
  34330. merged.push(a = b);
  34331. }
  34332. }
  34333. var best = -Infinity, dλ;
  34334. n = merged.length - 1;
  34335. a = merged[n];
  34336. for (var i = 0; i <= n; a = b, ++i) {
  34337. b = merged[i];
  34338. if ((dλ = this.angle(a[1], b[0])) > best) {
  34339. best = dλ;
  34340. this.λ0 = b[0];
  34341. this.λ1 = a[1];
  34342. }
  34343. }
  34344. }
  34345. this.ranges = null;
  34346. this.range = null;
  34347. return (this.λ0 == Infinity || this.φ0 == Infinity) ? com_ibm_rave_core_internal_geo_SphericalBounds.NULL_BOUNDS : [[this.λ0, this.φ0], [this.λ1, this.φ1]];
  34348. }
  34349. });
  34350. com_ibm_rave_core_internal_geo_SphericalBounds.NULL_BOUNDS = [[NaN, NaN], [NaN, NaN]];
  34351. // $source: com/ibm/rave/core/internal/geo/SphericalCentroid
  34352. /************************************************************************
  34353. ** IBM Confidential
  34354. **
  34355. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  34356. **
  34357. ** (C) Copyright IBM Corp. 2017
  34358. **
  34359. ** The source code for this program is not published or otherwise divested of its trade secrets,
  34360. ** irrespective of what has been deposited with the U.S. Copyright Office.
  34361. ************************************************************************/
  34362. // GENERATED
  34363. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  34364. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (runtime) // new
  34365. //@import com/ibm/rave/core/geo/Geo (runtime) // Geo
  34366. //@import com/ibm/rave/core/internal/math/Trigonometry (runtime) // asin, acos
  34367. /**
  34368. */
  34369. var com_ibm_rave_core_internal_geo_SphericalCentroid = com_ibm_rave_core_nativeImpl_Declare({
  34370. //centroidStreamListener : null,
  34371. //centroidPoint : null,
  34372. //centroidLineStart : null,
  34373. //centroidLineStart_point : null,
  34374. //centroidLineStart_nextPoint : null,
  34375. //centroidLineEnd : null,
  34376. //polygonStart : null,
  34377. //polygonEnd : null,
  34378. //centroidRingStart : null,
  34379. //centroidRingStart_point : null,
  34380. //centroidRingStart_nextPoint : null,
  34381. //centroidRingStart_lineEnd : null,
  34382. centroidW0 : 0, centroidW1 : 0, centroidX0 : 0, centroidY0 : 0, centroidZ0 : 0, centroidX1 : 0, centroidY1 : 0, centroidZ1 : 0, centroidX2 : 0, centroidY2 : 0, centroidZ2 : 0,
  34383. ringStart_λ00 : 0, ringStart_φ00 : 0, ringStart_x0 : 0, ringStart_y0 : 0, ringStart_z0 : 0,
  34384. lineStart_x0 : 0, lineStart_y0 : 0, lineStart_z0 : 0,
  34385. constructor : function() {
  34386. this.centroidStreamListener = new com_ibm_rave_core_internal_geo_DelegatingStreamListener();
  34387. /**
  34388. */
  34389. {
  34390. var self = this;
  34391. this.centroidPoint = function(λ, φ, z) {
  34392. var _λ = λ;
  34393. var _φ = φ;
  34394. _λ *= 0.017453292519943295;
  34395. var cosφ = Math.cos(_φ *= 0.017453292519943295);
  34396. self.centroidPointXYZ(cosφ * Math.cos(_λ), cosφ * Math.sin(_λ), Math.sin(_φ));
  34397. };
  34398. this.centroidLineStart = function() {
  34399. self.lineStart_x0 = self.lineStart_y0 = self.lineStart_z0 = 0;
  34400. self.centroidStreamListener.pointDelegate = self.centroidLineStart_point;
  34401. };
  34402. this.centroidLineStart_point = function(λ, φ, z) {
  34403. var _λ = λ;
  34404. var _φ = φ;
  34405. _λ *= 0.017453292519943295;
  34406. var cosφ = Math.cos(_φ *= 0.017453292519943295);
  34407. self.lineStart_x0 = cosφ * Math.cos(_λ);
  34408. self.lineStart_y0 = cosφ * Math.sin(_λ);
  34409. self.lineStart_z0 = Math.sin(_φ);
  34410. self.centroidStreamListener.pointDelegate = self.centroidLineStart_nextPoint;
  34411. self.centroidPointXYZ(self.lineStart_x0, self.lineStart_y0, self.lineStart_z0);
  34412. };
  34413. this.centroidLineStart_nextPoint = function(λ, φ, zz) {
  34414. var _λ = λ;
  34415. var _φ = φ;
  34416. _λ *= 0.017453292519943295;
  34417. var cosφ = Math.cos(_φ *= 0.017453292519943295);
  34418. var x = cosφ * Math.cos(_λ);
  34419. var y = cosφ * Math.sin(_λ);
  34420. var z = Math.sin(_φ);
  34421. var temp;
  34422. 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);
  34423. self.centroidW1 += w;
  34424. self.centroidX1 += w * (self.lineStart_x0 + (self.lineStart_x0 = x));
  34425. self.centroidY1 += w * (self.lineStart_y0 + (self.lineStart_y0 = y));
  34426. self.centroidZ1 += w * (self.lineStart_z0 + (self.lineStart_z0 = z));
  34427. self.centroidPointXYZ(self.lineStart_x0, self.lineStart_y0, self.lineStart_z0);
  34428. };
  34429. this.centroidLineEnd = function() {
  34430. self.centroidStreamListener.pointDelegate = self.centroidPoint;
  34431. };
  34432. this.polygonStart = function() {
  34433. self.centroidStreamListener.lineStartDelegate = self.centroidRingStart;
  34434. };
  34435. this.polygonEnd = function() {
  34436. self.centroidStreamListener.lineStartDelegate = self.centroidLineStart;
  34437. };
  34438. this.centroidRingStart = function() {
  34439. self.ringStart_λ00 = self.ringStart_φ00 = self.ringStart_x0 = self.ringStart_y0 = self.ringStart_z0 = 0;
  34440. self.centroidStreamListener.pointDelegate = self.centroidRingStart_point;
  34441. self.centroidStreamListener.lineEndDelegate = self.centroidRingStart_lineEnd;
  34442. };
  34443. this.centroidRingStart_point = function(λ, φ, z) {
  34444. var _λ = λ;
  34445. var _φ = φ;
  34446. self.ringStart_λ00 = _λ;
  34447. self.ringStart_φ00 = _φ;
  34448. self.centroidStreamListener.pointDelegate = self.centroidRingStart_nextPoint;
  34449. _λ *= 0.017453292519943295;
  34450. var cosφ = Math.cos(_φ *= 0.017453292519943295);
  34451. self.ringStart_x0 = cosφ * Math.cos(_λ);
  34452. self.ringStart_y0 = cosφ * Math.sin(_λ);
  34453. self.ringStart_z0 = Math.sin(_φ);
  34454. self.centroidPointXYZ(self.ringStart_x0, self.ringStart_y0, self.ringStart_z0);
  34455. };
  34456. this.centroidRingStart_nextPoint = function(λ, φ, zz) {
  34457. var _λ = λ;
  34458. var _φ = φ;
  34459. _λ *= 0.017453292519943295;
  34460. 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;
  34461. var v = (m == 0 || isNaN(m)) ? m : -com_ibm_rave_core_internal_math_Trigonometry.acos(u) / m;
  34462. var w = Math.atan2(m, u);
  34463. self.centroidX2 += v * cx;
  34464. self.centroidY2 += v * cy;
  34465. self.centroidZ2 += v * cz;
  34466. self.centroidW1 += w;
  34467. self.centroidX1 += w * (self.ringStart_x0 + (self.ringStart_x0 = x));
  34468. self.centroidY1 += w * (self.ringStart_y0 + (self.ringStart_y0 = y));
  34469. self.centroidZ1 += w * (self.ringStart_z0 + (self.ringStart_z0 = z));
  34470. self.centroidPointXYZ(self.ringStart_x0, self.ringStart_y0, self.ringStart_z0);
  34471. };
  34472. this.centroidRingStart_lineEnd = function() {
  34473. self.centroidRingStart_nextPoint(self.ringStart_λ00, self.ringStart_φ00, NaN);
  34474. self.centroidStreamListener.lineEndDelegate = self.centroidLineEnd;
  34475. self.centroidStreamListener.pointDelegate = self.centroidPoint;
  34476. };
  34477. this.centroidStreamListener.pointDelegate = this.centroidPoint;
  34478. this.centroidStreamListener.lineStartDelegate = this.centroidLineStart;
  34479. this.centroidStreamListener.lineEndDelegate = this.centroidLineEnd;
  34480. this.centroidStreamListener.polygonStartDelegate = this.polygonStart;
  34481. this.centroidStreamListener.polygonEndDelegate = this.polygonEnd;
  34482. }
  34483. },
  34484. centroidPointXYZ : function(x, y, z) {
  34485. ++this.centroidW0;
  34486. this.centroidX0 += (x - this.centroidX0) / this.centroidW0;
  34487. this.centroidY0 += (y - this.centroidY0) / this.centroidW0;
  34488. this.centroidZ0 += (z - this.centroidZ0) / this.centroidW0;
  34489. },
  34490. /**
  34491. * Returns the spherical centroid of the specified feature. See also path.centroid, which computes the projected centroid on the Cartesian plane.
  34492. * @param (Object) feature the GeoJSON object containing the feature whose area is computed
  34493. * @return (double[]) the point representing the centroid
  34494. */
  34495. calculateCentroid : function(feature) {
  34496. this.centroidW0 = this.centroidW1 = this.centroidX0 = this.centroidY0 = this.centroidZ0 = this.centroidX1 = this.centroidY1 = this.centroidZ1 = this.centroidX2 = this.centroidY2 = this.centroidZ2 = 0;
  34497. this.ringStart_λ00 = this.ringStart_φ00 = this.ringStart_x0 = this.ringStart_y0 = this.ringStart_z0 = 0;
  34498. this.lineStart_x0 = this.lineStart_y0 = this.lineStart_z0 = 0;
  34499. com_ibm_rave_core_geo_Geo.INSTANCE.stream(feature, this.centroidStreamListener);
  34500. var x = this.centroidX2;
  34501. var y = this.centroidY2;
  34502. var z = this.centroidZ2;
  34503. var m = x * x + y * y + z * z;
  34504. if (m < 1.0E-12) {
  34505. x = this.centroidX1;
  34506. y = this.centroidY1;
  34507. z = this.centroidZ1;
  34508. if (this.centroidW1 < 1.0E-6) {
  34509. x = this.centroidX0;
  34510. y = this.centroidY0;
  34511. z = this.centroidZ0;
  34512. }
  34513. m = x * x + y * y + z * z;
  34514. if (m < 1.0E-12) {
  34515. return com_ibm_rave_core_internal_geo_SphericalCentroid.NULL_CENTROID;
  34516. }
  34517. }
  34518. return [Math.atan2(y, x) * 57.29577951308232, com_ibm_rave_core_internal_math_Trigonometry.asin(z / Math.sqrt(m)) * 57.29577951308232];
  34519. }
  34520. });
  34521. com_ibm_rave_core_internal_geo_SphericalCentroid.NULL_CENTROID = [NaN, NaN];
  34522. // $source: com/ibm/rave/core/internal/geo/SphericalLength
  34523. /************************************************************************
  34524. ** IBM Confidential
  34525. **
  34526. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  34527. **
  34528. ** (C) Copyright IBM Corp. 2017
  34529. **
  34530. ** The source code for this program is not published or otherwise divested of its trade secrets,
  34531. ** irrespective of what has been deposited with the U.S. Copyright Office.
  34532. ************************************************************************/
  34533. // GENERATED
  34534. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  34535. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (runtime) // new
  34536. //@import com/ibm/rave/core/geo/Geo (runtime) // Geo
  34537. /**
  34538. */
  34539. var com_ibm_rave_core_internal_geo_SphericalLength = com_ibm_rave_core_nativeImpl_Declare({
  34540. //lengthStreamListener : null,
  34541. //lineStart : null,
  34542. //lineEnd : null,
  34543. //point : null,
  34544. //nextPoint : null,
  34545. λ0 : 0, sinφ0 : 0, cosφ0 : 0,
  34546. lengthSum : 0,
  34547. constructor : function() {
  34548. this.lengthStreamListener = new com_ibm_rave_core_internal_geo_DelegatingStreamListener();
  34549. /**
  34550. */
  34551. {
  34552. var self = this;
  34553. this.lineStart = function() {
  34554. self.λ0 = self.sinφ0 = self.cosφ0 = 0;
  34555. self.lengthStreamListener.pointDelegate = self.point;
  34556. self.lengthStreamListener.lineEndDelegate = self.lineEnd;
  34557. };
  34558. this.lineEnd = function() {
  34559. self.lengthStreamListener.pointDelegate = null;
  34560. self.lengthStreamListener.lineEndDelegate = null;
  34561. };
  34562. this.point = function(λ, φ, z) {
  34563. var _φ = φ;
  34564. self.λ0 = λ * 0.017453292519943295;
  34565. self.sinφ0 = Math.sin(_φ *= 0.017453292519943295);
  34566. self.cosφ0 = Math.cos(_φ);
  34567. self.lengthStreamListener.pointDelegate = self.nextPoint;
  34568. };
  34569. this.nextPoint = function(λ, φ, z) {
  34570. var _λ = λ;
  34571. var _φ = φ;
  34572. var sinφ = Math.sin(_φ *= 0.017453292519943295), cosφ = Math.cos(_φ), t = Math.abs((_λ *= 0.017453292519943295) - self.λ0), cosΔλ = Math.cos(t);
  34573. 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Δλ);
  34574. self.λ0 = _λ;
  34575. self.sinφ0 = sinφ;
  34576. self.cosφ0 = cosφ;
  34577. };
  34578. this.lengthStreamListener.lineStartDelegate = this.lineStart;
  34579. }
  34580. },
  34581. /**
  34582. * 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.
  34583. * @param (Object) feature the GeoJSON object containing the feature whose length is computed
  34584. * @return (double) the great-arc length
  34585. */
  34586. calculateLength : function(feature) {
  34587. this.lengthSum = 0;
  34588. com_ibm_rave_core_geo_Geo.INSTANCE.stream(feature, this.lengthStreamListener);
  34589. return this.lengthSum;
  34590. }
  34591. });
  34592. // $source: com/ibm/rave/core/internal/geo/SphericalInterpolation
  34593. /************************************************************************
  34594. ** IBM Confidential
  34595. **
  34596. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  34597. **
  34598. ** (C) Copyright IBM Corp. 2017
  34599. **
  34600. ** The source code for this program is not published or otherwise divested of its trade secrets,
  34601. ** irrespective of what has been deposited with the U.S. Copyright Office.
  34602. ************************************************************************/
  34603. // GENERATED
  34604. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  34605. //@import com/ibm/rave/core/internal/math/Trigonometry (runtime) // haversin
  34606. var com_ibm_rave_core_internal_geo_SphericalInterpolation = com_ibm_rave_core_nativeImpl_Declare({
  34607. });
  34608. /**
  34609. * 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.
  34610. * @param (double[]) source the first location
  34611. * @param (double[]) target the second location
  34612. * @return (com.ibm.rave.core.interpolate.Interpolator) the interpolator
  34613. */
  34614. com_ibm_rave_core_internal_geo_SphericalInterpolation.newInterpolator = function(source, target) {
  34615. var x0 = source[0] * 0.017453292519943295;
  34616. var y0 = source[1] * 0.017453292519943295;
  34617. var x1 = target[0] * 0.017453292519943295;
  34618. var y1 = target[1] * 0.017453292519943295;
  34619. 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);
  34620. if ((d)) {
  34621. return function(t) {
  34622. var _t = t;
  34623. var B = Math.sin(_t *= d) * k;
  34624. var A = Math.sin(d - _t) * k;
  34625. var x = A * kx0 + B * kx1;
  34626. var y = A * ky0 + B * ky1;
  34627. var z = A * sy0 + B * sy1;
  34628. return [Math.atan2(y, x) * 57.29577951308232, Math.atan2(z, Math.sqrt(x * x + y * y)) * 57.29577951308232];
  34629. };
  34630. }
  34631. return function(t) {
  34632. return [x0 * 57.29577951308232, y0 * 57.29577951308232];
  34633. };
  34634. };
  34635. // $source: com/ibm/rave/core/geo/CircleShapeGenerator
  34636. /************************************************************************
  34637. ** IBM Confidential
  34638. **
  34639. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  34640. **
  34641. ** (C) Copyright IBM Corp. 2017
  34642. **
  34643. ** The source code for this program is not published or otherwise divested of its trade secrets,
  34644. ** irrespective of what has been deposited with the U.S. Copyright Office.
  34645. ************************************************************************/
  34646. // GENERATED
  34647. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  34648. //@import com/ibm/rave/core/internal/geo/GeoShapeGeneratorUtil (runtime) // newCircleInterpolator
  34649. //@import com/ibm/rave/core/internal/geo/SphericalRotation (runtime) // rotation
  34650. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (runtime) // new
  34651. /**
  34652. * A class that is used to build a GeoJSON Polygon geometry object approximating a circle.
  34653. */
  34654. var com_ibm_rave_core_geo_CircleShapeGenerator = com_ibm_rave_core_nativeImpl_Declare({
  34655. //originObject : null,
  34656. //interpolator : null,
  34657. precisionValue : 0,
  34658. angleValue : 0,
  34659. _$functionClassMethod : function() {
  34660. var _$self = /**
  34661. * Builds a GeoJSON Polygon approximating a circle.
  34662. * @param (java.lang.Object[]) originArgs arguments passed by the caller that will be passed to the originValueFunction
  34663. * @return (Object) the GeoJson geometry object
  34664. */
  34665. function(originArgs) {
  34666. if (originArgs !== null || arguments.length > 1){
  34667. originArgs = Array.prototype.slice.call(arguments);
  34668. }
  34669. {
  34670. var center = (typeof _$self.originObject === "function") ? (_$self.originObject).apply((_$self.originObject), originArgs) : _$self.originObject;
  34671. var rotate = com_ibm_rave_core_internal_geo_SphericalRotation.rotation(-center[0] * 0.017453292519943295, -center[1] * 0.017453292519943295, 0);
  34672. var ring = [];
  34673. var coordinates = [];
  34674. coordinates.push(ring);
  34675. var listener = new com_ibm_rave_core_internal_geo_DelegatingStreamListener();
  34676. listener.pointDelegate = function(x, y, z) {
  34677. var invertedPoint = rotate.invert(x, y);
  34678. invertedPoint[0] *= 57.29577951308232;
  34679. invertedPoint[1] *= 57.29577951308232;
  34680. ring.push((((invertedPoint))));
  34681. };
  34682. if (_$self.interpolator) {
  34683. _$self.interpolator(null, null, 1, listener);
  34684. }
  34685. var json = {};
  34686. json["type"] = "Polygon";
  34687. json["coordinates"] = coordinates;
  34688. return json;
  34689. }
  34690. };
  34691. return _$self;
  34692. },
  34693. /**
  34694. * 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]
  34695. * @return (Object) the current value of the circle origin
  34696. */
  34697. origin$0 : function() {
  34698. return this.originObject;
  34699. },
  34700. /**
  34701. * Sets the coordinates of the circle origin
  34702. * @param (double[]) originPoint the x and y coordinates to use for the circle origin value
  34703. * @return (com.ibm.rave.core.geo.CircleShapeGenerator) this CircleShapeGenerator object itself
  34704. */
  34705. origin$1 : function(originPoint) {
  34706. this.originObject = originPoint;
  34707. return this;
  34708. },
  34709. /**
  34710. * Sets a value function to be used to figure out the origin of this circle
  34711. * @param (com.ibm.rave.core.geo.CircleShapeGenerator.ValueFunction) originFn the value function used to get circle origin
  34712. * @return (com.ibm.rave.core.geo.CircleShapeGenerator) this CircleShapeGenerator object itself
  34713. */
  34714. origin$2 : function(originFn) {
  34715. this.originObject = originFn;
  34716. return this;
  34717. },
  34718. /**
  34719. * Returns the current angular radius of the circle in degrees The default value is 90°
  34720. * @return (double) the angular radius of the circle in degrees
  34721. */
  34722. angle$0 : function() {
  34723. return this.angleValue;
  34724. },
  34725. /**
  34726. * Sets the angular radius of the circle in degrees
  34727. * @param (Object) x the value to set. The object could be either a Double or a string that parses to a Double number
  34728. * @return (com.ibm.rave.core.geo.CircleShapeGenerator) the angular radius of the circle in degrees
  34729. */
  34730. angle$1 : function(x) {
  34731. this.interpolator = com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.newCircleInterpolator((this.angleValue = + (x)) * 0.017453292519943295, this.precisionValue * 0.017453292519943295);
  34732. return this;
  34733. },
  34734. /**
  34735. * 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.
  34736. * @return (double) the precision value
  34737. */
  34738. precision$0 : function() {
  34739. return this.precisionValue;
  34740. },
  34741. /**
  34742. * 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.
  34743. * @return (com.ibm.rave.core.geo.CircleShapeGenerator) this CircleShapeGenerator object itself
  34744. */
  34745. precision$1 : function(x) {
  34746. this.interpolator = com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.newCircleInterpolator(this.angleValue * 0.017453292519943295, (this.precisionValue = + (x)) * 0.017453292519943295);
  34747. return this;
  34748. },
  34749. /** @expose */
  34750. origin : function(a0) {
  34751. var args = arguments;
  34752. if (args.length == 0) {
  34753. return this.origin$0();
  34754. }
  34755. if (args.length == 1 && typeof a0 === "function") {
  34756. return this.origin$2(a0);
  34757. }
  34758. return this.origin$1(a0);
  34759. },
  34760. /** @expose */
  34761. angle : function(a0) {
  34762. var args = arguments;
  34763. if (args.length == 0) {
  34764. return this.angle$0();
  34765. }
  34766. return this.angle$1(a0);
  34767. },
  34768. /** @expose */
  34769. precision : function(a0) {
  34770. var args = arguments;
  34771. if (args.length == 0) {
  34772. return this.precision$0();
  34773. }
  34774. return this.precision$1(a0);
  34775. }
  34776. //constructor : function() {}
  34777. });
  34778. /**
  34779. * Constructs and initialize the CircleShapeGenerator to default values
  34780. * @return (com.ibm.rave.core.geo.CircleShapeGenerator) the newly constructed CircleShapeGenerator object
  34781. */
  34782. com_ibm_rave_core_geo_CircleShapeGenerator.newCircleShapeGenerator = function() {
  34783. var circle = new com_ibm_rave_core_geo_CircleShapeGenerator();
  34784. circle.precisionValue = 6;
  34785. circle.originObject = com_ibm_rave_core_geo_CircleShapeGenerator.DEFAULT_ORIGIN;
  34786. circle.angle(90);
  34787. return circle;
  34788. };
  34789. com_ibm_rave_core_geo_CircleShapeGenerator.DEFAULT_ORIGIN = [0, 0];
  34790. // $source: com/ibm/rave/core/geo/GreatArcShapeGenerator
  34791. /************************************************************************
  34792. ** IBM Confidential
  34793. **
  34794. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  34795. **
  34796. ** (C) Copyright IBM Corp. 2017
  34797. **
  34798. ** The source code for this program is not published or otherwise divested of its trade secrets,
  34799. ** irrespective of what has been deposited with the U.S. Copyright Office.
  34800. ************************************************************************/
  34801. // GENERATED
  34802. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  34803. //@import com/ibm/rave/core/internal/geo/SphericalUtil (runtime) // calculateDistance
  34804. /**
  34805. * @deprecated use {type: "LineString"} or Rave.geo.distance instead.
  34806. */
  34807. var com_ibm_rave_core_geo_GreatArcShapeGenerator = com_ibm_rave_core_nativeImpl_Declare({
  34808. //sourceObject : null,
  34809. //targetObject : null,
  34810. _$functionClassMethod : function() {
  34811. var _$self = /**
  34812. * Builds a GeoJSON LineString approximating a great arc.
  34813. * @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.
  34814. * @return (Object) the GeoJson geometry object
  34815. */
  34816. function(pointsArgs) {
  34817. if (pointsArgs !== null || arguments.length > 1){
  34818. pointsArgs = Array.prototype.slice.call(arguments);
  34819. }
  34820. {
  34821. var source = (typeof _$self.sourceObject === "function") ? (_$self.sourceObject).apply((_$self.sourceObject), pointsArgs) : _$self.sourceObject;
  34822. var target = (typeof _$self.targetObject === "function") ? (_$self.targetObject).apply((_$self.targetObject), pointsArgs) : _$self.targetObject;
  34823. var coordinates = [];
  34824. coordinates.push((((source))));
  34825. coordinates.push((((target))));
  34826. var json = {};
  34827. json["type"] = "LineString";
  34828. json["coordinates"] = coordinates;
  34829. return json;
  34830. }
  34831. };
  34832. return _$self;
  34833. },
  34834. /**
  34835. */
  34836. constructor : function() {
  34837. this.sourceObject = function(pointsArgs) {
  34838. if (pointsArgs !== null || arguments.length > 1){
  34839. pointsArgs = Array.prototype.slice.call(arguments);
  34840. }
  34841. {
  34842. return (pointsArgs[0]).source;
  34843. }
  34844. };
  34845. this.targetObject = function(pointsArgs) {
  34846. if (pointsArgs !== null || arguments.length > 1){
  34847. pointsArgs = Array.prototype.slice.call(arguments);
  34848. }
  34849. {
  34850. return (pointsArgs[0]).target;
  34851. }
  34852. };
  34853. },
  34854. /**
  34855. * Calculates the distance between the source and target points
  34856. * @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.
  34857. * @return (double) the distance between the source and target point
  34858. */
  34859. /** @expose */
  34860. distance : function(pointsArgs) {
  34861. if (pointsArgs !== null || arguments.length > 1){
  34862. pointsArgs = Array.prototype.slice.call(arguments);
  34863. }
  34864. {
  34865. var source = (typeof this.sourceObject === "function") ? (this.sourceObject).apply((this.sourceObject), pointsArgs) : this.sourceObject;
  34866. var target = (typeof this.targetObject === "function") ? (this.targetObject).apply((this.targetObject), pointsArgs) : this.targetObject;
  34867. return com_ibm_rave_core_internal_geo_SphericalUtil.calculateDistance(source, target);
  34868. }
  34869. },
  34870. /**
  34871. * 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
  34872. * @return (Object) the current value of the source point
  34873. */
  34874. source$0 : function() {
  34875. return this.sourceObject;
  34876. },
  34877. /**
  34878. * Sets the coordinates of the source point
  34879. * @param (double[]) sourcePoint the x and y coordinates to use for the source point value
  34880. * @return (com.ibm.rave.core.geo.GreatArcShapeGenerator) this GreatArcShapeGenerator object itself
  34881. */
  34882. source$1 : function(sourcePoint) {
  34883. this.sourceObject = sourcePoint;
  34884. return this;
  34885. },
  34886. /**
  34887. * Sets a value function to be used to figure out the source point value of this great arc
  34888. * @param (com.ibm.rave.core.geo.GreatArcShapeGenerator.ValueFunction) sourceFn the value function used to get source point
  34889. * @return (com.ibm.rave.core.geo.GreatArcShapeGenerator) this GreatArcShapeGenerator object itself
  34890. */
  34891. source$2 : function(sourceFn) {
  34892. this.sourceObject = sourceFn;
  34893. return this;
  34894. },
  34895. /**
  34896. * 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
  34897. * @return (Object) the current value of the target point
  34898. */
  34899. target$0 : function() {
  34900. return this.targetObject;
  34901. },
  34902. /**
  34903. * Sets the coordinates of the target point
  34904. * @param (double[]) targetPoint the x and y coordinates to use for the source point value
  34905. * @return (com.ibm.rave.core.geo.GreatArcShapeGenerator) this GreatArcShapeGenerator object itself
  34906. */
  34907. target$1 : function(targetPoint) {
  34908. this.targetObject = targetPoint;
  34909. return this;
  34910. },
  34911. /**
  34912. * Sets a value function to be used to figure out the target point value of this great arc
  34913. * @param (com.ibm.rave.core.geo.GreatArcShapeGenerator.ValueFunction) targetFn the value function used to get target point
  34914. * @return (com.ibm.rave.core.geo.GreatArcShapeGenerator) this GreatArcShapeGenerator object itself
  34915. */
  34916. target$2 : function(targetFn) {
  34917. this.targetObject = targetFn;
  34918. return this;
  34919. },
  34920. /**
  34921. * This function is deprecated and has no impact. The precision value is always zero
  34922. * @return (com.ibm.rave.core.geo.GreatArcShapeGenerator) this GreatArcShapeGenerator object itself
  34923. * @deprecated
  34924. */
  34925. precision$0 : function(x) {
  34926. return this;
  34927. },
  34928. /**
  34929. * This function is deprecated. The precision value returned is always zero
  34930. * @return (double) the precision value always zero
  34931. * @deprecated
  34932. */
  34933. precision$1 : function() {
  34934. return 0;
  34935. },
  34936. /** @expose */
  34937. source : function(a0) {
  34938. var args = arguments;
  34939. if (args.length == 0) {
  34940. return this.source$0();
  34941. }
  34942. if (args.length == 1 && typeof a0 === "function") {
  34943. return this.source$2(a0);
  34944. }
  34945. return this.source$1(a0);
  34946. },
  34947. /** @expose */
  34948. target : function(a0) {
  34949. var args = arguments;
  34950. if (args.length == 0) {
  34951. return this.target$0();
  34952. }
  34953. if (args.length == 1 && typeof a0 === "function") {
  34954. return this.target$2(a0);
  34955. }
  34956. return this.target$1(a0);
  34957. },
  34958. /** @expose */
  34959. precision : function(a0) {
  34960. var args = arguments;
  34961. if (args.length == 0) {
  34962. return this.precision$1();
  34963. }
  34964. return this.precision$0(a0);
  34965. }
  34966. });
  34967. /**
  34968. * Constructs a GreatArcShapeGenerator
  34969. * @return (com.ibm.rave.core.geo.GreatArcShapeGenerator) the newly constructed GreatArcShapeGenerator object
  34970. */
  34971. com_ibm_rave_core_geo_GreatArcShapeGenerator.newGreatArcShapeGenerator = function() {
  34972. return new com_ibm_rave_core_geo_GreatArcShapeGenerator();
  34973. };
  34974. com_ibm_rave_core_geo_GreatArcShapeGenerator.GreatArcPointsStruct = rave_externs["GreatArcPointsStruct"] = com_ibm_rave_core_nativeImpl_Declare({
  34975. /** @expose */
  34976. source : null,
  34977. /** @expose */
  34978. target : null
  34979. });
  34980. // $source: com/ibm/rave/core/geo/GraticuleShapeGenerator
  34981. /************************************************************************
  34982. ** IBM Confidential
  34983. **
  34984. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  34985. **
  34986. ** (C) Copyright IBM Corp. 2017
  34987. **
  34988. ** The source code for this program is not published or otherwise divested of its trade secrets,
  34989. ** irrespective of what has been deposited with the U.S. Copyright Office.
  34990. ************************************************************************/
  34991. // GENERATED
  34992. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // bind, declare
  34993. //@import com/ibm/rave/core/Rave (runtime) // range
  34994. //@import com/ibm/rave/core/internal/geo/GeoShapeGeneratorUtil (runtime) // graticuleY, graticuleX
  34995. /**
  34996. * A class that is used to build and MultiLineString geometry object representing all meridians and parallels for this graticule.
  34997. */
  34998. var com_ibm_rave_core_geo_GraticuleShapeGenerator = com_ibm_rave_core_nativeImpl_Declare({
  34999. //x : null, //y : null, //X : null, //Y : null,
  35000. 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,
  35001. _$functionClassMethod : function() {
  35002. var _$self = /**
  35003. * Builds a MultiLineString geometry object representing all meridians and parallels for this graticule.
  35004. * @return (Object) the GeoJson geometry object
  35005. */
  35006. function() {
  35007. var coordinates = (_$self.generateLines());
  35008. var json = {};
  35009. json["type"] = "MultiLineString";
  35010. json["coordinates"] = coordinates;
  35011. return json;
  35012. };
  35013. return _$self;
  35014. },
  35015. generateLines : function() {
  35016. var self = this;
  35017. 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) {
  35018. return self.X(+ (currentValue));
  35019. });
  35020. 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) {
  35021. return self.Y(+ (currentValue));
  35022. });
  35023. 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) {
  35024. return Math.abs(+ (currentValue) % self.DX) > 1.0E-6;
  35025. }).map(function(currentValue, index, array) {
  35026. return self.x(+ (currentValue));
  35027. });
  35028. 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) {
  35029. return Math.abs(+ (currentValue) % self.DY) > 1.0E-6;
  35030. }).map(function(currentValue, index, array) {
  35031. return self.y(+ (currentValue));
  35032. });
  35033. return array_X.concat(array_Y, array_x, array_y);
  35034. },
  35035. /**
  35036. * Returns an array of LineString geometry objects, one for each meridian or parallel for this graticule.
  35037. * @return (Array) the array of LineString geometry objects
  35038. */
  35039. /** @expose */
  35040. lines : com_ibm_rave_core_nativeImpl_Declare.bind(function() {
  35041. return this.generateLines().map(function(currentValue, index, array) {
  35042. var coordinates = (currentValue);
  35043. var json = {};
  35044. json["type"] = "LineString";
  35045. json["coordinates"] = coordinates;
  35046. return json;
  35047. });
  35048. }),
  35049. /**
  35050. * Returns a Polygon geometry object representing the outline of this graticule, i.e. along the meridians and parallels defining its extent.
  35051. * @return (Object) the Polygon geometry object
  35052. */
  35053. /** @expose */
  35054. outline : com_ibm_rave_core_nativeImpl_Declare.bind(function() {
  35055. 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));
  35056. var coordinates = [];
  35057. coordinates.push((coords));
  35058. var json = {};
  35059. json["type"] = "Polygon";
  35060. json["coordinates"] = coordinates;
  35061. return json;
  35062. }),
  35063. /**
  35064. * Returns the current minor extent
  35065. * @return (Array) the current minor extent
  35066. */
  35067. extent$0 : function() {
  35068. return this.minorExtent();
  35069. },
  35070. /**
  35071. * Sets the major and minor extents of this graticule.
  35072. * @param (Array) ext the extent value to set
  35073. * @return (com.ibm.rave.core.geo.GraticuleShapeGenerator) this GraticuleShapeGenerator object itself
  35074. */
  35075. extent$1 : function(ext) {
  35076. return this.majorExtent(ext).minorExtent(ext);
  35077. },
  35078. /**
  35079. * Returns the current major extent The default value of major extent is from [-180°, -90° + Trigonometry.ε] to [180°, 90° - Trigonometry.ε]
  35080. * @return (Array) the current major extent
  35081. */
  35082. majorExtent$0 : function() {
  35083. return [[this.X0, this.Y0], [this.X1, this.Y1]];
  35084. },
  35085. /**
  35086. * Sets the major extent of this graticule
  35087. * @param (Array) ext the extent value to set
  35088. * @return (com.ibm.rave.core.geo.GraticuleShapeGenerator) this GraticuleShapeGenerator object itself
  35089. */
  35090. majorExtent$1 : function(ext) {
  35091. this.X0 = + (ext[0][0]);
  35092. this.X1 = + (ext[1][0]);
  35093. this.Y0 = + (ext[0][1]);
  35094. this.Y1 = + (ext[1][1]);
  35095. if (this.X0 > this.X1) {
  35096. var temp = this.X0;
  35097. this.X0 = this.X1;
  35098. this.X1 = temp;
  35099. }
  35100. if (this.Y0 > this.Y1) {
  35101. var temp = this.Y0;
  35102. this.Y0 = this.Y1;
  35103. this.Y1 = temp;
  35104. }
  35105. return this.precision(this.precisionValue);
  35106. },
  35107. /**
  35108. * Returns the current minor extent The default value of minor extent is from [-180°, -80° - Trigonometry.ε] to [180°, 80° + Trigonometry.ε]
  35109. * @return (Array) the current minor extent
  35110. */
  35111. minorExtent$0 : function() {
  35112. return [[this.x0, this.y0], [this.x1, this.y1]];
  35113. },
  35114. /**
  35115. * Sets the minor extent of this graticule
  35116. * @param (Array) ext the extent value to set
  35117. * @return (com.ibm.rave.core.geo.GraticuleShapeGenerator) this GraticuleShapeGenerator object itself
  35118. */
  35119. minorExtent$1 : function(ext) {
  35120. this.x0 = + (ext[0][0]);
  35121. this.x1 = + (ext[1][0]);
  35122. this.y0 = + (ext[0][1]);
  35123. this.y1 = + (ext[1][1]);
  35124. if (this.x0 > this.x1) {
  35125. var temp = this.x0;
  35126. this.x0 = this.x1;
  35127. this.x1 = temp;
  35128. }
  35129. if (this.y0 > this.y1) {
  35130. var temp = this.y0;
  35131. this.y0 = this.y1;
  35132. this.y1 = temp;
  35133. }
  35134. return this.precision(this.precisionValue);
  35135. },
  35136. /**
  35137. * Returns the current minor step
  35138. * @return (Array) the current minor step
  35139. */
  35140. step$0 : function() {
  35141. return this.minorStep();
  35142. },
  35143. /**
  35144. * Sets the major and minor step point (DX,DY) for this graticule
  35145. * @param (Array) s the step value to use
  35146. * @return (com.ibm.rave.core.geo.GraticuleShapeGenerator) this GraticuleShapeGenerator object itself
  35147. */
  35148. step$1 : function(s) {
  35149. return this.majorStep(s).minorStep(s);
  35150. },
  35151. /**
  35152. * Returns the current major step The default value is [90°, 360°]
  35153. * @return (Array) the current major step
  35154. */
  35155. majorStep$0 : function() {
  35156. return [this.DX, this.DY];
  35157. },
  35158. /**
  35159. * Sets the major step for this graticule
  35160. * @param (Array) s the step value to set
  35161. * @return (com.ibm.rave.core.geo.GraticuleShapeGenerator) this GraticuleShapeGenerator object itself
  35162. */
  35163. majorStep$1 : function(s) {
  35164. this.DX = + (s[0]);
  35165. this.DY = + (s[1]);
  35166. return this;
  35167. },
  35168. /**
  35169. * Returns the current minor step The default value is [10°, 10°]
  35170. * @return (Array) the current minor step
  35171. */
  35172. minorStep$0 : function() {
  35173. return [this.dx, this.dy];
  35174. },
  35175. /**
  35176. * Sets the minor step for this graticule
  35177. * @param (Array) s the step value to set
  35178. * @return (com.ibm.rave.core.geo.GraticuleShapeGenerator) this GraticuleShapeGenerator object itself
  35179. */
  35180. minorStep$1 : function(s) {
  35181. this.dx = + (s[0]);
  35182. this.dy = + (s[1]);
  35183. return this;
  35184. },
  35185. /**
  35186. * Returns the current precision, which defaults to 2.5°
  35187. * @return (double) the current precision
  35188. */
  35189. precision$0 : function() {
  35190. return this.precisionValue;
  35191. },
  35192. /**
  35193. * Sets the precision for this graticule, in degrees
  35194. * @param (double) p the precision value to set
  35195. * @return (com.ibm.rave.core.geo.GraticuleShapeGenerator) this GraticuleShapeGenerator object itself
  35196. */
  35197. precision$1 : function(p) {
  35198. this.precisionValue = + (p);
  35199. this.x = com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.graticuleX(this.y0, this.y1, 90);
  35200. this.y = com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.graticuleY(this.x0, this.x1, this.precisionValue);
  35201. this.X = com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.graticuleX(this.Y0, this.Y1, 90);
  35202. this.Y = com_ibm_rave_core_internal_geo_GeoShapeGeneratorUtil.graticuleY(this.X0, this.X1, this.precisionValue);
  35203. return this;
  35204. },
  35205. /** @expose */
  35206. extent : function(a0) {
  35207. var args = arguments;
  35208. if (args.length == 0) {
  35209. return this.extent$0();
  35210. }
  35211. return this.extent$1(a0);
  35212. },
  35213. /** @expose */
  35214. majorExtent : function(a0) {
  35215. var args = arguments;
  35216. if (args.length == 0) {
  35217. return this.majorExtent$0();
  35218. }
  35219. return this.majorExtent$1(a0);
  35220. },
  35221. /** @expose */
  35222. minorExtent : function(a0) {
  35223. var args = arguments;
  35224. if (args.length == 0) {
  35225. return this.minorExtent$0();
  35226. }
  35227. return this.minorExtent$1(a0);
  35228. },
  35229. /** @expose */
  35230. step : function(a0) {
  35231. var args = arguments;
  35232. if (args.length == 0) {
  35233. return this.step$0();
  35234. }
  35235. return this.step$1(a0);
  35236. },
  35237. /** @expose */
  35238. majorStep : function(a0) {
  35239. var args = arguments;
  35240. if (args.length == 0) {
  35241. return this.majorStep$0();
  35242. }
  35243. return this.majorStep$1(a0);
  35244. },
  35245. /** @expose */
  35246. minorStep : function(a0) {
  35247. var args = arguments;
  35248. if (args.length == 0) {
  35249. return this.minorStep$0();
  35250. }
  35251. return this.minorStep$1(a0);
  35252. },
  35253. /** @expose */
  35254. precision : function(a0) {
  35255. var args = arguments;
  35256. if (args.length == 0) {
  35257. return this.precision$0();
  35258. }
  35259. return this.precision$1(a0);
  35260. }
  35261. //constructor : function() {}
  35262. });
  35263. /**
  35264. * Constructs and initialize the GraticuleShapeGenerator to default values
  35265. * @return (com.ibm.rave.core.geo.GraticuleShapeGenerator) the newly constructed GraticuleShapeGenerator object
  35266. */
  35267. com_ibm_rave_core_geo_GraticuleShapeGenerator.newGraticuleShapeGenerator = function() {
  35268. var graticule = new com_ibm_rave_core_geo_GraticuleShapeGenerator();
  35269. graticule.dx = 10;
  35270. graticule.dy = 10;
  35271. graticule.DX = 90;
  35272. graticule.DY = 360;
  35273. graticule.precisionValue = 2.5;
  35274. graticule.majorExtent([[-180.0, -90.0 + 1.0E-6], [180.0, 90.0 - 1.0E-6]]);
  35275. return graticule.minorExtent([[-180.0, -80.0 - 1.0E-6], [180.0, 80.0 + 1.0E-6]]);
  35276. };
  35277. // $source: com/ibm/rave/core/geo/ClipExtentStreamListenerTransform
  35278. /************************************************************************
  35279. ** IBM Confidential
  35280. **
  35281. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  35282. **
  35283. ** (C) Copyright IBM Corp. 2017
  35284. **
  35285. ** The source code for this program is not published or otherwise divested of its trade secrets,
  35286. ** irrespective of what has been deposited with the U.S. Copyright Office.
  35287. ************************************************************************/
  35288. // GENERATED
  35289. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  35290. //@import com/ibm/rave/core/internal/geo/ClipUtil (runtime) // newClipExtentStreamListenerFactory
  35291. /**
  35292. * A class representing a stream transform that implements axis-aligned rectangle clipping. This is typically used to clip geometry to the viewport after projecting.
  35293. */
  35294. var com_ibm_rave_core_geo_ClipExtentStreamListenerTransform = com_ibm_rave_core_nativeImpl_Declare({
  35295. //transformListener : null,
  35296. //clip : null,
  35297. x0 : 0, y0 : 0, x1 : 0, y1 : 0,
  35298. /**
  35299. * create the transformListener given a streamListener
  35300. * @param (com.ibm.rave.core.geo.StreamListener) listener
  35301. * @return (com.ibm.rave.core.geo.TransformStreamListener) transformListener
  35302. */
  35303. /** @expose */
  35304. stream : function(listener) {
  35305. if (this.transformListener) {
  35306. this.transformListener.valid = false;
  35307. }
  35308. this.transformListener = this.clip(listener);
  35309. this.transformListener.valid = true;
  35310. return this.transformListener;
  35311. },
  35312. /**
  35313. * Sets the clip extent to the specified rectangle [​[x0, y0], [x1, y1]​]
  35314. * @param (Array) ext the upper and lower corners of the clipping rectangle to use
  35315. * @return (com.ibm.rave.core.geo.ClipExtentStreamListenerTransform) the this clip extent transform object itself
  35316. */
  35317. extent$0 : function(ext) {
  35318. 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]));
  35319. if (this.transformListener) {
  35320. this.transformListener.valid = false;
  35321. this.transformListener = null;
  35322. }
  35323. return this;
  35324. },
  35325. /**
  35326. * Returns the current clip extent, which defaults to [​[0, 0], [960, 500]​].
  35327. * @return (Array) current clip extent
  35328. */
  35329. extent$1 : function() {
  35330. return [[this.x0, this.y0], [this.x1, this.y1]];
  35331. },
  35332. /** @expose */
  35333. extent : function(a0) {
  35334. var args = arguments;
  35335. if (args.length == 0) {
  35336. return this.extent$1();
  35337. }
  35338. return this.extent$0(a0);
  35339. }
  35340. /**
  35341. */
  35342. //constructor : function() {}
  35343. });
  35344. /**
  35345. * Create a new stream transform that implements axis-aligned rectangle clipping. This is typically used to clip geometry to the viewport after projecting.
  35346. * @return (com.ibm.rave.core.geo.ClipExtentStreamListenerTransform) the newly created clip extent
  35347. */
  35348. /** @expose */
  35349. com_ibm_rave_core_geo_ClipExtentStreamListenerTransform.newClipExtent = function() {
  35350. var clipExtent = new com_ibm_rave_core_geo_ClipExtentStreamListenerTransform();
  35351. return clipExtent.extent([[0.0, 0.0], [960.0, 500.0]]);
  35352. };
  35353. // $source: com/ibm/rave/core/internal/geo/AlbersUsaProjection
  35354. /************************************************************************
  35355. ** IBM Confidential
  35356. **
  35357. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  35358. **
  35359. ** (C) Copyright IBM Corp. 2017
  35360. **
  35361. ** The source code for this program is not published or otherwise divested of its trade secrets,
  35362. ** irrespective of what has been deposited with the U.S. Copyright Office.
  35363. ************************************************************************/
  35364. // GENERATED
  35365. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  35366. //@import com/ibm/rave/core/internal/geo/ConicProjectionFactoryImpl (runtime) // newConicEqualAreaProjectionFactory
  35367. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (runtime) // new
  35368. //@import com/ibm/rave/core/geo/StreamListener (runtime) // StreamListener
  35369. //@import com/ibm/rave/core/internal/geo/TransformStreamListenerImpl (runtime) // new
  35370. /**
  35371. */
  35372. var com_ibm_rave_core_internal_geo_AlbersUsaProjection = com_ibm_rave_core_nativeImpl_Declare({
  35373. //point : null,
  35374. //lower48 : null, //alaska : null, //hawaii : null,
  35375. //pointStream : null,
  35376. //lower48Point : null, //alaskaPoint : null, //hawaiiPoint : null,
  35377. _$functionClassMethod : function() {
  35378. var _$self = function(coordinates) {
  35379. var x = coordinates[0], y = coordinates[1];
  35380. _$self.point = null;
  35381. _$self.lower48Point(x, y, NaN);
  35382. if (_$self.point) {
  35383. return _$self.point;
  35384. }
  35385. _$self.alaskaPoint(x, y, NaN);
  35386. if (_$self.point) {
  35387. return _$self.point;
  35388. }
  35389. _$self.hawaiiPoint(x, y, NaN);
  35390. return _$self.point;
  35391. };
  35392. return _$self;
  35393. },
  35394. /**
  35395. */
  35396. constructor : function() {
  35397. var self = this;
  35398. this.lower48 = com_ibm_rave_core_internal_geo_AlbersUsaProjection.newAlbersProjection();
  35399. var cea = com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl.newConicEqualAreaProjectionFactory()();
  35400. cea.rotate([154.0, 0.0]).center([-2.0, 58.5]);
  35401. cea.parallels([55.0, 65.0]);
  35402. this.alaska = cea;
  35403. cea = com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl.newConicEqualAreaProjectionFactory()();
  35404. cea.rotate([157.0, 0.0]).center([-3.0, 19.9]);
  35405. cea.parallels([8.0, 18.0]);
  35406. this.hawaii = cea;
  35407. this.pointStream = new com_ibm_rave_core_internal_geo_DelegatingStreamListener();
  35408. this.pointStream.pointDelegate = function(x, y, z) {
  35409. self.point = [x, y];
  35410. };
  35411. },
  35412. rotate$0 : function() {
  35413. throw new Error();
  35414. },
  35415. rotate$1 : function(rotation) {
  35416. throw new Error();
  35417. },
  35418. center$0 : function() {
  35419. throw new Error();
  35420. },
  35421. center$1 : function(c) {
  35422. throw new Error();
  35423. },
  35424. clipAngle$0 : function() {
  35425. throw new Error();
  35426. },
  35427. clipAngle$1 : function(a) {
  35428. throw new Error();
  35429. },
  35430. clipExtent$0 : function() {
  35431. throw new Error();
  35432. },
  35433. clipExtent$1 : function(e) {
  35434. throw new Error();
  35435. },
  35436. /** @expose */
  35437. invert : function(coordinates) {
  35438. var k = this.lower48.scale();
  35439. var t = this.lower48.translate();
  35440. var x = (coordinates[0] - t[0]) / k;
  35441. var y = (coordinates[1] - t[1]) / k;
  35442. 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);
  35443. },
  35444. translate$0 : function() {
  35445. return this.lower48.translate();
  35446. },
  35447. translate$1 : function(t) {
  35448. var k = this.lower48.scale();
  35449. var x = + (t[0]);
  35450. var y = + (t[1]);
  35451. this.lower48Point = this.lower48.translate(t).clipExtent([[x - .455 * k, y - .238 * k], [x + .455 * k, y + .238 * k]]).stream(this.pointStream).pointDelegate;
  35452. 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;
  35453. 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;
  35454. return this;
  35455. },
  35456. scale$0 : function() {
  35457. return this.lower48.scale();
  35458. },
  35459. scale$1 : function(s) {
  35460. this.lower48.scale(s);
  35461. this.alaska.scale(+ (s) * .35);
  35462. this.hawaii.scale(s);
  35463. return this.translate$1(this.lower48.translate());
  35464. },
  35465. precision$0 : function() {
  35466. return this.lower48.precision();
  35467. },
  35468. precision$1 : function(p) {
  35469. this.lower48.precision(p);
  35470. this.alaska.precision(p);
  35471. this.hawaii.precision(p);
  35472. return this;
  35473. },
  35474. /** @expose */
  35475. stream : function(listener) {
  35476. var lower48Stream = this.lower48.stream(listener), alaskaStream = this.alaska.stream(listener), hawaiiStream = this.hawaii.stream(listener);
  35477. var delegates = {};
  35478. delegates["point"] = function(x, y, z) {
  35479. lower48Stream.point(x, y, z);
  35480. alaskaStream.point(x, y, z);
  35481. hawaiiStream.point(x, y, z);
  35482. };
  35483. delegates["sphere"] = function() {
  35484. lower48Stream.sphere();
  35485. alaskaStream.sphere();
  35486. hawaiiStream.sphere();
  35487. };
  35488. delegates["lineStart"] = function() {
  35489. lower48Stream.lineStart();
  35490. alaskaStream.lineStart();
  35491. hawaiiStream.lineStart();
  35492. };
  35493. delegates["lineEnd"] = function() {
  35494. lower48Stream.lineEnd();
  35495. alaskaStream.lineEnd();
  35496. hawaiiStream.lineEnd();
  35497. };
  35498. delegates[com_ibm_rave_core_geo_StreamListener.polygonStartHandler] = function() {
  35499. lower48Stream.polygonStart();
  35500. alaskaStream.polygonStart();
  35501. hawaiiStream.polygonStart();
  35502. };
  35503. delegates["polygonEnd"] = function() {
  35504. lower48Stream.polygonEnd();
  35505. alaskaStream.polygonEnd();
  35506. hawaiiStream.polygonEnd();
  35507. };
  35508. return new com_ibm_rave_core_internal_geo_TransformStreamListenerImpl(listener, delegates);
  35509. },
  35510. /** @expose */
  35511. supportInversion : function() {
  35512. return true;
  35513. },
  35514. /** @expose */
  35515. supportStreaming : function() {
  35516. return true;
  35517. },
  35518. /** @expose */
  35519. rotate : function(a0) {
  35520. var args = arguments;
  35521. if (args.length == 0) {
  35522. return this.rotate$0();
  35523. }
  35524. return this.rotate$1(a0);
  35525. },
  35526. /** @expose */
  35527. center : function(a0) {
  35528. var args = arguments;
  35529. if (args.length == 0) {
  35530. return this.center$0();
  35531. }
  35532. return this.center$1(a0);
  35533. },
  35534. /** @expose */
  35535. clipAngle : function(a0) {
  35536. var args = arguments;
  35537. if (args.length == 0) {
  35538. return this.clipAngle$0();
  35539. }
  35540. return this.clipAngle$1(a0);
  35541. },
  35542. /** @expose */
  35543. clipExtent : function(a0) {
  35544. var args = arguments;
  35545. if (args.length == 0) {
  35546. return this.clipExtent$0();
  35547. }
  35548. return this.clipExtent$1(a0);
  35549. },
  35550. /** @expose */
  35551. translate : function(a0) {
  35552. var args = arguments;
  35553. if (args.length == 0) {
  35554. return this.translate$0();
  35555. }
  35556. return this.translate$1(a0);
  35557. },
  35558. /** @expose */
  35559. scale : function(a0) {
  35560. var args = arguments;
  35561. if (args.length == 0) {
  35562. return this.scale$0();
  35563. }
  35564. return this.scale$1(a0);
  35565. },
  35566. /** @expose */
  35567. precision : function(a0) {
  35568. var args = arguments;
  35569. if (args.length == 0) {
  35570. return this.precision$0();
  35571. }
  35572. return this.precision$1(a0);
  35573. }
  35574. });
  35575. com_ibm_rave_core_internal_geo_AlbersUsaProjection.newAlbersUsaProjection = function() {
  35576. var a = new com_ibm_rave_core_internal_geo_AlbersUsaProjection();
  35577. a.scale$1(1070);
  35578. return a;
  35579. };
  35580. com_ibm_rave_core_internal_geo_AlbersUsaProjection.newAlbersProjection = function() {
  35581. var cea = com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl.newConicEqualAreaProjectionFactory()();
  35582. cea.rotate([96.0, 0.0]).center([-.6, 38.7]);
  35583. cea.parallels([29.5, 45.5]).scale(1070);
  35584. return cea;
  35585. };
  35586. // $source: com/ibm/rave/core/geo/Geo
  35587. /************************************************************************
  35588. ** IBM Confidential
  35589. **
  35590. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  35591. **
  35592. ** (C) Copyright IBM Corp. 2017
  35593. **
  35594. ** The source code for this program is not published or otherwise divested of its trade secrets,
  35595. ** irrespective of what has been deposited with the U.S. Copyright Office.
  35596. ************************************************************************/
  35597. // GENERATED
  35598. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  35599. //@import com/ibm/rave/core/RegistryService (loadtime) // superclass
  35600. //@import com/ibm/rave/core/internal/geo/MercatorPlaneProjectionFactory (runtime) // MercatorPlaneProjectionFactory
  35601. //@import com/ibm/rave/core/internal/geo/TransverseMercatorProjectionFactory (runtime) // TransverseMercatorProjectionFactory
  35602. //@import com/ibm/rave/core/internal/geo/PlaneProjectionFactoryImpl (runtime) // newOrthographicProjectionFactory, newEquirectangularProjectionFactory, newStereographicProjectionFactory, newGnomonicProjectionFactory, newAzimuthalEqualAreaProjectionFactory, newWinkelTripelProjectionFactory, newAzimuthalEquidistantProjectionFactory
  35603. //@import com/ibm/rave/core/internal/geo/ConicProjectionFactoryImpl (runtime) // newConicEqualAreaProjectionFactory, newConicEquidistantProjectionFactory, newConicConformalProjectionFactory
  35604. //@import com/ibm/rave/core/internal/geo/Stream (runtime) // Stream
  35605. //@import com/ibm/rave/core/internal/geo/SphericalArea (runtime) // new
  35606. //@import com/ibm/rave/core/internal/geo/SphericalBounds (runtime) // new
  35607. //@import com/ibm/rave/core/internal/geo/SphericalCentroid (runtime) // new
  35608. //@import com/ibm/rave/core/internal/geo/SphericalUtil (loadtime) // calculateDistance
  35609. //@import com/ibm/rave/core/internal/geo/SphericalLength (runtime) // new
  35610. //@import com/ibm/rave/core/internal/geo/SphericalInterpolation (loadtime) // newInterpolator
  35611. //@import com/ibm/rave/core/internal/geo/SphericalRotation (loadtime) // newRotator
  35612. //@import com/ibm/rave/core/geo/CircleShapeGenerator (loadtime) // newCircleShapeGenerator
  35613. //@import com/ibm/rave/core/geo/GreatArcShapeGenerator (loadtime) // newGreatArcShapeGenerator
  35614. //@import com/ibm/rave/core/geo/GraticuleShapeGenerator (loadtime) // newGraticuleShapeGenerator
  35615. //@import com/ibm/rave/core/geo/TransformStreamListenerFactory (loadtime) // create
  35616. //@import com/ibm/rave/core/geo/ClipExtentStreamListenerTransform (loadtime) // newClipExtent
  35617. //@import com/ibm/rave/core/internal/geo/ProjectionImpl (loadtime) // newProjection
  35618. //@import com/ibm/rave/core/internal/geo/ProjectionMutatorImpl (loadtime) // newProjectionMutator
  35619. //@import com/ibm/rave/core/internal/geo/AlbersUsaProjection (loadtime) // newAlbersProjection, newAlbersUsaProjection
  35620. //@import com/ibm/rave/core/internal/geo/GeoPathGeneratorImpl (runtime) // newGeoPathGenerator
  35621. /**
  35622. * 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.
  35623. */
  35624. var com_ibm_rave_core_geo_Geo = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_RegistryService, {
  35625. /**
  35626. * 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.
  35627. */
  35628. /** @expose */
  35629. mercator : null,
  35630. /**
  35631. * A projection factory that constructs a transverse Mercator projection
  35632. */
  35633. /** @expose */
  35634. transverseMercator : null,
  35635. /**
  35636. * A projection factory that constructs an azimuthal equal-area projection which is suitable for choropleths
  35637. */
  35638. /** @expose */
  35639. azimuthalEqualArea : null,
  35640. /**
  35641. * 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.
  35642. */
  35643. /** @expose */
  35644. azimuthalEquidistant : null,
  35645. /**
  35646. * A projection factory that constructs an equal-distance (from some standard point or line) conic projection.
  35647. */
  35648. /** @expose */
  35649. conicEquidistant : null,
  35650. /**
  35651. * 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
  35652. */
  35653. /** @expose */
  35654. conicConformal : null,
  35655. /**
  35656. * 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.
  35657. */
  35658. /** @expose */
  35659. conicEqualArea : null,
  35660. /**
  35661. * 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.
  35662. */
  35663. /** @expose */
  35664. equirectangular : null,
  35665. /**
  35666. * 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
  35667. */
  35668. /** @expose */
  35669. stereographic : null,
  35670. /**
  35671. * 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
  35672. */
  35673. /** @expose */
  35674. orthographic : null,
  35675. /**
  35676. * A projection factory that constructs a gnomonic projection. The gnomonic projection is an azimuthal projection that projects great circles as straight lines
  35677. */
  35678. /** @expose */
  35679. gnomonic : null,
  35680. /**
  35681. * A projection factory that constructs Winkel Tripel projection.
  35682. */
  35683. /** @expose */
  35684. winkel3 : null,
  35685. constructor : function() {
  35686. this.mercator = com_ibm_rave_core_internal_geo_MercatorPlaneProjectionFactory.INSTANCE;
  35687. this.transverseMercator = com_ibm_rave_core_internal_geo_TransverseMercatorProjectionFactory.INSTANCE;
  35688. this.azimuthalEqualArea = com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newAzimuthalEqualAreaProjectionFactory();
  35689. this.azimuthalEquidistant = com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newAzimuthalEquidistantProjectionFactory();
  35690. this.conicEquidistant = com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl.newConicEquidistantProjectionFactory();
  35691. this.conicConformal = com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl.newConicConformalProjectionFactory();
  35692. this.conicEqualArea = com_ibm_rave_core_internal_geo_ConicProjectionFactoryImpl.newConicEqualAreaProjectionFactory();
  35693. this.equirectangular = com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newEquirectangularProjectionFactory();
  35694. this.stereographic = com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newStereographicProjectionFactory();
  35695. this.orthographic = com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newOrthographicProjectionFactory();
  35696. this.gnomonic = com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newGnomonicProjectionFactory();
  35697. this.winkel3 = com_ibm_rave_core_internal_geo_PlaneProjectionFactoryImpl.newWinkelTripelProjectionFactory();
  35698. },
  35699. /** @expose */
  35700. getServiceId : function() {
  35701. return "Geo";
  35702. },
  35703. /**
  35704. * 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.
  35705. * @param (Object) json The GeoJSON object to stream. (A feature or geometry JSON object could be passed as well)
  35706. * @param (com.ibm.rave.core.geo.StreamListener) listener The listener to be whose methods are to be invoked as the GeoJSON object is processed
  35707. * @see (com.ibm.rave.core.internal.geo.Stream) Stream
  35708. * @see (com.ibm.rave.core.geo.StreamListener) StreamListener
  35709. */
  35710. /** @expose */
  35711. stream : function(json, listener) {
  35712. com_ibm_rave_core_internal_geo_Stream.INSTANCE.stream(json, listener);
  35713. },
  35714. /**
  35715. * Returns the spherical area of the specified feature in steradians. See also path.area, which computes the projected area on the Cartesian plane
  35716. * @param (Object) json the GeoJSON object containing the feature whose area is computed
  35717. * @return (double) the area in steradians (The unit of solid angle)
  35718. */
  35719. /** @expose */
  35720. area : function(json) {
  35721. var sphericalArea = new com_ibm_rave_core_internal_geo_SphericalArea();
  35722. return sphericalArea.calculateArea(json);
  35723. },
  35724. /**
  35725. * 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.
  35726. * @param (Object) feature the GeoJSON object containing the feature whose bounds are computed
  35727. * @return (double[][]) the spherical bounding box
  35728. */
  35729. /** @expose */
  35730. bounds : function(feature) {
  35731. var sphericalBounds = new com_ibm_rave_core_internal_geo_SphericalBounds();
  35732. return sphericalBounds.calculateBounds(feature);
  35733. },
  35734. /**
  35735. * Returns the spherical centroid of the specified feature. See also path.centroid, which computes the projected centroid on the Cartesian plane.
  35736. * @param (Object) feature the GeoJSON object containing the feature whose centroid is computed
  35737. * @return (double[]) the point representing the centroid
  35738. */
  35739. /** @expose */
  35740. centroid : function(feature) {
  35741. var sphericalCentroid = new com_ibm_rave_core_internal_geo_SphericalCentroid();
  35742. return sphericalCentroid.calculateCentroid(feature);
  35743. },
  35744. /**
  35745. * 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.
  35746. * @param (double[]) a the first point
  35747. * @param (double[]) b the second point
  35748. * @return (double) the great-arc distance
  35749. */
  35750. /** @expose */
  35751. distance : com_ibm_rave_core_internal_geo_SphericalUtil.calculateDistance,
  35752. /**
  35753. * 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.
  35754. * @param (Object) feature the GeoJSON object containing the feature whose length is computed
  35755. * @return (double) the great-arc length
  35756. */
  35757. /** @expose */
  35758. length : function(feature) {
  35759. var sphericalLength = new com_ibm_rave_core_internal_geo_SphericalLength();
  35760. return sphericalLength.calculateLength(feature);
  35761. },
  35762. /**
  35763. * 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.
  35764. * @param (double[]) source the first location
  35765. * @param (double[]) target the second location
  35766. * @return (com.ibm.rave.core.interpolate.Interpolator) the interpolator
  35767. * @see (com.ibm.rave.core.interpolate.Interpolator) Interpolator
  35768. */
  35769. /** @expose */
  35770. interpolate : com_ibm_rave_core_internal_geo_SphericalInterpolation.newInterpolator,
  35771. /**
  35772. * 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.
  35773. * @param (double[]) location the location to rotate
  35774. * @return (com.ibm.rave.core.geo.SphericalRotator) the rotator
  35775. * @see (com.ibm.rave.core.geo.SphericalRotator) SphericalRotator
  35776. */
  35777. /** @expose */
  35778. rotation : com_ibm_rave_core_internal_geo_SphericalRotation.newRotator,
  35779. /**
  35780. * Constructs a GeoJSON feature generator for creating circles centered at a given geographic location with a given radius in degrees.
  35781. * @return (com.ibm.rave.core.geo.CircleShapeGenerator) circle shape generator
  35782. * @see (com.ibm.rave.core.geo.CircleShapeGenerator) CircleShapeGenerator
  35783. */
  35784. /** @expose */
  35785. circle : com_ibm_rave_core_geo_CircleShapeGenerator.newCircleShapeGenerator,
  35786. /**
  35787. * Constructs a GeoJSON feature of type LineString generator for creating a great arc from a source point to a target point
  35788. * @return (com.ibm.rave.core.geo.GreatArcShapeGenerator) great arc shape generator
  35789. * @see (com.ibm.rave.core.geo.GreatArcShapeGenerator) GreatArcShapeGenerator
  35790. * @deprecated use {type: "LineString"} or Rave.geo.distance instead.
  35791. */
  35792. /** @expose */
  35793. greatArc : com_ibm_rave_core_geo_GreatArcShapeGenerator.newGreatArcShapeGenerator,
  35794. /**
  35795. * Constructs a GeoJSON feature generator for creating graticules.
  35796. * @return (com.ibm.rave.core.geo.GraticuleShapeGenerator) graticule shape generator
  35797. * @see (com.ibm.rave.core.geo.GraticuleShapeGenerator) GraticuleShapeGenerator
  35798. */
  35799. /** @expose */
  35800. graticule : com_ibm_rave_core_geo_GraticuleShapeGenerator.newGraticuleShapeGenerator,
  35801. /**
  35802. * 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.
  35803. * @param (Object) delegates the map containing the state handlers to be used when creating the transform stream listener
  35804. * @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
  35805. */
  35806. /** @expose */
  35807. transform : com_ibm_rave_core_geo_TransformStreamListenerFactory.create,
  35808. /**
  35809. * Create a new stream transform that implements axis-aligned rectangle clipping. This is typically used to clip geometry to the viewport after projecting.
  35810. * @return (com.ibm.rave.core.geo.ClipExtentStreamListenerTransform) the clip extent stream listener transform
  35811. */
  35812. /** @expose */
  35813. clipExtent : com_ibm_rave_core_geo_ClipExtentStreamListenerTransform.newClipExtent,
  35814. /**
  35815. * Constructs a new base projection from the specified raw point projector
  35816. * @param (com.ibm.rave.core.geo.PointProjector) projetor the point projector to use when constructing the base projection
  35817. * @return (com.ibm.rave.core.geo.Projection) the newly created base projection
  35818. */
  35819. /** @expose */
  35820. projection : com_ibm_rave_core_internal_geo_ProjectionImpl.newProjection,
  35821. /**
  35822. * 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
  35823. * @param (com.ibm.rave.core.geo.PointProjectorFactory) projectorFactory the point projector factory to use
  35824. * @return (com.ibm.rave.core.geo.ProjectionMutator) the project mutator
  35825. */
  35826. /** @expose */
  35827. projectionMutator : com_ibm_rave_core_internal_geo_ProjectionMutatorImpl.newProjectionMutator,
  35828. /**
  35829. * 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.
  35830. * @return (com.ibm.rave.core.geo.ConicProjection) the newly constructed albers projection
  35831. */
  35832. /** @expose */
  35833. albers : com_ibm_rave_core_internal_geo_AlbersUsaProjection.newAlbersProjection,
  35834. /**
  35835. * 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.
  35836. * @return (com.ibm.rave.core.geo.InvertibleProjection) the newly constructed albers-USA projection
  35837. */
  35838. /** @expose */
  35839. albersUsa : com_ibm_rave_core_internal_geo_AlbersUsaProjection.newAlbersUsaProjection,
  35840. /**
  35841. * 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.
  35842. * @return (com.ibm.rave.core.geo.GeoPathGenerator) the newly created geographic path generator
  35843. */
  35844. /** @expose */
  35845. path : function() {
  35846. return com_ibm_rave_core_internal_geo_GeoPathGeneratorImpl.newGeoPathGenerator();
  35847. }
  35848. //constructor : function() {}
  35849. });
  35850. /**
  35851. * The global singleton of the Geo component
  35852. */
  35853. /** @expose */
  35854. com_ibm_rave_core_geo_Geo.INSTANCE = new com_ibm_rave_core_geo_Geo();
  35855. // $source: com/ibm/rave/core/internal/geo/GeoPathGeneratorImpl
  35856. /************************************************************************
  35857. ** IBM Confidential
  35858. **
  35859. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  35860. **
  35861. ** (C) Copyright IBM Corp. 2017
  35862. **
  35863. ** The source code for this program is not published or otherwise divested of its trade secrets,
  35864. ** irrespective of what has been deposited with the U.S. Copyright Office.
  35865. ************************************************************************/
  35866. // GENERATED
  35867. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // bind, declare
  35868. //@import com/ibm/rave/core/internal/geo/BufferPathContextStreamListener (runtime) // new
  35869. //@import com/ibm/rave/core/internal/geo/DrawingPathContextStreamListener (runtime) // new
  35870. //@import com/ibm/rave/core/internal/geo/PathAreaStreamListener (runtime) // new
  35871. //@import com/ibm/rave/core/internal/geo/Stream (runtime) // Stream
  35872. //@import com/ibm/rave/core/internal/geo/PathCentroidStreamListener (runtime) // new
  35873. //@import com/ibm/rave/core/internal/geo/PathBoundsStreamListener (runtime) // new
  35874. //@import com/ibm/rave/core/internal/geo/TransformStreamListenerImpl (runtime) // new
  35875. //@import com/ibm/rave/core/internal/geo/ResampleStreamListenerFactory (runtime) // new
  35876. //@import com/ibm/rave/core/internal/geo/ProjectionImpl (runtime) // projectionRadians
  35877. //@import com/ibm/rave/core/scene/ISceneNode (runtime) // new
  35878. //@import com/ibm/rave/core/internal/geo/PathActionDrawingContext (runtime) // new
  35879. //@import com/ibm/rave/core/internal/geo/AlbersUsaProjection (static) // newAlbersUsaProjection
  35880. /**
  35881. */
  35882. var com_ibm_rave_core_internal_geo_GeoPathGeneratorImpl = com_ibm_rave_core_nativeImpl_Declare({
  35883. //pointRadiusValue : null,
  35884. //basicProjection : null,
  35885. //drawingContext : null,
  35886. //projectStream : null,
  35887. //contextStream : null,
  35888. //cacheStream : null,
  35889. //pathCentroid : null,
  35890. //pathArea : null,
  35891. //pathBounds : null,
  35892. _$functionClassMethod : function() {
  35893. var _$self = function(data, index, groupIndex) {
  35894. if (!(com_ibm_rave_core_nativeImpl_Object.isInstanceOf(data, Object))) {
  35895. return null;
  35896. }
  35897. var origContext = _$self.context$0();
  35898. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(this, com_ibm_rave_core_scene_ISceneNode)) {
  35899. _$self.context$1(new com_ibm_rave_core_internal_geo_PathActionDrawingContext());
  35900. }
  35901. var object = data;
  35902. if (object) {
  35903. if (!_$self.cacheStream || !(_$self.cacheStream.valid)) {
  35904. if (typeof _$self.pointRadiusValue === "function") {
  35905. _$self.contextStream.pointRadius(+ ((_$self.pointRadiusValue)(object, index)));
  35906. } else {
  35907. _$self.contextStream.pointRadius(+ (_$self.pointRadiusValue));
  35908. }
  35909. _$self.cacheStream = _$self.projectStream(_$self.contextStream);
  35910. }
  35911. com_ibm_rave_core_internal_geo_Stream.INSTANCE.stream(object, _$self.cacheStream);
  35912. }
  35913. var result = _$self.contextStream.result();
  35914. _$self.context$1(origContext);
  35915. return result;
  35916. };
  35917. return _$self;
  35918. },
  35919. constructor : function() {
  35920. this.pointRadiusValue = (4.5);
  35921. },
  35922. /**
  35923. * @return (com.ibm.rave.core.geo.DrawingContext) the context
  35924. */
  35925. context$0 : function() {
  35926. return this.drawingContext;
  35927. },
  35928. /**
  35929. * @param (com.ibm.rave.core.geo.DrawingContext) context the context to set
  35930. */
  35931. context$1 : function(context) {
  35932. this.drawingContext = context;
  35933. if (!context) {
  35934. this.contextStream = new com_ibm_rave_core_internal_geo_BufferPathContextStreamListener();
  35935. } else {
  35936. this.contextStream = new com_ibm_rave_core_internal_geo_DrawingPathContextStreamListener(context);
  35937. }
  35938. this.reset();
  35939. return this;
  35940. },
  35941. /** @expose */
  35942. area : com_ibm_rave_core_nativeImpl_Declare.bind(function(object) {
  35943. this.pathArea = new com_ibm_rave_core_internal_geo_PathAreaStreamListener();
  35944. com_ibm_rave_core_internal_geo_Stream.INSTANCE.stream(object, this.projectStream(this.pathArea));
  35945. return this.pathArea.pathAreaSum;
  35946. }),
  35947. /** @expose */
  35948. centroid : com_ibm_rave_core_nativeImpl_Declare.bind(function(object) {
  35949. this.pathCentroid = new com_ibm_rave_core_internal_geo_PathCentroidStreamListener();
  35950. com_ibm_rave_core_internal_geo_Stream.INSTANCE.stream(object, this.projectStream(this.pathCentroid));
  35951. 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];
  35952. }),
  35953. /** @expose */
  35954. bounds : function(object) {
  35955. this.pathBounds = new com_ibm_rave_core_internal_geo_PathBoundsStreamListener();
  35956. com_ibm_rave_core_internal_geo_Stream.INSTANCE.stream(object, this.projectStream(this.pathBounds));
  35957. return [[this.pathBounds.pathBoundsX0, this.pathBounds.pathBoundsY0], [this.pathBounds.pathBoundsX1, this.pathBounds.pathBoundsY1]];
  35958. },
  35959. /**
  35960. * @return (com.ibm.rave.core.geo.BasicProjection) the projection
  35961. */
  35962. projection$0 : function() {
  35963. return this.basicProjection;
  35964. },
  35965. /**
  35966. * @param (com.ibm.rave.core.geo.BasicProjection) projection the projection to set
  35967. */
  35968. projection$1 : function(projection) {
  35969. this.basicProjection = projection;
  35970. if (this.basicProjection) {
  35971. if (this.basicProjection.stream) {
  35972. var self = this;
  35973. this.projectStream = function(listener) {
  35974. return (self.basicProjection).stream(listener);
  35975. };
  35976. } else {
  35977. this.projectStream = this.pathProjectStream(projection);
  35978. }
  35979. } else {
  35980. this.projectStream = function(listener) {
  35981. return new com_ibm_rave_core_internal_geo_TransformStreamListenerImpl(listener, {});
  35982. };
  35983. }
  35984. return this.reset();
  35985. },
  35986. /**
  35987. * @return (Object) the pointRadius
  35988. */
  35989. pointRadius$0 : function() {
  35990. return this.pointRadiusValue;
  35991. },
  35992. /**
  35993. * @param (Object) value the pointRadius to set
  35994. */
  35995. pointRadius$1 : function(value) {
  35996. if (typeof value === "function") {
  35997. this.pointRadiusValue = value;
  35998. } else {
  35999. this.pointRadiusValue = + (value);
  36000. }
  36001. this.reset();
  36002. return this;
  36003. },
  36004. reset : function() {
  36005. this.cacheStream = null;
  36006. return this;
  36007. },
  36008. pathProjectStream : function(projection) {
  36009. var resampleFactory = new com_ibm_rave_core_internal_geo_ResampleStreamListenerFactory(function(x, y, z) {
  36010. return (projection([x * 57.29577951308232, y * 57.29577951308232]));
  36011. });
  36012. return function(listener) {
  36013. return com_ibm_rave_core_internal_geo_ProjectionImpl.projectionRadians(resampleFactory(listener));
  36014. };
  36015. },
  36016. /** @expose */
  36017. draw : function(path2dHandler) {},
  36018. /** @expose */
  36019. context : function(a0) {
  36020. var args = arguments;
  36021. if (args.length == 0) {
  36022. return this.context$0();
  36023. }
  36024. return this.context$1(a0);
  36025. },
  36026. /** @expose */
  36027. projection : function(a0) {
  36028. var args = arguments;
  36029. if (args.length == 0) {
  36030. return this.projection$0();
  36031. }
  36032. return this.projection$1(a0);
  36033. },
  36034. /** @expose */
  36035. pointRadius : function(a0) {
  36036. var args = arguments;
  36037. if (args.length == 0) {
  36038. return this.pointRadius$0();
  36039. }
  36040. return this.pointRadius$1(a0);
  36041. }
  36042. /**
  36043. */
  36044. //constructor : function() {}
  36045. });
  36046. com_ibm_rave_core_internal_geo_GeoPathGeneratorImpl.newGeoPathGenerator = function() {
  36047. var path = new com_ibm_rave_core_internal_geo_GeoPathGeneratorImpl();
  36048. path.projection$1(com_ibm_rave_core_internal_geo_AlbersUsaProjection.newAlbersUsaProjection()).context(null);
  36049. return path;
  36050. };
  36051. // $source: com/ibm/rave/core/internal/geo/BufferPathContextStreamListener
  36052. /************************************************************************
  36053. ** IBM Confidential
  36054. **
  36055. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  36056. **
  36057. ** (C) Copyright IBM Corp. 2017
  36058. **
  36059. ** The source code for this program is not published or otherwise divested of its trade secrets,
  36060. ** irrespective of what has been deposited with the U.S. Copyright Office.
  36061. ************************************************************************/
  36062. // GENERATED
  36063. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  36064. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (loadtime) // superclass
  36065. /**
  36066. */
  36067. var com_ibm_rave_core_internal_geo_BufferPathContextStreamListener = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_DelegatingStreamListener, {
  36068. //pointCircle : null,
  36069. //buffer : null,
  36070. constructor : function() {
  36071. this.buffer = [];
  36072. /**
  36073. */
  36074. {
  36075. this.pointCircle = this.pathBufferCircle(4.5);
  36076. var self = this;
  36077. var point = function(x, y, z) {
  36078. self.buffer.push("M", com_ibm_rave_core_internal_geo_BufferPathContextStreamListener.dblToStr(x), ",", com_ibm_rave_core_internal_geo_BufferPathContextStreamListener.dblToStr(y), self.pointCircle);
  36079. };
  36080. var pointLine = function(x, y, z) {
  36081. self.buffer.push("L", com_ibm_rave_core_internal_geo_BufferPathContextStreamListener.dblToStr(x), ",", com_ibm_rave_core_internal_geo_BufferPathContextStreamListener.dblToStr(y));
  36082. };
  36083. var pointLineStart = function(x, y, z) {
  36084. self.buffer.push("M", com_ibm_rave_core_internal_geo_BufferPathContextStreamListener.dblToStr(x), ",", com_ibm_rave_core_internal_geo_BufferPathContextStreamListener.dblToStr(y));
  36085. self.pointDelegate = pointLine;
  36086. };
  36087. var lineStart = function() {
  36088. self.pointDelegate = pointLineStart;
  36089. };
  36090. var lineEnd = function() {
  36091. self.pointDelegate = point;
  36092. };
  36093. var lineEndPolygon = function() {
  36094. self.buffer.push("Z");
  36095. };
  36096. var polygonStart = function() {
  36097. self.lineEndDelegate = lineEndPolygon;
  36098. };
  36099. var polygonEnd = function() {
  36100. self.lineEndDelegate = lineEnd;
  36101. self.pointDelegate = point;
  36102. };
  36103. this.pointDelegate = point;
  36104. this.lineStartDelegate = lineStart;
  36105. this.lineEndDelegate = lineEnd;
  36106. this.polygonStartDelegate = polygonStart;
  36107. this.polygonEndDelegate = polygonEnd;
  36108. }
  36109. },
  36110. pointRadius : function(r) {
  36111. this.pointCircle = this.pathBufferCircle(r);
  36112. return this;
  36113. },
  36114. result : function() {
  36115. if (this.buffer.length > 0) {
  36116. var result = this.buffer.join("");
  36117. this.buffer.length = 0;
  36118. return result;
  36119. }
  36120. return null;
  36121. },
  36122. pathBufferCircle : function(radius) {
  36123. var radius2 = radius * 2;
  36124. return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -radius2 + "a" + radius + "," + radius + " 0 1,1 0," + radius2 + "z";
  36125. }
  36126. });
  36127. com_ibm_rave_core_internal_geo_BufferPathContextStreamListener.dblToStr = function(d) {
  36128. var dRounded = Math.round(d * 1000.0) / 1000.0;
  36129. return (dRounded);
  36130. };
  36131. com_ibm_rave_core_internal_geo_BufferPathContextStreamListener.BLANK = "";
  36132. // $source: com/ibm/rave/core/internal/geo/DrawingPathContextStreamListener
  36133. /************************************************************************
  36134. ** IBM Confidential
  36135. **
  36136. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  36137. **
  36138. ** (C) Copyright IBM Corp. 2017
  36139. **
  36140. ** The source code for this program is not published or otherwise divested of its trade secrets,
  36141. ** irrespective of what has been deposited with the U.S. Copyright Office.
  36142. ************************************************************************/
  36143. // GENERATED
  36144. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  36145. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (loadtime) // superclass
  36146. /**
  36147. */
  36148. var com_ibm_rave_core_internal_geo_DrawingPathContextStreamListener = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_DelegatingStreamListener, {
  36149. //context : null,
  36150. pointRadiusValue : 0,
  36151. /**
  36152. */
  36153. constructor : function(context) {
  36154. this.pointRadiusValue = 4.5;
  36155. this.context = context;
  36156. var self = this;
  36157. var point = function(x, y, z) {
  36158. self.context.moveTo(x + self.pointRadiusValue, y);
  36159. self.context.arc(x, y, self.pointRadiusValue, 0, 6.283185307179586);
  36160. };
  36161. var pointLine = function(x, y, z) {
  36162. self.context.lineTo(x, y);
  36163. };
  36164. var pointLineStart = function(x, y, z) {
  36165. self.context.moveTo(x, y);
  36166. self.pointDelegate = pointLine;
  36167. };
  36168. var lineStart = function() {
  36169. self.pointDelegate = pointLineStart;
  36170. };
  36171. var lineEndPolygon = function() {
  36172. self.context.closePath();
  36173. };
  36174. var polygonStart = function() {
  36175. self.lineEndDelegate = lineEndPolygon;
  36176. };
  36177. var lineEnd = function() {
  36178. self.pointDelegate = point;
  36179. };
  36180. var polygonEnd = function() {
  36181. self.lineEndDelegate = lineEnd;
  36182. self.pointDelegate = point;
  36183. };
  36184. this.pointDelegate = point;
  36185. this.lineStartDelegate = lineStart;
  36186. this.lineEndDelegate = lineEnd;
  36187. this.polygonStartDelegate = polygonStart;
  36188. this.polygonEndDelegate = polygonEnd;
  36189. },
  36190. pointRadius : function(r) {
  36191. this.pointRadiusValue = r;
  36192. return this;
  36193. },
  36194. result : function() {
  36195. return this.context;
  36196. }
  36197. });
  36198. // $source: com/ibm/rave/core/internal/geo/PathAreaStreamListener
  36199. /************************************************************************
  36200. ** IBM Confidential
  36201. **
  36202. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  36203. **
  36204. ** (C) Copyright IBM Corp. 2017
  36205. **
  36206. ** The source code for this program is not published or otherwise divested of its trade secrets,
  36207. ** irrespective of what has been deposited with the U.S. Copyright Office.
  36208. ************************************************************************/
  36209. // GENERATED
  36210. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  36211. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (loadtime) // superclass
  36212. /**
  36213. */
  36214. var com_ibm_rave_core_internal_geo_PathAreaStreamListener = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_DelegatingStreamListener, {
  36215. pathAreaSum : 0, pathAreaPolygon : 0,
  36216. ringStart_x00 : 0, ringStart_y00 : 0, ringStart_x0 : 0, ringStart_y0 : 0,
  36217. /**
  36218. * @return (double) the pathAreaSum
  36219. */
  36220. getPathAreaSum : function() {
  36221. return this.pathAreaSum;
  36222. },
  36223. /**
  36224. */
  36225. constructor : function() {
  36226. var self = this;
  36227. var pathAreaRingStart_nextPoint = function(x, y, zz) {
  36228. self.pathAreaPolygon += self.ringStart_y0 * x - self.ringStart_x0 * y;
  36229. self.ringStart_x0 = x;
  36230. self.ringStart_y0 = y;
  36231. };
  36232. var pathAreaRingStart_point = function(x, y, z) {
  36233. self.pointDelegate = pathAreaRingStart_nextPoint;
  36234. self.ringStart_x00 = self.ringStart_x0 = x;
  36235. self.ringStart_y00 = self.ringStart_y0 = y;
  36236. };
  36237. var pathAreaRingStart_lineEnd = function() {
  36238. pathAreaRingStart_nextPoint(self.ringStart_x00, self.ringStart_y00, NaN);
  36239. };
  36240. var pathAreaRingStart = function() {
  36241. self.ringStart_x00 = self.ringStart_y00 = self.ringStart_x0 = self.ringStart_y0 = 0;
  36242. self.pointDelegate = pathAreaRingStart_point;
  36243. self.lineEndDelegate = pathAreaRingStart_lineEnd;
  36244. };
  36245. var polygonStart = function() {
  36246. self.pathAreaPolygon = 0;
  36247. self.lineStartDelegate = pathAreaRingStart;
  36248. };
  36249. var polygonEnd = function() {
  36250. self.pointDelegate = null;
  36251. self.lineStartDelegate = null;
  36252. self.lineEndDelegate = null;
  36253. self.pathAreaSum += Math.abs(self.pathAreaPolygon / 2);
  36254. };
  36255. this.polygonStartDelegate = polygonStart;
  36256. this.polygonEndDelegate = polygonEnd;
  36257. }
  36258. });
  36259. // $source: com/ibm/rave/core/internal/geo/PathCentroidStreamListener
  36260. /************************************************************************
  36261. ** IBM Confidential
  36262. **
  36263. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  36264. **
  36265. ** (C) Copyright IBM Corp. 2017
  36266. **
  36267. ** The source code for this program is not published or otherwise divested of its trade secrets,
  36268. ** irrespective of what has been deposited with the U.S. Copyright Office.
  36269. ************************************************************************/
  36270. // GENERATED
  36271. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  36272. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (loadtime) // superclass
  36273. /**
  36274. */
  36275. var com_ibm_rave_core_internal_geo_PathCentroidStreamListener = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_DelegatingStreamListener, {
  36276. centroidX0 : 0, centroidY0 : 0, centroidZ0 : 0, centroidX1 : 0, centroidY1 : 0, centroidZ1 : 0, centroidX2 : 0, centroidY2 : 0, centroidZ2 : 0,
  36277. lineStart_x0 : 0, lineStart_y0 : 0,
  36278. ringStart_x00 : 0, ringStart_y00 : 0, ringStart_x0 : 0, ringStart_y0 : 0,
  36279. /**
  36280. */
  36281. constructor : function() {
  36282. var self = this;
  36283. var centroidPoint = function(x, y, z) {
  36284. self.centroidX0 += x;
  36285. self.centroidY0 += y;
  36286. ++self.centroidZ0;
  36287. };
  36288. var centroidLineStart_nextPoint = function(x, y, zz) {
  36289. var dx = x - self.lineStart_x0, dy = y - self.lineStart_y0, z = Math.sqrt(dx * dx + dy * dy);
  36290. self.centroidX1 += z * (self.lineStart_x0 + x) / 2;
  36291. self.centroidY1 += z * (self.lineStart_y0 + y) / 2;
  36292. self.centroidZ1 += z;
  36293. centroidPoint(self.lineStart_x0 = x, self.lineStart_y0 = y, NaN);
  36294. };
  36295. var centroidLineStart_point = function(x, y, z) {
  36296. self.pointDelegate = centroidLineStart_nextPoint;
  36297. centroidPoint(self.lineStart_x0 = x, self.lineStart_y0 = y, NaN);
  36298. };
  36299. var centroidLineStart = function() {
  36300. self.lineStart_x0 = self.lineStart_y0 = 0;
  36301. self.pointDelegate = centroidLineStart_point;
  36302. };
  36303. var centroidLineEnd = function() {
  36304. self.pointDelegate = centroidPoint;
  36305. };
  36306. var centroidRingStart_nextPoint = function(x, y, zz) {
  36307. var dx = x - self.ringStart_x0, dy = y - self.ringStart_y0, z = Math.sqrt(dx * dx + dy * dy);
  36308. self.centroidX1 += z * (self.ringStart_x0 + x) / 2;
  36309. self.centroidY1 += z * (self.ringStart_y0 + y) / 2;
  36310. self.centroidZ1 += z;
  36311. z = self.ringStart_y0 * x - self.ringStart_x0 * y;
  36312. self.centroidX2 += z * (self.ringStart_x0 + x);
  36313. self.centroidY2 += z * (self.ringStart_y0 + y);
  36314. self.centroidZ2 += z * 3;
  36315. centroidPoint(self.ringStart_x0 = x, self.ringStart_y0 = y, NaN);
  36316. };
  36317. var centroidRingStart_point = function(x, y, z) {
  36318. self.pointDelegate = centroidRingStart_nextPoint;
  36319. centroidPoint(self.ringStart_x00 = self.ringStart_x0 = x, self.ringStart_y00 = self.ringStart_y0 = y, NaN);
  36320. };
  36321. var centroidRingStart_lineEnd = function() {
  36322. centroidRingStart_nextPoint(self.ringStart_x00, self.ringStart_y00, NaN);
  36323. };
  36324. var centroidRingStart = function() {
  36325. self.ringStart_x00 = self.ringStart_y00 = self.ringStart_x0 = self.ringStart_y0 = 0;
  36326. self.pointDelegate = centroidRingStart_point;
  36327. self.lineEndDelegate = centroidRingStart_lineEnd;
  36328. };
  36329. var polygonStart = function() {
  36330. self.lineStartDelegate = centroidRingStart;
  36331. };
  36332. var polygonEnd = function() {
  36333. self.pointDelegate = centroidPoint;
  36334. self.lineStartDelegate = centroidLineStart;
  36335. self.lineEndDelegate = centroidLineEnd;
  36336. };
  36337. this.pointDelegate = centroidPoint;
  36338. this.lineStartDelegate = centroidLineStart;
  36339. this.lineEndDelegate = centroidLineEnd;
  36340. this.polygonStartDelegate = polygonStart;
  36341. this.polygonEndDelegate = polygonEnd;
  36342. },
  36343. /**
  36344. * @return (double) the centroidX0
  36345. */
  36346. getCentroidX0 : function() {
  36347. return this.centroidX0;
  36348. },
  36349. /**
  36350. * @return (double) the centroidY0
  36351. */
  36352. getCentroidY0 : function() {
  36353. return this.centroidY0;
  36354. },
  36355. /**
  36356. * @return (double) the centroidZ0
  36357. */
  36358. getCentroidZ0 : function() {
  36359. return this.centroidZ0;
  36360. },
  36361. /**
  36362. * @return (double) the centroidX1
  36363. */
  36364. getCentroidX1 : function() {
  36365. return this.centroidX1;
  36366. },
  36367. /**
  36368. * @return (double) the centroidY1
  36369. */
  36370. getCentroidY1 : function() {
  36371. return this.centroidY1;
  36372. },
  36373. /**
  36374. * @return (double) the centroidZ1
  36375. */
  36376. getCentroidZ1 : function() {
  36377. return this.centroidZ1;
  36378. },
  36379. /**
  36380. * @return (double) the centroidX2
  36381. */
  36382. getCentroidX2 : function() {
  36383. return this.centroidX2;
  36384. },
  36385. /**
  36386. * @return (double) the centroidY2
  36387. */
  36388. getCentroidY2 : function() {
  36389. return this.centroidY2;
  36390. },
  36391. /**
  36392. * @return (double) the centroidZ2
  36393. */
  36394. getCentroidZ2 : function() {
  36395. return this.centroidZ2;
  36396. }
  36397. });
  36398. // $source: com/ibm/rave/core/internal/geo/PathBoundsStreamListener
  36399. /************************************************************************
  36400. ** IBM Confidential
  36401. **
  36402. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  36403. **
  36404. ** (C) Copyright IBM Corp. 2017
  36405. **
  36406. ** The source code for this program is not published or otherwise divested of its trade secrets,
  36407. ** irrespective of what has been deposited with the U.S. Copyright Office.
  36408. ************************************************************************/
  36409. // GENERATED
  36410. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  36411. //@import com/ibm/rave/core/internal/geo/DelegatingStreamListener (loadtime) // superclass
  36412. /**
  36413. */
  36414. var com_ibm_rave_core_internal_geo_PathBoundsStreamListener = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_DelegatingStreamListener, {
  36415. pathBoundsX1 : 0, pathBoundsY1 : 0, pathBoundsX0 : 0, pathBoundsY0 : 0,
  36416. /**
  36417. */
  36418. constructor : function() {
  36419. this.pathBoundsX1 = this.pathBoundsY1 = -(this.pathBoundsX0 = this.pathBoundsY0 = Infinity);
  36420. var self = this;
  36421. var point = function(x, y, z) {
  36422. if (x < self.pathBoundsX0) {
  36423. self.pathBoundsX0 = x;
  36424. }
  36425. if (x > self.pathBoundsX1) {
  36426. self.pathBoundsX1 = x;
  36427. }
  36428. if (y < self.pathBoundsY0) {
  36429. self.pathBoundsY0 = y;
  36430. }
  36431. if (y > self.pathBoundsY1) {
  36432. self.pathBoundsY1 = y;
  36433. }
  36434. };
  36435. this.pointDelegate = point;
  36436. },
  36437. /**
  36438. * @return (double) the pathBoundsX1
  36439. */
  36440. getPathBoundsX1 : function() {
  36441. return this.pathBoundsX1;
  36442. },
  36443. /**
  36444. * @return (double) the pathBoundsY1
  36445. */
  36446. getPathBoundsY1 : function() {
  36447. return this.pathBoundsY1;
  36448. },
  36449. /**
  36450. * @return (double) the pathBoundsX0
  36451. */
  36452. getPathBoundsX0 : function() {
  36453. return this.pathBoundsX0;
  36454. },
  36455. /**
  36456. * @return (double) the pathBoundsY0
  36457. */
  36458. getPathBoundsY0 : function() {
  36459. return this.pathBoundsY0;
  36460. }
  36461. });
  36462. // $source: com/ibm/rave/core/scene/ISceneNode
  36463. /************************************************************************
  36464. ** IBM Confidential
  36465. **
  36466. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  36467. **
  36468. ** (C) Copyright IBM Corp. 2017
  36469. **
  36470. ** The source code for this program is not published or otherwise divested of its trade secrets,
  36471. ** irrespective of what has been deposited with the U.S. Copyright Office.
  36472. ************************************************************************/
  36473. // GENERATED
  36474. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  36475. /**
  36476. * TODO - this interface should define the SceneNode API. Ideally, the class {@link (com.ibm.rave.core.scene.SceneNode) SceneNode} should be in the render package and this interface should be used in core in instanceof or as parameters. That way the SceneNode code itself will never end up in rave.js/Rave code jar.
  36477. */
  36478. var com_ibm_rave_core_scene_ISceneNode = rave_externs["ISceneNode"] = com_ibm_rave_core_nativeImpl_Declare.implement(
  36479. );
  36480. // $source: com/ibm/rave/core/internal/geo/PathActionDrawingContext
  36481. /************************************************************************
  36482. ** IBM Confidential
  36483. **
  36484. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  36485. **
  36486. ** (C) Copyright IBM Corp. 2017
  36487. **
  36488. ** The source code for this program is not published or otherwise divested of its trade secrets,
  36489. ** irrespective of what has been deposited with the U.S. Copyright Office.
  36490. ************************************************************************/
  36491. // GENERATED
  36492. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  36493. /**
  36494. * A data structure that holds DrawingContext commands for Path generation. For instance, a Geo Path generator may stream into this context which will create a structure holding all the actions. This can be replayed at a later time.
  36495. */
  36496. var com_ibm_rave_core_internal_geo_PathActionDrawingContext = com_ibm_rave_core_nativeImpl_Declare({
  36497. //actions : null,
  36498. constructor : function() {
  36499. this.actions = [];
  36500. },
  36501. /** @expose */
  36502. beginPath : function() {},
  36503. /** @expose */
  36504. moveTo : function(x, y) {
  36505. this.actions.push(new com_ibm_rave_core_internal_geo_PathActionDrawingContext.MovePathAction(x, y));
  36506. },
  36507. /** @expose */
  36508. lineTo : function(x, y) {
  36509. this.actions.push(new com_ibm_rave_core_internal_geo_PathActionDrawingContext.LinePathAction(x, y));
  36510. },
  36511. /** @expose */
  36512. arc : function(x, y, radius, startAngle, endAngle) {
  36513. this.actions.push(new com_ibm_rave_core_internal_geo_PathActionDrawingContext.ArcPathAction(x, y, radius, startAngle, endAngle));
  36514. },
  36515. /** @expose */
  36516. closePath : function() {}
  36517. //constructor : function() {}
  36518. });
  36519. /**
  36520. * A data structure holding path 'actions'.
  36521. */
  36522. com_ibm_rave_core_internal_geo_PathActionDrawingContext.PathAction = com_ibm_rave_core_nativeImpl_Declare({
  36523. /**
  36524. * x value of this path action.
  36525. */
  36526. x : 0,
  36527. /**
  36528. * y value of this path action.
  36529. */
  36530. y : 0,
  36531. constructor : function(x, y) {
  36532. this.x = x;
  36533. this.y = y;
  36534. }
  36535. //type : function() {}
  36536. });
  36537. com_ibm_rave_core_internal_geo_PathActionDrawingContext.MovePathAction = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_PathActionDrawingContext.PathAction, {
  36538. type : function() {
  36539. return 1;
  36540. }
  36541. //constructor : function(x, y) {}
  36542. });
  36543. com_ibm_rave_core_internal_geo_PathActionDrawingContext.LinePathAction = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_PathActionDrawingContext.PathAction, {
  36544. type : function() {
  36545. return 2;
  36546. }
  36547. //constructor : function(x, y) {}
  36548. });
  36549. com_ibm_rave_core_internal_geo_PathActionDrawingContext.ArcPathAction = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_geo_PathActionDrawingContext.PathAction, {
  36550. radius : 0,
  36551. startAngle : 0,
  36552. endAngle : 0,
  36553. constructor : function(x, y, radius, startAngle, endAngle) {
  36554. this.radius = radius;
  36555. this.startAngle = startAngle;
  36556. this.endAngle = endAngle;
  36557. },
  36558. type : function() {
  36559. return 3;
  36560. }
  36561. });
  36562. /**
  36563. * MovePathAction type.
  36564. */
  36565. com_ibm_rave_core_internal_geo_PathActionDrawingContext.PathAction.MOVE = 1;
  36566. /**
  36567. * LinePathAction type.
  36568. */
  36569. com_ibm_rave_core_internal_geo_PathActionDrawingContext.PathAction.LINE = 2;
  36570. /**
  36571. * ArcPathAction type.
  36572. */
  36573. com_ibm_rave_core_internal_geo_PathActionDrawingContext.PathAction.ARC = 3;
  36574. // $source: com/ibm/rave/core/globalization/Bidi
  36575. /************************************************************************
  36576. ** IBM Confidential
  36577. **
  36578. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  36579. **
  36580. ** (C) Copyright IBM Corp. 2017
  36581. **
  36582. ** The source code for this program is not published or otherwise divested of its trade secrets,
  36583. ** irrespective of what has been deposited with the U.S. Copyright Office.
  36584. ************************************************************************/
  36585. // GENERATED
  36586. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  36587. //@import com/ibm/rave/core/locale/Locale (runtime) // getInstance
  36588. /**
  36589. * Class that handles bidi string formatting. Uses the default Locale (en_US) object but can still format LTR, RTL and AUTO formatted strings.
  36590. * @author jim
  36591. */
  36592. var com_ibm_rave_core_globalization_Bidi = com_ibm_rave_core_nativeImpl_Declare({
  36593. /** @expose */
  36594. format : null,
  36595. constructor : function() {
  36596. this.format = com_ibm_rave_core_locale_Locale.getInstance().getDefault().bidiStringFormat;
  36597. }
  36598. //constructor : function() {}
  36599. });
  36600. /** @expose */
  36601. com_ibm_rave_core_globalization_Bidi.INSTANCE = new com_ibm_rave_core_globalization_Bidi();
  36602. // $source: com/ibm/rave/core/util/StringFormatter
  36603. /************************************************************************
  36604. ** IBM Confidential
  36605. **
  36606. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  36607. **
  36608. ** (C) Copyright IBM Corp. 2017
  36609. **
  36610. ** The source code for this program is not published or otherwise divested of its trade secrets,
  36611. ** irrespective of what has been deposited with the U.S. Copyright Office.
  36612. ************************************************************************/
  36613. // GENERATED
  36614. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  36615. /**
  36616. * The parametrization utility, which will replace {i} parameters with supplied arguments. For example: <code> Rave.formatter.format( "The quick brown {0} jumps over the lazy {1}", "fox", "dog"); </code> produces "The quick brown fox jumps over the lazy dog";
  36617. */
  36618. var com_ibm_rave_core_util_StringFormatter = com_ibm_rave_core_nativeImpl_Declare({
  36619. /**
  36620. * @param (String) pattern pattern string to use. Current formatting rules support substituting bracketed numbers as indexes into the args array. For instance this code returns true <p> <code>format("This {1} a {2}", "is", "test").equals("This is a test");</code>
  36621. * @param (java.lang.String[]) args an array of strings to be formatted based on pattern.
  36622. * @return (String) formatted string
  36623. */
  36624. /** @expose */
  36625. format : function(pattern, args) {
  36626. if (args !== null || arguments.length > 2){
  36627. args = Array.prototype.slice.call(arguments, 1);
  36628. }
  36629. {
  36630. if (!args) {
  36631. return pattern;
  36632. }
  36633. var regex = new RegExp("\\{(\\d+)\\}", "g");
  36634. var formatted = pattern;
  36635. var matched;
  36636. while ((matched = regex.exec(formatted))) {
  36637. var number = ~~ (matched[1]);
  36638. if (number < args.length) {
  36639. var match = matched[0];
  36640. formatted = formatted.replace(match, args[number]);
  36641. }
  36642. }
  36643. regex = new RegExp("'\\{'", "");
  36644. matched = null;
  36645. while ((matched = regex.exec(formatted))) {
  36646. var match = matched[0];
  36647. formatted = formatted.replace(match, "{");
  36648. }
  36649. regex = new RegExp("'\\}'", "");
  36650. matched = null;
  36651. while ((matched = regex.exec(formatted))) {
  36652. var match = matched[0];
  36653. formatted = formatted.replace(match, "}");
  36654. }
  36655. return formatted;
  36656. }
  36657. }
  36658. //constructor : function() {}
  36659. });
  36660. /** @expose */
  36661. com_ibm_rave_core_util_StringFormatter.OPEN_BRACE_ESCAPE = "'\\{'";
  36662. /** @expose */
  36663. com_ibm_rave_core_util_StringFormatter.CLOSED_BRACE_ESCAPE = "'\\}'";
  36664. /** @expose */
  36665. com_ibm_rave_core_util_StringFormatter.INSTANCE = new com_ibm_rave_core_util_StringFormatter();
  36666. // $source: com/ibm/rave/core/interpolate/Interpolate
  36667. /************************************************************************
  36668. ** IBM Confidential
  36669. **
  36670. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  36671. **
  36672. ** (C) Copyright IBM Corp. 2017
  36673. **
  36674. ** The source code for this program is not published or otherwise divested of its trade secrets,
  36675. ** irrespective of what has been deposited with the U.S. Copyright Office.
  36676. ************************************************************************/
  36677. // GENERATED
  36678. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  36679. //@import com/ibm/rave/core/interpolate/Interpolators (runtime) // Interpolators
  36680. /**
  36681. * 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.
  36682. */
  36683. var com_ibm_rave_core_interpolate_Interpolate = com_ibm_rave_core_nativeImpl_Declare({
  36684. _$functionClassMethod : function() {
  36685. var _$self = /**
  36686. * 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.
  36687. */
  36688. function(a, b) {
  36689. return com_ibm_rave_core_interpolate_Interpolators.INSTANCE.getInterpolator(a, b);
  36690. };
  36691. return _$self;
  36692. }
  36693. //constructor : function() {}
  36694. });
  36695. /** @expose */
  36696. com_ibm_rave_core_interpolate_Interpolate.INSTANCE = new com_ibm_rave_core_interpolate_Interpolate();
  36697. // $source: com/ibm/rave/core/nativeImpl/xhr/XhrIdentity
  36698. /************************************************************************
  36699. ** IBM Confidential
  36700. **
  36701. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  36702. **
  36703. ** (C) Copyright IBM Corp. 2014
  36704. **
  36705. ** The source code for this program is not published or otherwise divested of its trade secrets,
  36706. ** irrespective of what has been deposited with the U.S. Copyright Office.
  36707. ************************************************************************/
  36708. //@import com/ibm/rave/core/nativeImpl/xhr/Xhr
  36709. var com_ibm_rave_core_nativeImpl_xhr_XhrIdentity = {
  36710. INSTANCE : com_ibm_rave_core_nativeImpl_xhr_Xhr(function(request) {
  36711. return request;
  36712. })
  36713. };
  36714. // $source: com/ibm/rave/core/nativeImpl/xhr/XhrText
  36715. /************************************************************************
  36716. ** IBM Confidential
  36717. **
  36718. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  36719. **
  36720. ** (C) Copyright IBM Corp. 2014
  36721. **
  36722. ** The source code for this program is not published or otherwise divested of its trade secrets,
  36723. ** irrespective of what has been deposited with the U.S. Copyright Office.
  36724. ************************************************************************/
  36725. //@import com/ibm/rave/core/nativeImpl/xhr/Xhr
  36726. var com_ibm_rave_core_nativeImpl_xhr_XhrText = {
  36727. INSTANCE : com_ibm_rave_core_nativeImpl_xhr_Xhr(function(request) {
  36728. return request.responseText;
  36729. })
  36730. };
  36731. // $source: com/ibm/rave/core/nativeImpl/xhr/XhrJson
  36732. /************************************************************************
  36733. ** IBM Confidential
  36734. **
  36735. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  36736. **
  36737. ** (C) Copyright IBM Corp. 2014
  36738. **
  36739. ** The source code for this program is not published or otherwise divested of its trade secrets,
  36740. ** irrespective of what has been deposited with the U.S. Copyright Office.
  36741. ************************************************************************/
  36742. //@import com/ibm/rave/core/nativeImpl/xhr/Xhr
  36743. var com_ibm_rave_core_nativeImpl_xhr_XhrJson = (function() {
  36744. function rave_json(request) {
  36745. return JSON.parse(request.responseText);
  36746. };
  36747. return {
  36748. INSTANCE : function(url, callback) {
  36749. return com_ibm_rave_core_nativeImpl_xhr_Xhr.create(url, "application/json", rave_json, callback);
  36750. }
  36751. }
  36752. })();
  36753. // $source: com/ibm/rave/core/nativeImpl/xhr/XhrHtml
  36754. /************************************************************************
  36755. ** IBM Confidential
  36756. **
  36757. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  36758. **
  36759. ** (C) Copyright IBM Corp. 2014
  36760. **
  36761. ** The source code for this program is not published or otherwise divested of its trade secrets,
  36762. ** irrespective of what has been deposited with the U.S. Copyright Office.
  36763. ************************************************************************/
  36764. //@import com/ibm/rave/core/nativeImpl/xhr/Xhr
  36765. var com_ibm_rave_core_nativeImpl_xhr_XhrHtml = (function() {
  36766. function rave_html(request) {
  36767. var range = rave_document.createRange();
  36768. range.selectNode(rave_document.body);
  36769. return range.createContextualFragment(request.responseText);
  36770. };
  36771. return {
  36772. INSTANCE : function(url, callback) {
  36773. return com_ibm_rave_core_nativeImpl_xhr_Xhr.create(url, "text/html", rave_html, callback);
  36774. }
  36775. }
  36776. })();
  36777. // $source: com/ibm/rave/core/nativeImpl/xhr/XhrXml
  36778. /************************************************************************
  36779. ** IBM Confidential
  36780. **
  36781. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  36782. **
  36783. ** (C) Copyright IBM Corp. 2014
  36784. **
  36785. ** The source code for this program is not published or otherwise divested of its trade secrets,
  36786. ** irrespective of what has been deposited with the U.S. Copyright Office.
  36787. ************************************************************************/
  36788. //@import com/ibm/rave/core/nativeImpl/xhr/Xhr
  36789. var com_ibm_rave_core_nativeImpl_xhr_XhrXml = {
  36790. INSTANCE : com_ibm_rave_core_nativeImpl_xhr_Xhr(function(request) {
  36791. return request.responseXML;
  36792. })
  36793. };
  36794. // $source: com/ibm/rave/core/nativeImpl/dsv/DsvFactory
  36795. /************************************************************************
  36796. ** IBM Confidential
  36797. **
  36798. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  36799. **
  36800. ** (C) Copyright IBM Corp. 2014, 2016
  36801. **
  36802. ** The source code for this program is not published or otherwise divested of its trade secrets,
  36803. ** irrespective of what has been deposited with the U.S. Copyright Office.
  36804. ************************************************************************/
  36805. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map
  36806. //@import com/ibm/rave/core/nativeImpl/xhr/Xhr
  36807. var com_ibm_rave_core_nativeImpl_dsv_DsvFactory = function(delimiter, mimeType) {
  36808. var reFormat = new RegExp("[\"" + delimiter + "\n]"),
  36809. delimiterCode = delimiter.charCodeAt(0);
  36810. function dsv(url, row, callback) {
  36811. if (arguments.length < 3) callback = row, row = null;
  36812. var xhr = com_ibm_rave_core_nativeImpl_xhr_Xhr.create(url, mimeType, row == null ? response : typedResponse(row), callback);
  36813. /**@expose*/
  36814. xhr.row = function(_) {
  36815. return arguments.length
  36816. ? xhr.response((row = _) == null ? response : typedResponse(_))
  36817. : row;
  36818. };
  36819. return xhr;
  36820. }
  36821. function response(request) {
  36822. return dsv.parse(request.responseText);
  36823. }
  36824. function typedResponse(f) {
  36825. return function(request) {
  36826. return dsv.parse(request.responseText, f);
  36827. };
  36828. }
  36829. /**@expose*/
  36830. dsv.parse = function(text, f) {
  36831. var o;
  36832. return dsv.parseRows(text, function(row, i) {
  36833. if (o) return o(row, i - 1);
  36834. var a = new Function("d", "return {" + row.map(function(name, i) {
  36835. return JSON.stringify(name) + ": d[" + i + "]";
  36836. }).join(",") + "}");
  36837. o = f ? function(row, i) { return f(a(row), i); } : a;
  36838. });
  36839. };
  36840. /**@expose*/
  36841. dsv.parseRows = function(text, f) {
  36842. var EOL = {}, // sentinel value for end-of-line
  36843. EOF = {}, // sentinel value for end-of-file
  36844. rows = [], // output rows
  36845. N = text.length,
  36846. I = 0, // current character index
  36847. n = 0, // the current line number
  36848. t, // the current token
  36849. eol; // is the current token followed by EOL?
  36850. function token() {
  36851. if (I >= N) return EOF; // special case: end of file
  36852. if (eol) return eol = false, EOL; // special case: end of line
  36853. // special case: quotes
  36854. var j = I;
  36855. if (text.charCodeAt(j) === 34) {
  36856. var i = j;
  36857. while (i++ < N) {
  36858. if (text.charCodeAt(i) === 34) {
  36859. if (text.charCodeAt(i + 1) !== 34) break;
  36860. ++i;
  36861. }
  36862. }
  36863. I = i + 2;
  36864. var c = text.charCodeAt(i + 1);
  36865. if (c === 13) {
  36866. eol = true;
  36867. if (text.charCodeAt(i + 2) === 10) ++I;
  36868. } else if (c === 10) {
  36869. eol = true;
  36870. }
  36871. return text.slice(j + 1, i).replace(/""/g, "\"");
  36872. }
  36873. // common case: find next delimiter or newline
  36874. while (I < N) {
  36875. var c = text.charCodeAt(I++), k = 1;
  36876. if (c === 10) eol = true; // \n
  36877. else if (c === 13) { eol = true; if (text.charCodeAt(I) === 10) ++I, ++k; } // \r|\r\n
  36878. else if (c !== delimiterCode) continue;
  36879. return text.slice(j, I - k);
  36880. }
  36881. // special case: last token before EOF
  36882. return text.slice(j);
  36883. }
  36884. while ((t = token()) !== EOF) {
  36885. var a = [];
  36886. while (t !== EOL && t !== EOF) {
  36887. a.push(t);
  36888. t = token();
  36889. }
  36890. if (f && (a = f(a, n++)) == null) continue;
  36891. rows.push(a);
  36892. }
  36893. return rows;
  36894. };
  36895. /**@expose*/
  36896. dsv.format = function(rows) {
  36897. if (Array.isArray(rows[0])) return dsv.formatRows(rows); // deprecated; use formatRows
  36898. var fieldSet = new com_ibm_rave_core_nativeImpl_arrays_ES6Map, fields = [];
  36899. // Compute unique fields in order of discovery.
  36900. rows.forEach(function(row) {
  36901. for (var field in row) {
  36902. if (!fieldSet.has(field)) {
  36903. fieldSet.set(field,1)
  36904. fields.push(field);
  36905. }
  36906. }
  36907. });
  36908. return [fields.map(formatValue).join(delimiter)].concat(rows.map(function(row) {
  36909. return fields.map(function(field) {
  36910. return formatValue(row[field]);
  36911. }).join(delimiter);
  36912. })).join("\n");
  36913. };
  36914. /**@expose*/
  36915. dsv.formatRows = function(rows) {
  36916. return rows.map(formatRow).join("\n");
  36917. };
  36918. function formatRow(row) {
  36919. return row.map(formatValue).join(delimiter);
  36920. }
  36921. function formatValue(text) {
  36922. return reFormat.test(text) ? "\"" + text.replace(/\"/g, "\"\"") + "\"" : text;
  36923. }
  36924. return dsv;
  36925. };
  36926. // $source: com/ibm/rave/core/nativeImpl/dsv/Csv
  36927. /************************************************************************
  36928. ** IBM Confidential
  36929. **
  36930. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  36931. **
  36932. ** (C) Copyright IBM Corp. 2014, 2016
  36933. **
  36934. ** The source code for this program is not published or otherwise divested of its trade secrets,
  36935. ** irrespective of what has been deposited with the U.S. Copyright Office.
  36936. ************************************************************************/
  36937. //@import com/ibm/rave/core/nativeImpl/dsv/DsvFactory
  36938. var com_ibm_rave_core_nativeImpl_dsv_Csv = {
  36939. INSTANCE : com_ibm_rave_core_nativeImpl_dsv_DsvFactory(",", "text/csv")
  36940. };
  36941. // $source: com/ibm/rave/core/nativeImpl/dsv/Tsv
  36942. /************************************************************************
  36943. ** IBM Confidential
  36944. **
  36945. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  36946. **
  36947. ** (C) Copyright IBM Corp. 2014, 2016
  36948. **
  36949. ** The source code for this program is not published or otherwise divested of its trade secrets,
  36950. ** irrespective of what has been deposited with the U.S. Copyright Office.
  36951. ************************************************************************/
  36952. //@import com/ibm/rave/core/nativeImpl/dsv/DsvFactory
  36953. var com_ibm_rave_core_nativeImpl_dsv_Tsv = {
  36954. INSTANCE : com_ibm_rave_core_nativeImpl_dsv_DsvFactory("\t", "text/tab-separated-values")
  36955. };
  36956. // $source: com/ibm/rave/core/collections/MapFunctionClass
  36957. /************************************************************************
  36958. ** IBM Confidential
  36959. **
  36960. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  36961. **
  36962. ** (C) Copyright IBM Corp. 2017
  36963. **
  36964. ** The source code for this program is not published or otherwise divested of its trade secrets,
  36965. ** irrespective of what has been deposited with the U.S. Copyright Office.
  36966. ************************************************************************/
  36967. // GENERATED
  36968. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  36969. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (loadtime) // new, create
  36970. var com_ibm_rave_core_collections_MapFunctionClass = rave_externs["MapFunctionClass"] = com_ibm_rave_core_nativeImpl_Declare({
  36971. _$functionClassMethod : function() {
  36972. var _$self = function(a0, a1) {
  36973. var args = arguments;
  36974. if (args.length == 0) {
  36975. return _$self.createMap$0();
  36976. }
  36977. if (args.length == 1 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]")) {
  36978. return _$self.createMap$3(a0);
  36979. }
  36980. if (args.length == 1 && (a0 == null || com_ibm_rave_core_nativeImpl_Object.isInstanceOf(a0, com_ibm_rave_core_nativeImpl_arrays_ES6Map))) {
  36981. return _$self.createMap$2(a0);
  36982. }
  36983. if (args.length == 1) {
  36984. return _$self.createMap$1(a0);
  36985. }
  36986. return _$self.createMap$4(a0, a1);
  36987. };
  36988. return _$self;
  36989. },
  36990. /**
  36991. * @return (com.ibm.rave.core.nativeImpl.arrays.ES6Map) ES6Map.
  36992. * @see this.ES6Map#this.create()
  36993. */
  36994. createMap$0 : com_ibm_rave_core_nativeImpl_arrays_ES6Map.create,
  36995. /**
  36996. * @param (Object) map
  36997. * @return (com.ibm.rave.core.nativeImpl.arrays.ES6Map) ES6Map
  36998. * @see this.ES6Map#this.create(java_util_Map)
  36999. */
  37000. createMap$1 : com_ibm_rave_core_nativeImpl_arrays_ES6Map.create,
  37001. /**
  37002. * @param (com.ibm.rave.core.nativeImpl.arrays.ES6Map) map
  37003. * @return (com.ibm.rave.core.nativeImpl.arrays.ES6Map) ES6Map
  37004. * @see this.ES6Map#this.create(com_ibm_rave_core_nativeImpl_arrays_ES6Map)
  37005. */
  37006. createMap$2 : function(map) {
  37007. return com_ibm_rave_core_nativeImpl_arrays_ES6Map.create(map);
  37008. },
  37009. /**
  37010. * @param (Array) input value array
  37011. * @return (com.ibm.rave.core.nativeImpl.arrays.ES6Map) ES6Map
  37012. * @see this.ES6Map#this.create(com_ibm_rave_core_nativeImpl_arrays_ES6Map)
  37013. */
  37014. createMap$3 : function(input) {
  37015. var map = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  37016. if (input) {
  37017. for (var i = 0; i < input.length; ++i) {
  37018. map.set(i, input[i]);
  37019. }
  37020. }
  37021. return com_ibm_rave_core_nativeImpl_arrays_ES6Map.create(map);
  37022. },
  37023. /**
  37024. * @param (Array) input value array
  37025. * @param (com.ibm.rave.core.selector.ValueFunction) callback the accessor function to use to get the value
  37026. * @return (com.ibm.rave.core.nativeImpl.arrays.ES6Map) ES6Map
  37027. * @see this.ES6Map#this.create(com_ibm_rave_core_nativeImpl_arrays_ES6Map)
  37028. */
  37029. createMap$4 : function(input, callback) {
  37030. var len = input.length;
  37031. var map = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  37032. for (var i = 0; i < len; ++i) {
  37033. var currentValue = input[i];
  37034. if (currentValue) {
  37035. map.set(callback.call(input, currentValue, i, -1), currentValue);
  37036. }
  37037. }
  37038. return com_ibm_rave_core_nativeImpl_arrays_ES6Map.create(map);
  37039. }
  37040. });
  37041. // $source: com/ibm/rave/core/Rave
  37042. /************************************************************************
  37043. ** IBM Confidential
  37044. **
  37045. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  37046. **
  37047. ** (C) Copyright IBM Corp. 2017
  37048. **
  37049. ** The source code for this program is not published or otherwise divested of its trade secrets,
  37050. ** irrespective of what has been deposited with the U.S. Copyright Office.
  37051. ************************************************************************/
  37052. // GENERATED
  37053. //@import com/ibm/rave/core/nativeImpl/math/TransformParser (loadtime) // create
  37054. //@import com/ibm/rave/core/selector/Selector (static) // new
  37055. //@import com/ibm/rave/core/transition/Transition (loadtime) // newTransition
  37056. //@import com/ibm/rave/core/arrays/Merge (loadtime) // merge
  37057. //@import com/ibm/rave/core/arrays/MinMax (loadtime) // min, max
  37058. //@import com/ibm/rave/core/arrays/Quantile (loadtime) // quantile
  37059. //@import com/ibm/rave/core/arrays/Deviation (loadtime) // deviation
  37060. //@import com/ibm/rave/core/arrays/Variance (loadtime) // variance
  37061. //@import com/ibm/rave/core/arrays/Mean (loadtime) // mean
  37062. //@import com/ibm/rave/core/arrays/Median (loadtime) // median
  37063. //@import com/ibm/rave/core/arrays/Extent (loadtime) // extent
  37064. //@import com/ibm/rave/core/arrays/Sum (loadtime) // sum
  37065. //@import com/ibm/rave/core/arrays/Zip (loadtime) // zip
  37066. //@import com/ibm/rave/core/arrays/Permute (loadtime) // permute
  37067. //@import com/ibm/rave/core/arrays/Shuffle (loadtime) // shuffle
  37068. //@import com/ibm/rave/core/arrays/Range (loadtime) // create
  37069. //@import com/ibm/rave/core/arrays/Bisector (loadtime) // create, Bisector
  37070. //@import com/ibm/rave/core/event/Dispatcher (static) // create
  37071. //@import com/ibm/rave/core/nativeImpl/event/Mouse (loadtime) // mousePoint
  37072. //@import com/ibm/rave/core/event/TouchUtil (loadtime) // touchFromSource, touch
  37073. //@import com/ibm/rave/core/event/Touches (loadtime) // touches
  37074. //@import com/ibm/rave/core/color/Colors (loadtime) // newLAB, newRGB, newHCL, newHSL, newRGBA
  37075. //@import com/ibm/rave/core/format/Round (loadtime) // round
  37076. //@import com/ibm/rave/core/nativeImpl/format/Requote (loadtime) // requote
  37077. //@import com/ibm/rave/core/format/FormatPrefix (loadtime) // formatPrefix
  37078. //@import com/ibm/rave/core/nativeImpl/arrays/AssociativeArrays (loadtime) // entries, keys, values
  37079. //@import com/ibm/rave/core/arrays/Nest (static) // new
  37080. //@import com/ibm/rave/core/internal/nativeImpl/PlatformInitialization (static) // init, getDocument, getDocumentElement
  37081. //@import com/ibm/rave/core/arrays/Pairs (loadtime) // pairs
  37082. //@import com/ibm/rave/core/arrays/RaveSet (loadtime) // create
  37083. //@import com/ibm/rave/core/Configuration (static) // Configuration
  37084. //@import com/ibm/rave/core/util/RaveUtil (static) // getInstance
  37085. //@import com/ibm/rave/core/graphicUtils/CanvasUtil (static) // CanvasUtil
  37086. //@import com/ibm/rave/core/nativeImpl/event/EventTracker (static) // EventTracker
  37087. //@import com/ibm/rave/core/nativeImpl/timer/Timer (static) // Timer
  37088. //@import com/ibm/rave/core/geom/Geom (static) // Geom
  37089. //@import com/ibm/rave/core/scales/Scales (static) // Scales
  37090. //@import com/ibm/rave/core/layout/Layout (static) // Layout
  37091. //@import com/ibm/rave/core/capabilities/Capabilities (static) // Capabilities
  37092. //@import com/ibm/rave/core/svg/SVG (static) // getInstance
  37093. //@import com/ibm/rave/core/geo/Geo (static) // Geo
  37094. //@import com/ibm/rave/core/behavior/Behavior (static) // Behavior
  37095. //@import com/ibm/rave/core/time/Time (static) // getInstance
  37096. //@import com/ibm/rave/core/globalization/Bidi (static) // Bidi
  37097. //@import com/ibm/rave/core/util/Namespace (static) // Namespace
  37098. //@import com/ibm/rave/core/math/Random (static) // Random
  37099. //@import com/ibm/rave/core/locale/NumberFormat (static) // new
  37100. //@import com/ibm/rave/core/locale/Locale (static) // Locale, getInstance
  37101. //@import com/ibm/rave/core/util/StringFormatter (static) // StringFormatter
  37102. //@import com/ibm/rave/core/arrays/Sort (static) // Sort
  37103. //@import com/ibm/rave/core/ease/Easing (static) // Easing
  37104. //@import com/ibm/rave/core/color/Color (static) // new
  37105. //@import com/ibm/rave/core/interpolate/Interpolators (static) // Interpolators
  37106. //@import com/ibm/rave/core/interpolate/Interpolate (static) // Interpolate
  37107. //@import com/ibm/rave/core/interpolate/ColorInterpolation (static) // ColorInterpolation
  37108. //@import com/ibm/rave/core/interpolate/StringInterpolation (static) // StringInterpolation
  37109. //@import com/ibm/rave/core/interpolate/NumberInterpolation (static) // NumberInterpolation
  37110. //@import com/ibm/rave/core/interpolate/RoundInterpolation (static) // RoundInterpolation
  37111. //@import com/ibm/rave/core/interpolate/ArrayInterpolation (static) // ArrayInterpolation
  37112. //@import com/ibm/rave/core/nativeImpl/interpolate/ObjectInterpolation (static) // ObjectInterpolation
  37113. //@import com/ibm/rave/core/interpolate/TransformInterpolation (static) // TransformInterpolation
  37114. //@import com/ibm/rave/core/interpolate/ZoomInterpolation (static) // ZoomInterpolation
  37115. //@import com/ibm/rave/core/nativeImpl/xhr/XhrIdentity (static) // XhrIdentity
  37116. //@import com/ibm/rave/core/nativeImpl/xhr/XhrText (static) // XhrText
  37117. //@import com/ibm/rave/core/nativeImpl/xhr/XhrJson (static) // XhrJson
  37118. //@import com/ibm/rave/core/nativeImpl/xhr/XhrHtml (static) // XhrHtml
  37119. //@import com/ibm/rave/core/nativeImpl/xhr/XhrXml (static) // XhrXml
  37120. //@import com/ibm/rave/core/nativeImpl/dsv/DsvFactory (static) // DsvFactory
  37121. //@import com/ibm/rave/core/nativeImpl/dsv/Csv (static) // Csv
  37122. //@import com/ibm/rave/core/nativeImpl/dsv/Tsv (static) // Tsv
  37123. //@import com/ibm/rave/core/collections/MapFunctionClass (static) // new
  37124. var com_ibm_rave_core_Rave = rave_externs["Rave"] = {
  37125. //constructor : function() {}
  37126. };
  37127. /**
  37128. * @see (com.ibm.rave.core.transform.Transform) Transform
  37129. */
  37130. /** @expose */
  37131. com_ibm_rave_core_Rave.transform = com_ibm_rave_core_nativeImpl_math_TransformParser.create;
  37132. /**
  37133. * @see this.Selector#this.init(com_ibm_rave_core_scene_SceneNode)
  37134. */
  37135. com_ibm_rave_core_Rave.select$0 = function(node) {
  37136. return new com_ibm_rave_core_selector_Selector().init(node);
  37137. };
  37138. /**
  37139. * @see this.Selector#this.init(String)
  37140. */
  37141. com_ibm_rave_core_Rave.select$1 = function(query) {
  37142. return new com_ibm_rave_core_selector_Selector().init(query);
  37143. };
  37144. /**
  37145. * @see this.Selector#this.initAll(Array)
  37146. */
  37147. com_ibm_rave_core_Rave.selectAll$0 = function(nodes) {
  37148. return new com_ibm_rave_core_selector_Selector().initAll(nodes);
  37149. };
  37150. /**
  37151. * @see this.Selector#this.initAll(String)
  37152. */
  37153. com_ibm_rave_core_Rave.selectAll$1 = function(query) {
  37154. return new com_ibm_rave_core_selector_Selector().initAll(query);
  37155. };
  37156. /**
  37157. * @see this.Transition#this.newTransition()
  37158. */
  37159. com_ibm_rave_core_Rave.transition$0 = com_ibm_rave_core_transition_Transition.newTransition;
  37160. /**
  37161. * @see this.Transition#this.newTransition(com_ibm_rave_core_selector_Selection)
  37162. */
  37163. com_ibm_rave_core_Rave.transition$1 = com_ibm_rave_core_transition_Transition.newTransition;
  37164. /**
  37165. * @see this.Transition#this.newTransition(String)
  37166. */
  37167. com_ibm_rave_core_Rave.transition$2 = com_ibm_rave_core_transition_Transition.newTransition;
  37168. /**
  37169. * @see this.Transition#this.newTransition(com_ibm_rave_core_selector_Selection, String)
  37170. */
  37171. com_ibm_rave_core_Rave.transition$3 = com_ibm_rave_core_transition_Transition.newTransition;
  37172. /**
  37173. * @see this.Merge#this.merge(Array)
  37174. */
  37175. /** @expose */
  37176. com_ibm_rave_core_Rave.merge = com_ibm_rave_core_arrays_Merge.merge;
  37177. /**
  37178. * @see this.MinMax#this.max(Array)
  37179. */
  37180. com_ibm_rave_core_Rave.max$0 = com_ibm_rave_core_arrays_MinMax.max$0;
  37181. /**
  37182. * @see this.MinMax#this.max(Array, com_ibm_rave_core_selector_ValueFunction)
  37183. */
  37184. com_ibm_rave_core_Rave.max$1 = com_ibm_rave_core_arrays_MinMax.max$1;
  37185. /**
  37186. * @see this.MinMax#this.min(Array)
  37187. */
  37188. com_ibm_rave_core_Rave.min$0 = com_ibm_rave_core_arrays_MinMax.min$0;
  37189. /**
  37190. * @see this.MinMax#this.min(Array, com_ibm_rave_core_selector_ValueFunction)
  37191. */
  37192. com_ibm_rave_core_Rave.min$1 = com_ibm_rave_core_arrays_MinMax.min$1;
  37193. /**
  37194. * @see this.Quantile#this.quantile(Array, )
  37195. */
  37196. /** @expose */
  37197. com_ibm_rave_core_Rave.quantile = com_ibm_rave_core_arrays_Quantile.quantile;
  37198. /**
  37199. * @see this.Deviation#this.deviation()
  37200. */
  37201. com_ibm_rave_core_Rave.deviation$0 = com_ibm_rave_core_arrays_Deviation.deviation$0;
  37202. /**
  37203. * @see Deviation#deviation(Object[], ValueFunction).
  37204. */
  37205. com_ibm_rave_core_Rave.deviation$1 = com_ibm_rave_core_arrays_Deviation.deviation$1;
  37206. /**
  37207. * @see this.Variance#this.variance()
  37208. */
  37209. com_ibm_rave_core_Rave.variance$0 = com_ibm_rave_core_arrays_Variance.variance$0;
  37210. /**
  37211. * @see this.Variance#this.variance(, com_ibm_rave_core_selector_ValueFunction)
  37212. */
  37213. com_ibm_rave_core_Rave.variance$1 = com_ibm_rave_core_arrays_Variance.variance$1;
  37214. /**
  37215. * @see this.Mean#this.mean()
  37216. */
  37217. com_ibm_rave_core_Rave.mean$0 = com_ibm_rave_core_arrays_Mean.mean$0;
  37218. /**
  37219. * @see this.Mean#this.mean(, com_ibm_rave_core_selector_ValueFunction)
  37220. */
  37221. com_ibm_rave_core_Rave.mean$1 = com_ibm_rave_core_arrays_Mean.mean$1;
  37222. /**
  37223. * @see this.Median#this.median()
  37224. */
  37225. com_ibm_rave_core_Rave.median$0 = com_ibm_rave_core_arrays_Median.median$0;
  37226. /**
  37227. * @see this.Median#this.median(, com_ibm_rave_core_selector_ValueFunction)
  37228. */
  37229. com_ibm_rave_core_Rave.median$1 = com_ibm_rave_core_arrays_Median.median$1;
  37230. /**
  37231. * @see this.Extent#this.extent()
  37232. */
  37233. com_ibm_rave_core_Rave.extent$0 = com_ibm_rave_core_arrays_Extent.extent$0;
  37234. /**
  37235. * @see this.Extent#this.extent(, com_ibm_rave_core_selector_ValueFunction)
  37236. */
  37237. com_ibm_rave_core_Rave.extent$1 = com_ibm_rave_core_arrays_Extent.extent$1;
  37238. /**
  37239. * @see this.Sum#this.sum(Array)
  37240. */
  37241. com_ibm_rave_core_Rave.sum$0 = com_ibm_rave_core_arrays_Sum.sum$0;
  37242. /**
  37243. * @see this.Sum#this.sum(Array, com_ibm_rave_core_selector_ValueFunction)
  37244. */
  37245. com_ibm_rave_core_Rave.sum$1 = com_ibm_rave_core_arrays_Sum.sum$1;
  37246. /**
  37247. * @see this.Zip#this.zip(Array...)
  37248. */
  37249. /** @expose */
  37250. com_ibm_rave_core_Rave.zip = com_ibm_rave_core_arrays_Zip.zip;
  37251. /**
  37252. * Uses the zip operator as a two-dimensional matrix transpose.
  37253. * @see this.Zip#this.zip(Array...)
  37254. */
  37255. /** @expose */
  37256. com_ibm_rave_core_Rave.transpose = function(objects) {
  37257. return com_ibm_rave_core_arrays_Zip.zip.apply(com_ibm_rave_core_arrays_Zip, objects);
  37258. };
  37259. /**
  37260. * @see this.Permute#this.permute(Array, Array)
  37261. */
  37262. /** @expose */
  37263. com_ibm_rave_core_Rave.permute = com_ibm_rave_core_arrays_Permute.permute;
  37264. /**
  37265. * @see this.Shuffle#this.shuffle(Array)
  37266. */
  37267. com_ibm_rave_core_Rave.shuffle$0 = com_ibm_rave_core_arrays_Shuffle.shuffle$0;
  37268. /**
  37269. * @see this.Shuffle#this.shuffle(Array)
  37270. */
  37271. com_ibm_rave_core_Rave.shuffle$1 = com_ibm_rave_core_arrays_Shuffle.shuffle$1;
  37272. /**
  37273. * @see this.Shuffle#this.shuffle(Array)
  37274. */
  37275. com_ibm_rave_core_Rave.shuffle$2 = com_ibm_rave_core_arrays_Shuffle.shuffle$2;
  37276. /**
  37277. * @see this.Range#this.create(Object)
  37278. */
  37279. com_ibm_rave_core_Rave.range$0 = com_ibm_rave_core_arrays_Range.create;
  37280. /**
  37281. * @see this.Range#this.create(Object, Object)
  37282. */
  37283. com_ibm_rave_core_Rave.range$1 = com_ibm_rave_core_arrays_Range.create;
  37284. /**
  37285. * @see this.Range#this.create(Object, Object, Object)
  37286. */
  37287. com_ibm_rave_core_Rave.range$2 = com_ibm_rave_core_arrays_Range.create;
  37288. /**
  37289. * @see this.Bisector#this.create(com_ibm_rave_core_util_Comparator)
  37290. */
  37291. com_ibm_rave_core_Rave.bisector$0 = com_ibm_rave_core_arrays_Bisector.create;
  37292. /**
  37293. * @see this.Bisector#this.create(com_ibm_rave_core_functions_DoubleValueFunction)
  37294. */
  37295. com_ibm_rave_core_Rave.bisector$1 = com_ibm_rave_core_arrays_Bisector.create;
  37296. /**
  37297. * @see this.Dispatcher#this.create(String...)
  37298. */
  37299. /** @expose */
  37300. com_ibm_rave_core_Rave.dispatch = function(types) {
  37301. if (types !== null || arguments.length > 1){
  37302. types = Array.prototype.slice.call(arguments);
  37303. }
  37304. {
  37305. return com_ibm_rave_core_event_Dispatcher.create.apply(com_ibm_rave_core_event_Dispatcher, types);
  37306. }
  37307. };
  37308. /**
  37309. * @see this.Mouse#this.mousePoint(com_ibm_rave_core_scene_SceneNode)
  37310. */
  37311. /** @expose */
  37312. com_ibm_rave_core_Rave.mouse = com_ibm_rave_core_nativeImpl_event_Mouse.mousePoint;
  37313. /**
  37314. * @see this.TouchUtil#this.touch(com_ibm_rave_core_scene_SceneNode, Array, String)
  37315. */
  37316. com_ibm_rave_core_Rave.touch$0 = com_ibm_rave_core_event_TouchUtil.touch;
  37317. /**
  37318. * @see this.TouchUtil#this.touchFromSource(com_ibm_rave_core_scene_SceneNode, String)
  37319. */
  37320. com_ibm_rave_core_Rave.touch$1 = com_ibm_rave_core_event_TouchUtil.touchFromSource;
  37321. /**
  37322. * @see this.Touches#this.touches(com_ibm_rave_core_scene_SceneNode)
  37323. */
  37324. com_ibm_rave_core_Rave.touches$0 = com_ibm_rave_core_event_Touches.touches$0;
  37325. /**
  37326. * @see this.Touches#this.touches(com_ibm_rave_core_scene_SceneNode, Array)
  37327. */
  37328. com_ibm_rave_core_Rave.touches$1 = com_ibm_rave_core_event_Touches.touches$1;
  37329. /**
  37330. * @see this.Colors#this.newLAB(, , )
  37331. */
  37332. com_ibm_rave_core_Rave.lab$0 = com_ibm_rave_core_color_Colors.newLAB;
  37333. /**
  37334. * @see this.Colors#this.newLAB(Object)
  37335. */
  37336. com_ibm_rave_core_Rave.lab$1 = com_ibm_rave_core_color_Colors.newLAB;
  37337. /**
  37338. * @see this.Colors#this.newHCL(, , )
  37339. */
  37340. com_ibm_rave_core_Rave.hcl$0 = com_ibm_rave_core_color_Colors.newHCL;
  37341. /**
  37342. * @see this.Colors#this.newHCL(Object)
  37343. */
  37344. com_ibm_rave_core_Rave.hcl$1 = com_ibm_rave_core_color_Colors.newHCL;
  37345. /**
  37346. * @see this.Colors#this.newHSL(, , )
  37347. */
  37348. com_ibm_rave_core_Rave.hsl$0 = com_ibm_rave_core_color_Colors.newHSL;
  37349. /**
  37350. * @see this.Colors#this.newHSL(Object)
  37351. */
  37352. com_ibm_rave_core_Rave.hsl$1 = com_ibm_rave_core_color_Colors.newHSL;
  37353. /**
  37354. * @see this.Colors#this.newRGB(, , )
  37355. */
  37356. com_ibm_rave_core_Rave.rgb$0 = com_ibm_rave_core_color_Colors.newRGB;
  37357. /**
  37358. * @see this.Colors#this.newRGB(Object)
  37359. */
  37360. com_ibm_rave_core_Rave.rgb$1 = com_ibm_rave_core_color_Colors.newRGB;
  37361. /**
  37362. * @see this.Colors#this.newRGBA(, , , )
  37363. */
  37364. /** @expose */
  37365. com_ibm_rave_core_Rave.rgba = com_ibm_rave_core_color_Colors.newRGBA;
  37366. /**
  37367. * @see this.Round#this.round(, )
  37368. */
  37369. /** @expose */
  37370. com_ibm_rave_core_Rave.round = com_ibm_rave_core_format_Round.round;
  37371. /**
  37372. * @see this.Requote#this.requote(String)
  37373. */
  37374. /** @expose */
  37375. com_ibm_rave_core_Rave.requote = com_ibm_rave_core_nativeImpl_format_Requote.requote;
  37376. /**
  37377. * @see this.FormatPrefix#this.formatPrefix(, Number)
  37378. */
  37379. /** @expose */
  37380. com_ibm_rave_core_Rave.formatPrefix = com_ibm_rave_core_format_FormatPrefix.formatPrefix;
  37381. /**
  37382. * @see this.AssociativeArrays#this.keys(java_util_Map)
  37383. * @return (Array) list of keys for a given map
  37384. */
  37385. /** @expose */
  37386. com_ibm_rave_core_Rave.keys = com_ibm_rave_core_nativeImpl_arrays_AssociativeArrays.keys;
  37387. /**
  37388. * @see this.AssociativeArrays#this.values(java_util_Map)
  37389. * @return (Array) list of values for a given map
  37390. */
  37391. /** @expose */
  37392. com_ibm_rave_core_Rave.values = com_ibm_rave_core_nativeImpl_arrays_AssociativeArrays.values;
  37393. /**
  37394. * @see this.AssociativeArrays#this.entries(java_util_Map)
  37395. * @return (Array) list of key and value pair for a given map
  37396. */
  37397. /** @expose */
  37398. com_ibm_rave_core_Rave.entries = com_ibm_rave_core_nativeImpl_arrays_AssociativeArrays.entries;
  37399. /**
  37400. * 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.
  37401. * @return (com.ibm.rave.core.arrays.Nest) the nest operator
  37402. */
  37403. /** @expose */
  37404. com_ibm_rave_core_Rave.nest = function() {
  37405. return new com_ibm_rave_core_arrays_Nest();
  37406. };
  37407. /** @expose */
  37408. com_ibm_rave_core_Rave.selection = function() {
  37409. 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()));
  37410. };
  37411. /**
  37412. * @param (java.lang.Object[]) array
  37413. * @return (java.lang.Object[]) Object[]
  37414. * @see this.Pairs#this.pairs()
  37415. */
  37416. /** @expose */
  37417. com_ibm_rave_core_Rave.pairs = com_ibm_rave_core_arrays_Pairs.pairs;
  37418. /**
  37419. * Constructs a new set. If array is specified, adds the given array of string values to the returned set.
  37420. * @return (com.ibm.rave.core.arrays.RaveSet) a new Set
  37421. * @see this.RaveSet#this.create()
  37422. */
  37423. com_ibm_rave_core_Rave.set$0 = com_ibm_rave_core_arrays_RaveSet.create;
  37424. /**
  37425. * Constructs a new set. If array is specified, adds the given array of string values to the returned set.
  37426. * @return (com.ibm.rave.core.arrays.RaveSet) a new Set
  37427. * @see this.RaveSet#this.create()
  37428. */
  37429. com_ibm_rave_core_Rave.set$1 = com_ibm_rave_core_arrays_RaveSet.create;
  37430. /**
  37431. * Create and return an image of the chart , which contains this scene node, maintaining the current zoom level. E.g. awt implementations: <code> String tag; ImageCreatedCallback callback = new ImageCreatedCallback() { public void ready(Object arg) { BufferedImage image = (BufferedImage) arg; ... }; SceneNode node = root.select(tag).node(); Rave.getImage(node, callback); </code> the exact type of the image object depends on ImageFactory associated with the the scene node
  37432. * @param (com.ibm.rave.core.scene.SceneNode) context scene node on the chart
  37433. * @param (com.ibm.rave.core.scene.ImageCreatedCallback) callback a callback function to be called when image is ready. The call will receive image data object as an argument
  37434. * @see (com.ibm.rave.core.scene.ImageFactory) ImageFactory
  37435. * @see (com.ibm.rave.core.scene.ImageCreatedCallback) ImageCreatedCallback
  37436. */
  37437. /** @expose */
  37438. com_ibm_rave_core_Rave.getImage = function(context, callback) {
  37439. var config = com_ibm_rave_core_Configuration.INSTANCE;
  37440. var factory = config.getImageFactory(context.rave_getNamespaceURI());
  37441. if (factory) {
  37442. factory(context, callback);
  37443. }
  37444. };
  37445. /**
  37446. * Create an SVG version of the chart given the scene node and return it in the given callback. <code> String tag; ImageCreatedCallback callback = new ImageCreatedCallback() { public void ready(Object arg) { String serializedNode = (String) arg; ... }; SceneNode node = root.select(tag).node(); Rave.getSVGImage(node, callback); </code>
  37447. * @param (com.ibm.rave.core.scene.SceneNode) context scene node on the chart
  37448. * @param (com.ibm.rave.core.scene.ImageCreatedCallback) callback a callback function to be called when image is ready. The call will receive image data object as an argument
  37449. * @see (com.ibm.rave.core.scene.ImageCreatedCallback) ImageCreatedCallback
  37450. */
  37451. /** @expose */
  37452. com_ibm_rave_core_Rave.getSVGImage = function(context, callback) {
  37453. var svgHtml = context.rave_getHtml();
  37454. svgHtml = svgHtml.replace(new RegExp("<root","g"), "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"");
  37455. svgHtml = svgHtml.replace(new RegExp("</root>","g"), "</svg>");
  37456. callback(svgHtml);
  37457. };
  37458. /** @expose */
  37459. com_ibm_rave_core_Rave.select = function(a0) {
  37460. var args = arguments;
  37461. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  37462. return com_ibm_rave_core_Rave.select$1(a0);
  37463. }
  37464. return com_ibm_rave_core_Rave.select$0(a0);
  37465. };
  37466. /** @expose */
  37467. com_ibm_rave_core_Rave.selectAll = function(a0) {
  37468. var args = arguments;
  37469. if (args.length == 1 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]")) {
  37470. return com_ibm_rave_core_Rave.selectAll$0(a0);
  37471. }
  37472. return com_ibm_rave_core_Rave.selectAll$1(a0);
  37473. };
  37474. /** @expose */
  37475. com_ibm_rave_core_Rave.transition = function(a0, a1) {
  37476. var args = arguments;
  37477. if (args.length == 0) {
  37478. return com_ibm_rave_core_Rave.transition$0();
  37479. }
  37480. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  37481. return com_ibm_rave_core_Rave.transition$2(a0);
  37482. }
  37483. if (args.length == 1) {
  37484. return com_ibm_rave_core_Rave.transition$1(a0);
  37485. }
  37486. return com_ibm_rave_core_Rave.transition$3(a0, a1);
  37487. };
  37488. /** @expose */
  37489. com_ibm_rave_core_Rave.max = function(a0, a1) {
  37490. var args = arguments;
  37491. if (args.length == 1) {
  37492. return com_ibm_rave_core_Rave.max$0(a0);
  37493. }
  37494. return com_ibm_rave_core_Rave.max$1(a0, a1);
  37495. };
  37496. /** @expose */
  37497. com_ibm_rave_core_Rave.min = function(a0, a1) {
  37498. var args = arguments;
  37499. if (args.length == 1) {
  37500. return com_ibm_rave_core_Rave.min$0(a0);
  37501. }
  37502. return com_ibm_rave_core_Rave.min$1(a0, a1);
  37503. };
  37504. /** @expose */
  37505. com_ibm_rave_core_Rave.deviation = function(a0, a1) {
  37506. var args = arguments;
  37507. if (args.length == 1) {
  37508. return com_ibm_rave_core_Rave.deviation$0(a0);
  37509. }
  37510. return com_ibm_rave_core_Rave.deviation$1(a0, a1);
  37511. };
  37512. /** @expose */
  37513. com_ibm_rave_core_Rave.variance = function(a0, a1) {
  37514. var args = arguments;
  37515. if (args.length == 1) {
  37516. return com_ibm_rave_core_Rave.variance$0(a0);
  37517. }
  37518. return com_ibm_rave_core_Rave.variance$1(a0, a1);
  37519. };
  37520. /** @expose */
  37521. com_ibm_rave_core_Rave.mean = function(a0, a1) {
  37522. var args = arguments;
  37523. if (args.length == 1) {
  37524. return com_ibm_rave_core_Rave.mean$0(a0);
  37525. }
  37526. return com_ibm_rave_core_Rave.mean$1(a0, a1);
  37527. };
  37528. /** @expose */
  37529. com_ibm_rave_core_Rave.median = function(a0, a1) {
  37530. var args = arguments;
  37531. if (args.length == 1) {
  37532. return com_ibm_rave_core_Rave.median$0(a0);
  37533. }
  37534. return com_ibm_rave_core_Rave.median$1(a0, a1);
  37535. };
  37536. /** @expose */
  37537. com_ibm_rave_core_Rave.extent = function(a0, a1) {
  37538. var args = arguments;
  37539. if (args.length == 1) {
  37540. return com_ibm_rave_core_Rave.extent$0(a0);
  37541. }
  37542. return com_ibm_rave_core_Rave.extent$1(a0, a1);
  37543. };
  37544. /** @expose */
  37545. com_ibm_rave_core_Rave.sum = function(a0, a1) {
  37546. var args = arguments;
  37547. if (args.length == 1) {
  37548. return com_ibm_rave_core_Rave.sum$0(a0);
  37549. }
  37550. return com_ibm_rave_core_Rave.sum$1(a0, a1);
  37551. };
  37552. /** @expose */
  37553. com_ibm_rave_core_Rave.shuffle = function(a0, a1, a2) {
  37554. var args = arguments;
  37555. if (args.length == 1) {
  37556. return com_ibm_rave_core_Rave.shuffle$0(a0);
  37557. }
  37558. if (args.length == 2) {
  37559. return com_ibm_rave_core_Rave.shuffle$1(a0, a1);
  37560. }
  37561. return com_ibm_rave_core_Rave.shuffle$2(a0, a1, a2);
  37562. };
  37563. /** @expose */
  37564. com_ibm_rave_core_Rave.range = function(a0, a1, a2) {
  37565. var args = arguments;
  37566. if (args.length == 1) {
  37567. return com_ibm_rave_core_Rave.range$0(a0);
  37568. }
  37569. if (args.length == 2) {
  37570. return com_ibm_rave_core_Rave.range$1(a0, a1);
  37571. }
  37572. return com_ibm_rave_core_Rave.range$2(a0, a1, a2);
  37573. };
  37574. /** @expose */
  37575. com_ibm_rave_core_Rave.bisector = function(a0) {
  37576. var args = arguments;
  37577. if (args.length == 1 && typeof a0 === "function" && a0.length == 2) {
  37578. return com_ibm_rave_core_Rave.bisector$0(a0);
  37579. }
  37580. return com_ibm_rave_core_Rave.bisector$1(a0);
  37581. };
  37582. /** @expose */
  37583. com_ibm_rave_core_Rave.touch = function(a0, a1, a2) {
  37584. var args = arguments;
  37585. if (args.length == 2) {
  37586. return com_ibm_rave_core_Rave.touch$1(a0, a1);
  37587. }
  37588. return com_ibm_rave_core_Rave.touch$0(a0, a1, a2);
  37589. };
  37590. /** @expose */
  37591. com_ibm_rave_core_Rave.touches = function(a0, a1) {
  37592. var args = arguments;
  37593. if (args.length == 1) {
  37594. return com_ibm_rave_core_Rave.touches$0(a0);
  37595. }
  37596. return com_ibm_rave_core_Rave.touches$1(a0, a1);
  37597. };
  37598. /** @expose */
  37599. com_ibm_rave_core_Rave.lab = function(a0, a1, a2) {
  37600. var args = arguments;
  37601. if (args.length == 1) {
  37602. return com_ibm_rave_core_Rave.lab$1(a0);
  37603. }
  37604. return com_ibm_rave_core_Rave.lab$0(a0, a1, a2);
  37605. };
  37606. /** @expose */
  37607. com_ibm_rave_core_Rave.hcl = function(a0, a1, a2) {
  37608. var args = arguments;
  37609. if (args.length == 1) {
  37610. return com_ibm_rave_core_Rave.hcl$1(a0);
  37611. }
  37612. return com_ibm_rave_core_Rave.hcl$0(a0, a1, a2);
  37613. };
  37614. /** @expose */
  37615. com_ibm_rave_core_Rave.hsl = function(a0, a1, a2) {
  37616. var args = arguments;
  37617. if (args.length == 1) {
  37618. return com_ibm_rave_core_Rave.hsl$1(a0);
  37619. }
  37620. return com_ibm_rave_core_Rave.hsl$0(a0, a1, a2);
  37621. };
  37622. /** @expose */
  37623. com_ibm_rave_core_Rave.rgb = function(a0, a1, a2) {
  37624. var args = arguments;
  37625. if (args.length == 1) {
  37626. return com_ibm_rave_core_Rave.rgb$1(a0);
  37627. }
  37628. return com_ibm_rave_core_Rave.rgb$0(a0, a1, a2);
  37629. };
  37630. /** @expose */
  37631. com_ibm_rave_core_Rave.set = function(a0) {
  37632. var args = arguments;
  37633. if (args.length == 0) {
  37634. return com_ibm_rave_core_Rave.set$0();
  37635. }
  37636. return com_ibm_rave_core_Rave.set$1(a0);
  37637. };
  37638. {
  37639. com_ibm_rave_core_internal_nativeImpl_PlatformInitialization();
  37640. }
  37641. /** @expose */
  37642. com_ibm_rave_core_Rave.util = com_ibm_rave_core_util_RaveUtil.getInstance();
  37643. /**
  37644. * The currently registered CSS engine for this platform. May be null if the platform already includes a CSS engine (native web for instance).
  37645. * @see (com.ibm.rave.core.css.CSSEngine) CSSEngine
  37646. */
  37647. /** @expose */
  37648. com_ibm_rave_core_Rave.css = null;
  37649. /**
  37650. * @see (com.ibm.rave.core.graphicUtils.CanvasUtil) CanvasUtil
  37651. */
  37652. /** @expose */
  37653. com_ibm_rave_core_Rave.canvas = com_ibm_rave_core_graphicUtils_CanvasUtil.INSTANCE;
  37654. /**
  37655. * @see (com.ibm.rave.core.nativeImpl.event.EventTracker) EventTracker
  37656. */
  37657. /** @expose */
  37658. com_ibm_rave_core_Rave.event = com_ibm_rave_core_nativeImpl_event_EventTracker.INSTANCE;
  37659. /**
  37660. * @see (com.ibm.rave.core.Configuration) Configuration
  37661. */
  37662. /** @expose */
  37663. com_ibm_rave_core_Rave.configuration = com_ibm_rave_core_Configuration.INSTANCE;
  37664. /**
  37665. * @see (com.ibm.rave.core.nativeImpl.timer.Timer) Timer
  37666. */
  37667. /** @expose */
  37668. com_ibm_rave_core_Rave.timer = com_ibm_rave_core_nativeImpl_timer_Timer.INSTANCE;
  37669. /**
  37670. * @see (com.ibm.rave.core.geom.Geom) Geom
  37671. */
  37672. /** @expose */
  37673. com_ibm_rave_core_Rave.geom = com_ibm_rave_core_geom_Geom.INSTANCE;
  37674. /**
  37675. * @see (com.ibm.rave.core.scales.Scales) Scales
  37676. */
  37677. /** @expose */
  37678. com_ibm_rave_core_Rave.scale = com_ibm_rave_core_scales_Scales.INSTANCE;
  37679. /**
  37680. * @see (com.ibm.rave.core.layout.Layout) Layout
  37681. */
  37682. /** @expose */
  37683. com_ibm_rave_core_Rave.layout = com_ibm_rave_core_layout_Layout.INSTANCE;
  37684. /**
  37685. * @see (com.ibm.rave.core.capabilities.Capabilities) Capabilities
  37686. */
  37687. /** @expose */
  37688. com_ibm_rave_core_Rave.capabilities = com_ibm_rave_core_capabilities_Capabilities.INSTANCE;
  37689. /**
  37690. * @see (com.ibm.rave.core.svg.SVG) SVG
  37691. */
  37692. /** @expose */
  37693. com_ibm_rave_core_Rave.svg = com_ibm_rave_core_svg_SVG.getInstance();
  37694. /**
  37695. * @see (com.ibm.rave.core.geo.Geo) Geo
  37696. */
  37697. /** @expose */
  37698. com_ibm_rave_core_Rave.geo = com_ibm_rave_core_geo_Geo.INSTANCE;
  37699. /**
  37700. * @see (com.ibm.rave.core.behavior.Behavior) Behavior
  37701. */
  37702. /** @expose */
  37703. com_ibm_rave_core_Rave.behavior = com_ibm_rave_core_behavior_Behavior.INSTANCE;
  37704. /**
  37705. * @see (com.ibm.rave.core.time.Time) Time
  37706. */
  37707. /** @expose */
  37708. com_ibm_rave_core_Rave.time = com_ibm_rave_core_time_Time.getInstance();
  37709. /**
  37710. * @see (com.ibm.rave.core.globalization.Bidi) Bidi
  37711. */
  37712. /** @expose */
  37713. com_ibm_rave_core_Rave.bidi = com_ibm_rave_core_globalization_Bidi.INSTANCE;
  37714. /**
  37715. * @see (com.ibm.rave.core.util.Namespace) Namespace
  37716. */
  37717. /** @expose */
  37718. com_ibm_rave_core_Rave.ns = com_ibm_rave_core_util_Namespace.INSTANCE;
  37719. /**
  37720. * @see (com.ibm.rave.core.math.Random) Random
  37721. */
  37722. /** @expose */
  37723. com_ibm_rave_core_Rave.random = com_ibm_rave_core_math_Random.INSTANCE;
  37724. /**
  37725. * @see (com.ibm.rave.core.locale.NumberFormat) NumberFormat
  37726. */
  37727. /** @expose */
  37728. com_ibm_rave_core_Rave.format = new com_ibm_rave_core_locale_NumberFormat(com_ibm_rave_core_locale_Locale.DEFAULT_LOCALE);
  37729. /**
  37730. * @see this.StringFormatter#com_ibm_rave_core_util_StringFormatter.INSTANCE
  37731. */
  37732. /** @expose */
  37733. com_ibm_rave_core_Rave.formatter = com_ibm_rave_core_util_StringFormatter.INSTANCE;
  37734. /**
  37735. * @see this.Locale#this.locale
  37736. */
  37737. /** @expose */
  37738. com_ibm_rave_core_Rave.locale = com_ibm_rave_core_locale_Locale.getInstance();
  37739. /**
  37740. * @see this.Bisector#com_ibm_rave_core_arrays_Bisector.bisectLeft
  37741. */
  37742. /** @expose */
  37743. com_ibm_rave_core_Rave.bisectLeft = com_ibm_rave_core_arrays_Bisector.bisectLeft;
  37744. /**
  37745. * @see this.Bisector#com_ibm_rave_core_arrays_Bisector.bisectRight
  37746. */
  37747. /** @expose */
  37748. com_ibm_rave_core_Rave.bisectRight = com_ibm_rave_core_arrays_Bisector.bisectRight;
  37749. /**
  37750. * @see this.Bisector#com_ibm_rave_core_arrays_Bisector.bisect
  37751. */
  37752. /** @expose */
  37753. com_ibm_rave_core_Rave.bisect = com_ibm_rave_core_arrays_Bisector.bisect;
  37754. /**
  37755. * @see this.Sort#com_ibm_rave_core_arrays_Sort.descending
  37756. */
  37757. /** @expose */
  37758. com_ibm_rave_core_Rave.descending = com_ibm_rave_core_arrays_Sort.descending;
  37759. /**
  37760. * @see this.Sort#com_ibm_rave_core_arrays_Sort.descending
  37761. */
  37762. /** @expose */
  37763. com_ibm_rave_core_Rave.ascending = com_ibm_rave_core_arrays_Sort.ascending;
  37764. /**
  37765. * @see (com.ibm.rave.core.ease.Easing) Easing
  37766. */
  37767. /** @expose */
  37768. com_ibm_rave_core_Rave.ease = com_ibm_rave_core_ease_Easing.INSTANCE;
  37769. /**
  37770. * 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.
  37771. */
  37772. /** @expose */
  37773. com_ibm_rave_core_Rave.color = com_ibm_rave_core_color_Color;
  37774. /**
  37775. * @see (com.ibm.rave.core.interpolate.Interpolators) Interpolators
  37776. */
  37777. /** @expose */
  37778. com_ibm_rave_core_Rave.interpolators = com_ibm_rave_core_interpolate_Interpolators.INSTANCE;
  37779. /**
  37780. * @see this.Interpolate#com_ibm_rave_core_interpolate_Interpolate.INSTANCE
  37781. */
  37782. /** @expose */
  37783. com_ibm_rave_core_Rave.interpolate = com_ibm_rave_core_interpolate_Interpolate.INSTANCE;
  37784. /**
  37785. * @see this.ColorInterpolation#com_ibm_rave_core_interpolate_ColorInterpolation.HCLINSTANCE
  37786. */
  37787. /** @expose */
  37788. com_ibm_rave_core_Rave.interpolateHcl = com_ibm_rave_core_interpolate_ColorInterpolation.HCLINSTANCE;
  37789. /**
  37790. * @see this.ColorInterpolation#com_ibm_rave_core_interpolate_ColorInterpolation.HSLINSTANCE
  37791. */
  37792. /** @expose */
  37793. com_ibm_rave_core_Rave.interpolateHsl = com_ibm_rave_core_interpolate_ColorInterpolation.HSLINSTANCE;
  37794. /**
  37795. * @see this.ColorInterpolation#com_ibm_rave_core_interpolate_ColorInterpolation.LABINSTANCE
  37796. */
  37797. /** @expose */
  37798. com_ibm_rave_core_Rave.interpolateLab = com_ibm_rave_core_interpolate_ColorInterpolation.LABINSTANCE;
  37799. /**
  37800. * @see this.ColorInterpolation#com_ibm_rave_core_interpolate_ColorInterpolation.RGBINSTANCE
  37801. */
  37802. /** @expose */
  37803. com_ibm_rave_core_Rave.interpolateRgb = com_ibm_rave_core_interpolate_ColorInterpolation.RGBINSTANCE;
  37804. /**
  37805. * @see this.StringInterpolation#com_ibm_rave_core_interpolate_StringInterpolation.INSTANCE
  37806. */
  37807. /** @expose */
  37808. com_ibm_rave_core_Rave.interpolateString = com_ibm_rave_core_interpolate_StringInterpolation.INSTANCE;
  37809. /**
  37810. * @see this.NumberInterpolation#com_ibm_rave_core_interpolate_NumberInterpolation.INSTANCE
  37811. */
  37812. /** @expose */
  37813. com_ibm_rave_core_Rave.interpolateNumber = com_ibm_rave_core_interpolate_NumberInterpolation.INSTANCE;
  37814. /**
  37815. * @see this.RoundInterpolation#com_ibm_rave_core_interpolate_RoundInterpolation.INSTANCE
  37816. */
  37817. /** @expose */
  37818. com_ibm_rave_core_Rave.interpolateRound = com_ibm_rave_core_interpolate_RoundInterpolation.INSTANCE;
  37819. /**
  37820. * @see this.ArrayInterpolation#com_ibm_rave_core_interpolate_ArrayInterpolation.INSTANCE
  37821. */
  37822. /** @expose */
  37823. com_ibm_rave_core_Rave.interpolateArray = com_ibm_rave_core_interpolate_ArrayInterpolation.INSTANCE;
  37824. /**
  37825. * @see this.ObjectInterpolation#com_ibm_rave_core_nativeImpl_interpolate_ObjectInterpolation.INSTANCE
  37826. */
  37827. /** @expose */
  37828. com_ibm_rave_core_Rave.interpolateObject = com_ibm_rave_core_nativeImpl_interpolate_ObjectInterpolation.INSTANCE;
  37829. /**
  37830. * @see this.TransformInterpolation#com_ibm_rave_core_interpolate_TransformInterpolation.INSTANCE
  37831. */
  37832. /** @expose */
  37833. com_ibm_rave_core_Rave.interpolateTransform = com_ibm_rave_core_interpolate_TransformInterpolation.INSTANCE;
  37834. /**
  37835. * @see this.ZoomInterpolation#com_ibm_rave_core_interpolate_ZoomInterpolation.INSTANCE
  37836. */
  37837. /** @expose */
  37838. com_ibm_rave_core_Rave.interpolateZoom = com_ibm_rave_core_interpolate_ZoomInterpolation.INSTANCE;
  37839. /** @expose */
  37840. com_ibm_rave_core_Rave.xhr = com_ibm_rave_core_nativeImpl_xhr_XhrIdentity.INSTANCE;
  37841. /** @expose */
  37842. com_ibm_rave_core_Rave.text = com_ibm_rave_core_nativeImpl_xhr_XhrText.INSTANCE;
  37843. /** @expose */
  37844. com_ibm_rave_core_Rave.json = com_ibm_rave_core_nativeImpl_xhr_XhrJson.INSTANCE;
  37845. /** @expose */
  37846. com_ibm_rave_core_Rave.html = com_ibm_rave_core_nativeImpl_xhr_XhrHtml.INSTANCE;
  37847. /** @expose */
  37848. com_ibm_rave_core_Rave.xml = com_ibm_rave_core_nativeImpl_xhr_XhrXml.INSTANCE;
  37849. /** @expose */
  37850. com_ibm_rave_core_Rave.dsv = com_ibm_rave_core_nativeImpl_dsv_DsvFactory.INSTANCE;
  37851. /** @expose */
  37852. com_ibm_rave_core_Rave.csv = com_ibm_rave_core_nativeImpl_dsv_Csv.INSTANCE;
  37853. /** @expose */
  37854. com_ibm_rave_core_Rave.tsv = com_ibm_rave_core_nativeImpl_dsv_Tsv.INSTANCE;
  37855. /**
  37856. * Map function
  37857. */
  37858. /** @expose */
  37859. com_ibm_rave_core_Rave.map = new com_ibm_rave_core_collections_MapFunctionClass();
  37860. // $source: com/ibm/rave/core/internal/selector/mirror/MirroredSceneNodeHelper
  37861. /************************************************************************
  37862. ** IBM Confidential
  37863. **
  37864. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  37865. **
  37866. ** (C) Copyright IBM Corp. 2017
  37867. **
  37868. ** The source code for this program is not published or otherwise divested of its trade secrets,
  37869. ** irrespective of what has been deposited with the U.S. Copyright Office.
  37870. ************************************************************************/
  37871. // GENERATED
  37872. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  37873. //@import com/ibm/rave/core/internal/selector/mirror/MirrorUtil (static) // createWrappingGroup, isMirrored, hasWrappingGroup, setRawNode, getExtendableNode, getWrappingGroup, isGroupOrOwnerNode
  37874. //@import com/ibm/rave/core/internal/nativeImpl/scene/SceneNodeUtil (runtime) // getOwnerBoundingClientRect
  37875. //@import com/ibm/rave/core/internal/selector/mirror/WrappedMirroredSceneNodeHelper (static) // update
  37876. //@import com/ibm/rave/core/Configuration (static) // Configuration
  37877. //@import com/ibm/rave/core/internal/selector/mirror/MirrorConstants (static) // MirrorConstants
  37878. //@import com/ibm/rave/core/Rave (static) // select
  37879. /**
  37880. * 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.
  37881. * @author jim
  37882. */
  37883. var com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper = com_ibm_rave_core_nativeImpl_Declare({
  37884. });
  37885. /**
  37886. * Internal static method used to update mirroring positioning on a passed node. This only applies to those nodes that require special mirror wrapping.
  37887. * @param (com.ibm.rave.core.scene.SceneNode) node
  37888. */
  37889. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.update = function(node) {
  37890. if (!node) {
  37891. return;
  37892. }
  37893. var group = com_ibm_rave_core_internal_selector_mirror_MirrorUtil.getWrappingGroup(node);
  37894. if (group != null) {
  37895. var translateWidth = com_ibm_rave_core_internal_nativeImpl_scene_SceneNodeUtil.getOwnerBoundingClientRect(node).width;
  37896. (group).setAttribute("transform", "translate(" + translateWidth + ",0)" + " scale(-1,1)");
  37897. } else {
  37898. switch (node.rave_getDrawType()) {
  37899. case 1003:
  37900. case 1007:
  37901. com_ibm_rave_core_internal_selector_mirror_WrappedMirroredSceneNodeHelper.update(node);
  37902. break;
  37903. default:
  37904. break;
  37905. }
  37906. }
  37907. };
  37908. /**
  37909. * Perform a mirroring operation on a passed in node.
  37910. * @param node The node to be mirrored.
  37911. */
  37912. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.mirrorNode$0 = function(context) {
  37913. var node = com_ibm_rave_core_internal_selector_mirror_MirrorUtil.getExtendableNode(context);
  37914. if (!(com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isMirrored(node))) {
  37915. node.rave_setProperty("__rave-mirrored__", true);
  37916. com_ibm_rave_core_Configuration.INSTANCE.extend(node, null);
  37917. context.rave_setProperty("__rave-mirrored__", true);
  37918. }
  37919. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(node, true);
  37920. var children = [];
  37921. for (var __i_enFor0 = 0, __exp_enFor0 = node.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  37922. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  37923. var child = __exp_enFor0[__i_enFor0];
  37924. children.push(child);
  37925. }
  37926. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(node, false);
  37927. for (var __i_enFor1 = 0, __exp_enFor1 = children, __len_enFor1 = __exp_enFor1.length;
  37928. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  37929. var child = __exp_enFor1[__i_enFor1];
  37930. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.mirrorNode$0(child);
  37931. }
  37932. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.update(node);
  37933. };
  37934. /**
  37935. * Perform an 'un' mirroring of the passed in node. Recursively removes all mirroring properties.
  37936. * @param node Node to recursively 'un'-mirror.
  37937. */
  37938. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.unMirrorNode = function(context) {
  37939. var node = com_ibm_rave_core_internal_selector_mirror_MirrorUtil.getExtendableNode(context);
  37940. if (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.hasWrappingGroup(node)) {
  37941. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper._unmirrorOwnerNode(node);
  37942. }
  37943. node.rave_setProperty("__rave-mirrored__", null);
  37944. context.rave_setProperty("__rave-mirrored__", null);
  37945. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(node, true);
  37946. var children = [];
  37947. for (var __i_enFor0 = 0, __exp_enFor0 = node.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  37948. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  37949. var child = __exp_enFor0[__i_enFor0];
  37950. children.push(child);
  37951. }
  37952. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(node, false);
  37953. for (var __i_enFor1 = 0, __exp_enFor1 = children, __len_enFor1 = __exp_enFor1.length;
  37954. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  37955. var child = __exp_enFor1[__i_enFor1];
  37956. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.unMirrorNode(child);
  37957. }
  37958. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.update(node);
  37959. };
  37960. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper._unmirrorOwnerNode = function(node) {
  37961. var group = com_ibm_rave_core_internal_selector_mirror_MirrorUtil.getWrappingGroup(node);
  37962. if (group != null) {
  37963. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(node, true);
  37964. var groupNode = group;
  37965. groupNode.rave_setProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.MIRRORED_GROUP_PROPERTY, null);
  37966. var existingChildren = [];
  37967. for (var __i_enFor0 = 0, __exp_enFor0 = groupNode.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  37968. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  37969. var child = __exp_enFor0[__i_enFor0];
  37970. existingChildren.push(child);
  37971. }
  37972. for (var __i_enFor1 = 0, __exp_enFor1 = existingChildren, __len_enFor1 = __exp_enFor1.length;
  37973. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  37974. var child = __exp_enFor1[__i_enFor1];
  37975. node.rave_appendChild(child);
  37976. }
  37977. com_ibm_rave_core_Rave.select(groupNode).remove();
  37978. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.setRawNode(node, false);
  37979. }
  37980. node.rave_setProperty("__rave-mirrored__", null);
  37981. node.rave_setProperty(com_ibm_rave_core_internal_selector_mirror_MirrorConstants.GROUP_NODE_PROPERTY, null);
  37982. };
  37983. /**
  37984. * Mirror or un-mirror scene node
  37985. * @param (com.ibm.rave.core.scene.SceneNode) context Scene node to mirror or un-mirror
  37986. * @param (boolean) mirror true if node to be mirrored, false to un-mirror the node
  37987. */
  37988. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.mirrorNode$1 = function(context, mirror) {
  37989. if (mirror) {
  37990. if (com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isGroupOrOwnerNode(context)) {
  37991. if (!(com_ibm_rave_core_internal_selector_mirror_MirrorUtil.isMirrored(context))) {
  37992. if (!(com_ibm_rave_core_internal_selector_mirror_MirrorUtil.hasWrappingGroup(context))) {
  37993. com_ibm_rave_core_internal_selector_mirror_MirrorUtil.createWrappingGroup(context);
  37994. }
  37995. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.mirrorNode$0(context);
  37996. }
  37997. }
  37998. } else {
  37999. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.unMirrorNode(context);
  38000. }
  38001. };
  38002. com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.mirrorNode = function(a0, a1) {
  38003. var args = arguments;
  38004. if (args.length == 1) {
  38005. return com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.mirrorNode$0(a0);
  38006. }
  38007. return com_ibm_rave_core_internal_selector_mirror_MirroredSceneNodeHelper.mirrorNode$1(a0, a1);
  38008. };
  38009. // $source: com/ibm/rave/core/scales/LinearScale
  38010. /************************************************************************
  38011. ** IBM Confidential
  38012. **
  38013. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  38014. **
  38015. ** (C) Copyright IBM Corp. 2018
  38016. **
  38017. ** The source code for this program is not published or otherwise divested of its trade secrets,
  38018. ** irrespective of what has been deposited with the U.S. Copyright Office.
  38019. ************************************************************************/
  38020. // GENERATED
  38021. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // bind, declare
  38022. //@import com/ibm/rave/core/scales/AbstractScale (loadtime) // scaleExtent, superclass
  38023. //@import com/ibm/rave/core/Rave (static) // Rave, range, formatPrefix
  38024. //@import com/ibm/rave/core/internal/scales/Polylinear (runtime) // new
  38025. //@import com/ibm/rave/core/internal/scales/Bilinear (runtime) // new
  38026. //@import com/ibm/rave/core/internal/interpolate/UninterpolateClamp (runtime) // new
  38027. //@import com/ibm/rave/core/internal/interpolate/UninterpolateNumber (runtime) // new
  38028. //@import com/ibm/rave/core/interpolate/RoundInterpolation (runtime) // new
  38029. //@import com/ibm/rave/core/internal/scales/Nice (static) // scaleNice, niceStep
  38030. //@import com/ibm/rave/core/locale/NumberFormat (runtime) // NumberFormat
  38031. //@import com/ibm/rave/core/nativeImpl/arrays/ES6Map (runtime) // create
  38032. /**
  38033. * 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].
  38034. */
  38035. var com_ibm_rave_core_scales_LinearScale = rave_externs["LinearScale"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scales_AbstractScale, {
  38036. //_domain : null,
  38037. //_range : null,
  38038. /** @expose */
  38039. _interpolate : null,
  38040. //output : null,
  38041. /** @expose */
  38042. input : null,
  38043. /** @expose */
  38044. _clamp : false,
  38045. _$functionClassMethod : function() {
  38046. var _$self = function(data, index, groupIndex) {
  38047. return _$self.output(data);
  38048. };
  38049. return _$self;
  38050. },
  38051. constructor : function(domain, range, interpolate, clamp) {
  38052. this._domain = [0, 1];
  38053. this._range = [0, 1];
  38054. this._interpolate = com_ibm_rave_core_Rave.interpolate;
  38055. /**
  38056. * @param (Array) domain
  38057. * @param (Array) range
  38058. * @param (com.ibm.rave.core.interpolate.InterpolatorFactory) interpolate
  38059. * @param (java.lang.Boolean) clamp
  38060. */
  38061. {
  38062. if (domain) {
  38063. this.domain(domain);
  38064. }
  38065. if (range) {
  38066. this.range(range);
  38067. }
  38068. if (interpolate) {
  38069. this._interpolate = interpolate;
  38070. }
  38071. if (clamp != null) {
  38072. this._clamp = clamp;
  38073. }
  38074. var self = this;
  38075. this.invert = function(y) {
  38076. return self.input(y);
  38077. };
  38078. this.ticks = function(tickArguments) {
  38079. if (tickArguments !== null || arguments.length > 1){
  38080. tickArguments = Array.prototype.slice.call(arguments);
  38081. }
  38082. {
  38083. return com_ibm_rave_core_scales_LinearScale.linearTicks.apply(this, [self._domain].concat(tickArguments));
  38084. }
  38085. };
  38086. this.tickFormat = function(tickArguments) {
  38087. if (tickArguments !== null || arguments.length > 1){
  38088. tickArguments = Array.prototype.slice.call(arguments);
  38089. }
  38090. {
  38091. var count = tickArguments.length > 0 ? + (tickArguments[0]) : null;
  38092. var format = tickArguments.length > 1 ? tickArguments[1] : null;
  38093. return com_ibm_rave_core_scales_LinearScale.linearTickFormat(self._domain, count, ((typeof format === "string" || format instanceof String)) ? format : null);
  38094. }
  38095. };
  38096. this.rescale();
  38097. }
  38098. },
  38099. rescale : function() {
  38100. 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();
  38101. var uninterpolator = this._clamp ? new com_ibm_rave_core_internal_interpolate_UninterpolateClamp() : new com_ibm_rave_core_internal_interpolate_UninterpolateNumber();
  38102. this.output = linear(this._domain, this._range, uninterpolator, this._interpolate);
  38103. this.input = linear(this._range, this._domain, uninterpolator, com_ibm_rave_core_Rave.interpolate);
  38104. return this;
  38105. },
  38106. domain$0 : function(values) {
  38107. this._domain = [];
  38108. for (var __i_enFor0 = 0, __exp_enFor0 = values, __len_enFor0 = __exp_enFor0.length;
  38109. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  38110. var o = __exp_enFor0[__i_enFor0];
  38111. this._domain.push(+ (o));
  38112. }
  38113. return this.rescale();
  38114. },
  38115. domain$1 : function() {
  38116. return this._domain;
  38117. },
  38118. range$0 : function(values) {
  38119. this._range = [];
  38120. for (var __i_enFor0 = 0, __exp_enFor0 = values, __len_enFor0 = __exp_enFor0.length;
  38121. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  38122. var o = __exp_enFor0[__i_enFor0];
  38123. this._range.push(o);
  38124. }
  38125. return this.rescale();
  38126. },
  38127. range$1 : function() {
  38128. return this._range;
  38129. },
  38130. /**
  38131. * 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.
  38132. * @param (Array) x Output range values.
  38133. * @return (com.ibm.rave.core.scales.LinearScale) This scale.
  38134. */
  38135. /** @expose */
  38136. rangeRound : function(x) {
  38137. return this.range(x).interpolate(new com_ibm_rave_core_interpolate_RoundInterpolation());
  38138. },
  38139. /**
  38140. * 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.
  38141. * @param (boolean) c True or False to Enable or Disable (respectively) clamping.
  38142. * @return (com.ibm.rave.core.scales.LinearScale) This scale.
  38143. */
  38144. clamp$0 : function(c) {
  38145. this._clamp = c;
  38146. return this.rescale();
  38147. },
  38148. /**
  38149. * 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.
  38150. * @return (boolean) True if clamping is enabled, false otherwise.
  38151. */
  38152. clamp$1 : function() {
  38153. return this._clamp;
  38154. },
  38155. /**
  38156. * 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.
  38157. * @param (com.ibm.rave.core.interpolate.InterpolatorFactory) interpolate The interpolator factory to assign to this scale.
  38158. * @return (com.ibm.rave.core.scales.LinearScale) this
  38159. */
  38160. interpolate$0 : function(interpolate) {
  38161. this._interpolate = interpolate;
  38162. return this.rescale();
  38163. },
  38164. /**
  38165. * 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.
  38166. * @return (Object) The interpolator factory assigned to this scale.
  38167. */
  38168. interpolate$1 : function() {
  38169. return this._interpolate;
  38170. },
  38171. /**
  38172. * 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.
  38173. * @return (com.ibm.rave.core.scales.LinearScale) this
  38174. */
  38175. nice$0 : function() {
  38176. com_ibm_rave_core_scales_LinearScale.linearNice(this._domain, 10);
  38177. return this.rescale();
  38178. },
  38179. /**
  38180. * 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.
  38181. * @param (Number) tickCount
  38182. * @return (com.ibm.rave.core.scales.LinearScale) this
  38183. */
  38184. nice$1 : function(tickCount) {
  38185. com_ibm_rave_core_scales_LinearScale.linearNice(this._domain, tickCount);
  38186. return this.rescale();
  38187. },
  38188. /**
  38189. * Extends the domain so that it starts and ends on nice values of 10 ^ <code>magnitude</code> This method typically modifies the scale's domain, and may only extend the bounds to the nearest value of 10 ^ <code>magnitude</code>.
  38190. * @param (Number) tickCount The 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.
  38191. * @param magnitude magnitude argument allows to control the tick interval. Each tick will be a multiple of 10 ^ <code>magnitude</code>.
  38192. * @return (com.ibm.rave.core.scales.LinearScale) this
  38193. */
  38194. nice$2 : function(tickCount, magnitidue) {
  38195. if (tickCount == null) {
  38196. tickCount = 10;
  38197. }
  38198. com_ibm_rave_core_internal_scales_Nice.scaleNice(this._domain, com_ibm_rave_core_internal_scales_Nice.niceStep(com_ibm_rave_core_scales_LinearScale.linearTickRange(this._domain, tickCount, magnitidue)[2]));
  38199. return this.rescale();
  38200. },
  38201. /**
  38202. * 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.
  38203. * @param (Number) tickCount
  38204. * @return (com.ibm.rave.core.scales.LinearScale) this
  38205. */
  38206. nice$3 : function(interval, tickCount) {
  38207. return null;
  38208. },
  38209. nice$4 : function(interval) {
  38210. return null;
  38211. },
  38212. /** @expose */
  38213. copy : com_ibm_rave_core_nativeImpl_Declare.bind(function() {
  38214. return new com_ibm_rave_core_scales_LinearScale(this.domain(), this.range(), this._interpolate, this._clamp);
  38215. }),
  38216. /** @expose */
  38217. domain : function(a0) {
  38218. var args = arguments;
  38219. if (args.length == 0) {
  38220. return this.domain$1();
  38221. }
  38222. return this.domain$0(a0);
  38223. },
  38224. /** @expose */
  38225. range : function(a0) {
  38226. var args = arguments;
  38227. if (args.length == 0) {
  38228. return this.range$1();
  38229. }
  38230. return this.range$0(a0);
  38231. },
  38232. /** @expose */
  38233. clamp : function(a0) {
  38234. var args = arguments;
  38235. if (args.length == 0) {
  38236. return this.clamp$1();
  38237. }
  38238. return this.clamp$0(a0);
  38239. },
  38240. /** @expose */
  38241. interpolate : function(a0) {
  38242. var args = arguments;
  38243. if (args.length == 0) {
  38244. return this.interpolate$1();
  38245. }
  38246. return this.interpolate$0(a0);
  38247. },
  38248. /** @expose */
  38249. nice : function(a0, a1) {
  38250. var args = arguments;
  38251. if (args.length == 0) {
  38252. return this.nice$0();
  38253. }
  38254. if (args.length == 1 && (a0 == null || typeof a0 === "number")) {
  38255. return this.nice$1(a0);
  38256. }
  38257. if (args.length == 1) {
  38258. return this.nice$4(a0);
  38259. }
  38260. if (args.length == 2 && (a0 == null || typeof a0 === "number") && (a1 == null || typeof a1 === "number")) {
  38261. return this.nice$2(a0, a1);
  38262. }
  38263. return this.nice$3(a0, a1);
  38264. }
  38265. });
  38266. /**
  38267. * @param (Array) domain
  38268. * @param (Number) tickArguments
  38269. * @return (Array) List of "nice"ed domain values
  38270. */
  38271. com_ibm_rave_core_scales_LinearScale.linearNice = function(domain, tickArguments) {
  38272. 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]));
  38273. };
  38274. /**
  38275. * @param (Array) domain
  38276. * @param (Number) tickCount number of desired ticks
  38277. * @param (Number) magnitude number which indicates the power of 10th for tick interval
  38278. * @return (Array) an array of the start, stop and step values
  38279. */
  38280. com_ibm_rave_core_scales_LinearScale.linearTickRange$0 = function(domain, tickCount, magnitude) {
  38281. var m = tickCount != null ? (tickCount) : 10;
  38282. var extent = com_ibm_rave_core_scales_AbstractScale.scaleExtent(domain);
  38283. var span = + (extent[1]) - + (extent[0]);
  38284. var tickMagnitude = Math.floor(Math.log(span / m) / Math.log(10));
  38285. if (magnitude != null) {
  38286. tickMagnitude = Math.max(+ (magnitude), tickMagnitude);
  38287. }
  38288. return com_ibm_rave_core_scales_LinearScale.getTickExtent(domain, m, tickMagnitude);
  38289. };
  38290. /**
  38291. * @param (Array) domain
  38292. * @param (Number) tickCount
  38293. * @return (Array) an array of the start, stop and step values
  38294. */
  38295. com_ibm_rave_core_scales_LinearScale.linearTickRange$1 = function(domain, tickCount) {
  38296. var m = tickCount != null ? (tickCount) : 10;
  38297. var extent = com_ibm_rave_core_scales_AbstractScale.scaleExtent(domain);
  38298. var span = + (extent[1]) - + (extent[0]);
  38299. var magnitude = Math.floor(Math.log(span / m) / Math.log(10));
  38300. return com_ibm_rave_core_scales_LinearScale.getTickExtent(domain, m, magnitude);
  38301. };
  38302. com_ibm_rave_core_scales_LinearScale.getTickExtent = function(domain, tickCount, tickMagnitude) {
  38303. var extent = com_ibm_rave_core_scales_AbstractScale.scaleExtent(domain);
  38304. var span = + (extent[1]) - + (extent[0]);
  38305. var step = Math.pow(10, tickMagnitude);
  38306. var err = tickCount / span * step;
  38307. if (err <= 0.15) {
  38308. step *= 10;
  38309. } else if (err <= 0.35) {
  38310. step *= 5;
  38311. } else if (err <= 0.75) {
  38312. step *= 2;
  38313. }
  38314. extent[0] = Math.ceil(+ (extent[0]) / step) * step;
  38315. extent[1] = Math.floor(+ (extent[1]) / step) * step + step * .5;
  38316. extent.splice(2, 0, step);
  38317. return extent;
  38318. };
  38319. /**
  38320. * @param _domain2
  38321. * @param (java.lang.Object[]) tickArguments
  38322. * @return (Array) The ticks
  38323. */
  38324. com_ibm_rave_core_scales_LinearScale.linearTicks = function(domain, tickArguments) {
  38325. if (tickArguments !== null || arguments.length > 2){
  38326. tickArguments = Array.prototype.slice.call(arguments, 1);
  38327. }
  38328. {
  38329. var tickCount = tickArguments && tickArguments.length > 0 ? + (tickArguments[0]) : null;
  38330. var magnitude = tickArguments && tickArguments.length > 2 ? tickArguments[2] : null;
  38331. var extents;
  38332. if (magnitude == null) {
  38333. extents = com_ibm_rave_core_scales_LinearScale.linearTickRange(domain, tickCount);
  38334. } else {
  38335. extents = com_ibm_rave_core_scales_LinearScale.linearTickRange(domain, tickCount, + (magnitude));
  38336. }
  38337. return (com_ibm_rave_core_Rave.range(+ (extents[0]), + (extents[1]), + (extents[2])));
  38338. }
  38339. };
  38340. /**
  38341. * @param (Array) domain
  38342. * @param (Number) m
  38343. * @param (String) format
  38344. * @return (com.ibm.rave.core.selector.ValueFunction) Formatted tick labels
  38345. */
  38346. com_ibm_rave_core_scales_LinearScale.linearTickFormat = function(domain, m, format) {
  38347. var _format = format;
  38348. var range = com_ibm_rave_core_scales_LinearScale.linearTickRange(domain, m);
  38349. if ((_format)) {
  38350. var match = new RegExp(com_ibm_rave_core_locale_NumberFormat.format_re, "i").exec(_format);
  38351. match.shift();
  38352. if (match.length >= 8 && match[8] == "s") {
  38353. var d = Math.max(Math.abs(+ (range[0])), Math.abs(+ (range[1])));
  38354. var prefix = com_ibm_rave_core_Rave.formatPrefix(d, null);
  38355. if (!((match[7]))) {
  38356. match[7] = "." + com_ibm_rave_core_scales_LinearScale.linearPrecision(prefix.scale(+ (range[2])));
  38357. }
  38358. match[8] = "f";
  38359. var numFormat = com_ibm_rave_core_Rave.format(match.join(""));
  38360. return function(data, index, groupIndex) {
  38361. return numFormat.call(this, prefix.scale(+ (data)), index, groupIndex) + prefix.symbol;
  38362. };
  38363. }
  38364. if (!((match[7]))) {
  38365. match[7] = "." + com_ibm_rave_core_scales_LinearScale.linearFormatPrecision(match[8], range);
  38366. }
  38367. _format = match.join("");
  38368. } else {
  38369. var value = + (range[2]);
  38370. _format = ",." + com_ibm_rave_core_scales_LinearScale.linearPrecision(value) + "f";
  38371. }
  38372. return com_ibm_rave_core_Rave.format(_format);
  38373. };
  38374. com_ibm_rave_core_scales_LinearScale.initialize_linearFormatSignificant = function() {
  38375. var linearFormatSignificant = com_ibm_rave_core_nativeImpl_arrays_ES6Map.create();
  38376. linearFormatSignificant.set("s", 1);
  38377. linearFormatSignificant.set("g", 1);
  38378. linearFormatSignificant.set("p", 1);
  38379. linearFormatSignificant.set("r", 1);
  38380. linearFormatSignificant.set("e", 1);
  38381. return linearFormatSignificant;
  38382. };
  38383. /**
  38384. * @param (double) value
  38385. * @return (int) int
  38386. */
  38387. com_ibm_rave_core_scales_LinearScale.linearPrecision = function(value) {
  38388. return (value == 0) ? 0 : ~~-Math.floor(Math.log(value) / Math.log(10) + 0.01);
  38389. };
  38390. /**
  38391. * @param (String) type
  38392. * @param (Array) range
  38393. * @return (Number) Number
  38394. */
  38395. com_ibm_rave_core_scales_LinearScale.linearFormatPrecision = function(type, range) {
  38396. var d = + (range[2]);
  38397. var p = com_ibm_rave_core_scales_LinearScale.linearPrecision(d);
  38398. if (com_ibm_rave_core_scales_LinearScale.linearFormatSignificant.get(type) != null) {
  38399. var precision = com_ibm_rave_core_scales_LinearScale.linearPrecision(Math.max(Math.abs(+ (range[0])), Math.abs(+ (range[1]))));
  38400. var typeValue = 0;
  38401. if (!(0 <= type.indexOf("e"))) {
  38402. typeValue = 1;
  38403. }
  38404. return Math.abs(p - precision + typeValue);
  38405. }
  38406. var typeValue = 0;
  38407. if (type == "%") {
  38408. typeValue = 1;
  38409. }
  38410. return p - typeValue * 2;
  38411. };
  38412. /** @expose */
  38413. com_ibm_rave_core_scales_LinearScale.linearTickRange = function(a0, a1, a2) {
  38414. var args = arguments;
  38415. if (args.length == 2) {
  38416. return com_ibm_rave_core_scales_LinearScale.linearTickRange$1(a0, a1);
  38417. }
  38418. return com_ibm_rave_core_scales_LinearScale.linearTickRange$0(a0, a1, a2);
  38419. };
  38420. /** @expose */
  38421. com_ibm_rave_core_scales_LinearScale.DEFAULT_TICKS = 10;
  38422. com_ibm_rave_core_scales_LinearScale.linearFormatSignificant = com_ibm_rave_core_scales_LinearScale.initialize_linearFormatSignificant();
  38423. // $source: com/ibm/rave/core/time/DateTimeScale
  38424. /************************************************************************
  38425. ** IBM Confidential
  38426. **
  38427. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  38428. **
  38429. ** (C) Copyright IBM Corp. 2017
  38430. **
  38431. ** The source code for this program is not published or otherwise divested of its trade secrets,
  38432. ** irrespective of what has been deposited with the U.S. Copyright Office.
  38433. ************************************************************************/
  38434. // GENERATED
  38435. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // bind, declare
  38436. //@import com/ibm/rave/core/scales/LinearScale (loadtime) // linearTickRange, superclass
  38437. //@import com/ibm/rave/core/arrays/Bisector (runtime) // Bisector
  38438. //@import com/ibm/rave/core/time/Time (static) // getInstance
  38439. //@import com/ibm/rave/core/scales/AbstractScale (runtime) // scaleExtent
  38440. //@import com/ibm/rave/core/internal/scales/Nice (runtime) // scaleNice
  38441. //@import com/ibm/rave/core/internal/scales/NiceIdentity (loadtime) // new, superclass
  38442. //@import com/ibm/rave/core/internal/nativeImpl/Lang (runtime) // isNumber
  38443. /**
  38444. * 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.
  38445. */
  38446. var com_ibm_rave_core_time_DateTimeScale = rave_externs["DateTimeScale"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scales_LinearScale, {
  38447. //_format : null,
  38448. //_methods : null,
  38449. //_methodsYear : null,
  38450. /**
  38451. * 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.
  38452. * @return (Array) Array of Date objects.
  38453. */
  38454. /** @expose */
  38455. domain$1 : com_ibm_rave_core_nativeImpl_Declare.bind(function() {
  38456. return com_ibm_rave_core_scales_LinearScale.prototype.domain$1.call(this).map(com_ibm_rave_core_time_DateTimeScale.scaleDate);
  38457. }),
  38458. /**
  38459. * Returns an exact copy of this time scale. Changes to this scale will not affect the returned scale, and vice versa.
  38460. * @return (com.ibm.rave.core.time.DateTimeScale) copy TimeScale
  38461. */
  38462. /** @expose */
  38463. copy : com_ibm_rave_core_nativeImpl_Declare.bind(function() {
  38464. return new com_ibm_rave_core_time_DateTimeScale(this.domain$1(), this.range(), this._interpolate, this._clamp, this._format, this._methods, this._methodsYear);
  38465. }),
  38466. constructor : function(domain, range, interpolate, clamp, format, methods, methodsYear) {
  38467. this._format = format;
  38468. this._methods = methods;
  38469. this._methodsYear = methodsYear;
  38470. var self = this;
  38471. this.invert = function(y) {
  38472. return self.invertDate(y);
  38473. };
  38474. this.ticks = function(tickArguments) {
  38475. if (tickArguments !== null || arguments.length > 1){
  38476. tickArguments = Array.prototype.slice.call(arguments);
  38477. }
  38478. {
  38479. return self.timeTicks.apply(self, tickArguments);
  38480. }
  38481. };
  38482. this.tickFormat = function(tickArguments) {
  38483. if (tickArguments !== null || arguments.length > 1){
  38484. tickArguments = Array.prototype.slice.call(arguments);
  38485. }
  38486. {
  38487. return self.timeTickFormat.apply(self, tickArguments);
  38488. }
  38489. };
  38490. },
  38491. tickMethod : com_ibm_rave_core_nativeImpl_Declare.bind(function(extent, tickCount) {
  38492. var span = + (extent[1]) - + (extent[0]);
  38493. var target = span / tickCount;
  38494. var i = com_ibm_rave_core_arrays_Bisector.bisect(com_ibm_rave_core_time_DateTimeScale.scaleSteps, target);
  38495. if (i == com_ibm_rave_core_time_DateTimeScale.scaleSteps.length) {
  38496. var list = extent.map(function(currentValue, index, array) {
  38497. return + (currentValue) / 31536e6;
  38498. });
  38499. return [this._methodsYear, com_ibm_rave_core_scales_LinearScale.linearTickRange(list, tickCount)[2]];
  38500. } else if (i == 0) {
  38501. return [com_ibm_rave_core_time_Time.getInstance().millisecond, com_ibm_rave_core_scales_LinearScale.linearTickRange(extent, tickCount)[2]];
  38502. }
  38503. var index = target / (com_ibm_rave_core_time_DateTimeScale.scaleSteps[i - 1]) < (com_ibm_rave_core_time_DateTimeScale.scaleSteps[i]) / target ? i - 1 : i;
  38504. return this._methods[index];
  38505. }),
  38506. nice$0 : function() {
  38507. return this.nice$1(10);
  38508. },
  38509. nice$1 : function(tickCount) {
  38510. var domain = this.domain$1();
  38511. var extent = com_ibm_rave_core_scales_AbstractScale.scaleExtent(domain);
  38512. var method = this.tickMethod(extent, tickCount);
  38513. return this.nice$2(method[0], method[1]);
  38514. },
  38515. nice$3 : function(interval) {
  38516. return this.nice$2(interval, 0);
  38517. },
  38518. nice$2 : function(interval, tickCount) {
  38519. var skip = ~~ (tickCount);
  38520. 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) {
  38521. return interval.floor(new Date(x)).getTime();
  38522. }, function(x) {
  38523. return interval.ceil(new Date(x)).getTime();
  38524. })));
  38525. },
  38526. /**
  38527. * <p> 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. </p> <p> The method may be called with zero, one, or two arguments: </p> <pre> timeTicks() timeTicks(count) timeTicks(interval) timeTicks(interval, step) </pre> <p> 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: </p> <pre> scale.ticks(10); </pre> <p> While to create ticks at 15-minute intervals, say: </p> <pre> scale.ticks(rave.time.minute, 15); </pre> <p> Note: for UTC scales, be sure to use the appropriate UTC range method (such as rave.time.minute.utc). </p> <p> The following time intervals are considered for automatic ticks: </p> <pre> 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. </pre> <p> This set of time intervals is somewhat arbitrary and additional values may be added in the future. </p> <p> RAVE NOTE: Rave Supports TimeRanges to be used instead of TimeIntervals (delegating to the range's interval) Rave does not support this deprecated feature. </p>
  38528. * @param (java.lang.Object[]) tickArguments Variable arguments
  38529. */
  38530. timeTicks : function(tickArguments) {
  38531. if (tickArguments !== null || arguments.length > 1){
  38532. tickArguments = Array.prototype.slice.call(arguments);
  38533. }
  38534. {
  38535. var domain = this.domain$1();
  38536. var extent = com_ibm_rave_core_scales_AbstractScale.scaleExtent(domain);
  38537. var interval;
  38538. var count = 0;
  38539. if (tickArguments.length > 0) {
  38540. if (com_ibm_rave_core_internal_nativeImpl_Lang.isNumber(tickArguments[0])) {
  38541. count = tickArguments[0];
  38542. } else {
  38543. interval = tickArguments[0];
  38544. }
  38545. }
  38546. if (interval && tickArguments.length > 1) {
  38547. if (com_ibm_rave_core_internal_nativeImpl_Lang.isNumber(tickArguments[1])) {
  38548. count = tickArguments[1];
  38549. }
  38550. }
  38551. var method;
  38552. if (!interval) {
  38553. if (tickArguments.length > 1) {
  38554. count = 0;
  38555. }
  38556. method = this.tickMethod(extent, count == null || count == 0 ? 10 : count);
  38557. interval = method[0];
  38558. count = method[1];
  38559. }
  38560. var skip = count;
  38561. var date1 = extent[0];
  38562. var date2 = extent[1];
  38563. if (interval.range) {
  38564. return (interval).range(date1, new Date(date2.getTime() + 1), skip < 1 ? 1 : skip);
  38565. }
  38566. return (interval)(date1, new Date(date2.getTime() + 1), skip < 1 ? 1 : skip);
  38567. }
  38568. },
  38569. /**
  38570. * 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>
  38571. * @param (java.lang.Object[]) tickArguments Optional arguments (typically passed in by Axis) which are not used by TimeScale
  38572. * @return (com.ibm.rave.core.selector.ValueFunction) Time format function
  38573. */
  38574. timeTickFormat : function(tickArguments) {
  38575. if (tickArguments !== null || arguments.length > 1){
  38576. tickArguments = Array.prototype.slice.call(arguments);
  38577. }
  38578. {
  38579. return this._format;
  38580. }
  38581. },
  38582. invertDate : function(x) {
  38583. return com_ibm_rave_core_time_DateTimeScale.scaleDate(this.input(x), 0, null);
  38584. },
  38585. /** @expose */
  38586. nice : com_ibm_rave_core_nativeImpl_Declare.bind(function(a0, a1) {
  38587. var args = arguments;
  38588. if (args.length == 0) {
  38589. return this.nice$0();
  38590. }
  38591. if (args.length == 1 && (a0 == null || typeof a0 === "number")) {
  38592. return this.nice$1(a0);
  38593. }
  38594. if (args.length == 1) {
  38595. return this.nice$3(a0);
  38596. }
  38597. return this.nice$2(a0, a1);
  38598. })
  38599. });
  38600. com_ibm_rave_core_time_DateTimeScale.ScaleDate = com_ibm_rave_core_nativeImpl_Declare({
  38601. _$functionClassMethod : function() {
  38602. var _$self = function(currentValue, index, array) {
  38603. return new Date(+ (currentValue));
  38604. };
  38605. return _$self;
  38606. }
  38607. });
  38608. /**
  38609. * Overrides NiceIdentity for more functionality
  38610. */
  38611. com_ibm_rave_core_time_DateTimeScale.TimeNiceIdentity = rave_externs["TimeNiceIdentity"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_internal_scales_NiceIdentity, {
  38612. //interval : null,
  38613. skip : 0,
  38614. constructor : function(interval, skip) {
  38615. this.interval = interval;
  38616. this.skip = skip;
  38617. var self = this;
  38618. this.floor = function(dateNumber) {
  38619. var newDate = new Date(dateNumber);
  38620. while (self.skipped(newDate = interval.floor(newDate))) {
  38621. newDate = new Date(newDate.getTime() - 1);
  38622. }
  38623. return newDate.getTime();
  38624. };
  38625. this.ceil = function(dateNumber) {
  38626. var newDate = new Date(dateNumber);
  38627. while (self.skipped(newDate = interval.ceil(newDate))) {
  38628. newDate = new Date(newDate.getTime() + 1);
  38629. }
  38630. return newDate.getTime();
  38631. };
  38632. },
  38633. skipped : function(date) {
  38634. return this.interval.range(date, new Date(date.getTime() + 1), this.skip).length == 0;
  38635. }
  38636. });
  38637. com_ibm_rave_core_time_DateTimeScale.scaleDate = new com_ibm_rave_core_time_DateTimeScale.ScaleDate();
  38638. com_ibm_rave_core_time_DateTimeScale.scaleSteps = [new Number(1e3), new Number(5e3), new Number(15e3), new Number(3e4), new Number(6e4), new Number(3e5), new Number(9e5), new Number(18e5), new Number(36e5), new Number(108e5), new Number(216e5), new Number(432e5), new Number(864e5), new Number(1728e5), new Number(6048e5), new Number(2592e6), new Number(7776e6), new Number(31536e6)];
  38639. /**
  38640. * 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.
  38641. */
  38642. /** @expose */
  38643. 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]];
  38644. /**
  38645. * Map the localMethods local time interval to utc time interval
  38646. */
  38647. /** @expose */
  38648. com_ibm_rave_core_time_DateTimeScale.utcMethods = com_ibm_rave_core_time_DateTimeScale.localMethods.map(function(currentValue, index, array) {
  38649. return [(currentValue[0]).utc, currentValue[1]];
  38650. });
  38651. /**
  38652. * Returns the appropriate ValueFunction depending on the format used
  38653. */
  38654. /** @expose */
  38655. com_ibm_rave_core_time_DateTimeScale.localFormat = com_ibm_rave_core_time_Time.getInstance().format.multi([[".%L", function(data, index, groupIndex) {
  38656. return (data).getMilliseconds();
  38657. }], [":%S", function(data, index, groupIndex) {
  38658. return (data).getSeconds();
  38659. }], ["%I:%M", function(data, index, groupIndex) {
  38660. return (data).getMinutes();
  38661. }], ["%I %p", function(data, index, groupIndex) {
  38662. return (data).getHours();
  38663. }], ["%a %d", function(data, index, groupIndex) {
  38664. var date = data;
  38665. return (date.getDay()) && date.getDate() != 1 ? 1 : 0;
  38666. }], ["%b %d", function(data, index, groupIndex) {
  38667. return (data).getDate() != 1 ? 1 : 0;
  38668. }], ["%B", function(data, index, groupIndex) {
  38669. return (data).getMonth();
  38670. }], ["%Y", function(data, index, groupIndex) {
  38671. return 1;
  38672. }]]);
  38673. /**
  38674. * Configure formatting for UTC time
  38675. */
  38676. /** @expose */
  38677. com_ibm_rave_core_time_DateTimeScale.utcFormat = com_ibm_rave_core_time_Time.getInstance().format.utc.multi([[".%L", function(data, index, groupIndex) {
  38678. return (data).getUTCMilliseconds();
  38679. }], [":%S", function(data, index, groupIndex) {
  38680. return (data).getUTCSeconds();
  38681. }], ["%I:%M", function(data, index, groupIndex) {
  38682. return (data).getUTCMinutes();
  38683. }], ["%I %p", function(data, index, groupIndex) {
  38684. return (data).getUTCHours();
  38685. }], ["%a %d", function(data, index, groupIndex) {
  38686. var date = data;
  38687. return (date.getUTCDay()) && date.getUTCDate() != 1 ? 1 : 0;
  38688. }], ["%b %d", function(data, index, groupIndex) {
  38689. return (data).getUTCDate() != 1 ? 1 : 0;
  38690. }], ["%B", function(data, index, groupIndex) {
  38691. return (data).getUTCMonth();
  38692. }], ["%Y", function(data, index, groupIndex) {
  38693. return 1;
  38694. }]]);
  38695. /**
  38696. * rave_time_scaleLocalMethods.year = rave_time.year;
  38697. */
  38698. /** @expose */
  38699. com_ibm_rave_core_time_DateTimeScale.localMethodsYear = com_ibm_rave_core_time_Time.getInstance().year;
  38700. /**
  38701. * rave_time_scaleUtcMethods.year = rave_time.year.utc
  38702. */
  38703. /** @expose */
  38704. com_ibm_rave_core_time_DateTimeScale.utcMethodsYear = com_ibm_rave_core_time_Time.getInstance().year.utc;
  38705. // $source: com/ibm/rave/core/internal/nativeImpl/Functor
  38706. /************************************************************************
  38707. ** IBM Confidential
  38708. **
  38709. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  38710. **
  38711. ** (C) Copyright IBM Corp. 2014
  38712. **
  38713. ** The source code for this program is not published or otherwise divested of its trade secrets,
  38714. ** irrespective of what has been deposited with the U.S. Copyright Office.
  38715. ************************************************************************/
  38716. // @import com/ibm/rave/core/Rave
  38717. /**
  38718. * Takes an object and always returns a function. If the object is a
  38719. * function, return it. Otherwise return a function that returns the object.
  38720. *
  38721. * Mapped to rave.functor().
  38722. *
  38723. * Only available in Javascript.
  38724. */
  38725. com_ibm_rave_core_Rave["functor"] = function(v) {
  38726. return typeof v === "function" ? v : function() {
  38727. return v;
  38728. };
  38729. };
  38730. // $source: com/ibm/rave/core/internal/nativeImpl/Rebind
  38731. /************************************************************************
  38732. ** IBM Confidential
  38733. **
  38734. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  38735. **
  38736. ** (C) Copyright IBM Corp. 2014
  38737. **
  38738. ** The source code for this program is not published or otherwise divested of its trade secrets,
  38739. ** irrespective of what has been deposited with the U.S. Copyright Office.
  38740. ************************************************************************/
  38741. // @import com/ibm/rave/core/Rave
  38742. /**
  38743. * Copies the methods with the specified names from source to target, and returns target.
  38744. * Calling one of the named methods on the target object invokes the same-named method
  38745. * on the source object, passing any arguments passed to the target method, and using the
  38746. * source object as the this context. If the source method returns the source object, the
  38747. * target method returns the target object (“setter” method); otherwise, the target method
  38748. * returns the return value of the source method (“getter” mode). The rebind operator allows
  38749. * inherited methods (mix-ins) to be rebound to a subclass on a different object.
  38750. *
  38751. * Mapped to rave.rebind().
  38752. *
  38753. * Only available in Javascript.
  38754. */
  38755. com_ibm_rave_core_Rave["rebind"] = function(target, source) {
  38756. var i = 1, n = arguments.length, method;
  38757. while (++i < n) target[method = arguments[i]] = rave_rebind(target, source, source[method]);
  38758. /**
  38759. * Method is assumed to be a standard Rave getter-setter:
  38760. * If passed with no arguments, gets the value.
  38761. * If passed with arguments, sets the value and returns the target.
  38762. */
  38763. function rave_rebind(target, source, method) {
  38764. return function() {
  38765. var value = method.apply(source, arguments);
  38766. return value === source ? target : value;
  38767. };
  38768. }
  38769. return target;
  38770. };
  38771. // $source: com/ibm/rave/core/internal/nativeImpl/version/Version
  38772. // @import com/ibm/rave/core/Rave
  38773. com_ibm_rave_core_Rave["version"] = new String("11.1.7-2102091153");
  38774. com_ibm_rave_core_Rave["version"]["build"] = "11.1.7-2102091153";
  38775. com_ibm_rave_core_Rave["version"]["vendor"] = "IBM Rapidly Adaptive Visualization Engine";
  38776. // $source: com/ibm/rave/core/internal/nativeImpl/Module
  38777. /************************************************************************
  38778. ** IBM Confidential
  38779. **
  38780. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  38781. **
  38782. ** (C) Copyright IBM Corp. 2014, 2016
  38783. **
  38784. ** The source code for this program is not published or otherwise divested of its trade secrets,
  38785. ** irrespective of what has been deposited with the U.S. Copyright Office.
  38786. ************************************************************************/
  38787. // Must be the first import
  38788. // @import ./ModuleHeader
  38789. // @import com/ibm/rave/core/Rave
  38790. // @import com/ibm/rave/core/behavior/Zoom
  38791. // @import com/ibm/rave/core/selector/Selector
  38792. // @import com/ibm/rave/core/selector/EnterSelector
  38793. // @import com/ibm/rave/core/transition/Transition
  38794. // @import com/ibm/rave/core/nativeImpl/Declare
  38795. // @import com/ibm/rave/core/internal/nativeImpl/Functor
  38796. // @import com/ibm/rave/core/internal/nativeImpl/Rebind
  38797. // @import com/ibm/rave/core/internal/nativeImpl/version/Version
  38798. var rave = com_ibm_rave_core_Rave;
  38799. // rave#event should be undefined to start
  38800. delete rave.event;
  38801. // satisfy prototype extension mechanism of selectors and transitions
  38802. rave["selection"].prototype = com_ibm_rave_core_selector_Selector.prototype;
  38803. rave["transition"].prototype = com_ibm_rave_core_transition_Transition.prototype;
  38804. // version info
  38805. rave["version"] = com_ibm_rave_core_Rave["version"];
  38806. // patch wheel event in zoom
  38807. // https://developer.mozilla.org/en-US/docs/Mozilla_event_reference/wheel
  38808. if (rave_document) {
  38809. if (!("onwheel" in rave_document.createElement("div"))) {
  38810. if ("onmousewheel" in rave_document) {
  38811. com_ibm_rave_core_behavior_Zoom.zoomDelta = function() {
  38812. if (typeof rave.event["wheelDelta"] !== "undefined") {
  38813. return rave.event["wheelDelta"];
  38814. }
  38815. return -rave.event["deltaY"] * (rave.event["deltaMode"] != 0 ? 120 : 1);
  38816. };
  38817. com_ibm_rave_core_behavior_Zoom.zoomWheel = "mousewheel";
  38818. } else {
  38819. com_ibm_rave_core_behavior_Zoom.zoomDelta = function() { return -rave.event["detail"]; };
  38820. com_ibm_rave_core_behavior_Zoom.zoomWheel = "MozMousePixelScroll";
  38821. }
  38822. }
  38823. }
  38824. // end patching the translated code
  38825. if (typeof define === "function" && define.amd) {
  38826. define(rave);
  38827. } else if (typeof module === "object" && module.exports) {
  38828. module.exports = rave;
  38829. }
  38830. // expose Rave class to the global variable rave
  38831. global["rave"] = rave;
  38832. global["rave"]["selection"]["enter"] = com_ibm_rave_core_selector_EnterSelector;
  38833. global["rave"]["_"] = {
  38834. "com_ibm_rave_core_nativeImpl_Declare" : com_ibm_rave_core_nativeImpl_Declare,
  38835. "com_ibm_rave_core_nativeImpl_Object" : com_ibm_rave_core_nativeImpl_Object,
  38836. "com_ibm_rave_core_internal_nativeImpl_Lang" : com_ibm_rave_core_internal_nativeImpl_Lang,
  38837. "com_ibm_rave_core_geom_PointStruct" : com_ibm_rave_core_geom_PointStruct,
  38838. "com_ibm_rave_core_scene_SceneNodeType" : com_ibm_rave_core_scene_SceneNodeType,
  38839. "com_ibm_rave_core_internal_css_CSSUtil" : com_ibm_rave_core_internal_css_CSSUtil,
  38840. "com_ibm_rave_core_internal_css_CSSTransformParser" : com_ibm_rave_core_internal_css_CSSTransformParser,
  38841. "com_ibm_rave_core_internal_css_om_CSSStyleDeclarationImpl" : com_ibm_rave_core_internal_css_om_CSSStyleDeclarationImpl,
  38842. "com_ibm_rave_core_internal_css_CSSParser" : com_ibm_rave_core_internal_css_CSSParser,
  38843. "rave_document" : rave_document,
  38844. "rave_documentElement" : rave_documentElement,
  38845. "rave_window" : rave_window
  38846. };
  38847. global["rave"]["internal"] = rave_externs;
  38848. // $source: com/ibm/rave/core/geom/NodeRect
  38849. /************************************************************************
  38850. ** IBM Confidential
  38851. **
  38852. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  38853. **
  38854. ** (C) Copyright IBM Corp. 2017
  38855. **
  38856. ** The source code for this program is not published or otherwise divested of its trade secrets,
  38857. ** irrespective of what has been deposited with the U.S. Copyright Office.
  38858. ************************************************************************/
  38859. // GENERATED
  38860. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  38861. /**
  38862. * An implementation of a DOMRect-like interface. Typically the values in this are relative to the viewport.
  38863. * @author jim
  38864. */
  38865. var com_ibm_rave_core_geom_NodeRect = rave_externs["NodeRect"] = com_ibm_rave_core_nativeImpl_Declare({
  38866. /** @expose */
  38867. left : 0,
  38868. /** @expose */
  38869. right : 0,
  38870. /** @expose */
  38871. top : 0,
  38872. /** @expose */
  38873. bottom : 0,
  38874. /** @expose */
  38875. width : 0,
  38876. /** @expose */
  38877. height : 0,
  38878. /** @expose */
  38879. constructor : function(left, right, bottom, top, width, height) {
  38880. this.left = left;
  38881. this.right = right;
  38882. this.top = top;
  38883. this.bottom = bottom;
  38884. this.width = width;
  38885. this.height = height;
  38886. }
  38887. });
  38888. // $source: com/ibm/rave/core/selector/SelectorDelegate
  38889. /************************************************************************
  38890. ** IBM Confidential
  38891. **
  38892. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  38893. **
  38894. ** (C) Copyright IBM Corp. 2017
  38895. **
  38896. ** The source code for this program is not published or otherwise divested of its trade secrets,
  38897. ** irrespective of what has been deposited with the U.S. Copyright Office.
  38898. ************************************************************************/
  38899. // GENERATED
  38900. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare, declare anonymous
  38901. //@import com/ibm/rave/core/selector/Selector (loadtime) // superclass
  38902. /**
  38903. * The delegate mechanism for a selector.
  38904. */
  38905. var com_ibm_rave_core_selector_SelectorDelegate = rave_externs["SelectorDelegate"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_selector_Selector, {
  38906. //selector : null,
  38907. /**
  38908. * Create a delegate selector.
  38909. */
  38910. /** @expose */
  38911. constructor : function() {},
  38912. /**
  38913. * Set the delegate selector.
  38914. * @param (com.ibm.rave.core.selector.Selector) selector The selector to delegate to.
  38915. * @return (com.ibm.rave.core.selector.Selector) The extended selector.
  38916. */
  38917. /** @expose */
  38918. setDelegate : function(selector) {
  38919. this.selector = selector;
  38920. return this;
  38921. },
  38922. /**
  38923. * Create the extension to the selector. Concrete classes will implement this method and return an instance of themselves.
  38924. * @param (com.ibm.rave.core.selector.Selector) s The core selector.
  38925. * @return (com.ibm.rave.core.selector.Selector) The extended selector.
  38926. */
  38927. /** @expose */
  38928. create : function(s) {},
  38929. /**
  38930. * @see Selector#this.append(String)
  38931. */
  38932. append$0 : function(name) {
  38933. return this.create(this.selector.append$0(name));
  38934. },
  38935. /**
  38936. * @see Selector#this.append(com_ibm_rave_core_selector_ValueFunction)
  38937. */
  38938. append$1 : function(elementFunction) {
  38939. return this.create(this.selector.append$1(elementFunction));
  38940. },
  38941. /**
  38942. * @see Selection#this.attr(Object)
  38943. */
  38944. attr$0 : function(value) {
  38945. this.selector.attr$0(value);
  38946. return this;
  38947. },
  38948. /**
  38949. * @see Selector#this.attr(String)
  38950. */
  38951. attr$3 : function(attribute) {
  38952. return this.selector.attr$3(attribute);
  38953. },
  38954. /**
  38955. * @see Selector#this.attr(String, Object)
  38956. */
  38957. attr$1 : function(attribute, value) {
  38958. this.selector.attr$1(attribute, value);
  38959. return this;
  38960. },
  38961. /**
  38962. * @see Selector#this.attr(String, com_ibm_rave_core_selector_ValueFunction)
  38963. */
  38964. attr$2 : function(attribute, valueFunction) {
  38965. this.selector.attr$2(attribute, valueFunction);
  38966. return this;
  38967. },
  38968. /**
  38969. * @see Selector#this.classed(String)
  38970. */
  38971. classed$0 : function(className) {
  38972. return this.selector.classed$0(className);
  38973. },
  38974. /**
  38975. * @see Selector#this.classed(Object)
  38976. */
  38977. classed$1 : function(value) {
  38978. this.selector.classed$1(value);
  38979. return this;
  38980. },
  38981. /**
  38982. * @see Selector#this.classed(String, )
  38983. */
  38984. classed$2 : function(className, add) {
  38985. this.selector.classed$2(className, add);
  38986. return this;
  38987. },
  38988. /**
  38989. * @see Selector#this.classed(String, com_ibm_rave_core_selector_ValueFunction)
  38990. */
  38991. classed$3 : function(className, valueFunction) {
  38992. this.selector.classed$3(className, valueFunction);
  38993. return this;
  38994. },
  38995. /**
  38996. * @see Selector#this.call(com_ibm_rave_core_selector_RunFunction, )
  38997. */
  38998. call$0 : function(callback, args) {
  38999. if (args !== null || arguments.length > 2){
  39000. args = Array.prototype.slice.call(arguments, 1);
  39001. }
  39002. {
  39003. this.selector.call.apply(this.selector, [callback].concat(args));
  39004. return this;
  39005. }
  39006. },
  39007. /**
  39008. * @see Selector#this.data()
  39009. */
  39010. data$0 : function() {
  39011. return this.selector.data$0();
  39012. },
  39013. /**
  39014. * @see Selector#this.datum()
  39015. */
  39016. datum$0 : function() {
  39017. return this.selector.datum$0();
  39018. },
  39019. /**
  39020. * @see Selector#this.datum(com_ibm_rave_core_selector_ValueFunction)
  39021. */
  39022. datum$1 : function(valueFn) {
  39023. this.selector.datum$1(valueFn);
  39024. return this;
  39025. },
  39026. /**
  39027. * @see Selector#this.datum(Object)
  39028. */
  39029. datum$2 : function(value) {
  39030. this.selector.datum$2(value);
  39031. return this;
  39032. },
  39033. /**
  39034. * @see Selector#this.data(com_ibm_rave_core_selector_ValueFunction)
  39035. */
  39036. data$1 : function(value) {
  39037. return this.create(this.selector.data$1(value));
  39038. },
  39039. /**
  39040. * @see Selector#this.data(com_ibm_rave_core_selector_ValueFunction, com_ibm_rave_core_selector_ValueFunction)
  39041. */
  39042. data$2 : function(value, key) {
  39043. return this.create(this.selector.data$2(value, key));
  39044. },
  39045. /**
  39046. * @see Selector#this.data()
  39047. */
  39048. data$3 : function(value) {
  39049. return this.create(this.selector.data$3(value));
  39050. },
  39051. /**
  39052. * @see Selector#this.data(, com_ibm_rave_core_selector_ValueFunction)
  39053. */
  39054. data$4 : function(value, key) {
  39055. return this.create(this.selector.data$4(value, key));
  39056. },
  39057. /**
  39058. * @see Selection#this.empty()
  39059. */
  39060. /** @expose */
  39061. empty : function() {
  39062. return this.selector.empty();
  39063. },
  39064. /**
  39065. * @see Selector#this.enter()
  39066. */
  39067. /** @expose */
  39068. enter : function() {
  39069. var self = this;
  39070. var d = new (com_ibm_rave_core_nativeImpl_Declare([com_ibm_rave_core_selector_SelectorDelegate], {
  39071. create : function(s) {
  39072. return self.create(s);
  39073. }
  39074. }))();
  39075. return d.setDelegate(this.selector.enter());
  39076. },
  39077. /**
  39078. * @see Selector#this.exit()
  39079. */
  39080. /** @expose */
  39081. exit : function() {
  39082. return this.create(this.selector.exit());
  39083. },
  39084. /**
  39085. * @see Selector#this.each(com_ibm_rave_core_selector_CallbackFunction)
  39086. */
  39087. /** @expose */
  39088. each$0 : function(callback) {
  39089. this.selector.each(callback);
  39090. return this;
  39091. },
  39092. /**
  39093. * @see Selector#this.filter(com_ibm_rave_core_selector_ValueFunction)
  39094. */
  39095. filter$0 : function(filterFunction) {
  39096. return this.create(this.selector.filter$0(filterFunction));
  39097. },
  39098. /**
  39099. * @see Selector#this.filter(String)
  39100. */
  39101. filter$1 : function(filter) {
  39102. return this.create(this.selector.filter$1(filter));
  39103. },
  39104. /**
  39105. * @see Selector#this.html()
  39106. */
  39107. html$0 : function() {
  39108. return this.selector.html$0();
  39109. },
  39110. /**
  39111. * @see Selector#this.html(Object)
  39112. */
  39113. html$1 : function(value) {
  39114. this.selector.html$1(value);
  39115. return this;
  39116. },
  39117. /**
  39118. * @see Selector#this.html(com_ibm_rave_core_selector_ValueFunction)
  39119. */
  39120. html$2 : function(valueFunction) {
  39121. this.selector.html$2(valueFunction);
  39122. return this;
  39123. },
  39124. /**
  39125. * @see Selector#this.insert(com_ibm_rave_core_selector_ValueFunction, String)
  39126. */
  39127. insert$2 : function(elementFunction, before) {
  39128. return this.create(this.selector.insert$2(elementFunction, before));
  39129. },
  39130. /**
  39131. * @see Selector#this.insert(com_ibm_rave_core_selector_ValueFunction, com_ibm_rave_core_selector_ValueFunction)
  39132. */
  39133. insert$3 : function(nameFunction, beforeFunction) {
  39134. return this.create(this.selector.insert$3(nameFunction, beforeFunction));
  39135. },
  39136. /**
  39137. * @see Selector#this.insert(String, String)
  39138. */
  39139. insert$4 : function(name, before) {
  39140. return this.create(this.selector.insert$4(name, before));
  39141. },
  39142. /**
  39143. * @see Selector#this.insert(String, com_ibm_rave_core_selector_ValueFunction)
  39144. */
  39145. insert$5 : function(type, beforeFunction) {
  39146. return this.create(this.selector.insert$5(type, beforeFunction));
  39147. },
  39148. /**
  39149. * @see Selector#this.interrupt()
  39150. */
  39151. interrupt$0 : function() {
  39152. this.selector.interrupt$0();
  39153. return this;
  39154. },
  39155. /**
  39156. * @see Selector#this.interrupt(String)
  39157. */
  39158. interrupt$1 : function(name) {
  39159. this.selector.interrupt$1(name);
  39160. return this;
  39161. },
  39162. /**
  39163. * @see Selector#this.init(com_ibm_rave_core_scene_SceneNode)
  39164. */
  39165. init$0 : function(node) {
  39166. this.selector.init$0(node);
  39167. return this;
  39168. },
  39169. /**
  39170. * @see Selector#this.initAll(Array)
  39171. */
  39172. initAll$0 : function(nodes) {
  39173. this.selector.initAll$0(nodes);
  39174. return this;
  39175. },
  39176. /**
  39177. * @see Selector#this.init(String)
  39178. */
  39179. init$1 : function(query) {
  39180. this.selector.init$1(query);
  39181. return this;
  39182. },
  39183. /**
  39184. * @see Selector#this.initAll(String)
  39185. */
  39186. initAll$1 : function(query) {
  39187. this.selector.initAll$1(query);
  39188. return this;
  39189. },
  39190. /**
  39191. * @see Selection#this.node()
  39192. */
  39193. /** @expose */
  39194. node : function() {
  39195. return this.selector.node();
  39196. },
  39197. /**
  39198. * @see Selector#this.on(String)
  39199. */
  39200. on$0 : function(eventName) {
  39201. return this.selector.on$0(eventName);
  39202. },
  39203. /**
  39204. * @see Selector#this.on(Object)
  39205. */
  39206. on$1 : function(value) {
  39207. this.selector.on$1(value);
  39208. return this;
  39209. },
  39210. /**
  39211. * @see Selector#this.on(String, com_ibm_rave_core_selector_SelectorEventListener)
  39212. */
  39213. on$2 : function(eventName, listener) {
  39214. this.selector.on$2(eventName, listener);
  39215. return this;
  39216. },
  39217. /**
  39218. * @see Selector#this.on(String, com_ibm_rave_core_selector_SelectorEventListener, )
  39219. */
  39220. on$3 : function(eventName, listener, useCapture) {
  39221. this.selector.on$3(eventName, listener, useCapture);
  39222. return this;
  39223. },
  39224. /**
  39225. * @see Selector#this.owner()
  39226. */
  39227. owner$0 : function() {
  39228. return this.selector.owner$0();
  39229. },
  39230. /**
  39231. * @see Selector#this.owner(com_ibm_rave_core_scene_SceneNode)
  39232. */
  39233. owner$1 : function(owner) {
  39234. this.selector.owner$1(owner);
  39235. return this;
  39236. },
  39237. /**
  39238. * @see Selector#this.owner(com_ibm_rave_core_selector_ValueFunction)
  39239. */
  39240. owner$2 : function(owner) {
  39241. this.selector.owner$2(owner);
  39242. return this;
  39243. },
  39244. /**
  39245. * @see Selector#this.order()
  39246. */
  39247. /** @expose */
  39248. order : function() {
  39249. this.selector.order();
  39250. return this;
  39251. },
  39252. /**
  39253. * @see Selector#this.mirror()
  39254. */
  39255. /** @expose */
  39256. mirror : function(mirror) {
  39257. return this.create(this.selector.mirror(mirror));
  39258. },
  39259. /**
  39260. * @see Selector#this.property(String)
  39261. */
  39262. property$0 : function(key) {
  39263. return this.selector.property$0(key);
  39264. },
  39265. /**
  39266. * @see Selector#this.property(Object)
  39267. */
  39268. property$1 : function(value) {
  39269. this.selector.property$1(value);
  39270. return this;
  39271. },
  39272. /**
  39273. * @see Selector#this.property(String, Object)
  39274. */
  39275. property$2 : function(key, value) {
  39276. this.selector.property$2(key, value);
  39277. return this;
  39278. },
  39279. /**
  39280. * @see Selector#this.property(String, com_ibm_rave_core_selector_ValueFunction)
  39281. */
  39282. property$3 : function(key, valueFunction) {
  39283. this.selector.property$3(key, valueFunction);
  39284. return this;
  39285. },
  39286. /**
  39287. * @see Selector#this.remove()
  39288. */
  39289. /** @expose */
  39290. remove : function() {
  39291. this.selector.remove();
  39292. return this;
  39293. },
  39294. /**
  39295. * @see Selection#this.size()
  39296. */
  39297. /** @expose */
  39298. size : function() {
  39299. return this.selector.size();
  39300. },
  39301. /**
  39302. * @see Selector#this.select(Object)
  39303. */
  39304. select$0 : function(query) {
  39305. return this.create(this.selector.select$0(query));
  39306. },
  39307. /**
  39308. * @see Selector#this.select(com_ibm_rave_core_selector_ValueFunction)
  39309. */
  39310. select$1 : function(valueFunction) {
  39311. return this.create(this.selector.select$1(valueFunction));
  39312. },
  39313. /**
  39314. * @see Selector#this.selectAll(String)
  39315. */
  39316. selectAll$0 : function(query) {
  39317. return this.create(this.selector.selectAll$0(query));
  39318. },
  39319. /**
  39320. * @see Selector#this.selectAll(com_ibm_rave_core_selector_ValueFunction)
  39321. */
  39322. selectAll$1 : function(sel) {
  39323. return this.create(this.selector.selectAll$1(sel));
  39324. },
  39325. /**
  39326. * @see Selector#this.extension(String)
  39327. */
  39328. /** @expose */
  39329. extension$0 : function(key) {
  39330. return this.selector.extension(key);
  39331. },
  39332. /**
  39333. * @see Selection#this.style(Object)
  39334. */
  39335. style$0 : function(value) {
  39336. this.selector.style$0(value);
  39337. return this;
  39338. },
  39339. /**
  39340. * @see Selection#this.style(Object, String)
  39341. */
  39342. style$1 : function(value, priority) {
  39343. this.selector.style$1(value, priority);
  39344. return this;
  39345. },
  39346. /**
  39347. * @see Selector#this.style(String)
  39348. */
  39349. style$6 : function(styleName) {
  39350. return this.selector.style$6(styleName);
  39351. },
  39352. /**
  39353. * @see Selector#this.style(String, Object)
  39354. */
  39355. style$2 : function(styleName, value) {
  39356. this.selector.style$2(styleName, value);
  39357. return this;
  39358. },
  39359. /**
  39360. * @see Selector#this.style(String, Object, String)
  39361. */
  39362. style$4 : function(styleName, value, priority) {
  39363. this.selector.style$4(styleName, value, priority);
  39364. return this;
  39365. },
  39366. /**
  39367. * @see Selector#this.style(String, com_ibm_rave_core_selector_ValueFunction)
  39368. */
  39369. style$3 : function(styleName, valueFunction) {
  39370. this.selector.style$3(styleName, valueFunction);
  39371. return this;
  39372. },
  39373. /**
  39374. * @see Selector#this.style(String, com_ibm_rave_core_selector_ValueFunction, String)
  39375. */
  39376. style$5 : function(styleName, valueFunction, priority) {
  39377. this.selector.style$5(styleName, valueFunction, priority);
  39378. return this;
  39379. },
  39380. /**
  39381. * @see Selector#this.sort(com_ibm_rave_core_util_Comparator)
  39382. */
  39383. /** @expose */
  39384. sort2$0 : function(c) {
  39385. this.selector.sort2(c);
  39386. return this;
  39387. },
  39388. /**
  39389. * @see Selector#this.sort()
  39390. */
  39391. /** @expose */
  39392. sort$0 : function() {
  39393. this.selector.sort();
  39394. return this;
  39395. },
  39396. /**
  39397. * @see Selector#this.text()
  39398. */
  39399. text$2 : function() {
  39400. return this.selector.text$2();
  39401. },
  39402. /**
  39403. * @see Selector#this.text(Object)
  39404. */
  39405. text$0 : function(value) {
  39406. this.selector.text$0(value);
  39407. return this;
  39408. },
  39409. /**
  39410. * @see Selector#this.text(com_ibm_rave_core_selector_ValueFunction)
  39411. */
  39412. text$1 : function(valueFunction) {
  39413. this.selector.text$1(valueFunction);
  39414. return this;
  39415. },
  39416. /**
  39417. * @see Selector#this.transition()
  39418. */
  39419. transition$0 : function() {
  39420. return this.selector.transition$0();
  39421. },
  39422. /**
  39423. * @see Selector#this.transition(String)
  39424. */
  39425. transition$1 : function(name) {
  39426. return this.selector.transition$1(name);
  39427. },
  39428. /**
  39429. * @see Selector#this.dispose()
  39430. */
  39431. /** @expose */
  39432. dispose : function() {
  39433. this.selector.dispose();
  39434. return this;
  39435. },
  39436. /** @expose */
  39437. append : function(a0) {
  39438. var args = arguments;
  39439. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  39440. return this.append$0(a0);
  39441. }
  39442. return this.append$1(a0);
  39443. },
  39444. /** @expose */
  39445. attr : function(a0, a1) {
  39446. var args = arguments;
  39447. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  39448. return this.attr$3(a0);
  39449. }
  39450. if (args.length == 1) {
  39451. return this.attr$0(a0);
  39452. }
  39453. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  39454. return this.attr$2(a0, a1);
  39455. }
  39456. return this.attr$1(a0, a1);
  39457. },
  39458. /** @expose */
  39459. classed : function(a0, a1) {
  39460. var args = arguments;
  39461. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  39462. return this.classed$0(a0);
  39463. }
  39464. if (args.length == 1) {
  39465. return this.classed$1(a0);
  39466. }
  39467. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  39468. return this.classed$3(a0, a1);
  39469. }
  39470. return this.classed$2(a0, a1);
  39471. },
  39472. /** @expose */
  39473. call : function(a0, a1) {
  39474. var args = arguments;
  39475. return this.call$0.apply(this, args);
  39476. },
  39477. /** @expose */
  39478. data : function(a0, a1) {
  39479. var args = arguments;
  39480. if (args.length == 0) {
  39481. return this.data$0();
  39482. }
  39483. if (args.length == 1 && typeof a0 === "function") {
  39484. return this.data$1(a0);
  39485. }
  39486. if (args.length == 1 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]")) {
  39487. return this.data$3(a0);
  39488. }
  39489. if (args.length == 2 && typeof a0 === "function" && typeof a1 === "function") {
  39490. return this.data$2(a0, a1);
  39491. }
  39492. if (args.length == 2 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]") && typeof a1 === "function") {
  39493. return this.data$4(a0, a1);
  39494. }
  39495. return com_ibm_rave_core_selector_Selector.prototype.data.apply(this, args);
  39496. },
  39497. /** @expose */
  39498. datum : function(a0) {
  39499. var args = arguments;
  39500. if (args.length == 0) {
  39501. return this.datum$0();
  39502. }
  39503. if (args.length == 1 && typeof a0 === "function") {
  39504. return this.datum$1(a0);
  39505. }
  39506. return this.datum$2(a0);
  39507. },
  39508. /** @expose */
  39509. filter : function(a0) {
  39510. var args = arguments;
  39511. if (args.length == 1 && typeof a0 === "function") {
  39512. return this.filter$0(a0);
  39513. }
  39514. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  39515. return this.filter$1(a0);
  39516. }
  39517. return Array.prototype.filter.apply(this, args);
  39518. },
  39519. /** @expose */
  39520. html : function(a0) {
  39521. var args = arguments;
  39522. if (args.length == 0) {
  39523. return this.html$0();
  39524. }
  39525. if (args.length == 1 && typeof a0 === "function") {
  39526. return this.html$2(a0);
  39527. }
  39528. return this.html$1(a0);
  39529. },
  39530. /** @expose */
  39531. insert : function(a0, a1) {
  39532. var args = arguments;
  39533. if (args.length == 2 && typeof a0 === "function" && (a1 == null || typeof a1 === "string")) {
  39534. return this.insert$2(a0, a1);
  39535. }
  39536. if (args.length == 2 && typeof a0 === "function" && typeof a1 === "function") {
  39537. return this.insert$3(a0, a1);
  39538. }
  39539. if (args.length == 2 && (a0 == null || typeof a0 === "string") && (a1 == null || typeof a1 === "string")) {
  39540. return this.insert$4(a0, a1);
  39541. }
  39542. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  39543. return this.insert$5(a0, a1);
  39544. }
  39545. return com_ibm_rave_core_selector_Selector.prototype.insert.apply(this, args);
  39546. },
  39547. /** @expose */
  39548. interrupt : function(a0) {
  39549. var args = arguments;
  39550. if (args.length == 0) {
  39551. return this.interrupt$0();
  39552. }
  39553. return this.interrupt$1(a0);
  39554. },
  39555. /** @expose */
  39556. init : function(a0) {
  39557. var args = arguments;
  39558. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  39559. return this.init$1(a0);
  39560. }
  39561. return this.init$0(a0);
  39562. },
  39563. /** @expose */
  39564. initAll : function(a0) {
  39565. var args = arguments;
  39566. if (args.length == 1 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]")) {
  39567. return this.initAll$0(a0);
  39568. }
  39569. return this.initAll$1(a0);
  39570. },
  39571. /** @expose */
  39572. on : function(a0, a1, a2) {
  39573. var args = arguments;
  39574. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  39575. return this.on$0(a0);
  39576. }
  39577. if (args.length == 1) {
  39578. return this.on$1(a0);
  39579. }
  39580. if (args.length == 2) {
  39581. return this.on$2(a0, a1);
  39582. }
  39583. return this.on$3(a0, a1, a2);
  39584. },
  39585. /** @expose */
  39586. owner : function(a0) {
  39587. var args = arguments;
  39588. if (args.length == 0) {
  39589. return this.owner$0();
  39590. }
  39591. if (args.length == 1 && typeof a0 === "function") {
  39592. return this.owner$2(a0);
  39593. }
  39594. return this.owner$1(a0);
  39595. },
  39596. /** @expose */
  39597. property : function(a0, a1) {
  39598. var args = arguments;
  39599. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  39600. return this.property$0(a0);
  39601. }
  39602. if (args.length == 1) {
  39603. return this.property$1(a0);
  39604. }
  39605. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  39606. return this.property$3(a0, a1);
  39607. }
  39608. return this.property$2(a0, a1);
  39609. },
  39610. /** @expose */
  39611. select : function(a0) {
  39612. var args = arguments;
  39613. if (args.length == 1 && typeof a0 === "function") {
  39614. return this.select$1(a0);
  39615. }
  39616. return this.select$0(a0);
  39617. },
  39618. /** @expose */
  39619. selectAll : function(a0) {
  39620. var args = arguments;
  39621. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  39622. return this.selectAll$0(a0);
  39623. }
  39624. return this.selectAll$1(a0);
  39625. },
  39626. /** @expose */
  39627. style : function(a0, a1, a2) {
  39628. var args = arguments;
  39629. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  39630. return this.style$6(a0);
  39631. }
  39632. if (args.length == 1) {
  39633. return this.style$0(a0);
  39634. }
  39635. if (args.length == 2 && (a0 == null || typeof a0 === "string") && typeof a1 === "function") {
  39636. return this.style$3(a0, a1);
  39637. }
  39638. if (args.length == 2 && (a0 == null || typeof a0 === "string") && (a1 == null || Object.prototype.toString.call(a1) !== "[object Array]")) {
  39639. return this.style$2(a0, a1);
  39640. }
  39641. if (args.length == 2) {
  39642. return this.style$1(a0, a1);
  39643. }
  39644. if (args.length == 3 && (a0 == null || typeof a0 === "string") && typeof a1 === "function" && (a2 == null || typeof a2 === "string")) {
  39645. return this.style$5(a0, a1, a2);
  39646. }
  39647. return this.style$4(a0, a1, a2);
  39648. },
  39649. /** @expose */
  39650. text : function(a0) {
  39651. var args = arguments;
  39652. if (args.length == 0) {
  39653. return this.text$2();
  39654. }
  39655. if (args.length == 1 && typeof a0 === "function") {
  39656. return this.text$1(a0);
  39657. }
  39658. return this.text$0(a0);
  39659. },
  39660. /** @expose */
  39661. transition : function(a0) {
  39662. var args = arguments;
  39663. if (args.length == 0) {
  39664. return this.transition$0();
  39665. }
  39666. return this.transition$1(a0);
  39667. }
  39668. });
  39669. // $source: com/ibm/rave/core/svg/AbstractTickHandler
  39670. /************************************************************************
  39671. ** IBM Confidential
  39672. **
  39673. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  39674. **
  39675. ** (C) Copyright IBM Corp. 2017
  39676. **
  39677. ** The source code for this program is not published or otherwise divested of its trade secrets,
  39678. ** irrespective of what has been deposited with the U.S. Copyright Office.
  39679. ************************************************************************/
  39680. // GENERATED
  39681. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  39682. var com_ibm_rave_core_svg_AbstractTickHandler = rave_externs["AbstractTickHandler"] = com_ibm_rave_core_nativeImpl_Declare({
  39683. /**
  39684. * Reset the work that was done when the tick handler was run.
  39685. * @param (com.ibm.rave.core.selector.Selection) ticks The selection containing the ticks to reset.
  39686. */
  39687. /** @expose */
  39688. reset : function(ticks) {}
  39689. });
  39690. })();