예제 #1
0
 public void CopyTo(CyPhyCOMInterfaces.IMgaTraceability copy)
 {
     foreach (var item in this.map)
     {
         string mapped;
         if (copy.TryGetMappedObject(item.Value, out mapped))
         {
             copy.AddItem(item.Key, mapped);
         }
         else
         {
             copy.AddItem(item.Key, item.Value);
         }
     }
 }
예제 #2
0
        public ComponentInfo(GME.MGA.IMgaFCO gmeObject, string modelType = null, CyPhyCOMInterfaces.IMgaTraceability traceability = null)
        {
            this.Name = gmeObject.Name;
            this.AbsPath = gmeObject.AbsPath;
            this.ID = gmeObject.ID;
            this.Path = this.GetPath();
            this.Kind = gmeObject.Meta.Name;
            this.ModelType = modelType;
            if (this.Kind == typeof(CyPhy.Component).Name)
            {
                var component = CyPhyClasses.Component.Cast(gmeObject);
                this.AVMID = component.Attributes.AVMID;
            }

            if (traceability != null)
            {
                string id = string.Empty;
                if (traceability.TryGetMappedObject(gmeObject.ID, out id))
                {
                    GME.MGA.MgaFCO baseComponent = gmeObject.Project.GetFCOByID(id);
                    if (baseComponent != null)
                    {
                        if (baseComponent.Status == 1)
                        {
                            // object is already deleted
                            // try to get it in a different way.
                            var idChain = gmeObject.RegistryValue["Elaborator/ID_Chain"];
                            if (string.IsNullOrWhiteSpace(idChain) == false)
                            {
                                id = idChain.Split(new char[] { ',' }).LastOrDefault();
                                if (id != null)
                                {
                                    baseComponent = gmeObject.Project.GetFCOByID(id);
                                    if (baseComponent != null)
                                    {
                                        this.Reference = new ComponentInfo(baseComponent, modelType);
                                    }
                                }
                            }
                        }
                        else
                        {
                            this.Reference = new ComponentInfo(baseComponent, modelType);
                        }
                    }
                }
            }
        }
예제 #3
0
 public static IEnumerable<IMgaObject> getTracedObjectOrSelf(this IEnumerable<IMgaObject> enumerable, CyPhyCOMInterfaces.IMgaTraceability traceability)
 {
     foreach (var obj in enumerable)
     {
         string originalID;
         if (traceability != null && traceability.TryGetMappedObject(obj.ID, out originalID))
         {
             yield return obj.Project.GetObjectByID(originalID);
         }
         else
         {
             yield return obj;
         }
     }
 }