|  |  | 
 |  |  |  | 
 |  |  | // Called to ensure that drawings will or will not have randomized ids. | 
 |  |  | // The current_drawing will have its nonce set if it doesn't already. | 
 |  |  | //  | 
 |  |  | // | 
 |  |  | // Params: | 
 |  |  | // enableRandomization - flag indicating if documents should have randomized ids | 
 |  |  | svgedit.draw.randomizeIds = function(enableRandomization, current_drawing) { | 
 |  |  | 
 |  |  |    * @type {SVGSVGElement} | 
 |  |  |    */ | 
 |  |  |   this.svgElem_ = svgElem; | 
 |  |  |    | 
 |  |  |  | 
 |  |  |   /** | 
 |  |  |    * The latest object number used in this drawing. | 
 |  |  |    * @type {number} | 
 |  |  |    */ | 
 |  |  |   this.obj_num = 0; | 
 |  |  |    | 
 |  |  |  | 
 |  |  |   /** | 
 |  |  |    * The prefix to prepend to each element id in the drawing. | 
 |  |  |    * @type {String} | 
 |  |  |    */ | 
 |  |  |   this.idPrefix = opt_idPrefix || "svg_"; | 
 |  |  |    | 
 |  |  |  | 
 |  |  |   /** | 
 |  |  |    * An array of released element ids to immediately reuse. | 
 |  |  |    * @type {Array.<number>} | 
 |  |  | 
 |  |  |   var oldObjNum = this.obj_num; | 
 |  |  |   var restoreOldObjNum = false; | 
 |  |  |  | 
 |  |  |   // If there are any released numbers in the release stack,  | 
 |  |  |   // If there are any released numbers in the release stack, | 
 |  |  |   // use the last one instead of the next obj_num. | 
 |  |  |   // We need to temporarily use obj_num as that is what getId() depends on. | 
 |  |  |   if (this.releasedNums.length > 0) { | 
 |  |  | 
 |  |  |   if (typeof num != typeof 1 || num <= 0 || this.releasedNums.indexOf(num) != -1) { | 
 |  |  |     return false; | 
 |  |  |   } | 
 |  |  |    | 
 |  |  |  | 
 |  |  |   // push the released number into the released queue | 
 |  |  |   this.releasedNums.push(num); | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  | // Function: svgedit.draw.Drawing.getNumLayers | 
 |  |  | // Returns the number of layers in the current drawing. | 
 |  |  | //  | 
 |  |  | // | 
 |  |  | // Returns: | 
 |  |  | // The number of layers in the current drawing. | 
 |  |  | svgedit.draw.Drawing.prototype.getNumLayers = function() { | 
 |  |  | 
 |  |  | // | 
 |  |  | // Parameters: | 
 |  |  | // i - the zero-based index of the layer you are querying. | 
 |  |  | //  | 
 |  |  | // | 
 |  |  | // Returns: | 
 |  |  | // The name of the ith layer | 
 |  |  | svgedit.draw.Drawing.prototype.getLayerName = function(i) { | 
 |  |  | 
 |  |  | }; | 
 |  |  |  | 
 |  |  | // Function: getCurrentLayerName | 
 |  |  | // Returns the name of the currently selected layer. If an error occurs, an empty string  | 
 |  |  | // Returns the name of the currently selected layer. If an error occurs, an empty string | 
 |  |  | // is returned. | 
 |  |  | // | 
 |  |  | // Returns: | 
 |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | // Function: svgedit.draw.Drawing.deleteCurrentLayer | 
 |  |  | // Deletes the current layer from the drawing and then clears the selection. This function  | 
 |  |  | // Deletes the current layer from the drawing and then clears the selection. This function | 
 |  |  | // then calls the 'changed' handler.  This is an undoable action. | 
 |  |  | // Returns: | 
 |  |  | // The SVGGElement of the layer removed or null. | 
 |  |  | 
 |  |  |       if (child.tagName == "g") { | 
 |  |  |         childgroups = true; | 
 |  |  |         var name = $("title",child).text(); | 
 |  |  |          | 
 |  |  |  | 
 |  |  |         // Hack for Opera 10.60 | 
 |  |  |         if(!name && svgedit.browser.isOpera() && child.querySelectorAll) { | 
 |  |  |           name = $(child.querySelectorAll('title')).text(); | 
 |  |  | 
 |  |  |       } | 
 |  |  |     } | 
 |  |  |   } | 
 |  |  |    | 
 |  |  |  | 
 |  |  |   // create a new layer and add all the orphans to it | 
 |  |  |   var svgdoc = this.svgElem_.ownerDocument; | 
 |  |  |   if (orphans.length > 0 || !childgroups) { | 
 |  |  | 
 |  |  | }; | 
 |  |  |  | 
 |  |  | // Function: svgedit.draw.Drawing.createLayer | 
 |  |  | // Creates a new top-level layer in the drawing with the given name and  | 
 |  |  | // Creates a new top-level layer in the drawing with the given name and | 
 |  |  | // sets the current layer to it. | 
 |  |  | // | 
 |  |  | // Parameters: | 
 |  |  | 
 |  |  | }; | 
 |  |  |  | 
 |  |  | // Function: svgedit.draw.Drawing.setLayerVisibility | 
 |  |  | // Sets the visibility of the layer. If the layer name is not valid, this function return  | 
 |  |  | // Sets the visibility of the layer. If the layer name is not valid, this function return | 
 |  |  | // false, otherwise it returns true. This is an undo-able action. | 
 |  |  | // | 
 |  |  | // Parameters: | 
 |  |  | 
 |  |  |     } | 
 |  |  |   } | 
 |  |  |   if (!layer) return null; | 
 |  |  |    | 
 |  |  |  | 
 |  |  |   var oldDisplay = layer.getAttribute("display"); | 
 |  |  |   if (!oldDisplay) oldDisplay = "inline"; | 
 |  |  |   layer.setAttribute("display", bVisible ? "inline" : "none"); | 
 |  |  | 
 |  |  | // Function: svgedit.draw.Drawing.getLayerOpacity | 
 |  |  | // Returns the opacity of the given layer.  If the input name is not a layer, null is returned. | 
 |  |  | // | 
 |  |  | // Parameters:  | 
 |  |  | // Parameters: | 
 |  |  | // layername - name of the layer on which to get the opacity | 
 |  |  | // | 
 |  |  | // Returns: |