/// <summary> /// Returns TRUE when this geometry has exactly same type, properties, and /// coordinates as the other geometry. /// </summary> public override bool Equals(object _other) { if (_other == this) { return(true); } if (!(_other is com.epl.geometry.Point)) { return(false); } com.epl.geometry.Point otherPt = (com.epl.geometry.Point)_other; if (m_description != otherPt.m_description) { return(false); } if (IsEmptyImpl()) { if (otherPt.IsEmptyImpl()) { return(true); } else { return(false); } } for (int i = 0, n = m_description.GetTotalComponentCount(); i < n; i++) { if (m_attributes[i] != otherPt.m_attributes[i]) { return(false); } } return(true); }
/// <summary>Merges this envelope with the point.</summary> /// <remarks> /// Merges this envelope with the point. The boundary of the envelope is /// increased to include the point. If the envelope is empty, the coordinates /// of the point to merge are assigned. If the point is empty, the original /// envelope is unchanged. /// </remarks> /// <param name="point">The point to be merged.</param> public virtual void Merge(com.epl.geometry.Point point) { _touch(); if (point.IsEmptyImpl()) { return; } com.epl.geometry.VertexDescription pointVD = point.m_description; if (m_description != pointVD) { MergeVertexDescription(pointVD); } if (IsEmpty()) { _setFromPoint(point); return; } m_envelope.Merge(point.GetXY()); for (int iattrib = 1, nattrib = pointVD.GetAttributeCount(); iattrib < nattrib; iattrib++) { int semantics = pointVD._getSemanticsImpl(iattrib); int ncomps = com.epl.geometry.VertexDescription.GetComponentCount(semantics); for (int iord = 0; iord < ncomps; iord++) { double v = point.GetAttributeAsDbl(semantics, iord); com.epl.geometry.Envelope1D interval = QueryInterval(semantics, iord); interval.Merge(v); SetInterval(semantics, iord, interval); } } }
private void _set(int endPoint, com.epl.geometry.Point src) { _touch(); com.epl.geometry.Point point = src; if (src.IsEmptyImpl()) { // can not assign an empty point throw new com.epl.geometry.GeometryException("empty_Geometry"); } com.epl.geometry.VertexDescription vdin = point.GetDescription(); for (int attributeIndex = 0, nattrib = vdin.GetAttributeCount(); attributeIndex < nattrib; attributeIndex++) { int semantics = vdin._getSemanticsImpl(attributeIndex); int ncomp = com.epl.geometry.VertexDescription.GetComponentCount(semantics); for (int icomp = 0; icomp < ncomp; icomp++) { double v = point.GetAttributeAsDbl(semantics, icomp); _setAttribute(endPoint, semantics, icomp, v); } } }
private void _get(int endPoint, com.epl.geometry.Point outPoint) { if (IsEmptyImpl()) { throw new com.epl.geometry.GeometryException("empty geometry"); } // ._setToDefault(); outPoint.AssignVertexDescription(m_description); if (outPoint.IsEmptyImpl()) { outPoint._setToDefault(); } for (int attributeIndex = 0; attributeIndex < m_description.GetAttributeCount(); attributeIndex++) { int semantics = m_description._getSemanticsImpl(attributeIndex); for (int icomp = 0, ncomp = com.epl.geometry.VertexDescription.GetComponentCount(semantics); icomp < ncomp; icomp++) { double v = _getAttributeAsDbl(endPoint, semantics, icomp); outPoint.SetAttribute(semantics, icomp, v); } } }