[mapguide-commits] r6315 - in sandbox/adsk/vik/Common:
CoordinateSystem Foundation/Exception Foundation/System
Geometry/Buffer Geometry/CoordinateSystem
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu Dec 8 12:27:20 EST 2011
Author: traianstanev
Date: 2011-12-08 09:27:20 -0800 (Thu, 08 Dec 2011)
New Revision: 6315
Modified:
sandbox/adsk/vik/Common/CoordinateSystem/CoordSys.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysCatalog.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysCategory.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysCategoryDictionary.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysDatum.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysDatumDictionary.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysDictionary.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysDictionaryBase.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysDictionaryUtility.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEllipsoid.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEllipsoidDictionary.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnum.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnumCategory.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnumCoordinateSystemInCategory.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnumDatum.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnumEllipsoid.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnumInteger32.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysFormatConverter.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysGeodeticPath.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysGeodeticTransformDef.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysGeodeticTransformation.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysGrids.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMathComparator.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMeasure.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMgrs.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMgrsZone.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysOneGrid.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysProjectionInformation.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysTransform.cpp
sandbox/adsk/vik/Common/CoordinateSystem/CoordSysUnitInformation.cpp
sandbox/adsk/vik/Common/CoordinateSystem/MentorDictionary.cpp
sandbox/adsk/vik/Common/CoordinateSystem/MentorUtil.cpp
sandbox/adsk/vik/Common/Foundation/Exception/ExceptionDefs.h
sandbox/adsk/vik/Common/Foundation/System/FileUtil.cpp
sandbox/adsk/vik/Common/Foundation/System/Resources.h
sandbox/adsk/vik/Common/Foundation/System/Util.cpp
sandbox/adsk/vik/Common/Geometry/Buffer/pobjbufr.cpp
sandbox/adsk/vik/Common/Geometry/CoordinateSystem/CoordinateSystemFactory.cpp
Log:
Removed numerous places where the code was try-catch-ing, then re-throwing the same exception that was caught. This re-throw cascade was not really useful in a non-server environment and removing it actually reduced the DLL size from 2.8 megs to 2.0 megs. So 28% of the generated code was actually made up of try-catch-throw.
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSys.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSys.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSys.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -239,7 +239,6 @@
{
INT32 nCoordinateSystemType=MgCoordinateSystemType::Unknown;
- MG_TRY()
if (0==m_csprm.prj_code)
{
nCoordinateSystemType=MgCoordinateSystemType::Unknown;
@@ -258,7 +257,6 @@
{
nCoordinateSystemType = MgCoordinateSystemType::Projected;
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.GetType")
return nCoordinateSystemType;
}
@@ -268,7 +266,6 @@
{
MgCoordinate* pCoordinate = NULL;
- MG_TRY()
if(lonLat->GetDimension() == MgCoordinateDimension::XY)
{
pCoordinate=ConvertFromLonLat(lonLat->GetX(), lonLat->GetY());
@@ -296,7 +293,6 @@
// What dimension is this?
throw new MgApplicationException(L"MgCoordinateSystem.ConvertFromLonLat", __LINE__, __WFILE__, NULL, L"InvalidArgument", NULL);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertFromLonLat")
return pCoordinate;
}
@@ -306,7 +302,6 @@
{
MgCoordinate* pCoordinate = NULL;
- MG_TRY()
if(coordinate->GetDimension() == MgCoordinateDimension::XY)
{
pCoordinate=ConvertToLonLat(coordinate->GetX(), coordinate->GetY());
@@ -334,7 +329,6 @@
// What dimension is this?
throw new MgApplicationException(L"MgCoordinateSystem.ConvertToLonLat", __LINE__, __WFILE__, NULL, L"InvalidArgument", NULL);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertToLonLat")
return pCoordinate;
}
@@ -354,9 +348,7 @@
{
double meters = 0.0;
- MG_TRY()
meters = units * m_csprm.csdef.unit_scl;
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertCoordinateSystemUnitsToMeters")
return meters;
}
@@ -375,10 +367,8 @@
{
double units = 0.0;
- MG_TRY()
// This may throw a divide by zero exception
units = meters / m_csprm.csdef.unit_scl;
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertMetersToCoordinateSystemUnits")
return units;
}
@@ -417,9 +407,7 @@
{
double distance = 0.0;
- MG_TRY()
distance = ::sqrt(::pow(x1 - x2, 2.0) + ::pow(y1 - y2, 2.0));
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.MeasureEuclideanDistance")
return distance;
}
@@ -474,7 +462,6 @@
{
double dDistance = 0.0;
- MG_TRY()
// This coordinate system must not be an arbitrary XY coordinate system,
// and there must be a Great Circle path between the points.
if(GetType() == MgCoordinateSystemType::Arbitrary)
@@ -494,8 +481,6 @@
dDistance = dDistance / unitScale;
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.MeasureGreatCircleDistance")
-
return dDistance;
}
@@ -549,8 +534,6 @@
{
double dAzimuth = 0.0;
- MG_TRY()
-
if(GetType() == MgCoordinateSystemType::Arbitrary)
{
double xDistance = x2 - x1;
@@ -577,7 +560,6 @@
Ptr<MgCoordinateSystemEllipsoid> pEllipsoid=GetEllipsoidDefinition();
dAzimuth=pEllipsoid->GetGreatCircleAzimuth(pLonLat1->GetX(), pLonLat1->GetY(), pLonLat2->GetX(), pLonLat2->GetY());
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.GetAzimuth")
return dAzimuth;
}
@@ -637,8 +619,6 @@
{
MgCoordinate* pCoordinate = NULL;
- MG_TRY()
-
double x = 0.0;
double y = 0.0;
@@ -676,8 +656,6 @@
pCoordinate = new MgCoordinateXY(x, y);
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.GetCoordinate")
-
return pCoordinate;
}
@@ -765,7 +743,6 @@
{
STRING sWkt;
- MG_TRY()
if (!m_pCatalog)
{
throw new MgApplicationException(L"MgCoordinateSystem.ToString", __LINE__, __WFILE__, NULL, L"CoordinateSystemInitializationFailed", NULL);
@@ -776,7 +753,6 @@
throw new MgApplicationException(L"MgCoordinateSystem.ToString", __LINE__, __WFILE__, NULL, L"CoordinateSystemInitializationFailed", NULL);
}
sWkt=pConverter->DefinitionToWkt(this, MgCoordinateSystemWktFlavor::Ogc);
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.ToString")
return sWkt;
}
@@ -808,8 +784,6 @@
//
void CCoordinateSystem::SetUnitCode(INT32 unit)
{
- MG_TRY()
-
//Can't change read-only items
if (Protected())
{
@@ -890,8 +864,6 @@
}
//...And return success!
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.SetUnitCode")
}
/////////////////////////////////////////////////////////////////
@@ -949,12 +921,10 @@
{
STRING sName;
- MG_TRY()
wchar_t* pName = Convert_Ascii_To_Wide(m_csprm.csdef.key_nm);
sName=pName;
delete[] pName;
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.GetCsCode")
return sName;
}
@@ -966,8 +936,6 @@
//
void CCoordinateSystem::SetCsCode(CREFSTRING sCode)
{
- MG_TRY()
-
if (Protected())
{
//Can't modify a read-only object.
@@ -1003,7 +971,6 @@
delete [] pStr;
//And we're done!
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.SetCsCode")
}
//Checks whether the specified string is a legal
@@ -1021,14 +988,10 @@
{
STRING sProjection;
- MG_TRY()
-
wchar_t* pProjection = Convert_Ascii_To_Wide(m_csprm.csdef.prj_knm);
sProjection=pProjection;
delete[] pProjection;
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.GetProjection")
-
return sProjection;
}
@@ -1050,8 +1013,6 @@
//
void CCoordinateSystem::SetProjectionCode(INT32 prjType)
{
- MG_TRY()
-
if (Protected())
{
//Can't change read-only items
@@ -1128,7 +1089,6 @@
m_pDatum = NULL;
m_pEllipsoid = NULL;
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.SetProjectionCode")
}
//gets the projection description
@@ -1147,8 +1107,6 @@
{
STRING sDatum;
- MG_TRY()
-
if (ProjectionIsNerthType (m_csprm.csdef.prj_knm))
{
//It's an arbitrary system.
@@ -1170,8 +1128,6 @@
sDatum=pDatum;
delete[] pDatum;
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.GetDatum")
-
return sDatum;
}
@@ -1202,8 +1158,6 @@
{
STRING sEllipsoid;
- MG_TRY()
-
if (ProjectionIsNerthType (m_csprm.csdef.prj_knm))
{
//It's an arbitrary system.
@@ -1230,8 +1184,6 @@
delete[] pEllipsoid;
assert(NULL==m_pDatum);
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.GetEllipsoid")
-
return sEllipsoid;
}
@@ -1332,8 +1284,6 @@
{
Ptr<MgStringCollection> pCategoryNames;
- MG_TRY()
-
Ptr<MgCoordinateSystemCategoryDictionary> pCtDict=m_pCatalog->GetCategoryDictionary();
if (!pCtDict)
{
@@ -1372,8 +1322,6 @@
}
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.GetCategories")
-
return pCategoryNames.Detach();
}
@@ -1394,8 +1342,6 @@
{
bool bIsValid = false;
- MG_TRY()
-
if (ProjectionIsNerthType (m_csprm.csdef.prj_knm))
{
return true;
@@ -1432,8 +1378,6 @@
bIsValid = IsLegalMentorName(m_csprm.csdef.elp_knm);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.IsValid")
-
return bIsValid;
}
@@ -1452,8 +1396,6 @@
{
bool bIsUsable = false;
- MG_TRY()
-
assert(NULL != pCatalog);
if (NULL == pCatalog)
{
@@ -1521,8 +1463,6 @@
bIsUsable = pElDict->Has(pStrEl);
} //if it's cartographic
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.IsUsable")
-
return bIsUsable;
}
@@ -1531,8 +1471,6 @@
//
bool CCoordinateSystem::IsSameAs(MgGuardDisposable *pDef)
{
- MG_TRY()
-
assert(NULL != pDef);
if (NULL == pDef)
{
@@ -1637,8 +1575,6 @@
}
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.IsSameAs")
-
//That's it! If we've made it this far without finding
//any differences, then they're the same as each other.
return true;
@@ -1652,8 +1588,6 @@
{
Ptr<CCoordinateSystem> pNew;
- MG_TRY()
-
pNew = new CCoordinateSystem(m_pCatalog);
//Make an object to be the copy
@@ -1682,8 +1616,6 @@
pNew->m_pEllipsoid = pElClone;
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.CreateClone")
-
//And we're done! Return success.
return pNew.Detach();
}
@@ -1697,14 +1629,11 @@
{
STRING sDesc;
- MG_TRY()
wchar_t* pDesc = Convert_Ascii_To_Wide(m_csprm.csdef.desc_nm);
sDesc=pDesc;
delete[] pDesc;
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.GetDescription")
-
return sDesc;
}
@@ -1733,15 +1662,11 @@
{
STRING sGroup;
- MG_TRY()
-
wchar_t* pGroup = Convert_Ascii_To_Wide(m_csprm.csdef.group);
sGroup=pGroup;
delete[] pGroup;
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.GetGroup")
-
return sGroup;
}
@@ -1768,15 +1693,11 @@
{
STRING sSource;
- MG_TRY()
-
wchar_t* pSource = Convert_Ascii_To_Wide(m_csprm.csdef.source);
sSource=pSource;
delete[] pSource;
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.GetSource")
-
return sSource;
}
@@ -1847,15 +1768,11 @@
{
STRING sLoc;
- MG_TRY()
-
wchar_t* pLoc = Convert_Ascii_To_Wide(m_csprm.csdef.locatn);
sLoc=pLoc;
delete[] pLoc;
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.GetLocation")
-
return sLoc;
}
@@ -1884,15 +1801,11 @@
{
STRING sCntrySt;
- MG_TRY()
-
wchar_t* pCntrySt = Convert_Ascii_To_Wide(m_csprm.csdef.cntry_st);
sCntrySt=pCntrySt;
delete[] pCntrySt;
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.GetCountryOrState")
-
return sCntrySt;
}
@@ -1932,8 +1845,6 @@
{
INT32 nNbParams=0;
- MG_TRY()
-
//Make sure that this parameter is used by this projection
INT32 nProjectionCode = ProjectionFromString(m_csprm.csdef.prj_knm);
if (MgCoordinateSystemProjectionCode::Unknown == nProjectionCode)
@@ -1952,7 +1863,6 @@
}
nNbParams=static_cast<INT32>(parmIdx);
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.GetProjectionParamCount")
return nNbParams;
}
@@ -1967,8 +1877,6 @@
{
double dValue = 0.0;
- MG_TRY()
-
//Make sure the parameter is in the valid range
if ((nIndex < 1) || (nIndex > knCsNumParams))
{
@@ -2001,8 +1909,6 @@
double *pdParms = &m_csprm.csdef.prj_prm1;
dValue = pdParms[nIndex-1];
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.GetProjectionParameter")
-
return dValue;
}
@@ -2017,8 +1923,6 @@
//
void CCoordinateSystem::SetProjectionParameter(INT32 nIndex, double dValue)
{
- MG_TRY()
-
//Can't change read-only items
if (Protected())
{
@@ -2072,8 +1976,6 @@
pdParms[nIndex-1] = dValue;
//And return success!
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.SetProjectionParameter")
}
//Gets the origin longitude of the coordinate system. (Not used by
@@ -2090,8 +1992,6 @@
//
void CCoordinateSystem::SetOriginLongitude(double dOrgLng)
{
- MG_TRY()
-
//Make sure we're not read-only
if (Protected())
{
@@ -2099,8 +1999,6 @@
}
m_csprm.csdef.org_lng = dOrgLng;
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.SetOriginLongitude")
}
//Gets the origin latitude of the coordinate system. (Not used by
@@ -2117,8 +2015,6 @@
//
void CCoordinateSystem::SetOriginLatitude(double dOrgLat)
{
- MG_TRY()
-
//Make sure we're not read-only
if (Protected())
{
@@ -2126,8 +2022,6 @@
}
m_csprm.csdef.org_lat = dOrgLat;
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.SetOriginLatitude")
}
//Gets the X offset (false easting) and Y offset (false northing) of the
@@ -2147,8 +2041,6 @@
//
void CCoordinateSystem::SetOffsets(double dXOffset, double dYOffset)
{
- MG_TRY()
-
if (Protected())
{
//Can't modify a read-only object.
@@ -2157,8 +2049,6 @@
m_csprm.csdef.x_off = dXOffset;
m_csprm.csdef.y_off = dYOffset;
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.SetOffsets")
}
//Gets the scale reduction factor of the coordinate system. (Not used
@@ -2182,8 +2072,6 @@
//
void CCoordinateSystem::SetScaleReduction(double dSclRed)
{
- MG_TRY()
-
if (Protected())
{
//Can't modify a read-only object.
@@ -2194,8 +2082,6 @@
{
m_csprm.csdef.scl_red = dSclRed;
}
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.SetScaleReduction")
}
//Gets the map scaling factor of the coordinate system. (Generally used
@@ -2211,8 +2097,6 @@
//
void CCoordinateSystem::SetMapScale(double dMapScale)
{
- MG_TRY()
-
if (Protected())
{
//Can't modify a read-only object.
@@ -2220,8 +2104,6 @@
}
m_csprm.csdef.map_scl = dMapScale;
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.SetMapScale")
}
//Gets the "zero limits" of the coordinate system. Absolute values of X
@@ -2243,8 +2125,6 @@
//
void CCoordinateSystem::SetZeroes(double dXZero, double dYZero)
{
- MG_TRY()
-
if (Protected())
{
//Can't modify a read-only object.
@@ -2253,8 +2133,6 @@
m_csprm.csdef.zero[0] = (dXZero < 0.0)? 0.0 : dXZero;
m_csprm.csdef.zero[1] = (dYZero < 0.0)? 0.0 : dYZero;
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.SetZeroes")
}
//Gets the latitude-longitude range for the coordinate system. If
@@ -2297,8 +2175,6 @@
//
void CCoordinateSystem::SetLonLatBounds(double dLonMin, double dLatMin, double dLonMax, double dLatMax)
{
- MG_TRY()
-
if (Protected())
{
//Can't modify a read-only object.
@@ -2318,8 +2194,6 @@
m_csprm.csdef.ll_max[0] = m_csprm.max_ll[0];
m_csprm.csdef.ll_max[1] = m_csprm.max_ll[1];
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.SetLonLatBounds")
}
//Turns off latitude-longitude range checking for the coordinate system.
@@ -2327,8 +2201,6 @@
//
void CCoordinateSystem::CancelLonLatBounds()
{
- MG_TRY()
-
if (Protected())
{
//Can't modify a read-only object.
@@ -2341,8 +2213,6 @@
m_csprm.min_ll[1] = 0.0;
m_csprm.max_ll[0] = 0.0;
m_csprm.max_ll[1] = 0.0;
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.CancelLonLatBounds")
}
//Turns on XY range checking for the coordinate system, and sets the allowed
@@ -2352,8 +2222,6 @@
//
void CCoordinateSystem::SetXYBounds(double dXMin, double dYMin, double dXMax, double dYMax)
{
- MG_TRY()
-
//Make sure we're not read-only
if (Protected())
{
@@ -2367,8 +2235,6 @@
m_csprm.min_xy[1] = dYMin;
m_csprm.max_xy[0] = dXMax;
m_csprm.max_xy[1] = dYMax;
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.SetXYBounds")
}
//Turns off XY range checking for the coordinate system. Any previous
@@ -2376,8 +2242,6 @@
//
void CCoordinateSystem::CancelXYBounds()
{
- MG_TRY()
-
//Make sure we're not read-only
if (Protected())
{
@@ -2388,8 +2252,6 @@
m_csprm.min_xy[1] = 0.0;
m_csprm.max_xy[0] = 0.0;
m_csprm.max_xy[1] = 0.0;
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.CancelXYBounds")
}
//Gets the quadrant of the coordinate system definition.
@@ -2405,8 +2267,6 @@
//
void CCoordinateSystem::SetQuadrant(INT16 sQuad)
{
- MG_TRY()
-
//Make sure we're not read-only
if (Protected())
{
@@ -2419,8 +2279,6 @@
}
m_csprm.csdef.quad = sQuad;
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.SetQuadrant")
}
//Gets a copy of the datum which the coordinate system uses. Caller is
@@ -2449,7 +2307,6 @@
//this method will remove the ellipsoid name and put the datum name inside the coordinate system
void CCoordinateSystem::SetDatum(CREFSTRING sDatum)
{
- MG_TRY()
if (Protected())
{
//Can't modify a read-only object.
@@ -2469,12 +2326,10 @@
memset(m_csprm.csdef.dat_knm, 0, sizeof(m_csprm.csdef.key_nm));
memset(m_csprm.csdef.elp_knm, 0, sizeof(m_csprm.csdef.key_nm));
strcpy(m_csprm.csdef.dat_knm, pStr);
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.SetDatum")
}
void CCoordinateSystem::SetEllipsoid(CREFSTRING sEllipsoid)
{
- MG_TRY()
if (Protected())
{
//Can't modify a read-only object.
@@ -2498,7 +2353,6 @@
memset(m_csprm.csdef.dat_knm, 0, sizeof(m_csprm.csdef.key_nm));
memset(m_csprm.csdef.elp_knm, 0, sizeof(m_csprm.csdef.key_nm));
strcpy(m_csprm.csdef.elp_knm, pStr);
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.SetEllipsoid")
}
*/
@@ -2810,7 +2664,6 @@
//-----------------------------------------------------------------------------
void CCoordinateSystem::ConvertCoordinateFromLonLat(MgCoordinate* lonLatToCoordinate)
{
- MG_TRY()
if(lonLatToCoordinate->GetDimension() == MgCoordinateDimension::XY ||
lonLatToCoordinate->GetDimension() == (MgCoordinateDimension::XY | MgCoordinateDimension::M))
{
@@ -2833,13 +2686,11 @@
// What dimension is this?
throw new MgApplicationException(L"MgCoordinateSystem.ConvertFromLonLat", __LINE__, __WFILE__, NULL, L"NullArgument", NULL);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertFromLonLat")
}
//-----------------------------------------------------------------------------
void CCoordinateSystem::ConvertCoordinateToLonLat(MgCoordinate* coordinateToLonLat)
{
- MG_TRY()
if(coordinateToLonLat->GetDimension() == MgCoordinateDimension::XY ||
coordinateToLonLat->GetDimension() == (MgCoordinateDimension::XY | MgCoordinateDimension::M))
{
@@ -2862,7 +2713,6 @@
// What dimension is this?
throw new MgApplicationException(L"MgCoordinateSystem.ConvertFromLonLat", __LINE__, __WFILE__, NULL, L"InvalidArgument", NULL);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertFromLonLat")
}
//-----------------------------------------------------------------------------
@@ -2875,12 +2725,11 @@
MgCoordinate* CCoordinateSystem::ConvertToLonLat(double dX, double dY)
{
Ptr<MgCoordinate> pCoordinate;
- MG_TRY()
+
double dLongitude=0., dLatitude=0.;
ConvertPoint(CS_xychk, CS_cs2ll, dX, dY, 0., &dLongitude, &dLatitude, NULL);
pCoordinate=new MgCoordinateXY(dLongitude, dLatitude);
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertToLonLat")
return pCoordinate.Detach();
}
@@ -2888,12 +2737,11 @@
MgCoordinate* CCoordinateSystem::ConvertToLonLat(double dX, double dY, double dZ)
{
Ptr<MgCoordinate> pCoordinate;
- MG_TRY()
+
double dLongitude=0., dLatitude=0., dZDest=0.;
ConvertPoint(CS_xychk, CS_cs3ll, dX, dY, dZ, &dLongitude, &dLatitude, &dZDest);
pCoordinate=new MgCoordinateXYZ(dLongitude, dLatitude, dZDest);
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertToLonLat")
return pCoordinate.Detach();
}
@@ -2908,12 +2756,11 @@
MgCoordinate* CCoordinateSystem::ConvertFromLonLat(double dLongitude, double dLatitude)
{
Ptr<MgCoordinate> pCoordinate;
- MG_TRY()
+
double dX=0., dY=0.;
ConvertPoint(CS_llchk, CS_ll2cs, dLongitude, dLatitude, 0., &dX, &dY, NULL);
pCoordinate=new MgCoordinateXY(dX, dY);
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertFromLonLat")
return pCoordinate.Detach();
}
@@ -2921,12 +2768,11 @@
MgCoordinate* CCoordinateSystem::ConvertFromLonLat(double dLongitude, double dLatitude, double dZ)
{
Ptr<MgCoordinate> pCoordinate;
- MG_TRY()
+
double dX=0., dY=0., dZDest=0.;
ConvertPoint(CS_llchk, CS_ll3cs, dLongitude, dLatitude, dZ, &dX, &dY, &dZDest);
pCoordinate=new MgCoordinateXYZ(dX, dY, dZDest);
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertFromLonLat")
return pCoordinate.Detach();
}
@@ -2973,8 +2819,6 @@
//
void CCoordinateSystem::SetString(CREFSTRING sSrc, char *pDest, UINT32 nMaxSize)
{
- MG_TRY()
-
assert(NULL != pDest);
if (NULL==pDest)
@@ -3003,8 +2847,6 @@
//Clean up and return success.
delete [] pStr;
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.SetString")
}
//Private function that evaluates the protect data member of m_csprm.csdef
@@ -3104,8 +2946,6 @@
{
bool bIsValid = false;
- MG_TRY()
-
assert(NULL != check);
//Make sure we've been initialized
@@ -3133,8 +2973,6 @@
bIsValid = true;
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.IsValidCoord")
-
return bIsValid;
}
@@ -3143,8 +2981,6 @@
//
void CCoordinateSystem::ConvertPoint(chkfunc check, llcsfunc convert, double dSourceCoord1, double dSourceCoord2, double dSourceCoord3, double *pdDestCoord1, double *pdDestCoord2, double *pdDestCoord3)
{
- MG_TRY()
-
assert(NULL != pdDestCoord1);
assert(NULL != pdDestCoord2);
if (NULL == pdDestCoord1 || NULL == pdDestCoord2)
@@ -3178,7 +3014,6 @@
throw new MgApplicationException(L"MgCoordinateSystem.ConvertPoint", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionExtentException", NULL);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertPoint")
}
//Private member function which gets a floating-point
@@ -3188,8 +3023,6 @@
{
double dResult = 0.;
- MG_TRY()
-
assert(NULL != func);
if (NULL == func)
{
@@ -3233,8 +3066,6 @@
throw new MgApplicationException(L"MgCoordinateSystem.GetDouble", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionWarningException", NULL);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.GetDouble")
-
return dResult;
}
@@ -3248,49 +3079,40 @@
MgCoordinateSystemMeasure* CCoordinateSystem::GetMeasure()
{
CCoordinateSystemMeasure* pNew=NULL;
- MG_TRY()
+
pNew=new CCoordinateSystemMeasure(this);
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.GetMeasure")
return pNew;
}
//*****************************************************************************
void CCoordinateSystem::ConvertFromLonLat(double lon, double lat, double& x, double& y)
{
- MG_TRY()
ConvertPoint(CS_llchk, CS_ll2cs, lon, lat, 0., &x, &y, NULL);
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertFromLonLat")
}
//*****************************************************************************
void CCoordinateSystem::ConvertFromLonLat(double lon[], double lat[], double x[], double y[], int arraySize)
{
- MG_TRY()
for(int i=0;i<arraySize;i++)
{
ConvertPoint(CS_llchk, CS_ll2cs, lon[i], lat[i], 0., &x[i], &y[i], NULL);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertFromLonLat")
}
//*****************************************************************************
void CCoordinateSystem::ConvertToLonLat(double x, double y, double& lon, double& lat)
{
- MG_TRY()
ConvertPoint(CS_xychk, CS_cs2ll, x, y, 0., &lon, &lat, NULL);
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertToLonLat")
}
//*****************************************************************************
void CCoordinateSystem::ConvertToLonLat(double x[], double y[], double lon[], double lat[], int arraySize)
{
- MG_TRY()
for(int i=0;i<arraySize;i++)
{
ConvertPoint(CS_xychk, CS_cs2ll, x[i], y[i], 0., &lon[i], &lat[i], NULL);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertToLonLat")
}
//*****************************************************************************
@@ -3298,7 +3120,6 @@
{
UINT8* pStreamOut=pStream;
- MG_TRY()
assert(NULL != pStream);
if (!pStream)
{
@@ -3342,7 +3163,6 @@
}
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.SerializeFrom")
return pStreamOut;
}
@@ -3351,7 +3171,6 @@
{
UINT8* pStreamOut=pStream;
- MG_TRY()
assert(NULL != pStream);
if (!pStream)
{
@@ -3376,7 +3195,6 @@
memcpy(pStreamOut, pBuf, sizeof(def));
pStreamOut = pStreamOut + sizeof(def);
- MG_CATCH_AND_THROW(L"MgCoordinateSystem.SerializeTo")
return pStreamOut;
}
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysCatalog.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysCatalog.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysCatalog.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -196,8 +196,6 @@
{
STRING sDir;
- MG_TRY()
-
bool bResult=false;
#ifdef _WIN32
@@ -257,9 +255,6 @@
throw new MgApplicationException(L"MgCoordinateSystemCatalog.GetDefaultDictionaryDir", __LINE__, __WFILE__, NULL, L"CoordinateSystemInitializationFailed", NULL);
}
- //And return success.
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCatalog.GetDefaultDictionaryDir")
-
return sDir;
}
@@ -280,8 +275,6 @@
//
void CCoordinateSystemCatalog::SetDictionaryDir(CREFSTRING sDirPath)
{
- MG_TRY()
-
if (sDirPath.empty())
{
throw new MgApplicationException(L"MgCoordinateSystemCatalog.SetDictionaryDir", __LINE__, __WFILE__, NULL, L"InvalidArgument", NULL);
@@ -366,8 +359,6 @@
m_pGxDict->SetFileName(sGx);
m_libraryStatus = lsInitialized;
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCatalog.SetDictionaryDir")
}
//cgeck if the files are writable
@@ -377,8 +368,6 @@
//if the file names and path have not yet been set up, an assertion is thrown
bool CCoordinateSystemCatalog::AreDictionaryFilesWritable()
{
- MG_TRY()
-
if (m_sDir.empty()
|| !m_pCsDict || m_pCsDict->GetFileName().empty()
|| !m_pDtDict || m_pDtDict->GetFileName().empty()
@@ -458,7 +447,6 @@
return false;
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCatalog.AreDictionaryFilesWritable")
return true;
}
@@ -470,8 +458,6 @@
//calling SetDictionaryDir() and on each dictionary SetFileName().
void CCoordinateSystemCatalog::SetDefaultDictionaryDirAndFileNames()
{
- MG_TRY()
-
//Get the system default path information
STRING sDir=GetDefaultDictionaryDir();
STRING sCs=m_pCsDict->GetDefaultFileName();
@@ -495,8 +481,6 @@
m_pGxDict->SetFileName(sGx);
m_libraryStatus=lsInitialized;
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCatalog.SetDefaultDictionaryDirAndFileNames")
}
@@ -512,8 +496,6 @@
{
Ptr<MgDisposableCollection> pColl;
- MG_TRY()
-
//We can get a datum shift even if the catalog is closed, but
//the directory must have been set, since the converter will
//need to get at data files to do certain datum shifts.
@@ -529,7 +511,6 @@
pColl->Add(pNew);
//And we're done! Return success.
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCatalog.GetGeodeticTransformations")
return pColl.Detach();
}
@@ -538,10 +519,9 @@
MgCoordinateSystemMathComparator* CCoordinateSystemCatalog::GetMathComparator()
{
CCoordinateSystemMathComparator *pNew=NULL;
- MG_TRY()
+
pNew=new CCoordinateSystemMathComparator;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCatalog.GetMathComparator")
//And we're done! Return success.
return pNew;
}
@@ -550,11 +530,9 @@
MgCoordinateSystemFormatConverter* CCoordinateSystemCatalog::GetFormatConverter()
{
CCoordinateSystemFormatConverter *pNew=NULL;
- MG_TRY()
+
pNew=new CCoordinateSystemFormatConverter(this);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCatalog.GetFormatConverter")
-
//And we're done! Return success.
return pNew;
}
@@ -563,11 +541,9 @@
MgCoordinateSystemProjectionInformation* CCoordinateSystemCatalog::GetProjectionInformation()
{
CCoordinateSystemProjectionInformation *pNew=NULL;
- MG_TRY()
+
pNew=new CCoordinateSystemProjectionInformation();
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCatalog.GetProjectionInformation")
-
//And we're done! Return success.
return pNew;
}
@@ -576,11 +552,9 @@
MgCoordinateSystemUnitInformation* CCoordinateSystemCatalog::GetUnitInformation()
{
CCoordinateSystemUnitInformation *pNew=NULL;
- MG_TRY()
+
pNew=new CCoordinateSystemUnitInformation();
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCatalog.GetUnitInformation")
-
//And we're done! Return success.
return pNew;
}
@@ -589,11 +563,9 @@
MgCoordinateSystemDictionaryUtility* CCoordinateSystemCatalog::GetDictionaryUtility()
{
CCoordinateSystemDictionaryUtility *pNew=NULL;
- MG_TRY()
+
pNew=new CCoordinateSystemDictionaryUtility(this);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCatalog.GetDictionaryUtility")
-
//And we're done! Return success.
return pNew;
}
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysCategory.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysCategory.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysCategory.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -271,8 +271,6 @@
//
void CCoordinateSystemCategory::CopyFrom(MgCoordinateSystemCategory *pDef)
{
- MG_TRY()
-
assert(NULL != pDef);
if (!pDef)
{
@@ -295,7 +293,6 @@
if (1 != pCsNameColl->GetCount()) break;
AddCoordinateSystem(pCsNameColl->GetItem(0));
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCategory.CopyFrom")
}
//Gets the name of the def.
@@ -303,12 +300,10 @@
{
STRING sName;
- MG_TRY()
wchar_t *pName = Convert_Ascii_To_Wide(m_categoryName.Name());
sName=pName;
delete[] pName;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCategory.GetName")
return sName;
}
@@ -318,7 +313,6 @@
//if the specified name is not legal.
void CCoordinateSystemCategory::SetName(CREFSTRING sName)
{
- MG_TRY()
if (!IsLegalName(sName))
{
throw new MgApplicationException(L"MgCoordinateSystemCategory.SetName", __LINE__, __WFILE__, NULL, L"InvalidArgument", NULL);
@@ -330,7 +324,6 @@
m_categoryName = pName;
delete [] pName;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCategory.SetName")
}
//Gets whether the def is "valid." Validity, in this case, is
@@ -407,8 +400,6 @@
//
bool CCoordinateSystemCategory::IsSameAs(MgGuardDisposable *pDef)
{
- MG_TRY()
-
if (NULL == pDef)
{
throw new MgApplicationException(L"MgCoordinateSystemCategory.IsSameAs", __LINE__, __WFILE__, NULL, L"NullArgument", NULL);
@@ -472,8 +463,6 @@
}
} //for each coordsys name in the category
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCategory.IsSameAs")
-
return false;
}
@@ -484,8 +473,6 @@
{
Ptr<CCoordinateSystemCategory> pNew;
- MG_TRY()
-
//Create a clone object
pNew = new CCoordinateSystemCategory(m_pCatalog);
@@ -495,8 +482,6 @@
//Copy the list of coordinate systems
pNew->m_listCoordinateSystemNames = m_listCoordinateSystemNames;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCategory.CreateClone")
-
//And we're done! Return success.
return pNew.Detach();
}
@@ -516,11 +501,9 @@
{
CCoordinateSystemEnumCoordinateSystemInCategory* pNameEnum=NULL;
- MG_TRY()
pNameEnum=new CCoordinateSystemEnumCoordinateSystemInCategory(m_pCatalog);
pNameEnum->Initialize(&m_listCoordinateSystemNames);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCategory.GetEnum")
return pNameEnum;
}
@@ -529,7 +512,6 @@
MgStringCollection* CCoordinateSystemCategory::GetCoordinateSystems()
{
Ptr<MgStringCollection> pCsColl;
- MG_TRY()
pCsColl=new MgStringCollection;
@@ -541,7 +523,7 @@
pCsColl->Add(pName);
delete[] pName;
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCategory.GetCoordinateSystems")
+
return pCsColl.Detach();
}
@@ -552,7 +534,6 @@
//
void CCoordinateSystemCategory::AddCoordinateSystem(CREFSTRING sName)
{
- MG_TRY()
//Make sure it's a legal name
char *pName = Convert_Wide_To_Ascii(sName.c_str()); //need to delete [] pName
@@ -578,7 +559,6 @@
m_listCoordinateSystemNames.push_back(newMember);
//Success!
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCategory.AddCoordinateSystem")
}
//Removes the specified coordinate system key name from the category.
@@ -588,8 +568,6 @@
//
void CCoordinateSystemCategory::RemoveCoordinateSystem(CREFSTRING sName)
{
- MG_TRY()
-
//Make sure it's a legal name
char *pName = Convert_Wide_To_Ascii(sName.c_str()); //need to delete [] pName
@@ -611,7 +589,6 @@
}
//Return success.
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCategory.RemoveCoordinateSystem")
}
//Tests whether the category contains the specified coordinate system
@@ -621,7 +598,6 @@
{
bool bHas=false;
- MG_TRY()
//Make sure it's a legal name
char *pName = Convert_Wide_To_Ascii(sName.c_str()); //need to delete [] pName
@@ -639,8 +615,6 @@
CSystemNameList::iterator itList=std::find(m_listCoordinateSystemNames.begin(), m_listCoordinateSystemNames.end(), member);
bHas=(itList != m_listCoordinateSystemNames.end());
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCategory.HasCoordinateSystem")
-
return bHas;
}
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysCategoryDictionary.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysCategoryDictionary.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysCategoryDictionary.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -71,12 +71,8 @@
{
Ptr<CCoordinateSystemCategory> pNewDef;
- MG_TRY()
-
pNewDef = new CCoordinateSystemCategory(m_pCatalog);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCategoryDictionary.NewCategory")
-
return pNewDef.Detach();
}
@@ -301,7 +297,6 @@
csFILE* CCoordinateSystemCategoryDictionary::Open(CsDictionaryOpenMode nOpenMode)
{
csFILE* pFile=NULL;
- MG_TRY()
//Make sure they've specified a valid mode
bool bWriting;
@@ -360,7 +355,6 @@
}
//And we're done! Return success.
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCategoryDictionary.Open")
return pFile;
}
@@ -380,8 +374,6 @@
//-----------------------------------------------------------------------------
void CCoordinateSystemCategoryDictionary::SetFileName(CREFSTRING sFileName)
{
- MG_TRY()
-
//Make local variables to hold converted strings
bool bResult = IsValidDictionaryName(sFileName);
if (!bResult)
@@ -412,8 +404,6 @@
//automatically the next time we need it
m_bIndexDirty=true;
m_sFileName=sFileName;
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDictionary.SetFileName")
}
//-----------------------------------------------------------------------------
@@ -421,9 +411,7 @@
STRING CCoordinateSystemCategoryDictionary::GetPath()
{
STRING sPath;
- MG_TRY()
sPath = m_pCatalog->GetDictionaryDir() + m_sFileName;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDictionary.GetPath")
return sPath;
}
@@ -433,10 +421,8 @@
{
UINT32 nSize=0;
- MG_TRY()
//Return the size.
nSize=static_cast<UINT32>(Index().size());
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCategoryDictionary.GetSize")
return nSize;
}
@@ -685,15 +671,12 @@
{
bool bHas=false;
- MG_TRY()
-
//Look in our index
char *pName = Convert_Wide_To_Ascii(sName.c_str()); //need to delete [] pName
CCategoryNameIndexMap::const_iterator iter = Index().find(CCategoryName(pName));
delete [] pName;
bHas=(iter != Index().end());
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCategoryDictionary.Has")
return bHas;
}
@@ -704,8 +687,6 @@
{
MgCoordinateSystemEnum* pEnum=NULL;
- MG_TRY()
-
//Make an enumerator object
CCoordinateSystemEnumCategory *pNewEnum=new CCoordinateSystemEnumCategory;
//Set it up to use our list
@@ -719,7 +700,6 @@
//counting so that Release() will properly free the new object.
pEnum=static_cast<MgCoordinateSystemEnum*>(pNewEnum);
assert(pEnum);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemCategoryDictionary.GetEnum")
return pEnum;
}
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysDatum.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysDatum.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysDatum.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -76,8 +76,6 @@
{
Ptr<MgCoordinateSystemEllipsoid> pEl;
- MG_TRY()
-
//Make sure we've been initialized
if (!IsInitialized())
{
@@ -92,8 +90,6 @@
throw new MgApplicationException(L"MgCoordinateSystemDatum.GetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumInitializationFailedException", NULL);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatum.GetEllipsoidDefinition")
-
return pEl.Detach();
}
@@ -214,12 +210,10 @@
{
STRING sCode;
- MG_TRY()
wchar_t* pName = Convert_Ascii_To_Wide(m_DtDef.key_nm);
sCode=pName;
delete[] pName;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatum.GetDtCode")
return sCode;
}
@@ -231,8 +225,6 @@
//
void CCoordinateSystemDatum::SetDtCode(CREFSTRING sCode)
{
- MG_TRY()
-
if (Protected())
{
//Can't modify a read-only object.
@@ -271,7 +263,6 @@
delete[] pStr;
//And we're done!
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatum.SetDtCode")
}
//Checks whether the specified string is a legal datum key name.
@@ -294,8 +285,6 @@
{
bool bIsValid = false;
- MG_TRY()
-
bIsValid=IsDatumValid();
if (!bIsValid)
{
@@ -313,8 +302,6 @@
bIsValid = (IsLegalEllipsoidRadius(m_datum.e_rad)
&& IsLegalEllipsoidRadius(m_datum.p_rad));
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatum.IsValid")
-
return bIsValid;
}
@@ -333,8 +320,6 @@
{
bool bIsUsable = false;
- MG_TRY()
-
assert(NULL != pCatalog);
if (NULL == pCatalog)
{
@@ -368,8 +353,6 @@
//Check to see if the ellipsoid is there
bIsUsable = pElDict->Has(sElName);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatum.IsUsable")
-
return bIsUsable;
}
@@ -380,8 +363,6 @@
{
bool bIsSame=false;
- MG_TRY()
-
assert(NULL != pDef);
if (NULL == pDef)
{
@@ -435,8 +416,6 @@
//any differences, then they're the same as each other.
bIsSame=pThisElDef->IsSameAs(pElDef);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatum.IsSameAs")
-
return bIsSame;
}
@@ -445,8 +424,6 @@
{
Ptr<CCoordinateSystemDatum> pNew;
- MG_TRY()
-
//Make an object to be the copy
pNew = new CCoordinateSystemDatum(m_pCatalog);
@@ -466,8 +443,6 @@
pNew->m_bEncrypted = m_bEncrypted;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatum.CreateClone")
-
//And we're done! Return success.
return pNew.Detach();
}
@@ -481,14 +456,11 @@
{
STRING sDesc;
- MG_TRY()
wchar_t* pDesc = Convert_Ascii_To_Wide(m_datum.dt_name);
sDesc=pDesc;
delete[] pDesc;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatum.GetDescription")
-
return sDesc;
}
@@ -518,13 +490,11 @@
{
STRING sGroup;
- MG_TRY()
wchar_t *pGroup = Convert_Ascii_To_Wide(m_DtDef.group);
sGroup=pGroup;
delete[] pGroup;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatum.GetGroup")
return sGroup;
}
@@ -551,12 +521,10 @@
{
STRING sSource;
- MG_TRY()
wchar_t *pSource = Convert_Ascii_To_Wide(m_DtDef.source);
sSource=pSource;
delete[] pSource;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatum.GetSource")
return sSource;
}
@@ -631,12 +599,10 @@
{
STRING sLoc;
- MG_TRY()
wchar_t* pLoc = Convert_Ascii_To_Wide(m_DtDef.locatn);
sLoc=pLoc;
delete[] pLoc;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatum.GetLocation")
return sLoc;
}
@@ -665,14 +631,11 @@
{
STRING sCountryOrState;
- MG_TRY()
wchar_t *pCountryOrState = Convert_Ascii_To_Wide(m_DtDef.cntry_st);
sCountryOrState=pCountryOrState;
delete[] pCountryOrState;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatum.GetCountryOrState")
-
return sCountryOrState;
}
@@ -700,12 +663,10 @@
{
STRING sEllipsoid;
- MG_TRY()
wchar_t* pEllipsoid = Convert_Ascii_To_Wide(m_DtDef.ell_knm);
sEllipsoid=pEllipsoid;
delete[] pEllipsoid;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatum.GetEllipsoid")
return sEllipsoid;
}
@@ -716,8 +677,6 @@
//
void CCoordinateSystemDatum::SetEllipsoid(CREFSTRING sEllipsoid)
{
- MG_TRY()
-
//Make sure this object isn't read-only
if (Protected())
{
@@ -747,7 +706,6 @@
strcpy(&m_ElDef.key_nm[0], pStr);
delete [] pStr;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatum.SetEllipsoid")
}
//validates the datum without caring about the ellipsoid
@@ -764,8 +722,6 @@
{
bool bIsValid=false;
- MG_TRY()
-
//Check for mathematical integrity
if ( !IsLegalDatumOffset(m_datum.delta_X)
|| !IsLegalDatumOffset(m_datum.delta_Y)
@@ -787,8 +743,6 @@
//Make sure the ellipsoid name is legal
bIsValid = IsLegalMentorName(m_datum.ell_knm);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatum.IsDatumValid")
-
return bIsValid;
}
@@ -797,8 +751,6 @@
//this is not just setting an internal pointer.
void CCoordinateSystemDatum::SetEllipsoidDefinition(MgCoordinateSystemEllipsoid *pEllipsoidDef)
{
- MG_TRY()
-
assert(NULL != pEllipsoidDef);
if (NULL == pEllipsoidDef)
{
@@ -872,8 +824,6 @@
//Return success.
assert(IsInitialized());
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatum.SetEllipsoidDefinition")
}
//-----------------------------------------------------------------------------
@@ -889,16 +839,12 @@
{
Ptr<MgDisposableCollection> pColl;
- MG_TRY()
-
Ptr<CCoordinateSystemGeodeticTransformation> pNew = new CCoordinateSystemGeodeticTransformation(m_pCatalog, this, pTarget);
pColl = new MgDisposableCollection;
pColl->Add(pNew);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatum.GetGeodeticTransformations")
-
return pColl.Detach();
}
@@ -909,7 +855,6 @@
//
void CCoordinateSystemDatum::SetString(CREFSTRING sSrc, char *pDest, UINT32 nMaxSize)
{
- MG_TRY()
assert(NULL != pDest);
if (NULL==pDest)
{
@@ -937,7 +882,6 @@
//Clean up and return success.
delete [] pStr;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatum.SetString")
}
//Private function that evaluates the protect data member of m_def
@@ -959,7 +903,6 @@
{
UINT8* pStreamOut=pStream;
- MG_TRY()
assert(NULL != pStream);
if (!pStream)
{
@@ -1015,7 +958,6 @@
}
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatum.SerializeFrom")
return pStreamOut;
}
@@ -1024,7 +966,6 @@
{
UINT8* pStreamOut=pStream;
- MG_TRY()
assert(NULL != pStream);
if (!pStream)
{
@@ -1049,7 +990,6 @@
memcpy(pStreamOut, pBuf, sizeof(def));
pStreamOut = pStreamOut + sizeof(def);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatum.SerializeTo")
return pStreamOut;
}
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysDatumDictionary.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysDatumDictionary.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysDatumDictionary.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -305,12 +305,8 @@
{
Ptr<CCoordinateSystemDatum> pNewDef;
- MG_TRY()
-
pNewDef = new CCoordinateSystemDatum(m_pCatalog);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatumDictionary.NewDatum")
-
return pNewDef.Detach();
}
@@ -330,8 +326,6 @@
//-----------------------------------------------------------------------------
void CCoordinateSystemDatumDictionary::SetFileName(CREFSTRING sFileName)
{
- MG_TRY()
-
//Make local variables to hold converted strings
bool bResult = IsValidDictionaryName(sFileName);
if (!bResult)
@@ -364,7 +358,6 @@
m_pmapSystemNameDescription=NULL;
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDictionary.SetFileName")
}
//------------------------------------------------------------------------
@@ -372,9 +365,7 @@
STRING CCoordinateSystemDatumDictionary::GetPath()
{
STRING sPath;
- MG_TRY()
sPath = m_pCatalog->GetDictionaryDir() + m_sFileName;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatumDictionary.GetPath")
return sPath;
}
@@ -384,8 +375,6 @@
{
UINT32 nSize=0;
- MG_TRY()
-
//If we have a summary available, we can just return its size.
if (NULL != m_pmapSystemNameDescription)
{
@@ -409,7 +398,6 @@
{
throw new MgApplicationException(L"MgCoordinateSystemDatumDictionary.GetSize", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatumDictionary.GetSize")
return nSize;
}
@@ -426,7 +414,6 @@
//open for write).
void CCoordinateSystemDatumDictionary::Add(MgGuardDisposable *pDefinition)
{
- MG_TRY()
assert(NULL != pDefinition);
if (NULL == pDefinition)
{
@@ -449,8 +436,6 @@
BuildDtDefFromInterface,
pDatumDef,
false);
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatumDictionary.Add")
}
//Removes the datum definition with the specified name from the
@@ -460,13 +445,11 @@
//isn't allowing write access).
void CCoordinateSystemDatumDictionary::Remove(CREFSTRING sName)
{
- MG_TRY()
MentorDictionary::RemoveDef<cs_Dtdef_>(
m_pmapSystemNameDescription,
CS_dtdef,
CS_dtdel,
sName.c_str());
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatumDictionary.Remove")
}
//Modifies a datum definition in the set. The existing definition
@@ -476,7 +459,6 @@
//in the catalog), a ReadOnly (if the set isn't allowing write access).
void CCoordinateSystemDatumDictionary::Modify(MgGuardDisposable *pDefinition)
{
- MG_TRY()
assert(NULL != pDefinition);
if (NULL == pDefinition)
{
@@ -499,7 +481,6 @@
BuildDtDefFromInterface,
pDatumDef,
true);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatumDictionary.Modify")
}
//This function looks for a datum definition in the set with
@@ -589,8 +570,6 @@
{
bool bHas=false;
- MG_TRY()
-
//Get the name to search for
char *pName = Convert_Wide_To_Ascii(sName.c_str()); //need to delete [] pName
@@ -611,7 +590,6 @@
}
}
delete [] pName;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatumDictionary.Has")
return bHas;
}
@@ -621,14 +599,11 @@
{
MgCoordinateSystemEnum* pEnum=NULL;
- MG_TRY()
-
//Make an enumerator object
CCoordinateSystemEnumDatum *pNew = GetEnumImp();
assert(pNew);
pEnum=static_cast<MgCoordinateSystemEnum*>(pNew);
assert(pEnum);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDatumDictionary.GetEnum")
return pEnum;
}
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysDictionary.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysDictionary.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysDictionary.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -324,12 +324,8 @@
{
Ptr<CCoordinateSystem> pNewDef;
- MG_TRY()
-
pNewDef = new CCoordinateSystem(m_pCatalog);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDictionary.NewCoordinateSystem")
-
return pNewDef.Detach();
}
@@ -349,8 +345,6 @@
//------------------------------------------------------------------------
void CCoordinateSystemDictionary::SetFileName(CREFSTRING sFileName)
{
- MG_TRY()
-
//Make local variables to hold converted strings
bool bResult = IsValidDictionaryName(sFileName);
if (!bResult)
@@ -382,8 +376,6 @@
delete m_pmapSystemNameDescription;
m_pmapSystemNameDescription=NULL;
}
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDictionary.SetFileName")
}
//------------------------------------------------------------------------
@@ -391,9 +383,7 @@
STRING CCoordinateSystemDictionary::GetPath()
{
STRING sPath;
- MG_TRY()
sPath = m_pCatalog->GetDictionaryDir() + m_sFileName;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDictionary.GetPath")
return sPath;
}
@@ -402,7 +392,6 @@
{
UINT32 nSize=0;
- MG_TRY()
//If we have a summary available, we can just return its size.
if (NULL != m_pmapSystemNameDescription)
{
@@ -428,8 +417,6 @@
throw new MgApplicationException(L"MgCoordinateSystemDictionary.GetSize", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDictionary.GetSize")
-
return nSize;
}
@@ -444,8 +431,6 @@
//open for write).
void CCoordinateSystemDictionary::Add(MgGuardDisposable *pDefinition)
{
- MG_TRY()
-
assert(NULL != pDefinition);
if (NULL == pDefinition)
{
@@ -468,8 +453,6 @@
BuildCsDefFromInterface,
pCoordinateSystem,
false);
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDictionary.Add")
}
//Removes the coordsys definition with the specified name from the
@@ -480,13 +463,11 @@
//
void CCoordinateSystemDictionary::Remove(CREFSTRING sName)
{
- MG_TRY()
MentorDictionary::RemoveDef<cs_Csdef_>(
m_pmapSystemNameDescription,
CS_csdef,
CS_csdel,
sName.c_str());
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDictionary.Remove")
}
//Modifies the specified def in the set.
@@ -494,8 +475,6 @@
//def is not the right kind.
void CCoordinateSystemDictionary::Modify(MgGuardDisposable *pDefinition)
{
- MG_TRY()
-
assert(NULL != pDefinition);
if (NULL == pDefinition)
{
@@ -518,7 +497,6 @@
BuildCsDefFromInterface,
pCoordinateSystem,
true);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDictionary.Modify")
}
//This function looks for a coordsys definition in the set with
@@ -614,7 +592,6 @@
{
bool bHas=false;
- MG_TRY()
//Get the name to search for
char *pName = Convert_Wide_To_Ascii(sName.c_str()); //need to delete [] pName
@@ -635,7 +612,6 @@
}
}
delete [] pName;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDictionary.Has")
return bHas;
}
@@ -689,15 +665,11 @@
{
MgCoordinateSystemEnum* pEnum=NULL;
- MG_TRY()
-
CCoordinateSystemEnum* pNew=GetEnumImp();
assert(pNew);
pEnum=static_cast<MgCoordinateSystemEnum*>(pNew);
assert(pEnum);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDictionary.GetEnum")
-
return pEnum;
}
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysDictionaryBase.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysDictionaryBase.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysDictionaryBase.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -94,12 +94,8 @@
DICTIONARY_BASE_TEMPLATE
STRING DICTIONARY_BASE_TEMPLATE_METHOD::GetPath() /* the full path to the file we're currently using */
{
- MG_TRY()
-
return (this->catalog->GetDictionaryDir() + this->fileName);
- MG_CATCH_AND_THROW(L"CCoordinateSystemDictionaryBase.GetPath")
-
_ASSERT(false); //OOM - unable to create the exception object?
return NULL;
}
@@ -159,8 +155,6 @@
if (!pDictionaryDef)
throw new MgApplicationException(L"CCoordinateSystemDictionaryBase.Add", __LINE__, __WFILE__, NULL, L"InvalidArgument", NULL);
- MG_TRY()
-
//::UpdateDef will lock the (file) resource via [SmartCriticalClass critical(true);]
MentorDictionary::UpdateDef<U, T>(
this->dictionaryItems, /* can be null in case no enumerator has been created yet or this dictionary isn't set up for caching */
@@ -173,22 +167,17 @@
pDictionaryDef,
false); /* bAlreadyExists - we want to create a new one, i.e. the definition must not exist yet */
- MG_CATCH_AND_THROW(L"CCoordinateSystemDictionaryBase.Add")
}
//////////////////////////////////////////////////////////////////////////////////////////////////
DICTIONARY_BASE_TEMPLATE
void DICTIONARY_BASE_TEMPLATE_METHOD::Remove(CREFSTRING sName)
{
- MG_TRY()
-
MentorDictionary::RemoveDef<U>(
this->dictionaryItems, /* can be null in case no enumerator has been created yet or this dictionary isn't set up for caching */
definitionAccess->readDefinition,
definitionAccess->deleteDefinition,
sName.c_str());
-
- MG_CATCH_AND_THROW(L"CCoordinateSystemDictionaryBase.Remove")
}
//////////////////////////////////////////////////////////////////////////////////////////////////
@@ -202,8 +191,6 @@
if (!pDictionaryDef)
throw new MgApplicationException(L"CCoordinateSystemDictionaryBase.Modify", __LINE__, __WFILE__, NULL, L"InvalidArgument", NULL);
- MG_TRY()
-
//::UpdateDef will lock the (file) resource via [SmartCriticalClass critical(true);]
//we don't pass our [this->items] here, as the dictionary is accessed anyway;
@@ -221,7 +208,6 @@
true, //the definition has to exist
checkProtectedOnUpdate);
- MG_CATCH_AND_THROW(L"CCoordinateSystemDictionaryBase.Modify")
}
//////////////////////////////////////////////////////////////////////////////////////////////////
@@ -272,8 +258,6 @@
DICTIONARY_BASE_TEMPLATE
bool DICTIONARY_BASE_TEMPLATE_METHOD::Has(CREFSTRING sName)
{
- MG_TRY()
-
try
{
Ptr<MgGuardDisposable> definition = this->Get(sName);
@@ -287,8 +271,6 @@
return false;
}
- MG_CATCH_AND_THROW(L"CCoordinateSystemDictionaryBase.Has")
-
_ASSERT(false);
return false;
}
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysDictionaryUtility.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysDictionaryUtility.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysDictionaryUtility.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -81,8 +81,6 @@
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CCoordinateSystemDictionaryUtility::CreateDictionaryFile(const wchar_t* kpDict, const long klMagic)
{
- MG_TRY()
-
char *pDict = Convert_Wide_To_Ascii(kpDict); //need to delete [] pDict;
//Make sure the file doesn't already exist
@@ -112,6 +110,4 @@
//Success!
CS_fclose(pFile);
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystemDictionaryUtility.CreateDictionaryFile")
}
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEllipsoid.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEllipsoid.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEllipsoid.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -54,7 +54,6 @@
//
void CCoordinateSystemEllipsoid::SetString(CREFSTRING sSrc, char* pDest, int nMaxSize)
{
- MG_TRY()
assert(NULL != pDest);
if (NULL==pDest)
@@ -83,7 +82,6 @@
//Clean up and return success.
delete [] pStr;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoid.SetString")
}
//Private function that evaluates the protect data member of m_def
@@ -111,13 +109,10 @@
{
STRING sName;
- MG_TRY()
-
wchar_t *pName = Convert_Ascii_To_Wide(m_def.key_nm);
sName=pName;
delete[] pName;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoid.GetElCode")
return sName;
}
@@ -127,8 +122,6 @@
//a legal ellipsoid name.
void CCoordinateSystemEllipsoid::SetElCode(CREFSTRING sCode)
{
- MG_TRY()
-
if (Protected())
{
//Can't modify a read-only object.
@@ -163,7 +156,6 @@
delete [] pStr;
//And we're done!
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoid.SetElCode")
}
//Checks whether the specified string is a legal ellipsoid key name.
@@ -185,7 +177,6 @@
{
bool bIsValid = false;
- MG_TRY()
//Make sure the name is legal
bIsValid = IsLegalMentorName(m_def.key_nm);
if (!bIsValid)
@@ -196,7 +187,6 @@
//Make sure the radii have been initialized
bIsValid = (IsLegalEllipsoidRadius(m_def.e_rad) &&
IsLegalEllipsoidRadius(m_def.p_rad));
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoid.IsValid")
return bIsValid;
}
@@ -221,9 +211,7 @@
{
bool bIsUsable = false;
- MG_TRY()
bIsUsable = IsValid();
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoid.IsUsable")
return bIsUsable;
}
@@ -232,7 +220,6 @@
//(Key name is ignored for purposes of comparison.)
bool CCoordinateSystemEllipsoid::IsSameAs(MgGuardDisposable *pDef)
{
- MG_TRY()
bool bIsSame = false;
assert(NULL != pDef);
@@ -268,8 +255,6 @@
assert(FloatEqual(m_def.flat, def.flat));
assert(FloatEqual(m_def.ecent, def.ecent));
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoid.IsSameAs")
-
//They're the same!
return true;
}
@@ -279,8 +264,6 @@
{
Ptr<CCoordinateSystemEllipsoid> pDef;
- MG_TRY()
-
//Make an object to be the copy
pDef = new CCoordinateSystemEllipsoid(m_pCatalog);
@@ -294,8 +277,6 @@
pDef->m_def.epsgNbr = 0;
pDef->m_bEncrypted = m_bEncrypted;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoid.CreateClone")
-
//And we're done! Return success.
return pDef.Detach();
}
@@ -309,11 +290,9 @@
{
STRING sDesc;
- MG_TRY()
wchar_t *pDesc = Convert_Ascii_To_Wide(m_def.name);
sDesc=pDesc;
delete[] pDesc;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoid.GetDescription")
return sDesc;
}
@@ -343,13 +322,10 @@
{
STRING sGroup;
- MG_TRY()
wchar_t *pGroup = Convert_Ascii_To_Wide(m_def.group);
sGroup=pGroup;
delete[] pGroup;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoid.GetGroup")
-
return sGroup;
}
@@ -376,11 +352,10 @@
{
STRING sSource;
- MG_TRY()
wchar_t *pSource = Convert_Ascii_To_Wide(m_def.source);
- STRING sSource(pSource);
+
+ sSource = pSource;
delete[] pSource;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoid.GetSource")
return sSource;
}
@@ -482,8 +457,6 @@
//
void CCoordinateSystemEllipsoid::SetRadii(double dEquatorialRadius, double dPolarRadius)
{
- MG_TRY()
-
//Make sure this object isn't read-only
if (Protected())
{
@@ -512,7 +485,6 @@
m_def.ecent = Eccentricity(dFlat);
//And return success!
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoid.SetRadii")
}
//Utility function which calculates an eccentricity from the given
@@ -522,8 +494,6 @@
{
double dEccent = 0.0;
- MG_TRY()
-
//Make sure they've given us a mathematically valid flattening value
assert(dFlat >= 0.0);
assert(dFlat <= 1.0);
@@ -535,8 +505,6 @@
dEccent = Eccentricity(dFlat);
assert(FloatEqual(dFlat, FlatteningRatio(dEccent)));
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoid.FlatteningRatioToEccentricity")
-
return dEccent;
}
@@ -547,8 +515,6 @@
{
double dFlat = 0.0;
- MG_TRY()
-
//Make sure they've given us a mathematically valid eccentricity value
assert(dEccent >= 0.0);
assert(dEccent <= 1.0);
@@ -560,8 +526,6 @@
dFlat = FlatteningRatio(dEccent);
assert(FloatEqual(dEccent, Eccentricity(dFlat)));
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoid.EccentToFlat")
-
return dFlat;
}
@@ -572,8 +536,6 @@
{
double dEquatorialRadius = 0.0;
- MG_TRY()
-
//Make sure they've given us a mathematically valid flattening value
assert(dFlatteningRatio >= 0.0);
assert(dFlatteningRatio < 1.0);
@@ -585,8 +547,6 @@
dEquatorialRadius = dPolarRadius / (1.0 - dFlatteningRatio);
assert(FloatEqual(dFlatteningRatio, FlatteningRatio(dEquatorialRadius, dPolarRadius)));
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoid.EquatorialRadiusFromPolarRadiusFlatteningRatio")
-
return dEquatorialRadius;
}
@@ -597,8 +557,6 @@
{
double dPolarRadius = 0.0;
- MG_TRY()
-
//Make sure they've given us a mathematically valid flattening value
assert(dFlatteningRatio >= 0.0);
assert(dFlatteningRatio < 1.0);
@@ -610,8 +568,6 @@
dPolarRadius = dEquatorialRadius * (1.0 - dFlatteningRatio);
assert(FloatEqual(dFlatteningRatio, FlatteningRatio(dEquatorialRadius, dPolarRadius)));
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoid.PolarRadiusFromEquatorialRadiusFlatteningRatio")
-
return dPolarRadius;
}
@@ -622,8 +578,6 @@
//points or antipodal points, the azimuth will be returned as zero.
void CCoordinateSystemEllipsoid::GreatCircle(double dLongitude1, double dLatitude1, double dLongitude2, double dLatitude2, double *pdDistance, double *pdAzimuth)
{
- MG_TRY()
-
assert(NULL != pdDistance);
assert(NULL != pdAzimuth);
if (NULL == pdDistance || NULL == pdAzimuth)
@@ -648,7 +602,6 @@
pdDistance); //great-circle distance
//Return success.
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoid.GreatCircle")
}
double CCoordinateSystemEllipsoid::GetGreatCircleDistance(double dLongitude1, double dLatitude1, double dLongitude2, double dLatitude2)
@@ -670,7 +623,6 @@
//Get the limits of legal ellipsoid radius values, in meters.
void CCoordinateSystemEllipsoid::GetRadiusBounds(double *pdMinRadius, double *pdMaxRadius)
{
- MG_TRY()
assert(NULL != pdMinRadius);
assert(NULL != pdMaxRadius);
if (NULL == pdMinRadius || NULL == pdMaxRadius)
@@ -680,7 +632,6 @@
*pdMinRadius = kdMinEllipsoidRadius;
*pdMaxRadius = kdMaxEllipsoidRadius;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoid.GetRadiusBounds")
}
double CCoordinateSystemEllipsoid::GetRadiusMin()
@@ -705,9 +656,7 @@
{
bool bLegal=false;
- MG_TRY()
bLegal=IsLegalEllipsoidRadius(dRadius);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoid.IsLegalRadius")
return bLegal;
}
@@ -716,7 +665,6 @@
//
void CCoordinateSystemEllipsoid::GetFlatteningRatioBounds(double *pdMinFlat, double *pdMaxFlat)
{
- MG_TRY()
assert(NULL != pdMinFlat);
assert(NULL != pdMaxFlat);
if (NULL == pdMinFlat || NULL == pdMaxFlat)
@@ -726,7 +674,6 @@
*pdMinFlat = kdMinEllipsoidFlat;
*pdMaxFlat = kdMaxEllipsoidFlat;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoid.GetFlatteningRatioBounds")
}
double CCoordinateSystemEllipsoid::GetFlatteningRatioMin()
@@ -753,9 +700,7 @@
{
bool bLegal=false;
- MG_TRY()
bLegal=::IsLegalFlatteningRatio(dFlat);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoid.IsLegalFlatteningRatio")
return bLegal;
}
@@ -766,8 +711,6 @@
{
double dFlat = 0.0;
- MG_TRY()
-
if (!IsLegalEllipsoidRadius(dEquatorialRadius))
{
throw new MgApplicationException(L"MgCoordinateSystemEllipsoid.FlatteningRatioFromRadii", __LINE__, __WFILE__, NULL, L"InvalidArgument", NULL);
@@ -778,7 +721,6 @@
}
dFlat = FlatteningRatio(dEquatorialRadius, dPolarRadius);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoid.FlatteningRatioFromRadii")
return dFlat;
}
@@ -794,7 +736,6 @@
{
UINT8* pStreamOut=pStream;
- MG_TRY()
assert(NULL != pStream);
if (!pStream)
{
@@ -838,7 +779,6 @@
}
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoid.SerializeFrom")
return pStreamOut;
}
@@ -847,7 +787,6 @@
{
UINT8* pStreamOut=pStream;
- MG_TRY()
assert(NULL != pStream);
if (!pStream)
{
@@ -872,7 +811,6 @@
memcpy(pStreamOut, pBuf, sizeof(def));
pStreamOut = pStreamOut + sizeof(def);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoid.SerializeTo")
return pStreamOut;
}
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEllipsoidDictionary.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEllipsoidDictionary.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEllipsoidDictionary.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -245,12 +245,8 @@
{
Ptr<CCoordinateSystemEllipsoid> pNewDef;
- MG_TRY()
-
pNewDef = new CCoordinateSystemEllipsoid(m_pCatalog);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoidDictionary.NewEllipsoid")
-
return pNewDef.Detach();
}
@@ -270,8 +266,6 @@
//-----------------------------------------------------------------------------
void CCoordinateSystemEllipsoidDictionary::SetFileName(CREFSTRING sFileName)
{
- MG_TRY()
-
//Make local variables to hold converted strings
bool bResult = IsValidDictionaryName(sFileName);
if (!bResult)
@@ -303,8 +297,6 @@
delete m_pmapSystemNameDescription;
m_pmapSystemNameDescription=NULL;
}
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoidDictionary.SetFileName")
}
//------------------------------------------------------------------------
@@ -312,9 +304,7 @@
STRING CCoordinateSystemEllipsoidDictionary::GetPath()
{
STRING sPath;
- MG_TRY()
sPath = m_pCatalog->GetDictionaryDir() + m_sFileName;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoidDictionary.GetPath")
return sPath;
}
@@ -324,8 +314,6 @@
{
UINT32 nSize=0;
- MG_TRY()
-
//If we have a summary available, we can just return its size.
if (NULL != m_pmapSystemNameDescription)
{
@@ -347,7 +335,6 @@
{
throw new MgApplicationException(L"MgCoordinateSystemEllipsoidDictionary.GetSize", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoidDictionary.GetSize")
return nSize;
}
@@ -364,8 +351,6 @@
//open for write).
void CCoordinateSystemEllipsoidDictionary::Add(MgGuardDisposable *pDefinition)
{
- MG_TRY()
-
assert(NULL != pDefinition);
if (NULL == pDefinition)
{
@@ -389,7 +374,6 @@
pEllipsoidDef,
false);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoidDictionary.Add")
}
//Removes the ellipsoid definition with the specified name from the
@@ -399,13 +383,11 @@
//isn't allowing write access.
void CCoordinateSystemEllipsoidDictionary::Remove(CREFSTRING sName)
{
- MG_TRY()
MentorDictionary::RemoveDef<cs_Eldef_>(
m_pmapSystemNameDescription,
CS_eldef,
CS_eldel,
sName.c_str());
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoidDictionary.Remove")
}
//Modifies the specified def in the set.
@@ -418,7 +400,6 @@
//in the catalog, ReadOnly if the set isn't allowing write access.
void CCoordinateSystemEllipsoidDictionary::Modify(MgGuardDisposable *pDefinition)
{
- MG_TRY()
assert(NULL != pDefinition);
if (NULL == pDefinition)
{
@@ -441,7 +422,6 @@
BuildElDefFromInterface,
pEllipsoidDef,
true);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoidDictionary.Modify")
}
//This function looks for an ellipsoid definition in the set with
@@ -519,8 +499,6 @@
{
bool bHas=false;
- MG_TRY()
-
//Get the name to search for
char *pName = Convert_Wide_To_Ascii(sName.c_str()); //need to delete [] pName
@@ -541,7 +519,6 @@
}
}
delete [] pName;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoidDictionary.Has")
return bHas;
}
@@ -551,12 +528,10 @@
{
MgCoordinateSystemEnum* pEnum=NULL;
- MG_TRY()
CCoordinateSystemEnumEllipsoid* pNew=GetEnumImp();
assert(pNew);
pEnum=static_cast<MgCoordinateSystemEnum*>(pNew);
assert(pEnum);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoidDictionary.GetEnum")
return pEnum;
}
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnum.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnum.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnum.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -74,11 +74,9 @@
//Set the filter.
void CCoordinateSystemEnum::AddFilter(MgCoordinateSystemFilter *pFilter)
{
- MG_TRY()
ClearFilter();
m_vectFilter.push_back(pFilter);
SAFE_ADDREF(pFilter);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.SetFilter")
}
//----------------------------------------------------------
@@ -99,7 +97,6 @@
{
Ptr<MgDisposableCollection> pOutput;
- MG_TRY()
pOutput=new MgDisposableCollection;
//optimization:
@@ -149,7 +146,6 @@
pOutput->Add(pDef);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.Next")
return pOutput.Detach();
}
@@ -160,7 +156,6 @@
MgStringCollection* CCoordinateSystemEnum::NextName(UINT32 ulCount)
{
Ptr<MgStringCollection> pOutput;
- MG_TRY()
pOutput=new MgStringCollection;
for (; m_iter != m_pmapSystemNameDescription->end(); ++m_iter)
{
@@ -179,7 +174,6 @@
delete[] pwName;
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.NextName")
return pOutput.Detach();
}
@@ -187,7 +181,6 @@
MgStringCollection* CCoordinateSystemEnum::NextDescription(UINT32 ulCount)
{
Ptr<MgStringCollection> pOutput;
- MG_TRY()
pOutput=new MgStringCollection;
for (; m_iter != m_pmapSystemNameDescription->end(); ++m_iter)
{
@@ -206,7 +199,6 @@
delete[] pwDecsription;
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.NextDescription")
return pOutput.Detach();
}
@@ -216,8 +208,6 @@
//
void CCoordinateSystemEnum::Skip(UINT32 ulSkipCount)
{
- MG_TRY()
-
UINT32 ulSkipped;
for (ulSkipped=0; m_iter != m_pmapSystemNameDescription->end(); ++m_iter)
{
@@ -238,8 +228,6 @@
{
throw new MgApplicationException(L"MgCoordinateSystemEnum.Skip", __LINE__, __WFILE__, NULL, L"InvalidArgument", NULL);
}
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.Skip")
}
//----------------------------------------------------------
@@ -259,8 +247,6 @@
{
bool bIsFiltered=false;
- MG_TRY()
-
assert(NULL != kpName);
if (!kpName)
{
@@ -290,7 +276,6 @@
//Evaluate it
bIsFiltered=IsFilteredOut(pDef);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.IsFilteredOut")
return bIsFiltered;
}
@@ -301,7 +286,6 @@
//
bool CCoordinateSystemEnum::IsFilteredOut(MgGuardDisposable *pDef)
{
- MG_TRY()
assert(NULL != pDef);
if (!pDef)
{
@@ -315,7 +299,6 @@
return true;
}
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.IsFilteredOut")
//No Filter has been set.
return false;
@@ -330,8 +313,6 @@
{
Ptr<CCoordinateSystemEnum> pNew;
- MG_TRY()
-
//Make an object to be the copy
pNew = new CCoordinateSystemEnum;
@@ -348,8 +329,6 @@
pNew->m_readAllDefCallback = this->m_readAllDefCallback;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.CreateClone")
-
return pNew.Detach();
}
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnumCategory.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnumCategory.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnumCategory.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -56,7 +56,6 @@
//
bool CCoordinateSystemEnumCategory::IsFilteredOut(MgGuardDisposable *pDef)
{
- MG_TRY()
assert(NULL != pDef);
if (!pDef)
@@ -71,7 +70,6 @@
return true;
}
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.IsFilteredOut")
//No filter has been set.
return false;
@@ -86,8 +84,6 @@
{
bool bIsFiltered=false;
- MG_TRY()
-
assert(NULL != kpName);
if (!kpName)
{
@@ -117,7 +113,6 @@
//Evaluate it
bIsFiltered=IsFilteredOut(pDef);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.IsFilteredOut")
return bIsFiltered;
}
@@ -141,11 +136,9 @@
//Set the filter.
void CCoordinateSystemEnumCategory::AddFilter(MgCoordinateSystemFilter *pFilter)
{
- MG_TRY()
ClearFilter();
m_vectFilter.push_back(pFilter);
SAFE_ADDREF(pFilter);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.SetFilter")
}
//----------------------------------------------------------
@@ -153,7 +146,6 @@
{
Ptr<MgDisposableCollection> pOutput;
- MG_TRY()
pOutput=new MgDisposableCollection;
wchar_t* pStr;
@@ -190,7 +182,6 @@
pOutput->Add(pDef);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.Next")
return pOutput.Detach();
}
@@ -201,7 +192,6 @@
MgStringCollection* CCoordinateSystemEnumCategory::NextName(UINT32 ulCount)
{
Ptr<MgStringCollection> pOutput;
- MG_TRY()
pOutput=new MgStringCollection;
for (; m_iter != m_pCategoryNameList->end(); ++m_iter)
@@ -223,7 +213,6 @@
delete[] pwName;
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.NextName")
return pOutput.Detach();
}
@@ -239,8 +228,6 @@
//
void CCoordinateSystemEnumCategory::Skip(UINT32 ulSkipCount)
{
- MG_TRY()
-
UINT32 ulSkipped;
for (ulSkipped=0; m_iter != m_pCategoryNameList->end(); ++m_iter)
{
@@ -261,8 +248,6 @@
{
throw new MgApplicationException(L"MgCoordinateSystemEnum.Skip", __LINE__, __WFILE__, NULL, L"InvalidArgument", NULL);
}
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.Skip")
}
//----------------------------------------------------------
@@ -282,8 +267,6 @@
{
Ptr<CCoordinateSystemEnumCategory> pNew;
- MG_TRY()
-
//Make a new object
pNew = new CCoordinateSystemEnumCategory;
@@ -298,7 +281,6 @@
}
//And we're done! Return success.
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.CreateClone")
return pNew.Detach();
}
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnumCoordinateSystemInCategory.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnumCoordinateSystemInCategory.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnumCoordinateSystemInCategory.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -45,11 +45,9 @@
//Set the filter.
void CCoordinateSystemEnumCoordinateSystemInCategory::AddFilter(MgCoordinateSystemFilter *pFilter)
{
- MG_TRY()
ClearFilter();
m_vectFilter.push_back(pFilter);
SAFE_ADDREF(pFilter);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.SetFilter")
}
//----------------------------------------------------------
@@ -83,7 +81,6 @@
{
Ptr<MgDisposableCollection> pOutput;
- MG_TRY()
pOutput=new MgDisposableCollection;
if (!m_pCatalog)
@@ -129,7 +126,6 @@
pOutput->Add(pCs);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.Next")
return pOutput.Detach();
}
@@ -140,7 +136,7 @@
MgStringCollection* CCoordinateSystemEnumCoordinateSystemInCategory::NextName(UINT32 ulCount)
{
Ptr<MgStringCollection> pOutput;
- MG_TRY()
+
pOutput=new MgStringCollection;
wchar_t* pstr;
for (; m_iter != m_kpListCoordinateSystemNames->end(); ++m_iter)
@@ -163,7 +159,6 @@
delete[] pstr;
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.NextName")
return pOutput.Detach();
}
@@ -171,7 +166,7 @@
MgStringCollection* CCoordinateSystemEnumCoordinateSystemInCategory::NextDescription(UINT32 ulCount)
{
Ptr<MgStringCollection> pOutput;
- MG_TRY()
+
pOutput=new MgStringCollection;
if (!m_pCatalog)
{
@@ -219,7 +214,6 @@
pOutput->Add(strDescription);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.NextDescription")
return pOutput.Detach();
}
@@ -229,7 +223,6 @@
//
void CCoordinateSystemEnumCoordinateSystemInCategory::Skip(UINT32 ulSkipCount)
{
- MG_TRY()
UINT32 ulSkipped;
for (ulSkipped=0; m_iter != m_kpListCoordinateSystemNames->end(); ++m_iter)
{
@@ -253,7 +246,6 @@
throw new MgApplicationException(L"MgCoordinateSystemEnum.Skip", __LINE__, __WFILE__, NULL, L"InvalidArgument", NULL);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.Skip")
}
//Resets the enumerator to the start of the collection.
@@ -271,7 +263,6 @@
{
bool bIsFiltered=false;
- MG_TRY()
assert(NULL != kpName);
if (!kpName)
{
@@ -282,7 +273,6 @@
wchar_t* pStr = Convert_Ascii_To_Wide(kpName);
bIsFiltered=IsFilteredOut(pStr);
delete[] pStr;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.IsFilteredOut")
return bIsFiltered;
}
@@ -294,7 +284,6 @@
{
bool bIsFiltered=false;
- MG_TRY()
assert(NULL != kpName);
if (!kpName)
{
@@ -332,7 +321,6 @@
//Evaluate it
bIsFiltered=IsFilteredOut(pDef);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.IsFilteredOut")
return bIsFiltered;
}
@@ -342,7 +330,6 @@
//
bool CCoordinateSystemEnumCoordinateSystemInCategory::IsFilteredOut(MgGuardDisposable *pDef)
{
- MG_TRY()
assert(NULL != pDef);
if (!pDef)
{
@@ -356,7 +343,6 @@
return true;
}
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.IsFilteredOut")
//No Filter has been set.
return false;
@@ -371,8 +357,6 @@
{
Ptr<CCoordinateSystemEnumCoordinateSystemInCategory> pNew;
- MG_TRY()
-
//Make a new object
pNew = new CCoordinateSystemEnumCoordinateSystemInCategory(m_pCatalog);
@@ -385,8 +369,6 @@
SAFE_ADDREF(m_vectFilter[i]);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.CreateClone")
-
//And we're done! Return success.
return pNew.Detach();
}
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnumDatum.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnumDatum.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnumDatum.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -41,8 +41,6 @@
{
Ptr<CCoordinateSystemEnumDatum> pNew;
- MG_TRY()
-
//Make an object to be the copy
pNew = new CCoordinateSystemEnumDatum;
@@ -57,7 +55,6 @@
SAFE_ADDREF(m_vectFilter[i]);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.CreateClone")
-
+
return pNew.Detach();
}
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnumEllipsoid.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnumEllipsoid.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnumEllipsoid.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -41,8 +41,6 @@
{
Ptr<CCoordinateSystemEnumEllipsoid> pNew;
- MG_TRY()
-
//Make an object to be the copy
pNew = new CCoordinateSystemEnumEllipsoid;
@@ -57,7 +55,5 @@
SAFE_ADDREF(m_vectFilter[i]);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.CreateClone")
-
return pNew.Detach();
}
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnumInteger32.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnumInteger32.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysEnumInteger32.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -56,7 +56,6 @@
//
void CCoordinateSystemEnumInteger32::SetList(INT32 *pnValues, UINT32 ulSize)
{
- MG_TRY()
assert((NULL != pnValues) || (ulSize == 0));
if (!pnValues)
{
@@ -75,18 +74,15 @@
//Copy them in and return success
memcpy(m_pnValues, pnValues, ulSize * sizeof(INT32));
m_ulSize = ulSize;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnumInteger32.SetList")
}
//----------------------------------------------------------
//Set the filter.
void CCoordinateSystemEnumInteger32::AddFilter(MgCoordinateSystemFilterInteger32 *pFilter)
{
- MG_TRY()
ClearFilter();
m_vectFilter.push_back(pFilter);
SAFE_ADDREF(pFilter);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnumInteger32.SetFilter")
}
//This function clears the Filter, if one is set.
@@ -106,7 +102,6 @@
{
Ptr<MgIntCollection> pOutput;
- MG_TRY()
pOutput=new MgIntCollection;
for (; m_ulPos < m_ulSize; m_ulPos++)
@@ -125,7 +120,6 @@
pOutput->Add(m_pnValues[m_ulPos]);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnumInteger32.Next")
return pOutput.Detach();
}
*/
@@ -134,7 +128,6 @@
{
Ptr<MgStringCollection> pOutput;
- MG_TRY()
pOutput=new MgStringCollection;
for (; m_ulPos < m_ulSize; m_ulPos++)
@@ -160,7 +153,6 @@
pOutput->Add(wszINT32);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnumInteger32.Next")
return pOutput.Detach();
}
@@ -170,7 +162,6 @@
//
void CCoordinateSystemEnumInteger32::Skip(UINT32 ulSkipCount)
{
- MG_TRY()
UINT32 ulSkipped;
for (ulSkipped=0; m_ulPos < m_ulSize; m_ulPos++)
{
@@ -189,7 +180,6 @@
{
throw new MgApplicationException(L"MgCoordinateSystemEnumInteger32.Skip", __LINE__, __WFILE__, NULL, L"InvalidArgument", NULL);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnumInteger32.Skip")
}
//Resets the enumerator to the start of the collection.
@@ -205,7 +195,6 @@
//
bool CCoordinateSystemEnumInteger32::IsFilteredOut(INT32 nValue)
{
- MG_TRY()
//If a Filter hasn't been specified, just return true.
if (m_vectFilter.empty())
{
@@ -221,7 +210,6 @@
}
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnumInteger32.IsFilteredOut")
//No Filter has been set.
return false;
}
@@ -233,9 +221,7 @@
MgCoordinateSystemEnumInteger32* CCoordinateSystemEnumInteger32::CreateClone()
{
Ptr<CCoordinateSystemEnumInteger32> pNew;
-
- MG_TRY()
-
+
//Make an object to be the copy
pNew = new CCoordinateSystemEnumInteger32;
@@ -250,7 +236,5 @@
SAFE_ADDREF(m_vectFilter[i]);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemEnumInteger32.CreateClone")
-
return pNew.Detach();
}
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysFormatConverter.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysFormatConverter.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysFormatConverter.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -414,8 +414,6 @@
{
STRING sWkt;
- MG_TRY()
-
//numbers in WKT string always use a dot a separator but the locale might say otherwise
CCsNumericDotLocale dotLocale;
@@ -521,7 +519,6 @@
delete[] wszWkt;
}
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFormatConverter.CodeToWkt")
return sWkt;
}
@@ -953,8 +950,6 @@
{
bool bIsPresent=false;
- MG_TRY()
-
//if input is EPSG
if (MgCoordinateSystemCodeFormat::Epsg==nFormat)
{
@@ -1003,8 +998,6 @@
throw new MgApplicationException(L"MgCoordinateSystemFormatConverter.IsCodeInDictionary", __LINE__, __WFILE__, NULL, L"InvalidArgument", NULL);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFormatConverter.IsCodeInDictionary")
-
return bIsPresent;
}
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysGeodeticPath.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysGeodeticPath.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysGeodeticPath.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -211,7 +211,6 @@
{
UINT8* pStreamOut=pStream;
- MG_TRY()
assert(NULL != pStream);
if (!pStream)
{
@@ -245,7 +244,6 @@
CS_free (previousPathPtr);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemGeodeticPath.SerializeFrom")
return pStreamOut;
}
@@ -254,7 +252,6 @@
{
UINT8* pStreamOut=pStream;
- MG_TRY()
assert(NULL != pStream);
if (!pStream)
{
@@ -269,7 +266,6 @@
memcpy(pStreamOut, pBuf, sizeof(*this->pathDefinition));
pStreamOut = pStreamOut + sizeof(*this->pathDefinition);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemGeodeticPath.SerializeTo")
return pStreamOut;
}
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysGeodeticTransformDef.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysGeodeticTransformDef.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysGeodeticTransformDef.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -443,7 +443,6 @@
char *pBuf;
UINT8* pStreamOut=pStream;
- MG_TRY()
assert(NULL != pStream);
if (!pStream)
{
@@ -458,7 +457,6 @@
memcpy(pStreamOut, pBuf, sizeof(*this->transformDefinition));
pStreamOut = pStreamOut + sizeof(*this->transformDefinition);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemGeodeticTransformDef.SerializeTo")
return pStreamOut;
}
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysGeodeticTransformation.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysGeodeticTransformation.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysGeodeticTransformation.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -86,8 +86,6 @@
//
void CCoordinateSystemGeodeticTransformation::SetSourceAndTarget(MgCoordinateSystemDatum *pSource, MgCoordinateSystemDatum *pTarget)
{
- MG_TRY()
-
//Set up our source datum
MgCoordinateSystemDatum *pSourceTmp=GetWGS84IfNull(pSource);
if (!pSourceTmp)
@@ -162,8 +160,6 @@
//the correct refcount value
SAFE_ADDREF(m_pDtTarget);
}
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystemGeodeticTransformation.SetSourceAndTarget")
}
//Gets a copy of the source datum of the converter (will
@@ -204,7 +200,6 @@
//
void CCoordinateSystemGeodeticTransformation::Shift(MgCoordinate* pLonLat)
{
- MG_TRY()
//Make sure we've been initialized
if (!IsInitialized())
{
@@ -239,7 +234,6 @@
{
pLonLat->SetZ(*pdZ);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemGeodeticTransformation.Shift")
}
//Shifts the provided latitude/longitude coordinates from source datum
@@ -252,8 +246,6 @@
{
Ptr<MgCoordinate> pCoord;
- MG_TRY()
-
//Make sure we've been initialized
if (!IsInitialized())
{
@@ -278,7 +270,6 @@
}
pCoord=new MgCoordinateXY(dLongitude, dLatitude);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemGeodeticTransformation.Shift")
return pCoord.Detach();
}
@@ -295,7 +286,6 @@
{
Ptr<MgCoordinate> pCoord;
- MG_TRY()
//Make sure we've been initialized
if (!IsInitialized())
{
@@ -321,7 +311,6 @@
pCoord=new MgCoordinateXYZ(dLongitude, dLatitude, dZ);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemGeodeticTransformation.Shift")
return pCoord.Detach();
}
@@ -476,7 +465,6 @@
double CCoordinateSystemGeodeticTransformation::GetOffsetX()
{
double dResult=0.;
- MG_TRY()
//if not WGS84 for the target system, bye bye!
cs_Dtdef_ def;
@@ -486,14 +474,12 @@
}
dResult=def.delta_X;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemGeodeticTransformation.GetOffsetX")
return dResult;
}
double CCoordinateSystemGeodeticTransformation::GetOffsetY()
{
double dResult=0.;
- MG_TRY()
//if not WGS84 for the target system, bye bye!
cs_Dtdef_ def;
@@ -502,14 +488,13 @@
throw new MgApplicationException(L"MgCoordinateSystemGeodeticTransformation.GetOffsetY", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
}
dResult=def.delta_Y;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemGeodeticTransformation.GetOffsetY")
+
return dResult;
}
double CCoordinateSystemGeodeticTransformation::GetOffsetZ()
{
double dResult=0.;
- MG_TRY()
//if not WGS84 for the target system, bye bye!
cs_Dtdef_ def;
@@ -518,7 +503,7 @@
throw new MgApplicationException(L"MgCoordinateSystemGeodeticTransformation.GetOffsetZ", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
}
dResult=def.delta_Z;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemGeodeticTransformation.GetOffsetZ")
+
return dResult;
}
@@ -534,7 +519,6 @@
//
void CCoordinateSystemGeodeticTransformation::SetOffset(double x, double y, double z)
{
- MG_TRY()
if (!m_pDtSource || !m_pDtTarget)
{
throw new MgApplicationException(L"MgCoordinateSystemGeodeticTransformation.SetOffset", __LINE__, __WFILE__, NULL, L"CoordinateSystemInitializationFailed", NULL);
@@ -570,8 +554,6 @@
pDatumImp->m_DtDef.delta_X = pDatumImp->m_datum.delta_X = x;
pDatumImp->m_DtDef.delta_Y = pDatumImp->m_datum.delta_Y = y;
pDatumImp->m_DtDef.delta_Z = pDatumImp->m_datum.delta_Z = z;
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystemGeodeticTransformation.SetOffset")
}
//Gets the Bursa-Wolfe transformation values for the datum. Rotations are
@@ -590,7 +572,6 @@
double CCoordinateSystemGeodeticTransformation::GetBursaWolfeTransformRotationX()
{
double dResult=0.;
- MG_TRY()
//if not WGS84 for the target system, bye bye!
cs_Dtdef_ def;
@@ -601,14 +582,12 @@
dResult = def.rot_X;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemGeodeticTransformation.GetBursaWolfeTransformRotationX")
return dResult;
}
double CCoordinateSystemGeodeticTransformation::GetBursaWolfeTransformRotationY()
{
double dResult=0.;
- MG_TRY()
//if not WGS84 for the target system, bye bye!
cs_Dtdef_ def;
@@ -619,14 +598,12 @@
dResult = def.rot_Y;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemGeodeticTransformation.GetBursaWolfeTransformRotationY")
return dResult;
}
double CCoordinateSystemGeodeticTransformation::GetBursaWolfeTransformRotationZ()
{
double dResult=0.;
- MG_TRY()
//if not WGS84 for the target system, bye bye!
cs_Dtdef_ def;
@@ -637,14 +614,12 @@
dResult = def.rot_Z;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemGeodeticTransformation.GetBursaWolfeTransformRotationZ")
return dResult;
}
double CCoordinateSystemGeodeticTransformation::GetBursaWolfeTransformBwScale()
{
double dResult=0.;
- MG_TRY()
//if not WGS84 for the target system, bye bye!
cs_Dtdef_ def;
@@ -655,7 +630,6 @@
dResult = def.bwscale;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemGeodeticTransformation.GetBursaWolfeTransformRotationBwScale")
return dResult;
}
@@ -672,8 +646,6 @@
//
void CCoordinateSystemGeodeticTransformation::SetBursaWolfeTransform(double dRotationX, double dRotationY, double dRotationZ, double dBwScale)
{
- MG_TRY()
-
if (!m_pDtSource || !m_pDtTarget)
{
throw new MgApplicationException(L"MgCoordinateSystemGeodeticTransformation.SetBursaWolfeTransform", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -711,8 +683,6 @@
pDatumImp->m_DtDef.rot_Y = pDatumImp->m_datum.rot_Y = dRotationY;
pDatumImp->m_DtDef.rot_Z = pDatumImp->m_datum.rot_Z = dRotationZ;
pDatumImp->m_DtDef.bwscale = pDatumImp->m_datum.bwscale = dBwScale;
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystemGeodeticTransformation.SetBursaWolfeTransform")
}
//Gets the method which this datum definition will use for transforming
@@ -754,8 +724,6 @@
//
void CCoordinateSystemGeodeticTransformation::SetGeodeticTransformationMethod(INT32 nGeodeticTransformationMethod)
{
- MG_TRY()
-
if (!m_pDtSource || !m_pDtTarget)
{
throw new MgApplicationException(L"MgCoordinateSystemGeodeticTransformation.SetGeodeticTransformationMethod", __LINE__, __WFILE__, NULL, L"CoordinateSystemInitializationFailed", NULL);
@@ -787,7 +755,6 @@
}
pDatumImp->m_DtDef.to84_via = pDatumImp->m_datum.to84_via = nGeodeticTransformationMethod;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemGeodeticTransformation.SetGeodeticTransformationMethod")
}
//Gets the max legal value for a datum offset, in meters.
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysGrids.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysGrids.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysGrids.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -418,23 +418,21 @@
Ptr<MgCoordinate> clPnt;
Ptr<MgCoordinateCollection> collection;
- MG_TRY()
- swPnt = factory.CreateCoordinateXY(southwest->GetX(),southwest->GetY());
- sePnt = factory.CreateCoordinateXY(northeast->GetX(),southwest->GetY());
- nePnt = factory.CreateCoordinateXY(northeast->GetX(),northeast->GetY());
- nwPnt = factory.CreateCoordinateXY(southwest->GetX(),northeast->GetY());
- clPnt = factory.CreateCoordinateXY(southwest->GetX(),southwest->GetY());
+ swPnt = factory.CreateCoordinateXY(southwest->GetX(),southwest->GetY());
+ sePnt = factory.CreateCoordinateXY(northeast->GetX(),southwest->GetY());
+ nePnt = factory.CreateCoordinateXY(northeast->GetX(),northeast->GetY());
+ nwPnt = factory.CreateCoordinateXY(southwest->GetX(),northeast->GetY());
+ clPnt = factory.CreateCoordinateXY(southwest->GetX(),southwest->GetY());
- collection = new MgCoordinateCollection();
- collection->Add (swPnt);
- collection->Add (sePnt);
- collection->Add (nePnt);
- collection->Add (nwPnt);
- collection->Add (clPnt);
+ collection = new MgCoordinateCollection();
+ collection->Add (swPnt);
+ collection->Add (sePnt);
+ collection->Add (nePnt);
+ collection->Add (nwPnt);
+ collection->Add (clPnt);
- Ptr<MgLinearRing> ring = factory.CreateLinearRing (collection);
- m_GridBoundary = factory.CreatePolygon (ring,NULL);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemGridBoundary.SetBoundaryExtents")
+ Ptr<MgLinearRing> ring = factory.CreateLinearRing (collection);
+ m_GridBoundary = factory.CreatePolygon (ring,NULL);
}
void CCoordinateSystemGridBoundary::SetBoundaryExtents (MgPolygon* boundary)
{
@@ -452,31 +450,29 @@
Ptr<MgCoordinateIterator> ringItr;
Ptr<MgCoordinate> coordPtr;
- MG_TRY ()
- // Set up the accumulation values so we will always capture the first
- // values encountered in the actual polygon.
- eastMin = northMin = 1.0E+300;
- eastMax = northMax = -1.0E+300;
+ // Set up the accumulation values so we will always capture the first
+ // values encountered in the actual polygon.
+ eastMin = northMin = 1.0E+300;
+ eastMax = northMax = -1.0E+300;
- // We loop through theouter ring of the polygon. For the purpose of this function,
- // the first ordinate in each coordinate is considered the easting and the
- // second ordinate in each coordinate is considered the northing.
- //
- // It remains unclear, at this point, if we need to know if the coordinate
- // system of the boundary is geographic or not. We'll fund out pretty soon.
- outerRing = m_GridBoundary->GetExteriorRing ();
- ringItr = outerRing->GetCoordinates ();
- while (ringItr->MoveNext ())
- {
- coordPtr = ringItr->GetCurrent ();
- currentX = coordPtr->GetX ();
- currentY = coordPtr->GetY ();
- if (currentX < eastMin) eastMin = currentX;
- if (currentX > eastMax) eastMax = currentX;
- if (currentY < northMin) northMin = currentY;
- if (currentY > northMax) northMax = currentY;
- }
- MG_CATCH_AND_THROW(L"MgCoordinateSystemGridBoundary.GetBoundaryExtents")
+ // We loop through theouter ring of the polygon. For the purpose of this function,
+ // the first ordinate in each coordinate is considered the easting and the
+ // second ordinate in each coordinate is considered the northing.
+ //
+ // It remains unclear, at this point, if we need to know if the coordinate
+ // system of the boundary is geographic or not. We'll fund out pretty soon.
+ outerRing = m_GridBoundary->GetExteriorRing ();
+ ringItr = outerRing->GetCoordinates ();
+ while (ringItr->MoveNext ())
+ {
+ coordPtr = ringItr->GetCurrent ();
+ currentX = coordPtr->GetX ();
+ currentY = coordPtr->GetY ();
+ if (currentX < eastMin) eastMin = currentX;
+ if (currentX > eastMax) eastMax = currentX;
+ if (currentY < northMin) northMin = currentY;
+ if (currentY > northMax) northMax = currentY;
+ }
return;
}
void CCoordinateSystemGridBoundary::SetMaxCurvePoints (INT32 maxPoints)
@@ -500,27 +496,25 @@
Ptr<MgLinearRing> exteriorRing;
Ptr<MgLinearRingCollection> interiorRings;
- MG_TRY()
- // Convert the outer ring.
- sourceRing = m_GridBoundary->GetExteriorRing ();
- exteriorRing = TransformLinearRing (sourceRing,transform,precision);
+ // Convert the outer ring.
+ sourceRing = m_GridBoundary->GetExteriorRing ();
+ exteriorRing = TransformLinearRing (sourceRing,transform,precision);
- interiorRingCount = m_GridBoundary->GetInteriorRingCount ();
- if (interiorRingCount > 0)
- {
- // Create the repository for the interior rings, now that we know
- // there are some (this is rare).
- interiorRings = new MgLinearRingCollection ();
+ interiorRingCount = m_GridBoundary->GetInteriorRingCount ();
+ if (interiorRingCount > 0)
+ {
+ // Create the repository for the interior rings, now that we know
+ // there are some (this is rare).
+ interiorRings = new MgLinearRingCollection ();
- for (index = 0;index < interiorRingCount;index += 1)
- {
- sourceRing = m_GridBoundary->GetInteriorRing (index);
- targetRing = TransformLinearRing (sourceRing,transform,precision);
- interiorRings->Add (targetRing);
- }
+ for (index = 0;index < interiorRingCount;index += 1)
+ {
+ sourceRing = m_GridBoundary->GetInteriorRing (index);
+ targetRing = TransformLinearRing (sourceRing,transform,precision);
+ interiorRings->Add (targetRing);
}
- result = new MgPolygon (exteriorRing,interiorRings);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemGridBoundary.GetBoundary")
+ }
+ result = new MgPolygon (exteriorRing,interiorRings);
return result.Detach ();
}
MgLineStringCollection* CCoordinateSystemGridBoundary::ClipLineString (MgLineString* lineString) const
@@ -530,11 +524,9 @@
Ptr<MgCoordinateIterator> polyItr;
Ptr<MgCoordinateIterator> lineItr;
- MG_TRY()
- polyItr = m_GridBoundary->GetCoordinates ();
- lineItr = lineString->GetCoordinates ();
- collection = MgSpatialUtility::ClipStringToPolygon (polyItr,lineItr);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemGridBoundary.ClipLineString")
+ polyItr = m_GridBoundary->GetCoordinates ();
+ lineItr = lineString->GetCoordinates ();
+ collection = MgSpatialUtility::ClipStringToPolygon (polyItr,lineItr);
return collection.Detach ();
}
void CCoordinateSystemGridBoundary::Dispose ()
@@ -556,61 +548,59 @@
Ptr<MgCoordinateIterator> ringItr;
Ptr<MgCoordinateIterator> lineItr;
- MG_TRY ()
- // NOTE: Boundaries are required to proceed in a counterclockwise
- // direction, but this function will be used to transform both
- // exterior and interior rings. So in this function we cannot count
- // on any specific order. We should be able to rely on the fact that
- // each ring presented to us is indeed closed.
+ // NOTE: Boundaries are required to proceed in a counterclockwise
+ // direction, but this function will be used to transform both
+ // exterior and interior rings. So in this function we cannot count
+ // on any specific order. We should be able to rely on the fact that
+ // each ring presented to us is indeed closed.
- // To create a MgLinearRing, we need an MgCoordinateCollection. So we
- // create an empty MgCoordinateCollection, and then spend most of our
- // time adding points to this collection. The primary source of these
- // points will be the MgLineStrings returned by the
- // MgCoordinateSystemTransform::GridLine object. Perhaps that function
- // should be modified to return an MgCoordinateCollection? Probably
- // doesn't make much difference as you can't (at least at thie time)
- // add one coordinate collection to another. Too Bad!!!
- targetCollection = new MgCoordinateCollection ();
+ // To create a MgLinearRing, we need an MgCoordinateCollection. So we
+ // create an empty MgCoordinateCollection, and then spend most of our
+ // time adding points to this collection. The primary source of these
+ // points will be the MgLineStrings returned by the
+ // MgCoordinateSystemTransform::GridLine object. Perhaps that function
+ // should be modified to return an MgCoordinateCollection? Probably
+ // doesn't make much difference as you can't (at least at thie time)
+ // add one coordinate collection to another. Too Bad!!!
+ targetCollection = new MgCoordinateCollection ();
- ringItr = linearRing->GetCoordinates ();
- ringItr->MoveNext ();
+ ringItr = linearRing->GetCoordinates ();
+ ringItr->MoveNext ();
+ curToPnt = ringItr->GetCurrent ();
+ copyBufr = transform->Transform (curToPnt);
+ targetCollection->Add (copyBufr);
+ while (ringItr->MoveNext ())
+ {
+ // Convert the current segment.
+ curFromPnt = curToPnt;
curToPnt = ringItr->GetCurrent ();
- copyBufr = transform->Transform (curToPnt);
- targetCollection->Add (copyBufr);
- while (ringItr->MoveNext ())
- {
- // Convert the current segment.
- curFromPnt = curToPnt;
- curToPnt = ringItr->GetCurrent ();
- convertedSegment = transform->GridLine (curFromPnt,curToPnt,curvePrecision,m_MaxCurvePoints);
+ convertedSegment = transform->GridLine (curFromPnt,curToPnt,curvePrecision,m_MaxCurvePoints);
- // Copy the converted segment to the target coordinate collection.
- lineItr = convertedSegment->GetCoordinates ();
+ // Copy the converted segment to the target coordinate collection.
+ lineItr = convertedSegment->GetCoordinates ();
- // To prevent duplicate points, we always skip adding the initial
- // point of a converted line string. We dealt with the initial
- // point of the first segment above. The first point of each
- // additional line segment will have been processed as the "to"
- // point of the last segment processed. Always adding the last
- // point of each segment means we don't need to worry about an
- // extra point when we are done.
- lineItr->MoveNext ();
+ // To prevent duplicate points, we always skip adding the initial
+ // point of a converted line string. We dealt with the initial
+ // point of the first segment above. The first point of each
+ // additional line segment will have been processed as the "to"
+ // point of the last segment processed. Always adding the last
+ // point of each segment means we don't need to worry about an
+ // extra point when we are done.
+ lineItr->MoveNext ();
- // Copy the remainder of the converted line segment.
- while (lineItr->MoveNext ())
- {
- copyBufr = lineItr->GetCurrent ();
- targetCollection->Add (copyBufr);
- }
+ // Copy the remainder of the converted line segment.
+ while (lineItr->MoveNext ())
+ {
+ copyBufr = lineItr->GetCurrent ();
+ targetCollection->Add (copyBufr);
}
+ }
- // OK, we should have now converted our ring to a collection of points.
- // If the ring provided was closed (as it should be) than the result we
- // have created should also be closed. We can now convert this back to
- // a linear ring which is our required return type.
- result = new MgLinearRing (targetCollection);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemGridBoundary.TransformLinearRing")
+ // OK, we should have now converted our ring to a collection of points.
+ // If the ring provided was closed (as it should be) than the result we
+ // have created should also be closed. We can now convert this back to
+ // a linear ring which is our required return type.
+ result = new MgLinearRing (targetCollection);
return result.Detach ();
}
@@ -728,39 +718,37 @@
MgGeometryFactory mgFactory;
MgCoordinateSystemFactory csFactory;
- MG_TRY()
- // Get the region limits in a convenient form.
- westLimit = southwest->GetX ();
- eastLimit = northeast->GetX ();
- southLimit = southwest->GetY ();
- northLimit = northeast->GetY ();
- southeast = mgFactory.CreateCoordinateXY (eastLimit,southLimit);
- northwest = mgFactory.CreateCoordinateXY (westLimit,northLimit);
+ // Get the region limits in a convenient form.
+ westLimit = southwest->GetX ();
+ eastLimit = northeast->GetX ();
+ southLimit = southwest->GetY ();
+ northLimit = northeast->GetY ();
+ southeast = mgFactory.CreateCoordinateXY (eastLimit,southLimit);
+ northwest = mgFactory.CreateCoordinateXY (westLimit,northLimit);
- // Calculate the center of the region and convert to frame coordinates.
- xx = 0.5 * (eastLimit + westLimit);
- yy = 0.5 * (northLimit + southLimit);
- gridToFrame->Transform (&xx,&yy);
- m_RegionCenter = mgFactory.CreateCoordinateXY (xx,yy);
+ // Calculate the center of the region and convert to frame coordinates.
+ xx = 0.5 * (eastLimit + westLimit);
+ yy = 0.5 * (northLimit + southLimit);
+ gridToFrame->Transform (&xx,&yy);
+ m_RegionCenter = mgFactory.CreateCoordinateXY (xx,yy);
- // Generate the polygon; then convert to frame coordinates.
- regionBoundaryInGridCrs = csFactory.GridBoundary (southwest,northeast);
- regionBoundaryInGridCrs->SetMaxCurvePoints (maxPoints);
- m_RegionBoundary = regionBoundaryInGridCrs->GetBoundary (gridToFrame,curvePrecision);
+ // Generate the polygon; then convert to frame coordinates.
+ regionBoundaryInGridCrs = csFactory.GridBoundary (southwest,northeast);
+ regionBoundaryInGridCrs->SetMaxCurvePoints (maxPoints);
+ m_RegionBoundary = regionBoundaryInGridCrs->GetBoundary (gridToFrame,curvePrecision);
- // Generate and clip each of the four bounding lines.
- lineString = gridToFrame->GridLine (southwest,southeast,curvePrecision,maxPoints);
- m_SouthLine = frameBoundary->ClipLineString (lineString);
+ // Generate and clip each of the four bounding lines.
+ lineString = gridToFrame->GridLine (southwest,southeast,curvePrecision,maxPoints);
+ m_SouthLine = frameBoundary->ClipLineString (lineString);
- lineString = gridToFrame->GridLine (southeast,northeast,curvePrecision,maxPoints);
- m_EastLine = frameBoundary->ClipLineString (lineString);
+ lineString = gridToFrame->GridLine (southeast,northeast,curvePrecision,maxPoints);
+ m_EastLine = frameBoundary->ClipLineString (lineString);
- lineString = gridToFrame->GridLine (northeast,northwest,curvePrecision,maxPoints);
- m_NorthLine = frameBoundary->ClipLineString (lineString);
+ lineString = gridToFrame->GridLine (northeast,northwest,curvePrecision,maxPoints);
+ m_NorthLine = frameBoundary->ClipLineString (lineString);
- lineString = gridToFrame->GridLine (northwest,southwest,curvePrecision,maxPoints);
- m_WestLine = frameBoundary->ClipLineString (lineString);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemGridBoundary.SetBoundaryExtents")
+ lineString = gridToFrame->GridLine (northwest,southwest,curvePrecision,maxPoints);
+ m_WestLine = frameBoundary->ClipLineString (lineString);
}
STRING CCoordinateSystemGridRegion::GetLabel ()
{
@@ -932,24 +920,22 @@
double delta;
Ptr<MgCoordinateSystemGridLine> gridLine;
- MG_TRY ()
- // The combination of orientation and grid value should be unique.
- // Return is -1 if not found.
- count = m_GridLineCollection->GetCount ();
- for (index = 0;index < count;index += 1)
+ // The combination of orientation and grid value should be unique.
+ // Return is -1 if not found.
+ count = m_GridLineCollection->GetCount ();
+ for (index = 0;index < count;index += 1)
+ {
+ gridLine = static_cast<MgCoordinateSystemGridLine*>(m_GridLineCollection->GetItem (index));
+ if (gridLine->GetGridOrientation () == gridOrientation)
{
- gridLine = static_cast<MgCoordinateSystemGridLine*>(m_GridLineCollection->GetItem (index));
- if (gridLine->GetGridOrientation () == gridOrientation)
+ delta = fabs (gridLine->GetRealValue () - gridValue);
+ if (delta < 1.0E-012)
{
- delta = fabs (gridLine->GetRealValue () - gridValue);
- if (delta < 1.0E-012)
- {
- rtnValue = index;
- break;
- }
+ rtnValue = index;
+ break;
}
}
- MG_CATCH_AND_THROW(L"CCoordinateSystemGridLineCollection::IndexOf")
+ }
return rtnValue;
}
void CCoordinateSystemGridLineCollection::RemoveAt (INT32 index)
@@ -985,14 +971,12 @@
Ptr<MgCoordinateSystemGridLine> aGridLine;
// Memory check is done inside Add()
- MG_TRY ()
- toAddCount = aGridLineCollection->GetCount ();
- for (index = 0;index < toAddCount;index += 1)
- {
- aGridLine = aGridLineCollection->GetItem (index);
- this->Add (aGridLine);
- }
- MG_CATCH_AND_THROW(L"CCoordinateSystemGridLineCollection::AddCollection")
+ toAddCount = aGridLineCollection->GetCount ();
+ for (index = 0;index < toAddCount;index += 1)
+ {
+ aGridLine = aGridLineCollection->GetItem (index);
+ this->Add (aGridLine);
+ }
return;
}
void CCoordinateSystemGridLineCollection::Dispose(void)
@@ -1058,16 +1042,13 @@
Ptr<MgCoordinateSystemGridRegion> aGridRegion;
// Memory check is done inside Add()
- MG_TRY ()
-
- toAddCount = aGridRegionCollection->GetCount ();
- for (index = 0;index < toAddCount;index += 1)
- {
- aGridRegion = aGridRegionCollection->GetItem (index);
- // This Add refers to the "this" object.
- this->Add (aGridRegion);
- }
- MG_CATCH_AND_THROW(L"CCoordinateSystemGridRegionCollection::AddCollection")
+ toAddCount = aGridRegionCollection->GetCount ();
+ for (index = 0;index < toAddCount;index += 1)
+ {
+ aGridRegion = aGridRegionCollection->GetItem (index);
+ // This Add refers to the "this" object.
+ this->Add (aGridRegion);
+ }
return;
}
void CCoordinateSystemGridRegionCollection::Dispose (void)
@@ -1134,14 +1115,12 @@
Ptr<MgCoordinateSystemGridTick> aGridTick;
// Memory check is done in Add()
- MG_TRY ()
- toAddCount = aGridTickCollection->GetCount ();
- for (index = 0;index < toAddCount;index += 1)
- {
- aGridTick = aGridTickCollection->GetItem (index);
- this->Add (aGridTick);
- }
- MG_CATCH_AND_THROW(L"CCoordinateSystemGridTickCollection::AddCollection")
+ toAddCount = aGridTickCollection->GetCount ();
+ for (index = 0;index < toAddCount;index += 1)
+ {
+ aGridTick = aGridTickCollection->GetItem (index);
+ this->Add (aGridTick);
+ }
return;
}
void CCoordinateSystemGridTickCollection::Dispose (void)
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMathComparator.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMathComparator.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMathComparator.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -68,7 +68,6 @@
//
bool CCoordinateSystemMathComparator::Same(MgGuardDisposable *pDefinition1, MgGuardDisposable *pDefinition2)
{
- MG_TRY()
assert(pDefinition1);
assert(pDefinition2);
if (!pDefinition1 || !pDefinition2) return false;
@@ -114,7 +113,6 @@
}
return SameCoordinateSystem(pCsDef1, pCsDef2);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemMathComparator.Same")
// It's not any def type we care about.
return false;
@@ -126,7 +124,6 @@
//
bool CCoordinateSystemMathComparator::SameEllipsoid(MgCoordinateSystemEllipsoid *pDefinition1, MgCoordinateSystemEllipsoid *pDefinition2)
{
- MG_TRY()
assert(pDefinition1);
assert(pDefinition2);
if (!pDefinition1 || !pDefinition2) return false;
@@ -144,7 +141,6 @@
#ifdef _DEBUG
bResult = true;
#endif
- MG_CATCH_AND_THROW(L"MgCoordinateSystemMathComparator.SameEllipsoid")
return true;
}
@@ -155,7 +151,6 @@
//
bool CCoordinateSystemMathComparator::SameDatum(MgCoordinateSystemDatum *pDefinition1, MgCoordinateSystemDatum *pDefinition2)
{
- MG_TRY()
assert(pDefinition1);
assert(pDefinition2);
if (!pDefinition1 || !pDefinition2) return false;
@@ -298,7 +293,6 @@
#ifdef _DEBUG
bResult = true;
#endif
- MG_CATCH_AND_THROW(L"MgCoordinateSystemMathComparator.SameDatum")
// They're mathematically identical.
return true;
@@ -310,7 +304,6 @@
//
bool CCoordinateSystemMathComparator::SameCoordinateSystem(MgCoordinateSystem *pDefinition1, MgCoordinateSystem *pDefinition2)
{
- MG_TRY()
assert(pDefinition1);
assert(pDefinition2);
if (!pDefinition1 || !pDefinition2) return false;
@@ -500,8 +493,6 @@
bResult = true;
#endif
- MG_CATCH_AND_THROW(L"MgCoordinateSystemMathComparator.SameCoordinateSystem")
-
// Okay, they're mathematically identical.
return true;
}
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMeasure.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMeasure.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMeasure.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -78,7 +78,6 @@
{
double distance = 0.0;
- MG_TRY()
if(m_pCoordSys->GetType() == MgCoordinateSystemType::Arbitrary)
{
distance = m_pCoordSys->MeasureEuclideanDistance(x1, y1, x2, y2);
@@ -87,7 +86,6 @@
{
distance = m_pCoordSys->MeasureGreatCircleDistance(x1, y1, x2, y2);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemMeasure.GetDistance")
return distance;
}
@@ -96,14 +94,12 @@
double CCoordinateSystemMeasure::GetDistance(MgCoordinate* coord1, MgCoordinate* coord2)
{
double distance = 0.0;
- MG_TRY()
if((NULL == coord1) || (NULL == coord2))
{
throw new MgApplicationException(L"MgCoordinateSystemMeasure.GetDistance", __LINE__, __WFILE__, NULL, L"NullArgument", NULL);
}
distance = GetDistance(coord1->GetX(), coord1->GetY(), coord2->GetX(), coord2->GetY());
- MG_CATCH_AND_THROW(L"MgCoordinateSystemMeasure.GetDistance")
return distance;
}
@@ -132,9 +128,7 @@
{
double azimuth = 0.0;
- MG_TRY()
azimuth = m_pCoordSys->GetAzimuth(x1, y1, x2, y2);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemMeasure.GetAzimuth")
return azimuth;
}
@@ -143,13 +137,12 @@
double CCoordinateSystemMeasure::GetAzimuth(MgCoordinate* coord1, MgCoordinate* coord2)
{
double azimuth = 0.0;
- MG_TRY()
+
if((NULL == coord1) || (NULL == coord2))
{
throw new MgApplicationException(L"MgCoordinateSystemMeasure.GetAzimuth", __LINE__, __WFILE__, NULL, L"NullArgument", NULL);
}
azimuth = GetAzimuth(coord1->GetX(), coord1->GetY(), coord2->GetX(), coord2->GetY());
- MG_CATCH_AND_THROW(L"MgCoordinateSystemMeasure.GetAzimuth")
return azimuth;
}
@@ -186,9 +179,8 @@
{
MgCoordinate* pCoordinate=NULL;
- MG_TRY()
pCoordinate=m_pCoordSys->GetCoordinate(xStart, yStart, azimuth, distance);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemMeasure.GetCoordinate")
+
return pCoordinate;
}
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMgrs.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMgrs.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMgrs.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -266,61 +266,59 @@
void CCoordinateSystemMgrs::InitMgrsSpecification (MgCoordinateSystemGridSpecification* pSpecification,
INT32 mgrsGridLevel)
{
- MG_TRY ()
- // Initialize the standard stuff.
- pSpecification->SetGridBase (0.0,0.0);
- if (mgrsGridLevel == MgCoordinateSystemMgrsGridLevel::MgrsUtm)
- {
- pSpecification->SetGridIncrement (6.0,8.0);
- pSpecification->SetTickIncrements (1.0,1.0);
- pSpecification->SetUnits (MgCoordinateSystemUnitCode::Degree,MgCoordinateSystemUnitType::Angular);
- pSpecification->SetCurvePrecision (1.0E-05);
+ // Initialize the standard stuff.
+ pSpecification->SetGridBase (0.0,0.0);
+ if (mgrsGridLevel == MgCoordinateSystemMgrsGridLevel::MgrsUtm)
+ {
+ pSpecification->SetGridIncrement (6.0,8.0);
+ pSpecification->SetTickIncrements (1.0,1.0);
+ pSpecification->SetUnits (MgCoordinateSystemUnitCode::Degree,MgCoordinateSystemUnitType::Angular);
+ pSpecification->SetCurvePrecision (1.0E-05);
+ }
+ else if (mgrsGridLevel == MgCoordinateSystemMgrsGridLevel::MgrsUps)
+ {
+ pSpecification->SetGridIncrement (4.0,4.0);
+ pSpecification->SetTickIncrements (1.0,1.0);
+ pSpecification->SetUnits (MgCoordinateSystemUnitCode::Degree,MgCoordinateSystemUnitType::Angular);
+ pSpecification->SetCurvePrecision (1.0E-05);
+ }
+ else if (mgrsGridLevel >= MgCoordinateSystemMgrsGridLevel::Mgrs100Km &&
+ mgrsGridLevel <= MgCoordinateSystemMgrsGridLevel::Mgrs1m)
+ {
+ double gridIncrement;
+ switch (mgrsGridLevel) {
+ case MgCoordinateSystemMgrsGridLevel::Mgrs100Km:
+ gridIncrement = 100000.0;
+ break;
+ case MgCoordinateSystemMgrsGridLevel::Mgrs10Km:
+ gridIncrement = 10000.0;
+ break;
+ case MgCoordinateSystemMgrsGridLevel::Mgrs1Km:
+ gridIncrement = 1000.0;
+ break;
+ case MgCoordinateSystemMgrsGridLevel::Mgrs100m:
+ gridIncrement = 100.0;
+ break;
+ case MgCoordinateSystemMgrsGridLevel::Mgrs10m:
+ gridIncrement = 10.0;
+ break;
+ case MgCoordinateSystemMgrsGridLevel::Mgrs1m:
+ gridIncrement = 1.0;
+ break;
+ default:
+ // to keep lint happy
+ gridIncrement = 0.0;
+ break;
}
- else if (mgrsGridLevel == MgCoordinateSystemMgrsGridLevel::MgrsUps)
- {
- pSpecification->SetGridIncrement (4.0,4.0);
- pSpecification->SetTickIncrements (1.0,1.0);
- pSpecification->SetUnits (MgCoordinateSystemUnitCode::Degree,MgCoordinateSystemUnitType::Angular);
- pSpecification->SetCurvePrecision (1.0E-05);
- }
- else if (mgrsGridLevel >= MgCoordinateSystemMgrsGridLevel::Mgrs100Km &&
- mgrsGridLevel <= MgCoordinateSystemMgrsGridLevel::Mgrs1m)
- {
- double gridIncrement;
- switch (mgrsGridLevel) {
- case MgCoordinateSystemMgrsGridLevel::Mgrs100Km:
- gridIncrement = 100000.0;
- break;
- case MgCoordinateSystemMgrsGridLevel::Mgrs10Km:
- gridIncrement = 10000.0;
- break;
- case MgCoordinateSystemMgrsGridLevel::Mgrs1Km:
- gridIncrement = 1000.0;
- break;
- case MgCoordinateSystemMgrsGridLevel::Mgrs100m:
- gridIncrement = 100.0;
- break;
- case MgCoordinateSystemMgrsGridLevel::Mgrs10m:
- gridIncrement = 10.0;
- break;
- case MgCoordinateSystemMgrsGridLevel::Mgrs1m:
- gridIncrement = 1.0;
- break;
- default:
- // to keep lint happy
- gridIncrement = 0.0;
- break;
- }
- pSpecification->SetGridIncrement (gridIncrement,gridIncrement);
- pSpecification->SetTickIncrements (gridIncrement / 10.0,gridIncrement / 10.0);
- pSpecification->SetUnits (MgCoordinateSystemUnitCode::Meter,MgCoordinateSystemUnitType::Linear);
- pSpecification->SetCurvePrecision (0.25);
- }
- else
- {
- // Parameter error
- }
- MG_CATCH_AND_THROW(L"MgCoordinateSystemMgrs::InitMgrsSpecification")
+ pSpecification->SetGridIncrement (gridIncrement,gridIncrement);
+ pSpecification->SetTickIncrements (gridIncrement / 10.0,gridIncrement / 10.0);
+ pSpecification->SetUnits (MgCoordinateSystemUnitCode::Meter,MgCoordinateSystemUnitType::Linear);
+ pSpecification->SetCurvePrecision (0.25);
+ }
+ else
+ {
+ // Parameter error
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
INT32 CCoordinateSystemMgrs::GetSpecializationType ()
@@ -369,47 +367,45 @@
__LINE__, __WFILE__, NULL, L"CoordinateSystemInitializationFailed", NULL);
}
- MG_TRY ()
- theGridLineCollection = new CCoordinateSystemGridLineCollection (m_GridLineMemoryThreshold);
+ theGridLineCollection = new CCoordinateSystemGridLineCollection (m_GridLineMemoryThreshold);
- // Determine the grid type.
- unitType = specification->GetUnitType();
- specIsGrid = (unitType == MgCoordinateSystemUnitType::Linear);
+ // Determine the grid type.
+ unitType = specification->GetUnitType();
+ specIsGrid = (unitType == MgCoordinateSystemUnitType::Linear);
- // Process each zone in our zone collection. Originally, we thought
- // we could just call the GetGridLines function of the OneGrid
- // base class, but there are just too many special cases to deal with.
- // So, rather than kludge a bunch of special stuff into OneGrid and
- // compromise its generality, we have our own functions in this MGRS
- // specific object which duplicates much of the functionality of the
- // OneGrid objoect.
- zoneCount = m_ZoneCollection->GetCount ();
- for (index = 0;index < zoneCount;index += 1)
+ // Process each zone in our zone collection. Originally, we thought
+ // we could just call the GetGridLines function of the OneGrid
+ // base class, but there are just too many special cases to deal with.
+ // So, rather than kludge a bunch of special stuff into OneGrid and
+ // compromise its generality, we have our own functions in this MGRS
+ // specific object which duplicates much of the functionality of the
+ // OneGrid objoect.
+ zoneCount = m_ZoneCollection->GetCount ();
+ for (index = 0;index < zoneCount;index += 1)
+ {
+ mgrsZoneGrid = m_ZoneCollection->GetItem (index);
+ if (specIsGrid)
{
- mgrsZoneGrid = m_ZoneCollection->GetItem (index);
- if (specIsGrid)
- {
- // The specification calls for a grid. The following function
- // is smart enough to deal with the special nature of zones
- // 31 through 37 at the higher northern latitudes.
- aGridLineCollection = mgrsZoneGrid->GetGridLines (m_GridBoundary,specification);
- }
- else
- {
- // The specification calls for a graticule This object is
- // smart enough to deal with band X (which is 12 degrees high)
- // and the special nature of zones 31 through 37 at the higher
- // northern latitudes.
- aGridLineCollection = mgrsZoneGrid->GetGraticuleLines (m_GridBoundary,specification);
- }
- if (aGridLineCollection != 0)
- {
- // Add whatever we got to the collection we are accumulating.
- theGridLineCollection->AddCollection (aGridLineCollection);
- aGridLineCollection = 0;
- }
+ // The specification calls for a grid. The following function
+ // is smart enough to deal with the special nature of zones
+ // 31 through 37 at the higher northern latitudes.
+ aGridLineCollection = mgrsZoneGrid->GetGridLines (m_GridBoundary,specification);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemMgrs::GetGridLines")
+ else
+ {
+ // The specification calls for a graticule This object is
+ // smart enough to deal with band X (which is 12 degrees high)
+ // and the special nature of zones 31 through 37 at the higher
+ // northern latitudes.
+ aGridLineCollection = mgrsZoneGrid->GetGraticuleLines (m_GridBoundary,specification);
+ }
+ if (aGridLineCollection != 0)
+ {
+ // Add whatever we got to the collection we are accumulating.
+ theGridLineCollection->AddCollection (aGridLineCollection);
+ aGridLineCollection = 0;
+ }
+ }
return static_cast<MgCoordinateSystemGridLineCollection*>(theGridLineCollection.Detach());
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -427,17 +423,15 @@
__LINE__, __WFILE__, NULL, L"CoordinateSystemInitializationFailed", NULL);
}
- MG_TRY ()
- theGridRegionCollection = new CCoordinateSystemGridRegionCollection (m_GridRegionMemoryThreshold);
- zoneCount = m_ZoneCollection->GetCount ();
- for (index = 0;index < zoneCount;index += 1)
- {
- mgrsZoneGrid = m_ZoneCollection->GetItem (index);
- Ptr<MgCoordinateSystemGridRegionCollection> aGridRegionCollection;
- aGridRegionCollection = mgrsZoneGrid->GetGridRegions (m_GridBoundary,specification);
- theGridRegionCollection->AddCollection (aGridRegionCollection);
- }
- MG_CATCH_AND_THROW(L"MgCoordinateSystemMgrs::GetGridRegions")
+ theGridRegionCollection = new CCoordinateSystemGridRegionCollection (m_GridRegionMemoryThreshold);
+ zoneCount = m_ZoneCollection->GetCount ();
+ for (index = 0;index < zoneCount;index += 1)
+ {
+ mgrsZoneGrid = m_ZoneCollection->GetItem (index);
+ Ptr<MgCoordinateSystemGridRegionCollection> aGridRegionCollection;
+ aGridRegionCollection = mgrsZoneGrid->GetGridRegions (m_GridBoundary,specification);
+ theGridRegionCollection->AddCollection (aGridRegionCollection);
+ }
return static_cast<MgCoordinateSystemGridRegionCollection*>(theGridRegionCollection.Detach());
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -459,42 +453,40 @@
__LINE__, __WFILE__, NULL, L"CoordinateSystemInitializationFailed", NULL);
}
- MG_TRY ()
- theGridTickCollection = new CCoordinateSystemGridTickCollection (m_GridTickMemoryThreshold);
- unitType = specification->GetUnitType();
- specIsGrid = (unitType == MgCoordinateSystemUnitType::Linear);
- if (specIsGrid)
+ theGridTickCollection = new CCoordinateSystemGridTickCollection (m_GridTickMemoryThreshold);
+ unitType = specification->GetUnitType();
+ specIsGrid = (unitType == MgCoordinateSystemUnitType::Linear);
+ if (specIsGrid)
+ {
+ zoneCount = m_ZoneCollection->GetCount ();
+ for (index = 0;index < zoneCount;index += 1)
{
- zoneCount = m_ZoneCollection->GetCount ();
- for (index = 0;index < zoneCount;index += 1)
- {
- mgrsZoneGrid = m_ZoneCollection->GetItem (index);
- aGridTickCollection = mgrsZoneGrid->GetBoundaryTicks (specification);
- theGridTickCollection->AddCollection (aGridTickCollection);
- }
+ mgrsZoneGrid = m_ZoneCollection->GetItem (index);
+ aGridTickCollection = mgrsZoneGrid->GetBoundaryTicks (specification);
+ theGridTickCollection->AddCollection (aGridTickCollection);
}
- else
+ }
+ else
+ {
+ if (m_GraticuleUtm)
{
- if (m_GraticuleUtm)
- {
- aGridTickCollection = m_GraticuleUtm->GetBoundaryTicks (specification);
- theGridTickCollection->AddCollection (aGridTickCollection);
- }
- if (m_GraticuleUpsNorth)
- {
- aGridTickCollection = m_GraticuleUpsNorth->GetBoundaryTicks (specification);
- theGridTickCollection->AddCollection (aGridTickCollection);
- }
- if (m_GraticuleUpsSouth)
- {
- aGridTickCollection = m_GraticuleUpsSouth->GetBoundaryTicks (specification);
- theGridTickCollection->AddCollection (aGridTickCollection);
- }
+ aGridTickCollection = m_GraticuleUtm->GetBoundaryTicks (specification);
+ theGridTickCollection->AddCollection (aGridTickCollection);
}
- // TODO: Need to remove from the collection any grid ticks which are
- // internal to the m_GridBoundary object of this object. This will be
- // tricky, as the tick positions will usually be right on the boundary.
- MG_CATCH_AND_THROW(L"MgCoordinateSystemMgrs::GetGridTicks")
+ if (m_GraticuleUpsNorth)
+ {
+ aGridTickCollection = m_GraticuleUpsNorth->GetBoundaryTicks (specification);
+ theGridTickCollection->AddCollection (aGridTickCollection);
+ }
+ if (m_GraticuleUpsSouth)
+ {
+ aGridTickCollection = m_GraticuleUpsSouth->GetBoundaryTicks (specification);
+ theGridTickCollection->AddCollection (aGridTickCollection);
+ }
+ }
+ // TODO: Need to remove from the collection any grid ticks which are
+ // internal to the m_GridBoundary object of this object. This will be
+ // tricky, as the tick positions will usually be right on the boundary.
return static_cast<MgCoordinateSystemGridTickCollection*>(theGridTickCollection.Detach());
}
@@ -909,269 +901,267 @@
// pointer will be null. In this case, we must not add the zone to the zone
// collection.
- MG_TRY ()
- Ptr<MgCoordinateSystemFactory> csFactory = new MgCoordinateSystemFactory ();
- zoneCollection = new CCoordinateSystemMgrsZoneCollection ();
- pSouthwest = new MgCoordinateXY ();
- pNortheast = new MgCoordinateXY ();
+ Ptr<MgCoordinateSystemFactory> csFactory = new MgCoordinateSystemFactory ();
+ zoneCollection = new CCoordinateSystemMgrsZoneCollection ();
+ pSouthwest = new MgCoordinateXY ();
+ pNortheast = new MgCoordinateXY ();
- // Release any graticule objects which may already exist.
- m_GraticuleUtm = 0;
- m_GraticuleUpsNorth = 0;
- m_GraticuleUpsSouth = 0;
+ // Release any graticule objects which may already exist.
+ m_GraticuleUtm = 0;
+ m_GraticuleUpsNorth = 0;
+ m_GraticuleUpsSouth = 0;
- // Get the min/max of the frame in frame coordinates.
- frameBoundary->GetBoundaryExtents (eastMin,eastMax,northMin,northMax);
+ // Get the min/max of the frame in frame coordinates.
+ frameBoundary->GetBoundaryExtents (eastMin,eastMax,northMin,northMax);
- // Convert the polygon portion of the Grid Boundary object to long/lat
- // coordinates and extract the min/max from the resulting polygon.
- llCRS = csFactory->CreateFromCode (useFrameDatum ? L"LL" : L"LL84");
- toLlTransform = csFactory->GetTransform(frameCRS,llCRS);
- toLlTransform->IgnoreDatumShiftWarning (true);
- toLlTransform->IgnoreOutsideDomainWarning (true);
- toFrameTransform = csFactory->GetTransform(llCRS,frameCRS);
- toFrameTransform->IgnoreDatumShiftWarning (true);
- toFrameTransform->IgnoreOutsideDomainWarning (true);
- pPolygon = frameBoundary->GetBoundary (toLlTransform,1.0E-05);
- llBoundary = csFactory->GridBoundary (pPolygon);
- llBoundary->GetBoundaryExtents (lngMin,lngMax,latMin,latMax);
+ // Convert the polygon portion of the Grid Boundary object to long/lat
+ // coordinates and extract the min/max from the resulting polygon.
+ llCRS = csFactory->CreateFromCode (useFrameDatum ? L"LL" : L"LL84");
+ toLlTransform = csFactory->GetTransform(frameCRS,llCRS);
+ toLlTransform->IgnoreDatumShiftWarning (true);
+ toLlTransform->IgnoreOutsideDomainWarning (true);
+ toFrameTransform = csFactory->GetTransform(llCRS,frameCRS);
+ toFrameTransform->IgnoreDatumShiftWarning (true);
+ toFrameTransform->IgnoreOutsideDomainWarning (true);
+ pPolygon = frameBoundary->GetBoundary (toLlTransform,1.0E-05);
+ llBoundary = csFactory->GridBoundary (pPolygon);
+ llBoundary->GetBoundaryExtents (lngMin,lngMax,latMin,latMax);
- // The llBoundary object has been created using rectangular techniques.
- // Since the earth is spherical, in certain rare cases the resulting
- // extents can exclude either (or both, presumably) pole when inclusion
- // is appropriate. We try to deal with that issue here. We use this
- // technique only for projections which we believe can properly
- // represent a pole for defensive purposes.
+ // The llBoundary object has been created using rectangular techniques.
+ // Since the earth is spherical, in certain rare cases the resulting
+ // extents can exclude either (or both, presumably) pole when inclusion
+ // is appropriate. We try to deal with that issue here. We use this
+ // technique only for projections which we believe can properly
+ // represent a pole for defensive purposes.
- if (CanDoPoles (frameCRS))
+ if (CanDoPoles (frameCRS))
+ {
+ // Use the toFrameXform object to convert the north pole to the frame
+ // coordinate system. If the conversion is successful, and the result
+ // resides within the original cartesian frame boundary, we add the
+ // north pole to the extents generated by the GetBoundaryExtents
+ // function call.
+ if (latMax > 0.0)
{
- // Use the toFrameXform object to convert the north pole to the frame
- // coordinate system. If the conversion is successful, and the result
- // resides within the original cartesian frame boundary, we add the
- // north pole to the extents generated by the GetBoundaryExtents
- // function call.
- if (latMax > 0.0)
+ Ptr<MgCoordinate> poleTest = new MgCoordinateXY (0.0,90.0);
+ poleTest = toFrameTransform->Transform (poleTest);
+ if (poleTest->GetX () >= eastMin && poleTest->GetX () <= eastMax &&
+ poleTest->GetY () >= northMin && poleTest->GetY () <= northMax)
{
- Ptr<MgCoordinate> poleTest = new MgCoordinateXY (0.0,90.0);
- poleTest = toFrameTransform->Transform (poleTest);
- if (poleTest->GetX () >= eastMin && poleTest->GetX () <= eastMax &&
- poleTest->GetY () >= northMin && poleTest->GetY () <= northMax)
- {
- northPole = true;
- }
+ northPole = true;
}
- if (latMin < 0.0)
+ }
+ if (latMin < 0.0)
+ {
+ Ptr<MgCoordinate> poleTest = new MgCoordinateXY (0.0,-90.0);
+ poleTest = toFrameTransform->Transform (poleTest);
+ if (poleTest->GetX () >= eastMin && poleTest->GetX () <= eastMax &&
+ poleTest->GetY () >= northMin && poleTest->GetY () <= northMax)
{
- Ptr<MgCoordinate> poleTest = new MgCoordinateXY (0.0,-90.0);
- poleTest = toFrameTransform->Transform (poleTest);
- if (poleTest->GetX () >= eastMin && poleTest->GetX () <= eastMax &&
- poleTest->GetY () >= northMin && poleTest->GetY () <= northMax)
- {
- southPole = true;
- }
+ southPole = true;
}
}
+ }
- // Use the latitude min/max to extract the UTM/UPS zones as necessary.
- if (latMin < -80.0 || southPole)
+ // Use the latitude min/max to extract the UTM/UPS zones as necessary.
+ if (latMin < -80.0 || southPole)
+ {
+ // There is a portion of the frame boundary in the south polar region.
+ zoneNbr = -61;
+
+ pPolygon = 0;
+ if (southPole)
{
- // There is a portion of the frame boundary in the south polar region.
- zoneNbr = -61;
+ // The south pole is included within the provided frame boundary.
+ // In this case, the rectangular technique used above would
+ // produce a closed polygon which will look like a circular pie
+ // with an infitessiammly smal slice in it. This slice drives
+ // the clipper crazy. So, we need to develop a simple
+ // circular closed boundary around, but not including the
+ // pole.
- pPolygon = 0;
- if (southPole)
+ // Since we need to do the same thing for the northern pole as
+ // well, we have a function that will do that for us. THis
+ // function will fail if the underlying frame CRS is not
+ // suitable for polar aspects.
+ pPolygon = ParallelPolygon (toFrameTransform,-80.0,720);
+ }
+ if (!pPolygon)
+ {
+ // The south pole is not within the frame boundary, the
+ // generation of a circular boundary representing a parallel
+ // failed, or the frame CRS is incapabale of representing
+ // the pole. Therefore, we have to use the standard rectangular
+ // boundary technique and hope for the best. This should work
+ // fine if the region does not actually include the pole, and
+ // the results should be decent in other cases.
+ pSouthwest->SetX (lngMin);
+ pSouthwest->SetY (latMin);
+ pNortheast->SetX (lngMax);
+ pNortheast->SetY (-80.0);
+ llBoundary = csFactory->GridBoundary (pSouthwest,pNortheast);
+ pPolygon = llBoundary->GetBoundary (toFrameTransform,1.0);
+ }
+ if (pPolygon)
+ {
+ Ptr<MgPolygon> pPolygonTemp = frameBoundary->GetBoundary ();
+ pPolygonIntersection = dynamic_cast<MgPolygon*>(pPolygon->Intersection (pPolygonTemp));
+ if (pPolygonIntersection != 0)
{
- // The south pole is included within the provided frame boundary.
- // In this case, the rectangular technique used above would
- // produce a closed polygon which will look like a circular pie
- // with an infitessiammly smal slice in it. This slice drives
- // the clipper crazy. So, we need to develop a simple
- // circular closed boundary around, but not including the
- // pole.
+ reducedFrameBoundary = csFactory->GridBoundary (pPolygonIntersection);
+ mgrsZoneGrid = new CCoordinateSystemMgrsZone (reducedFrameBoundary,zoneNbr,useFrameDatum,frameCRS,m_nLetteringScheme,
+ m_GridLineMemoryThreshold,m_GridTickMemoryThreshold,m_GridRegionMemoryThreshold);
+ zoneCollection->Add (mgrsZoneGrid);
- // Since we need to do the same thing for the northern pole as
- // well, we have a function that will do that for us. THis
- // function will fail if the underlying frame CRS is not
- // suitable for polar aspects.
- pPolygon = ParallelPolygon (toFrameTransform,-80.0,720);
+ // Construct the m_GraticuleUpsSouth member, it may be needed.
+ m_GraticuleUpsSouth = new CCoordinateSystemOneGrid (reducedFrameBoundary,llCRS,frameCRS,
+ m_GridLineMemoryThreshold,m_GridTickMemoryThreshold);
}
- if (!pPolygon)
+ }
+ }
+ if (latMax > 84.0 || northPole)
+ {
+ // There is a portion of the frame boundary in the north polar region.
+ zoneNbr = 61;
+
+ // Same as for the south pole, sans the laborious comments.
+ pPolygon = 0;
+ if (northPole)
+ {
+ pPolygon = ParallelPolygon (toFrameTransform,84.0,720);
+ }
+ if (pPolygon == 0)
+ {
+ pSouthwest->SetX (lngMin);
+ pSouthwest->SetY (84.0);
+ pNortheast->SetX (lngMax);
+ pNortheast->SetY (latMax);
+ llBoundary = csFactory->GridBoundary (pSouthwest,pNortheast);
+ pPolygon = llBoundary->GetBoundary (toFrameTransform,1.0);
+ }
+ if (pPolygon != 0)
+ {
+ Ptr<MgPolygon> pPolygonTemp = frameBoundary->GetBoundary ();
+ pPolygonIntersection = dynamic_cast<MgPolygon*>(pPolygon->Intersection (pPolygonTemp));
+ if (pPolygonIntersection != 0)
{
- // The south pole is not within the frame boundary, the
- // generation of a circular boundary representing a parallel
- // failed, or the frame CRS is incapabale of representing
- // the pole. Therefore, we have to use the standard rectangular
- // boundary technique and hope for the best. This should work
- // fine if the region does not actually include the pole, and
- // the results should be decent in other cases.
- pSouthwest->SetX (lngMin);
- pSouthwest->SetY (latMin);
- pNortheast->SetX (lngMax);
- pNortheast->SetY (-80.0);
- llBoundary = csFactory->GridBoundary (pSouthwest,pNortheast);
- pPolygon = llBoundary->GetBoundary (toFrameTransform,1.0);
+ reducedFrameBoundary = csFactory->GridBoundary (pPolygonIntersection);
+ mgrsZoneGrid = new CCoordinateSystemMgrsZone (reducedFrameBoundary,zoneNbr,useFrameDatum,frameCRS,m_nLetteringScheme,
+ m_GridLineMemoryThreshold,m_GridTickMemoryThreshold,m_GridRegionMemoryThreshold);
+ zoneCollection->Add (mgrsZoneGrid);
+
+ // Construct the m_GraticuleUpsNorth member, it may be needed.
+ m_GraticuleUpsNorth = new CCoordinateSystemOneGrid (reducedFrameBoundary,llCRS,frameCRS,
+ m_GridLineMemoryThreshold,m_GridTickMemoryThreshold);
}
- if (pPolygon)
+ }
+ }
+ if (latMax > -80.0 && latMin < 84.0)
+ {
+ // A portion of the frame boundary is in the region covered by the
+ // normal (i.e. non-polar) UTM zones. Determine the particular UTM
+ // zones we need to generate.
+ tmpInt32 = static_cast <INT32>(floor (lngMin));
+ zoneMin = ((tmpInt32 + 180) / 6) + 1;
+ tmpInt32 = static_cast <INT32>(ceil (lngMax));
+ zoneMax = ((tmpInt32 + 180) / 6) + 1;
+
+ if (latMax > 0.0)
+ {
+ // There are some northern zones.
+
+ // We will need to generate, for each UTM zone, the extents
+ // of that particular UTM zone trimmed to the extents of the
+ // provided frame boundary. The north/south portions
+ // are the same for each zone, so we do that once here outside
+ // the loop.
+ pSouthwest->SetY ((latMin < 0.0) ? 0.0 : latMin);
+ pNortheast->SetY ((latMax > 84.0) ? 84.0 : latMax);
+
+ // OK, generate a CCoordinateSystemMgrsZone object for each
+ // UTM zone which intersects the frame boundary provided.
+ // Usually only one, but we must be able to handle the
+ // multiple zone case.
+ for (zoneNbr = zoneMin;zoneNbr <= zoneMax;zoneNbr += 1)
{
+ // 1> Compute the 'LL' boundary of this UTM zone.
+ // North/South done above, here we need only deal
+ // with east/west.
+ cm = static_cast<double>((zoneNbr * 6) - 183);
+ westLimit = cm - 3.0;
+ eastLimit = cm + 3.0;
+
+ // 2> Apply the extents of the provided frame boundary.
+ if (westLimit < lngMin) westLimit = lngMin;
+ if (eastLimit > lngMax) eastLimit = lngMax;
+
+ // 3> Create, in terms of LL coordinates, the frame
+ // boundary as is appropriate for this particular zone.
+ pSouthwest->SetX (westLimit);
+ pNortheast->SetX (eastLimit);
+
+ // 4> Convert this reduced frame boundary back to frame
+ // coordinates.
+ llBoundary = csFactory->GridBoundary (pSouthwest,pNortheast);
+ pPolygon = llBoundary->GetBoundary (toFrameTransform,1.0);
Ptr<MgPolygon> pPolygonTemp = frameBoundary->GetBoundary ();
pPolygonIntersection = dynamic_cast<MgPolygon*>(pPolygon->Intersection (pPolygonTemp));
if (pPolygonIntersection != 0)
{
reducedFrameBoundary = csFactory->GridBoundary (pPolygonIntersection);
mgrsZoneGrid = new CCoordinateSystemMgrsZone (reducedFrameBoundary,zoneNbr,useFrameDatum,frameCRS,m_nLetteringScheme,
- m_GridLineMemoryThreshold,m_GridTickMemoryThreshold,m_GridRegionMemoryThreshold);
+ m_GridLineMemoryThreshold,m_GridTickMemoryThreshold,m_GridRegionMemoryThreshold);
zoneCollection->Add (mgrsZoneGrid);
-
- // Construct the m_GraticuleUpsSouth member, it may be needed.
- m_GraticuleUpsSouth = new CCoordinateSystemOneGrid (reducedFrameBoundary,llCRS,frameCRS,
- m_GridLineMemoryThreshold,m_GridTickMemoryThreshold);
}
- }
+ }
}
- if (latMax > 84.0 || northPole)
+ if (latMin < 0.0)
{
- // There is a portion of the frame boundary in the north polar region.
- zoneNbr = 61;
-
- // Same as for the south pole, sans the laborious comments.
- pPolygon = 0;
- if (northPole)
+ // Pretty much the same as the northern zones processed
+ // above, but without the laborious comments.
+ pSouthwest->SetY ((latMin < -80.0) ? -80.0 : latMin);
+ pNortheast->SetY ((latMax > 0.0) ? 0.0 : latMax);
+ for (zoneNbr = zoneMin;zoneNbr <= zoneMax;zoneNbr += 1)
{
- pPolygon = ParallelPolygon (toFrameTransform,84.0,720);
- }
- if (pPolygon == 0)
- {
- pSouthwest->SetX (lngMin);
- pSouthwest->SetY (84.0);
- pNortheast->SetX (lngMax);
- pNortheast->SetY (latMax);
+ cm = static_cast<double>((zoneNbr * 6) - 183);
+ westLimit = cm - 3.0;
+ eastLimit = cm + 3.0;
+ if (westLimit < lngMin) westLimit = lngMin;
+ if (eastLimit > lngMax) eastLimit = lngMax;
+ pSouthwest->SetX (westLimit);
+ pNortheast->SetX (eastLimit);
+
llBoundary = csFactory->GridBoundary (pSouthwest,pNortheast);
pPolygon = llBoundary->GetBoundary (toFrameTransform,1.0);
- }
- if (pPolygon != 0)
- {
Ptr<MgPolygon> pPolygonTemp = frameBoundary->GetBoundary ();
pPolygonIntersection = dynamic_cast<MgPolygon*>(pPolygon->Intersection (pPolygonTemp));
if (pPolygonIntersection != 0)
{
reducedFrameBoundary = csFactory->GridBoundary (pPolygonIntersection);
- mgrsZoneGrid = new CCoordinateSystemMgrsZone (reducedFrameBoundary,zoneNbr,useFrameDatum,frameCRS,m_nLetteringScheme,
- m_GridLineMemoryThreshold,m_GridTickMemoryThreshold,m_GridRegionMemoryThreshold);
+ mgrsZoneGrid = new CCoordinateSystemMgrsZone (reducedFrameBoundary,-zoneNbr,useFrameDatum,frameCRS,m_nLetteringScheme,
+ m_GridLineMemoryThreshold,m_GridTickMemoryThreshold,m_GridRegionMemoryThreshold);
zoneCollection->Add (mgrsZoneGrid);
-
- // Construct the m_GraticuleUpsNorth member, it may be needed.
- m_GraticuleUpsNorth = new CCoordinateSystemOneGrid (reducedFrameBoundary,llCRS,frameCRS,
- m_GridLineMemoryThreshold,m_GridTickMemoryThreshold);
}
}
}
- if (latMax > -80.0 && latMin < 84.0)
- {
- // A portion of the frame boundary is in the region covered by the
- // normal (i.e. non-polar) UTM zones. Determine the particular UTM
- // zones we need to generate.
- tmpInt32 = static_cast <INT32>(floor (lngMin));
- zoneMin = ((tmpInt32 + 180) / 6) + 1;
- tmpInt32 = static_cast <INT32>(ceil (lngMax));
- zoneMax = ((tmpInt32 + 180) / 6) + 1;
- if (latMax > 0.0)
- {
- // There are some northern zones.
-
- // We will need to generate, for each UTM zone, the extents
- // of that particular UTM zone trimmed to the extents of the
- // provided frame boundary. The north/south portions
- // are the same for each zone, so we do that once here outside
- // the loop.
- pSouthwest->SetY ((latMin < 0.0) ? 0.0 : latMin);
- pNortheast->SetY ((latMax > 84.0) ? 84.0 : latMax);
-
- // OK, generate a CCoordinateSystemMgrsZone object for each
- // UTM zone which intersects the frame boundary provided.
- // Usually only one, but we must be able to handle the
- // multiple zone case.
- for (zoneNbr = zoneMin;zoneNbr <= zoneMax;zoneNbr += 1)
- {
- // 1> Compute the 'LL' boundary of this UTM zone.
- // North/South done above, here we need only deal
- // with east/west.
- cm = static_cast<double>((zoneNbr * 6) - 183);
- westLimit = cm - 3.0;
- eastLimit = cm + 3.0;
-
- // 2> Apply the extents of the provided frame boundary.
- if (westLimit < lngMin) westLimit = lngMin;
- if (eastLimit > lngMax) eastLimit = lngMax;
-
- // 3> Create, in terms of LL coordinates, the frame
- // boundary as is appropriate for this particular zone.
- pSouthwest->SetX (westLimit);
- pNortheast->SetX (eastLimit);
-
- // 4> Convert this reduced frame boundary back to frame
- // coordinates.
- llBoundary = csFactory->GridBoundary (pSouthwest,pNortheast);
- pPolygon = llBoundary->GetBoundary (toFrameTransform,1.0);
- Ptr<MgPolygon> pPolygonTemp = frameBoundary->GetBoundary ();
- pPolygonIntersection = dynamic_cast<MgPolygon*>(pPolygon->Intersection (pPolygonTemp));
- if (pPolygonIntersection != 0)
- {
- reducedFrameBoundary = csFactory->GridBoundary (pPolygonIntersection);
- mgrsZoneGrid = new CCoordinateSystemMgrsZone (reducedFrameBoundary,zoneNbr,useFrameDatum,frameCRS,m_nLetteringScheme,
- m_GridLineMemoryThreshold,m_GridTickMemoryThreshold,m_GridRegionMemoryThreshold);
- zoneCollection->Add (mgrsZoneGrid);
- }
- }
- }
- if (latMin < 0.0)
- {
- // Pretty much the same as the northern zones processed
- // above, but without the laborious comments.
- pSouthwest->SetY ((latMin < -80.0) ? -80.0 : latMin);
- pNortheast->SetY ((latMax > 0.0) ? 0.0 : latMax);
- for (zoneNbr = zoneMin;zoneNbr <= zoneMax;zoneNbr += 1)
- {
- cm = static_cast<double>((zoneNbr * 6) - 183);
- westLimit = cm - 3.0;
- eastLimit = cm + 3.0;
- if (westLimit < lngMin) westLimit = lngMin;
- if (eastLimit > lngMax) eastLimit = lngMax;
- pSouthwest->SetX (westLimit);
- pNortheast->SetX (eastLimit);
-
- llBoundary = csFactory->GridBoundary (pSouthwest,pNortheast);
- pPolygon = llBoundary->GetBoundary (toFrameTransform,1.0);
- Ptr<MgPolygon> pPolygonTemp = frameBoundary->GetBoundary ();
- pPolygonIntersection = dynamic_cast<MgPolygon*>(pPolygon->Intersection (pPolygonTemp));
- if (pPolygonIntersection != 0)
- {
- reducedFrameBoundary = csFactory->GridBoundary (pPolygonIntersection);
- mgrsZoneGrid = new CCoordinateSystemMgrsZone (reducedFrameBoundary,-zoneNbr,useFrameDatum,frameCRS,m_nLetteringScheme,
- m_GridLineMemoryThreshold,m_GridTickMemoryThreshold,m_GridRegionMemoryThreshold);
- zoneCollection->Add (mgrsZoneGrid);
- }
- }
- }
-
- // Need a CCoordinateSystemOneGrid object which can produce the 6 x 8 graticule
- // for the entire regon.
- pSouthwest->SetX (lngMin);
- pNortheast->SetX (lngMax);
- pSouthwest->SetY ((latMin < -80.0) ? -80.0 : latMin);
- pNortheast->SetY ((latMax > 84.0) ? 84.0 : latMax);
- llBoundary = csFactory->GridBoundary (pSouthwest,pNortheast);
- pPolygon = llBoundary->GetBoundary (toFrameTransform,1.0);
- Ptr<MgPolygon> pPolygonTemp = frameBoundary->GetBoundary ();
- pPolygonIntersection = dynamic_cast<MgPolygon*>(pPolygon->Intersection (pPolygonTemp));
- if (pPolygonIntersection != 0)
- {
- reducedFrameBoundary = csFactory->GridBoundary (pPolygonIntersection);
- m_GraticuleUtm = new CCoordinateSystemOneGrid (reducedFrameBoundary,llCRS,frameCRS,
- m_GridLineMemoryThreshold,m_GridTickMemoryThreshold);
- }
+ // Need a CCoordinateSystemOneGrid object which can produce the 6 x 8 graticule
+ // for the entire regon.
+ pSouthwest->SetX (lngMin);
+ pNortheast->SetX (lngMax);
+ pSouthwest->SetY ((latMin < -80.0) ? -80.0 : latMin);
+ pNortheast->SetY ((latMax > 84.0) ? 84.0 : latMax);
+ llBoundary = csFactory->GridBoundary (pSouthwest,pNortheast);
+ pPolygon = llBoundary->GetBoundary (toFrameTransform,1.0);
+ Ptr<MgPolygon> pPolygonTemp = frameBoundary->GetBoundary ();
+ pPolygonIntersection = dynamic_cast<MgPolygon*>(pPolygon->Intersection (pPolygonTemp));
+ if (pPolygonIntersection != 0)
+ {
+ reducedFrameBoundary = csFactory->GridBoundary (pPolygonIntersection);
+ m_GraticuleUtm = new CCoordinateSystemOneGrid (reducedFrameBoundary,llCRS,frameCRS,
+ m_GridLineMemoryThreshold,m_GridTickMemoryThreshold);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemMgrs::FrameBoundaryToZones")
+ }
return zoneCollection.Detach ();
}
#endif //WANT_GEOS
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMgrsZone.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMgrsZone.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMgrsZone.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -71,9 +71,8 @@
{
Ptr<CCoordinateSystemGridRegionCollection> regionCollection;
- MG_TRY ()
- regionCollection = BuildRegionCollection (frameBoundary,specification);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemMgrsZone::GetGridRegions")
+ regionCollection = BuildRegionCollection (frameBoundary,specification);
+
return SAFE_ADDREF(regionCollection.p);
}
CCoordinateSystemGridLineCollection* CCoordinateSystemMgrsZone::GetGridLines (MgCoordinateSystemGridBoundary* frameBoundary,
@@ -115,46 +114,64 @@
Ptr<CCoordinateSystemGridLineCollection> gridLineCollection = new CCoordinateSystemGridLineCollection (m_GridLineMemoryThreshold);
- MG_TRY ()
- fromPoint = new MgCoordinateXY ();
- toPoint = new MgCoordinateXY ();
- CCoordinateSystemGridSpecification* mySpecPtr = dynamic_cast<CCoordinateSystemGridSpecification*>(specification);
- precision = mySpecPtr->GetCurvePrecision (m_GridCRS);
+ fromPoint = new MgCoordinateXY ();
+ toPoint = new MgCoordinateXY ();
+ CCoordinateSystemGridSpecification* mySpecPtr = dynamic_cast<CCoordinateSystemGridSpecification*>(specification);
+ precision = mySpecPtr->GetCurvePrecision (m_GridCRS);
- // To be are successful, we'll need a Transform which will convert
- // 'LL' to the frame coordinate system.
- llCRS = csFactory.CreateFromCode (L"LL");
- frameCRS = GetFrameCRS ();
- toFrameTransform = csFactory.GetTransform(llCRS,frameCRS);
+ // To be are successful, we'll need a Transform which will convert
+ // 'LL' to the frame coordinate system.
+ llCRS = csFactory.CreateFromCode (L"LL");
+ frameCRS = GetFrameCRS ();
+ toFrameTransform = csFactory.GetTransform(llCRS,frameCRS);
- // Major regions are solely a function of the extents of the grid in
- // terms of geographic coordinates. So, we extract the extents of this
- // grid in geographic coordinate form, and work from there.
- GetGeographicExtents (lngMin,lngMax,latMin,latMax);
+ // Major regions are solely a function of the extents of the grid in
+ // terms of geographic coordinates. So, we extract the extents of this
+ // grid in geographic coordinate form, and work from there.
+ GetGeographicExtents (lngMin,lngMax,latMin,latMax);
- // MajorRegions do not do their own memory checks. They do all their allocation
- // in their ctor and it is estimated that the largest potential collection is about
- // 40Mb. The first following call to lineCollection->Add() will check, so it would
- // be redundant to add an additional check here.
- regionCollection = new CCoordinateSystemMgrsMajorRegionCollection (m_UtmZone,latMin,latMax);
- if (regionCollection != 0)
+ // MajorRegions do not do their own memory checks. They do all their allocation
+ // in their ctor and it is estimated that the largest potential collection is about
+ // 40Mb. The first following call to lineCollection->Add() will check, so it would
+ // be redundant to add an additional check here.
+ regionCollection = new CCoordinateSystemMgrsMajorRegionCollection (m_UtmZone,latMin,latMax);
+ if (regionCollection != 0)
+ {
+ // Draw the east/west lines, i.e. the lines of constant latitude.
+ regionCount = regionCollection->GetCount ();
+ for (index = 0;index < regionCount;index += 1)
{
- // Draw the east/west lines, i.e. the lines of constant latitude.
- regionCount = regionCollection->GetCount ();
- for (index = 0;index < regionCount;index += 1)
+ // We have a region.
+ regionPtr = regionCollection->GetItem (index);
+ value = regionPtr->GetSouthEdgeLat ();
+ fromPoint->SetX (regionPtr->GetWestEdgeLng ());
+ fromPoint->SetY (value);
+ toPoint->SetX (regionPtr->GetEastEdgeLng ());
+ toPoint->SetY (value);
+ lineString = toFrameTransform->GridLine (fromPoint,toPoint,precision,m_MaxCurvePoints);
+
+ // Clip the line to the frame boundary. The grid line may
+ // actually leave, and then re-enter, the grid boundary, so the
+ // result can be a multi-line string.
+ lineStringCollection = frameBoundary->ClipLineString (lineString);
+ if (lineStringCollection)
{
- // We have a region.
- regionPtr = regionCollection->GetItem (index);
- value = regionPtr->GetSouthEdgeLat ();
+ // Construct the Grid Line object and add it to the grid
+ // line collection object.
+ gridLine = new CCoordinateSystemGridLine (MgCoordinateSystemGridOrientation::NorthSouth,value);
+ gridLine->SetSegmentCollection (lineStringCollection);
+ gridLineCollection->Add (gridLine);
+ }
+ if (index == (regionCount - 1))
+ {
+ value = regionPtr->GetNorthEdgeLat ();
fromPoint->SetX (regionPtr->GetWestEdgeLng ());
fromPoint->SetY (value);
toPoint->SetX (regionPtr->GetEastEdgeLng ());
toPoint->SetY (value);
lineString = toFrameTransform->GridLine (fromPoint,toPoint,precision,m_MaxCurvePoints);
- // Clip the line to the frame boundary. The grid line may
- // actually leave, and then re-enter, the grid boundary, so the
- // result can be a multi-line string.
+ // Clip the line to the frame boundary.
lineStringCollection = frameBoundary->ClipLineString (lineString);
if (lineStringCollection)
{
@@ -164,82 +181,62 @@
gridLine->SetSegmentCollection (lineStringCollection);
gridLineCollection->Add (gridLine);
}
- if (index == (regionCount - 1))
- {
- value = regionPtr->GetNorthEdgeLat ();
- fromPoint->SetX (regionPtr->GetWestEdgeLng ());
- fromPoint->SetY (value);
- toPoint->SetX (regionPtr->GetEastEdgeLng ());
- toPoint->SetY (value);
- lineString = toFrameTransform->GridLine (fromPoint,toPoint,precision,m_MaxCurvePoints);
-
- // Clip the line to the frame boundary.
- lineStringCollection = frameBoundary->ClipLineString (lineString);
- if (lineStringCollection)
- {
- // Construct the Grid Line object and add it to the grid
- // line collection object.
- gridLine = new CCoordinateSystemGridLine (MgCoordinateSystemGridOrientation::NorthSouth,value);
- gridLine->SetSegmentCollection (lineStringCollection);
- gridLineCollection->Add (gridLine);
- }
- }
}
+ }
- // Draw the western north/south lines, i.e. the lines of constant
- // longitude.
- regionCount = regionCollection->GetCount ();
- for (index = 0;index < regionCount;index += 1)
- {
- // We have a region.
- regionPtr = regionCollection->GetItem (index);
- value = regionPtr->GetWestEdgeLng ();
- fromPoint->SetX (value);
- fromPoint->SetY (regionPtr->GetSouthEdgeLat ());
- toPoint->SetX (value);
- toPoint->SetY (regionPtr->GetNorthEdgeLat ());
- lineString = toFrameTransform->GridLine (fromPoint,toPoint,precision,m_MaxCurvePoints);
+ // Draw the western north/south lines, i.e. the lines of constant
+ // longitude.
+ regionCount = regionCollection->GetCount ();
+ for (index = 0;index < regionCount;index += 1)
+ {
+ // We have a region.
+ regionPtr = regionCollection->GetItem (index);
+ value = regionPtr->GetWestEdgeLng ();
+ fromPoint->SetX (value);
+ fromPoint->SetY (regionPtr->GetSouthEdgeLat ());
+ toPoint->SetX (value);
+ toPoint->SetY (regionPtr->GetNorthEdgeLat ());
+ lineString = toFrameTransform->GridLine (fromPoint,toPoint,precision,m_MaxCurvePoints);
- // Clip the line to the frame boundary.
- lineStringCollection = frameBoundary->ClipLineString (lineString);
- if (lineStringCollection)
- {
- // Construct the Grid Line object and add it to the grid
- // line collection object.
- gridLine = new CCoordinateSystemGridLine (MgCoordinateSystemGridOrientation::EastWest,value);
- gridLine->SetSegmentCollection (lineStringCollection);
- gridLineCollection->Add (gridLine);
- }
+ // Clip the line to the frame boundary.
+ lineStringCollection = frameBoundary->ClipLineString (lineString);
+ if (lineStringCollection)
+ {
+ // Construct the Grid Line object and add it to the grid
+ // line collection object.
+ gridLine = new CCoordinateSystemGridLine (MgCoordinateSystemGridOrientation::EastWest,value);
+ gridLine->SetSegmentCollection (lineStringCollection);
+ gridLineCollection->Add (gridLine);
}
+ }
- // Draw the north/south lines, i.e. the lines of constant longitude.
- regionCount = regionCollection->GetCount ();
- for (index = 0;index < regionCount;index += 1)
- {
- // We have a region.
- regionPtr = regionCollection->GetItem (index);
- value = regionPtr->GetEastEdgeLng ();
- fromPoint->SetX (value);
- fromPoint->SetY (regionPtr->GetSouthEdgeLat ());
- toPoint->SetX (value);
- toPoint->SetY (regionPtr->GetNorthEdgeLat ());
- lineString = toFrameTransform->GridLine (fromPoint,toPoint,precision,m_MaxCurvePoints);
+ // Draw the north/south lines, i.e. the lines of constant longitude.
+ regionCount = regionCollection->GetCount ();
+ for (index = 0;index < regionCount;index += 1)
+ {
+ // We have a region.
+ regionPtr = regionCollection->GetItem (index);
+ value = regionPtr->GetEastEdgeLng ();
+ fromPoint->SetX (value);
+ fromPoint->SetY (regionPtr->GetSouthEdgeLat ());
+ toPoint->SetX (value);
+ toPoint->SetY (regionPtr->GetNorthEdgeLat ());
+ lineString = toFrameTransform->GridLine (fromPoint,toPoint,precision,m_MaxCurvePoints);
- // Clip the line to the frame boundary. The grid line may
- // actually leave, and then re-enter, the grid boundary, so the
- // result can be a multi-line string.
- lineStringCollection = frameBoundary->ClipLineString (lineString);
- if (lineStringCollection)
- {
- // Construct the Grid Line object and add it to the grid
- // line collection object.
- gridLine = new CCoordinateSystemGridLine (MgCoordinateSystemGridOrientation::EastWest,value);
- gridLine->SetSegmentCollection (lineStringCollection);
- gridLineCollection->Add (gridLine);
- }
+ // Clip the line to the frame boundary. The grid line may
+ // actually leave, and then re-enter, the grid boundary, so the
+ // result can be a multi-line string.
+ lineStringCollection = frameBoundary->ClipLineString (lineString);
+ if (lineStringCollection)
+ {
+ // Construct the Grid Line object and add it to the grid
+ // line collection object.
+ gridLine = new CCoordinateSystemGridLine (MgCoordinateSystemGridOrientation::EastWest,value);
+ gridLine->SetSegmentCollection (lineStringCollection);
+ gridLineCollection->Add (gridLine);
}
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemMgrsZone::GetGraticuleLines")
+ }
return gridLineCollection.Detach ();
}
INT32 CCoordinateSystemMgrsZone::ApproxGridRegionMemoryUsage (MgCoordinateSystemGridSpecification* specification)
@@ -272,83 +269,81 @@
}
maxRegions = 0x7FFF0000 / regionSize;
- MG_TRY ()
- if (specification->GetUnitType () == MgCoordinateSystemUnitType::Angular)
+ if (specification->GetUnitType () == MgCoordinateSystemUnitType::Angular)
+ {
+ double eastingIncrement = specification->GetEastingIncrement (MgCoordinateSystemUnitCode::Degree);
+ double northingIncrement = specification->GetNorthingIncrement (MgCoordinateSystemUnitCode::Degree);
+ if (MgMathUtility::DblCmp (eastingIncrement,6.0) &&
+ MgMathUtility::DblCmp (northingIncrement,8.0))
{
- double eastingIncrement = specification->GetEastingIncrement (MgCoordinateSystemUnitCode::Degree);
- double northingIncrement = specification->GetNorthingIncrement (MgCoordinateSystemUnitCode::Degree);
- if (MgMathUtility::DblCmp (eastingIncrement,6.0) &&
- MgMathUtility::DblCmp (northingIncrement,8.0))
- {
- double lngMin,lngMax;
- double latMin,latMax;
- Ptr<CCoordinateSystemMgrsMajorRegionCollection> mjrRegionCollection;
+ double lngMin,lngMax;
+ double latMin,latMax;
+ Ptr<CCoordinateSystemMgrsMajorRegionCollection> mjrRegionCollection;
- // Determine the number of regions included in the boundary.
- GetGeographicExtents (lngMin,lngMax,latMin,latMax);
- mjrRegionCollection = new CCoordinateSystemMgrsMajorRegionCollection (m_UtmZone,latMin,latMax);
- regionCount = mjrRegionCollection->GetCount ();
+ // Determine the number of regions included in the boundary.
+ GetGeographicExtents (lngMin,lngMax,latMin,latMax);
+ mjrRegionCollection = new CCoordinateSystemMgrsMajorRegionCollection (m_UtmZone,latMin,latMax);
+ regionCount = mjrRegionCollection->GetCount ();
- // Make a guess at the amount of memory required.
- if (regionCount < maxRegions)
- {
- memoryGuess = regionSize * regionCount;
- }
- else
- {
- // Who knows what MAXINT will be in various environments. We know
- // that memoryGuess is an INT32, so we use our own hard coded value.
- memoryGuess = 0x7FFFFFFF;
- }
+ // Make a guess at the amount of memory required.
+ if (regionCount < maxRegions)
+ {
+ memoryGuess = regionSize * regionCount;
}
+ else
+ {
+ // Who knows what MAXINT will be in various environments. We know
+ // that memoryGuess is an INT32, so we use our own hard coded value.
+ memoryGuess = 0x7FFFFFFF;
+ }
}
- else if (specification->GetUnitType () == MgCoordinateSystemUnitType::Linear)
+ }
+ else if (specification->GetUnitType () == MgCoordinateSystemUnitType::Linear)
+ {
+ double eastingIncrement = specification->GetEastingIncrement (MgCoordinateSystemUnitCode::Meter);
+ double northingIncrement = specification->GetNorthingIncrement (MgCoordinateSystemUnitCode::Meter);
+ if (MgMathUtility::DblCmp (eastingIncrement,100000.0) &&
+ MgMathUtility::DblCmp (northingIncrement,100000.0))
{
- double eastingIncrement = specification->GetEastingIncrement (MgCoordinateSystemUnitCode::Meter);
- double northingIncrement = specification->GetNorthingIncrement (MgCoordinateSystemUnitCode::Meter);
- if (MgMathUtility::DblCmp (eastingIncrement,100000.0) &&
- MgMathUtility::DblCmp (northingIncrement,100000.0))
- {
- INT32 beginEast, endEast;
- INT32 beginNorth, endNorth;
+ INT32 beginEast, endEast;
+ INT32 beginNorth, endNorth;
- double delta;
- double curvePrecision;
- double eastMin, eastMax;
- double northMin, northMax;
+ double delta;
+ double curvePrecision;
+ double eastMin, eastMax;
+ double northMin, northMax;
- curvePrecision = 1.0;
- // Estimate the number of minor regions.
- GetGridExtents (eastMin,eastMax,northMin,northMax,curvePrecision);
+ curvePrecision = 1.0;
+ // Estimate the number of minor regions.
+ GetGridExtents (eastMin,eastMax,northMin,northMax,curvePrecision);
- delta = fabs (fmod (eastMin,100000.0));
- beginEast = static_cast<INT32>(eastMin - ((eastMin >= 0.0) ? delta : (100000.0 - delta)));
- delta = fabs (fmod (eastMax,100000.0));
- endEast = static_cast<INT32>(eastMax + ((eastMax >= 0.0) ? (100000.0 - delta) : -delta));
+ delta = fabs (fmod (eastMin,100000.0));
+ beginEast = static_cast<INT32>(eastMin - ((eastMin >= 0.0) ? delta : (100000.0 - delta)));
+ delta = fabs (fmod (eastMax,100000.0));
+ endEast = static_cast<INT32>(eastMax + ((eastMax >= 0.0) ? (100000.0 - delta) : -delta));
- delta = fabs (fmod (northMin,100000.0));
- beginNorth = static_cast<INT32>(northMin - ((northMin >= 0.0) ? delta : (100000.0 - delta)));
- delta = fabs (fmod (northMax,100000.0));
- endNorth = static_cast<INT32>(northMax + ((northMax >= 0.0) ? (100000.0 - delta) : -delta));
+ delta = fabs (fmod (northMin,100000.0));
+ beginNorth = static_cast<INT32>(northMin - ((northMin >= 0.0) ? delta : (100000.0 - delta)));
+ delta = fabs (fmod (northMax,100000.0));
+ endNorth = static_cast<INT32>(northMax + ((northMax >= 0.0) ? (100000.0 - delta) : -delta));
- INT32 verticalCount = (endNorth - beginNorth) / 100000;
- INT32 horizontalCount = (endEast - beginEast) / 100000;
- regionCount = horizontalCount * verticalCount;
+ INT32 verticalCount = (endNorth - beginNorth) / 100000;
+ INT32 horizontalCount = (endEast - beginEast) / 100000;
+ regionCount = horizontalCount * verticalCount;
- // Make a guess at the amount of memory required.
- if (regionCount < maxRegions)
- {
- memoryGuess = regionSize * regionCount;
- }
- else
- {
- // Who knows what MAXINT will be in various environments. We know
- // that memoryGuess is an INT32, so we use our own hard coded value.
- memoryGuess = 0x7FFFFFFF;
- }
+ // Make a guess at the amount of memory required.
+ if (regionCount < maxRegions)
+ {
+ memoryGuess = regionSize * regionCount;
}
+ else
+ {
+ // Who knows what MAXINT will be in various environments. We know
+ // that memoryGuess is an INT32, so we use our own hard coded value.
+ memoryGuess = 0x7FFFFFFF;
+ }
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemMgrsZone::ApproxGridRegionMemoryUsage")
+ }
return memoryGuess;
}
@@ -371,30 +366,28 @@
double northingIncrement;
Ptr<CCoordinateSystemGridRegionCollection> regionCollection;
- MG_TRY ()
- regionCollection = new CCoordinateSystemGridRegionCollection (m_GridRegionMemoryThreshold);
- curvePrecision = specification->GetCurvePrecision ();
- if (specification->GetUnitType () == MgCoordinateSystemUnitType::Angular)
+ regionCollection = new CCoordinateSystemGridRegionCollection (m_GridRegionMemoryThreshold);
+ curvePrecision = specification->GetCurvePrecision ();
+ if (specification->GetUnitType () == MgCoordinateSystemUnitType::Angular)
+ {
+ eastingIncrement = specification->GetEastingIncrement (MgCoordinateSystemUnitCode::Degree);
+ northingIncrement = specification->GetNorthingIncrement (MgCoordinateSystemUnitCode::Degree);
+ if (MgMathUtility::DblCmp (eastingIncrement,6.0) &&
+ MgMathUtility::DblCmp (northingIncrement,8.0))
{
- eastingIncrement = specification->GetEastingIncrement (MgCoordinateSystemUnitCode::Degree);
- northingIncrement = specification->GetNorthingIncrement (MgCoordinateSystemUnitCode::Degree);
- if (MgMathUtility::DblCmp (eastingIncrement,6.0) &&
- MgMathUtility::DblCmp (northingIncrement,8.0))
- {
- BuildMajorRegions (regionCollection,frameBoundary,curvePrecision);
- }
+ BuildMajorRegions (regionCollection,frameBoundary,curvePrecision);
}
- else if (specification->GetUnitType () == MgCoordinateSystemUnitType::Linear)
+ }
+ else if (specification->GetUnitType () == MgCoordinateSystemUnitType::Linear)
+ {
+ eastingIncrement = specification->GetEastingIncrement (MgCoordinateSystemUnitCode::Meter);
+ northingIncrement = specification->GetNorthingIncrement (MgCoordinateSystemUnitCode::Meter);
+ if (MgMathUtility::DblCmp (eastingIncrement,100000.0) &&
+ MgMathUtility::DblCmp (northingIncrement,100000.0))
{
- eastingIncrement = specification->GetEastingIncrement (MgCoordinateSystemUnitCode::Meter);
- northingIncrement = specification->GetNorthingIncrement (MgCoordinateSystemUnitCode::Meter);
- if (MgMathUtility::DblCmp (eastingIncrement,100000.0) &&
- MgMathUtility::DblCmp (northingIncrement,100000.0))
- {
- BuildMinorRegions (regionCollection,frameBoundary,curvePrecision);
- }
+ BuildMinorRegions (regionCollection,frameBoundary,curvePrecision);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemMgrsZone::GetGraticuleLines")
+ }
return regionCollection.Detach ();
}
void CCoordinateSystemMgrsZone::BuildMajorRegions (CCoordinateSystemGridRegionCollection* regionCollection,
@@ -420,52 +413,50 @@
MgCoordinateSystemFactory csFactory;
- MG_TRY ()
- southwest = new MgCoordinateXY ();
- northeast = new MgCoordinateXY ();
+ southwest = new MgCoordinateXY ();
+ northeast = new MgCoordinateXY ();
- // To be are successful, we'll need a Transform which will convert
- // 'LL' to the frame coordinate system.
- llCRS = csFactory.CreateFromCode (L"LL");
- frameCRS = GetFrameCRS ();
- toFrameTransform = csFactory.GetTransform(llCRS,frameCRS);
+ // To be are successful, we'll need a Transform which will convert
+ // 'LL' to the frame coordinate system.
+ llCRS = csFactory.CreateFromCode (L"LL");
+ frameCRS = GetFrameCRS ();
+ toFrameTransform = csFactory.GetTransform(llCRS,frameCRS);
- // Major regions are solely a function of the extents of the grid in
- // terms of geographic coordinates. So, we extract the extents of this
- // grid in geographic coordinate form, and work from there.
- GetGeographicExtents (lngMin,lngMax,latMin,latMax);
+ // Major regions are solely a function of the extents of the grid in
+ // terms of geographic coordinates. So, we extract the extents of this
+ // grid in geographic coordinate form, and work from there.
+ GetGeographicExtents (lngMin,lngMax,latMin,latMax);
- mjrRegionCollection = new CCoordinateSystemMgrsMajorRegionCollection (m_UtmZone,latMin,latMax);
- if (mjrRegionCollection != 0)
+ mjrRegionCollection = new CCoordinateSystemMgrsMajorRegionCollection (m_UtmZone,latMin,latMax);
+ if (mjrRegionCollection != 0)
+ {
+ INT32 mjrRegionCount = mjrRegionCollection->GetCount ();
+ for (index = 0;index < mjrRegionCount;index += 1)
{
- INT32 mjrRegionCount = mjrRegionCollection->GetCount ();
- for (index = 0;index < mjrRegionCount;index += 1)
- {
- // We have a region.
- regionPtr = mjrRegionCollection->GetItem (index);
- southwest->SetX (regionPtr->GetWestEdgeLng ());
- southwest->SetY (regionPtr->GetSouthEdgeLat ());
- northeast->SetX (regionPtr->GetEastEdgeLng ());
- northeast->SetY (regionPtr->GetNorthEdgeLat ());
- designation = regionPtr->GetDesignation ();
- pMjrRegion = new CCoordinateSystemGridRegion (designation,frameBoundary,
- toFrameTransform,
- southwest,
- northeast,
- curvePrecision,
- maxPoints);
- regionCollection->Add (pMjrRegion);
- }
+ // We have a region.
+ regionPtr = mjrRegionCollection->GetItem (index);
+ southwest->SetX (regionPtr->GetWestEdgeLng ());
+ southwest->SetY (regionPtr->GetSouthEdgeLat ());
+ northeast->SetX (regionPtr->GetEastEdgeLng ());
+ northeast->SetY (regionPtr->GetNorthEdgeLat ());
+ designation = regionPtr->GetDesignation ();
+ pMjrRegion = new CCoordinateSystemGridRegion (designation,frameBoundary,
+ toFrameTransform,
+ southwest,
+ northeast,
+ curvePrecision,
+ maxPoints);
+ regionCollection->Add (pMjrRegion);
}
- else if (m_UtmZone == 61)
- {
- //TODO: need to generate regions for the north polar region.
- }
- else if (m_UtmZone == -61)
- {
- //TODO: need to generate regions for the south polar region.
- }
- MG_CATCH_AND_THROW(L"MgCoordinateSystemOneGrid::BuildMajorRegions")
+ }
+ else if (m_UtmZone == 61)
+ {
+ //TODO: need to generate regions for the north polar region.
+ }
+ else if (m_UtmZone == -61)
+ {
+ //TODO: need to generate regions for the south polar region.
+ }
}
void CCoordinateSystemMgrsZone::BuildMinorRegions (CCoordinateSystemGridRegionCollection* regionCollection,
MgCoordinateSystemGridBoundary* frameBoundary,
@@ -495,113 +486,111 @@
MgCoordinateSystemFactory csFactory;
MgGeometryFactory mgFactory;
- MG_TRY ()
- // This function is in the OneGrid base class. We call it just in case
- // the grid boundary has not been generated for this object yet.
- GetGridExtents (eastMin,eastMax,northMin,northMax,curvePrecision);
+ // This function is in the OneGrid base class. We call it just in case
+ // the grid boundary has not been generated for this object yet.
+ GetGridExtents (eastMin,eastMax,northMin,northMax,curvePrecision);
- // Generation of regions requires conversion of region boundaries to
- // frame coordinates. The OneGrid base class has this transformation
- // available.
- gridToFrameXfrom = GetGridToFrameXform ();
+ // Generation of regions requires conversion of region boundaries to
+ // frame coordinates. The OneGrid base class has this transformation
+ // available.
+ gridToFrameXfrom = GetGridToFrameXform ();
- // Expand the min/max values to the 100K boundaries of the minor regions.
- // A little overkill here as the extent values should never be negative.
- delta = fabs (fmod (eastMin,rK100Km));
- beginEast = static_cast<INT32>(eastMin - ((eastMin >= 0.0) ? delta : (rK100Km - delta)));
- delta = fabs (fmod (eastMax,rK100Km));
- endEast = static_cast<INT32>(eastMax + ((eastMax >= 0.0) ? (rK100Km - delta) : -delta));
+ // Expand the min/max values to the 100K boundaries of the minor regions.
+ // A little overkill here as the extent values should never be negative.
+ delta = fabs (fmod (eastMin,rK100Km));
+ beginEast = static_cast<INT32>(eastMin - ((eastMin >= 0.0) ? delta : (rK100Km - delta)));
+ delta = fabs (fmod (eastMax,rK100Km));
+ endEast = static_cast<INT32>(eastMax + ((eastMax >= 0.0) ? (rK100Km - delta) : -delta));
- delta = fabs (fmod (northMin,rK100Km));
- beginNorth = static_cast<INT32>(northMin - ((northMin >= 0.0) ? delta : (rK100Km - delta)));
- delta = fabs (fmod (northMax,rK100Km));
- endNorth = static_cast<INT32>(northMax + ((northMax >= 0.0) ? (rK100Km - delta) : -delta));
+ delta = fabs (fmod (northMin,rK100Km));
+ beginNorth = static_cast<INT32>(northMin - ((northMin >= 0.0) ? delta : (rK100Km - delta)));
+ delta = fabs (fmod (northMax,rK100Km));
+ endNorth = static_cast<INT32>(northMax + ((northMax >= 0.0) ? (rK100Km - delta) : -delta));
- // We'll move from south to north, doing each west to east row in turn.
- for (northIndex = beginNorth;northIndex < endNorth;northIndex += iK100Km)
+ // We'll move from south to north, doing each west to east row in turn.
+ for (northIndex = beginNorth;northIndex < endNorth;northIndex += iK100Km)
+ {
+ for (eastIndex = beginEast;eastIndex < endEast;eastIndex += iK100Km)
{
- for (eastIndex = beginEast;eastIndex < endEast;eastIndex += iK100Km)
- {
- Ptr<MgCoordinate> southwest;
- Ptr<MgCoordinate> southeast;
- Ptr<MgCoordinate> northeast;
- Ptr<MgCoordinate> northwest;
+ Ptr<MgCoordinate> southwest;
+ Ptr<MgCoordinate> southeast;
+ Ptr<MgCoordinate> northeast;
+ Ptr<MgCoordinate> northwest;
- // Use the current eastIndex and northIndex values to generate
- // a 100KM sqaure.
- southwest = mgFactory.CreateCoordinateXY (static_cast<double>(eastIndex),static_cast<double>(northIndex));
- southeast = mgFactory.CreateCoordinateXY (static_cast<double>(eastIndex + iK100Km),static_cast<double>(northIndex));
- northeast = mgFactory.CreateCoordinateXY (static_cast<double>(eastIndex + iK100Km),static_cast<double>(northIndex + iK100Km));
- northwest = mgFactory.CreateCoordinateXY (static_cast<double>(eastIndex),static_cast<double>(northIndex + iK100Km));
+ // Use the current eastIndex and northIndex values to generate
+ // a 100KM sqaure.
+ southwest = mgFactory.CreateCoordinateXY (static_cast<double>(eastIndex),static_cast<double>(northIndex));
+ southeast = mgFactory.CreateCoordinateXY (static_cast<double>(eastIndex + iK100Km),static_cast<double>(northIndex));
+ northeast = mgFactory.CreateCoordinateXY (static_cast<double>(eastIndex + iK100Km),static_cast<double>(northIndex + iK100Km));
+ northwest = mgFactory.CreateCoordinateXY (static_cast<double>(eastIndex),static_cast<double>(northIndex + iK100Km));
- // Now we need the designation. The comes from the MgCoordinateSystemMgrs
- // object that knows about the lettering scheme. Unfortunately, we don't
- // have a reference to the host Mgrs object, so we're going to have to know
- // about the lettering scheme.
- STRING designation = CCoordinateSystemMgrs::GridSquareDesignation (m_UtmZone,static_cast<double>(eastIndex + 1),
- static_cast<double>(northIndex + 1),
- m_LetteringScheme);
- if (!designation.empty ())
- {
- // Construct the region object and add it to the region collection.
- pMnrRegion = new CCoordinateSystemGridRegion (designation);
+ // Now we need the designation. The comes from the MgCoordinateSystemMgrs
+ // object that knows about the lettering scheme. Unfortunately, we don't
+ // have a reference to the host Mgrs object, so we're going to have to know
+ // about the lettering scheme.
+ STRING designation = CCoordinateSystemMgrs::GridSquareDesignation (m_UtmZone,static_cast<double>(eastIndex + 1),
+ static_cast<double>(northIndex + 1),
+ m_LetteringScheme);
+ if (!designation.empty ())
+ {
+ // Construct the region object and add it to the region collection.
+ pMnrRegion = new CCoordinateSystemGridRegion (designation);
- double xx = static_cast<double>(eastIndex + (iK100Km / 2));
- double yy = static_cast<double>(northIndex + (iK100Km / 2));
- gridToFrameXfrom->Transform (&xx,&yy);
- Ptr<MgCoordinate> rgnCenter = mgFactory.CreateCoordinateXY (xx,yy);
- pMnrRegion->SetRegionCenter (rgnCenter);
+ double xx = static_cast<double>(eastIndex + (iK100Km / 2));
+ double yy = static_cast<double>(northIndex + (iK100Km / 2));
+ gridToFrameXfrom->Transform (&xx,&yy);
+ Ptr<MgCoordinate> rgnCenter = mgFactory.CreateCoordinateXY (xx,yy);
+ pMnrRegion->SetRegionCenter (rgnCenter);
- // Generate the region boundary polygon; then convert to frame coordinates.
- rgnBoundary = csFactory.GridBoundary (southwest,northeast);
- rgnBoundary->SetMaxCurvePoints (maxPoints);
- Ptr<MgPolygon> rgnPolygon = rgnBoundary->GetBoundary (gridToFrameXfrom,curvePrecision);
- pMnrRegion->SetRegionBoundary (rgnPolygon);
+ // Generate the region boundary polygon; then convert to frame coordinates.
+ rgnBoundary = csFactory.GridBoundary (southwest,northeast);
+ rgnBoundary->SetMaxCurvePoints (maxPoints);
+ Ptr<MgPolygon> rgnPolygon = rgnBoundary->GetBoundary (gridToFrameXfrom,curvePrecision);
+ pMnrRegion->SetRegionBoundary (rgnPolygon);
- // Get a coordinate iterator which represents the grid boundary.
- // Note, that this boundary is the Intersection of the UTM zone
- // boundary and the viewport frame boundary.
- Ptr<MgCoordinateSystemGridBoundary> gridBoundary = GetGridBoundary ();
- Ptr<MgPolygon> gridPolygon = gridBoundary->GetBoundary ();
- Ptr<MgLinearRing> gridExteriorRing = gridPolygon->GetExteriorRing ();
- Ptr<MgCoordinateIterator> gridBoundaryItr = gridExteriorRing->GetCoordinates ();
+ // Get a coordinate iterator which represents the grid boundary.
+ // Note, that this boundary is the Intersection of the UTM zone
+ // boundary and the viewport frame boundary.
+ Ptr<MgCoordinateSystemGridBoundary> gridBoundary = GetGridBoundary ();
+ Ptr<MgPolygon> gridPolygon = gridBoundary->GetBoundary ();
+ Ptr<MgLinearRing> gridExteriorRing = gridPolygon->GetExteriorRing ();
+ Ptr<MgCoordinateIterator> gridBoundaryItr = gridExteriorRing->GetCoordinates ();
- // Generate the four lines.
- swPntIsIn = MgSpatialUtility::PointIsInPolygon (gridBoundaryItr,southwest);
- sePntIsIn = MgSpatialUtility::PointIsInPolygon (gridBoundaryItr,southeast);
- nePntIsIn = MgSpatialUtility::PointIsInPolygon (gridBoundaryItr,northeast);
- nwPntIsIn = MgSpatialUtility::PointIsInPolygon (gridBoundaryItr,northwest);
+ // Generate the four lines.
+ swPntIsIn = MgSpatialUtility::PointIsInPolygon (gridBoundaryItr,southwest);
+ sePntIsIn = MgSpatialUtility::PointIsInPolygon (gridBoundaryItr,southeast);
+ nePntIsIn = MgSpatialUtility::PointIsInPolygon (gridBoundaryItr,northeast);
+ nwPntIsIn = MgSpatialUtility::PointIsInPolygon (gridBoundaryItr,northwest);
- if (swPntIsIn || sePntIsIn)
- {
- Ptr<MgLineString> lineString = gridToFrameXfrom->GridLine (southwest,southeast,curvePrecision,maxPoints);
- Ptr<MgLineStringCollection> rgnLine = frameBoundary->ClipLineString (lineString);
- pMnrRegion->SetSouthLine (rgnLine);
- }
- if (sePntIsIn || nePntIsIn)
- {
- Ptr<MgLineString> lineString = gridToFrameXfrom->GridLine (southeast,northeast,curvePrecision,maxPoints);
- Ptr<MgLineStringCollection> rgnLine = frameBoundary->ClipLineString (lineString);
- pMnrRegion->SetEastLine (rgnLine);
- }
- if (nePntIsIn || nwPntIsIn)
- {
- Ptr<MgLineString> lineString = gridToFrameXfrom->GridLine (northeast,northwest,curvePrecision,maxPoints);
- Ptr<MgLineStringCollection> rgnLine = frameBoundary->ClipLineString (lineString);
- pMnrRegion->SetNorthLine (rgnLine);
- }
- if (nwPntIsIn || swPntIsIn)
- {
- Ptr<MgLineString> lineString = gridToFrameXfrom->GridLine (northwest,southwest,curvePrecision,maxPoints);
- Ptr<MgLineStringCollection> rgnLine = frameBoundary->ClipLineString (lineString);
- pMnrRegion->SetWestLine (rgnLine);
- }
-
- regionCollection->Add (pMnrRegion);
+ if (swPntIsIn || sePntIsIn)
+ {
+ Ptr<MgLineString> lineString = gridToFrameXfrom->GridLine (southwest,southeast,curvePrecision,maxPoints);
+ Ptr<MgLineStringCollection> rgnLine = frameBoundary->ClipLineString (lineString);
+ pMnrRegion->SetSouthLine (rgnLine);
}
+ if (sePntIsIn || nePntIsIn)
+ {
+ Ptr<MgLineString> lineString = gridToFrameXfrom->GridLine (southeast,northeast,curvePrecision,maxPoints);
+ Ptr<MgLineStringCollection> rgnLine = frameBoundary->ClipLineString (lineString);
+ pMnrRegion->SetEastLine (rgnLine);
+ }
+ if (nePntIsIn || nwPntIsIn)
+ {
+ Ptr<MgLineString> lineString = gridToFrameXfrom->GridLine (northeast,northwest,curvePrecision,maxPoints);
+ Ptr<MgLineStringCollection> rgnLine = frameBoundary->ClipLineString (lineString);
+ pMnrRegion->SetNorthLine (rgnLine);
+ }
+ if (nwPntIsIn || swPntIsIn)
+ {
+ Ptr<MgLineString> lineString = gridToFrameXfrom->GridLine (northwest,southwest,curvePrecision,maxPoints);
+ Ptr<MgLineStringCollection> rgnLine = frameBoundary->ClipLineString (lineString);
+ pMnrRegion->SetWestLine (rgnLine);
+ }
+
+ regionCollection->Add (pMnrRegion);
}
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemOneGrid::BuildMinorRegions")
+ }
}
///////////////////////////////////////////////////////////////////////////////
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysOneGrid.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysOneGrid.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysOneGrid.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -170,112 +170,110 @@
Ptr<CCoordinateSystemGridLineCollection> gridLineCollection = new CCoordinateSystemGridLineCollection (m_GridLineMemoryThreshold);
- MG_TRY()
- gridCrsUnitCode = m_GridCRS->GetUnitCode ();
+ gridCrsUnitCode = m_GridCRS->GetUnitCode ();
- CCoordinateSystemGridSpecification* mySpecPtr = dynamic_cast<CCoordinateSystemGridSpecification*>(specs);
- coordinate = new MgCoordinateXY ();
- fromPnt = new MgCoordinateXY ();
- toPnt = new MgCoordinateXY ();
+ CCoordinateSystemGridSpecification* mySpecPtr = dynamic_cast<CCoordinateSystemGridSpecification*>(specs);
+ coordinate = new MgCoordinateXY ();
+ fromPnt = new MgCoordinateXY ();
+ toPnt = new MgCoordinateXY ();
- // If the boundary has not been converted yet, or if the precision
- // value has been changed, reproduce the m_GridBoundary
- // member from the m_FrameBoundary member. At this point, we
- // need the curve precision value in Grid system units.
- precision = mySpecPtr->GetCurvePrecision (m_GridCRS);
- GenerateGridBoundary (precision);
+ // If the boundary has not been converted yet, or if the precision
+ // value has been changed, reproduce the m_GridBoundary
+ // member from the m_FrameBoundary member. At this point, we
+ // need the curve precision value in Grid system units.
+ precision = mySpecPtr->GetCurvePrecision (m_GridCRS);
+ GenerateGridBoundary (precision);
- // Get the extents of the frame boundary, and then convert them to
- // grid coordinates. Doing this here _should_ elimiate the need to
- // arbitrarily expand the grid boundary.
- m_GridBoundary->GetBoundaryExtents (eastMin,eastMax,northMin,northMax);
+ // Get the extents of the frame boundary, and then convert them to
+ // grid coordinates. Doing this here _should_ elimiate the need to
+ // arbitrarily expand the grid boundary.
+ m_GridBoundary->GetBoundaryExtents (eastMin,eastMax,northMin,northMax);
- // Adjust so the the grid limits are exact values with regard to the
- // specified increments. Do this in an expansive way so the the grid
- // limits always get larger, never smaller.
- //
- // Note that we need to have the increments and base values in terms
- // of the grid coordinate system, regardless of the units used to
- // specify them.
- increment = mySpecPtr->GetEastingIncrement(gridCrsUnitCode);
- delta = fabs(fmod (eastMin,increment));
- eastMin -= (eastMin >= 0.0) ? delta : (increment - delta);
- delta = fabs(fmod (eastMax,increment));
- eastMax += (eastMax >= 0.0) ? (increment - delta) : delta;
+ // Adjust so the the grid limits are exact values with regard to the
+ // specified increments. Do this in an expansive way so the the grid
+ // limits always get larger, never smaller.
+ //
+ // Note that we need to have the increments and base values in terms
+ // of the grid coordinate system, regardless of the units used to
+ // specify them.
+ increment = mySpecPtr->GetEastingIncrement(gridCrsUnitCode);
+ delta = fabs(fmod (eastMin,increment));
+ eastMin -= (eastMin >= 0.0) ? delta : (increment - delta);
+ delta = fabs(fmod (eastMax,increment));
+ eastMax += (eastMax >= 0.0) ? (increment - delta) : delta;
- increment = mySpecPtr->GetNorthingIncrement(gridCrsUnitCode);
- delta = fabs(fmod (northMin,increment));
- northMin -= (northMin >= 0.0) ? delta : (increment - delta);
- delta = fabs(fmod (northMax,increment));
- northMax += (northMax >= 0.0) ? (increment - delta) : delta;
+ increment = mySpecPtr->GetNorthingIncrement(gridCrsUnitCode);
+ delta = fabs(fmod (northMin,increment));
+ northMin -= (northMin >= 0.0) ? delta : (increment - delta);
+ delta = fabs(fmod (northMax,increment));
+ northMax += (northMax >= 0.0) ? (increment - delta) : delta;
- // Adjust for the base. Again, we always enlarge, never shrink.
- if (mySpecPtr->GetEastingBase () > 0.0)
- {
- increment = mySpecPtr->GetEastingIncrement (gridCrsUnitCode);
- delta = fmod (mySpecPtr->GetEastingBase(gridCrsUnitCode),increment);
- eastMin += delta - increment;
- eastMax += delta + increment;
- }
- if (mySpecPtr->GetNorthingBase () > 0.0)
- {
- increment = mySpecPtr->GetNorthingIncrement (gridCrsUnitCode);
- delta = fmod (mySpecPtr->GetNorthingBase(gridCrsUnitCode),increment);
- northMin += delta - increment;
- northMax += delta + increment;
- }
-
- // Given the specification, we double loop, generating lines.
- // Forst loop, generatinf west/east lines starting at the southern edge
- // proceeding to the north.
+ // Adjust for the base. Again, we always enlarge, never shrink.
+ if (mySpecPtr->GetEastingBase () > 0.0)
+ {
+ increment = mySpecPtr->GetEastingIncrement (gridCrsUnitCode);
+ delta = fmod (mySpecPtr->GetEastingBase(gridCrsUnitCode),increment);
+ eastMin += delta - increment;
+ eastMax += delta + increment;
+ }
+ if (mySpecPtr->GetNorthingBase () > 0.0)
+ {
increment = mySpecPtr->GetNorthingIncrement (gridCrsUnitCode);
- for (value = northMin;value <= northMax;value += increment)
- {
- fromPnt->SetX (eastMin);
- fromPnt->SetY (value);
- toPnt->SetX (eastMax);
- toPnt->SetY (value);
- lineString = m_ToFrameXform->GridLine (fromPnt,toPnt,precision,m_MaxCurvePoints);
+ delta = fmod (mySpecPtr->GetNorthingBase(gridCrsUnitCode),increment);
+ northMin += delta - increment;
+ northMax += delta + increment;
+ }
- // Clip the line to the frame boundary. The grid line may
- // actually leave, and then re-enter, the grid boundary, so the
- // result can be a multi-line string.
- lineStringCollection = m_FrameBoundary->ClipLineString (lineString);
- if (lineStringCollection)
- {
- // Construct the Grid Line object and add it to the grid
- // line collection object.
- gridLine = new CCoordinateSystemGridLine (MgCoordinateSystemGridOrientation::NorthSouth,value);
- gridLine->SetSegmentCollection (lineStringCollection);
- gridLineCollection->Add (gridLine);
- }
- }
+ // Given the specification, we double loop, generating lines.
+ // Forst loop, generatinf west/east lines starting at the southern edge
+ // proceeding to the north.
+ increment = mySpecPtr->GetNorthingIncrement (gridCrsUnitCode);
+ for (value = northMin;value <= northMax;value += increment)
+ {
+ fromPnt->SetX (eastMin);
+ fromPnt->SetY (value);
+ toPnt->SetX (eastMax);
+ toPnt->SetY (value);
+ lineString = m_ToFrameXform->GridLine (fromPnt,toPnt,precision,m_MaxCurvePoints);
- // Second loop, the south/north lines, starting at the western edged
- // proceeding to the east.
- increment = mySpecPtr->GetEastingIncrement (gridCrsUnitCode);
- for (value = eastMin;value <= eastMax;value += increment)
+ // Clip the line to the frame boundary. The grid line may
+ // actually leave, and then re-enter, the grid boundary, so the
+ // result can be a multi-line string.
+ lineStringCollection = m_FrameBoundary->ClipLineString (lineString);
+ if (lineStringCollection)
{
- fromPnt->SetX (value);
- fromPnt->SetY (northMin);
- toPnt->SetX (value);
- toPnt->SetY (northMax);
- lineString = m_ToFrameXform->GridLine (fromPnt,toPnt,precision,m_MaxCurvePoints);
+ // Construct the Grid Line object and add it to the grid
+ // line collection object.
+ gridLine = new CCoordinateSystemGridLine (MgCoordinateSystemGridOrientation::NorthSouth,value);
+ gridLine->SetSegmentCollection (lineStringCollection);
+ gridLineCollection->Add (gridLine);
+ }
+ }
- // Clip the line to the frame boundary. The grid line may
- // actually leave, and then re-enter, the grid boundary, so the
- // result can be a multi-line string.
- lineStringCollection = m_FrameBoundary->ClipLineString (lineString);
- if (lineStringCollection)
- {
- // Construct the Grid Line object and add it to the grid
- // line collection object.
- gridLine = new CCoordinateSystemGridLine (MgCoordinateSystemGridOrientation::EastWest,value);
- gridLine->SetSegmentCollection (lineStringCollection);
- gridLineCollection->Add (gridLine);
- }
+ // Second loop, the south/north lines, starting at the western edged
+ // proceeding to the east.
+ increment = mySpecPtr->GetEastingIncrement (gridCrsUnitCode);
+ for (value = eastMin;value <= eastMax;value += increment)
+ {
+ fromPnt->SetX (value);
+ fromPnt->SetY (northMin);
+ toPnt->SetX (value);
+ toPnt->SetY (northMax);
+ lineString = m_ToFrameXform->GridLine (fromPnt,toPnt,precision,m_MaxCurvePoints);
+
+ // Clip the line to the frame boundary. The grid line may
+ // actually leave, and then re-enter, the grid boundary, so the
+ // result can be a multi-line string.
+ lineStringCollection = m_FrameBoundary->ClipLineString (lineString);
+ if (lineStringCollection)
+ {
+ // Construct the Grid Line object and add it to the grid
+ // line collection object.
+ gridLine = new CCoordinateSystemGridLine (MgCoordinateSystemGridOrientation::EastWest,value);
+ gridLine->SetSegmentCollection (lineStringCollection);
+ gridLineCollection->Add (gridLine);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemOneGrid::GetGridLines")
+ }
return static_cast<MgCoordinateSystemGridLineCollection*>(gridLineCollection.Detach());
}
@@ -306,125 +304,123 @@
Ptr<CCoordinateSystemGridTickCollection> tickCollection;
MgGeometryFactory mgFactory;
- MG_TRY ()
- gridCrsUnitCode = m_GridCRS->GetUnitCode ();
+ gridCrsUnitCode = m_GridCRS->GetUnitCode ();
- CCoordinateSystemGridSpecification* mySpecPtr = dynamic_cast<CCoordinateSystemGridSpecification*>(specs);
- tickCollection = new CCoordinateSystemGridTickCollection (m_GridTickMemoryThreshold);
+ CCoordinateSystemGridSpecification* mySpecPtr = dynamic_cast<CCoordinateSystemGridSpecification*>(specs);
+ tickCollection = new CCoordinateSystemGridTickCollection (m_GridTickMemoryThreshold);
- // Get the grid extents.
- curvePrecision = mySpecPtr->GetCurvePrecision();
- GetGridExtents (eastMin,eastMax,northMin,northMax,curvePrecision);
+ // Get the grid extents.
+ curvePrecision = mySpecPtr->GetCurvePrecision();
+ GetGridExtents (eastMin,eastMax,northMin,northMax,curvePrecision);
- // Expand the extents to become the lowest and highest tick values
- // for each of the ordinates.
- increment = mySpecPtr->GetTickEastingIncrement(gridCrsUnitCode);
- delta = fabs(fmod (eastMin,increment));
- eastMin -= (eastMin >= 0.0) ? delta : (increment - delta);
- delta = fabs(fmod (eastMax,increment));
- eastMax += (eastMax >= 0.0) ? (increment - delta) : delta;
+ // Expand the extents to become the lowest and highest tick values
+ // for each of the ordinates.
+ increment = mySpecPtr->GetTickEastingIncrement(gridCrsUnitCode);
+ delta = fabs(fmod (eastMin,increment));
+ eastMin -= (eastMin >= 0.0) ? delta : (increment - delta);
+ delta = fabs(fmod (eastMax,increment));
+ eastMax += (eastMax >= 0.0) ? (increment - delta) : delta;
- increment = mySpecPtr->GetTickNorthingIncrement(gridCrsUnitCode);
- delta = fabs(fmod (northMin,increment));
- northMin -= (northMin >= 0.0) ? delta : (increment - delta);
- delta = fabs(fmod (northMax,increment));
- northMax += (northMax >= 0.0) ? (increment - delta) : delta;
+ increment = mySpecPtr->GetTickNorthingIncrement(gridCrsUnitCode);
+ delta = fabs(fmod (northMin,increment));
+ northMin -= (northMin >= 0.0) ? delta : (increment - delta);
+ delta = fabs(fmod (northMax,increment));
+ northMax += (northMax >= 0.0) ? (increment - delta) : delta;
- // Adjust for the base. Again, we always enlarge, never shrink.
- if (mySpecPtr->GetEastingBase () > 0.0)
- {
- increment = mySpecPtr->GetEastingIncrement (gridCrsUnitCode);
- delta = fmod (mySpecPtr->GetEastingBase(gridCrsUnitCode),increment);
- eastMin += delta - increment;
- eastMax += delta + increment;
- }
- if (mySpecPtr->GetNorthingBase () > 0.0)
- {
- increment = mySpecPtr->GetNorthingIncrement (gridCrsUnitCode);
- delta = fmod (mySpecPtr->GetNorthingBase(gridCrsUnitCode),increment);
- northMin += delta - increment;
- northMax += delta + increment;
- }
+ // Adjust for the base. Again, we always enlarge, never shrink.
+ if (mySpecPtr->GetEastingBase () > 0.0)
+ {
+ increment = mySpecPtr->GetEastingIncrement (gridCrsUnitCode);
+ delta = fmod (mySpecPtr->GetEastingBase(gridCrsUnitCode),increment);
+ eastMin += delta - increment;
+ eastMax += delta + increment;
+ }
+ if (mySpecPtr->GetNorthingBase () > 0.0)
+ {
+ increment = mySpecPtr->GetNorthingIncrement (gridCrsUnitCode);
+ delta = fmod (mySpecPtr->GetNorthingBase(gridCrsUnitCode),increment);
+ northMin += delta - increment;
+ northMax += delta + increment;
+ }
- // Extract the exterior ring from the frame boundary.
- pPolygon = m_FrameBoundary->GetBoundary ();
- exteriorRing = pPolygon->GetExteriorRing ();
+ // Extract the exterior ring from the frame boundary.
+ pPolygon = m_FrameBoundary->GetBoundary ();
+ exteriorRing = pPolygon->GetExteriorRing ();
- // Loop once for each line segment in the polyline which defines the
- // the frame boundary.
- ringItr = exteriorRing->GetCoordinates ();
- ringItr->MoveNext ();
+ // Loop once for each line segment in the polyline which defines the
+ // the frame boundary.
+ ringItr = exteriorRing->GetCoordinates ();
+ ringItr->MoveNext ();
+ toPnt = ringItr->GetCurrent ();
+ while (ringItr->MoveNext ())
+ {
+ fromPnt = toPnt;
toPnt = ringItr->GetCurrent ();
- while (ringItr->MoveNext ())
- {
- fromPnt = toPnt;
- toPnt = ringItr->GetCurrent ();
- // Do the easting ticks; that is tickmarks whose value is an
- // easting ordinate value.
- increment = mySpecPtr->GetTickEastingIncrement (gridCrsUnitCode);
- orientation = MgCoordinateSystemGridOrientation::EastWest;
- for (ordinateValue = eastMin;ordinateValue <= eastMax;ordinateValue += increment)
+ // Do the easting ticks; that is tickmarks whose value is an
+ // easting ordinate value.
+ increment = mySpecPtr->GetTickEastingIncrement (gridCrsUnitCode);
+ orientation = MgCoordinateSystemGridOrientation::EastWest;
+ for (ordinateValue = eastMin;ordinateValue <= eastMax;ordinateValue += increment)
+ {
+ Ptr<MgCoordinate> tickPoint = new MgCoordinateXY ();
+ status = m_ToGridXform->PositionOfValue (tickPoint,ordinateValue,
+ orientation,
+ fromPnt,
+ toPnt);
+ if (status == 0)
{
- Ptr<MgCoordinate> tickPoint = new MgCoordinateXY ();
- status = m_ToGridXform->PositionOfValue (tickPoint,ordinateValue,
- orientation,
- fromPnt,
- toPnt);
- if (status == 0)
- {
- // Here if we got a real point. Create a tick object and
- // add it to the collection. We're going to need to capture
- // some information about the boundary line.
- deltaX = toPnt->GetX () - fromPnt->GetX ();
- deltaY = toPnt->GetY () - fromPnt->GetY ();
- segLength = sqrt (deltaX * deltaX + deltaY * deltaY);
- Ptr<MgCoordinate> unitVector = mgFactory.CreateCoordinateXY (deltaX / segLength,deltaY / segLength);
- Ptr<CCoordinateSystemGridTick> tickPtr;
- tickPtr = new CCoordinateSystemGridTick (orientation,ordinateValue);
- tmpDbl = (ordinateValue - specs->GetEastingBase ());
- tmpDbl = fmod (tmpDbl,specs->GetEastingIncrement ());
- isOnGridLine = fabs (tmpDbl) < 1.0E-08;
- tickPtr->SetOnGridLine (isOnGridLine);
- tickPtr->SetDirection (unitVector);
- tickPtr->SetPosition (tickPoint);
- tickCollection->Add (tickPtr);
- }
+ // Here if we got a real point. Create a tick object and
+ // add it to the collection. We're going to need to capture
+ // some information about the boundary line.
+ deltaX = toPnt->GetX () - fromPnt->GetX ();
+ deltaY = toPnt->GetY () - fromPnt->GetY ();
+ segLength = sqrt (deltaX * deltaX + deltaY * deltaY);
+ Ptr<MgCoordinate> unitVector = mgFactory.CreateCoordinateXY (deltaX / segLength,deltaY / segLength);
+ Ptr<CCoordinateSystemGridTick> tickPtr;
+ tickPtr = new CCoordinateSystemGridTick (orientation,ordinateValue);
+ tmpDbl = (ordinateValue - specs->GetEastingBase ());
+ tmpDbl = fmod (tmpDbl,specs->GetEastingIncrement ());
+ isOnGridLine = fabs (tmpDbl) < 1.0E-08;
+ tickPtr->SetOnGridLine (isOnGridLine);
+ tickPtr->SetDirection (unitVector);
+ tickPtr->SetPosition (tickPoint);
+ tickCollection->Add (tickPtr);
}
+ }
- // Do the northing ticks; that is tickmarks whose value is an
- // northing ordinate value.
- increment = mySpecPtr->GetTickNorthingIncrement (gridCrsUnitCode);
- orientation = MgCoordinateSystemGridOrientation::NorthSouth;
- for (ordinateValue = northMin;ordinateValue <= northMax;ordinateValue += increment)
+ // Do the northing ticks; that is tickmarks whose value is an
+ // northing ordinate value.
+ increment = mySpecPtr->GetTickNorthingIncrement (gridCrsUnitCode);
+ orientation = MgCoordinateSystemGridOrientation::NorthSouth;
+ for (ordinateValue = northMin;ordinateValue <= northMax;ordinateValue += increment)
+ {
+ Ptr<MgCoordinate> tickPoint = new MgCoordinateXY ();
+ status = m_ToGridXform->PositionOfValue (tickPoint,ordinateValue,
+ orientation,
+ fromPnt,
+ toPnt);
+ if (status == 0)
{
- Ptr<MgCoordinate> tickPoint = new MgCoordinateXY ();
- status = m_ToGridXform->PositionOfValue (tickPoint,ordinateValue,
- orientation,
- fromPnt,
- toPnt);
- if (status == 0)
- {
- // Here if we got a real point. Create a tick object and
- // add it to the collection. We're going to need to capture
- // some information about the boundary line.
- deltaX = toPnt->GetX () - fromPnt->GetX ();
- deltaY = toPnt->GetY () - fromPnt->GetY ();
- segLength = sqrt (deltaX * deltaX + deltaY * deltaY);
- Ptr<MgCoordinate> unitVector = mgFactory.CreateCoordinateXY (deltaX / segLength,deltaY / segLength);
- Ptr<CCoordinateSystemGridTick> tickPtr;
- tickPtr = new CCoordinateSystemGridTick (orientation,ordinateValue);
- tmpDbl = (ordinateValue - specs->GetNorthingBase ());
- tmpDbl = fmod (tmpDbl,specs->GetNorthingIncrement ());
- isOnGridLine = fabs (tmpDbl) < 1.0E-08;
- tickPtr->SetDirection (unitVector);
- tickPtr->SetPosition (tickPoint);
- tickCollection->Add (tickPtr);
- }
+ // Here if we got a real point. Create a tick object and
+ // add it to the collection. We're going to need to capture
+ // some information about the boundary line.
+ deltaX = toPnt->GetX () - fromPnt->GetX ();
+ deltaY = toPnt->GetY () - fromPnt->GetY ();
+ segLength = sqrt (deltaX * deltaX + deltaY * deltaY);
+ Ptr<MgCoordinate> unitVector = mgFactory.CreateCoordinateXY (deltaX / segLength,deltaY / segLength);
+ Ptr<CCoordinateSystemGridTick> tickPtr;
+ tickPtr = new CCoordinateSystemGridTick (orientation,ordinateValue);
+ tmpDbl = (ordinateValue - specs->GetNorthingBase ());
+ tmpDbl = fmod (tmpDbl,specs->GetNorthingIncrement ());
+ isOnGridLine = fabs (tmpDbl) < 1.0E-08;
+ tickPtr->SetDirection (unitVector);
+ tickPtr->SetPosition (tickPoint);
+ tickCollection->Add (tickPtr);
}
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemOneGrid::GetGridLines")
+ }
return tickCollection.Detach ();
}
@@ -551,20 +547,18 @@
bool generateGridBoundary;
Ptr<MgPolygon> pPolygon;
- MG_TRY ()
- generateGridBoundary = (m_GridBoundary == NULL);
- if (!generateGridBoundary)
- {
- generateGridBoundary = (fabs (boundaryPrecision - m_BoundaryPrecision) > 1.0E-12);
- }
- if (generateGridBoundary)
- {
- m_GridBoundary = new CCoordinateSystemGridBoundary ();
- pPolygon = m_FrameBoundary->GetBoundary(m_ToGridXform.p,boundaryPrecision);
- m_GridBoundary->SetBoundaryExtents (pPolygon);
- m_BoundaryPrecision = boundaryPrecision;
- }
- MG_CATCH_AND_THROW(L"MgCoordinateSystemOneGrid::GenerateGridBoundary")
+ generateGridBoundary = (m_GridBoundary == NULL);
+ if (!generateGridBoundary)
+ {
+ generateGridBoundary = (fabs (boundaryPrecision - m_BoundaryPrecision) > 1.0E-12);
+ }
+ if (generateGridBoundary)
+ {
+ m_GridBoundary = new CCoordinateSystemGridBoundary ();
+ pPolygon = m_FrameBoundary->GetBoundary(m_ToGridXform.p,boundaryPrecision);
+ m_GridBoundary->SetBoundaryExtents (pPolygon);
+ m_BoundaryPrecision = boundaryPrecision;
+ }
}
void CCoordinateSystemOneGrid::GetGeographicExtents (double& longMin,double& longMax,double& latMin,double& latMax,double precision)
{
@@ -574,15 +568,13 @@
Ptr<MgCoordinateSystemTransform> llTransform;
MgCoordinateSystemFactory csFactory;
- MG_TRY ()
- llCRS = csFactory.CreateFromCode (L"LL");
- llTransform = csFactory.GetTransform(m_FrameCRS,llCRS);
- llTransform->IgnoreDatumShiftWarning (true);
- llTransform->IgnoreOutsideDomainWarning (true);
- pPolygon = m_FrameBoundary->GetBoundary (llTransform,precision);
- llBoundary = csFactory.GridBoundary (pPolygon);
- llBoundary->GetBoundaryExtents (longMin,longMax,latMin,latMax);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemOneGrid::GetGeographicExtents")
+ llCRS = csFactory.CreateFromCode (L"LL");
+ llTransform = csFactory.GetTransform(m_FrameCRS,llCRS);
+ llTransform->IgnoreDatumShiftWarning (true);
+ llTransform->IgnoreOutsideDomainWarning (true);
+ pPolygon = m_FrameBoundary->GetBoundary (llTransform,precision);
+ llBoundary = csFactory.GridBoundary (pPolygon);
+ llBoundary->GetBoundaryExtents (longMin,longMax,latMin,latMax);
}
void CCoordinateSystemOneGrid::GetGridExtents (double& eastMin,double& eastMax,double& northMin,double& northMax,double precision)
{
@@ -592,11 +584,9 @@
Ptr<MgCoordinateSystemTransform> llTransform;
MgCoordinateSystemFactory csFactory;
- MG_TRY ()
- // Make sure the grid boundary has been calculated.
- GenerateGridBoundary (precision);
- m_GridBoundary->GetBoundaryExtents (eastMin,eastMax,northMin,northMax);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemOneGrid::GetGridExtents")
+ // Make sure the grid boundary has been calculated.
+ GenerateGridBoundary (precision);
+ m_GridBoundary->GetBoundaryExtents (eastMin,eastMax,northMin,northMax);
}
void CCoordinateSystemOneGrid::Dispose (void)
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysProjectionInformation.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysProjectionInformation.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysProjectionInformation.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -133,14 +133,10 @@
{
Ptr<CCoordinateSystemEnumInteger32> pNewEnum;
- MG_TRY()
-
pNewEnum = new CCoordinateSystemEnumInteger32;
pNewEnum->SetList(kProjections, klNumProjections);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemProjectionInformation.GetEnumProjections")
-
return pNewEnum.Detach();
}
@@ -152,7 +148,6 @@
{
INT32 nNbParams=0;
- MG_TRY()
if (MgCoordinateSystemProjectionCode::Unknown == nProjectionCode)
{
throw new MgApplicationException(L"MgCoordinateSystemProjectionInformation.GetParameterCount", __LINE__, __WFILE__, NULL, L"InvalidArgument", NULL);
@@ -166,7 +161,6 @@
}
nNbParams=static_cast<INT32>(parmIdx);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemProjectionInformation.GetParameterCount")
return nNbParams;
}
@@ -178,7 +172,6 @@
{
bool bUses = false;
- MG_TRY()
if (MgCoordinateSystemProjectionCode::Unknown == nProjectionCode)
{
throw new MgApplicationException(L"MgCoordinateSystemProjectionInformation.IsUsingParameter", __LINE__, __WFILE__, NULL, L"InvalidArgument", NULL);
@@ -192,7 +185,6 @@
int nResult = CS_prjprm(NULL, nProjectionCode, ulIndex-1);
bUses = (1 == nResult);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemProjectionInformation.IsUsingParameter")
return bUses;
}
@@ -250,7 +242,7 @@
double CCoordinateSystemProjectionInformation::GetParameterMin(INT32 nProjectionCode, UINT32 ulIndex)
{
double dResult=0.;
- MG_TRY()
+
if (MgCoordinateSystemProjectionCode::Unknown == nProjectionCode)
{
throw new MgApplicationException(L"MgCoordinateSystemProjectionInformation.GetParameterMin", __LINE__, __WFILE__, NULL, L"InvalidArgument", NULL);
@@ -282,14 +274,13 @@
//Return the information.
dResult=info.min_val;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemProjectionInformation.GetParameterMin")
return dResult;
}
double CCoordinateSystemProjectionInformation::GetParameterMax(INT32 nProjectionCode, UINT32 ulIndex)
{
double dResult=0.;
- MG_TRY()
+
if (MgCoordinateSystemProjectionCode::Unknown == nProjectionCode)
{
throw new MgApplicationException(L"MgCoordinateSystemProjectionInformation.GetParameterMax", __LINE__, __WFILE__, NULL, L"InvalidArgument", NULL);
@@ -321,7 +312,7 @@
//Return the information.
dResult=info.max_val;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemProjectionInformation.GetParameterMax")
+
return dResult;
}
@@ -334,7 +325,6 @@
double CCoordinateSystemProjectionInformation::GetParameterDefault(INT32 nProjectionCode, UINT32 ulIndex)
{
double dDefault = 0.;
- MG_TRY()
if (MgCoordinateSystemProjectionCode::Unknown == nProjectionCode)
{
@@ -368,7 +358,6 @@
//Return the information.
dDefault = info.deflt;
- MG_CATCH_AND_THROW(L"MgCoordinateSystemProjectionInformation.GetParamDefault")
return dDefault;
}
@@ -386,8 +375,6 @@
{
INT32 logicalType = MgCoordinateSystemProjectionLogicalType::None;
- MG_TRY()
-
if (MgCoordinateSystemProjectionCode::Unknown == nProjectionCode)
{
throw new MgApplicationException(L"MgCoordinateSystemProjectionInformation.GetParamLogicalType", __LINE__, __WFILE__, NULL, L"InvalidArgument", NULL);
@@ -420,7 +407,6 @@
//Return the information.
logicalType = static_cast<INT32>(info.log_type);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemProjectionInformation.GetParamLogicalType")
return logicalType;
}
@@ -437,8 +423,6 @@
{
INT32 formatType = MgCoordinateSystemProjectionFormatType::None;
- MG_TRY()
-
if (MgCoordinateSystemProjectionCode::Unknown == nProjectionCode)
{
throw new MgApplicationException(L"MgCoordinateSystemProjectionInformation.GetParamFormatType", __LINE__, __WFILE__, NULL, L"InvalidArgument", NULL);
@@ -471,7 +455,6 @@
//Return the information.
formatType = static_cast<INT32>(info.format);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemProjectionInformation.GetParamFormatType")
return formatType;
}
@@ -489,7 +472,6 @@
INT32 CCoordinateSystemProjectionInformation::GetParameterType(INT32 nProjectionCode, UINT32 ulIndex)
{
INT32 paramType=MgCoordinateSystemProjectionParameterType::NotUsed;
- MG_TRY()
if (MgCoordinateSystemProjectionCode::Unknown == nProjectionCode)
{
@@ -524,7 +506,6 @@
}
paramType = static_cast<INT32>(nIndex);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemProjectionInformation.GetParamType")
return paramType;
}
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysTransform.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysTransform.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysTransform.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -100,8 +100,6 @@
bool bIsValid = true;
int nResult;
- MG_TRY()
-
//Make sure we're initialized
if (!IsInitialized())
{
@@ -129,8 +127,6 @@
bIsValid = false;
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemTransform.IsValidPoint")
-
//And return.
return bIsValid;
}
@@ -151,7 +147,6 @@
MgCoordinate* CCoordinateSystemTransform::Transform(double x, double y)
{
MgCoordinate* pCoordinate = NULL;
- MG_TRY()
//Convert the point
INT32 status;
@@ -193,7 +188,6 @@
whatever it is you do with MgCoordinate objects. */
pCoordinate = new MgCoordinateXY(dCoords [0], dCoords [1]);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemTransform.Transform")
return pCoordinate;
}
@@ -216,7 +210,6 @@
MgCoordinate* CCoordinateSystemTransform::TransformM(double x, double y, double m)
{
MgCoordinate* pCoordinate = NULL;
- MG_TRY()
//Convert the point
INT32 status;
@@ -257,7 +250,6 @@
pCoordinate = new MgCoordinateXYM(dCoords [0], dCoords [1], lclM);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemTransform.TransformM")
return pCoordinate;
}
@@ -280,7 +272,6 @@
MgCoordinate* CCoordinateSystemTransform::Transform(double x, double y, double z)
{
MgCoordinate* pCoordinate = NULL;
- MG_TRY()
//Convert the point
INT32 status;
@@ -319,7 +310,6 @@
pCoordinate = new MgCoordinateXYZ(dCoords [0], dCoords [1], dCoords [2]);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemTransform.Transform")
return pCoordinate;
}
@@ -345,7 +335,7 @@
MgCoordinate* CCoordinateSystemTransform::TransformM(double x, double y, double z, double m)
{
MgCoordinate* pCoordinate = NULL;
- MG_TRY()
+
INT32 status;
double lclM (m);
double dCoords [3] = {x, y, z};
@@ -384,7 +374,6 @@
pCoordinate = new MgCoordinateXYZM(dCoords [0], dCoords [1], dCoords [2], lclM);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemTransform.TransformM")
return pCoordinate;
}
@@ -406,8 +395,6 @@
double m;
double dCoords [3];
- MG_TRY()
-
if(NULL == coordinate)
{
throw new MgApplicationException(L"MgCoordinateSystemTransform.TransformCoordinate", __LINE__, __WFILE__, NULL, L"NullArgument", NULL);
@@ -518,7 +505,6 @@
{
InterpretStatus (status);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemTransform.TransformCoordinate")
}
///////////////////////////////////////////////////////////////////////////
@@ -536,7 +522,6 @@
MgCoordinate* CCoordinateSystemTransform::Transform(MgCoordinate* coordinate)
{
MgCoordinate* pCoordinate = NULL;
- MG_TRY()
if(NULL == coordinate)
{
@@ -568,7 +553,6 @@
// What dimension is this?
throw new MgApplicationException(L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"InvalidArgument", NULL);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemTransform.Transform")
return pCoordinate;
}
@@ -624,8 +608,6 @@
// sent to stdout and ends up being included in the web-tier HTTP response.
// printf("\nTransform(envelope) -- Source: %S Dest: %S\n", m_pCsSource->GetCsCode().c_str(), m_pCsTarget->GetCsCode().c_str());
- MG_TRY()
-
if(NULL == envelope)
{
throw new MgApplicationException(L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"NullArgument", NULL);
@@ -732,8 +714,6 @@
pEnvelope = new MgEnvelope (xyzLowerLeft,xyzUpperRight);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemTransform.Transform")
-
// Leave commented except for temporary debugging. The printf output gets
// sent to stdout and ends up being included in the web-tier HTTP response.
/*
@@ -799,8 +779,6 @@
//
void CCoordinateSystemTransform::SetSourceAndTarget(MgCoordinateSystem* pSource, MgCoordinateSystem* pTarget)
{
- MG_TRY()
-
if (NULL == pSource || NULL == pTarget)
{
throw new MgApplicationException(L"MgCoordinateSystemTransform.SetSourceAndTarget", __LINE__, __WFILE__, NULL, L"NullArgument", NULL);
@@ -874,7 +852,6 @@
m_nTargetCount = 0;
//And return success!
- MG_CATCH_AND_THROW(L"MgCoordinateSystemTransform.SetSourceAndTarget")
}
// Geodetic Transformation Information
@@ -1031,8 +1008,6 @@
///////////////////////////////////////////////////////////////////////////
void CCoordinateSystemTransform::Transform(double* x, double* y)
{
- MG_TRY()
-
assert(NULL != x);
assert(NULL != y);
if (NULL == x || NULL == y)
@@ -1073,7 +1048,6 @@
}
//And return.
- MG_CATCH_AND_THROW(L"MgCoordinateSystemTransform.Transform")
}
///////////////////////////////////////////////////////////////////////////
@@ -1084,8 +1058,6 @@
double dCoords [3];
- MG_TRY()
-
assert(NULL != x);
assert(NULL != y);
if (NULL == x || NULL == y)
@@ -1155,14 +1127,11 @@
}
//And return.
- MG_CATCH_AND_THROW(L"MgCoordinateSystemTransform.Transform")
}
///////////////////////////////////////////////////////////////////////////
void CCoordinateSystemTransform::TransformM(double* x, double* y, double* m)
{
- MG_TRY()
-
assert(NULL != x);
assert(NULL != y);
if (NULL == x || NULL == y)
@@ -1203,7 +1172,6 @@
}
//And return.
- MG_CATCH_AND_THROW(L"MgCoordinateSystemTransform.Transform")
}
///////////////////////////////////////////////////////////////////////////
@@ -1214,8 +1182,6 @@
double dCoords [3];
- MG_TRY()
-
assert(NULL != x);
assert(NULL != y);
assert(NULL != m);
@@ -1287,7 +1253,6 @@
}
//And return.
- MG_CATCH_AND_THROW(L"MgCoordinateSystemTransform.Transform")
}
///////////////////////////////////////////////////////////////////////////
@@ -1295,8 +1260,6 @@
{
INT32 status;
- MG_TRY()
-
assert(NULL != x);
assert(NULL != y);
assert(NULL != z);
@@ -1338,7 +1301,6 @@
}
//And return.
- MG_CATCH_AND_THROW(L"MgCoordinateSystemTransform.Transform")
}
///////////////////////////////////////////////////////////////////////////
@@ -1349,8 +1311,6 @@
double dCoords [3];
- MG_TRY()
-
assert(NULL != x);
assert(NULL != y);
assert(NULL != z);
@@ -1422,7 +1382,6 @@
}
//And return.
- MG_CATCH_AND_THROW(L"MgCoordinateSystemTransform.Transform")
}
///////////////////////////////////////////////////////////////////////////
@@ -1430,7 +1389,6 @@
{
INT32 status;
- MG_TRY()
assert(NULL != x);
assert(NULL != y);
assert(NULL != z);
@@ -1473,7 +1431,6 @@
InterpretStatus (status);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemTransform.TransformM")
}
///////////////////////////////////////////////////////////////////////////
@@ -1484,7 +1441,6 @@
double dCoords [3];
- MG_TRY()
assert(NULL != x);
assert(NULL != y);
assert(NULL != z);
@@ -1558,7 +1514,6 @@
InterpretStatus (m_nTransformStatus);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemTransform.TransformM")
}
void CCoordinateSystemTransform::Transform2D (double xy[][2],INT32 pointCount)
Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysUnitInformation.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysUnitInformation.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysUnitInformation.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -137,7 +137,6 @@
double CCoordinateSystemUnitInformation::GetScale(INT32 unit, INT32 desiredUnitType)
{
double dScale=0.;
- MG_TRY()
INT32 unitType;
if (!GetUnitInfo(unit, &unitType, &dScale))
@@ -153,7 +152,6 @@
arguments.Add(L""); // dummy argument
throw new MgApplicationException(L"MgCoordinateSystemUnitInformation.GetScale", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemNotLinearUnit", NULL);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemUnitInformation.GetScale")
return dScale;
}
@@ -166,14 +164,10 @@
{
Ptr<CCoordinateSystemEnumInteger32> pNewEnum;
- MG_TRY()
-
pNewEnum = new CCoordinateSystemEnumInteger32;
pNewEnum->SetList(kLinearUnits, klNumLinearUnits);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemUnitInformation.GetEnumLinearUnits")
-
return pNewEnum.Detach();
}
@@ -185,14 +179,10 @@
{
Ptr<CCoordinateSystemEnumInteger32> pNewEnum;
- MG_TRY()
-
pNewEnum = new CCoordinateSystemEnumInteger32;
pNewEnum->SetList(kAngularUnits, klNumAngularUnits);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemUnitInformation.GetEnumAngularUnits")
-
return pNewEnum.Detach();
}
@@ -256,8 +246,6 @@
//
STRING CCoordinateSystemUnitInformation::GetAbbreviation(INT32 unit)
{
- MG_TRY()
-
//Get a string for the unit
const char *kpTag = StringFromUnit(unit);
if (NULL == kpTag)
@@ -291,7 +279,6 @@
//above should catch that possibility. The only way this
//could happen would be if Mentor and the public API source code got
//out of sync with each other.
- MG_CATCH_AND_THROW(L"MgCoordinateSystemUnitInformation.GetAbbreviation")
assert(0);
return L"";
Modified: sandbox/adsk/vik/Common/CoordinateSystem/MentorDictionary.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/MentorDictionary.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/MentorDictionary.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -47,8 +47,6 @@
{
csFILE *pFile=NULL;
- MG_TRY()
-
//Make sure they've specified a valid mode
bool bWriting;
switch (nOpenMode)
@@ -119,7 +117,6 @@
throw new MgApplicationException(L"MentorDictionary.Open", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryNoWriteToOldException", NULL);
}
- MG_CATCH_AND_THROW(L"MentorDictionary.Open")
return pFile;
}
@@ -148,8 +145,6 @@
/*[IN/OUT]*/ REFSTRING sFileNameSet,
/*[in]*/ const wchar_t* kpMethodName)
{
- MG_TRY()
-
_ASSERT(!sFileName.empty());
if (!sFileName.empty())
@@ -183,8 +178,6 @@
//ok, so, save the file name
sFileNameSet=sFileName;
-
- MG_CATCH_AND_THROW(kpMethodName)
}
//Default callback used to force opening an arbitrary dictionary file in reading mode
Modified: sandbox/adsk/vik/Common/CoordinateSystem/MentorUtil.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/MentorUtil.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/CoordinateSystem/MentorUtil.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -973,8 +973,6 @@
{
Ptr<CCoordinateSystem> pDef;
- MG_TRY()
-
cs_Csdef_ defLocal = def;
//Tweak the coordsys def as needed to make sure
//that it's legal.
@@ -995,8 +993,6 @@
pDef->InitFromCatalog(def);
}
- MG_CATCH_AND_THROW(L"BuildInterfaceFromCsDef")
-
return pDef.Detach();
}
@@ -1007,7 +1003,6 @@
{
Ptr<CCoordinateSystemDatum> pNew;
- MG_TRY()
//Construct our object
pNew = new CCoordinateSystemDatum(pCatalog);
@@ -1016,8 +1011,6 @@
pNew->InitFromCatalog(def);
}
- MG_CATCH_AND_THROW(L"BuildInterfaceFromDtDef")
-
return pNew.Detach();
}
@@ -1028,8 +1021,6 @@
{
Ptr<CCoordinateSystemEllipsoid> pNew;
- MG_TRY()
-
//Construct our object
pNew = new CCoordinateSystemEllipsoid(pCatalog);
@@ -1038,8 +1029,6 @@
pNew->Init(def);
}
- MG_CATCH_AND_THROW(L"BuildInterfaceFromElDef")
-
return pNew.Detach();
}
Modified: sandbox/adsk/vik/Common/Foundation/Exception/ExceptionDefs.h
===================================================================
--- sandbox/adsk/vik/Common/Foundation/Exception/ExceptionDefs.h 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/Foundation/Exception/ExceptionDefs.h 2011-12-08 17:27:20 UTC (rev 6315)
@@ -76,11 +76,6 @@
mgException->Raise(); \
} \
-#define MG_CATCH_AND_THROW(methodName) \
- MG_CATCH(methodName) \
- \
- MG_THROW() \
-
#define MG_CATCH_AND_RELEASE() \
} \
catch (MgException* e) \
Modified: sandbox/adsk/vik/Common/Foundation/System/FileUtil.cpp
===================================================================
--- sandbox/adsk/vik/Common/Foundation/System/FileUtil.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/Foundation/System/FileUtil.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -69,8 +69,6 @@
///
void MgFileUtil::ValidateFileName(CREFSTRING fileName)
{
- MG_TRY()
-
if (fileName.empty())
{
MgStringCollection arguments;
@@ -106,8 +104,6 @@
L"MgFileUtil.ValidateFileName",
__LINE__, __WFILE__, &arguments, L"InvalidArgument", NULL);
}
-
- MG_CATCH_AND_THROW(L"MgFileUtil.ValidateFileName")
}
///----------------------------------------------------------------------------
@@ -217,8 +213,6 @@
{
bool success = false;
- MG_TRY()
-
if (pathname.empty())
{
throw new MgApplicationException(L"MgFileUtil.GetFileStatus",
@@ -251,8 +245,6 @@
__LINE__, __WFILE__, &arguments, L"FileIo", NULL);
}
- MG_CATCH_AND_THROW(L"MgFileUtil.GetFileStatus")
-
return success;
}
@@ -391,8 +383,6 @@
void MgFileUtil::CreateDirectory(CREFSTRING path, bool strict, bool recursive)
{
- MG_TRY()
-
if (PathnameExists(path))
{
if (strict)
@@ -439,16 +429,12 @@
{
MkDir(path);
}
-
- MG_CATCH_AND_THROW(L"MgFileUtil.CreateDirectory")
}
/// private helper
void MgFileUtil::MkDir(CREFSTRING path)
{
- MG_TRY()
-
MgLock lock(sm_mutex);
#ifdef _WIN32
@@ -474,8 +460,6 @@
break;
}
}
-
- MG_CATCH_AND_THROW(L"MgFileUtil.MkDir")
}
#if WANT_ACE
@@ -493,8 +477,6 @@
void MgFileUtil::DeleteDirectory(CREFSTRING path, bool recursive, bool strict)
{
- MG_TRY()
-
MgLock lock(sm_mutex);
if (CleanDirectory(path, recursive, strict) == false)
@@ -521,8 +503,6 @@
break;
}
}
-
- MG_CATCH_AND_THROW(L"MgFileUtil.DeleteDirectory")
}
///----------------------------------------------------------------------------
@@ -716,8 +696,6 @@
void MgFileUtil::CopyFile(CREFSTRING sourcePathname, CREFSTRING destPathname,
bool overwrite)
{
- MG_TRY()
-
if (sourcePathname.empty() || destPathname.empty())
{
throw new MgNullArgumentException(L"MgFileUtil.CopyFile",
@@ -751,8 +729,6 @@
MgByteSink byteSink(byteReader);
byteSink.ToFile(destPathname);
-
- MG_CATCH_AND_THROW(L"MgFileUtil.CopyFile")
}
///----------------------------------------------------------------------------
@@ -770,8 +746,6 @@
{
STRING tempPathname;
- MG_TRY()
-
// TODO: Server Drawing Service GETDRAWINGLAYER API does not work well
// if using Mg temporary directory.
MgConfiguration* config = MgConfiguration::GetInstance();
@@ -785,8 +759,6 @@
CreateDirectory(tempPathname);
AppendSlashToEndOfPath(tempPathname);
- MG_CATCH_AND_THROW(L"MgFileUtil.GetTempPath")
-
return tempPathname;
}
@@ -805,8 +777,6 @@
{
STRING tempPathname;
- MG_TRY()
-
tempPathname = GetTempPath();
STRING uuid;
@@ -815,8 +785,6 @@
CreateDirectory(tempPathname);
- MG_CATCH_AND_THROW(L"MgFileUtil.GenerateTempPath")
-
return tempPathname;
}
@@ -918,8 +886,6 @@
void MgFileUtil::DeleteFile(CREFSTRING pathname, bool strict)
{
- MG_TRY()
-
MgLock lock(sm_mutex);
if (!PathnameExists(pathname))
@@ -958,8 +924,6 @@
break;
}
}
-
- MG_CATCH_AND_THROW(L"MgFileUtil.DeleteFile")
}
@@ -979,8 +943,6 @@
void MgFileUtil::RenameFile(CREFSTRING path, CREFSTRING oldFileName,
CREFSTRING newFileName, bool overwrite)
{
- MG_TRY()
-
if (path.empty() || oldFileName.empty() || newFileName.empty())
{
throw new MgApplicationException(L"MgFileUtil.RenameFile",
@@ -995,8 +957,6 @@
newPathname += newFileName;
RenameFile(oldPathname, newPathname, overwrite);
-
- MG_CATCH_AND_THROW(L"MgFileUtil.RenameFile")
}
///----------------------------------------------------------------------------
@@ -1015,8 +975,6 @@
void MgFileUtil::RenameFile(CREFSTRING oldPathname, CREFSTRING newPathname,
bool overwrite)
{
- MG_TRY()
-
if (oldPathname.empty() || newPathname.empty())
{
throw new MgApplicationException(L"MgFileUtil.RenameFile",
@@ -1093,8 +1051,6 @@
break;
}
}
-
- MG_CATCH_AND_THROW(L"MgFileUtil.RenameFile")
}
@@ -1119,8 +1075,6 @@
{
STRING tempPathname;
- MG_TRY()
-
#if WANT_ACE
if (useMgTempPath)
{
@@ -1177,8 +1131,6 @@
tempPathname.append(extension);
}
- MG_CATCH_AND_THROW(L"MgFileUtil.GenerateTempFileName")
-
return tempPathname;
}
@@ -1248,8 +1200,6 @@
{
bool bResult = false;
- MG_TRY()
-
if (pathname.empty())
{
throw new MgApplicationException(L"MgFileUtil.IsFileInUse",
@@ -1290,8 +1240,6 @@
}
}
- MG_CATCH_AND_THROW(L"MgFileUtil.IsFileInUse")
-
return bResult;
}
Modified: sandbox/adsk/vik/Common/Foundation/System/Resources.h
===================================================================
--- sandbox/adsk/vik/Common/Foundation/System/Resources.h 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/Foundation/System/Resources.h 2011-12-08 17:27:20 UTC (rev 6315)
@@ -39,9 +39,6 @@
#define MG_RESOURCES_THROW() \
MG_THROW() \
-#define MG_RESOURCES_CATCH_AND_THROW(methodName) \
- MG_CATCH_AND_THROW(methodName) \
-
/// \cond INTERNAL
class MG_FOUNDATION_API MgResources : public MgGuardDisposable
{
Modified: sandbox/adsk/vik/Common/Foundation/System/Util.cpp
===================================================================
--- sandbox/adsk/vik/Common/Foundation/System/Util.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/Foundation/System/Util.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -728,15 +728,11 @@
{
InitializeUuidGenerator();
- MG_TRY()
-
string str;
MgUtil::GenerateUuid(str);
uuid = ACE_Ascii_To_Wide(str.c_str()).wchar_rep();
-
- MG_CATCH_AND_THROW(L"MgUtil.GenerateUuid")
}
///----------------------------------------------------------------------------
@@ -755,8 +751,6 @@
{
InitializeUuidGenerator();
- MG_TRY()
-
ACE_Utils::UUID uuidObject;
uuidGenerator.generate_UUID(uuidObject);
@@ -770,8 +764,6 @@
}
uuid = str->c_str();
-
- MG_CATCH_AND_THROW(L"MgUtil.GenerateUuid")
}
#endif
Modified: sandbox/adsk/vik/Common/Geometry/Buffer/pobjbufr.cpp
===================================================================
--- sandbox/adsk/vik/Common/Geometry/Buffer/pobjbufr.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/Geometry/Buffer/pobjbufr.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -453,13 +453,9 @@
mgException.p = 0;
if (m_pBufferUtil->CreateOffsetChainLBL(TRUE))
{
- MG_TRY()
-
// forward call to base class method
GenerateBufferZone(m_pVertices, m_pnPolyVerts, m_nPolyObjects,
callback, bufferPolygon);
-
- MG_CATCH_AND_THROW(L"PolyObjectBuffer.CreateBufferZone")
}
}
}
Modified: sandbox/adsk/vik/Common/Geometry/CoordinateSystem/CoordinateSystemFactory.cpp
===================================================================
--- sandbox/adsk/vik/Common/Geometry/CoordinateSystem/CoordinateSystemFactory.cpp 2011-12-08 16:39:20 UTC (rev 6314)
+++ sandbox/adsk/vik/Common/Geometry/CoordinateSystem/CoordinateSystemFactory.cpp 2011-12-08 17:27:20 UTC (rev 6315)
@@ -66,8 +66,6 @@
///</summary>
MgCoordinateSystemFactory::MgCoordinateSystemFactory()
{
- MG_TRY()
-
// Set the single copy of the catalog
if (sm_pCatalog == NULL)
{
@@ -79,8 +77,6 @@
sm_pCatalog = new CCoordinateSystemCatalog();
}
}
-
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.MgCoordinateSystemFactory")
}
///////////////////////////////////////////////////////////////////////////
@@ -100,8 +96,6 @@
{
Ptr<MgCoordinateSystem> coordinateSystem;
- MG_TRY()
-
if (NULL == sm_pCatalog)
{
throw new MgApplicationException(
@@ -125,8 +119,6 @@
coordinateSystemCache->Set(wkt, coordinateSystem.p);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.Create")
-
return coordinateSystem.Detach();
}
@@ -138,8 +130,6 @@
{
Ptr<MgCoordinateSystem> coordinateSystem;
- MG_TRY()
-
if (NULL == sm_pCatalog)
{
throw new MgApplicationException(
@@ -160,8 +150,6 @@
coordinateSystemCache->Set(code, coordinateSystem.p);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.CreateFromCode")
-
return coordinateSystem.Detach();
}
@@ -195,13 +183,10 @@
//
MgCoordinateSystemCatalog* MgCoordinateSystemFactory::GetCatalog()
{
- MG_TRY()
-
if (!sm_pCatalog)
{
throw new MgApplicationException(L"MgCoordinateSystemFactory.GetCatalog", __LINE__, __WFILE__, NULL, L"CoordinateSystemInitializationFailed", NULL);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.GetCatalog")
return SAFE_ADDREF((MgCoordinateSystemCatalog*)sm_pCatalog);
}
@@ -210,11 +195,9 @@
MgCoordinateSystemTransform* MgCoordinateSystemFactory::GetTransform(MgCoordinateSystem* pSource, MgCoordinateSystem* pTarget)
{
Ptr<CCoordinateSystemTransform> pNew;
- MG_TRY()
+
pNew=new CCoordinateSystemTransform(pSource, pTarget);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.GetTransform")
-
//And we're done! Return success.
return pNew.Detach();
}
@@ -234,8 +217,6 @@
{
STRING code;
- MG_TRY()
-
if (!sm_pCatalog)
{
throw new MgApplicationException(L"MgCoordinateSystemFactory.ConvertWktToCoordinateSystemCode", __LINE__, __WFILE__, NULL, L"CoordinateSystemInitializationFailed", NULL);
@@ -247,8 +228,6 @@
}
code=pConverter->WktToCode(MgCoordinateSystemWktFlavor::Unknown, wkt, MgCoordinateSystemCodeFormat::Mentor);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.ConvertWktToCoordinateSystemCode")
-
return code;
}
@@ -267,8 +246,6 @@
{
STRING wkt;
- MG_TRY()
-
if (!sm_pCatalog)
{
throw new MgApplicationException(L"MgCoordinateSystemFactory.ConvertCoordinateSystemCodeToWkt", __LINE__, __WFILE__, NULL, L"CoordinateSystemInitializationFailed", NULL);
@@ -293,8 +270,6 @@
wkt=pConverter->CodeToWkt(MgCoordinateSystemCodeFormat::Mentor, code, MgCoordinateSystemWktFlavor::Ogc);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.ConvertCoordinateSystemCodeToWkt")
-
return wkt;
}
@@ -309,8 +284,6 @@
{
Ptr<MgStringCollection> categoryNames;
- MG_TRY()
-
categoryNames = new MgStringCollection();
if (!sm_pCatalog)
@@ -331,8 +304,6 @@
throw new MgApplicationException(L"MgCoordinateSystemFactory.EnumerateCategories", __LINE__, __WFILE__, NULL, L"CoordinateSystemInitializationFailed", NULL);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.EnumerateCategories")
-
return categoryNames.Detach();
}
@@ -351,8 +322,6 @@
{
Ptr<MgBatchPropertyCollection> pCoordinateSystems;
- MG_TRY()
-
pCoordinateSystems = new MgBatchPropertyCollection();
if (!sm_pCatalog)
@@ -425,8 +394,6 @@
pCoordinateSystems->Add(pCoordSysProperties);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.EnumerateCoordinateSystems")
-
return pCoordinateSystems.Detach();
}
@@ -445,8 +412,6 @@
{
STRING wkt;
- MG_TRY()
-
if (!sm_pCatalog)
{
throw new MgApplicationException(L"MgCoordinateSystemFactory.ConvertEpsgCodeToWkt", __LINE__, __WFILE__, NULL, L"CoordinateSystemInitializationFailed", NULL);
@@ -464,7 +429,6 @@
#endif
STRING strEpsgCode(wszEpsg);
wkt=pConverter->CodeToWkt(MgCoordinateSystemCodeFormat::Epsg, strEpsgCode, MgCoordinateSystemWktFlavor::Ogc);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.ConvertEpsgCodeToWkt")
return wkt;
}
@@ -484,8 +448,6 @@
{
INT32 nEpsg=-1;
- MG_TRY()
-
if (!sm_pCatalog)
{
throw new MgApplicationException(L"MgCoordinateSystemFactory.ConvertWktToEpsgCode", __LINE__, __WFILE__, NULL, L"CoordinateSystemInitializationFailed", NULL);
@@ -497,7 +459,6 @@
}
STRING strEpsgCode=pConverter->WktToCode(MgCoordinateSystemWktFlavor::Unknown, wkt, MgCoordinateSystemCodeFormat::Epsg);
nEpsg = (INT32)wcstol(strEpsgCode.c_str(), NULL, 10);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.ConvertWktToEpsgCode")
return nEpsg;
}
@@ -518,8 +479,6 @@
///////////////////////////////////////////////////////////////////////////
bool MgCoordinateSystemFactory::IsValid(CREFSTRING wkt)
{
- MG_TRY()
-
if (!sm_pCatalog)
{
throw new MgApplicationException(L"MgCoordinateSystemFactory.IsValid", __LINE__, __WFILE__, NULL, L"CoordinateSystemInitializationFailed", NULL);
@@ -545,8 +504,6 @@
return false;
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.IsValid")
-
return false;
}
@@ -565,23 +522,22 @@
{
Ptr<MgCoordinateSystemGridSpecification> gridSpecification;
- MG_TRY ()
- gridSpecification = new CCoordinateSystemGridSpecification ();
- if (gridSpecification != NULL)
- {
- gridSpecification->SetGridBase (0.0,0.0);
- gridSpecification->SetGridIncrement (increment,increment);
- gridSpecification->SetGridIncrement (tickIncrement,tickIncrement);
- gridSpecification->SetUnits (unitCode,MgCoordinateSystemUnitType::Linear);
- gridSpecification->SetCurvePrecision (curvePrecision);
+ gridSpecification = new CCoordinateSystemGridSpecification ();
+ if (gridSpecification != NULL)
+ {
+ gridSpecification->SetGridBase (0.0,0.0);
+ gridSpecification->SetGridIncrement (increment,increment);
+ gridSpecification->SetGridIncrement (tickIncrement,tickIncrement);
+ gridSpecification->SetUnits (unitCode,MgCoordinateSystemUnitType::Linear);
+ gridSpecification->SetCurvePrecision (curvePrecision);
- // Check the consistency of all these parameters.
- if (!gridSpecification->IsConsistent ())
- {
- throw new MgApplicationException(L"MgCoordinateSystemFactory.GridSpecification", __LINE__, __WFILE__, NULL, L"InvalidArgument", NULL);
- }
+ // Check the consistency of all these parameters.
+ if (!gridSpecification->IsConsistent ())
+ {
+ throw new MgApplicationException(L"MgCoordinateSystemFactory.GridSpecification", __LINE__, __WFILE__, NULL, L"InvalidArgument", NULL);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.GridSpecification")
+ }
+
return gridSpecification.Detach ();
}
MgCoordinateSystemGridSpecification* MgCoordinateSystemFactory::GridSpecification (INT32 gridType,
@@ -589,20 +545,19 @@
{
Ptr<MgCoordinateSystemGridSpecification> gridSpecification;
- MG_TRY ()
- gridSpecification = new CCoordinateSystemGridSpecification ();
- if (gridSpecification != NULL)
+ gridSpecification = new CCoordinateSystemGridSpecification ();
+ if (gridSpecification != NULL)
+ {
+ if (gridType == MgCoordinateSystemGridSpecializationType::MGRS)
{
- if (gridType == MgCoordinateSystemGridSpecializationType::MGRS)
- {
- CCoordinateSystemMgrs::InitMgrsSpecification (gridSpecification,gridLevel);
- }
- else
- {
- // Throw an exception
- }
+ CCoordinateSystemMgrs::InitMgrsSpecification (gridSpecification,gridLevel);
}
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.GridSpecification")
+ else
+ {
+ // Throw an exception
+ }
+ }
+
return gridSpecification.Detach ();
}
///////////////////////////////////////////////////////////////////////////
@@ -612,13 +567,12 @@
MgCoordinateSystemGridBoundary* rtnValue (0);
CCoordinateSystemGridBoundary* pGridBoundary;
- MG_TRY()
- pGridBoundary = new CCoordinateSystemGridBoundary (southwest,northeast);
- if (pGridBoundary != NULL)
- {
- rtnValue = static_cast<MgCoordinateSystemGridBoundary*>(pGridBoundary);
- }
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.GridBoundary")
+ pGridBoundary = new CCoordinateSystemGridBoundary (southwest,northeast);
+ if (pGridBoundary != NULL)
+ {
+ rtnValue = static_cast<MgCoordinateSystemGridBoundary*>(pGridBoundary);
+ }
+
return rtnValue;
}
MgCoordinateSystemGridBoundary* MgCoordinateSystemFactory::GridBoundary(MgPolygon* boundary)
@@ -626,13 +580,12 @@
MgCoordinateSystemGridBoundary* rtnValue (0);
CCoordinateSystemGridBoundary* pGridBoundary;
- MG_TRY()
- pGridBoundary = new CCoordinateSystemGridBoundary (boundary);
- if (pGridBoundary != NULL)
- {
- rtnValue = static_cast<MgCoordinateSystemGridBoundary*>(pGridBoundary);
- }
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.GridBoundary")
+ pGridBoundary = new CCoordinateSystemGridBoundary (boundary);
+ if (pGridBoundary != NULL)
+ {
+ rtnValue = static_cast<MgCoordinateSystemGridBoundary*>(pGridBoundary);
+ }
+
return rtnValue;
}
@@ -646,11 +599,10 @@
bool bSetExceptionsOn)
{
Ptr<CCoordinateSystemMgrs> pNew;
- MG_TRY()
+
pNew=new CCoordinateSystemMgrs(nLetteringScheme, bSetExceptionsOn);
pNew->Init(dEquatorialRadius, dEccentricity);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.GetMgrs")
//And we're done! Return success.
return pNew.Detach();
@@ -665,11 +617,10 @@
bool bSetExceptionsOn)
{
Ptr<CCoordinateSystemMgrs> pNew;
- MG_TRY()
+
pNew=new CCoordinateSystemMgrs(nLetteringScheme, bSetExceptionsOn);
pNew->InitFromEllipsoid(sEllipsoidCode);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.GetMgrsEllipsoid")
//And we're done! Return success.
return pNew.Detach();
@@ -684,11 +635,10 @@
bool bSetExceptionsOn)
{
Ptr<CCoordinateSystemMgrs> pNew;
- MG_TRY()
+
pNew=new CCoordinateSystemMgrs(nLetteringScheme, bSetExceptionsOn);
pNew->InitFromDatum(sDatumCode);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.GetMgrsDatum")
//And we're done! Return success.
return pNew.Detach();
@@ -702,10 +652,8 @@
Ptr<MgCoordinateSystemGridBase> pNewMgrs;
Ptr<MgCoordinateSystem> pFrameCs;
- MG_TRY()
- pFrameCs = CreateFromCode(sFrameCs);
- pNewMgrs = MgrsGrid (pFrameCs,bUseTargetDatum,nLetteringScheme,bSetExceptionsOn);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.GetMgrsDatum")
+ pFrameCs = CreateFromCode(sFrameCs);
+ pNewMgrs = MgrsGrid (pFrameCs,bUseTargetDatum,nLetteringScheme,bSetExceptionsOn);
return pNewMgrs.Detach ();
}
@@ -718,19 +666,17 @@
STRING sDatumCode;
Ptr<CCoordinateSystemMgrs> pNewMgrs;
- MG_TRY()
- pNewMgrs=new CCoordinateSystemMgrs(pFrameCs,nLetteringScheme,bSetExceptionsOn);
+ pNewMgrs=new CCoordinateSystemMgrs(pFrameCs,nLetteringScheme,bSetExceptionsOn);
- if (bUseTargetDatum)
- {
- sDatumCode = pFrameCs->GetDatum ();
- }
- else
- {
- sDatumCode = L"WGS84";
- }
- pNewMgrs->InitFromDatum(sDatumCode);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.GetMgrsDatum")
+ if (bUseTargetDatum)
+ {
+ sDatumCode = pFrameCs->GetDatum ();
+ }
+ else
+ {
+ sDatumCode = L"WGS84";
+ }
+ pNewMgrs->InitFromDatum(sDatumCode);
//And we're done! Return success.
return static_cast<MgCoordinateSystemGridBase*>(pNewMgrs.Detach());
@@ -742,11 +688,9 @@
{
Ptr<MgCoordinateSystemGridBase> pGenericGrid;
- MG_TRY()
- Ptr<MgCoordinateSystem> pGridCs = CreateFromCode(sGridCs);
- Ptr<MgCoordinateSystem> pFrameCs = CreateFromCode(sFrameCs);
- pGenericGrid = GenericGrid (pGridCs,pFrameCs,bSetExceptionsOn);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.GetMgrsDatum")
+ Ptr<MgCoordinateSystem> pGridCs = CreateFromCode(sGridCs);
+ Ptr<MgCoordinateSystem> pFrameCs = CreateFromCode(sFrameCs);
+ pGenericGrid = GenericGrid (pGridCs,pFrameCs,bSetExceptionsOn);
return pGenericGrid.Detach ();
}
@@ -757,9 +701,7 @@
{
Ptr<MgCoordinateSystemGridGeneric> pGenericGrid;
- MG_TRY()
- pGenericGrid=new CCoordinateSystemGridGeneric (pGridCs,pFrameCs,bSetExceptionsOn);
- MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.GetMgrsDatum")
+ pGenericGrid=new CCoordinateSystemGridGeneric (pGridCs,pFrameCs,bSetExceptionsOn);
return static_cast<MgCoordinateSystemGridBase*>(pGenericGrid.Detach());
}
More information about the mapguide-commits
mailing list