Clean up constructor/Setup functions. Add copy constructor. Change Load to return a std::list<Zone>
This commit is contained in:
parent
5ab9a48599
commit
03767236d9
121
src/zm_zone.cpp
121
src/zm_zone.cpp
|
@ -24,9 +24,6 @@
|
|||
#include "zm_monitor.h"
|
||||
|
||||
void Zone::Setup(
|
||||
Monitor *p_monitor,
|
||||
int p_id,
|
||||
const char *p_label,
|
||||
ZoneType p_type,
|
||||
const Polygon &p_polygon,
|
||||
const Rgb p_alarm_rgb,
|
||||
|
@ -45,11 +42,6 @@ void Zone::Setup(
|
|||
int p_overload_frames,
|
||||
int p_extend_alarm_frames
|
||||
) {
|
||||
monitor = p_monitor;
|
||||
|
||||
id = p_id;
|
||||
label = new char[strlen(p_label)+1];
|
||||
strcpy(label, p_label);
|
||||
type = p_type;
|
||||
polygon = p_polygon;
|
||||
alarm_rgb = p_alarm_rgb;
|
||||
|
@ -108,25 +100,21 @@ void Zone::Setup(
|
|||
}
|
||||
}
|
||||
|
||||
if ( config.record_diag_images ) {
|
||||
if ( config.record_diag_images_fifo ) {
|
||||
snprintf(diag_path, sizeof(diag_path),
|
||||
"%s/diagpipe-%d-poly.jpg",
|
||||
if (config.record_diag_images) {
|
||||
if (config.record_diag_images_fifo) {
|
||||
diag_path = stringtf("%s/diagpipe-%d-poly.jpg",
|
||||
staticConfig.PATH_SOCKS.c_str(), id);
|
||||
|
||||
Fifo::fifo_create_if_missing(diag_path);
|
||||
Fifo::fifo_create_if_missing(diag_path.c_str());
|
||||
} else {
|
||||
snprintf(diag_path, sizeof(diag_path), "%s/diag-%d-poly.jpg",
|
||||
diag_path = stringtf("%s/diag-%d-poly.jpg",
|
||||
monitor->getStorage()->Path(), id);
|
||||
}
|
||||
pg_image->WriteJpeg(diag_path, config.record_diag_images_fifo);
|
||||
} else {
|
||||
diag_path[0] = 0;
|
||||
pg_image->WriteJpeg(diag_path.c_str(), config.record_diag_images_fifo);
|
||||
}
|
||||
} // end Zone::Setup
|
||||
|
||||
Zone::~Zone() {
|
||||
delete[] label;
|
||||
if ( image )
|
||||
delete image;
|
||||
delete pg_image;
|
||||
|
@ -227,7 +215,7 @@ bool Zone::CheckAlarms(const Image *delta_image) {
|
|||
unsigned int hi_x = polygon.HiX();
|
||||
unsigned int hi_y = polygon.HiY();
|
||||
|
||||
Debug(4, "Checking alarms for zone %d/%s in lines %d -> %d", id, label, lo_y, hi_y);
|
||||
Debug(4, "Checking alarms for zone %d/%s in lines %d -> %d", id, label.c_str(), lo_y, hi_y);
|
||||
|
||||
/* if(config.cpu_extensions && sse_version >= 20) {
|
||||
sse2_alarmedpixels(diff_image, pg_image, &alarm_pixels, &pixel_diff_count);
|
||||
|
@ -237,7 +225,7 @@ bool Zone::CheckAlarms(const Image *delta_image) {
|
|||
std_alarmedpixels(diff_image, pg_image, &alarm_pixels, &pixel_diff_count);
|
||||
|
||||
if ( config.record_diag_images )
|
||||
diff_image->WriteJpeg(diag_path, config.record_diag_images_fifo);
|
||||
diff_image->WriteJpeg(diag_path.c_str(), config.record_diag_images_fifo);
|
||||
|
||||
if ( pixel_diff_count && alarm_pixels )
|
||||
pixel_diff = pixel_diff_count/alarm_pixels;
|
||||
|
@ -321,7 +309,7 @@ bool Zone::CheckAlarms(const Image *delta_image) {
|
|||
}
|
||||
|
||||
if ( config.record_diag_images )
|
||||
diff_image->WriteJpeg(diag_path, config.record_diag_images_fifo);
|
||||
diff_image->WriteJpeg(diag_path.c_str(), config.record_diag_images_fifo);
|
||||
|
||||
Debug(5, "Got %d filtered pixels, need %d -> %d",
|
||||
alarm_filter_pixels, min_filter_pixels, max_filter_pixels);
|
||||
|
@ -543,7 +531,7 @@ bool Zone::CheckAlarms(const Image *delta_image) {
|
|||
}
|
||||
|
||||
if ( config.record_diag_images )
|
||||
diff_image->WriteJpeg(diag_path, config.record_diag_images_fifo);
|
||||
diff_image->WriteJpeg(diag_path.c_str(), config.record_diag_images_fifo);
|
||||
|
||||
if ( !alarm_blobs ) {
|
||||
return false;
|
||||
|
@ -594,7 +582,7 @@ bool Zone::CheckAlarms(const Image *delta_image) {
|
|||
} // end for i < WHITE
|
||||
|
||||
if ( config.record_diag_images )
|
||||
diff_image->WriteJpeg(diag_path, config.record_diag_images_fifo);
|
||||
diff_image->WriteJpeg(diag_path.c_str(), config.record_diag_images_fifo);
|
||||
|
||||
Debug(5, "Got %d blob pixels, %d blobs, need %d -> %d, %d -> %d",
|
||||
alarm_blob_pixels, alarm_blobs, min_blob_pixels, max_blob_pixels, min_blobs, max_blobs);
|
||||
|
@ -746,14 +734,12 @@ bool Zone::CheckAlarms(const Image *delta_image) {
|
|||
bool Zone::ParsePolygonString(const char *poly_string, Polygon &polygon) {
|
||||
|
||||
char *str = (char *)poly_string;
|
||||
char *ws;
|
||||
char *cp;
|
||||
int n_coords = 0;
|
||||
int max_n_coords = strlen(str)/4;
|
||||
Coord *coords = new Coord[max_n_coords];
|
||||
while ( *str != '\0' ) {
|
||||
cp = strchr(str, ',');
|
||||
if ( !cp ) {
|
||||
char *cp = strchr(str, ',');
|
||||
if (!cp) {
|
||||
Error("Bogus coordinate %s found in polygon string", str);
|
||||
break;
|
||||
}
|
||||
|
@ -762,7 +748,7 @@ bool Zone::ParsePolygonString(const char *poly_string, Polygon &polygon) {
|
|||
Debug(3, "Got coordinate %d,%d from polygon string", x, y);
|
||||
coords[n_coords++] = Coord(x, y);
|
||||
|
||||
ws = strchr(cp+2, ' ');
|
||||
char *ws = strchr(cp+2, ' ');
|
||||
if ( ws )
|
||||
str = ws+1;
|
||||
else
|
||||
|
@ -818,7 +804,10 @@ bool Zone::ParseZoneString(const char *zone_string, int &zone_id, int &colour, P
|
|||
return result;
|
||||
} // end bool Zone::ParseZoneString(const char *zone_string, int &zone_id, int &colour, Polygon &polygon)
|
||||
|
||||
int Zone::Load(Monitor *monitor, Zone **&zones) {
|
||||
std::list<Zone> Zone::Load(Monitor *monitor) {
|
||||
std::list<Zone> zones;
|
||||
|
||||
//), Zone **&zones) {
|
||||
std::string sql = stringtf("SELECT Id,Name,Type+0,Units,Coords,AlarmRGB,CheckMethod+0,"
|
||||
"MinPixelThreshold,MaxPixelThreshold,MinAlarmPixels,MaxAlarmPixels,"
|
||||
"FilterX,FilterY,MinFilterPixels,MaxFilterPixels,"
|
||||
|
@ -827,14 +816,14 @@ int Zone::Load(Monitor *monitor, Zone **&zones) {
|
|||
" FROM Zones WHERE MonitorId = %d ORDER BY Type, Id", monitor->Id());
|
||||
|
||||
MYSQL_RES *result = zmDbFetch(sql.c_str());
|
||||
if (!result) {
|
||||
return 0;
|
||||
}
|
||||
if (!result) return zones;
|
||||
|
||||
int n_zones = mysql_num_rows(result);
|
||||
Debug(1, "Got %d zones for monitor %s", n_zones, monitor->Name());
|
||||
#if 0
|
||||
delete[] zones;
|
||||
zones = new Zone *[n_zones];
|
||||
#endif
|
||||
for(int i = 0; MYSQL_ROW dbrow = mysql_fetch_row(result); i++) {
|
||||
int col = 0;
|
||||
|
||||
|
@ -867,7 +856,6 @@ int Zone::Load(Monitor *monitor, Zone **&zones) {
|
|||
Polygon polygon;
|
||||
if ( !ParsePolygonString(Coords, polygon) ) {
|
||||
Error("Unable to parse polygon string '%s' for zone %d/%s for monitor %s, ignoring", Coords, Id, Name, monitor->Name());
|
||||
n_zones -= 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -891,10 +879,13 @@ int Zone::Load(Monitor *monitor, Zone **&zones) {
|
|||
}
|
||||
|
||||
if ( atoi(dbrow[2]) == Zone::INACTIVE ) {
|
||||
zones[i] = new Zone(monitor, Id, Name, polygon);
|
||||
//zones[i] = new Zone(monitor, Id, Name, polygon);
|
||||
zones.push_back(Zone(monitor, Id, Name, polygon));
|
||||
} else if ( atoi(dbrow[2]) == Zone::PRIVACY ) {
|
||||
zones[i] = new Zone(monitor, Id, Name, (Zone::ZoneType)Type, polygon);
|
||||
//zones[i] = new Zone(monitor, Id, Name, (Zone::ZoneType)Type, polygon);
|
||||
zones.push_back(Zone(monitor, Id, Name, (Zone::ZoneType)Type, polygon));
|
||||
} else {
|
||||
#if 0
|
||||
zones[i] = new Zone(
|
||||
monitor, Id, Name, (Zone::ZoneType)Type, polygon, AlarmRGB,
|
||||
(Zone::CheckMethod)CheckMethod, MinPixelThreshold, MaxPixelThreshold,
|
||||
|
@ -902,17 +893,25 @@ int Zone::Load(Monitor *monitor, Zone **&zones) {
|
|||
MinFilterPixels, MaxFilterPixels,
|
||||
MinBlobPixels, MaxBlobPixels, MinBlobs, MaxBlobs,
|
||||
OverloadFrames, ExtendAlarmFrames);
|
||||
#endif
|
||||
zones.push_back(Zone(
|
||||
monitor, Id, Name, (Zone::ZoneType)Type, polygon, AlarmRGB,
|
||||
(Zone::CheckMethod)CheckMethod, MinPixelThreshold, MaxPixelThreshold,
|
||||
MinAlarmPixels, MaxAlarmPixels, Coord( FilterX, FilterY ),
|
||||
MinFilterPixels, MaxFilterPixels,
|
||||
MinBlobPixels, MaxBlobPixels, MinBlobs, MaxBlobs,
|
||||
OverloadFrames, ExtendAlarmFrames));
|
||||
}
|
||||
} // end foreach row
|
||||
mysql_free_result(result);
|
||||
return n_zones;
|
||||
} // end int Zone::Load(Monitor *monitor, Zone **&zones)
|
||||
return zones;
|
||||
} // end std::list<Zone> Zone::Load(Monitor *monitor)
|
||||
|
||||
bool Zone::DumpSettings(char *output, bool /*verbose*/) {
|
||||
output[0] = 0;
|
||||
|
||||
sprintf(output+strlen(output), " Id : %d\n", id );
|
||||
sprintf(output+strlen(output), " Label : %s\n", label );
|
||||
sprintf(output+strlen(output), " Label : %s\n", label.c_str() );
|
||||
sprintf(output+strlen(output), " Type: %d - %s\n", type,
|
||||
type==ACTIVE?"Active":(
|
||||
type==INCLUSIVE?"Inclusive":(
|
||||
|
@ -985,3 +984,49 @@ void Zone::std_alarmedpixels(
|
|||
*pixel_sum = pixelsdifference;
|
||||
Debug(7, "STORED pixelsalarmed(%d), pixelsdifference(%d)", pixelsalarmed, pixelsdifference);
|
||||
} // end void Zone::std_alarmedpixels(Image* pdiff_image, const Image* ppoly_image, unsigned int* pixel_count, unsigned int* pixel_sum)
|
||||
|
||||
Zone::Zone(const Zone &z) {
|
||||
monitor = z.monitor;
|
||||
id = z.id;
|
||||
label = z.label;
|
||||
type = z.type;
|
||||
alarm_rgb = z.alarm_rgb;
|
||||
check_method = z.check_method;
|
||||
min_pixel_threshold = z.min_pixel_threshold;
|
||||
max_pixel_threshold = z.max_pixel_threshold;
|
||||
min_alarm_pixels = z.min_alarm_pixels;
|
||||
max_alarm_pixels = z.max_alarm_pixels;
|
||||
filter_box = z.filter_box;
|
||||
min_filter_pixels = z.min_filter_pixels;
|
||||
max_filter_pixels = z.max_filter_pixels;
|
||||
std::copy(z.blob_stats, z.blob_stats+256, blob_stats);
|
||||
min_blob_pixels = z.min_blob_pixels;
|
||||
max_blob_pixels = z.max_blob_pixels;
|
||||
min_blobs = z.min_blobs;
|
||||
max_blobs = z.max_blobs;
|
||||
overload_frames = z.overload_frames;
|
||||
extend_alarm_frames = z.extend_alarm_frames;
|
||||
|
||||
alarmed = z.alarmed;
|
||||
was_alarmed = z.was_alarmed;
|
||||
pixel_diff = z.pixel_diff;
|
||||
alarm_pixels = z.alarm_pixels;
|
||||
alarm_filter_pixels = z.alarm_filter_pixels;
|
||||
alarm_blob_pixels = z.alarm_blob_pixels;
|
||||
alarm_blobs = z.alarm_blobs;
|
||||
min_blob_size = z.min_blob_size;
|
||||
max_blob_size = z.max_blob_size;
|
||||
|
||||
alarm_box = z.alarm_box;
|
||||
alarm_centre = z.alarm_centre;
|
||||
score = z.score;
|
||||
pg_image = z.pg_image ? new Image(*z.pg_image) : nullptr;
|
||||
ranges = new Range[monitor->Height()];
|
||||
std::copy(z.ranges, z.ranges+monitor->Height(), ranges);
|
||||
image = z.image ? new Image(*z.image) : nullptr;
|
||||
|
||||
overload_count = z.overload_count;
|
||||
extend_alarm_count = z.extend_alarm_count;
|
||||
diag_path = z.diag_path;
|
||||
}
|
||||
|
||||
|
|
143
src/zm_zone.h
143
src/zm_zone.h
|
@ -27,6 +27,10 @@
|
|||
#include "zm_poly.h"
|
||||
#include "zm_rgb.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
||||
class Event;
|
||||
class Image;
|
||||
class Monitor;
|
||||
|
@ -42,7 +46,14 @@ protected:
|
|||
int hi_x;
|
||||
int off_x;
|
||||
};
|
||||
typedef struct { unsigned char tag; int count; int lo_x; int hi_x; int lo_y; int hi_y; } BlobStats;
|
||||
typedef struct {
|
||||
unsigned char tag;
|
||||
int count;
|
||||
int lo_x;
|
||||
int hi_x;
|
||||
int lo_y;
|
||||
int hi_y;
|
||||
} BlobStats;
|
||||
|
||||
public:
|
||||
typedef enum { ACTIVE=1, INCLUSIVE, EXCLUSIVE, PRECLUSIVE, INACTIVE, PRIVACY } ZoneType;
|
||||
|
@ -50,10 +61,10 @@ public:
|
|||
|
||||
protected:
|
||||
// Inputs
|
||||
Monitor *monitor;
|
||||
Monitor *monitor;
|
||||
|
||||
int id;
|
||||
char *label;
|
||||
int id;
|
||||
std::string label;
|
||||
ZoneType type;
|
||||
Polygon polygon;
|
||||
Rgb alarm_rgb;
|
||||
|
@ -69,7 +80,7 @@ protected:
|
|||
int min_filter_pixels;
|
||||
int max_filter_pixels;
|
||||
|
||||
BlobStats blob_stats[256];
|
||||
BlobStats blob_stats[256];
|
||||
int min_blob_pixels;
|
||||
int max_blob_pixels;
|
||||
int min_blobs;
|
||||
|
@ -97,50 +108,128 @@ protected:
|
|||
|
||||
int overload_count;
|
||||
int extend_alarm_count;
|
||||
char diag_path[PATH_MAX];
|
||||
std::string diag_path;
|
||||
|
||||
protected:
|
||||
void Setup( Monitor *p_monitor, int p_id, const char *p_label, ZoneType p_type, const Polygon &p_polygon, const Rgb p_alarm_rgb, CheckMethod p_check_method, int p_min_pixel_threshold, int p_max_pixel_threshold, int p_min_alarm_pixels, int p_max_alarm_pixels, const Coord &p_filter_box, int p_min_filter_pixels, int p_max_filter_pixels, int p_min_blob_pixels, int p_max_blob_pixels, int p_min_blobs, int p_max_blobs, int p_overload_frames, int p_extend_alarm_frames );
|
||||
void Setup(
|
||||
ZoneType p_type,
|
||||
const Polygon &p_polygon,
|
||||
const Rgb p_alarm_rgb,
|
||||
CheckMethod p_check_method,
|
||||
int p_min_pixel_threshold,
|
||||
int p_max_pixel_threshold,
|
||||
int p_min_alarm_pixels,
|
||||
int p_max_alarm_pixels,
|
||||
const Coord &p_filter_box,
|
||||
int p_min_filter_pixels,
|
||||
int p_max_filter_pixels,
|
||||
int p_min_blob_pixels,
|
||||
int p_max_blob_pixels,
|
||||
int p_min_blobs,
|
||||
int p_max_blobs,
|
||||
int p_overload_frames,
|
||||
int p_extend_alarm_frames);
|
||||
|
||||
void std_alarmedpixels(Image* pdiff_image, const Image* ppoly_image, unsigned int* pixel_count, unsigned int* pixel_sum);
|
||||
|
||||
public:
|
||||
Zone( Monitor *p_monitor, int p_id, const char *p_label, ZoneType p_type, const Polygon &p_polygon, const Rgb p_alarm_rgb, CheckMethod p_check_method, int p_min_pixel_threshold=15, int p_max_pixel_threshold=0, int p_min_alarm_pixels=50, int p_max_alarm_pixels=75000, const Coord &p_filter_box=Coord( 3, 3 ), int p_min_filter_pixels=50, int p_max_filter_pixels=50000, int p_min_blob_pixels=10, int p_max_blob_pixels=0, int p_min_blobs=0, int p_max_blobs=0, int p_overload_frames=0, int p_extend_alarm_frames=0 )
|
||||
Zone(
|
||||
Monitor *p_monitor,
|
||||
int p_id,
|
||||
const char *p_label,
|
||||
ZoneType p_type,
|
||||
const Polygon &p_polygon,
|
||||
const Rgb p_alarm_rgb,
|
||||
CheckMethod p_check_method,
|
||||
int p_min_pixel_threshold=15,
|
||||
int p_max_pixel_threshold=0,
|
||||
int p_min_alarm_pixels=50,
|
||||
int p_max_alarm_pixels=75000,
|
||||
const Coord &p_filter_box=Coord( 3, 3 ),
|
||||
int p_min_filter_pixels=50,
|
||||
int p_max_filter_pixels=50000,
|
||||
int p_min_blob_pixels=10,
|
||||
int p_max_blob_pixels=0,
|
||||
int p_min_blobs=0,
|
||||
int p_max_blobs=0,
|
||||
int p_overload_frames=0,
|
||||
int p_extend_alarm_frames=0)
|
||||
:
|
||||
monitor(p_monitor),
|
||||
id(p_id),
|
||||
label(p_label),
|
||||
blob_stats{}
|
||||
{
|
||||
Setup( p_monitor, p_id, p_label, p_type, p_polygon, p_alarm_rgb, p_check_method, p_min_pixel_threshold, p_max_pixel_threshold, p_min_alarm_pixels, p_max_alarm_pixels, p_filter_box, p_min_filter_pixels, p_max_filter_pixels, p_min_blob_pixels, p_max_blob_pixels, p_min_blobs, p_max_blobs, p_overload_frames, p_extend_alarm_frames );
|
||||
Setup(p_type, p_polygon, p_alarm_rgb, p_check_method, p_min_pixel_threshold, p_max_pixel_threshold, p_min_alarm_pixels, p_max_alarm_pixels, p_filter_box, p_min_filter_pixels, p_max_filter_pixels, p_min_blob_pixels, p_max_blob_pixels, p_min_blobs, p_max_blobs, p_overload_frames, p_extend_alarm_frames );
|
||||
}
|
||||
Zone( Monitor *p_monitor, int p_id, const char *p_label, const Polygon &p_polygon, const Rgb p_alarm_rgb, CheckMethod p_check_method, int p_min_pixel_threshold=15, int p_max_pixel_threshold=0, int p_min_alarm_pixels=50, int p_max_alarm_pixels=75000, const Coord &p_filter_box=Coord( 3, 3 ), int p_min_filter_pixels=50, int p_max_filter_pixels=50000, int p_min_blob_pixels=10, int p_max_blob_pixels=0, int p_min_blobs=0, int p_max_blobs=0, int p_overload_frames=0, int p_extend_alarm_frames=0)
|
||||
Zone(
|
||||
Monitor *p_monitor,
|
||||
int p_id,
|
||||
const char *p_label,
|
||||
const Polygon &p_polygon,
|
||||
const Rgb p_alarm_rgb,
|
||||
CheckMethod p_check_method,
|
||||
int p_min_pixel_threshold=15,
|
||||
int p_max_pixel_threshold=0,
|
||||
int p_min_alarm_pixels=50,
|
||||
int p_max_alarm_pixels=75000,
|
||||
const Coord &p_filter_box=Coord( 3, 3 ),
|
||||
int p_min_filter_pixels=50,
|
||||
int p_max_filter_pixels=50000,
|
||||
int p_min_blob_pixels=10,
|
||||
int p_max_blob_pixels=0,
|
||||
int p_min_blobs=0,
|
||||
int p_max_blobs=0,
|
||||
int p_overload_frames=0,
|
||||
int p_extend_alarm_frames=0)
|
||||
:
|
||||
monitor(p_monitor),
|
||||
id(p_id),
|
||||
label(p_label),
|
||||
blob_stats{}
|
||||
{
|
||||
Setup( p_monitor, p_id, p_label, Zone::ACTIVE, p_polygon, p_alarm_rgb, p_check_method, p_min_pixel_threshold, p_max_pixel_threshold, p_min_alarm_pixels, p_max_alarm_pixels, p_filter_box, p_min_filter_pixels, p_max_filter_pixels, p_min_blob_pixels, p_max_blob_pixels, p_min_blobs, p_max_blobs, p_overload_frames, p_extend_alarm_frames );
|
||||
Setup(Zone::ACTIVE, p_polygon, p_alarm_rgb, p_check_method, p_min_pixel_threshold, p_max_pixel_threshold, p_min_alarm_pixels, p_max_alarm_pixels, p_filter_box, p_min_filter_pixels, p_max_filter_pixels, p_min_blob_pixels, p_max_blob_pixels, p_min_blobs, p_max_blobs, p_overload_frames, p_extend_alarm_frames );
|
||||
}
|
||||
Zone( Monitor *p_monitor, int p_id, const char *p_label, const Polygon &p_polygon )
|
||||
Zone(Monitor *p_monitor, int p_id, const char *p_label, const Polygon &p_polygon)
|
||||
:
|
||||
monitor(p_monitor),
|
||||
id(p_id),
|
||||
label(p_label),
|
||||
blob_stats{}
|
||||
{
|
||||
Setup( p_monitor, p_id, p_label, Zone::INACTIVE, p_polygon, kRGBBlack, (Zone::CheckMethod)0, 0, 0, 0, 0, Coord( 0, 0 ), 0, 0, 0, 0, 0, 0, 0, 0 );
|
||||
Setup(Zone::INACTIVE, p_polygon, kRGBBlack, (Zone::CheckMethod)0, 0, 0, 0, 0, Coord(0, 0), 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
Zone( Monitor *p_monitor, int p_id, const char *p_label, ZoneType p_type, const Polygon &p_polygon )
|
||||
:
|
||||
monitor(p_monitor),
|
||||
id(p_id),
|
||||
label(p_label),
|
||||
blob_stats{}
|
||||
{
|
||||
Setup( p_monitor, p_id, p_label, p_type, p_polygon, kRGBBlack, (Zone::CheckMethod)0, 0, 0, 0, 0, Coord( 0, 0 ), 0, 0, 0, 0, 0, 0, 0, 0 );
|
||||
Setup(p_type, p_polygon, kRGBBlack, (Zone::CheckMethod)0, 0, 0, 0, 0, Coord( 0, 0 ), 0, 0, 0, 0, 0, 0, 0, 0 );
|
||||
}
|
||||
|
||||
public:
|
||||
Zone(const Zone &z);
|
||||
|
||||
~Zone();
|
||||
|
||||
inline int Id() const { return( id ); }
|
||||
inline const char *Label() const { return( label ); }
|
||||
inline ZoneType Type() const { return( type ); }
|
||||
inline int Id() const { return id; }
|
||||
inline const char *Label() const { return label.c_str(); }
|
||||
inline ZoneType Type() const { return type; }
|
||||
inline bool IsActive() const { return( type == ACTIVE ); }
|
||||
inline bool IsInclusive() const { return( type == INCLUSIVE ); }
|
||||
inline bool IsExclusive() const { return( type == EXCLUSIVE ); }
|
||||
inline bool IsPreclusive() const { return( type == PRECLUSIVE ); }
|
||||
inline bool IsInactive() const { return( type == INACTIVE ); }
|
||||
inline bool IsPrivacy() const { return( type == PRIVACY ); }
|
||||
inline const Image *AlarmImage() const { return( image ); }
|
||||
inline const Polygon &GetPolygon() const { return( polygon ); }
|
||||
inline bool Alarmed() const { return( alarmed ); }
|
||||
inline bool WasAlarmed() const { return( was_alarmed ); }
|
||||
inline const Image *AlarmImage() const { return image; }
|
||||
inline const Polygon &GetPolygon() const { return polygon; }
|
||||
inline bool Alarmed() const { return alarmed; }
|
||||
inline bool WasAlarmed() const { return was_alarmed; }
|
||||
inline void SetAlarm() { was_alarmed = alarmed; alarmed = true; }
|
||||
inline void ClearAlarm() { was_alarmed = alarmed; alarmed = false; }
|
||||
inline Coord GetAlarmCentre() const { return( alarm_centre ); }
|
||||
inline unsigned int Score() const { return( score ); }
|
||||
inline Coord GetAlarmCentre() const { return alarm_centre; }
|
||||
inline unsigned int Score() const { return score; }
|
||||
|
||||
inline void ResetStats() {
|
||||
alarmed = false;
|
||||
|
@ -160,7 +249,7 @@ public:
|
|||
|
||||
static bool ParsePolygonString( const char *polygon_string, Polygon &polygon );
|
||||
static bool ParseZoneString( const char *zone_string, int &zone_id, int &colour, Polygon &polygon );
|
||||
static int Load( Monitor *monitor, Zone **&zones );
|
||||
static std::list<Zone> Load(Monitor *monitor);
|
||||
//=================================================
|
||||
bool CheckOverloadCount();
|
||||
int GetOverloadCount();
|
||||
|
@ -174,8 +263,8 @@ public:
|
|||
void SetScore(unsigned int nScore);
|
||||
void SetAlarmImage(const Image* srcImage);
|
||||
|
||||
inline const Image *getPgImage() const { return( pg_image ); }
|
||||
inline const Range *getRanges() const { return( ranges ); }
|
||||
inline const Image *getPgImage() const { return pg_image; }
|
||||
inline const Range *getRanges() const { return ranges; }
|
||||
};
|
||||
|
||||
#endif // ZM_ZONE_H
|
||||
|
|
Loading…
Reference in New Issue