本文整理汇总了C++中ExprNode::GetPos方法的典型用法代码示例。如果您正苦于以下问题:C++ ExprNode::GetPos方法的具体用法?C++ ExprNode::GetPos怎么用?C++ ExprNode::GetPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExprNode
的用法示例。
在下文中一共展示了ExprNode::GetPos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: extMin
void
ParallelCoordinatesViewerPluginInfo::InitializePlotAtts(
AttributeSubject *atts, ViewerPlot *plot)
{
// If we had scalar names, we can just copy the default atts
// and return.
if (defaultAtts->GetScalarAxisNames().size() != 0)
{
// One helpful thing we can do: make sure the user set the
// visual axis names. They really should have, but since
// we can blindly copy them from the scalar axis names in
// this case, no harm doing it for them.
if (defaultAtts->GetVisualAxisNames().size() == 0)
defaultAtts->SetVisualAxisNames(defaultAtts->GetScalarAxisNames());
*(ParallelCoordinatesAttributes*)atts = *defaultAtts;
return;
}
// Otherwise, we must be an array variable; try to get
// some names for its components....
const avtDatabaseMetaData *md = plot->GetMetaData();
const std::string &var = plot->GetVariableName();
const avtArrayMetaData *array = md->GetArray(var);
stringVector subNames;
if (array)
{
subNames = array->compNames;
}
else
{
Expression *exp =
ParsingExprList::GetExpression(plot->GetVariableName());
if (exp == NULL || exp->GetType() != Expression::ArrayMeshVar)
{
debug3 << "ParallelCoordinatesAttributes::InitializePlotAtts: "
<< "variable wasn't an array database variable, an "
<< "array expression, or a list of scalars. This can "
<< "happen if the user attempts to create this plot "
<< "without the use off a wizard, e.g. in the case of "
<< "the cli. Assuming this is the case and continuing "
<< "without error.\n";
return;
}
// If we have any problems walking the expression tree, just return;
// the worst case scenario if we don't populate the visual axis
// name list is that the GUI window is temporarily blank.
ExprNode *root = ParsingExprList::GetExpressionTree(exp);
if (root->GetTypeName() != "Function")
return;
FunctionExpr *fn = dynamic_cast<FunctionExpr*>(root);
if (fn->GetName() != "array_compose" &&
fn->GetName() != "array_compose_with_bins")
return;
ArgsExpr *argsExpr = fn->GetArgsExpr();
std::vector<ArgExpr*> *args = argsExpr ? argsExpr->GetArgs() : NULL;
if (!args)
return;
for (size_t i=0; i<args->size(); i++)
{
ExprNode *arg = (ExprNode*)((*args)[i]->GetExpr());
if (arg->GetTypeName() == "List")
break;
subNames.push_back(arg->GetPos().GetText(exp->GetDefinition()));
}
}
doubleVector extMin(subNames.size(), -1e+37);
doubleVector extMax(subNames.size(), +1e+37);
// Set up the default attributes to contain these values, so
// if the user hits reset, the axis names are retained.
defaultAtts->SetVisualAxisNames(subNames);
defaultAtts->SetExtentMinima(extMin);
defaultAtts->SetExtentMaxima(extMax);
*(ParallelCoordinatesAttributes*)atts = *defaultAtts;
}