![]() |
【转帖】newbie question trying to extend singledoc with with zoom-w
newbie question: trying to extend singledoc with with zoom_w
newbie question: trying to extend singledoc with with zoom_window func. hi, i looked at the zoom_window example in odamfcapp, but it is sooo complicated and there is lots of stuff that i don't need in my simple case.. i tried to simplify/adjust the zoom_window example, but i can't get it to work. pls help here's what i have: i have a simple dxf file with just 1 polyline in it. attached file. i have a user selected area - rectangle. i have pt1 (upper left corner)and pt2 (bottom right corner) in some device coordinates. model space. now i do the following: //////////////////////////////////////////////////////// oddbobjectptr pvpobj = getdocument()->m_pdb->activeviewportid().safeopenobject(oddb::kforread) ; oddbabstractviewportdataptr pavd(pvpobj); odgsview* pview = m_pdevice->viewat(0); //skip the xworldtoeye transformation, because my dxf is not in wcs but in ucs odgevector3d eyevec = pt2 - pt1; if(odnonzero(eyevec.x) && odnonzero(eyevec.y)) (odnonzero(eyevec.x) && odnonzero(eyevec.y)) { odgepoint3d newpos = pt1 + eyevec / 2.; eyevec.x = fabs(eyevec.x); eyevec.y = fabs(eyevec.y); pview->dolly( newpos.asvector() ); double wf = pview->fieldwidth() / eyevec.x; double hf = pview->fieldheight() / eyevec.y; pview->zoom(odmin(wf, hf)); } pavd->setview(pvpobj, pview); m_pdevice->update(); ///////////////////////////////////////////////////////// this code does zoom, but not corectly and not the selected area. please help - i really need to get it to work. also, i couldn't find the tranformation from device coordinates to ucs?!? i wanted to check device coordinates converted to ucs give me result similar to my polyline coordinates...but i couldn't find the transformation formula?? p.s. i also tried this code with dwg file and used the worldtoeye transformation - same thing! - it does zoom, but not the selected area. thank you in advance //nora attached files hi, quote: i have pt1 (upper left corner)and pt2 (bottom right corner) in some device coordinates. model space. what you mean as "some device coordinates"? you should know what coordinate system you are use - to determine correct transformation. in odamfcapp example, input coordinates is in wcs, but in dolly() and zoom() methods you should use eye coordinate space. quote: also, i couldn't find the tranformation from device coordinates to ucs?!? i wanted to check device coordinates converted to ucs give me result similar to my polyline coordinates...but i couldn't find the transformation formula?? see odamfcapp example. following methods in [editorobject.cpp] file: void odexeditorobject::ucsplane(odgeplane& plane) const bool odexeditorobject::toucstoworld(odgepoint3d& wcspt) const |
所有的时间均为北京时间。 现在的时间是 01:26 PM. |