⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shapeencoder.as

📁 用于flash/flex的 as3的 2D图形图像图表的动态生成
💻 AS
字号:
package flare.vis.operator.encoder
{
	import flare.scale.ScaleType;
	import flare.util.palette.Palette;
	import flare.util.palette.ShapePalette;
	import flare.vis.data.Data;
	
	/**
	 * Encodes a data field into shape values, using an ordinal scale.
	 * Shape values are integer indices that map into a shape palette, which
	 * provides drawing routines for shapes. See the
	 * <code>flare.palette.ShapePalette</code> and 
	 * <code>flare.data.render.ShapeRenderer</code> classes for more.
	 */
	public class ShapeEncoder extends Encoder
	{
		private var _palette:ShapePalette;
		
		/** @inheritDoc */
		public override function get palette():Palette { return _palette; }
		public override function set palette(p:Palette):void {
			_palette = p as ShapePalette;
		}
		/** The palette as a ShapePalette instance. */
		public function get shapes():ShapePalette { return _palette; }
		public function set shapes(p:ShapePalette):void { _palette = p; }
		
		// --------------------------------------------------------------------
		
		/**
		 * Creates a new ShapeEncoder.
		 * @param source the source property
		 * @param group the data group to process
		 * @param palette the shape palette for assigning shapes
		 */
		public function ShapeEncoder(field:String=null,
			group:String=Data.NODES, palette:ShapePalette=null)
		{
			super(field, "shape", group);
			_binding.scaleType = ScaleType.CATEGORIES;
			_palette = palette ? palette : ShapePalette.defaultPalette();
		}
		
		/** @inheritDoc */
		protected override function encode(val:Object):*
		{
			return _palette.getShape(_binding.index(val));
		}
		
	} // end of class ShapeEncoder
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -