Hi,
In thinkgeo mapsuite desktop edition there are seven pointsymboltype available. I want to add my own in it. For example there is triangle available in it. I want right angled triangle to add.
Request you to guide.
Thanks & Regards,
Goral
Add new PointSymbolType
Hi Goral,
You should want to create a new class which inherit from, then override DrowCore function and draw any style you want.
As below is a simple sample for how to implement it, wish helpful.
public class RightAngledTrianglePointStyle : PointStyle
{
protected override void DrawCore(System.Collections.Generic.IEnumerable<Feature> features, GeoCanvas canvas, System.Collections.ObjectModel.Collection<SimpleCandidate> labelsInThisLayer, System.Collections.ObjectModel.Collection<SimpleCandidate> labelsInAllLayers)
{
foreach (Feature feature in features)
{
ScreenPointF screenCenterPoint = ExtentHelper.ToScreenCoordinate(canvas.CurrentWorldExtent, feature, canvas.Width, canvas.Height);
// Put your algorithm here to calculate the vertexes screen coordinates of right angled triangle
// Then convert them back to world coordinates
PointShape v1;
PointShape v2;
PointShape v3;
GeoPen geoPen; // Custom your geo pen
GeoBrush geoBrush; // Custom your geo bursh
RingShape border = new RingShape();
border.Vertices.Add(new Vertex(v1));
border.Vertices.Add(new Vertex(v2));
border.Vertices.Add(new Vertex(v3));
canvas.DrawArea(new Feature(new PolygonShape(border)), geoPen, geoBrush, DrawingLevel, XOffsetInPixel, YOffsetInPixel, PenBrushDrawingOrder.BrushFirst);
}
}
}
Regards,
Don
Hi,
Thanks for reply. It works fine. I just want to know about it in detail. I was doing this thing but missed part is I am not converting first to screencoordinates and again to world coordinates to draw feature. Because of that after drawing its behaving like simple feature so with zoomedin it becoming big. Can you please explain me the fundamental behind that conversion.
Thanks
Goral
Hi Goral,
The conversion is for keep the icon looks the same when you zoom in or out.
If you don’t have this requirement, please just use world coordinates.
Regards,
Don
Hi,
Thanks for reply. Ya exactly that I want. Like whatever I drawn it should remain same size when apply zoom. This is the basic fundamental I am missing.
Thanks & Regards,
Goral
Hi Goral,
I just afraid you need this and don’t know related APIs, so you can remove that if you don’t need that in your project.
Any question please let us know.
Regards,
Don
Hi,
Thanks for reply. I got the point.
Thanks,
Goral
Hi,
Any question please let us know.
Regards,
Don