Esempio n. 1
0
        private void FillDataGrid(List <Point> newPl = null, bool alert = false, bool fillZ = false)
        {
            //RiverSimulationProfile p = RiverSimulationProfile.profile;
            var rg = p.inputGrid;

            //int type = 0, count = 0;
//            StructureSetUtility.CalcTypeCount(selIndex, ref type, ref count, typeIndex);
            int index = selCombo.SelectedIndex;
            int type = 0, count = 0;

            GetTypeAndCount(index, ref type, ref count);

            Point pt = new Point();

            for (int i = 0; i < rg.GetI; ++i)
            {
                for (int j = 0; j < rg.GetJ; ++j)
                {
                    pt.X = i;
                    pt.Y = j;
                    Point grpId  = SideFlowtUtility.WhichGroup(sideOutObjects, sideInObjects, pt);
                    int   nameId = grpId.X * (sideOutObjects == null ? 0 : sideOutObjects.Length) + grpId.Y;
                    Color cr;
                    if (grpId.X == -1 && grpId.Y == -1)
                    {   //空白處
                        cr = Color.White;
                        if (fillZ)
                        {
                            dataGv[j, i].Value    = p.inputGrid.inputCoor[i, j].z.ToString();
                            dataGv[j, i].ReadOnly = true;
                        }
                        else
                        {
                            dataGv[j, i].Value    = "";
                            dataGv[j, i].ReadOnly = true;
                        }
                    }
                    else if (grpId.X == type && grpId.Y == count)
                    {   //被選取的結構物
                        cr = (alert) ? alertColor : selectedColor;
                        if (fillZ)
                        {
                            dataGv[j, i].Value    = structureName[nameId];
                            dataGv[j, i].ReadOnly = false;
                        }
                        else
                        {
                            dataGv[j, i].Value    = structureName[nameId];
                            dataGv[j, i].ReadOnly = true;
                        }
                    }
                    else
                    {   //其他結構物
                        cr = colorTable[grpId.X % colorTable.Length];
                        if (fillZ)
                        {
                            dataGv[j, i].Value    = structureName[nameId];
                            dataGv[j, i].ReadOnly = false;
                        }
                        else
                        {
                            dataGv[j, i].Value    = structureName[nameId];
                            dataGv[j, i].ReadOnly = true;
                        }
                    }

                    dataGv[j, i].Style.BackColor = cr;
                }
            }
        }