예제 #1
0
        /// <summary>
        /// Parse the definition of one index in the database
        /// </summary>
        /// <param name="cur2">the current node</param>
        /// <returns></returns>
        protected TIndex ParseIndex(XmlNode cur2)
        {
            TIndex      element;
            XmlNode     cur;
            TIndexField myIndexField;
            int         groupId;

            element           = new TIndex();
            element.strName   = GetAttribute(cur2, "name");
            element.strDescr  = GetAttribute(cur2, "descr");
            element.strArea   = GetAttribute(cur2, "area");
            element.bPrimary  = (GetAttribute(cur2, "primary") == "yes");
            element.bUnique   = (GetAttribute(cur2, "unique") == "yes");
            element.bImplicit = (GetAttribute(cur2, "implicit") == "yes");
            cur = cur2.FirstChild;

            while (cur != null)
            {
                groupId      = -1;
                myIndexField = (TIndexField)Parse(cur, ref groupId, "indexfield");

                if (myIndexField != null)
                {
                    element.grpIndexField.Add(myIndexField);
                }

                cur = GetNextEntity(cur);
            }

            return(element);
        }
예제 #2
0
 public Key(TSource source, TIndex index)
 {
     Source = source;
     _index = index;
     unchecked
     {
         _hashCode = (Source.GetHashCode() * 397) ^
                     _index.GetHashCode();
     }
 }
예제 #3
0
        private static (VertexPosition[] vertices, TIndex[] indices) GenerateBufferData()
        {
            // convention is X -> y ^ and Z to sky
            // So first verts are at bottom left.
            // front-face is CW
            var vertices = new VertexPosition[GridResolution * GridResolution];
            var i        = 0;

            for (var y = 0; y < GridResolution; y++)
            {
                for (var x = 0; x < GridResolution; x++)
                {
                    vertices[i] = new VertexPosition(new Vector3(x / (float)(GridResolution - 1), y / (float)(GridResolution - 1), 0));
                    i++;
                }
            }
            Trace.Assert(i == vertices.Length);

            var ntriangles = (GridResolution - 1) * (GridResolution - 1) * 2;
            var indices    = new TIndex[ntriangles * 3];

            i = 0;
            for (var y = 0; y < GridResolution - 1; y++)
            {
                for (var x = 0; x < GridResolution - 1; x++)
                {
                    var bl = checked ((TIndex)(GridResolution * y + x));
                    var br = checked ((TIndex)(GridResolution * y + (x + 1)));
                    var tl = checked ((TIndex)(GridResolution * (y + 1) + x));
                    var tr = checked ((TIndex)(GridResolution * (y + 1) + (x + 1)));

                    indices[i++] = tl;
                    indices[i++] = tr;
                    indices[i++] = bl;

                    indices[i++] = bl;
                    indices[i++] = tr;
                    indices[i++] = br;
                }
            }
            Trace.Assert(i == indices.Length);

            return(vertices, indices);
        }
예제 #4
0
 public DataNotFoundException(TIndex index)
     : base("Data not found at " + index.ToString())
 {
 }
예제 #5
0
 public TaskData(TIndex index)
 {
     Index             = index;
     _completionSource = new NoThrowTaskCompletionSource <TData>();
 }
예제 #6
0
        /// <summary>
        /// Parse the definition of one index in the database
        /// </summary>
        /// <param name="cur2">the current node</param>
        /// <returns></returns>
        protected TIndex ParseIndex(XmlNode cur2)
        {
            TIndex element;
            XmlNode cur;
            TIndexField myIndexField;
            int groupId;

            element = new TIndex();
            element.strName = GetAttribute(cur2, "name");
            element.strDescr = GetAttribute(cur2, "descr");
            element.strArea = GetAttribute(cur2, "area");
            element.bPrimary = (GetAttribute(cur2, "primary") == "yes");
            element.bUnique = (GetAttribute(cur2, "unique") == "yes");
            element.bImplicit = (GetAttribute(cur2, "implicit") == "yes");
            cur = cur2.FirstChild;

            while (cur != null)
            {
                groupId = -1;
                myIndexField = (TIndexField)Parse(cur, ref groupId, "indexfield");

                if (myIndexField != null)
                {
                    element.grpIndexField.Add(myIndexField);
                }

                cur = GetNextEntity(cur);
            }

            return element;
        }