fix image rotate

Apr 20, 2012 at 6:04 AM

Sample.cs should be fixed to  correct for bit map  X, Y coordinate.

 

private void DrawImage()

        {

            if (_mDem != null)

            {

                var bitmap = new Bitmap( _mDem.ARecord.eastings_cols,_mDem.ARecord.northings_rows);

 

                for (int col = 0; col < _mDem.ARecord.eastings_cols; col++)

                {

                    for (int row = 0; row < _mDem.ARecord.northings_rows; row++)

                    {

                        double height = _mDem.BRecord.elevations[col, row] * _mDem.ARecord.xyz_resolution[2];

                        var min = _mDem.ARecord.elevation_min;

                        var max = _mDem.ARecord.elevation_max;

                        if (height >= min)

                        {

                            double tempra = (height - min) / (max - min);

                            int ratio = (int)(Math.Sqrt( tempra)* 255f);

                            bitmap.SetPixel(col, _mDem.ARecord.northings_rows-row-1, Color.FromArgb(128, 128, ratio));

                        }

                    }

                }

 

                _mPictureBox.Image = bitmap;

            }

        }

Coordinator
Apr 26, 2012 at 11:50 AM

Hi thanaphan4,

Thanks for the feedback.

I am unable to verify this at the moment, but I have added your correction as a comment in the latest sample.cs commit.