<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Pulsar4X;
using Pulsar4X.WinForms;
using Pulsar4X.WinForms.GLUtilities;
using OpenTK;


namespace Pulsar4X.WinForms.Controls.SceenGraph
{
    /// <summary>
    /// A generic Class which define the interface for a node in a Sceen graph, specific types of nodes should inherit from here.
    /// </summary>
    public abstract class SceenElement
    {
        /// <summary>
        /// List of Primitives that make up this sprite.
        /// </summary>
        protected List<GLPrimitive> m_lPrimitives = new List<GLPrimitive>();

        /// <summary>
        /// Get Primitives List.
        /// </summary>
        public List<GLPrimitive> Primitives
        {
            get
            {
                return m_lPrimitives;
            }
        }

        /// <summary>
        /// The Controlling Primitive is used to to work out things like if this boject has been selected, 
        /// e.g. For a Planet the Planet icon in the Controlling Primitive, everthing else is just UI chrome that hangs off mit.
        /// </summary>
        protected GLPrimitive m_oPrimaryPrimitive;

        /// <summary>
        /// Gets or sets the Controlling Primitive.
        /// </summary>
        public GLPrimitive PrimaryPrimitive
        {
            get
            {
                return m_oPrimaryPrimitive;
            }
            set
            {
                m_oPrimaryPrimitive = value;
            }
        }

        /// <summary>
        /// List of children
        /// </summary>
        protected List<SceenElement> m_lChildren = new List<SceenElement>();

        /// <summary>
        /// Get Children List.
        /// </summary>
        public List<SceenElement> Children
        {
            get
            {
                return Children;
            }
        }

        /// <summary>
        /// The ID of the entity this object repesents.
        /// </summary>
        public Guid EntityID { get; set; }

        /// <summary>
        /// Define the minium size in pixels for this object, 0 means that it can disapear.
        /// </summary>
        public Vector2 MinimumSize { get; set; }

        /// <summary>
        /// Defines the real size of this object in Km.
        /// </summary>
        public Vector2 RealSize { get; set; }

        /// <summary>
        /// Defines the distance from the ControllingPrimitive's Position for testing for selection. 
        /// </summary>
        public float SelectionDistance { get; set; }

        /// <summary>
        /// If False this element will not render any of its children
        /// </summary>
        public bool RenderChildren { get; set; }


        /// <summary>
        /// Default Constructor
        /// </summary>
        public SceenElement()
        {
            // set some defaults:
            MinimumSize = new Vector2(8, 8);
            RenderChildren = true;
        }

        /// <summary>
        /// Renders this Sprite's Primitives to the screen, then calles Redner() on aly Children
        /// </summary>
        public abstract void Render();

        /// <summary>
        /// Gets the Selected Entity at the Position specified (in world coords). if it is not this sprite then it will 
        /// recurse down the Children until it finds it. it will return null if it cannot be found
        /// </summary>
        public abstract Guid GetSelected(Vector3 a_v3AtPos);

        /// <summary>
        /// Will update/refresh the position and Size of the sprite, handles things like making sure that this sprite is not too small, etc.
        /// </summary>
        /// <param name="a_fZoomScaler"></param>
        public abstract void Refresh(float a_fZoomScaler);

        /// <summary>
        /// Add a primitive to the Sceen Element
        /// </summary>
        /// <param name="a_oPrimitive">The Primitive to Add</param>
        public void AddPrimitive(GLPrimitive a_oPrimitive)
        {
            m_lPrimitives.Add(a_oPrimitive);
        }

        /// <summary>
        /// Add a Child Element to this element.
        /// </summary>
        /// <param name="a_oElement">The element to add.</param>
        public void AddChildElement(SceenElement a_oElement)
        {
            m_lChildren.Add(a_oElement);
        }
    }
}<commit_msg>Added Parent Field to SceenElement class<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Pulsar4X;
using Pulsar4X.WinForms;
using Pulsar4X.WinForms.GLUtilities;
using OpenTK;


namespace Pulsar4X.WinForms.Controls.SceenGraph
{
    /// <summary>
    /// A generic Class which define the interface for a node in a Sceen graph, specific types of nodes should inherit from here.
    /// </summary>
    public abstract class SceenElement
    {
        /// <summary>
        /// List of Primitives that make up this sprite.
        /// </summary>
        protected List<GLPrimitive> m_lPrimitives = new List<GLPrimitive>();

        /// <summary>
        /// Get Primitives List.
        /// </summary>
        public List<GLPrimitive> Primitives
        {
            get
            {
                return m_lPrimitives;
            }
        }

        /// <summary>
        /// The Controlling Primitive is used to to work out things like if this boject has been selected, 
        /// e.g. For a Planet the Planet icon in the Controlling Primitive, everthing else is just UI chrome that hangs off mit.
        /// </summary>
        protected GLPrimitive m_oPrimaryPrimitive;

        /// <summary>
        /// Gets or sets the Controlling Primitive.
        /// </summary>
        public GLPrimitive PrimaryPrimitive
        {
            get
            {
                return m_oPrimaryPrimitive;
            }
            set
            {
                m_oPrimaryPrimitive = value;
            }
        }

        /// <summary>
        /// List of children
        /// </summary>
        protected List<SceenElement> m_lChildren = new List<SceenElement>();

        /// <summary>
        /// Get Children List.
        /// </summary>
        public List<SceenElement> Children
        {
            get
            {
                return Children;
            }
        }

        /// <summary>
        ///  This SceenElements Parent.
        /// </summary>
        protected SceenElement m_oParent;

        /// <summary>
        /// Gets or Sets the Parent Sceen Element of this Object.
        /// </summary>
        public SceenElement Parent
        {
            get
            {
                return m_oParent;
            }
            set
            {
                m_oParent = value;
            }
        }

        /// <summary>
        /// The ID of the entity this object repesents.
        /// </summary>
        public Guid EntityID { get; set; }

        /// <summary>
        /// Define the minium size in pixels for this object, 0 means that it can disapear.
        /// </summary>
        public Vector2 MinimumSize { get; set; }

        /// <summary>
        /// Defines the real size of this object in Km.
        /// </summary>
        public Vector2 RealSize { get; set; }

        /// <summary>
        /// Defines the distance from the ControllingPrimitive's Position for testing for selection. 
        /// </summary>
        public float SelectionDistance { get; set; }

        /// <summary>
        /// If False this element will not render any of its children
        /// </summary>
        public bool RenderChildren { get; set; }


        /// <summary>
        /// Default Constructor
        /// </summary>
        public SceenElement()
        {
            // set some defaults:
            MinimumSize = new Vector2(8, 8);
            RenderChildren = true;
        }

        /// <summary>
        /// Renders this Sprite's Primitives to the screen, then calles Redner() on aly Children
        /// </summary>
        public abstract void Render();

        /// <summary>
        /// Gets the Selected Entity at the Position specified (in world coords). if it is not this sprite then it will 
        /// recurse down the Children until it finds it. it will return null if it cannot be found
        /// </summary>
        public abstract Guid GetSelected(Vector3 a_v3AtPos);

        /// <summary>
        /// Will update/refresh the position and Size of the sprite, handles things like making sure that this sprite is not too small, etc.
        /// </summary>
        /// <param name="a_fZoomScaler"></param>
        public abstract void Refresh(float a_fZoomScaler);

        /// <summary>
        /// Add a primitive to the Sceen Element
        /// </summary>
        /// <param name="a_oPrimitive">The Primitive to Add</param>
        public void AddPrimitive(GLPrimitive a_oPrimitive)
        {
            m_lPrimitives.Add(a_oPrimitive);
        }

        /// <summary>
        /// Add a Child Element to this element.
        /// </summary>
        /// <param name="a_oElement">The element to add.</param>
        public void AddChildElement(SceenElement a_oElement)
        {
            a_oElement.Parent = this;
            m_lChildren.Add(a_oElement);
        }
    }
}
{'fraction_non_alphanumeric': 0.10089372240766663, 'fraction_numerical': 0.0025842575643372457, 'mean_word_length': 1.5136671177266576, 'pattern_counts': {'":': 0, '<': 103, '<?xml version=': 0, '>': 103, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7248480', 'n_tokens_mistral': 2456, 'n_tokens_neox': 2388, 'n_words': 816}