本文整理汇总了C#中Altaxo.Data.AltaxoVariant类的典型用法代码示例。如果您正苦于以下问题:C# AltaxoVariant类的具体用法?C# AltaxoVariant怎么用?C# AltaxoVariant使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AltaxoVariant类属于Altaxo.Data命名空间,在下文中一共展示了AltaxoVariant类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MergeYBoundsInto
public void MergeYBoundsInto(IPlotArea layer, IPhysicalBoundaries pb, PlotItemCollection coll)
{
Dictionary<G2DPlotItem, Processed2DPlotData> plotDataList;
IPhysicalBoundaries pbclone = (IPhysicalBoundaries)pb.Clone(); // before we can use CanUseStyle, we have to give physical y boundaries template
CoordinateTransformingStyleBase.MergeYBoundsInto(pbclone, coll);
if (!CanUseStyle(layer, coll, out plotDataList))
{
pb.Add(pbclone);
return;
}
// we put zero into the y-Boundaries, since the addition starts with that value
pb.Add(new AltaxoVariant(0.0));
AltaxoVariant[] ySumArray = null;
int idx = -1;
foreach (IGPlotItem pi in coll)
{
if (pi is G2DPlotItem)
{
idx++;
G2DPlotItem gpi = (G2DPlotItem)pi;
Processed2DPlotData pdata = plotDataList[gpi];
// Note: we can not use AddUp function here, since
// when we have positive/negative items, the intermediate bounds
// might be wider than the bounds of the end result
if (ySumArray == null)
{
ySumArray = new AltaxoVariant[pdata.RangeList.PlotPointCount];
int j = -1;
foreach (int originalIndex in pdata.RangeList.OriginalRowIndices())
{
j++;
ySumArray[j] = pdata.GetYPhysical(originalIndex);
pb.Add(ySumArray[j]);
}
}
else // this is not the first item
{
int j = -1;
foreach (int originalIndex in pdata.RangeList.OriginalRowIndices())
{
j++;
ySumArray[j] += pdata.GetYPhysical(originalIndex);
pb.Add(ySumArray[j]);
}
}
}
}
}
示例2: SetValueAt
// indexers
public override void SetValueAt(int i, AltaxoVariant val)
{
try
{
this[i] = val.ToDouble();
}
catch (Exception ex)
{
throw new ApplicationException(string.Format("Error: Try to set {0}[{1}] with the string {2}, exception: {3}", this.TypeAndName, i, val.ToString(), ex.Message));
}
}
示例3: GetMinorTicksAsVariant
public override AltaxoVariant[] GetMinorTicksAsVariant()
{
double[] ticks = GetMinorTicks();
AltaxoVariant[] vticks = new AltaxoVariant[ticks.Length];
for (int i = 0; i < ticks.Length; ++i)
vticks[i] = ticks[i];
return vticks;
}
示例4: AddUp
/// <summary>Adds the y-values of a plot item to an array of y-values..</summary>
/// <param name="vArray">The y array to be added to. If null, a new array will be allocated (and filled with the y-values of the plot item).</param>
/// <param name="pdata">The pdata.</param>
/// <returns>If the parameter <paramref name="vArray"/> was not null, then that <paramref name="vArray"/> is returned. Otherwise the newly allocated array is returned.</returns>
public static AltaxoVariant[] AddUp(AltaxoVariant[] vArray, Processed3DPlotData pdata)
{
if (vArray == null)
{
vArray = new AltaxoVariant[pdata.RangeList.PlotPointCount];
int j = -1;
foreach (int originalIndex in pdata.RangeList.OriginalRowIndices())
{
j++;
vArray[j] = pdata.GetZPhysical(originalIndex);
}
}
else // this is not the first item
{
int j = -1;
foreach (int originalIndex in pdata.RangeList.OriginalRowIndices())
{
j++;
vArray[j] += pdata.GetZPhysical(originalIndex);
}
}
return vArray;
}
示例5: DefaultDateTimeConverter
private string DefaultDateTimeConverter(AltaxoVariant x)
{
return ((DateTime)x).ToString("o");
}
示例6: DefaultTextConverter
private string DefaultTextConverter(AltaxoVariant x)
{
string s = x.ToString();
s = s.Replace('\r', ' ');
s = s.Replace('\n', ' ');
return s;
}
示例7: FinalProcessScaleBoundaries
/// <summary>
/// Calculates the ticks based on the org and end of the scale. Org and End now are given and can not be changed anymore.
/// </summary>
/// <param name="org">Scale origin.</param>
/// <param name="end">Scale end.</param>
/// <param name="scale">The scale.</param>
public abstract void FinalProcessScaleBoundaries(AltaxoVariant org, AltaxoVariant end, Scale scale);
示例8: FormatItem
protected override string FormatItem(AltaxoVariant item)
{
if (!string.IsNullOrEmpty(_formatString))
{
try
{
return string.Format(_formatString, item.ToObject());
}
catch (Exception)
{
}
}
return item.ToString();
}
示例9: vop_ShiftRight_Rev
public override bool vop_ShiftRight_Rev(AltaxoVariant c2, out DataColumn c3)
{
if (((AltaxoVariant)c2).IsType(AltaxoVariant.Content.VDouble))
{
DoubleColumn c1 = this;
int len = c1._count;
Altaxo.Data.DoubleColumn c33 = new Altaxo.Data.DoubleColumn(len);
long c22 = (long)(double)c2;
for (int i = 0; i < len; i++)
c33._data[i] = c22 >> ((int)c1._data[i]);
c33._count = len;
c3 = c33;
return true;
}
c3 = null;
return false;
}
示例10: vop_ShiftLeft
public override bool vop_ShiftLeft(AltaxoVariant c2, out DataColumn c3)
{
if (((AltaxoVariant)c2).IsType(AltaxoVariant.Content.VDouble))
{
int c22 = (int)(double)c2;
c3 = this << c22;
return true;
}
c3 = null;
return false;
}
示例11: GetMeasuredItems
/// <summary>
/// Measures a couple of items and prepares them for being drawn.
/// </summary>
/// <param name="g">Graphics context.</param>
/// <param name="font">Font used.</param>
/// <param name="strfmt">String format used.</param>
/// <param name="items">Array of items to be drawn.</param>
/// <returns>An array of <see cref="IMeasuredLabelItem" /> that can be used to determine the size of each item and to draw it.</returns>
public override IMeasuredLabelItem[] GetMeasuredItems(IGraphicsContext3D g, FontX3D font, AltaxoVariant[] items)
{
string[] titems = FormatItems(items);
if (!string.IsNullOrEmpty(_prefix) || !string.IsNullOrEmpty(_suffix))
{
for (int i = 0; i < titems.Length; ++i)
titems[i] = _prefix + titems[i] + _suffix;
}
MeasuredLabelItem[] litems = new MeasuredLabelItem[titems.Length];
FontX3D localfont = font;
for (int i = 0; i < titems.Length; ++i)
{
litems[i] = new MeasuredLabelItem(g, localfont, titems[i], _relativeLineSpacing, Alignment.Near, Alignment.Near, _textBlockAlignment);
}
return litems;
}
示例12: SetValueAt
// indexers
public override void SetValueAt(int i, AltaxoVariant val)
{
if(val.IsTypeOrNull(AltaxoVariant.Content.VString))
this[i] = (string)val;
else
this[i] = val.ToString();
// throw new ApplicationException("Error: Try to set " + this.TypeAndName + "[" + i + "] with " + val.ToString());
}
示例13: SetValueAt
// indexers
public override void SetValueAt(int i, AltaxoVariant val)
{
if(val.IsType(AltaxoVariant.Content.VDouble))
this[i] = val.m_Double;
else if(val.CanConvertedToDouble)
this[i] = val.ToDouble();
else
throw new ApplicationException("Error: Try to set " + this.TypeAndName + "[" + i + "] with the string " + val.ToString());
}
示例14: vop_ShiftRight
public override bool vop_ShiftRight(AltaxoVariant c2, out DataColumn c3)
{
if(((AltaxoVariant)c2).IsType(AltaxoVariant.Content.VDouble))
{
DoubleColumn c1=this;
int len = c1.m_Count;
Altaxo.Data.DoubleColumn c33 = new Altaxo.Data.DoubleColumn(len);
int c22 = (int)(double)c2;
for(int i=0;i<len;i++)
c33.m_Array[i] = ((long)c1.m_Array[i]) >> c22;
c33.m_Count = len;
c3=c33;
return true;
}
c3=null;
return false;
}
示例15: FromPhysicalVariant
/// <summary>
/// Initialized a 2D identifier from the parallel axis and the physical value of the perpendicular axis.
/// </summary>
/// <param name="parallelAxisNumber">Number of parallel axis (0->X, 1->Y, 2->Z).</param>
/// <param name="physicalValueOther">Physical value of the axis perendicular to the parallel axis.</param>
/// <returns>A freshly created 2D line identifier.</returns>
public static CSLineID FromPhysicalVariant(int parallelAxisNumber, AltaxoVariant physicalValueOther)
{
if (parallelAxisNumber < 0 || parallelAxisNumber > 2)
throw new ArgumentOutOfRangeException("AxisNumber must be either 0, 1, or 2, but you provide: " + parallelAxisNumber.ToString());
if (!physicalValueOther.Equals(physicalValueOther))
throw new ArgumentException("You can not set physical values that return false when compared to itself, value is: " + physicalValueOther.ToString());
CSLineID id = new CSLineID();
id._parallelAxisNumber = parallelAxisNumber;
id._physicalValueFirstOther = physicalValueOther;
id._logicalValueFirstOther = double.NaN;
id._usePhysicalValueFirstOther = true;
id._logicalValueSecondOther = double.NaN;
return id;
}