Skip to content

Commit

Permalink
Re-introduced the missing Triangle check in TIN
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMorel committed May 3, 2015
1 parent 9fce48c commit 47512f8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
10 changes: 0 additions & 10 deletions src/PolyhedralSurface.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,4 @@ public function getIterator()
{
return new \ArrayIterator($this->patches);
}

/**
* Returns the FQCN of the contained Geometry type.
*
* @return string
*/
protected static function containedGeometryType()
{
return Polygon::class;
}
}
22 changes: 16 additions & 6 deletions src/TIN.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,36 @@

namespace Brick\Geo;

use Brick\Geo\Exception\UnexpectedGeometryException;

/**
* A TIN (triangulated irregular network) is a PolyhedralSurface consisting only of Triangle patches.
*/
class TIN extends PolyhedralSurface
{
/**
* @noproxy
*
* {@inheritdoc}
*
* @throws UnexpectedGeometryException If the patches are not triangles.
*/
public function geometryType()
public function __construct(CoordinateSystem $cs, Polygon ...$patches)
{
return 'TIN';
parent::__construct($cs, ...$patches);

foreach ($patches as $patch) {
if (! $patch instanceof Triangle) {
throw new UnexpectedGeometryException('The patches in a TIN must be triangles.');
}
}
}

/**
* @noproxy
*
* {@inheritdoc}
*/
protected static function containedGeometryType()
public function geometryType()
{
return Triangle::class;
return 'TIN';
}
}

0 comments on commit 47512f8

Please sign in to comment.