Show / Hide Table of Contents

    Class ElementInstance

    An instance of an element in the model. Instances point to one instance of a type, but have individual ids and transforms.

    Examples
    // Create a test user element.
    var profile = new Profile(Polygon.Rectangle(1.0, 1.0));
    var material = new Material("yellow", Colors.Yellow);
    var line = new Line(Vector3.Origin, new Vector3(5, 5, 5));
    
    // Set the isElementDefinition parameter to true,
    // so the element is considered an instance definition.
    var testUserElement = new TestUserElement(line, profile, material, isElementDefinition: true);
    
    // Create instances of that element
    // with varied transforms.
    var attractor = new Vector3(30, 20);
    for (var x = 0.0; x < 50; x += 1.5)
    {
        for (var y = 0.0; y < 50; y += 1.5)
        {
            var loc = new Vector3(x, y);
            var d = loc.DistanceTo(attractor);
            var s = d == 0 ? 1 : 5 * Math.Sin(1 / d);
            var t = new Transform();
            t.Scale(new Vector3(s, s, s));
            t.Move(loc);
            var instance = testUserElement.CreateInstance(t, $"Test User Element {x}:{y}");
            this.Model.AddElement(instance);
        }
    }
    
    Inheritance
    System.Object
    Element
    ElementInstance
    Implements
    System.ComponentModel.INotifyPropertyChanged
    Inherited Members
    Element.Id
    Element.Name
    Element.AdditionalProperties
    Element.PropertyChanged
    Element.RaisePropertyChanged(String)
    Element.SetMapping(String, MappingBase)
    Element.GetMapping(String)
    Element.GetMapping<T>(String)
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Elements
    Assembly: Hypar.Elements.dll
    Syntax
    public class ElementInstance : Element, INotifyPropertyChanged

    Properties

    BaseDefinition

    The element from which this instance is derived.

    Declaration
    public GeometricElement BaseDefinition { get; }
    Property Value
    Type Description
    GeometricElement

    Transform

    The transform of the instance.

    Declaration
    public Transform Transform { get; }
    Property Value
    Type Description
    Transform

    Implements

    System.ComponentModel.INotifyPropertyChanged

    Extension Methods

    ElementProxyExtensions.Proxy<T>(T, String)
    Identity.AddOverrideIdentity(Element, IOverride)
    Identity.AddOverrideIdentity(Element, String, String, Object)
    Identity.AddOverrideValue(Element, String, Object)
    Identity.OverrideIds<T>(Element, String)