Example #1
0
        public WorldXmlWrapper ToXmlWrapper(IWorld wor)
        {
            WorldXmlWrapper p = new WorldXmlWrapper();

            p.UseBase = wor.UseBase;
            var par = wor.Parameters;

            p.BaseFieldXml = fpc.ToXmlWrapper(wor.BaseField);

            p.FieldsWrap = new List <FieldXmlWrapper>();

            p.ExportParametersWrap           = new ExportParametersXmlWrapper();
            p.ExportParametersWrap.MinHeight = wor.ExportParameters.MinHeight;
            p.ExportParametersWrap.MaxHeight = wor.ExportParameters.MaxHeight;

            p.ParametersWrap = new WorldParametersXmlWrapper();
            p.ParametersWrap.BitmapResolutionString = par.BitmapResolutionString;
            p.ParametersWrap.ErosionStrength        = par.ErosionStrength;

            foreach (var fld in wor.Fields)
            {
                p.FieldsWrap.Add(fpc.ToXmlWrapper(fld));
            }

            return(p);
        }
Example #2
0
        public IWorld ToObject(WorldXmlWrapper wrapper)
        {
            World p   = new World();
            var   par = wpc.ToObject(wrapper.ParametersWrap);

            p.UseBase = wrapper.UseBase;
            var bf = fpc.ToObject(wrapper.BaseFieldXml);

            p.BaseField = new BaseField(bf.Polygon, bf.Parameters);

            p.Parameters.BitmapResolutionString = par.BitmapResolutionString;
            p.Parameters.ErosionStrength        = par.ErosionStrength;


            p.ExportParameters.MaxHeight = wrapper.ExportParametersWrap.MaxHeight;
            p.ExportParameters.MinHeight = wrapper.ExportParametersWrap.MinHeight;

            foreach (var fld in wrapper.Fields)
            {
                p.Fields.Add(fpc.ToObject(fld));
            }

            return(p);
        }