private static Descriptor CreatePropertyDescriptor(PropertyDefinition prop)
        {
            var desc = new Descriptor();
            desc.Name = prop.Name;

            if (prop.Type == PropertyDefinitionType.Geometry)
            {
                var g = (GeometricPropertyDefinition)prop;
                desc.Description = string.Format(Strings.FsPreview_GeometryPropertyNodeTooltip,
                    g.Name,
                    g.Description,
                    g.GeometryTypesToString(),
                    g.IsReadOnly,
                    g.HasElevation,
                    g.HasMeasure,
                    g.SpatialContextAssociation,
                    Environment.NewLine);
            }
            else if (prop.Type == PropertyDefinitionType.Data)
            {
                var d = (DataPropertyDefinition)prop;
                desc.Description = string.Format(Strings.FsPreview_DataPropertyNodeTooltip,
                    d.Name,
                    d.Description,
                    d.DataType.ToString(),
                    d.IsNullable,
                    d.IsReadOnly,
                    d.Length,
                    d.Precision,
                    d.Scale,
                    Environment.NewLine);
            }
            else if (prop.Type == PropertyDefinitionType.Raster)
            {
                var r = (RasterPropertyDefinition)prop;
                desc.Description = string.Format(Strings.FsPreview_RasterPropertyNodeTooltip,
                    r.Name,
                    r.Description,
                    r.IsNullable,
                    r.DefaultImageXSize,
                    r.DefaultImageYSize,
                    r.SpatialContextAssociation,
                    Environment.NewLine);
            }
            else
            {
                desc.Description = string.Format(Strings.FsPreview_GenericPropertyTooltip,
                    prop.Name,
                    prop.Type.ToString(),
                    Environment.NewLine);
            }

            return desc;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Removes the specified property from the properties collection. If it is a data property definition, it is also
        /// removed from the identity properties collection
        /// </summary>
        /// <param name="prop"></param>
        /// <returns></returns>
        public bool RemoveProperty(PropertyDefinition prop)
        {
            bool removed = _properties.Remove(prop);

            if (removed && prop.Type == PropertyDefinitionType.Data)
            {
                _identity.Remove((DataPropertyDefinition)prop);
                prop.Parent = null;
            }

            return removed;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Gets the index of the specified property
 /// </summary>
 /// <param name="prop"></param>
 /// <returns></returns>
 public int IndexOfProperty(PropertyDefinition prop)
 {
     return _properties.IndexOf(prop);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Adds the specified property definition
 /// </summary>
 /// <param name="prop"></param>
 public void AddProperty(PropertyDefinition prop)
 {
     if (!_properties.Contains(prop))
         _properties.Add(prop);
     prop.Parent = this;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Creates a clone of the specified instance
        /// </summary>
        /// <param name="prop">The instance to clone.</param>
        /// <returns></returns>
        public static PropertyDefinition Clone(PropertyDefinition prop)
        {
            switch (prop.Type)
            {
                case PropertyDefinitionType.Data:
                    {
                        var source = (DataPropertyDefinition)prop;
                        var dp = new DataPropertyDefinition(prop.Name, prop.Description);

                        dp.DataType = source.DataType;
                        dp.DefaultValue = source.DefaultValue;
                        dp.IsAutoGenerated = source.IsAutoGenerated;
                        dp.IsNullable = source.IsNullable;
                        dp.IsReadOnly = source.IsReadOnly;
                        dp.Length = source.Length;
                        dp.Precision = source.Precision;
                        dp.Scale = source.Scale;

                        return dp;
                    }
                case PropertyDefinitionType.Geometry:
                    {
                        var source = (GeometricPropertyDefinition)prop;
                        var gp = new GeometricPropertyDefinition(prop.Name, prop.Description);

                        gp.SpecificGeometryTypes = source.SpecificGeometryTypes;
                        gp.HasElevation = source.HasElevation;
                        gp.HasMeasure = source.HasMeasure;
                        gp.IsReadOnly = source.IsReadOnly;
                        gp.SpatialContextAssociation = source.SpatialContextAssociation;

                        return gp;
                    }
                case PropertyDefinitionType.Raster:
                    {
                        var source = (RasterPropertyDefinition)prop;
                        var rp = new RasterPropertyDefinition(prop.Name, prop.Description);

                        rp.DefaultImageXSize = source.DefaultImageXSize;
                        rp.DefaultImageYSize = source.DefaultImageYSize;
                        rp.IsNullable = source.IsNullable;
                        rp.IsReadOnly = source.IsReadOnly;
                        rp.SpatialContextAssociation = source.SpatialContextAssociation;

                        return rp;
                    }
            }
            throw new ArgumentException();
        }
Ejemplo n.º 6
0
 public PropertyItem(PropertyDefinition pd)
 {
     _propDef = pd;
 }