Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
More api cleanups
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9495 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Oct 19, 2008
1 parent 1fb00d5 commit efba2d8
Show file tree
Hide file tree
Showing 38 changed files with 177 additions and 173 deletions.
Binary file modified doc/userguide.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions python/core/qgis.sip
Expand Up @@ -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;
Expand Down
24 changes: 9 additions & 15 deletions python/core/qgscoordinatereferencesystem.sip
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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
*/
Expand Down Expand Up @@ -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
*/
Expand Down
10 changes: 5 additions & 5 deletions python/core/qgscoordinatetransform.sip
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion python/core/qgsgeometry.sip
Expand Up @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions python/core/qgsrasterlayer.sip
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion python/core/qgsrect.sip
Expand Up @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions src/app/qgisapp.cpp
Expand Up @@ -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();
Expand All @@ -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() );
}
Expand All @@ -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
{
Expand Down Expand Up @@ -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();
Expand Down
10 changes: 5 additions & 5 deletions src/app/qgsoptions.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -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() ) );

Expand Down Expand Up @@ -356,16 +356,16 @@ 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() );
}

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
{
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsprojectproperties.h
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsrasterlayerproperties.cpp
Expand Up @@ -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>" );
Expand Down Expand Up @@ -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 )
Expand Down
8 changes: 4 additions & 4 deletions src/app/qgsvectorlayerproperties.cpp
Expand Up @@ -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 ) ) );
Expand Down Expand Up @@ -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>";

//
Expand All @@ -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>";
*/

Expand Down Expand Up @@ -875,7 +875,7 @@ void QgsVectorLayerProperties::on_pbnChangeSpatialRefSys_clicked()
}
delete mySelector;

leSpatialRefSys->setText( layer->srs().proj4String() );
leSpatialRefSys->setText( layer->srs().toProj4() );
leSpatialRefSys->setCursorPosition( 0 );
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/qgis.h
Expand Up @@ -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, "
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsclipper.cpp
Expand Up @@ -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)

Expand Down

0 comments on commit efba2d8

Please sign in to comment.