//////////////////////////////////////////////////////////////////////////// //--------------------------------- REVISIONS ------------------------------ // Date Name Tracking # Description // --------- ------------------- ------------- ---------------------- // 21JUN2009 James Shen Initial Creation //////////////////////////////////////////////////////////////////////////// /** * draw a region. * @param mapPen pen for the border of the region. * @param mapBrush brush to fill the region. * @param region the polygon object. */ private void DrawRegion(MapPen mapPen, MapBrush mapBrush, GeoPolygon region) { Pen pen = new Pen(new Color(mapPen.Color,false), mapPen.Width); TextureBrush brush = GetImagePatternBrush(mapBrush); ArrayList clippedPts = _sutherlandHodgman.ClipRegion(region.GetPoints()); GeoPoint[] screenPts = FromLatLngToMapPixel(clippedPts); if (screenPts.Length > 2) { { int[] xpoints = new int[screenPts.Length]; int[] ypoints = new int[screenPts.Length]; for (int i = 0; i < screenPts.Length; i++) { xpoints[i] = (int)screenPts[i].X; ypoints[i] = (int)screenPts[i].Y; } Polygon polygon = new Polygon { Xpoints = xpoints, Ypoints = ypoints, NumOfNpoints = xpoints.Length }; if (mapBrush.Pattern == 2) { SharedGraphics2D.SetPenAndBrush(pen, brush); SharedGraphics2D.DrawPolygon(null, polygon); SharedGraphics2D.FillPolygon(null, polygon); } else { SharedGraphics2D.SetDefaultPen(pen); SharedGraphics2D.DrawPolygon(null, polygon); } } } }
public PolygonPathIterator(Polygon pg, AffineTransform at) { poly = pg; transform = at; if (pg.NumOfNpoints == 0) { // Prevent a spurious SEG_CLOSE segment index = 1; } }