예제 #1
0
        public RenderingRulesSetOptions()
        {
            IPropertiesSchema schema = new PropertiesSchema(null);

            propertiesBag = new PropertiesBag(schema, true);

            using (PropertiesSchemaBuilder builder = new PropertiesSchemaBuilder(schema))
            {
                builder
                .Add <bool>(SettingIdForceBackgroundColor).Default(false)
                .Add <GisColor>(SettingIdLandBackgroundColor).Default(new GisColor(unchecked (0xFFEFBF)))
                .Add <string>(SettingIdMinKosmosVersion)
                .Add <GisColor> (SettingIdSeaColor).Default(new GisColor(unchecked (0x5EAEFF)));
            }
        }
        public static PropertiesGroup Create(PropertiesEntry propertiesEntry, PropertiesSchema schema)
        {
            var restModel = new PropertiesGroup(schema.Name, schema.Key.Replace(".", "-"),
                                                schema.IsEditable, schema.Mode);

            foreach (var propertyInfo in schema.Properties)
            {
                var values = new List <PropertiesElementValue>();
                foreach (var propertiesValue in propertiesEntry.Properties)
                {
                    var value = propertiesValue.Value.GetType().GetProperty(propertyInfo.Key)?.GetValue(propertiesValue.Value, null);
                    values.Add(new PropertiesElementValue(propertiesValue.SiteId, value));
                }

                var property = new PropertiesElement(propertyInfo.Key.Replace(".", "-"), propertyInfo.Name,
                                                     propertyInfo.Type, values, propertyInfo.IsRequired);
                restModel.Properties.Add(property);
            }

            return(restModel);
        }