protected override void LoadFromDoc(System.Xml.Linq.XDocument doc) { _weatherSets = new UndoAwareObservableCollection <Weather>(this); XElement root = (XElement)doc.FirstNode; var sets = root.Element(FileDescriptions.FILE_SKY_EL_WEATHER_SETS); if (sets != null) { foreach (XElement weather in sets.Elements(FileDescriptions.FILE_SKY_EL_WEATHER)) { _weatherSets.Add(Weather.ReadFromXml(weather, this, OwnPath)); } } ClearUndoRedo(); }
public WeatherTimeRange(IUndoManager undoManager, L3dFilePath parentFile = null) : base(undoManager) { _sightDistance = 10000; _brightnessFactor = 1.0f; _variables = new UndoAwareObservableCollection <L3dVariable>(undoManager); _textures = new List <TextureEntry>(5); for (int i = 0; i < 5; i++) { TextureEntry en = new TextureEntry(); en._texture = L3dFilePath.CreateRelativeToFile(string.Empty, parentFile); en._tileU = 1; en._tileV = 1; _textures.Add(en); } }
protected override void LoadFromDoc(System.Xml.Linq.XDocument doc) { _weatherSet = new UndoAwareObservableCollection <WeatherTimeRange>(this); //WeatherSet.AllowNew = false; XElement root = (XElement)doc.FirstNode; XElement rootProps = doc.Elements().First().Element(FileDescriptions.FILE_GENERAL_EL_PROPS); if (rootProps != null) { _header = rootProps.Attribute(FileDescriptions.FILE_WEATHER_AT_PROPS_HEADER).Read <string>(string.Empty); } XElement illumination = root.Element(FileDescriptions.FILE_WEATHER_EL_ILLUMINATION); Illumination = AmbientIllumination.ReadFromXml(illumination, this, OwnPath); if (Illumination == null) { Illumination = new AmbientIllumination(this); } var set = root.Element(FileDescriptions.FILE_WEATHER_EL_WEATHER_SET); if (set != null) { List <WeatherTimeRange> tempL = new List <WeatherTimeRange>(); foreach (XElement timeRange in set.Elements(FileDescriptions.FILE_WEATHER_EL_TIME_RANGE)) { WeatherTimeRange r = WeatherTimeRange.ReadFromXml(timeRange, this, OwnPath); if (r != null) { tempL.Add(r); } } foreach (var it in tempL.OrderBy(w => w.Begin)) { _weatherSet.Add(it); } } ClearUndoRedo(); }
public SkyFile() { _weatherSets = new UndoAwareObservableCollection <Weather>(this); }
public WeatherFile() { _illumination = new AmbientIllumination(this); _weatherSet = new UndoAwareObservableCollection <WeatherTimeRange>(this); }