The pan function in the CADCamera class allows users to move the camera along its local x and y axes.
The CADViewer sample demonstrates this functionality. See Samples.
The following Pan sample illustrates how you use the pan function:
C# |
Copy Code |
using System.IO;
using ImageGear.Formats;
using ImageGear.Formats.CAD;
public static void CameraPan(string path, double x, double y)
{
ImGearCADPage page = null;
// Load the file.
using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read))
{
page = (ImGearCADPage)ImGearFileFormats.LoadPage(fileStream);
}
// Pan the camera
page.Camera.Pan(x, y);
} |
VB.NET |
Copy Code |
Imports System.IO
Imports ImageGear.Formats
Imports ImageGear.Formats.CAD
Public Sub CameraPan(path As String, x As Double, y As Double)
Dim page As ImGearCADPage
' Load the file.
Using fileStream As New FileStream(path, FileMode.Open, FileAccess.Read)
page = ImGearFileFormats.LoadPage(fileStream)
End Using
' Pan the camera
page.Camera.Pan(x, y)
End Sub |
The Pan function is generally used for changing position relative to a certain point. If you wish to simply go to a specific position in the view, use the page.Camera.LookAt(x, y, z) or page.Camera.SetPosition(x, y, z) functions where x, y, and z are integers representing the position of the camera on the respective global axes.