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
0
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);
    }
}
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());
}
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
0
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
0
void
QvisAppearanceWidget::singleColorOpacityChanged(int opacity)
{
    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 *singleColorNode = multiCurveNode->GetNode("singleColor");
        DataNode *colorAttributeNode = singleColorNode->GetNode("ColorAttribute");
        DataNode *colorNode = colorAttributeNode->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;
        DataNode *newColorNode = new DataNode("color", newColor, 4);
        colorAttributeNode->RemoveNode(colorNode);
        colorAttributeNode->AddNode(newColorNode);
        atts->SetFromNode(&root);
        atts->Notify();
        emit multiCurveChanged(atts);
    }
}
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());
}
// ****************************************************************************
// 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;
}
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());
    }
}
示例#10
0
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());
}
示例#11
0
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);
        }
    }
}
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);
        }
    }
}
示例#13
0
文件: Asset.cpp 项目: zenkovich/o2
	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();
	}
示例#14
0
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;
        }
    }
}
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);
        }
    }
}
示例#16
0
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);
}
示例#17
0
void
LineoutAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("LineoutAttributes");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("point1")) != 0)
        SetPoint1(node->AsDoubleArray());
    if((node = searchNode->GetNode("point2")) != 0)
        SetPoint2(node->AsDoubleArray());
    if((node = searchNode->GetNode("interactive")) != 0)
        SetInteractive(node->AsBool());
    if((node = searchNode->GetNode("ignoreGlobal")) != 0)
        SetIgnoreGlobal(node->AsBool());
    if((node = searchNode->GetNode("samplingOn")) != 0)
        SetSamplingOn(node->AsBool());
    if((node = searchNode->GetNode("numberOfSamplePoints")) != 0)
        SetNumberOfSamplePoints(node->AsInt());
    if((node = searchNode->GetNode("reflineLabels")) != 0)
        SetReflineLabels(node->AsBool());
    if((node = searchNode->GetNode("designator")) != 0)
        SetDesignator(node->AsString());
}
void
CracksClipperAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("CracksClipperAttributes");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("crack1Var")) != 0)
        SetCrack1Var(node->AsString());
    if((node = searchNode->GetNode("crack2Var")) != 0)
        SetCrack2Var(node->AsString());
    if((node = searchNode->GetNode("crack3Var")) != 0)
        SetCrack3Var(node->AsString());
    if((node = searchNode->GetNode("strainVar")) != 0)
        SetStrainVar(node->AsString());
    if((node = searchNode->GetNode("showCrack1")) != 0)
        SetShowCrack1(node->AsBool());
    if((node = searchNode->GetNode("showCrack2")) != 0)
        SetShowCrack2(node->AsBool());
    if((node = searchNode->GetNode("showCrack3")) != 0)
        SetShowCrack3(node->AsBool());
    if((node = searchNode->GetNode("inMassVar")) != 0)
        SetInMassVar(node->AsString());
}
void
LagrangianAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("LagrangianAttributes");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("seedPoint")) != 0)
        SetSeedPoint(node->AsDoubleArray());
    if((node = searchNode->GetNode("numSteps")) != 0)
        SetNumSteps(node->AsInt());
    if((node = searchNode->GetNode("XAxisSample")) != 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 < 6)
                SetXAxisSample(sampleType(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            sampleType value;
            if(sampleType_FromString(node->AsString(), value))
                SetXAxisSample(value);
        }
    }
    if((node = searchNode->GetNode("YAxisSample")) != 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 < 6)
                SetYAxisSample(sampleType(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            sampleType value;
            if(sampleType_FromString(node->AsString(), value))
                SetYAxisSample(value);
        }
    }
    if((node = searchNode->GetNode("variable")) != 0)
        SetVariable(node->AsString());
}
示例#20
0
void
SphereAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("SphereAttributes");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("origin")) != 0)
        SetOrigin(node->AsDoubleArray());
    if((node = searchNode->GetNode("radius")) != 0)
        SetRadius(node->AsDouble());
}
示例#21
0
void
DualMeshAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("DualMeshAttributes");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("mode")) != 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)
                SetMode(ConversionMode(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            ConversionMode value;
            if(ConversionMode_FromString(node->AsString(), value))
                SetMode(value);
        }
    }
}
示例#22
0
void
DelaunayAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("DelaunayAttributes");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("dimension")) != 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)
                SetDimension(Dimension(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            Dimension value;
            if(Dimension_FromString(node->AsString(), value))
                SetDimension(value);
        }
    }
}
示例#23
0
void
SiloDumpAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("SiloDumpAttributes");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("filename")) != 0)
        SetFilename(node->AsString());
    if((node = searchNode->GetNode("display")) != 0)
        SetDisplay(node->AsBool());
}
示例#24
0
void
TruecolorAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("TruecolorAttributes");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("opacity")) != 0)
        SetOpacity(node->AsDouble());
    if((node = searchNode->GetNode("lightingFlag")) != 0)
        SetLightingFlag(node->AsBool());
}
void
DatabaseCorrelation::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("DatabaseCorrelation");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("name")) != 0)
        SetName(node->AsString());
    if((node = searchNode->GetNode("numStates")) != 0)
        SetNumStates(node->AsInt());
    if((node = searchNode->GetNode("method")) != 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)
                SetMethod(CorrelationMethod(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            CorrelationMethod value;
            if(CorrelationMethod_FromString(node->AsString(), value))
                SetMethod(value);
        }
    }
    if((node = searchNode->GetNode("databaseNames")) != 0)
        SetDatabaseNames(node->AsStringVector());
    if((node = searchNode->GetNode("databaseNStates")) != 0)
        SetDatabaseNStates(node->AsIntVector());
    if((node = searchNode->GetNode("databaseTimes")) != 0)
        SetDatabaseTimes(node->AsDoubleVector());
    if((node = searchNode->GetNode("databaseCycles")) != 0)
        SetDatabaseCycles(node->AsIntVector());
    if((node = searchNode->GetNode("indices")) != 0)
        SetIndices(node->AsIntVector());
    if((node = searchNode->GetNode("condensedTimes")) != 0)
        SetCondensedTimes(node->AsDoubleVector());
    if((node = searchNode->GetNode("condensedCycles")) != 0)
        SetCondensedCycles(node->AsIntVector());
}
示例#26
0
void
OnionPeelAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("OnionPeelAttributes");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("adjacencyType")) != 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)
                SetAdjacencyType(NodeFace(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            NodeFace value;
            if(NodeFace_FromString(node->AsString(), value))
                SetAdjacencyType(value);
        }
    }
    if((node = searchNode->GetNode("useGlobalId")) != 0)
        SetUseGlobalId(node->AsBool());
    if((node = searchNode->GetNode("categoryName")) != 0)
        SetCategoryName(node->AsString());
    if((node = searchNode->GetNode("subsetName")) != 0)
        SetSubsetName(node->AsString());
    if((node = searchNode->GetNode("index")) != 0)
        SetIndex(node->AsIntVector());
    if((node = searchNode->GetNode("logical")) != 0)
        SetLogical(node->AsBool());
    if((node = searchNode->GetNode("requestedLayer")) != 0)
        SetRequestedLayer(node->AsInt());
    if((node = searchNode->GetNode("seedType")) != 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)
                SetSeedType(SeedIdType(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            SeedIdType value;
            if(SeedIdType_FromString(node->AsString(), value))
                SetSeedType(value);
        }
    }
}
示例#27
0
void
ColorControlPoint::SetFromNode(DataNode *parentNode)
{
    //int i;
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("ColorControlPoint");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("colors")) != 0)
        SetColors(node->AsUnsignedCharArray());
    if((node = searchNode->GetNode("position")) != 0)
        SetPosition(node->AsFloat());
}
示例#28
0
void
FileOpenOptions::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("FileOpenOptions");
    if(searchNode == 0)
        return;

    DataNode *node;
    DataNode **children;
    if((node = searchNode->GetNode("typeNames")) != 0)
        SetTypeNames(node->AsStringVector());
    if((node = searchNode->GetNode("typeIDs")) != 0)
        SetTypeIDs(node->AsStringVector());

    // Clear all the DBOptionsAttributess if we got any.
    bool clearedOpenOptions = false;
    // Go through all of the children and construct a new
    // DBOptionsAttributes 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("DBOptionsAttributes"))
            {
                if (!clearedOpenOptions)
                {
                    ClearOpenOptions();
                    clearedOpenOptions = true;
                }
                DBOptionsAttributes temp;
                temp.SetFromNode(children[i]);
                AddOpenOptions(temp);
            }
        }
    }

    if((node = searchNode->GetNode("Enabled")) != 0)
        SetEnabled(node->AsIntVector());
    if((node = searchNode->GetNode("preferredIDs")) != 0)
        SetPreferredIDs(node->AsStringVector());
}
void
ExportDBAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("ExportDBAttributes");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("allTimes")) != 0)
        SetAllTimes(node->AsBool());
    if((node = searchNode->GetNode("db_type")) != 0)
        SetDb_type(node->AsString());
    if((node = searchNode->GetNode("db_type_fullname")) != 0)
        SetDb_type_fullname(node->AsString());
    if((node = searchNode->GetNode("filename")) != 0)
        SetFilename(node->AsString());
    if((node = searchNode->GetNode("dirname")) != 0)
        SetDirname(node->AsString());
    if((node = searchNode->GetNode("variables")) != 0)
        SetVariables(node->AsStringVector());
    if((node = searchNode->GetNode("opts")) != 0)
        opts.SetFromNode(node);
}
void
NameschemeAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("NameschemeAttributes");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("namescheme")) != 0)
        SetNamescheme(node->AsString());
    if((node = searchNode->GetNode("externalArrayNames")) != 0)
        SetExternalArrayNames(node->AsStringVector());
    if((node = searchNode->GetNode("externalArrayOffsets")) != 0)
        SetExternalArrayOffsets(node->AsIntVector());
    if((node = searchNode->GetNode("externalArrayData")) != 0)
        SetExternalArrayData(node->AsIntVector());
    if((node = searchNode->GetNode("allExplicitNames")) != 0)
        SetAllExplicitNames(node->AsStringVector());
    if((node = searchNode->GetNode("explicitIds")) != 0)
        SetExplicitIds(node->AsIntVector());
    if((node = searchNode->GetNode("explicitNames")) != 0)
        SetExplicitNames(node->AsStringVector());
}