void
SILAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

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

    DataNode *node;
    DataNode **children;
    if((node = searchNode->GetNode("nSets")) != 0)
        SetNSets(node->AsInt());
    if((node = searchNode->GetNode("setNames")) != 0)
        SetSetNames(node->AsStringVector());
    if((node = searchNode->GetNode("setIds")) != 0)
        SetSetIds(node->AsIntVector());
    if((node = searchNode->GetNode("wholeList")) != 0)
        SetWholeList(node->AsIntVector());
    if((node = searchNode->GetNode("nCollections")) != 0)
        SetNCollections(node->AsInt());
    if((node = searchNode->GetNode("category")) != 0)
        SetCategory(node->AsStringVector());
    if((node = searchNode->GetNode("role")) != 0)
        SetRole(node->AsIntVector());
    if((node = searchNode->GetNode("superset")) != 0)
        SetSuperset(node->AsIntVector());

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


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


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

    if((node = searchNode->GetNode("order")) != 0)
        SetOrder(node->AsIntVector());
}
void
ExtremeValueAnalysisAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

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

    DataNode *node;
    if((node = searchNode->GetNode("dataYearBegin")) != 0)
        SetDataYearBegin(node->AsInt());
    if((node = searchNode->GetNode("dataAnalysisYearRangeEnabled")) != 0)
        SetDataAnalysisYearRangeEnabled(node->AsBool());
    if((node = searchNode->GetNode("dataAnalysisYear1")) != 0)
        SetDataAnalysisYear1(node->AsInt());
    if((node = searchNode->GetNode("dataAnalysisYear2")) != 0)
        SetDataAnalysisYear2(node->AsInt());
    if((node = searchNode->GetNode("ensemble")) != 0)
        SetEnsemble(node->AsBool());
    if((node = searchNode->GetNode("numEnsembles")) != 0)
        SetNumEnsembles(node->AsInt());
    if((node = searchNode->GetNode("dataScaling")) != 0)
        SetDataScaling(node->AsDouble());
    if((node = searchNode->GetNode("extremeMethod")) != 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)
                SetExtremeMethod(ExtremeType(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            ExtremeType value;
            if(ExtremeType_FromString(node->AsString(), value))
                SetExtremeMethod(value);
        }
    }
    if((node = searchNode->GetNode("optimizationMethod")) != 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)
                SetOptimizationMethod(OptimizationType(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            OptimizationType value;
            if(OptimizationType_FromString(node->AsString(), value))
                SetOptimizationMethod(value);
        }
    }
    if((node = searchNode->GetNode("aggregation")) != 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)
                SetAggregation(AggregationType(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            AggregationType value;
            if(AggregationType_FromString(node->AsString(), value))
                SetAggregation(value);
        }
    }
    if((node = searchNode->GetNode("covariateModelScale")) != 0)
        SetCovariateModelScale(node->AsBool());
    if((node = searchNode->GetNode("covariateModelLocation")) != 0)
        SetCovariateModelLocation(node->AsBool());
    if((node = searchNode->GetNode("covariateModelShape")) != 0)
        SetCovariateModelShape(node->AsBool());
    if((node = searchNode->GetNode("computeReturnValues")) != 0)
        SetComputeReturnValues(node->AsBool());
    if((node = searchNode->GetNode("returnValues")) != 0)
        SetReturnValues(node->AsIntVector());
    if((node = searchNode->GetNode("computeRVDifferences")) != 0)
        SetComputeRVDifferences(node->AsBool());
    if((node = searchNode->GetNode("rvDifference1")) != 0)
        SetRvDifference1(node->AsInt());
    if((node = searchNode->GetNode("rvDifference2")) != 0)
        SetRvDifference2(node->AsInt());
    if((node = searchNode->GetNode("displayMonth")) != 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 < 12)
                SetDisplayMonth(MonthType(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            MonthType value;
            if(MonthType_FromString(node->AsString(), value))
                SetDisplayMonth(value);
        }
    }
    if((node = searchNode->GetNode("displaySeason")) != 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 < 4)
                SetDisplaySeason(SeasonType(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            SeasonType value;
            if(SeasonType_FromString(node->AsString(), value))
                SetDisplaySeason(value);
        }
    }
    if((node = searchNode->GetNode("computeParamValues")) != 0)
        SetComputeParamValues(node->AsBool());
    if((node = searchNode->GetNode("dumpData")) != 0)
        SetDumpData(node->AsBool());
    if((node = searchNode->GetNode("dumpDebug")) != 0)
        SetDumpDebug(node->AsBool());
}
Ejemplo n.º 3
0
void
WellBoreAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

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

    DataNode *node;
    if((node = searchNode->GetNode("defaultPalette")) != 0)
        defaultPalette.SetFromNode(node);
    if((node = searchNode->GetNode("changedColors")) != 0)
        SetChangedColors(node->AsUnsignedCharVector());
    if((node = searchNode->GetNode("colorType")) != 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)
                SetColorType(ColoringMethod(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            ColoringMethod value;
            if(ColoringMethod_FromString(node->AsString(), value))
                SetColorType(value);
        }
    }
    if((node = searchNode->GetNode("colorTableName")) != 0)
        SetColorTableName(node->AsString());
    if((node = searchNode->GetNode("invertColorTable")) != 0)
        SetInvertColorTable(node->AsBool());
    if((node = searchNode->GetNode("singleColor")) != 0)
        singleColor.SetFromNode(node);
    if((node = searchNode->GetNode("multiColor")) != 0)
        multiColor.SetFromNode(node);
    if((node = searchNode->GetNode("drawWellsAs")) != 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)
                SetDrawWellsAs(WellRenderingMode(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            WellRenderingMode value;
            if(WellRenderingMode_FromString(node->AsString(), value))
                SetDrawWellsAs(value);
        }
    }
    if((node = searchNode->GetNode("wellCylinderQuality")) != 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 < 4)
                SetWellCylinderQuality(DetailLevel(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            DetailLevel value;
            if(DetailLevel_FromString(node->AsString(), value))
                SetWellCylinderQuality(value);
        }
    }
    if((node = searchNode->GetNode("wellRadius")) != 0)
        SetWellRadius(node->AsFloat());
    if((node = searchNode->GetNode("wellLineWidth")) != 0)
        SetWellLineWidth(node->AsInt());
    if((node = searchNode->GetNode("wellLineStyle")) != 0)
        SetWellLineStyle(node->AsInt());
    if((node = searchNode->GetNode("wellAnnotation")) != 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 < 4)
                SetWellAnnotation(WellAnnotation(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            WellAnnotation value;
            if(WellAnnotation_FromString(node->AsString(), value))
                SetWellAnnotation(value);
        }
    }
    if((node = searchNode->GetNode("wellStemHeight")) != 0)
        SetWellStemHeight(node->AsFloat());
    if((node = searchNode->GetNode("wellNameScale")) != 0)
        SetWellNameScale(node->AsFloat());
    if((node = searchNode->GetNode("legendFlag")) != 0)
        SetLegendFlag(node->AsBool());
    if((node = searchNode->GetNode("nWellBores")) != 0)
        SetNWellBores(node->AsInt());
    if((node = searchNode->GetNode("wellBores")) != 0)
        SetWellBores(node->AsIntVector());
    if((node = searchNode->GetNode("wellNames")) != 0)
        SetWellNames(node->AsStringVector());
}