// 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);
         }
     }
 }
        public override void ReplaceNaNs(int semantics, double value)
        {
            AddAttribute(semantics);
            if (IsEmpty())
            {
                return;
            }
            bool modified = false;
            int  ncomps   = com.epl.geometry.VertexDescription.GetComponentCount(semantics);

            for (int i = 0; i < ncomps; i++)
            {
                com.epl.geometry.AttributeStreamBase streamBase = GetAttributeStreamRef(semantics);
                if (streamBase is com.epl.geometry.AttributeStreamOfDbl)
                {
                    com.epl.geometry.AttributeStreamOfDbl dblStream = (com.epl.geometry.AttributeStreamOfDbl)streamBase;
                    for (int ivert = 0, n = m_pointCount * ncomps; ivert < n; ivert++)
                    {
                        double v = dblStream.Read(ivert);
                        if (double.IsNaN(v))
                        {
                            dblStream.Write(ivert, value);
                            modified = true;
                        }
                    }
                }
                else
                {
                    for (int ivert = 0, n = m_pointCount * ncomps; ivert < n; ivert++)
                    {
                        double v = streamBase.ReadAsDbl(ivert);
                        if (double.IsNaN(v))
                        {
                            streamBase.WriteAsDbl(ivert, value);
                            modified = true;
                        }
                    }
                }
            }
            if (modified)
            {
                NotifyModified(com.epl.geometry.MultiVertexGeometryImpl.DirtyFlags.DirtyCoordinates);
            }
        }