狠狠撸

狠狠撸Share a Scribd company logo
ЛАБОРАТОРНАЯ
РАБОТА 1
?ФАБРИКА BLOCKLY?
ВЫПОЛНИЛ СТУДЕНТ ГРУППЫ ПОС-10А
ШЕПЛЯКОВ Д. В.
Работа с
файлами
SVG
ИСХОДНЫЙ КОД ИЗОБРАЖЕНИЯ
<svg width="64" height="64" xmlns="http://www.w3.org/2000/svg"><!-- Created with SVG-edit - http://svg-
edit.googlecode.com/ --> <g><title>Layer 1</title><line fill="none" stroke="#000000" stroke-width="1" stroke-
dasharray="null" stroke-linejoin="null" stroke-linecap="null" x1="25.25" y1="3.25" x2="25.25" y2="25.75" id="svg_4"/>
<line fill="none" stroke="#000000" stroke-width="1" stroke-dasharray="null" stroke-linejoin="null" stroke-
linecap="null" x1="29.5" y1="34" x2="29.5" y2="34.25" id="svg_5"/><line fill="none" stroke="#000000" stroke-
width="1" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x1="25.25" y1="25.75" x2="58.75"
y2="25.75" id="svg_6"/><line fill="none" stroke="#000000" stroke-width="1" stroke-dasharray="null" stroke-
linejoin="null" stroke-linecap="null" x1="25.5" y1="25.75" x2="6" y2="48.25" id="svg_7"/> <text fill="#000000"
stroke="#000000" stroke-width="0" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x="60.75"
y="27.75" id="svg_10" font-size="7.024" font-family="serif" text-anchor="middle" xml:space="preserve">x</text><text
fill="#000000" stroke="#000000" stroke-width="0" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null"
x="21.75" y="5.875" font-size="7.024" font-family="serif" text-anchor="middle" xml:space="preserve"
id="svg_11">y</text><text fill="#000000" stroke="#000000" stroke-width="0" stroke-dasharray="null" stroke-
linejoin="null" stroke-linecap="null" x="4.25" y="51.875" font-size="7.024" font-family="serif" text-anchor="middle"
xml:space="preserve" id="svg_12">z</text><text fill="#000000" stroke="#000000" stroke-width="0" stroke-
dasharray="null" stroke-linejoin="null" stroke-linecap="null" x="18.25" y="26.75" id="svg_13" font-size="4.024" font-
family="serif" text-anchor="middle" xml:space="preserve">O(0,0,0)</text></g></svg>
МАСШТАБИРОВАНИЕ SVG ФАЙЛА
ПРЕДСТАВЛЕНИЕ BLOCKLY
СГЕНЕРИРОВАННЫЙ КОД
РЕЗУЛЬТАТ
ЗАГОЛОВОК
Blockly.Language.webgl_a25_1html = {
category: 'WebGL',
helpUrl:"../../media/webgl_a25_header.help.html",
init: function() {
this.setColour(290);
this.appendStatementInput("NAME")
// .appendTitle(new Blockly.FieldImage("../../media/1.svg", 64, 64))
.appendTitle("HTML");
this.setNextStatement(true);
this.setTooltip(''); } };
Blockly.JavaScript.webgl_a25_1html = function() {
var statements_name = Blockly.JavaScript.statementToCode(this, 'NAME');
// TODO: Assemble JavaScript into code variable.
var code = '&lt;html&gt;n&lt;head&gt;n&lt;title&gt;' + statements_name.toString()
+ '&lt;/title&gt;n&lt;/head&gt;'
return code; };
НАЗВАНИЕ СТРАНИЦЫ
Blockly.Language.webgl_a25_2html = {
category: 'WebGL',
helpUrl:"../../media/title.html",
init: function() {
this.setColour(230);
this.appendDummyInput()
.appendTitle("Title")
.appendTitle(new Blockly.FieldTextInput("Лабораторная работа № 1"), "NAME");
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setTooltip('');
}
};
Blockly.JavaScript.webgl_a25_2html = function() {
var text_name = this.getTitleValue('NAME');
var code = text_name.toString();
return code;
};
ТЕЛО СТРАНИЦЫ
Blockly.Language.webgl_a25_3html = {
category: 'WebGL',
helpUrl: "../../media/Body.html",
init: function() {
this.setColour(120);
this.appendStatementInput("NAME")
.appendTitle("Body");
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setTooltip(''); } };
Blockly.JavaScript.webgl_a25_3html = function() {
var statements_name = Blockly.JavaScript.statementToCode(this,
'NAME');
var code = 'n&lt;body&gt;n' + statements_name.toString() +
'n&lt;/body&gt;'
return code;
};
СОЗДАНИЕ СПИСКА
Blockly.Language.canvas_a25_lists_3d_points = { category: 'Canvas',helpUrl:
"../../media/lists.html", init: function() { this.setColour(350);
this.appendDummyInput() .appendTitle(new
Blockly.FieldImage("../../media/1.svg", 64, 64))
.appendTitle("lists_3D_points"); this.appendValueInput("x") .setCheck(Number)
.setAlign(Blockly.ALIGN_RIGHT) .appendTitle("X1 Y1 Z1");
this.appendValueInput("x1")
.setCheck(Number) .setAlign(Blockly.ALIGN_RIGHT)
.appendTitle("X2 Y2 Z2"); this.appendValueInput("x2")
.setCheck(Number) .setAlign(Blockly.ALIGN_RIGHT)
.appendTitle("X3 Y3 Z3"); this.appendValueInput("x3") .setCheck(Number)
.setAlign(Blockly.ALIGN_RIGHT) .appendTitle("X4 Y4 Z4");
this.setPreviousStatement(true); this.setNextStatement(true);
this.setTooltip(''); }};Blockly.JavaScript.canvas_a25_lists_3d_points = function() {
var value_x = Blockly.JavaScript.valueToCode(this, 'x',
Blockly.JavaScript.ORDER_ATOMIC); var value_x1 =
Blockly.JavaScript.valueToCode(this, 'x1', Blockly.JavaScript.ORDER_ATOMIC); var
value_x2 = Blockly.JavaScript.valueToCode(this, 'x2',
Blockly.JavaScript.ORDER_ATOMIC); var value_x3 =
Blockly.JavaScript.valueToCode(this, 'x3', Blockly.JavaScript.ORDER_ATOMIC); //
TODO: Assemble JavaScript into code variable. var code= 'Список трехмерных
координат {'+value_x+','; code += ' '+value_x1+','; code += ' '+value_x2+','; code
+= ' '+value_x3+' '; code += '}'; return code;
};
КОНЕЦ ДОКУМЕНТА
Blockly.Language.webgl_a25_6html = {
category: 'WebGL',
helpUrl:"../../media/Footer.html",
init: function() {
this.setColour(290);
this.appendDummyInput()
.appendTitle("Footer");
this.setPreviousStatement(true);
this.setTooltip('');
}};
Blockly.JavaScript.webgl_a25_6html = function() {
var code = 'n&lt;/html&gt;'
return code;
};
ФАЙЛ СПРАВКИ HTML
ФАЙЛ СПРАВКИ TITLE
ФАЙЛ СПРАВКИ BODY
ФАЙЛ СПРАВКИ LISTS_3D_POINTS
ФАЙЛ СПРАВКИ ВВЕДЕНИЯ ЧИСЛА
ФАЙЛ СПРАВКИ FOOTER
СПАСИБО ЗА ВНИМАНИЕ

More Related Content

лабораторная работа 1 Исправленная

  • 1. ЛАБОРАТОРНАЯ РАБОТА 1 ?ФАБРИКА BLOCKLY? ВЫПОЛНИЛ СТУДЕНТ ГРУППЫ ПОС-10А ШЕПЛЯКОВ Д. В.
  • 3. ИСХОДНЫЙ КОД ИЗОБРАЖЕНИЯ <svg width="64" height="64" xmlns="http://www.w3.org/2000/svg"><!-- Created with SVG-edit - http://svg- edit.googlecode.com/ --> <g><title>Layer 1</title><line fill="none" stroke="#000000" stroke-width="1" stroke- dasharray="null" stroke-linejoin="null" stroke-linecap="null" x1="25.25" y1="3.25" x2="25.25" y2="25.75" id="svg_4"/> <line fill="none" stroke="#000000" stroke-width="1" stroke-dasharray="null" stroke-linejoin="null" stroke- linecap="null" x1="29.5" y1="34" x2="29.5" y2="34.25" id="svg_5"/><line fill="none" stroke="#000000" stroke- width="1" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x1="25.25" y1="25.75" x2="58.75" y2="25.75" id="svg_6"/><line fill="none" stroke="#000000" stroke-width="1" stroke-dasharray="null" stroke- linejoin="null" stroke-linecap="null" x1="25.5" y1="25.75" x2="6" y2="48.25" id="svg_7"/> <text fill="#000000" stroke="#000000" stroke-width="0" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x="60.75" y="27.75" id="svg_10" font-size="7.024" font-family="serif" text-anchor="middle" xml:space="preserve">x</text><text fill="#000000" stroke="#000000" stroke-width="0" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x="21.75" y="5.875" font-size="7.024" font-family="serif" text-anchor="middle" xml:space="preserve" id="svg_11">y</text><text fill="#000000" stroke="#000000" stroke-width="0" stroke-dasharray="null" stroke- linejoin="null" stroke-linecap="null" x="4.25" y="51.875" font-size="7.024" font-family="serif" text-anchor="middle" xml:space="preserve" id="svg_12">z</text><text fill="#000000" stroke="#000000" stroke-width="0" stroke- dasharray="null" stroke-linejoin="null" stroke-linecap="null" x="18.25" y="26.75" id="svg_13" font-size="4.024" font- family="serif" text-anchor="middle" xml:space="preserve">O(0,0,0)</text></g></svg>
  • 7. ЗАГОЛОВОК Blockly.Language.webgl_a25_1html = { category: 'WebGL', helpUrl:"../../media/webgl_a25_header.help.html", init: function() { this.setColour(290); this.appendStatementInput("NAME") // .appendTitle(new Blockly.FieldImage("../../media/1.svg", 64, 64)) .appendTitle("HTML"); this.setNextStatement(true); this.setTooltip(''); } }; Blockly.JavaScript.webgl_a25_1html = function() { var statements_name = Blockly.JavaScript.statementToCode(this, 'NAME'); // TODO: Assemble JavaScript into code variable. var code = '&lt;html&gt;n&lt;head&gt;n&lt;title&gt;' + statements_name.toString() + '&lt;/title&gt;n&lt;/head&gt;' return code; };
  • 8. НАЗВАНИЕ СТРАНИЦЫ Blockly.Language.webgl_a25_2html = { category: 'WebGL', helpUrl:"../../media/title.html", init: function() { this.setColour(230); this.appendDummyInput() .appendTitle("Title") .appendTitle(new Blockly.FieldTextInput("Лабораторная работа № 1"), "NAME"); this.setPreviousStatement(true); this.setNextStatement(true); this.setTooltip(''); } }; Blockly.JavaScript.webgl_a25_2html = function() { var text_name = this.getTitleValue('NAME'); var code = text_name.toString(); return code; };
  • 9. ТЕЛО СТРАНИЦЫ Blockly.Language.webgl_a25_3html = { category: 'WebGL', helpUrl: "../../media/Body.html", init: function() { this.setColour(120); this.appendStatementInput("NAME") .appendTitle("Body"); this.setPreviousStatement(true); this.setNextStatement(true); this.setTooltip(''); } }; Blockly.JavaScript.webgl_a25_3html = function() { var statements_name = Blockly.JavaScript.statementToCode(this, 'NAME'); var code = 'n&lt;body&gt;n' + statements_name.toString() + 'n&lt;/body&gt;' return code; };
  • 10. СОЗДАНИЕ СПИСКА Blockly.Language.canvas_a25_lists_3d_points = { category: 'Canvas',helpUrl: "../../media/lists.html", init: function() { this.setColour(350); this.appendDummyInput() .appendTitle(new Blockly.FieldImage("../../media/1.svg", 64, 64)) .appendTitle("lists_3D_points"); this.appendValueInput("x") .setCheck(Number) .setAlign(Blockly.ALIGN_RIGHT) .appendTitle("X1 Y1 Z1"); this.appendValueInput("x1") .setCheck(Number) .setAlign(Blockly.ALIGN_RIGHT) .appendTitle("X2 Y2 Z2"); this.appendValueInput("x2") .setCheck(Number) .setAlign(Blockly.ALIGN_RIGHT) .appendTitle("X3 Y3 Z3"); this.appendValueInput("x3") .setCheck(Number) .setAlign(Blockly.ALIGN_RIGHT) .appendTitle("X4 Y4 Z4"); this.setPreviousStatement(true); this.setNextStatement(true); this.setTooltip(''); }};Blockly.JavaScript.canvas_a25_lists_3d_points = function() { var value_x = Blockly.JavaScript.valueToCode(this, 'x', Blockly.JavaScript.ORDER_ATOMIC); var value_x1 = Blockly.JavaScript.valueToCode(this, 'x1', Blockly.JavaScript.ORDER_ATOMIC); var value_x2 = Blockly.JavaScript.valueToCode(this, 'x2', Blockly.JavaScript.ORDER_ATOMIC); var value_x3 = Blockly.JavaScript.valueToCode(this, 'x3', Blockly.JavaScript.ORDER_ATOMIC); // TODO: Assemble JavaScript into code variable. var code= 'Список трехмерных координат {'+value_x+','; code += ' '+value_x1+','; code += ' '+value_x2+','; code += ' '+value_x3+' '; code += '}'; return code; };
  • 11. КОНЕЦ ДОКУМЕНТА Blockly.Language.webgl_a25_6html = { category: 'WebGL', helpUrl:"../../media/Footer.html", init: function() { this.setColour(290); this.appendDummyInput() .appendTitle("Footer"); this.setPreviousStatement(true); this.setTooltip(''); }}; Blockly.JavaScript.webgl_a25_6html = function() { var code = 'n&lt;/html&gt;' return code; };