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()); }
NS_IMETHODIMP HTMLProgressElement::SetMax(double aValue) { ErrorResult rv; SetMax(aValue, rv); return rv.ErrorCode(); }
// constructor SliderView::SliderView(PopupSlider* target, int32 min, int32 max, int32 value, const char* formatString) : PopupView("slider"), fTarget(target), fFormatString(formatString), fMin(min), fMax(max), fValue(value), fButtonRect(0.0, 0.0, -1.0, -1.0), fDragOffset(0.0) { SetViewColor(B_TRANSPARENT_32_BIT); if (Max() < Min()) SetMax(Min()); BFont font; GetFont(&font); float buttonWidth, buttonHeight; GetSliderButtonDimensions(Max(), FormatString(), &font, buttonWidth, buttonHeight); fButtonRect.right = fButtonRect.left + buttonWidth; fButtonRect.bottom = fButtonRect.top + buttonHeight; float size = Max() - Min(); if (size > 200) size = 200; ResizeTo(6.0 + fButtonRect.Width() + size + 6.0, 6.0 + fButtonRect.Height() + 6.0); }
// // Name: AdaptiveArmor() // Class: AdaptiveArmor // // Description: Constructor // // Parameters: None // // Returns: None // AdaptiveArmor::AdaptiveArmor() { amount = 0; SetMax ( 200 ); // Add Adaptions to list _fxList.AddObject( "fx/fx-borg-sheild-01.tik" ); _fxList.AddObject( "fx/fx-borg-sheild-02.tik" ); _fxList.AddObject( "fx/fx-borg-sheild-03.tik" ); // Set our current Adaption _AdaptionFX = "fx/fx-borg-sheild-01.tik"; // Set our index _currentFXIndex = 1; _fxTimeNormal = 0.15; _fxTimeExplosive = 1.0; _AddMODToCannotAdaptList( MOD_IMOD_PRIMARY); _AddMODToCannotAdaptList( MOD_IMOD_SECONDARY); _AddMODToCannotAdaptList( MOD_SUICIDE ); if ( !LoadingSavegame ) { //Try and pull data from the gameVars Event *loadEvent = new Event ( EV_Armor_LoadAdaptionDataFromGameVars ); PostEvent( loadEvent, 3.0 ); //LoadDataFromGameVars(); } }
void Item::setAmount( float startamount ) { amount = startamount; if ( amount >= MaxAmount() ) { SetMax( (int) amount ); } }
ECode RatingBar::SetStepSize( /* [in] */ Float stepSize) { if (stepSize <= 0) { return NOERROR; } Float newMax = mNumStars / stepSize; Int32 newProgress = (Int32)(newMax / GetMax() * GetProgress()); SetMax((Int32)newMax); SetProgress(newProgress); return NOERROR; }
// // Name: Armor() // Class: Armor // // Description: Constructor // // Parameters: None // // Returns: None // Armor::Armor() { // all data will be setup by the archive function if ( LoadingSavegame ) return; if ( multiplayerManager.checkFlag( MP_FLAG_NO_ARMOR ) ) { PostEvent( EV_Remove, EV_REMOVE ); return; } setName( "UnknownArmor" ); amount = 0; SetMax ( 200 ); _mpItemType = MP_ITEM_TYPE_ARMOR; }
void NamespaceAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("NamespaceAttributes"); if(searchNode == 0) return; DataNode *node; if((node = searchNode->GetNode("type")) != 0) SetType(node->AsInt()); if((node = searchNode->GetNode("subsets")) != 0) SetSubsets(node->AsIntVector()); if((node = searchNode->GetNode("min")) != 0) SetMin(node->AsInt()); if((node = searchNode->GetNode("max")) != 0) SetMax(node->AsInt()); }
/** Mouse Button Down */ void ScrollBar::OnMouseDown(unsigned short /*x*/, unsigned short y, unsigned short Button, unsigned short /*Mod*/) { //removing the double click flag, use a more sophisticated method //if it is needed later Button&=GEM_MB_NORMAL; if (Button==GEM_MB_SCRLUP) { ScrollUp(); return; } if (Button==GEM_MB_SCRLDOWN) { ScrollDown(); return; } if (y <= GetFrameHeight(IE_GUI_SCROLLBAR_UP_UNPRESSED) ) { State |= UP_PRESS; ScrollUp(); return; } if (y >= Height - GetFrameHeight(IE_GUI_SCROLLBAR_DOWN_UNPRESSED)) { State |= DOWN_PRESS; ScrollDown(); return; } // check that stepPx is set if value is set if (Value && !stepPx) { SetMax(Value); } if (y >= SliderYPos && y < SliderYPos + GetFrameHeight(IE_GUI_SCROLLBAR_SLIDER)) { /* TODO: factor in where we grab the slider and offset it when dragging. */ State |= SLIDER_GRAB; return; } // if we made it this far we will jump the nib y and "grab" it // this way we only need to click once to jump+scroll State |= SLIDER_GRAB; SetPosForY(y - GetFrameHeight(IE_GUI_SCROLLBAR_UP_UNPRESSED)); }
void GUI_PopupButton::SetDescriptor(const string& inDesc) { GUI_Control::SetDescriptor(inDesc); mItems.clear(); string::const_iterator b, e; b = inDesc.begin(); while (b != inDesc.end()) { e = b; while (e != inDesc.end() && *e != '\n') ++e; mItems.push_back(string(b,e)); if (e != inDesc.end()) ++e; b = e; } SetMax(mItems.size()); if (GetValue() > GetMax()) SetValue(GetMax()); Refresh(); }
PRBool nsSMILTimedElement::SetAttr(nsIAtom* aAttribute, const nsAString& aValue, nsAttrValue& aResult, nsresult* aParseResult) { PRBool foundMatch = PR_TRUE; nsresult parseResult = NS_OK; if (aAttribute == nsGkAtoms::begin) { parseResult = SetBeginSpec(aValue); } else if (aAttribute == nsGkAtoms::dur) { parseResult = SetSimpleDuration(aValue); } else if (aAttribute == nsGkAtoms::end) { parseResult = SetEndSpec(aValue); } else if (aAttribute == nsGkAtoms::fill) { parseResult = SetFillMode(aValue); } else if (aAttribute == nsGkAtoms::max) { parseResult = SetMax(aValue); } else if (aAttribute == nsGkAtoms::min) { parseResult = SetMin(aValue); } else if (aAttribute == nsGkAtoms::repeatCount) { parseResult = SetRepeatCount(aValue); } else if (aAttribute == nsGkAtoms::repeatDur) { parseResult = SetRepeatDur(aValue); } else if (aAttribute == nsGkAtoms::restart) { parseResult = SetRestart(aValue); } else { foundMatch = PR_FALSE; } if (foundMatch) { aResult.SetTo(aValue); if (aParseResult) { *aParseResult = parseResult; } } return foundMatch; }
bool wxTimeSpinCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style, const wxString &name) { wxControl::Create(parent, id, pos, size, style & ~(wxSP_WRAP | wxSP_ARROW_KEYS), wxDefaultValidator, name); SetFont(parent->GetFont()); m_spn = new wxSpinButton(this, CTRLID_SPN, wxDefaultPosition, wxDefaultSize, wxSP_WRAP | wxSP_VERTICAL | (style & wxSP_ARROW_KEYS)); wxSize cs = GetClientSize(); wxSize ss = m_spn->GetBestSize(); m_txt = new wxTextCtrl(this, CTRLID_TXT, wxEmptyString, wxPoint(0, 0), wxSize(cs.x - ss.x, cs.y), wxWANTS_CHARS); m_txt->Connect(wxID_ANY, wxID_ANY, wxEVT_KEY_DOWN, wxKeyEventHandler(wxTimeSpinCtrl::OnEditKey), 0, this); m_txt->Connect(wxID_ANY, wxID_ANY, wxEVT_KILL_FOCUS, wxFocusEventHandler(wxTimeSpinCtrl::OnKillFocus), 0, this); wxArrayString valArray; wxChar c; for (c = '0'; c <= '9'; c++) valArray.Add(wxString(c, 1)); valArray.Add(wxT(":")); wxTextValidator tv(wxFILTER_INCLUDE_CHAR_LIST); tv.SetIncludes(valArray); m_txt->SetValidator(tv); m_spn->SetSize(ss.x, cs.y); m_spn->SetPosition(wxPoint(cs.x - ss.x, 0)); canWrap = (style & wxSP_WRAP) != 0; SetMax(24 * 60 * 60 - 1); SetInitialSize(size); return true; }
//Animation Timeline AnimationTimeline::AnimationTimeline( ResourceManager* mgr, unsigned int ID, RectangleF const& location, Resource sprite, unsigned int backcolor, float rotation, bool visible, unsigned int flags, ObjectsContainer* parent, bool update ) : GUIProgress(mgr, ID, location, sprite, backcolor, rotation, visible, flags, parent, update) { m_type |= OBJECT_TYPE_ANITIMELINE; m_flags |= OBJECT_Flag_PTypeSlider; paused = true; cframe = 0; maxframes = 300; fps = 20; m_markercol = 0xFFFF000F; sel = 0; animtype = 0; SetMax((float)maxframes); if(ID != 10) { if(Game->timeline != 0) { QueueForDelete(); } else { Game->timeline = this; } } }
void Item::SetMaxAmount( Event *ev ) { SetMax( ev->GetInteger( 1 ) ); }
void AnimationTimeline::SetMaxFrames(unsigned int frames) { maxframes = frames; SetMax((float)maxframes); }
void Spinner::SetRange(int32 min, int32 max) { SetMin(min); SetMax(max); }
void avtVectorGlyphMapper::CustomizeMappers(void) { if (setMin) { SetMin(min); } else { SetMinOff(); } if (setMax) { SetMax(max); } else { SetMaxOff(); } // // It is probable that the mappers defaults did not actually get set, so // explicitly do that here. // SetMappersMinMax(); if (glyphFilter != NULL) { for (int i = 0 ; i < nGlyphFilters ; i++) { if (glyphFilter[i] != NULL) { glyphFilter[i]->SetSourceConnection(glyph); if (scaleByMagnitude) glyphFilter[i]->SetScaleModeToScaleByVector(); else glyphFilter[i]->SetScaleModeToDataScalingOff(); if (GetInput()->GetInfo().GetAttributes().GetSpatialDimension() == 2) glyphFilter[i]->SetTreatVectorsAs2D(1); } if (normalsFilter[i] != NULL) { normalsFilter[i]->SetNormalTypeToCell(); } } } if (colorByMag) { ColorByMagOn(); } else if (colorByScalar) { ColorByScalarOn(scalarName); } else { ColorByMagOff(glyphColor); } for (int i = 0; i < nMappers; i++) { if (actors[i] != NULL) { mappers[i]->SetLookupTable(lut); vtkProperty *prop = actors[i]->GetProperty(); prop->SetLineStipplePattern(LineStyle2StipplePattern(lineStyle)); prop->SetLineWidth(LineWidth2Int(lineWidth)); } } SetScale(scale); SetDefaultRange(); }
Maths::Maths() { SetMax(0); }
Maths::Maths(unsigned int max) { SetMax(max); }
void ContourAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("ContourAttributes"); if(searchNode == 0) return; DataNode *node; // Set the default palette from the values in the DataNode. if((node = searchNode->GetNode("defaultPalette")) != 0) defaultPalette.SetFromNode(node); 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("legendFlag")) != 0) SetLegendFlag(node->AsBool()); if((node = searchNode->GetNode("invertColorTable")) != 0) SetInvertColorTable(node->AsBool()); if((node = searchNode->GetNode("lineStyle")) != 0) SetLineStyle(node->AsInt()); if((node = searchNode->GetNode("lineWidth")) != 0) SetLineWidth(node->AsInt()); if((node = searchNode->GetNode("singleColor")) != 0) singleColor.SetFromNode(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(Select_by(ival)); } else if(node->GetNodeType() == STRING_NODE) { Select_by value; if(Select_by_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(Scaling(ival)); } else if(node->GetNodeType() == STRING_NODE) { Scaling value; if(Scaling_FromString(node->AsString(), value)) SetScaling(value); } } if((node = searchNode->GetNode("wireframe")) != 0) SetWireframe(node->AsBool()); }
void SurfaceAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("SurfaceAttributes"); if(searchNode == 0) return; DataNode *node; if((node = searchNode->GetNode("legendFlag")) != 0) SetLegendFlag(node->AsBool()); if((node = searchNode->GetNode("lightingFlag")) != 0) SetLightingFlag(node->AsBool()); if((node = searchNode->GetNode("surfaceFlag")) != 0) SetSurfaceFlag(node->AsBool()); if((node = searchNode->GetNode("wireframeFlag")) != 0) SetWireframeFlag(node->AsBool()); 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("colorByZFlag")) != 0) SetColorByZFlag(node->AsBool()); 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 < 3) SetScaling(Scaling(ival)); } else if(node->GetNodeType() == STRING_NODE) { Scaling value; if(Scaling_FromString(node->AsString(), value)) SetScaling(value); } } if((node = searchNode->GetNode("lineStyle")) != 0) SetLineStyle(node->AsInt()); if((node = searchNode->GetNode("lineWidth")) != 0) SetLineWidth(node->AsInt()); if((node = searchNode->GetNode("surfaceColor")) != 0) surfaceColor.SetFromNode(node); if((node = searchNode->GetNode("wireframeColor")) != 0) wireframeColor.SetFromNode(node); if((node = searchNode->GetNode("skewFactor")) != 0) SetSkewFactor(node->AsDouble()); if((node = searchNode->GetNode("min")) != 0) SetMin(node->AsDouble()); if((node = searchNode->GetNode("max")) != 0) SetMax(node->AsDouble()); if((node = searchNode->GetNode("colorTableName")) != 0) SetColorTableName(node->AsString()); if((node = searchNode->GetNode("invertColorTable")) != 0) SetInvertColorTable(node->AsBool()); }
void SurfaceFilterAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("SurfaceFilterAttributes"); if(searchNode == 0) return; DataNode *node; 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("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 < 3) SetScaling(Scaling(ival)); } else if(node->GetNodeType() == STRING_NODE) { Scaling value; if(Scaling_FromString(node->AsString(), value)) SetScaling(value); } } if((node = searchNode->GetNode("skewFactor")) != 0) SetSkewFactor(node->AsDouble()); if((node = searchNode->GetNode("min")) != 0) SetMin(node->AsDouble()); if((node = searchNode->GetNode("max")) != 0) SetMax(node->AsDouble()); if((node = searchNode->GetNode("zeroFlag")) != 0) SetZeroFlag(node->AsBool()); if((node = searchNode->GetNode("variable")) != 0) SetVariable(node->AsString()); if((node = searchNode->GetNode("useXYLimits")) != 0) SetUseXYLimits(node->AsBool()); if((node = searchNode->GetNode("generateNodalOutput")) != 0) SetGenerateNodalOutput(node->AsBool()); }
void VectorAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("VectorAttributes"); if(searchNode == 0) return; DataNode *node; if((node = searchNode->GetNode("glyphLocation")) != 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) SetGlyphLocation(GlyphLocation(ival)); } else if(node->GetNodeType() == STRING_NODE) { GlyphLocation value; if(GlyphLocation_FromString(node->AsString(), value)) SetGlyphLocation(value); } } if((node = searchNode->GetNode("useStride")) != 0) SetUseStride(node->AsBool()); if((node = searchNode->GetNode("stride")) != 0) SetStride(node->AsInt()); if((node = searchNode->GetNode("nVectors")) != 0) SetNVectors(node->AsInt()); if((node = searchNode->GetNode("lineStyle")) != 0) SetLineStyle(node->AsInt()); if((node = searchNode->GetNode("lineWidth")) != 0) SetLineWidth(node->AsInt()); if((node = searchNode->GetNode("scale")) != 0) SetScale(node->AsDouble()); if((node = searchNode->GetNode("scaleByMagnitude")) != 0) SetScaleByMagnitude(node->AsBool()); if((node = searchNode->GetNode("autoScale")) != 0) SetAutoScale(node->AsBool()); if((node = searchNode->GetNode("headSize")) != 0) SetHeadSize(node->AsDouble()); if((node = searchNode->GetNode("headOn")) != 0) SetHeadOn(node->AsBool()); if((node = searchNode->GetNode("colorByMag")) != 0) SetColorByMag(node->AsBool()); if((node = searchNode->GetNode("useLegend")) != 0) SetUseLegend(node->AsBool()); if((node = searchNode->GetNode("vectorColor")) != 0) vectorColor.SetFromNode(node); if((node = searchNode->GetNode("colorTableName")) != 0) SetColorTableName(node->AsString()); if((node = searchNode->GetNode("invertColorTable")) != 0) SetInvertColorTable(node->AsBool()); if((node = searchNode->GetNode("vectorOrigin")) != 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) SetVectorOrigin(OriginType(ival)); } else if(node->GetNodeType() == STRING_NODE) { OriginType value; if(OriginType_FromString(node->AsString(), value)) SetVectorOrigin(value); } } if((node = searchNode->GetNode("minFlag")) != 0) SetMinFlag(node->AsBool()); if((node = searchNode->GetNode("maxFlag")) != 0) SetMaxFlag(node->AsBool()); 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("min")) != 0) SetMin(node->AsDouble()); if((node = searchNode->GetNode("max")) != 0) SetMax(node->AsDouble()); if((node = searchNode->GetNode("lineStem")) != 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) SetLineStem(LineStem(ival)); } else if(node->GetNodeType() == STRING_NODE) { LineStem value; if(LineStem_FromString(node->AsString(), value)) SetLineStem(value); } } if((node = searchNode->GetNode("geometryQuality")) != 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) SetGeometryQuality(Quality(ival)); } else if(node->GetNodeType() == STRING_NODE) { Quality value; if(Quality_FromString(node->AsString(), value)) SetGeometryQuality(value); } } if((node = searchNode->GetNode("stemWidth")) != 0) SetStemWidth(node->AsDouble()); if((node = searchNode->GetNode("origOnly")) != 0) SetOrigOnly(node->AsBool()); if((node = searchNode->GetNode("glyphType")) != 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) SetGlyphType(GlyphType(ival)); } else if(node->GetNodeType() == STRING_NODE) { GlyphType value; if(GlyphType_FromString(node->AsString(), value)) SetGlyphType(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()); }