01: /*
02: * Apollo - Motion capture and animation system
03: * Copyright (c) 2005 Apollo
04: *
05: * This program is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU General Public License
07: * as published by the Free Software Foundation; either version 2
08: * of the License, or (at your option) any later version.
09: *
10: * This program is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13: * GNU General Public License for more details.
14: *
15: * You should have received a copy of the GNU General Public License
16: * along with this program; if not, write to the Free Software
17: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18: *
19: * http://www.gnu.org/copyleft/gpl.html
20: *
21: * @author Giovane.Kuhn - brain@netuno.com.br
22: *
23: */
24: package org.apollo.datamodel;
25:
26: import java.io.Serializable;
27: import java.util.Collections;
28: import java.util.HashMap;
29: import java.util.Map;
30:
31: /**
32: * Class to represent a frame in tracking video
33: * @author Giovane.Kuhn on 27/05/2005
34: */
35: public final class TrackingFrame implements Serializable {
36:
37: private static final long serialVersionUID = 1L;
38:
39: /** Tracking joints */
40: private Map<String, TrackingJoint> trackingJoints;
41:
42: /** Frame sequence,start at 0 */
43: private int sequence;
44:
45: public int getSequence() {
46: return sequence;
47: }
48:
49: public void setSequence(int sequence) {
50: this .sequence = sequence;
51: }
52:
53: public Map<String, TrackingJoint> getTrackingJoints() {
54: if (trackingJoints == null) {
55: return Collections.emptyMap();
56: }
57: return trackingJoints;
58: }
59:
60: public void setTrackingJoints(
61: Map<String, TrackingJoint> trackingJoints) {
62: this .trackingJoints = trackingJoints;
63: }
64:
65: public void addTrackingJoint(TrackingJoint joint) {
66: if (trackingJoints == null) {
67: trackingJoints = new HashMap<String, TrackingJoint>();
68: }
69: trackingJoints.put(joint.getName(), joint);
70: }
71:
72: public void reset() {
73: if (trackingJoints == null) {
74: return;
75: }
76: for (TrackingJoint j : trackingJoints.values()) {
77: j.removeAllMarkers();
78: }
79: }
80:
81: public TrackingJoint getTrackingJoint(String name) {
82: if (trackingJoints == null) {
83: return null;
84: }
85: return trackingJoints.get(name);
86: }
87:
88: }
|