PHP Class Location\Line

Author: Marcus Jaschen ([email protected])
Inheritance: implements location\GeometryInterface
显示文件 Open project: mjaschen/phpgeo Class Usage Examples

Protected Properties

Property Type Description
$point1 Coordinate
$point2 Coordinate

Public Methods

Method Description
__construct ( Coordinate $point1, Coordinate $point2 )
getBearing ( Location\Bearing\BearingInterface $bearingCalculator ) : float
getFinalBearing ( Location\Bearing\BearingInterface $bearingCalculator ) : float
getLength ( Location\Distance\DistanceInterface $calculator ) : float Calculates the length of the line (distance between the two coordinates).
getPoint1 ( ) : Coordinate
getPoint2 ( ) : Coordinate
getPoints ( ) : array Returns an array containing the two points.
getReverse ( ) : Line Create a new instance with reversed point order, i. e. reversed direction.
setPoint1 ( Coordinate $point1 )
setPoint2 ( Coordinate $point2 )

Method Details

__construct() public method

public __construct ( Coordinate $point1, Coordinate $point2 )
$point1 Coordinate
$point2 Coordinate

getBearing() public method

public getBearing ( Location\Bearing\BearingInterface $bearingCalculator ) : float
$bearingCalculator Location\Bearing\BearingInterface
return float

getFinalBearing() public method

public getFinalBearing ( Location\Bearing\BearingInterface $bearingCalculator ) : float
$bearingCalculator Location\Bearing\BearingInterface
return float

getLength() public method

Calculates the length of the line (distance between the two coordinates).
public getLength ( Location\Distance\DistanceInterface $calculator ) : float
$calculator Location\Distance\DistanceInterface instance of distance calculation class
return float

getPoint1() public method

public getPoint1 ( ) : Coordinate
return Coordinate

getPoint2() public method

public getPoint2 ( ) : Coordinate
return Coordinate

getPoints() public method

Returns an array containing the two points.
public getPoints ( ) : array
return array

getReverse() public method

Create a new instance with reversed point order, i. e. reversed direction.
public getReverse ( ) : Line
return Line

setPoint1() public method

public setPoint1 ( Coordinate $point1 )
$point1 Coordinate

setPoint2() public method

public setPoint2 ( Coordinate $point2 )
$point2 Coordinate

Property Details

$point1 protected_oe property

protected Coordinate,Location $point1
return Coordinate

$point2 protected_oe property

protected Coordinate,Location $point2
return Coordinate