Exemplo n.º 1
0
        public bool isExist(Point pointStart, Point pointEnd, bool isexit)
        {
            FlowData fd = new FlowData();

            fd.p0     = pointStart;
            fd.p1     = pointEnd;
            fd.isExit = isexit;
            return(listFlow.Contains(fd));
        }
Exemplo n.º 2
0
        public void AddFlow(Point pointStart, Point pointEnd, bool isexit)
        {
            FlowData fd = new FlowData();

            fd.p0     = pointStart;
            fd.p1     = pointEnd;
            fd.isExit = isexit;
            listFlow.Add(fd);
        }
Exemplo n.º 3
0
        public FlowData getElement(int index)
        {
            FlowData fd = new FlowData();

            if (index <= listFlow.Count)
            {
                fd = (FlowData)listFlow[index];
            }
            return(fd);
        }
Exemplo n.º 4
0
        public bool isExist(FlowData fdata)
        {
            FlowData fd;
            bool     succ = false;

            for (int i = 0; i < listFlow.Count; i++)
            {
                fd = (FlowData)listFlow[i];
                if (fd.Equals(fdata))
                {
                    succ = true;
                    break;
                }
            }
            return(succ);
        }
Exemplo n.º 5
0
        public bool DeleteFlow(FlowData fdata)
        {
            FlowData fd;
            bool     succ = false;

            for (int i = 0; i < listFlow.Count; i++)
            {
                fd = (FlowData)listFlow[i];
                if (fd.Equals(fdata))
                {
                    listFlow.RemoveAt(i);
                    succ = true;
                    break;
                }
            }
            return(succ);
        }
Exemplo n.º 6
0
        //所有坐标平移计算
        bool CoordinateTranslationFunc(Point ShiftSize)
        //函数名:CoordinateTranslationFunc(point ShiftSize)
        //输入:ListFlow待绘制图坐标数组,移动大小Size
        //输出:更新后的ListFlow待绘制图坐标数组
        //功能描述:将数据坐标数据按向量Size进行平移
        {
            //算法
            //算法
            //step1、数据有效性检查
            //若 ListFlow==null 则
            if (listFlow == null)
            {
                return(false);
            }
            //若 ListFlow ==0则
            if (listFlow.Count == 0)
            {
                return(false);
            }

            ArrayList ListFlowBackup = (ArrayList)listFlow.Clone();

            listFlow.Clear();
            FlowData FlowDataTemp = new FlowData();//

            //Step2、数组循环
            //for i=0 to ListFlow.Length
            for (int i = 0; i < ListFlowBackup.Count; i++)
            {
                FlowDataTemp = (FlowData)(ListFlowBackup[i]);

                //step3、坐标移动
                //P0赋值p0减去ShiftSize
                FlowDataTemp.p0.Offset(ShiftSize);

                //P1赋值p1减去ShiftSize
                FlowDataTemp.p1.Offset(ShiftSize);

                listFlow.Add(FlowDataTemp);
            }//step4、跳到step2

            //step5、返回true
            return(true);
        }
Exemplo n.º 7
0
        public bool DeleteFlow(Point pointStart, Point pointEnd, bool isexit)
        {
            FlowData fd = new FlowData();
            FlowData fdata;

            fd.p0     = pointStart;
            fd.p1     = pointEnd;
            fd.isExit = isexit;
            bool succ = false;

            for (int i = 0; i < listFlow.Count; i++)
            {
                fdata = (FlowData)listFlow[i];
                if (fd.Equals(fdata))
                {
                    listFlow.RemoveAt(i);
                    succ = true;
                    break;
                }
            }
            return(succ);
        }
Exemplo n.º 8
0
        //得到坐标集合的最大值和最小值
        public bool GetCoordinateMinAndMaxFunc(ref Point MinPoint, ref Point MaxPoint)
        //函数名:bool GetCoordinateMinAndMaxFunc(ref point MinPoint,ref point MaxPoint )
        //输入:ListFlow待绘制图坐标数组
        //输出:上述坐标集合的最大值和最小值坐标MinPoint,MaxPoint
        //功能描述:获取ListFlow最大值和最小值
        {
            //算法
            //step1、数据有效性检查
            //若 ListFlow==null 则
            if (listFlow == null)
            {
                return(false);
            }
            //若 ListFlow ==0则
            if (listFlow.Count == 0)
            {
                return(false);
            }

            //step2、MinPoint,MaxPoint初始化
            //MinPoint,MaxPoint的X坐标赋值为ListFlow[0]的p0坐标X
            MinPoint.X = ((FlowData)(listFlow[0])).p0.X;
            MaxPoint.X = ((FlowData)(listFlow[0])).p0.X;

            //MinPoint,MaxPoint的Y坐标赋值为ListFlow[0]的p0坐标Y
            MinPoint.Y = ((FlowData)(listFlow[0])).p0.Y;
            MaxPoint.Y = ((FlowData)(listFlow[0])).p0.Y;

            FlowData FlowDataTemp = new FlowData();//

            //Step3、数组循环
            //for i=0 to ListFlow.Length
            for (int i = 0; i < listFlow.Count; i++)
            {
                FlowDataTemp = (FlowData)(listFlow[i]);

                //step4、X坐标与最大和最小值比较
                //若 第i个ListFlow坐标X大于MaxPoint坐标X 则
                if (FlowDataTemp.p0.X > MaxPoint.X)
                {
                    //MaxPoint坐标X赋值为第i个ListFlow坐标X
                    MaxPoint.X = FlowDataTemp.p0.X;
                }

                //若 第i个ListFlow坐标X小于MinPoint坐标X 则
                if (FlowDataTemp.p0.X < MinPoint.X)
                {
                    //MinPoint坐标X赋值为第i个ListFlow坐标X
                    MinPoint.X = FlowDataTemp.p0.X;
                }


                //Y坐标与最大和最小值比较
                //若 第i个ListFlow坐标Y大于MaxPoint坐标Y 则
                if (FlowDataTemp.p0.Y > MaxPoint.Y)
                {
                    //MaxPoint坐标Y赋值为第i个ListFlow坐标Y
                    MaxPoint.Y = FlowDataTemp.p0.Y;
                }
                //若 第i个ListFlow坐标Y小于MinPoint坐标Y 则
                if (FlowDataTemp.p0.Y < MinPoint.Y)
                {
                    //MinPoint坐标Y赋值为第i个ListFlow坐标Y
                    MinPoint.Y = FlowDataTemp.p0.Y;
                }
            }//step5、跳到step3

            //step6、返回true
            return(true);
        }
Exemplo n.º 9
0
 public void AddFlow(FlowData fdata)
 {
     listFlow.Add(fdata);
 }