Example #1
0
    // Use this for initialization
    void Start()
    {
        global_animator = GameObject.Find("DisplayArea").GetComponent <Animator>();
        returnButton.onClick.AddListener(() => { global_animator.SetTrigger("ExitDetailView"); });
        plantButton.onClick.AddListener(() => { global_animator.SetTrigger("Detail2Plant"); });

        buttons[0] = transform.Find("Content/Buttons/Upper/Row1/Button1").GetComponent <FlatButton>();
        buttons[1] = transform.Find("Content/Buttons/Upper/Row1/Button2").GetComponent <FlatButton>();
        buttons[2] = transform.Find("Content/Buttons/Upper/Row2/Button3").GetComponent <FlatButton>();
        buttons[3] = transform.Find("Content/Buttons/Upper/Row2/Button4").GetComponent <FlatButton>();
        bars[0]    = transform.Find("Content/Graphics/Upper/Bars/ValueBar1").GetComponent <ValueBar>();
        bars[1]    = transform.Find("Content/Graphics/Upper/Bars/ValueBar2").GetComponent <ValueBar>();
        slider     = transform.Find("Content/Buttons/Lower/SettingSlider").GetComponent <SettingSlider>();
        power      = transform.Find("Content/Buttons/Lower/PowerSlider").GetComponent <PowerSlider>();
        header     = transform.Find("Content/Graphics/Upper/Model/Info").GetComponent <ModelHeader>();
        plotter    = transform.Find("Content/Graphics/Lower/Graph").GetComponent <PlotGraph>();
        stage      = transform.Find("Content/Graphics/Upper/Model/Model/Stage").GetComponent <Camera>();

        server = GameObject.Find("DisplayArea/Database/Server").GetComponent <Server>();

        currentComponentName = "";

        components.Add("T001", server.Tank1);
        components.Add("T002", server.Tank2);
        components.Add("V001", server.Ventile1);
        components.Add("V002", server.Ventile2);
        components.Add("M001", server.Mischer1);
        components.Add("P001", server.Pumpe1);
    }
Example #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: int plotArgs(int plotmode, Stack st)throws ParseException, JasymcaException
    internal override int plotArgs(int plotmode, Stack st)
    {
        if (LambdaPLOT.pg == null)
        {
            pg = new PlotGraph(plotmode);
        }
        else
        {
            pg.setmode(plotmode);
        }
        int narg = getNarg(st);

        object[] pargs = new object[narg];
        for (int i = 0; i < narg; i++)
        {
            object x = st.Pop();
            if (x is Vektor)
            {
                x        = (new ExpandConstants()).f_exakt((Vektor)x);
                pargs[i] = ((Vektor)x).Double;
            }
            else
            {
                pargs[i] = x;
            }
        }
        pg.addLineErrorbars(pargs);
        pg.show();
        return(0);
    }
        public void addMeasure(int index)
        {
            binner.addMeasure(index);

            //Create graphical object associated with measure
            PlotGraph measureGraph = new PlotGraph();

            plotsGraphics.Add(measureGraph);

            //Create polygon associated with graphical object
            Polygon plotPoly = new Polygon();

            plotPoly.Stroke          = new SolidColorBrush(Colors.Black);
            plotPoly.Fill            = new SolidColorBrush(Colors.LightBlue);
            plotPoly.StrokeThickness = 2;
            measureGraph.plotPoly    = plotPoly;
            mainCanvas.Children.Add(plotPoly);

            if (binner.GetSplitMode())
            {
                //Create self plotgraph
                PlotGraph selfMeasureGraph = new PlotGraph();
                selfPlotsGraphics.Add(selfMeasureGraph);

                //Create poly
                plotPoly                  = new Polygon();
                plotPoly.Stroke           = new SolidColorBrush(Colors.Black);
                plotPoly.Fill             = new SolidColorBrush(Colors.LightCoral);
                plotPoly.StrokeThickness  = 2;
                selfMeasureGraph.plotPoly = plotPoly;
                mainCanvas.Children.Add(plotPoly);
            }

            binner.UpdateData();
        }
Example #4
0
        private void Action_Click(object sender, EventArgs e)
        {
            string name;
            string teacher;
            string group;
            string X;
            string Y;
            int    n;
            double alpha;

            try
            {
                name    = input_name.Text.Trim();
                teacher = input_teacher.Text.Trim();
                group   = input_group.Text.Trim();
                n       = int.Parse(input_n.Text.Trim());
                alpha   = double.Parse(input_alpha.Text.Trim());
                X       = input_X.Text.Trim();
                Y       = input_Y.Text.Trim();
                var xArray = X.Split(' ');
                var yArray = Y.Split(' ');
                if (xArray.Length != yArray.Length)
                {
                    throw new ArgumentException("Количество элементов в двух выборках не совпадает или поставлен лишний пробел");
                }

                this.X = new double[xArray.Length];
                this.Y = new double[yArray.Length];

                for (int i = 0; i < xArray.Length; i++)
                {
                    double.TryParse(xArray[i], out this.X[i]);
                    double.TryParse(yArray[i], out this.Y[i]);
                }
                string year = DateTime.Now.Year.ToString();

                var calc      = new Calculation(this.X, this.Y, alpha);
                var plotGraph = new PlotGraph(this.X, this.Y, calc.Koefficients[0], calc.Koefficients[1]);
                var text      = new Text(group, name, teacher, year, n, alpha, this.X, this.Y);
                MessageBox.Show("Уважаемый, " + name + ", Ваша курсовая готова!");
            }
            catch (Exception ex)
            {
                throw new ArgumentException(ex.Message);
            }
        }
        public GpxAnalyzerVM(IIODialog openFile, IIODialog saveFile)
        {
            _openFileIO   = openFile;
            _saveFileIO   = saveFile;
            Graph         = null;
            CurrentTracks = new List <GpsTrack>();

            m_ElevLegend   = String.Empty;
            m_ElevInterval = 100;
            m_DistInterval = 10d;
            m_ElevMin      = 0;
            m_ElevMax      = 0;
            m_DistMax      = 0d;

            m_Points = new ObservableCollection <DataPoint>();
            m_Tracks = new ObservableCollection <TrackNameVM>();

            m_Tracks.CollectionChanged += M_Tracks_CollectionChanged;

            OpenFileCmd  = new RelayCommand(OpenFile);
            SaveImageCmd = new RelayCommand <IImageHolder>(SaveImage);
        }
        public void RefreshGraph()
        {
            if (CurrentTracks.Count > 0)
            {
                var analyzer = new GpxAnalysis.GpxAnalyzer();

                var useTrack = analyzer.MergeTrackPoints(from track in CurrentTracks
                                                         join trackname in Tracks on track.Name equals trackname.Title
                                                         where trackname.IsSelected
                                                         select track);

                Graph = analyzer.GetGraphFromTrack(new GpsTrack()
                {
                    Name = "all", Points = useTrack.ToList()
                }, true);

                Points = new ObservableCollection <DataPoint>(Graph.Points.Select(pp => new DataPoint()
                {
                    X = pp.Distance, Y = pp.Elevation
                }));

                ElevLegend = String.Format(
                    @"Distance: {0:0.00}mi
.  
Min Elevation: {4:0.00}ft
Max Elevation: {5:0.00}ft
.  
Elevation Gain: {1:0.00}ft
Elevation Loss: {2:0.00}ft
Cumulative Change: {3:0.00}ft",
                    Graph.TotalDistance, Graph.TotalElevationGain, Graph.TotalElevationLoss,
                    (Graph.TotalElevationGain + Graph.TotalElevationLoss),
                    Graph.MinElevation, Graph.MaxElevation);

                SetMinMax();
            }
        }
Example #7
0
 public PlotLine(PlotGraph outerInstance)
 {
     this.outerInstance = outerInstance;
 }
        private void UpdateGraphics()
        {
            double canvasHeight = mainCanvas.ActualHeight;
            double canvasWidth  = mainCanvas.ActualWidth;
            Point  bottomLeft   = new Point(0, mainCanvas.ActualHeight);

            double leftColumnWidth = Math.Min(200, canvasWidth / 4);
            double PlotAxisMargin  = 10;

            AbovePlotArea = new GraphicArea(leftColumnWidth, 0, canvasWidth - leftColumnWidth, 26);
            AxisArea      = new GraphicArea(0, AbovePlotArea.Bottom, leftColumnWidth, 7 * canvasHeight / 12);
            PlotArea      = new GraphicArea(AxisArea.Right + PlotAxisMargin, AbovePlotArea.Bottom, canvasWidth - AxisArea.width, AxisArea.height);
            XLabelArea    = new GraphicArea(PlotArea.Left, PlotArea.Bottom, canvasWidth - AxisArea.width, 50);
            TimeModeArea  = new GraphicArea(0, AxisArea.Bottom, AxisArea.width, XLabelArea.height);
            //Bot left area
            WordSoupArea = new GraphicArea(XLabelArea.Left, XLabelArea.Bottom, XLabelArea.width, canvasHeight - XLabelArea.Bottom);

            Canvas.SetLeft(PlotAreaRect, PlotArea.Left);
            Canvas.SetTop(PlotAreaRect, PlotArea.Top);
            PlotAreaRect.Width  = PlotArea.width;
            PlotAreaRect.Height = PlotArea.height;

            //Show draw zones only
            if (false)
            {
                mainCanvas.Children.Clear();
                Rectangle a1 = new Rectangle();
                a1.Fill   = new SolidColorBrush(Colors.Blue);
                a1.Width  = AxisArea.width;
                a1.Height = AxisArea.height;
                mainCanvas.Children.Add(a1);
                Canvas.SetTop(a1, AxisArea.Top);
                Canvas.SetLeft(a1, AxisArea.Left);

                a1        = new Rectangle();
                a1.Fill   = new SolidColorBrush(Colors.Red);
                a1.Width  = PlotArea.width;
                a1.Height = PlotArea.height;
                //mainCanvas.Children.Add(a1);
                Canvas.SetTop(a1, PlotArea.Top);
                Canvas.SetLeft(a1, PlotArea.Left);

                a1        = new Rectangle();
                a1.Fill   = new SolidColorBrush(Colors.Orange);
                a1.Width  = XLabelArea.width;
                a1.Height = XLabelArea.height;
                mainCanvas.Children.Add(a1);
                Canvas.SetTop(a1, XLabelArea.Top);
                Canvas.SetLeft(a1, XLabelArea.Left);

                a1        = new Rectangle();
                a1.Fill   = new SolidColorBrush(Colors.Purple);
                a1.Width  = WordSoupArea.width;
                a1.Height = WordSoupArea.height;
                mainCanvas.Children.Add(a1);
                Canvas.SetTop(a1, WordSoupArea.Top);
                Canvas.SetLeft(a1, WordSoupArea.Left);

                a1        = new Rectangle();
                a1.Fill   = new SolidColorBrush(Colors.Pink);
                a1.Width  = TimeModeArea.width;
                a1.Height = TimeModeArea.height;
                mainCanvas.Children.Add(a1);
                Canvas.SetTop(a1, TimeModeArea.Top);
                Canvas.SetLeft(a1, TimeModeArea.Left);

                //return;
            }

            //Plot Measure Plots
            //Detect graphical elements size descrepancies
            if (plotsGraphics.Count != binner.measures.Count)
            {
                int diff = binner.measures.Count - plotsGraphics.Count;

                if (diff > 0)
                {
                    while (binner.measures.Count != plotsGraphics.Count)
                    {
                        //Create graphical object associated with measure
                        PlotGraph measureGraph = new PlotGraph();
                        plotsGraphics.Add(measureGraph);

                        //Create polygon associated with graphical object
                        Polygon plotPoly = new Polygon();
                        plotPoly.Stroke          = new SolidColorBrush(Colors.Black);
                        plotPoly.Fill            = new SolidColorBrush(Colors.LightBlue);
                        plotPoly.StrokeThickness = 2;
                        measureGraph.plotPoly    = plotPoly;
                        mainCanvas.Children.Add(plotPoly);
                    }
                }
                else
                {
                    while (binner.measures.Count != plotsGraphics.Count)
                    {
                        //Remove Polygons
                        mainCanvas.Children.Remove(plotsGraphics[0].plotPoly);

                        //Remove graphics
                        plotsGraphics.RemoveAt(0);
                    }
                }
            }
            //Detect self graphical elements size descrepancies
            if (binner.GetSplitMode())
            {
                if (selfPlotsGraphics.Count != binner.measures.Count)
                {
                    int diff = binner.measures.Count - selfPlotsGraphics.Count;

                    if (diff > 0)
                    {
                        while (binner.measures.Count != selfPlotsGraphics.Count)
                        {
                            //Create graphical object associated with measure
                            PlotGraph measureGraph = new PlotGraph();
                            selfPlotsGraphics.Add(measureGraph);

                            //Create polygon associated with graphical object
                            Polygon plotPoly = new Polygon();
                            plotPoly.Stroke          = new SolidColorBrush(Colors.Black);
                            plotPoly.Fill            = new SolidColorBrush(Colors.Green);
                            plotPoly.StrokeThickness = 2;
                            measureGraph.plotPoly    = plotPoly;
                            mainCanvas.Children.Add(plotPoly);
                        }
                    }
                    else
                    {
                        while (binner.measures.Count != selfPlotsGraphics.Count)
                        {
                            //Remove Polygons
                            mainCanvas.Children.Remove(selfPlotsGraphics[0].plotPoly);

                            //Remove graphics
                            selfPlotsGraphics.RemoveAt(0);
                        }
                    }
                }
            }

            //Update plot graphics
            double pace = PlotArea.width / (binner.binCount);
            double multiplier;

            TimelineDataController.PlotData data, selfData;
            PlotGraph       graph, selfGraph;
            double          axisHeight;
            PointCollection points;

            for (int m = 0; m < binner.measures.Count; m++)
            {
                data     = binner.plotsData[m];
                selfData = null;
                graph    = plotsGraphics[m];

                if (!binner.GetSplitMode())
                {
                    axisHeight = 0;
                    multiplier = PlotArea.height / data.max;
                }
                else
                {
                    selfData = binner.selfPlotsData[m];

                    axisHeight = PlotArea.height * selfData.max / (data.max + selfData.max);
                    multiplier = PlotArea.height / (data.max + selfData.max);
                }

                points = new PointCollection();
                points.Add(new Point(PlotArea.Right, PlotArea.Bottom - axisHeight));
                points.Add(new Point(PlotArea.Left, PlotArea.Bottom - axisHeight));

                for (int b = 0; b < binner.binCount; b++)
                {
                    //Bin
                    points.Add(new Point(binner.binDefinitions[b].axisStart * PlotArea.width + PlotArea.Left, -(data.binValues[b] * multiplier) + PlotArea.Bottom - axisHeight));
                    points.Add(new Point(binner.binDefinitions[b].axisEnd * PlotArea.width + PlotArea.Left, -(data.binValues[b] * multiplier) + PlotArea.Bottom - axisHeight));

                    //Linear
                    //points.Add(new Point(binner.binDefinitions[b].axisStart * PlotArea.width + pace/2 + PlotArea.Left, -(data.binValues[b] * multiplier) + PlotArea.Bottom));
                }
                graph.plotPoly.Points = points;

                if (binner.GetSplitMode())
                {
                    selfGraph = selfPlotsGraphics[m];

                    points = new PointCollection();
                    points.Add(new Point(PlotArea.Right, PlotArea.Bottom - axisHeight));
                    points.Add(new Point(PlotArea.Left, PlotArea.Bottom - axisHeight));

                    for (int b = 0; b < binner.binCount; b++)
                    {
                        //Bin
                        points.Add(new Point(binner.binDefinitions[b].axisStart * PlotArea.width + PlotArea.Left, (selfData.binValues[b] * multiplier) + PlotArea.Bottom - axisHeight));
                        points.Add(new Point(binner.binDefinitions[b].axisEnd * PlotArea.width + PlotArea.Left, (selfData.binValues[b] * multiplier) + PlotArea.Bottom - axisHeight));

                        //Linear
                        //points.Add(new Point(binner.binDefinitions[b].axisStart * PlotArea.width + pace/2 + PlotArea.Left, -(data.binValues[b] * multiplier) + PlotArea.Bottom));
                    }
                    selfGraph.plotPoly.Points = points;
                }
            }

            //Update Top Controls
            //Split
            Canvas.SetLeft(splitBut, 0);
            Canvas.SetTop(splitBut, 0);
            splitBut.Content = binner.GetSplitMode() ? "All" : "Split";
            splitBut.Width   = AbovePlotArea.Left;
            splitBut.Height  = AxisArea.Top;

            //TimeOverviewer
            Canvas.SetLeft(timeOverviewLabel, AbovePlotArea.Left);
            Canvas.SetTop(timeOverviewLabel, AbovePlotArea.Top);
            timeOverviewLabel.Content = binner.timeOverview;

            //Text Finder
            Canvas.SetLeft(textFinderBox, AbovePlotArea.Right - 100);
            Canvas.SetTop(textFinderBox, AbovePlotArea.Top);
            Canvas.SetLeft(textFinderLabel, AbovePlotArea.Right - 100 - 40);
            Canvas.SetTop(textFinderLabel, AbovePlotArea.Top);

            //Update TimeMode Buttons Position
            double buttonSize = TimeModeArea.width / 4;

            Canvas.SetLeft(linearTimeBut, TimeModeArea.Left);
            Canvas.SetTop(linearTimeBut, TimeModeArea.Top);
            linearTimeBut.Width = buttonSize;
            Canvas.SetLeft(yearTimeBut, TimeModeArea.Left + buttonSize * 1);
            Canvas.SetTop(yearTimeBut, TimeModeArea.Top);
            yearTimeBut.Width = buttonSize;
            Canvas.SetLeft(weekTimeBut, TimeModeArea.Left + buttonSize * 2);
            Canvas.SetTop(weekTimeBut, TimeModeArea.Top);
            weekTimeBut.Width = buttonSize;
            Canvas.SetLeft(hourTimeBut, TimeModeArea.Left + buttonSize * 3);
            Canvas.SetTop(hourTimeBut, TimeModeArea.Top);
            hourTimeBut.Width = buttonSize;

            //Spread some labels around
            //Clear labels
            for (int i = 0; i < labels.Count; i++)
            {
                mainCanvas.Children.Remove(labels[i]);
            }
            labels.Clear();

            for (int i = 0; i < axisMarkers.Count; i++)
            {
                mainCanvas.Children.Remove(axisMarkers[i]);
            }
            axisMarkers.Clear();

            //Axis labels
            List <TimelineDataController.LabelDefinition> axisLabels = binner.getTimeAxisLabels();

            for (int i = 0; i < axisLabels.Count; i++)
            {
                TimelineDataController.LabelDefinition labelData = axisLabels[i];

                if (labelData.axisFactor >= 0 && labelData.axisFactor <= 1)
                {
                    double xx       = PlotArea.Left + PlotArea.width * labelData.axisFactor;
                    Label  newLabel = new Label();
                    newLabel.Width   = 100;
                    newLabel.Content = labelData.mainText;
                    newLabel.HorizontalContentAlignment = HorizontalAlignment.Center;
                    Canvas.SetTop(newLabel, PlotArea.Bottom);
                    Canvas.SetLeft(newLabel, xx - 50);
                    mainCanvas.Children.Add(newLabel);
                    labels.Add(newLabel);

                    if (labelData.subText != "")
                    {
                        newLabel         = new Label();
                        newLabel.Width   = 100;
                        newLabel.Content = labelData.subText;
                        newLabel.HorizontalContentAlignment = HorizontalAlignment.Center;
                        Canvas.SetTop(newLabel, PlotArea.Bottom + XLabelArea.height / 4);
                        Canvas.SetLeft(newLabel, xx - 50);
                        mainCanvas.Children.Add(newLabel);
                        labels.Add(newLabel);
                    }

                    Line newMarker = new Line();
                    newMarker.Stroke          = new SolidColorBrush(Colors.Black);
                    newMarker.StrokeThickness = 2;
                    newMarker.X1 = xx;
                    newMarker.Y1 = PlotArea.Bottom - 6;
                    newMarker.X2 = xx;
                    newMarker.Y2 = PlotArea.Bottom + 6;
                    mainCanvas.Children.Add(newMarker);
                    axisMarkers.Add(newMarker);
                }
            }


            //WordSoup
            for (int i = 0; i < wordSoupLabels.Count; i++)
            {
                mainCanvas.Children.Remove(wordSoupLabels[i]);
            }
            wordSoupLabels.Clear();

            List <WordSoupMeta> wordMeta = new List <WordSoupMeta>();
            int    wordSoupCount         = 5;
            double accumulated           = 0;

            for (int i = 0; i < wordSoupCount && i < binner.lexicAnomalies.Count; i++)
            {
                TimelineDataController.LexicPresence presence = binner.lexicAnomalies[i];
                WordSoupMeta meta = new WordSoupMeta(presence.word, presence.weight, presence.placement);

                wordMeta.Add(meta);
                accumulated += meta.weight;
            }

            double orderAcum = 0;

            for (int i = 0; i < wordMeta.Count; i++)
            {
                WordSoupMeta wmeta = wordMeta[i];
                Label        lbl   = new Label();
                lbl.Content = wmeta.word;
                lbl.HorizontalContentAlignment = HorizontalAlignment.Center;
                lbl.VerticalContentAlignment   = VerticalAlignment.Center;
                double cS = (wmeta.weight / accumulated);
                lbl.Background  = new SolidColorBrush(Colors.CornflowerBlue);
                lbl.BorderBrush = new SolidColorBrush(Colors.Blue);
                double hh = cS * WordSoupArea.height;
                lbl.Height = hh;
                double ww = cS * WordSoupArea.width;
                lbl.Width = ww;

                Canvas.SetTop(lbl, WordSoupArea.Top + orderAcum * WordSoupArea.height);
                Canvas.SetLeft(lbl, WordSoupArea.Left + wmeta.axis * WordSoupArea.width - ww / 2);

                orderAcum += cS;

                wordSoupLabels.Add(lbl);
                mainCanvas.Children.Add(lbl);
            }
        }