Ejemplo n.º 1
0
        //*************************************************************************
        //  Constructor: ReadWorkbookContext()
        //
        /// <summary>
        /// Initializes a new instance of the <see cref="ReadWorkbookContext" />
        /// class.
        /// </summary>
        //*************************************************************************

        public ReadWorkbookContext()
        {
            m_bIgnoreVertexLocations   = true;
            m_bFillIDColumns           = false;
            m_bPopulateVertexWorksheet = false;
            m_bReadEdgeWeights         = false;
            m_bReadGroups                  = false;
            m_bSaveGroupVertices           = false;
            m_bReadVertexLabels            = false;
            m_bReadEdgeLabels              = false;
            m_bReadVertexImages            = false;
            m_oDefaultVertexImageSize      = new Nullable <Single>();
            m_eDefaultVertexShape          = VertexShape.Disk;
            m_bReadAllEdgeAndVertexColumns = false;
            m_oGraphRectangle              = Rectangle.FromLTRB(0, 0, 100, 100);
            m_oColorConverter2             = new ColorConverter2();
            m_oBooleanConverter            = new BooleanConverter();
            m_oEdgeWidthConverter          = new EdgeWidthConverter();
            m_oEdgeStyleConverter          = new EdgeStyleConverter();
            m_oVertexRadiusConverter       = new VertexRadiusConverter();

            m_oVertexLocationConverter =
                new VertexLocationConverter(m_oGraphRectangle);

            m_oVertexNameDictionary  = new Dictionary <String, IVertex>();
            m_oEdgeRowIDDictionary   = new Dictionary <Int32, IIdentityProvider>();
            m_oVertexRowIDDictionary = new Dictionary <Int32, IIdentityProvider>();

            AssertValid();
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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));
        }
Ejemplo n.º 4
0
        //*************************************************************************
        //  Constructor: ReadWorkbookContext()
        //
        /// <summary>
        /// Initializes a new instance of the <see cref="ReadWorkbookContext" />
        /// class.
        /// </summary>
        //*************************************************************************
        public ReadWorkbookContext()
        {
            m_bIgnoreVertexLocations = true;
            m_bFillIDColumns = false;
            m_bPopulateVertexWorksheet = false;
            m_bReadEdgeWeights = false;
            m_bReadGroups = false;
            m_bSaveGroupVertices = false;
            m_bReadVertexLabels = false;
            m_bReadEdgeLabels = false;
            m_bReadVertexImages = false;
            m_oDefaultVertexImageSize = new Nullable<Single>();
            m_eDefaultVertexShape = VertexShape.Disk;
            m_bReadAllEdgeAndVertexColumns = false;
            m_oGraphRectangle = Rectangle.FromLTRB(0, 0, 100, 100);
            m_oColorConverter2 = new ColorConverter2();
            m_oBooleanConverter = new BooleanConverter();
            m_oEdgeWidthConverter = new EdgeWidthConverter();
            m_oEdgeStyleConverter = new EdgeStyleConverter();
            m_oVertexRadiusConverter = new VertexRadiusConverter();

            m_oVertexLocationConverter =
            new VertexLocationConverter(m_oGraphRectangle);

            m_oVertexNameDictionary = new Dictionary<String, IVertex>();
            m_oEdgeRowIDDictionary = new Dictionary<Int32, IIdentityProvider>();
            m_oVertexRowIDDictionary = new Dictionary<Int32, IIdentityProvider>();

            AssertValid();
        }
Ejemplo n.º 5
0
 public void TearDown()
 {
     m_oEdgeWidthConverter = null;
 }
Ejemplo n.º 6
0
 public void SetUp()
 {
     m_oEdgeWidthConverter = new EdgeWidthConverter();
 }
Ejemplo n.º 7
0
 //*************************************************************************
 //  Constructor: EdgeWidthConverterTest()
 //
 /// <summary>
 /// Initializes a new instance of the <see
 /// cref="EdgeWidthConverterTest" /> class.
 /// </summary>
 //*************************************************************************
 public EdgeWidthConverterTest()
 {
     m_oEdgeWidthConverter = null;
 }
Ejemplo n.º 8
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);
        }