001package com.github.sarxos.webcam; 002 003import java.awt.Point; 004import java.util.EventObject; 005 006 007/** 008 * Webcam detected motion event. 009 * 010 * @author Bartosz Firyn (SarXos) 011 */ 012public class WebcamMotionEvent extends EventObject { 013 014 private static final long serialVersionUID = -7245768099221999443L; 015 016 private final double strength; 017 private final Point cog; 018 019 /** 020 * Create detected motion event. 021 * 022 * @param detector 023 * @param strength 024 */ 025 public WebcamMotionEvent(WebcamMotionDetector detector, double strength, Point cog) { 026 027 super(detector); 028 029 this.strength = strength; 030 this.cog = cog; 031 } 032 033 /** 034 * Get percentage fraction of image covered by motion. 0 is no motion on 035 * image, and 100 is full image covered by motion. 036 * 037 * @return Motion area 038 */ 039 public double getArea() { 040 return strength; 041 } 042 043 public Point getCog() { 044 return cog; 045 } 046}