GXPLY class¶
-
class
GXPLY
(handle=0)¶ GXPLY class.
The
GXPLY
object contains the definitions for one or more polygons, and does import and export of polygon files.-
add_polygon
(vv_x, vv_y)¶ Add a polygon to the polygon file.
Parameters: New in version 5.0.
License: Geosoft Open License
-
add_polygon_ex
(vv_x, vv_y, exclude)¶ Add a polygon to the polygon file.
Parameters: New in version 5.0.
License: Geosoft Open License
-
area
()¶ Compute the Area of a polygon
Returns: Area of a polygon Return type: float New in version 5.1.3.
License: Geosoft Open License
Note: Excluded polygons have negative area.
-
change_ipj
(ipj)¶ Set the projection.
Parameters: ipj (GXIPJ) – GXIPJ
to place in theGXPLY
New in version 5.0.5.
License: Geosoft Open License
Note: The
GXPLY
is re-projected to the new projection.
-
clear
()¶ Clear/remove all polygons from the
GXPLY
.New in version 5.1.8.
License: Geosoft Open License
-
clip_area
(min_x, min_y, max_x, max_y)¶ Clip a polygon to an area
Parameters: - min_x (float) – Min X
- min_y (float) – Min Y
- max_x (float) – Max X
- max_y (float) – Max y
Returns: Return type: int
New in version 5.1.3.
License: Geosoft Open License
-
clip_line_int
(min_x, min_y, max_x, max_y, vv, inc, first)¶ Clips a line in or out of the polygons for intersections (
GS_DOUBLE
). Intersections are returned as fiducials down the line stored inGXVV
starting at the first point of the line. Examples: No intersection:PLY_LINE_CLIP_OUTSIDE
, 0 intersections Starts outside, ends inside:PLY_LINE_CLIP_OUTSIDE
, 1 intersection Starts outside, intersects then ends inside or outside:PLY_LINE_CLIP_OUTSIDE
, 2 intersections Starts inside, ends inside :PLY_LINE_CLIP_INSIDE
, 1 intersection (gives end-of-line) Starts inside, ends outside :PLY_LINE_CLIP_INSIDE
, 1 intersectionParameters: - min_x (float) – Min X of line to clip
- min_y (float) – Min Y of line to clip
- max_x (float) – Max X of line to clip
- max_y (float) – Max y of line to clip
- vv (GXVV) – DOUBLE
GXVV
holding intersection fids - inc (float) – Data element increment (precision)
- first (int_ref) – First point value (PLY_LINE_CLIP constants value)
Returns: 0, Terminates on error (you can ignore this value)
Return type: int
New in version 6.3.
License: Geosoft Open License
-
clip_ply
(ppl_yb, ppl_yc)¶ Clip one polygon against another
Parameters: Returns: Return type: int
New in version 5.1.3.
License: Geosoft Open License
Note: Resulting clipped polygon only has inclusive regions of the clipped area. Exclusion polygons are treated as included areas.
-
copy
(srce)¶ Destroys a
GXPLY
ObjectParameters: srce (GXPLY) – Source New in version 5.0.
License: Geosoft Open License
-
classmethod
create
()¶ Creates a Polygon Object.
Returns: GXPLY
HandleReturn type: GXPLY New in version 5.0.
License: Geosoft Open License
-
classmethod
create_s
(bf)¶ Create an
GXPLY
Object from aGXBF
Parameters: bf (GXBF) – GXBF
to serialize fromReturns: GXPLY
HandleReturn type: GXPLY New in version 5.1.
License: Geosoft Open License
-
extent
(min_x, min_y, max_x, max_y)¶ Get the extent of the current polygon.
Parameters: New in version 5.0.
License: Geosoft Open License
Note: If there are no polygons in the
GXPLY
object, returns dummies.
-
get_description
(desc)¶ Get the
GXPLY
description stringParameters: desc (str_ref) – Polygon description New in version 5.1.
License: Geosoft Open License
-
get_ipj
(ipj)¶ Get the projection.
Parameters: ipj (GXIPJ) – GXIPJ
in which to place theGXPLY
projectionNew in version 5.0.5.
License: Geosoft Open License
-
get_polygon
(vv_x, vv_y, poly)¶ Get a polygon from the
GXPLY
Parameters: New in version 5.0.
License: Geosoft Open License
-
get_polygon_ex
(vv_x, vv_y, poly, exclude)¶ Get a polygon from the
GXPLY
Parameters: New in version 5.0.
License: Geosoft Open License
-
is_null
()¶ Check if this is a null (undefined) instance
Returns: True if this is a null (undefined) instance, False otherwise. Return type: bool
-
load_table
(table)¶ Loads Polygons from a Polygon file.
Parameters: table (str) – Name of the polygon file File contains coordinates of one or more polygons New in version 5.0.
License: Geosoft Open License
-
num_poly
()¶ Get the number of polygons.
Returns: Number of polygons in the GXPLY
.Return type: int New in version 5.0.
License: Geosoft Open License
-
rectangle
(min_x, min_y, max_x, max_y)¶ Creates a polygon from a rectangular area.
Parameters: - min_x (float) – Min X
- min_y (float) – Min Y
- max_x (float) – Max X
- max_y (float) – Max Y
New in version 5.0.5.
License: Geosoft Open License
-
rotate
(x, y, rot)¶ Rotate a polygon about a point.
Parameters: - x (float) – Rotation point, X
- y (float) – Rotation point, Y
- rot (float) – Rotation angle, CCW in degrees
New in version 5.0.
License: Geosoft Open License
-
save_table
(table)¶ Save Polygons to a Polygon file.
Parameters: table (str) – Name of the polygon file New in version 5.0.
License: Geosoft Open License
-
serial
(bf)¶ -
Parameters: bf (GXBF) – GXBF
to serialize toNew in version 5.1.
License: Geosoft Open License
-
set_description
(desc)¶ Set the
GXPLY
description stringParameters: desc (str) – Polygon description New in version 5.1.
License: Geosoft Open License
-
set_ipj
(ipj)¶ Set the projection.
Parameters: ipj (GXIPJ) – GXIPJ
to place in theGXPLY
New in version 5.0.5.
License: Geosoft Open License
Note: This changes the projection information only.
-
thin
(thin)¶ Thin polygons to a desired resolution
Parameters: thin (float) – Thining resolution New in version 5.1.3.
License: Geosoft Open License
Note: Points on the polygon that deviate from a line drawn between neighboring points by more than the thining resolution will be removed.
-
PLY_CLIP constants¶
Polygon clipping mode
-
PLY_CLIP_NO_INTERSECT
¶ The polygons do not intersect
-
gxapi.
PLY_CLIP_NO_INTERSECT
= 0
-
-
PLY_CLIP_INTERSECT
¶ The polygons do intersect
-
gxapi.
PLY_CLIP_INTERSECT
= 1
-
-
PLY_CLIP_A_IN_B
¶ Polygon A is completly inside polygon B
-
gxapi.
PLY_CLIP_A_IN_B
= 2
-
-
PLY_CLIP_B_IN_A
¶ Polygon B is completly inside polygon A
-
gxapi.
PLY_CLIP_B_IN_A
= 3
-
PLY_LINE_CLIP constants¶
Polygon line clip indicator
-
PLY_LINE_CLIP_INSIDE
¶ The start point of the line is inside
-
gxapi.
PLY_LINE_CLIP_INSIDE
= 0
-
-
PLY_LINE_CLIP_NO_INTERSECT
¶ This name is a misnomer - it should have been
PLY_LINE_CLIP_INSIDE
, but is retained to support legacy code-
gxapi.
PLY_LINE_CLIP_NO_INTERSECT
= 0
-
-
PLY_LINE_CLIP_OUTSIDE
¶ The start point of the line is outside
-
gxapi.
PLY_LINE_CLIP_OUTSIDE
= 1
-
-
PLY_LINE_CLIP_ERROR
¶ Error
-
gxapi.
PLY_LINE_CLIP_ERROR
= 2
-