Exemple #1
0
        private void DrawCompareWave()
        {
            //关闭日期标志
            selectDateFlag = false;

            //标志已经启用对比功能
            compareFlag = true;
            //获取该风机点的风速集合
            compareWindSpeedList = FanPointDAL.GetWindSpeedOrWindDirectionOfSinglePoint(FanPointDAL.Type.风速, windFieldOfCompareFan.BranchTableName, cmbWindFieldName.SelectedItem.ToString(), cmbWindFanNumber.SelectedItem.ToString(), startTime, endTime);
            //获取该风机点的风向集合
            compareWindDirectionList = FanPointDAL.GetWindSpeedOrWindDirectionOfSinglePoint(FanPointDAL.Type.风向, windFieldOfCompareFan.BranchTableName, cmbWindFieldName.SelectedItem.ToString(), cmbWindFanNumber.SelectedItem.ToString(), startTime, endTime);
            //获取风速最大值和最小值
            compareWindSpeedMaxAndMin = new double[2];
            compareWindSpeedMaxAndMin = FanPointDAL.GetMaxMinDataOfSinglePoint(FanPointDAL.Type.风速, windFieldOfCompareFan.BranchTableName, cmbWindFieldName.SelectedItem.ToString(), cmbWindFanNumber.SelectedItem.ToString(), startTime, endTime);
            //获取风向最大值和最小值
            compareWindDirectionMaxAndMin = new double[2];
            compareWindDirectionMaxAndMin = FanPointDAL.GetMaxMinDataOfSinglePoint(FanPointDAL.Type.风向, windFieldOfCompareFan.BranchTableName, cmbWindFieldName.SelectedItem.ToString(), cmbWindFanNumber.SelectedItem.ToString(), startTime, endTime);

            //获取比较之后的风速最大值和最小值
            speedMax = GetMax(windSpeedMaxAndMin[0], compareWindSpeedMaxAndMin[0]);
            speedMin = GetMin(windSpeedMaxAndMin[1], compareWindSpeedMaxAndMin[1]);
            //获取比较之后的风向最大值和最小值
            directionMax = GetMax(windDirectionMaxAndMin[0], compareWindDirectionMaxAndMin[0]);
            directionMin = GetMin(windDirectionMaxAndMin[1], compareWindDirectionMaxAndMin[1]);

            //重新构建时间集合
            //将原始风机的时间加入新集合
            allDate = new List <DateTime?>();
            for (int i = 0; i < dateTimeCollection.Count; i++)
            {
                dateTimeCollection[i] = dateTimeCollection[i].Value.Date;
                allDate.Add(dateTimeCollection[i].Value.Date);
            }
            //将对比风机的时间加入新集合
            for (int i = 0; i < compareDateTimeCollection.Count; i++)
            {
                compareDateTimeCollection[i] = compareDateTimeCollection[i].Value.Date;
                if (allDate.Contains(compareDateTimeCollection[i].Value.Date) == false)
                {
                    allDate.Add(compareDateTimeCollection[i].Value.Date);
                }
            }
            allDate = allDate.OrderBy(d => d.Value.Date).ToList();//对日期排序

            //绘制风速图形
            Draw.DrawGrid(cvsWindSpeed, "#FF95310C");//此方法有清空canvas的操作
            Draw.DrawWord(cvsWindSpeed, this.CompanyName, this.WindFieldName, this.FanNumber, speedMax, speedMin, "#FF95310C", "(米/秒)", allDate, compareDateTimeCollection);
            Draw.DrawCompareCurve(cvsWindSpeed, windSpeedList, speedMax, speedMin, "#FF95310C", allDate, dateTimeCollection);
            Draw.DrawCompareCurve(cvsWindSpeed, compareWindSpeedList, speedMax, speedMin, "#FF104B00", allDate, compareDateTimeCollection);

            //绘制风向图形
            Draw.DrawGrid(cvsWindDirection, "#FF4D056E");//此方法有清空canvas的操作
            Draw.DrawWord(cvsWindDirection, this.CompanyName, this.WindFieldName, this.FanNumber, directionMax, directionMin, "#FF4D056E", "(度)", allDate, compareDateTimeCollection);
            Draw.DrawCompareCurve(cvsWindDirection, windDirectionList, directionMax, directionMin, "#FF4D056E", allDate, dateTimeCollection);
            Draw.DrawCompareCurve(cvsWindDirection, compareWindDirectionList, directionMax, directionMin, "#FF104B00", allDate, compareDateTimeCollection);
        }
Exemple #2
0
        private void DrawWave()
        {
            //标志已经关闭对比功能
            compareFlag = false;
            //获取起始时间
            startTime = dpStart.SelectedDate;
            //获取终止时间
            endTime = dpEnd.SelectedDate;
            if (startTime == null || endTime == null)
            {
                //重置日期标志为false
                selectDateFlag = false;
                MessageBox.Show("要查询的起止时间不能为空,请选择时间!");
                return;
            }
            if (startTime >= endTime)
            {
                //重置日期标志为false
                selectDateFlag = false;
                MessageBox.Show("您选择的时间不对,请重新输入");
                return;
            }


            //获取当前风机的时间集合
            dateTimeCollection = FanPointDAL.GetDateTimeCollectionOfSingleFan(windFieldOfFan.BranchTableName, this.WindFieldName, this.FanNumber, startTime, endTime);
            if (dateTimeCollection == null)
            {
                MessageBox.Show("没有检索到该风机的任何风速风向数据!", "啥也没找到", MessageBoxButton.OK, MessageBoxImage.Warning);
                Draw.DrawGrid(cvsWindSpeed, "#FF95310C");     //此方法有清空canvas的操作
                Draw.DrawGrid(cvsWindDirection, "#FF4D056E"); //此方法有清空canvas的操作
                //重置日期标志为false
                selectDateFlag = false;
                return;
            }

            //重置日期标志为true
            selectDateFlag = true;
            //使能对比按钮
            btnAddCompare.IsEnabled = true;

            //获取当前风机的风速集合
            windSpeedList = FanPointDAL.GetWindSpeedOrWindDirectionOfSinglePoint(FanPointDAL.Type.风速, windFieldOfFan.BranchTableName, this.WindFieldName, this.FanNumber, startTime, endTime);
            //获取当前风机的风向集合
            windDirectionList = FanPointDAL.GetWindSpeedOrWindDirectionOfSinglePoint(FanPointDAL.Type.风向, windFieldOfFan.BranchTableName, this.WindFieldName, this.FanNumber, startTime, endTime);
            //获取风速最大值和最小值
            windSpeedMaxAndMin = new double[2];
            windSpeedMaxAndMin = FanPointDAL.GetMaxMinDataOfSinglePoint(FanPointDAL.Type.风速, windFieldOfFan.BranchTableName, this.WindFieldName, this.FanNumber, startTime, endTime);
            //获取风向最大值和最小值
            windDirectionMaxAndMin = new double[2];
            windDirectionMaxAndMin = FanPointDAL.GetMaxMinDataOfSinglePoint(FanPointDAL.Type.风向, windFieldOfFan.BranchTableName, this.WindFieldName, this.FanNumber, startTime, endTime);



            //绘制风速数据
            Draw.DrawGrid(cvsWindSpeed, "#FF95310C");//此方法有清空canvas的操作
            Draw.DrawWord(cvsWindSpeed, this.CompanyName, this.WindFieldName, this.FanNumber, windSpeedMaxAndMin[0], windSpeedMaxAndMin[1], "#FF95310C", "(米/秒)", dateTimeCollection, null);
            Draw.DrawCurve(cvsWindSpeed, windSpeedList, windSpeedMaxAndMin[0], windSpeedMaxAndMin[1], "#FF95310C");

            //绘制风向数据
            Draw.DrawGrid(cvsWindDirection, "#FF4D056E");//此方法有清空canvas的操作
            Draw.DrawWord(cvsWindDirection, this.CompanyName, this.WindFieldName, this.FanNumber, windDirectionMaxAndMin[0], windDirectionMaxAndMin[1], "#FF4D056E", "(度)", dateTimeCollection, null);
            Draw.DrawCurve(cvsWindDirection, windDirectionList, windDirectionMaxAndMin[0], windDirectionMaxAndMin[1], "#FF4D056E");

            return;
        }