Example #1
0
        public static ModelCube3D Load(string path)
        {
            var model = new ModelCube3D();

            model.Reset();

            if (!string.IsNullOrEmpty(path) && File.Exists(path))
            {
                var jsonContent = File.ReadAllText(path);

                if (!string.IsNullOrEmpty(jsonContent))
                {
                    model = JsonConvert.DeserializeObject <ModelCube3D>(jsonContent);
                }
            }

            return(model);
        }
Example #2
0
        public void Load(string path, float centerX, float centerY)
        {
            this.model = PLP3D.ModelCube3D.Load(path);

            foreach (var connection in model.LineConnections)
            {
                realLines.Add(
                    new Line
                {
                    Stroke          = System.Windows.Media.Brushes.Black,
                    X1              = centerX + model.Points[connection.Id1].X,
                    Y1              = centerY + model.Points[connection.Id1].Y * (-1),
                    X2              = centerX + model.Points[connection.Id2].X,
                    Y2              = centerY + model.Points[connection.Id2].Y * (-1),
                    StrokeThickness = 3,
                }
                    );
            }

            //rotating so the lines shown in the window update
            RotatingOnX(centerX, centerY, 0);
        }