Best JavaScript code snippet using testcafe
FigureControlFun.js
Source:FigureControlFun.js
1//FigureCntrol internal Functinos---------------------------------------------------------------2function InitFigureControl() //åå§åæ§ä»¶åæ°3{4 this.m_fZoomNum=1; //å¾å½¢æ¾å¤§åæ° 5 this.m_cpCurrentPoint_cursor.x=0; //å½åé¼ æ ä½ç½®6 this.m_cpCurrentPoint_cursor.y=0;7 this.m_cpOriginalPoint_cursor.x=0; //æè¿ä¸æ¬¡é¼ æ å·¦é®ç¹å»çä½ç½®8 this.m_cpOriginalPoint_cursor.y=0;9 this.m_cpDistancePoint.x=0; //å·¦é®ç¹å»é¼ æ åå移çä½ç½®10 this.m_cpDistancePoint.y=0;11 this.OriginalPoint_Bitmap.x=0;//50; //åæ åç¹ä½ç½®12 this.OriginalPoint_Bitmap.y=0;//10; 13 this.m_MovePoint_cursor.x=0; //å½åé¼ æ 移å¨å°çä½ç½®14 this.m_MovePoint_cursor.y=0; 15 this.b_SubFiguresMove=true; //æ¯å¦ç§»å¨å¾å½¢å½¢16 this.b_SubFiguresZoom=false; //éæ¾ç¼©æ¾å¾å½¢ 17 this.b_LButtonDouC=false; //æ¯å¦è¿å¤äºå·¦é®åå»ç¶æ18 this.m_CurrentDistance.x=0; //åæ 平移è·ç¦»19 this.m_CurrentDistance.y=0;20 this.m_nFigureCount=0; //å¾å½¢ä¸ªæ°21 this.m_nCursorInFigureId=0; //é¼ æ æå¨å¾å½¢ID22 this.SelectFigureId=0;23 this.m_nNextFigureIndex=0;24 this.b_DrawCircle=false;25 this.b_DrawDoubleRect=false;26 this.b_DrawPoly=false;27 this.b_DrawRect=false;28 this.b_PreDrawRect=false; //åå¤ç»å¶æ¹æ¡29 this.b_PreDrawCircle=false;30 this.b_PreDrawDoubleRect=false; 31 this.b_FigurePointSelect=false;32 this.m_nScrollRate=0;33 this.CurrentFigure.shift_x=0;34 this.CurrentFigure.shift_y=0;35 this.m_CurrentFillStyle=0;36 this.b_ChangeFigureValue=false; 37 this.m_PositionLabel.x=0;38 this.m_PositionLabel.y=0;39 this.b_InitShiftToCenter=true;40 this.b_ShowPositionLabel=false;41 this.b_LeftButtonDown=false;42 this.b_LoadData=false;43 this.b_ChangeFigureSize=true;44 this.b_ChooseDRectType=false;45 this.m_RectFigure.top=0;46 this.m_RectFigure.bottom=0;47 this.m_RectFigure.right=0;48 this.m_RectFigure.left=0; 49 this.m_ClientRect.top=0;50 this.m_ClientRect.bottom=0;51 this.m_ClientRect.left=0;52 this.m_ClientRect.right=0;53 this.x_Distance=0;54 this.y_Distance=0;55 this.b_ProcessImageFromDc=false;56 this.b_CursorInOutSide=true;57 this.m_bRGBBufferFill=false;58 this.b_ShowPointRect=true;59 this.b_MoveAllFigures=false;60 61 if (this.m_SelectSubFigureRectIdSet.m_nFigureRectCount>0)62 {63 this.m_SelectSubFigureRectIdSet.ClearFigureRectData();64 }65 if (this.m_TempLinesPointSet.nCPointCount>0)66 {67 this.m_TempLinesPointSet.ClearData();68 }69 if (this.m_FiguresSet.m_nFigureCount>0)70 {71 this.m_FiguresSet.ClearFigureSetData();72 }73 74 this.m_CurrentImageObject.m_pImgBuf=null; 75 this.m_TransparentBackgroundColor=0;76 this.m_nControlWidth=0;77 this.m_nControlHeight=0;78 this.FinishDrawNotice=null;79 this.m_csCurrentDrawFigureName="";80 this.m_OutsideLineColor="rgb(255,255,255)";81 this.b_ShowOutSideLine=false; 82 83 return true; 84} 85function RepaintControl() //æ§ä»¶éç» CPaintDC*86{87 if(this.b_LoadData==false)88 {89 return;90 } 91 92 this.m_Context.clearRect(0,0,this.m_Canvas.width,this.m_Canvas.height);93 this.m_RectFigure.left=0;94 this.m_RectFigure.right=this.m_Image.width;95 this.m_RectFigure.top=0;96 this.m_RectFigure.bottom=this.m_Image.height; 97 this.m_Context.drawImage(this.m_Image,0,0,this.m_Image.width,this.m_Image.height,98 this.OriginalPoint_Bitmap.x,this.OriginalPoint_Bitmap.y,99 this.m_Image.width*this.m_fZoomNum,100 this.m_Image.height*this.m_fZoomNum);101//å¾å大å°æ¡102 this.DrawOutSideLine();103//æ¤å¤æ¾ç¤ºå¾åä¸å±çåç§å¾å½¢å½¢ 104 if (this.m_FiguresSet.m_nFigureCount>0)105 { 106 var FindIterator=new Figure ; 107 for(var index=0;index<this.m_FiguresSet.m_nFigureCount;index++)108 { 109 this.DrawFigure(this.m_FiguresSet.m_Figures[index]); 110 } 111 } 112//ç»å®æ¶æ£å¨ç»ççº¿æ¡ 113 this.drawTempLines(); 114//æ¾ç¤ºå
¶ä»å¾å½¢ä¿¡æ¯115 this.ShowOtherFigures();116 117 118 119}120// FigureData121function ConnectLine(data) //æ线ç»æçå¾å½¢å½¢è¿çº¿122{123 var MovePoint=new CPoint(0,0);124 var In_OriginalPoint_cursor=new CPoint(0,0); 125 PointEqual(MovePoint,this.OriginalPoint_Bitmap); 126 var nCurrentPointIndex=0,nPointIndex=0;127//移å¨å°èµ·å§ç¹128 var FindIterator=new CPoint(0,0);129 if (data.figure_data.nCPointCount==0)130 {131 return;132 } 133 FindIterator=data.figure_data.m_CPoint[0];134 nCurrentPointIndex++;135 136 //æ¾ç¤ºç¬¬ä¸ä¸ªå°æ¹æ¡137 if ((data.figure_id==this.m_nCursorInFigureId || data.figure_id== this.SelectFigureId) && this.b_ShowPointRect)138 {139 var point=new CPoint(0,0);140 point.x=GetIntValue(FindIterator.x*this.m_fZoomNum)+MovePoint.x+data.shift_x;141 point.y=GetIntValue(FindIterator.y*this.m_fZoomNum)+MovePoint.y+data.shift_y;142 this.DrawPointRect(point,0); 143 } 144 this.m_Context.strokeStyle =data.figure_color;145 this.m_Context.beginPath();146 this.m_Context.moveTo(GetIntValue(FindIterator.x*this.m_fZoomNum)+MovePoint.x+data.shift_x,GetIntValue(FindIterator.y*this.m_fZoomNum)+MovePoint.y+data.shift_y); 147 this.m_Context.stroke();148 149 if (data.figure_type==RectType)150 {151 data.figure_rect.left=FindIterator.x;152 data.figure_rect.top=FindIterator.y;153 }154//æ¾ç¤ºå¾å½¢å155 var rect=new CRect(0,0,0,0);156 this.m_Context.strokeStyle =data.figure_color;157 158 rect.left=5+GetIntValue(FindIterator.x*this.m_fZoomNum)+MovePoint.x+data.shift_x;159 rect.right=rect.left+FigureControl_TextLength;160 rect.top=GetIntValue(FindIterator.y*this.m_fZoomNum)+MovePoint.y+data.shift_y;161 rect.bottom=rect.top+FigureControl_TextLength;162 163 164 this.m_Context.fillText(data.figure_name,rect.left,rect.top); 165 166//对ææç¹è¿çº¿ 167 nPointIndex++;168 var TempColorNum=0;169 for (nPointIndex;nPointIndex<data.figure_data.nCPointCount;nPointIndex++)170 { 171 FindIterator=data.figure_data.m_CPoint[nPointIndex];172 if (nCurrentPointIndex==3)173 {174 data.figure_rect.right=FindIterator.x; 175 data.figure_rect.bottom=FindIterator.y;176 }177 //è¿çº¿178 this.m_Context.strokeStyle =data.figure_color;179 this.m_Context.lineTo(GetIntValue(FindIterator.x*this.m_fZoomNum)+MovePoint.x+data.shift_x,180 GetIntValue(FindIterator.y*this.m_fZoomNum)+MovePoint.y+data.shift_y);181 this.m_Context.stroke(); 182 }183 FindIterator=data.figure_data.m_CPoint[0]; 184 this.m_Context.strokeStyle =data.figure_color;185 this.m_Context.lineTo(GetIntValue(FindIterator.x*this.m_fZoomNum)+MovePoint.x+data.shift_x,186 GetIntValue(FindIterator.y*this.m_fZoomNum)+MovePoint.y+data.shift_y);187 this.m_Context.stroke();188 189 190 nPointIndex=1;191 //æ¾ç¤ºå°æ¹æ¡ 192 for (nPointIndex;nPointIndex<data.figure_data.nCPointCount;nPointIndex++)193 { 194 FindIterator=data.figure_data.m_CPoint[nPointIndex];195 nCurrentPointIndex++; 196 if (nCurrentPointIndex==3)197 {198 data.figure_rect.right=FindIterator.x; 199 data.figure_rect.bottom=FindIterator.y;200 } 201 if ((data.figure_id==this.m_nCursorInFigureId || data.figure_id== this.SelectFigureId) && this.b_ShowPointRect)202 { 203 var point=new CPoint(0,0);204 point.x=GetIntValue(FindIterator.x*this.m_fZoomNum)+MovePoint.x+data.shift_x;205 point.y=GetIntValue(FindIterator.y*this.m_fZoomNum)+MovePoint.y+data.shift_y;206 this.DrawPointRect(point,(++TempColorNum)%2);207 if (data.figure_type==RectType && !data.bShowSqure)208 {209 if (nCurrentPointIndex==2)210 {211 point.x=GetIntValue((FindIterator.x-data.figure_rect.Width()/2.0)*this.m_fZoomNum)+MovePoint.x+data.shift_x;212 point.y=GetIntValue(FindIterator.y*this.m_fZoomNum)+MovePoint.y+data.shift_y;213 this.DrawPointRect(point,2);214 }215 if (nCurrentPointIndex==3)216 {217 point.x=GetIntValue(FindIterator.x*this.m_fZoomNum)+MovePoint.x+data.shift_x;218 point.y=GetIntValue((FindIterator.y-data.figure_rect.Height()/2.0)*this.m_fZoomNum)+MovePoint.y+data.shift_y;219 this.DrawPointRect(point,2);220 } 221 222 if (nCurrentPointIndex==4)223 {224 point.x=GetIntValue((FindIterator.x+data.figure_rect.Width()/2.0)*this.m_fZoomNum)+MovePoint.x+data.shift_x;225 point.y=GetIntValue(FindIterator.y*this.m_fZoomNum)+MovePoint.y+data.shift_y;226 this.DrawPointRect(point,2);227 point.x=GetIntValue(FindIterator.x*this.m_fZoomNum)+MovePoint.x+data.shift_x;228 point.y=GetIntValue((FindIterator.y-data.figure_rect.Height()/2.0)*this.m_fZoomNum)+MovePoint.y+data.shift_y;229 this.DrawPointRect(point,2);230 }231 232 }233 } 234 }235 236 237 238 239 if ((data.figure_id==this.m_nCursorInFigureId || data.figure_id== this.SelectFigureId)240 && this.b_LeftButtonDown && data.figure_type==RectType && data.bShowSqure)241 {242 var pt=new CPoint(GetIntValue(data.figure_rect.right*this.m_fZoomNum+MovePoint.x+data.shift_x-243 (data.figure_rect.right-data.figure_rect.left)*this.m_fZoomNum/2.0),244 GetIntValue(data.figure_rect.bottom*this.m_fZoomNum+MovePoint.y+data.shift_y-245 (data.figure_rect.bottom-data.figure_rect.top)/2.0*this.m_fZoomNum));246 247 this.DrawPointRect(pt,2);248 } 249 250}251function DrawFigure(data)//ç»å¶å¾å½¢252{253 //å¡«å
å¾å½¢254 this.FillFigureRect(data);255 //å¾å½¢å¨è¾¹çº¿æ¡256 if (data.figure_type==CircleType)257 {258 this.DrawEllipseRect(data);259 }260 else if (data.figure_type==DrectType)261 {262 this.DrawDoubleRect(data);263 }264 else265 {266 this.ConnectLine(data); 267 }268}269function FillFigureRect(data) //å¡«å
å¾å½¢ 270{271 if (data.figure_fill.b_fill==true)272 { 273 //å¡«å
å¤è¾¹å½¢274 if (data.figure_type==PolyType ||data.figure_type==RectType)275 {276 var PointCount=data.figure_data.m_nFigureRectCount();277 var points=new Array(PointCount);278 for(var n=0;n<PointCount;n++)279 points[n]=new CPoint(0,0);280 281 var FindIterator=new CPoint(0,0);282 var FindPointIndex=0;283 var i=0;284 for (;FindPointIndex < PointCount;FindPointIndex++)285 {286 FindIterator=data.figure_data.m_CPoint[FindPointIndex]287 288 points[i].x=GetIntValue(FindIterator.x*this.m_fZoomNum+this.OriginalPoint_Bitmap.x)+data.shift_x;289 points[i].y=GetIntValue(FindIterator.y*this.m_fZoomNum+this.OriginalPoint_Bitmap.y)+data.shift_y; 290 i++;291 }292 293 294 this.m_Context.fillStyle=data.figure_fill.figure_color;295 296 //int oldrop2=cdc.SetROP2(data.figure_fill.FillStyle);297 //cdc.Polygon(points,PointCount); 298 //cdc.SetROP2(oldrop2); 299 300 } 301 //å¡«å
åå½¢302 else if (data.figure_type==CircleType)303 { 304 var TempFillRect=new CRect(0,0,0,0);305 TempFillRect.left=GetIntValue(data.figure_rect.left*this.m_fZoomNum+this.OriginalPoint_Bitmap.x)+data.shift_x;306 TempFillRect.right=GetIntValue(data.figure_rect.right*this.m_fZoomNum+this.OriginalPoint_Bitmap.x)+data.shift_x;307 TempFillRect.top=GetIntValue(data.figure_rect.top*this.m_fZoomNum+this.OriginalPoint_Bitmap.y)+data.shift_y;308 TempFillRect.bottom=GetIntValue(data.figure_rect.bottom*this.m_fZoomNum+this.OriginalPoint_Bitmap.y)+data.shift_y;309 310 var xPostion=TempFillRect.left+(TempFillRect.right-TempFillRect.left)/2.0;311 var YPostion=TempFillRect.top+(TempFillRect.bottom-TempFillRect.top)/2.0;312 313 this.m_Context.fillStyle=data.figure_fill.figure_color; 314 315 this.m_Context.arc(GetIntValue(xPostion),GetIntValue(YPostion),316 GetIntValue((TempFillRect.right-TempFillRect.left)/2.0),317 0, Math.PI * 2,false); 318 319 } 320 else if (data.figure_type==DrectType)321 {322 var TempFillRect=new CRect(0,0,0,0);323 TempFillRect.left=GetIntValue(data.figure_rect.left*this.m_fZoomNum+this.OriginalPoint_Bitmap.x)+data.shift_x;324 TempFillRect.right=GetIntValue(data.figure_rect.right*this.m_fZoomNum+this.OriginalPoint_Bitmap.x)+data.shift_x;325 TempFillRect.top=GetIntValue(data.figure_rect.top*this.m_fZoomNum+this.OriginalPoint_Bitmap.y)+data.shift_y;326 TempFillRect.bottom=GetIntValue(data.figure_rect.bottom*this.m_fZoomNum+this.OriginalPoint_Bitmap.y)+data.shift_y;327 var points=new Array(4);328 for(var i=0;i<4;i++)329 points[i]=new CPoint(0,0);330 points[0].x=TempFillRect.left;331 points[0].y=TempFillRect.top;332 points[1].x=TempFillRect.right;333 points[1].y=TempFillRect.top;334 points[2].x=TempFillRect.right;335 points[2].y=TempFillRect.bottom;336 points[3].x=TempFillRect.left;337 points[3].y=TempFillRect.bottom;338 339 this.m_Context.fillStyle=data.figure_fill.figure_color;340 }341 } 342 return;343}344function drawTempLines() //å®æ¶æ¾ç¤ºæ£å¨ç»ç线æ¡345{346 if (this.m_TempLinesPointSet.nCPointCount==0)347 {348 return;349 } 350 //list<CPoint >::iterator FindIterator;351 var FindIterator=new CPoint(0,0);352 var FindPointIndex=0;353 354 FindIterator=this.m_TempLinesPointSet.m_CPoint[FindPointIndex];355 356 this.m_Context.beginPath();357 this.m_Context.fillStyle = "green";358 this.m_Context.arc(FindIterator.x,FindIterator.y,FigureControl_Radius,Math.PI * 2,false);359 this.m_Context.moveTo(FindIterator.x,FindIterator.y); 360 361 362 FindIterator=this.m_TempLinesPointSet.m_CPoint[++FindPointIndex];363 364 this.m_Context.fillStyle = "rgb(255,255,0)";365 366 for (FindPointIndex;FindPointIndex<this.m_TempLinesPointSet.nCPointCount;FindPointIndex++)367 {368 FindIterator=this.m_TempLinesPointSet.m_CPoint[FindPointIndex];369 370 this.m_Context.lineTo(FindIterator.x,FindIterator.y); 371 }372 this.m_Context.stroke();373}374function DrawOutSideLine() //å¾åå¤å´æ¡ 375{}376function InSubFigureRect(point,beginPoint,endPoint)//ç¹æ¯å¦å¨ç´æ¥æå®èå´å
377{378 var k=0.0;//ç´çº¿æç379 if (endPoint.x-beginPoint.x!=0)380 {381 k=((endPoint.y-beginPoint.y)*1.0/(endPoint.x-beginPoint.x));382 }383 else384 k=0;385 var y=GetIntValue((k*(point.x-endPoint.x)))+endPoint.y;386 if ( y>=point.y && point.x>=minValue(endPoint.x,beginPoint.x) && point.x<maxValue(endPoint.x,beginPoint.x)) 387 {388 return true;389 } 390 else391 {392 return false;393 }394}395function InEllipseRect(rect,point)//ç¹æ¯å¦å¨ååºåå
396{397 var a=0.0,b=0.0, x0=0.0,y0=0.0; 398 //æ¤åç¦ç¹å¨Xè½´ä¸399 if (rect.Width()>=rect.Height())400 {401 a=maxValue(GetIntValue(rect.Height()/2.0),GetIntValue(rect.Width()/2.0));402 b=minValue(GetIntValue(rect.Height()/2.0),GetIntValue(rect.Width()/2.0));403 x0=GetIntValue(rect.right-rect.Width()/2.0); 404 y0=GetIntValue(rect.bottom-rect.Height()/2.0); 405 var tempvalue=0.0;406 tempvalue=Math.pow(b,2)-Math.pow(b/a,2)*Math.pow((point.x-x0),2);407 if (tempvalue<0)408 {409 return false;410 }411 tempvalue=Math.pow(tempvalue,0.5);412 var y1=0.0,y2=0.0;413 y1=y0+tempvalue;414 y2=y0-tempvalue;415 if ((y1>=point.y&& y2<=point.y) || (y1<=point.y && y2>=point.y))416 {417 return true;418 }419 else420 {421 return false;422 }423 }424 else//æ¤åç¦ç¹å¨Yè½´ä¸425 {426 a=maxValue(GetIntValue(rect.Height()/2.0),GetIntValue(rect.Width()/2.0));427 b=minValue(GetIntValue(rect.Height()/2.0),GetIntValue(rect.Width()/2.0));428 x0=GetIntValue((rect.right-rect.Width()/2.0)); 429 y0=GetIntValue((rect.bottom-rect.Height()/2.0)); 430 var tempvalue=0.0;431 tempvalue=Math.pow(a,2)-Math.pow(a/b,2)*Math.pow((point.x-x0),2);432 if (tempvalue<0)433 {434 return false;435 }436 tempvalue=Math.pow(tempvalue,0.5);437 var y1=0.0,y2=0.0;438 y1=y0+tempvalue;439 y2=y0-tempvalue;440 if ((y1>=point.y&& y2<=point.y) || (y1<=point.y && y2>=point.y))441 {442 return true;443 }444 else445 {446 return false;447 }448 }449}450function DrawRect(rect)//ç»æ¹æ¡åºå451{ 452 this.m_Context.beginPath();453 this.m_Context.moveTo(rect.left,rect.top);454 this.m_Context.lineTo(rect.right,rect.top);455 this.m_Context.lineTo(rect.right,rect.bottom);456 this.m_Context.lineTo(rect.left,rect.bottom);457 this.m_Context.lineTo(rect.left,rect.top); 458 this.m_Context.stroke();459}460function DrawEllipseRect(data)//ç»å461{462 var rect=new CRect(0,0,0,0);463 rect.left=GetIntValue(data.figure_rect.left*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+data.shift_x;464 rect.right=GetIntValue(data.figure_rect.right*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+data.shift_x;465 rect.top=GetIntValue(data.figure_rect.top*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+data.shift_y;466 rect.bottom=GetIntValue(data.figure_rect.bottom*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+data.shift_y;467 468 469 var x=rect.GetCenter().x;470 var y=rect.GetCenter().y;471 var a=rect.Width()/2.0;472 var b=rect.Height()/2.0;473 474 var r = (a > b) ? a : b;475 var ratioX = a / r;476 var ratioY = b / r;477 478 this.m_Context.save();479 this.m_Context.scale(ratioX, ratioY);480 this.m_Context.beginPath();481 this.m_Context.strokeStyle =data.figure_color;482 this.m_Context.arc(x / ratioX, y / ratioY, r, 0, 2 * Math.PI, false);483 this.m_Context.stroke();484 //this.m_Context.closePath();485 this.m_Context.restore();486 //this.m_Context.fill();487 488 //ç»å°æ¹æ¡489 if ((data.figure_id==this.m_nCursorInFigureId || data.figure_id== this.SelectFigureId)&& this.b_ShowPointRect)490 {491 var point=new CPoint(0,0);492 point.x=rect.left+GetIntValue((rect.right-rect.left)/2);493 point.y=rect.top;494 this.DrawPointRect(point,0); 495 point.x=rect.right;496 point.y=rect.top+GetIntValue((rect.bottom-rect.top)/2);497 this.DrawPointRect(point,1); 498 point.x=rect.left+GetIntValue((rect.right-rect.left)/2);499 point.y=rect.bottom;500 this.DrawPointRect(point,0); 501 point.x=rect.left;502 point.y=rect.top+GetIntValue((rect.bottom-rect.top)/2);503 this.DrawPointRect(point,1);504 }505 //æ¾ç¤ºå¾å½¢å506 ///*507 var ShowNameRect=new CRect(0,0,0,0);508 ShowNameRect.left=rect.left+5;509 ShowNameRect.top=rect.top+GetIntValue((rect.bottom-rect.top)/2.0)-5;510 ShowNameRect.right= ShowNameRect.left+FigureControl_TextLength;511 ShowNameRect.bottom=ShowNameRect.top+FigureControl_TextLength;512 513 this.m_Context.fillText(data.figure_name,ShowNameRect,ShowNameRect.left,514 ShowNameRect.top);515}516function DrawDoubleRect(data)//ç»åæ¹æ¡517{518 var rect=new CRect(0,0,0,0);519 var rect_outside=new CRect(0,0,0,0);520 rect.left=GetIntValue(data.figure_rect.left*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+data.shift_x;521 rect.right=GetIntValue(data.figure_rect.right*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+data.shift_x;522 rect.top=GetIntValue(data.figure_rect.top*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+data.shift_y;523 rect.bottom=GetIntValue(data.figure_rect.bottom*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+data.shift_y;524 rect_outside.left=GetIntValue(data.figure_rect_outside.left*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+data.shift_x;525 rect_outside.right=GetIntValue(data.figure_rect_outside.right*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+data.shift_x;526 rect_outside.top=GetIntValue(data.figure_rect_outside.top*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+data.shift_y;527 rect_outside.bottom=GetIntValue(data.figure_rect_outside.bottom*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+data.shift_y;528 529 this.m_Context.fillStyle = data.figure_color;530 this.DrawRect(rect);531 this.DrawRect(rect_outside); 532//æ¾ç¤ºå°æ¹æ¡533 if ((data.figure_id==this.m_nCursorInFigureId || data.figure_id== this.SelectFigureId)&& this.b_ShowPointRect)534 {535 var point=new CPoint(0,0);536 point.x=rect.left;537 point.y=rect.top;538 this.DrawPointRect(point,0);539 point.x=rect.right;540 point.y=rect.top;541 this.DrawPointRect(point,1);542 point.x=rect.right;543 point.y=rect.bottom;544 this.DrawPointRect(point,0);545 point.x=rect.left;546 point.y=rect.bottom;547 this.DrawPointRect(point,1);548 point.x=rect_outside.left;549 point.y=rect_outside.top;550 this.DrawPointRect(point,1);551 point.x=rect_outside.right;552 point.y=rect_outside.top;553 this.DrawPointRect(point,0);554 point.x=rect_outside.right;555 point.y=rect_outside.bottom;556 this.DrawPointRect(point,1);557 point.x=rect_outside.left;558 point.y=rect_outside.bottom;559 this.DrawPointRect(point,0);560 } 561//æ¾ç¤ºå¾å½¢å 562 rect.right=rect.left+FigureControl_TextLength; 563 rect.bottom=rect.top+FigureControl_TextLength;564 565 this.m_Context.fillText(data.figure_name,rect.left,rect.top); 566}567 568 function SelectSubFigureRectSet(pt) //ç¡®å®å½åç¹æå¨çåºåèå´éå BOOL569{570 //æ¤å¤æ¾ç¤ºå¾åä¸å±çåç§éæ©æ¡ 571 if (this.m_FiguresSet.m_nFigureCount==0)572 {573 return false;574 }575 var MovePoint=new CPoint(0,0);576 var In_OriginalPoint_cursor=new CPoint(0,0); 577 PointEqual(MovePoint,this.OriginalPoint_Bitmap); 578 PointEqual(In_OriginalPoint_cursor,this.m_cpOriginalPoint_cursor);579 var LinePointBegin=new CPoint(0,0);580 var LinePointEnd=new CPoint(0,0);581 var Iterator=new Figure;582 var FigureIndex=0; 583 for(FigureIndex;FigureIndex<this.m_FiguresSet.m_nFigureCount;FigureIndex++)584 { 585 Iterator=this.m_FiguresSet.m_Figures[FigureIndex];586 var PointInRect=0; 587 if (Iterator.figure_type==DrectType)588 {589 var rect=new CRect(0,0,0,0);590 var rect_outside=new CRect(0,0,0,0);591 rect.left=GetIntValue(Iterator.figure_rect.left*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+Iterator.shift_x;592 rect.right=GetIntValue(Iterator.figure_rect.right*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+Iterator.shift_x;593 rect.top=GetIntValue(Iterator.figure_rect.top*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+Iterator.shift_y;594 rect.bottom=GetIntValue(Iterator.figure_rect.bottom*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+Iterator.shift_y;595 rect_outside.left=GetIntValue(Iterator.figure_rect_outside.left*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+Iterator.shift_x;596 rect_outside.right=GetIntValue(Iterator.figure_rect_outside.right*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+Iterator.shift_x;597 rect_outside.top=GetIntValue(Iterator.figure_rect_outside.top*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+Iterator.shift_y;598 rect_outside.bottom=GetIntValue(Iterator.figure_rect_outside.bottom*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+Iterator.shift_y;599 600 if (In_OriginalPoint_cursor.x>=rect_outside.left 601 &&In_OriginalPoint_cursor.x<=rect_outside.right 602 && In_OriginalPoint_cursor.y>=rect_outside.top 603 && In_OriginalPoint_cursor.y<=rect_outside.bottom)604 {605 var CurrentFigure=new CFigureRect;606 CurrentFigure.m_nFigureID = Iterator.figure_id;607 CurrentFigure.m_FigureRect = Iterator.figure_rect_outside;608 this.m_SelectSubFigureRectIdSet.AddFiguretRect(CurrentFigure);609 } 610 var CornerPoint=new Array(8);611 for(var index=0;index<8;index++)612 CornerPoint[index]=new CPoint(0,0);613 CornerPoint[0].x=rect.left;614 CornerPoint[0].y=rect.top;615 CornerPoint[1].x=rect.right;616 CornerPoint[1].y=rect.top;617 CornerPoint[2].x=rect.right;618 CornerPoint[2].y=rect.bottom;619 CornerPoint[3].x=rect.left;620 CornerPoint[3].y=rect.bottom;621 CornerPoint[4].x=rect_outside.left;622 CornerPoint[4].y=rect_outside.top;623 CornerPoint[5].x=rect_outside.right;624 CornerPoint[5].y=rect_outside.top;625 CornerPoint[6].x=rect_outside.right;626 CornerPoint[6].y=rect_outside.bottom;627 CornerPoint[7].x=rect_outside.left;628 CornerPoint[7].y=rect_outside.bottom;629 for (var i=0;i<8;i++)630 {631 if (PointInPointRect(In_OriginalPoint_cursor,CornerPoint[i]))632 {633 var CurrentFigure=new CFigureRect;634 CurrentFigure.m_nFigureID = Iterator.figure_id;635 CurrentFigure.m_FigureRect = Iterator.figure_rect_outside;636 this.m_SelectSubFigureRectIdSet.AddFiguretRect(CurrentFigure);637 return true;638 //break;639 }640 }641 }642 else if (Iterator.figure_type==CircleType)643 {644 var rect=new CRect;645 rect.left=GetIntValue(Iterator.figure_rect.left*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+Iterator.shift_x;646 rect.right=GetIntValue(Iterator.figure_rect.right*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+Iterator.shift_x;647 rect.top=GetIntValue(Iterator.figure_rect.top*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+Iterator.shift_y;648 rect.bottom=GetIntValue(Iterator.figure_rect.bottom*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+Iterator.shift_y;649 if (InEllipseRect(rect,In_OriginalPoint_cursor))650 {651 var CurrentFigure=new CFigureRect;652 CurrentFigure.m_nFigureID = Iterator.figure_id;653 CurrentFigure.m_FigureRect = Iterator.figure_rect;654 this.m_SelectSubFigureRectIdSet.AddFiguretRect(CurrentFigure);655 }656 var CornerPoint=new Array(4);657 for(var index=0;index<4;index++)658 CornerPoint[index]=new CPoint(0,0);659 660 CornerPoint[0].x=rect.left+rect.Width()/2;661 CornerPoint[0].y=rect.top;662 CornerPoint[1].x=rect.right;663 CornerPoint[1].y=rect.top+rect.Height()/2;664 CornerPoint[2].x=rect.left+rect.Width()/2;665 CornerPoint[2].y=rect.bottom;666 CornerPoint[3].x=rect.left;667 CornerPoint[3].y=rect.top+rect.Height()/2;668 for (var i=0;i<4;i++)669 {670 if (PointInPointRect(In_OriginalPoint_cursor,CornerPoint[i]))671 {672 var CurrentFigure=new CFigureRect;673 CurrentFigure.m_nFigureID = Iterator.figure_id;674 CurrentFigure.m_FigureRect = Iterator.figure_rect;675 this.m_SelectSubFigureRectIdSet.AddFiguretRect(CurrentFigure);676 return true;677 //break;678 }679 }680 }681 else682 {683 684 if (Iterator.figure_data.nCPointCount>0) //åªè®¡ç®ç±ç¹è¿æ¥ç»æçå¾å½¢685 { 686 var FindIterator=new CPoint(0,0);687 var FindIndex=0; 688 FindIterator=Iterator.figure_data.m_CPoint[FindIndex]; 689 LinePointBegin.x=GetIntValue(FindIterator.x*this.m_fZoomNum)+MovePoint.x+Iterator.shift_x;690 LinePointBegin.y=GetIntValue(FindIterator.y*this.m_fZoomNum)+MovePoint.y+Iterator. shift_y;691 var nCurrentPointIndex=0;692 var CenterPoint=new CPoint(0,0);693 for (FindIndex;FindIndex<Iterator.figure_data.nCPointCount;FindIndex++)694 {695 nCurrentPointIndex++;696 FindIterator=Iterator.figure_data.m_CPoint[FindIndex]; 697 //计ç®æ¯å¦ä¸æå½±ç¸è¿698 LinePointEnd.x=GetIntValue(FindIterator.x*this.m_fZoomNum)+MovePoint.x+Iterator.shift_x;699 LinePointEnd.y=GetIntValue(FindIterator.y*this.m_fZoomNum)+MovePoint.y+Iterator.shift_y; 700 if (this.InSubFigureRect(In_OriginalPoint_cursor,LinePointBegin,LinePointEnd))701 {702 PointInRect++;703 } 704 LinePointBegin.x=LinePointEnd.x;705 LinePointBegin.y=LinePointEnd.y;706 var CornerPoint=new CPoint(0,0);707 CornerPoint.x=LinePointEnd.x;708 CornerPoint.y=LinePointEnd.y;709 710 if(Iterator.figure_type==RectType)711 {712 switch(nCurrentPointIndex)713 {714 case 1:715 CenterPoint.x=GetIntValue((FindIterator.x+Iterator.figure_rect.Width()/2.0)*this.m_fZoomNum)+716 MovePoint.x+Iterator.shift_x;717 CenterPoint.y=LinePointEnd.y;718 break;719 case 2:720 CenterPoint.x=LinePointEnd.x;721 CenterPoint.y=GetIntValue((FindIterator.y+Iterator.figure_rect.Height()/2.0)*this.m_fZoomNum)+MovePoint.y722 +Iterator.shift_y; 723 break;724 case 3:725 CenterPoint.x=GetIntValue((FindIterator.x-Iterator.figure_rect.Width()/2.0)*this.m_fZoomNum)+726 MovePoint.x+Iterator.shift_x; 727 CenterPoint.y=LinePointEnd.y;728 break;729 case 4:730 CenterPoint.x=LinePointEnd.x;731 CenterPoint.y=GetIntValue((FindIterator.y-Iterator.figure_rect.Height()/2.0)*this.m_fZoomNum)+MovePoint.y732 +Iterator.shift_y; 733 default:734 break;735 } 736 if (this.PointInPointRect(In_OriginalPoint_cursor,CenterPoint))737 {738 var CurrentFigure=new CFigureRect;739 CurrentFigure.m_nFigureID = Iterator.figure_id;740 this.GetFigureOutsideRect(CurrentFigure.m_FigureRect, Iterator);741 this.m_SelectSubFigureRectIdSet.AddFiguretRect(CurrentFigure);742 return true;743 //break;744 }745 }746 if (this.PointInPointRect(In_OriginalPoint_cursor,CornerPoint))747 {748 var CurrentFigure=new CFigureRect;749 CurrentFigure.m_nFigureID = Iterator.figure_id;750 this.GetFigureOutsideRect(CurrentFigure.m_FigureRect, Iterator);751 this.m_SelectSubFigureRectIdSet.AddFiguretRect(CurrentFigure);752 return true;753 //break;754 }755 }756 //æåä¸æ¡è¾¹757 FindIterator=Iterator.figure_data.m_CPoint[0];758 LinePointEnd.x=GetIntValue(FindIterator.x*this.m_fZoomNum)+MovePoint.x+Iterator.shift_x;759 LinePointEnd.y=GetIntValue(FindIterator.y*this.m_fZoomNum)+MovePoint.y+Iterator.shift_y; 760 761 if (this.InSubFigureRect(In_OriginalPoint_cursor,LinePointBegin,LinePointEnd))762 {763 PointInRect++;764 } 765 //åå
¥å½åé¼ æ ç¹æå¨åºåçéåéå766 if (PointInRect%2==1)767 { 768 var CurrentFigure=new CFigureRect;769 CurrentFigure.m_nFigureID = Iterator.figure_id;770 this.GetFigureOutsideRect(CurrentFigure.m_FigureRect, Iterator);771 this.m_SelectSubFigureRectIdSet.AddFiguretRect(CurrentFigure);772 //break;773 } 774 var CornerPoint=new CPoint(0,0);775 CornerPoint.x=LinePointEnd.x;776 CornerPoint.y=LinePointEnd.y; 777 if (this.PointInPointRect(In_OriginalPoint_cursor,CornerPoint))778 {779 var CurrentFigure=new CFigureRect;780 CurrentFigure.m_nFigureID = Iterator.figure_id;781 this.GetFigureOutsideRect(CurrentFigure.m_FigureRect, Iterator);782 this.m_SelectSubFigureRectIdSet.AddFiguretRect(CurrentFigure);783 return true; 784 //break;785 }786 PointInRect=0;787 }788 } 789 }790 return true;791}792function DrawPointRect(point,ColorId) //ç»ç¹æ¹æ¡793{794 var rect=new CRect(0,0,0,0);795 rect.left=point.x-FigureControl_PointRectDistance;796 rect.right=point.x+FigureControl_PointRectDistance;797 rect.top=point.y-FigureControl_PointRectDistance;798 rect.bottom=point.y+FigureControl_PointRectDistance; 799 800 if (ColorId==0)801 {802 this.m_Context.fillStyle = "yellow";803 this.m_Context.strokeStyle = "yellow";804 }805 else if (ColorId==1)806 {807 this.m_Context.fillStyle = "red";808 this.m_Context.strokeStyle = "yellow";809 } 810 else if (ColorId==2)811 {812 this.m_Context.fillStyle = "white";813 this.m_Context.strokeStyle = "yellow";814 } 815 this.DrawRect(rect);816}817function PointGoOutSide(point) //å½åç¹æ¯å¦å·²ç»è¶
åºå¾ç移å¨èå´818{819 if(point.x<this.OriginalPoint_Bitmap.x || point.y<this.OriginalPoint_Bitmap.y)820 { 821 return true;822 }823 if ( point.x>this.OriginalPoint_Bitmap.x+this.m_RectFigure.Width()*this.m_fZoomNum 824 || point.y>this.OriginalPoint_Bitmap.y+this.m_RectFigure.Height()*this.m_fZoomNum)825 { 826 return true;827 } 828 return false;829}830function PointInPointRect(pt,rect_point) //Aç¹æ¯å¦å¨Bç¹åºåèå´å
831{832 var rect=new CRect(0,0,0,0);833 var RectSize=FigureControl_PointRectDistance;834 rect.left=rect_point.x-RectSize;835 rect.right=rect_point.x+RectSize;836 rect.top=rect_point.y-RectSize;837 rect.bottom=rect_point.y+RectSize;838 if (PointInRect(pt,rect))839 {840 return true;841 }842 else843 {844 return false;845 }846}847function PointInRect(point ,rect) //ç¹æ¯å¦å¨æ¹æ¡åºåå
848{849 if (point.x>=rect.left && point.x<=rect.right && point.y>=rect.top && point.y<=rect.bottom)850 {851 return true;852 } 853 else854 return false;855}856function PointInRectEdge(point,rect,num)// ç¹æ¯å¦å¨æ¹æ¡è¾¹ç¼åºåå
857{858 if (point.x<=rect.left && point.y<=rect.top && num==LeftTop)859 {860 return true;861 }862 else if (point.x>=rect.right && point.y<=rect.top && num==RightTop)863 {864 return true;865 }866 else if (point.x>=rect.right && point.y>=rect.bottom && num==RightBottom)867 {868 return true;869 }870 else if (point.x<=rect.left && point.y>=rect.bottom&& num==LeftBottom)871 {872 return true;873 }874 else875 {876 return false;877 }878}879function LoadFromFile(BmpPath) //ä»æ件导å
¥880{}881function LoadFromBuffer(IMG_OBJ) // ä»Buffer导å
¥ 882{}883function SearchPoint() //å¨å¾å½¢ééé¢å¯»æ¾å½åé¼ æ ç¹çè¿é» 884{885 var In_OriginalPoint_cursor=new CPoint(0,0); //å½åé¼ æ æå¨ä½ç½®886 PointEqual(In_OriginalPoint_cursor,this.m_cpOriginalPoint_cursor);887 var Iterator=new Figure;888 var nFigureIndex=0;889 for(nFigureIndex;nFigureIndex<this.m_FiguresSet.m_nFigureCount;nFigureIndex++)890 {891 //ç¡®å®åç¾éä¸ç¹892 Iterator=this.m_FiguresSet.m_Figures[nFigureIndex];893 if (Iterator.figure_id==this.m_nCursorInFigureId)894 {895 if (Iterator.figure_type==DrectType)896 {897 var rect=new CRect(0,0,0,0);898 var rect_outside=new CRect(0,0,0,0);899 rect.left=GetIntValue(Iterator.figure_rect.left*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+Iterator.shift_x;900 rect.right=GetIntValue(Iterator.figure_rect.right*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+Iterator.shift_x;901 rect.top=GetIntValue(Iterator.figure_rect.top*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+Iterator.shift_y;902 rect.bottom=GetIntValue(Iterator.figure_rect.bottom*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+Iterator.shift_y; 903 rect_outside.left=GetIntValue(Iterator.figure_rect_outside.left*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+Iterator.shift_x;904 rect_outside.right=GetIntValue(Iterator.figure_rect_outside.right*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+Iterator.shift_x;905 rect_outside.top=GetIntValue(Iterator.figure_rect_outside.top*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+Iterator.shift_y;906 rect_outside.bottom=GetIntValue(Iterator.figure_rect_outside.bottom*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+Iterator.shift_y; 907 var pt=new Array(9);908 for (var nPt=0;nPt<9;nPt++)909 pt[nPt]=new CPoint(0,0); 910 pt[1].x=rect.left;911 pt[1].y=rect.top;912 pt[2].x=rect.right;913 pt[2].y=rect.top;914 pt[3].x=rect.right;915 pt[3].y=rect.bottom;916 pt[4].x=rect.left;917 pt[4].y=rect.bottom;918 pt[5].x=rect_outside.left;919 pt[5].y=rect_outside.top;920 pt[6].x=rect_outside.right;921 pt[6].y=rect_outside.top;922 pt[7].x=rect_outside.right;923 pt[7].y=rect_outside.bottom;924 pt[8].x=rect_outside.left;925 pt[8].y=rect_outside.bottom; 926 for (var i=1;i<=8;i++)927 {928 if (this.PointInPointRect(In_OriginalPoint_cursor,pt[i]))929 {930 this.CurrentSelectPoint.Figure_id=Iterator.figure_id;931 this.CurrentSelectPoint.Figure_point.x=GetIntValue((pt[i].x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum);932 this.CurrentSelectPoint.Figure_point.y=GetIntValue((pt[i].y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum);933 this.CurrentSelectPoint.nPointIndex=i;934 //å·²ç»æ¾å°è¯¥ç¹ï¼è¿å 935 this.b_FigurePointSelect=true;936 return; 937 }938 else939 {940 this.b_FigurePointSelect=false;941 }942 } 943 }944 else if (Iterator.figure_type==CircleType)945 {946 var rect=new CRect(0,0,0,0);947 rect.left=GetIntValue(Iterator.figure_rect.left*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+Iterator.shift_x;948 rect.right=GetIntValue(Iterator.figure_rect.right*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+Iterator.shift_x;949 rect.top=GetIntValue(Iterator.figure_rect.top*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+Iterator.shift_y;950 rect.bottom=GetIntValue(Iterator.figure_rect.bottom*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+Iterator.shift_y; 951 var pt=new Array(5);952 for (var nPt=0;nPt<5;nPt++)953 pt[nPt]=new CPoint(0,0); 954 pt[1].x=rect.left+GetIntValue(((rect.right-rect.left)/2));955 pt[1].y=rect.top; 956 pt[2].x=rect.right;957 pt[2].y=rect.top+GetIntValue(((rect.bottom-rect.top)/2)); 958 pt[3].x=rect.left+GetIntValue(((rect.right-rect.left)/2));959 pt[3].y=rect.bottom; 960 pt[4].x=rect.left;961 pt[4].y=rect.top+GetIntValue(((rect.bottom-rect.top)/2)); 962 for (var i=1;i<=4;i++)963 {964 if (PointInPointRect(In_OriginalPoint_cursor,pt[i]))965 {966 this.CurrentSelectPoint.Figure_id=Iterator.figure_id;967 this.CurrentSelectPoint.Figure_point.x=GetIntValue((pt[i].x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum);968 this.CurrentSelectPoint.Figure_point.y=GetIntValue((pt[i].y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum); 969 //å·²ç»æ¾å°è¯¥ç¹ï¼è¿å 970 this.b_FigurePointSelect=true;971 this.CurrentSelectPoint.nPointIndex=i;972 return;973 }974 else975 {976 this.b_FigurePointSelect=false;977 }978 }979 }980 else if (Iterator.figure_type==PolyType || Iterator.figure_type==RectType)981 { 982 var FindIterator=new CPoint(0,0);983 var nPointIndex=0;984 var centerPoint=new CPoint(0,0);985 var nFindPointIndex=0;986 for (nFindPointIndex;nFindPointIndex<Iterator.figure_data.nCPointCount;nFindPointIndex++)987 {988 FindIterator=Iterator.figure_data.m_CPoint[nFindPointIndex];989 nPointIndex++;990 var pt=new CPoint(0,0); 991 992 pt.x=GetIntValue(FindIterator.x*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+Iterator.shift_x;993 pt.y=GetIntValue(FindIterator.y*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+Iterator.shift_y;994 centerPoint.x=pt.x;995 centerPoint.y=pt.y;996 if (nPointIndex<=4 && Iterator.figure_type==RectType)997 {998 switch(nPointIndex)999 {1000 case 1:1001 centerPoint.x=GetIntValue((FindIterator.x+Iterator.figure_rect.Width()/2.0)*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+Iterator.shift_x;1002 break;1003 case 2:1004 centerPoint.y=GetIntValue((FindIterator.y+Iterator.figure_rect.Height()/2.0)*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+Iterator.shift_y;1005 break;1006 case 3:1007 centerPoint.x=GetIntValue((FindIterator.x-Iterator.figure_rect.Width()/2.0)*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+Iterator.shift_x;1008 break;1009 case 4:1010 centerPoint.y=GetIntValue((FindIterator.y-Iterator.figure_rect.Height()/2.0)*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+Iterator.shift_y;1011 break;1012 default:1013 break;1014 }1015 if (this.PointInPointRect(In_OriginalPoint_cursor,centerPoint))1016 { 1017 this.CurrentSelectPoint.Figure_id=Iterator.figure_id;1018 this.CurrentSelectPoint.Figure_point.x=centerPoint.x;1019 this.CurrentSelectPoint.Figure_point.y=centerPoint.y;1020 this.CurrentSelectPoint.nPointIndex=nPointIndex+4;1021 this.b_FigurePointSelect=true;1022 //å·²ç»æ¾å°è¯¥ç¹ï¼è¿å1023 return; 1024 }1025 }1026 if (this.PointInPointRect(In_OriginalPoint_cursor,pt))1027 { 1028 this.CurrentSelectPoint.Figure_id=Iterator.figure_id;1029 this.CurrentSelectPoint.Figure_point.x=FindIterator.x;1030 this.CurrentSelectPoint.Figure_point.y=FindIterator.y;1031 this.b_FigurePointSelect=true;1032 this.CurrentSelectPoint.nPointIndex=nPointIndex;1033 //å·²ç»æ¾å°è¯¥ç¹ï¼è¿å1034 return; 1035 } 1036 else1037 {1038 this.b_FigurePointSelect=false;1039 }1040 }1041 }1042 }1043 else1044 {1045 this.b_FigurePointSelect=false;1046 }1047 }1048}1049function SetFillStyle(nIndex) //设置填å
é£æ ¼1050{}1051function GetFillStyle(nIndex) //è·åå¡«å
é£æ ¼ï¼1052{}1053function ShowOtherFigures() //æ¾ç¤ºå©ä½çä¸äºå¾å½¢å½¢1054{}1055function setInitZoomScale(num) // åå§ç¼©æ¾æ¯çï¼æ¾å¤§çï¼ä¸ºè´æ°1056{1057 num=-num;1058 this.m_nScrollRate=GetIntValue(num*10);1059 if (num>0)1060 { //æ大æ¾å¤§åç1061 if (num<-60)1062 {1063 return false;1064 } 1065 this.m_fZoomNum= Math.pow(FigureControl_ScaleBot,this.m_nScrollRate); 1066 this.m_ImageHeight=this.m_ClientRect.height*this.m_fZoomNum;1067 this.m_ImageWeith=this.m_ClientRect.width*this.m_fZoomNum;1068 this.m_OldImageWeith=this.m_ClientRect.width*Math.pow(FigureControl_ScaleBot,this.m_nScrollRate+1);1069 this.m_OldImageHeight=this.m_ClientRect.height*Math.pow(FigureControl_ScaleBot,this.m_nScrollRate+1);1070 this.m_CurrentDistance.x=GetIntValue((this.m_ImageWeith-this.m_OldImageWeith)/2);1071 this.m_CurrentDistance.y=GetIntValue((this.m_ImageHeight-this.m_OldImageHeight)/2);1072 this.OriginalPoint_Bitmap.x=(this.OriginalPoint_Bitmap.x-this.m_CurrentDistance.x); 1073 this.OriginalPoint_Bitmap.y=(this.OriginalPoint_Bitmap.y-this.m_CurrentDistance.y);1074 } 1075 else 1076 { 1077 if (num>60)1078 {1079 return false;1080 } 1081 this.m_fZoomNum=Math.pow(FigureControl_ScaleBot,this.m_nScrollRate); 1082 this.m_ImageHeight=this.m_ClientRect.height*this.m_fZoomNum;1083 this.m_ImageWeith=this.m_ClientRect.width*this.m_fZoomNum; 1084 this.m_OldImageWeith=this.m_ClientRect.width*Math.pow(FigureControl_ScaleBot,this.m_nScrollRate-1);1085 this.m_OldImageHeight=this.m_ClientRect.height*Math.pow(FigureControl_ScaleBot,this.m_nScrollRate-1);1086 this.m_CurrentDistance.x=-GetIntValue((this.m_OldImageWeith-this.m_ImageWeith)/2);1087 this.m_CurrentDistance.y=-GetIntValue((this.m_OldImageHeight-this.m_ImageHeight)/2);1088 this.OriginalPoint_Bitmap.x=(this.OriginalPoint_Bitmap.x-this.m_CurrentDistance.x);1089 this.OriginalPoint_Bitmap.y=(this.OriginalPoint_Bitmap.y-this.m_CurrentDistance.y);1090 } 1091 this.RepaintControl(); 1092 return true;1093}1094function ProcessMaskImage(int ,int) //æ¾ç¤ºMaskå¾å½¢ 1095{}1096function ShiftImageToCenter() //åå§å¾åå±
ä¸ 1097{1098 var temp_x=0,temp_y=0; 1099 temp_x=GetIntValue((this.m_ClientRect.width-this.m_Image.width*this.m_fZoomNum)/2);1100 temp_y=GetIntValue((this.m_ClientRect.height-this.m_Image.height*this.m_fZoomNum)/2);1101 this.OriginalPoint_Bitmap.x=temp_x;1102 this.OriginalPoint_Bitmap.y=temp_y; 1103 this.m_nControlWidth=temp_x;1104 this.m_nControlHeight=temp_y;1105 this.RepaintControl();1106}1107function FinishDraw(nIndex)1108{}1109function AlignWidthBytes(nBytes)1110{}1111function LButtonDown(point) //å·¦é®åä¸1112{1113 point.x-=this.x_Distance;1114 point.y-=this.y_Distance; 1115 if (!PointInCurrentRect(this.m_ClientRect,point))1116 {1117 return;1118 } 1119 PointEqual(m_cpOriginalPoint_cursor,point); 1120 this.b_LeftButtonDown=true;1121 //åè½: å¤æå½åç¹æå¨åªä¸ªåºåçç¹åºåä¸1122 //æ¸
空ä¸æ¬¡å·¦é®éä¸åºåéå1123 var nLastSelectFigure=this.m_nCursorInFigureId;1124 this.m_SelectSubFigureRectIdSet.ClearFigureRectData();1125 m_nCursorInFigureId=0; 1126 //å¤æå½åç¹éä¸äºåªäºåºå1127 this.SelectSubFigureRectSet(this.m_cpOriginalPoint_cursor); 1128 if (m_SelectSubFigureRectIdSet.m_nFigureRectCount>0 && this.b_LButtonDouC==false ) 1129 {1130 //list<CFigureRect>::iterator FindIterator;1131 var FindIterator=new CFigureRect;1132 var FindIndex=0;1133 FindIterator=this.m_SelectSubFigureRectIdSet.m_FigureRect[FindIndex];1134 var CFigureRect =new CFigureRect;1135 SelectFigure = FindIterator;1136 for (FindIndex;FindIndex<m_SelectSubFigureRectIdSet.m_nFigureRectCount;FindIndex++)1137 {1138 if(FindIterator.m_FigureRect.left > SelectFigure.m_FigureRect.left1139 || FindIterator.m_FigureRect.top > SelectFigure.m_FigureRect.top1140 || FindIterator.m_FigureRect.right < SelectFigure.m_FigureRect.right1141 || FindIterator.m_FigureRect.bottom < SelectFigure.m_FigureRect.bottom)1142 SelectFigure = FindIterator;1143 1144 FindIterator=this.m_SelectSubFigureRectIdSet.m_FigureRect[FindIndex];1145 }1146 m_nCursorInFigureId=SelectFigure.m_nFigureID; 1147 } 1148 if (this.m_nCursorInFigureId && this.b_ChangeFigureSize)1149 { 1150 this.SearchPoint();1151 } 1152 if (this.b_DrawRect || this.b_DrawDoubleRect || this.b_DrawCircle || this.b_DrawPoly || this.b_LButtonDouC)1153 { 1154 if (!this.PointGoOutSide(point))1155 {1156 //å¦æå¼å§ç»ç»æ¹æ¡1157 if (this.b_DrawRect )1158 { 1159 //å¦æå¼å§ç»ç»æ¹æ¡ï¼ç¹å»äºä¸ä¸ªå·¦é®1160 if (this.b_PreDrawRect)1161 {1162 this.b_PreDrawRect=false;1163 //æ¹æ¡å©ä¸çä¸ä¸ªç¹1164 point.x-=this.OriginalPoint_Bitmap.x;1165 point.y-=this.OriginalPoint_Bitmap.y;1166 point.x=this.GetIntValue(point.x/m_fZoomNum);1167 point.y=this.GetIntValue(point.y/m_fZoomNum);1168 //list<CPoint >::iterator FindIterator;1169 var FindIterator =new CPoint(0,0);1170 var FindPointIndex=0;1171 FindIterator=CurrentFigure.figure_data.m_CPoint[FindPointIndex];1172 if(FindIterator.x > point.x)1173 {1174 var nTemp = FindIterator.x;1175 FindIterator.x = point.x;1176 point.x = nTemp;1177 }1178 if(FindIterator.y > point.y)1179 {1180 var nTemp = FindIterator.y;1181 FindIterator.y = point.y;1182 point.y = nTemp;1183 }1184 var p1=new CPoint(0,0);1185 var p2=new CPoint(0,0);1186 var p4=new CPoint(0,0);1187 p1.x=FindIterator.x;1188 p1.y=FindIterator.y;1189 p2.x=point.x;1190 p2.y=p1.y;1191 p4.x=p1.x;1192 p4.y=point.y;1193 //å
¶ä½ä¸ä¸ªç¹åå
¥å°å¾å1194 this.CurrentFigure.figure_data.AddCPoint(p2);1195 this.CurrentFigure.figure_data.AddCPoint(point); 1196 this.CurrentFigure.figure_data.AddCPoint(p4);1197 this.CurrentFigure.figure_rect.left=p1.x;1198 this.CurrentFigure.figure_rect.top=p1.y;1199 this.CurrentFigure.figure_rect.right=point.x;1200 this.CurrentFigure.figure_rect.bottom=point.y;1201 this.m_nFigureCount++;1202 this.CurrentFigure.figure_color=this.m_FigureColor;1203 //CString figurename;1204 //figurename.Format(_T("%d"),m_nFigureCount);1205 this.CurrentFigure.figure_name=this.m_csCurrentDrawFigureName; 1206 this.m_csCurrentDrawFigureName="";1207 this.CurrentFigure.figure_id=this.m_nFigureCount; 1208 this.CurrentFigure.figure_type=RectType;1209 this.CurrentFigure.ReserverData=this.m_strDataReserved;1210 this.m_FiguresSet.AddFigure(CurrentFigure);1211 1212 1213 this.CurrentFigure.ClearFigureData(); 1214 this.b_DrawRect=false; 1215 }1216 else1217 { 1218 this.b_PreDrawRect=true; 1219 //æ¯æ¬¡åªæä¸ä¸ªå¾å½¢å¨ç»å¶1220 point.x-=this.OriginalPoint_Bitmap.x;1221 point.y-=this.OriginalPoint_Bitmap.y;1222 point.x=GetIntValue(point.x/this.m_fZoomNum);1223 point.y=GetIntValue(point.y/this.m_fZoomNum);1224 CurrentFigure.figure_data.AddCPoint(point); // åå
¥å°å¾å 1225 }1226 }1227 else1228 this.b_PreDrawRect=false; 1229 //å¦æå¼å§ç»ç»åæ¹æ¡1230 if (this.b_DrawDoubleRect )1231 { 1232 //å¦æå¼å§ç»ç»åæ¹æ¡ï¼ç¹å»äºä¸ä¸ªå·¦é®1233 if (this.b_PreDrawDoubleRect)1234 {1235 this.b_PreDrawDoubleRect=false;1236 //æ¹æ¡å©ä¸çä¸ä¸ªç¹1237 point.x-=this.OriginalPoint_Bitmap.x;1238 point.y-=this.OriginalPoint_Bitmap.y;1239 point.x=GetIntValue(point.x/this.m_fZoomNum);1240 point.y=GetIntValue(point.y/this.m_fZoomNum); 1241 this.CurrentFigure.figure_rect.right=point.x;1242 this.CurrentFigure.figure_rect.bottom=point.y; 1243 this.CurrentFigure.figure_rect_outside.right=point.x+GetIntValue(FigureControl_DoubleRectDistance/this.m_fZoomNum);1244 this.CurrentFigure.figure_rect_outside.bottom=point.y+GetIntValue(FigureControl_DoubleRectDistance/this.m_fZoomNum); 1245 //ä¸å
许ç»ä¸è§èçåæ¹æ¡1246 if ((this.CurrentFigure.figure_rect.right<=this.CurrentFigure.figure_rect.left) 1247 || (this.CurrentFigure.figure_rect.top>=this.CurrentFigure.figure_rect.bottom))1248 {1249 this.CurrentFigure.ClearFigureData();1250 }1251 else1252 {1253 this.m_nFigureCount++;1254 this.CurrentFigure.figure_color=this.m_FigureColor;1255 //CString figurename;1256 //figurename.Format(_T("%d"),m_nFigureCount);1257 this.CurrentFigure.figure_id=this.m_nFigureCount;1258 this.CurrentFigure.figure_name=this.m_csCurrentDrawFigureName; 1259 this.m_csCurrentDrawFigureName="";1260 this.CurrentFigure.figure_type=DrectType;1261 this.CurrentFigure.ReserverData=this.m_strDataReserved;1262 1263 //åå
¥1264 m_FiguresSet.AddFigure(this.CurrentFigure); 1265 1266 //SetCurrentSelectFigure(CurrentFigure.figure_id);1267 this.b_DrawDoubleRect=false;1268 this.CurrentFigure.ClearFigureData();1269 }1270 }1271 else1272 {1273 this.b_PreDrawDoubleRect=true;1274 //æ¯æ¬¡åªæä¸ä¸ªå¾å½¢å¨ç»å¶1275 point.x-=this.OriginalPoint_Bitmap.x;1276 point.y-=this.OriginalPoint_Bitmap.y;1277 point.x=GetIntValue(point.x/this.m_fZoomNum);1278 point.y=GetIntValue(point.y/this.m_fZoomNum);1279 // åå
¥å°å¾å1280 this.CurrentFigure.figure_rect.left=point.x;1281 this.CurrentFigure.figure_rect.top=point.y;1282 this.CurrentFigure.figure_rect_outside.left=point.x-GetIntValue(FigureControl_DoubleRectDistance/this.m_fZoomNum);1283 this.CurrentFigure.figure_rect_outside.top=point.y-GetIntValue(FigureControl_DoubleRectDistance/this.m_fZoomNum); 1284 }1285 }1286 else1287 {1288 this.b_PreDrawDoubleRect=false;1289 } 1290 //å¼å§ç»å¶å1291 if(this.b_DrawCircle)1292 { 1293 if (this.b_PreDrawCircle)1294 {1295 this.b_PreDrawCircle=false;1296 point.x-=this.OriginalPoint_Bitmap.x;1297 point.y-=this.OriginalPoint_Bitmap.y;1298 point.x=GetIntValue(point.x/this.m_fZoomNum);1299 point.y=GetIntValue(point.y/this.m_fZoomNum);1300 this.CurrentFigure.figure_rect.right=point.x;1301 this.CurrentFigure.figure_rect.bottom=point.y;1302 this.m_nFigureCount++;1303 this.CurrentFigure.figure_color=this.m_FigureColor; 1304 //CString figurename;1305 //figurename.Format(_T("%d"),m_nFigureCount);1306 this.CurrentFigure.figure_name=this.m_csCurrentDrawFigureName;1307 this.m_csCurrentDrawFigureName="";1308 this.CurrentFigure.figure_id=this.m_nFigureCount;1309 this.CurrentFigure.figure_type=CircleType;1310 1311 this.CurrentFigure.ReserverData=this.m_strDataReserved;1312 this.m_FiguresSet.AddFigure(CurrentFigure); 1313 //FinishDraw(CurrentFigure.figure_id);1314 //SetCurrentSelectFigure(CurrentFigure.figure_id);1315 this.CurrentFigure.ClearFigureData();1316 this.b_DrawCircle=false;1317 }1318 else1319 { 1320 this.b_PreDrawCircle=true;1321 point.x-=this.OriginalPoint_Bitmap.x;1322 point.y-=this.OriginalPoint_Bitmap.y;1323 point.x=GetIntValue(point.x/this.m_fZoomNum);1324 point.y=GetIntValue(point.y/this.m_fZoomNum);1325 // åå
¥1326 this.CurrentFigure.figure_rect.left=point.x;1327 this.CurrentFigure.figure_rect.top=point.y; 1328 }1329 }1330 else1331 this.b_PreDrawCircle=false;1332 if (this.b_LButtonDouC==true && this.b_DrawPoly)1333 { 1334 this.m_TempLinesPointSet.AddCPoint(point); //ç»å®æ¶çº¿æ¡ 1335 //å°æ¾ç¤ºåæ 转æçå®åæ 1336 point.x-=this.OriginalPoint_Bitmap.x;1337 point.y-=this.OriginalPoint_Bitmap.y;1338 point.x=GetIntValue(point.x/this.m_fZoomNum);1339 point.y=GetIntValue(point.y/this.m_fZoomNum);1340 thisCurrentFigure.figure_data.AddCPoint((point)); // åå
¥å°å¾å1341 } 1342 } 1343 }1344 this.RepaintControl();1345}1346 1347 1348// External User Event Operations1349//å¤é¨æ¶æ¯ååº ï¼éè¦ä»å¤é¨ä¼ å
¥ç»æ§ä»¶1350function MouseWheel(zDelta, pt) //æ»å¨é¼ æ ä¸å»º1351{1352 pt.x-=this.x_Distance;1353 pt.y-=this.y_Distance;1354 //ç论ä¸zDeltaæ¯æ¬¡é½æ¯120æè
-120 1355 1356 var zoomCount=(zDelta/120); 1357 var x1=0,x2=0,y1=0,y2=0;1358 var InImageWidth=0,InImageHight=0;1359 InImageWidth=(this.m_MovePoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum;1360 InImageHight=(this.m_MovePoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum;1361 if (zoomCount>0)1362 { //æ大æ¾å¤§åç 1363 if (this.m_nScrollRate<FigureControl_MaxZoomScale)1364 {1365 return false; 1366 }1367 this.m_nScrollRate--;1368 this.m_fZoomNum=Math.pow(FigureControl_ScaleBot,this.m_nScrollRate); 1369 var TestX=0,TestY=0;1370 TestX=InImageWidth*(this.m_fZoomNum-Math.pow(FigureControl_ScaleBot,this.m_nScrollRate+1));1371 TestY=InImageHight*(this.m_fZoomNum-Math.pow(FigureControl_ScaleBot,this.m_nScrollRate+1));1372 this.OriginalPoint_Bitmap.x=GetIntValue(this.OriginalPoint_Bitmap.x-TestX); 1373 this.OriginalPoint_Bitmap.y=GetIntValue(this.OriginalPoint_Bitmap.y-TestY);1374 } 1375 else1376 { 1377 if (this.m_nScrollRate>-2*FigureControl_MaxZoomScale)1378 {1379 return false;1380 }1381 this.m_nScrollRate++;1382 this.m_fZoomNum=Math.pow(FigureControl_ScaleBot,this.m_nScrollRate); 1383 var TestX=0,TestY=0;1384 TestX=(InImageWidth*(this.m_fZoomNum- Math.pow(FigureControl_ScaleBot,this.m_nScrollRate-1)));1385 TestY=(InImageHight*(this.m_fZoomNum- Math.pow(FigureControl_ScaleBot,this.m_nScrollRate-1)));1386 this.OriginalPoint_Bitmap.x=GetIntValue(this.OriginalPoint_Bitmap.x-TestX); 1387 this.OriginalPoint_Bitmap.y=GetIntValue(this.OriginalPoint_Bitmap.y-TestY);1388 } 1389 1390 this.RepaintControl(); 1391}1392 1393function LButtonDown(point) //å·¦é®åä¸1394{1395 point.x-=this.x_Distance;1396 point.y-=this.y_Distance; 1397 if (!PointInCurrentRect(this.m_ClientRect,point))1398 {1399 return;1400 } 1401 PointEqual(this.m_cpOriginalPoint_cursor,point); 1402 this.b_LeftButtonDown=true;1403 //åè½: å¤æå½åç¹æå¨åªä¸ªåºåçç¹åºåä¸1404 //æ¸
空ä¸æ¬¡å·¦é®éä¸åºåéå1405 var nLastSelectFigure=this.m_nCursorInFigureId;1406 this.m_SelectSubFigureRectIdSet.ClearFigureRectData();1407 this.m_nCursorInFigureId=0; 1408 //å¤æå½åç¹éä¸äºåªäºåºå1409 this.SelectSubFigureRectSet(this.m_cpOriginalPoint_cursor); 1410 var maxId=0;1411 if (this.m_SelectSubFigureRectIdSet.m_nFigureRectCount>0 && this.b_LButtonDouC==false ) 1412 {1413 var FindIterator=new CFigureRect ;1414 var FindIndex=0; 1415 for (FindIndex;FindIndex<this.m_SelectSubFigureRectIdSet.m_nFigureRectCount;FindIndex++)1416 {1417 FindIterator=this.m_SelectSubFigureRectIdSet.m_FigureRect[FindIndex];1418 if(FindIterator.m_nFigureID>maxId) //å°æåä¸ä¸ªå¾å½¢IDä¼ åº1419 {1420 maxId=FindIterator.m_nFigureID;1421 }1422 }1423 this.m_nCursorInFigureId=maxId; 1424 } 1425 if (this.m_nCursorInFigureId && this.b_ChangeFigureSize)1426 { 1427 this.SearchPoint();1428 } 1429 if (this.b_DrawRect || this.b_DrawDoubleRect || this.b_DrawCircle || this.b_DrawPoly || this.b_LButtonDouC)1430 { 1431 if (!this.PointGoOutSide(point))1432 {1433 //å¦æå¼å§ç»ç»æ¹æ¡1434 if (this.b_DrawRect )1435 { 1436 //å¦æå¼å§ç»ç»æ¹æ¡ï¼ç¹å»äºä¸ä¸ªå·¦é®1437 if (this.b_PreDrawRect)1438 {1439 this.b_PreDrawRect=false;1440 //æ¹æ¡å©ä¸çä¸ä¸ªç¹1441 point.x-=this.OriginalPoint_Bitmap.x;1442 point.y-=this.OriginalPoint_Bitmap.y;1443 point.x=GetIntValue(point.x/this.m_fZoomNum);1444 point.y=GetIntValue(point.y/this.m_fZoomNum);1445 var FindIterator=new CPoint(0,0);1446 var FindPointIndex=0;1447 FindIterator=this.CurrentFigure.figure_data.m_CPoint[FindPointIndex];1448 if(FindIterator.x > point.x)1449 {1450 var nTemp = FindIterator.x;1451 FindIterator.x = point.x;1452 point.x = nTemp;1453 }1454 if(FindIterator.y > point.y)1455 {1456 var nTemp = FindIterator.y;1457 FindIterator.y = point.y;1458 point.y = nTemp;1459 }1460 var p1=new CPoint(0,0);1461 var p2=new CPoint(0,0);1462 var p4=new CPoint(0,0);1463 p1.x=FindIterator.x;1464 p1.y=FindIterator.y;1465 p2.x=point.x;1466 p2.y=p1.y;1467 p4.x=p1.x;1468 p4.y=point.y;1469 //å
¶ä½ä¸ä¸ªç¹åå
¥å°å¾å1470 this.CurrentFigure.figure_data.AddCPoint((p2));1471 this.CurrentFigure.figure_data.AddCPoint((point)); 1472 this.CurrentFigure.figure_data.AddCPoint((p4));1473 this.CurrentFigure.figure_rect.left=p1.x;1474 this.CurrentFigure.figure_rect.top=p1.y;1475 this.CurrentFigure.figure_rect.right=point.x;1476 this.CurrentFigure.figure_rect.bottom=point.y;1477 this.m_nFigureCount++;1478 this.CurrentFigure.figure_color=this.m_FigureColor;1479 1480 this.CurrentFigure.figure_name=this.m_csCurrentDrawFigureName; 1481 this.m_csCurrentDrawFigureName="";1482 this.CurrentFigure.figure_id=this.m_nFigureCount; 1483 this.CurrentFigure.figure_type=RectType;1484 this.CurrentFigure.ReserverData=this.m_strDataReserved;1485 this.m_FiguresSet.AddFigure(this.CurrentFigure);1486 //FinishDraw(CurrentFigure.figure_id);1487 this.CurrentFigure.ClearFigureData(); 1488 this.b_DrawRect=false; 1489 }1490 else1491 { 1492 this.b_PreDrawRect=true; 1493 //æ¯æ¬¡åªæä¸ä¸ªå¾å½¢å¨ç»å¶1494 point.x-=this.OriginalPoint_Bitmap.x;1495 point.y-=this.OriginalPoint_Bitmap.y;1496 point.x=GetIntValue(point.x/this.m_fZoomNum);1497 point.y=GetIntValue(point.y/this.m_fZoomNum);1498 this.CurrentFigure.figure_data.AddCPoint((point)); // åå
¥å°å¾å 1499 }1500 }1501 else1502 this.b_PreDrawRect=false; 1503 //å¦æå¼å§ç»ç»åæ¹æ¡1504 if (this.b_DrawDoubleRect )1505 { 1506 //å¦æå¼å§ç»ç»åæ¹æ¡ï¼ç¹å»äºä¸ä¸ªå·¦é®1507 if (this.b_PreDrawDoubleRect)1508 {1509 this.b_PreDrawDoubleRect=false;1510 //æ¹æ¡å©ä¸çä¸ä¸ªç¹1511 point.x-=this.OriginalPoint_Bitmap.x;1512 point.y-=this.OriginalPoint_Bitmap.y;1513 point.x=GetIntValue(point.x/this.m_fZoomNum);1514 point.y=GetIntValue(point.y/this.m_fZoomNum); 1515 this.CurrentFigure.figure_rect.right=point.x;1516 this.CurrentFigure.figure_rect.bottom=point.y; 1517 this.CurrentFigure.figure_rect_outside.right=point.x+GetIntValue(FigureControl_DoubleRectDistance/this.m_fZoomNum);1518 this.CurrentFigure.figure_rect_outside.bottom=point.y+GetIntValue(FigureControl_DoubleRectDistance/this.m_fZoomNum); 1519 //ä¸å
许ç»ä¸è§èçåæ¹æ¡1520 if ((this.CurrentFigure.figure_rect.right<=this.CurrentFigure.figure_rect.left) 1521 || (this.CurrentFigure.figure_rect.top>=this.CurrentFigure.figure_rect.bottom))1522 {1523 this.CurrentFigure.ClearFigureData();1524 }1525 else1526 {1527 this.m_nFigureCount++;1528 this.CurrentFigure.figure_color=this.m_FigureColor; 1529 this.CurrentFigure.figure_id=this.m_nFigureCount;1530 this.CurrentFigure.figure_name=this.m_csCurrentDrawFigureName; 1531 this.m_csCurrentDrawFigureName="";1532 this.CurrentFigure.figure_type=DrectType; 1533 this.CurrentFigure.ReserverData=this.m_strDataReserved;1534 //åå
¥1535 this.m_FiguresSet.AddFigure(this.CurrentFigure); 1536 //FinishDraw(CurrentFigure.figure_id);1537 1538 this.b_DrawDoubleRect=false;1539 this.CurrentFigure.ClearFigureData();1540 }1541 }1542 else1543 {1544 this.b_PreDrawDoubleRect=true;1545 //æ¯æ¬¡åªæä¸ä¸ªå¾å½¢å¨ç»å¶1546 point.x-=this.OriginalPoint_Bitmap.x;1547 point.y-=this.OriginalPoint_Bitmap.y;1548 point.x=GetIntValue(point.x/this.m_fZoomNum);1549 point.y=GetIntValue(point.y/this.m_fZoomNum);1550 // åå
¥å°å¾å1551 this.CurrentFigure.figure_rect.left=point.x;1552 this.CurrentFigure.figure_rect.top=point.y;1553 this.CurrentFigure.figure_rect_outside.left=point.x-GetIntValue(FigureControl_DoubleRectDistance/this.m_fZoomNum);1554 this.CurrentFigure.figure_rect_outside.top=point.y-GetIntValue(FigureControl_DoubleRectDistance/this.m_fZoomNum); 1555 }1556 }1557 else1558 {1559 this.b_PreDrawDoubleRect=false;1560 } 1561 //å¼å§ç»å¶å1562 if(this.b_DrawCircle)1563 { 1564 if (this.b_PreDrawCircle)1565 {1566 this.b_PreDrawCircle=false;1567 point.x-=this.OriginalPoint_Bitmap.x;1568 point.y-=this.OriginalPoint_Bitmap.y;1569 point.x=GetIntValue(point.x/this.m_fZoomNum);1570 point.y=GetIntValue(point.y/this.m_fZoomNum);1571 this.CurrentFigure.figure_rect.right=point.x;1572 this.CurrentFigure.figure_rect.bottom=point.y;1573 this.m_nFigureCount++;1574 this.CurrentFigure.figure_color=this.m_FigureColor; 1575 1576 this.CurrentFigure.figure_name=this.m_csCurrentDrawFigureName;1577 this.m_csCurrentDrawFigureName="";1578 this.CurrentFigure.figure_id=this.m_nFigureCount;1579 this.CurrentFigure.figure_type=CircleType;1580 this.CurrentFigure.ReserverData=this.m_strDataReserved;1581 1582 this.m_FiguresSet.AddFigure(this.CurrentFigure); 1583 //FinishDraw(CurrentFigure.figure_id);1584 1585 this.CurrentFigure.ClearFigureData();1586 this.b_DrawCircle=false;1587 }1588 else1589 { 1590 this.b_PreDrawCircle=true;1591 point.x-=this.OriginalPoint_Bitmap.x;1592 point.y-=this.OriginalPoint_Bitmap.y;1593 point.x=GetIntValue(point.x/this.m_fZoomNum);1594 point.y=GetIntValue(point.y/this.m_fZoomNum);1595 // åå
¥1596 this.CurrentFigure.figure_rect.left=point.x;1597 this.CurrentFigure.figure_rect.top=point.y; 1598 }1599 }1600 else1601 this.b_PreDrawCircle=false;1602 if (this.b_LButtonDouC==true && this.b_DrawPoly==true)1603 { 1604 this.m_TempLinesPointSet.AddCPoint(point); //ç»å®æ¶çº¿æ¡ 1605 //å°æ¾ç¤ºåæ 转æçå®åæ 1606 point.x-=this.OriginalPoint_Bitmap.x;1607 point.y-=this.OriginalPoint_Bitmap.y;1608 point.x=GetIntValue(point.x/this.m_fZoomNum);1609 point.y=GetIntValue(point.y/this.m_fZoomNum);1610 this.CurrentFigure.figure_data.AddCPoint((point)); // åå
¥å°å¾å1611 } 1612 } 1613 }1614 this.RepaintControl();1615}1616function LButtonUp( point) //å·¦é®å¼¹ä¸1617{1618 this.b_LeftButtonDown=false;1619 var b_moveWindow=false;1620 1621 //åæ¢ç§»å¨å¾å½¢ï¼å°å¹³ç§»è·ç¦»è®¡ç®è¿åæ¥åæ 1622 if (this.b_SubFiguresMove)1623 { 1624 //list<Figure>::iterator FindIterator; 1625 var FindIterator=new Figure;1626 var FindIndex=0;1627 FindIterator=this.m_FiguresSet.m_Figures[FindIndex];1628 1629 for(FindIndex;FindIndex<this.m_FiguresSet.m_nFigureCount;FindIndex++)1630 { 1631 1632 FindIterator=this.m_FiguresSet.m_Figures[FindIndex];1633 1634 if ((FindIterator.figure_id==this.m_nCursorInFigureId )1635 && this.m_SelectSubFigureRectIdSet.m_nFigureRectCount>0 && this.b_FigurePointSelect==false) 1636 { 1637 FindIterator.MoveFigure(this.m_cpDistancePoint.x,this.m_cpDistancePoint.y); // (m_cpDistancePoint.x>2 ||m_cpDistancePoint.y>2))//é²æ¢è½»å¾®çç§»å¨ 1638 1639 if (FindIterator.figure_type==DrectType)1640 {1641 FindIterator.DistanceToData(this.m_fZoomNum,DrectType);1642 }1643 else if (FindIterator.figure_type==CircleType)1644 {1645 FindIterator.DistanceToData(this.m_fZoomNum,CircleType);1646 }1647 else if (FindIterator.figure_type==RectType)1648 {1649 FindIterator.DistanceToData (this.m_fZoomNum,RectType);1650 }1651 else1652 {1653 FindIterator.DistanceToData(this.m_fZoomNum,PolyType);1654 } 1655 } 1656 }1657 } 1658 //ä¸å¨éæ©å¾å½¢è¾¹ç¼ç¹1659 this.b_FigurePointSelect=false; 1660 1661}1662 1663function LButtonDblClk(point) //å·¦é®åå»1664{1665 point.x-=this.x_Distance;1666 point.y-=this.y_Distance; 1667 var tempPoint=new CPoint(0,0);1668 tempPoint.x=GetIntValue((point.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum);1669 tempPoint.y=GetIntValue((point.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum); 1670 if (!PointInCurrentRect(this.m_RectFigure,tempPoint))1671 {1672 return;1673 } 1674//å é¤å¤è¾¹å½¢è¾¹ç¼ç¹1675 //list<Figure>::iterator Iterator;1676 var Iterator=new Figure;1677 var IfFind=false;1678 var FindIndex=0;1679 Iterator=this.m_FiguresSet.m_Figures[FindIndex];1680 for(FindIndex;FindIndex<this.m_FiguresSet.m_nFigureCount;FindIndex++)1681 {1682 if (Iterator.figure_type==PolyType)1683 {1684 //std::list<CPoint>::iterator PointIterator;1685 var PointIterator=new CPoint(0,0);1686 var FindPointIndex=0;1687 var PointNum=1;1688 PointIterator=Iterator.figure_data.m_CPoint[FindPointIndex];1689 for (FindPointIndex;FindPointIndex<Iterator.figure_data.nCPointCount;FindPointIndex++)1690 {1691 PointNum++;1692 var pt=new CPoint(0,0);1693 pt.x=GetIntValue(PointIterator.x*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+Iterator.shift_x;1694 pt.y=GetIntValue(PointIterator.y*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+Iterator.shift_y;1695 if (PointInPointRect(this.m_cpOriginalPoint_cursor,pt))1696 { 1697 //å é¤ä¸ä¸ªè¾¹ç¼ç¹1698 if (PointNum%2==0)1699 {1700 Iterator.figure_data.eraseCPoint(FindPointIndex); 1701 } 1702 else//æ·»å ä¸ä¸ªè¾¹ç¼ç¹1703 {1704 var BeginPoint=new CPoint(0,0);1705 var EndPoint=new CPoint(0,0);1706 var MidPoint=new CPoint(0,0);1707 BeginPoint=PointIterator;1708 var NextPoint=FindPointIndex+1;1709 PointIterator=Iterator.figure_data.m_CPointp[NextPoint];1710 1711 if (PointIterator==Iterator.figure_data.end())1712 {1713 break;1714 }1715 1716 EndPoint=PointIterator;1717 MidPoint.x=GetIntValue(((BeginPoint.x+EndPoint.x)/2.0));1718 MidPoint.y=GetIntValue(((BeginPoint.y+EndPoint.y)/2.0)); 1719 Iterator.figure_data.InsertPoint(FindPointIndex,MidPoint);1720 1721 } 1722 IfFind=true;1723 this.RepaintControl();1724 break;1725 }1726 }1727 }1728 if (IfFind==true)1729 {1730 break;1731 } 1732 }1733//对å¤è¾¹å½¢çå¤ç 1734 if (this.b_LButtonDouC==false && this.b_DrawPoly) //第ä¸æ¬¡åå»ï¼å¼å§ç»å¾å½¢1735 {1736 //ç»æ§ä»¶å¾å½¢èµå¼ï¼åå§å1737 this.b_LButtonDouC=true; 1738 this.m_TempLinesPointSet.AddCPoint(point); //å®æ¶ç»æ¶æ¾ç¤º1739 //å°æ¾ç¤ºåæ 转æçå®åæ 1740 point.x-=this.OriginalPoint_Bitmap.x;1741 point.y-=this.OriginalPoint_Bitmap.y;1742 point.x=GetIntValue(point.x/this.m_fZoomNum);1743 point.y=GetIntValue(point.y/this.m_fZoomNum);1744 this.CurrentFigure.figure_data.AddCPoint((point)); //åå
¥å°åè¡¨ä¸ 1745 }1746 else if(this.b_LButtonDouC==true && this.b_DrawPoly) //åä¸æ¬¡åå»ï¼ç»æç»ä¸æ¬¡å¾å½¢1747 {1748 this.b_LButtonDouC=false; 1749 //std::list<CPoint>::iterator PointIterator;1750 var PointIterator=new CPoint(0,0);1751 var BeginPoint=new CPoint(0,0);1752 var EndPoint=new CPoint(0,0);1753 var MidPoint=new CPoint(0,0);1754 var FindPointIndex=0;1755 PointIterator=this.CurrentFigure.figure_data.m_CPoint[FindPointIndex];1756 1757 for (FindPointIndex;FindPointIndex<this.CurrentFigure.figure_data.nCPointCount;FindPointIndex++)1758 {1759 PointIterator=this.CurrentFigure.figure_data.m_CPoint[FindPointIndex];1760 1761 /*BeginPoint=PointIterator;1762 var NextPoint=FindPointIndex+1;1763 PointIterator=this.CurrentFigure.figure_data.m_CPoint[NextPoint];1764 if (PointIterator==this.CurrentFigure.figure_data.m_CPoint[this.CurrentFigure.figure_data.nCPointCoun-1])1765 {1766 break;1767 }1768 EndPoint=PointIterator;1769 MidPoint.x=GetIntValue(((BeginPoint.x+EndPoint.x)/2.0));1770 MidPoint.y=GetIntValue(((BeginPoint.y+EndPoint.y)/2.0));1771 this.CurrentFigure.figure_data.InsertPoint(FindPointIndex,MidPoint);*/1772 1773 }1774 this.m_nFigureCount++;1775 this.CurrentFigure.figure_id=this.m_nFigureCount;1776 this.CurrentFigure.figure_color=this.m_FigureColor;1777 this.CurrentFigure.figure_type=PolyType; 1778 this.m_csCurrentDrawFigureName=this.m_nFigureCount;1779 1780 this.CurrentFigure.figure_name=this.m_csCurrentDrawFigureName;1781 this.CurrentFigure.ReserverData=this.m_strDataReserved;1782 this.m_csCurrentDrawFigureName="";1783 this.m_FiguresSet.AddFigure(this.CurrentFigure);1784 //FinishDraw(CurrentFigure.figure_id);1785 //SetCurrentSelectFigure(CurrentFigure.figure_id);1786 this.CurrentFigure.ClearFigureData(); 1787 this.m_TempLinesPointSet.ClearData();1788 this.b_DrawPoly=false;1789 this.RepaintControl();1790 1791 1792 } 1793}1794//External Operation Functions1795//åè½: æ¾ç¤ºèåä¿¡æ¯1796function ShowInfo(csInfo,poin) 1797{} 1798//åå°åå§ä½ç½® 1799function BackToInitFigure() 1800{}1801//æ¸
é¤å½åç»å¶ç¶æ1802function ClearDrawStatus() 1803{}1804//å é¤ææå¾å½¢1805function ClearAllFigures() 1806{}1807//åæ¶å¡«å
å¾å½¢1808function CancelFillFigure(nId)1809{}1810//å¤å¶æå®å¾å½¢1811function CopyCurrentSelectFigureRect(nId) 1812{}1813//å é¤æå®ç±»åçå¾å½¢1814function DeleteFigureType(nFigureType) 1815{}1816//å é¤æåä¸ä¸ªå¾å½¢1817function DeleteLastFigure() 1818{}1819//å é¤æå®å¾å½¢1820function DeleteSelectFigure(int) 1821{}1822//å é¤æå®çå¾å½¢åºåï¼ä¸å
æ¬åæ¹æ¡1823function DeleteFigureByName(csName) 1824{}1825//æ¯å¦éä¸è¾¹ç¼ç¹1826function BSelectFigurePoint() 1827{}1828//åæ¹æ¡å¯¹è§ä½ç½®æ¯å¦åæ¶æå¨1829function SetDRectChooseType(bAllShift)1830{}1831//å¾å½¢å½¢æ¯å¦è½å¤ç§»å¨1832function SetFigureMoveStatus(bStatus) 1833{1834 this.b_SubFiguresMove=bStatus;1835}1836//æ¾ç¤ºè¾¹å°æ¹æ¡1837function ShowPointRect(bShow) 1838{}1839//æ¯å¦å
许æ¹åå¾å½¢å¤§å°1840function ChangeFigureSize(bChange) 1841{}1842/************************************************************************/1843/* 1844该ç»å½æ°ç¨æ¥å¨æ§ä»¶ä¸æå¨ç»å¶å¾å½¢1845csFigureName å¾å½¢åå1846strReservedData ä¿çå段1847*/1848/************************************************************************/1849function DrawRectFigure(csFigureName,strReservedDat)//ç»å¶æ¹æ¡1850{1851 this.m_strDataReserved=strReservedDat;1852 this.m_csCurrentDrawFigureName=csFigureName;1853 this.b_DrawRect=true;1854 this.b_DrawDoubleRect=false;1855 this.b_DrawPoly=false;1856 this.b_DrawCircle=false; 1857 this.b_PreDrawRect=false;1858 this.b_PreDrawDoubleRect=false;1859 this.b_PreDrawCircle=false;1860 this.b_LButtonDouC=false;1861 this.CurrentFigure.ClearFigureData();1862 this.m_TempLinesPointSet.ClearData();1863 return this.b_DrawRect;1864}1865function DrawDoubleRectFigure(csFigureName,strReservedData) //ç»å¶åæ¹æ¡1866{1867 this.m_strDataReserved=strReservedData;1868 this.m_csCurrentDrawFigureName=csFigureName;1869 this.b_DrawRect=false;1870 this.b_DrawDoubleRect=true;1871 this.b_DrawPoly=false;1872 this.b_DrawCircle=false; 1873 this.b_PreDrawRect=false;1874 this.b_PreDrawDoubleRect=false;1875 this.b_PreDrawCircle=false;1876 this.b_LButtonDouC=false;1877 this.CurrentFigure.ClearFigureData();1878 this.m_TempLinesPointSet.ClearData();1879 return this.b_DrawDoubleRect;1880}1881function DrawPolyFigure(csFigureName,strReservedData) //ç»å¶å¤è¾¹å½¢1882{1883 this.m_strDataReserved=strReservedData;1884 this.b_DrawRect=false;1885 this.b_DrawDoubleRect=false;1886 this.b_DrawPoly=true;1887 this.b_DrawCircle=false; 1888 this.b_PreDrawRect=false;1889 this.b_PreDrawDoubleRect=false;1890 this.b_PreDrawCircle=false;1891 this.b_LButtonDouC=false;1892 this.CurrentFigure.ClearFigureData();1893 this.m_TempLinesPointSet.ClearData();1894 return this.b_DrawPoly;1895}1896function DrawCircleFigure(csFigureName,strReservedData) //ç»å¶åå½¢ 1897{1898 this.m_strDataReserved=strReservedData;1899 this.b_DrawRect=false;1900 this.b_DrawDoubleRect=false;1901 this.b_DrawPoly=false;1902 this.b_DrawCircle=true; 1903 this.b_PreDrawRect=false;1904 this.b_PreDrawDoubleRect=false;1905 this.b_PreDrawCircle=false;1906 this.b_LButtonDouC=false;1907 this.CurrentFigure.ClearFigureData();1908 this.m_TempLinesPointSet.ClearData();1909 return this.b_DrawCircle;1910} 1911/************************************************************************/1912/* 1913è·åå¾å½¢æ°æ®å
容1914éè¦è·åææå¾å½¢æ°æ®å
容æ¶ï¼å¯ä»¥è°ç¨while(GetNextFigures(Figure figureData)){}çå½¢å¼1915*/1916/************************************************************************/1917//è·åæå®å¾å½¢ä¿¡æ¯ï¼è¿åä¸ä¸ªæéå¯ä»¥ä¿®æ¹Figureä¿¡æ¯1918function GetFigure(figureData,nFigureId)1919{}1920//å
¼å®¹åæ¥ç代ç ï¼è·åä¸ä¸ªFigureçæ·è´1921function GetFigure1(figureData,nFigureId)1922{}1923//è·åæå®ææå¾å½¢ä¿¡æ¯ 1924function GetNextFigures(figureData)1925{}1926//è·åæ§ä»¶å
æ°æ® CFigureControl *DesFigureControl1927function GetFigureData(DesFigureControl)1928{}1929function GetFigureCount()1930{}1931//è·å¾ç»å®å¾å½¢ç±»å1932function GetFigureType(id,type) 1933{}1934//è·åæå®å¾å½¢ç¹ä¸ªæ°1935function GetFigurePointNum(nFigureId)1936{}1937//è·åå¾å½¢çç¹éå,ç¹çåæ 为ç¸å¯¹äºå¾åå·¦ä¸ç¹èè¨çä½ç½® 1938//BOOL CPoint PointData[],int nPointNum)1939function GetFigurePoints(PointData,nPointNum) 1940{}1941//è·å¾å½åå¾åä¸(0,0)çå移 å¦æè¿å为trueè·åæåï¼å¦æ为falseï¼è¶
åºå¾åèå´1942//CPoint 1943function GetShiftDistance() 1944{}1945//è·å¾å½åé¼ æ å¨å¾åä¸çä½ç½®1946//BOOL PointData[MaxCPointCount]1947function GetCurrentCusorInImage(PointData) 1948{}1949//è·å¾å½åéä¸çå¾å½¢IDéå1950//const int* int idNum1951function GetCurrentSelectFigureIdSet(idNum) 1952{}1953//è·å¾å½åçæ¾å¤§åæ°1954//float 1955function GetZoomRate() 1956{}1957//设置å½å缩æ¾ç³»æ°1958//float 1959function SetZoomRate(fRate) 1960{}1961//è¿åé¼ æ éä¸å¾å½¢id1962//int 1963function GetCurrentSelectFigureId() 1964{}1965//è¿åé¼ æ éä¸å¾å½¢idï¼id为设置éä¸çå¾å½¢id1966//int int id1967function GetCurrentSelectFigureId(id) 1968{}1969//è·å¾æåä¸ä¸ªå¾å½¢å½¢ID1970//int 1971function GetLastFigureId() 1972{}1973//bool 1974function GetFigureDrawStatus()1975{}1976//设置å½åç»å¾é¢è²1977function SetDrawFigureColor(COLORREF ) 1978{}1979//ä¿®æ¹å¾å½¢ID1980//BOOL 1981function SetFigureId(nOldFigureId,nNewFigureId)1982{}1983//æ§ä»¶ä¸çªå£çå移 1984//BOOL 1985function setControlShiftDistance(nX,nY) 1986{}1987//设置æå®å¾å½¢ç§»å¨è·ç¦»1988//BOOL 1989function setFigureShiftDistance(nId,nX ,nY)1990{}1991//设置éæç 0-100 1992function setTransparentFigureRate(nRate,nFigureId) 1993{}1994//设置æå®å¾å½¢é¢è²1995function SetFigureColor(COLORREF,nFigureId) 1996{}1997//设置å½åå¾å½¢é£æ ¼ 1-16, bSetSingle表示æ¯å¦åªè®¾ç½®å½åFigure1998function SetFigureStyle(nStyleType,nFigureId,bSetSingle) 1999{}2000//设置å¾å½¢ç¶æ(ALLOWMOVE,ALLOWSIZE), bMode=TRUE 表示添å ï¼bMode=FALSE表示å é¤2001function SetFigureStates(nStates,nFigureId, bMode)2002{}2003//设置å¾å½¢çå称2004function SetFigureName(csName,FigureId)2005{}2006//设置æå®å¾å½¢çä¿çå段å
容 void *ReservedData,int FigureId2007function SetFigureReservedData(ReservedData,FigureId)2008{}2009//æå®å½åéä¸çå¾å½¢2010function SetCurrentSelectFigure(nId) 2011{}2012//æ¾ç¤ºèçææ 2013//BOOL 2014function ShowMaskingProcess(COLORREF,bMask)2015{}2016//设置åå§èæ¯é¢è²2017//bshowAlways æ¯å¦èæ¯é¢è²ä¸ç´æ¾ç¤º2018function SetBackGroundColor(COLORREF ,bshowAlways) 2019{}2020//å¾å平移è·ç¦»2021function SetFigureShiftDistance(nX ,nY)2022{}2023//移å¨ææå¾å½¢2024function SetMoveAllFigures(bMove)2025{2026 this.b_MoveAllFigures=bMove;2027}2028//设置å¾åæ ¹æ®å½åæ§ä»¶å¤§å°ç¼©æ¾2029function SetFitFillControl()2030{2031 var nImageWidth=this.m_Image.width;2032 var nImageHeight=this.m_Image.height;2033 var nWidth=this.m_ClientRect.width;2034 var nHeight=this.m_ClientRect.height;2035 var TempNum,fZoomNum=1; 2036 TempNum=(nHeight*1.0/nImageHeight);2037 fZoomNum=TempNum;2038 TempNum=(nWidth*1.0/nImageWidth);2039 if (fZoomNum>TempNum)2040 {2041 fZoomNum=TempNum;2042 }2043 var fMinValue=1.0;2044 for (var i=FigureControl_MaxZoomScale;i<FigureControl_MaxZoomScale*-1;i++)2045 {2046 if (Math.abs(Math.pow(FigureControl_ScaleBot,i)-fZoomNum)<fMinValue)2047 {2048 fMinValue=Math.abs(Math.pow(FigureControl_ScaleBot,i)-fZoomNum);2049 this.m_nScrollRate=i;2050 }2051 }2052 this.m_fZoomNum=Math.pow(FigureControl_ScaleBot,this.m_nScrollRate);2053 this.RepaintControl();2054}2055//å¡«å
å½åå¾å½¢ 2056//int 2057function FillFigure(nFigureId,COLORREF)2058{}2059//设置æ¯å¦æ¾ç¤ºå¤å´å¾å½¢æ¡2060function SetShowFigureOutsideLine(bSHow,COLORREF)2061{}2062//æ·»å ç¦æ¢æå¨å¾åid2063//BOOL 2064function AddForbiddenFigureId(nFigureId)2065{}2066//å é¤ç¦æ¢æå¨å¾åid2067//BOOL 2068function DeleteForbiddenFigureId(nFigureId) 2069{}2070//设置å½åç©å½¢ä¸ºæ£æ¹å½¢2071//BOOL 2072function SetRectToSquare(FigureId)2073{}2074//æ转å¾å½¢2075//BOOL 2076function RotateFigure(nAngle,CenterPoint,nFigureId)2077{}2078//缩æ¾å¾å½¢2079//BOOL 2080function ZoomFigure(fZoomRate,CenterPoint,nFigureId)2081{}2082//设置为æå¼æ¨¡å¼2083function SetStretchModel(bInterpose)2084{}2085/************************************************************************/2086/* 2087设置æ è®°ç¹2088show æ¯å¦æ¾ç¤º2089LabelPoint å±å¹åæ 2090bOutSide æ¯å¦æ¯å¤é¨åæ 2091*/2092/************************************************************************/2093function ShowPositionLabel(BOOL,point,BOOL) 2094{}2095//è·åé¼ æ æå¨ä½ç½®2096//void GetCursorPosition(CPoint); 2097/************************************************************************/2098/* 2099PointData ç¹æ°æ®2100nPointNum ç¹ä¸ªæ°2101COLORREF å¾å½¢é¢è²2102CString å¾å½¢åå2103strReservedDat ä¿çæ°æ®2104è¿åå¼: æ°å»ºå¾å½¢ID2105*/2106/************************************************************************/2107//å¤é¨ä¼ å
¥å¤è¾¹å½¢æ¹æ¡2108//int CPoint *PointData,int nPointNum,COLORREF,CString,void* strReservedData=NULL2109function O_DrawPolyFigure(PointData,nPointNum,COLORREF,strName,strReservedData)2110{}2111//int 2112function O_DrawPolyFigure1(PointData,nPointNum,COLORREF,strName,strReservedData)2113{}2114//å¤é¨ä¼ å
¥æ¹æ¡ CPoint *PointData2115function O_DrawRectFigure(PointData,COLORREF,strName,strReservedData) 2116{}2117function O_DrawRectFigure1(OutSideRect,COLORREF,strName,strReservedData)2118{}2119//å¤é¨ä¼ å
¥å 2120//int CPoint *PointData2121function O_DrawCircleFigure(PointData,COLORREF,strName, strReservedDat) 2122{}2123//int 2124function O_DrawCirlceFigure1(CenterPoint,nRadius,FigureName,FiugreColor,strReservedDat)2125{}2126//å¤é¨ä¼ åæ¹æ¡ 2127//int 2128function O_DrawDoubleRectFigure(InSidePointData,OutSidePointData,COLORREF,strName,strReservedDat) 2129{}2130//å¤é¨ä¼ åæ¹æ¡2131//int 2132function O_DrawDoubleRectFigure1(InsideRect,OutsideRect,FigureColor,FigureName,strReservedDat)2133{} 2134/************************************************************************/2135/* ç¨äºä¿®æ¹æ§ä»¶å
é¨å¾åæ°æ®å
容 2136注ï¼ä¿®æ¹åæ°æ®æ æ³è¿å2137ææééçå¾åå¨æ§ä»¶å
é¨é½è½¬æ¢ä¸ºRGBAå¤çï¼å½éè¦ä¿®æ¹åééæ¶ï¼å¯ä»¥å°RGBå¼é½è®¾ä¸ºä¸æ ·2138*/2139/************************************************************************/2140//ä¿®æ¹å¾åååç´ 2141//BOOL 2142function SetImagePix(pt,nRValue,nGValue,nBValue) 2143{}2144//è·åå¾åååç´ å
容2145//BOOL CPoint pt,int RValue,int nGValue,int nBValue2146function GetImagePix(pt,RValue,nGValue,nBValue) 2147{}2148//å·æ°æ§ä»¶2149function ReFreshControl()2150{} 2151//éæ¾æ§ä»¶æ°æ®2152//BOOL 2153function FreeControl()2154{}2155//public: 2156/************************************************************************/2157/* 2158Imgobject IMG_OBJ *buffer2159Pt æ§ä»¶å¨æå¨åºç¨ç¨åºçªå£çä½ç½®çå·¦ä¸è§2160ImgColor åå§é¢è²2161ZoomData åå§æ¾å¤§åæ°2162FilePath å¾çè·¯å¾2163pParent æ§ä»¶æå¨çªå£æé2164è¿åå¼ï¼æ¯å¦åå§åæå2165*/2166/************************************************************************/2167//ä»buffer导å
¥2168//BOOL IMG_OBJ *Imgobject,CWnd *pParent,COLORREF ImgColor=RGB(255,0,0),float ZoomData=0, bEnableEvent2169function InitFigureControlFromBuffer(Imgobject,pParent,ImgColor,ZoomData,bEnableEvent) 2170{2171}2172//ä»æ件导å
¥æ°æ®2173//BOOL LPCTSTR FilePath,CPoint pt,COLORREF ImgColor=RGB(255,0,0),float ZoomData=0, BOOL bEnableEvent=FALSE2174function InitFigureControlFromFile(context,canvas,ImageName,Control)2175{2176 this.m_Context=context;2177 this.m_Canvas=canvas; 2178 var Rect=getBrowserPosition(this.m_Canvas); 2179 this.x_Distance=Rect.left;2180 this.y_Distance=Rect.top;2181 2182 this.b_LoadData=true;2183 this.m_Image.onload=function(){ 2184 Control.SetFitFillControl();2185 Control.ShiftImageToCenter();2186 } 2187 2188 this.m_Image.src=ImageName; 2189 this.m_ClientRect=this.m_Canvas.getBoundingClientRect()2190 2191 2192 //é¼ æ 缩æ¾2193 this.m_Canvas.onmousewheel=this.m_Canvas.onwheel=function(event){2194 var pt=new CPoint(event.clientX,event.clientY);2195 Control.MouseWheel(event.wheelDelta,pt);2196 Control.RepaintControl();2197 } 2198 2199 //é¼ æ æä¸å·¦é®2200 this.m_Canvas.onmousedown=function(event){ 2201 2202 if(event.button==0)2203 {2204 var pt=new CPoint(event.clientX,event.clientY);2205 Control.m_bMouseClickFlag=true;2206 Control.LButtonDown(pt);2207 2208 //é¼ æ 移å¨2209 Control.m_Canvas.onmousemove=function(event)2210 {2211 Control.m_Canvas.style.cursor="move";2212 var pt=new CPoint(event.clientX,event.clientY); 2213 Control.MouseMove(pt);2214 }2215 }2216 2217 //é¼ æ æ¾å¼å·¦é® 2218 Control.m_Canvas.onmouseup=function(){2219 if(event.button==0)2220 {2221 Control.m_bMouseClickFlag=false;2222 var pt=new CPoint(event.clientX,event.clientY);2223 2224 Control.LButtonUp(pt);2225 Control.m_Canvas.onmousemove=null;2226 Control.m_Canvas.onmouseup=null;2227 Control.m_Canvas.style.cursor="default";2228 } 2229 } 2230 }2231 2232 //é¼ æ 移å¨2233 this.m_Canvas.onmousemove=function(event)2234 {2235 var pt=new CPoint(event.clientX,event.clientY); 2236 Control.MouseMove(pt);2237 }2238 2239 //é¼ æ åå»å·¦é® 2240 this.m_Canvas.ondblclick=function()2241 {2242 if(event.button==0)2243 {2244 var pt=new CPoint(event.clientX,event.clientY); 2245 Control.LButtonDblClk(pt);2246 } 2247 }2248}2249 2250//æªåå§åï¼ç¨å½åç¯å¢æ¾ç¤º2251//BOOL IMG_OBJ*2252function LoadImageFromBuffer(fControl)2253{2254 //var imagedata_Org = this.m_Context.getImageData(0, 0,this.m_Image.width, this.m_Image.height);2255 var imagedata;//=mew Image;2256 //Image.2257 for(var i = 0, n = imagedata.data.length; i < n; i += 3) 2258 { 2259 imagedata.data[i + 0] = 255 - imagedata.data[i + 0]; //red;2260 imagedata.data[i + 1] = 255 - imagedata.data[i + 1]; //green2261 imagedata.data[i + 2] = 255 - imagedata.data[i + 2]; //blue2262 //imagedata.data[i + 3] = 255 - imagedata.data[i + 3]; //a2263 }2264 this.m_Context.putImageData(imagedata, 0, 0);2265} 2266//æªåå§åï¼ç¨å½åç¯å¢æ¾ç¤º2267//BOOL LPCTSTR FilePath2268function LoadImageFromFile(ImageName,Control)2269{ 2270 this.m_Image.onload=function(){2271 Control.RepaintControl();2272 } 2273 2274 this.m_Image.src=ImageName; 2275 2276 //é¼ æ 缩æ¾2277 this.m_Canvas.onmousewheel=this.m_Canvas.onwheel=function(event){2278 var pt=new CPoint(event.clientX,event.clientY);2279 Control.MouseWheel(event.wheelDelta,pt);2280 Control.RepaintControl();2281 } 2282 2283 //é¼ æ æä¸å·¦é®2284 this.m_Canvas.onmousedown=function(event){ 2285 2286 if(event.button==0)2287 {2288 var pt=new CPoint(event.clientX,event.clientY);2289 Control.m_bMouseClickFlag=true;2290 Control.LButtonDown(pt);2291 2292 //é¼ æ 移å¨2293 Control.m_Canvas.onmousemove=function(event)2294 {2295 Control.m_Canvas.style.cursor="move";2296 var pt=new CPoint(event.clientX,event.clientY); 2297 Control.MouseMove(pt);2298 }2299 }2300 2301 //é¼ æ æ¾å¼å·¦é® 2302 Control.m_Canvas.onmouseup=function(){2303 if(event.button==0)2304 {2305 Control.m_bMouseClickFlag=false;2306 var pt=new CPoint(event.clientX,event.clientY);2307 2308 Control.LButtonUp(pt);2309 Control.m_Canvas.onmousemove=null;2310 Control.m_Canvas.onmouseup=null;2311 Control.m_Canvas.style.cursor="default";2312 } 2313 } 2314 }2315 2316 //é¼ æ 移å¨2317 this.m_Canvas.onmousemove=function(event)2318 {2319 var pt=new CPoint(event.clientX,event.clientY); 2320 Control.MouseMove(pt);2321 }2322 2323 //é¼ æ åå»å·¦é® 2324 this.m_Canvas.ondblclick=function()2325 {2326 if(event.button==0)2327 {2328 var pt=new CPoint(event.clientX,event.clientY); 2329 Control.LButtonDblClk(pt);2330 } 2331 }2332} 2333//åè°å½æ°ï¼ç¨æ¥å¤çå¤é¨ç»å¶è¦æ±2334//BOOL 2335//nType=1,3,42336//BOOL 2337function WriteBmpToFile(nType,csPath) 2338{} 2339//BOOL list<Figure>::iterator pFigure, int nShiftX, int nShiftY2340function CheckFigureGotoOutSide(pFigure, nShiftX,nShiftY)2341{}2342//CRect * pRect , list<Figure>::iterator Iterator2343function GetFigureOutsideRect(pRect,Iterator)2344{}2345function MouseMove(point) //移å¨é¼ æ 2346{2347 var bInvalidate=0;2348 point.x-=this.x_Distance;2349 point.y-=this.y_Distance; 2350 var nSelectRectSize=GetIntValue(2+Math.abs(1/this.m_fZoomNum));2351 if (!PointInCurrentRect(this.m_ClientRect,point))2352 {2353 this.b_CursorInOutSide=true;2354 return;2355 } 2356 else2357 {2358 this.b_CursorInOutSide=false;2359 }2360 if (this.b_DrawRect || this.b_DrawPoly ||this.b_DrawCircle ||this.b_LeftButtonDown ||this.b_DrawDoubleRect)2361 {2362 bInvalidate++;2363 }2364 PointEqual(this.m_MovePoint_cursor,point); 2365 //å¦æç»å¾å½¢æ¶ï¼é¼ æ 移å¨å°å¯¹è±¡å¾å¤2366 if ((this.b_DrawRect || this.b_DrawPoly ||this.b_DrawCircle) && this.PointGoOutSide(this.m_MovePoint_cursor))2367 {2368 return;2369 } 2370 var tempPoint=new CPoint(0,0);2371 tempPoint.x=this.m_MovePoint_cursor.x+FigureControl_DoubleRectDistance;2372 tempPoint.y=this.m_MovePoint_cursor.y+FigureControl_DoubleRectDistance;2373 if (this.PointGoOutSide(tempPoint) && this.b_DrawDoubleRect)2374 {2375 return;2376 }2377 if(this.m_bMouseClickFlag)2378 {2379 this.m_cpCurrentPoint_cursor.x=point.x;2380 this.m_cpCurrentPoint_cursor.y=point.y; 2381 2382 this.m_cpDistancePoint.x=this.m_cpCurrentPoint_cursor.x-this.m_cpOriginalPoint_cursor.x;2383 this.m_cpDistancePoint.y=this.m_cpCurrentPoint_cursor.y-this.m_cpOriginalPoint_cursor.y; 2384 var m_cpCurrentPoint_cursor=new CPoint(0,0);2385 PointEqual(m_cpCurrentPoint_cursor,point); 2386 2387 //æå¨å¾å½¢è¾¹ç¼ç¹ 2388 if (this.b_FigurePointSelect&& !this.PointGoOutSide(this.m_cpCurrentPoint_cursor))2389 {2390 var Index=0;2391 var Iterator=new Figure; 2392 for(Index;Index<this.m_FiguresSet.m_nFigureCount;Index++)2393 {2394 Iterator=this.m_FiguresSet.m_Figures[Index];2395 var b_find=0;2396 var b_RelativeWindow=false;2397 var distance=0;2398 varcurrentFigurePos=-1;2399 2400 if (Iterator.figure_id==this.CurrentSelectPoint.Figure_id)2401 { 2402 if ( Iterator.figure_type==RectType || Iterator.figure_type==PolyType)2403 { 2404 var FindIterator=new CPoint(0,0);2405 var FindIndex=0;2406 var pointNum=0 //å½å移å¨å°ç¬¬å 个ç¹2407 var nSquredMoveDistance=0;2408 for(FindIndex;FindIndex<Iterator.figure_data.nCPointCount;FindIndex++)2409 {2410 pointNum++; 2411 FindIterator=Iterator.figure_data.m_CPoint[FindIndex];2412 2413 if ((FindIterator.x==this.CurrentSelectPoint.Figure_point.x && FindIterator.y==this.CurrentSelectPoint.Figure_point.y))2414 {2415 if (Iterator.figure_type==PolyType)2416 { 2417 FindIterator.x=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum);2418 FindIterator.y=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum);2419 2420 this.CurrentSelectPoint.Figure_point.x=FindIterator.x;2421 this.CurrentSelectPoint.Figure_point.y=FindIterator.y; 2422 }2423 if ( Iterator.figure_type==RectType)2424 { 2425 var nMoveDistance_x=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum)-FindIterator.x; 2426 var nMoveDistance_y=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum)-FindIterator.y; 2427 nSquredMoveDistance=nMoveDistance_x;2428 2429 switch (pointNum)2430 {2431 case 1: //第ä¸ä¸ªç¹2432 if (Iterator.bShowSqure)2433 { 2434 FindIterator.x+=nSquredMoveDistance;2435 FindIterator.y+=nSquredMoveDistance;2436 FindIterator=Iterator.figure_data.m_CPoint[1];2437 2438 FindIterator.x-=nSquredMoveDistance;2439 FindIterator.y+=nSquredMoveDistance;2440 FindIterator=Iterator.figure_data.m_CPoint[2];2441 FindIterator.x-=nSquredMoveDistance;2442 FindIterator.y-=nSquredMoveDistance;2443 FindIterator=Iterator.figure_data.m_CPoint[3];2444 FindIterator.x+=nSquredMoveDistance;2445 FindIterator.y-=nSquredMoveDistance; 2446 }2447 else2448 {2449 var pt=new CPoint(0,0); 2450 pt.x=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum);2451 pt.y=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum); 2452 2453 Iterator.figure_data.m_CPoint[0].x=pt.x;2454 Iterator.figure_data.m_CPoint[0].y=pt.y;2455 2456 Iterator.figure_data.m_CPoint[1].y=pt.y;2457 2458 Iterator.figure_data.m_CPoint[3].x=pt.x; 2459 } 2460 break; 2461 case 2:2462 if (Iterator.bShowSqure)2463 {2464 FindIterator=Iterator.figure_data.m_CPoint[0];2465 FindIterator.x-=nSquredMoveDistance;2466 FindIterator.y-=nSquredMoveDistance;2467 FindIterator=Iterator.figure_data.m_CPoint[1];2468 FindIterator.x+=nSquredMoveDistance;2469 FindIterator.y-=nSquredMoveDistance;2470 FindIterator=Iterator.figure_data.m_CPoint[2];2471 FindIterator.x+=nSquredMoveDistance;2472 FindIterator.y+=nSquredMoveDistance;2473 FindIterator=Iterator.figure_data.m_CPoint[3];2474 FindIterator.x-=nSquredMoveDistance;2475 FindIterator.y+=nSquredMoveDistance; 2476 }2477 else2478 {2479 var pt=new CPoint(0,0); 2480 pt.x=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum);2481 pt.y=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum); 2482 2483 Iterator.figure_data.m_CPoint[1].x=pt.x;2484 Iterator.figure_data.m_CPoint[1].y=pt.y;2485 2486 Iterator.figure_data.m_CPoint[0].y=pt.y;2487 2488 Iterator.figure_data.m_CPoint[2].x=pt.x; 2489 } 2490 break;2491 case 3:2492 if (Iterator.bShowSqure)2493 {2494 FindIterator=Iterator.figure_data.m_CPoint[0];2495 FindIterator.x-=nSquredMoveDistance;2496 FindIterator.y-=nSquredMoveDistance;2497 FindIterator=Iterator.figure_data.m_CPoint[1];2498 FindIterator.x+=nSquredMoveDistance;2499 FindIterator.y-=nSquredMoveDistance; 2500 FindIterator=Iterator.figure_data.m_CPoint[2];2501 FindIterator.x+=nSquredMoveDistance;2502 FindIterator.y+=nSquredMoveDistance;2503 FindIterator=Iterator.figure_data.m_CPoint[3];2504 }2505 else2506 {2507 var pt=new CPoint(0,0); 2508 pt.x=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum);2509 pt.y=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum); 2510 2511 Iterator.figure_data.m_CPoint[2].x=pt.x;2512 Iterator.figure_data.m_CPoint[2].y=pt.y;2513 2514 Iterator.figure_data.m_CPoint[1].x=pt.x;2515 2516 Iterator.figure_data.m_CPoint[3].y=pt.y; 2517 } 2518 break;2519 case 4:2520 if (Iterator.bShowSqure)2521 {2522 FindIterator.x+=nSquredMoveDistance;2523 FindIterator.y-=nSquredMoveDistance;2524 FindIterator=Iterator.figure_data.m_CPoint[2];2525 FindIterator.x-=nSquredMoveDistance;2526 FindIterator.y-=nSquredMoveDistance;2527 FindIterator=Iterator.figure_data.m_CPoint[1];2528 FindIterator.x-=nSquredMoveDistance;2529 FindIterator.y+=nSquredMoveDistance;2530 FindIterator=Iterator.figure_data.m_CPoint[0];2531 FindIterator.x+=nSquredMoveDistance;2532 FindIterator.y+=nSquredMoveDistance;2533 }2534 else2535 {2536 var pt=new CPoint(0,0); 2537 pt.x=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum);2538 pt.y=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum); 2539 2540 Iterator.figure_data.m_CPoint[3].x=pt.x;2541 Iterator.figure_data.m_CPoint[3].y=pt.y;2542 2543 Iterator.figure_data.m_CPoint[2].y=pt.y;2544 2545 Iterator.figure_data.m_CPoint[0].x=pt.x; 2546 } 2547 break;2548 default:2549 break;2550 } 2551 this.CurrentSelectPoint.Figure_point.x=FindIterator.x;2552 this.CurrentSelectPoint.Figure_point.y=FindIterator.y; 2553 b_find=1;2554 break; //æ¾å°è¯¥ç¹åéåº2555 }2556 } //end of list of point//*/2557 if ((Iterator.figure_type==RectType &&this.CurrentSelectPoint.nPointIndex>=5))2558 {2559 //ä¸é´ç¹ 2560 FindIterator=Iterator.figure_data.m_CPoint[0];2561 var pt=new CPoint(0,0); 2562 switch(this.CurrentSelectPoint.nPointIndex)2563 {2564 case 5: 2565 pt.y=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum);2566 FindIterator.y=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum);2567 FindIterator=Iterator.figure_data.m_CPoint[1];2568 FindIterator.y=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum);2569 break;2570 case 6: 2571 pt.x=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum); 2572 FindIterator=Iterator.figure_data.m_CPoint[1];2573 FindIterator.x=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum);2574 FindIterator=Iterator.figure_data.m_CPoint[2];2575 FindIterator.x=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum); 2576 break;2577 case 7: 2578 pt.y=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum); 2579 FindIterator=Iterator.figure_data.m_CPoint[2];2580 FindIterator.y=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum);2581 FindIterator=Iterator.figure_data.m_CPoint[3];2582 FindIterator.y=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum); 2583 break;2584 case 8: 2585 pt.x=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum);2586 FindIterator.x=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum);2587 FindIterator=Iterator.figure_data.m_CPoint[3];2588 FindIterator.x=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum); 2589 break;2590 default:2591 break;2592 } 2593 b_find=1;2594 //break; //æ¾å°è¯¥ç¹åéåº2595 }2596 } //end of recttype ,polytype2597 }2598 if(Iterator.figure_type==CircleType)2599 { 2600 var pt=new Array(5);2601 for(var index=0;index<5;index++)2602 pt[index]=new CPoint(0,0);2603 2604 pt[1].x=Iterator.figure_rect.left+GetIntValue((Iterator.figure_rect.right-Iterator.figure_rect.left)/2);2605 pt[1].y=Iterator.figure_rect.top; 2606 pt[2].x=Iterator.figure_rect.right;2607 pt[2].y=Iterator.figure_rect.top+GetIntValue((Iterator.figure_rect.bottom-Iterator.figure_rect.top)/2); 2608 pt[3].x=Iterator.figure_rect.left+GetIntValue((Iterator.figure_rect.right-Iterator.figure_rect.left)/2);2609 pt[3].y=Iterator.figure_rect.bottom; 2610 pt[4].x=Iterator.figure_rect.left;2611 pt[4].y=Iterator.figure_rect.top+GetIntValue((Iterator.figure_rect.bottom-Iterator.figure_rect.top)/2);2612 for (var i=1;i<=4;i++)2613 { 2614 if(Math.abs(pt[i].x-this.CurrentSelectPoint.Figure_point.x)<=nSelectRectSize 2615 && Math.abs(pt[i].y-this.CurrentSelectPoint.Figure_point.y)<=nSelectRectSize)2616 {2617 switch(i)2618 {2619 case 1:2620 Iterator.figure_rect.top=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum); //åå
¥å¾åç¹2621 this.CurrentSelectPoint.Figure_point.y=Iterator.figure_rect.top; 2622 break;2623 case 2: 2624 Iterator.figure_rect.right=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum);2625 this.CurrentSelectPoint.Figure_point.x=Iterator.figure_rect.right;2626 break;2627 case 3:2628 Iterator.figure_rect.bottom=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum);2629 this.CurrentSelectPoint.Figure_point.y=Iterator.figure_rect.bottom; 2630 break;2631 case 4:2632 Iterator.figure_rect.left=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum);2633 this.CurrentSelectPoint.Figure_point.x=Iterator.figure_rect.left;2634 break;2635 default:2636 break; 2637 } 2638 b_find=1;2639 break;2640 }2641 }2642 }2643 if (Iterator.figure_type==DrectType)2644 {2645 var pt=new Array(9);2646 for(var index=0;index<9;index++)2647 pt[index]=new CPoint(0,0);2648 2649 pt[1].x=Iterator.figure_rect.left;2650 pt[1].y=Iterator.figure_rect.top;2651 pt[2].x=Iterator.figure_rect.right;2652 pt[2].y=Iterator.figure_rect.top;2653 pt[3].x=Iterator.figure_rect.right;2654 pt[3].y=Iterator.figure_rect.bottom;2655 pt[4].x=Iterator.figure_rect.left;2656 pt[4].y=Iterator.figure_rect.bottom;2657 pt[5].x=Iterator.figure_rect_outside.left;2658 pt[5].y=Iterator.figure_rect_outside.top;2659 pt[6].x=Iterator.figure_rect_outside.right;2660 pt[6].y=Iterator.figure_rect_outside.top;2661 pt[7].x=Iterator.figure_rect_outside.right;2662 pt[7].y=Iterator.figure_rect_outside.bottom;2663 pt[8].x=Iterator.figure_rect_outside.left;2664 pt[8].y=Iterator.figure_rect_outside.bottom; 2665 for (var i=1;i<=8;i++)2666 { 2667 if(Math.abs(pt[i].x-this.CurrentSelectPoint.Figure_point.x)<nSelectRectSize && Math.abs(pt[i].y-this.CurrentSelectPoint.Figure_point.y)<nSelectRectSize)2668 {2669 var MoveDistance_x=0,MoveDistance_y=0; 2670 var CurrentPointCursor=new CPoint(0,0);2671 CurrentPointCursor.x=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum); 2672 CurrentPointCursor.y=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum); 2673 switch(i)2674 {2675 case 1: 2676 if (CurrentPointCursor.x>=pt[2].x || CurrentPointCursor.y>=pt[4].y )2677 {2678 break;2679 }2680 else2681 {2682 MoveDistance_x=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum)-Iterator.figure_rect.left; 2683 MoveDistance_y=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum)-Iterator.figure_rect.top; 2684 Iterator.figure_rect.left=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum); 2685 Iterator.figure_rect.top=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum); 2686 if (Iterator.figure_rect_outside.left+MoveDistance_x<=0 || Iterator.figure_rect_outside.top+MoveDistance_y<=0)2687 {2688 break;2689 }2690 else2691 {2692 Iterator.figure_rect_outside.left+=MoveDistance_x;2693 Iterator.figure_rect_outside.top+=MoveDistance_y;2694 this.CurrentSelectPoint.Figure_point.x=Iterator.figure_rect.left;2695 this.CurrentSelectPoint.Figure_point.y=Iterator.figure_rect.top;2696 break;2697 } 2698 } 2699 case 2:2700 if (CurrentPointCursor.x<=pt[1].x || CurrentPointCursor.y>=pt[3].y)2701 {2702 break;2703 }2704 else2705 {2706 MoveDistance_x=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum)-Iterator.figure_rect.right; 2707 MoveDistance_y=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum)-Iterator.figure_rect.top; 2708 Iterator.figure_rect.right=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum); 2709 Iterator.figure_rect.top=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum); 2710 if (Iterator.figure_rect_outside.right+MoveDistance_x>=this.m_RectFigure.right || Iterator.figure_rect_outside.top+MoveDistance_y<=0)2711 {2712 break;2713 }2714 else2715 {2716 Iterator.figure_rect_outside.right+=MoveDistance_x;2717 Iterator.figure_rect_outside.top+=MoveDistance_y;2718 this.CurrentSelectPoint.Figure_point.x=Iterator.figure_rect.right;2719 this.CurrentSelectPoint.Figure_point.y=Iterator.figure_rect.top;2720 break;2721 } 2722 } 2723 case 3:2724 if (CurrentPointCursor.x<=pt[4].x || CurrentPointCursor.y<=pt[2].y)2725 {2726 break;2727 }2728 else2729 {2730 MoveDistance_x=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum)-Iterator.figure_rect.right; 2731 MoveDistance_y=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum)-Iterator.figure_rect.bottom; 2732 Iterator.figure_rect.right=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum); 2733 Iterator.figure_rect.bottom=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum); 2734 if (Iterator.figure_rect_outside.right+MoveDistance_x>=this.m_RectFigure.right || Iterator.figure_rect_outside.bottom+MoveDistance_y>=this.m_RectFigure.bottom)2735 {2736 break;2737 }2738 else2739 {2740 Iterator.figure_rect_outside.right+=MoveDistance_x;2741 Iterator.figure_rect_outside.bottom+=MoveDistance_y;2742 this.CurrentSelectPoint.Figure_point.x=Iterator.figure_rect.right;2743 this.CurrentSelectPoint.Figure_point.y=Iterator.figure_rect.bottom;2744 break;2745 } 2746 } 2747 case 4:2748 if (CurrentPointCursor.x>=pt[3].x || CurrentPointCursor.y<=pt[1].y)2749 {2750 break;2751 }2752 else2753 {2754 MoveDistance_x=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum)-Iterator.figure_rect.left; 2755 MoveDistance_y=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum)-Iterator.figure_rect.bottom; 2756 Iterator.figure_rect.left=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum); 2757 Iterator.figure_rect.bottom=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum); 2758 if (Iterator.figure_rect_outside.left+MoveDistance_x<=0 || Iterator.figure_rect_outside.bottom+MoveDistance_y>=this.m_RectFigure.bottom)2759 {2760 break;2761 }2762 else2763 {2764 Iterator.figure_rect_outside.left+=MoveDistance_x;2765 Iterator.figure_rect_outside.bottom+=MoveDistance_y;2766 this.CurrentSelectPoint.Figure_point.x=Iterator.figure_rect.left;2767 this.CurrentSelectPoint.Figure_point.y=Iterator.figure_rect.bottom;2768 break;2769 } 2770 } 2771 case 5: 2772 if (this.PointInRectEdge(CurrentPointCursor,Iterator.figure_rect,LeftTop))2773 {2774 if (this.b_ChooseDRectType)2775 {2776 MoveDistance_x=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum)-Iterator.figure_rect_outside.left; 2777 MoveDistance_y=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum)-Iterator.figure_rect_outside.top; 2778 if (Iterator.figure_rect_outside.right-MoveDistance_x>=this.m_RectFigure.right || Iterator.figure_rect_outside.bottom-MoveDistance_y>=this.m_RectFigure.bottom)2779 {2780 break;2781 }2782 else2783 {2784 Iterator.figure_rect_outside.left=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum); 2785 Iterator.figure_rect_outside.top=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum); 2786 //æ ¹æ®çºªå¿µå¸ç®æ³ä¿®æ¹2787 Iterator.figure_rect_outside.right-=MoveDistance_x;2788 Iterator.figure_rect_outside.bottom-=MoveDistance_y;2789 this.CurrentSelectPoint.Figure_point.x=Iterator.figure_rect_outside.left;2790 this.CurrentSelectPoint.Figure_point.y=Iterator.figure_rect_outside.top;2791 } 2792 }2793 else2794 {2795 Iterator.figure_rect_outside.left=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum); 2796 Iterator.figure_rect_outside.top=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum); 2797 this.CurrentSelectPoint.Figure_point.x=Iterator.figure_rect_outside.left;2798 this.CurrentSelectPoint.Figure_point.y=Iterator.figure_rect_outside.top;2799 }2800 } 2801 break;2802 case 6: 2803 if (this.PointInRectEdge(CurrentPointCursor,Iterator.figure_rect,RightTop))2804 {2805 if (this.b_ChooseDRectType)2806 {2807 MoveDistance_x=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum)-Iterator.figure_rect_outside.right; 2808 MoveDistance_y=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum)-Iterator.figure_rect_outside.top; 2809 if (Iterator.figure_rect_outside.left-MoveDistance_x<=0 || Iterator.figure_rect_outside.bottom-MoveDistance_y>=this.m_RectFigure.bottom)2810 {2811 break;2812 }2813 else2814 {2815 Iterator.figure_rect_outside.right=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum); 2816 Iterator.figure_rect_outside.top=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum); 2817 //æ ¹æ®çºªå¿µå¸ç®æ³ä¿®æ¹2818 Iterator.figure_rect_outside.left-=MoveDistance_x;2819 Iterator.figure_rect_outside.bottom-=MoveDistance_y; 2820 this.CurrentSelectPoint.Figure_point.x=Iterator.figure_rect_outside.right;2821 this.CurrentSelectPoint.Figure_point.y=Iterator.figure_rect_outside.top;2822 } 2823 }2824 else2825 {2826 Iterator.figure_rect_outside.right=GetIntValue((m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum); 2827 Iterator.figure_rect_outside.top=GetIntValue((m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum); 2828 this.CurrentSelectPoint.Figure_point.x=Iterator.figure_rect_outside.right;2829 this.CurrentSelectPoint.Figure_point.y=Iterator.figure_rect_outside.top;2830 }2831 } 2832 break;2833 case 7: 2834 if (this.PointInRectEdge(CurrentPointCursor,Iterator.figure_rect,RightBottom))2835 {2836 if (this.b_ChooseDRectType)2837 {2838 MoveDistance_x=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum)-Iterator.figure_rect_outside.right; 2839 MoveDistance_y=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum)-Iterator.figure_rect_outside.bottom; 2840 if (Iterator.figure_rect_outside.left-MoveDistance_x<=0 || Iterator.figure_rect_outside.top-MoveDistance_y<=0)2841 {2842 break;2843 }2844 else2845 {2846 Iterator.figure_rect_outside.right=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum); 2847 Iterator.figure_rect_outside.bottom=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum); 2848 //æ ¹æ®çºªå¿µå¸ç®æ³ä¿®æ¹2849 Iterator.figure_rect_outside.left-=MoveDistance_x;2850 Iterator.figure_rect_outside.top-=MoveDistance_y;2851 this.CurrentSelectPoint.Figure_point.x=Iterator.figure_rect_outside.right;2852 this.CurrentSelectPoint.Figure_point.y=Iterator.figure_rect_outside.bottom;2853 }2854 }2855 else2856 {2857 Iterator.figure_rect_outside.right=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum); 2858 Iterator.figure_rect_outside.bottom=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum); 2859 this.CurrentSelectPoint.Figure_point.x=Iterator.figure_rect_outside.right;2860 this.CurrentSelectPoint.Figure_point.y=Iterator.figure_rect_outside.bottom;2861 }2862 } 2863 break;2864 case 8: 2865 if (this.PointInRectEdge(CurrentPointCursor,Iterator.figure_rect,LeftBottom))2866 {2867 if (this.b_ChooseDRectType)2868 {2869 MoveDistance_x=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/m_fZoomNum)-Iterator.figure_rect_outside.left; 2870 MoveDistance_y=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/m_fZoomNum)-Iterator.figure_rect_outside.bottom; 2871 if (Iterator.figure_rect_outside.right-MoveDistance_x>=m_RectFigure.right || Iterator.figure_rect_outside.top-MoveDistance_y<=0)2872 {2873 break;2874 }2875 else2876 {2877 Iterator.figure_rect_outside.left=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum); 2878 Iterator.figure_rect_outside.bottom=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum); 2879 //æ ¹æ®çºªå¿µå¸ç®æ³ä¿®æ¹2880 Iterator.figure_rect_outside.right-=MoveDistance_x;2881 Iterator.figure_rect_outside.top-=MoveDistance_y; 2882 this.CurrentSelectPoint.Figure_point.x=Iterator.figure_rect_outside.left;2883 this.CurrentSelectPoint.Figure_point.y=Iterator.figure_rect_outside.bottom;2884 }2885 }2886 else2887 {2888 Iterator.figure_rect_outside.left=GetIntValue((this.m_cpCurrentPoint_cursor.x-this.OriginalPoint_Bitmap.x)/this.m_fZoomNum); 2889 Iterator.figure_rect_outside.bottom=GetIntValue((this.m_cpCurrentPoint_cursor.y-this.OriginalPoint_Bitmap.y)/this.m_fZoomNum); 2890 this.CurrentSelectPoint.Figure_point.x=Iterator.figure_rect_outside.left;2891 this.CurrentSelectPoint.Figure_point.y=Iterator.figure_rect_outside.bottom;2892 }2893 } 2894 break;2895 default:2896 break;2897 }2898 b_find=1;2899 break;2900 }2901 }2902 }2903 }2904 if (b_find==1)2905 { 2906 break;2907 }2908 }2909 bInvalidate++;2910 }2911 //平移ææå¾å½¢2912 if (this.b_SubFiguresMove && this.b_FigurePointSelect==false && this.b_LeftButtonDown==true )2913 { 2914 var FindIterator=new Figure;2915 var FindIndex=0; 2916 for(FindIndex;FindIndex<this.m_FiguresSet.m_nFigureCount;FindIndex++)2917 { 2918 FindIterator=this.m_FiguresSet.m_Figures[FindIndex];2919 if ((FindIterator.figure_id==this.m_nCursorInFigureId && this.m_SelectSubFigureRectIdSet.m_nFigureRectCount>0)2920 || this.b_MoveAllFigures)2921 { 2922 FindIterator.MoveFigure(this.m_cpDistancePoint.x,this.m_cpDistancePoint.y);2923 var b_OutSide=false;2924 if (FindIterator.figure_type==DrectType)2925 {2926 var p1=new CPoint(0,0);2927 var p2=new CPoint(0,0); 2928 p1.x=GetIntValue(FindIterator.figure_rect_outside.left*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+FindIterator.shift_x;2929 p1.y=GetIntValue(FindIterator.figure_rect_outside.top*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+FindIterator.shift_y;2930 p2.x=GetIntValue(FindIterator.figure_rect_outside.right*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+FindIterator.shift_x; 2931 p2.y=GetIntValue(FindIterator.figure_rect_outside.bottom*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+FindIterator.shift_y;2932 if (this.PointGoOutSide(p1) || this.PointGoOutSide(p2))2933 {2934 b_OutSide=true;2935 }2936 if (b_OutSide)2937 {2938 FindIterator.MoveFigure(-1*m_cpDistancePoint.x,-1*m_cpDistancePoint.y);2939 }2940 }2941 else if(FindIterator.figure_type==CircleType)2942 {2943 var p1=new CPoint(0,0);2944 var p2=new CPoint(0,0); 2945 p1.x=GetIntValue(FindIterator.figure_rect.left*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+FindIterator.shift_x;2946 p1.y=GetIntValue(FindIterator.figure_rect.top*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+FindIterator.shift_y;2947 p2.x=GetIntValue(FindIterator.figure_rect.right*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+FindIterator.shift_x; 2948 p2.y=GetIntValue(FindIterator.figure_rect.bottom*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+FindIterator.shift_y;2949 if (this.PointGoOutSide(p1) || this.PointGoOutSide(p2))2950 {2951 b_OutSide=true;2952 }2953 if (b_OutSide)2954 {2955 FindIterator.MoveFigure(-1*this.m_cpDistancePoint.x,-1*this.m_cpDistancePoint.y);2956 } 2957 }2958 else //å
¶å®ç为ç¹ç»æçå¾å½¢2959 { 2960 var PointIterator=new CPoint(0,0);2961 var nPointIndex=0;2962 var nFindPointIndex=0;2963 for (nFindPointIndex;nFindPointIndex<FindIterator.figure_data.nCPointCount;nFindPointIndex++)2964 {2965 PointIterator=FindIterator.figure_data.m_CPoint[nFindPointIndex];2966 var TempPoint=new CPoint(0,0);2967 TempPoint.x=GetIntValue(PointIterator.x*this.m_fZoomNum)+this.OriginalPoint_Bitmap.x+FindIterator.shift_x;2968 TempPoint.y=GetIntValue(PointIterator.y*this.m_fZoomNum)+this.OriginalPoint_Bitmap.y+FindIterator.shift_y;2969 if(this.PointGoOutSide((TempPoint)))2970 {2971 b_OutSide=true;2972 break;2973 } 2974 nPointIndex++; 2975 }2976 if (b_OutSide)2977 {2978 FindIterator.MoveFigure(-1*m_cpDistancePoint.x,-1*m_cpDistancePoint.y);2979 }2980 } 2981 } 2982 }2983 bInvalidate++;2984 } 2985 else if(this.b_SubFiguresMove==false && this.b_FigurePointSelect==false && this.b_LeftButtonDown==true && this.b_DrawPoly==false)2986 { 2987 this.OriginalPoint_Bitmap.x=this.m_cpDistancePoint.x+this.OriginalPoint_Bitmap.x;2988 this.OriginalPoint_Bitmap.y=this.m_cpDistancePoint.y+this.OriginalPoint_Bitmap.y; 2989 bInvalidate++;2990 } 2991 this.m_cpOriginalPoint_cursor.x=this.m_cpCurrentPoint_cursor.x;2992 this.m_cpOriginalPoint_cursor.y=this.m_cpCurrentPoint_cursor.y; 2993 } 2994 if (bInvalidate>0)2995 {2996 this.RepaintControl();2997 }2998}2999function PreTranslateMessage(msg)...
commonFun.js
Source:commonFun.js
1function errorCallBack(response, error){2 trace(response); 3 trace(error); 4}5function timeDisplayHtml(prefix){6 var facet_range_prefix = ""+prefix+"_facet_range";7 var facet_created_at_html = "";8 facet_created_at_html += '<span class="rightalign"></span><span id="'+facet_range_prefix+'_timeselect_start">å
¨é¨æ¶é´</span><span id="'+facet_range_prefix+'_splitmark" style="display:none;"> ~ </span><span id="'+facet_range_prefix+'_timeselect_end"></span>';9 facet_created_at_html += createRangeOnsiteFieldHtml(facet_range_prefix, true);10 $("#"+prefix+"_facet_range_html").empty().append(facet_created_at_html);11 //为æ¶é´æ§ä»¶ç»å®äºä»¶12 $("#"+facet_range_prefix+"_createdtime_start, #"+facet_range_prefix+"_createdtime_end").die("click");13 $("#"+facet_range_prefix+"_createdtime_start, #"+facet_range_prefix+"_createdtime_end").live("click", function() {14 WdatePicker({onpicked:function(){15 var cs = $("#"+facet_range_prefix+"_createdtime_start").val();16 var ce = $("#"+facet_range_prefix+"_createdtime_end").val();17 if(cs.length != 0 || ce.length != 0){18 $("input[target=createdtime]").attr("checked", false);19 $("#"+facet_range_prefix+"_timeselect_start").text(cs);20 $("#"+facet_range_prefix+"_timeselect_end").text(ce);21 isShowSplitmark("#"+facet_range_prefix+"_timeselect_start", "#"+facet_range_prefix+"_timeselect_end", "#"+facet_range_prefix+"_splitmark", true);22 $("#"+facet_range_prefix+"_createdtime_all").attr("checked", false);23 }24 },oncleared:function(){25 if($("#"+facet_range_prefix+"_createdtime_start").val().length == 0 && $("#"+facet_range_prefix+"_createdtime_end").val().length == 0){26 $("#"+facet_range_prefix+"_timeselect_start").text("å
¨é¨æ¶é´");27 $("#"+facet_range_prefix+"_timeselect_end").text("");28 isShowSplitmark("#"+facet_range_prefix+"_timeselect_start", "#"+facet_range_prefix+"_timeselect_end", "#"+facet_range_prefix+"_splitmark");29 $("#"+facet_range_prefix+"_createdtime_all").attr("checked", true);30 }31 else{32 if($("input[name="+facet_range_prefix+"_createdtime_start]").val().length == 0){33 $("#"+facet_range_prefix+"_timeselect_start").text("");34 }35 if($("input[name="+facet_range_prefix+"_createdtime_end]").val().length == 0){36 $("#"+facet_range_prefix+"_timeselect_end").text("");37 }38 }39 },dateFmt:'yyyy-MM-dd HH:mm:ss'});40 });41 //为æ§ä»¶ç»å®é¢è²æ¹åäºä»¶42 $("#"+prefix+"_facet_range_html div[timetype] input, #"+prefix+"_facet_range_html div[timetype] select").unbind("click");43 $("#"+prefix+"_facet_range_html div[timetype] input, #"+prefix+"_facet_range_html div[timetype] select").bind("click", function(){44 var tt = $(this).parent().attr("timetype");45 $("#"+prefix+"_facet_range_html").attr("checkedtimetype", tt); //æåä¸æ¬¡éæ©çæ¶é´æ§ä»¶46 //_this.changeBorderColor(tt); 47 changeTimeBorderColor(prefix+"_facet_range_html", tt); 48 });49 //å¿«æ·æé®ç¹å»äºä»¶50 $("#"+prefix+"_facet_range_createdtime_all").bind("click", function(){51 if($(this).prop("checked")){52 $(this).attr("checked", true);53 setTimeSelectMsg(""+prefix+"_facet_range", "å
¨é¨æ¶é´", ""); 54 }55 else{56 $(this).attr("checked", false);57 var cs = $("#"+prefix+"_facet_range_createdtime_start").val();58 var ce = $("#"+prefix+"_facet_range_createdtime_end").val();59 if(cs == "" && ce == ""){60 setTimeSelectMsg(""+prefix+"_facet_range", "请填åæ¶é´"); 61 }62 else if(cs == "" || cs == undefined){63 setTimeSelectMsg(""+prefix+"_facet_range", "", ce); 64 }65 else if(ce == "" || ce == undefined){66 setTimeSelectMsg(""+prefix+"_facet_range", cs, ""); 67 }68 }69 });70 //æ¶é´æ ç¾ å½åæ¶é´åå¼å§æ¶é´åæ¢ å¹¶ç» æ»æ é¢èµå¼71 $("#"+prefix+"_facet_range_nearlytime_thistime").bind("click", function(){72 var timestate = $(this).attr("timestate");73 nearlytimeTagClick(""+prefix+"_facet_range", timestate);74 });75 //ç¸å¯¹ä»å¤©,å¿«æ·æé®ç¹å»äºä»¶76 $("#"+prefix+"_facet_range_nearlytime_div input[nearly]").bind("click", function(){77 var nearlytype = $(this).attr("nearly");78 nearlytimeShortCutBtnClick(""+prefix+"_facet_range", nearlytype);79 });80 $("#"+prefix+"_facet_range_nearlytime, #"+prefix+"_facet_range_nearlytime_gap").bind("change", function(){81 nearlytimeInputChange(""+prefix+"_facet_range");82 });83 //beforetime æ§ä»¶ å½åæ¶é´,å¼å§æ¶é´æ ç¾ç¹å»äºä»¶84 $("#"+prefix+"_facet_range_beforetime_thistime").bind("click", function(){85 var timestate = $(this).attr("timestate");86 beforetimeTagTimeClick(""+prefix+"_facet_range", timestate);87 });88 $("#"+prefix+"_facet_range_beforetime_thisdate").bind("click", function(){89 var datestate = $(this).attr("datestate");90 beforetimeTagDateClick(""+prefix+"_facet_range", datestate);91 });92 //æ¶é´æ®µ æ¹å93 $("#"+prefix+"_facet_range_beforetime_start, #"+prefix+"_facet_range_beforetime_end, #"+prefix+"_facet_range_beforetime_end_gap").bind("change", function(){94 beforetimeInputChange(""+prefix+"_facet_range");95 });96 $("#"+prefix+"_facet_range_untiltime_div input[untiltime]").bind("click", function(){97 var type = $(this).attr("untiltime");98 var until= $(this).attr("until"+type+"");99 untiltimeShortCutBtnClick(""+prefix+"_facet_range", until, type);100 });101 //æ¶é´æ§ä»¶,ä¸ææ¥æåä½éæ©102 $.each(["start", "end"], function(k, item){103 //gap change104 $("#"+prefix+"_facet_range_untiltime_"+item+"_gap").bind("change", function(){105 var usgval = $(this).val();106 untiltimeGapChange(""+prefix+"_facet_range", usgval, item);107 untiltimeValueChange(""+prefix+"_facet_range");108 //_this.setUntilTimeChangeValue();109 });110 //this_gap change111 $("#"+prefix+"_facet_range_untiltime_"+item+"_this_gap").bind("change", function(){112 var ustgval = $(this).val();113 var unitArr = dateUnitDisplay(ustgval, "down");114 var opthtml = timeSelectOption(unitArr);115 $("#"+prefix+"_facet_range_untiltime_"+item+"_to_gap").empty().append(opthtml);116 //_this.setUntilTimeChangeValue();117 untiltimeValueChange(""+prefix+"_facet_range");118 });119 //to_gap change120 $("#"+prefix+"_facet_range_untiltime_"+item+"_to_gap").bind("change", function(){121 //_this.setUntilTimeChangeValue();122 untiltimeValueChange(""+prefix+"_facet_range");123 });124 //start change125 $("#"+prefix+"_facet_range_untiltime_"+item+"").bind("change", function(){126 untiltimeInputChange(""+prefix+"_facet_range", item);127 //_this.setUntilTimeChangeValue();128 untiltimeValueChange(""+prefix+"_facet_range");129 });130 //start to change131 $("#"+prefix+"_facet_range_untiltime_"+item+"_to").bind("change", function(){132 //_this.setUntilTimeChangeValue();133 untiltimeValueChange(""+prefix+"_facet_range");134 });135 });136 var measurehtml = "<option value='month'>æ</option><option value='day'>天</option><option value='hour'>å°æ¶</option>";137 $("#"+prefix+"_facet_gap_measure").empty().append(measurehtml);138}139function createRangeOnsiteFieldHtml(prefix, pretitle){140 var html = "";141 //ç¸å¯¹ä»å¤©142 var nearlytimespan = "";143 if(pretitle){144 nearlytimespan = '<span class="rightalign">ç¸å¯¹ä»å¤©ï¼</span>';145 }146 html += '<div style="margin:7px;" id="'+prefix+'_nearlytime_div" timetype="nearlytime">'+nearlytimespan+'<input type="radio" name="'+prefix+'_nearlytime_shortcut" id="'+prefix+'_nearlytime_day" class="outborder" nearly="1day" /><label for="'+prefix+'_nearlytime_day">è¿ä¸å¤©</label> <input type="radio" name="'+prefix+'_nearlytime_shortcut" id="'+prefix+'_nearlytime_week" class="outborder" nearly="1week" /><label for="'+prefix+'_nearlytime_week">è¿ä¸å¨</label> <input type="radio" name="'+prefix+'_nearlytime_shortcut" id="'+prefix+'_nearlytime_month" class="outborder" nearly="1month" /><label for="'+prefix+'_nearlytime_month">è¿ä¸æ</label> <input type="radio" name="'+prefix+'_nearlytime_shortcut" id="'+prefix+'_nearlytime_year" class="outborder" nearly="1year" /><label for="'+prefix+'_nearlytime_year">è¿ä¸å¹´</label> è¿<input type="text" class="smallinput" style="border:1px solid #ccc;" id="'+prefix+'_nearlytime" name="'+prefix+'_nearlytime" /><select id="'+prefix+'_nearlytime_gap">'+timeSelectOption()+'</select> <a id="'+prefix+'_nearlytime_thistime" timestate="now" style="display:none;"></a></div>';147 //æ¶é´æ®µ148 var beforetimespan = "";149 if(pretitle){150 beforetimespan = '<span class="rightalign">æ¶é´æ®µï¼</span>';151 }152 html += '<div style="margin:7px;" id="'+prefix+'_beforetime_div" timetype="beforetime">'+beforetimespan+' å<input type="text" value="" id="'+prefix+'_beforetime_start" name="'+prefix+'_beforetime_start" class="smallinput" style="border:1px solid #ccc;"/>å°å<input type="text" value="" class="smallinput" style="border:1px solid #ccc;" id="'+prefix+'_beforetime_end" name="'+prefix+'_beforetime_end" /><select id="'+prefix+'_beforetime_end_gap">'+timeSelectOption()+'</select> <a style="display:none;" id="'+prefix+'_beforetime_thisdate" datestate="now"></a> <a style="display:none;" id="'+prefix+'_beforetime_thistime" timestate="now"></a></div>';153 //ç»å¯¹æ¶é´154 var createdtimespan = "";155 if(pretitle){156 createdtimespan = '<span class="rightalign">ç»å¯¹æ¶é´ï¼</span>';157 }158 html += "<div style='margin:7px;' id='"+prefix+"_createdtime_div' timetype='createdtime'>"+createdtimespan+"<input type='text' id='"+prefix+"_createdtime_start' name='"+prefix+"_createdtime_start' style='border:1px solid #ccc;'> è³ <input type='text' id='"+prefix+"_createdtime_end' name='"+prefix+"_createdtime_end' style='border:1px solid #ccc;'> <input type='checkbox' name='"+prefix+"_createdtime_all' id='"+prefix+"_createdtime_all' /><label for='"+prefix+"_createdtime_all'>å
¨é¨</label></div>";159 //æ¥åæ¶é´æ®µ160 var untiltimespan = "";161 html += '<div style="margin:7px;" id="'+prefix+'_untiltime_div" timetype="untiltime">';162 $.each(["start", "end"], function(k,v){163 if(pretitle && v == "start"){164 untiltimespan = '<span class="rightalign">æ¥åæ¶é´æ®µï¼</span>';165 }166 else if(pretitle && v == "end"){167 untiltimespan = '<span class="rightalign"></span>';168 }169 html+= ''+untiltimespan+'<input type="radio" name="'+prefix+'_untiltime_'+v+'_shortcut" id="'+prefix+'_untiltime_'+v+'_shortcut1" class="outborder" untiltime="'+v+'" until'+v+'="1day" /><label for="'+prefix+'_untiltime_'+v+'_shortcut1">æ¨å¤©</label> <input type="radio" name="'+prefix+'_untiltime_'+v+'_shortcut" id="'+prefix+'_untiltime_'+v+'_shortcut2" class="outborder" untiltime="'+v+'" until'+v+'="1week" /><label for="'+prefix+'_untiltime_'+v+'_shortcut2">ä¸å¨</label> <input type="radio" name="'+prefix+'_untiltime_'+v+'_shortcut" id="'+prefix+'_untiltime_'+v+'_shortcut3" class="outborder" untiltime="'+v+'" until'+v+'="1month" /><label for="'+prefix+'_untiltime_'+v+'_shortcut3">ä¸ä¸ªæ</label> ';170 html+='è³ä»<input type="text" value="" class="smallinput" style="border:1px solid #ccc;" id="'+prefix+'_untiltime_'+v+'" name="'+prefix+'_untiltime_'+v+'" untiltime="'+v+'" /><select id="'+prefix+'_untiltime_'+v+'_gap" untiltime="'+v+'" >'+timeSelectOption()+'</select>该<select id="'+prefix+'_untiltime_'+v+'_this_gap">'+timeSelectOption()+'</select>ç第<input type="text" value="" class="smallinput" style="border:1px solid #ccc;" id="'+prefix+'_untiltime_'+v+'_to" name="'+prefix+'_untiltime_'+v+'_to" untiltime="'+v+'" /><select id="'+prefix+'_untiltime_'+v+'_to_gap" untiltime="'+v+'" >'+timeSelectOption()+'</select><br/>';171 });172 html += '</div>';173 return html;174}175/**176 * ä»æ¨¡åçfiltervalueæ°ç» ä¸è·åæå®å称ç filtervalue177 * @param filtername178 * @param filtervalueArr 179 * @returns filtervalueçæ°ç»180 */181function getFilterValue(filtername,filtervalueArr){182 var returnval = [];183 $.each(filtervalueArr,function(i,item){184 if(item.fieldname == filtername){185 returnval.push(item);186 }187 });188 return returnval;189}190/**191 * çæ模åçfiltervalue对象192 * @param filtername193 * @param datatype 194 * @param value195 * @returns filtervalue对象196 */197function createFiltervalue(fieldname, datatype, value){198 var filtervalue = {};199 filtervalue.fieldname = fieldname;200 var fieldvalue = {};201 fieldvalue.datatype = datatype;202 fieldvalue.value = value;203 filtervalue.fieldvalue = fieldvalue;204 return filtervalue;205}206/*207 * å建spanæ ç¾208 * item å¼æ ç¾spançclassåç¼ é»è®¤åfieldnameç¸å209 * name 对åºå¼çname stringç±»å对åºfieldvalueä¸ç value, value_text_objectç±»åçå text210 * code 对åºå¼çcode stringç±»åä¸åå¨, æ ä¸nameç¸å, value_text_objectç±»åå value211 * isnot érangeç±»åå段å¯ä»¥éæ©ä¸å
å«æå¼, isnot 为 trueæ¶ æ·»å "ä¸"éæ©æé® ç»å®ç¹å»äºä»¶212 * exclude isnot 为trueæ¶ ä¸ºexcludeèµå¼ æ¯å¦æé¤213 * isfeature ç¹å¾åç±» ,å½éæ©ç¹å¾åç±»æ¶æ·»å æ¤å±æ§214 * emotype åæ
æå¼ å¯è½ä¸åå¨215 * marktype å¾®åæ è¯åååå¾®å, æ è®°æ·»å çæ¯idè¿æ¯url216 * blurtype å
¼å®¹æ§çæ¬ç blur_value_objcetç±»å217 * canclename å é¤æé®<a>æ ç¾çå称218 * */219function createFormConfigSpanHtml(item, name, code, isnot, exclude, isfeature, emotype, marktype, blurtype, canclename){220 //æ
æ221 var emocode = "";222 if(emotype != undefined && emotype != ""){223 emocode = "emotype='"+emotype+"'";224 }225 //ç¹å¾åç±»226 var fea = "";227 if(isfeature != undefined && isfeature != ""){228 fea = "isfeature='"+isfeature+"'";229 }230 var marktypeattr = "";231 if(marktype != undefined && marktype != ""){232 marktypeattr = "marktype='"+marktype+"'";233 }234 235 var blurtypeattr = "";236 if(blurtype != undefined && blurtype != ""){237 blurtypeattr = "blurtype='"+blurtype+"'";238 }239 var codeattr = "";240 if(code != undefined){241 code = commonFun.trim(code); 242 codeattr = "code='"+code+"'";243 }244 //é»è®¤å¼245 if(canclename == undefined || canclename == ""){246 canclename = "cancleselectedvaluetextobj";247 }248 //ç»å®å é¤äºä»¶249 $("a[name=cancleselectedvaluetextobj]").die("click");250 $("a[name=cancleselectedvaluetextobj]").live("click", function(){251 $(this).parent().remove();252 });253 name = commonFun.trim(name); //å»é¤ä¸¤ç«¯ç©ºæ ¼254 var spanhtml = "";255 spanhtml += "<span class='selwordsbox'>";256 var exattr = "";257 if(isnot){258 var exstyle = "";259 if(exclude != undefined && exclude != 0){260 exattr = "exclude='"+exclude+"'";261 exstyle = "style='color:#000000;'";262 }263 spanhtml += "<a class='excludeitem' onclick='excludeItemFun(this)' "+exstyle+" >ä¸</a>";264 }265 spanhtml += "<span class='"+item+"item' "+codeattr+" "+exattr+" "+fea+" "+emocode+" "+marktypeattr+" "+blurtypeattr+" >"+name+"</span>";266 spanhtml += "<a name='"+canclename+"' value='"+item+"' class='cancleitem'>Ã</a>";267 spanhtml += "</span>";268 return spanhtml;269}270function checkSession(){271 $.ajax({url:config.phpPath+"checkuser.php",dataType:"json",type:"POST",data:{type:"existsession"},async:false,272 success:function(d){273 if(!d.result){274 location.href = config.sitePath+"login.shtml";275 }276 },277 error:function(){278 location.href = config.sitePath+"login.shtml";279 }280 });281}282function getSpiderAccountName(sourceid, accountid){283 var n = '';284 if(config.allSpiderAccount.length == 0){285 getSpiderAccount(function(data){286 if(data){287 config.allSpiderAccount = data;288 }289 });290 }291 $(config.allSpiderAccount).each(function(i,item){292 if(item.id == accountid && item.sourceid == sourceid ){293 n = item.username;294 return false;295 }296 });297 return n;298}299function getSpiderAccount(callback){300 $.ajax({url:config.phpPath+"taskmanager.php",async:false,data:{type:"getspideraccount"}, type:"post", dataType:"json",301 success:function(data){302 if(jQuery.isFunction(callback)){303 callback(data);304 }305 }});306}307//æ ¹æ®ä¸»æºidè·åå«å308function getHostName(hostid){309 if(!hostid){310 return "é»è®¤ä¸»æº";311 }312 var n = '';313 if(config.allDataHost.length == 0){314 getDataHost(function(data){315 if(data){316 config.allDataHost = data;317 }318 });319 }320 $(config.allDataHost).each(function(i,item){321 if(item.id == hostid){322 n = item.alias;323 return false;324 }325 });326 return n;327}328function getDataHost(callback){329 $.ajax({url:config.phpPath+"taskmanager.php",async:false,data:{type:"getdatahost"}, type:"post", dataType:"json",330 success:function(data){331 if(jQuery.isFunction(callback)){332 callback(data);333 }334 }});335}336function getTplOutfield(callback){337 var tploutfieldurl = config.phpPath+"spiderconfig_model.php";338 $.ajax({url:tploutfieldurl,async:false,data:{type:"selecttploutfield"}, type:"get", dataType:"json",339 success:function(data){340 if(jQuery.isFunction(callback)){341 callback(data);342 }343 }});344}345function getAccountSource(callback){346 $.ajax({347 url:config.phpPath+"taskmanager.php",348 async:false,349 data:{type:"getaccountsource"}, 350 type:"get", 351 dataType:"json",352 success:function(data){353 if(jQuery.isFunction(callback)){354 callback(data);355 }356 }357 });358}359//æ ¹æ®é
ç½®idè·åå称360function getSpiderConfigName(configid){361 var n = '';362 if(config.allSpiderConfig.length == 0){363 getSpiderConfig(function(data){364 if(data){365 config.allSpiderConfig= data;366 }367 });368 }369 $(config.allSpiderConfig).each(function(i,item){370 if(item.id == configid){371 n = item.name;372 return false;373 }374 });375 return n;376}377/*378function getSpiderConfig(callback){379 var getspiderconfigurl = config.phpPath+"spiderconfig_model.php";380 $.ajax({url:getspiderconfigurl,async:false,data:{type:"selectspiderconfiginfo"}, type:"get", dataType:"json",381 success:function(data){382 if(jQuery.isFunction(callback)){383 callback(data);384 }385 }});386}387*/388//è·åç¬è«é
ç½®çidåå称389function getSpiderConfig(callback){390 $.ajax({url:config.phpPath+"taskmanager.php",async:false,data:{type:"getspiderconfig"}, type:"post", dataType:"json",391 success:function(data){392 if(jQuery.isFunction(callback)){393 callback(data);394 }395 }});396}397/*398//æ ¹æ®æç´¢å¼æidè·åå称399function getSearchEngineName(engineid){400 var n = '';401 if(config.allSearchEngine.length == 0){402 getSearchEngine(function(data){403 if(data){404 config.allSearchEngine = data;405 }406 });407 }408 $(config.allSearchEngine).each(function(i,item){409 if(item.id == engineid){410 n = item.name;411 return false;412 }413 });414 return n;415}416//è·åæç´¢å¼æçidåå称417function getSearchEngine(callback){418 $.ajax({419 url:config.phpPath+"taskmanager.php",420 async:false,421 data:{type:"getsearchenginelist"}, 422 type:"get", 423 dataType:"json",424 success:function(data){425 if(jQuery.isFunction(callback)){426 callback(data);427 }428 }429 });430}431//æ ¹æ®æåç«ç¹idè·åå称432function getSearchSiteName(siteid){433 var n = '';434 if(config.allSearchSite.length == 0){435 getSearchSite(function(data){436 if(data){437 config.allSearchSite = data;438 }439 });440 }441 $(config.allSearchSite).each(function(i,item){442 if(item.id == siteid){443 n = item.name;444 return false;445 }446 });447 return n;448}449//è·åæç´¢å¼æçidåå称450function getSearchSite(callback){451 $.ajax({452 url:config.phpPath+"taskmanager.php",453 async:false,454 data:{type:"getsearchsitelist"}, 455 type:"get", 456 dataType:"json",457 success:function(data){458 if(jQuery.isFunction(callback)){459 callback(data);460 }461 }462 });463}464*/465//è·åç¨æ·ç±»åçæè¿°466function getUserTypeText(usertype){467 if(undefined == usertype || null == usertype ){468 return "å
¨é¨";469 }470 else{471 return parseInt(usertype,10) == 1 ? "ç§åç¨æ·" : "æ®éç¨æ·";472 }473}474function _getintvalue(v){475 return (v == undefined || v == null) ? 0 : v;476}477function getTaskDetail(task){478 var v = task;479 if(v.taskparams.scene == undefined){480 v.taskparams.scene = {};481 }482 var infohtm = '';483 var ld = v.local == 1 ? "æ¯":"å¦";484 infohtm += "æ¬å°ï¼"+ld+"<br/>";485 var rd = v.remote == 1 ? "æ¯":"å¦";486 infohtm += "è¿ç¨ï¼"+rd+"<br/>";487 var cdelay = v.conflictdelay == null ? "æªè®¾ç½®" : v.conflictdelay+"ç§";488 infohtm += "å²çªå»¶è¿ï¼"+cdelay+"<br/>";489 infohtm += "<hr>";490 /*491 //å®æ¶è®¡å492 if(task.crontime != undefined){493 infohtm +="å®æ¶è®¡åï¼"+getCrontimeDes(v.crontime)+"<br/>";494 }495 */496 var task_term = '';497 var exeinfo = "";498 var comitstr = "";499 if(v.taskparams.iscommit){500 comitstr += "ç«å³æ´æ°"; 501 }502 else{503 comitstr += "å®ææ¶æ交";504 }505 exeinfo +="å¤çæ¹å¼ï¼";506 if(v.taskparams.each_count){507 exeinfo +="æ¯æ¬¡æ交"+v.taskparams.each_count+"æ¡,"508 }509 exeinfo +=comitstr+"<br/>";510 //æ¾ç¤ºåè¯æ¹æ¡ ç¨æ·é
ç½®åæ¾ç¤º511 if(task.taskparams.dictionaryPlan != undefined){512 var data1=JSON.parse(task.taskparams.dictionaryPlan);513 var planHtml="";514 var count=1;515 $.each(data1,function(di, itemPlan){516 planHtml +="æ¹æ¡"+count+":(";517 var t2="";518 var count2=0;519 if(itemPlan!=undefined&&itemPlan.length==0){520 if(count2!=0)521 t2=t2+","+"é»è®¤æ¹æ¡";522 else523 t2="é»è®¤æ¹æ¡";524 count2++;525 }526 else{527 $.each(itemPlan, function (dj, itemCategory) {528 if(count2!=0)529 t2=t2+","+itemCategory.name;530 else531 t2=itemCategory.name;532 count2++;533 });534 }535 planHtml+=t2+")";536 count++;537 });538 infohtm += "åè¯æ¹æ¡ï¼"+planHtml+"<br/>";539 }540 541 //542 if(task.task == config.TASK_REPOST_TREND){//åæ转åèæ¬543 544 infohtm += exeinfo;545 var seedweibo = "";546 /*if(task.taskparams.orimid != undefined && task.taskparams.orimid.length > 0){547 seedweibo = task.taskparams.orimid.join("<br/>");548 infohtm += "ç§åå¾®å(URL)ï¼<br/>"+seedweibo+"<br/>";549 }*/550 if(task.taskparams.forceupdate != undefined){551 infohtm += "强å¶æåï¼"+(v.taskparams.forceupdate ? "æ¯" : "å¦")+"<br/>";552 }553 if(task.taskparams.oristatus != undefined && task.taskparams.oristatus.length > 0){554 seedweibo = task.taskparams.oristatus.join("<br/>");555 infohtm += "ç§åå¾®å("+task.taskparams.oristatus.length.toString()+"æ¡)ï¼<br/>"+seedweibo+"<br/>";556 }557 if(task.taskparams.isseed != undefined){558 infohtm += "ååæ¯å¦ç§åï¼"+(task.taskparams.isseed ? "æ¯" : "å¦")+"<br/>";559 }560 if(task.taskparams.isrepostseed!= undefined){561 infohtm += "转åæ¯å¦ç§åï¼"+(v.taskparams.isrepostseed ? "æ¯" : "å¦")+"<br/>";562 }563 if(task.taskparams.iscalctrend!= undefined){564 infohtm += "æ¯å¦è®¡ç®è½¨è¿¹ï¼"+(task.taskparams.iscalctrend ? "æ¯" : "å¦")+"<br/>";565 }566 if(task.taskparams.config != undefined){567 infohtm += "æåé
ç½®ï¼"+getSpiderConfigName(task.taskparams.config)+"<br/>";568 }569 if(task.taskparams.source != undefined){570 var sn = getSourceName(task.taskparams.source);571 var sourcename = sn;572 if(!sourcename){573 sourcename = task.taskparams.source;574 }575 infohtm += "æ°æ®æ¥æºï¼"+sourcename+"<br/>";576 }577 if(task.taskparams.accountid != undefined){578 var accountname = [];579 $.each(task.taskparams.accountid, function(i, item){580 var sn = getSpiderAccountName(task.taskparams.source, item);581 accountname.push(sn); 582 })583 infohtm += "æåå¸å·ï¼"+accountname.join(", ")+"<br/>";584 }585 if(task.taskparams.logoutfirst != undefined){586 infohtm += "ä»»å¡å¼å§åéåºå½åç»å½è´¦å·ï¼"+(task.taskparams.logoutfirst ? "æ¯" : "å¦")+"<br/>";587 }588 if(task.taskparams.duration != undefined){589 infohtm += "ä»»å¡è¶
æ¶ï¼"+task.taskparams.duration+"ç§<br/>";590 }591 if("nodup" in task){592 infohtm += "å
许éå¤ä»»å¡ï¼"+(task.nodup ? "æ¯" : "å¦")+"<br/>";593 }594 /*if(task.taskparams.oristatus != undefined && task.taskparams.oristatus.length > 0){595 seedweibo += "ID: "+task.taskparams.oristatus.toString();596 }597 if(task.taskparams.orimid != undefined && task.taskparams.orimid.length > 0){598 seedweibo += " MID: "+task.taskparams.orimid.toString();599 }*/600 if(task.local == 1){601 if(task.taskparams.currorigurl){602 infohtm += "æ£å¨å¤çï¼"+task.taskparams.currorigurl+"<br/>";603 }604 var apicount = _getintvalue(task.taskparams.scene.repost_timeline_count) + _getintvalue(task.taskparams.scene.repost_timeline_ids_count) + _getintvalue(task.taskparams.scene.statuses_count_count);605 infohtm += "<b>ç»è®¡æ¡æ°ï¼</b>æ»è®¿é®API次æ°"+apicount+"ï¼å
æ¬ï¼repost_timeline:"+_getintvalue(task.taskparams.scene.repost_timeline_count)+", repost_timeline_ids:"+_getintvalue(task.taskparams.scene.repost_timeline_ids_count)+"ï¼statuses_count:"+_getintvalue(task.taskparams.scene.statuses_count_count);606 infohtm += "å
±åºé"+_getintvalue(task.taskparams.scene.apierrorcount)+"次ã æ»æå"+_getintvalue(task.taskparams.scene.spider_statuscount)+"æ¡ï¼è¢«å é¤"+_getintvalue(task.taskparams.scene.deleted_weibocount)+"æ¡ï¼å
¥åº"+_getintvalue(task.taskparams.scene.insertsql_statuscount)+"æ¡, æ°å¢å°solr失败"+_getintvalue(task.taskparams.scene.solrerrorcount)+"æ¡,æ»æ°å¢ç¨æ·"+_getintvalue(task.taskparams.scene.spider_usercount)+"个ï¼æ´æ°solræ»è½¬åãæ»å°è¾¾åºé"+_getintvalue(task.taskparams.scene.calc_solrerrorcount)+"次<br/>";607 var get_seedweibo_time = _getintvalue(task.taskparams.scene.get_seedweibo_time);608 infohtm += "<b>è·åç§åå¾®åæ»è±è´¹</b>"+get_seedweibo_time+"ï¼å½åç§åå¾®åæ»è½¬åæ°"+_getintvalue(task.taskparams.scene.current_seedweibo_reposts_count)+"<br/>";609 var get_origrepost_time = _getintvalue(task.taskparams.scene.get_origrepost_time);610 var repost_timeline_count = _getintvalue(task.taskparams.scene.repost_timeline_count);611 var repost_timeline_time = _getintvalue(task.taskparams.scene.repost_timeline_time);612 var analysistime = _getintvalue(task.taskparams.scene.analysistime);613 var storetime = _getintvalue(task.taskparams.scene.storetime);614 var insertsql_statustime = _getintvalue(task.taskparams.scene.insertsql_statustime);615 var insertsql_usertime = _getintvalue(task.taskparams.scene.insertsql_usertime);616 infohtm += "<b>æåååç转åæ»è±è´¹</b>"+get_origrepost_time+"ãå
æ¬ï¼è®¿é®API "+repost_timeline_count+" 次è±è´¹"+repost_timeline_time+"ï¼åæè±è´¹"+analysistime+"ï¼åå¨å°solrè±è´¹"+storetime+"ï¼æå
¥æ°æ®åºè±è´¹"+insertsql_statustime+"ï¼æå
¥ç¨æ·è±è´¹"+insertsql_usertime+"<br/>";617 var set_repost_father_time = _getintvalue(task.taskparams.scene.set_repost_father_time);618 infohtm += "<b>åæç¶IDæ»è±è´¹</b>"+set_repost_father_time+"ï¼æäºçº§è½¬åçå¾®åæ»æ°"+_getintvalue(task.taskparams.scene.all_secrepost_count)+"ãå
æ¬ï¼æ¥è¯¢è½¬å"+_getintvalue(task.taskparams.scene.select_repost_sqlcount)+"次(å
±"+_getintvalue(task.taskparams.scene.select_repost_count)+"æ¡)è±è´¹"+_getintvalue(task.taskparams.scene.select_repost_time)+"ï¼";619 infohtm += "æ£æ¥å·²åå¨çå©åæ°"+_getintvalue(task.taskparams.scene.check_repost_count)+"次è±è´¹"+_getintvalue(task.taskparams.scene.check_repost_time)+"ï¼è®¿é®API "+_getintvalue(task.taskparams.scene.repost_timeline_ids_count)+" 次è±è´¹"+_getintvalue(task.taskparams.scene.repost_timeline_ids_time)+"ï¼";620 infohtm += "æ´æ°fatheridã转åå±çº§"+_getintvalue(task.taskparams.complete_repost_count)+"次è±è´¹"+_getintvalue(task.taskparams.scene.update_fatherid_time)+"ï¼æ´æ°å
åæ°æ®ä¸ç转åå±çº§"+_getintvalue(task.taskparams.scene.update_memory_count)+"次è±è´¹"+_getintvalue(task.taskparams.scene.update_memory_time)+"<br/>";621 var update_taskids_time = _getintvalue(task.taskparams.scene.update_taskids_time);622 infohtm += "<b>æ´æ°æåè¿åº¦ç¶æ(å
±"+_getintvalue(task.taskparams.scene.update_taskids_count)+"æ¡)è±è´¹</b>"+update_taskids_time+"<br/>";623 var set_total_counts_time = _getintvalue(task.taskparams.scene.set_total_counts_time);624 infohtm += "<b>计ç®æ»è½¬åæ°ãæ»å°è¾¾æ°å¹¶æ´æ°å°solræ»è±è´¹</b>"+set_total_counts_time+"ãå
æ¬ï¼æ¥è¯¢è½¬å"+_getintvalue(task.taskparams.scene.calc_select_repost_count)+"次è±è´¹"+_getintvalue(task.taskparams.scene.calc_select_repost_time)+"ï¼è®¡ç®è½¬åæ°"+_getintvalue(task.taskparams.scene.calc_counts_count)+"次è±è´¹"+_getintvalue(task.taskparams.scene.calc_counts_time)+"ï¼æ´æ°æ°æ®åº"+_getintvalue(task.taskparams.scene.calc_updatecounts_count)+"次è±è´¹"+_getintvalue(task.taskparams.scene.calc_updatecounts_time)+"ï¼æ´æ°å°solr"+_getintvalue(task.taskparams.scene.calc_select_repost_count)+"次(å
±"+_getintvalue(task.taskparams.scene.calc_updatesolr_count)+"æ¡)è±è´¹"+_getintvalue(task.taskparams.scene.calc_updatesolr_time)+"<br/>";625 var all_time = get_seedweibo_time + get_origrepost_time + set_repost_father_time + update_taskids_time + set_total_counts_time;626 infohtm += "<b>æ»è®¡</b>ï¼æ»å¤çåå"+_getintvalue(task.taskparams.select_cursor)+"æ¡ï¼æ»å¤ç转å"+_getintvalue(task.taskparams.complete_repost_count)+"æ¡ï¼å½åæ£å¨å¤çç转åä½ç½®"+_getintvalue(task.taskparams.select_repost_cursor)+"ï¼æ»æ¶é´ï¼"+all_time+"ã";627 var fatalcount = _getintvalue(task.taskparams.scene.fatalcount);628 var manual_shutdowncount = _getintvalue(task.taskparams.scene.manual_shutdowncount);629 var queuecount = _getintvalue(task.taskparams.scene.queuecount);630 var allshutdown = fatalcount + manual_shutdowncount + queuecount;631 infohtm += "å
±åæ¢"+allshutdown+"次ï¼å
¶ä¸ä»»å¡å´©æº"+fatalcount+"次ï¼äººå·¥åæ¢"+manual_shutdowncount+"次ï¼ç±äºçå¾
èµæºåæ¢"+queuecount+"次ï¼æèµ·"+_getintvalue(task.taskparams.scene.hangcount)+"æ¬¡ï¼ çå¾
æ¶é´"+_getintvalue(task.taskparams.scene.waittime)+"<br/>";632 if(task.taskparams.scene.hangstate != undefined && task.taskparams.scene.hangstate != 0){633 var hangreason = task.taskparams.scene.hangreason == undefined ? "" : task.taskparams.scene.hangreason;634 infohtm += "ä»»å¡æèµ·ï¼åå ï¼" + hangreason+"<br/>";635 }636 if(task.taskparams.scene.status_desp != undefined && task.taskparams.scene.status_desp != ""){637 infohtm += "ä»»å¡ç¶ææè¿°ï¼"+task.taskparams.scene.status_desp;638 }639 }640 else{641 if(task.taskparams.phase == 1){642 infohtm += "ä»»å¡é¶æ®µï¼æååå转å<br/>";643 infohtm += "ä»»å¡è¿åº¦ï¼å·²å¤çåå"+task.taskparams.select_cursor+"æ¡";644 if(task.taskparams.currorigurl){645 infohtm += "ï¼æ£å¨å¤çï¼"+task.taskparams.currorigurl;646 }647 if(task.taskparams.repost != undefined && task.taskparams.repost.length > 0){648 if(task.taskparams.select_cursor < task.taskparams.oristatus.length){649 var origprogress = task.taskparams.repost[task.taskparams.repost.length - 1].idnum;650 infohtm += "ï¼å·²æåå½ååå转å"+origprogress+"æ¡";651 }652 }653 infohtm += "<br/>";654 }655 else if(task.taskparams.phase == 2){656 infohtm += "ä»»å¡é¶æ®µï¼æåäºçº§è½¬å<br/>";657 infohtm += "ä»»å¡è¿åº¦ï¼å
±æäºçº§è½¬å"+task.taskparams.repostcount+"æ¡ï¼å·²å¤çäºçº§è½¬å"+task.taskparams.repostdone+"æ¡<br/>";658 }659 if(task.taskparams.repost != undefined){660 infohtm += "<b>转åæ°å表ï¼</b><br/>";661 for(var i = 0; i < task.taskparams.repost.length; i++){662 infohtm += "ååï¼"+task.taskparams.repost[i].orig+"ï¼è½¬å"+task.taskparams.repost[i].idnum+"æ¡<br/>";663 }664 }665 if(task.taskparams.scene.stat != undefined){666 infohtm += "<b>ä»»å¡ç»è®¡ä¿¡æ¯ï¼</b><br/>";667 infohtm += printStat(task.taskparams.scene.stat);668 }669 if(task.taskparams.scene.dropcount != undefined){670 infohtm += "æ¾å¼æ¬¡æ°ï¼"+task.taskparams.scene.dropcount+"<br/>";671 }672 }673 }674 else if(task.task == config.TASK_REPOSTPATH || task.task == config.TASK_COMMENTPATH){675 infohtm += exeinfo;676 if(task.taskparams.oriurls != undefined && task.taskparams.oriurls.length > 0){677 var seedweibo = task.taskparams.oriurls.join("<br/>");678 infohtm += "æºé¾æ¥("+task.taskparams.oriurls.length.toString()+"æ¡)ï¼<br/>"+seedweibo+"<br/>";679 }680 if(task.taskparams.errorurl != undefined && task.taskparams.errorurl.length > 0){681 infohtm += "åºéé¾æ¥("+task.taskparams.errorurl.length.toString()+"æ¡)ï¼<br/>";682 $.each(task.taskparams.errorurl, function(ei, eitem){683 infohtm += "é¾æ¥:"+eitem.url+" åå :"+eitem.msg+"<br/>";684 });685 }686 }687 else if(task.task == config.TASK_COMMENTS){//æåè¯è®º688 infohtm += exeinfo;689 if(task.taskparams.forceupdate != undefined){690 infohtm += "强å¶æåï¼"+(v.taskparams.forceupdate ? "æ¯" : "å¦")+"<br/>";691 }692 if(task.taskparams.oristatus != undefined && task.taskparams.oristatus.length > 0){693 var seedweibo = task.taskparams.oristatus.join("<br/>");694 infohtm += "ç§åå¾®å("+task.taskparams.oristatus.length.toString()+"æ¡)ï¼<br/>"+seedweibo+"<br/>";695 }696 if(task.taskparams.isseed != undefined){697 infohtm += "æ¯å¦ç§åï¼"+(task.taskparams.isseed ? "æ¯" : "å¦")+"<br/>";698 }699 if(task.taskparams.config != undefined){700 infohtm += "æåé
ç½®ï¼"+getSpiderConfigName(task.taskparams.config)+"<br/>";701 }702 if(task.taskparams.source != undefined){703 var sn = getSourceName(task.taskparams.source);704 var sourcename = sn;705 if(!sourcename){706 sourcename = task.taskparams.source;707 }708 infohtm += "æ°æ®æ¥æºï¼"+sourcename+"<br/>";709 }710 if(task.taskparams.accountid != undefined){711 var accountname = [];712 $.each(task.taskparams.accountid, function(i, item){713 var sn = getSpiderAccountName(task.taskparams.source, item);714 accountname.push(sn); 715 })716 infohtm += "æåå¸å·ï¼"+accountname.join(", ")+"<br/>";717 }718 if(task.taskparams.logoutfirst != undefined){719 infohtm += "ä»»å¡å¼å§åéåºå½åç»å½è´¦å·ï¼"+(task.taskparams.logoutfirst ? "æ¯" : "å¦")+"<br/>";720 }721 if(task.taskparams.duration != undefined){722 infohtm += "ä»»å¡è¶
æ¶ï¼"+task.taskparams.duration+"ç§<br/>";723 }724 if("nodup" in task){725 infohtm += "å
许éå¤ä»»å¡ï¼"+(task.nodup ? "æ¯" : "å¦")+"<br/>";726 }727 if(task.taskparams.iscalctrend!= undefined){728 infohtm += "æ¯å¦è®¡ç®è½¨è¿¹ï¼"+(task.taskparams.iscalctrend ? "æ¯" : "å¦")+"<br/>";729 }730 if(task.local == 1){731 if(task.taskparams.currorigurl){732 infohtm += "æ£å¨å¤çï¼"+task.taskparams.currorigurl+"<br/>";733 }734 infohtm += "<b>ç»è®¡æ¡æ°ï¼</b>å·²å¤çåå"+_getintvalue(task.taskparams.select_cursor)+"æ¡ï¼æ»æå"+_getintvalue(task.taskparams.scene.spider_statuscount)+"æ¡ï¼å
¥åº"+_getintvalue(task.taskparams.scene.new_comments_count)+"æ¡ï¼æ°å¢ç¨æ·"+_getintvalue(task.taskparams.scene.new_user_count)+"个ãAPIå
±åºé"+_getintvalue(task.taskparams.scene.apierrorcount)+"次ï¼æ°å¢å°solr失败"+_getintvalue(task.taskparams.scene.solrerrorcount)+"æ¡ï¼æ´æ°åå¤æ°å¤±è´¥"+_getintvalue(task.taskparams.scene.calc_solrerrorcount)+"æ¡<br/>";735 infohtm += "<b>ç»è®¡æ¶é´ï¼</b>è·åç§åå¾®åæ»è±è´¹"+_getintvalue(task.taskparams.scene.get_seedweibo_time)+"ï¼è·åè¯è®ºæ»è±è´¹"+_getintvalue(task.taskparams.scene.get_comments_time)+"ï¼å
¥åºæ»è±è´¹"+_getintvalue(task.taskparams.scene.insert_comments_time)+"ï¼æ´æ°åå¤æ°æ»è±è´¹"+_getintvalue(task.taskparams.scene.calc_comments_time)+"<br/>";736 if(task.taskparams.scene.status_desp != undefined && task.taskparams.scene.status_desp != ""){737 infohtm += "ä»»å¡ç¶ææè¿°ï¼"+task.taskparams.scene.status_desp;738 }739 }740 else{741 infohtm += "ä»»å¡è¿åº¦ï¼å·²å¤çå¾®å"+(task.taskparams.select_cursor ? task.taskparams.select_cursor : 0)+"æ¡";742 if(task.taskparams.currorigurl){743 infohtm += "ï¼æ£å¨å¤çï¼"+task.taskparams.currorigurl;744 }745 if(task.taskparams.comment != undefined && task.taskparams.comment.length > 0){746 if(task.taskparams.select_cursor < task.taskparams.oristatus.length){747 var origprogress = task.taskparams.comment[task.taskparams.comment.length - 1].idnum;748 infohtm += "ï¼å·²æåå½åå¾®åè¯è®º"+origprogress+"æ¡";749 }750 }751 infohtm += "<br/>";752 if(task.taskparams.comment != undefined){753 infohtm += "<b>è¯è®ºæ°å表ï¼</b><br/>";754 for(var i = 0; i < task.taskparams.comment.length; i++){755 infohtm += "å¾®åï¼"+task.taskparams.comment[i].orig+"ï¼è¯è®º"+task.taskparams.comment[i].idnum+"æ¡<br/>";756 }757 }758 if(task.taskparams.scene.stat != undefined){759 infohtm += "<b>ä»»å¡ç»è®¡ä¿¡æ¯ï¼</b><br/>";760 infohtm += printStat(task.taskparams.scene.stat);761 }762 if(task.taskparams.scene.dropcount != undefined){763 infohtm += "æ¾å¼æ¬¡æ°ï¼"+task.taskparams.scene.dropcount+"<br/>";764 }765 }766 }767 else if(task.task == config.TASK_KEYWORD){//æåå
³é®è¯768 infohtm += "æåé
ç½®ï¼"+getSpiderConfigName(task.taskparams.config)+"<br/>";769 if(task.taskparams.source != undefined){770 var sn = getSourceName(task.taskparams.source);771 var sourcename = sn;772 if(!sourcename){773 sourcename = task.taskparams.source;774 }775 infohtm += "æ°æ®æ¥æºï¼"+sourcename+"<br/>";776 }777 if(task.taskparams.accountid != undefined){778 var accountname = [];779 $.each(task.taskparams.accountid, function(i, item){780 var sn = getSpiderAccountName(task.taskparams.source, item);781 accountname.push(sn); 782 })783 infohtm += "æåå¸å·ï¼"+accountname.join(", ")+"<br/>";784 }785 if(task.taskparams.logoutfirst != undefined){786 infohtm += "ä»»å¡å¼å§åéåºå½åç»å½è´¦å·ï¼"+(task.taskparams.logoutfirst ? "æ¯" : "å¦")+"<br/>";787 }788 if(task.taskparams.isswitch != undefined){789 infohtm += "æ¯å¦åæ¢å¸å·ï¼"+(task.taskparams.isswitch ? "æ¯" : "å¦")+"<br/>";790 if(task.taskparams.isswitch){791 infohtm += "å¸å·åæ¢çç¥ï¼"+task.taskparams.switchpage+"页/"+task.taskparams.switchtime+"ç§<br/>";792 }793 if(parseInt(task.taskparams.globalaccount,10)){794 infohtm += "使ç¨å
¨å±å¸å·ï¼"+(task.taskparams.isswitch ? "æ¯" : "å¦")+"<br/>";795 }796 }797 if(task.taskparams.keywords != undefined){798 infohtm += "å
³é®è¯ï¼"+task.taskparams.keywords+"<br/>";799 }800 if(task.taskparams.username != undefined){801 infohtm += "ç¨æ·æµç§°ï¼"+task.taskparams.username+"<br/>";802 }803 infohtm += "æ¯å¦ç§åï¼"+(task.taskparams.isseed ? "æ¯" : "å¦")+"<br/>";804 if(task.taskparams.filterdup != undefined){805 infohtm += "å»é¤éå¤ï¼"+(task.taskparams.filterdup ? "æ¯" : "å¦")+"<br/>";806 }807 if(task.taskparams.starttime != undefined){808 infohtm += "å¼å§æ¶é´ï¼"+timeToStr(task.taskparams.starttime)+"<br/>";809 }810 if(task.taskparams.endtime != undefined){811 infohtm += "ç»ææ¶é´ï¼"+timeToStr(task.taskparams.endtime)+"<br/>";812 }813 if(task.relativestart!= undefined){814 var ttrs = task.relativestart;815 var rsstr = "";816 if(ttrs == "now"){817 rsstr = "å建æ¶é´";818 }819 else{820 var rs = task.relativestart.split(" ");821 var num = parseFloat(rs[0]);822 var gap = getGaptext(rs[1]);823 if(num > 0){824 rsstr = "å"+num+gap;825 }826 else{827 var tnum = -num;828 rsstr = "å"+tnum+gap;829 }830 }831 infohtm += "ç¸å¯¹å¼å§æ¶é´ï¼"+rsstr+"<br/>";832 }833 if(task.relativeend != undefined){834 var ttre = task.relativeend;835 var restr = "";836 if(ttre == "now"){837 restr = "å建æ¶é´";838 }839 else{840 var rs = task.relativeend.split(" ");841 var num = parseFloat(rs[0]);842 var gap = getGaptext(rs[1]);843 if(num > 0){844 restr = "å"+num+gap;845 }846 else{847 var tnum = -num;848 restr = "å"+tnum+gap;849 }850 }851 infohtm += "ç¸å¯¹ç»ææ¶é´ï¼"+restr+"<br/>";852 }853 if(task.taskparams.step != undefined && task.taskparams.step.length > 0){854 infohtm += "æ¥é¿ï¼"+parseInt(task.taskparams.step, 10)+(task.taskparams.step.indexOf("h") > 0 ? "å°æ¶" : "天")+"<br/>";855 }856 infohtm += "ä»»å¡è¶
æ¶ï¼"+task.taskparams.duration+"ç§<br/>";857 if("nodup" in task){858 infohtm += "å
许éå¤ä»»å¡ï¼"+(task.nodup ? "æ¯" : "å¦")+"<br/>";859 }860 if(task.taskparams.scene.dropcount != undefined){861 infohtm += "æ¾å¼æ¬¡æ°ï¼"+task.taskparams.scene.dropcount+"<br/>";862 }863 if(task.taskparams.scene.stat != undefined){864 infohtm += printStat(task.taskparams.scene.stat);865 }866 }867 else if(task.task == config.TASK_WEBPAGE){//论å868 if(task.taskparams.searchengine != undefined){869 infohtm += "æç´¢å¼æï¼"+getSearchEngineName(task.taskparams.searchengine)+"<br/>";870 }871 if(task.taskparams.crawlpage){872 infohtm += "æå页æ°ï¼"+task.taskparams.crawlpage+"<br/>";873 }874 if(task.taskparams.createdtimestart != undefined){875 infohtm += "主å¸å表æ¶é´å¼å§ï¼"+timeToStr(task.taskparams.createdtimestart)+"<br/>";876 }877 if(task.taskparams.createdtimeend != undefined){878 infohtm += "主å¸å表æ¶é´ç»æï¼"+timeToStr(task.taskparams.createdtimeend)+"<br/>";879 }880 if(task.taskparams.searchsite != undefined){881 infohtm += "æåç«ç¹ï¼"+getSearchSiteName(task.taskparams.searchsite)+"<br/>";882 }883 if(task.taskparams.source != undefined){884 var sn = getSourceName(task.taskparams.source);885 var sourcename = sn;886 if(!sourcename){887 sourcename = task.taskparams.source;888 }889 infohtm += "æ°æ®æ¥æºï¼"+sourcename+"<br/>";890 }891 if(task.taskparams.listurls){892 var u = task.taskparams.listurls;893 if(isArray(u)){894 var urlstr = "";895 $.each(u, function(ui, uitem){896 urlstr += "http:"+uitem.url+"<br/>";897 });898 infohtm += "æåå表URLï¼"+urlstr+"<br/>";899 }900 else{901 u = u.toString().replace(/</g, "<");902 u = u.toString().replace(/>/g, ">");903 infohtm += "æåå表URLï¼"+u+"<br/>";904 }905 }906 if(task.taskparams.texturls){907 var u = task.taskparams.texturls;908 if(isArray(u)){909 var urlstr = "";910 /*911 $.each(u, function(ui, uitem){912 urlstr += "http:"+uitem.url+"<br/>";913 });914 */915 infohtm += "æåæç« è¯¦æ
URLï¼"+urlstr+"<br/>";916 }917 else{918 u = u.toString().replace(/</g, "<");919 u = u.toString().replace(/>/g, ">");920 infohtm += "æåæç« è¯¦æ
URLï¼"+u+"<br/>";921 }922 }923 if(task.taskparams.importarticlecount){924 infohtm += "æ¯ä¸ªä»»å¡å
å«æºæç« æ°ï¼"+task.taskparams.importarticlecount+"<br/>";925 }926 if(task.taskparams.lastrplytimestart != undefined){927 infohtm += "æç« å表æ¶é´å¼å§ï¼"+timeToStr(task.taskparams.lastrplytimestart)+"<br/>";928 }929 if(task.taskparams.lastrplytimeend != undefined){930 infohtm += "æç« å表æ¶é´ç»æï¼"+timeToStr(task.taskparams.lastrplytimeend)+"<br/>";931 }932 if(task.taskparams.userurls){933 var u = task.taskparams.userurls;934 if(isArray(u)){935 var urlstr = "";936 $.each(u, function(ui, uitem){937 urlstr += "http:"+uitem.url+"<br/>";938 });939 infohtm += "æåç¨æ·URLï¼"+urlstr+"<br/>";940 }941 else{942 u = u.toString().replace(/</g, "<");943 u = u.toString().replace(/>/g, ">");944 infohtm += "æåç¨æ·URLï¼"+u+"<br/>";945 }946 }947 if(task.taskparams.importusercount){948 infohtm += "æ¯ä¸ªä»»å¡å
å«ç¨æ·æ°ï¼"+task.taskparams.importusercount+"<br/>";949 }950 if(task.taskparams.userids){951 var userids = task.taskparams.userids;952 if(isArray(userids)){953 infohtm += "æåç¨æ·idï¼"+userids.join(",")+"<br/>";954 }955 }956 if(task.taskparams.logoutfirst != undefined){957 infohtm += "ä»»å¡å¼å§åéåºå½åç»å½è´¦å·ï¼"+(task.taskparams.logoutfirst ? "æ¯" : "å¦")+"<br/>";958 }959 if(task.taskparams.iscalctrend!= undefined){960 infohtm += "æ¯å¦è®¡ç®è½¨è¿¹ï¼"+(task.taskparams.iscalctrend ? "æ¯" : "å¦")+"<br/>";961 }962 if(task.taskparams.accountid != undefined){963 var accountname = [];964 $.each(task.taskparams.accountid, function(i, item){965 var sn = getSpiderAccountName(task.taskparams.source, item);966 accountname.push(sn); 967 })968 infohtm += "æåå¸å·ï¼"+accountname.join(", ")+"<br/>";969 }970 if(task.taskparams.isswitch != undefined){971 infohtm += "æ¯å¦åæ¢å¸å·ï¼"+(task.taskparams.isswitch ? "æ¯" : "å¦")+"<br/>";972 if(task.taskparams.isswitch){973 infohtm += "å¸å·åæ¢çç¥ï¼"+task.taskparams.switchpage+"页/"+task.taskparams.switchtime+"ç§<br/>";974 }975 if(parseInt(task.taskparams.globalaccount,10)){976 infohtm += "使ç¨å
¨å±å¸å·ï¼"+(task.taskparams.isswitch ? "æ¯" : "å¦")+"<br/>";977 }978 }979 if(task.taskparams.keywords != undefined){980 infohtm += "å
³é®è¯ï¼"+task.taskparams.keywords+"<br/>";981 }982 if(task.taskparams.username != undefined){983 infohtm += "ç¨æ·æµç§°ï¼"+task.taskparams.username+"<br/>";984 }985 if(task.taskparams.filterdup != undefined){986 infohtm += "å»é¤éå¤ï¼"+(task.taskparams.filterdup ? "æ¯" : "å¦")+"<br/>";987 }988 if(task.taskparams.starttime != undefined){989 infohtm += "å¼å§æ¶é´ï¼"+timeToStr(task.taskparams.starttime)+"<br/>";990 }991 if(task.taskparams.endtime != undefined){992 infohtm += "ç»ææ¶é´ï¼"+timeToStr(task.taskparams.endtime)+"<br/>";993 }994 if(task.relativestart!= undefined){995 var ttrs = task.relativestart;996 var rsstr = "";997 if(ttrs == "now"){998 rsstr = "å建æ¶é´";999 }1000 else{1001 var rs = task.relativestart.split(" ");1002 var num = parseFloat(rs[0]);1003 var gap = getGaptext(rs[1]);1004 if(num > 0){1005 rsstr = "å"+num+gap;1006 }1007 else{1008 var tnum = -num;1009 rsstr = "å"+tnum+gap;1010 }1011 }1012 infohtm += "ç¸å¯¹å¼å§æ¶é´ï¼"+rsstr+"<br/>";1013 }1014 if(task.relativeend != undefined){1015 var ttre = task.relativeend;1016 var restr = "";1017 if(ttre == "now"){1018 restr = "å建æ¶é´";1019 }1020 else{1021 var rs = task.relativeend.split(" ");1022 var num = parseFloat(rs[0]);1023 var gap = getGaptext(rs[1]);1024 if(num > 0){1025 restr = "å"+num+gap;1026 }1027 else{1028 var tnum = -num;1029 restr = "å"+tnum+gap;1030 }1031 }1032 infohtm += "ç¸å¯¹ç»ææ¶é´ï¼"+restr+"<br/>";1033 }1034 if(task.taskparams.step != undefined && task.taskparams.step.length > 0){1035 infohtm += "æ¥é¿ï¼"+parseInt(task.taskparams.step, 10)+(task.taskparams.step.indexOf("h") > 0 ? "å°æ¶" : "天")+"<br/>";1036 }1037 infohtm += "ä»»å¡è¶
æ¶ï¼"+task.taskparams.duration+"ç§<br/>";1038 if("nodup" in task){1039 infohtm += "å
许éå¤ä»»å¡ï¼"+(task.nodup ? "æ¯" : "å¦")+"<br/>";1040 }1041 if(task.taskparams.scene.dropcount != undefined){1042 infohtm += "æ¾å¼æ¬¡æ°ï¼"+task.taskparams.scene.dropcount+"<br/>";1043 }1044 if(task.taskparams.scene.stat != undefined){1045 infohtm += printStat(task.taskparams.scene.stat);1046 }1047 }1048 else if(task.task == config.TASK_FRIEND){//æåå
³æ³¨1049 infohtm += "æåé
ç½®ï¼"+getSpiderConfigName(task.taskparams.config)+"<br/>";1050 if(task.taskparams.source != undefined){1051 var sn = getSourceName(task.taskparams.source);1052 var sourcename = sn;1053 if(!sourcename){1054 sourcename = task.taskparams.source;1055 }1056 infohtm += "æ°æ®æ¥æºï¼"+sourcename+"<br/>";1057 }1058 if(task.taskparams.unames != undefined){1059 infohtm += "ç¨æ·ï¼"+task.taskparams.unames+"<br/>";1060 }1061 else{1062 infohtm += "ç¨æ·IDï¼"+task.taskparams.uids+"<br/>";1063 }1064 infohtm += "æ¯å¦ç§åï¼"+(task.taskparams.isseed ? "æ¯" : "å¦")+"<br/>";1065 infohtm += "ä»»å¡è¶
æ¶ï¼"+task.taskparams.duration+"ç§<br/>";1066 if("nodup" in task){1067 infohtm += "å
许éå¤ä»»å¡ï¼"+(task.nodup ? "æ¯" : "å¦")+"<br/>";1068 }1069 if(task.taskparams.scene.dropcount != undefined){1070 infohtm += "æ¾å¼æ¬¡æ°ï¼"+task.taskparams.scene.dropcount+"<br/>";1071 }1072 if(task.taskparams.scene.stat != undefined){1073 infohtm += printStat(task.taskparams.scene.stat);1074 }1075 }1076 else if(task.task == config.TASK_MIGRATEDATA){//è¿ç§»æ°æ®1077 infohtm += "<b>é
置信æ¯</b><br/>";1078 infohtm += "æºä¸»æºï¼"+getHostName(task.taskparams.srchost)+"<br/>";1079 var dsthosts = [];1080 if(task.taskparams.dsthost != undefined){1081 for(var i = 0; i < task.taskparams.dsthost.length; i++){1082 dsthosts.push(getHostName(task.taskparams.dsthost[i]));1083 }1084 infohtm += "ç®æ 主æºï¼"+dsthosts.join(",")+"<br/>";1085 }1086 infohtm += "æ大å¤çæ¡æ°ï¼";1087 if(task.taskparams.maxcount != undefined){1088 infohtm += task.taskparams.maxcount+"<br/>";1089 }1090 else{1091 infohtm += "å
¨é¨<br/>";1092 }1093 if(task.taskparams.eachcount != undefined){1094 infohtm += "æ¯æ¬¡å¤çæ¡æ°ï¼"+task.taskparams.eachcount+"<br/>";1095 }1096 if(task.taskparams.keepsrc != undefined){1097 infohtm += "ä¿çæºæ°æ®ï¼"+(task.taskparams.keepsrc ? "æ¯" : "å¦")+"<br/>";1098 }1099 if(task.taskparams.delseedweibo != undefined){1100 infohtm += "å é¤ç§åå¾®åï¼"+(task.taskparams.delseedweibo ? "æ¯" : "å¦")+"<br/>";1101 }1102 if(task.taskparams.deluser != undefined){1103 infohtm += "å é¤ç¨æ·ï¼"+(task.taskparams.deluser ? "æ¯" : "å¦")+"<br/>";1104 }1105 if(task.taskparams.delseeduser != undefined){1106 infohtm += "å é¤ç§åç¨æ·ï¼"+(task.taskparams.delseeduser ? "æ¯" : "å¦")+"<br/>";1107 }1108 if(task.taskparams.source != undefined){1109 var sn = getSourceName(task.taskparams.source);1110 var sourcename = sn;1111 if(!sourcename){1112 sourcename = task.taskparams.source;1113 }1114 infohtm += "æ°æ®æ¥æºï¼"+sourcename+"<br/>";1115 }1116 if(task.taskparams.cond_ge_created != undefined){1117 infohtm += "æå°å建æ¶é´ï¼"+timeToStr(task.taskparams.cond_ge_created)+"<br/>";1118 }1119 if(task.taskparams.cond_lt_created != undefined){1120 infohtm += "æ大å建æ¶é´ï¼"+timeToStr(task.taskparams.cond_lt_created)+"<br/>";1121 }1122 if(task.taskparams.cond_ex_text != undefined){1123 infohtm += "æé¤å
³é®è¯ï¼"+task.taskparams.cond_ex_text+"<br/>";1124 }1125 if(task.taskparams.cond_in_text != undefined){1126 infohtm += "å
å«å
³é®è¯ï¼"+task.taskparams.cond_in_text+"<br/>";1127 }1128 if(task.taskparams.cond_ex_name != undefined){1129 infohtm += "æé¤ç¨æ·æµç§°ï¼"+task.taskparams.cond_ex_name+"<br/>";1130 }1131 if(task.taskparams.cond_in_name != undefined){1132 infohtm += "å
å«ç¨æ·æµç§°ï¼"+task.taskparams.cond_in_name+"<br/>";1133 }1134 if("nodup" in task){1135 infohtm += "å
许éå¤ä»»å¡ï¼"+(task.nodup ? "æ¯" : "å¦")+"<br/>";1136 }1137 infohtm += "<b>ç»è®¡ä¿¡æ¯</b><br/>";1138 if(!task.taskparams.keepsrc){1139 if(task.taskparams.select_cursor != undefined){1140 infohtm += "<span style='color:red;'>ä¿çæç« æ°ï¼</span>"+task.taskparams.select_cursor+"<br/>";1141 }1142 }1143 if(task.taskparams.scene.delete_status_count != undefined){1144 infohtm += "å é¤æç« æ°ï¼"+task.taskparams.scene.delete_status_count+"<br/>";1145 }1146 if(task.taskparams.scene.delete_user_count != undefined){1147 infohtm += "å é¤ç¨æ·æ°ï¼"+task.taskparams.scene.delete_user_count+"<br/>";1148 }1149 if(task.taskparams.scene.alltime != undefined){1150 infohtm += "æ»è±è´¹æ¶é´ï¼"+task.taskparams.scene.alltime+"<br/>";1151 }1152 if(task.taskparams.scene.solr_time != undefined){1153 infohtm += "æºsolræ»æ¶é´ï¼"+task.taskparams.scene.solr_time+"<br/>";1154 }1155 if(task.taskparams.scene.solr_query_time != undefined){1156 infohtm += "æºsolræ¥è¯¢æ¶é´ï¼"+task.taskparams.scene.solr_query_time+"<br/>";1157 }1158 if(task.taskparams.scene.solr_retrieve_time != undefined){1159 infohtm += "æºsolræåæ¶é´ï¼"+task.taskparams.scene.solr_retrieve_time+"<br/>";1160 }1161 if(task.taskparams.scene.solr_delete_time != undefined){1162 infohtm += "æºsolrå é¤æ¶é´ï¼"+task.taskparams.scene.solr_delete_time+"<br/>";1163 }1164 if(task.taskparams.scene.db_time != undefined){1165 infohtm += "æºæ°æ®åºæ»æ¶é´ï¼"+task.taskparams.scene.db_time+"<br/>";1166 }1167 if(task.taskparams.scene.db_query_time != undefined){1168 infohtm += "æºæ°æ®åºæ¥è¯¢æ¶é´ï¼"+task.taskparams.scene.db_query_time+"<br/>";1169 }1170 if(task.taskparams.scene.db_retrieve_time != undefined){1171 infohtm += "æºæ°æ®åºæåæ¶é´ï¼"+task.taskparams.scene.db_retrieve_time+"<br/>";1172 }1173 if(task.taskparams.scene.db_delete_time != undefined){1174 infohtm += "æºæ°æ®åºå é¤æ¶é´ï¼"+task.taskparams.scene.db_delete_time+"<br/>";1175 }1176 if(task.taskparams.scene.dst != undefined){1177 for(var i = 0; i < task.taskparams.scene.dst.length; i++){1178 infohtm += "ç®æ 主æº"+dsthosts[i]+"<br/>";1179 if(task.taskparams.scene.dst[i].insert_status_count != undefined){1180 infohtm += "æå
¥æç« æ°ï¼"+task.taskparams.scene.dst[i].insert_status_count+"<br/>";1181 }1182 if(task.taskparams.scene.dst[i].update_status_count != undefined){1183 infohtm += "æ´æ°æç« æ°ï¼"+task.taskparams.scene.dst[i].update_status_count+"<br/>";1184 }1185 if(task.taskparams.scene.dst[i].insert_user_count != undefined){1186 infohtm += "æå
¥ç¨æ·æ°ï¼"+task.taskparams.scene.dst[i].insert_user_count+"<br/>";1187 }1188 if(task.taskparams.scene.dst[i].update_user_count != undefined){1189 infohtm += "æ´æ°ç¨æ·æ°ï¼"+task.taskparams.scene.dst[i].update_user_count+"<br/>";1190 }1191 if(task.taskparams.scene.dst[i].solr_time != undefined){1192 infohtm += "solræ»æ¶é´ï¼"+task.taskparams.scene.dst[i].solr_time+"<br/>";1193 }1194 if(task.taskparams.scene.dst[i].solr_query_time != undefined){1195 infohtm += "solræ¥è¯¢æ¶é´ï¼"+task.taskparams.scene.dst[i].solr_query_time+"<br/>";1196 }1197 if(task.taskparams.scene.dst[i].solr_insert_time != undefined){1198 infohtm += "solræå
¥æ¶é´ï¼"+task.taskparams.scene.dst[i].solr_insert_time+"<br/>";1199 }1200 if(task.taskparams.scene.dst[i].solr_update_time != undefined){1201 infohtm += "solræ´æ°æ¶é´ï¼"+task.taskparams.scene.dst[i].solr_update_time+"<br/>";1202 }1203 if(task.taskparams.scene.dst[i].db_time != undefined){1204 infohtm += "æ°æ®åºæ»æ¶é´ï¼"+task.taskparams.scene.dst[i].db_time+"<br/>";1205 }1206 if(task.taskparams.scene.dst[i].db_query_time != undefined){1207 infohtm += "æ°æ®åºæ¥è¯¢æ¶é´ï¼"+task.taskparams.scene.dst[i].db_query_time+"<br/>";1208 }1209 if(task.taskparams.scene.dst[i].db_insert_time != undefined){1210 infohtm += "æ°æ®åºæå
¥æ¶é´ï¼"+task.taskparams.scene.dst[i].db_insert_time+"<br/>";1211 }1212 if(task.taskparams.scene.dst[i].db_update_time != undefined){1213 infohtm += "æ°æ®åºæ´æ°æ¶é´ï¼"+task.taskparams.scene.dst[i].db_update_time+"<br/>";1214 }1215 }1216 }1217 }1218 else if(task.task == config.TASK_SNAPSHOT || task.task == config.TASK_EVENTALERT){//æ´æ°å¿«ç
§1219 infohtm += "<b>é
置信æ¯</b><br/>";1220 infohtm += "å®ä¾IDï¼"+task.taskparams.instanceid+"<br/>";1221 if(task.taskparams.spawntime != undefined){1222 infohtm += "æ´æ°æ¶é´ï¼"+timeToStr(task.taskparams.spawntime)+"<br/>";1223 }1224 if(task.taskparams.history_enable != undefined){1225 infohtm += "ä¿ååå²ï¼"+(task.taskparams.history_enable ? "æ¯" : "å¦")+"<br/>";1226 }1227 if(task.taskparams.history_count != undefined){1228 infohtm += "ä¿ååå²æ¡æ°ï¼"+task.taskparams.history_count+"<br/>";1229 }1230 if(task.taskparams.history_duration != undefined){1231 infohtm += "ä¿ååå²æ¶é´ï¼"+task.taskparams.history_duration+"ç§<br/>";1232 }1233 if("nodup" in task){1234 infohtm += "å
许éå¤ä»»å¡ï¼"+(task.nodup ? "æ¯" : "å¦")+"<br/>";1235 }1236 if(task.taskparams.eventlist!= undefined){1237 if(task.taskparams.eventlist.name){1238 infohtm += "äºä»¶å称ï¼"+task.taskparams.eventlist.name+"<br/>";1239 }1240 if(task.taskparams.eventlist.remarks){1241 infohtm += "äºä»¶æè¿°ï¼"+task.taskparams.eventlist.remarks+"<br/>";1242 }1243 if(task.taskparams.eventlist.alarms){1244 var alarmArr = task.taskparams.eventlist.alarms;1245 var elecondition = {}1246 /*1247 if(!elecondition){1248 var elecondition = {}1249 elecondition.firstrequestData = ritem.snapshot;1250 elecondition.dataJson = ritem.content;1251 }1252 */1253 infohtm += "é¢è¦æ¡ä»¶:<br/>";1254 $.each(alarmArr, function(ai, aitem){1255 var tmpnum = parseInt(ai, 10) + 1;1256 infohtm += " æ¡ä»¶"+tmpnum+":"+getLogicExpDes(aitem.trigger, elecondition)+"<br/>";1257 });1258 }1259 }1260 else{1261 infohtm += "é¢è¦æ¡ä»¶ï¼æ <br/>";1262 }1263 if(task.taskparams.scene.userid != undefined){1264 infohtm += "<b>ç»è®¡ä¿¡æ¯</b><br/>";1265 infohtm += "ç¨æ·IDï¼"+task.taskparams.scene.userid+"<br/>";1266 }1267 if(task.taskparams.scene.reqstat != undefined){1268 infohtm += "请æ±æ°ï¼"+task.taskparams.scene.reqstat.length+"<br/>";1269 for(var i = 0; i < task.taskparams.scene.reqstat.length; i++){1270 infohtm += "请æ±"+i+"å
ç´ IDï¼"+task.taskparams.scene.reqstat[i].elementid+"ï¼æ¶é´ï¼"+task.taskparams.scene.reqstat[i].reqtime+"ç§<br/>";1271 }1272 }1273 if(task.taskparams.scene.alltime != undefined){1274 infohtm += "æ»æ¶é´ï¼"+task.taskparams.scene.alltime+"ç§<br/>";1275 }1276 }1277 else{1278 if(v.taskparams.source != undefined){1279 var sn = getSourceName(v.taskparams.source);1280 var sourcename = sn;1281 if(!sourcename){1282 sourcename = task.taskparams.source;1283 }1284 task_term += sourcename;1285 }1286 else{1287 task_term += 'å
¨é¨';1288 }1289 if(v.task == config.TASK_IMPORTWEIBOURL){//æ¤å
¥å¾®å1290 var datatype = v.taskparams.datatype ? v.taskparams.datatype : v.taskparams.urltype;1291 var _data = v.taskparams.urls ? v.taskparams.urls : v.taskparams.data;1292 if(datatype == 'comment'){1293 task_term += ' æ¤å
¥è¯è®º';1294 }1295 else if(datatype == 'weibo'){1296 task_term += ' æ¤å
¥å¾®åå
容';1297 }1298 else if(datatype == 'url'){1299 task_term += ' æ¤å
¥å¾®åURL';1300 }1301 else{1302 task_term += ' æ¤å
¥å¾®åID';1303 }1304 if(v.taskparams.isseed){1305 task_term += ' ç§åå¾®å';1306 }1307 else{1308 task_term += ' éç§åå¾®å';1309 }1310 if(v.taskparams.addreposttask){1311 task_term += ' åæ¶æ·»å 转åä»»å¡';1312 }1313 task_term += '<br/>æ°æ®ï¼<br/>';1314 for(var i=0; i<_data.length; i++){1315 var rd = '';1316 if(datatype == 'id' || datatype == 'url' || datatype == 'comment'){1317 rd = typeof(_data[i]) == 'object' ? _data[i][datatype] : _data[i];1318 }1319 else{1320 continue;//å¾®åå
容ä¸æ¾ç¤º1321 }1322 if(i == (_data.length -1)){1323 task_term += rd;1324 }1325 else{1326 task_term += rd+', ';1327 }1328 }1329 if(task_term != ''){1330 infohtm += 'åæ°ï¼'+task_term + '<br/>';1331 }1332 if(v.taskparams.depend != undefined){1333 infohtm += 'ä¾èµä»»å¡ï¼'+v.taskparams.depend + '<br/>';1334 }1335 }1336 else if(v.task == config.TASK_IMPORTUSERID){//æ¤å
¥ç¨æ·1337 var _data = v.taskparams.urls ? v.taskparams.urls : v.taskparams.data;1338 if(v.taskparams.datatype == 'id'){1339 task_term += ' æ¤å
¥ç¨æ·ID';1340 }1341 else{1342 task_term += ' æ¤å
¥ç¨æ·æµç§°';1343 }1344 if(v.taskparams.isseed){1345 task_term += ' ç§åç¨æ·';1346 }1347 else{1348 task_term += ' éç§åç¨æ·';1349 }1350 if(v.taskparams.getfriends){1351 task_term += ' ç«å³æåå
³æ³¨';1352 }1353 task_term += '<br/>æ°æ®ï¼<br/>';1354 for(var i = 0; i < v.taskparams.data.length; i++){1355 if(i == (v.taskparams.data.length -1)){1356 task_term += v.taskparams.data[i];1357 }1358 else{1359 task_term += v.taskparams.data[i]+', ';1360 }1361 }1362 if(task_term != ''){1363 infohtm += 'åæ°ï¼'+task_term + '<br/>';1364 }1365 }1366 else{1367 /*1368 if(v.taskparams.maxanalysistime != undefined){1369 task_term += ' æ¶é´æ©äº '+timeToStr(_getintvalue(v.taskparams.maxanalysistime))+' çæ°æ®';1370 } 1371 */1372 if(v.taskparams.users != undefined){1373 if(v.taskparams.inputtype == 'id'){1374 task_term += ' æå®ç¨æ·IDï¼ ';1375 }1376 else{1377 task_term += ' æå®ç¨æ·æµç§°ï¼ ';1378 }1379 task_term += v.taskparams.users.toString()+' ';1380 }1381 if(v.taskparams.usertype != undefined){1382 task_term += ' ç¨æ·ç±»åï¼ '+getUserTypeText(v.taskparams.usertype.toString())+' ';1383 }1384 if(v.taskparams.min_follower_count != undefined){1385 task_term += ' ç²ä¸æ°å¤§äºï¼ '+_getintvalue(v.taskparams.min_follower_count)+'ç ';1386 }1387 if(task_term != ''){1388 infohtm += 'æ°æ®èå´ï¼'+task_term + '<br/>';1389 }1390 if(v.taskparams.config != undefined){1391 infohtm += "æåé
ç½®ï¼"+getSpiderConfigName(v.taskparams.config)+"<br/>";1392 }1393 if(v.taskparams.isseed != undefined){1394 infohtm += "æ¯å¦ç§åï¼"+(v.taskparams.isseed ? "æ¯" : "å¦")+"<br/>";1395 }1396 if(v.taskparams.minanalysistime!= undefined){1397 infohtm += "æç« åæå¼å§æ¶é´ï¼"+timeToStr(v.taskparams.minanalysistime)+"<br/>";1398 }1399 if(v.taskparams.maxanalysistime != undefined){1400 infohtm += "æç« åæç»ææ¶é´ï¼"+timeToStr(v.taskparams.maxanalysistime)+"<br/>";1401 }1402 if(v.taskparams.min_created_time!= undefined){1403 infohtm += "å¼å§æ¶é´ï¼"+timeToStr(v.taskparams.min_created_time)+"<br/>";1404 }1405 if(v.taskparams.max_created_time != undefined){1406 infohtm += "ç»ææ¶é´ï¼"+timeToStr(v.taskparams.max_created_time)+"<br/>";1407 }1408 if(v.taskparams.source_host){1409 infohtm += "åææ°æ®æ¥æºï¼"+v.taskparams.source_host.join(",")+"<br/>";1410 }1411 if(v.taskparams.urls){1412 var u = v.taskparams.urls;1413 if(isArray(u)){1414 var urlstr = "";1415 $.each(u, function(ui, uitem){1416 urlstr += ""+uitem+"<br/>";1417 });1418 infohtm += "åæå表URLï¼"+urlstr+"<br/>";1419 }1420 }1421 if(v.taskparams.starttime != undefined){1422 infohtm += "å¼å§æ¶é´ï¼"+timeToStr(v.taskparams.starttime)+"<br/>";1423 }1424 if(v.taskparams.endtime != undefined){1425 infohtm += "ç»ææ¶é´ï¼"+timeToStr(v.taskparams.endtime)+"<br/>";1426 }1427 if(task.relativestart!= undefined){1428 var ttrs = task.relativestart;1429 var rsstr = "";1430 if(ttrs == "now"){1431 rsstr = "å建æ¶é´";1432 }1433 else{1434 var rs = task.relativestart.split(" ");1435 var num = parseFloat(rs[0]);1436 var gap = getGaptext(rs[1]);1437 if(num > 0){1438 rsstr = "å"+num+gap;1439 }1440 else{1441 var tnum = -num;1442 rsstr = "å"+tnum+gap;1443 }1444 }1445 infohtm += "ç¸å¯¹å¼å§æ¶é´ï¼"+rsstr+"<br/>";1446 }1447 if(task.relativeend != undefined){1448 var ttre = task.relativeend;1449 var restr = "";1450 if(ttre == "now"){1451 restr = "å建æ¶é´";1452 }1453 else{1454 var rs = task.relativeend.split(" ");1455 var num = parseFloat(rs[0]);1456 var gap = getGaptext(rs[1]);1457 if(num > 0){1458 restr = "å"+num+gap;1459 }1460 else{1461 var tnum = -num;1462 restr = "å"+tnum+gap;1463 }1464 }1465 infohtm += "ç¸å¯¹ç»ææ¶é´ï¼"+restr+"<br/>";1466 }1467 if(task.taskparams.logoutfirst != undefined){1468 infohtm += "ä»»å¡å¼å§åéåºå½åç»å½è´¦å·ï¼"+(task.taskparams.logoutfirst ? "æ¯" : "å¦")+"<br/>";1469 }1470 if(task.taskparams.accountid != undefined){1471 var accountname = [];1472 $.each(task.taskparams.accountid, function(i, item){1473 var sn = getSpiderAccountName(task.taskparams.source, item);1474 accountname.push(sn); 1475 })1476 infohtm += "æåå¸å·ï¼"+accountname.join(", ")+"<br/>";1477 }1478 if(task.taskparams.isswitch != undefined){1479 infohtm += "æ¯å¦åæ¢å¸å·ï¼"+(task.taskparams.isswitch ? "æ¯" : "å¦")+"<br/>";1480 if(task.taskparams.isswitch){1481 infohtm += "å¸å·åæ¢çç¥ï¼"+task.taskparams.switchpage+"页/"+task.taskparams.switchtime+"ç§<br/>";1482 }1483 if(parseInt(task.taskparams.globalaccount,10)){1484 infohtm += "使ç¨å
¨å±å¸å·ï¼"+(task.taskparams.isswitch ? "æ¯" : "å¦")+"<br/>";1485 }1486 }1487 if(v.taskparams.step != undefined && v.taskparams.step.length > 0){1488 infohtm += "æ¥é¿ï¼"+parseInt(v.taskparams.step, 10)+(v.taskparams.step.indexOf("h") > 0 ? "å°æ¶" : "天")+"<br/>";1489 }1490 if(v.taskparams.duration != undefined){1491 infohtm += "ä»»å¡è¶
æ¶ï¼"+v.taskparams.duration+"ç§<br/>";1492 }1493 if("nodup" in task){1494 infohtm += "å
许éå¤ä»»å¡ï¼"+(task.nodup ? "æ¯" : "å¦")+"<br/>";1495 }1496 if(v.taskparams.scene.dropcount != undefined){1497 infohtm += "æ¾å¼æ¬¡æ°ï¼"+v.taskparams.scene.dropcount+"<br/>";1498 }1499 if(v.taskparams.scene.stat != undefined){1500 infohtm += printStat(v.taskparams.scene.stat);1501 }1502 if(v.taskparams.scene.users_notext != undefined && v.taskparams.scene.users_notext.length > 0){1503 var darr = [];1504 $.each(v.taskparams.scene.users_notext, function(vi, vitem){1505 var n = "";1506 n+=vitem;1507 if(v.taskparams.scene.users_notexistname != undefined && v.taskparams.scene.users_notexistname.length > 0){1508 n += "("+v.taskparams.scene.users_notexistname[vi]+")"; 1509 }1510 darr.push(n); 1511 });1512 if(darr.length > 0){1513 infohtm += "ä¸åå¨çç¨æ·ï¼"+darr.join(", ")+"<br/>";1514 }1515 else{1516 infohtm += "ä¸åå¨çç¨æ·ï¼"+v.taskparams.scene.users_notext.join(", ")+"<br/>";1517 }1518 }1519 if(v.taskparams.scene.users_change_screen_name != undefined && v.taskparams.scene.users_change_screen_name.length > 0){1520 infohtm += "æ´æ¹æµç§°çç¨æ·:"+v.taskparams.scene.users_change_screen_name.join(", ")+"<br/>";1521 }1522 if(v.taskparams.scene.users_id2name != undefined && v.taskparams.scene.users_id2name.length > 0){1523 infohtm += "ç¨æ·IDæµç§°æ å°ï¼"+v.taskparams.scene.users_id2name.join(", ")+"<br/>";1524 }1525 }1526 var func = "";1527 var tokenize_fieldname = {text:"åæå
容", verified_reason:"认è¯åå ", description:"ç¨æ·ç®ä»", post_title:"å¸åæ é¢"};1528 if(v.taskparams.tokenize_fields != undefined){1529 func += "éæ°åæï¼"1530 $.each(v.taskparams.tokenize_fields,function(tfi,tf){1531 var sp = ",";1532 if(tfi == v.taskparams.tokenize_fields.length -1){1533 sp="<br/>";1534 }1535 func += tokenize_fieldname[tf]+sp;1536 });1537 }1538 var other_fieldname = {area:"ç¨æ·å°åº", reposts_count:"转åæ°", direct_reposts_count:"ç´æ¥è½¬åæ°",total_reposts_count:"æ»è½¬åæ°",1539 followers_count:"ç´æ¥å°è¾¾æ°",total_reach_count:"æ»å°è¾¾æ°",comments_count:"è¯è®ºæ°",time:"æ¶é´"};1540 if(v.taskparams.other_fields != undefined){1541 func += "æ´æ°ï¼"1542 $.each(v.taskparams.other_fields,function(tfi,tf){1543 var sp = ",";1544 if(tfi == v.taskparams.other_fields.length -1){1545 sp="<br/>";1546 }1547 func += other_fieldname[tf]+sp;1548 });1549 }1550 infohtm += func;1551 infohtm += exeinfo;1552 if(v.task == config.TASK_IMPORTUSERID){1553 if(v.taskparams.scene.alltime){1554 infohtm += 'æ»è±è´¹æ¶é´ï¼'+_getintvalue(v.taskparams.scene.alltime)+'<br/>';1555 }1556 if(v.taskparams.scene.solr_query_time){1557 infohtm += 'æ¥è¯¢ç¨æ·è±è´¹æ¶é´ï¼'+_getintvalue(v.taskparams.scene.solr_query_time)+'<br/>';1558 }1559 if(v.taskparams.scene.solr_update_time){1560 infohtm += 'æ´æ°ç¨æ·è±è´¹æ¶é´ï¼'+_getintvalue(v.taskparams.scene.solr_update_time)+'<br/>';1561 }1562 }1563 if(!v.taskparams.scene.isremote){1564 if(v.taskparams.scene.execcount != undefined){1565 infohtm += 'æ§è¡æ¬¡æ°ï¼'+_getintvalue(v.taskparams.scene.execcount)+'<br/>';1566 }1567 if(v.taskparams.scene.analysistime != undefined){1568 infohtm += 'åæææ¡£è±è´¹æ¶é´ï¼'+_getintvalue(v.taskparams.scene.analysistime)+'<br/>';1569 }1570 if(v.taskparams.scene.storetime != undefined){1571 infohtm += 'åå¨ææ¡£è±è´¹æ¶é´ï¼'+_getintvalue(v.taskparams.scene.storetime)+'<br/>';1572 }1573 if(v.taskparams.scene.sqlquerytime != undefined){1574 infohtm += 'æ¥è¯¢æ°æ®è±è´¹æ¶é´ï¼'+_getintvalue(v.taskparams.scene.sqlquerytime)+'<br/>';1575 }1576 if(v.taskparams.scene.sqlupdatetime != undefined){1577 infohtm += 'æ´æ°åæç¶æè±è´¹æ¶é´ï¼'+_getintvalue(v.taskparams.scene.sqlupdatetime)+'<br/>';1578 }1579 1580 if(v.taskparams.scene.apicount_usertimeline != undefined){1581 infohtm += '访é®API(user_timeline)次æ°ï¼'+v.taskparams.scene.apicount_usertimeline;1582 var errorcnt = v.taskparams.scene.apierrorcount_usertimeline ? v.taskparams.scene.apierrorcount_usertimeline : 0;1583 infohtm += ', åºéæ°ï¼'+_getintvalue(v.taskparams.scene.apierrorcount_usertimeline);1584 infohtm += ', è±è´¹æ¶é´ï¼'+_getintvalue(v.taskparams.scene.apitime_usertimeline)+'<br/>';1585 }1586 if(v.taskparams.scene.spider_statuscount != undefined){1587 infohtm += 'æ»æåæ°ï¼'+v.taskparams.scene.spider_statuscount;1588 infohtm += ', æ»å
¥åºæ°ï¼'+_getintvalue(v.taskparams.scene.insertsql_statuscount);1589 infohtm += ', å
¥åºè±è´¹æ¶é´ï¼'+_getintvalue(v.taskparams.scene.insertsql_statustime)+'<br/>';1590 }1591 if(v.taskparams.scene.spider_usercount != undefined){1592 infohtm += 'æ°ç¨æ·æ°ï¼'+v.taskparams.scene.spider_usercount;1593 infohtm += ', å
¥åºè±è´¹æ¶é´ï¼'+_getintvalue(v.taskparams.scene.insertsql_usertime)+'<br/>';1594 }1595 if(v.taskparams.seedusercount != undefined){1596 infohtm += 'æ»ç§åç¨æ·æ°ï¼'+v.taskparams.seedusercount;1597 infohtm += ', å·²å¤çï¼'+_getintvalue(v.taskparams.select_user_cursor);1598 infohtm += ', æ»è±è´¹æ¶é´ï¼'+_getintvalue(v.taskparams.scene.alltime);1599 }1600 1601 if(v.taskparams.scene.databasecount != undefined){1602 var dbcount = _getintvalue(v.taskparams.scene.databasecount);1603 infohtm += 'å
¨é¨æ°æ®æ°ï¼'+dbcount+'';1604 var allcount = _getintvalue(v.taskparams.scene.alldatacount);1605 if(allcount){1606 infohtm += ', è¿æ»¤åçååæ°æ®æ°ï¼'+allcount+'';1607 }1608 infohtm += '<br/>';1609 }1610 if(v.taskparams.scene.totalanalysiscount != undefined){1611 var tas = _getintvalue(v.taskparams.scene.totalanalysiscount); 1612 infohtm += 'éåææ°æ®æ°ï¼'+tas+'';1613 infohtm += '<br/>';1614 }1615 if(v.taskparams.scene.api_queryid_count){1616 infohtm += '访é®API(queryid)'+_getintvalue(v.taskparams.scene.api_queryid_count)+'次, åºé'+_getintvalue(v.taskparams.scene.api_queryid_errorcount)+', è±è´¹'+_getintvalue(v.taskparams.scene.api_queryid_time)+'<br/>';1617 }1618 if(v.taskparams.scene.api_showuser_count){1619 infohtm += '访é®API(æåç¨æ·show_user)'+_getintvalue(v.taskparams.scene.api_showuser_count)+'次, åºé'+_getintvalue(v.taskparams.scene.api_showuser_errorcount)+', è±è´¹'+_getintvalue(v.taskparams.scene.api_showuser_time)+'<br/>';1620 }1621 if(v.taskparams.scene.api_showstatus_count){1622 infohtm += '访é®API(æåå¾®åshow_status)'+_getintvalue(v.taskparams.scene.api_showstatus_count)+'次, åºé'+_getintvalue(v.taskparams.scene.api_showstatus_errorcount)+', è±è´¹'+_getintvalue(v.taskparams.scene.api_showstatus_time)+'<br/>';1623 }1624 if(v.taskparams.scene.api_friends_count){1625 infohtm += '访é®API(æåå
³æ³¨friends)'+_getintvalue(v.taskparams.scene.api_friends_count)+'次, åºé'+_getintvalue(v.taskparams.scene.api_friends_errorcount)+', è±è´¹'+_getintvalue(v.taskparams.scene.api_friends_time)+'<br/>';1626 }1627 }1628 var solrerrorcount = v.taskparams.scene.solrerrorcount;//æ»å¤±è´¥æ¡æ°1629 if(v.task == 8){1630 var allcount = v.taskparams.urls ? v.taskparams.urls.length : v.taskparams.data.length;1631 var datatype = v.taskparams.datatype ? v.taskparams.datatype : v.taskparams.urltype;1632 var str1 = ""; 1633 if(datatype == 'comment'){1634 str1 = 'æ¥æ¶å°è¯è®ºID';1635 }1636 else if(datatype == 'weibo'){1637 str1 = 'æ¥æ¶å°å¾®åå
容';1638 }1639 else if(datatype == 'url'){1640 str1 = 'æ¥æ¶å°å¾®åURL';1641 }1642 else{1643 str1 = 'æ¥æ¶å°å¾®åID';1644 }1645 var dc = _getintvalue(v.taskparams.select_cursor);1646 if(datatype == 'comment'){1647 infohtm += str1+'ï¼'+allcount+ 'æ¡, å·²å¤çï¼'+dc+'. æ°æ®åºåå¨'+_getintvalue(v.taskparams.scene.exists_weibocount)+'æ¡.';1648 }1649 else{1650 infohtm += str1+'ï¼'+allcount+ 'æ¡, å·²å¤çï¼'+dc+'. æ°æ®åºåå¨'+_getintvalue(v.taskparams.scene.exists_weibocount)+'æ¡,';1651 infohtm += ' å·²æ´æ°å¾®å'+_getintvalue(v.taskparams.scene.update_weibocount)+'æ¡. æ°æ®åºå·²åå¨'+_getintvalue(v.taskparams.scene.userexists_count)+'个ç¨æ·,';1652 infohtm += ' æ°å¢ç¨æ·'+_getintvalue(v.taskparams.scene.insert_user_count)+'个, æ´æ°ç¨æ·'+_getintvalue(v.taskparams.scene.update_user_count)+'个.';1653 }1654 }1655 else if(v.task == config.TASK_IMPORTUSERID){1656 var allcount = v.taskparams.data.length;1657 var datatype = v.taskparams.datatype;1658 var str1 = ""; 1659 if(datatype == 'id'){1660 str1 = 'æ¥æ¶å°ç¨æ·ID';1661 }1662 else{1663 str1 = 'æ¥æ¶å°ç¨æ·æµç§°';1664 }1665 var dc = _getintvalue(v.taskparams.select_cursor);1666 infohtm += str1+'ï¼'+allcount+ 'æ¡, å·²å¤çï¼'+dc+'æ¡,';1667 infohtm += ' æ°å¢ç¨æ·'+_getintvalue(v.taskparams.scene.insert_user_count)+'个, æ´æ°ç¨æ·'+_getintvalue(v.taskparams.scene.update_user_count)+'个.';1668 }1669 else if(!v.taskparams.scene.isremote){1670 var datacount = v.datastatus ? v.datastatus : 0;1671 solrerrorcount = solrerrorcount ? solrerrorcount : 0;1672 var startindex = v.taskparams.startdataindex ? v.taskparams.startdataindex : 0;1673 var endindex = v.taskparams.enddataindex ? v.taskparams.enddataindex : 0;1674 var taskinfostr = (startindex == 0 && endindex == 0) ? "å
¨é¨" : "èµ·å§ï¼"+startindex+',ç»æï¼'+endindex;1675 infohtm += 'ä»»å¡éè¦å¤ççï¼'+taskinfostr+ ', å·²å¤çï¼'+datacount+', 失败æ°ï¼<span style="color:red">'+solrerrorcount+'</span>';1676 }1677 if(!v.taskparams.scene.isremote){1678 var resstr = "";1679 if(v.taskparams.scene.res_ip){1680 resstr += "IP:"+v.taskparams.scene.res_ip.resource;1681 resstr += ", appkey:"+v.taskparams.scene.res_ip.appkey;1682 }1683 if(v.taskparams.scene.res_acc){1684 resstr += ", å¸å·:"+v.taskparams.scene.res_acc.resource;1685 }1686 if(resstr != ""){1687 infohtm += "<br/>å½åèµæºï¼"+resstr;1688 }1689 }1690 if(v.taskparams.scene.status_desp != undefined && v.taskparams.scene.status_desp != ""){1691 infohtm += "<br/>ä»»å¡ç¶ææè¿°ï¼"+v.taskparams.scene.status_desp;1692 }1693 if(v.taskparams.scene.error_notext_datas != undefined && v.taskparams.scene.error_notext_datas.length > 0){1694 if(v.task == 9){1695 infohtm += '<br/><span style="color:red;">ç¨æ·ä¸åå¨ç:</span><br/>';1696 }1697 else{1698 infohtm += '<br/><span style="color:red;">å¾®åä¸åå¨ç:</span><br/>';1699 }1700 for(var i=0; i< v.taskparams.scene.error_notext_datas.length; i++){1701 var fixstr = (i == v.taskparams.scene.error_notext_datas.length-1) ? "" : ", ";1702 infohtm += v.taskparams.scene.error_notext_datas[i] + fixstr;1703 }1704 }1705 if(v.taskparams.scene.error_other_datas != undefined && v.taskparams.scene.error_other_datas.length > 0){1706 infohtm += '<br/><span style="color:red;">åçå
¶ä»é误ç:</span><br/>';1707 for(var i=0; i< v.taskparams.scene.error_other_datas.length; i++){1708 var fixstr = (i == v.taskparams.scene.error_other_datas.length-1) ? "" : ", ";1709 infohtm += v.taskparams.scene.error_other_datas[i] + fixstr;1710 }1711 }1712 }1713 if("scene" in task){1714 infohtm += "<br/>è¿è¡ç»æï¼";1715 if(task.scene.duplicate != undefined){1716 infohtm += "éå¤ä»»å¡ä¸ªæ°ï¼"+task.scene.duplicate+", ";1717 }1718 if(task.scene.taskadded != undefined){1719 infohtm += "æ°å¢ä»»å¡ä¸ªæ°ï¼"+task.scene.taskadded+"<br/>";1720 }1721 }1722 return infohtm;1723}1724function printStat(stat)1725{1726 var statstr = "";1727 if(stat.count != undefined){1728 statstr += "æåæ¡æ°ï¼"+stat.count+"<br/>";1729 }1730 if(stat.child != undefined){1731 statstr += "åä»»å¡æ°ï¼"+stat.child+"<br/>";1732 }1733 if(stat.time != undefined){1734 statstr += "æ»æ¶é´ï¼"+stat.time+"æ¯«ç§ ";1735 }1736 if(stat.avg_time != undefined){1737 statstr += "å¹³åæ¶é´ï¼"+stat.avg_time+"æ¯«ç§ ";1738 }1739 if(stat.min_time != undefined){1740 statstr += "æå°æ¶é´ï¼"+stat.min_time+"æ¯«ç§ ";1741 }1742 if(stat.max_time != undefined){1743 statstr += "æ大æ¶é´ï¼"+stat.max_time+"毫ç§<br/>";1744 }1745 if(stat.svr_time != undefined){1746 statstr += "æå¡å¨æ»æ¶é´ï¼"+stat.svr_time+"æ¯«ç§ ";1747 }1748 if(stat.avg_svr_time != undefined){1749 statstr += "æå¡å¨å¹³åæ¶é´ï¼"+stat.avg_svr_time+"æ¯«ç§ ";1750 }1751 if(stat.min_svr_time != undefined){1752 statstr += "æå¡å¨æå°æ¶é´ï¼"+stat.min_svr_time+"æ¯«ç§ ";1753 }1754 if(stat.max_svr_time != undefined){1755 statstr += "æå¡å¨æ大æ¶é´ï¼"+stat.max_svr_time+"毫ç§<br/>";1756 }1757 return statstr;1758}1759var tenantArr = [];1760function getTenantName(tenantid){1761 var tenantname = "";1762 if(tenantid != null){1763 var find = false;1764 $.each(tenantArr, function(ti, titem){1765 if(titem.tenantid == tenantid){1766 tenantname = titem.tenantname;1767 find = true;1768 return false;1769 }1770 });1771 if(!find){1772 $.ajax({1773 type: "GET",1774 dataType: "json",1775 async:false,1776 url: config.modelUrl+"tenant_user_model.php",1777 data: {tid:tenantid, type:"gettenantbyid"},1778 success:function(data){1779 if(data.totalcount > 0){1780 $.each(data.children, function(di, ditem){1781 tenantArr.push({tenantid:ditem.tenantid,tenantname:ditem.tenantname});1782 tenantname = ditem.tenantname;1783 });1784 }1785 else{1786 tenantArr.push({tenantid:tenantid,tenantname:""});1787 }1788 }1789 });1790 }1791 }1792 return tenantname;1793}1794var userArr = [];1795function getUserName(userid){1796 var username = "";1797 if(userid != null){1798 var find = false;1799 $.each(userArr, function(ti, titem){1800 if(titem.userid == userid){1801 username = titem.username;1802 find = true;1803 return false;1804 }1805 });1806 if(!find){1807 $.ajax({1808 type: "GET",1809 dataType: "json",1810 async:false,1811 url: config.modelUrl+"user_model.php",1812 data: {uid:userid, type:"getuserbyid"},1813 success:function(data){1814 if(data.totalcount > 0){1815 $.each(data.children, function(di, ditem){1816 userArr.push({userid:ditem.userid,username:ditem.username});1817 username = ditem.username;1818 });1819 }1820 }1821 });1822 }1823 }1824 return username;...
engine.js
Source:engine.js
...61 INPUT_BASE = 16;62}63function setBaseBinary() {64 for (var i = 0; i < 32; i++) {65 text = getIntValue("#r"+i,BASE)66 n = convertBase(text,2)67 $("#r"+i).text(n+"")68 }69 text = getIntValue("#ir",BASE)70 n = convertBase(text,2)71 $("#ir").text(n+"")72 text = getIntValue("#pc",BASE)73 n = convertBase(text,2)74 $("#pc").text(n+"")75 BASE = 2;76}77function setBaseOctal() {78 for (var i = 0; i < 32; i++) {79 text = getIntValue("#r"+i,BASE)80 n = convertBase(text,8)81 $("#r"+i).text(n+"")82 }83 text = getIntValue("#ir",BASE)84 n = convertBase(text,8)85 $("#ir").text(n+"")86 text = getIntValue("#pc",BASE)87 n = convertBase(text,8)88 $("#pc").text(n+"")89 BASE = 8;90}91function setBaseDecimal() {92 for (var i = 0; i < 32; i++) {93 text = getIntValue("#r"+i,BASE)94 n = convertBase(text,10)95 $("#r"+i).text(n+"")96 }97 text = getIntValue("#ir",BASE)98 n = convertBase(text,10)99 $("#ir").text(n+"")100 text = getIntValue("#pc",BASE)101 n = convertBase(text,10)102 $("#pc").text(n+"")103 BASE = 10;104}105function setBaseHex() {106 for (var i = 0; i < 32; i++) {107 text = getIntValue("#r"+i,BASE)108 n = convertBase(text,16)109 $("#r"+i).text(n+"")110 }111 text = getIntValue("#ir",BASE)112 n = convertBase(text,16)113 $("#ir").text(n+"")114 text = getIntValue("#pc",BASE)115 n = convertBase(text,16)116 $("#pc").text(n+"")117 BASE = 16;118}119var errorRaised = false;120var stopRaised = false;121var memory = {};122function executeAssembly() {123 errorRaised = false;124 stopRaised = false;125 changeRegister("#pc","1");126 var code = assemblyCode.getValue().split("\n");127 while(parseInt($('#pc').text(),BASE)-1<code.length){128 if(errorRaised){129 appendToOutput("ERROR!")130 appendToOutput("ABORTING EXECUTION!")131 break;132 }133 if(stopRaised){134 break;135 }136 handleCode(code[parseInt($('#pc').text(),BASE)-1]);137 }138 // changeRegister("#pc",1);139}140function getFinalCode(operation,operands) {141 opCode = convertBase(getOpCode(operation),2)142 cmd = pad(opCode,6);143 c = operands.length;144 for(var i=0;i<c;i++){145 k = operands[i].replace("r","")146 dat = parseInt(k,INPUT_BASE)147 cmd += pad(convertBase(dat,2),6)148 }149 cmd = padR(cmd,32);150 if(cmd.length>32)151 appendToOutput("Warning : IR exceeds 32 bits! the command wont run on real machine!")152 if(BASE == 2)153 return cmd154 csd = parseInt(cmd,2)155 return convertBase(csd,BASE)156}157function getOpCode(operation) {158 switch (operation.toLowerCase()) {159 case "ld" : return 1;160 case "ldr" : return 2;161 case "la" : return 5;162 case "lar" : return 6;163 case "st" : return 3;164 case "str" : return 4;165 case "br" : return 8;166 case "brl" : return 9;167 case "add" : return 12;168 case "sub" : return 14;169 case "neg" : return 15;170 case "addi" : return 13;171 case "and" : return 20;172 case "andi" : return 21;173 case "or" : return 22;174 case "ori" : return 23;175 case "not" : return 24;176 case "shr" : return 26;177 case "shra" : return 27;178 case "shl" : return 28;179 case "shc" : return 29;180 case "nop" : return 0;181 case "stop" : return 31;182 }183}184function handleCode(line) {185 incrementPC();186 if(VERBOSE)187 appendToOutput("Fetching PC...");188 part = line.split(" ");189 operation = part[0];190 if(part.length>1)191 p = part[1];192 else193 p = ""194 operandsMeta = p195 if(p.includes(";"))196 operandsMeta = part[1].substring(0, part[1].indexOf(';'));197 if(operandsMeta.includes(","))198 operands = operandsMeta.split(",");199 else200 operands = operandsMeta;201 if(operands.length > 3 && !operation.startsWith("brl")){202 raiseError("Unsupported more than 3 bit addressing...");203 }204 pc = $('#pc').text()205 changeRegister('#ir',getFinalCode(operation,operands));206 //everything seems okay so far...207 handleCommand(operation,operands);208}209function changeRegister(registerId,value) {210 try {211 str = registerId.trim().replace("#", "").toUpperCase() + " = " + value;212 $(registerId).text(value)213 if(VERBOSE)214 appendToOutput(str)215 }catch (e) {216 appendToOutput("Error trying to change "+registerId.replace("#", "").toUpperCase())217 }218}219function changeRegisterCustom(registerId,value,message) {220 try {221 str = message.trim().replace("#", "").toUpperCase();222 $(registerId).text(value)223 appendToOutput(str)224 }catch (e) {225 appendToOutput("Error trying to change "+registerId.replace("#", "").toUpperCase())226 }227}228function raiseError(errorInfo) {229 errorRaised = true;230 appendToOutput(errorInfo);231}232function appendToOutput(string){233 if(string.toLowerCase().includes("branching"))234 if(VERBOSE)235 outputCode.replaceRange(string+"\n", CodeMirror.Pos(outputCode.lastLine()))236 else{}237 else238 outputCode.replaceRange(string+"\n", CodeMirror.Pos(outputCode.lastLine()))239}240function incrementPC() {241 val = parseInt($('#pc').text(),BASE) + 1242 changeRegister('#pc',convertBase(val,BASE))243}244function malfunctionCommand() {245 raiseError('Command not supported. Please check the cheat sheat given below');246}247function registerNotFound() {248 raiseError('Required register was not found');249}250function registerExists(id) {251 if(id === "pc")252 return true;253 if(id === "ir")254 return true;255 for (var i=0;i<32;i++)256 if(id === "r"+i)257 return true;258 return false;259}260function getIntValue(registerId,base) {261 return parseInt($(registerId).text(),base);262}263function handleCommand(command,operands) {264 if(command.toLowerCase().includes("br")){265 brOperation(command.toLowerCase(),operands)266 return267 }268 switch (command.toLowerCase()) {269 case "add" :270 addOperation(operands);271 break;272 case "addi" :273 addIOperation(operands);274 break;275 case "neg":276 negOperation(operands);277 break;278 case "sub":279 subOperation(operands);280 break;281 case "and":282 andOperation(operands);283 break;284 case "andi":285 andIOperation(operands);286 break;287 case "or":288 orOperation(operands);289 break;290 case "ori":291 orIOperation(operands);292 break;293 case "not":294 notOperation(operands);295 break;296 case "shr":297 shrOperation(operands);298 break;299 case "shra":300 shraOperation(operands);301 break;302 case "shl":303 shlOperation(operands);304 break;305 case "shc":306 shcOperation(operands);307 break;308 case "nop;":309 case "nop":310 nopOperation(operands);311 break;312 case "stop;":313 case "stop":314 stopOperation(operands);315 break;316 case "ld":317 ldOperation(operands);318 break;319 case "ldr":320 ldOperation(operands);321 break;322 case "la":323 laOperation(operands);324 break;325 case "lar":326 larOperation(operands);327 break;328 case "st":329 stOperation(operands);330 break;331 case "str":332 strOperation(operands);333 break;334 default:malfunctionCommand();335 }336}337function ldrOperation(operands) {338 if (operands.length < 3) {339 if (registerExists(operands[0])) {340 sum = parseInt(operands[1],INPUT_BASE)341 pc = getIntValue('#pc',BASE);342 content = memory[sum+pc]343 if (typeof content === 'undefined'){344 changeRegisterCustom('#' + operands[0], 0, operands[0] + ' = M[' + operands[1] +"+PC] <-- 0")345 }346 else {347 changeRegisterCustom('#' + operands[0], convertBase(content,BASE), operands[0] + ' = M[' + operands[1] +"+PC] <-- " + convertBase(content,BASE))348 }349 } else350 registerNotFound();351 } else {352 malfunctionCommand();353 }354}355function brOperation(command,operands) {356 console.log("Called br")357 if (operands.length <= 4) {358 if(command.includes("brl")){359 handleLinked(command,operands);360 }361 else{362 handleBranch(command,operands);363 }364 } else {365 malfunctionCommand();366 }367}368function handleLinked(command,operands) {369 intPCval = getIntValue("#pc",BASE);370 basePCval = convertBase(intPCval,BASE);371 if(operands.length==4){ //its that C command so check for C =_=372 branchAddress = getIntValue("#"+operands[1],BASE);373 cond = getIntValue("#"+operands[2],BASE);374 test = parseInt(operands[3],INPUT_BASE);375 if(test >= 0 && test <=5){376 switch (test) {377 case 0:378 appendToOutput("branch never... should I do anything here??")379 break;380 case 1:381 changeRegister("#"+operands[0],basePCval)382 changeRegisterCustom("#pc",convertBase(branchAddress,BASE),"Branching to "+operands[1])383 break;384 case 2:385 if(cond==0) {386 changeRegister("#"+operands[0],basePCval)387 changeRegisterCustom("#pc", convertBase(branchAddress, BASE), "Branching to " + operands[1])388 }389 else390 appendToOutput("Not branching as the condition is not met")391 break;392 case 3:393 if(cond!=0) {394 changeRegister("#"+operands[0],basePCval)395 changeRegisterCustom("#pc", convertBase(branchAddress, BASE), "Branching to " + operands[1])396 }397 else398 appendToOutput("Not branching as the condition is not met")399 break;400 case 4:401 if(cond>=0 && cond<parseInt("10000000000000000000000000000000",2)) {402 changeRegister("#"+operands[0],basePCval)403 changeRegisterCustom("#pc", convertBase(branchAddress, BASE), "Branching to " + operands[1])404 }405 else406 appendToOutput("Not branching as the condition is not met")407 case 5:408 if(cond<0 || cond>=parseInt("10000000000000000000000000000000",2)) {409 changeRegister("#"+operands[0],basePCval)410 changeRegisterCustom("#pc", convertBase(branchAddress, BASE), "Branching to " + operands[1])411 }412 else413 appendToOutput("Not branching as the condition is not met")414 }415 }else{416 raiseError("condition not found!")417 }418 }else{419 //phew people are using real thing now...420 branchAddress = ""421 outputN = ""422 if(typeof(operands)==="string") {423 branchAddress = getIntValue("#" + operands, BASE);424 outputN = operands425 }426 else {427 branchAddress = getIntValue("#" + operands[1], BASE);428 outputN = operands[1]429 }430 if(command.includes("nv")){431 appendToOutput("branch never... should I do anything here??")432 }else if(command.includes("zr")){433 cond = getIntValue("#"+operands[2],BASE)434 if(cond==0) {435 changeRegister("#"+operands[0],basePCval)436 changeRegisterCustom("#pc", convertBase(branchAddress, BASE), "Branching to " + outputN)437 }438 else439 appendToOutput("Not branching as the condition is not met")440 }else if(command.includes("nz")){441 cond = getIntValue("#"+operands[2],BASE)442 if(cond!=0) {443 changeRegister("#"+operands[0],basePCval)444 changeRegisterCustom("#pc", convertBase(branchAddress, BASE), "Branching to " + outputN)445 }446 else447 appendToOutput("Not branching as the condition is not met")448 }else if(command.includes("pl")){449 cond = getIntValue("#"+operands[2],BASE)450 if(cond>=0 && cond<parseInt("10000000000000000000000000000000",2)) {451 changeRegister("#"+operands[0],basePCval)452 changeRegisterCustom("#pc", convertBase(branchAddress, BASE), "Branching to " + outputN)453 }454 else455 appendToOutput("Not branching as the condition is not met")456 }else if(command.includes("mi")){457 cond = getIntValue("#"+operands[2],BASE)458 if(cond<0 || cond>=parseInt("10000000000000000000000000000000",2)) {459 changeRegister("#"+operands[0],basePCval)460 changeRegisterCustom("#pc", convertBase(branchAddress, BASE), "Branching to " + outputN)461 }462 else463 appendToOutput("Not branching as the condition is not met")464 }else if(command.trim()==="brl"){465 changeRegister("#"+operands[0],basePCval)466 changeRegisterCustom("#pc",convertBase(branchAddress,BASE),"Branching to "+outputN)467 }468 }469}470function handleBranch(command,operands) {471 if(operands.length==3){ //its that C command so check for C =_=472 branchAddress = getIntValue("#"+operands[0],BASE);473 cond = getIntValue("#"+operands[1],BASE);474 test = parseInt(operands[2],INPUT_BASE);475 if(test >= 0 && test <=5){476 switch (test) {477 case 0:478 appendToOutput("branch never... should I do anything here??")479 break;480 case 1:481 changeRegisterCustom("#pc",convertBase(branchAddress,BASE),"Branching to "+operands[0])482 break;483 case 2:484 if(cond==0)485 changeRegisterCustom("#pc",convertBase(branchAddress,BASE),"Branching to "+operands[0])486 else487 appendToOutput("Not branching as the condition is not met")488 break;489 case 3:490 if(cond!=0)491 changeRegisterCustom("#pc",convertBase(branchAddress,BASE),"Branching to "+operands[0])492 else493 appendToOutput("Not branching as the condition is not met")494 break;495 case 4:496 if(cond>=0 && cond<parseInt("10000000000000000000000000000000",2))497 changeRegisterCustom("#pc",convertBase(branchAddress,BASE),"Branching to "+operands[0])498 else499 appendToOutput("Not branching as the condition is not met")500 case 5:501 if(cond<0 || cond>=parseInt("10000000000000000000000000000000",2))502 changeRegisterCustom("#pc",convertBase(branchAddress,BASE),"Branching to "+operands[0])503 else504 appendToOutput("Not branching as the condition is not met")505 }506 }else{507 raiseError("condition not found!")508 }509 }else{510 //phew people are using real thing now...511 branchAddress = ""512 outputN = ""513 if(typeof(operands)==="string") {514 branchAddress = getIntValue("#" + operands, BASE);515 outputN = operands516 }517 else {518 branchAddress = getIntValue("#" + operands[0], BASE);519 outputN = operands[0]520 }521 if(command.includes("nv")){522 appendToOutput("branch never... should I do anything here??")523 }else if(command.includes("zr")){524 cond = getIntValue("#"+operands[1],BASE)525 if(cond==0)526 changeRegisterCustom("#pc",convertBase(branchAddress,BASE),"Branching to "+outputN)527 else528 appendToOutput("Not branching as the condition is not met")529 }else if(command.includes("nz")){530 cond = getIntValue("#"+operands[1],BASE)531 if(cond!=0)532 changeRegisterCustom("#pc",convertBase(branchAddress,BASE),"Branching to "+outputN)533 else534 appendToOutput("Not branching as the condition is not met")535 }else if(command.includes("pl")){536 cond = getIntValue("#"+operands[1],BASE)537 if(cond>=0 && cond<parseInt("10000000000000000000000000000000",2))538 changeRegisterCustom("#pc",convertBase(branchAddress,BASE),"Branching to "+outputN)539 else540 appendToOutput("Not branching as the condition is not met")541 }else if(command.includes("mi")){542 cond = getIntValue("#"+operands[1],BASE)543 if(cond<0 || cond>=parseInt("10000000000000000000000000000000",2))544 changeRegisterCustom("#pc",convertBase(branchAddress,BASE),"Branching to "+outputN)545 else546 appendToOutput("Not branching as the condition is not met")547 }else if(command.trim()==="br"){548 changeRegisterCustom("#pc",convertBase(branchAddress,BASE),"Branching to "+outputN)549 }550 }551}552function laOperation(operands) {553 if (operands.length < 3) {554 if (registerExists(operands[0])) {555 sum = parseInt(operands[1],INPUT_BASE)556 content = sum557 changeRegisterCustom('#' + operands[0], convertBase(content,BASE), operands[0] + ' = ' + operands[1] +" <-- " + convertBase(content,BASE))558 } else559 registerNotFound();560 } else {561 malfunctionCommand();562 }563}564function strOperation(operands) {565 if (operands.length < 3) {566 if (registerExists(operands[0])) {567 sum = parseInt(operands[1],INPUT_BASE)568 pc = getIntValue("#pc",BASE)569 memory[sum+pc]=getIntValue("#"+operands[0],BASE)570 k = sum+pc571 appendToOutput("M["+convertBase(sum,BASE)+"+PC] = "+convertBase(getIntValue('#'+operands[0],BASE),BASE))572 } else573 registerNotFound();574 } else {575 malfunctionCommand();576 }577}578function stOperation(operands) {579 if (operands.length < 3) {580 if (registerExists(operands[0])) {581 if(operands[1].includes("(")){582 newOp = operands[1].replace("("," ");583 newOp = newOp.replace(")","");584 newOp = newOp.split(" ");585 sum = getIntValue('#'+newOp[1],BASE)586 k = sum+parseInt(newOp[0],INPUT_BASE)587 memory[k] = getIntValue("#"+operands[0],BASE)588 appendToOutput("M["+convertBase(k,BASE)+"] = "+convertBase(getIntValue('#'+operands[0],BASE),BASE))589 return;590 }591 sum = parseInt(operands[1],INPUT_BASE)592 memory[sum]= getIntValue('#'+operands[0],BASE)593 appendToOutput("M["+convertBase(sum,BASE)+"] = "+convertBase(getIntValue('#'+operands[0],BASE),BASE))594 } else595 registerNotFound();596 } else {597 malfunctionCommand();598 }599}600function ldOperation(operands) {601 if (operands.length < 3) {602 if (registerExists(operands[0])) {603 if(operands[1].includes("(")){604 newOp = operands[1].replace("("," ");605 newOp = newOp.replace(")","");606 newOp = newOp.split(" ");607 sum = getIntValue('#'+newOp[1],BASE)608 content = memory[sum+parseInt(newOp[0],INPUT_BASE)];609 if (typeof content === 'undefined'){610 changeRegisterCustom('#' + operands[0], 0, operands[0] + ' = M[' + newOp[0] +"+"+newOp[1]+"] <-- 0")611 }612 else {613 changeRegisterCustom('#' + operands[0], convertBase(content,BASE), operands[0] + ' = M[' + newOp[0] +"+"+newOp[1]+"] <-- " + convertBase(content,BASE))614 }615 return;616 }617 sum = parseInt(operands[1],INPUT_BASE)618 content = memory[sum]619 if (typeof content === 'undefined'){620 changeRegisterCustom('#' + operands[0], 0, operands[0] + ' = M[' + operands[1] +"] <-- 0")621 }622 else {623 changeRegisterCustom('#' + operands[0], convertBase(content,BASE), operands[0] + ' = M[' + operands[1] +"] <-- " + convertBase(content,BASE))624 }625 } else626 registerNotFound();627 } else {628 malfunctionCommand();629 }630}631function nopOperation(operands) {632 appendToOutput("NOP!!!")633}634function stopOperation(operands) {635 stopRaised = true;636 appendToOutput("Stop met, Abort the program");637}638function shcOperation(operands) {639 if (operands.length < 3) {640 malfunctionCommand();641 } else {642 if (registerExists(operands[0]) && registerExists(operands[1]) &&643 registerExists(operands[2])) {644 n = getIntValue('#' + operands[1],BASE);645 d = getIntValue('#' + operands[2],BASE);646 sum = (n << d)|(n >> (32 - d));647 changeRegisterCustom('#' + operands[0], convertBase(sum,BASE), operands[0] + ' = ' + operands[1] + '<<<>>>' + operands[2] + " <-- " + convertBase(sum,BASE))648 } else{649 p = parseInt(operands[2],BASE)650 if(!(typeof p == 'number')){651 registerNotFound();652 }653 else{654 n = getIntValue('#' + operands[1],BASE);655 d = p;656 sum = (n << d)|(n >> (32 - d));657 changeRegisterCustom('#' + operands[0], convertBase(sum,BASE), operands[0] + ' = ' + operands[1] + '<<<>>>' + operands[2] + " <-- " + convertBase(sum,BASE))658 }659 }660 }661}662function shrOperation(operands) {663 if (operands.length < 3) {664 malfunctionCommand();665 } else {666 if (registerExists(operands[0]) && registerExists(operands[1]) &&667 registerExists(operands[2])) {668 sum = getIntValue('#' + operands[1],BASE) >>> getIntValue('#' + operands[2],BASE)669 changeRegisterCustom('#' + operands[0], convertBase(sum,BASE), operands[0] + ' = ' + operands[1] + '>>>' + operands[2] + " <-- " + convertBase(sum,BASE))670 } else {671 p = parseInt(operands[2],BASE)672 if(!(typeof p == 'number')){673 registerNotFound();674 }675 else{676 sum = getIntValue('#' + operands[1],BASE) >>> p677 changeRegisterCustom('#' + operands[0], convertBase(sum,BASE), operands[0] + ' = ' + operands[1] + '>>>' + operands[2] + " <-- " + convertBase(sum,BASE))678 }679 }680 }681}682function shlOperation(operands) {683 if (operands.length < 3) {684 malfunctionCommand();685 } else {686 if (registerExists(operands[0]) && registerExists(operands[1]) &&687 registerExists(operands[2])) {688 sum = getIntValue('#' + operands[1],BASE) << getIntValue('#' + operands[2],BASE)689 changeRegisterCustom('#' + operands[0], convertBase(sum,BASE), operands[0] + ' = ' + operands[1] + '<<' + operands[2] + " <-- " + convertBase(sum,BASE))690 } else{691 p = parseInt(operands[2],BASE)692 if(!(typeof p == 'number')){693 registerNotFound();694 }695 else{696 sum = getIntValue('#' + operands[1],BASE) << p697 changeRegisterCustom('#' + operands[0], convertBase(sum,BASE), operands[0] + ' = ' + operands[1] + '<<' + operands[2] + " <-- " + convertBase(sum,BASE))698 }699 }700 }701}702function shraOperation(operands) {703 if (operands.length < 3) {704 malfunctionCommand();705 } else {706 if (registerExists(operands[0]) && registerExists(operands[1]) &&707 registerExists(operands[2])) {708 sum = getIntValue('#' + operands[1],BASE) >> getIntValue('#' + operands[2],BASE)709 changeRegisterCustom('#' + operands[0], convertBase(sum,BASE), operands[0] + ' = ' + operands[1] + '>>' + operands[2] + " <-- " + convertBase(sum,BASE))710 } else {711 p = parseInt(operands[2],BASE)712 if(!(typeof p == 'number')){713 registerNotFound();714 }715 else{716 sum = getIntValue('#' + operands[1],BASE) >> p717 changeRegisterCustom('#' + operands[0], convertBase(sum,BASE), operands[0] + ' = ' + operands[1] + '>>' + operands[2] + " <-- " + convertBase(sum,BASE))718 }719 }720 }721}722function orOperation(operands) {723 if (operands.length < 3) {724 malfunctionCommand();725 } else {726 if (registerExists(operands[0]) && registerExists(operands[1]) &&727 registerExists(operands[2])) {728 sum = getIntValue('#' + operands[1],BASE) | getIntValue('#' + operands[2],BASE)729 changeRegisterCustom('#' + operands[0], convertBase(sum,BASE), operands[0] + ' = ' + operands[1] + '|' + operands[2] + " <-- " + convertBase(sum,BASE))730 } else731 registerNotFound();732 }733}734function andOperation(operands) {735 if (operands.length < 3) {736 malfunctionCommand();737 } else {738 if (registerExists(operands[0]) && registerExists(operands[1]) &&739 registerExists(operands[2])) {740 sum = getIntValue('#' + operands[1],BASE) & getIntValue('#' + operands[2],BASE)741 changeRegisterCustom('#' + operands[0], convertBase(sum,BASE), operands[0] + ' = ' + operands[1] + '&' + operands[2] + " <-- " + convertBase(sum,BASE))742 } else743 registerNotFound();744 }745}746function andIOperation(operands) {747 if (operands.length < 3) {748 malfunctionCommand();749 } else {750 if (registerExists(operands[0]) && registerExists(operands[1])) {751 if(convertBase(parseInt(operands[2],INPUT_BASE),2).length>32752 || operands[2].length>32) {753 raiseError('Register/constant content exceed 32bits')754 return;755 }756 sum = getIntValue('#' + operands[1],BASE) & parseInt(operands[2],INPUT_BASE)757 changeRegisterCustom('#' + operands[0], convertBase(sum,BASE), operands[0] + ' = ' + operands[1] + '&' + operands[2] + " <-- " + convertBase(sum,BASE))758 } else759 registerNotFound();760 }761}762function orIOperation(operands) {763 if (operands.length < 3) {764 malfunctionCommand();765 } else {766 if (registerExists(operands[0]) && registerExists(operands[1])) {767 if(convertBase(parseInt(operands[2],INPUT_BASE),2).length>32768 || operands[2].length>32) {769 raiseError('Register/constant content exceed 32bits')770 return;771 }772 sum = getIntValue('#' + operands[1],BASE) | parseInt(operands[2],INPUT_BASE)773 changeRegisterCustom('#' + operands[0], convertBase(sum,BASE), operands[0] + ' = ' + operands[1] + '|' + operands[2] + " <-- " + convertBase(sum,BASE))774 } else775 registerNotFound();776 }777}778function negOperation(operands) {779 if (operands.length < 3) {780 if (registerExists(operands[0]) && registerExists(operands[1])) {781 sum = twosComplement('#' + operands[1],BASE)782 if(sum.toString(2).length<=32)783 changeRegisterCustom('#' + operands[0], sum, operands[0] + ' = -' + operands[1] +" <-- " + sum)784 else785 raiseError("Negation exceeds 32bits");786 } else787 registerNotFound();788 } else {789 malfunctionCommand();790 }791}792function notOperation(operands) {793 if (operands.length < 3) {794 if (registerExists(operands[0]) && registerExists(operands[1])) {795 sum = ~getIntValue('#'+operands[1],INPUT_BASE)796 console.log("SUM "+sum)797 console.log(convertBase(sum,BASE));798 changeRegisterCustom('#' + operands[0], convertBase(sum,BASE), operands[0] + ' = !' + operands[1] +" <-- " + convertBase(sum,BASE))799 } else800 registerNotFound();801 } else {802 malfunctionCommand();803 }804}805function twosComplement(registerId,base) {806 bin = pad($(registerId).text(),32);807 console.log("bin = "+bin)808 if(base === 2){}809 else{810 bin = convertBase(bin,2);811 }812 return (~parseInt(bin,2) + 1 >>> 0).toString(base)813 //(~0b11111111111111111111111111111111 + 1 >>> 0).toString(10)814}815function twosComplementSTR(numSTR,base) {816 bin = pad(numSTR,32);817 console.log("bin = "+bin)818 if(base === 2){}819 else{820 bin = convertBase(bin,2);821 }822 return (~parseInt(bin,2) + 1 >>> 0).toString(base)823 //(~0b11111111111111111111111111111111 + 1 >>> 0).toString(10)824}825function addOperation(operands) {826 if (operands.length < 3) {827 malfunctionCommand();828 } else {829 if (registerExists(operands[0]) && registerExists(operands[1]) &&830 registerExists(operands[2])) {831 sum = getIntValue('#' + operands[1],BASE) + getIntValue('#' + operands[2],BASE)832 if(sum.toString(2).length>32){833 raiseError("Sum exceeds 32bits");834 return;835 }836 changeRegisterCustom('#' + operands[0], convertBase(sum,BASE), operands[0] + ' = ' + operands[1] + '+' + operands[2] + " <-- " + convertBase(sum,BASE))837 } else838 registerNotFound();839 }840}841function addIOperation(operands) {842 if (operands.length < 3) {843 malfunctionCommand();844 } else {845 if (registerExists(operands[0]) && registerExists(operands[1])) {846 if(convertBase(getIntValue('#' + operands[1],BASE),2).length>32847 || convertBase(parseInt(operands[2],INPUT_BASE),2).length>32848 || operands[2].length>32) {849 raiseError('Register/constant content exceed 32bits')850 return;851 }852 sum = getIntValue('#' + operands[1],BASE) + parseInt(operands[2],INPUT_BASE)853 if(sum.toString(2).length>32){854 raiseError("Sum exceeds 32bits");855 return;856 }857 sum = convertBase(sum,BASE)858 console.log(sum)859 changeRegisterCustom('#' + operands[0], sum+"", operands[0] + ' = ' + operands[1] + '+' + operands[2] + " <-- " + sum)860 } else861 registerNotFound();862 }863}864function addBin(a, b) {865 var dec = Number(parseInt(a, 2)) + Number(parseInt(b, 2));866 return dec.toString(2);867}868function subOperation(operands) {869 if (operands.length < 3) {870 malfunctionCommand();871 } else {872 if (registerExists(operands[0]) && registerExists(operands[1]) &&873 registerExists(operands[2])) {874 var twosCompStr = twosComplement('#' + operands[2],BASE);875 var newComp = convertBase(parseInt(twosCompStr,BASE),2);876 a = pad(convertBase(getIntValue('#' + operands[1],BASE),2),32);877 sum = addBin(a, newComp);878 if(sum.length === 33){879 //result is positive.880 sum=sum.substring(1,33);881 sum = parseInt(sum,2)882 sum = convertBase(sum,BASE)883 changeRegisterCustom('#' + operands[0], sum, operands[0] + ' = ' + operands[1] + '-' + operands[2] + " <-- " + sum)884 }885 else{886 //result is negative887 sum = parseInt(sum,2)888 sum = convertBase(sum,BASE)889 changeRegisterCustom('#' + operands[0], sum, operands[0] + ' = ' + operands[1] + '-' + operands[2] + " <-- " +sum)890 }...
logger.js
Source:logger.js
...11 Level.prototype.getName = function () {12 return this.name;13 };14 Level.prototype.getLevel = function (val) {15 if (Level.OFF.getIntValue() == val)16 return Level.OFF;17 else if (Level.SEVERE.getIntValue() == val)18 return Level.SEVERE;19 else if (Level.WARNING.getIntValue() == val)20 return Level.WARNING;21 else if (Level.INFO.getIntValue() == val)22 return Level.INFO;23 else if (Level.CONFIG.getIntValue() == val)24 return Level.CONFIG;25 else if (Level.FINE.getIntValue() == val)26 return Level.FINE;27 else if (Level.FINER.getIntValue() == val)28 return Level.FINER;29 else if (Level.FINEST.getIntValue() == val)30 return Level.FINEST;31 else if (Level.ALL.getIntValue