root/InOutExpositor/InOutExpositor.pde

Revision 3e73eb74f88c840906f6889e46418bb8634af0b5, 22.6 kB (checked in by Robin Gareus <robin@…>, 11 months ago)

image loading optimizations and titles..

  • Property mode set to 100644
Line 
1/////////////////////////////////////////////////////////////////////////////////////////////////////////////
2/////////////////////////////////////////////////////////////////////////////////////////////////////////////
3/*
4This applet is based on the code from the InOutServer applet.
5Only Specific parts (not included in the InOutServer applet) are commented here.
6InOutExpositor loads the "inout.xml" file (manually, or checking regularly if there is a newer version).
7It creates Client objects representing the IN/OUT projects (see comments in the InOutServer applet).
8It gets some preview .png files too, using the 'list.txt' file produced by InOutPreviewer.
9Different display modes are available (see mModes).
10When inactive during a certain amount of time, the AUTOPILOT mode switch automatically between display modes. (and loads the XML)
11Note that that all Flags are reseted when changing modes
12As indicated on screen, press 'DEL' to see how to show/hide things.
13*/
14////////////////////////////////////////////////////////////////////////////// Libraries
15import processing.opengl.*; // uncommented if application mode
16import java.util.Vector;
17import traer.physics.*;
18import processing.xml.*; // XML in
19import java.io.*; // get list of files in directory
20import fullscreen.*;
21
22FullScreen fs;
23////////////////////////////////////////////////////////////////////////////// Screen
24// WARNING ! : to export as web applet, you must set the size() arguments manually too
25int windW = 1024 ; // Set to screen resolution to get fullscreen in 'Present' mode (or when exporting as application)
26int windH = 768 ;
27//int windW = 800 ;
28//int windH = 500 ;
29////////////////////////////////////////////////////////////////////////////// Auto Pilot Mode
30int autoPilotLaunchCompt = 50*25 ; // time before AUTO
31int autoPilotBetween = 20*25 ; // time between AUTO modes
32int fadingTime = 7*25 ; // fading time between modes
33////////////////////////////////////////////////////////////////////////////// LOADING FROM XML(s) :
34int MAXXMLFILES = 9999 ;
35int currXmlListN = 0 ;
36boolean goFullscreen = false;
37boolean loadXmlFromSample = false ;
38boolean loadFromXMLlist = false ;
39boolean loadFromXMLlistAutoRun = true ; // auto play the XML list (anyway, try the bottom time-slider)
40String xmlFilesFolder = "/xmlList/" ; // XML LIST FOLDER !! WARNING : only "inout_xxx.xml" files in the folder (not ".DS_store" or others)
41//String xmlFileAddressLive = "http://io.citu.fr/data/inout.xml" ; // current XML from server
42String xmlFileAddressLive = "http://theartcollider.net/yp/ioxml.php" ; // current XML from server
43String xmlFileAddressSample = "http://theartcollider.net/data/inout_sample.xml" ; // with fictive connexions
44//String xmlFileAddressSample = "inout.xml"; // local included example XML
45//String previewFilesAddress = "http://io.citu.fr/previews" ;
46String previewFilesAddress = "http://theartcollider.net/yp/_thumb/" ;
47////////////////////////////////////////////////////////////////////////////// XML List replay mode
48int minTimeStamp = 2000000000 ;
49int maxTimeStamp = 0 ;
50int currTimeStamp ;
51int nXmlFiles ;
52int SaveFrameCnt = 0;
53////////////////////////////////////////////////////////////////////////////// Various
54PFont font;
55ParticleSystem physics;
56Particle center ;
57////////////////////////////////////////////////////////////////////////////// CLIENTS & STUFF INIT
58int nClients = 0 ;     // Nombre de clients
59Vector myClients ;     // PROJECTS (Clients)
60Client highlighted, selected ;   // selected Client
61////////////////////////////////////////////////////////////////////////////// OTHER USEFUL CLASSes
62Explorator selectedExplorator ;
63Explorator liveExplorator ;      // to display selected LiveTrajectWeb (reseau des connexions)
64State drawnState ; // current displayed config
65GraphUtils clientGraphUtils ;
66LocationUtils clientsLocationUtils ;
67
68String[] modeTitle;
69int currMode = 0 ;
70
71////////////////////////////////////////////////////////////
72int MAXPNGER = 2 ; // png preview images MALLOC size
73int PNGLOADINTERVAL = 90 ; // seconds before allowing to reload images
74
75////////////////////////////////////////////////////////////////////////////// PREVIEW PNG
76boolean gotPreviewImage = false ;
77PImage previewedImage ;
78PImage cImageMask ; // Round mask for preview images
79////////////////////////////////////////////////////////////////////////////// GENERALES
80String aSepa = "@" ; // sep entre adjectifs (ie param)
81String aVirg = "/" ; // sep entre valeurs d1 param
82String aTag = "%" ; // sep entre tag et valeur tag (nb d'occur)
83////////////////////////////////////////////////////////////////////////////// WINDOW
84int contextW = 100 ; // ContextMenu
85int contextH = 120 ;
86////////////////////////////////////////////////////////////////////////////// XML CLIENT/SERVER
87int compt = 0 ;
88int moduloXMLLoad = 200 ;
89String lastXmlDate = "" ;
90////////////////////////////////////////////////////////////////////////////// AUTOPILOT MODE variabes
91boolean autoPilot = false ; // to change views and move clients automatically
92int autoPilotCompt = 0 ;
93int autoPilotLastCompt = 0 ;
94int autoPilotBegCompt = 0;
95float fadeValue = 0 ;
96////////////////////////////////////////////////////////////////////////////// Clients Interpolation Mouvement Factor
97float clientsSpeedFactor = 0.95 ;
98int clearBckgOpacity = 10 ; // [0,255] (when clearBackground=false, controls remanence)
99////////////////////////////////////////////////////////////////////////////// FLAGS
100boolean radialClientsMovement = false ; // movement during mode change
101boolean pleaseWait = false ;
102boolean pleaseWait2= false ;
103int     bascNewMode = -1;
104boolean resetClients = true ;
105boolean running = false ;
106boolean clearBackground = true ;
107boolean allowDragX = true ;
108boolean allowDragY = true ;
109boolean contextualMenu = false ;
110boolean onlyRolloverText = false ;
111boolean showFlagsText = false ;
112boolean[] showType ;
113boolean data = true ;
114boolean audio = true ;
115boolean video = true ;
116/////////////////////////////////////// XML Loading
117boolean autoXmlLoad = false ;
118boolean loadXmlNow = false ;
119///////////////////////////////////////
120boolean displayHistoryQuads = false ;
121boolean displayGenome = false ;
122boolean displayClients = true ;
123boolean displayTrajet = false ;
124//////////////////////////////////////// MODES...
125boolean showStatsBackg = false ;
126boolean showBigPreview = false ;
127boolean showEllipses = false ;
128boolean showNormalCircle = false ;
129boolean showLocations = false ;
130/////////////////////////////////////// Client DRAW FLAGS
131boolean showClientBox = false ;
132boolean showClientInfo = false ;
133boolean showClientName = false ;
134boolean showTentacules = false ;
135/////////////////////////////////////// Satisfaction
136boolean showClientScore = false ;
137boolean showClientInFriends = false ;
138boolean showClientOutFriends = false ;
139/////////////////////////////////////// LINKS
140boolean showWordArborescence = false ;
141boolean showLinkCurves = false ;
142boolean showLinkDirect = true ;
143boolean showLinkSimple = false ;
144boolean showLinkArcs = false ;
145boolean showLinkTriangles = true ;
146boolean showLinkHalfCircles = false ;
147/////////////////////////////////////// PHYICS Modes
148boolean processPhysics = false ;
149boolean repulsionToAnother = false ;
150boolean springsToAnchor = false ;
151boolean springsToTags = false ;
152boolean springsToClients = false ;
153
154/////////////////////////////////////// MODES !!!!!
155String currentModeTitle = "-" ;
156
157/////////////////////////////////////// MODE - HORIZONTAL half circles
158float hwcYPos = windH/3 ;
159/////////////////////////////////////// MODE - STATS (activity,sociability)
160float stMargin = 220 ;
161/////////////////////////////////////// MODE - CIRCLE (OLD, unused)
162float cirMX = windW*4/7 ;
163float cirMY = windH-windH/4 ;
164float cirMR = windW/2 ;
165float cirMDateWidth = windW/3; // width of dates
166int cirNLevel = 10 ;
167int cirNLevelOp = 7 ;
168float cirMbeginAng = PI ; // clients on circle
169float cirMapertureAng = 2*PI/3 ; // idem
170/////////////////////////////////////// MODE - systeme solaire
171float ellipseA = 80 ;
172float ellipseB = 40 ;
173float clientBoxH = 20 ; // Cell box
174float clientBoxL = 40 ;
175color dColor = color(200,200,200) ;
176color aColor = color(10,10,200) ;
177color vColor = color(200,10,10) ;
178////////////////////////////////////// MODE - explorator
179float openANG = PI/5 ;
180float shiftANG = -PI/6 ;
181int explDepthMAX = 6 ;
182int inDepth = explDepthMAX ;
183int outDepth = explDepthMAX ;
184////////////////////////////////////// STATISTIQUES
185int clientsOldestDate = 0 ;
186int clientsNewestDate = 0 ;
187/////////////////////////////////////// LOCAL Vars
188int nClients2 = nClients*nClients ; // N^2
189float upControlZone = 0 ; //95 ;
190float centerY ;
191int N_nClients = nClients ;
192
193
194//////////////////////////////////////////////////////////////////////////////////////////
195//////////////////////////////////////////////////////////////////////////////////////////
196
197Thread loadThread;
198ImageLoader loader;
199
200void setup()
201{
202//  size(800,600,OPENGL);
203  size(windW,windH);
204  background(10);
205  smooth();
206  frameRate(25) ;
207  font = loadFont("Verdana-48.vlw");
208  //font = loadFont("Verdana-11.vlw");
209  textFont(font,10);
210  textMode(MODEL); // default mode
211
212  //cImageMask = loadImage("cImageMaskE.png") ;
213
214  centerY = upControlZone + (height-upControlZone)/2.0 ;
215
216  ///////////////////////////////////////////////////////////////////////////////// Physics
217  physics = new ParticleSystem( 0, 0.05 );
218  center = physics.makeParticle( 1.0, width/2, upControlZone + (height-upControlZone)/2, 0 );
219  center.makeFixed() ;
220 
221  //////////////////////////////
222  showType = new boolean[3] ;
223  showType[0] = true ;
224  showType[1] = true ;
225  showType[2] = true ;
226  //////////////////////////////
227
228  myClients = new Vector() ;
229  nClients = int(N_nClients) ;
230  nClients2 = nClients*nClients ;
231  drawnState = new State(nClients2) ;
232
233  setTypeColors();
234  modeTitle = new String[6] ;
235  //////////////////////////////////////////////////////////// MODE TITLES
236  /*
237        modeTitle[0] = "Connections (<)" ;
238  modeTitle[1] = "Physical and Metaphysical Locations (w)" ;
239  modeTitle[2] = "Sociability and Nervousness (x)" ;
240  modeTitle[3] = "Treeview and Influences (c)";
241  modeTitle[4] = "Affinity Groups (v)" ;
242  modeTitle[5] = "Flux and Reflux (b)" ;
243  */
244  modeTitle[0] = "Connections" ;
245  modeTitle[1] = "Physical and Metaphysical Locations";
246  modeTitle[2] = "Sociability and Nervousness";
247  modeTitle[3] = "Treeview and Influences";
248  modeTitle[4] = "Affinity Groups";
249  modeTitle[5] = "Flux and Reflux";
250
251  loader=new ImageLoader();
252  loadThread=new Thread(loader);
253        loadThread.start();
254
255  if(loadFromXMLlist) getXMLlist() ; // loads XML list for player
256  if (goFullscreen) {
257    fs = new FullScreen(this);
258    fs.enter();
259  }
260}
261
262//////////////////////////////////////////////////////////////////////////////////////////
263//////////////////////////////////////////////////////////////////////////////////////////
264void draw()
265{   
266/*
267  if(frameCount%10==0) {
268    Client cli ;
269    for(int i=0;i<nClients;i++) {
270      cli = getClient(i);
271      if(cli.showPreview || cli.showSmallPreview) cli.thePNGs.nextImage() ;
272    }
273  }
274*/
275
276  compt++ ;
277  if(compt==30) loadXmlNow=true ;
278
279  if(processPhysics) physics.advanceTime( 1.0 );
280  if(clearBackground) fill(0) ;
281  else fill(0,clearBckgOpacity) ;
282  noStroke() ;
283  rect(0,0,width,height) ;
284
285  if(running && nClients>0) {
286    ////////////////////////////////////////////////////////////////////////////
287    ////////////////////////////////////////////////////////////////////////////
288    ////////////////////////////////////// MODE EXPOSITION : AUTOPILOT
289    if(!autoPilot && (compt-autoPilotLastCompt)>=autoPilotLaunchCompt) {
290      autoPilotBegCompt = compt ;
291      autoPilot = true ;
292      print("LAUNCHING AUTOPILOT !! after "+(compt-autoPilotLastCompt)+"\n") ;
293    }
294    if(autoPilot) {
295      autoPilotCompt = compt-autoPilotBegCompt;
296      /////////// Reloading XML at beginning
297      if(autoPilotCompt%autoPilotBetween==0) { // every 'autoPilotBetween' FRAMES
298        int modUlo = autoPilotCompt/autoPilotBetween ;
299        /*
300        int theMode = modUlo%6 ; // modes 0 1 2 3 4 5 only
301        */
302        // only modes 0 1 2 3 5
303        if ((modUlo%4)==4) {
304          modUlo++;
305        }
306        int theMode = modUlo%6 ;
307        if(theMode==0) loadXMLData() ;
308        basculeToMode(theMode) ; // Changing Mode
309      }
310
311      /////////// Fading screen :
312      float opacTime = autoPilotCompt%autoPilotBetween ;
313      if( opacTime>(autoPilotBetween-fadingTime) ) opacTime = autoPilotBetween - opacTime ;
314      if( opacTime<fadingTime )
315        fadeValue = 255 - 255*opacTime/(float)fadingTime ;
316      else fadeValue = 0 ;
317      if(fadeValue > 170 && (currMode==4||currMode==2)) pleaseWait = true ;
318      else pleaseWait = false ;
319    }
320
321    if (bascNewMode >=0) {
322      if (pleaseWait2==true) {basculeToMode(bascNewMode); bascNewMode=-1; pleaseWait2=false;}
323      else {pleaseWait2=true;}
324    }
325    ////////////////////////////////////////////////////////////////////////////
326    ////////////////////////////////////////////////////////////////////////////
327    ////////////////////////////////////// DRAWING ENVIRONMENT (backg)
328    if(showEllipses) traceEllipses() ;
329    if(showClientBox) refreshLinkedAngles() ;
330    if(showLinkHalfCircles) traceLinkHalfCircleBackg() ;
331    if(showNormalCircle) traceNormalCircleBackg() ; // old (concentric circles - sort by dates)
332    if(showStatsBackg) traceStatsBackg() ; // 2 axis : activity, sociability
333
334    ////////////////////////////////////////////////////////////////////////////
335    ////////////////////////////////////////////////////////////////////////////
336    ////////////////////////////////////// DRAWING CLIENTS
337    if(displayClients) {
338
339      //////// CLIENTS LINKS !!!
340      for(int i=0;i<nClients;i++)
341        if(showLinkTriangles) drawOutLinkTriangle( getClient(i) ) ;
342
343      for(int i=0;i<nClients;i++)
344        if(!displayTrajet) getClient(i).traceOutLinks() ;
345
346      //////// LOCATIONS (par dessus les liens!)
347      if(showLocations) clientsLocationUtils.trace() ;
348
349      //////// CLIENTS !!!
350      for(int i=0;i<nClients;i++)
351        getClient(i).traceClient() ;
352
353      //////// Depth Explorator (gray clones)
354      if(showEllipses) getSelected().traceExplorator() ;
355
356      //////// Live Sun beam traject
357      if(displayTrajet) traceTrajet() ;
358
359      //////// SHOW BIG PREVIEW (il peut y en avoir pluisieurs en mm tmps)
360      for(int i=0;i<nClients;i++) {
361        Client ccli = getClient(i);
362        if(ccli.showPreview) ccli.tracePreviewPNG(1) ;
363        if(ccli.showSmallPreview) ccli.tracePreviewPNG(0.2) ;
364      }
365
366    } // END if(display)
367    ////////////////////////////////////////////////////////
368    if(fadeValue>0) { // FADING ALL CLIENTS
369      noStroke();
370      fill(0,fadeValue) ;
371      rect(0,0,width,height) ;
372      for(int i=0;i<nClients;i++) getClient(i).traceClientPoint() ;
373    }
374
375  } //END if(running)
376  ////////////////////////////////////////////////////////
377  if(loadFromXMLlist && loadFromXMLlistAutoRun && compt>100) loadXmlNow=true ;
378
379  if(loadXmlNow || (autoXmlLoad && compt%moduloXMLLoad==0) ) {
380    if(!autoPilot) {
381      loadXMLData() ;
382      loadXmlNow = false ;
383    }
384  }
385
386  ////// INFO TEXT
387  traceInfoTexts() ; // CURRENT MODE TITLE
388  traceColorLegend(); // data/audio/video colors
389  if(showFlagsText) traceFlagsText() ;
390  if(pleaseWait || pleaseWait2) tracePleaseWait() ;
391
392  if(loadFromXMLlist) traceTimeLine() ; // mode : replaying list of XML files
393
394  if(loadFromXMLlist && currMode==2) repartClientsByStats( myClients ) ; // if displaying in StatsMode, we replace clients every frame
395
396  if (false) {
397    String FrameCounterOUT;
398    FrameCounterOUT = nf(SaveFrameCnt++, 6);
399    saveFrame("/tmp/iox/frame_"+FrameCounterOUT+".jpg");
400  }
401}
402////////////////////////////////////////////////////////////////////////////
403////////////////////////////////////////////////////////////////////////////
404float timeLineMargin = 10 ;
405void traceTimeLine() {
406  noFill() ;
407  stroke(255) ;
408  rect(timeLineMargin, height-2*timeLineMargin,width-2*timeLineMargin,timeLineMargin);
409  fill(200) ;
410  float INT = (maxTimeStamp-minTimeStamp) ;
411  float CURR = (currTimeStamp-minTimeStamp) ;
412  float xxx=(CURR*(width-2*timeLineMargin)/INT);
413  //print("EE "+xxx+"\n") ;
414  rect(timeLineMargin, height-2*timeLineMargin, timeLineMargin+xxx, timeLineMargin) ;
415  textAlign(LEFT);
416  textFont(font,10);
417  noStroke() ;
418  fill(255) ;
419  int tmpstmp = getTimeStampFromFileName( xmlFiles[currXmlListN%nXmlFiles] ) ;
420  String dateStr = formatTimeStamp(tmpstmp) ;
421  text(dateStr,timeLineMargin+xxx,height-2*timeLineMargin-4);
422}
423void traceLastOscMessage(String lmess) {
424  textAlign(CENTER);
425  textFont(font,10);
426  noStroke() ;
427  fill(255) ;
428  text(lmess,width/2,height-20);
429}
430void tracePleaseWait() {
431  fill(0,180);
432  rect(0,0,width,height);
433  fill(255) ;
434  textAlign(CENTER);
435  textFont(font,15);
436  noStroke() ;
437  fill(255) ;
438  text("Loading images ... please wait",width/2,height/2) ;
439}
440void traceInfoTexts() {
441  noStroke() ;
442  fill(255) ;
443  float bx=10;
444  float by=27;
445  textAlign(LEFT);
446  textFont(font,20);
447  text("TheArtCollider.org Traffic-Monitor",bx,by) ;
448        /*
449  textFont(font,10);
450  text("Press DEL to show/hide keyboard controls",bx,by+20) ;
451  textAlign(RIGHT);
452  float dy=16;
453  for(int m=0;m<6;m++) {
454    textFont(font,14);
455    if(currMode==m) fill(255) ;
456    else fill(120) ;
457    text(modeTitle[m],width-10,20+m*dy) ;
458  }
459  */
460  textAlign(RIGHT);
461        text(modeTitle[currMode],width-30,by) ;
462
463  fill(127,127,127) ;
464        ellipse(width-12, height-12, 18, 18);
465        ellipse(width-12, 20, 18, 18);
466  fill(255,255,127) ;
467  textFont(font,13);
468        text("?",width-8,height-7) ;
469        triangle(width-15, 13, width-5, 20, width-15, 27);
470
471  textAlign(LEFT) ;
472}
473///////////////////////////////////////////////////////
474void traceFlagsText() {
475  float widX = width/3 ; // largeur d'une bande
476  float pd = 10 ; // petit decalage debut en x
477  String info="" ;
478  String info2="" ;
479  String info3="" ;
480  noStroke() ;
481  fill(0,180);
482  rect(0,0,width,height);
483  fill(255) ;
484  textAlign(LEFT) ;
485
486  info += "=== GENERAL INFOS ===\n\n" ;
487  info += "nClients = "+nClients+"\n" ;
488  info += "h - displayClients = " +displayClients +"\n\n" ;
489
490  info += "=== PHYSICS OPTIONS ===\n\n" ;
491  info += "? - processPhysics = " +processPhysics +"\n\n" ;
492
493  info += "a - springsToAnchor = " +springsToAnchor +"\n" ;
494  info += "e - springsToClients = " +springsToClients +"\n" ;
495  info += "z - repulsionToAnother = " +repulsionToAnother +"\n\n\n" ;
496
497  info += "=== DISPLAY MODES ===\n\n" ;
498
499  info += "< - MODE Random\n" ;
500  info += "w - MODE Locations\n" ;
501  info += "x - MODE Stats\n" ;
502  info += "c - MODE Parcours\n" ;
503  info += "v - MODE Groups\n" ;
504  info += "b - MODE Arcs\n\n" ;
505  info += "t - launch live Trajects on selected\n\n" ;
506
507  info2 += "=== DISPLAY OPTIONS ===\n\n" ;
508  info2 += "= - showData = "+showType[0]+"\n" ;
509  info2 += "/ - showAudio = "+showType[1]+"\n" ;
510  info2 += "* - showVideo = "+showType[2]+"\n\n" ;
511
512  info2 += "q - clearBackground = " +clearBackground +"\n\n" ;
513
514  info2 += "n - onlyRolloverText = "+onlyRolloverText +"\n\n" ;
515
516  info2 += "1 - showClientBox = " +showClientBox +"\n" ;
517  info2 += "3 - showClientName = " +showClientName +"\n" ;
518  info2 += "9 - showClientInfo = " +showClientInfo +"\n" ;
519  info2 += "2 - showClientScore = " +showClientScore+"\n\n" ;
520
521  info2 += "i - showClientInFriends = " +showClientInFriends +"\n" ;
522  info2 += "o - showClientOutFriends = " +showClientOutFriends +"\n\n" ;
523
524  info2 += "8 - showLinkSimple = " +showLinkSimple +"\n" ;
525  info2 += "5 - showLinkDirect = " +showLinkDirect +"\n" ;
526  info2 += "4 - showLinkCurves = " +showLinkCurves +"\n" ;
527  info2 += "6 - showLinkArcs = " +showLinkArcs +"\n" ;
528  info2 += "0 - showLinkTriangles = " +showLinkTriangles +"\n\n" ;
529
530  info3 += "=== LOAD XML OPTIONS ===\n\n" ;
531  info3 += "XML LIST REPLAY MODE = "+loadFromXMLlist+"\n" ;
532  info3 += "r - loadFromXMLlistAutoRun = "+loadFromXMLlistAutoRun+"\n\n" ;
533  info3 += "l - loadXmlData\n" ;
534  info3 += "s - autoXmlLoad = "+autoXmlLoad+"\n" ;
535  info3 += "u - loadXmlFromSample = "+loadXmlFromSample+"\n" ;
536 
537
538  float plx = 70 ;
539  textFont(font,10);
540  text(info,pd,upControlZone+plx) ;
541  text(info2,widX+pd,upControlZone+plx) ;
542  text(info3,2*widX+pd,upControlZone+plx) ;
543}
544void traceColorLegend() {
545  noStroke() ;
546  textAlign(LEFT) ;
547  textFont(font,10);
548  float dec=40;
549  float dey=5;
550  float ll=10;
551  float gx=17;
552  float gy=height-50;
553  fill(dColor);
554  rect(gx,gy,ll,ll);
555  fill(255);
556  text("Data",gx,gy-dey);
557  fill(aColor);
558  rect(gx+dec,gy,ll,ll);
559  fill(255);
560  text("Audio",gx+dec,gy-dey);
561  fill(vColor);
562  rect(gx+2*dec,gy,ll,ll);
563  fill(255);
564  text("Video",gx+2*dec,gy-dey);
565}
566void traceLinkHalfCircleBackg() {
567  noStroke() ;
568  fill(150,60) ;
569  rect(0,0,width,hwcYPos) ;
570  stroke(100,130) ; 
571  line(0,hwcYPos,width,hwcYPos) ;
572}
573void traceStatsBackg() {
574  /////// TRACING STATS LEGEND : to do
575  //background(20) ;
576  //  float ox = stMargin ;
577  //  float oy = height-stMargin ;
578  //  float ax = width-stMargin ;
579  //  float ay = stMargin ;
580  //  noStroke() ;
581  //  fill(0) ;
582  //  rect(ox,ay,ax-stMargin,oy-stMargin) ;
583  //  stroke(70);
584  //  line(ox,oy,ax,oy) ;
585  //  line(ox,ay,ox,oy) ;
586
587}
588void traceNormalCircleBackg() {
589  background(70) ;
590  fill(0,cirNLevelOp) ;
591  //stroke(150,110) ;
592  noStroke() ;
593  ellipse(cirMX,cirMY,cirMR*2,cirMR*2) ;
594  float smallR = cirMR - cirMDateWidth ;
595  noStroke() ;
596  for(int u=0;u<cirNLevel;u++) {
597    float currR = smallR + (float)u*(cirMR-smallR)/cirNLevel ;
598    ellipse(cirMX,cirMY,currR*2,currR*2) ;
599  }
600  //        stroke(150,110) ;
601  //        fill(120) ;
602  //        ellipse(cirMX,cirMY,smallR*2,smallR*2) ;
603  //////// Scale LEGEND :
604  traceNormalCircleLegend() ;
605}
606void traceNormalCircleLegend() {
607  stroke(255) ;
608  strokeWeight(2) ;
609  line(cirMX,height-10,cirMX-cirMR,height-10) ;
610  int tn = 20 ;
611  for(int t=0;t<tn;t++) {
612    float tx = cirMX-t*cirMR/tn ;
613    line(tx,height-10, tx,height-15) ;
614  }
615  //clientsNewestDate
616  //clientsOldestDate
617  noStroke() ;
618  fill(255) ;
619  Date dd = new Date(clientsNewestDate) ;
620  textFont(font,10);
621  text("High "+dd.toString(),cirMX,height-20);
622  text("Low "+clientsOldestDate,cirMX-cirMR,height-20);
623}
624void traceEllipses() {
625  float x,y,nx,ny,a,b,na,nb ;
626  float A,B,AA,BB ;
627  int N = 50 ;
628  float op ;
629  for (int c=0; c<8 ;c=c+1) {
630    op = 60.0*(1.0-(float)c/10.0) ;
631    if(c%2==1) fill(100,op);
632    else noFill() ;
633    for (int k=0; k<N ;k++) {
634      A = ellipseA*c;
635      B = ellipseB*c;
636      AA = ellipseA*(c+1);
637      BB = ellipseB*(c+1);
638
639      x = width/2 + A*cos(k*2*PI/N) ;
640      y = centerY + B*sin(k*2*PI/N) ;
641      nx = width/2 + A*cos((k+1)*2*PI/N) ;
642      ny = centerY + B*sin((k+1)*2*PI/N) ;
643
644      a = width/2 + AA*cos(k*2*PI/N) ;
645      b = centerY + BB*sin(k*2*PI/N) ;
646      na = width/2 + AA*cos((k+1)*2*PI/N) ;
647      nb = centerY + BB*sin((k+1)*2*PI/N) ;
648      noStroke() ;
649      quad(x,y,a,b,na,nb,nx,ny) ;
650      stroke(200,op);
651      line(x,y,nx,ny) ;
652      line(a,b,na,nb) ;
653    }
654  }
655}
656////////////////////////////////////////////////////////////
657////////////////////////////////////////////////////////////
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
Note: See TracBrowser for help on using the browser.