public static IFilter Create(string filterKey) { IFilter result = null; switch (filterKey) { case "Median": result = new MedianFilter(); break; case "Monochrome": result = new MonochromeFilter(); break; case "Sharpen": result = new SharpenFilter(); break; case "Boundary": result = new Boundary(); break; case "Otzu": result = new Otcu(); break; } return result; }
public void Constructor_ZeroDimension_Throws() { var center = new Point(1, 1); var boundary = new Boundary(center, 0, 0); Assert.Fail("Boundary with dimension zero should throw"); }
private Boundary getBackgroundBoundary() { Boundary value = new Boundary (); float xMin = gameController.boundary.xMin; float xMax = gameController.boundary.xMax; float width = xMax - xMin; float scale = width / boundaryTransform.localScale.x; float height = scale * boundaryTransform.localScale.y; Camera cam = Camera.main; if (cam != null) { float cameraViewHeight = cam.orthographicSize * 2.0f; if (height < cameraViewHeight) { scale = cameraViewHeight / height; height *= scale; width *= scale; } } else { Debug.Log ("No camera"); } value.zMin = -height / 2.0f; value.zMax = height / 2.0f; value.xMin = -width / 2.0f; value.xMax = width / 2.0f; return value; }
public void Search_AreaWithOnePoint_ReturnsOnePoint() { var center = new Point(0, 0); var boundary = new Boundary(center, 1, 1); var quad = new QuadTree<Point>(boundary); // insert one point in the second quadrant var point = new Point(-0.75, +0.75); quad.Insert(point); // then insert one point in each remaining quadrant var points = new List<Point> { new Point(+0.75, +0.75), // first quadrant new Point(-0.75, -0.75), // third quadrant new Point(+0.75, -0.75) // fourth quadrant }; points.ForEach(p => quad.Insert(p)); // search second quadrant var searchArea = new Boundary(new Point(-0.5, 0.5), 0.5, 0.5); var results = quad.Search(searchArea); Assert.IsTrue(results.Count == 1); Assert.IsTrue(results.Contains(point)); }
void Start() { rb = GetComponent<Rigidbody>(); boundary = new Boundary(); boundary.yMin = -5.5f; boundary.yMax = 10f; }
public void Insert_WithinBoundary_ReturnsTrue() { var center = new Point(0, 0); var boundary = new Boundary(center, 1, 1); var quad = new QuadTree<Point>(boundary); Assert.IsTrue(quad.Insert(new Point(0, 0))); Assert.IsTrue(quad.Insert(new Point(-0.5, 0.5))); }
public void Insert_OutOfBoundary_ReturnsFalse() { var center = new Point(0, 0); var boundary = new Boundary(center, 1, 1); var quad = new QuadTree<Point>(boundary); Assert.IsFalse(quad.Insert(new Point(2, 0))); Assert.IsFalse(quad.Insert(new Point(0, 2))); }
private Boundary getPlayerBoundary() { Boundary value = new Boundary (); value.xMin = gameController.boundary.xMin + 1.0f; value.xMax = gameController.boundary.xMax - 1.0f; value.zMin = gameController.boundary.zMin + 1.0f; value.zMax = gameController.boundary.zMax - 4.0f; return value; }
private Boundary getHazardStartBoundary() { Boundary value = new Boundary (); value.xMin = boundary.xMin + 1.0f; value.xMax = boundary.xMax - 1.0f; value.zMin = boundary.zMax + 2.0f; value.zMax = boundary.zMax + 2.0f; return value; }
private Boundary getDestroyBoundary() { Boundary value = new Boundary (); value.xMin = gameController.boundary.xMin - 1.0f; value.xMax = gameController.boundary.xMax + 1.0f; value.zMin = gameController.boundary.zMin - 1.0f; value.zMax = gameController.boundary.zMax + 1.0f; return value; }
// Use this for initialization void Start() { _Transform = transform; _MoveBoundary = Area.WalkingBoundary; SpriteRenderer sprite = GetComponent<SpriteRenderer> (); _SpriteHalfWidth = sprite.bounds.size.x / 2; _SpriteHalfHeight = sprite.bounds.size.y / 2; //Debug.Log ("Player Size: " + new Vector2 (_SpriteHalfWidth, _SpriteHalfHeight)); }
public void GeneratePointsWithin_Boundary_BoundaryContainsAllPoints() { var center = new Point(0, 0); var boundary = new Boundary(center, 1, 1); var generator = new RandomGenerator(); var results = generator.GeneratePointsWithin(boundary, 1000); results.ForEach(p => Assert.IsTrue(boundary.Contains(p))); }
public void Contains_PointOnBoundary_ReturnsTrue() { var center = new Point(-1, -1); var boundary = new Boundary(center, 1, 1); var pointOnBoundary = new Point(0, 0); var result = boundary.Contains(pointOnBoundary); Assert.IsTrue(result); }
public void Contains_PointOutOfBoundary_ReturnsFalse() { var center = new Point(1,1); var boundary = new Boundary(center, 2, 2); var pointOutOfBounds = new Point(-2, -4); var result = boundary.Contains(pointOutOfBounds); Assert.IsFalse(result); }
public void Contains_PointWithinBoundary_ReturnsTrue() { var center = new Point(-1, 1); var boundary = new Boundary(center, 1, 1); var pointWithinBounds = new Point(-0.3, 0.7); var result = boundary.Contains(pointWithinBounds); Assert.IsTrue(result); }
public void Intersects_AreaContainingBoundary_ReturnsTrue() { var center = new Point(-3, -3); var boundary = new Boundary(center, 1, 1); var areaContainingBoundary = new Boundary(new Point(-3, -3), 5, 5); var result = boundary.Intersects(areaContainingBoundary); Assert.IsTrue(result); }
public void Intersects_AreaOutOfBoundary_ReturnsFalse() { var center = new Point(-1, -1); var boundary = new Boundary(center, 1, 1); var areaOutOfBoundary = new Boundary(new Point(1, 1), 0.5, 0.5); var result = boundary.Intersects(areaOutOfBoundary); Assert.IsFalse(result); }
public void GetValueTest() { IGrid inputGrid = new MockClasses.MockGrid(); Boundary boundary = new Boundary(-180, -90, 180, 90); EquirectangularGridMap target = new EquirectangularGridMap(inputGrid, boundary); Assert.AreEqual(1.2777777777777777, target.GetValue(-80, -90)); Assert.AreEqual(0, target.GetXIndex(-80)); Assert.AreEqual(1, target.GetYIndex(-90)); Assert.AreEqual(double.NaN, target.GetValue(-190, -90)); }
public void Intersects_AreaWithBorderIntersection_ReturnsTrue() { var center = new Point(0, 0); var boundary = new Boundary(center, 0.5, 0.5); var areaWithBorderIntersection = new Boundary(new Point(1, 0), 0.5, 0.5); var result = boundary.Intersects(areaWithBorderIntersection); Assert.IsTrue(result); }
public void Construct_New_HasNoChildren() { var center = new Point(0, 0); var boundary = new Boundary(center, 1, 1); var quad = new QuadTree<Point>(boundary); Assert.IsNotNull(quad); Assert.IsFalse(quad.HasChildren); }
public void GenerateIntersectingBoundary_Boundary_Intersects() { var center = new Point(0, 0); var boundary = new Boundary(center, 10, 10); var generator = new RandomGenerator(); var result = generator.GenerateIntersectingBoundary(boundary); Assert.IsNotNull(result); Assert.IsTrue(boundary.Intersects(result)); }
public void GeneratePointsWithin_Quantity_ReturnsCorrectQuantity() { var center = new Point(0, 0); var boundary = new Boundary(center, 1, 1); var generator = new RandomGenerator(); var quantity = 100; var results = generator.GeneratePointsWithin(boundary, quantity); Assert.IsNotNull(results); Assert.IsTrue(results.Count == quantity); }
public void GenerateIntersectingBoundaries_Boundaries_Intersects() { var center = new Point(0, 0); var boundary = new Boundary(center, 10, 10); var generator = new RandomGenerator(); var result = generator.GenerateIntersectingBoundaries(boundary, 100); Assert.IsNotNull(result); Assert.IsTrue(result.Count == 100); result.ForEach(b => Assert.IsTrue(boundary.Intersects(b))); }
IEnumerator Start() { aura = new List<string>(); nimbus = new List<string>(); bry = new Boundary(-1f, -1f, -1f, -1f, -1f, -1f); while(Initialize.finished != true) { yield return new WaitForSeconds(0.05f); } InvokeRepeating("CheckPos", 0, 0.5F); // player position changed InvokeRepeating("CheckEnv", DisFish.interval, DisFish.interval); // environment changed }
// Update is called once per frame void FixedUpdate() { rb = GetComponent<Rigidbody> (); rb.velocity = new Vector3(Input.GetAxis("Horizontal2"),0 , Input.GetAxis("Vertical2")) * speed; Boundary boundary = new Boundary (); rb.transform.position = new Vector3 ( Mathf.Clamp (rb.position.x, boundary.xMin, boundary.xMax), 0.0f, Mathf.Clamp (rb.position.z, boundary.zMin, boundary.zMax) ); rb.rotation = Quaternion.Euler (0.0f, 0.0f, rb.velocity.x * tilt); }
void Awake() { // Disable automatic sleep timeout. Screen.sleepTimeout = SleepTimeout.NeverSleep; // Set world boundary coordinates. Vector2 bottomLeft = Camera.main.ViewportToWorldPoint(new Vector2(0, 0)); Vector2 topRight = Camera.main.ViewportToWorldPoint(new Vector2(1, 1)); worldBoundary = new Boundary(); worldBoundary.xMin = bottomLeft.x; worldBoundary.xMax = topRight.x; worldBoundary.yMin = bottomLeft.y; worldBoundary.yMax = topRight.y; }
/// <summary> /// Проверяет, входит ли указанный объем в текущую область видимости /// </summary> /// <param name="boundary">Объем ограничивающий что-либо в пространстве</param> /// <returns> /// <para><b>0</b>, если объем не содержится в области видимости,</para> /// <para><b>1</b>, если содержится частично,</para> /// <para><b>2</b>, если содержится полностью</para> /// </returns> public int BoundaryInFrustrum(Boundary boundary) { int c2 = 0; for (int p = 0; p < 4; ++p) { int c = 0; if (_frustrum[p, 0] * boundary.Point.X + _frustrum[p, 1] * boundary.Point.Z + _frustrum[p, 3] > 0) ++c; if (_frustrum[p, 0] * boundary.Point.X + _frustrum[p, 1] * (boundary.Point.Z + boundary.Rad) + _frustrum[p, 3] > 0) ++c; if (_frustrum[p, 0] * (boundary.Point.X + boundary.Rad) + _frustrum[p, 1] * boundary.Point.Z + _frustrum[p, 3] > 0) ++c; if (_frustrum[p, 0] * (boundary.Point.X + boundary.Rad) + _frustrum[p, 1] * (boundary.Point.Z + boundary.Rad) + _frustrum[p, 3] > 0) ++c; if (c == 0) return 0; if (c == 4) ++c2; } return (c2 == 4) ? 2 : 1; }
public void GeneratePyramidsWithBoundaryMercatorTest() { MockClasses.MockTileCreatorForMercatorTileGenerator creator = new MockClasses.MockTileCreatorForMercatorTileGenerator(); TileGenerator target = new TileGenerator(creator); int level = 5; var imageBoundary = new Boundary(-180, -90, 180, 90); target.Generate(level, imageBoundary); Assert.AreEqual(6, creator.TileCreated.Count); Assert.AreEqual(1024, creator.TileCreated[5]); Assert.AreEqual(256, creator.TileCreated[4]); Assert.AreEqual(64, creator.TileCreated[3]); Assert.AreEqual(16, creator.TileCreated[2]); Assert.AreEqual(4, creator.TileCreated[1]); Assert.AreEqual(1, creator.TileCreated[0]); }
internal void CreateGherkinLink(RepositoryInfo repositoryInfo, Command command) { var args = (AppendToCollectionCommandArgs)command.CommandArgs; var gherkinFile = (GherkinFile)entityRepository.Load(repositoryInfo, args.CollectionMember); if (gherkinFile.FileProviderType != ProviderType) return; // this is not for us var updateBoundary = new Boundary(Context.Current); try { GherkinFilePoller.TriggerUpdate(gherkinFile, updateBoundary); } catch (Exception ex) { logger.Log(TraceEventType.Error, "An exception has occurred during updating a gherkin file link: {0}", ex); } }
/// <summary> /// Constructor. Inject the various dependencies. /// </summary> public BubbleController(GameObject bubblePrefab, BubbleOptions options, Boundary worldBoundary, ExplosionController explosionController, SpectrumVisualiser spectrumVisualiser) { this.explosionController = explosionController; this.bubblePrefab = bubblePrefab; this.options = options; this.worldBoundary = worldBoundary; activeBubbles = new List<GameObject>(options.maxBubbles); pooledBubbles = new List<GameObject>(options.maxBubbles); InitBubblePool(); spectrumPeaks = new List<Peak>(); // Subscribe to the spectrum visualiser's SpectrumChangedEvent, // so that we are able to spawn bubbles at peaks in the rendered spectrum. spectrumVisualiser.SpectrumChangedEventHandler += OnSpectrumBandsUpdate; yOrigin = spectrumVisualiser.yOrigin; }
private void Start() { pastSprite.GetComponent <Transform>().localPosition = new Vector3(pastSprite.GetComponent <Transform>().localPosition.x, pastSprite.GetComponent <Transform>().localPosition.y, -Boundary.OnePageToDeltaZ() * 10000f); presentSprite.GetComponent <Transform>().localPosition = new Vector3(presentSprite.GetComponent <Transform>().localPosition.x, presentSprite.GetComponent <Transform>().localPosition.y, 0f); futureSprite.GetComponent <Transform>().localPosition = new Vector3(futureSprite.GetComponent <Transform>().localPosition.x, futureSprite.GetComponent <Transform>().localPosition.y, Boundary.OnePageToDeltaZ() * 10000f); backgroundCanvas.localPosition = new Vector3(backgroundCanvas.localPosition.x, backgroundCanvas.localPosition.y, Boundary.sight * 10000f); }
public static int ZOrderingComparer(Point first, Point second, Boundary mbb) { return(SpaceFillingCurves.NOrdering(Moves.East, Moves.SouthWest).ComparePoints(first, second, mbb)); }
void FixedUpdate() { Rigidbody rigidBody = GetComponent <Rigidbody>(); Boundary.UpdateRigidbodyPosition(rigidBody); }
// 求交点, 返回的pos是clip空间下坐标 Vertex Intersect(Vertex v1, Vertex v2, Boundary b, Vector4 wMin, Vector4 wMax) { Vertex iPt = new Vertex(); float m1 = 0, m2 = 0, m3 = 0, m4 = 0, m5 = 0, m6 = 0; Vector4 p1 = v1.ClipSpacePosition; Vector4 p2 = v2.ClipSpacePosition; if (p1.X != p2.X) { m1 = (wMin.X - p1.X) / (p2.X - p1.X); m2 = (wMax.X - p1.X) / (p2.X - p1.X); } if (p1.Y != p2.Y) { m3 = (wMin.Y - p1.Y) / (p2.Y - p1.Y); m4 = (wMax.Y - p1.Y) / (p2.Y - p1.Y); } if (p1.Z != p2.Z) { m5 = (wMin.Z - p1.Z) / (p2.Z - p1.Z); m6 = (wMax.Z - p1.Z) / (p2.Z - p1.Z); } Vector4 clipPos = new Vector4(); Vector4 pos = new Vector4(); Color4 col = new Color4(255, 255, 255); Vector4 normal = new Vector4(); Vector4 uv = new Vector4(); switch (b) { case Boundary.Left: clipPos.X = wMin.X; clipPos.Y = p1.Y + (p2.Y - p1.Y) * m1; clipPos.Z = p1.Z + (p2.Z - p1.Z) * m1; clipPos.W = p1.W + (p2.W - p1.W) * m1; col = MathUtil.ColorInterp(v1.Color, v2.Color, m1); normal = MathUtil.Vector4Interp(v1.nowNormal, v2.nowNormal, m1); uv = MathUtil.Vector4Interp(v1.UV, v2.UV, m1); break; case Boundary.Right: clipPos.X = wMax.X; clipPos.Y = p1.Y + (p2.Y - p1.Y) * m2; clipPos.Z = p1.Z + (p2.Z - p1.Z) * m2; clipPos.W = p1.W + (p2.W - p1.W) * m2; col = MathUtil.ColorInterp(v1.Color, v2.Color, m2); normal = MathUtil.Vector4Interp(v1.nowNormal, v2.nowNormal, m2); uv = MathUtil.Vector4Interp(v1.UV, v2.UV, m2); break; case Boundary.Bottom: clipPos.Y = wMin.Y; clipPos.X = p1.X + (p2.X - p1.X) * m3; clipPos.Z = p1.Z + (p2.Z - p1.Z) * m3; clipPos.W = p1.W + (p2.W - p1.W) * m3; col = MathUtil.ColorInterp(v1.Color, v2.Color, m3); normal = MathUtil.Vector4Interp(v1.nowNormal, v2.nowNormal, m3); uv = MathUtil.Vector4Interp(v1.UV, v2.UV, m3); break; case Boundary.Top: clipPos.Y = wMax.Y; clipPos.X = p1.X + (p2.X - p1.X) * m4; clipPos.Z = p1.Z + (p2.Z - p1.Z) * m4; clipPos.W = p1.W + (p2.W - p1.W) * m4; col = MathUtil.ColorInterp(v1.Color, v2.Color, m4); normal = MathUtil.Vector4Interp(v1.nowNormal, v2.nowNormal, m4); uv = MathUtil.Vector4Interp(v1.UV, v2.UV, m4); break; case Boundary.Behind: clipPos.Z = wMin.Z; clipPos.X = p1.X + (p2.X - p1.X) * m5; clipPos.Y = p1.Y + (p2.Y - p1.Y) * m5; clipPos.W = p1.W + (p2.W - p1.W) * m5; col = MathUtil.ColorInterp(v1.Color, v2.Color, m5); normal = MathUtil.Vector4Interp(v1.nowNormal, v2.nowNormal, m5); uv = MathUtil.Vector4Interp(v1.UV, v2.UV, m5); break; case Boundary.Front: clipPos.Z = wMax.Z; clipPos.X = p1.X + (p2.X - p1.X) * m6; clipPos.Y = p1.Y + (p2.Y - p1.Y) * m6; clipPos.W = p1.W + (p2.W - p1.W) * m6; col = MathUtil.ColorInterp(v1.Color, v2.Color, m6); normal = MathUtil.Vector4Interp(v1.nowNormal, v2.nowNormal, m6); uv = MathUtil.Vector4Interp(v1.UV, v2.UV, m6); break; } iPt.Position = pos; iPt.ClipSpacePosition = clipPos; iPt.ScreenSpacePosition = this.device.ViewPort(clipPos); iPt.Normal = normal; iPt.nowNormal = normal.Normalized; iPt.UV = uv; iPt.Color = col; return(iPt); }
/// <summary> /// 添加范围查询条件 /// </summary> /// <param name="source">源</param> /// <param name="expression">列名表达式,范例:t => t.Name</param> /// <param name="min">最小值</param> /// <param name="max">最大值</param> /// <param name="boundary">包含边界</param> public static ISqlBuilder Between <TEntity>(this ISqlBuilder source, Expression <Func <TEntity, object> > expression, decimal?min, decimal?max, Boundary boundary = Boundary.Both) where TEntity : class { if (source == null) { throw new ArgumentNullException(nameof(source)); } if (source is IClauseAccessor accessor) { accessor.WhereClause.Between(expression, min, max, boundary); } return(source); }
void Start() { rb = GetComponent <Rigidbody>(); boundary = new Boundary(-6, 6, -2, 8); }
public void Deconstruction() { var(value, inclusive) = Boundary.Create(10, true); value.Should().Be(10); inclusive.Should().Be(true); }
/// <summary> /// 添加范围查询条件 /// </summary> /// <param name="expression">列名表达式</param> /// <param name="min">最小值</param> /// <param name="max">最大值</param> /// <param name="boundary">包含边界</param> public ISqlQuery Between <TEntity>(Expression <Func <TEntity, object> > expression, decimal?min, decimal?max, Boundary boundary = Boundary.Both) where TEntity : class { Builder.Between(expression, min, max, boundary); return(this); }
/// <summary> /// 添加范围查询条件 /// </summary> /// <param name="column">列名</param> /// <param name="min">最小值</param> /// <param name="max">最大值</param> /// <param name="boundary">包含边界</param> public ISqlQuery Between(string column, decimal?min, decimal?max, Boundary boundary = Boundary.Both) { Builder.Between(column, min, max, boundary); return(this); }
public static Point[] HilbertSorter(Point[] array) { Boundary boundary = GetBoundary(array, 5); return(IRI.Ket.DataStructure.SortAlgorithm.Heapsort <Point>(array, (p1, p2) => HilbertComparer(p1, p2, boundary))); }
public static Point[] MooreSorter(Point[] array) { Boundary boundary = GetBoundary(array, 5); return(SortAlgorithm.Heapsort <Point>(array, (p1, p2) => MooreComparer(p1, p2, boundary))); }
public static int Peano03Comparer(Point first, Point second, Boundary mbb) { return(SpaceFillingCurves.Peano03(Moves.North, Moves.East).ComparePoints(first, second, mbb)); }
public static int UOrderOrLebesgueSquareComparer(Point first, Point second, Boundary mbb) { return(SpaceFillingCurves.UOrderOrLebesgueSquare(Moves.North, Moves.East).ComparePoints(first, second, mbb)); }
public static int DiagonalLebesgueComparer(Point first, Point second, Boundary mbb) { return(SpaceFillingCurves.LebesgueDiagonal(Moves.NorthEast, Moves.West).ComparePoints(first, second, mbb)); }
public BoundarySave(action action, Boundary boundary) : base(action) { current = boundary; }
public static Point[] UOrderOrLebesgueSquareSorter(Point[] array) { Boundary boundary = GetBoundary(array, 5); return(SortAlgorithm.Heapsort <Point>(array, (p1, p2) => UOrderOrLebesgueSquareComparer(p1, p2, boundary))); }
private static void Main(string[] args) //****************************************************************************80 // // Purpose: // // MAIN is the main program for TRIANGULATION_L2Q. // // Discussion: // // TRIANGULATION_L2Q makes a quadratic triangulation from a linear one. // // Thanks to Zhu Wang for pointing out a problem caused by a change // in the ordering of elements in the triangle neighbor array, 25 August 2010. // // Usage: // // triangulation_l2q prefix // // where 'prefix' is the common filename prefix: // // * prefix_nodes.txt contains the linear node coordinates, // * prefix_elements.txt contains the linear element definitions. // * prefix_l2q_nodes.txt will contain the quadratic node coordinates, // * prefix_l2q_elements.txt will contain the quadratic element definitions. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 25 August 2010 // // Author: // // John Burkardt // { int element; int i; string prefix; Console.WriteLine(""); Console.WriteLine("TRIANGULATION_L2Q"); Console.WriteLine(" Read a \"linear\" triangulation and"); Console.WriteLine(" write out a \"quadratic\" triangulation."); Console.WriteLine(""); Console.WriteLine(" Read a dataset of NODE_NUM1 points in 2 dimensions."); Console.WriteLine(" Read an associated triangulation dataset of ELEMENT_NUM "); Console.WriteLine(" elements which uses 3 nodes per triangular element."); Console.WriteLine(""); Console.WriteLine(" Create new nodes which are triangle midpoints,"); Console.WriteLine(" generate new node and triangulation data for"); Console.WriteLine(" quadratic 6-node elements, and write them out."); Console.WriteLine(""); // // Get the filename prefix. // try { prefix = args[0]; } catch { Console.WriteLine(""); Console.WriteLine("TRIANGULATION_L2Q:"); Console.WriteLine(" Please enter the filename prefix."); prefix = Console.ReadLine(); } // // Create the filenames. // string node_filename = prefix + "_nodes.txt"; string element_filename = prefix + "_elements.txt"; string node_l2q_filename = prefix + "_l2q_nodes.txt"; string element_l2q_filename = prefix + "_l2q_elements.txt"; // // Read the data. // TableHeader h = typeMethods.r8mat_header_read(node_filename); int m = h.m; int node_num1 = h.n; Console.WriteLine(""); Console.WriteLine(" Read the header of \"" + node_filename + "\"."); Console.WriteLine(""); Console.WriteLine(" Spatial dimension M = " + m + ""); Console.WriteLine(" Number of nodes NODE_NUM1 = " + node_num1 + ""); double[] node_xy1 = typeMethods.r8mat_data_read(node_filename, m, node_num1); Console.WriteLine(""); Console.WriteLine(" Read the data in \"" + node_filename + "\"."); typeMethods.r8mat_transpose_print_some(m, node_num1, node_xy1, 1, 1, m, 10, " Portion of node coordinate data:"); // // Read the element data. // h = typeMethods.i4mat_header_read(element_filename); int element_order1 = h.m; int element_num = h.n; if (element_order1 != 3) { Console.WriteLine(""); Console.WriteLine("TRIANGULATION_L2Q - Fatal error!"); Console.WriteLine(" Data is not for a 3-node triangulation."); return; } Console.WriteLine(""); Console.WriteLine(" Read the header of \"" + element_filename + "\"."); Console.WriteLine(""); Console.WriteLine(" Element order = " + element_order1 + ""); Console.WriteLine(" Number of elements = " + element_num + ""); int[] element_node1 = typeMethods.i4mat_data_read(element_filename, element_order1, element_num); Console.WriteLine(""); Console.WriteLine(" Read the data in \"" + element_filename + "\"."); typeMethods.i4mat_transpose_print_some(element_order1, element_num, element_node1, 1, 1, element_order1, 10, " First 10 elements:"); // // Detect and correct 1-based node indexing. // Mesh.mesh_base_zero(node_num1, element_order1, element_num, ref element_node1); // // Determine the number of midside nodes that will be added. // int boundary_num = Boundary.triangulation_order3_boundary_edge_count(element_num, element_node1); int interior_num = (3 * element_num - boundary_num) / 2; int edge_num = interior_num + boundary_num; Console.WriteLine(""); Console.WriteLine(" Number of midside nodes to add = " + edge_num + ""); // // Allocate space. // int node_num2 = node_num1 + edge_num; int element_order2 = 6; double[] node_xy2 = new double[m * node_num2]; int[] element_node2 = new int[element_order2 * element_num]; // // Build the element neighbor array. // int[] element_neighbor = NeighborElements.triangulation_neighbor_triangles(element_order1, element_num, element_node1); typeMethods.i4mat_transpose_print(3, element_num, element_neighbor, " Element_neighbor:"); // // Create the midside nodes. // for (element = 0; element < element_num; element++) { for (i = 0; i < 3; i++) { element_node2[i + element * 6] = element_node1[i + element * 3]; } for (i = 3; i < 6; i++) { element_node2[i + element * 6] = -1; } } for (i = 0; i < m; i++) { int node; for (node = 0; node < node_num1; node++) { node_xy2[i + node * 2] = node_xy1[i + node * 2]; } for (node = node_num1; node < node_num2; node++) { node_xy2[i + node * 2] = -1.0; } } node_num2 = node_num1; Console.WriteLine(""); Console.WriteLine(" Generate midside nodes"); Console.WriteLine(""); for (element = 1; element <= element_num; element++) { for (i = 0; i < 3; i++) { // // CORRECTION #1 because element neighbor definition was changed. // int iii = typeMethods.i4_wrap(i + 2, 0, 2); int element2 = element_neighbor[iii + (element - 1) * 3]; switch (element2) { case > 0 when element2 < element: continue; } int ip1 = typeMethods.i4_wrap(i + 1, 0, 2); // // Temporary RETRO FIX! // int k1 = element_node2[i + (element - 1) * 6] + 1; int k2 = element_node2[ip1 + (element - 1) * 6] + 1; string cout = " " + node_num2.ToString(CultureInfo.InvariantCulture).PadLeft(8); int ii; for (ii = 0; ii < 2; ii++) { node_xy2[(node_xy2.Length + ii + node_num2 * m) % node_xy2.Length] = 0.5 * (node_xy1[(ii + (k1 - 1) * m + node_xy1.Length) % node_xy1.Length] + node_xy1[(ii + (k2 - 1) * m + node_xy1.Length) % node_xy1.Length]); cout += " " + node_xy2[(ii + node_num2 * m + node_xy2.Length) % node_xy2.Length].ToString(CultureInfo.InvariantCulture).PadLeft(12); } Console.WriteLine(cout); element_node2[3 + i + (element - 1) * 6] = node_num2; switch (element2) { case > 0: { for (ii = 0; ii < 3; ii++) { // // CORRECTION #2 because element neighbor definition changed. // iii = typeMethods.i4_wrap(ii + 2, 0, 2); if (element_neighbor[iii + (element2 - 1) * 3] == element) { element_node2[ii + 3 + (element2 - 1) * 6] = node_num2; } } break; } } node_num2 += 1; } } typeMethods.i4mat_transpose_print(element_order2, element_num, element_node2, " ELEMENT_NODE2:"); // // Write out the node and element data for the quadratic mesh. // typeMethods.r8mat_transpose_print(m, node_num2, node_xy2, " NODE_XY2:"); typeMethods.r8mat_write(node_l2q_filename, m, node_num2, node_xy2); typeMethods.i4mat_write(element_l2q_filename, element_order2, element_num, element_node2); Console.WriteLine(""); Console.WriteLine("TRIANGULATION_L2Q:"); Console.WriteLine(" Normal end of execution."); Console.WriteLine(""); }
public static Point[] DiagonalLebesgueSorter(Point[] array) { Boundary boundary = GetBoundary(array, 5); return(SortAlgorithm.Heapsort <Point>(array, (p1, p2) => DiagonalLebesgueComparer(p1, p2, boundary))); }
public static void Equality(double value, bool inclusive) { var a = Boundary.Create(value, inclusive); var b = Boundary.Create(value, inclusive); var ib = new B(value, inclusive); a.CompareLowTo(ib).Should().Be(0); a.CompareHighTo(ib).Should().Be(0); a.Equals((object)b).Should().BeTrue(); a.Equals("nope").Should().BeFalse(); a.CanRangeWith("nope").Should().BeFalse(); (a == b).Should().BeTrue(); (a >= b).Should().BeTrue(); (a <= b).Should().BeTrue(); a.CompareLowTo(a).Should().Be(0); a.CompareHighTo(a).Should().Be(0); a.GetHashCode().Should().Be(b.GetHashCode()); ib = new B(value + 1, inclusive); a.CompareLowTo(ib).Should().Be(-1); a.CompareHighTo(ib).Should().Be(-1); ib = new B(value - 1, inclusive); a.CompareLowTo(ib).Should().Be(+1); a.CompareHighTo(ib).Should().Be(+1); ib = new B(value + 1, !inclusive); a.CompareLowTo(ib).Should().Be(-1); a.CompareHighTo(ib).Should().Be(-1); ib = new B(value - 1, !inclusive); a.CompareLowTo(ib).Should().Be(+1); a.CompareHighTo(ib).Should().Be(+1); var c = Boundary.Create(value + 1, inclusive); var d = Boundary.Create(value + 1, !inclusive); a.Equals((object)c).Should().BeFalse(); (a != c).Should().BeTrue(); (a < c).Should().BeTrue(); (a <= c).Should().BeTrue(); a.CompareLowTo(c).Should().Be(-1); a.CompareHighTo(c).Should().Be(-1); c.CompareLowTo(a).Should().Be(+1); c.CompareHighTo(a).Should().Be(+1); a.CompareLowTo(d).Should().Be(-1); a.CompareHighTo(d).Should().Be(-1); d.CompareLowTo(a).Should().Be(+1); d.CompareHighTo(a).Should().Be(+1); a.GetHashCode().Should().NotBe(c.GetHashCode()); c = Boundary.Create(value - 1, inclusive); (a == c).Should().BeFalse(); (a > c).Should().BeTrue(); (a >= c).Should().BeTrue(); a.GetHashCode().Should().NotBe(c.GetHashCode()); d = Boundary.Create(value, !inclusive); d.Equals(c).Should().BeFalse(); d.CompareTo(c).Should().BePositive(); var i = inclusive ? +1 : -1; ib = new B(value, !inclusive); a.CompareLowTo(ib).Should().Be(-i); a.CompareHighTo(ib).Should().Be(+i); a.CompareLowTo(d).Should().Be(-i); a.CompareHighTo(d).Should().Be(+i); d.CompareLowTo(a).Should().Be(+i); d.CompareHighTo(a).Should().Be(-i); d.GetHashCode().Should().NotBe(c.GetHashCode()); d.GetHashCode().Should().NotBe(a.GetHashCode()); a.Equals(d).Should().BeFalse(); Assert.Throws <ArgumentException>( () => a.CompareTo(d)); }
internal static PropertyVm BedsCaption(this Boundary <long> beds) { string bedsCaption = DisplayHelper.GetBedsCaption(beds); return(new PropertyVm(bedsCaption, (bedsCaption.Equals("1", StringComparison.InvariantCultureIgnoreCase) || bedsCaption.Equals("Studio", StringComparison.InvariantCultureIgnoreCase) || bedsCaption.Equals("Efficiency", StringComparison.InvariantCultureIgnoreCase) ? "Bed" : "Beds"))); }
public static void GetChanges(Document _doc, string _filepath) // _filepath to .txt file in share folder { //string[] files = Directory.GetFiles(mapFolderPath, "*.txt"); float x = 0, y = 0; // callouts, main and floating topics int index = 1; // subtopic index in a branch string line = ""; string _case = ""; string _what = ""; // case details string rollup = SUtils.rollupuri; //string numbering = SUtils.numberinguri; string mapfolderpath = Path.GetDirectoryName(_filepath) + "\\"; //foreach (string file in files) { System.IO.StreamReader _file = null; try { _file = new System.IO.StreamReader(_filepath); } catch (Exception e) { System.Windows.Forms.MessageBox.Show("Exception: " + e.Message, "ReceiveChanges:StreamReader"); return; } line = _file.ReadLine(); // line 1: case _case = line; int colon = line.IndexOf(":"); if (colon != -1) { _case = line.Substring(0, colon); // before colon _what = line.Substring(++colon); // after colon if (!int.TryParse(_what, out index)) { index = 1; } } MapCompanion.received = true; // to repulse event handlers switch (_case) { ///////////////////////// MODIFY TOPIC /////////////////////// case "modify": // line 2: topic Guid _t = SUtils.FindTopicByAttrGuid(_doc, _file.ReadLine()); if (_t == null) { System.Windows.Forms.MessageBox.Show("ReceiveChanges.CaseModify.TopicNotFound"); break; //TODO } if (_what == "rollup") // set or remove rollup { if (_t.HasAttributesNamespace[rollup]) { _t.IsTaskRollupTopic = false; } else { _t.IsTaskRollupTopic = true; } break; } // line 3: topic text (for chat) forchat = _file.ReadLine(); // line 4: timestamp (to attributes) TransactionsWrapper.SetATTR(_t, SUtils.TMODIFIED, _file.ReadLine()); // line 5: offset line = _file.ReadLine(); if (line != "") { if (_t.IsFloatingTopic || _t.IsMainTopic || _t.IsCalloutTopic) { int w = line.IndexOf(";"); float.TryParse(line.Substring(0, w), out x); float.TryParse(line.Substring(w + 1), out y); } } // line 6 to end: value line = _file.ReadLine(); string _value = line; while (line != null) { line = _file.ReadLine(); if (line != null) { _value = _value + Environment.NewLine + line; } } if (_what != "offset") { PortraitSet.TopicPortrait(_t, _what, _value, mapfolderpath); } if (_t.IsFloatingTopic || _t.IsMainTopic || _t.IsCalloutTopic) { _t.SetOffset(x, y); //restore topic position } break; ////////////////// MODIFY case ends /////////////////// /////////////////////////// ADD TOPIC //////////////////////// case "add": Topic _parent = null; Boundary _bparent = null; Relationship _rparent = null; // line 2: parent guid line = _file.ReadLine(); if (line != "") // empty if floating topic { if (_what == "relcallout") { _rparent = SUtils.FindRelationshipByAttrGuid(_doc, line); } else if (_what == "bndcallout") { _bparent = SUtils.FindBoundaryByAttrGuid(_doc, line); } else { _parent = SUtils.FindTopicByAttrGuid(_doc, line); } if (_parent == null && _rparent == null && _bparent == null) { System.Windows.Forms.MessageBox.Show("ReceiveChanges.CaseAdd.ObjectNotFound"); break; // TODO обнаружить ошибку - сообщить пользователю? } } // line 3: topic text - for chat forchat = _file.ReadLine(); // line 4: added topic guid : add topic line = _file.ReadLine(); if (_what == "floating") { _t = _doc.AllFloatingTopics.Add(); } else if (_what == "callout") { _t = _parent.AllCalloutTopics.Add(); } else if (_what == "relcallout") { _t = _rparent.AllCalloutTopics.Add(); } else if (_what == "bndcallout") { _t = _bparent.CreateSummaryTopic(MMUtils.GetString("callout.text")); } else { _t = _parent.AllSubTopics.Add(); _parent.AllSubTopics.Insert(_t, index); // EventDocumentClipboardPaste fires! MapCompanion.paste = false; // so, neutralize it... } TransactionsWrapper.SetATTR(_t, SUtils.OGUID, line); // line 5: timestamp line = _file.ReadLine(); TransactionsWrapper.SetATTR(_t, SUtils.TADDED, line); TransactionsWrapper.SetATTR(_t, SUtils.TMODIFIED, line); // line 6: offset line = _file.ReadLine(); if (line != "") // skip standart topics { int w = line.IndexOf(";"); float.TryParse(line.Substring(0, w), out x); float.TryParse(line.Substring(w + 1), out y); } if (_t.IsFloatingTopic || _t.IsMainTopic || _t.IsCalloutTopic) { _t.SetOffset(x, y); } // line 7: skip if new topic added, otherwise (topic was pasted) replace whole topic xml line = _file.ReadLine(); // <?xml version="1.0" standalone="no"?> if (line != "newtopic") { _t.Xml = line + _file.ReadLine(); // topic XML if (_t.IsFloatingTopic || _t.IsMainTopic || _t.IsCalloutTopic) { _t.SetOffset(x, y); } } _parent = null; _rparent = null; _bparent = null; break; ///////////////////// ADD TOPIC case ends //////////////////////// //////////// DELETE TOPIC OR RELATIONSHIP OR BOUNDARY //////////// case "delete": // line 2: guid of object to delete line = _file.ReadLine(); DocumentObject m_objtodelete = null; m_objtodelete = SUtils.FindObjectByAttrGuid(_doc, line); if (m_objtodelete == null) { System.Windows.Forms.MessageBox.Show("ReceiveChanges.CaseDelete.ObjectNotFound"); break; // TODO map synchro failure, do something } m_objtodelete.Delete(); m_objtodelete = null; // line 3: for chat: topic text or "relationship" or "boundary" forchat = _file.ReadLine(); // line 4: for chat: name of user who deleted object username = _file.ReadLine(); break; //////////////////// DELETE case ends //////////////////// //////////////////// RELATIONSHIP ADD, MODIFY ////////////////// case "relationship": Relationship rel = null; // line 2: relationship guid line = _file.ReadLine(); if (_what == "modify") { rel = SUtils.FindRelationshipByAttrGuid(_doc, line); if (rel == null) { System.Windows.Forms.MessageBox.Show("ReceiveChanges.CaseRelationships.RelNotFound"); break; } } // line 3: Guid of connection 1st object string Guid1 = _file.ReadLine(); Topic t1 = null, t2 = null; Boundary b1 = SUtils.FindBoundaryByAttrGuid(_doc, Guid1); if (b1 == null) { t1 = SUtils.FindTopicByAttrGuid(_doc, Guid1); } if (b1 == null && t1 == null) { System.Windows.Forms.MessageBox.Show("ReceiveChanges.CaseRelationships.Object1NotFound"); break; // TODO } // line 4: string Guid2 = _file.ReadLine(); Boundary b2 = SUtils.FindBoundaryByAttrGuid(_doc, Guid2); if (b2 == null) { t2 = SUtils.FindTopicByAttrGuid(_doc, Guid2); } if (b2 == null && t2 == null) { System.Windows.Forms.MessageBox.Show("ReceiveChanges.CaseRelationships.Object2NotFound"); break; // TODO } if (b1 == null) { if (b2 == null) { if (_what == "modify") { rel.SetConnection1ToTopic(t1); rel.SetConnection2ToTopic(t2); } else { rel = t1.AllRelationships.AddToTopic(t2); TransactionsWrapper.SetAttributes(rel, line); } } else if (_what == "modify") { rel.SetConnection1ToTopic(t1); rel.SetConnection2ToBoundary(b2); } else { rel = t1.AllRelationships.AddToBoundary(b2); TransactionsWrapper.SetAttributes(rel, line); } } else { if (b2 == null) { if (_what == "modify") { rel.SetConnection1ToBoundary(b1); rel.SetConnection2ToTopic(t2); } else { rel = b1.AllRelationships.AddToTopic(t2); TransactionsWrapper.SetAttributes(rel, line); } } else if (_what == "modify") { rel.SetConnection1ToBoundary(b1); rel.SetConnection2ToBoundary(b2); } else { rel = b1.AllRelationships.AddToBoundary(b2); TransactionsWrapper.SetAttributes(rel, line); } } // line 5-8: control points if ((line = _file.ReadLine()) == null) //new rel added, go out { break; } rel.SetControlPoints( Convert.ToSingle(line), Convert.ToSingle(_file.ReadLine()), Convert.ToSingle(_file.ReadLine()), Convert.ToSingle(_file.ReadLine()) ); // line 9-10: rel.Shape1 = RelationshipShape(_file.ReadLine()); rel.Shape2 = RelationshipShape(_file.ReadLine()); // line 11: rel.LineColor.Value = Convert.ToInt32(_file.ReadLine()); // line 12: rel.LineDashStyle = LineDashStyle(_file.ReadLine()); // line 13: rel.LineShape = LineShape(_file.ReadLine()); // line 14: rel.LineWidth = Convert.ToSingle(_file.ReadLine()); // line 15: rel.AutoRouting = Convert.ToBoolean(_file.ReadLine()); rel = null; t1 = null; t2 = null; b1 = null; b2 = null; break; /////////////// RELATIONSHIP case ends ////////// /////////////////// ADD OR MODIFY BOUNDARY //////////////// case "boundary": // line 2: topic guid _t = SUtils.FindTopicByAttrGuid(_doc, _file.ReadLine()); Boundary b = null; // line 3: boundary shape or portrait if (_what == "add") { b = _t.CreateBoundary(); b.Shape = BoundaryShape(_file.ReadLine()); } else // modify boundary { b = _t.Boundary; string[] bvalues = _file.ReadLine().Split(';'); b.Shape = MMEnums.BoundaryShape(bvalues[0]); b.FillColor.Value = Convert.ToInt32(bvalues[1]); b.LineColor.Value = Convert.ToInt32(bvalues[2]); b.LineDashStyle = MMEnums.LineDashStyle(bvalues[3]); b.LineWidth = Convert.ToInt32(bvalues[4]); } // line 4: boundary guid TransactionsWrapper.SetAttributes(b, _file.ReadLine()); b = null; break; ////////////// BOUNDARY case ends //////////////// } MapCompanion.received = false; _file.Close(); _t = null; // TODO dooble-check! very important!! //File.Delete(file); } // foreach files //MMBase.SendMessage("received"); // TODO nedeed? }
/// <summary> /// 添加范围查询条件 /// </summary> /// <param name="expression">列名表达式</param> /// <param name="min">最小值</param> /// <param name="max">最大值</param> /// <param name="boundary">包含边界</param> public void Between <TEntity>(Expression <Func <TEntity, object> > expression, decimal?min, decimal?max, Boundary boundary) where TEntity : class { var column = _helper.GetColumn(expression); Between(column, min, max, boundary); }
/// <summary> /// 初始化日期范围过滤条件 - 包含时间 /// </summary> /// <param name="propertyExpression">属性表达式</param> /// <param name="min">最小值</param> /// <param name="max">最大值</param> /// <param name="boundary">包含边界</param> public DateTimeSegmentCriteria(Expression <Func <TEntity, TProperty> > propertyExpression, DateTime?min, DateTime?max, Boundary boundary = Boundary.Both) : base(propertyExpression, min, max, boundary) { }
/// <summary> /// 对第一次切割后不是4张小图的做处理 /// </summary> /// <param name="img"></param> /// <param name="_bmp"></param> /// <param name="list"></param> /// <returns></returns> private static List <Boundary> NotFourChars(Image img, out Bitmap _bmp, List <Boundary> list, int charWidth) { if (list.Count == 0) { _bmp = TrimBmp(img); list.Add(new Boundary() { StartX = 0, EndX = _bmp.Height - 1, EndY = _bmp.Width - 1, StartY = 0 }); } else { _bmp = new Bitmap(img); } if (list.Count == 1) { //平均切割 Boundary bd = list[0]; int _startY = bd.StartY; int _endY = _startY; int _startX = bd.StartX; int _endX = bd.EndX; int avr = (list[0].EndY - list[0].StartY) / 4 - 1; list.Clear(); for (int i = 0; i < 4; i++) { _endY = _startY + avr; list.Add(new Boundary { EndY = _endY, EndX = _endX, StartY = _startY, StartX = _startX }); _startY = _endY + 1; } } if (list.Count == 3) { Boundary max = list[0]; int index = 0; for (int i = 1; i < list.Count; i++) { Boundary _max = list[i]; if (max.EndY - max.StartY < _max.EndY - _max.StartY) { index = i; max = _max; } } //平分 int _startY = max.StartY; int _endY = _startY; int _startX = max.StartX; int _endX = max.EndX; int avr = (max.EndY - max.StartY) / 2 - 1; list.Remove(max); for (int i = 0; i < 2; i++) { _endY = _startY + avr; list.Insert(index, new Boundary { EndY = _endY, EndX = _endX, StartY = _startY, StartX = _startX }); index = index + 1; _startY = _endY + 1; } } if (list.Count == 2) { if (Math.Abs((list[1].EndY - list[1].StartY) - (list[0].EndY - list[0].StartY)) > 1.5 * charWidth) { Boundary max = (list[1].EndY - list[1].StartY) > (list[0].EndY - list[0].StartY) ? list[1] : list[0]; //平分 int index = (list[1].EndY - list[1].StartY) > (list[0].EndY - list[0].StartY) ? 1 : 0; int _startY = max.StartY; int _endY = _startY; int _startX = max.StartX; int _endX = max.EndX; int avr = (max.EndY - max.StartY) / 3 - 1; list.Remove(max); for (int i = 0; i < 3; i++) { _endY = _startY + avr; list.Insert(index, new Boundary { EndY = _endY, EndX = _endX, StartY = _startY, StartX = _startX }); index = index + 1; _startY = _endY + 1; } } else { List <Boundary> _temp = new List <Boundary>(); for (int i = 0; i < 2; i++) { Boundary max = list[i]; //平分 int _startY = max.StartY; int _endY = _startY; int _startX = max.StartX; int _endX = max.EndX; int avr = (max.EndY - max.StartY) / 2 - 1; for (int j = 0; j < 2; j++) { _endY = _startY + avr; _temp.Add(new Boundary { EndY = _endY, EndX = _endX, StartY = _startY, StartX = _startX }); _startY = _endY + 1; } } list = _temp; } } return(list); }
/// <summary> /// 设置范围查询条件 /// </summary> /// <typeparam name="TEntity">实体类型</typeparam> /// <param name="sqlQuery">Sql查询对象</param> /// <param name="expression">列名表达式,范例:t => t.Name</param> /// <param name="min">最小值</param> /// <param name="max">最大值</param> /// <param name="boundary">包含边界</param> /// <returns></returns> public static ISqlQuery Between <TEntity>(this ISqlQuery sqlQuery, Expression <Func <TEntity, object> > expression, double?min, double?max, Boundary boundary = Boundary.Both) where TEntity : class { var builder = sqlQuery.GetBuilder(); builder.Between(expression, min, max, boundary); return(sqlQuery); }
/// <summary> /// 初始化范围过滤条件 /// </summary> /// <param name="propertyExpression">属性表达式</param> /// <param name="min">最小值</param> /// <param name="max">最大值</param> /// <param name="boundary">包含边界</param> protected SegmentCriteriaBase(Expression <Func <TEntity, TProperty> > propertyExpression, TValue?min, TValue?max, Boundary boundary) { _builder = new PredicateExpressionBuilder <TEntity>(); _propertyExpression = propertyExpression; _min = min; _max = max; _boundary = boundary; }
/// <summary> /// 初始化decimal范围过滤条件 /// </summary> /// <param name="propertyExpression">属性表达式</param> /// <param name="min">最小值</param> /// <param name="max">最大值</param> /// <param name="boundary">包含边界</param> public DecimalSegmentCriteria(Expression <Func <TEntity, TProperty> > propertyExpression, decimal?min, decimal?max, Boundary boundary = Boundary.Both) : base(propertyExpression, min, max, boundary) { }
protected virtual void Start() { boundary = ScaledBoundary(Vector2.zero); }
public static int GrayComparer(Point first, Point second, Boundary mbb) { return(SpaceFillingCurves.Gray(Moves.North, Moves.East, Moves.South).ComparePoints(first, second, mbb)); }
internal static PropertyVm BathesCaption(this Boundary <long> bathes) { string bathesCaption = DisplayHelper.GetBathesCaption(bathes); return(new PropertyVm(bathesCaption, (bathesCaption.Equals("1", StringComparison.InvariantCulture) ? "Bath" : "Baths"))); }