Esempio n. 1
0
        private void OnGridPropertyChanged(object sender, EventArgs e)
        {
            GridderSource source = this.sim3D.Tag as GridderSource;

            if (source == null)
            {
                return;
            }

            List <SimLabGrid> gridders = this.sim3D.Scene.SceneContainer.Traverse <SimLabGrid>().ToList <SimLabGrid>();

            if (gridders.Count <= 0)
            {
                return;
            }

            SimLabGrid grid = gridders[0];

            GridProperty prop = this.CurrentProperty;

            if (prop == null)
            {
                return;
            }
            float minValue = prop.MinValue;
            float maxValue = prop.MaxValue;
            float step     = (maxValue - minValue) / 10.0f;

            if (step <= 0.0f)
            {
                step = 1.0f;
            }

            this.sim3D.SetColorIndicator(minValue, maxValue, step);
            TexCoordBuffer textureCoordinates = source.CreateTextureCoordinates(prop.GridIndexes, prop.Values, minValue, maxValue);

            grid.SetTextureCoods(textureCoordinates);

            DynamicUnstructureGrid           dynamicUnstructureGrid          = gridders[0] as DynamicUnstructureGrid;
            DynamicUnstructuredGridderSource dynamicUnstructureGridderSource = source as DynamicUnstructuredGridderSource;

            if (dynamicUnstructureGrid != null && dynamicUnstructureGridderSource != null)
            {
                TexCoordBuffer anotherTextureCoordinates = dynamicUnstructureGridderSource.CreateFractureTextureCoordinates(prop.GridIndexes, prop.Values, minValue, maxValue);
                dynamicUnstructureGrid.SetFractionTextureCoords(anotherTextureCoordinates);
            }

            this.sim3D.Invalidate();
        }
        /// <summary>
        /// 应用切片分析
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSlicesApply_Click(object sender, EventArgs e)
        {
            GridProperty prop = this.CurrentProperty;

            if (prop == null)
            {
                return;
            }


            HexahedronGridderSource source = this.CurrentHexahedronGrid;

            if (source == null)
            {
                return;
            }

            List <SimLabGrid> gridders = this.sim3D.Scene.SceneContainer.Traverse <SimLabGrid>().ToList <SimLabGrid>();

            if (gridders.Count <= 0)
            {
                return;
            }

            SimLabGrid gridder = gridders[0];
            List <int> islices = this.GetSelectedSlices(this.lbxNI);
            List <int> jslices = this.GetSelectedSlices(this.lbxNJ);
            List <int> kslices = this.GetSelectedSlices(this.lbxNZ);

            source.IBlocks = islices;
            source.JBlocks = jslices;
            source.KBlocks = kslices;
            source.RefreashSlices();
            float          minValue           = this.sim3D.uiColorIndicator.Data.MinValue;
            float          maxValue           = this.sim3D.uiColorIndicator.Data.MaxValue;
            TexCoordBuffer textureCoordinates = source.CreateTextureCoordinates(prop.GridIndexes, prop.Values, minValue, maxValue);

            gridder.SetTextureCoods(textureCoordinates);

            this.sim3D.Invalidate();
        }