I've drawn in Autocad a rectangle (0,0,100,100). Then I added two circles (outline ellipses in terms of DWFx), both with center in (50,50). Radius of the first one = 25, radius of the second one = 50. Then I exported the drawing to dwfx with view set to rectangle (-50,-50, 150, 150). It looks ok in Design Review. However I've got problems when loading the drawing with dwf toolkit. Namely, coordinates of ellpises are 100% corrected and after applying appropriate transformation (scale and offset from transformation matrix) I receive back point (50,50) and corresponding radius. But the coordinates of polyline (corresponding to the rectangle) are a bit wierd (y is negative) and afer the same transformation I receive different points than in original drawing. I checked the distanes and they are ok -> the scale factor is ok but there is something wrong with offset. Thus, the rectnagle is placed in wrong location and its enter doesn't coincide with the ellpises' centers any more. I attach the dwfx file. Where should I look for some informationn about that offset?
Thank you for your question.
Please send us a snapshot of you source code to research; I haven’t found any special transform setting of the rectangle.
then I store Vm_inv and calculate coordinates of the points (with respect to viewports origin) by
assuming that origin of the viewport in real world coordinates can be calculated as follows:
box = const_cast<WT_Contour_Set&>(*viewport.contour()).b
_offsetInfo._x = box.minpt().m_x;
_offsetInfo._y = box.minpt().m_y;
tmp_origin(Vm_inv(3,0), Vm_inv(3,1), 0 );
tmp_origin.x = (-tmp_origin.x) - (Vm_inv(0,0) * _offsetInfo._x);
tmp_origin.y = (-tmp_origin.y) - (Vm_inv(1,1) * _offsetInfo._y);
I investigated the dwfx file manually, after changing it into zip archive and I found that outline_ellipse is saved as an entry in a xml file while square (polyline) is saved in FixedPage.fpage file. I suppose it could mean that there are two different transforms to be applied (one for coordinates of ellipse and the other for polyline). Am I right?
I had exactly the same issues, and after researching it and looking at the example files, you basically goto ensure that the pahelayout defiination is correct, to help this is the code I use, and fixes it nicely :-)
// first get our graphics resource.
DWFGraphicResource *pGraphicResource = dynamic_cast< DWFGraphicResource *>(m_piXamlStrmRes->get());
// now we can get our transformation, as follows for the definePageLayout.
// next get our plot section
DWFEPlotSection *pPlotSection = dynamic_cast<DWFEPlotSection*>( m_pSection );
// and finally setup the Page Layout.
pxFile->definePageLayout( oTransform, pPlotSection->paper()->width(), pPlotSection->paper()->height(), 1);
I hope this helps, if you look at the xaml example in the dwf toolkit, the above code should make sense.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.