| 1 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|---|
| 2 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|---|
| 3 | /* |
|---|
| 4 | This applet is based on the code from the InOutServer applet. |
|---|
| 5 | Only Specific parts (not included in the InOutServer applet) are commented here. |
|---|
| 6 | InOutExpositor loads the "inout.xml" file (manually, or checking regularly if there is a newer version). |
|---|
| 7 | It creates Client objects representing the IN/OUT projects (see comments in the InOutServer applet). |
|---|
| 8 | It gets some preview .png files too, using the 'list.txt' file produced by InOutPreviewer. |
|---|
| 9 | Different display modes are available (see mModes). |
|---|
| 10 | When inactive during a certain amount of time, the AUTOPILOT mode switch automatically between display modes. (and loads the XML) |
|---|
| 11 | Note that that all Flags are reseted when changing modes |
|---|
| 12 | As indicated on screen, press 'DEL' to see how to show/hide things. |
|---|
| 13 | */ |
|---|
| 14 | ////////////////////////////////////////////////////////////////////////////// Libraries |
|---|
| 15 | import processing.opengl.*; // uncommented if application mode |
|---|
| 16 | import java.util.Vector; |
|---|
| 17 | import traer.physics.*; |
|---|
| 18 | import processing.xml.*; // XML in |
|---|
| 19 | import java.io.*; // get list of files in directory |
|---|
| 20 | import fullscreen.*; |
|---|
| 21 | |
|---|
| 22 | FullScreen fs; |
|---|
| 23 | ////////////////////////////////////////////////////////////////////////////// Screen |
|---|
| 24 | // WARNING ! : to export as web applet, you must set the size() arguments manually too |
|---|
| 25 | int windW = 1024 ; // Set to screen resolution to get fullscreen in 'Present' mode (or when exporting as application) |
|---|
| 26 | int windH = 768 ; |
|---|
| 27 | //int windW = 800 ; |
|---|
| 28 | //int windH = 500 ; |
|---|
| 29 | ////////////////////////////////////////////////////////////////////////////// Auto Pilot Mode |
|---|
| 30 | int autoPilotLaunchCompt = 50*25 ; // time before AUTO |
|---|
| 31 | int autoPilotBetween = 20*25 ; // time between AUTO modes |
|---|
| 32 | int fadingTime = 7*25 ; // fading time between modes |
|---|
| 33 | ////////////////////////////////////////////////////////////////////////////// LOADING FROM XML(s) : |
|---|
| 34 | int MAXXMLFILES = 9999 ; |
|---|
| 35 | int currXmlListN = 0 ; |
|---|
| 36 | boolean goFullscreen = false; |
|---|
| 37 | boolean loadXmlFromSample = false ; |
|---|
| 38 | boolean loadFromXMLlist = false ; |
|---|
| 39 | boolean loadFromXMLlistAutoRun = true ; // auto play the XML list (anyway, try the bottom time-slider) |
|---|
| 40 | String 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 |
|---|
| 42 | String xmlFileAddressLive = "http://theartcollider.net/yp/ioxml.php" ; // current XML from server |
|---|
| 43 | String 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" ; |
|---|
| 46 | String previewFilesAddress = "http://theartcollider.net/yp/_thumb/" ; |
|---|
| 47 | ////////////////////////////////////////////////////////////////////////////// XML List replay mode |
|---|
| 48 | int minTimeStamp = 2000000000 ; |
|---|
| 49 | int maxTimeStamp = 0 ; |
|---|
| 50 | int currTimeStamp ; |
|---|
| 51 | int nXmlFiles ; |
|---|
| 52 | int SaveFrameCnt = 0; |
|---|
| 53 | ////////////////////////////////////////////////////////////////////////////// Various |
|---|
| 54 | PFont font; |
|---|
| 55 | ParticleSystem physics; |
|---|
| 56 | Particle center ; |
|---|
| 57 | ////////////////////////////////////////////////////////////////////////////// CLIENTS & STUFF INIT |
|---|
| 58 | int nClients = 0 ; // Nombre de clients |
|---|
| 59 | Vector myClients ; // PROJECTS (Clients) |
|---|
| 60 | Client highlighted, selected ; // selected Client |
|---|
| 61 | ////////////////////////////////////////////////////////////////////////////// OTHER USEFUL CLASSes |
|---|
| 62 | Explorator selectedExplorator ; |
|---|
| 63 | Explorator liveExplorator ; // to display selected LiveTrajectWeb (reseau des connexions) |
|---|
| 64 | State drawnState ; // current displayed config |
|---|
| 65 | GraphUtils clientGraphUtils ; |
|---|
| 66 | LocationUtils clientsLocationUtils ; |
|---|
| 67 | |
|---|
| 68 | String[] modeTitle; |
|---|
| 69 | int currMode = 0 ; |
|---|
| 70 | |
|---|
| 71 | //////////////////////////////////////////////////////////// |
|---|
| 72 | int MAXPNGER = 2 ; // png preview images MALLOC size |
|---|
| 73 | int PNGLOADINTERVAL = 90 ; // seconds before allowing to reload images |
|---|
| 74 | |
|---|
| 75 | ////////////////////////////////////////////////////////////////////////////// PREVIEW PNG |
|---|
| 76 | boolean gotPreviewImage = false ; |
|---|
| 77 | PImage previewedImage ; |
|---|
| 78 | PImage cImageMask ; // Round mask for preview images |
|---|
| 79 | ////////////////////////////////////////////////////////////////////////////// GENERALES |
|---|
| 80 | String aSepa = "@" ; // sep entre adjectifs (ie param) |
|---|
| 81 | String aVirg = "/" ; // sep entre valeurs d1 param |
|---|
| 82 | String aTag = "%" ; // sep entre tag et valeur tag (nb d'occur) |
|---|
| 83 | ////////////////////////////////////////////////////////////////////////////// WINDOW |
|---|
| 84 | int contextW = 100 ; // ContextMenu |
|---|
| 85 | int contextH = 120 ; |
|---|
| 86 | ////////////////////////////////////////////////////////////////////////////// XML CLIENT/SERVER |
|---|
| 87 | int compt = 0 ; |
|---|
| 88 | int moduloXMLLoad = 200 ; |
|---|
| 89 | String lastXmlDate = "" ; |
|---|
| 90 | ////////////////////////////////////////////////////////////////////////////// AUTOPILOT MODE variabes |
|---|
| 91 | boolean autoPilot = false ; // to change views and move clients automatically |
|---|
| 92 | int autoPilotCompt = 0 ; |
|---|
| 93 | int autoPilotLastCompt = 0 ; |
|---|
| 94 | int autoPilotBegCompt = 0; |
|---|
| 95 | float fadeValue = 0 ; |
|---|
| 96 | ////////////////////////////////////////////////////////////////////////////// Clients Interpolation Mouvement Factor |
|---|
| 97 | float clientsSpeedFactor = 0.95 ; |
|---|
| 98 | int clearBckgOpacity = 10 ; // [0,255] (when clearBackground=false, controls remanence) |
|---|
| 99 | ////////////////////////////////////////////////////////////////////////////// FLAGS |
|---|
| 100 | boolean radialClientsMovement = false ; // movement during mode change |
|---|
| 101 | boolean pleaseWait = false ; |
|---|
| 102 | boolean pleaseWait2= false ; |
|---|
| 103 | int bascNewMode = -1; |
|---|
| 104 | boolean resetClients = true ; |
|---|
| 105 | boolean running = false ; |
|---|
| 106 | boolean clearBackground = true ; |
|---|
| 107 | boolean allowDragX = true ; |
|---|
| 108 | boolean allowDragY = true ; |
|---|
| 109 | boolean contextualMenu = false ; |
|---|
| 110 | boolean onlyRolloverText = false ; |
|---|
| 111 | boolean showFlagsText = false ; |
|---|
| 112 | boolean[] showType ; |
|---|
| 113 | boolean data = true ; |
|---|
| 114 | boolean audio = true ; |
|---|
| 115 | boolean video = true ; |
|---|
| 116 | /////////////////////////////////////// XML Loading |
|---|
| 117 | boolean autoXmlLoad = false ; |
|---|
| 118 | boolean loadXmlNow = false ; |
|---|
| 119 | /////////////////////////////////////// |
|---|
| 120 | boolean displayHistoryQuads = false ; |
|---|
| 121 | boolean displayGenome = false ; |
|---|
| 122 | boolean displayClients = true ; |
|---|
| 123 | boolean displayTrajet = false ; |
|---|
| 124 | //////////////////////////////////////// MODES... |
|---|
| 125 | boolean showStatsBackg = false ; |
|---|
| 126 | boolean showBigPreview = false ; |
|---|
| 127 | boolean showEllipses = false ; |
|---|
| 128 | boolean showNormalCircle = false ; |
|---|
| 129 | boolean showLocations = false ; |
|---|
| 130 | /////////////////////////////////////// Client DRAW FLAGS |
|---|
| 131 | boolean showClientBox = false ; |
|---|
| 132 | boolean showClientInfo = false ; |
|---|
| 133 | boolean showClientName = false ; |
|---|
| 134 | boolean showTentacules = false ; |
|---|
| 135 | /////////////////////////////////////// Satisfaction |
|---|
| 136 | boolean showClientScore = false ; |
|---|
| 137 | boolean showClientInFriends = false ; |
|---|
| 138 | boolean showClientOutFriends = false ; |
|---|
| 139 | /////////////////////////////////////// LINKS |
|---|
| 140 | boolean showWordArborescence = false ; |
|---|
| 141 | boolean showLinkCurves = false ; |
|---|
| 142 | boolean showLinkDirect = true ; |
|---|
| 143 | boolean showLinkSimple = false ; |
|---|
| 144 | boolean showLinkArcs = false ; |
|---|
| 145 | boolean showLinkTriangles = true ; |
|---|
| 146 | boolean showLinkHalfCircles = false ; |
|---|
| 147 | /////////////////////////////////////// PHYICS Modes |
|---|
| 148 | boolean processPhysics = false ; |
|---|
| 149 | boolean repulsionToAnother = false ; |
|---|
| 150 | boolean springsToAnchor = false ; |
|---|
| 151 | boolean springsToTags = false ; |
|---|
| 152 | boolean springsToClients = false ; |
|---|
| 153 | |
|---|
| 154 | /////////////////////////////////////// MODES !!!!! |
|---|
| 155 | String currentModeTitle = "-" ; |
|---|
| 156 | |
|---|
| 157 | /////////////////////////////////////// MODE - HORIZONTAL half circles |
|---|
| 158 | float hwcYPos = windH/3 ; |
|---|
| 159 | /////////////////////////////////////// MODE - STATS (activity,sociability) |
|---|
| 160 | float stMargin = 220 ; |
|---|
| 161 | /////////////////////////////////////// MODE - CIRCLE (OLD, unused) |
|---|
| 162 | float cirMX = windW*4/7 ; |
|---|
| 163 | float cirMY = windH-windH/4 ; |
|---|
| 164 | float cirMR = windW/2 ; |
|---|
| 165 | float cirMDateWidth = windW/3; // width of dates |
|---|
| 166 | int cirNLevel = 10 ; |
|---|
| 167 | int cirNLevelOp = 7 ; |
|---|
| 168 | float cirMbeginAng = PI ; // clients on circle |
|---|
| 169 | float cirMapertureAng = 2*PI/3 ; // idem |
|---|
| 170 | /////////////////////////////////////// MODE - systeme solaire |
|---|
| 171 | float ellipseA = 80 ; |
|---|
| 172 | float ellipseB = 40 ; |
|---|
| 173 | float clientBoxH = 20 ; // Cell box |
|---|
| 174 | float clientBoxL = 40 ; |
|---|
| 175 | color dColor = color(200,200,200) ; |
|---|
| 176 | color aColor = color(10,10,200) ; |
|---|
| 177 | color vColor = color(200,10,10) ; |
|---|
| 178 | ////////////////////////////////////// MODE - explorator |
|---|
| 179 | float openANG = PI/5 ; |
|---|
| 180 | float shiftANG = -PI/6 ; |
|---|
| 181 | int explDepthMAX = 6 ; |
|---|
| 182 | int inDepth = explDepthMAX ; |
|---|
| 183 | int outDepth = explDepthMAX ; |
|---|
| 184 | ////////////////////////////////////// STATISTIQUES |
|---|
| 185 | int clientsOldestDate = 0 ; |
|---|
| 186 | int clientsNewestDate = 0 ; |
|---|
| 187 | /////////////////////////////////////// LOCAL Vars |
|---|
| 188 | int nClients2 = nClients*nClients ; // N^2 |
|---|
| 189 | float upControlZone = 0 ; //95 ; |
|---|
| 190 | float centerY ; |
|---|
| 191 | int N_nClients = nClients ; |
|---|
| 192 | |
|---|
| 193 | |
|---|
| 194 | ////////////////////////////////////////////////////////////////////////////////////////// |
|---|
| 195 | ////////////////////////////////////////////////////////////////////////////////////////// |
|---|
| 196 | |
|---|
| 197 | Thread loadThread; |
|---|
| 198 | ImageLoader loader; |
|---|
| 199 | |
|---|
| 200 | void 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 | ////////////////////////////////////////////////////////////////////////////////////////// |
|---|
| 264 | void 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 | //////////////////////////////////////////////////////////////////////////// |
|---|
| 404 | float timeLineMargin = 10 ; |
|---|
| 405 | void 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 | } |
|---|
| 423 | void traceLastOscMessage(String lmess) { |
|---|
| 424 | textAlign(CENTER); |
|---|
| 425 | textFont(font,10); |
|---|
| 426 | noStroke() ; |
|---|
| 427 | fill(255) ; |
|---|
| 428 | text(lmess,width/2,height-20); |
|---|
| 429 | } |
|---|
| 430 | void 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 | } |
|---|
| 440 | void 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 | /////////////////////////////////////////////////////// |
|---|
| 474 | void 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 | } |
|---|
| 544 | void 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 | } |
|---|
| 566 | void traceLinkHalfCircleBackg() { |
|---|
| 567 | noStroke() ; |
|---|
| 568 | fill(150,60) ; |
|---|
| 569 | rect(0,0,width,hwcYPos) ; |
|---|
| 570 | stroke(100,130) ; |
|---|
| 571 | line(0,hwcYPos,width,hwcYPos) ; |
|---|
| 572 | } |
|---|
| 573 | void 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 | } |
|---|
| 588 | void 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 | } |
|---|
| 606 | void 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 | } |
|---|
| 624 | void 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 | |
|---|