Skip to content

Commit

Permalink
Merge branch 'master' into Diffing_Engine-#2095-leveragePersistentId
Browse files Browse the repository at this point in the history
  • Loading branch information
alelom committed Dec 1, 2020
2 parents 843acf5 + ed3ba07 commit 5dee50e
Show file tree
Hide file tree
Showing 125 changed files with 1,125 additions and 3,322 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public static partial class Create
/**** Public Methods ****/
/***************************************************/

[PreviousVersion("4.0", "BH.Engine.Structure.Create.NewInternalElement2D(BH.oM.Structure.Elements.Panel)")]
[Description("Creates a new Element2D, appropriate to the input type. For this case the appropriate type for the Panel will be a new Opening, in the position provided. \n" +
"Method required for any IElement2D that contians internal IElement2Ds.")]
[Input("panel", "Panel just used to determine the appropriate type of IElement2D to create.")]
Expand Down
26 changes: 22 additions & 4 deletions Analytical_Engine/Modify/SetGeometry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
using BH.oM.Analytical.Elements;
using BH.oM.Geometry;
using BH.Engine.Geometry;
using BH.oM.Base;
using BH.Engine.Base;

namespace BH.Engine.Analytical
{
Expand All @@ -38,19 +38,22 @@ public static partial class Modify
/**** Public Methods ****/
/***************************************************/

[PreviousVersion("4.0", "BH.Engine.Structure.Modify.SetGeometry(BH.oM.Structure.Elements.Node, BH.oM.Geometry.Point)")]
[Description("Updates the position of a INode.")]
[Input("node", "The INode to set the postion to.")]
[Input("point", "The new position of the INode.")]
[Output("node", "The INode with updated geometry.")]
public static INode SetGeometry(this INode node, Point point)
{
INode clone = node.GetShallowClone(true) as INode;
INode clone = node.ShallowClone();
clone.Position = point.Clone();
return clone;
}

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

[PreviousInputNames("link", "bar")]
[PreviousVersion("4.0", "BH.Engine.Structure.Modify.SetGeometry(BH.oM.Structure.Elements.Bar, BH.oM.Geometry.ICurve)")]
[Description("Updates geometry of an ILink by updating the positions of its end Nodes.")]
[Input("link", "The ILink to update.")]
[Input("curve", "The new centreline curve of the ILink. Should be a linear curve. \n" +
Expand All @@ -65,25 +68,40 @@ public static ILink<TNode> SetGeometry<TNode>(this ILink<TNode> link, ICurve cur
return null;
}

ILink<TNode> clone = link.GetShallowClone(true) as ILink<TNode>;
ILink<TNode> clone = link.ShallowClone();
clone.StartNode = (TNode)clone.StartNode.SetGeometry(curve.IStartPoint());
clone.EndNode = (TNode)clone.EndNode.SetGeometry(curve.IEndPoint());
return clone;
}

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

[PreviousVersion("4.0", "BH.Engine.Structure.Modify.SetGeometry(BH.oM.Structure.Elements.Edge, BH.oM.Geometry.ICurve)")]
[Description("Updates the curve geometry of an IEdge.")]
[Input("edge", "The IEdge to update.")]
[Input("curve", "The curve to set to the IEdge.")]
[Output("edge", "The IEdge with updated geometry.")]
public static IEdge SetGeometry(this IEdge edge, ICurve curve)
{
IEdge clone = edge.GetShallowClone(true) as IEdge;
IEdge clone = edge.ShallowClone();
clone.Curve = curve.IClone();
return clone;
}

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

[PreviousInputNames("anaSurface", "strSurface")]
[PreviousVersion("4.0", "BH.Engine.Structure.Modify.SetGeometry(BH.oM.Structure.Elements.Surface, BH.oM.Geometry.ISurface)")]
[Description("Updates the geometrical ISurface of a analytical ISurface.")]
[Input("anaSurface", "The analytical Surface to update.")]
[Input("geoSurface", "The geometrical ISurface to set to the structural Surface.")]
[Output("strSurface", "The analytical Surface with updated geometry.")]
public static BH.oM.Analytical.Elements.ISurface SetGeometry(this BH.oM.Analytical.Elements.ISurface anaSurface, BH.oM.Geometry.ISurface geoSurface)
{
anaSurface.Extents = geoSurface;
return anaSurface;
}

/***************************************************/
}
}
4 changes: 3 additions & 1 deletion Analytical_Engine/Modify/SetInternalElements2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
using System.Linq;
using BH.oM.Reflection.Attributes;
using System.ComponentModel;
using BH.Engine.Base;


namespace BH.Engine.Analytical
Expand All @@ -37,6 +38,7 @@ public static partial class Modify
/**** Public Methods ****/
/***************************************************/

[PreviousVersion("4.0", "BH.Engine.Structure.Modify.SetInternalElements2D(BH.oM.Structure.Elements.Panel, System.Collections.Generic.List<BH.oM.Dimensional.IElement2D>)")]
[Description("Sets internal IElement2Ds of a IPanel, i.e. sets the Openings of an IPanel. Method required for all IElement2Ds.")]
[Input("panel", "The IPanel to update.")]
[Input("openings", "The internal IElement2Ds to set. For an IPanel this should be a list of Openings matching the type of the IPanel.")]
Expand All @@ -45,7 +47,7 @@ public static IPanel<TEdge, TOpening> SetInternalElements2D<TEdge, TOpening>(thi
where TEdge : IEdge
where TOpening : IOpening<TEdge>
{
IPanel<TEdge, TOpening> pp = panel.GetShallowClone() as IPanel<TEdge, TOpening>;
IPanel<TEdge, TOpening> pp = panel.ShallowClone();
pp.Openings = new List<TOpening>(openings.Cast<TOpening>().ToList());
return pp;
}
Expand Down
8 changes: 5 additions & 3 deletions Analytical_Engine/Modify/SetOutlineElements1D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public static partial class Modify
/**** Public Methods ****/
/***************************************************/

[PreviousVersion("4.0", "BH.Engine.Structure.Modify.SetOutlineElements1D(BH.oM.Structure.Elements.Opening, System.Collections.Generic.List<BH.oM.Dimensional.IElement1D>)")]
[Description("Sets the Outline Element1Ds of an opening, i.e. the Edges of an Opening. Method required for all IElement2Ds.")]
[Input("opening", "The Opening to update the Edges of.")]
[Input("edges", "A list of IElement1Ds which all should be of a type of Edge accepted by the Opening or Geometrical ICurve. \n" +
Expand All @@ -48,14 +49,15 @@ public static partial class Modify
public static IOpening<TEdge> SetOutlineElements1D<TEdge>(this IOpening<TEdge> opening, IEnumerable<IElement1D> edges)
where TEdge : IEdge
{
IOpening<TEdge> o = opening.GetShallowClone(true) as IOpening<TEdge>;
IOpening<TEdge> o = opening.ShallowClone();

o.Edges = ConvertToEdges<TEdge>(edges);
return o;
}

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

[PreviousVersion("4.0", "BH.Engine.Structure.Modify.SetOutlineElements1D(BH.oM.Structure.Elements.Panel, System.Collections.Generic.List<BH.oM.Dimensional.IElement1D>)")]
[Description("Sets the outline Element1Ds of a IPanel, i.e. the ExternalEdges of a IPanel. Method required for all IElement2Ds.")]
[Input("panel", "The IPanel to update the ExternalEdges of.")]
[Input("edges", "A list of IElement1Ds which all should be of a type of Edge accepted by the IPanel or Geometrical ICurve. \n" +
Expand All @@ -65,7 +67,7 @@ public static IPanel<TEdge, TOpening> SetOutlineElements1D<TEdge, TOpening>(this
where TEdge : IEdge
where TOpening : IOpening<TEdge>
{
IPanel<TEdge, TOpening> pp = panel.GetShallowClone(true) as IPanel<TEdge, TOpening>;
IPanel<TEdge, TOpening> pp = panel.ShallowClone();

pp.ExternalEdges = ConvertToEdges<TEdge>(edges);
return pp;
Expand All @@ -79,7 +81,7 @@ public static IPanel<TEdge, TOpening> SetOutlineElements1D<TEdge, TOpening>(this
[Output("region", "The region with updated perimiter.")]
public static IRegion SetOutlineElements1D(this IRegion region, IEnumerable<IElement1D> outlineElements)
{
IRegion r = region.GetShallowClone(true) as IRegion;
IRegion r = region.ShallowClone();

IEnumerable<ICurve> joinedCurves = outlineElements.Cast<ICurve>();
if (outlineElements.Count() != 1)
Expand Down
2 changes: 2 additions & 0 deletions Analytical_Engine/Query/Elements0D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public static partial class Query
/**** IElement1D ****/
/******************************************/

[PreviousInputNames("link", "bar")]
[PreviousVersion("4.0", "BH.Engine.Structure.Query.Elements0D(BH.oM.Structure.Elements.Bar)")]
[Description("Gets the Element0Ds of an ILink, which for the case of a ILink means getting the StartNode and EndNode. Method necessary for IElement pattern.")]
[Input("link", "The ILink to extract IElement0ds from.")]
[Output("element0Ds", "The list of Elements0D of the ILink, i.e. the StartNode and EndNode.")]
Expand Down
12 changes: 12 additions & 0 deletions Analytical_Engine/Query/Geometry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public static partial class Query
/**** Public Methods ****/
/***************************************************/

[PreviousVersion("4.0", "BH.Engine.Structure.Query.Geometry(BH.oM.Structure.Elements.Node)")]
[Description("Gets the geometry of a INode as a Point. Method required for automatic display in UI packages.")]
[Input("node", "INode to get the Point from.")]
[Output("point", "The geometry of the INode.")]
Expand All @@ -53,6 +54,8 @@ public static Point Geometry(this INode node)

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

[PreviousInputNames("link", "bar")]
[PreviousVersion("4.0", "BH.Engine.Structure.Query.Geometry(BH.oM.Structure.Elements.Bar)")]
[Description("Gets the geometry of a ILink as its centreline. Method required for automatic display in UI packages.")]
[Input("link", "ILink to get the centreline geometry from.")]
[Output("line", "The geometry of the ILink as its centreline.")]
Expand All @@ -64,6 +67,7 @@ public static Line Geometry<TNode>(this ILink<TNode> link)

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

[PreviousVersion("4.0", "BH.Engine.Structure.Query.Geometry(BH.oM.Structure.Elements.Edge)")]
[Description("Gets the geometry of a IEdge as its Curve. Method required for automatic display in UI packages.")]
[Input("edge", "IEdge to get the curve geometry from.")]
[Output("curve", "The geometry of the IEdge as its Curve.")]
Expand All @@ -74,6 +78,7 @@ public static ICurve Geometry(this IEdge edge)

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

[PreviousVersion("4.0", "BH.Engine.Structure.Query.Geometry(BH.oM.Structure.Elements.Panel)")]
[Description("Gets the geometry of a analytical IPanel at its centre. Method required for automatic display in UI packages.")]
[Input("panel", "IPanel to get the planar surface geometry from.")]
[Output("surface", "The geometry of the analytical IPanel at its centre.")]
Expand All @@ -100,6 +105,7 @@ public static PolyCurve Geometry<TEdge>(this IOpening<TEdge> opening)

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

[PreviousVersion("4.0", "BH.Engine.Structure.Query.Geometry(BH.oM.Structure.Elements.Surface)")]
[Description("Gets the geometry of a analytical ISurface at its centre. Method required for automatic display in UI packages.")]
[Input("surface", "Analytical ISurface to get the geometrical Surface geometry from.")]
[Output("surface", "The underlying surface geometry of the analytical ISurface at its centre.")]
Expand All @@ -110,6 +116,8 @@ public static IGeometry Geometry(this BH.oM.Analytical.Elements.ISurface surface

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

[PreviousInputNames("mesh", "feMesh")]
[PreviousVersion("4.0", "BH.Engine.Structure.Query.Geometry(BH.oM.Structure.Elements.FEMesh)")]
[Description("Gets the geometry of a analytical IMesh as a geometrical Mesh. A geometrical mesh only supports 3 and 4 nodes faces, while a FEMesh does not have this limitation. For FEMeshFaces with more than 4 nodes or less than 3 this operation is therefore not possible. Method required for automatic display in UI packages.")]
[Input("mesh", "Analytical IMesh to get the mesh geometry from.")]
[Output("mesh", "The geometry of the IMesh as a geometrical Mesh.")]
Expand All @@ -128,6 +136,8 @@ public static Mesh Geometry<TNode, TFace>(this IMesh<TNode, TFace> mesh)

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

[PreviousInputNames("faces", "feFaces")]
[PreviousVersion("4.0", "BH.Engine.Structure.Query.Geometry(System.Collections.Generic.IEnumerable<BH.oM.Structure.Elements.FEMeshFace>)")]
[Description("Gets the geometry of a collection of IFaces as a geometrical Mesh's Faces. A geometrical mesh face only supports 3 and 4 nodes faces, while a FEMeshFace does not have this limitation. For FEMeshFaces with more than 4 nodes or less than 3 this operation is therefore not possible. Method required for automatic display in UI packages.")]
[Input("faces", "Analytical IFaces to get the mesh faces geometry from.")]
[Output("faces", "The geometry of the IFaces as geometrical Mesh Faces.")]
Expand All @@ -146,6 +156,8 @@ public static IEnumerable<Face> Geometry<TFace>(this IEnumerable<TFace> faces)

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

[PreviousInputNames("face", "feFace")]
[PreviousVersion("4.0", "BH.Engine.Structure.Query.Geometry(BH.oM.Structure.Elements.FEMeshFace)")]
[Description("Gets the geometry of a analytical IFace as a geometrical Mesh's Face. A geometrical mesh face only supports 3 and 4 nodes faces, while a FEMeshFace does not have this limitation. For FEMeshFaces with more than 4 nodes or less than 3 this operation is therefore not possible. Method required for automatic display in UI packages.")]
[Input("face", "Analytical IFace to get the mesh face geometry from.")]
[Output("face", "The geometry of the IFace as geometrical Mesh Face.")]
Expand Down
1 change: 1 addition & 0 deletions Analytical_Engine/Query/InternalElements2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static partial class Query
/**** Public Methods ****/
/***************************************************/

[PreviousVersion("4.0", "BH.Engine.Structure.Query.InternalElements2D(BH.oM.Structure.Elements.Panel)")]
[Description("Gets inner IElement2Ds from a IPanel. Method required for all IElement2Ds. \n" +
"For a IPanel this method will return a list of all of its openings.")]
[Input("panel", "The IPanel to get internal IElement2Ds from.")]
Expand Down
2 changes: 2 additions & 0 deletions Analytical_Engine/Query/OutlineElements1D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public static partial class Query
/**** Public Methods ****/
/***************************************************/

[PreviousVersion("4.0", "BH.Engine.Structure.Query.OutlineElements1D(BH.oM.Structure.Elements.Opening)")]
[Description("Gets the edge elements from an IOpening defining the boundary of the element. Method required for all IElement2Ds. \n" +
"For an IOpening this will return a list of its Edges.")]
[Input("opening", "The IOpening to get outline elements from.")]
Expand All @@ -49,6 +50,7 @@ public static List<IElement1D> OutlineElements1D<TEdge>(this IOpening<TEdge> ope

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

[PreviousVersion("4.0", "BH.Engine.Structure.Query.OutlineElements1D(BH.oM.Structure.Elements.Panel)")]
[Description("Gets the edge elements from an IPanel defining the boundary of the element. Method required for all IElement2Ds. \n" +
"For an IPanel this will return a list of its ExternalEdges.")]
[Input("panel", "The IPanel to get outline elements from.")]
Expand Down
5 changes: 3 additions & 2 deletions Architecture_Engine/Create/Theatron/ProfileOrigin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
using BH.Engine.Geometry;
using System.ComponentModel;
using BH.oM.Reflection.Attributes;
using BH.Engine.Base;

namespace BH.Engine.Architecture.Theatron
{
Expand All @@ -43,9 +44,9 @@ public static ProfileOrigin ProfileOrigin(Point origin,Vector direction)
if (direction.Z != 0) direction.Z = 0;
return new ProfileOrigin {

Origin = origin.Clone(),
Origin = origin.ShallowClone(),

Direction = direction.Clone(),
Direction = direction.ShallowClone(),

};

Expand Down
4 changes: 2 additions & 2 deletions Architecture_Engine/Create/Theatron/SeatingBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,14 @@ private static void SetBlockFloorBasic(ref SeatingBlock block)
List<Point> vertices = new List<Point>();
for (int j = 0; j < block.Sections.Count; j++)
{
temp = block.Sections[j].FloorPoints.Select(item => item.Clone()).ToList();
temp = block.Sections[j].FloorPoints.Select(item => item.ShallowClone()).ToList();

if (j == 1)//on the vom
{
//transfrom right
for (int p = 0; p < temp.Count; p++) temp[p] = temp[p] + rightShift;
vertices.AddRange(temp);
temp = block.Sections[j].FloorPoints.Select(item => item.Clone()).ToList();
temp = block.Sections[j].FloorPoints.Select(item => item.ShallowClone()).ToList();
//transfrom left
for (int p = 0; p < temp.Count; p++) temp[p] = temp[p] + leftShift;
}
Expand Down
2 changes: 1 addition & 1 deletion Architecture_Engine/Modify/CleanRoom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static partial class Modify
[Output("cleanedRoom", "A room that has been cleaned")]
public static Room CleanRoom(this Room room, double angleTolerance = Tolerance.Angle, double minimumSegmentLength = Tolerance.Distance)
{
Room clonedRoom = room.DeepClone<Room>();
Room clonedRoom = room.DeepClone();
clonedRoom.Perimeter = clonedRoom.Perimeter.ICollapseToPolyline(Tolerance.Angle).CleanPolyline(angleTolerance, minimumSegmentLength);
return clonedRoom;
}
Expand Down
10 changes: 5 additions & 5 deletions Architecture_Engine/Modify/SetGeometry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public static partial class Modify
[Deprecated("2.4", "BH.Engine.Architecture.Elements.Grid superseded by BH.oM.Geometry.SettingOut.Grid")]
public static Grid SetGeometry(this Grid grid, ICurve curve)
{
Grid clone = grid.GetShallowClone() as Grid;
clone.Curve = curve.IClone();
Grid clone = grid.ShallowClone() as Grid;
clone.Curve = curve.DeepClone();
return clone;
}

Expand All @@ -52,9 +52,9 @@ public static Grid SetGeometry(this Grid grid, ICurve curve)
[Output("room", "An Architecture Room with an updated geometry")]
public static Room SetGeometry(this Room room, Point locationPoint = null, ICurve perimeterCurve = null)
{
Room clone = room.DeepClone<Room>();
clone.Location = locationPoint == null ? room.Location.DeepClone<Point>() : locationPoint;
clone.Perimeter = perimeterCurve == null ? room.Perimeter.DeepClone<ICurve>() : perimeterCurve;
Room clone = room.DeepClone();
clone.Location = locationPoint == null ? room.Location.DeepClone() : locationPoint;
clone.Perimeter = perimeterCurve == null ? room.Perimeter.DeepClone() : perimeterCurve;
return clone;
}
}
Expand Down
3 changes: 2 additions & 1 deletion Architecture_Engine/Modify/SetOutlineElements1D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

using BH.oM.Reflection.Attributes;
using System.ComponentModel;
using BH.Engine.Base;

namespace BH.Engine.Architecture
{
Expand All @@ -43,7 +44,7 @@ public static partial class Modify
[Output("room", "The updated Architecture Room")]
public static Room SetOutlineElements1D(this Room room, List<IElement1D> outlineElements1D)
{
Room r = room.GetShallowClone() as Room;
Room r = room.ShallowClone() as Room;
r.Perimeter = BH.Engine.Geometry.Compute.IJoin(outlineElements1D.Cast<ICurve>().ToList())[0];
return r;
}
Expand Down
Loading

0 comments on commit 5dee50e

Please sign in to comment.