IMcLinesGetFeaturePoints Method
|
|
Get a list of coordinate points that describe a feature.
Namespace:
MediaCy.IQL.Features
Assembly:
MediaCy.IQL.Features (in MediaCy.IQL.Features.dll) Version: 10.0.6912.0
SyntaxFunction GetFeaturePoints (
FeatureIndex As Integer,
<OptionalAttribute> <OutAttribute> ByRef PointsResults As Object
) As Integer
Parameters
- FeatureIndex
- Type: SystemInt32
The index of the feature. If this is a negative number, then
for McPoints only, the coordinates of all points are returned. Otherwise
this must be a feature index value between 0 and Count minus 1. - PointsResults (Optional)
- Type: SystemObject
If NULL or missing (VT_ERROR or VT_NULL), then only the count is
returned. If pointing to an empty variant (VT_EMPTY), then this variant is
filled with an array of SINGLEPOINT records containing X,Y pairs of points.
Otherwise PointsResults must point to a variant containing a safearray or
record(s) of the proper type and size. Allowed types are LONGPOINT, LONGRECT
or long, SINGLEPOINT, SINGLERECT or float (AKA Single in VB), and
DOUBLEPOINT, DOULBERECT or double. A non-emtpy variant of the right size and
type will be filled with x,y pixel coordinate values (one XXXPOINT per point
or two long/float/double per point)
Return Value
Type:
Int32The number of points needed in PointsResults or the number
of points filled into that variant. If pvPoint
contains a safearray of long/float/double, then pNumPoints will be equal to
half the size of that safearray since there are two values per point.
Implements
IMcFeaturesGetFeaturePoints(Int32, Object)
RemarksFor most types of features, the coordinates returned by GetFeaturePoints
will be a standard description of the feature that will allow its duplication
when passed to the SetFeaturePoints method (see Notes for exceptions).
For McPoints, each feature is a single point X,Y pixel coordinate. For McLines,
each feature is described by a polyline of two or more X,Y pixel coordinates.
For McRegions, each feature is a polyline of three or more X,Y pixel coordinates,
describing a path along the boundary pixels of a connected region.
Coordinates are returned into an array of values, POINT or RECT structs supplied
by the caller (see Example). The type of the returned result depends on the
type of array that the caller supplies. If the caller supplies a
Missing or Null pvPoints result variant (VT_ERROR or VT_NULL), then just the number of points
required to hold the returned array will be returned.
If the caller supplies an Empty pvPoints result variant (VT_EMPTY), then that
variant is filled with an array of SINGLEPOINT X,Y results (VT_RECORD variant type).
For McPoints, it is possible to return all feature points as an array. This
cannot be done for McLines or McRegions, where the coordinates of only one feature
at a time may be retrieved. The default SINGLEPOINT results for Empty
pvPoints, is always an array, even if only a single point is requested. As
illustrated in the examples, you can supply a scalar SINGLEPOINT, if you wish.
Only one basic description of feature coordinates is generated by this function.
Use GetFeaturePointsEx for a number of other types of feature coordinate
information.
Although this property is really intended for McRegions of Type
mcftOutline, it will return a proper list of points in most cases.
mcftOutline: The points defining the outline
mcftBox: 4 points (one point for each corner of the box)
mcftEllipse: The points defining the outline of the ellipse/circle
mcftScanList: The outline of the indexed region will be generated
and its points returned.
However, only in the mcftOutline case will the same Type of feature be
recreated by a call to SetFeaturePoints
Examples
Dim MyRegions As McRegions
Set MyRegions = Engine.ActiveImage.RegionFeatures
Dim lNumPoints As long
lNumPoints = MyRegions.GetFeaturePoints(0)
ReDim ptsFeature(lNumPoints) As SINGLEPOINT
MyRegions.GetFeaturePoints(0, ptsFeature)
Dim MyRegions As McRegions
Set MyRegions = Engine.ActiveImage.RegionFeatures
Dim lNumPoints As long
Dim varPoints As Variant
varPoints = Empty
lNumPoints = MyRegions.GetFeaturePoints(0, varPoints)
Dim MyPoints As McPoints
Set MyPoints = Engine.ActiveImage.PointFeatures
Dim onePoint As SINGLEPOINT
lNumPoints = MyPoints.GetFeaturePoints(0, onePoint)
See Also