Exemple #1
0
 public virtual Boolean IsNodePropertyInherited(BooleanNodeProperty property)
 {
    return this.IsNodePropertyInherited(NodeProperties.ToProperty(property));
 }
Exemple #2
0
 public virtual Boolean GetNodeProperty(BooleanNodeProperty property)
 {
    return false;
 }
Exemple #3
0
 public virtual void SetNodeProperty(BooleanNodeProperty property, bool value) { }
Exemple #4
0
 /// <summary>
 /// Converts a BooleanNodeProperty to a NodeProperty.
 /// </summary>
 /// <param name="property">The BooleanNodeProperty to convert.</param>
 public static NodeProperty ToProperty(BooleanNodeProperty property)
 {
    return (NodeProperty)Enum.ToObject(typeof(NodeProperty), property);
 }
Exemple #5
0
 private static void SetLayerProperty(IILayer layer, BooleanNodeProperty property, Boolean value)
 {
    switch (property)
    {
       case BooleanNodeProperty.IsHidden:
          layer.IsHidden = value;
          break;
       case BooleanNodeProperty.IsFrozen:
          layer.IsFrozen = value;
          break;
       case BooleanNodeProperty.SeeThrough:
          layer.XRayMtl = value;
          break;
       case BooleanNodeProperty.BoxMode:
          layer.BoxMode = value;
          break;
       case BooleanNodeProperty.BackfaceCull:
          layer.BackCull = value;
          break;
       case BooleanNodeProperty.AllEdges:
          layer.AllEdges = value;
          break;
       case BooleanNodeProperty.VertexTicks:
          layer.VertTicks = value;
          break;
       case BooleanNodeProperty.Trajectory:
          layer.Trajectory(value, false);
          break;
       case BooleanNodeProperty.IgnoreExtents:
          layer.IgnoreExtents = value;
          break;
       case BooleanNodeProperty.FrozenInGray:
          layer.ShowFrozenWithMtl = value;
          break;
       case BooleanNodeProperty.Renderable:
          layer.Renderable = value;
          break;
       case BooleanNodeProperty.InheritVisibility:
          layer.InheritVisibility = value;
          break;
       case BooleanNodeProperty.PrimaryVisibility:
          layer.PrimaryVisibility = value;
          break;
       case BooleanNodeProperty.SecondaryVisibility:
          layer.SecondaryVisibility = value;
          break;
       case BooleanNodeProperty.ReceiveShadows:
          layer.RcvShadows = value;
          break;
       case BooleanNodeProperty.CastShadows:
          layer.CastShadows = value;
          break;
       case BooleanNodeProperty.ApplyAtmospherics:
          layer.ApplyAtmospherics = value;
          break;
       case BooleanNodeProperty.RenderOccluded:
          layer.RenderOccluded = value;
          break;
       default:
          break;
    }
 }
Exemple #6
0
      public override void SetNodeProperty(BooleanNodeProperty property, bool value)
      {
         XRefSceneFlags flags = 0;
         if (property == BooleanNodeProperty.IsHidden)
            flags = XRefSceneFlags.Hidden;
         else if (property == BooleanNodeProperty.BoxMode)
            flags = XRefSceneFlags.BoxMode;

         if (flags != 0)
         {
            if (value)
               this.SetFlags(flags);
            else
               this.RemoveFlags(flags);
         }
         else
         {
            base.SetNodeProperty(property, value);
         }
      }
Exemple #7
0
 public override void SetNodeProperty(BooleanNodeProperty property, bool value)
 {
    switch (property)
    {
       case BooleanNodeProperty.IsHidden:
          this.INode.Hide(value);
          break;
       case BooleanNodeProperty.IsFrozen:
          this.INode.IsFrozen = value;
          break;
       case BooleanNodeProperty.SeeThrough:
          this.INode.XRayMtl(value);
          break;
       case BooleanNodeProperty.BoxMode:
          this.INode.BoxMode(value);
          break;
       case BooleanNodeProperty.BackfaceCull:
          this.INode.BackCull(value);
          break;
       case BooleanNodeProperty.AllEdges:
          this.INode.AllEdges(value);
          break;
       case BooleanNodeProperty.VertexTicks:
          this.INode.VertTicks = BoolToInt(value);
          break;
       case BooleanNodeProperty.Trajectory:
          this.INode.SetTrajectoryON(value);
          break;
       case BooleanNodeProperty.IgnoreExtents:
          this.INode.IgnoreExtents(value);
          break;
       case BooleanNodeProperty.FrozenInGray:
          this.INode.SetShowFrozenWithMtl(value);
          break;
       case BooleanNodeProperty.Renderable:
          this.INode.SetRenderable(value);
          break;
       case BooleanNodeProperty.InheritVisibility:
          this.INode.InheritVisibility = value;
          break;
       case BooleanNodeProperty.PrimaryVisibility:
          this.INode.SetPrimaryVisibility(value);
          break;
       case BooleanNodeProperty.SecondaryVisibility:
          this.INode.SetSecondaryVisibility(value);
          break;
       case BooleanNodeProperty.ReceiveShadows:
          this.INode.SetRcvShadows(value);
          break;
       case BooleanNodeProperty.CastShadows:
          this.INode.SetCastShadows(value);
          break;
       case BooleanNodeProperty.ApplyAtmospherics:
          this.INode.SetApplyAtmospherics(value);
          break;
       case BooleanNodeProperty.RenderOccluded:
          this.INode.RenderOccluded = value;
          break;
       default:
          base.SetNodeProperty(property, value);
          break;
    }
 }
Exemple #8
0
 private static void setAppData(IAnimatable anim, BooleanNodeProperty sbid, byte[] data)
 {
    NestedLayers.setAppData(anim, PropertySbidOffset + (uint)sbid, data);
 }
Exemple #9
0
 private static void removeAppData(IAnimatable anim, BooleanNodeProperty sbid)
 {
    NestedLayers.removeAppData(anim, PropertySbidOffset + (uint)sbid);
 }
Exemple #10
0
   /// <summary>
   /// Tests if the given property on the given layer is inherited from a parent layer.
   /// </summary>
   public static Boolean IsPropertyInherited(IILayer layer, BooleanNodeProperty prop)
   {
      if (layer == null)
         return false;

      Boolean ownValue = NestedLayers.GetProperty(layer, prop);
      Boolean actualValue = NestedLayers.GetLayerProperty(layer, prop);

      return (ownValue != actualValue);
   }
Exemple #11
0
 private static byte[] getAppData(IAnimatable anim, BooleanNodeProperty sbid)
 {
    return NestedLayers.getAppData(anim, PropertySbidOffset + (uint)sbid);
 }
Exemple #12
0
   private static void SetProperty(IILayer layer, BooleanNodeProperty property, Boolean value, Boolean setByParent)
   {
      if (layer == null)
         return;
      
      //Store new value in AppDataChunk.
      if (!setByParent)
         NestedLayers.setAppData(layer, property, BitConverter.GetBytes(value));

      //Set new value based on value and parent value.
      Boolean ownValue = NestedLayers.GetProperty(layer, property);

      Boolean newValue = ownValue;
      IILayer parentLayer = NestedLayers.GetParent(layer);
      if (parentLayer != null)
      {
         Boolean parentValue = NestedLayers.GetLayerProperty(parentLayer, property);

         BinaryPredicate<Boolean> pred = Functor.Or;
         if (!NestedLayers.propertyOps.TryGetValue(property, out pred))
            pred = Functor.Or;
         newValue = pred(ownValue, parentValue);
      }

      NestedLayers.SetLayerProperty(layer, property, newValue);

      //Broadcast notification.
      if (property == BooleanNodeProperty.IsHidden)
      {
         MaxInterfaces.Global.BroadcastNotification(SystemNotificationCode.LayerHiddenStateChanged, layer);
      }
      else if (property == BooleanNodeProperty.IsFrozen)
      {
         MaxInterfaces.Global.BroadcastNotification(SystemNotificationCode.LayerFrozenStateChanged, layer);
      }
      else
      {
         LayerPropertyChangedParam parameters = new LayerPropertyChangedParam(layer, NodeProperties.ToProperty(property));
         MaxInterfaces.Global.BroadcastNotification(LayerNotificationCode.LayerPropertyChanged, parameters);
      }

      //Propagate to children.
      IEnumerable<IILayer> childLayers = NestedLayers.GetChildren(layer, false);
      foreach (IILayer childLayer in childLayers)
      {
         NestedLayers.SetProperty(childLayer, property, value, true);
      }
   }
Exemple #13
0
 /// <summary>
 /// Sets a layer property and propagates it to its children.
 /// </summary>
 public static void SetProperty(IILayer layer, BooleanNodeProperty prop, Boolean value)
 {
    NestedLayers.SetProperty(layer, prop, value, false);
 }
Exemple #14
0
 /// <summary>
 /// Returns the value of a property on the layer.
 /// It will return the layer's own value, regardless of whether it has been overridden by a parent layer.
 /// </summary>
 public static Boolean GetProperty(IILayer layer, BooleanNodeProperty property)
 {
    byte[] data = NestedLayers.getAppData(layer, property);
    if (data != null)
       return BitConverter.ToBoolean(data, 0);
    else
       return NestedLayers.GetLayerProperty(layer, property);
 }
 public NodePropertyMenuItemModel( String text, String image, Type resType
                            , BooleanNodeProperty property) : base(text, image, resType)
 {
    this.Property = property;
 }
Exemple #16
0
 public override bool GetNodeProperty(BooleanNodeProperty property)
 {
    return this.ChildNodes.All(n => n.GetNodeProperty(property));
 }
Exemple #17
0
 public override bool GetNodeProperty(BooleanNodeProperty property)
 {
    if (property == BooleanNodeProperty.IsHidden)
       return this.HasFlags(XRefSceneFlags.Hidden);
    if (property == BooleanNodeProperty.BoxMode)
       return this.HasFlags(XRefSceneFlags.BoxMode);
    
    return base.GetNodeProperty(property);
 }
Exemple #18
0
 public override void SetNodeProperty(BooleanNodeProperty property, bool value)
 {
    this.ChildNodes.ForEach(n => n.SetNodeProperty(property, value));
 }
Exemple #19
0
 public override bool GetNodeProperty(BooleanNodeProperty property)
 {
    switch (property)
    {
       case BooleanNodeProperty.IsHidden: return this.INode.IsObjectHidden;
       case BooleanNodeProperty.IsFrozen: return this.INode.IsObjectFrozen;
       case BooleanNodeProperty.SeeThrough: return IntToBool(this.INode.XRayMtl_);
       case BooleanNodeProperty.BoxMode: return IntToBool(this.INode.BoxMode_);
       case BooleanNodeProperty.BackfaceCull: return IntToBool(this.INode.BackCull_);
       case BooleanNodeProperty.AllEdges: return IntToBool(this.INode.AllEdges_);
       case BooleanNodeProperty.VertexTicks: return IntToBool(this.INode.VertTicks);
       case BooleanNodeProperty.Trajectory: return IntToBool(this.INode.TrajectoryON);
       case BooleanNodeProperty.IgnoreExtents: return IntToBool(this.INode.IgnoreExtents_);
       case BooleanNodeProperty.FrozenInGray: return IntToBool(this.INode.ShowFrozenWithMtl);
       case BooleanNodeProperty.Renderable: return IntToBool(this.INode.Renderable);
       case BooleanNodeProperty.InheritVisibility: return this.INode.InheritVisibility;
       case BooleanNodeProperty.PrimaryVisibility: return IntToBool(this.INode.PrimaryVisibility);
       case BooleanNodeProperty.SecondaryVisibility: return IntToBool(this.INode.SecondaryVisibility);
       case BooleanNodeProperty.ReceiveShadows: return IntToBool(this.INode.RcvShadows);
       case BooleanNodeProperty.CastShadows: return IntToBool(this.INode.CastShadows);
       case BooleanNodeProperty.ApplyAtmospherics: return IntToBool(this.INode.ApplyAtmospherics);
       case BooleanNodeProperty.RenderOccluded: return this.INode.RenderOccluded;
       default: return base.GetNodeProperty(property);
    }
 }
Exemple #20
0
 public override Boolean GetNodeProperty(BooleanNodeProperty property)
 {
    return NestedLayers.GetProperty(this.ILayer, property);
 }
Exemple #21
0
 /// <summary>
 /// Tests if the given BooleanNodeProperty is a render property.
 /// </summary>
 /// <param name="property">The BooleanNodeProperty to test.</param>
 public static Boolean IsRenderProperty(BooleanNodeProperty property)
 {
    return IsRenderProperty(ToProperty(property));
 }
Exemple #22
0
 public override void SetNodeProperty(BooleanNodeProperty property, bool value)
 {
    NestedLayers.SetProperty(this.ILayer, property, value);
 }
Exemple #23
0
 /// <summary>
 /// Tests if the given BooleanNodeProperty is a display property.
 /// </summary>
 /// <param name="property">The BooleanNodeProperty to test.</param>
 public static Boolean IsDisplayProperty(BooleanNodeProperty property)
 {
    return IsDisplayProperty(ToProperty(property));
 }
Exemple #24
0
 private static Boolean GetLayerProperty(IILayer layer, BooleanNodeProperty property)
 {
    switch (property)
    {
       case BooleanNodeProperty.IsHidden: return layer.IsHidden;
       case BooleanNodeProperty.IsFrozen: return layer.IsFrozen;
       case BooleanNodeProperty.SeeThrough: return layer.XRayMtl;
       case BooleanNodeProperty.BoxMode: return layer.BoxMode;
       case BooleanNodeProperty.BackfaceCull: return layer.BackCull;
       case BooleanNodeProperty.AllEdges: return layer.AllEdges;
       case BooleanNodeProperty.VertexTicks: return layer.VertTicks;
       case BooleanNodeProperty.Trajectory: return layer.Trajectory_;
       case BooleanNodeProperty.IgnoreExtents: return layer.IgnoreExtents;
       case BooleanNodeProperty.FrozenInGray: return layer.ShowFrozenWithMtl;
       case BooleanNodeProperty.Renderable: return layer.Renderable;
       case BooleanNodeProperty.InheritVisibility: return layer.InheritVisibility;
       case BooleanNodeProperty.PrimaryVisibility: return layer.PrimaryVisibility;
       case BooleanNodeProperty.SecondaryVisibility: return layer.SecondaryVisibility;
       case BooleanNodeProperty.ReceiveShadows: return layer.RcvShadows;
       case BooleanNodeProperty.CastShadows: return layer.CastShadows;
       case BooleanNodeProperty.ApplyAtmospherics: return layer.ApplyAtmospherics;
       case BooleanNodeProperty.RenderOccluded: return layer.RenderOccluded;
       default: return false;
    }
 }