Пример #1
0
        int UpdateElipsePosition(Node label, Ellipse2D ellipse, OCgp_Ax2 ax2)
        {
            label.Update <StringInterpreter>().Value = DisplayedShapeNames.Ellipse;
            FunctionInterpreter elipseFunction = label.Update <FunctionInterpreter>();

            elipseFunction.Name = "Ellipse";

            elipseFunction.BeginUpdate();
            // Create the data structure : Set the dimensions, position and name attributes
            elipseFunction.Dependency.Child(1).Geometry = GeomUtils.VertexToPnt(ellipse.GetEllipseCenter(), ax2);
            // Add the major radius
            elipseFunction.Dependency.Child(2).Real = ellipse.GetMajorRadius();
            // Add the minor radius
            elipseFunction.Dependency.Child(3).Real = ellipse.GetMinorRadius();
            // Add angle
            elipseFunction.Dependency.Child(4).Real = ellipse.GetAngle();

            if (elipseFunction.Execute() != 0)
            {
                // TODO: Handle the error
            }

            return(0);
        }
Пример #2
0
        int SetLabelPosition(OCgp_Ax2 ax2, Node L, double x1, double y1, double x2, double y2, double x3, double y3)
        {
            L.Update <StringInterpreter>().Value = DisplayedShapeNames.Rectangle;

            // Instanciate a TFunction_Function attribute connected to the current Rectangle driver
            // and attach it to the data structure as an attribute of the Rectangle Label

            FunctionInterpreter rectangleDriver = L.Update <FunctionInterpreter>();

            rectangleDriver.Name = "Rectangle";
            rectangleDriver.BeginUpdate();

            // Create the data structure : Set the dimensions, position and name attributes
            rectangleDriver.Dependency.Child(1).Geometry = GeomUtils.VertexToPnt(new OCGraphic2d_Vertex(x1, y1), ax2);
            rectangleDriver.Dependency.Child(2).Geometry = GeomUtils.VertexToPnt(new OCGraphic2d_Vertex(x2, y2), ax2);
            rectangleDriver.Dependency.Child(3).Geometry = GeomUtils.VertexToPnt(new OCGraphic2d_Vertex(x3, y3), ax2);


            if (rectangleDriver.Execute() != 0)
            {
                // TODO : handle the error
            }
            return(0);
        }