/**
  * Constructor
  * @param array $config
  * @throws BadParamException
  */
 public function __construct(array $config)
 {
     foreach ($config as $prop => $value) {
         if (property_exists($this, $prop)) {
             $this->{$prop} = $value;
         }
     }
     if (!$this->zeroPoint instanceof IPointGlobal) {
         throw new BadParamException('ZeroPoint must be instance of IPointGlobal');
     }
     if (!$this->endPoint instanceof IPointGlobal) {
         throw new BadParamException('EndPoint must be instance of IPointGlobal');
     }
     if ($this->zeroPoint->equal($this->endPoint, true)) {
         throw new BadParamException("Field Points are equal");
     }
     $offset = $this->endPoint->subtract($this->zeroPoint);
     $this->latOffset = $offset->getLatitude();
     $this->lonOffset = $offset->getLongitude();
     $this->checkPositiveInt($this->latSegments, $this->lonSegments);
     $this->checkPositiveNumber($this->latLength, $this->lonLength);
 }