public static void SetPosition(AdornmentLocation location, RectangleShape boudingBox, PrinterLayer printerLayer, double width, double height, double left, double top)
        {
            switch (location)
            {
            case AdornmentLocation.UseOffsets:
                printerLayer.SetPosition(width, height, 0, 0, PrintingUnit.Inch);
                break;

            case AdornmentLocation.UpperLeft:
                printerLayer.SetPosition(width, height, boudingBox.UpperLeftPoint.X + width * 0.5 + left, boudingBox.UpperLeftPoint.Y - height * 0.5 - top, PrintingUnit.Inch);
                break;

            case AdornmentLocation.UpperCenter:
                printerLayer.SetPosition(width, height, left, boudingBox.UpperLeftPoint.Y - height * 0.5 - top, PrintingUnit.Inch);
                break;

            case AdornmentLocation.UpperRight:
                printerLayer.SetPosition(width, height, boudingBox.UpperRightPoint.X - width * 0.5 + left, boudingBox.UpperLeftPoint.Y - height * 0.5 - top, PrintingUnit.Inch);
                break;

            case AdornmentLocation.CenterLeft:
                printerLayer.SetPosition(width, height, boudingBox.UpperLeftPoint.X + width * 0.5 + left, -top, PrintingUnit.Inch);
                break;

            case AdornmentLocation.Center:
                printerLayer.SetPosition(width, height, left, -top, PrintingUnit.Inch);
                break;

            case AdornmentLocation.CenterRight:
                printerLayer.SetPosition(width, height, boudingBox.UpperRightPoint.X - width * 0.5 + left, -top, PrintingUnit.Inch);
                break;

            case AdornmentLocation.LowerLeft:
                printerLayer.SetPosition(width, height, boudingBox.UpperLeftPoint.X + width * 0.5 + left, boudingBox.LowerLeftPoint.Y + height * 0.5 - top, PrintingUnit.Inch);
                break;

            case AdornmentLocation.LowerCenter:
                printerLayer.SetPosition(width, height, left, boudingBox.LowerLeftPoint.Y + height * 0.5 - top, PrintingUnit.Inch);
                break;

            case AdornmentLocation.LowerRight:
                printerLayer.SetPosition(width, height, boudingBox.UpperRightPoint.X - width * 0.5 + left, boudingBox.LowerLeftPoint.Y + height * 0.5 - top, PrintingUnit.Inch);
                break;
            }
        }
 protected override void DrawTileCore(GeoCanvas geoCanvas)
 {
     base.DrawTileCore(geoCanvas);
     if (gridLayer != null)
     {
         PagePrinterLayer pagePrinterLayer = PrinterLayers.OfType <PagePrinterLayer>().FirstOrDefault();
         if (pagePrinterLayer != null)
         {
             if (!gridLayer.IsOpen)
             {
                 gridLayer.Open();
             }
             gridLayer.SetPosition(pagePrinterLayer.GetPosition());
             gridLayer.Draw(geoCanvas, new Collection <SimpleCandidate>());
         }
     }
 }