Ejemplo n.º 1
0
        public DVRSpherical(string varName, FieldModel.MeteorDataProvider mdProvider, Bitmap bitmap, int col, int row, float modelH, float exgg, Point pLeft, Point pRight)
            : base(varName, mdProvider, bitmap, col, row, modelH, exgg, pLeft, pRight)
        {
            if (_bricks != null)
            {
                _bricks.Clear();
            }
            else
            {
                _bricks = new List <VolumeBrick>();
            }

            _varName    = varName;
            _mdProvider = mdProvider;
            nTime       = mdProvider.meteorMetaData.nTime;
            nLevel      = mdProvider.meteorMetaData.nLevel;
            nRow        = mdProvider.meteorMetaData.nRow;
            nCol        = mdProvider.meteorMetaData.nColumn;
            _vectorA    = new float[nRow * nCol * nLevel];
            _cacheArr   = new float[nRow * nCol * nLevel];

            _mdProvider.GetData(_mdProvider.ConfigPath, varName, FieldModel.TimeController.Instance.TimeNumber);
            _mdProvider.meteorData.varList[0].CopyTo(_vectorA, 0);

            uvw = new float[nLevel, nRow, nCol];
            int idx = 0;

            for (int l = 0; l < nLevel; l++)
            {
                for (int r = 0; r < nRow; r++)
                {
                    for (int c = 0; c < nCol; c++)
                    {
                        uvw[l, r, c] = _vectorA[idx];
                        idx++;
                    }
                }
            }

            float latOri, lonOri, intervalLat, intervalLon;

            lonOri      = (float)_mdProvider.meteorMetaData.lons[0].Degrees;
            latOri      = (float)_mdProvider.meteorMetaData.lats[0].Degrees;
            intervalLon = (float)(_mdProvider.meteorMetaData.lons[1].Degrees - _mdProvider.meteorMetaData.lons[0].Degrees);
            intervalLat = (float)(_mdProvider.meteorMetaData.lats[1].Degrees - _mdProvider.meteorMetaData.lats[0].Degrees);
            _bricks.Add(new VolumeBrick(this, lonOri, latOri, modelH, intervalLon, intervalLat, exgg, 0, 0, 429, 267, nLevel));
        }
Ejemplo n.º 2
0
        public DVRTextured3D(string varName, FieldModel.MeteorDataProvider mdProvider, Bitmap bitmap, int col, int row, float modelH, float exgg, Point pLeft, Point pRight)
        {
            _varName     = varName;
            _transferMap = ImageHelper.LoadTexture(bitmap, System.Drawing.Imaging.ImageFormat.Png);
            if (_varName == "UVW")
            {
                isVector = true;
            }
            else
            {
                isVector = false;
            }
            _mdProvider = mdProvider;
            _blockRow   = row;
            _blockColum = col;
            nTime       = mdProvider.meteorMetaData.nTime;
            nLevel      = mdProvider.meteorMetaData.nLevel;
            nRow        = mdProvider.meteorMetaData.nRow;
            nCol        = mdProvider.meteorMetaData.nColumn;
            if (isVector)
            {
                _vectorB   = new Vector3[nRow * nCol * nLevel];
                _cacheBArr = new Vector3[nRow * nCol * nLevel];
            }
            else
            {
                _vectorA  = new float[nRow * nCol * nLevel];
                _cacheArr = new float[nRow * nCol * nLevel];
            }

            _mdProvider.GetData(_mdProvider.ConfigPath, varName, FieldModel.TimeController.Instance.TimeNumber);
            if (isVector)
            {
                _mdProvider.meteorData.mergeList[0].CopyTo(_vectorB, 0);
                maxValue = 0.0f;
                for (int i = 0; i < _vectorB.Length; i++)
                {
                    if (_vectorB[i].Length() < 10000000 && _vectorB[i].Length() > maxValue)
                    {
                        maxValue = _vectorB[i].Length();
                    }
                }

                minValue = maxValue;
                for (int i = 0; i < _vectorB.Length; i++)
                {
                    if (_vectorB[i].Length() < minValue)
                    {
                        minValue = _vectorB[i].Length();
                    }
                }
            }
            else
            {
                _mdProvider.meteorData.varList[0].CopyTo(_vectorA, 0);
                maxValue = 0.0f;
                for (int i = 0; i < _vectorA.Length; i++)
                {
                    if (_vectorA[i] < 10000000 && _vectorA[i] > maxValue)
                    {
                        maxValue = _vectorA[i];
                    }
                }

                minValue = maxValue;
                for (int i = 0; i < _vectorA.Length; i++)
                {
                    if (_vectorA[i] < minValue)
                    {
                        minValue = _vectorA[i];
                    }
                }
            }

            uvw = new float[nLevel, nRow, nCol];
            int idx = 0;

            if (isVector)
            {
                for (int l = 0; l < nLevel; l++)
                {
                    for (int r = 0; r < nRow; r++)
                    {
                        for (int c = 0; c < nCol; c++)
                        {
                            uvw[l, r, c] = _vectorB[idx].Length();
                            idx++;
                        }
                    }
                }
            }
            else
            {
                for (int l = 0; l < nLevel; l++)
                {
                    for (int r = 0; r < nRow; r++)
                    {
                        for (int c = 0; c < nCol; c++)
                        {
                            uvw[l, r, c] = _vectorA[idx];
                            idx++;
                        }
                    }
                }
            }

            float latOri, lonOri, intervalLat, intervalLon;

            lonOri      = (float)_mdProvider.meteorMetaData.lons[0].Degrees;
            latOri      = (float)_mdProvider.meteorMetaData.lats[0].Degrees;
            intervalLon = (float)(_mdProvider.meteorMetaData.lons[1].Degrees - _mdProvider.meteorMetaData.lons[0].Degrees);
            intervalLat = (float)(_mdProvider.meteorMetaData.lats[1].Degrees - _mdProvider.meteorMetaData.lats[0].Degrees);

            int colStep = (pRight.X - pLeft.X) / _blockColum;
            int rowStep = (pRight.Y - pLeft.Y) / _blockRow;

            //修改模式
            try
            {
                for (int i = 0; i < _blockRow; i++)
                {
                    for (int j = 0; j < _blockColum; j++)
                    {
                        _bricks.Add(new VolumeBrick(this, lonOri, latOri, modelH, intervalLon, intervalLat, exgg, pLeft.X + j * colStep, pLeft.Y + i * rowStep, colStep, rowStep, nLevel));
                    }
                }
            }
            catch (Exception EX)
            { }

            FieldModel.TimeController.Instance.TimeCount = nTime;

            this.Initialize(DrawArgs.Instance);
        }