コード例 #1
0
        protected override void OnInitialize()
        {
            base.OnInitialize();

            var prop = Property as EdgeDrawProperty;

            if (prop == null)
            {
                return;
            }

            Drawers.Clear();

            var startVertexDrawerProp = new VertexDrawProperty();

            startVertexDrawerProp.Color    = prop.StartVertexColor;
            startVertexDrawerProp.Position = prop.StartVertex;
            Drawers.Add(new VertexDrawer(startVertexDrawerProp));

            var lineDrawerProp = new LineDrawerProperty();

            lineDrawerProp.Color       = prop.LineColor;
            lineDrawerProp.StartVertex = prop.StartVertex;
            lineDrawerProp.EndVertex   = prop.EndVertex;
            Drawers.Add(new LineDrawer(lineDrawerProp));

            var endVertexDrawerProp = new VertexDrawProperty();

            endVertexDrawerProp.Color    = prop.EndVertexColor;
            endVertexDrawerProp.Position = prop.EndVertex;
            Drawers.Add(new VertexDrawer(endVertexDrawerProp));
        }
コード例 #2
0
ファイル: TriangleDrawer.cs プロジェクト: skanmera/Algonim
        protected override void OnInitialize()
        {
            base.OnInitialize();

            var prop = Property as TriangleDrawProperty;

            if (prop == null)
            {
                return;
            }

            Drawers.Clear();

            var vertexAProp = new VertexDrawProperty();

            vertexAProp.Color    = prop.VertexAColor;
            vertexAProp.Position = prop.VertexA;
            Drawers.Add(new VertexDrawer(vertexAProp));

            var lineABDrawerProp = new LineDrawerProperty();

            lineABDrawerProp.Color       = prop.EdgeABColor;
            lineABDrawerProp.StartVertex = prop.VertexA;
            lineABDrawerProp.EndVertex   = prop.VertexB;
            Drawers.Add(new LineDrawer(lineABDrawerProp));

            var vertexBProp = new VertexDrawProperty();

            vertexBProp.Color    = prop.VertexAColor;
            vertexBProp.Position = prop.VertexB;
            Drawers.Add(new VertexDrawer(vertexBProp));

            var lineBCDrawerProp = new LineDrawerProperty();

            lineBCDrawerProp.Color       = prop.EdgeBCColor;
            lineBCDrawerProp.StartVertex = prop.VertexB;
            lineBCDrawerProp.EndVertex   = prop.VertexC;
            Drawers.Add(new LineDrawer(lineBCDrawerProp));

            var vertexCProp = new VertexDrawProperty();

            vertexCProp.Color    = prop.VertexCColor;
            vertexCProp.Position = prop.VertexC;
            Drawers.Add(new VertexDrawer(vertexCProp));

            var lineCADrawerProp = new LineDrawerProperty();

            lineCADrawerProp.Color       = prop.EdgeCAColor;
            lineCADrawerProp.StartVertex = prop.VertexC;
            lineCADrawerProp.EndVertex   = prop.VertexA;
            Drawers.Add(new LineDrawer(lineCADrawerProp));
        }