From: preecej Date: Mon, 25 Mar 2013 21:25:08 +0000 (+0000) Subject: Moved the IADB project out of Balaji's Personnel folder to the X-Git-Url: http://gitweb.planteome.org/?a=commitdiff_plain;h=667570673a2362a135e5ff1067fc9fde93a14160;p=old-jaiswallab-svn%2F.git Moved the IADB project out of Balaji's Personnel folder to the jaiswallab/ projects level svn path=/; revision=442 --- diff --git a/Personnel/athreyab/image_annotation_db/html5/get_image.php b/Personnel/athreyab/image_annotation_db/html5/get_image.php deleted file mode 100755 index f483d1e..0000000 --- a/Personnel/athreyab/image_annotation_db/html5/get_image.php +++ /dev/null @@ -1,33 +0,0 @@ -query($segment_query) or die($mysqli->error.__LINE__); -if($segment_result->num_rows > 0) { - $segment = $segment_result->fetch_assoc(); -} - -*/ -$image_query = "SELECT * FROM Annotated_image where annotated_image_id = 1"; -$image_result = $mysqli->query($image_query) or die($mysqli->error.__LINE__); -if($image_result->num_rows > 0) { - $image = $image_result->fetch_assoc(); -} - -//echo ''; -//echo ''; - -//print_r($image); -header('Content-type: '.$image['annotated_image_type']); -setcookie("imgh",$image['annotated_image_height'] ); -setcookie("imgw",$image['annotated_image_width'] ); - -echo $image['annotated_image']; -?> diff --git a/Personnel/athreyab/image_annotation_db/html5/image.png b/Personnel/athreyab/image_annotation_db/html5/image.png deleted file mode 100755 index 234ce51..0000000 Binary files a/Personnel/athreyab/image_annotation_db/html5/image.png and /dev/null differ diff --git a/Personnel/athreyab/image_annotation_db/html5/image_annotation.php b/Personnel/athreyab/image_annotation_db/html5/image_annotation.php deleted file mode 100755 index 28caefe..0000000 --- a/Personnel/athreyab/image_annotation_db/html5/image_annotation.php +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - hi - -hi -query($segment_query) or die($mysqli->error.__LINE__); -if($segment_result->num_rows > 0) { - while($s = $segment_result->fetch_array()){ - $segment = array(); - $segment['id'] = $s['segment_id']; - $segment['color'] = $s['color']; - $coordinates = array(); - - $offset = 9; - $pts = unpack("@$offset/d*", $s[2]); - $geom = array(); - $pair = false; - $count = 0; - $i = 1; - while($i < count($pts)){ - $geom[0] = $pts[$i]; - $i = $i + 1; - $geom[1] = $pts[$i]; - $i = $i + 1; - $coordinates[$count] = $geom; - $count = $count + 1; - } - $segment['coordinates'] = $coordinates; - $segments[$segment["id"]] = $segment; - } -} -?> - - - diff --git a/Personnel/athreyab/image_annotation_db/html5/image_annotation1.php b/Personnel/athreyab/image_annotation_db/html5/image_annotation1.php deleted file mode 100755 index dcc903a..0000000 --- a/Personnel/athreyab/image_annotation_db/html5/image_annotation1.php +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - -
- -query($segment_query) or die($mysqli->error.__LINE__); -if($segment_result->num_rows > 0) { - while($s = $segment_result->fetch_array()){ - $segment = array(); - $segment['id'] = $s['segment_id']; - $segment['color'] = $s['color']; - $coordinates = array(); - - $offset = 9; - $pts = unpack("@$offset/d*", $s[2]); - $geom = array(); - $pair = false; - $count = 0; - $i = 1; - while($i < count($pts)){ - $geom[0] = $pts[$i]; - $i = $i + 1; - $geom[1] = $pts[$i]; - $i = $i + 1; - $coordinates[$count] = $geom; - $count = $count + 1; - } - $segment['coordinates'] = $coordinates; - $segments[$segment["id"]] = $segment; - } -} -?> - - - diff --git a/Personnel/athreyab/image_annotation_db/html5/image_annotation2.php b/Personnel/athreyab/image_annotation_db/html5/image_annotation2.php deleted file mode 100755 index 56a2fd9..0000000 --- a/Personnel/athreyab/image_annotation_db/html5/image_annotation2.php +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - -
- -query($segment_query) or die($mysqli->error.__LINE__); -if($segment_result->num_rows > 0) { - while($s = $segment_result->fetch_array()){ - $segment = array(); - $segment['id'] = $s['segment_id']; - $segment['color'] = $s['color']; - $coordinates = array(); - - $offset = 9; - $pts = unpack("@$offset/d*", $s[2]); - $geom = array(); - $pair = false; - $count = 0; - $i = 1; - while($i < count($pts)){ - $geom[0] = $pts[$i]; - $i = $i + 1; - $geom[1] = $pts[$i]; - $i = $i + 1; - $coordinates[$count] = $geom; - $count = $count + 1; - } - $segment['coordinates'] = $coordinates; - $segments[$segment["id"]] = $segment; - } -} -?> - - - diff --git a/Personnel/athreyab/image_annotation_db/html5/image_annotation3.php b/Personnel/athreyab/image_annotation_db/html5/image_annotation3.php deleted file mode 100755 index dc4b719..0000000 --- a/Personnel/athreyab/image_annotation_db/html5/image_annotation3.php +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - -query($segment_query) or die($mysqli->error.__LINE__); - if($segment_result->num_rows > 0) { - while($s = $segment_result->fetch_array()){ - $segment = array(); - $segment['id'] = $s['segment_id']; - $segment['color'] = $s['color']; - $coordinates = array(); - - $offset = 9; - $pts = unpack("@$offset/d*", $s[2]); - $geom = array(); - $pair = false; - $count = 0; - $i = 1; - while($i < count($pts)){ - $geom[0] = $pts[$i]; - $i = $i + 1; - $geom[1] = $pts[$i]; - $i = $i + 1; - $coordinates[$count] = $geom; - $count = $count + 1; - } - $segment['coordinates'] = $coordinates; - $segments[$segment["id"]] = $segment; - } - } -?> - - - - - -
- - - diff --git a/Personnel/athreyab/image_annotation_db/html5/image_annotation4.php b/Personnel/athreyab/image_annotation_db/html5/image_annotation4.php deleted file mode 100755 index 6a52334..0000000 --- a/Personnel/athreyab/image_annotation_db/html5/image_annotation4.php +++ /dev/null @@ -1,176 +0,0 @@ - - - - - - - - -
- -query($segment_query) or die($mysqli->error.__LINE__); -if($segment_result->num_rows > 0) { - while($s = $segment_result->fetch_array()){ - $segment = array(); - $segment['id'] = $s['segment_id']; - $segment['color'] = $s['color']; - $coordinates = array(); - - $offset = 9; - $pts = unpack("@$offset/d*", $s[2]); - $geom = array(); - $pair = false; - $count = 0; - $i = 1; - while($i < count($pts)){ - $geom[0] = $pts[$i]; - $i = $i + 1; - $geom[1] = $pts[$i]; - $i = $i + 1; - $coordinates[$count] = $geom; - $count = $count + 1; - } - $segment['coordinates'] = $coordinates; - $segments[$segment["id"]] = $segment; - } -} -?> - - - diff --git a/Personnel/athreyab/image_annotation_db/html5/jquery.cookie.js b/Personnel/athreyab/image_annotation_db/html5/jquery.cookie.js deleted file mode 100755 index 8038e22..0000000 --- a/Personnel/athreyab/image_annotation_db/html5/jquery.cookie.js +++ /dev/null @@ -1,73 +0,0 @@ -/*! - * jQuery Cookie Plugin v1.3 - * https://github.com/carhartl/jquery-cookie - * - * Copyright 2011, Klaus Hartl - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://www.opensource.org/licenses/mit-license.php - * http://www.opensource.org/licenses/GPL-2.0 - */ -(function ($, document, undefined) { - - var pluses = /\+/g; - - function raw(s) { - return s; - } - - function decoded(s) { - return decodeURIComponent(s.replace(pluses, ' ')); - } - - var config = $.cookie = function (key, value, options) { - - // write - if (value !== undefined) { - options = $.extend({}, config.defaults, options); - - if (value === null) { - options.expires = -1; - } - - if (typeof options.expires === 'number') { - var days = options.expires, t = options.expires = new Date(); - t.setDate(t.getDate() + days); - } - - value = config.json ? JSON.stringify(value) : String(value); - - return (document.cookie = [ - encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value), - options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE - options.path ? '; path=' + options.path : '', - options.domain ? '; domain=' + options.domain : '', - options.secure ? '; secure' : '' - ].join('')); - } - - // read - var decode = config.raw ? raw : decoded; - var cookies = document.cookie.split('; '); - for (var i = 0, l = cookies.length; i < l; i++) { - var parts = cookies[i].split('='); - if (decode(parts.shift()) === key) { - var cookie = decode(parts.join('=')); - return config.json ? JSON.parse(cookie) : cookie; - } - } - - return null; - }; - - config.defaults = {}; - - $.removeCookie = function (key, options) { - if ($.cookie(key) !== null) { - $.cookie(key, null, options); - return true; - } - return false; - }; - -})(jQuery, document); - diff --git a/Personnel/athreyab/image_annotation_db/html5/kinetic-v4.0.4.min.js b/Personnel/athreyab/image_annotation_db/html5/kinetic-v4.0.4.min.js deleted file mode 100644 index ef3384b..0000000 --- a/Personnel/athreyab/image_annotation_db/html5/kinetic-v4.0.4.min.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * KineticJS JavaScript Library v4.0.4 - * http://www.kineticjs.com/ - * Copyright 2012, Eric Rowell - * Licensed under the MIT or GPL Version 2 licenses. - * Date: Oct 19 2012 - * - * Copyright (C) 2011 - 2012 by Eric Rowell - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -var Kinetic={};Kinetic.Filters={},Kinetic.Plugins={},Kinetic.Global={BUBBLE_WHITELIST:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseenter","mouseleave","click","dblclick","touchstart","touchmove","touchend","tap","dbltap","dragstart","dragmove","dragend"],BUFFER_WHITELIST:["fill","stroke","textFill","textStroke"],BUFFER_BLACKLIST:["shadow"],stages:[],idCounter:0,tempNodes:{},shapes:{},warn:function(a){console&&console.warn&&console.warn("Kinetic warning: "+a)},extend:function(a,b){for(var c in b.prototype)c in a.prototype||(a.prototype[c]=b.prototype[c])},_pullNodes:function(a){var b=this.tempNodes;for(var c in b){var d=b[c];d.getStage()!==undefined&&d.getStage()._id===a._id&&(a._addId(d),a._addName(d),this._removeTempNode(d))}},_addTempNode:function(a){this.tempNodes[a._id]=a},_removeTempNode:function(a){delete this.tempNodes[a._id]}},Kinetic.Filters.Grayscale=function(a){var b=a.data;for(var c=0;c0},_getXY:function(a){if(this._isNumber(a))return{x:a,y:a};if(this._isArray(a)){if(a.length===1){var b=a[0];if(this._isNumber(b))return{x:b,y:b};if(this._isArray(b))return{x:b[0],y:b[1]};if(this._isObject(b))return b}else if(a.length>=2)return{x:a[0],y:a[1]}}else if(this._isObject(a))return a;return{x:0,y:0}},_getSize:function(a){if(this._isNumber(a))return{width:a,height:a};if(this._isArray(a))if(a.length===1){var b=a[0];if(this._isNumber(b))return{width:b,height:b};if(this._isArray(b)){if(b.length>=4)return{width:b[2],height:b[3]};if(b.length>=2)return{width:b[0],height:b[1]}}else if(this._isObject(b))return b}else{if(a.length>=4)return{width:a[2],height:a[3]};if(a.length>=2)return{width:a[0],height:a[1]}}else if(this._isObject(a))return a;return{width:0,height:0}},_getPoints:function(a){if(a===undefined)return[];if(this._isObject(a[0]))return a;var b=[];for(var c=0;c>16&255,g:b>>8&255,b:b&255}},_getRandomColorKey:function(){var a=Math.round(Math.random()*255),b=Math.round(Math.random()*255),c=Math.round(Math.random()*255);return this._rgbToHex(a,b,c)},_merge:function(a,b){var c=this._clone(b);for(var d in a)this._isObject(a[d])?c[d]=this._merge(a[d],c[d]):c[d]=a[d];return c},_clone:function(a){var b={};for(var c in a)this._isObject(a[c])?b[c]=this._clone(a[c]):b[c]=a[c];return b}},Kinetic.Canvas=function(a,b){this.element=document.createElement("canvas"),this.context=this.element.getContext("2d"),this.element.width=a,this.element.height=b},Kinetic.Canvas.prototype={clear:function(){var a=this.getContext(),b=this.getElement();a.clearRect(0,0,b.width,b.height)},getElement:function(){return this.element},getContext:function(){return this.context},setWidth:function(a){this.element.width=a},setHeight:function(a){this.element.height=a},getWidth:function(){return this.element.width},getHeight:function(){return this.element.height},setSize:function(a,b){this.setWidth(a),this.setHeight(b)},toDataURL:function(a,b){try{return this.element.toDataURL(a,b)}catch(c){return this.element.toDataURL()}}},Kinetic.Tween=function(a,b,c,d,e,f){this._listeners=[],this.addListener(this),this.obj=a,this.propFunc=b,this.begin=d,this._pos=d,this.setDuration(f),this.isPlaying=!1,this._change=0,this.prevTime=0,this.prevPos=0,this.looping=!1,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.name="",this.func=c,this.setFinish(e)},Kinetic.Tween.prototype={setTime:function(a){this.prevTime=this._time,a>this.getDuration()?this.looping?(this.rewind(a-this._duration),this.update(),this.broadcastMessage("onLooped",{target:this,type:"onLooped"})):(this._time=this._duration,this.update(),this.stop(),this.broadcastMessage("onFinished",{target:this,type:"onFinished"})):a<0?(this.rewind(),this.update()):(this._time=a,this.update())},getTime:function(){return this._time},setDuration:function(a){this._duration=a===null||a<=0?1e5:a},getDuration:function(){return this._duration},setPosition:function(a){this.prevPos=this._pos,this.propFunc(a),this._pos=a,this.broadcastMessage("onChanged",{target:this,type:"onChanged"})},getPosition:function(a){return a===undefined&&(a=this._time),this.func(a,this.begin,this._change,this._duration)},setFinish:function(a){this._change=a-this.begin},getFinish:function(){return this.begin+this._change},start:function(){this.rewind(),this.startEnterFrame(),this.broadcastMessage("onStarted",{target:this,type:"onStarted"})},rewind:function(a){this.stop(),this._time=a===undefined?0:a,this.fixTime(),this.update()},fforward:function(){this._time=this._duration,this.fixTime(),this.update()},update:function(){this.setPosition(this.getPosition(this._time))},startEnterFrame:function(){this.stopEnterFrame(),this.isPlaying=!0,this.onEnterFrame()},onEnterFrame:function(){this.isPlaying&&this.nextFrame()},nextFrame:function(){this.setTime((this.getTimer()-this._startTime)/1e3)},stop:function(){this.stopEnterFrame(),this.broadcastMessage("onStopped",{target:this,type:"onStopped"})},stopEnterFrame:function(){this.isPlaying=!1},continueTo:function(a,b){this.begin=this._pos,this.setFinish(a),this._duration!==undefined&&this.setDuration(b),this.start()},resume:function(){this.fixTime(),this.startEnterFrame(),this.broadcastMessage("onResumed",{target:this,type:"onResumed"})},yoyo:function(){this.continueTo(this.begin,this._time)},addListener:function(a){return this.removeListener(a),this._listeners.push(a)},removeListener:function(a){var b=this._listeners,c=b.length;while(c--)if(b[c]==a)return b.splice(c,1),!0;return!1},broadcastMessage:function(){var a=[];for(var b=0;b0){this._runFrames();var a=this;requestAnimFrame(function(){a._animationLoop()})}else this.animRunning=!1},Kinetic.Animation._handleAnimation=function(){var a=this;this.animRunning||(this.animRunning=!0,a._animationLoop())},requestAnimFrame=function(a){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,1e3/60)}}(),Kinetic.Node=function(a){this._nodeInit(a)},Kinetic.Node.prototype={_nodeInit:function(a){this.defaultNodeAttrs={visible:!0,listening:!0,name:undefined,opacity:1,x:0,y:0,scale:{x:1,y:1},rotation:0,offset:{x:0,y:0},draggable:!1},this.setDefaultAttrs(this.defaultNodeAttrs),this.eventListeners={},this.setAttrs(a);var b=this;this.on("idChange.kinetic",function(a){var c=b.getStage();c&&(c._removeId(a.oldVal),c._addId(b))}),this.on("nameChange.kinetic",function(a){var c=b.getStage();c&&(c._removeName(a.oldVal,b._id),c._addName(b))})},on:function(a,b){var c=a.split(" ");for(var d=0;d1?g[1]:"";this.eventListeners[h]||(this.eventListeners[h]=[]),this.eventListeners[h].push({name:i,handler:b})}},off:function(a){var b=a.split(" ");for(var c=0;c1)if(g)this.eventListeners[g]&&this._off(g,f[1]);else for(var d in this.eventListeners)this._off(d,f[1]);else delete this.eventListeners[g]}},remove:function(){var a=this.getParent();if(a&&this.index!==undefined&&a.children[this.index]._id==this._id){var b=a.getStage();b&&(b._removeId(this.getId()),b._removeName(this.getName(),this._id)),Kinetic.Global._removeTempNode(this),a.children.splice(this.index,1),a._setChildrenIndices();while(this.children&&this.children.length>0)this.children[0].remove()}},getAttrs:function(){return this.attrs},setDefaultAttrs:function(a){this.attrs===undefined&&(this.attrs={});if(a)for(var b in a)this.attrs[b]===undefined&&(this.attrs[b]=a[b])},setAttrs:function(a){if(a)for(var b in a){var c="set"+b.charAt(0).toUpperCase()+b.slice(1);Kinetic.Type._isFunction(this[c])?this[c](a[b]):this.setAttr(b,a[b])}},isVisible:function(){return this.attrs.visible&&this.getParent()&&!this.getParent().isVisible()?!1:this.attrs.visible},show:function(){this.setVisible(!0)},hide:function(){this.setVisible(!1)},getZIndex:function(){return this.index},getAbsoluteZIndex:function(){function e(b){var f=[];for(var g=0;g0&&f[0].getLevel()<=a&&e(f)}var a=this.getLevel(),b=this.getStage(),c=this,d=0;return c.nodeType!=="Stage"&&e(c.getStage().getChildren()),d},getLevel:function(){var a=0,b=this.parent;while(b)a++,b=b.parent;return a},setPosition:function(){var a=Kinetic.Type._getXY([].slice.call(arguments));this.setAttr("x",a.x),this.setAttr("y",a.y)},getPosition:function(){return{x:this.attrs.x,y:this.attrs.y}},getAbsolutePosition:function(){var a=this.getAbsoluteTransform(),b=this.getOffset();return a.translate(b.x,b.y),a.getTranslation()},setAbsolutePosition:function(){var a=Kinetic.Type._getXY([].slice.call(arguments)),b=this._clearTransform();this.attrs.x=b.x,this.attrs.y=b.y,delete b.x,delete b.y;var c=this.getAbsoluteTransform();c.invert(),c.translate(a.x,a.y),a={x:this.attrs.x+c.getTranslation().x,y:this.attrs.y+c.getTranslation().y},this.setPosition(a.x,a.y),this._setTransform(b)},move:function(){var a=Kinetic.Type._getXY([].slice.call(arguments)),b=this.getX(),c=this.getY();a.x!==undefined&&(b+=a.x),a.y!==undefined&&(c+=a.y),this.setPosition(b,c)},getRotationDeg:function(){return this.getRotation()*180/Math.PI},setRotationDeg:function(a){this.setRotation(a*Math.PI/180)},rotate:function(a){this.setRotation(this.getRotation()+a)},rotateDeg:function(a){this.setRotation(this.getRotation()+a*Math.PI/180)},moveToTop:function(){var a=this.index;return this.parent.children.splice(a,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0},moveUp:function(){var a=this.index;if(a0)return this.parent.children.splice(a,1),this.parent.children.splice(a-1,0,this),this.parent._setChildrenIndices(),!0},moveToBottom:function(){var a=this.index;if(a>0)return this.parent.children.splice(a,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0},setZIndex:function(a){var b=this.index;this.parent.children.splice(b,1),this.parent.children.splice(a,0,this),this.parent._setChildrenIndices()},getAbsoluteOpacity:function(){var a=this.getOpacity();return this.getParent()&&(a*=this.getParent().getAbsoluteOpacity()),a},moveTo:function(a){var b=this.parent;b.children.splice(this.index,1),b._setChildrenIndices(),a.children.push(this),this.index=a.children.length-1,this.parent=a,a._setChildrenIndices()},toObject:function(){var a={},b=Kinetic.Type;a.attrs={};for(var c in this.attrs){var d=this.attrs[c];!b._isFunction(d)&&!b._isElement(d)&&(!b._isObject(d)||!b._hasMethods(d))&&(a.attrs[c]=d)}return a.nodeType=this.nodeType,a.shapeType=this.shapeType,a},toJSON:function(){return JSON.stringify(this.toObject())},getParent:function(){return this.parent},getLayer:function(){return this.getParent().getLayer()},getStage:function(){return this.getParent()?this.getParent().getStage():undefined},simulate:function(a){this._handleEvent(a,{})},getAbsoluteTransform:function(){var a=new Kinetic.Transform,b=[],c=this.parent;b.unshift(this);while(c)b.unshift(c),c=c.parent;for(var d=0;d=0&&!b.cancelBubble&&this.parent&&(c&&c.parent?this._handleEvent.call(this.parent,a,b,c.parent):this._handleEvent.call(this.parent,a,b))}},_shouldDraw:function(a){return this.isVisible()&&(!a||a.name!=="buffer"||this.getListening())}},Kinetic.Node.addSetters=function(constructor,a){for(var b=0;b=c.tweens.length&&c.onFinished()}}},Kinetic.Transition.prototype={start:function(){for(var a=0;a0)this.children[0].remove()},add:function(a){a._id=Kinetic.Global.idCounter++,a.index=this.children.length,a.parent=this,this.children.push(a);var b=a.getStage();if(!b)Kinetic.Global._addTempNode(a);else{b._addId(a),b._addName(a);var c=Kinetic.Global;c._pullNodes(b)}return this},get:function(a){var b=new Kinetic.Collection;if(a.charAt(0)==="#"){var c=this._getNodeById(a.slice(1));c&&b.push(c)}else if(a.charAt(0)==="."){var d=this._getNodesByName(a.slice(1));Kinetic.Collection.apply(b,d)}else{var e=[],f=this.getChildren();for(var g=0;g=0;d--){var e=c[d];if(e.isVisible()&&e.isListening()){var f=e.bufferCanvas.context.getImageData(Math.round(a.x),Math.round(a.y),1,1).data;if(f[3]===255){var g=Kinetic.Type._rgbToHex(f[0],f[1],f[2]);return b=Kinetic.Global.shapes[g],{shape:b,pixel:f}}if(f[0]>0||f[1]>0||f[2]>0||f[3]>0)return{pixel:f}}}return null},_getNodeById:function(a){return this.ids[a]||null},_getNodesByName:function(a){return this.names[a]||[]},_resizeDOM:function(){if(this.content){var a=this.attrs.width,b=this.attrs.height;this.content.style.width=a+"px",this.content.style.height=b+"px",this.bufferCanvas.setSize(a,b);var c=this.children;for(var d=0;d0},remove:function(){Kinetic.Node.prototype.remove.call(this),delete Kinetic.Global.shapes[this.colorKey]},draw:function(a){if(this.attrs.drawFunc&&Kinetic.Node.prototype._shouldDraw.call(this,a)){var b=this.getStage(),c=a.getContext(),d=[],e=this.parent;d.unshift(this);while(e)d.unshift(e),e=e.parent;c.save();for(var f=0;f0&&d&&(this.attrs.height==="auto"||e*(c+1)this.attrs.width-this.attrs.padding*2){if(f==0)break;var i=h.lastIndexOf(" "),j=h.lastIndexOf("-"),k=Math.max(i,j);if(k>=0){g=a.splice(0,1+k).join("");break}g=a.splice(0,f).join("");break}f++,f===a.length&&(g=a.splice(0,f).join(""))}this.textWidth=Math.max(this.textWidth,this._getTextSize(g).width),g!==undefined&&(b.push(g),d=!0),c++}this.textArr=b}},Kinetic.Global.extend(Kinetic.Text,Kinetic.Shape),Kinetic.Node.addGettersSetters(Kinetic.Text,["fontFamily","fontSize","fontStyle","textFill","textStroke","textStrokeWidth","padding","align","lineHeight"]),Kinetic.Node.addGetters(Kinetic.Text,["text"]),Kinetic.Line=function(a){this._initLine(a)},Kinetic.Line.prototype={_initLine:function(a){this.setDefaultAttrs({points:[],lineCap:"butt",dashArray:[],detectionType:"pixel"}),this.shapeType="Line",a.drawFunc=this.drawFunc,Kinetic.Shape.call(this,a)},drawFunc:function(a){var b={};a.beginPath(),a.moveTo(this.attrs.points[0].x,this.attrs.points[0].y);for(var c=1;c0){var f=this.attrs.points[c-1].x,g=this.attrs.points[c-1].y;this._dashedLine(a,f,g,d,e,this.attrs.dashArray)}else a.lineTo(d,e)}this.stroke(a)},setPoints:function(a){this.setAttr("points",Kinetic.Type._getPoints(a))},_dashedLine:function(a,b,c,d,e,f){var g=f.length,h=d-b,i=e-c,j=h>i,k=j?i/h:h/i;k>9999?k=9999:k<-9999&&(k=-9999);var l=Math.sqrt(h*h+i*i),m=0,n=!0;while(l>=.1&&m<1e4){var o=f[m++%g];o===0&&(o=.001),o>l&&(o=l);var p=Math.sqrt(o*o/(1+k*k));j?(b+=h<0&&i<0?p*-1:p,c+=h<0&&i<0?k*p*-1:k*p):(b+=h<0&&i<0?k*p*-1:k*p,c+=h<0&&i<0?p*-1:p),a[n?"lineTo":"moveTo"](b,c),l-=o,n=!n}a.moveTo(d,e)}},Kinetic.Global.extend(Kinetic.Line,Kinetic.Shape),Kinetic.Node.addGettersSetters(Kinetic.Line,["dashArray"]),Kinetic.Node.addGetters(Kinetic.Line,["points"]),Kinetic.Sprite=function(a){this._initSprite(a)},Kinetic.Sprite.prototype={_initSprite:function(a){this.setDefaultAttrs({index:0,frameRate:17}),a.drawFunc=this.drawFunc,Kinetic.Shape.call(this,a),this.anim=new Kinetic.Animation;var b=this;this.on("animationChange.kinetic",function(){b.setIndex(0)})},drawFunc:function(a){var b=this.attrs.animation,c=this.attrs.index,d=this.attrs.animations[b][c];a.beginPath(),a.rect(0,0,d.width,d.height),a.closePath(),this.fill(a),this.stroke(a),this.attrs.image&&(a.beginPath(),a.rect(0,0,d.width,d.height),a.closePath(),this.drawImage(a,this.attrs.image,d.x,d.y,d.width,d.height,0,0,d.width,d.height))},start:function(){var a=this,b=this.getLayer();this.anim.node=b,this.interval=setInterval(function(){var b=a.attrs.index;a._updateIndex(),a.afterFrameFunc&&b===a.afterFrameIndex&&(a.afterFrameFunc(),delete a.afterFrameFunc,delete a.afterFrameIndex)},1e3/this.attrs.frameRate),this.anim.start()},stop:function(){this.anim.stop(),clearInterval(this.interval)},afterFrame:function(a,b){this.afterFrameIndex=a,this.afterFrameFunc=b},_updateIndex:function(){var a=this.attrs.index,b=this.attrs.animation;ai?h:i,o=h>i?1:h/i,p=h>i?i/h:1;a.translate(f,g),a.rotate(l),a.scale(o,p),a.arc(0,0,n,j,j+k,1-m),a.scale(1/o,1/p),a.rotate(-l),a.translate(-f,-g);break;case"z":a.closePath()}}this.fill(a),this.stroke(a)}},Kinetic.Global.extend(Kinetic.Path,Kinetic.Shape),Kinetic.Path.getLineLength=function(a,b,c,d){return Math.sqrt((c-a)*(c-a)+(d-b)*(d-b))},Kinetic.Path.getPointOnLine=function(a,b,c,d,e,f,g){f===undefined&&(f=b),g===undefined&&(g=c);var h=(e-c)/(d-b+1e-8),i=Math.sqrt(a*a/(1+h*h));d0&&k[0]===""&&k.shift();for(var l=0;l0){if(isNaN(k[0]))break;var m=null,n=[],o=g,p=h;switch(j){case"l":g+=k.shift(),h+=k.shift(),m="L",n.push(g,h);break;case"L":g=k.shift(),h=k.shift(),n.push(g,h);break;case"m":g+=k.shift(),h+=k.shift(),m="M",n.push(g,h),j="l";break;case"M":g=k.shift(),h=k.shift(),m="M",n.push(g,h),j="L";break;case"h":g+=k.shift(),m="L",n.push(g,h);break;case"H":g=k.shift(),m="L",n.push(g,h);break;case"v":h+=k.shift(),m="L",n.push(g,h);break;case"V":h=k.shift(),m="L",n.push(g,h);break;case"C":n.push(k.shift(),k.shift(),k.shift(),k.shift()),g=k.shift(),h=k.shift(),n.push(g,h);break;case"c":n.push(g+k.shift(),h+k.shift(),g+k.shift(),h+k.shift()),g+=k.shift(),h+=k.shift(),m="C",n.push(g,h);break;case"S":var q=g,r=h,s=f[f.length-1];s.command==="C"&&(q=g+(g-s.points[2]),r=h+(h-s.points[3])),n.push(q,r,k.shift(),k.shift()),g=k.shift(),h=k.shift(),m="C",n.push(g,h);break;case"s":var q=g,r=h,s=f[f.length-1];s.command==="C"&&(q=g+(g-s.points[2]),r=h+(h-s.points[3])),n.push(q,r,g+k.shift(),h+k.shift()),g+=k.shift(),h+=k.shift(),m="C",n.push(g,h);break;case"Q":n.push(k.shift(),k.shift()),g=k.shift(),h=k.shift(),n.push(g,h);break;case"q":n.push(g+k.shift(),h+k.shift()),g+=k.shift(),h+=k.shift(),m="Q",n.push(g,h);break;case"T":var q=g,r=h,s=f[f.length-1];s.command==="Q"&&(q=g+(g-s.points[0]),r=h+(h-s.points[1])),g=k.shift(),h=k.shift(),m="Q",n.push(q,r,g,h);break;case"t":var q=g,r=h,s=f[f.length-1];s.command==="Q"&&(q=g+(g-s.points[0]),r=h+(h-s.points[1])),g+=k.shift(),h+=k.shift(),m="Q",n.push(q,r,g,h);break;case"A":var t=k.shift(),u=k.shift(),v=k.shift(),w=k.shift(),x=k.shift(),y=g,z=h;g=k.shift(),h=k.shift(),m="A",n=this.convertEndpointToCenterParameterization(y,z,g,h,w,x,t,u,v);break;case"a":var t=k.shift(),u=k.shift(),v=k.shift(),w=k.shift(),x=k.shift(),y=g,z=h;g+=k.shift(),h+=k.shift(),m="A",n=this.convertEndpointToCenterParameterization(y,z,g,h,w,x,t,u,v)}f.push({command:m||j,points:n,start:{x:o,y:p},pathLength:this.calcLength(o,p,m||j,n)})}(j==="z"||j==="Z")&&f.push({command:"z",points:[],start:undefined,pathLength:0})}return f},Kinetic.Path.calcLength=function(a,b,c,d){var e,f,g,h=Kinetic.Path;switch(c){case"L":return h.getLineLength(a,b,d[0],d[1]);case"C":e=0,f=h.getPointOnCubicBezier(0,a,b,d[0],d[1],d[2],d[3],d[4],d[5]);for(t=.01;t<=1;t+=.01)g=h.getPointOnCubicBezier(t,a,b,d[0],d[1],d[2],d[3],d[4],d[5]),e+=h.getLineLength(f.x,f.y,g.x,g.y),f=g;return e;case"Q":e=0,f=h.getPointOnQuadraticBezier(0,a,b,d[0],d[1],d[2],d[3]);for(t=.01;t<=1;t+=.01)g=h.getPointOnQuadraticBezier(t,a,b,d[0],d[1],d[2],d[3]),e+=h.getLineLength(f.x,f.y,g.x,g.y),f=g;return e;case"A":e=0;var i=d[4],j=d[5],k=d[4]+j,l=Math.PI/180;Math.abs(i-k)k;t-=l)g=h.getPointOnEllipticalArc(d[0],d[1],d[2],d[3],t,0),e+=h.getLineLength(f.x,f.y,g.x,g.y),f=g;else for(t=i+l;t1&&(g*=Math.sqrt(m),h*=Math.sqrt(m));var n=Math.sqrt((g*g*h*h-g*g*l*l-h*h*k*k)/(g*g*l*l+h*h*k*k));e==f&&(n*=-1),isNaN(n)&&(n=0);var o=n*g*l/h,p=n*-h*k/g,q=(a+c)/2+Math.cos(j)*o-Math.sin(j)*p,r=(b+d)/2+Math.sin(j)*o+Math.cos(j)*p,s=function(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1])},t=function(a,b){return(a[0]*b[0]+a[1]*b[1])/(s(a)*s(b))},u=function(a,b){return(a[0]*b[1]=1&&(y=0),f===0&&y>0&&(y-=2*Math.PI),f==1&&y<0&&(y+=2*Math.PI),[q,r,g,h,v,y,j,f]},Kinetic.Node.addGettersSetters(Kinetic.Path,["data"]),Kinetic.TextPath=function(a){this._initTextPath(a)},Kinetic.TextPath.prototype={_initTextPath:function(a){this.setDefaultAttrs({fontFamily:"Calibri",fontSize:12,fontStyle:"normal",detectionType:"path",text:""}),this.dummyCanvas=document.createElement("canvas"),this.shapeType="TextPath" -,this.dataArray=[];var b=this;a.drawFunc=this.drawFunc,Kinetic.Shape.call(this,a),this.dataArray=Kinetic.Path.parsePathData(this.attrs.data),this.on("dataChange",function(){b.dataArray=Kinetic.Path.parsePathData(this.attrs.data)});var c=["text","textStroke","textStrokeWidth"];for(var d=0;d0)return g=c,b[c];b[c].command=="M"&&(d={x:b[c].points[0],y:b[c].points[1]})}return{}},j=function(b,c){var g=a._getTextSize(b).width,j=0,k=0,l=!1;e=undefined;while(Math.abs(g-j)/g>.01&&k<25){k++;var m=j;while(f===undefined)f=i(),f&&m+f.pathLengthg?e=Kinetic.Path.getPointOnLine(g,d.x,d.y,f.points[0],f.points[1],d.x,d.y):f=undefined;break;case"A":var o=f.points[4],p=f.points[5],q=f.points[4]+p;h===0?h=o+1e-8:g>j?h+=Math.PI/180*p/Math.abs(p):h-=Math.PI/360*p/Math.abs(p),Math.abs(h)>Math.abs(q)&&(h=q,n=!0),e=Kinetic.Path.getPointOnEllipticalArc(f.points[0],f.points[1],f.points[2],f.points[3],h,f.points[6]);break;case"C":h===0?g>f.pathLength?h=1e-8:h=g/f.pathLength:g>j?h+=(g-j)/f.pathLength:h-=(j-g)/f.pathLength,h>1&&(h=1,n=!0),e=Kinetic.Path.getPointOnCubicBezier(h,f.start.x,f.start.y,f.points[0],f.points[1],f.points[2],f.points[3],f.points[4],f.points[5]);break;case"Q":h===0?h=g/f.pathLength:g>j?h+=(g-j)/f.pathLength:h-=(j-g)/f.pathLength,h>1&&(h=1,n=!0),e=Kinetic.Path.getPointOnQuadraticBezier(h,f.start.x,f.start.y,f.points[0],f.points[1],f.points[2],f.points[3])}e!==undefined&&(j=Kinetic.Path.getLineLength(d.x,d.y,e.x,e.y)),n&&(n=!1,f=undefined)}};for(var k=0;k 0 && $row[0] == '')) - return -1; - return $row[0]; - } - - function get_image_source_version_id($image_source_id,$source_version){ - $query = "select image_source_version_id from image_source_version where image_source_id='$image_source_id' and source_version='$source_version'"; - $row = getRowFromDB($query,"image source version id"); - if(count($row) == 0 || (count($row) > 0 && $row[0] == '')) - return -1; - return $row[0]; - } - - function save_image_source_version_information($image_source_id,$contact){ - $source_version = $contact['source_version']; - $publication_id = $contact['publication_id']; - $contribution_date = $contact['contribution_date']; - $mysqldate = date( 'Y-m-d H:i:s', $contribution_date ); - $contribution_date = strtotime( $mysqldate ); - - $id_from_db = get_image_source_version_id($image_source_id,$source_version); - if($id_from_db == -1){ - $query = "INSERT INTO image_source_version(image_source_id,source_version,contribution_date,publication_id) VALUES('$image_source_id','$source_version','$contribution_date','$publication_id')"; - $rsrcResult = mysql_query($query); - if (!$rsrcResult) { - echo "DB Error while trying to add new image source version information\n"; - echo 'MySQL Error: ' . mysql_error(); - exit(); - } - $id_from_db = get_image_source_version_id($image_source_id,$source_version); - } - return $id_from_db; - } - - $file = $_FILES['file']['tmp_name']; - $file_handle = fopen($file, "r"); - $contact = array(); - while (!feof($file_handle)) { - $line = fgets($file_handle); - $s = explode("\t",$line); - if($s[0] != "") - $contact[$s[0]] = $s[1]; - } - fclose($file_handle); - - if(count($contact) < 4 || $contact['source_name'] == '' || $contact['contributor_name'] == '' || $contact['contact_email'] == '' || $contact['contribution_date'] == ''){ - echo "Required information is missing. "; - } - else{ - $image_source_id = save_image_source_information($contact); - $image_source_version_id = save_image_source_version_information($image_source_id,$contact); - - if($image_source_id != -1 && $image_source_version_id != -1){ - echo "information saved successfully
"; - echo "Click here to upload annotated image data file"; - } - else{ - echo "Couldn't save information"; - exit(); - } - } - -?> diff --git a/Personnel/athreyab/image_annotation_db/ia_upload/data.html b/Personnel/athreyab/image_annotation_db/ia_upload/data.html deleted file mode 100755 index 8972814..0000000 --- a/Personnel/athreyab/image_annotation_db/ia_upload/data.html +++ /dev/null @@ -1,18 +0,0 @@ - - -Tool for uploading image annotation information - - -

Tool for uploading image annotation information

-

Step 2

-

Please upload the image annotation information file below

-


-
- - -
- -
- - - diff --git a/Personnel/athreyab/image_annotation_db/ia_upload/index.html b/Personnel/athreyab/image_annotation_db/ia_upload/index.html deleted file mode 100755 index 1f3ded2..0000000 --- a/Personnel/athreyab/image_annotation_db/ia_upload/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - -Tool for uploading image annotation information - - -

Tool for uploading image annotation information

-

Step 1

-

Please upload the contact information file below

-


-
- - -
- -
- - - diff --git a/Personnel/athreyab/image_annotation_db/image_annotation.mwb b/Personnel/athreyab/image_annotation_db/image_annotation.mwb deleted file mode 100644 index 8ed60e1..0000000 Binary files a/Personnel/athreyab/image_annotation_db/image_annotation.mwb and /dev/null differ diff --git a/Personnel/athreyab/image_annotation_db/image_annotation.png b/Personnel/athreyab/image_annotation_db/image_annotation.png deleted file mode 100644 index 99d8db7..0000000 Binary files a/Personnel/athreyab/image_annotation_db/image_annotation.png and /dev/null differ diff --git a/Personnel/athreyab/image_annotation_db/image_annotation.sql b/Personnel/athreyab/image_annotation_db/image_annotation.sql deleted file mode 100644 index 34826e7..0000000 --- a/Personnel/athreyab/image_annotation_db/image_annotation.sql +++ /dev/null @@ -1,168 +0,0 @@ -SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; -SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; -SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL'; - -CREATE SCHEMA IF NOT EXISTS `image_annotation` DEFAULT CHARACTER SET latin1 ; -USE `image_annotation` ; - --- ----------------------------------------------------- --- Table `image_annotation`.`Species_map` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `image_annotation`.`Species_map` ; - -CREATE TABLE IF NOT EXISTS `image_annotation`.`Species_map` ( - `ubio_id` INT(11) NOT NULL , - `po_species_id` INT(11) NOT NULL , - PRIMARY KEY (`ubio_id`) , - INDEX `fk_Species_map_1` (`po_species_id` ASC) , - CONSTRAINT `fk_Species_map_1` - FOREIGN KEY (`po_species_id` ) - REFERENCES `po_beta`.`species` (`id` ) - ON DELETE NO ACTION - ON UPDATE NO ACTION) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - - --- ----------------------------------------------------- --- Table `image_annotation`.`Annotated_term_type` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `image_annotation`.`Annotated_term_type` ; - -CREATE TABLE IF NOT EXISTS `image_annotation`.`Annotated_term_type` ( - `annotated_term_type_id` INT(11) NOT NULL , - `annotated_term_type` VARCHAR(45) NULL DEFAULT NULL , - PRIMARY KEY (`annotated_term_type_id`) ) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - - --- ----------------------------------------------------- --- Table `image_annotation`.`Annotated_term` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `image_annotation`.`Annotated_term` ; - -CREATE TABLE IF NOT EXISTS `image_annotation`.`Annotated_term` ( - `annotated_term_id` INT(11) NOT NULL , - `annotated_term` VARCHAR(45) NULL DEFAULT NULL , - `annotated_term_type_id` INT(11) NULL DEFAULT NULL , - `po_term_id` INT(11) NULL DEFAULT NULL , - PRIMARY KEY (`annotated_term_id`) , - INDEX `fk_Annotated Term_1` (`annotated_term_type_id` ASC) , - INDEX `fk_Annotated_term_2` (`po_term_id` ASC) , - CONSTRAINT `fk_Annotated Term_1` - FOREIGN KEY (`annotated_term_type_id` ) - REFERENCES `image_annotation`.`Annotated_term_type` (`annotated_term_type_id` ) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_Annotated_term_2` - FOREIGN KEY (`po_term_id` ) - REFERENCES `po_beta`.`term` (`id` ) - ON DELETE NO ACTION - ON UPDATE NO ACTION) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - - --- ----------------------------------------------------- --- Table `image_annotation`.`Annotated_image` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `image_annotation`.`Annotated_image` ; - -CREATE TABLE IF NOT EXISTS `image_annotation`.`Annotated_image` ( - `annotated_image_id` INT(11) NOT NULL , - `image_path` VARCHAR(255) NULL DEFAULT NULL , - `curator` VARCHAR(45) NULL DEFAULT NULL , - `comments` VARCHAR(45) NULL DEFAULT NULL , - `annotated_term_id` INT(11) NULL DEFAULT NULL , - `ubio_id` INT(11) NULL DEFAULT NULL , - `ubio_name` VARCHAR(45) NULL DEFAULT NULL , - `species_name` VARCHAR(45) NULL DEFAULT NULL , - PRIMARY KEY (`annotated_image_id`) , - INDEX `fk_Annotated_image_1` (`ubio_id` ASC) , - INDEX `fk_Annotated_image_3` (`annotated_term_id` ASC) , - CONSTRAINT `fk_Annotated_image_1` - FOREIGN KEY (`ubio_id` ) - REFERENCES `image_annotation`.`Species_map` (`ubio_id` ) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_Annotated_image_3` - FOREIGN KEY (`annotated_term_id` ) - REFERENCES `image_annotation`.`Annotated_term` (`annotated_term_id` ) - ON DELETE NO ACTION - ON UPDATE NO ACTION) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - - --- ----------------------------------------------------- --- Table `image_annotation`.`Annotated_keyword` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `image_annotation`.`Annotated_keyword` ; - -CREATE TABLE IF NOT EXISTS `image_annotation`.`Annotated_keyword` ( - `annotated_keyword_id` INT(11) NOT NULL , - `annotated_keyword` VARCHAR(45) NULL DEFAULT NULL , - PRIMARY KEY (`annotated_keyword_id`) ) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - - --- ----------------------------------------------------- --- Table `image_annotation`.`Annotated_keywordlist` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `image_annotation`.`Annotated_keywordlist` ; - -CREATE TABLE IF NOT EXISTS `image_annotation`.`Annotated_keywordlist` ( - `annotated_image_id` INT(11) NOT NULL , - `annotated_keyword_id` INT(11) NOT NULL , - PRIMARY KEY (`annotated_image_id`, `annotated_keyword_id`) , - INDEX `fk_Annotated_keywordlist_1` (`annotated_image_id` ASC) , - INDEX `fk_Annotated_keywordlist_2` (`annotated_keyword_id` ASC) , - CONSTRAINT `fk_Annotated_keywordlist_1` - FOREIGN KEY (`annotated_image_id` ) - REFERENCES `image_annotation`.`Annotated_image` (`annotated_image_id` ) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_Annotated_keywordlist_2` - FOREIGN KEY (`annotated_keyword_id` ) - REFERENCES `image_annotation`.`Annotated_keyword` (`annotated_keyword_id` ) - ON DELETE NO ACTION - ON UPDATE NO ACTION) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - - --- ----------------------------------------------------- --- Table `image_annotation`.`Segment` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `image_annotation`.`Segment` ; - -CREATE TABLE IF NOT EXISTS `image_annotation`.`Segment` ( - `segment_id` INT(11) NOT NULL , - `color` VARCHAR(45) NULL DEFAULT NULL , - `annotated_image_id` INT(11) NULL DEFAULT NULL , - `byte_mask` BLOB NULL DEFAULT NULL , - `coordinates` LINESTRING NULL DEFAULT NULL , - `annotated_term_id` INT(11) NULL DEFAULT NULL , - PRIMARY KEY (`segment_id`) , - INDEX `fk_Segment_2` (`annotated_term_id` ASC) , - INDEX `fk_Segment_1` (`annotated_image_id` ASC) , - CONSTRAINT `fk_Segment_1` - FOREIGN KEY (`annotated_image_id` ) - REFERENCES `image_annotation`.`Annotated_image` (`annotated_image_id` ) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_Segment_2` - FOREIGN KEY (`annotated_term_id` ) - REFERENCES `image_annotation`.`Annotated_term` (`annotated_term_id` ) - ON DELETE NO ACTION - ON UPDATE NO ACTION) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - - - -SET SQL_MODE=@OLD_SQL_MODE; -SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; -SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; diff --git a/Personnel/athreyab/image_annotation_db/image_annotation_v1.11.mwb b/Personnel/athreyab/image_annotation_db/image_annotation_v1.11.mwb deleted file mode 100644 index a292898..0000000 Binary files a/Personnel/athreyab/image_annotation_db/image_annotation_v1.11.mwb and /dev/null differ diff --git a/Personnel/athreyab/image_annotation_db/image_annotation_v1.11.png b/Personnel/athreyab/image_annotation_db/image_annotation_v1.11.png deleted file mode 100644 index a9eeaec..0000000 Binary files a/Personnel/athreyab/image_annotation_db/image_annotation_v1.11.png and /dev/null differ diff --git a/Personnel/athreyab/image_annotation_db/image_annotation_v1_11_load.sql b/Personnel/athreyab/image_annotation_db/image_annotation_v1_11_load.sql deleted file mode 100644 index e984040..0000000 --- a/Personnel/athreyab/image_annotation_db/image_annotation_v1_11_load.sql +++ /dev/null @@ -1,220 +0,0 @@ -SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; -SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; -SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL'; - -CREATE SCHEMA IF NOT EXISTS `image_annotation` DEFAULT CHARACTER SET latin1 ; -USE `image_annotation` ; - --- ----------------------------------------------------- --- Table `image_annotation`.`image_source` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `image_annotation`.`image_source` ; - -CREATE TABLE IF NOT EXISTS `image_annotation`.`image_source` ( - `image_source_id` INT NOT NULL AUTO_INCREMENT , - `source_name` VARCHAR(80) NULL , - `url` VARCHAR(255) NULL , - `contact_email` VARCHAR(80) NULL , - `contributor_name` VARCHAR(80) NULL , - PRIMARY KEY (`image_source_id`) ) -ENGINE = InnoDB; - - --- ----------------------------------------------------- --- Table `image_annotation`.`image_source_version` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `image_annotation`.`image_source_version` ; - -CREATE TABLE IF NOT EXISTS `image_annotation`.`image_source_version` ( - `image_source_version_id` INT NOT NULL , - `image_source_id` INT NULL , - `source_version` VARCHAR(45) NULL , - `contribution_date` DATE NULL , - `publication_id` VARCHAR(45) NULL , - PRIMARY KEY (`image_source_version_id`) , - INDEX `fk_Image_source_version_1` (`image_source_id` ASC) , - CONSTRAINT `fk_Image_source_version_1` - FOREIGN KEY (`image_source_id` ) - REFERENCES `image_annotation`.`image_source` (`image_source_id` ) - ON DELETE NO ACTION - ON UPDATE NO ACTION) -ENGINE = InnoDB; - - --- ----------------------------------------------------- --- Table `image_annotation`.`curator` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `image_annotation`.`curator` ; - -CREATE TABLE IF NOT EXISTS `image_annotation`.`curator` ( - `curator_id` INT NOT NULL AUTO_INCREMENT , - `firstname` VARCHAR(80) NULL , - `lastname` VARCHAR(80) NULL , - `primary_email` VARCHAR(80) NULL , - `alternate_email` VARCHAR(80) NULL , - `affiliation` VARCHAR(80) NULL , - PRIMARY KEY (`curator_id`) ) -ENGINE = InnoDB; - - --- ----------------------------------------------------- --- Table `image_annotation`.`taxon` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `image_annotation`.`taxon` ; - -CREATE TABLE IF NOT EXISTS `image_annotation`.`taxon` ( - `taxon_id` INT NOT NULL AUTO_INCREMENT , - `species_id` VARCHAR(45) NULL , - `species_name` VARCHAR(80) NULL , - `common_name` VARCHAR(80) NULL , - `genus` VARCHAR(80) NULL , - `subspecies` VARCHAR(80) NULL , - PRIMARY KEY (`taxon_id`) ) -ENGINE = InnoDB; - - --- ----------------------------------------------------- --- Table `image_annotation`.`annotated_image` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `image_annotation`.`annotated_image` ; - -CREATE TABLE IF NOT EXISTS `image_annotation`.`annotated_image` ( - `annotated_image_id` INT NOT NULL AUTO_INCREMENT , - `curator_id` INT NULL DEFAULT NULL , - `image_source_version_id` INT NULL , - `taxon_id` INT NULL DEFAULT NULL , - `annotated_image` LONGBLOB NULL , - `image_path` VARCHAR(255) NULL DEFAULT NULL , - `annotated_image_type` VARCHAR(45) NULL , - `timestamp` DATE NULL , - `software_name` VARCHAR(45) NULL , - `software_version` VARCHAR(32) NULL , - `comments` VARCHAR(255) NULL , - `ip_comment` VARCHAR(255) NULL , - `collection_location` VARCHAR(255) NULL , - `collection_date` DATE NULL , - `source_db_name` VARCHAR(45) NULL , - `source_db_id` INT(11) NULL , - `doi` VARCHAR(45) NULL , - PRIMARY KEY (`annotated_image_id`) , - INDEX `fk_Annotated_image_1` (`image_source_version_id` ASC) , - INDEX `fk_Annotated_image_3` (`curator_id` ASC) , - INDEX `fk_Annotated_image_2` (`taxon_id` ASC) , - CONSTRAINT `fk_Annotated_image_1` - FOREIGN KEY (`image_source_version_id` ) - REFERENCES `image_annotation`.`image_source_version` (`image_source_version_id` ) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_Annotated_image_3` - FOREIGN KEY (`curator_id` ) - REFERENCES `image_annotation`.`curator` (`curator_id` ) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_Annotated_image_2` - FOREIGN KEY (`taxon_id` ) - REFERENCES `image_annotation`.`taxon` (`taxon_id` ) - ON DELETE NO ACTION - ON UPDATE NO ACTION) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - - --- ----------------------------------------------------- --- Table `image_annotation`.`annotated_term` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `image_annotation`.`annotated_term` ; - -CREATE TABLE IF NOT EXISTS `image_annotation`.`annotated_term` ( - `annotated_term_id` INT NOT NULL AUTO_INCREMENT , - `keyword` VARCHAR(80) NULL DEFAULT NULL , - `ontology_term_id` VARCHAR(80) NULL DEFAULT NULL , - `ontology_term_name` VARCHAR(80) NULL DEFAULT NULL , - `isKeyword` BIT NULL , - PRIMARY KEY (`annotated_term_id`) ) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - - --- ----------------------------------------------------- --- Table `image_annotation`.`segment` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `image_annotation`.`segment` ; - -CREATE TABLE IF NOT EXISTS `image_annotation`.`segment` ( - `segment_id` INT NOT NULL AUTO_INCREMENT , - `annotated_image_id` INT NULL , - `color` VARCHAR(40) NULL DEFAULT NULL , - `byte_mask` LONGBLOB NULL DEFAULT NULL , - `coordinates` LINESTRING NULL DEFAULT NULL , - PRIMARY KEY (`segment_id`) , - INDEX `fk_Segment_1` (`annotated_image_id` ASC) , - CONSTRAINT `fk_Segment_1` - FOREIGN KEY (`annotated_image_id` ) - REFERENCES `image_annotation`.`annotated_image` (`annotated_image_id` ) - ON DELETE NO ACTION - ON UPDATE NO ACTION) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - - --- ----------------------------------------------------- --- Table `image_annotation`.`annotated_term_image` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `image_annotation`.`annotated_term_image` ; - -CREATE TABLE IF NOT EXISTS `image_annotation`.`annotated_term_image` ( - `annotated_term_image_id` INT NOT NULL AUTO_INCREMENT , - `annotated_term_id` INT NULL , - `annotated_image_id` INT NULL , - PRIMARY KEY (`annotated_term_image_id`) , - INDEX `fk_Annotated_term_image_2` (`annotated_term_id` ASC) , - INDEX `fk_Annotated_term_image_1` (`annotated_image_id` ASC) , - CONSTRAINT `fk_Annotated_term_image_2` - FOREIGN KEY (`annotated_term_id` ) - REFERENCES `image_annotation`.`annotated_term` (`annotated_term_id` ) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_Annotated_term_image_1` - FOREIGN KEY (`annotated_image_id` ) - REFERENCES `image_annotation`.`annotated_image` (`annotated_image_id` ) - ON DELETE NO ACTION - ON UPDATE NO ACTION) -ENGINE = InnoDB; - - --- ----------------------------------------------------- --- Table `image_annotation`.`annotated_term_segment` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `image_annotation`.`annotated_term_segment` ; - -CREATE TABLE IF NOT EXISTS `image_annotation`.`annotated_term_segment` ( - `annotated_term_segment_id` INT NOT NULL AUTO_INCREMENT , - `segment_id` INT NULL , - `annotated_term_id` INT NULL , - `trait_term_id` INT NULL , - PRIMARY KEY (`annotated_term_segment_id`) , - INDEX `fk_Annotated_term_segment_1` (`annotated_term_id` ASC) , - INDEX `fk_Annotated_term_segment_2` (`segment_id` ASC) , - INDEX `fk_Annotated_term_segment_3` (`trait_term_id` ASC) , - CONSTRAINT `fk_Annotated_term_segment_1` - FOREIGN KEY (`annotated_term_id` ) - REFERENCES `image_annotation`.`annotated_term` (`annotated_term_id` ) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_Annotated_term_segment_2` - FOREIGN KEY (`segment_id` ) - REFERENCES `image_annotation`.`segment` (`segment_id` ) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_Annotated_term_segment_3` - FOREIGN KEY (`trait_term_id` ) - REFERENCES `image_annotation`.`annotated_term` (`annotated_term_id` ) - ON DELETE NO ACTION - ON UPDATE NO ACTION) -ENGINE = InnoDB; - - - -SET SQL_MODE=@OLD_SQL_MODE; -SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; -SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; diff --git a/image_annotation_db/html5/get_image.php b/image_annotation_db/html5/get_image.php new file mode 100755 index 0000000..f483d1e --- /dev/null +++ b/image_annotation_db/html5/get_image.php @@ -0,0 +1,33 @@ +query($segment_query) or die($mysqli->error.__LINE__); +if($segment_result->num_rows > 0) { + $segment = $segment_result->fetch_assoc(); +} + +*/ +$image_query = "SELECT * FROM Annotated_image where annotated_image_id = 1"; +$image_result = $mysqli->query($image_query) or die($mysqli->error.__LINE__); +if($image_result->num_rows > 0) { + $image = $image_result->fetch_assoc(); +} + +//echo ''; +//echo ''; + +//print_r($image); +header('Content-type: '.$image['annotated_image_type']); +setcookie("imgh",$image['annotated_image_height'] ); +setcookie("imgw",$image['annotated_image_width'] ); + +echo $image['annotated_image']; +?> diff --git a/image_annotation_db/html5/image.png b/image_annotation_db/html5/image.png new file mode 100755 index 0000000..234ce51 Binary files /dev/null and b/image_annotation_db/html5/image.png differ diff --git a/image_annotation_db/html5/image_annotation.php b/image_annotation_db/html5/image_annotation.php new file mode 100755 index 0000000..28caefe --- /dev/null +++ b/image_annotation_db/html5/image_annotation.php @@ -0,0 +1,86 @@ + + + + + + + + + hi + +hi +query($segment_query) or die($mysqli->error.__LINE__); +if($segment_result->num_rows > 0) { + while($s = $segment_result->fetch_array()){ + $segment = array(); + $segment['id'] = $s['segment_id']; + $segment['color'] = $s['color']; + $coordinates = array(); + + $offset = 9; + $pts = unpack("@$offset/d*", $s[2]); + $geom = array(); + $pair = false; + $count = 0; + $i = 1; + while($i < count($pts)){ + $geom[0] = $pts[$i]; + $i = $i + 1; + $geom[1] = $pts[$i]; + $i = $i + 1; + $coordinates[$count] = $geom; + $count = $count + 1; + } + $segment['coordinates'] = $coordinates; + $segments[$segment["id"]] = $segment; + } +} +?> + + + diff --git a/image_annotation_db/html5/image_annotation1.php b/image_annotation_db/html5/image_annotation1.php new file mode 100755 index 0000000..dcc903a --- /dev/null +++ b/image_annotation_db/html5/image_annotation1.php @@ -0,0 +1,124 @@ + + + + + + + + +
+ +query($segment_query) or die($mysqli->error.__LINE__); +if($segment_result->num_rows > 0) { + while($s = $segment_result->fetch_array()){ + $segment = array(); + $segment['id'] = $s['segment_id']; + $segment['color'] = $s['color']; + $coordinates = array(); + + $offset = 9; + $pts = unpack("@$offset/d*", $s[2]); + $geom = array(); + $pair = false; + $count = 0; + $i = 1; + while($i < count($pts)){ + $geom[0] = $pts[$i]; + $i = $i + 1; + $geom[1] = $pts[$i]; + $i = $i + 1; + $coordinates[$count] = $geom; + $count = $count + 1; + } + $segment['coordinates'] = $coordinates; + $segments[$segment["id"]] = $segment; + } +} +?> + + + diff --git a/image_annotation_db/html5/image_annotation2.php b/image_annotation_db/html5/image_annotation2.php new file mode 100755 index 0000000..56a2fd9 --- /dev/null +++ b/image_annotation_db/html5/image_annotation2.php @@ -0,0 +1,116 @@ + + + + + + + + +
+ +query($segment_query) or die($mysqli->error.__LINE__); +if($segment_result->num_rows > 0) { + while($s = $segment_result->fetch_array()){ + $segment = array(); + $segment['id'] = $s['segment_id']; + $segment['color'] = $s['color']; + $coordinates = array(); + + $offset = 9; + $pts = unpack("@$offset/d*", $s[2]); + $geom = array(); + $pair = false; + $count = 0; + $i = 1; + while($i < count($pts)){ + $geom[0] = $pts[$i]; + $i = $i + 1; + $geom[1] = $pts[$i]; + $i = $i + 1; + $coordinates[$count] = $geom; + $count = $count + 1; + } + $segment['coordinates'] = $coordinates; + $segments[$segment["id"]] = $segment; + } +} +?> + + + diff --git a/image_annotation_db/html5/image_annotation3.php b/image_annotation_db/html5/image_annotation3.php new file mode 100755 index 0000000..dc4b719 --- /dev/null +++ b/image_annotation_db/html5/image_annotation3.php @@ -0,0 +1,126 @@ + + + + + + + +query($segment_query) or die($mysqli->error.__LINE__); + if($segment_result->num_rows > 0) { + while($s = $segment_result->fetch_array()){ + $segment = array(); + $segment['id'] = $s['segment_id']; + $segment['color'] = $s['color']; + $coordinates = array(); + + $offset = 9; + $pts = unpack("@$offset/d*", $s[2]); + $geom = array(); + $pair = false; + $count = 0; + $i = 1; + while($i < count($pts)){ + $geom[0] = $pts[$i]; + $i = $i + 1; + $geom[1] = $pts[$i]; + $i = $i + 1; + $coordinates[$count] = $geom; + $count = $count + 1; + } + $segment['coordinates'] = $coordinates; + $segments[$segment["id"]] = $segment; + } + } +?> + + + + + +
+ + + diff --git a/image_annotation_db/html5/image_annotation4.php b/image_annotation_db/html5/image_annotation4.php new file mode 100755 index 0000000..6a52334 --- /dev/null +++ b/image_annotation_db/html5/image_annotation4.php @@ -0,0 +1,176 @@ + + + + + + + + +
+ +query($segment_query) or die($mysqli->error.__LINE__); +if($segment_result->num_rows > 0) { + while($s = $segment_result->fetch_array()){ + $segment = array(); + $segment['id'] = $s['segment_id']; + $segment['color'] = $s['color']; + $coordinates = array(); + + $offset = 9; + $pts = unpack("@$offset/d*", $s[2]); + $geom = array(); + $pair = false; + $count = 0; + $i = 1; + while($i < count($pts)){ + $geom[0] = $pts[$i]; + $i = $i + 1; + $geom[1] = $pts[$i]; + $i = $i + 1; + $coordinates[$count] = $geom; + $count = $count + 1; + } + $segment['coordinates'] = $coordinates; + $segments[$segment["id"]] = $segment; + } +} +?> + + + diff --git a/image_annotation_db/html5/jquery.cookie.js b/image_annotation_db/html5/jquery.cookie.js new file mode 100755 index 0000000..8038e22 --- /dev/null +++ b/image_annotation_db/html5/jquery.cookie.js @@ -0,0 +1,73 @@ +/*! + * jQuery Cookie Plugin v1.3 + * https://github.com/carhartl/jquery-cookie + * + * Copyright 2011, Klaus Hartl + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://www.opensource.org/licenses/mit-license.php + * http://www.opensource.org/licenses/GPL-2.0 + */ +(function ($, document, undefined) { + + var pluses = /\+/g; + + function raw(s) { + return s; + } + + function decoded(s) { + return decodeURIComponent(s.replace(pluses, ' ')); + } + + var config = $.cookie = function (key, value, options) { + + // write + if (value !== undefined) { + options = $.extend({}, config.defaults, options); + + if (value === null) { + options.expires = -1; + } + + if (typeof options.expires === 'number') { + var days = options.expires, t = options.expires = new Date(); + t.setDate(t.getDate() + days); + } + + value = config.json ? JSON.stringify(value) : String(value); + + return (document.cookie = [ + encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value), + options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE + options.path ? '; path=' + options.path : '', + options.domain ? '; domain=' + options.domain : '', + options.secure ? '; secure' : '' + ].join('')); + } + + // read + var decode = config.raw ? raw : decoded; + var cookies = document.cookie.split('; '); + for (var i = 0, l = cookies.length; i < l; i++) { + var parts = cookies[i].split('='); + if (decode(parts.shift()) === key) { + var cookie = decode(parts.join('=')); + return config.json ? JSON.parse(cookie) : cookie; + } + } + + return null; + }; + + config.defaults = {}; + + $.removeCookie = function (key, options) { + if ($.cookie(key) !== null) { + $.cookie(key, null, options); + return true; + } + return false; + }; + +})(jQuery, document); + diff --git a/image_annotation_db/html5/kinetic-v4.0.4.min.js b/image_annotation_db/html5/kinetic-v4.0.4.min.js new file mode 100644 index 0000000..ef3384b --- /dev/null +++ b/image_annotation_db/html5/kinetic-v4.0.4.min.js @@ -0,0 +1,30 @@ +/** + * KineticJS JavaScript Library v4.0.4 + * http://www.kineticjs.com/ + * Copyright 2012, Eric Rowell + * Licensed under the MIT or GPL Version 2 licenses. + * Date: Oct 19 2012 + * + * Copyright (C) 2011 - 2012 by Eric Rowell + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +var Kinetic={};Kinetic.Filters={},Kinetic.Plugins={},Kinetic.Global={BUBBLE_WHITELIST:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseenter","mouseleave","click","dblclick","touchstart","touchmove","touchend","tap","dbltap","dragstart","dragmove","dragend"],BUFFER_WHITELIST:["fill","stroke","textFill","textStroke"],BUFFER_BLACKLIST:["shadow"],stages:[],idCounter:0,tempNodes:{},shapes:{},warn:function(a){console&&console.warn&&console.warn("Kinetic warning: "+a)},extend:function(a,b){for(var c in b.prototype)c in a.prototype||(a.prototype[c]=b.prototype[c])},_pullNodes:function(a){var b=this.tempNodes;for(var c in b){var d=b[c];d.getStage()!==undefined&&d.getStage()._id===a._id&&(a._addId(d),a._addName(d),this._removeTempNode(d))}},_addTempNode:function(a){this.tempNodes[a._id]=a},_removeTempNode:function(a){delete this.tempNodes[a._id]}},Kinetic.Filters.Grayscale=function(a){var b=a.data;for(var c=0;c0},_getXY:function(a){if(this._isNumber(a))return{x:a,y:a};if(this._isArray(a)){if(a.length===1){var b=a[0];if(this._isNumber(b))return{x:b,y:b};if(this._isArray(b))return{x:b[0],y:b[1]};if(this._isObject(b))return b}else if(a.length>=2)return{x:a[0],y:a[1]}}else if(this._isObject(a))return a;return{x:0,y:0}},_getSize:function(a){if(this._isNumber(a))return{width:a,height:a};if(this._isArray(a))if(a.length===1){var b=a[0];if(this._isNumber(b))return{width:b,height:b};if(this._isArray(b)){if(b.length>=4)return{width:b[2],height:b[3]};if(b.length>=2)return{width:b[0],height:b[1]}}else if(this._isObject(b))return b}else{if(a.length>=4)return{width:a[2],height:a[3]};if(a.length>=2)return{width:a[0],height:a[1]}}else if(this._isObject(a))return a;return{width:0,height:0}},_getPoints:function(a){if(a===undefined)return[];if(this._isObject(a[0]))return a;var b=[];for(var c=0;c>16&255,g:b>>8&255,b:b&255}},_getRandomColorKey:function(){var a=Math.round(Math.random()*255),b=Math.round(Math.random()*255),c=Math.round(Math.random()*255);return this._rgbToHex(a,b,c)},_merge:function(a,b){var c=this._clone(b);for(var d in a)this._isObject(a[d])?c[d]=this._merge(a[d],c[d]):c[d]=a[d];return c},_clone:function(a){var b={};for(var c in a)this._isObject(a[c])?b[c]=this._clone(a[c]):b[c]=a[c];return b}},Kinetic.Canvas=function(a,b){this.element=document.createElement("canvas"),this.context=this.element.getContext("2d"),this.element.width=a,this.element.height=b},Kinetic.Canvas.prototype={clear:function(){var a=this.getContext(),b=this.getElement();a.clearRect(0,0,b.width,b.height)},getElement:function(){return this.element},getContext:function(){return this.context},setWidth:function(a){this.element.width=a},setHeight:function(a){this.element.height=a},getWidth:function(){return this.element.width},getHeight:function(){return this.element.height},setSize:function(a,b){this.setWidth(a),this.setHeight(b)},toDataURL:function(a,b){try{return this.element.toDataURL(a,b)}catch(c){return this.element.toDataURL()}}},Kinetic.Tween=function(a,b,c,d,e,f){this._listeners=[],this.addListener(this),this.obj=a,this.propFunc=b,this.begin=d,this._pos=d,this.setDuration(f),this.isPlaying=!1,this._change=0,this.prevTime=0,this.prevPos=0,this.looping=!1,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.name="",this.func=c,this.setFinish(e)},Kinetic.Tween.prototype={setTime:function(a){this.prevTime=this._time,a>this.getDuration()?this.looping?(this.rewind(a-this._duration),this.update(),this.broadcastMessage("onLooped",{target:this,type:"onLooped"})):(this._time=this._duration,this.update(),this.stop(),this.broadcastMessage("onFinished",{target:this,type:"onFinished"})):a<0?(this.rewind(),this.update()):(this._time=a,this.update())},getTime:function(){return this._time},setDuration:function(a){this._duration=a===null||a<=0?1e5:a},getDuration:function(){return this._duration},setPosition:function(a){this.prevPos=this._pos,this.propFunc(a),this._pos=a,this.broadcastMessage("onChanged",{target:this,type:"onChanged"})},getPosition:function(a){return a===undefined&&(a=this._time),this.func(a,this.begin,this._change,this._duration)},setFinish:function(a){this._change=a-this.begin},getFinish:function(){return this.begin+this._change},start:function(){this.rewind(),this.startEnterFrame(),this.broadcastMessage("onStarted",{target:this,type:"onStarted"})},rewind:function(a){this.stop(),this._time=a===undefined?0:a,this.fixTime(),this.update()},fforward:function(){this._time=this._duration,this.fixTime(),this.update()},update:function(){this.setPosition(this.getPosition(this._time))},startEnterFrame:function(){this.stopEnterFrame(),this.isPlaying=!0,this.onEnterFrame()},onEnterFrame:function(){this.isPlaying&&this.nextFrame()},nextFrame:function(){this.setTime((this.getTimer()-this._startTime)/1e3)},stop:function(){this.stopEnterFrame(),this.broadcastMessage("onStopped",{target:this,type:"onStopped"})},stopEnterFrame:function(){this.isPlaying=!1},continueTo:function(a,b){this.begin=this._pos,this.setFinish(a),this._duration!==undefined&&this.setDuration(b),this.start()},resume:function(){this.fixTime(),this.startEnterFrame(),this.broadcastMessage("onResumed",{target:this,type:"onResumed"})},yoyo:function(){this.continueTo(this.begin,this._time)},addListener:function(a){return this.removeListener(a),this._listeners.push(a)},removeListener:function(a){var b=this._listeners,c=b.length;while(c--)if(b[c]==a)return b.splice(c,1),!0;return!1},broadcastMessage:function(){var a=[];for(var b=0;b0){this._runFrames();var a=this;requestAnimFrame(function(){a._animationLoop()})}else this.animRunning=!1},Kinetic.Animation._handleAnimation=function(){var a=this;this.animRunning||(this.animRunning=!0,a._animationLoop())},requestAnimFrame=function(a){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,1e3/60)}}(),Kinetic.Node=function(a){this._nodeInit(a)},Kinetic.Node.prototype={_nodeInit:function(a){this.defaultNodeAttrs={visible:!0,listening:!0,name:undefined,opacity:1,x:0,y:0,scale:{x:1,y:1},rotation:0,offset:{x:0,y:0},draggable:!1},this.setDefaultAttrs(this.defaultNodeAttrs),this.eventListeners={},this.setAttrs(a);var b=this;this.on("idChange.kinetic",function(a){var c=b.getStage();c&&(c._removeId(a.oldVal),c._addId(b))}),this.on("nameChange.kinetic",function(a){var c=b.getStage();c&&(c._removeName(a.oldVal,b._id),c._addName(b))})},on:function(a,b){var c=a.split(" ");for(var d=0;d1?g[1]:"";this.eventListeners[h]||(this.eventListeners[h]=[]),this.eventListeners[h].push({name:i,handler:b})}},off:function(a){var b=a.split(" ");for(var c=0;c1)if(g)this.eventListeners[g]&&this._off(g,f[1]);else for(var d in this.eventListeners)this._off(d,f[1]);else delete this.eventListeners[g]}},remove:function(){var a=this.getParent();if(a&&this.index!==undefined&&a.children[this.index]._id==this._id){var b=a.getStage();b&&(b._removeId(this.getId()),b._removeName(this.getName(),this._id)),Kinetic.Global._removeTempNode(this),a.children.splice(this.index,1),a._setChildrenIndices();while(this.children&&this.children.length>0)this.children[0].remove()}},getAttrs:function(){return this.attrs},setDefaultAttrs:function(a){this.attrs===undefined&&(this.attrs={});if(a)for(var b in a)this.attrs[b]===undefined&&(this.attrs[b]=a[b])},setAttrs:function(a){if(a)for(var b in a){var c="set"+b.charAt(0).toUpperCase()+b.slice(1);Kinetic.Type._isFunction(this[c])?this[c](a[b]):this.setAttr(b,a[b])}},isVisible:function(){return this.attrs.visible&&this.getParent()&&!this.getParent().isVisible()?!1:this.attrs.visible},show:function(){this.setVisible(!0)},hide:function(){this.setVisible(!1)},getZIndex:function(){return this.index},getAbsoluteZIndex:function(){function e(b){var f=[];for(var g=0;g0&&f[0].getLevel()<=a&&e(f)}var a=this.getLevel(),b=this.getStage(),c=this,d=0;return c.nodeType!=="Stage"&&e(c.getStage().getChildren()),d},getLevel:function(){var a=0,b=this.parent;while(b)a++,b=b.parent;return a},setPosition:function(){var a=Kinetic.Type._getXY([].slice.call(arguments));this.setAttr("x",a.x),this.setAttr("y",a.y)},getPosition:function(){return{x:this.attrs.x,y:this.attrs.y}},getAbsolutePosition:function(){var a=this.getAbsoluteTransform(),b=this.getOffset();return a.translate(b.x,b.y),a.getTranslation()},setAbsolutePosition:function(){var a=Kinetic.Type._getXY([].slice.call(arguments)),b=this._clearTransform();this.attrs.x=b.x,this.attrs.y=b.y,delete b.x,delete b.y;var c=this.getAbsoluteTransform();c.invert(),c.translate(a.x,a.y),a={x:this.attrs.x+c.getTranslation().x,y:this.attrs.y+c.getTranslation().y},this.setPosition(a.x,a.y),this._setTransform(b)},move:function(){var a=Kinetic.Type._getXY([].slice.call(arguments)),b=this.getX(),c=this.getY();a.x!==undefined&&(b+=a.x),a.y!==undefined&&(c+=a.y),this.setPosition(b,c)},getRotationDeg:function(){return this.getRotation()*180/Math.PI},setRotationDeg:function(a){this.setRotation(a*Math.PI/180)},rotate:function(a){this.setRotation(this.getRotation()+a)},rotateDeg:function(a){this.setRotation(this.getRotation()+a*Math.PI/180)},moveToTop:function(){var a=this.index;return this.parent.children.splice(a,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0},moveUp:function(){var a=this.index;if(a0)return this.parent.children.splice(a,1),this.parent.children.splice(a-1,0,this),this.parent._setChildrenIndices(),!0},moveToBottom:function(){var a=this.index;if(a>0)return this.parent.children.splice(a,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0},setZIndex:function(a){var b=this.index;this.parent.children.splice(b,1),this.parent.children.splice(a,0,this),this.parent._setChildrenIndices()},getAbsoluteOpacity:function(){var a=this.getOpacity();return this.getParent()&&(a*=this.getParent().getAbsoluteOpacity()),a},moveTo:function(a){var b=this.parent;b.children.splice(this.index,1),b._setChildrenIndices(),a.children.push(this),this.index=a.children.length-1,this.parent=a,a._setChildrenIndices()},toObject:function(){var a={},b=Kinetic.Type;a.attrs={};for(var c in this.attrs){var d=this.attrs[c];!b._isFunction(d)&&!b._isElement(d)&&(!b._isObject(d)||!b._hasMethods(d))&&(a.attrs[c]=d)}return a.nodeType=this.nodeType,a.shapeType=this.shapeType,a},toJSON:function(){return JSON.stringify(this.toObject())},getParent:function(){return this.parent},getLayer:function(){return this.getParent().getLayer()},getStage:function(){return this.getParent()?this.getParent().getStage():undefined},simulate:function(a){this._handleEvent(a,{})},getAbsoluteTransform:function(){var a=new Kinetic.Transform,b=[],c=this.parent;b.unshift(this);while(c)b.unshift(c),c=c.parent;for(var d=0;d=0&&!b.cancelBubble&&this.parent&&(c&&c.parent?this._handleEvent.call(this.parent,a,b,c.parent):this._handleEvent.call(this.parent,a,b))}},_shouldDraw:function(a){return this.isVisible()&&(!a||a.name!=="buffer"||this.getListening())}},Kinetic.Node.addSetters=function(constructor,a){for(var b=0;b=c.tweens.length&&c.onFinished()}}},Kinetic.Transition.prototype={start:function(){for(var a=0;a0)this.children[0].remove()},add:function(a){a._id=Kinetic.Global.idCounter++,a.index=this.children.length,a.parent=this,this.children.push(a);var b=a.getStage();if(!b)Kinetic.Global._addTempNode(a);else{b._addId(a),b._addName(a);var c=Kinetic.Global;c._pullNodes(b)}return this},get:function(a){var b=new Kinetic.Collection;if(a.charAt(0)==="#"){var c=this._getNodeById(a.slice(1));c&&b.push(c)}else if(a.charAt(0)==="."){var d=this._getNodesByName(a.slice(1));Kinetic.Collection.apply(b,d)}else{var e=[],f=this.getChildren();for(var g=0;g=0;d--){var e=c[d];if(e.isVisible()&&e.isListening()){var f=e.bufferCanvas.context.getImageData(Math.round(a.x),Math.round(a.y),1,1).data;if(f[3]===255){var g=Kinetic.Type._rgbToHex(f[0],f[1],f[2]);return b=Kinetic.Global.shapes[g],{shape:b,pixel:f}}if(f[0]>0||f[1]>0||f[2]>0||f[3]>0)return{pixel:f}}}return null},_getNodeById:function(a){return this.ids[a]||null},_getNodesByName:function(a){return this.names[a]||[]},_resizeDOM:function(){if(this.content){var a=this.attrs.width,b=this.attrs.height;this.content.style.width=a+"px",this.content.style.height=b+"px",this.bufferCanvas.setSize(a,b);var c=this.children;for(var d=0;d0},remove:function(){Kinetic.Node.prototype.remove.call(this),delete Kinetic.Global.shapes[this.colorKey]},draw:function(a){if(this.attrs.drawFunc&&Kinetic.Node.prototype._shouldDraw.call(this,a)){var b=this.getStage(),c=a.getContext(),d=[],e=this.parent;d.unshift(this);while(e)d.unshift(e),e=e.parent;c.save();for(var f=0;f0&&d&&(this.attrs.height==="auto"||e*(c+1)this.attrs.width-this.attrs.padding*2){if(f==0)break;var i=h.lastIndexOf(" "),j=h.lastIndexOf("-"),k=Math.max(i,j);if(k>=0){g=a.splice(0,1+k).join("");break}g=a.splice(0,f).join("");break}f++,f===a.length&&(g=a.splice(0,f).join(""))}this.textWidth=Math.max(this.textWidth,this._getTextSize(g).width),g!==undefined&&(b.push(g),d=!0),c++}this.textArr=b}},Kinetic.Global.extend(Kinetic.Text,Kinetic.Shape),Kinetic.Node.addGettersSetters(Kinetic.Text,["fontFamily","fontSize","fontStyle","textFill","textStroke","textStrokeWidth","padding","align","lineHeight"]),Kinetic.Node.addGetters(Kinetic.Text,["text"]),Kinetic.Line=function(a){this._initLine(a)},Kinetic.Line.prototype={_initLine:function(a){this.setDefaultAttrs({points:[],lineCap:"butt",dashArray:[],detectionType:"pixel"}),this.shapeType="Line",a.drawFunc=this.drawFunc,Kinetic.Shape.call(this,a)},drawFunc:function(a){var b={};a.beginPath(),a.moveTo(this.attrs.points[0].x,this.attrs.points[0].y);for(var c=1;c0){var f=this.attrs.points[c-1].x,g=this.attrs.points[c-1].y;this._dashedLine(a,f,g,d,e,this.attrs.dashArray)}else a.lineTo(d,e)}this.stroke(a)},setPoints:function(a){this.setAttr("points",Kinetic.Type._getPoints(a))},_dashedLine:function(a,b,c,d,e,f){var g=f.length,h=d-b,i=e-c,j=h>i,k=j?i/h:h/i;k>9999?k=9999:k<-9999&&(k=-9999);var l=Math.sqrt(h*h+i*i),m=0,n=!0;while(l>=.1&&m<1e4){var o=f[m++%g];o===0&&(o=.001),o>l&&(o=l);var p=Math.sqrt(o*o/(1+k*k));j?(b+=h<0&&i<0?p*-1:p,c+=h<0&&i<0?k*p*-1:k*p):(b+=h<0&&i<0?k*p*-1:k*p,c+=h<0&&i<0?p*-1:p),a[n?"lineTo":"moveTo"](b,c),l-=o,n=!n}a.moveTo(d,e)}},Kinetic.Global.extend(Kinetic.Line,Kinetic.Shape),Kinetic.Node.addGettersSetters(Kinetic.Line,["dashArray"]),Kinetic.Node.addGetters(Kinetic.Line,["points"]),Kinetic.Sprite=function(a){this._initSprite(a)},Kinetic.Sprite.prototype={_initSprite:function(a){this.setDefaultAttrs({index:0,frameRate:17}),a.drawFunc=this.drawFunc,Kinetic.Shape.call(this,a),this.anim=new Kinetic.Animation;var b=this;this.on("animationChange.kinetic",function(){b.setIndex(0)})},drawFunc:function(a){var b=this.attrs.animation,c=this.attrs.index,d=this.attrs.animations[b][c];a.beginPath(),a.rect(0,0,d.width,d.height),a.closePath(),this.fill(a),this.stroke(a),this.attrs.image&&(a.beginPath(),a.rect(0,0,d.width,d.height),a.closePath(),this.drawImage(a,this.attrs.image,d.x,d.y,d.width,d.height,0,0,d.width,d.height))},start:function(){var a=this,b=this.getLayer();this.anim.node=b,this.interval=setInterval(function(){var b=a.attrs.index;a._updateIndex(),a.afterFrameFunc&&b===a.afterFrameIndex&&(a.afterFrameFunc(),delete a.afterFrameFunc,delete a.afterFrameIndex)},1e3/this.attrs.frameRate),this.anim.start()},stop:function(){this.anim.stop(),clearInterval(this.interval)},afterFrame:function(a,b){this.afterFrameIndex=a,this.afterFrameFunc=b},_updateIndex:function(){var a=this.attrs.index,b=this.attrs.animation;ai?h:i,o=h>i?1:h/i,p=h>i?i/h:1;a.translate(f,g),a.rotate(l),a.scale(o,p),a.arc(0,0,n,j,j+k,1-m),a.scale(1/o,1/p),a.rotate(-l),a.translate(-f,-g);break;case"z":a.closePath()}}this.fill(a),this.stroke(a)}},Kinetic.Global.extend(Kinetic.Path,Kinetic.Shape),Kinetic.Path.getLineLength=function(a,b,c,d){return Math.sqrt((c-a)*(c-a)+(d-b)*(d-b))},Kinetic.Path.getPointOnLine=function(a,b,c,d,e,f,g){f===undefined&&(f=b),g===undefined&&(g=c);var h=(e-c)/(d-b+1e-8),i=Math.sqrt(a*a/(1+h*h));d0&&k[0]===""&&k.shift();for(var l=0;l0){if(isNaN(k[0]))break;var m=null,n=[],o=g,p=h;switch(j){case"l":g+=k.shift(),h+=k.shift(),m="L",n.push(g,h);break;case"L":g=k.shift(),h=k.shift(),n.push(g,h);break;case"m":g+=k.shift(),h+=k.shift(),m="M",n.push(g,h),j="l";break;case"M":g=k.shift(),h=k.shift(),m="M",n.push(g,h),j="L";break;case"h":g+=k.shift(),m="L",n.push(g,h);break;case"H":g=k.shift(),m="L",n.push(g,h);break;case"v":h+=k.shift(),m="L",n.push(g,h);break;case"V":h=k.shift(),m="L",n.push(g,h);break;case"C":n.push(k.shift(),k.shift(),k.shift(),k.shift()),g=k.shift(),h=k.shift(),n.push(g,h);break;case"c":n.push(g+k.shift(),h+k.shift(),g+k.shift(),h+k.shift()),g+=k.shift(),h+=k.shift(),m="C",n.push(g,h);break;case"S":var q=g,r=h,s=f[f.length-1];s.command==="C"&&(q=g+(g-s.points[2]),r=h+(h-s.points[3])),n.push(q,r,k.shift(),k.shift()),g=k.shift(),h=k.shift(),m="C",n.push(g,h);break;case"s":var q=g,r=h,s=f[f.length-1];s.command==="C"&&(q=g+(g-s.points[2]),r=h+(h-s.points[3])),n.push(q,r,g+k.shift(),h+k.shift()),g+=k.shift(),h+=k.shift(),m="C",n.push(g,h);break;case"Q":n.push(k.shift(),k.shift()),g=k.shift(),h=k.shift(),n.push(g,h);break;case"q":n.push(g+k.shift(),h+k.shift()),g+=k.shift(),h+=k.shift(),m="Q",n.push(g,h);break;case"T":var q=g,r=h,s=f[f.length-1];s.command==="Q"&&(q=g+(g-s.points[0]),r=h+(h-s.points[1])),g=k.shift(),h=k.shift(),m="Q",n.push(q,r,g,h);break;case"t":var q=g,r=h,s=f[f.length-1];s.command==="Q"&&(q=g+(g-s.points[0]),r=h+(h-s.points[1])),g+=k.shift(),h+=k.shift(),m="Q",n.push(q,r,g,h);break;case"A":var t=k.shift(),u=k.shift(),v=k.shift(),w=k.shift(),x=k.shift(),y=g,z=h;g=k.shift(),h=k.shift(),m="A",n=this.convertEndpointToCenterParameterization(y,z,g,h,w,x,t,u,v);break;case"a":var t=k.shift(),u=k.shift(),v=k.shift(),w=k.shift(),x=k.shift(),y=g,z=h;g+=k.shift(),h+=k.shift(),m="A",n=this.convertEndpointToCenterParameterization(y,z,g,h,w,x,t,u,v)}f.push({command:m||j,points:n,start:{x:o,y:p},pathLength:this.calcLength(o,p,m||j,n)})}(j==="z"||j==="Z")&&f.push({command:"z",points:[],start:undefined,pathLength:0})}return f},Kinetic.Path.calcLength=function(a,b,c,d){var e,f,g,h=Kinetic.Path;switch(c){case"L":return h.getLineLength(a,b,d[0],d[1]);case"C":e=0,f=h.getPointOnCubicBezier(0,a,b,d[0],d[1],d[2],d[3],d[4],d[5]);for(t=.01;t<=1;t+=.01)g=h.getPointOnCubicBezier(t,a,b,d[0],d[1],d[2],d[3],d[4],d[5]),e+=h.getLineLength(f.x,f.y,g.x,g.y),f=g;return e;case"Q":e=0,f=h.getPointOnQuadraticBezier(0,a,b,d[0],d[1],d[2],d[3]);for(t=.01;t<=1;t+=.01)g=h.getPointOnQuadraticBezier(t,a,b,d[0],d[1],d[2],d[3]),e+=h.getLineLength(f.x,f.y,g.x,g.y),f=g;return e;case"A":e=0;var i=d[4],j=d[5],k=d[4]+j,l=Math.PI/180;Math.abs(i-k)k;t-=l)g=h.getPointOnEllipticalArc(d[0],d[1],d[2],d[3],t,0),e+=h.getLineLength(f.x,f.y,g.x,g.y),f=g;else for(t=i+l;t1&&(g*=Math.sqrt(m),h*=Math.sqrt(m));var n=Math.sqrt((g*g*h*h-g*g*l*l-h*h*k*k)/(g*g*l*l+h*h*k*k));e==f&&(n*=-1),isNaN(n)&&(n=0);var o=n*g*l/h,p=n*-h*k/g,q=(a+c)/2+Math.cos(j)*o-Math.sin(j)*p,r=(b+d)/2+Math.sin(j)*o+Math.cos(j)*p,s=function(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1])},t=function(a,b){return(a[0]*b[0]+a[1]*b[1])/(s(a)*s(b))},u=function(a,b){return(a[0]*b[1]=1&&(y=0),f===0&&y>0&&(y-=2*Math.PI),f==1&&y<0&&(y+=2*Math.PI),[q,r,g,h,v,y,j,f]},Kinetic.Node.addGettersSetters(Kinetic.Path,["data"]),Kinetic.TextPath=function(a){this._initTextPath(a)},Kinetic.TextPath.prototype={_initTextPath:function(a){this.setDefaultAttrs({fontFamily:"Calibri",fontSize:12,fontStyle:"normal",detectionType:"path",text:""}),this.dummyCanvas=document.createElement("canvas"),this.shapeType="TextPath" +,this.dataArray=[];var b=this;a.drawFunc=this.drawFunc,Kinetic.Shape.call(this,a),this.dataArray=Kinetic.Path.parsePathData(this.attrs.data),this.on("dataChange",function(){b.dataArray=Kinetic.Path.parsePathData(this.attrs.data)});var c=["text","textStroke","textStrokeWidth"];for(var d=0;d0)return g=c,b[c];b[c].command=="M"&&(d={x:b[c].points[0],y:b[c].points[1]})}return{}},j=function(b,c){var g=a._getTextSize(b).width,j=0,k=0,l=!1;e=undefined;while(Math.abs(g-j)/g>.01&&k<25){k++;var m=j;while(f===undefined)f=i(),f&&m+f.pathLengthg?e=Kinetic.Path.getPointOnLine(g,d.x,d.y,f.points[0],f.points[1],d.x,d.y):f=undefined;break;case"A":var o=f.points[4],p=f.points[5],q=f.points[4]+p;h===0?h=o+1e-8:g>j?h+=Math.PI/180*p/Math.abs(p):h-=Math.PI/360*p/Math.abs(p),Math.abs(h)>Math.abs(q)&&(h=q,n=!0),e=Kinetic.Path.getPointOnEllipticalArc(f.points[0],f.points[1],f.points[2],f.points[3],h,f.points[6]);break;case"C":h===0?g>f.pathLength?h=1e-8:h=g/f.pathLength:g>j?h+=(g-j)/f.pathLength:h-=(j-g)/f.pathLength,h>1&&(h=1,n=!0),e=Kinetic.Path.getPointOnCubicBezier(h,f.start.x,f.start.y,f.points[0],f.points[1],f.points[2],f.points[3],f.points[4],f.points[5]);break;case"Q":h===0?h=g/f.pathLength:g>j?h+=(g-j)/f.pathLength:h-=(j-g)/f.pathLength,h>1&&(h=1,n=!0),e=Kinetic.Path.getPointOnQuadraticBezier(h,f.start.x,f.start.y,f.points[0],f.points[1],f.points[2],f.points[3])}e!==undefined&&(j=Kinetic.Path.getLineLength(d.x,d.y,e.x,e.y)),n&&(n=!1,f=undefined)}};for(var k=0;k 0 && $row[0] == '')) + return -1; + return $row[0]; + } + + function get_image_source_version_id($image_source_id,$source_version){ + $query = "select image_source_version_id from image_source_version where image_source_id='$image_source_id' and source_version='$source_version'"; + $row = getRowFromDB($query,"image source version id"); + if(count($row) == 0 || (count($row) > 0 && $row[0] == '')) + return -1; + return $row[0]; + } + + function save_image_source_version_information($image_source_id,$contact){ + $source_version = $contact['source_version']; + $publication_id = $contact['publication_id']; + $contribution_date = $contact['contribution_date']; + $mysqldate = date( 'Y-m-d H:i:s', $contribution_date ); + $contribution_date = strtotime( $mysqldate ); + + $id_from_db = get_image_source_version_id($image_source_id,$source_version); + if($id_from_db == -1){ + $query = "INSERT INTO image_source_version(image_source_id,source_version,contribution_date,publication_id) VALUES('$image_source_id','$source_version','$contribution_date','$publication_id')"; + $rsrcResult = mysql_query($query); + if (!$rsrcResult) { + echo "DB Error while trying to add new image source version information\n"; + echo 'MySQL Error: ' . mysql_error(); + exit(); + } + $id_from_db = get_image_source_version_id($image_source_id,$source_version); + } + return $id_from_db; + } + + $file = $_FILES['file']['tmp_name']; + $file_handle = fopen($file, "r"); + $contact = array(); + while (!feof($file_handle)) { + $line = fgets($file_handle); + $s = explode("\t",$line); + if($s[0] != "") + $contact[$s[0]] = $s[1]; + } + fclose($file_handle); + + if(count($contact) < 4 || $contact['source_name'] == '' || $contact['contributor_name'] == '' || $contact['contact_email'] == '' || $contact['contribution_date'] == ''){ + echo "Required information is missing. "; + } + else{ + $image_source_id = save_image_source_information($contact); + $image_source_version_id = save_image_source_version_information($image_source_id,$contact); + + if($image_source_id != -1 && $image_source_version_id != -1){ + echo "information saved successfully
"; + echo "Click here to upload annotated image data file"; + } + else{ + echo "Couldn't save information"; + exit(); + } + } + +?> diff --git a/image_annotation_db/ia_upload/data.html b/image_annotation_db/ia_upload/data.html new file mode 100755 index 0000000..8972814 --- /dev/null +++ b/image_annotation_db/ia_upload/data.html @@ -0,0 +1,18 @@ + + +Tool for uploading image annotation information + + +

Tool for uploading image annotation information

+

Step 2

+

Please upload the image annotation information file below

+


+
+ + +
+ +
+ + + diff --git a/image_annotation_db/ia_upload/index.html b/image_annotation_db/ia_upload/index.html new file mode 100755 index 0000000..1f3ded2 --- /dev/null +++ b/image_annotation_db/ia_upload/index.html @@ -0,0 +1,18 @@ + + +Tool for uploading image annotation information + + +

Tool for uploading image annotation information

+

Step 1

+

Please upload the contact information file below

+


+
+ + +
+ +
+ + + diff --git a/image_annotation_db/image_annotation.mwb b/image_annotation_db/image_annotation.mwb new file mode 100644 index 0000000..8ed60e1 Binary files /dev/null and b/image_annotation_db/image_annotation.mwb differ diff --git a/image_annotation_db/image_annotation.png b/image_annotation_db/image_annotation.png new file mode 100644 index 0000000..99d8db7 Binary files /dev/null and b/image_annotation_db/image_annotation.png differ diff --git a/image_annotation_db/image_annotation.sql b/image_annotation_db/image_annotation.sql new file mode 100644 index 0000000..34826e7 --- /dev/null +++ b/image_annotation_db/image_annotation.sql @@ -0,0 +1,168 @@ +SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; +SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; +SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL'; + +CREATE SCHEMA IF NOT EXISTS `image_annotation` DEFAULT CHARACTER SET latin1 ; +USE `image_annotation` ; + +-- ----------------------------------------------------- +-- Table `image_annotation`.`Species_map` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `image_annotation`.`Species_map` ; + +CREATE TABLE IF NOT EXISTS `image_annotation`.`Species_map` ( + `ubio_id` INT(11) NOT NULL , + `po_species_id` INT(11) NOT NULL , + PRIMARY KEY (`ubio_id`) , + INDEX `fk_Species_map_1` (`po_species_id` ASC) , + CONSTRAINT `fk_Species_map_1` + FOREIGN KEY (`po_species_id` ) + REFERENCES `po_beta`.`species` (`id` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `image_annotation`.`Annotated_term_type` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `image_annotation`.`Annotated_term_type` ; + +CREATE TABLE IF NOT EXISTS `image_annotation`.`Annotated_term_type` ( + `annotated_term_type_id` INT(11) NOT NULL , + `annotated_term_type` VARCHAR(45) NULL DEFAULT NULL , + PRIMARY KEY (`annotated_term_type_id`) ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `image_annotation`.`Annotated_term` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `image_annotation`.`Annotated_term` ; + +CREATE TABLE IF NOT EXISTS `image_annotation`.`Annotated_term` ( + `annotated_term_id` INT(11) NOT NULL , + `annotated_term` VARCHAR(45) NULL DEFAULT NULL , + `annotated_term_type_id` INT(11) NULL DEFAULT NULL , + `po_term_id` INT(11) NULL DEFAULT NULL , + PRIMARY KEY (`annotated_term_id`) , + INDEX `fk_Annotated Term_1` (`annotated_term_type_id` ASC) , + INDEX `fk_Annotated_term_2` (`po_term_id` ASC) , + CONSTRAINT `fk_Annotated Term_1` + FOREIGN KEY (`annotated_term_type_id` ) + REFERENCES `image_annotation`.`Annotated_term_type` (`annotated_term_type_id` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_Annotated_term_2` + FOREIGN KEY (`po_term_id` ) + REFERENCES `po_beta`.`term` (`id` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `image_annotation`.`Annotated_image` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `image_annotation`.`Annotated_image` ; + +CREATE TABLE IF NOT EXISTS `image_annotation`.`Annotated_image` ( + `annotated_image_id` INT(11) NOT NULL , + `image_path` VARCHAR(255) NULL DEFAULT NULL , + `curator` VARCHAR(45) NULL DEFAULT NULL , + `comments` VARCHAR(45) NULL DEFAULT NULL , + `annotated_term_id` INT(11) NULL DEFAULT NULL , + `ubio_id` INT(11) NULL DEFAULT NULL , + `ubio_name` VARCHAR(45) NULL DEFAULT NULL , + `species_name` VARCHAR(45) NULL DEFAULT NULL , + PRIMARY KEY (`annotated_image_id`) , + INDEX `fk_Annotated_image_1` (`ubio_id` ASC) , + INDEX `fk_Annotated_image_3` (`annotated_term_id` ASC) , + CONSTRAINT `fk_Annotated_image_1` + FOREIGN KEY (`ubio_id` ) + REFERENCES `image_annotation`.`Species_map` (`ubio_id` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_Annotated_image_3` + FOREIGN KEY (`annotated_term_id` ) + REFERENCES `image_annotation`.`Annotated_term` (`annotated_term_id` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `image_annotation`.`Annotated_keyword` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `image_annotation`.`Annotated_keyword` ; + +CREATE TABLE IF NOT EXISTS `image_annotation`.`Annotated_keyword` ( + `annotated_keyword_id` INT(11) NOT NULL , + `annotated_keyword` VARCHAR(45) NULL DEFAULT NULL , + PRIMARY KEY (`annotated_keyword_id`) ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `image_annotation`.`Annotated_keywordlist` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `image_annotation`.`Annotated_keywordlist` ; + +CREATE TABLE IF NOT EXISTS `image_annotation`.`Annotated_keywordlist` ( + `annotated_image_id` INT(11) NOT NULL , + `annotated_keyword_id` INT(11) NOT NULL , + PRIMARY KEY (`annotated_image_id`, `annotated_keyword_id`) , + INDEX `fk_Annotated_keywordlist_1` (`annotated_image_id` ASC) , + INDEX `fk_Annotated_keywordlist_2` (`annotated_keyword_id` ASC) , + CONSTRAINT `fk_Annotated_keywordlist_1` + FOREIGN KEY (`annotated_image_id` ) + REFERENCES `image_annotation`.`Annotated_image` (`annotated_image_id` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_Annotated_keywordlist_2` + FOREIGN KEY (`annotated_keyword_id` ) + REFERENCES `image_annotation`.`Annotated_keyword` (`annotated_keyword_id` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `image_annotation`.`Segment` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `image_annotation`.`Segment` ; + +CREATE TABLE IF NOT EXISTS `image_annotation`.`Segment` ( + `segment_id` INT(11) NOT NULL , + `color` VARCHAR(45) NULL DEFAULT NULL , + `annotated_image_id` INT(11) NULL DEFAULT NULL , + `byte_mask` BLOB NULL DEFAULT NULL , + `coordinates` LINESTRING NULL DEFAULT NULL , + `annotated_term_id` INT(11) NULL DEFAULT NULL , + PRIMARY KEY (`segment_id`) , + INDEX `fk_Segment_2` (`annotated_term_id` ASC) , + INDEX `fk_Segment_1` (`annotated_image_id` ASC) , + CONSTRAINT `fk_Segment_1` + FOREIGN KEY (`annotated_image_id` ) + REFERENCES `image_annotation`.`Annotated_image` (`annotated_image_id` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_Segment_2` + FOREIGN KEY (`annotated_term_id` ) + REFERENCES `image_annotation`.`Annotated_term` (`annotated_term_id` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + + +SET SQL_MODE=@OLD_SQL_MODE; +SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; +SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; diff --git a/image_annotation_db/image_annotation_v1.11.mwb b/image_annotation_db/image_annotation_v1.11.mwb new file mode 100644 index 0000000..a292898 Binary files /dev/null and b/image_annotation_db/image_annotation_v1.11.mwb differ diff --git a/image_annotation_db/image_annotation_v1.11.png b/image_annotation_db/image_annotation_v1.11.png new file mode 100644 index 0000000..a9eeaec Binary files /dev/null and b/image_annotation_db/image_annotation_v1.11.png differ diff --git a/image_annotation_db/image_annotation_v1_11_load.sql b/image_annotation_db/image_annotation_v1_11_load.sql new file mode 100644 index 0000000..e984040 --- /dev/null +++ b/image_annotation_db/image_annotation_v1_11_load.sql @@ -0,0 +1,220 @@ +SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; +SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; +SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL'; + +CREATE SCHEMA IF NOT EXISTS `image_annotation` DEFAULT CHARACTER SET latin1 ; +USE `image_annotation` ; + +-- ----------------------------------------------------- +-- Table `image_annotation`.`image_source` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `image_annotation`.`image_source` ; + +CREATE TABLE IF NOT EXISTS `image_annotation`.`image_source` ( + `image_source_id` INT NOT NULL AUTO_INCREMENT , + `source_name` VARCHAR(80) NULL , + `url` VARCHAR(255) NULL , + `contact_email` VARCHAR(80) NULL , + `contributor_name` VARCHAR(80) NULL , + PRIMARY KEY (`image_source_id`) ) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `image_annotation`.`image_source_version` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `image_annotation`.`image_source_version` ; + +CREATE TABLE IF NOT EXISTS `image_annotation`.`image_source_version` ( + `image_source_version_id` INT NOT NULL , + `image_source_id` INT NULL , + `source_version` VARCHAR(45) NULL , + `contribution_date` DATE NULL , + `publication_id` VARCHAR(45) NULL , + PRIMARY KEY (`image_source_version_id`) , + INDEX `fk_Image_source_version_1` (`image_source_id` ASC) , + CONSTRAINT `fk_Image_source_version_1` + FOREIGN KEY (`image_source_id` ) + REFERENCES `image_annotation`.`image_source` (`image_source_id` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `image_annotation`.`curator` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `image_annotation`.`curator` ; + +CREATE TABLE IF NOT EXISTS `image_annotation`.`curator` ( + `curator_id` INT NOT NULL AUTO_INCREMENT , + `firstname` VARCHAR(80) NULL , + `lastname` VARCHAR(80) NULL , + `primary_email` VARCHAR(80) NULL , + `alternate_email` VARCHAR(80) NULL , + `affiliation` VARCHAR(80) NULL , + PRIMARY KEY (`curator_id`) ) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `image_annotation`.`taxon` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `image_annotation`.`taxon` ; + +CREATE TABLE IF NOT EXISTS `image_annotation`.`taxon` ( + `taxon_id` INT NOT NULL AUTO_INCREMENT , + `species_id` VARCHAR(45) NULL , + `species_name` VARCHAR(80) NULL , + `common_name` VARCHAR(80) NULL , + `genus` VARCHAR(80) NULL , + `subspecies` VARCHAR(80) NULL , + PRIMARY KEY (`taxon_id`) ) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `image_annotation`.`annotated_image` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `image_annotation`.`annotated_image` ; + +CREATE TABLE IF NOT EXISTS `image_annotation`.`annotated_image` ( + `annotated_image_id` INT NOT NULL AUTO_INCREMENT , + `curator_id` INT NULL DEFAULT NULL , + `image_source_version_id` INT NULL , + `taxon_id` INT NULL DEFAULT NULL , + `annotated_image` LONGBLOB NULL , + `image_path` VARCHAR(255) NULL DEFAULT NULL , + `annotated_image_type` VARCHAR(45) NULL , + `timestamp` DATE NULL , + `software_name` VARCHAR(45) NULL , + `software_version` VARCHAR(32) NULL , + `comments` VARCHAR(255) NULL , + `ip_comment` VARCHAR(255) NULL , + `collection_location` VARCHAR(255) NULL , + `collection_date` DATE NULL , + `source_db_name` VARCHAR(45) NULL , + `source_db_id` INT(11) NULL , + `doi` VARCHAR(45) NULL , + PRIMARY KEY (`annotated_image_id`) , + INDEX `fk_Annotated_image_1` (`image_source_version_id` ASC) , + INDEX `fk_Annotated_image_3` (`curator_id` ASC) , + INDEX `fk_Annotated_image_2` (`taxon_id` ASC) , + CONSTRAINT `fk_Annotated_image_1` + FOREIGN KEY (`image_source_version_id` ) + REFERENCES `image_annotation`.`image_source_version` (`image_source_version_id` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_Annotated_image_3` + FOREIGN KEY (`curator_id` ) + REFERENCES `image_annotation`.`curator` (`curator_id` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_Annotated_image_2` + FOREIGN KEY (`taxon_id` ) + REFERENCES `image_annotation`.`taxon` (`taxon_id` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `image_annotation`.`annotated_term` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `image_annotation`.`annotated_term` ; + +CREATE TABLE IF NOT EXISTS `image_annotation`.`annotated_term` ( + `annotated_term_id` INT NOT NULL AUTO_INCREMENT , + `keyword` VARCHAR(80) NULL DEFAULT NULL , + `ontology_term_id` VARCHAR(80) NULL DEFAULT NULL , + `ontology_term_name` VARCHAR(80) NULL DEFAULT NULL , + `isKeyword` BIT NULL , + PRIMARY KEY (`annotated_term_id`) ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `image_annotation`.`segment` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `image_annotation`.`segment` ; + +CREATE TABLE IF NOT EXISTS `image_annotation`.`segment` ( + `segment_id` INT NOT NULL AUTO_INCREMENT , + `annotated_image_id` INT NULL , + `color` VARCHAR(40) NULL DEFAULT NULL , + `byte_mask` LONGBLOB NULL DEFAULT NULL , + `coordinates` LINESTRING NULL DEFAULT NULL , + PRIMARY KEY (`segment_id`) , + INDEX `fk_Segment_1` (`annotated_image_id` ASC) , + CONSTRAINT `fk_Segment_1` + FOREIGN KEY (`annotated_image_id` ) + REFERENCES `image_annotation`.`annotated_image` (`annotated_image_id` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `image_annotation`.`annotated_term_image` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `image_annotation`.`annotated_term_image` ; + +CREATE TABLE IF NOT EXISTS `image_annotation`.`annotated_term_image` ( + `annotated_term_image_id` INT NOT NULL AUTO_INCREMENT , + `annotated_term_id` INT NULL , + `annotated_image_id` INT NULL , + PRIMARY KEY (`annotated_term_image_id`) , + INDEX `fk_Annotated_term_image_2` (`annotated_term_id` ASC) , + INDEX `fk_Annotated_term_image_1` (`annotated_image_id` ASC) , + CONSTRAINT `fk_Annotated_term_image_2` + FOREIGN KEY (`annotated_term_id` ) + REFERENCES `image_annotation`.`annotated_term` (`annotated_term_id` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_Annotated_term_image_1` + FOREIGN KEY (`annotated_image_id` ) + REFERENCES `image_annotation`.`annotated_image` (`annotated_image_id` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `image_annotation`.`annotated_term_segment` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `image_annotation`.`annotated_term_segment` ; + +CREATE TABLE IF NOT EXISTS `image_annotation`.`annotated_term_segment` ( + `annotated_term_segment_id` INT NOT NULL AUTO_INCREMENT , + `segment_id` INT NULL , + `annotated_term_id` INT NULL , + `trait_term_id` INT NULL , + PRIMARY KEY (`annotated_term_segment_id`) , + INDEX `fk_Annotated_term_segment_1` (`annotated_term_id` ASC) , + INDEX `fk_Annotated_term_segment_2` (`segment_id` ASC) , + INDEX `fk_Annotated_term_segment_3` (`trait_term_id` ASC) , + CONSTRAINT `fk_Annotated_term_segment_1` + FOREIGN KEY (`annotated_term_id` ) + REFERENCES `image_annotation`.`annotated_term` (`annotated_term_id` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_Annotated_term_segment_2` + FOREIGN KEY (`segment_id` ) + REFERENCES `image_annotation`.`segment` (`segment_id` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_Annotated_term_segment_3` + FOREIGN KEY (`trait_term_id` ) + REFERENCES `image_annotation`.`annotated_term` (`annotated_term_id` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + + +SET SQL_MODE=@OLD_SQL_MODE; +SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; +SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;