public static BHE.Building FromGBXML(this BHX.Location location) { BHE.Building building = new oM.Environment.Elements.Building(); building.Elevation = location.Elevation; building.Location.Longitude = location.Longitude; building.Location.Latitude = location.Latitude; BHP.BuildingContextFragment props = new BHP.BuildingContextFragment(); props.PlaceName = location.Name; props.WeatherStation = location.StationID.ID; building.Fragments.Add(props); return(building); }
public static BHX.Location ToGBXMLLocation(this BHE.Building building, GBXMLSettings settings) { BHX.Location location = new BHX.Location(); location.Longitude = Math.Round(building.Location.Longitude, settings.RoundingSettings.BuildingLocation); location.Latitude = Math.Round(building.Location.Latitude, settings.RoundingSettings.BuildingLocation); location.Elevation = Math.Round(building.Elevation, settings.RoundingSettings.BuildingLocation); BHP.BuildingContextFragment context = building.FindFragment <BHP.BuildingContextFragment>(typeof(BHP.BuildingContextFragment)); if (context != null) { location.Name = context.PlaceName; location.StationID.ID = context.WeatherStation; } return(location); }