EGwsStatus GwsCommonFdoUtils::DescribeClassSC ( FdoIConnection * conn, const GWSQualifiedName & classname, GwsSpatialContextDescription & desc ) { FdoPtr<FdoFeatureSchema> schema; FdoPtr<FdoClassDefinition> classDef; GwsCommonFdoUtils::GetClassDefinition (conn, classname, schema.p, classDef.p); for (; classDef != NULL ; classDef = classDef->GetBaseClass ()) { FdoPtr<FdoPropertyDefinitionCollection> propdsc = classDef->GetProperties (); // discover geometric property name. Use the first one if there are many. for (int idx = 0; idx < propdsc->GetCount(); idx ++) { FdoPtr<FdoPropertyDefinition> prop; prop = propdsc->GetItem (idx); if (prop->GetPropertyType () == FdoPropertyType_GeometricProperty) { FdoGeometricPropertyDefinition* geomProp = static_cast<FdoGeometricPropertyDefinition*>(prop.p); FdoString* pSC = geomProp->GetSpatialContextAssociation(); if(pSC != NULL) { return GwsCommonFdoUtils::DescribeSC (conn, pSC, desc); } } } } return eGwsSCNotFound; }
bool GwsCommonFdoUtils::GetFdoClassIdentityProperties ( FdoClassDefinition * pClassDef, FdoDataPropertyDefinitionCollection * & pIdentityProps ) { // identity properties are acquired from the principal base class pClassDef->AddRef (); FdoPtr<FdoClassDefinition> childClass = pClassDef; FdoPtr<FdoClassDefinition> baseClass; pIdentityProps = NULL; while ((baseClass = childClass->GetBaseClass ()) != NULL) { childClass = baseClass; } pIdentityProps = childClass->GetIdentityProperties (); if (pIdentityProps == NULL) return false; if(pIdentityProps->GetCount() == 0) { pIdentityProps->Release (); pIdentityProps = NULL; return false; } return true; }
FdoDataPropertyDefinitionCollection* GwsBinaryFeatureWriter::FindIDProps(FdoClassDefinition* fc) { FdoPtr <FdoDataPropertyDefinitionCollection> idpdc = fc->GetIdentityProperties(); FdoPtr<FdoClassDefinition> base = FDO_SAFE_ADDREF(fc); //go up class hierarchy to find base class (it has the identity properties) while ((base = base->GetBaseClass()) != NULL) idpdc = base->GetIdentityProperties(); if (idpdc->GetCount() == 0) return NULL; return (FDO_SAFE_ADDREF (idpdc.p)); }
FdoPropertyDefinition * GwsCommonFdoUtils::GetPropertyDefinition ( FdoClassDefinition * pClassDef, FdoString * PropertyName ) { pClassDef->AddRef (); FdoPtr<FdoClassDefinition> classDef = pClassDef; FdoPropertyDefinition * propDef = NULL; for (; propDef == NULL && classDef != NULL ; classDef = classDef->GetBaseClass ()) { FdoPtr<FdoPropertyDefinitionCollection> propdsc = classDef->GetProperties (); propDef = propdsc->FindItem (PropertyName); } return propDef; }
bool GwsCommonFdoUtils::GetGeometryName (FdoClassDefinition *pClassDef, std::wstring &name) { if(pClassDef == NULL) return false; if(pClassDef->GetClassType() == FdoClassType_FeatureClass) { FdoFeatureClass* pFeatClass = dynamic_cast<FdoFeatureClass*>(pClassDef); if(!pFeatClass) { assert(false); return false; } FdoPtr<FdoGeometricPropertyDefinition> pgDef = pFeatClass->GetGeometryProperty(); if (pgDef != NULL) { name = pgDef->GetName(); return true; } } FdoInt32 idx; FdoPtr<FdoClassDefinition> classDef = pClassDef; FDO_SAFE_ADDREF(pClassDef); for (; classDef != NULL ; classDef = classDef->GetBaseClass ()) { FdoPtr<FdoPropertyDefinitionCollection> propdsc = classDef->GetProperties (); // discover geometric property name. Use the first one if there are many. for (idx = 0; idx < propdsc->GetCount(); idx ++) { FdoPtr<FdoPropertyDefinition> prop; prop = propdsc->GetItem(idx); if (prop->GetPropertyType () == FdoPropertyType_GeometricProperty) { name = prop->GetName (); return true; } } } return false; }