Thank you Carlos. You are right, you have to make a small change in the DrawCore function to have that behavior. Look at the code below. I just added two condition statements for the parallels and the meridians:
protected override void DrawCore(GeoCanvas canvas, Collection<SimpleCandidate> labelsInAllLayers)
{
RectangleShape currentExtent = canvas.CurrentWorldExtent;
double currentMinX = currentExtent.UpperLeftPoint.X;
double currentMaxX = currentExtent.UpperRightPoint.X;
double currentMaxY = currentExtent.UpperLeftPoint.Y;
double currentMinY = currentExtent.LowerLeftPoint.Y;
//Gets the increment according to the current extent of the map and the graticule density set
//by the GrsaticuleDensity property
double increment;
increment = GetIncrement(currentExtent.Width, graticuleDensity);
//Collections of GraticuleLabel for labeling the different lines.
Collection<GraticuleLabel> meridianGraticuleLabels = new Collection<GraticuleLabel>();
Collection<GraticuleLabel> parallelGraticuleLabels = new Collection<GraticuleLabel>();
//Loop for displaying the meridians (lines of common longitude).
double x = 0;
for (x = CeilingNumber(currentExtent.UpperLeftPoint.X, increment); x <= currentExtent.UpperRightPoint.X; x += increment)
{
if ((x <= 180) && (x >= -180))
{
LineShape lineShapeMeridian = new LineShape();
lineShapeMeridian.Vertices.Add(new Vertex(x, currentMaxY));
lineShapeMeridian.Vertices.Add(new Vertex(x, currentMinY));
canvas.DrawLine(lineShapeMeridian, new GeoPen(graticuleColor, 0.5F), DrawingLevel.LevelFour);
//Gets the label and screen position of each meridian.
ScreenPointF meridianLabelPosition = ExtentHelper.ToScreenCoordinate(canvas.CurrentWorldExtent, x, currentMaxY, canvas.Width, canvas.Height);
meridianGraticuleLabels.Add(new GraticuleLabel(FormatLatLong(x, LineType.Meridian, increment), meridianLabelPosition));
}
}
//Loop for displaying the parallels (lines of common latitude).
double y = 0;
for (y = CeilingNumber(currentExtent.LowerLeftPoint.Y, increment); y <= currentExtent.UpperRightPoint.Y; y += increment)
{
if ((y <= 90) && (y >= -90))
{
LineShape lineShapeParallel = new LineShape();
lineShapeParallel.Vertices.Add(new Vertex(currentMaxX, y));
lineShapeParallel.Vertices.Add(new Vertex(currentMinX, y));
canvas.DrawLine(lineShapeParallel, new GeoPen(graticuleColor, 0.5F), DrawingLevel.LevelFour);
//Gets the label and screen position of each parallel.
ScreenPointF parallelLabelPosition = ExtentHelper.ToScreenCoordinate(canvas.CurrentWorldExtent, currentMinX, y, canvas.Width, canvas.Height);
parallelGraticuleLabels.Add(new GraticuleLabel(FormatLatLong(y, LineType.Parallel, increment), parallelLabelPosition));
}
}
//Loop for displaying the label for the meridians.
foreach (GraticuleLabel meridianGraticuleLabel in meridianGraticuleLabels)
{
Collection<ScreenPointF> locations = new Collection<ScreenPointF>();
locations.Add(new ScreenPointF(meridianGraticuleLabel.location.X, meridianGraticuleLabel.location.Y + 6));
canvas.DrawText(meridianGraticuleLabel.label, new GeoFont("Arial", 10), new GeoSolidBrush(GeoColor.StandardColors.Navy),
new GeoPen(GeoColor.StandardColors.White, 2), locations, DrawingLevel.LevelFour, 8, 0, 0);
}
//Loop for displaying the label for the parallels.
foreach (GraticuleLabel parallelGraticuleLabel in parallelGraticuleLabels)
{
Collection< ScreenPointF> locations = new Collection<ScreenPointF>();
locations.Add(new ScreenPointF(parallelGraticuleLabel.location.X,parallelGraticuleLabel.location.Y));
canvas.DrawText(parallelGraticuleLabel.label, new GeoFont("Arial", 10), new GeoSolidBrush(GeoColor.StandardColors.Navy),
new GeoPen(GeoColor.StandardColors.White,2), locations, DrawingLevel.LevelFour, 8, 0, 90);
}
}