On 09/25/2015 11:12 PM, Mike Gibson wrote: > The software that we are creating needs a way for the user to enter in a > zoom level and xy position that they want to use for the wxArt2d canvas.
This here might give you a hint, also search for the word zoom in that file, man examples on how to change zoom. bool a2dCanvasCommandProcessor::Zoom( double x1, double y1, double x2, double y2, bool upp ) > It also needs a way for the user to set zoom with the mouse, and then You mean using a zoom tool?? > populate the fields by clicking a button. ?? Don't understand this. > > I currently don't see a way to retrieve the zoom level. Is there a way > to do this? Zoomlevel?? How is that defined? The canvas is simply a certain size in world coordinates. Your program what and how much can be zoomed in or out etc. Search things like this (drawing.cpp). else if ( event.GetId() == CmdMenu_ZoomOut2().GetId() ) { found = true; a2dDrawingPart* drawer = a2dCanvasGlobals->GetActiveDrawingPart(); if ( !drawer ) return; if ( !drawer->GetDisplayWindow() ) return; a2dDrawer2D* dr = drawer->GetDrawer2D(); if ( !dr ) return; int dx, dy; drawer->GetDisplayWindow()->GetClientSize( &dx, &dy ); if ( dy > dx ) dx = dy; dr->SetMappingUpp( dr->GetVisibleMinX() - dr->GetUppX()*dx*( m_zoomfactor*0.5 - 0.5 ), dr->GetVisibleMinY() - dr->GetUppY()*dy*( m_zoomfactor*0.5 - 0.5 ), dr->GetUppX() * m_zoomfactor, dr->GetUppY() * m_zoomfactor ); > > And if the user currently enters in a zoom level and position, the only > function I've seen that seems to be made for this is > a2dCanvas::ZoomOutXy(), but when I enter in values, it doesn't behave as > expected (what units is ZoomOutXy expecting for x,y, and zoom?). void a2dCanvas::ZoomOutAtXy( int x, int y, double n ) Is to zoom out at a certain position, and n is the amount, x,y, in mouse coordinates. > Ideally, I would like the user to be able to enter the zoom value as a > percentage of the defined image extents, Which image? > and be able to enter in xy > coordinates in world units, and then have the a2dCanvas zoom to the > level and position. There are no levels. You need to tell with a2dDrawingPart::SetMappingUpp and others like that, what will be the worldcoordinates you want to see. > And when they click the button, I'd like the same > type of information returned: xy coords in world, and the zoom level > expressed as a percentage of the defined image extents. I think you need to calculate this your self, the information on what is show on the canvas is availble, the rest is for you to do. If you have an a2dDrawing with objects in it (e.g. one image), a2dCanvas/a2dDrawingPart, can display part of that. Which part , is defined in coordinates used in the drawing (world). Class a2dDrawer2D with SetMappingXXX is what you need to study. This is the class used to draw, and here is defined what is shown on the canvas etc. Some of them are available from a2dCanvas directly (wrapped ). Hope it helps, it is not very clear to me what you are trying to do. regards, Klaas > > What suggestions do people have for accomplishing this? > > > Thanks, > - Mike > > ------------------------------------------------------------------------------ > _______________________________________________ > Wxart2d-users_dev mailing list > Wxart2d-users_dev@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wxart2d-users_dev > ------------------------------------------------------------------------------ _______________________________________________ Wxart2d-users_dev mailing list Wxart2d-users_dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxart2d-users_dev