📄 scanbeam.cpp
字号:
found=true; } else if (found) //only once in here { attached=true; found=false; _BBI.Attach(this); _BBI.toiter(&_BI); //this is the position new records will be inserted //recalculate ysp for the new scanline record->Calc_Ysp(_low); _BI++; } else { //recalculate ysp for the new scanline record->Calc_Ysp(_low); _BI++; } } if (attached) { _BI.toiter(&_BBI); _BBI.Detach(); } } else { _BBI.Attach(this); _BBI.toroot(); _BI.tohead(); while (!_BI.hitroot()) { Record* record=_BI.item(); record->Calc_Ysp(_low); if (!found && (record->Ysp() < _low->GetY())) { found=true; _BBI.toiter(&_BI); } _BI++; } _BI.toiter(&_BBI); _BBI.Detach(); } } else { //because the previous beam was flat the links to remove are //below the last insert position if (_low->GetBinHighest(true)) //is there something to remove { if ( scantype == LINKHOLES ) { _BI.tohead(); while (!_BI.hitroot()) { Record* record=_BI.item(); //records containing links towards the new low node //are links to be removed if ((record->GetLink()->GetEndNode() == _low) || (record->GetLink()->GetBeginNode() == _low) ) { holes = ProcessHoles(false,_I) || holes; } _BI++; } } //on record back bring us to the last inserted record //or if nothing was inserted the record before the last deleted record //if there was no record before the last deleted record this means //we where at the beginning of the beam, so at root //_BI << (lastinserted+1); //_BI--; //if (_BI.hitroot()) //only possible when at the begin of the beam _BI.tohead(); while (!_BI.hitroot()) { Record* record=_BI.item(); //records containing links towards the new low node //are links to be removed if ((record->GetLink()->GetEndNode() == _low) || (record->GetLink()->GetBeginNode() == _low) ) { delete _BI.item(); _BI.remove(); found=true; } else if (found) //only once in here break; else if (record->Ysp() < _low->GetY()) //if flatlinks are not in the beam nothing will be found //this will bring us to the right insertion point break; else _BI++; } } else { //on record back bring us to the last inserted record //or if nothing was inserted the record before the last deleted record //if there was no record before the last deleted record this means //we where at the beginning of the beam, so at root //_BI << (lastinserted+ 1); //_BI--; //if (_BI.hitroot()) //only possible when at the begin of the beam _BI.tohead(); while (!_BI.hitroot()) { Record* record=_BI.item(); if (record->Ysp() < _low->GetY()) break; _BI++; } } } break; case NODELINK: case LINKLINK: { if (_type == NORMAL) { Calc_Ysp(); if (scantype==LINKLINK) foundnew = Process_LinkToLink_Crossings() !=0 || foundnew; else SortTheBeam( false ); } //else beam is already sorted because the added/removed flat links //do not change the ysp of links already there, new non flat links //are inserted in order, as result the beam stays sorted if (_low->GetBinHighest(true)) //is there something to remove { _BI.tohead(); while (!_BI.hitroot()) { Record* record=_BI.item(); //records containing links towards the new low node //are links to be removed if ((record->GetLink()->GetEndNode() == _low) || (record->GetLink()->GetBeginNode() == _low) ) { KBoolLine* line=record->GetLine(); if (scantype==NODELINK) foundnew = Process_PointToLink_Crossings() !=0 || foundnew; line->ProcessCrossings(_I); delete _BI.item(); _BI.remove(); found=true; } //because the beam is sorted on ysp, stop when nothing can be there to remove //and the right insertion point for new links has been found else if ((record->Ysp() < _low->GetY())) break; else _BI++; } } else { _BI.tohead(); while (!_BI.hitroot()) { Record* record=_BI.item(); //because the beam is sorted on ysp, stop when //the right insertion point for new links has been found if ((record->Ysp() < _low->GetY())) break; _BI++; } } } break; default: break; } return foundnew;}/*bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes ){ bool found = false; bool foundnew = false; DL_Iter<Record*> _BBI=DL_Iter<Record*>(); bool attached=false; _low = _I->item()->GetBeginNode(); switch(scantype) { case INOUT: case GENLR: case LINKHOLES: if (_type==NORMAL ) { KBoolLink* link = _low->GetBinHighest(true); if ( link ) //is there something to remove { link->SetRecordNode( NULL ); if ( scantype == LINKHOLES ) { _BI.tohead(); while (!_BI.hitroot()) { Record* record = _BI.item(); //records containing links towards the new low node //are links to be removed if ((record->GetLink()->GetEndNode() == _low) || (record->GetLink()->GetBeginNode() == _low) ) { holes = ProcessHoles(false,_I) || holes; } _BI++; } } _BI.tohead(); while (!_BI.hitroot()) { Record* record=_BI.item(); //records containing links towards the new low node //are links to be removed if ((record->GetLink()->GetEndNode() == _low) || (record->GetLink()->GetBeginNode() == _low) ) { delete _BI.item(); _BI.remove(); found=true; } else if (found) //only once in here { attached=true; found=false; //recalculate ysp for the new scanline record->Calc_Ysp(_low); _BI++; } else { //recalculate ysp for the new scanline record->Calc_Ysp(_low); _BI++; } } } else { _BI.tohead(); while (!_BI.hitroot()) { Record* record=_BI.item(); record->Calc_Ysp(_low); _BI++; } } } else { //because the previous beam was flat the links to remove are //below the last insert position KBoolLink* link; link = _low->GetBinHighest(true); if( link )//is there something to remove { link->SetRecordNode( NULL ); bool linkf = false; _BI.tohead(); while (!_BI.hitroot()) { Record* record = _BI.item(); if (record->GetLink() == link) linkf = true; _BI++; } if ( !linkf ) _BI.tohead(); if ( scantype == LINKHOLES ) { _BI.tohead(); while (!_BI.hitroot()) { Record* record=_BI.item(); //records containing links towards the new low node //are links to be removed if ((record->GetLink()->GetEndNode() == _low) || (record->GetLink()->GetBeginNode() == _low) ) { holes = ProcessHoles(false,_I) || holes; } _BI++; } } //_BI.tonode( link->GetRecordNode() ); //delete _BI.item(); //_BI.remove(); //on record back bring us to the last inserted record //or if nothing was inserted the record before the last deleted record //if there was no record before the last deleted record this means //we where at the beginning of the beam, so at root //_BI << (lastinserted+1); //_BI--; //if (_BI.hitroot()) //only possible when at the begin of the beam //found=false; _BI.tohead(); while (!_BI.hitroot()) { Record* record=_BI.item(); //records containing links towards the new low node //are links to be removed if ((record->GetLink()->GetEndNode() == _low) || (record->GetLink()->GetBeginNode() == _low) ) { if ( link != record->GetLink() ) { break; } if ( link->GetRecordNode() != _BI.node() ) { delete _BI.item(); _BI.remove(); } else { delete _BI.item(); _BI.remove(); } found=true; } else if (found) //only once in here break; else if (record->Ysp() < _low->GetY()) //if flatlinks are not in the beam nothing will be found //this will bring us to the right insertion point break; else _BI++; } } else { //on record back bring us to the last inserted record //or if nothing was inserted the record before the last deleted record //if there was no record before the last deleted record this means //we where at the beginning of the beam, so at root //_BI << (lastinserted+ 1); //_BI--; //if (_BI.hitroot()) //only possible when at the begin of the beam _BI.tohead(); while (!_BI.hitroot()) { Record* record=_BI.item(); if (record->Ysp() < _low->GetY()) break; _BI++; } } } break; case NODELINK: case LINKLINK: { if (_type == NORMAL) { Calc_Ysp(); if (scantype==LINKLINK) foundnew = Process_LinkToLink_Crossings() !=0 || foundnew; else SortTheBeam( false ); } //else beam is already sorted because the added/removed flat links //do not change the ysp of links already there, new non flat links //are inserted in order, as result the beam stays sorted if (_low->GetBinHighest(true)) //is there something to remove { _BI.tohead(); while (!_BI.hitroot()) { Record* record=_BI.item(); //records containing links towards the new low node //are links to be removed if ((record->GetLink()->GetEndNode() == _low) || (record->GetLink()->GetBeginNode() == _low) ) { KBoolLine* line=record->GetLine(); if (scantype==NODELINK) foundnew = Process_PointToLink_Crossings() !=0 || foundnew; line->ProcessCrossings(_I); delete _BI.item(); _BI.remove(); found=true; } //because the beam is sorted on ysp, stop when nothing can be there to remove //and the right insertion point for new links has been found else if ((record->Ysp() < _low->GetY())) break; else _BI++; } } else { _BI.tohead(); while (!_BI.hitroot()) { Record* record=_BI.item(); //because the beam is sorted on ysp, stop when //the right insertion point for new links has been found if ((record->Ysp() < _low->GetY())) break; _BI++; } } } break; default: break; } return foundnew;}*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -