Esempio n. 1
0
        public void TestGetTargetMarks()
        {
            TargetMark[] marks =
                PaperBallotTarget.GetTargetMarks(TargetType.Arrow);

            Assert.AreEqual(1, marks.Length);
            Assert.AreEqual(TargetMark.ArrowDefault, marks[0]);
        }
        /// <summary>
        ///     Clears this instance.
        /// </summary>
        /// <externalUnit/>
        /// <revision revisor="dev13" date="11/19/2009" version="1.1.3.7">
        ///     Added documentation header
        /// </revision>
        public void Clear()
        {
            this.ballots.Entries.Clear();
            this.contests.Entries.Clear();
            this.candidates.Entries.Clear();
            this.parameters.Entries.Clear();

            this.candlist.Entries.Clear();
            this.contlist.Entries.Clear();
            this.parties.Entries.Clear();

            this.target = null;
        }
        /// <summary>
        ///     Sets the target.
        /// </summary>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="offsetX">The offset X.</param>
        /// <param name="offsetY">The offset Y.</param>
        /// <param name="lineWidth">Width of the line.</param>
        /// <param name="lineDensity">The line density.</param>
        /// <externalUnit/>
        /// <revision revisor="dev13" date="11/19/2009" version="1.1.3.7">
        ///     Added documentation header
        /// </revision>
        public void SetTarget(
            double width,
            double height,
            double offsetX,
            double offsetY,
            double lineWidth,
            double lineDensity)
        {
            BallotEntrySet targetParams =
                new BallotEntrySet(typeof(StpTargetParam));

            targetParams.Entries.Add(
                new object[]
            {
                1,
                TargetParam.Width.ToString(), string.Empty,
                width.ToString()
            });

            targetParams.Entries.Add(
                new object[]
            {
                2,
                TargetParam.Height.ToString(), string.Empty,
                height.ToString()
            });

            targetParams.Entries.Add(
                new object[]
            {
                3,
                TargetParam.OffsetX.ToString(), string.Empty,
                offsetX.ToString()
            });

            targetParams.Entries.Add(
                new object[]
            {
                4,
                TargetParam.OffsetY.ToString(), string.Empty,
                offsetY.ToString()
            });

            targetParams.Entries.Add(
                new object[]
            {
                5,
                TargetParam.LineWidth.ToString(), string.Empty,
                lineWidth.ToString()
            });

            targetParams.Entries.Add(
                new object[]
            {
                6,
                TargetParam.LineDensity.ToString(), string.Empty,
                lineDensity.ToString()
            });

            TargetType type;

            int idx = this.parameters.FindIndex(
                StpParam.PDFLayoutParamId, (int)PdfParam.TargetType);
            int val = this.parameters.GetValueInt(idx, StpParam.ParamValue);

            type = (TargetType)Enum.ToObject(typeof(TargetType), val);

            this.target = new PaperBallotTarget(targetParams, type);
        }