Results 1 to 11 of 11

Thread: Like Matlab

  1. #1
    Join Date
    Oct 2007
    Location
    Caracas - Venezuela
    Posts
    27
    Thanks
    6
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Red face Like Matlab

    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.
    Colombo C. Da Encarnaçao Q.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

  3. The following user says thank you to jacek for this useful post:

    Colx007 (14th November 2007)

  4. #3
    Join Date
    Mar 2008
    Posts
    68
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Like Matlab

    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

  5. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,311
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Like Matlab

    Qwt can display raster data as spectrogram and/or as contour lines.
    See its screenshots.

    Uwe

  6. #5
    Join Date
    Mar 2008
    Posts
    68
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Like Matlab

    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

  7. #6
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,311
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Like Matlab

    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

  8. #7
    Join Date
    Mar 2008
    Posts
    68
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Like Matlab

    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?

  9. #8
    Join Date
    Mar 2008
    Posts
    68
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Like Matlab

    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?

  10. #9
    Join Date
    Mar 2008
    Posts
    68
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Like Matlab

    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

  11. #10
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,311
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Like Matlab

    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

  12. #11
    Join Date
    Mar 2008
    Posts
    68
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Like Matlab

    Thanks for the info

Similar Threads

  1. Introducing ChainLink: Matlab-style GUI for Qt4 developers
    By magland in forum Qt-based Software
    Replies: 9
    Last Post: 19th December 2007, 04:56
  2. C mex in MATLAB and the commenting
    By Masih in forum General Programming
    Replies: 1
    Last Post: 22nd August 2007, 22:06

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.