File size: 5,047 Bytes
233f6d4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | Clazz.declarePackage ("JS");
Clazz.load (null, "JS.ScriptExt", ["JU.AU"], function () {
c$ = Clazz.decorateAsClass (function () {
this.vwr = null;
this.e = null;
this.chk = false;
this.st = null;
this.slen = 0;
Clazz.instantialize (this, arguments);
}, JS, "ScriptExt");
Clazz.defineMethod (c$, "init",
function (eval) {
this.e = eval;
this.vwr = this.e.vwr;
return this;
}, "~O");
Clazz.defineMethod (c$, "atomExpressionAt",
function (i) {
return this.e.atomExpressionAt (i);
}, "~N");
Clazz.defineMethod (c$, "checkLength",
function (i) {
this.e.checkLength (i);
}, "~N");
Clazz.defineMethod (c$, "error",
function (err) {
this.e.error (err);
}, "~N");
Clazz.defineMethod (c$, "invArg",
function () {
this.e.invArg ();
});
Clazz.defineMethod (c$, "invPO",
function () {
this.error (23);
});
Clazz.defineMethod (c$, "getShapeProperty",
function (shapeType, propertyName) {
return this.e.getShapeProperty (shapeType, propertyName);
}, "~N,~S");
Clazz.defineMethod (c$, "paramAsStr",
function (i) {
return this.e.paramAsStr (i);
}, "~N");
Clazz.defineMethod (c$, "centerParameter",
function (i) {
return this.e.centerParameter (i, null);
}, "~N");
Clazz.defineMethod (c$, "floatParameter",
function (i) {
return this.e.floatParameter (i);
}, "~N");
Clazz.defineMethod (c$, "getPoint3f",
function (i, allowFractional) {
return this.e.getPoint3f (i, allowFractional, true);
}, "~N,~B");
Clazz.defineMethod (c$, "intParameter",
function (index) {
return this.e.intParameter (index);
}, "~N");
Clazz.defineMethod (c$, "isFloatParameter",
function (index) {
switch (this.e.tokAt (index)) {
case 2:
case 3:
return true;
}
return false;
}, "~N");
Clazz.defineMethod (c$, "setShapeProperty",
function (shapeType, propertyName, propertyValue) {
this.e.setShapeProperty (shapeType, propertyName, propertyValue);
}, "~N,~S,~O");
Clazz.defineMethod (c$, "showString",
function (s) {
this.e.showString (s);
}, "~S");
Clazz.defineMethod (c$, "stringParameter",
function (index) {
return this.e.stringParameter (index);
}, "~N");
Clazz.defineMethod (c$, "getToken",
function (i) {
return this.e.getToken (i);
}, "~N");
Clazz.defineMethod (c$, "tokAt",
function (i) {
return this.e.tokAt (i);
}, "~N");
Clazz.defineMethod (c$, "setShapeId",
function (iShape, i, idSeen) {
if (idSeen) this.invArg ();
var name = this.e.setShapeNameParameter (i).toLowerCase ();
this.setShapeProperty (iShape, "thisID", name);
return name;
}, "~N,~N,~B");
Clazz.defineMethod (c$, "getColorTrans",
function (eval, i, allowNone, ret) {
var translucentLevel = 3.4028235E38;
if (eval.theTok != 1765808134) --i;
switch (this.tokAt (i + 1)) {
case 603979967:
i++;
translucentLevel = (this.isFloatParameter (i + 1) ? eval.getTranslucentLevel (++i) : this.vwr.getFloat (570425354));
break;
case 1073742074:
i++;
translucentLevel = 0;
break;
}
if (eval.isColorParam (i + 1)) {
ret[0] = eval.getArgbParam (++i);
} else if (this.tokAt (i + 1) == 1073742333) {
ret[0] = 0;
eval.iToken = i + 1;
} else if (translucentLevel == 3.4028235E38) {
this.invArg ();
} else {
ret[0] = -2147483648;
}i = eval.iToken;
return translucentLevel;
}, "JS.ScriptEval,~N,~B,~A");
Clazz.defineMethod (c$, "finalizeObject",
function (shapeID, colorArgb, translucentLevel, intScale, doSet, data, iptDisplayProperty, bs) {
if (doSet) {
this.setShapeProperty (shapeID, "set", data);
}if (colorArgb != -2147483648) this.e.setShapePropertyBs (shapeID, "color", Integer.$valueOf (colorArgb), bs);
if (translucentLevel != 3.4028235E38) this.e.setShapeTranslucency (shapeID, "", "translucent", translucentLevel, bs);
if (intScale != 0) {
this.setShapeProperty (shapeID, "scale", Integer.$valueOf (intScale));
}if (iptDisplayProperty > 0) {
if (!this.e.setMeshDisplayProperty (shapeID, iptDisplayProperty, 0)) this.invArg ();
}}, "~N,~N,~N,~N,~B,~O,~N,JU.BS");
Clazz.defineMethod (c$, "getIntArray2",
function (i) {
var list = (this.e.getToken (i)).getList ();
var faces = JU.AU.newInt2 (list.size ());
for (var vi = faces.length; --vi >= 0; ) {
var face = list.get (vi).getList ();
if (face == null) this.invArg ();
faces[vi] = Clazz.newIntArray (face.size (), 0);
for (var vii = faces[vi].length; --vii >= 0; ) faces[vi][vii] = face.get (vii).intValue;
}
return faces;
}, "~N");
Clazz.defineMethod (c$, "getAllPoints",
function (index) {
var points = null;
var bs = null;
try {
switch (this.e.tokAt (index)) {
case 7:
points = this.e.getPointArray (index, -1, false);
break;
case 12290:
case 10:
case 1073742325:
bs = this.atomExpressionAt (index);
break;
}
if (points == null) {
if (bs == null) bs = this.vwr.getAllAtoms ();
points = new Array (bs.cardinality ());
for (var i = bs.nextSetBit (0), pt = 0; i >= 0; i = bs.nextSetBit (i + 1)) points[pt++] = this.vwr.ms.at[i];
}} catch (e) {
if (Clazz.exceptionOf (e, Exception)) {
} else {
throw e;
}
}
if (points.length < 3) this.invArg ();
return points;
}, "~N");
});
|