Exemplo n.º 1
0
        static App()
        {
            DocumentPath = "document.json";
            EditorPath   = "editor.json";
            WindowPath   = "window.json";

            ContainerFactory = new DefaultContainerFactory();

            if (Design.IsDesignMode)
            {
                StyleLibrary = ContainerFactory.CreateStyleLibrary();
                GroupLibrary = ContainerFactory.CreateGroupLibrary();
                ToolContext  = ContainerFactory.CreateToolContext();
                ToolContext.DocumentContainer.StyleLibrary = StyleLibrary;
                ToolContext.DocumentContainer.GroupLibrary = GroupLibrary;

                if (ToolContext is IEditorToolContext editorToolContext)
                {
                    editorToolContext.ContainerFactory = ContainerFactory;
                    editorToolContext.UseSkia();
                    editorToolContext.NewContainerView("View");

                    editorToolContext.CurrentDirectory = Directory.GetCurrentDirectory();
                    editorToolContext.AddFiles(editorToolContext.CurrentDirectory);
                }
            }
        }
Exemplo n.º 2
0
        public void LargeDataTest()
        {
            // Arrange
            var factory       = new DefaultContainerFactory <int>();
            int positionCount = 500;

            Type[]            types      = new Type[50];
            int[][]           points     = new int[types.Count()][];
            Container <int>[] containers = new Container <int> [1000];

            for (int i = 0; i < types.Length; ++i)
            {
                types[i] = typeof(MatrixXY <>);
            }

            for (int i = 0; i < points.Length; ++i)
            {
                points[i] = new int[positionCount];
                for (int j = 0; j < positionCount; ++j)
                {
                    points[i][j] = 0;
                }
            }
            for (int i = 0; i < containers.Length; ++i)
            {
                containers[i] = factory.Create(types, positionCount, points);
            }

            // Act
            ContainersCollection <int> containersCollection = new ContainersCollection <int>(containers);
        }
Exemplo n.º 3
0
        public void PositionXYZPointsCountTest()
        {
            //// Arrange
            var       factory       = new DefaultContainerFactory <int>();
            const int positionCount = 3;

            Type[] matricesSignatures = new Type[]
            {
                typeof(MatrixX <>),
                typeof(MatrixXY <>),
                typeof(MatrixXYZ <>),
                typeof(MatrixXY <>),
                typeof(MatrixXY <>),
                typeof(MatrixX <>),
                typeof(MatrixXYZ <>),
            };
            int[][] pointsCountForMatricesAndPositions = new int[][]
            {
                new int[] { 300, 2223, 15 },
                new int[] { 13, 0, 4 },
                new int[] { 5, 5, 5 },
                new int[] { 54, 823, 5 },
                new int[] { 428, 5, 1 },
                new int[] { 328, 2, 0 },
                new int[] { 5, 56, 5 }
            };

            Container <int> container = factory.Create(matricesSignatures, positionCount, pointsCountForMatricesAndPositions);

            //// Act
            ContainersCollection <int> containersCollection = new ContainersCollection <int>(container);
        }
Exemplo n.º 4
0
        static ContainersCollection <double> ExampleTwo()
        {
            var       factory       = new DefaultContainerFactory <double>();
            const int positionCount = 1;

            Type[] types = new Type[]
            {
                typeof(MatrixXY <>),
                typeof(MatrixXY <>),
                typeof(MatrixXY <>),
                typeof(MatrixXY <>),
                typeof(MatrixXY <>),
                typeof(MatrixX <>),
                typeof(MatrixX <>),
                typeof(MatrixX <>),
                typeof(MatrixX <>),
                typeof(MatrixX <>)
            };
            int[][] points = new int[types.Count()][];
            Container <double>[] containers = new Container <double> [10];

            for (int i = 0; i < points.Length; ++i)
            {
                points[i] = new int[] { 1 };
            }

            for (int i = 0; i < containers.Length; ++i)
            {
                containers[i] = factory.Create(types, positionCount, points);
            }

            return(new ContainersCollection <double>(containers));
        }
Exemplo n.º 5
0
        static ContainersCollection <decimal> ExampleOne()
        {
            var       factory       = new DefaultContainerFactory <decimal>();
            const int positionCount = 100;

            Type[] types = new Type[]
            {
                typeof(MatrixXY <>),
                typeof(MatrixX <>)
            };
            int[][] points = new int[types.Count()][];
            Container <decimal>[] containers = new Container <decimal> [3];

            points[0] =
                new int[] { 50, 200 }.Concat(
                Enumerable.Repeat(0, positionCount - 2)
                ).ToArray();
            points[1] =
                new int[] { 4, 7 }.Concat(
                Enumerable.Repeat(0, positionCount - 2)
                ).ToArray();


            for (int i = 0; i < containers.Length; ++i)
            {
                containers[i] = factory.Create(types, positionCount, points);
            }

            return(new ContainersCollection <decimal>(containers));
        }
Exemplo n.º 6
0
        public void PositionCountTest()
        {
            // Arrange
            var       factory       = new DefaultContainerFactory <int>();
            const int positionCount = 3;

            Type[] matricesSignatures = new Type[]
            {
                typeof(MatrixXYZ <>),
                typeof(MatrixX <>),
                typeof(MatrixXY <>),
            };
            int[][] pointsCountForMatricesAndPositions = new int[][]
            {
                new int[] { 5, 5, 5 },
                Enumerable.Repeat(4, 3).ToArray(),
                new int[] { 3, 2, 5 }
            };

            Container <int> container = factory.Create(matricesSignatures, positionCount, pointsCountForMatricesAndPositions);

            // Act
            ContainersCollection <int> containersCollection = new ContainersCollection <int>(container);
        }