ThinkGeo.com    |     Documentation    |     Premium Support

Adornment Layers on PdfGeoCanvas

Greetings,


I am working on puting the map on PDF based off the projects you have posted.  All is working well except for my adornment layers are not drawn where they should be.  For example, I have a compass drawn in the upper right corner of the map, which draws fine on the map control, however when it is drawn on the PDF, it is drawn off the right side of the map.  I have attached two images from a basic sample app I created showing this.


Map:



 


PDF:



 


I have also noticed that I have a scale line that is set to be placed in the bottom center, however in the PDF it is offset to the right a little bit.


Any help would be appreciated.


 


Thank you for your time,


Ryan



Ryan,


Thanks for your post.
 
If I add the ScaleLineAdormentLayer, it works fine, so I suspect that your own AdormentLayer to draw the compass is the root reason for this problem. If you want, could you send me a small sample application to show us your problem?

ScaleLineAdornmentLayer scaleLineAdornmentLayer = new ScaleLineAdornmentLayer();
scaleLineAdornmentLayer.Location = AdornmentLocation.CenterLeft;
winformsMap1.AdornmentOverlay.Layers.Add("ScaleLineAdornmentLayer", scaleLineAdornmentLayer);

 
Any more questions just feel free to let me know.
 
Thanks.
 
Yale

Yale, 
  
   I think there maybe an issue here Yale.  In the adornment layer we specify what the ‘size’ of the item is and that is in screen coordinates, and maybe in int.  In the PDF side of things we convert from the screne size to the PDF’s size which I think is in points.  There maybe some issue with the placements because of this conversion.  The bad news is I am not sure what we can do about it.  It might be that when going to PDF you may have to specify a position that take into account you are using a PDF. 
  
 David

Hi,


I've attached a very simple sample that sets the maps background to Red and draws a circle in the upper right corner.  You can click the button to generate and open the pdf to see that it is drawn off the map.


Thanks,


Ryan



1531-AdornmentSample.zip (14 KB)

Ryan & David,


Thanks for your sample and helps, I appreciate it very much. Sorry for the delay replying for some problem in the discussion forum in the past few days.


I did some research without any good luck; I found even thought I change the position of the circle from left as following, it seems still does not work:

protected override void DrawCore(GeoCanvas canvas, Collection<SimpleCandidate> labelsInAllLayers)
        {
            int compassX = 0;
            int compassY = 16 + (32 / 2);
 
            float widht = canvas.Width / 715 * 60;
 
            canvas.DrawEllipse(new Feature(ExtentHelper.ToWorldCoordinate(canvas.CurrentWorldExtent, new ScreenPointF(compassX, compassY), canvas.Width, canvas.Height)), widht, widht, new GeoPen(GeoColor.StandardColors.Black), new GeoSolidBrush(GeoColor.FromArgb(150, GeoColor.StandardColors.White)), DrawingLevel.LevelOne);
 
            //int compassX = (int)canvas.Width - (16 / 2) - 26;
            //int compassY = 16 + (32 / 2);
 
            //float widht = canvas.Width / 715 * 60;
 
            //canvas.DrawEllipse(new Feature(ExtentHelper.ToWorldCoordinate(canvas.CurrentWorldExtent, new ScreenPointF(compassX, compassY), canvas.Width, canvas.Height)), widht, widht, new GeoPen(GeoColor.StandardColors.Black), new GeoSolidBrush(GeoColor.FromArgb(150, GeoColor.StandardColors.White)), DrawingLevel.LevelOne);
        }


I will do more research on this to see if we can find a solution and let you know as soon as possible.



 
Any more questions just feel free to let me know.
 
Thanks.
 
Yale