/** * @class Aerial上に表示するイメージアイコンクラス */ function AerialIcon(){ var self = this; /** * アイコンの位置座標 * @type AerialPoint */ this.point = null; /** * アイコン画像の幅 * @type int */ this.width = AerialCom.defaultIconWidth; /** * アイコン画像の高さ * @type int */ this.height = AerialCom.defaultIconHeight; /** * アイコン画像のURI * @type string */ this.src = null; /** * アイコンのドキュメントエレメントID * @type string */ this.id = null; /** * アイコンの座標に対応するアイコン画像上の位置 * @type int * @example 0:中心 1:左上 2:中央上 3:右上 4:右中央 5:右下 6:中央下 7:左下 8:左中央 */ this.positionType = 0; /** * アイコンの名称 * @type string */ this.name = null; /** * 表示優先度 * @type int */ this.priority = 0; /** * アイコンをマウスオーバーした際に実行する関数 * @type function */ this.onMouseOver = null; /** * アイコンからマウスアウトした際に実行する関数 * @type function */ this.onMouseOut = null; /** * アイコンをクリックした際に実行する関数 * @type function */ this.onClick = null; /** * @private * @function * @returns {DocumentElement} アイコンのドキュメントエレメント */ this.createElement = createElement; function createElement(){ var img = document.createElement('img'); var is = img.style; var msg; is.border = 'none'; is.margin = '0px'; is.padding= '0px'; is.cursor = 'pointer'; img.src = self.src; if(self.width && self.height){ // nothing to do... } else{ self.width = AerialCom.defaultIconWidth; self.height = AerialCom.defaultIconHeight; } img.onmouseover = mOver; img.onmouseout = mOut; img.onclick = mClick; is.width = self.width + 'px'; is.height = self.height+ 'px'; // if transparent PNG and old IE(5.5/6.0) if (/MSIE (5\.5|6\.)/.test(navigator.userAgent) && /.\png/.test(self.src.toLowerCase())){ img.src = AerialCom.transImgSrc; img.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+self.src+'\', sizingMethod=\'scale\')'; } return img; function mOver(){ if(!self.name) return; msg = document.createElement('div'); var t = document.createElement('div'); var s = document.createElement('div'); var ms = msg.style; var ts = t.style; var ss = s.style; ts.fontSize = '14px'; ts.border = 'none'; ts.margin = '0px'; ts.padding = '5px'; ts.position = 'absolute'; ts.color = AerialCom.mainFontColor; ts.backgroundColor = AerialCom.mainBackColor; ss.backgroundColor = '#000000'; ss.height = '10px'; ss.position = 'absolute'; ss.top = '10px'; ss.left = '10px'; ss.filter = 'alpha(opacity=' + 30 + ')'; ss.opacity = 0.3; var x = parseInt(img.style.left); var y = parseInt(img.style.top); ms.position = 'absolute'; ms.top = y - parseInt(img.style.height) + 'px'; ms.left = x + parseInt(img.style.width) + 'px'; t.innerHTML = '' + self.name + ''; s.innerHTML = t.innerHTML; img.parentNode.appendChild(msg); msg.appendChild(s); msg.appendChild(t); if(self.onMouseOver) self.onMouseOver(); } function mOut(){ if(msg){ img.parentNode.removeChild(msg); msg = null; } if(self.onMouseOut) self.onMouseOut(); } function mClick(){ if(self.onClick) self.onClick(); } } } /** * @private * @class Aerial上に表示するHTMLアイコンクラス */ function AerialCustomIcon(){ var self = this; /** * アイコンの位置座標 * @type AerialPoint */ this.point = null; /** * アイコンの幅 * @type int */ this.width = AerialCom.defaultIconWidth; /** * アイコンの高さ * @type int */ this.height = AerialCom.defaultIconHeight; /** * アイコンのHTMLソース * @type string */ this.src = null; /** * アイコンのドキュメントエレメントID * @type string */ this.id = null; /** * アイコンの座標に対応するアイコン画像上の位置 * @type int * @example 0:中心 1:左上 2:中央上 3:右上 4:右中央 5:右下 6:中央下 7:左下 8:左中央 */ this.positionType = 0; /** * アイコンの名称 * @type string */ this.name = null; /** * 表示優先度 * @type int */ this.priority = 0; /** * アイコンをマウスオーバーした際に実行する関数 * @type function */ this.onMouseOver = null; /** * アイコンからマウスアウトした際に実行する関数 * @type function */ this.onMouseOut = null; /** * アイコンをクリックした際に実行する関数 * @type function */ this.onClick = null; /** * @private * @function * @returns {DocumentElement} アイコンのドキュメントエレメント */ this.createElement = createElement; function createElement(){ var div = document.createElement('div'); var ds = div.style; ds.border = 'none'; ds.margin = '0px'; ds.padding= '0px'; //ds.cursor = 'pointer'; div.innerHTML = self.src; if(self.width && self.height){ // nothing to do... } else{ self.width = AerialCom.defaultIconWidth; self.height = AerialCom.defaultIconHeight; } div.onmouseover = mOver; div.onmouseout = mOut; div.onclick = mClick; ds.width = self.width + 'px'; ds.height = self.height+ 'px'; return div; function mOver(){ } function mOut(){ if(self.onMouseOut) self.onMouseOut(); } function mClick(){ if(self.onClick) self.onClick(); } } }