/***********************************************************************
**
**   projectionbase.cpp
**
**   This file is part of KFLog2.
**
************************************************************************
**
**   Copyright (c):  2002 by Heiner Lamprecht
**
**   This file is distributed under the terms of the General Public
**   Licence. See the file COPYING for more information.
**
**   $Id: projectionbase.cpp,v 1.4 2004/01/02 21:57:50 andre Exp $
**
***********************************************************************/
#include "projectionbase.h"
#include "projectionlambert.h"
#include "projectioncylindric.h"

ProjectionBase::ProjectionBase()
{
}

ProjectionBase::~ProjectionBase()
{
}


void SaveProjection(QDataStream & s, ProjectionBase * p) {
  s << Q_INT8(p->projectionType());
  p->saveParameters(s);  
}

ProjectionBase * LoadProjection(QDataStream & s) {
  ProjectionBase * result;
  result=0;
  Q_INT8 i;
  s >> i;
  switch (ProjectionBase::ProjectionType(i)) {
  case ProjectionBase::Lambert:
    result=new ProjectionLambert();
    result->loadParameters(s);
    break;
  case ProjectionBase::Cylindric:
    result=new ProjectionCylindric();
    result->loadParameters(s);
    break;
  default:
    qWarning("Unknown projectiontype!");
    break;
  }
  return result;
}
