Esempio n. 1
0
        public void AddLoadedChartLines(Dictionary <string, DataToSerialize> symbolsDrawingsToSerialize, string name)
        {
            // add loaded chart lines
            foreach (var data in symbolsDrawingsToSerialize)
            {
                if (data.Key == name)
                {
                    // found drawing for symbol
                    foreach (var line in data.Value.chartLines)
                    {
                        ChartLine lineToAdd = new ChartLine(this);

                        // Create and add new points
                        lineToAdd.setP1(Misc.LineStringToPoint(drawingInfo, line.StartPointDV));
                        lineToAdd.setP2(Misc.LineStringToPoint(drawingInfo, line.EndPointDV));

                        lineToAdd.color           = Misc.StringToBrush(line.Color);
                        lineToAdd.linePath.Stroke = lineToAdd.color;

                        // default layer is L1
                        lineToAdd.layerData = line.Data;
                        if (line.Data == null)
                        {
                            lineToAdd.layerData = "L1";
                        }
                        if (line.Data == "")
                        {
                            lineToAdd.layerData = "L1";
                        }
                        if (lineToAdd.layerData.Contains("L1") == false)
                        {
                            lineToAdd.linePath.Visibility = Visibility.Hidden;
                        }

                        lineToAdd.mode        = ChartLine.Mode.Normal;
                        lineToAdd.drawingMode = ChartLine.DrawingMode.Invalid;
                        lineToAdd.Select(false);

                        chartLines.Add(lineToAdd);
                        canvas.Children.Add(lineToAdd.linePath);
                        canvas.Children.Add(lineToAdd.rectPath);

                        lineToAdd.MoveP1(lineToAdd.getP1());
                        lineToAdd.MoveP2(lineToAdd.getP2());
                    }
                    break;
                }
            }
        }
Esempio n. 2
0
 public void MoveControlPoint(ChartLine line, Point mousePosition, bool resize)
 {
     if (line.drawingMode == DrawingMode.P1)
     {
         line.MoveP1(mousePosition, resize);
     }
     else if (line.drawingMode == DrawingMode.P2)
     {
         line.MoveP2(mousePosition, resize);
     }
     else if (line.drawingMode == DrawingMode.Mid)
     {
         line.MoveMid(mousePosition);
     }
 }