-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathProject.js
104 lines (76 loc) · 2.38 KB
/
Project.js
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
/* $RCSfile: Project.js,v $
* $Revision: 1.12 $ $Date: 2012/11/07 21:11:12 $
* Auth: Jochen Fritz ([email protected])
*
* 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 Project (builder)
{
var proj_el = builder.root_element["project"];
if (!proj_el) {
throw new Error ("No project found");
}
this.asis = this.make_shape(builder, proj_el["as_is"]);
this.tobe = this.make_shape(builder, proj_el["to_be"]);
var wp = proj_el["wp"];
this.workplan = new Workplan(builder, wp);
}
METHODS (Project, {
getName : function() {return "Project";},
getBoundingBox : function() {
var bbox = new BoundingBox();
if (this.asis)
bbox.updateFrom(this.asis.getBoundingBox());
if (this.tobe)
bbox.updateFrom(this.tobe.getBoundingBox());
bbox.updateFrom(this.workplan.getBoundingBox());
return bbox;
},
getTobe : function() {
if (this.tobe)
return this.tobe;
return this.workplan.getTobe();
},
getFixture : function() {
return this.workplan.getFixture();
},
makeSceneGraph : function(cx, loadables) {
var ret = new SGNode(cx, this);
ret.appendChild(this.workplan.makeSceneGraph(cx, loadables));
return ret;
},
makeProjectTree : function(wp_node, tn) {
var doc = wp_node.ownerDocument;
if (!doc)
throw new Error ("No document");
var ul = doc.createElement("ul");
wp_node.appendChild(ul);
this.workplan.makeProjectTree(ul, tn.getChild(0));
Tree(ul);
tn.getChild(0).setActive();
},
/**********************************************/
/* Private methods
*/
make_shape : function(builder, id) {
if (!id)
return null;
return new Shape(builder, id);
}
});