void ConstructDataBinningAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("ConstructDataBinningAttributes"); if(searchNode == 0) return; DataNode *node; if((node = searchNode->GetNode("name")) != 0) SetName(node->AsString()); if((node = searchNode->GetNode("varnames")) != 0) SetVarnames(node->AsStringVector()); if((node = searchNode->GetNode("binType")) != 0) SetBinType(node->AsUnsignedCharVector()); if((node = searchNode->GetNode("binBoundaries")) != 0) SetBinBoundaries(node->AsDoubleVector()); 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 < 9) SetReductionOperator(ReductionOperator(ival)); } else if(node->GetNodeType() == STRING_NODE) { ReductionOperator value; if(ReductionOperator_FromString(node->AsString(), value)) SetReductionOperator(value); } } if((node = searchNode->GetNode("varForReductionOperator")) != 0) SetVarForReductionOperator(node->AsString()); if((node = searchNode->GetNode("undefinedValue")) != 0) SetUndefinedValue(node->AsDouble()); if((node = searchNode->GetNode("binningScheme")) != 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) SetBinningScheme(BinningScheme(ival)); } else if(node->GetNodeType() == STRING_NODE) { BinningScheme value; if(BinningScheme_FromString(node->AsString(), value)) SetBinningScheme(value); } } if((node = searchNode->GetNode("numBins")) != 0) SetNumBins(node->AsIntVector()); if((node = searchNode->GetNode("overTime")) != 0) SetOverTime(node->AsBool()); if((node = searchNode->GetNode("timeStart")) != 0) SetTimeStart(node->AsInt()); if((node = searchNode->GetNode("timeEnd")) != 0) SetTimeEnd(node->AsInt()); if((node = searchNode->GetNode("timeStride")) != 0) SetTimeStride(node->AsInt()); if((node = searchNode->GetNode("outOfBoundsBehavior")) != 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) SetOutOfBoundsBehavior(OutOfBoundsBehavior(ival)); } else if(node->GetNodeType() == STRING_NODE) { OutOfBoundsBehavior value; if(OutOfBoundsBehavior_FromString(node->AsString(), value)) SetOutOfBoundsBehavior(value); } } }
void HistogramAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("HistogramAttributes"); if(searchNode == 0) return; DataNode *node; if((node = searchNode->GetNode("basedOn")) != 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) SetBasedOn(BasedOn(ival)); } else if(node->GetNodeType() == STRING_NODE) { BasedOn value; if(BasedOn_FromString(node->AsString(), value)) SetBasedOn(value); } } if((node = searchNode->GetNode("histogramType")) != 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) SetHistogramType(BinContribution(ival)); } else if(node->GetNodeType() == STRING_NODE) { BinContribution value; if(BinContribution_FromString(node->AsString(), value)) SetHistogramType(value); } } if((node = searchNode->GetNode("weightVariable")) != 0) SetWeightVariable(node->AsString()); if((node = searchNode->GetNode("limitsMode")) != 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) SetLimitsMode(LimitsMode(ival)); } else if(node->GetNodeType() == STRING_NODE) { LimitsMode value; if(LimitsMode_FromString(node->AsString(), value)) SetLimitsMode(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("numBins")) != 0) SetNumBins(node->AsInt()); if((node = searchNode->GetNode("domain")) != 0) SetDomain(node->AsInt()); if((node = searchNode->GetNode("zone")) != 0) SetZone(node->AsInt()); if((node = searchNode->GetNode("useBinWidths")) != 0) SetUseBinWidths(node->AsBool()); if((node = searchNode->GetNode("outputType")) != 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) SetOutputType(OutputType(ival)); } else if(node->GetNodeType() == STRING_NODE) { OutputType value; if(OutputType_FromString(node->AsString(), value)) SetOutputType(value); } } if((node = searchNode->GetNode("lineStyle")) != 0) SetLineStyle(node->AsInt()); if((node = searchNode->GetNode("lineWidth")) != 0) SetLineWidth(node->AsInt()); if((node = searchNode->GetNode("color")) != 0) color.SetFromNode(node); if((node = searchNode->GetNode("dataScale")) != 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) SetDataScale(DataScale(ival)); } else if(node->GetNodeType() == STRING_NODE) { DataScale value; if(DataScale_FromString(node->AsString(), value)) SetDataScale(value); } } if((node = searchNode->GetNode("binScale")) != 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) SetBinScale(DataScale(ival)); } else if(node->GetNodeType() == STRING_NODE) { DataScale value; if(DataScale_FromString(node->AsString(), value)) SetBinScale(value); } } if((node = searchNode->GetNode("normalizeHistogram")) != 0) SetNormalizeHistogram(node->AsBool()); if((node = searchNode->GetNode("computeAsCDF")) != 0) SetComputeAsCDF(node->AsBool()); }