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

Method evaluate

src/module/textmodule.cpp:34–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34Node* TextModule::evaluate(const Context& ctx) const
35{
36 auto* textVal=dynamic_cast<TextValue*>(getParameterArgument(ctx,0));
37 if(!textVal)
38 return nullptr;
39
40 QString family;
41 auto* fontVal=dynamic_cast<TextValue*>(getParameterArgument(ctx,1));
42 if(fontVal)
43 family=fontVal->getValueString();
44
45 int size=12;
46 auto* sizeVal=dynamic_cast<NumberValue*>(getParameterArgument(ctx,2));
47 if(sizeVal)
48 size=sizeVal->toInteger();
49
50 QPathTextBuilder tb;
51 tb.setText(textVal->getValueString());
52 tb.setFamily(family);
53 tb.setSize(size);
54
55 auto* pn=new PrimitiveNode();
56 Primitive* p=tb.buildPrimitive();
57 p->setType(PrimitiveTypes::Surface);
58 p->setSanitized(false);
59 pn->setPrimitive(p);
60 pn->setChildren(ctx.getInputNodes());
61 return pn;
62}

Callers

nothing calls this directly

Calls 11

toIntegerMethod · 0.80
setFamilyMethod · 0.80
getInputNodesMethod · 0.80
getValueStringMethod · 0.45
setTextMethod · 0.45
setSizeMethod · 0.45
buildPrimitiveMethod · 0.45
setTypeMethod · 0.45
setSanitizedMethod · 0.45
setPrimitiveMethod · 0.45
setChildrenMethod · 0.45

Tested by

no test coverage detected