create-prj.patch
src/analysis/interpolation/qgsgridfilewriter.cpp | ||
---|---|---|
17 | 17 | |
18 | 18 |
#include "qgsgridfilewriter.h" |
19 | 19 |
#include "qgsinterpolator.h" |
20 |
#include "qgsvectorlayer.h" |
|
20 | 21 |
#include <QFile> |
22 |
#include <QFileInfo> |
|
21 | 23 |
#include <QProgressDialog> |
22 | 24 | |
23 | 25 |
QgsGridFileWriter::QgsGridFileWriter( QgsInterpolator* i, QString outputPath, QgsRectangle extent, int nCols, int nRows , double cellSizeX, double cellSizeY ) |
... | ... | |
96 | 98 |
} |
97 | 99 |
} |
98 | 100 | |
101 |
// create prj file |
|
102 |
QgsInterpolator::LayerData ld; |
|
103 |
ld = mInterpolator->mLayerData.first(); |
|
104 |
QgsVectorLayer* vl = ld.vectorLayer; |
|
105 |
QString crs = vl->crs().toWkt(); |
|
106 |
QFileInfo fi( mOutputFilePath ); |
|
107 |
QString fileName = fi.absolutePath() + "/" + fi.completeBaseName() + ".prj"; |
|
108 |
QFile prjFile( fileName ); |
|
109 |
if ( !prjFile.open( QFile::WriteOnly ) ) |
|
110 |
{ |
|
111 |
return 1; |
|
112 |
} |
|
113 |
QTextStream prjStream( &prjFile ); |
|
114 |
prjStream << crs; |
|
115 |
prjStream << endl; |
|
116 |
prjFile.close(); |
|
117 | ||
99 | 118 |
delete progressDialog; |
100 | 119 |
return 0; |
101 | 120 |
} |
src/analysis/interpolation/qgsinterpolator.h | ||
---|---|---|
90 | 90 |
@return 0 in case of success*/ |
91 | 91 |
int addVerticesToCache( QgsGeometry* geom, bool zCoord, double attributeValue ); |
92 | 92 | |
93 | ||
93 |
friend class QgsGridFileWriter; |
|
94 | 94 |
}; |
95 | 95 | |
96 | 96 |
#endif |