Including your featuregeometry in a map – Pitney Bowes MapXtreme User Manual

Page 303

Advertising
background image

Chapter 16: Spatial Objects and Coordinate Systems

Including Your FeatureGeometry in a Map

MapXtreme v7.1

310

Developer Guide

dPoints[1] = new DPoint(-109.169283,49.241794);
...
dPoints[101] = new DPoint(-109.171279,49.214879);
Ring newRing = new Ring(longLatNad83, CurveSegmentType.Linear, dPoints);

Polygon

A Polygon is an object made up of Rings. A polygon must have at least a single Ring which defines
the exterior boundary of the Polygon. Other Rings can be included inside which then define holes in
the Polygon. Once a Ring is placed inside of another Ring the object becomes a MultiPolygon.

Use the following example code to model the creation of a Polygon.

using MapInfo.Geometry;

DPoint[][] points = new DPoint[1][];
points[0] = polyPointArrays[0];
Polygon polygon = new Polygon

(longLatNad83, CurveSegmentType.Linear, polyPointArrays[0]);

Including Your FeatureGeometry in a Map

Once a geometry is created you then need to add it to a map, allowing you to display it, select it,
label it, or perform any other map-related operations on it.

Public Shared Sub MapInfo_Mapping_HowDoICreateFeatureAddToMap(ByVal
mapControl1 As MapControl, ByVal connection As MIConnection, ByVal x As _

Double, ByVal y As Double)

Dim map As Map = mapControl1.Map

’uses wldcty25 as a template
Dim table As Table = _

MapInfo.Engine.Session.Current.Catalog.GetTable("wldcty25")

’ create a temp table and add a featurelayer for it
Dim coordSys As CoordSys = map.GetDisplayCoordSys()
Dim tableInfo As TableInfoMemTable = New TableInfoMemTable("temp")
tableInfo.Temporary = True

’ add Geometry column
Dim column As Column

’ specify coordsys for object column
column = New GeometryColumn(coordSys)
column.Alias = "MI_Geometry"
column.DataType = MIDbType.FeatureGeometry
tableInfo.Columns.Add(column)

’ add style column
column = New Column
column.Alias = "MI_Style"

Advertising