/Source/Common/SWIG/Classes/BWTA/Polygon.cs

http://bwapi-mono-bridge.googlecode.com/ · C# · 139 lines · 101 code · 29 blank · 9 comment · 19 complexity · e248a3baab84f64200aea382c5e8433b MD5 · raw file

  1. /* ----------------------------------------------------------------------------
  2. * This file was automatically generated by SWIG (http://www.swig.org).
  3. * Version 2.0.1
  4. *
  5. * Do not make changes to this file unless you know what you are doing--modify
  6. * the SWIG interface file instead.
  7. * ----------------------------------------------------------------------------- */
  8. namespace SWIG.BWTA {
  9. // defaults
  10. using System;
  11. using System.Runtime.InteropServices;
  12. // BWAPI
  13. using BWAPI;
  14. public partial class Polygon : PositionVector {
  15. private HandleRef swigCPtr;
  16. internal Polygon(IntPtr cPtr, bool cMemoryOwn) : base(bwtaPINVOKE.Polygon_SWIGUpcast(cPtr), cMemoryOwn) {
  17. swigCPtr = new HandleRef(this, cPtr);
  18. }
  19. internal static HandleRef getCPtr(Polygon obj) {
  20. return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  21. }
  22. ~Polygon() {
  23. Dispose();
  24. }
  25. public override void Dispose() {
  26. lock(this) {
  27. if (swigCPtr.Handle != IntPtr.Zero) {
  28. if (swigCMemOwn) {
  29. swigCMemOwn = false;
  30. bwtaPINVOKE.delete_Polygon(swigCPtr);
  31. }
  32. swigCPtr = new HandleRef(null, IntPtr.Zero);
  33. }
  34. GC.SuppressFinalize(this);
  35. base.Dispose();
  36. }
  37. }
  38. public override int GetHashCode()
  39. {
  40. return this.swigCPtr.Handle.GetHashCode();
  41. }
  42. public override bool Equals(object obj)
  43. {
  44. bool equal = false;
  45. if (obj is Polygon)
  46. equal = (((Polygon)obj).swigCPtr.Handle == this.swigCPtr.Handle);
  47. return equal;
  48. }
  49. public bool Equals(Polygon obj)
  50. {
  51. if (obj == null) return false;
  52. return (obj.swigCPtr.Handle == this.swigCPtr.Handle);
  53. }
  54. public static bool operator ==(Polygon obj1, Polygon obj2)
  55. {
  56. if (object.ReferenceEquals(obj1, obj2)) return true;
  57. if (object.ReferenceEquals(obj1, null)) return false;
  58. if (object.ReferenceEquals(obj2, null)) return false;
  59. return obj1.Equals(obj2);
  60. }
  61. public static bool operator !=(Polygon obj1, Polygon obj2)
  62. {
  63. if (object.ReferenceEquals(obj1, obj2)) return false;
  64. if (object.ReferenceEquals(obj1, null)) return true;
  65. if (object.ReferenceEquals(obj2, null)) return true;
  66. return !obj1.Equals(obj2);
  67. }
  68. public Polygon() : this(bwtaPINVOKE.new_Polygon__SWIG_0(), true) {
  69. }
  70. public Polygon(Polygon b) : this(bwtaPINVOKE.new_Polygon__SWIG_1(Polygon.getCPtr(b)), true) {
  71. if (bwtaPINVOKE.SWIGPendingException.Pending) throw bwtaPINVOKE.SWIGPendingException.Retrieve();
  72. }
  73. public double getArea() {
  74. double ret = bwtaPINVOKE.Polygon_getArea(swigCPtr);
  75. return ret;
  76. }
  77. public double getPerimeter() {
  78. double ret = bwtaPINVOKE.Polygon_getPerimeter(swigCPtr);
  79. return ret;
  80. }
  81. public Position getCenter() {
  82. Position ret = new Position(bwtaPINVOKE.Polygon_getCenter(swigCPtr), true);
  83. return ret;
  84. }
  85. public bool isInside(Position p) {
  86. bool ret = bwtaPINVOKE.Polygon_isInside(swigCPtr, Position.getCPtr(p));
  87. if (bwtaPINVOKE.SWIGPendingException.Pending) throw bwtaPINVOKE.SWIGPendingException.Retrieve();
  88. return ret;
  89. }
  90. public Position getNearestPoint(Position p) {
  91. Position ret = new Position(bwtaPINVOKE.Polygon_getNearestPoint(swigCPtr, Position.getCPtr(p)), true);
  92. if (bwtaPINVOKE.SWIGPendingException.Pending) throw bwtaPINVOKE.SWIGPendingException.Retrieve();
  93. return ret;
  94. }
  95. public PolygonVector getHoles() {
  96. PolygonVector ret = new PolygonVector(bwtaPINVOKE.Polygon_getHoles(swigCPtr), false);
  97. return ret;
  98. }
  99. public PolygonVector holes {
  100. set {
  101. bwtaPINVOKE.Polygon_holes_set(swigCPtr, PolygonVector.getCPtr(value));
  102. }
  103. get {
  104. IntPtr cPtr = bwtaPINVOKE.Polygon_holes_get(swigCPtr);
  105. PolygonVector ret = (cPtr == IntPtr.Zero) ? null : new PolygonVector(cPtr, false);
  106. return ret;
  107. }
  108. }
  109. }
  110. }