MCPcopy Create free account
hub / github.com/GilesBathgate/RapCAD / evaluate

Method evaluate

src/module/alignmodule.cpp:36–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36Node* AlignModule::evaluate(const Context& ctx) const
37{
38 QList<ViewDirections> align;
39 VectorValue* vecVal=dynamic_cast<VectorValue*>(ctx.getArgument(0,"anchor"));
40 if(vecVal) {
41 Point p = vecVal->getPoint();
42 decimal x=p.x();
43 decimal y=p.y();
44 decimal z=p.z();
45 if(x>0.0) {
46 align.append(ViewDirections::East);
47 } else if(x<0.0) {
48 align.append(ViewDirections::West);
49 } else {
50 align.append(ViewDirections::East);
51 align.append(ViewDirections::West);
52 }
53 if(y>0.0) {
54 align.append(ViewDirections::North);
55 } else if(y<0.0) {
56 align.append(ViewDirections::South);
57 } else {
58 align.append(ViewDirections::North);
59 align.append(ViewDirections::South);
60 }
61 if(z>0.0) {
62 align.append(ViewDirections::Top);
63 } else if(z<0.0) {
64 align.append(ViewDirections::Bottom);
65 } else {
66 align.append(ViewDirections::Top);
67 align.append(ViewDirections::Bottom);
68 }
69 } else {
70
71 auto* topVal=dynamic_cast<BooleanValue*>(getParameterArgument(ctx,0,0));
72 auto* bottomVal=dynamic_cast<BooleanValue*>(getParameterArgument(ctx,1,0));
73 auto* northVal=dynamic_cast<BooleanValue*>(getParameterArgument(ctx,2,0));
74 auto* southVal=dynamic_cast<BooleanValue*>(getParameterArgument(ctx,3,0));
75 auto* eastVal=dynamic_cast<BooleanValue*>(getParameterArgument(ctx,4,0));
76 auto* westVal=dynamic_cast<BooleanValue*>(getParameterArgument(ctx,5,0));
77
78 if(topVal&&topVal->isTrue()) {
79 align.append(ViewDirections::Top);
80 }
81 if(bottomVal&&bottomVal->isTrue()) {
82 align.append(ViewDirections::Bottom);
83 }
84 if(northVal&&northVal->isTrue()) {
85 align.append(ViewDirections::North);
86 }
87 if(southVal&&southVal->isTrue()) {
88 align.append(ViewDirections::South);
89 }
90 if(eastVal&&eastVal->isTrue()) {
91 align.append(ViewDirections::East);
92 }
93 if(westVal&&westVal->isTrue()) {

Callers

nothing calls this directly

Calls 10

getArgumentMethod · 0.80
getPointMethod · 0.80
xMethod · 0.80
yMethod · 0.80
zMethod · 0.80
appendMethod · 0.80
getInputNodesMethod · 0.80
setAlignMethod · 0.80
isTrueMethod · 0.45
setChildrenMethod · 0.45

Tested by

no test coverage detected