Hi there,
We are using the MapSuite for iOS using xamarin.forms. Due to our need we had to create to custom adornment layers using the available samples for thinkgeo map suite for wpf.
We created one custom unit scalebar and a north arrow display adornment layer. Then we add them to the MapViewAdornment layer using the following api. For the first time when it draws they are drawn fine, but if I zoom-in or refresh then the new scale bar or the north arrow is drawn on top of the last scale or north arrow. We tried to refresh the adornment layer when the current context changes, but did not work either.
screen shot of the draw/redraw/ refresh issue
For convenience I includes the draw core method of our compass adornment layer
protected override void DrawCore(GeoCanvas canvas, Collection<SimpleCandidate> labelsInAllLayers)
{
// Draws the scaled images of needle and frame images according to the percentage size. For example with a PercentageSize of 80,
// the compass size will be 80% of the size of needle image.
//Sets the position of the compass.
int margin = 10;
int Xloc = 0;
int Yloc = 0;
int imageWidth = (sizePercentage * needleImage.GetWidth()) / 100;
int imageHeight = (sizePercentage * needleImage.GetHeight()) / 100;
switch (Position)
{
case AdornmentPosition.UpperLeft:
Xloc = (imageWidth / 2) + margin;
Yloc = (imageHeight / 2) + margin;
break;
case AdornmentPosition.UpperRight:
Xloc = ((int)canvas.Width - (imageWidth / 2)) - margin;
Yloc = (imageHeight / 2) + margin;
break;
case AdornmentPosition.LowerLeft:
Xloc = (imageWidth / 2) + margin;
Yloc = ((int)canvas.Height - (imageHeight / 2)) - margin;
break;
case AdornmentPosition.LowerRight:
Xloc = ((int)canvas.Width - (imageWidth / 2)) - margin;
Yloc = ((int)canvas.Height - (imageHeight / 2)) - margin;
break;
case AdornmentPosition.LowerCenter:
Xloc = ((int)canvas.Width / 2 - (imageWidth / 2)) - margin;
Yloc = ((int)canvas.Height - (imageHeight / 2)) - margin;
break;
//case AdornmentPosition.Center:
// Xpos = ((int)canvas.Width / 2) - margin;
// Ypos = ((int)canvas.Height / 2) - margin;
// break;
case AdornmentPosition.UpperCenter:
Xloc = ((int)canvas.Width / 2 + (imageWidth / 2)) + margin;
Yloc = margin + (imageHeight / 2);
break;
}
// canvas.Clear(new GeoSolidBrush(GeoColor.SimpleColors.Transparent));
//Draws the needle image at the size according to the percentage size and rotate the image according to RotateAngle property.
canvas.DrawScreenImage(needleImage, Xloc, Yloc, imageWidth, imageHeight, DrawingLevel.LevelFour, 0, 0, rotateAngle);
//If the frame image has been set, draws image at the size according to the percentage size with no rotation.
if (frameImage != null)
{
canvas.DrawScreenImage(frameImage, Xloc, Yloc, imageWidth, imageHeight, DrawingLevel.LevelFour, 0, 0, 0);
}
}