diff --git a/src/activities/digital_electricity/DigitalElectricity.qml b/src/activities/digital_electricity/DigitalElectricity.qml index fb15a76e4..9b66f763b 100644 --- a/src/activities/digital_electricity/DigitalElectricity.qml +++ b/src/activities/digital_electricity/DigitalElectricity.qml @@ -1,346 +1,347 @@ /* GCompris - DigitalElectricity.qml * * Copyright (C) 2016 Pulkit Gupta * * Authors: * Bruno Coudoin (GTK+ version) * Pulkit Gupta (Qt Quick port) * * 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 QtQuick.Controls 1.4 import GCompris 1.0 import "../../core" import "digital_electricity.js" as Activity ActivityBase { id: activity onStart: focus = true onStop: {} pageComponent: Rectangle { id: background anchors.fill: parent color: "#ffffb3" signal start signal stop property bool vert: background.width > background.height 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 backgroundContainer: backgroundContainer property alias bar: bar property alias bonus: bonus property alias availablePieces: availablePieces property alias toolTip: toolTip property alias infoTxt: infoTxt property alias truthTablesModel: truthTablesModel property alias displayTruthTable: inputOutputTxt.displayTruthTable property alias dataset: dataset - //property alias infoImage: infoImage + property alias infoImage: infoImage } Loader { id: dataset asynchronous: false } onStart: { Activity.start(items) } onStop: { Activity.stop() } Rectangle { id: backgroundContainer color: "#ffffb3" x: background.vert ? 90 * ApplicationInfo.ratio : 0 y: background.vert ? 0 : 90 * ApplicationInfo.ratio width: background.vert ? background.width - 90 * ApplicationInfo.ratio : background.width height: background.vert ? background.height - (bar.height * 1.1) : background.height - (bar.height * 1.1) - 90 * ApplicationInfo.ratio MouseArea { anchors.fill: parent onClicked: Activity.deselect() } GCText { id: infoTxt anchors { horizontalCenter: parent.horizontalCenter top: infoTxtContainer.top topMargin: 2 } fontSizeMode: Text.Fit minimumPixelSize: 10 color: "white" style: Text.Outline styleColor: "black" horizontalAlignment: Text.AlignHLeft width: Math.min(implicitWidth, 0.90 * parent.width) height: inputOutputTxt.visible == false ? Math.min(implicitHeight, 0.9 * parent.height) : - Math.min(implicitHeight, 0.4 * parent.height) + Math.min(implicitHeight, (inputOutputTxt.inputs > 2 ? 0.3 : 0.4) * parent.height) wrapMode: TextEdit.WordWrap visible: false z: 4 } Rectangle { id: infoTxtContainer anchors.centerIn: parent width: infoTxt.width + 20 - height: inputOutputTxt.visible == false ? infoTxt.height : + height: inputOutputTxt.visible == false ? infoTxt.height + infoImage.height + 6 : infoTxt.height + inputOutputTxt.height + truthTable.height + 8 opacity: 0.8 radius: 10 border.width: 2 border.color: "black" visible: infoTxt.visible gradient: Gradient { GradientStop { position: 0.0; color: "#000" } GradientStop { position: 0.9; color: "#666" } GradientStop { position: 1.0; color: "#AAA" } } MouseArea { anchors.fill: parent onClicked: infoTxt.visible = false } z: 3 } - /*Image { + Image { id: infoImage property int heightNeed: parent.height - infoTxt.height + property bool imgVisible: false height: source == "" ? 0 : parent.height - infoTxt.height - 10 width: source == "" ? 0 : parent.width - 10 fillMode: Image.PreserveAspectFit - visible: infoTxt.visible + visible: infoTxt.visible && imgVisible anchors { top: infoTxt.bottom horizontalCenter: parent.horizontalCenter } z: 5 - }*/ + } ListModel { id: truthTablesModel property int rows property int columns property int inputs property int outputs } Row { id: inputOutputTxt z: 5 property bool displayTruthTable visible: infoTxt.visible && displayTruthTable - property int cellSize: Math.min(parent.height - infoTxt.height - 10, 0.45 * parent.height) / - truthTablesModel.rows property int inputs: truthTablesModel.inputs property int outputs: truthTablesModel.outputs + property int cellSize: Math.min(parent.height - infoTxt.height - 10, (inputs > 2 ? 0.6 : + 0.45) * parent.height) / truthTablesModel.rows property int minSize: 2 * cellSize //width: truthTable.width height: cellSize anchors { top: infoTxt.bottom horizontalCenter: parent.horizontalCenter } Rectangle { color: "#c7ecfb" width: Math.max(inputOutputTxt.minSize, inputOutputTxt.cellSize * inputOutputTxt.inputs) height: inputOutputTxt.cellSize border.color: "black" border.width: 1 GCText { anchors.centerIn: parent fontSizeMode: Text.Fit minimumPixelSize: 10 color: "white" style: Text.Outline styleColor: "black" horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter height: parent.height width: parent.width text: qsTr("Input") } } Rectangle { color: "#c7ecfb" width: Math.max(inputOutputTxt.minSize, inputOutputTxt.cellSize * inputOutputTxt.outputs) height: inputOutputTxt.cellSize border.color: "black" border.width: 1 GCText { anchors.centerIn: parent fontSizeMode: Text.Fit minimumPixelSize: 10 color: "white" style: Text.Outline styleColor: "black" horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter height: parent.height width: parent.width text: qsTr("Output") } } } Grid { id: truthTable rows: truthTablesModel.rows columns: truthTablesModel.columns //width: columns * inputOutputTxt.cellSize height: rows * inputOutputTxt.cellSize z: 5 visible: inputOutputTxt.visible anchors { top: inputOutputTxt.bottom horizontalCenter: parent.horizontalCenter } //spacing: 1 Repeater { id: repeater model: truthTablesModel //15//pieces delegate: blueSquare Component { id: blueSquare Rectangle { width: ((index % truthTable.columns) / (truthTablesModel.inputs - 1)) <= 1 ? (inputOutputTxt.inputs > 1 ? inputOutputTxt.cellSize : inputOutputTxt.minSize) : (inputOutputTxt.outputs > 1 ? inputOutputTxt.cellSize : inputOutputTxt.minSize) height: inputOutputTxt.cellSize border.color: "black" border.width: 1 //radius: 1 color: "#c7ecfb" GCText { id: truthTableValue anchors.centerIn: parent fontSizeMode: Text.Fit minimumPixelSize: 10 color: "white" style: Text.Outline styleColor: "black" horizontalAlignment: Text.AlignHCenter height: parent.height width: parent.width text: value } } } } } } Rectangle { id: leftWidget width: background.vert ? 90 * ApplicationInfo.ratio : background.width height: background.vert ? background.height : 90 * ApplicationInfo.ratio color: "#FFFF42" border.color: "#FFD85F" border.width: 4 anchors.left: parent.left ListWidget { id: availablePieces vert: background.vert ? true : false } } Rectangle { id: toolTip anchors { bottom: bar.top bottomMargin: 10 left: leftWidget.left leftMargin: 5 } width: toolTipTxt.width + 10 height: toolTipTxt.height + 5 opacity: 1 radius: 10 z: 100 border.width: 2 border.color: "black" gradient: Gradient { GradientStop { position: 0.0; color: "#000" } GradientStop { position: 0.9; color: "#666" } GradientStop { position: 1.0; color: "#AAA" } } property alias text: toolTipTxt.text Behavior on opacity { NumberAnimation { duration: 120 } } function show(newText) { if(newText) { text = newText opacity = 0.8 } else { opacity = 0 } } GCText { id: toolTipTxt anchors.centerIn: parent fontSize: regularSize color: "white" style: Text.Outline styleColor: "black" horizontalAlignment: Text.AlignHCenter wrapMode: TextEdit.WordWrap } } DialogHelp { id: dialogHelp onClose: home() } Bar { id: bar content: BarEnumContent { value: help | home | reload} onHelpClicked: { displayDialog(dialogHelp) } onPreviousLevelClicked: Activity.previousLevel() onNextLevelClicked: Activity.nextLevel() onHomeClicked: activity.home() onReloadClicked: Activity.reset() } Bonus { id: bonus Component.onCompleted: win.connect(Activity.nextLevel) } } } diff --git a/src/activities/digital_electricity/Component.qml b/src/activities/digital_electricity/ElectricalComponent.qml similarity index 86% rename from src/activities/digital_electricity/Component.qml rename to src/activities/digital_electricity/ElectricalComponent.qml index f89a6441c..d9845416d 100644 --- a/src/activities/digital_electricity/Component.qml +++ b/src/activities/digital_electricity/ElectricalComponent.qml @@ -1,138 +1,149 @@ /* GCompris - Component.qml * * Copyright (C) 2016 Pulkit Gupta * * Authors: * Bruno Coudoin (GTK+ version) * Pulkit Gupta (Qt Quick port) * * 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.3 import "digital_electricity.js" as Activity import GCompris 1.0 Image { id: electricalComponent property QtObject pieceParent property string imgSrc property double posX property double posY property double imgWidth property double imgHeight property int index property string toolTipTxt property int rotationAngle: 0 property int initialAngle: 0 property int startingAngle: 0 property int output property double terminalSize property variant inputs: [] property variant outputs: [] property alias rotateComponent: rotateComponent x: posX * parent.width y: posY * parent.height width: imgWidth * parent.width height: imgHeight * parent.height fillMode: Image.PreserveAspectFit opacity: 1.0 source: Activity.url + imgSrc z: 2 mipmap: true antialiasing: true onPaintedWidthChanged: { updateDragConstraints() Activity.updateWires(index) } PropertyAnimation { id: rotateComponent target: electricalComponent property: "rotation" from: initialAngle; to: initialAngle + rotationAngle duration: 1 onStarted:{Activity.animationInProgress = true} onStopped: { initialAngle = initialAngle + rotationAngle //console.log("initialAngle",initialAngle) Activity.updateWires(index) if(initialAngle == startingAngle + rotationAngle * 45) { if(initialAngle == 360 || initialAngle == -360) initialAngle = 0 startingAngle = initialAngle Activity.animationInProgress = false updateDragConstraints() } else rotateComponent.start() } easing.type: Easing.InOutQuad } function updateDragConstraints() { - if(rotationAngle == 0 || rotationAngle == 180 || rotationAngle == 360 || rotationAngle == -360 - || rotationAngle == -180) { + //console.log("initialAngle",initialAngle) + if(initialAngle == 0 || initialAngle == 180 || initialAngle == 360 || initialAngle == -360 + || initialAngle == -180) { mouseArea.drag.minimumX = (electricalComponent.paintedWidth - electricalComponent.width)/2 mouseArea.drag.minimumY = (electricalComponent.paintedHeight - electricalComponent.height)/2 mouseArea.drag.maximumX = electricalComponent.parent.width - (electricalComponent.width + electricalComponent.paintedWidth)/2 mouseArea.drag.maximumY = electricalComponent.parent.height - (electricalComponent.height + electricalComponent.paintedHeight)/2 } else { mouseArea.drag.minimumX = (electricalComponent.paintedHeight - electricalComponent.width)/2 mouseArea.drag.minimumY = (electricalComponent.paintedWidth - electricalComponent.height)/2 mouseArea.drag.maximumX = electricalComponent.parent.width - (electricalComponent.width + electricalComponent.paintedHeight)/2 mouseArea.drag.maximumY = electricalComponent.parent.height - (electricalComponent.height + electricalComponent.paintedWidth)/2 } //console.log("mouseArea",mouseArea.drag.minimumX,mouseArea.drag.minimumY) } MouseArea { id: mouseArea //anchors.fill: parent width: parent.paintedWidth height: parent.paintedHeight anchors.centerIn: parent drag.target: electricalComponent onPressed: { - console.log("Component index",index) + //console.log("Component index",index) + Activity.updateToolTip(toolTipTxt) + Activity.componentSelected(index) + } + onClicked: { + //console.log("Component index",index) if(Activity.toolDelete) { - Activity.updateToolTip("") Activity.removeComponent(index) } else { - Activity.updateToolTip(toolTipTxt) - Activity.componentSelected(index) + if(imgSrc == "switchOff.svg") { + imgSrc = "switchOn.svg" + Activity.updateComponent(index) + } + else if(imgSrc == "switchOn.svg") { + imgSrc = "switchOff.svg" + Activity.updateComponent(index) + } } } - onPositionChanged: { + /*onPositionChanged: { Activity.updateWires(index) - } + }*/ onReleased: { parent.posX = parent.x / parent.parent.width parent.posY = parent.y / parent.parent.height parent.x = Qt.binding(function() { return parent.posX * parent.parent.width }) parent.y = Qt.binding(function() { return parent.posY * parent.parent.height }) Activity.updateToolTip("") } } } diff --git a/src/activities/digital_electricity/SevenSegment.qml b/src/activities/digital_electricity/SevenSegment.qml new file mode 100644 index 000000000..6fd40b63e --- /dev/null +++ b/src/activities/digital_electricity/SevenSegment.qml @@ -0,0 +1,95 @@ +/* GCompris - SevenSegment.qml + * + * Copyright (C) 2016 Pulkit Gupta + * + * Authors: + * Bruno Coudoin (GTK+ version) + * Pulkit Gupta (Qt Quick port) + * + * 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.3 +import "digital_electricity.js" as Activity + +import GCompris 1.0 + +Item { + id: sevenSegment + property variant code + height: parent.height + width: parent.width + + Image { + source: Activity.url + "sevenSegmentDisplayA.svg" + visible: code[0] == 1 + anchors.centerIn: parent + height: parent.height + width: parent.width + fillMode: Image.PreserveAspectFit + } + + Image { + source: Activity.url + "sevenSegmentDisplayB.svg" + visible: code[1] == 1 + anchors.centerIn: parent + height: parent.height + width: parent.width + fillMode: Image.PreserveAspectFit + } + + Image { + source: Activity.url + "sevenSegmentDisplayC.svg" + visible: code[2] == 1 + anchors.centerIn: parent + height: parent.height + width: parent.width + fillMode: Image.PreserveAspectFit + } + + Image { + source: Activity.url + "sevenSegmentDisplayD.svg" + visible: code[3] == 1 + anchors.centerIn: parent + height: parent.height + width: parent.width + fillMode: Image.PreserveAspectFit + } + + Image { + source: Activity.url + "sevenSegmentDisplayE.svg" + visible: code[4] == 1 + anchors.centerIn: parent + height: parent.height + width: parent.width + fillMode: Image.PreserveAspectFit + } + + Image { + source: Activity.url + "sevenSegmentDisplayF.svg" + visible: code[5] == 1 + anchors.centerIn: parent + height: parent.height + width: parent.width + fillMode: Image.PreserveAspectFit + } + + Image { + source: Activity.url + "sevenSegmentDisplayG.svg" + visible: code[6] == 1 + anchors.centerIn: parent + height: parent.height + width: parent.width + fillMode: Image.PreserveAspectFit + } +} diff --git a/src/activities/digital_electricity/TerminalPoint.qml b/src/activities/digital_electricity/TerminalPoint.qml index 92c34a389..5d8cf1f3d 100644 --- a/src/activities/digital_electricity/TerminalPoint.qml +++ b/src/activities/digital_electricity/TerminalPoint.qml @@ -1,87 +1,87 @@ /* GCompris - TerminalPoint.qml * * Copyright (C) 2016 Pulkit Gupta * * Authors: * Bruno Coudoin (GTK+ version) * Pulkit Gupta (Qt Quick port) * * 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.0 import "digital_electricity.js" as Activity import GCompris 1.0 Rectangle { id: terminalPoint property double posX property double posY property double size: parent.terminalSize property bool selected: false property string type property int value: -1 property int index property int componentIndex property variant wireIndex: [] width: size * parent.paintedHeight height: size * parent.paintedHeight radius: width / 2 color: "Black" x: (parent.width - parent.paintedWidth) / 2 + posX * parent.paintedWidth - width / 2 y: (parent.height - parent.paintedHeight) / 2 + posY * parent.paintedHeight - height / 2 //property variant coord: parent.parent.mapFromItem(terminalPoint, terminalPoint.x + width / 2, terminalPoint.y + height / 2) property double xCenter: terminalPoint.parent.x + terminalPoint.x + width/2 property double yCenter: terminalPoint.parent.y + terminalPoint.y + height/2 //property double xCenterFromComponent: terminalPoint.parent.x + terminalPoint.parent.width / 2 - xCenter //property double yCenterFromComponent: terminalPoint.parent.y + terminalPoint.parent.height / 2 - yCenter property double xCenterFromComponent: terminalPoint.x + width/2 - terminalPoint.parent.width / 2 property double yCenterFromComponent: terminalPoint.y + height/2 - terminalPoint.parent.height / 2 Rectangle { id: boundary anchors.centerIn: terminalPoint width: terminalPoint.width * 1.4 height: width visible: selected radius: width / 2 color: "green" z: -1 } MouseArea { id: mouseArea anchors.fill: parent onPressed: { selected = true - console.log("Pressed Terminal",index,type,value) + //console.log("Pressed Terminal",index,type,value) Activity.terminalPointSelected(index) //parent.parent.parent.moveFromX = parent.parent.x + mouseX //parent.parent.parent.moveFromY = parent.parent.y + mouseY } /* onPositionChanged: { parent.parent.parent.moveToX = parent.parent.x + mouseX parent.parent.parent.moveToY = parent.parent.y + mouseY //console.log(parent.parent.parent.moveToX,parent.parent.parent.moveToY) //console.log(parent.parent.x + mouseX,parent.parent.y + mouseY) parent.parent.parent.requestPaint() }*/ } } diff --git a/src/activities/digital_electricity/Wire.qml b/src/activities/digital_electricity/Wire.qml index 7d171bb00..57cd319a0 100644 --- a/src/activities/digital_electricity/Wire.qml +++ b/src/activities/digital_electricity/Wire.qml @@ -1,66 +1,66 @@ /* GCompris - Wire.qml * * Copyright (C) 2016 Pulkit Gupta * * Authors: * Bruno Coudoin (GTK+ version) * Pulkit Gupta (Qt Quick port) * * 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.0 import "digital_electricity.js" as Activity import GCompris 1.0 Rectangle { id: wire //property double posX1 //property double posY1 //property double posX2 //property double posY2 //property double rectWidth //property double rotateAngle property string wireColor property int index property int from property int to //width: rectWidth height: 5 color: wireColor //"Red" radius: height / 2 //x: posX1 //y: posY1 transformOrigin: Item.Left //rotation: rotateAngle MouseArea { id: mouseArea //anchors.fill: parent width: parent.width height: parent.height * 3 anchors.centerIn: parent onPressed: { - console.log("Pressed Wire",index,color,wireColor) + //console.log("Pressed Wire",index,color,wireColor) if(Activity.toolDelete) { Activity.removeWire(index) } } } } diff --git a/src/activities/digital_electricity/digital_electricity.js b/src/activities/digital_electricity/digital_electricity.js index e8ffeda3c..d43d771fe 100644 --- a/src/activities/digital_electricity/digital_electricity.js +++ b/src/activities/digital_electricity/digital_electricity.js @@ -1,745 +1,815 @@ /* GCompris - digital_electricity.js * * Copyright (C) 2016 Pulkit Gupta * * Authors: * Bruno Coudoin (GTK+ version) * Pulkit Gupta (Qt Quick port) * * 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 var currentLevel = 0 var numberOfLevel = 4 var items var url = "qrc:/gcompris/src/activities/digital_electricity/resource/" //var componentIndex = 0 var toolDelete var selectedIndex var animationInProgress var selectedTerminal var mapSrc = {} var terminals = [] var deletedIndex = [] var components = [] var componentsInfo = [] var wires = [] var connected = [] var deletedWireIndex = [] var colors = ["red","green","blue","blueviolet","silver"] +var sevenSegmentDisplay = [] function start(items_) { items = items_ currentLevel = 0 - var filename = url + "Components.qml" + var filename = url + "ElectricalComponents.qml" items.dataset.source = filename var componentsData = items.dataset.item var componentsDataLength = componentsData.components.length for(var i = 0 ; i < componentsDataLength ; ++i) { var component = componentsData.components[i] items.availablePieces.model.append( { "imgName": component.imgName, "imgWidth": component.imgWidth, "imgHeight": component.imgHeight, "toolTipText": component.toolTipText, "terminalSize": component.terminalSize, }); mapSrc[component.imgName] = i if(component.imgName == "ledOff.svg") mapSrc["ledOn.svg"] = i else if(component.imgName == "switchOff.svg") mapSrc["switchOn.svg"] = i componentsInfo[i] = [] componentsInfo[i][0] = component.imgWidth componentsInfo[i][1] = component.imgHeight componentsInfo[i][2] = component.toolTipText componentsInfo[i][3] = component.terminalSize componentsInfo[i][4] = [] var inputs = component.inputTerminals for(var j = 0 ; j < inputs.length ; ++j) { componentsInfo[i][4][j] = [] var input = inputs[j] componentsInfo[i][4][j][0] = input.posX componentsInfo[i][4][j][1] = input.posY componentsInfo[i][4][j][2] = input.value == undefined ? -1 : input.value } componentsInfo[i][5] = [] var outputs = component.outputTerminals //console.log("outputs.length",outputs.length) for(var j = 0 ; j < outputs.length ; ++j) { componentsInfo[i][5][j] = [] var output = outputs[j] componentsInfo[i][5][j][0] = output.posX componentsInfo[i][5][j][1] = output.posY componentsInfo[i][5][j][2] = output.value == undefined ? -1 : output.value } componentsInfo[i][6] = component.information componentsInfo[i][7] = component.truthTable } /*items.availablePieces.model.append( { "imgName": "zero.svg", "imgWidth": 0.12, "imgHeight": 0.2, "toolTipText": qsTr("Zero input"), "terminalSize": 0.205 }); items.availablePieces.model.append( { "imgName": "one.svg", "imgWidth": 0.12, "imgHeight": 0.2, "toolTipText": qsTr("One input"), "terminalSize": 0.218 }); /*items.availablePieces.model.append( { "imgName": "battery.svg", "imgWidth": 0.13, "imgHeight": 0.18, "toolTipText": qsTr("Battery") }); items.availablePieces.model.append( { "imgName": "comparator.svg", "imgWidth": 0.3, "imgHeight": 0.25, "toolTipText": qsTr("Comparator") }); items.availablePieces.model.append( { "imgName": "ledOff.svg", "imgWidth": 0.16, "imgHeight": 0.2, "toolTipText": qsTr("LED"), "terminalSize": 0.111 }); /*items.availablePieces.model.append( { "imgName": "switchOff.svg", "imgWidth": 0.18, "imgHeight": 0.15, "toolTipText": qsTr("Switch") }); items.availablePieces.model.append( { "imgName": "BCDTo7Segment.svg", "imgWidth": 0.3, "imgHeight": 0.4, "toolTipText": qsTr("BCD To 7 Segment") }); items.availablePieces.model.append( { "imgName": "sevenSegmentDisplay.svg", "imgWidth": 0.18, "imgHeight": 0.4, "toolTipText": qsTr("7 Segment Display"), "terminalSize": 0.097 }); items.availablePieces.model.append( { "imgName": "gateAnd.svg", "imgWidth": 0.15, "imgHeight": 0.12, "toolTipText": qsTr("AND gate"), "terminalSize": 0.246 }); /*items.availablePieces.model.append( { "imgName": "gateNand.svg", "imgWidth": 0.15, "imgHeight": 0.12, "toolTipText": qsTr("NAND gate") }); items.availablePieces.model.append( { "imgName": "gateNor.svg", "imgWidth": 0.15, "imgHeight": 0.12, "toolTipText": qsTr("NOR gate") }); items.availablePieces.model.append( { "imgName": "gateNot.svg", "imgWidth": 0.15, "imgHeight": 0.12, "toolTipText": qsTr("Not gate") }); items.availablePieces.model.append( { "imgName": "gateOr.svg", "imgWidth": 0.15, "imgHeight": 0.12, "toolTipText": qsTr("Or gate") }); items.availablePieces.model.append( { "imgName": "gateXor.svg", "imgWidth": 0.15, "imgHeight": 0.12, "toolTipText": qsTr("Xor gate") }); //*/ //items.availablePieces.view.refreshLeftWidget() initLevel() } function stop() { for(var i = 0 ; i < components.length ; ++i) { var j for(j = 0 ; j < deletedIndex.length ; ++j) { if(deletedIndex[j] == i) break } - if(j == deletedIndex.length) + if(j == deletedIndex.length) { + if(components[i].imgSrc == "sevenSegmentDisplay.svg") + sevenSegmentDisplay[i].destroy() components[i].destroy() + } } /*for(var i = 0 ; i < terminals.length ; ++i) { terminals[i].destroy(); }*/ for(var i = 0 ; i < wires.length ; ++i) { var j for(j = 0 ; j < deletedWireIndex.length ; ++j) { if(deletedWireIndex[j] == i) break } if(j == deletedWireIndex.length) wires[i].destroy() } } function initLevel() { items.availablePieces.view.currentDisplayedGroup = 0 items.availablePieces.view.previousNavigation = 1 items.availablePieces.view.nextNavigation = 1 terminals = [] deletedIndex = [] components = [] wires = [] connected = [] deletedWireIndex = [] + sevenSegmentDisplay = [] animationInProgress = false deselect() toolDelete = false updateToolTip("") } function reset() { deselect() stop() initLevel() } function createComponent(x, y, src, imgWidth, imgHeight, toolTipTxt, terminalSize) { - var electricComponent = Qt.createComponent("qrc:/gcompris/src/activities/digital_electricity/Component.qml") + var electricComponent = Qt.createComponent("qrc:/gcompris/src/activities/digital_electricity/ElectricalComponent.qml") if (electricComponent.status == electricComponent.Error) { // Error Handling console.log("Error loading component:", electricComponent.errorString()); } //console.log("Inside createComponent") x = x / items.backgroundContainer.width y = y / items.backgroundContainer.height //console.log("x",x,"y",y) var index if(deletedIndex.length > 0) { index = deletedIndex[deletedIndex.length - 1] deletedIndex.pop() } else index = components.length var componentInfo = componentsInfo[mapSrc[src]] components[index] = electricComponent.createObject( items.backgroundContainer, { "index": index, "posX": x, "posY": y, "imgSrc": src, "imgWidth": componentInfo[0], "imgHeight": componentInfo[1], "toolTipTxt": componentInfo[2], "terminalSize": componentInfo[3] }); var electricComponentCreated = components[index] var terminalComponent = Qt.createComponent("qrc:/gcompris/src/activities/digital_electricity/TerminalPoint.qml") //console.log("Error loading component:", terminalComponent.errorString()) var terminalIndex = terminals.length //console.log("terminalIndex",terminalIndex) + if(src == "sevenSegmentDisplay.svg") { + var sevenSegmentComponent = Qt.createComponent("qrc:/gcompris/src/activities/digital_electricity/SevenSegment.qml") + sevenSegmentDisplay[index] = sevenSegmentComponent.createObject( + electricComponentCreated, { + "code": [0,0,0,0,0,0] + }); + sevenSegmentDisplay[index].anchors.centerIn = electricComponentCreated + } + var inputs = componentInfo[4] for(var i = 0 ; i < inputs.length ; ++i) { var input = inputs[i] electricComponentCreated.inputs.push(terminalIndex) terminals[terminalIndex++] = terminalComponent.createObject( electricComponentCreated, { "posX": input[0], "posY": input[1], "index": terminalIndex - 1, "type": "In", "componentIndex": index, "value": input[2] }); //console.log("posX",input[0]) } var outputs = componentInfo[5] //console.log("outputs.length",outputs.length) for(var i = 0 ; i < outputs.length ; ++i) { var output = outputs[i] electricComponentCreated.outputs.push(terminalIndex) terminals[terminalIndex++] = terminalComponent.createObject( electricComponentCreated, { "posX": output[0], "posY": output[1], "index": terminalIndex - 1, "type": "Out", "componentIndex": index, "value": output[2] }); } componentSelected(index) } function terminalPointSelected(index) { if(selectedTerminal == -1 || selectedTerminal == index) selectedTerminal = index else if((terminals[index].type != terminals[selectedTerminal].type) && terminals[index].componentIndex != terminals[selectedTerminal].componentIndex) { var inIndex = terminals[index].type == "In" ? index : selectedTerminal var outIndex = terminals[index].type == "Out" ? index : selectedTerminal //console.log("in, connected[inIndex]",connected[inIndex],"inIndex",inIndex) if(connected[inIndex] == undefined || connected[inIndex] == -1) { //console.log("in2") var wireComponent = Qt.createComponent("qrc:/gcompris/src/activities/digital_electricity/Wire.qml") var index if(deletedWireIndex.length > 0) { index = deletedWireIndex[deletedWireIndex.length - 1] deletedWireIndex.pop() } else index = wires.length var colorIndex = Math.floor(Math.random() * colors.length) //console.log("colorIndex",colorIndex) wires[index] = wireComponent.createObject( items.backgroundContainer, { "from": outIndex, "to": inIndex, "wireColor": colors[colorIndex], "index": index }); terminals[inIndex].value = terminals[outIndex].value terminals[inIndex].wireIndex.push(index) terminals[outIndex].wireIndex.push(index) updateWires(terminals[inIndex].componentIndex) updateWires(terminals[outIndex].componentIndex) updateComponent(terminals[inIndex].componentIndex) connected[inIndex] = outIndex } deselect() } else { //console.log("else") deselect() selectedTerminal = index terminals[index].selected = true } } function updateComponent(index) { var visited = [] updateComponentUtility(index, visited) } function updateComponentUtility(index, visited) { //console.log("index",index,"components[index].imgSrc",components[index].imgSrc) if(visited[index] != undefined) // To prevent infinite loop because of bad connection return visited[index] = true var component = components[index] - if(component.imgSrc == "gateAnd.svg") { - var output = 1 - for(var i = 0 ; i < 2 ; ++i) { - var value = terminals[component.inputs[i]].value - if(value == -1) { - output = -1 - break - } - output = output && value - } - //console.log("output",output) - terminals[component.outputs[0]].value = output - } - else if(component.imgSrc == "ledOff.svg") { + if(component.imgSrc == "ledOff.svg") { if(terminals[component.inputs[0]].value == 1 && terminals[component.inputs[1]].value == 0) component.source = url + "ledOn.svg" else component.source = url + "ledOff.svg" //console.log("component.source",component.source) return } - //console.log("component index",index) + else if(component.imgSrc == "sevenSegmentDisplay.svg") { + var code = [] + for(var i = 0 ; i < 7 ; ++i) { + var value = terminals[component.inputs[i]].value + if(value == -1) { + for(var j = 0 ; j < 7 ; ++j) code[j] = 0 + } + code[i] = value + } + sevenSegmentDisplay[index].code = code + return + } + else if(component.imgSrc == "switchOff.svg") { + terminals[component.outputs[0]].value = -1 + } + else if(component.imgSrc == "switchOn.svg") { + terminals[component.outputs[0]].value = terminals[component.inputs[0]].value + } + else if(component.imgSrc == "comparator.svg") { + var firstInput = terminals[component.inputs[0]].value + var secondInput = terminals[component.inputs[1]].value + if(firstInput != -1 && secondInput != -1) { + terminals[component.outputs[0]].value = firstInput < secondInput ? 1 : 0 + terminals[component.outputs[1]].value = firstInput == secondInput ? 1 : 0 + terminals[component.outputs[2]].value = firstInput > secondInput ? 1 : 0 + } + else { + terminals[component.outputs[0]].value = -1 + terminals[component.outputs[1]].value = -1 + terminals[component.outputs[2]].value = -1 + } + } + else { + var inputSet = false + var compnentInfo = componentsInfo[mapSrc[component.imgSrc]] + var truthTable = compnentInfo[7] + var i + var input = component.inputs + for(i = 1 ; i < truthTable.length ; ++i) { + var j + for(j = 0 ; j < input.length; ++j) { + if(terminals[input[j]].value != truthTable[i][j]) + break + } + if(j == input.length) + break + } + var output = component.outputs + if(i == truthTable.length) { + for(var j = 0 ; j < output.length ; ++j) + terminals[output[j]].value = -1 + } + else { + for(var j = 0 ; j < output.length ; ++j) + terminals[output[j]].value = truthTable[i][j + input.length] + } + } for(var i = 0 ; i < component.outputs.length ; ++i) { var terminal = terminals[component.outputs[i]] for(var j = 0 ; j < terminal.wireIndex.length ; ++j) { terminals[wires[terminal.wireIndex[j]].to].value = terminal.value } } for(var i = 0 ; i < component.outputs.length ; ++i) { var terminal = terminals[component.outputs[i]] //console.log("terminal index",terminal.index) for(var j = 0 ; j < terminal.wireIndex.length ; ++j) { //console.log("wires[terminal.wireIndex[j]].to",wires[terminal.wireIndex[j]].to) updateComponentUtility(terminals[wires[terminal.wireIndex[j]].to].componentIndex,visited) } } } function updateWires(index) { var component = components[index] if(component == undefined || component.inputs == undefined || component.outputs == undefined) return var rotatedAngle = component.initialAngle * Math.PI / 180 for(var i = 0 ; i < component.inputs.length ; ++i) { var terminal = terminals[component.inputs[i]] if(terminal.wireIndex.length != 0) { var wire = wires[terminal.wireIndex[0]] var otherAngle = components[terminals[wire.from].componentIndex].initialAngle * Math.PI / 180 var x = terminals[wire.from].xCenterFromComponent var y = terminals[wire.from].yCenterFromComponent var x1 = terminals[wire.from].xCenter - x + x * Math.cos(otherAngle) - y * Math.sin(otherAngle) var y1 = terminals[wire.from].yCenter - y + x * Math.sin(otherAngle) + y * Math.cos(otherAngle) //console.log(otherComponentAngle,x,y,x1,y1) x = terminal.xCenterFromComponent y = terminal.yCenterFromComponent var x2 = terminal.xCenter - x + x * Math.cos(rotatedAngle) - y * Math.sin(rotatedAngle) var y2 = terminal.yCenter - y + x * Math.sin(rotatedAngle) + y * Math.cos(rotatedAngle) /*if((rotatedAngle > 0 && rotatedAngle <= 90) || rotatedAngle == -270) { x2 = component.x + component.width / 2 + (terminal.yCenterFromComponent * rotatedAngle) / 90 y2 = component.y + component.height / 2 - (terminal.xCenterFromComponent * rotatedAngle) / 90 } else if(rotatedAngle == 180 || rotatedAngle == -180) { x2 = x2 + terminal.xCenterFromComponent * 2 y2 = y2 + terminal.yCenterFromComponent * 2 } else if(rotatedAngle == 270 || rotatedAngle == -90) { x2 = component.x + component.width / 2 - terminal.yCenterFromComponent y2 = component.y + component.height / 2 + terminal.xCenterFromComponent }*/ var width = Math.pow((Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2)),0.5) + 2 var angle = (180/Math.PI)*Math.atan((y2-y1)/(x2-x1)) if(x2 - x1 < 0) angle = angle - 180 wire.x = x1 wire.y = y1 wire.width = width wire.rotation = angle //wire.rotateAngle = angle } } //console.log("component index",component.index,"component.outputs.length",component.outputs.length) for(var i = 0 ; i < component.outputs.length ; ++i) { var terminal = terminals[component.outputs[i]] //console.log("terminal index",terminal.index,"component.outputs[i]",component.outputs[i]) for(var j = 0 ; j < terminal.wireIndex.length ; ++j) { var x = terminal.xCenterFromComponent var y = terminal.yCenterFromComponent var x1 = terminal.xCenter - x + x * Math.cos(rotatedAngle) - y * Math.sin(rotatedAngle) var y1 = terminal.yCenter - y + x * Math.sin(rotatedAngle) + y * Math.cos(rotatedAngle) var wire = wires[terminal.wireIndex[j]] var otherAngle = components[terminals[wire.to].componentIndex].initialAngle * Math.PI / 180 x = terminals[wire.to].xCenterFromComponent y = terminals[wire.to].yCenterFromComponent var x2 = terminals[wire.to].xCenter - x + x * Math.cos(otherAngle) - y * Math.sin(otherAngle) var y2 = terminals[wire.to].yCenter - y + x * Math.sin(otherAngle) + y * Math.cos(otherAngle) /*if(rotatedAngle == 90 || rotatedAngle == -270) { x1 = component.x + component.width / 2 + terminal.yCenterFromComponent y1 = component.y + component.height / 2 - terminal.xCenterFromComponent } else if(rotatedAngle == 180 || rotatedAngle == -180) { x1 = x1 + terminal.xCenterFromComponent * 2 y1 = y1 + terminal.yCenterFromComponent * 2 } else if(rotatedAngle == 270 || rotatedAngle == -90) { x1 = component.x + component.width / 2 - terminal.yCenterFromComponent y1 = component.y + component.height / 2 + terminal.xCenterFromComponent }*/ var width = Math.pow((Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2)),0.5) + 2 var angle = (180/Math.PI)*Math.atan((y2-y1)/(x2-x1)) if(x2 - x1 < 0) angle = angle - 180 //wire.posX1 = x1 //wire.posY1 = y1 //wire.posX2 = x2 //wire.posY2 = y2 wire.x = x1 wire.y = y1 wire.width = width wire.rotation = angle //wire.rotateAngle = angle } } } function deselect() { //items.availablePieces.toolDelete.state = "notSelected" items.availablePieces.rotateLeft.state = "canNotBeSelected" items.availablePieces.rotateRight.state = "canNotBeSelected" items.availablePieces.info.state = "canNotBeSelected" items.infoTxt.visible = false //toolDelete = false selectedIndex = -1 selectedTerminal = -1 for(var i = 0 ; i < terminals.length ; ++i) { terminals[i].selected = false } } function removeComponent(index) { + var component = components[index] + if(component.src == "sevenSegmentDisplay.svg") + sevenSegmentDisplay[index].destroy() for(var i = 0 ; i < component.inputs.length ; ++i) { var terminal = terminals[component.inputs[i]] if(terminal.wireIndex.length != 0) // Input Terminal can have only 1 wire removeWire(terminal.wireIndex[0]) } for(var i = 0 ; i < component.outputs.length ; ++i) { var terminal = terminals[component.outputs[i]] //console.log("Remove terminal.wireIndex.length",terminal.wireIndex.length) while (terminal.wireIndex.length != 0) { //console.log("terminal.wireIndex[j]",terminal.wireIndex[j]) removeWire(terminal.wireIndex[0]) // Output Terminal can have more than 1 wire } } components[index].destroy() deletedIndex.push(index) deselect() } function removeWire(index) { var wire = wires[index] var inTerminal = terminals[wire.to] var outTerminal = terminals[wire.from] var removeIndex = inTerminal.wireIndex.indexOf(index) inTerminal.wireIndex.splice(removeIndex,1) removeIndex = outTerminal.wireIndex.indexOf(index) outTerminal.wireIndex.splice(removeIndex,1) //removeIndex = connected.indexOf(wire.to) //connected.splice(wire.to,1) connected[wire.to] = -1 inTerminal.value = -1 wires[index].destroy() deletedWireIndex.push(index) updateComponent(inTerminal.componentIndex) } function componentSelected(index) { selectedIndex = index items.availablePieces.rotateLeft.state = "canBeSelected" items.availablePieces.rotateRight.state = "canBeSelected" items.availablePieces.info.state = "canBeSelected" } function rotateLeft() { components[selectedIndex].rotationAngle = -2//components[selectedIndex].initialAngle - 90 //console.log("rotationAngle",components[selectedIndex].rotationAngle) components[selectedIndex].rotateComponent.start() /*components[selectedIndex].initialAngle = components[selectedIndex].rotationAngle == -360 ? 0 : components[selectedIndex].rotationAngle*/ } function rotateRight() { components[selectedIndex].rotationAngle = 2//components[selectedIndex].initialAngle + 90 //console.log("rotationAngle",components[selectedIndex].rotationAngle) components[selectedIndex].rotateComponent.start() /*components[selectedIndex].initialAngle = components[selectedIndex].rotationAngle == 360 ? 0 : components[selectedIndex].rotationAngle*/ } function displayInfo() { - var component = componentsInfo[mapSrc[components[selectedIndex].imgSrc]] + var src = components[selectedIndex].imgSrc + var component = componentsInfo[mapSrc[src]] deselect() items.infoTxt.visible = true items.infoTxt.text = component[6] if(component[7].length == 0) items.displayTruthTable = false else { items.displayTruthTable = true var truthTable = items.truthTablesModel truthTable.clear() truthTable.rows = component[7].length truthTable.columns = component[7][0].length truthTable.inputs = component[4].length truthTable.outputs = component[5].length for(var i = 0 ; i < component[7].length ; ++i) for(var j = 0 ; j < component[7][i].length ; ++j) truthTable.append({'value': component[7][i][j]}) } + if(src == "sevenSegmentDisplay.svg") { + items.infoImage.imgVisible = true + items.infoImage.source = url + "7SegmentDisplay.svg" + } + else { + items.infoImage.imgVisible = false + items.infoImage.source = "" + } + //console.log(componentName,componentName=="battery.svg") /*if(componentName == "battery.svg") { items.infoTxt.text = qsTr("Battery is a power source of DC voltage. In analog electronics, the positive " + "terminal gives positive voltage, equal to the rating of battery and negative " + "terminal acts as ground (zero voltage). The battery can have different values " + "depending on its rating. In digital electronics, positive voltage is represented " + "by symbol ‘1’ and ground is represented by symbol ‘0’. Therefore in digital " + "electronics, there are only two states of voltage produced by battery – ‘1’ and ‘0’.") //items.infoImage.source = "" }*/ /*if(componentName == "one.svg" || componentName == "zero.svg") { items.infoTxt.text = qsTr("Digital electronics is a branch of electronics that handle digital signals " + "(i.e discrete signals instead of continous signals). Therefore all values within " + "a range or band represent the same numeric value. In most cases, the number of " + "these states is two and they are represented by two voltage bands: one near a " + "reference value (typically termed as 'ground' or zero volts), and other value near " + "the supply voltage. These correspond to the 'false' ('0') and 'true' ('1') values " + "of the Boolean domain respectively (named after its inventor, George Boole). " + "In this activity, you can give '0' and '1' as input to other logical devices, " + "and see their output through an output device.") //items.infoImage.source = "" } else if(componentName == "gateAnd.svg") { items.infoTxt.text = qsTr("AND gate takes 2 or more binary input in its input terminals and outputs a single " + "value. The output is 0 if any of the input is 0, else it is 1. In this activity, " + "a 2 input AND gate is shown. Truth table for 2 input AND gate is:") //items.infoImage.source = url + "AndTruthTable.svg" items.truthTablesModel.rows = 1 items.truthTablesModel.columns = 3 items.truthTablesModel.inputs = 2 items.truthTablesModel.outputs = 1 items.truthTablesModel.append({'value': "A"}) items.truthTablesModel.append({'value': "B"}) items.truthTablesModel.append({'value': "C"}) } else if(componentName == "gateNand.svg") { items.infoTxt.text = qsTr("NAND gate takes 2 or more binary input in its input terminals and outputs a single " + "value. It is the complement of AND gate. In this activity, a 2 input NAND gate is " + "shown. Truth table for 2 input NAND gate is:") //items.infoImage.source = url + "NandTruthTable.svg" } else if(componentName == "gateNor.svg") { items.infoTxt.text = qsTr("NOR gate takes 2 or more binary input in its input terminals and outputs a single " + "value. It is the complement of OR gate. In this activity, a 2 input NOR gate is " + "shown. Truth table for 2 input NOR gate is:") //items.infoImage.source = url + "NorTruthTable.svg" } else if(componentName == "gateNot.svg") { items.infoTxt.text = qsTr("Not gate (also known as inverter) takes a binary input in its input terminal and " + "outputs a single value. The output is the complement of the input value, that is, it " + "is 0 if input is 1, and 1 if input is 0. Truth table for NOT gate is:") //items.infoImage.source = url + "NotTruthTable.svg" } else if(componentName == "gateOr.svg") { items.infoTxt.text = qsTr("OR gate takes 2 or more binary input in its input terminals and outputs a single " + "value. The output is 1 if any of the input is 1, else it is 0. In this activity, a " + "2 input OR gate is shown. Truth table for 2 input OR gate is:") //items.infoImage.source = url + "OrTruthTable.svg" } else if(componentName == "gateXor.svg") { items.infoTxt.text = qsTr("XOR gate takes 2 or more binary input in its input terminals and outputs a single " + "value. The output is 1 if number of '1' in input is odd, and 0 if number of '1' in " + "input is even. In this activity, a 2 input XOR gate is shown. Truth table for " + "2 input XOR gate is:") //items.infoImage.source = url + "XorTruthTable.svg" } else if(componentName == "comparator.svg") { items.infoTxt.text = qsTr("Comparator takes 2 numbers as input, A and B. It compares them and outputs 3 " + "values. First value is true if A < B, else it is false. Second value is true " + "if A = B, else it is false. Third value is true if A > B, else it is false. " + "In digital electronics, true value is represented as 1, and false value is " + "represented as 0") } /*else if(componentName == "BCDTo7Segment.svg") { items.infoTxt.text = qsTr("BCD to 7 segment converter takes 4 binary inputs in its input terminals and gives " + "7 binary outputs. The 4 binary inputs represents a BCD number (binary-coded decimal). " + "The converter converts this BCD number to corresponding bits, which are used to " + "display the decimal number (represented by the BCD number) on the 7 segment display. " + "The truth table for BCD To 7 Segment converted is:") //items.infoImage.source = url + "BCDTo7SegmentTruthTable.svg" } else if(componentName == "BCDTo7Segment.svg") { items.infoTxt.text = qsTr("BCD to 7 segment converter takes 4 binary inputs which represent a BCD number, " + "and convert them to 7 binary bits which represent corresponding number in 7 segment " + "format. The truth table is:") //items.infoImage.source = url + "BCDTo7SegmentTruthTable.svg" } else if(componentName == "sevenSegmentDisplay.svg") { items.infoTxt.text = qsTr("7 segment display takes 7 binary inputs in its input terminals. The display " + "consists of 7 segments and each segment gets lighted according to the input. " + "By generating different combination of binary inputs, the display can be used to " + "display various different symbols. The diagram is:") //items.infoImage.source = url + "7SegmentDisplay.svg" } else if(componentName == "ledOn.svg" || componentName == "ledOff.svg") { items.infoTxt.text = qsTr("LED (Light-emitting diode) is a two-lead semiconductor light source. It emits " + "light when activated. LED has 2 input terminals, the longer terminal is the " + "positive terminal (anode) and smaller terminal is the negative terminal (cathode)" + ". LED is activated when anode has a higher potential than cathode. In digital " + "electronics LED can be used to check the output of the components. Connect " + "the cathode of LED to ground ('0') and anode of LED to the output of the " + "component. If output is 1, the LED will be activated (emit light), and if " + "output is 0, the LED will be deactivated.") //items.infoImage.source = "" } else if(componentName == "switchOn.svg" || componentName == "switchOff.svg") { items.infoTxt.text = qsTr("Switch is used to maintain easy connection between two terminals. If the switch is " + "turned on, then the two terminals are connected and current can flow through the " + "switch. If the switch is turned off, then the connection between terminal is broken, " + "and current can not flow through it.") //items.infoImage.source = "" }*/ //console.log(items.infoTxt.text) } function updateToolTip(toolTipTxt) { items.toolTip.show(toolTipTxt) } function nextLevel() { if(numberOfLevel <= ++currentLevel ) { currentLevel = 0 } initLevel(); } function previousLevel() { if(--currentLevel < 0) { currentLevel = numberOfLevel - 1 } initLevel(); } diff --git a/src/activities/digital_electricity/resource/Components.qml b/src/activities/digital_electricity/resource/Components.qml deleted file mode 100644 index 8cb93f346..000000000 --- a/src/activities/digital_electricity/resource/Components.qml +++ /dev/null @@ -1,136 +0,0 @@ -/* GCompris - * - * Copyright (C) 2016 Pulkit Gupta - * - * Authors: - * Bruno Coudoin (GTK+ version) - * Pulkit Gupta (Qt Quick port) - * - * 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.0 - -QtObject { - property variant components : [ - { - "imgName": "zero.svg", - "imgWidth": 0.12, - "imgHeight": 0.2, - "toolTipText": qsTr("Zero input"), - "terminalSize": 0.205, - "inputTerminals": [], - "outputTerminals": [ - { - "posX": 0.91, - "posY": 0.5, - "value": 0 - } - ], - "information": qsTr("Digital electronics is a branch of electronics that handle digital signals " + - "(i.e discrete signals instead of continous signals). Therefore all values within " + - "a range or band represent the same numeric value. In most cases, the number of " + - "these states is two and they are represented by two voltage bands: one near a " + - "reference value (typically termed as 'ground' or zero volts), and other value near " + - "the supply voltage. These correspond to the 'false' ('0') and 'true' ('1') values " + - "of the Boolean domain respectively (named after its inventor, George Boole). " + - "In this activity, you can give '0' and '1' as input to other logical devices, " + - "and see their output through an output device."), - "truthTable": [] - - }, - { - "imgName": "one.svg", - "imgWidth": 0.12, - "imgHeight": 0.2, - "toolTipText": qsTr("One input"), - "terminalSize": 0.218, - "inputTerminals": [], - "outputTerminals": [ - { - "posX": 0.91, - "posY": 0.5, - "value": 1 - } - ], - "information": qsTr("Digital electronics is a branch of electronics that handle digital signals " + - "(i.e discrete signals instead of continous signals). Therefore all values within " + - "a range or band represent the same numeric value. In most cases, the number of " + - "these states is two and they are represented by two voltage bands: one near a " + - "reference value (typically termed as 'ground' or zero volts), and other value near " + - "the supply voltage. These correspond to the 'false' ('0') and 'true' ('1') values " + - "of the Boolean domain respectively (named after its inventor, George Boole). " + - "In this activity, you can give '0' and '1' as input to other logical devices, " + - "and see their output through an output device."), - "truthTable": [] - }, - { - "imgName": "gateAnd.svg", - "imgWidth": 0.15, - "imgHeight": 0.12, - "toolTipText": qsTr("AND gate"), - "terminalSize": 0.246, - "inputTerminals": [ - { - "posX": 0.045, - "posY": 0.219 - }, - { - "posX": 0.045, - "posY": 0.773 - } - ], - "outputTerminals": [ - { - "posX": 0.955, - "posY": 0.5 - } - ], - "information": qsTr("AND gate takes 2 or more binary input in its input terminals and outputs a single " + - "value. The output is 0 if any of the input is 0, else it is 1. In this activity, " + - "a 2 input AND gate is shown. Truth table for 2 input AND gate is:"), - "truthTable": [['A','B',"A.B"], - ['0','0','0'], - ['0','1','0'], - ['1','0','0'], - ['1','1','1']] - }, - { - "imgName": "ledOff.svg", - "imgWidth": 0.16, - "imgHeight": 0.2, - "toolTipText": qsTr("LED"), - "terminalSize": 0.111, - "inputTerminals": [ - { - "posX": 0.319, - "posY": 0.945, - }, - { - "posX": 0.776, - "posY": 0.698 - } - ], - "outputTerminals": [], - "information": qsTr("LED (Light-emitting diode) is a two-lead semiconductor light source. It emits " + - "light when activated. LED has 2 input terminals, the longer terminal is the " + - "positive terminal (anode) and smaller terminal is the negative terminal (cathode)" + - ". LED is activated when anode has a higher potential than cathode. In digital " + - "electronics LED can be used to check the output of the components. Connect " + - "the cathode of LED to ground ('0') and anode of LED to the output of the " + - "component. If output is 1, the LED will be activated (emit light), and if " + - "output is 0, the LED will be deactivated."), - "truthTable": [] - } - ] -} diff --git a/src/activities/digital_electricity/resource/ElectricalComponents.qml b/src/activities/digital_electricity/resource/ElectricalComponents.qml new file mode 100644 index 000000000..cd744f0f4 --- /dev/null +++ b/src/activities/digital_electricity/resource/ElectricalComponents.qml @@ -0,0 +1,461 @@ +/* GCompris + * + * Copyright (C) 2016 Pulkit Gupta + * + * Authors: + * Bruno Coudoin (GTK+ version) + * Pulkit Gupta (Qt Quick port) + * + * 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.0 + +QtObject { + property variant components : [ + { + "imgName": "zero.svg", + "imgWidth": 0.12, + "imgHeight": 0.2, + "toolTipText": qsTr("Zero input"), + "terminalSize": 0.205, + "inputTerminals": [], + "outputTerminals": [ + { + "posX": 0.91, + "posY": 0.5, + "value": 0 + } + ], + "information": qsTr("Digital electronics is a branch of electronics that handle digital signals " + + "(i.e discrete signals instead of continous signals). Therefore all values within " + + "a range or band represent the same numeric value. In most cases, the number of " + + "these states is two and they are represented by two voltage bands: one near a " + + "reference value (typically termed as 'ground' or zero volts), and other value near " + + "the supply voltage. These correspond to the 'false' ('0') and 'true' ('1') values " + + "of the Boolean domain respectively (named after its inventor, George Boole). " + + "In this activity, you can give '0' and '1' as input to other logical devices, " + + "and see their output through an output device."), + "truthTable": [] + + }, + { + "imgName": "one.svg", + "imgWidth": 0.12, + "imgHeight": 0.2, + "toolTipText": qsTr("One input"), + "terminalSize": 0.218, + "inputTerminals": [], + "outputTerminals": [ + { + "posX": 0.91, + "posY": 0.5, + "value": 1 + } + ], + "information": qsTr("Digital electronics is a branch of electronics that handle digital signals " + + "(i.e discrete signals instead of continous signals). Therefore all values within " + + "a range or band represent the same numeric value. In most cases, the number of " + + "these states is two and they are represented by two voltage bands: one near a " + + "reference value (typically termed as 'ground' or zero volts), and other value near " + + "the supply voltage. These correspond to the 'false' ('0') and 'true' ('1') values " + + "of the Boolean domain respectively (named after its inventor, George Boole). " + + "In this activity, you can give '0' and '1' as input to other logical devices, " + + "and see their output through an output device."), + "truthTable": [] + }, + { + "imgName": "BCDTo7Segment.svg", + "imgWidth": 0.3, + "imgHeight": 0.4, + "toolTipText": qsTr("BCD To 7 Segment"), + "terminalSize": 0.097, + "inputTerminals": [ + { + "posX": 0.031, + "posY": 0.057 + }, + { + "posX": 0.031, + "posY": 0.35 + }, + { + "posX": 0.031, + "posY": 0.649 + }, + { + "posX": 0.031, + "posY": 0.935 + } + ], + "outputTerminals": [ + { + "posX": 0.969, + "posY": 0.048 + }, + { + "posX": 0.969, + "posY": 0.198 + }, + { + "posX": 0.969, + "posY": 0.353 + }, + { + "posX": 0.968, + "posY": 0.509 + }, + { + "posX": 0.969, + "posY": 0.664 + }, + { + "posX": 0.969, + "posY": 0.812 + }, + { + "posX": 0.969, + "posY": 0.952 + } + ], + "information": qsTr("BCD to 7 segment converter takes 4 binary inputs in its input terminals and gives " + + "7 binary outputs. The 4 binary inputs represents a BCD number (binary-coded decimal). " + + "The converter converts this BCD number to corresponding bits, which are used to " + + "display the decimal number (represented by the BCD number) on the 7 segment display. " + + "The truth table for BCD To 7 Segment converted is:"), + "truthTable": [['A','B','C','D','a','b','c','d','e','f','g'], + ['0','0','0','0','1','1','1','1','1','1','0'], + ['0','0','0','1','0','1','1','0','0','0','0'], + ['0','0','1','0','1','1','0','1','1','0','1'], + ['0','0','1','1','1','1','1','1','0','0','1'], + ['0','1','0','0','0','1','1','0','0','1','1'], + ['0','1','0','1','1','0','1','1','0','1','1'], + ['0','1','1','0','1','0','1','1','1','1','1'], + ['0','1','1','1','1','1','1','0','0','0','0'], + ['1','0','0','0','1','1','1','1','1','1','1'], + ['1','0','0','1','1','1','1','1','0','1','1']] + }, + { + "imgName": "sevenSegmentDisplay.svg", + "imgWidth": 0.18, + "imgHeight": 0.4, + "toolTipText": qsTr("7 Segment Display"), + "terminalSize": 0.116, + "inputTerminals": [ + { + "posX": 0.06, + "posY": 0.058 + }, + { + "posX": 0.06, + "posY": 0.195 + }, + { + "posX": 0.06, + "posY": 0.337 + }, + { + "posX": 0.06, + "posY": 0.484 + }, + { + "posX": 0.06, + "posY": 0.636 + }, + { + "posX": 0.06, + "posY": 0.791 + }, + { + "posX": 0.06, + "posY": 0.942 + } + ], + "outputTerminals": [], + "information": qsTr("7 segment display takes 7 binary inputs in its input terminals. The display " + + "consists of 7 segments and each segment gets lighted according to the input. " + + "By generating different combination of binary inputs, the display can be used to " + + "display various different symbols. The diagram is:"), + "truthTable": [] + }, + { + "imgName": "comparator.svg", + "imgWidth": 0.3, + "imgHeight": 0.25, + "toolTipText": qsTr("Comparator"), + "terminalSize": 0.214, + "inputTerminals": [ + { + "posX": 0.039, + "posY": 0.211 + }, + { + "posX": 0.039, + "posY": 0.784 + } + ], + "outputTerminals": [ + { + "posX": 0.961, + "posY": 0.128 + }, + { + "posX": 0.961, + "posY": 0.481 + }, + { + "posX": 0.961, + "posY": 0.88 + } + ], + "information": qsTr("Comparator takes 2 numbers as input, A and B. It compares them and outputs 3 " + + "values. First value is true if A < B, else it is false. Second value is true " + + "if A = B, else it is false. Third value is true if A > B, else it is false. " + + "In digital electronics, true value is represented as 1, and false value is " + + "represented as 0"), + "truthTable": [] + }, + { + "imgName": "switchOff.svg", + "imgWidth": 0.18, + "imgHeight": 0.15, + "toolTipText": qsTr("Switch"), + "terminalSize": 0.552, + "inputTerminals": [ + { + "posX": 0.065, + "posY": 0.503 + } + ], + "outputTerminals": [ + { + "posX": 0.935, + "posY": 0.497 + } + ], + "information": qsTr("Switch is used to maintain easy connection between two terminals. If the switch is " + + "turned on, then the two terminals are connected and current can flow through the " + + "switch. If the switch is turned off, then the connection between terminal is broken, " + + "and current can not flow through it."), + "truthTable": [] + }, + { + "imgName": "gateAnd.svg", + "imgWidth": 0.15, + "imgHeight": 0.12, + "toolTipText": qsTr("AND gate"), + "terminalSize": 0.246, + "inputTerminals": [ + { + "posX": 0.045, + "posY": 0.219 + }, + { + "posX": 0.045, + "posY": 0.773 + } + ], + "outputTerminals": [ + { + "posX": 0.955, + "posY": 0.5 + } + ], + "information": qsTr("AND gate takes 2 or more binary input in its input terminals and outputs a single " + + "value. The output is 0 if any of the input is 0, else it is 1. In this activity, " + + "a 2 input AND gate is shown. Truth table for 2 input AND gate is:"), + "truthTable": [['A','B',"A.B"], + ['0','0','0'], + ['0','1','0'], + ['1','0','0'], + ['1','1','1']] + }, + { + "imgName": "gateNand.svg", + "imgWidth": 0.15, + "imgHeight": 0.12, + "toolTipText": qsTr("NAND gate"), + "terminalSize": 0.273, + "inputTerminals": [ + { + "posX": 0.045, + "posY": 0.174 + }, + { + "posX": 0.045, + "posY": 0.786 + } + ], + "outputTerminals": [ + { + "posX": 0.955, + "posY": 0.484 + } + ], + "information": qsTr("NAND gate takes 2 or more binary input in its input terminals and outputs a single " + + "value. It is the complement of AND gate. In this activity, a 2 input NAND gate is " + + "shown. Truth table for 2 input NAND gate is:"), + "truthTable": [['A','B',"~(A.B)"], + ['0','0','1'], + ['0','1','1'], + ['1','0','1'], + ['1','1','0']] + }, + { + "imgName": "gateNor.svg", + "imgWidth": 0.15, + "imgHeight": 0.12, + "toolTipText": qsTr("NOR gate"), + "terminalSize": 0.251, + "inputTerminals": [ + { + "posX": 0.045, + "posY": 0.205 + }, + { + "posX": 0.045, + "posY": 0.769 + } + ], + "outputTerminals": [ + { + "posX": 0.955, + "posY": 0.491 + } + ], + "information": qsTr("NOR gate takes 2 or more binary input in its input terminals and outputs a single " + + "value. It is the complement of OR gate. In this activity, a 2 input NOR gate is " + + "shown. Truth table for 2 input NOR gate is:"), + "truthTable": [['A','B',"~(A+B)"], + ['0','0','1'], + ['0','1','0'], + ['1','0','0'], + ['1','1','0']] + }, + { + "imgName": "gateNot.svg", + "imgWidth": 0.15, + "imgHeight": 0.12, + "toolTipText": qsTr("Not gate"), + "terminalSize": 0.261, + "inputTerminals": [ + { + "posX": 0.046, + "posY": 0.503 + } + ], + "outputTerminals": [ + { + "posX": 0.954, + "posY": 0.492 + } + ], + "information": qsTr("Not gate (also known as inverter) takes a binary input in its input terminal and " + + "outputs a single value. The output is the complement of the input value, that is, it " + + "is 0 if input is 1, and 1 if input is 0. Truth table for NOT gate is:"), + "truthTable": [['A',"~A"], + ['0','1'], + ['1','0']] + }, + { + "imgName": "gateOr.svg", + "imgWidth": 0.15, + "imgHeight": 0.12, + "toolTipText": qsTr("Or gate"), + "terminalSize": 0.251, + "inputTerminals": [ + { + "posX": 0.045, + "posY": 0.223 + }, + { + "posX": 0.045, + "posY": 0.786 + } + ], + "outputTerminals": [ + { + "posX": 0.955, + "posY": 0.509 + } + ], + "information": qsTr("OR gate takes 2 or more binary input in its input terminals and outputs a single " + + "value. The output is 1 if any of the input is 1, else it is 0. In this activity, a " + + "2 input OR gate is shown. Truth table for 2 input OR gate is:"), + "truthTable": [['A','B',"A+B"], + ['0','0','0'], + ['0','1','1'], + ['1','0','1'], + ['1','1','1']] + }, + { + "imgName": "gateXor.svg", + "imgWidth": 0.15, + "imgHeight": 0.12, + "toolTipText": qsTr("Xor gate"), + "terminalSize": 0.229, + "inputTerminals": [ + { + "posX": 0.045, + "posY": 0.248 + }, + { + "posX": 0.045, + "posY": 0.762 + } + ], + "outputTerminals": [ + { + "posX": 0.955, + "posY": 0.509 + } + ], + "information": qsTr("XOR gate takes 2 or more binary input in its input terminals and outputs a single " + + "value. The output is 1 if number of '1' in input is odd, and 0 if number of '1' in " + + "input is even. In this activity, a 2 input XOR gate is shown. Truth table for " + + "2 input XOR gate is:"), + "truthTable": [['A','B',"A^B"], + ['0','0','0'], + ['0','1','1'], + ['1','0','1'], + ['1','1','0']] + }, + { + "imgName": "ledOff.svg", + "imgWidth": 0.16, + "imgHeight": 0.2, + "toolTipText": qsTr("LED"), + "terminalSize": 0.111, + "inputTerminals": [ + { + "posX": 0.319, + "posY": 0.945 + }, + { + "posX": 0.776, + "posY": 0.698 + } + ], + "outputTerminals": [], + "information": qsTr("LED (Light-emitting diode) is a two-lead semiconductor light source. It emits " + + "light when activated. LED has 2 input terminals, the longer terminal is the " + + "positive terminal (anode) and smaller terminal is the negative terminal (cathode)" + + ". LED is activated when anode has a higher potential than cathode. In digital " + + "electronics LED can be used to check the output of the components. Connect " + + "the cathode of LED to ground ('0') and anode of LED to the output of the " + + "component. If output is 1, the LED will be activated (emit light), and if " + + "output is 0, the LED will be deactivated."), + "truthTable": [] + } + ] +} diff --git a/src/activities/digital_electricity/resource/comparator.svg b/src/activities/digital_electricity/resource/comparator.svg index bc6571c86..903113813 100644 --- a/src/activities/digital_electricity/resource/comparator.svg +++ b/src/activities/digital_electricity/resource/comparator.svg @@ -1,180 +1,180 @@ image/svg+xml + transform="translate(9.0425882,-287.42958)"> + cx="25.457239" + cy="355.27139" + rx="30.596819" + ry="30.536495" /> + cx="25.457239" + cy="539.39081" + r="30.539909" /> A B + cx="833.27063" + cy="328.56808" + r="30.539719" /> A < B + cx="833.27063" + cy="441.93848" + r="30.539909" /> A = B + cx="833.27063" + cy="570.19995" + r="30.539909" /> A > B diff --git a/src/activities/digital_electricity/resource/gateNand.svg b/src/activities/digital_electricity/resource/gateNand.svg index a61c29d3c..4b99881b4 100644 --- a/src/activities/digital_electricity/resource/gateNand.svg +++ b/src/activities/digital_electricity/resource/gateNand.svg @@ -1,115 +1,111 @@ image/svg+xml + transform="translate(-109.22969,-446.98738)"> + + + + + - - - - - - + id="g3348" + transform="matrix(0.90427827,0,0,0.90427827,117.70393,246.78527)"> - + id="rect1358-8" + sodipodi:nodetypes="ccccccccc" + style="fill:none;stroke:#0000a9;stroke-width:7.95758867;stroke-linejoin:round" + d="m 159.08239,225.44232 c 51.10799,0.3922 102.27727,-1.24706 153.29334,2.08354 21.99973,3.57879 31.22245,9.56896 44.27521,21.79137 21.11116,20.51367 28.74059,52.41327 26.25873,80.59927 -1.44009,21.87716 -11.98035,45.95736 -30.82413,60.41958 -11.06114,8.3985 -23.71558,13.60735 -40.16941,16.48754 -30.76285,4.07515 -61.89338,2.29802 -92.84007,2.88018 -20.0081,0 -39.98557,0.0306 -59.99367,0.45961 l 0,-184.72109 z" /> + - diff --git a/src/activities/digital_electricity/resource/gateNor.svg b/src/activities/digital_electricity/resource/gateNor.svg index 26523e43e..42346289c 100644 --- a/src/activities/digital_electricity/resource/gateNor.svg +++ b/src/activities/digital_electricity/resource/gateNor.svg @@ -1,111 +1,111 @@ image/svg+xml - - - - + transform="translate(-109.22969,-435.02045)"> + + + cx="132.98421" + cy="477.24649" + r="23.754499" /> + cx="132.98419" + cy="584.05078" + r="23.754499" /> - - + + + + diff --git a/src/activities/digital_electricity/resource/gateNot.svg b/src/activities/digital_electricity/resource/gateNot.svg index 028befd41..3b1c114e2 100644 --- a/src/activities/digital_electricity/resource/gateNot.svg +++ b/src/activities/digital_electricity/resource/gateNot.svg @@ -1,113 +1,105 @@ image/svg+xml - + - - - - - - - - + transform="translate(-94.909127,-452.73019)"> + + + + diff --git a/src/activities/digital_electricity/resource/gateOr.svg b/src/activities/digital_electricity/resource/gateOr.svg index 96dc009e9..00ac69032 100644 --- a/src/activities/digital_electricity/resource/gateOr.svg +++ b/src/activities/digital_electricity/resource/gateOr.svg @@ -1,104 +1,100 @@ image/svg+xml - - - - + transform="translate(-109.22972,-434.93685)"> + + + cx="132.98421" + cy="477.24649" + r="23.754499" /> + cx="132.98419" + cy="584.05078" + r="23.754499" /> diff --git a/src/activities/digital_electricity/resource/gateXor.svg b/src/activities/digital_electricity/resource/gateXor.svg index cbc7896cc..04a56f8e5 100644 --- a/src/activities/digital_electricity/resource/gateXor.svg +++ b/src/activities/digital_electricity/resource/gateXor.svg @@ -1,118 +1,113 @@ image/svg+xml + transform="translate(-109.22969,-425.83136)"> + id="g3382"> + style="fill:none;stroke:#000000;stroke-width:6.55188274px" + d="m 590.89581,531.39437 -104.043,0" /> - - - - - - + style="opacity:0.64899998;fill:#000000;fill-opacity:0.93377482;stroke:none;stroke-width:4.15100002;stroke-miterlimit:3.54999995;stroke-dasharray:none;stroke-opacity:0.05298013" /> + + + + + transform="matrix(1.2807438,0,0,1.2807437,-30.259522,309.7471)"> diff --git a/src/activities/digital_electricity/resource/ground.svg b/src/activities/digital_electricity/resource/ground.svg deleted file mode 100644 index 9a8864563..000000000 --- a/src/activities/digital_electricity/resource/ground.svg +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - diff --git a/src/activities/digital_electricity/resource/sevenSegmentDisplay.svg b/src/activities/digital_electricity/resource/sevenSegmentDisplay.svg index 9f9b77a21..bacad6022 100644 --- a/src/activities/digital_electricity/resource/sevenSegmentDisplay.svg +++ b/src/activities/digital_electricity/resource/sevenSegmentDisplay.svg @@ -1,252 +1,252 @@ + width="412.57486" + height="426.36978"> + transform="translate(-5.6229866,265.5615)"> image/svg+xml Openclipart Seven segment display gray 7 2012-03-15T11:54:43 A simple seven segment display https://openclipart.org/detail/168838/seven-segment-display-gray-7-by-alex8664 alex8664 display lcd number seven segment diff --git a/src/activities/digital_electricity/resource/sevenSegmentDisplayA.svg b/src/activities/digital_electricity/resource/sevenSegmentDisplayA.svg new file mode 100644 index 000000000..82eac18ad --- /dev/null +++ b/src/activities/digital_electricity/resource/sevenSegmentDisplayA.svg @@ -0,0 +1,108 @@ + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + 2012-03-15T11:54:43 + A simple seven segment display + https://openclipart.org/detail/168838/seven-segment-display-gray-7-by-alex8664 + + + alex8664 + + + + + display + lcd + number + seven segment + + + + + + + + + + + diff --git a/src/activities/digital_electricity/resource/sevenSegmentDisplayB.svg b/src/activities/digital_electricity/resource/sevenSegmentDisplayB.svg new file mode 100644 index 000000000..3cd0ad2fa --- /dev/null +++ b/src/activities/digital_electricity/resource/sevenSegmentDisplayB.svg @@ -0,0 +1,107 @@ + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + 2012-03-15T11:54:43 + A simple seven segment display + https://openclipart.org/detail/168838/seven-segment-display-gray-7-by-alex8664 + + + alex8664 + + + + + display + lcd + number + seven segment + + + + + + + + + + + diff --git a/src/activities/digital_electricity/resource/sevenSegmentDisplayC.svg b/src/activities/digital_electricity/resource/sevenSegmentDisplayC.svg new file mode 100644 index 000000000..8a1aebaac --- /dev/null +++ b/src/activities/digital_electricity/resource/sevenSegmentDisplayC.svg @@ -0,0 +1,107 @@ + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + 2012-03-15T11:54:43 + A simple seven segment display + https://openclipart.org/detail/168838/seven-segment-display-gray-7-by-alex8664 + + + alex8664 + + + + + display + lcd + number + seven segment + + + + + + + + + + + diff --git a/src/activities/digital_electricity/resource/sevenSegmentDisplayD.svg b/src/activities/digital_electricity/resource/sevenSegmentDisplayD.svg new file mode 100644 index 000000000..511219324 --- /dev/null +++ b/src/activities/digital_electricity/resource/sevenSegmentDisplayD.svg @@ -0,0 +1,108 @@ + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + 2012-03-15T11:54:43 + A simple seven segment display + https://openclipart.org/detail/168838/seven-segment-display-gray-7-by-alex8664 + + + alex8664 + + + + + display + lcd + number + seven segment + + + + + + + + + + + diff --git a/src/activities/digital_electricity/resource/sevenSegmentDisplayE.svg b/src/activities/digital_electricity/resource/sevenSegmentDisplayE.svg new file mode 100644 index 000000000..066eb9ed4 --- /dev/null +++ b/src/activities/digital_electricity/resource/sevenSegmentDisplayE.svg @@ -0,0 +1,107 @@ + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + 2012-03-15T11:54:43 + A simple seven segment display + https://openclipart.org/detail/168838/seven-segment-display-gray-7-by-alex8664 + + + alex8664 + + + + + display + lcd + number + seven segment + + + + + + + + + + + diff --git a/src/activities/digital_electricity/resource/sevenSegmentDisplayF.svg b/src/activities/digital_electricity/resource/sevenSegmentDisplayF.svg new file mode 100644 index 000000000..1ed42cea0 --- /dev/null +++ b/src/activities/digital_electricity/resource/sevenSegmentDisplayF.svg @@ -0,0 +1,107 @@ + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + 2012-03-15T11:54:43 + A simple seven segment display + https://openclipart.org/detail/168838/seven-segment-display-gray-7-by-alex8664 + + + alex8664 + + + + + display + lcd + number + seven segment + + + + + + + + + + + diff --git a/src/activities/digital_electricity/resource/sevenSegmentDisplayG.svg b/src/activities/digital_electricity/resource/sevenSegmentDisplayG.svg new file mode 100644 index 000000000..677bfe04f --- /dev/null +++ b/src/activities/digital_electricity/resource/sevenSegmentDisplayG.svg @@ -0,0 +1,108 @@ + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + 2012-03-15T11:54:43 + A simple seven segment display + https://openclipart.org/detail/168838/seven-segment-display-gray-7-by-alex8664 + + + alex8664 + + + + + display + lcd + number + seven segment + + + + + + + + + + + diff --git a/src/activities/digital_electricity/resource/switchOff.svg b/src/activities/digital_electricity/resource/switchOff.svg index a2f0a0cbf..18a7feb80 100644 --- a/src/activities/digital_electricity/resource/switchOff.svg +++ b/src/activities/digital_electricity/resource/switchOff.svg @@ -1,426 +1,426 @@ image/svg+xml + transform="translate(-39.512972,-372.36225)"> + cx="974.49066" + cy="489.90796" + r="57.900265" /> + cx="104.80647" + cy="491.33649" + r="57.900299" /> OFF diff --git a/src/activities/digital_electricity/resource/switchOn.svg b/src/activities/digital_electricity/resource/switchOn.svg index cd339e6c6..0841beb14 100644 --- a/src/activities/digital_electricity/resource/switchOn.svg +++ b/src/activities/digital_electricity/resource/switchOn.svg @@ -1,410 +1,631 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + transform="translate(-39.512972,-375.59296)"> + + + + + transform="matrix(1.7306165,0,0,1.7306165,656.49394,-806.27102)"> + style="fill:#ffffff;filter:url(#filter5038-1)" /> + style="fill:#b3b3b3;filter:url(#filter5042-0)" /> + style="fill:#444444;filter:url(#filter3909-1-3-6)" /> + style="fill:#a8a8a8;filter:url(#filter3909-1-3-6)" /> + style="fill:#ffffff;fill-opacity:0.81467004;filter:url(#filter3917-8-1-4)" /> + style="fill:#444444;filter:url(#filter3909-1-3-6)" /> + style="fill:#a8a8a8;filter:url(#filter3909-1-3-6)" /> + style="fill:#ffffff;fill-opacity:0.81467004;filter:url(#filter3917-8-1-4)" /> ON + style="fill:#ffffff;fill-opacity:0.76018001;filter:url(#filter4140-9-8)" /> + style="filter:url(#filter4148-8-2)" /> - - - -