Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aligning with Grid and Level migration to Spatial #2732

Merged
merged 3 commits into from
Jan 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions Architecture_Engine/Query/Geometry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

using BH.Engine.Geometry;
using BH.oM.Architecture.BuildersWork;
using BH.oM.Architecture.Elements;
using BH.oM.Geometry;
using BH.oM.Geometry.CoordinateSystem;
using BH.oM.Base.Attributes;
Expand All @@ -38,16 +37,6 @@ public static partial class Query
/**** Public Methods ****/
/***************************************************/

[Description("Extracts geometry of the given Grid.")]
[Input("grid", "Grid to be queried for its geometry.")]
[Output("Geometry of the input Grid.")]
public static ICurve Geometry(this Grid grid)
{
return grid?.Curve;
}

/***************************************************/

[Description("Extracts geometry of the given Theatron.")]
[Input("theatron", "Theatron to be queried for its geometry.")]
[Output("Geometry of the input Theatron.")]
Expand Down
20 changes: 10 additions & 10 deletions Environment_Engine/Compute/MapToLevel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
using BH.oM.Geometry;
using BH.oM.Environment.Elements;
using BH.oM.Architecture.Elements;
using BH.oM.Geometry.SettingOut;
using BH.oM.Spatial.SettingOut;

using BH.Engine.Geometry;
using BH.oM.Base;
Expand All @@ -50,16 +50,16 @@ public static partial class Compute
[MultiOutput(1, "levelsInUse", "A sublist of the BHoM Levels that have Room.")]
[MultiOutput(2, "regionsNotMapped", "A collection of BHoM Regions which did not sit neatly on any of the provided levels")]
[PreviousInputNames("regions", "spaces, rooms")]
public static Output<List<List<IRegion>>, List<oM.Geometry.SettingOut.Level>, List<IRegion>> MapToLevel(List<IRegion> regions, List<oM.Geometry.SettingOut.Level> levels, int decimals = 6)
public static Output<List<List<IRegion>>, List<oM.Spatial.SettingOut.Level>, List<IRegion>> MapToLevel(List<IRegion> regions, List<oM.Spatial.SettingOut.Level> levels, int decimals = 6)
{
List<List<IRegion>> regionsByLevel = new List<List<IRegion>>();
List<oM.Geometry.SettingOut.Level> levelsInUse = new List<oM.Geometry.SettingOut.Level>();
List<oM.Spatial.SettingOut.Level> levelsInUse = new List<oM.Spatial.SettingOut.Level>();
List<IRegion> regionsNotByLevel = new List<IRegion>();
List<oM.Geometry.SettingOut.Level> roundedLevels = new List<oM.Geometry.SettingOut.Level>();
List<oM.Spatial.SettingOut.Level> roundedLevels = new List<oM.Spatial.SettingOut.Level>();

for (int x = 0; x < levels.Count; x++)
{
oM.Geometry.SettingOut.Level lvl = levels[x].DeepClone();
oM.Spatial.SettingOut.Level lvl = levels[x].DeepClone();
lvl.Elevation = Math.Round(lvl.Elevation, decimals);
roundedLevels.Add(lvl); //Round the levels
}
Expand All @@ -72,7 +72,7 @@ public static partial class Compute
BoundingBox bbox = region.Perimeter.IBounds();
double zLevel = Math.Round(bbox.Min.Z, decimals);

oM.Geometry.SettingOut.Level roundedLevel = roundedLevels.Where(x => x.Elevation == zLevel).FirstOrDefault();
oM.Spatial.SettingOut.Level roundedLevel = roundedLevels.Where(x => x.Elevation == zLevel).FirstOrDefault();
if (roundedLevel == null)
{
regionsNotByLevel.Add(region);
Expand All @@ -98,7 +98,7 @@ public static partial class Compute
foreach (KeyValuePair<double, List<IRegion>> kvp in mappedRooms.OrderBy(x => x.Key))
regionsByLevel.Add(kvp.Value);

Output<List<List<IRegion>>, List<oM.Geometry.SettingOut.Level>, List<IRegion>> output = new Output<List<List<IRegion>>, List<oM.Geometry.SettingOut.Level>, List<IRegion>>
Output<List<List<IRegion>>, List<oM.Spatial.SettingOut.Level>, List<IRegion>> output = new Output<List<List<IRegion>>, List<oM.Spatial.SettingOut.Level>, List<IRegion>>
{
Item1 = regionsByLevel,
Item2 = levelsInUse.OrderBy(x => x.Elevation).Distinct().ToList(),
Expand All @@ -117,10 +117,10 @@ public static partial class Compute
[MultiOutput(0, "regionsByLevel", "A collection of BHoM Regions grouped by levels.")]
[MultiOutput(1, "levelsInUse", "A sublist of the BHoM Levels that have Room.")]
[MultiOutput(2, "regionsNotMapped", "A collection of BHoM Regions which did not sit neatly on any of the provided levels")]
public static Output<List<List<IRegion>>, List<oM.Geometry.SettingOut.Level>, List<IRegion>> MaptoLevel(List<IRegion> regions, int decimals = 6)
public static Output<List<List<IRegion>>, List<oM.Spatial.SettingOut.Level>, List<IRegion>> MaptoLevel(List<IRegion> regions, int decimals = 6)
{
List<oM.Geometry.SettingOut.Level> levels = Create.Levels(regions);
Output<List<List<IRegion>>, List<oM.Geometry.SettingOut.Level>, List<IRegion>> output = MapToLevel(regions, levels, decimals);
List<oM.Spatial.SettingOut.Level> levels = Create.Levels(regions);
Output<List<List<IRegion>>, List<oM.Spatial.SettingOut.Level>, List<IRegion>> output = MapToLevel(regions, levels, decimals);

return output;
}
Expand Down
6 changes: 3 additions & 3 deletions Environment_Engine/Create/Levels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
using BH.oM.Environment.Elements;
using BH.oM.Geometry;
using BH.Engine.Geometry;
using BH.oM.Geometry.SettingOut;
using BH.oM.Spatial.SettingOut;

using BH.oM.Quantities.Attributes;
using BH.Engine.Spatial;
Expand Down Expand Up @@ -60,10 +60,10 @@ public static List<Level> Levels(List<IRegion> regions, int decimals = 6, double
double minLevel = regionPolyline.MinimumLevel(decimals);
double maxLevel = regionPolyline.MaximumLevel(decimals);

levels.Add(BH.Engine.Geometry.Create.Level(Math.Round(minLevel, decimals)));
levels.Add(BH.Engine.Spatial.Create.Level(Math.Round(minLevel, decimals)));

if (minLevel != maxLevel)
levels.Add(BH.Engine.Geometry.Create.Level(Math.Round(maxLevel, decimals)));
levels.Add(BH.Engine.Spatial.Create.Level(Math.Round(maxLevel, decimals)));
}

return levels;
Expand Down
2 changes: 1 addition & 1 deletion Environment_Engine/Query/FilterOpenings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
using BH.oM.Physical.Elements;
using BH.Engine.Geometry;

using BH.oM.Geometry.SettingOut;
using BH.oM.Spatial.SettingOut;


namespace BH.Engine.Environment
Expand Down
2 changes: 1 addition & 1 deletion Environment_Engine/Query/FilterPanels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
using BH.oM.Geometry;
using BH.Engine.Geometry;
using BH.oM.Base;
using BH.oM.Geometry.SettingOut;
using BH.oM.Spatial.SettingOut;

namespace BH.Engine.Environment
{
Expand Down
2 changes: 1 addition & 1 deletion Environment_Engine/Query/FindDuplicatePanels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
using BH.oM.Base.Attributes;
using System.ComponentModel;

using BH.oM.Geometry.SettingOut;
using BH.oM.Spatial.SettingOut;

using BH.Engine.Base;

Expand Down
2 changes: 1 addition & 1 deletion Environment_Engine/Query/FloorHeights.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

using BH.Engine.Base;

using BH.oM.Geometry.SettingOut;
using BH.oM.Spatial.SettingOut;

namespace BH.Engine.Environment
{
Expand Down
2 changes: 1 addition & 1 deletion Environment_Engine/Query/IsOnLevel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
using System.ComponentModel;

using BH.oM.Geometry;
using BH.oM.Geometry.SettingOut;
using BH.oM.Spatial.SettingOut;
using BH.oM.Base.Attributes;

namespace BH.Engine.Environment
Expand Down
2 changes: 1 addition & 1 deletion Environment_Engine/Query/Level.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
using BH.oM.Geometry;
using BH.Engine.Geometry;

using BH.oM.Geometry.SettingOut;
using BH.oM.Spatial.SettingOut;
using BH.oM.Base;

using BH.oM.Base.Attributes;
Expand Down
2 changes: 1 addition & 1 deletion Environment_Engine/Query/MaximumLevel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
using BH.oM.Geometry;
using BH.Engine.Geometry;

using BH.oM.Geometry.SettingOut;
using BH.oM.Spatial.SettingOut;
using BH.oM.Base;

using BH.oM.Base.Attributes;
Expand Down
2 changes: 1 addition & 1 deletion Environment_Engine/Query/MinimumLevel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
using BH.oM.Geometry;
using BH.Engine.Geometry;

using BH.oM.Geometry.SettingOut;
using BH.oM.Spatial.SettingOut;
using BH.oM.Base;

using BH.oM.Base.Attributes;
Expand Down
2 changes: 1 addition & 1 deletion Environment_Engine/Query/Openings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
using BH.oM.Physical.Elements;
using BH.Engine.Geometry;

using BH.oM.Geometry.SettingOut;
using BH.oM.Spatial.SettingOut;

namespace BH.Engine.Environment
{
Expand Down
2 changes: 1 addition & 1 deletion Environment_Engine/Query/OpeningsFromElements.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
using BH.oM.Physical.Elements;
using BH.Engine.Geometry;

using BH.oM.Geometry.SettingOut;
using BH.oM.Spatial.SettingOut;

namespace BH.Engine.Environment
{
Expand Down
2 changes: 1 addition & 1 deletion Environment_Engine/Query/OpeningsFromPhysical.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
using BH.oM.Physical.Elements;
using BH.Engine.Geometry;

using BH.oM.Geometry.SettingOut;
using BH.oM.Spatial.SettingOut;

namespace BH.Engine.Environment
{
Expand Down
2 changes: 1 addition & 1 deletion Environment_Engine/Query/PanelByGuid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
using BH.oM.Base.Attributes;
using System.ComponentModel;

using BH.oM.Geometry.SettingOut;
using BH.oM.Spatial.SettingOut;

using BH.Engine.Base;

Expand Down
2 changes: 1 addition & 1 deletion Environment_Engine/Query/Panels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
using BH.oM.Base.Attributes;
using System.ComponentModel;

using BH.oM.Geometry.SettingOut;
using BH.oM.Spatial.SettingOut;

using BH.Engine.Base;

Expand Down
2 changes: 1 addition & 1 deletion Environment_Engine/Query/PanelsContainingPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
using BH.oM.Base.Attributes;
using System.ComponentModel;

using BH.oM.Geometry.SettingOut;
using BH.oM.Spatial.SettingOut;

using BH.Engine.Base;

Expand Down
2 changes: 1 addition & 1 deletion Environment_Engine/Query/PanelsFromPhysical.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
using BH.oM.Base.Attributes;
using System.ComponentModel;

using BH.oM.Geometry.SettingOut;
using BH.oM.Spatial.SettingOut;

using BH.Engine.Base;

Expand Down
2 changes: 1 addition & 1 deletion Environment_Engine/Query/RegionLevel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
using System.Threading.Tasks;
using System.ComponentModel;

using BH.oM.Geometry.SettingOut;
using BH.oM.Spatial.SettingOut;
using BH.Engine.Geometry;
using BH.oM.Geometry;
using BH.oM.Environment.Elements;
Expand Down
2 changes: 1 addition & 1 deletion Environment_Engine/Query/StoreyGeometry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

using BH.oM.Geometry;
using BH.Engine.Geometry;
using BH.oM.Geometry.SettingOut;
using BH.oM.Spatial.SettingOut;

using BH.oM.Base.Attributes;
using System.ComponentModel;
Expand Down
2 changes: 1 addition & 1 deletion Environment_Engine/Query/UniqueOpeningInstances.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
using BH.oM.Physical.Elements;
using BH.Engine.Geometry;

using BH.oM.Geometry.SettingOut;
using BH.oM.Spatial.SettingOut;

namespace BH.Engine.Environment
{
Expand Down
2 changes: 1 addition & 1 deletion Environment_Engine/Query/UniquePanelInstances.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
using BH.oM.Base.Attributes;
using System.ComponentModel;

using BH.oM.Geometry.SettingOut;
using BH.oM.Spatial.SettingOut;

using BH.Engine.Base;

Expand Down
2 changes: 1 addition & 1 deletion Environment_Engine/Query/UniquePanels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
using BH.oM.Base.Attributes;
using System.ComponentModel;

using BH.oM.Geometry.SettingOut;
using BH.oM.Spatial.SettingOut;

using BH.Engine.Base;

Expand Down
10 changes: 0 additions & 10 deletions Geometry_Engine/Modify/SetGeometry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

using BH.Engine.Base;
using BH.oM.Geometry;
using BH.oM.Geometry.SettingOut;

namespace BH.Engine.Geometry
{
Expand Down Expand Up @@ -86,15 +85,6 @@ public static ICurve SetGeometry(this PolyCurve curve, ICurve newCurve)
return newCurve.DeepClone();
}

/***************************************************/

public static Grid SetGeometry(this Grid grid, ICurve curve)
{
Grid clone = grid.ShallowClone();
clone.Curve = curve.DeepClone();
return clone;
}

/***************************************************/
/**** Interface Methods ****/
/***************************************************/
Expand Down
9 changes: 0 additions & 9 deletions Geometry_Engine/Query/Geometry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/

using BH.oM.Geometry;
using BH.oM.Geometry.SettingOut;

namespace BH.Engine.Geometry
{
Expand Down Expand Up @@ -85,14 +84,6 @@ public static ICurve Geometry(this PolyCurve curve)
return curve;
}

/***************************************************/

public static ICurve Geometry(this Grid grid)
{
return grid?.Curve;
}


/***************************************************/
/**** Interface Methods ****/
/***************************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
*/

using BH.oM.Geometry;
using BH.oM.Geometry.SettingOut;
using BH.oM.Spatial.SettingOut;
using BH.oM.Quantities.Attributes;
using BH.oM.Base.Attributes;
using BH.Engine.Geometry;
using System.ComponentModel;

namespace BH.Engine.Geometry.SettingOut
namespace BH.Engine.Spatial
{
public static partial class Create
{
Expand All @@ -38,8 +39,9 @@ public static partial class Create
[Input("curve", "Curve to be used as grid curve. Will be projected to the XY Plane.")]
[Input("name", "Optional name of the Grid.")]
[Output("grid", "A Grid in the XY Plane.")]
[PreviousVersion("5.1", "BH.Engine.Architecture.Create.Grid(BH.oM.Geometry.ICurve)")]
[PreviousVersion("5.1", "BH.Engine.Architecture.Create.Grid(BH.oM.Geometry.ICurve, System.String)")]
[PreviousVersion("5.1", "BH.Engine.Architecture.Elements.Create.Grid(BH.oM.Geometry.ICurve)")]
[PreviousVersion("5.1", "BH.Engine.Architecture.Elements.Create.Grid(BH.oM.Geometry.ICurve, System.String)")]
[PreviousVersion("5.1", "BH.Engine.Geometry.SettingOut.Create.Grid(BH.oM.Geometry.ICurve, System.String)")]
public static Grid Grid(ICurve curve, string name = "")
{
return new Grid
Expand All @@ -57,8 +59,9 @@ public static Grid Grid(ICurve curve, string name = "")
[Input("length", "Length of the output Grid line.", typeof(Length))]
[Input("name", "Optional name of the Grid.")]
[Output("grid", "A Grid in the XY Plane.")]
[PreviousVersion("5.1", "BH.Engine.Architecture.Create.Grid(BH.oM.Geometry.Point, BH.oM.Geometry.Vector, System.Double)")]
[PreviousVersion("5.1", "BH.Engine.Architecture.Create.Grid(BH.oM.Geometry.Point, BH.oM.Geometry.Vector, System.String, System.Double)")]
[PreviousVersion("5.1", "BH.Engine.Architecture.Elements.Create.Grid(BH.oM.Geometry.Point, BH.oM.Geometry.Vector, System.Double)")]
[PreviousVersion("5.1", "BH.Engine.Architecture.Elements.Create.Grid(BH.oM.Geometry.Point, BH.oM.Geometry.Vector, System.String, System.Double)")]
[PreviousVersion("5.1", "BH.Engine.Geometry.SettingOut.Create.Grid(BH.oM.Geometry.Point, BH.oM.Geometry.Vector, System.Double, System.String)")]
public static Grid Grid(Point origin, Vector direction, double length = 20, string name = "")
{
Point projectedOrigin = origin.Project(Plane.XY);
Expand Down
Loading