internal void ArcFor(PDFUnit rx, PDFUnit ry, double ang, PathArcSize size, PathArcSweep sweep, PDFPoint enddelta)
        {
            PDFPoint    end = ConvertDeltaToActual(enddelta);
            PathArcData arc = new PathArcData()
            {
                RadiusX = rx, RadiusY = ry, XAxisRotation = ang, ArcSize = size, ArcSweep = sweep, EndPoint = end
            };

            CurrentPath.Add(arc);

            IEnumerable <PathBezierCurveData> curves = PathDataHelper.GetBezierCurvesForArc(this.Cursor, arc);

            foreach (PathBezierCurveData bez in curves)
            {
                IncludeInBounds(bez.EndPoint);
                if (bez.HasStartHandle)
                {
                    IncludeInBounds(bez.StartHandle);
                }
                if (bez.HasEndHandle)
                {
                    IncludeInBounds(bez.EndHandle);
                }
            }

            Cursor = end;
        }
        public void LineTo(PDFPoint end)
        {
            PathLineData line = new PathLineData();

            line.LineTo = end;
            CurrentPath.Add(line);
            IncludeInBounds(end);
            Cursor = end;
        }
        public void MoveTo(PDFPoint start)
        {
            PathMoveData move = new PathMoveData();

            move.MoveTo = start;
            CurrentPath.Add(move);
            IncludeInBounds(start);
            Cursor = start;
        }
Beispiel #4
0
        public void AddCurrentSubpath()
        {
            if (CurrentSubpath == null)
            {
                return;
            }

            CurrentPath.Add(CurrentSubpath);
            CurrentSubpath = null;
        }
        public void MoveBy(PDFPoint delta)
        {
            PathMoveData move = new PathMoveData();
            PDFPoint     pos  = ConvertDeltaToActual(delta);

            move.MoveTo = pos;
            CurrentPath.Add(move);
            IncludeInBounds(pos);
            Cursor = pos;
        }
        /// <summary>
        /// Closes the current path (drawing a line from the current point to the start point if the path is not already closed)
        /// And then ends the path if 'end' is true.
        /// </summary>
        public void ClosePath(bool end)
        {
            PathCloseData close = new PathCloseData();

            CurrentPath.Add(close);
            if (end)
            {
                this.EndPath();
            }
        }
        public void HorizontalLineFor(PDFUnit dx)
        {
            PathLineData line = new PathLineData();
            PDFPoint     end  = ConvertDeltaToActual(dx, 0);

            line.LineTo = end;
            CurrentPath.Add(line);
            IncludeInBounds(end);
            Cursor = end;
        }
        public void HorizontalLineTo(PDFUnit x)
        {
            PathLineData line = new PathLineData();
            PDFPoint     end  = new PDFPoint(x, this.Cursor.Y);

            line.LineTo = end;
            CurrentPath.Add(line);
            IncludeInBounds(end);
            Cursor = end;
        }
        public void VerticalLineTo(PDFUnit y)
        {
            PathLineData line = new PathLineData();
            PDFPoint     end  = new PDFPoint(this.Cursor.X, y);

            line.LineTo = end;
            CurrentPath.Add(line);
            IncludeInBounds(end);
            Cursor = end;
        }
        public void LineFor(PDFPoint delta)
        {
            PathLineData line = new PathLineData();
            PDFPoint     end  = ConvertDeltaToActual(delta);

            line.LineTo = end;
            CurrentPath.Add(line);
            IncludeInBounds(end);
            Cursor = end;
        }
        public void CubicCurveToWithHandleEnd(PDFPoint end, PDFPoint handleEnd)
        {
            PathBezierCurveData arc = new PathBezierCurveData(end, PDFPoint.Empty, handleEnd, false, true);

            CurrentPath.Add(arc);
            IncludeInBounds(end);
            IncludeInBounds(handleEnd);

            Cursor     = end;
            LastHandle = handleEnd;
        }
        public void CubicCurveTo(PDFPoint end, PDFPoint handleStart, PDFPoint handleEnd)
        {
            PathBezierCurveData arc = new PathBezierCurveData(end, handleStart, handleEnd, true, true);

            CurrentPath.Add(arc);
            IncludeInBounds(end);
            IncludeInBounds(handleStart);
            IncludeInBounds(handleEnd);

            Cursor     = end;
            LastHandle = handleEnd;
        }
        public void QuadraticCurveTo(PDFPoint end, PDFPoint handle)
        {
            PathQuadraticCurve arc = new PathQuadraticCurve()
            {
                EndPoint = end, ControlPoint = handle
            };

            CurrentPath.Add(arc);
            IncludeInBounds(end);
            IncludeInBounds(handle);
            Cursor     = end;
            LastHandle = handle;
        }
        public void CubicCurveForWithHandleEnd(PDFPoint delta, PDFPoint deltaHandleEnd)
        {
            PDFPoint end       = ConvertDeltaToActual(delta);
            PDFPoint handleEnd = ConvertDeltaToActual(deltaHandleEnd);

            PathBezierCurveData arc = new PathBezierCurveData(end, PDFPoint.Empty, handleEnd, false, true);

            CurrentPath.Add(arc);
            IncludeInBounds(end);
            IncludeInBounds(handleEnd);

            Cursor     = end;
            LastHandle = handleEnd;
        }
        public void QuadraticCurveFor(PDFPoint endDelta, PDFPoint handleDelta)
        {
            PDFPoint           end    = ConvertDeltaToActual(endDelta);
            PDFPoint           handle = ConvertDeltaToActual(handleDelta);
            PathQuadraticCurve arc    = new PathQuadraticCurve()
            {
                EndPoint = end, ControlPoint = handle
            };

            CurrentPath.Add(arc);
            IncludeInBounds(end);
            IncludeInBounds(handle);
            Cursor     = end;
            LastHandle = handle;
        }
 private void updatePath(Folder i_FolderSelected)
 {
     if (i_FolderSelected.Depth == 0)
     {
         CurrentPath = new List <Folder>()
         {
             i_FolderSelected
         };
     }
     else if (i_FolderSelected.Depth == CurrentPath.Count)
     {
         CurrentPath.Add(i_FolderSelected);
     }
     else if (i_FolderSelected.Depth < CurrentPath.Count)
     {
         CurrentPath.RemoveRange(i_FolderSelected.Depth, CurrentPath.Count - 1);
         CurrentPath.Add(i_FolderSelected);
     }
     else    //i_FolderSelected.Depth > CurrentPath.Count is impossible scenario! something bad happened!
     {
         throw new Exception("Corrupted hierarchy navigation.");
     }
 }
Beispiel #17
0
            public void Compute()
            {
                while (true)
                {
                    var nextRows = PathRows
                                   .Where(n => (int)n.Field <decimal>("path_content_id") == CurrentContentId &&
                                          (CurrentRelatedContentId == 0 || (int?)n.Field <decimal?>("rel_content_id") == CurrentRelatedContentId))
                                   .OrderBy(n => (int)n.Field <decimal>("attribute_id"))
                                   .ToArray();
                    if (!nextRows.Any())
                    {
                        break;
                    }

                    if (nextRows.Any(n => n.Field <bool>("is_ext")))
                    {
                        if (!nextRows.All(n => n.Field <bool>("is_ext")))
                        {
                            throw new Exception("Incorrect relation security settings: mixed extensions and normal");
                        }

                        var nextIds = nextRows.Select(n => (int)n.Field <decimal>("rel_content_id")).Distinct().OrderBy(n => n).ToArray();
                        if (nextIds.Length > 1)
                        {
                            nextRows = nextRows.Where(n => (int)n.Field <decimal>("rel_content_id") == nextIds[0]).ToArray();
                        }

                        ExtraFinders = nextIds.Skip(1).Select(n => new RelationSecurityPathFinder(PathRows, CurrentContentId, CurrentPath)
                        {
                            CurrentRelatedContentId = n, OldIndex = OldIndex, Index = Index
                        }).ToList();

                        var param = new RelationSecurityPathItem
                        {
                            ContentId  = (int)nextRows.First().Field <decimal>("path_content_id"),
                            Extensions = nextRows.Select((n, k) => new RelationSecurityPathItem(n)
                            {
                                Order = Index + k + 1, JoinOrder = OldIndex
                            }).ToArray(),
                            Order     = Index,
                            JoinOrder = OldIndex
                        };

                        OldIndex = Index;
                        Index    = Index + 1 + param.Extensions.Length;
                        CurrentPath.Add(param);
                    }
                    else
                    {
                        var param = new RelationSecurityPathItem(nextRows.First())
                        {
                            Order = Index, JoinOrder = OldIndex
                        };
                        OldIndex = Index;
                        Index++;

                        if (nextRows.Length > 1)
                        {
                            param.Secondary = nextRows.Skip(1).Select((n, j) => new RelationSecurityPathItem(n)
                            {
                                Order = Index + j + 1, JoinOrder = param.JoinOrder
                            }).ToArray();
                            Index = Index + param.Secondary.Length;
                        }
                        else
                        {
                            param.Secondary = new RelationSecurityPathItem[] { };
                        }
                        CurrentPath.Add(param);
                    }

                    CurrentContentId        = nextRows.Select(n => (int)(n.Field <decimal?>("rel_content_id") ?? 0)).First();
                    CurrentRelatedContentId = 0;
                }
            }