/// <summary>Sets the envelope from the attribute stream.</summary>
 /// <remarks>
 /// Sets the envelope from the attribute stream. The attribute stream stores
 /// interleaved x and y. The envelope will be set to empty if the pointCount
 /// is zero.
 /// </remarks>
 public void SetEnvelopeFromPoints(int pointCount, com.epl.geometry.Envelope2D inOutEnv)
 {
     if (pointCount == 0)
     {
         inOutEnv.SetEmpty();
         return;
     }
     if (pointCount < 0)
     {
         pointCount = Size() / 2;
     }
     else
     {
         if (pointCount * 2 > Size())
         {
             throw new System.ArgumentException();
         }
     }
     inOutEnv.SetCoords(Read(0), Read(1));
     for (int i = 1; i < pointCount; i++)
     {
         inOutEnv.MergeNE(Read(i * 2), Read(i * 2 + 1));
     }
 }
        internal void StrokeDrawPolyPath(com.epl.geometry.SimpleRasterizer rasterizer, com.epl.geometry.MultiPathImpl polyPath, double tol)
        {
            com.epl.geometry.Point2D[] fan = new com.epl.geometry.Point2D[4];
            for (int i = 0; i < fan.Length; i++)
            {
                fan[i] = new com.epl.geometry.Point2D();
            }
            com.epl.geometry.SegmentIteratorImpl segIter = polyPath.QuerySegmentIterator();
            double strokeHalfWidth = m_transform.Transform(tol) + 1.5;
            double shortSegment    = 0.25;

            com.epl.geometry.Point2D vec        = new com.epl.geometry.Point2D();
            com.epl.geometry.Point2D vecA       = new com.epl.geometry.Point2D();
            com.epl.geometry.Point2D vecB       = new com.epl.geometry.Point2D();
            com.epl.geometry.Point2D ptStart    = new com.epl.geometry.Point2D();
            com.epl.geometry.Point2D ptEnd      = new com.epl.geometry.Point2D();
            com.epl.geometry.Point2D prev_start = new com.epl.geometry.Point2D();
            com.epl.geometry.Point2D prev_end   = new com.epl.geometry.Point2D();
            double[] helper_xy_10_elm           = new double[10];
            com.epl.geometry.Envelope2D segEnv  = new com.epl.geometry.Envelope2D();
            com.epl.geometry.Point2D    ptOld   = new com.epl.geometry.Point2D();
            while (segIter.NextPath())
            {
                bool hasFan = false;
                bool first  = true;
                ptOld.SetCoords(0, 0);
                while (segIter.HasNextSegment())
                {
                    com.epl.geometry.Segment seg = segIter.NextSegment();
                    ptStart.x = seg.GetStartX();
                    ptStart.y = seg.GetStartY();
                    ptEnd.x   = seg.GetEndX();
                    ptEnd.y   = seg.GetEndY();
                    segEnv.SetEmpty();
                    segEnv.Merge(ptStart.x, ptStart.y);
                    segEnv.MergeNE(ptEnd.x, ptEnd.y);
                    if (!m_geomEnv.IsIntersectingNE(segEnv))
                    {
                        if (hasFan)
                        {
                            rasterizer.StartAddingEdges();
                            rasterizer.AddSegmentStroke(prev_start.x, prev_start.y, prev_end.x, prev_end.y, strokeHalfWidth, false, helper_xy_10_elm);
                            rasterizer.RenderEdges(com.epl.geometry.SimpleRasterizer.EVEN_ODD);
                            hasFan = false;
                        }
                        first = true;
                        continue;
                    }
                    m_transform.Transform(ptEnd, ptEnd);
                    if (first)
                    {
                        m_transform.Transform(ptStart, ptStart);
                        ptOld.SetCoords(ptStart);
                        first = false;
                    }
                    else
                    {
                        ptStart.SetCoords(ptOld);
                    }
                    prev_start.SetCoords(ptStart);
                    prev_end.SetCoords(ptEnd);
                    rasterizer.StartAddingEdges();
                    hasFan = !rasterizer.AddSegmentStroke(prev_start.x, prev_start.y, prev_end.x, prev_end.y, strokeHalfWidth, true, helper_xy_10_elm);
                    rasterizer.RenderEdges(com.epl.geometry.SimpleRasterizer.EVEN_ODD);
                    if (!hasFan)
                    {
                        ptOld.SetCoords(prev_end);
                    }
                }
                if (hasFan)
                {
                    rasterizer.StartAddingEdges();
                    hasFan = !rasterizer.AddSegmentStroke(prev_start.x, prev_start.y, prev_end.x, prev_end.y, strokeHalfWidth, false, helper_xy_10_elm);
                    rasterizer.RenderEdges(com.epl.geometry.SimpleRasterizer.EVEN_ODD);
                }
            }
        }