public ExportSettingsDialog(ExportSettings settings, NuGenDocument doc, List<string> includedCurves, List<string> excludedCurves) { this.settings = settings; this.includedCurves = includedCurves; this.excludedCurves = excludedCurves; this.pointsets = doc.PointSets; this.coordSettings = doc.CoordSettings; this.gridSettings = doc.GridDisplaySettings; InitializeComponent(); InitializeDefaults(); this.MaximumSize = Size; }
// export this pointset with one x-y pair on each line. header and footer are handled elsewhere. // the x and y values will be exported with their respective numeric precisions public string ExportCurveAll(ExportSettings xport, int xPrecision, int yPrecision) { string rtn = ""; // if this curve is a function, then skip points whose exported x value is the same // as the previous point so the output can be imported into any sql database that // requires unique x values string xLast = "", xNew = "", yNew = ""; foreach (NuGenPoint p in points) { xNew = Math.Round(p.XThetaGraph, xPrecision).ToString(); yNew = Math.Round(p.YRGraph, yPrecision).ToString(); string delim; switch (xport.delimiters) { case ExportDelimiters.Commas: delim = ","; break; case ExportDelimiters.Spaces: delim = " "; break; case ExportDelimiters.Tabs: delim = "\t"; break; default: delim = ""; break; } if ((xLast != xNew) || (style.lineConnectAs != LineConnectAs.SingleValuedFunction)) { rtn += xNew; rtn += delim; rtn += yNew; rtn += "\n"; } xLast = xNew; } return rtn; }
// return the name of this pointset, filtering out any embedded delimiters for easier parsing // downstream (which would be performed by external applications) public string ExportCurveHeader(ExportSettings xport) { return name.Replace(xport.GetDelimiter(), ""); }