using Core.Gis.GeoApi.Geometries; using Core.GIS.NetTopologySuite.Utilities; namespace Core.GIS.NetTopologySuite.GeometriesGraph { /// /// A GraphComponent is the parent class for the objects' /// that form a graph. Each GraphComponent can carry a /// Label. /// public abstract class GraphComponent { /// /// /// protected Label label; // isInResult indicates if this component has already been included in the result private bool isCovered = false; /// /// /// public GraphComponent() { Visited = false; IsCoveredSet = false; InResult = false; } /// /// /// /// public GraphComponent(Label label) { Visited = false; IsCoveredSet = false; InResult = false; this.label = label; } /// /// /// public Label Label { get { return label; } set { label = value; } } /// /// /// public bool InResult { get; set; } /// /// IsInResult indicates if this component has already been included in the result. /// public bool IsInResult { get { return InResult; } } /// /// /// public bool Covered { get { return isCovered; } set { isCovered = value; IsCoveredSet = true; } } /// /// /// public bool IsCovered { get { return Covered; } } /// /// /// public bool IsCoveredSet { get; private set; } /// /// /// public bool Visited { get; set; } /// /// /// public bool IsVisited { get { return Visited; } } /// /// /// /// /// A coordinate in this component (or null, if there are none). /// public abstract ICoordinate Coordinate { get; } /// /// An isolated component is one that does not intersect or touch any other /// component. This is the case if the label has valid locations for /// only a single Geometry. /// /// true if this component is isolated. public abstract bool IsIsolated { get; } /// /// Compute the contribution to an IM for this component. /// public abstract void ComputeIM(IntersectionMatrix im); /// /// Update the IM with the contribution for this component. /// A component only contributes if it has a labelling for both parent geometries. /// /// public void UpdateIM(IntersectionMatrix im) { Assert.IsTrue(label.GeometryCount >= 2, "found partial label"); ComputeIM(im); } } }