diff --git a/src/activities/family/ActivityInfo.qml b/src/activities/family/ActivityInfo.qml index df4a4a33f..1847faa43 100644 --- a/src/activities/family/ActivityInfo.qml +++ b/src/activities/family/ActivityInfo.qml @@ -1,35 +1,37 @@ /* GCompris - ActivityInfo.qml * * Copyright (C) 2016 RAJDEEP KAUR * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ import GCompris 1.0 ActivityInfo { name: "family/Family.qml" difficulty: 1 icon: "family/family.svg" author: "Rajdeep Kaur <rajdeep.kaur@kde.org>" demo: true title: qsTr("Family") description: qsTr("This activity will give teach about who we are related to our relatives") //intro: "Let us understand what to call our relatives" goal: qsTr("To get an idea about relationships in the family") prerequisite: qsTr("Reading Skills") - manual: "" - credit: "" + manual: qsTr("To find the relation between two of your family members\n") + + qsTr("Here we take some assumptions the red colored lines refers the married couple and blue colored stright lines refers to parents and siblings\n") + + qsTr("Red circle will points to you and blue one your relative now you have to think what you should call him\n") + credit: "Johnny Jazeix" section: "fun" createdInVersion: 7000 } diff --git a/src/activities/family/Family.qml b/src/activities/family/Family.qml index 52edbce6b..46b26c2de 100644 --- a/src/activities/family/Family.qml +++ b/src/activities/family/Family.qml @@ -1,271 +1,295 @@ /* GCompris - family.qml * * Copyright (C) 2016 RAJDEEP KAUR * * Authors: * * RAJDEEP KAUR * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ import QtQuick 2.1 import GCompris 1.0 import "../../core" import "family.js" as Activity ActivityBase { id: activity onStart: focus = true onStop: {} pageComponent: Image { id: background anchors.fill: parent source: Activity.url + "back.svg" sourceSize.width: parent.width fillMode: Image.PreserveAspectCrop property bool horizontalLayout:background.width > background.height signal start signal stop Component.onCompleted: { activity.start.connect(start) activity.stop.connect(stop) } // Add here the QML items you need to access in javascript QtObject { id: items property Item main: activity.main property alias background: background property alias bar: bar property alias bonus: bonus property alias nodecreator:nodecreator property alias answerschoice: answerschoice property alias edgecreator: edgecreator } onStart: { Activity.start(items) } onStop: { Activity.stop() } Item { id: partition width: background.width height: background.height Rectangle { id: tree color: "transparent" width: background.horizontalLayout ? background.width*0.65 : background.width height: background.horizontalLayout ? background.height : background.height*0.65 border.color: "black" border.width: 5 Item { id: treestructure Repeater { id: nodecreator model: ListModel{} delegate: Tree { id: currentpointer x: xx*tree.width y: yy*tree.height width: tree.width/5 height: tree.width/5 recwidth: currentpointer.width recheight: currentpointer.height searchitem: 3 nodeimagesource: Activity.url+nodee bordercolor: "black" borderwidth: 4 colorr: "transparent" radius: recwidth/2 state:currentstate MouseArea { id: nodemousearea anchors.fill: parent } states: [ State { name: "active" PropertyChanges { target: currentpointer bordercolor: "blue" } }, State { name: "deactive" PropertyChanges { target: currentpointer } }, State { name: "activeto" PropertyChanges { target: currentpointer bordercolor: "red" } } ] SequentialAnimation { id: anim running: currentpointer.state === "active" || currentpointer.state === "activeto" loops: Animation.Infinite alwaysRunToEnd: true NumberAnimation { target: currentpointer property: "rotation" from: 0; to: 10 duration: 200 easing.type: Easing.OutQuad } NumberAnimation { target: currentpointer property: "rotation" from: 10; to: -10 duration: 400 easing.type: Easing.InOutQuad } NumberAnimation { target: currentpointer property: "rotation" from: -10; to: 0 duration: 200 easing.type: Easing.InQuad } } } } GCText { id: me text:qsTr("Me") visible: Activity.treestructure[bar.level-1].captions[0] !== undefined - x: Activity.treestructure[bar.level-1].captions[0] ? Activity.treestructure[bar.level-1].captions[0][0]*tree.width : 0 - y: Activity.treestructure[bar.level-1].captions[0] ? Activity.treestructure[bar.level-1].captions[0][1]*tree.height : 0 + x: Activity.treestructure[bar.level-1].captions[0][0]*tree.width + y: Activity.treestructure[bar.level-1].captions[0][1]*tree.height width: tree.width/12 height: tree.height/14 } Image { id: questionmark source: Activity.url + "questionmark.svg" visible: Activity.treestructure[bar.level-1].captions[1] !== undefined - x: Activity.treestructure[bar.level-1].captions[0] ? Activity.treestructure[bar.level-1].captions[1][0]*tree.width : 0 - y: Activity.treestructure[bar.level-1].captions[0] ? Activity.treestructure[bar.level-1].captions[1][1]*tree.height : 0 + x: Activity.treestructure[bar.level-1].captions[1][0]*tree.width + y: Activity.treestructure[bar.level-1].captions[1][1]*tree.height } Repeater { id: edgecreator model: ListModel{} delegate: Rectangle { id: edge opacity: 1 antialiasing: true - color: "black" - + state: edgestate transformOrigin: Item.TopLeft x: x1*tree.width y: y1*tree.height property var x2: x22*tree.width property var y2: y22*tree.height width: Math.sqrt(Math.pow(x - x2, 2) + Math.pow(y- y2, 2)) height: 4 * ApplicationInfo.ratio rotation: (Math.atan((y2 - y)/(x2-x)) * 180 / Math.PI) + (((y2-y) < 0 && (x2-x) < 0) * 180) + (((y2-y) >= 0 && (x2-x) < 0) * 180) Behavior on height { NumberAnimation { duration: 2000 easing.type: Easing.OutExpo } } Behavior on width { NumberAnimation { duration: 2000 easing.type: Easing.OutExpo } } + + states:[ + State { + name: "married" + PropertyChanges { + target: edge + color: "#F1C40F" + } + }, + State { + name: "siblings" + PropertyChanges { + target:edge + color:"#28B463" + } + }, + State { + name: "others" + PropertyChanges { + target: edge + color:"black" + } + } + ] } + } } } Rectangle { id: answers color: "transparent" width: background.horizontalLayout ? background.width*0.35 : background.width height: background.horizontalLayout ? background.height : background.height*0.35 anchors.left: background.horizontalLayout ? tree.right : partition.left anchors.top: background.horizontalLayout ? partition.top: tree.bottom border.color: "black" border.width: 5 Image { width: parent.width * 0.99 height: parent.height * 0.99 anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter source: Activity.url + "answerarea.svg" Grid { columns: 1 rowSpacing: 20 anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter Repeater { id: answerschoice model: ListModel{} delegate: AnswerButton { id: options width: answers.width*0.70 height: answers.height*Activity.answerbuttonheight textLabel: optionn isCorrectAnswer: textLabel === answer onCorrectlyPressed: bonus.good("lion") } } } } } } DialogHelp { id: dialogHelp onClose: home() } Bar { id: bar content: BarEnumContent { value: help | home | level } onHelpClicked: { displayDialog(dialogHelp) } onPreviousLevelClicked: Activity.previousLevel() onNextLevelClicked: Activity.nextLevel() onHomeClicked: activity.home() } Bonus { id: bonus Component.onCompleted: win.connect(Activity.nextLevel) } } } diff --git a/src/activities/family/family.js b/src/activities/family/family.js index ba02b3fe9..fe0ecc859 100644 --- a/src/activities/family/family.js +++ b/src/activities/family/family.js @@ -1,490 +1,507 @@ /* GCompris - family.js * * Copyright (C) 2016 RAJDEEP KAUR * * Authors: * "RAJDEEP KAUR" * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ .pragma library .import QtQuick 2.0 as Quick -//.import "engine.js" as Engine var currentLevel = 0 var items var url = "qrc:/gcompris/src/activities/family/resource/" var treestructure = [ { edgelist: [ [0.41, 0.25, 0.64, 0.25], [0.53, 0.25, 0.53, 0.50] ], nodePositions: [ [0.211, 0.20], [0.633, 0.20], [0.40, 0.50] ], rationn: [80, 80, 80], captions: [ [0.28, 0.60], [0.101, 0.25] ], nodeleave: ["man3.svg", "lady2.svg", "boy1.svg"], - currentstate: ["active", "deactive", "activeto"], + currentstate: ["activeto", "deactive", "active"], + edgestate:["married","others"], answer: [qsTr("Father")], optionss: [qsTr("Father"), qsTr("Grandfather"), qsTr("Uncle")] }, { edgelist: [ [0.41, 0.25, 0.64, 0.25], [0.53, 0.25, 0.53, 0.50] ], nodePositions: [ [0.211, 0.20], [0.633, 0.20], [0.4, 0.50] ], rationn: [80, 80, 80], captions: [ [0.28, 0.60], [0.8283, 0.24] ], nodeleave: ["man3.svg", "lady2.svg", "boy1.svg"], - currentstate: ["deactive", "active", "activeto"], + currentstate: ["deactive", "activeto", "active"], + edgestate:["married","others"], answer: [qsTr("Mother")], optionss: [qsTr("Mother"), qsTr("GrandMother"), qsTr("Aunty")] }, { edgelist: [ [0.41, 0.25, 0.64, 0.25], [0.53, 0.257, 0.44, 0.50], [0.53, 0.257, 0.63, 0.50] ], nodePositions: [ [0.211, 0.20], [0.633, 0.20], [0.33, 0.50], [0.55, 0.50] ], rationn: [80, 80, 80], captions:[ [0.22, 0.605], [0.760, 0.605] ], nodeleave: ["man3.svg", "lady2.svg", "boy1.svg", "boy2.svg"], currentstate: ["deactive", "deactive", "active", "activeto"], + edgestate:["married","others","others","others"], answer: [qsTr("Brother")], optionss: [qsTr("Cousin"), qsTr("Brother"), qsTr("Sister")] }, { edgelist: [ [0.41, 0.25, 0.64, 0.25], [0.53, 0.26, 0.33, 0.50], [0.53, 0.25, 0.53, 0.50], [0.53, 0.25, 0.70, 0.52] ], nodePositions: [ [0.211, 0.20], [0.633, 0.20], [0.22, 0.50], [0.43, 0.50], [0.65, 0.50] ], rationn: [80, 80, 80], captions: [ [0.281,0.77], [0.50,0.75] ], nodeleave: ["man3.svg", "lady2.svg", "boy1.svg", "girl1.svg", "boy2.svg"], currentstate: ["deactive", "deactive", "active", "activeto", "deactive"], + edgestate:["married","others","others","others"], answer: [qsTr("Sister")], optionss: [qsTr("Cousin"), qsTr("Brother"), qsTr("Sister")] }, { edgelist: [ [0.491, 0.17, 0.54, 0.17], [0.525, 0.17, 0.525, 0.45], [0.44, 0.45, 0.60, 0.45], [0.525, 0.45, 0.525, 0.65], [0.33, 0.65, 0.70, 0.65], [0.33, 0.65, 0.33, 0.70], [0.525, 0.65, 0.525, 0.70], [0.70, 0.65, 0.70, 0.725] ], nodePositions: [ [0.311, 0.10], [0.533, 0.10], [0.251, 0.40], [0.588, 0.40], [0.22, 0.70], [0.43, 0.70], [0.65, 0.70] ], rationn: [80, 80, 80], captions: [ [0.118,0.76], [0.22,0.17], ], nodeleave: ["grandfather.svg", "old-lady.svg", "man2.svg", "lady1.svg", "girl1.svg", "boy1.svg", "boy2.svg"], - currentstate: ["active", "deactive", "deactive", "deactive", "activeto", "deactive", "deactive"], + currentstate: ["activeto", "deactive", "deactive", "deactive", "active", "deactive", "deactive"], + edgestate:["married","others","married","others","others","others","others","others" ], answer: [qsTr("Grand Father")], optionss: [qsTr("Grand Daughter"), qsTr("Grand Son"), qsTr("Grand Father"), qsTr("Grand Mother")] }, { edgelist: [ [0.50, 0.17, 0.54, 0.17], [0.525, 0.17, 0.525, 0.45], [0.44, 0.45, 0.60, 0.45], [0.525, 0.45, 0.525, 0.65], [0.33, 0.65, 0.70, 0.65], [0.33, 0.65, 0.33, 0.70], [0.525, 0.65, 0.525, 0.70], [0.70, 0.65, 0.70, 0.725] ], nodePositions: [ [0.311, 0.10], [0.533, 0.10], [0.251, 0.40], [0.588, 0.40], [0.22, 0.70], [0.43, 0.70], [0.65, 0.70], ], rationn: [80, 80, 80], captions: [ [0.85,0.76], [0.743,0.16] ], nodeleave: ["grandfather.svg", "old-lady.svg", "man2.svg", "lady1.svg", "boy1.svg", "girl1.svg", "boy2.svg"], - currentstate: ["deactive", "active", "deactive", "deactive", "deactive", "deactive", "activeto", "active"], + currentstate: ["deactive", "activeto", "deactive", "deactive", "deactive", "deactive", "active", "active"], + edgestate:["married","others","married","others","others","others","others","others" ], answer: [qsTr("Grand Mother")], optionss: [qsTr("Grand Daughter"), qsTr("Grand Son"), qsTr("Grand Father"), qsTr("Grand Mother")], }, { edgelist: [ [0.50, 0.17, 0.54, 0.17], [0.525, 0.17, 0.525, 0.45], [0.44, 0.45, 0.60, 0.45], [0.525, 0.45, 0.525, 0.65], [0.33, 0.65, 0.70, 0.65], [0.33, 0.65, 0.33, 0.70], [0.525, 0.65, 0.525, 0.70], [0.70, 0.65, 0.70, 0.725] ], nodePositions: [ [0.311, 0.10], [0.533, 0.10], [0.251, 0.40], [0.588, 0.40], [0.22, 0.70], [0.43, 0.70], [0.65, 0.70] ], rationn: [80, 80, 80], captions: [ [0.22,0.17], [0.85,0.76] ], nodeleave: ["grandfather.svg", "old-lady.svg", "man2.svg", "lady1.svg", "boy1.svg", "boy2.svg","girl1.svg" ], - currentstate: ["activeto", "deactive", "deactive", "deactive", "deactive", "deactive", "active"], + currentstate: ["active", "deactive", "deactive", "deactive", "deactive", "deactive", "activeto"], + edgestate:["married","others","married","others","others","others","others","others" ], answer: [qsTr("Grand Daughter")], optionss: [qsTr("Grand Daughter"), qsTr("Grand Son"), qsTr("Grand Father"), qsTr("Grand Mother")] }, { edgelist: [ [0.50, 0.17, 0.54, 0.17], [0.525, 0.17, 0.525, 0.45], [0.44, 0.45, 0.60, 0.45], [0.525, 0.45, 0.525, 0.65], [0.33, 0.65, 0.70, 0.65], [0.33, 0.65, 0.33, 0.70], [0.525, 0.65, 0.525, 0.70], [0.70, 0.65, 0.70, 0.725] ], nodePositions: [ [0.311, 0.10], [0.533, 0.10], [0.251, 0.40], [0.588, 0.40], [0.22, 0.70], [0.43, 0.70], [0.65, 0.70] ], rationn: [80, 80, 80], captions: [ [0.743,0.16], [0.85,0.76] ], nodeleave: ["grandfather.svg", "old-lady.svg", "man2.svg", "lady1.svg", "boy1.svg", "girl1.svg", "boy2.svg"], currentstate: ["deactive", "activeto", "deactive", "deactive", "deactive", "deactive", "active", "activeto"], + edgestate:["married","others","married","others","others","others","others","others" ], answer: [qsTr("Grand Son")], optionss: [qsTr("Grand Daughter"), qsTr("Grand Son"), qsTr("Grand Father"), qsTr("Grand Mother")] }, { edgelist: [ [0.50, 0.17, 0.53, 0.17], [0.525, 0.17, 0.525, 0.45], [0.44, 0.45, 0.60, 0.45], [0.22, 0.45, 0.254, 0.45], [0.22, 0.45, 0.22, 0.72], [0.22, 0.71, 0.25, 0.71] ], nodePositions: [ [0.311, 0.10], [0.251, 0.40], [0.588, 0.40], [0.22, 0.70] ], rationn: [80, 80, 80], captions: [ [0.118,0.76], [0.83,0.45] ], nodeleave: ["grandfather.svg", "man3.svg", "man2.svg", "boy1.svg"], - currentstate: ["deactive", "deactive", "active", "activeto"], + currentstate: ["deactive", "deactive", "activeto", "active"], + edgestate:["others","others","siblings","others","others","others"], answer: [qsTr("Uncle")], optionss: [qsTr("Uncle"), qsTr("Aunty"), qsTr("Nephew"), qsTr("Niece")] }, { edgelist: [ [0.50, 0.17, 0.53, 0.17], [0.525, 0.17, 0.525, 0.45], [0.44, 0.45, 0.60, 0.45], [0.22, 0.45, 0.254, 0.45], [0.22, 0.45, 0.22, 0.72], [0.22, 0.71, 0.25, 0.71] ], nodePositions: [ [0.311, 0.10], [0.251, 0.40], [0.588, 0.40], [0.22, 0.70] ], rationn: [80, 80, 80], captions: [ [0.83,0.45], [0.118,0.76], ], nodeleave: ["grandfather.svg", "man3.svg", "man2.svg", "boy1.svg"], - currentstate: ["deactive", "deactive", "activeto", "active"], + currentstate: ["deactive", "deactive", "active", "activeto"], + edgestate:["others","others","siblings","others","others","others"], answer: [qsTr("Nephew")], optionss: [qsTr("Uncle"), qsTr("Aunty"), qsTr("Nephew"), qsTr("Niece")] }, { edgelist: [ [0.50, 0.17, 0.53, 0.17], [0.525, 0.17, 0.525, 0.45], [0.44, 0.45, 0.60, 0.45], [0.22, 0.45, 0.254, 0.45], [0.22, 0.45, 0.22, 0.72], [0.22, 0.71, 0.25, 0.71] ], nodePositions: [ [0.311, 0.10], [0.533, 0.10], [0.251, 0.40], [0.588, 0.40], [0.22, 0.70] ], rationn: [80, 80, 80], captions: [ [0.118,0.76], [0.83,0.45], ], nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady1.svg", "babyboy.svg"], - currentstate: ["deactive", "deactive", "deactive", "active", "activeto"], + currentstate: ["deactive", "deactive", "deactive", "activeto", "active"], + edgestate:["others","others","siblings","others","others","others"], answer: [qsTr("Aunty")], optionss: [qsTr("Uncle"), qsTr("Aunty"), qsTr("Nephew"), qsTr("Niece")] }, { edgelist: [ [0.50, 0.17, 0.53, 0.17], [0.525, 0.17, 0.525, 0.45], [0.44, 0.45, 0.60, 0.45], [0.22, 0.45, 0.254, 0.45], [0.22, 0.45, 0.22, 0.72], [0.22, 0.71, 0.25, 0.71] ], nodePositions: [ [0.311, 0.10], [0.533, 0.10], [0.251, 0.40], [0.588, 0.40], [0.22, 0.70] ], rationn: [80, 80, 80], captions: [ [0.83,0.45], [0.118,0.76] ], nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady1.svg", "babyboy.svg"], - currentstate: ["deactive", "deactive", "deactive", "activeto", "active"], + currentstate: ["deactive", "deactive", "deactive", "active", "activeto"], + edgestate:["married","others","siblings","others","others","others"], answer: [qsTr("Niece")], optionss: [qsTr("Uncle"), qsTr("Aunty"), qsTr("Nephew"), qsTr("Niece")] }, { edgelist: [ [0.65, 0.16, 0.745, 0.16], [0.70, 0.16, 0.70, 0.70], [0.70, 0.50, 0.58, 0.50], [0.40, 0.52, 0.34, 0.52], [0.69, 0.695, 0.75, 0.695] ], nodePositions: [ [0.463, 0.10], [0.733, 0.10], [0.400, 0.45], [0.150, 0.45], [0.733, 0.67] ], rationn: [80, 80, 80], captions: [ [0.02,0.51], [0.32,0.16] ], nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady2.svg", "man1.svg"], - currentstate: ["active", "deactive", "deactive", "activeto", "deactive"], + currentstate: ["activeto", "deactive", "deactive", "active", "deactive"], + edgestate:["married","others","others","married","others"], answer: [qsTr("Father-in-law")], optionss: [qsTr("Father-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] }, { edgelist: [ [0.65, 0.16, 0.745, 0.16], [0.70, 0.16, 0.70, 0.70], [0.70, 0.50, 0.58, 0.50], [0.40, 0.52, 0.34, 0.52], [0.69, 0.695, 0.75, 0.695] ], nodePositions: [ [0.463, 0.10], [0.733, 0.10], [0.400, 0.45], [0.150, 0.45], [0.733, 0.67] ], rationn: [80, 80, 80], captions: [ [0.02,0.51], [0.80,0.365], ], nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady2.svg", "man1.svg"], - currentstate: ["deactive", "active", "deactive", "activeto", "deactive"], + currentstate: ["deactive", "activeto", "deactive", "active", "deactive"], + edgestate:["married","others","others","married","others"], answer: [qsTr("Mother-in-law")], optionss: [qsTr("Father-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] }, { edgelist: [ [0.65, 0.16, 0.745, 0.16], [0.70, 0.16, 0.70, 0.70], [0.70, 0.50, 0.58, 0.50], [0.40, 0.52, 0.34, 0.52], [0.69, 0.695, 0.75, 0.695] ], nodePositions: [ [0.463, 0.10], [0.733, 0.10], [0.400, 0.45], [0.150, 0.45], [0.733, 0.67] ], rationn: [80, 80, 80], captions: [ [0.02,0.51], [0.78,0.5340] ], nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady2.svg", "man1.svg"], - currentstate: ["deactive", "deactive", "deactive", "activeto", "active"], + currentstate: ["deactive", "deactive", "deactive", "active", "activeto"], + edgestate:["married","others","others","married","others"], answer: [qsTr("Brother-in-law")], optionss: [qsTr("Father-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] }, { edgelist: [ [0.54, 0.16, 0.61, 0.16], [0.58, 0.16, 0.58, 0.70], [0.58, 0.50, 0.475, 0.50], [0.310, 0.52, 0.235, 0.52], [0.57, 0.695, 0.63, 0.695], [0.615, 0.75, 0.50, 0.75] ], nodePositions: [ [0.343, 0.10], [0.603, 0.10], [0.300, 0.45], [0.040, 0.45], [0.603, 0.67], [0.30, 0.70] ], rationn: [80, 80, 80], captions: [ [0.10,0.34], [0.20,0.76] ], nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady2.svg", "man1.svg", "lady1.svg"], currentstate: ["dective", "deactive", "deactive", "active", "deactive", "activeto"], + edgestate:["married","others","others","married","others","married"], answer: [qsTr("Sister-in-law")], optionss: [qsTr("Father-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] }, { edgelist: [ [0.65, 0.16, 0.745, 0.16], [0.70, 0.16, 0.70, 0.70], [0.70, 0.50, 0.58, 0.50], [0.40, 0.52, 0.34, 0.52], [0.69, 0.695, 0.75, 0.695] ], nodePositions: [ [0.463, 0.10], [0.733, 0.10], [0.400, 0.45], [0.150, 0.45], [0.733, 0.67] ], rationn: [80, 80, 80], captions: [ [0.32,0.15], [0.05,0.50] ], nodeleave: ["grandfather.svg", "old-lady.svg", "lady2.svg", "man3.svg", "man1.svg"], currentstate: ["active", "deactive", "deactive", "activeto", "deactive", "deactive"], + edgestate:["married","others","others","married","others"], answer: [qsTr("Son-in-law")], optionss: [qsTr("Son-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] } ] var numberOfLevel = treestructure.length; var answerbuttonheight = 0 ; function start(items_) { items = items_ currentLevel = 0 initLevel() } function stop() { } function initLevel() { items.bar.level = currentLevel + 1 var levelTree = treestructure[currentLevel] answerbuttonheight = 1/(levelTree.optionss.length+4); items.nodecreator.model.clear(); items.answerschoice.model.clear(); items.edgecreator.model.clear(); for(var i = 0 ; i < levelTree.nodePositions.length ; i++) { items.nodecreator.model.append({ "xx": levelTree.nodePositions[i][0], "yy": levelTree.nodePositions[i][1], "nodee": levelTree.nodeleave[i], "rationn": levelTree.rationn[i], "currentstate": levelTree.currentstate[i] }); } for(var j = 0 ; j