/// <summary>���p�`��`�悷��</summary> /// <param name="image">�`��Ώۂ̃C���[�W</param> /// <param name="plotInfo">�v���b�g���</param> public static void DrawLine(Image image, PlotsInformation plotInfo) { //�������x����ѐ�Ύ��x�z��̒������قȂ�ꍇ�͗�O if (plotInfo.DrybulbTemperatures.Length != plotInfo.AbsoluteHumidities.Length) throw new Exception("�v���b�g���s����"); //�c������擾 int width = canvasSize.Width - R_MARGIN - L_MARGIN; int height = canvasSize.Height - T_MARGIN - B_MARGIN; //�`��Ώۂ�����������ꍇ�͏I�� if (width <= 0 || height <= 0) return; //Bitmap����Graphic�I�u�W�F�N�g��쐬 Graphics gr = Graphics.FromImage(image); //���^�t�@�C���łȂ���A���`�G�C���A�X�ݒ� if (!(image is System.Drawing.Imaging.Metafile)) gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; //�`���_������ֈړ� gr.TranslateTransform(L_MARGIN, height + T_MARGIN); //�`��̂��߂̕ϊ����[�g double minDB = lineProperties[Lines.DryBulbTemperatureLine].MinimumValue; double minAH = lineProperties[Lines.AbsoluteHumidityLine].MinimumValue; double maxDB = lineProperties[Lines.DryBulbTemperatureLine].MaximumValue; double maxAH = lineProperties[Lines.AbsoluteHumidityLine].MaximumValue; double yRate = height / (maxAH - minAH); double xRate = width / (maxDB - minDB); //�|�C���g���X�g��쐬 PointF[] ptf = new PointF[plotInfo.DrybulbTemperatures.Length]; for (int i = 0; i < ptf.Length; i++) { ptf[i] = getPointFromDBandAH(plotInfo.DrybulbTemperatures[i], plotInfo.AbsoluteHumidities[i], xRate, yRate); } Pen pen = new Pen(plotInfo.LineColor); pen.Width = plotInfo.Diameter; if (2 <= ptf.Length) gr.DrawPolygon(pen, ptf); //Graphics�I�u�W�F�N�g����� gr.Dispose(); }
/// <summary>�v���b�g��`�悷��</summary> /// <param name="image">�`��Ώۂ̃C���[�W</param> /// <param name="plotInfo">�v���b�g���</param> public static void DrawPlots(Image image, PlotsInformation plotInfo) { DrawPlots(image, plotInfo.FillColor, plotInfo.LineColor, plotInfo.Diameter, plotInfo.DrybulbTemperatures, plotInfo.AbsoluteHumidities); }
/// <summary>Image�ɋ�C���}����я�ԓ_��`�悷��</summary> /// <param name="image">�`��Ώۂ̃C���[�W</param> /// <param name="plotInfos">��C��ԓ_</param> public static void DrawChart(Image image, PlotsInformation[] plotInfos) { //�c������擾 int width = canvasSize.Width - R_MARGIN - L_MARGIN; int height = canvasSize.Height - T_MARGIN - B_MARGIN; //�`��Ώۂ�����������ꍇ�͏I�� if (width <= 0 || height <= 0) return; //Bitmap����Graphic�I�u�W�F�N�g��쐬 Graphics gr = Graphics.FromImage(image); //���^�t�@�C���łȂ���A���`�G�C���A�X�ݒ� if (!(image is System.Drawing.Imaging.Metafile)) gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; //�`��̈�g��`�� gr.DrawRectangle(BPEN, 0, 0, canvasSize.Width, canvasSize.Height); gr.DrawLine(BPEN, L_MARGIN, T_MARGIN, width + L_MARGIN, T_MARGIN); gr.DrawLine(BPEN, L_MARGIN, T_MARGIN + height, width + L_MARGIN, T_MARGIN + height); gr.DrawLine(BPEN, L_MARGIN, T_MARGIN, L_MARGIN, T_MARGIN + height); //gr.DrawRectangle(BPEN, L_MARGIN, T_MARGIN, width, height); //�`���_������ֈړ� gr.TranslateTransform(L_MARGIN, height + T_MARGIN); //�`��̂��߂̕ϊ����[�g��v�Z double minDB = lineProperties[Lines.DryBulbTemperatureLine].MinimumValue; double minAH = lineProperties[Lines.AbsoluteHumidityLine].MinimumValue; double maxDB = lineProperties[Lines.DryBulbTemperatureLine].MaximumValue; double maxAH = lineProperties[Lines.AbsoluteHumidityLine].MaximumValue; double yRate = height / (maxAH - minAH); double xRate = width / (maxDB - minDB); //�O�a���`�揈�� if (lineProperties[Lines.SaturatedLine].DrawLine) drawSaturatedLine(gr, xRate, yRate); //���������x���`�揈�� if (lineProperties[Lines.DryBulbTemperatureLine].DrawLine) drawDryBulbTemperatureLine(gr, xRate, yRate); //����Ύ��x���`�揈�� if (lineProperties[Lines.AbsoluteHumidityLine].DrawLine) drawAbsoluteHumidityLine(gr, xRate, yRate); //���G���^���s�[���`�揈�� if (lineProperties[Lines.EnthalpyLine].DrawLine) drawEnthalpyLine(gr, xRate, yRate); //���������x���`�揈�� if (lineProperties[Lines.WetBulbTemperatureLine].DrawLine) drawWetBulbTemperatureLine(gr, xRate, yRate); //����e�ϐ��`�揈�� if (lineProperties[Lines.SpecificVoluemLine].DrawLine) drawSpecificVolumeLine(gr, xRate, yRate); //�����Ύ��x���`�揈�� if (lineProperties[Lines.RelativeHumidityLine].DrawLine) drawRelativeHumidityLine(gr, xRate, yRate); //���E�ڐ��肨��ѐ��l�`�揈�� drawAxis(gr, xRate, yRate); //**���������ԓ_�`�揈�� foreach (PlotsInformation pi in plotInfos) { Brush brsh = new SolidBrush(pi.FillColor); Pen pen = new Pen(pi.LineColor); float plotHalfSize = pi.Diameter / 2f; for (int i = 0; i < pi.DrybulbTemperatures.Length; i++) { PointF ptf = getPointFromDBandAH(pi.DrybulbTemperatures[i], pi.AbsoluteHumidities[i], xRate, yRate); gr.FillEllipse(brsh, ptf.X - plotHalfSize, ptf.Y - plotHalfSize, pi.Diameter, pi.Diameter); gr.DrawEllipse(pen, ptf.X - plotHalfSize, ptf.Y - plotHalfSize, pi.Diameter, pi.Diameter); } } //Graphics�I�u�W�F�N�g����� gr.Dispose(); }