本文整理汇总了C++中DataNode::AsFloatArray方法的典型用法代码示例。如果您正苦于以下问题:C++ DataNode::AsFloatArray方法的具体用法?C++ DataNode::AsFloatArray怎么用?C++ DataNode::AsFloatArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataNode
的用法示例。
在下文中一共展示了DataNode::AsFloatArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
AnnotationObject::SetFromNode(DataNode *parentNode)
{
if(parentNode == 0)
return;
DataNode *searchNode = parentNode->GetNode("AnnotationObject");
if(searchNode == 0)
return;
DataNode *node;
if((node = searchNode->GetNode("objectName")) != 0)
SetObjectName(node->AsString());
if((node = searchNode->GetNode("objectType")) != 0)
{
// Allow enums to be int or string in the config file
if(node->GetNodeType() == INT_NODE)
{
int ival = node->AsInt();
if(ival >= 0 && ival < 8)
SetObjectType(AnnotationType(ival));
}
else if(node->GetNodeType() == STRING_NODE)
{
AnnotationType value;
if(AnnotationType_FromString(node->AsString(), value))
SetObjectType(value);
}
}
if((node = searchNode->GetNode("visible")) != 0)
SetVisible(node->AsBool());
if((node = searchNode->GetNode("active")) != 0)
SetActive(node->AsBool());
if((node = searchNode->GetNode("position")) != 0)
{
if(node->GetNodeType() == FLOAT_ARRAY_NODE)
{
const float *fn = node->AsFloatArray();
double dp[3] = {fn[0], fn[1], fn[2]};
SetPosition(dp);
}
else
SetPosition(node->AsDoubleArray());
}
if((node = searchNode->GetNode("position2")) != 0)
{
if(node->GetNodeType() == FLOAT_ARRAY_NODE)
{
const float *fn = node->AsFloatArray();
double dp[3] = {fn[0], fn[1], fn[2]};
SetPosition2(dp);
}
else
SetPosition2(node->AsDoubleArray());
}
if((node = searchNode->GetNode("textColor")) != 0)
textColor.SetFromNode(node);
if((node = searchNode->GetNode("useForegroundForTextColor")) != 0)
SetUseForegroundForTextColor(node->AsBool());
if((node = searchNode->GetNode("color1")) != 0)
color1.SetFromNode(node);
if((node = searchNode->GetNode("color2")) != 0)
color2.SetFromNode(node);
if((node = searchNode->GetNode("text")) != 0)
SetText(node->AsStringVector());
if((node = searchNode->GetNode("fontFamily")) != 0)
{
// Allow enums to be int or string in the config file
if(node->GetNodeType() == INT_NODE)
{
int ival = node->AsInt();
if(ival >= 0 && ival < 3)
SetFontFamily(FontFamily(ival));
}
else if(node->GetNodeType() == STRING_NODE)
{
FontFamily value;
if(FontFamily_FromString(node->AsString(), value))
SetFontFamily(value);
}
}
if((node = searchNode->GetNode("fontBold")) != 0)
SetFontBold(node->AsBool());
if((node = searchNode->GetNode("fontItalic")) != 0)
SetFontItalic(node->AsBool());
if((node = searchNode->GetNode("fontShadow")) != 0)
SetFontShadow(node->AsBool());
if((node = searchNode->GetNode("floatAttribute1")) != 0)
SetDoubleAttribute1(node->AsDouble());
if((node = searchNode->GetNode("doubleAttribute1")) != 0)
SetDoubleAttribute1(node->AsDouble());
if((node = searchNode->GetNode("intAttribute1")) != 0)
SetIntAttribute1(node->AsInt());
if((node = searchNode->GetNode("intAttribute2")) != 0)
SetIntAttribute2(node->AsInt());
if((node = searchNode->GetNode("intAttribute3")) != 0)
SetIntAttribute3(node->AsInt());
if((node = searchNode->GetNode("doubleVector1")) != 0)
SetDoubleVector1(node->AsDoubleVector());
if((node = searchNode->GetNode("stringVector1")) != 0)
//.........这里部分代码省略.........
示例2: if
void
SimilarityTransformAttributes::SetFromNode(DataNode *parentNode)
{
if(parentNode == 0)
return;
DataNode *searchNode = parentNode->GetNode("SimilarityTransformAttributes");
if(searchNode == 0)
return;
DataNode *node;
if((node = searchNode->GetNode("doRotate")) != 0)
SetDoRotate(node->AsBool());
if((node = searchNode->GetNode("rotateOrigin")) != 0)
{
if(node->GetNodeType() == DOUBLE_ARRAY_NODE)
{
SetRotateOrigin(node->AsDoubleArray());
}
else if(node->GetNodeType() == FLOAT_ARRAY_NODE)
{
const float *fa = node->AsFloatArray();
double da[3] = {fa[0], fa[1], fa[2]};
SetRotateOrigin(da);
}
}
if((node = searchNode->GetNode("rotateAxis")) != 0)
{
if(node->GetNodeType() == DOUBLE_ARRAY_NODE)
{
SetRotateAxis(node->AsDoubleArray());
}
else if(node->GetNodeType() == FLOAT_ARRAY_NODE)
{
const float *fa = node->AsFloatArray();
double da[3] = {fa[0], fa[1], fa[2]};
SetRotateAxis(da);
}
}
if((node = searchNode->GetNode("rotateAmount")) != 0)
{
if(node->GetNodeType() == DOUBLE_NODE)
SetRotateAmount(node->AsDouble());
else if(node->GetNodeType() == FLOAT_NODE)
SetRotateAmount((double)node->AsFloat());
}
if((node = searchNode->GetNode("rotateType")) != 0)
{
// Allow enums to be int or string in the config file
if(node->GetNodeType() == INT_NODE)
{
int ival = node->AsInt();
if(ival >= 0 && ival < 2)
SetRotateType(AngleType(ival));
}
else if(node->GetNodeType() == STRING_NODE)
{
AngleType value;
if(AngleType_FromString(node->AsString(), value))
SetRotateType(value);
}
}
if((node = searchNode->GetNode("doScale")) != 0)
SetDoScale(node->AsBool());
if((node = searchNode->GetNode("scaleOrigin")) != 0)
{
if(node->GetNodeType() == DOUBLE_ARRAY_NODE)
{
SetScaleOrigin(node->AsDoubleArray());
}
else if(node->GetNodeType() == FLOAT_ARRAY_NODE)
{
const float *fa = node->AsFloatArray();
double da[3] = {fa[0], fa[1], fa[2]};
SetScaleOrigin(da);
}
}
if((node = searchNode->GetNode("scaleX")) != 0)
{
if(node->GetNodeType() == DOUBLE_NODE)
SetScaleX(node->AsDouble());
else if(node->GetNodeType() == FLOAT_NODE)
SetScaleX((double)node->AsFloat());
}
if((node = searchNode->GetNode("scaleY")) != 0)
{
if(node->GetNodeType() == DOUBLE_NODE)
SetScaleY(node->AsDouble());
else if(node->GetNodeType() == FLOAT_NODE)
SetScaleY((double)node->AsFloat());
}
if((node = searchNode->GetNode("scaleZ")) != 0)
{
if(node->GetNodeType() == DOUBLE_NODE)
SetScaleZ(node->AsDouble());
else if(node->GetNodeType() == FLOAT_NODE)
SetScaleZ((double)node->AsFloat());
}
if((node = searchNode->GetNode("doTranslate")) != 0)
SetDoTranslate(node->AsBool());
//.........这里部分代码省略.........