From 0345245e860375a32c9a437c4a9d9cae807134e9 Mon Sep 17 00:00:00 2001
From: Shashank
Date: Mon, 29 May 2017 12:40:26 +0530
Subject: CMSCOPE changed
---
modules/xml/demos/atoms_colors.xml | 113 +++++++++++++++++
modules/xml/demos/diazepam.dem.sce | 102 ++++++++++++++++
modules/xml/demos/diazepam.xml | 223 ++++++++++++++++++++++++++++++++++
modules/xml/demos/xml.dem.gateway.sce | 18 +++
4 files changed, 456 insertions(+)
create mode 100755 modules/xml/demos/atoms_colors.xml
create mode 100755 modules/xml/demos/diazepam.dem.sce
create mode 100755 modules/xml/demos/diazepam.xml
create mode 100755 modules/xml/demos/xml.dem.gateway.sce
(limited to 'modules/xml/demos')
diff --git a/modules/xml/demos/atoms_colors.xml b/modules/xml/demos/atoms_colors.xml
new file mode 100755
index 000000000..dd57b61a3
--- /dev/null
+++ b/modules/xml/demos/atoms_colors.xml
@@ -0,0 +1,113 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/xml/demos/diazepam.dem.sce b/modules/xml/demos/diazepam.dem.sce
new file mode 100755
index 000000000..5f244642d
--- /dev/null
+++ b/modules/xml/demos/diazepam.dem.sce
@@ -0,0 +1,102 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2011 - DIGITEO - Sylvestre Ledru
+//
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+function diazepam_demo()
+
+
+
+ my_test_fig = figure(100001);
+ my_test_fig.figure_name = "Display of a molecule of diazepam from a CML file (XML)";
+
+ filename = "diazepam.dem.sce";
+ demo_viewCode(filename);
+
+ listDisplayed = struct();
+
+ prot = funcprot();
+ funcprot(0);
+
+ function displayAtom(atomName)
+ if ~isfield(listDisplayed,atomName) then
+
+ listDisplayed(atomName)=%t;
+ [coords elementType] = getAtomInfos(atomName);
+
+ rgbX = xmlXPath(xmlAtomsColors, "//atom[@name=''" + elementType + "'']/@*[name()=''R'' or name()=''G'' or name()=''B'']");
+ rgb = xmlAsNumber(rgbX);
+
+ xfarc(coords(1) - 0.5, coords(2) + 0.5, 1, 1, 0, 360 * 64);
+ cercle = get("hdl");
+ cercle.background = color(rgb(1), rgb(2), rgb(3));
+ xstring(coords(1), coords(2) - 1, elementType);
+ end
+ endfunction
+
+ function [coord, elemType] = getAtomInfos(atomName)
+ xp = xmlXPath(xmlFile, "//cmldoc/molecule/atomArray/atom[@id=''" + atomName + "'']");
+ atomX = xmlXPath(xp(1), "float");
+ coord = xmlAsNumber(atomX);
+ elemType = xmlXPath(xp(1), "string(string[@builtin=''elementType''])");
+ endfunction
+
+ funcprot(prot);
+
+ xmlAtomsColors = xmlRead(SCI + "/modules/xml/demos/atoms_colors.xml");
+ xmlFile = xmlRead(SCI + "/modules/xml/demos/diazepam.xml");
+
+ bonds = xmlXPath(xmlFile, "//cmldoc/molecule/bondArray/bond");
+ nbBonds = size(bonds);
+ coords = [];
+ drawlater();
+ plot2d([], [], -1, "030", " ", [-6, -6, 6, 6]);
+ f = gcf();
+ f.background = color(255, 255, 255);
+ f.anti_aliasing = "8x";
+
+ for i = 1:nbBonds(2)
+ bondCouple = xmlAsText(xmlXPath(bonds(i), "string[@builtin=''atomRef'']"));
+ order = xmlAsNumber(xmlXPath(bonds(i), "string[@builtin=''order'']"));
+ x1 = getAtomInfos(bondCouple(1))';
+ x2 = getAtomInfos(bondCouple(2))';
+ if order ~= 1 then
+ u = x2 - x1;
+ u = [0 1 ; -1 0] * u / norm(u);
+ end
+
+ if order == 1 then
+ coords(:, $ + 1) = x1;
+ coords(:, $ + 1) = x2;
+ elseif order == 2 then
+ coords(:, $ + 1) = x1 - 0.1 * u;
+ coords(:, $ + 1) = x2 - 0.1 * u;
+ coords(:, $ + 1) = x1 + 0.1 * u;
+ coords(:, $ + 1) = x2 + 0.1 * u;
+ elseif order == 3 then
+ coords(:, $ + 1) = x1;
+ coords(:, $ + 1) = x2;
+ coords(:, $ + 1) = x1 - 0.1 * u;
+ coords(:, $ + 1) = x2 - 0.1 * u;
+ coords(:, $ + 1) = x1 + 0.1 * u;
+ coords(:, $ + 1) = x2 + 0.1 * u;
+ end
+ end
+ coords = coords(:, 2:$);
+
+ xsegs(coords(1, :), coords(2, :));
+
+ for i = 1:nbBonds(2)
+ bondCouple = xmlAsText(xmlXPath(bonds(i), "string[@builtin=''atomRef'']"));
+ displayAtom(bondCouple(1));
+ displayAtom(bondCouple(2));
+ end
+
+ drawnow();
+
+ xmlDelete(xmlAtomsColors, xmlFile);
+
+endfunction
+
+diazepam_demo();
+clear diazepam_demo;
\ No newline at end of file
diff --git a/modules/xml/demos/diazepam.xml b/modules/xml/demos/diazepam.xml
new file mode 100755
index 000000000..8bbb13850
--- /dev/null
+++ b/modules/xml/demos/diazepam.xml
@@ -0,0 +1,223 @@
+
+
+
+
+
+
+
+
+
+ C
+ 1.4278
+ -0.202
+
+
+ C
+ 0.2204
+ 0.7483
+
+
+ C
+ 1.1983
+ -1.7262
+
+
+ N
+ 2.9383
+ 0.1377
+
+
+ C
+ 0.2204
+ 2.3093
+
+
+ C
+ -1.111
+ -0.0138
+
+
+ C
+ 2.4195
+ -2.6766
+
+
+ C
+ -0.2433
+ -2.3093
+
+
+ C
+ 3.604
+ 1.5472
+
+
+ N
+ 1.4278
+ 3.2597
+
+
+ C
+ -1.111
+ 3.0714
+
+
+ C
+ -2.4562
+ 0.7759
+
+
+ C
+ 2.2037
+ -4.2008
+
+
+ C
+ -0.4591
+ -3.8336
+
+
+ C
+ 2.9383
+ 2.9199
+
+
+ C
+ 1.0743
+ 4.7839
+
+
+ C
+ -2.4562
+ 2.3093
+
+
+ Cl
+ -3.829
+ 0.0138
+
+
+ C
+ 0.7483
+ -4.7839
+
+
+ O
+ 3.9162
+ 4.1457
+
+
+
+
+ a1
+ a2
+ 1
+
+
+ a1
+ a3
+ 1
+
+
+ a1
+ a4
+ 2
+
+
+ a2
+ a5
+ 2
+
+
+ a2
+ a6
+ 1
+
+
+ a3
+ a7
+ 1
+
+
+ a3
+ a8
+ 2
+
+
+ a4
+ a9
+ 1
+
+
+ a5
+ a10
+ 1
+
+
+ a5
+ a11
+ 1
+
+
+ a6
+ a12
+ 2
+
+
+ a7
+ a13
+ 2
+
+
+ a8
+ a14
+ 1
+
+
+ a9
+ a15
+ 1
+
+
+ a10
+ a16
+ 1
+
+
+ a11
+ a17
+ 2
+
+
+ a12
+ a18
+ 1
+
+
+ a13
+ a19
+ 1
+
+
+ a15
+ a20
+ 2
+
+
+ a10
+ a15
+ 1
+
+
+ a12
+ a17
+ 1
+
+
+ a14
+ a19
+ 2
+
+
+
+
diff --git a/modules/xml/demos/xml.dem.gateway.sce b/modules/xml/demos/xml.dem.gateway.sce
new file mode 100755
index 000000000..aeb12cd59
--- /dev/null
+++ b/modules/xml/demos/xml.dem.gateway.sce
@@ -0,0 +1,18 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2011 - DIGITEO - Sylvestre Ledru
+//
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+
+function subdemolist = demo_gateway()
+
+ demopath = get_absolute_file_path("xml.dem.gateway.sce");
+ add_demo(gettext("XML"), demopath + "xml.dem.gateway.sce");
+
+ subdemolist = [_("CML read") ,"diazepam.dem.sce" ]
+
+ subdemolist(:,2) = demopath + subdemolist(:,2);
+endfunction
+
+subdemolist = demo_gateway();
+clear demo_gateway;
--
cgit