コード例 #1
0
ファイル: OrGate.cs プロジェクト: des904e15/attacktrees
        protected override void Render(ContentWriter cw, Vector2D offset)
        {
            var top = offset + new Vector2D(Size.X / 2, Size.Y);

            var left_topleft = offset + new Vector2D(Vector1D.Zero, Size.Y * 3 / 4);
            var left_bottomleft = offset + new Vector2D(Vector1D.Zero, Size.Y * 1 / 4);

            var right_topright = offset + new Vector2D(Size.X, Size.Y * 3 / 4);
            var right_bottomright = offset + new Vector2D(Size.X, Size.Y * 1 / 4);

            var bottomright = offset + new Vector2D(Size.X, Vector1D.Zero);

            var indent = Size.X / 5;

            var bMidR = offset + new Vector2D(Size.X - indent, Size.Y / 10);
            var bottommid = offset + new Vector2D(Size.X / 2, Size.Y / 10);
            var bMidL = offset + new Vector2D(indent, Size.Y / 10);

            cw.MoveTo(offset);
            cw.LineTo(left_bottomleft);
            cw.CurveFromTo(left_topleft, top);
            cw.CurveFromTo(right_topright, right_bottomright);
            cw.LineTo(bottomright);
            cw.CurveTo(bMidR, bottommid);
            cw.CurveFromTo(bMidL, offset);

            cw.CloseShape = true;
        }
コード例 #2
0
ファイル: Connector.cs プロジェクト: des904e15/attacktrees
        protected override void Render(ContentWriter cw, Vector2D offset)
        {
            var size = Size;
            var width = Math.Abs(size.X.Value(UnitsOfMeasure.Centimeters));
            if (width < 1)
                size.X = Vector1D.Zero;

            var p1 = offset + new Vector2D(Vector1D.Zero, size.Y);
            var p2 = offset + new Vector2D(Vector1D.Zero, size.Y / 2);
            var p3 = offset + new Vector2D(size.X, size.Y / 2);
            var p4 = offset + new Vector2D(size.X, Vector1D.Zero);

            cw.MoveTo(centerX, offset.Y + size.Y + Node.GateHeight + Node.Margin);
            cw.LineTo(centerX, offset.Y + size.Y + Node.GateHeight / 2);

            cw.MoveTo(offset.X, offset.Y + size.Y + Node.GateHeight / 2);
            cw.LineTo(p1);
            cw.LineTo(p2);
            cw.LineTo(p3);
            cw.LineTo(p4);
        }
コード例 #3
0
ファイル: AndGate.cs プロジェクト: des904e15/attacktrees
        protected override void Render(ContentWriter cw, Vector2D offset)
        {
            var topleft = offset + new Vector2D(Vector1D.Zero, Size.Y);
            var topright = offset + Size;

            var left = offset + new Vector2D(Vector1D.Zero, Size.Y / 2);
            var right = offset + new Vector2D(Size.X, Size.Y / 2);

            var top = offset + new Vector2D(Size.X / 2, Size.Y);
            var bottomright = offset + new Vector2D(Size.X, Vector1D.Zero);

            cw.MoveTo(offset);
            cw.LineTo(left);
            cw.CurveTo(topleft, top, top);
            cw.CurveTo(topright, right);
            cw.LineTo(bottomright);
            cw.LineTo(offset);

            cw.CloseShape = true;
        }