Select Git revision
EnableCommand.cs
VolumeFacts.cs 14.47 KiB
using Newtonsoft.Json;
using REST_JSON_API;
using System.Collections;
using System.Collections.Generic;
/// <summary>
/// The volume of a cone A defined by a base area <see cref="CircleFact">CircleFact</see>, an apex <see cref="PointFact">PointFact</see> and the volume as float
/// </summary>
public class ConeVolumeFact : FactWrappedCRTP<ConeVolumeFact>
{
/// <summary> a <see cref="CircleFact">CircleFact</see> describing the base area </summary>
public string Cid1;
[JsonIgnore]
public CircleFact Circle { get => (CircleFact)FactRecorder.AllFacts[Cid1]; }
/// <summary> a <see cref="PointFact">PointFact</see> describing the apex point </summary>
public string Pid1;
[JsonIgnore]
public PointFact Point { get => (PointFact)FactRecorder.AllFacts[Pid1]; }
/// <summary> the volume of the cone as a float </summary>
public float volume;
/// <summary> \copydoc Fact.Fact </summary>
public ConeVolumeFact() : base()
{
this.Cid1 = null;
this.Pid1 = null;
this.volume = 0.0f;
}
/// <summary>
/// Standard Constructor:
/// Initiates members and creates MMT %Fact Server-Side
/// </summary>
/// <param name="cid1">sets <see cref="Cid1"/></param>
/// <param name="pid1">sets <see cref="Pid1"/></param>
/// <param name="vol">sets <see cref="volume"/></param>
public ConeVolumeFact(string cid1, string pid1, float vol) : base()
{
this.Cid1 = cid1;
this.Pid1 = pid1;
this.volume = vol;
}
protected override void RecalculateTransform()
{
Position = Point.Position;
Rotation = Circle.Rotation;
}
/// <summary>
/// Bypasses initialization of new MMT %Fact by using existend URI, _which is not checked for existence_.
/// </summary>
/// <param name="Cid1">sets <see cref="Cid1"/></param>
/// <param name="Pid1">sets <see cref="Pid1"/></param>
/// <param name="volume">sets <see cref="volume"/></param>
/// <param name="backendURI">MMT URI</param>
public ConeVolumeFact(string Cid1, string Pid1, float volume, SOMDoc _ServerDefinition) : base()
{
this.Cid1 = Cid1;
this.Pid1 = Pid1;
this.volume = volume;
this.ServerDefinition = _ServerDefinition;
}
/// \copydoc Fact.parseFact(ScrollFact)
public new static IEnumerator parseFact(List<Fact> ret, MMTFact fact)
{