Exemplo n.º 1
0
        public void DrawGraphsXY(double[] x, double[] y)
        {
            CurveGraph.Series.Clear();
            ScatterSeries serie = new ScatterSeries();

            for (int i = 0; i < x.Length; ++i)
            {
                serie.Points.Add(new ScatterPoint(x[i], y[i]));
            }
            CurveGraph.Series.Add(serie);
            CurveGraph.InvalidatePlot(true);
        }
Exemplo n.º 2
0
        public void RefreshGraph()
        {
            CurveGraph.Series.Clear();
            FunctionSeries serie = new FunctionSeries();
            int            x     = 0;

            foreach (double value in Points)
            {
                serie.Points.Add(new DataPoint(x, value));
                x += 10;
            }
            CurveGraph.Series.Add(serie);
            CurveGraph.Title = "Новый график";
            CurveGraph.InvalidatePlot(true);
        }
Exemplo n.º 3
0
        public void DrawGraphs(params double[][] curves)
        {
            CurveGraph.Series.Clear();
            FunctionSeries[] serie = new FunctionSeries[curves.Length];
            int x = 0, i = 0;

            foreach (double[] curve in curves)
            {
                x        = 0;
                serie[i] = new FunctionSeries();
                foreach (double value in curve)
                {
                    serie[i].Points.Add(new DataPoint(x, value));
                    x += 10;
                }
                CurveGraph.Series.Add(serie[i++]);
            }
            CurveGraph.InvalidatePlot(true);
        }
Exemplo n.º 4
0
        private void FindShape()
        {       // wird in einem zweiten Thread aufgerufen. Ob es Probleme macht, dass von dieser
            // Methode ausgehend indirekt OpenCascade verwendet wird? Um zu verhindern, dass
            // gleichzeitig mehrere Methoden von OpenCascade laufen müsste man ein "lock" mit einem
            // globalen Objekt der OpenCascade Bibliothek machen...
            try
            {
                Frame.ActiveView.Canvas.Cursor = "WaitCursor";
                GeoPoint p = base.CurrentMousePosition;
                foundOnPlane = CurrentMouseView.Projection.ProjectionPlane; // bei mehreren Fenstern so nicht gut!!!
                GeoPoint2D onPlane = foundOnPlane.Project(p);
                // hier müsste man irgendwie erst wenig picken und wenn nix geht dann immer mehr
                BoundingRect pickrect      = new BoundingRect(onPlane, base.WorldViewSize, base.WorldViewSize);
                Set <Layer>  visibleLayers = null;
                if (Frame.ActiveView is ModelView)
                {
                    visibleLayers = new Set <Layer>((Frame.ActiveView as ModelView).GetVisibleLayers());
                }
#if !WEBASSEMBLY
                else if (Frame.ActiveView is GDI2DView)
                {
                    visibleLayers = new Set <Layer>((Frame.ActiveView as GDI2DView).VisibleLayers.Checked);
                }
#endif
                GeoObjectList l = Frame.ActiveView.Model.GetObjectsFromRect(pickrect, CurrentMouseView.Projection, visibleLayers, PickMode.normal, Frame.Project.FilterList);
                // Problem: ein großese Rechteck, welches weit über pickrect hinausgeht hat Inseln, die nicht im pickrect liegen
                // Diese werden nicht gefunden. Deshalb hier nochmal das pickrect ggf. erweitern
                pickrect = l.GetExtent(CurrentMouseView.Projection, true, false);
                // l = Frame.ActiveView.ProjectedModel.GetObjectsFromRect(pickrect, null);
                l = Frame.ActiveView.Model.GetObjectsFromRect(pickrect, CurrentMouseView.Projection, visibleLayers, PickMode.normal, Frame.Project.FilterList);
                l.DecomposeBlocks(false);
                // l.Reduce(Frame.Project.FilterList); // FilterList jetzt schon beim Picken
                // CompoundShape cs = CompoundShape.CreateFromConnectedList(l, foundOnPlane, onPlane, l.GetExtent().Size * 1e-6, mode);
                CompoundShape cs = null;
                if (cs == null)
                {
                    CurveGraph cg = CurveGraph.CrackCurves(l, foundOnPlane, l.GetExtent().Size * 1e-6); // gap eine Ordnung größer als Precision
                    if (cg != null)
                    {
                        cs = cg.CreateCompoundShape(true, onPlane, mode, false);
#if DEBUG
                        if (cs == null)
                        {
                            cg = CurveGraph.CrackCurves(l, foundOnPlane, l.GetExtent().Size * 1e-6); // gap eine Ordnung größer als Precision
                            cs = cg.CreateCompoundShape(true, onPlane, mode, false);
                        }
#endif
                    }
                    else
                    {
                        cg = CurveGraph.CrackCurves(l, foundOnPlane, l.GetExtent().Size * 1e-6); // gap eine Ordnung größer als Precision
                    }
                }
                if (cs != null)
                {
                    Plane shapesPlane;
                    Plane pln;
                    if (cs != null)
                    {
                        // das BeginInvoke synchronisiert mit den MouseMessages, d.h.
                        // OnShapeFound wird nur aufgerufen, wenn alle Messages
                        // abgearbeitet sind, er also nicht in irgendeiner anderen
                        // Methode dieser Klasse steckt. Denn in OnShapeFound wird
                        // ActiveObject gesetzt und das geht nur synchron mit dem Control.
                        if (Curves.GetCommonPlane(cs.Curves3d(), out shapesPlane))
                        {
                            //cs = cs.Project(foundOnPlane, shapesPlane);
                            pln = shapesPlane;
                        }
                        else
                        {
                            pln = CurrentMouseView.Projection.DrawingPlane;
                        }
                        if (debug)
                        {
                            OnShapeFound(cs, pln, p);
                        }
                        else
                        {
                            OnShapeFound(cs, pln, p);
                        }
                    }
                }
                findShapeIsRunning = false;
            }
            catch (ThreadAbortException)
            {
                findShapeIsRunning = false;
            }
            catch (System.Exception e)
            {
                string dbg = e.Message;
                findShapeIsRunning = false;
            }
            finally
            {   // aus welchen Gründen könnte er hier rausfliegen???
                findShapeIsRunning = false;
            }
        }