Esempio n. 1
0
        public IEnumerable <double> FillLine(FL_Line line)
        {
            double currentRemaining = EndsWithSpace ? line.Length - SpaceLength : line.Length;
            bool   nextIsSpace      = StartsWithSpace;

            while (currentRemaining > 0)
            {
                if (nextIsSpace)
                {
                    currentRemaining -= SpaceLength;
                    yield return(SpaceLength);
                }
                else if (currentRemaining - PartLength < 0)
                {
                    yield return(currentRemaining);

                    currentRemaining = 0;
                }
                else
                {
                    currentRemaining -= PartLength;
                    yield return(PartLength);
                }

                nextIsSpace = !nextIsSpace;
            }

            if (EndsWithSpace)
            {
                yield return(SpaceLength);
            }
        }
Esempio n. 2
0
        public IEnumerable <double> FillLine(FL_Line line)
        {
            int numberOfFullParts = (int)(line.Length / PartWidth);

            if ((line.Length - (numberOfFullParts * PartWidth) / 2) > AllowedError)
            {
                yield return((line.Length - (numberOfFullParts * PartWidth)) / 2);
            }

            for (int i = 0; i < numberOfFullParts; i++)
            {
                yield return(PartWidth);
            }

            if ((line.Length - (numberOfFullParts * PartWidth)) / 2 > AllowedError)
            {
                yield return((line.Length - (numberOfFullParts * PartWidth)) / 2);
            }
        }
Esempio n. 3
0
        public IEnumerable <double> FillLine(FL_Line line)
        {
            int    numberOfParts      = (int)Math.Round((line.Length + DesiredSpace) / (PartWidth + DesiredSpace));
            double lengthWithoutParts = line.Length - (numberOfParts * PartWidth);
            double spaceWidth         = lengthWithoutParts / (numberOfParts - 1);

            bool spacePart = StartsWithSpace;

            for (int i = 0; i < numberOfParts + numberOfParts - 1; i++)
            {
                if (spacePart)
                {
                    yield return(spaceWidth);
                }
                else
                {
                    yield return(PartWidth);
                }

                spacePart = !spacePart;
            }
        }
Esempio n. 4
0
        public IEnumerable <double> FillLine(FL_Line line)
        {
            int numberOfFullParts = (int)(line.Length / PartWidth) - 1;

            yield return(EndPartAtStart ?
                         EndPartSize(line.Length) :
                         StartPartSize(line.Length));

            for (int i = 0; i < numberOfFullParts; i++)
            {
                yield return(PartWidth);
            }

            yield return(!EndPartAtStart?
                         EndPartSize(line.Length) :
                             StartPartSize(line.Length));

            if (AlternateVariablePosition)
            {
                EndPartAtStart = !EndPartAtStart;
            }
        }