Changes between Version 12 and Version 13 of FDORfc60


Ignore:
Timestamp:
Apr 13, 2011, 8:57:11 AM (13 years ago)
Author:
gregboone
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FDORfc60

    v12 v13  
    191191Through such an organization of Annotation properties into !FdoAnnotationPropertyDefinition and !FdoAnnotationTextElementClass types, multiple Annotation definitions can then be created and added to a single feature class definition, each named uniquely and pointing to a distinct !TextElement class.
    192192
     193===== Enhanced FDO Class and Property Types =====
     194
     195In order for the !AnnotationTextElement class type to be recognizable when reading an FDO schema, the FDO API Class Type enumeration will be extended to include an enumeration value for type !AnnotationTextElementClass. 
     196
     197
     198{{{
     199enum FdoClassType
     200{
     201    FdoClassType_Class,
     202    FdoClassType_FeatureClass,
     203    ...
     204    ...
     205    FdoClassType_AnnotationTextElementClass
     206};
     207}}}
     208
     209This enumerated value will be returned by the implementation of
     210       
     211
     212{{{
     213FdoClassType FdoAnnotationTextElementClass::GetClassType();
     214}}}
     215
     216In order for the !AnnotationPropertyDefinition type to be recognizable when reading an FDO schema, the FDO API Property Type enumeration will be extended to include an enumeration value for type !AnnotationPropertyDefinition. 
     217
     218
     219{{{
     220enum FdoPropertyType
     221{
     222    FdoPropertyType_DataProperty,
     223    FdoPropertyType_ObjectProperty,
     224    FdoPropertyType_GeometricProperty,
     225    FdoPropertyType_AssociationProperty,
     226    FdoPropertyType_RasterProperty,
     227    FdoPropertyType_AnnotationProperty
     228};
     229}}}
     230
     231This enumerated value will be returned by the implementation of
     232       
     233
     234{{{
     235FdoPropertyType FdoAnnotationPropertyDefinition::GetPropertyType();
     236}}}
     237
     238==== FDO Logical Schema to Physical Schema ====
     239
     240Using the same FDO classes and physical schema elements introduced in the above sections, here is an FDO code example on how an !ApplySchema Command would be executed to create a physical schema from an FDO logical schema.
     241
     242
     243{{{
     244// Create the schema
     245FdoFeatureSchemaP schema = FdoFeatureSchema::Create(L"Default", L"");
     246FdoClassCollectionP classes = schema->GetClasses();
     247
     248// Create the RoadAnnotation TextElements Class
     249FdoAnnotationTextElementClassP txtElementClassDef =
     250    FdoAnnotationTextElementClass::Create(L"RoadAnnotation", L"");
     251FdoPropertyDefinitionCollectionP txtElementProps =
     252    txtElementClassDef->GetProperties();
     253FdoDataPropertyDefinitionCollectionP txtElementIdProps =
     254    txtElementClassDef->GetIdentityProperties();;
     255
     256// Create a ParentId property to hold the parent ID that owns the text element
     257FdoDataPropertyDefinitionP dataProp =
     258    FdoDataPropertyDefinition::Create(L"ParentId", L"");
     259dataProp->SetDataType(FdoDataType_Int32);
     260dataProp->SetNullable(false);
     261dataProp->SetReadOnly(false);
     262dataProp->SetIsAutoGenerated(false);
     263
     264// The ParentId property is a class ID property
     265txtElementProps->Add(dataProp);
     266txtElementIdProps->Add(dataProp);
     267
     268// Explicitly set the ParentId property
     269txtElementClassDef->SetParentIdentityProperty(dataProp);
     270
     271// Create a ParentId property so that Text Elements can be ordered
     272dataProp = FdoDataPropertyDefinition::Create(L"SequenceId", L"");
     273dataProp->SetDataType(FdoDataType_Int32);
     274dataProp->SetNullable(false);
     275dataProp->SetReadOnly(false);
     276dataProp->SetIsAutoGenerated(false);
     277
     278// The SequenceId property is a class ID property
     279txtElementProps->Add(dataProp);
     280txtElementIdProps->Add(dataProp);
     281
     282// Explicitly set the SequenceId property
     283txtElementClassDef->SetSequenceProperty(dataProp);
     284
     285// Create a string data property that will hold the Text Element Value
     286dataProp = FdoDataPropertyDefinition::Create(L"TextValue", L"");
     287dataProp->SetDataType(FdoDataType_String);
     288props->Add(dataProp);
     289
     290// Explicitly set the Text Element Value property
     291txtElementClassDef->SetTextValueProperty(geoProp);
     292
     293// Create a string data property that will hold the Text Element Attributes
     294dataProp = FdoDataPropertyDefinition::Create(L"TextAttributes", L"");
     295dataProp->SetDataType(FdoDataType_String);
     296props->Add(dataProp);
     297
     298// Explicitly set the Text Element Attributes property
     299txtElementClassDef->SetTextAttributesProperty(geoProp);
     300
     301// Create a Geometry Location property for the Text Element
     302FdoGeometricPropertyDefinitionP geoProp =
     303FdoGeometricPropertyDefinition::Create(L"Location", L"");
     304geoProp->SetSpatialContextAssociation(L"EPSG:4326");
     305geoProp->SetGeometryTypes((int)(FdoGeometryType_Point)); // Point
     306props->Add(geoProp);
     307
     308// Explicitly set the Geometry Location property
     309txtElementClassDef->SetGeometryProperty(geoProp);
     310
     311// Create a Geometry LeaderLine property for the Text Element
     312geoProp = FdoGeometricPropertyDefinition::Create(L"LeaderLine", L"");
     313geoProp->SetSpatialContextAssociation(L"EPSG:4326");
     314geoProp->SetGeometryTypes((int)(FdoGeometryType_MultiCurveString));
     315props->Add(geoProp);
     316
     317// Explicitly set the Geometry LeaderLine property
     318txtElementClassDef->SetLeaderLineProperty(geoProp);
     319
     320// Add the class to the schema
     321classes->Add(txtElementClassDef);
     322
     323// Create the Read class
     324FdoFeatureClassP classDef = FdoFeatureClass::Create(L"Road", L"");
     325FdoPropertyDefinitionCollectionP props = classDef->GetProperties();
     326FdoDataPropertyDefinitionCollectionP idProps = classDef->GetIdentityProperties();;
     327
     328// Create an Annotation property to allow reference to the TextElements
     329FdoAnnotationPropertyDefinitionP annotationProp =
     330    FdoAnnotationPropertyDefinition::Create(L"Annotation", L"");
     331props->Add(annotationProp);
     332
     333// Create a Road Identity property
     334dataProp = FdoDataPropertyDefinition::Create(L"FeatId", L"");
     335dataProp->SetDataType(FdoDataType_Int32);
     336dataProp->SetNullable(false);
     337dataProp->SetReadOnly(false);
     338dataProp->SetIsAutoGenerated(true);
     339
     340// The FeatId property is an ID property
     341props->Add(dataProp);
     342idProps->Add(dataProp);
     343
     344// Set the annotation identity property
     345annotationProp->SetIdentityProperty(dataProp);
     346
     347// Create a Name property
     348dataProp = FdoDataPropertyDefinition::Create(L"Name", L"");
     349dataProp->SetDataType(FdoDataType_String);
     350props->Add(dataProp);
     351
     352// Create a Width property
     353dataProp = FdoDataPropertyDefinition::Create(L"Width", L"");
     354dataProp->SetDataType(FdoDataType_Double);
     355props->Add(dataProp);
     356
     357// Create a Geometry to contain the Road location
     358geoProp = FdoGeometricPropertyDefinition::Create(L"Location", L"");
     359geoProp->SetSpatialContextAssociation(L"EPSG:4326");
     360geoProp->SetGeometryTypes((int)(FdoGeometryType_CurveString)); // CurveString
     361props->Add(geoProp);
     362
     363// Set the geometry property for the class
     364classDef->SetGeometryProperty(geoProp);
     365
     366// Create a Geometry Envelope to contain the TextElements extents
     367geoProp = FdoGeometricPropertyDefinition::Create(L"TextEnvelope", L"");
     368geoProp->SetSpatialContextAssociation(L"EPSG:4326");
     369geoProp->SetGeometryTypes((int)(FdoGeometryType_CurveString)); // CurveString
     370props->Add(geoProp);
     371
     372// Set the annotation envelope property
     373annotationProp->SetTextEnvelopeProperty(geoProp);
     374
     375// Create a string data property that will hold the default TextElement Value
     376dataProp = FdoDataPropertyDefinition::Create(L"TextDefaultValue", L"");
     377dataProp->SetDataType(FdoDataType_String);
     378props->Add(dataProp);
     379
     380// Explicitly set the Text Element Value property
     381annotationProp->SetDefaultTextValueProperty(dataProp);
     382
     383// Create a string data property that will hold the default TextElement Attributes
     384dataProp = FdoDataPropertyDefinition::Create(L"TextDefaultAttributes", L"");
     385dataProp->SetDataType(FdoDataType_String);
     386props->Add(dataProp);
     387
     388// Explicitly set the Text Element Attributes property
     389annotationProp->SetDefaultTextAttributesProperty(dataProp);
     390
     391// Add the class to the schema
     392classes->Add(classDef);
     393
     394// Execute ApplySchema to create the schema
     395FdoIApplySchemaP applyschema =
     396    (FdoIApplySchema*)(connection->CreateCommand(FdoCommandType_ApplySchema));
     397applyschema->SetIgnoreStates(true);
     398applyschema->SetFeatureSchema(schema);
     399applyschema->Execute();
     400}}}
     401
     402
     403
    193404== Implications ==
    194405