/// <summary> /// Merge updates only the Null attributes of this object /// with the attributes of another. /// </summary> public virtual void Merge(TopologyLocation gl) { // if the src is an Area label & and the dest is not, increase the dest to be an Area if (gl.location.Length > location.Length) { Locations[] newLoc = new Locations[3]; newLoc[(int)Positions.On] = location[(int)Positions.On]; newLoc[(int)Positions.Left] = Locations.Null; newLoc[(int)Positions.Right] = Locations.Null; location = newLoc; } for (int i = 0; i < location.Length; i++) if (location[i] == Locations.Null && i < gl.location.Length) location[i] = gl.location[i]; }
/// <summary> /// /// </summary> /// <param name="gl"></param> public TopologyLocation(TopologyLocation gl) { Init(gl.location.Length); if (gl != null) { for (int i = 0; i < location.Length; i++) location[i] = gl.location[i]; } }
/// <summary> /// /// </summary> /// <param name="le"></param> /// <param name="locIndex"></param> /// <returns></returns> public virtual bool IsEqualOnSide(TopologyLocation le, int locIndex) { return location[locIndex] == le.location[locIndex]; }
/// <summary> /// /// </summary> /// <param name="gl"></param> public virtual void SetLocations(TopologyLocation gl) { for (int i = 0; i < gl.location.Length; i++) location[i] = gl.location[i]; }
/// <summary> /// Construct a Label with a single location for both Geometries. /// Initialize the location for the Geometry index. /// </summary> /// <param name="geomIndex"></param> /// <param name="onLoc"></param> public Label(int geomIndex, Locations onLoc) { elt[0] = new TopologyLocation(Locations.Null); elt[1] = new TopologyLocation(Locations.Null); elt[geomIndex].SetLocation(onLoc); }
/// <summary> /// Construct a Label with On, Left and Right locations for both Geometries. /// Initialize the locations for both Geometries to the given values. /// </summary> /// <param name="onLoc"></param> /// <param name="leftLoc"></param> /// <param name="rightLoc"></param> public Label(Locations onLoc, Locations leftLoc, Locations rightLoc) { elt[0] = new TopologyLocation(onLoc, leftLoc, rightLoc); elt[1] = new TopologyLocation(onLoc, leftLoc, rightLoc); }
/// <summary> /// Converts one GeometryLocation to a Line location. /// </summary> /// <param name="geomIndex"></param> public virtual void ToLine(int geomIndex) { if (elt[geomIndex].IsArea) elt[geomIndex] = new TopologyLocation(elt[geomIndex].GetLocations()[0]); }
/// <summary> /// Construct a Label with a single location for both Geometries. /// Initialize the locations to Null. /// </summary> /// <param name="onLoc"></param> public Label(Locations onLoc) { elt[0] = new TopologyLocation(onLoc); elt[1] = new TopologyLocation(onLoc); }
/// <summary> /// /// </summary> /// <param name="geomIndex"></param> /// <param name="tl"></param> private void SetGeometryLocation(int geomIndex, TopologyLocation tl) { if (tl == null) return; elt[geomIndex].SetLocations(tl); }
/// <summary> /// Merge this label with another one. /// Merging updates any null attributes of this label with the attributes from lbl. /// </summary> /// <param name="lbl"></param> public virtual void Merge(Label lbl) { for (int i = 0; i < 2; i++) { if (elt[i] == null && lbl.elt[i] != null) elt[i] = new TopologyLocation(lbl.elt[i]); else elt[i].Merge(lbl.elt[i]); } }
/// <summary> /// Construct a Label with the same values as the argument Label. /// </summary> /// <param name="lbl"></param> public Label(Label lbl) { elt[0] = new TopologyLocation(lbl.elt[0]); elt[1] = new TopologyLocation(lbl.elt[1]); }
/// <summary> /// Construct a Label with the same values as the argument for the /// given Geometry index. /// </summary> /// <param name="geomIndex"></param> /// <param name="gl"></param> public Label(int geomIndex, TopologyLocation gl) { elt[0] = new TopologyLocation(gl.GetLocations()); elt[1] = new TopologyLocation(gl.GetLocations()); elt[geomIndex].SetLocations(gl); }
/// <summary> /// Construct a Label with On, Left and Right locations for both Geometries. /// Initialize the locations for the given Geometry index. /// </summary> /// <param name="geomIndex"></param> /// <param name="onLoc"></param> /// <param name="leftLoc"></param> /// <param name="rightLoc"></param> public Label(int geomIndex, Locations onLoc, Locations leftLoc, Locations rightLoc) { elt[0] = new TopologyLocation(Locations.Null, Locations.Null, Locations.Null); elt[1] = new TopologyLocation(Locations.Null, Locations.Null, Locations.Null); elt[geomIndex].SetLocations(onLoc, leftLoc, rightLoc); }