void avtContourPlot::SetAtts(const AttributeGroup *a) { needsRecalculation = atts.ChangesRequireRecalculation(*(const ContourAttributes*)a); atts = *(const ContourAttributes*)a; if (atts.GetContourMethod() == ContourAttributes::Level) { numLevels = atts.GetContourNLevels(); } else if (atts.GetContourMethod() == ContourAttributes::Value) { numLevels = (int)atts.GetContourValue().size(); } else { numLevels = (int)atts.GetContourPercent().size(); } SetColors(); SetLineWidth(atts.GetLineWidth()); SetLineStyle(atts.GetLineStyle()); SetLegend(atts.GetLegendFlag()); if (atts.GetWireframe()) { behavior->SetAntialiasedRenderOrder(ABSOLUTELY_LAST); levelsMapper->SetSpecularIsInappropriate(true); } else { behavior->SetAntialiasedRenderOrder(DOES_NOT_MATTER); levelsMapper->SetSpecularIsInappropriate(false); } }
void avtCurvePlot::SetAtts(const AttributeGroup *a) { needsRecalculation = atts.ChangesRequireRecalculation(*(const CurveAttributes*)a); atts = *(const CurveAttributes*)a; double rgba[4]; atts.GetCurveColor().GetRgba(rgba); curveLegend->SetColor(rgba); if (atts.GetShowLegend()) { curveLegend->LegendOn(); } else { curveLegend->LegendOff(); } SetLineWidth(atts.GetLineWidth()); SetLineStyle(atts.GetLineStyle()); decoMapper->SetLabelColor(rgba); decoMapper->SetLabelVisibility(atts.GetShowLabels()); renderer->SetAtts(atts); behavior->GetInfo().GetAttributes().SetWindowMode(WINMODE_CURVE); }
NS_IMETHODIMP nsRenderingContextQt::PopState() { GraphicsState *state; PRUint32 cnt = mStateCache.Count(); if (cnt > 0) { state = (GraphicsState*)mStateCache.ElementAt(cnt - 1); mStateCache.RemoveElementAt(cnt - 1); // Assign all local attributes from the state object just popped if (state->mMatrix) { delete mTranMatrix; mTranMatrix = state->mMatrix; } mClipRegion.swap(state->mClipRegion); if (state->mColor != mCurrentColor) SetColor(state->mColor); if (state->mLineStyle != mCurrentLineStyle) SetLineStyle(state->mLineStyle); if (state->mFontMetrics && (mFontMetrics != state->mFontMetrics)) SetFont(state->mFontMetrics); // Delete this graphics state object #ifdef USE_GS_POOL nsGraphicsStatePool::ReleaseGS(state); #else delete state; #endif } return NS_OK; }
void MultiCurveAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("MultiCurveAttributes"); 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 < 2) SetColorType(ColoringMethod(ival)); } else if(node->GetNodeType() == STRING_NODE) { ColoringMethod value; if(ColoringMethod_FromString(node->AsString(), value)) SetColorType(value); } } if((node = searchNode->GetNode("singleColor")) != 0) singleColor.SetFromNode(node); if((node = searchNode->GetNode("multiColor")) != 0) multiColor.SetFromNode(node); if((node = searchNode->GetNode("lineStyle")) != 0) SetLineStyle(node->AsInt()); if((node = searchNode->GetNode("lineWidth")) != 0) SetLineWidth(node->AsInt()); if((node = searchNode->GetNode("yAxisTitleFormat")) != 0) SetYAxisTitleFormat(node->AsString()); if((node = searchNode->GetNode("useYAxisTickSpacing")) != 0) SetUseYAxisTickSpacing(node->AsBool()); if((node = searchNode->GetNode("yAxisTickSpacing")) != 0) SetYAxisTickSpacing(node->AsDouble()); if((node = searchNode->GetNode("displayMarkers")) != 0) SetDisplayMarkers(node->AsBool()); if((node = searchNode->GetNode("markerVariable")) != 0) SetMarkerVariable(node->AsString()); if((node = searchNode->GetNode("displayIds")) != 0) SetDisplayIds(node->AsBool()); if((node = searchNode->GetNode("idVariable")) != 0) SetIdVariable(node->AsString()); if((node = searchNode->GetNode("legendFlag")) != 0) SetLegendFlag(node->AsBool()); }
void CArcUnit::ErasedDraw(CDC *memDC,DataInfo &pDataInfo, HRGN ErasedRgn) { CRect rect; CPoint sPoint,ePoint; int Red,Green,Blue; Red=GetRValue(pDataInfo.penColor); Green=GetGValue(pDataInfo.penColor); Blue=GetBValue(pDataInfo.penColor); sPoint=CaculatePoint(pDataInfo.StartPoint,pDataInfo); ePoint=CaculatePoint(pDataInfo.EndPoint,pDataInfo); Graphics mGraphics(memDC->m_hDC); /////////////////////////////////// Matrix matrix; Region tRgn; Region *ptRgn=tRgn.FromHRGN(ErasedRgn); mGraphics.ExcludeClip(ptRgn); matrix.Reset(); delete ptRgn; //////////////////////////////////// mGraphics.TranslateTransform(pDataInfo.CenterPoint.x,pDataInfo.CenterPoint.y); mGraphics.RotateTransform(pDataInfo.RotateAngle); mGraphics.SetSmoothingMode(SmoothingModeAntiAlias); Pen mPen(Color(255,Red,Green,Blue),pDataInfo.penWidth); SetLineStyle(mPen,pDataInfo.LineStyle); if(int(pDataInfo.startAngle)==270&&int(pDataInfo.sweepAngle)==90) { rect.left=2*sPoint.x-ePoint.x; rect.top=sPoint.y; rect.right=ePoint.x; rect.bottom=2*ePoint.y-sPoint.y; } if(int(pDataInfo.startAngle)==270&&int(pDataInfo.sweepAngle)==-90) { rect.left=sPoint.x; rect.top=sPoint.y; rect.right=2*ePoint.x-sPoint.x; rect.bottom=2*ePoint.y-sPoint.y; } if(int(pDataInfo.startAngle)==90&&int(pDataInfo.sweepAngle)==90) { rect.left=sPoint.x; rect.top=2*sPoint.y-ePoint.y; rect.right=2*ePoint.x-sPoint.x; rect.bottom=ePoint.y; } if(int(pDataInfo.startAngle)==90&&int(pDataInfo.sweepAngle)==-90) { rect.left=2*sPoint.x-ePoint.x; rect.top=2*sPoint.y-ePoint.y; rect.right=ePoint.x; rect.bottom=ePoint.y; } mGraphics.DrawArc(&mPen,rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,pDataInfo.startAngle,pDataInfo.sweepAngle); mGraphics.ResetTransform(); }
void avtTopologyPlot::SetColors() { std::vector < std::string > labels(4); LevelColorMap levelColorMap; labels[0] = avtTopologyFilter::labelNames[0]; labels[1] = avtTopologyFilter::labelNames[1]; labels[2] = avtTopologyFilter::labelNames[2]; labels[3] = avtTopologyFilter::labelNames[3]; ColorAttributeList cal(atts.GetMultiColor()); int numColors = cal.GetNumColors(); // // Create colors from original color table. // unsigned char *colors = new unsigned char[numColors * 4]; unsigned char *cptr = colors; for(int i = 0; i < numColors; i++) { cal[i].SetAlpha((unsigned char)(255 * opacity[i])); *cptr++ = (unsigned char)cal[i].Red(); *cptr++ = (unsigned char)cal[i].Green(); *cptr++ = (unsigned char)cal[i].Blue(); *cptr++ = (unsigned char)cal[i].Alpha(); // // Create a label-to-color-index mapping // levelColorMap.insert(LevelColorMap::value_type(labels[i], i)); } avtLUT->SetLUTColorsWithOpacity(colors, numColors); levelsMapper->SetColors(cal, needsRecalculation); levelsLegend->SetLevels(labels); levelsMapper->SetLabelColorMap(levelColorMap); levelsLegend->SetLabelColorMap(levelColorMap); delete [] colors; SetLineWidth(atts.GetLineWidth()); SetLineStyle(atts.GetLineStyle()); }
void CArcUnit::ReDraw(CDC* memDC,DataInfo &pDataInfo) { CPoint sPoint,ePoint; int Red,Green,Blue; Red=GetRValue(pDataInfo.penColor); Green=GetGValue(pDataInfo.penColor); Blue=GetBValue(pDataInfo.penColor); sPoint=CaculatePoint(pDataInfo.StartPoint,pDataInfo); ePoint=CaculatePoint(pDataInfo.EndPoint,pDataInfo); Graphics mGraphics(memDC->m_hDC); mGraphics.TranslateTransform(pDataInfo.CenterPoint.x,pDataInfo.CenterPoint.y); mGraphics.RotateTransform(pDataInfo.RotateAngle); mGraphics.SetSmoothingMode(SmoothingModeAntiAlias); mGraphics.ScaleTransform(pDataInfo.xScale,pDataInfo.yScale); /////////////////////////////////// Region tRgn; Region *ptRgn=tRgn.FromHRGN(pDataInfo.hRgn); if(ptRgn != NULL) mGraphics.ExcludeClip(ptRgn); delete ptRgn; //////////////////////////////////// Pen mPen(Color(255,Red,Green,Blue),pDataInfo.penWidth); SetLineStyle(mPen,pDataInfo.LineStyle); float dx,dy; dx=ePoint.x-sPoint.y; dy=ePoint.y-sPoint.y; CPoint ptCenter,ptRadius; ptCenter.x=sPoint.x+dx*pDataInfo.AllRate[0].xRate; ptCenter.y=sPoint.y+dy*pDataInfo.AllRate[0].yRate; ptRadius.x=sPoint.x+dx*pDataInfo.AllRate[1].xRate; ptRadius.y=sPoint.y+dy*pDataInfo.AllRate[1].yRate; dx=ptRadius.x-ptCenter.x; dy=ptRadius.y-ptCenter.y; float Radius=sqrt(dx*dx+dy*dy); CRect rect(ptCenter.x-Radius,ptCenter.y-Radius,ptCenter.x+Radius,ptCenter.y+Radius); //pDataInfo.startAngle = 0; //pDataInfo.sweepAngle = 90; mGraphics.DrawArc(&mPen,rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,pDataInfo.startAngle,pDataInfo.sweepAngle); //mGraphics.DrawPie(&mPen,rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,pDataInfo.startAngle,pDataInfo.sweepAngle); mGraphics.ResetTransform(); }
void avtWellBorePlot::SetAtts(const AttributeGroup *a) { const WellBoreAttributes *newAtts = (const WellBoreAttributes *)a; needsRecalculation = atts.ChangesRequireRecalculation(*newAtts); atts = *newAtts; if (WellBoreFilter != NULL) WellBoreFilter->SetAttributes(*newAtts); if (newAtts->GetNWellBores() == 0) return; SetColors(); SetLegend(atts.GetLegendFlag()); SetLineWidth(atts.GetWellLineWidth()); SetLineStyle(atts.GetWellLineStyle()); decoMapper->SetScale(atts.GetWellNameScale()); decoMapper->SetLabelVisibility(true); }
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 CArcUnit::DrawGraphics(CDC *memDC,DataInfo &pDataInfo,CPoint ePoint) { CRect rect; CPoint sPoint; int Red,Green,Blue,dx,dy; BOOL xflag=false; BOOL yflag=false; sPoint=pDataInfo.StartPoint; if(sPoint.x>ePoint.x) { dx=sPoint.x; sPoint.x=ePoint.x; ePoint.x=dx; xflag=true; } if(sPoint.y>ePoint.y) { dy=sPoint.y; sPoint.y=ePoint.y; ePoint.y=dy; yflag=true; } if(!xflag&&!yflag) { pDataInfo.startAngle=270.0f; pDataInfo.sweepAngle=90.0f; } if(xflag&&!yflag) { pDataInfo.startAngle=270.0f; pDataInfo.sweepAngle=-90.0f; } if(xflag&&yflag) { pDataInfo.startAngle=90.0f; pDataInfo.sweepAngle=90.0f; } if(!xflag&&yflag) { pDataInfo.startAngle=90.0f; pDataInfo.sweepAngle=-90.0f; } if(int(pDataInfo.startAngle)==270&&int(pDataInfo.sweepAngle)==90) { rect.left=2*sPoint.x-ePoint.x; rect.top=sPoint.y; rect.right=ePoint.x; rect.bottom=2*ePoint.y-sPoint.y; } if(int(pDataInfo.startAngle)==270&&int(pDataInfo.sweepAngle)==-90) { rect.left=sPoint.x; rect.top=sPoint.y; rect.right=2*ePoint.x-sPoint.x; rect.bottom=2*ePoint.y-sPoint.y; } if(int(pDataInfo.startAngle)==90&&int(pDataInfo.sweepAngle)==90) { rect.left=sPoint.x; rect.top=2*sPoint.y-ePoint.y; rect.right=2*ePoint.x-sPoint.x; rect.bottom=ePoint.y; } if(int(pDataInfo.startAngle)==90&&int(pDataInfo.sweepAngle)==-90) { rect.left=2*sPoint.x-ePoint.x; rect.top=2*sPoint.y-ePoint.y; rect.right=ePoint.x; rect.bottom=ePoint.y; } Red=GetRValue(pDataInfo.penColor); Green=GetGValue(pDataInfo.penColor); Blue=GetBValue(pDataInfo.penColor); Graphics mGraphics(memDC->m_hDC); mGraphics.SetSmoothingMode(SmoothingModeAntiAlias); Pen mPen(Color(255,Red,Green,Blue),pDataInfo.penWidth); SetLineStyle(mPen,pDataInfo.LineStyle); mGraphics.DrawArc(&mPen,rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,pDataInfo.startAngle,pDataInfo.sweepAngle); }
void SubsetAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("SubsetAttributes"); if(searchNode == 0) return; DataNode *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("invertColorTable")) != 0) SetInvertColorTable(node->AsBool()); if((node = searchNode->GetNode("filledFlag")) != 0) SetFilledFlag(node->AsBool()); if((node = searchNode->GetNode("legendFlag")) != 0) SetLegendFlag(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("multiColor")) != 0) multiColor.SetFromNode(node); if((node = searchNode->GetNode("subsetNames")) != 0) SetSubsetNames(node->AsStringVector()); if((node = searchNode->GetNode("subsetType")) != 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) SetSubsetType(Subset_Type(ival)); } else if(node->GetNodeType() == STRING_NODE) { Subset_Type value; if(Subset_Type_FromString(node->AsString(), value)) SetSubsetType(value); } } if((node = searchNode->GetNode("opacity")) != 0) SetOpacity(node->AsDouble()); if((node = searchNode->GetNode("wireframe")) != 0) SetWireframe(node->AsBool()); if((node = searchNode->GetNode("drawInternal")) != 0) SetDrawInternal(node->AsBool()); if((node = searchNode->GetNode("smoothingLevel")) != 0) SetSmoothingLevel(node->AsInt()); if((node = searchNode->GetNode("pointSize")) != 0) SetPointSize(node->AsDouble()); if((node = searchNode->GetNode("pointType")) != 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 < 8) SetPointType(PointType(ival)); } else if(node->GetNodeType() == STRING_NODE) { PointType value; if(PointType_FromString(node->AsString(), value)) SetPointType(value); } } if((node = searchNode->GetNode("pointSizeVarEnabled")) != 0) SetPointSizeVarEnabled(node->AsBool()); if((node = searchNode->GetNode("pointSizeVar")) != 0) SetPointSizeVar(node->AsString()); if((node = searchNode->GetNode("pointSizePixels")) != 0) SetPointSizePixels(node->AsInt()); }
void FilledBoundaryAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("FilledBoundaryAttributes"); if(searchNode == 0) return; DataNode *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("invertColorTable")) != 0) SetInvertColorTable(node->AsBool()); if((node = searchNode->GetNode("filledFlag")) != 0) SetFilledFlag(node->AsBool()); if((node = searchNode->GetNode("legendFlag")) != 0) SetLegendFlag(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("multiColor")) != 0) multiColor.SetFromNode(node); if((node = searchNode->GetNode("boundaryNames")) != 0) SetBoundaryNames(node->AsStringVector()); if((node = searchNode->GetNode("boundaryType")) != 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) SetBoundaryType(Boundary_Type(ival)); } else if(node->GetNodeType() == STRING_NODE) { Boundary_Type value; if(Boundary_Type_FromString(node->AsString(), value)) SetBoundaryType(value); } } if((node = searchNode->GetNode("opacity")) != 0) SetOpacity(node->AsDouble()); if((node = searchNode->GetNode("wireframe")) != 0) SetWireframe(node->AsBool()); if((node = searchNode->GetNode("drawInternal")) != 0) SetDrawInternal(node->AsBool()); if((node = searchNode->GetNode("smoothingLevel")) != 0) SetSmoothingLevel(node->AsInt()); if((node = searchNode->GetNode("cleanZonesOnly")) != 0) SetCleanZonesOnly(node->AsBool()); if((node = searchNode->GetNode("mixedColor")) != 0) mixedColor.SetFromNode(node); if((node = searchNode->GetNode("pointSize")) != 0) SetPointSize(node->AsDouble()); if((node = searchNode->GetNode("pointType")) != 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 < 8) SetPointType(PointType(ival)); } else if(node->GetNodeType() == STRING_NODE) { PointType value; if(PointType_FromString(node->AsString(), value)) SetPointType(value); } } if((node = searchNode->GetNode("pointSizeVarEnabled")) != 0) SetPointSizeVarEnabled(node->AsBool()); if((node = searchNode->GetNode("pointSizeVar")) != 0) SetPointSizeVar(node->AsString()); if((node = searchNode->GetNode("pointSizePixels")) != 0) SetPointSizePixels(node->AsInt()); // We are no longer using MultiColor as the source for the "mixed" // color (in clean zones only), but someone may have saved their // settings with the "mixed" color in the list. Remove it if it's // in there. // // NOTE: This code can be removed in a few months, as soon as // 1.3 is at least a few versions old, since it represents a little // bit of a hack. bool done = false; while (!done) { done = true; size_t index; for (index=0; index<boundaryNames.size(); index++) { if (boundaryNames[index] == "mixed") { done = false; break; } } if (!done) { multiColor.RemoveColors((int)index); for (size_t i=index+1; i<boundaryNames.size(); i++) boundaryNames[i-1] = boundaryNames[i]; boundaryNames.resize(boundaryNames.size() - 1); } } }
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 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 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()); }