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


C# CelestialBody.is_root方法代码示例

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


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

示例1: Name

 public static String Name(FrameType type, CelestialBody selected) {
  switch (type) {
    case FrameType.BODY_CENTRED_NON_ROTATING:
      return selected.name + "-Centred Inertial";
    case FrameType.BARYCENTRIC_ROTATING:
       if (selected.is_root()) {
         throw Log.Fatal("Naming barycentric rotating frame of root body");
       } else {
         return selected.referenceBody.name + "-" + selected.name +
                " Barycentric";
       }
    case FrameType.BODY_CENTRED_PARENT_DIRECTION:
       if (selected.is_root()) {
         throw Log.Fatal(
             "Naming parent-direction rotating frame of root body");
       } else {
         // TODO(egg): find a proper name...
         return selected.name + "-Centred " + selected.referenceBody.name +
                "-Fixed";
       }
    case FrameType.BODY_SURFACE:
      return selected.name + "-Centred " + selected.name + "-Fixed";
    default:
      throw Log.Fatal("Unexpected type " + type.ToString());
  }
 }
开发者ID:pleroy,项目名称:Principia,代码行数:26,代码来源:reference_frame_selector.cs

示例2: Name

 public static String Name(FrameType type, CelestialBody selected) {
  switch (type) {
    case FrameType.BODY_CENTRED_NON_ROTATING:
      return selected.name + "-Centred Inertial";
    case FrameType.BARYCENTRIC_ROTATING:
       if (selected.is_root()) {
         throw Log.Fatal("Naming barycentric rotating frame of root body");
       } else {
         return selected.referenceBody.name + "-" + selected.name +
                " Barycentric";
       }
    default:
      throw Log.Fatal("Unexpected type " + type.ToString());
  }
 }
开发者ID:pdn4kd,项目名称:Principia,代码行数:15,代码来源:reference_frame_selector.cs

示例3: RenderSubtree

 private void RenderSubtree(CelestialBody celestial, int depth) {
   // Horizontal offset between a node and its children.
   const int offset = 20;
   UnityEngine.GUILayout.BeginHorizontal();
   if (!celestial.is_root()) {
     UnityEngine.GUILayout.Label(
         "",
         UnityEngine.GUILayout.Width(offset * (depth - 1)));
     string button_text;
     if (celestial.is_leaf()) {
       button_text = "";
     } else if (expanded_[celestial]) {
       button_text = "-";
     } else {
       button_text = "+";
     }
     if (UnityEngine.GUILayout.Button(button_text,
                                      UnityEngine.GUILayout.Width(offset))) {
       Shrink();
       expanded_[celestial] = !expanded_[celestial];
     }
   }
   if (UnityEngine.GUILayout.Toggle(selected_celestial_ == celestial,
                                    celestial.name)) {
     if (selected_celestial_ != celestial) {
       selected_celestial_ = celestial;
       on_change_(FrameParameters());
     }
   }
   UnityEngine.GUILayout.EndHorizontal();
   if (celestial.is_root() || (!celestial.is_leaf() && expanded_[celestial])) {
     foreach (CelestialBody child in celestial.orbitingBodies) {
       RenderSubtree(child, depth + 1);
     }
   }
 }
开发者ID:ThomasKerman,项目名称:Principia,代码行数:36,代码来源:reference_frame_selector.cs

示例4: Description

 public static String Description(FrameType type, CelestialBody selected) {
   switch (type) {
     case FrameType.BODY_CENTRED_NON_ROTATING:
       return "Non-rotating reference frame fixing the centre of " +
              selected.theName;
     case FrameType.BARYCENTRIC_ROTATING:
       if (selected.is_root()) {
         throw Log.Fatal("Describing barycentric rotating frame of root body");
       } else {
         return "Reference frame fixing the barycentre of " +
                selected.theName + " and " + selected.referenceBody.theName +
                ", the plane in which they move about the barycentre, and" +
                " the line between them";
       }
     default:
       throw Log.Fatal("Unexpected type " + type.ToString());
   }
 }
开发者ID:pdn4kd,项目名称:Principia,代码行数:18,代码来源:reference_frame_selector.cs

示例5: ShortName

 public static String ShortName(FrameType type, CelestialBody selected) {
   switch (type) {
     case FrameType.BODY_CENTRED_NON_ROTATING:
       return selected.name[0] + "CI";
     case FrameType.BARYCENTRIC_ROTATING:
       if (selected.is_root()) {
         throw Log.Fatal(
             "Naming parent-direction rotating frame of root body");
       } else {
         return selected.referenceBody.name[0] + (selected.name[0] + "B");
       }
     case FrameType.BODY_CENTRED_PARENT_DIRECTION:
       if (selected.is_root()) {
         throw Log.Fatal("Naming barycentric rotating frame of root body");
       } else {
         return selected.name[0] + "C" + selected.referenceBody.name[0] +
                "F";
       }
     case FrameType.BODY_SURFACE:
       return selected.name[0] + "C" + selected.name[0] + "F";
     default:
       throw Log.Fatal("Unexpected type " + type.ToString());
   }
 }
开发者ID:pleroy,项目名称:Principia,代码行数:24,代码来源:reference_frame_selector.cs


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