Esempio n. 1
0
        public IPositionSet GetRamSet2()
        {
            List <IPosition> lst  = new List <IPosition>();
            Position_Point   ipos = null;

            ipos = new Position_Point();
            ipos.SetX(10);
            ipos.SetY(20);
            lst.Add(ipos);
            ipos = new Position_Point();
            ipos.SetX(50);
            ipos.SetY(70);
            lst.Add(ipos);
            ipos = new Position_Point();
            ipos.SetX(50);
            ipos.SetY(90);
            lst.Add(ipos);
            ipos = new Position_Point();
            ipos.SetX(25);
            ipos.SetY(30);
            lst.Add(ipos);
            PositionSetEdit_ImplementByICollectionTemplate pSet = new PositionSetEdit_ImplementByICollectionTemplate(lst);

            return(pSet);
        }
Esempio n. 2
0
        public IPositionSet WriteLineInGrid(float gridWidth, float gridHeight, IPosition startPosition, IPosition endPosition)
        {
            Position_Point refPos = new Position_Point();

            refPos.SetX(0);
            refPos.SetY(0);
            return(getBlockLine(refPos, gridWidth, startPosition, endPosition));
        }
        public void Init(float leftestX, float lowestY, float MapWidth, float MapHeight, float MaxGridLength, int UnitNumInLength, int effectivelevelNum)
        {
            this.MapWidth  = MapWidth;
            this.MapHeight = MapHeight;

            this.MaxGridLength           = MaxGridLength;
            this.set_UnitNumInGridLength = UnitNumInLength;
            this.EffectivelevelNum       = effectivelevelNum;

            RelativelyPoint.SetX(leftestX);
            RelativelyPoint.SetY(lowestY);

            InitMemory();
        }
Esempio n. 4
0
        public IPositionSet GetRamSet(int wRank, int hRank)
        {
            List <IPosition> lst  = new List <IPosition>();
            Position_Point   ipos = null;

            for (int i = 0; i < 100; i++)
            {
                ipos = new Position_Point();
                ipos.SetX(RandomMakerAlgorithm.RandomMaker.RapidBetween(0, wRank));
                ipos.SetY(RandomMakerAlgorithm.RandomMaker.RapidBetween(0, hRank));
                lst.Add(ipos);
            }
            PositionSetEdit_ImplementByICollectionTemplate pSet = new PositionSetEdit_ImplementByICollectionTemplate(lst);

            return(pSet);
        }
        //根据函数来作图
        public void draw(double[] xData)
        {
            List <IPosition>[] pl = new List <IPosition> [nameList.Count]; //new List<IPosition>()[xData.Length];

            for (int i = 0; i < nameList.Count; i++)
            {
                pl[i] = new List <IPosition>();
            }

            for (int j = 0; j < xData.Length; j++)
            {
                //对每个函数分发同一个object
                Object temp = null;

                if (getPublicObjectFunc != null)
                {
                    temp = getPublicObjectFunc(xData[j]);
                }

                //先对每一个函数计算同一个规模的输入的函数值
                for (int i = 0; i < nameList.Count; i++)
                {
                    Position_Point p = new Position_Point();
                    p.SetX((float)(xData[j]));

                    if (getPublicObjectFunc == null)
                    {
                        p.SetY((float)(funcList[i](xData[j])));
                    }
                    else
                    {
                        p.SetY((float)(funcWithObjectList[i](xData[j], temp)));
                    }

                    pl[i].Add(p);
                }
            }

            for (int i = 0; i < nameList.Count; i++)
            {
                curvePlot.addCurve(nameList[i], new PositionSet_ImplementByIEnumerableTemplate(pl[i]));
            }

            curvePlot.draw();
        }
 public void draw_Old(double[] xData)
 {
     for (int i = 0; i < nameList.Count; i++)
     {
         List <IPosition> pl    = new List <IPosition>();
         double[]         yData = new double[xData.Length];
         string           name  = nameList[i];
         Func             func  = funcList[i];
         for (int j = 0; j < xData.Length; j++)
         {
             Position_Point p = new Position_Point();
             p.SetX((float)(xData[j]));
             p.SetY((float)(func(xData[j])));
             pl.Add(p);
         }
         curvePlot.addCurve(name, new PositionSet_ImplementByIEnumerableTemplate(pl));
     }
     curvePlot.draw();
 }
        public IPosition GetMouseDoubleChickedRealPosition()
        {
            System.Threading.Thread currentThread            = System.Threading.Thread.CurrentThread;
            Position_Point          mouseChickedRealPosition = null;

            this.BeginInvoke(new dShow(MessageBox.Show), new object[] { "please double chick on the screen." });

            MouseDoubleClick += delegate(object sender, MouseEventArgs e)
            {
                mouseChickedRealPosition = new Position_Point();
                mouseChickedRealPosition.SetX(ConvertMouseXToRealX(e.X));
                mouseChickedRealPosition.SetY(ConvertMouseYToRealY(e.Y));

                if ((currentThread.ThreadState & System.Threading.ThreadState.Suspended) == System.Threading.ThreadState.Suspended)
                {
                    currentThread.Resume();
                }
            };

            currentThread.Suspend();
            return(mouseChickedRealPosition);
        }