[mapguide-commits] r5718 - in sandbox/adsk/2.2gp: .
Common/CoordinateSystem
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Apr 22 04:39:13 EDT 2011
Author: christinebao
Date: 2011-04-22 01:39:13 -0700 (Fri, 22 Apr 2011)
New Revision: 5718
Modified:
sandbox/adsk/2.2gp/
sandbox/adsk/2.2gp/Common/CoordinateSystem/CoordSysFormatConverter.cpp
Log:
Integrate r5552, r5616, r5687 from trunk to branches/2.2.
Fix ticket http://trac.osgeo.org/mapguide/ticket/1600
Threading error with CodeToWkt() method
Property changes on: sandbox/adsk/2.2gp
___________________________________________________________________
Added: svn:mergeinfo
+ /trunk/MgDev:5552,5616,5687
Modified: sandbox/adsk/2.2gp/Common/CoordinateSystem/CoordSysFormatConverter.cpp
===================================================================
--- sandbox/adsk/2.2gp/Common/CoordinateSystem/CoordSysFormatConverter.cpp 2011-04-21 15:18:07 UTC (rev 5717)
+++ sandbox/adsk/2.2gp/Common/CoordinateSystem/CoordSysFormatConverter.cpp 2011-04-22 08:39:13 UTC (rev 5718)
@@ -455,7 +455,7 @@
throw new MgInvalidArgumentException(L"MgCoordinateSystemFormatConverter.CodeToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
}
- const char* szMsiName=NULL;
+ std::string szMsiName;
std::string strName;
//if input is EPSG
@@ -484,9 +484,20 @@
//viewed from the outside of public API
//The mapping from Adsk name to Msi is done internally inside
//the method CSepsg2adskCS
- szMsiName=CSepsg2adskCS(lEpsg);
- if (!szMsiName)
+ CriticalClass.Enter();
+ const char* szMsiNameTemp=NULL;
+ szMsiNameTemp=CSepsg2adskCS(lEpsg);
+ if(NULL == szMsiNameTemp)
{
+ szMsiName = "";
+ }
+ else
+ {
+ szMsiName = szMsiNameTemp;
+ }
+ CriticalClass.Leave();
+ if (szMsiName.empty())
+ {
return L"";
}
}
@@ -501,8 +512,8 @@
strName=pszCsSource;
delete[] pszCsSource;
ReformatOldArbitraryName(strName);
- szMsiName=strName.c_str();
- if (!szMsiName)
+ szMsiName=strName;
+ if (szMsiName.empty())
{
return L"";
}
@@ -517,7 +528,7 @@
char csWktBufr [2048];
//is it an arbitrary system, one that uses NERTH projection?
- wchar_t* wszMsiName=Convert_Ascii_To_Wide(szMsiName);
+ wchar_t* wszMsiName=Convert_Ascii_To_Wide(szMsiName.c_str());
if (!wszMsiName)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.CodeToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -540,7 +551,7 @@
else
{
SmartCriticalClass critical(true);
- if (0==CS_cs2Wkt(csWktBufr,sizeof(csWktBufr),szMsiName,GetWktFlavor(nWktFlavor)))
+ if (0==CS_cs2Wkt(csWktBufr,sizeof(csWktBufr),szMsiName.c_str(),GetWktFlavor(nWktFlavor)))
{
wchar_t* wszWkt=Convert_Ascii_To_Wide(csWktBufr);
if (!wszWkt)
@@ -818,7 +829,7 @@
throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.CodeToDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
}
- const char* szMsiName=NULL;
+ std::string szMsiName;
//if input is EPSG
bool bResult=false;
@@ -832,9 +843,20 @@
//viewed from the outside of the public API
//The mapping from Adsk name to Msi is done internally inside
//the method CSepsg2adskCS
- szMsiName=CSepsg2adskCS(lEpsg);
- if (szMsiName)
+ CriticalClass.Enter();
+ const char* szMsiNameTemp=NULL;
+ szMsiNameTemp=CSepsg2adskCS(lEpsg);
+ if(NULL == szMsiNameTemp)
{
+ szMsiName = "";
+ }
+ else
+ {
+ szMsiName = szMsiNameTemp;
+ }
+ CriticalClass.Leave();
+ if (!szMsiName.empty())
+ {
bResult=true;
}
}
@@ -853,9 +875,9 @@
//now get the definition
if (bResult)
{
- assert(szMsiName);
+ assert(!szMsiName.empty());
- wchar_t* wszMsiName=Convert_Ascii_To_Wide(szMsiName);
+ wchar_t* wszMsiName=Convert_Ascii_To_Wide(szMsiName.c_str());
if (!wszMsiName)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.CodeToDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -908,14 +930,26 @@
//viewed from the outside of the public API
//The mapping from Adsk name to Msi is done internally inside
//the method CSepsg2adskCS
- const char* szMsiName=CSepsg2adskCS(lEpsg);
- if (szMsiName)
+ std::string szMsiName;
+ CriticalClass.Enter();
+ const char* szMsiNameTemp=NULL;
+ szMsiNameTemp=CSepsg2adskCS(lEpsg);
+ if(NULL == szMsiNameTemp)
{
+ szMsiName = "";
+ }
+ else
+ {
+ szMsiName = szMsiNameTemp;
+ }
+ CriticalClass.Leave();
+ if (!szMsiName.empty())
+ {
//need to check if the system is in our dictionary
- bool bIsCoordinateSystem=IsCoordinateSystem(const_cast<char*>(szMsiName), NULL);
+ bool bIsCoordinateSystem=IsCoordinateSystem(const_cast<char*>(szMsiName.c_str()), NULL);
if (bIsCoordinateSystem)
{
- wchar_t *pwszCsDestination=Convert_Ascii_To_Wide(szMsiName);
+ wchar_t *pwszCsDestination=Convert_Ascii_To_Wide(szMsiName.c_str());
if (!pwszCsDestination)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.CodeToCode", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -997,9 +1031,21 @@
//viewed from the outside of the public API
//The mapping from Adsk name to Msi is done internally inside
//the method CSepsg2adskCS
- const char* szMsiName=CSepsg2adskCS(lEpsg);
- if (szMsiName)
+ std::string szMsiName;
+ CriticalClass.Enter();
+ const char* szMsiNameTemp=NULL;
+ szMsiNameTemp=CSepsg2adskCS(lEpsg);
+ if(NULL == szMsiNameTemp)
{
+ szMsiName = "";
+ }
+ else
+ {
+ szMsiName = szMsiNameTemp;
+ }
+ CriticalClass.Leave();
+ if (!szMsiName.empty())
+ {
//we may have found an Msi name for a system
//but we still have to check if the system is in the dicionary
//in CS_epsg.c I found some systems that were present in the mapping
@@ -1008,7 +1054,7 @@
//if the system is in the dictionary since it takes care
//of mapping an MSI name to a valid ADSK name
//We'll check the existence of the system for additional security
- bIsPresent=IsCoordinateSystem(const_cast<char*>(szMsiName), NULL);
+ bIsPresent=IsCoordinateSystem(const_cast<char*>(szMsiName.c_str()), NULL);
}
}
}
More information about the mapguide-commits
mailing list