I create polygons with mouse click events as follows:
private void PrintMousePos(int x, int y, MouseEventArgs e)
{
PointF[] location = { new PointF(x, y) };
inverseTransform.TransformPoints(location);
if (NewPolygon != null)
{
// We are already drawing a polygon.
// If it's the right mouse button, finish this polygon.
if (e.Button == MouseButtons.Right)
{
// Finish this polygon.
if (NewPolygon.Count > 2) Polygons.Add(NewPolygon);
NewPolygon = null;
}
else
{
// Add a point to this polygon.
if (NewPolygon[NewPolygon.Count - 1] != Location)
{
NewPolygon.Add(location[0]);
}
}
}
else
{
// Start a new polygon.
NewPolygon = new List<PointF>();
NewPoint = Location;
NewPolygon.Add(location[0]);
}
// Redraw.
picCanvas.Invalidate();
}
(picCanvas is a picturebox within a Panel. I don't use any maps, just an image)
I need to save this polygons to MySQL database. I'm using MySQL workbench 8 to create the table.
How do I save the every polygon to a table and what datatype is the best to use for this?
How do I retrieve the polygon points again to and populate a table?
Please give me an example of the sql text to save and to retrieve the data?
>( yourPointsList);`
– TaW Nov 10 '18 at 15:25