![]() |
【转帖】lineweight and lwdisplay
lineweight and lwdisplay
lineweight and lwdisplay hi, oddbdatabase::setlwdisplay doesn't works in real time, we have to close the active view and reopen it to display the lineweight. can anybody give me a solution to my problem ? regards. hi, it does not work in model space (in paper -- it's ok). i fixed it. for now you can use somthing like this: i tried in odamfcapp: code: class lwdisplayreactor : public oddbdatabasereactor { odrx_no_heap_operators(); odgsdevice* m_pdevice; codamfcappdoc* m_pdoc; static void modellweights(oduint8array& lweights, double scale) { lweights.clear(); lweights.reserve(24); *lweights.append() = oduint8( 2. * scale + 0.5 ); *lweights.append() = oduint8( 2. * scale + 0.5 ); *lweights.append() = oduint8( 2. * scale + 0.5 ); *lweights.append() = oduint8( 2. * scale + 0.5 ); *lweights.append() = oduint8( 2. * scale + 0.5 ); *lweights.append() = oduint8( 2. * scale + 0.5 ); *lweights.append() = oduint8( 2. * scale + 0.5 ); *lweights.append() = oduint8( 2. * scale + 0.5 ); *lweights.append() = oduint8( 6. * scale + 0.5 ); *lweights.append() = oduint8( 6. * scale + 0.5 ); *lweights.append() = oduint8( 8. * scale + 0.5 ); *lweights.append() = oduint8( 10. * scale + 0.5 ); *lweights.append() = oduint8( 10. * scale + 0.5 ); *lweights.append() = oduint8( 12. * scale + 0.5 ); *lweights.append() = oduint8( 14. * scale + 0.5 ); *lweights.append() = oduint8( 16. * scale + 0.5 ); *lweights.append() = oduint8( 18. * scale + 0.5 ); *lweights.append() = oduint8( 20. * scale + 0.5 ); *lweights.append() = oduint8( 20. * scale + 0.5 ); *lweights.append() = oduint8( 24. * scale + 0.5 ); *lweights.append() = oduint8( 26. * scale + 0.5 ); *lweights.append() = oduint8( 28. * scale + 0.5 ); *lweights.append() = oduint8( 30. * scale + 0.5 ); *lweights.append() = oduint8( 30. * scale + 0.5 ); } public: lwdisplayreactor() : m_pdoc(0) , m_pdevice(0) { } void set(odgsdevice* pdevice, codamfcappdoc* pdoc); void headersysvar_lwdisplay_changed(const oddbdatabase* pdb); }; void lwdisplayreactor::headersysvar_lwdisplay_changed(const oddbdatabase* pdb) { if(m_pdevice) { codamfcappdoc* pdoc = m_pdoc; odgsdevice* pdevice = m_pdevice; odgsviewptr pview; oduint32 i; oduint32 numviews = pdevice->numviews(); double lwscale; if(pdb->getlwdisplay()) { oduint8array lweights; modellweights(lweights, pdb->appservices()->getlwdispscale()); for(i = 0; i<numviews; ++i) { pview = pdevice->viewat(i); pview->setlineweightenum(lweights.size(), lweights.getptr()); } } else { lwscale = 0.0; for(i = 0; i<numviews; ++i) { pview = pdevice->viewat(i); pview->setlineweighttodcscale(lwscale); } } // force viewer repaint pdoc->updateallviews(null); } } void lwdisplayreactor::set(odgsdevice* pdevice, codamfcappdoc* pdoc) { if(m_pdoc) m_pdoc->m_pdb->removereactor(this); if(pdevice) pdoc->m_pdb->addreactor(this); m_pdevice = pdevice; m_pdoc = pdoc; } i instantiated this class in cdwgviewer: code: odstaticrxobject<lwdisplayreactor> m_lwdisplayreactor; and called code: m_lwdisplayreactor.set(m_pdevice, static_cast<codamfcappdoc*>(getdocument())); in cdwgviewer::createdevice() and called code: m_lwdisplayreactor.set(0, 0); in cdwgviewer::destroydevice(). also you can just put code inside from headersysvar_lwdisplay_changed() just after switching lwdisplay settingfff">, if you do not need handle changing this setting outside your code via oddbdatabase::setlwdisplay(); last edited by dmitry a. novikov; 28th may 2007 at 11:32 amfff">. |
所有的时间均为北京时间。 现在的时间是 02:37 PM. |