-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWorkplan.js
More file actions
117 lines (87 loc) · 2.76 KB
/
Workplan.js
File metadata and controls
117 lines (87 loc) · 2.76 KB
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
/* $RCSfile: Workplan.js,v $
* $Revision: 1.10 $ $Date: 2012/11/07 21:11:12 $
* Auth: Jochen Fritz (jfritz@steptools.com)
*
* Copyright (c) 1991-2012 by STEP Tools Inc.
* All Rights Reserved.
*
* Permission to use, copy, modify, and distribute this software and
* its documentation is hereby granted, provided that this copyright
* notice and license appear on all copies of the software.
*
* STEP TOOLS MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
* SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. STEP TOOLS
* SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
* DERIVATIVES.
*
* ----------------------------------------
*/
"use strict";
function Workplan (builder, id)
{
var ret = builder.make(id, this, "Workplan");
if (ret) return ret;
var el = builder.getElement(id);
this.initExecutable(builder, el);
this.elements = [];
if (el["elements"])
var wp_els = el["elements"];
else
var wp_els = [];
for (var i=0; i<wp_els.length; i++) {
var ex = Executable(builder, wp_els[i]);
if (ex)
this.elements.push(ex);
}
}
Executable.RegisterSubtype("Workplan", Workplan);
SUBTYPE(Executable, Workplan);
METHODS (Workplan, {
getName : function() {return "Workplan";},
getBoundingBox : function() {
var bbox = new BoundingBox();
if (this.fixture)
bbox.updateFrom(this.fixture.getBoundingBox());
for (var i=0; i<this.elements.length; i++) {
bbox.updateFrom(this.elements[i].getBoundingBox());
}
return bbox;
},
getTobe : function() {
var ret = this.getTobeExecutable();
if (ret) return ret;
return this.elements[this.elements.length-1].getTobe();
},
makeSceneGraph : function(cox, loadables, xform) {
var ret = new SGNode(cox, this);
for (var i=0; i<this.elements.length; i++) {
var el = this.elements[i];
var ch = this.elements[i].makeSceneGraph(cox, loadables, xform);
ret.appendChild(ch);
}
this.makeSceneGraphExecutable(cox, loadables);
return ret;
},
makeProjectTree : function(dom_parent, tn) {
var doc = dom_parent.ownerDocument;
var li = doc.createElement("li");
dom_parent.appendChild(li);
var n = this.appendTreeText(li, this.name);
n.treenode = tn;
n.onclick = function() {
this.treenode.setActive();
this.treenode.redraw();
};
var ul = doc.createElement("ul");
li.appendChild(ul);
for (var i=0; i<this.elements.length; i++) {
var child = this.elements[i];
var child_tn = tn.getChild(i);
child.makeProjectTree(ul, child_tn);
}
return li;
}
});