QCoordSys.cpp
资源名称:QGIS.rar [点击查看]
上传用户:oybseng
上传日期:2015-04-27
资源大小:7831k
文件大小:50k
源码类别:
GDI/图象编程
开发平台:
Visual C++
- // QCoordSys.cpp: implementation of the CQCoordSys class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "..stdafx.h"
- #include "..includeResource.h"
- #include "..includeQCoordSys.h"
- #include "..includeQBaseObj.h"
- #include "....geoprojectionsMapProjections.h"
- #include "..includeQGlobalObj.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- CQGISEllipsiodParams::CQGISEllipsiodParams(enumQGISEllipsiodType ET /* = ET_KLSFSJ */)
- {
- switch(ET)
- {
- case ET_UNKNOWN:
- {
- break;
- }
- case ET_KLSFSJ: //克拉索夫斯基
- {
- m_szEName = "克拉索夫斯基椭球(1940)"; //椭球球名称 Krassovsky
- m_lEID = ET_KLSFSJ;
- m_lEYear = 1940;
- m_fEHalfMajorAxis = 6378245; //椭球长半轴
- m_fEHalfMinorAxis = 6356863.018773; //椭球短半轴
- m_fEFlattening = 1.0/298.3; //扁率
- m_fEGravityConst = 0; //地心引力常数
- m_fXOffset = 0;
- m_fYOffset = 0;
- m_fZOffset = 0;
- break;
- }
- case ET_IUGG75:
- {
- m_szEName = "IUGG75椭球";
- m_lEID = ET_IUGG75;
- m_lEYear = 1975;
- m_fEHalfMajorAxis = 6378140;//椭球长半轴
- m_fEHalfMinorAxis = 6356755.2881575;//椭球短半轴
- m_fEFlattening = 1.0/298.257; //扁率
- m_fEGravityConst = 0; //地心引力常数
- m_fXOffset = 0;
- m_fYOffset = 0;
- m_fZOffset = 0;
- break;
- }
- case ET_WGS84:
- {
- m_lEID = ET_WGS84;//
- m_szEName = "WGS-84椭球(1984)";//椭球体名称 Krassovsky
- m_lEYear = 1984;//定义年代
- m_fEHalfMajorAxis = 6378137;//椭球长半轴
- m_fEHalfMinorAxis = 6356752.3142451;//椭球短半轴
- m_fEFlattening = 1.0/298.257223563; //扁率
- m_fEGravityConst = 0; //地心引力常数
- m_fXOffset = 0;
- m_fYOffset = 0;
- m_fZOffset = 0;
- break;
- }
- case ET_MAX:
- break;
- default:
- {
- m_szEName = "克拉索夫斯基椭球(1940)"; //椭球球名称 Krassovsky
- m_lEID = ET_KLSFSJ;
- m_lEYear = 1940;
- m_fEHalfMajorAxis = 6378245; //椭球长半轴
- m_fEHalfMinorAxis = 6356863.018773; //椭球短半轴
- m_fEFlattening = 1.0/298.3; //扁率
- m_fEGravityConst = 0; //地心引力常数
- m_fXOffset = 0;
- m_fYOffset = 0;
- m_fZOffset = 0;
- break;
- }
- }
- }
- CQGISEllipsiodParams::CQGISEllipsiodParams(CQGISEllipsiodParams & e)
- {
- m_lEID = e.GetEllipsioddType();
- m_szEName = e.GetellipsiodName();
- m_lEYear = e.GetEllipsiodYear();
- m_fEHalfMajorAxis = e.GetEHalfMajorAxis();
- m_fEHalfMinorAxis = e.GetEHalfMinorAxis();
- m_fEFlattening = e.GetEFlattening();
- m_fEGravityConst = e.m_fEGravityConst;
- m_fXOffset = e.m_fXOffset;
- m_fYOffset = e.m_fYOffset;
- m_fZOffset = e.m_fZOffset;
- }
- void CQGISEllipsiodParams::Copy(CQGISEllipsiodParams & e)
- {
- m_lEID = e.GetEllipsioddType();
- m_szEName = e.GetellipsiodName();
- m_lEYear = e.GetEllipsiodYear();
- m_fEHalfMajorAxis = e.GetEHalfMajorAxis();
- m_fEHalfMinorAxis = e.GetEHalfMinorAxis();
- m_fEFlattening = e.GetEFlattening();
- m_fEGravityConst = e.m_fEGravityConst;
- m_fXOffset = e.m_fXOffset;
- m_fYOffset = e.m_fYOffset;
- m_fZOffset = e.m_fZOffset;
- }
- void CQGISEllipsiodParams::SetEHalfMajorAxis(double a)
- {
- if(a<6378100) return;
- m_fEHalfMajorAxis = a;
- }
- double CQGISEllipsiodParams::GetEHalfMajorAxis()
- {
- return m_fEHalfMajorAxis;
- }
- void CQGISEllipsiodParams::SetEHalfMinorAxis(double b)
- {
- if(b<6356000) return;
- m_fEHalfMinorAxis = b;
- }
- double CQGISEllipsiodParams::GetEHalfMinorAxis()
- {
- return m_fEHalfMinorAxis;
- }
- void CQGISEllipsiodParams::SetEFlattening(double flat)
- {
- if(flat>1/290) return;
- m_fEFlattening = flat;
- }
- double CQGISEllipsiodParams::GetEFlattening()
- {
- return m_fEFlattening;
- }
- void CQGISEllipsiodParams::SetEllipsiodName(CString szEllipsiodName)
- {
- m_szEName = szEllipsiodName;
- }
- CString CQGISEllipsiodParams::GetellipsiodName()
- {
- return m_szEName;
- }
- void CQGISEllipsiodParams::SetEllipsiodType(long lET)
- {
- if(lET<=ET_UNKNOWN || lET>ET_MAX) lET = ET_UNKNOWN;
- m_lEID = lET;
- }
- long CQGISEllipsiodParams::GetEllipsioddType()
- {
- return m_lEID;
- }
- void CQGISEllipsiodParams::SetellipsiodYear(long lYear)
- {
- m_lEYear = lYear;
- }
- long CQGISEllipsiodParams::GetEllipsiodYear()
- {
- return m_lEYear;
- }
- CString CQGISEllipsiodParams::ValToStr()
- {
- CString sz;
- sz.Empty();
- if(m_lEID != 0)
- {
- char * szEType = new char;
- switch(m_lEID)
- {
- case ET_KLSFSJ:
- szEType = "ET_KLSFSJ";
- break;
- case ET_IUGG75:
- szEType = "ET_IUGG75";
- break;
- case ET_USERDEF:
- szEType = "ET_USERDEF";
- break;
- case ET_WGS84:
- szEType = "ET_WGS84";
- break;
- default:
- szEType = "ET_KLSFSJ";
- break;
- }
- sz.Format("椭球类型:%s椭球确定时间:%d椭球名称:%s椭球常轴:%f椭球短轴:%f椭球扁率:%f椭球重力引力常数:%f椭球偏移:%f,%f,%f",
- szEType,m_lEYear,m_szEName,m_fEHalfMajorAxis,
- m_fEHalfMinorAxis,m_fEFlattening,m_fEGravityConst,m_fXOffset,m_fYOffset,m_fZOffset);
- }
- return sz;
- }
- void CQGISEllipsiodParams::DataSerialize(CArchive & ar)
- {
- if(ar.IsStoring())
- {
- ar<<m_lEID;
- ar<<m_lEYear;
- ar<<m_szEName;
- ar<<m_fEHalfMajorAxis;
- ar<<m_fEHalfMinorAxis;
- ar<<m_fEFlattening;
- ar<<m_fEFlattening;
- ar<<m_fXOffset;
- ar<<m_fYOffset;
- ar<<m_fZOffset;
- }
- else
- {
- ar>>m_lEID;
- ar>>m_lEYear;
- ar>>m_szEName;
- ar>>m_fEHalfMajorAxis;
- ar>>m_fEHalfMinorAxis;
- ar>>m_fEFlattening;
- ar>>m_fEFlattening;
- ar>>m_fXOffset;
- ar>>m_fYOffset;
- ar>>m_fZOffset;
- }
- }
- IMPLEMENT_SERIAL(CQGISEllipsiodParams,CObject,1)
- void CQGISEllipsiodParams::Serialize(CArchive & ar)
- {
- if(ar.IsStoring())
- {
- ar.Write(&m_lEID,sizeof(long));
- ar.Write(&m_lEYear,sizeof(long));
- ar.Write(&m_fEHalfMajorAxis,sizeof(float));
- ar.Write(&m_fEHalfMinorAxis,sizeof(float));
- ar.Write(&m_fEFlattening,sizeof(float));
- ar.Write(&m_fEGravityConst,sizeof(float));
- ar.Write(&m_fXOffset,sizeof(float));
- ar.Write(&m_fYOffset,sizeof(float));
- ar.Write(&m_fZOffset,sizeof(float));
- int i = m_szEName.GetLength();
- ar.Write(&i,sizeof(int));
- ar.Write((const char *)m_szEName,i);
- }
- else
- {
- ar.Read(&m_lEID,sizeof(long));
- ar.Read(&m_lEYear,sizeof(long));
- ar.Read(&m_fEHalfMajorAxis,sizeof(float));
- ar.Read(&m_fEHalfMinorAxis,sizeof(float));
- ar.Read(&m_fEFlattening,sizeof(float));
- ar.Read(&m_fEGravityConst,sizeof(float));
- ar.Read(&m_fXOffset,sizeof(float));
- ar.Read(&m_fYOffset,sizeof(float));
- ar.Read(&m_fZOffset,sizeof(float));
- int i = 0;
- ar.Read(&i,sizeof(int));
- char szName[255];
- ar.Read(szName,i);
- szName[i] = ' ';
- m_szEName = CString(szName);
- }
- }
- bool CQGISEllipsiodParams::operator ==(CQGISEllipsiodParams & e)
- {
- if(m_lEID == e.GetEllipsioddType() &&
- m_lEYear == e.GetEllipsiodYear() &&
- m_szEName == e.GetellipsiodName() &&
- m_fEHalfMajorAxis == e.GetEHalfMajorAxis() &&
- m_fEHalfMinorAxis == e.m_fEHalfMinorAxis &&
- m_fEGravityConst == e.m_fEGravityConst &&
- m_fEFlattening == e.GetEFlattening() &&
- m_fXOffset == e.m_fXOffset &&
- m_fYOffset == e.m_fYOffset &&
- m_fZOffset == e.m_fZOffset)
- return true;
- else
- return false;
- }
- //////////////////////////////////////////////////////////////////////////
- CQGISMapProjectionParams::CQGISMapProjectionParams()
- {
- m_lMID = 1;
- m_szMName = "Gauss投影";
- m_dMLatitude_Of_False_Origin = 0;//原点纬度
- m_dMLongitude_Of_False_Origin = 114*PI/180;//中央经度
- m_dMLatitude_Of_1st_Standard_Parallel = 20*PI/180;//第1标准纬线
- m_dMLatitude_Of_2nd_Standard_Parallel = 40*PI/180;//第2标准纬线
- m_dMEasting_At_False_Origin = 0;
- m_dMNorthing_At_False_Origin = 0;
- m_dMLatitude_Of_Projection_Centre = 0;
- m_dMLongitude_Of_Projection_Centre = 0;
- m_dMScale_Factor_On_Initial_Line = 1;
- m_dMAzimuth_Of_Initial_Line = 0;
- m_dMAngle_From_Rectified_To_Skewed_Grid = 0;
- m_dMEasting_At_Projection_Centre = 0;
- m_dMNorthing_At_Projection_Centre = 0;
- m_dMLatitude_Of_Natural_Origin = 0;
- m_dMLongitude_Of_Natural_Origin = 0;
- m_dMScale_Factor_At_Natural_Origin = 0;
- m_dMFalse_Easting = 0;
- m_dMFalse_Northing = 0;
- }
- CQGISMapProjectionParams::CQGISMapProjectionParams(CQGISMapProjectionParams & e)
- {
- m_lMID = e.GetMapProjectionType();
- m_szMName = e.m_szMName;
- m_dMLatitude_Of_False_Origin = e.GetLatitudeOfFalseOrigin();
- m_dMLongitude_Of_False_Origin = e.GetLongitudeOfFalseOrigin();
- m_dMLatitude_Of_1st_Standard_Parallel = e.GetLatitudeOf1stStandardParallel();
- m_dMLatitude_Of_2nd_Standard_Parallel = e.GetLatitudeOf2ndStandardParallel();
- m_dMEasting_At_False_Origin = e.GetEastingAtFalseOrigin();
- m_dMNorthing_At_False_Origin = e.GetNorthingAtFalseOrigin();
- m_dMLatitude_Of_Projection_Centre = e.m_dMLatitude_Of_Projection_Centre;
- m_dMLongitude_Of_Projection_Centre = e.m_dMLongitude_Of_Projection_Centre;
- m_dMScale_Factor_On_Initial_Line = e.m_dMScale_Factor_On_Initial_Line;
- m_dMAzimuth_Of_Initial_Line = e.m_dMAzimuth_Of_Initial_Line;
- m_dMAngle_From_Rectified_To_Skewed_Grid = e.m_dMAngle_From_Rectified_To_Skewed_Grid;
- m_dMEasting_At_Projection_Centre = e.m_dMEasting_At_Projection_Centre;
- m_dMNorthing_At_Projection_Centre = e.m_dMNorthing_At_Projection_Centre;
- m_dMLatitude_Of_Natural_Origin = e.m_dMLatitude_Of_Natural_Origin;
- m_dMLongitude_Of_Natural_Origin = e.m_dMLongitude_Of_Natural_Origin;
- m_dMScale_Factor_At_Natural_Origin = e.m_dMScale_Factor_At_Natural_Origin;
- m_dMFalse_Easting = e.m_dMFalse_Easting;
- m_dMFalse_Northing = e.m_dMFalse_Northing;
- }
- CQGISMapProjectionParams CQGISMapProjectionParams::operator =(CQGISMapProjectionParams & e)
- {
- m_lMID = e.m_lMID;
- m_szMName = e.m_szMName;
- m_dMLatitude_Of_False_Origin = e.m_dMLatitude_Of_False_Origin;
- m_dMLongitude_Of_False_Origin = e.m_dMLongitude_Of_False_Origin;
- m_dMLatitude_Of_1st_Standard_Parallel = e.m_dMLatitude_Of_1st_Standard_Parallel;
- m_dMLatitude_Of_2nd_Standard_Parallel = e.m_dMLatitude_Of_2nd_Standard_Parallel;
- m_dMEasting_At_False_Origin = e.m_dMEasting_At_False_Origin;
- m_dMNorthing_At_False_Origin = e.m_dMNorthing_At_False_Origin;
- m_dMLatitude_Of_Projection_Centre = e.m_dMLatitude_Of_Projection_Centre;
- m_dMLongitude_Of_Projection_Centre = e.m_dMLongitude_Of_Projection_Centre;
- m_dMScale_Factor_On_Initial_Line = e.m_dMScale_Factor_On_Initial_Line;
- m_dMAzimuth_Of_Initial_Line = e.m_dMAzimuth_Of_Initial_Line;
- m_dMAngle_From_Rectified_To_Skewed_Grid = e.m_dMAngle_From_Rectified_To_Skewed_Grid;
- m_dMEasting_At_Projection_Centre = e.m_dMEasting_At_Projection_Centre;
- m_dMNorthing_At_Projection_Centre = e.m_dMNorthing_At_Projection_Centre;
- m_dMLatitude_Of_Natural_Origin = e.m_dMLatitude_Of_Natural_Origin;
- m_dMLongitude_Of_Natural_Origin = e.m_dMLongitude_Of_Natural_Origin;
- m_dMScale_Factor_At_Natural_Origin = e.m_dMScale_Factor_At_Natural_Origin;
- m_dMFalse_Easting = e.m_dMFalse_Easting;
- m_dMFalse_Northing = e.m_dMFalse_Northing;
- return *this;
- }
- bool CQGISMapProjectionParams::operator == (CQGISMapProjectionParams & e)
- {
- if(
- m_lMID == e.m_lMID &&
- m_szMName == e.m_szMName &&
- m_dMLatitude_Of_False_Origin == e.m_dMLatitude_Of_False_Origin &&
- m_dMLongitude_Of_False_Origin == e.m_dMLongitude_Of_False_Origin &&
- m_dMLatitude_Of_1st_Standard_Parallel == e.m_dMLatitude_Of_1st_Standard_Parallel &&
- m_dMLatitude_Of_2nd_Standard_Parallel == e.m_dMLatitude_Of_2nd_Standard_Parallel &&
- m_dMEasting_At_False_Origin == e.m_dMEasting_At_False_Origin &&
- m_dMNorthing_At_False_Origin == e.m_dMNorthing_At_False_Origin &&
- m_dMLatitude_Of_Projection_Centre == e.m_dMLatitude_Of_Projection_Centre &&
- m_dMLongitude_Of_Projection_Centre == e.m_dMLongitude_Of_Projection_Centre &&
- m_dMScale_Factor_On_Initial_Line == e.m_dMScale_Factor_On_Initial_Line &&
- m_dMAzimuth_Of_Initial_Line == e.m_dMAzimuth_Of_Initial_Line &&
- m_dMAngle_From_Rectified_To_Skewed_Grid == e.m_dMAngle_From_Rectified_To_Skewed_Grid &&
- m_dMEasting_At_Projection_Centre == e.m_dMEasting_At_Projection_Centre &&
- m_dMNorthing_At_Projection_Centre == e.m_dMNorthing_At_Projection_Centre &&
- m_dMLatitude_Of_Natural_Origin == e.m_dMLatitude_Of_Natural_Origin &&
- m_dMLongitude_Of_Natural_Origin == e.m_dMLongitude_Of_Natural_Origin &&
- m_dMScale_Factor_At_Natural_Origin == e.m_dMScale_Factor_At_Natural_Origin &&
- m_dMFalse_Easting == e.m_dMFalse_Easting &&
- m_dMFalse_Northing == e.m_dMFalse_Northing)
- return true;
- return false;
- }
- IMPLEMENT_SERIAL(CQGISMapProjectionParams,CObject,1)
- void CQGISMapProjectionParams::Serialize(CArchive & ar)
- {
- if(ar.IsStoring())
- {
- ar<<m_lMID;
- ar<<m_szMName;
- ar<<m_dMLatitude_Of_False_Origin;
- ar<<m_dMLongitude_Of_False_Origin;
- ar<<m_dMLatitude_Of_1st_Standard_Parallel;
- ar<<m_dMLatitude_Of_2nd_Standard_Parallel;
- ar<<m_dMEasting_At_False_Origin;
- ar<<m_dMNorthing_At_False_Origin;
- ar<<m_dMLatitude_Of_Projection_Centre;
- ar<<m_dMLongitude_Of_Projection_Centre;
- ar<<m_dMScale_Factor_On_Initial_Line;
- ar<<m_dMAzimuth_Of_Initial_Line;
- ar<<m_dMAngle_From_Rectified_To_Skewed_Grid;
- ar<<m_dMEasting_At_Projection_Centre;
- ar<<m_dMNorthing_At_Projection_Centre;
- ar<<m_dMLatitude_Of_Natural_Origin;
- ar<<m_dMLongitude_Of_Natural_Origin;
- ar<<m_dMScale_Factor_At_Natural_Origin;
- ar<<m_dMFalse_Easting;
- ar<<m_dMFalse_Northing;
- }
- else
- {
- ar>>m_lMID;
- ar>>m_szMName;
- ar>>m_dMLatitude_Of_False_Origin;
- ar>>m_dMLongitude_Of_False_Origin;
- ar>>m_dMLatitude_Of_1st_Standard_Parallel;
- ar>>m_dMLatitude_Of_2nd_Standard_Parallel;
- ar>>m_dMEasting_At_False_Origin;
- ar>>m_dMNorthing_At_False_Origin;
- ar>>m_dMLatitude_Of_Projection_Centre;
- ar>>m_dMLongitude_Of_Projection_Centre;
- ar>>m_dMScale_Factor_On_Initial_Line;
- ar>>m_dMAzimuth_Of_Initial_Line;
- ar>>m_dMAngle_From_Rectified_To_Skewed_Grid;
- ar>>m_dMEasting_At_Projection_Centre;
- ar>>m_dMNorthing_At_Projection_Centre;
- ar>>m_dMLatitude_Of_Natural_Origin;
- ar>>m_dMLongitude_Of_Natural_Origin;
- ar>>m_dMScale_Factor_At_Natural_Origin;
- ar>>m_dMFalse_Easting;
- ar>>m_dMFalse_Northing;
- }
- }
- long CQGISMapProjectionParams::GetMapProjectionType()
- {
- return m_lMID;
- }
- void CQGISMapProjectionParams::SetMapProjectionType(long nType)
- {
- if(nType>=MPT_MAX || nType<MPT_UNKNOWN)nType = MPT_UNKNOWN;
- m_lMID = nType;
- }
- bool CQGISMapProjectionParams::SetLatitudeOf1stStandardParallel(double B1)
- {
- if(B1<-PI/2.0 || B1>PI/2)return false;
- m_dMLatitude_Of_1st_Standard_Parallel = B1;
- return true;
- }
- bool CQGISMapProjectionParams::SetLatitudeOf2ndStandardParallel(double B2)
- {
- if(B2<-PI/2.0 || B2>PI/2)return false;
- m_dMLatitude_Of_2nd_Standard_Parallel = B2;
- return true;
- }
- bool CQGISMapProjectionParams::SetLongitudeOfFalseOrigin(double L0)//中央经度
- {
- if(L0<-PI || L0>PI)return false;
- m_dMLongitude_Of_False_Origin = L0;
- return true;
- }
- bool CQGISMapProjectionParams::SetLatitudeOfFalseOrigin(double B0)//原点纬度
- {
- if(B0<-PI/2.0 || B0>PI/2)return false;
- m_dMLatitude_Of_False_Origin = B0;
- return true;
- }
- bool CQGISMapProjectionParams::SetEastingAtFalseOrigin(double dEF)//东伪偏移
- {
- m_dMEasting_At_False_Origin = dEF;
- return true;
- }
- bool CQGISMapProjectionParams::SetNorthingAtFalseOrigin(double dNF)//北纬偏移
- {
- m_dMNorthing_At_False_Origin = dNF;
- return true;
- }
- double CQGISMapProjectionParams::GetLatitudeOf1stStandardParallel()
- {
- return m_dMLatitude_Of_1st_Standard_Parallel;
- }
- double CQGISMapProjectionParams::GetLatitudeOf2ndStandardParallel()
- {
- return m_dMLatitude_Of_2nd_Standard_Parallel;
- }
- double CQGISMapProjectionParams::GetLongitudeOfFalseOrigin()//中央经度
- {
- return m_dMLongitude_Of_False_Origin;
- }
- double CQGISMapProjectionParams::GetLatitudeOfFalseOrigin()//原点纬度
- {
- return m_dMLatitude_Of_False_Origin;
- }
- double CQGISMapProjectionParams::GetEastingAtFalseOrigin()//东伪偏移
- {
- return m_dMEasting_At_False_Origin;
- }
- double CQGISMapProjectionParams::GetNorthingAtFalseOrigin()//北纬偏移
- {
- return m_dMNorthing_At_False_Origin;
- }
- //////////////////////////////////////////////////////////////////////////
- CQGISDatumPlaneParams::CQGISDatumPlaneParams()
- {
- m_szName = "1985国家高程基准";//基准面名称
- m_lEllipsoid = ET_KLSFSJ;//Ellipsoid为基准面采用的椭球体的ID号
- //ShiftX, ShiftY, ShiftZ为平移参数
- m_dShiftX = 0;
- m_dShiftY = 0;
- m_dShiftZ = 0;
- //RotateX, RotateY, RotateZ为旋转参数;
- m_dRotateX = 1;
- m_dRotateY = 1;
- m_dRotateZ = 1;
- //ScaleAdjust为比例校正因子,以百万分之一计
- m_dScaleAdjust = 1;
- //PrimeMeridian为本初子午线经度,在我国取0,表示经度从格林威治起算
- m_dPrimeMeridian = 0;//弧度
- }
- CQGISDatumPlaneParams::~CQGISDatumPlaneParams()
- {
- }
- CQGISDatumPlaneParams::CQGISDatumPlaneParams(CQGISDatumPlaneParams & e)
- {
- m_szName = e.m_szName;//基准面名称
- m_lEllipsoid = e.m_lEllipsoid;//Ellipsoid为基准面采用的椭球体的ID号
- //ShiftX, ShiftY, ShiftZ为平移参数
- m_dShiftX = e.m_dShiftX;
- m_dShiftY = e.m_dShiftY;
- m_dShiftZ = e.m_dShiftZ;
- //RotateX, RotateY, RotateZ为旋转参数;
- m_dRotateX = e.m_dRotateX;
- m_dRotateY = e.m_dRotateY;
- m_dRotateZ = e.m_dRotateZ;
- //ScaleAdjust为比例校正因子,以百万分之一计
- m_dScaleAdjust = e.m_dScaleAdjust;
- //PrimeMeridian为本初子午线经度,在我国取0,表示经度从格林威治起算
- m_dPrimeMeridian = e.m_dPrimeMeridian;//弧度
- }
- CQGISDatumPlaneParams CQGISDatumPlaneParams::operator=(CQGISDatumPlaneParams & e)
- {
- m_szName = e.m_szName;//基准面名称
- m_lEllipsoid = e.m_lEllipsoid;//Ellipsoid为基准面采用的椭球体的ID号
- //ShiftX, ShiftY, ShiftZ为平移参数
- m_dShiftX = e.m_dShiftX;
- m_dShiftY = e.m_dShiftY;
- m_dShiftZ = e.m_dShiftZ;
- //RotateX, RotateY, RotateZ为旋转参数;
- m_dRotateX = e.m_dRotateX;
- m_dRotateY = e.m_dRotateY;
- m_dRotateZ = e.m_dRotateZ;
- //ScaleAdjust为比例校正因子,以百万分之一计
- m_dScaleAdjust = e.m_dScaleAdjust;
- //PrimeMeridian为本初子午线经度,在我国取0,表示经度从格林威治起算
- m_dPrimeMeridian = e.m_dPrimeMeridian;//弧度
- return *this;
- }
- bool CQGISDatumPlaneParams::operator==(CQGISDatumPlaneParams & e)
- {
- if(
- m_szName == e.m_szName &&
- m_lEllipsoid == e.m_lEllipsoid &&
- m_dShiftX == e.m_dShiftX &&
- m_dShiftY == e.m_dShiftY &&
- m_dShiftZ == e.m_dShiftZ &&
- m_dRotateX == e.m_dRotateX &&
- m_dRotateY == e.m_dRotateY &&
- m_dRotateZ == e.m_dRotateZ &&
- m_dScaleAdjust == e.m_dScaleAdjust &&
- m_dPrimeMeridian == e.m_dPrimeMeridian
- )
- return true;
- return false;
- }
- IMPLEMENT_SERIAL(CQGISDatumPlaneParams,CObject,1)
- void CQGISDatumPlaneParams::Serialize(CArchive & ar)
- {
- if(ar.IsStoring())
- {
- ar<< m_szName;//基准面名称
- ar<< m_lEllipsoid;//Ellipsoid为基准面采用的椭球体的ID号
- //ShiftX, ShiftY, ShiftZ为平移参数
- ar<< m_dShiftX;
- ar<< m_dShiftY;
- ar<< m_dShiftZ;
- //RotateX, RotateY, RotateZ为旋转参数;
- ar<< m_dRotateX;
- ar<< m_dRotateY;
- ar<< m_dRotateZ;
- //ScaleAdjust为比例校正因子,以百万分之一计
- ar<< m_dScaleAdjust;
- //PrimeMeridian为本初子午线经度,在我国取0,表示经度从格林威治起算
- ar<< m_dPrimeMeridian;//弧度
- }
- else
- {
- ar>> m_szName;//基准面名称
- ar>> m_lEllipsoid;//Ellipsoid为基准面采用的椭球体的ID号
- //ShiftX, ShiftY, ShiftZ为平移参数
- ar>> m_dShiftX;
- ar>> m_dShiftY;
- ar>> m_dShiftZ;
- //RotateX, RotateY, RotateZ为旋转参数;
- ar>> m_dRotateX;
- ar>> m_dRotateY;
- ar>> m_dRotateZ;
- //ScaleAdjust为比例校正因子,以百万分之一计
- ar>> m_dScaleAdjust;
- //PrimeMeridian为本初子午线经度,在我国取0,表示经度从格林威治起算
- ar>> m_dPrimeMeridian;//弧度
- }
- }
- //////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////
- //坐标系统
- CQGISGeoCoordSysParams::CQGISGeoCoordSysParams(enumQGISCoordSysType csType)
- {
- switch(csType)
- {
- case CST_BEIJING54:
- {
- m_enumCoordSysType = CST_BEIJING54;
- A = 6378245.0;
- Alfa = 1.0/298.3 ;
- E2 = 0.00669342162296594 ;
- UTM = 1.0 ;
- DN = 0.0 ;
- X0 = 0.0 ;
- Y0 = 0.0 ;
- H0 = 0.0;
- L0 = 111.0/180*PI;
- break;
- }
- case CST_XIAN80:
- {
- m_enumCoordSysType = CST_XIAN80;
- A=6378140.0;
- Alfa = 1.0/298.257;
- E2 = 0.006694384999588 ;
- UTM = 1.0 ;
- DN = 0.0 ;
- X0 = 0.0 ;
- Y0 = 0.0 ;
- H0 = 0.0;
- L0 = 111.0/180*PI;
- break;
- }
- case CST_WGS84:
- {
- m_enumCoordSysType = CST_WGS84;
- A = 6378137.0;
- Alfa = 1.0/298.257223563 ;
- E2 = 0.00669437999014132 ;
- UTM = 1.0 ;
- DN = 0.0 ;
- X0 = 0.0 ;
- Y0 = 0.0 ;
- H0 = 0.0;
- L0 = 111.0/180*PI;
- break;
- }
- default:
- {
- m_enumCoordSysType = CST_BEIJING54;
- A = 6378245.0;
- Alfa = 1.0/298.3 ;
- E2 = 0.00669342162296594 ;
- UTM = 1.0 ;
- DN = 0.0 ;
- X0 = 0.0 ;
- Y0 = 0.0 ;
- H0 = 0.0;
- L0 = 111.0/180*PI;
- break;
- }
- }
- }
- CQGISGeoCoordSysParams::~CQGISGeoCoordSysParams(void)
- {
- }
- //设置坐标系统类型: 1,北京54坐标系; 2,西安80坐标系; 3,WGS 84坐标系
- void CQGISGeoCoordSysParams::SetCoordSysType(enumQGISCoordSysType csType)
- {
- switch(csType)
- {
- case CST_BEIJING54:
- {
- m_enumCoordSysType = CST_BEIJING54;
- A = 6378245.0;
- Alfa = 1.0/298.3 ;
- E2 = 0.00669342162296594 ;
- UTM = 1.0 ;
- DN = 0.0 ;
- X0 = 0.0 ;
- Y0 = 0.0 ;
- H0 = 0.0;
- L0 = 111.0/180*PI;
- break;
- }
- case CST_XIAN80:
- {
- m_enumCoordSysType = CST_XIAN80;
- A=6378140.0;
- Alfa = 1.0/298.257;
- E2 = 0.006694384999588 ;
- UTM = 1.0 ;
- DN = 0.0 ;
- X0 = 0.0 ;
- Y0 = 0.0 ;
- H0 = 0.0;
- L0 = 111.0/180*PI;
- break;
- }
- case CST_WGS84:
- {
- m_enumCoordSysType = CST_WGS84;
- A = 6378137.0;
- Alfa = 1.0/298.257223563 ;
- E2 = 0.00669437999014132 ;
- UTM = 1.0 ;
- DN = 0.0 ;
- X0 = 0.0 ;
- Y0 = 0.0 ;
- H0 = 0.0;
- L0 = 111.0/180*PI;
- break;
- }
- default:
- {
- m_enumCoordSysType = CST_BEIJING54;
- A = 6378245.0;
- Alfa = 1.0/298.3 ;
- E2 = 0.00669342162296594 ;
- UTM = 1.0 ;
- DN = 0.0 ;
- X0 = 0.0 ;
- Y0 = 0.0 ;
- H0 = 0.0;
- L0 = 111.0/180*PI;
- break;
- }
- }
- }
- //获取坐标系统类型: 1,北京54坐标系; 2,西安80坐标系; 3,WGS 84坐标系
- enumQGISCoordSysType CQGISGeoCoordSysParams::GetCoordSysType()
- {
- return m_enumCoordSysType;
- }
- //////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////
- ///***************CQGIS****************///
- ///函数名称:CQCoordSys
- ///返回类型:无
- ///入口参数:无
- ///出口参数:无
- ///思路说明:构造函数
- ///***************CQGIS****************///
- //////////////////////////////////////////
- CQCoordSys::CQCoordSys()
- {
- m_nMapMode = MM_TEXT; //Windows默认的映射模式
- //设备坐标与逻辑坐标之间的映射模式
- m_ptViewportOrg = CPoint(0,0); //视口原点放在(0,0)点
- m_sizeViewportSize = CSize(100,100); //视口范围
- m_ptWndportOrg = CPoint(0,0);
- m_sizeWndportSize = CSize(100,100);
- //世界坐标系下的START点在逻辑坐标下的值
- m_lStartX = 0;
- m_lStartY = m_ptWndportOrg.y + m_sizeWndportSize.cy;
- //逻辑坐标系统与世界坐标系统的映射模式
- m_nWorldMapMode = WMM_NORMAL;
- //世界坐标系统的旋转角度,只有当m_nWorldMapMode=WMM_AXIS_ROTATE时候起作用
- m_dRotateAngle = 0.0; //表示度数0-360
- m_wStartX = 0;
- m_wStartY = 0;
- //逻辑坐标的X轴上一米相当于m_dLogicalUnitsPtrMeterX逻辑单位
- m_dLogicalUnitsPtrMeterX = 96/0.0254;
- m_dLogicalUnitsPtrMeterY = m_dLogicalUnitsPtrMeterX;
- m_dMapScale = 1; //地图比例尺分母
- m_dDispScale = 1; //显示比例1:1
- m_nUnitType = 0; //系统单位
- }
- CQCoordSys::~CQCoordSys()
- {
- }
- CQCoordSys::CQCoordSys(CQCoordSys & CS)
- {
- m_nMapMode = CS.GetQMapMode();
- //设备坐标参数
- m_ptViewportOrg = CS.GetViewportOrg();
- m_sizeViewportSize = CS.GetViewportSize();
- //窗口坐标参数
- m_ptWndportOrg = CS.GetWndportOrg();
- m_sizeWndportSize = CS.GetWndportSize();
- //世界坐标参数
- //在世界坐标系统下用于显示图形的起点坐标
- CS.GetStartOfWorld(m_wStartX,m_wStartY);
- //逻辑坐标系统与世界坐标系统的映射模式
- m_nWorldMapMode = (enumQGISWorldMapMode)CS.GetWorldMapMode();
- //世界坐标的旋转
- m_dRotateAngle = CS.GetRotateAngle();
- //世界坐标系下用于显示图形的起点坐标在逻辑坐标下的值
- CS.GetStartOfWnd(m_lStartX,m_lStartY);
- CS.GetLogicalUnitsPtrMeter(m_dLogicalUnitsPtrMeterX,m_dLogicalUnitsPtrMeterY);
- m_dMapScale = CS.GetMapScale();
- m_dDispScale = CS.GetDisplayScale();
- }
- CQCoordSys CQCoordSys::operator =(CQCoordSys & CS)
- {
- m_nMapMode = CS.GetQMapMode();
- //设备坐标参数
- m_ptViewportOrg = CS.GetViewportOrg();
- m_sizeViewportSize = CS.GetViewportSize();
- //窗口坐标参数
- m_ptWndportOrg = CS.GetWndportOrg();
- m_sizeWndportSize = CS.GetWndportSize();
- //世界坐标参数
- //在世界坐标系统下用于显示图形的起点坐标
- CS.GetStartOfWorld(m_wStartX,m_wStartY);
- //逻辑坐标系统与世界坐标系统的映射模式
- m_nWorldMapMode = (enumQGISWorldMapMode)CS.GetWorldMapMode();
- //世界坐标的旋转
- m_dRotateAngle = CS.GetRotateAngle();
- //世界坐标系下用于显示图形的起点坐标在逻辑坐标下的值
- CS.GetStartOfWnd(m_lStartX,m_lStartY);
- CS.GetLogicalUnitsPtrMeter(m_dLogicalUnitsPtrMeterX,m_dLogicalUnitsPtrMeterY);
- m_dMapScale = CS.GetMapScale();
- m_dDispScale = CS.GetDisplayScale();
- return *this;
- }
- bool CQCoordSys::operator==(CQCoordSys & CS)
- {
- if(m_nMapMode==CS.GetQMapMode() &&
- m_ptViewportOrg==CS.GetViewportOrg()&&
- m_sizeViewportSize==CS.GetViewportSize()&&
- m_ptWndportOrg==CS.GetWndportOrg()&&
- m_sizeWndportSize==CS.GetWndportSize()&&
- m_lStartX==CS.GetStartXOfWnd()&&
- m_lStartY==CS.GetStartYOfWnd()&&
- m_nWorldMapMode==(enumQGISWorldMapMode)CS.GetWorldMapMode()&&
- m_dRotateAngle==CS.GetRotateAngle()&&
- m_wStartX==CS.GetStartXOfWorld()&&
- m_wStartY==CS.GetStartYOfWorld()&&
- m_EllipsiodParams==CS.GetEllipsiodParams()&&
- m_MapProjectionParams==CS.GetMapProjectionParams()&&
- m_DatumPaneParams==CS.GetDatumPlaneParams()&&
- m_nUnitType==CS.GetUnitType()&& //系统单位:0-M,1-CM,2-MM,3-INCH,4-KM,5-dms, 6-度
- m_dLogicalUnitsPtrMeterX==CS.GetLogicalUintsPtrMeterX()&&//逻辑坐标的X轴上一米相当于m_dLogicalUnitsPtrMeterX逻辑单位
- m_dLogicalUnitsPtrMeterY==CS.GetLogicalUintsPtrMeterY()&&//逻辑坐标的Y轴上一米相当于m_dLogicalUnitsPtrMeterY逻辑单位
- m_dMapScale==CS.GetMapScale()&&//地图比例尺分母
- m_dDispScale==CS.GetDisplayScale())//地图显示比例,既将图纸放大m_dDispScale倍
- return true;
- else
- return false;
- }
- double CQCoordSys::GetLogicalUintsPtrMeterX()
- {
- return m_dLogicalUnitsPtrMeterX;
- }
- double CQCoordSys::GetLogicalUintsPtrMeterY()
- {
- return m_dLogicalUnitsPtrMeterY;
- }
- void CQCoordSys::Copy(CQCoordSys & CS)
- {
- m_nMapMode = CS.GetQMapMode();
- //设备坐标参数
- m_ptViewportOrg = CS.GetViewportOrg();
- m_sizeViewportSize = CS.GetViewportSize();
- //窗口坐标参数
- m_ptWndportOrg = CS.GetWndportOrg();
- m_sizeWndportSize = CS.GetWndportSize();
- //世界坐标参数
- //在世界坐标系统下用于显示图形的起点坐标
- CS.GetStartOfWorld(m_wStartX,m_wStartY);
- //逻辑坐标系统与世界坐标系统的映射模式
- m_nWorldMapMode = (enumQGISWorldMapMode)CS.GetWorldMapMode();
- //世界坐标的旋转
- m_dRotateAngle = CS.GetRotateAngle();
- //世界坐标系下用于显示图形的起点坐标在逻辑坐标下的值
- CS.GetStartOfWnd(m_lStartX,m_lStartY);
- CS.GetLogicalUnitsPtrMeter(m_dLogicalUnitsPtrMeterX,m_dLogicalUnitsPtrMeterY);
- m_dMapScale = CS.GetMapScale();
- m_dDispScale = CS.GetDisplayScale();
- }
- inline long CQCoordSys::GetStartXOfWnd()
- {
- return m_lStartX;
- }
- inline long CQCoordSys::GetStartYOfWnd()
- {
- return m_lStartY;
- }
- inline double CQCoordSys::GetStartXOfWorld()
- {
- return m_wStartX;
- }
- inline double CQCoordSys::GetStartYOfWorld()
- {
- return m_wStartY;
- }
- inline void CQCoordSys::SetQMapMode(int nMapMode)
- {
- m_nMapMode = nMapMode;
- }
- inline int CQCoordSys::GetQMapMode() const
- {
- return m_nMapMode;
- }
- void CQCoordSys::SetViewportOrg(long x,long y)
- {
- m_ptViewportOrg = CPoint(x,y);
- }
- void CQCoordSys::SetViewportOrg(CPoint & pt)
- {
- m_ptViewportOrg = pt;
- }
- inline CPoint CQCoordSys::GetViewportOrg()
- {
- return m_ptViewportOrg;
- }
- void CQCoordSys::SetViewport(long x,long y,long cx,long cy)
- {
- m_ptViewportOrg = CPoint(x,y);
- m_sizeViewportSize = CSize(cx,cy);
- }
- inline void CQCoordSys::GetViewport(long &x,long &y,long &cx,long &cy)
- {
- x = m_ptViewportOrg.x;
- y = m_ptViewportOrg.y;
- cx = m_sizeViewportSize.cx;
- cy = m_sizeViewportSize.cy;
- }
- void CQCoordSys::SetViewportSize(long cx,long cy)
- {
- m_sizeViewportSize = CSize(cx,cy);
- }
- void CQCoordSys::SetViewportSize(CSize size)
- {
- m_sizeViewportSize = size;
- }
- inline CSize CQCoordSys::GetViewportSize()
- {
- return m_sizeViewportSize;
- }
- inline void CQCoordSys::SetWndportOrg(long x,long y)
- {
- m_ptWndportOrg = CPoint(x,y);
- }
- inline void CQCoordSys::SetWndportOrg(CPoint & pt)
- {
- m_ptWndportOrg = pt;
- }
- inline CPoint CQCoordSys::GetWndportOrg()
- {
- return m_ptWndportOrg;
- }
- void CQCoordSys::SetWndport(long x,long y,long cx,long cy)
- {
- m_ptWndportOrg = CPoint(x,y);
- m_sizeWndportSize = CSize(cx,cy);
- }
- void CQCoordSys::GetWndport(long &x,long &y,long &cx,long &cy)
- {
- x = m_ptWndportOrg.x;
- y = m_ptWndportOrg.y;
- cx = m_sizeWndportSize.cx;
- cy = m_sizeWndportSize.cy;
- }
- void CQCoordSys::SetWndportSize(long cx,long cy)
- {
- m_sizeWndportSize = CSize(cx,cy);
- }
- void CQCoordSys::SetWndportSize(CSize size)
- {
- m_sizeWndportSize = size;
- }
- inline CSize CQCoordSys::GetWndportSize()
- {
- return m_sizeWndportSize;
- }
- inline void CQCoordSys::SetStartOfWnd(long x,long y)
- {
- m_lStartX = x;
- m_lStartY = y;
- }
- inline void CQCoordSys::GetStartOfWnd(long &x,long &y)
- {
- x = m_lStartX;
- y = m_lStartY;
- }
- inline UINT CQCoordSys::GetWorldMapMode() const
- {
- return m_nWorldMapMode;
- }
- inline void CQCoordSys::SetWorldMapMode(UINT wWorldMapMode /* = WMM_NORMAL */)
- {
- m_nWorldMapMode = (enumQGISWorldMapMode)wWorldMapMode;
- }
- inline double CQCoordSys::CalWorldScale()
- {
- double scale = m_dMapScale/(m_dLogicalUnitsPtrMeterX*m_dDispScale);
- //0-M,1-CM,2-MM,3-INCH,4-KM,5-dms, 6-度
- switch(m_nUnitType) //系统单位
- {
- case 0:
- break;
- case 1:
- scale/=100;
- break;
- case 2:
- scale/=1000;
- break;
- case 3:
- scale*=0.0254;
- break;
- case 4:
- scale*=1000;
- break;
- default:
- break;
- }
- return scale;
- }
- inline double CQCoordSys::GetWorldScale() const
- {
- double scale = m_dMapScale/(m_dLogicalUnitsPtrMeterX*m_dDispScale);
- //0-M,1-CM,2-MM,3-INCH,4-KM,5-dms, 6-度
- switch(m_nUnitType) //系统单位
- {
- case 0:
- break;
- case 1:
- scale/=100;
- break;
- case 2:
- scale/=1000;
- break;
- case 3:
- scale*=0.0254;
- break;
- case 4:
- scale*=1000;
- break;
- default:
- break;
- }
- return scale;
- }
- inline double CQCoordSys::GetDisplayScale() const
- {
- return m_dDispScale;
- }
- inline void CQCoordSys::SetDisplayScale(double DS)
- {
- m_dDispScale = DS;
- }
- inline void CQCoordSys::SetWorldScale(double fDisplayScale,double fMapScale)
- {
- m_dDispScale = fDisplayScale;
- m_dMapScale = fMapScale;
- }
- inline void CQCoordSys::SetWorldScale(double worldScale)
- {
- m_dDispScale = CalDispScale(worldScale);
- }
- inline double CQCoordSys::CalDispScale(double worldScale)
- {
- //0-M,1-CM,2-MM,3-INCH,4-KM,5-dms, 6-度
- switch(m_nUnitType)
- {
- case 0:
- break;
- case 1:
- worldScale*=100;
- break;
- case 2:
- worldScale*=1000;
- break;
- case 3:
- worldScale/=0.0254;
- break;
- case 4:
- worldScale/=1000;
- break;
- default:
- break;
- }
- return m_dMapScale/(worldScale*m_dLogicalUnitsPtrMeterX);
- }
- inline double CQCoordSys::GetMapScale() const
- {
- return m_dMapScale;
- }
- void CQCoordSys::SetMapScale(double fMapScale)
- {
- m_dMapScale = fMapScale;
- }
- inline void CQCoordSys::SetStartOfWorld(double x,double y)
- {
- m_wStartX = x;
- m_wStartY = y;
- }
- inline void CQCoordSys::GetStartOfWorld(double &x,double &y)
- {
- x = m_wStartX;
- y = m_wStartY;
- }
- inline void CQCoordSys::SetRotateAngle(double fRA)
- {
- m_dRotateAngle = fRA;
- }
- inline double CQCoordSys::GetRotateAngle()
- {
- return m_dRotateAngle;
- }
- CString CQCoordSys::GetUnitNameCHS()
- {
- //0-M,1-CM,2-MM,3-INCH,4-KM,5-dms, 6-度
- CString szUint;
- switch(m_nUnitType)
- {
- case 0:
- szUint = "米";
- break;
- case 1:
- szUint = "厘米";
- break;
- case 2:
- szUint = "毫米";
- break;
- case 3:
- szUint = "英尺";
- break;
- case 4:
- szUint = "公里";
- break;
- case 5:
- szUint = "度分秒";
- break;
- case 6:
- szUint = "度";
- break;
- default:
- break;
- }
- return szUint;
- }
- void CQCoordSys::SetUnitType(int it)
- {
- m_nUnitType = it;
- }
- inline int CQCoordSys::GetUnitType() const
- {
- return m_nUnitType;
- }
- CQGISEllipsiodParams & CQCoordSys::GetEllipsiodParams()
- {
- return m_EllipsiodParams;
- }
- CQGISMapProjectionParams & CQCoordSys::GetMapProjectionParams()
- {
- return m_MapProjectionParams;
- }
- CQGISDatumPlaneParams & CQCoordSys::GetDatumPlaneParams()
- {
- return m_DatumPaneParams;
- }
- void CQCoordSys::SetLogicalUnitsPtrMeter(double x,double y)
- {
- m_dLogicalUnitsPtrMeterX = x;
- m_dLogicalUnitsPtrMeterY = y;
- }
- void CQCoordSys::GetLogicalUnitsPtrMeter(double &x,double &y)
- {
- x = m_dLogicalUnitsPtrMeterX;
- y = m_dLogicalUnitsPtrMeterY;
- }
- IMPLEMENT_SERIAL(CQCoordSys,CObject,1)
- void CQCoordSys::Serialize(CArchive& ar)
- {
- if(ar.IsStoring())
- {
- ar<<m_nMapMode;
- ar<<m_ptViewportOrg;
- ar<<m_sizeViewportSize;
- ar<<m_ptWndportOrg;
- ar<<m_sizeWndportSize;
- ar<<m_lStartX;
- ar<<m_lStartY;
- ar<<m_wStartX;
- ar<<m_wStartY;
- ar<<(int)m_nWorldMapMode;
- ar<<m_dRotateAngle;
- ar<<m_nUnitType;
- ar<<m_dLogicalUnitsPtrMeterX;
- ar<<m_dLogicalUnitsPtrMeterY;
- ar<<m_dMapScale;
- ar<<m_dDispScale;
- }
- else
- {
- ar>>m_nMapMode;
- ar>>m_ptViewportOrg;
- ar>>m_sizeViewportSize;
- ar>>m_ptWndportOrg;
- ar>>m_sizeWndportSize;
- ar>>m_lStartX;
- ar>>m_lStartY;
- ar>>m_wStartX;
- ar>>m_wStartY;
- int nWorldMapMode = 0;
- ar>>nWorldMapMode;
- m_nWorldMapMode = (enumQGISWorldMapMode)nWorldMapMode;
- ar>>m_dRotateAngle;
- ar>>m_nUnitType;
- ar>>m_dLogicalUnitsPtrMeterX;
- ar>>m_dLogicalUnitsPtrMeterY;
- ar>>m_dMapScale;
- ar>>m_dDispScale;
- }
- m_EllipsiodParams.Serialize(ar);
- m_DatumPaneParams.Serialize(ar);
- m_MapProjectionParams.Serialize(ar);
- }
- void CQCoordSys::LPtoWP(long x,long y,double * wx,double * wy)
- {
- //转换公式
- //WMM_NORMAL MM_TEXT
- //(wx - m_wStartX)/GetWorldScale() = x - m_lStartX
- //(wy - m_wStartY)/GetWorldScale() = m_lStartY - y
- //wx = (x - m_lStartX)*GetWorldScale()+m_wStartX
- //wy = (m_lStartY - y)*GetWorldScale()+m_wStartY
- //WMM_X_AXIS_REVERSE
- //(m_wStartX - wx)/GetWorldScale() = x - m_lStartX
- //(wy - m_wStartY)/GetWorldScale() = m_lStartY - y
- if(m_nMapMode == MM_TEXT) //windows默认的逻辑坐标与设备坐标的映射模式
- {
- switch(m_nWorldMapMode)
- {
- case WMM_NORMAL: //正常
- {
- *wx = (x-m_lStartX)*GetWorldScale()+m_wStartX;
- *wy = (m_lStartY-y)*GetWorldScale()+m_wStartY;
- break;
- }
- case WMM_X_AXIS_REVERSE://X轴倒置
- {
- *wx = m_wStartX - (x-m_lStartX)*GetWorldScale();
- *wy = (m_lStartY-y)*GetWorldScale()+m_wStartY;
- break;
- }
- case WMM_Y_AXIS_REVERSE://Y轴倒置
- {
- *wx = (x-m_lStartX)*GetWorldScale()+m_wStartX;
- *wy = m_wStartY - (m_lStartY-y)*GetWorldScale();
- break;
- }
- case WMM_XY_AXIS_REVERSE://XY轴军倒置
- {
- *wx = m_wStartX - (x-m_lStartX)*GetWorldScale();
- *wy = m_wStartY - (m_lStartY-y)*GetWorldScale();
- break;
- }
- case WMM_AXIS_ROTATE:
- {
- AfxMessageBox("不支持!");
- break;
- }
- default:
- {
- *wx = (x-m_lStartX)*GetWorldScale()+m_wStartX;
- *wy = (m_lStartY-y)*GetWorldScale()+m_wStartY;
- break;
- }
- }
- }
- else
- //转换公式
- //WMM_NORMAL 非 MM_TEXT
- //(wx - m_wStartX)/GetWorldScale() = x - m_lStartX
- //(wy - m_wStartY)/GetWorldScale() = y - m_lStartY
- //wx = (x - m_lStartX)*GetWorldScale()+m_wStartX
- //wy = (y - m_lStartY)*GetWorldScale()+m_wStartY
- //WMM_X_AXIS_REVERSE
- //(m_wStartX - wx)/GetWorldScale() = x - m_lStartX
- //(wy - m_wStartY)/GetWorldScale() = y - m_lStartY
- {
- switch(m_nWorldMapMode)
- {
- case WMM_NORMAL:
- {
- *wx = (x - m_lStartX)*GetWorldScale()+m_wStartX;
- *wy = (y - m_lStartY)*GetWorldScale()+m_wStartY;
- break;
- }
- case WMM_X_AXIS_REVERSE: //X轴倒置
- {
- *wx = m_wStartX - (x-m_lStartX)*GetWorldScale();
- *wy = m_wStartY + (y-m_lStartY)*GetWorldScale();
- break;
- }
- case WMM_Y_AXIS_REVERSE://Y轴倒置
- {
- *wx = (x - m_lStartX)*GetWorldScale()+m_wStartX;
- *wy = m_wStartY - (y-m_lStartY)*GetWorldScale();
- break;
- }
- case WMM_XY_AXIS_REVERSE://XY轴倒置
- {
- *wx = m_wStartX - (x-m_lStartX)*GetWorldScale();
- *wy = m_wStartY - (y-m_lStartY)*GetWorldScale();
- break;
- }
- case WMM_AXIS_ROTATE:
- {
- AfxMessageBox("不支持!");
- break;
- }
- default:
- {
- *wx = (x - m_lStartX)*GetWorldScale()+m_wStartX;
- *wy = (y - m_lStartY)*GetWorldScale()+m_wStartY;
- break;
- }
- }
- }
- }
- void CQCoordSys::LPtoWP(CPoint pt,CQPoint * qpt)
- {
- double dx,dy;
- LPtoWP(pt.x,pt.y,&dx,&dy);
- qpt->SetPoint(dx,dy);
- }
- void CQCoordSys::LPtoWP(CRect rc,CBoundaryRect * pRect)
- {
- double x1,y1,x2,y2;
- LPtoWP(rc.left,rc.bottom,&x1,&y1);
- LPtoWP(rc.right,rc.top,&x2,&y2);
- pRect->SetLeftBottomX(min(x1,x2));
- pRect->SetLeftBottomY(min(y1,y2));
- pRect->SetRightTopX(max(x1,x2));
- pRect->SetRightTopY(max(y1,y2));
- }
- void CQCoordSys::WPtoLP(double wx,double wy,long *lx,long *ly)
- {
- //假如是Windows的默认映射模式
- if(m_nMapMode == MM_TEXT)
- {
- //变换公式
- //(wx-m_wStartX)/GetWorldScale() = x-m_lStartX
- //(wy-m_wStartY)/GetWorldScale() = m_lStartY-y
- switch(m_nWorldMapMode)
- {
- case WMM_NORMAL:
- {
- *lx = (long)(m_lStartX+(wx-m_wStartX)/GetWorldScale());
- *ly = (long)(m_lStartY-(wy-m_wStartY)/GetWorldScale());
- break;
- }
- case WMM_X_AXIS_REVERSE: //X轴反转
- {
- *lx = (long)(m_lStartX+(m_wStartX-wx)/GetWorldScale());
- *ly = (long)(m_lStartY-(wy-m_wStartY)/GetWorldScale());
- break;
- }
- case WMM_Y_AXIS_REVERSE://Y轴反转
- {
- *lx = (long)(m_lStartX+(wx-m_lStartX)/GetWorldScale());
- *ly = (long)(m_lStartY-(m_lStartY-wy)/GetWorldScale());
- break;
- }
- case WMM_XY_AXIS_REVERSE://XY轴反转
- {
- *lx = (long)(m_lStartX+(m_wStartX-wx)/GetWorldScale());
- *ly = (long)(m_lStartY-(m_lStartY-wy)/GetWorldScale());
- break;
- }
- case WMM_AXIS_ROTATE:
- {
- AfxMessageBox("不支持!");
- break;
- }
- default:
- {
- *lx = (long)(m_lStartX+(wx-m_wStartX)/GetWorldScale());
- *ly = (long)(m_lStartY-(wy-m_wStartY)/GetWorldScale());
- break;
- }
- }
- }
- else //非MM_TEXT
- {
- //(wx-m_wStartX)/GetWorldScale() = x-m_lStartX
- //(wy-m_wStartY)/GetWorldScale() = y-m_lStartY
- switch(m_nWorldMapMode)
- {
- case WMM_NORMAL:
- {
- *lx = (long)(m_lStartX+(wx-m_wStartX)/GetWorldScale());
- *ly = (long)(m_lStartY+(wy-m_wStartY)/GetWorldScale());
- break;
- }
- case WMM_X_AXIS_REVERSE:
- {
- *lx = (long)(m_lStartX+(m_wStartX-wx)/GetWorldScale());
- *ly = (long)(m_lStartY+(wy-m_wStartY)/GetWorldScale());
- break;
- }
- case WMM_Y_AXIS_REVERSE:
- {
- *lx = (long)(m_lStartX+(wx-m_wStartX)/GetWorldScale());
- *ly = (long)(m_lStartY+(m_wStartY-wy)/GetWorldScale());
- break;
- }
- case WMM_XY_AXIS_REVERSE:
- {
- *lx = (long)(m_lStartX+(m_wStartX-wx)/GetWorldScale());
- *ly = (long)(m_lStartY+(m_wStartY-wy)/GetWorldScale());
- break;
- }
- case WMM_AXIS_ROTATE:
- {
- AfxMessageBox("不支持!");
- break;
- }
- default:
- {
- *lx = (long)(m_lStartX+(wx-m_wStartX)/GetWorldScale());
- *ly = (long)(m_lStartY+(wy-m_wStartY)/GetWorldScale());
- break;
- }
- }
- }
- }
- void CQCoordSys::WPtoLP(CQPoint qpt,CPoint * pt)
- {
- double wx = qpt.GetX();
- double wy = qpt.GetY();
- WPtoLP(wx,wy,&pt->x,&pt->y);
- }
- void CQCoordSys::WPtoLP(CBoundaryRect BRect,CRect * pRc)
- {
- double minx,miny,maxx,maxy;
- CPoint pt1,pt2;
- minx = BRect.GetLeftBottomX();
- miny = BRect.GetLeftBottomY();
- maxx = BRect.GetRightTopX();
- maxy = BRect.GetRightTopY();
- WPtoLP(minx,miny,&pt1.x,&pt1.y);
- WPtoLP(maxx,maxy,&pt2.x,&pt2.y);
- pRc->left = min(pt1.x,pt2.x);
- pRc->top = min(pt1.y,pt2.y);
- pRc->right= max(pt1.x,pt2.x);
- pRc->bottom = max(pt1.y,pt2.y);
- }
- //////////////////////////////////////////
- ///***************CQGIS****************///
- ///函数名称:LLtoWL
- ///返回类型:double
- ///入口参数:long lLen
- ///出口参数:无
- ///思路说明:
- ///***************CQGIS****************///
- //////////////////////////////////////////
- double CQCoordSys::LLtoWL(long lLen)
- {
- return (double)(lLen*GetWorldScale());
- }
- inline long CQCoordSys::WLtoLL(double wLen)
- {
- return long(wLen/GetWorldScale());
- }
- inline double CQCoordSys::LLtoMM(long lLen)
- {
- //25.4代表英尺长度
- if(m_nMapMode==MM_TEXT)
- {
- return double(lLen*25.4/g_QObj.g_nPixelsPerInchX);
- }
- else if(m_nMapMode==MM_HIMETRIC)
- {
- return double(lLen/100.0);
- }
- else if(m_nMapMode==MM_LOMETRIC)
- {
- return double(lLen/10.0);
- }
- else if(m_nMapMode==MM_LOENGLISH)
- {
- return double(lLen/100.0*25.4);
- }
- else if(m_nMapMode==MM_HIENGLISH)
- {
- return double(lLen/1000.0*25.4);
- }
- else if(m_nMapMode==MM_TWIPS)
- {
- return double(lLen/1440.0*25.4);
- }
- else return 0;
- }
- inline long CQCoordSys::MMtoLL(double mLen)
- {
- double s=0;
- if(m_nMapMode==MM_TEXT)
- {
- s=mLen/25.4*g_QObj.g_nPixelsPerInchX;
- }
- else if(m_nMapMode==MM_HIMETRIC)
- {
- s=mLen*100.0;
- }
- else if(m_nMapMode==MM_LOMETRIC)
- {
- s=mLen*10.0;
- }
- else if(m_nMapMode==MM_LOENGLISH)
- {
- s=mLen*100.0/25.4;
- }
- else if(m_nMapMode==MM_HIENGLISH)
- {
- s=mLen*1000.0/25.4;
- }
- else if(m_nMapMode==MM_TWIPS)
- {
- s=mLen*1440.0/25.4;
- }
- else
- {
- s=0;
- }
- return (long)(s*m_dDispScale);
- }
- inline double CQCoordSys::WLtoML(double wLen)
- {
- return wLen/m_dMapScale;
- }
- inline long CQCoordSys::MLtoLL(double mLen)
- {
- //0-M,1-CM,2-MM,3-INCH,4-KM,5-dms, 6-度
- double s=1;
- switch(m_nUnitType)
- {
- case 0:
- break;
- case 1:
- s=s/100;
- break;
- case 2:
- s=s/1000;
- break;
- case 3:
- s=s*0.0254;
- break;
- case 4:
- s=s*1000;
- break;
- case 5:
- break;
- case 6:
- break;
- }
- return long(mLen*s*m_dLogicalUnitsPtrMeterX+0.5);
- }
- inline double CQCoordSys::MLtoWL(double mLen)
- {
- return mLen*m_dMapScale;
- }
- inline double CQCoordSys::LLtoML(long lLen)
- {
- double s=1;
- switch(m_nUnitType)
- {
- case 0:
- break;
- case 1:
- s=s/100;
- break;
- case 2:
- s=s/1000;
- break;
- case 3:
- s=s*0.0254;
- break;
- case 4:
- s=s*1000;
- break;
- case 5:
- break;
- case 6:
- break;
- }
- return lLen/(s*m_dLogicalUnitsPtrMeterX);
- }
- inline double CQCoordSys::MMtoWL(double mm)
- {
- double d = 0;
- if(m_nMapMode==MM_TEXT)
- {
- d = mm/25.4*g_QObj.g_nPixelsPerInchX;
- }
- else if(m_nMapMode==MM_HIMETRIC)
- {
- d = mm*100.0;
- }
- else if(m_nMapMode==MM_LOMETRIC)
- {
- d = mm*10.0;
- }
- else if(m_nMapMode==MM_LOENGLISH)
- {
- d = mm*100.0/25.4;
- }
- else if(m_nMapMode==MM_HIENGLISH)
- {
- d = mm*1000.0/25.4;
- }
- else if(m_nMapMode==MM_TWIPS)
- {
- d = mm*1440.0/25.4;
- }
- else
- {
- d = 0;
- }
- double s= m_dMapScale/m_dLogicalUnitsPtrMeterX;
- //0-M,1-CM,2-MM,3-INCH,4-KM,5-dms, 6-度
- switch(m_nUnitType) {
- case 0:
- break;
- case 1:
- s=s/100;
- break;
- case 2:
- s=s/1000;
- break;
- case 3:
- s=s*0.0254;
- break;
- case 4:
- s=s*1000;
- break;
- case 5:
- break;
- case 6:
- break;
- }
- return d * s;
- }
- inline double CQCoordSys::MMtoWL(double mm,double MapScale)
- {
- double d = 0;
- if(m_nMapMode==MM_TEXT)
- {
- d = mm/25.4*g_QObj.g_nPixelsPerInchX;
- }
- else if(m_nMapMode==MM_HIMETRIC)
- {
- d = mm*100.0;
- }
- else if(m_nMapMode==MM_LOMETRIC)
- {
- d = mm*10.0;
- }
- else if(m_nMapMode==MM_LOENGLISH)
- {
- d = mm*100.0/25.4;
- }
- else if(m_nMapMode==MM_HIENGLISH)
- {
- d = mm*1000.0/25.4;
- }
- else if(m_nMapMode==MM_TWIPS)
- {
- d = mm*1440.0/25.4;
- }
- else
- {
- d = 0;
- }
- double s= MapScale/m_dLogicalUnitsPtrMeterX;
- //0-M,1-CM,2-MM,3-INCH,4-KM,5-dms, 6-度
- switch(m_nUnitType)
- {
- case 0:
- break;
- case 1:
- s=s/100;
- break;
- case 2:
- s=s/1000;
- break;
- case 3:
- s=s*0.0254;
- break;
- case 4:
- s=s*1000;
- break;
- case 5:
- break;
- case 6:
- break;
- }
- return d * s;
- }
- inline void CQCoordSys::Translate(CPoint OldPoint,CPoint NewPoint)
- {
- switch(m_nWorldMapMode)
- {
- case WMM_NORMAL:
- {
- m_wStartX =m_wStartX-(NewPoint.x-OldPoint.x)*GetWorldScale();
- if(m_nMapMode==MM_TEXT)
- m_wStartY =m_wStartY+(NewPoint.y-OldPoint.y)*GetWorldScale();
- else
- m_wStartY =m_wStartY-(NewPoint.y-OldPoint.y)*GetWorldScale();
- break;
- }
- case WMM_X_AXIS_REVERSE://世界坐标的X轴倒置向左增大
- {
- m_wStartX =m_wStartX+(NewPoint.x-OldPoint.x)*GetWorldScale();
- if(m_nMapMode==MM_TEXT)
- m_wStartY =m_wStartY+(NewPoint.y-OldPoint.y)*GetWorldScale();
- else
- m_wStartY =m_wStartY-(NewPoint.y-OldPoint.y)*GetWorldScale();
- break;
- }
- case WMM_Y_AXIS_REVERSE://世界坐标的Y轴倒置向下增大
- {
- m_wStartX =m_wStartX-(NewPoint.x-OldPoint.x)*GetWorldScale();
- if(m_nMapMode==MM_TEXT)
- m_wStartY =m_wStartY-(NewPoint.y-OldPoint.y)*GetWorldScale();
- else
- m_wStartY =m_wStartY+(NewPoint.y-OldPoint.y)*GetWorldScale();
- break;
- }
- case WMM_XY_AXIS_REVERSE://世界坐标的Y轴倒置向下增大,世界坐标的X轴倒置向左增大
- {
- m_wStartX =m_wStartX+(NewPoint.x-OldPoint.x)*GetWorldScale();
- if(m_nMapMode==MM_TEXT)
- m_wStartY =m_wStartY-(NewPoint.y-OldPoint.y)*GetWorldScale();
- else
- m_wStartY =m_wStartY+(NewPoint.y-OldPoint.y)*GetWorldScale();
- break;
- }
- case WMM_AXIS_ROTATE:
- {
- AfxMessageBox("Not support");
- break;
- }
- default://等同于WMM_NORMAL
- {
- m_wStartX =m_wStartX-(NewPoint.x-OldPoint.x)*GetWorldScale();
- if(m_nMapMode==MM_TEXT)
- m_wStartY =m_wStartY+(NewPoint.y-OldPoint.y)*GetWorldScale();
- else
- m_wStartY =m_wStartY-(NewPoint.y-OldPoint.y)*GetWorldScale();
- }
- }
- }
- inline void CQCoordSys::Translate(long lOffX, long lOffY)
- {
- switch(m_nWorldMapMode)
- {
- case WMM_NORMAL:
- {
- m_wStartX = m_wStartX - lOffX*GetWorldScale();
- if(m_nMapMode==MM_TEXT)
- m_wStartY = m_wStartY + lOffY*GetWorldScale();
- else
- m_wStartY = m_wStartY - lOffY*GetWorldScale();
- break;
- }
- case WMM_X_AXIS_REVERSE://世界坐标的X轴倒置向左增大
- {
- m_wStartX =m_wStartX + lOffX*GetWorldScale();
- if(m_nMapMode==MM_TEXT)
- m_wStartY =m_wStartY + lOffY*GetWorldScale();
- else
- m_wStartY =m_wStartY - lOffY*GetWorldScale();
- break;
- }
- case WMM_Y_AXIS_REVERSE://世界坐标的Y轴倒置向下增大
- {
- m_wStartX = m_wStartX - lOffX*GetWorldScale();
- if(m_nMapMode==MM_TEXT)
- m_wStartY = m_wStartY - lOffY*GetWorldScale();
- else
- m_wStartY = m_wStartY + lOffY*GetWorldScale();
- break;
- }
- case WMM_XY_AXIS_REVERSE://世界坐标的Y轴倒置向下增大,世界坐标的X轴倒置向左增大
- {
- m_wStartX = m_wStartX + lOffX*GetWorldScale();
- if(m_nMapMode==MM_TEXT)
- m_wStartY =m_wStartY - lOffY*GetWorldScale();
- else
- m_wStartY =m_wStartY + lOffY*GetWorldScale();
- break;
- }
- case WMM_AXIS_ROTATE:
- {
- AfxMessageBox("Not support");
- break;
- }
- default://等同于WMM_NORMAL
- {
- m_wStartX = m_wStartX - lOffX*GetWorldScale();
- if(m_nMapMode==MM_TEXT)
- m_wStartY = m_wStartY + lOffY*GetWorldScale();
- else
- m_wStartY = m_wStartY - lOffY*GetWorldScale();
- }
- }
- }
- inline void CQCoordSys::Zoom(CPoint & pt, double dZoomFactor/* =2 */)
- {
- if(dZoomFactor>LARGE_NUMBER|| dZoomFactor==1.0|| dZoomFactor<SMALL_NUMBER ) return ;
- CQPoint fpt;
- LPtoWP(pt,&fpt);
- m_dDispScale *=dZoomFactor;
- m_wStartX=fpt.GetX() - pt.x * GetWorldScale();
- if(m_nMapMode==MM_TEXT)
- m_wStartY=fpt.GetY()-GetWorldScale()*(m_sizeWndportSize.cy-pt.y );
- else
- m_wStartY=fpt.GetY()-GetWorldScale()*(m_sizeWndportSize.cy+pt.y );
- }
- inline void CQCoordSys::DisplayRectFitToView(CBoundaryRect * pRect)
- {
- if(!pRect) return;
- if(!pRect->IsValid()) return;
- //得到左下点和右上点,中点
- long x1,y1,x2,y2;
- WPtoLP( pRect->GetLeftBottomX(), pRect->GetLeftBottomY(), &x1, &y1 );
- WPtoLP( pRect->GetRightTopX(), pRect->GetRightTopY(), &x2, &y2 );
- CPoint MidPos( (x1+x2)/2,(y1+y2)/2 );
- CSize sizewnd = GetWndportSize();
- CPoint tempPoint(sizewnd.cx/2,sizewnd.cy/2);
- double bl1=(double)(sizewnd.cx)/(double)(x2-x1); //横向放大比例
- double bl2=(double)(sizewnd.cy)/(double)(y1-y2); //纵向放大比例
- if(bl2<bl1) bl1=bl2; //取较小的变化比例
- Zoom(MidPos,bl1);
- Translate(MidPos,tempPoint);
- }
- inline void CQCoordSys::DisplayRectFitToView(double dMinX, double dMinY,double dMaxX,double dMaxY)
- {
- //得到左下点和右上点,中点
- long x1,y1,x2,y2;
- WPtoLP( dMinX, dMinY, &x1, &y1 );
- WPtoLP( dMaxX, dMaxY, &x2, &y2 );
- CPoint MidPos( (x1+x2)/2,(y1+y2)/2 );
- CSize sizewnd = GetWndportSize();
- CPoint tempPoint(sizewnd.cx/2,sizewnd.cy/2); //窗口中点
- if((x2-x1)>=5&&(y1-y2)>=5)
- {
- //改变比例
- double bl1=(double)(sizewnd.cx)/(double)(x2-x1); //横向放大比例
- double bl2=(double)(sizewnd.cy)/(double)(y1-y2); //纵向放大比例
- if(bl2<bl1)
- bl1=bl2; //取较小的变化比例
- Zoom(MidPos,bl1);
- Translate(MidPos,tempPoint);
- }
- }
- void CQCoordSys::DisplayAllInRect(double dMinX, double dMinY,double dMaxX,double dMaxY)
- {
- //计算横向比例
- double hblc = (dMaxX-dMinX)/(GetViewportSize().cx-20);
- //计算纵向比例
- double vblc = (dMaxY-dMinY)/(GetViewportSize().cy-20);
- double blc = 1;
- //取较大的比例为显示比例
- if(hblc>vblc)
- blc = hblc;
- else
- blc = vblc;
- /*以下确定屏幕左下角的实际坐标,即在左侧和下侧都留了10点阵的区域
- (minx,miny)在屏幕的左下角向右10点阵同时向上10点阵处。*/
- SetStartOfWorld(dMinX-10*blc,dMinY-10*blc);
- SetWorldScale(blc);
- switch(GetWorldMapMode())
- {
- case WMM_NORMAL:
- SetStartOfWnd(10,GetViewportSize().cy-10);
- break;
- case WMM_XY_AXIS_REVERSE:
- SetStartOfWnd(GetViewportSize().cx-10,10);
- break;
- case WMM_X_AXIS_REVERSE:
- SetStartOfWnd(GetViewportSize().cx-10,GetViewportSize().cy-10);
- break;
- case WMM_Y_AXIS_REVERSE:
- SetStartOfWnd(10,10);
- break;
- default:
- SetStartOfWnd(10,GetViewportSize().cy-10);
- }
- }
- inline void CQCoordSys::Display_1_VS_1(double dMinX, double dMinY,double dMaxX,double dMaxY)
- {
- SetStartOfWorld(dMinX,dMinY);
- SetDisplayScale(1.0); //设置显示比例为1:1
- switch(GetWorldMapMode())
- {
- case WMM_NORMAL:
- SetStartOfWnd(10,GetViewportSize().cy-10);
- break;
- case WMM_XY_AXIS_REVERSE:
- SetStartOfWnd(GetViewportSize().cx-10,10);
- break;
- case WMM_X_AXIS_REVERSE:
- SetStartOfWnd(GetViewportSize().cx-10,GetViewportSize().cy-10);
- case WMM_Y_AXIS_REVERSE:
- SetStartOfWnd(10,10);
- break;
- default:
- SetStartOfWnd(10,GetViewportSize().cy-10);
- }
- }