<?xml version="1.0" encoding="UTF-8"?>
<rmml>
<!--
$RCSfile: rnmc_stdShape.xml $
$Revision: 957 $

last change: $Date: 2009-02-17 14:00:06 +0300 (Вт, 17 фев 2009) $
             $Author: toha $

	Lacerta Project
	version 1.0.0.1
	Copyright (C) 2007-2009 RNMC
-->
<!--
=====================================================================
			Визуальный объект 'Векторный примитив'
<shape>
	<param ... />
	<area 	weight="" color="">[x, y, w, h]</area>
	<area 	weight="" color="">[x, y, w, h]</area>
</shape>
=====================================================================
-->
<composition name="rnmc_stdShape" class="rnmc_stdMediaObject">
	<script><![CDATA[
		this.type = "rnmc_stdShape"

	//	для каждого объекта необходимо определить
	//	какие эффекты к нему применимы
		this.fadeEffectEnabled = true;
		this.moveEffectEnabled = true;
		this.scaleEffectEnabled = false;
/*		
 *  rectangular shape - [x, y, w, h]
 *  circular shape - (x ,y ,r )
 *  ellipse shape - (x ,y ,w ,h )
 *  polyshape - {(x,y),(x,y), ...}
 *  concatenation of shapes - shape1, shape2,
 */
		this.shapeArea   = "";
		this.shapeColor  = "#FFFFFF";
		this.shapeWeight = 2;

		function initFromNode(srcNode){
			var xmlNode = null;
			var xmlAttributeMap = null;
			var xmlAttribute = null;

			xmlAttributeMap = srcNode.attributes;
			if (xmlAttributeMap){
				xmlAttribute = xmlAttributeMap.getNamedItem("id");
				if (xmlAttribute != null && xmlAttribute.specified)
					this.id = xmlAttribute.value;
				xmlAttribute = xmlAttributeMap.getNamedItem("visible");
				if (xmlAttribute != null && xmlAttribute.specified){
					if(xmlAttribute.value == "true")
						this.visibility = OBJECT_VISIBILITY_TRUE;
					else if(xmlAttribute.value == "false")
						this.visibility = OBJECT_VISIBILITY_FALSE;
				}
				xmlAttribute = xmlAttributeMap.getNamedItem("enabled");
				if (xmlAttribute != null && xmlAttribute.specified
					&& xmlAttribute.value == "false")
					this.disabled = true;
			}

			if(scene.defaultSettings && scene.defaultSettings.stdShape){
				this.titleStyle = scene.defaultSettings.stdShape.titleStyle;
			}

			xmlNode = srcNode.firstChild;
			while(xmlNode){
				if(xmlNode.nodeName == "param"){
					this.parseParamNode(xmlNode);
				} else if(xmlNode.nodeName == "rollovermenu"){
					this.parseRolloverMenuNode(xmlNode);
				}  else if(xmlNode.nodeName == "actions"){
					this.parseActionsNode(xmlNode);
				} else if(xmlNode.nodeName == "control"){
					this.parseControlNode(xmlNode);
				} else if(xmlNode.nodeName == "title"){
					this.parseTitleNode(xmlNode);
				} else if(xmlNode.nodeName == "hint"){
					this.parseHintNode(xmlNode);
				} else if(xmlNode.nodeName == "attach"){
					this.parseAttachNode(xmlNode);
				} else if(xmlNode.nodeName == "effects"){
					this.parseEffectsNode(xmlNode);
				} else if(xmlNode.nodeName == "drag"){ //	таскание медиа-объекта
					this.parseDraggingNode(xmlNode);
				} else if(xmlNode.nodeName == "area"){
					var shapeObject = new Object();
					xmlAttributeMap = xmlNode.attributes;
					if (xmlAttributeMap)
					{
						xmlAttribute = xmlAttributeMap.getNamedItem("weight");
						if (xmlAttribute != null && xmlAttribute.specified)
							this.shapeWeight = xmlAttribute.value;
						xmlAttribute = xmlAttributeMap.getNamedItem("color");
						if (xmlAttribute != null && xmlAttribute.specified)
							this.shapeColor = xmlAttribute.value;
					}
					if(xmlNode.textContent)
						this.shapeArea = scene.Utils.trim(xmlNode.textContent);
				}

				xmlNode = xmlNode.nextSibling;
			}

			return true;
		}

	//	загрузка объекта
		function loadObject(){
			if(!this.objectContent){
				this.objectContent = new Shape();
				this.objectContent.shapeArea = this.shapeArea;
				this.objectContent.color = this.shapeColor;
				this.objectContent.weight = this.shapeWeight;
				this.objectContent.visible = false;
				if (this.objectHitArea != null)
					this.objectContent.hitArea = this.objectHitArea;
				this.objectContent.parent = this;
			}
		}

	//	 выгрузка (удаление объекта)
		function unloadObject(){
			this.effectsTarget = null;
			if(this.objectContent){
				this.objectContent.parent = null;
				this.objectContent = null;
			}
		}
		
		function showObject(){
//trace("rnmc_stdShape.showObject()");
			this.loadObject();

			if(this.objectContent){
				var objectPosition = this.getPosition();
				this.setPosition(objectPosition[0], objectPosition[1], objectPosition[2], objectPosition[3], this.objectDepth);
				this.objectContent.opacity = this.objectOpacity;
				this.objectContent.visible = false;
			};

			rnmc_stdMediaObject_showObject();
		};

		function hideObject(){
//trace("rnmc_stdShape.hideObject()");
			rnmc_stdMediaObject_hideObject();
		};
	]]></script>
</composition>
</rmml>
