Ejemplo n.º 1
0
    public void Build(ShortcutSettings sSettings, GameObject parentObj)
    {
        _id = ShortcutUtil.ItemAutoId;

        switch (sSettings.Type)
        {
        case (ShortcutType.Arc):
            ArcItem _aItem = parentObj.AddComponent <ArcItem>();
            _item = _aItem;

            break;

        case (ShortcutType.Stick):
            StickItem _sItem = parentObj.AddComponent <StickItem>();
            _item = _sItem;

            break;

        default:
            break;
        }

        _item.transform.SetParent(parentObj.transform, false);

        SetItemDatas();

        _item.Build(sSettings, parentObj);
    }
Ejemplo n.º 2
0
        private void CreateGraph(ZedGraphControl zgc1, Array x_value1, Array y_value1, double x_min1, double x_max1)
        {
            zgc1.GraphPane.CurveList.Clear();
            zgc1.Refresh();
            GraphPane myPane = zgc1.GraphPane;

            // Set the titles and axis labels
            myPane.Title.Text       = "图像直方图";
            myPane.XAxis.Title.Text = "像元值";
            myPane.YAxis.Title.Text = "像元个数";

            PointPairList list = new PointPairList();

            for (int i = 0; i < y_value1.Length; i++)    //256改为y_value.Length,纠正错误:有些影像的像元数不到256个,会产生索引溢出,by-zhzhx,
            {
                string a = x_value1.GetValue(i).ToString();
                string b = y_value1.GetValue(i).ToString();
                double x = Convert.ToDouble(a);
                double y = Convert.ToDouble(b);
                list.Add(x, y);
            }

            StickItem myCurve = myPane.AddStick("", list, Color.Blue);

            myCurve.Line.Width = 2.0f;
            //myPane.XAxis.MajorGrid.IsVisible = true;
            myPane.XAxis.Scale.Max = x_max1;
            myPane.XAxis.Scale.Min = x_min1;
            //myPane.YAxis.Scale.MajorStep = 500;

            // Fill the axis background with a color gradient
            myPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45.0F);
            zgc1.AxisChange();
            zgc1.Refresh();
        }
Ejemplo n.º 3
0
        public StickItemDemo() : base("A demonstration of the 'StickItem', which is a single line for " +
                                      "each point running from the XAxis to the data value",
                                      "Stick Item Demo", DemoType.Bar)
        {
            GraphPane myPane = base.GraphPane;

            // Set the titles and axis labels
            myPane.Title.Text       = "StickItem Demo Chart";
            myPane.XAxis.Title.Text = "X Label";
            myPane.YAxis.Title.Text = "My Y Axis";

            PointPairList list = new PointPairList();

            for (int i = 0; i < 100; i++)
            {
                double x = (double)i;
                double y = Math.Sin(i / 8.0);
                double z = Math.Abs(Math.Cos(i / 8.0)) * y;
                list.Add(x, y, z);
            }

            StickItem myCurve = myPane.AddStick("Some Sticks", list, Color.Blue);

            myCurve.Line.Width = 2.0f;
            myPane.XAxis.MajorGrid.IsVisible = true;
            myPane.XAxis.Scale.Max           = 100;

            // Fill the axis background with a color gradient
            myPane.Chart.Fill = new Fill(Color.White,
                                         Color.LightGoldenrodYellow, 45.0F);

            base.ZedGraphControl.AxisChange();
        }
Ejemplo n.º 4
0
 public static void GetRangeY(StickItem curve, int fromId, int toId, ref ValueRange yRange)
 {
     for (int idx = fromId; idx <= toId; idx++)
     {
         PointPair item = (PointPair)curve.Points[idx];
         if (item.Y < yRange.Min)
         {
             yRange.Min = item.Y;
         }
         if (item.Y > yRange.Max)
         {
             yRange.Max = item.Y;
         }
     }
 }
Ejemplo n.º 5
0
        private void CreateGraph(ZedGraphControl zgc)
        {
            // get a reference to the GraphPane
            GraphPane myPane = zgc.GraphPane;

            myPane.Chart.Fill = new Fill(Color.White, Color.LightGray, 45.0f);
            // Set the Titles
            myPane.XAxis.MajorGrid.IsVisible = true;
            myPane.YAxis.MajorGrid.IsVisible = true;
            myPane.Title.Text        = Resources.GraphTitle;
            myPane.XAxis.Title.Text  = "Time, ms";
            myPane.YAxis.Title.Text  = "f0(t) [Hz]";
            myPane.Y2Axis.Title.Text = "Cmd";
            myPane.Y2Axis.IsVisible  = true;
            myPane.Y2Axis.Scale.Min  = 0;
            myPane.Y2Axis.Scale.Max  = 1.5;
            LineItem lineItem;

            lineItem                  = new LineItem("f0(t)");
            lineItem.Line.Width       = 2;
            lineItem.Color            = Color.DarkBlue;
            lineItem.Symbol.IsVisible = false;

            myPane.CurveList.Add(lineItem);

            lineItem                  = new LineItem("P. component (t)");
            lineItem.Line.Width       = 2;
            lineItem.Color            = Color.DarkCyan;
            lineItem.Symbol.IsVisible = false;
            myPane.CurveList.Add(lineItem);

            lineItem                  = new LineItem("A. cmd");
            lineItem.Color            = Color.Chocolate;
            lineItem.Symbol.IsVisible = false;
            lineItem.IsY2Axis         = true;
            lineItem.Line.StepType    = StepType.ForwardSegment;
            myPane.CurveList.Add(lineItem);

            StickItem stickItem = new StickItem("P. cmd");

            stickItem.Line.Width       = 1.5f;
            stickItem.Color            = Color.Chartreuse;
            stickItem.Symbol.Type      = SymbolType.Diamond;
            stickItem.Symbol.IsVisible = true;
            stickItem.IsY2Axis         = true;
            myPane.CurveList.Add(stickItem);
        }
Ejemplo n.º 6
0
 public static void GetRangeY(StickItem curve, int fromId, int toId, ref ValueRange yRange)
 {
     fromId = Math.Max(fromId, 0);
     toId   = Math.Min(toId, curve.Points.Count - 1);
     for (int idx = fromId; idx <= toId; idx++)
     {
         if (idx < 0 || idx >= curve.Points.Count)
         {
             continue;
         }
         PointPair item = (PointPair)curve.Points[idx];
         if (item.Y < yRange.Min)
         {
             yRange.Min = item.Y;
         }
         if (item.Y > yRange.Max)
         {
             yRange.Max = item.Y;
         }
     }
 }
Ejemplo n.º 7
0
        public StickItem AddCurveStick(string name, double[] seriesY, Color color)
        {
            StickItem myCurve = myGraphPane.AddStick(name, this.mySeriesX, seriesY, color);

            return(myCurve);
        }