Ejemplo n.º 1
0
        public void CopyFrom(DropAreaPlotStyle from, Main.EventFiring eventFiring)
        {
            if (object.ReferenceEquals(this, from))
            {
                return;
            }

            using (var suspendToken = SuspendGetToken())
            {
                _connectionStyle                  = from._connectionStyle;
                _connectCircular                  = from._connectCircular;
                _ignoreMissingDataPoints          = from._ignoreMissingDataPoints;
                _independentOnShiftingGroupStyles = from._independentOnShiftingGroupStyles;

                _fillDirection = from._fillDirection;
                _fillRule      = from._fillRule;
                ChildCopyToMember(ref _fillBrush, from._fillBrush);
                _fillColorLinkage = from._fillColorLinkage;
                ChildCopyToMember(ref _framePen, from._framePen);
                _frameColorLinkage = from._frameColorLinkage;

                EhSelfChanged();

                suspendToken.Resume(eventFiring);
            }
        }
Ejemplo n.º 2
0
 public CSPlaneInformation GetPlaneInformation(CSPlaneID planeID)
 {
     return(new CSPlaneInformation(planeID)
     {
         Name = GetNameOfPlane(planeID)
     });
 }
Ejemplo n.º 3
0
        }                                                                    // not used here


        void Initialize(bool bInit)
        {
            if (bInit)
            {
                _font             = _doc.Font;
                _independentColor = _doc.IndependentColor;
                _color            = _doc.Color;

                _horizontalAlignment = _doc.HorizontalAlignment;
                _verticalAlignment   = _doc.VerticalAlignment;
                _attachToEdge        = _doc.AttachedAxis != null;
                _attachedEdge        = _doc.AttachedAxis;
                _xOffset             = _doc.XOffset;
                _yOffset             = _doc.YOffset;
                _labelColumn         = _doc.LabelColumn;
                _backgroundStyle     = _doc.BackgroundStyle;
            }

            if (null != View)
            {
                View.Font_Initialize(_font);
                View.IndependentColor_Initialize(_independentColor);
                View.Color_Initialize(_color);
                View.HorizontalAlignment_Initialize(System.Enum.GetNames(typeof(System.Drawing.StringAlignment)), System.Enum.GetName(typeof(System.Drawing.StringAlignment), _horizontalAlignment));
                View.VerticalAlignment_Initialize(System.Enum.GetNames(typeof(System.Drawing.StringAlignment)), System.Enum.GetName(typeof(System.Drawing.StringAlignment), _verticalAlignment));
                View.AttachToAxis_Initialize(_attachToEdge);
                SetAttachmentDirection();
                View.Rotation = (float)_doc.Rotation;
                View.XOffset_Initialize(Serialization.NumberConversion.ToString(_xOffset * 100));
                View.YOffset_Initialize(Serialization.NumberConversion.ToString(_yOffset * 100));
                View.Background = _backgroundStyle;

                InitializeLabelColumnText();
            }
        }
Ejemplo n.º 4
0
        private void SetCoordinateSystemDependentObjects(CSLineID id)
        {
            // Scales
            _listOfScales = new SelectableListNodeList
            {
                new SelectableListNode("Z-Scale", 0, false)
            };

            // Axes
            // collect the AxisStyleIdentifier from the actual layer and also all possible AxisStyleIdentifier
            _axisControl = new Dictionary <CSLineID, AxisStyleControllerConditionalGlue>();
            _listOfAxes  = new SelectableListNodeList();
            foreach (CSLineID ids in _doc.CoordinateSystem.GetJoinedAxisStyleIdentifier(_doc.AxisStyles.AxisStyleIDs, new CSLineID[] { id }))
            {
                CSAxisInformation info = _doc.CoordinateSystem.GetAxisStyleInformation(ids);
                var axisInfo           = new AxisStyleControllerConditionalGlue(info, _doc.AxisStyles);
                _axisControl.Add(info.Identifier, axisInfo);
                _listOfAxes.Add(new SelectableListNode(info.NameOfAxisStyle, info.Identifier, false));
            }

            // Planes
            _listOfPlanes   = new SelectableListNodeList();
            _currentPlaneID = CSPlaneID.Front;
            _listOfPlanes.Add(new SelectableListNode("Front", _currentPlaneID, true));
        }
Ejemplo n.º 5
0
 void CopyFrom(GridPlane from)
 {
     this._planeID        = from._planeID;
     this.GridStyleFirst  = from._grid1 == null ? null : (GridStyle)from._grid1.Clone();
     this.GridStyleSecond = from._grid2 == null ? null : (GridStyle)from._grid2.Clone();
     this.Background      = from._background == null ? null : (BrushX)from._background.Clone();
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Template to get a fill path.
        /// </summary>
        /// <param name="gp">Graphics path to fill with data.</param>
        /// <param name="pdata">The plot data. Don't use the Range property of the pdata, since it is overriden by the next argument.</param>
        /// <param name="range">The plot range to use.</param>
        /// <param name="layer">Graphics layer.</param>
        /// <param name="fillDirection">Designates a bound to fill to.</param>
        /// <param name="linePoints">The points that mark the line.</param>
        /// <param name="connectCircular">If true, a circular connection is drawn.</param>
        private void FillOneRange_PreprocessedPoints(
            GraphicsPath gp,
            Processed2DPlotData pdata,
            IPlotRange range,
            IPlotArea layer,
            CSPlaneID fillDirection,
            PointF[] linePoints,
            bool connectCircular,
            double logicalShiftX,
            double logicalShiftY
            )
        {
            if (connectCircular)
            {
                gp.AddBeziers(linePoints);
                gp.CloseFigure();
            }
            else
            {
                Logical3D r0 = layer.GetLogical3D(pdata, range.OriginalFirstPoint);
                r0.RX += logicalShiftX;
                r0.RY += logicalShiftY;
                layer.CoordinateSystem.GetIsolineFromPlaneToPoint(gp, fillDirection, r0);
                gp.AddBeziers(linePoints);

                Logical3D r1 = layer.GetLogical3D(pdata, range.GetOriginalRowIndexFromPlotPointIndex(range.LowerBound + linePoints.Length - 1));
                r1.RX += logicalShiftX;
                r1.RY += logicalShiftY;

                layer.CoordinateSystem.GetIsolineFromPointToPlane(gp, r1, fillDirection);
                layer.CoordinateSystem.GetIsolineOnPlane(gp, fillDirection, r1, r0);

                gp.CloseFigure();
            }
        }
Ejemplo n.º 7
0
        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);
                }
            }
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
0
        public CSPlaneInformation GetPlaneInformation(CSPlaneID planeID)
        {
            CSLineID          lineID   = (CSLineID)planeID;
            CSAxisInformation lineInfo = GetAxisStyleInformation(lineID);

            CSPlaneInformation result = new CSPlaneInformation(planeID);

            result.Name = lineInfo.NameOfAxisStyle;
            return(result);
        }
Ejemplo n.º 10
0
 public DropAreaPlotStyle(ILineConnectionStyle connection, bool ignoreMissingDataPoints, bool connectCircular, CSPlaneID direction, BrushX fillBrush, ColorLinkage fillColorLinkage)
 {
     _connectionStyle         = connection;
     _ignoreMissingDataPoints = ignoreMissingDataPoints;
     _connectCircular         = connectCircular;
     _fillDirection           = direction;
     _fillColorLinkage        = fillColorLinkage;
     ChildCopyToMember(ref _fillBrush, fillBrush);
     ChildSetMember(ref _framePen, new PenX(NamedColors.Transparent, 1));
 }
Ejemplo n.º 11
0
            protected virtual GridPlane SDeserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                CSPlaneID id = (CSPlaneID)info.GetValue("ID", null);
                GridPlane s  = (o == null ? new GridPlane(id) : (GridPlane)o);

                s.GridStyleFirst  = (GridStyle)info.GetValue("Grid1", s);
                s.GridStyleSecond = (GridStyle)info.GetValue("Grid2", s);
                s.Background      = (BrushX)info.GetValue("Background", s);

                return(s);
            }
Ejemplo n.º 12
0
 public bool Contains(CSPlaneID planeid)
 {
     foreach (GridPlane plane in _innerList)
     {
         if (plane.PlaneID == planeid)
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 13
0
        public DropLinePlotStyle(CSPlaneID planeID, PenX3D pen)
        {
            if (null == pen)
            {
                throw new ArgumentNullException(nameof(pen));
            }

            _dropTargets = new CSPlaneIDList(new[] { planeID });

            // Cached values
            SetCachedValues();
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Template to get a fill path.
 /// </summary>
 /// <param name="gp">Graphics path to fill with data.</param>
 /// <param name="pdata">The plot data. Do not use the plot point positions from here, since they are not shifted when shifting group styles are present.</param>
 /// <param name="range">The plot range to use.</param>
 /// <param name="layer">Graphics layer.</param>
 /// <param name="fillDirection">Designates a bound to fill to.</param>
 /// <param name="ignoreMissingDataPoints">If true, missing data points are ignored.</param>
 /// <param name="connectCircular">If true, the line is connected circular, and the area is the polygon inside of that circular connection.</param>
 /// <param name="allLinePointsShiftedAlready">The plot positions, already shifted when a logical shift needed to be applied. Don't use the Range property of the pdata, since it is overriden by the next argument.</param>
 /// <param name="logicalShiftX">The logical shift in x-direction.</param>
 /// <param name="logicalShiftY">The logical shift in x-direction.</param>
 public abstract void FillOneRange(
     GraphicsPath gp,
     Processed2DPlotData pdata,
     IPlotRange range,
     IPlotArea layer,
     CSPlaneID fillDirection,
     bool ignoreMissingDataPoints,
     bool connectCircular,
     PointF[] allLinePointsShiftedAlready,
     double logicalShiftX,
     double logicalShiftY
     );
Ejemplo n.º 15
0
        private void CopyFrom(GridPlane from)
        {
            if (object.ReferenceEquals(this, from))
            {
                return;
            }

            _planeID        = from._planeID;
            GridStyleFirst  = from._grid1 == null ? null : (GridStyle)from._grid1.Clone();
            GridStyleSecond = from._grid2 == null ? null : (GridStyle)from._grid2.Clone();
            Background      = from._background;
        }
Ejemplo n.º 16
0
        public static VectorD2D GetUntransformedAxisPlaneVector(CSPlaneID id)
        {
            switch (id.PerpendicularAxisNumber)
            {
            case 0: // perpendicular axis is X
                return(new VectorD2D(1, 0));

            case 1: // perpendicular axis is Y
                return(new VectorD2D(0, 1));

            default:
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 17
0
        public override string GetNameOfPlane(CSPlaneID planeId)
        {
            var uv = GetUntransformedAxisPlaneVector(planeId);
            var tv = uv;

            var lv = planeId.LogicalValue;

            if (tv.X == -1 || tv.Y == -1)
            {
                lv = 1 - lv;
            }
            string name = "";

            if (Math.Abs(tv.X) == 1)
            {
                if (lv == 0)
                {
                    name = "Left";
                }
                else if (lv == 1)
                {
                    name = "Right";
                }
                else
                {
                    name = string.Format("{0}% between left and right", lv * 100);
                }
            }
            else if (Math.Abs(tv.Y) == 1)
            {
                if (lv == 0)
                {
                    name = "Front";
                }
                else if (lv == 1)
                {
                    name = "Back";
                }
                else
                {
                    name = string.Format("{0}% between front and back", lv * 100);
                }
            }
            else
            {
                throw new NotImplementedException();
            }

            return(name);
        }
Ejemplo n.º 18
0
        public DropAreaPlotStyle(Altaxo.Main.Properties.IReadOnlyPropertyBag context)
        {
            var penWidth = GraphDocument.GetDefaultPenWidth(context);
            var color    = GraphDocument.GetDefaultPlotColor(context);

            ChildSetMember(ref _framePen, new PenX(NamedColors.Transparent, penWidth)
            {
                LineJoin = LineJoin.Bevel
            });
            _ignoreMissingDataPoints = false;
            ChildSetMember(ref _fillBrush, new BrushX(color));
            _fillDirection   = new CSPlaneID(1, 0);
            _connectionStyle = LineConnectionStyles.StraightConnection.Instance;
        }
Ejemplo n.º 19
0
 /// <summary>
 /// Draws an isoline on a plane beginning from r0 to r1. For r0,r1 either ry0,ry1 is used (if it is an x-axis),
 /// otherwise rx0,rx1 is used. The other parameter pair is not used.
 /// </summary>
 /// <param name="path">Graphics path to fill with the isoline.</param>
 /// <param name="r0">Logical coordinate of the start point.</param>
 /// <param name="r1">Logical coordinate of the end point.</param>
 /// <param name="id">The axis to end the isoline.</param>
 public virtual void GetIsolineOnPlane(CSPlaneID id, Logical3D r0, Logical3D r1, IPolylineD3D path)
 {
     if (id.PerpendicularAxisNumber == 0)
     {
         path = GetIsoline(new Logical3D(id.LogicalValue, r0.RY, r0.RZ), new Logical3D(id.LogicalValue, r1.RY, r1.RZ));
     }
     else if (id.PerpendicularAxisNumber == 1)
     {
         path = GetIsoline(new Logical3D(r0.RX, id.LogicalValue, r0.RZ), new Logical3D(r1.RX, id.LogicalValue, r1.RZ));
     }
     else
     {
         path = GetIsoline(new Logical3D(r0.RX, r0.RY, id.LogicalValue), new Logical3D(r1.RX, r1.RY, id.LogicalValue));
     }
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Gets an isoline beginning from a given point to the axis.
 /// </summary>
 /// <param name="path">Graphics path to fill with the isoline.</param>
 /// <param name="r">Logical coordinate of the start point.</param>
 /// <param name="id">The logical plane to end the isoline.</param>
 public virtual void GetIsolineFromPointToPlane(Logical3D r, CSPlaneID id, out IPolylineD3D path)
 {
     if (id.PerpendicularAxisNumber == 0)
     {
         path = GetIsoline(r, new Logical3D(id.LogicalValue, r.RY, r.RZ));
     }
     else if (id.PerpendicularAxisNumber == 1)
     {
         path = GetIsoline(r, new Logical3D(r.RX, id.LogicalValue, r.RZ));
     }
     else
     {
         path = GetIsoline(r, new Logical3D(r.RX, r.RY, id.LogicalValue));
     }
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Draws an isoline on a plane beginning from r0 to r1. For r0,r1 either ry0,ry1 is used (if it is an x-axis),
 /// otherwise rx0,rx1 is used. The other parameter pair is not used.
 /// </summary>
 /// <param name="path">Graphics path to fill with the isoline.</param>
 /// <param name="r0">Logical coordinate of the start point.</param>
 /// <param name="r1">Logical coordinate of the end point.</param>
 /// <param name="id">The axis to end the isoline.</param>
 public virtual void GetIsolineOnPlane(GraphicsPath path, CSPlaneID id, Logical3D r0, Logical3D r1)
 {
     if (id.PerpendicularAxisNumber == 0)
     {
         GetIsoline(path, new Logical3D(id.LogicalValue, r0.RY, r0.RZ), new Logical3D(id.LogicalValue, r1.RY, r1.RZ));
     }
     else if (id.PerpendicularAxisNumber == 1)
     {
         GetIsoline(path, new Logical3D(r0.RX, id.LogicalValue, r0.RZ), new Logical3D(r1.RX, id.LogicalValue, r1.RZ));
     }
     else
     {
         GetIsoline(path, new Logical3D(r0.RX, r0.RY, id.LogicalValue), new Logical3D(r1.RX, r1.RY, id.LogicalValue));
     }
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Draws an isoline beginning from a plane to the given point.
 /// </summary>
 /// <param name="path">Graphics path to fill with the isoline.</param>
 /// <param name="id">The logical plane to start drawing from.</param>
 /// <param name="r">Logical coordinates of the end point.</param>
 public virtual void GetIsolineFromPlaneToPoint(GraphicsPath path, CSPlaneID id, Logical3D r)
 {
     if (id.PerpendicularAxisNumber == 0)
     {
         GetIsoline(path, new Logical3D(id.LogicalValue, r.RY, r.RZ), r);
     }
     else if (id.PerpendicularAxisNumber == 1)
     {
         GetIsoline(path, new Logical3D(r.RX, id.LogicalValue, r.RZ), r);
     }
     else
     {
         GetIsoline(path, new Logical3D(r.RX, r.RY, id.LogicalValue), r);
     }
 }
Ejemplo n.º 23
0
        /// <inheritdoc/>
        public override void FillOneRange(
            GraphicsPath gp,
            Processed2DPlotData pdata,
            IPlotRange range,
            IPlotArea layer,
            CSPlaneID fillDirection,
            bool ignoreMissingDataPoints,
            bool connectCircular,
            PointF[] allLinePointsShiftedAlready,
            double logicalShiftX,
            double logicalShiftY
            )
        {
            if (range.Length < 2)
            {
                return;
            }

            PointF[] linePoints = Segment2Connection_GetSubPoints(allLinePointsShiftedAlready, range, layer, connectCircular, out var lastIdx);

            if (connectCircular)
            {
                gp.AddLines(linePoints);
                gp.CloseFigure();
            }
            else
            {
                int offs = range.LowerBound;
                for (int i = 0; i < linePoints.Length - 1; i += 2)
                {
                    Logical3D r0 = layer.GetLogical3D(pdata, range.GetOriginalRowIndexFromPlotPointIndex(range.LowerBound + i));
                    r0.RX += logicalShiftX;
                    r0.RY += logicalShiftY;

                    layer.CoordinateSystem.GetIsolineFromPlaneToPoint(gp, fillDirection, r0);
                    gp.AddLine(linePoints[i].X, linePoints[i].Y, linePoints[i + 1].X, linePoints[i + 1].Y);
                    Logical3D r1 = layer.GetLogical3D(pdata, range.GetOriginalRowIndexFromPlotPointIndex(range.LowerBound + i + 1));
                    r1.RX += logicalShiftX;
                    r1.RY += logicalShiftY;

                    layer.CoordinateSystem.GetIsolineFromPointToPlane(gp, r1, fillDirection);
                    layer.CoordinateSystem.GetIsolineOnPlane(gp, fillDirection, r1, r0);
                    gp.StartFigure();
                }

                gp.CloseFigure();
            }
        }
Ejemplo n.º 24
0
        public LabelPlotStyle(LabelPlotStyle from)
        {
            this._font               = (Font)from._font.Clone();
            this._independentColor   = from._independentColor;
            this._brush              = (BrushX)from._brush.Clone();
            this._xOffset            = from._xOffset;
            this._yOffset            = from._yOffset;
            this._rotation           = from._rotation;
            this._backgroundStyle    = null == from._backgroundStyle ? null : (IBackgroundStyle)from._backgroundStyle.Clone();
            this._cachedStringFormat = (System.Drawing.StringFormat)from._cachedStringFormat.Clone();
            this._attachedPlane      = null == from._attachedPlane ? null : from._attachedPlane.Clone();
            this._labelColumn        = (Altaxo.Data.ReadableColumnProxy)from._labelColumn.Clone();
            this._parent             = from._parent;

            CreateEventChain();
        }
Ejemplo n.º 25
0
        public LabelPlotStyle(Altaxo.Data.IReadableColumn labelColumn)
        {
            this._font                             = new Font(System.Drawing.FontFamily.GenericSansSerif, 8, GraphicsUnit.World);
            this._independentColor                 = false;
            this._brush                            = new BrushX(Color.Black);
            this._xOffset                          = 0;
            this._yOffset                          = 0;
            this._rotation                         = 0;
            this._backgroundStyle                  = null;
            this._cachedStringFormat               = new StringFormat(StringFormatFlags.NoWrap);
            this._cachedStringFormat.Alignment     = System.Drawing.StringAlignment.Center;
            this._cachedStringFormat.LineAlignment = System.Drawing.StringAlignment.Center;
            this._attachedPlane                    = null;
            this._labelColumn                      = new Altaxo.Data.ReadableColumnProxy(labelColumn);

            CreateEventChain();
        }
Ejemplo n.º 26
0
        LayerController(XYPlotLayer layer, string currentPage, int axisScaleIdx, CSLineID id)
        {
            _originalDoc    = layer;
            _doc            = (XYPlotLayer)layer.Clone();
            _docSuspendLock = _doc.BeginUpdate();

            SetCoordinateSystemDependentObjects(id);

            _currentScale    = axisScaleIdx;
            _currentAxisID   = id;
            _currentPlaneID  = CSPlaneID.Front;
            _currentPageName = currentPage;
            if (null != View)
            {
                SetViewElements();
            }
        }
Ejemplo n.º 27
0
        /// <inheritdoc/>
        public override void FillOneRange(
            GraphicsPath gp,
            Processed2DPlotData pdata,
            IPlotRange range,
            IPlotArea layer,
            CSPlaneID fillDirection,
            bool ignoreMissingDataPoints,
            bool connectCircular,
            PointF[] allLinePoints,
            double logicalShiftX,
            double logicalShiftY
            )
        {
            if (range.Length < 4)
            {
                return;
            }

            if (connectCircular)
            {
                var circularLinePointsLengthM1 = 2 + TrimToValidBezierLength(range.Length);
                var circularLinePoints         = new PointF[circularLinePointsLengthM1 + 1];
                Array.Copy(allLinePoints, range.LowerBound, circularLinePoints, 0, range.Length); // Extract
                circularLinePoints[circularLinePointsLengthM1] = circularLinePoints[0];

                // amend missing control points
                if (circularLinePointsLengthM1 - range.Length >= 1)
                {
                    circularLinePoints[circularLinePointsLengthM1 - 1] = GdiExtensionMethods.Interpolate(circularLinePoints[circularLinePointsLengthM1 - 3], circularLinePoints[circularLinePointsLengthM1], 0.5); // Last Control point should be halfway between
                }
                if (circularLinePointsLengthM1 - range.Length >= 2)
                {
                    circularLinePoints[circularLinePointsLengthM1 - 2] = GdiExtensionMethods.Interpolate(circularLinePoints[circularLinePointsLengthM1 - 3], circularLinePoints[circularLinePointsLengthM1], 0.5); // Middle Control point should be halfway between previous fixed point and last(=first) fixed point
                }
                FillOneRange_PreprocessedPoints(gp, pdata, range, layer, fillDirection, circularLinePoints, connectCircular, logicalShiftX, logicalShiftY);
            }
            else
            {
                var trimmedLinePointsLength = TrimToValidBezierLength(range.Length);
                var trimmedLinePoints       = new PointF[trimmedLinePointsLength];
                Array.Copy(allLinePoints, range.LowerBound, trimmedLinePoints, 0, trimmedLinePointsLength); // Extract
                FillOneRange_PreprocessedPoints(gp, pdata, range, layer, fillDirection, trimmedLinePoints, connectCircular, logicalShiftX, logicalShiftY);
            }
        }
Ejemplo n.º 28
0
        public IEnumerable <CSPlaneID> GetJoinedPlaneIdentifier(IEnumerable <CSLineID> list1, IEnumerable <CSPlaneID> list2)
        {
            var set = new HashSet <CSPlaneID>();

            foreach (CSAxisInformation info in AxisStyles)
            {
                foreach (var planeID in CSPlaneID.GetPlanesParallelToAxis3D(info.Identifier))
                {
                    if (!set.Contains(planeID))
                    {
                        set.Add(planeID);
                        yield return(planeID);
                    }
                }
            }

            if (list1 != null)
            {
                foreach (CSLineID lineID in list1)
                {
                    foreach (var planeID in CSPlaneID.GetPlanesParallelToAxis3D(lineID))
                    {
                        if (!set.Contains(planeID))
                        {
                            set.Add(planeID);
                            yield return(planeID);
                        }
                    }
                }
            }

            if (list2 != null)
            {
                foreach (CSPlaneID planeID in list2)
                {
                    if (null != planeID && !set.Contains(planeID))
                    {
                        set.Add(planeID);
                        yield return(planeID);
                    }
                }
            }
        }
Ejemplo n.º 29
0
        public PointD3D GetPointOnPlane(CSPlaneID id, double logicalFirstOther, double logicalSecondOther)
        {
            PointD3D result;

            if (id.PerpendicularAxisNumber == 0)
            {
                LogicalToLayerCoordinates(new Logical3D(id.LogicalValue, logicalFirstOther, logicalSecondOther), out result);
            }
            else if (id.PerpendicularAxisNumber == 1)
            {
                LogicalToLayerCoordinates(new Logical3D(logicalFirstOther, id.LogicalValue, logicalSecondOther), out result);
            }
            else
            {
                LogicalToLayerCoordinates(new Logical3D(logicalFirstOther, logicalSecondOther, id.LogicalValue), out result);
            }

            return(result);
        }
Ejemplo n.º 30
0
        /// <inheritdoc/>
        public override void FillOneRange(
            GraphicsPath gp,
            Processed2DPlotData pdata,
            IPlotRange range,
            IPlotArea layer,
            CSPlaneID fillDirection,
            bool ignoreMissingDataPoints,
            bool connectCircular,
            PointF[] allLinePoints,
            double logicalShiftX,
            double logicalShiftY
            )
        {
            var circularLinePoints = new PointF[range.Length + (connectCircular ? 1 : 0)];

            Array.Copy(allLinePoints, range.LowerBound, circularLinePoints, 0, range.Length); // Extract
            if (connectCircular)
            {
                circularLinePoints[circularLinePoints.Length - 1] = circularLinePoints[0];
            }

            if (connectCircular)
            {
                gp.AddLines(circularLinePoints);
                gp.CloseFigure();
            }
            else // not circular
            {
                Logical3D r0 = layer.GetLogical3D(pdata, range.OriginalFirstPoint);
                r0.RX += logicalShiftX;
                r0.RY += logicalShiftY;

                layer.CoordinateSystem.GetIsolineFromPlaneToPoint(gp, fillDirection, r0);
                gp.AddLines(circularLinePoints);
                Logical3D r1 = layer.GetLogical3D(pdata, connectCircular ? range.OriginalFirstPoint : range.OriginalLastPoint);
                r1.RX += logicalShiftX;
                r1.RY += logicalShiftY;

                layer.CoordinateSystem.GetIsolineFromPointToPlane(gp, r1, fillDirection);
                layer.CoordinateSystem.GetIsolineOnPlane(gp, fillDirection, r1, r0);
                gp.CloseFigure();
            }
        }
Ejemplo n.º 31
0
		/// <inheritdoc/>
		public override void FillOneRange(
		GraphicsPath gp,
			Processed2DPlotData pdata,
			IPlotRange range,
			IPlotArea layer,
			CSPlaneID fillDirection,
			bool ignoreMissingDataPoints,
			bool connectCircular,
			PointF[] allLinePoints,
			double logicalShiftX,
			double logicalShiftY
		)
		{
			PointF[] circularLinePoints = new PointF[range.Length + (connectCircular ? 1 : 0)];
			Array.Copy(allLinePoints, range.LowerBound, circularLinePoints, 0, range.Length); // Extract
			if (connectCircular)
				circularLinePoints[circularLinePoints.Length - 1] = circularLinePoints[0];

			if (connectCircular)
			{
				gp.AddLines(circularLinePoints);
				gp.CloseFigure();
			}
			else // not circular
			{
				Logical3D r0 = layer.GetLogical3D(pdata, range.OriginalFirstPoint);
				r0.RX += logicalShiftX;
				r0.RY += logicalShiftY;

				layer.CoordinateSystem.GetIsolineFromPlaneToPoint(gp, fillDirection, r0);
				gp.AddLines(circularLinePoints);
				Logical3D r1 = layer.GetLogical3D(pdata, connectCircular ? range.OriginalFirstPoint : range.OriginalLastPoint);
				r1.RX += logicalShiftX;
				r1.RY += logicalShiftY;

				layer.CoordinateSystem.GetIsolineFromPointToPlane(gp, r1, fillDirection);
				layer.CoordinateSystem.GetIsolineOnPlane(gp, fillDirection, r1, r0);
				gp.CloseFigure();
			}
		}
Ejemplo n.º 32
0
		public abstract string GetNameOfPlane(CSPlaneID planeId);
Ejemplo n.º 33
0
		/// <summary>
		/// Draws an isoline beginning from a given point to the axis.
		/// </summary>
		/// <param name="path">Graphics path to fill with the isoline.</param>
		/// <param name="r">Logical coordinate of the start point.</param>
		/// <param name="id">The logical plane to end the isoline.</param>
		public virtual void GetIsolineFromPointToPlane(GraphicsPath path, Logical3D r, CSPlaneID id)
		{
			if (id.PerpendicularAxisNumber == 0)
			{
				GetIsoline(path, r, new Logical3D(id.LogicalValue, r.RY, r.RZ));
			}
			else if (id.PerpendicularAxisNumber == 1)
			{
				GetIsoline(path, r, new Logical3D(r.RX, id.LogicalValue, r.RZ));
			}
			else
			{
				GetIsoline(path, r, new Logical3D(r.RX, r.RY, id.LogicalValue));
			}
		}
Ejemplo n.º 34
0
 /// <summary>
 /// Updates the logical value of a plane id in case it uses a physical value.
 /// </summary>
 /// <param name="id">The plane identifier</param>
 public void UpdateCSPlaneID(CSPlaneID id)
 {
   if (id.UsePhysicalValue)
   {
     double l = this.LinkedScales.Scale(id.PerpendicularAxisNumber).PhysicalVariantToNormal(id.PhysicalValue);
     id.LogicalValue = l;
   }
 }
Ejemplo n.º 35
0
		public void CopyFrom(DropAreaPlotStyle from, Main.EventFiring eventFiring)
		{
			if (object.ReferenceEquals(this, from))
				return;

			using (var suspendToken = SuspendGetToken())
			{
				this._connectionStyle = from._connectionStyle;
				this._connectCircular = from._connectCircular;
				this._ignoreMissingDataPoints = from._ignoreMissingDataPoints;
				this._independentOnShiftingGroupStyles = from._independentOnShiftingGroupStyles;

				this._fillDirection = from._fillDirection;
				this._fillRule = from._fillRule;
				ChildCopyToMember(ref _fillBrush, from._fillBrush);
				this._fillColorLinkage = from._fillColorLinkage;
				ChildCopyToMember(ref _framePen, from._framePen);
				this._frameColorLinkage = from._frameColorLinkage;

				EhSelfChanged();

				suspendToken.Resume(eventFiring);
			}
		}
Ejemplo n.º 36
0
		public PointD2D GetPointOnPlane(CSPlaneID id, Logical3D r)
		{
			double x, y;
			if (id.PerpendicularAxisNumber == 0)
				LogicalToLayerCoordinates(new Logical3D(id.LogicalValue, r.RY, r.RZ), out x, out y);
			else if (id.PerpendicularAxisNumber == 1)
				LogicalToLayerCoordinates(new Logical3D(r.RX, id.LogicalValue, r.RZ), out x, out y);
			else
				LogicalToLayerCoordinates(new Logical3D(r.RX, r.RY, id.LogicalValue), out x, out y);

			return new PointD2D(x, y);
		}
Ejemplo n.º 37
0
		public void Paint(IGraphicsContext3D g, IPlotArea layer, Processed3DPlotData pdata, Processed3DPlotData prevItemData, Processed3DPlotData nextItemData)
		{
			PlotRangeList rangeList = pdata.RangeList;
			var ptArray = pdata.PlotPointsInAbsoluteLayerCoordinates;

			// adjust the skip frequency if it was not set appropriate
			if (_skipFreq <= 0)
				_skipFreq = 1;

			var dropTargets = new List<CSPlaneID>(_dropTargets.Select(id => layer.UpdateCSPlaneID(id)));
			if (_additionalDropTargetIsEnabled)
			{
				CSPlaneID userPlane;
				if (_additionalDropTargetUsePhysicalBaseValue)
				{
					userPlane = new CSPlaneID(_additionalDropTargetPerpendicularAxis, layer.Scales[_additionalDropTargetPerpendicularAxis].PhysicalVariantToNormal(_additionalDropTargetBaseValue));
				}
				else
				{
					userPlane = new CSPlaneID(_additionalDropTargetPerpendicularAxis, _additionalDropTargetBaseValue);
				}
				dropTargets.Add(userPlane);
			}

			// paint the scatter style

			PointD3D pos = PointD3D.Empty;

			if (null == _cachedSymbolSizeForIndexFunction && null == _cachedColorForIndexFunction) // using a constant symbol size and constant color
			{
				var pen = _pen;
				// update pen widths
				double w1 = _lineWidth1Offset + _lineWidth1Factor * _cachedSymbolSize;
				double w2 = _lineWidth2Offset + _lineWidth2Factor * _cachedSymbolSize;
				pen = pen.WithThickness1(w1).WithThickness2(w2);

				var gapStart = 0.5 * (_gapAtStartOffset + _gapAtStartFactor * _cachedSymbolSize);
				var gapEnd = 0.5 * (_gapAtEndOffset + _gapAtEndFactor * _cachedSymbolSize);

				for (int r = 0; r < rangeList.Count; r++)
				{
					var range = rangeList[r];
					int lower = range.LowerBound;
					int upper = range.UpperBound;

					for (int j = lower; j < upper; j += _skipFreq)
					{
						Logical3D r3d = layer.GetLogical3D(pdata, j + range.OffsetToOriginal);
						foreach (CSPlaneID id in dropTargets)
						{
							IPolylineD3D isoLine;
							layer.CoordinateSystem.GetIsolineFromPointToPlane(r3d, id, out isoLine);
							if (gapStart != 0 || gapEnd != 0)
								isoLine = isoLine.ShortenedBy(RADouble.NewAbs(gapStart), RADouble.NewAbs(gapEnd));

							if (null != isoLine)
								g.DrawLine(pen, isoLine);
						}
					}
				} // for each range
			}
			else // using a variable symbol size or variable symbol color
			{
				for (int r = 0; r < rangeList.Count; r++)
				{
					var range = rangeList[r];
					int lower = range.LowerBound;
					int upper = range.UpperBound;
					int offset = range.OffsetToOriginal;
					for (int j = lower; j < upper; j += _skipFreq)
					{
						var pen = _pen;
						if (null == _cachedColorForIndexFunction)
						{
							_cachedSymbolSize = _cachedSymbolSizeForIndexFunction(j + offset);
							double w1 = _lineWidth1Offset + _lineWidth1Factor * _cachedSymbolSize;
							double w2 = _lineWidth2Offset + _lineWidth2Factor * _cachedSymbolSize;
							pen = _pen.WithThickness1(w1).WithThickness2(w2);
						}
						else
						{
							_cachedSymbolSize = null == _cachedSymbolSizeForIndexFunction ? _cachedSymbolSize : _cachedSymbolSizeForIndexFunction(j + offset);
							double w1 = _lineWidth1Offset + _lineWidth1Factor * _cachedSymbolSize;
							double w2 = _lineWidth2Offset + _lineWidth2Factor * _cachedSymbolSize;

							var customSymbolColor = _cachedColorForIndexFunction(j + offset);
							pen = _pen.WithThickness1(w1).WithThickness2(w2).WithColor(NamedColor.FromArgb(customSymbolColor.A, customSymbolColor.R, customSymbolColor.G, customSymbolColor.B));
						}

						var gapStart = 0.5 * (_gapAtStartOffset + _gapAtStartFactor * _cachedSymbolSize);
						var gapEnd = 0.5 * (_gapAtEndOffset + _gapAtEndFactor * _cachedSymbolSize);

						Logical3D r3d = layer.GetLogical3D(pdata, j + rangeList[r].OffsetToOriginal);
						foreach (CSPlaneID id in _dropTargets)
						{
							IPolylineD3D isoLine;
							layer.CoordinateSystem.GetIsolineFromPointToPlane(r3d, id, out isoLine);

							if (gapStart != 0 || gapEnd != 0)
								isoLine = isoLine.ShortenedBy(RADouble.NewAbs(gapStart), RADouble.NewAbs(gapEnd));
							if (null != isoLine)
								g.DrawLine(pen, isoLine);
						}
					}
				}
			}
		}
Ejemplo n.º 38
0
		/// <inheritdoc/>
		public override void FillOneRange(
		GraphicsPath gp,
			Processed2DPlotData pdata,
			IPlotRange rangeRaw,
			IPlotArea layer,
			CSPlaneID fillDirection,
			bool ignoreMissingDataPoints,
			bool connectCircular,
			PointF[] allLinePointsShiftedAlready,
			double logicalShiftX,
			double logicalShiftY
		)
		{
		}
Ejemplo n.º 39
0
		/// <summary>
		/// Draws an isoline on a plane beginning from r0 to r1. For r0,r1 either ry0,ry1 is used (if it is an x-axis),
		/// otherwise rx0,rx1 is used. The other parameter pair is not used.
		/// </summary>
		/// <param name="path">Graphics path to fill with the isoline.</param>
		/// <param name="r0">Logical coordinate of the start point.</param>
		/// <param name="r1">Logical coordinate of the end point.</param>
		/// <param name="id">The axis to end the isoline.</param>
		public virtual void GetIsolineOnPlane(GraphicsPath path, CSPlaneID id, Logical3D r0, Logical3D r1)
		{
			if (id.PerpendicularAxisNumber == 0)
			{
				GetIsoline(path, new Logical3D(id.LogicalValue, r0.RY, r0.RZ), new Logical3D(id.LogicalValue, r1.RY, r1.RZ));
			}
			else if (id.PerpendicularAxisNumber == 1)
			{
				GetIsoline(path, new Logical3D(r0.RX, id.LogicalValue, r0.RZ), new Logical3D(r1.RX, id.LogicalValue, r1.RZ));
			}
			else
			{
				GetIsoline(path, new Logical3D(r0.RX, r0.RY, id.LogicalValue), new Logical3D(r1.RX, r1.RY, id.LogicalValue));
			}
		}
Ejemplo n.º 40
0
		private void PaintOneRange(Graphics g, IPlotArea layer, IPlotRange range, Processed2DPlotData pdata)
		{
			// adjust the skip frequency if it was not set appropriate
			if (_skipFrequency <= 0)
				_skipFrequency = 1;

			var dropTargets = new List<CSPlaneID>(_dropTargets.Select(id => layer.UpdateCSPlaneID(id)));
			if (_additionalDropTargetIsEnabled)
			{
				CSPlaneID userPlane;
				if (_additionalDropTargetUsePhysicalBaseValue)
				{
					userPlane = new CSPlaneID(_additionalDropTargetPerpendicularAxis, layer.Scales[_additionalDropTargetPerpendicularAxis].PhysicalVariantToNormal(_additionalDropTargetBaseValue));
				}
				else
				{
					userPlane = new CSPlaneID(_additionalDropTargetPerpendicularAxis, _additionalDropTargetBaseValue);
				}
				dropTargets.Add(userPlane);
			}

			// paint the scatter style

			PointD3D pos = PointD3D.Empty;
			var gpath = new GraphicsPath();

			if (null == _cachedSymbolSizeForIndexFunction && null == _cachedColorForIndexFunction) // using a constant symbol size and constant color
			{
				// update pen widths
				var pen = _pen.Clone();
				double w1 = _lineWidth1Offset + _lineWidth1Factor * _cachedSymbolSize;
				pen.Width = w1;

				var gapStart = 0.5 * (_gapAtStartOffset + _gapAtStartFactor * _cachedSymbolSize);
				var gapEnd = 0.5 * (_gapAtEndOffset + _gapAtEndFactor * _cachedSymbolSize);


				int lower = range.LowerBound;
				int upper = range.UpperBound;

				for (int j = lower; j < upper; j += _skipFrequency)
				{
					var originalRowIndex = range.GetOriginalRowIndexFromPlotPointIndex(j);

					Logical3D r3d = layer.GetLogical3D(pdata, originalRowIndex);
					r3d.RX += _cachedLogicalShiftX;
					r3d.RY += _cachedLogicalShiftY;

					foreach (CSPlaneID id in dropTargets)
					{
						gpath.Reset();
						layer.CoordinateSystem.GetIsolineFromPointToPlane(gpath, r3d, id);
						PointF[] shortenedPathPoints = null;
						if (gapStart != 0 || gapEnd != 0)
						{
							gpath.Flatten();
							var pathPoints = gpath.PathPoints;
							shortenedPathPoints = GdiExtensionMethods.ShortenedBy(pathPoints, RADouble.NewAbs(gapStart), RADouble.NewAbs(gapEnd));
							if (null != shortenedPathPoints)
								g.DrawLines(pen, shortenedPathPoints);
						}
						else
						{
							g.DrawPath(pen, gpath);
						}
					}
				}

			}
			else // using a variable symbol size or variable symbol color
			{

				int lower = range.LowerBound;
				int upper = range.UpperBound;
				for (int j = lower; j < upper; j += _skipFrequency)
				{
					var originalRowIndex = range.GetOriginalRowIndexFromPlotPointIndex(j);
					var pen = _pen.Clone();
					if (null == _cachedColorForIndexFunction)
					{
						_cachedSymbolSize = _cachedSymbolSizeForIndexFunction(originalRowIndex);
						double w1 = _lineWidth1Offset + _lineWidth1Factor * _cachedSymbolSize;
						pen.Width = w1;
					}
					else
					{
						_cachedSymbolSize = null == _cachedSymbolSizeForIndexFunction ? _cachedSymbolSize : _cachedSymbolSizeForIndexFunction(originalRowIndex);
						double w1 = _lineWidth1Offset + _lineWidth1Factor * _cachedSymbolSize;

						var customSymbolColor = _cachedColorForIndexFunction(originalRowIndex);
						pen.Width = w1;
						pen.Color = NamedColor.FromArgb(customSymbolColor.A, customSymbolColor.R, customSymbolColor.G, customSymbolColor.B);
					}

					var gapStart = 0.5 * (_gapAtStartOffset + _gapAtStartFactor * _cachedSymbolSize);
					var gapEnd = 0.5 * (_gapAtEndOffset + _gapAtEndFactor * _cachedSymbolSize);

					Logical3D r3d = layer.GetLogical3D(pdata, originalRowIndex);
					r3d.RX += _cachedLogicalShiftX;
					r3d.RY += _cachedLogicalShiftY;

					foreach (CSPlaneID id in _dropTargets)
					{
						gpath.Reset();
						layer.CoordinateSystem.GetIsolineFromPointToPlane(gpath, r3d, id);
						PointF[] shortenedPathPoints = null;
						if (gapStart != 0 || gapEnd != 0)
						{
							gpath.Flatten();
							var pathPoints = gpath.PathPoints;
							shortenedPathPoints = GdiExtensionMethods.ShortenedBy(pathPoints, RADouble.NewAbs(gapStart), RADouble.NewAbs(gapEnd));
							if (null != shortenedPathPoints)
								g.DrawLines(pen, shortenedPathPoints);
						}
						else
						{
							g.DrawPath(pen, gpath);
						}
					}
				}

			}
		}
Ejemplo n.º 41
0
		public DropAreaPlotStyle(Altaxo.Main.Properties.IReadOnlyPropertyBag context)
		{
			var penWidth = GraphDocument.GetDefaultPenWidth(context);
			var color = GraphDocument.GetDefaultPlotColor(context);

			ChildSetMember(ref _framePen, new PenX(NamedColors.Transparent, penWidth) { LineJoin = LineJoin.Bevel });
			_ignoreMissingDataPoints = false;
			ChildSetMember(ref _fillBrush, new BrushX(color));
			_fillDirection = new CSPlaneID(1, 0);
			_connectionStyle = LineConnectionStyles.StraightConnection.Instance;
		}
Ejemplo n.º 42
0
		public override string GetNameOfPlane(CSPlaneID planeId)
		{
			string name = "";
			if (planeId.UsePhysicalValue)
			{
				switch (planeId.PerpendicularAxisNumber)
				{
					case 0:
						name = string.Format("X = {0}", planeId.PhysicalValue);
						break;

					case 1:
						name = string.Format("Y = {0}", planeId.PhysicalValue);
						break;

					case 2:
						name = string.Format("Z = {0}", planeId.PhysicalValue);
						break;

					default:
						throw new NotImplementedException();
				}
			}
			else
			{
				var uv = GetUntransformedAxisPlaneVector(planeId);
				var tv = VectorTransformation.Transform(uv);

				var lv = planeId.LogicalValue;

				if (tv.X == -1 || tv.Y == -1)
					lv = 1 - lv;
				if (Math.Abs(tv.X) == 1) // vector in x-direction
				{
					if (lv == 0)
						name = "Zero degrees";
					else if (lv == 1)
						name = "360 degrees";
					else
						name = string.Format("{0}% between 0 and 360 degrees", lv * 100);
				}
				else if (Math.Abs(tv.Y) == 1) // vector in y-direction
				{
					if (lv == 0)
						name = "Inner circle";
					else if (lv == 1)
						name = "Outer circle";
					else
						name = string.Format("{0}% between inner and outer circle", lv * 100);
				}
				else
				{
					throw new NotImplementedException();
				}
			}
			return name;
		}
Ejemplo n.º 43
0
		public override string GetNameOfPlane(CSPlaneID planeId)
		{
			string name = "";
			if (planeId.UsePhysicalValue)
			{
				switch (planeId.PerpendicularAxisNumber)
				{
					case 0:
						name = string.Format("X = {0}", planeId.PhysicalValue);
						break;

					case 1:
						name = string.Format("Y = {0}", planeId.PhysicalValue);
						break;

					case 2:
						name = string.Format("Z = {0}", planeId.PhysicalValue);
						break;

					default:
						throw new NotImplementedException();
				}
			}
			else // use logical value
			{
				var uv = GetUntransformedAxisPlaneVector(planeId);
				var tv = VectorTransformation.Transform(uv);

				var lv = planeId.LogicalValue;

				if (tv.X == -1 || tv.Y == -1)
					lv = 1 - lv;
				if (Math.Abs(tv.X) == 1) // perpendicular vector in x-direction
				{
					if (lv == 0)
						name = "Left";
					else if (lv == 1)
						name = "Right";
					else
						name = string.Format("{0}% between left and right", lv * 100);
				}
				else if (Math.Abs(tv.Y) == 1) // perpendicular vector in y-direction
				{
					if (lv == 0)
						name = "Bottom";
					else if (lv == 1)
						name = "Top";
					else
						name = string.Format("{0}% between bottom and top", lv * 100);
				}
				else
				{
					throw new NotImplementedException();
				}
			}
			return name;
		}
Ejemplo n.º 44
0
			public CSPlaneID UpdateCSPlaneID(CSPlaneID id)
			{
				if (id.UsePhysicalValue)
				{
					int scaleidx = id.PerpendicularAxisNumber;
					switch (scaleidx)
					{
						case 0:
							id = id.WithLogicalValue(_xScale.PhysicalVariantToNormal(id.PhysicalValue));
							break;

						case 1:
							id = id.WithLogicalValue(_yScale.PhysicalVariantToNormal(id.PhysicalValue));
							break;

						default:
							id = _layer.UpdateCSPlaneID(id);
							break;
					}
				}
				return id;
			}
Ejemplo n.º 45
0
		public void GetFillPath(GraphicsPath gp, IPlotArea layer, Processed2DPlotData pdata, CSPlaneID fillDirection)
		{
			PointF[] plotPositions = pdata.PlotPointsInAbsoluteLayerCoordinates;
			if (0 != _cachedLogicalShiftX || 0 != _cachedLogicalShiftY)
			{
				plotPositions = Processed2DPlotData.GetPlotPointsInAbsoluteLayerCoordinatesWithShift(pdata, layer, _cachedLogicalShiftX, _cachedLogicalShiftY);
			}

			PlotRangeList rangeList = pdata.RangeList;
			fillDirection = layer.UpdateCSPlaneID(fillDirection);

			int rangelistlen = rangeList.Count;

			if (this._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
				PlotRange totalRange = new PlotRange(rangeList[0].LowerBound, rangeList[rangelistlen - 1].UpperBound);
				_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 < rangelistlen; i++)
				{
					_connectionStyle.FillOneRange(gp, pdata, rangeList[i], layer, fillDirection, _ignoreMissingDataPoints, _connectCircular, plotPositions, _cachedLogicalShiftX, _cachedLogicalShiftY);
				}
			}
		}
Ejemplo n.º 46
0
		public override string GetNameOfPlane(CSPlaneID planeId)
		{
			var uv = GetUntransformedAxisPlaneVector(planeId);
			var tv = uv;

			var lv = planeId.LogicalValue;

			if (tv.X == -1 || tv.Y == -1)
				lv = 1 - lv;
			string name = "";
			if (Math.Abs(tv.X) == 1)
			{
				if (lv == 0)
					name = "Left";
				else if (lv == 1)
					name = "Right";
				else
					name = string.Format("{0}% between left and right", lv * 100);
			}
			else if (Math.Abs(tv.Y) == 1)
			{
				if (lv == 0)
					name = "Front";
				else if (lv == 1)
					name = "Back";
				else
					name = string.Format("{0}% between front and back", lv * 100);
			}
			else
			{
				throw new NotImplementedException();
			}

			return name;
		}
Ejemplo n.º 47
0
		public static VectorD2D GetUntransformedAxisPlaneVector(CSPlaneID id)
		{
			switch (id.PerpendicularAxisNumber)
			{
				case 0: // perpendicular axis is X
					return new VectorD2D(1, 0);

				case 1: // perpendicular axis is Y
					return new VectorD2D(0, 1);

				default:
					throw new NotImplementedException();
			}
		}
Ejemplo n.º 48
0
		public void PaintOneRange(Graphics g, IPlotArea layer, IPlotRange range, Processed2DPlotData pdata)
		{
			if (this._labelColumnProxy.Document == null)
				return;

			_cachedStringFormat.Alignment = GdiExtensionMethods.ToGdi(_alignmentX);
			_cachedStringFormat.LineAlignment = GdiExtensionMethods.ToGdi(_alignmentY);

			if (null != _attachedPlane)
				_attachedPlane = layer.UpdateCSPlaneID(_attachedPlane);

			var ptArray = pdata.PlotPointsInAbsoluteLayerCoordinates;
			Altaxo.Data.IReadableColumn labelColumn = this._labelColumnProxy.Document;

			bool isUsingVariableColorForLabelText = null != _cachedColorForIndexFunction && IsColorReceiver;
			bool isUsingVariableColorForLabelBackground = null != _cachedColorForIndexFunction &&
				(null != _backgroundStyle && _backgroundStyle.SupportsBrush && (_backgroundColorLinkage == ColorLinkage.Dependent || _backgroundColorLinkage == ColorLinkage.PreserveAlpha));
			bool isUsingVariableColor = isUsingVariableColorForLabelText || isUsingVariableColorForLabelBackground;
			BrushX clonedTextBrush = null;
			BrushX clonedBackBrush = null;
			if (isUsingVariableColorForLabelText)
				clonedTextBrush = _brush.Clone();
			if (isUsingVariableColorForLabelBackground)
				clonedBackBrush = _backgroundStyle.Brush.Clone();

			// save the graphics stat since we have to translate the origin
			var gs = g.Save();

			double xpos = 0, ypos = 0;
			double xpre, ypre;
			double xdiff, ydiff;

			bool isFormatStringContainingBraces = _labelFormatString?.IndexOf('{') >= 0;
			var culture = System.Threading.Thread.CurrentThread.CurrentCulture;

			bool mustUseLogicalCoordinates = null != this._attachedPlane || 0 != _cachedLogicalShiftX || 0 != _cachedLogicalShiftY;

			int lower = range.LowerBound;
			int upper = range.UpperBound;
			for (int j = lower; j < upper; j+=_skipFrequency)
			{
				int originalRowIndex = range.GetOriginalRowIndexFromPlotPointIndex(j);
				string label;
				if (string.IsNullOrEmpty(_labelFormatString))
				{
					label = labelColumn[originalRowIndex].ToString();
				}
				else if (!isFormatStringContainingBraces)
				{
					label = labelColumn[originalRowIndex].ToString(_labelFormatString, culture);
				}
				else
				{
					// the label format string can contain {0} for the label column item, {1} for the row index, {2} .. {4} for the x, y and z component of the data point
					label = string.Format(_labelFormatString, labelColumn[originalRowIndex], originalRowIndex, pdata.GetPhysical(0, originalRowIndex), pdata.GetPhysical(1, originalRowIndex), pdata.GetPhysical(2, originalRowIndex));
				}

				if (string.IsNullOrEmpty(label))
					continue;

				double localSymbolSize = _symbolSize;
				if (null != _cachedSymbolSizeForIndexFunction)
				{
					localSymbolSize = _cachedSymbolSizeForIndexFunction(originalRowIndex);
				}

				double localFontSize = _fontSizeOffset + _fontSizeFactor * localSymbolSize;
				if (!(localFontSize > 0))
					continue;

				_font = _font.WithSize(localFontSize);

				// Start of preparation of brushes, if a variable color is used
				if (isUsingVariableColor)
				{
					Color c = _cachedColorForIndexFunction(originalRowIndex);

					if (isUsingVariableColorForLabelText)
					{
						clonedTextBrush.Color = new NamedColor(AxoColor.FromArgb(c.A, c.R, c.G, c.B), "e");
					}
					if (isUsingVariableColorForLabelBackground)
					{
						if (_backgroundColorLinkage == ColorLinkage.PreserveAlpha)
							clonedBackBrush.Color = new NamedColor(AxoColor.FromArgb(clonedBackBrush.Color.Color.A, c.R, c.G, c.B), "e");
						else
							clonedBackBrush.Color = new NamedColor(AxoColor.FromArgb(c.A, c.R, c.G, c.B), "e");
					}
				}
				// end of preparation of brushes for variable colors

				if (mustUseLogicalCoordinates) // we must use logical coordinates because either there is a shift of logical coordinates, or an attached plane
				{
					Logical3D r3d = layer.GetLogical3D(pdata, originalRowIndex);
					r3d.RX += _cachedLogicalShiftX;
					r3d.RY += _cachedLogicalShiftY;

					if (null != this._attachedPlane)
					{
						var pp = layer.CoordinateSystem.GetPointOnPlane(this._attachedPlane, r3d);
						xpre = pp.X;
						ypre = pp.Y;
					}
					else
					{
						PointD3D pt;
						layer.CoordinateSystem.LogicalToLayerCoordinates(r3d, out xpre, out ypre);
					}
				}
				else // no shifting, thus we can use layer coordinates
				{
					xpre = ptArray[j].X;
					ypre = ptArray[j].Y;
				}

				xdiff = xpre - xpos;
				ydiff = ypre - ypos;
				xpos = xpre;
				ypos = ypre;
				g.TranslateTransform((float)xdiff, (float)ydiff);
				if (this._rotation != 0)
					g.RotateTransform((float)-this._rotation);

				this.PaintOneItem(g, label, localSymbolSize, clonedTextBrush, clonedBackBrush);

				if (this._rotation != 0)
					g.RotateTransform((float)this._rotation);

			}

			g.Restore(gs); // Restore the graphics state
		}
Ejemplo n.º 49
0
		public DropLinePlotStyle(CSPlaneID planeID, PenX3D pen)
		{
			if (null == pen)
				throw new ArgumentNullException(nameof(pen));

			this._dropTargets = new CSPlaneIDList(new[] { planeID });

			// Cached values
			SetCachedValues();
		}
Ejemplo n.º 50
0
		public bool CopyFrom(object obj, bool copyWithDataReferences)
		{
			if (object.ReferenceEquals(this, obj))
				return true;
			var from = obj as LabelPlotStyle;
			if (null == from)
				return false;

			using (var suspendToken = SuspendGetToken())
			{
				this._attachedPlane = from._attachedPlane;
				this._independentSkipFrequency = from._independentSkipFrequency;
				this._skipFrequency = from._skipFrequency;
				this._ignoreMissingDataPoints = from._ignoreMissingDataPoints;
				this._independentOnShiftingGroupStyles = from._independentOnShiftingGroupStyles;
				this._labelFormatString = from._labelFormatString;

				this._independentSymbolSize = from._independentSymbolSize;
				this._symbolSize = from._symbolSize;

				this._fontSizeOffset = from._fontSizeOffset;
				this._fontSizeFactor = from._fontSizeFactor;

				this._font = from._font;
				ChildCopyToMember(ref _brush, from._brush);
				this._independentColor = from._independentColor;

				this._alignmentX = from._alignmentX;
				this._alignmentY = from._alignmentY;

				this._rotation = from._rotation;

				this._offsetX_Points = from._offsetX_Points;
				this._offsetX_EmUnits = from._offsetX_EmUnits;
				this._offsetX_SymbolSizeUnits = from._offsetX_SymbolSizeUnits;

				this._offsetY_Points = from._offsetY_Points;
				this._offsetY_EmUnits = from._offsetY_EmUnits;
				this._offsetY_SymbolSizeUnits = from._offsetY_SymbolSizeUnits;

				this._backgroundColorLinkage = from._backgroundColorLinkage;
				ChildCopyToMember(ref _backgroundStyle, from._backgroundStyle);

				this._cachedLogicalShiftX = from._cachedLogicalShiftX;
				this._cachedLogicalShiftY = from._cachedLogicalShiftY;

				this._cachedStringFormat = (System.Drawing.StringFormat)from._cachedStringFormat.Clone();

				if (copyWithDataReferences)
					this.LabelColumnProxy = (Altaxo.Data.IReadableColumnProxy)from._labelColumnProxy.Clone();

				EhSelfChanged(EventArgs.Empty);
				suspendToken.Resume();
			}
			return true;
		}
Ejemplo n.º 51
0
    public CSPlaneInformation GetPlaneInformation(CSPlaneID planeID)
    {
      CSLineID lineID = (CSLineID)planeID;
      CSAxisInformation lineInfo = GetAxisStyleInformation(lineID);

      CSPlaneInformation result = new CSPlaneInformation(planeID);
      result.Name = lineInfo.NameOfAxisStyle;
      return result;
    }
Ejemplo n.º 52
0
		public CSPlaneInformation GetPlaneInformation(CSPlaneID planeID)
		{
			return new CSPlaneInformation(planeID) { Name = GetNameOfPlane(planeID) };
		}
Ejemplo n.º 53
0
		public void Paint(IGraphicsContext3D g, IPlotArea layer, Processed3DPlotData pdata, Processed3DPlotData prevItemData, Processed3DPlotData nextItemData)
		{
			if (this._labelColumnProxy.Document == null)
				return;

			if (null != _attachedPlane)
				_attachedPlane = layer.UpdateCSPlaneID(_attachedPlane);

			PlotRangeList rangeList = pdata.RangeList;
			var ptArray = pdata.PlotPointsInAbsoluteLayerCoordinates;
			Altaxo.Data.IReadableColumn labelColumn = this._labelColumnProxy.Document;

			bool isUsingVariableColorForLabelText = null != _cachedColorForIndexFunction && IsColorReceiver;
			bool isUsingVariableColorForLabelBackground = null != _cachedColorForIndexFunction &&
				(null != _backgroundStyle && _backgroundStyle.SupportsUserDefinedMaterial && (_backgroundColorLinkage == ColorLinkage.Dependent || _backgroundColorLinkage == ColorLinkage.PreserveAlpha));
			bool isUsingVariableColor = isUsingVariableColorForLabelText || isUsingVariableColorForLabelBackground;
			IMaterial clonedTextBrush = _material;
			IMaterial clonedBackBrush = null;
			if (isUsingVariableColorForLabelBackground)
				clonedBackBrush = _backgroundStyle.Material;

			// save the graphics stat since we have to translate the origin
			var gs = g.SaveGraphicsState();

			double xpos = 0, ypos = 0, zpos = 0;
			double xpre, ypre, zpre;
			double xdiff, ydiff, zdiff;

			bool isFormatStringContainingBraces = _labelFormatString?.IndexOf('{') >= 0;
			var culture = System.Threading.Thread.CurrentThread.CurrentCulture;

			bool mustUseLogicalCoordinates = null != this._attachedPlane || 0 != _cachedLogicalShiftX || 0 != _cachedLogicalShiftY || 0 != _cachedLogicalShiftZ;

			for (int r = 0; r < rangeList.Count; r++)
			{
				int lower = rangeList[r].LowerBound;
				int upper = rangeList[r].UpperBound;
				int offset = rangeList[r].OffsetToOriginal;
				for (int j = lower; j < upper; j += _skipFrequency)
				{
					string label;
					if (string.IsNullOrEmpty(_labelFormatString))
					{
						label = labelColumn[j + offset].ToString();
					}
					else if (!isFormatStringContainingBraces)
					{
						label = labelColumn[j + offset].ToString(_labelFormatString, culture);
					}
					else
					{
						// the label format string can contain {0} for the label column item, {1} for the row index, {2} .. {4} for the x, y and z component of the data point
						label = string.Format(_labelFormatString, labelColumn[j + offset], j + offset, pdata.GetPhysical(0, j + offset), pdata.GetPhysical(1, j + offset), pdata.GetPhysical(2, j + offset));
					}

					if (string.IsNullOrEmpty(label))
						continue;

					double localSymbolSize = _symbolSize;
					if (null != _cachedSymbolSizeForIndexFunction)
					{
						localSymbolSize = _cachedSymbolSizeForIndexFunction(j + offset);
					}

					double localFontSize = _fontSizeOffset + _fontSizeFactor * localSymbolSize;
					if (!(localFontSize > 0))
						continue;

					_font = _font.WithSize(localFontSize);

					// Start of preparation of brushes, if a variable color is used
					if (isUsingVariableColor)
					{
						var c = _cachedColorForIndexFunction(j + offset);

						if (isUsingVariableColorForLabelText)
						{
							clonedTextBrush = clonedTextBrush.WithColor(new NamedColor(AxoColor.FromArgb(c.A, c.R, c.G, c.B), "e"));
						}
						if (isUsingVariableColorForLabelBackground)
						{
							if (_backgroundColorLinkage == ColorLinkage.PreserveAlpha)
								clonedBackBrush = clonedBackBrush.WithColor(new NamedColor(AxoColor.FromArgb(clonedBackBrush.Color.Color.A, c.R, c.G, c.B), "e"));
							else
								clonedBackBrush = clonedBackBrush.WithColor(new NamedColor(AxoColor.FromArgb(c.A, c.R, c.G, c.B), "e"));
						}
					}
					// end of preparation of brushes for variable colors

					if (mustUseLogicalCoordinates) // we must use logical coordinates because either there is a shift of logical coordinates, or an attached plane
					{
						Logical3D r3d = layer.GetLogical3D(pdata, j + offset);
						r3d.RX += _cachedLogicalShiftX;
						r3d.RY += _cachedLogicalShiftY;
						r3d.RZ += _cachedLogicalShiftZ;

						if (null != this._attachedPlane)
						{
							var pp = layer.CoordinateSystem.GetPointOnPlane(this._attachedPlane, r3d);
							xpre = pp.X;
							ypre = pp.Y;
							zpre = pp.Z;
						}
						else
						{
							PointD3D pt;
							layer.CoordinateSystem.LogicalToLayerCoordinates(r3d, out pt);
							xpre = pt.X;
							ypre = pt.Y;
							zpre = pt.Z;
						}
					}
					else // no shifting, thus we can use layer coordinates
					{
						xpre = ptArray[j].X;
						ypre = ptArray[j].Y;
						zpre = ptArray[j].Z;
					}

					xdiff = xpre - xpos;
					ydiff = ypre - ypos;
					zdiff = zpre - zpos;
					xpos = xpre;
					ypos = ypre;
					zpos = zpre;
					g.TranslateTransform(xdiff, ydiff, zdiff);
					g.RotateTransform(_rotationX, _rotationY, _rotationZ);

					this.Paint(g, label, localSymbolSize, clonedTextBrush, clonedBackBrush);

					g.RotateTransform(-_rotationX, -_rotationY, -_rotationZ);
				} // end for
			}

			g.RestoreGraphicsState(gs); // Restore the graphics state
		}
Ejemplo n.º 54
0
		/// <inheritdoc/>
		public override void FillOneRange(
		GraphicsPath gp,
			Processed2DPlotData pdata,
			IPlotRange range,
			IPlotArea layer,
			CSPlaneID fillDirection,
			bool ignoreMissingDataPoints,
			bool connectCircular,
			PointF[] allLinePointsShiftedAlready,
			double logicalShiftX,
			double logicalShiftY
		)
		{
			if (range.Length < 2)
				return;

			int lastIdx;
			PointF[] linePoints = Segment2Connection_GetSubPoints(allLinePointsShiftedAlready, range, layer, connectCircular, out lastIdx);


			if (connectCircular)
			{
				gp.AddLines(linePoints);
				gp.CloseFigure();
			}
			else
			{
				int offs = range.LowerBound;
				for (int i = 0; i < linePoints.Length - 1; i += 2)
				{
					Logical3D r0 = layer.GetLogical3D(pdata, range.GetOriginalRowIndexFromPlotPointIndex(range.LowerBound + i));
					r0.RX += logicalShiftX;
					r0.RY += logicalShiftY;

					layer.CoordinateSystem.GetIsolineFromPlaneToPoint(gp, fillDirection, r0);
					gp.AddLine(linePoints[i].X, linePoints[i].Y, linePoints[i + 1].X, linePoints[i + 1].Y);
					Logical3D r1 = layer.GetLogical3D(pdata, range.GetOriginalRowIndexFromPlotPointIndex(range.LowerBound + i + 1));
					r1.RX += logicalShiftX;
					r1.RY += logicalShiftY;

					layer.CoordinateSystem.GetIsolineFromPointToPlane(gp, r1, fillDirection);
					layer.CoordinateSystem.GetIsolineOnPlane(gp, fillDirection, r1, r0);
					gp.StartFigure();
				}

				gp.CloseFigure();
			}
		}
Ejemplo n.º 55
0
		public DropAreaPlotStyle(ILineConnectionStyle connection, bool ignoreMissingDataPoints, bool connectCircular, CSPlaneID direction, BrushX fillBrush, ColorLinkage fillColorLinkage)
		{
			_connectionStyle = connection;
			_ignoreMissingDataPoints = ignoreMissingDataPoints;
			_connectCircular = connectCircular;
			_fillDirection = direction;
			_fillColorLinkage = fillColorLinkage;
			ChildCopyToMember(ref _fillBrush, fillBrush);
			ChildSetMember(ref _framePen, new PenX(NamedColors.Transparent, 1));
		}
Ejemplo n.º 56
0
			public CSPlaneID UpdateCSPlaneID(CSPlaneID id)
			{
				throw new NotImplementedException();
			}
Ejemplo n.º 57
0
		public void Paint(Graphics g, IPlotArea layer, Processed2DPlotData pdata, Processed2DPlotData prevItemData, Processed2DPlotData nextItemData)
		{
			if (this._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 (this._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);
		}
Ejemplo n.º 58
0
		/// <inheritdoc/>
		public override void FillOneRange(
		GraphicsPath gp,
			Processed2DPlotData pdata,
			IPlotRange range,
			IPlotArea layer,
			CSPlaneID fillDirection,
			bool ignoreMissingDataPoints,
			bool connectCircular,
			PointF[] allLinePoints,
			double logicalShiftX,
			double logicalShiftY
		)
		{
			if (range.Length < 2)
				return;

			int lastIdx;
			int numberOfPointsPerOriginalPoint;
			PointF[] linepts = GetStepPolylinePoints(allLinePoints, range, layer, connectCircular, out numberOfPointsPerOriginalPoint, out lastIdx);
			FillOneRange(gp, pdata, range, layer, fillDirection, linepts, connectCircular, allLinePoints, logicalShiftX, logicalShiftY);
		}
Ejemplo n.º 59
0
		/// <summary>
		/// Template to get a fill path.
		/// </summary>
		/// <param name="gp">Graphics path to fill with data.</param>
		/// <param name="pdata">The plot data. Don't use the Range property of the pdata, since it is overriden by the next argument.</param>
		/// <param name="range">The plot range to use.</param>
		/// <param name="layer">Graphics layer.</param>
		/// <param name="fillDirection">Designates a bound to fill to.</param>
		/// <param name="linePoints">The points that mark the line.</param>
		/// <param name="connectCircular">If true, a circular connection is drawn.</param>
		/// <param name="allLinePointsShiftedAlready">The plot positions, already shifted when a logical shift needed to be applied. Don't use the Range property of the pdata, since it is overriden by the next argument.</param>
		/// <param name="logicalShiftX">The logical shift in x-direction.</param>
		/// <param name="logicalShiftY">The logical shift in x-direction.</param>
		public virtual void FillOneRange(
		GraphicsPath gp,
			Processed2DPlotData pdata,
			IPlotRange range,
			IPlotArea layer,
			CSPlaneID fillDirection,
			PointF[] linePoints,
			bool connectCircular,
			PointF[] allLinePointsShiftedAlready,
			double logicalShiftX,
			double logicalShiftY
		)
		{
			if (connectCircular)
			{
				gp.AddLines(linePoints);
				gp.CloseFigure();
			}
			else
			{
				Logical3D r0 = layer.GetLogical3D(pdata, range.OriginalFirstPoint);
				r0.RX += logicalShiftX;
				r0.RY += logicalShiftY;

				layer.CoordinateSystem.GetIsolineFromPlaneToPoint(gp, fillDirection, r0);
				gp.AddLines(linePoints);

				Logical3D r1 = layer.GetLogical3D(pdata, range.OriginalLastPoint);
				r1.RX += logicalShiftX;
				r1.RY += logicalShiftY;

				layer.CoordinateSystem.GetIsolineFromPointToPlane(gp, r1, fillDirection);
				layer.CoordinateSystem.GetIsolineOnPlane(gp, fillDirection, r1, r0);
				gp.CloseFigure();
			}
		}
Ejemplo n.º 60
0
		/// <summary>
		/// Draws an isoline beginning from a given point to a plane.
		/// </summary>
		/// <param name="g">Graphics to draw the isoline to.</param>
		/// <param name="pen">The pen to use.</param>
		/// <param name="r">Logical coordinate of the start point.</param>
		/// <param name="id">The logical plane to end the isoline.</param>
		public virtual void DrawIsolineFromPointToPlane(Graphics g, System.Drawing.Pen pen, Logical3D r, CSPlaneID id)
		{
			if (id.PerpendicularAxisNumber == 0)
			{
				DrawIsoline(g, pen, r, new Logical3D(id.LogicalValue, r.RY, r.RZ));
			}
			else if (id.PerpendicularAxisNumber == 1)
			{
				DrawIsoline(g, pen, r, new Logical3D(r.RX, id.LogicalValue, r.RZ));
			}
			else
			{
				DrawIsoline(g, pen, r, new Logical3D(r.RX, r.RY, id.LogicalValue));
			}
		}