示例#1
0
        public InkDataModel CreateWill3Document()
        {
            IPathCollection paths = GetComponentInChildren <IPathCollection>();

            if (paths == null)
            {
                return(null);
            }

            InkDataModel will3Doc = new InkDataModel();

            PathGroupNode root = new PathGroupNode(Identifier.FromNewGuid());

            will3Doc.InkTree.Root = root;

            PathPointLayout layoutXYZS = new PathPointLayout(PathPoint.Property.X, PathPoint.Property.Y, PathPoint.Property.Z, PathPoint.Property.Size);

            List <System.Numerics.Vector3> brushPolyhedron = CreateDummyBrush();
            VectorBrush brush = new VectorBrush(Identifier.FromNewGuid(), brushPolyhedron);

            brush.RenderModeUri       = "will3://rendering//pen";
            brush.RenderingProperties = new RenderingProperties()
            {
                Red   = 0.0f,
                Green = 0.0f,
                Blue  = 0.0f,
                Alpha = 1.0f
            };

            will3Doc.Brushes.AddVectorBrush(brush);

            Style style = new Style(brush);

            int pathsCount = paths.GetPathsCount();

            for (int i = 0; i < pathsCount; i++)
            {
                Spline spline = new Spline();
                spline.Ts   = 0.0f;
                spline.Tf   = 1.0f;
                spline.Data = paths.GetPathAt(i);

                Wacom.Ink.Serialization.Model.Path will3Path = new Wacom.Ink.Serialization.Model.Path(Identifier.FromNewGuid(),
                                                                                                      spline, style, layoutXYZS, Identifier.Empty);

                PathNode pathNode = new PathNode(Identifier.FromNewGuid(), will3Path);

                root.Add(pathNode);
            }

            return(will3Doc);
        }
示例#2
0
        private void AddPathDrawable(string Name, IEnumerable <BasePathGroup> Groups, Color color, bool CanConnect = true)
        {
            //Create a connectable object to connect each point
            var renderablePathConnected = new RenderableConnectedPaths(color);

            if (Name == "Lap Path" || Name == "Gravity Path")
            {
                renderablePathConnected.Use4PointConnection = true;
            }

            if (CanConnect)
            {
                viewport.AddDrawable(renderablePathConnected);
            }

            //Load a node wrapper to the tree
            var pathNode = new PathCollectionNode(Name);

            treeView1.Nodes.Add(pathNode);

            int groupIndex = 0;

            foreach (var group in Groups)
            {
                if (CanConnect)
                {
                    renderablePathConnected.AddGroup(group);
                }

                var groupNode = new PathGroupNode($"{Name} Group{groupIndex++}");
                pathNode.Nodes.Add(groupNode);

                int pointIndex = 0;
                foreach (var path in group.PathPoints)
                {
                    var pontNode = new PathPointNode($"{Name} Point{pointIndex++}");
                    pontNode.PathPoint = path;
                    groupNode.Nodes.Add(pontNode);

                    path.OnPathMoved = OnPathMoved;
                    viewport.AddDrawable(path.RenderablePoint);
                }
            }
        }