Add numCoords, Coords, Area, AlarmRGB to Zone object. Also add Points(), AreaCoords, svg_polygon utility functions to it.

This commit is contained in:
Isaac Connor 2021-12-05 17:45:26 -05:00
parent 27e87fc21f
commit 45559123af
1 changed files with 16 additions and 0 deletions

View File

@ -13,6 +13,10 @@ class Zone extends ZM_Object {
'Name' => '',
'Type' => 'Active',
'Units' => 'Pixels',
'NumCoords' => '0',
'Coords' => 0,
'Area' => '0',
'AlarmRGB' => '0',
'CheckMethod' => 'Blobs',
'MinPixelThreshold' => null,
'MaxPixelThreshold' => null,
@ -46,5 +50,17 @@ class Zone extends ZM_Object {
return new Monitor();
}
public function Points() {
return coordsToPoints($this->Coords());
}
public function AreaCoords() {
return preg_replace('/\s+/', ',', $this->Coords());
}
public function svg_polygon() {
return '<polygon points="'.$this->AreaCoords().'" class="'.$this->Type().'" />';
}
} # end class Zone
?>