RasterSymbologyWidgets.cpp
Go to the documentation of this file.
1 #include "SymbologyWidgets.h"
2 
3 // TerraLib
4 #include "../../Config.h"
6 #include <terralib/raster.h>
7 #include <terralib/dataaccess.h>
8 #include <terralib/datatype.h>
9 #include <terralib/se.h>
10 
11 // Qt
12 #include <QApplication>
13 
15 {
16  int argc = 1;
17  QApplication app(argc, 0);
18 
19  // set input raster name
20  std::string rinfo ("file://");
21 
22  std::string data_dir = TERRALIB_DATA_DIR;
23 
24  //std::string filename(data_dir + '/shp/SP_cities.shp");
25 
26  std::string filename(data_dir + "/Nulos/nulos2.shp");
27 
28  rinfo += data_dir + "/geotiff/cbers2b_rgb342_crop.tif";
29 
30 // open input raster
31  std::unique_ptr<te::da::DataSource> ds = te::da::DataSourceFactory::make("GDAL", rinfo);
32  ds->open();
33 
34  std::unique_ptr<te::da::DataSourceTransactor> tr = ds->getTransactor();
35  std::unique_ptr<te::da::DataSetType> dt = tr->getDataSetType("cbers2b_rgb342_crop.tif");
36  te::rst::RasterProperty* rstp = static_cast<te::rst::RasterProperty*>(dt->getProperties()[0]->clone());
37 
38  std::unique_ptr<te::da::DataSet> dataSet = tr->getDataSet("cbers2b_rgb342_crop.tif");
39 
40  std::size_t rpos = te::da::GetFirstPropertyPos(dataSet.get(), te::dt::RASTER_TYPE);
41  std::unique_ptr<te::rst::Raster> raster = dataSet->getRaster(rpos);
42 
44 
45  // Creates the rastersymbolizer dialog
47 
48  dlg.setRasterProperty(raster.get(), rstp);
49 
50  if(dlg.exec() == QDialog::Accepted)
51  {
52  rs = static_cast<te::se::RasterSymbolizer*>(dlg.getRasterSymbolizer());
53  }
54 
55 }
This file contains include headers for the Data Type module of TerraLib.
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
A dialog used to build a RasterSymbolizerDialog element.
Several examples declarations.
This file contains include headers for TerraLib Symbology Encoding module.
static te::dt::Date ds(2010, 01, 01)
Raster property.
static te::dt::TimeDuration dt(20, 30, 50, 11)
void RasterSymbologyWidgets()
It shows a set of widgets related with Raster Symbology Encondig.
The RasterSymbolizer describes how to render raster/matrix-coverage data (e.g., satellite photos...
te::se::Symbolizer * getRasterSymbolizer() const
void setRasterProperty(te::rst::Raster *r, te::rst::RasterProperty *p)
Sets the raster information.
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
This file contains include headers for the Data Access module of TerraLib.