Ejemplo 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();
        }