Databrowser do not show properties all though they are defined in the FeatureClass definition cache

I have got a problem that at least did not exist in BentleyMap SS2. I have veryfied that it exist in Bentley Map SS3 built 95 and sadly enough also in the new service release with built no 107.

In short:

I have a small Mvba app that defines a new featureclass OisPunkt with a number of properties. Then I create a number of these features and I can check that they are created with the properties. BUT when I start the databrowser it will not accept the feature Class defintion and show only the feature instance without properties.

Documentation:

FeatureClasse definition

:

Mvba code creating and verifying the feature class definitions:

CreateFeatureClass and AddPropertyToFeatureClasse are both functions in a MDL DLL 

Public Sub StartOisClient(ByVal feltliste As String)

Set OISclient = CreateObject("OISlib.OISclient")
If OISclient.SetLogon(OISUSER, OISPWD) = False Then
'ved at spørge på paramtren sættes den
End If


If modX34featdef.TjekFeatDef("OisPunkt") = False Then
CreateFeatureClass StrPtr("OisPunkt"), XFMFEATUREGISTYPE_PointLine
End If

If modX34featdef.TjekFeatAttribDef("OisPunkt", "MATR_NR") = False Then
AddPropertyToFeatureClass StrPtr("OisPunkt"), StrPtr("MATR_NR"), XFM_DATATYPE_STRING, 10
AddPropertyToFeatureClass StrPtr("OisPunkt"), StrPtr("EJERLAV"), XFM_DATATYPE_STRING, 80
End If

Dim Felt As Variant
Dim strFelt As String

For Each Felt In Split(felt_liste, ",")
strFelt = Felt
If modX34featdef.TjekFeatAttribDef("OisPunkt", strFelt) = False Then
AddPropertyToFeatureClass StrPtr("OisPunkt"), StrPtr(strFelt), XFM_DATATYPE_STRING, 80
End If
Next

modX34featdef.DumpFeatureDefinitionProperties "OisPunkt"

End Sub
Here comes the code for DumpFeatureDefinitionProperties:
Public Sub DumpFeatureDefinitionProperties(FeatureName As String)
Debug.Print "--------"

Dim message As String

Dim oFeatureDef As FeatureDef
On Error GoTo ***
Set oFeatureDef = xft.FeatureMgr.GetFeatureDefinition(FeatureName)

Dim strGeomType As String

Select Case oFeatureDef.GeometryType
Case 0: strGeomType = "UNKNOWN"
Case 1: strGeomType = "LINE STRING or CURVE"
Case 2: strGeomType = "POLYGON"
Case 3: strGeomType = "POINT"
Case 4: strGeomType = "TEXT"
End Select


message = "FeatureClass: " & oFeatureDef.Name & ", " & strGeomType
dmsgPrint StrPtr(message)

Dim numProperties As Long
numProperties = oFeatureDef.PropertyCount

Dim propertyIndex As Long
For propertyIndex = 0 To (numProperties - 1)
Dim oPropertyDef As PropertyDef
Set oPropertyDef = oFeatureDef.GetPropertyDefinition(propertyIndex)

message = " " & oPropertyDef.Name & ", " & oPropertyDef.TypeName
dmsgPrint StrPtr(message)
'Debug.Print oPropertyDef.Name, oPropertyDef.TypeName
Next
***:
End Sub

Here comes a Analyze Feature of one of the newly created features:

And last the Databrowser:


What has happen since version SS2 since the Databrowser (and the Edit feature function as well) no longer uses the feature Class definition cache
If I close Bentley map and open with the same designfile the Dynamic Feature Scoring findes the properties (offcause)

Erik Wirring
LE34
Parents
  • Futher investigation has shown that this problem do not occur in fesh design files where the feature "OisPunkt" has not existed before.

    However if the feature "OisPunkt" had been registred by DFS, it seems like it was not posible to change the property definition for this feature. (adding more properties)

    Unfortunally I am not able to dump the entire FeatureClasse definition cache, so I am not able to see if there some how was defined more than one instance of "OisPunkt"  [ See: communities.bentley.com/.../82936.aspx]

    Erik

  • Some more observations to this mystery:

    1. Disabling DynamicFeatureScoring (DFS) makes no other change in the behavior!
    2. Removing all instance of a featureClass removes the definition of that featureClass from the FeatureClass Definition Cache !!! From this point and forward DataBrowser, EditFeature etc. does not see any definition of that featureClasse even though the featureClasse has been redefined in the FeatureClass Definition Cache. It is not only the XFT object that indicate that the featuredefinition is removed from the featureClassDefinition Cache the functions in the MDL API reports the same behavior.
  • Regarding observation 2, your dynamic feature class is removed from the session's feature class list when the last instance of the class is removed from the session.   To keep the class in the session, you can call: xfmFeatureDef_setKeepInSession (featureDef, TRUE)

    ...when you are creating the class.  This function is in xfmCore.lib and is not currently documented or in a FDF file so include the definition in your source:

    StatusInt xfmFeatureDef_setKeepInSession(XfmFeatureDefP  featureDef,BoolInt         keepInSession);

    We will need to document this function for the next release.

    BTW, To show/dump the definition of a feature class to the MicroStation text window, you can use the keyin: mdl command dumpfeaturedefbyname OisPunkt

    Can you provide a dgn with the OisPunkt where on file open DataBrowser shows no properties?  I would have expected DFS to see at least your properties in the instance data.

    When is your application first loaded to add your feature class?

    Regards,

    Chris


    This is a test

  • Hi Chris

    Thanks. I will include XfmFeatureDef_setKeepInSession into my MDL dll. That will solve most of the problem complex.

    But.

    I will not be able to provide a dgn with OisPunkt where on file open Databrowser shows no properties, because as I earlier wrote the DFS will create a correct  feature definition of oisPunkt correct. at opening. However! if all instance of OisPunkt is deleted and some new are created DFS do not create a correct feature definition, may be due to the fact that the layer "OisPunkt" exists? So here there are still a problem since the DFS created featureClass definition is removed with the last instance of OisPunkt, and re-creation of featureClasse definition are not 'accepted' by Databrowser

    The application that create features OisPunkt starts with checking whether OisPunkt featureClasse is defined correct, if not it will create the featureClass definition and/or adding properties definitions. The application is loaded on user request for creating the feature OisPunkt that contains up-to-date information about the owner of the parcel retrieved over the Net. OisPunkt is placed in the centroid of the parcel

Reply
  • Hi Chris

    Thanks. I will include XfmFeatureDef_setKeepInSession into my MDL dll. That will solve most of the problem complex.

    But.

    I will not be able to provide a dgn with OisPunkt where on file open Databrowser shows no properties, because as I earlier wrote the DFS will create a correct  feature definition of oisPunkt correct. at opening. However! if all instance of OisPunkt is deleted and some new are created DFS do not create a correct feature definition, may be due to the fact that the layer "OisPunkt" exists? So here there are still a problem since the DFS created featureClass definition is removed with the last instance of OisPunkt, and re-creation of featureClasse definition are not 'accepted' by Databrowser

    The application that create features OisPunkt starts with checking whether OisPunkt featureClasse is defined correct, if not it will create the featureClass definition and/or adding properties definitions. The application is loaded on user request for creating the feature OisPunkt that contains up-to-date information about the owner of the parcel retrieved over the Net. OisPunkt is placed in the centroid of the parcel

Children
  • Hi Erik,

    Regarding the DFS created feature definition, you might consider setting up a design application to load after Map/XFM(Map MS_DGNAPPS loads XFM) so you can set the DFS generated feature definition to stay in the session.   xfmFeatureDef_create will tell you if the definition currently exists in the session.

    Regards,

    Chris


    This is a test

  • Hi Chris

    I did some more testing and the result is rather surprising, and it indicates that your suggestion propably  will not work .-(

    I took my test file, removed all instance of OisPunkt but left the layser "Oispunkt" empty. Then closed the BMap session, and restarted BMap with my test file.

    just after startop I used the "Mdl command dumpfeaturedefbyname OisPunkt". Here I could see that DFS had not created any featuredefinition on the existens of the layer "OisPunkt". Then I ran by application which create the feature definition and a number of instances of the feature OisPunkt. Tested that the featuredefinition was okay. and last loaded DataBrowser which refused to show the properties.

    Next test I just placed a simple line on the layer "OisPunkt" so it was not completly empty. Closed and reopened BMap.

    First test with  "Mdl command dumpfeaturedefbyname OisPunkt" shows that DFS now has created a featuredefinition:

    command dumpfeaturedefbyname: FeatureDef (0x16247a8) Name [OisPunkt] Path [] Key=266 RefCnt=4
    command dumpfeaturedefbyname: Description [(null)] CategoryName [] GISTypeName [linestring/curve]
    command dumpfeaturedefbyname: IsCollection=FALSE
    command dumpfeaturedefbyname: NumSubFeatures=0
    command dumpfeaturedefbyname: NumProperties=1 NumDgnProperties=0
    command dumpfeaturedefbyname: Owner: ApplicationId=22564, ApplicationType=14
    command dumpfeaturedefbyname: PropertyDef (0x2092ef38) Name[Geometry
    _Length] DisplayName[Geometry_Length] FullName[Geometry_Length] TypeName[DOUBLE]
    TypeId=4 MaxSize=0 External=Y ReadOnly=Y RefCnt=4
    command dumpfeaturedefbyname: QueryNodeList size=0
    command dumpfeaturedefbyname: InsertNodeList size=0
    command dumpfeaturedefbyname: CopyNodeList size=0
    command dumpfeaturedefbyname: UpdateNodeList size=0
    command dumpfeaturedefbyname: DeleteNodeList size=0
    command dumpfeaturedefbyname: DBLinkNodeList size=0
    command dumpfeaturedefbyname: QueryCList size=0
    command dumpfeaturedefbyname: InsertCList size=0
    command dumpfeaturedefbyname: CopyCList size=0
    command dumpfeaturedefbyname: UpdateCList size=0
    command dumpfeaturedefbyname: DeleteCList size=0
    command dumpfeaturedefbyname: DBLinkCList size=0
    Then I started my application which now updates the featuredefinition instead of creating a new featuredefinition along with creating the 
    instances of the feature "OisPunkt". Now the featuredefition looks like this (which is exactly the same as in the first test!):
    command dumpfeaturedefbyname: FeatureDef (0x16247a8) Name [OisPunkt] Path [] Key=266 RefCnt=10
    command dumpfeaturedefbyname: Description [(null)] CategoryName [] GISTypeName [linestring/curve]
    command dumpfeaturedefbyname: IsCollection=FALSE
    command dumpfeaturedefbyname: NumSubFeatures=0
    command dumpfeaturedefbyname: NumProperties=7 NumDgnProperties=6
    command dumpfeaturedefbyname: Owner: ApplicationId=22564, ApplicationType=14
    command dumpfeaturedefbyname: PropertyDef (0x2092ef38) Name[Geometry_Length] DisplayName[Geometry_Length] FullName[Geometry_Length] TypeName[DOUBLE]
    TypeId=4 MaxSize=0 External=Y ReadOnly=Y RefCnt=4
    command dumpfeaturedefbyname: PropertyDef (0x198b0e78) Name[MATR_NR]
    DisplayName[MATR_NR] FullName[MATR_NR] TypeName[STRING] TypeId=1 MaxSize=10 External=N ReadOnly=N RefCnt=2
    command dumpfeaturedefbyname: PropertyDef (0x20bb9a90) Name[EJERLAV]
    DisplayName[EJERLAV] FullName[EJERLAV] TypeName[STRING] TypeId=1 MaxSize=80 External=N ReadOnly=N RefCnt=2
    command dumpfeaturedefbyname: PropertyDef (0x20bb9b98) Name[EJER_NAVN] DisplayName[EJER_NAVN] FullName[EJER_NAVN] TypeName[STRING] TypeId=1 MaxSize=
    80 External=N ReadOnly=N RefCnt=2
    command dumpfeaturedefbyname: PropertyDef (0x20bb9ca0) Name[EJER_ADR
    ] DisplayName[EJER_ADR] FullName[EJER_ADR] TypeName[STRING] TypeId=1 MaxSize=80
    External=N ReadOnly=N RefCnt=2
    command dumpfeaturedefbyname: PropertyDef (0x20bb9da8) Name[EJER_UDV_ADR] DisplayName[EJER_UDV_ADR] FullName[EJER_UDV_ADR] TypeName[STRING] TypeId=1
    MaxSize=80 External=N ReadOnly=N RefCnt=2
    command dumpfeaturedefbyname: PropertyDef (0x20bb9eb0) Name[EJER_POSTADR] DisplayName[EJER_POSTADR] FullName[EJER_POSTADR] TypeName[STRING] TypeId=1
    MaxSize=80 External=N ReadOnly=N RefCnt=2
    command dumpfeaturedefbyname: QueryNodeList size=0
    command dumpfeaturedefbyname: InsertNodeList size=0
    command dumpfeaturedefbyname: CopyNodeList size=0
    command dumpfeaturedefbyname: UpdateNodeList size=0
    command dumpfeaturedefbyname: DeleteNodeList size=0
    command dumpfeaturedefbyname: DBLinkNodeList size=0
    command dumpfeaturedefbyname: QueryCList size=0
    command dumpfeaturedefbyname: InsertCList size=0
    command dumpfeaturedefbyname: CopyCList size=0
    command dumpfeaturedefbyname: UpdateCList size=0
    command dumpfeaturedefbyname: DeleteCList size=0
    command dumpfeaturedefbyname: DBLinkCList size=0
    And NOW dataBrowser shows all the properties as it should.!
    So is it possible to conclude any thing from this ?
    Erik Wirring
  • Hi Erik,

    I am not able to reproduce results like you mention here:

    "I took my test file, removed all instance of OisPunkt but left the layser "Oispunkt" empty. Then closed the BMap session, and restarted BMap with my test file.just after startop I used the "Mdl command dumpfeaturedefbyname OisPunkt". Here I could see that DFS had not created any featuredefinition on the existens of the layer "OisPunkt". Then I ran by application which create the feature definition and a number of instances of the feature OisPunkt. Tested that the featuredefinition was okay. and last loaded DataBrowser which refused to show the properties."

    I am using Map Enterprise 8.11.9.107 in the msgeo user using the gasmain mdl example.  My observations match until your last sentence above.  In my case, I do see my feature properties as expected.  This is strange.  I cannot figure out what is different between my scenario and yours.

    What Map product and version are you using?  Can you send your dgn with a few of your instances so that I can try your scenario starting from the step to delete the instances in the file?  Can you send the code snippet that creates the feature definition?

    Regards,

    Chris


    This is a test

  • Hi Chris,

    I am using Bentley Map Standalone 8.9.11.107 with no XFM schema at all (That the way we work :-)) May be that is the 'big' difference.

    I have attach my test designfile. I have include 49 instances of the Feature "OisPunkt".

    The codesnippets I mail directly to you it consist of 3 vba files showing how the OisPunkt app. works and a C file containing all the code that does the actual On-The-Fly feature definition.

    Hope it all will help you to be able to reproduce our problem. if not maybe we could make a "TeamView" session or another kind of online session to show you what happens

    Regards

    Erik

    Detai-008-3d-.dgn
  • I replied to Erik directly but will add notes here for completeness.

    I was able to reproduce the “feature class in databrowser without any properties” problem with these steps.

    1. Start Map & Open test file containing no OisPunkt instances.  Only the OisPunkt level exists

    2. Load All into DataBrowser.  OisPunkt tab is not created since no OisPunkt instances exist in the file

    3. Load application that creates OisPunkt class and create a feature instance of this class. I mimicked your feature class creation in my C code.

    4. Load All into Databrowser.  OisPunkt is tab is created and loaded but shows NO properties

    By running step 2, the Databrowser was loaded and became a listener to the feature class added event.  In step 3, the class is added (with the call to xfmFeatureDefMgr_addRootFeatureDefToList) and Databrowser updates its schema to add the new OisPunkt class.  The properties are not shown in Databrowser since at the time of the xfmFeatureDefMgr_addRootFeatureDefToList call the OisPunkt XfmFeatureDef did not yet contain the properties.  By changing the application code to fully specify the feature definition before calling xfmFeatureDefMgr_addRootFeatureDefToList, the properties were shown in Databrowser.

    We also discussed the use of xfmFeatureDefMgr_startBulkFeatureDefChanges and xfmFeatureDefMgr_stopBulkFeatureDefChanges before and after a session of featuredefinition to help with this problem.  But the Databrowser feature class added listener does not take into account if in a bulk feature def changes mode when updating its schema.   One area of Map that I can think that takes bulk mode into account is the listener that updates the XFM Command Manager dialog box when classes are added & removed….when in bulk mode, this listener will wait to update the dialog once at the end of bulk mode instead of updating the dialog for each feature class event.  This would be important for you if you are adding methods and command manager entries for your dynamic classes (see xfmDialogMgr_addMethodToCommandManagerDomainList).


    This is a test