Пример #1
0
        TransferToGraphDrawer
        (
            GraphDrawer graphDrawer
        )
        {
            Debug.Assert(graphDrawer != null);
            AssertValid();

            this.LabelUserSettings.TransferToGraphDrawer(graphDrawer);

            graphDrawer.BackColor =
                WpfGraphicsUtil.ColorToWpfColor(this.BackColor);

            EdgeDrawer   oEdgeDrawer   = graphDrawer.EdgeDrawer;
            VertexDrawer oVertexDrawer = graphDrawer.VertexDrawer;

            EdgeWidthConverter oEdgeWidthConverter = new EdgeWidthConverter();
            AlphaConverter     oAlphaConverter     = new AlphaConverter();

            oEdgeDrawer.Width =
                oEdgeWidthConverter.WorkbookToGraph(this.EdgeWidth);

            oEdgeDrawer.SelectedWidth =
                oEdgeWidthConverter.WorkbookToGraph(this.SelectedEdgeWidth);

            oEdgeDrawer.Color = WpfGraphicsUtil.ColorToWpfColor(

                Color.FromArgb(oAlphaConverter.WorkbookToGraphAsByte(
                                   this.EdgeAlpha),

                               this.EdgeColor)
                );

            oEdgeDrawer.SelectedColor = WpfGraphicsUtil.ColorToWpfColor(
                this.SelectedEdgeColor);

            oEdgeDrawer.RelativeArrowSize = this.RelativeArrowSize;

            oVertexDrawer.Shape = this.VertexShape;

            oVertexDrawer.Radius = (new VertexRadiusConverter()).WorkbookToGraph(
                this.VertexRadius);

            oVertexDrawer.Color = WpfGraphicsUtil.ColorToWpfColor(

                Color.FromArgb(oAlphaConverter.WorkbookToGraphAsByte(
                                   this.VertexAlpha),

                               this.VertexColor)
                );

            oVertexDrawer.SelectedColor = WpfGraphicsUtil.ColorToWpfColor(
                this.SelectedVertexColor);
        }
Пример #2
0
        ReadWidth
        (
            ExcelTableReader.ExcelTableRow oRow,
            EdgeWidthConverter oEdgeWidthConverter,
            IEdge oEdge
        )
        {
            Debug.Assert(oRow != null);
            Debug.Assert(oEdgeWidthConverter != null);
            AssertValid();

            String sWidth;

            if (!oRow.TryGetNonEmptyStringFromCell(EdgeTableColumnNames.Width,
                                                   out sWidth))
            {
                return;
            }

            Single fWidth;

            if (!Single.TryParse(sWidth, out fWidth))
            {
                Range oInvalidCell = oRow.GetRangeForCell(
                    EdgeTableColumnNames.Width);

                OnWorkbookFormatError(String.Format(

                                          "The cell {0} contains an invalid width.  The edge width,"
                                          + " which is optional, must be a number.  Any number is"
                                          + " acceptable, although {1} is used for any number less than"
                                          + " {1} and {2} is used for any number greater than {2}."
                                          ,
                                          ExcelUtil.GetRangeAddress(oInvalidCell),
                                          EdgeWidthConverter.MinimumWidthWorkbook,
                                          EdgeWidthConverter.MaximumWidthWorkbook
                                          ),

                                      oInvalidCell
                                      );
            }

            oEdge.SetValue(ReservedMetadataKeys.PerEdgeWidth,
                           oEdgeWidthConverter.WorkbookToGraph(fWidth));
        }
Пример #3
0
        //*************************************************************************
        //  Method: TransferToGraphDrawer()
        //
        /// <summary>
        /// Transfers the settings to a <see cref="GraphDrawer" />.
        /// </summary>
        ///
        /// <param name="graphDrawer">
        /// Graph drawer to transfer the settings to.
        /// </param>
        //*************************************************************************
        public void TransferToGraphDrawer(
            GraphDrawer graphDrawer
            )
        {
            Debug.Assert(graphDrawer != null);
            AssertValid();

            this.LabelUserSettings.TransferToGraphDrawer(graphDrawer);

            graphDrawer.BackColor =
            WpfGraphicsUtil.ColorToWpfColor(this.BackColor);

            EdgeDrawer oEdgeDrawer = graphDrawer.EdgeDrawer;
            VertexDrawer oVertexDrawer = graphDrawer.VertexDrawer;

            EdgeWidthConverter oEdgeWidthConverter = new EdgeWidthConverter();
            AlphaConverter oAlphaConverter = new AlphaConverter();

            oEdgeDrawer.Width =
            oEdgeWidthConverter.WorkbookToGraph(this.EdgeWidth);

            oEdgeDrawer.SelectedWidth =
            oEdgeWidthConverter.WorkbookToGraph(this.SelectedEdgeWidth);

            oEdgeDrawer.Color = WpfGraphicsUtil.ColorToWpfColor(

            Color.FromArgb(oAlphaConverter.WorkbookToGraphAsByte(
                this.EdgeAlpha),

            this.EdgeColor)
            );

            oEdgeDrawer.SelectedColor = WpfGraphicsUtil.ColorToWpfColor(
            this.SelectedEdgeColor);

            oEdgeDrawer.RelativeArrowSize = this.RelativeArrowSize;

            oVertexDrawer.Shape = this.VertexShape;

            oVertexDrawer.Radius = ( new VertexRadiusConverter() ).WorkbookToGraph(
            this.VertexRadius);

            oVertexDrawer.Color = WpfGraphicsUtil.ColorToWpfColor(

            Color.FromArgb(oAlphaConverter.WorkbookToGraphAsByte(
                this.VertexAlpha),

            this.VertexColor)
            );

            oVertexDrawer.SelectedColor = WpfGraphicsUtil.ColorToWpfColor(
            this.SelectedVertexColor);
        }