Use graphics to display preview of plots
This commit is contained in:
parent
771df71108
commit
b58965c823
@ -9,6 +9,8 @@ using System.Windows.Forms;
|
|||||||
using VEPROMS.CSLA.Library;
|
using VEPROMS.CSLA.Library;
|
||||||
using XYPlots;
|
using XYPlots;
|
||||||
using DevComponents.DotNetBar;
|
using DevComponents.DotNetBar;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using VG;
|
||||||
|
|
||||||
namespace Volian.Controls.Library
|
namespace Volian.Controls.Library
|
||||||
{
|
{
|
||||||
@ -552,6 +554,7 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
else if (selectedChld.type == 4) // x/y plot
|
else if (selectedChld.type == 4) // x/y plot
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
//PreviewMultiLineRO pmlROTable = new PreviewMultiLineRO(selectedChld.value, selectedChld.title);
|
//PreviewMultiLineRO pmlROTable = new PreviewMultiLineRO(selectedChld.value, selectedChld.title);
|
||||||
//pmlROTable.ShowDialog(); // This will show the graph commands
|
//pmlROTable.ShowDialog(); // This will show the graph commands
|
||||||
this.Cursor = Cursors.WaitCursor;
|
this.Cursor = Cursors.WaitCursor;
|
||||||
@ -562,7 +565,10 @@ namespace Volian.Controls.Library
|
|||||||
pdfname += "\\" + selectedChld.appid + ".pdf";
|
pdfname += "\\" + selectedChld.appid + ".pdf";
|
||||||
//if (File.Exists(pdfname))
|
//if (File.Exists(pdfname))
|
||||||
// File.Delete(pdfname);
|
// File.Delete(pdfname);
|
||||||
XYPlot ROGraph = new XYPlot(selectedChld.value, pdfname);
|
XYPlot ROGraph = new XYPlot(selectedChld.value);
|
||||||
|
VGOut_C1PDF pdf = VGOut_C1PDF.Create();
|
||||||
|
ROGraph.Process(pdf);
|
||||||
|
pdf.Save(pdfname);
|
||||||
this.Cursor = Cursors.Default;
|
this.Cursor = Cursors.Default;
|
||||||
|
|
||||||
// Run an internet browser window
|
// Run an internet browser window
|
||||||
@ -578,6 +584,9 @@ namespace Volian.Controls.Library
|
|||||||
// wait for a one minute max
|
// wait for a one minute max
|
||||||
if (!WaitToDeleteFile(pdfname,1))
|
if (!WaitToDeleteFile(pdfname,1))
|
||||||
MessageBox.Show(string.Format("The PDF viewer was holding this file open: \n\n{0}",pdfname),"Cannot Delete Temporary File");
|
MessageBox.Show(string.Format("The PDF viewer was holding this file open: \n\n{0}",pdfname),"Cannot Delete Temporary File");
|
||||||
|
*/
|
||||||
|
frmXYPlot plot = new frmXYPlot(selectedChld.appid + " - " + selectedChld.title, selectedChld.value);
|
||||||
|
plot.Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void ProgressBar_Initialize(int max, string desc)
|
private void ProgressBar_Initialize(int max, string desc)
|
||||||
@ -654,164 +663,186 @@ namespace Volian.Controls.Library
|
|||||||
//if (DoCaret) s2 = s2.Replace("^", @"\u916");
|
//if (DoCaret) s2 = s2.Replace("^", @"\u916");
|
||||||
outstr = outstr.Replace("^", @"\u916");
|
outstr = outstr.Replace("^", @"\u916");
|
||||||
|
|
||||||
outstr = ConvertDOSSuperAndSubScripts(outstr);
|
// OLD: This function is now handled in the ConvertFortranFormatToScienctificNotation
|
||||||
|
//outstr = ConvertDOSSuperAndSubScripts(outstr);
|
||||||
|
|
||||||
outstr = ConvertFortranFormatToScienctificNotation(outstr);
|
outstr = ConvertFortranFormatToScienctificNotation(outstr);
|
||||||
|
|
||||||
return outstr;
|
return outstr;
|
||||||
}
|
}
|
||||||
private string ConvertFortranFormatToScienctificNotation(string str)
|
//public static string ConvertFortranFormatToScienctificNotation(string str)
|
||||||
{
|
//{
|
||||||
string outstr = "";
|
// string outstr = "";
|
||||||
int orglen = str.Length;
|
// int orglen = str.Length;
|
||||||
int cnt = 0;
|
// int cnt = 0;
|
||||||
int ptr;
|
// int ptr;
|
||||||
|
|
||||||
int nbytes;
|
// int nbytes;
|
||||||
int tstr, tstr2, rptr, start = 0;
|
// int tstr, tstr2, rptr, start = 0;
|
||||||
|
|
||||||
while (cnt < orglen)
|
// while (cnt < orglen)
|
||||||
|
// {
|
||||||
|
// // position up to the the next number, sign, or period
|
||||||
|
// ptr = str.IndexOfAny("+-0123456789.".ToCharArray(), cnt);
|
||||||
|
// if (ptr == -1)
|
||||||
|
// {
|
||||||
|
// outstr += str.Substring(cnt);
|
||||||
|
// break; // jump out of while loop - nothing else to process
|
||||||
|
// }
|
||||||
|
// if ((ptr - cnt) > 0)
|
||||||
|
// {
|
||||||
|
// outstr += str.Substring(cnt, ptr - cnt);
|
||||||
|
// cnt = ptr;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (cnt > start && str[cnt - 1] == '\'')
|
||||||
|
// {
|
||||||
|
// //B2003-053: only remove the single quote character
|
||||||
|
// // if str ptr is not at the end of the string or
|
||||||
|
// // the next char (after the str ptr) is not a space
|
||||||
|
// // or newline... (as per Paul Linn on 7/17/03)
|
||||||
|
// int len = orglen - cnt;
|
||||||
|
// if (len <= 1 || str[cnt + 1] == ' ' || str[cnt + 1] == '\n')
|
||||||
|
// start = cnt;
|
||||||
|
// else
|
||||||
|
// start = cnt - 1;
|
||||||
|
// }
|
||||||
|
// else start = cnt;
|
||||||
|
// tstr = cnt;
|
||||||
|
|
||||||
|
// //Skip preceeding signs
|
||||||
|
// if (str[cnt] == '+' || str[cnt] == '-')
|
||||||
|
// cnt++;
|
||||||
|
|
||||||
|
// cnt = NextNonNumber(str, cnt);
|
||||||
|
// if (str[cnt] == '.')
|
||||||
|
// {
|
||||||
|
// cnt = NextNonNumber(str, cnt + 1);
|
||||||
|
// if (cnt >= str.Length) //jsj bug fix
|
||||||
|
// {
|
||||||
|
// outstr += str.Substring(tstr);
|
||||||
|
// break; // jump out of while loop - nothing else to process
|
||||||
|
// }
|
||||||
|
// if (str[start] == '\'')
|
||||||
|
// {
|
||||||
|
// start++;
|
||||||
|
// }
|
||||||
|
// else if (str[cnt] == 'E' && cnt > tstr)
|
||||||
|
// {
|
||||||
|
// nbytes = (cnt - tstr); // don't include the 'E'
|
||||||
|
// outstr += str.Substring(tstr, nbytes);
|
||||||
|
// cnt++;
|
||||||
|
|
||||||
|
// rptr = outstr.Length - 1;
|
||||||
|
// while (outstr[rptr] == '0') rptr--;
|
||||||
|
// if (outstr[rptr] != '.') rptr++;
|
||||||
|
// if (rptr < (outstr.Length - 1))
|
||||||
|
// outstr = outstr.Substring(0, rptr + 1); // trim trailing 0's
|
||||||
|
// //outstr = outstr.TrimEnd(".".ToCharArray());
|
||||||
|
// int poutstr = 0;
|
||||||
|
// if (outstr[poutstr] == '+' || outstr[poutstr] == '-') poutstr++;
|
||||||
|
// if (!outstr.Substring(poutstr).Equals("1"))
|
||||||
|
// {
|
||||||
|
// outstr += "x1";
|
||||||
|
// }
|
||||||
|
// outstr += "0\\super ";
|
||||||
|
|
||||||
|
// tstr2 = cnt;
|
||||||
|
// if (str[cnt] == '+' || str[cnt] == '-') cnt++;
|
||||||
|
// cnt = NextNonNumber(str, cnt);
|
||||||
|
|
||||||
|
// if (str[cnt] == '.' && char.IsDigit(str, cnt + 1))
|
||||||
|
// cnt = NextNonNumber(str, cnt + 1);
|
||||||
|
|
||||||
|
// nbytes = cnt - tstr2; // +1;
|
||||||
|
// outstr += str.Substring(tstr2, nbytes);
|
||||||
|
// outstr += "\\nosupersub ";
|
||||||
|
|
||||||
|
// if (!char.IsLetterOrDigit(str, cnt) && !char.IsWhiteSpace(str, cnt))
|
||||||
|
// return (str.Substring(tstr));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// outstr += str.Substring(start, cnt - start + 1);
|
||||||
|
// cnt++;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return (outstr);
|
||||||
|
//}
|
||||||
|
|
||||||
|
//private static int NextNonNumber(string str, int cnt)
|
||||||
|
//{
|
||||||
|
// int rtn = 0;
|
||||||
|
// string tstr = str.Substring(cnt);
|
||||||
|
// int len = tstr.Length;
|
||||||
|
// while (rtn < len && char.IsDigit(tstr, rtn)) rtn++;
|
||||||
|
// return rtn + cnt;
|
||||||
|
//}
|
||||||
|
public static string ConvertFortranFormatToScienctificNotation(string str)
|
||||||
{
|
{
|
||||||
// position up to the the next number, sign, or period
|
// Convert E style numbers to RTF with \super and \nosupersub
|
||||||
ptr = str.IndexOfAny("+-0123456789.".ToCharArray(), cnt);
|
string retval = Regex.Replace(str, "([+-]?)([0-9]+)[.]?([0-9]*?)0*E([+-]?[0-9]+)", new MatchEvaluator(FixFortranNumber));
|
||||||
if (ptr == -1)
|
retval = Regex.Replace(retval, "[#](.*?)[#]", "\\super $1\\nosupersub ");// DOS Superscript
|
||||||
{
|
retval = Regex.Replace(retval, "[~](.*?)[~]", "\\sub $1\\nosupersub ");// DOS Subscript
|
||||||
outstr += str.Substring(cnt);
|
return retval;
|
||||||
break; // jump out of while loop - nothing else to process
|
|
||||||
}
|
}
|
||||||
if ((ptr - cnt) > 0)
|
private static string FixFortranNumber(Match match)
|
||||||
{
|
{
|
||||||
outstr += str.Substring(cnt, ptr - cnt);
|
StringBuilder sb = new StringBuilder(match.Groups[1].Value);
|
||||||
cnt = ptr;
|
if (match.Groups[3].Length == 0) // Nothing to the right of the decimal
|
||||||
|
if (match.Groups[2].Value != "1") // Other than "1", multiply it times 10 raised to a power
|
||||||
|
sb.Append(match.Groups[2].Value + "x10");
|
||||||
|
else // The number is simply 1 so it can be ignored and 10 can be raised to a power
|
||||||
|
sb.Append("10");
|
||||||
|
else // A number with a decimal point
|
||||||
|
sb.Append(match.Groups[2].Value + "." + match.Groups[3].Value + "x10");
|
||||||
|
// Add the exponent as superscript
|
||||||
|
return sb.ToString() + "\\super " + match.Groups[4].Value + "\\nosupersub ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cnt > start && str[cnt - 1] == '\'')
|
//private string ConvertDOSSuperAndSubScripts(string instr)
|
||||||
{
|
//{
|
||||||
//B2003-053: only remove the single quote character
|
// string outstr = "";
|
||||||
// if str ptr is not at the end of the string or
|
// string tstr = instr;
|
||||||
// the next char (after the str ptr) is not a space
|
// int cnt = 0;
|
||||||
// or newline... (as per Paul Linn on 7/17/03)
|
// int ptr = 0;
|
||||||
int len = orglen - cnt;
|
// bool issupper=false, issub = false;
|
||||||
if (len <= 1 || str[cnt + 1] == ' ' || str[cnt + 1] == '\n')
|
|
||||||
start = cnt;
|
|
||||||
else
|
|
||||||
start = cnt - 1;
|
|
||||||
}
|
|
||||||
else start = cnt;
|
|
||||||
tstr = cnt;
|
|
||||||
|
|
||||||
//Skip preceeding signs
|
// while (tstr != null && (ptr = tstr.IndexOfAny("#~".ToCharArray(), cnt)) >= 0)
|
||||||
if (str[cnt] == '+' || str[cnt] == '-')
|
// {
|
||||||
cnt++;
|
// if (ptr > cnt)
|
||||||
|
// outstr += tstr.Substring(cnt, ptr - cnt);
|
||||||
cnt = NextNonNumber(str, cnt);
|
// switch (tstr[ptr])
|
||||||
if (str[cnt] == '.')
|
// {
|
||||||
{
|
// case '#':
|
||||||
cnt = NextNonNumber(str, cnt + 1);
|
// if (issub || issupper)
|
||||||
if (cnt >= str.Length) //jsj bug fix
|
// outstr += "\\nosupersub ";
|
||||||
{
|
// else
|
||||||
outstr += str.Substring(tstr);
|
// outstr += "\\super ";
|
||||||
break; // jump out of while loop - nothing else to process
|
// issupper = !issupper;
|
||||||
}
|
// issub = false;
|
||||||
if (str[start] == '\'')
|
// break;
|
||||||
{
|
// case '~':
|
||||||
start++;
|
// if (issupper || issub)
|
||||||
}
|
// outstr += "\\nosupersub ";
|
||||||
else if (str[cnt] == 'E' && cnt > tstr)
|
// else
|
||||||
{
|
// outstr += "\\sub ";
|
||||||
nbytes = (cnt - tstr); // don't include the 'E'
|
// issub = !issub;
|
||||||
outstr += str.Substring(tstr, nbytes);
|
// issupper = false;
|
||||||
cnt++;
|
// break;
|
||||||
|
// }
|
||||||
rptr = outstr.Length - 1;
|
// cnt = ptr + 1;
|
||||||
while (outstr[rptr] == '0') rptr--;
|
// if (cnt >= tstr.Length)
|
||||||
if (outstr[rptr] != '.') rptr++;
|
// tstr = null;
|
||||||
if (rptr < (outstr.Length - 1))
|
// else
|
||||||
outstr = outstr.Substring(0, rptr + 1); // trim trailing 0's
|
// tstr = instr.Substring(cnt);
|
||||||
|
// cnt = 0;
|
||||||
int poutstr = 0;
|
// }
|
||||||
if (outstr[poutstr] == '+' || outstr[poutstr] == '-') poutstr++;
|
// if (tstr != null)
|
||||||
if (!outstr[poutstr].Equals("1"))
|
// outstr += tstr;
|
||||||
{
|
// return outstr;
|
||||||
outstr += "x1";
|
//}
|
||||||
}
|
|
||||||
outstr += "0\\super ";
|
|
||||||
|
|
||||||
tstr2 = cnt;
|
|
||||||
if (str[cnt] == '+' || str[cnt] == '-') cnt++;
|
|
||||||
cnt = NextNonNumber(str, cnt);
|
|
||||||
|
|
||||||
if (str[cnt] == '.' && char.IsDigit(str, cnt + 1))
|
|
||||||
cnt = NextNonNumber(str, cnt + 1);
|
|
||||||
|
|
||||||
nbytes = cnt - tstr2; // +1;
|
|
||||||
outstr += str.Substring(tstr2, nbytes);
|
|
||||||
outstr += "\\nosupersub ";
|
|
||||||
|
|
||||||
if (!char.IsLetterOrDigit(str, cnt) && !char.IsWhiteSpace(str, cnt))
|
|
||||||
return (str.Substring(tstr));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
outstr += str.Substring(start, cnt - start + 1);
|
|
||||||
cnt++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (outstr);
|
|
||||||
}
|
|
||||||
|
|
||||||
private int NextNonNumber(string str, int cnt)
|
|
||||||
{
|
|
||||||
int rtn = 0;
|
|
||||||
string tstr = str.Substring(cnt);
|
|
||||||
int len = tstr.Length;
|
|
||||||
while (rtn < len && char.IsDigit(tstr,rtn)) rtn++;
|
|
||||||
return rtn + cnt;
|
|
||||||
}
|
|
||||||
|
|
||||||
private string ConvertDOSSuperAndSubScripts(string instr)
|
|
||||||
{
|
|
||||||
string outstr = "";
|
|
||||||
string tstr = instr;
|
|
||||||
int cnt = 0;
|
|
||||||
int ptr = 0;
|
|
||||||
bool issupper=false, issub = false;
|
|
||||||
|
|
||||||
while (tstr != null && (ptr = tstr.IndexOfAny("#~".ToCharArray(), cnt)) >= 0)
|
|
||||||
{
|
|
||||||
if (ptr > cnt)
|
|
||||||
outstr += tstr.Substring(cnt, ptr - cnt);
|
|
||||||
switch (tstr[ptr])
|
|
||||||
{
|
|
||||||
case '#':
|
|
||||||
if (issub || issupper)
|
|
||||||
outstr += "\\nosupersub ";
|
|
||||||
else
|
|
||||||
outstr += "\\super ";
|
|
||||||
issupper = !issupper;
|
|
||||||
issub = false;
|
|
||||||
break;
|
|
||||||
case '~':
|
|
||||||
if (issupper || issub)
|
|
||||||
outstr += "\\nosupersub ";
|
|
||||||
else
|
|
||||||
outstr += "\\sub ";
|
|
||||||
issub = !issub;
|
|
||||||
issupper = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
cnt = ptr + 1;
|
|
||||||
if (cnt >= tstr.Length)
|
|
||||||
tstr = null;
|
|
||||||
else
|
|
||||||
tstr = instr.Substring(cnt);
|
|
||||||
cnt = 0;
|
|
||||||
}
|
|
||||||
if (tstr != null)
|
|
||||||
outstr += tstr;
|
|
||||||
return outstr;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string _TemporaryFolder = null;
|
private static string _TemporaryFolder = null;
|
||||||
public static string TemporaryFolder
|
public static string TemporaryFolder
|
||||||
|
Loading…
x
Reference in New Issue
Block a user