FdoExpressionEngineFunctionCollection* FdoRdbmsSelectCommand::GetUserDefinedFunctions( FdoSmLpSpatialContextCollection *scColl, FdoClassDefinition *classDef )
{
	// Length2D and Area2D require to pass in the 'geodetic' flag.
	// Check the associated coordinate system. In case it is geodetic, create a custom function.
	
	FdoPtr<FdoExpressionEngineFunctionCollection> userDefinedFunctions;

	if (classDef->GetClassType() == FdoClassType_FeatureClass)
	{
        FdoPtr<FdoGeometricPropertyDefinition> gpd = ((FdoFeatureClass*)classDef)->GetGeometryProperty();

		if ( gpd )
		{
			FdoStringP	scname = gpd->GetSpatialContextAssociation();

			if ( scname.GetLength() != 0 )
			{
				FdoSmLpSpatialContextP  sc = scColl->FindItem( scname );
				FdoStringP	wkt = sc->GetCoordinateSystemWkt();
				
				if ( wkt.Contains( L"PROJCS" ) )
					; // do nothing
				else if ( wkt.Contains( L"GEOGCS" ) )
				{
					userDefinedFunctions = FdoExpressionEngineFunctionCollection::Create();
					userDefinedFunctions->Add( FdoFunctionLength2D::Create(true));
					userDefinedFunctions->Add( FdoFunctionArea2D::Create(true));
				}
			}
		}
	}
	return FDO_SAFE_ADDREF(userDefinedFunctions.p);
}
Esempio n. 2
0
void OdbcConnectionUtil::CleanFiles(FdoStringCollection* files, FdoStringP& pTypeName)
{
	try
	{
		FdoString* pTypeNamecst = pTypeName;
		size_t lng = pTypeName.GetLength();
        size_t count = files->GetCount();
		for (size_t i = 0; i < count; i++)
		{
			FdoStringP name = files->GetString(i);
            if (lng != name.GetLength())
			{
                if (name.Contains(pTypeName))
					FdoCommonFile::Delete (name, true);
			}
		}
	}
	catch(...){}
}