Пример #1
0
            bool AlreadyFinished(ref Polygon polygon, OperationType ot, SweepEvent currentEvent)
            {
                if ((ot == OperationType.INTERSECTION && currentEvent.Point.x > minMaxX) ||
                    (ot == OperationType.DIFFERENCE && currentEvent.Point.x > bbSubject.max.x))
                {
                    polygon = connector.CreatePolygon();

                    return(true);
                }

                if (ot == OperationType.UNION && currentEvent.Point.x > minMaxX)
                {
                    // add all the non-processed line segments to the result
                    if (!currentEvent.Left)
                    {
                        connector.Add(currentEvent.CreateEdge());
                    }

                    while (!futureSweepLineEvents.IsEmpty())
                    {
                        currentEvent = futureSweepLineEvents.ExtractFirst();

                        if (!currentEvent.Left)
                        {
                            connector.Add(currentEvent.CreateEdge());
                        }
                    }

                    polygon = connector.CreatePolygon();

                    return(true);
                }

                return(false);
            }
Пример #2
0
 public Randomize() : base()
 {
     Rectangle = new RectangleF(0, 0, 16, 16);
     Resizable = false;
     Value     = new Netron.Connector(this, "Value", false);
     Connector.Add(Value);
 }
Пример #3
0
 public Transfer() : base()
 {
     Title  = "Transfer";
     Source = new Netron.Connector(this, "Source", false);
     Connector.Add(Source);
     Target = new Netron.Connector(this, "Target", false);
     Connector.Add(Target);
 }
Пример #4
0
        public Inspect() : base()
        {
            Rectangle = new RectangleF(0, 0, 50, 16);
            Resizable = false;
            Value     = new Netron.Connector(this, "Value", false);
            Connector.Add(Value);

            __Value = 0.0f;
        }
Пример #5
0
        public static void Start()
        {
            VasilyRunner.Run();
            Connector.Add <SqlConnection>("key", "链接字符串");
            Connector.Add <SqlConnection>("key-wr", "读-链接字符串", "写-链接字符串");
            Connector.AddRead <SqlConnection>("read1", "读-链接字符串");
            Connector.AddWrite <SqlConnection>("write2", "写-链接字符串");

            //创建driver的三种方式
            //wrapper = wrapper1 = wrapper2


            DapperWrapper <One> wrapper  = new DapperWrapper <One>("key");
            DapperWrapper <One> wrapper1 = "key";
            var wrapper2 = DapperWrapper <One> .UseKey("key");

            //wrapper4 = wrapper5 = wrapper6 = wrapper7
            DapperWrapper <One> wrapper4 = new DapperWrapper <One>("read1", "write2");
            DapperWrapper <One> wrapper5 = "key-wr | write2          ";
            var wrapper6 = DapperWrapper <One> .UseKey("key-wr", "write2");

            var wrapper7 = DapperWrapper <One> .UseKey("key-wr");



            One one  = new One();
            One one1 = new One();
            One one2 = new One();


            //两种调用方式

            //指定操作方式,RequestType赋值一次即可。
            //RequestType默认为 Complete;
            wrapper.RequestType = VasilyRequestType.Complete;
            wrapper.GetAll();

            //使用属性调用
            wrapper.Complete.GetAll();

            //获取所有元素
            wrapper.GetAll();
            wrapper.GetByPrimary(one);
            wrapper.GetsIn(1, 2, 3, 4);
            wrapper.GetIn(1);
            wrapper.IsRepeat(one);
            wrapper.NoRepeateAdd(one);
            wrapper.GetNoRepeateId <int>(one);
            wrapper.GetRepeates(one);
            wrapper.ModifyByPrimary(one, one1, one2);
            wrapper.Add(one, one1, one2);
            wrapper.SingleDeleteByPrimary(1);
            wrapper.EntitiesDeleteByPrimary(one, one1, one2);

            //SafeInsert = NoRepeateInsert + GetNoRepeateId
            wrapper.SafeAdd(one);
        }
Пример #6
0
 public Account() : base()
 {
     Title   = "Account";
     Balance = new Netron.Connector(this, "Balance", true);
     Connector.Add(Balance);
     Transaction = new Netron.Connector(this, "Transaction", true);
     Connector.Add(Transaction);
     __Balance = new Currency(1000, "EUR");
 }
Пример #7
0
 public Inspect() : base()
 {
     Title     = "Inspect";
     Rectangle = new RectangleF(0, 0, 120, 40);
     Resizable = false;
     Value     = new Netron.Connector(this, "Value", false);
     Connector.Add(Value);
     __Value = new Currency();
 }
Пример #8
0
 public Person() : base()
 {
     Rectangle = new RectangleF(0, 0, 120, 40);
     Father    = new Netron.Connector(this, "Father", false);
     Connector.Add(Father);
     Mother = new Netron.Connector(this, "Mother", false);
     Connector.Add(Mother);
     Children = new Netron.Connector(this, "Children", false);
     Connector.Add(Children);
 }
Пример #9
0
        public IAC() : base()
        {
            Rectangle   = new RectangleF(0, 0, 16, 16);
            Resizable   = false;
            __Dentrides = new Netron.Connector(this, "Dentrides", true);
            Connector.Add(__Dentrides);
            __Activation = new Netron.Connector(this, "Activation", false);
            Connector.Add(__Activation);

            Activation = 0.1f;
        }
Пример #10
0
            SimpleClosedPath Join(SimpleClosedPath exterior, SimpleClosedPath hole, Edge edge)
            {
                connector.Clear();

                connector.Add(new Edge(edge.To, edge.From));

                foreach (Edge e in exterior.OwnEdgesOnly())
                {
                    connector.Add(e);
                }

                foreach (Edge e in hole.OwnEdgesOnly())
                {
                    connector.Add(e);
                }

                connector.Add(edge);

                return(connector.CreatePolygon().GetPath(0));
            }
Пример #11
0
        public void TestReadAndWrite()
        {
            Connector.Add <MySqlConnection>(
                "unit",
                "database=Test"
                );

            var creator = Connector.Initor("unit");

            Assert.Equal("database=Test", creator.Read().ConnectionString);
            Assert.Equal("database=Test", creator.Write().ConnectionString);
        }
Пример #12
0
        public Inspect2() : base()
        {
            Size = 100;

            Rectangle = new RectangleF(0, 0, Size, 20);
            Resizable = false;
            __Value   = new Netron.Connector(this, "Value", false);
            Connector.Add(__Value);

            Value  = new float[Size];
            Redraw = 0;
        }
Пример #13
0
        public void TestWrite()
        {
            Connector.Add <MySqlConnection>(
                "unit",
                "database=Read",
                "database=Write"
                );

            DbCreator creator = Connector.WriteInitor("unit");

            Assert.NotNull(creator);
            Assert.Equal("database=Write", creator().ConnectionString);
        }
Пример #14
0
        public Synapse() : base()
        {
            Rectangle   = new RectangleF(0, 0, 12, 12);
            Resizable   = false;
            __Dentrides = new Netron.Connector(this, "Dentrides", true);
            Connector.Add(__Dentrides);
            __Axon = new Netron.Connector(this, "Axon", false);
            Connector.Add(__Axon);
            __Weight = new Netron.Connector(this, "Weight", true);
            Connector.Add(__Weight);

            Weight = 0.2f;
        }
Пример #15
0
        public void Demo()
        {
            //添加一个SqlServer驱动的读写字符串
            //key为"key:sql"
            //连接字符串为"连接字符串"
            Connector.Add <SqlConnection>("key:sql1", "连接字符串");
            Connector.Add <SqlConnection>("key:sql2", "写-连接字符串", "读-连接字符串");

            //获取"key:sql"的连接初始化器
            var creator = Connector.Initor("key:sql1");
            var reader  = Connector.ReadInitor("key:sql1");
            var writter = Connector.WriteInitor("key:sql2");

            //获取连接委托
            DbCreator read  = creator.Read;
            DbCreator write = creator.Write;

            //创建连接
            IDbConnection r_connection = read();
            IDbConnection w_connection = write();
        }
Пример #16
0
        public Matrix() : base()
        {
            Rectangle = new RectangleF(0, 0, 120, 100);
            Resizable = true;

            Value = new Netron.Connector[Width][];
            for (int x = 0; x < Width; x++)
            {
                Value[x] = new Netron.Connector[Height];
            }

            for (int x = 0; x < Width; x++)
            {
                for (int y = 0; y < Height; y++)
                {
                    String sx = String.Format("{0}", x);
                    String sy = String.Format("{0}", y);
                    String s  = "(" + sx + ", " + sy + ")";

                    Value[x][y] = new Netron.Connector(this, s, true);
                    Connector.Add(Value[x][y]);
                }
            }
        }
Пример #17
0
 public void Add <T, S>(string key, string reader, string writter)
 {
     Connector.Add <T, S>(key, reader, writter);
 }
Пример #18
0
 public void Add <T>(string key, string value)
 {
     Connector.Add <T>(key, value);
 }