[CONNECT C++] IDgnECTypeAdapter::GetStandardValues

IDgnECTypeAdapter::GetStandardValues fills a StandardValuesCollection from the MstnPropertyFormatter schema.  Here's a fragment of XML...

<StandardValues xmlns="EditorCustomAttributes.01.00">
  <ValueMap>
    <ValueMap>
      <Value>-1</Value>
      <DisplayString>(Use Active Master Units)</DisplayString>
    </ValueMap>
    ... 16 more
  </ValueMap>
</StandardValues>

But StandardValuesCollection is a bvector of WString.  What it gets is a list of DisplayStrings. It ignores the integer Value element.

Are the integer Value elements relevant, and if so how do I obtain them?

Parents
  • Unknown said:
    What are you trying to accomplish?

    Following your previous hints, I'm exploring how to get a custom display string from a standard element property.  For example, a closed element seems to belong to an EC AreaClass in the MstnPropertyFormatter schema. ECProperty Units has a list of StandardValues including Use Active Master Units, Acres and others.  How do I obtain a string that measures a closed element in, say, Acres?

    I find it rather easy to become lost in the forest of DgnECTypeAdapter, ECEnabler, DgnECInstance, DgnECTypeAdapterContext and ECProperty.

     
    Regards, Jon Summers
    LA Solutions

  • MstnPropertyFormatter:AreaClass has nothing to do with closed elements. That schema is all about formatting property values.
    Closed elements are represented by subclasses of BaseElementSchema:MstnClosedBoundary.

    Create an ECInstance of AreaClass, set its Units property to -3, and pass it to TextField (or to IDgnECTypeAdapter, if you're doing your own formatting).
  • Unknown said:
    Create an ECInstance of AreaClass

    I'm stumped.  I think that I need a DgnECInstanceEnabler in order to create an ECInstance.  Here's what I have so far...

    if (TextPropertyManager::GetMstnPropertyFormatterSchema (formatSchema)) // help function
    {
      ECN::ECClassCP  formatClass	= formatSchema->GetClassCP (L"AreaClass");
      //trace: got EC Class 'AreaClass' Display Label 'Closed Elements'
      const bool&     IncludeBaseClasses	{ true };
      ECPropertyP     prop	= formatClass->GetPropertyP (L"Units", IncludeBaseClasses);
      //trace: Schema 'MstnPropertyFormatter' Class 'AreaClass' has property 'Units'
      DgnECManagerR   manager		= Bentley::DgnPlatform::DgnECManager::GetManager();
      DgnECInstanceEnablerP formatEnabler = manager.ObtainInstanceEnabler  (*formatClass, *GetActiveDgnFile ());
      // formatEnable == nullptr
    }

    What have I missed?

     
    Regards, Jon Summers
    LA Solutions

Reply
  • Unknown said:
    Create an ECInstance of AreaClass

    I'm stumped.  I think that I need a DgnECInstanceEnabler in order to create an ECInstance.  Here's what I have so far...

    if (TextPropertyManager::GetMstnPropertyFormatterSchema (formatSchema)) // help function
    {
      ECN::ECClassCP  formatClass	= formatSchema->GetClassCP (L"AreaClass");
      //trace: got EC Class 'AreaClass' Display Label 'Closed Elements'
      const bool&     IncludeBaseClasses	{ true };
      ECPropertyP     prop	= formatClass->GetPropertyP (L"Units", IncludeBaseClasses);
      //trace: Schema 'MstnPropertyFormatter' Class 'AreaClass' has property 'Units'
      DgnECManagerR   manager		= Bentley::DgnPlatform::DgnECManager::GetManager();
      DgnECInstanceEnablerP formatEnabler = manager.ObtainInstanceEnabler  (*formatClass, *GetActiveDgnFile ());
      // formatEnable == nullptr
    }

    What have I missed?

     
    Regards, Jon Summers
    LA Solutions

Children