[Smtk-developers] View (Continued)

David Thompson david.thompson at kitware.com
Fri Apr 24 02:55:44 EDT 2015


Hi Bob,

I agree with Rob... if the Components are not ever going to be subclassed, they should be stored by value.

Also, for your C++ construction example, I would consider changing the API a little to make it easier to construct views manually:

int main()
{
View sview =
  View("SimpleExpression", "Functions")
    .setContents("PolyLinearFunction");

View aview =
  View("Attribute", "BoundaryConditions")
    .setAttribute("ModelEntityFilter", "f")
    .addChildren(
      "SpecifiedHead", "SpecifiedFlux", FlowInjectionWell",
      "METData", "GroundSurfaceHeatFlux", "UseMETData",
      "RayCaster", BottomBoundaryTemp");

View iview =
  View("Instanced", "Time")
    .setAttribute("Type", "Time")
    .setContents("Time")
    .addChild("Instance");

View rview =
  View("Root", "SimBuilder");
rview.addChild("DefaultColor").setContents("1., 1., 0.5, 1.");
rview.addChild("InvalidColor").setContents("1., 0.5, 0.5, 1.");
rview.addChildren("Views", "Functions", "BoundaryConditions", "Time");
}

and programmatically

int main()
{
View sview = // ... same as above ...

std::vector<std::string> childNames; 
View aview =
  View("Attribute", "BoundaryConditions")
    .setAttribute("ModelEntityFilter", "f")
    .addChildren(childNames);

// ...

View rview = View("Root", "SimBuilder");
rview.addChild("DefaultColor").append() << 1. << 1. << 0.5 << 1.;
rview.addChild("InvalidColor").append() << 1. << 0.5 << 0.5 << 1.;
rview.addChildren("Views", "Functions", "BoundaryConditions", "Time");
}


More information about the Smtk-developers mailing list