Esempio n. 1
0
        public void Draw(Graphics g, BrushX brush, RectangleD2D innerArea)
        {
            innerArea.Inflate(_shadowLength / 2, _shadowLength / 2); // Padding
            var outerArea = innerArea;

            outerArea.Inflate(_shadowLength, _shadowLength);

            brush.SetEnvironment(outerArea, BrushX.GetEffectiveMaximumResolution(g, 1));
            g.FillRectangle(brush, (RectangleF)outerArea);

            var twhite = new SolidBrush(Color.FromArgb(128, 255, 255, 255));
            var oA     = (RectangleF)outerArea;
            var iA     = (RectangleF)innerArea;

            g.FillPolygon(twhite, new PointF[] {
                new PointF(oA.Left, oA.Top),                                      // upper left point
                new PointF(oA.Right, oA.Top),                                     // go to the right
                new PointF(iA.Right, iA.Top),                                     // go 45 deg left down in the upper right corner
                new PointF(iA.Left, iA.Top),                                      // upper left corner of the inner rectangle
                new PointF(iA.Left, iA.Bottom),                                   // lower left corner of the inner rectangle
                new PointF(oA.Left, oA.Bottom)                                    // lower left corner
            });

            var tblack = new SolidBrush(Color.FromArgb(128, 0, 0, 0));

            g.FillPolygon(tblack, new PointF[] {
                new PointF(oA.Right, oA.Bottom),
                new PointF(oA.Right, oA.Top),
                new PointF(iA.Right, iA.Top),
                new PointF(iA.Right, iA.Bottom),                                    // upper left corner of the inner rectangle
                new PointF(iA.Left, iA.Bottom),                                     // lower left corner of the inner rectangle
                new PointF(oA.Left, oA.Bottom)                                      // lower left corner
            });
        }
Esempio n. 2
0
 public void Draw(System.Drawing.Graphics g, BrushX brush, RectangleD2D innerArea)
 {
     if (brush != null)
     {
         brush.SetEnvironment(innerArea, BrushX.GetEffectiveMaximumResolution(g, 1));
         g.FillRectangle(brush, (RectangleF)innerArea);
     }
 }
Esempio n. 3
0
        public void PaintBackground(Graphics g, IPlotArea layer)
        {
            Region region = layer.CoordinateSystem.GetRegion();

            if (_background != null)
            {
                RectangleF innerArea = region.GetBounds(g);
                _background.SetEnvironment(innerArea, BrushX.GetEffectiveMaximumResolution(g, 1));
                g.FillRegion(_background, region);
            }
        }
Esempio n. 4
0
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            Graphics  grfx      = e.Graphics;
            Rectangle rectColor = new Rectangle(e.Bounds.Left, e.Bounds.Top, 2 * e.Bounds.Height, e.Bounds.Height);

            rectColor.Inflate(-1, -1);

            Rectangle rectText = new Rectangle(e.Bounds.Left + 2 * e.Bounds.Height,
                                               e.Bounds.Top,
                                               e.Bounds.Width - 2 * e.Bounds.Height,
                                               e.Bounds.Height);

            if (this.Enabled)
            {
                e.DrawBackground();
            }

            grfx.DrawRectangle(new Pen(e.ForeColor), rectColor);

            string text       = string.Empty;
            object objAtIndex = e.Index >= 0 ? Items[e.Index] : SelectedItem;

            if (objAtIndex is Color)
            {
                Color itemColor = (Color)objAtIndex;
                grfx.FillRectangle(new SolidBrush(itemColor), rectColor);
                if (itemColor.IsNamedColor)
                {
                    text = itemColor.Name;
                }
                else if (ColorDictionary.IsBaseColorNamed(itemColor))
                {
                    int transparency = ((255 - itemColor.A) * 100) / 255;
                    text = "T" + transparency.ToString() + ColorDictionary.GetBaseColorName(itemColor);
                }
                else
                {
                    text = "Custom Color";
                }
            }
            else if (objAtIndex is BrushX)
            {
                BrushX itemBrush = (BrushX)objAtIndex;
                itemBrush.SetEnvironment(rectColor, BrushX.GetEffectiveMaximumResolution(grfx));
                grfx.FillRectangle(itemBrush, rectColor);
                text = "Custom Brush";
            }

            grfx.DrawString(text, Font, new SolidBrush(e.ForeColor), rectText);
        }
Esempio n. 5
0
        public void UpdatePreview(BrushX brush)
        {
            if (null == _previewPanel || null == brush)
            {
                return;
            }

            int height = (int)_previewPanel.ActualHeight;
            int width  = (int)_previewPanel.ActualWidth;

            if (height <= 0)
            {
                height = 64;
            }
            if (width <= 0)
            {
                width = 64;
            }

            if (null == _previewBitmap)
            {
                _previewBitmap       = new GdiToWpfBitmap(width, height);
                _previewPanel.Source = _previewBitmap.WpfBitmap;
            }

            if (width != _previewBitmap.GdiRectangle.Width || height != _previewBitmap.GdiRectangle.Height)
            {
                _previewBitmap.Resize(width, height);
                _previewPanel.Source = _previewBitmap.WpfBitmap;
            }

            using (var grfx = _previewBitmap.BeginGdiPainting())
            {
                var fullRect = _previewBitmap.GdiRectangle;

                grfx.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy;
                grfx.FillRectangle(System.Drawing.Brushes.Transparent, fullRect);
                grfx.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver;

                var r2 = fullRect;
                r2.Inflate(-r2.Width / 4, -r2.Height / 4);
                //grfx.FillRectangle(System.Drawing.Brushes.Black, r2);

                brush.SetEnvironment(fullRect, BrushX.GetEffectiveMaximumResolution(grfx));
                grfx.FillRectangle(brush, fullRect);

                _previewBitmap.EndGdiPainting();
            }
        }
Esempio n. 6
0
 public RectangleF PaintSymbol(Graphics g, RectangleF bounds)
 {
     bounds.Inflate(0, -bounds.Height / 4);
     if (null != _fillBrush)
     {
         _fillBrush.SetEnvironment(bounds, BrushX.GetEffectiveMaximumResolution(g, 1));
         g.FillRectangle(_fillBrush, bounds);
     }
     if (null != _framePen)
     {
         _framePen.SetEnvironment(bounds, BrushX.GetEffectiveMaximumResolution(g, 1));
         g.DrawRectangle(_framePen, bounds.X, bounds.Y, bounds.Width, bounds.Height);
     }
     return(bounds);
 }
Esempio n. 7
0
        private void EhBrushPreview_Paint(object sender, PaintEventArgs e)
        {
            Graphics  grfx     = e.Graphics;
            Rectangle fullRect = this._brushPreviewPanel.ClientRectangle;

            fullRect.Inflate(-fullRect.Width / 16, -fullRect.Height / 16);

            if (_brushGlue != null)
            {
                grfx.FillRectangle(Brushes.White, fullRect);
                Rectangle r2 = fullRect;
                r2.Inflate(-r2.Width / 4, -r2.Height / 4);
                grfx.FillRectangle(Brushes.Black, r2);

                _brushGlue.Brush.SetEnvironment(fullRect, BrushX.GetEffectiveMaximumResolution(grfx));
                grfx.FillRectangle(_brushGlue.Brush, fullRect);
            }
        }
Esempio n. 8
0
        public override void Paint(Graphics g, IPaintContext context)
        {
            GraphicsState gs = g.Save();

            TransformGraphics(g);

            var bounds  = Bounds;
            var boundsF = (RectangleF)bounds;

            if (Brush.IsVisible)
            {
                Brush.SetEnvironment(boundsF, BrushX.GetEffectiveMaximumResolution(g, Math.Max(ScaleX, ScaleY)));
                g.FillEllipse(Brush, boundsF);
            }

            Pen.SetEnvironment(boundsF, BrushX.GetEffectiveMaximumResolution(g, Math.Max(ScaleX, ScaleY)));
            g.DrawEllipse(Pen, boundsF);
            g.Restore(gs);
        }
Esempio n. 9
0
        public override void Paint(Graphics g, IPaintContext paintContext)
        {
            GraphicsState gs = g.Save();

            TransformGraphics(g);
            var bounds = Bounds;
            var path   = InternalGetPath(bounds.LeftTop);

            Pen.SetEnvironment((RectangleF)bounds, BrushX.GetEffectiveMaximumResolution(g, Math.Max(ScaleX, ScaleY)));
            g.DrawPath(Pen, path);
            if (_outlinePen != null && _outlinePen.IsVisible)
            {
                path.Widen(Pen);
                OutlinePen.SetEnvironment((RectangleF)bounds, BrushX.GetEffectiveMaximumResolution(g, Math.Max(ScaleX, ScaleY)));
                g.DrawPath(OutlinePen, path);
            }

            g.Restore(gs);
        }
Esempio n. 10
0
        private void UpdatePreviewPanel()
        {
            if (null == _previewPanel || null == _pen)
            {
                return;
            }

            int height = (int)_previewPanel.ActualHeight;
            int width  = (int)_previewPanel.ActualWidth;

            if (height <= 0)
            {
                height = 64;
            }
            if (width <= 0)
            {
                width = 64;
            }

            if (null == _previewBitmap)
            {
                _previewBitmap       = new GdiToWpfBitmap(width, height);
                _previewPanel.Source = _previewBitmap.WpfBitmap;
            }

            if (width != _previewBitmap.GdiRectangle.Width || height != _previewBitmap.GdiRectangle.Height)
            {
                _previewBitmap.Resize(width, height);
                _previewPanel.Source = _previewBitmap.WpfBitmap;
            }

            using (var grfx = _previewBitmap.BeginGdiPainting())
            {
                var fullRect = _previewBitmap.GdiRectangle;
                grfx.FillRectangle(System.Drawing.Brushes.White, fullRect);
                _pen.BrushHolder.SetEnvironment(fullRect, BrushX.GetEffectiveMaximumResolution(grfx));
                grfx.DrawLine(_pen, fullRect.Width / 6, fullRect.Height / 2, (fullRect.Width * 5) / 6, fullRect.Height / 2);

                _previewBitmap.EndGdiPainting();
            }
        }
Esempio n. 11
0
        public override void Paint(Graphics g, IPaintContext paintContext)
        {
            GraphicsState gs = g.Save();

            TransformGraphics(g);

            var bounds = Bounds;

            Pen.SetEnvironment((RectangleF)bounds, BrushX.GetEffectiveMaximumResolution(g, Math.Max(ScaleX, ScaleY)));
            g.DrawLine(Pen, (float)bounds.X, (float)bounds.Y, (float)bounds.Right, (float)bounds.Bottom);

            if (_outlinePen != null && _outlinePen.IsVisible)
            {
                var p = new GraphicsPath();
                p.AddLine((float)bounds.X, (float)bounds.Y, (float)bounds.Right, (float)bounds.Bottom);
                p.Widen(Pen);
                OutlinePen.SetEnvironment((RectangleF)bounds, BrushX.GetEffectiveMaximumResolution(g, Math.Max(ScaleX, ScaleY)));
                g.DrawPath(OutlinePen, p);
            }

            g.Restore(gs);
        }
Esempio n. 12
0
        public override void Paint(Graphics g, IPaintContext context)
        {
            GraphicsState gs = g.Save();

            TransformGraphics(g);

            var bounds = Bounds;

            var path = InternalGetPath(bounds.LeftTop);

            if (Brush.IsVisible)
            {
                Brush.SetEnvironment((RectangleF)bounds, BrushX.GetEffectiveMaximumResolution(g, Math.Max(ScaleX, ScaleY)));
                g.FillPath(Brush, path);
            }

            if (Pen.IsVisible)
            {
                Pen.SetEnvironment((RectangleF)bounds, BrushX.GetEffectiveMaximumResolution(g, Math.Max(ScaleX, ScaleY)));
                g.DrawPath(Pen, path);
            }
            g.Restore(gs);
        }
Esempio n. 13
0
        public void Draw(System.Drawing.Graphics g, BrushX brush, RectangleD2D innerArea)
        {
            BrushX shadowBrush = null;

            if (object.ReferenceEquals(brush, _brush))
            {
                if (null == _cachedShadowBrush)
                {
                    _cachedShadowBrush = GetShadowBrush(brush);
                    _cachedShadowBrush.ParentObject = this;
                }
                shadowBrush = _cachedShadowBrush;
            }
            else
            {
                shadowBrush = GetShadowBrush(brush);
            }

            innerArea.Inflate(_shadowLength / 2, _shadowLength / 2);

            // please note: m_Bounds is already extended to the shadow

            // first the shadow
            shadowBrush.SetEnvironment(innerArea, BrushX.GetEffectiveMaximumResolution(g, 1));

            // shortCuts to floats
            var   iArea        = (RectangleF)innerArea;
            float shadowLength = (float)_shadowLength;

            g.TranslateTransform(shadowLength, shadowLength);
            g.FillRectangle(shadowBrush, iArea);
            g.TranslateTransform(-shadowLength, -shadowLength);

            brush.SetEnvironment(innerArea, BrushX.GetEffectiveMaximumResolution(g, 1));
            g.FillRectangle(brush, iArea);
            g.DrawRectangle(Pens.Black, iArea.Left, iArea.Top, iArea.Width, iArea.Height);
        }
Esempio n. 14
0
        private void PaintFillToPrevPlotItem(Graphics g, IPlotArea layer, Altaxo.Graph.Gdi.Plot.Data.Processed2DPlotData pdata, Processed2DPlotData prevItemData)
        {
            // ensure that brush and pen are cached
            if (null != _fillBrush)
            {
                _fillBrush.SetEnvironment(new RectangleD2D(PointD2D.Empty, layer.Size), BrushX.GetEffectiveMaximumResolution(g, 1));
            }

            PlotRangeList rangeList    = pdata.RangeList;
            int           rangelistlen = rangeList.Count;

            // we have to ignore the missing points here, thus all ranges can be plotted
            // as one range, i.e. continuously
            // for this, we create the totalRange, which contains all ranges
            var totalRange = new PlotRange(rangeList[0].LowerBound, rangeList[rangelistlen - 1].UpperBound, rangeList[0].OffsetToOriginal);

            _cachedPaintOneRange(g, pdata, totalRange, layer, prevItemData);
        }
Esempio n. 15
0
        public void Paint(System.Drawing.Graphics g, IPlotArea layer, Processed2DPlotData pdata, Processed2DPlotData prevItemData, Processed2DPlotData nextItemData)
        {
            if (null == pdata)
            {
                throw new ArgumentNullException(nameof(pdata));
            }

            PlotRangeList rangeList = pdata.RangeList;

            System.Drawing.PointF[] ptArray = pdata.PlotPointsInAbsoluteLayerCoordinates;
            layer.CoordinateSystem.LogicalToLayerCoordinates(new Logical3D(0, 0), out var xleft, out var ybottom);
            layer.CoordinateSystem.LogicalToLayerCoordinates(new Logical3D(1, 1), out var xright, out var ytop);
            float xe = (float)xright;
            float ye = (float)ybottom;

            var path = new GraphicsPath();

            double globalBaseValue;

            if (_usePhysicalBaseValue)
            {
                globalBaseValue = layer.YAxis.PhysicalVariantToNormal(_baseValue);
                if (double.IsNaN(globalBaseValue))
                {
                    globalBaseValue = 0;
                }
            }
            else
            {
                globalBaseValue = _baseValue.ToDouble();
            }

            bool useVariableFillColor  = null != _fillBrush && null != _cachedColorForIndexFunction && !_independentFillColor;
            bool useVariableFrameColor = null != _framePen && null != _cachedColorForIndexFunction && !_independentFrameColor;

            var fillBrush = _fillBrush == null ? null : useVariableFillColor?_fillBrush.Clone() : _fillBrush;

            var framePen = _framePen == null ? null : useVariableFrameColor?_framePen.Clone() : _framePen;

            int j = -1;

            foreach (int originalRowIndex in pdata.RangeList.OriginalRowIndices())
            {
                j++;

                double xcn = _xOffsetLogical + layer.XAxis.PhysicalVariantToNormal(pdata.GetXPhysical(originalRowIndex));
                double xln = xcn - 0.5 * _xSizeLogical;
                double xrn = xcn + 0.5 * _xSizeLogical;

                double ycn    = layer.YAxis.PhysicalVariantToNormal(pdata.GetYPhysical(originalRowIndex));
                double ynbase = globalBaseValue;

                if (_startAtPreviousItem && pdata.PreviousItemData != null)
                {
                    double prevstart = layer.YAxis.PhysicalVariantToNormal(pdata.PreviousItemData.GetYPhysical(originalRowIndex));
                    if (!double.IsNaN(prevstart))
                    {
                        ynbase  = prevstart;
                        ynbase += Math.Sign(ynbase - globalBaseValue) * _previousItemYGap;
                    }
                }

                path.Reset();
                layer.CoordinateSystem.GetIsoline(path, new Logical3D(xln, ynbase), new Logical3D(xln, ycn));
                layer.CoordinateSystem.GetIsoline(path, new Logical3D(xln, ycn), new Logical3D(xrn, ycn));
                layer.CoordinateSystem.GetIsoline(path, new Logical3D(xrn, ycn), new Logical3D(xrn, ynbase));
                layer.CoordinateSystem.GetIsoline(path, new Logical3D(xrn, ynbase), new Logical3D(xln, ynbase));
                path.CloseFigure();

                if (null != fillBrush)
                {
                    if (useVariableFillColor)
                    {
                        fillBrush.Color = GdiColorHelper.ToNamedColor(_cachedColorForIndexFunction(originalRowIndex), "VariableColor");
                    }

                    fillBrush.SetEnvironment(path.GetBounds(), BrushX.GetEffectiveMaximumResolution(g, 1));
                    g.FillPath(fillBrush, path);
                }

                if (null != framePen)
                {
                    if (useVariableFrameColor)
                    {
                        framePen.Color = GdiColorHelper.ToNamedColor(_cachedColorForIndexFunction(originalRowIndex), "VariableColor");
                    }

                    framePen.SetEnvironment(path.GetBounds(), BrushX.GetEffectiveMaximumResolution(g, 1));
                    g.DrawPath(framePen, path);
                }
            }
        }
Esempio n. 16
0
        /// <summary>
        /// Paints the axis style labels.
        /// </summary>
        /// <param name="g">Graphics environment.</param>
        /// <param name="coordSyst">The coordinate system. Used to get the path along the axis.</param>
        /// <param name="scale">Scale.</param>
        /// <param name="tickSpacing">If not <c>null</c>, this parameter provides a custom tick spacing that is used instead of the default tick spacing of the scale.</param>
        /// <param name="styleInfo">Information about begin of axis, end of axis.</param>
        /// <param name="outerDistance">Distance between axis and labels.</param>
        /// <param name="useMinorTicks">If true, minor ticks are shown.</param>
        public virtual void Paint(Graphics g, G2DCoordinateSystem coordSyst, Scale scale, TickSpacing tickSpacing, CSAxisInformation styleInfo, double outerDistance, bool useMinorTicks)
        {
            _cachedAxisStyleInfo = styleInfo;
            CSLineID    styleID = styleInfo.Identifier;
            Scale       raxis   = scale;
            TickSpacing ticking = tickSpacing;

            _enclosingPath.Reset();
            _enclosingPath.FillMode = FillMode.Winding; // with Winding also overlapping rectangles are selected
            var helperPath = new GraphicsPath();
            var math       = new Matrix();

            Logical3D r0 = styleID.GetLogicalPoint(styleInfo.LogicalValueAxisOrg);
            Logical3D r1 = styleID.GetLogicalPoint(styleInfo.LogicalValueAxisEnd);

            Logical3D outer;
            var       dist_x = outerDistance; // Distance from axis tick point to label
            var       dist_y = outerDistance; // y distance from axis tick point to label

            // dist_x += this._font.SizeInPoints/3; // add some space to the horizontal direction in order to separate the chars a little from the ticks

            // next statement is necessary to have a consistent string length both
            // on 0 degree rotated text and rotated text
            // without this statement, the text is fitted to the pixel grid, which
            // leads to "steps" during scaling
            g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

            double[]        relpositions;
            AltaxoVariant[] ticks;
            if (useMinorTicks)
            {
                relpositions = ticking.GetMinorTicksNormal(raxis);
                ticks        = ticking.GetMinorTicksAsVariant();
            }
            else
            {
                relpositions = ticking.GetMajorTicksNormal(raxis);
                ticks        = ticking.GetMajorTicksAsVariant();
            }

            if (!_suppressedLabels.IsEmpty)
            {
                var filteredTicks        = new List <AltaxoVariant>();
                var filteredRelPositions = new List <double>();

                for (int i = 0; i < ticks.Length; i++)
                {
                    if (_suppressedLabels.ByValues.Contains(ticks[i]))
                    {
                        continue;
                    }
                    if (_suppressedLabels.ByNumbers.Contains(i))
                    {
                        continue;
                    }
                    if (_suppressedLabels.ByNumbers.Contains(i - ticks.Length))
                    {
                        continue;
                    }

                    filteredTicks.Add(ticks[i]);
                    filteredRelPositions.Add(relpositions[i]);
                }
                ticks        = filteredTicks.ToArray();
                relpositions = filteredRelPositions.ToArray();
            }

            IMeasuredLabelItem[] labels = _labelFormatting.GetMeasuredItems(g, _font, _stringFormat, ticks);

            double     emSize    = _font.Size;
            CSAxisSide labelSide = null != _labelSide ? _labelSide.Value : styleInfo.PreferredLabelSide;

            for (int i = 0; i < ticks.Length; i++)
            {
                double r = relpositions[i];

                if (!Altaxo.Calc.RMath.IsInIntervalCC(r, -1000, 1000))
                {
                    continue;
                }

                outer = coordSyst.GetLogicalDirection(styleID.ParallelAxisNumber, labelSide);
                PointD2D tickorg = coordSyst.GetNormalizedDirection(r0, r1, r, outer, out var outVector);
                PointD2D tickend = tickorg + outVector * outerDistance;

                PointD2D msize = labels[i].Size;
                PointD2D morg  = tickend;

                if (_automaticRotationShift)
                {
                    double alpha = _rotation * Math.PI / 180 - Math.Atan2(outVector.Y, outVector.X);
                    double shift = msize.Y * 0.5 * Math.Abs(Math.Sin(alpha)) + (msize.X + _font.Size / 2) * 0.5 * Math.Abs(Math.Cos(alpha));
                    morg = morg + outVector * shift;
                }
                else
                {
                    morg = morg.WithXPlus(outVector.X * _font.Size / 3);
                }

                var mrect = new RectangleD2D(morg, msize);
                if (_automaticRotationShift)
                {
                    AdjustRectangle(ref mrect, StringAlignment.Center, StringAlignment.Center);
                }
                else
                {
                    AdjustRectangle(ref mrect, _horizontalAlignment, _verticalAlignment);
                }

                math.Reset();
                math.Translate((float)morg.X, (float)morg.Y);
                if (_rotation != 0)
                {
                    math.Rotate((float)-_rotation);
                }
                math.Translate((float)(mrect.X - morg.X + emSize * _xOffset), (float)(mrect.Y - morg.Y + emSize * _yOffset));

                System.Drawing.Drawing2D.GraphicsState gs = g.Save();
                g.MultiplyTransform(math);

                if (_backgroundStyle != null)
                {
                    _backgroundStyle.Draw(g, new RectangleD2D(PointD2D.Empty, msize));
                }

                _brush.SetEnvironment(new RectangleD2D(PointD2D.Empty, msize), BrushX.GetEffectiveMaximumResolution(g, 1));
                labels[i].Draw(g, _brush, new PointF(0, 0));
                g.Restore(gs); // Restore the graphics state

                helperPath.Reset();
                helperPath.AddRectangle(new RectangleF(PointF.Empty, (SizeF)msize));
                helperPath.Transform(math);

                _enclosingPath.AddPath(helperPath, true);
            }
        }
Esempio n. 17
0
        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);
                }
            }
        }
Esempio n. 18
0
        public void Paint(Graphics g, IPlotArea layer, Processed2DPlotData pdata, Processed2DPlotData prevItemData, Processed2DPlotData nextItemData)
        {
            if (_connectionStyle is LineConnectionStyles.NoConnection)
            {
                return;
            }

            PointF[] plotPositions = pdata.PlotPointsInAbsoluteLayerCoordinates;

            if (_independentOnShiftingGroupStyles)
            {
                _cachedLogicalShiftX = _cachedLogicalShiftY = 0;
            }

            if (0 != _cachedLogicalShiftX || 0 != _cachedLogicalShiftY)
            {
                plotPositions = Processed2DPlotData.GetPlotPointsInAbsoluteLayerCoordinatesWithShift(pdata, layer, _cachedLogicalShiftX, _cachedLogicalShiftY);
            }

            // ensure that brush and pen are cached
            if (null != _framePen)
            {
                _framePen.Cached = true;
            }

            if (null != _fillBrush)
            {
                _fillBrush.SetEnvironment(new RectangleD2D(PointD2D.Empty, layer.Size), BrushX.GetEffectiveMaximumResolution(g, 1));
            }

            _fillDirection = layer.UpdateCSPlaneID(_fillDirection);

            var gp = new GraphicsPath();

            PlotRangeList rangeList = pdata.RangeList;

            if (_ignoreMissingDataPoints)
            {
                // in case we ignore the missing points, all ranges can be plotted
                // as one range, i.e. continuously
                // for this, we create the totalRange, which contains all ranges
                IPlotRange totalRange = new PlotRangeCompound(rangeList);
                _connectionStyle.FillOneRange(gp, pdata, totalRange, layer, _fillDirection, _ignoreMissingDataPoints, _connectCircular, plotPositions, _cachedLogicalShiftX, _cachedLogicalShiftY);
            }
            else // we not ignore missing points, so plot all ranges separately
            {
                for (int i = 0; i < rangeList.Count; i++)
                {
                    _connectionStyle.FillOneRange(gp, pdata, rangeList[i], layer, _fillDirection, _ignoreMissingDataPoints, _connectCircular, plotPositions, _cachedLogicalShiftX, _cachedLogicalShiftY);
                }
            }

            g.FillPath(_fillBrush, gp);

            g.DrawPath(_framePen, gp);
        }