Beispiel #1
0
        Point GetAuxPoint(IniFile.Section section, int index)
        {
            var x = section.ReadDouble("AuxPoints(" + index.ToString() + ").X");
            var y = section.ReadDouble("AuxPoints(" + index.ToString() + ").Y");

            return(new Point(x, y));
        }
Beispiel #2
0
        void ProcessPoint(IniFile.Section section)
        {
            var type         = section.ReadInt("Type");
            var parentFigure = section["ParentFigure"];

            if (!parentFigure.IsEmpty())
            {
                EnsureSectionProcessed("Figure" + parentFigure);
                return;
            }

            if (type == 8)
            {
                FindAndProcessArcWithPoint(section.GetTitleNumber("Point"));
                return;
            }

            if (type == 9)
            {
                FindAndProcessMidPoint(section.GetTitleNumber("Point"));
                return;
            }

            var x     = section.ReadDouble("X");
            var y     = section.ReadDouble("Y");
            var point = Factory.CreateFreePoint(drawing, new Point(x, y));

            point.Name = section["Name"];
            SetPointStyle(section, point);
            Actions.Actions.Add(drawing, point);
            var pointIndex = section.GetTitleNumber("Point");

            points[pointIndex] = point;
        }
Beispiel #3
0
        void ProcessButton(IniFile.Section section)
        {
            var type = section.ReadInt("Type");

            if (type != 0)
            {
                return;
            }

            var button = new ShowHideControl();

            button.Drawing            = drawing;
            button.Checkbox.IsChecked = section.ReadBool("InitiallyVisible", false);
            button.AddDependencies(GetPointList(section));
            button.MoveTo(section.ReadDouble("X"), section.ReadDouble("Y"));
            SetButtonStyle(section, button);
            Actions.Actions.Add(drawing, button);

            var text = section["Caption"].Replace("~~", Environment.NewLine);

            if (section["Charset"] == "0")
            {
                text = text.Replace('I', '²');
            }

            button.Checkbox.Content = text;

            ReadButtonDependencies(section, button);

            button.UpdateFigureVisibility();
            buttons[section.GetTitleNumber("Button")] = button;
        }
Beispiel #4
0
        void ReadAnalyticCircle(IniFile.Section section)
        {
            var a = section.ReadDouble("AuxInfo(1)");
            var b = section.ReadDouble("AuxInfo(2)");
            var c = section.ReadDouble("AuxInfo(3)");

            var x = -a / 2;
            var y = -b / 2;
            var r = (a * a / 4 + b * b / 4 - c).SquareRoot();

            var figure = Factory.CreateCircleByEquation(
                drawing,
                x.ToStringInvariant(),
                y.ToStringInvariant(),
                r.ToStringInvariant());

            SetFigureStyle(section, figure);
            AddFigure(section, figure);
        }
Beispiel #5
0
        void ProcessLabel(IniFile.Section section)
        {
            var label = Factory.CreateLabel(drawing);

            label.MoveTo(section.ReadDouble("X"), section.ReadDouble("Y"));
            SetLabelStyle(section, label);
            Actions.Actions.Add(drawing, label);
            labels[section.GetTitleNumber("Label")] = label;
            var text = section["Caption"].Replace("~~", Environment.NewLine);

            if (section["Charset"] == "0")
            {
                text = text.Replace('І', '²');
            }
#if !PLAYER
            drawing.ActionManager.SetProperty(label, "Text", text);
#else
            label.Text = text;
#endif
        }
Beispiel #6
0
        void SetPointStyle(IniFile.Section section, IFigure figure)
        {
            figure.Visible = !section.ReadBool("Hide", false) && section.ReadBool("Visible", true);

            var fillColor     = section.ReadColor("FillColor");
            var fillStyle     = section.ReadInt("FillStyle");
            var foreColor     = section.ReadColor("ForeColor");
            var physicalWidth = section.ReadDouble("PhysicalWidth");

            if (fillStyle == 1)
            {
                fillColor = Colors.Transparent;
            }

            var pointStyle = new PointStyle()
            {
                Fill        = new SolidColorBrush(fillColor),
                Color       = foreColor,
                Size        = physicalWidth,
                StrokeWidth = 0.7
            };

            figure.Style = drawing.StyleManager.FindExistingOrAddNew(pointStyle);
        }
Beispiel #7
0
 double GetAuxInfo(IniFile.Section section, int index)
 {
     return(section.ReadDouble("AuxInfo(" + index.ToString() + ")"));
 }