Mercurial > MadButterfly
comparison nodejs/svg.js @ 1414:036f2b447860
Merge
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Wed, 06 Apr 2011 14:37:34 +0800 |
parents | c918b79892ab |
children | 6fa411fd9549 13e126941bdd |
comparison
equal
deleted
inserted
replaced
1413:b8dfa491ed9d | 1414:036f2b447860 |
---|---|
1035 n = this._groupMap[id]; | 1035 n = this._groupMap[id]; |
1036 var m = [1,0,0,1,0,0] | 1036 var m = [1,0,0,1,0,0] |
1037 this.parseGroup(m,root,id, n) | 1037 this.parseGroup(m,root,id, n) |
1038 } | 1038 } |
1039 | 1039 |
1040 function getName(n) | |
1041 { | |
1042 var attr = n.attr('mbname'); | |
1043 var name; | |
1044 | |
1045 if (attr) { | |
1046 name = attr.value(); | |
1047 if (name != '') return name; | |
1048 } | |
1049 attr = n.attr('label'); | |
1050 | |
1051 if (attr) { | |
1052 name = attr.value(); | |
1053 if (name != '') return name; | |
1054 } | |
1055 attr = n.attr('id'); | |
1056 | |
1057 if (attr) { | |
1058 name = attr.value(); | |
1059 if (name != '') return name; | |
1060 } | |
1061 | |
1062 return ''; | |
1063 | |
1064 } | |
1065 | |
1040 loadSVG.prototype._check_duplicate_src=function(n,coord) { | 1066 loadSVG.prototype._check_duplicate_src=function(n,coord) { |
1041 var id = n.attr('id'); | 1067 var id = getName(n); |
1042 coord.id = id; | |
1043 if (id) { | 1068 if (id) { |
1044 coord.id = id.value(); | 1069 coord.id = id; |
1070 coord.refid = id; | |
1045 } else { | 1071 } else { |
1046 coord.id = "NA"; | 1072 coord.id = "NA"; |
1073 coord.refid ="NA"; | |
1047 } | 1074 } |
1048 if (n.name()=="use") { | 1075 if (n.name()=="use") { |
1049 n.coord.isuse = true | 1076 n.coord.isuse = true |
1050 } else { | 1077 } else { |
1051 n.coord.isuse = false; | 1078 n.coord.isuse = false; |
1059 try { | 1086 try { |
1060 if (this.mb_rt.mbnames[id].target) { | 1087 if (this.mb_rt.mbnames[id].target) { |
1061 sys.puts("duplicated"); | 1088 sys.puts("duplicated"); |
1062 } | 1089 } |
1063 this.mb_rt.mbnames[id].target = coord; | 1090 this.mb_rt.mbnames[id].target = coord; |
1091 coord.refid = this.mb_rt.mbnames[id].id; | |
1064 } catch(e) { | 1092 } catch(e) { |
1065 sys.puts("id "+id+" is not defined"); | 1093 sys.puts("id "+id+" is not defined"); |
1066 } | 1094 } |
1067 } | 1095 } |
1068 | 1096 |