import { Boolean } from "../dataType/Boolean";
import { Number } from "../dataType/Number";
import { ErrorMargin } from "./ErrorMargin";
import { Geometry } from "./Geometry";
import { PrintObject } from "./PrintObject";
import { Projection } from "./Projection";
import { List } from "../dataType/List";
import { Array } from "../dataType/Array";
import { String } from "../dataType/String";
import { Dictionary } from "./Dictionary";

/**
 *  gve
 * @class gve.Feature
 * @since gve
 */
export class Feature extends PrintObject {

  /**
   * 通过Geometry构造Feature对象
   * @hideconstructor
   * @param {Geometry} [geometry] 几何形体对象
   * @param {object} [properties] Feature属性
   * @returns gve.Feature
   */
  constructor(geometry?: any, properties?: object) {
    super();
    if (!(this instanceof Feature)) {
      return new Feature(geometry, properties);
    }
  }

  type: string = "Feature";
  
  /**
   * Feature投影转换
   * @param {string} [proj] 可选参数,待转换的投影坐标,默认EPSG:4326
   * @returns Feature   
  */
  transform(proj?: string) {
    return new Feature();
  }

  /**
   *  设置影像的属性值
   *  @param {string} property 属性名
   *  @param {any} val 属性值
   *  @return Feature
   */
  set(property: string, val: any) {
    return new Feature();
  }

  /**
   *  判断第一个feature是否被第二个feature包含,不被包含返回false,被包含返回true
   *  @param {Feature} feature Feature实例
   *  @return boolean
   */
  containedIn(feature: Feature) {
    return new Boolean();
  }

  /**
   *  判断第一个feature是否包含第二个feature,不包含返回false,包含返回true
   *  @param {Feature} feature Feature实例
   *  @return boolean
   */
  contains(feature: Feature) {
    return new Boolean();
  }

  /**
   *  判断两个feature是否相离,相离返回true,相交返回false
   *  @param {Feature} feature Feature实例
   *  @return boolean
   */
  disjoint(feature: Feature) {
    return new Boolean();
  }

  /**
   *  判断两个feature是否相交,返回True和False
   *  @param {Feature} feature Feature实例
   *  @return boolean
   */
  intersects(feature: Feature) {
    return new Boolean();
  }

  /**
   *  计算两个feature的交集,返回交集feature,属性为第一个feature的属性
   *  @param {Feature} feature Feature实例
   *  @return Feature
   */
  intersection(feature: Feature) {
    return new Feature();
  }

  /**
   *  计算两个feature的差集,返回差集feature,属性为第一个feature的属性
   *  @param {Feature} feature Feature实例
   *  @return Feature
   */
  difference(feature: Feature) {
    return new Feature();
  }

  /**
   *  计算两个feature的并集,返回并集feature,属性为第一个feature的属性
   *  @param {Feature} feature Feature实例
   *  @return Feature
   */
  union(feature: Feature) {
    return new Feature();
  }

  /**
   *  返回给定特征几何体线性部分的长度。多边形部分将被忽略。多几何图形的长度是各部分长度的总和。
   *  @return Number
   */
  length() {
    return new Number();
  }

  /**
   *  返回地物默认几何图形的面积。点和线字符串的面积为 0,多几何图形的面积是其组成部分的面积之和(相交面积计算多次)
   *  @return Number
   */
  area() {
    return new Number();
  }

  /**
   *  融合feature,返回融合feature
   *  @return Feature
   */
  dissolve() {
    return new Feature();
  }

  /**
   *  计算feature缓冲区,返回缓冲区feature
   *  @param {number} param 缓冲区半径,单位为米
   *  @return Feature
   */
  buffer(param: number) {
    return new Feature();
  }

  /**
   * 返回Feature的几何图形信息,几何信息以Json形式表示
   * @returns Geometry
   */
  geometry() {
    return new Geometry();
  }

  /**
   * 返回给定Feature的geometry
   * @param {ErrorMargin} [maxError] 可选参数,最大的误差
   * @param {Projection} [proj] 可选参数,投影
   * @returns Feature
   */
  bounds(maxError?: ErrorMargin, proj?: Projection) {
    return new Feature();
  }

  /**
   * 返回给定Feature的中心点
   * @param {ErrorMargin} [maxError] 可选参数,最大的误差
   * @param {Projection} [proj] 可选参数,投影
   * @returns Feature
   */
  centroid(maxError?: ErrorMargin, proj?: Projection) {
    return new Feature();
  }

  /**
   * 返回给定Feature的凸包
   * @param {ErrorMargin} [maxError] 可选参数,最大的误差
   * @param {Projection} [proj] 可选参数,投影
   * @returns Feature
   */
  convexHull(maxError?: ErrorMargin, proj?: Projection) {
    return new Feature();
  }

  /**
   * 复制Feature的属性信息
   * @param {Feature} source 复制属性的对象
   * @param {List<any>|any[]} [properties] 可选参数,复制的属性列表
   * @param {List<any>|any[]} [exclude] 可选参数,排除的属性
   * @returns Feature
   */
  copyProperties(source: Feature, properties?: List<any>|any[], exclude?: List<any>|any[]) {
    return new Feature();
  }

  /**
   * 切割Feature不超过给定的距离
   * @param {List<any>|any[]} distances 每个LineString的距离
   * @param {ErrorMargin} [maxError] 可选参数,最大的误差
   * @param {Projection} [proj] 可选参数,投影
   * @returns Feature
   */
  cutLines(distances: List<any>|any[], maxError?: ErrorMargin, proj?: Projection) {
    return new Feature();
  }

  /**
   * 返回两个Feature之间最小的距离
   * @param {Feature} right 需要计算距离的Feature
   * @param {ErrorMargin} [maxError] 可选参数,最大的误差
   * @param {Projection} [proj] 可选参数,投影
   * @returns Number
   */
  distance(right: Feature, maxError?: ErrorMargin, proj?: Projection) {
    return new Number();
  }

  /**
   * 提取一个Feature中的属性值
   * @param {string} property 提取的属性
   * @returns Array
   */
  getArray(property: string) {
    return new Array();
  }

  /**
   * 提取一个Feature中的属性值
   * @param {string} property 提取的属性
   * @returns Number
   */
  getNumber(property: string) {
    return new Number();
  }

  /**
   * 提取一个Feature中的属性值
   * @param {string} property 提取的属性
   * @returns String
   */
  getString(property: string) {
    return new String();
  }

  /**
   * 返回Feature在集合中给定的ID
   * @returns String
   */
  id() {
    return new String();
  }

  /**
   * 返回Feature的周长
   * @param {ErrorMargin} [maxError] 可选参数,最大的误差
   * @param {Projection} [proj] 可选参数,投影
   * @returns Number
   */
  perimeter(maxError?: ErrorMargin, proj?: Projection) {
    return new Number();
  }

  /**
   * 返回Feature的序列化对象
   * @param {boolean} [legacy] 可选参数,是否需要序列化
   * @returns Feature
   */
  serialize(legacy?: boolean) {
    return new Feature();
  }

  /**
   * 返回给定Geometry的Feature
   * @param {Geometry} geometry 给定的geometry
   * @returns Feature
   */
  setGeometry(geometry: Geometry) {
    return new Feature();
  }

  /**
   * 简化Feature的Geometry在给定的误差内
   * @param {ErrorMargin} maxError 最大的误差
   * @param {Projection} [proj] 可选参数,投影
   * @returns Feature
   */
  simplify(maxError: ErrorMargin, proj?: Projection) {
    return new Feature();
  }

  /**
   * 两个Feature之间的对称差异
   * @param {Feature} right 待比较的Feature
   * @param {ErrorMargin} [maxError] 可选参数,最大的误差
   * @param {Projection} [proj] 可选参数,投影
   * @returns Feature
   */
  symmetricDifference(right: Feature, maxError?: ErrorMargin, proj?: Projection) {
    return new Feature();
  }

  /**
   * 根据Feature中的选择的属性创建一个新Array
   * @param {List<any>|any[]} properties 选择的属性
   * @returns Array
   */
  toArray(properties: List<any>|any[]) {
    return new Array();
  }

  /**
   * 根据Feature中的选择的属性创建一个新Dictionary
   * @param {List<any>|any[]} properties 选择的属性
   * @returns Dictionary
   */
  toDictionary(properties: List<any>|any[]) {
    return new Dictionary();
  }
  /**
   * 判断两个几何形状在指定距离内
   * @param {Feature} right Feature
   * @param {Number} distance 距离的阈值
   * @param {Projection} [proj] 投影类型
   * @returns Boolean
   */
  withinDistance(right:Feature, distance:number, proj?:Projection){
    return new Boolean();
  }
}