Exemple #1
0
 /// <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);
         }
     }
 }
Exemple #2
0
 /// <summary>Merges this envelope with the extent of the given envelope.</summary>
 /// <remarks>
 /// Merges this envelope with the extent of the given envelope. If this
 /// envelope is empty, the coordinates of the given envelope
 /// are assigned. If the given envelope is empty, this envelope is unchanged.
 /// </remarks>
 /// <param name="other">The envelope to merge.</param>
 public virtual void Merge(com.epl.geometry.Envelope other)
 {
     _touch();
     if (other.IsEmpty())
     {
         return;
     }
     com.epl.geometry.VertexDescription otherVD = other.m_description;
     if (otherVD != m_description)
     {
         MergeVertexDescription(otherVD);
     }
     m_envelope.Merge(other.m_envelope);
     for (int iattrib = 1, nattrib = otherVD.GetAttributeCount(); iattrib < nattrib; iattrib++)
     {
         int semantics = otherVD.GetSemantics(iattrib);
         int ncomps    = com.epl.geometry.VertexDescription.GetComponentCount(semantics);
         for (int iord = 0; iord < ncomps; iord++)
         {
             com.epl.geometry.Envelope1D intervalOther = other.QueryInterval(semantics, iord);
             com.epl.geometry.Envelope1D interval      = QueryInterval(semantics, iord);
             interval.Merge(intervalOther);
             SetInterval(semantics, iord, interval);
         }
     }
 }
 // Checked vs. Jan 11, 2011
 /// <param name="bExact">
 /// True, when the exact envelope need to be calculated and false
 /// for the loose one.
 /// </param>
 protected internal virtual void _updateAllDirtyIntervals(bool bExact)
 {
     _verifyAllStreams();
     if (_hasDirtyFlag(com.epl.geometry.MultiVertexGeometryImpl.DirtyFlags.DirtyIntervals))
     {
         if (null == m_envelope)
         {
             m_envelope = new com.epl.geometry.Envelope(m_description);
         }
         else
         {
             m_envelope.AssignVertexDescription(m_description);
         }
         if (IsEmpty())
         {
             m_envelope.SetEmpty();
             return;
         }
         _updateXYImpl(bExact);
         // efficient method for xy's
         // now go through other attribues.
         for (int attributeIndex = 1; attributeIndex < m_description.GetAttributeCount(); attributeIndex++)
         {
             int semantics = m_description._getSemanticsImpl(attributeIndex);
             int ncomps    = com.epl.geometry.VertexDescription.GetComponentCount(semantics);
             com.epl.geometry.AttributeStreamBase stream = m_vertexAttributes[attributeIndex];
             for (int iord = 0; iord < ncomps; iord++)
             {
                 com.epl.geometry.Envelope1D interval = new com.epl.geometry.Envelope1D();
                 interval.SetEmpty();
                 for (int i = 0; i < m_pointCount; i++)
                 {
                     double value = stream.ReadAsDbl(i * ncomps + iord);
                     // some
                     // optimization
                     // is
                     // possible
                     // if
                     // non-virtual
                     // method
                     // is
                     // used
                     interval.Merge(value);
                 }
                 m_envelope.SetInterval(semantics, iord, interval);
             }
         }
         if (bExact)
         {
             _setDirtyFlag(com.epl.geometry.MultiVertexGeometryImpl.DirtyFlags.DirtyIntervals, false);
         }
     }
 }