本文整理汇总了C++中DataNode::GetNode方法的典型用法代码示例。如果您正苦于以下问题:C++ DataNode::GetNode方法的具体用法?C++ DataNode::GetNode怎么用?C++ DataNode::GetNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataNode
的用法示例。
在下文中一共展示了DataNode::GetNode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
ContourOpAttributes::SetFromNode(DataNode *parentNode)
{
if(parentNode == 0)
return;
DataNode *searchNode = parentNode->GetNode("ContourOpAttributes");
if(searchNode == 0)
return;
DataNode *node;
if((node = searchNode->GetNode("contourNLevels")) != 0)
SetContourNLevels(node->AsInt());
if((node = searchNode->GetNode("contourValue")) != 0)
SetContourValue(node->AsDoubleVector());
if((node = searchNode->GetNode("contourPercent")) != 0)
SetContourPercent(node->AsDoubleVector());
if((node = searchNode->GetNode("contourMethod")) != 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)
SetContourMethod(ContourMethod(ival));
}
else if(node->GetNodeType() == STRING_NODE)
{
ContourMethod value;
if(ContourMethod_FromString(node->AsString(), value))
SetContourMethod(value);
}
}
if((node = searchNode->GetNode("minFlag")) != 0)
SetMinFlag(node->AsBool());
if((node = searchNode->GetNode("maxFlag")) != 0)
SetMaxFlag(node->AsBool());
if((node = searchNode->GetNode("min")) != 0)
SetMin(node->AsDouble());
if((node = searchNode->GetNode("max")) != 0)
SetMax(node->AsDouble());
if((node = searchNode->GetNode("scaling")) != 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)
SetScaling(ContourScaling(ival));
}
else if(node->GetNodeType() == STRING_NODE)
{
ContourScaling value;
if(ContourScaling_FromString(node->AsString(), value))
SetScaling(value);
}
}
if((node = searchNode->GetNode("variable")) != 0)
SetVariable(node->AsString());
}
示例2: root
void
QvisAppearanceWidget::opacityChanged(int opacity, int index)
{
int MultiCurve = viewer->GetPlotIndex("MultiCurve");
AttributeSubject *atts = viewer->DelayedState()->GetPlotAttributes(MultiCurve);
if(atts != 0)
{
DataNode root("root");
atts->CreateNode(&root, true, false);
DataNode *multiCurveNode = root.GetNode("MultiCurveAttributes");
DataNode *multiColorNode = multiCurveNode->GetNode("multiColor");
DataNode *calNode = multiColorNode->GetNode("ColorAttributeList");
DataNode **children = calNode->GetChildren();
DataNode *colorNode = children[index]->GetNode("color");
const unsigned char *oldColor = colorNode->AsUnsignedCharArray();
unsigned char newColor[4];
newColor[0] = oldColor[0];
newColor[1] = oldColor[1];
newColor[2] = oldColor[2];
newColor[3] = (unsigned char)opacity;
colorNode->SetUnsignedCharArray(newColor, 4);
atts->SetFromNode(&root);
atts->Notify();
emit multiCurveChanged(atts);
}
}
示例3: if
void
TimeFormat::SetFromNode(DataNode *parentNode)
{
if(parentNode == 0)
return;
DataNode *searchNode = parentNode->GetNode("TimeFormat");
if(searchNode == 0)
return;
DataNode *node;
if((node = searchNode->GetNode("displayMode")) != 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)
SetDisplayMode(DisplayMode(ival));
}
else if(node->GetNodeType() == STRING_NODE)
{
DisplayMode value;
if(DisplayMode_FromString(node->AsString(), value))
SetDisplayMode(value);
}
}
if((node = searchNode->GetNode("precision")) != 0)
SetPrecision(node->AsInt());
}
示例4: if
void
CoordSwapAttributes::SetFromNode(DataNode *parentNode)
{
if(parentNode == 0)
return;
DataNode *searchNode = parentNode->GetNode("CoordSwapAttributes");
if(searchNode == 0)
return;
DataNode *node;
if((node = searchNode->GetNode("newCoord1")) != 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)
SetNewCoord1(Coord(ival));
}
else if(node->GetNodeType() == STRING_NODE)
{
Coord value;
if(Coord_FromString(node->AsString(), value))
SetNewCoord1(value);
}
}
if((node = searchNode->GetNode("newCoord2")) != 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)
SetNewCoord2(Coord(ival));
}
else if(node->GetNodeType() == STRING_NODE)
{
Coord value;
if(Coord_FromString(node->AsString(), value))
SetNewCoord2(value);
}
}
if((node = searchNode->GetNode("newCoord3")) != 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)
SetNewCoord3(Coord(ival));
}
else if(node->GetNodeType() == STRING_NODE)
{
Coord value;
if(Coord_FromString(node->AsString(), value))
SetNewCoord3(value);
}
}
}
示例5: SetPrinterName
void
PrinterAttributes::SetFromNode(DataNode *parentNode)
{
if(parentNode == 0)
return;
DataNode *searchNode = parentNode->GetNode("PrinterAttributes");
if(searchNode == 0)
return;
DataNode *node;
if((node = searchNode->GetNode("printerName")) != 0)
SetPrinterName(node->AsString());
if((node = searchNode->GetNode("printProgram")) != 0)
SetPrintProgram(node->AsString());
if((node = searchNode->GetNode("documentName")) != 0)
SetDocumentName(node->AsString());
if((node = searchNode->GetNode("creator")) != 0)
SetCreator(node->AsString());
if((node = searchNode->GetNode("numCopies")) != 0)
SetNumCopies(node->AsInt());
if((node = searchNode->GetNode("portrait")) != 0)
SetPortrait(node->AsBool());
if((node = searchNode->GetNode("printColor")) != 0)
SetPrintColor(node->AsBool());
if((node = searchNode->GetNode("outputToFile")) != 0)
SetOutputToFile(node->AsBool());
if((node = searchNode->GetNode("outputToFileName")) != 0)
SetOutputToFileName(node->AsString());
if((node = searchNode->GetNode("pageSize")) != 0)
SetPageSize(node->AsInt());
}
示例6: if
void
RectilinearProject2DAttributes::SetFromNode(DataNode *parentNode)
{
if(parentNode == 0)
return;
DataNode *searchNode = parentNode->GetNode("RectilinearProject2DAttributes");
if(searchNode == 0)
return;
DataNode *node;
if((node = searchNode->GetNode("reductionOperator")) != 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)
SetReductionOperator(ReductionOperator(ival));
}
else if(node->GetNodeType() == STRING_NODE)
{
ReductionOperator value;
if(ReductionOperator_FromString(node->AsString(), value))
SetReductionOperator(value);
}
}
if((node = searchNode->GetNode("mapGrid")) != 0)
SetMapGrid(node->AsBool());
}
示例7: topLevel
// ****************************************************************************
// Method: ColorTableManager::WriteConfigFile
//
// Purpose:
// Writes a the color table to a file.
//
// Arguments:
// filename : The name of the file to write.
//
// Programmer: Brad Whitlock
// Creation: Thu Jul 3 18:27:28 PST 2003
//
// Modifications:
// Brad Whitlock, Thu Nov 13 11:55:17 PDT 2003
// I made it throw a VisItException if the file can't be opened.
//
// Brad Whitlock, Thu Dec 18 11:18:06 PDT 2003
// I made it call CreateNode with the new completeSave flag set to false.
//
// Brad Whitlock, Thu Feb 17 15:55:29 PST 2005
// I removed the exception and made the function return a bool.
//
// Kathleen Biagas, Fri Aug 8 08:34:29 PDT 2014
// Set default category name to 'UserDefined'.
//
// ****************************************************************************
bool
ColorTableManager::WriteConfigFile(std::ostream& out)
{
DataNode topLevel("topLevel");
// Create the color table node.
DataNode *ctNode = new DataNode("ColorTable");
topLevel.AddNode(ctNode);
ctNode->AddNode(new DataNode("Version", std::string(VISIT_VERSION)));
// Let the color table create and add its information to the node.
ccpl.CreateNode(ctNode, false, true);
// This is an export, set the categoryName to UserDefined, adding the node
// if necessary.
if (ctNode->GetNode("ColorControlPointList")->GetNode("category"))
{
// if the category is Standard
std::string category =
ctNode->GetNode("ColorControlPointList")->GetNode("category")->AsString();
if (category == std::string("Standard"))
{
ctNode->GetNode("ColorControlPointList")->GetNode("category")->SetString("UserDefined");
}
}
else
{
ctNode->GetNode("ColorControlPointList")->AddNode(new DataNode("category",std::string("UserDefined")));
}
// Write the output file.
out << "<?xml version=\"1.0\"?>\n";
WriteObject(out, ctNode);
return true;
}
示例8:
void
AttributeSubjectMap::ProcessOldVersions(DataNode *parentNode,
const std::string &configVersion, AttributeSubject *obj)
{
//
// Look for the required nodes.
//
if(parentNode == 0)
return;
DataNode *mapNode = parentNode->GetNode("AttributeSubjectMap");
if(mapNode == 0)
return;
DataNode *indicesNode = mapNode->GetNode("indices");
if(indicesNode == 0)
return;
DataNode *attsNode = mapNode->GetNode("attributes");
if(attsNode == 0)
return;
//
// Now that we have all of the nodes that we need, process old versions
// of each of the input data nodes.
//
const intVector &iv = indicesNode->AsIntVector();
DataNode **attsObjects = attsNode->GetChildren();
const int numAtts = attsNode->GetNumChildren();
for(int i = 0; i < iv.size(); ++i)
{
if(i < numAtts)
obj->ProcessOldVersions(attsObjects[i], configVersion.c_str());
}
}
示例9: if
void
CartographicProjectionAttributes::SetFromNode(DataNode *parentNode)
{
if(parentNode == 0)
return;
DataNode *searchNode = parentNode->GetNode("CartographicProjectionAttributes");
if(searchNode == 0)
return;
DataNode *node;
if((node = searchNode->GetNode("projectionID")) != 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 < 11)
SetProjectionID(ProjectionID(ival));
}
else if(node->GetNodeType() == STRING_NODE)
{
ProjectionID value;
if(ProjectionID_FromString(node->AsString(), value))
SetProjectionID(value);
}
}
if((node = searchNode->GetNode("centralMeridian")) != 0)
SetCentralMeridian(node->AsDouble());
}
示例10: if
void
MessageAttributes::SetFromNode(DataNode *parentNode)
{
if(parentNode == 0)
return;
DataNode *searchNode = parentNode->GetNode("MessageAttributes");
if(searchNode == 0)
return;
DataNode *node;
if((node = searchNode->GetNode("text")) != 0)
SetText(node->AsString());
if((node = searchNode->GetNode("unicode")) != 0)
SetUnicode(node->AsUnsignedCharVector());
if((node = searchNode->GetNode("hasUnicode")) != 0)
SetHasUnicode(node->AsBool());
if((node = searchNode->GetNode("severity")) != 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 < 5)
SetSeverity(Severity(ival));
}
else if(node->GetNodeType() == STRING_NODE)
{
Severity value;
if(Severity_FromString(node->AsString(), value))
SetSeverity(value);
}
}
}
示例11: if
void
DatabaseCorrelationList::SetFromNode(DataNode *parentNode)
{
if(parentNode == 0)
return;
DataNode *searchNode = parentNode->GetNode("DatabaseCorrelationList");
if(searchNode == 0)
return;
DataNode *node;
DataNode **children;
// Clear all the DatabaseCorrelations if we got any.
bool clearedCorrelations = false;
// Go through all of the children and construct a new
// DatabaseCorrelation for each one of them.
children = searchNode->GetChildren();
if(children != 0)
{
for(int i = 0; i < searchNode->GetNumChildren(); ++i)
{
if(children[i]->GetKey() == std::string("DatabaseCorrelation"))
{
if (!clearedCorrelations)
{
ClearCorrelations();
clearedCorrelations = true;
}
DatabaseCorrelation temp;
temp.SetFromNode(children[i]);
AddCorrelations(temp);
}
}
}
if((node = searchNode->GetNode("needPermission")) != 0)
SetNeedPermission(node->AsBool());
if((node = searchNode->GetNode("defaultCorrelationMethod")) != 0)
SetDefaultCorrelationMethod(node->AsInt());
if((node = searchNode->GetNode("whenToCorrelate")) != 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)
SetWhenToCorrelate(WhenToCorrelate(ival));
}
else if(node->GetNodeType() == STRING_NODE)
{
WhenToCorrelate value;
if(WhenToCorrelate_FromString(node->AsString(), value))
SetWhenToCorrelate(value);
}
}
}
示例12: OnDeserialized
void Asset::OnDeserialized(const DataNode& node)
{
if (auto pathNode = node.GetNode("path"))
mPath = *pathNode;
if (auto idNode = node.GetNode("id"))
idNode->GetValue(IdRef());
if (IdRef() != 0 || !mPath.IsEmpty())
Load();
}
示例13: ClearAtts
void
AttributeSubjectMap::SetFromNode(DataNode *parentNode,
AttributeSubject *factoryObj)
{
//
// Clear the attributes.
//
ClearAtts();
//
// Look for the required nodes.
//
if(parentNode == 0)
return;
DataNode *mapNode = parentNode->GetNode("AttributeSubjectMap");
if(mapNode == 0)
return;
DataNode *indicesNode = mapNode->GetNode("indices");
if(indicesNode == 0)
return;
DataNode *attsNode = mapNode->GetNode("attributes");
if(attsNode == 0)
return;
//
// Now that we have all of the nodes that we need, read in the objects
// and add them to the "map".
//
const intVector &iv = indicesNode->AsIntVector();
DataNode **attsObjects = attsNode->GetChildren();
const int numAtts = attsNode->GetNumChildren();
for(int i = 0; i < iv.size(); ++i)
{
if(i < numAtts)
{
// Create a fresh AttributeSubject so that its fields are
// initialized to the default values and not those last read in.
AttributeSubject *reader = factoryObj->NewInstance(false);
// Initialize the object using the data node.
reader->SetFromNode(attsObjects[i]);
// Add the object to the map.
SetAtts(iv[i], reader);
// delete the reader object.
delete reader;
}
}
}
示例14: if
void
AnimationAttributes::SetFromNode(DataNode *parentNode)
{
if(parentNode == 0)
return;
DataNode *searchNode = parentNode->GetNode("AnimationAttributes");
if(searchNode == 0)
return;
DataNode *node;
if((node = searchNode->GetNode("animationMode")) != 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)
SetAnimationMode(AnimationMode(ival));
}
else if(node->GetNodeType() == STRING_NODE)
{
AnimationMode value;
if(AnimationMode_FromString(node->AsString(), value))
SetAnimationMode(value);
}
}
if((node = searchNode->GetNode("pipelineCachingMode")) != 0)
SetPipelineCachingMode(node->AsBool());
if((node = searchNode->GetNode("frameIncrement")) != 0)
SetFrameIncrement(node->AsInt());
if((node = searchNode->GetNode("timeout")) != 0)
SetTimeout(node->AsInt());
if((node = searchNode->GetNode("playbackMode")) != 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)
SetPlaybackMode(PlaybackMode(ival));
}
else if(node->GetNodeType() == STRING_NODE)
{
PlaybackMode value;
if(PlaybackMode_FromString(node->AsString(), value))
SetPlaybackMode(value);
}
}
}
示例15:
void
LightList::SetFromNode(DataNode *parentNode)
{
if(parentNode == 0)
return;
DataNode *searchNode = parentNode->GetNode("LightList");
if(searchNode == 0)
return;
DataNode *node;
if((node = searchNode->GetNode("light0")) != 0)
light0.SetFromNode(node);
if((node = searchNode->GetNode("light1")) != 0)
light1.SetFromNode(node);
if((node = searchNode->GetNode("light2")) != 0)
light2.SetFromNode(node);
if((node = searchNode->GetNode("light3")) != 0)
light3.SetFromNode(node);
if((node = searchNode->GetNode("light4")) != 0)
light4.SetFromNode(node);
if((node = searchNode->GetNode("light5")) != 0)
light5.SetFromNode(node);
if((node = searchNode->GetNode("light6")) != 0)
light6.SetFromNode(node);
if((node = searchNode->GetNode("light7")) != 0)
light7.SetFromNode(node);
}