示例#1
0
        public void DisplayAllClusters(bool compute = true, bool updateKeys = true)
        {
            var modelGroup = new Model3DGroup();

            if (compute)
            {
                BatchDesign.GenerateLoadsClustering();
            }
            List <List <MWPoint3D> > clusters = BatchDesign.Clusters;

            List <Color> colors = GetColors();

            for (int i = 0; i < clusters.Count; i++)
            {
                var pointMesh = new MeshBuilder(false, true);
                foreach (var p in clusters[i])
                {
                    Point3D center = new Point3D(10 * p.X / batchDesign.MaxMx, 10 * p.Y / batchDesign.MaxMy, 10 * p.Z / batchDesign.MaxP);
                    pointMesh.AddSphere(center, radius: 0.05, thetaDiv: 8, phiDiv: 4);
                }
                var mesh0 = new GeometryModel3D(pointMesh.ToMesh(), MaterialHelper.CreateMaterial(colors[i]));
                mesh0.BackMaterial = mesh0.Material;
                modelGroup.Children.Add(mesh0);
            }

            LoadsCloud = modelGroup;
            DisplayAllColumnsClusters(updateKeys);
        }
示例#2
0
        public void DisplayOneDesignCluster(int n)
        {
            //BatchDesign.GetDesignClusters();
            var modelGroup = new Model3DGroup();
            List <List <Column> > designClusters = BatchDesign.GetDesignClustersCol();

            for (int i = 0; i < designClusters.Count; i++)
            {
                MeshBuilder   meshBuilder = new MeshBuilder(false, true);
                List <Column> columns     = designClusters[i];
                foreach (var c in columns)
                {
                    Point3D center  = new Point3D(c.Point1.X * 1e-3, c.Point1.Y * 1e-3, c.Point1.Z * 1e-3);
                    double  xlength = 0.2;
                    double  ylength = 0.2;
                    double  zlength = (c.Point2.Z - c.Point1.Z) * 1e-3;
                    meshBuilder.AddBox(center, xlength, ylength, zlength);
                }
                Color col  = i == n ? myColors[i].ChangeAlpha(150) : myColors[i].ChangeAlpha(20);
                var   mesh = new GeometryModel3D(meshBuilder.ToMesh(), MaterialHelper.CreateMaterial(col));
                mesh.BackMaterial = mesh.Material;
                modelGroup.Children.Add(mesh);
            }
            ClusteredDesigns        = modelGroup;
            NumberOfColumns_Designs = designClusters[n].Count;
        }
示例#3
0
        public void DisplayDesignClustersKeys()
        {
            // update keys
            designKeys = new List <DesignKey>();
            List <List <Column> > designClusters = BatchDesign.GetDesignClustersCol();

            for (int i = 0; i < designClusters.Count; i++)
            {
                string name = "Unnamed";
                if (designClusters[i][0].LX != 0)
                {
                    name = designClusters[i][0].LX + " x " + designClusters[i][0].LY;
                }
                else
                {
                    name = "D" + designClusters[i][0].Diameter;
                }
                designKeys.Add(new DesignKey()
                {
                    Label = name,
                    Color = new SolidColorBrush(myColors[i]),
                    Index = i,
                });
            }
            RaisePropertyChanged(nameof(DesignKeys));
        }
示例#4
0
        public void DisplayDesignClusters(bool updateKeys = true, bool generate = true)
        {
            if (generate)
            {
                BatchDesign.GetDesignClusters();
            }
            var modelGroup = new Model3DGroup();
            List <List <Column> > designClusters = BatchDesign.GetDesignClustersCol();

            for (int i = 0; i < designClusters.Count; i++)
            {
                MeshBuilder   meshBuilder = new MeshBuilder(false, true);
                List <Column> columns     = designClusters[i];
                foreach (var c in columns)
                {
                    Point3D center  = new Point3D(c.Point1.X * 1e-3, c.Point1.Y * 1e-3, c.Point1.Z * 1e-3);
                    double  xlength = 0.2;
                    double  ylength = 0.2;
                    double  zlength = (c.Point2.Z - c.Point1.Z) * 1e-3;
                    meshBuilder.AddBox(center, xlength, ylength, zlength);
                }
                var mesh = new GeometryModel3D(meshBuilder.ToMesh(), MaterialHelper.CreateMaterial(myColors[i].ChangeAlpha(150)));
                mesh.BackMaterial = mesh.Material;
                modelGroup.Children.Add(mesh);
            }
            ClusteredDesigns = modelGroup;

            if (updateKeys)
            {
                DisplayDesignClustersKeys();
            }
            NumberOfColumns_Designs = designClusters.Sum(c => c.Count);
        }