Skip to content
Permalink
Browse files

Changed the way SRS is read from XML. Moved <spatialrefsys> tag down …

…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@6424 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
homann
homann committed Jan 12, 2007
1 parent 4df6cab commit 167252b69607e33ca95e35d5251eb061bb6c8ec3
Showing with 22 additions and 17 deletions.
  1. +4 −4 src/core/qgscoordinatetransform.cpp
  2. +1 −5 src/core/qgsmaplayer.cpp
  3. +7 −0 src/core/qgsmaprender.cpp
  4. +10 −8 src/core/qgsspatialrefsys.cpp
@@ -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;
@@ -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");
@@ -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();
@@ -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;
}

@@ -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"))
{

0 comments on commit 167252b

Please sign in to comment.
You can’t perform that action at this time.