View Full Version : Like Matlab
Colx007
12th November 2007, 18:56
In matlab there are several funtions for graphics like plot(x,y) and plot3d(x,y,z). Are there funtions to plot 3d lake surfices and maps? or someones can help me to make that funtion .
thank you very much.
jacek
13th November 2007, 00:49
Try these:
http://qwt.sourceforge.net/
http://qwtplot3d.sourceforge.net/
csvivek
21st April 2008, 06:27
Hi,
I need to display raster maps in my application, i am using Qt 4.2.2.
Can you suggest how this can be done?
Looking forward to your response
Uwe
21st April 2008, 06:52
Qwt can display raster data as spectrogram and/or as contour lines.
See its screenshots (http://qwt.sourceforge.net/spectrogramscreenshots.html).
Uwe
csvivek
21st April 2008, 07:30
Hi,
I am a newbie to Qt.
I have the following requirements,
1. Support multiple layers
2. Display raster data in one layer (dted elevation data files)
3. ability to control the opacity of layers.
I have downloaded and installed Qwt.
Can you help me out, in adding layers and to get the raster data displayed in one layer.
Looking forward to your response:)
Uwe
22nd April 2008, 06:41
With Qwt you would use a QwtPlotSpectrogram object for each type of raster data.
1. Support multiple layers
Use the z value to control the layer stack and hide/show the spectrogram items according to your layer control.
2. Display raster data in one layer (dted elevation data files)
You need to connect your data to QwtPlotSpectrogram using a QwtRasterData object.
3. ability to control the opacity of layers.
spectrogram->setAlpha(alpha); // [ 0-255]
Uwe
csvivek
22nd April 2008, 07:05
How do i open the DTED file(which is a grid of elevation values) with QwtRasterData class?
Does QwtRasterData class use GDAL libraries to open raster maps?
csvivek
22nd April 2008, 07:07
Sorry for having used two different threads for same topic....:(
Can you share a sample code which would do the display of a sample elevation data?
csvivek
22nd April 2008, 07:15
I have opened the file using GDAL using the snippet of code given below,
The data is finally stored in the variable "eledata"
{GDALAllRegister();
/*---------------------------------------
* Open Dataset and get raster band (assuming it is band #1)
*/
poDataset = (GDALDataset *) GDALOpen( pszFilename, GA_ReadOnly );
if( poDataset == NULL )
{
printf( "Couldn't open dataset %s\n",
pszFilename );
}
GDALRasterBand *poBand;
poBand = poDataset->GetRasterBand( 1 );
poDataset->GetGeoTransform( adfGeoTransform );
/* -------------------------------------
* Get variables from input dataset
*/
const double nsres = adfGeoTransform[5];
const double ewres = adfGeoTransform[1];
const float nullValue = (float) poBand->GetNoDataValue( );
const int nXSize = poBand->GetXSize();
const int nYSize = poBand->GetYSize();
int flag = 0;
shadeBuf = (float *) CPLMalloc(sizeof(float)*nXSize);
eledata = (float *) CPLMalloc(sizeof(float)*nXSize*nYSize);
xcor = adfGeoTransform[0];
ycor = adfGeoTransform[3];
printf("the initial x : %f\n, the initial y : %f\n", xcor, ycor);
printf("North South Pixel resolution : %d\nEast West Pixel resolution : %d\n", nXSize, nYSize);
printf("Number of bands in raster :%d\n",poDataset->GetRasterCount());
poBand->RasterIO( GF_Read, 0, 0, nXSize, nYSize,
eledata, nXSize, nYSize, GDT_Float32,
0, 0 );
}
How do i proceed to display this data using QwtRasterData class?
The elevation values ranges from -9000 to 10000 meters and i need to display these as gray scale values or provide suitable RGB mapping for the same.
Looking forward to your response :)
Uwe
22nd April 2008, 21:42
How do i proceed to display this data using QwtRasterData class?
I already told you the 4 methods you need to implement.
The elevation values ranges from -9000 to 10000 meters and i need to display these as gray scale values or provide suitable RGB mapping for the same.
Then YourElevationData::range() should return [-9000, 10000]. Next have a look at QwtColorMap and friends.
What about looking at the docs ?
Uwe
csvivek
23rd April 2008, 06:07
Thanks for the info :)
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.