private function calculateEndPoints($poid, $oid) {
    // from child...
    if ($this->map["type"] == MAPTYPE_HORIZONTAL) {
      // connect from mid top...
      $x1 = $this->map[$oid]->x * $this->scale['x'] + ($this->labelDim['right'] - $this->labelDim['left'])/2 + $this->border;
      $y1 = $this->map[$oid]->y * $this->scale['y'] + $this->border - 1;
    }
    else {
      // connect from mid left...
      $x1 = $this->map[$oid]->x * $this->scale['x'] + $this->border - 1;
      $y1 = $this->map[$oid]->y * $this->scale['y'] + ($this->labelDim['bottom'] - $this->labelDim['top'])/2 + $this->border;
    }
    // ...to parent
    if ($this->map["type"] == MAPTYPE_HORIZONTAL) {
      // ...to mid bottom
      $x2 = $this->map[$poid]->x * $this->scale['x'] + ($this->labelDim['right'] - $this->labelDim['left'])/2 + $this->border;
      $y2 = $this->map[$poid]->y * $this->scale['y'] + ($this->labelDim['bottom'] - $this->labelDim['top']) + $this->border + 1;
    }
    else {
      // ...to mid right
      $x2 = $this->map[$poid]->x * $this->scale['x'] + $this->labelDim['right'] - $this->labelDim['left'] + $this->border + 1;
      $y2 = $this->map[$poid]->y * $this->scale['y'] + ($this->labelDim['bottom'] - $this->labelDim['top'])/2 + $this->border;
    }
    return [new Position($x1, $y1, 0), new Position($x2, $y2, 0)];
  }