Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

omgspatialreferencesystem.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002 *   Copyright (C) 2005 by Tim Sutton   *
00003 *   tim@linfiniti.com   *
00004 *                                                                         *
00005 *   This program is free software; you can redistribute it and/or modify  *
00006 *   it under the terms of the GNU General Public License as published by  *
00007 *   the Free Software Foundation; either version 2 of the License, or     *
00008 *   (at your option) any later version.                                   *
00009 *                                                                         *
00010 *   This program is distributed in the hope that it will be useful,       *
00011 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013 *   GNU General Public License for more details.                          *
00014 *                                                                         *
00015 *   You should have received a copy of the GNU General Public License     *
00016 *   along with this program; if not, write to the                         *
00017 *   Free Software Foundation, Inc.,                                       *
00018 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019 ***************************************************************************/
00020 #include "omgspatialreferencesystem.h"
00021 #include <QFile>
00022 #include <QTextStream>
00023 
00024 
00025 OmgSpatialReferenceSystem::OmgSpatialReferenceSystem()
00026 {
00027 
00028 }
00029 
00030 OmgSpatialReferenceSystem::~OmgSpatialReferenceSystem()
00031 {
00032 
00033 }
00034 
00035 
00036 
00037 OmgSpatialReferenceSystem::WktMap OmgSpatialReferenceSystem::getWktMap()
00038 {
00039   WktMap myWktMap;
00040   //first lat long hard coded options, rest of WKTs we will try to get from our resource file
00041   myWktMap["Lat/Long WGS84"] = "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]],AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST],AUTHORITY[\"EPSG\",\"4326\"]]";
00042 
00043 
00044   // The wkt list is in the qt reources file (see reources dir and qt docs on how resource bundles work)
00045   QFile myQFile(":/wkt_defs.txt" );
00046   if ( myQFile.open( QIODevice::ReadOnly ) )
00047   {
00048     //now we parse the file
00049     QTextStream myQTextStream( &myQFile );
00050     QString myCurrentLine;
00051     while ( !myQTextStream.atEnd() )
00052     {
00053       // line of text excluding '\n'
00054       // lines are in pairs
00055       // first line in pair has descriptive name for wkt
00056       // second line actual wkt
00057       myCurrentLine= myQTextStream.readLine();
00058       if (myCurrentLine.left(4)!="PROJ")
00059       {
00060         myWktMap[myCurrentLine]=myQTextStream.readLine();
00061       }
00062     }
00063     myQFile.close();
00064   }
00065   else
00066   {
00067     qDebug("Opening wkt file failed");
00068   }
00069   //qDebug("Opening wkt completed");
00070   return myWktMap;
00071 }
00072 

Generated on Mon Apr 28 15:09:11 2008 for openModellerDesktop by  doxygen 1.4.1-20050210