![]() |
【转帖】implementing select function
implementing select function
implementing select function hi i would like to implement a select function that receives a rectangle and that i could have something like an iterator for the selected objects. my true objective is to select points and objects with vertices and be able to link them with polylines or making a polygon. i´m develloping for pocket pc and i'm trying to understand the select function in odamfcapp example but i wasn't able so far. could someone explain to me how this is done?it is crucial for my project... thanks pedro tenreiro odamfcapp contains sample of selection functionality. see cdwgviewer::select() function. sincerely yours, george udov hi, in dd selecting mechanism gives you a feedback via selection reactor passed into call odgsview::select(). so you able ether to collect entities for later use or to perform instant action on them. the mechanism also alows you to choose which part of scene hierarchy you would like to select (space entities only or subentities e.g. entities in nested block) via calling odgidrawabledesc::marktoskip(). dmitry. here is completed code that fills 'sset' array with space entities' ids selected by screen rectagle in specified view. code: voidfff"> myselect(constfff"> oddbobjectid& spaceid, odgsview* pview, constfff"> crect& rc, oddbobjectidarray& sset) { classfff"> selectionreactor : publicfff"> odgsselectionreactor { oddbobjectid m_spaceid; oddbobjectidarray* m_psset; publicfff">: selectionreactor(oddbobjectidarray& sset, constfff"> oddbobjectid& spaceid) : m_psset(&sset) , m_spaceid(spaceid) { m_psset->clear(); } bool fff"> selected(const odgidrawabledesc& drawabledesc) { constfff"> odgidrawabledesc* pdesc = &drawabledesc; whilefff">(pdesc->pparent && pdesc->pparent->persistid != m_spaceid) { // mark drawable to be skipped // (as we don't want to get more 'selected' notifications // from its children) pdesc->marktoskip(truefff">); pdesc = pdesc->pparent; } iffff">(pdesc && pdesc->persistid) { pdesc->marktoskip(truefff">); // regen abort for selected drawable *m_psset->append() = pdesc->persistid; } return truefff">; } } selectionreactor(sset, spaceid); iffff">(rc.top == rc.bottom && rc.left == rc.right) { // todo: implement point select } else { pview->select((odgsdcpoint*)&rc, 2, &selectionreactor); } } |
所有的时间均为北京时间。 现在的时间是 09:49 PM. |