Private void Button1_Click (Object Sender, System.Eventargs E)
{
// Draw points in one of the X and Y coordinates of the current map center
Map Map1 = MapControl1.map;
Double X = Map1.center.x / 2;
Double y = map1.center.y / 2;
ShowPointOnSearchtableMap (X, Y);
}
Private void showpointonsearchTableMap (double x, double y)
{
Map Map = MapControl1.map;
MapInfo.data.Table Table = mapinfo.Engine.Session.current.catalog.getTable ("Temp");
Coordsys coordsys = map.getdisplayCoordsys ();
IF (Table == Null)
{
TableInfomemTable TableInfo = New TableInFomemTable ("Temp");
TableInfo.temporary = true;
Column column;
Column = New GeometryColumn (CoRDSys);
Column.Alias = "mi_geometry";
Column.DataType = midbtype.featureGeometry;
TableInfo.columns.add (column);
COLUMN = New column ();
Column.Alias = "mi_style";
Column.DataType = midbtype.style;
TableInfo.columns.add (column);
Table = mapinfo.Engine.session.current.catalog.createtable; TableInfo
}
Else
{
Micronection conn = new micronection ();
MicMmand Tempcmd = conn.createCommand ();
Tempcmd.commandtext = "delete from temp";
Cn.open ();
Tempcmd.executenonquery ();
CONN.CLOSE ();
Tempcmd.dispose ();
}
// Creative point and its style
FeatureGeometry geometry = new mapinfo.geetry.point (CoRDSys, X, Y);
SimplectorPointStyle VStyle = New SimplectorPointStyle (40, System.drawing.color.green, 14);
// The style, color, and size of the point created are modified in the upper statement.
Compositestyle CStyle = new mapinfo.styles.compositestyle (vStyle);
MicroNection Connection = New MicroNection ();
MICOMMAND CMD = Connection.createCommand ();
cmd.Parameters.Add ("Geometry", Midbtype.FeatureGeometry;
Cmd.Parameters.Add ("style", midbtype.style;
CMD.comMandtext = "INSERT INTO TEMP (MI_GEMETRY, MI_STYLE) VALUES (Geometry, Style); connection.open ();
Cmd.Parameters [0] .value = geometry;
CMD.Parameters [1] .value = cStyle;
INT nchanged = cmd.executenonquery ();
cmd.dispose ();
// Create a layer and insert it to the top layer of the current map
Featurelayer fl = new featurelayer (TABLE);
Map.layers.insert (0, fl);
Map.center = new mapinfo.geetry.dpoint (x, y);
}