Changeset 14049 for branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/PackingShape.cs
- Timestamp:
- 07/12/16 20:03:45 (8 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/PackingShape.cs
r14048 r14049 29 29 30 30 namespace HeuristicLab.Problems.BinPacking3D { 31 [Item(" CuboidPackingShape", "Represents the cuboid measures (width, height, depth) of a three-dimensional cuboidic bin-packing object.")]31 [Item("PackingShape (3d)", "Represents the cuboid measures (width, height, depth) of a three-dimensional cuboidic bin-packing object.")] 32 32 [StorableClass] 33 public class CuboidPackingShape : PackingShape<PackingPosition>, IComparable<CuboidPackingShape> {33 public class PackingShape : PackingShape<PackingPosition>, IComparable<PackingShape> { 34 34 public IFixedValueParameter<IntValue> HeightParameter { 35 35 get { return (IFixedValueParameter<IntValue>)Parameters["Height"]; } … … 58 58 59 59 [StorableConstructor] 60 protected CuboidPackingShape(bool deserializing) : base(deserializing) { }61 protected CuboidPackingShape(CuboidPackingShape original, Cloner cloner)60 protected PackingShape(bool deserializing) : base(deserializing) { } 61 protected PackingShape(PackingShape original, Cloner cloner) 62 62 : base(original, cloner) { 63 63 RegisterEvents(); 64 64 } 65 public CuboidPackingShape()65 public PackingShape() 66 66 : base() { 67 67 Parameters.Add(new FixedValueParameter<IntValue>("Width")); … … 72 72 } 73 73 74 public CuboidPackingShape(int width, int height, int depth)74 public PackingShape(int width, int height, int depth) 75 75 : this() { 76 76 this.Width = width; … … 80 80 81 81 public override IDeepCloneable Clone(Cloner cloner) { 82 return new CuboidPackingShape(this, cloner);82 return new PackingShape(this, cloner); 83 83 } 84 84 … … 101 101 #region IComparable Members 102 102 103 public int CompareTo( CuboidPackingShape other) {103 public int CompareTo(PackingShape other) { 104 104 //Using "Clustered-Area-Height"-comparison as descr 105 105 … … 114 114 115 115 public override int CompareTo(object obj) { 116 var other = ( CuboidPackingShape)obj;116 var other = (PackingShape)obj; 117 117 if (other != null) return CompareTo(other); 118 118 else throw new ArgumentException(string.Format("Cannot compare with object {0}", obj), "obj"); … … 128 128 public int y2; 129 129 public int z2; 130 public CuboidDiagonal( CuboidPackingShape myShape) : this(new PackingPosition(0, 0, 0, 0), myShape) { }131 public CuboidDiagonal(PackingPosition myPosition, CuboidPackingShape myShape) {130 public CuboidDiagonal(PackingShape myShape) : this(new PackingPosition(0, 0, 0, 0), myShape) { } 131 public CuboidDiagonal(PackingPosition myPosition, PackingShape myShape) { 132 132 x1 = myPosition.X; 133 133 y1 = myPosition.Y; … … 153 153 } 154 154 public override bool Encloses(PackingPosition checkedPosition, PackingShape<PackingPosition> checkedShape) { 155 return Encloses(checkedPosition, ( CuboidPackingShape)checkedShape);155 return Encloses(checkedPosition, (PackingShape)checkedShape); 156 156 } 157 private bool Encloses(PackingPosition checkedPosition, CuboidPackingShape checkedShape) {157 private bool Encloses(PackingPosition checkedPosition, PackingShape checkedShape) { 158 158 return Encloses(new CuboidDiagonal(this), new CuboidDiagonal(checkedPosition, checkedShape)); 159 159 } … … 168 168 169 169 public override bool Overlaps(PackingPosition myPosition, PackingPosition checkedPosition, PackingShape<PackingPosition> checkedShape) { 170 return Overlaps(myPosition, checkedPosition, ( CuboidPackingShape)checkedShape);170 return Overlaps(myPosition, checkedPosition, (PackingShape)checkedShape); 171 171 } 172 private bool Overlaps(PackingPosition myPosition, PackingPosition checkedPosition, CuboidPackingShape checkedShape) {172 private bool Overlaps(PackingPosition myPosition, PackingPosition checkedPosition, PackingShape checkedShape) { 173 173 return Overlaps(new CuboidDiagonal(myPosition, this), new CuboidDiagonal(checkedPosition, checkedShape)); 174 174 }
Note: See TracChangeset
for help on using the changeset viewer.