/// <summary>Initializes a new instance of the <see cref="Extrapolator"/> class. /// </summary> /// <param name="curveInterpolator">The interpolation approach of the curve.</param> /// <param name="buildingDirection">The building direction of the curve extrapolation.</param> /// <param name="value">The individual value to take into account for the constant curve extrapolation.</param> /// <param name="extrapolatorFactory">The <see cref="GridPointCurve.Extrapolator"/> object that serves as factory for the current object.</param> public Extrapolator(ICurveDataFitting curveInterpolator, BuildingDirection buildingDirection, double value, GridPointCurve.Extrapolator extrapolatorFactory) { m_CurveInterpolator = curveInterpolator ?? throw new ArgumentNullException(nameof(curveInterpolator)); m_BuildingDirection = buildingDirection; m_GridPointValue = value; Factory = extrapolatorFactory; }
/// <summary>Initializes a new instance of the <see cref="Individual"/> class. /// </summary> /// <param name="buildingDirection">The building direction.</param> /// <param name="value">The individual value to take into account for the constant curve extrapolation.</param> public Individual(BuildingDirection buildingDirection, double value) : base(buildingDirection) { if (Double.IsNaN(value) == true) { throw new ArgumentException(String.Format(ExceptionMessages.ArgumentIsNaN, nameof(value))); } m_Value = value; switch (buildingDirection) { case BuildingDirection.FromFirstGridPoint: m_Name = new IdentifierString(String.Format("Constant:First;{0}", value)); m_LongName = new IdentifierString(String.Format(CurveResource.LongNameExtrapolationConstantFirstIndividual, value)); TrySetAnnotation(String.Format(CurveResource.AnnotationExtrapolationConstantFirstIndividual, value)); break; case BuildingDirection.FromLastGridPoint: m_Name = new IdentifierString(String.Format("Constant:Last;{0}", value)); m_LongName = new IdentifierString(CurveResource.LongNameExtrapolationConstantLastIndividual); TrySetAnnotation(String.Format(CurveResource.AnnotationExtrapolationConstantLastIndividual, value)); break; default: throw new NotImplementedException(); } }
/// <summary>Initializes a new instance of the <see cref="Extrapolator"/> class. /// </summary> /// <param name="curveInterpolator">The interpolation approach of the curve.</param> /// <param name="buildingDirection">The building direction of the curve extrapolation.</param> /// <param name="slope">The slope.</param> /// <param name="extrapolatorFactory">The <see cref="GridPointCurve.Extrapolator"/> object that serves as factory for the current object.</param> public Extrapolator(ICurveDataFitting curveInterpolator, BuildingDirection buildingDirection, double slope, GridPointCurve.Extrapolator extrapolatorFactory) { m_CurveInterpolator = curveInterpolator ?? throw new ArgumentNullException(nameof(curveInterpolator)); m_BuildingDirection = buildingDirection; m_Slope = slope; m_ReferencePoint = Double.NaN; m_ReferenceValue = Double.NaN; Factory = extrapolatorFactory; }
/// <summary>Initializes a new instance of the <see cref="Extrapolator"/> class. /// </summary> /// <param name="curveInterpolator">The interpolation approach of the curve.</param> /// <param name="buildingDirection">The building direction of the curve extrapolation.</param> /// <param name="extrapolatorFactory">The <see cref="GridPointCurve.Extrapolator"/> object that serves as factory for the current object.</param> public Extrapolator(ICurveDataFitting curveInterpolator, BuildingDirection buildingDirection, GridPointCurve.Extrapolator extrapolatorFactory) { if (curveInterpolator == null) { throw new ArgumentNullException(nameof(curveInterpolator)); } if ((curveInterpolator is IDifferentiableRealValuedCurve) == false) { throw new ArgumentException(nameof(curveInterpolator)); } m_CurveInterpolator = (IDifferentiableRealValuedCurve)curveInterpolator; m_BuildingDirection = buildingDirection; m_Slope = Double.NaN; m_ReferencePoint = Double.NaN; m_ReferenceValue = Double.NaN; Factory = extrapolatorFactory; }
public static Quaternion TranslateDirection(BuildingDirection direction) { switch (direction) { case BuildingDirection.NORTH: return(Quaternion.Euler(0, 0, 0)); case BuildingDirection.EAST: return(Quaternion.Euler(0, 90, 0)); case BuildingDirection.SOUTH: return(Quaternion.Euler(0, 180, 0)); case BuildingDirection.WEST: return(Quaternion.Euler(0, -90, 0)); default: return(Quaternion.identity); } }
/// <summary>Initializes a new instance of the <see cref="GridpointSlope"/> class. /// </summary> /// <param name="buildingDirection">The building direction.</param> public GridpointSlope(BuildingDirection buildingDirection) : base(buildingDirection) { switch (buildingDirection) { case BuildingDirection.FromFirstGridPoint: m_Name = new IdentifierString("Linear:First two Gridpoint Slope"); m_LongName = new IdentifierString(CurveResource.LongNameExtrapolationLinearFirstTwoSlope); TrySetAnnotation(CurveResource.AnnotationExtrapolationLinearFirstTwoSlope); break; case BuildingDirection.FromLastGridPoint: m_Name = new IdentifierString("Linear:Last two Gridpoint Slope"); m_LongName = new IdentifierString(CurveResource.LongNameExtrapolationLinearLastTwoSlope); TrySetAnnotation(CurveResource.AnnotationExtrapolationLinearLastTwoSlope); break; default: throw new NotImplementedException(); } }
/// <summary>Initializes a new instance of the <see cref="Individual"/> class. /// </summary> /// <param name="buildingDirection">The building direction.</param> /// <param name="slope">The slope of the linear curve extrapolation.</param> public Individual(BuildingDirection buildingDirection, double slope) : base(buildingDirection) { m_Slope = slope; switch (buildingDirection) { case BuildingDirection.FromFirstGridPoint: m_Name = new IdentifierString(String.Format("Linear:First;{0}", slope)); m_LongName = new IdentifierString(String.Format(CurveResource.LongNameExtrapolationLinearFirstIndividual, slope)); TrySetAnnotation(String.Format(CurveResource.AnnotationExtrapolationLinearFirstIndividual, slope)); break; case BuildingDirection.FromLastGridPoint: m_Name = new IdentifierString(String.Format("Linear:Last;{0}", slope)); m_LongName = new IdentifierString(String.Format(CurveResource.LongNameExtrapolationLinearLastIndividual, slope)); TrySetAnnotation(String.Format(CurveResource.AnnotationExtrapolationLinearLastIndividual, slope)); break; default: throw new NotImplementedException(); } }
public Tile(MapDataStore container, DFCoord position) { this.container = container; this.position = position; tileType = default(int); material = default(MatPairStruct); base_material = default(MatPairStruct); layer_material = default(MatPairStruct); vein_material = default(MatPairStruct); construction_item = default(MatPairStruct); waterLevel = default(int); magmaLevel = default(int); rampType = 0; buildingMaterial = default(MatPairStruct); buildingType = default(BuildingStruct); buildingLocalPos = default(DFCoord2d); buildingDirection = 0; Hidden = false; trunkPercent = 0; positionOnTree = default(DFCoord); digDesignation = TileDigDesignation.NO_DIG; spatters = null; }
public void InitOrModifyTile(DFCoord coord, int? tileType = null, MatPairStruct? material = null, MatPairStruct? base_material = null, MatPairStruct? layer_material = null, MatPairStruct? vein_material = null, int? waterLevel = null, int? magmaLevel = null, MatPairStruct? construction_item = null, int? rampType = null, BuildingStruct? buildingType = null, MatPairStruct? buildingMaterial = null, DFCoord2d? buildingLocalPos = null, BuildingDirection? buildingDirection = null, bool? hidden = null, byte? trunkPercent = null, DFCoord? positionOnTree = null, TileDigDesignation? digDesignation = null, List<Spatter> spatters = null) { if (!InSliceBounds(coord)) { throw new UnityException("Can't modify tile outside of slice"); } if (this[coord] == null) this[coord] = new Tile(this, coord); this[coord].Modify( tileType, material, base_material, layer_material, vein_material, waterLevel, magmaLevel, construction_item, rampType, buildingType, buildingMaterial, buildingLocalPos, buildingDirection, hidden, trunkPercent, positionOnTree, digDesignation, spatters ); }
public void Modify(int? tileType = null, MatPairStruct? material = null, MatPairStruct? base_material = null, MatPairStruct? layer_material = null, MatPairStruct? vein_material = null, int? waterLevel = null, int? magmaLevel = null, MatPairStruct? construction_item = null, int? rampType = null, BuildingStruct? buildingType = null, MatPairStruct? buildingMaterial = null, DFCoord2d? buildingLocalPos = null, BuildingDirection? buildingDirection = null, bool? hidden = null, byte? trunkPercent = null, DFCoord? positionOnTree = null, TileDigDesignation? digDesignation = null, List<Spatter> spatters = null) { if (tileType != null) { this.tileType = tileType.Value; } if (material != null) { this.material = material.Value; } if (base_material != null) { this.base_material = base_material.Value; } if (layer_material != null) { this.layer_material = layer_material.Value; } if (vein_material != null) { this.vein_material = vein_material.Value; } if (waterLevel != null) { this.waterLevel = waterLevel.Value; } if (magmaLevel != null) { this.magmaLevel = magmaLevel.Value; } if (construction_item != null) { this.construction_item = construction_item.Value; } if(rampType != null) { this.rampType = rampType.Value; } if(buildingType != null) { this.buildingType = buildingType.Value; } if(buildingMaterial != null) { this.buildingMaterial = buildingMaterial.Value; } if (buildingLocalPos != null) this.buildingLocalPos = buildingLocalPos.Value; if (buildingDirection != null) this.buildingDirection = buildingDirection.Value; if (hidden != null) Hidden = hidden.Value; if (trunkPercent != null) this.trunkPercent = trunkPercent.Value; if (positionOnTree != null) this.positionOnTree = positionOnTree.Value; if (digDesignation != null) this.digDesignation = digDesignation.Value; if (spatters != null) this.spatters = spatters; }
public void CopyFrom(Tile orig) { container = orig.container; position = orig.position; tileType = orig.tileType; material = orig.material; base_material = orig.base_material; layer_material = orig.layer_material; vein_material = orig.vein_material; construction_item = orig.construction_item; waterLevel = orig.waterLevel; magmaLevel = orig.magmaLevel; RampType = orig.RampType; buildingType = orig.buildingType; buildingMaterial = orig.buildingMaterial; buildingLocalPos = orig.buildingLocalPos; buildingDirection = orig.buildingDirection; Hidden = orig.Hidden; trunkPercent = orig.trunkPercent; positionOnTree = orig.positionOnTree; digDesignation = orig.digDesignation; spatters = orig.spatters; }
public void Modify (int? tileType = null, MatPairStruct? material = null, MatPairStruct? base_material = null, MatPairStruct? layer_material = null, MatPairStruct? vein_material = null, int? waterLevel = null, int? magmaLevel = null, MatPairStruct? construction_item = null, int? rampType = null, BuildingStruct? buildingType = null, MatPairStruct? buildingMaterial = null, DFCoord2d? buildingLocalPos = null, BuildingDirection? buildingDirection = null, bool? hidden = null) { if (tileType != null) { this.tileType = tileType.Value; } if (material != null) { this.material = material.Value; } if (base_material != null) { this.base_material = base_material.Value; } if (layer_material != null) { this.layer_material = layer_material.Value; } if (vein_material != null) { this.vein_material = vein_material.Value; } if (waterLevel != null) { this.waterLevel = waterLevel.Value; } if (magmaLevel != null) { this.magmaLevel = magmaLevel.Value; } if (construction_item != null) { this.construction_item = construction_item.Value; } if(rampType != null) { this.rampType = rampType.Value; } if(buildingType != null) { this.buildingType = buildingType.Value; } if(buildingMaterial != null) { this.buildingMaterial = buildingMaterial.Value; } if (buildingLocalPos != null) this.buildingLocalPos = buildingLocalPos.Value; if (buildingDirection != null) this.buildingDirection = buildingDirection.Value; if (hidden != null) this.hidden = hidden.Value; }
public void InitOrModifyTile(DFCoord coord, int? tileType = null, MatPairStruct? material = null, MatPairStruct? base_material = null, MatPairStruct? layer_material = null, MatPairStruct? vein_material = null, int? waterLevel = null, int? magmaLevel = null, MatPairStruct? construction_item = null, int? rampType = null, BuildingStruct? buildingType = null, MatPairStruct? buildingMaterial = null, DFCoord2d? buildingLocalPos = null, BuildingDirection? buildingDirection = null, bool? hidden = null) { DFCoord local = WorldToLocalSpace(coord); if (!InSliceBoundsLocal(local.x, local.y, local.z)) { throw new UnityException("Can't modify tile outside of slice"); } if (tiles[local.x, local.y, local.z] == null) tiles[local.x, local.y, local.z] = new Tile(this, local); tiles[local.x, local.y, local.z].Modify(tileType, material, base_material, layer_material, vein_material, waterLevel, magmaLevel, construction_item, rampType, buildingType, buildingMaterial, buildingLocalPos, buildingDirection, hidden); }
public void Modify(int?tileType = null, MatPairStruct?material = null, MatPairStruct?base_material = null, MatPairStruct?layer_material = null, MatPairStruct?vein_material = null, int?waterLevel = null, int?magmaLevel = null, MatPairStruct?construction_item = null, int?rampType = null, BuildingStruct?buildingType = null, MatPairStruct?buildingMaterial = null, DFCoord2d?buildingLocalPos = null, BuildingDirection?buildingDirection = null, bool?hidden = null, byte?trunkPercent = null, DFCoord?positionOnTree = null, TileDigDesignation?digDesignation = null, List <Spatter> spatters = null) { if (tileType != null) { this.tileType = tileType.Value; } if (material != null) { this.material = material.Value; } if (base_material != null) { this.base_material = base_material.Value; } if (layer_material != null) { this.layer_material = layer_material.Value; } if (vein_material != null) { this.vein_material = vein_material.Value; } if (waterLevel != null) { this.waterLevel = waterLevel.Value; } if (magmaLevel != null) { this.magmaLevel = magmaLevel.Value; } if (construction_item != null) { this.construction_item = construction_item.Value; } if (rampType != null) { this.rampType = rampType.Value; } if (buildingType != null) { this.buildingType = buildingType.Value; } if (buildingMaterial != null) { this.buildingMaterial = buildingMaterial.Value; } if (buildingLocalPos != null) { this.buildingLocalPos = buildingLocalPos.Value; } if (buildingDirection != null) { this.buildingDirection = buildingDirection.Value; } if (hidden != null) { Hidden = hidden.Value; } if (trunkPercent != null) { this.trunkPercent = trunkPercent.Value; } if (positionOnTree != null) { this.positionOnTree = positionOnTree.Value; } if (digDesignation != null) { this.digDesignation = digDesignation.Value; } if (spatters != null) { this.spatters = spatters; } }
/// <summary>Initializes a new instance of the <see cref="Extrapolator"/> class. /// </summary> /// <param name="buildingDirection">A value indicating whether the extrapolation has to be applied to the left or right side, i.e. starting point is the first or last grid point.</param> /// <remarks>The extrapolation 'none' supports both directions.</remarks> protected Extrapolator(BuildingDirection buildingDirection) { m_BuildingDirection = buildingDirection; m_Annotation = String.Empty; }