public void CloneTest() { var exp = new Max(new[] { new Number(1), new Number(2) }, 2); var clone = exp.Clone(); Assert.Equal(exp, clone); }
/// <summary> /// Creates a geometry (Polygon) that resembles this bounding box. /// </summary> /// <returns></returns> public Geometry ToGeometry() { var linearRing = new LinearRing(new[] { Min.Clone(), new Point(Min.X, Max.Y), Max.Clone(), new Point(Max.X, Min.Y), Min.Clone() }); return(new Polygon(linearRing, null)); }
/// <summary> /// Клонирование объекта значения /// </summary> /// <returns>Клон объекта</returns> public override object Clone( ) { SequenceVariable variable = new SequenceVariable(Name, (Value)Value.Clone( )); if (Min != null) { variable.Min = (Value)Min.Clone( ); } if (Max != null) { variable.Max = (Value)Max.Clone( ); } if (Step != null) { variable.Step = (Value)Step.Clone( ); } return(variable); }
/// <summary> /// Клонирование объекта значения /// </summary> /// <returns>Клон объекта</returns> public override object Clone( ) { SystemVariable variable = new SystemVariable(Name, IsReadOnly, (Value)Value.Clone( )); if (Min != null) { variable.Min = (Value)Min.Clone( ); } if (Max != null) { variable.Max = (Value)Max.Clone( ); } if (Step != null) { variable.Step = (Value)Step.Clone( ); } variable.IsLookExpression = IsLookExpression; return(variable); }
/// <summary> /// Клонирование объекта значения /// </summary> /// <returns>Клон объекта</returns> public override object Clone( ) { GlobalVariable variable = new GlobalVariable(Name, (Value)Value.Clone( )); if (Min != null) { variable.Min = (Value)Min.Clone( ); } if (Max != null) { variable.Max = (Value)Max.Clone( ); } if (Step != null) { variable.Step = (Value)Step.Clone( ); } variable.IsAdd = IsAdd; return(variable); }
/// <summary> /// set this box to the bounding box of this and point /// </summary> public void Include([NotNull] Pnt point, int dimension) { if (Min == Max) { Min = Min.Clone(); Max = Max.Clone(); } for (var i = 0; i < dimension; i++) { if (point[i] < Min[i]) { Min[i] = point[i]; } else if (point[i] > Max[i]) { Max[i] = point[i]; } } }
/// <summary> /// set this box to the bounding box of this and box /// </summary> /// <param name="box"></param> /// <param name="dimension"></param> public void Include([NotNull] IBox box, int dimension) { if (Min == Max) { Min = Min.Clone(); Max = Max.Clone(); } for (var i = 0; i < dimension; i++) { if (box.Min[i] < Min[i]) { Min[i] = box.Min[i]; } if (box.Max[i] > Max[i]) { Max[i] = box.Max[i]; } } }
public Box Clone() { return(new Box(Min.Clone(), Max.Clone())); }