mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-15 00:07:25 -05:00
More api cleanups
git-svn-id: http://svn.osgeo.org/qgis/trunk@9495 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
a896fee415
commit
1ca4f2365b
Binary file not shown.
@ -89,8 +89,8 @@ public:
|
||||
};
|
||||
|
||||
|
||||
/** WKT string that represents a geographic coord sys */
|
||||
const QString GEOWKT;
|
||||
/** Wkt string that represents a geographic coord sys */
|
||||
const QString GEOWkt;
|
||||
|
||||
/** PROJ4 string that represents a geographic coord sys */
|
||||
const QString GEOPROJ4;
|
||||
|
||||
@ -24,7 +24,7 @@ class QgsCoordinateReferenceSystem
|
||||
~QgsCoordinateReferenceSystem();
|
||||
|
||||
/*!
|
||||
* Constructs a CRS object from a WKT string
|
||||
* Constructs a CRS object from a Wkt string
|
||||
* @param theWkt A String containing a valid Wkt def
|
||||
*/
|
||||
explicit QgsCoordinateReferenceSystem(QString theWkt);
|
||||
@ -59,14 +59,14 @@ class QgsCoordinateReferenceSystem
|
||||
*/
|
||||
bool createFromSrid(const long theSrid);
|
||||
|
||||
/*! Set up this srs using a WKT spatial ref sys definition.
|
||||
/*! Set up this srs using a Wkt spatial ref sys definition.
|
||||
* The wkt will be converted to a proj4 string using OGR helper
|
||||
* functions. After this the srs databasses will be searched for matches.
|
||||
* First the system level read only srs.db will be checked
|
||||
* and then the users ~/.qgis/qgis.db database will be checked for a match.
|
||||
* @note Any members will be overwritten during this process.
|
||||
* @note SRID and EpsgCrsId may be blank if no match can be found on srs db.
|
||||
* @param theWkt The WKT for the desired spatial reference system.
|
||||
* @param theWkt The Wkt for the desired spatial reference system.
|
||||
* @return bool TRUE if sucess else false
|
||||
*/
|
||||
bool createFromWkt(const QString theWkt);
|
||||
@ -161,10 +161,6 @@ class QgsCoordinateReferenceSystem
|
||||
* is inconclusive.
|
||||
*/
|
||||
bool equals(QString theProj4String);
|
||||
/*! A helper to get an wkt representation of this srs
|
||||
* @return string containing Wkt of the srs
|
||||
*/
|
||||
QString toWkt() const;
|
||||
|
||||
/*! Restores state from the given Dom node.
|
||||
* @param theNode The node from which state will be restored
|
||||
@ -188,12 +184,6 @@ class QgsCoordinateReferenceSystem
|
||||
*/
|
||||
bool writeXML( QDomNode & theNode, QDomDocument & theDoc );
|
||||
|
||||
/** A static helper function to find out the proj4 string for a srsid
|
||||
* @param int theSrsId The srsid used for the lookup
|
||||
* @return QString The proj4 string
|
||||
*/
|
||||
static QString getProj4FromSrsId(const int theSrsId);
|
||||
|
||||
/** Sets custom function to force valid CRS
|
||||
* QGIS uses implementation in QgisGui::customSrsValidation
|
||||
*/
|
||||
@ -229,13 +219,17 @@ class QgsCoordinateReferenceSystem
|
||||
* @note A zero length string will be returned if the ellipsoidAcronym is uninitialised
|
||||
*/
|
||||
QString ellipsoidAcronym () const;
|
||||
/*! A helper to get an wkt representation of this srs
|
||||
* @return string containing Wkt of the srs
|
||||
*/
|
||||
QString toWkt() const;
|
||||
/** Get the Proj Proj4String. If proj and ellps keys are found in the parameters,
|
||||
* they will be stripped out and the Projection and ellipsoid acronyms will be
|
||||
* overridden with these.
|
||||
* @return QString theProj4String Proj4 format specifies that define this srs.
|
||||
* @note A zero length string will be returned if the proj4String is uninitialised
|
||||
* @note A zero length string will be returned if the toProj4 is uninitialised
|
||||
*/
|
||||
QString proj4String() const;
|
||||
QString toProj4() const;
|
||||
/*! Get this Geographic? flag
|
||||
* @return bool theGeoFlag Whether this is a geographic or projected coordinate system
|
||||
*/
|
||||
|
||||
@ -35,20 +35,20 @@ class QgsCoordinateTransform : QObject
|
||||
/*!
|
||||
* Constructs a QgsCoordinateTransform using the Well Known Text representation
|
||||
* of the layer and map canvas coordinate systems
|
||||
* @param theSourceWKT WKT, typically of the layer's coordinate system
|
||||
* @param theDestWKT WKT, typically of the map canvas coordinate system
|
||||
* @param theSourceWkt Wkt, typically of the layer's coordinate system
|
||||
* @param theDestWkt Wkt, typically of the map canvas coordinate system
|
||||
*/
|
||||
QgsCoordinateTransform(QString theSourceWKT, QString theDestWKT );
|
||||
QgsCoordinateTransform(QString theSourceWkt, QString theDestWkt );
|
||||
|
||||
/*!
|
||||
* Constructs a QgsCoordinateTransform using a Spatial Reference Id
|
||||
* of the layer and map canvas coordinate system as Wkt
|
||||
* @param theSourceSrid Spatial Ref Id of the layer's coordinate system
|
||||
* @param theSourceWKT WKT of the map canvas coordinate system
|
||||
* @param theSourceWkt Wkt of the map canvas coordinate system
|
||||
* @param theSourceCRSType On of the enum members defined in QgsCoordinateReferenceSystem::CrsType
|
||||
*/
|
||||
QgsCoordinateTransform(long theSourceSrid,
|
||||
QString theDestWKT,
|
||||
QString theDestWkt,
|
||||
QgsCoordinateReferenceSystem::CrsType theSourceCRSType = QgsCoordinateReferenceSystem::PostgisCrsId );
|
||||
|
||||
//! destructor
|
||||
|
||||
@ -34,7 +34,7 @@ class QgsGeometry
|
||||
~QgsGeometry();
|
||||
|
||||
|
||||
/** static method that creates geometry from WKT */
|
||||
/** static method that creates geometry from Wkt */
|
||||
static QgsGeometry* fromWkt(QString wkt) /Factory/;
|
||||
|
||||
/** construct geometry from a point */
|
||||
|
||||
@ -90,8 +90,8 @@ public:
|
||||
*/
|
||||
QString identifyAsText(const QgsPoint & point);
|
||||
|
||||
/** \brief Query gdal to find out the WKT projection string for this layer. This implements the virtual method of the same name defined in QgsMapLayer*/
|
||||
QString getProjectionWKT();
|
||||
/** \brief Query gdal to find out the Wkt projection string for this layer. This implements the virtual method of the same name defined in QgsMapLayer*/
|
||||
QString getProjectionWkt();
|
||||
|
||||
/** \brief Returns the number of raster units per each raster pixel. For rasters with world file, this is normally the first row (without the sign) in that file */
|
||||
double rasterUnitsPerPixel();
|
||||
|
||||
@ -67,7 +67,7 @@ class QgsRect
|
||||
void combineExtentWith(double x, double y);
|
||||
//! test if rectangle is empty
|
||||
bool isEmpty() const;
|
||||
//! returns string representation in WKT form
|
||||
//! returns string representation in Wkt form
|
||||
QString asWktCoordinates() const;
|
||||
//! returns string representation of form xmin,ymin xmax,ymax
|
||||
QString toString(bool automaticPrecision = false) const;
|
||||
|
||||
@ -260,7 +260,7 @@ static QgsMessageOutput* messageOutputViewer_()
|
||||
*/
|
||||
static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
|
||||
{
|
||||
QString proj4String;
|
||||
QString toProj4;
|
||||
QSettings mySettings;
|
||||
QString myDefaultProjectionOption =
|
||||
mySettings.value( "/Projections/defaultBehaviour" ).toString();
|
||||
@ -271,9 +271,9 @@ static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
|
||||
|
||||
QgsGenericProjectionSelector * mySelector = new QgsGenericProjectionSelector();
|
||||
mySelector->setMessage( srs->validationHint() ); //shows a generic message, if not speficied
|
||||
proj4String = QgsProject::instance()->readEntry( "SpatialRefSys", "//ProjectCRSProj4String", GEOPROJ4 );
|
||||
toProj4 = QgsProject::instance()->readEntry( "SpatialRefSys", "//ProjectCRSProj4String", GEOPROJ4 );
|
||||
QgsCoordinateReferenceSystem defaultCRS;
|
||||
if ( defaultCRS.createFromProj4( proj4String ) )
|
||||
if ( defaultCRS.createFromProj4( toProj4 ) )
|
||||
{
|
||||
mySelector->setSelectedCrsId( defaultCRS.srsid() );
|
||||
}
|
||||
@ -291,10 +291,10 @@ static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
|
||||
}
|
||||
else if ( myDefaultProjectionOption == "useProject" )
|
||||
{
|
||||
// XXX TODO: Change project to store selected CS as 'projectCRS' not 'selectedWKT'
|
||||
proj4String = QgsProject::instance()->readEntry( "SpatialRefSys", "//ProjectCRSProj4String", GEOPROJ4 );
|
||||
QgsDebugMsg( "Layer srs set from project: " + proj4String );
|
||||
srs->createFromProj4( proj4String );
|
||||
// XXX TODO: Change project to store selected CS as 'projectCRS' not 'selectedWkt'
|
||||
toProj4 = QgsProject::instance()->readEntry( "SpatialRefSys", "//ProjectCRSProj4String", GEOPROJ4 );
|
||||
QgsDebugMsg( "Layer srs set from project: " + toProj4 );
|
||||
srs->createFromProj4( toProj4 );
|
||||
}
|
||||
else ///Projections/defaultBehaviour==useGlobal
|
||||
{
|
||||
@ -2309,7 +2309,7 @@ void QgisApp::addDatabaseLayer()
|
||||
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||
|
||||
QString connInfo = dbs->connInfo();
|
||||
// for each selected table, connect to the database, parse the WKT geometry,
|
||||
// for each selected table, connect to the database, parse the Wkt geometry,
|
||||
// and build a canvasitem for it
|
||||
// readWKB(connInfo,tables);
|
||||
QStringList::Iterator it = tables.begin();
|
||||
|
||||
@ -80,7 +80,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
|
||||
radUseGlobalProjection->setChecked( true );
|
||||
}
|
||||
|
||||
txtGlobalWKT->setText( settings.value( "/Projections/defaultProjectionString", GEOPROJ4 ).toString() );
|
||||
txtGlobalWkt->setText( settings.value( "/Projections/defaultProjectionString", GEOPROJ4 ).toString() );
|
||||
|
||||
// populate combo box with ellipsoids
|
||||
getEllipsoidList();
|
||||
@ -291,7 +291,7 @@ void QgsOptions::saveOptions()
|
||||
settings.setValue( "/Projections/defaultBehaviour", "useGlobal" );
|
||||
}
|
||||
|
||||
settings.setValue( "/Projections/defaultProjectionString", txtGlobalWKT->toPlainText() );
|
||||
settings.setValue( "/Projections/defaultProjectionString", txtGlobalWkt->toPlainText() );
|
||||
|
||||
settings.setValue( "/qgis/measure/ellipsoid", getEllipsoidAcronym( cmbEllipsoid->currentText() ) );
|
||||
|
||||
@ -356,7 +356,7 @@ void QgsOptions::on_pbnSelectProjection_clicked()
|
||||
|
||||
//find out srs id of current proj4 string
|
||||
QgsCoordinateReferenceSystem refSys;
|
||||
if ( refSys.createFromProj4( txtGlobalWKT->toPlainText() ) )
|
||||
if ( refSys.createFromProj4( txtGlobalWkt->toPlainText() ) )
|
||||
{
|
||||
mySelector->setSelectedCrsId( refSys.srsid() );
|
||||
}
|
||||
@ -364,8 +364,8 @@ void QgsOptions::on_pbnSelectProjection_clicked()
|
||||
if ( mySelector->exec() )
|
||||
{
|
||||
//! @todo changes this control name in gui to txtGlobalProjString
|
||||
txtGlobalWKT->setText( mySelector->selectedProj4String() );
|
||||
QgsDebugMsg( QString( "------ Global Default Projection Selection set to ----------\n%1" ).arg( txtGlobalWKT->toPlainText() ) );
|
||||
txtGlobalWkt->setText( mySelector->selectedProj4String() );
|
||||
QgsDebugMsg( QString( "------ Global Default Projection Selection set to ----------\n%1" ).arg( txtGlobalWkt->toPlainText() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -57,7 +57,7 @@ class QgsProjectProperties : public QDialog, private Ui::QgsProjectPropertiesBas
|
||||
void title( QString const & title );
|
||||
|
||||
/*! Accessor for projection */
|
||||
QString projectionWKT();
|
||||
QString projectionWkt();
|
||||
|
||||
/*! Indicates that the projection switch is on */
|
||||
bool isProjected();
|
||||
|
||||
@ -299,7 +299,7 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer *lyr, QWidget *p
|
||||
tabBar->setTabEnabled( tabBar->indexOf( tabPageHistogram ), FALSE );
|
||||
}
|
||||
|
||||
leSpatialRefSys->setText( mRasterLayer->srs().proj4String() );
|
||||
leSpatialRefSys->setText( mRasterLayer->srs().toProj4() );
|
||||
|
||||
// Set text for pyramid info box
|
||||
QString pyramidFormat( "<h2>%1</h2><p>%2 %3 %4</p><b><font color='red'><p>%5</p><p>%6</p>" );
|
||||
@ -1696,7 +1696,7 @@ void QgsRasterLayerProperties::on_pbnChangeSpatialRefSys_clicked()
|
||||
}
|
||||
delete mySelector;
|
||||
|
||||
leSpatialRefSys->setText( mRasterLayer->srs().proj4String() );
|
||||
leSpatialRefSys->setText( mRasterLayer->srs().toProj4() );
|
||||
}
|
||||
|
||||
void QgsRasterLayerProperties::on_cboxColorMap_currentIndexChanged( const QString& theText )
|
||||
|
||||
@ -129,7 +129,7 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
|
||||
|
||||
updateButtons();
|
||||
|
||||
leSpatialRefSys->setText( layer->srs().proj4String() );
|
||||
leSpatialRefSys->setText( layer->srs().toProj4() );
|
||||
leSpatialRefSys->setCursorPosition( 0 );
|
||||
|
||||
connect( sliderTransparency, SIGNAL( valueChanged( int ) ), this, SLOT( sliderTransparency_valueChanged( int ) ) );
|
||||
@ -763,7 +763,7 @@ QString QgsVectorLayerProperties::getMetadata()
|
||||
myMetadata += tr( "Layer Spatial Reference System:" );
|
||||
myMetadata += "</td></tr>";
|
||||
myMetadata += "<tr><td>";
|
||||
myMetadata += layer->srs().proj4String().replace( QRegExp( "\"" ), " \"" );
|
||||
myMetadata += layer->srs().toProj4().replace( QRegExp( "\"" ), " \"" );
|
||||
myMetadata += "</td></tr>";
|
||||
|
||||
//
|
||||
@ -775,7 +775,7 @@ QString QgsVectorLayerProperties::getMetadata()
|
||||
myMetadata += tr("Project (Output) Spatial Reference System:");
|
||||
myMetadata += "</td></tr>";
|
||||
myMetadata += "<tr><td>";
|
||||
myMetadata += coordinateTransform->destCRS().proj4String().replace(QRegExp("\"")," \"");
|
||||
myMetadata += coordinateTransform->destCRS().toProj4().replace(QRegExp("\"")," \"");
|
||||
myMetadata += "</td></tr>";
|
||||
*/
|
||||
|
||||
@ -875,7 +875,7 @@ void QgsVectorLayerProperties::on_pbnChangeSpatialRefSys_clicked()
|
||||
}
|
||||
delete mySelector;
|
||||
|
||||
leSpatialRefSys->setText( layer->srs().proj4String() );
|
||||
leSpatialRefSys->setText( layer->srs().toProj4() );
|
||||
leSpatialRefSys->setCursorPosition( 0 );
|
||||
}
|
||||
|
||||
|
||||
@ -112,8 +112,8 @@ inline void ( *cast_to_fptr( void *p ) )()
|
||||
return u.f;
|
||||
}
|
||||
|
||||
/** WKT string that represents a geographic coord sys */
|
||||
const QString GEOWKT =
|
||||
/** Wkt string that represents a geographic coord sys */
|
||||
const QString GEOWkt =
|
||||
"GEOGCS[\"WGS 84\", "
|
||||
" DATUM[\"WGS_1984\", "
|
||||
" SPHEROID[\"WGS 84\",6378137,298.257223563, "
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
// Where has all the code gone?
|
||||
|
||||
// It's been inlined, so is in the qgsclipper.h file.
|
||||
// It's been inlined, so its in the qgsclipper.h file.
|
||||
|
||||
// But the static members must be initialised outside the class! (or GCC 4 dies)
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ class CORE_EXPORT QgsClipper
|
||||
|
||||
|
||||
// A handy way to refer to the four boundaries
|
||||
enum boundary {Xmax, Xmin, Ymax, Ymin};
|
||||
enum Boundary {XMax, XMin, YMax, YMin};
|
||||
|
||||
// Trims the given feature to a rectangular box. Returns the trimmed
|
||||
// feature in x and y. The shapeOpen parameter determines whether
|
||||
@ -88,17 +88,17 @@ class CORE_EXPORT QgsClipper
|
||||
const std::vector<double>& inY,
|
||||
std::vector<double>& outX,
|
||||
std::vector<double>& outY,
|
||||
boundary b,
|
||||
Boundary b,
|
||||
bool shapeOpen );
|
||||
|
||||
// Determines if a point is inside or outside the given boundary
|
||||
static bool inside( const double x, const double y, boundary b );
|
||||
static bool inside( const double x, const double y, Boundary b );
|
||||
|
||||
// Calculates the intersection point between a line defined by a
|
||||
// (x1, y1), and (x2, y2) and the given boundary
|
||||
static QgsPoint intersect( const double x1, const double y1,
|
||||
const double x2, const double y2,
|
||||
boundary b );
|
||||
Boundary b );
|
||||
};
|
||||
|
||||
// The inline functions
|
||||
@ -119,19 +119,19 @@ inline void QgsClipper::trimFeature( std::vector<double>& x,
|
||||
{
|
||||
std::vector<double> tmpX;
|
||||
std::vector<double> tmpY;
|
||||
trimFeatureToBoundary( x, y, tmpX, tmpY, Xmax, shapeOpen );
|
||||
trimFeatureToBoundary( x, y, tmpX, tmpY, XMax, shapeOpen );
|
||||
|
||||
x.clear();
|
||||
y.clear();
|
||||
trimFeatureToBoundary( tmpX, tmpY, x, y, Ymax, shapeOpen );
|
||||
trimFeatureToBoundary( tmpX, tmpY, x, y, YMax, shapeOpen );
|
||||
|
||||
tmpX.clear();
|
||||
tmpY.clear();
|
||||
trimFeatureToBoundary( x, y, tmpX, tmpY, Xmin, shapeOpen );
|
||||
trimFeatureToBoundary( x, y, tmpX, tmpY, XMin, shapeOpen );
|
||||
|
||||
x.clear();
|
||||
y.clear();
|
||||
trimFeatureToBoundary( tmpX, tmpY, x, y, Ymin, shapeOpen );
|
||||
trimFeatureToBoundary( tmpX, tmpY, x, y, YMin, shapeOpen );
|
||||
}
|
||||
|
||||
// An auxilary function that is part of the polygon trimming
|
||||
@ -144,7 +144,7 @@ inline void QgsClipper::trimFeatureToBoundary(
|
||||
const std::vector<double>& inY,
|
||||
std::vector<double>& outX,
|
||||
std::vector<double>& outY,
|
||||
boundary b, bool shapeOpen )
|
||||
Boundary b, bool shapeOpen )
|
||||
{
|
||||
// The shapeOpen parameter selects whether this function treats the
|
||||
// shape as open or closed. False is appropriate for polygons and
|
||||
@ -197,23 +197,23 @@ inline void QgsClipper::trimFeatureToBoundary(
|
||||
// An auxilary function to trimPolygonToBoundarY() that returns
|
||||
// whether a point is inside or outside the given boundary.
|
||||
|
||||
inline bool QgsClipper::inside( const double x, const double y, boundary b )
|
||||
inline bool QgsClipper::inside( const double x, const double y, Boundary b )
|
||||
{
|
||||
switch ( b )
|
||||
{
|
||||
case Xmax: // x < MAX_X is inside
|
||||
case XMax: // x < MAX_X is inside
|
||||
if ( x < MAX_X )
|
||||
return true;
|
||||
break;
|
||||
case Xmin: // x > MIN_X is inside
|
||||
case XMin: // x > MIN_X is inside
|
||||
if ( x > MIN_X )
|
||||
return true;
|
||||
break;
|
||||
case Ymax: // y < MAX_Y is inside
|
||||
case YMax: // y < MAX_Y is inside
|
||||
if ( y < MAX_Y )
|
||||
return true;
|
||||
break;
|
||||
case Ymin: // y > MIN_Y is inside
|
||||
case YMin: // y > MIN_Y is inside
|
||||
if ( y > MIN_Y )
|
||||
return true;
|
||||
break;
|
||||
@ -228,7 +228,7 @@ inline bool QgsClipper::inside( const double x, const double y, boundary b )
|
||||
|
||||
inline QgsPoint QgsClipper::intersect( const double x1, const double y1,
|
||||
const double x2, const double y2,
|
||||
boundary b )
|
||||
Boundary b )
|
||||
{
|
||||
// This function assumes that the two given points (x1, y1), and
|
||||
// (x2, y2) cross the given boundary. Making this assumption allows
|
||||
@ -238,19 +238,19 @@ inline QgsPoint QgsClipper::intersect( const double x1, const double y1,
|
||||
|
||||
switch ( b )
|
||||
{
|
||||
case Xmax: // x = MAX_X boundary
|
||||
case XMax: // x = MAX_X boundary
|
||||
r_n = -( x1 - MAX_X ) * ( MAX_Y - MIN_Y );
|
||||
r_d = ( x2 - x1 ) * ( MAX_Y - MIN_Y );
|
||||
break;
|
||||
case Xmin: // x = MIN_X boundary
|
||||
case XMin: // x = MIN_X boundary
|
||||
r_n = -( x1 - MIN_X ) * ( MAX_Y - MIN_Y );
|
||||
r_d = ( x2 - x1 ) * ( MAX_Y - MIN_Y );
|
||||
break;
|
||||
case Ymax: // y = MAX_Y boundary
|
||||
case YMax: // y = MAX_Y boundary
|
||||
r_n = ( y1 - MAX_Y ) * ( MAX_X - MIN_X );
|
||||
r_d = -( y2 - y1 ) * ( MAX_X - MIN_X );
|
||||
break;
|
||||
case Ymin: // y = MIN_Y boundary
|
||||
case YMin: // y = MIN_Y boundary
|
||||
r_n = ( y1 - MIN_Y ) * ( MAX_X - MIN_X );
|
||||
r_d = -( y2 - y1 ) * ( MAX_X - MIN_X );
|
||||
break;
|
||||
|
||||
@ -228,12 +228,12 @@ bool QgsCoordinateReferenceSystem::loadFromDb( QString db, QString field, long i
|
||||
mDescription = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 1 ) );
|
||||
mProjectionAcronym = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 2 ) );
|
||||
mEllipsoidAcronym = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 3 ) );
|
||||
QString proj4String = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 4 ) );
|
||||
QString toProj4 = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 4 ) );
|
||||
mSRID = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 5 ) ).toLong();
|
||||
mEpsg = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 6 ) ).toLong();
|
||||
int geo = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 7 ) ).toInt();
|
||||
mGeoFlag = ( geo == 0 ? false : true );
|
||||
setProj4String( proj4String );
|
||||
setProj4String( toProj4 );
|
||||
setMapUnits();
|
||||
}
|
||||
else
|
||||
@ -264,7 +264,7 @@ bool QgsCoordinateReferenceSystem::createFromWkt( QString theWkt )
|
||||
if ( myInputResult != OGRERR_NONE )
|
||||
{
|
||||
QgsDebugMsg( "\n---------------------------------------------------------------" );
|
||||
QgsDebugMsg( "This CRS could *** NOT *** be set from the supplied WKT " );
|
||||
QgsDebugMsg( "This CRS could *** NOT *** be set from the supplied Wkt " );
|
||||
QgsDebugMsg( "INPUT: " + theWkt );
|
||||
QgsDebugMsg( "---------------------------------------------------------------\n" );
|
||||
return mIsValidFlag;
|
||||
@ -593,18 +593,18 @@ QString QgsCoordinateReferenceSystem::ellipsoidAcronym() const
|
||||
}
|
||||
}
|
||||
|
||||
QString QgsCoordinateReferenceSystem::proj4String() const
|
||||
QString QgsCoordinateReferenceSystem::toProj4() const
|
||||
{
|
||||
if ( !mIsValidFlag )
|
||||
return "";
|
||||
|
||||
QString proj4String;
|
||||
QString toProj4;
|
||||
char *proj4src = NULL;
|
||||
OSRExportToProj4( mCRS, &proj4src );
|
||||
proj4String = proj4src;
|
||||
toProj4 = proj4src;
|
||||
CPLFree( proj4src );
|
||||
|
||||
return proj4String;
|
||||
return toProj4;
|
||||
}
|
||||
|
||||
bool QgsCoordinateReferenceSystem::geographicFlag() const
|
||||
@ -864,11 +864,11 @@ bool QgsCoordinateReferenceSystem::equals( QString theProj4String )
|
||||
QString QgsCoordinateReferenceSystem::toWkt() const
|
||||
{
|
||||
QString myWkt;
|
||||
char* WKT;
|
||||
if ( OSRExportToWkt( mCRS, &WKT ) == OGRERR_NONE )
|
||||
char* Wkt;
|
||||
if ( OSRExportToWkt( mCRS, &Wkt ) == OGRERR_NONE )
|
||||
{
|
||||
myWkt = WKT;
|
||||
OGRFree( WKT );
|
||||
myWkt = Wkt;
|
||||
OGRFree( Wkt );
|
||||
}
|
||||
|
||||
return myWkt;
|
||||
@ -941,7 +941,7 @@ bool QgsCoordinateReferenceSystem::writeXML( QDomNode & theNode, QDomDocument &
|
||||
QDomElement mySrsElement = theDoc.createElement( "spatialrefsys" );
|
||||
|
||||
QDomElement myProj4Element = theDoc.createElement( "proj4" );
|
||||
myProj4Element.appendChild( theDoc.createTextNode( proj4String() ) );
|
||||
myProj4Element.appendChild( theDoc.createTextNode( toProj4() ) );
|
||||
mySrsElement.appendChild( myProj4Element );
|
||||
|
||||
QDomElement mySrsIdElement = theDoc.createElement( "srsid" );
|
||||
@ -991,8 +991,8 @@ bool QgsCoordinateReferenceSystem::writeXML( QDomNode & theNode, QDomDocument &
|
||||
|
||||
|
||||
// Returns the whole proj4 string for the selected srsid
|
||||
//this is a static method!
|
||||
QString QgsCoordinateReferenceSystem::getProj4FromSrsId( const int theSrsId )
|
||||
//this is a static method! NOTE I've made it private for now to reduce API clutter TS
|
||||
QString QgsCoordinateReferenceSystem::proj4FromSrsId( const int theSrsId )
|
||||
{
|
||||
|
||||
QString myDatabaseFileName;
|
||||
@ -1091,7 +1091,7 @@ void QgsCoordinateReferenceSystem::debugPrint()
|
||||
QgsDebugMsg( "***SpatialRefSystem***" );
|
||||
QgsDebugMsg( "* Valid : " + ( mIsValidFlag ? QString( "true" ) : QString( "false" ) ) );
|
||||
QgsDebugMsg( "* SrsId : " + QString::number( mSrsId ) );
|
||||
QgsDebugMsg( "* Proj4 : " + proj4String() );
|
||||
QgsDebugMsg( "* Proj4 : " + toProj4() );
|
||||
QgsDebugMsg( "* Desc. : " + mDescription );
|
||||
if ( mapUnits() == QGis::Meters )
|
||||
{
|
||||
|
||||
@ -57,14 +57,14 @@ class CORE_EXPORT QgsCoordinateReferenceSystem
|
||||
~QgsCoordinateReferenceSystem();
|
||||
|
||||
/*!
|
||||
* Constructs a CRS object from a WKT string
|
||||
* Constructs a CRS object from a Wkt string
|
||||
* @param theWkt A String containing a valid Wkt def
|
||||
*/
|
||||
explicit QgsCoordinateReferenceSystem( QString theWkt );
|
||||
|
||||
/*! Use this constructor when you want to create a CRS object using
|
||||
* a postgis SRID, an EpsgCrsId id or a QGIS CRS_ID.
|
||||
* @note We encourage you to use EpsgCrsId, WKT or Proj4 to describe CRS's in your code
|
||||
* @note We encourage you to use EpsgCrsId, Wkt or Proj4 to describe CRS's in your code
|
||||
* wherever possible. QGSI CRS_IDs are not guaranteed to be permanent / involatile.
|
||||
* @param theId The ID no valid for the chosen coordinate system id type
|
||||
* @param theType One of the types described in QgsCoordinateReferenceSystem::CrsType
|
||||
@ -100,14 +100,14 @@ class CORE_EXPORT QgsCoordinateReferenceSystem
|
||||
*/
|
||||
bool createFromSrid( const long theSrid );
|
||||
|
||||
/*! Set up this srs using a WKT spatial ref sys definition.
|
||||
/*! Set up this srs using a Wkt spatial ref sys definition.
|
||||
* The wkt will be converted to a proj4 string using OGR helper
|
||||
* functions. After this the srs databasses will be searched for matches.
|
||||
* First the system level read only srs.db will be checked
|
||||
* and then the users ~/.qgis/qgis.db database will be checked for a match.
|
||||
* @note Any members will be overwritten during this process.
|
||||
* @note SRID and EpsgCrsId may be blank if no match can be found on srs db.
|
||||
* @param theWkt The WKT for the desired spatial reference system.
|
||||
* @param theWkt The Wkt for the desired spatial reference system.
|
||||
* @return bool TRUE if sucess else false
|
||||
*/
|
||||
bool createFromWkt( const QString theWkt );
|
||||
@ -203,10 +203,6 @@ class CORE_EXPORT QgsCoordinateReferenceSystem
|
||||
* is inconclusive.
|
||||
*/
|
||||
bool equals( QString theProj4String );
|
||||
/*! A helper to get an wkt representation of this srs
|
||||
* @return string containing Wkt of the srs
|
||||
*/
|
||||
QString toWkt() const;
|
||||
|
||||
/*! Restores state from the given Dom node.
|
||||
* @param theNode The node from which state will be restored
|
||||
@ -230,11 +226,6 @@ class CORE_EXPORT QgsCoordinateReferenceSystem
|
||||
*/
|
||||
bool writeXML( QDomNode & theNode, QDomDocument & theDoc ) const;
|
||||
|
||||
/** A static helper function to find out the proj4 string for a srsid
|
||||
* @param int theSrsId The srsid used for the lookup
|
||||
* @return QString The proj4 string
|
||||
*/
|
||||
static QString getProj4FromSrsId( const int theSrsId );
|
||||
|
||||
/** Sets custom function to force valid CRS
|
||||
* QGIS uses implementation in QgisGui::customSrsValidation
|
||||
@ -251,40 +242,54 @@ class CORE_EXPORT QgsCoordinateReferenceSystem
|
||||
* @return long theSrsId The internal sqlite3 srs.db primary key for this srs
|
||||
*/
|
||||
long srsid() const;
|
||||
|
||||
/*! Get the postgis srid for this srs
|
||||
* @return long theSRID the Postgis spatial_ref_sys identifier for this srs (defaults to 0)
|
||||
*/
|
||||
long postgisSrid() const;
|
||||
|
||||
/*! Get the EpsgCrsId identifier for this srs
|
||||
* @return long theEpsg the ESPG identifier for this srs (defaults to 0)
|
||||
*/
|
||||
long epsg() const;
|
||||
|
||||
/*! Get the Description
|
||||
* @return QString the Description A textual description of the srs.
|
||||
* @note A zero length string will be returned if the description is uninitialised
|
||||
*/
|
||||
QString description() const;
|
||||
|
||||
/*! Get the Projection Acronym
|
||||
* @return QString theProjectionAcronym The official proj4 acronym for the projection family
|
||||
* @note A zero length string will be returned if the projectionAcronym is uninitialised
|
||||
*/
|
||||
QString projectionAcronym() const;
|
||||
|
||||
/*! Get the Ellipsoid Acronym
|
||||
* @return QString theEllipsoidAcronym The official proj4 acronym for the ellipoid
|
||||
* @note A zero length string will be returned if the ellipsoidAcronym is uninitialised
|
||||
*/
|
||||
QString ellipsoidAcronym() const;
|
||||
/** Get the Proj Proj4String. If proj and ellps keys are found in the parameters,
|
||||
|
||||
/*! A helper to get an wkt representation of this srs
|
||||
* @return string containing Wkt of the srs
|
||||
*/
|
||||
QString toWkt() const;
|
||||
|
||||
/** Get the Proj Proj4 string representation of this srs.
|
||||
* If proj and ellps keys are found in the parameters,
|
||||
* they will be stripped out and the Projection and ellipsoid acronyms will be
|
||||
* overridden with these.
|
||||
* @return QString theProj4String Proj4 format specifies that define this srs.
|
||||
* @note A zero length string will be returned if the proj4String is uninitialised
|
||||
* @note A zero length string will be returned if the toProj4 is uninitialised
|
||||
*/
|
||||
QString proj4String() const;
|
||||
QString toProj4() const;
|
||||
|
||||
/*! Get this Geographic? flag
|
||||
* @return bool theGeoFlag Whether this is a geographic or projected coordinate system
|
||||
*/
|
||||
bool geographicFlag() const;
|
||||
|
||||
/*! Get the units that the projection is in
|
||||
* @return QGis::UnitType that gives the units for the coordinate system
|
||||
*/
|
||||
@ -303,6 +308,11 @@ class CORE_EXPORT QgsCoordinateReferenceSystem
|
||||
// We dont want to expose these to the public api since they wont create
|
||||
// a fully valid crs. Programmers should use the createFrom* methods rather
|
||||
private:
|
||||
/** A static helper function to find out the proj4 string for a srsid
|
||||
* @param int theSrsId The srsid used for the lookup
|
||||
* @return QString The proj4 string
|
||||
*/
|
||||
static QString proj4FromSrsId( const int theSrsId );
|
||||
|
||||
/*! Set the QGIS SrsId
|
||||
* @param long theSrsId The internal sqlite3 srs.db primary key for this srs
|
||||
@ -421,9 +431,9 @@ inline std::ostream& operator << ( std::ostream& os, const QgsCoordinateReferenc
|
||||
}
|
||||
|
||||
mySummary += "\n\t\tProj4String : " ;
|
||||
if ( !r.proj4String().isNull() )
|
||||
if ( !r.toProj4().isNull() )
|
||||
{
|
||||
mySummary += r.proj4String();
|
||||
mySummary += r.toProj4();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -72,13 +72,13 @@ QgsCoordinateTransform::QgsCoordinateTransform( QString theSourceCRS, QString th
|
||||
}
|
||||
|
||||
QgsCoordinateTransform::QgsCoordinateTransform( long theSourceSrid,
|
||||
QString theDestWKT,
|
||||
QString theDestWkt,
|
||||
QgsCoordinateReferenceSystem::CrsType theSourceCRSType ): QObject()
|
||||
{
|
||||
setFinder();
|
||||
|
||||
mSourceCRS.createFromId( theSourceSrid, theSourceCRSType );
|
||||
mDestCRS.createFromWkt( theDestWKT );
|
||||
mDestCRS.createFromWkt( theDestWkt );
|
||||
// initialize the coordinate system data structures
|
||||
//XXX Who spells initialize initialise?
|
||||
//XXX A: Its the queen's english....
|
||||
@ -145,12 +145,12 @@ void QgsCoordinateTransform::initialise()
|
||||
//No destination projection is set so we set the default output projection to
|
||||
//be the same as input proj. This only happens on the first layer loaded
|
||||
//whatever that may be...
|
||||
mDestCRS.createFromProj4( mSourceCRS.proj4String() );
|
||||
mDestCRS.createFromProj4( mSourceCRS.toProj4() );
|
||||
}
|
||||
|
||||
// init the projections (destination and source)
|
||||
mDestinationProjection = pj_init_plus( mDestCRS.proj4String().toUtf8() );
|
||||
mSourceProjection = pj_init_plus( mSourceCRS.proj4String().toUtf8() );
|
||||
mDestinationProjection = pj_init_plus( mDestCRS.toProj4().toUtf8() );
|
||||
mSourceProjection = pj_init_plus( mSourceCRS.toProj4().toUtf8() );
|
||||
|
||||
mInitialisedFlag = true;
|
||||
if ( mDestinationProjection == NULL )
|
||||
@ -185,7 +185,7 @@ void QgsCoordinateTransform::initialise()
|
||||
|
||||
//XXX todo overload == operator for QgsCoordinateReferenceSystem
|
||||
//at the moment srs.parameters contains the whole proj def...soon it wont...
|
||||
//if (mSourceCRS->proj4String() == mDestCRS->proj4String())
|
||||
//if (mSourceCRS->toProj4() == mDestCRS->toProj4())
|
||||
if ( mSourceCRS == mDestCRS )
|
||||
{
|
||||
// If the source and destination projection are the same, set the short
|
||||
@ -416,14 +416,14 @@ void QgsCoordinateTransform::transformCoords( const int& numPoints, double *x, d
|
||||
{
|
||||
QgsLogger::critical( tr( "The source spatial reference system (CRS) is not valid. " ) +
|
||||
tr( "The coordinates can not be reprojected. The CRS is: " ) +
|
||||
mSourceCRS.proj4String() );
|
||||
mSourceCRS.toProj4() );
|
||||
return;
|
||||
}
|
||||
if ( !mDestCRS.isValid() )
|
||||
{
|
||||
QgsLogger::critical( tr( "The destination spatial reference system (CRS) is not valid. " ) +
|
||||
tr( "The coordinates can not be reprojected. The CRS is: " ) +
|
||||
mDestCRS.proj4String() );
|
||||
mDestCRS.toProj4() );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -69,20 +69,20 @@ class CORE_EXPORT QgsCoordinateTransform: public QObject
|
||||
/*!
|
||||
* Constructs a QgsCoordinateTransform using the Well Known Text representation
|
||||
* of the layer and map canvas coordinate systems
|
||||
* @param theSourceWKT WKT, typically of the layer's coordinate system
|
||||
* @param theDestWKT WKT, typically of the map canvas coordinate system
|
||||
* @param theSourceWkt Wkt, typically of the layer's coordinate system
|
||||
* @param theDestWkt Wkt, typically of the map canvas coordinate system
|
||||
*/
|
||||
QgsCoordinateTransform( QString theSourceWKT, QString theDestWKT );
|
||||
QgsCoordinateTransform( QString theSourceWkt, QString theDestWkt );
|
||||
|
||||
/*!
|
||||
* Constructs a QgsCoordinateTransform using a Spatial Reference Id
|
||||
* of the layer and map canvas coordinate system as Wkt
|
||||
* @param theSourceSrid Spatial Ref Id of the layer's coordinate system
|
||||
* @param theSourceWKT WKT of the map canvas coordinate system
|
||||
* @param theSourceWkt Wkt of the map canvas coordinate system
|
||||
* @param theSourceCRSType On of the enum members defined in QgsCoordinateReferenceSystem::CrsType
|
||||
*/
|
||||
QgsCoordinateTransform( long theSourceSrid,
|
||||
QString theDestWKT,
|
||||
QString theDestWkt,
|
||||
QgsCoordinateReferenceSystem::CrsType theSourceCRSType = QgsCoordinateReferenceSystem::PostgisCrsId );
|
||||
|
||||
//! destructor
|
||||
|
||||
@ -404,7 +404,7 @@ QgsGeometry* QgsGeometry::fromWkt( QString wkt )
|
||||
GEOSWKTReader_destroy( reader );
|
||||
return g;
|
||||
#else
|
||||
return fromGeosGeom( GEOSGeomFromWKT( wkt.toLocal8Bit().data() ) );
|
||||
return fromGeosGeom( GEOSGeomFromWkt( wkt.toLocal8Bit().data() ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -52,14 +52,14 @@ class QgsRect;
|
||||
/** \ingroup core
|
||||
* A geometry is the spatial representation of a feature.
|
||||
* Represents a geometry with input and output in formats specified by
|
||||
* (at least) the Open Geospatial Consortium (WKB / WKT), and containing
|
||||
* (at least) the Open Geospatial Consortium (WKB / Wkt), and containing
|
||||
* various functions for geoprocessing of the geometry.
|
||||
*
|
||||
* The geometry is represented internally by the OGC WKB format or
|
||||
* as GEOS geometry. Some functions use WKB for their work, others
|
||||
* use GEOS.
|
||||
*
|
||||
* TODO: migrate completely to GEOS and only support WKB/WKT import/export.
|
||||
* TODO: migrate completely to GEOS and only support WKB/Wkt import/export.
|
||||
*
|
||||
* @author Brendan Morley
|
||||
*/
|
||||
@ -79,7 +79,7 @@ class CORE_EXPORT QgsGeometry
|
||||
//! Destructor
|
||||
~QgsGeometry();
|
||||
|
||||
/** static method that creates geometry from WKT */
|
||||
/** static method that creates geometry from Wkt */
|
||||
static QgsGeometry* fromWkt( QString wkt );
|
||||
|
||||
/** construct geometry from a point */
|
||||
@ -317,7 +317,7 @@ class CORE_EXPORT QgsGeometry
|
||||
// Private variables
|
||||
|
||||
// All of these are mutable since there may be on-the-fly
|
||||
// conversions between WKB, GEOS and WKT;
|
||||
// conversions between WKB, GEOS and Wkt;
|
||||
// However the intent is the const functions do not
|
||||
// semantically change the value that this object represents.
|
||||
|
||||
|
||||
@ -472,7 +472,7 @@ bool QgsMapRenderer::projectionsEnabled()
|
||||
|
||||
void QgsMapRenderer::setDestinationSrs( const QgsCoordinateReferenceSystem& srs )
|
||||
{
|
||||
QgsDebugMsg( "* Setting destCRS : = " + srs.proj4String() );
|
||||
QgsDebugMsg( "* Setting destCRS : = " + srs.toProj4() );
|
||||
QgsDebugMsg( "* DestCRS.srsid() = " + QString::number( srs.srsid() ) );
|
||||
if ( *mDestCRS != srs )
|
||||
{
|
||||
@ -488,7 +488,7 @@ const QgsCoordinateReferenceSystem& QgsMapRenderer::destinationSrs()
|
||||
{
|
||||
QgsDebugMsg( "* Returning destCRS" );
|
||||
QgsDebugMsg( "* DestCRS.srsid() = " + QString::number( mDestCRS->srsid() ) );
|
||||
QgsDebugMsg( "* DestCRS.proj4() = " + mDestCRS->proj4String() );
|
||||
QgsDebugMsg( "* DestCRS.proj4() = " + mDestCRS->toProj4() );
|
||||
return *mDestCRS;
|
||||
}
|
||||
|
||||
|
||||
@ -90,7 +90,7 @@ class CORE_EXPORT QgsRect
|
||||
void combineExtentWith( double x, double y );
|
||||
//! test if rectangle is empty
|
||||
bool isEmpty() const;
|
||||
//! returns string representation in WKT form
|
||||
//! returns string representation in Wkt form
|
||||
QString asWktCoordinates() const;
|
||||
//! returns string representation of form xmin,ymin xmax,ymax
|
||||
QString toString( bool automaticPrecision = false ) const;
|
||||
|
||||
@ -443,13 +443,13 @@ bool QgsRasterLayer::readFile( QString const & fileName )
|
||||
// QgsCoordinateTransform for this layer
|
||||
// NOTE: we must do this before getMetadata is called
|
||||
|
||||
QString mySourceWKT = getProjectionWKT();
|
||||
QString mySourceWkt = getProjectionWkt();
|
||||
|
||||
QgsDebugMsg( "--------------------------------------------------------------------------------------" );
|
||||
QgsDebugMsg( "using wkt:\n" + mySourceWKT );
|
||||
QgsDebugMsg( "using wkt:\n" + mySourceWkt );
|
||||
QgsDebugMsg( "--------------------------------------------------------------------------------------" );
|
||||
|
||||
mCRS->createFromWkt( mySourceWKT );
|
||||
mCRS->createFromWkt( mySourceWkt );
|
||||
//get the project projection, defaulting to this layer's projection
|
||||
//if none exists....
|
||||
if ( !mCRS->isValid() )
|
||||
@ -598,20 +598,20 @@ bool QgsRasterLayer::readFile( QString const & fileName )
|
||||
|
||||
} // QgsRasterLayer::readFile
|
||||
|
||||
QString QgsRasterLayer::getProjectionWKT()
|
||||
QString QgsRasterLayer::getProjectionWkt()
|
||||
{
|
||||
QString myWKTString;
|
||||
QString myWktString;
|
||||
QgsCoordinateReferenceSystem myCRS;
|
||||
myWKTString = QString( GDALGetProjectionRef( mGdalDataset ) );
|
||||
myCRS.createFromWkt( myWKTString );
|
||||
myWktString = QString( GDALGetProjectionRef( mGdalDataset ) );
|
||||
myCRS.createFromWkt( myWktString );
|
||||
if ( !myCRS.isValid() )
|
||||
{
|
||||
//try to get the gcp srs from the raster layer if available
|
||||
myWKTString = QString( GDALGetGCPProjection( mGdalDataset ) );
|
||||
myWktString = QString( GDALGetGCPProjection( mGdalDataset ) );
|
||||
|
||||
// What is the purpose of this piece of code?
|
||||
// Sideeffects from validate()?
|
||||
// myCRS.createFromWkt(myWKTString);
|
||||
// myCRS.createFromWkt(myWktString);
|
||||
// if (!myCRS.isValid())
|
||||
// {
|
||||
// // use force and make CRS valid!
|
||||
@ -620,7 +620,7 @@ QString QgsRasterLayer::getProjectionWKT()
|
||||
|
||||
}
|
||||
|
||||
return myWKTString;
|
||||
return myWktString;
|
||||
}
|
||||
|
||||
void QgsRasterLayer::closeDataset()
|
||||
@ -3235,7 +3235,7 @@ QString QgsRasterLayer::getMetadata()
|
||||
myMetadata += tr( "Layer Spatial Reference System: " );
|
||||
myMetadata += "</p>\n";
|
||||
myMetadata += "<p>";
|
||||
myMetadata += mCRS->proj4String();
|
||||
myMetadata += mCRS->toProj4();
|
||||
myMetadata += "</p>\n";
|
||||
|
||||
// output coordinate system
|
||||
@ -3245,7 +3245,7 @@ QString QgsRasterLayer::getMetadata()
|
||||
myMetadata += tr("Project Spatial Reference System: ");
|
||||
myMetadata += "</p>\n";
|
||||
myMetadata += "<p>";
|
||||
myMetadata += mCoordinateTransform->destCRS().proj4String();
|
||||
myMetadata += mCoordinateTransform->destCRS().toProj4();
|
||||
myMetadata += "</p>\n";
|
||||
*/
|
||||
|
||||
|
||||
@ -265,8 +265,8 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
|
||||
*/
|
||||
QString identifyAsText( const QgsPoint & point );
|
||||
|
||||
/** \brief Query gdal to find out the WKT projection string for this layer. This implements the virtual method of the same name defined in QgsMapLayer*/
|
||||
QString getProjectionWKT();
|
||||
/** \brief Query gdal to find out the Wkt projection string for this layer. This implements the virtual method of the same name defined in QgsMapLayer*/
|
||||
QString getProjectionWkt();
|
||||
|
||||
/** \brief Returns the number of raster units per each raster pixel. For rasters with world file, this is normally the first row (without the sign) in that file */
|
||||
double rasterUnitsPerPixel();
|
||||
|
||||
@ -75,13 +75,13 @@ void QgsGenericProjectionSelector::setSelectedEpsg( long theID )
|
||||
|
||||
QString QgsGenericProjectionSelector::selectedProj4String()
|
||||
{
|
||||
//@NOTE dont use getSelectedWKT as that just returns the name part!
|
||||
//@NOTE dont use getSelectedWkt as that just returns the name part!
|
||||
return projectionSelector->selectedProj4String();
|
||||
}
|
||||
|
||||
long QgsGenericProjectionSelector::selectedCrsId()
|
||||
{
|
||||
//@NOTE dont use getSelectedWKT as that just returns the name part!
|
||||
//@NOTE dont use getSelectedWkt as that just returns the name part!
|
||||
return projectionSelector->selectedCrsId();
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE qgisgrassmodule SYSTEM "http://mrcc.com/qgisgrassmodule.dtd">
|
||||
|
||||
<qgisgrassmodule label="Print projection information from a georeferenced ASCII file containing a WKT projection description and create a new location based on it" module="g.proj">
|
||||
<qgisgrassmodule label="Print projection information from a georeferenced ASCII file containing a Wkt projection description and create a new location based on it" module="g.proj">
|
||||
<file key="wkt" type="old" />
|
||||
<option key="location" />
|
||||
</qgisgrassmodule>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE qgisgrassmodule SYSTEM "http://mrcc.com/qgisgrassmodule.dtd">
|
||||
|
||||
<qgisgrassmodule label="Print projection information from a georeferenced ASCII file containing a WKT projection description" module="g.proj">
|
||||
<qgisgrassmodule label="Print projection information from a georeferenced ASCII file containing a Wkt projection description" module="g.proj">
|
||||
<file key="wkt" type="old" />
|
||||
<flag key="p" />
|
||||
<flag key="d" />
|
||||
|
||||
@ -460,7 +460,7 @@ void QgsGrassNewMapset::setGrassProjection()
|
||||
char *wkt = NULL;
|
||||
if (( errcode = OSRExportToWkt( hCRS, &wkt ) ) != OGRERR_NONE )
|
||||
{
|
||||
QgsDebugMsg( QString( "OGR can't get WKT-style parameter string\nOGR Error code was %1" ).arg( errcode ) );
|
||||
QgsDebugMsg( QString( "OGR can't get Wkt-style parameter string\nOGR Error code was %1" ).arg( errcode ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
#include <qgsfeature.h> //we will need to pass a bunch of these for each rec
|
||||
#include <qgsgeometry.h> //each feature needs a geometry
|
||||
#include <qgspoint.h> //we will use point geometry
|
||||
#include <qgis.h> //defines GEOWKT
|
||||
#include <qgis.h> //defines GEOWkt
|
||||
#include <qgslogger.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
@ -42,7 +42,7 @@ GraticuleCreator::GraticuleCreator( QString theOutputFileName )
|
||||
mFields.insert( 5, myField6 );
|
||||
mFields.insert( 6, myField7 );
|
||||
mFields.insert( 7, myField8 );
|
||||
mCRS = QgsCoordinateReferenceSystem( GEOWKT );
|
||||
mCRS = QgsCoordinateReferenceSystem( GEOWkt );
|
||||
mFileName = theOutputFileName;
|
||||
|
||||
}
|
||||
|
||||
@ -410,7 +410,7 @@ bool QgsShapeFile::insertLayer( QString dbname, QString schema, QString primary_
|
||||
|
||||
char *geo_temp;
|
||||
// 'GeometryFromText' supports only 2D coordinates
|
||||
// TODO for proper 2.5D support we would need to use 'GeomFromEWKT'
|
||||
// TODO for proper 2.5D support we would need to use 'GeomFromEWkt'
|
||||
if ( hasMoreDimensions )
|
||||
OGR_G_SetCoordinateDimension( geom, 2 );
|
||||
OGR_G_ExportToWkt( geom, &geo_temp );
|
||||
|
||||
@ -1269,7 +1269,7 @@ struct Map_info *QgsGrassProvider::layerMap( int layerId )
|
||||
|
||||
QgsCoordinateReferenceSystem QgsGrassProvider::getCRS()
|
||||
{
|
||||
QString WKT;
|
||||
QString Wkt;
|
||||
|
||||
struct Cell_head cellhd;
|
||||
|
||||
@ -1297,14 +1297,14 @@ QgsCoordinateReferenceSystem QgsGrassProvider::getCRS()
|
||||
struct Key_Value *projinfo = G_get_projinfo();
|
||||
struct Key_Value *projunits = G_get_projunits();
|
||||
char *wkt = GPJ_grass_to_wkt( projinfo, projunits, 0, 0 );
|
||||
WKT = QString( wkt );
|
||||
Wkt = QString( wkt );
|
||||
free( wkt );
|
||||
}
|
||||
|
||||
setlocale( LC_NUMERIC, oldlocale );
|
||||
|
||||
QgsCoordinateReferenceSystem srs;
|
||||
srs.createFromWkt( WKT );
|
||||
srs.createFromWkt( Wkt );
|
||||
|
||||
return srs;
|
||||
}
|
||||
|
||||
@ -1138,11 +1138,11 @@ QGISEXTERN bool createEmptyDataSource( const QString& uri,
|
||||
OGRSpatialReferenceH reference = NULL;
|
||||
QgsCoordinateReferenceSystem mySpatialRefSys;
|
||||
mySpatialRefSys.validate();
|
||||
QString myWKT = mySpatialRefSys.toWkt();
|
||||
QString myWkt = mySpatialRefSys.toWkt();
|
||||
|
||||
if ( !myWKT.isNull() && myWKT.length() != 0 )
|
||||
if ( !myWkt.isNull() && myWkt.length() != 0 )
|
||||
{
|
||||
reference = OSRNewSpatialReference( myWKT.toLocal8Bit().data() );
|
||||
reference = OSRNewSpatialReference( myWkt.toLocal8Bit().data() );
|
||||
}
|
||||
|
||||
// Map the qgis geometry type to the OGR geometry type
|
||||
@ -1247,13 +1247,13 @@ QgsCoordinateReferenceSystem QgsOgrProvider::getCRS()
|
||||
char * ppszProj4;
|
||||
OSRExportToProj4( mySpatialRefSys, &ppszProj4 );
|
||||
QgsDebugMsg( ppszProj4 );
|
||||
char *pszWKT = NULL;
|
||||
OSRExportToWkt( mySpatialRefSys, &pszWKT );
|
||||
QString myWKTString = QString( pszWKT );
|
||||
OGRFree( pszWKT );
|
||||
char *pszWkt = NULL;
|
||||
OSRExportToWkt( mySpatialRefSys, &pszWkt );
|
||||
QString myWktString = QString( pszWkt );
|
||||
OGRFree( pszWkt );
|
||||
|
||||
// create CRS from WKT
|
||||
srs.createFromWkt( myWKTString );
|
||||
// create CRS from Wkt
|
||||
srs.createFromWkt( myWktString );
|
||||
}
|
||||
|
||||
return srs;
|
||||
|
||||
@ -828,7 +828,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QTextBrowser" name="txtGlobalWKT" />
|
||||
<widget class="QTextBrowser" name="txtGlobalWkt" />
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QGroupBox" name="grpProjectionBehaviour" >
|
||||
@ -1092,7 +1092,7 @@
|
||||
<tabstop>radPromptForProjection</tabstop>
|
||||
<tabstop>radUseProjectProjection</tabstop>
|
||||
<tabstop>radUseGlobalProjection</tabstop>
|
||||
<tabstop>txtGlobalWKT</tabstop>
|
||||
<tabstop>txtGlobalWkt</tabstop>
|
||||
<tabstop>pbnSelectProjection</tabstop>
|
||||
<tabstop>grpLocale</tabstop>
|
||||
<tabstop>cboLocale</tabstop>
|
||||
|
||||
@ -95,7 +95,7 @@ class ProjectionCsHandlingTest : public CppUnit::TestCase
|
||||
void testProjImportWkt()
|
||||
{
|
||||
// create a spatial reference system object
|
||||
std::cout << "\n\nCreating and OGRSpatialReference object from WKT" << std::endl;
|
||||
std::cout << "\n\nCreating and OGRSpatialReference object from Wkt" << std::endl;
|
||||
OGRSpatialReferenceH myInputSpatialRefSys = OSRNewSpatialReference( NULL );
|
||||
char *pWkt = ( char* )wkt.ascii();
|
||||
CPPUNIT_ASSERT( OSRImportFromWkt( myInputSpatialRefSys, &pWkt ) == OGRERR_NONE );
|
||||
@ -164,7 +164,7 @@ class ProjectionCsHandlingTest : public CppUnit::TestCase
|
||||
//
|
||||
void testProjEpsgExportToProj4()
|
||||
{
|
||||
std::cout << "\n\nGetting NAD83 proj4 parameters from an EpsgCrsId format WKT" << std::endl;
|
||||
std::cout << "\n\nGetting NAD83 proj4 parameters from an EpsgCrsId format Wkt" << std::endl;
|
||||
// set up the spatial ref
|
||||
OGRSpatialReference myInputSpatialRefSys;
|
||||
char *pWkt = ( char* )wktEpsg.ascii();
|
||||
@ -219,7 +219,7 @@ class ProjectionCsHandlingTest : public CppUnit::TestCase
|
||||
//
|
||||
void testFetchWktAttributes()
|
||||
{
|
||||
std::cout << "\n\nFetching states.prj WKT attributes using OGRSpatialReference::GetAttrValue" << std::endl;
|
||||
std::cout << "\n\nFetching states.prj Wkt attributes using OGRSpatialReference::GetAttrValue" << std::endl;
|
||||
// set up the spatial ref - use the nad83 from states.prj
|
||||
OGRSpatialReference myInputSpatialRefSys;
|
||||
char *pWkt = ( char* )wktDestNad83.ascii();
|
||||
@ -230,7 +230,7 @@ class ProjectionCsHandlingTest : public CppUnit::TestCase
|
||||
std::cout << "\tDatum: " << datum << std::endl;
|
||||
}
|
||||
//
|
||||
// Test the WKT contained in wkt.txt in the current directory to see if
|
||||
// Test the Wkt contained in wkt.txt in the current directory to see if
|
||||
// the datum can be determined
|
||||
//
|
||||
void testWktFromFile()
|
||||
@ -293,15 +293,15 @@ class ProjectionCsHandlingTest : public CppUnit::TestCase
|
||||
}
|
||||
|
||||
private:
|
||||
// WKT for default projection hardcoded in QgsCoordinateTransform class
|
||||
// Wkt for default projection hardcoded in QgsCoordinateTransform class
|
||||
QString wkt;
|
||||
// WKT for an ESRI style GEOGCS in NAD27
|
||||
// Wkt for an ESRI style GEOGCS in NAD27
|
||||
QString wktDest;
|
||||
// WKT for an ESRI style GEOGCS in NAD83 (from states.shp shapefile)
|
||||
// Wkt for an ESRI style GEOGCS in NAD83 (from states.shp shapefile)
|
||||
QString wktDestNad83;
|
||||
// WKT for an EpsgCrsId style GEOGCS
|
||||
// Wkt for an EpsgCrsId style GEOGCS
|
||||
QString wktEpsg;
|
||||
// WKT for an ESRI style PROJCS as read from a shapefile
|
||||
// Wkt for an ESRI style PROJCS as read from a shapefile
|
||||
QString wktAkAlbers;
|
||||
};
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
#include <qgscoordinatereferencesystem.h> //needed for creating a srs
|
||||
#include <qgsapplication.h> //search path for srs.db
|
||||
#include <qgsfield.h>
|
||||
#include <qgis.h> //defines GEOWKT
|
||||
#include <qgis.h> //defines GEOWkt
|
||||
#include <qgsproviderregistry.h>
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ void Regression1141::diacriticalTest()
|
||||
mEncoding = "UTF-8";
|
||||
QgsField myField( "ąęćń", QVariant::Int, "int", 10, 0, "Value on lon" );
|
||||
mFields.insert( 0, myField );
|
||||
mCRS = QgsCoordinateReferenceSystem( GEOWKT );
|
||||
mCRS = QgsCoordinateReferenceSystem( GEOWkt );
|
||||
|
||||
qDebug( "Checking test dataset exists..." );
|
||||
qDebug( mFileName.toLocal8Bit() );
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
#include <qgscoordinatereferencesystem.h> //needed for creating a srs
|
||||
#include <qgsapplication.h> //search path for srs.db
|
||||
#include <qgsfield.h>
|
||||
#include <qgis.h> //defines GEOWKT
|
||||
#include <qgis.h> //defines GEOWkt
|
||||
#include <qgsmaprenderer.h>
|
||||
#include <qgsmaplayer.h>
|
||||
#include <qgsvectorlayer.h>
|
||||
@ -89,7 +89,7 @@ void TestQgsMapRenderer::initTestCase()
|
||||
mEncoding = "UTF-8";
|
||||
QgsField myField1("Value",QVariant::Int,"int",10,0,"Value on lon");
|
||||
mFields.insert(0, myField1);
|
||||
mCRS = QgsCoordinateReferenceSystem(GEOWKT);
|
||||
mCRS = QgsCoordinateReferenceSystem(GEOWkt);
|
||||
//
|
||||
// Create the test dataset if it doesnt exist
|
||||
//
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
#include <qgscoordinatereferencesystem.h> //needed for creating a srs
|
||||
#include <qgsapplication.h> //search path for srs.db
|
||||
#include <qgsfield.h>
|
||||
#include <qgis.h> //defines GEOWKT
|
||||
#include <qgis.h> //defines GEOWkt
|
||||
|
||||
/** \ingroup UnitTests
|
||||
* This is a unit test for the QgsVectorFileWriter class.
|
||||
@ -100,7 +100,7 @@ void TestQgsVectorFileWriter::initTestCase()
|
||||
mEncoding = "UTF-8";
|
||||
QgsField myField1("Field1",QVariant::String,"String",10,0,"Field 1 comment");
|
||||
mFields.insert(0, myField1);
|
||||
mCRS = QgsCoordinateReferenceSystem(GEOWKT);
|
||||
mCRS = QgsCoordinateReferenceSystem(GEOWkt);
|
||||
mPoint1 = QgsPoint(10.0,10.0);
|
||||
mPoint2 = QgsPoint(15.0,10.0);
|
||||
mPoint3 = QgsPoint(15.0,12.0);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user