English

FAQ: Why does the MOLE IGraphicDef.MinPointCount property return zero or not match the minimum points required by the military specification?

Question

Why does the MOLE IGraphicDef.MinPointCount property return zero or not match the minimum points required by the military specification?

Answer

The MOLE API communicates the required geometry type and minimum and maximum number of geometry points for a tactical graphic symbol ID/function code using the IGraphicDef and IGeometryLimits interfaces. These interfaces contain the following properties to perform this function:

Property - Helpstring:
IGraphicDef.ConstructionNotes - A human readable string/notes that describes how to build the core geometry for the graphic.
IGeometryLimits.GeometryType - The type of geometry (equivalent to esriGeometryType). MOLE supports the following types: 1 – Point, 3 – Line, 4 – Polygon.
IGeometryLimits.MinPointCount - The minimum number of points required. Default is 0 (use normal geometry limits).
IGeometryLimits.MaxPointCount - The maximum number of points required. Default is 0 (use normal geometry limits).

Some confusion can arise when MinPointCount returns zero. When this value is returned, use the default value for the feature type as explained below:

· The default value for the 'point feature type' is 1.
· The default value for the 'for line feature type' is 2.
· The default value for the 'for polygon feature type' is 4 (see note below).

Note:
For polygons, the default value of 4 may cause confusion because MOLE expects all polygons to be closed polygons (for example, that IPolygonClose() is called on the geometry). This implies that all of these closed polygons have a minimum of 4 points, where the endpoint is at the start point.

For example, for a support by fire position graphic, G*GPOAS*******X, the standard specifies four anchor points, but MOLE requires five points; the fifth point closes the polygon and is positioned on the start point.


Code:
The following example (as pseudo code) shows how one might implement this substitution (for zero):

IGeometryLimits geoLimits = graphicDef as IGeometryLimits;
int minNumberOfPoints = geoLimits.MinPointCount;
int maxNumberOfPoints = geoLimits.MaxPointCount;
int nGeoType = geoLimits.GeometryType;

if (nGeoType == 1) // Point
{
// min/maxNumberOfPoints do not need to be checked for points
minNumberOfPoints = 1;
maxNumberOfPoints = 1;
}
else if (nGeoType == 3) // Line
{
if (minNumberOfPoints == 0)
minNumberOfPoints = 2;

if (maxNumberOfPoints == 0)
maxNumberOfPoints = INFINITY_TAG; // Tag for no bound
}
else if (nGeoType == 4) // Polygon/Area
{
if (minNumberOfPoints == 0)
minNumberOfPoints = 4; // Minimum of 4 points in a *closed* polygon

if (maxNumberOfPoints == 0)
maxNumberOfPoints = INFINITY_TAG; // Tag for no bound
}