当前位置: 首页>>代码示例>>C++>>正文


C++ Site::children方法代码示例

本文整理汇总了C++中Site::children方法的典型用法代码示例。如果您正苦于以下问题:C++ Site::children方法的具体用法?C++ Site::children怎么用?C++ Site::children使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Site的用法示例。


在下文中一共展示了Site::children方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: skyTemperature

TEST_F(ModelFixture, SkyTemperature_Hierarchy)
{
  Model model;

  SkyTemperature skyTemperature(model);
  // default parent is Site, but not made by parent()
  OptionalParentObject opo = skyTemperature.parent();
  EXPECT_FALSE(opo);
  // construct Site
  Site site = model.getUniqueModelObject<Site>();
  opo = skyTemperature.parent();
  ASSERT_TRUE(opo);
  ParentObject skyTempParent = *opo;
  EXPECT_TRUE(skyTempParent == site);

  // Make skyTemperature apply to a RunPeriod
  RunPeriod runPeriod = model.getUniqueModelObject<RunPeriod>();
  EXPECT_TRUE(skyTemperature.setParent(runPeriod));
  opo = skyTemperature.parent();
  ASSERT_TRUE(opo);
  skyTempParent = *opo;
  EXPECT_TRUE(skyTempParent == runPeriod);
  EXPECT_EQ(static_cast<unsigned>(0),site.children().size());

  SkyTemperature globalSkyTemperature(model);
  opo = globalSkyTemperature.parent();
  ASSERT_TRUE(opo);
  ParentObject globalSkyTempParent = *opo;
  EXPECT_TRUE(globalSkyTempParent == site);
  EXPECT_EQ(static_cast<unsigned>(1),site.children().size());
  EXPECT_EQ(static_cast<unsigned>(1),runPeriod.children().size());
  EXPECT_EQ(static_cast<unsigned>(4),model.numObjects());

  // skyTemperature can also be parented by SizingPeriod objects
  DesignDay designDay(model);
  EXPECT_TRUE(skyTemperature.setParent(designDay));
  WeatherFileDays weatherFileDays(model);
  EXPECT_TRUE(skyTemperature.setParent(weatherFileDays));
  WeatherFileConditionType weatherFileConditionType(model);
  EXPECT_TRUE(skyTemperature.setParent(weatherFileConditionType));
}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:41,代码来源:SkyTemperature_GTest.cpp

示例2: group

TEST_F(ModelFixture, ShadingSurfaceGroup_Site_Hierarchy)
{
  Model model;

  // make a site
  Site site = model.getUniqueModelObject<Site>();

  // add a shading surface group
  ShadingSurfaceGroup group(model);
  EXPECT_TRUE(group.setShadingSurfaceType("Site"));

  // make a new shading surface
  Point3dVector points;
  points.push_back(Point3d(0, 2, 0));
  points.push_back(Point3d(0, 0, 0));
  points.push_back(Point3d(1, 0, 0));
  ShadingSurface surface(points, model);
  EXPECT_TRUE(surface.setShadingSurfaceGroup(group));
  ASSERT_TRUE(surface.shadingSurfaceGroup());
  EXPECT_EQ(group.handle(), surface.shadingSurfaceGroup()->handle());

  // check children from group
  ASSERT_EQ(static_cast<unsigned>(1), group.children().size());
  EXPECT_EQ(surface.handle(), group.children()[0].handle());

  // now check children from site
  ASSERT_EQ(static_cast<unsigned>(1), site.children().size());
  EXPECT_EQ(group.handle(), site.children()[0].handle());

  // check parent from group
  ASSERT_TRUE(group.parent());
  EXPECT_EQ(site.handle(), group.parent()->handle());

  // check parent from surface
  ASSERT_TRUE(surface.parent());
  EXPECT_EQ(group.handle(), surface.parent()->handle());
}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:37,代码来源:ShadingSurfaceGroup_GTest.cpp


注:本文中的Site::children方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。