"use strict"; /* Copyright [2014] [Diagramo] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** Group is ONLY a logical grouping of some figures. * It does not paint itself and it does not change the Z-Order of member figures * * @constructor * @param {Numeric} id - the id of group * @this {Group} * @author Alex, Zack Newsham zack_newsham@yahoo.co.uk */ function Group(id){ /**Group's id*/ if(id){ this.id = id; } else{ this.id = STACK.generateId(); } /**By default all groups are temporary....so it's up to you make them permanent*/ this.permanent = false; /**An {Array} of 2 {Point}s that keeps the rotation of the Group*/ this.rotationCoords = []; /**Serialization type*/ this.oType = 'Group'; } /**Creates a {Group} out of JSON parsed object *@param {JSONObject} o - the JSON parsed object *@return {Group} a newly constructed Group *@author Alex Gheorghiu **/ Group.load = function(o){ var newGroup = new Group(); //empty constructor newGroup.id = o.id; newGroup.permanent = o.permanent; newGroup.rotationCoords = Point.loadArray(o.rotationCoords); return newGroup; } /**Creates a new {Array} of {Group}s out of JSON parsed object *@param {JSONObject} v - the JSON parsed object *@return {Array} of newly constructed {Group}s *@author Alex Gheorghiu **/ Group.loadArray = function(v){ var newGroups = []; for(var i=0; i