public void Start()
		{
			int count = boneConnections.Length;

			if (startObject == null)
			{
				Debug.LogError("No start GameObject defined for BoneConnector script.");
				count = 0;
			}
			if (endObject == null)
			{
				// lines stay within the bones of one object
				endObject = startObject;
			}

			// prepare renderers and data structures
			lines = new LineData[count];
			for (int i = 0; i < count; i++)
			{
				GameObject line = GameObject.Instantiate(linePrefab);
				line.transform.parent = this.transform;
				line.name = "Line " + i;
				lines[i] = new LineData(line.GetComponent<LineRenderer>());
			}
			linePrefab.SetActive(false);

			copyContainer = new GameObject();
			copyContainer.name = "Copies";
			copyContainer.transform.parent = this.transform;
		}
Exemplo n.º 2
0
    static Vector2Int GetLineVector(LineData v, bool invertXY)
    {
        Vector2Int result = Vector2Int.zero;

        if (invertXY)
        {
            int y1 = v.minY + (Mathf.RoundToInt(v.yRange * 0f));
            int x1 = (Mathf.RoundToInt(v.slope * y1)) + v.intercept + v.offset;

            int y2 = v.minY + (Mathf.RoundToInt(v.yRange * 1f));
            int x2 = (Mathf.RoundToInt(v.slope * y2)) + v.intercept + v.offset;

            Vector2Int p0 = new Vector2Int(x1, y1);
            Vector2Int p1 = new Vector2Int(x2, y2);

            result = p1 - p0;
        }
        else
        {
            int x1 = v.minX + (Mathf.RoundToInt(v.xRange * 0f));
            int y1 = (Mathf.RoundToInt(v.slope * x1)) + v.intercept + v.offset;

            int x2 = v.minX + (Mathf.RoundToInt(v.xRange * 1f));
            int y2 = (Mathf.RoundToInt(v.slope * x2)) + v.intercept + v.offset;

            Vector2Int p0 = new Vector2Int(x1, y1);
            Vector2Int p1 = new Vector2Int(x2, y2);

            result = p1 - p0;
        }

        return(result);
    }
Exemplo n.º 3
0
    public void AddLineDataPoint(LineData lineDataPoint) //send in min and max for data value
    {
        if (m_LineData == null)
        {
            return;
        }
        float mappedXDataPoint = Map(Time.time, m_StartTime, (m_Width) + m_StartTime, 0.0f, m_Width);
        float mappedYDataPoint = Map(lineDataPoint.m_DataValue, m_MinRange, m_MaxRange, 0, m_Height);

        if (mappedXDataPoint >= m_Width)
        {
            ResetGraphData();
            mappedXDataPoint = Map(Time.time, m_StartTime, (m_Width) + m_StartTime, 0.0f, m_Width); //width / 5 because one point every 5 second
        }

        lineDataPoint.m_Time = Time.time; //set xval of point
        GameObject point = Instantiate(m_PointObject);

        lineDataPoint.m_DataObject = point;

        //map datapoint to the scale of the graph

        Vector3 offset = new Vector3(mappedXDataPoint, mappedYDataPoint, 0);

        point.transform.parent        = m_GraphOrigin.transform;
        point.transform.localPosition = Vector3.zero + offset;

        m_Step += m_StepLength; //move to next step(possibly switch to Time.time)
        m_PointCount++;         //point count is int tracking indices for line renderer

        m_LineData.Add(lineDataPoint);

        SetLineRendererPosition(point.transform.position);
    }
Exemplo n.º 4
0
    LineData ReadLine(AnimVRData.Line?line)
    {
        var result = new LineData();

        result.transform = ReadTransform(line.Value.Trans);

        var settings = ReadBrushStyle(line.Value.Settings);

        settings.ApplyTo(result);

        result.Points             = new List <SerializableVector3>(line.Value.PointsLength);
        result.widths             = new List <float>(line.Value.WidthsLength);
        result.colors             = new List <SerializableColor>(line.Value.ColorsLength);
        result.light              = new List <float>(line.Value.LightsLength);
        result.rotations          = new List <SerializableQuaternion>(line.Value.RotationsLength);
        result.cameraOrientations = new List <SerializableQuaternion>(line.Value.CamOrientationsLength);

        for (int i = 0; i < line.Value.PointsLength; i++)
        {
            result.Points.Add(ReadVec3(line.Value.Points(i).Value));
            result.widths.Add(line.Value.Widths(i));
            result.colors.Add(ReadColor(line.Value.Colors(i).Value));
            result.light.Add(line.Value.Lights(i));
            result.rotations.Add(ReadQuat(line.Value.Rotations(i).Value));
            result.cameraOrientations.Add(ReadQuat(line.Value.CamOrientations(i).Value));
        }

        return(result);
    }
Exemplo n.º 5
0
        // -------------------------------------------------------------------------------------------------
        // Gets dissasembly source
        //
        // \param [in,out]  tf
        // The tf.
        // \param           maxlines
        // The maxlines.
        //
        // \return  The dissasembly source.
        // -------------------------------------------------------------------------------------------------
        public string GetDissasemblySource(ref TraceFile tf, int maxlines, int currentline)
        {
            string textfile = "";

            tf.lines.Clear();
            int lineNumber = 0;


            for (int i = 0; i < maxlines - 1; i++)
            {
                textfile = textfile + DissasemblyLines[currentline].line + "\n";


                if (DissasemblyLines[currentline].addr >= 0)
                {
                    LineData ld = new LineData();
                    ld.lineNumber  = lineNumber;
                    ld.nextAddress = new NextAddress(DissasemblyLines[currentline].addr, NextAddress.GetBankFromAddress(ref MainForm.banks, DissasemblyLines[currentline].addr));
                    ld.tf          = tf;
                    tf.lines.Add(ld);
                }

                lineNumber++;
                currentline++;
            }



            return(textfile);
        }
Exemplo n.º 6
0
        public static bool Analyze(string sid, DateTime start, DateTime end)
        {
            List <LineData> list = BizApi.QueryLineByDay(sid, start, end);

            //停盘
            if (list.Count == 0)
            {
                //Console.WriteLine(sid + " close");
                return(false);
            }
            int      peekindexclose   = 0;
            LineData peek             = GetClosePeek(list, out peekindexclose);
            int      valleyindexclose = 0;
            LineData vally            = GetCloseValley(list, out valleyindexclose);
            int      valleyindexlow2  = 0;
            LineData vally2           = GetLowValley2(list, peekindexclose, out valleyindexlow2);

            //如果时间太短,调整不够
            //if (peekindexclose < valleyindexclose || peekindexclose > valleyindexlow2) return false;
            //if (peekindexclose - valleyindexclose < 3 || valleyindexlow2 - peekindexclose < 3) return false;

            bool shangzhang = judgeShangzhang(list, peekindexclose, valleyindexclose);

            bool xiadie = judgeXiajiang(list, peekindexclose, valleyindexlow2);

            bool liangneng = judgeSuoliang(list, peekindexclose, valleyindexclose);

            Console.WriteLine("上涨,下跌,缩量" + shangzhang + "," + xiadie + "," + liangneng);
            return(shangzhang && xiadie && liangneng);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 上涨过程
        /// </summary>
        /// <param name="list"></param>
        /// <param name="peekindexclose"></param>
        /// <param name="vallyindexclose"></param>
        /// <returns></returns>
        public static bool judgeShangzhang(List <LineData> list, int peekindexclose, int vallyindexclose)
        {
            LineData peek   = list[peekindexclose];
            LineData valley = list[vallyindexclose];

            //收盘价阳线
            int b1 = (peek.close > peek.open) && (peek.close == peek.high) ? 1 : 0;;

            int b2 = ((decimal)(peek.close - list[peekindexclose - 1].close) / list[peekindexclose - 1].close) > adjust ? 1 : 0;

            //最高价比最低价过20%
            int b3 = ((decimal)((peek.close - valley.close) / valley.close)) > shangzhang_zhangfu ? 1 : 0;

            //有涨停
            bool bb = false;

            for (int i = 1; i <= peekindexclose; i++)
            {
                if ((decimal)((list[i].close - list[i - 1].close) / list[i - 1].close) > 0.098M)
                {
                    bb = true;
                }
            }

            int b4 = bb ? 1 : 0;

            return((b1 + b2 + b3 + b4) > 3);
        }
Exemplo n.º 8
0
    private static string GetLineFilterJSON(string layerName, float min, float max)
    {
        var thiknessLineData = new LineData();

        thiknessLineData.LayerID = layerName;

        List <Vector2> dataDist = new List <Vector2>();

        dataDist = new List <Vector2>();

        thiknessLineData.DataDistribution = new Vector2[100];
        dataDist.Add(new Vector2(min, 34));

        for (int i = 1; i <= 98; i++)
        {
            float X    = UnityEngine.Random.Range(min, max);
            float Y    = UnityEngine.Random.Range(0, 255);
            var   vect = new Vector2(X, Y);
            dataDist.Add(vect);
        }
        ;

        dataDist.Add(new Vector2(max, 34));
        thiknessLineData.DataDistribution = dataDist.OrderBy(i => i.x).ToArray();


        string lineChartJSON = JsonUtility.ToJson(thiknessLineData);

        return(lineChartJSON);
    }
Exemplo n.º 9
0
            protected void CalcLinesX(double minValue, double maxValue, double coef)
            {
                List <LineData> lines      = new List <LineData>();
                List <LineData> linesMinor = new List <LineData>();

                double dValue   = maxValue - minValue;
                int    posLines = (int)(maxValue / coef);
                int    negLines = (int)(minValue / coef);

                for (int i = negLines; i < posLines; i++)
                {
                    LineData line = new LineData();
                    line.Text = GetTrafficString(i * coef);

                    float py = (float)((maxValue - i * coef));
                    line.RelativePoint.Y = (float)(py / dValue);
                    lines.Add(line);

                    double divVal = coef / 8;
                    for (int minor = 1; minor < 8; minor++)
                    {
                        double mLineValue = i * coef + minor * divVal;
                        line                 = new LineData();
                        line.Text            = GetTrafficString(mLineValue);
                        line.RelativePoint.Y = (float)((maxValue - mLineValue) / dValue);
                        linesMinor.Add(line);
                    }
                }
                _linesMajorX = lines.ToArray();
                _linesMinorX = linesMinor.ToArray();
            }
        // Set apearance of MPandroidChart here
        private void PrepareLineChart(LineChart mChart)
        {
            mChart.Description.Enabled = false;
            mChart.SetTouchEnabled(false);
            mChart.SetScaleEnabled(false);
            var legend = mChart.Legend;

            legend.Enabled  = true;
            legend.TextSize = 12f;
            mChart.SetDrawGridBackground(false);
            mChart.AnimateY(1100);
            mChart.SetDrawBorders(false);
            mChart.SetHardwareAccelerationEnabled(true);
            var sets = new List <ILineDataSet>
            {
                CreateLineDataSet(Color.Magenta, "X"),
                CreateLineDataSet(Color.LimeGreen, "Y"),
                CreateLineDataSet(Color.DarkBlue, "Z")
            };
            LineData data = new LineData(sets);

            mChart.Data = data;
            XAxis xl = mChart.XAxis;

            xl.SetDrawGridLines(true);
            xl.SetAvoidFirstLastClipping(true);
            xl.Enabled = true;
            YAxis leftAxis = mChart.AxisLeft;

            leftAxis.SetDrawGridLines(false);
            leftAxis.SetDrawGridLines(true);
            YAxis rightAxis = mChart.AxisRight;

            rightAxis.Enabled = false;
        }
Exemplo n.º 11
0
 public StartCommand(LineData lineData)
 {
     if (lineData != null)
     {
         checkLineData(lineData);
     }
 }
Exemplo n.º 12
0
 public AddRaCommand(LineData lineData)
 {
     if (lineData != null)
     {
         checkLineData(lineData);
     }
 }
Exemplo n.º 13
0
        /// <summary>
        /// Reads a line in a .text segment of a program, and adds any found symbols to the
        /// symbol table.
        /// </summary>
        /// <param name="asmLine">The line of assembly code to parse.</param>
        /// <param name="symbolList">The list of symbols that will be added to.</param>
        /// <param name="alignment">Unused. Alignment is always on word boundaries in the text segment.</param>
        public void ParseSymbolsInLine(LineData asmLine, SymbolTable symbolList, int alignment)
        {
            string[] tokens = asmLine.Text.Split(' ');
            // a label should end with a ':' character.
            // this is OK if there's trash and no real assembly at this point,
            // as the second pass code generator will flag it.
            // we're just here to get symbols and addresses.
            if (ParserCommon.ContainsLabel(tokens[0]))
            {
                string labelName = ParserCommon.ExtractLabel(tokens[0]);
                var    label     = new Symbol(labelName, SegmentType.Text, m_CurrTextAddress);
                label.Size = sizeof(int);
                symbolList.AddSymbol(label);

                // determine if there are any instructions on this line.
                string[] subTokens = tokens[0].Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries);

                // if we have more than one subtoken, then there is more than just a label on this line.
                // increment the number of words in the segment (since we're assuming whatever is on the right-hand side
                // is an instruction) by however many bytes the instruction is
                if (subTokens.Length > 1)
                {
                    ParseUnlabeledLine(asmLine);
                }
            }

            // if this doesn't have a label, and is not empty or a comment,
            // then this is an instruction. increment the counter.
            else
            {
                ParseUnlabeledLine(asmLine);
            }
        }
Exemplo n.º 14
0
        // ********************************************************************

        #region Methods called from property setters

        public void UpdateAfterSelectedMeasurementChange()
        {
            var x1 = SelectedMeasurement.GetFirstXPosition();
            var x2 = SelectedMeasurement.GetLastXPosition();

            LineData.UpdateLineEndXPoints(x1, x2);
        }
Exemplo n.º 15
0
        public void Start()
        {
            int count = boneConnections.Length;

            if (startObject == null)
            {
                Debug.LogError("No start GameObject defined for BoneConnector script.");
                count = 0;
            }
            if (endObject == null)
            {
                // lines stay within the bones of one object
                endObject = startObject;
            }

            // prepare renderers and data structures
            lines = new LineData[count];
            for (int i = 0; i < count; i++)
            {
                GameObject line = GameObject.Instantiate(linePrefab);
                line.transform.parent = this.transform;
                line.name             = "Line " + i;
                lines[i] = new LineData(line.GetComponent <LineRenderer>());
            }
            linePrefab.SetActive(false);

            copyContainer                  = new GameObject();
            copyContainer.name             = "Copies";
            copyContainer.transform.parent = this.transform;
        }
Exemplo n.º 16
0
 /// <summary>
 /// render一行
 /// </summary>
 /// <param name="lineData"></param>
 public void renderLine(LineData lineData)
 {
     for (int j = 0; j < lineData.list.Count; j++)
     {
         renderCell(lineData.list[j]);
     }
 }
Exemplo n.º 17
0
    private void Load()
    {
        var lineas = ReadTsv();

        IDictionary <GroupId, IList <LineData> > tipsBuffer = new Dictionary <GroupId, IList <LineData> >();

        foreach (string s in lineas)
        {
            LineData linea = ProcesarLinea(s);

            var groupId = new GroupId(linea.Entidad, linea.TipConditionId, linea.Orden);

            if (!tipsBuffer.ContainsKey(groupId))
            {
                tipsBuffer.Add(groupId, new List <LineData>());
            }

            tipsBuffer[groupId].Add(linea);
        }

        foreach (var gId in tipsBuffer.Keys)
        {
            Tips.Add(CrearTipGroup(gId.Entidad, gId.TipConditionId, gId.Orden, tipsBuffer[gId]));
        }
    }
Exemplo n.º 18
0
        public void DrawLine()
        {
            var request = new LineData();

            request.PinX   = 1;
            request.PinY   = 2;
            request.Width  = 1;
            request.Height = 1;
            request.Points = new List <PointF> {
                new PointF(0, 0), new PointF(0, 1)
            };
            request.Text = "test draw line";
            var shapeStyleData = new ShapeStyleData();

            shapeStyleData.FillBackGroundColor = "#FF0000";
            var textStyleData = new TextStyleData();

            textStyleData.FontSize = 0.25;
            textStyleData.FontName = "Times New Roman";
            request.ShapeStyleData = shapeStyleData;
            request.TextStyleData  = textStyleData;

            var response = diagramApi.PutDrawLine(fileName, pageName, request, StorageTestFOLDER);

            Assert.IsTrue(response.IsSuccess);
        }
        private void InitializeChart()
        {
            if (supportLineChart != null && supportLineChart.ChartData != null && lineChart != null)
            {
                SupportChart.OnInitializeChart(supportLineChart, lineChart);

                var data         = supportLineChart.ChartData;
                var dataSetItems = new List <LineDataSet>();

                foreach (var itemChild in data.IF_GetDataSet())
                {
                    var         entryOriginal = itemChild.IF_GetEntry().Select(item => new MikePhil.Charting.Data.Entry(item.GetXPosition(), item.GetYPosition()));
                    LineDataSet lineDataSet   = new LineDataSet(entryOriginal.ToArray(), itemChild.IF_GetTitle());
                    lineDataSet.Color = itemChild.IF_GetDataColor().ToAndroid();
                    lineDataSet.SetMode(SupportChart.GetDrawLineMode(itemChild.IF_GetDrawMode()));
                    lineDataSet.CircleRadius     = itemChild.IF_GetCircleRadius();
                    lineDataSet.CircleHoleRadius = itemChild.IF_GetCircleHoleRadius();
                    lineDataSet.SetDrawCircles(itemChild.IF_GetDrawCircle());
                    lineDataSet.SetDrawValues(itemChild.IF_GetDrawValue());

                    var arrColor = itemChild.IF_GetCircleColors().Select(item => item.ToAndroid());
                    lineDataSet.SetCircleColor(itemChild.IF_GetCircleColor().ToAndroid());
                    dataSetItems.Add(lineDataSet);
                }

                LineData lineData = new LineData(dataSetItems.ToArray());
                lineChart.Data = lineData;
            }
        }
Exemplo n.º 20
0
    static Vector2Int[] DrawLineSamples(LineData v, bool invertXY)
    {
        Vector2Int[] result = new Vector2Int[v.resolution];

        if (invertXY)
        {
            for (int i = 0; i < v.resolution; i++)
            {
                int y = v.minY + (Mathf.RoundToInt(v.yRange * ((float)i / (float)v.resolution)));
                int x = (Mathf.RoundToInt(v.slope * y)) + v.intercept + v.offset;

                result[i] = new Vector2Int(x, y);
            }
        }
        else
        {
            for (int i = 0; i < v.resolution; i++)
            {
                int x = v.minX + (Mathf.RoundToInt(v.xRange * ((float)i / (float)v.resolution)));
                int y = (Mathf.RoundToInt(v.slope * x)) + v.intercept + v.offset;

                result[i] = new Vector2Int(x, y);
            }
        }

        return(result);
    }
Exemplo n.º 21
0
 public CallMacroCommand(LineData lineData)
 {
     if (lineData != null)
     {
         checkLineData(lineData);
     }
 }
Exemplo n.º 22
0
        ///---------------------------------------------------------------------
        #region Lines Pool
        private void EnableRendering()
        {
            for (int p = 0; p < 2; p++)
            {
                var text         = p == 0 ? "BackFront" : "Front";
                var lineShader   = Shader.Find("Prateek/DebugLineShader" + text);
                var lineMaterial = new Material(lineShader);

                var go = new GameObject("DebugLineRenderer" + text, typeof(MeshFilter), typeof(MeshRenderer));
                go.transform.SetParent(transform);
                go.transform.localPosition = Vector3.zero;
                go.transform.localRotation = Quaternion.identity;

                var renderer = go.GetComponent <MeshRenderer>();
                renderer.material = lineMaterial;
                lineMaterial      = renderer.material;

                if (p == 0)
                {
                    lineDataBackFront = new LineData(instanceCount, go, renderer, lineMaterial, borderThickness);
                }
                else
                {
                    lineDataFront = new LineData(instanceCount, go, renderer, lineMaterial, borderThickness);
                }
            }
        }
Exemplo n.º 23
0
    public GameObject AddALine(Vector3 point1, Vector3 point2, Vector3 cameraPos)
    {
        LineData lineData = new LineData(point1, point2);

        lineData.scale = Vector3.Distance((point1 + point2) / 2, cameraPos) * scaleFactor;
        return(AddALine(lineData));
    }
Exemplo n.º 24
0
        public bool checkLineData(LineData lineData)
        {
            if (lineData.args.isEmpty() || lineData.args.Length > 1)
            {
                throw new ArgumentException("Неверный формат сроки");
            }
            if (!Regex.IsMatch(lineData.args.get(0), @"[cC](['""])(.+)\1"))
            {
                throw new ArgumentException("Неверный формат выражения");
            }

            //var byteC = ;

            //if (byteC.Count == 1)
            //{
            //    if (tempLine.Length == (byteC[0].Index + byteC[0].Length))
            //    {
            //        tempArg1 = tempLine.Substring(byteC[0].Index, byteC[0].Length);
            //        tempLine = tempLine.Substring(0, tempLine.Length - byteC[0].Length);
            //    }
            //    else
            //    {
            //        err.AppendText(string.Format("Неверный формат строки {0}\n", lineCount + 1));
            //        return;
            //    }
            //}
            //else if (byteC.Count > 1)
            //{
            //    err.AppendText(string.Format("Неверный формат строки {0}\n", lineCount + 1));
            //    return;
            //}
            _data = lineData;
            return(true);
        }
        protected override void OnSceneGUI()
        {
            base.OnSceneGUI();

            serializedObject.Update();

            var rotation = endPoint.FindPropertyRelative("rotation");

            if (Tools.current == Tool.Move)
            {
                EditorGUI.BeginChangeCheck();
                Vector3 newTargetPosition = Handles.PositionHandle(LineData.GetPoint(1), Quaternion.identity);

                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(LineData, "Change Simple Point Position");
                    LineData.SetPoint(1, newTargetPosition);
                }
            }
            else if (Tools.current == Tool.Rotate)
            {
                EditorGUI.BeginChangeCheck();
                Quaternion newTargetRotation = Handles.RotationHandle(rotation.quaternionValue, LineData.GetPoint(1));

                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(LineData, "Change Simple Point Rotation");
                    rotation.quaternionValue = newTargetRotation;
                }
            }

            serializedObject.ApplyModifiedProperties();
        }
    private static void ProcessLineAsset(string path)
    {
        Mesh mesh;

        StreamReader reader = new StreamReader(path);
        string       data   = reader.ReadToEnd();

        reader.Close();

        string assetPath = path.Replace(".lines", ".asset");

        string[] bits = assetPath.Replace(".asset", "").Split('/');
        string   name = bits[bits.Length - 1];

        mesh = (Mesh)AssetDatabase.LoadAssetAtPath(assetPath, typeof(Mesh));
        if (!mesh)
        {
            mesh      = new Mesh();
            mesh.name = name;
            AssetDatabase.CreateAsset(mesh, assetPath);
        }
        else
        {
            mesh.Clear();
        }

        LineData.Parse(data, ref mesh);
        AssetDatabase.SaveAssets();
    }
Exemplo n.º 27
0
 public ByteCommand(LineData lineData)
 {
     if (lineData != null)
     {
         checkLineData(lineData);
     }
 }
        private void UpdatePlot(LineChart mChart, int broadcast_idx, float[] dataVector)
        {
            LineData data = mChart.LineData;

            if (data != null)
            {
                ILineDataSet setx = (ILineDataSet)data.DataSets[0];
                ILineDataSet sety = (ILineDataSet)data.DataSets[1];
                ILineDataSet setz = (ILineDataSet)data.DataSets[2];

                // add new plot entry
                data.AddEntry(new Entry(broadcast_idx, dataVector[0]), 0);
                data.AddEntry(new Entry(broadcast_idx, dataVector[1]), 1);
                data.AddEntry(new Entry(broadcast_idx, dataVector[2]), 2);
                mChart.NotifyDataSetChanged();
                // limit the number of visible entries
                mChart.SetVisibleXRangeMaximum(max_entries);

                // remove plot entries outside of current view
                if (setx.EntryCount == max_entries_saved)
                {
                    setx.RemoveEntry(0);
                    sety.RemoveEntry(0);
                    setz.RemoveEntry(0);
                    mChart.AxisLeft.SpaceTop = 10f;
                }
                // move to the latest entry
                mChart.MoveViewToX(broadcast_idx);
            }
        }
Exemplo n.º 29
0
 /// <summary>
 /// Parses current drawing from JSON
 /// </summary>
 /// <param name="jsonDrawCommands">JSON draw commands</param>
 private void ParseCurrentDrawingFromJSON(JArray jsonDrawCommands)
 {
     foreach (JToken json_token in jsonDrawCommands)
     {
         if (json_token is JObject json_draw_command)
         {
             if (json_draw_command.ContainsKey("type") && json_draw_command.ContainsKey("data") && json_draw_command["data"] is JObject json_draw_command_data)
             {
                 switch (json_draw_command["type"].ToObject<string>())
                 {
                     case "line":
                         LineData line_data = json_draw_command_data.ToObject<LineData>();
                         if ((line_data != null) && line_data.IsValid)
                         {
                             currentDrawing.Add(new DrawCommand(EDrawCommandType.Line, line_data.FromX, line_data.FromY, line_data.ToX, line_data.ToY, (Color)line_data.Color, line_data.LineWidth));
                         }
                         else
                         {
                             throw new InvalidDataException("Line draw command data is invalid.");
                         }
                         break;
                     case "fill":
                         FillData fill_data = json_draw_command_data.ToObject<FillData>();
                         if ((fill_data != null) && fill_data.IsValid)
                         {
                             currentDrawing.Add(new DrawCommand(EDrawCommandType.Fill, fill_data.X, fill_data.Y, default, default, (Color)fill_data.Color, 0.0f));
                         }
                         else
                         {
                             throw new InvalidDataException("Fill draw command data is invalid.");
                         }
                         break;
                 }
             }
         }
Exemplo n.º 30
0
 public EndifCommand(LineData lineData)
 {
     if (lineData != null)
     {
         checkLineData(lineData);
     }
 }
Exemplo n.º 31
0
    public virtual void Awake()
    {
        LineData.use     = this;
        this.ship1Points = VectorLine.BytesToVector3List(this.ship1.bytes);
        this.ship2Points = VectorLine.BytesToVector3List(this.ship2.bytes);
        this.ship3Points = VectorLine.BytesToVector3List(this.ship3.bytes);
        this.ship4Points = VectorLine.BytesToVector3List(this.ship4.bytes);
        this.titlePoints = VectorLine.BytesToVector3List(this.title.bytes);

        // Exploded ship parts
        this.partLocations = new Vector3[] { new Vector3(-0.02f, 3.17f, -1.52f), new Vector3(0f, 1.91f, -0.12f), new Vector3(0f, 1.8f, -2.29f), new Vector3(-0.6f, -0.36f, 0.13f), new Vector3(0.84f, -0.75f, 3f), new Vector3(-1.3f, -0.79f, -2.35f), new Vector3(1.12f, 0f, -1.89f) };
        this.partPoints    = new List <System.Collections.Generic.List <Vector3> >(7);
        int i = 0;

        while (i < 7)
        {
            this.partPoints.Add(VectorLine.BytesToVector3List(this.shipParts[i].bytes));
            i++;
        }

        // Reticle
        this.reticlePoints = new List <Vector3>(new Vector3[] { new Vector3(-30f, 0f), new Vector3(30f, 0f), new Vector3(0f, -30f), new Vector3(0f, 30f),
                                                                new Vector3(-5f, 10f), new Vector3(5f, 10f), new Vector3(10f, 5f), new Vector3(10f, -5f),
                                                                new Vector3(5f, -10f), new Vector3(-5f, -10f), new Vector3(-10f, 5f), new Vector3(-10f, -5f),
                                                                new Vector3(-10f, 20f), new Vector3(10f, 20f), new Vector3(20f, 10f), new Vector3(20f, -10f),
                                                                new Vector3(10f, -20f), new Vector3(-10f, -20f), new Vector3(-20f, 10f), new Vector3(-20f, -10f) });
    }
Exemplo n.º 32
0
 public GameObject AddALine(LineData lineData)
 {
     GameObject line = new GameObject ("Line");
     LineRenderer lineRenderer = line.AddComponent ("LineRenderer") as LineRenderer;
     lineRenderer.SetWidth (lineData.scale, lineData.scale);
     lineRenderer.SetPosition (0, lineData.point1.ToVector3());
     lineRenderer.SetPosition (1, lineData.point2.ToVector3());
     lineRenderer.transform.parent = transform;
     lineRenderer.renderer.material = lineMaterial;
     DataHolder holder = (DataHolder) line.AddComponent("DataHolder");
     holder.StatsData = lineData;
     return line;
 }
Exemplo n.º 33
0
        public void ProcessDataThreadMethod()
        {
            try
            {
                // Enter the listening loop.
                while (!_shutdown)
                {
                    byte[] receivedData;
                    int lineSize = PixelsPerColumn * BytesPerPixel;
                    receivedData = _diplotDataAcess.ReceiveDataLines(lineSize);

                    if (receivedData == null)
                    {
                        Thread.Sleep(10);
                        continue;
                    }

                    LineData ld = new LineData();
                    ld.data = receivedData;
                    lineArray.Add(ld);                    
                }
            }
            catch (SocketException e)
            {
                Console.WriteLine("SocketException: {0}", e);
            }
            finally
            {
                
            }


            Console.WriteLine("\nHit enter to continue...");
            Console.Read();
        }
Exemplo n.º 34
0
Arquivo: Parser.cs Projeto: vs06/bvcms
        LineData GetLineData()
        {
            while (lineno < lines.Length && skipline.IsMatch(curline))
            {
                lineno++;
                continue;
            }
            if (lineno >= lines.Length)
                return null;
            var m = linedata.Match(curline);
            if (m.Success)
            {
                var d = new LineData();
                d.line = curline.Trim();
                lineno++;
                d.lineno = lineno;
                d.indent = m.Groups["sp"].Value.Length;
                d.value = m.Groups["val"].Value.TrimEnd();
                var keyword = m.Groups["keyword"].Value;

                RegKeywords kw;
                if (!Enum.TryParse<RegKeywords>(keyword, true, out kw))
                    kw = RegKeywords.None;
                d.kw = kw;
                if (d.value == "<<")
                {
                    var lookfor = curline.Trim();
                    lineno++;
                    d.html = true;
                    var sb = new StringBuilder();
                    while (lineno < lines.Length && curline.Trim() != lookfor)
                    {
                        sb.Append(curline.Trim());
                        lineno++;
                    }
                    d.value = sb.ToString();
                    lineno++;
                }
                return d;
            }
            return null;
        }
Exemplo n.º 35
0
        private bool PlotSpatial(int detpb, LineData lineData)
        {
            Random br;
            int tst = 0;
            UInt32 id;
            bool bret = false;

            dqi.DetNum = 80; //hard-coded
            dqi.BytesPerPixel = 3; //hard-coded

            uint dwBytesPerSection = dqi.DetNum * dqi.BytesPerPixel + dqi.LineHeaderSize;
            
            byte[] HeaderID = new byte[dqi.LineHeaderSize];
            
            if (DisplayMode == 1)//time
                return bret;
            else
            {
                //setup ui
                if (SetupSpatialModeUi == false)
                {
                    this.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                            (ThreadStart)delegate()
                            {
                                tabControl1.SelectedIndex = 1;
                                MyChart.ChartAreas[0].AxisX.CustomLabels.Clear();
                                MyChart.Series[0].ChartType = SeriesChartType.FastPoint;
                                MyChart.Series[0].MarkerStyle = MarkerStyle.Circle;
                                MyChart.Series[0].MarkerSize = SeriesMarkerSize;//4;
                                MyChart.Series[0].MarkerColor = System.Drawing.Color.Black;
                                //how many boards to display
                                int brd = (int)dqi.DetNum / detpb;
                                for (int i = 0; i < brd; i++)
                                {
                                    MyChart.ChartAreas[0].AxisX.CustomLabels.Add(5 + detpb * i, 20 + detpb * i, "board " + (i + 1).ToString(), 0, LabelMarkStyle.None);
                                }

                            }
                   );
                    SetupSpatialModeUi = true;
                }

                if (EmulatorEnabled == true)
                {
                    {
                        br = new Random();
                        br.NextBytes(DataStorage);
                    }
                }
                else
                {
                    try
                    {
                        //if (lineData.data != null)
                        //    pipeComm.DataSrvHandle.Read(DataStorage, 0, DataStorage.Length);
                        //else
                        DataStorage = lineData.data;

                        dqi.DetNum = 80;// (uint)diPlotDetectorAppChannel.PixelsPerColumn;
                        LineDataX = new uint[dqi.DetNum];

                    }
                    catch { }
                }

                for (int pp = 0; pp < 10; pp++)
                {
                    tst += (int)DataStorage[pp];
                }

                if (DataStorage.Length != 0 && tst != 0)
                {
                    //Buffer.BlockCopy(DataStorage, 0, HeaderID, 0, HeaderID.Length);
                    //Buffer.BlockCopy(DataStorage, (int)dqi.LineHeaderSize, LineDataX, 0, ((int)dwBytesPerSection - (int)dqi.LineHeaderSize)); //?????????????

                    int index = 0;

                    for (int i = 0; i < dqi.DetNum; i++)
                    {
                        LineDataX[i] = (uint)(((DataStorage[index + 2] << 16) + (DataStorage[index + 1] << 8) + DataStorage[index]) >> 8);
                        //LineDataX[i] = (uint)(DataStorage[index + 2] << 8 + DataStorage[index + 1]);
                        index += 3;
                    }

                    //id = BitConverter.ToUInt32(HeaderID, 0);
                    //UpdateCtl((object)BlockIdLbl, id.ToString());
                    this.Dispatcher.Invoke(DispatcherPriority.Normal, new PlotChartDelegate(PlotData));

                    if (EmulatorEnabled == true)
                    {
                        System.Threading.Thread.Sleep(50);
                    }
                    else
                    {
                        System.Threading.Thread.Sleep(1);
                    }
                }
            }

            bret = true;
            return bret;
        }
 public RawLineReceivedEventArgs(LineData rawLine)
 {
     this.RawLine = rawLine;
 }
Exemplo n.º 37
0
 // Functions
 protected virtual void OnDestroy()
 {
     // Line renderer
     if (lineData != null)
     {
         if (lineData.Renderer != null)
         {
             Destroy(lineData.Renderer);
         }
         if (lineData.Filter != null)
         {
             Destroy(lineData.Filter);
         }
     }
     lineData = null;
 }
Exemplo n.º 38
0
    private float scaleFactor = .01f; // todo; monodevelop has lost the ability to shift1

    #endregion Fields

    #region Methods

    public GameObject AddALine(Vector3 point1, Vector3 point2, Vector3 cameraPos)
    {
        LineData lineData = new LineData(point1, point2);
        lineData.scale = Vector3.Distance((point1 + point2) / 2, cameraPos) * scaleFactor;
        return AddALine(lineData);
    }