/// <summary> /// Processes a single value . /// If the data value is text, the boundaries are /// updated and the number of items is increased by one (if not contained already). The function returns true /// in this case. On the other hand, if the value is outside the range, the function has to /// return false. /// </summary> /// <param name="item">The data item.</param> /// <returns>True if data is in the tracked range, false if the data is not in the tracked range.</returns> public bool Add(Altaxo.Data.AltaxoVariant item) { if (!(item.IsType(Altaxo.Data.AltaxoVariant.Content.VString))) { return(false); } string s = item.ToString(); if (string.IsNullOrEmpty(s)) { return(false); // we consider empty string as invalid data here } if (IsSuspended) // when suspended: performance tweak, see overrides OnSuspended and OnResume for details (if suspended, we have saved the state of the instance for comparison when we resume). { if (!_itemList.Contains(s)) { _itemList.Add(s); } } else // not suspended: normal behaviour with change notification { if (!_itemList.Contains(s)) { _itemList.Add(s); EhSelfChanged(new BoundariesChangedEventArgs(BoundariesChangedData.NumberOfItemsChanged | BoundariesChangedData.UpperBoundChanged)); } } return(true); }
protected override string SetScaleOrgEnd(Altaxo.Data.AltaxoVariant org, Altaxo.Data.AltaxoVariant end) { double o = org.ToDouble(); double e = end.ToDouble(); if (o <= 0) { o = CumulativeProbabilityScaleRescaleConditions.DefaultOrgValue; } else if (o >= 1) { o = CumulativeProbabilityScaleRescaleConditions.DefaultEndValue; } if (e <= 0) { e = CumulativeProbabilityScaleRescaleConditions.DefaultOrgValue; } else if (e >= 1) { e = CumulativeProbabilityScaleRescaleConditions.DefaultEndValue; } if (o == e) { double h = o / 2; o = o - h; e = e + h; } InternalSetOrgEnd(o, e); return(null); }
public void FixupInternalDataStructures(IPlotArea layer, Func <CSLineID, CSAxisInformation> GetAxisStyleInformation) { // update the logical values of the physical axes before if (_styleID.UsePhysicalValueOtherFirst) { // then update the logical value of this identifier double logicalValue = layer.Scales[_styleID.AxisNumberOtherFirst].PhysicalVariantToNormal(_styleID.PhysicalValueOtherFirst); _styleID = _styleID.WithLogicalValueOtherFirst(logicalValue); } if (_styleID.UsePhysicalValueOtherSecond) { // then update the logical value of this identifier double logicalValue = layer.Scales[_styleID.AxisNumberOtherSecond].PhysicalVariantToNormal(_styleID.PhysicalValueOtherSecond); _styleID = _styleID.WithLogicalValueOtherSecond(logicalValue); } CachedAxisInformation = GetAxisStyleInformation(_styleID); if (null != _customTickSpacing) { CSLineID styleID = _cachedAxisInfo.Identifier; Scale scale = layer.Scales[styleID.ParallelAxisNumber]; Altaxo.Data.AltaxoVariant org = scale.OrgAsVariant, end = scale.EndAsVariant; _customTickSpacing.PreProcessScaleBoundaries(ref org, ref end, false, false); _customTickSpacing.FinalProcessScaleBoundaries(org, end, scale); } if (null != _axisTitle) { _axisTitle.SetParentSize(layer.Size, false); } }
public void Paint(IGraphicsContext3D g, IPlotArea layer, CSPlaneID plane, int axisnumber) { if (!_showGrid) { return; } Scale axis = layer.Scales[axisnumber]; TickSpacing ticking = layer.Scales[axisnumber].TickSpacing; var layerRect = new RectangleD3D(PointD3D.Empty, layer.Size); if (_showZeroOnly) { var var = new Altaxo.Data.AltaxoVariant(0.0); double rel = axis.PhysicalVariantToNormal(var); //_majorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1)); if (rel >= 0 && rel <= 1) { var logV = new Logical3D(); logV.SetR(plane.PerpendicularAxisNumber, plane.LogicalValue); logV.SetR(axisnumber, rel); var thirdAxisNumber = Logical3D.GetPerpendicularAxisNumber(plane.PerpendicularAxisNumber, axisnumber); var line = layer.CoordinateSystem.GetIsoline(logV.WithR(thirdAxisNumber, 0), logV.WithR(thirdAxisNumber, 1)); g.DrawLine(MajorPen, line); } } else { double[] ticks; if (_showMinor) { //_minorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1)); ticks = ticking.GetMinorTicksNormal(axis); for (int i = 0; i < ticks.Length; ++i) { var logV = new Logical3D(); logV.SetR(plane.PerpendicularAxisNumber, plane.LogicalValue); logV.SetR(axisnumber, ticks[i]); var thirdAxisNumber = Logical3D.GetPerpendicularAxisNumber(plane.PerpendicularAxisNumber, axisnumber); var line = layer.CoordinateSystem.GetIsoline(logV.WithR(thirdAxisNumber, 0), logV.WithR(thirdAxisNumber, 1)); g.DrawLine(MinorPen, line); } } //MajorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1)); ticks = ticking.GetMajorTicksNormal(axis); for (int i = 0; i < ticks.Length; ++i) { var logV = new Logical3D(); logV.SetR(plane.PerpendicularAxisNumber, plane.LogicalValue); logV.SetR(axisnumber, ticks[i]); var thirdAxisNumber = Logical3D.GetPerpendicularAxisNumber(plane.PerpendicularAxisNumber, axisnumber); var line = layer.CoordinateSystem.GetIsoline(logV.WithR(thirdAxisNumber, 0), logV.WithR(thirdAxisNumber, 1)); g.DrawLine(MajorPen, line); } } }
protected override string SetScaleOrgEnd(Altaxo.Data.AltaxoVariant org, Altaxo.Data.AltaxoVariant end) { double o = org.ToDouble(); double e = end.ToDouble(); InternalSetOrgEnd(o, e); return(null); }
protected override string FormatItem(Altaxo.Data.AltaxoVariant item) { const double tolerance = 1E-8; int denominator = 1440; // this allows for resolution of a quarter of a degree if (!item.CanConvertedToDouble) { return(item.ToString()); } double value = item; double multipvalue = value * denominator / Math.PI; double multipround = Math.Round(multipvalue, 0); if (Math.Abs(multipvalue - multipround) < tolerance && Math.Abs(multipround) < int.MaxValue) // then it is a ratio of pi { int nominator = (int)multipround; Shorten(ref nominator, ref denominator); if (nominator == 0) { return("0"); } else { string pre; if (nominator == 1) { pre = string.Empty; } else if (nominator == -1) { pre = "-"; } else { pre = nominator.ToString(); } string post; if (denominator == 1) { post = string.Empty; } else { post = "/" + denominator.ToString(); } return(pre + '\u03c0' + post); } } return(item.ToString()); }
protected override string FormatItem(Altaxo.Data.AltaxoVariant item) { if (item.IsType(Altaxo.Data.AltaxoVariant.Content.VDouble)) { return(FormatItem(item)); } else { return(item.ToString()); } }
protected override string SetScaleOrgEnd(Altaxo.Data.AltaxoVariant org, Altaxo.Data.AltaxoVariant end) { double o = org.ToDouble(); double e = end.ToDouble(); if (!(o < e)) { return("org is not less than end"); } InternalSetOrgEnd(o, e, false, false); return(null); }
protected override string SetScaleOrgEnd(Altaxo.Data.AltaxoVariant org, Altaxo.Data.AltaxoVariant end) { // ignore all this stuff, org and end are fixed here! /* * double o = org.ToDouble(); * double e = end.ToDouble(); * * if (!(o < e)) * return "org is not less than end"; * * InternalSetOrgEnd(o, e, false, false); */ return(null); }
public BarGraphPlotStyle(BarGraphPlotStyle from) { this._relInnerGapWidth = from._relInnerGapWidth; this._relOuterGapWidth = from._relOuterGapWidth; this._width = from._width; this._position = from._position; this._independentColor = from._independentColor; this._fillBrush = from._fillBrush.Clone(); this._framePen = from._framePen == null ? null : (PenX)from._framePen.Clone(); this._startAtPreviousItem = from._startAtPreviousItem; this._previousItemYGap = from._previousItemYGap; this._usePhysicalBaseValue = from._usePhysicalBaseValue; this._baseValue = from._baseValue; this._parent = from._parent; }
/// <summary> /// Processes a single value . /// If the data value is text, the boundaries are /// updated and the number of items is increased by one (if not contained already). The function returns true /// in this case. On the other hand, if the value is outside the range, the function has to /// return false. /// </summary> /// <param name="item">The data item.</param> /// <returns>True if data is in the tracked range, false if the data is not in the tracked range.</returns> public bool Add(Altaxo.Data.AltaxoVariant item) { if (item.IsType(Altaxo.Data.AltaxoVariant.Content.VString)) { string s = item.ToString(); if (!_itemList.Contains(s)) { _itemList.Add(s); if (_eventSuspendCount == 0) { OnNumberOfItemsChanged(); OnBoundaryChanged(false, true); } return(true); } } return(false); }
public override void FinalProcessScaleBoundaries(Altaxo.Data.AltaxoVariant org, Altaxo.Data.AltaxoVariant end, Altaxo.Graph.Scales.Scale scale) { _org = org; _end = end; try { if (_showRatioEndOrg) { _span = end / org; } else { _span = end - org; } } catch (Exception) { _span = new Data.AltaxoVariant(string.Empty); } }
/// <summary> /// This function searches for patterns like aaa=bbb in the provided string. If it finds such a item, it creates a column named aaa /// and stores the value bbb at the same position in it as in the text column. /// </summary> /// <param name="strg">The string where to search for the patterns described above.</param> /// <param name="store">The column collection where to store the newly created columns of properties.</param> /// <param name="index">The index into the column where to store the property value.</param> public static void ExtractPropertiesFromString(string strg, Altaxo.Data.DataColumnCollection store, int index) { string pat; pat = @"(\S+)=(\S+)"; Regex r = new Regex(pat, RegexOptions.Compiled | RegexOptions.IgnoreCase); for (Match m = r.Match(strg); m.Success; m = m.NextMatch()) { string propname = m.Groups[1].ToString(); string propvalue = m.Groups[2].ToString(); // System.Diagnostics.Trace.WriteLine("Found the pair " + propname + " : " + propvalue); if (!store.ContainsColumn(propname)) { Altaxo.Data.DataColumn col; if (Altaxo.Serialization.DateTimeParsing.IsDateTime(propvalue)) { col = new Altaxo.Data.DateTimeColumn(); } else if (Altaxo.Serialization.NumberConversion.IsNumeric(propvalue)) { col = new Altaxo.Data.DoubleColumn(); } else { col = new Altaxo.Data.TextColumn(); } store.Add(col, propname); // add the column to the collection } // now the column is present we can store the value in it. store[propname][index] = new Altaxo.Data.AltaxoVariant(propvalue); } }
public override System.Drawing.SizeF MeasureItem(System.Drawing.Graphics g, System.Drawing.Font font, System.Drawing.StringFormat strfmt, Altaxo.Data.AltaxoVariant mtick, System.Drawing.PointF morg) { string firstpart, exponent; SplitInFirstPartAndExponent((double)mtick, out firstpart, out exponent); SizeF size1 = g.MeasureString(firstpart, font, new PointF(0, 0), strfmt); SizeF size2 = g.MeasureString(exponent, font, new PointF(size1.Width, 0), strfmt); return(new SizeF(size1.Width + size2.Width, size1.Height)); }
/// <summary> /// Processes a single value. /// If the data value is inside the considered value range, the boundaries are /// updated and the number of items is increased by one. The function has to return true /// in this case. On the other hand, if the value is outside the range, the function has to /// return false. /// </summary> /// <param name="item">The data value.</param> /// <returns>True if data is in the tracked range, false if the data is not in the tracked range.</returns> public abstract bool Add(Altaxo.Data.AltaxoVariant item);
public void Paint(IGraphicsContext3D g, IPlotArea layer, CSPlaneID plane, int axisnumber) { if (!_showGrid) return; Scale axis = layer.Scales[axisnumber]; TickSpacing ticking = layer.Scales[axisnumber].TickSpacing; RectangleD3D layerRect = new RectangleD3D(PointD3D.Empty, layer.Size); if (_showZeroOnly) { Altaxo.Data.AltaxoVariant var = new Altaxo.Data.AltaxoVariant(0.0); double rel = axis.PhysicalVariantToNormal(var); //_majorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1)); if (rel >= 0 && rel <= 1) { Logical3D logV = new Logical3D(); logV.SetR(plane.PerpendicularAxisNumber, plane.LogicalValue); logV.SetR(axisnumber, rel); var thirdAxisNumber = Logical3D.GetPerpendicularAxisNumber(plane.PerpendicularAxisNumber, axisnumber); var line = layer.CoordinateSystem.GetIsoline(logV.WithR(thirdAxisNumber, 0), logV.WithR(thirdAxisNumber, 1)); g.DrawLine(MajorPen, line); } } else { double[] ticks; if (_showMinor) { //_minorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1)); ticks = ticking.GetMinorTicksNormal(axis); for (int i = 0; i < ticks.Length; ++i) { Logical3D logV = new Logical3D(); logV.SetR(plane.PerpendicularAxisNumber, plane.LogicalValue); logV.SetR(axisnumber, ticks[i]); var thirdAxisNumber = Logical3D.GetPerpendicularAxisNumber(plane.PerpendicularAxisNumber, axisnumber); var line = layer.CoordinateSystem.GetIsoline(logV.WithR(thirdAxisNumber, 0), logV.WithR(thirdAxisNumber, 1)); g.DrawLine(MinorPen, line); } } //MajorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1)); ticks = ticking.GetMajorTicksNormal(axis); for (int i = 0; i < ticks.Length; ++i) { Logical3D logV = new Logical3D(); logV.SetR(plane.PerpendicularAxisNumber, plane.LogicalValue); logV.SetR(axisnumber, ticks[i]); var thirdAxisNumber = Logical3D.GetPerpendicularAxisNumber(plane.PerpendicularAxisNumber, axisnumber); var line = layer.CoordinateSystem.GetIsoline(logV.WithR(thirdAxisNumber, 0), logV.WithR(thirdAxisNumber, 1)); g.DrawLine(MajorPen, line); } } }
public override bool PreProcessScaleBoundaries(ref Altaxo.Data.AltaxoVariant org, ref Altaxo.Data.AltaxoVariant end, bool isOrgExtendable, bool isEndExtendable) { return(false); }
protected override string FormatItem(Altaxo.Data.AltaxoVariant item) { return(item.ToString()); }
public override void DrawItem(Graphics g, BrushX brush, FontX font, StringFormat strfmt, Altaxo.Data.AltaxoVariant item, PointF morg) { SplitInFirstPartAndExponent(item, out var firstpart, out var mant, out var middelpart, out var exponent); var gdiFont = GdiFontManager.ToGdi(font); SizeF size1 = g.MeasureString(_prefix + firstpart + middelpart, gdiFont, morg, strfmt); g.DrawString(_prefix + firstpart + middelpart, gdiFont, brush, morg, strfmt); var orginalY = morg.Y; morg.X += size1.Width; morg.Y += size1.Height / 3; FontX font2 = font.WithSize(font.Size * 2 / 3.0); var gdiFont2 = GdiFontManager.ToGdi(font2); g.DrawString(exponent, gdiFont2, brush, morg); if (!string.IsNullOrEmpty(_suffix)) { morg.X += g.MeasureString(exponent, gdiFont2, morg, strfmt).Width; morg.Y = orginalY; } if (!string.IsNullOrEmpty(_suffix)) { g.DrawString(_suffix, gdiFont, brush, morg, strfmt); } }
protected override string FormatItem(Altaxo.Data.AltaxoVariant item) { throw new ApplicationException("Programming error: this function must not be called because the item can not be formatted as a string"); }
public override bool Add(Altaxo.Data.AltaxoVariant item) { return(true); }
public override void DrawItem(Graphics g, BrushX brush, Font font, StringFormat strfmt, Altaxo.Data.AltaxoVariant item, PointF morg) { string firstpart, exponent; SplitInFirstPartAndExponent((double)item, out firstpart, out exponent); SizeF size1 = g.MeasureString(firstpart, font, morg, strfmt); g.DrawString(firstpart, font, brush, morg, strfmt); morg.X += size1.Width; morg.Y += size1.Height / 3; using (Font font2 = new Font(font.FontFamily, (float)(font.Size * 2 / 3.0))) { g.DrawString(exponent, font2, brush, morg); } }
public override System.Drawing.SizeF MeasureItem(System.Drawing.Graphics g, FontX font, System.Drawing.StringFormat strfmt, Altaxo.Data.AltaxoVariant mtick, System.Drawing.PointF morg) { SplitInFirstPartAndExponent(mtick, out var firstpart, out var mant, out var middelpart, out var exponent); var gdiFont = GdiFontManager.ToGdi(font); SizeF size1 = g.MeasureString(_prefix + firstpart + middelpart, gdiFont, new PointF(0, 0), strfmt); SizeF size2 = g.MeasureString(exponent, gdiFont, new PointF(size1.Width, 0), strfmt); SizeF size3 = g.MeasureString(_suffix, gdiFont, new PointF(0, 0), strfmt); return(new SizeF(size1.Width + size2.Width + size3.Width, size1.Height)); }
public override void FinalProcessScaleBoundaries(Altaxo.Data.AltaxoVariant org, Altaxo.Data.AltaxoVariant end, Altaxo.Graph.Scales.Scale scale) { _org = org; _end = end; try { if (_showRatioEndOrg) _span = end / org; else _span = end - org; } catch (Exception) { _span = new Data.AltaxoVariant(string.Empty); } }
public void Paint(Graphics g, IPlotArea layer, int axisnumber) { if (!_showGrid) { return; } Scales.Scale axis = axisnumber == 0 ? layer.XAxis : layer.YAxis; RectangleF layerRect = new RectangleF(new PointF(0, 0), layer.Size); if (_showZeroOnly) { Altaxo.Data.AltaxoVariant var = new Altaxo.Data.AltaxoVariant(0.0); double rel = axis.PhysicalVariantToNormal(var); _majorPen.BrushRectangle = layerRect; if (rel >= 0 && rel <= 1) { if (axisnumber == 0) { layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(rel, 0), new Logical3D(rel, 1)); } else { layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(0, rel), new Logical3D(1, rel)); } //layer.DrawIsoLine(g, MajorPen, axisnumber, rel, 0, 1); } } else { double[] ticks; if (_showMinor) { _minorPen.BrushRectangle = layerRect; ticks = axis.GetMinorTicksNormal(); for (int i = 0; i < ticks.Length; ++i) { if (axisnumber == 0) { layer.CoordinateSystem.DrawIsoline(g, MinorPen, new Logical3D(ticks[i], 0), new Logical3D(ticks[i], 1)); } else { layer.CoordinateSystem.DrawIsoline(g, MinorPen, new Logical3D(0, ticks[i]), new Logical3D(1, ticks[i])); } //layer.DrawIsoLine(g, MinorPen, axisnumber, ticks[i], 0, 1); } } MajorPen.BrushRectangle = layerRect; ticks = axis.GetMajorTicksNormal(); for (int i = 0; i < ticks.Length; ++i) { if (axisnumber == 0) { layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(ticks[i], 0), new Logical3D(ticks[i], 1)); } else { layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(0, ticks[i]), new Logical3D(1, ticks[i])); } //layer.DrawIsoLine(g, MajorPen, axisnumber, ticks[i], 0, 1); } } }
public void Paint(Graphics g, IPlotArea layer, int axisnumber) { if (!_showGrid) { return; } Scale axis = layer.Scales[axisnumber]; TickSpacing ticking = layer.Scales[axisnumber].TickSpacing; var layerRect = new RectangleD2D(PointD2D.Empty, layer.Size); if (_showZeroOnly) { var var = new Altaxo.Data.AltaxoVariant(0.0); double rel = axis.PhysicalVariantToNormal(var); _majorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1)); if (rel >= 0 && rel <= 1) { if (axisnumber == 0) { layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(rel, 0), new Logical3D(rel, 1)); } else { layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(0, rel), new Logical3D(1, rel)); } //layer.DrawIsoLine(g, MajorPen, axisnumber, rel, 0, 1); } } else { double[] ticks; if (_showMinor) { _minorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1)); ticks = ticking.GetMinorTicksNormal(axis); for (int i = 0; i < ticks.Length; ++i) { if (axisnumber == 0) { layer.CoordinateSystem.DrawIsoline(g, MinorPen, new Logical3D(ticks[i], 0), new Logical3D(ticks[i], 1)); } else { layer.CoordinateSystem.DrawIsoline(g, MinorPen, new Logical3D(0, ticks[i]), new Logical3D(1, ticks[i])); } //layer.DrawIsoLine(g, MinorPen, axisnumber, ticks[i], 0, 1); } } MajorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1)); ticks = ticking.GetMajorTicksNormal(axis); for (int i = 0; i < ticks.Length; ++i) { if (axisnumber == 0) { layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(ticks[i], 0), new Logical3D(ticks[i], 1)); } else { layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(0, ticks[i]), new Logical3D(1, ticks[i])); } //layer.DrawIsoLine(g, MajorPen, axisnumber, ticks[i], 0, 1); } } }
/// <summary> /// PhysicalVariantToNormal translates physical values into a normal value linear along the axis /// a physical value of the axis origin must return a value of zero /// a physical value of the axis end must return a value of one /// the function physicalToNormal must be provided by any derived class /// </summary> /// <param name="x">the physical value</param> /// <returns> /// the normalized value linear along the axis, /// 0 for axis origin, 1 for axis end</returns> public override double PhysicalVariantToNormal(Altaxo.Data.AltaxoVariant x) { return(PhysicalToNormal(x.ToDouble())); }
public override bool Add(Altaxo.Data.AltaxoVariant item) { return(Add((DateTime)item)); }
public override bool Add(Altaxo.Data.AltaxoVariant item) { return(Add(item.ToDouble())); }
/// <summary> /// This function searches for patterns like aaa=bbb in the provided string. If it finds such a item, it creates a column named aaa /// and stores the value bbb at the same position in it as in the text column. /// </summary> /// <param name="strg">The string where to search for the patterns described above.</param> /// <param name="store">The column collection where to store the newly created columns of properties.</param> /// <param name="index">The index into the column where to store the property value.</param> public static void ExtractPropertiesFromString(string strg, Altaxo.Data.DataColumnCollection store, int index) { string pat; pat = @"(\S+)=(\S+)"; Regex r = new Regex(pat, RegexOptions.Compiled | RegexOptions.IgnoreCase); for ( Match m = r.Match(strg); m.Success; m = m.NextMatch()) { string propname = m.Groups[1].ToString(); string propvalue = m.Groups[2].ToString(); // System.Diagnostics.Trace.WriteLine("Found the pair " + propname + " : " + propvalue); if(!store.ContainsColumn(propname)) { Altaxo.Data.DataColumn col; if(Altaxo.Serialization.DateTimeParsing.IsDateTime(propvalue)) col = new Altaxo.Data.DateTimeColumn(); else if(Altaxo.Serialization.NumberConversion.IsNumeric(propvalue)) col = new Altaxo.Data.DoubleColumn(); else col = new Altaxo.Data.TextColumn(); store.Add(col,propname); // add the column to the collection } // now the column is present we can store the value in it. store[propname][index] = new Altaxo.Data.AltaxoVariant(propvalue); } }
public override void FinalProcessScaleBoundaries(Altaxo.Data.AltaxoVariant org, Altaxo.Data.AltaxoVariant end, Scale scale) { }
public void Paint(Graphics g, IPlotArea layer, int axisnumber) { if (!_showGrid) return; Scales.Scale axis = axisnumber == 0 ? layer.XAxis : layer.YAxis; RectangleF layerRect = new RectangleF(new PointF(0, 0), layer.Size); if (_showZeroOnly) { Altaxo.Data.AltaxoVariant var = new Altaxo.Data.AltaxoVariant(0.0); double rel = axis.PhysicalVariantToNormal(var); _majorPen.BrushRectangle = layerRect; if (rel >= 0 && rel <= 1) { if (axisnumber == 0) layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(rel, 0), new Logical3D(rel, 1)); else layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(0, rel), new Logical3D(1, rel)); //layer.DrawIsoLine(g, MajorPen, axisnumber, rel, 0, 1); } } else { double[] ticks; if (_showMinor) { _minorPen.BrushRectangle = layerRect; ticks = axis.GetMinorTicksNormal(); for (int i = 0; i < ticks.Length; ++i) { if (axisnumber == 0) layer.CoordinateSystem.DrawIsoline(g, MinorPen, new Logical3D(ticks[i], 0), new Logical3D(ticks[i], 1)); else layer.CoordinateSystem.DrawIsoline(g, MinorPen, new Logical3D(0, ticks[i]), new Logical3D(1, ticks[i])); //layer.DrawIsoLine(g, MinorPen, axisnumber, ticks[i], 0, 1); } } MajorPen.BrushRectangle = layerRect; ticks = axis.GetMajorTicksNormal(); for (int i = 0; i < ticks.Length; ++i) { if(axisnumber==0) layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(ticks[i], 0), new Logical3D(ticks[i], 1)); else layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(0, ticks[i]), new Logical3D(1, ticks[i])); //layer.DrawIsoLine(g, MajorPen, axisnumber, ticks[i], 0, 1); } } }
public void Paint(Graphics g, IPlotArea layer, int axisnumber) { if (!_showGrid) return; Scale axis = layer.Scales[axisnumber]; TickSpacing ticking = layer.Scales[axisnumber].TickSpacing; RectangleD2D layerRect = new RectangleD2D(PointD2D.Empty, layer.Size); if (_showZeroOnly) { Altaxo.Data.AltaxoVariant var = new Altaxo.Data.AltaxoVariant(0.0); double rel = axis.PhysicalVariantToNormal(var); _majorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1)); if (rel >= 0 && rel <= 1) { if (axisnumber == 0) layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(rel, 0), new Logical3D(rel, 1)); else layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(0, rel), new Logical3D(1, rel)); //layer.DrawIsoLine(g, MajorPen, axisnumber, rel, 0, 1); } } else { double[] ticks; if (_showMinor) { _minorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1)); ticks = ticking.GetMinorTicksNormal(axis); for (int i = 0; i < ticks.Length; ++i) { if (axisnumber == 0) layer.CoordinateSystem.DrawIsoline(g, MinorPen, new Logical3D(ticks[i], 0), new Logical3D(ticks[i], 1)); else layer.CoordinateSystem.DrawIsoline(g, MinorPen, new Logical3D(0, ticks[i]), new Logical3D(1, ticks[i])); //layer.DrawIsoLine(g, MinorPen, axisnumber, ticks[i], 0, 1); } } MajorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1)); ticks = ticking.GetMajorTicksNormal(axis); for (int i = 0; i < ticks.Length; ++i) { if (axisnumber == 0) layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(ticks[i], 0), new Logical3D(ticks[i], 1)); else layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(0, ticks[i]), new Logical3D(1, ticks[i])); //layer.DrawIsoLine(g, MajorPen, axisnumber, ticks[i], 0, 1); } } }
/// <summary> /// Moves on or more rows in to a new position. /// </summary> /// <param name="selectedIndices">The indices of the rows to move.</param> /// <param name="newPosition">The new position of the rows.</param> public void ChangeRowPosition(Altaxo.Collections.IAscendingIntegerCollection selectedIndices, int newPosition) { int numberSelected = selectedIndices.Count; if(numberSelected==0) return; int oldPosition = selectedIndices[0]; if(oldPosition==newPosition) return; // check that the newPosition is ok if(newPosition<0) throw new ArgumentException("New row position is negative!"); // Allocated tempory storage for the datacolumns Altaxo.Data.AltaxoVariant[] tempMoved = new Altaxo.Data.AltaxoVariant[numberSelected]; int firstAffected; int maxAffected; if(newPosition<oldPosition) // move down to lower indices { firstAffected = newPosition; maxAffected = Math.Max(newPosition+numberSelected,selectedIndices[numberSelected-1]+1); } else { firstAffected = selectedIndices[0]; maxAffected = newPosition+numberSelected; } for(int nColumn=ColumnCount-1;nColumn>=0;nColumn--) { Altaxo.Data.DataColumn thiscolumn = this[nColumn]; // fill temporary storage for(int i=0;i<numberSelected;i++) tempMoved[i]=thiscolumn[selectedIndices[i]]; if(newPosition<oldPosition) // move down to lower indices { for(int i=selectedIndices[numberSelected-1],offset=0;i>=firstAffected;i--) { if(numberSelected>offset && i==selectedIndices[numberSelected-1-offset]) offset++; else thiscolumn[i+offset] = thiscolumn[i]; } } else // move up to higher { for(int i=selectedIndices[0],offset=0;i<maxAffected;i++) { if(offset<numberSelected && i==selectedIndices[offset]) offset++; else thiscolumn[i-offset] = thiscolumn[i]; } } // Fill in temporary stored columns on new position for(int i=0;i<numberSelected;i++) thiscolumn[newPosition+i] = tempMoved[i]; } this.EhChildChanged(null,ChangeEventArgs.CreateRowMoveArgs(ColumnCount,firstAffected,maxAffected)); }