| 34 | } |
| 35 | |
| 36 | Node* 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()) { |
nothing calls this directly
no test coverage detected