Example #1
0
        private static nodetype CreateModelNode([NotNull] ModelNode modelNode)
        {
            DdxModel model = modelNode.Model;

            var data = new List <datatype>
            {
                CreateData(_keyNodeLabel, model.Name),
                CreateData(_keyModelName, model.Name)
            };

            var mlgraph =
                new graphtype
            {
                edgedefault = graphedgedefaulttype.directed,
                Items       = modelNode.DatasetNodes.Select(node => CreateDatasetNode(node,
                                                                                      useQualifiedLabel
                                                                                      : false))
                              .Cast <object>()
                              .ToArray()
            };

            var items = new List <object>();

            items.AddRange(data.Cast <object>());
            items.Add(mlgraph);
            return(new nodetype
            {
                id = modelNode.NodeId,
                Items = items.ToArray()
            });
        }
Example #2
0
        public static graphmltype GetGraphMLDocument([NotNull] DatasetDependencyGraph graph,
                                                     bool includeModelNodes = true)
        {
            var keys = new List <keytype>
            {
                CreateKey(_keyNodeLabel, "Label", keyfortype.node),
                CreateKey(_keyGeometryType, "GeometryType", keyfortype.node),
                CreateKey(_keyModelName, "Model", keyfortype.node),
                CreateKey(_keyEdgeLabel, "Label", keyfortype.edge),
                CreateKey(_keyQualityCondition, "QualityCondition", keyfortype.edge),
                CreateKey(_keyFromDataset, "FromDataset", keyfortype.edge),
                CreateKey(_keyToDataset, "ToDataset", keyfortype.edge),
                CreateKey(_keyFromFilterExpression, "FromFilterExpression",
                          keyfortype.edge),
                CreateKey(_keyToFilterExpression, "ToFilterExpression", keyfortype.edge),
                CreateKey(_keyFromParameter, "FromParameter", keyfortype.edge),
                CreateKey(_keyToParameter, "ToParameter", keyfortype.edge),
                CreateKey(_keyIssueType, "IssueType", keyfortype.edge),
                CreateKey(_keyStopCondition, "IsStopCondition", keyfortype.edge,
                          "boolean"),
                CreateKey(_keyCategory, "Category", keyfortype.edge),
                CreateKey(_keyTest, "Test", keyfortype.edge)
            };

            var rootItems = new List <object>();

            rootItems.AddRange(graph.DatasetDependencies.Select(CreateEdge).Cast <object>());

            if (includeModelNodes)
            {
                rootItems.AddRange(graph.ModelNodes.Select(CreateModelNode).Cast <object>());
            }
            else
            {
                rootItems.AddRange(
                    graph.DatasetNodes.Select(
                        node => CreateDatasetNode(node, useQualifiedLabel: true))
                    .Cast <object>());
            }

            var mlgraph = new graphtype
            {
                edgedefault = graphedgedefaulttype.directed,
                Items       = rootItems.ToArray()
            };

            var document = new graphmltype
            {
                key   = keys.ToArray(),
                Items = new object[] { mlgraph }
            };

            document.desc = graph.Description;

            return(document);
        }
Example #3
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     switch (comboBox1.SelectedIndex)
     {
         case 0:
             selectedtype = graphtype.X;
             Chart1.ChartArea.Axes[1].Text = "Buffer.X";
             break;
         case 1:
             selectedtype = graphtype.X_p;
             Chart1.ChartArea.Axes[1].Text = "Buffer.X_Processed";
             break;
         case 2:
             selectedtype = graphtype.Y;
             Chart1.ChartArea.Axes[1].Text = "Buffer.Y";
             break;
         case 3:
             selectedtype = graphtype.Y_p;
             Chart1.ChartArea.Axes[1].Text = "Buffer.Y_Processed";
             break;
         case 4:
             selectedtype = graphtype.Z;
             Chart1.ChartArea.Axes[1].Text = "Buffer.Z";
             break;
         case 5:
             selectedtype = graphtype.Z_p;
             Chart1.ChartArea.Axes[1].Text = "Buffer.Z_Processed";
             break;
         case 6:
             selectedtype = graphtype.Latitude;
             Chart1.ChartArea.Axes[1].Text = "Buffer.Latitude";
             break;
         case 7:
             selectedtype = graphtype.Latitude_p;
             Chart1.ChartArea.Axes[1].Text = "Buffer.Latitude_Processed";
             break;
         case 8:
             selectedtype = graphtype.Altitude;
             Chart1.ChartArea.Axes[1].Text = "Buffer.Altitude";
             break;
         case 9:
             selectedtype = graphtype.Altitude_p;
             Chart1.ChartArea.Axes[1].Text = "Buffer.Altitude_Processed";
             break;
         case 10:
             selectedtype = graphtype.Longitude;
             Chart1.ChartArea.Axes[1].Text = "Buffer.Longitude";
             break;
         case 11:
             selectedtype = graphtype.Longitude_p;
             Chart1.ChartArea.Axes[1].Text = "Buffer.Longitude_Processed";
             break;
         case 12:
             selectedtype = graphtype.Vx;
             Chart1.ChartArea.Axes[1].Text = "Buffer.Vx";
             break;
         case 13:
             selectedtype = graphtype.Vx_p;
             Chart1.ChartArea.Axes[1].Text = "Buffer.Vx_Processed";
             break;
         case 14:
             selectedtype = graphtype.Vy;
             Chart1.ChartArea.Axes[1].Text = "Buffer.Vy";
             break;
         case 15:
             selectedtype = graphtype.Vy_p;
             Chart1.ChartArea.Axes[1].Text = "Buffer.Vy_Processed";
             break;
         case 16:
             selectedtype = graphtype.Vz;
             Chart1.ChartArea.Axes[1].Text = "Buffer.Vz";
             break;
         case 17:
             selectedtype = graphtype.Vz_p;
             Chart1.ChartArea.Axes[1].Text = "Buffer.Vz_Processed";
             break;
         case 18:
             selectedtype = graphtype.Ax;
             Chart1.ChartArea.Axes[1].Text = "Buffer.Ax";
             break;
         case 19:
             selectedtype = graphtype.Ay;
             Chart1.ChartArea.Axes[1].Text = "Buffer.Ay";
             break;
         case 20:
             selectedtype = graphtype.Az;
             Chart1.ChartArea.Axes[1].Text = "Buffer.Az";
             break;
         case 21:
             selectedtype = graphtype.A;
             Chart1.ChartArea.Axes[1].Text = "Buffer.A";
             break;
         case 22:
             selectedtype = graphtype.PDOP;
             Chart1.ChartArea.Axes[1].Text = "Buffer.PDOP";
             break;
         case 23:
             selectedtype = graphtype.State;
             Chart1.ChartArea.Axes[1].Text = "Buffer.State";
             break;
         case 24:
             selectedtype = graphtype.Temperature;
             Chart1.ChartArea.Axes[1].Text = "Buffer.Temperature";
             break;
         case 25:
             selectedtype = graphtype.UsedStats;
             Chart1.ChartArea.Axes[1].Text = "Buffer.UsedStats";
             break;
         case 26:
             selectedtype = graphtype.VisibleStats;
             Chart1.ChartArea.Axes[1].Text = "Buffer.VisibleSats";
             break;
     }
     LoadData();
 }
Example #4
0
        public GraphData Readbuffer(graphtype type,float fstart, float fend,int gpoints)
        {
            #region stream_switch
                switch (type)
                {
                    case graphtype.Altitude:
                        stream = Altitude;
                        maxstream = AltitudeMax;
                        minstream = AltitudeMin;
                        break;
                    case graphtype.Altitude_p:
                        stream = Altitude;
                        maxstream = AltitudeMax;
                        minstream = AltitudeMin;
                        break;
                    case graphtype.Ax:
                        stream = Ax;
                        maxstream = AxMax;
                        minstream = AxMin;
                        break;
                    case graphtype.Ay:
                        stream = Ay;
                        maxstream = AyMax;
                        minstream = AyMin;
                        break;
                    case graphtype.Az:
                        stream = Az;
                        maxstream = AzMax;
                        minstream = AzMin;
                        break;
                    case graphtype.Latitude:
                        stream = Latitude;
                        maxstream = LatitudeMax;
                        minstream = LatitudeMin;
                        break;
                    case graphtype.Latitude_p:
                        stream = Latitude_p;
                        maxstream = LatitudeMax;
                        minstream = LatitudeMin;
                        break;
                    case graphtype.Longitude:
                        stream = Longitude;
                        maxstream = LongitudeMax;
                        minstream = LongitudeMin;
                        break;
                    case graphtype.Longitude_p:
                        stream = Longitude_p;
                        maxstream = LongitudeMax;
                        minstream = LongitudeMin;
                        break;
                    case graphtype.PDOP:
                        stream = PDOP;
                        maxstream = PDOPMax;
                        minstream = PDOPMin;
                        break;
                    case graphtype.State:
                        stream = state;
                        maxstream = minstream = state;
                        break;
                    case graphtype.Temperature:
                        stream = Temperature;
                        maxstream = minstream = Temperature;
                        break;
                    case graphtype.UsedStats:
                        stream = UsedStats;
                        maxstream = minstream = UsedStats;
                        break;
                    case graphtype.VisibleStats:
                        stream = VisibleStats;
                        maxstream = minstream = VisibleStats;
                        break;
                    case graphtype.Vx:
                        stream = Vx;
                        maxstream = VxMax;
                        minstream = VxMin;
                        break;
                    case graphtype.Vx_p:
                        stream = Vx_p;
                        maxstream = VxMax;
                        minstream = VxMin;
                        break;
                    case graphtype.Vy:
                        stream = Vy;
                        maxstream = VyMax;
                        minstream = VyMin;
                        break;
                    case graphtype.Vy_p:
                        stream = Vy_p;
                        maxstream = VyMax;
                        minstream = VyMin;
                        break;
                    case graphtype.Vz:
                        stream = Vz;
                        maxstream = VzMax;
                        minstream = VzMin;
                        break;
                    case graphtype.Vz_p:
                        stream = Vz_p;
                        maxstream = VzMax;
                        minstream = VzMin;
                        break;
                    case graphtype.X:
                        stream = X;
                        maxstream = XMax;
                        minstream = XMin;
                        break;
                    case graphtype.X_p:
                        stream = X_p;
                        maxstream = XMax;
                        minstream = XMin;
                        break;
                    case graphtype.Y:
                        stream = Y;
                        maxstream = YMax;
                        minstream = YMin;
                        break;
                    case graphtype.Y_p:
                        stream = Y_p;
                        maxstream = YMax;
                        minstream = YMin;
                        break;
                    case graphtype.Z:
                        stream = Z;
                        maxstream = ZMax;
                        minstream = ZMin;
                        break;
                    case graphtype.Z_p:
                        stream = Z_p;
                        maxstream = ZMax;
                        minstream = ZMin;
                        break;
                    case graphtype.A:
                        stream = A;
                        maxstream = AMin;
                        minstream = AMax;
                        break;
                    case graphtype.V:
                        stream = V;
                        maxstream = VMax;
                        minstream = VMin;
                        break;
                    case graphtype.V_p:
                        stream = V_p;
                        maxstream = VMax;
                        minstream = VMin;
                        break;
                }
                #endregion
                GraphData tempgraphdata = new GraphData(gpoints);

                if (stream.Length > 0)
                {
                    stream.Position = Functions.QuantizePosition(fstart * stream.Length);
                    maxstream.Position = minstream.Position = Functions.QuantizePosition(fstart * minstream.Length);
                    timestream.Position = Functions.QuantizePosition6bit(fstart * timestream.Length);

                    var db = (float)((fend - fstart) * stream.Length / gpoints);
                    var tdb = (float)((fend - fstart) * timestream.Length / gpoints);
                    var mdb = (float)((fend - fstart) * maxstream.Length);
                    var counter = 0;
                    int extflag = 1;
                    float pos = stream.Position;
                    float tpos = timestream.Position;
                    byte[] byt = new byte[4];
                    byte[] tbyt = new byte[6];
                    while (true)
                    {
                        double t;
                        if (type == graphtype.State || type == graphtype.Temperature)
                        {
                            t = stream.ReadByte();
                            pos += db;
                            stream.Position = (int)(pos);
                        }
                        else
                        {
                            stream.Read(byt, 0, 4);
                            if (type != graphtype.UsedStats && type != graphtype.VisibleStats)
                                t = Functions.BytetoFloat(byt);
                            else
                                t = Functions.BytetoFloatOther(byt);
                            pos += db;
                            stream.Position = Functions.QuantizePosition(pos);
                        }

                        timestream.Read(tbyt,0,6);
                        tpos += tdb;
                        timestream.Position = Functions.QuantizePosition6bit(tpos);

                        tempgraphdata.x[counter] = (double)stream.Position/stream.Length;//(double)stream.Position / stream.Length;
                        tempgraphdata.y[counter] = t;
                        var tempt = Functions.ReadDateTime(tbyt);
                        if (counter == 0)
                            tempgraphdata.date[counter] = tempt;
                        else
                        {
                            if (tempgraphdata.date[counter - 1] > tempt)
                                tempgraphdata.date[counter] = tempgraphdata.date[counter - 1];
                            else
                                tempgraphdata.date[counter] = tempt;
                        }
                        if (counter++ >= gpoints - 1)
                            break;
                        if (stream.Position >= stream.Length - 3 && type != graphtype.State && type != graphtype.Temperature)
                        {
                            for (int i = counter; i < gpoints; i++)
                            {
                                tempgraphdata.x[i] = (double)counter / gpoints;
                                tempgraphdata.y[i] = t;
                                tempgraphdata.date[i] = Functions.ReadDateTime(tbyt);
                            }
                            break;
                        }
                        else if (stream.Position >= stream.Length - 1 && type == graphtype.State && type == graphtype.Temperature)
                        {
                            for (int i = counter; i < gpoints; i++)
                            {
                                tempgraphdata.x[i] = (double)counter / gpoints;
                                tempgraphdata.y[i] = t;
                                tempgraphdata.date[i] = Functions.ReadDateTime(tbyt);
                            }
                            break;
                        }
                    }
                    while (extflag >= 0)
                    {
                        if (maxstream.Length <= 0)
                        {
                            tempgraphdata.max.Add(0);
                            tempgraphdata.min.Add(0);
                            break;
                        }
                        maxstream.Read(byt, 0, 4);
                        var tempmax = Functions.BytetoFloat(byt);
                        tempgraphdata.max.Add(tempmax);
                        minstream.Read(byt, 0, 4);
                        var tempmin = Functions.BytetoFloat(byt);
                        tempgraphdata.min.Add(tempmin);
                        float Percent = (float)maxstream.Position / (float)maxstream.Length;
                        if (Percent >= fend || Percent >= 1f)
                            extflag = -1;
                    }
                }
                return tempgraphdata;
        }
Example #5
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (comboBox1.SelectedIndex)
            {
            case 0:
                selectedtype = graphtype.X;
                Chart1.ChartArea.Axes[1].Text = "Buffer.X";
                break;

            case 1:
                selectedtype = graphtype.X_p;
                Chart1.ChartArea.Axes[1].Text = "Buffer.X_Processed";
                break;

            case 2:
                selectedtype = graphtype.Y;
                Chart1.ChartArea.Axes[1].Text = "Buffer.Y";
                break;

            case 3:
                selectedtype = graphtype.Y_p;
                Chart1.ChartArea.Axes[1].Text = "Buffer.Y_Processed";
                break;

            case 4:
                selectedtype = graphtype.Z;
                Chart1.ChartArea.Axes[1].Text = "Buffer.Z";
                break;

            case 5:
                selectedtype = graphtype.Z_p;
                Chart1.ChartArea.Axes[1].Text = "Buffer.Z_Processed";
                break;

            case 6:
                selectedtype = graphtype.Latitude;
                Chart1.ChartArea.Axes[1].Text = "Buffer.Latitude";
                break;

            case 7:
                selectedtype = graphtype.Latitude_p;
                Chart1.ChartArea.Axes[1].Text = "Buffer.Latitude_Processed";
                break;

            case 8:
                selectedtype = graphtype.Altitude;
                Chart1.ChartArea.Axes[1].Text = "Buffer.Altitude";
                break;

            case 9:
                selectedtype = graphtype.Altitude_p;
                Chart1.ChartArea.Axes[1].Text = "Buffer.Altitude_Processed";
                break;

            case 10:
                selectedtype = graphtype.Longitude;
                Chart1.ChartArea.Axes[1].Text = "Buffer.Longitude";
                break;

            case 11:
                selectedtype = graphtype.Longitude_p;
                Chart1.ChartArea.Axes[1].Text = "Buffer.Longitude_Processed";
                break;

            case 12:
                selectedtype = graphtype.Vx;
                Chart1.ChartArea.Axes[1].Text = "Buffer.Vx";
                break;

            case 13:
                selectedtype = graphtype.Vx_p;
                Chart1.ChartArea.Axes[1].Text = "Buffer.Vx_Processed";
                break;

            case 14:
                selectedtype = graphtype.Vy;
                Chart1.ChartArea.Axes[1].Text = "Buffer.Vy";
                break;

            case 15:
                selectedtype = graphtype.Vy_p;
                Chart1.ChartArea.Axes[1].Text = "Buffer.Vy_Processed";
                break;

            case 16:
                selectedtype = graphtype.Vz;
                Chart1.ChartArea.Axes[1].Text = "Buffer.Vz";
                break;

            case 17:
                selectedtype = graphtype.Vz_p;
                Chart1.ChartArea.Axes[1].Text = "Buffer.Vz_Processed";
                break;

            case 18:
                selectedtype = graphtype.Ax;
                Chart1.ChartArea.Axes[1].Text = "Buffer.Ax";
                break;

            case 19:
                selectedtype = graphtype.Ay;
                Chart1.ChartArea.Axes[1].Text = "Buffer.Ay";
                break;

            case 20:
                selectedtype = graphtype.Az;
                Chart1.ChartArea.Axes[1].Text = "Buffer.Az";
                break;

            case 21:
                selectedtype = graphtype.A;
                Chart1.ChartArea.Axes[1].Text = "Buffer.A";
                break;

            case 22:
                selectedtype = graphtype.PDOP;
                Chart1.ChartArea.Axes[1].Text = "Buffer.PDOP";
                break;

            case 23:
                selectedtype = graphtype.State;
                Chart1.ChartArea.Axes[1].Text = "Buffer.State";
                break;

            case 24:
                selectedtype = graphtype.Temperature;
                Chart1.ChartArea.Axes[1].Text = "Buffer.Temperature";
                break;

            case 25:
                selectedtype = graphtype.UsedStats;
                Chart1.ChartArea.Axes[1].Text = "Buffer.UsedStats";
                break;

            case 26:
                selectedtype = graphtype.VisibleStats;
                Chart1.ChartArea.Axes[1].Text = "Buffer.VisibleSats";
                break;
            }
            LoadData();
        }