예제 #1
0
        private static void FillItemArray(List <DPath> list, DElementList eleList, string sqRootPath, int sqIndex)
        {
            foreach (DElement ele in eleList)
            {
                DicomTag tag  = ele.DicomTag;
                DPath    path = DPath.GetDPath(tag, ele.getVR(), "", sqRootPath, sqIndex);
                path.Enable   = (ele.Type != DValueType.Type3 && ele.Type != DValueType.Unknown);
                path.Catagory = ele.Catagory;
                list.Add(path);

                if (ele.VR == DVR.SQ)
                {
                    int index = -1;
                    foreach (DElementList subList in ele.Sequence)
                    {
                        index++;
                        DPath pathBegin = DPath.GetItemGroupPathBegin(index);
                        DPath pathEnd   = DPath.GetItemGroupPathEnd(index);
                        list.Add(pathBegin);
                        FillItemArray(list, subList, path.Path, index);
                        list.Add(pathEnd);
                    }
                }
            }
        }
예제 #2
0
 public MWLQueryCriteriaItem(DPath dcmPath, GWDataDBField gwField)
 {
     DPath            = dcmPath;
     GWDataDBField    = gwField;
     base.SourceField = DicomMappingHelper.DPath2DataColumnName(dcmPath);
     Initialize();
 }
예제 #3
0
        internal static DType GetEnumType(IntellisenseData.IntellisenseData intellisenseData, TexlNode node)
        {
            Contracts.AssertValue(intellisenseData);
            Contracts.AssertValue(node);

            DottedNameNode dottedNode;
            FirstNameNode  firstNameNode;

            if ((dottedNode = node.AsDottedName()) != null)
            {
                return(intellisenseData.Binding.GetType(dottedNode.Left));
            }

            if ((firstNameNode = node.AsFirstName()) != null)
            {
                FirstNameInfo firstNameInfo = intellisenseData.Binding.GetInfo(firstNameNode).VerifyValue();

                DPath parent = firstNameInfo.Path.Parent;
                if (!parent.Name.IsValid)
                {
                    return(DType.Unknown);
                }

                if (intellisenseData.TryGetEnumSymbol(parent.Name, intellisenseData.Binding, out EnumSymbol enumSymbol))
                {
                    return(enumSymbol.EnumType);
                }
            }

            return(DType.Unknown);
        }
예제 #4
0
 public MWLQueryCriteriaItem(DPath dcmPath)
 {
     DPath            = dcmPath;
     base.SourceField = DicomMappingHelper.DPath2DataColumnName(dcmPath);
     GWDataDBField    = GWDataDBField.Null;
     Translating.Type = TranslatingType.None;
     Initialize();
 }
예제 #5
0
 public StorageItem(DPath dcmPath)
 {
     DPath                  = dcmPath;
     SourceField            = DicomMappingHelper.DPath2DataColumnName(DPath);// DPath.Seperator + dcmPath.Path;
     GWDataDBField          = GWDataDBField.Null;
     Translating.Type       = TranslatingType.None;
     Translating.ConstValue = "";
 }
예제 #6
0
 public static string DPath2DataColumnName(DPath path)
 {
     if (path == null)
     {
         return("");
     }
     return(DPath2DataColumnName(path.Path));
 }
예제 #7
0
 public MWLQueryResultItem(DPath dcmPath)
 {
     DPath                  = dcmPath;
     base.TargetField       = DicomMappingHelper.DPath2DataColumnName(dcmPath);
     GWDataDBField          = GWDataDBField.Null;
     Translating.Type       = TranslatingType.FixValue;
     Translating.ConstValue = "";
 }
예제 #8
0
        public bool IsColumnSearchable(DPath columnPath)
        {
            Contracts.AssertValid(columnPath);

            return(IsDelegationSupportedByColumn(columnPath, DelegationCapability.Filter | DelegationCapability.Contains) ||
                   IsDelegationSupportedByColumn(columnPath, DelegationCapability.Filter | DelegationCapability.IndexOf | DelegationCapability.GreaterThan) ||
                   IsDelegationSupportedByColumn(columnPath, DelegationCapability.Filter | DelegationCapability.SubStringOf | DelegationCapability.Equal));
        }
예제 #9
0
        public ControlKeywordInfo(NameNode node, DPath path, IExternalControl data)
            : base(BindKind.Control, node.VerifyValue())
        {
            Contracts.AssertValid(path);
            Contracts.AssertValueOrNull(data);

            Path = path;
            Data = data;
        }
예제 #10
0
 public void LoadSetting(DPath path)
 {
     if (path == null)
     {
         return;
     }
     SelectItem(this._comboxBoxTag, DHelper.GetTagName((uint)path.GetTag()));
     SelectItem(this._comboxBoxVR, path.VR.ToString());
 }
예제 #11
0
 public void SaveSetting(DPath path)
 {
     if (path == null)
     {
         return;
     }
     //cfg.Tag = GetTag();       //todo...
     path.VR = (DVR)GetVR();
 }
예제 #12
0
        public IEnumerable <TexlFunction> LookupFunctions(DPath theNamespace, string name, bool localeInvariant = false)
        {
            Contracts.Check(theNamespace.IsValid, "The namespace is invalid.");
            Contracts.CheckNonEmpty(name, "name");

            // See TexlFunctionsLibrary.Lookup
            // return _functionLibrary.Lookup(theNamespace, name, localeInvariant, null);
            IEnumerable <TexlFunction> functionLibrary = _library.Where(func => func.Namespace == theNamespace && name == (localeInvariant ? func.LocaleInvariantName : func.Name)); // Base filter

            return(functionLibrary);
        }
예제 #13
0
        public Identifier(DPath theNamespace, Token atToken, IdentToken tok)
        {
            Contracts.Assert(theNamespace.IsValid);
            Contracts.AssertValueOrNull(atToken);
            Contracts.AssertValue(tok);
            Contracts.Assert(tok.Name.IsValid);

            Namespace = theNamespace;
            AtToken   = atToken;
            Token     = tok;
            Name      = tok.Name;
        }
예제 #14
0
        protected bool TryGetColumnRestrictions(DPath columnPath, out DelegationCapability restrictions)
        {
            Contracts.AssertValid(columnPath);

            if (ColumnRestrictions.TryGetValue(columnPath, out restrictions))
            {
                return(true);
            }

            restrictions = DelegationCapability.None;
            return(false);
        }
예제 #15
0
        public NameLookupInfo(BindKind kind, DType type, DPath path, int upCount, object data = null, DName logicalName = default(DName))
        {
            Contracts.Assert(BindKind._Min <= kind && kind < BindKind._Lim);
            Contracts.Assert(upCount >= 0);
            Contracts.AssertValueOrNull(data);

            Kind        = kind;
            Type        = type;
            Path        = path;
            UpCount     = upCount;
            Data        = data;
            LogicalName = logicalName;
        }
예제 #16
0
        public virtual bool IsUnaryOpInDelegationSupportedByColumn(UnaryOp op, DPath columnPath)
        {
            Contracts.AssertValid(columnPath);

            if (!IsUnaryOpInDelegationSupported(op))
            {
                return(false);
            }

            Contracts.Assert(DelegationCapability.UnaryOpToDelegationCapabilityMap.ContainsKey(op));

            return(IsDelegationSupportedByColumn(columnPath, DelegationCapability.UnaryOpToDelegationCapabilityMap[op]));
        }
예제 #17
0
        // Returns true if column is marked as AscendingOnly.
        public bool IsColumnAscendingOnly(DPath columnPath)
        {
            Contracts.AssertValid(columnPath);

            DelegationCapability columnRestrictions;

            if (!TryGetColumnRestrictions(columnPath, out columnRestrictions))
            {
                return(false);
            }

            return(columnRestrictions.HasCapability(DelegationCapability.SortAscendingOnly));
        }
예제 #18
0
 public void LoadSetting(DPath path)
 {
     if (path == null)
     {
         return;
     }
     SelectItem(this._comboxBoxVR, (int)path.VR);
     if (!SelectItem(this._comboxBoxTag, path.GetTag()))
     {
         this._textBoxGroupNum.Text   = path.GetGroupString();
         this._textBoxElementNum.Text = path.GetElementString();
         this._comboxBoxTag.Text      = path.Description;
     }
 }
예제 #19
0
        private void bt_path_Click(object sender, EventArgs e)
        {
            DPath path = new DPath
            {
                MyBrush    = new SolidBrush(Color.FromArgb(128, Color.DarkOrchid)),
                Selectable = true
                             //X = e.Location.X,
                             //Y = e.Location.Y,
            };
            CommandAdd add = new CommandAdd();

            add.item = path;
            paintPanel1.SetCommand(add);
        }
예제 #20
0
        public T AddChild <T>(Form parentForm, XCollection <T> list)
            where T : MappingItem, IDicomMappingItem, new()
        {
            T selitem = GetSelectedItem() as T;

            if (selitem == null || selitem.DPath.VR != DVR.SQ)
            {
                return(null);
            }

            FormElement2 <T> frm = new FormElement2 <T>(null, list, selitem, true, _gwDataDBConnection, _log, _asQueryResult, _isInbound);

            BeforeShowFormElement(ButtonType.AddChild, frm, selitem);
            if (frm.ShowDialog(parentForm) != DialogResult.OK)
            {
                return(null);
            }
            AfterShowFormElement(ButtonType.AddChild, frm, selitem);

            T newitem = frm.MappingItem;

            if (newitem == null)
            {
                return(null);
            }

            int  index    = list.IndexOf(selitem);
            bool hasChild = DicomMappingHelper.HasSequence <T>(index, list);

            if (hasChild == false)
            {
                T iBegin = new T();
                DPath.SetItemGroupPathBegin(iBegin.DPath, 0);
                T iEnd = new T();
                DPath.SetItemGroupPathEnd(iEnd.DPath, 0);

                int sqIndex = index + 1;
                list.Insert(sqIndex++, iBegin);
                list.Insert(sqIndex, iEnd);
            }

            if (DicomMappingHelper.FindEndDPathIndex <T>(ref index, list))
            {
                newitem.DPath.Catagory = selitem.DPath.Catagory;
                list.Insert(index, newitem);
            }

            return(newitem);
        }
예제 #21
0
        // Parse a namespace-qualified invocation, e.g. Facebook.GetFriends()
        private CallNode ParseInvocationWithNamespace(DottedNameNode dotted)
        {
            Contracts.Assert(dotted.HasPossibleNamespaceQualifier);

            DPath path = dotted.ToDPath();

            Contracts.Assert(path.IsValid);
            Contracts.Assert(!path.IsRoot);
            Contracts.Assert(!path.Parent.IsRoot);

            Identifier head = new Identifier(path.Parent, null, dotted.Right.Token);

            Contracts.Assert(_curs.TidCur == TokKind.ParenOpen);

            return(ParseInvocation(head, ParseTrivia(), dotted));
        }
예제 #22
0
        private bool IsColumnSortable(StrLitNode node, TexlBinding binding, SortOpMetadata sortMetadata)
        {
            Contracts.AssertValue(node);
            Contracts.AssertValue(binding);
            Contracts.AssertValue(sortMetadata);

            DPath columnPath = DPath.Root.Append(new DName(node.Value));

            if (!sortMetadata.IsDelegationSupportedByColumn(columnPath, DelegationCapability.Sort))
            {
                SuggestDelegationHint(node, binding);
                return(false);
            }

            return(true);
        }
예제 #23
0
        private FirstNameInfo(BindKind kind, FirstNameNode node, int nestDst, int nestCur, DPath path, object data, DName dataControlName, bool isDataControlAccess)
            : base(kind, node)
        {
            Contracts.Assert(nestDst >= int.MinValue);
            Contracts.Assert(nestCur >= 0);
            Contracts.Assert(nestCur >= nestDst);
            Contracts.AssertValueOrNull(data);

            NestDst             = nestDst;
            NestSrc             = nestCur;
            Path                = path;
            Data                = data;
            IsDataControlAccess = isDataControlAccess;
            DataControlName     = dataControlName;

            _dataQueryOptions = new Lazy <Dictionary <ExpandPath, ExpandQueryOptions> >();
        }
예제 #24
0
            private DPath getReplacementPath(string alias, DPath currentColumnPath)
            {
                if (alias.Contains("/"))
                {
                    var fullPath = DPath.Root;

                    foreach (var name in alias.Split('/'))
                    {
                        fullPath = fullPath.Append(new DName(name));
                    }

                    return(fullPath);
                }
                else // Task 5593666: This is temporary to not cause regressions while sharepoint switches to using full query param
                {
                    return(currentColumnPath.Append(new DName(alias)));
                }
            }
예제 #25
0
        public void SaveSetting(DPath path, DPath sqPath)
        {
            if (path == null)
            {
                return;
            }

            string strPath = (sqPath == null) ? "" : sqPath.Path;
            int    index   = (sqPath == null) ? -1 : 0;

            string   description = this._comboxBoxTag.Text;
            int      tag         = GetTag();
            DicomTag dicomTag    = DHelper.Int2DicomTag(tag);
            DPath    p           = DPath.GetDPath(dicomTag, GetVR(), description, strPath, index);

            path.Description = p.Description;
            path.Path        = p.Path;
            path.VR          = p.VR;
        }
예제 #26
0
        public override bool TryGetColumnCapabilities(DPath columnPath, out DelegationCapability capabilities)
        {
            Contracts.AssertValid(columnPath);

            // See if there is a specific capability defined for column.
            // If not then just return default one.
            if (!_columnCapabilities.TryGetValue(columnPath, out capabilities))
            {
                return(base.TryGetColumnCapabilities(columnPath, out capabilities));
            }

            // If metadata specified any restrictions for this column then apply those
            // before returning capabilities.
            DelegationCapability restrictions;

            if (TryGetColumnRestrictions(columnPath, out restrictions))
            {
                capabilities &= ~restrictions;
            }

            return(true);
        }
예제 #27
0
        public bool IsDelegationSupportedByColumn(DPath columnPath, DelegationCapability delegationCapability)
        {
            Contracts.AssertValid(columnPath);

            // Only the first part of the path can have been renamed
            string logicalName;

            if (DType.TryGetLogicalNameForColumn(_tableSchema, columnPath[0], out logicalName))
            {
                var renamedColumnPath = DPath.Root;
                renamedColumnPath = renamedColumnPath.Append(new DName(logicalName));
                for (int i = 1; i < columnPath.Length; ++i)
                {
                    renamedColumnPath = renamedColumnPath.Append(new DName(columnPath[i]));
                }

                columnPath = renamedColumnPath;
            }

            DelegationCapability columnCapabilities;

            return(TryGetColumnCapabilities(columnPath, out columnCapabilities) && columnCapabilities.HasCapability(delegationCapability.Capabilities));
        }
            private static bool TryGetNamespaceFunctions(TexlNode node, TexlBinding binding, out IEnumerable <TexlFunction> functions)
            {
                Contracts.AssertValue(node);
                Contracts.AssertValue(binding);

                FirstNameNode curNode = node.AsFirstName();

                if (curNode == null)
                {
                    functions = EmptyEnumerator <TexlFunction> .Instance;
                    return(false);
                }

                FirstNameInfo firstNameInfo = binding.GetInfo(curNode).VerifyValue();

                Contracts.AssertValid(firstNameInfo.Name);

                DPath namespacePath = new DPath().Append(firstNameInfo.Name);

                functions = binding.NameResolver.LookupFunctionsInNamespace(namespacePath);

                return(functions.Any());
            }
예제 #29
0
        public virtual bool TryGetColumnCapabilities(DPath columnPath, out DelegationCapability capabilities)
        {
            Contracts.AssertValid(columnPath);

            // Check if it's a valid column name. As capabilities are not defined for all columns, we need to do this check.
            DType _;

            if (!_tableSchema.TryGetType(columnPath, out _))
            {
                capabilities = DelegationCapability.None;
                return(false);
            }

            capabilities = DefaultColumnCapabilities;

            DelegationCapability restrictions;

            if (TryGetColumnRestrictions(columnPath, out restrictions))
            {
                capabilities &= ~restrictions;
            }

            return(true);
        }
예제 #30
0
    public IEnumerator UpdatePathsToDatastream()
    {
        paths = new DPath[width];
        for (int x = 1; x < width; x++)
        {
            enemySpawn.waveCounterIndicator.text = "Initializing: " + ((int)((float)x / (float)width * 100f)).ToString() + "%";
            curPath = null;

            Dictionary <Node, float> dist = new Dictionary <Node, float>();
            Dictionary <Node, Node>  prev = new Dictionary <Node, Node>();

            List <Node> unvisited = new List <Node>();

            Node source = nodes[x, height - 1];
            Node target = nodes[x, 1];

            dist[source] = 0f;
            prev[source] = null;

            foreach (Node v in nodes)
            {
                if (v != source && v != null)
                {
                    dist[v] = Mathf.Infinity;
                    prev[v] = null;
                }

                unvisited.Add(v);
            }

            int bakeIndex = 0;
            while (unvisited.Count != 0)
            {
                Node u = null;

                foreach (Node poss in unvisited)
                {
                    if (poss != null)
                    {
                        if (u == null || dist[poss] < dist[u])
                        {
                            u = poss;
                        }
                    }
                }

                if (u == target)
                {
                    break;
                }

                unvisited.Remove(u);

                int index = 0;
                foreach (Node v in u.nearby)
                {
                    float alt = dist[u] + u.DistanceTo(v) + extraCost[index];
                    index++;

                    if (v != null)
                    {
                        if (debugDrawPaths)
                        {
                            Debug.DrawLine(NodeToWorld(u), NodeToWorld(v), Color.blue, 0.1f, false);
                        }

                        if (alt < dist[v])
                        {
                            dist[v] = alt;
                            prev[v] = u;
                        }
                    }
                }

                bakeIndex++;
                if (bakeIndex % bakeSpeed == 0)
                {
                    yield return(new WaitForEndOfFrame());
                }
            }

            if (prev[target] == null)
            {
                StopCoroutine("UpdatePathsToDatastream");
            }

            curPath = new List <Node>();
            Node curr = target;

            while (prev[curr] != null)
            {
                curPath.Add(curr);
                curr = prev[curr];
            }

            curPath.Reverse();

            List <Vector3> newPath = new List <Vector3>();
            foreach (Node n in curPath)
            {
                newPath.Add(NodeToWorld(n));
            }

            paths[x] = new DPath(newPath.ToArray());
        }

        enemySpawn.StartWave();
    }