WorkingZoomFactor
|
Scope |
Pepso |
|
Type |
Single / Float / 4 byte |
|
Default |
1.0 |
|
.NET |
PeGrid.Zoom.WorkingFactor |
|
Ocx|Vcl |
WorkingZoomFactor |
|
DLL |
PEP_fWORKINGZOOMFACTOR |
Purpose
Gets or sets current zoom factor or zoom level. Defined as ratio of logical size of chart compared to size of currently zoomed selection rectangle.
Comments
PeGrid.Zoom.WorkingFactor members of Pepso.PeGrid.Zoom
This is a complex set of features, and understanding how it works will take some time in the process of working with this feature to dynamically generate a zoomed state targeting some desired coordinate,
To re-establish some previous zoomed state, you have to read ZoomOffsetPixelX
and Y, then you should also store the current WorkingZoomFactor.
First to show how we get the offset type properties...
m_nZoomOffsetX = rect2.left ;
m_nZoomOffsetY = rect2.top;
// Offset is then offset from PEP_rectAXIS, you can read via
RECT m_rectCircle;
PEvget (hPE, PEP_rectAXIS, &m_rectCircle);
// Integer based offset
m_nZoomOffsetX -= m_rectCircle.left;
m_nZoomOffsetY -= m_rectCircle.top;
// Float based offset
m_fZoomOffsetX = ((float) m_nZoomOffsetX) / (float) ((m_rectCircle.right -
m_rectCircle.left));
m_fZoomOffsetY = ((float) m_nZoomOffsetY) / (float) ((m_rectCircle.bottom -
m_rectCircle.top));
ZoomFactor is caclulated via...
Note: rect is PEP_rectGRAPH
Note: rect2: Left/Top is related to ZoomOffsetPixelX and ZoomOffsetPixel, and
Right/Bottom (in our code) is the extents the user zoomed to via the mouse
selection zoom coordinates of bottom right.
float l1 = (float) rect.right - rect.left;
float l2 = (float) rect2.right - rect2.left;
if (!m_bZoomMode) // as relates to ZoomMode and just fyi
{
if (m_nZoomInterfaceOnly) // as relates to ZoomInterfaceOnly and just fyi
{
m_fZIOZoomFactor = (l1) / (l2);
m_fZIOZoomFactor -= 1.0F;
m_fZIOZoomFactor /= 2.0F;
}
else
{
m_fZoomFactor = (l1) / (l2);
m_fZoomFactor -= 1.0F;
m_fZoomFactor /= 2.0F;
}
}
else
{
if (m_nZoomInterfaceOnly)
m_fZIOZoomFactor = oldZoomFactor * ( (l1) / (l2) );
else
m_fZoomFactor = oldZoomFactor * ( (l1) / (l2) );
}
If ZoomMode is currently true, the only way to know ZoomFactor is to know
the last ZoomFactor. As you zoom the factor changes upon itself.
ZoomFactor is ultimately the ratio of the width of PEP_rectAXIS (which in this case is the large logical rect holding the total area of the circlular polar grid) divided by the width of PEP_rectGRAPH which is the screen coordinates which happens to be bound/contained within PEP_rectAXIS.
|