//////-class UIset Start-//////////////////////////////// class UIset{ float x; float y; float uiw; float uih; boolean isSaved; boolean isUncheck; int unCheckCase; // test input text INputTextfield testf; //initiate Button object Button refresh_b, save_b, cancel_b, continue_b; //color ColorSelectUI csu; // AskSpaceIssue AskSpaceIssue askspace; // personal info UserInfo u_info; // TITLE Textbox title; Textbox error; String errorCase; UIset(float x_, float y_){ x = x_; y = y_; //title String guiTitle = "Audience survey pannel"; title = new Textbox(guiTitle, x+10, y+8, 300, 40, 14, font_meta24); error = new Textbox("uncheck", x+10, y+8, 450, 40, 14, font_meta14); // declare button refresh_b = new Button("REFRESH", x + 501, y + 322, 58, 20,10, 1,1,font_meta11 ); cancel_b = new Button("CANCEL", x + 501 + 70, y + 322, 58, 20,10, 1,1,font_meta11); save_b = new Button("SAVE", x + 501 + 140, y + 322, 58, 20,10, 1,1,font_meta11); continue_b = new Button("CONTINUE", x + 380 -29, y + 250, 58, 20,10, 1,1,font_meta11); // csu csu = new ColorSelectUI(x+10,y+50,200); // AskSpaceIssue askspace = new AskSpaceIssue(x+230,y+50,250,220); // u_info u_info = new UserInfo(x+500, y+50, 200); isSaved = false; isUncheck = false; } void display(){ fill(255,40); rect(x, y+41, 220, 320); fill(255,60); rect(x+221, y+41, 269, 320); fill(255,40); rect(x+491, y+41, 219, 320); fill(255,20); rect(x, y, 710, 40); fill(255, 60); title.textBox(); // button refresh_b.display(); cancel_b.display(); save_b.display(); // csu fill(255); csu.display(); // u_info u_info.display(); // spaceIssue askspace.display(); // add userinfo; // addArray(); // reset if(refresh_b.on == 1 || cancel_b.on == 1){ reset(); } // checkunfill if(save_b.on == 1){ checkingUnfill(); } // display error errorDisplay(unCheckCase); if(continue_b.on == 1){ isUncheck = false; //println(isUncheck); } } void setPosition(float xx, float yy){ x = xx; y = yy; u_info.setPosition(x, y); } void addArray(){ // Question part01-emotion emotionArray = splice(emotionArray, csu.askFeel.selectItem, count); rv = splice(rv, csu.cset.redbar.rv ,count); gv = splice(gv, csu.cset.greenbar.gv ,count); bv = splice(bv, csu.cset.bluebar.bv ,count); // Question part02-evaluation askFeelArray = splice(askFeelArray, askspace.favour, count); distanceArray = splice(distanceArray, askspace.askSpace.ratioValue, count); darkArray = splice(darkArray, askspace.askDark.ratioValue, count); softArray = splice(softArray, askspace.askSoftness.ratioValue, count); locationArray = splice(locationArray, int(askspace.askSpace.ratioValue), count); // Question part03-demographic genderArray = splice(genderArray, u_info.gender.selectId, count); ageArray = splice(ageArray, u_info.age.selectId, count); nameArray = splice( nameArray, u_info.input_name.textContents, count); commentArray = splice(commentArray, u_info.input_comment.textContents,count); } void reset(){ // Question part03-demographic u_info.gender.selectId = 0; u_info.age.selectId = 0; u_info.input_name.textField.textContent = u_info.input_name.textField.textContent.substring(0, 0); u_info.input_name.textField2.textContent = u_info.input_name.textField2.textContent.substring(0, 0); u_info.input_name.labeltext = "name"; u_info.input_name.reset = true; u_info.input_comment.textField.textContent = u_info.input_comment.textField.textContent.substring(0, 0); u_info.input_comment.textField2.textContent = u_info.input_comment.textField2.textContent.substring(0, 0); u_info.input_comment.labeltext = "Is it like a ride?"; u_info.input_comment.reset = true; // Question part02-evaluation askspace.askSpace.hd.x = askspace.askSpace.bx + askspace.w/2 - askspace.askSpace.hw; askspace.askDark.hd.x = askspace.askDark.bx + askspace.w/2 - askspace.askDark.hw; askspace.askSoftness.hd.x = askspace.askSoftness.bx + askspace.w/2 - askspace.askSoftness.hw; askspace.radio[0].bg.isLocked = false; askspace.radio[1].bg.isLocked = false; // Question part01-emotion csu.askFeel.selectId = 0; csu.cset.redbar.incres = 0; csu.cset.greenbar.incres = 0; csu.cset.bluebar.incres = 0; } void checkingUnfill(){ if(csu.askFeel.selectId == 0){ unCheckCase = 1; isUncheck = true; } if(u_info.gender.selectId == 0){ unCheckCase = 2; isUncheck = true; } if(u_info.age.selectId == 0){ unCheckCase = 3; isUncheck = true; } if((csu.cset.redbar.rv+csu.cset.greenbar.gv+csu.cset.bluebar.bv)==0){ unCheckCase = 4; isUncheck = true; } if(askspace.favour == 0){ unCheckCase = 5; isUncheck = true; } if(u_info.input_comment.labeltext == "Is it like a ride?"){ unCheckCase = 6; isUncheck = true; } if(u_info.input_name.labeltext == "name"){ unCheckCase = 7; isUncheck = true; } } void errorDisplay(int caseNum_){ if(isUncheck == true){ switch(caseNum_){ case 1: errorCase = "You did not select item from the emotion selection, Please select one of them to continue."; break; case 2: errorCase = "You did not mark your gender from the gender selection, Please select one of them to continue."; break; case 3: errorCase = "You did not mark your age group from the age group selection, Please select one of them to continue."; break; case 4: errorCase = "You did not pick the color for your feeling, Please move the color scrollbar to change it."; break; case 5: errorCase = "You did not mark your experience from the question selection, Please mark them to continue."; break; case 6: errorCase = "You did not give your comment, Please give us your opinion to continue.."; break; case 7: errorCase = "You did not give your name, Please let us know your name to continue."; break; } fill(0,220); rect(x,y,760,360); fill(255); textFont(font_meta14); float ew = textWidth(errorCase); text(errorCase, int(x+(760-ew)/2) , int(y+200)); continue_b.display(); } } } /////Class UIset end///////////////////////////////////////////////////// // class UserInfo Begin---> UIset /////////////////////////////////////// class UserInfo{ float x, y, w; Textbox userT_01, userT_02; Choise age; Choise gender; // test input text INputTextfield input_name, input_comment; UserInfo(float x_, float y_, float w_){ x = x_; y = y_; w = w_; String ut_01 = "Could you leave your general information- Name, Gender, Age Group ? "; userT_01 = new Textbox(ut_01, x, y, w, 40, 14, font_meta11); //testf String name = "name"; input_name = new INputTextfield(name, x, y+40, 200, 23, 14 ,font_meta12); String[] gender_s = { "Gender","Female", "male" }; gender = new Choise(gender_s, x+1, y+70, 60, font_meta11); String[] age_s = { "Age Group", "0-10","11-20", "21-30","31-40","41-50","51-60","61-70","Over 70s" }; age = new Choise(age_s, x+90, y+70, 87, font_meta11); String ut_02 = "Does this exhibition remind you of some other place or exhibition?"; userT_02 = new Textbox(ut_02, x, y+120, w, 40, 14, font_meta11); String comment = "Is it like a ride? "; input_comment = new INputTextfield(comment, x, y+155, 200, 60, 14 ,font_meta12); } void display(){ fill(255); // testf input_name.display(); input_comment.display(); // fill(255); userT_01.textBox(); userT_02.textBox(); age.display(); gender.display(); } void setPosition(float xx, float yy){ x = xx; y = yy; } } // class UserInfo End---> UIset /////////////////////////////////////// class AskSpaceIssue{ float x, y, w, h; NewScrollBar askDark; NewScrollBar askSoftness; NewScrollBar askSpace; Textbox spaceIssue_01, spaceIssue_01_1,spaceIssue_02, spaceIssue_03, cap; Radio[] radio; int favour = 0; AskSpaceIssue(float x_, float y_, float w_, float h_){ x = x_; y = y_; w = w_; h = h_; String s01 = "Do you feel comfortable to move around the space with other people?"; spaceIssue_01 = new Textbox(s01, x, y, w, 40, 14, font_meta11); String cap_ = "Please position the sliders to indicate where along the scale that best fits your opinion."; cap = new Textbox(cap_, x, y+70, w, 50, 12, font_meta10); String s01_01 = "How much space do you need to feel comfortable to move?"; spaceIssue_01_1 = new Textbox(s01_01, x, y+107, w, 40, 14, font_meta11); askSpace = new NewScrollBar(x, y+142, w, 15, 15); askSpace.bgColor = color(255,0); askSpace.hd.x = askSpace.bx + w/2 - askSpace.hw; String s02 = "Is the space dark? How dark is dark? "; spaceIssue_02 = new Textbox(s02,x, y+187, w, 40, 14, font_meta11); askDark = new NewScrollBar(x, y+207, w, 15, 15); askDark.bgColor = color(255,0); askDark.hd.x = askDark.bx + w/2 - askDark.hw; String s03 = "Is the floor hard or soft?"; spaceIssue_03 = new Textbox(s03, x, y+252, w, 40, 14, font_meta11); askSoftness = new NewScrollBar(x, y+272, w, 15, 15); askSoftness.bgColor = color(255,0); askSoftness.hd.x = askSoftness.bx + w/2 - askSoftness.hw; radio = new Radio[2]; for(int i=0; i<2; i++){ //float x = i*100;// radio[i] = new Radio(5+x+i*120, y+40, 10, color(255), color(0), i, radio); } } void display(){ bgDistance(askSpace.bx, askSpace.by, askSpace.bw, askSpace.bh); askSpace.display(); fill(60); textFont(font_meta10); text("1 meter", askDark.bx+1+2, askSpace.by+1+10); fill(60); String d="3 meters"; float dwidth = textWidth(d)+5; text(d, askDark.bx+1+askDark.bw - dwidth, askSpace.by+1+10); bgDark(askDark.bx, askDark.by, askDark.bw, askDark.bh); askDark.display(); fill(220); textFont(font_meta10); text("Dark", askDark.bx+1+2, askDark.by+1+10); fill(60); String l="Light"; float lwidth = textWidth(l)+5; text(l, askDark.bx+1+askDark.bw - lwidth, askDark.by+1+10); bgFloor(askSoftness.bx, askSoftness.by, askSoftness.bw, askSoftness.bh); askSoftness.display(); fill(60); textFont(font_meta10); text("Hard", askDark.bx+1+2, askSoftness.by+1+10); fill(60); String s="Soft"; float swidth = textWidth(s)+5; text(s, askDark.bx+1+askDark.bw - swidth, askSoftness.by+1+10); for(int i=0; i<2; i++){ radio[i].display(); if(mousePressed){ radio[i].press(mouseX, mouseY); } if(radio[0].bg.isLocked == true){ favour =1; } if(radio[1].bg.isLocked == true){ favour =2; } } fill(255,150); cap.textBox(); fill(255); spaceIssue_01.textBox(); fill(220); textFont(font_meta14); String yes="Yes, I do."; text(yes, radio[1].x + radio[1].size, radio[1].y + 4); fill(220); textFont(font_meta14); String no="No, I do not."; text(no, radio[0].x +radio[0].size , radio[1].y + 4); spaceIssue_01_1.textBox(); spaceIssue_02.textBox(); spaceIssue_03.textBox(); } void update(){ for(int i=0; i<2; i++){ radio[i].press(mouseX, mouseY); } } void bgDistance(float bx, float by, float bw, float bh){ noStroke(); fill(255); rect(bx, by, bw, bh); fill(220); rect(bx+1, by+1, bw-2, bh-2); fill(60); triangle(bx+1+40+5, by+1+6.5-3, bx+1+40+5, by+1+6.5+3, bx+1+40, by+1+6.5); triangle(bx+1+bw-44-5, by+1+6.5-3, bx+1+bw-44, by+1+6.5, bx+1+bw-44-5, by+1+6.5+3); stroke(120,80); line(bx+1+40, by+1+6.5, bx+1+bw-44, by+1+6.5); noStroke(); } void bgDark(float bx, float by, float bw, float bh){ noStroke(); fill(255); rect(bx, by, bw, bh); fill(220); rect(bx+1, by+1, bw-2, bh-2); beginShape(QUADS); fill(40); vertex(bx+1, by+1); vertex(bx+1, by+1+bh-2); fill(220); vertex(bx+1+bw-2, by+1+bh-2); vertex(bx+1+bw-2, by+1); endShape(); } void bgFloor(float bx, float by, float bw, float bh){ noStroke(); fill(255); rect(bx, by, bw, bh); fill(220); rect(bx+1, by+1, bw-2, bh-2); stroke(120,80); line(bx+1+30, by+1+6.5, bx+1+bw-34, by+1+6.5); noStroke(); fill(30); rect(bx+1+30, by+1+2.5, 8, 8); ellipse( bx+1+bw-34, by+1+6.5, 8, 8); } } // Class ArcShape start --> Class ShapeControlPannel /////////////////////////////////////////////////////// class ArcShape{ float x, y, w, h, sto, sta; color arcFill; int alphaN; ArcShape(float x_, float y_, float w_, int alphaN_,int i_){ x = x_; y = y_; w = w_; h = w; alphaN = alphaN_; switch(i_){ case 0: arcFill = color(230,172,80); break; case 1: arcFill = color(178,86,61); break; case 2: arcFill = color(255,87,202); break; case 3: arcFill = color(106,51,178); break; case 4: arcFill = color(73,102,216); break; case 5: arcFill = color(63,199,130); break; case 6: arcFill = color(126,210,73); break; case 7: arcFill = color(160,149,46); break; } } void display(){ noStroke(); fill(arcFill, alphaN); float degg = radians(360/16); float start = TWO_PI-degg; float stop = degg; sto = start; sta = stop; arc(0, 0, w, h, start, stop); } void setSize(float x){ h = w = x; } void growSize(float x){ float targetX = x; float increas = 0.3; if(w < targetX){ w += (targetX-w)*increas; h += (targetX-h)*increas; } if(w == targetX){ h = w = x; } } } // Class ArcShape end /////////////////////////////////////////////////////// ///Class ColorSelectUI start ---> UIset////////////////////////////////////////////// class ColorSelectUI{ // start locaton, width float x,y,w,h; // float cx,cy; // comment pannel Choise askFeel; String ss[]={ "Emotion","Excited", "Relaxed", "Inquisitive", "Nervous", "Unsure", "Invigorated" }; // colorpannedl Colorpannel cset; // textBox Textbox tb_01,tb_02; Textbox tb_03; ColorSelectUI(float x_, float y_, float w_){ x = x_; y = y_; w = w_; // textBox ask feel String s_tb_01 = "Just before entering the exhibition how do you feel?"; tb_01 = new Textbox(s_tb_01, x , y, w,40,14,font_meta11); //println(tb_01.getTh()); String s_tb_02 = "Today, it was "; tb_02 = new Textbox(s_tb_02, x , y+43, w,20,14,font_meta14); // comment pannel_Choise class askFeel = new Choise(ss, x+tb_02.getLength()+8, y+40, w-(tb_02.getLength()+32), font_meta11); // textBox ask color String s_tb_03 = "If you express your feelings with a color, What kind of color could be matched with your feeling?"; tb_03 = new Textbox(s_tb_03, x , askFeel.y+askFeel.sellh+30, w, 60,14,font_meta11); // color pannel _ cset cset = new Colorpannel(x, askFeel.y + askFeel.sellh+tb_03.h+25, w, 25); } void display(){ //textBox fill(255); tb_01.textBox(); tb_02.textBox(); tb_03.textBox(); // color cset.display(); //askFeel display askFeel.display(); //println(askFeel.selectItem); } } ///Class ColorSelectUI end ///////////////////////////////////////// // color pannel --> ColorSelectUI//////////////////////////////////////////// class Colorpannel{ float x, y, w, h; Scrollbar redbar; Scrollbar greenbar; Scrollbar bluebar; color pickedColor; Textbox tb_04; Colorpannel(float xx, float yy, float ww, float hh){ x = xx; y = yy; w = ww; h = hh; // color handle redbar = new Scrollbar ( w, 10); greenbar = new Scrollbar (w, 10); bluebar = new Scrollbar (w, 10); String s_tb_04 = "Move the scrollbars left and right to change the represented color."; tb_04 = new Textbox(s_tb_04, x , y+45, w, 60,12,font_meta10); } void display(){ //selected colored rectangle pickedColor = color(redbar.rv, greenbar.gv, bluebar.bv); noStroke(); fill(255,120); rect(x, y, w, 35); fill(pickedColor); rect(x+1, y+1, w-2, 33); // mesage int tav = redbar.rv + greenbar.gv + bluebar.bv; //println(tav); if(tav > 0 && tav < 380){ fill(255); } else{ fill(0); } String st = "You selected this colour."; textFont(font_meta11,11); float sl = (w-textWidth(st))/2; float sh = textAscent(); float ss = textDescent(); float th = (sh+ss); text(st,int(x+sl),int(y+2*th)); fill(255,160); tb_04.textBox(); redbar.display(x, y+75, 1); greenbar.display(x, y+100, 2); bluebar.display(x, y+125, 3); } } //-------------------------------------------------------------class colorpannel end /////// Scrollbar --> Colorpannel //////////////////////////////////////////////////// class Scrollbar{ float tx, y, h, w; float shx, shy, shh, shw,ratio,maxi; float incres; boolean over; boolean locked; color pointC ; color overC = color(255); color handlec = color(188,202,211); color normalc = color(188,202,211); color pressed = color(255); int rv; int gv; int bv; Scrollbar(float ww, float hh){ h = hh; w = ww; over = false; incres =0; locked = false; rv = 0; gv = 0; bv = 0; } void display(float x, float y, int nn){ update(); over(); noStroke(); pointC = color (rv,gv,bv); tx = x; shx = tx+incres; shy = y; shw = w/20; ratio=(w+110)/255; for(int i =0; i= shx && mouseX <= shx+shw && mouseY >= shy && mouseY <= shy+20){ return true; } else{ return false; } } }