Click or drag to resize

IMcGraphOverlayMapZoomedToImage Method

Convert image coordinates to screen coordinates in the active view.

Namespace:  MediaCy.IQL.Display.Overlays
Assembly:  MediaCy.IQL.Display.Overlays (in MediaCy.IQL.Display.Overlays.dll) Version: 10.0.6912.0
Syntax
VB
Sub MapZoomedToImage ( 
	<OutAttribute> ByRef LongZoomedCoords As Object,
	<OutAttribute> ByRef FloatImageCoords As Object,
	Optional DrawMode As mcGraphOverlayDrawMode = mcGraphOverlayDrawMode.mcgdmScreen
)

Parameters

LongZoomedCoords
Type: SystemObject
Variant containing an array of coordinates to convert (one LONGPOINT or 2 Long values per point).
FloatImageCoords
Type: SystemObject
Variant containing the destination array for the converted coordinates (one SINGLEPOINT or 2 Single values per point). Note that if this is already an array of a compatible type and long enough to hold the results, its type and length will not be changed. If the array needs to be changed, it will be returned as two Single values per result point.
DrawMode (Optional)
Type: MediaCy.IQL.Display.OverlaysmcGraphOverlayDrawMode
Conversion mode.
Remarks
This method will be most useful to users implementing their own tool classes (McGraphToolServer). Otherwise, since coordinates are always exposed in image coordinates, there shouldn't be any need to convert them back to screen coordinates. MapZoomedToImage can also be used to find the current view's Pan, Scroll and Magnification. To do so, just pass in as LongZoomedCoords 0,0 and 1,1. Then the first FloatImageCoords will be the Pan and Scroll, while the difference of the second FloatImageCoords from the first will be the Magnification. Use MapImageToZoomed to convert from unzoomed image coordinates to client coordinates. Note that you will not get a perfect round-trip conversion of MapImageToZoomed followed by MapZoomedToImage for Magnifications other than odd values greater than one.
Examples
VB
'This example can be pasted onto the ThisSession IQStudio Object
Private WithEvents myOvl As McGraphOverlay
Public Sub InitMappingTest()
If ThisApplication.ActiveImage Is Nothing Then
ShutDownMappingTest
Else
Set myOvl = ThisApplication.ActiveImage.AnnotationOverlay
End If
End Sub
Public Sub ShutDownMappingTest()
Set myOvl = Nothing
End Sub
Private Sub myOvl_ObjectMoved(ByVal Overlay As IMcGraphOverlay2, ByVal Object As IMcGraphObj2)
Dim fptImage As SINGLEPOINT, lptZoomed As LONGPOINT
Object.GetPosition fptImage.x, fptImage.y
Overlay.MapImageToZoomed fptImage, lptZoomed, mcgdmScreen
ThisApplication.Output.PrintMessage "Image Position: " + McToText(fptImage) + " Client Coords: " + McToText(lptZoomed)
'Round trip with output conversion of Variant
Dim varImageUnzoomed As Variant
Overlay.MapZoomedToImage lptZoomed, varImageUnzoomed, mcgdmScreen
ThisApplication.Output.PrintMessage "Image Position Unzoomed: " + McToText(varImageUnzoomed)
'Note that you will typically not get a perfect round-trip for most Magnifications
End Sub 'myOvl_ObjectMoved
See Also