Skip to content

Commit

Permalink
Changed the way SRS is read from XML. Moved <spatialrefsys> tag down …
Browse files Browse the repository at this point in the history
…to spatialrefsys.cpp only.

Now SRSs are read from saved projects correctly. Also added som debug outputs.


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6424 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
homann committed Jan 12, 2007
1 parent 59ddd25 commit a124ef6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/core/qgscoordinatetransform.cpp
Expand Up @@ -524,12 +524,12 @@ bool QgsCoordinateTransform::readXML( QDomNode & theNode )

QgsDebugMsg("Reading Coordinate Transform from xml ------------------------!");

QDomNode mySrcNodeParent = theNode.namedItem("sourcesrs");
QDomNode mySrcNode = mySrcNodeParent.namedItem("spatialrefsys");
QDomNode mySrcNode = theNode.namedItem("sourcesrs");
mSourceSRS.readXML(mySrcNode);
QDomNode myDestNodeParent = theNode.namedItem("destinationsrs");
QDomNode myDestNode = myDestNodeParent.namedItem("spatialrefsys");

QDomNode myDestNode = theNode.namedItem("destinationsrs");
mDestSRS.readXML(myDestNode);

initialise();

return true;
Expand Down
6 changes: 1 addition & 5 deletions src/core/qgsmaplayer.cpp
Expand Up @@ -192,11 +192,7 @@ bool QgsMapLayer::readXML( QDomNode & layer_node )

//read srs
QDomNode srsNode = layer_node.namedItem("srs");
if( ! srsNode.isNull() )
{
QDomNode mySrsNode = srsNode.namedItem("spatialrefsys");
mSRS->readXML(mySrsNode);
}
mSRS->readXML(srsNode);

//read transparency level
QDomNode transparencyNode = layer_node.namedItem("transparencyLevelInt");
Expand Down
7 changes: 7 additions & 0 deletions src/core/qgsmaprender.cpp
Expand Up @@ -377,8 +377,12 @@ bool QgsMapRender::projectionsEnabled()

void QgsMapRender::setDestinationSrs(const QgsSpatialRefSys& srs)
{
QgsDebugMsg("* Setting destSRS");
QgsDebugMsg("* DestSRS.srsid() = " + QString::number(srs.srsid()));
QgsDebugMsg("* DestSRS.proj4() = " + srs.proj4String());
if (*mDestSRS != srs)
{
QgsDebugMsg("No, changed my mind!");
*mDestSRS = srs;
updateFullExtent();
emit destinationSrsChanged();
Expand All @@ -387,6 +391,9 @@ void QgsMapRender::setDestinationSrs(const QgsSpatialRefSys& srs)

const QgsSpatialRefSys& QgsMapRender::destinationSrs()
{
QgsDebugMsg("* Returning destSRS");
QgsDebugMsg("* DestSRS.srsid() = " + QString::number(mDestSRS->srsid()));
QgsDebugMsg("* DestSRS.proj4() = " + mDestSRS->proj4String());
return *mDestSRS;
}

Expand Down
18 changes: 10 additions & 8 deletions src/core/qgsspatialrefsys.cpp
Expand Up @@ -1070,35 +1070,37 @@ QString QgsSpatialRefSys::toWkt()
bool QgsSpatialRefSys::readXML( QDomNode & theNode )
{
QgsDebugMsg("Reading Spatial Ref Sys from xml ------------------------!");
QDomNode myNode = theNode.namedItem("proj4");
QDomNode srsNode = theNode.namedItem( "spatialrefsys" );

QDomNode myNode = srsNode.namedItem("proj4");
QDomElement myElement = myNode.toElement();
setProj4String(myElement.text());

myNode = theNode.namedItem("srsid");
myNode = srsNode.namedItem("srsid");
myElement = myNode.toElement();
setSrsId(myElement.text().toLong());

myNode = theNode.namedItem("srid");
myNode = srsNode.namedItem("srid");
myElement = myNode.toElement();
setSrid(myElement.text().toLong());

myNode = theNode.namedItem("epsg");
myNode = srsNode.namedItem("epsg");
myElement = myNode.toElement();
setEpsg(myElement.text().toLong());

myNode = theNode.namedItem("description");
myNode = srsNode.namedItem("description");
myElement = myNode.toElement();
setDescription(myElement.text());

myNode = theNode.namedItem("projectionacronym");
myNode = srsNode.namedItem("projectionacronym");
myElement = myNode.toElement();
setProjectionAcronym(myElement.text());

myNode = theNode.namedItem("ellipsoidacronym");
myNode = srsNode.namedItem("ellipsoidacronym");
myElement = myNode.toElement();
setEllipsoidAcronym(myElement.text());

myNode = theNode.namedItem("geographicflag");
myNode = srsNode.namedItem("geographicflag");
myElement = myNode.toElement();
if (myElement.text().compare("true"))
{
Expand Down

0 comments on commit a124ef6

Please sign in to comment.