12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295 |
- (function() {
- // During the rave-canvas.js build, this file is added to the top.
- // Create an inner self-executing function that will be run with the global scope
- // On browsers, this is 'window'. Everywhere else should use 'this' if available.
- // Need to run eval('this') "indirectly" by having eval returned by (1,eval). OBVIOUSLY :)
- var _window = (1, eval)('this');
- (function (global, factory) {
- // dynamically determine how 'rave' variable should be loaded depeneding on loader type
- var _rave;
- if (typeof module === "object" && typeof module.exports === "object" && typeof require == "function") {
- // CommonJS/node.js
- module.exports = factory(global,require("rave"));
- } else if (typeof define === "function" && define.amd) {
- // AMD
- define(['rave'], function(rave) {
- return factory(global,rave);
- });
- } else {
- // probably loading via script tag. run as is, setting stuff on rave
- factory(global,global['rave']);
- }
- }(_window, function (_global, _rave) {// $source: com/ibm/rave/core/canvas/internal/nativeImpl/ModuleHeader
- /************************************************************************
- ** IBM Confidential
- **
- ** 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.
- ************************************************************************/
- // setup
- "use strict";
- // _global and _rave are initialized in the wrapping rave-canvas.js-header.js code
- /** @expose */
- var global = typeof _global !== "undefined" ? _global : (1, eval)('this');
- var rave = typeof _rave !== "undefined" ? _rave : global['rave'];
- var window = global;
- var rave_externs={},
- com_ibm_rave_core_Rave = rave,
- com_ibm_rave_core_nativeImpl_Declare = rave["_"]["com_ibm_rave_core_nativeImpl_Declare"],
- com_ibm_rave_core_nativeImpl_Object = rave["_"]["com_ibm_rave_core_nativeImpl_Object"],
- com_ibm_rave_core_internal_nativeImpl_Lang = rave["_"]["com_ibm_rave_core_internal_nativeImpl_Lang"],
- com_ibm_rave_core_geom_PointStruct = rave["_"]["com_ibm_rave_core_geom_PointStruct"],
- com_ibm_rave_core_geom_RectStruct = rave["internal"]["RectStruct"],
- com_ibm_rave_core_geom_RaveRect = rave["internal"]["RaveRect"],
- com_ibm_rave_core_transform_MatrixUtil = rave["internal"]["MatrixUtil"],
- com_ibm_rave_core_scene_SceneNodeType = rave["_"]["com_ibm_rave_core_scene_SceneNodeType"],
- com_ibm_rave_core_internal_css_CSSUtil = rave["_"]["com_ibm_rave_core_internal_css_CSSUtil"],
- com_ibm_rave_core_internal_css_CSSTransformParser = rave["_"]["com_ibm_rave_core_internal_css_CSSTransformParser"],
- com_ibm_rave_core_internal_css_om_CSSStyleDeclarationImpl = rave["_"]["com_ibm_rave_core_internal_css_om_CSSStyleDeclarationImpl"],
- com_ibm_rave_core_internal_css_CSSParser = rave["_"]["com_ibm_rave_core_internal_css_CSSParser"],
- com_ibm_rave_core_context_RaveContextManager = rave["internal"]["RaveContextManager"],
- com_ibm_rave_core_context_RaveOperationalMode = rave["internal"]["RaveOperationalMode"],
- rave_document = rave["_"]["rave_document"];
- // $source: com/ibm/rave/core/internal/util/CollectionsUtil
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- var com_ibm_rave_core_internal_util_CollectionsUtil = {
- //constructor : function() {}
- };
- /**
- * Removes the value from the list.
- * @param (Array) list the list to remove the value from
- * @param (Object) value the value to remove
- * @return (boolean) <code>true</code> if the value was found in the list, <code>false</code> otherwise
- */
- com_ibm_rave_core_internal_util_CollectionsUtil.remove = function(list, value) {
- var i = list.indexOf(value);
- if (i >= 0) {
- list.splice(i, 1);
- return true;
- }
- return false;
- };
- // $source: com/ibm/rave/core/internal/css/CSSStyle
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- var com_ibm_rave_core_internal_css_CSSStyle = function(id, name, inheritable) {
- this.id = id;
- this.name = name;
- this.inheritable = inheritable;
- };
- // $source: com/ibm/rave/core/internal/css/CSSConstants
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- var com_ibm_rave_core_internal_css_CSSConstants = {
- };
- com_ibm_rave_core_internal_css_CSSConstants.TRANSFORM = "transform";
- com_ibm_rave_core_internal_css_CSSConstants.ID = "id";
- com_ibm_rave_core_internal_css_CSSConstants.IMPORTANT = "important";
- com_ibm_rave_core_internal_css_CSSConstants.INITIAL = "initial";
- com_ibm_rave_core_internal_css_CSSConstants.INHERIT = "inherit";
- com_ibm_rave_core_internal_css_CSSConstants.NONE = "none";
- com_ibm_rave_core_internal_css_CSSConstants.TRANSPARENT = "transparent";
- com_ibm_rave_core_internal_css_CSSConstants.IN_PX = 96.0;
- com_ibm_rave_core_internal_css_CSSConstants.PT_IN = 0.0138888889;
- com_ibm_rave_core_internal_css_CSSConstants.PC_IN = 0.1666666667;
- com_ibm_rave_core_internal_css_CSSConstants.CM_IN = 0.3937007874;
- com_ibm_rave_core_internal_css_CSSConstants.MM_IN = 0.0393700787;
- com_ibm_rave_core_internal_css_CSSConstants.NORMAL = "normal";
- com_ibm_rave_core_internal_css_CSSConstants.BOLD = "bold";
- com_ibm_rave_core_internal_css_CSSConstants.OBLIQUE = "oblique";
- com_ibm_rave_core_internal_css_CSSConstants.ITALIC = "italic";
- com_ibm_rave_core_internal_css_CSSConstants.BOLDER = "bolder";
- com_ibm_rave_core_internal_css_CSSConstants.LIGHTER = "lighter";
- com_ibm_rave_core_internal_css_CSSConstants.SMALLCAPS = "small-caps";
- // $source: com/ibm/rave/render/internal/properties/SceneNodeStyles
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- /**
- * A list of public style properties for scene nodes. These style attributes are also "presentation attributes", meaning they can be defined as a style (style="fill:red") or an attribute (fill="red").
- */
- var com_ibm_rave_render_internal_properties_SceneNodeStyles = {
- };
- /**
- * Is the style represented by 'index' one that affects layout? For instance, x, y, etc styles all affect layout.
- * @param (int) index style index to search
- * @return (boolean) <code>true</code> if this index represents a 'layout' style, <code>false</code> otherwise.
- */
- com_ibm_rave_render_internal_properties_SceneNodeStyles.isLayoutStyle = function(index) {
- return index <= 27;
- };
- com_ibm_rave_render_internal_properties_SceneNodeStyles.x = 0;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.y = 1;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.width = 2;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.height = 3;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.x1 = 4;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.x2 = 5;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.r = 6;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.y1 = 7;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.y2 = 8;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.cx = 9;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.cy = 10;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.transform = 11;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.rx = 12;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.ry = 13;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.line_height = 14;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.dx = 15;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.dy = 16;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.offset = 17;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.fx = 18;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.fy = 19;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.font = 20;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.font_family = 21;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.font_size = 22;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.font_style = 23;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.font_weight = 24;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.font_variant = 25;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.display = 26;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.text_anchor = 27;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.LAYOUT_INDEX = 27;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.fill = 28;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke = 29;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.opacity = 30;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_width = 31;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_opacity = 32;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.fill_opacity = 33;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_dasharray = 34;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_dashoffset = 35;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_linecap = 36;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_linejoin = 37;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_miterlimit = 38;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.text_decoration = 39;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.stop_color = 40;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.stop_opacity = 41;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.pointer_events = 42;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.cursor = 43;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.clip_path = 44;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.visibility = 45;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.text_shadow = 46;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.shape_rendering = 47;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames = ["x", "y", "width", "height", "x1", "x2", "r", "y1", "y2", "cx", "cy", "transform", "rx", "ry", "line-height", "dx", "dy", "offset", "fx", "fy", "font", "font-family", "font-size", "font-style", "font-weight", "font-variant", "display", "text-anchor", "fill", "stroke", "opacity", "stroke-width", "stroke-opacity", "fill-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "text-decoration", "stop-color", "stop-opacity", "pointer-events", "cursor", "clip-path", "visibility", "text-shadow", "shape-rendering"];
- // $source: com/ibm/rave/render/internal/nodes/NodeUtil
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/render/internal/RendererConfiguration (runtime) // RendererConfiguration
- var com_ibm_rave_render_internal_nodes_NodeUtil = {
- };
- /**
- * Find the referenced scene node matching the expected type. The search is performed from the root of the given context node.
- * @param (com.ibm.rave.core.scene.SceneNode) context the context node in which to search
- * @param (String) id the node ID to search for
- * @param (int[]) expectedTypes array of expected node types (of type from SceneNodeType)
- * @return (com.ibm.rave.core.scene.SceneNode) the matching scene node, or <code>null</code> if not found or expected type differs
- */
- com_ibm_rave_render_internal_nodes_NodeUtil.findSceneNode = function(context, id, expectedTypes) {
- var rootProvider = com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.getRootProviderForNode(context);
- if (id != null && rootProvider) {
- var cm = rootProvider.getCacheManager();
- if (cm) {
- var match = cm.matchId(1000, id, rootProvider.getRoot());
- if (match) {
- for (var __i_enFor0 = 0, __len_enFor0 = expectedTypes.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var expectedType = expectedTypes[__i_enFor0];
- if (match.rave_getDrawType() == expectedType) {
- return match;
- }
- }
- }
- }
- }
- return null;
- };
- // $source: com/ibm/rave/core/internal/svg/SVGConstants
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- var com_ibm_rave_core_internal_svg_SVGConstants = {
- };
- com_ibm_rave_core_internal_svg_SVGConstants.ELLIPSE = "ellipse";
- com_ibm_rave_core_internal_svg_SVGConstants.RECT = "rect";
- com_ibm_rave_core_internal_svg_SVGConstants.CIRCLE = "circle";
- com_ibm_rave_core_internal_svg_SVGConstants.LINE = "line";
- com_ibm_rave_core_internal_svg_SVGConstants.TEXT = "text";
- com_ibm_rave_core_internal_svg_SVGConstants.TEXTPATH = "textPath";
- com_ibm_rave_core_internal_svg_SVGConstants.G = "g";
- com_ibm_rave_core_internal_svg_SVGConstants.PATH = "path";
- com_ibm_rave_core_internal_svg_SVGConstants.POLYGON = "polygon";
- com_ibm_rave_core_internal_svg_SVGConstants.POLYLINE = "polyline";
- com_ibm_rave_core_internal_svg_SVGConstants.DEFS = "defs";
- com_ibm_rave_core_internal_svg_SVGConstants.LINEARGRADIENT = "linearGradient";
- com_ibm_rave_core_internal_svg_SVGConstants.STOP = "stop";
- com_ibm_rave_core_internal_svg_SVGConstants.RADIALGRADIENT = "radialGradient";
- com_ibm_rave_core_internal_svg_SVGConstants.IMAGE = "image";
- com_ibm_rave_core_internal_svg_SVGConstants.CLIP_PATH = "clipPath";
- com_ibm_rave_core_internal_svg_SVGConstants.STOP_COLOR = "stop-color";
- com_ibm_rave_core_internal_svg_SVGConstants.OFFSET = "offset";
- com_ibm_rave_core_internal_svg_SVGConstants.TSPAN = "tspan";
- //com_ibm_rave_core_internal_svg_SVGConstants.MOVE_TO = "M";
- //com_ibm_rave_core_internal_svg_SVGConstants.LINE_TO = "L";
- //com_ibm_rave_core_internal_svg_SVGConstants.CLOSE_PATH = "Z";
- //com_ibm_rave_core_internal_svg_SVGConstants.PATH_SEPARATOR = ",";
- // $source: com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/Dashing
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 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.
- ************************************************************************/
- // @import com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/BezierUtils (runtime)
- var com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing = {
-
- /**
- * Split the points into curve segments.
- *
- * @param ctx
- * the canvas context
- * @param dash
- * the dash array
- * @param newPoints
- * an array to be filled with curve info
- * @param prevResidue
- * optional object containing previous dash info
- */
- splitToDashedBezier : function(points, dash, newPoints, prevResidue) {
- var residue = 0, t = 0, da, i = 0;
- if (prevResidue) {
- da = prevResidue.l;
- i = prevResidue.i;
- } else {
- da = dash[0];
- }
- while (t < 1) {
- // get the 't' corresponding to the given dash value.
- t = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_BezierUtils.tAtLength(points, da);
- if (t == 1) {
- var rl = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_BezierUtils.computeLength(points);
- residue = {
- l : da - rl,
- i : i
- };
- }
- // split bezier at t: left part is the "dash" curve, right part is the remaining bezier points
- var curves = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_BezierUtils.splitBezierAtT(points, t);
- if (!(i % 2)) {
- // only keep the "dash" curve
- newPoints.push(curves[0]);
- }
- points = curves[1];
- ++i;
- da = dash[i % dash.length];
- }
- return residue;
- },
-
- /**
- * Builds a set of bezier (cubic || quadratic)CurveTo' canvas instructions
- * that represents a dashed stroke of the specified bezier geometry.
- *
- * @param ctx
- * the canvas context
- * @param dash
- * the dash array
- * @param x
- * the start x coordinate
- * @param y
- * the start y coordinate
- * @param points
- * the control points
- * @param prevResidue
- * optional object containing previous dash info
- */
- toDashedCurveTo : function(ctx, dash, x, y, points, prevResidue) {
- var pts = [x, y].concat(points), quadratic = points.length === 4, api = quadratic ? "quadraticCurveTo"
- : "bezierCurveTo", curves = [];
- var residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.splitToDashedBezier(pts, dash, curves, prevResidue);
- for (var c = 0; c < curves.length; ++c) {
- var curve = curves[c];
- ctx.moveTo(curve[0], curve[1]);
- ctx[api].apply(ctx, curve.slice(2));
- }
- return residue;
- },
-
- /**
- * Builds a set of moveTo/lineTo' canvas instructions that represents a
- * dashed stroke of the specified line geometry.
- *
- * @param ctx
- * the canvas context
- * @param dash
- * the dash array
- * @param x1
- * the start x coordinate
- * @param y1
- * the start y coordinate
- * @param x2
- * the end x coordinate
- * @param y2
- * the end y coordinate
- * @param prevResidue
- * optional object containing previous dash info
- */
- toDashedLineTo : function(ctx, dash, x1, y1, x2, y2, prevResidue) {
- var residue = 0, r = 0, da = 0, tlength = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_BezierUtils.distance(x1, y1, x2, y2), i = 0, prevx = x1, prevy = y1, x, y;
- if (prevResidue) {
- da = prevResidue.l;
- i = prevResidue.i;
- } else {
- da += dash[0];
- }
- while (Math.abs(1 - r) > 0) {
- if (da > tlength) {
- residue = {
- l : da - tlength,
- i : i
- };
- da = tlength;
- }
- r = da / tlength;
- x = x1 + (x2 - x1) * r;
- y = y1 + (y2 - y1) * r;
- if (!(i++ % 2)) {
- ctx.moveTo(prevx, prevy);
- ctx.lineTo(x, y);
- }
- prevx = x;
- prevy = y;
- da += dash[i % dash.length];
- }
- if (!residue && i) {
- residue = {l: dash[i % dash.length], i: i};
- }
- return residue;
- }
- };
- // $source: com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/BezierUtils
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 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.
- ************************************************************************/
- // From dojo without the gfx dependency.
- // Required to support non-native dashing.
- var com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_BezierUtils = (function() {
- var bu = {},
- error = 0.1;
- bu.tAtLength = function(points, length){
- // summary:
- // Returns the t corresponding to the given length for the specified bezier curve.
- // points: Number[]
- // The bezier points. Should be [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y] for a cubic
- // bezier curve or [p1x, p1y, cx, cy, p2x, p2y] for a quadratic bezier curve.
- // length: Number
- // The length.
- var t = 0,
- quadratic = points.length == 6,
- currentLen = 0,
- splitCount = 0,
- splitFunc = quadratic ? splitQBezierAtT : splitBezierAtT;
- var _compute = function(p, error){
- // control points polygon length
- var pLen = 0;
- for(var i = 0; i < p.length-2; i+=2)
- pLen += distance(p[i],p[i+1],p[i+2],p[i+3]);
- // chord length
- var chord = quadratic ?
- distance(points[0],points[1],points[4],points[5]) :
- distance(points[0],points[1],points[6],points[7]);
- // if needs more approx. or if currentLen is greater than the target length,
- // split the curve one more time
- if(pLen - chord > error || currentLen + pLen > length + error){
- ++splitCount;
- var newbezier = splitFunc(p, .5);
- // check 1st subpath
- _compute(newbezier[0], error);
- // the 1st subcurve was the good one, we stop
- if(Math.abs(currentLen - length) <= error){
- return;
- }
- // need to continue with the 2nde subcurve
- _compute(newbezier[1], error);
- return ;
- }
- currentLen += pLen;
- t += 1.0 / (1 << splitCount);
- };
- if(length)
- _compute(points, 0.5);
- return t;
- };
- var computeLength = bu.computeLength = function(/*Array*/points){
- // summary:
- // Returns the length of the given bezier curve.
- // points: Number[]
- // The bezier points. Should be [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y] for a cubic
- // bezier curve or [p1x, p1y, cx, cy, p2x, p2y] for a quadratic bezier curve.
- var quadratic = points.length == 6, pLen=0;
- // control points polygon length
- for(var i = 0; i < points.length-2; i+=2)
- pLen += distance(points[i],points[i+1],points[i+2],points[i+3]);
- // chord length
- var chord = quadratic ?
- distance(points[0],points[1],points[4],points[5]) :
- distance(points[0],points[1],points[6],points[7]);
- // split polygons until the polygon and the chord are "the same"
- if(pLen-chord>error){
- var newBeziers = quadratic ? splitQBezierAtT(points,.5) : splitCBezierAtT(points,.5);
- var length = computeLength(newBeziers[0], quadratic);
- length += computeLength(newBeziers[1], quadratic);
- return length;
- }
- // pLen is close enough, done.
- return pLen;
- };
- var distance = bu.distance = function(x1, y1, x2, y2){
- // summary:
- // Returns the distance between the specified points.
- return Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
- };
- var splitQBezierAtT = function(points, t){
- // summary:
- // Split a quadratic bezier curve into 2 sub-quadratic beziers at the specified t.
- // de Casteljau
- var r = 1-t,
- r2 = r*r,
- t2 = t*t,
- p1x = points[0],
- p1y = points[1],
- cx = points[2],
- cy = points[3],
- p2x = points[4],
- p2y = points[5],
- ax = r*p1x + t*cx,
- ay = r*p1y + t*cy,
- bx = r*cx + t*p2x,
- by = r*cy + t*p2y,
- px = r2*p1x + 2*r*t*cx + t2*p2x,
- py = r2*p1y + 2*r*t*cy + t2*p2y;
- return [
- [
- p1x, p1y,
- ax, ay,
- px, py
- ],
- [
- px, py,
- bx, by,
- p2x, p2y
- ]
- ];
- };
- var splitCBezierAtT = function(points, t){
- // summary:
- // Split a cubic bezier curve into 2 sub-cubic beziers at the specified t.
- // de Casteljau
- var r = 1-t,
- r2 = r*r,
- r3 = r2*r,
- t2 = t*t,
- t3 = t2*t,
- p1x = points[0],
- p1y = points[1],
- c1x = points[2],
- c1y = points[3],
- c2x = points[4],
- c2y = points[5],
- p2x = points[6],
- p2y = points[7],
- ax = r*p1x + t*c1x,
- ay = r*p1y + t*c1y,
- cx = r*c2x + t*p2x,
- cy = r*c2y + t*p2y,
- mx = r2*p1x + 2*r*t*c1x + t2*c2x,
- my = r2*p1y + 2*r*t*c1y + t2*c2y,
- nx = r2*c1x + 2*r*t*c2x + t2*p2x,
- ny = r2*c1y + 2*r*t*c2y + t2*p2y,
- px = r3*p1x + 3*r2*t*c1x + 3*r*t2*c2x+t3*p2x,
- py = r3*p1y + 3*r2*t*c1y + 3*r*t2*c2y+t3*p2y;
- return [
- [
- p1x, p1y,
- ax, ay,
- mx, my,
- px, py
- ],
- [
- px, py,
- nx, ny,
- cx, cy,
- p2x, p2y
- ]
- ];
- };
- var splitBezierAtT = bu.splitBezierAtT = function(points, t){
- return points.length == 6 ? splitQBezierAtT(points, t) : splitCBezierAtT(points, t);
- };
- return bu;
- })();
- // $source: com/ibm/rave/render/internal/select/jsoup/select/QueryParser
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/core/context/RaveContextManager (runtime) // RaveContextManager
- //@import com/ibm/rave/render/internal/select/jsoup/select/StructuralEvaluator (runtime) // new
- //@import com/ibm/rave/render/internal/select/jsoup/select/CombiningEvaluator (runtime) // new
- //@import com/ibm/rave/render/internal/select/jsoup/select/Evaluator (runtime) // new
- //@import com/ibm/rave/render/internal/select/jsoup/parser/TokenQueue (runtime) // new, unescape
- /**
- * Parses a CSS selector into an Evaluator tree.
- */
- var com_ibm_rave_render_internal_select_jsoup_select_QueryParser = com_ibm_rave_core_nativeImpl_Declare({
- //tq : null,
- //evals : null,
- constructor : function(query) {
- this.evals = [];
- /**
- * Create a new QueryParser.
- * @param (String) query CSS query
- */
- {
- this.tq = new com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue(query);
- }
- },
- getQueryParserRegExps : function() {
- var queryParserRegExps = com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData("QUERY_PARSER_REG_EXP_KEY");
- if (!queryParserRegExps) {
- queryParserRegExps = new com_ibm_rave_render_internal_select_jsoup_select_QueryParser.QueryParserRegExps();
- com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().putData("QUERY_PARSER_REG_EXP_KEY", queryParserRegExps);
- }
- return queryParserRegExps;
- },
- /**
- * Parse the query
- * @return (com.ibm.rave.render.internal.select.jsoup.select.Evaluator) Evaluator
- */
- parse$1 : function() {
- this.tq.consumeWhitespace();
- if (this.tq.matchesAnyChar.apply(this.tq, com_ibm_rave_render_internal_select_jsoup_select_QueryParser.combinators)) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Root());
- this.combinator(this.tq.consume$0());
- } else {
- if (!(this.findElements())) {
- return null;
- }
- }
- while (!(this.tq.isEmpty())) {
- var seenWhite = this.tq.consumeWhitespace();
- if (this.tq.matchesAnyChar.apply(this.tq, com_ibm_rave_render_internal_select_jsoup_select_QueryParser.combinators)) {
- this.combinator(this.tq.consume$0());
- } else if (seenWhite) {
- this.combinator(32);
- } else {
- if (!(this.findElements())) {
- return null;
- }
- }
- }
- if (this.evals.length == 1) {
- return this.evals[0];
- }
- return new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And(this.evals);
- },
- combinator : function(combinator) {
- this.tq.consumeWhitespace();
- var subQuery = this.consumeSubQuery();
- var rootEval;
- var currentEval;
- var newEval = com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(subQuery);
- var replaceRightMost = false;
- if (this.evals.length == 1) {
- rootEval = currentEval = this.evals[0];
- if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(rootEval, com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.Or) && combinator != 44) {
- currentEval = (currentEval).rightMostEvaluator();
- replaceRightMost = true;
- }
- } else {
- rootEval = currentEval = new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And(this.evals);
- }
- this.evals = [];
- if (combinator == 62) {
- currentEval = new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And([newEval, new com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.ImmediateParent(currentEval)]);
- } else if (combinator == 32) {
- currentEval = new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And([newEval, new com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Parent(currentEval)]);
- } else if (combinator == 43) {
- currentEval = new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And([newEval, new com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.ImmediatePreviousSibling(currentEval)]);
- } else if (combinator == 126) {
- currentEval = new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And([newEval, new com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.PreviousSibling(currentEval)]);
- } else if (combinator == 44) {
- var or;
- if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(currentEval, com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.Or)) {
- or = currentEval;
- or.add(newEval);
- } else {
- or = new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.Or(null);
- or.add(currentEval);
- or.add(newEval);
- }
- currentEval = or;
- } else {
- return;
- }
- if (replaceRightMost) {
- (rootEval).replaceRightMostEvaluator(currentEval);
- } else {
- rootEval = currentEval;
- }
- this.evals.push(rootEval);
- },
- consumeSubQuery : function() {
- var sq = "";
- while (!(this.tq.isEmpty())) {
- if (this.tq.matchesChar(40)) {
- sq += "(" + this.tq.chompBalanced(40, 41) + ")";
- } else if (this.tq.matchesChar(91)) {
- sq += "[" + this.tq.chompBalanced(91, 93) + "]";
- } else if (this.tq.matchesAnyChar.apply(this.tq, com_ibm_rave_render_internal_select_jsoup_select_QueryParser.combinators)) {
- break;
- } else {
- sq += String.fromCharCode(this.tq.consume$0());
- }
- }
- return sq;
- },
- findElements : function() {
- if (this.tq.matchCharChomp(46)) {
- this.byClass();
- } else if (this.tq.matchCharChomp(35)) {
- this.byId();
- } else if (this.tq.matchCharChomp(42)) {
- this.allElements();
- } else if (this.tq.matchesChar(91)) {
- this.byAttribute();
- } else if (this.tq.matchesWord()) {
- this.byTag();
- } else if (this.tq.matchesChar(58)) {
- if (this.tq.matchChomp(":lt(")) {
- this.indexLessThan();
- } else if (this.tq.matchChomp(":gt(")) {
- this.indexGreaterThan();
- } else if (this.tq.matchChomp(":eq(")) {
- this.indexEquals();
- } else if (this.tq.matches(":has(")) {
- this.has();
- } else if (this.tq.matches(":contains(")) {
- this.contains(false);
- } else if (this.tq.matches(":containsOwn(")) {
- this.contains(true);
- } else if (this.tq.matches(":matches(")) {
- this.matches(false);
- } else if (this.tq.matches(":matchesOwn(")) {
- this.matches(true);
- } else if (this.tq.matches(":not(")) {
- this.not();
- } else if (this.tq.matchChomp(":nth-child(")) {
- this.cssNthChild(false, false);
- } else if (this.tq.matchChomp(":nth-last-child(")) {
- this.cssNthChild(true, false);
- } else if (this.tq.matchChomp(":nth-of-type(")) {
- this.cssNthChild(false, true);
- } else if (this.tq.matchChomp(":nth-last-of-type(")) {
- this.cssNthChild(true, true);
- } else if (this.tq.matchChomp(":first-child")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsFirstChild());
- } else if (this.tq.matchChomp(":last-child")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsLastChild());
- } else if (this.tq.matchChomp(":first-of-type")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthOfType(0, 1));
- } else if (this.tq.matchChomp(":last-of-type")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthLastOfType(0, 1));
- } else if (this.tq.matchChomp(":only-child")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsOnlyChild());
- } else if (this.tq.matchChomp(":only-of-type")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsOnlyOfType());
- } else if (this.tq.matchChomp(":empty")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsEmpty());
- } else if (this.tq.matchChomp(":root")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsRoot());
- } else {
- return false;
- }
- return true;
- } else {
- return false;
- }
- return true;
- },
- byId : function() {
- var id = this.tq.consumeCssIdentifier();
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Id(id));
- },
- byClass : function() {
- var className = this.tq.consumeCssIdentifier();
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Class(className.trim()));
- },
- byTag : function() {
- var tagName = this.tq.consumeElementSelector();
- if (0 <= tagName.indexOf("|")) {
- tagName = tagName.replace("|", ":");
- }
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Tag(tagName.trim()));
- },
- byAttribute : function() {
- var cq = new com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue(this.tq.chompBalanced(91, 93));
- var key = cq.consumeToAny.apply(cq, com_ibm_rave_render_internal_select_jsoup_select_QueryParser.AttributeEvals);
- cq.consumeWhitespace();
- if (cq.isEmpty()) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Attribute(key));
- } else {
- if (cq.matchChomp("=")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValue(key, cq.remainder()));
- } else if (cq.matchChomp("!=")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueNot(key, cq.remainder()));
- } else if (cq.matchChomp("^=")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueStarting(key, cq.remainder()));
- } else if (cq.matchChomp("$=")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueEnding(key, cq.remainder()));
- } else if (cq.matchChomp("*=")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueContaining(key, cq.remainder()));
- } else if (cq.matchChomp("~=")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueMatching(key, new RegExp(cq.remainder(), "i")));
- } else {
- return;
- }
- }
- },
- allElements : function() {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AllElements());
- },
- indexLessThan : function() {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexLessThan(this.consumeIndex()));
- },
- indexGreaterThan : function() {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexGreaterThan(this.consumeIndex()));
- },
- indexEquals : function() {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexEquals(this.consumeIndex()));
- },
- cssNthChild : function(backwards, ofType) {
- var argS = this.tq.chompTo(")").trim().toLowerCase();
- var queryParserRegExps = this.getQueryParserRegExps();
- var mAB = queryParserRegExps.NTH_AB.exec(argS);
- var mB = queryParserRegExps.NTH_B.exec(argS);
- var a, b;
- if ("odd" == argS) {
- a = 2;
- b = 1;
- } else if ("even" == argS) {
- a = 2;
- b = 0;
- } else if (mAB && mAB.length > 0) {
- a = mAB[3] != null ? ~~ (mAB[1].replace("^\\+", "")) : 1;
- b = mAB[4] != null ? ~~ (mAB[4].replace("^\\+", "")) : 1;
- } else if (mB && mB.length > 0) {
- a = 0;
- b = ~~ (mB[0].replace("^\\+", ""));
- } else {
- return;
- }
- if (ofType) {
- if (backwards) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthLastOfType(a, b));
- } else {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthOfType(a, b));
- }
- } else {
- if (backwards) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthLastChild(a, b));
- } else {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthChild(a, b));
- }
- }
- },
- consumeIndex : function() {
- var indexS = this.tq.chompTo(")").trim();
- return parseInt(indexS);
- },
- has : function() {
- this.tq.consume$1(":has");
- var subQuery = this.tq.chompBalanced(40, 41);
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Has(com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(subQuery)));
- },
- contains : function(own) {
- this.tq.consume$1(own ? ":containsOwn" : ":contains");
- var searchText = com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.unescape(this.tq.chompBalanced(40, 41));
- if (own) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.ContainsOwnText(searchText));
- } else {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.ContainsText(searchText));
- }
- },
- matches : function(own) {
- this.tq.consume$1(own ? ":matchesOwn" : ":matches");
- var regex = this.tq.chompBalanced(40, 41);
- if (own) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.MatchesOwn(new RegExp(regex, "")));
- } else {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Matches(new RegExp(regex, "")));
- }
- },
- not : function() {
- this.tq.consume$1(":not");
- var subQuery = this.tq.chompBalanced(40, 41);
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Not(com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(subQuery)));
- },
- parse : function() {
- var args = arguments;
- return this.parse$1();
- }
- });
- /**
- * Parse a CSS query into an Evaluator.
- * @param (String) query CSS query
- * @return (com.ibm.rave.render.internal.select.jsoup.select.Evaluator) Evaluator
- */
- com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0 = function(query) {
- var p = new com_ibm_rave_render_internal_select_jsoup_select_QueryParser(query);
- return p.parse$1();
- };
- com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse = function(a0) {
- var args = arguments;
- return com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(a0);
- };
- com_ibm_rave_render_internal_select_jsoup_select_QueryParser.QueryParserRegExps = com_ibm_rave_core_nativeImpl_Declare({
- //NTH_AB : null,
- //NTH_B : null,
- constructor : function() {
- this.NTH_AB = new RegExp("((\\+|-)?(\\d+)?)n(\\s*(\\+|-)?\\s*\\d*)?", "i");
- this.NTH_B = new RegExp("(\\+|-)?(\\d+)", "");
- }
- });
- //com_ibm_rave_render_internal_select_jsoup_select_QueryParser.QUERY_PARSER_REG_EXP_KEY = "QUERY_PARSER_REG_EXP_KEY";
- com_ibm_rave_render_internal_select_jsoup_select_QueryParser.combinators = [44, 62, 43, 126, 32];
- com_ibm_rave_render_internal_select_jsoup_select_QueryParser.AttributeEvals = ["=", "!=", "^=", "$=", "*=", "~="];
- // $source: com/ibm/rave/render/internal/select/jsoup/select/Evaluator
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * Evaluates that an SceneNode matches the selector.
- */
- var com_ibm_rave_render_internal_select_jsoup_select_Evaluator = com_ibm_rave_core_nativeImpl_Declare({
- /**
- * Test if a SceneNode has been cached for this evaluator.
- * @param (com.ibm.rave.render.internal.nodes.cache.SceneNodeCacheManager) manager The external cache manager
- * @param (com.ibm.rave.core.scene.SceneNode) element The element currently being tested for a match.
- * @return (Array) list of cached scene nodes.
- */
- cached : function(manager, element) {
- return null;
- }
- //constructor : function() {},
- /**
- * Test if the SceneNode meets the evaluator's requirements.
- * @param (com.ibm.rave.core.scene.SceneNode) root Root of the matching subtree
- * @param (com.ibm.rave.core.scene.SceneNode) element tested SceneNode
- * @return (boolean) <code>true</code> if it matches, <code>false</code> otherwise.
- */
- //matches : function(root, element) {}
- });
- /**
- * Evaluator for tag name
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Tag = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
- //tagName : null,
- constructor : function(tagName) {
- this.tagName = tagName;
- },
- matches : function(root, element) {
- if (root == element) {
- return false;
- }
- return (element.rave_getName() == this.tagName);
- }
- });
- /**
- * Evaluator for SceneNode id
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Id = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
- //id : null,
- constructor : function(id) {
- this.id = id;
- },
- matches : function(root, element) {
- return (this.id == (element).getId());
- },
- cached : function(cache, root) {
- if (!cache) {
- return null;
- }
- var cached = cache.matchId(1000, this.id, root);
- return !cached ? null : [cached];
- }
- });
- /**
- * Evaluator for SceneNode class
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Class = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
- //className : null,
- constructor : function(className) {
- this.className = className;
- },
- cached : function(cache, root) {
- return null;
- },
- matches : function(root, element) {
- return (element).getClassList().indexOf(this.className)> -1;
- }
- });
- /**
- * Abstract evaluator for attribute name/value matching
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeKeyPair = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
- //key : null,
- //value : null,
- isIdKey : false,
- isClassKey : false,
- constructor : function(key, value) {
- var _value = value;
- this.key = key.trim().toLowerCase();
- if (_value != null) {
- if ((_value.match("^[\"'].*") && _value.match(".*[\"']$"))) {
- _value = _value.substring(1, _value.length - 1);
- }
- this.value = _value.trim();
- }
- if (this.key == "id") {
- this.isIdKey = true;
- } else if (this.key == "class") {
- this.isClassKey = true;
- }
- },
- cached : function(node, root) {
- return null;
- }
- });
- /**
- * Evaluator for attribute name matching
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Attribute = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeKeyPair, {
- matches : function(root, element) {
- if (root == element) {
- return false;
- }
- if (this.isIdKey) {
- return (element).getId() != null;
- }
- return element.getAttribute(this.key) != null;
- },
- cached : function(node, root) {
- return null;
- }
- //constructor : function(key) {}
- });
- /**
- * Evaluator for attribute name/value matching
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValue = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeKeyPair, {
- cached : function(cache, root) {
- if (!cache) {
- return null;
- }
- if (this.isIdKey) {
- var cached = cache.matchId(1000, this.value, root);
- return !cached ? null : [cached];
- } else if (this.isClassKey) {
- return cache.matchClass(1001, this.value, root);
- }
- return null;
- },
- matches : function(root, element) {
- if (root == element) {
- return false;
- }
- if (this.isIdKey) {
- return this.value == (element).getId();
- }
- var val = element.getAttribute(this.key);
- var attributeValue = val == null ? "" : ""+(element.getAttribute(this.key));
- return this.value.toUpperCase() == attributeValue.toUpperCase();
- }
- //constructor : function(key, value) {}
- });
- /**
- * Evaluator for attribute name != value matching
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueNot = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeKeyPair, {
- matches : function(root, element) {
- var val = element.getAttribute(this.key);
- var attributeValue = val == null ? "" : ""+(element.getAttribute(this.key));
- return !(this.value.toUpperCase() == attributeValue.toUpperCase());
- }
- //constructor : function(key, value) {}
- });
- /**
- * Evaluator for attribute name/value matching (value prefix)
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueStarting = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeKeyPair, {
- matches : function(root, element) {
- var attributeValue = element.getAttribute(this.key);
- if (attributeValue == null) {
- return false;
- }
- var elementValue = ""+(attributeValue);
- return elementValue.match("^" + this.value + ".*");
- }
- //constructor : function(key, value) {}
- });
- /**
- * Evaluator for attribute name/value matching (value ending)
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueEnding = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeKeyPair, {
- matches : function(root, element) {
- var attributeVal = element.getAttribute(this.key);
- if (attributeVal == null) {
- return false;
- }
- var elementValue = ""+(attributeVal);
- return elementValue.match(".*" + this.value + "$");
- }
- //constructor : function(key, value) {}
- });
- /**
- * Evaluator for attribute name/value matching (value containing)
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueContaining = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeKeyPair, {
- matches : function(root, element) {
- var attributeValue = element.getAttribute(this.key);
- if (attributeValue == null) {
- return false;
- }
- var elementValue = ""+(attributeValue);
- return 0 <= elementValue.indexOf(this.value);
- }
- //constructor : function(key, value) {}
- });
- /**
- * Evaluator for attribute name/value matching (value regex matching)
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueMatching = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
- //key : null,
- //pattern : null,
- constructor : function(key, pattern) {
- this.key = key.trim().toLowerCase();
- this.pattern = pattern;
- },
- matches : function(root, element) {
- return element.getAttribute(this.key) != null && this.pattern.test(""+(element.getAttribute(this.key)));
- }
- });
- /**
- * Evaluator for any / all SceneNode matching
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AllElements = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
- matches : function(root, element) {
- return element != root;
- }
- });
- /**
- * Abstract evaluator for sibling index matching
- * @author ant
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexEvaluator = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
- index : 0,
- constructor : function(index) {
- this.index = index;
- }
- });
- /**
- * Evaluator for matching by sibling index number (e < idx)
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexLessThan = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexEvaluator, {
- matches : function(root, element) {
- return (element).getSiblingIndex() < this.index;
- }
- //constructor : function(index) {}
- });
- /**
- * Evaluator for matching by sibling index number (e > idx)
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexGreaterThan = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexEvaluator, {
- matches : function(root, element) {
- return (element).getSiblingIndex() > this.index;
- }
- //constructor : function(index) {}
- });
- /**
- * Evaluator for matching by sibling index number (e = idx)
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexEquals = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexEvaluator, {
- matches : function(root, element) {
- return (element).getSiblingIndex() == this.index;
- }
- //constructor : function(index) {}
- });
- /**
- * Evaluator for matching the last sibling (css :last-child)
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsLastChild = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
- matches : function(root, element) {
- var p = element.rave_getParentNode();
- return element != root && p && ((element).getSiblingIndex() == p.rave_getChildNodes().length - 1);
- }
- });
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.CssNthEvaluator = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
- a : 0, b : 0,
- constructor : function(a, b) {
- this.a = a;
- this.b = b;
- },
- matches : function(root, element) {
- var p = element.rave_getParentNode();
- if (!p) {
- return false;
- }
- var pos = this.calculatePosition(root, element);
- if (this.a == 0) {
- return pos == this.b;
- }
- return (pos - this.b) * this.a >= 0 && (pos - this.b) % this.a == 0;
- }
- //calculatePosition : function(root, element) {}
- });
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthLastOfType = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.CssNthEvaluator, {
- calculatePosition : function(root, element) {
- var pos = 0;
- var family = element.rave_getParentNode().rave_getChildNodes();
- for (var i = (element).getSiblingIndex(); i < family.length; ++i) {
- if (family[i].rave_getName() == element.rave_getName()) {
- pos++;
- }
- }
- return pos;
- }
- //constructor : function(a, b) {}
- });
- /**
- * css pseudo class nth-of-type
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthOfType = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.CssNthEvaluator, {
- calculatePosition : function(root, element) {
- var pos = 0;
- var family = element.rave_getParentNode().rave_getChildNodes();
- for (var i = 0; i < family.length; ++i) {
- if (family[i].rave_getName() == element.rave_getName()) {
- pos++;
- }
- if (family[i] == element) {
- break;
- }
- }
- return pos;
- }
- //constructor : function(a, b) {}
- });
- /**
- * css-compatible Evaluator for :eq (css :nth-child)
- * @see (com.ibm.rave.render.internal.select.jsoup.select.Evaluator.IndexEquals) IndexEquals
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthChild = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.CssNthEvaluator, {
- calculatePosition : function(root, element) {
- return (element).getSiblingIndex() + 1;
- }
- //constructor : function(a, b) {}
- });
- /**
- * css pseudo class :nth-last-child)
- * @see (com.ibm.rave.render.internal.select.jsoup.select.Evaluator.IndexEquals) IndexEquals
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthLastChild = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.CssNthEvaluator, {
- calculatePosition : function(root, element) {
- return element.rave_getParentNode().rave_getChildNodes().length - (element).getSiblingIndex();
- }
- //constructor : function(a, b) {}
- });
- /**
- * Evaluator for matching the first sibling (css :first-child)
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsFirstChild = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
- matches : function(root, element) {
- var p = element.rave_getParentNode();
- return p && (element).getSiblingIndex() == 0;
- }
- });
- /**
- * css3 pseudo-class :root
- * @see <a href="http://www.w3.org/TR/selectors/#root-pseudo">:root selector</a>
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsRoot = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
- matches : function(root, element) {
- return !element.rave_getParentNode();
- }
- });
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsOnlyChild = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
- matches : function(root, element) {
- var p = element.rave_getParentNode();
- return p && !element.rave_getPreviousSibling() && !element.rave_getNextSibling();
- }
- });
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsOnlyOfType = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
- matches : function(root, element) {
- var p = element.rave_getParentNode();
- if (!p) {
- return false;
- }
- var pos = 0;
- var family = p.rave_getChildNodes();
- for (var i = 0; i < family.length; ++i) {
- if (family[i].rave_getName() == element.rave_getName()) {
- pos++;
- }
- }
- return pos == 1;
- }
- });
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsEmpty = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
- matches : function(root, element) {
- return !(element.rave_hasChildNodes());
- }
- });
- /**
- * Evaluator for matching SceneNode (and its descendants) text
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.ContainsText = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
- //searchText : null,
- constructor : function(searchText) {
- this.searchText = searchText.toLowerCase();
- },
- matches : function(root, element) {
- if (root == element) {
- return false;
- }
- if (0 <= element.rave_getText().toLowerCase().indexOf(this.searchText)) {
- return true;
- }
- for (var __i_enFor0 = 0, __exp_enFor0 = element.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- if (this.matches(element, child)) {
- return true;
- }
- }
- return false;
- }
- });
- /**
- * Evaluator for matching SceneNode's own text
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.ContainsOwnText = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
- //searchText : null,
- constructor : function(searchText) {
- this.searchText = searchText.toLowerCase();
- },
- matches : function(root, element) {
- return (0 <= element.rave_getText().toLowerCase().indexOf(this.searchText));
- }
- });
- /**
- * Evaluator for matching SceneNode (and its descendants) text with regex
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Matches = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
- //pattern : null,
- constructor : function(pattern) {
- this.pattern = pattern;
- },
- matches : function(root, element) {
- if (this.pattern.test(element.rave_getText())) {
- return true;
- }
- for (var __i_enFor0 = 0, __exp_enFor0 = element.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- if (this.matches(element, child)) {
- return true;
- }
- }
- return false;
- }
- });
- /**
- * Evaluator for matching SceneNode's own text with regex
- */
- com_ibm_rave_render_internal_select_jsoup_select_Evaluator.MatchesOwn = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
- //pattern : null,
- constructor : function(pattern) {
- this.pattern = pattern;
- },
- matches : function(root, element) {
- return this.pattern.test(element.rave_getText());
- }
- });
- // $source: com/ibm/rave/render/internal/select/jsoup/select/StructuralEvaluator
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/select/jsoup/select/Evaluator (loadtime) // new, superclass
- //@import com/ibm/rave/render/internal/select/jsoup/select/Collector (runtime) // collect
- /**
- * Base structural evaluator.
- */
- var com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
- //evaluator : null
- });
- com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Root = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
- matches : function(root, element) {
- return root == element;
- }
- });
- com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Has = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator, {
- constructor : function(evaluator) {
- this.evaluator = evaluator;
- },
- matches : function(root, element) {
- for (var __i_enFor0 = 0, __exp_enFor0 = com_ibm_rave_render_internal_select_jsoup_select_Collector.collect(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AllElements(), element, null), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var e = __exp_enFor0[__i_enFor0];
- if (e != element && this.evaluator.matches(root, e)) {
- return true;
- }
- }
- return false;
- }
- });
- com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Not = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator, {
- constructor : function(evaluator) {
- this.evaluator = evaluator;
- },
- matches : function(root, node) {
- return !(this.evaluator.matches(root, node));
- }
- });
- com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Parent = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator, {
- constructor : function(evaluator) {
- this.evaluator = evaluator;
- },
- matches : function(root, element) {
- if (root == element) {
- return false;
- }
- var parent = element.rave_getParentNode();
- while (parent) {
- if (this.evaluator.matches(root, parent)) {
- return true;
- }
- parent = parent.rave_getParentNode();
- }
- return false;
- }
- });
- com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.ImmediateParent = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator, {
- constructor : function(evaluator) {
- this.evaluator = evaluator;
- },
- matches : function(root, element) {
- if (root == element) {
- return false;
- }
- var parent = element.rave_getParentNode();
- return parent && this.evaluator.matches(root, parent);
- }
- });
- com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.PreviousSibling = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator, {
- constructor : function(evaluator) {
- this.evaluator = evaluator;
- },
- matches : function(root, element) {
- if (root == element) {
- return false;
- }
- var prev = element.rave_getPreviousSibling();
- while (prev) {
- if (this.evaluator.matches(root, prev)) {
- return true;
- }
- prev = prev.rave_getPreviousSibling();
- }
- return false;
- }
- });
- com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.ImmediatePreviousSibling = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator, {
- constructor : function(evaluator) {
- this.evaluator = evaluator;
- },
- matches : function(root, element) {
- if (root == element) {
- return false;
- }
- var prev = element.rave_getPreviousSibling();
- return prev && this.evaluator.matches(root, prev);
- }
- });
- // $source: com/ibm/rave/render/internal/select/jsoup/select/NodeTraversor
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * Depth-first node traversor. Use to iterate through all nodes under and including the specified root node.
- */
- var com_ibm_rave_render_internal_select_jsoup_select_NodeTraversor = com_ibm_rave_core_nativeImpl_Declare({
- //visitor : null,
- /**
- * Create a new traversor.
- * @param (com.ibm.rave.render.internal.select.jsoup.select.NodeVisitor) visitor a class implementing the {@link (com.ibm.rave.render.internal.select.jsoup.select.NodeVisitor) NodeVisitor} interface, to be called when visiting each node.
- */
- constructor : function(visitor) {
- this.visitor = visitor;
- },
- /**
- * Start a depth-first traverse of the root and all of its descendants.
- * @param (com.ibm.rave.core.scene.SceneNode) root the root node point to traverse.
- */
- traverse : function(root) {
- if (!root) {
- return;
- }
- var node = root;
- var depth = 0;
- this.visit(node, depth);
- },
- visit : function(node, depth) {
- if (!node) {
- return;
- }
- this.visitor.head(node, depth);
- for (var __i_enFor0 = 0, __exp_enFor0 = node.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- this.visit(child, depth + 1);
- }
- this.visitor.tail(node, depth);
- }
- });
- // $source: com/ibm/rave/render/internal/select/jsoup/select/Collector
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/select/jsoup/select/NodeTraversor (static) // new
- /**
- * Collects a list of elements that match the supplied criteria.
- * @author Jonathan Hedley
- */
- var com_ibm_rave_render_internal_select_jsoup_select_Collector = com_ibm_rave_core_nativeImpl_Declare({
- //constructor : function() {}
- });
- /**
- * Build a list of elements, by visiting root and every descendant of root, and testing it against the evaluator.
- * @param (com.ibm.rave.render.internal.select.jsoup.select.Evaluator) evaluator Evaluator to test elements against
- * @param (com.ibm.rave.core.scene.SceneNode) root root of tree to descend
- * @param (com.ibm.rave.render.internal.nodes.cache.SceneNodeCacheManager) cache
- * @return (Array) list of matches; empty if none
- */
- com_ibm_rave_render_internal_select_jsoup_select_Collector.collect = function(evaluator, root, cache) {
- var elements = [];
- if (evaluator) {
- var cachedVals = evaluator.cached(cache, root);
- if (cachedVals) {
- for (var __i_enFor0 = 0, __exp_enFor0 = cachedVals, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var node = __exp_enFor0[__i_enFor0];
- elements.push(node);
- }
- } else {
- new com_ibm_rave_render_internal_select_jsoup_select_NodeTraversor(new com_ibm_rave_render_internal_select_jsoup_select_Collector.Accumulator(root, elements, evaluator)).traverse(root);
- }
- }
- return elements;
- };
- com_ibm_rave_render_internal_select_jsoup_select_Collector.Accumulator = com_ibm_rave_core_nativeImpl_Declare({
- //root : null,
- //elements : null,
- //evaluator : null,
- constructor : function(root, elements, evaluator) {
- this.root = root;
- this.elements = elements;
- this.evaluator = evaluator;
- },
- head : function(node, depth) {
- if (this.evaluator && this.evaluator.matches(this.root, node)) {
- this.elements.push(node);
- }
- },
- tail : function(node, depth) {}
- });
- // $source: com/ibm/rave/render/internal/select/jsoup/select/CombiningEvaluator
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/select/jsoup/select/Evaluator (loadtime) // superclass
- /**
- * Base combining (and, or) evaluator.
- */
- var com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
- //evaluators : null,
- num : 0,
- constructor : function(evaluators) {
- this.evaluators = [];
- {
- if (evaluators) {
- for (var __i_enFor0 = 0, __exp_enFor0 = evaluators, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var evaluator = __exp_enFor0[__i_enFor0];
- this.evaluators.push(evaluator);
- }
- }
- this.updateNumEvaluators();
- }
- },
- rightMostEvaluator : function() {
- return this.num > 0 ? this.evaluators[this.num - 1] : null;
- },
- replaceRightMostEvaluator : function(replacement) {
- this.evaluators[this.num - 1] = replacement;
- },
- updateNumEvaluators : function() {
- this.num = this.evaluators.length;
- }
- });
- com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator, {
- matches : function(root, node) {
- for (var i = 0; i < this.num; ++i) {
- var s = this.evaluators[i];
- if (!(s.matches(root, node))) {
- return false;
- }
- }
- return true;
- }
- //constructor : function(evaluators) {}
- });
- com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.Or = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator, {
- /**
- * Create a new Or evaluator. The initial evaluators are ANDed together and used as the first clause of the OR.
- * @param (Array) evaluators initial OR clause (these are wrapped into an AND evaluator).
- */
- constructor : function(evaluators) {
- if (this.num > 1) {
- this.evaluators.push(new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And(evaluators));
- } else if (evaluators) {
- for (var __i_enFor0 = 0, __exp_enFor0 = evaluators, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var evaluator = __exp_enFor0[__i_enFor0];
- this.evaluators.push(evaluator);
- }
- }
- this.updateNumEvaluators();
- },
- add : function(e) {
- this.evaluators.push(e);
- this.updateNumEvaluators();
- },
- matches : function(root, node) {
- for (var i = 0; i < this.num; ++i) {
- var s = this.evaluators[i];
- if (s.matches(root, node)) {
- return true;
- }
- }
- return false;
- }
- });
- // $source: com/ibm/rave/render/internal/select/jsoup/parser/TokenQueue
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/select/jsoup/helper/StringUtil (runtime) // regionMatches, isWhitespace, startsWith
- //@import com/ibm/rave/core/context/RaveContextManager (static) // RaveContextManager
- /**
- * A character queue with parsing helpers.
- * @author Jonathan Hedley
- */
- var com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue = com_ibm_rave_core_nativeImpl_Declare({
- //queue : null,
- pos : 0,
- /**
- * Create a new TokenQueue.
- * @param (String) data string of data to back queue.
- */
- constructor : function(data) {
- this.queue = data;
- },
- /**
- * Is the queue empty?
- * @return (boolean) true if no data left in queue.
- */
- isEmpty : function() {
- return this.remainingLength() == 0;
- },
- remainingLength : function() {
- return this.queue.length - this.pos;
- },
- /**
- * Tests if the next characters on the queue match the sequence. Case insensitive.
- * @param (String) seq String to check queue for.
- * @return (boolean) true if the next characters match.
- */
- matches : function(seq) {
- return com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.regionMatches(this.queue, true, this.pos, seq, 0, seq.length);
- },
- /**
- * Case sensitive match test.
- * @param (String) seq string to case sensitively check for
- * @return (boolean) true if matched, false if not
- */
- matchesCS : function(seq) {
- return com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.startsWith(this.queue, seq, this.pos);
- },
- /**
- * Tests if the next characters match any of the sequences. Case insensitive.
- * @param (java.lang.String[]) seq list of strings to case insensitively check for
- * @return (boolean) true of any matched, false if none did
- */
- matchesAny : function(seq) {
- if (seq !== null || arguments.length > 1){
- seq = Array.prototype.slice.call(arguments);
- }
- {
- for (var __i_enFor0 = 0, __len_enFor0 = seq.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var s = seq[__i_enFor0];
- if (this.matches(s)) {
- return true;
- }
- }
- return false;
- }
- },
- matchesAnyChar : function(cs) {
- if (cs !== null || arguments.length > 1){
- cs = Array.prototype.slice.call(arguments);
- }
- {
- var c = this.queue.charCodeAt(this.pos);
- for (var i = 0; i < cs.length; ++i) {
- if (cs[i] == c) {
- return true;
- }
- }
- return false;
- }
- },
- matchesChar : function(cs) {
- return this.queue.charCodeAt(this.pos) == cs;
- },
- /**
- * Tests if the queue matches the sequence (as with match), and if they do, removes the matched string from the queue.
- * @param (String) seq String to search for, and if found, remove from queue.
- * @return (boolean) true if found and removed, false if not found.
- */
- matchChomp : function(seq) {
- if (this.matches(seq)) {
- this.pos += seq.length;
- return true;
- }
- return false;
- },
- matchCharChomp : function(c) {
- if (this.matchesChar(c)) {
- this.pos++;
- return true;
- }
- return false;
- },
- /**
- * Tests if queue starts with a whitespace character.
- * @return (boolean) if starts with whitespace
- */
- matchesWhitespace : function() {
- return !(this.isEmpty()) && com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.isWhitespace(this.queue.charCodeAt(this.pos));
- },
- /**
- * Test if the queue matches a word character (letter or digit).
- * @return (boolean) if matches a word character
- */
- matchesWord : function() {
- var c = this.queue.charCodeAt(this.pos);
- return (c >= 97 && c <= 122) || (c >= 65 && c <= 90) || (c >= 48 && c <= 57);
- },
- /**
- * Consume one character off queue.
- * @return (char) first character on queue.
- */
- consume$0 : function() {
- return this.queue.charCodeAt(this.pos++);
- },
- /**
- * Consumes the supplied sequence of the queue. If the queue does not start with the supplied sequence, will throw an illegal state exception -- but you should be running match() against that condition. <p> Case insensitive.
- * @param (String) seq sequence to remove from head of queue.
- */
- consume$1 : function(seq) {
- var len = seq.length;
- this.pos += len;
- },
- /**
- * Pulls a string off the queue, up to but exclusive of the match sequence, or to the queue running out.
- * @param (String) seq String to end on (and not include in return, but leave on queue). <b>Case sensitive.</b>
- * @return (String) The matched data consumed from queue.
- */
- consumeTo : function(seq) {
- var offset = this.queue.indexOf(seq, this.pos);
- if (offset != -1) {
- var consumed = this.queue.substring(this.pos, offset);
- this.pos += consumed.length;
- return consumed;
- }
- return this.remainder();
- },
- /**
- * Consumes to the first sequence provided, or to the end of the queue. Leaves the terminator on the queue.
- * @param (java.lang.String[]) seq any number of terminators to consume to. <b>Case insensitive.</b>
- * @return (String) consumed string
- */
- consumeToAny : function(seq) {
- if (seq !== null || arguments.length > 1){
- seq = Array.prototype.slice.call(arguments);
- }
- {
- var start = this.pos;
- while (!(this.isEmpty()) && !(this.matchesAny.apply(this, seq))) {
- this.pos++;
- }
- var data = this.queue.substring(start, this.pos);
- return data;
- }
- },
- /**
- * Pulls a string off the queue (like consumeTo), and then pulls off the matched string (but does not return it). <p> If the queue runs out of characters before finding the seq, will return as much as it can (and queue will go isEmpty() == true).
- * @param (String) seq String to match up to, and not include in return, and to pull off queue. <b>Case sensitive.</b>
- * @return (String) Data matched from queue.
- */
- chompTo : function(seq) {
- var data = this.consumeTo(seq);
- this.matchChomp(seq);
- return data;
- },
- /**
- * Pulls a balanced string off the queue. E.g. if queue is "(one (two) three) four", (,) will return "one (two) three", and leave " four" on the queue. Unbalanced openers and closers can be escaped (with \). Those escapes will be left in the returned string, which is suitable for regexes (where we need to preserve the escape), but unsuitable for contains text strings; use unescape for that.
- * @param (char) open opener
- * @param (char) close closer
- * @return (String) data matched from the queue
- */
- chompBalanced : function(open, close) {
- var start = -1;
- var end = -1;
- var depth = 0;
- var last = 0;
- do {
- if (this.isEmpty()) {
- break;
- }
- var c = this.consume$0();
- if (last == 0 || last != 92) {
- if (c == open) {
- depth++;
- if (start == -1) {
- start = this.pos;
- }
- } else if (c == close) {
- depth--;
- }
- }
- if (depth > 0 && last != 0) {
- end = this.pos;
- }
- last = c;
- } while (depth > 0);
- return (end >= 0) ? this.queue.substring(start, end) : "";
- },
- /**
- * Pulls the next run of whitespace characters of the queue.
- */
- consumeWhitespace : function() {
- var seen = false;
- while (this.matchesWhitespace()) {
- this.pos++;
- seen = true;
- }
- return seen;
- },
- /**
- * Retrieves the next run of word type (letter or digit) off the queue.
- * @return (String) String of word characters from queue, or empty string if none.
- */
- consumeWord : function() {
- var start = this.pos;
- while (this.matchesWord()) {
- this.pos++;
- }
- return this.queue.substring(start, this.pos);
- },
- /**
- * Consume an tag name off the queue (word or :, _, -)
- * @return (String) tag name
- */
- consumeTagName : function() {
- var start = this.pos;
- while (!(this.isEmpty()) && (this.matchesWord() || this.matchesAnyChar(58, 95, 45))) {
- this.pos++;
- }
- return this.queue.substring(start, this.pos);
- },
- /**
- * Consume a CSS element selector (tag name, but | instead of : for namespaces, to not conflict with :pseudo selects).
- * @return (String) tag name
- */
- consumeElementSelector : function() {
- var start = this.pos;
- while (!(this.isEmpty()) && (this.matchesWord() || this.matchesAnyChar(124, 95, 45))) {
- this.pos++;
- }
- return this.queue.substring(start, this.pos);
- },
- /**
- * Consume a CSS identifier (ID or class) off the queue (letter, digit, -, _) http://www.w3.org/TR/CSS2/syndata.html#value-def-identifier
- * @return (String) identifier
- */
- consumeCssIdentifier : function() {
- var start = this.pos;
- while (!(this.isEmpty()) && (this.matchesWord() || this.matchesAnyChar(45, 95))) {
- this.pos++;
- }
- return this.queue.substring(start, this.pos);
- },
- /**
- * Consume an attribute key off the queue (letter, digit, -, _, :")
- * @return (String) attribute key
- */
- consumeAttributeKey : function() {
- var start = this.pos;
- while (!(this.isEmpty()) && (this.matchesWord() || this.matchesAnyChar(45, 95, 58))) {
- this.pos++;
- }
- return this.queue.substring(start, this.pos);
- },
- /**
- * Consume and return whatever is left on the queue.
- * @return (String) remained of queue.
- */
- remainder : function() {
- var remainder = this.queue.substring(this.pos, this.queue.length);
- this.pos = this.queue.length;
- return remainder;
- },
- consume : function(a0) {
- var args = arguments;
- if (args.length == 0) {
- return this.consume$0();
- }
- return this.consume$1(a0);
- }
- });
- com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.getTokenQueueRegExp = function() {
- var regexp = com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData("TOKEN_QUEUE_REG_EXP_KEY");
- if (!regexp) {
- regexp = new RegExp("[A-Z\\d]", "i");
- com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().putData("TOKEN_QUEUE_REG_EXP_KEY", regexp);
- }
- return regexp;
- };
- /**
- * Unescaped a \ escaped string.
- * @param (String) text backslash escaped string
- * @return (String) unescaped string
- */
- com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.unescape = function(text) {
- var out = "";
- var last = 0;
- for (var i = 0; i < text.length; ++i) {
- var c = text.charCodeAt(i);
- if (c == 92) {
- if (last != 0 && last == 92) {
- out += String.fromCharCode(c);
- }
- } else {
- out += String.fromCharCode(c);
- }
- last = c;
- }
- return out.valueOf();
- };
- com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.ESC = 92;
- com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.NIL = 0;
- //com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.TOKEN_QUEUE_REG_EXP_KEY = "TOKEN_QUEUE_REG_EXP_KEY";
- // $source: com/ibm/rave/render/internal/select/jsoup/helper/StringUtil
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * A minimal String utility class. Designed for internal jsoup use only.
- */
- var com_ibm_rave_render_internal_select_jsoup_helper_StringUtil = com_ibm_rave_core_nativeImpl_Declare({
- });
- /**
- * Tests if a code point is "whitespace" as defined in the HTML spec.
- * @param (int) c code point to test
- * @return (boolean) true if code point is whitespace, false otherwise
- */
- com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.isWhitespace = function(c) {
- return c == 32 || c == 9 || c == 10 || c == 12 || c == 13;
- };
- /**
- * Translatable version of Java String#regionMaches().
- * @param (String) original String to
- * @param (boolean) ignoreCase ignore case or not
- * @param (int) toffset starting offset of the original string
- * @param (String) other the string to compare
- * @param (int) ooffset starting offset of the subregion in the string
- * @param (int) len number of chars to compare
- * @return (boolean) true if regions match.
- */
- com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.regionMatches = function(original, ignoreCase, toffset, other, ooffset, len) {
- if (original.length < toffset + len || original.length < ooffset + len) {
- return false;
- }
- var substring1 = original.substring(toffset, toffset + len);
- var substring2 = other.substring(ooffset, ooffset + len);
- if (ignoreCase) {
- return substring1.toLowerCase() == substring2.toLowerCase();
- }
- return substring1 == substring2;
- };
- /**
- * @param (String) queue
- * @param (String) seq
- * @param (int) pos
- * @return (boolean) <code>true</code> if starts with, <code>false</code> otherwise.
- */
- com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.startsWith = function(queue, seq, pos) {
- return com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.regionMatches(queue, false, 0, seq, 0, pos);
- };
- com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.padding = ["", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "];
- // $source: com/ibm/rave/render/internal/RendererConfiguration
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * Configuration specific to native renderers and scene nodes.
- */
- var com_ibm_rave_render_internal_RendererConfiguration = com_ibm_rave_core_nativeImpl_Declare({
- //roots : null,
- constructor : function() {
- this.roots = [];
- },
- /**
- * Return all registered root providers.
- * @return (Array) A list of all registered root providers.
- */
- getRootProviders : function() {
- return this.roots;
- },
- /**
- * Return the root provider that contains a specific node.
- * @param (com.ibm.rave.core.scene.SceneNode) node Return the provider that contains this node.
- * @return (com.ibm.rave.render.internal.nodes.RootProvider) Matching root provider, or null if none found.
- */
- getRootProviderForNode : function(node) {
- for (var __i_enFor0 = 0, __exp_enFor0 = this.roots, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var root = __exp_enFor0[__i_enFor0];
- if (node.rave_getOwner() == root.getRoot().rave_getOwner()) {
- return root;
- }
- }
- return null;
- },
- /**
- * Add a root provider to the list of providers system-wide. Root providers are containers for a single root node that holds a scene tree.
- * @param (com.ibm.rave.render.internal.nodes.RootProvider) rootProvider Root provider to add to the system.
- */
- addRootProvider : function(rootProvider) {
- this.roots.push(rootProvider);
- },
- /**
- * Remove a root provider from the list of providers system-wide. Root providers are containers for a single root node that holds a scene tree.
- * @param (com.ibm.rave.render.internal.nodes.RootProvider) rootProvider Root provider to remove from the system.
- */
- removeRootProvider : function(rootProvider) {
- var i = this.roots.indexOf(rootProvider);
- if (i >= 0) {
- this.roots.splice(i, 1);
- }
- },
- /**
- * Remove the root provider that contains a specific node.
- * @param (com.ibm.rave.core.scene.SceneNode) node Find the root provider that contains this node and remove it from the list of root providers.
- */
- removeRootProviderForNode : function(node) {
- var i = -1;
- var found = false;
- for (var __i_enFor0 = 0, __exp_enFor0 = this.roots, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var root = __exp_enFor0[__i_enFor0];
- i++;
- if (node == root.getRoot().rave_getOwner()) {
- found = true;
- break;
- }
- }
- if (found) {
- this.roots.splice(i, 1);
- }
- }
- //constructor : function() {}
- });
- /**
- * Singleton instance of this renderer configuration.
- */
- com_ibm_rave_render_internal_RendererConfiguration.INSTANCE = new com_ibm_rave_render_internal_RendererConfiguration();
- // $source: com/ibm/rave/render/internal/select/jsoup/select/JsoupSelector
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/select/jsoup/select/QueryParser (runtime) // parse
- //@import com/ibm/rave/render/internal/select/jsoup/select/Collector (runtime) // collect
- /**
- * CSS-like element selector, that finds elements matching a query. <p/> <h2>Selector syntax</h2> A selector is a chain of simple selectors, separated by combinators. Selectors are case insensitive (including against elements, attributes, and attribute values). <p/> The universal selector (*) is implicit when no element selector is supplied (i.e. {@code *.header} and {@code .header} is equivalent). <p/> <table> <tr> <th align="left">Pattern</th> <th align="left">Matches</th> <th align="left">Example</th> </tr> <tr> <td><code>*</code></td> <td>any element</td> <td><code>*</code></td> </tr> <tr> <td><code>tag</code></td> <td>elements with the given tag name</td> <td><code>div</code></td> </tr> <tr> <td><code>ns|E</code></td> <td>elements of type E in the namespace <i>ns</i></td> <td><code>fb|name</code> finds <code><fb:name></code> elements</td> </tr> <tr> <td><code>#id</code></td> <td>elements with attribute ID of "id"</td> <td><code>div#wrap</code>, <code>#logo</code></td> </tr> <tr> <td><code>.class</code></td> <td>elements with a class name of "class"</td> <td><code>div.left</code>, <code>.result</code></td> </tr> <tr> <td><code>[attr]</code></td> <td>elements with an attribute named "attr" (with any value)</td> <td><code>a[href]</code>, <code>[title]</code></td> </tr> <tr> <td><code>[^attrPrefix]</code></td> <td>elements with an attribute name starting with "attrPrefix". Use to find elements with HTML5 datasets</td> <td><code>[^data-]</code>, <code>div[^data-]</code></td> </tr> <tr> <td><code>[attr=val]</code></td> <td>elements with an attribute named "attr", and value equal to "val"</td> <td><code>img[width=500]</code>, <code>a[rel=nofollow]</code></td> </tr> <tr> <td><code>[attr="val"]</code></td> <td>elements with an attribute named "attr", and value equal to "val"</td> <td><code>span[hello="Cleveland"][goodbye="Columbus"]</code>, <code>a[rel="nofollow"]</code></td> </tr> <tr> <td><code>[attr^=valPrefix]</code></td> <td>elements with an attribute named "attr", and value starting with "valPrefix"</td> <td><code>a[href^=http:]</code></code></td> </tr> <tr> <td><code>[attr$=valSuffix]</code></td> <td>elements with an attribute named "attr", and value ending with "valSuffix"</td> <td><code>img[src$=.png]</code></td> </tr> <tr> <td><code>[attr*=valContaining]</code></td> <td>elements with an attribute named "attr", and value containing "valContaining"</td> <td><code>a[href*=/search/]</code></td> </tr> <tr> <td><code>[attr~=<em>regex</em>]</code></td> <td>elements with an attribute named "attr", and value matching the regular expression</td> <td><code>img[src~=(?i)\\.(png|jpe?g)]</code></td> </tr> <tr> <td></td> <td>The above may be combined in any order</td> <td><code>div.header[title]</code></td> </tr> <tr> <td> <td colspan="3"> <h3>Combinators</h3></td> </tr> <tr> <td><code>E F</code></td> <td>an F element descended from an E element</td> <td><code>div a</code>, <code>.logo h1</code></td> </tr> <tr> <td><code>E > F</code></td> <td>an F direct child of E</td> <td><code>ol > li</code></td> </tr> <tr> <td><code>E + F</code></td> <td>an F element immediately preceded by sibling E</td> <td><code>li + li</code>, <code>div.head + div</code></td> </tr> <tr> <td><code>E ~ F</code></td> <td>an F element preceded by sibling E</td> <td><code>h1 ~ p</code></td> </tr> <tr> <td><code>E, F, G</code></td> <td>all matching elements E, F, or G</td> <td><code>a[href], div, h3</code></td> </tr> <tr> <td> <td colspan="3"> <h3>Pseudo selectors</h3></td> </tr> <tr> <td><code>:lt(<em>n</em>)</code></td> <td>elements whose sibling index is less than <em>n</em></td> <td><code>td:lt(3)</code> finds the first 2 cells of each row</td> </tr> <tr> <td><code>:gt(<em>n</em>)</code></td> <td>elements whose sibling index is greater than <em>n</em></td> <td><code>td:gt(1)</code> finds cells after skipping the first two</td> </tr> <tr> <td><code>:eq(<em>n</em>)</code></td> <td>elements whose sibling index is equal to <em>n</em></td> <td><code>td:eq(0)</code> finds the first cell of each row</td> </tr> <tr> <td><code>:has(<em>selector</em>)</code></td> <td>elements that contains at least one element matching the <em>selector</em></td> <td><code>div:has(p)</code> finds divs that contain p elements</td> </tr> <tr> <td><code>:not(<em>selector</em>)</code></td> <td>elements that do not match the <em>selector</em>. See also Elements#not(String)</td> <td><code>div:not(.logo)</code> finds all divs that do not have the "logo" class.<br /> <code>div:not(:has(div))</code> finds divs that do not contain divs.</code></td> </tr> <tr> <td><code>:contains(<em>text</em>)</code></td> <td>elements that contains the specified text. The search is case insensitive. The text may appear in the found element, or any of its descendants.</td> <td><code>p:contains(jsoup)</code> finds p elements containing the text "jsoup".</td> </tr> <tr> <td><code>:matches(<em>regex</em>)</code></td> <td>elements whose text matches the specified regular expression. The text may appear in the found element, or any of its descendants.</td> <td><code>td:matches(\\d+)</code> finds table cells containing digits. <code>div:matches((?i)login)</code> finds divs containing the text, case insensitively.</td> </tr> <tr> <td><code>:containsOwn(<em>text</em>)</code></td> <td>elements that directly contain the specified text. The search is case insensitive. The text must appear in the found element, not any of its descendants.</td> <td><code>p:containsOwn(jsoup)</code> finds p elements with own text "jsoup". </td> </tr> <tr> <td><code>:matchesOwn(<em>regex</em>)</code></td> <td>elements whose own text matches the specified regular expression. The text must appear in the found element, not any of its descendants.</td> <td><code>td:matchesOwn(\\d+)</code> finds table cells directly containing digits. <code>div:matchesOwn((?i)login)</code> finds divs containing the text, case insensitively.</td> </tr> <tr> <td></td> <td>The above may be combined in any order and with other selectors</td> <td><code>.light:contains(name):eq(0)</code></td> </tr> <tr> <td colspan="3"> <h3>Structural pseudo selectors</h3></td> </tr> <tr> <td><code>:root</code></td> <td>The element that is the root of the document. In HTML, this is the <code>html</code> element</td> <td><code>:root</code></td> </tr> <tr> <td><code>:nth-child(<em>a</em>n+<em>b</em>)</code></td> <td> <p> elements that have <code><em>a</em>n+<em>b</em>-1</code> siblings <b>before</b> it in the document tree, for any positive integer or zero value of <code>n</code>, and has a parent element. For values of <code>a</code> and <code>b</code> greater than zero, this effectively divides the element's children into groups of a elements (the last group taking the remainder), and selecting the <em>b</em>th element of each group. For example, this allows the selectors to address every other row in a table, and could be used to alternate the color of paragraph text in a cycle of four. The <code>a</code> and <code>b</code> values must be integers (positive, negative, or zero). The index of the first child of an element is 1. </p> In addition to this, <code>:nth-child()</code> can take <code>odd</code> and <code>even</code> as arguments instead. <code>odd</code> has the same signification as <code>2n+1</code>, and <code>even</code> has the same signification as <code>2n</code>.</td> <td><code>tr:nth-child(2n+1)</code> finds every odd row of a table. <code>:nth-child(10n-1)</code> the 9th, 19th, 29th, etc, element. <code>li:nth-child(5)</code> the 5h li</td> </tr> <tr> <td><code>:nth-last-child(<em>a</em>n+<em>b</em>)</code></td> <td>elements that have <code><em>a</em>n+<em>b</em>-1</code> siblings <b>after</b> it in the document tree. Otherwise like <code>:nth-child()</code></td> <td><code>tr:nth-last-child(-n+2)</code> the last two rows of a table</td> </tr> <tr> <td><code>:nth-of-type(<em>a</em>n+<em>b</em>)</code></td> <td>pseudo-class notation represents an element that has <code><em>a</em>n+<em>b</em>-1</code> siblings with the same expanded element name <em>before</em> it in the document tree, for any zero or positive integer value of n, and has a parent element</td> <td><code>img:nth-of-type(2n+1)</code></td> </tr> <tr> <td><code>:nth-last-of-type(<em>a</em>n+<em>b</em>)</code></td> <td>pseudo-class notation represents an element that has <code><em>a</em>n+<em>b</em>-1</code> siblings with the same expanded element name <em>after</em> it in the document tree, for any zero or positive integer value of n, and has a parent element</td> <td><code>img:nth-last-of-type(2n+1)</code></td> </tr> <tr> <td><code>:first-child</code></td> <td>elements that are the first child of some other element.</td> <td><code>div > p:first-child</code></td> </tr> <tr> <td><code>:last-child</code></td> <td>elements that are the last child of some other element.</td> <td><code>ol > li:last-child</code></td> </tr> <tr> <td><code>:first-of-type</code></td> <td>elements that are the first sibling of its type in the list of children of its parent element</td> <td><code>dl dt:first-of-type</code></td> </tr> <tr> <td><code>:last-of-type</code></td> <td>elements that are the last sibling of its type in the list of children of its parent element</td> <td><code>tr > td:last-of-type</code></td> </tr> <tr> <td><code>:only-child</code></td> <td>elements that have a parent element and whose parent element hasve no other element children</td> <td></td> </tr> <tr> <td><code>:only-of-type</code></td> <td>an element that has a parent element and whose parent element has no other element children with the same expanded element name</td> <td></td> </tr> <tr> <td><code>:empty</code></td> <td>elements that have no children at all</td> <td></td> </tr> </table>
- * @author Jonathan Hedley, jonathan@hedley.net
- * @see #this.select(String, com_ibm_rave_core_scene_SceneNode, com_ibm_rave_render_internal_nodes_cache_SceneNodeCacheManager)
- */
- var com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector = com_ibm_rave_core_nativeImpl_Declare({
- //evaluator : null,
- //root : null,
- //cache : null,
- constructor : function(query, root, cache) {
- var _query = query.trim();
- this.evaluator = com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(_query);
- this.root = root;
- this.cache = cache;
- },
- selectAll : function() {
- return com_ibm_rave_render_internal_select_jsoup_select_Collector.collect(this.evaluator, this.root, this.cache);
- }
- });
- /**
- * Find elements matching selector.
- * @param (String) query CSS selector
- * @param (com.ibm.rave.core.scene.SceneNode) root root element to descend into
- * @param (com.ibm.rave.render.internal.nodes.cache.SceneNodeCacheManager) cache Optional caching manager that contains caches for classes, ids, etc.
- * @return (Array) matching elements, empty if not
- */
- com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select = function(query, root, cache) {
- return new com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector(query, root, cache).selectAll();
- };
- // $source: com/ibm/rave/render/internal/query/SceneNodeSelectionQueryEngine
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/select/jsoup/select/QueryParser (runtime) // parse
- //@import com/ibm/rave/render/internal/RendererConfiguration (runtime) // RendererConfiguration
- //@import com/ibm/rave/render/internal/select/jsoup/select/JsoupSelector (static) // select
- /**
- * A CSS3 selection query engine for abstract scene tree/node type scene nodes.
- */
- var com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine = com_ibm_rave_core_nativeImpl_Declare({
- matches : function(context, selectorString) {
- if (selectorString != null) {
- var evaluator = com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(selectorString);
- if (evaluator) {
- return evaluator.matches(context.rave_getOwner(), context);
- }
- }
- return false;
- },
- querySelector$0 : function(match, rootNode) {
- if (match != null) {
- var results = this.querySelectorAll$1(match, rootNode);
- if (results.length > 0) {
- return results[0];
- }
- }
- return null;
- },
- querySelector$1 : function(match) {
- if (match != null) {
- var matches = this.querySelectorAll$0(match);
- if (matches && matches.length > 0) {
- return matches[0];
- }
- }
- return null;
- },
- querySelectorAll$0 : function(match) {
- return this.querySelectorAll$1(match, null);
- },
- querySelectorAll$1 : function(match, rootNode) {
- var results = [];
- if (match != null) {
- com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine.doQuerySelectorAll(results, match, rootNode, ":root" == match);
- }
- return results;
- },
- querySelector : function(a0, a1) {
- var args = arguments;
- if (args.length == 1) {
- return this.querySelector$1(a0);
- }
- return this.querySelector$0(a0, a1);
- },
- querySelectorAll : function(a0, a1) {
- var args = arguments;
- if (args.length == 1) {
- return this.querySelectorAll$0(a0);
- }
- return this.querySelectorAll$1(a0, a1);
- }
- });
- com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine.doQuerySelectorAll = function(results, match, rootNode, includeRootInResults) {
- var _rootNode = rootNode;
- if (_rootNode) {
- var rootProvider = com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.getRootProviderForNode(_rootNode);
- var cache = null;
- if (rootProvider) {
- cache = rootProvider.getCacheManager();
- if (_rootNode == rootProvider.getRoot().rave_getOwner()) {
- _rootNode = rootProvider.getRoot();
- }
- for (var __i_enFor0 = 0, __exp_enFor0 = com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select(match, _rootNode, cache), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var node = __exp_enFor0[__i_enFor0];
- if (!(includeRootInResults == false && node == _rootNode)) {
- results.push(node);
- }
- }
- }
- } else {
- var providers = com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.getRootProviders();
- for (var __i_enFor1 = 0, __exp_enFor1 = providers, __len_enFor1 = __exp_enFor1.length;
- __i_enFor1 < __len_enFor1; ++__i_enFor1) {
- var provider = __exp_enFor1[__i_enFor1];
- com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine.doQuerySelectorAll(results, match, provider.getRoot(), true);
- }
- }
- };
- // $source: com/ibm/rave/core/canvas/internal/nativeImpl/CanvasSelectionQueryEngine
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2016
- **
- ** 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.
- ************************************************************************/
- // @import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- // @import com/ibm/rave/render/internal/query/SceneNodeSelectionQueryEngine (loadtime)
- var com_ibm_rave_core_canvas_internal_nativeImpl_CanvasSelectionQueryEngine = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine, {
-
- constructor : function(delegateQueryEngine) {
- this._delegateQueryEngine = delegateQueryEngine;
- },
-
- matches : function(context, selectorString) {
- return this._delegateQueryEngine.querySelectorAll(selectorString, null).indexOf(context) >= 0;
- }
- });
- // $source: com/ibm/rave/core/canvas/internal/nativeImpl/CustomRendererSelectionQueryEngine
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2014, 2016
- **
- ** 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.
- ************************************************************************/
- // @import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- // @import com/ibm/rave/render/internal/RendererConfiguration (runtime) // RendererConfiguration
- // @import com/ibm/rave/render/internal/select/jsoup/select/JsoupSelector (runtime) // select
- // @import com/ibm/rave/core/internal/css/CSSParser (runtime)
- /*
- * This class provides query support at the DOM level and into the canvas scene tree allowing
- * query selectors to cross the boundary from DOM to non-DOM.
- *
- * Example:
- * "body .visualization .axis text"
- *
- * Lets assume that ".axis text" is within a canvas.
- *
- * Start by executing this query against the DOM. No matches.
- * Then for each root provider, execute the same query. No matches.
- *
- * Breakdown the query into parts: ['body', '.visualization', '.axis', 'text']
- *
- * Remove the last part and execute the query on the DOM, ".body .visualization .axis". No matches.
- * Remove the last part again and execute the query on the DOM, ".body .visualization". We have a match.
- *
- * Now that we have a match reconstruct a query from the removed parts: ".axis text"
- * Find all root providers which are descendants of the DOM query matches.
- *
- * For all root providers which are descendants, execute the query ".axis text". We have a match.
- * Add the matches to the result.
- *
- * Keep breaking down the original query and performing the above steps until the query is empty.
- *
- * All the while making sure not to add duplicates to the results.
- *
- */
- var com_ibm_rave_core_canvas_internal_nativeImpl_CustomRendererSelectionQueryEngine = (function() {
-
- return com_ibm_rave_core_nativeImpl_Declare({
- constructor : function(domQueryEngine) {
- this._domQueryEngine = domQueryEngine;
- },
-
- matches : function(context, query) {
- return this._domQueryEngine.matches(context, query) || this.querySelectorAll(query, null).indexOf(context) >= 0;
- },
-
- querySelector : function(query, rootNode) {
- if (query){
- var result = this._domQueryEngine.querySelector(query, rootNode);
- if (result) {
- return result;
- }
-
- // TODO optimize
- var result = this.querySelectorAll(query, rootNode);
- if (result && result.length) {
- return result[0];
- }
- }
- return null;
- },
-
- querySelectorAll : function(query, rootNode) {
- if (!query) {
- return [];
- }
-
- rootNode = rootNode || rave_document;
-
- var results = this._domQueryEngine.querySelectorAll(query, rootNode);
-
- if (!results.concat) {
- // since results from the DOM query engine is a NodeList,
- // convert it to an array such that we can use the Array#concat method
- results = Array.prototype.slice.call(results, 0)
- }
-
- var providers = com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.getRootProviders();
- for (var i = 0; i < providers.length; i++) {
- // Add jsoup selection to results
- var matches = com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select(query, providers[i].getRoot(), providers[i].getCacheManager());
- if (matches && matches.length) {
- results = results.concat(matches);
- }
- }
-
- // break up the original query into parts
- var queries = com_ibm_rave_core_internal_css_CSSParser.splitSelectorText(query);
- for (var i = 0; i < queries.length; i++) {
- var queryParts = com_ibm_rave_core_internal_css_CSSParser.deconstructSelectorText(queries[i]);
- if (queryParts.length > 1) {
-
- // this array holds all the query parts we pop
- var endParts = [];
-
- while (queryParts.length > 1) {
-
- // remove a query part and insert it at the start of the endParts
- endParts.unshift(queryParts.pop());
-
- // construct the inner query from the end parts
- var innerQuery = endParts.join(' ');
-
- // execute the broken down query on the DOM
- var partialFind = this._domQueryEngine.querySelectorAll(queryParts.join(' '), rootNode);
- if (partialFind && partialFind.length) {
-
- // if we have matches we need to identify root providers were are descendants of the matches
- for (var i = 0; i < providers.length; i++) {
- var provider = providers[i];
- for (var j = 0; j < partialFind.length; j++) {
-
- // check if the root node is a child of any partial find
- var nodeToCompare = partialFind[j],
- parent = provider.getRoot().rave_getOwner();
- do {
- if (parent == nodeToCompare) {
- break;
- }
- } while (parent = parent.parentNode);
-
- if (parent) {
- // we have a match
- // now perform the remainder of the query on the provider's root node
- var innerResults = com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select(innerQuery, provider.getRoot(), provider.getCacheManager())
- if (innerResults && innerResults.length) {
- for (var k = 0; k < innerResults.length; k++) {
- // don't add duplicates
- if (results.indexOf(innerResults[k]) == -1) {
- results.push(innerResults[k]);
- }
- }
- }
- break;
- }
- }
- }
- }
- }
- }
- }
-
- return results;
- }
- });
- })();
- // $source: com/ibm/rave/render/SceneItemFactory
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/RectSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/CircleSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/LineSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/TextSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/TextPathSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/GroupSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/PathSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/PolygonSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/PolylineSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/DefsSceneItem (runtime) // new
- //@import com/ibm/rave/core/internal/svg/SVGConstants (runtime) // SVGConstants
- //@import com/ibm/rave/render/internal/nodes/LinearGradientSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/RadialGradientSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/StopSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/ImageSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/EllipseSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/ClipPathSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/TSpanSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/GenericSceneNode (runtime) // new
- var com_ibm_rave_render_SceneItemFactory = rave_externs["SceneItemFactory"] = com_ibm_rave_core_nativeImpl_Declare({
- _$functionClassMethod : function() {
- var _$self = /**
- * Create items that can be appended to the root scene tree. Ultimately the renderer will draw these shapes.
- * @return (com.ibm.rave.core.scene.SceneNode) Returns a new scene node of the requested type. Returns null if this is an unsupported type.
- */
- function(nsuri, name, parentContext) {
- if ("rect" == name) {
- return new com_ibm_rave_render_internal_nodes_RectSceneItem(nsuri, parentContext);
- } else if ("circle" == name) {
- return new com_ibm_rave_render_internal_nodes_CircleSceneItem(nsuri, parentContext);
- } else if ("line" == name) {
- return new com_ibm_rave_render_internal_nodes_LineSceneItem(nsuri, parentContext);
- } else if ("text" == name) {
- return new com_ibm_rave_render_internal_nodes_TextSceneItem(nsuri, parentContext);
- } else if ("textPath" == name) {
- return new com_ibm_rave_render_internal_nodes_TextPathSceneItem(nsuri, parentContext);
- } else if ("g" == name) {
- return new com_ibm_rave_render_internal_nodes_GroupSceneItem(nsuri, parentContext);
- } else if ("path" == name) {
- return new com_ibm_rave_render_internal_nodes_PathSceneItem(nsuri, parentContext);
- } else if ("polygon" == name) {
- return new com_ibm_rave_render_internal_nodes_PolygonSceneItem(nsuri, parentContext);
- } else if ("polyline" == name) {
- return new com_ibm_rave_render_internal_nodes_PolylineSceneItem(nsuri, parentContext);
- } else if ("defs" == name) {
- return new com_ibm_rave_render_internal_nodes_DefsSceneItem(nsuri, parentContext);
- } else if (com_ibm_rave_core_internal_svg_SVGConstants.LINEARGRADIENT == name) {
- return new com_ibm_rave_render_internal_nodes_LinearGradientSceneItem(nsuri, parentContext);
- } else if (com_ibm_rave_core_internal_svg_SVGConstants.RADIALGRADIENT == name) {
- return new com_ibm_rave_render_internal_nodes_RadialGradientSceneItem(nsuri, parentContext);
- } else if ("stop" == name) {
- return new com_ibm_rave_render_internal_nodes_StopSceneItem(nsuri, parentContext);
- } else if ("image" == name) {
- return new com_ibm_rave_render_internal_nodes_ImageSceneItem(nsuri, parentContext);
- } else if ("ellipse" == name) {
- return new com_ibm_rave_render_internal_nodes_EllipseSceneItem(nsuri, parentContext);
- } else if ("clipPath" == name) {
- return new com_ibm_rave_render_internal_nodes_ClipPathSceneItem(nsuri, parentContext);
- } else if ("tspan" == name) {
- return new com_ibm_rave_render_internal_nodes_TSpanSceneItem(nsuri, parentContext);
- }
- return new com_ibm_rave_render_internal_nodes_GenericSceneNode(nsuri, parentContext, name);
- };
- return _$self;
- }
- });
- // $source: com/ibm/rave/core/scene/SceneNode
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * The base type for all nodes.
- */
- var com_ibm_rave_core_scene_SceneNode = rave_externs["SceneNode"] = com_ibm_rave_core_nativeImpl_Declare({
- /**
- * Get the parent of this node.
- * @return (com.ibm.rave.core.scene.SceneNode) the parent of this node, or <code>null</code> if this node has no parent.
- */
- /** @expose */
- rave_getParentNode : function() {
- return this.rave_getParentNode.call(this);
- },
- /**
- * Get this node's owner node. Depending on the backing implementation, the owner may be equal to the root. In other cases, the owner is a special node with application level capabilities such as handling of accessibility or interactions with the rest of the application.
- * @return (com.ibm.rave.core.scene.SceneNode) the owner node
- */
- /** @expose */
- rave_getOwner : function() {},
- /**
- * Set the node's owner node.
- * @param (com.ibm.rave.core.scene.SceneNode) owner the owner node
- * @see #this.getOwner()
- */
- /** @expose */
- rave_setOwner : function(owner) {},
- /**
- * Set this node's parent. Clients should not call this method directly.
- * @param (com.ibm.rave.core.scene.SceneNode) parent the parent node, may be <code>null</code>
- */
- /** @expose */
- rave_setParentNode : function(parent) {},
- /**
- * Appends the given node to the end of the children.
- * @param (com.ibm.rave.core.scene.SceneNode) node the node to append
- */
- /** @expose */
- rave_appendChild : function(node) {
- this.appendChild.call(this, node);
- },
- /**
- * Does this node have children.
- * @return (boolean) <code>true</code> if this node has children, <code>false</code> otherwise
- */
- /** @expose */
- rave_hasChildNodes : function() {
- return this.rave_hasChildNodes.call(this);
- },
- /**
- * Get the children of this node.
- * @return (Array) a list of child nodes
- */
- /** @expose */
- rave_getChildNodes : function() {
- return this.rave_getChildNodes.call(this);
- },
- /**
- * Get this node's next sibling.
- * @return (com.ibm.rave.core.scene.SceneNode) The next sibling node, or <code>null</code> if the parent contains no more nodes.
- */
- /** @expose */
- rave_getNextSibling : function() {
- return this.rave_getNextSibling.call(this);
- },
- /**
- * Get this node's first child.
- * @return (com.ibm.rave.core.scene.SceneNode) The first child node, or <code>null</code> if this node has no children.
- */
- /** @expose */
- rave_getFirstChild : function() {
- return this.rave_getFirstChild.call(this);
- },
- /**
- * Get this node's previous sibling.
- * @return (com.ibm.rave.core.scene.SceneNode) The previous sibling node, or <code>null</code> if the parent contains no more nodes.
- */
- /** @expose */
- rave_getPreviousSibling : function() {
- return this.rave_getPreviousSibling.call(this);
- },
- /**
- * Insert the given node before the other specified node.
- * @param (com.ibm.rave.core.scene.SceneNode) node the node to insert
- * @param (com.ibm.rave.core.scene.SceneNode) before the node to insert before
- */
- /** @expose */
- rave_insertBefore : function(node, before) {
- this.insertBefore.call(this, node, before);
- },
- /**
- * Set the text content.
- * @param (String) text the text content
- */
- /** @expose */
- rave_setText : function(text) {
- this.rave_setText.call(this, text);
- },
- /**
- * Removes the node from the list of children.
- * @param (com.ibm.rave.core.scene.SceneNode) node the node to remove
- * @return (boolean) <code>true</code> if the node was a child node and removed, <code>false</code> otherwise
- */
- /** @expose */
- removeChild : function(node) {
- return this.removeChild.call(this, node);
- },
- /**
- * Set the style for the given name.
- * @param (String) styleName the style name
- * @param (Object) value the style value This method sets a style using default priority
- */
- rave_setStyle$0 : function(styleName, value) {
- this.rave_setStyle.call(this, styleName, value, "");
- },
- /**
- * Set the style for the given name.
- * @param (String) styleName the style name
- * @param (Object) value the style value
- * @param (String) priority the style priority (ie, "important")
- */
- rave_setStyle$1 : function(styleName, value, priority) {
- this.rave_setStyle.call(this, styleName, value, priority);
- },
- /**
- * Dispatches an event on this node.
- * @param (com.ibm.rave.core.internal.nativeImpl.event.Event) event the triggering event
- * @return (boolean) <code>false</code> if at least one of the event handlers which handled this event called {@link this.Event#this.preventDefault()} , <code>true</code> otherwise
- */
- /** @expose */
- dispatchEvent : function(event) {},
- /**
- * Retrieve the event listener for the given event type.
- * @param (String) eventType the event type
- * @return (com.ibm.rave.core.event.EventListener) the event listener, may be <code>null</code>
- */
- /** @expose */
- rave_getEventListener : function(eventType) {},
- /**
- * Removes all event listeners for the given qualifier.
- * @param (String) group a qualifier to the event type for grouping like events
- */
- /** @expose */
- rave_removeEventListeners : function(group) {},
- /**
- * Get the attribute value for the given attribute name.
- * @param (String) attribute the attribute name
- * @return (Object) the attribute value
- */
- /** @expose */
- getAttribute : function(attribute) {},
- /**
- * Get the attribute value for the given attribute name.
- * @param (String) namespace the namespace
- * @param (String) attribute the attribute name
- * @return (Object) the attribute value
- */
- /** @expose */
- getAttributeNS : function(namespace, attribute) {},
- /**
- * Set the attribute value for the given attribute.
- * @param (String) namespace the namespace
- * @param (String) attribute the attribute name
- * @param (Object) value the attribute value
- */
- /** @expose */
- setAttributeNS : function(namespace, attribute, value) {},
- /**
- * Remove the attribute for the given attribute name.
- * @param (String) attribute the attribute name
- */
- /** @expose */
- removeAttribute : function(attribute) {},
- /**
- * Remove the attribute for the given attribute name.
- * @param (String) namespace the namespace
- * @param (String) attribute the attribute name
- */
- /** @expose */
- removeAttributeNS : function(namespace, attribute) {},
- /**
- * Get the style for the given name.
- * @param (String) styleName the style name
- * @return (Object) the style value
- */
- /** @expose */
- rave_getStyle : function(styleName) {},
- /**
- * Get the computed style for the given name.
- * @param (String) styleName the style name
- * @return (Object) the computed style value
- */
- /** @expose */
- rave_getComputedStyle : function(styleName) {},
- /**
- * Remove the style for the given name.
- * @param (String) styleName the style name
- */
- /** @expose */
- rave_removeStyle : function(styleName) {},
- /**
- * Get the text content.
- * @return (String) the text content
- */
- /** @expose */
- rave_getText : function() {},
- /**
- * Get the html content.
- * @return (String) the html content
- */
- /** @expose */
- rave_getHtml : function() {},
- /**
- * Set the html content.
- * @param (String) html the html content
- */
- /** @expose */
- rave_setHtml : function(html) {},
- /**
- * Query whether the CSS class is set on the node.
- * @param (String) className the class to query
- * @return (boolean) <code>true</code> if the class is set, <code>false</code> otherwise
- */
- /** @expose */
- rave_containsClass : function(className) {},
- /**
- * Set or unset the CSS class on the node.
- * @param (String) className the class to query
- * @return (boolean) <code>true</code> if the class changed, <code>false</code> otherwise
- */
- /** @expose */
- rave_addClass : function(className) {},
- /**
- * Remove the CSS class on the node.
- * @param (String) className the class to query
- * @return (boolean) <code>true</code> if the class changed, <code>false</code> otherwise
- */
- /** @expose */
- rave_removeClass : function(className) {},
- /**
- * Get the data associated with this node.
- * @return (Object) the associated data
- */
- /** @expose */
- rave_getData : function() {
- return this.rave_getProperty("__data__");
- },
- /**
- * Set the data for this node.
- * @param (Object) value the data value
- */
- /** @expose */
- rave_setData : function(value) {
- this.rave_setProperty("__data__", value);
- },
- /**
- * Returns true if the data had been set on this element
- * @return (boolean) true if data has been set otherwise false
- */
- /** @expose */
- rave_hasData : function() {
- return this.rave_hasProperty("__data__");
- },
- /**
- * Store a value on this node for a given key.
- * @param (String) key the property key
- * @param (Object) value the property value
- */
- /** @expose */
- rave_setProperty : function(key, value) {
- this.rave_setProperty.call(this, key, value);
- },
- /**
- * Remove a property from the node.
- * @param (String) key The property to remove.
- */
- /** @expose */
- rave_removeProperty : function(key) {
- this.removePropertyExt.call(this, key);
- },
- /**
- * Set the attribute value for the given attribute.
- * @param (String) key the attribute key
- * @param (Object) value the attribute value
- */
- /** @expose */
- setAttribute : function(key, value) {
- this.setAttribute.call(this, key, value);
- },
- /**
- * Get a stored value from this node for a given key.
- * @param (String) key the property key
- * @return (Object) the property value
- */
- /** @expose */
- rave_getProperty : function(key) {},
- /**
- * Returns true if this element has a property with the same name as the string passed in
- * @param (String) proName property name to check
- * @return (boolean) true if the property exist otherwise false
- */
- /** @expose */
- rave_hasProperty : function(proName) {},
- /**
- * Get the name of this node.
- * @return (String) the name of this node
- */
- /** @expose */
- rave_getName : function() {},
- /**
- * Get the namespace URI of this node.
- * @return (String) the namespace URI, may be <code>null</code>
- */
- /** @expose */
- rave_getNamespaceURI : function() {},
- /**
- * Get the qualified name of this node. The qualified name is a concatenation of the namespace URI and the name with a colon delimiter.
- * @return (String) the qualified name
- */
- /** @expose */
- rave_getQualifiedName : function() {},
- /**
- * Returns the size of this node in a rectangle geom and its position relative to the viewport. Takes all transforms into account - ie transform, translate, rotate, etc. Does not include stroke or other styles.
- */
- /** @expose */
- getBoundingClientRect : function() {},
- /**
- * Returns the local bounds of this node in a rectangle geom relative to its parent node. Typically these are the set positioning properties (x,y,width,height,etc). Does not take transforms into account. Does not include stroke or other styles.
- * @return (com.ibm.rave.core.geom.RaveRect) Bounding box of this shape. Must never return null.
- */
- /** @expose */
- getBBox : function() {},
- /**
- * Returns the draw type of node as an int.
- * @return (int) The integer representation of the type of drawable shape of this node.
- */
- /** @expose */
- rave_getDrawType : function() {
- return 0;
- },
- /**
- * Returns the computed transform matrix of this node in screen coordinates.
- * @return (com.ibm.rave.core.transform.Matrix) Matrix object that describes the transform matrix. In Javascript, this object may be a native Matrix object depending on implementation.
- */
- /** @expose */
- getScreenCTM : function() {
- return this.getScreenCTM.call(this);
- },
- /**
- * Returns the computed transform matrix of this node in local coordinates.
- * @return (com.ibm.rave.core.transform.Matrix) Matrix object that describes the transform matrix. In Javascript, this object may be a native Matrix object depending on implementation.
- */
- /** @expose */
- getCTM : function() {
- return this.getCTM.call(this);
- },
- /**
- * Dispose of this node; allow any clean up to be performed.
- */
- /** @expose */
- rave_dispose : function() {},
- /**
- * Return all scene nodes which intersect with the rectangle
- * @param (com.ibm.rave.core.geom.RectStruct) rect test rectangle
- * @return (Array) all scene nodes which intersect with the test rectangle
- */
- /** @expose */
- rave_intersectionList : function(rect) {},
- /** @expose */
- rave_getSizePx : function(size) {},
- /**
- * Return a single node from the the bottom of the node containment tree, which intersects with the x,y coordinates
- * @param (double) x coordinate x
- * @param (double) y coordinate y
- * @return (com.ibm.rave.core.scene.SceneNode) a single node from the the bottom of the node containment tree, which intersects with the x,y coordinates
- */
- /** @expose */
- rave_intersection : function(x, y) {},
- /** @expose */
- rave_initExtensions : function() {},
- /**
- * Return a map of css property names to set property css values on this node. This mimics window.getComputedStyles(node) on the web. (We delegate to that API on Javascript).
- * @return (Object) map of css property names to set property css values
- */
- /** @expose */
- rave_getComputedStyles : function() {},
- /** @expose */
- rave_setStyle : function(a0, a1, a2) {
- var args = arguments;
- if (args.length == 2) {
- return this.rave_setStyle$0(a0, a1);
- }
- return this.rave_setStyle$1(a0, a1, a2);
- },
- /** @expose */
- rave_addEventListener : function(a0, a1, a2, a3) {
- var args = arguments;
- if (args.length == 2) {
- return this.rave_addEventListener$1(a0, a1);
- }
- if (args.length == 3) {
- return this.rave_addEventListener$2(a0, a1, a2);
- }
- return this.rave_addEventListener$0(a0, a1, a2, a3);
- },
- /** @expose */
- rave_removeEventListener : function(a0, a1) {
- var args = arguments;
- if (args.length == 1) {
- return this.rave_removeEventListener$0(a0);
- }
- return this.rave_removeEventListener$1(a0, a1);
- }
- /**
- * Adds an event listener for the given qualifier and event type.
- * @param (String) eventType the event type
- * @param (com.ibm.rave.core.event.EventListener) listener the event listener
- * @param (boolean) useCapture whether or not the listener is to be added to the capture phase; not supported by all clients
- * @param (String) group a qualified to the event type for grouping like events
- */
- //rave_addEventListener$0 : function(eventType, listener, useCapture, group) {},
- /**
- * Adds an event listener for the given event type.
- * @param (String) eventType the event type
- * @param (com.ibm.rave.core.event.EventListener) listener the event listener
- */
- //rave_addEventListener$1 : function(eventType, listener) {},
- /**
- * Adds an event listener for the given event type.
- * @param (String) eventType the event type
- * @param (com.ibm.rave.core.event.EventListener) listener the event listener
- * @param (boolean) useCapture whether or not the listener is to be added to the capture phase; not supported by all clients
- */
- //rave_addEventListener$2 : function(eventType, listener, useCapture) {},
- /**
- * Removes an event listener for the given type.
- * @param (String) eventType the event type
- */
- //rave_removeEventListener$0 : function(eventType) {},
- /**
- * Removes an event listener for the given qualifier and type.
- * @param (String) eventType the event type
- * @param (String) group a qualifier to the event type for grouping like events
- */
- //rave_removeEventListener$1 : function(eventType, group) {}
- });
- /** @expose */
- com_ibm_rave_core_scene_SceneNode.DATA_PROPERTY = "__data__";
- // $source: com/ibm/rave/render/internal/nodes/AbstractSceneNode
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/core/scene/SceneNode (loadtime) // superclass
- //@import com/ibm/rave/render/internal/properties/SceneNodeAttributes (runtime) // new
- //@import com/ibm/rave/core/internal/util/CollectionsUtil (runtime) // remove
- //@import com/ibm/rave/render/internal/properties/SceneNodeDefaultStyles (runtime) // getIndex
- //@import com/ibm/rave/core/internal/nativeImpl/Lang (runtime) // isArray
- //@import com/ibm/rave/core/transform/MatrixUtil (runtime) // identity, transformBounds, isIdentityMatrix
- //@import com/ibm/rave/render/internal/nodes/NodeUtil (runtime) // findSceneNode
- //@import com/ibm/rave/core/geom/RectStruct (runtime) // new
- //@import com/ibm/rave/core/geom/NodeRect (runtime) // new
- //@import com/ibm/rave/render/internal/style/ShadowStyle (runtime) // parse
- //@import com/ibm/rave/render/internal/nodes/SceneNodeStyleManager (runtime) // new
- //@import com/ibm/rave/core/internal/css/CSSParser (runtime) // parse
- /**
- * A base type for scene nodes.
- */
- var com_ibm_rave_render_internal_nodes_AbstractSceneNode = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scene_SceneNode, {
- //cachedBBox : null,
- //cachedBoundingClientRect : null,
- //parent : null,
- //owner : null,
- //children : null,
- //namespaceURI : null,
- //attributes : null,
- //propertyBag : null,
- //classList : null,
- //eventListeners : null,
- //listenersByGroup : null,
- //listenersByType : null,
- //qname : null,
- /**
- * Scene tree context used retrieve data about the scene tree.
- */
- //sceneTreeContext : null,
- /**
- * Native object holding specific platform information for this node. For instance on AWT, this might be a Rectangle2d object.
- */
- //nativeSceneNode : null,
- //styleManager : null,
- //cachedCTM : null,
- //cachedScreenCTM : null,
- text : "",
- html : "",
- invalidLayout : true,
- dirty : false,
- constructor : function(nsuri, context) {
- this.attributes = new com_ibm_rave_render_internal_properties_SceneNodeAttributes();
- {
- this.rave_initExtensions();
- this.namespaceURI = nsuri;
- if (context) {
- this.sceneTreeContext = (context).sceneTreeContext;
- }
- this.styleManager = new com_ibm_rave_render_internal_nodes_SceneNodeStyleManager(this);
- }
- },
- /**
- * Return this node's 'id' attribute. Must return the same value as getAttribute('id');
- * @return (String) String representation of this node's ID value.
- */
- getId : function() {
- var id = this.attributes.getByIndex(0);
- if (id == null) {
- return null;
- }
- return ""+(id);
- },
- /** @expose */
- rave_hasProperty : function(propName) {
- return this.propertyBag ? this.propertyBag.hasOwnProperty(propName) : false;
- },
- /**
- * Create an instance of our children list
- */
- createChildren : function() {
- this.children = [];
- },
- /** @expose */
- rave_getEventListener : function(eventType) {
- var info = this.eventListeners ? this.eventListeners[eventType] : null;
- return info ? info.listener : null;
- },
- rave_addEventListener$1 : function(eventType, listener) {
- this.rave_addEventListener$0(eventType, listener, false, null);
- },
- rave_addEventListener$2 : function(eventType, listener, useCapture) {
- this.rave_addEventListener$0(eventType, listener, useCapture, null);
- },
- rave_addEventListener$0 : function(eventType, listener, useCapture, group) {
- var eventId = com_ibm_rave_render_internal_nodes_AbstractSceneNode.createEventId(eventType, group);
- if (!this.eventListeners) {
- this.eventListeners = {};
- this.listenersByGroup = {};
- this.listenersByType = {};
- } else if (this.eventListeners.hasOwnProperty(eventId)) {
- this.rave_removeEventListener$1(eventType, group);
- }
- var info = new com_ibm_rave_render_internal_nodes_AbstractSceneNode.ListenerInfo(eventId, eventType, listener, useCapture);
- this.eventListeners[eventId] = info;
- var groupList = this.listenersByGroup[group];
- if (!groupList) {
- groupList = [];
- this.listenersByGroup[group] = groupList;
- }
- groupList.push(info);
- var typeList = this.listenersByType[eventType];
- if (!typeList) {
- typeList = [];
- this.listenersByType[eventType] = typeList;
- var renderer = this.sceneTreeContext ? this.sceneTreeContext.getRenderer() : null;
- if (renderer) {
- renderer.registerEvent(eventType, this);
- }
- }
- typeList.push(info);
- },
- rave_removeEventListener$0 : function(eventType) {
- if (this.eventListeners) {
- this.rave_removeEventListener$1(eventType, null);
- }
- },
- rave_removeEventListener$1 : function(eventType, group) {
- if (this.eventListeners) {
- var eventId = com_ibm_rave_render_internal_nodes_AbstractSceneNode.createEventId(eventType, group);
- var info = this.eventListeners[eventId];
- if (info) {
- delete this.eventListeners[eventId];
- info.isRemoved = true;
- var byGroupList = this.listenersByGroup[group];
- if (com_ibm_rave_core_internal_util_CollectionsUtil.remove(byGroupList, info) && byGroupList.length == 0) {
- delete this.listenersByGroup[group];
- }
- var byTypeList = this.listenersByType[eventType];
- if (com_ibm_rave_core_internal_util_CollectionsUtil.remove(byTypeList, info) && byTypeList.length == 0) {
- delete this.listenersByType[eventType];
- var renderer = this.sceneTreeContext ? this.sceneTreeContext.getRenderer() : null;
- if (renderer) {
- renderer.unregisterEvent(eventType, this);
- }
- }
- }
- }
- },
- /** @expose */
- rave_removeEventListeners : function(group) {
- if (this.listenersByGroup) {
- var list = this.listenersByGroup[group];
- if (list) {
- var renderer = this.sceneTreeContext ? this.sceneTreeContext.getRenderer() : null;
- for (var __i_enFor0 = 0, __exp_enFor0 = list, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var info = __exp_enFor0[__i_enFor0];
- delete this.eventListeners[info.id];
- info.isRemoved = true;
- var byTypeList = this.listenersByType[info.type];
- if (com_ibm_rave_core_internal_util_CollectionsUtil.remove(byTypeList, info)) {
- if (byTypeList.length == 0) {
- delete this.listenersByType[info.type];
- if (renderer) {
- renderer.unregisterEvent(info.type, this);
- }
- }
- }
- }
- delete this.listenersByGroup[group];
- }
- }
- },
- /** @expose */
- dispatchEvent : function(event) {
- if (!event) {
- throw new Error("Null event");
- }
- if (event.type == null || event.type.length == 0) {
- throw new Error("Uninitialized event");
- }
- var targetList = [];
- event.target = this;
- var targetParent = this.rave_getParentNode();
- while (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(targetParent, com_ibm_rave_render_internal_nodes_AbstractSceneNode)) {
- targetList.push(targetParent);
- targetParent = targetParent.rave_getParentNode();
- }
- event.eventPhase = 1;
- if (com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTargets(event, targetList, true, false)) {
- event.eventPhase = 2;
- if (com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTarget(event, this, false, true)) {
- if (event.bubbles && !event.propagationStopped) {
- event.eventPhase = 3;
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTargets(event, targetList, false, false);
- }
- }
- }
- event.currentTarget = null;
- event.eventPhase = 0;
- return event.defaultPrevented;
- },
- /** @expose */
- getAttribute : function(attribute) {
- return attribute != null ? this.attributes.get(attribute) : null;
- },
- setSceneTreeContext : function(stc) {
- this.sceneTreeContext = stc;
- if (this.children) {
- for (var __i_enFor0 = 0, __exp_enFor0 = this.children, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- (child).setSceneTreeContext(stc);
- }
- }
- },
- /**
- * Notify listeners of a 'type' notification change on this node. Happens after the change has been made.
- * @param (int) type The SceneItemNotificationType to notify listeners about.
- * @param (int) subType Optional SceneItemNotificationType to notify listeners about.
- * @param (String) key An optional key value that is being modified. For instance, this could be the attribute name.
- * @param (Object) toValue The value that the key is being updated to.
- * @param (Object) fromValue The value that the key is being updated from (will be null if this is a new property).
- */
- notifyAfterUpdate : function(type, subType, key, toValue, fromValue) {
- if (this.sceneTreeContext) {
- if (this.sceneTreeContext.getCacheManager()) {
- this.sceneTreeContext.getCacheManager().afterUpdate(type, subType, key, toValue, fromValue, this);
- }
- if (this.sceneTreeContext.getRenderer()) {
- this.sceneTreeContext.getRenderer().handleDrawEvent(type, this);
- }
- }
- },
- /** @expose */
- rave_getStyle : function(attribute) {
- var style = this.styleManager.getStyleByName(attribute);
- if (style && !style.fromAttribute) {
- return style.value != null ? style.value.toString() : "";
- }
- return "";
- },
- computeStyleValue : function(id) {
- this.computeStylesToRoot();
- return this.styleManager.getComputedCSSStyle(id).value;
- },
- computeCSSStyle : function(id) {
- this.computeStylesToRoot();
- return this.styleManager.getComputedCSSStyle(id);
- },
- /**
- * Get the value of a previously computed style based on id. Does not re-calculate the style. If you need the styles recalculated, use computeStyleValue().
- * @see #this.computeStyleValue( this.id)
- * @param (int) id The internal style id to look for.
- * @return (Object) The value of the CSSStyle associated with this computed style. The caller is responsible for properly casting.
- */
- getComputedStyleValue : function(id) {
- return this.styleManager.getComputedStyleValue(id);
- },
- /**
- * Get the previously computed style based on id. Does not re-calculate the style. If you need the styles recalculated, use computeCSSStyle().
- * @see #this.computeCSSStyle( this.id)
- * @param (int) id The internal style id to look for.
- * @return (com.ibm.rave.core.internal.css.CSSStyle) The CSSStyle associated with this computed style.
- */
- getComputedCSSStyle : function(id) {
- return this.styleManager.getComputedCSSStyle(id);
- },
- /** @expose */
- rave_getComputedStyle : function(attribute) {
- this.computeStylesToRoot();
- var cssStyle = this.styleManager.getComputedCSSStyle(com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.getIndex(attribute));
- return cssStyle ? cssStyle.value != null ? cssStyle.value.toString() : "" : undefined;
- },
- /** @expose */
- rave_getComputedStyles : function() {
- this.computeStylesToRoot();
- var results = {};
- for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.styleManager.computedStyles), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var index = __exp_enFor0[__i_enFor0];
- var style = this.styleManager.computedStyles[index];
- var value;
- if ((typeof style.value === "string" || style.value instanceof String) || (typeof style.value === "number" || style.value instanceof Number)) {
- value = ""+(style.value);
- } else if (com_ibm_rave_core_internal_nativeImpl_Lang.isArray(style.value)) {
- value = "";
- var array = style.value;
- for (var i = 0; i < array.length; ++i) {
- value += array[i].toString();
- if (i < array.length - 1) {
- value += ",";
- }
- }
- } else {
- value = style.value == null ? "" : style.value.toString();
- }
- results[style.name] = value;
- }
- return results;
- },
- /**
- * Compute all styles all the way up to the root. This ensures that inherited styles are up to date for this node. TODO we need a better way to determine if the styles have changed on a node and when to recompute.
- */
- computeStylesToRoot : function() {
- var parentNode = this.rave_getParentNode();
- if (parentNode) {
- (parentNode).computeStylesToRoot();
- }
- this.computeStyles();
- },
- /** @expose */
- rave_getText : function() {
- var result = this.text;
- for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- result += child.rave_getText();
- }
- return result;
- },
- /** @expose */
- rave_getHtml : function() {
- var builder = "";
- builder+=("<" + this.rave_getName() + " " + this.attributes.serialize() + " " + this.styleManager.serialize());
- if (this.rave_hasChildNodes()) {
- builder+=(">");
- for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- builder+=((child).rave_getHtml());
- }
- builder+=(this.text + "</" + this.rave_getName() + ">");
- } else {
- if (this.text != null && this.text.length > 0) {
- builder+=(">" + this.text + "</" + this.rave_getName() + ">");
- } else {
- builder+=("/>");
- }
- }
- return builder;
- },
- /** @expose */
- rave_setHtml : function(html) {
- this.setDirty(true, true);
- var newValue = html == null ? "" : html;
- this.html = newValue;
- this.notifyAfterUpdate(1000, 2003, "html", newValue, null);
- },
- /** @expose */
- rave_addClass : function(className) {
- return this.addClassAndUpdateClassAttr(className, true);
- },
- addClassAndUpdateClassAttr : function(className, updateClassAttr) {
- var added = false;
- var classes = className.split(new RegExp("\\s+"));
- if (classes.length > 0) {
- if (!this.classList) {
- this.classList = [];
- }
- var newClassName = null;
- for (var __i_enFor0 = 0, __len_enFor0 = classes.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var clazz = classes[__i_enFor0];
- if (clazz.length > 0 && !(this.classList.indexOf(clazz)> -1)) {
- if (!added) {
- added = true;
- this.setDirty(true, true);
- this.styleManager.dirtyExternalStyles = true;
- newClassName = this.attributes.getByIndex(2);
- if (newClassName == null) {
- newClassName = "";
- }
- }
- if (newClassName.length > 0) {
- newClassName += " ";
- }
- newClassName += clazz;
- this.classList.push(clazz);
- this.notifyAfterUpdate(1001, 2001, "class", clazz, null);
- }
- }
- if (added && updateClassAttr) {
- this.attributes.setPropertyValue(2, newClassName);
- }
- }
- return added;
- },
- /** @expose */
- rave_removeClass : function(className) {
- var removed = false;
- if (this.classList && this.classList.length > 0) {
- var classes = className.split(new RegExp("\\s+"));
- if (classes.length > 0) {
- for (var __i_enFor0 = 0, __len_enFor0 = classes.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var clazz = classes[__i_enFor0];
- if (clazz.length > 0 && this.classList.indexOf(clazz)> -1) {
- if (!removed) {
- removed = true;
- this.setDirty(true, true);
- this.styleManager.dirtyExternalStyles = true;
- }
- com_ibm_rave_core_internal_util_CollectionsUtil.remove(this.classList, clazz);
- this.notifyAfterUpdate(1002, 2001, "class", null, clazz);
- }
- }
- if (removed) {
- this.attributes.setPropertyValue(2, this.classList.join(" "));
- }
- }
- }
- return removed;
- },
- /** @expose */
- rave_containsClass : function(className) {
- if (!this.classList) {
- return false;
- }
- var classes = className.trim().split(new RegExp("\\s"));
- for (var __i_enFor0 = 0, __len_enFor0 = classes.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var clazz = classes[__i_enFor0];
- if (!(this.classList.indexOf(clazz.trim())> -1)) {
- return false;
- }
- }
- return true;
- },
- /** @expose */
- rave_getNamespaceURI : function() {
- return this.namespaceURI;
- },
- /** @expose */
- rave_getQualifiedName : function() {
- if (this.qname == null) {
- this.qname = this.namespaceURI + ":" + this.rave_getName();
- }
- return this.qname;
- },
- /** @expose */
- getAttributeNS : function(namespace, attribute) {
- return this.getAttribute(namespace + ":" + attribute);
- },
- /** @expose */
- setAttributeNS : function(namespace, attribute, value) {
- this.setAttribute(namespace + ":" + attribute, value);
- },
- /** @expose */
- removeAttribute : function(attribute) {
- var oldValue = this.attributes.get(attribute);
- if (oldValue == null) {
- return;
- }
- this.setAttribute(attribute, null);
- this.notifyAfterUpdate(1002, 2000, attribute, null, oldValue);
- },
- /** @expose */
- removeAttributeNS : function(namespace, attribute) {
- this.removeAttribute(namespace + ":" + attribute);
- },
- /** @expose */
- rave_removeStyle : function(styleName) {
- this.styleManager.removeStyle(styleName);
- },
- /**
- * Computes all styles for this node. The caller must ensure that all parent nodes have had their styles computed already.
- */
- computeStyles : function() {
- this.styleManager.computeStyles();
- },
- /** @expose */
- rave_getProperty : function(key) {
- return this.propertyBag ? this.propertyBag[key] : null;
- },
- /**
- * @return (Array) List of class names on this node.
- */
- getClassList : function() {
- if (!this.classList) {
- this.classList = [];
- }
- return this.classList;
- },
- getPropertyBag : function() {
- if (!this.propertyBag) {
- this.propertyBag = {};
- }
- return this.propertyBag;
- },
- /** @expose */
- rave_setParentNode : function(parent) {
- var rendererSet = false;
- if (!this.sceneTreeContext && parent) {
- var r = (parent).sceneTreeContext;
- if (r) {
- this.setSceneTreeContext(r);
- rendererSet = true;
- }
- }
- if (this.sceneTreeContext && this.sceneTreeContext.getRenderer()) {
- if ((!this.parent && parent) || rendererSet) {
- this.recursiveRegisterEventListeners();
- } else if (this.parent && !parent) {
- this.recursiveUnregisterEventListeners();
- }
- if (!parent) {
- this.setSceneTreeContext(null);
- }
- }
- this.parent = parent;
- },
- /** @expose */
- rave_getOwner : function() {
- if (this.owner) {
- return this.owner;
- }
- var p = this.rave_getParentNode();
- return !p ? null : p.rave_getOwner();
- },
- /** @expose */
- rave_setOwner : function(owner) {
- this.owner = owner;
- },
- /**
- * @expose
- */
- computeCTM : function(context, isScreenCTM) {
- var abstractContext = context;
- var ctm = com_ibm_rave_core_transform_MatrixUtil.identity();
- var t = abstractContext.computeStyleValue(11);
- if (t) {
- ctm = t;
- }
- var parent = context.rave_getParentNode();
- if (parent) {
- var pctm = isScreenCTM ? parent.getScreenCTM() : parent.getCTM();
- if (pctm) {
- if (!ctm) {
- ctm = pctm;
- } else if (!(com_ibm_rave_core_transform_MatrixUtil.isIdentityMatrix(pctm))) {
- ctm = pctm.multiply(ctm);
- }
- }
- }
- return ctm ? ctm : com_ibm_rave_core_transform_MatrixUtil.identity();
- },
- recursiveRegisterEventListeners : function() {
- if (this.eventListeners) {
- var renderer = this.sceneTreeContext.getRenderer();
- for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.eventListeners), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var type = __exp_enFor0[__i_enFor0];
- renderer.registerEvent(type, this);
- }
- }
- if (this.children) {
- for (var __i_enFor1 = 0, __exp_enFor1 = this.children, __len_enFor1 = __exp_enFor1.length;
- __i_enFor1 < __len_enFor1; ++__i_enFor1) {
- var child = __exp_enFor1[__i_enFor1];
- (child).recursiveRegisterEventListeners();
- }
- }
- },
- recursiveUnregisterEventListeners : function() {
- if (this.eventListeners) {
- var renderer = this.sceneTreeContext.getRenderer();
- for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.eventListeners), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var type = __exp_enFor0[__i_enFor0];
- renderer.unregisterEvent(type, this);
- }
- }
- if (this.children) {
- for (var __i_enFor1 = 0, __exp_enFor1 = this.children, __len_enFor1 = __exp_enFor1.length;
- __i_enFor1 < __len_enFor1; ++__i_enFor1) {
- var child = __exp_enFor1[__i_enFor1];
- (child).recursiveUnregisterEventListeners();
- }
- }
- },
- /**
- * Removes the child from this parent but does not update the parent node of the child.
- * @param (com.ibm.rave.core.scene.SceneNode) child
- */
- internalRemoveChild : function(child) {
- var idx = this.children.indexOf(child);
- if (idx >= 0) {
- this.children.splice(idx, 1);
- }
- },
- /**
- * Helper method to append a child item.
- * @param (com.ibm.rave.core.scene.SceneNode) item the child item to append
- * @return (int) the index of the appended item
- */
- internalAppendChild : function(item) {
- if (!this.children) {
- this.createChildren();
- }
- this.setDirty(true, true);
- if (item.rave_getParentNode()) {
- item.rave_getParentNode().removeChild(item);
- }
- this.children.push(item);
- item.rave_setParentNode(this);
- return this.children.length - 1;
- },
- /**
- * Helper method to insert a child item before another one. If the 'before' item isn't actually a child of this node, then insert 'item' at the end.
- * @param (com.ibm.rave.core.scene.SceneNode) item the item to insert
- * @param (com.ibm.rave.core.scene.SceneNode) before the item to insert before
- * @return (int) the index of the inserted item.
- */
- insertChildBefore : function(item, before) {
- if (!this.children) {
- this.createChildren();
- }
- var bidx = this.children.indexOf(before);
- if (before && bidx >= 0) {
- if (item == before) {
- return bidx;
- }
- this.setDirty(true, true);
- this.internalRemoveChild(item);
- bidx = this.children.indexOf(before);
- item.rave_setParentNode(this);
- this.children.splice(bidx, 0, item);
- return bidx;
- }
- this.setDirty(true, true);
- this.children.push(item);
- item.rave_setParentNode(this);
- return this.children.length - 1;
- },
- /**
- * Get the sibling of this scene item at the specified index offset. The offset can be any integer, including 0 or negative values. For a negative offset, this method will return a sibling at a position <em>preceding</em> this item.
- * @param (int) offset Integer index offset.
- * @return (com.ibm.rave.core.scene.SceneNode) This item's sibling at the specified index offset.
- */
- getSibling : function(offset) {
- var sibling;
- if (this.parent) {
- var c = this.parent.rave_getChildNodes();
- var idx = c.indexOf(this);
- var idxOffset = idx + offset;
- if (idx > -1 && (idxOffset >= 0 && idxOffset < c.length)) {
- sibling = c[idxOffset];
- }
- }
- return sibling;
- },
- _detectHits : function(list, rectangle) {
- if (this._hitDetectionEntryTest()) {
- return;
- }
- if (this.rave_intersects(rectangle)) {
- if (this.rave_hasChildNodes()) {
- var childNodes = this.getChildrenArray();
- for (var i = childNodes.length - 1; i >= 0; --i) {
- var child = childNodes[i];
- var ctm = child.getComputedStyleValue(11);
- child._detectHits(list, ctm ? com_ibm_rave_core_transform_MatrixUtil.transformBounds(rectangle, ctm.inverse()) : rectangle);
- }
- } else if (!("none" == this.getComputedStyleValue(42))) {
- list.push(this);
- }
- }
- },
- _detectHit : function(rectangle) {
- if (this._hitDetectionEntryTest()) {
- return null;
- }
- if (this.rave_intersects(rectangle)) {
- if (this.rave_hasChildNodes()) {
- var childNodes = this.getChildrenArray();
- for (var i = childNodes.length - 1; i >= 0; --i) {
- var child = childNodes[i];
- var ctm = child.getComputedStyleValue(11);
- var hit = child._detectHit(ctm ? com_ibm_rave_core_transform_MatrixUtil.transformBounds(rectangle, ctm.inverse()) : rectangle);
- if (hit) {
- return hit;
- }
- }
- } else if (!("none" == this.getComputedStyleValue(42))) {
- return this;
- }
- return !this.rave_getParentNode() ? this : null;
- }
- return null;
- },
- _hitDetectionEntryTest : function() {
- return !(this.isVisible()) || "none" == this.getComputedStyleValue(26);
- },
- rave_intersects : function(rect) {
- if ("none" == this.computeStyleValue(26) || "none" == this.getComputedStyleValue(42) || !(this.intersectsClip(rect))) {
- return false;
- }
- var r = this.getBBox();
- return r.intersects(rect);
- },
- /**
- * Helper method to check if the given rect intersects with the clip on this node. If no clip is present, returns <code>true</code>.
- * @param (com.ibm.rave.core.geom.RectStruct) rect the rectangle hit testing region
- * @return (boolean) <code>true</code> if the rectangle intersects the clip or if no clip is present, <code>false</code> otherwise
- */
- intersectsClip : function(rect) {
- var clip = com_ibm_rave_render_internal_nodes_NodeUtil.findSceneNode(this, this.getComputedStyleValue(44), [1014]);
- return !clip || clip.rave_intersects(rect);
- },
- /** @expose */
- rave_intersectionList : function(r) {
- var list = [];
- this._detectHits(list, r);
- return list;
- },
- /** @expose */
- rave_intersection : function(x, y) {
- return this._detectHit(new com_ibm_rave_core_geom_RectStruct(x, y, 0.5, 0.5));
- },
- /** @expose */
- rave_initExtensions : function() {
- this.rave_setProperty = com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_PROPERTY_EXT;
- this.removePropertyExt = com_ibm_rave_render_internal_nodes_AbstractSceneNode.REMOVE_PROPERTY_EXT;
- this.appendChild = com_ibm_rave_render_internal_nodes_AbstractSceneNode.APPEND_CHILD_EXT;
- this.rave_getParentNode = com_ibm_rave_render_internal_nodes_AbstractSceneNode.PARENT_NODE_EXT;
- this.insertBefore = com_ibm_rave_render_internal_nodes_AbstractSceneNode.INSERT_BEFORE_EXT;
- this.rave_getNextSibling = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_NEXT_SIBLING_EXT;
- this.rave_getPreviousSibling = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_PREVIOUS_SIBLING_EXT;
- this.rave_getFirstChild = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_FIRST_CHILD;
- this.rave_hasChildNodes = com_ibm_rave_render_internal_nodes_AbstractSceneNode.HAS_CHILD_NODES_EXT;
- this.rave_getChildNodes = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_CHILD_NODES_EXT;
- this.removeChild = com_ibm_rave_render_internal_nodes_AbstractSceneNode.REMOVE_CHILD_EXT;
- this.rave_setStyle = com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_STYLE_EXT;
- this.setAttribute = com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_ATTRIBUTE_EXT;
- this.rave_setText = com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_TEXT_EXT;
- this.getCTM = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_CTM_EXT;
- this.getScreenCTM = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_SCREEN_CTM_EXT;
- },
- /**
- * Return the index of this node relative to its siblings.
- * @return (int) The index of this node relative to its siblings.
- */
- getSiblingIndex : function() {
- return this.parent.rave_getChildNodes().indexOf(this);
- },
- /**
- * Called after painting of node and its children. By default, this does nothing. Nodes can override as needed.
- * @param (com.ibm.rave.render.AbstractRenderer) renderer The renderer to draw to
- */
- postPaint : function(renderer) {},
- /**
- * Is this a 'drawable' scene node. ie - one that can be drawn on a canvas. For instance, a "rect" shape is drawable, while a "defs" node is not.
- * @return (boolean) <code>true</code> if this is a drawable node, <code>false</code> otherwise.
- */
- isDrawable : function() {
- return true;
- },
- /**
- * Get the size from the computed style and convert to pixel value.
- * @param (com.ibm.rave.core.css.CSSSize) size the CSS size
- * @return (double) a pixel value of the size for the given style
- */
- /** @expose */
- rave_getSizePx : function(size) {
- var value = 0;
- if (size) {
- value = size.value;
- switch (size.unit.type) {
- case 1:
- break;
- case 2:
- break;
- case 4:
- value = 96.0 * 0.3937007874 * value;
- break;
- case 3:
- value = 96.0 * value;
- break;
- case 6:
- value = 96.0 * 0.0138888889 * value;
- break;
- case 7:
- value = 96.0 * 0.1666666667 * value;
- break;
- case 5:
- value = 96.0 * 0.0393700787 * value;
- break;
- }
- }
- return value;
- },
- /**
- * Return a pixel size for the computed style information for the style referenced by styleId.
- * @param (int) styleId Style id from SceneNodeStyles.
- * @return (double) Computed pixel value for this style.
- */
- getComputedSizePx : function(styleId) {
- return this.rave_getSizePx(this.getComputedCSSStyle(styleId).value);
- },
- /** @expose */
- getBBox : function() {
- if (this.invalidLayout) {
- this.layout();
- }
- if (!this.cachedBBox) {
- this.cachedBBox = this.calculateBBox();
- }
- return this.cachedBBox;
- },
- /**
- * A method to get the bounding box to use in getBoundingClientRect() calculations. By default this method just calls getBBox(), but some scene node types may need to override this. For instance, text nodes change their x values based on text-anchor.
- * @return (com.ibm.rave.core.geom.RaveRect) Bounding box to be used in getBoundingClientRect() before transforms are applied.
- */
- getBoundingClientRectBBox : function() {
- return this.getBBox();
- },
- /**
- * Perform a layout pass on this node and this node only. Invalidate our layout caches.
- */
- layout : function() {
- if (this.invalidLayout) {
- this.computeStylesToRoot();
- this.doLayout();
- }
- this.invalidLayout = false;
- },
- /**
- * We call invalidateLayout whenever an attribute or style changes that changes the bounding box of this node.
- */
- invalidateLayout : function() {
- this.invalidLayout = true;
- this.cachedBBox = null;
- var parent = this;
- if ((parent = parent.rave_getParentNode()) && !(parent).invalidLayout) {
- (parent).invalidateLayout();
- }
- },
- /**
- * Called whenever transform information has changed. This invalidates our CTM and cached bounding client rect.
- */
- invalidateTransform : function() {
- this.cachedBoundingClientRect = null;
- this.cachedScreenCTM = null;
- this.cachedCTM = null;
- if (this.rave_hasChildNodes()) {
- for (var __i_enFor0 = 0, __exp_enFor0 = this.getChildrenArray(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- (child).invalidateTransform();
- }
- }
- },
- /**
- * Returns the size of this node in a rectangle geom and its position relative to the viewport. Takes all transforms into account - ie transform, translate, rotate, etc. Does not include stroke or other non-layout attributes.
- */
- /** @expose */
- getBoundingClientRect : function() {
- if (this.invalidLayout) {
- this.layout();
- }
- if (!this.cachedBoundingClientRect) {
- var bb = this.getBoundingClientRectBBox();
- var ownerLeft = 0;
- var ownerTop = 0;
- if (this.rave_getOwner() != this) {
- var ownerRect = this.rave_getOwner().getBoundingClientRect();
- ownerLeft = ownerRect.left;
- ownerTop = ownerRect.top;
- }
- var bstruct = com_ibm_rave_core_transform_MatrixUtil.transformBounds(new com_ibm_rave_core_geom_RectStruct(bb.x, bb.y, bb.width, bb.height), this.getCTM());
- var left = bstruct.x + ownerLeft;
- var right = left + bstruct.width;
- var top = bstruct.y + ownerTop;
- var bottom = top + bstruct.height;
- this.cachedBoundingClientRect = new com_ibm_rave_core_geom_NodeRect(left, right, bottom, top, bstruct.width, bstruct.height);
- }
- return this.cachedBoundingClientRect;
- },
- /**
- * Is this node 'visible' meaning it will be fully drawn. This method only takes the visibility attribute into account.
- * @return (boolean) <code>true</code> if this node should be painted. <code>false</code> otherwise.
- */
- isVisible : function() {
- return this.styleManager.isVisible();
- },
- isDirty : function() {
- return this.dirty;
- },
- setDirty : function(dirty_, invalidateLayout) {
- if (dirty_) {
- var notifyChildren = false;
- if (!this.dirty) {
- this.dirty = true;
- notifyChildren = true;
- switch (this.rave_getDrawType()) {
- case -1:
- case 1004:
- case 1015:
- break;
- default:
- if (this.sceneTreeContext && this.sceneTreeContext.getRenderer()) {
- this.sceneTreeContext.getRenderer().makeDirty(this);
- }
- }
- }
- if (invalidateLayout) {
- this.invalidateLayout();
- this.invalidateTransform();
- }
- if (notifyChildren && this.rave_hasChildNodes()) {
- for (var __i_enFor0 = 0, __exp_enFor0 = this.getChildrenArray(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- (child).setDirty(true, false);
- }
- }
- } else {
- this.dirty = false;
- }
- },
- /**
- * Internal API to return raw children nodes collection (including mirrored groups if any). Can return null
- * @return (Array) raw children nodes collection (including mirrored groups if any). Can return null
- */
- getChildrenArray : function() {
- return this.children;
- },
- getShadow : function() {
- return com_ibm_rave_render_internal_style_ShadowStyle.parse(this.rave_getProperty("_rave_drop_shadow"));
- },
- /** @expose */
- rave_addEventListener : function(a0, a1, a2, a3) {
- var args = arguments;
- if (args.length == 2) {
- return this.rave_addEventListener$1(a0, a1);
- }
- if (args.length == 3) {
- return this.rave_addEventListener$2(a0, a1, a2);
- }
- return this.rave_addEventListener$0(a0, a1, a2, a3);
- },
- /** @expose */
- rave_removeEventListener : function(a0, a1) {
- var args = arguments;
- if (args.length == 1) {
- return this.rave_removeEventListener$0(a0);
- }
- return this.rave_removeEventListener$1(a0, a1);
- }
- //paint : function(renderer) {},
- /**
- * Calculate the bounding box based on the currently set attributes.
- */
- //calculateBBox : function() {},
- /**
- * Perform a layout pass on this node.
- */
- //doLayout : function() {}
- });
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.createEventId = function(eventType, group) {
- return eventType + (group != null ? "." + group : "");
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTargets = function(event, targetList, capturing, atTargetPhase) {
- var start = 0, inc = 1, end = targetList.length;
- if (capturing) {
- start = targetList.length - 1;
- inc = end = -1;
- }
- for (var i = start; i != end && !event.propagationStopped && !event.immediatePropagationStopped; i += inc) {
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTarget(event, targetList[i], capturing, atTargetPhase);
- }
- return !event.propagationStopped;
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTarget = function(event, currentTarget, capturing, atTargetPhase) {
- if (currentTarget.listenersByType) {
- var list = currentTarget.listenersByType[event.type];
- if (list) {
- list = list.slice();
- var currentListener = list.length;
- while (--currentListener >= 0) {
- var info = list[currentListener];
- if (!info.isRemoved && (atTargetPhase || info.capture == capturing)) {
- event.currentTarget = currentTarget;
- info.listener.call(currentTarget, event);
- }
- }
- }
- }
- return !event.propagationStopped;
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.ListenerInfo = function(id, type, listener, capture) {
- this.id = id;
- this.type = type;
- this.listener = listener;
- this.capture = capture;
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_PROPERTY_EXT = function(key, value) {
- if ("__rave-mirrored__" == key) {
- (this).invalidateLayout();
- }
- (this).getPropertyBag()[key] = value;
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.REMOVE_PROPERTY_EXT = function(key) {
- delete (this).getPropertyBag()[key];
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.APPEND_CHILD_EXT = function(node) {
- (this).internalAppendChild(node);
- (node).notifyAfterUpdate(1001, 3000, null, null, null);
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.INSERT_BEFORE_EXT = function(node, before) {
- (this).insertChildBefore(node, before);
- (node).notifyAfterUpdate(1001, 3000, null, null, null);
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_NEXT_SIBLING_EXT = function() {
- return (this).getSibling(1);
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_PREVIOUS_SIBLING_EXT = function() {
- return (this).getSibling(-1);
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_FIRST_CHILD = function() {
- var asc = this;
- if (asc.children && asc.children.length > 0) {
- return asc.children[0];
- }
- return asc.getSibling(1);
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.HAS_CHILD_NODES_EXT = function() {
- var asc = this;
- return asc.children && asc.children.length > 0;
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_CHILD_NODES_EXT = function() {
- var asc = this;
- if (!asc.children) {
- asc.createChildren();
- }
- return asc.children;
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.REMOVE_CHILD_EXT = function(node) {
- var asc = this;
- var removed = false;
- var idx = asc.children.indexOf(node);
- if (idx >= 0) {
- removed = true;
- (node).setDirty(true, true);
- asc.children.splice(idx, 1);
- (node).notifyAfterUpdate(1002, 3000, null, null, null);
- node.rave_setParentNode(null);
- }
- return removed;
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.PARENT_NODE_EXT = function() {
- return (this).parent;
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_TEXT_EXT = function(text) {
- (this).setDirty(true, true);
- var oldValue = (this).text;
- var newValue = text == null ? "" : text;
- var copy = [];
- for (var __i_enFor0 = 0, __exp_enFor0 = (this).rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- copy.push(child);
- }
- for (var __i_enFor1 = 0, __exp_enFor1 = copy, __len_enFor1 = __exp_enFor1.length;
- __i_enFor1 < __len_enFor1; ++__i_enFor1) {
- var child = __exp_enFor1[__i_enFor1];
- (this).removeChild(child);
- }
- (this).text = newValue;
- (this).notifyAfterUpdate(1000, 2004, "text", newValue, oldValue);
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_ATTRIBUTE_EXT = function(key, value) {
- if (key != null) {
- var k = key.toLowerCase();
- var acontext = this;
- var oldValue;
- var index = acontext.attributes.getIndex(k);
- switch (index) {
- case 2:
- if (acontext.classList) {
- acontext.classList = null;
- }
- if (value != null) {
- acontext.addClassAndUpdateClassAttr(""+(value), false);
- } else {
- acontext.setDirty(true, false);
- }
- break;
- case 1:
- acontext.styleManager.removeAllInlineStyles();
- var styleSheet = com_ibm_rave_core_internal_css_CSSParser.parse("a{" + ""+(value) + "}");
- for (var __i_enFor0 = 0, __exp_enFor0 = styleSheet.cssRules, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var rule = __exp_enFor0[__i_enFor0];
- var styleDecl = rule.style;
- for (var i = 0; i < styleDecl.length; ++i) {
- var styleName = styleDecl.item(i);
- acontext.rave_setStyle(styleName, styleDecl.getPropertyValue(styleName), styleDecl.getPropertyPriority(styleName));
- }
- }
- break;
- default:
- var styleIndex = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.getIndex(k);
- if (styleIndex >= 0) {
- var style = acontext.styleManager.getStyleByIndex(styleIndex);
- if (!style) {
- acontext.rave_setStyle(k, value, null);
- style = acontext.styleManager.getStyleByIndex(styleIndex);
- if (style) {
- style.fromAttribute = true;
- }
- } else if (style.fromAttribute) {
- acontext.rave_setStyle(k, value, null);
- style.fromAttribute = true;
- }
- } else {
- acontext.setDirty(true, true);
- }
- }
- if (index == -1) {
- oldValue = acontext.attributes.get(k);
- index = acontext.attributes.put(k, value);
- } else {
- oldValue = acontext.attributes.getByIndex(index);
- acontext.attributes.setPropertyValue(index, value);
- }
- acontext.notifyAfterUpdate(1000, 2000, k, value, oldValue);
- }
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_STYLE_EXT = function(styleName, value, priority) {
- (this).styleManager.setStyle(this, styleName, value, priority);
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_CTM_EXT = function() {
- var abstractContext = this;
- if (!abstractContext.cachedCTM) {
- abstractContext.cachedCTM = abstractContext.computeCTM(this, false);
- }
- return abstractContext.cachedCTM;
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_SCREEN_CTM_EXT = function() {
- var abstractContext = this;
- if (!abstractContext.cachedScreenCTM) {
- abstractContext.cachedScreenCTM = abstractContext.computeCTM(this, true);
- }
- return abstractContext.cachedScreenCTM;
- };
- // $source: com/ibm/rave/render/internal/nodes/RectSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
- //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/GeometricHelper (runtime) // new
- /**
- * Rectangle shape.
- */
- var com_ibm_rave_render_internal_nodes_RectSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
- x : 0,
- y : 0,
- width : 0,
- height : 0,
- rx : 0,
- ry : 0,
- calculateBBox : function() {
- return new com_ibm_rave_core_geom_RaveRect(this.x, this.y, this.width, this.height);
- },
- /** @expose */
- rave_getDrawType : function() {
- return 1000;
- },
- /** @expose */
- rave_getName : function() {
- return "rect";
- },
- getX : function() {
- return this.x;
- },
- getY : function() {
- return this.y;
- },
- getWidth : function() {
- return this.width;
- },
- getHeight : function() {
- return this.height;
- },
- getRx : function() {
- return this.rx;
- },
- getRy : function() {
- return this.ry;
- },
- rave_intersects : function(rect) {
- var rx = this.getRx();
- var ry = this.getRy();
- if (rx < 1 && ry < 1) {
- return com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.rave_intersects.call(this, rect);
- }
- var x = this.getX();
- var y = this.getY();
- var w = this.getWidth();
- var h = this.getHeight();
- rx = (rx == 0) ? ry : rx;
- ry = (ry == 0) ? rx : ry;
- if (rx > w / 2) {
- rx = w / 2;
- }
- if (ry > h / 2) {
- ry = h / 2;
- }
- var kappa = 0.5522848;
- var ox = rx * kappa;
- var oy = ry * kappa;
- var xe = x + w;
- var ye = y + h;
- var pathHandler = new com_ibm_rave_render_internal_nodes_GeometricHelper.PathHandler();
- pathHandler.moveTo(x + rx, y);
- pathHandler.lineTo(x + w - rx, y);
- pathHandler.bezierCurveTo(xe - rx + ox, y, xe, y + ry - oy, xe, y + ry);
- pathHandler.lineTo(x + w, y + h - ry);
- pathHandler.bezierCurveTo(xe, ye - ry + oy, xe - rx + ox, ye, xe - rx, ye);
- pathHandler.lineTo(x + rx, y + h);
- pathHandler.bezierCurveTo(x + rx - ox, ye, x, ye - ry + oy, x, ye - ry);
- pathHandler.lineTo(x, y + ry);
- pathHandler.bezierCurveTo(x, y + ry - oy, x + rx - ox, y, x + rx, y);
- pathHandler.closePath();
- var shapes = pathHandler.getShapes();
- return shapes[0].intersect$1(rect) && this.intersectsClip(rect);
- },
- paint : function(renderer) {
- renderer.setStrokeAndFill(this);
- renderer.drawRect(this);
- },
- doLayout : function() {
- this.x = this.rave_getSizePx(this.getComputedCSSStyle(0).value);
- this.y = this.rave_getSizePx(this.getComputedCSSStyle(1).value);
- this.width = this.rave_getSizePx(this.getComputedCSSStyle(2).value);
- this.height = this.rave_getSizePx(this.getComputedCSSStyle(3).value);
- this.rx = this.rave_getSizePx(this.getComputedCSSStyle(12).value);
- this.ry = this.rave_getSizePx(this.getComputedCSSStyle(13).value);
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/properties/DynamicAttributesCollection
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * A representation of a set of attributes on a scene item. Uses a fixed array of 'propertyNames' and 'propertyValues'. The values can be modified, names cannot. This is done for speed because we can access the values by index which is much faster than using a string->object map.
- */
- var com_ibm_rave_render_internal_properties_DynamicAttributesCollection = com_ibm_rave_core_nativeImpl_Declare({
- //propNames : null,
- //propValues : null,
- //dynamicMap : null,
- allowUnknownProperties : true,
- getByIndex : function(i) {
- return this.propValues[i];
- },
- setPropertyValue : function(index, value) {
- this.propValues[index] = value;
- },
- get : function(propName) {
- var i = this.getIndex(propName);
- if (i == -1) {
- return this.allowUnknownProperties && this.dynamicMap ? this.dynamicMap[propName.toLowerCase()] : null;
- }
- return this.propValues[i];
- },
- put : function(propName, value) {
- var i = this.getIndex(propName);
- if (i == -1) {
- if (this.allowUnknownProperties) {
- if (!this.dynamicMap) {
- this.dynamicMap = {};
- }
- this.dynamicMap[propName] = value;
- }
- } else {
- this.setPropertyValue(i, value);
- }
- return i;
- },
- getIndex : function(propName) {
- for (var i = 0, len = this.propNames.length; i < len; ++i) {
- if (this.propNames[i] == propName) {
- return i;
- }
- }
- return -1;
- },
- /**
- * returns how many attributes exist in this attribute collection
- * @return (int) Number of properties in this collection.
- */
- size : function() {
- return this.propNames.length + (!this.allowUnknownProperties || !this.dynamicMap ? 0 : Object.keys(this.dynamicMap).length);
- },
- /**
- * Determine if this collection contains a property with the same name as the passed string The method implementation relies on the fact that string are interned so for example in java do not do containsProperty(new String("key")) performance is very important in this method
- * @param (String) propName property to check
- * @return (boolean) true if there is a property with the same name otherwise false
- */
- containsProperty : function(propName) {
- var props = this.propNames;
- for (var index = 0; index < props.length; ++index) {
- if (props[index] == propName) {
- return true;
- }
- }
- return this.allowUnknownProperties && this.dynamicMap ? this.dynamicMap.hasOwnProperty(propName) : false;
- },
- getKeys : function() {
- var result = [];
- for (var __i_enFor0 = 0, __exp_enFor0 = this.propNames, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var name = __exp_enFor0[__i_enFor0];
- result.push(name);
- }
- if (this.dynamicMap) {
- for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(this.dynamicMap), __len_enFor1 = __exp_enFor1.length;
- __i_enFor1 < __len_enFor1; ++__i_enFor1) {
- var name = __exp_enFor1[__i_enFor1];
- result.push(name);
- }
- }
- return result;
- },
- /**
- * Return a serialized version of all set values in this collection in the form: "key="value" key="value""
- * @return (String) serialized version in the form "key="value" key="value""
- */
- serialize : function() {
- var builder = "";
- for (var __i_enFor0 = 0, __exp_enFor0 = this.getKeys(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var key = __exp_enFor0[__i_enFor0];
- var val = this.get(key);
- if (val != null) {
- builder+=(key + "=\"" + val + "\"" + " ");
- }
- }
- return builder.trim();
- }
- });
- // $source: com/ibm/rave/render/internal/properties/SceneNodeAttributes
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/properties/DynamicAttributesCollection (loadtime) // superclass
- /**
- * A list of public attribute properties for scene nodes. Typically only used by renderers for quick access to properties.
- */
- var com_ibm_rave_render_internal_properties_SceneNodeAttributes = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_properties_DynamicAttributesCollection, {
- constructor : function() {
- this.propNames = com_ibm_rave_render_internal_properties_SceneNodeAttributes.propertyNames;
- this.propValues = [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null];
- }
- });
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.id = 0;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.style = 1;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.class_attr = 2;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.transform = 3;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.clip_path = 4;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.x = 5;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.y = 6;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.width = 7;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.height = 8;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.x1 = 9;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.x2 = 10;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.r = 11;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.y1 = 12;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.y2 = 13;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.cx = 14;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.cy = 15;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.d = 16;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.points = 17;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.propertyNames = ["id", "style", "class", "transform", "clip-path", "x", "y", "width", "height", "x1", "x2", "r", "y1", "y2", "cx", "cy", "d", "points"];
- // $source: com/ibm/rave/render/internal/style/ShorthandStyle
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * Abstract class describing a shorthand style definition. Basically just a set of key/value pairs that describe each piece of a shorthand property. For instance, the "font" style is a shorthanded way of defining "font-size", "font-weight", "font-family", etc.
- */
- var com_ibm_rave_render_internal_style_ShorthandStyle = com_ibm_rave_core_nativeImpl_Declare({
- //getKeys : function() {},
- //getValue : function(key) {}
- });
- // $source: com/ibm/rave/render/internal/style/FontStyle
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/style/ShorthandStyle (loadtime) // superclass
- //@import com/ibm/rave/core/internal/css/CSSUtil (runtime) // parseFont, parseWeight, parseSize, parseFontFamily
- /**
- * <p> Represents CSS font information. Properties are: </p> <dl> <dt><code>font-size</code></dt> <dd>A CSSSize with numeric value ( {@link #this.getSize()} ) and unit ( {@link #this.getUnit()} ).</dd> <dt><code>font-family</code></dt> <dd>A string ( {@link #this.getFamily()} ). The family is a comma-separated list of family names. The names in the input list may be quoted. The stored names are all quoted, using double-quotes if the original was not quoted. </dd> <dt><code>font-style</code></dt> <dd>A string ( {@link #this.getStyle()} ). Supported values are "normal", "oblique", or "italic".</dd> <dt><code>font-weight</code></dt> <dd>A string ( {@link #this.getWeight()} ). Supported values are "normal", "bold", "bolder", "lighter", or a multiple of 100 between 100 and 900 inclusive.</dd> <dt><code>font-variant</code></dt> <dd>A string ( {@link #this.getFontVariant()} ). Supported values are "normal", "small-caps".</dd> <dt>lineHeight</dt> <dd>A string ( {@link #this.getLineHeightAsString()} ), only available by the {@link #this.toString()} method.</dd> </dl>
- */
- var com_ibm_rave_render_internal_style_FontStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_ShorthandStyle, {
- //values : null,
- //style : null,
- //size : null,
- //family : null,
- //lineHeight : null,
- //weight : null,
- //variant : null,
- constructor : function(style, family, size, weight, lineHeight, variant) {
- this.values = [];
- /**
- * A class that holds font styling information. Typically used only by external renderers but still needs to be public. This class is not responsible for ensuring the local system supports any or all font information.
- * @param (String) style The style in which the font is displayed. Valid values are "normal", "italic", "oblique".
- * @param (String) family The font face to display the font in. Must be a valid system/web font. Default depends on the renderer and system.
- * @param (com.ibm.rave.core.css.CSSSize) size The font size in 'unit' measurements.
- * @param (String) weight The 'boldness' of a font. Similar to a CSS font-weight value. Weights are interpolated over a range of 0-900 with steps of 100. Each step is more bold than the last, providing the font supports different weight values. For fonts that only support "normal" and "bold" 100-500 is normal and 600-900 is bold.
- * @param (String) lineHeight A string describing the height of each line of this font.
- * @param (String) variant The variant type of this font. Only options are "normal" or "small-caps".
- */
- {
- var _style = style;
- var _family = com_ibm_rave_core_internal_css_CSSUtil.parseFontFamily(family);
- var _variant = variant;
- if (_style == null) {
- _style = "";
- }
- this.values.push(_style);
- this.style = _style;
- this.values.push(size);
- this.size = size;
- if (_family == null) {
- _family = "";
- }
- this.values.push(_family);
- this.family = _family;
- this.weight = weight;
- this.values.push(this.weight);
- if (_variant == null) {
- _variant = "";
- }
- this.values.push(_variant);
- this.variant = _variant;
- this.values.push(lineHeight);
- this.lineHeight = lineHeight;
- }
- },
- /**
- * Return the 'style' of this font. Valid current values are "normal", "italic", "oblique".
- * @return (String) style of this font. ("normal", "italic", "oblique").
- */
- getStyle : function() {
- return this.style;
- },
- /**
- * Returns the current size of the font in the set unit.
- * @return (double) The size of the font in the current unit measurement.
- */
- getSize : function() {
- return this.size.value;
- },
- /**
- * Return the unit type set for this style.
- * @return (com.ibm.rave.core.css.CSSUnit) a {@link (com.ibm.rave.core.css.CSSUnit) CSSUnit}
- */
- getUnit : function() {
- return this.size.unit;
- },
- /**
- * @return (com.ibm.rave.core.css.CSSSize) The {@link (com.ibm.rave.core.css.CSSSize) CSSSize} of this font, with size and unit
- */
- getCSSSize : function() {
- return this.size;
- },
- /**
- * Return the set font family as a simple string. Typically follows CSS-style format (comma separated list). This class is not responsible for ensuring the local system supports any or all font family information.
- * @return (String) Font family as a comma separated (CSS-style) list.
- */
- getFamily : function() {
- return this.family;
- },
- /**
- * Return the weight type set for this style.
- * @return (String) String representing the font weight style.
- */
- getWeight : function() {
- return this.weight;
- },
- getLineHeightAsString : function() {
- if (this.lineHeight == null) {
- return "normal";
- }
- return this.lineHeight;
- },
- /**
- * Return the variant definition of this font style.
- * @return (String) font variant. Current values are "normal" or "small-caps".
- */
- getFontVariant : function() {
- return this.variant;
- },
- /**
- * Return the shorthand font CSS property of this style.
- */
- toString : function() {
- var str = this.style + " " + this.variant + " " + this.weight + " " + (~~this.getSize()) + this.getUnit() + "/" + this.getLineHeightAsString() + " " + this.family;
- return str.trim();
- },
- getKeys : function() {
- return com_ibm_rave_render_internal_style_FontStyle.keys;
- },
- getValue : function(key) {
- var i = com_ibm_rave_render_internal_style_FontStyle.keys.indexOf(key);
- if (i > -1) {
- return this.values[i];
- }
- return null;
- }
- });
- /**
- * Parse a shorthand font per the rules defined by <a href="https ://developer.mozilla.org/en/docs/Web/CSS/font">W3 CSS</a>. <p> <code>[ [ <'font-style'> || <font-variant-css21> || <'font-weight'> || <'font-stretch'> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] | caption | icon | menu | message-box | small-caption | status-bar where <font-variant-css21> = [ normal | small-caps ] </code>
- * @param (Object) value Font CSS style rule text.
- * @return (com.ibm.rave.render.internal.style.FontStyle) TextStyle representing font. Returns null if invalid specification (missing size or family, or invalid weight number)
- */
- com_ibm_rave_render_internal_style_FontStyle.parseFont = function(value) {
- var parsed = com_ibm_rave_core_internal_css_CSSUtil.parseFont(value);
- var _size = com_ibm_rave_core_internal_css_CSSUtil.parseSize(parsed[3]);
- var _weight = com_ibm_rave_core_internal_css_CSSUtil.parseWeight(parsed[2]);
- var _family = parsed[5];
- if (!_size || _family == null || _weight == null) {
- return null;
- }
- return new com_ibm_rave_render_internal_style_FontStyle(parsed[0], _family, _size, _weight, parsed[4], parsed[1]);
- };
- com_ibm_rave_render_internal_style_FontStyle.keys = ["font-style", "font-size", "font-family", "font-weight", "font-variant", "line-height"];
- // $source: com/ibm/rave/render/internal/style/AbstractStyle
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/core/Rave (runtime) // rgba
- /**
- * An abstract implementation of a style. Includes things typically required in a style class like color, opacity, etc.
- */
- var com_ibm_rave_render_internal_style_AbstractStyle = com_ibm_rave_core_nativeImpl_Declare({
- opacity : 1,
- /**
- * Return opacity of this styled object between 0-1. 0 means fully transparent. 1 means fully opaque.
- * @return (double) opacity of this style between 0-1.
- */
- getOpacity : function() {
- return this.opacity;
- },
- /**
- * Set opacity of this styled object between 0-1. 0 means fully transparent. 1 means fully opaque.
- * @param (double) opacity Opacity to set.
- */
- setOpacity : function(opacity) {
- this.opacity = opacity;
- },
- /**
- * Does this style produce a style that is visible and should be drawn.
- * @return (boolean) <code>true</code> if this style is visible <code>false</code> otherwise.
- */
- isVisible : function() {
- return this.opacity > 0;
- },
- calculateColorWithOpacity : function() {
- var color = this.getColor();
- return com_ibm_rave_core_Rave.rgba(color.r, color.g, color.b, color.a * this.opacity);
- }
- /**
- * Returns the type of style.
- * @return (int) enum value from StyleTypes
- * @see (com.ibm.rave.render.internal.style.StyleTypes) StyleTypes
- */
- //getType : function() {},
- /**
- * Some styles have a default color.
- * @return (com.ibm.rave.core.color.RGB) Color object for this style, this takes opacity and fill-opacity into account. May return null.
- */
- //getColor : function() {}
- });
- // $source: com/ibm/rave/render/internal/style/ShadowStyle
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/style/AbstractStyle (loadtime) // superclass
- //@import com/ibm/rave/core/internal/css/CSSUtil (runtime) // parseShadowStyle
- /**
- * [offset_x offset_y blur-radius color] | none | initial | inherit
- */
- var com_ibm_rave_render_internal_style_ShadowStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_AbstractStyle, {
- //offset_x : null,
- //offset_y : null,
- //blur_radius : null,
- //color : null,
- constructor : function(h_shadow, v_shadow, blur_radius, color) {
- this.offset_x = h_shadow;
- this.offset_y = v_shadow;
- this.blur_radius = blur_radius;
- this.color = color;
- },
- getType : function() {
- return 1004;
- },
- getColor : function() {
- return this.color;
- }
- });
- /**
- * Parse a shorthand font per the rules defined by <a href="https ://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow">W3 CSS</a>. offset_x offset_y blur-radius color| none | initial | inherit
- * @param (Object) value shadow CSS style rule text.
- * @return (com.ibm.rave.render.internal.style.ShadowStyle) ShadowStyle representing text shadow. Returns null if invalid specification
- */
- com_ibm_rave_render_internal_style_ShadowStyle.parse = function(value) {
- var style = com_ibm_rave_core_internal_css_CSSUtil.parseShadowStyle(value);
- if (!style) {
- return null;
- }
- return new com_ibm_rave_render_internal_style_ShadowStyle(style[0], style[1], style[2], style[3]);
- };
- // $source: com/ibm/rave/render/internal/DefaultStyleValueConverter
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/core/internal/css/CSSTransformParser (static) // parse
- //@import com/ibm/rave/core/internal/css/CSSUtil (static) // parseIdUrlLink, parseWeight, parseSize, parseDashArray, parseFontFamily
- //@import com/ibm/rave/core/internal/css/CSSConstants (static) // CSSConstants
- //@import com/ibm/rave/core/Rave (static) // rgb
- //@import com/ibm/rave/render/internal/style/FontStyle (static) // parseFont
- //@import com/ibm/rave/render/internal/style/ShadowStyle (static) // parse
- /**
- * Converts style values into generic objects.
- */
- var com_ibm_rave_render_internal_DefaultStyleValueConverter = com_ibm_rave_core_nativeImpl_Declare({
- });
- com_ibm_rave_render_internal_DefaultStyleValueConverter.convert = function(index, styleName, value) {
- switch (index) {
- case 11:
- return com_ibm_rave_core_internal_css_CSSTransformParser.parse(""+(value));
- case 38:
- case 30:
- case 32:
- case 33:
- case 41:
- return + (value);
- case 35:
- case 31:
- case 0:
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- case 16:
- case 15:
- case 9:
- case 10:
- case 22:
- case 12:
- case 13:
- case 17:
- case 18:
- case 19:
- return com_ibm_rave_core_internal_css_CSSUtil.parseSize(value);
- case 14:
- if (value == null) {
- return "normal";
- }
- var _value = ""+(value);
- _value = _value.trim();
- if ("normal" == _value) {
- return "normal";
- }
- return com_ibm_rave_core_internal_css_CSSUtil.parseSize(value).toString();
- case 34:
- return com_ibm_rave_core_internal_css_CSSUtil.parseDashArray(value.toString());
- case 28:
- var link = com_ibm_rave_core_internal_css_CSSUtil.parseIdUrlLink(value);
- if (link != null) {
- return value;
- }
- case 29:
- return com_ibm_rave_core_internal_css_CSSConstants.TRANSPARENT == value.toString().toLowerCase() || "none" == value.toString().toLowerCase() ? "none" : com_ibm_rave_core_Rave.rgb(value);
- case 24:
- return com_ibm_rave_core_internal_css_CSSUtil.parseWeight(value);
- case 44:
- return com_ibm_rave_core_internal_css_CSSUtil.parseIdUrlLink(value);
- case 20:
- return com_ibm_rave_render_internal_style_FontStyle.parseFont(value);
- case 21:
- return com_ibm_rave_core_internal_css_CSSUtil.parseFontFamily(value);
- case 46:
- return com_ibm_rave_render_internal_style_ShadowStyle.parse(value);
- default:
- return value;
- }
- };
- // $source: com/ibm/rave/render/internal/properties/SceneNodeDefaultStyles
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/core/internal/css/CSSStyle (static) // new
- //@import com/ibm/rave/render/internal/DefaultStyleValueConverter (static) // convert
- //@import com/ibm/rave/render/internal/properties/SceneNodeStyles (static) // SceneNodeStyles
- /**
- * Helper class for creating default style objects for nodes.
- */
- var com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles = com_ibm_rave_core_nativeImpl_Declare({
- });
- com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createCSSStyle = function(id, name) {
- return new com_ibm_rave_core_internal_css_CSSStyle(id, name, com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.defaultStyles[id].inheritable);
- };
- com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle = function(id, name, value, inheritable) {
- var style = new com_ibm_rave_core_internal_css_CSSStyle(id, name, inheritable);
- style.value = com_ibm_rave_render_internal_DefaultStyleValueConverter.convert(id, name, value);
- style.rawValue = value.toString();
- return style;
- };
- /**
- * Return the index of the passed style name from the list of default styles. Used to map into our maps of styles which should all share the same indexing.
- * @param (String) styleName The name of the style to get the index of. (ie - "fill")
- * @return (int) Index of this style in our default map.
- */
- com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.getIndex = function(styleName) {
- return com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames.indexOf(styleName);
- };
- com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createDefaults = function() {
- var styles = [];
- styles[46] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(46, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[46], "none", true);
- styles[28] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(28, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[28], "#000000", true);
- styles[29] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(29, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[29], "none", true);
- styles[30] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(30, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[30], 1.0, false);
- styles[31] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(31, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[31], "1px", true);
- styles[32] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(32, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[32], 1, true);
- styles[33] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(33, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[33], 1.0, true);
- styles[26] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(26, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[26], "block", false);
- styles[21] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(21, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[21], "serif", true);
- styles[22] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(22, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[22], "16px", true);
- styles[23] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(23, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[23], "normal", true);
- styles[24] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(24, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[24], "normal", true);
- styles[25] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(25, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[25], "normal", true);
- styles[34] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(34, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[34], "none", true);
- styles[35] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(35, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[35], 0, true);
- styles[36] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(36, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[36], "butt", true);
- styles[37] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(37, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[37], "miter", true);
- styles[38] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(38, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[38], 4, true);
- styles[27] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(27, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[27], "start", true);
- styles[39] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(39, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[39], "none", false);
- styles[45] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(45, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[45], "visible", true);
- styles[40] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(40, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[40], "#000000", false);
- styles[41] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(41, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[41], 1.0, false);
- styles[42] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(42, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[42], "auto", true);
- styles[43] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(43, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[43], "auto", true);
- styles[20] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(20, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[20], "normal normal normal 16/normal serif", true);
- styles[47] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(47, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[47], "auto", true);
- styles[0] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(0, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[0], "", false);
- styles[1] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(1, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[1], "", false);
- styles[2] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(2, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[2], "", false);
- styles[3] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(3, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[3], "", false);
- styles[4] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(4, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[4], "", false);
- styles[5] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(5, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[5], "", false);
- styles[6] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(6, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[6], "", false);
- styles[7] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(7, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[7], "", false);
- styles[8] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(8, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[8], "", false);
- styles[9] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(9, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[9], "", false);
- styles[10] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(10, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[10], "", false);
- styles[11] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(11, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[11], "", false);
- styles[12] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(12, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[12], "", false);
- styles[13] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(13, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[13], "", false);
- styles[44] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(44, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[44], "", false);
- styles[14] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(14, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[14], "normal", true);
- styles[15] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(15, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[15], "", false);
- styles[16] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(16, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[16], "", false);
- styles[17] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(17, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[17], "", false);
- styles[18] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(18, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[18], "", false);
- styles[19] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(19, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[19], "", false);
- return styles;
- };
- com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.defaultStyles = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createDefaults();
- // $source: com/ibm/rave/render/internal/nodes/SceneNodeStyleManager
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/properties/SceneNodeStyles (runtime) // SceneNodeStyles, isLayoutStyle
- //@import com/ibm/rave/render/internal/properties/SceneNodeDefaultStyles (runtime) // SceneNodeDefaultStyles, getIndex, createCSSStyle
- //@import com/ibm/rave/render/internal/css/collector/CSSStyleRuleCollector (runtime) // collectAll
- //@import com/ibm/rave/render/internal/DefaultStyleValueConverter (runtime) // convert
- //@import com/ibm/rave/render/internal/style/ShorthandStyle (runtime) // new
- //@import com/ibm/rave/core/internal/css/CSSStyle (static) // new
- /**
- * A class for helping scene nodes keep track of styling information.
- */
- var com_ibm_rave_render_internal_nodes_SceneNodeStyleManager = com_ibm_rave_core_nativeImpl_Declare({
- //changedStyles : null,
- //importantChangedStyles : null,
- //computedStyles : null,
- //styles : null,
- //node : null,
- invalidStyles : true,
- dirtyExternalStyles : true,
- dirtyInlineStyles : true,
- constructor : function(abstractSceneNode) {
- this.computedStyles = {};
- this.styles = {};
- {
- this.node = abstractSceneNode;
- }
- },
- updateStyle : function(style, index, important, newValue, rawValue, name) {
- this.styles[index] = style;
- this.dirtyInlineStyles = true;
- if (important) {
- if (!this.importantChangedStyles) {
- this.importantChangedStyles = {};
- }
- this.importantChangedStyles[index] = style;
- if (this.changedStyles) {
- delete this.changedStyles[index];
- }
- } else {
- if (!this.changedStyles) {
- this.changedStyles = {};
- }
- this.changedStyles[index] = style;
- if (this.importantChangedStyles) {
- delete this.importantChangedStyles[index];
- }
- }
- if (style) {
- style.value = newValue;
- style.rawValue = rawValue;
- style.important = important;
- style.fromAttribute = false;
- } else {
- this.dirtyExternalStyles = true;
- }
- this.node.setDirty(true, com_ibm_rave_render_internal_properties_SceneNodeStyles.isLayoutStyle(index));
- var oldValue = (style ? style.value : null);
- this.node.notifyAfterUpdate(1000, 2002, name, newValue, oldValue);
- },
- computeStyles : function() {
- if (this.dirtyInlineStyles || this.dirtyExternalStyles || this.invalidStyles) {
- var inheritableStyleChanges = null;
- if (this.dirtyInlineStyles) {
- if (this.importantChangedStyles) {
- for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.importantChangedStyles), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var key = __exp_enFor0[__i_enFor0];
- var style = this.importantChangedStyles[key];
- var styleId = style.id;
- var cstyle = this.computedStyles[styleId];
- if (!cstyle || cstyle == com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE || cstyle.owner != this.node) {
- cstyle = style;
- this.computedStyles[cstyle.id] = style;
- }
- if (this.node.rave_hasChildNodes() && cstyle.inheritable) {
- if (!inheritableStyleChanges) {
- inheritableStyleChanges = [];
- }
- inheritableStyleChanges.push(styleId);
- }
- }
- this.importantChangedStyles = null;
- }
- if (this.changedStyles) {
- for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(this.changedStyles), __len_enFor1 = __exp_enFor1.length;
- __i_enFor1 < __len_enFor1; ++__i_enFor1) {
- var key = __exp_enFor1[__i_enFor1];
- var style = this.changedStyles[key];
- var styleId = key;
- var cstyle = this.computedStyles[styleId];
- if (cstyle && cstyle.important) {
- continue;
- }
- if (!style) {
- if (cstyle && cstyle.owner == this.node) {
- this.computedStyles[styleId] = com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE;
- if (this.node.rave_hasChildNodes() && cstyle.inheritable) {
- if (!inheritableStyleChanges) {
- inheritableStyleChanges = [];
- }
- inheritableStyleChanges.push(styleId);
- }
- cstyle = null;
- this.invalidStyles = true;
- }
- } else if (!cstyle || cstyle == com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE || cstyle.owner != this.node) {
- cstyle = style;
- this.computedStyles[styleId] = cstyle;
- if (this.node.rave_hasChildNodes() && cstyle.inheritable) {
- if (!inheritableStyleChanges) {
- inheritableStyleChanges = [];
- }
- inheritableStyleChanges.push(styleId);
- }
- }
- }
- this.changedStyles = null;
- }
- }
- if (this.dirtyExternalStyles || this.invalidStyles) {
- var externalStyles = null;
- var parentNode = this.node.rave_getParentNode();
- for (var i = 0, len = com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames.length; i < len; ++i) {
- var style = this.computedStyles[i];
- if (style && style == com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE && this.node.rave_hasChildNodes() && style.inheritable) {
- if (!inheritableStyleChanges) {
- inheritableStyleChanges = [];
- }
- inheritableStyleChanges.push(i);
- }
- if (this.dirtyExternalStyles) {
- if (!externalStyles) {
- externalStyles = this.getExternalStyles();
- }
- if (externalStyles.length > 0 && externalStyles[i]) {
- if (externalStyles[i].important || !style || style == com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE || style.owner != this.node || style.fromAttribute) {
- style = externalStyles[i];
- this.computedStyles[i] = style;
- }
- } else if (style && style.owner == com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.EXTERNAL_STYLE_OWNER) {
- style = null;
- this.computedStyles[i] = style;
- }
- }
- if (!style || style == com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE) {
- style = null;
- if (parentNode && com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.defaultStyles[i].inheritable && parentNode.rave_getDrawType() != -1) {
- style = parentNode.getComputedCSSStyle(i);
- }
- }
- if (!style) {
- style = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.defaultStyles[i];
- }
- this.computedStyles[i] = style;
- }
- this.invalidStyles = false;
- }
- if (inheritableStyleChanges) {
- for (var __i_enFor2 = 0, __exp_enFor2 = this.node.getChildrenArray(), __len_enFor2 = __exp_enFor2.length;
- __i_enFor2 < __len_enFor2; ++__i_enFor2) {
- var child = __exp_enFor2[__i_enFor2];
- var achild = child;
- for (var __i_enFor3 = 0, __exp_enFor3 = inheritableStyleChanges, __len_enFor3 = __exp_enFor3.length;
- __i_enFor3 < __len_enFor3; ++__i_enFor3) {
- var key = __exp_enFor3[__i_enFor3];
- var childStyle = achild.styleManager.computedStyles[key];
- if (childStyle && childStyle.owner != child && childStyle.owner != com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.EXTERNAL_STYLE_OWNER) {
- achild.styleManager.computedStyles[key] = com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE;
- achild.styleManager.dirtyInlineStyles = true;
- achild.styleManager.invalidStyles = true;
- }
- }
- }
- }
- this.dirtyInlineStyles = false;
- this.dirtyExternalStyles = false;
- }
- },
- /**
- * Returns a style structure with all applicable external styles. Mimics the same array and index of SceneNodeStyles.
- * @return (com.ibm.rave.core.internal.css.CSSStyle[]) an array of applicable external styles.
- */
- getExternalStyles : function() {
- var styleValues;
- var rules = com_ibm_rave_render_internal_css_collector_CSSStyleRuleCollector.collectAll(this.node);
- if (rules.length > 0) {
- styleValues = [];
- for (var __i_enFor0 = 0, __exp_enFor0 = rules, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var rule = __exp_enFor0[__i_enFor0];
- var style = rule.style;
- for (var i = 0, len = style.length; i < len; ++i) {
- var item = style.item(i);
- this.updateExternalStyle(item, styleValues, style.getPropertyValue(item), "important" == style.getPropertyPriority(item));
- }
- }
- } else {
- styleValues = [];
- }
- return styleValues;
- },
- updateExternalStyle : function(item, styleValues, value1, isImportant) {
- var id = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.getIndex(item);
- if (id != -1) {
- var existingStyle = styleValues[id];
- if (!existingStyle || (isImportant && !existingStyle.important)) {
- var value = com_ibm_rave_render_internal_DefaultStyleValueConverter.convert(id, item, value1);
- if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(value, com_ibm_rave_render_internal_style_ShorthandStyle)) {
- for (var __i_enFor0 = 0, __exp_enFor0 = (value).getKeys(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var key = __exp_enFor0[__i_enFor0];
- this.updateExternalStyle(key, styleValues, (value).getValue(key), isImportant);
- }
- }
- if (value != null) {
- styleValues[id] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createCSSStyle(id, item);
- styleValues[id].owner = com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.EXTERNAL_STYLE_OWNER;
- styleValues[id].value = value;
- styleValues[id].rawValue = value.toString();
- styleValues[id].important = isImportant;
- }
- }
- }
- },
- /**
- * Remove all inline styles from this node's styles.
- */
- removeAllInlineStyles : function() {
- for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.styles), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var key = __exp_enFor0[__i_enFor0];
- if (this.styles[key]) {
- this.node.rave_removeStyle(com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[key]);
- }
- }
- },
- /**
- * @param (String) styleName
- */
- removeStyle : function(styleName) {
- if (styleName != null) {
- var name = styleName.toLowerCase();
- var idx = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.getIndex(styleName);
- var style = this.styles[idx];
- if (style) {
- var hasNewStyle = false;
- if (!style.fromAttribute) {
- var attrValue = this.node.attributes.get(styleName);
- if (attrValue != null) {
- var newValue = com_ibm_rave_render_internal_DefaultStyleValueConverter.convert(idx, name, attrValue);
- if (newValue != null) {
- style.value = newValue;
- style.rawValue = newValue.toString();
- style.fromAttribute = true;
- style.important = false;
- hasNewStyle = true;
- }
- }
- }
- if (!hasNewStyle) {
- this.updateStyle(null, idx, false, null, null, name);
- if (this.importantChangedStyles) {
- delete this.importantChangedStyles[idx];
- }
- }
- }
- }
- },
- setStyle : function(context, styleName, value, priority) {
- if (styleName != null) {
- if (value == null) {
- this.removeStyle(styleName);
- } else {
- var acontext = context;
- var name = styleName.toLowerCase();
- var index = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.getIndex(name);
- if (index >= 0) {
- var oldCssStyle = acontext.styleManager.getComputedCSSStyle(index);
- if (!oldCssStyle || !(value===oldCssStyle.rawValue)) {
- var newValue = com_ibm_rave_render_internal_DefaultStyleValueConverter.convert(index, name, value);
- if (newValue != null) {
- var important = priority != null && "important" == priority.toLowerCase();
- if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(newValue, com_ibm_rave_render_internal_style_ShorthandStyle)) {
- for (var __i_enFor0 = 0, __exp_enFor0 = (newValue).getKeys(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var key = __exp_enFor0[__i_enFor0];
- acontext.rave_setStyle(key, (newValue).getValue(key), priority);
- }
- }
- var style = this.styles[index];
- if (!style) {
- style = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createCSSStyle(index, name);
- style.owner = acontext;
- }
- this.updateStyle(style, index, important, newValue, value, name);
- }
- }
- }
- }
- }
- },
- getComputedStyleValue : function(id) {
- var style = this.getComputedCSSStyle(id);
- return !style ? null : style.value;
- },
- getComputedCSSStyle : function(id) {
- return this.computedStyles[id];
- },
- setDirtyExternalStyles : function(dirtyExternalStyles) {
- this.dirtyExternalStyles = dirtyExternalStyles;
- },
- getStyleByName : function(styleName) {
- return this.getStyleByIndex(com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.getIndex(styleName));
- },
- getStyleByIndex : function(styleIndex) {
- return this.styles[styleIndex];
- },
- isVisible : function() {
- return !("hidden" == this.getComputedStyleValue(45));
- },
- serialize : function() {
- var result = [];
- for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.styles), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var index = __exp_enFor0[__i_enFor0];
- var val = this.styles[index];
- if (val) {
- result.push(val.name + ":" + val.value + ";");
- }
- }
- var str = "";
- if (result.length > 0) {
- str = "style=\"" + result.join(" ") + "\"";
- }
- return str;
- }
- });
- com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.EXTERNAL_STYLE_OWNER = {};
- com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE = new com_ibm_rave_core_internal_css_CSSStyle(-1, null, true);
- // $source: com/ibm/rave/render/internal/css/collector/CSSStyleRuleCollector
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/core/Rave (runtime) // Rave
- //@import com/ibm/rave/core/internal/css/CSSStyleSheetManager (runtime) // CSSStyleSheetManager
- /**
- * Responsible for collecting external stylesheet rules that apply to a particular SceneNode. Orders these results based on results from CSSStyleSheetManager based on specificity.
- */
- var com_ibm_rave_render_internal_css_collector_CSSStyleRuleCollector = com_ibm_rave_core_nativeImpl_Declare({
- });
- /**
- * Returns a list of matching external CSS rules for a scene node. Note that this method does not take internal styles into account at all - it matches only external styles to scene nodes. This list is sorted by most significant style specificity to lowest.
- * @param (com.ibm.rave.render.internal.nodes.AbstractSceneNode) node Scene node
- * @return (Array) List of matching CSSStyleRules.
- */
- com_ibm_rave_render_internal_css_collector_CSSStyleRuleCollector.collectAll = function(node) {
- var matches = [];
- var selectorCache = {};
- var engine = com_ibm_rave_core_Rave.configuration.getQueryEngine(null);
- if (engine) {
- for (var __i_enFor0 = 0, __exp_enFor0 = com_ibm_rave_render_internal_css_collector_CSSStyleRuleCollector.getPotentialMatches(node), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var potentialMatch = __exp_enFor0[__i_enFor0];
- var selectorText = potentialMatch.selectorText;
- if (!(selectorCache.hasOwnProperty(selectorText))) {
- if (engine.matches(node, selectorText)) {
- matches.push(potentialMatch);
- }
- selectorCache[selectorText] = 1;
- }
- }
- }
- return matches;
- };
- com_ibm_rave_render_internal_css_collector_CSSStyleRuleCollector.getPotentialMatches = function(node) {
- var manager = com_ibm_rave_core_internal_css_CSSStyleSheetManager.INSTANCE;
- var potentialMatches = [];
- var id = node.getId();
- if (id != null) {
- var rules = manager.getPotentialMatchesById("#" + id);
- if (rules) {
- for (var __i_enFor0 = 0, __exp_enFor0 = rules, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var rule = __exp_enFor0[__i_enFor0];
- potentialMatches.push(rule);
- }
- }
- }
- var classes = node.getClassList();
- for (var __i_enFor1 = 0, __exp_enFor1 = classes, __len_enFor1 = __exp_enFor1.length;
- __i_enFor1 < __len_enFor1; ++__i_enFor1) {
- var className = __exp_enFor1[__i_enFor1];
- if (className != null) {
- var rules = manager.getPotentialMatchesByClass("." + className);
- if (rules) {
- for (var __i_enFor2 = 0, __exp_enFor2 = rules, __len_enFor2 = __exp_enFor2.length;
- __i_enFor2 < __len_enFor2; ++__i_enFor2) {
- var rule = __exp_enFor2[__i_enFor2];
- potentialMatches.push(rule);
- }
- }
- }
- }
- var tag = node.rave_getName();
- if (tag != null) {
- var rules = manager.getPotentialMatchesByTag(tag);
- if (rules) {
- for (var __i_enFor3 = 0, __exp_enFor3 = rules, __len_enFor3 = __exp_enFor3.length;
- __i_enFor3 < __len_enFor3; ++__i_enFor3) {
- var rule = __exp_enFor3[__i_enFor3];
- potentialMatches.push(rule);
- }
- }
- }
- return potentialMatches;
- };
- // $source: com/ibm/rave/core/internal/css/CSSStyleSheetManager
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/core/internal/css/CSSParser (runtime) // splitSelectorText, deconstructSelectorText
- /**
- * This class is responsible for maintaining the state of all external stylesheets. It accepts parsed stylesheets and caches them based on selector.
- */
- var com_ibm_rave_core_internal_css_CSSStyleSheetManager = com_ibm_rave_core_nativeImpl_Declare({
- //idToStyleRules : null,
- //classToStyleRules : null,
- //tagToStyleRules : null,
- //allMaps : null,
- constructor : function() {
- this.allMaps = [];
- {
- this.initialize();
- }
- },
- /**
- * Add a CSSStyleSheet's rule list to our cached internal set of style rules. These can be used later to style scene nodes.
- * @param (com.ibm.rave.core.css.CSSStyleSheet) stylesheet CSSStyleSheet object parsed from CSS text.
- */
- add : function(stylesheet) {
- for (var __i_enFor0 = 0, __exp_enFor0 = stylesheet.cssRules, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var rule = __exp_enFor0[__i_enFor0];
- if (rule.selectorText != null) {
- this.addToCache(rule);
- }
- }
- },
- initialize : function() {
- this.idToStyleRules = {};
- this.classToStyleRules = {};
- this.tagToStyleRules = {};
- this.allMaps.length = 0;
- this.allMaps.push(this.idToStyleRules);
- this.allMaps.push(this.classToStyleRules);
- this.allMaps.push(this.tagToStyleRules);
- },
- /**
- * Clears all StyleSheets from cache.
- */
- clear : function() {
- this.initialize();
- },
- /**
- * For 'className', return all CSSStyleRules that may potentially match. The className must contain a leading ".".
- * @param (String) className Class name to check for potential matching CSSRules. Must contain a leading ".".
- * @return (Array) List of potential CSSStyleRule matches for this class. Returns null if no match found.
- */
- getPotentialMatchesByClass : function(className) {
- return this.classToStyleRules[className];
- },
- /**
- * For 'id', return all CSSStyleRules that may potentially match. The id must contain a leading "#".
- * @param (String) id id name to check for potential matching CSSRules. Must contain a leading "#".
- * @return (Array) List of potential CSSStyleRule matches for this id. Returns null if no match found.
- */
- getPotentialMatchesById : function(id) {
- return this.idToStyleRules[id];
- },
- /**
- * For node 'tag' name, return all CSSStyleRules that may potentially match.
- * @param (String) tag tag name to check for potential matching CSSRules.
- * @return (Array) List of potential CSSStyleRule matches for this id. Returns null if no match found.
- */
- getPotentialMatchesByTag : function(tag) {
- return this.tagToStyleRules[tag];
- },
- addToCache : function(styleRule) {
- for (var __i_enFor0 = 0, __exp_enFor0 = com_ibm_rave_core_internal_css_CSSParser.splitSelectorText(styleRule.selectorText), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var selector = __exp_enFor0[__i_enFor0];
- var parts = com_ibm_rave_core_internal_css_CSSParser.deconstructSelectorText(selector);
- var dominant = parts[parts.length - 1];
- var matches = com_ibm_rave_core_internal_css_CSSStyleSheetManager.splitSelectorTextByTypes(dominant);
- for (var __i_enFor1 = 0, __len_enFor1 = matches.length;
- __i_enFor1 < __len_enFor1; ++__i_enFor1) {
- var match = matches[__i_enFor1];
- if (match.length == 0) {
- continue;
- }
- var matchingMap = null;
- switch (com_ibm_rave_core_internal_css_CSSStyleSheetManager.determineSelectorType(match)) {
- case 3:
- matchingMap = this.tagToStyleRules;
- break;
- case 2:
- matchingMap = this.idToStyleRules;
- break;
- case 1:
- matchingMap = this.classToStyleRules;
- break;
- case -1:
- default:
- break;
- }
- if (matchingMap) {
- var rules = matchingMap[match];
- var insertIndex = 0;
- if (!rules) {
- rules = [];
- matchingMap[match] = rules;
- } else {
- for (var i = 0; i < rules.length; ++i) {
- var existingRule = rules[i];
- if (com_ibm_rave_core_internal_css_CSSStyleSheetManager.determineSpecificity(styleRule) >= com_ibm_rave_core_internal_css_CSSStyleSheetManager.determineSpecificity(existingRule)) {
- break;
- }
- insertIndex++;
- }
- }
- rules.splice(insertIndex, 0, styleRule);
- }
- }
- }
- },
- /**
- * Remove a selector from all our internal selector maps.
- * @param (com.ibm.rave.core.css.CSSStyleSheet) styleSheet StyleSheet to remove.
- * @return (boolean) <code>true</code> if this stylesheet was removed from the system. <code>false</code> if it did not exist.
- */
- remove : function(styleSheet) {
- var result = false;
- for (var __i_enFor0 = 0, __exp_enFor0 = this.allMaps, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var map = __exp_enFor0[__i_enFor0];
- for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(map), __len_enFor1 = __exp_enFor1.length;
- __i_enFor1 < __len_enFor1; ++__i_enFor1) {
- var key = __exp_enFor1[__i_enFor1];
- var list = map[key];
- for (var i = 0; i < list.length; ++i) {
- var rule = list[i];
- if (rule.parentStyleSheet == styleSheet) {
- list.splice(i--, 1);
- result = true;
- }
- }
- if (list.length == 0) {
- delete map[key];
- }
- }
- }
- return result;
- }
- });
- /**
- * Split this individual selector up into tag, class and id pieces So, "img#id.foo" would be split into "tag" "#id" ".foo". Use a lookbehind regex so we keep the special chars
- * @param selectorText A selector string representing a single
- * @return (java.lang.String[]) Array of individual selector pieces that represent a single class/attribute/id of a node.
- */
- com_ibm_rave_core_internal_css_CSSStyleSheetManager.splitSelectorTextByTypes = function(selector) {
- return selector.replace(new RegExp(",","g"), " ").split(new RegExp("(?=[\\.\\#\\s])"));
- };
- com_ibm_rave_core_internal_css_CSSStyleSheetManager.determineSpecificity = function(styleRule) {
- if (styleRule._specificity > 0) {
- return styleRule._specificity;
- }
- var specificity = 0;
- for (var __i_enFor0 = 0, __exp_enFor0 = com_ibm_rave_core_internal_css_CSSStyleSheetManager.splitSelectorTextByTypes(styleRule.selectorText), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var selector = __exp_enFor0[__i_enFor0];
- switch (com_ibm_rave_core_internal_css_CSSStyleSheetManager.determineSelectorType(selector)) {
- case 3:
- specificity++;
- break;
- case 2:
- specificity += 0x100;
- break;
- case 1:
- specificity += 0x10;
- break;
- default:
- break;
- }
- }
- styleRule._specificity = specificity;
- return specificity;
- };
- com_ibm_rave_core_internal_css_CSSStyleSheetManager.determineSelectorType = function(selectorText) {
- if (selectorText == null) {
- return -1;
- }
- var firstChar = selectorText.charCodeAt(0);
- if (firstChar == 35) {
- return 2;
- } else if (firstChar == 46 || firstChar == 58) {
- return 1;
- }
- return 3;
- };
- com_ibm_rave_core_internal_css_CSSStyleSheetManager.CLASS = 1;
- com_ibm_rave_core_internal_css_CSSStyleSheetManager.ID = 2;
- com_ibm_rave_core_internal_css_CSSStyleSheetManager.TAG = 3;
- /**
- * Singleton instance of the style sheet manager.
- */
- com_ibm_rave_core_internal_css_CSSStyleSheetManager.INSTANCE = new com_ibm_rave_core_internal_css_CSSStyleSheetManager();
- com_ibm_rave_core_internal_css_CSSStyleSheetManager.UNKNOWN = -1;
- // $source: com/ibm/rave/core/geom/RaveRect
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * A class that describes a Rectangular shape in a non-native way. Immutable. Uses doubles as coordinates.
- * @author jim
- */
- var com_ibm_rave_core_geom_RaveRect = rave_externs["RaveRect"] = com_ibm_rave_core_nativeImpl_Declare({
- /** @expose */
- x : 0,
- /** @expose */
- y : 0,
- /** @expose */
- width : 0,
- /** @expose */
- height : 0,
- /** @expose */
- constructor : function(x, y, width, height) {
- this.x = x;
- this.y = y;
- this.width = width;
- this.height = height;
- },
- /** @expose */
- getX : function() {
- return this.x;
- },
- /** @expose */
- getX2 : function() {
- return this.x + this.width;
- },
- /** @expose */
- getY : function() {
- return this.y;
- },
- /** @expose */
- getY2 : function() {
- return this.y + this.height;
- },
- /** @expose */
- getWidth : function() {
- return this.width;
- },
- /** @expose */
- getHeight : function() {
- return this.height;
- },
- /**
- * Return true if the receiver the the rect intersect, false otherwise
- * @param (com.ibm.rave.core.geom.RectStruct) rect another rectangle to test for intersection
- * @return (boolean) true if the rectangles intersect, false otherwise
- */
- /** @expose */
- intersects : function(rect) {
- return this.x <= (rect.x + rect.width) && (this.x + this.width) >= rect.x && this.y <= (rect.y + rect.height) && (this.y + this.height) >= rect.y;
- },
- /**
- * Checks whether or not this <code>Rectangle</code> contains the point at the specified location {@code (x,y)} .
- * @param (double) X the specified X coordinate
- * @param (double) Y the specified Y coordinate
- * @return (boolean) <code>true</code> if the point {@code (x,y)} is inside this <code>Rectangle</code>; <code>false</code> otherwise.
- */
- /** @expose */
- contains : function(X, Y) {
- if (this.width < 0 || this.height < 0) {
- return false;
- }
- return X >= this.x && Y >= this.y && X <= (this.x + this.width) && Y <= (this.y + this.height);
- }
- });
- // $source: com/ibm/rave/render/internal/nodes/GeometricHelper
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/geom/PointStruct (runtime) // new
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/path/Path2DUtil (runtime) // arcToBezier
- /**
- * A handful of geometric helper methods used by SceneNode hit testing
- * @author Ian Ballantyne
- */
- var com_ibm_rave_render_internal_nodes_GeometricHelper = {
- };
- /**
- * Determine if a rectangle intersects with a polygon
- * @param (com.ibm.rave.core.geom.RectStruct) rect rectangle for testing intersection
- * @param (Array) points polygon for testing intersection
- * @return (boolean) true if intersect, false otherwise
- */
- com_ibm_rave_render_internal_nodes_GeometricHelper.polygonIntersect = function(rect, points) {
- var topLeft = new com_ibm_rave_core_geom_PointStruct(rect.x, rect.y);
- if (com_ibm_rave_render_internal_nodes_GeometricHelper.pointInPolygon(topLeft, points)) {
- return true;
- } else if (com_ibm_rave_render_internal_nodes_GeometricHelper.pointInRectangle(points[0], rect)) {
- return true;
- } else {
- var topRight = new com_ibm_rave_core_geom_PointStruct(rect.x + rect.width, rect.y);
- var bottomRight = new com_ibm_rave_core_geom_PointStruct(rect.x + rect.width, rect.y + rect.height);
- var bottomLeft = new com_ibm_rave_core_geom_PointStruct(rect.x, rect.y + rect.height);
- var prevPoint = points[points.length - 1];
- for (var __i_enFor0 = 0, __exp_enFor0 = points, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var curPoint = __exp_enFor0[__i_enFor0];
- if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(topLeft.x, topLeft.y, topRight.x, topRight.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) {
- return true;
- } else if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(topRight.x, topRight.y, bottomRight.x, bottomRight.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) {
- return true;
- } else if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(bottomRight.x, bottomRight.y, bottomLeft.x, bottomLeft.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) {
- return true;
- } else if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(bottomLeft.x, bottomLeft.y, topLeft.x, topLeft.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) {
- return true;
- }
- prevPoint = curPoint;
- }
- }
- return false;
- };
- /**
- * Determine if a rectangle intersects with a polyline
- * @param (com.ibm.rave.core.geom.RectStruct) rect rectangle for testing intersection
- * @param (Array) points polyline for testing intersection
- * @return (boolean) true if intersect, false otherwise
- */
- com_ibm_rave_render_internal_nodes_GeometricHelper.polylineIntersect = function(rect, points) {
- if (com_ibm_rave_render_internal_nodes_GeometricHelper.pointInRectangle(points[0], rect)) {
- return true;
- } else {
- var topLeft = new com_ibm_rave_core_geom_PointStruct(rect.x, rect.y);
- var topRight = new com_ibm_rave_core_geom_PointStruct(rect.x + rect.width, rect.y);
- var bottomRight = new com_ibm_rave_core_geom_PointStruct(rect.x + rect.width, rect.y + rect.height);
- var bottomLeft = new com_ibm_rave_core_geom_PointStruct(rect.x, rect.y + rect.height);
- var prevPoint = points[points.length - 1];
- for (var __i_enFor0 = 0, __exp_enFor0 = points, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var curPoint = __exp_enFor0[__i_enFor0];
- if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(topLeft.x, topLeft.y, topRight.x, topRight.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) {
- return true;
- } else if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(topRight.x, topRight.y, bottomRight.x, bottomRight.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) {
- return true;
- } else if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(bottomRight.x, bottomRight.y, bottomLeft.x, bottomLeft.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) {
- return true;
- } else if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(bottomLeft.x, bottomLeft.y, topLeft.x, topLeft.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) {
- return true;
- }
- prevPoint = curPoint;
- }
- }
- return false;
- };
- /**
- * Determine if a point is inside a polygon
- * @param (com.ibm.rave.core.geom.PointStruct) pt point to test
- * @param (Array) points polygon for testing
- * @return (boolean) true if point is inside polygon, false otherwise
- */
- com_ibm_rave_render_internal_nodes_GeometricHelper.pointInPolygon = function(pt, points) {
- var isInside = false;
- var prevPoint = points[points.length - 1];
- for (var __i_enFor0 = 0, __exp_enFor0 = points, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var curPoint = __exp_enFor0[__i_enFor0];
- var curAbove = curPoint.y >= pt.y;
- var prevAbove = prevPoint.y >= pt.y;
- var stradle = curAbove != prevAbove;
- if (stradle) {
- var xIntersect = (prevPoint.x - curPoint.x) * (pt.y - curPoint.y) / (prevPoint.y - curPoint.y) + curPoint.x;
- var pointLeftOfIntersect = pt.x <= xIntersect;
- if (pointLeftOfIntersect) {
- isInside = !isInside;
- }
- }
- prevPoint = curPoint;
- }
- return isInside;
- };
- /**
- * Determine if a point lies on a polyline
- * @param (com.ibm.rave.core.geom.PointStruct) pt point to test
- * @param (Array) points polyline for testing
- * @param (double) tolerance max distance point can be from polyline to be considered "on"
- * @return (boolean) true if point is on the polyline, false otherwise
- */
- com_ibm_rave_render_internal_nodes_GeometricHelper.pointOnPolyline = function(pt, points, tolerance) {
- var prevPoint;
- for (var __i_enFor0 = 0, __exp_enFor0 = points, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var curPoint = __exp_enFor0[__i_enFor0];
- if (!prevPoint) {
- prevPoint = curPoint;
- } else {
- var d = com_ibm_rave_render_internal_nodes_GeometricHelper.calcDistance(pt.x, pt.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y);
- if (d <= tolerance) {
- return true;
- }
- prevPoint = curPoint;
- }
- }
- return false;
- };
- /**
- * Determine if a point is in a rectangle
- * @param (com.ibm.rave.core.geom.PointStruct) pt point to test
- * @param (com.ibm.rave.core.geom.RectStruct) rect rectangle for testing
- * @return (boolean) true if point is inside the rectangle, false otherwise
- */
- com_ibm_rave_render_internal_nodes_GeometricHelper.pointInRectangle = function(pt, rect) {
- return pt.x >= rect.x && pt.x < rect.x + rect.width && pt.y >= rect.y && pt.y < rect.y + rect.height;
- };
- /**
- * Determine if a circle intersects with a rectangle
- * @param (double) xCtr center x of circle
- * @param (double) yCtr center y of circle
- * @param (double) radius radius of circle
- * @param (com.ibm.rave.core.geom.RectStruct) rect rectangle for testing
- * @return (boolean) true if intersect, false otherwise
- */
- com_ibm_rave_render_internal_nodes_GeometricHelper.circleIntersect = function(xCtr, yCtr, radius, rect) {
- var xClosest = com_ibm_rave_render_internal_nodes_GeometricHelper.clamp(xCtr, rect.x, rect.x + rect.width);
- var yClosest = com_ibm_rave_render_internal_nodes_GeometricHelper.clamp(yCtr, rect.y, rect.y + rect.height);
- var dx = xCtr - xClosest;
- var dy = yCtr - yClosest;
- var distance_sq = dx * dx + dy * dy;
- return distance_sq < (radius * radius);
- };
- com_ibm_rave_render_internal_nodes_GeometricHelper.clamp = function(value, minValue, maxValue) {
- if (value < minValue) {
- return minValue;
- } else if (value > maxValue) {
- return maxValue;
- }
- return value;
- };
- /**
- * Calculate the distance of a point from a line segment
- * @param (double) x x value of point
- * @param (double) y y value of point
- * @param (double) x1 start x of line segment
- * @param (double) y1 start y of line segment
- * @param (double) x2 end x of line segment
- * @param (double) y2 end y of line segment
- * @return (double) distance
- */
- com_ibm_rave_render_internal_nodes_GeometricHelper.calcDistance = function(x, y, x1, y1, x2, y2) {
- var dot = (x - x1) * (x2 - x1) + (y - y1) * (y2 - y1);
- var len_sq = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
- var u = -1;
- if (len_sq != 0) {
- u = dot / len_sq;
- }
- var xSeg, ySeg;
- if (u < 0) {
- xSeg = x1;
- ySeg = y1;
- } else if (u > 1) {
- xSeg = x2;
- ySeg = y2;
- } else {
- xSeg = x1 + u * (x2 - x1);
- ySeg = y1 + u * (y2 - y1);
- }
- var dx = x - xSeg;
- var dy = y - ySeg;
- return Math.sqrt(dx * dx + dy * dy);
- };
- /**
- * Determine if two line segments intersect
- * @param (double) x1 start x of first line segment
- * @param (double) y1 start y of first line segment
- * @param (double) x2 end x of first line segment
- * @param (double) y2 end y of first line segment
- * @param (double) x3 start x of second line segment
- * @param (double) y3 start y of second line segment
- * @param (double) x4 end x of second line segment
- * @param (double) y4 end y of second line segment
- * @return (boolean) true if line segments intersect, false otherwise
- */
- com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect = function(x1, y1, x2, y2, x3, y3, x4, y4) {
- var denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
- if (denom <= 0.00001) {
- return false;
- }
- var uA = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denom;
- var uB = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denom;
- return uA > 0 && uA < 1 && uB > 0 && uB < 1;
- };
- /**
- * Determine if 2 rectangles intersect
- * @param (double) left1 left (x) of first rectangle
- * @param (double) top1 top (y) of first rectangle
- * @param (double) width1 width of first rectangle
- * @param (double) height1 height of first rectangle
- * @param (double) left2 left (x) of second rectangle
- * @param (double) top2 top (y) of second rectangle
- * @param (double) width2 width of second rectangle
- * @param (double) height2 heightof second rectangle
- * @return (boolean) true if intersect, false otherwise
- */
- com_ibm_rave_render_internal_nodes_GeometricHelper.rectIntersects = function(left1, top1, width1, height1, left2, top2, width2, height2) {
- var right1 = left1 + width1;
- var bottom1 = top1 + height1;
- var right2 = left2 + width2;
- var bottom2 = top2 + height2;
- return !(left1 > right2 || right1 < left2 || top1 > bottom2 || bottom1 < top2);
- };
- /**
- * A path can contain 0 or more "shapes" (either polylines or polygons), this object holds on to one of those shapes
- */
- com_ibm_rave_render_internal_nodes_GeometricHelper.PathShape = com_ibm_rave_core_nativeImpl_Declare({
- //points : null,
- //bounds : null,
- isClosed : false,
- isCollinear : true,
- initialSlope : 0,
- initialVertical : false,
- constructor : function() {
- this.points = [];
- },
- addPoint : function(point) {
- if (this.points.length != 0) {
- if (point.x == this.points[this.points.length - 1].x && point.y == this.points[this.points.length - 1].y) {
- return;
- }
- }
- this.points.push(point);
- if (!this.bounds) {
- this.bounds = [];
- this.bounds[0] = new com_ibm_rave_core_geom_PointStruct(point.x, point.y);
- this.bounds[1] = new com_ibm_rave_core_geom_PointStruct(point.x, point.y);
- } else {
- if (point.x < this.bounds[0].x) {
- this.bounds[0].x = point.x;
- } else if (point.x > this.bounds[1].x) {
- this.bounds[1].x = point.x;
- }
- if (point.y < this.bounds[0].y) {
- this.bounds[0].y = point.y;
- } else if (point.y > this.bounds[1].y) {
- this.bounds[1].y = point.y;
- }
- }
- if (this.isCollinear && this.points.length >= 2) {
- var dx = this.points[this.points.length - 1].x - this.points[this.points.length - 2].x;
- var dy = this.points[this.points.length - 1].y - this.points[this.points.length - 2].y;
- var isVertical = Math.abs(dy) < 0.0001;
- var slope = isVertical ? 0 : dx / dy;
- if (this.points.length == 2) {
- this.initialVertical = isVertical;
- this.initialSlope = slope;
- } else {
- this.isCollinear = (isVertical == this.initialVertical && Math.abs(this.initialSlope - slope) < 0.0001);
- }
- }
- },
- setClosed : function() {
- if (!this.isCollinear) {
- this.isClosed = true;
- }
- },
- getBounds : function() {
- return this.bounds;
- },
- intersect$0 : function(point) {
- if (this.isClosed) {
- return com_ibm_rave_render_internal_nodes_GeometricHelper.pointInPolygon(point, this.points);
- } else {
- return com_ibm_rave_render_internal_nodes_GeometricHelper.pointOnPolyline(point, this.points, 5.0);
- }
- },
- intersect$1 : function(rect) {
- if (rect.width <= 2 && rect.height <= 2) {
- return this.intersect$0(new com_ibm_rave_core_geom_PointStruct(rect.x, rect.y));
- }
- if (rect.x > this.bounds[1].x || (rect.x + rect.width) < this.bounds[0].x || rect.y > this.bounds[1].y || (rect.y + rect.height) < this.bounds[0].y) {
- return false;
- }
- if (this.isClosed) {
- return com_ibm_rave_render_internal_nodes_GeometricHelper.polygonIntersect(rect, this.points);
- } else {
- return com_ibm_rave_render_internal_nodes_GeometricHelper.polylineIntersect(rect, this.points);
- }
- },
- intersect : function(a0) {
- var args = arguments;
- if (args.length == 1 && (a0 == null || com_ibm_rave_core_nativeImpl_Object.isInstanceOf(a0, com_ibm_rave_core_geom_PointStruct))) {
- return this.intersect$0(a0);
- }
- return this.intersect$1(a0);
- }
- });
- /**
- * An implementation of Path2DHandler that is used to create an array of PathShape objects that represent the contents of a Path
- */
- com_ibm_rave_render_internal_nodes_GeometricHelper.PathHandler = com_ibm_rave_core_nativeImpl_Declare({
- //shapes : null,
- //currentPoint : null,
- currentShape : -1,
- constructor : function() {
- this.shapes = [];
- },
- /** @expose */
- fail : function(index) {},
- /** @expose */
- startPath : function() {},
- /** @expose */
- closePath : function() {
- this.shapes[this.currentShape].setClosed();
- this.currentPoint = null;
- },
- /** @expose */
- moveTo : function(x, y) {
- this.currentShape++;
- this.shapes.push(new com_ibm_rave_render_internal_nodes_GeometricHelper.PathShape());
- this.currentPoint = new com_ibm_rave_core_geom_PointStruct(x, y);
- this.shapes[this.currentShape].addPoint(this.currentPoint);
- },
- /** @expose */
- lineTo : function(x, y) {
- this.currentPoint = new com_ibm_rave_core_geom_PointStruct(x, y);
- this.shapes[this.currentShape].addPoint(this.currentPoint);
- },
- /** @expose */
- quadraticCurveTo : function(cpx, cpy, x, y) {
- var p0x = this.currentPoint.x;
- var p0y = this.currentPoint.y;
- var p1x = cpx;
- var p1y = cpy;
- var p2x = x;
- var p2y = y;
- var dx = p2x - p0x;
- var dy = p2y - p0y;
- var delta = Math.max(Math.abs(dx), Math.abs(dy));
- var curvePointCount = ~~(delta / 2);
- if (curvePointCount > 1) {
- var dt = 1.0 / curvePointCount;
- var t = dt;
- for (var j = 0; j < curvePointCount; ++j) {
- var xp = (1 - t) * (1 - t) * p0x + 2 * (1 - t) * t * p1x + (t * t) * p2x;
- var yp = (1 - t) * (1 - t) * p0y + 2 * (1 - t) * t * p1y + (t * t) * p2y;
- this.shapes[this.currentShape].addPoint(new com_ibm_rave_core_geom_PointStruct(xp, yp));
- t += dt;
- }
- }
- this.currentPoint = new com_ibm_rave_core_geom_PointStruct(x, y);
- this.shapes[this.currentShape].addPoint(this.currentPoint);
- },
- /** @expose */
- bezierCurveTo : function(cp1x, cp1y, cp2x, cp2y, x, y) {
- var p0x = this.currentPoint.x;
- var p0y = this.currentPoint.y;
- var p1x = cp1x;
- var p1y = cp1y;
- var p2x = cp2x;
- var p2y = cp2y;
- var p3x = x;
- var p3y = y;
- var dx = p3x - p0x;
- var dy = p3y - p0y;
- var delta = Math.max(Math.abs(dx), Math.abs(dy));
- var curvePointCount = ~~(delta / 2);
- if (curvePointCount > 1) {
- var dt = 1.0 / curvePointCount;
- var t = dt;
- for (var j = 0; j < curvePointCount; ++j) {
- var xp = (1 - t) * (1 - t) * (1 - t) * p0x + 3 * (1 - t) * (1 - t) * t * p1x + 3 * (1 - t) * (t * t) * p2x + (t * t * t) * p3x;
- var yp = (1 - t) * (1 - t) * (1 - t) * p0y + 3 * (1 - t) * (1 - t) * t * p1y + 3 * (1 - t) * (t * t) * p2y + (t * t * t) * p3y;
- this.shapes[this.currentShape].addPoint(new com_ibm_rave_core_geom_PointStruct(xp, yp));
- t += dt;
- }
- }
- this.currentPoint = new com_ibm_rave_core_geom_PointStruct(x, y);
- this.shapes[this.currentShape].addPoint(this.currentPoint);
- },
- /** @expose */
- arcTo : function(x0, y0, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) {
- com_ibm_rave_render_internal_nodes_path_Path2DUtil.arcToBezier(this, x0, y0, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y);
- },
- getShapes : function() {
- return this.shapes;
- }
- });
- // $source: com/ibm/rave/render/internal/nodes/path/Path2DUtil
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/transform/MatrixUtil (static) // identity, mapPoints
- var com_ibm_rave_render_internal_nodes_path_Path2DUtil = {
- //constructor : function() {}
- };
- /**
- * Utility for converting an SVG arc to bezier curves. Useful for platforms that do not support the SVG arc in the same way.
- */
- com_ibm_rave_render_internal_nodes_path_Path2DUtil.arcToBezier = function(path, x0, y0, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) {
- var angle = xAxisRotation % 360;
- var dx2 = (x0 - x) / 2.0;
- var dy2 = (y0 - y) / 2.0;
- var angleRad = angle / 180.0 * Math.PI;
- var cosAngle = Math.cos(angleRad);
- var sinAngle = Math.sin(angleRad);
- var x1 = (cosAngle * dx2 + sinAngle * dy2);
- var y1 = (-sinAngle * dx2 + cosAngle * dy2);
- var rxAbs = Math.abs(rx);
- var ryAbs = Math.abs(ry);
- var Prx = rxAbs * rxAbs;
- var Pry = ryAbs * ryAbs;
- var Px1 = x1 * x1;
- var Py1 = y1 * y1;
- var radiiCheck = Px1 / Prx + Py1 / Pry;
- if (radiiCheck > 1) {
- rxAbs = Math.sqrt(radiiCheck) * rxAbs;
- ryAbs = Math.sqrt(radiiCheck) * ryAbs;
- Prx = rxAbs * rxAbs;
- Pry = ryAbs * ryAbs;
- }
- var sign = (largeArcFlag == sweepFlag) ? -1 : 1;
- var sq = ((Prx * Pry) - (Prx * Py1) - (Pry * Px1)) / ((Prx * Py1) + (Pry * Px1));
- sq = (sq < 0) ? 0 : sq;
- var coef = (sign * Math.sqrt(sq));
- var cx1 = coef * ((rxAbs * y1) / ryAbs);
- var cy1 = coef * -((ryAbs * x1) / rxAbs);
- var sx2 = (x0 + x) / 2.0;
- var sy2 = (y0 + y) / 2.0;
- var cx = sx2 + (cosAngle * cx1 - sinAngle * cy1);
- var cy = sy2 + (sinAngle * cx1 + cosAngle * cy1);
- var ux = (x1 - cx1) / rxAbs;
- var uy = (y1 - cy1) / ryAbs;
- var vx = (-x1 - cx1) / rxAbs;
- var vy = (-y1 - cy1) / ryAbs;
- var p, n;
- n = Math.sqrt((ux * ux) + (uy * uy));
- p = ux;
- sign = (uy < 0) ? -1 : 1;
- var angleStart = (sign * Math.acos(p / n)) * 180.0 / Math.PI;
- n = Math.sqrt((ux * ux + uy * uy) * (vx * vx + vy * vy));
- p = ux * vx + uy * vy;
- sign = (ux * vy - uy * vx < 0) ? -1 : 1;
- var angleExtent = (sign * Math.acos(p / n)) * 180.0 / Math.PI;
- if (!sweepFlag && angleExtent > 0) {
- angleExtent -= 360;
- } else if (sweepFlag && angleExtent < 0) {
- angleExtent += 360;
- }
- angleExtent %= 360;
- angleStart %= 360;
- var bezierPoints = com_ibm_rave_render_internal_nodes_path_Path2DUtil.arcToBeziers(angleStart, angleExtent);
- var m = com_ibm_rave_core_transform_MatrixUtil.identity();
- com_ibm_rave_core_transform_MatrixUtil.mapPoints(bezierPoints, m.scaleNonUniform(rxAbs, ryAbs));
- com_ibm_rave_core_transform_MatrixUtil.mapPoints(bezierPoints, m.rotate(angle));
- com_ibm_rave_core_transform_MatrixUtil.mapPoints(bezierPoints, m.translate(cx, cy));
- bezierPoints[bezierPoints.length - 2] = x;
- bezierPoints[bezierPoints.length - 1] = y;
- for (var i = 0; i < bezierPoints.length; i += 6) {
- path.bezierCurveTo(bezierPoints[i], bezierPoints[i + 1], bezierPoints[i + 2], bezierPoints[i + 3], bezierPoints[i + 4], bezierPoints[i + 5]);
- }
- };
- com_ibm_rave_render_internal_nodes_path_Path2DUtil.arcToBeziers = function(angleStart, angleExtent) {
- var numSegments = Math.ceil(Math.abs(angleExtent) / 90.0);
- var angleStartRad = angleStart / 180.0 * Math.PI;
- var angleExtentRad = angleExtent / 180.0 * Math.PI;
- var angleIncrement = (angleExtentRad / numSegments);
- var controlLength = 4.0 / 3.0 * Math.sin(angleIncrement / 2.0) / (1.0 + Math.cos(angleIncrement / 2.0));
- var coords = [];
- var pos = 0;
- for (var i = 0; i < numSegments; ++i) {
- var angle = angleStartRad + i * angleIncrement;
- var dx = Math.cos(angle);
- var dy = Math.sin(angle);
- coords[pos++] = (dx - controlLength * dy);
- coords[pos++] = (dy + controlLength * dx);
- angle += angleIncrement;
- dx = Math.cos(angle);
- dy = Math.sin(angle);
- coords[pos++] = (dx + controlLength * dy);
- coords[pos++] = (dy - controlLength * dx);
- coords[pos++] = dx;
- coords[pos++] = dy;
- }
- return coords;
- };
- // $source: com/ibm/rave/render/internal/nodes/CircleSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
- //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/GeometricHelper (runtime) // circleIntersect
- /**
- * Circle shape.
- */
- var com_ibm_rave_render_internal_nodes_CircleSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
- cx : 0,
- r : 0,
- cy : 0,
- calculateBBox : function() {
- return new com_ibm_rave_core_geom_RaveRect(this.cx - this.r, this.cy - this.r, this.r * 2, this.r * 2);
- },
- /** @expose */
- rave_getDrawType : function() {
- return 1002;
- },
- /** @expose */
- rave_getName : function() {
- return "circle";
- },
- getCx : function() {
- return this.cx;
- },
- getCy : function() {
- return this.cy;
- },
- getR : function() {
- return this.r;
- },
- rave_intersects : function(rect) {
- return com_ibm_rave_render_internal_nodes_GeometricHelper.circleIntersect(this.cx, this.cy, this.r, rect) && this.intersectsClip(rect);
- },
- paint : function(renderer) {
- renderer.setStrokeAndFill(this);
- renderer.drawCircle(this);
- },
- doLayout : function() {
- this.cx = this.rave_getSizePx(this.getComputedCSSStyle(9).value);
- this.cy = this.rave_getSizePx(this.getComputedCSSStyle(10).value);
- this.r = this.rave_getSizePx(this.getComputedCSSStyle(6).value);
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/nodes/LineSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
- //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
- //@import com/ibm/rave/core/geom/PointStruct (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/GeometricHelper (runtime) // pointOnPolyline, polylineIntersect
- /**
- * Circle shape.
- */
- var com_ibm_rave_render_internal_nodes_LineSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
- x1 : 0,
- x2 : 0,
- y1 : 0,
- y2 : 0,
- calculateBBox : function() {
- var tmp;
- if (this.x1 > this.x2) {
- tmp = this.x1;
- this.x1 = this.x2;
- this.x2 = tmp;
- }
- if (this.y1 > this.y2) {
- tmp = this.y1;
- this.y1 = this.y2;
- this.y2 = tmp;
- }
- return new com_ibm_rave_core_geom_RaveRect(this.x1, this.y1, this.x2 - this.x1, this.y2 - this.y1);
- },
- /** @expose */
- rave_getDrawType : function() {
- return 1001;
- },
- /** @expose */
- rave_getName : function() {
- return "line";
- },
- getX1 : function() {
- return this.x1;
- },
- getX2 : function() {
- return this.x2;
- },
- getY1 : function() {
- return this.y1;
- },
- getY2 : function() {
- return this.y2;
- },
- rave_intersects : function(rect) {
- var line = [];
- line.push(new com_ibm_rave_core_geom_PointStruct(this.x1, this.y1));
- line.push(new com_ibm_rave_core_geom_PointStruct(this.x2, this.y2));
- if (rect.width <= 2 && rect.height <= 2) {
- return com_ibm_rave_render_internal_nodes_GeometricHelper.pointOnPolyline(new com_ibm_rave_core_geom_PointStruct(rect.x, rect.y), line, 5.0);
- }
- return com_ibm_rave_render_internal_nodes_GeometricHelper.polylineIntersect(rect, line) && this.intersectsClip(rect);
- },
- paint : function(renderer) {
- renderer.setStrokeAndFill(this);
- renderer.drawLine(this);
- },
- doLayout : function() {
- this.x1 = this.rave_getSizePx(this.getComputedCSSStyle(4).value);
- this.x2 = this.rave_getSizePx(this.getComputedCSSStyle(5).value);
- this.y1 = this.rave_getSizePx(this.getComputedCSSStyle(7).value);
- this.y2 = this.rave_getSizePx(this.getComputedCSSStyle(8).value);
- }
- //constructor : function(nsuri, context) {}
- });
- com_ibm_rave_render_internal_nodes_LineSceneItem.LINE_TOUCH_DISTANCE = 5;
- // $source: com/ibm/rave/render/internal/nodes/TextSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
- //@import com/ibm/rave/core/geom/RectStruct (runtime) // new
- //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
- //@import com/ibm/rave/render/internal/style/RenderStyleManager (runtime) // getFont
- //@import com/ibm/rave/render/internal/style/ShadowStyle (runtime) // parse
- //@import com/ibm/rave/render/internal/nodes/TSpanSceneItem (runtime) // new
- //@import com/ibm/rave/core/Rave (runtime) // Rave
- /**
- * Text shape.
- */
- var com_ibm_rave_render_internal_nodes_TextSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
- //styleCache : null,
- //ascent : null,
- //descent : null,
- //cachedBoundingClientRectBBox : null,
- x : 0,
- y : 0,
- width : 0,
- height : 0,
- nextX : 0,
- nextY : 0,
- /** @expose */
- rave_getDrawType : function() {
- return 1003;
- },
- /** @expose */
- rave_getName : function() {
- return "text";
- },
- notifyAfterUpdate : function(type, subType, key, toValue, fromValue) {
- this.styleCache = null;
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.notifyAfterUpdate.call(this, type, subType, key, toValue, fromValue);
- },
- invalidateLayout : function() {
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.invalidateLayout.call(this);
- this.cachedBoundingClientRectBBox = null;
- },
- calculateBBox : function() {
- var clientRect = new com_ibm_rave_core_geom_RectStruct(this.x, this.y - this.ascent, this.width, this.height);
- if (this.rave_hasChildNodes()) {
- for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- var childRect = (child).calculateBBox();
- this.expandRect(childRect, clientRect);
- }
- }
- return new com_ibm_rave_core_geom_RaveRect(clientRect.x, clientRect.y, clientRect.width, clientRect.height);
- },
- getBoundingClientRectBBox : function() {
- if (!this.cachedBoundingClientRectBBox) {
- if (this.invalidLayout) {
- this.layout();
- }
- var clientRect = new com_ibm_rave_core_geom_RectStruct(this.x, this.y - this.ascent, this.width, this.height);
- if (this.rave_hasChildNodes()) {
- for (var __i_enFor0 = 0, __exp_enFor0 = this.getChildrenArray(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- var childRect = (child).getBoundingClientRectBBox();
- this.expandRect(childRect, clientRect);
- }
- }
- this.cachedBoundingClientRectBBox = new com_ibm_rave_core_geom_RaveRect(clientRect.x, clientRect.y, clientRect.width, clientRect.height);
- }
- return this.cachedBoundingClientRectBBox;
- },
- /**
- * Expand bounding box of rect2 to include positions of rect1 that are outside rect2 bounds. Modifies rect2 in place.
- * @param (com.ibm.rave.core.geom.RaveRect) rect1
- * @param (com.ibm.rave.core.geom.RectStruct) rect2
- */
- expandRect : function(rect1, rect2) {
- var currentX2 = rect2.x + rect2.width;
- var currentY2 = rect2.y + rect2.height;
- var childX2 = rect1.x + rect1.width;
- var childY2 = rect1.y + rect1.height;
- rect2.x = Math.min(rect1.x, rect2.x);
- rect2.y = Math.min(rect1.y, rect2.y);
- rect2.width = Math.max(currentX2, childX2) - rect2.x;
- rect2.height = Math.max(currentY2, childY2) - rect2.y;
- },
- /**
- * @return (com.ibm.rave.render.internal.style.FontStyle) An object representing the styles of this text node.
- */
- getFontStyle : function() {
- if (!this.styleCache) {
- this.styleCache = com_ibm_rave_render_internal_style_RenderStyleManager.getFont(this);
- }
- return this.styleCache;
- },
- /**
- * @return (com.ibm.rave.render.internal.style.ShadowStyle) An object representing the styles of this text node.
- */
- getShadow : function() {
- var result = this.getComputedStyleValue(46);
- if (!result) {
- result = com_ibm_rave_render_internal_style_ShadowStyle.parse(this.rave_getProperty("_rave_drop_shadow"));
- }
- result = (!result || "none" == result) ? null : result;
- return result;
- },
- /**
- * Return the text content.
- * @return (String) text content
- */
- getTextString : function() {
- return this.text;
- },
- /**
- * Returns the X position where this item will start drawing from. TODO: Does not yet take text direction into account.
- * @return (double) x position taking alignment into account.
- */
- getX : function() {
- return this.x;
- },
- /**
- * Returns the Y position where this item will start drawing from. This returns the text baseline
- * @return (double) y position
- */
- getY : function() {
- return this.y;
- },
- /** @expose */
- rave_getSizePx : function(size) {
- var value = 0;
- if (size) {
- value = size.value;
- switch (size.unit.type) {
- case 1:
- return size.value * this.getFontStyle().getSize();
- default:
- return com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.rave_getSizePx.call(this, size);
- }
- }
- return value;
- },
- paint : function(renderer) {
- if (this.text != null && this.text.length > 0) {
- renderer.setStrokeAndFill(this);
- renderer.drawText(this);
- }
- },
- doLayout : function() {
- this.calculateDimensions();
- this.nextX = this.x + this.width;
- this.nextY = this.y;
- this.invalidLayout = false;
- if (this.rave_hasChildNodes()) {
- for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(child, com_ibm_rave_render_internal_nodes_TSpanSceneItem)) {
- var achild = child;
- if (achild.invalidLayout) {
- achild.layout();
- }
- this.nextX = achild.nextX;
- this.nextY = achild.nextY;
- }
- }
- }
- },
- /**
- * When a textSceneItem is invalidated, if it has a tspanItem child, the child tspanItem needs to be invalidated too. This is necessary because tspan is generated internally, and the text style attribute is specified on text, not on its tspan children.
- */
- setDirty : function(dirty_, invalidateLayout) {
- if (dirty_ && invalidateLayout && this.rave_hasChildNodes()) {
- for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(child, com_ibm_rave_render_internal_nodes_TSpanSceneItem)) {
- (child).invalidateLayout();
- }
- }
- }
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.setDirty.call(this, dirty_, invalidateLayout);
- },
- /**
- * Perform dimension (x,y,width,height,etc) calculations only.
- */
- calculateDimensions : function() {
- this.computeStylesToRoot();
- var metrics = this.calculateMetrics();
- this.width = metrics["width"];
- var fontSize = this.rave_getSizePx(this.getComputedCSSStyle(22).value);
- this.ascent = metrics["actualBoundingBoxAscent"];
- this.descent = metrics["actualBoundingBoxDescent"];
- if (undefined == this.ascent) {
- this.ascent = fontSize * .7 + fontSize * .1;
- }
- if (undefined == this.descent) {
- this.descent = fontSize * .3;
- }
- this.height = this.ascent + this.descent;
- this.width = this.calculateMetrics()["width"];
- this.x = this.calculateX();
- this.y = this.rave_getSizePx(this.getComputedCSSStyle(1).value) + this.rave_getSizePx(this.getComputedCSSStyle(16).value);
- },
- calculateX : function() {
- var calculatedX = this.rave_getSizePx(this.getComputedStyleValue(0));
- var anchor = this.getComputedStyleValue(27);
- if ("middle" == anchor) {
- calculatedX -= this.width / 2;
- } else if ("end" == anchor) {
- calculatedX -= this.width;
- }
- return calculatedX + this.rave_getSizePx(this.getComputedStyleValue(15));
- },
- calculateMetrics : function() {
- var context = com_ibm_rave_core_Rave.canvas.create(1, 1).getContext("2d");
- context.font = this.getFontStyle().toString();
- var tm = context.measureText(this.text);
- com_ibm_rave_core_Rave.canvas.disposeContext(context);
- return tm;
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/style/GradientFillStyle
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/style/AbstractStyle (loadtime) // superclass
- /**
- * The abstract base class for color gradient used for filling shapes. Gradients are immutable.
- */
- var com_ibm_rave_render_internal_style_GradientFillStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_AbstractStyle, {
- /**
- * A list to hold gradient color stops
- */
- //stops : null,
- constructor : function() {
- this.stops = [];
- },
- /**
- * Add a gradient color stop at a set index.
- * @param (com.ibm.rave.render.internal.style.GradientStop) stop {@link (com.ibm.rave.render.internal.style.GradientStop) GradientStop}
- * @return (com.ibm.rave.render.internal.style.GradientFillStyle) This gradient for easy chaining.
- */
- addStop : function(stop) {
- this.stops.push(this.updateOffset(stop));
- return this;
- },
- /**
- * Return a list of all stop objects associated with this gradient.
- * @return (Array) list of all stop objects associated with this gradient. Returns an empty list if none defined.
- */
- getStops : function() {
- return this.stops;
- },
- getColor : function() {
- return null;
- },
- calculateColorWithOpacity : function() {
- return null;
- },
- /**
- * Update the stop's offset to match the rules of SVG for gradients. (http://www.w3.org/TR/SVG/pservers.html#StopElement)
- */
- updateOffset : function(stop) {
- var maxStop;
- for (var __i_enFor0 = 0, __exp_enFor0 = this.stops, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var s = __exp_enFor0[__i_enFor0];
- if (!maxStop || s.offset > maxStop.offset) {
- maxStop = s;
- }
- }
- if (maxStop) {
- var maxOffset = maxStop.offset;
- if (stop.offset <= maxOffset) {
- stop.setOffset(maxOffset);
- maxStop.setOffset(maxOffset - 1.0E-5);
- }
- }
- return stop;
- }
- });
- /**
- * A small adjustment to differentiate between equal stop values. AWT renderer throws an exception when stops have the same value. Adjusting one of the values by this amount mimics SVG behavior for equal stop values.
- */
- com_ibm_rave_render_internal_style_GradientFillStyle.EQUAL_DIFF = 0.00001;
- // $source: com/ibm/rave/render/internal/style/LinearGradientFillStyle
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/style/GradientFillStyle (loadtime) // superclass
- var com_ibm_rave_render_internal_style_LinearGradientFillStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_GradientFillStyle, {
- /**
- * Starting X position.
- */
- x1 : 0,
- /**
- * Starting Y position.
- */
- y1 : 0,
- /**
- * Ending X position.
- */
- x2 : 0,
- /**
- * Ending Y position.
- */
- y2 : 0,
- /**
- * Create a linear gradient style. Has the following public properties defined:<p> x0<p> y0<p> x1<p> y1<p> stops<p>
- * @param (double) x1 The horizontal coordinate of the gradient start point.
- * @param (double) y1 The vertical coordinate of the gradient start point.
- * @param (double) x2 The horizontal coordinate of the gradient end point.
- * @param (double) y2 The vertical coordinate of the gradient end point.
- */
- constructor : function(x1, y1, x2, y2) {
- this.x1 = x1;
- this.y1 = y1;
- this.x2 = x2;
- this.y2 = y2;
- },
- getType : function() {
- return 1001;
- }
- });
- // $source: com/ibm/rave/render/internal/style/RadialGradientFillStyle
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/style/GradientFillStyle (loadtime) // superclass
- var com_ibm_rave_render_internal_style_RadialGradientFillStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_GradientFillStyle, {
- /**
- * The horizontal coordinate of the gradient start point.
- */
- cx : 0,
- /**
- * The vertical coordinate of the gradient start point.
- */
- cy : 0,
- /**
- * Radius of the starting circle.
- */
- r : 0,
- /**
- * The horizontal coordinate of the gradient end point.
- */
- fx : 0,
- /**
- * The vertical coordinate of the gradient end point.
- */
- fy : 0,
- /**
- * Create a radial gradient style. Has the following public properties defined: <p> cx <p> cy <p> r <p> fx <p> fy <p> stops <p>
- * @param (double) cx The horizontal coordinate of the gradient center point.
- * @param (double) cy The vertical coordinate of the gradient center point.
- * @param (double) r Radius of the starting circle.
- * @param (double) fx The horizontal coordinate of the gradient focal point.
- * @param (double) fy The vertical coordinate of the gradient focal point.
- */
- constructor : function(cx, cy, r, fx, fy) {
- this.cx = cx;
- this.cy = cy;
- this.r = r;
- this.fx = fx;
- this.fy = fy;
- },
- getType : function() {
- return 1002;
- }
- });
- // $source: com/ibm/rave/render/internal/style/FillStyle
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/style/AbstractStyle (loadtime) // superclass
- //@import com/ibm/rave/core/Rave (runtime) // rgb
- var com_ibm_rave_render_internal_style_FillStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_AbstractStyle, {
- //color : null,
- /**
- * A class representing a fill style for an arbitrary shape. If both a color and gradient are supplied, the renderer has the option to apply either.
- * @param (Object) color A color style to apply as a fill in a CSS style notation (ie - "#ffffff", "rgb(0,0,0)", etc).
- * @param (double) opacity The amount of opacity to apply from 0 (transparent) to 1 (opaque).
- * @see <a href="http://www.w3.org/TR/css3-color/">http://www.w3.org/TR/css3-color/</a>
- */
- constructor : function(color, opacity) {
- this.setOpacity(opacity);
- this.color = com_ibm_rave_core_Rave.rgb(color);
- },
- /**
- * Parses the value of getColor() as an RGB string and returns a new RGB object.
- * @return (com.ibm.rave.core.color.RGB) RGB object representing color.
- */
- getColor : function() {
- return this.color;
- },
- isVisible : function() {
- return com_ibm_rave_render_internal_style_AbstractStyle.prototype.isVisible.call(this) && this.color;
- },
- getType : function() {
- return 1000;
- }
- });
- // $source: com/ibm/rave/render/internal/style/GradientStop
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/core/Rave (runtime) // rgb
- /**
- * A class representing a stop for a gradient. Holds a stop offset and a color.
- */
- var com_ibm_rave_render_internal_style_GradientStop = com_ibm_rave_core_nativeImpl_Declare({
- /**
- * Gradient stop color.
- */
- //color : null,
- /**
- * Gradient stop offset.
- */
- offset : 0,
- /**
- * Gradient stop opacity
- */
- opacity : 0,
- /**
- * Creates a new object representing a stop inside a gradient.
- * @param (double) offset Where this offset starts. A value between 0-1 representing a percentage of a bounding box. The bounding box is defined by the gradient type and properties.
- * @param (com.ibm.rave.core.color.RGB) color The color of this gradient stop.
- * @param (double) opacity The opacity level of this stop.
- */
- constructor : function(offset, color, opacity) {
- this.offset = this.fix(offset);
- this.color = color;
- this.opacity = this.fix(opacity);
- },
- /**
- * Return this stop as an RGBA color. Multiplies any existing rgba() fill color with stop-opacity to create the alpha value.
- * @return (com.ibm.rave.core.color.RGB) RGBA combining stop-opacity and stop color.
- */
- calculateColor : function() {
- var opacity = this.color.a * this.opacity;
- return com_ibm_rave_core_Rave.rgb("rgba(" + this.color.r + "," + this.color.g + "," + this.color.b + "," + opacity + ")");
- },
- fix : function(number) {
- return Math.min(Math.max(number, 0), 1);
- },
- /**
- * Return the stop offset from 0->1
- * @return (double) The offset from 0-1>
- */
- getOffset : function() {
- return this.offset;
- },
- setOffset : function(offset) {
- this.offset = this.fix(offset);
- },
- /**
- * Return the stop opacity from 0->1. Defaults to 1.
- * @return (double) The stop opacity from 0->1.
- */
- getOpacity : function() {
- return this.opacity;
- }
- });
- // $source: com/ibm/rave/render/internal/style/StrokeStyle
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/style/AbstractStyle (loadtime) // superclass
- //@import com/ibm/rave/core/Rave (runtime) // rgb
- var com_ibm_rave_render_internal_style_StrokeStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_AbstractStyle, {
- //lineJoin : null,
- //lineCap : null,
- //dashArray : null,
- //strokeColor : null,
- width : 0,
- miterLimit : 0,
- dashOffset : 0,
- /**
- * A class that holds information about stroke styling.
- * @param (Object) strokeColor A string representation of a color in CSS style notation (ie - "#ffffff", "rgb(0,0,0)", etc)
- * @param (double) width the pixel stroke width
- * @param (double) opacity the opacity between 0 and 1 inclusive
- * @param (double) miterLimit the maxmimum miter length. Miter length is the distance between the inner corner and the outer corner where two lines meet. Only valid when lineJoin is 'miter'.
- * @param (String) lineJoin the type of corner created when two lines meet. Valid values: bevel, round, miter
- * @param (String) lineCap the style of end caps for a line. Valid values: butt, round, square
- * @param (float[]) dashArray the pattern of dashes and gaps (positive numbers) used to stroke paths
- * @param (double) dashOffset the distance into the dash pattern to start the dash
- */
- constructor : function(strokeColor, width, opacity, miterLimit, lineJoin, lineCap, dashArray, dashOffset) {
- this.setOpacity(opacity);
- this.strokeColor = com_ibm_rave_core_Rave.rgb(strokeColor);
- this.width = width;
- this.miterLimit = miterLimit;
- this.lineJoin = lineJoin;
- this.lineCap = lineCap;
- this.dashArray = dashArray;
- this.dashOffset = dashOffset;
- },
- isVisible : function() {
- return com_ibm_rave_render_internal_style_AbstractStyle.prototype.isVisible.call(this) && this.width > 0;
- },
- /**
- * Return the stroke width.
- * @return (double) Stroke width.
- */
- getWidth : function() {
- return this.width;
- },
- /**
- * Return the line cap. Valid values are butt, round, square
- * @return (String) line cap
- */
- getLineCap : function() {
- return this.lineCap;
- },
- /**
- * Return the line join. Valid values are bevel, round, miter.
- * @return (String) line join
- */
- getLineJoin : function() {
- return this.lineJoin;
- },
- /**
- * Return the miter limit.
- * @return (double) the miter limit
- */
- getMiterLimit : function() {
- return this.miterLimit;
- },
- /**
- * Return the stroke color as RGB. May return null.
- * @return (com.ibm.rave.core.color.RGB) Set stroke color. Returns 'black' if the defined color is not valid.
- */
- getColor : function() {
- return this.strokeColor;
- },
- /**
- * Return the dash array.
- * @return (float[]) the dash array
- */
- getDashArray : function() {
- return this.dashArray;
- },
- /**
- * Return the dash offset.
- * @return (double) the dash offset
- */
- getDashOffset : function() {
- return this.dashOffset;
- },
- getType : function() {
- return 1003;
- }
- });
- // $source: com/ibm/rave/render/internal/style/RenderStyleManager
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/core/internal/css/CSSUtil (runtime) // parseIdUrlLink
- //@import com/ibm/rave/render/internal/nodes/NodeUtil (runtime) // findSceneNode
- //@import com/ibm/rave/render/internal/style/LinearGradientFillStyle (static) // new
- //@import com/ibm/rave/render/internal/style/RadialGradientFillStyle (static) // new
- //@import com/ibm/rave/render/internal/style/FillStyle (static) // new
- //@import com/ibm/rave/render/internal/style/GradientStop (static) // new
- //@import com/ibm/rave/render/internal/style/StrokeStyle (static) // new
- //@import com/ibm/rave/render/internal/style/FontStyle (static) // new
- /**
- * An internal helper class that converts styles on a SceneNode to internal style classes (FillStyle, FontStyle, etc) used by the renderers.
- */
- var com_ibm_rave_render_internal_style_RenderStyleManager = com_ibm_rave_core_nativeImpl_Declare({
- });
- /**
- * Return a FillStyle object based on style properties set on the node. Will return null if there is no fill style defined on the node or if the style would result in a completely transparent fill.
- * @return (com.ibm.rave.render.internal.style.AbstractStyle) FillStyle object representing styles set on the node.
- */
- com_ibm_rave_render_internal_style_RenderStyleManager.getFill = function(node) {
- var fill = node.getComputedStyleValue(28);
- var style;
- if (fill != null && !("none" == fill)) {
- var id = com_ibm_rave_core_internal_css_CSSUtil.parseIdUrlLink(fill);
- if (id != null) {
- var gradientNode = com_ibm_rave_render_internal_nodes_NodeUtil.findSceneNode(node, id, [1011, 1012]);
- if (gradientNode) {
- switch (gradientNode.rave_getDrawType()) {
- case 1011:
- var linearGradient = gradientNode;
- style = new com_ibm_rave_render_internal_style_LinearGradientFillStyle(linearGradient.getX1(node), linearGradient.getY1(node), linearGradient.getX2(node), linearGradient.getY2(node));
- com_ibm_rave_render_internal_style_RenderStyleManager.addGradientStops(style, linearGradient);
- break;
- case 1012:
- var radialGradient = gradientNode;
- style = new com_ibm_rave_render_internal_style_RadialGradientFillStyle(radialGradient.getCX(node), radialGradient.getCY(node), radialGradient.getR(node), radialGradient.getFX(node), radialGradient.getFY(node));
- com_ibm_rave_render_internal_style_RenderStyleManager.addGradientStops(style, radialGradient);
- break;
- }
- }
- } else {
- var oOpacity = node.getComputedStyleValue(30);
- var oFillOpacity = node.getComputedStyleValue(33);
- var opacity = (oOpacity != null) ? (oOpacity) : 1;
- var fillOpacity = (oFillOpacity != null) ? (oFillOpacity) : 1;
- opacity = opacity * fillOpacity;
- if (opacity > 0) {
- style = new com_ibm_rave_render_internal_style_FillStyle(fill, Math.min(opacity, 1));
- }
- }
- }
- return style;
- };
- com_ibm_rave_render_internal_style_RenderStyleManager.addGradientStops = function(gradientStyle, gradientNode) {
- for (var __i_enFor0 = 0, __exp_enFor0 = gradientNode.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- if (child.rave_getDrawType() == 1016) {
- var stopItem = child;
- gradientStyle.addStop(new com_ibm_rave_render_internal_style_GradientStop(stopItem.getOffset(), stopItem.getColor(), stopItem.getOpacity()));
- }
- }
- };
- /**
- * Return a StrokeStyle object based on style properties set on the node. Will return null if there is no stroke styling defined on the node or if the style would result in a completely transparent stroke.
- * @return (com.ibm.rave.render.internal.style.StrokeStyle) FillStyle object representing styles set on the node.
- */
- com_ibm_rave_render_internal_style_RenderStyleManager.getStroke = function(node) {
- var stroke = node.getComputedStyleValue(29);
- if (stroke == null || "none" == stroke) {
- return null;
- }
- var strokeWidth = node.getComputedSizePx(31);
- if (strokeWidth > 0) {
- var oOpacity = node.getComputedStyleValue(30);
- var oStrokeOpacity = node.getComputedStyleValue(32);
- var opacity = (oOpacity != null) ? (oOpacity) : 1;
- var strokeOpacity = (oStrokeOpacity != null) ? (oStrokeOpacity) : 1;
- opacity = opacity * strokeOpacity;
- if (opacity > 0) {
- var miterLimit = (node.getComputedStyleValue(38));
- var lineJoin = node.getComputedStyleValue(37);
- var lineCap = node.getComputedStyleValue(36);
- var dashArray = node.getComputedStyleValue(34);
- var dashOffset = node.getComputedSizePx(35);
- return new com_ibm_rave_render_internal_style_StrokeStyle(stroke, strokeWidth, Math.min(opacity, 1), miterLimit, lineJoin, lineCap, dashArray, dashOffset);
- }
- }
- return null;
- };
- /**
- * Gets font information from CSS-type styles set on a scene node. Currently supports these style attributes: <p> font-style <p> - Defaults to "normal". <p> font-family <p> - Defaults to "". <p> font-size <p> - Defaults size to FontStyle.DEFAULT_FONT_SIZE <p> - Defaults unit to FontUnitType.PX <p> font-weight <p> - Defaults to "normal". <p>
- * @param (com.ibm.rave.render.internal.nodes.AbstractSceneNode) node Scene node with styles set.
- * @return (com.ibm.rave.render.internal.style.FontStyle) FontStyle object that holds font information for drawing.
- */
- com_ibm_rave_render_internal_style_RenderStyleManager.getFont = function(node) {
- var style = node.getComputedStyleValue(23);
- var family = node.getComputedStyleValue(21);
- var size = node.getComputedStyleValue(22);
- var weight = node.getComputedStyleValue(24);
- var lineHeight = ""+(node.getComputedStyleValue(14));
- var variant = node.getComputedStyleValue(25);
- return new com_ibm_rave_render_internal_style_FontStyle(style, family, size, weight, lineHeight, variant);
- };
- //com_ibm_rave_render_internal_style_RenderStyleManager.NONE = "none";
- //com_ibm_rave_render_internal_style_RenderStyleManager.BUTT = "butt";
- //com_ibm_rave_render_internal_style_RenderStyleManager.MITER = "miter";
- // $source: com/ibm/rave/render/internal/nodes/TSpanSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/TextSceneItem (loadtime) // new, superclass
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (runtime)
- /**
- * A class that describes a text span. tspan nodes are treated like text nodes with the exception that they are positioned relative to their parent element (typically a text node) if no absolute positioning is provided.
- */
- var com_ibm_rave_render_internal_nodes_TSpanSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_TextSceneItem, {
- /** @expose */
- rave_getName : function() {
- return "tspan";
- },
- /**
- * Create a tspan scene node.
- * @param (String) nsuri
- * @param (com.ibm.rave.core.scene.SceneNode) context
- */
- constructor : function(nsuri, context) {
- this.invalidLayout = true;
- },
- doLayout : function() {
- var parent = this.rave_getParentNode();
- if (parent && (parent).invalidLayout) {
- (parent).doLayout();
- } else {
- com_ibm_rave_render_internal_nodes_TextSceneItem.prototype.doLayout.call(this);
- }
- },
- /** @expose */
- getBoundingClientRect : function() {
- var parent = this.rave_getParentNode();
- if (parent) {
- return (parent).getBoundingClientRect();
- }
- return com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.getBoundingClientRect.call(this);
- },
- /** @expose */
- getBBox : function() {
- var parent = this.rave_getParentNode();
- if (parent) {
- return (parent).getBBox();
- }
- return com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.getBBox.call(this);
- },
- getFontStyle : function() {
- var parent = this.rave_getParentNode();
- if (parent && (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(parent, com_ibm_rave_render_internal_nodes_TextSceneItem))) {
- return (parent).getFontStyle();
- }
- return com_ibm_rave_render_internal_nodes_TextSceneItem.prototype.getFontStyle.call(this);
- },
- calculateDimensions : function() {
- com_ibm_rave_render_internal_nodes_TextSceneItem.prototype.calculateDimensions.call(this);
- var parent = this.rave_getParentNode();
- if (parent && com_ibm_rave_core_nativeImpl_Object.isInstanceOf(parent, com_ibm_rave_render_internal_nodes_TextSceneItem)) {
- var parentItem = parent;
- if (this.getAttribute("x") == null) {
- this.x += parentItem.nextX;
- }
- if (this.getAttribute("y") == null) {
- this.y += parentItem.nextY;
- }
- }
- }
- });
- // $source: com/ibm/rave/render/internal/nodes/TextPathSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
- //@import com/ibm/rave/core/geom/RectStruct (runtime) // new
- //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
- //@import com/ibm/rave/render/internal/style/RenderStyleManager (runtime) // getFont
- //@import com/ibm/rave/render/internal/style/ShadowStyle (runtime) // parse
- //@import com/ibm/rave/core/Rave (runtime) // selectAll, Rave
- //@import com/ibm/rave/render/internal/nodes/TSpanSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/TextSceneItem (runtime) // new
- /**
- * TextPath shape.
- */
- var com_ibm_rave_render_internal_nodes_TextPathSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
- //styleCache : null,
- //ascent : null,
- //descent : null,
- //cachedBoundingClientRectBBox : null,
- x : 0,
- y : 0,
- width : 0,
- height : 0,
- nextX : 0,
- nextY : 0,
- /** @expose */
- getDrawType : function() {
- return 1017;
- },
- /** @expose */
- getName : function() {
- return "textPath";
- },
- notifyAfterUpdate : function(type, subType, key, toValue, fromValue) {
- this.styleCache = null;
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.notifyAfterUpdate.call(this, type, subType, key, toValue, fromValue);
- },
- invalidateLayout : function() {
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.invalidateLayout.call(this);
- this.cachedBoundingClientRectBBox = null;
- },
- calculateBBox : function() {
- var clientRect = new com_ibm_rave_core_geom_RectStruct(this.x, this.y - this.ascent, this.width, this.height);
- if (this.rave_hasChildNodes()) {
- for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- var childRect = (child).calculateBBox();
- this.expandRect(childRect, clientRect);
- }
- }
- return new com_ibm_rave_core_geom_RaveRect(clientRect.x, clientRect.y, clientRect.width, clientRect.height);
- },
- getBoundingClientRectBBox : function() {
- if (!this.cachedBoundingClientRectBBox) {
- if (this.invalidLayout) {
- this.layout();
- }
- var clientRect = new com_ibm_rave_core_geom_RectStruct(this.x, this.y - this.ascent, this.width, this.height);
- if (this.rave_hasChildNodes()) {
- for (var __i_enFor0 = 0, __exp_enFor0 = this.getChildrenArray(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- var childRect = (child).getBoundingClientRectBBox();
- this.expandRect(childRect, clientRect);
- }
- }
- this.cachedBoundingClientRectBBox = new com_ibm_rave_core_geom_RaveRect(clientRect.x, clientRect.y, clientRect.width, clientRect.height);
- }
- return this.cachedBoundingClientRectBBox;
- },
- /**
- * Expand bounding box of rect2 to include positions of rect1 that are outside rect2 bounds. Modifies rect2 in place.
- * @param (com.ibm.rave.core.geom.RaveRect) rect1
- * @param (com.ibm.rave.core.geom.RectStruct) rect2
- */
- expandRect : function(rect1, rect2) {
- var currentX2 = rect2.x + rect2.width;
- var currentY2 = rect2.y + rect2.height;
- var childX2 = rect1.x + rect1.width;
- var childY2 = rect1.y + rect1.height;
- rect2.x = Math.min(rect1.x, rect2.x);
- rect2.y = Math.min(rect1.y, rect2.y);
- rect2.width = Math.max(currentX2, childX2) - rect2.x;
- rect2.height = Math.max(currentY2, childY2) - rect2.y;
- },
- /**
- * @return (com.ibm.rave.render.internal.style.FontStyle) An object representing the styles of this text node.
- */
- getFontStyle : function() {
- if (!this.styleCache) {
- this.styleCache = com_ibm_rave_render_internal_style_RenderStyleManager.getFont(this);
- }
- return this.styleCache;
- },
- /**
- * @return (com.ibm.rave.render.internal.style.ShadowStyle) An object representing the styles of this text node.
- */
- getShadow : function() {
- var result = this.getComputedStyleValue(46);
- if (!result) {
- result = com_ibm_rave_render_internal_style_ShadowStyle.parse(this.rave_getProperty("_rave_drop_shadow"));
- }
- result = (!result || "none" == result) ? null : result;
- return result;
- },
- /**
- * Return the text content.
- * @return (String) text content
- */
- getTextString : function() {
- return this.text;
- },
- /**
- * Returns the X position where this item will start drawing from. TODO: Does not yet take text direction into account.
- * @return (double) x position taking alignment into account.
- */
- getX : function() {
- return this.x;
- },
- getXOffset : function() {
- return + (this.rave_getParentNode().getAttribute("x")) + + (this.rave_getParentNode().getAttribute("dx"));
- },
- getYOffset : function() {
- return + (this.rave_getParentNode().getAttribute("y")) + + (this.rave_getParentNode().getAttribute("dy"));
- },
- /**
- * Returns the Y position where this item will start drawing from. This returns the text baseline
- * @return (double) y position
- */
- getY : function() {
- return this.y;
- },
- /** @expose */
- getSizePx : function(size) {
- var value = 0;
- if (size) {
- value = size.value;
- switch (size.unit.type) {
- case 1:
- return size.value * this.getFontStyle().getSize();
- default:
- return com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.rave_getSizePx.call(this, size);
- }
- }
- return value;
- },
- paint : function(renderer) {
- if (this.text != null && this.text.length > 0) {
- renderer.setStrokeAndFill(this);
- renderer.drawTextPath(this, this.getFilteredPath());
- }
- },
- /**
- * Will return a selector with all the path matching the provided id
- */
- getFilteredPath : function() {
- var pathID = (this.getAttribute("http://www.w3.org/1999/xlink:href"));
- var finalPathID = pathID.substring(1);
- var filteredPaths = com_ibm_rave_core_Rave.selectAll("path").filter(function(data, index, groupIndex) {
- return finalPathID == (this).getAttribute("id") ? true : false;
- });
- return filteredPaths;
- },
- doLayout : function() {
- this.calculateDimensions();
- this.nextX = this.x + this.width;
- this.nextY = this.y;
- this.invalidLayout = false;
- if (this.rave_hasChildNodes()) {
- for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(child, com_ibm_rave_render_internal_nodes_TSpanSceneItem)) {
- var achild = child;
- if (achild.invalidLayout) {
- achild.layout();
- }
- this.nextX = achild.nextX;
- this.nextY = achild.nextY;
- }
- }
- }
- },
- /**
- * When a textSceneItem is invalidated, if it has a tspanItem child, the child tspanItem needs to be invalidated too. This is necessary because tspan is generated internally, and the text style attribute is specified on text, not on its tspan children.
- */
- setDirty : function(dirty_, invalidateLayout) {
- if (dirty_ && invalidateLayout && this.rave_hasChildNodes()) {
- for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(child, com_ibm_rave_render_internal_nodes_TSpanSceneItem)) {
- (child).invalidateLayout();
- }
- }
- }
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.setDirty.call(this, dirty_, invalidateLayout);
- },
- /**
- * Perform dimension (x,y,width,height,etc) calculations only.
- */
- calculateDimensions : function() {
- this.computeStylesToRoot();
- var metrics = this.calculateMetrics();
- this.width = metrics["width"];
- var fontSize = this.getSizePx(this.getComputedCSSStyle(22).value);
- this.ascent = metrics["actualBoundingBoxAscent"];
- this.descent = metrics["actualBoundingBoxDescent"];
- if (undefined == this.ascent) {
- this.ascent = fontSize * .7 + fontSize * .1;
- }
- if (undefined == this.descent) {
- this.descent = fontSize * .3;
- }
- this.height = this.ascent + this.descent;
- if (!(com_ibm_rave_core_nativeImpl_Object.isInstanceOf(this.rave_getParentNode(), com_ibm_rave_render_internal_nodes_TextSceneItem))) {
- this.x = 0;
- this.y = 0;
- } else {
- this.x = this.calculateX();
- this.y = this.getSizePx((this.rave_getParentNode()).getComputedStyleValue(1)) + this.getSizePx((this.rave_getParentNode()).getComputedStyleValue(16));
- }
- },
- calculateX : function() {
- var parentCalculatedX = this.getSizePx((this.rave_getParentNode()).getComputedStyleValue(0));
- var anchor = this.getComputedStyleValue(27);
- if ("middle" == anchor) {
- parentCalculatedX -= this.width / 2;
- } else if ("end" == anchor) {
- parentCalculatedX -= this.width;
- }
- return parentCalculatedX + this.getSizePx((this.rave_getParentNode()).getComputedStyleValue(15));
- },
- calculateMetrics : function() {
- var context = com_ibm_rave_core_Rave.canvas.create(1, 1).getContext("2d");
- context.font = this.getFontStyle().toString();
- var tm = context.measureText(this.text);
- com_ibm_rave_core_Rave.canvas.disposeContext(context);
- return tm;
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/nodes/GroupSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
- //@import com/ibm/rave/core/transform/MatrixUtil (runtime) // transformBounds
- //@import com/ibm/rave/core/geom/RectStruct (runtime) // new
- //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
- var com_ibm_rave_render_internal_nodes_GroupSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
- isolated : false,
- /** @expose */
- rave_getName : function() {
- return "g";
- },
- /** @expose */
- rave_getDrawType : function() {
- return 1004;
- },
- rave_intersects : function(rect) {
- if (this.rave_hasChildNodes()) {
- return com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.rave_intersects.call(this, rect);
- }
- return false;
- },
- calculateBBox : function() {
- var x1, y1, x2, y2, cx2, cy2;
- x1 = y1 = x2 = y2 = 0;
- if (this.rave_hasChildNodes()) {
- x1 = y1 = Infinity;
- x2 = y2 = -Infinity;
- for (var __i_enFor0 = 0, __exp_enFor0 = this.getChildrenArray(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- var bb = child.getBBox();
- var x = bb.x;
- var y = bb.y;
- var w = bb.width;
- var h = bb.height;
- var t = (child).computeStyleValue(11);
- if (t) {
- var bstruct = com_ibm_rave_core_transform_MatrixUtil.transformBounds(new com_ibm_rave_core_geom_RectStruct(x, y, w, h), t);
- x = bstruct.x;
- y = bstruct.y;
- w = bstruct.width;
- h = bstruct.height;
- }
- cx2 = x + w;
- cy2 = y + h;
- if (x < x1) {
- x1 = x;
- }
- if (y < y1) {
- y1 = y;
- }
- if (cx2 > x2) {
- x2 = cx2;
- }
- if (cy2 > y2) {
- y2 = cy2;
- }
- }
- }
- return new com_ibm_rave_core_geom_RaveRect(x1, y1, x2 - x1, y2 - y1);
- },
- paint : function(renderer) {
- this.isolated = this.isolate();
- if (this.isolated) {
- renderer.push();
- }
- },
- postPaint : function(renderer) {
- if (this.isolated) {
- renderer.pop(this.getOpacity());
- }
- },
- doLayout : function() {},
- /**
- * Determine if we need to isolate the painting of the group: if we have opacity, we need to isolate the group by drawing into a new context, applying opacity, then drawing that image into the previous context.
- */
- isolate : function() {
- return this.getOpacity() < 1 ? true : false;
- },
- /**
- * Return the opacity of this stop from 0->1. Defaults to 1 (fully opaque)
- * @return (double) opacity of this stop from 0->1
- */
- getOpacity : function() {
- var oOpacity = this.getComputedStyleValue(30);
- return (oOpacity != null) ? (oOpacity) : 1;
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/nodes/PathSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
- //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/GeometricHelper (runtime) // new
- //@import com/ibm/rave/render/internal/style/RenderStyleManager (runtime) // getFill
- //@import com/ibm/rave/core/internal/nativeImpl/Lang (runtime) // isString
- //@import com/ibm/rave/render/internal/nodes/path/StringPathGenerator (runtime) // new
- //@import com/ibm/rave/core/internal/geo/PathActionPathGenerator (runtime) // new
- //@import com/ibm/rave/core/internal/geo/PathActionDrawingContext (runtime) // new
- /**
- * A translated implementation of an SVG path shape.
- */
- var com_ibm_rave_render_internal_nodes_PathSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
- //d : null,
- //pathString : null,
- calculateBBox : function() {
- if (!this.d) {
- return new com_ibm_rave_core_geom_RaveRect(0, 0, 0, 0);
- }
- var pathHandler = new com_ibm_rave_render_internal_nodes_GeometricHelper.PathHandler();
- this.d.draw(pathHandler);
- var shapes = pathHandler.getShapes();
- if (shapes.length == 0) {
- return new com_ibm_rave_core_geom_RaveRect(0, 0, 0, 0);
- }
- var bounds = shapes[0].getBounds();
- var xMin = bounds[0].x;
- var yMin = bounds[0].y;
- var xMax = bounds[1].x;
- var yMax = bounds[1].y;
- for (var i = 1; i < shapes.length; ++i) {
- bounds = shapes[i].getBounds();
- if (bounds[0].x < xMin) {
- xMin = bounds[0].x;
- }
- if (bounds[1].x > xMax) {
- xMax = bounds[1].x;
- }
- if (bounds[0].y < yMin) {
- yMin = bounds[0].y;
- }
- if (bounds[1].y > yMax) {
- yMax = bounds[1].y;
- }
- }
- return new com_ibm_rave_core_geom_RaveRect(xMin, yMin, xMax - xMin, yMax - yMin);
- },
- /** @expose */
- rave_getDrawType : function() {
- return 1006;
- },
- /** @expose */
- rave_getName : function() {
- return "path";
- },
- rave_intersects : function(rect) {
- var intersection = false;
- if (this.d) {
- var pathHandler = new com_ibm_rave_render_internal_nodes_GeometricHelper.PathHandler();
- this.d.draw(pathHandler);
- var shapes = pathHandler.getShapes();
- if (shapes.length == 0) {
- return false;
- }
- var hasFill = com_ibm_rave_render_internal_style_RenderStyleManager.getFill(this);
- for (var __i_enFor0 = 0, __exp_enFor0 = shapes, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var shape = __exp_enFor0[__i_enFor0];
- if (hasFill) {
- shape.setClosed();
- }
- if (shape.intersect$1(rect)) {
- if (this.intersectsClip(rect)) {
- intersection = !intersection;
- }
- }
- }
- }
- return intersection;
- },
- paint : function(renderer) {
- if (this.getPath()) {
- renderer.setStrokeAndFill(this);
- renderer.drawPath(this);
- }
- },
- /**
- * @return (com.ibm.rave.core.geo.PathGenerator) PathGenerator representing the current path.
- */
- getPath : function() {
- return this.d;
- },
- /**
- * If this path was populated via an SVG path as a string, this will return the original string. null if a PathDrawingContext was used to populate.
- * @return (String) String SVG path used to originally populate this path object. null otherwise.
- */
- getPathString : function() {
- return this.pathString;
- },
- /** @expose */
- rave_initExtensions : function() {
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.rave_initExtensions.call(this);
- var origSetAttr = this.setAttribute;
- var self = this;
- this.setAttribute = function(key, value) {
- origSetAttr.call(this, key, value);
- if (value != null && "d" == key) {
- var internalVal = self.attributes.getByIndex(16);
- self.pathString = null;
- if (com_ibm_rave_core_internal_nativeImpl_Lang.isString(internalVal)) {
- self.pathString = ""+(internalVal);
- self.d = new com_ibm_rave_render_internal_nodes_path_StringPathGenerator(self.getPathString());
- } else {
- self.d = new com_ibm_rave_core_internal_geo_PathActionPathGenerator();
- if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(internalVal, com_ibm_rave_core_internal_geo_PathActionDrawingContext)) {
- self.d.context(internalVal);
- }
- }
- } else if (value != null && "points" == key) {
- var internalVal = self.attributes.getByIndex(17);
- self.pathString = ""+(internalVal);
- self.d = new com_ibm_rave_render_internal_nodes_path_StringPathGenerator(self.getPathString());
- }
- };
- },
- doLayout : function() {}
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/nodes/path/StringPathGenerator
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/path/Path2DParser (runtime) // new
- /**
- * A PathGenerator that first parses an SVG path and then calls the Path commands on it. This is used in Path rendering to take an SVG path and create path shapes out of it.
- */
- var com_ibm_rave_render_internal_nodes_path_StringPathGenerator = com_ibm_rave_core_nativeImpl_Declare({
- //path : null,
- _$functionClassMethod : function() {
- var _$self = function(data, index, groupIndex) {
- return null;
- };
- return _$self;
- },
- /**
- * @param (String) path The SVG Path string to parse.
- */
- constructor : function(path) {
- this.path = path;
- },
- context$0 : function() {
- return null;
- },
- context$1 : function(context) {
- return this;
- },
- /** @expose */
- draw : function(path2dHandler) {
- new com_ibm_rave_render_internal_nodes_path_Path2DParser(path2dHandler).parse(this.path);
- },
- /** @expose */
- context : function(a0) {
- var args = arguments;
- if (args.length == 0) {
- return this.context$0();
- }
- return this.context$1(a0);
- }
- });
- // $source: com/ibm/rave/render/internal/nodes/path/Path2DParser
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * SVG path parser.
- */
- var com_ibm_rave_render_internal_nodes_path_Path2DParser = com_ibm_rave_core_nativeImpl_Declare({
- //path : null,
- //d : null,
- currentX : 0, currentY : 0, xCenter : 0, yCenter : 0,
- idx : 0,
- dLength : 0,
- fail : false,
- currentChar : 0,
- currentCharIdx : -1,
- constructor : function(path) {
- this.path = path;
- },
- parse : function(pathString) {
- if (pathString != null) {
- this.currentX = this.currentY = this.xCenter = this.yCenter = this.idx = 0;
- this.currentChar = 0;
- this.currentCharIdx = -1;
- this.d = pathString;
- this.dLength = pathString.length;
- this.path.startPath();
- for (; this.idx < this.dLength;) {
- this.fail = false;
- this.skipWhitespace();
- switch (this.getChar(this.idx++)) {
- case 109:
- this._moveTo(false);
- break;
- case 77:
- this._moveTo(true);
- break;
- case 108:
- this._lineTo(false, true, true);
- break;
- case 76:
- this._lineTo(true, true, true);
- break;
- case 99:
- this._bezierCurveTo(false, false);
- break;
- case 67:
- this._bezierCurveTo(true, false);
- break;
- case 115:
- this._bezierCurveTo(false, true);
- break;
- case 83:
- this._bezierCurveTo(true, true);
- break;
- case 113:
- this._quadraticCurveTo(false, false);
- break;
- case 81:
- this._quadraticCurveTo(true, false);
- break;
- case 116:
- this._quadraticCurveTo(false, true);
- break;
- case 84:
- this._quadraticCurveTo(true, true);
- break;
- case 104:
- this._lineTo(false, false, true);
- break;
- case 72:
- this._lineTo(true, false, true);
- break;
- case 118:
- this._lineTo(false, true, false);
- break;
- case 86:
- this._lineTo(true, true, false);
- break;
- case 97:
- this._arcTo(false);
- break;
- case 65:
- this._arcTo(true);
- break;
- case 122:
- case 90:
- this.path.closePath();
- break;
- default:
- this.path.fail(this.idx - 1);
- return;
- }
- }
- }
- },
- /**
- * Skips 4 different types of whitespace characters: <ul> <li>space</li> <li>line feed</li> <li>tab</li> <li>carriage return</li>
- */
- skipWhitespace : function() {
- while (this.idx < this.dLength) {
- switch (this.getChar(this.idx)) {
- case 32:
- case 13:
- case 10:
- case 9:
- this.idx++;
- break;
- default:
- return;
- }
- }
- },
- /**
- * Skips whitespace following by an optional comma and additional whitespace.
- */
- skipWhitespaceComma : function() {
- this.skipWhitespace();
- if (this.idx < this.dLength && this.getChar(this.idx) == 44) {
- this.idx++;
- this.skipWhitespace();
- }
- },
- /**
- * Increments the index if a '-' or '+' sign is identified.
- */
- sign : function() {
- if (this.idx < this.dLength) {
- var c = this.getChar(this.idx);
- if (c == 45 || c == 43) {
- this.idx++;
- }
- }
- },
- /**
- * Increments the index for each digit found.
- * @param (boolean) optional whether or not a digit sequence is optional
- */
- digitSequence : function(optional) {
- var found = optional;
- while (this.idx < this.dLength) {
- switch (this.getChar(this.idx)) {
- case 48:
- case 49:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- this.idx++;
- found = true;
- break;
- default:
- if (!optional && !found) {
- this.fail = true;
- }
- return;
- }
- }
- },
- /**
- * Increments the index if an exponent is found starting with 'e' or 'E' followed by an sign optional sign and required digits.
- */
- exponent : function() {
- if (this.idx < this.dLength) {
- var c = this.getChar(this.idx);
- if (c == 101 || c == 69) {
- this.idx++;
- this.sign();
- this.digitSequence(false);
- }
- }
- },
- /**
- * Parse a number returning the value or NaN if parse failed. The starting index is provided such that other methods can consume the sign if necessary.
- * @param (int) start the starting index of the number
- * @return (double) the parsed number
- */
- parseNumber : function(start) {
- this.digitSequence(true);
- if (this.idx < this.dLength && this.getChar(this.idx) == 46) {
- this.idx++;
- this.digitSequence(false);
- if (this.fail) {
- return NaN;
- }
- }
- if (this.idx < this.dLength) {
- this.exponent();
- }
- if (this.idx == start) {
- this.fail = true;
- return NaN;
- }
- var result = parseFloat(this.d.substring(start, this.idx));
- this.fail = isNaN(result);
- return result;
- },
- /**
- * Parse a number with optional sign.
- * @return (double) the parsed number
- */
- number : function() {
- var start = this.idx;
- this.sign();
- return this.parseNumber(start);
- },
- /**
- * Parse a positive number with optional '+' sign.
- * @return (double) the parsed number
- */
- nonNegativeNumber : function() {
- var start = this.idx;
- if (this.idx < this.dLength && this.getChar(this.idx) == 43) {
- this.idx++;
- }
- return this.parseNumber(start);
- },
- /**
- * Parse a number with optional preceding whitespace and comma.
- * @return (double) the parsed number
- */
- whitespaceCommaNumber : function() {
- this.skipWhitespaceComma();
- return this.number();
- },
- /**
- * Parse a number with optional preceding whitespace and comma.
- * @param (boolean) noComma whether or a not a comma is allow or not
- * @return (double) the parsed number
- */
- whitespaceOptCommaNumber : function(noComma) {
- if (noComma) {
- this.skipWhitespace();
- } else {
- this.skipWhitespaceComma();
- }
- return this.number();
- },
- /**
- * Parse a positive number with optional preceding whitespace and comma.
- * @return (double) the parsed number
- */
- whitespaceCommaNonNegativeNumber : function() {
- this.skipWhitespaceComma();
- return this.nonNegativeNumber();
- },
- /**
- * Parse a positive number with optional preceding whitespace and comma.
- * @param noComma whether or a not a comma is allow or not
- * @return (double) the parsed number
- */
- whitespaceOptCommaNonNegativeNumber : function(firstNumber) {
- if (firstNumber) {
- this.skipWhitespace();
- } else {
- this.skipWhitespaceComma();
- }
- return this.nonNegativeNumber();
- },
- /**
- * Parse an integer flag. A parsed value of 1 is 'true' while a parsed value of 0 is 'false'.
- * @return (boolean) the parsed flag
- */
- flag : function() {
- this.skipWhitespaceComma();
- var result = true;
- if (this.idx < this.dLength) {
- var c = this.getChar(this.idx);
- if (c == 48) {
- result = false;
- } else if (c != 49) {
- this.fail = true;
- }
- } else {
- this.fail = true;
- }
- if (!this.fail) {
- this.idx++;
- }
- return result;
- },
- _moveTo : function(absolute) {
- this.skipWhitespace();
- var x = this.number();
- if (this.fail) {
- return;
- }
- var y = this.whitespaceCommaNumber();
- if (this.fail) {
- return;
- }
- if (!absolute) {
- x += this.currentX;
- y += this.currentY;
- }
- this.path.moveTo(x, y);
- this.xCenter = this.currentX = x;
- this.yCenter = this.currentY = y;
- this.skipWhitespaceComma();
- this._lineTo(absolute, true, true);
- },
- _lineTo : function(absolute, vertical, horizontal) {
- var noComma = true;
- for (;;) {
- var x = 0, y = 0;
- if (horizontal) {
- x = this.whitespaceOptCommaNumber(noComma);
- noComma = false;
- if (this.fail) {
- return;
- }
- if (!absolute) {
- x += this.currentX;
- }
- } else {
- x = this.currentX;
- }
- if (vertical) {
- y = this.whitespaceOptCommaNumber(noComma);
- if (this.fail) {
- return;
- }
- if (!absolute) {
- y += this.currentY;
- }
- } else {
- y = this.currentY;
- }
- this.path.lineTo(x, y);
- this.xCenter = this.currentX = x;
- this.yCenter = this.currentY = y;
- noComma = false;
- }
- },
- _quadraticCurveTo : function(absolute, usePreviousCP) {
- var noComma = true;
- var cpx, cpy, x, y;
- for (;;) {
- if (usePreviousCP) {
- cpx = 2 * this.currentX - this.xCenter;
- cpy = 2 * this.currentY - this.yCenter;
- } else {
- cpx = this.whitespaceOptCommaNumber(noComma);
- noComma = false;
- if (this.fail) {
- return;
- }
- cpy = this.whitespaceCommaNumber();
- if (this.fail) {
- return;
- }
- }
- x = this.whitespaceOptCommaNumber(noComma);
- if (this.fail) {
- return;
- }
- y = this.whitespaceCommaNumber();
- if (this.fail) {
- return;
- }
- if (!absolute) {
- x += this.currentX;
- y += this.currentY;
- }
- this.path.quadraticCurveTo(cpx, cpy, x, y);
- this.currentX = x;
- this.currentY = y;
- this.xCenter = cpx;
- this.yCenter = cpy;
- noComma = false;
- }
- },
- _bezierCurveTo : function(absolute, usePreviousCP) {
- var noComma = true;
- var cpx1, cpy1, cpx2, cpy2, x, y;
- for (;;) {
- if (usePreviousCP) {
- cpx1 = 2 * this.currentX - this.xCenter;
- cpy1 = 2 * this.currentY - this.yCenter;
- } else {
- cpx1 = this.whitespaceOptCommaNumber(noComma);
- noComma = false;
- if (this.fail) {
- return;
- }
- cpy1 = this.whitespaceCommaNumber();
- if (this.fail) {
- return;
- }
- }
- cpx2 = this.whitespaceOptCommaNumber(noComma);
- if (this.fail) {
- return;
- }
- cpy2 = this.whitespaceCommaNumber();
- if (this.fail) {
- return;
- }
- x = this.whitespaceCommaNumber();
- if (this.fail) {
- return;
- }
- y = this.whitespaceCommaNumber();
- if (this.fail) {
- return;
- }
- if (!absolute) {
- cpx1 += this.currentX;
- cpy1 += this.currentY;
- cpx2 += this.currentX;
- cpy2 += this.currentY;
- x += this.currentX;
- y += this.currentY;
- }
- this.path.bezierCurveTo(cpx1, cpy1, cpx2, cpy2, x, y);
- this.currentX = x;
- this.currentY = y;
- this.xCenter = cpx2;
- this.yCenter = cpy2;
- noComma = false;
- }
- },
- _arcTo : function(absolute) {
- var noComma = true, largeArcFlag, sweepFlag;
- var rx, ry, xAxisRotation, x, y;
- for (;;) {
- rx = this.whitespaceOptCommaNonNegativeNumber(noComma);
- if (this.fail) {
- return;
- }
- ry = this.whitespaceCommaNonNegativeNumber();
- if (this.fail) {
- return;
- }
- xAxisRotation = this.whitespaceCommaNumber();
- if (this.fail) {
- return;
- }
- largeArcFlag = this.flag();
- if (this.fail) {
- return;
- }
- sweepFlag = this.flag();
- if (this.fail) {
- return;
- }
- x = this.whitespaceCommaNumber();
- if (this.fail) {
- return;
- }
- y = this.whitespaceCommaNumber();
- if (this.fail) {
- return;
- }
- if (!absolute) {
- x += this.currentX;
- y += this.currentY;
- }
- if (this.currentX != x || this.currentY != y) {
- if (rx == 0 || ry == 0) {
- this.path.lineTo(x, y);
- } else {
- this.path.arcTo(this.currentX, this.currentY, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y);
- }
- this.xCenter = this.currentX = x;
- this.yCenter = this.currentY = y;
- }
- noComma = false;
- }
- },
- getChar : function(i) {
- if (this.currentCharIdx != i) {
- this.currentCharIdx = i;
- this.currentChar = this.d.charCodeAt(i);
- }
- return this.currentChar;
- }
- });
- // $source: com/ibm/rave/core/internal/geo/PathActionPathGenerator
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * A PathGenerator that is used to create a PathAction data structure from DrawContext commands.
- */
- var com_ibm_rave_core_internal_geo_PathActionPathGenerator = com_ibm_rave_core_nativeImpl_Declare({
- //drawingContext : null,
- _$functionClassMethod : function() {
- var _$self = function(data, index, groupIndex) {
- return null;
- };
- return _$self;
- },
- context$0 : function() {
- return this.drawingContext;
- },
- context$1 : function(context) {
- this.drawingContext = context;
- return this;
- },
- /** @expose */
- draw : function(path2dHandler) {
- var currentX = 0;
- var currentY = 0;
- for (var __i_enFor0 = 0, __exp_enFor0 = (this.drawingContext).actions, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var action = __exp_enFor0[__i_enFor0];
- switch (action.type()) {
- case 1:
- currentX = action.x;
- currentY = action.y;
- path2dHandler.moveTo(action.x, action.y);
- break;
- case 2:
- path2dHandler.lineTo(action.x, action.y);
- break;
- case 3:
- var radius = (action).radius;
- path2dHandler.arcTo(currentX, currentY, radius, radius, 0, false, false, action.x, action.y);
- break;
- }
- }
- },
- /** @expose */
- context : function(a0) {
- var args = arguments;
- if (args.length == 0) {
- return this.context$0();
- }
- return this.context$1(a0);
- }
- });
- // $source: com/ibm/rave/render/internal/nodes/PolygonSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/PathSceneItem (loadtime) // superclass
- /**
- * A translated implementation of an SVG polygon shape.
- */
- var com_ibm_rave_render_internal_nodes_PolygonSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_PathSceneItem, {
- /** @expose */
- rave_getDrawType : function() {
- return 1010;
- },
- /** @expose */
- rave_getName : function() {
- return "polygon";
- },
- paint : function(renderer) {
- var points = this.attributes.getByIndex(17);
- if (points != null && points.length > 0) {
- renderer.setStrokeAndFill(this);
- renderer.drawPath(this);
- }
- },
- getPathString : function() {
- var points = this.attributes.getByIndex(17);
- return 'M' + points + 'Z';
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/nodes/PolylineSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/PathSceneItem (loadtime) // superclass
- /**
- * A translated implementation of an SVG polyline shape.
- */
- var com_ibm_rave_render_internal_nodes_PolylineSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_PathSceneItem, {
- /** @expose */
- rave_getDrawType : function() {
- return 1009;
- },
- /** @expose */
- rave_getName : function() {
- return "polyline";
- },
- paint : function(renderer) {
- var points = this.attributes.getByIndex(17);
- if (points != null && points.length > 0) {
- renderer.setStrokeAndFill(this);
- renderer.drawPath(this);
- }
- },
- getPathString : function() {
- var points = this.attributes.getByIndex(17);
- return 'M' + points;
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/nodes/DefsSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
- //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
- /**
- * A scene node representing an SVG "defs" node. May contain other shapes, gradient declarations, clips, etc.
- */
- var com_ibm_rave_render_internal_nodes_DefsSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
- /** @expose */
- rave_getName : function() {
- return "defs";
- },
- /** @expose */
- rave_getDrawType : function() {
- return 1015;
- },
- isDrawable : function() {
- return false;
- },
- calculateBBox : function() {
- return new com_ibm_rave_core_geom_RaveRect(0, 0, 0, 0);
- },
- paint : function(renderer) {},
- doLayout : function() {}
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/nodes/GradientSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
- //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
- //@import com/ibm/rave/core/Rave (runtime) // Rave
- /**
- * Abstract class with code common to gradient scene items (gradient and linear)
- */
- var com_ibm_rave_render_internal_nodes_GradientSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
- calculateBBox : function() {
- return new com_ibm_rave_core_geom_RaveRect(0, 0, 0, 0);
- },
- /** @expose */
- rave_getSizePx : function(size) {
- var value = 0;
- if (size) {
- value = size.value;
- switch (size.unit.type) {
- case 2:
- value = value / 100;
- break;
- }
- }
- return value;
- },
- paint : function(renderer) {},
- doLayout : function() {},
- getLocalXValue : function(val, node) {
- var rect = node.getBBox();
- return (com_ibm_rave_core_Rave.scale.linear().range([rect.x, rect.x + rect.width]).call(this, val, -1, -1));
- },
- getLocalYValue : function(val, node) {
- var rect = node.getBBox();
- return (com_ibm_rave_core_Rave.scale.linear().range([rect.y, rect.y + rect.height]).call(this, val, -1, -1));
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/nodes/LinearGradientSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/GradientSceneItem (loadtime) // superclass
- //@import com/ibm/rave/core/internal/svg/SVGConstants (runtime) // SVGConstants
- var com_ibm_rave_render_internal_nodes_LinearGradientSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_GradientSceneItem, {
- /** @expose */
- rave_getName : function() {
- return com_ibm_rave_core_internal_svg_SVGConstants.LINEARGRADIENT;
- },
- isDrawable : function() {
- return false;
- },
- /**
- * Returns the 0->1 x1 property in user space coordinates. Bases it on the bounding box of the passed in node. This is typically the scene node to which the gradient is being applied.
- * @param (com.ibm.rave.core.scene.SceneNode) node Bounding box to determine user space coordinate.
- * @return (double) user space coordinate of 0->1 x1 value.
- */
- getX1 : function(node) {
- var x1 = this.rave_getSizePx(this.computeCSSStyle(4).value);
- return this.getLocalXValue(x1, node);
- },
- /**
- * Returns the 0->1 x2 property in user space coordinates. Bases it on the bounding box of the passed in node. This is typically the scene node to which the gradient is being applied.
- * @param (com.ibm.rave.core.scene.SceneNode) node Bounding box to determine user space coordinate.
- * @return (double) user space coordinate of 0->1 x2 value.
- */
- getX2 : function(node) {
- var x2 = this.rave_getSizePx(this.computeCSSStyle(5).value);
- return this.getLocalXValue(x2, node);
- },
- /**
- * Returns the 0->1 y1 property in user space coordinates. Bases it on the bounding box of the passed in node. This is typically the scene node to which the gradient is being applied.
- * @param (com.ibm.rave.core.scene.SceneNode) node Bounding box to determine user space coordinate.
- * @return (double) user space coordinate of 0->1 y1 value.
- */
- getY1 : function(node) {
- var y1 = this.rave_getSizePx(this.computeCSSStyle(7).value);
- return this.getLocalYValue(y1, node);
- },
- /**
- * Returns the 0->1 y2 property in user space coordinates. Bases it on the bounding box of the passed in node. This is typically the scene node to which the gradient is being applied.
- * @param (com.ibm.rave.core.scene.SceneNode) node Bounding box to determine user space coordinate.
- * @return (double) user space coordinate of 0->1 x2 value.
- */
- getY2 : function(node) {
- var y2 = this.rave_getSizePx(this.computeCSSStyle(8).value);
- return this.getLocalYValue(y2, node);
- },
- /** @expose */
- rave_getDrawType : function() {
- return 1011;
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/nodes/RadialGradientSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/GradientSceneItem (loadtime) // superclass
- //@import com/ibm/rave/core/internal/svg/SVGConstants (runtime) // SVGConstants
- //@import com/ibm/rave/core/Rave (runtime) // Rave
- var com_ibm_rave_render_internal_nodes_RadialGradientSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_GradientSceneItem, {
- /** @expose */
- rave_getName : function() {
- return com_ibm_rave_core_internal_svg_SVGConstants.RADIALGRADIENT;
- },
- isDrawable : function() {
- return false;
- },
- /** @expose */
- rave_getDrawType : function() {
- return 1012;
- },
- /**
- * Returns the 0->1 cx (center x) property in user space coordinates. Bases it on the bounding box of the passed in node. This is typically the scene node to which the gradient is being applied.
- * @param (com.ibm.rave.core.scene.SceneNode) node Bounding box to determine user space coordinate.
- * @return (double) user space coordinate of 0->1 cx value.
- */
- getCX : function(node) {
- var cx = this.rave_getSizePx(this.computeCSSStyle(9).value);
- return this.getLocalXValue(cx, node);
- },
- /**
- * Returns the 0->1 cy (center y) property in user space coordinates. Bases it on the bounding box of the passed in node. This is typically the scene node to which the gradient is being applied.
- * @param (com.ibm.rave.core.scene.SceneNode) node Bounding box to determine user space coordinate.
- * @return (double) user space coordinate of 0->1 cy value.
- */
- getCY : function(node) {
- var cy = this.rave_getSizePx(this.computeCSSStyle(10).value);
- return this.getLocalYValue(cy, node);
- },
- /**
- * Returns the 0->1 radius property in user space coordinates. Bases it on the bounding box of the passed in node. This is typically the scene node to which the gradient is being applied.
- * @param (com.ibm.rave.core.scene.SceneNode) node Bounding box to determine user space coordinate.
- * @return (double) user space coordinate of 0->1 radius value.
- */
- getR : function(node) {
- var r = this.rave_getSizePx(this.computeCSSStyle(6).value);
- var rect = node.getBBox();
- return (com_ibm_rave_core_Rave.scale.linear().range([0, rect.width]).call(this, r, -1, -1));
- },
- /**
- * Returns the 0->1 fx (focal point x) property in user space coordinates. Bases it on the bounding box of the passed in node. This is typically the scene node to which the gradient is being applied.
- * @param (com.ibm.rave.core.scene.SceneNode) node Bounding box to determine user space coordinate.
- * @return (double) user space coordinate of 0->1 fx value.
- */
- getFX : function(node) {
- var fx = this.rave_getSizePx(this.computeCSSStyle(18).value);
- return this.getLocalXValue(fx, node);
- },
- /**
- * Returns the 0->1 fy (focal point y) property in user space coordinates. Bases it on the bounding box of the passed in node. This is typically the scene node to which the gradient is being applied.
- * @param (com.ibm.rave.core.scene.SceneNode) node Bounding box to determine user space coordinate.
- * @return (double) user space coordinate of 0->1 fy value.
- */
- getFY : function(node) {
- var fy = this.rave_getSizePx(this.computeCSSStyle(19).value);
- return this.getLocalYValue(fy, node);
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/nodes/StopSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/GradientSceneItem (loadtime) // superclass
- //@import com/ibm/rave/core/Rave (runtime) // rgb
- var com_ibm_rave_render_internal_nodes_StopSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_GradientSceneItem, {
- /** @expose */
- rave_getName : function() {
- return "stop";
- },
- /** @expose */
- rave_getDrawType : function() {
- return 1016;
- },
- /**
- * Return the stop color as an RGB color.
- * @return (com.ibm.rave.core.color.RGB) RGB representation of the stop color.
- */
- getColor : function() {
- return com_ibm_rave_core_Rave.rgb(this.getAttribute("stop-color"));
- },
- /**
- * Returns the 0->1 offset property in user space coordinates. Bases it on the bounding box of the passed in node. This is typically the scene node to which the gradient is being applied.
- * @return (double) user space coordinate of 0->1 offset value.
- */
- getOffset : function() {
- return this.rave_getSizePx(this.computeCSSStyle(17).value);
- },
- /**
- * Return the opacity of this stop from 0->1. Defaults to 1 (fully opaque)
- * @return (double) opacity of this stop from 0->1
- */
- getOpacity : function() {
- return (this.getComputedStyleValue(41));
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/nodes/ImageSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/RectSceneItem (loadtime) // superclass
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (runtime)
- /**
- * An SVG-like image node. <image x="0" y="0" height="50px" width="50px" xlink:href="cat.jpg" />
- */
- var com_ibm_rave_render_internal_nodes_ImageSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_RectSceneItem, {
- IMAGE_CACHE_KEY : "__rave__image",
- href : "",
- /** @expose */
- getName : function() {
- return "image";
- },
- /** @expose */
- getDrawType : function() {
- return 1007;
- },
- paint : function(renderer) {
- renderer.setStrokeAndFill(this);
- renderer.drawImage(this);
- },
- /** @expose */
- setAttributeNS : function(namespace, attribute, value) {
- if (attribute == "href") {
- this.rave_setProperty(this.IMAGE_CACHE_KEY, null);
- this.href = value == null ? "" : ""+(value);
- }
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.setAttributeNS.call(this, namespace, attribute, value);
- },
- /**
- * Return the href attribute containing the URL for this image.
- * @return (String) href attribute containing the image URL. Returns "" if no attribute set.
- */
- getHref : function() {
- return this.href;
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/nodes/EllipseSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
- //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/GeometricHelper (runtime) // new
- /**
- * Ellipse shape.
- */
- var com_ibm_rave_render_internal_nodes_EllipseSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
- cx : 0,
- cy : 0,
- rx : 0,
- ry : 0,
- calculateBBox : function() {
- return new com_ibm_rave_core_geom_RaveRect(this.cx - this.rx, this.cy - this.ry, this.rx * 2, this.ry * 2);
- },
- /** @expose */
- rave_getDrawType : function() {
- return 1013;
- },
- /** @expose */
- rave_getName : function() {
- return "ellipse";
- },
- getCx : function() {
- return this.cx;
- },
- getCy : function() {
- return this.cy;
- },
- getRx : function() {
- return this.rx;
- },
- getRy : function() {
- return this.ry;
- },
- rave_intersects : function(rect) {
- var kappa = 0.5522848;
- var ox = this.rx * kappa;
- var oy = this.ry * kappa;
- var pathHandler = new com_ibm_rave_render_internal_nodes_GeometricHelper.PathHandler();
- pathHandler.moveTo(this.cx - this.rx, this.cy);
- pathHandler.bezierCurveTo(this.cx - this.rx, this.cy - oy, this.cx - ox, this.cy - this.ry, this.cx, this.cy - this.ry);
- pathHandler.bezierCurveTo(this.cx + ox, this.cy - this.ry, this.cx + this.rx, this.cy - oy, this.cx + this.rx, this.cy);
- pathHandler.bezierCurveTo(this.cx + this.rx, this.cy + oy, this.cx + ox, this.cy + this.ry, this.cx, this.cy + this.ry);
- pathHandler.bezierCurveTo(this.cx - ox, this.cy + this.ry, this.cx - this.rx, this.cy + oy, this.cx - this.rx, this.cy);
- pathHandler.closePath();
- var shapes = pathHandler.getShapes();
- return shapes[0].intersect$1(rect) && this.intersectsClip(rect);
- },
- paint : function(renderer) {
- renderer.setStrokeAndFill(this);
- renderer.drawEllipse(this);
- },
- doLayout : function() {
- this.cx = this.rave_getSizePx(this.getComputedCSSStyle(9).value);
- this.cy = this.rave_getSizePx(this.getComputedCSSStyle(10).value);
- this.rx = this.rave_getSizePx(this.getComputedCSSStyle(12).value);
- this.ry = this.rave_getSizePx(this.getComputedCSSStyle(13).value);
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/nodes/ClipPathSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/GroupSceneItem (loadtime) // superclass
- /**
- * Clip path shape.
- */
- var com_ibm_rave_render_internal_nodes_ClipPathSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_GroupSceneItem, {
- isDrawable : function() {
- return false;
- },
- /** @expose */
- rave_getDrawType : function() {
- return 1014;
- },
- /** @expose */
- rave_getName : function() {
- return "clipPath";
- },
- paint : function(renderer) {
- renderer.addClip(this);
- },
- doLayout : function() {
- for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- (child).doLayout();
- }
- },
- rave_intersects : function(rect) {
- if (this.rave_hasChildNodes()) {
- if ("none" == this.computeStyleValue(26) || "none" == this.getComputedStyleValue(42)) {
- return false;
- }
- for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- if ((child).rave_intersects(rect)) {
- return true;
- }
- }
- }
- return false;
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/nodes/GenericSceneNode
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/GroupSceneItem (loadtime) // superclass
- //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
- /**
- * A generic node, which does not render
- */
- var com_ibm_rave_render_internal_nodes_GenericSceneNode = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_GroupSceneItem, {
- //_name : null,
- //_bBox : null,
- constructor : function(nsuri, context, name) {
- this._bBox = new com_ibm_rave_core_geom_RaveRect(0, 0, 0, 0);
- {
- this._name = name;
- }
- },
- /** @expose */
- getName : function() {
- return this._name;
- },
- intersects : function(rect) {
- return false;
- },
- /** @expose */
- getBBox : function() {
- return this._bBox;
- },
- calculateBBox : function() {
- return this._bBox;
- }
- });
- // $source: com/ibm/rave/render/internal/nodes/RootSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/GroupSceneItem (loadtime) // superclass
- //@import com/ibm/rave/render/internal/RendererConfiguration (runtime) // RendererConfiguration
- /**
- * A root scene item
- */
- var com_ibm_rave_render_internal_nodes_RootSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_GroupSceneItem, {
- //renderer : null,
- //cacheManager : null,
- constructor : function(nsuri, context) {
- this.setSceneTreeContext(this);
- },
- /** @expose */
- rave_getName : function() {
- return "root";
- },
- /** @expose */
- rave_dispose : function() {
- com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.removeRootProviderForNode(this.rave_getOwner());
- },
- /** @expose */
- rave_getDrawType : function() {
- return -1;
- },
- rave_intersects : function(rect) {
- return true;
- },
- getRenderer : function() {
- return this.renderer;
- },
- setRenderer : function(renderer) {
- this.renderer = renderer;
- },
- getCacheManager : function() {
- return this.cacheManager;
- },
- setCacheManager : function(cacheManager) {
- this.cacheManager = cacheManager;
- }
- });
- // $source: com/ibm/rave/render/AbstractRenderer
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/DirtyRegionManager (runtime) // new
- //@import com/ibm/rave/core/context/RaveOperationalMode (runtime) // RaveOperationalMode
- //@import com/ibm/rave/core/Rave (runtime) // Rave
- //@import com/ibm/rave/render/internal/nodes/NodeUtil (runtime) // findSceneNode
- //@import com/ibm/rave/render/internal/style/RenderStyleManager (runtime) // getStroke, getFill
- /**
- * An abstract implementation of a renderer. Takes care of a number of details so specific renderers don't have to.
- */
- var com_ibm_rave_render_AbstractRenderer = rave_externs["AbstractRenderer"] = com_ibm_rave_core_nativeImpl_Declare({
- //dirtyManager : null,
- /** @expose */
- root : null,
- //eventManager : null,
- drawRunning : false,
- lastDrawTime : 0,
- lastWidth : 0,
- lastHeight : 0,
- /** @expose */
- isDirtyRegionEnabled : function() {
- return this.dirtyManager;
- },
- /**
- * Under certain circumstances, enabling dirty region support can improve interaction performance. Consider enabling dirty regions if the following applies: <ul> <li>Interaction feedback feels lagged.</li> <li>The visualization contains many elements.</li> <li>Scene changes are contained within smaller areas where repainting the entire scene is unnecessary.</li> </ul> To enable dirty regions, set the 'rave-dirtyRegions' property to <code>true</code>.
- * @return (boolean) <code>true</code> if the flag is set on the root node, <code>false</code> otherwise
- */
- /** @expose */
- getDirtyRegionFlagFromRoot : function() {
- return (this.root.rave_getProperty("rave-dirtyRegions"));
- },
- /** @expose */
- getWidth : function() {
- return + (this.root.getAttribute("width"));
- },
- /** @expose */
- getHeight : function() {
- return + (this.root.getAttribute("height"));
- },
- /**
- * By default repaint just calls render() to re-render the whole scene.
- */
- /** @expose */
- repaint : function() {
- if (this.getDirtyRegionFlagFromRoot()) {
- if (!this.dirtyManager) {
- this.dirtyManager = new com_ibm_rave_render_internal_DirtyRegionManager();
- }
- } else {
- this.dirtyManager = null;
- }
- var width = this.getWidth();
- var height = this.getHeight();
- if (this.dirtyManager && (width != this.lastWidth || height != this.lastHeight)) {
- this.dirtyManager.forceRedraw();
- }
- this.start(!this.dirtyManager || this.dirtyManager.globalDirty);
- this.render(this.root);
- this.finish();
- this.lastWidth = width;
- this.lastHeight = height;
- },
- /** @expose */
- constructor : function(root) {
- this.root = root;
- },
- /**
- * Makes the scene dirty due to changes in the given node. If dirty regions are enabled, updates the dirty region with the bounds of the given node.
- * @param (com.ibm.rave.render.internal.nodes.AbstractSceneNode) node the node which causes the scene to be dirty
- */
- /** @expose */
- makeDirty : function(node) {
- if (this.dirtyManager) {
- this.dirtyManager.add(node);
- }
- },
- /** @expose */
- createEventManager : function() {},
- /** @expose */
- registerEvent : function(eventType, node) {
- if (!this.eventManager) {
- this.eventManager = this.createEventManager();
- }
- this.eventManager.registerEvent(eventType, node);
- },
- /** @expose */
- unregisterEvent : function(eventType, node) {
- if (this.eventManager) {
- this.eventManager.unregisterEvent(eventType, node);
- }
- },
- /** @expose */
- handleDrawEvent : function(type, item) {
- if (com_ibm_rave_core_context_RaveOperationalMode.MODE != 1) {
- if (!this.drawRunning) {
- this.drawRunning = true;
- var renderer = this;
- var event = function(elapsed) {
- renderer.repaint();
- renderer.lastDrawTime = Date.now();
- renderer.drawRunning = false;
- return true;
- };
- var diff = Date.now() - this.lastDrawTime;
- var delay = (diff > 15) ? 0 : diff;
- com_ibm_rave_core_Rave.timer(event, delay);
- }
- }
- },
- /** @expose */
- render : function(node) {
- var anode = node;
- var parentNode = node;
- while (parentNode.rave_getParentNode()) {
- parentNode = parentNode.rave_getParentNode();
- }
- this.recursiveComputeStyles(parentNode);
- var dirtyClip;
- if (this.dirtyManager && !(this.dirtyManager.globalDirty)) {
- dirtyClip = this.dirtyManager.getClip();
- if (dirtyClip) {
- this.saveGraphicsState();
- this.addRectClip(dirtyClip);
- this.clearRect(dirtyClip);
- }
- }
- this.doRender(anode);
- if (this.dirtyManager) {
- this.dirtyManager.clear();
- if (dirtyClip) {
- this.restoreGraphicsState();
- }
- }
- },
- recursiveComputeStyles : function(node) {
- node.computeStyles();
- for (var __i_enFor0 = 0, __exp_enFor0 = node.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- this.recursiveComputeStyles(child);
- }
- },
- doRender : function(node) {
- if (!(node.isDrawable())) {
- return;
- }
- this.saveGraphicsState();
- var matrix = node.getComputedStyleValue(11);
- if (matrix) {
- this.applyMatrix(matrix);
- }
- var clipNode = com_ibm_rave_render_internal_nodes_NodeUtil.findSceneNode(node, node.getComputedStyleValue(44), [1014]);
- if (clipNode) {
- clipNode.layout();
- clipNode.paint(this);
- }
- this.shapeRendering(node.getComputedStyleValue(47));
- var painted = false;
- if (node.rave_getDrawType() != -1 && (!this.dirtyManager || node.isDirty() || this.dirtyManager.intersects(node))) {
- node.layout();
- if (node.isVisible()) {
- node.paint(this);
- painted = true;
- }
- }
- if (node.rave_hasChildNodes()) {
- for (var __i_enFor0 = 0, __exp_enFor0 = node.getChildrenArray(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- this.doRender(child);
- }
- }
- if (painted) {
- node.postPaint(this);
- }
- node.setDirty(false, false);
- this.restoreGraphicsState();
- },
- /** @expose */
- start : function(renderFromScratch) {},
- /** @expose */
- finish : function() {},
- applyMatrix : function(matrix) {
- this.transform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
- },
- /**
- * Takes a scene node and applies fill and stroke based on its properties.
- * @param (com.ibm.rave.render.internal.nodes.AbstractSceneNode) node Abstract node to set fill and stroke for.
- */
- /** @expose */
- setStrokeAndFill : function(node) {
- var style = com_ibm_rave_render_internal_style_RenderStyleManager.getFill(node);
- this.fill(style);
- this.stroke(com_ibm_rave_render_internal_style_RenderStyleManager.getStroke(node));
- },
- /**
- * Draw the path object created by {@link this.SceneItemFactory#this.create(String, String, com_ibm_rave_core_scene_SceneNode)}
- * @param (com.ibm.rave.render.internal.nodes.PathSceneItem) path a path object
- */
- /** @expose */
- drawPath : function(path) {},
- /** @expose */
- addClip : function(clip) {},
- /** @expose */
- drawEllipse : function(ellipse) {},
- /** @expose */
- drawRect : function(rect) {},
- /** @expose */
- drawLine : function(line) {},
- /** @expose */
- drawText : function(text) {},
- /** @expose */
- drawTextPath : function(textPath, paths) {},
- /** @expose */
- drawCircle : function(circle) {},
- /** @expose */
- push : function() {},
- /** @expose */
- pop : function(opacity) {},
- /** @expose */
- drawImage : function(image) {},
- /** @expose */
- fill : function(fill) {},
- /** @expose */
- stroke : function(stroke) {},
- /** @expose */
- transform : function(a, b, c, d, e, f) {},
- /** @expose */
- saveGraphicsState : function() {},
- /** @expose */
- restoreGraphicsState : function() {},
- /** @expose */
- addRectClip : function(newClip) {},
- /** @expose */
- clearRect : function(clip) {},
- /** @expose */
- shapeRendering : function(mode) {}
- });
- // $source: com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/CanvasRenderer
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2014, 2016
- **
- ** 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.
- ************************************************************************/
- // @import com/ibm/rave/core/nativeImpl/Declare (load)
- // @import com/ibm/rave/render/AbstractRenderer (load)
- // @import com/ibm/rave/render/internal/properties/SceneNodeAttributes (runtime)
- // @import com/ibm/rave/render/internal/properties/SceneNodeStyles (runtime)
- // @import com/ibm/rave/core/nativeImpl/Object (runtime)
- // @import com/ibm/rave/render/event/EventManager (runtime)
- // @import com/ibm/rave/render/internal/nodes/path/Path2DParser (runtime)
- // @import com/ibm/rave/render/internal/nodes/path/Path2DUtil (runtime)
- // @import com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/Dashing (runtime)
- // @import com/ibm/rave/core/scene/SceneNodeType (runtime)
- var com_ibm_rave_canvas_internal_nativeImpl_render_canvas_CanvasRenderer = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_AbstractRenderer, {
- constructor : function() {
- this._context = this._getCanvasNode().getContext('2d');
- this._renderingContextStack = [];
- this._transforms = [];
- var ratio = this._getCanvasNode().rave_getProperty("__rave_canvas_ratio__") || 1;
- this._currentTransform = new TransformMatrix(ratio, 0, 0, ratio, 0, 0);
- this._hasNativeDash = typeof this._context.setLineDash == "function";
- this._hasNativePath2D = !!window.Path2D;
- this._crispEdges = false;
- },
- getWidth: function() {
- return this._getCanvasNode().width;
- },
- getHeight: function() {
- return this._getCanvasNode().height;
- },
- getDirtyRegionFlagFromRoot: function() {
- // check the canvas node first
- return !!this._getCanvasNode()["rave-dirtyRegions"]
- || (this.root && this.root.rave_hasChildNodes() && !!this.root.rave_getChildNodes()[0].rave_getProperty("rave-dirtyRegions"));
- },
- clear: function() {
- this.saveGraphicsState();
- var canvas = this._getCanvasNode(), ctx = this._context;
-
- // Clear the main rect. remove any transforms for this calculation just to be sure.
- this.setTransform(1, 0, 0, 1, 0, 0);
- ctx.clearRect(0, 0, canvas.width, canvas.height);
- this.restoreGraphicsState();
- },
- fill: function (fill) {
- this._fill = fill;
- },
- stroke: function (stroke) {
- this._stroke = stroke;
- this._dashArray = !this._hasNativeDash && stroke ? stroke.getDashArray() : null;
- },
- start: function(renderFromScratch) {
- if (renderFromScratch) {
- this.saveGraphicsState();
- var canvas = this._getCanvasNode(), ctx = this._context;
- this._renderingContextStack = [];
- // Clear the main rect. remove any transforms for this calculation just to be sure.
- this.setTransform(1, 0, 0, 1, 0, 0);
- ctx.clearRect(0, 0, canvas.width, canvas.height);
- this.restoreGraphicsState();
- }
- },
- clearRect: function(rect) {
- this._context.clearRect(rect.x, rect.y, rect.width, rect.height);
- },
- finish: function() {
- },
- transform: function(a, b, c, d, e, f) {
- this._context.transform(a, b, c, d, e, f);
- this._currentTransform = this._currentTransform.multiply(new TransformMatrix(a, b, c, d, e, f));
- },
-
- setTransform: function(a, b, c, d, e, f) {
- this._context.setTransform(a, b, c, d, e, f);
- this._currentTransform = new TransformMatrix(a, b, c, d, e, f);
- },
- drawEllipse: function(ellipse) {
- this._drawEllipse(ellipse.getCx(), ellipse.getCy(), ellipse.getRx(), ellipse.getRy());
- },
- drawRect: function(rect){
- var x = this._snap(rect.getX()),
- y = this._snap(rect.getY()),
- w = this._crispEdges ? Math.round(rect.getWidth()) : rect.getWidth(),
- h = this._crispEdges ? Math.round(rect.getHeight()) : rect.getHeight(),
- rx = rect.getRx(),
- ry = rect.getRy(),
- xe = x + w, // x-end
- ye = y + h, // y-end
- ctx = this._context,
- da = this._dashArray,
- residue;
- // set the opposite radius if not set or < 0
- if (rx > 0 && ry <= 0) {
- ry = rx;
- } else if (ry > 0 && rx <= 0) {
- rx = ry;
- }
- // radius must <= half the width or height
- rx = Math.min(rx, w / 2);
- ry = Math.min(ry, h / 2);
- if (rx > 0) {
- var kappa = 0.5522848,
- ox = rx * kappa, // control point offset horizontal
- oy = ry * kappa; // control point offset vertical
- }
- this._preDraw();
- if (!this._clipping && da) {
- if (rx > 0) {
- // draw rounded rectangle
- residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, da, x + rx, y, x + w - rx, y);
- residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedCurveTo(ctx, da, x + w - rx, y, [xe - rx + ox, y, xe, y + ry - oy, xe, y + ry], residue);
- residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, da, x + w, y + ry, x + w, y + h - ry, residue);
- residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedCurveTo(ctx, da, x + w, y + h - ry, [xe, ye - ry + oy, xe - rx + ox, ye, xe - rx, ye], residue);
- residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, da, x + w - rx, y + h, x + rx, y + h, residue);
- residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedCurveTo(ctx, da, x + rx, y + h, [x + rx - ox, ye, x, ye - ry + oy, x, ye - ry], residue);
- residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, da, x, y + h - ry, x, y + ry, residue);
- com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedCurveTo(ctx, da, x, y + ry, [x, y + ry - oy, x + rx - ox, y, x + rx, y], residue);
- } else {
- residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, da, x, y, xe, y);
- residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, da, xe, y, xe, ye, residue);
- residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, da, xe, endY, x, ye, residue);
- com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, da, x, xy, x, y, residue);
- }
- } else if (rx > 0) {
- // draw rounded rectangle
- ctx.moveTo(x + rx, y);
- ctx.lineTo(x + w - rx, y);
- ctx.bezierCurveTo(xe - rx + ox, y, xe, y + ry - oy, xe, y + ry);
- ctx.lineTo(x + w, y + h - ry);
- ctx.bezierCurveTo(xe, ye - ry + oy, xe - rx + ox, ye, xe - rx, ye);
- ctx.lineTo(x + rx, y + h);
- ctx.bezierCurveTo(x + rx - ox, ye, x, ye - ry + oy, x, ye - ry);
- ctx.lineTo(x, y + ry);
- ctx.bezierCurveTo(x, y + ry - oy, x + rx - ox, y, x + rx, y);
- } else {
- ctx.rect(x,y,w,h);
- }
- this._postDraw();
- },
- drawLine: function(line){
- var x1=this._snap(line.getX1()),
- y1=this._snap(line.getY1()),
- x2=this._snap(line.getX2()),
- y2=this._snap(line.getY2());
- this._preDraw();
- var ctx = this._context;
- if (this._dashArray) {
- com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, this._dashArray, x1, y1, x2, y2);
- } else {
- ctx.moveTo(x1, y1);
- ctx.lineTo(x2, y2);
- }
- this._postDraw();
- },
- drawPath: function(node) {
- var path, pathGenerator = node.getPath();
- var pathString = node.getPathString();
- var hasNativeStringParser = this._hasNativePath2D && pathString;
- var useNativePath = hasNativeStringParser && !this._crispEdges;
-
- if (!this._clipping && useNativePath) {
- path = new Path2D(pathString);
- } else {
- path = new com_ibm_rave_canvas_internal_nativeImpl_render_canvas_CanvasRenderer_PathHandler(this._crispEdges);
- if (pathGenerator) {
- pathGenerator.draw(path);
- }
- }
-
- this._preDraw();
- var ctx = this._context;
- var shadow = node.getShadow();
- if(shadow != null){
- ctx.save();//save context before applying text shadow
- ctx.shadowOffsetX = node.rave_getSizePx(shadow.offset_x);
- ctx.shadowOffsetY = node.rave_getSizePx(shadow.offset_y);
- ctx.shadowColor = shadow.color != null ? shadow.getColor().toString() : ctx.fillStyle ;
- if(shadow.blur_radius != null){
- ctx.shadowBlur = node.rave_getSizePx(shadow.blur_radius);
- }
- }
- if (!useNativePath || this._clipping) {
- path.draw(ctx, this);
- }
-
- if (!this._clipping) {
- if (this._fill) {
- this._applyFill(this._fill, useNativePath);
- if (useNativePath) {
- ctx.fill(path);
- }
- }
- if (this._stroke) {
- this._applyStroke(this._stroke, useNativePath);
- if (useNativePath) {
- ctx.stroke(path);
- }
- }
- }
-
- if(shadow != null){
- ctx.restore(); // restore context after text drawing and show application
- }
-
- this._postDraw();
- },
- drawCircle: function(circle){
- var r = circle.getR();
- this._drawEllipse(circle.getCx(), circle.getCy(), r, r);
- },
- shapeRendering: function(mode) {
- // The only supported mode (other than the default) is "crispEdges".
- this._crispEdges = mode === "crispEdges";
- },
-
- _drawEllipse : function(cx, cy, rx, ry) {
- this._preDraw();
- var ctx = this._context, da = this._dashArray;
- if (ctx['ellipse'] && !da) {
- // use native ellipse function
- ctx['ellipse'](cx, cy, rx, ry, 0, 0, 2 * Math.PI, false);
- } else if (da) {
- // use dashing library because it's implementation matches svg dashing more closely
- var residue,
- kappa = 0.5522848,
- ox = rx * kappa, // control point offset horizontal
- oy = ry * kappa; // control point offset vertical
- // draw ellipse
- residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedCurveTo(ctx, da, cx - rx, cy, [cx - rx, cy - oy, cx - ox, cy - ry, cx, cy - ry], residue);
- residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedCurveTo(ctx, da, cx, cy - ry, [cx + ox, cy - ry, cx + rx, cy - oy, cx + rx, cy], residue);
- residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedCurveTo(ctx, da, cx + rx, cy, [cx + rx, cy + oy, cx + ox, cy + ry, cx, cy + ry], residue);
- com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedCurveTo(ctx, da, cx, cy + ry, [cx - ox, cy + ry, cx - rx, cy + oy, cx - rx, cy], residue);
- } else {
- // Draw an ellipse by scaling a full arc (unless it's just a circle)
- var r = rx, twoPI = 2 * Math.PI;
- if (rx != ry) {
- // draw an oval
- // save state due to translate and scale
- this.saveGraphicsState();
- // translate to center such that the ellipse can be drawn at 0,0
- ctx.translate(cx, cy);
- if (rx > ry) {
- ctx.scale(1, ry/rx);
- } else {
- r = ry;
- ctx.scale(rx/ry, 1);
- }
- ctx.arc(0, 0, r, 0, twoPI, false);
-
- this.restoreGraphicsState();
- } else {
- // draw a circle
- ctx.arc(cx, cy, r, 0, twoPI, false);
- }
- }
- this._postDraw();
- },
- drawText: function(textItem) {
- var text= textItem.getTextString();
- var x= textItem.getX();
- var y= textItem.getY();
- this._context.font = textItem.getFontStyle().toString();
- if (this._fill) {
- this._applyFill(this._fill, true);
- }
- var shadow = textItem.getShadow();
- if(shadow != null){
- this._context.save();//save context before applying text shadow
- this._context.shadowOffsetX = textItem.rave_getSizePx(shadow.offset_x);
- this._context.shadowOffsetY = textItem.rave_getSizePx(shadow.offset_y);
- this._context.shadowColor = shadow.color != null ? shadow
- .getColor().toString() : this._context.fillStyle ;
- if(shadow.blur_radius != null){
- this._context.shadowBlur = textItem.rave_getSizePx(shadow.blur_radius);
- }
- }
- this._context.fillText(text, x, y);
-
- if(shadow != null){
- this._context.restore(); // restore context after text drawing and show application
- }
-
- if (this._stroke) {
- this._applyStroke(this._stroke,true);
- this._context.strokeText(text, x, y);
- }
- },
- // Number of images currently being loaded
- _imageCount: 0,
- drawImage : function (imageSceneItem) {
- var href = imageSceneItem.getHref();
- if (href && href.length) {
- var self = this;
- // Check if this item has a cached image already
- var img = imageSceneItem.rave_getProperty("__rave__image");
- if (! img) {
- // this creates an image object and sets up callbacks to
- // populate the cache when ready
- self._createImage(imageSceneItem,href);
- } else {
- // draw from the cached version
- // -1 signals an error - don't draw
- if (img != -1) {
- self._handleDrawImage(img,imageSceneItem);
- }
- }
- }
- },
- _createImage: function(imageSceneItem, href) {
- var self = this;
- self._imageCount++;
- // This is the first time requesting an image for this ImageSceneItem
- // Create a new object
- var img = new Image();
- img.onload = function(){
- // last render has finished and our image is now loaded.
- // cache the image on the scene item for the next draw
- imageSceneItem.rave_setProperty("__rave__image", img);
- // Remove this image from the queue
- self._imageCount--;
- clearTimeout(self._imageTimeOut);
- if (self._imageCount) {
- // Still more images to load. give them some time to
- // load before we fire a full render.
- self._imageTimeOut = setTimeout(self.repaint(),50);
- } else {
- // no more images, repaint immediately
- self.repaint();
- }
- };
- img.onerror = function(){
- // image loading failed. mark as failed with -1
- imageSceneItem.rave_setProperty("__rave__image", -1);
- // Remove this image from the queue
- self._imageCount--;
- };
- img.src = href;
- return img;
- },
- /**
- * Method that gets called when an image has been loaded.
- * Draws the image once all images created before it have been drawn.
- */
- _handleDrawImage: function(image, imageSceneItem) {
- // We're next. Draw!
- var x = imageSceneItem.getX();
- var y = imageSceneItem.getY();
- var w = imageSceneItem.getWidth();
- var h = imageSceneItem.getHeight();
- var gAlpha=this._context.globalAlpha;
- this._context.globalAlpha=this._fill.getOpacity();
- // Draw image and remove from queue
- this._context.drawImage(image,x,y,w,h);
- this._context.globalAlpha=gAlpha;
- },
- push: function() {
- // save current rendering context on the stack
- this._renderingContextStack.push([this._getCanvasNode(), this._context]);
- // save current transform to apply on new context
- var t = this._currentTransform;
-
- this.saveGraphicsState();
-
- // create new canvas
- var canvas = document.createElement("canvas");
- canvas.width = this.getWidth();
- canvas.height = this.getHeight();
- // make new context the current one
- this._setCanvasNode(canvas);
- this._context = canvas.getContext('2d');
-
- // reset current transform
- this._currentTransform = new TransformMatrix(1, 0, 0, 1, 0, 0);
-
- // apply transform on new context
- this.transform(t.matrix.a, t.matrix.b, t.matrix.c, t.matrix.d, t.matrix.e, t.matrix.f);
- },
- pop: function(opacity) {
- // current canvas that will be drawn
- var canvas = this._getCanvasNode();
-
- // get rendering context from the stack
- var renderingContext = this._renderingContextStack.pop();
-
- // store transform before reset
- var at = this._currentTransform;
-
- // set current context
- this._setCanvasNode(renderingContext[0]);
- this._context = renderingContext[1];
-
- // reset transform before drawing
- this.setTransform(1, 0, 0, 1, 0, 0);
- // draw image with opacity
- this._drawTransparentImage(canvas, opacity);
-
- // set transform
- this.setTransform(at.matrix.a, at.matrix.b, at.matrix.c, at.matrix.d, at.matrix.e, at.matrix.f);
-
- this.restoreGraphicsState();
- },
-
- _drawTransparentImage: function(image, opacity) {
- // save current alpha
- var currentAlpha = this._context.globalAlpha;
- // save current composite
- var currentComp = this._context.globalCompositeOperation;
- // set new alpha using passed in opacity
- this._context.globalAlpha = opacity;
- this._context.globalCompositeOperation = "source-over";
- // render image from group canvas into current context
- this._context.drawImage(image, 0, 0);
- // reset alpha
- this._context.globalAlpha = currentAlpha;
- // reset composite
- this._context.globalCompositeOperation = currentComp;
- },
- saveGraphicsState: function() {
- this._context.save();
- this._transforms.push(this._currentTransform);
- },
- restoreGraphicsState: function() {
- this._context.restore();
- this._currentTransform = this._transforms.pop();
- },
- addClip: function(clip) {
- var ctx = this._context;
- ctx.beginPath();
- this._clipping = 1;
- var children = clip.rave_getChildNodes();
- for (var i = 0; i < children.length; i++) {
- var child = children[i];
- switch (child.rave_getDrawType()) {
- case com_ibm_rave_core_scene_SceneNodeType.CIRCLE:
- this.drawCircle(child);
- break;
- case com_ibm_rave_core_scene_SceneNodeType.RECT:
- this.drawRect(child);
- break;
- case com_ibm_rave_core_scene_SceneNodeType.PATH:
- case com_ibm_rave_core_scene_SceneNodeType.POLYGON:
- case com_ibm_rave_core_scene_SceneNodeType.POLYLINE:
- this.drawPath(child);
- break;
- case com_ibm_rave_core_scene_SceneNodeType.ELLIPSE:
- this.drawEllipse(child);
- break;
- }
- }
- delete this._clipping;
- ctx.clip();
- },
- _getCanvasNode: function() {
- return this.root._canvasNode;
- },
- _setCanvasNode: function(node) {
- this.root._canvasNode = node;
- },
- _preDraw: function() {
- !this._clipping && this._context.beginPath();
- if (this._crispEdges) {
- this.saveGraphicsState();
- var m = this._currentTransform.matrix;
- this.transform(1, 0, 0, 1, Math.floor(m.e) + 0.5 - m.e, Math.floor(m.f) + 0.5 - m.f);
- }
- },
- _postDraw: function() {
- !this._clipping && this._applyStyles(this._fill, this._stroke);
-
- if (this._crispEdges) {
- this.restoreGraphicsState();
- }
- },
- // Apply all the styles defined in the passed styles object.
- _applyStyles: function(fill, stroke) {
- this._applyFill(fill);
- this._applyStroke(stroke);
- },
- _applyFill: function(fill, skipFill) {
- if (fill) {
- var type = fill.getType();
- var style = null;
- if (type == 1001) {
- // linear gradient
- style = this._context.createLinearGradient(fill.x1, fill.y1, fill.x2, fill.y2);
- var stops = fill.getStops();
- for (var i = 0; i < stops.length; i++) {
- style.addColorStop(stops[i].getOffset(), stops[i].calculateColor().toString());
- }
- } else if (type == 1002) {
- // radial gradient
- // I sort of eyeballed the 'r1' value which is fixed in SVG (or based somehow on the bounding box)
- // This value gives a pretty good approximation.
- style = this._context.createRadialGradient(fill.fx, fill.fy, fill.r/24, fill.cx, fill.cy, fill.r);
- var stops = fill.getStops();
- for (var i = 0; i < stops.length; i++) {
- style.addColorStop(stops[i].getOffset(), stops[i].calculateColor().toString());
- }
- } else {
- // regular color fill
- style = fill.calculateColorWithOpacity().toString();
- }
- this._context.fillStyle = style;
- if (!skipFill) {
- this._context.fill();
- }
- }
- },
- _applyStroke: function(stroke, skipStroke) {
- if (stroke) {
- var color = stroke.calculateColorWithOpacity().toString();
- if (color) {
- var ctx = this._context;
- ctx.strokeStyle = color;
- ctx.lineWidth = stroke.getWidth();
- ctx.lineCap = stroke.getLineCap();
- ctx.lineJoin = stroke.getLineJoin();
- ctx.miterLimit = stroke.getMiterLimit();
- if (this._hasNativeDash && stroke.getDashArray()) {
- ctx.setLineDash(stroke.getDashArray());
- ctx.lineDashOffset = stroke.getDashOffset();
- }
- if (!skipStroke) {
- ctx.stroke();
- }
- }
- }
- },
- createEventManager : function() {
- var canvas = this._getCanvasNode();
- // create a native event manager
- return new (com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_event_EventManager, {
- addNativeEventListener : function(eventType, listener) {
- var nativeListener = function(e) {
- // create an event object
- var event = wrapEvent(e);
- // listener callback
- listener(event);
- unwrapEvent(e, event);
- };
- canvas.addEventListener(eventType, nativeListener);
- return nativeListener;
- },
- removeNativeEventListener : function(eventType, nativeObject) {
- canvas.removeEventListener(eventType, nativeObject);
- }
- }))(this);
- },
-
- _snap : function(v) {
- return _doSnap(v, this._crispEdges);
- }
- });
- // Object to track the current transform of the canvas.
- // Basically a wrapper to an SVGMatrix object.
- var TransformMatrix = function(a, b, c, d, e, f) {
-
- var svgMatrix = document.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGMatrix();
- svgMatrix.a = a || 1;
- svgMatrix.b = b || 0;
- svgMatrix.c = c || 0;
- svgMatrix.d = d || 1;
- svgMatrix.e = e || 0;
- svgMatrix.f = f || 0;
-
- return {
- matrix : svgMatrix,
-
- multiply : function(secondTransformMatrix) {
- var svgMatrix = this.matrix.multiply(secondTransformMatrix.matrix);
- return new TransformMatrix(svgMatrix.a, svgMatrix.b, svgMatrix.c, svgMatrix.d, svgMatrix.e, svgMatrix.f);
- },
-
- identity : function() {
- this.matrix.a = 1;
- this.matrix.b = 0;
- this.matrix.c = 0;
- this.matrix.d = 1;
- this.matrix.e = 0;
- this.matrix.f = 0;
- }
- };
- }
- var com_ibm_rave_canvas_internal_nativeImpl_render_canvas_CanvasRenderer_PathHandler = com_ibm_rave_core_nativeImpl_Declare({
- constructor : function(crisp) {
- this._cmds = [];
- this._crisp = crisp;
- },
- draw : function(c, r) {
- var cmds = this._cmds;
- for (var i = 0; i < cmds.length; i++) {
- cmds[i](c, r, this);
- }
- },
- fail : function(index) {
- this._cmds.push(function(c) {
- c.closePath();
- });
- },
- startPath : function() {
- this._cmds.push(function(c, r, self) {
- self._x = self._y = 0;
- });
- },
- closePath : function() {
- this._cmds.push(function(c) {
- c.closePath();
- });
- },
- moveTo : function(x, y) {
- this._cmds.push(function(c, r, self) {
- c.moveTo(self._snap(x), self._snap(y));
- self._x = x;
- self._y = y;
- });
- },
- lineTo : function(x, y) {
- var _x = this._snap(x),
- _y = this._snap(y);
- this._cmds.push(function(c, r, self) {
- if (r._dashArray) {
- self._residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(c, r._dashArray, self._x, self._y, _x, _y, self._residue);
- self._x = x;
- self._y = y;
- } else {
- c.lineTo(_x,_y);
- }
- });
- },
- bezierCurveTo : function(cp1x, cp1y, cp2x, cp2y, x, y) {
- this._cmds.push(function(c, r , self) {
- if (r._dashArray) {
- self._residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedCurveTo(c, r._dashArray, self._x, self._y, [cp1x, cp1y, cp2x, cp2y, x, y], self._residue);
- self._x = x;
- self._y = y;
- } else {
- c.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
- }
- });
- },
- quadraticCurveTo : function(cpx, cpy, x, y) {
- this._cmds.push(function(c, r , self) {
- if (r._dashArray) {
- self._residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedCurveTo(c, r._dashArray, self._x, self._y, [cpx, cpy, x, y], self._residue);
- self._x = x;
- self._y = y;
- } else {
- c.quadraticCurveTo(cpx, cpy, x, y);
- }
- });
- },
- arcTo : function(x0, y0, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) {
- com_ibm_rave_render_internal_nodes_path_Path2DUtil.arcToBezier(this,
- x0, y0, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y);
- },
-
- _snap : function(v) {
- return _doSnap(v, this._crispEdges);
- }
- });
- function _doSnap(value, crisp) {
- return crisp ? Math.round(value) : value;
- }
- // $source: com/ibm/rave/render/internal/DirtyRegionManager
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/core/transform/MatrixUtil (runtime) // transformBounds
- //@import com/ibm/rave/core/geom/RectStruct (runtime) // new
- //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
- /**
- * Manages dirty regions for a renderer.
- */
- var com_ibm_rave_render_internal_DirtyRegionManager = com_ibm_rave_core_nativeImpl_Declare({
- //dirtyRegion : null,
- //normalizedRegion : null,
- //dirtyNodes : null,
- globalDirty : true,
- constructor : function() {
- this.dirtyNodes = [];
- },
- /**
- * If globally dirty, the entire scene should be repainted.
- * @return (boolean) <code>true</code> if the dirty region is all dirty, <code>false</code> otherwise
- */
- isGloballyDirty : function() {
- return this.globalDirty;
- },
- /**
- * Add the scene node whose bounds to add to the current dirtyRegion.
- * @param (com.ibm.rave.render.internal.nodes.AbstractSceneNode) node the scene node whose bounds are dirty
- */
- add : function(node) {
- if (!this.globalDirty) {
- this.dirtyNodes.push(node);
- this.addBounds(node, node.rave_getProperty("__drc__"));
- }
- },
- addBounds : function(node, cache) {
- var left, top, right, bottom;
- if (!cache) {
- var r = this.computeBounds(node);
- left = r.x;
- right = r.x + r.width;
- top = r.y;
- bottom = r.y + r.height;
- } else {
- left = cache.x;
- right = cache.x + cache.width;
- top = cache.y;
- bottom = cache.y + cache.height;
- }
- if (!this.globalDirty) {
- this.normalizedRegion = null;
- if (!this.dirtyRegion) {
- this.dirtyRegion = new com_ibm_rave_render_internal_DirtyRegionManager.Rect(left, right, top, bottom);
- } else {
- this.dirtyRegion.left = Math.min(this.dirtyRegion.left, left);
- this.dirtyRegion.top = Math.min(this.dirtyRegion.top, top);
- this.dirtyRegion.bottom = Math.max(this.dirtyRegion.bottom, bottom);
- this.dirtyRegion.right = Math.max(this.dirtyRegion.right, right);
- }
- }
- },
- /**
- * Get the cached or computed dirty bounds for the given node.
- */
- getDirtyBounds : function(node) {
- var r = node.rave_getProperty("__drc__");
- if (!r) {
- r = this.computeBounds(node);
- }
- return r;
- },
- /**
- * Computes the dirty bounds of the given node. Similar to bounding client rect but includes parts of the node that don't contribute to the bounding client rect such as stroke width.
- */
- computeBounds : function(node) {
- var bBox = node.getBoundingClientRectBBox();
- var left = bBox.x;
- var top = bBox.y;
- var right = bBox.x + bBox.width;
- var bottom = bBox.y + bBox.height;
- var strokeWidth = node.getComputedSizePx(31);
- if (strokeWidth > 0) {
- var expand = 1.5 * strokeWidth / 2.;
- left -= expand;
- top -= expand;
- right += expand;
- bottom += expand;
- }
- var r = com_ibm_rave_core_transform_MatrixUtil.transformBounds(new com_ibm_rave_core_geom_RectStruct(left, top, right - left, bottom - top), node.getCTM());
- node.rave_setProperty("__drc__", r);
- return r;
- },
- /**
- * Clear the current dirty region. But does not make the region globally dirty.
- */
- clear : function() {
- this.dirtyRegion = null;
- this.normalizedRegion = null;
- this.globalDirty = false;
- this.dirtyNodes.length = 0;
- },
- /**
- * Like {@link this.DirtyRegionManager#this.clear()} but also makes the region globally dirty.
- */
- forceRedraw : function() {
- for (var __i_enFor0 = 0, __exp_enFor0 = this.dirtyNodes, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var node = __exp_enFor0[__i_enFor0];
- node.rave_removeProperty("__drc__");
- }
- this.clear();
- this.globalDirty = true;
- },
- /**
- * Completes the dirty region by rounding all coordinates.
- */
- normalize : function() {
- for (var __i_enFor0 = 0, __exp_enFor0 = this.dirtyNodes, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var node = __exp_enFor0[__i_enFor0];
- this.addBounds(node, null);
- }
- this.dirtyNodes.length = 0;
- this.normalizedRegion = new com_ibm_rave_render_internal_DirtyRegionManager.Rect(Math.max(0, Math.floor(this.dirtyRegion.left - 2)), Math.max(0, Math.ceil(this.dirtyRegion.right + 2)), Math.max(0, Math.floor(this.dirtyRegion.top - 2)), Math.max(0, Math.ceil(this.dirtyRegion.bottom + 2)));
- },
- /**
- * Get the clip rect based on the current dirty region.
- * @return (com.ibm.rave.core.geom.RaveRect) a clip rect, or <code>null</code> if no dirty region present
- */
- getClip : function() {
- if (this.dirtyRegion) {
- if (!this.normalizedRegion) {
- this.normalize();
- }
- return new com_ibm_rave_core_geom_RaveRect(this.normalizedRegion.left, this.normalizedRegion.top, this.normalizedRegion.right - this.normalizedRegion.left, this.normalizedRegion.bottom - this.normalizedRegion.top);
- }
- return null;
- },
- /**
- * Does the passed scene item intersect with the current dirty region.
- * @param (com.ibm.rave.render.internal.nodes.AbstractSceneNode) node
- * @return (boolean) true if the item intersects with the current dirty region, false otherwise.
- */
- intersects : function(node) {
- if (this.dirtyRegion) {
- if (!this.normalizedRegion) {
- this.normalize();
- }
- var r = this.getDirtyBounds(node);
- if (r.x >= this.normalizedRegion.right || r.y >= this.normalizedRegion.bottom || (r.y + r.height) <= this.normalizedRegion.top || (r.x + r.width) <= this.normalizedRegion.left) {
- return false;
- }
- }
- return true;
- }
- });
- com_ibm_rave_render_internal_DirtyRegionManager.Rect = function(left, right, top, bottom) {
- this.left = left;
- this.right = right;
- this.top = top;
- this.bottom = bottom;
- };
- com_ibm_rave_render_internal_DirtyRegionManager.DIRTY_CACHE = "__drc__";
- /**
- * Expansion to deal with anti-aliasing.
- */
- com_ibm_rave_render_internal_DirtyRegionManager.EXPAND = 2;
- // $source: com/ibm/rave/render/event/EventManager
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * Responsible for mapping native events to Rave events. <p> The event manager will request to listen to native events and then convert these native events into Rave events which are then fired onto the scene nodes with listeners.
- */
- var com_ibm_rave_render_event_EventManager = rave_externs["EventManager"] = com_ibm_rave_core_nativeImpl_Declare({
- //eventHandlers : null,
- //renderer : null,
- constructor : function(renderer) {
- this.eventHandlers = {};
- {
- this.renderer = renderer;
- }
- },
- /**
- * Notifies the event manager that the given scene node is interested in receiving events of the given type.
- * @param (String) eventType string describing the different event types
- * @param (com.ibm.rave.core.scene.SceneNode) node scene node that will listen for events
- */
- /** @expose */
- registerEvent : function(eventType, node) {
- var info = this.eventHandlers[eventType];
- var key = "__rave-eventmanager" + eventType;
- if (!info) {
- info = this.createNativeEventHandler(eventType);
- if (info) {
- this.eventHandlers[eventType] = info;
- node.rave_setProperty(key, eventType);
- info.addNode(node);
- }
- } else if (!(node.rave_hasProperty(key))) {
- node.rave_setProperty(key, eventType);
- info.addNode(node);
- }
- },
- /**
- * Notifies the event manager that the given scene node is no longer interested in receiving events of the given type.
- * @param (String) eventType string describing the different event types
- * @param (com.ibm.rave.core.scene.SceneNode) node scene node that was listening for events
- */
- /** @expose */
- unregisterEvent : function(eventType, node) {
- var info = this.eventHandlers[eventType];
- if (info) {
- var key = "__rave-eventmanager" + eventType;
- if (node.rave_hasProperty(key)) {
- node.rave_removeProperty(key);
- info.removeNode(node);
- if (info.canDispose()) {
- info.dispose();
- delete this.eventHandlers[eventType];
- }
- }
- }
- },
- createNativeEventHandler : function(eventType) {
- var result;
- if ("mouseover" == eventType) {
- result = this.createMouseOverListener(eventType);
- } else if ("mouseout" == eventType) {
- result = this.createMouseOutListener(eventType);
- } else if ("mouseenter" == eventType) {
- result = this.createMouseEnterListener(eventType);
- } else if ("mouseleave" == eventType) {
- result = this.createMouseLeaveListener(eventType);
- } else if ("click" == eventType || "dblclick" == eventType || "mousemove" == eventType || "mouseup" == eventType || "mousedown" == eventType || "contextmenu" == eventType || "wheel" == eventType) {
- result = this.createSimpleEventListener(eventType);
- } else if ("touchmove" == eventType || "touchend" == eventType || "touchcancel" == eventType) {
- result = this.createTouchEventListener(eventType);
- } else if ("touchstart" == eventType) {
- result = this.createTouchStartEventListener(eventType);
- } else if ("keydown" == eventType || "keypress" == eventType || "keyup" == eventType) {
- result = this.createKeyboardEventListener(eventType);
- }
- return result;
- },
- /**
- * To track mouse over, a native mouse move event must be tracked. When the mouse moves over a scene node, a Rave mouse over event is fired. Also tracks mouse out events to clear the cached target.
- * @param (String) eventType the event type
- */
- createMouseOverListener : function(eventType) {
- var target;
- var self = this;
- var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mousemove", this.addNativeEventListener("mousemove", function(event) {
- var hit = self.findHit(event.clientX, event.clientY);
- if (hit && hit != target) {
- event.type = eventType;
- hit.dispatchEvent(event);
- event.type = "mousemove";
- }
- target = hit;
- })));
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mouseout", this.addNativeEventListener("mouseout", function(event) {
- target = null;
- })));
- return info;
- },
- /**
- * To track mouse out, a native mouse move event must be tracked. When the mouse moves over a scene node, the node reference is saved. When the mouse moves off the saved node, a Rave mouse out event is fired. A native mouse out of the component is also tracked which will cause a mouse out on the saved node.
- * @param (String) eventType the event type
- */
- createMouseOutListener : function(eventType) {
- var target;
- var self = this;
- var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mousemove", this.addNativeEventListener("mousemove", function(event) {
- var hit = self.findHit(event.clientX, event.clientY);
- if (target && hit != target) {
- event.type = eventType;
- target.dispatchEvent(event);
- event.type = "mousemove";
- }
- target = hit;
- })));
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mouseout", this.addNativeEventListener("mouseout", function(event) {
- if (target) {
- target.dispatchEvent(event);
- target = null;
- }
- })));
- return info;
- },
- /**
- * To track mouse enter, a native mouse move event must be tracked. When the mouse moves over a scene node, a Rave mouse enter event is fired. Also tracks mouse out events to clear the cached target and ancestors.
- * @param (String) eventType the event type
- */
- createMouseEnterListener : function(eventType) {
- var target;
- var self = this;
- var ancestors = [];
- var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mousemove", this.addNativeEventListener("mousemove", function(event) {
- var hit = self.findHit(event.clientX, event.clientY);
- if (hit) {
- if (hit != target) {
- var index = ancestors.indexOf(hit);
- if (index >= 0) {
- ancestors.length =index + 1;
- } else {
- event.type = eventType;
- var bubbles = event.bubbles;
- event.bubbles = false;
- var isDescendant = false;
- for (var i = ancestors.length - 1; i >= 0; --i) {
- var ancestor = ancestors[i];
- if (com_ibm_rave_render_event_EventManager.isDescendant(ancestor, hit)) {
- ancestors.length =i + 1;
- var newAncestors = [];
- var parent = hit;
- do {
- newAncestors.push(parent);
- parent.dispatchEvent(event);
- } while ((parent = parent.rave_getParentNode()) != ancestor);
- for (var j = newAncestors.length - 1; j >= 0; --j) {
- ancestors.push(newAncestors[j]);
- }
- isDescendant = true;
- break;
- }
- }
- if (!isDescendant) {
- ancestors.length = 0;
- var parent = hit;
- do {
- ancestors.push(parent);
- parent.dispatchEvent(event);
- } while ((parent = parent.rave_getParentNode()));
- ancestors.reverse();
- }
- event.bubbles = bubbles;
- event.type = "mousemove";
- }
- }
- } else if (target) {
- ancestors.length = 0;
- }
- target = hit;
- })));
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mouseout", this.addNativeEventListener("mouseout", function(event) {
- target = null;
- ancestors.length = 0;
- })));
- return info;
- },
- /**
- * To track mouse leave, a native mouse move event must be tracked. When the mouse moves over a scene node, a Rave mouse leave event is fired for the previous target. Also tracks mouse out events to clear the cached target and ancestors and dispatch an event for the previous target
- * @param (String) eventType the event type
- */
- createMouseLeaveListener : function(eventType) {
- var target;
- var self = this;
- var ancestors = [];
- var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mousemove", this.addNativeEventListener("mousemove", function(event) {
- var hit = self.findHit(event.clientX, event.clientY);
- if (hit != target) {
- if (!target) {
- var parent = hit;
- do {
- ancestors.push(parent);
- } while ((parent = parent.rave_getParentNode()));
- ancestors.reverse();
- } else {
- var index = ancestors.indexOf(hit);
- if (index >= 0) {
- for (var i = ancestors.length - 1; i > index; --i) {
- ancestors[i].dispatchEvent(event);
- }
- ancestors.length =index + 1;
- } else {
- event.type = eventType;
- var bubbles = event.bubbles;
- event.bubbles = false;
- var isDescendant = false;
- for (var i = ancestors.length - 1; i >= 0; --i) {
- var ancestor = ancestors[i];
- if (hit && com_ibm_rave_render_event_EventManager.isDescendant(ancestor, hit)) {
- ancestors.length =i + 1;
- var newAncestors = [];
- var parent = hit;
- do {
- newAncestors.push(parent);
- } while ((parent = parent.rave_getParentNode()) != ancestor);
- for (var j = newAncestors.length - 1; j >= 0; --j) {
- ancestors.push(newAncestors[j]);
- }
- isDescendant = true;
- break;
- }
- ancestor.dispatchEvent(event);
- }
- if (!isDescendant && hit) {
- var parent = hit;
- do {
- ancestors.push(parent);
- } while ((parent = parent.rave_getParentNode()));
- ancestors.reverse();
- }
- event.bubbles = bubbles;
- event.type = "mousemove";
- }
- }
- target = hit;
- }
- })));
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mouseout", this.addNativeEventListener("mouseout", function(event) {
- if (target) {
- event.type = eventType;
- target.dispatchEvent(event);
- target = null;
- ancestors.length = 0;
- event.type = "mouseout";
- }
- })));
- return info;
- },
- /**
- * Adds a native event listener for the same event in the event listener info.
- * @param (String) eventType the event type
- */
- createSimpleEventListener : function(eventType) {
- var self = this;
- var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
- var listener = function(event) {
- var hit = self.findHit(event.clientX, event.clientY);
- if (hit) {
- hit.dispatchEvent(event);
- }
- };
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle(info.eventType, this.addNativeEventListener(info.eventType, listener)));
- return info;
- },
- /**
- * Add a native listener for keyboard events, which only dispatch to the root element (e.g. SVG, Canvas, AWTRavePanelSceneNode)
- * @param (String) eventType Event name (e.g. "keydown").
- */
- createKeyboardEventListener : function(eventType) {
- var self = this;
- var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
- var listener = function(event) {
- self.renderer.root.dispatchEvent(event);
- };
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle(info.eventType, this.addNativeEventListener(info.eventType, listener)));
- return info;
- },
- /**
- * Adds a native event listener for the touchstart event.
- * @param (String) eventType the event type
- */
- createTouchStartEventListener : function(eventType) {
- var self = this;
- var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
- var listener = function(event) {
- for (var __i_enFor0 = 0, __exp_enFor0 = (event).changedTouches, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var touch = __exp_enFor0[__i_enFor0];
- var hit = self.findHit(touch.clientX, touch.clientY);
- if (hit) {
- hit.dispatchEvent(event);
- }
- }
- };
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle(info.eventType, this.addNativeEventListener(info.eventType, listener)));
- return info;
- },
- /**
- * In order to touch events other than start, the event must be dispatched to all nodes listening to that touch event. It is their responsibility to distinguish whether the event pertains to them based on the changedTouches property.
- * @param (String) eventType the event type
- */
- createTouchEventListener : function(eventType) {
- var self = this;
- var touchPoints = {};
- var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
- var listener1 = function(event) {
- for (var __i_enFor0 = 0, __exp_enFor0 = (event).changedTouches, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var touch = __exp_enFor0[__i_enFor0];
- var node = touchPoints[touch.identifier];
- if (node) {
- node.dispatchEvent(event);
- }
- }
- };
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle(info.eventType, this.addNativeEventListener(info.eventType, listener1)));
- var listener2 = function(event) {
- for (var __i_enFor0 = 0, __exp_enFor0 = (event).changedTouches, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var touch = __exp_enFor0[__i_enFor0];
- var hit = self.findHit(touch.clientX, touch.clientY);
- if (hit) {
- touchPoints[touch.identifier] = hit;
- }
- }
- };
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("touchstart", this.addNativeEventListener("touchstart", listener2)));
- var listener3 = function(event) {
- for (var __i_enFor0 = 0, __exp_enFor0 = (event).changedTouches, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var touch = __exp_enFor0[__i_enFor0];
- delete touchPoints[touch.identifier];
- }
- };
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("touchend", this.addNativeEventListener("touchend", listener3)));
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("touchcancel", this.addNativeEventListener("touchcancel", listener3)));
- return info;
- },
- /**
- * Finds a scene node under the given coordinates.
- * @param (double) x x coordinate
- * @param (double) y y coordinate
- * @return (com.ibm.rave.core.scene.SceneNode) the scene node under the coordinates, or <code>null</code> if none found
- */
- findHit : function(x, y) {
- var root = this.renderer.root;
- var nodeClientRect = root.rave_getOwner().getBoundingClientRect();
- return root.rave_intersection(x - nodeClientRect.left, y - nodeClientRect.top);
- },
- /**
- * Add a listener for native events.
- * @param (String) eventType the event type
- * @param (com.ibm.rave.render.event.NativeEventListener) listener the event listener
- * @return (Object) a native object, typically the native listener, which will be used when calling {@link #this.removeNativeEventListener(String, Object)}
- */
- /** @expose */
- addNativeEventListener : function(eventType, listener) {},
- /**
- * Removes a listener for native events.
- * @param (String) eventType the event type
- * @param (Object) nativeObject a native object received as the return value from {@link #this.addNativeEventListener(String, com_ibm_rave_render_event_NativeEventListener)}
- */
- /** @expose */
- removeNativeEventListener : function(eventType, nativeObject) {}
- });
- com_ibm_rave_render_event_EventManager.isDescendant = function(ancestor, node) {
- var parent = node;
- while ((parent = parent.rave_getParentNode())) {
- if (parent == ancestor) {
- return true;
- }
- }
- return false;
- };
- com_ibm_rave_render_event_EventManager.NativeListenerBundle = function(eventType, listener) {
- this.eventType = eventType;
- this.nativeListenerObject = listener;
- };
- /**
- * Keeps a count of interested in a particular event type. When the count reaches 0, this event listener info can be disposed.
- */
- com_ibm_rave_render_event_EventManager.EventListenerInfo = com_ibm_rave_core_nativeImpl_Declare({
- //bundles : null,
- //eventType : null,
- //em : null,
- /** @expose */
- nodeCount : 0,
- constructor : function(em, eventType) {
- this.bundles = [];
- {
- this.em = em;
- this.eventType = eventType;
- }
- },
- dispose : function() {
- for (var __i_enFor0 = 0, __exp_enFor0 = this.bundles, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var bundle = __exp_enFor0[__i_enFor0];
- this.em.removeNativeEventListener(bundle.eventType, bundle.nativeListenerObject);
- }
- },
- addNode : function(node) {
- this.nodeCount++;
- },
- removeNode : function(node) {
- this.nodeCount--;
- },
- canDispose : function() {
- return this.nodeCount == 0;
- }
- });
- /**
- * Property key for caching the type of event a node is listening to.
- */
- //com_ibm_rave_render_event_EventManager.CACHE_KEY_PREFIX = "__rave-eventmanager";
- // $source: com/ibm/rave/render/internal/nodes/cache/SceneNodeCacheManager
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/cache/SingleSceneNodeCache (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/cache/MultiSceneNodeCache (runtime) // new
- /**
- * A manager for a scene node cache. Listens for events on a scene node item and updates the cache if needed.
- */
- var com_ibm_rave_render_internal_nodes_cache_SceneNodeCacheManager = com_ibm_rave_core_nativeImpl_Declare({
- //idCache : null,
- //classCache : null,
- constructor : function() {
- this.idCache = new com_ibm_rave_render_internal_nodes_cache_SingleSceneNodeCache();
- this.classCache = new com_ibm_rave_render_internal_nodes_cache_MultiSceneNodeCache();
- },
- /**
- * Retrieve a single SceneNode from a cache, anywhere within this scene tree from the owner down.
- * @param (int) cacheId The SceneNodeCacheType id of the cache to retrieve a single value from.
- * @param (String) idString Unique id to search for in this entire scene tree, starting from the owner.
- * @param (com.ibm.rave.core.scene.SceneNode) root root node of the DOM branch being used for lookup
- * @return (com.ibm.rave.core.scene.SceneNode) SceneNode matching the passed unique id.
- */
- matchId : function(cacheId, idString, root) {
- if (cacheId == 1000) {
- var node = this.idCache.get(idString);
- if (this.isDescendant(node, root)) {
- return node;
- }
- }
- return null;
- },
- isDescendant : function(node, root) {
- if (node) {
- var parent = node;
- do {
- if (parent == root) {
- return true;
- }
- } while ((parent = parent.rave_getParentNode()));
- }
- return false;
- },
- /**
- * Retrieve a list of SceneNodes with a particular class anywhere within this scene tree from the owner down.
- * @param (int) cacheId The SceneNodeCacheType id of the cache to retrieve a single value from.
- * @param (String) className className to search for in this entire scene tree, starting from the owner.
- * @param (com.ibm.rave.core.scene.SceneNode) root Any matching node must have this node somewhere in its parent chain. May be null which will return all matching nodes.
- * @return (Array) All SceneNodes matching the passed class.
- */
- matchClass : function(cacheId, className, root) {
- var matches;
- if (cacheId == 1001) {
- var cached = this.classCache.get(className);
- if (cached) {
- for (var __i_enFor0 = 0, __exp_enFor0 = cached, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var node = __exp_enFor0[__i_enFor0];
- if (this.isDescendant(node, root)) {
- if (!matches) {
- matches = [];
- }
- matches.push(node);
- }
- }
- }
- }
- return matches;
- },
- /**
- * Caching support to quickly search by ID. Add an id -> SceneNode map to this owner's cache. Dynamically creates the cache if one hasn't been created yet.
- * @param value
- * @param (Object) id
- */
- addToIDCache : function(node, id, addChildIds) {
- if (id != null) {
- this.idCache.add(""+(id), node);
- if (addChildIds) {
- for (var __i_enFor0 = 0, __exp_enFor0 = node.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- this.addToIDCache(child, (child).getId(), true);
- }
- }
- }
- },
- /**
- * Add all classes on this node to the cache.
- * @param (com.ibm.rave.core.scene.SceneNode) node
- */
- removeFromIdCache : function(node, id, removeFromChildren) {
- this.idCache.remove$0(""+(id), node);
- if (removeFromChildren && node.rave_hasChildNodes()) {
- for (var __i_enFor0 = 0, __exp_enFor0 = node.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- this.removeFromIdCache(child, (child).getId(), true);
- }
- }
- },
- afterUpdate : function(type, subType, key, newValue, oldValue, node) {
- switch (type) {
- case (1000):
- if (subType == 2000) {
- if ("id" == key) {
- if (oldValue != null) {
- this.removeFromIdCache(node, oldValue, false);
- }
- this.addToIDCache(node, newValue, false);
- }
- }
- break;
- case (1001):
- if (subType == 2000) {
- if ("id" == key) {
- this.addToIDCache(node, newValue, false);
- }
- } else if (subType == 2001) {
- } else if (subType == 3000) {
- var id = node.getId();
- if (id != null) {
- this.addToIDCache(node, id, true);
- }
- }
- break;
- case (1002):
- if (subType == 2000) {
- if ("id" == key) {
- this.removeFromIdCache(node, oldValue, false);
- }
- } else if (subType == 2001) {
- } else if (subType == 3000) {
- var id = node.getId();
- this.removeFromIdCache(node, id, true);
- }
- break;
- default:
- break;
- }
- }
- });
- //com_ibm_rave_render_internal_nodes_cache_SceneNodeCacheManager.ID = "id";
- // $source: com/ibm/rave/render/internal/nodes/cache/SceneNodeCache
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * An abstract class describing a caching mechanism for Scene Nodes. This cache is typically stored relative to the scene's root, meaning there is one cache per scene tree.
- * @param < (java.lang.Object) V > The type of value that this cache is holding. Can be a single scene node or a set of scene nodes, etc.
- */
- var com_ibm_rave_render_internal_nodes_cache_SceneNodeCache = com_ibm_rave_core_nativeImpl_Declare({
- //factory : null,
- //cache : null,
- _isReady : true,
- constructor : function() {
- this.cache = {};
- },
- /**
- * Is this cache ready to accept nodes or not?
- * @return (boolean) True if this cache is ready to accept nodes. False otherwise.
- */
- isReady : function() {
- return this._isReady;
- },
- /**
- * Add a node to this cache under 'key'.
- * @param (String) key The key of the cache.
- * @param (com.ibm.rave.core.scene.SceneNode) node The node to add
- */
- add : function(key, node) {
- if (!(this.isReady()) || key == null) {
- return null;
- }
- var container = this.get(key);
- if (!container) {
- container = this.factory(node);
- this.cache[key] = container;
- }
- return container;
- },
- /**
- * Add a node to the container of each 'key' in 'keys'.
- * @param (Array) keys Multiple key names of the cache.
- * @param (com.ibm.rave.core.scene.SceneNode) node The node to add to each key container.
- */
- addMany : function(keys, node) {
- if (!(this.isReady()) || !keys) {
- return null;
- }
- var setValues = keys;
- for (var __i_enFor0 = 0, __len_enFor0 = setValues.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var key = setValues[__i_enFor0];
- this.add(key, node);
- }
- return setValues;
- },
- /**
- * Return the first matching node for this key from our cached set of nodes.
- * @param (String) key The bucket to get a node from.
- * @return (java.lang.Object) The first matching node for this key.
- */
- get : function(key) {
- if (!(this.isReady()) || key == null) {
- return null;
- }
- return this.cache[key];
- },
- /**
- * Remove a node from the set of nodes under 'key' in this cache.
- * @param (String) key The bucket to remove the node from.
- * @param (com.ibm.rave.core.scene.SceneNode) node The node to remove.
- */
- remove$0 : function(key, node) {
- if (!(this.isReady()) || key == null) {
- return;
- }
- delete this.cache[key];
- },
- /**
- * Remove a node from multiple keys in this cache.
- * @param (Array) keys The buckets to remove the node from.
- * @param (com.ibm.rave.core.scene.SceneNode) node The node to remove.
- */
- remove$1 : function(keys, node) {
- if (!(this.isReady()) || !keys) {
- return;
- }
- var setValues = keys;
- for (var __i_enFor0 = 0, __len_enFor0 = setValues.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var key = setValues[__i_enFor0];
- this.remove$0(key, node);
- }
- },
- remove : function(a0, a1) {
- var args = arguments;
- if (args.length == 2 && (a0 == null || typeof a0 === "string")) {
- return this.remove$0(a0, a1);
- }
- return this.remove$1(a0, a1);
- }
- //constructor : function() {}
- });
- // $source: com/ibm/rave/render/internal/nodes/cache/SingleSceneNodeCache
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/cache/SceneNodeCache (loadtime) // superclass
- /**
- * A cache that can hold only one node per key (id, for example)
- */
- var com_ibm_rave_render_internal_nodes_cache_SingleSceneNodeCache = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_cache_SceneNodeCache, {
- /**
- * A cache that can hold only one node per key (id, for example)
- */
- constructor : function() {
- this.factory = function(node) {
- return node;
- };
- }
- });
- // $source: com/ibm/rave/render/internal/nodes/cache/MultiSceneNodeCache
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/cache/SceneNodeCache (loadtime) // superclass
- /**
- * A cache that can hold multiple nodes per key (classes, for example)
- */
- var com_ibm_rave_render_internal_nodes_cache_MultiSceneNodeCache = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_cache_SceneNodeCache, {
- /**
- * A cache that can hold multiple nodes per key (classes, for example)
- */
- constructor : function() {
- this.factory = function(node) {
- return [];
- };
- },
- add : function(className, node) {
- var container = com_ibm_rave_render_internal_nodes_cache_SceneNodeCache.prototype.add.call(this, className, node);
- if (className != null) {
- container.push(node);
- }
- return container;
- },
- /**
- * Remove a node from the set of nodes under 'key' in this cache.
- * @param (String) className The bucket to remove the node from.
- * @param (com.ibm.rave.core.scene.SceneNode) node The node to remove.
- */
- remove$0 : function(className, node) {
- var list = this.get(className);
- if (list) {
- var i = list.indexOf(node);
- if (i >= 0) {
- list.splice(i, 1);
- }
- }
- }
- });
- // $source: com/ibm/rave/core/css/RaveCSSEngine
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** 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.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/core/internal/css/CSSParser (runtime) // parse
- //@import com/ibm/rave/core/internal/css/CSSStyleSheetManager (runtime) // CSSStyleSheetManager
- /**
- * An implementation of the CSSEngine interface. Used to import external styles into the CSSStyleSheetManager.
- * @see (com.ibm.rave.core.css.CSSEngine) CSSEngine
- */
- var com_ibm_rave_core_css_RaveCSSEngine = rave_externs["RaveCSSEngine"] = com_ibm_rave_core_nativeImpl_Declare({
- //stylesheets : null,
- constructor : function() {
- this.stylesheets = [];
- /**
- * Creates a <code>RaveCSSEngine</code>
- */
- {}
- },
- /** @expose */
- importCSS : function(cssText) {
- var styleSheet = com_ibm_rave_core_internal_css_CSSParser.parse(cssText);
- if (styleSheet) {
- return this.importStyleSheet(styleSheet) ? styleSheet : null;
- }
- return null;
- },
- /** @expose */
- importStyleSheets : function(styleSheets) {
- if (styleSheets) {
- var result = true;
- for (var __i_enFor0 = 0, __exp_enFor0 = styleSheets, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var styleSheet = __exp_enFor0[__i_enFor0];
- if (!(this.importStyleSheet(styleSheet))) {
- result = false;
- }
- }
- return result;
- }
- return false;
- },
- /** @expose */
- importStyleSheet : function(styleSheet) {
- if (styleSheet && !(this.stylesheets.indexOf(styleSheet)> -1)) {
- com_ibm_rave_core_internal_css_CSSStyleSheetManager.INSTANCE.add(styleSheet);
- this.stylesheets.push(styleSheet);
- return true;
- }
- return false;
- },
- /** @expose */
- styleSheets : function() {
- return this.stylesheets;
- },
- /** @expose */
- removeAllStyleSheets : function() {
- this.stylesheets.length = 0;
- com_ibm_rave_core_internal_css_CSSStyleSheetManager.INSTANCE.clear();
- },
- /** @expose */
- removeStyleSheet : function(styleSheet) {
- var index = this.stylesheets.indexOf(styleSheet);
- if (index > -1) {
- this.stylesheets.splice(index, 1);
- return com_ibm_rave_core_internal_css_CSSStyleSheetManager.INSTANCE.remove(styleSheet);
- }
- return false;
- }
- });
- // $source: com/ibm/rave/core/canvas/internal/nativeImpl/Module
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2014, 2016
- **
- ** 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.
- ************************************************************************/
- //@OnDemandLoad("rave-canvas")
- //Must be the first import
- //@import ./ModuleHeader
- //Other module dependencies
- //@import com/ibm/rave/core/internal/nativeImpl/Module
- //@import com/ibm/rave/core/canvas/internal/nativeImpl/CanvasSelectionQueryEngine (static)
- //@import com/ibm/rave/core/canvas/internal/nativeImpl/CustomRendererSelectionQueryEngine (static)
- //@import com/ibm/rave/render/SceneItemFactory (static)
- //@import com/ibm/rave/render/internal/nodes/RootSceneItem (static)
- //@import com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/CanvasRenderer (static)
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (static)
- //@import com/ibm/rave/core/nativeImpl/Object (runtime)
- //@import com/ibm/rave/render/internal/RendererConfiguration (runtime)
- //@import com/ibm/rave/render/internal/nodes/cache/SceneNodeCacheManager (runtime)
- //@import com/ibm/rave/core/css/RaveCSSEngine (static)
- function wrapEvent(e) {
- if (!e) {
- return null;
- }
- // create an event object
- var event = {};
- // mixin the native event properties into the new event object
- com_ibm_rave_core_nativeImpl_Object.mixin(event, e);
- // create new functions on the new event object because we cannot
- // execute the mixin'd functions due to native constraints
- // also because the generated code expects properties #immediatePropagationStopped
- // and #propagationStopped
- event.preventDefault = function () {
- this.defaultPrevented = true;
- };
- event.stopImmediatePropagation = function () {
- this.immediatePropagationStopped = true;
- };
- event.stopPropagation = function () {
- this.propagationStopped = true;
- };
- return event;
- }
- function unwrapEvent(e, wrapped) {
- // propagate event properties to the native event
- if (wrapped.defaultPrevented) {
- e.preventDefault();
- }
- if (wrapped.immediatePropagationStopped) {
- e.stopImmediatePropagation();
- }
- if (wrapped.propagationStopped) {
- e.stopPropagation();
- }
- return e;
- }
- (function () {
- var config = rave.configuration;
- // register the canvas scene item factory
- var canvasFactory = new com_ibm_rave_render_SceneItemFactory();
- config.setSceneNodeFactory("canvas", canvasFactory);
- config.setSceneNodeFactory("http://www.w3.org/1999/xhtml:CANVAS", function (nsuri, name, context) {
- var rootProvider = com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.getRootProviderForNode(context);
- if (!rootProvider) {
- var root = new com_ibm_rave_render_internal_nodes_RootSceneItem("canvas", context);
- root.getBoundingClientRect = function () {
- return context.getBoundingClientRect();
- };
- root._canvasNode = context;
- root.rave_setOwner(context);
- root.id = "__rave_canvas_root__";
- context.rave_setProperty("__rave_canvas_root__", root);
- // Override computeCTM so we include transformed tx (e) and ty (f) values
- var _origCTM = root.computeCTM;
- root.computeCTM = function (node, isScreenCTM) {
- // To mimic SVG nodes in getScreenCTM() mode, append the
- // canvas node's bounding left and top to the current CTM
- var ctm = _origCTM(node, isScreenCTM);
- if (context && isScreenCTM) {
- var rect = context.getBoundingClientRect();
- ctm.e += rect.left;
- ctm.f += rect.top;
- }
- return ctm;
- }
- // This registers the new renderer with the root scene node.
- var cacheManager = new com_ibm_rave_render_internal_nodes_cache_SceneNodeCacheManager(root);
- root.setRenderer(new com_ibm_rave_canvas_internal_nativeImpl_render_canvas_CanvasRenderer(root));
- root.setCacheManager(cacheManager);
- rootProvider = {
- getRoot: function () {
- return root;
- },
- getCacheManager: function () {
- return cacheManager;
- }
- };
- com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.addRootProvider(rootProvider);
- }
- var rootNode = rootProvider.getRoot();
- var item = canvasFactory("canvas", name, rootNode);
- return item;
- });
- // Query Engines
- // Need to override the default query selector so we can select over multiple roots (svg and canvas)
- var domQueryEngine = config.getQueryEngine(null);
- var defaultCanvasQueryEngine = new com_ibm_rave_core_canvas_internal_nativeImpl_CustomRendererSelectionQueryEngine(domQueryEngine);
- config.setQueryEngine(null, defaultCanvasQueryEngine);
- config.setQueryEngine("http://www.w3.org/1999/xhtml", defaultCanvasQueryEngine);
- var canvasQueryEngine = new com_ibm_rave_core_canvas_internal_nativeImpl_CanvasSelectionQueryEngine(defaultCanvasQueryEngine);
- config.setQueryEngine("canvas", canvasQueryEngine);
- config.setQueryEngine("http://www.w3.org/1999/xhtml:CANVAS", canvasQueryEngine);
-
- // For non-DOM nodes we need to wrap the event such that it can be modified by our own dispatcher
- var oriDispatchEvent = com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.dispatchEvent;
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.dispatchEvent = function (e) {
- var wrapped = wrapEvent(e),
- result = oriDispatchEvent.call(this, wrapped);
- unwrapEvent(e, wrapped);
- return result;
- };
- // Override the CSS engine
- rave.css = new com_ibm_rave_core_css_RaveCSSEngine();
- // Add length property which calls the original length function
- Object.defineProperty(com_ibm_rave_core_internal_css_om_CSSStyleDeclarationImpl.prototype, 'length', {
- get: function () {
- return this.propNames.length;
- }
- });
-
-
- /**
- * Adjust canvas context transformation to compensate for screen and image
- * buffer pixel density. This will help reduce fuzziness (anti-aliasing
- * blur) in high ppi screens, e.g. Apple Retina displays, and in browsers
- * that use odd pixel ratios in its backing image buffer.
- *
- * @param canvasSelection
- * Rave selection containing the <canvas> node(s).
- */
- /** @expose */
- rave.canvas.fixPixelDensity = function(canvasSelection) {
- return canvasSelection.each(function() {
-
- var bounds = this.getBoundingClientRect(),
- ctx = this.getContext('2d'),
- w = bounds.width,
- h = bounds.height;
-
- var dpr = window.devicePixelRatio || 1;
- var bsr = ctx.webkitBackingStorePixelRatio ||
- ctx.mozBackingStorePixelRatio ||
- ctx.msBackingStorePixelRatio ||
- ctx.oBackingStorePixelRatio ||
- ctx.backingStorePixelRatio || 1;
-
- var ratio = dpr / bsr;
-
- this.width = w * ratio;
- this.height = h * ratio;
- this.style.width = w + "px";
- this.style.height = h + "px";
-
- ctx.setTransform(ratio, 0, 0, ratio, 0, 0);
- ctx.save();
-
- this.rave_setProperty("__rave_canvas_ratio__", ratio);
- });
- }
- })();
- // This is the end of the factory method defined in the header. Added only during a full compiled JS build.
- return rave;
- }));})();
|