/* 
 * PROJECT: FLARManager
 * http://transmote.com/flar
 * Copyright 2009, Eric Socolofsky
 * --------------------------------------------------------------------------------
 * This work complements FLARToolkit, developed by Saqoosha as part of the Libspark project.
 *	http://www.libspark.org/wiki/saqoosha/FLARToolKit
 * FLARToolkit is Copyright (C)2008 Saqoosha,
 * and is ported from NYARToolkit, which is ported from ARToolkit.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this framework; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 * 
 * For further information please contact:
 *	<eric(at)transmote.com>
 *	http://transmote.com/flar
 * 
 */

package com.transmote.flar.marker {
	import org.libspark.flartoolkit.core.FLARSquare;
	import org.libspark.flartoolkit.core.transmat.FLARTransMatResult;
	
	/**
	 * container for information about a detected marker.
	 * 
	 * @author	Eric Socolofsky
	 * @url		http://transmote.com/flar
	 */
	public class FLARMarker {
		internal var _transformMatrix:FLARTransMatResult;
		internal var _patternId:int;
		internal var _direction:int;
		internal var _confidence:Number;
		internal var _outline:FLARMarkerOutline;
		
		/**
		 * constructor.
		 */
		public function FLARMarker (patternId:int, direction:int, confidence:Number, outline:FLARMarkerOutline, transformMatrix:FLARTransMatResult) {
			this._patternId = patternId;
			this._direction = direction;
			this._confidence = confidence;
			this._outline = outline;
			this._transformMatrix = transformMatrix;
		}
		
		/**
		 * copy the properties of a FLARMarker into this FLARMarker.
		 */
		public function copy (otherMarker:FLARMarker) :void {
			this._patternId = otherMarker._patternId;
			this._direction = otherMarker._direction;
			this._confidence = otherMarker._confidence;
			this._outline = otherMarker._outline;
			this._transformMatrix = otherMarker._transformMatrix;
		}
		
		/**
		 * ID of this marker's pattern.
		 * pattern IDs are zero-indexed, and are
		 * assigned to patterns in the order they were initially loaded.
		 */
		public function get patternId () :int {
			return this._patternId;
		}
		
		/**
		 * orthographic orientation of detected marker.
		 * value between 0 and 3, inclusive:
		 * 0: up
		 * 1: left
		 * 2: down
		 * 3: right
		 */
		public function get direction () :int {
			return this._direction;
		}
		
		/**
		 * 'confidence' is a value assigned by FLARToolkit to each detected marker,
		 * that describes the algorithm's perceived accuracy of the pattern match.
		 */
		public function get confidence () :Number {
			return this._confidence;
		}
		
		/**
		 * FLARMarkerOutline that describes outline of pattern of detected marker.
		 */
		public function get outline () :FLARMarkerOutline {
			return this._outline;
		}
		
		/**
		 * FLARTransMatResult matrix that describes transformation of marker relative to the camera.
		 * apply to FLARBaseNodes that should appear 'tethered' to the marker.
		 */
		public function get transformMatrix () :FLARTransMatResult {
			return this._transformMatrix;
		}
	}
}