Beispiel #1
0
        public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == typeof(System.String) &&
                value is GEMSMaterial)
            {
                GEMSMaterial material = (GEMSMaterial)value;

                return(material.Name);
            }

            if (destinationType == typeof(System.String) && value == null)
            {
                return("N/A");
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
Beispiel #2
0
        public GEMSSingle(XPathNavigator navigator, GEMSProject parent)
        {
            this.parent = parent;

            //Basic information
            id   = int.Parse(navigator.GetAttribute("id", string.Empty));
            name = navigator.GetAttribute("name", string.Empty);
            float transparency = float.Parse(navigator.GetAttribute("transparent", string.Empty));

            pec = navigator.GetAttribute("pec", string.Empty) == "0" ? false:true;

            //Material
            int materialId = int.Parse(navigator.GetAttribute("material", string.Empty));

            //Find the material in the material list of the project
            material = parent.SearchMaterial(materialId);
            if (material != null)
            {
                material.UsedSignalIds.Add(this.id);
            }

            //Color of the geometry belongs to this single
            navigator.MoveToChild("Color", string.Empty);
            int blue  = int.Parse(navigator.GetAttribute("blue", string.Empty));
            int red   = int.Parse(navigator.GetAttribute("red", string.Empty));
            int green = int.Parse(navigator.GetAttribute("green", string.Empty));

            singleColor = Color.FromArgb(GetModelMaterialTransparency(transparency), red, green, blue);
            navigator.MoveToParent( );

            //Operations
            LoadOperations(navigator);

            //Information of excitation or output
            currentEO = SingleEO.Load(navigator, this);

            UpdatePrimaryModel( );
            UpdateSingleEOSymbolModel( );
        }