示例#1
0
        public override void Render(OxyPlot.IRenderContext rc, PlotModel model1, AxisLayer axisLayer, int pass)
        {
#if DEBUG_MAP
            Console.WriteLine("render clound axis " + this.Name);
#endif
            Render(rc, model1);
        }
示例#2
0
        public override void Render(OxyPlot.IRenderContext rc, OxyPlot.PlotModel model, AxisLayer axisLayer, int pass)
        {
            base.Render(rc, model, axisLayer, pass);
            if (model.Series.Count == 0)
            {
                return;
            }

            var      field = rc.GetType().GetField("g", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
            object   o     = field.GetValue(rc);
            Graphics g     = (Graphics)o;



            LineSeries series = model.Series.First(s => { if (s is LineSeries)
                                                          {
                                                              return(true);
                                                          }
                                                          else
                                                          {
                                                              return(false);
                                                          } }) as LineSeries;

            for (int i = 0; i < series.Points.Count; i++)
            {
                ScreenPoint sp  = series.Transform(series.Points[i]);
                int         key = (int)series.Points[i].X;
                if (IsCloudVisble && Cloud.Count > 0 && (Cloud[key]) != "9999")
                {
                    if (Cloud[key] != null)
                    {
                        using (Font f = new System.Drawing.Font(_PrivateFontCollection.Families[1], 12F))
                        {
                            float x = (float)sp.X;
                            float y = (float)model.Height - 50;
                            DrawText(g, new ScreenPoint(x, y), Cloud[key],
                                     OxyColor.FromRgb(CloudColor.R, CloudColor.G, CloudColor.B), f, 0F,
                                     HorizontalAlignment.Center, VerticalAlignment.Middle);
                        }
                    }
                }

                if (IsWindVisible && WindSpeeds.Count > 0 && (WindSpeeds[key]) != "9999" /* && (WindSpeeds[key]) != "0"*/)
                {
                    if (WindDirs[key] != null)
                    {
                        using (Font f = new System.Drawing.Font(_PrivateFontCollection.Families[0], 30F))
                        {
                            float x = (float)sp.X;
                            float y = (float)model.Height - 50;
                            DrawText(g, new ScreenPoint(x, y), WindSpeeds[key],
                                     OxyColor.FromRgb(WindColor.R, WindColor.G, WindColor.B), f, float.Parse(WindDirs[key]),
                                     HorizontalAlignment.Left, VerticalAlignment.Bottom, -15, 15);
                        }
                    }
                }
            }
        }
示例#3
0
        public override void Render(OxyPlot.IRenderContext rc, PlotModel model1, AxisLayer axisLayer, int pass)
        {
            PlotModel model = this.PlotModel;

            if (Theme != null)
            {
                OxyColor color = Convertor.ConvertColorToOxyColor(Theme.GetThemeColor());
                TicklineColor = color;
                TextColor     = color;
                TitleColor    = color;
            }
            //base.Render(rc, model, axisLayer, pass);
            IList <IList <ScreenPoint> > points      = new List <IList <ScreenPoint> >();
            FeatureTextIntersector       intersector = new FeatureTextIntersector(FeatureTextIntersector.SortStyle.Horizontal, 3);

            for (int i = 0; i < this.Labels.Count; i++)
            {
                string  label     = this.Labels[i];
                OxySize text_size = rc.MeasureText(label, this.ActualFont, this.ActualFontSize, this.ActualFontWeight);

                double x = Transform(i);
                if (x < model.PlotArea.Left || x > model.PlotArea.Right)
                {
                    continue;
                }

                double y  = model.PlotArea.Bottom;
                double y2 = y + 5;

                IList <ScreenPoint> sps = new List <ScreenPoint>();
                sps.Add(new ScreenPoint(x, y));
                sps.Add(new ScreenPoint(x, model.PlotArea.Top));

                points.Add(sps);
                intersector.Add(new FeatureText(label, new ScreenPoint(x, y2), text_size));

                // rc.DrawText(new ScreenPoint(x, y + 7), label, TextColor, this.ActualFont, this.ActualFontSize, this.ActualFontWeight, this.Angle, HorizontalAlignment.Left, VerticalAlignment.Middle);
            }

            List <FeatureText> fearures = intersector.DiscaredIntersection();

            if (fearures != null)
            {
                foreach (FeatureText ft in fearures)
                {
                    rc.DrawText(ft.Position, ft.Text, this.TextColor, this.ActualFont, this.ActualFontSize, this.ActualFontWeight, this.Angle, HorizontalAlignment.Center);
                }
            }

            foreach (IList <ScreenPoint> line in points)
            {
                rc.DrawLine(line, this.ExtraGridlineColor, 1, LineStyle.Dash.GetDashArray());
            }
        }
示例#4
0
        public override void Render(OxyPlot.IRenderContext rc, PlotModel model1, AxisLayer axisLayer, int pass)
        {
            PlotModel model = this.PlotModel;

            if (Theme != null)
            {
                OxyColor color = Convertor.ConvertColorToOxyColor(Theme.GetThemeColor());
                TicklineColor = color;
                TextColor     = color;
                TitleColor    = color;
            }
            base.Render(rc, model1, axisLayer, pass);
        }