Point.js 702 B

1234567891011121314151617181920212223242526272829303132
  1. //CLASS:几何类型点
  2. function Point(x, y,radius) {
  3. Geometry.apply(this, arguments);
  4. this.radius = radius;
  5. this.x = x;
  6. this.y = y;
  7. };
  8. Point.prototype = new Geometry();
  9. //point类的横坐标。
  10. Point.prototype.x = null;
  11. //point类的纵坐标。
  12. Point.prototype.y = null;
  13. //得到点的范围。
  14. Point.prototype.getBounds = function () {
  15. if(!this.bounds) {
  16. var x = this.x;
  17. var y = this.y;
  18. this.bounds = new CanvasSketch.Bounds(x, y, x, y);
  19. return this.bounds;
  20. } else {
  21. return this.bounds;
  22. }
  23. };
  24. //clone方法。
  25. Point.prototype.clone = function () {
  26. return new Point(this.x, this.y);
  27. };
  28. Point.prototype.geoType = "Point";