internal void FillMultiPath(com.epl.geometry.SimpleRasterizer rasterizer, com.epl.geometry.Transformation2D trans, com.epl.geometry.MultiPathImpl polygon, bool isWinding)
 {
     com.epl.geometry.SegmentIteratorImpl segIter = polygon.QuerySegmentIterator();
     com.epl.geometry.Point2D             p1      = new com.epl.geometry.Point2D();
     com.epl.geometry.Point2D             p2      = new com.epl.geometry.Point2D();
     while (segIter.NextPath())
     {
         while (segIter.HasNextSegment())
         {
             com.epl.geometry.Segment seg = segIter.NextSegment();
             if (seg.GetType() != com.epl.geometry.Geometry.Type.Line)
             {
                 throw com.epl.geometry.GeometryException.GeometryInternalError();
             }
             // TODO:
             // densify
             // the
             // segment
             // here
             trans.Transform(seg.GetStartXY(), p1);
             trans.Transform(seg.GetEndXY(), p2);
             m_rasterizer.AddEdge(p1.x, p1.y, p2.x, p2.y);
         }
     }
     m_rasterizer.RenderEdges(isWinding ? com.epl.geometry.SimpleRasterizer.WINDING : com.epl.geometry.SimpleRasterizer.EVEN_ODD);
 }
Пример #2
0
 public override void ApplyTransformation(com.epl.geometry.Transformation2D transform)
 {
     _touch();
     com.epl.geometry.Point2D pt = new com.epl.geometry.Point2D();
     pt.x = m_xStart;
     pt.y = m_yStart;
     transform.Transform(pt, pt);
     m_xStart = pt.x;
     m_yStart = pt.y;
     pt.x     = m_xEnd;
     pt.y     = m_yEnd;
     transform.Transform(pt, pt);
     m_xEnd = pt.x;
     m_yEnd = pt.y;
 }
Пример #3
0
 public override void ApplyTransformation(com.epl.geometry.Transformation2D transform)
 {
     if (IsEmptyImpl())
     {
         return;
     }
     com.epl.geometry.Point2D pt = GetXY();
     transform.Transform(pt, pt);
     SetXY(pt);
 }
Пример #4
0
 public override void ApplyTransformation(com.epl.geometry.Transformation2D transform)
 {
     if (IsEmpty())
     {
         return;
     }
     _verifyAllStreams();
     com.epl.geometry.AttributeStreamOfDbl points = (com.epl.geometry.AttributeStreamOfDbl)m_vertexAttributes[0];
     com.epl.geometry.Point2D pt2 = new com.epl.geometry.Point2D();
     for (int ipoint = 0; ipoint < m_pointCount; ipoint++)
     {
         pt2.x = points.Read(ipoint * 2);
         pt2.y = points.Read(ipoint * 2 + 1);
         transform.Transform(pt2, pt2);
         points.Write(ipoint * 2, pt2.x);
         points.Write(ipoint * 2 + 1, pt2.y);
     }
     // REFACTOR: reset the exact envelope only and transform the loose
     // envelope
     NotifyModified(com.epl.geometry.MultiVertexGeometryImpl.DirtyFlags.DirtyCoordinates);
 }
        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);
                }
            }
        }
Пример #6
0
 public override void ApplyTransformation(com.epl.geometry.Transformation2D transform)
 {
     _touch();
     transform.Transform(m_envelope);
 }