private void ImportContainer(CyPhy.DesignEntity cyphy_container, avm.Container ad_container) { cyphy_container.Name = ad_container.Name; AVM2CyPhyML.CyPhyMLComponentBuilder.SetLayoutData(ad_container, cyphy_container.Impl); Dictionary<Type, CyPhyClasses.DesignContainer.AttributesClass.ContainerType_enum> typeToAttribute = new Dictionary<Type, CyPhyClasses.DesignContainer.AttributesClass.ContainerType_enum>() { {typeof(avm.DesignSpaceContainer), CyPhyClasses.DesignContainer.AttributesClass.ContainerType_enum.Compound}, {typeof(avm.Alternative), CyPhyClasses.DesignContainer.AttributesClass.ContainerType_enum.Alternative}, {typeof(avm.Optional), CyPhyClasses.DesignContainer.AttributesClass.ContainerType_enum.Optional}, {typeof(avm.Compound), CyPhyClasses.DesignContainer.AttributesClass.ContainerType_enum.Compound}, }; if (cyphy_container is CyPhy.DesignContainer) { ((CyPhy.DesignContainer)cyphy_container).Attributes.ContainerType = typeToAttribute[ad_container.GetType()]; if (ad_container is avm.Alternative) { ((IMgaFCO)cyphy_container.Impl).SetRegistryValueDisp("icon", "alternative_ds.png"); } if (ad_container is avm.Optional) { ((IMgaFCO)cyphy_container.Impl).SetRegistryValueDisp("icon", "optional_ds"); } } if (ad_container is avm.Alternative) { foreach (var ad_mux in ((avm.Alternative)ad_container).ValueFlowMux) { processMux((CyPhy.DesignContainer)cyphy_container, ad_mux); } } foreach (avm.Port avmPort in ad_container.Port) { if (cyphy_container is CyPhy.DesignContainer) { process((CyPhy.DesignContainer)cyphy_container, avmPort); } else { process((CyPhy.ComponentAssembly)cyphy_container, avmPort); } } foreach (var ad_connector in ad_container.Connector) { var cyphy_connector = CyPhyClasses.Connector.Cast(CreateChild((ISIS.GME.Common.Interfaces.Model)cyphy_container, typeof(CyPhyClasses.Connector))); processConnector(ad_connector, cyphy_connector); } foreach (var ad_prop in ad_container.Property) { if (cyphy_container is CyPhy.DesignContainer) { process((CyPhy.DesignContainer)cyphy_container, ad_prop); } else { process((CyPhy.ComponentAssembly)cyphy_container, ad_prop); } } foreach (var ad_componentinstance in ad_container.ComponentInstance) { CyPhy.ComponentRef cyphy_componentref; if (cyphy_container is CyPhy.DesignContainer) { cyphy_componentref = CyPhyClasses.ComponentRef.Create((CyPhy.DesignContainer)cyphy_container); } else { cyphy_componentref = CyPhyClasses.ComponentRef.Create((CyPhy.ComponentAssembly)cyphy_container); } ImportComponentInstance(ad_componentinstance, cyphy_componentref); } foreach (var ad_childcontainer in ad_container.Container1) { CyPhy.DesignEntity cyphy_childcontainer; if (cyphy_container is CyPhy.DesignContainer) { cyphy_childcontainer = CyPhyClasses.DesignContainer.Create((CyPhy.DesignContainer)cyphy_container); } else { cyphy_childcontainer = CyPhyClasses.ComponentAssembly.Create((CyPhy.ComponentAssembly)cyphy_container); } ImportContainer(cyphy_childcontainer, ad_childcontainer); } foreach (var simpleFormula in ad_container.Formula.OfType<avm.SimpleFormula>()) { CyPhyML.SimpleFormula cyphy_simpleFormula = CyPhyClasses.SimpleFormula.Cast(CreateChild((ISIS.GME.Common.Interfaces.Model)cyphy_container, typeof(CyPhyClasses.SimpleFormula))); process(simpleFormula, cyphy_simpleFormula); } foreach (var complexFormula in ad_container.Formula.OfType<avm.ComplexFormula>()) { var cyphy_customFormula = CyPhyClasses.CustomFormula.Cast(CreateChild((ISIS.GME.Common.Interfaces.Model)cyphy_container, typeof(CyPhyClasses.CustomFormula))); processComplexFormula(complexFormula, cyphy_customFormula); } }
private void ImportContainer(CyPhy.DesignEntity cyphy_container, avm.Container ad_container) { cyphy_container.Name = ad_container.Name; AVM2CyPhyML.CyPhyMLComponentBuilder.SetLayoutData(ad_container, cyphy_container.Impl); Dictionary<Type, CyPhyClasses.DesignContainer.AttributesClass.ContainerType_enum> typeToAttribute = new Dictionary<Type, CyPhyClasses.DesignContainer.AttributesClass.ContainerType_enum>() { {typeof(avm.DesignSpaceContainer), CyPhyClasses.DesignContainer.AttributesClass.ContainerType_enum.Compound}, {typeof(avm.Alternative), CyPhyClasses.DesignContainer.AttributesClass.ContainerType_enum.Alternative}, {typeof(avm.Optional), CyPhyClasses.DesignContainer.AttributesClass.ContainerType_enum.Optional}, {typeof(avm.Compound), CyPhyClasses.DesignContainer.AttributesClass.ContainerType_enum.Compound}, }; if (cyphy_container is CyPhy.DesignContainer) { ((CyPhy.DesignContainer)cyphy_container).Attributes.ContainerType = typeToAttribute[ad_container.GetType()]; } foreach (avm.Port avmPort in ad_container.Port) { if (cyphy_container is CyPhy.DesignContainer) { process((CyPhy.DesignContainer)cyphy_container, avmPort); } else { process((CyPhy.ComponentAssembly)cyphy_container, avmPort); } } foreach (var ad_connector in ad_container.Connector) { var cyphy_connector = CyPhyClasses.Connector.Cast(CreateChild((ISIS.GME.Common.Interfaces.Model)cyphy_container, typeof(CyPhyClasses.Connector))); processConnector(ad_connector, cyphy_connector); } foreach (var ad_prop in ad_container.Property) { if (cyphy_container is CyPhy.DesignContainer) { process((CyPhy.DesignContainer)cyphy_container, ad_prop); } else { process((CyPhy.ComponentAssembly)cyphy_container, ad_prop); } } foreach (var ad_componentinstance in ad_container.ComponentInstance) { CyPhy.ComponentRef cyphy_componentref; if (cyphy_container is CyPhy.DesignContainer) { cyphy_componentref = CyPhyClasses.ComponentRef.Create((CyPhy.DesignContainer)cyphy_container); } else { cyphy_componentref = CyPhyClasses.ComponentRef.Create((CyPhy.ComponentAssembly)cyphy_container); } ImportComponentInstance(ad_componentinstance, cyphy_componentref); } foreach (var ad_childcontainer in ad_container.Container1) { CyPhy.DesignEntity cyphy_childcontainer; if (cyphy_container is CyPhy.DesignContainer) { cyphy_childcontainer = CyPhyClasses.DesignContainer.Create((CyPhy.DesignContainer)cyphy_container); } else { cyphy_childcontainer = CyPhyClasses.ComponentAssembly.Create((CyPhy.ComponentAssembly)cyphy_container); } ImportContainer(cyphy_childcontainer, ad_childcontainer); } foreach (var constraint in ad_container.ContainerFeature.OfType<avm.schematic.eda.ExactLayoutConstraint>()) { CyPhyML.ExactLayoutConstraint cyphy_constraint = CyPhyClasses.ExactLayoutConstraint.Cast(CreateChild((ISIS.GME.Common.Interfaces.Model)cyphy_container, typeof(CyPhyClasses.ExactLayoutConstraint))); cyphy_constraint.Name = typeof(CyPhyML.ExactLayoutConstraint).Name; SetLayoutData(constraint, cyphy_constraint.Impl); cyphy_constraint.Attributes.X = constraint.X.ToString(); cyphy_constraint.Attributes.Y = constraint.Y.ToString(); cyphy_constraint.Attributes.Layer = d_LayerEnumMap[constraint.Layer]; if (constraint.RotationSpecified) { cyphy_constraint.Attributes.Rotation = d_RotationEnumMap[constraint.Rotation]; } if (string.IsNullOrWhiteSpace(constraint.ConstraintTarget) == false) { CyPhyML.ComponentRef compInstance; if (avmId2ComponentInstance.TryGetValue(constraint.ConstraintTarget, out compInstance)) { CyPhyClasses.ApplyExactLayoutConstraint.Connect(cyphy_constraint, compInstance); } } } foreach (var constraint in ad_container.ContainerFeature.OfType<avm.schematic.eda.RangeLayoutConstraint>()) { CyPhyML.RangeLayoutConstraint cyphy_constraint = CyPhyClasses.RangeLayoutConstraint.Cast(CreateChild((ISIS.GME.Common.Interfaces.Model)cyphy_container, typeof(CyPhyClasses.RangeLayoutConstraint))); cyphy_constraint.Name = typeof(CyPhyML.RangeLayoutConstraint).Name; SetLayoutData(constraint, cyphy_constraint.Impl); cyphy_constraint.Attributes.LayerRange = d_LayerRangeEnumMap[constraint.LayerRange]; if (constraint.XRangeMinSpecified && constraint.XRangeMaxSpecified) { cyphy_constraint.Attributes.XRange = constraint.XRangeMin + "-" + constraint.XRangeMax; } if (constraint.YRangeMinSpecified && constraint.YRangeMaxSpecified) { cyphy_constraint.Attributes.YRange = constraint.YRangeMin + "-" + constraint.YRangeMax; } foreach (var compId in constraint.ConstraintTarget) { CyPhyML.ComponentRef compInstance; if (avmId2ComponentInstance.TryGetValue(compId, out compInstance)) { CyPhyClasses.ApplyRangeLayoutConstraint.Connect(cyphy_constraint, compInstance); } } } foreach (var constraint in ad_container.ContainerFeature.OfType<avm.schematic.eda.RelativeLayoutConstraint>()) { CyPhyML.RelativeLayoutConstraint cyphy_constraint = CyPhyClasses.RelativeLayoutConstraint.Cast(CreateChild((ISIS.GME.Common.Interfaces.Model)cyphy_container, typeof(CyPhyClasses.RelativeLayoutConstraint))); cyphy_constraint.Name = typeof(CyPhyML.RelativeLayoutConstraint).Name; SetLayoutData(constraint, cyphy_constraint.Impl); if (constraint.XOffsetSpecified) { cyphy_constraint.Attributes.XOffset = constraint.XOffset.ToString(); } if (constraint.YOffsetSpecified) { cyphy_constraint.Attributes.YOffset = constraint.YOffset.ToString(); } foreach (var compId in constraint.ConstraintTarget) { CyPhyML.ComponentRef compInstance; if (avmId2ComponentInstance.TryGetValue(compId, out compInstance)) { CyPhyClasses.ApplyRelativeLayoutConstraint.Connect(cyphy_constraint, compInstance); } } if (string.IsNullOrWhiteSpace(constraint.Origin) == false) { CyPhyML.ComponentRef compInstance; if (avmId2ComponentInstance.TryGetValue(constraint.Origin, out compInstance)) { CyPhyClasses.RelativeLayoutConstraintOrigin.Connect(compInstance, cyphy_constraint); } } } foreach (var simpleFormula in ad_container.Formula.OfType<avm.SimpleFormula>()) { CyPhyML.SimpleFormula cyphy_simpleFormula = CyPhyClasses.SimpleFormula.Cast(CreateChild((ISIS.GME.Common.Interfaces.Model)cyphy_container, typeof(CyPhyClasses.SimpleFormula))); process(simpleFormula, cyphy_simpleFormula); } foreach (var complexFormula in ad_container.Formula.OfType<avm.ComplexFormula>()) { var cyphy_customFormula = CyPhyClasses.CustomFormula.Cast(CreateChild((ISIS.GME.Common.Interfaces.Model)cyphy_container, typeof(CyPhyClasses.CustomFormula))); processComplexFormula(complexFormula, cyphy_customFormula); } }