WsfZone

WsfZone inherits WsfObject

Static Methods

All zones created with these static methods are not attached to a platform and do not exist in the global simulation context. They are strictly owned by whatever script created them.

static WsfZone CreateCircular(double minRadius, double maxRadius, double startAngle, double stopAngle)

Creates and returns a circular zone with the given min/max radius and start/stop angles.

static WsfZone CreateElliptical(double latAxis, double lonAxis, double startAngle, double stopAngle)

Creates and returns an elliptical zone with the given lat/lon axis and start/stop angles.

static WsfZone CreateSpherical(double minRadius, double maxRadius, double startAngle, double stopAngle)

Creates and returns a spherical zone with the given min/max radius and start/stop angles.

static WsfZone CreatePolygonal(Array<WsfGeoPoint> aGeoPointArray)

Creates and returns an independent polygonal zone with the given geodetic coordinates as points.

static WsfZone CreatePolygonal(WsfPlatform aPlatform, Array<Vec3> aPoints)

Creates and returns a relative polygonal zone with the given vector of relative coordinates as points. Uses the given platform to initially place the zone. When dealing with relative zones (e.g., calling “PointIsInside”) you must provide an eye point or a relative platform to use.

static WsfZone FindZone(string aZoneName)

Return the zone with the specified name.

Note

The return value will be invalid if the specified zone does not exist. Use IsValid() method on the return value to ensure it is valid before performing any operations on it.

General Methods

WsfGeoPoint Centroid()
WsfGeoPoint Location()
WsfGeoPoint Position()

Returns a WsfGeoPoint of the centroid or center of mass of the zone.

Note

These methods are only valid for polygonal zones; use Reference for other zone types (Circular, Elliptical, Spherical).

WsfGeoPoint MaxPoint()

Returns a WsfGeoPoint of the max point (upper-right corner) of the bounding box of a zone.

Note

This method is only valid for polygonal zones.

WsfGeoPoint MinPoint()

Returns a WsfGeoPoint of the min point (lower-left corner) of the bounding box of a zone.

Note

This method is only valid for polygonal zones.

double ModifierValue(string aModifierCategoryName)

Returns the modifier value of the zone given the modifier category name.

Note

The return value will be equal to -1 if the modifier was not found.

bool PointIsInside(WsfGeoPoint aViewPoint, WsfGeoPoint aEyePoint, double aLookHeading, double aDeltaDownRange)

Returns true if the given viewpoint is within the zone.

  • aEyePoint is used if the zone is a relative zone. If it is, the zone is placed relative to the given eye point and look heading.

  • aLookHeading is used if the zone is a relative zone.

bool PointIsInside(WsfPlatform aRelativePlatform, WsfGeoPoint aLocationPoint)

Returns true if the given location point is within the zone.

  • aRelativePlatform is used for a location and look heading if the zone is a relative zone. If it is, the zone is placed relative to the given platform.

bool PointIsInside(WsfGeoPoint aLocationPoint)

Returns true if the given location point is within the zone. Assumes the zone is a global zone with absolute geodetic coordinates. Returns false if it is a relative zone.

WsfGeoPoint Reference()

Returns a WsfGeoPoint of the reference point of the zone. The reference point is usually the first vertex in the array of vertices that define the zone.

double PenetrationDistance(WsfGeoPoint aFromPoint, WsfGeoPoint aToPoint)

Return the penetration distance in meters through the zone along the line defined by the given points.

Note

Penetration calculations are approximate. Implicit projections using latitude and longitude are employed in the implementation of this method, so that the farther the penetration distance is from one (latitude, longitude) point to another through a zone, the more inaccurate the result will be (this is not the case for altitude differences).

Note

Use of this method is only valid with absolute zones for which none of the minimum_radius, start_angle, and stop_angle inputs are specified, as well as the heading input for the polygonal zone type.

Array<WsfGeoPoint> PolyPoints()

Returns an array of location points that define the zone.

Note

The return value will be invalid if the zone is not a “polygonal” zone. Use IsValid() method on the return value to ensure it is valid before performing any operations on it.

void SetPolyPoints(Array<WsfGeoPoint> aLocationPoints)

Makes the zone a polygon zone and sets its points to the given location points. The zone is now considered independent and relative to nothing, its points are geodetic coordinates.

void SetCategory(string aCategory)

Applies a user supplied string value as the category of the zone.

string GetCategory()

Returns the string category value of the zone.

void SetPriority(int aPriority)

Applies a user supplied int value as the priority of the zone.

string GetPriority()

Returns the int priority value of the zone.

Color GetFillColor()

Returns the fill color of the zone.

Note

The returned Color object may be a null reference if the fill color has not been explicitly set using fill_color or SetFillColor. Use IsValid() to ensure it is valid.

Color GetLineColor()

Returns the line color of the zone.

Note

The returned Color object may be a null reference if the line color has not been explicitly set using line_color or SetLineColor. Use IsValid() to ensure it is valid.

void SetFillColor(Color aFillColor)

Sets the fill color of the zone to aFillColor.

void SetLineColor(Color aLineColor)

Sets the line color of the zone to aLineColor.

Draw Methods

Note

The following methods are only implemented for polygonal zones. Other zone types (e.g. circular) are not currently supported.

void Draw(WsfDraw aDraw)

Draws an outline of a polygonal zone, using the aDraw object.

void DebugDrawZone()

Draws an outline of a polygonal zone, using WsfDraw with a 5 second duration.

void Draw(WsfDraw aDraw, WsfGeoPoint aEyePoint, double aLookHeading)

Draws an outline of a relative zone using the aDraw object.

void DebugDrawZone(WsfGeoPoint aEyePoint, double aLookHeading)

Draws an outline of a relative zone using WsfDraw with a 5 second duration.

void DrawCentroid(WsfDraw aDraw)

Draws an ‘X’ at the centroid location of the zone using the aDraw object.

void DebugDrawCentroid()

Draws an ‘X’ at the centroid location of the zone using WsfDraw with a 5 second duration.

void DrawBounds(WsfDraw aDraw)

Draws an outline of the bounding box of the zone (min and max points) using the aDraw object.

void DebugDrawBounds()

Draws an outline of the bounding box of the zone (min and max points) using WsfDraw with a 5 second duration.

Auxiliary Data Methods

Auxiliary Data is a collection of optional named user data attributes that can be stored with the object. The framework will maintain the attributes but in no other way attempts to use the data contained within. The definition and use of any attribute is defined purely by the user.

bool AuxDataBool(string aName)
int AuxDataInt(string aName)
double AuxDataDouble(string aName)
string AuxDataString(string aName)
Object AuxDataObject(string aName)

Retrieve the value of the auxiliary data attribute with the indicated name. If the attribute does not exist then a default value will be returned (false for bool, 0 for int and 0.0 for double).

bool AuxDataExists(string aName)
bool CheckAuxData(string aName)

Returns true if an auxiliary data member exists with the specified name.

bool HasAuxData()

Returns true if the object has auxiliary data.

bool DeleteAuxData(string aName)

Delete the auxiliary data attribute with the indicated name. Returns true if the attribute exists and was deleted, or false if the attribute did not exist.

void SetAuxData(string aName, bool aValue)
void SetAuxData(string aName, int aValue)
void SetAuxData(string aName, double aValue)
void SetAuxData(string aName, string aValue)
void SetAuxData(string aName, Object aValue)

Set the value of the auxiliary data attribute with the indicated name. The last form of SetAuxData() can store any script object type.

Map<string, string> GetAllAuxDataTypes()

Return the names and types of all auxiliary data attributes in the form of a Map<string,string>. Map keys are valid names of auxiliary data attributes. Map values are type names corresponding to valid auxiliary data attribute names.