public string GetFormattedStringBlock(TimeHolder time) { if (time is null) { throw new ArgumentNullException(); } if (time.Hours < 0) { throw new ArgumentOutOfRangeException(); } var sb = new StringBuilder(); var firstLineMultiplier = time.Hours / 5; for (int i = 0; i < FirstLineLampsCount; i++) { sb.Append(_colorProvider.GetColor(i < firstLineMultiplier)); } sb.AppendLine(); var secondLineMultiplier = time.Hours % 5; for (int i = 0; i < SecondLineLampsCount; i++) { sb.Append(_colorProvider.GetColor(i < secondLineMultiplier)); } sb.AppendLine(); return(sb.ToString()); }
/// <summary> /// Gets the color for the index idx. /// </summary> /// <param name="idx">Index into the row of the data column.</param> /// <returns>The calculated color for the provided index.</returns> private Color GetColor(int idx) { var dataColumn = DataColumn; if (null != dataColumn) { return(_colorProvider.GetColor(_scale.PhysicalToNormal(dataColumn[idx]))); } else { return(_colorProvider.GetColor(double.NaN)); } }
public CalculationResponse Calculate([FromBody] CalculationRequest request, [FromQuery] bool colored = false) { var result = calculator.Calculate((Operation)request.Operation, request.Operands); if (colored) { var color = colorProvider.GetColor(result); return(new CalculationColorResponse(result, color)); } return(new CalculationResponse(result)); }
public string GetFormattedStringBlock(TimeHolder time) { if (time is null) { throw new ArgumentNullException(nameof(time)); } if (time.Seconds < 0) { throw new ArgumentOutOfRangeException(); } var isSecondPlaceholderEnabled = time.Seconds % 2 == 0; return($"{_colorProvider.GetColor(isSecondPlaceholderEnabled)}{Environment.NewLine}"); }
public string GetColorCodes() { return _colorProvider.GetColor(); }
private Color GetColor(double val) { double relval = _scale.PhysicalToNormal(val); return(_colorProvider.GetColor(relval)); }
public string FetchData(){ string color= _colorProvider.GetColor() return color; }
/// <summary> /// Generate the dual of this geometry. ( The dual mesh translates vertices to faces, and faces to vertices ). /// Used for rendering the world. /// </summary> /// <typeparam name="AltVertex">The dual's vertex format</typeparam> /// <param name="colorProvider">A system for coloring the vertices of the dual</param> /// <returns></returns> public Geometry <AltVertex> GenerateDual <AltVertex>(IColorProvider colorProvider) where AltVertex : struct, IVertex { // For each edge, // get centroids of triangles each side // make 2 new triangles from verts of edge + centroids List <AltVertex> newVerts = new List <AltVertex>(mesh.vertices.Length + Topology.Edges.Count * 2); // Initialize the first V verts for (int i = 0; i < mesh.vertices.Length; ++i) { newVerts.Add(new AltVertex()); } List <uint> newIndices = new List <uint>(); foreach (var iter in Topology.Edges) { Int64 key = iter.Key; int index1 = (int)(key & 0xffffffff); int index2 = (int)((key >> 32) & 0xffffffff); Edge e = iter.Value; Vector3 centroid1 = Topology.Centroids[e.triangle1].position; Vector3 centroid2 = Topology.Centroids[e.triangle2].position; // To find which order of vertices to use; // if triangle1 contains index1 followed by index2, // new tris are index1, c2, c1; index2, c1, c2 // otherwise, the opposite order. bool edgeOrderIsAnticlockwise = false; for (int i = 0; i < 3; i++) { if (indices[e.triangle1 * 3 + i] == index1) { if (indices[e.triangle1 * 3 + (i + 1) % 3] == index2) { edgeOrderIsAnticlockwise = true; } break; } } // Get the color of the face from the color provider for the vertex in the primary mesh Vector4 c1 = colorProvider.GetColor(index1); Vector4 c2 = colorProvider.GetColor(index2); if (edgeOrderIsAnticlockwise) { AddTriangle2(ref newVerts, ref newIndices, index1, ref centroid2, ref centroid1, c1); AddTriangle2(ref newVerts, ref newIndices, index2, ref centroid1, ref centroid2, c2); } else { AddTriangle2(ref newVerts, ref newIndices, index1, ref centroid1, ref centroid2, c1); AddTriangle2(ref newVerts, ref newIndices, index2, ref centroid2, ref centroid1, c2); } } var newMesh = new Mesh <AltVertex>(newVerts.ToArray()); var newGeom = new Geometry <AltVertex>(newMesh, newIndices.ToArray()); return(newGeom); }